KG_Chat_Empowerment

Enhance the chat abilities

// ==UserScript==
// @name         KG_Chat_Empowerment
// @namespace    klavogonki
// @version      1.0.1
// @description  Enhance the chat abilities
// @author       Patcher
// @match        *://klavogonki.ru/g*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=klavogonki.ru
// @grant        none
// ==/UserScript==

(()=>{"use strict";var e={56:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},72:e=>{var t=[];function n(e){for(var n=-1,o=0;o<t.length;o++)if(t[o].identifier===e){n=o;break}return n}function o(e,o){for(var a={},r=[],i=0;i<e.length;i++){var l=e[i],c=o.base?l[0]+o.base:l[0],d=a[c]||0,m="".concat(c," ").concat(d);a[c]=d+1;var p=n(m),u={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)t[p].references++,t[p].updater(u);else{var g=s(u,o);o.byIndex=i,t.splice(i,0,{identifier:m,updater:g,references:1})}r.push(m)}return r}function s(e,t){var n=t.domAPI(t);n.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,s){var a=o(e=e||[],s=s||{});return function(e){e=e||[];for(var r=0;r<a.length;r++){var i=n(a[r]);t[i].references--}for(var l=o(e,s),c=0;c<a.length;c++){var d=n(a[c]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}a=l}}},113:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},208:(e,t,n)=>{n.d(t,{A:()=>i});var o=n(601),s=n.n(o),a=n(314),r=n.n(a)()(s());r.push([e.id,'.empowerment-button {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  width: 48px;\n  height: 48px;\n  cursor: pointer;\n  background-color: #212226;\n  border: 1px solid #45474b;\n}\n\n/* input error indication */\n.input-error {\n  transition: background-color 300ms ease-in-out;\n  background-color: #6b2f2f !important;\n}\n\n/* chat length popup on field type with dynamic movement horizontally */\n.length-field-popup {\n  position: absolute;\n  font: bold 12px Montserrat;\n  bottom: 40px;\n  transition: left 100ms ease-out;\n  height: 20px;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  padding: 2px 4px;\n  margin: 2px;\n  opacity: 0;\n  border: none !important;\n}\n\n.bounce-in {\n  animation: bounceIn 500ms forwards;\n}\n\n@keyframes bounceIn {\n  0% {\n    transform: translateY(0);\n    opacity: 0;\n  }\n\n  50% {\n    transform: translateY(-10px);\n    opacity: 1;\n  }\n\n  100% {\n    transform: translateY(0);\n    opacity: 1;\n  }\n}\n\n.bounce-out {\n  animation: bounceOut 500ms forwards;\n}\n\n@keyframes bounceOut {\n  0% {\n    transform: translateY(0);\n    opacity: 1;\n  }\n\n  50% {\n    transform: translateY(-10px);\n    opacity: 1;\n  }\n\n  100% {\n    transform: translateY(0);\n    opacity: 0;\n  }\n}\n\n/* catalogs panel && personal messages panel messages anchors color */\n.chat-logs-panel .message-text a,\n.cached-messages-panel .message-text a {\n  color: burlywood !important;\n  transition: color 0.15s ease-in-out;\n}\n\n.chat-logs-panel .message-text a:hover,\n.cached-messages-panel .message-text a:hover {\n  color: lightgoldenrodyellow !important;\n}\n\n/* Empowerment panel */\n.empowerment-panel {\n  position: fixed;\n  top: 50%;\n  transform: translateY(-100%);\n  right: 15px;\n  display: flex;\n  flex-direction: column;\n  z-index: 1000;\n  gap: 0.2em;\n}\n\n/* Chat user count element */\n.participant-count {\n  filter: grayscale(100%);\n  transition: 0.2s ease-in-out;\n  font-family: \'Orbitron\', sans-serif;\n  font-size: 24px;\n  color: #83cf40;\n  background-color: #2b4317;\n  width: 48px;\n  height: 48px;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  border: 1px solid #4b7328;\n  cursor: default;\n}\n\n.pulse-effect {\n  animation: pulse 500ms ease-out;\n}\n\n@keyframes pulse {\n  0% {\n    filter: brightness(1);\n  }\n\n  50% {\n    filter: brightness(1.5);\n  }\n\n  100% {\n    filter: brightness(1);\n  }\n}\n\n.shake-effect {\n  animation: shake 500ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;\n}\n\n@keyframes shake {\n  0% {\n    transform: translateX(0);\n  }\n\n  10% {\n    transform: translateX(-4px);\n  }\n\n  20% {\n    transform: translateX(6px);\n  }\n\n  30% {\n    transform: translateX(-8px);\n  }\n\n  40% {\n    transform: translateX(8px);\n  }\n\n  50% {\n    transform: translateX(-6px);\n  }\n\n  60% {\n    transform: translateX(5px);\n  }\n\n  70% {\n    transform: translateX(-3px);\n  }\n\n  80% {\n    transform: translateX(2px);\n  }\n\n  90% {\n    transform: translateX(-1px);\n  }\n\n  100% {\n    transform: translateX(0);\n  }\n}\n\n.custom-tooltip-popup {\n  position: fixed;\n  background: rgb(22, 22, 22);\n  color: rgb(222, 222, 222);\n  padding: 0.5em;\n  z-index: 1200;\n  font-size: 0.9em;\n  pointer-events: none;\n  white-space: nowrap;\n  opacity: 0;\n  transition: opacity 0.1s;\n  display: none;\n  left: 0;\n  top: 0;\n  border: 1px solid rgb(60, 60, 60) !important;\n  border-radius: 4px !important;\n  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3) !important;\n}\n\n.static-chat-notification {\n  cursor: default;\n  white-space: nowrap;\n  padding: 8px;\n  display: inline-flex;\n  flex: 0 auto;\n  justify-content: center;\n  margin: 4px;\n  font-size: 1em;\n  align-items: center;\n  border-radius: 4px !important;\n}\n\n.dynamic-chat-notifications-container {\n  z-index: 1000;\n  width: 0;\n  position: fixed;\n  display: flex;\n  flex-direction: column;\n  top: 0;\n  bottom: 0;\n  left: 0;\n  right: 0;\n  padding-top: 160px;\n}\n\n.dynamic-chat-notification {\n  cursor: default;\n  white-space: nowrap;\n  position: relative;\n  align-items: center;\n  width: fit-content;\n  display: flex;\n  margin-bottom: 0.2em;\n  padding: 8px 16px 8px 12px;\n  border-radius: 0 4px 4px 0 !important;\n  left: 0;\n  transform: translateX(-100%);\n  opacity: 1;\n  transition: transform 0.3s cubic-bezier(0.83, 0, 0.17, 1), opacity 0.3s cubic-bezier(0.83, 0, 0.17, 1);\n}\n\n/* For both (static and dynamic) notifications */\n.user-enter {\n  color: hsl(100, 50%, 50%) !important;\n  background-color: hsl(100, 50%, 10%) !important;\n  border: 1px solid hsl(100, 50%, 25%) !important;\n}\n\n.user-left {\n  color: hsl(0, 50%, 70%) !important;\n  background-color: hsl(0, 50%, 15%) !important;\n  border: 1px solid hsl(0, 50%, 40%) !important;\n}\n\n/* convertImageLinksToImage */\n.clickable-thumbnail {\n  display: flex !important;\n  opacity: 1;\n  transition: opacity 0.15s ease-in-out;\n  border: none !important;\n  max-width: 150px;\n  max-height: 150px;\n  cursor: pointer;\n  background-color: transparent;\n  margin: 6px;\n  overflow: hidden !important;\n}\n\n.clickable-thumbnail:hover {\n  opacity: 0.8;\n}\n\n.clickable-thumbnail img {\n  max-height: 100%;\n  max-width: 100%;\n  background-color: transparent;\n  object-fit: contain;\n}\n\n.scaled-thumbnail {\n  top: 50%;\n  left: 50%;\n  transform-origin: center center;\n  transform: translate(-50%, -50%) scale(1);\n  position: fixed;\n  opacity: 0;\n  z-index: 1000;\n  transform-origin: center center;\n  max-height: 90vh;\n  max-width: 90vw;\n  cursor: pointer;\n  border-radius: 0.6em !important;\n  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.28) !important;\n}\n\n/* convertVideoLinksToPlayer */\n.video-wrapper {\n  display: flex;\n  flex-direction: column;\n}\n\n.video-wrapper .processed-video {\n  margin-bottom: 0.2em !important;\n}\n\n.video-wrapper .youtube-info {\n  display: flex;\n  flex-direction: column;\n  margin-bottom: 0.2em;\n  font-family: "Montserrat", sans-serift;\n  font-size: 0.9em;\n  color: #8ede87;\n  font-weight: 500;\n  white-space: break-spaces;\n}\n\n.video-container,\n.youtube-thumb {\n  border-radius: 0.4em !important;\n  display: flex;\n  border: none;\n  height: 200px !important;\n  width: 356px !important\n}\n\n.youtube-thumb {\n  cursor: pointer !important;\n  object-fit: cover !important;\n}\n\n/* Dimming element */\n.dimming-background {\n  background: black;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  position: fixed;\n  opacity: 0;\n  z-index: 998;\n}\n\n/* loadProfileIntoIframe */\n.profile-iframe-container {\n  opacity: 0;\n  border: none;\n  display: flex;\n  position: fixed;\n  z-index: 1001;\n  width: 75vw;\n  min-width: 1000px;\n  height: 80vh;\n  top: 48.5vh;\n  left: 50vw;\n  transform: translate(-50%, -50%);\n  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08) !important;\n  border-radius: 0.6em !important;\n}\n\n.scroll-buttons-container {\n  display: flex;\n  justify-content: center;\n  grid-area: scroll;\n  flex-direction: column;\n  height: calc(100% - 1em);\n  padding: 1em;\n}\n\n.scroll-buttons-container .scroll-button {\n  margin: 0.25em 0;\n  background-color: rgba(222, 222, 222, 0.1);\n}\n\n/* Common styles for all panel header buttons */\n.large-button {\n  width: 48px;\n  height: 48px;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  cursor: pointer;\n  border-radius: 0.2em !important;\n  filter: brightness(1);\n  transition: filter 0.3s ease, opacity 0.3s ease;\n}\n\n.large-button:hover {\n  filter: brightness(0.8);\n}\n\n.panel-control-buttons {\n  display: flex;\n}\n\n.panel-control-buttons>div:not(:first-child) {\n  margin-left: 0.5em;\n}\n\n/* Common background color for all panel header buttons */\n.panel-header-clear-button {\n  background-color: brown;\n}\n\n.panel-header-close-button {\n  background-color: darkolivegreen;\n}\n\n.panel-header-save-button {\n  display: none;\n  opacity: 0;\n  visibility: hidden;\n  background-color: #2f6b63;\n}\n\n.panel-header-import-button {\n  background-color: #502f6b;\n}\n\n.panel-header-export-button {\n  background-color: #2f4c6b;\n}\n\n.panel-header-copy-button,\n.panel-header-date-button {\n  background-color: steelblue;\n}\n\n.panel-header-toggle-button {\n  background-color: #144e9d;\n}\n\n.panel-header-toggle-media-messages {\n  background-color: darkslategray;\n}\n\n.toggle-mention-messages-button {\n  background-color: saddlebrown;\n}\n\n.panel-header-one-day-back-button,\n.panel-header-one-day-forward-button {\n  background-color: darkcyan;\n}\n\n.panel-header-shuffle-button {\n  background-color: darkslateblue;\n}\n\n/* New chat user list */\n#chat-general .userlist-content {\n  opacity: 0;\n}\n\n#chat-general .smile-tab {\n  position: relative;\n  z-index: 1;\n}\n\n.chat-user-list {\n  display: flex;\n  flex-direction: column;\n  position: absolute;\n  top: 20px;\n  padding-top: 8px;\n  width: 200px;\n  height: 94%;\n  overflow-y: auto;\n  overflow-x: hidden;\n}\n\n.chat-user-list [class^="rank-group"] {\n  display: flex;\n  flex-direction: column;\n}\n\n.chat-user-list [class^="user"] {\n  display: inline-flex;\n  margin: 2px 0;\n}\n\n.chat-user-list .avatar {\n  width: 24px;\n  height: 24px;\n  display: inline-flex;\n}\n\n.chat-user-list .avatar img,\n.fetched-users .avatar img {\n  border-radius: 0.2em !important;\n  transform-origin: left;\n  transition: transform 0.15s;\n}\n\n.chat-user-list .avatar img:hover,\n.fetched-users .avatar img:hover {\n  transform: scale(2);\n}\n\n.chat-user-list .name {\n  text-decoration: none;\n  display: inline-flex;\n  width: auto;\n  height: 24px;\n  line-height: 24px;\n  padding: 0 8px;\n  max-width: 124px;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n\n.chat-user-list .name:hover {\n  text-decoration: underline;\n}\n\n.chat-user-list .profile,\n.chat-user-list .tracked,\n.chat-user-list .ignored,\n.chat-user-list .moderator {\n  display: inline-flex;\n  width: 24px;\n  height: 24px;\n  justify-content: center;\n  align-items: center;\n}\n\n/* Highlight for mention words */\n.mention {\n  display: inline-flex;\n  color: #83cf40;\n  font-family: Roboto Mono, monospace;\n  font-weight: bold;\n}\n\n/* Chat popup messages */\n.popup-messages-container {\n  display: flex;\n  flex-direction: column;\n  justify-content: flex-end;\n  align-items: start;\n  user-select: none;\n  pointer-events: none;\n  position: fixed;\n  left: 0;\n  right: 0;\n  top: 50px;\n  bottom: 0;\n}\n\n.popup-chat-message {\n  display: flex;\n  align-items: center;\n  background-color: hsl(100, 50%, 10%);\n  position: relative;\n  max-width: 70vw;\n  border-radius: 0.2em !important;\n  color: hsl(100, 50%, 50%);\n  border: 1px solid hsl(100, 50%, 25%);\n  padding: 4px;\n  margin: 6px 15vw;\n  opacity: 0;\n  transform: translateY(20px);\n  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;\n  animation: fadeIn 0.3s ease-in-out forwards;\n}\n\n@keyframes fadeIn {\n  from {\n    opacity: 0;\n    transform: translateY(20px);\n  }\n\n  to {\n    opacity: 1;\n    transform: translateY(0);\n  }\n}\n\n.popup-chat-message.fade-out {\n  animation: fadeOut 0.3s ease-in-out forwards;\n}\n\n@keyframes fadeOut {\n  from {\n    opacity: 1;\n    transform: translateY(0);\n  }\n\n  to {\n    opacity: 0;\n    transform: translateY(-20px);\n  }\n}\n\n.popup-chat-message>div {\n  padding: 2px;\n  display: flex;\n  font-family: \'Montserrat\', sans-serif;\n}\n\n.popup-chat-message .time,\n.popup-chat-message .time-icon {\n  opacity: 0.7;\n}\n\n/* Empowerment voice settings (Ctrl + Alt) */\n.voice-settings {\n  position: absolute;\n  top: 65px;\n  right: 70px;\n  opacity: 0;\n  transition: opacity 0.3s ease;\n  font-family: Orbitron, sans-serif;\n}\n\n/* Basic styles for empowerment voice settings */\n.voice-value-info {\n  display: flex;\n  width: 100%;\n  justify-content: center;\n  margin-bottom: 6px;\n}\n\n/* voice speed */\n.voice-speed {\n  color: hsl(100, 50%, 50%);\n}\n\n.voice-speed-progress {\n  display: block;\n  width: 120px;\n  height: 12px;\n  background-color: hsl(90, 60%, 30%);\n}\n\n.voice-speed-progress-fill {\n  display: block;\n  height: 100%;\n  background-color: hsl(90, 60%, 50%);\n}\n\n/* voice pitch */\n.voice-pitch {\n  color: hsl(180, 60%, 50%);\n}\n\n.voice-pitch-progress {\n  display: block;\n  width: 120px;\n  height: 12px;\n  background-color: hsl(180, 60%, 30%);\n}\n\n.voice-pitch-progress-fill {\n  display: block;\n  height: 100%;\n  background-color: hsl(180, 60%, 50%);\n}\n\n/* Tablets (768px to 991px) */\n@media (max-width: 991px) {\n  .scroll-buttons-container {\n    position: absolute !important;\n    right: 0.5em !important;\n    justify-content: end !important;\n  }\n}\n\n/* Very Small Screens (up to 630px) */\n@media (max-width: 630px) {\n  .scroll-buttons-container {\n    display: none !important;\n  }\n}',""]);const i=r},314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,s,a){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var i=0;i<this.length;i++){var l=this[i][0];null!=l&&(r[l]=!0)}for(var c=0;c<e.length;c++){var d=[].concat(e[c]);o&&r[d[0]]||(void 0!==a&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=a),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),s&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=s):d[4]="".concat(s)),t.push(d))}},t}},344:(e,t,n)=>{n.d(t,{A:()=>i});var o=n(601),s=n.n(o),a=n(314),r=n.n(a)()(s());r.push([e.id,"/* showCachePanel */\n.cached-users-panel {\n  opacity: 0;\n  background-color: #1b1b1b;\n  border-radius: 0.6em !important;\n  position: fixed;\n  top: 100px;\n  left: 50%;\n  transform: translateX(-50%);\n  width: 80vw;\n  height: 80vh;\n  z-index: 1000;\n  display: grid;\n  grid-template-columns: 1fr;\n  grid-template-rows: min-content;\n  grid-template-areas:\n    \"header header\"\n    \"cache scroll\";\n}\n\n.cached-users-panel .panel-header {\n  display: flex;\n  flex-direction: row;\n  justify-content: space-between;\n  padding: 0.6em;\n  grid-area: header;\n}\n\n.cached-users-panel .drop-time {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  min-width: fit-content;\n}\n\n.cached-users-panel .drop-time-threshold-description {\n  padding: 0.6em;\n  color: #c6b209;\n}\n\n.cached-users-panel .drop-time-threshold {\n  padding: 0.6em;\n  color: lightcoral;\n  font-family: 'Roboto Mono', monospace;\n  font-size: 1.1em;\n  font-weight: bold;\n  border-radius: 0.2em !important;\n  border: 1px solid rgba(240, 128, 128, 0.20);\n  background-color: rgba(240, 128, 128, 0.05);\n  transition: filter 0.3s;\n  filter: sepia(0);\n  cursor: pointer;\n}\n\n.cached-users-panel .drop-time-threshold:hover {\n  filter: sepia(1);\n}\n\n.cached-users-panel .drop-time-expiration-description {\n  padding: 0.6em;\n  color: #d0562c;\n}\n\n.cached-users-panel .drop-time-expiration {\n  padding: 0.6em;\n  color: antiquewhite;\n  font-family: 'Roboto Mono', monospace;\n  font-size: 1.1em;\n}\n\n.cached-users-panel .search-for-cached-users {\n  width: 100%;\n  margin: 0 0.5em;\n  display: flex;\n}\n\n.cached-users-panel .cached-users-search-input {\n  outline: none;\n  height: 48px;\n  width: 100%;\n  padding: 10px;\n  font-size: 1em;\n  font-family: 'Montserrat';\n  color: bisque !important;\n  border-radius: 0.2em !important;\n  box-sizing: border-box;\n  background-color: #111;\n  border: 1px solid #222;\n}\n\n.cached-users-panel .error-message {\n  width: fit-content;\n  white-space: nowrap;\n  font-family: 'Montserrat';\n  color: lightcoral;\n}\n\n.fetch-mode-button {\n  background-color: #b2a4f9;\n}\n\n.fetch-mode-button svg {\n  stroke: darkslateblue;\n}\n\n.cache-mode-button {\n  background-color: darkslateblue;\n}\n\n.cache-mode-button svg {\n  stroke: #b2a4f9;\n}\n\n.cached-users-panel .fetched-users {\n  display: grid;\n  grid-template-rows: 1fr 1fr;\n  height: calc(100% - 0.5em);\n  overflow-y: auto;\n  grid-area: cache;\n}\n\n.cached-users-panel .users-container {\n  display: grid;\n  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));\n  gap: 12px;\n  padding: 1em;\n  height: fit-content;\n}\n\n/* Common styles for all descriptions */\n.cached-users-panel .description {\n  color: bisque;\n  font-family: Montserrat;\n  font-size: 1em;\n  margin: 0;\n  padding: 0.4em 0.2em;\n  grid-column: 1 / -1;\n  height: fit-content;\n}\n\n/* Common styles for user container elements in cached users panel */\n.cached-users-panel .user-item {\n  display: grid;\n  grid-template-columns: auto 1fr;\n  align-items: center;\n  height: fit-content;\n  gap: 0.6em;\n  margin-bottom: 1em;\n}\n\n/* Common styles for the visits element */\n.cached-users-panel .visits {\n  margin-left: 8px;\n  padding: 4px 6px;\n  border-radius: 2px !important;\n  cursor: pointer;\n  white-space: pre;\n}\n\n/* Styling for tracked visits */\n.cached-users-panel .visits.tracked {\n  color: greenyellow;\n  background-color: darkgreen;\n  font-weight: bold;\n}\n\n/* Styling for untracked visits */\n.cached-users-panel .visits.untracked {\n  color: orange;\n  background-color: #111111;\n  font-weight: normal;\n}\n\n/* Common styles for the action log container */\n.cached-users-panel .action-log {\n  position: fixed;\n  opacity: 0;\n  padding: 8px;\n  gap: 4px;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n  max-height: 85vh;\n  overflow-y: auto;\n  scrollbar-width: none;\n  overflow-x: hidden;\n  display: flex;\n  flex-wrap: wrap;\n  background-color: #111111;\n  justify-content: center;\n  border: 3px dashed #212121;\n  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08) !important;\n  border-radius: 0.2em !important;\n}\n\n.cached-users-panel .rank {\n  padding: 2px 0;\n}\n\n.cached-users-panel .registered {\n  color: cadetblue;\n  font-size: 12px;\n}\n\n.cached-users-panel .user-metrics {\n  display: inline-flex;\n  grid-column: span 2;\n  white-space: nowrap;\n}\n\n.cached-users-panel .user-metrics span {\n  margin-right: 0.2em !important;\n}\n\n.cached-users-panel .avatar {\n  font-size: 1.8rem;\n}\n\n.cached-users-panel .avatar img {\n  height: 24px;\n  width: 24px;\n}\n\n.cached-users-panel .login {\n  color: skyblue !important;\n  text-decoration: none;\n  font-family: 'Montserrat', sans-serif;\n  transition: color 0.3s ease;\n}\n\n.cached-users-panel .login:hover {\n  color: cornsilk !important;\n}\n\n.cache-user-count {\n  display: flex;\n  position: absolute;\n  justify-content: center;\n  align-items: center;\n  left: 0;\n  bottom: 0;\n  transform: translate(-50%, 50%);\n  z-index: 1;\n  height: 20px;\n  padding: 0 4px;\n  border-radius: 2px !important;\n  background-color: #9db380;\n  color: rgb(2, 2, 2);\n  font-size: 12px;\n  font-family: Roboto, sans-serif;\n  font-weight: bold;\n}\n\n/* Desktops (992px to 1199px) */\n@media (max-width: 1199px) {\n  .cached-users-panel {\n    width: 90vw;\n    height: 85vh;\n    min-width: unset;\n  }\n}\n\n/* Tablets (768px to 991px) */\n@media (max-width: 991px) {\n  .cached-users-panel {\n    width: 95vw;\n    height: 90vh;\n    grid-template-columns: 1fr;\n    grid-template-rows: min-content auto;\n    grid-template-areas:\n      \"header\"\n      \"cache\";\n  }\n\n  .cached-users-panel .panel-header {\n    flex-wrap: wrap;\n  }\n\n  .cached-users-panel .search-for-cached-users {\n    margin: 0.5em 0;\n    order: 1;\n  }\n\n  .cached-users-panel .users-container {\n    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));\n  }\n}\n\n/* Mobile Phones (up to 576px) */\n@media (max-width: 576px) {\n  .cached-users-panel {\n    width: 100vw;\n    height: 100vh;\n    top: 0;\n    left: 0;\n    transform: none;\n    border-radius: 0 !important;\n  }\n\n  .cached-users-panel .panel-header {\n    padding: 0.5em;\n  }\n\n  .cached-users-panel .drop-time-threshold,\n  .cached-users-panel .drop-time-expiration {\n    padding: 0.4em;\n  }\n\n  .cached-users-panel .users-container {\n    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));\n    gap: 8px;\n    padding: 0.5em;\n  }\n\n  .cached-users-panel .user-item {\n    gap: 0.4em;\n    margin-bottom: 1em;\n  }\n\n  .cached-users-panel .avatar {\n    font-size: 1.4rem;\n  }\n\n  .cached-users-panel .avatar img {\n    height: 20px;\n    width: 20px;\n  }\n\n  .cached-users-panel .login {\n    font-size: 0.9em;\n  }\n\n  .cached-users-panel .visits {\n    font-size: 0.8em;\n    padding: 2px 4px;\n  }\n\n  .cached-users-panel .registered {\n    font-size: 10px;\n  }\n\n  /* Mobile Phones (up to 520px) */\n  @media (max-width: 520px) {\n    .cached-users-panel .drop-time-threshold-description,\n    .cached-users-panel .drop-time-expiration-description {\n      display: none !important;\n    }\n  }\n\n  /* Mobile Phones (up to 320px) */\n  @media (max-width: 320px) {\n    .cached-users-panel .drop-time {\n      display: none !important;\n    }\n\n    .cached-users-panel .panel-control-buttons {\n      width: 100% !important;\n      justify-content: end !important;\n    }\n  }\n}",""]);const i=r},479:(e,t,n)=>{n.d(t,{A:()=>i});var o=n(601),s=n.n(o),a=n(314),r=n.n(a)()(s());r.push([e.id,"/* toggleHiddenMessages */\n.toggle-button-hidden {\n  background-color: hsl(0, 20%, 10%);\n  color: hsl(0, 50%, 50%);\n  border: 1px solid hsl(0, 50%, 50%);\n}\n\n.toggle-button-show {\n  background-color: hsl(90, 20%, 10%);\n  color: hsl(90, 50%, 50%);\n  border: 1px solid hsl(90, 50%, 50%);\n}\n\n.toggle-button-hide {\n  background-color: hsl(50, 20%, 10%);\n  color: hsl(50, 50%, 50%);\n  border: 1px solid hsl(50, 50%, 50%);\n}\n\n/* Chat messages manual remover */\n/* Delete button base styles */\n.delete-btn {\n  z-index: 999;\n  padding: 8px 16px;\n  background-color: hsl(0, 50%, 20%);\n  color: hsl(0, 60%, 70%);\n  border: 1px solid hsl(0, 50%, 35%);\n  transition: all 0.3s;\n  cursor: pointer;\n  filter: brightness(1);\n  border-radius: 0.2em !important;\n}\n\n.delete-btn:hover {\n  filter: brightness(1.5);\n}\n\n/* Common styles for all selected messages */\n.selected-message {\n  background-clip: padding-box !important;\n}\n\n/* message-mode */\n.selected-message.message-mode {\n  background-color: hsla(0, 50%, 50%, 0.2) !important;\n  box-shadow: inset 0px 0px 0px 1px hsl(0, 50%, 50%, 0.4) !important;\n}\n\n/* username-mode */\n.selected-message.username-mode {\n  background-color: hsla(145, 50%, 30%, 0.2) !important;\n  box-shadow: inset 0px 0px 0px 1px hsl(145, 50%, 50%, 0.4) !important;\n}\n\n/* time-mode */\n.selected-message.time-mode {\n  background-color: hsla(200, 50%, 30%, 0.2) !important;\n  box-shadow: inset 0px 0px 0px 1px hsl(200, 50%, 50%, 0.4) !important;\n}\n\n.shown-message {\n  background-color: hsla(30, 60%, 30%, 0.2) !important;\n  box-shadow: inset 0px 0px 0px 1px hsl(30, 60%, 50%, 0.4) !important;\n  background-clip: padding-box !important;\n}\n\n.hidden-message {\n  display: none;\n}\n\n/* Toggle button base styles */\n.toggle-button {\n  font: bold 0.9em 'Montserrat', sans-serif;\n  position: absolute;\n  top: 0;\n  right: 2em;\n  padding: 8px 16px;\n  transition: filter 0.3s;\n  border-radius: 0 0 0.2em 0.2em !important;\n  border-top: none;\n  min-width: 4em;\n}\n\n.toggle-button.toggle-hidden {\n  background: linear-gradient(to top, hsl(0, 50%, 20%), hsl(0, 50%, 25%));\n  color: hsl(0, 60%, 70%);\n  border-left: 1px solid hsl(0, 50%, 35%);\n  border-right: 1px solid hsl(0, 50%, 35%);\n  border-bottom: 1px solid hsl(0, 50%, 35%);\n}\n\n.toggle-button.toggle-shown {\n  background: linear-gradient(to top, hsl(30, 50%, 20%), hsl(30, 50%, 25%));\n  color: hsl(30, 60%, 70%);\n  border-left: 1px solid hsl(30, 50%, 35%);\n  border-right: 1px solid hsl(30, 50%, 35%);\n  border-bottom: 1px solid hsl(30, 50%, 35%);\n}\n\n.toggle-button:hover {\n  filter: brightness(1.5);\n}",""]);const i=r},540:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},601:e=>{e.exports=function(e){return e[1]}},659:e=>{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},664:(e,t,n)=>{n.d(t,{A:()=>i});var o=n(601),s=n.n(o),a=n(314),r=n.n(a)()(s());r.push([e.id,'/* showSettingsPanel */\n.settings-panel {\n  opacity: 0;\n  background-color: #1b1b1b;\n  border-radius: 0.6em !important;\n  position: fixed;\n  top: 100px;\n  left: 50%;\n  transform: translateX(-50%);\n  width: 50vw;\n  height: 80vh;\n  z-index: 1000;\n  min-width: 1000px;\n  display: grid;\n  grid-template-columns: 1fr;\n  grid-template-rows: min-content;\n  grid-template-areas:\n    "header header"\n    "settings scroll";\n}\n\n.settings-panel .panel-header {\n  display: flex;\n  flex-direction: row;\n  justify-content: flex-end;\n  padding: 0.6em;\n  grid-area: header;\n}\n\n.settings-panel .settings-content-container {\n  overflow-y: auto;\n  height: calc(100% - 0.5em);\n  padding: 1em;\n  grid-area: settings;\n}\n\n.settings-panel .settings-description {\n  position: relative;\n  font: 1em Montserrat;\n  color: burlywood;\n  background-color: rgba(222, 184, 135, 0.1);\n  width: fit-content;\n  margin: 0 0 1em;\n  padding: 0.4em 0.8em;\n  border-radius: 0.4em !important;\n  left: 50%;\n  transform: translateX(-50%);\n}\n\n.settings-panel .settings-spoiler button {\n  position: relative;\n  font: 1em Montserrat;\n  color: lightgreen;\n  background-color: rgba(222, 184, 135, 0.1);\n  margin: 0 0 3em 0;\n  padding: 0.4em 0.8em;\n  border-radius: 0.4em !important;\n  left: 50%;\n  transform: translateX(-50%);\n  cursor: pointer;\n  transition: background-color 0.3s ease;\n  border: none;\n}\n\n.settings-panel .settings-spoiler button:hover {\n  background-color: rgba(222, 184, 135, 0.25);\n}\n\n.settings-panel .settings-field {\n  height: 30px;\n  max-width: 200px;\n  min-width: 150px;\n  padding: 0.4em;\n  font: 1em Montserrat;\n  font-family: Montserrat;\n  color: bisque;\n  border-radius: 0.2em !important;\n  box-sizing: border-box;\n  background-color: rgb(17, 17, 17);\n  border: 1px solid rgb(34, 34, 34);\n}\n\n.settings-panel .settings-button {\n  width: 30px;\n  height: 30px;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  border-radius: 0.2em !important;\n  cursor: pointer;\n  transition: filter 0.3s;\n  filter: brightness(1);\n}\n\n.settings-panel .settings-button:hover {\n  filter: brightness(0.8);\n}\n\n/* Disabled state */\n.settings-panel .settings-button.disabled {\n  filter: grayscale(1);\n  pointer-events: none;\n  opacity: 0.5;\n}\n\n.settings-panel .settings-button {\n  width: 30px;\n  height: 30px;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  border-radius: 0.2em !important;\n  cursor: pointer;\n  transition: filter 0.3s;\n}\n\n.settings-panel select {\n  height: 30px;\n  min-width: 105px;\n  max-width: 120px;\n  padding: 0.4em;\n  font: 1em Montserrat, sans-serif;\n  color: bisque !important;\n  border-radius: 0.2em !important;\n  box-sizing: border-box;\n  background-color: rgb(17, 17, 17) !important;\n  border: 1px solid rgb(34, 34, 34) !important;\n}\n\n.settings-panel option {\n  height: 30px;\n  background-color: rgb(17, 17, 17) !important;\n  color: bisque !important;\n  font-family: \'Montserrat\', sans-serif;\n}\n\n.settings-panel .remove-settings-button {\n  stroke: #ee9090;\n  background-color: #6b2f2f;\n}\n\n.settings-panel .assigned-settings-button {\n  stroke: lightsteelblue;\n  background-color: steelblue;\n}\n\n.settings-panel .add-settings-button {\n  stroke: #d190ee;\n  background-color: #502f6b;\n}\n\n.settings-panel .toggle-item {\n  display: inline-flex;\n  align-items: center;\n  gap: 1em;\n}\n\n.settings-panel .toggle-description {\n  cursor: pointer;\n  color: burlywood;\n  transition: color 0.15s ease-in-out;\n}\n\n.settings-panel .toggle-description:hover {\n  color: lightgoldenrodyellow;\n}\n\n.settings-panel .settings-container {\n  width: 100%;\n  gap: 0.4em;\n  display: inline-flex;\n  flex-wrap: wrap;\n  align-items: start;\n  margin-bottom: 4em;\n}\n\n.settings-panel .settings-toggle-container {\n  flex-direction: column;\n}\n\n.settings-panel [class$="item"] {\n  display: inline-flex;\n  gap: 0.4em;\n}\n\n/* Desktops (992px to 1199px) */\n@media (max-width: 1199px) {\n  .settings-panel {\n    width: 90vw;\n    height: 85vh;\n    min-width: unset;\n  }\n\n  .settings-panel .settings-field,\n  .settings-panel select {\n    max-width: 180px;\n  }\n}\n\n/* Tablets (768px to 991px) */\n@media (max-width: 991px) {\n  .settings-panel {\n    width: 95vw;\n    height: 90vh;\n    grid-template-columns: 1fr;\n    grid-template-rows: min-content auto;\n    grid-template-areas:\n      "header"\n      "settings";\n  }\n\n  .settings-panel .panel-header {\n    flex-wrap: wrap;\n  }\n\n  .settings-panel .settings-field,\n  .settings-panel select {\n    max-width: 160px;\n    min-width: 120px;\n  }\n\n  .settings-panel .settings-container {\n    flex-direction: column;\n    align-items: flex-start;\n  }\n}\n\n/* Mobile Phones (up to 576px) */\n@media (max-width: 576px) {\n  .settings-panel {\n    width: 100vw;\n    height: 100vh;\n    top: 0;\n    left: 0;\n    transform: none;\n    border-radius: 0 !important;\n  }\n\n  .settings-panel .settings-description,\n  .settings-panel .toggle-description {\n    font-size: 0.9em;\n  }\n\n  .settings-panel .settings-container {\n    flex-direction: column;\n    gap: 0.2em;\n    margin-bottom: 2em;\n  }\n\n  .settings-panel .toggle-item {\n    gap: 0.5em;\n  }\n\n  .settings-panel [class$="item"] {\n    gap: 0.2em;\n  }\n}',""]);const i=r},720:(e,t,n)=>{n.d(t,{A:()=>i});var o=n(601),s=n.n(o),a=n(314),r=n.n(a)()(s());r.push([e.id,'/* positionChatLogsButton */\n.chat-logs-button {\n  position: relative;\n  z-index: 1;\n}\n\n/* showChatLogsPanel */\n.chat-logs-panel {\n  opacity: 0;\n  background-color: #1b1b1b;\n  border-radius: 0.6em !important;\n  position: fixed;\n  top: 100px;\n  left: 50%;\n  transform: translateX(-50%);\n  width: 80vw;\n  height: 80vh;\n  z-index: 1000;\n  min-width: 1000px;\n  display: grid;\n  grid-template-columns: 1fr;\n  grid-template-rows: min-content;\n  grid-template-areas:\n    "header header header"\n    "messages scroll users";\n}\n\n.chat-logs-panel .panel-header {\n  display: flex;\n  flex-direction: row;\n  grid-area: header;\n  justify-content: flex-end;\n  padding: 0.6em;\n}\n\n.chat-logs-panel .panel-control-buttons {\n  display: flex;\n}\n\n.chat-logs-panel .search-for-chatlogs-messages {\n  width: 100%;\n  margin: 0 0.5em 0 0;\n  display: flex;\n}\n\n.chat-logs-panel .chatlogs-search-input {\n  outline: none;\n  height: 48px;\n  width: 100%;\n  padding: 10px;\n  font-size: 1em;\n  font-family: Montserrat;\n  color: bisque !important;\n  border-radius: 0.2em !important;\n  box-sizing: border-box;\n  background-color: #111;\n  border: 1px solid #222 !important;\n}\n\n.chat-logs-panel .chatlogs-date-input {\n  background-color: #111;\n  color: bisque;\n  border: 1px solid #222;\n  width: fit-content;\n  height: 48px;\n  padding: 10px;\n  font-size: 1em;\n  font-family: Montserrat;\n  border-radius: 0.2em !important;\n  box-sizing: border-box;\n  margin: 0 0.5em;\n}\n\n.toggle-mention-messages-counter,\n.toggle-media-messages-counter {\n  display: flex;\n  position: absolute;\n  justify-content: center;\n  align-items: center;\n  padding: 2px 4px;\n  border-radius: 2px !important;\n  font-size: 12px;\n  font-family: Roboto;\n  font-weight: bold;\n  bottom: 0px;\n  left: 0px;\n  transform: translate(-50%, 50%);\n  color: #020202;\n  pointer-events: none;\n  user-select: none;\n}\n\n.toggle-mention-messages-counter {\n  background-color: #ffa07a;\n}\n\n.toggle-media-messages-counter {\n  background-color: #71c4c4;\n}\n\n.chat-logs-panel .saved-chatlog-url {\n  color: darkseagreen !important;\n  text-decoration: none;\n  display: inline-flex;\n  padding: 0.5em;\n}\n\n.chat-logs-panel .saved-chatlog-url-title {\n  color: lightsteelblue;\n  padding: 0.5em;\n}\n\n.saved-chatlog-container {\n  display: flex;\n  flex-direction: column;\n  overflow-y: auto;\n  background-color: rgb(30, 40, 45);\n  border: 1px solid rgb(60, 70, 80) !important;\n  border-radius: 0.2em !important;\n  position: absolute;\n  padding: 0.5em;\n  height: fit-content;\n  width: max-content;\n  max-height: 400px;\n  top: calc(50px + 1em);\n  right: 0;\n}\n\n.chat-logs-panel .chat-logs-container {\n  overflow-y: auto;\n  overflow-x: hidden;\n  height: calc(100% - 0.5em);\n  padding: 1em;\n  display: flex;\n  grid-area: messages;\n  flex-direction: column;\n}\n\n.chat-logs-panel .message-item {\n  padding: 0.2em;\n  display: inline-flex;\n  cursor: pointer;\n  align-items: start;\n}\n\n.chat-logs-panel .message-time {\n  color: darkseagreen;\n  margin: 0 0.4em;\n  cursor: pointer;\n  transition: color 0.2s ease;\n  height: fit-content;\n}\n\n.chat-logs-panel .message-time:hover {\n  color: lightgreen;\n}\n\n.chat-logs-panel .message-username {\n  cursor: pointer;\n  margin: 0 0.4em;\n  height: fit-content;\n}\n\n.chat-logs-panel .message-text {\n  color: lightsteelblue;\n  margin: 0 0.4em;\n  overflow-wrap: anywhere;\n  height: fit-content;\n}\n\n.chat-logs-panel .active-users {\n  padding: 1em;\n  height: calc(100% - 1em);\n  width: fit-content;\n  overflow-y: auto;\n  overflow-x: hidden;\n  grid-area: users;\n  display: flex;\n  flex-direction: column;\n}\n\n.chat-logs-panel .active-user-item {\n  display: flex;\n  height: fit-content;\n  align-items: center;\n  justify-content: left;\n  margin: 0.2em 0;\n  cursor: pointer;\n  transition: filter 0.15s;\n}\n\n.chat-logs-panel .active-user-item:hover {\n  filter: brightness(0.8);\n}\n\n.chat-logs-panel .active-user-name {\n  padding: 0.4em;\n}\n\n.chat-logs-panel .active-user-messages-count {\n  padding: 0.4em;\n  border-radius: 0.2em !important;\n}\n\n/* Adaptivity */\n/* Desktops (992px to 1199px) */\n@media (max-width: 1199px) {\n  .chat-logs-panel {\n    width: 90vw;\n    height: 85vh;\n    min-width: unset; /* Remove min-width for flexibility */\n  }\n  \n  .chat-logs-panel .active-users {\n    width: 200px; /* Reduce width of active users panel */\n  }\n}\n\n/* Tablets (768px to 991px) */\n@media (max-width: 991px) {\n  .chat-logs-panel {\n    width: 95vw;\n    height: 90vh;\n    grid-template-columns: 1fr; /* Switch to single column */\n    grid-template-rows: min-content auto auto; /* Stack elements vertically */\n    grid-template-areas:\n      "header"\n      "messages"\n      "users";\n  }\n  \n  .chat-logs-panel .active-users {\n    width: 100%; /* Full width */\n    height: auto;\n    max-height: 200px; /* Limit height with scrolling */\n    overflow-y: auto;\n  }\n  \n  .chat-logs-panel .panel-header {\n    flex-direction: column; /* Stack header items vertically */\n    align-items: flex-start;\n  }\n  \n  .chat-logs-panel .search-for-chatlogs-messages {\n    width: 100%; /* Full width search bar */\n    margin-bottom: 0.5em;\n  }\n  \n  .chat-logs-panel .panel-control-buttons {\n    width: 100%; /* Full width for buttons */\n    justify-content: center;\n  }\n\n  .chat-logs-panel .active-users,\n  .chat-logs-panel .panel-header-toggle-button {\n    display: none !important;\n  }\n}\n\n/* Mobile phones (576px and below) */\n@media (max-width: 576px) {\n  .chat-logs-panel {\n    width: 100vw;\n    height: 100vh;\n    top: 0;\n    left: 0;\n    transform: none; /* Remove centering */\n    border-radius: 0 !important; /* Full-screen, no rounded corners */\n  }\n  \n  .chat-logs-panel .panel-header {\n    padding: 0.5em; /* Reduce padding */\n  }\n  \n  .chat-logs-panel .active-users {\n    display: none; /* Hide active users */\n  }\n  \n  .chat-logs-panel .message-item {\n    padding: 0.1em; /* Reduce message padding */\n  }\n  \n  .chat-logs-panel .message-time,\n  .chat-logs-panel .message-username,\n  .chat-logs-panel .message-text {\n    margin: 0 0.2em; /* Reduce margins */\n    font-size: 0.9em; /* Smaller text */\n  }\n\n  .chat-logs-panel .video-container,\n  .chat-logs-panel .youtube-thumb {\n    transform-origin: top left;\n    transform: scale(0.8);\n  }\n  \n  .chat-logs-panel .toggle-mention-messages-counter,\n  .chat-logs-panel .toggle-media-messages-counter {\n    font-size: 10px; /* Smaller counters */\n  }\n  \n  .chat-logs-panel .saved-chatlog-container {\n    max-height: 300px; /* Reduce height of saved chat logs */\n  }\n}',""]);const i=r},825:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var s=void 0!==n.layer;s&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,s&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},946:(e,t,n)=>{n.d(t,{A:()=>i});var o=n(601),s=n.n(o),a=n(314),r=n.n(a)()(s());r.push([e.id,'/* positionMessagesButton */\n.personal-messages-button {\n  position: relative;\n  z-index: 2;\n}\n\n.message-count {\n  display: flex;\n  position: absolute;\n  justify-content: center;\n  align-items: center;\n  height: 20px;\n  padding: 0 4px;\n  border-radius: 2px !important;\n  color: rgb(2, 2, 2);\n  font-size: 12px;\n  font-family: Roboto, sans-serif;\n  font-weight: bold;\n  bottom: 0;\n}\n\n.total-message-count {\n  left: 0;\n  transform: translate(-50%, 50%);\n  background-color: #fa8072;\n}\n\n.new-message-count {\n  right: 0;\n  transform: translate(50%, 50%);\n  background-color: #ffd700;\n}\n\n/* showMessagesPanel */\n.cached-messages-panel {\n  opacity: 0;\n  background-color: #1b1b1b;\n  border-radius: 0.6em !important;\n  position: fixed;\n  top: 100px;\n  left: 50%;\n  transform: translateX(-50%);\n  width: 50vw;\n  height: 80vh;\n  z-index: 1000;\n  min-width: 1000px;\n  display: grid;\n  grid-template-columns: 1fr;\n  grid-template-rows: min-content;\n  grid-template-areas:\n    "header header"\n    "messages scroll";\n}\n\n.panel-header {\n  display: flex;\n  flex-direction: row;\n  justify-content: flex-end;\n  /* Aligns to the right */\n  padding: 0.6em;\n  grid-area: header;\n}\n\n.search-for-personal-messages {\n  width: 100%;\n  margin: 0 0.5em 0 0;\n  display: flex;\n}\n\n.personal-messages-search-input {\n  outline: none;\n  height: 48px;\n  width: 100%;\n  padding: 10px;\n  font-size: 1em;\n  font-family: Montserrat, sans-serif;\n  color: bisque !important;\n  border-radius: 0.2em !important;\n  box-sizing: border-box;\n  background-color: #111;\n  border: 1px solid #222 !important;\n}\n\n.cached-messages-panel .messages-container {\n  overflow-y: auto;\n  height: calc(100% - 0.5em);\n  padding: 1em;\n  grid-area: messages;\n}\n\n.cached-messages-panel .date-item {\n  position: relative;\n  font: 1em Montserrat, sans-serif;\n  color: burlywood;\n  background-color: rgba(222, 184, 135, 0.1);\n  width: fit-content;\n  margin: 2em 1em 1em;\n  padding: 0.4em 0.8em;\n  text-align: center;\n  border-radius: 0.4em !important;\n  left: 50%;\n  transform: translateX(-50%);\n}\n\n.cached-messages-panel .message-item {\n  padding: 0.2em;\n}\n\n.cached-messages-panel .message-time {\n  margin: 0px 0.4em;\n  height: fit-content;\n  cursor: pointer;\n  transition: color 0.2s ease;\n}\n\n.cached-messages-panel .message-username {\n  display: inline-flex;\n  cursor: pointer;\n  margin: 0px 0.4em;\n  height: fit-content;\n}\n\n.cached-messages-panel .message-text {\n  cursor: pointer;\n  margin: 0px 0.4em;\n  height: fit-content;\n}\n\n/* Adaptivity */\n/* Desktops (992px to 1199px) */\n@media (max-width: 1199px) {\n  .cached-messages-panel {\n    width: 90vw;\n    height: 85vh;\n    min-width: unset;\n  }\n}\n\n/* Tablets (768px to 991px) */\n@media (max-width: 991px) {\n  .cached-messages-panel {\n    width: 95vw;\n    height: 90vh;\n    grid-template-columns: 1fr;\n    grid-template-rows: min-content auto;\n    grid-template-areas:\n      "header"\n      "messages";\n  }\n\n  .cached-messages-panel .panel-header {\n    flex-direction: column;\n    align-items: flex-start;\n  }\n\n  .cached-messages-panel .search-for-personal-messages {\n    width: 100%;\n    margin-right: 0;\n    margin-bottom: 0.5em;\n  }\n\n  .cached-messages-panel .panel-control-buttons {\n    width: 100%;\n    justify-content: center;\n  }\n}\n\n/* Very Small Screens (up to 630px) */\n@media (max-width: 630px) {\n  .cached-messages-panel .panel-header-date-button,\n  .cached-messages-panel .chatlogs-date-input {\n    display: none !important;\n  }\n}\n\n/* Mobile Phones (up to 576px) */\n@media (max-width: 576px) {\n  .cached-messages-panel {\n    width: 100vw;\n    height: 100vh;\n    top: 0;\n    left: 0;\n    transform: none;\n    border-radius: 0 !important;\n  }\n\n  .cached-messages-panel .panel-header {\n    padding: 0.5em;\n  }\n\n  .cached-messages-panel .message-item {\n    padding: 0.1em;\n  }\n\n  .cached-messages-panel .message-time,\n  .cached-messages-panel .message-username,\n  .cached-messages-panel .message-text {\n    margin: 0 0.2em;\n    font-size: 0.9em;\n  }\n\n  .cached-messages-panel .video-container,\n  .cached-messages-panel .youtube-thumb {\n    transform-origin: top left;\n    transform: scale(0.8);\n  }\n\n  .cached-messages-panel .message-count {\n    font-size: 10px;\n    height: 16px;\n    padding: 0 3px;\n  }\n}',""]);const i=r}},t={};function n(o){var s=t[o];if(void 0!==s)return s.exports;var a=t[o]={id:o,exports:{}};return e[o](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.nc=void 0;n.d({},{f:()=>us});var o=n(72),s=n.n(o),a=n(825),r=n.n(a),i=n(659),l=n.n(i),c=n(56),d=n.n(c),m=n(540),p=n.n(m),u=n(113),g=n.n(u),h=n(208),f={};f.styleTagTransform=g(),f.setAttributes=d(),f.insert=l().bind(null,"head"),f.domAPI=r(),f.insertStyleElement=p();s()(h.A,f);h.A&&h.A.locals&&h.A.locals;const y="http://www.w3.org/2000/svg",v=`\n  <svg xmlns="${y}"\n      width="16"\n      height="16"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="currentColor"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="icon-enter icon-feather icon-log-in">\n    <path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"></path>\n    <polyline points="10 17 15 12 10 7"></polyline>\n    <line x1="15" y1="12" x2="3" y2="12"></line>\n  </svg>`,b=`\n  <svg xmlns="${y}"\n      width="16"\n      height="16"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="currentColor" stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="icon-leave icon-feather icon-log-out">\n    <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>\n    <polyline points="16 17 21 12 16 7"></polyline>\n    <line x1="21" y1="12" x2="9" y2="12"></line>\n  </svg>`,x=`\n  <svg xmlns="${y}"\n      width="18"\n      height="18"\n      viewBox="0 0 24 24"\n      fill="url(#moderatorGradient)"  \x3c!-- Use a gradient fill --\x3e\n      stroke="none"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-shield">\n    \x3c!-- Define the gradient --\x3e\n    <defs>\n        <linearGradient id="moderatorGradient" x1="0%" y1="0%" x2="0%" y2="100%">\n            <stop offset="0%" style="stop-color: rgb(255, 215, 0); stop-opacity: 1" />\n            <stop offset="100%" style="stop-color: rgb(255, 140, 0); stop-opacity: 1" />\n        </linearGradient>\n    </defs>\n    <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>\n  </svg>`,w=`\n  <svg xmlns="${y}"\n       width="16"\n       height="16"\n       viewBox="0 0 24 24"\n       fill="url(#trackedGradient)"  \x3c!-- Use a gradient fill --\x3e\n       class="feather feather-star">\n      \x3c!-- Define the gradient for the fill --\x3e\n    <defs>\n      <linearGradient id="trackedGradient" x1="0%" y1="0%" x2="0%" y2="100%">\n        <stop offset="0%" style="stop-color: rgb(135, 206, 250); stop-opacity: 1" />\n        <stop offset="100%" style="stop-color: rgb(0, 191, 255); stop-opacity: 1" />\n      </linearGradient>\n    </defs>\n    \x3c!-- Use the gradient for the fill --\x3e\n    <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"\n      stroke="url(#trackedGradient)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round">\n    </polygon>\n  </svg>`,S=`\n  <svg xmlns="${y}"\n      width="16"\n      height="16"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(255, 160, 122)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-slash">\n    <circle cx="12" cy="12" r="10"></circle>\n    <line x1="4.93" y1="4.93" x2="19.07" y2="19.07"></line>\n  </svg>`,k=`\n  <svg xmlns="${y}"\n      width="28"\n      height="28"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="hsl(355, 80%, 65%)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round">\n    <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>\n    <line x1="23" y1="9" x2="17" y2="15"></line>\n    <line x1="17" y1="9" x2="23" y2="15"></line>\n  </svg>`,E=`\n  <svg xmlns="${y}"\n      width="28"\n      height="28"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="hsl(55, 80%, 65%)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round">\n    <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>\n    <path d="M19.07 4.93a10 10 0 0 1 0 14.14" opacity="0.3"></path>\n    <path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path>\n  </svg>`,C=`\n  <svg xmlns="${y}"\n      width="28"\n      height="28"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="hsl(80, 80%, 40%)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round">\n    <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>\n    <path d="M19.07 4.93a10 10 0 0 1 0 14.14"></path>\n    <path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path>\n  </svg>`,L=`\n  <svg xmlns="${y}"\n      width="28"\n      height="28"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="hsl(100, 50%, 50%)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round">\n    <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>\n    <circle cx="9" cy="7" r="4"></circle>\n    <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>\n    <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>\n  </svg>`,T=`\n  <svg xmlns="${y}"\n      width="28"\n      height="28"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="hsl(180, 60%, 50%)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round">\n    <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>\n    <circle cx="12" cy="7" r="4"></circle>\n  </svg>`,M=`\n  <svg xmlns="${y}"\n      width="16"\n      height="16"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="currentColor"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-slash">\n    <circle cx="12" cy="12" r="10"></circle>\n    <line x1="4.93" y1="4.93" x2="19.07" y2="19.07"></line>\n  </svg>`,$=`\n  <svg xmlns="${y}"\n      width="28"\n      height="28"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(180, 213, 131)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-database">\n    <ellipse cx="12" cy="5" rx="9" ry="3"></ellipse>\n    <path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"></path>\n    <path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path>\n  </svg>`,N=`\n  <svg xmlns="${y}"\n      width="28"\n      height="28"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(255, 160, 122)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-mail">\n    <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path>\n    <polyline points="22,6 12,13 2,6"></polyline>\n  </svg>`,q=`\n  <svg xmlns="${y}"\n      width="28"\n      height="28"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(100, 149, 237)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-message-circle">\n      <path \n          d="M21 11.5 a8.38 8.38 0 0 1 -.9 3.8 a8.5 8.5 0 0 1 -7.6 4.7 a8.38 8.38 0 0 1 -3.8 -.9\n          L3 21 l1.9 -5.7 a8.38 8.38 0 0 1 -.9 -3.8 a8.5 8.5 0 0 1 4.7 -7.6\n          a8.38 8.38 0 0 1 3.8 -.9 h.5 a8.48 8.48 0 0 1 8 8 v.5 z">\n      </path>\n  </svg>`,A=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(113, 196, 196)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-film">\n    <rect x="2" y="2" width="20" height="20" rx="2.18" ry="2.18"></rect>\n    <line x1="7" y1="2" x2="7" y2="22"></line>\n    <line x1="17" y1="2" x2="17" y2="22"></line>\n    <line x1="2" y1="12" x2="22" y2="12"></line>\n    <line x1="2" y1="7" x2="7" y2="7"></line>\n    <line x1="2" y1="17" x2="7" y2="17"></line>\n    <line x1="17" y1="17" x2="22" y2="17"></line>\n    <line x1="17" y1="7" x2="22" y2="7"></line>\n  </svg>`,I=`\n  <svg xmlns="${y}"\n      width="16"\n      height="16"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(255, 100, 100)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-slash">\n    <circle cx="12" cy="12" r="10"></circle>\n    <line x1="4.93" y1="4.93" x2="19.07" y2="19.07"></line>\n  </svg>`,j=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(255, 228, 196)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-sliders">\n    <line x1="4" y1="21" x2="4" y2="14"></line>\n    <line x1="4" y1="10" x2="4" y2="3"></line>\n    <line x1="12" y1="21" x2="12" y2="12"></line>\n    <line x1="12" y1="8" x2="12" y2="3"></line>\n    <line x1="20" y1="21" x2="20" y2="16"></line>\n    <line x1="20" y1="12" x2="20" y2="3"></line>\n    <line x1="1" y1="14" x2="7" y2="14"></line>\n    <line x1="9" y1="8" x2="15" y2="8"></line>\n    <line x1="17" y1="16" x2="23" y2="16"></line>\n  </svg>`,O=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(144, 238, 144)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-x">\n    <line x1="18" y1="6" x2="6" y2="18"></line>\n    <line x1="6" y1="6" x2="18" y2="18"></line>\n  </svg>`,B="rgb(211, 211, 211)",H=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="${B}"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevrons-up">\n    <polyline points="17 11 12 6 7 11"></polyline>\n    <polyline points="17 18 12 13 7 18"></polyline>\n  </svg>`,D=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="${B}"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-up">\n    <polyline points="18 15 12 9 6 15"></polyline>\n  </svg>`,P=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="${B}"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">\n    <polyline points="6 9 12 15 18 9"></polyline>\n  </svg>`,z=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="${B}"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevrons-down">\n    <polyline points="7 13 12 18 17 13"></polyline>\n    <polyline points="7 6 12 11 17 6"></polyline>\n  </svg>`,F=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 25 25"\n      fill="none"\n      stroke="rgb(137, 187, 255)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-toggle-right">\n    <rect x="1" y="5" width="22" height="14" rx="7" ry="7"></rect>\n    <circle cx="16" cy="12" r="3"></circle>\n  </svg>`,U=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 25 25"\n      fill="none"\n      stroke="rgb(137, 187, 255)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-toggle-left">\n    <rect x="1" y="5" width="22" height="14" rx="7" ry="7"></rect>\n    <circle cx="8" cy="12" r="3"></circle>\n  </svg>`,_=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(176, 196, 222)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-calendar">\n    <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>\n    <line x1="16" y1="2" x2="16" y2="6"></line>\n    <line x1="8" y1="2" x2="8" y2="6"></line>\n    <line x1="3" y1="10" x2="21" y2="10"></line>\n  </svg>`,R=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(176, 196, 222)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-clipboard">\n    <path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path>\n    <rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect>\n  </svg>`,J=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(28, 229, 229)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-left">\n    <polyline points="15 18 9 12 15 6"></polyline>\n  </svg>`,K=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(28, 229, 229)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right">\n      <polyline points="9 18 15 12 9 6"></polyline>\n  </svg>`,V=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(169, 155, 255)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-shuffle">\n    <polyline points="16 3 21 3 21 8"></polyline>\n    <line x1="4" y1="20" x2="21" y2="3"></line>\n    <polyline points="21 16 21 21 16 21"></polyline>\n    <line x1="15" y1="15" x2="21" y2="21"></line>\n    <line x1="4" y1="4" x2="9" y2="9"></line>\n  </svg>`,X=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(255, 140, 0)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash-2">\n    <polyline points="3 6 5 6 21 6"></polyline>\n    <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>\n    <line x1="10" y1="11" x2="10" y2="17"></line>\n    <line x1="14" y1="11" x2="14" y2="17"></line>\n  </svg>`,Y=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="currentColor"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-users">\n    <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>\n    <circle cx="9" cy="7" r="4"></circle>\n    <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>\n    <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>\n  </svg>`,G=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(209, 144, 238)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-download">\n    <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>\n    <polyline points="7 10 12 15 17 10"></polyline>\n    <line x1="12" y1="15" x2="12" y2="3"></line>\n  </svg>`,W=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(144, 185, 238)"\n      stroke-width="2" stroke-linecap="round"\n      stroke-linejoin="round" class="feather feather-upload">\n    <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>\n    <polyline points="17 8 12 3 7 8"></polyline>\n    <line x1="12" y1="3" x2="12" y2="15"></line>\n  </svg>`,Z=`\n  <svg xmlns="${y}"\n      width="24"\n      height="24"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(144, 238, 220)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-save">\n    <path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"></path>\n    <polyline points="17 21 17 13 7 13 7 21"></polyline>\n    <polyline points="7 3 7 8 15 8"></polyline>\n  </svg>`,Q=`\n  <svg xmlns="${y}"\n      width="16"\n      height="16"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(238, 144, 144)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash">\n    <polyline points="3 6 5 6 21 6"></polyline>\n    <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>\n  </svg>`,ee=`\n  <svg xmlns="${y}"\n      width="20"\n      height="20"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(176, 196, 222)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-snowflake">\n    <g id="snowflake">\n      <line x1="12.06" y1="2.74" x2="12.06" y2="12.06" />\n      <line x1="20.12" y1="7.4" x2="12.06" y2="12.06" />\n      <line x1="20.12" y1="16.71" x2="12.06" y2="12.06" />\n      <line x1="12.06" y1="21.37" x2="12.06" y2="12.06" />\n      <line x1="3.99" y1="16.71" x2="12.06" y2="12.06" />\n      <line x1="3.99" y1="7.4" x2="12.06" y2="12.06" />\n      <polyline points="8.96,4.67 12.06,7.77 15.16,4.67"/>\n      <polyline points="16.9,5.68 15.76,9.92 20,11.05"/>\n      <polyline points="20,13.06 15.76,14.2 16.9,18.43"/>\n      <polyline points="15.16,19.44 12.06,16.34 8.96,19.44"/>\n      <polyline points="7.21,18.43 8.35,14.2 4.11,13.06"/>\n      <polyline points="4.11,11.05 8.35,9.92 7.21,5.68"/>\n    </g>\n  </svg>`,te=`\n  <svg xmlns="${y}"\n      width="16"\n      height="16"\n      viewBox="0 0 24 24"\n      fill="none"\n      stroke="rgb(209, 144, 238)"\n      stroke-width="2"\n      stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus">\n    <line x1="12" y1="5" x2="12" y2="19"></line>\n    <line x1="5" y1="12" x2="19" y2="12"></line>\n  </svg>`,ne=300,oe="https://klavogonki.ru/u/#/",se=document.querySelector(".userpanel .user-block .user-dropdown .name span").textContent,ae=document.querySelector("a.drop-btn.mail")?.href?.match(/\/u\/#\/(\d+)\/messages\//)?.[1],re=new Intl.DateTimeFormat("en-CA").format(new Date),ie=2.5,le=["😀","😁","😂","🤣","😃","😄","😅","😆","😉","😊","😋","😎","😏","😐","😑","😒","😓","😔","😕","😖","😗","😘","😙","😚","😜","😝","😛","🤑","🤗","🤔","🤐","🤨","😣","😥","😮","🤯","😳","😱","😨","😰","😢","🤪","😵","😲","🤤","😷","🤒","🤕","🤢","🤧","😇","🥳","🥺","😬","😴","😌","🤥","🥴","🥵","🥶","🤧","🤭","🤫","😠","😡","😳","😞","😟","😕","🐱","😺","😸","😹","😻","😼","😽","🙀","😿","😾","🐶","🐭","🐹","🐰","🦊","🐻","🐼","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🙈","🙉","🙊","🐔","🦄"];let ce={lastFocusedIframeTextarea:null,bigImageEvents:{},panelsEvents:{},fetchedUsers:JSON.parse(localStorage.getItem("fetchedUsers"))||{}};const de=function(e){const[t,n=0,o=0]=e.split(":").map(Number);return t+n/60+o/3600}(localStorage.getItem("cacheRefreshThresholdHours")||(localStorage.setItem("cacheRefreshThresholdHours",24),24)),me=["klavogonki.ru","youtube.com","youtu.be","imgur.com","pikabu.ru","userapi.com","ibb.co","yaplakal.com","freepik.com"];var pe=n(664),ue={};ue.styleTagTransform=g(),ue.setAttributes=d(),ue.insert=l().bind(null,"head"),ue.domAPI=r(),ue.insertStyleElement=p();s()(pe.A,ue);pe.A&&pe.A.locals&&pe.A.locals;function ge(e,t=0,n=0){const o=[{transform:`translate(${t}%, calc(${n}%)) scale(1)`},{transform:`translate(${t}%, calc(${n}% - 60%)) scale(1.1)`},{transform:`translate(${t}%, calc(${n}% + 15%)) scale(1)`},{transform:`translate(${t}%, calc(${n}% - 20%)) scale(1.05)`},{transform:`translate(${t}%, calc(${n}% + 8%)) scale(1)`},{transform:`translate(${t}%, calc(${n}% - 10%)) scale(1.05)`},{transform:`translate(${t}%, calc(${n}% + 4%)) scale(1)`},{transform:`translate(${t}%, calc(${n}%)) scale(1)`}];return e.animate(o,{duration:500,easing:"ease",iterations:1}).finished}function he(e){e.classList.add("shake-effect"),setTimeout((()=>{e.classList.remove("shake-effect")}),500)}function fe(e){e.classList.add("pulse-effect"),setTimeout((()=>{e.classList.remove("pulse-effect")}),500)}let{panelsEvents:ye}=ce;const ve=localStorage.getItem("KG_Chat_Empowerment"),be=ve?JSON.parse(ve):{voiceSettings:{voiceSpeed:1.5,voicePitch:1},messageSettings:{}};function xe(e,t){e.addEventListener("click",(()=>{const n=e.classList.toggle("assigned-frozen-config");e.classList.toggle("assigned-thawed-config"),e.style.opacity=n?"1":"0.3",function(e,t){const n=localStorage.getItem("usersToTrack");if(n){const o=JSON.parse(n).map((n=>n.name===e?{...n,state:t}:n));localStorage.setItem("usersToTrack",JSON.stringify(o))}}(t,n?"frozen":"thawed")}))}function we(e){const t=document.createElement("div");return t.className=`${e}-item`,t}function Se(e,t="",n=""){const o=document.createElement("input");return o.className=`settings-field ${e}-field`,o.value=t,o.placeholder=n,o}function ke(e,t){const n=document.createElement("div");return n.className=`settings-button remove-settings-button remove-${e}-word`,n.innerHTML=Q,function(e,t){e.addEventListener("click",(()=>{t.remove()}))}(n,t),n}function Ee(e){const t=we("tracked"),n=Se("tracked-username",e.name,"Username"),o=Se("tracked-pronunciation",e.pronunciation,"Pronunciation"),s=ke("tracked",t),a=function(e="thawed",t){const n=document.createElement("div");return n.className=`settings-button assigned-settings-button assigned-${e}-config`,n.style.opacity="thawed"===e?"0.3":"1",n.innerHTML=ee,xe(n,t),n}("frozen"===e.state?"frozen":"thawed",e.name),r=document.createElement("select");r.className="tracked-gender-select";return[{value:"Male",emoji:"👨"},{value:"Female",emoji:"👩"}].forEach((({value:t,emoji:n})=>{const o=document.createElement("option");o.value=t,o.textContent=`${n} ${t}`,e.gender===t&&(o.selected=!0),r.appendChild(o)})),t.appendChild(n),t.appendChild(r),t.appendChild(o),t.appendChild(s),t.appendChild(a),t}function Ce(e,t){const n=we("toggle"),o=document.createElement("select");o.className="toggle-select";const s=document.createElement("span");s.className="toggle-description",s.dataset.category=e.category,s.dataset.type=e.type,s.textContent=e.description,s.style.cursor="pointer",s.style.transition="color 0.15s ease-in-out",s.addEventListener("click",(()=>{e.image&&window.open(e.image,"_blank")}));return[{value:"yes",emoji:"✔️"},{value:"no",emoji:"❌"}].forEach((({value:e,emoji:t})=>{const n=document.createElement("option");n.value=e,n.textContent=`${t} ${e}`,o.appendChild(n)})),o.value=t,n.appendChild(o),n.appendChild(s),n}ve||localStorage.setItem("KG_Chat_Empowerment",JSON.stringify(be));const Le=[{type:"tracked",emoji:"👀",key:"usersToTrack",selector:".settings-tracked-container",creator:Ee},{type:"mention",emoji:"📢",key:"mentionKeywords",selector:".settings-mention-container",creator:function(e){const t=we("mention"),n=Se("mention",e,"Mention Keyword"),o=ke("mention",t);return t.appendChild(n),t.appendChild(o),t}},{type:"replacement",emoji:"♻️",key:"usernameReplacements",selector:".settings-replacement-container",creator:function(e={original:"",replacement:""}){const t=we("replacement"),n=Se("replacement-original",e.original,"Original username"),o=Se("replacement",e.replacement,"Replacement name"),s=ke("replacement",t);return t.appendChild(n),t.appendChild(o),t.appendChild(s),t}},{type:"moderator",emoji:"⚔️",key:"moderator",selector:".settings-moderator-container",creator:function(e){const t=we("moderator"),n=Se("moderator",e,"Moderator Name"),o=ke("moderator",t);return t.appendChild(n),t.appendChild(o),t}},{type:"ignored",emoji:"🛑",key:"ignored",selector:".settings-ignored-container",creator:function(e){const t=we("ignored"),n=Se("ignored",e,"Ignored User"),o=ke("ignored",t);return t.appendChild(n),t.appendChild(o),t}},{type:"toggle",emoji:"🔘",key:"toggle",selector:".settings-toggle-container",creator:Ce}],Te=[{description:"👀 Show chat static notifications",image:"https://i.imgur.com/oUPSi9I.jpeg",category:"notifications",type:"static"},{description:"👀 Show global dynamic notifications",image:"https://i.imgur.com/8ffCdUG.jpeg",category:"notifications",type:"dynamic"},{description:"🔊 Play a beep sound and speak feedback when the user enters or leaves the chat",image:"https://i.imgur.com/6PXFIES.jpeg",category:"sound",type:"presence"},{description:"🔊 Switch to google TTS engine if available",image:"https://i.imgur.com/0H94LII.jpeg",category:"sound",type:"gTTS"},{description:"📦️ Create participants counter",image:"https://i.imgur.com/rqIVAgH.jpeg",category:"elements",type:"counter"}],Me=Object.fromEntries(Le.map((e=>[e.key,[]])));Le.forEach((e=>{const t=e.key,n=JSON.parse(localStorage.getItem(t))||[];n.length&&Me[t].splice(0,Me[t].length,...n)}));const $e=Le.find((e=>"mention"===e.type));async function Ne(e){const t=e.target.files[0];if(t){const e=new FileReader;return new Promise(((n,o)=>{e.onload=function(e){const t=e.target.result;try{je(JSON.parse(t)),n()}catch(e){console.error("Error parsing JSON data:",e.message),console.error("Invalid JSON:",t),alert("Failed to parse JSON data. Please check the format and try again."),o(e)}},e.onerror=function(e){console.error("Error reading file:",e.target.error),o(e.target.error)},e.readAsText(t)}))}}function qe(e){if(!e||"object"!=typeof e)return console.error("Invalid settings data for download."),void alert("Cannot export settings. Please try again.");try{const t="  ",n="    ";let o="{\n";Le.forEach(((s,a)=>{const r=s.key,i=e[r];let l="";l=Array.isArray(i)?`[\n${i.map((e=>`${n}${JSON.stringify(e)}`)).join(",\n")}\n${t}]`:JSON.stringify(i),o+=`${t}"${r}": ${l}`,a<Le.length-1?o+=",\n":o+="\n"})),o+="}";const s=`KG_Chat_Empowerment_Settings_${new Intl.DateTimeFormat("en-CA").format(new Date)}.json`,a=new Blob([o],{type:"application/json"}),r=URL.createObjectURL(a),i=document.createElement("a");i.href=r,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}catch(e){console.error("Error exporting settings:",e),alert("Failed to export settings. Please try again.")}}function Ae(){return Object.fromEntries(Le.map((e=>[e.key,JSON.parse(localStorage.getItem(e.key))||[]])))}function Ie(e){const t=document.createElement("div");t.classList.add("empowerment-button","settings-button"),t.title="Show Settings Panel",t.style.position="relative",t.innerHTML=j;const n=document.createElement("input");n.type="file",n.accept=".json",n.style.display="none",n.addEventListener("change",Ne),t.addEventListener("click",(e=>{fe(t),pt&&qe(Ae()),mt&&n.click(),pt||mt||function(){const e=document.querySelector(".settings-panel");if(e)return e.remove(),void xt("hide");gt();const t=document.createElement("div");t.className="settings-panel popup-panel",ye.handleSettingsKeydown=e=>{"Escape"===e.key&&(wt(t,"hide"),xt("hide"),document.removeEventListener("keydown",ye.handleSettingsKeydown))},document.addEventListener("keydown",ye.handleSettingsKeydown);const n=document.createElement("div");n.className="panel-header";const o=document.createElement("div");o.classList.add("panel-control-buttons");const s=document.createElement("div");s.className="large-button panel-header-close-button",s.innerHTML=O,s.title="Close panel",s.addEventListener("click",(()=>{wt(t,"hide"),xt("hide")}));const a=document.createElement("div");a.className="large-button panel-header-clear-button",a.innerHTML=X,a.title="Clear settings",a.addEventListener("click",(()=>{d()}));const r=document.createElement("div");r.className="large-button panel-header-import-button",r.innerHTML=G,r.title="Import settings";const i=document.createElement("div");function l(e){const t=document.querySelector(".settings-content-container");if(!t)return console.error("Container not found.");const n=()=>{e.style.visibility="visible",e.style.display="flex",setTimeout((()=>{e.style.opacity="1"}),10)},o=()=>{e.style.opacity="0",setTimeout((()=>{e.style.visibility="hidden",e.style.display="none"}),300)},s=Ae(),a=()=>{const e={};Le.forEach((t=>{e[t.key]=[]})),t.querySelectorAll(".settings-tracked-container .tracked-item").forEach((t=>{const n=t.querySelector(".tracked-username-field"),o=t.querySelector(".tracked-gender-select"),s=t.querySelector(".tracked-pronunciation-field"),a=t.querySelector(".assigned-thawed-config, .assigned-frozen-config"),r=n?n.value.trim():"",i=o?o.value.trim():"",l=s?s.value.trim():"",c=a.classList.contains("assigned-frozen-config")?"frozen":"thawed";e.usersToTrack.push({name:r,gender:i,pronunciation:l,state:c})}));const a=new Set(e.usersToTrack.map((e=>e.name.toLowerCase())));t.querySelectorAll(".settings-mention-container .mention-item").forEach((t=>{const n=t.querySelector(".mention-field"),o=n?n.value.trim():"";e.mentionKeywords.push(o)})),t.querySelectorAll(".settings-replacement-container .replacement-item").forEach((t=>{const n=t.querySelector(".replacement-original-field"),o=t.querySelector(".replacement-field"),s=n?n.value.trim():"",r=o?o.value.trim():"";if(a.has(s.toLowerCase()))return n.classList.add("input-error"),void he(n);n.classList.remove("input-error"),e.usernameReplacements.push({original:s,replacement:r})})),t.querySelectorAll(".settings-moderator-container .moderator-item").forEach((t=>{const n=t.querySelector(".moderator-field"),o=n?n.value.trim():"";e.moderator.push(o)})),t.querySelectorAll(".settings-ignored-container .ignored-item").forEach((t=>{const n=t.querySelector(".ignored-field"),o=n?n.value.trim():"";e.ignored.push(o)})),t.querySelectorAll(".settings-toggle-container .toggle-item").forEach((t=>{const n=t.querySelector(".toggle-description"),o=t.querySelector(".toggle-select"),s=o?.value.trim()||"no";e.toggle.push({category:n.dataset.category,type:n.dataset.type,option:s})}));return JSON.stringify(s)!==JSON.stringify(e)?n():o(),e};e.addEventListener("click",(()=>{const e=a();je(e),Object.assign(s,e),o()})),t.querySelectorAll("input, select").forEach((e=>{e.addEventListener("input",a)}));const r=e=>{"INPUT"===e.tagName||"SELECT"===e.tagName?e.addEventListener("input",a):e.querySelectorAll("input, select").forEach((e=>{e.addEventListener("input",a)}))};new MutationObserver(vt((e=>{e.forEach((e=>{"childList"===e.type&&(e.addedNodes.forEach((e=>{e.nodeType===Node.ELEMENT_NODE&&r(e)})),e.removedNodes.forEach((e=>{e.nodeType===Node.ELEMENT_NODE&&a()})))}))}),ne)).observe(t,{childList:!0,subtree:!0})}i.className="large-button panel-header-save-button",i.innerHTML=Z,i.title="Save settings";const c=document.createElement("input");function d(){Le.forEach((e=>{const t=document.querySelector(e.selector);if(t){const e=t.querySelector(".add-settings-button");t.replaceChildren(),e&&t.appendChild(e)}}))}c.type="file",c.accept=".json",c.style.display="none",c.addEventListener("change",(async e=>{await Ne(e),d(),u()})),r.addEventListener("click",(()=>{c.click()})),r.appendChild(c);const m=document.createElement("div");m.className="large-button panel-header-export-button",m.innerHTML=W,m.title="Export settings",m.addEventListener("click",(function(){qe(Ae())})),o.appendChild(i),o.appendChild(r),o.appendChild(m),o.appendChild(a),o.appendChild(s),n.appendChild(o),t.appendChild(n);const p=document.createElement("div");function u(){const e=Ae(),t=document.querySelector(".settings-content-container");Le.forEach((n=>{const{key:o,selector:s,creator:a,type:r,emoji:i}=n,l=document.querySelector(s);if(!l)return;l.classList.add("settings-container");const c=l.querySelector(".add-settings-button");for(;l.firstChild&&l.firstChild!==c;)l.removeChild(l.firstChild);if("toggle"!==r){(e[o]||[]).forEach((e=>l.appendChild(a(e))));const t=g(s,a);l.appendChild(t)}else{const e=JSON.parse(localStorage.getItem(o))||[];Te.forEach((t=>{const n=e.find((e=>e.category===t.category&&e.type===t.type)),o=n?n.option:"yes",s=Ce(t,o);l.appendChild(s)}))}const d=function(e,t={}){const n=document.createElement("div");n.classList.add("settings-spoiler");const o=document.createElement("button");return o.textContent=t.showText||"Show Content",e.style.display="none",o.addEventListener("click",(()=>{const n="none"===e.style.display;e.style.display=n?"flex":"none",o.textContent=n?t.hideText||"Hide Content":t.showText||"Show Content"})),n.appendChild(o),n.appendChild(e),n}(l,{showText:`${i} Show ${r}`,hideText:`${i} Hide ${r}`});t.appendChild(d)}))}function g(e,t){const n=e.split("-")[1],o=document.querySelector(`.add-${n}-item`);o&&o.remove();const s=document.createElement("div");return s.className=`settings-button add-settings-button add-${n}-item`,s.innerHTML=te,s.addEventListener("click",(()=>{const o=document.querySelector(e),a=o.querySelectorAll(`.${n}-item`),r=a.length>0?a[a.length-1]:null,i=r?r.querySelectorAll("input"):[],l=Array.from(i).some((e=>0===e.value.trim().length));if(!r||!l){const e=t(t===Ee?{name:"",pronunciation:""}:"");e instanceof HTMLElement?o.insertBefore(e,s):console.error("Invalid item created.")}else alert("Please fill in the previous item before adding a new one.")})),s}p.className="settings-content-container",Le.forEach((({type:e})=>{const t=document.createElement("div");t.className=`settings-${e}-container`,p.appendChild(t)})),t.appendChild(p);const{scrollButtonsContainer:h}=yt(p);t.appendChild(h),document.body.appendChild(t),u(),l(i),wt(t,"show"),xt("show")}()})),t.appendChild(n),e.appendChild(t)}function je(e){Le.forEach((t=>{Array.isArray(e[t.key])&&(Me[t.key]=e[t.key])})),Le.forEach((e=>{localStorage.setItem(e.key,JSON.stringify(Me[e.key]))})),console.log("Uploaded settings applied:",Me)}void 0!==se&&se&&$e&&Me[$e.key].push(se);let Oe,Be,He=be.voiceSettings.voiceSpeed??1.5,De=be.voiceSettings.voicePitch??1;function Pe(){Be.innerHTML="silence"===Oe.id?k:"beep"===Oe.id?E:C}function ze(){return{speed:(He-0)/2.5*100+"%",pitch:(De-0)/2*100+"%"}}let Fe=null,Ue=null;function _e(e){e.preventDefault();const t=function(e){const t=0===e.button,n=e.ctrlKey||e.metaKey,o=e.altKey;if(!n&&!o)return null;const s=n?"voiceSpeed":"voicePitch",a=t?-.1:.1,r=be.voiceSettings[s],[i,l]="voiceSpeed"===s?[0,ie]:[0,2];return a<0&&r<=i||a>0&&r>=l?null:{prop:s,step:a}}(e);if(!t)return;const{prop:n,step:o}=t;Re(n,o),Fe=setTimeout((()=>{Ue=setInterval((()=>{Re(n,o)||clearInterval(Ue)}),100)}),500);const s=()=>{clearTimeout(Fe),clearInterval(Ue),Oe.removeEventListener("mouseup",s),Oe.removeEventListener("mouseleave",s)};Oe.addEventListener("mouseup",s),Oe.addEventListener("mouseleave",s)}function Re(e,t){const n=parseFloat(be.voiceSettings[e]),[o,s]="voiceSpeed"===e?[0,ie]:[0,2],a=Math.min(s,Math.max(o,n+t));return n!==a&&(function(e,t){const n=parseFloat(t.toFixed(1));be.voiceSettings[e]=n,"voiceSpeed"===e?He=n:"voicePitch"===e&&(De=n);localStorage.setItem("KG_Chat_Empowerment",JSON.stringify(be)),function(){let e=document.querySelector(".voice-settings"),t=document.querySelector(".current-voice-speed"),n=document.querySelector(".current-voice-pitch");if(mt){e||(e=document.createElement("div"),e.classList.add("voice-settings"),Oe.appendChild(e),e.offsetWidth,e.style.opacity="1"),n?.remove(),t||(t=document.createElement("span"),t.classList.add("current-voice-speed"),e.appendChild(t));let o=t.querySelector(".voice-value-info")||document.createElement("span");t.querySelector(".voice-value-info")||(o.classList.add("voice-speed","voice-value-info"),t.appendChild(o)),o.innerHTML=He<=0||He>=ie?M:`SPEED ${Number(He).toFixed(1)}`;let s=t.querySelector(".voice-speed-progress")||document.createElement("span");if(!t.querySelector(".voice-speed-progress")){s.classList.add("voice-speed-progress");const e=document.createElement("span");e.classList.add("voice-speed-progress-fill"),s.appendChild(e),t.appendChild(s)}t.querySelector(".voice-speed-progress-fill").style.width=ze().speed,e.timeoutId&&clearTimeout(e.timeoutId),e.timeoutId=setTimeout((()=>{e.style.opacity="0",setTimeout((()=>e.remove()),500)}),2e3)}else if(pt){e||(e=document.createElement("div"),e.classList.add("voice-settings"),Oe.appendChild(e),e.offsetWidth,e.style.opacity="1"),t?.remove(),n||(n=document.createElement("span"),n.classList.add("current-voice-pitch"),e.appendChild(n));let o=n.querySelector(".voice-value-info")||document.createElement("span");n.querySelector(".voice-value-info")||(o.classList.add("voice-pitch","voice-value-info"),n.appendChild(o)),o.innerHTML=De<=0||De>=2?M:`PITCH ${De.toFixed(1)}`;let s=n.querySelector(".voice-pitch-progress")||document.createElement("span");if(!n.querySelector(".voice-pitch-progress")){s.classList.add("voice-pitch-progress");const e=document.createElement("span");e.classList.add("voice-pitch-progress-fill"),s.appendChild(e),n.appendChild(s)}n.querySelector(".voice-pitch-progress-fill").style.width=ze().pitch,e.timeoutId&&clearTimeout(e.timeoutId),e.timeoutId=setTimeout((()=>{e.style.opacity="0",setTimeout((()=>e.remove()),500)}),2e3)}else e?.remove()}()}(e,a),t>0?a<s:a>o)}const{usersToTrack:Je}=Me;const Ke=function(){const e=new AudioContext;return new Promise((t=>{e.onstatechange=function(){"running"===e.state&&t(e)}}))}(),Ve=[300,600],Xe=[600,300],Ye=[500],Ge=[600,800],We=100;function Ze(e,t){Ke.then((n=>{for(let o=0;o<e.length;o++){const s=e[o];if(0===s)setTimeout((()=>{}),80);else{const e=n.createOscillator(),a=n.createGain();e.connect(a),e.frequency.value=s,e.type="sine";const r=n.createBiquadFilter();r.type="lowpass",r.frequency.value=250,e.connect(r);const i=n.createBiquadFilter();i.type="highpass",i.frequency.value=16e3,r.connect(i),a.connect(n.destination),a.gain.setValueAtTime(0,n.currentTime),a.gain.linearRampToValueAtTime(t,n.currentTime+.01),e.start(n.currentTime+o*We/1e3),e.stop(n.currentTime+(o*We+80)/1e3),a.gain.setValueAtTime(t,n.currentTime+(o*We+70)/1e3),a.gain.linearRampToValueAtTime(0,n.currentTime+(o*We+80)/1e3)}}}))}const Qe=new Promise((e=>{const t=window.speechSynthesis;let n=t.getVoices();const o="Microsoft Pavel - Russian (Russia)",s="Microsoft Irina - Russian (Russia)";let a=n.find((e=>e.name===o)),r=n.find((e=>e.name===s));if(a&&r&&0!==n.length){const o=new SpeechSynthesisUtterance;o.lang="ru-RU",o.voice=r,e({synth:t,utterance:o,voices:n,pavelVoice:a,irinaVoice:r})}else t.addEventListener("voiceschanged",(()=>{if(n=t.getVoices(),a=n.find((e=>e.name===o)),r=n.find((e=>e.name===s)),a&&r){const o=new SpeechSynthesisUtterance;o.lang="ru-RU",o.voice=r,e({synth:t,utterance:o,voices:n,pavelVoice:a,irinaVoice:r})}}))}));async function et(e,t=t){const n=At("sound","gTTS"),o=await async function(e){return e.replace(/[-−_]/g," ").replace(/https?:\/\/(?:www\.)?([a-zA-Z0-9.-]+)(\/.*)?/g,((e,t)=>t)).replace(/\s(?=[?!,.:;@])/g,"").replace(/["#$%&'()*+\/<=>[\\\]^`{|}~]/g,"").split(" ").filter(Boolean).join(" ").trim()}(e);if(n){const e=(e=>e.split(/\s+/).reduce(((e,t)=>{const n=/[А-Яа-яЁё0-9]/.test(t)?"ru":"en";return e.length&&e[e.length-1].lang===n?e[e.length-1].text+=" "+t:e.push({lang:n,text:t}),e}),[]))(o);try{for(const{lang:t,text:n}of e)await new Promise(((e,o)=>{fetch(`http://127.0.0.1:5000/speak?text=${encodeURIComponent(n)}&lang=${t}`).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.arrayBuffer()})).then((t=>{const n=new(window.AudioContext||window.webkitAudioContext),s=new Audio(URL.createObjectURL(new Blob([t],{type:"audio/mp3"}))),a=n.createMediaElementSource(s),r=n.createGain();r.gain.value=2,a.connect(r),r.connect(n.destination),s.onended=e,s.onerror=o,s.play()})).catch(o)}))}catch(e){console.error("Server TTS failed:",e)}}else await async function(e,t=t){const{synth:n,utterance:o,voice:s}=await Qe;return Object.assign(o,{text:e,rate:t,volume:1,pitch:De,voice:s}),new Promise((e=>{o.onend=e,n.speak(o)}))}(e,t)}const tt={Male:{enter:"зашёл",leave:"вышел"},Female:{enter:"зашла",leave:"вышла"}};const{ignored:nt,mentionKeywords:ot,usernameReplacements:st,usersToTrack:at}=Me;let{panelsEvents:rt,bigImageEvents:it,lastFocusedIframeTextarea:lt,fetchedUsers:ct}=ce;const dt=e=>window.location.href.includes(e);let mt=!1,pt=!1;function ut(){Object.entries(it).forEach((([e,t])=>{document.removeEventListener(e,t)}))}function gt(){Object.values(rt).forEach((e=>{document.removeEventListener("keydown",e)})),Object.keys(rt).forEach((e=>delete rt[e]));const e=document.querySelector(".popup-panel");e&&e.remove()}function ht({container:e,buttons:t}){const n=0===e.scrollTop,o=e.scrollTop+e.clientHeight>=e.scrollHeight-3;[t.fullScrollUpButton,t.partialScrollUpButton].forEach((e=>{e.style.opacity=n?"0.3":"1",e.style.pointerEvents=n?"none":"auto"})),[t.fullScrollDownButton,t.partialScrollDownButton].forEach((e=>{e.style.opacity=o?"0.3":"1",e.style.pointerEvents=o?"none":"auto"}))}function ft({container:e,scrollButtonsContainer:t}){e.scrollHeight>e.clientHeight?t.style.display="flex":t.style.display="none"}function yt(e){const t=document.createElement("div");t.className="scroll-buttons-container";const n=document.createElement("div");n.innerHTML=H,n.title="Scroll Up (Full)";const o=document.createElement("div");o.innerHTML=D,o.title="Scroll Up (Partial)";const s=document.createElement("div");s.innerHTML=P,s.title="Scroll Down (Partial)";const a=document.createElement("div");a.innerHTML=z,a.title="Scroll Down (Full)";const r={fullScrollUpButton:n,partialScrollUpButton:o,partialScrollDownButton:s,fullScrollDownButton:a};function i(t,n){const o=n?e.scrollHeight:e.clientHeight;e.scrollBy({top:"up"===t?-o:o,behavior:"smooth"}),ht({container:e,buttons:r})}Object.values(r).forEach((e=>{e.classList.add("large-button","scroll-button"),t.appendChild(e)})),n.addEventListener("click",(()=>i("up",!0))),o.addEventListener("click",(()=>i("up",!1))),s.addEventListener("click",(()=>i("down",!1))),a.addEventListener("click",(()=>i("down",!0))),ht({container:e,buttons:r}),ft({container:e,scrollButtonsContainer:t});const l=()=>{ft({container:e,scrollButtonsContainer:t}),ht({container:e,buttons:r})};e.addEventListener("scroll",l);const c=new ResizeObserver(l);c.observe(e);const d=new MutationObserver(l);d.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});return{scrollButtonsContainer:t,cleanup:()=>{c.disconnect(),d.disconnect(),e.removeEventListener("scroll",l)}}}["keydown","keyup"].forEach((e=>document.addEventListener(e,(t=>{return n=t.key,o="keydown"===e,"Control"===n&&(mt=o),void("Alt"===n&&(pt=o));var n,o})))),["blur","focus"].forEach((e=>document.addEventListener(e,(()=>{(mt||pt)&&(console.log(`${mt?"Ctrl ":""}${pt?"Alt ":""}key was true`),mt=!1,pt=!1)}))));const vt=(e,t=300)=>{let n;return function(...o){clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}};function bt(e,t,n){e&&(e.offsetHeight,e.style.transition="opacity 0.3s",e.style.opacity="show"===t?n:"0","hide"===t&&e.addEventListener("transitionend",(()=>{"0"===e.style.opacity&&e.remove()}),{once:!0}))}function xt(e){let t=document.querySelector(".dimming-background"),n=document.querySelector(".scaled-thumbnail");("hide"!==e||t)&&(t||(t=document.createElement("div"),t.classList.add("dimming-background"),document.body.appendChild(t),t.addEventListener("click",(function(){const e=document.querySelector(".popup-panel")||t.previousElementSibling;e&&bt(e,"hide",0),xt("hide"),n&&ut()}))),bt(t,e,.5),"hide"===e&&n&&(ut(),wt(n,"hide")))}function wt(e,t){e&&(bt(e,t,1),e.addEventListener("dblclick",(t=>{const n=document.querySelector(".popup-panel");(t.target===e||t.target.parentElement===e||t.target.parentElement&&t.target.parentElement.parentElement===e)&&(n&&t.target.closest(".scaled-thumbnail")||xt("hide"),bt(e,"hide",1))})))}function St(e){return/^https?:\/\//.test(e)&&/%[0-9A-Fa-f]{2}/.test(e)}function kt(e){const[t]=e.split("#");return decodeURIComponent(t).replace(/ /g,"_")}function Et(e){document.querySelector({generalMessages:".messages-content div",chatlogsMessages:".chat-logs-container",personalMessages:".messages-container-wrapper"}[e])?.querySelectorAll("a:not(.media):not(.decoded)").forEach((e=>{try{if(St(e.href)){let t=kt(e.href);e.href=e.textContent=t,e.classList.add("decoded")}}catch(t){console.error("Error decoding link:",t,e.href)}}))}const Ct=e=>{const t=document.createElement("iframe");t.classList.add("profile-iframe-container"),t.src=e,document.body.appendChild(t),bt(t,"show",1);const n=()=>{bt(t,"hide",0),document.removeEventListener("keydown",o),document.removeEventListener("mousedown",o)},o=e=>{if("keydown"===e.type&&"Space"===e.code){if(lt)return void e.stopPropagation();e.preventDefault(),n()}"mousedown"!==e.type||t.contains(e.target)||n()};document.addEventListener("keydown",o),document.addEventListener("mousedown",o),t.onload=()=>{try{const e=t.contentWindow,s=e.document;s.addEventListener("focusin",(e=>{"TEXTAREA"===e.target.tagName&&(lt=e.target)})),s.addEventListener("focusout",(()=>{setTimeout((()=>{s.activeElement&&"TEXTAREA"===s.activeElement.tagName||(lt=null)}),0)})),e.addEventListener("keydown",o),e.addEventListener("dblclick",n),new MutationObserver(((e,t)=>{e.some((e=>[...e.removedNodes].some((e=>1===e.nodeType&&(e.classList.contains("dimming-background")||e.classList.contains("cached-users-panel"))))))&&(n(),t.disconnect())})).observe(document.body,{childList:!0,subtree:!0})}catch(e){console.warn("Unable to access iframe contents:",e)}}};let Lt=null;function Tt(){let e;do{e=le[Math.floor(Math.random()*le.length)]}while(e===Lt);return Lt=e,e}async function Mt(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch ${e}`);return t.json()}async function $t(e,t=!0){return new Promise((async(n,o)=>{let s=t&&JSON.parse(localStorage.getItem("fetchedUsers"))||{};const a=s[e];if(t&&function(e){return e&&"object"==typeof e&&["rank","login","registered","bestSpeed","ratingLevel","friends","cars","avatarTimestamp"].every((t=>void 0!==e?.[t]))}(a))n({rank:a.rank,login:a.login,registeredDate:a.registered,bestSpeed:a.bestSpeed,ratingLevel:a.ratingLevel,friends:a.friends,cars:a.cars,avatar:a.avatar,avatarTimestamp:a.avatarTimestamp});else try{const o=`https://klavogonki.ru/api/profile/get-summary?id=${e}`,a=`https://klavogonki.ru/api/profile/get-index-data?userId=${e}`,[i,l]=await Promise.all([fetch(o),fetch(a)]);if(!i.ok||!l.ok)throw new Error("Failed to fetch data from one of the APIs.");const c=await i.json(),d=await l.json();if(!(c?.user?.login&&c.title&&d?.stats?.registered))throw new Error("Invalid data format received from the API.");{const o=c.title,a=c.user.login,i=d.stats.registered.sec?(r=d.stats.registered.sec,new Date(1e3*r).toISOString().slice(0,19).replace("T"," ")):"Invalid Date",l=d.stats.best_speed||0,m=d.stats.rating_level||0,p=d.stats.friends_cnt||0,u=d.stats.cars_cnt||0,g=c.user?.avatar||null,h=c.user.avatar?.sec||0,f=function(e,t){return e.toString()+Math.floor(t/1e3).toString()}(h,c.user.avatar?.usec||0);t&&(s[e]={rank:o,login:a,registered:i,bestSpeed:l,ratingLevel:m,friends:p,cars:u,avatar:g,avatarTimestamp:f},localStorage.setItem("fetchedUsers",JSON.stringify(s))),n({rank:o,login:a,registeredDate:i,bestSpeed:l,ratingLevel:m,friends:p,cars:u,avatar:g,avatarTimestamp:f})}}catch(t){console.error(`Error fetching user profile data for ${e}:`,t),o(t)}var r}))}function Nt(e=!1,t=24){const n=localStorage.getItem("lastClearTime"),o=n?((new Date).getTime()-n)/36e5:1/0;if(e||o>=t){localStorage.removeItem("fetchedUsers"),Object.keys(ct).forEach((e=>delete ct[e]));const e=(new Date).getTime()+60*t*60*1e3;localStorage.setItem("lastClearTime",(new Date).getTime().toString()),localStorage.setItem("nextClearTime",e.toString())}}function qt(e,t){const n=Object.values(JSON.parse(localStorage.getItem("fetchedUsers")||"[]")).find((t=>t?.login===e));if(!n)return`❌ User "${e}" not found`;const o=n.actionLog||[],s=o.find((e=>e.timestamp===t));if(!s)return`Action not found at ${t}`;const a=o.indexOf(s);if(0===a)return`🙌 ${e}'s first action`;const r=o.slice(0,a).reverse().find((e=>e.type!==s.type));if(!r)return`❌ No valid previous action found for ${t}`;const i=function(e,t){const n=e=>e.split(":").reduce(((e,t,n)=>e+t*[3600,60,1][n]),0),o=Math.abs(n(t)-n(e));return[Math.floor(o/3600),Math.floor(o%3600/60),o%60].map((e=>e.toString().padStart(2,"0"))).join(":")}(r.timestamp,s.timestamp);return"leave"===s.type?`🛑 ${e} stayed in chat for ${i}`:`✅ ${e} was absent for ${i}`}function At(e,t){const n=(JSON.parse(localStorage.getItem("toggle"))||[]).find((n=>n.category===e&&n.type===t));return!n||"yes"===n.option}let It=!0;function jt(e="generalMessages",t=600){const n={generalMessages:".messages-content",chatlogsMessages:".chat-logs-container",personalMessages:".messages-container-wrapper"}[e];if(!n)return;const o=document.querySelector(n);if(o)if(It)o.scrollTop=o.scrollHeight,It=!1;else{o.scrollHeight-o.scrollTop-o.clientHeight<=t&&(o.scrollTop=o.scrollHeight)}}async function Ot(e,t){const{top:n,height:o}=t.getBoundingClientRect(),{top:s,height:a}=e.getBoundingClientRect(),r=n-(s+a/2)+o/2;e.scrollBy({top:r,behavior:"smooth"}),await new Promise((e=>setTimeout(e,500))),e.style.scrollBehavior="auto",he(t)}function Bt(){return(new Date).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}const Ht=e=>{try{const{hostname:t}=new URL(e),n=t.toLowerCase().split(".").slice(-2).join(".");return{isTrusted:me.includes(n),domain:n}}catch(t){return console.error("Error in isTrustedDomain:",t.message),{isTrusted:!1,domain:e}}};function Dt(e="generalMessages"){const t={generalMessages:{container:".messages-content div",messageElement:"p",exclude:[".time",".username"]},chatlogsMessages:{container:".chat-logs-container",messageElement:".message-text"},personalMessages:{container:".messages-container",messageElement:".message-text"}}[e];if(!t)return void console.error("Invalid container type");const n=document.querySelectorAll(t.container),o=new WeakSet;n.forEach((n=>{n.querySelectorAll(t.messageElement).forEach((n=>{[...n.querySelectorAll(".private"),...n.querySelectorAll(".system-message"),n].forEach((n=>{const s=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,{acceptNode:n=>{if(o.has(n))return NodeFilter.FILTER_SKIP;const s=n.parentElement;return s.closest(".mention, .time, .username")||"generalMessages"===e&&s.closest(t.exclude.join(","))?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}},!1),a=[];let r;for(;r=s.nextNode();)a.push(r);a.forEach((e=>{o.has(e)||(!function(e){const t=/[\s]+|[^\s\wа-яА-ЯёЁ]+|[\wа-яА-ЯёЁ]+/g,n=e.textContent.match(t);if(!n)return;const o=document.createDocumentFragment();n.forEach((e=>{if(ot.map((e=>e.toLowerCase())).includes(e.toLowerCase())){const t=document.createElement("span");t.className="mention",t.textContent=e,o.appendChild(t)}else o.appendChild(document.createTextNode(e))})),e.parentNode.replaceChild(o,e)}(e),o.add(e))}))}))}))}))}let Pt=localStorage.personalMessages&&Object.keys(JSON.parse(localStorage.personalMessages)).length||0;function zt(){const e=document.querySelector(".personal-messages-button .total-message-count"),t=document.querySelector(".personal-messages-button .new-message-count");if(!e||!t)return;const n=JSON.parse(localStorage.getItem("personalMessages"))||{},o=Object.keys(n).length;let s=Number(localStorage.getItem("newMessagesCount"))||0;o>Pt&&(s++,localStorage.setItem("newMessagesCount",s),fe(t),ge(t,50,50)),e.textContent=o,t.textContent=s,t.style.visibility=s>0?"visible":"hidden",o!==Pt&&fe(e),Pt=o}function Ft(e){return function(e){const t={А:"A",Б:"B",В:"V",Г:"G",Д:"D",Е:"E",Ё:"Yo",Ж:"Zh",З:"Z",И:"I",Й:"Y",К:"K",Л:"L",М:"M",Н:"N",О:"O",П:"P",Р:"R",С:"S",Т:"T",У:"U",Ф:"F",Х:"Kh",Ц:"Ts",Ч:"Ch",Ш:"Sh",Щ:"Shch",Ъ:"y",Ы:"Y",Ь:"i",Э:"E",Ю:"Yu",Я:"Ya",а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"yo",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ъ:"y",ы:"y",ь:"i",э:"e",ю:"yu",я:"ya"};return e.split("").map((e=>t[e]||e)).join("")}(e)}function Ut(e){return!!e&&["Клавобот","Пользователь","заблокирован"].every((t=>e.includes(t)))}const _t=()=>{const e=localStorage.getItem("activeChatTab")||"game",t=window.location.href.includes("gmid"),n=t&&"game"===e?'[id^="chat-game"] .text':"#chat-general .text",o=t&&"game"===e?'[id^="chat-game"] .send':"#chat-general .send",s=t&&"game"===e?'[id^="chat-game"] .messages':"#chat-general .messages",a={game:document.querySelector('[id^="chat-game"] .userlist-content'),general:document.querySelector("#chat-general .userlist-content")},r=document.querySelector(t?"game"===e?".game.c":".general.c":"general"===e?".general.c":".game.c"),i=document.querySelector(t?document.querySelector(".game.c.active")?".general.c":".game.c":document.querySelector(".general.c.active")?".game.c":".general.c"),l=document.querySelectorAll(".messages-content p"),c=document.querySelector(s);return{chatField:document.querySelector(n),chatSend:document.querySelector(o),activeChatTab:r,nextChatTab:i,chatHidden:document.querySelector("#chat-wrapper.chat-hidden"),allMessages:l,messagesContainer:c,userList:a}};function Rt(e){const[t,n,o]=e.match(/\d+/g).map(Number),{h:s,s:a,l:r}=((e,t,n)=>{e/=255,t/=255,n/=255;const o=Math.max(e,t,n),s=Math.min(e,t,n);let a,r,i=(o+s)/2;if(o===s)a=r=0;else{const l=o-s;r=i<.5?l/(o+s):l/(2-o-s),a=(o===e?(t-n)/l+(t<n?6:0):o===t?(n-e)/l+2:(e-t)/l+4)/6}return a=Math.round(360*a),r=Math.min(Math.round(100*r),90),i=Math.round(100*i),a>215&&a<280&&(a=a<255?215:280),{h:a,s:r,l:i}})(t,n,o),i=((e,t,n)=>{let o,s,a;if(n/=100,0==(t/=100))o=s=a=255*n;else{const r=n<.5?n*(1+t):n+t-n*t,i=2*n-r,l=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e);o=Math.round(255*l(i,r,e/360+1/3)),s=Math.round(255*l(i,r,e/360)),a=Math.round(255*l(i,r,e/360-1/3))}return`rgb(${o}, ${s}, ${a})`})(s,a,r<50?50:r);return i}function Jt(e,t){if(e)if("one"===t){const t=e.querySelector("span[data-user]");if(!t)return;const n=Rt(getComputedStyle(e).color);e.style.setProperty("color",n,"important"),t.style.setProperty("filter","invert(0)","important")}else"all"===t?Array.from(e).forEach((e=>{if(!e)return;const t=e.querySelector("span[data-user]");if(!t)return;const n=Rt(getComputedStyle(e).color);e.style.setProperty("color",n,"important"),t.style.setProperty("filter","invert(0)","important")})):console.error("Invalid mode. Use 'one' or 'all'.")}async function Kt(){const e=document.querySelector(".messages-content div p:last-of-type");if(!e)return null;const t=async e=>Array.from(e.childNodes).map((e=>e.nodeType===Node.TEXT_NODE&&e.textContent.trim()?e.textContent.trim():"IMG"===e.nodeName&&e.getAttribute("title")?e.getAttribute("title"):"A"===e.nodeName&&e.getAttribute("href")?e.getAttribute("href"):"")).filter(Boolean);let n=(await t(e)).join(" ").trim(),o="common";const s=e.querySelector(".room.private");if(s&&s.textContent.includes("[шепчет ")){const s=e.querySelector("span.private");s&&(n=(await t(s)).join(" ").trim(),o="private")}const a=e.querySelector(".system-message");if(a){let e=(await t(a)).join(" ").trim();e=e.replace(/<Клавобот>\s*/g,""),n=e,o="system"}"common"===o&&function(e){const t=e.toLowerCase();return ot.some((e=>t.includes(e.toLowerCase())))}(n)&&(o="mention");const r=JSON.parse(localStorage.getItem("personalMessages"))||{},i=e.querySelector(".time")?.textContent||"N/A",l=e.querySelector(".username span[data-user]"),c=l?l.getAttribute("data-user"):null,d=l?l.textContent:"SYSTEM",m=Rt(l?l.parentElement.style.color:"rgb(180,180,180)"),p=`${i}_${d}`;("mention"===o||"private"===o)&&!nt.includes(d)&&(r[p]={time:i,date:(new Date).toLocaleDateString("en-CA"),username:d,usernameColor:m,message:n,type:o,userId:c},localStorage.setItem("personalMessages",JSON.stringify(r)));const u=e.querySelector(".username"),g=u?u.textContent.replace(/[<>]/g,""):"SYSTEM";Dt();let h="mention"===o||"private"===o?`${Xt(g)} обращается: `:g!==Vt?`${Xt(g)} пишет: `:"";Vt=g;return{messageText:h+Xt(n),usernameText:g}}let Vt=null;function Xt(e){if(null===e)return e;const t=[...at.map((e=>e.name)),...st.map((e=>e.original))],n=new RegExp(`(${t.join("|")})`,"gu");return e.replace(n,(e=>{const t=st.find((t=>t.original===e));if(t)return t.replacement;const n=at.find((t=>t.name===e));return n?.pronunciation||e}))}let Yt=!1;const Gt=new Set;function Wt(e){Gt.has(e)||(Gt.add(e),Yt||(Yt=!0,async function(){for(const e of Gt)await et(e,He),Gt.delete(e);Yt=!1}()))}function Zt(){return window.getSelection().toString().length>0}const Qt="Вы не можете отправлять сообщения",en="Связь с сервером потеряна";function tn(e){if(!e)return null;const t=e.value;return t.includes(Qt)?Qt:t.includes(en)?en:null}function nn(){const e=document.getElementById("chat-content").querySelectorAll(".messages-content div p"),t="14px",n=Array.from(e).map((e=>({element:e,isSystem:!!e.querySelector(".system-message"),username:(()=>{const t=e.querySelector("span.username span[data-user]");return t?t.textContent.replace(/[<>]/g,""):null})()})));let o=null,s=!1;n.forEach(((e,a)=>{const{element:r,isSystem:i,username:l}=e;if(r.style.marginTop="",r.style.marginBottom="",i)return r.style.marginTop=t,void(r.style.marginBottom=t);if(!l)return;s&&l!==o&&(r.style.marginTop=t);const c=n[a+1];c&&!c.isSystem&&c.username!==l&&(r.style.marginBottom=t),o=l,s=!0}))}if(dt("gamelist")){function gs(e,t,n){if(t.disabled){const o=tn(t);o===Qt?(t.disabled=n.disabled=!1,n.style.setProperty("background-color","rgb(160, 35, 35)","important"),n.style.setProperty("background-image",`url("data:image/svg+xml,${encodeURIComponent(I)}")`,"important"),n.style.setProperty("background-repeat","no-repeat","important"),n.style.setProperty("background-position","center","important"),n.style.setProperty("color","transparent","important"),t.value=null,console.log("Chat field was blocked, re-enabled.")):o===en&&(console.log("Lost connection, reloading..."),setTimeout((()=>{window.location.reload()}),e))}}const hs=new MutationObserver((()=>{const{chatField:e,chatSend:t}=_t();gs(5e3,e,t)})),{chatField:fs}=_t();fs&&hs.observe(fs,{attributes:!0,attributeFilter:["disabled"]}),document.addEventListener("visibilitychange",(()=>{if("visible"===document.visibilityState){const{chatField:e,chatSend:t}=_t();gs(1e3,e,t)}}))}function on(){const{chatHidden:e,chatField:t}=_t();!e&&t&&t.focus()}function sn(e){console.log("Clicked element:",e.target);const t=e.target.classList.contains("general")?"general":"game";localStorage.setItem("activeChatTab",t)}[...document.querySelectorAll(".general.c, .game.c")].forEach((e=>e.addEventListener("click",sn))),document.addEventListener("keydown",(e=>{"Tab"===e.key&&(!function(){const{nextChatTab:e,chatField:t,chatHidden:n}=_t();!n&&e&&(e.click(),t?.focus())}(),e.preventDefault())}));const an=document.querySelector(".mostright");function rn(){const{chatField:e}=_t();e.setAttribute("maxlength","1000"),e.addEventListener("paste",(t=>{t.preventDefault();const n=t.clipboardData.getData("text");let o=n;St(n)&&(o=kt(n));const s=e.selectionStart,a=e.selectionEnd;e.value=e.value.slice(0,s)+o+e.value.slice(a),e.setSelectionRange(s+o.length,s+o.length)})),e.addEventListener("keydown",(t=>{const n=e.value;"Enter"===t.key&&(n.length>300?(t.preventDefault(),async function(e){const t=e.split(" ").reduce(((e,t)=>{const n=e[e.length-1];return(n+" "+t).trim().length>300?[...e,t]:[...e.slice(0,-1),(n+" "+t).trim()]}),[""]),{chatField:n,chatSend:o}=_t(),s=e.length>300;s&&(n.disabled=!0);for(let e=0;e<t.length;e++){const s=t[e];if(n.value=s,console.log(`Sending piece ${e+1}: "${s}" (Length: ${s.length})`),o.click(),e<t.length-1){const e=Math.floor(500*Math.random())+500;console.log(`Waiting for ${e} ms before sending the next piece.`),await new Promise((t=>setTimeout(t,e)))}}s&&(n.disabled=!1)}(n),console.log(`Long message processed: "${n}"`),e.value=""):console.log(`Short message processed: "${n}"`))}))}(dt("gmid")||dt("gamelist"))&&an.addEventListener("click",(()=>{setTimeout((()=>{document.querySelector("#chat-wrapper.chat-hidden")?(localStorage.setItem("shouldShowPopupMessage","true"),isInitializedChat=!1):(pruneDeletedMessages(),on(),isInitializedChat=!1,setTimeout((()=>isInitializedChat=!1),3e3),localStorage.setItem("shouldShowPopupMessage","false"))}),300)})),(dt("gmid")||dt("gamelist"))&&document.addEventListener("keydown",(e=>{if(e.ctrlKey&&"Space"===e.code){const e=document.querySelector("#chat-fixed-placeholder"),t="none"===e.style.display;e.style.display=t?"unset":"none",localStorage.setItem("shouldShowPopupMessage",!t),t?_t().chatField?.focus():document.querySelector(".popup-messages-container")?.remove()}}));const ln=[{family:"Montserrat",weights:["100","200","300","400","500","600","700","800","900"]},{family:"Orbitron",weights:["400","500","600","700","800","900"]},{family:"Roboto Mono",weights:["100","200","300","400","500","600","700"]}];async function cn(){try{ln.forEach((e=>{!function(e,t){if(!document.querySelector(`.font-${e.replace(/\s/g,"-")}`)){const n=document.createElement("link");n.rel="stylesheet",n.href=`https://fonts.googleapis.com/css2?family=${e.replace(/\s/g,"+")}:wght@${t.join(";")}&display=swap`,n.classList.add(`font-${e.replace(/\s/g,"-")}`),document.head.appendChild(n)}}(e.family,e.weights)}))}catch(e){console.error("Font loading failed:",e)}}let dn=null,mn=null,pn=null,un=!1,gn=!1,hn=null;const fn=(e,t)=>{if(!dn)return;let n=e+10;const o=dn.offsetWidth,s=window.innerWidth;n=Math.min(Math.max(n,10),s-o-10),dn.style.left=`${n}px`,dn.style.top=`${t+18}px`},yn=e=>dn&&fn(e.clientX,e.clientY),vn=()=>{un=!1,hn=null,clearTimeout(pn),clearTimeout(mn),mn=setTimeout((()=>{dn&&(dn.style.opacity="0",gn=!1,setTimeout((()=>{!un&&dn&&(dn.style.display="none",dn.textContent="",document.removeEventListener("mousemove",yn))}),50))}),100)};function bn(e,t){null!=t&&(e._tooltipContent=t,e._tooltipInitialized||(e._tooltipInitialized=!0,dn||=(()=>{const e=document.createElement("div");return e.classList.add("custom-tooltip-popup"),e.style.position="absolute",e.style.display="none",e.style.opacity="0",document.body.appendChild(e),e})(),e.addEventListener("mouseenter",(t=>{un=!0,hn=e,clearTimeout(mn),clearTimeout(pn),dn.textContent=e._tooltipContent,dn.style.display="flex",dn.style.opacity="0",dn.offsetHeight,fn(t.clientX,t.clientY),document.addEventListener("mousemove",yn),pn=setTimeout((()=>{dn.style.opacity="1",gn=!0}),600)})),e.addEventListener("mouseleave",vn)))}new MutationObserver((()=>{hn&&!document.contains(hn)&&vn()})).observe(document,{childList:!0,subtree:!0});var xn=n(344),wn={};wn.styleTagTransform=g(),wn.setAttributes=d(),wn.insert=l().bind(null,"head"),wn.domAPI=r(),wn.insertStyleElement=p();s()(xn.A,wn);xn.A&&xn.A.locals&&xn.A.locals;const{usersToTrack:Sn}=Me;function kn(e){const t=document.createElement("span");return t.classList.add("action-icon"),t.style.margin="0 4px",t.style.setProperty("border","none","important"),t.innerHTML=e,t}function En(e,t,n,o,s){const a={generalChat:".messages-content div",cachePanel:".fetched-users .action-log"}[s];if(!a)return void console.error("Invalid or missing container. Please provide 'generalChat' or 'cachePanel'.");const r=document.querySelector(a);if(!r)return void console.error("Container not found in DOM.");r.classList.add("generalChat"===s?"static-chat-notifications-container":"static-cache-notifications-container");const i=document.createElement("span");i.classList.add("static-chat-notification"),"generalChat"===s&&i.addEventListener("dblclick",(()=>{!async function(e=40,t=600,n=140){const o=document.querySelector(".messages-content");if(!o)return;const s=o.style.scrollBehavior;o.style.scrollBehavior="smooth";const a=[...document.querySelectorAll(".static-chat-notification")].reverse();for(const s of a){!Nn(s,o)&&(o.scrollTop=s.offsetTop-o.offsetTop-o.clientHeight/2,await Tn(t)),Object.assign(s.style,{transition:[`opacity ${n/1e3}s cubic-bezier(.3,.1,1,.1)`,`transform ${n/1e3}s cubic-bezier(0,.7,.3,0.95)`].join(","),opacity:0,transformOrigin:"left",transform:"translateX(8em) skewX(-20deg)"}),await Tn(n),s.remove(),await Tn(e)}o.scrollHeight-o.scrollTop<=o.clientHeight||(o.scrollTop=o.scrollHeight,await Tn(t));o.style.scrollBehavior=s}()}));const l=document.createElement("span");l.classList.add("action-user"),l.textContent=e;const c=kn(t),d=document.createElement("span");d.classList.add("action-time"),d.textContent=n,i.appendChild(l),i.appendChild(c),i.appendChild(d),i.dataset.username=e,i.dataset.time=n,o?i.classList.add("user-enter"):i.classList.add("user-left"),r.appendChild(i),i.addEventListener("mouseover",(()=>{const e=qt(i.dataset.username,i.dataset.time);bn(i,e)}))}const Cn=[];let Ln=!1;const Tn=e=>new Promise((t=>setTimeout(t,e)));function Mn(){if(0===Cn.length)return void(Ln=!1);Ln=!0;const{user:e,iconType:t,time:n,presence:o}=Cn.shift();!function(e,t,n,o){let s=document.querySelector(".dynamic-chat-notifications-container");s||(s=document.createElement("div"),s.classList.add("dynamic-chat-notifications-container"),document.body.appendChild(s));const a=document.createElement("span");a.classList.add("dynamic-chat-notification");const r=document.createElement("span");r.classList.add("action-user"),r.textContent=e;const i=kn(t),l=document.createElement("span");l.classList.add("action-time"),l.textContent=n,a.appendChild(r),a.appendChild(i),a.appendChild(l),a.dataset.username=e,a.dataset.time=n,o?a.classList.add("user-enter"):a.classList.add("user-left"),s.appendChild(a),a.addEventListener("mouseover",(()=>{const e=qt(a.dataset.username,a.dataset.time);bn(a,e)})),setTimeout((()=>{a.style.transform="translateX(0)",setTimeout((()=>{a.style.transform="translateX(-100%)",setTimeout((()=>{s.removeChild(a)}),300)}),5e3)}),300)}(e,t,n,o),setTimeout(Mn,500)}function $n(e,t,n){const o=Sn.some((t=>t.name===e&&"thawed"===t.state)),s=o&&At("notifications","static"),a=At("notifications","dynamic");if(!s&&!a)return;const r=Bt();s&&o&&(En(e,t,r,n,"generalChat"),jt("generalMessages",350)),a&&function(e,t,n,o){Cn.push({user:e,iconType:t,time:n,presence:o}),Ln||Mn()}(e,t,r,n)}function Nn(e,t){const n=t.getBoundingClientRect(),o=e.getBoundingClientRect();return o.top>=n.top&&o.bottom<=n.bottom}const qn={Экстракибер:1,Кибергонщик:2,Супермен:3,Маньяк:4,Гонщик:5,Профи:6,Таксист:7,Любитель:8,Новичок:9},An={Экстракибер:"#06B4E9",Кибергонщик:"#5681ff",Супермен:"#B543F5",Маньяк:"#DA0543",Гонщик:"#FF8C00",Профи:"#C1AA00",Таксист:"#2DAB4F",Любитель:"#61B5B3",Новичок:"#AFAFAF"};function In(){const e=document.querySelector(".cached-users-panel");if(e)return e.remove(),void xt("hide");gt();let t=JSON.parse(localStorage.getItem("fetchedUsers"))||{};const n=document.createElement("div");n.className="cached-users-panel popup-panel",ce.panelsEvents.handleCacheKeydown=e=>{"Escape"===e.key&&(wt(n,"hide"),xt("hide"),document.removeEventListener("keydown",ce.panelsEvents.handleCacheKeydown))},document.addEventListener("keydown",ce.panelsEvents.handleCacheKeydown);const o=document.createElement("div");o.className="panel-header";const s=document.createElement("div");s.className="drop-time";const a=document.createElement("span");a.className="drop-time-threshold-description",a.textContent="🚧 Threshold";const r=document.createElement("span");r.className="drop-time-threshold";const i=localStorage.getItem("cacheRefreshThresholdHours");r.innerHTML=i||"00:00:00",r.addEventListener("click",(function(){let e=!1;for(;!e;){const t=prompt("Enter a cache refresh time (e.g., HH, HH:mm, or HH:mm:ss):"),n=document.querySelector(".drop-time-threshold");if(null===t)e=!0;else if(/^([0-9]+|[01][0-9]|2[0-4])(:([0-5]?[0-9])(:([0-5]?[0-9]))?)?$/.test(t)){const[o,s="00",a="00"]=t.split(":").map((e=>e.padStart(2,"0")));n.textContent=`${o}:${s}:${a}`,localStorage.setItem("cacheRefreshThresholdHours",`${o}:${s}:${a}`),localStorage.removeItem("fetchedUsers"),localStorage.removeItem("lastClearTime"),localStorage.removeItem("nextClearTime"),setTimeout((()=>location.reload()),1e3),e=!0}else alert("Invalid time format. Please use HH, HH:mm, or HH:mm:ss.")}}));const l=document.createElement("span");l.className="drop-time-expiration-description",l.textContent="💣 Countdown";const c=document.createElement("span");c.className="drop-time-expiration",s.append(a,r,l,c),o.appendChild(s);const d=document.createElement("div");d.className="search-for-cached-users";const m=document.createElement("input");m.className="cached-users-search-input",m.type="text",d.appendChild(m),m.addEventListener("click",(()=>mt&&(m.value=""))),m.addEventListener("input",(()=>{const e=document.querySelector(".old-users"),t=document.querySelector(".new-users"),n=document.querySelector(".fetched-users");if(!m.value.trim()){e.style.display="grid",t.style.display="grid";const o=document.querySelector(".search-results");o&&n&&n.removeChild(o)}})),m.addEventListener("keydown",(e=>{"Enter"!==e.key||e.target.value.trim()||(e.preventDefault(),e.target.value="user ")}));const p=async e=>{const t=document.querySelector(".old-users"),n=document.querySelector(".new-users"),o=document.querySelector(".fetched-users");if(e){t.style.display="none",n.style.display="none";let s=document.querySelector(".search-results")||k("search");s.parentElement||o.appendChild(s),s.replaceChildren();const a=[];try{const t=await async function(e){const t=`https://klavogonki.ru/api/profile/search-users?query=${e}`,n=(await Mt(t)).all;if(!n||0===n.length)throw new Error(`User ${e} not found.`);return n.map((e=>e.id))}(e);await Promise.all(t.map((async e=>{const t=await $t(e,!1),n={rank:t.rank,login:t.login,registered:t.registeredDate,bestSpeed:t.bestSpeed,ratingLevel:t.ratingLevel,friends:t.friends,cars:t.cars,avatarTimestamp:t.avatarTimestamp,avatar:t.avatar},o=N(e,n);o&&a.push(o)}))),a.sort(((e,t)=>e.order!==t.order?e.order-t.order:t.bestSpeed-e.bestSpeed)),a.forEach((({userElement:e})=>s.appendChild(e)));const n=L(`Search Results for: ${e}`,"search-results-description");s.prepend(n)}catch(e){console.error("Error fetching user profile:",e);const t=document.createElement("div");t.className="error-message",t.textContent=`Error: ${e.message}`,s.appendChild(t)}}};m.addEventListener("input",vt((e=>{const t=e.target.value.trim(),n=localStorage.getItem("cachePanelSearchMode"),o=t.startsWith("user ")?t.substring(5).trim():"fetch"===n?t:"";o&&p(o)}),ne)),o.appendChild(d);const u=new MutationObserver((e=>{if(e.some((e=>"childList"===e.type&&e.addedNodes.length))){const e=document.querySelector(".cached-users-search-input"),t=Array.from(document.querySelectorAll(".fetched-users .login")),n=(e,t)=>{let n=0,o=0;for(const s of t.toLowerCase())o<e.length&&s===e[o].toLowerCase()&&(n+=2,o++);return o===e.length?n:0},o=e=>{t.forEach((t=>{t.closest(".user-item").style.display=!e||n(e,t.textContent)>0?"grid":"none"}))};e.focus(),e.addEventListener("input",(()=>o(e.value.trim()))),u.disconnect()}}));u.observe(o,{childList:!0,subtree:!0});const g=document.createElement("div");g.className="panel-control-buttons",g.style.display="flex";const h=document.createElement("div");h.className="large-button user-mode-button",h.innerHTML=Y;const f=localStorage.getItem("cachePanelSearchMode")||(localStorage.setItem("cachePanelSearchMode","cache"),"cache");function y(e){h.classList.toggle("cache-mode-button","cache"===e),h.classList.toggle("fetch-mode-button","cache"!==e)}h.title=`Current active mode: ${f}`,y(f),h.addEventListener("click",(()=>{const e="cache"===localStorage.getItem("cachePanelSearchMode")?"fetch":"cache";localStorage.setItem("cachePanelSearchMode",e),y(e),h.title=`Current active mode: ${e}`;const t=document.querySelector(".old-users"),n=document.querySelector(".new-users");let o=document.querySelector(".search-results");"fetch"===e?(t.style.display="none",n.style.display="none",o||(o=document.createElement("div"),o.className="users-container search-results",S.appendChild(o)),o.style.display="grid"):(t.style.display="grid",n.style.display="grid",o&&(o.style.display="none"))})),g.appendChild(h);const x=document.createElement("div");x.className="large-button panel-header-clear-button",x.title="Clear cache",x.innerHTML=X,x.addEventListener("click",(()=>{jn(),Nt(!0,de);const e=document.querySelector(".cache-panel-load-button .cache-user-count");e&&(e.textContent="0")})),g.appendChild(x);const w=document.createElement("div");w.className="large-button panel-header-close-button",w.title="Close panel",w.innerHTML=O,w.addEventListener("click",jn),g.appendChild(w),o.appendChild(g);const S=document.createElement("div");function k(e){const t=document.createElement("div");return"old"===e?t.className="users-container old-users":"new"===e?t.className="users-container new-users":"search"===e&&(t.className="users-container search-results"),t}S.className="fetched-users";const E=k("old"),C=k("new");function L(e,t){const n=document.createElement("span");return n.className=`description ${t}`,n.textContent=e,n}E.appendChild(L("Active Users","old-users-description")),C.appendChild(L("New Registrations","new-users-description")),S.append(E,C);const T=[];let M=!0;const $=new Date,N=(e,t)=>{const n=document.createElement("div");n.className="user-item";const o=document.createElement("div");o.className="avatar";const s=t.avatarTimestamp,a=`/storage/avatars/${e}_big.png`;if(s&&"00"!==s||t.avatar&&Object.keys(t.avatar).length){const e=document.createElement("img");e.src=`${a}?updated=${s}`,e.alt=`${t.login}'s avatar`,e.style.objectFit="cover",o.appendChild(e)}else o.innerHTML=Tt();const r=document.createElement("div");r.className="user-data";const i=document.createElement("div");i.className="login-container";const l=document.createElement("a");l.className="login",l.textContent=t.login,l.href=`https://klavogonki.ru/profile/${e}`,i.appendChild(l);const c=oe+e,d=`${oe}${ae}/messages/${e}/`;if(l.addEventListener("click",(e=>{if(e.preventDefault(),e.ctrlKey&&e.shiftKey){const e=window.open(d,"_blank");e&&e.focus()}else e.ctrlKey?Ct(d):Ct(c)})),void 0!==t.visits){const n=document.createElement("span");n.className="visits "+(t.tracked?"tracked":"untracked"),n.textContent=t.visits,n.dataset.userId=e,function(e){const t=Number(e.textContent);if(isNaN(t))return console.warn("Invalid visits count!");const n=t<=10?"💧":t<=20?"💦":t<=30?"🌊":"🔥";e.textContent=`${n} ${t}`}(n),i.appendChild(n),n.addEventListener("click",(e=>{M=!0;const o=n.dataset.userId,s=JSON.parse(localStorage.getItem("fetchedUsers"))||{},a=s?s[o]:null,r=a?.actionLog;if(a){let n=document.querySelector(".action-log");n?n.replaceChildren():(n=document.createElement("div"),n.className="action-log",S.appendChild(n),bt(n,"show",1)),r&&M&&r.forEach(((e,n)=>{if(!M||"object"!=typeof e||!e)return;const{type:o,timestamp:s}=e,a=t.login||"Unknown User",r="enter"===o?v:b,i="enter"===o;setTimeout((()=>{M&&En(a,r,s,i,"cachePanel")}),10*(n+1))}));const o=e=>{n.contains(e.target)&&"Space"!==e.code||("Space"===e.code&&e.preventDefault(),bt(n,"hide",0),M=!1,["click","keydown"].forEach((e=>document.removeEventListener(e,o))))};["click","keydown"].forEach((e=>document.addEventListener(e,o))),e.stopPropagation()}else console.error("User data not found")}))}r.appendChild(i);const m=document.createElement("div");m.className="rank",m.textContent=t.rank||"N/A",m.style.color=An[t.rank]||"white",r.appendChild(m);const p=document.createElement("div");let u;p.className="registered",p.textContent=t.registered||"N/A";const g=p.textContent;p.addEventListener("mouseover",(()=>{clearTimeout(u),u=setTimeout((()=>{p.textContent=function(e){const t=Math.floor((new Date-new Date(e))/1e3),n=Math.floor(t/31536e3),o=Math.floor(t%31536e3/(30.44*24*60*60)),s=Math.floor(t%(30.44*24*60*60)/86400),a=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),i=t%60,l=[];return n>0?(l.push(`${n} year${n>1?"s":""}`),o>0&&l.push(`${o} month${o>1?"s":""}`)):o>1||1===o&&s>0?(l.push(`${o} month${o>1?"s":""}`),s>0&&l.push(`${s} day${s>1?"s":""}`)):s>0?(l.push(`${s} day${s>1?"s":""}`),a>0&&l.push(`${a} hour${a>1?"s":""}`),r>0&&l.push(`${r} minute${r>1?"s":""}`)):a>0?(l.push(`${a} hour${a>1?"s":""}`),r>0&&l.push(`${r} minute${r>1?"s":""}`)):r>0?(l.push(`${r} minute${r>1?"s":""}`),i>0&&l.push(`${i} second${i>1?"s":""}`)):l.push(`${i} second${i>1?"s":""}`),l.filter(Boolean).join(" ")}(t.registered)}),300)})),p.addEventListener("mouseout",(()=>{clearTimeout(u),p.textContent=g})),r.appendChild(p);const h=(e,t,n,o,s,a)=>{const r=document.createElement("span");return r.className=e,r.style.color=t,r.innerHTML=`${n}${o||0}`,r.title=s,r.style.cursor="pointer",r.addEventListener("click",(()=>Ct(a))),r},f=document.createElement("div");return f.className="user-metrics",f.append(h("best-speed","cyan","🚀",t.bestSpeed,"Best speed",`https://klavogonki.ru/u/#/${e}/stats/normal/`),h("rating-level","gold","⭐",t.ratingLevel,"Rating level",`https://klavogonki.ru/top/rating/today?s=${t.login}`),h("cars-count","lightblue","🚖",t.cars,"Cars count",`https://klavogonki.ru/u/#/${e}/car/`),h("friends-count","lightgreen","🤝",t.friends,"Friends count",`https://klavogonki.ru/u/#/${e}/friends/list/`)),n.append(o,r,f),{userElement:n,order:qn[t.rank]||10,bestSpeed:t.bestSpeed||0,registered:t.registered}};"cache"===localStorage.getItem("cachePanelSearchMode")&&(Object.keys(t).forEach((e=>{const n=t[e];T.push(N(e,n))})),T.sort(((e,t)=>e.order!==t.order?e.order-t.order:t.bestSpeed-e.bestSpeed)),T.forEach((({userElement:e,registered:t})=>{((e=>$-new Date(e)<=864e5)(t)?C:E).appendChild(e)}))),document.body.appendChild(n),n.append(o,S);const{scrollButtonsContainer:q}=yt(S);function A(){const e=localStorage.getItem("lastClearTime"),t=localStorage.getItem("nextClearTime"),n=document.querySelector(".drop-time-expiration");if(e&&t&&n){const e=t-Date.now();e<=0?Nt(!0,de):function(e,t){const n=String(Math.floor(t/36e5)).padStart(2,"0"),o=String(Math.floor(t%36e5/6e4)).padStart(2,"0"),s=String(Math.floor(t%6e4/1e3)).padStart(2,"0"),a=5*Math.ceil(parseInt(s)/5);e.textContent=`${n}:${o}:${s} ${I[a]||I[0]}`}(n,e)}}n.appendChild(q),wt(n,"show"),xt("show");const I={0:"🕛",5:"🕐",10:"🕑",15:"🕒",20:"🕓",25:"🕔",30:"🕕",35:"🕖",40:"🕗",45:"🕘",50:"🕙",55:"🕚"};setInterval(A,1e3),A()}function jn(){const e=document.querySelector(".cached-users-panel");e&&(wt(e,"hide"),xt("hide"))}let{fetchedUsers:On}=ce;const{usersToTrack:Bn,ignored:Hn,moderator:Dn}=Me;function Pn(e){const t={class:"unknown",icon:"❓",color:"#000000"},n={Экстракибер:{class:"extra",icon:"🚀",color:"#06B4E9"},Кибергонщик:{class:"cyber",icon:"🤖",color:"#5681ff"},Супермен:{class:"superman",icon:"👊",color:"#B543F5"},Маньяк:{class:"maniac",icon:"🔪",color:"#DA0543"},Гонщик:{class:"racer",icon:"⚡️️",color:"#FF8C00"},Профи:{class:"profi",icon:"️💼️",color:"#C1AA00"},Таксист:{class:"driver",icon:"🚖️",color:"#2DAB4F"},Любитель:{class:"amateur",icon:"🍆️",color:"#61B5B3"},Новичок:{class:"newbie",icon:"🐥",color:"#AFAFAF"}}[e]||t;return n.class===t.class&&console.log(`Class not found for status title: ${e}. Using default class: ${t.class}`),n}function zn(e,t,n,o,s){const a=On?.[e]?.avatarTimestamp,r="00"!==a?`/storage/avatars/${e}_big.png?updated=${a}`:"",i=document.createElement("div"),l=Pn(t),c=l.class,d=l.color,m=l.icon;i.classList.add(`user${e}`,c);const p=document.createElement("div");if(p.classList.add("avatar"),"00"!==a){const e=document.createElement("img");e.src=r,p.appendChild(e)}else p.style.fontSize="1.8rem",p.innerHTML=Tt();const u=document.createElement("a");u.classList.add("name"),u.title="Send private message",u.dataset.user=e,u.textContent=n,u.style.setProperty("color",d,"important");const g=document.createElement("a");g.classList.add("profile");bn(g,`${m} ${t} - ${o}`),g.target="_blank",g.href=`/profile/${e}/`;let h=function(e,t,n){const o="http://www.w3.org/2000/svg",s=20,a=10,r=Math.random().toString(36).substring(2,22),i=n||0!==e?1:.6,l=document.createElementNS(o,"svg");if(Object.entries({width:s,height:s,viewBox:"0 0 20 20",xmlns:o}).forEach((([e,t])=>l.setAttribute(e,t))),l.classList.add("circularProgress"),n||0===e){if(!n){const e=document.createElementNS(o,"circle");Object.entries({cx:a,cy:a,r:8,fill:"none",stroke:t,"stroke-width":2}).forEach((([t,n])=>e.setAttribute(t,n))),e.classList.add("outerCircle"),l.appendChild(e)}const e=s/24*i,r=a-12*e,c=document.createElementNS(o,"g");c.setAttribute("transform",`translate(${r}, ${r}) scale(${e})`),c.classList.add("closeIconGroup");const d=document.createElementNS(o,"path");Object.entries({d:"M18.364 5.636a1 1 0 0 1 0 1.414L13.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414L12 13.414l-4.95 4.95a1 1 0 0 1-1.414-1.414L10.586 12l-4.95-4.95a1 1 0 0 1 1.414-1.414L12 10.586l4.95-4.95a1 1 0 0 1 1.414 0z",fill:t}).forEach((([e,t])=>d.setAttribute(e,t))),c.appendChild(d),l.appendChild(c)}else{const n=document.createElementNS(o,"defs");n.classList.add("defs");const s=document.createElementNS(o,"clipPath");s.setAttribute("id",`clipInner-${r}`),s.classList.add("clipPath");const i=document.createElementNS(o,"rect");Object.entries({x:2,y:2,width:16,height:0,transform:"rotate(180, 10, 10)"}).forEach((([e,t])=>i.setAttribute(e,t))),i.classList.add("clipRect");const c=document.createElementNS(o,"animate");Object.entries({attributeName:"height",from:0,to:e/100*16,begin:"indefinite",dur:"1s",fill:"freeze",calcMode:"spline",keySplines:"0.4 0 0.2 1",keyTimes:"0;1"}).forEach((([e,t])=>c.setAttribute(e,t))),c.classList.add("animateProfileProgress"),i.appendChild(c),s.appendChild(i),n.appendChild(s),l.appendChild(n);const d=document.createElementNS(o,"circle");Object.entries({cx:a,cy:a,r:8,fill:"none",stroke:t,"stroke-width":2}).forEach((([e,t])=>d.setAttribute(e,t))),d.classList.add("outerCircle"),l.appendChild(d);const m=document.createElementNS(o,"circle");Object.entries({cx:a,cy:a,r:8,fill:t,"clip-path":`url(#clipInner-${r})`}).forEach((([e,t])=>m.setAttribute(e,t))),m.classList.add("innerCircle"),l.appendChild(m)}return l.outerHTML}(function(e){const t=100*Math.floor(e/100);return(e-t)/(t+100-t)*100}(o),d,s);g.innerHTML=h,setTimeout((()=>{const e=g.querySelector(".animateProfileProgress");e&&e.beginElement()}),10),g.addEventListener("click",(function(t){t.preventDefault(),mt?window.open(oe+e,"_blank"):Ct(oe+e)}));const f=`${oe}${ae}/messages/${e}/`;u.addEventListener("click",(function(t){if(t.ctrlKey&&t.shiftKey){const e=window.open(f,"_blank");e&&e.focus()}else t.ctrlKey?Ct(f):function(e){const t=`<${document.querySelector(`.name[data-user="${e}"]`).textContent}>`,n=document.querySelector(".messages .text");n.value=t,n.focus(),n.selectionEnd=n.value.length}(e)})),i.appendChild(p),i.appendChild(u),i.appendChild(g);if(Bn.find((e=>e.name===n&&"thawed"===e.state))){const e=document.createElement("div");e.title="Tracked user",e.classList.add("tracked"),e.innerHTML=w,i.appendChild(e)}if(Hn.includes(n)){const e=document.createElement("div");e.title="Ignored user",e.classList.add("ignored"),e.innerHTML=S,i.appendChild(e)}const y=document.querySelector(`.userlist-content ins.user${e} img[src*="moderator"]`),v=Dn.includes(n);if(y||v){const e=document.createElement("div");e.classList.add("moderator"),e.innerHTML=x,i.appendChild(e)}return i}async function Fn(e,t){try{const n=document.querySelector(".userlist-content");let o=document.querySelector(".chat-user-list");if(!o){o=document.createElement("div"),o.classList.add("chat-user-list");const e=document.querySelector(".userlist");e&&e.appendChild(o)}const s={};["extra","cyber","superman","maniac","racer","profi","driver","amateur","newbie"].forEach((e=>{const t=o.querySelector(`.rank-group-${e}`);t?s[e]=t:(s[e]=document.createElement("div"),s[e].classList.add(`rank-group-${e}`),o.appendChild(s[e]))}));const a=new Set;for(const o of n.querySelectorAll("ins")){const n=o.querySelector(".name"),r=n.getAttribute("data-user"),i=n.textContent;if(!a.has(r))try{const{rank:n,login:l,registeredDate:c,bestSpeed:d,ratingLevel:m,friends:p,cars:u,avatarTimestamp:g}=await $t(r);On[r]?(On[r].rank=n,On[r].login=l,On[r].registered=c,On[r].bestSpeed=d,On[r].ratingLevel=m,On[r].friends=p,On[r].cars=u,On[r].avatarTimestamp=g):On[r]={rank:n,login:l,registered:c,bestSpeed:d,ratingLevel:m,friends:p,cars:u,avatarTimestamp:g},e===i&&"enter"===t&&(On[r].visits=(On[r].visits||0)+1,On[r].tracked=Bn.some((t=>t.name===e)));const{class:h}=Pn(n);if(!s[h].querySelector(`.user${r}`)){const e=zn(r,n,i,d,o.classList.contains("revoked"));s[h].appendChild(e),us&&he(e)}a.add(r)}catch(e){console.error(`Error fetching profile summary for user ${r}:`,e)}}o.querySelectorAll('.chat-user-list [class^="user"]').forEach((e=>{const t=e.querySelector(".name").getAttribute("data-user");a.has(t)||e.remove()})),Object.values(s).forEach((e=>[...e.children].sort(((e,t)=>(On[t.querySelector(".name")?.getAttribute("data-user")]?.bestSpeed||0)-(On[e.querySelector(".name")?.getAttribute("data-user")]?.bestSpeed||0))).forEach((t=>e.appendChild(t))))),localStorage.setItem("fetchedUsers",JSON.stringify(On)),function(){const e=document.querySelector(".cache-panel-load-button .cache-user-count");if(!e)return;const t=Object.keys(JSON.parse(localStorage.getItem("fetchedUsers"))||{}).length.toString();t!==e.textContent&&(e.textContent=t,fe(e))}()}catch(e){console.error("Error refreshing user list:",e)}}var Un=n(479),_n={};_n.styleTagTransform=g(),_n.setAttributes=d(),_n.insert=l().bind(null,"head"),_n.domAPI=r(),_n.insertStyleElement=p();s()(Un.A,_n);Un.A&&Un.A.locals&&Un.A.locals;class Rn{constructor(){this.selected=new Set,this.isDragging=!1,this.toggleBtn=null,this.init()}init(){this.attachEvents(),this.updateDeletedMessages(),this.renderToggle()}attachEvents(){document.addEventListener("mousedown",(e=>{const t=e.target.closest(".messages-content p");if(t&&2===e.button&&t){if(e.target.closest(".time")){const n=Array.from(document.querySelectorAll(".messages-content p")),o=n.indexOf(t);if(-1!==o)if(e.ctrlKey)n.slice(o).forEach((e=>{this.toggleSelect(e,!0,"time-mode"),e.classList.add("time-mode")}));else{const e=t.querySelector(".username");if(e){const t=e.textContent.trim();n.slice(o).forEach((e=>{const n=e.querySelector(".username");n&&n.textContent.trim()===t&&(this.toggleSelect(e,!0,"time-mode"),e.classList.add("time-mode"))}))}}}else if(e.target.closest(".username")){const t=e.target.closest(".username").textContent.trim();document.querySelectorAll(".messages-content p").forEach((e=>{const n=e.querySelector(".username");n&&n.textContent.trim()===t&&(this.toggleSelect(e,!0,"username-mode"),e.classList.add("username-mode"))}))}else this.isDragging=!0,this.toggleSelect(t,!0,"message-mode")}})),document.addEventListener("mouseup",(()=>this.isDragging=!1)),document.addEventListener("mousemove",(e=>{if(!this.isDragging)return;const t=e.target.closest(".messages-content p");t&&this.toggleSelect(t,!0,"message-mode")})),document.addEventListener("contextmenu",(e=>{const t=e.target.closest(".messages-content p");t&&(Zt()||(e.preventDefault(),this.showDeleteButton(e,t)))}))}toggleSelect(e,t,n="message-mode"){if(!e)return;if(Zt())return;e.classList.toggle("selected-message",t),t?"message-mode"===n&&e.classList.add("message-mode"):e.classList.remove("username-mode","time-mode","message-mode");const o=Jn(e);t?this.selected.add(o):this.selected.delete(o)}showDeleteButton(e,t){if(Zt())return;const n=document.querySelector(".delete-btn");n&&n.remove();const o=document.createElement("button");o.className="delete-btn",o.textContent="Delete",document.body.append(o);const{offsetWidth:s,offsetHeight:a}=o;let r;o.remove(),Object.assign(o.style,{position:"fixed",top:e.clientY-a/2+"px",left:e.clientX-s/2+"px"}),o.onclick=()=>{document.querySelectorAll(".selected-message").forEach((e=>{e&&(e.classList.remove("selected-message","username-mode","time-mode","message-mode"),0===e.classList.length&&e.removeAttribute("class"))})),this.storeDeleted([...this.selected]),o.remove(),this.selected.clear(),this.updateDeletedMessages(),this.renderToggle()},o.addEventListener("mouseenter",(()=>{r&&clearTimeout(r)})),o.addEventListener("mouseleave",(()=>{r=setTimeout((()=>{o.remove(),this.clearSelection()}),1e3)})),document.body.append(o)}clearSelection(){document.querySelectorAll(".selected-message").forEach((e=>{e&&(e.classList.remove("selected-message","username-mode","time-mode","message-mode"),0===e.classList.length&&e.removeAttribute("class"))})),this.selected.clear()}storeDeleted(e){const t=new Set(JSON.parse(localStorage.getItem("deletedChatMessagesContent")||"[]"));e.forEach((e=>t.add(e))),localStorage.setItem("deletedChatMessagesContent",JSON.stringify([...t]))}updateDeletedMessages(){const e=new Set(JSON.parse(localStorage.getItem("deletedChatMessagesContent")||"[]")),t=document.querySelectorAll(".messages-content p");0!==t.length&&(t.forEach((t=>{if(!t)return;const n=Jn(t);t.classList.remove("shown-message"),t.classList.toggle("hidden-message",e.has(n))})),localStorage.setItem("deletedChatMessagesContent",JSON.stringify([...e])))}renderToggle(){if(!(JSON.parse(localStorage.getItem("deletedChatMessagesContent")||"[]").length>0))return void(this.toggleBtn&&(this.toggleBtn.remove(),this.toggleBtn=null));const e=document.querySelector(".messages-content");e&&(this.toggleBtn||(this.toggleBtn=document.createElement("button"),this.toggleBtn.className="toggle-button toggle-hidden",this.toggleBtn.textContent="Show",this.toggleBtn.onclick=e=>{if(e.ctrlKey)return document.querySelectorAll(".messages-content p").forEach((e=>{e&&e.classList.remove("hidden-message","shown-message")})),localStorage.setItem("deletedChatMessagesContent",JSON.stringify([])),this.selected.clear(),this.updateDeletedMessages(),void this.renderToggle();const t="Show"===this.toggleBtn.textContent,n=JSON.parse(localStorage.getItem("deletedChatMessagesContent")||"[]");document.querySelectorAll(".messages-content p").forEach((e=>{if(!e)return;const o=Jn(e);n.includes(o)&&(e.classList.toggle("hidden-message",!t),e.classList.toggle("shown-message",t))})),t?(this.toggleBtn.textContent="Hide",this.toggleBtn.classList.remove("toggle-hidden"),this.toggleBtn.classList.add("toggle-shown")):(this.toggleBtn.textContent="Show",this.toggleBtn.classList.remove("toggle-shown"),this.toggleBtn.classList.add("toggle-hidden"))},e.append(this.toggleBtn)))}}function Jn(e){if(!e)return"";const t=e.cloneNode(!0);Array.from(t.querySelectorAll(".time")).forEach((e=>e.remove()));return[t.textContent,[...Array.from(e.querySelectorAll("a")).map((e=>e.href)),...Array.from(e.querySelectorAll("img")).map((e=>e.title.trim())),...Array.from(e.querySelectorAll("iframe")).map((e=>e.src.trim()))].filter(Boolean).join(" ")].filter(Boolean).join(" ")}const Kn={extra:"🚀",cyber:"🤖",superman:"👊",maniac:"🔪",racer:"⚡️",profi:"💼",driver:"🚖",amateur:"🍆",newbie:"🐥"};function Vn(e,t=0){const n=document.createElement("div");n.classList.add("participant-count"),n.innerHTML=t.toString(),e&&e.appendChild(n),n.addEventListener("mouseover",(function(){const e=Object.keys(Kn).reduce(((e,t)=>{const n=document.getElementsByClassName(t).length;return n>0&&e.push(`${Kn[t]}${n}`),e}),[]).join(" ");bn(n,e)}))}const{usersToTrack:Xn}=Me,Yn=_t().userList.general;let Gn=new Map,Wn=0,Zn=!1;function Qn(e,t){if(!e)return;const n=t.toString().length;e.textContent=t,e.style.fontSize=Math.max(24-2*(n-1),12)+"px"}const eo=new MutationObserver(vt((e=>{e.forEach((e=>{if("childList"===e.type){const t=document.querySelector("#voice, #beep, #silence"),n=t&&"silence"===t.id,o=document.querySelector("#chat-wrapper.chat-hidden"),s=document.querySelector(".participant-count");if(o)return void(s&&(s.style.filter="grayscale(100%)",s.textContent="0"));const a=new Map(Array.from(Yn.children).map((e=>{const t=e.querySelector(".name"),n=t?.getAttribute("data-user"),o=t?.textContent?.trim();return n?[n,{userName:o}]:null})).filter(Boolean));if(!us)return;if(!Zn)return s&&0===Number(s.textContent)&&function(e,t){let n=0;const o=()=>{if(n<=e){const s=Math.min(n/(e||1),1);Qn(t,n++),t.style.filter=`grayscale(${100-100*s}%)`,setTimeout(o,20)}else fe(t),ge(t),Zn=!0};setTimeout(o,20)}(a.size,s),a.forEach(((e,t)=>Gn.set(t,e))),void setTimeout((()=>{Zn=!0}),2e3);let r=[...a].filter((([e])=>!Gn.has(e))).map((([e,t])=>({userId:e,...t}))),i=[...Gn].filter((([e])=>!a.has(e))).map((([e,t])=>({userId:e,userName:t.userName})));Gn=new Map(a);const l=Gn.size;function c(e,t){const{userName:o,userId:s}=e,a=function(e){const t=at.find((t=>t.name===e));return t?t.gender:null}(o),r=Xn.some((e=>e.name===o&&"thawed"===e.state));$n(o,"enter"===t?v:b,"enter"===t),Fn(o,t),function(e,t){e&&t?(ct[e]=ct[e]||{},ct[e].actionLog=ct[e].actionLog||[],ct[e].actionLog.push({type:t,timestamp:Bt()})):console.error("Missing userId or actionType")}(s,t),!n&&r&&function(e,t,n){if(!At("sound","presence"))return;const o=n||"Male",s=Je.find((t=>t.name===e)),a="enter"===t?tt[o].enter:tt[o].leave;Ze("enter"===t?Ve:Xe,.2),setTimeout((()=>et(`${s.pronunciation} ${a}`,He)),300)}(o,t,a)}l!==Wn&&Zn&&s&&(Qn(s,l),s.style.filter=l>0?"none":"grayscale(100%)",fe(s)),r.forEach((e=>c(e,"enter"))),i.forEach((e=>c(e,"leave"))),Wn=l}}))}),ne));const to=["jpg","jpeg","png","gif","webp"],no="📸",oo="🖥️",so="💀️️",ao=.2,ro=10,io=.1;let lo=0,co=!1,mo=[],po=null;const{bigImageEvents:uo}=ce,go=e=>{const t=(e=>{try{return e.match(/\.([^?#.]+)(?:[?#]|$)/i)?.[1]?.toLowerCase()||""}catch(e){return console.error("Error extracting extension:",e.message),""}})(e);return{allowed:to.includes(t),extension:t}},ho=(e,t)=>{const n=document.createElement("img");n.src=e,n.classList.add("scaled-thumbnail"),document.body.appendChild(n),lo=t;let o=1,s=!1,a=0,r=0,i=-50,l=-50;const c=e=>{wt(e,"hide"),document.querySelector(".popup-panel")||xt("hide"),ut()};return uo.unfocusedClick=e=>{n.contains(e.target)||(n.remove(),ut())},uo.keydown=e=>{"Escape"===e.code||"Space"===e.code?(e.preventDefault(),c(n)):"ArrowLeft"===e.code?fo(-1):"ArrowRight"===e.code&&fo(1)},uo.wheel=e=>{const t=e.deltaY<0?1:-1;o+=t*io*o,o=Math.max(ao,Math.min(o,ro)),n.style.transform=`translate(${i}%, ${l}%) scale(${o})`},uo.mousemove=e=>{if(s){if(e.ctrlKey){const t=e.clientY-r,n=t<0?1:-1,s=Math.abs(t)*io*.05;o+=n*s*o,o=Math.max(ao,Math.min(o,ro))}else{const t=(e.clientX-a)/o*5,s=(e.clientY-r)/o*5;i+=t/n.clientWidth*100,l+=s/n.clientHeight*100}n.style.transform=`translate(${i}%, ${l}%) scale(${o})`,a=e.clientX,r=e.clientY}},uo.mousedown=e=>{const{button:t,clientX:o,clientY:i,target:l,ctrlKey:d}=e;if((0===t||2===t)&&l!==n)return;const m=l.src;0===t?fo(-1):2===t?(e.preventDefault(),d?(navigator.clipboard.writeText(m).catch(console.error),c(n)):fo(1)):1===t&&(s=!0,a=o,r=i,e.preventDefault())},uo.mouseup=e=>{1===e.button&&(s=!1)},uo.contextmenu=e=>e.preventDefault(),Object.entries(it).forEach((([e,t])=>{document.addEventListener(e,t)})),n},fo=e=>{const t=lo+e;t>=0&&t<mo.length&&!co&&(co=!0,po&&(po.src=mo[t].imgSrc),setTimeout((()=>co=!1),50),lo=t)};function yo(e){const t=document.querySelector({generalMessages:".messages-content div",chatlogsMessages:".chat-logs-container",personalMessages:".messages-container-wrapper"}[e]);if(!t)return;const n=t.querySelectorAll("a:not(.skipped):not(.processed-image)");function o(n,o){const s=document.createElement("div");s.classList.add("clickable-thumbnail"),s.dataset.sourceLink=n.href;const a=document.createElement("img");a.src=n.href,a.onload=()=>{s.appendChild(a),n.parentNode.insertBefore(s,n.nextSibling),jt(e,600)},a.onerror=()=>{console.error("Failed to load image:",n.href),n.classList.add("skipped")},o?n.querySelector(".clickable-thumbnail")||n.addEventListener("click",(e=>{n.querySelector(".clickable-thumbnail")||(s.appendChild(a),n.parentNode.insertBefore(s,n.nextSibling))})):(s.appendChild(a),n.parentNode.insertBefore(s,n.nextSibling)),s.addEventListener("click",(e=>{e.stopPropagation(),mo=[],t.querySelectorAll(".clickable-thumbnail").forEach(((e,t)=>{const n=e.querySelector("img");n&&e.dataset.sourceLink&&mo.push({link:e.dataset.sourceLink,imgSrc:n.src,index:t})}));const o=mo.findIndex((e=>e.link===n.href||e.imgSrc===a.src));po=ho(a.src,o>=0?o:0),wt(po,"show"),xt("show")}))}n.length&&n.forEach((e=>{if(!e.href||!e.href.startsWith("http"))return;const{allowed:t,extension:n}=go(e.href);if(!t)return;e.classList.add("media");const{isTrusted:s,domain:a}=Ht(e.href);e.title=St(e.href)?kt(e.href):e.href,s?function(e,t,n){e.textContent=`${no} ${t.toUpperCase()} ${oo} ${n}`,e.classList.add("processed-image"),o(e,!1)}(e,n,a):function(e,t,n){e.classList.add("skipped"),e.textContent=`${no} ${t.toUpperCase()} ${oo} ${n} ${so} Untrusted`,e.addEventListener("click",(t=>{e.classList.contains("processed-image")||(t.preventDefault(),e.classList.remove("skipped"),e.classList.add("processed-image"),o(e,!0))}))}(e,n,a)}))}const vo="📺",bo="📹",xo="🎬️",wo="🖥️",So="💀️️",ko=["mp4","webm","ogg","mov","avi"];let Eo=null,Co=null;async function Lo(e,t,n,o,s){e.innerHTML="",t.innerHTML="";const a=await async function(e){const t=`https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${e}&format=json`;try{const e=await fetch(t),n=await e.json();return{title:n.title||"Title not found",channel:n.author_name||"Channel not found"}}catch(e){return console.error("Error fetching YouTube metadata:",e),{title:"Error",channel:"Error"}}}(n),r=document.createElement("span");r.classList.add("channel-name"),r.textContent=`${vo} ${a.channel}`;const i=document.createElement("span");i.classList.add("video-title"),i.textContent=`${bo} ${a.title}`,e.append(r,i);const l=document.createElement("img");l.src=`https://img.youtube.com/vi/${n}/hqdefault.jpg`,l.alt=o,l.classList.add("youtube-thumb"),t.appendChild(l),l.addEventListener("load",(()=>{jt(s,600)}))}function To(e){if(!e)return void console.warn("containerType parameter is required");const t={generalMessages:".messages-content div",chatlogsMessages:".chat-logs-container",personalMessages:".messages-container-wrapper"};if(!t[e])return void console.warn(`Invalid containerType: ${e}`);const n=document.querySelector(t[e]);if(!n)return;const o=n.querySelectorAll("a:not(.skipped):not(.processed-video)");function s(e,t,n,o,s){const{youtubeMatch:a,videoType:r,videoId:i}=o,l=(e=>{const t=e.match(/\.([^?#.]+)(?:[?#]|$)/i)?.[1]?.toLowerCase()||"";return{allowed:ko.includes(t),extension:t}})(t);if(!a&&!l.allowed)return;e.classList.add("processed-video");const c=document.createElement("div");if(c.classList.add("video-wrapper"),e.textContent=`${xo} ${r} ${wo} ${n}`,e.title=St(t)?kt(t):t,e.style.display="inline-flex",a){const t=document.createElement("div");t.classList.add("youtube-info");const n=document.createElement("div");n.classList.add("youtube-placeholder"),n.dataset.videoId=i,n.dataset.videoType=r,n.dataset.containerType=s,e.parentNode.insertBefore(c,e),c.append(e,t,n),Lo(t,n,i,r,s),n.addEventListener("click",(()=>{if(Co&&Co!==n){const e=Co.dataset.videoId,t=Co.dataset.videoType,n=Co.dataset.containerType,o=Co.previousElementSibling;o&&o.classList.contains("youtube-info")&&Lo(o,Co,e,t,n)}Co=n;const e=(Eo||(Eo=document.createElement("iframe"),Eo.classList.add("video-container"),Eo.allowFullscreen=!0,Eo.setAttribute("allow","fullscreen")),Eo);e.src=`https://www.youtube.com/embed/${i}?autoplay=1`,n.innerHTML="",n.appendChild(e)}))}else{const n=document.createElement("video");n.classList.add("video-container"),n.src=t,n.controls=!0,e.parentNode.insertBefore(c,e),c.append(e,n)}}o.length&&o.forEach((t=>{const n=t.href;if(!n)return;const o=function(e){const t=e.match(/(?:shorts\/|live\/|watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]{11})/i);if(t)return{youtubeMatch:!0,videoId:t[1],videoType:e.includes("shorts/")?"Shorts":e.includes("live/")?"Live":e.includes("watch?v=")?"Watch":e.includes("youtu.be/")?"Share":"YouTube"};const n=e.split(".").pop().toLowerCase();return!!ko.includes(n)&&{youtubeMatch:!1,videoType:`Video (${n.toUpperCase()})`}}(n);if(!o)return;t.classList.add("media");const{isTrusted:a,domain:r}=Ht(n);if(!a)return t.classList.add("skipped"),t.textContent=`${xo} ${o.videoType} ${wo} ${r} ${So} Untrusted`,void t.addEventListener("click",(a=>{t.classList.contains("processed-video")||(a.preventDefault(),t.classList.remove("skipped"),s(t,n,r,o,e))}));s(t,n,r,o,e)}))}const Mo={};function $o(){if("true"!==localStorage.getItem("shouldShowPopupMessage"))return;const e=document.querySelector(".messages-content p:last-of-type");if(e){const t=e.querySelector(".time"),n=e.querySelector(".username"),o=Array.from(e.childNodes).map((e=>{if(e.nodeType===Node.TEXT_NODE)return{type:"text",value:e.nodeValue.replace(/ /g," ")};if(e.nodeType===Node.ELEMENT_NODE){if("a"===e.tagName.toLowerCase()&&e.classList.contains("private"))return{type:"text",value:"📢 "};if("span"===e.tagName.toLowerCase()&&e.classList.contains("private"))return{type:"text",value:e.textContent.replace(/ /g," ")};if("img"===e.tagName.toLowerCase())return{type:"img",title:e.getAttribute("title")};if("a"===e.tagName.toLowerCase())return{type:"anchor",href:e.getAttribute("href")}}})).filter(Boolean),s=t.textContent.replace(/[\[\]]/g,""),a=n.textContent.replace(/[<>]/g,"");let r=Mo[a];r||(r=15*Math.floor(24*Math.random()),Mo[a]=r);let i=document.querySelector(".popup-messages-container");if(i||(i=document.createElement("div"),i.classList.add("popup-messages-container"),document.body.appendChild(i)),i.childElementCount>=10){const e=i.firstChild;e.classList.add("fade-out"),setTimeout((()=>{i.removeChild(e)}),300)}const l=document.createElement("div");l.classList.add("popup-chat-message"),l.style.filter=`hue-rotate(${r}deg)`;const c=document.createElement("div");c.classList.add("time-icon"),c.innerHTML=icons.clockSVG;const d=document.createElement("div");d.classList.add("time"),d.textContent=s;const m=document.createElement("div");m.classList.add("user-icon"),m.innerHTML=icons.userSVG;const p=document.createElement("div");p.classList.add("username"),p.textContent=a;const u=document.createElement("div");u.classList.add("action-icon"),u.innerHTML=icons.actionSVG;const g=document.createElement("div");g.classList.add("message"),l.appendChild(c),l.appendChild(d),l.appendChild(m),l.appendChild(p),l.appendChild(u),l.appendChild(g),o.forEach((e=>{const t=document.createElement("div");"text"===e.type?t.textContent=e.value:"img"===e.type?t.innerHTML=`&nbsp;${e.title}&nbsp;`:"anchor"===e.type&&(t.innerHTML=`&nbsp;${e.href}&nbsp;`),g.appendChild(t)})),i.appendChild(l)}}const{ignored:No}=Me;let qo=!1;const Ao=new MutationObserver((async e=>{if(Jt(document.querySelectorAll(".username"),"all"),us)for(let t of e)if("childList"===t.type)for(let e of t.addedNodes)if(e.nodeType===Node.ELEMENT_NODE&&"P"===e.tagName){const t=e.querySelector(".username");t&&Jt(t,"one");const n=localStorage.getItem("previousMessageText"),o=await Kt(),s=o?.messageText||null,a=o?.usernameText||null,r=Ft(a);if(Ut(s)&&(console.log("Ban message detected:",s),new Audio("https://github.com/VimiummuimiV/Sounds/raw/refs/heads/main/Mario_Game_Over.mp3").play()),a&&No.includes(a)){e.classList.add("ignored-user",r),e.style.display="none";continue}const i=document.querySelector("#voice, #beep, #silence"),l=i&&"voice"===i.id,c=i&&"beep"===i.id,d=document.querySelector("#every-message, #mention-message"),m=d&&"every-message"===d.id,p=d&&"mention-message"===d.id,u="[шепчет вам]",g=e.querySelector(".room.private"),h=g&&g.textContent.includes(u);if(l&&us&&s&&s!==n&&(localStorage.setItem("previousMessageText",s),a&&!a.includes(se))){(m||p&&qo||h)&&Wt(s)}if(c&&us&&s&&s!==n&&(localStorage.setItem("previousMessageText",s),a&&!a.includes(se))){if(m||p&&qo||h){Ze(!m||qo?Ge:Ye,.2),qo&&(qo=!1)}}us&&(yo("generalMessages"),To("generalMessages"),Et("generalMessages"),nn(),jt("generalMessages",350),$o(),zt())}}));const{chatField:Io,messagesContainer:jo}=_t();let Oo=null;(dt("gmid")||dt("gamelist"))&&(Oo=document.createElement("div"),Oo.className="length-field-popup",jo.appendChild(Oo));const Bo=document.createElement("canvas").getContext("2d");let Ho,Do,Po,zo=!1,Fo=0;function Uo(e){let t;t=e>Fo?`${e} 🡆`:e<Fo?`🡄 ${e}`:`${e}`,Oo.textContent=t,function(e){if(!Oo)return void console.error("lengthPopup is not defined");let t;if(0===e)t="hsl(200, 20%, 50%)";else if(e>=1&&e<=90)t="hsl(120, 100%, 40%)";else if(e>90&&e<=100){const n=(e-90)/10;t=`hsl(${Math.round(120+-60*n)}, 100%, 40%)`}else if(e>100&&e<=190)t="hsl(60, 100%, 50%)";else if(e>190&&e<=200){const n=(e-190)/10;t=`hsl(${Math.round(60+-30*n)}, 100%, 50%)`}else if(e>200&&e<=250)t="hsl(40, 100%, 50%)";else if(e>250&&e<=300){const n=(e-250)/50;t=`hsl(${Math.round(40+-40*n)}, 100%, 70%)`}else t="hsl(0, 100%, 70%)";Oo.style.color=t}(e),Fo=e}function _o(e){zo!==e&&(Oo.classList.toggle("bounce-in",e),Oo.classList.toggle("bounce-out",!e),zo=e,e||setTimeout((()=>Oo.classList.remove("bounce-out")),500))}function Ro(){clearTimeout(Ho),Uo(Io.value.length),function(e){const t=getComputedStyle(Io);Bo.font=`${t.fontWeight} ${t.fontSize} ${t.fontFamily}`;const n=Bo.measureText(e).width,o=Io.offsetLeft+n+5,s=Io.offsetLeft+Io.offsetWidth-Oo.offsetWidth;Oo.style.left=`${Math.min(o,s)}px`}(Io.value),_o(!0),Ho=setTimeout((()=>_o(!1)),1e3)}function Jo(e){"Enter"===e.key&&(Uo(0),Object.assign(Oo.style,{left:"0px",color:"hsl(200, 20%, 50%)"}),_o(!0),Ho=setTimeout((()=>_o(!1)),1e3))}function Ko(){Po.innerHTML="every-message"===Do.id?L:T}var Vo=n(946),Xo={};Xo.styleTagTransform=g(),Xo.setAttributes=d(),Xo.insert=l().bind(null,"head"),Xo.domAPI=r(),Xo.insertStyleElement=p();s()(Vo.A,Xo);Vo.A&&Vo.A.locals&&Vo.A.locals;var Yo=n(720),Go={};Go.styleTagTransform=g(),Go.setAttributes=d(),Go.insert=l().bind(null,"head"),Go.domAPI=r(),Go.insertStyleElement=p();s()(Yo.A,Go);Yo.A&&Yo.A.locals&&Yo.A.locals;const{ignored:Wo}=Me;let{panelsEvents:Zo,isCtrlKeyPressed:Qo}=ce;const es=async(e,t)=>{t&&(t.innerHTML="");const n=`https://klavogonki.ru/chatlogs/${e}.html?rand=${Math.floor(Math.random()*10**20)}`;try{const e=await fetch(n);if(!e.ok)throw new Error("Network response was not ok");const t=await e.text(),o=1024*1e3,s=t.length>o?t.slice(0,o):t,a=(e=>[...(new DOMParser).parseFromString(e,"text/html").querySelectorAll(".ts")].map((e=>{const t=e.nextElementSibling,n=t?.nextSibling,o=e=>e?[...e.childNodes].reduce(((e,t)=>{if(t.nodeType===Node.TEXT_NODE)e+=t.textContent;else if(t.nodeType===Node.ELEMENT_NODE)if("A"===t.tagName)e+=t.getAttribute("href");else if("BR"===t.tagName)return e;return e}),"").trim():"";if(t?.classList.contains("mn")&&n){let s="";if(n.nodeType===Node.ELEMENT_NODE)s=o(n);else if(n.nodeType===Node.TEXT_NODE){const e=t.nextElementSibling;s=e&&"A"===e.tagName?`${n.textContent.trim()} ${e.getAttribute("href")}`:n.textContent.trim()}return s||(s=o(t.nextSibling)),{time:e.textContent.trim().replace(/[\[\]]/g,""),username:t.textContent.trim().replace(/<|>/g,""),message:s||null}}const s=e.nextElementSibling;if(s&&s.classList.contains("mne")){const t=s.textContent.trim();return{time:e.textContent.trim().replace(/[\[\]]/g,""),username:"SYSTEM",message:t||null}}return null})).filter(Boolean))(s),r=t.length>o,i=[];let l=null;for(const e of a){const t=e.message!==l?.message,n=e.username!==l?.username;(t||n)&&(i.push(e),l=e)}return{chatlogs:i.filter((e=>!Wo.includes(e.username))),url:n,size:s.length,info:r,error:null}}catch(e){return{chatlogs:[],url:n,size:0,error:e.message}}},ts="2012-02-12";let ns={media:!1,mention:!1};const os=()=>{ns={media:!1,mention:!1}};async function ss(e){const t="mention"===e;ns={media:!!("media"===e)&&!ns.media,mention:!!t&&!ns.mention},document.querySelectorAll(".message-item").forEach((e=>{const t=e.querySelector(".media"),n=e.querySelector(".mention");ns.media?(e.style.contentVisibility=t?"visible":"hidden",e.style.fontSize=t?"":"0"):ns.mention?(e.style.contentVisibility=n?"visible":"hidden",e.style.fontSize=n?"":"0"):(e.style.contentVisibility="visible",e.style.fontSize="")}))}async function as(e){const t=document.querySelector(".chat-logs-panel");if(t)return t.remove(),void xt("hide");gt();const n=document.createElement("div");n.className="chat-logs-panel popup-panel";const o=document.createElement("div");o.className="panel-header";const s=document.createElement("div");s.className="panel-control-buttons";const a=document.createElement("div");a.className="search-for-chatlogs-messages";const r=document.createElement("input");function i(){requestAnimationFrame((function(){r.focus()}))}r.className="chatlogs-search-input",r.type="text",a.appendChild(r),o.appendChild(a),r.addEventListener("input",(()=>D(r.value))),r.addEventListener("click",(e=>{e.ctrlKey&&(r.value="",D(r.value))})),r.addEventListener("keydown",(async e=>{const t=r.value;if("Enter"===e.key){let e=t;/^\d{8}$/.test(t)?(e=6===t.length?"20"+t:t,e=e.replace(/(\d{4})(\d{2})(\d{2})/,"$1-$2-$3")):/^\d{6}$/.test(t)&&(e="20"+t.replace(/(\d{2})(\d{2})(\d{2})/,"$1-$2-$3"));/^\d{2,4}[:\-]\d{2}[:\-]\d{2}$/.test(e.replace(/:/g,"-"))&&!isNaN(new Date(e.replace(/:/g,"-")).getTime())?(await j(e),c(d)):alert("Please enter a valid date.\n\nValid formats include:\n1. yyyy-mm-dd\n2. yyyy:mm:dd\n3. yy-mm-dd\n4. yy:mm:dd\n5. yyyymmdd\n6. yymmdd\n\n"),r.value=""}})),i();const l=document.createElement("div");function c(e){"none"===e.style.display&&(e.style.display="flex")}l.className="large-button panel-header-date-button",l.innerHTML=_,l.addEventListener("click",(()=>{var e;(e=d).style.display="none"===e.style.display?"flex":"none"}));const d=document.createElement("input");d.type="date",d.className="chatlogs-date-input",d.style.display="none",s.appendChild(l),s.appendChild(d);const m=document.createElement("div");m.className="large-button toggle-mention-messages-button",m.innerHTML=N,m.title="Toggle Mention Messages",m.addEventListener("click",(async()=>{await ss("mention")}));const p=document.createElement("div");p.className="toggle-mention-messages-counter",p.textContent="0",m.appendChild(p),s.appendChild(m);const u=document.createElement("div");u.className="large-button panel-header-toggle-media-messages",u.innerHTML=A,u.title="Toggle Media Messages",u.addEventListener("click",(async()=>{await ss("media")}));const g=document.createElement("div");g.className="toggle-media-messages-counter",g.textContent="0",u.appendChild(g),s.appendChild(u);const h=document.createElement("div");h.className="large-button panel-header-copy-button",h.innerHTML=R,h.title="Copy Chat Logs Url";const f=e=>{const t=e.match(/(\d{4}-\d{2}-\d{2})/);return t?t[1]:null};function y(e,t){t&&(t.replaceChildren(),e.forEach((({url:n,title:o})=>{const s=f(n),a=document.createElement("div");a.classList.add("saved-chatlog-url-wrapper");const r=document.createElement("a");r.classList.add("saved-chatlog-url"),r.textContent=s,r.href=n,r.addEventListener("click",(async t=>{if(t.preventDefault(),t.ctrlKey){const n=t.target.href,o=e.filter((e=>e.url!==n));if(o.length!==e.length){e=o,localStorage.setItem("savedChatlogs",JSON.stringify(e));t.target.closest(".saved-chatlog-url-wrapper").remove()}}else await j(s)}));const i=document.createElement("span");i.classList.add("saved-chatlog-url-title"),i.textContent=o||"➕",i.addEventListener("click",(()=>{const t=prompt("Enter a new title for this chat log:",i.textContent);if(null!==t&&t!==i.textContent){i.textContent=t;const o=e.findIndex((e=>e.url===n));-1!==o&&(e[o].title=t,localStorage.setItem("savedChatlogs",JSON.stringify(e)))}})),a.appendChild(r),a.appendChild(i),t.appendChild(a)})))}h.addEventListener("click",(e=>{let t=document.querySelector(".saved-chatlog-container");!t&&!e.shiftKey&&ge(h,0,0),!t||e.ctrlKey||t.contains(e.target)||t.remove();let n=JSON.parse(localStorage.getItem("savedChatlogs"))||[];if(e.ctrlKey&&!e.target.closest(".saved-chatlog-url")){const e=f(I);if(!e)return;const o=prompt("Enter a title for this chat log:","➕");n.some((t=>f(t.url)===e))||(n.push({url:I,title:o||"➕"}),n.sort(((e,t)=>{const n=f(e.url),o=f(t.url);return new Date(n)-new Date(o)})),localStorage.setItem("savedChatlogs",JSON.stringify(n))),y(n,t)}else e.shiftKey?n.length>0&&!t&&(t=document.createElement("div"),t.classList.add("saved-chatlog-container"),y(n,t),h.appendChild(t)):navigator.clipboard.writeText(I).catch((e=>console.error("Failed to copy: ",e)))})),s.appendChild(h);const v=localStorage.getItem("shouldShowActiveUsers")||(localStorage.setItem("shouldShowActiveUsers","shown"),"shown"),b=document.createElement("div");function x(e){b.innerHTML="shown"===e?U:F,b.title="shown"===e?"Hide User List":"Show User List"}b.className="large-button panel-header-toggle-button",x(v),b.title="shown"===v?"Hide User List":"Show User List",b.addEventListener("click",(function(){const e="shown"===localStorage.getItem("shouldShowActiveUsers")?"hidden":"shown";if(localStorage.setItem("shouldShowActiveUsers",e),x(e),"shown"===e)B(q,n);else{const e=n.querySelector(".active-users");e&&n.removeChild(e)}})),s.appendChild(b);const w=document.createElement("div");w.className="large-button panel-header-one-day-back-button",w.title="Previous Day",w.innerHTML=J;const S=document.createElement("div");S.className="large-button panel-header-one-day-forward-button",S.title="Next Day",S.innerHTML=K;const k=document.createElement("div");function E(){return d.value?new Date(d.value):new Date}k.className="large-button panel-header-shuffle-button",k.title="Random Date",k.innerHTML=V;w.addEventListener("click",(async()=>{const e=E();e.setDate(e.getDate()-1),await j(e),c(d),i(),os()})),S.addEventListener("click",(async()=>{const e=E();e.setDate(e.getDate()+1),await j(e),c(d),i(),os()})),k.addEventListener("click",(async()=>{const e=function(){const e=new Date(ts),t=new Date-e,n=Math.floor(Math.random()*t),o=new Date(e.getTime()+n);return new Intl.DateTimeFormat("en-CA").format(o)}();await j(e),c(d),i(),os()})),s.appendChild(w),s.appendChild(S),s.appendChild(k);const C=document.createElement("div");C.className="large-button panel-header-close-button",C.title="Close panel",C.innerHTML=O,C.addEventListener("click",(()=>{wt(n,"hide"),xt("hide")})),s.appendChild(C),o.appendChild(s);const L=document.createElement("div");L.className="chat-logs-container",n.appendChild(o),n.appendChild(L),document.body.appendChild(n);const{scrollButtonsContainer:T}=yt(L);n.appendChild(T),wt(n,"show"),xt("show");const M={};let $=null;const q=new Map;let I="";const j=async e=>{const t=new Intl.DateTimeFormat("en-CA").format(new Date((e=>/^\d{4}:\d{2}:\d{2}$/.test(e)?e.replace(/:/g,"-"):e)(e)));if(t<ts||t>re)return void alert(t<ts?`The selected date cannot be earlier than ${ts}.`:"You cannot load a future date.");var o;o=t,d.value=o,l.title=`Current date: ${o}`;const{chatlogs:s,url:a,size:i,info:c,error:m}=await es(t,L),u=(i/1024).toFixed(2);r.placeholder=m?`Error: ${m}`:c?`Limit reached: ${u} KB`:c||`Size: ${u} KB`,I=a,q.clear(),s.forEach((async({time:t,username:n,message:o})=>{q.set(n,(q.get(n)||0)+1);const s=document.createElement("div");s.classList.add("message-item"),s.addEventListener("click",(async e=>{e.target.closest("a")||(ns&&await ss(),r.value.length>0&&(r.value=""),await Ot(L,s))}));const a=document.createElement("span");a.className="message-time",a.textContent=t,a.addEventListener("click",(function(){const n=`https://klavogonki.ru/chatlogs/${e}.html#${t}`;window.open(n,"_blank","noopener,noreferrer")}));const i=document.createElement("span");i.className="message-username",i.textContent=n,i.addEventListener("click",(async()=>{const e=await async function(e){const t=JSON.parse(localStorage.getItem("userIdsCache")||"{}");if(t[e])return t[e];try{const n=await getExactUserIdByName(e);if(n)return t[e]=n,localStorage.setItem("userIdsCache",JSON.stringify(t)),n}catch(t){console.error(`Error fetching user ID for ${e}:`,t)}return null}(n);if(e){const t=`https://klavogonki.ru/u/#/${e}/`;window.open(t,"_blank","noopener,noreferrer")}else addShakeEffect(i)}));let l=M[n];l||(l=15*Math.floor(14*Math.random()),M[n]=l),i.style.color=`hsl(${l}, 80%, 50%)`;const c=document.createElement("span");c.className="message-text",c.innerHTML=o.replace(/:(?=\w*[a-zA-Z])(\w+):/g,((e,t)=>`<img src="/img/smilies/${t}.gif" alt=":${t}:" title=":${t}:" class="smile">`)).replace(/(https?:\/\/[^\s]+)/gi,(e=>`<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`)),s.style.marginTop=$!==n?"0.6em":"",$=n,s.appendChild(a),s.appendChild(i),s.appendChild(c),L.appendChild(s)})),B(q,n,r),requestAnimationFrame((()=>{yo("chatlogsMessages"),To("chatlogsMessages"),Et("chatlogsMessages"),Dt("chatlogsMessages"),L.scrollTop=L.scrollHeight,g.textContent=document.querySelectorAll(".chat-logs-container .media").length,p.textContent=document.querySelectorAll(".chat-logs-container .mention").length,L.childElementCount>0&&(r.placeholder+=` | Total messages: ${L.childElementCount}`),r.value.length>0&&D(r.value)}))};function B(e,t,n){if("shown"===localStorage.getItem("shouldShowActiveUsers")){let n=t.querySelector(".active-users");n||(n=document.createElement("div"),n.className="active-users",t.appendChild(n));const o=Array.from(e.entries()).sort((([,e],[,t])=>t-e));n.innerHTML="",o.forEach((([e,t])=>{const o=document.createElement("div");o.className="active-user-item",o.addEventListener("click",(()=>{const t=r.value.trim(),n=Qo?`, ${e}`:e;r.value=t===e?"":Qo&&!t.includes(e)?t+n:e,D(r.value)}));const s=document.createElement("span");s.className="active-user-name",s.textContent=e;const a=M[e]||0;s.style.color=`hsl(${a}, 80%, 50%)`;const i=document.createElement("span");i.className="active-user-messages-count",i.textContent=t,i.style.color=`hsl(${a}, 80%, 50%)`,i.style.backgroundColor=`hsla(${a}, 80%, 50%, 0.2)`,o.appendChild(i),o.appendChild(s),n.appendChild(o)}))}}const H=e||re;function D(e){if(/^[\d-:]+$/.test(e.trim()))return;function t(e){return e.replace(/[_-]/g," ").toLowerCase()}const n=t(e).trim(),o=Array.from(document.querySelectorAll(".chat-logs-container > .message-item")),s=function(e){return e.map((e=>{const t=e.querySelector(".message-username"),n=t?t.textContent.toLowerCase().trim():"",o=e.querySelector(".message-text");return{username:n,messageText:o?o.textContent.toLowerCase().trim():""}}))}(o),a=!n,r=n.split(",").map((e=>e.trim())).filter(Boolean),i=r.filter((e=>s.some((n=>t(n.username)===e)))).length>=2;o.forEach(((e,o)=>{const l=e.closest(".message-item"),c=s[o];let d=!1;const m=t(c.username),p=t(c.messageText);d=!!a||(i?r.some((e=>m===e)):m.includes(n)||p.includes(n)),l.style.contentVisibility=d?"visible":"hidden",l.style.fontSize=d?"":"0"}))}await j(H),e&&c(d),d.max=re,d.min=ts,d.value=H,l.title=`Current date: ${H}`,d.addEventListener("change",(async e=>{const t=e.target.value;await j(t),l.title=`Current date: ${t}`})),Zo.handleChatLogsKeydown=e=>{"Escape"===e.key&&(wt(n,"hide"),xt("hide"),document.removeEventListener("keydown",Zo.handleChatLogsKeydown))},document.addEventListener("keydown",Zo.handleChatLogsKeydown)}let{panelsEvents:rs}=ce;function is(e){const t=document.createElement("div");t.classList.add("empowerment-button","personal-messages-button"),t.innerHTML=N;const n=document.createElement("div");n.classList.add("message-count","total-message-count");const o=JSON.parse(localStorage.getItem("personalMessages"))||{};n.textContent=Object.keys(o).length,t.appendChild(n);const s=document.createElement("div");s.classList.add("message-count","new-message-count");let a=Number(localStorage.getItem("newMessagesCount"))||(localStorage.setItem("newMessagesCount","0"),0);s.textContent=a,s.style.visibility=a>0?"visible":"hidden",t.appendChild(s),t.title="Show Personal Messages",t.addEventListener("click",(function(){fe(t),ps();Object.keys(JSON.parse(localStorage.getItem("personalMessages"))||{}).length>0&&(localStorage.setItem("newMessagesCount","0"),a=0,s.textContent=a)})),e.appendChild(t)}async function ls(e,t,n){const o=document.querySelector(".messages-content");if(!o)return null;const s=e=>e.replace(/[\[\]]/g,"").split(":").reduce(((e,t,n)=>e+Number(t)*60**(2-n)),0),a=s(e),r=e=>Array.from(o.querySelectorAll("p")).find((n=>{const o=n.querySelector(".time"),a=n.querySelector(".username span[data-user]");if(o&&a){const n=s(o.textContent.trim()),r=a.textContent.trim();return e(n)&&r===t}return!1}));let i=r((e=>e===a));return i||(i=r((e=>Math.abs(e-a)<=2))),i&&n&&await Ot(o,i),i||!1}function cs(e){const t=180- -(new Date).getTimezoneOffset(),[n,o,s]=e.split(":").map(Number);let a=60*n+o+t;a=(a%1440+1440)%1440;const r=a%60;return`${Math.floor(a/60).toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}function ds(e,t="single"){const n=e.querySelector(".message-time").textContent,o=e.querySelector(".message-username").textContent;let s=JSON.parse(localStorage.getItem("personalMessagesBackup"))||{};if(0===Object.keys(s).length){s={...JSON.parse(localStorage.getItem("personalMessages"))||{}},localStorage.setItem("personalMessagesBackup",JSON.stringify(s))}let a={...s};if("all"===t)document.querySelectorAll(".message-item").forEach((e=>{const t=e.querySelector(".message-username").textContent;if(t===o){e.remove();const n=e.querySelector(".message-time").textContent;delete a[`[${n}]_${t}`]}}));else if("from"===t){const t=Array.from(document.querySelectorAll(".message-item"));for(let n=t.indexOf(e);n<t.length;n++){const e=t[n],s=e.querySelector(".message-username").textContent;if(s===o){e.remove();const t=e.querySelector(".message-time").textContent;delete a[`[${t}]_${s}`]}}}else{const t=`[${n}]_${o}`;a[t]&&(delete a[t],e.remove())}localStorage.setItem("personalMessagesBackup",JSON.stringify(a));const r=document.querySelector(".personal-messages-button .total-message-count");r&&(r.textContent=Object.keys(a).length)}function ms(){const e=Object.keys(JSON.parse(localStorage.getItem("personalMessages")||"{}")).length;document.querySelector(".personal-messages-button .total-message-count").textContent=e}async function ps(){const e=document.querySelector(".cached-messages-panel");if(e)return e.remove(),void xt("hide");let t=!0,n=!1;ms(),localStorage.getItem("personalMessagesBackup")&&localStorage.removeItem("personalMessagesBackup"),gt();const o=document.querySelector(".personal-messages-button .new-message-count");function s(){const e=localStorage.getItem("personalMessages");return JSON.parse(e)||{}}o&&(o.textContent="0"),o.style.visibility="hidden",localStorage.removeItem("newMessagesCount");let a=s();const r=document.createElement("div");r.className="cached-messages-panel popup-panel";const i=document.createElement("div");i.className="panel-header";const l=document.createElement("div");l.className="search-for-personal-messages";const c=document.createElement("input");c.className="personal-messages-search-input",c.type="search",l.appendChild(c);const d=document.createElement("div");d.className="panel-control-buttons";const m=document.createElement("div");m.className="large-button panel-header-save-button",m.innerHTML=Z,m.title="Save messages",m.style.opacity="0",m.addEventListener("click",(()=>{const e=localStorage.getItem("personalMessagesBackup"),n=localStorage.getItem("personalMessages"),o=e&&n;if(o&&o&&n!==e&&!t){window.confirm("Do you want to apply changes?")&&(localStorage.setItem("personalMessages",e),localStorage.removeItem("personalMessagesBackup"),m.style.setProperty("display","none","important"),m.style.opacity="0",m.addEventListener("transitionend",(function(){m.style.display="none"})))}}));const p=document.createElement("div");p.className="large-button panel-header-import-button",p.innerHTML=G,p.title="Import messages",p.addEventListener("click",(()=>{n=!0;const e=document.createElement("input");e.type="file",e.accept=".json",e.addEventListener("change",(e=>{const t=e.target.files[0];if(t){const e=new FileReader;e.onload=async()=>{try{const t=JSON.parse(e.result),n={...JSON.parse(localStorage.getItem("personalMessages")||"{}"),...t},o=Object.fromEntries(Object.entries(n).sort((([,e],[,t])=>{const n=e.time.replace(/[[\]]/g,""),o=t.time.replace(/[[\]]/g,""),s=`${e.date} ${n}`,a=`${t.date} ${o}`;return new Date(s)-new Date(a)})));localStorage.setItem("personalMessages",JSON.stringify(o)),ms();const a=s();await L(a)}catch(e){alert("Failed to import messages. The file may be corrupted.")}},e.readAsText(t)}})),e.click()}));const u=document.createElement("div");u.className="large-button panel-header-export-button",u.innerHTML=W,u.title="Export messages",u.addEventListener("click",(()=>{const e=localStorage.getItem("personalMessages");if(e&&"{}"!==e){const t=new Intl.DateTimeFormat("en-CA").format(new Date),n=JSON.parse(e),o=JSON.stringify(n,null,2),s=new Blob([o],{type:"application/json"}),a=document.createElement("a");a.href=URL.createObjectURL(s),a.download=`Personal_Messages_${t}.json`,a.click()}else alert("No messages to export.")}));const g=document.createElement("div");g.className="large-button panel-header-copy-button",g.innerHTML=R,g.title="Copy Personal Messages",g.addEventListener("click",(()=>{const e=Array.from(document.querySelector(".messages-container").children).filter((e=>{const t=window.getComputedStyle(e);return"hidden"!==t.contentVisibility&&"none"!==t.display})).map((e=>e.classList.contains("date-item")?e.textContent.trim():[e.querySelector(".message-time"),e.querySelector(".message-username"),e.querySelector(".message-text")].map((e=>e?.textContent.trim())).filter(Boolean).join(" "))).filter(Boolean).join(" \n");e.trim()?(ge(g,0,0),navigator.clipboard.writeText(e).catch(console.error)):alert("No messages to copy.")}));const h=document.createElement("div");h.className="large-button panel-header-clear-button",h.title="Clear personal messages",h.innerHTML=X,h.addEventListener("click",(()=>{n=!0;const e=JSON.parse(localStorage.getItem("personalMessages")||"{}");if(0===Object.keys(e).length)return void alert("No messages to delete.");y.innerHTML=null,localStorage.setItem("personalMessages",JSON.stringify({})),wt(r,"hide"),xt("hide");const t=document.querySelector(".personal-messages-button .total-message-count");t&&(t.textContent="0")}));const f=document.createElement("div");f.className="large-button panel-header-close-button",f.title="Close panel",f.innerHTML=O,f.addEventListener("click",(()=>{wt(r,"hide"),xt("hide")})),i.appendChild(l),d.appendChild(m),d.appendChild(p),d.appendChild(u),d.appendChild(g),d.appendChild(h),d.appendChild(f),i.appendChild(d),r.appendChild(i);const y=document.createElement("div");y.className="messages-container";let v=null,b=0,x=100,w=!1,S=null;const k=[],E={private:"coral",mention:"darkseagreen"},C={private:"coral",mention:"lightsteelblue",default:"slategray"};async function L(e){y.children.length&&y.replaceChildren(),Object.entries(e).forEach((([,{time:e,date:t,username:n,usernameColor:o,message:s,type:a,userId:i}])=>{if(S!==t){const e=document.createElement("div");e.className="date-item",e.textContent=t===re?"Today ⏳":`${t} 📅`,e.dataset.date=t,y.appendChild(e),S=t}const l=document.createElement("div");l.className="message-item",n!==v&&(l.style.marginTop="0.6em",v=n);const c=e.replace(/[\[\]]/g,"").trim(),d=document.createElement("span");if(d.className="message-time",d.textContent=c,d.title=`Moscow Time: ${cs(c)}`,d.style.color=E[a]||"slategray","mention"===a||"private"===a){const e="mention"===a?"lightgreen":"peachpuff";d.addEventListener("mouseover",(()=>{d.style.color=e})),d.addEventListener("mouseout",(()=>{d.style.color=E[a]})),d.addEventListener("click",(e=>{if(e.ctrlKey)ds(l,"from");else if("mention"===a){const e=`https://klavogonki.ru/chatlogs/${t}.html#${cs(c)}`;window.open(e,"_blank","noopener,noreferrer")}}))}const m=document.createElement("span");m.className="message-username",m.textContent=n,m.style.color=o,m.addEventListener("click",(e=>{if(e.ctrlKey)ds(l,"all");else if(i){const e=`https://klavogonki.ru/u/#/${i}/`;window.open(e,"_blank","noopener,noreferrer")}else addShakeEffect(m)}));const p=document.createElement("span");p.className="message-text",p.innerHTML=s.replace(/:(?=\w*[a-zA-Z])(\w+):/g,((e,t)=>`<img src="/img/smilies/${t}.gif" alt=":${t}:" title=":${t}:" class="smile">`)).replace(/(https?:\/\/[^\s]+)/gi,(e=>`<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`)),p.addEventListener("click",(async function(t){if(t.ctrlKey)return void ds(l,"single");if(await ls(e,n,!0))wt(r,"hide"),xt("hide");else{let e=p.parentElement.previousElementSibling;for(;e&&!e.classList.contains("date-item");)e=e.previousElementSibling;if(e){await as(e.dataset.date);const t=cs(c);requestAnimationFrame((async()=>{setTimeout((async()=>{const e=await async function(e,t,n){const o=document.querySelector(".chat-logs-container");if(!o)return null;const s=e=>e.replace(/[\[\]]/g,"").split(":").reduce(((e,t,n)=>e+Number(t)*60**(2-n)),0),a=s(e),r=e=>Array.from(o.querySelectorAll(".message-item")).find((n=>{const o=n.querySelector(".message-time"),a=n.querySelector(".message-username");if(o&&a){const n=s(o.textContent.trim()),r=a.textContent.trim();return e(n)&&r===t}return!1}));let i=r((e=>e===a));return i||(i=r((e=>Math.abs(e-a)<=2))),i&&n&&await Ot(o,i),i||!1}(t,n,!0);if(!e){wt(document.querySelector(".chat-logs-panel"),"hide"),ps()}}),500)}))}}}));const u={messageTextElement:p,time:e,username:n,type:a};k.push(u),l.appendChild(d),l.appendChild(m),l.appendChild(p),y.appendChild(l)})),requestAnimationFrame((()=>{yo("personalMessages"),To("personalMessages"),Et("personalMessages"),Dt("personalMessages"),y.scrollTop=y.scrollHeight,new MutationObserver((e=>{n||e.find((e=>"childList"===e.type&&e.removedNodes.length>0))&&"0"===m.style.opacity&&(t=!1,m.style.visibility="visible",m.style.display="flex",m.offsetHeight,m.style.opacity="1",m.style.transition="opacity 0.5s ease")})).observe(y,{childList:!0,subtree:!0}),setTimeout((()=>{n=!1}),500)})),k.reverse().forEach((async({messageTextElement:e,time:t,username:n,type:o})=>{b<x&&(w=await ls(t,n,!1),b++,b>=x&&(w=!1,console.log("Reached maximum ping checks, resetting pingMessages."))),e.style.color=w&&"mention"===o?"lightgreen":w&&"private"===o?"lemonchiffon":C[o]||"slategray"}))}await L(a),r.appendChild(y),document.body.appendChild(r);const{scrollButtonsContainer:T}=yt(y);r.appendChild(T),wt(r,"show"),xt("show"),c.addEventListener("click",(()=>mt&&(c.value=""))),c.addEventListener("input",(()=>{const e=c.value.toLowerCase().replace(/_/g," ");y.querySelectorAll(".date-item").forEach((t=>{let n=!1,o=t.nextElementSibling;for(;o&&!o.classList.contains("date-item");){const t=(o.querySelector(".message-time")?.textContent.toLowerCase().replace(/_/g," ")+" "+o.querySelector(".message-username")?.textContent.toLowerCase().replace(/_/g," ")+" "+o.querySelector(".message-text")?.textContent.toLowerCase().replace(/_/g," ")).includes(e);o.style.contentVisibility=t?"visible":"hidden",o.style.fontSize=t?"":"0",n=n||t,o=o.nextElementSibling}t.style.display=n?"":"none"}))})),requestAnimationFrame((function(){c.focus()})),rs.handlePersonalMessagesKeydown=e=>{"Escape"===e.key&&(wt(r,"hide"),xt("hide"),document.removeEventListener("keydown",rs.handlePersonalMessagesKeydown))},document.addEventListener("keydown",rs.handlePersonalMessagesKeydown)}let us=!1;(()=>{cn();const e=(()=>{const e=document.createElement("div");return e.classList.add("empowerment-panel"),document.body.appendChild(e),e})();if(dt("gmid")||dt("gamelist")){At("elements","counter")&&Vn(e),function(){const e=getComputedStyle(document.querySelector(".chat .messages")).backgroundColor,t=document.createElement("style");t.innerHTML=`\n    #chat-general .smile-tab, .chat-user-list {\n      background-color: ${e};\n    }\n  `,document.head.appendChild(t)}()}if((dt("gmid")||dt("gamelist"))&&(function(e){Oe=document.createElement("div");const t=be.messageSettings.messageNotificationState||"silence";Oe.classList.add("empowerment-button","sound-switcher-button"),Oe.id=t,Oe.title=be.messageSettings.messageNotificationTitle||"Do not disturb",Be=document.createElement("span"),Be.classList.add("sound-switcher-icon"),Oe.appendChild(Be),e.appendChild(Oe),Oe.addEventListener("click",(function(){if(!mt&&!pt){switch(document.querySelector(".current-voice-speed")?.remove(),document.querySelector(".current-voice-pitch")?.remove(),fe(this),this.id){case"silence":this.id="beep",this.title="Notify with beep signal",be.messageSettings.messageNotificationState="beep",be.messageSettings.messageNotificationTitle="Notify with beep signal";break;case"beep":this.id="voice",this.title="Notify with voice API",be.messageSettings.messageNotificationState="voice",be.messageSettings.messageNotificationTitle="Notify with voice API";break;case"voice":this.id="silence",this.title="Do not disturb",be.messageSettings.messageNotificationState="silence",be.messageSettings.messageNotificationTitle="Do not disturb"}localStorage.setItem("KG_Chat_Empowerment",JSON.stringify(be)),Pe()}})),Oe.addEventListener("mousedown",_e),Oe.addEventListener("contextmenu",(e=>e.preventDefault())),Pe()}(e),function(e){Do=document.createElement("div");const t=be.messageSettings.messageModeState||"every-message";Do.classList.add("empowerment-button","message-mode-button"),Do.id=t,Do.title=be.messageSettings.messageModeTitle||"Notify about every message",Po=document.createElement("span"),Po.classList.add("message-mode-icon"),Do.appendChild(Po),e.appendChild(Do),Do.addEventListener("click",(function(){mt&&pt||(fe(this),"every-message"===this.id?(this.id="mention-message",this.title="Notify about mention message",be.messageSettings.messageModeState="mention-message",be.messageSettings.messageModeTitle="Notify about mention message"):(this.id="every-message",this.title="Notify about every message",be.messageSettings.messageModeState="every-message",be.messageSettings.messageModeTitle="Notify about every message"),localStorage.setItem("KG_Chat_Empowerment",JSON.stringify(be)),Ko())})),Ko()}(e)),function(e){const t=document.createElement("div");t.classList.add("empowerment-button","cache-panel-load-button"),t.style.position="relative",t.style.zIndex="3",t.innerHTML=$;const n=document.createElement("div");n.className="cache-user-count",n.textContent=Object.keys(JSON.parse(localStorage.getItem("fetchedUsers"))||{}).length,t.appendChild(n),t.title="Show Cache Panel",t.addEventListener("click",(()=>{fe(t),In()})),e.appendChild(t)}(e),is(e),function(e){const t=document.createElement("div");t.classList.add("empowerment-button","chat-logs-button"),t.style.position="relative",t.style.zIndex="1",t.innerHTML=q,t.title="Show Chat Logs",t.addEventListener("click",(async function(){fe(t),await as()})),e.appendChild(t)}(e),Ie(e),function(){const e=document.querySelector(".messages-content div");e?Ao.observe(e,{childList:!0,subtree:!0}):console.warn("Messages container not found!")}(),Yn?eo.observe(Yn,{childList:!0}):console.warn("User list not found!"),!dt("gmid")&&!dt("gamelist"))return;const t=new Rn;let n=new MutationObserver((()=>{const e=document.querySelector(".messages-content div"),o=document.querySelectorAll(".messages-content div p");document.contains(e)&&(!function(){const e=document.querySelector("#chat-fixed-placeholder");localStorage.getItem("shouldShowPopupMessage")||localStorage.setItem("shouldShowPopupMessage","false"),e.style.display=JSON.parse(localStorage.getItem("shouldShowPopupMessage"))?"none":"unset"}(),o.length>=20&&(n.disconnect(),function(){const{allMessages:e}=_t();e.forEach((e=>{const t=e.querySelector(".username"),n=t?.textContent?.replace(/[<>]/g,"")||null;if(n&&nt.includes(n)){const t=Ft(n);e.classList.add("ignored-user",t),e.style.display="none"}}))}(),yo("generalMessages"),To("generalMessages"),Et("generalMessages"),window.location.href.includes("gmid")&&function(){const{activeChatTab:e,chatField:t}=_t();e?.click(),t?.focus()}(),function(){const{chatField:e}=_t();e&&(e.value=localStorage.getItem("inputBackup")||"",e.addEventListener("input",vt((()=>{tn(e)||localStorage.setItem("inputBackup",e.value)}),250)),e.addEventListener("keydown",(e=>{"Enter"===e.key&&localStorage.removeItem("inputBackup")})))}(),Dt(),nn(),jt("generalMessages",350),Nt(!1,de),Fn(),on(),t.updateDeletedMessages(),rn(),function(){const e=document.querySelectorAll(".messages-content p");if(0===e.length)return;const t=new Set(Array.from(e).map((e=>Jn(e)))),n=new Set(JSON.parse(localStorage.getItem("deletedChatMessagesContent")||"[]"));localStorage.setItem("deletedChatMessagesContent",JSON.stringify([...n].filter((e=>t.has(e)))))}(),setTimeout((()=>{Oo&&(Io.addEventListener("input",Ro),Io.addEventListener("keydown",Jo))}),600),setTimeout((()=>us=!0),600)))}));n.observe(document,{childList:!0,subtree:!0})})()})();