mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 09:54:52 +00:00
1 line
56 KiB
JavaScript
1 line
56 KiB
JavaScript
!function(e){function t(t){for(var o,a,c=t[0],s=t[1],u=t[2],d=0,g=[];d<c.length;d++)a=c[d],Object.prototype.hasOwnProperty.call(r,a)&&r[a]&&g.push(r[a][0]),r[a]=0;for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o]);for(l&&l(t);g.length;)g.shift()();return i.push.apply(i,u||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],o=!0,c=1;c<n.length;c++){var s=n[c];0!==r[s]&&(o=!1)}o&&(i.splice(t--,1),e=a(a.s=n[0]))}return e}var o={},r={2:0},i=[];function a(t){if(o[t])return o[t].exports;var n=o[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=o,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(n,o,function(t){return e[t]}.bind(null,o));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var c=window.webpackJsonp=window.webpackJsonp||[],s=c.push.bind(c);c.push=t,c=c.slice();for(var u=0;u<c.length;u++)t(c[u]);var l=s;i.push([668,0]),n()}({105:function(e,t,n){"use strict";t.__esModule=!0,t.selectActiveTab=t.selectSettings=void 0;t.selectSettings=function(e){return e.settings};t.selectActiveTab=function(e){return e.settings.view.activeTab}},106:function(e,t,n){"use strict";t.__esModule=!0,t.isSameMessage=t.serializeMessage=t.createMessage=t.createMainPage=t.createPage=t.canPageAcceptType=void 0;var o=n(681),r=n(107);function i(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}t.canPageAcceptType=function(e,t){return t.startsWith(r.MESSAGE_TYPE_INTERNAL)||e.acceptedTypes[t]};var c=function(e){return Object.assign({id:(0,o.createUuid)(),name:"New Tab",acceptedTypes:{},unreadCount:0,createdAt:Date.now()},e)};t.createPage=c;t.createMainPage=function(){for(var e,t={},n=i(r.MESSAGE_TYPES);!(e=n()).done;){t[e.value.type]=!0}return c({name:"Main",acceptedTypes:t})};t.createMessage=function(e){return Object.assign({createdAt:Date.now()},e)};t.serializeMessage=function(e){return{type:e.type,text:e.text,html:e.html,times:e.times,createdAt:e.createdAt}};t.isSameMessage=function(e,t){return"string"==typeof e.text&&e.text===t.text||"string"==typeof e.html&&e.html===t.html}},107:function(e,t,n){"use strict";t.__esModule=!0,t.MESSAGE_TYPES=t.MESSAGE_TYPE_DEBUG=t.MESSAGE_TYPE_ATTACKLOG=t.MESSAGE_TYPE_ADMINLOG=t.MESSAGE_TYPE_EVENTCHAT=t.MESSAGE_TYPE_MODCHAT=t.MESSAGE_TYPE_ADMINCHAT=t.MESSAGE_TYPE_COMBAT=t.MESSAGE_TYPE_ADMINPM=t.MESSAGE_TYPE_OOC=t.MESSAGE_TYPE_DEADCHAT=t.MESSAGE_TYPE_WARNING=t.MESSAGE_TYPE_INFO=t.MESSAGE_TYPE_RADIO=t.MESSAGE_TYPE_LOCALCHAT=t.MESSAGE_TYPE_SYSTEM=t.MESSAGE_TYPE_INTERNAL=t.MESSAGE_TYPE_UNKNOWN=t.IMAGE_RETRY_MESSAGE_AGE=t.IMAGE_RETRY_LIMIT=t.IMAGE_RETRY_DELAY=t.COMBINE_MAX_TIME_WINDOW=t.COMBINE_MAX_MESSAGES=t.MESSAGE_PRUNE_INTERVAL=t.MESSAGE_SAVE_INTERVAL=t.MAX_PERSISTED_MESSAGES=t.MAX_VISIBLE_MESSAGES=void 0;t.MAX_VISIBLE_MESSAGES=2500;t.MAX_PERSISTED_MESSAGES=1e3;t.MESSAGE_SAVE_INTERVAL=1e4;t.MESSAGE_PRUNE_INTERVAL=6e4;t.COMBINE_MAX_MESSAGES=5;t.COMBINE_MAX_TIME_WINDOW=5e3;t.IMAGE_RETRY_DELAY=250;t.IMAGE_RETRY_LIMIT=10;t.IMAGE_RETRY_MESSAGE_AGE=6e4;t.MESSAGE_TYPE_UNKNOWN="unknown";t.MESSAGE_TYPE_INTERNAL="internal";t.MESSAGE_TYPE_SYSTEM="system";t.MESSAGE_TYPE_LOCALCHAT="localchat";t.MESSAGE_TYPE_RADIO="radio";t.MESSAGE_TYPE_INFO="info";t.MESSAGE_TYPE_WARNING="warning";t.MESSAGE_TYPE_DEADCHAT="deadchat";t.MESSAGE_TYPE_OOC="ooc";t.MESSAGE_TYPE_ADMINPM="adminpm";t.MESSAGE_TYPE_COMBAT="combat";t.MESSAGE_TYPE_ADMINCHAT="adminchat";t.MESSAGE_TYPE_MODCHAT="modchat";t.MESSAGE_TYPE_EVENTCHAT="eventchat";t.MESSAGE_TYPE_ADMINLOG="adminlog";t.MESSAGE_TYPE_ATTACKLOG="attacklog";t.MESSAGE_TYPE_DEBUG="debug";var o=[{type:"system",name:"System Messages",description:"Messages from your client, always enabled",selector:".boldannounce",important:!0},{type:"localchat",name:"Local",description:"In-character local messages (say, emote, etc)",selector:".say, .emote"},{type:"radio",name:"Radio",description:"All departments of radio messages",selector:".alert, .syndradio, .centradio, .airadio, .entradio, .comradio, .secradio, .engradio, .medradio, .sciradio, .supradio, .srvradio, .expradio, .radio, .deptradio, .newscaster"},{type:"info",name:"Info",description:"Non-urgent messages from the game and items",selector:".notice:not(.pm), .adminnotice, .info, .sinister, .cult"},{type:"warning",name:"Warnings",description:"Urgent messages from the game and items",selector:".warning:not(.pm), .critical, .userdanger, .italics"},{type:"deadchat",name:"Deadchat",description:"All of deadchat",selector:".deadsay"},{type:"ooc",name:"OOC",description:"The bluewall of global OOC messages",selector:".ooc, .adminooc"},{type:"adminpm",name:"Admin PMs",description:"Messages to/from admins (adminhelp)",selector:".pm, .adminhelp"},{type:"combat",name:"Combat Log",description:"Urist McTraitor has stabbed you with a knife!",selector:".danger"},{type:"unknown",name:"Unsorted",description:"Everything we could not sort, always enabled"},{type:"adminchat",name:"Admin Chat",description:"ASAY messages",selector:".admin_channel, .adminsay",admin:!0},{type:"modchat",name:"Mod Chat",description:"MSAY messages",selector:".mod_channel",admin:!0},{type:"adminlog",name:"Admin Log",description:"ADMIN LOG: Urist McAdmin has jumped to coordinates X, Y, Z",selector:".log_message",admin:!0},{type:"attacklog",name:"Attack Log",description:"Urist McTraitor has shot John Doe",admin:!0},{type:"debug",name:"Debug Log",description:"DEBUG: SSPlanets subsystem Recover().",admin:!0}];t.MESSAGE_TYPES=o},144:function(e,t,n){"use strict";t.__esModule=!0,t.SettingsPanel=t.settingsReducer=t.settingsMiddleware=t.useSettings=void 0;var o=n(676);t.useSettings=o.useSettings;var r=n(677);t.settingsMiddleware=r.settingsMiddleware;var i=n(678);t.settingsReducer=i.settingsReducer;var a=n(679);t.SettingsPanel=a.SettingsPanel},145:function(e,t,n){"use strict";t.__esModule=!0,t.chatReducer=t.chatMiddleware=t.ChatTabs=t.ChatPanel=t.ChatPageSettings=void 0;var o=n(680);t.ChatPageSettings=o.ChatPageSettings;var r=n(682);t.ChatPanel=r.ChatPanel;var i=n(684);t.ChatTabs=i.ChatTabs;var a=n(685);t.chatMiddleware=a.chatMiddleware;var c=n(686);t.chatReducer=c.chatReducer},146:function(e,t,n){"use strict";t.__esModule=!0,t.selectChatPageById=t.selectCurrentChatPage=t.selectChatPages=t.selectChat=void 0;var o=n(14);t.selectChat=function(e){return e.chat};t.selectChatPages=function(e){return(0,o.map)((function(t){return e.chat.pageById[t]}))(e.chat.pages)};t.selectCurrentChatPage=function(e){return e.chat.pageById[e.chat.currentPageId]};t.selectChatPageById=function(e){return function(t){return t.chat.pageById[e]}}},147:function(e,t,n){"use strict";t.__esModule=!0,t.pingReply=t.pingFail=t.pingSuccess=void 0;var o=n(22),r=(0,o.createAction)("ping/success",(function(e){var t=Date.now(),n=.5*(t-e.sentAt);return{payload:{lastId:e.id,roundtrip:n},meta:{now:t}}}));t.pingSuccess=r;var i=(0,o.createAction)("ping/fail");t.pingFail=i;var a=(0,o.createAction)("ping/reply");t.pingReply=a},211:function(e,t,n){"use strict";t.__esModule=!0,t.audioReducer=t.NowPlayingWidget=t.audioMiddleware=t.useAudio=void 0;var o=n(672);t.useAudio=o.useAudio;var r=n(673);t.audioMiddleware=r.audioMiddleware;var i=n(675);t.NowPlayingWidget=i.NowPlayingWidget;var a=n(687);t.audioReducer=a.audioReducer},212:function(e,t,n){"use strict";t.__esModule=!0,t.selectAudio=void 0;t.selectAudio=function(e){return e.audio}},213:function(e,t,n){"use strict";t.__esModule=!0,t.setClientTheme=t.THEMES=void 0;t.THEMES=["light","dark","default"];var o=null;t.setClientTheme=function(e){if(clearInterval(o),Byond.command(".output statbrowser:set_theme "+e),o=setTimeout((function(){Byond.command(".output statbrowser:set_theme "+e)}),1500),"light"===e)return Byond.winset({"infowindow.background-color":"#E6E6E6","infowindow.text-color":"#000000","info.background-color":"#F0F0F0","info.text-color":"#000000","browseroutput.background-color":"#E6E6E6","browseroutput.text-color":"#000000","outputwindow.background-color":"#E6E6E6","outputwindow.text-color":"#000000","mainwindow.background-color":"#E6E6E6","split.background-color":"#F0F0F0","changelog.background-color":"#90B3DD","changelog.text-color":"#000000","rules.background-color":"#90B3DD","rules.text-color":"#000000","wiki.background-color":"#90B3DD","wiki.text-color":"#000000","forum.background-color":"#90B3DD","forum.text-color":"#000000","github.background-color":"#90B3DD","github.text-color":"#000000","report-issue.background-color":"#EF7F7F","report-issue.text-color":"#000000","output.background-color":"#F0F0F0","output.text-color":"#000000","statwindow.background-color":"#E6E6E6","statwindow.text-color":"#000000","stat.background-color":"#F0F0F0","stat.tab-background-color":"#E6E6E6","stat.text-color":"#000000","stat.tab-text-color":"#000000","stat.prefix-color":"#000000","stat.suffix-color":"#000000","saybutton.background-color":"#E6E6E6","saybutton.text-color":"#000000","asset_cache_browser.background-color":"#E6E6E6","asset_cache_browser.text-color":"#000000","tooltip.background-color":"#F0F0F0","tooltip.text-color":"#000000"});"dark"===e&&Byond.winset({"infowindow.background-color":"#242424","infowindow.text-color":"#E0E0E0","info.background-color":"#272727","info.text-color":"#E0E0E0","browseroutput.background-color":"#272727","browseroutput.text-color":"#E0E0E0","outputwindow.background-color":"#272727","outputwindow.text-color":"#E0E0E0","mainwindow.background-color":"#242424","split.background-color":"#272727","changelog.background-color":"#40628A","changelog.text-color":"#E0E0E0","rules.background-color":"#40628A","rules.text-color":"#E0E0E0","wiki.background-color":"#40628A","wiki.text-color":"#E0E0E0","forum.background-color":"#40628A","forum.text-color":"#E0E0E0","github.background-color":"#40628A","github.text-color":"#E0E0E0","report-issue.background-color":"#A92C2C","report-issue.text-color":"#E0E0E0","output.background-color":"#272727","output.text-color":"#E0E0E0","statwindow.background-color":"#242424","statwindow.text-color":"#E0E0E0","stat.background-color":"#242424","stat.tab-background-color":"#272727","stat.text-color":"#E0E0E0","stat.tab-text-color":"#E0E0E0","stat.prefix-color":"#E0E0E0","stat.suffix-color":"#E0E0E0","saybutton.background-color":"#272727","saybutton.text-color":"#E0E0E0","asset_cache_browser.background-color":"#272727","asset_cache_browser.text-color":"#E0E0E0","tooltip.background-color":"#272727","tooltip.text-color":"#E0E0E0"}),"default"===e&&Byond.winset({"infowindow.background-color":"#242424","infowindow.text-color":"#E0E0E0","info.background-color":"#272727","info.text-color":"#E0E0E0","browseroutput.background-color":"#272727","browseroutput.text-color":"#E0E0E0","outputwindow.background-color":"#272727","outputwindow.text-color":"#E0E0E0","mainwindow.background-color":"#242424","split.background-color":"#272727","changelog.background-color":"#40628A","changelog.text-color":"#E0E0E0","rules.background-color":"#40628A","rules.text-color":"#E0E0E0","wiki.background-color":"#40628A","wiki.text-color":"#E0E0E0","forum.background-color":"#40628A","forum.text-color":"#E0E0E0","github.background-color":"#40628A","github.text-color":"#E0E0E0","report-issue.background-color":"#A92C2C","report-issue.text-color":"#E0E0E0","output.background-color":"#272727","output.text-color":"#E0E0E0","statwindow.background-color":"#242424","statwindow.text-color":"#E0E0E0","stat.background-color":"#242424","stat.tab-background-color":"#272727","stat.text-color":"#E0E0E0","stat.tab-text-color":"#E0E0E0","stat.prefix-color":"#E0E0E0","stat.suffix-color":"#E0E0E0","saybutton.background-color":"#272727","saybutton.text-color":"#E0E0E0","asset_cache_browser.background-color":"#272727","asset_cache_browser.text-color":"#E0E0E0","tooltip.background-color":"#272727","tooltip.text-color":"#E0E0E0"})}},214:function(e,t,n){"use strict";t.__esModule=!0,t.SETTINGS_TABS=void 0;t.SETTINGS_TABS=[{id:"general",name:"General"},{id:"chatPage",name:"Chat Tabs"}]},215:function(e,t,n){"use strict";(function(e){t.__esModule=!0,t.chatRenderer=void 0;var o=n(185),r=n(6),i=n(25),a=n(107),c=n(106),s=n(683);function u(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var d=(0,i.createLogger)("chatRenderer"),g=function(e,t){var n=document.createElement("span");return n.className="Chat__highlight",n.setAttribute("style","background-color:"+t),n.textContent=e,n},p=function(){var e=document.createElement("div");return e.className="ChatMessage",e},h=function(){var e=document.createElement("div");return e.className="Chat__reconnected",e},f=function(e){setTimeout((function(){var t=e.target,n=parseInt(t.getAttribute("data-reload-n"),10)||0;if(n>=a.IMAGE_RETRY_LIMIT)d.error("failed to load an image after "+n+" attempts");else{var o=t.src;t.src=null,t.src=o+"#"+n,t.setAttribute("data-reload-n",n+1)}}),a.IMAGE_RETRY_DELAY)},m=function(e){var t=e.node,n=e.times;if(t&&n){var o=t.querySelector(".Chat__badge"),i=o||document.createElement("div");i.textContent=n,i.className=(0,r.classes)(["Chat__badge","Chat__badge--animate"]),requestAnimationFrame((function(){i.className="Chat__badge"})),o||t.appendChild(i)}},v=function(){function t(){var e=this;this.loaded=!1,this.rootNode=null,this.queue=[],this.messages=[],this.visibleMessages=[],this.page=null,this.events=new o.EventEmitter,this.scrollNode=null,this.scrollTracking=!0,this.handleScroll=function(t){var n=e.scrollNode,o=n.scrollHeight,r=n.scrollTop+n.offsetHeight,i=Math.abs(o-r)<24;i!==e.scrollTracking&&(e.scrollTracking=i,e.events.emit("scrollTrackingChanged",i),d.debug("tracking",e.scrollTracking))},this.ensureScrollTracking=function(){e.scrollTracking&&e.scrollToBottom()},setInterval((function(){return e.pruneMessages()}),a.MESSAGE_PRUNE_INTERVAL)}var n=t.prototype;return n.isReady=function(){return this.loaded&&this.rootNode&&this.page},n.mount=function(t){var n=this;this.rootNode?t.appendChild(this.rootNode):this.rootNode=t,this.scrollNode=function(e){for(var t=document.body,n=e;n&&n!==t;){if(n.scrollWidth<n.offsetWidth)return n;n=n.parentNode}return window}(this.rootNode),this.scrollNode.addEventListener("scroll",this.handleScroll),e((function(){n.scrollToBottom()})),this.tryFlushQueue()},n.onStateLoaded=function(){this.loaded=!0,this.tryFlushQueue()},n.tryFlushQueue=function(){this.isReady()&&this.queue.length>0&&(this.processBatch(this.queue),this.queue=[])},n.assignStyle=function(e){void 0===e&&(e={});for(var t=0,n=Object.keys(e);t<n.length;t++){var o=n[t];this.rootNode.style.setProperty(o,e[o])}},n.setHighlight=function(e,t){if(!e||!t)return this.highlightRegex=null,void(this.highlightColor=null);var n=/^[a-z0-9_\-\s]+$/gi,o=String(e).split(",").map((function(e){return e.trim()})).filter((function(e){return e&&e.length>1&&n.test(e)}));if(0===o.length)return this.highlightRegex=null,void(this.highlightColor=null);this.highlightRegex=new RegExp("("+o.join("|")+")","gi"),this.highlightColor=t},n.scrollToBottom=function(){this.scrollNode.scrollTop=this.scrollNode.scrollHeight},n.changePage=function(e){if(!this.isReady())return this.page=e,void this.tryFlushQueue();this.page=e,this.rootNode.textContent="",this.visibleMessages=[];for(var t,n,o=document.createDocumentFragment(),r=u(this.messages);!(n=r()).done;){var i=n.value;(0,c.canPageAcceptType)(e,i.type)&&(t=i.node,o.appendChild(t),this.visibleMessages.push(i))}t&&(this.rootNode.appendChild(o),t.scrollIntoView())},n.getCombinableMessage=function(e){for(var t=Date.now(),n=this.visibleMessages.length,o=n-1,r=Math.max(0,n-a.COMBINE_MAX_MESSAGES),i=o;i>=r;i--){var s=this.visibleMessages[i];if(!s.type.startsWith(a.MESSAGE_TYPE_INTERNAL)&&(0,c.isSameMessage)(s,e)&&t<s.createdAt+a.COMBINE_MAX_TIME_WINDOW)return s}return null},n.processBatch=function(t,n){var o=this;void 0===n&&(n={});var r=n,i=r.prepend,l=r.notifyListeners,v=void 0===l||l,E=Date.now();if(this.isReady()){for(var y,b,S=document.createDocumentFragment(),_={},C=u(t);!(b=C()).done;){var A=b.value,M=(0,c.createMessage)(A),T=this.getCombinableMessage(M);if(T)T.times=(T.times||1)+1,m(T);else{if(M.node)y=M.node;else if("internal/reconnected"===M.type)y=h();else if(y=p(),M.text?y.textContent=M.text:M.html?y.innerHTML=M.html:d.error("Error: message is missing text payload",M),!M.avoidHighlighting&&this.highlightRegex&&(0,s.highlightNode)(y,this.highlightRegex,(function(e){return g(e,o.highlightColor)}))&&(y.className+=" ChatMessage--highlighted"),(0,s.linkifyNode)(y),E<M.createdAt+a.IMAGE_RETRY_MESSAGE_AGE)for(var w=y.querySelectorAll("img"),N=0;N<w.length;N++)w[N].addEventListener("error",f);if(M.node=y,!M.type){var I=!Byond.IS_LTE_IE8&&a.MESSAGE_TYPES.find((function(e){return e.selector&&y.querySelector(e.selector)}));M.type=(null==I?void 0:I.type)||a.MESSAGE_TYPE_UNKNOWN}m(M),_[M.type]||(_[M.type]=0),_[M.type]+=1,this.messages.push(M),(0,c.canPageAcceptType)(this.page,M.type)&&(S.appendChild(y),this.visibleMessages.push(M))}}if(y){var x=this.rootNode.childNodes[0];i&&x?this.rootNode.insertBefore(S,x):this.rootNode.appendChild(S),this.scrollTracking&&e((function(){return o.scrollToBottom()}))}v&&this.events.emit("batchProcessed",_)}else this.queue=i?[].concat(t,this.queue):[].concat(this.queue,t)},n.pruneMessages=function(){if(this.isReady())if(this.scrollTracking){var e=this.visibleMessages,t=Math.max(0,e.length-a.MAX_VISIBLE_MESSAGES);if(t>0){this.visibleMessages=e.slice(t);for(var n=0;n<t;n++){var o=e[n];this.rootNode.removeChild(o.node),o.node="pruned"}this.messages=this.messages.filter((function(e){return"pruned"!==e.node})),d.log("pruned "+t+" visible messages")}var r=Math.max(0,this.messages.length-a.MAX_PERSISTED_MESSAGES);r>0&&(this.messages=this.messages.slice(r),d.log("pruned "+r+" stored messages"))}else d.debug("pruning delayed")},n.rebuildChat=function(){if(this.isReady()){for(var e,t=Math.max(0,this.messages.length-a.MAX_PERSISTED_MESSAGES),n=this.messages.slice(t),o=u(n);!(e=o()).done;)e.value.node=undefined;this.rootNode.textContent="",this.messages=[],this.visibleMessages=[],this.processBatch(n,{notifyListeners:!1})}},n.saveToDisk=function(){if(!Byond.IS_LTE_IE10){for(var e="",t=document.styleSheets,n=0;n<t.length;n++)for(var o=t[n].cssRules,r=0;r<o.length;r++)e+=o[r].cssText+"\n";e+="body, html { background-color: #141414 }\n";for(var i,a="",c=u(this.messages);!(i=c()).done;){var s=i.value;s.node&&(a+=s.node.outerHTML+"\n")}var l=new Blob(["<!doctype html>\n<html>\n<head>\n<title>SS13 Chat Log</title>\n<style>\n"+e+'</style>\n</head>\n<body>\n<div class="Chat">\n'+a+"</div>\n</body>\n</html>\n"]),d=(new Date).toISOString().substring(0,19).replace(/[-:]/g,"").replace("T","-");window.navigator.msSaveBlob(l,"ss13-chatlog-"+d+".html")}},t}();window.__chatRenderer__||(window.__chatRenderer__=new v);var E=window.__chatRenderer__;t.chatRenderer=E}).call(this,n(101).setImmediate)},216:function(e,t,n){"use strict";t.__esModule=!0,t.gameReducer=t.gameMiddleware=t.useGame=void 0;var o=n(688);t.useGame=o.useGame;var r=n(689);t.gameMiddleware=r.gameMiddleware;var i=n(691);t.gameReducer=i.gameReducer},217:function(e,t,n){"use strict";t.__esModule=!0,t.selectGame=void 0;t.selectGame=function(e){return e.game}},218:function(e,t,n){"use strict";t.__esModule=!0,t.connectionRestored=t.connectionLost=t.roundRestarted=void 0;var o=n(22),r=(0,o.createAction)("roundrestart");t.roundRestarted=r;var i=(0,o.createAction)("game/connectionLost");t.connectionLost=i;var a=(0,o.createAction)("game/connectionRestored");t.connectionRestored=a},219:function(e,t,n){"use strict";t.__esModule=!0,t.pingReducer=t.PingIndicator=t.pingMiddleware=void 0;var o=n(693);t.pingMiddleware=o.pingMiddleware;var r=n(694);t.PingIndicator=r.PingIndicator;var i=n(697);t.pingReducer=i.pingReducer},220:function(e,t,n){"use strict";t.__esModule=!0,t.PING_ROUNDTRIP_WORST=t.PING_ROUNDTRIP_BEST=t.PING_QUEUE_SIZE=t.PING_MAX_FAILS=t.PING_TIMEOUT=t.PING_INTERVAL=void 0;t.PING_INTERVAL=2500;t.PING_TIMEOUT=2e3;t.PING_MAX_FAILS=3;t.PING_QUEUE_SIZE=8;t.PING_ROUNDTRIP_BEST=50;t.PING_ROUNDTRIP_WORST=200},65:function(e,t,n){"use strict";t.__esModule=!0,t.openChatSettings=t.toggleSettings=t.changeSettingsTab=t.loadSettings=t.updateSettings=void 0;var o=n(22),r=(0,o.createAction)("settings/update");t.updateSettings=r;var i=(0,o.createAction)("settings/load");t.loadSettings=i;var a=(0,o.createAction)("settings/changeTab");t.changeSettingsTab=a;var c=(0,o.createAction)("settings/toggle");t.toggleSettings=c;var s=(0,o.createAction)("settings/openChatTab");t.openChatSettings=s},668:function(e,t,n){n(148),e.exports=n(669)},669:function(e,t,n){"use strict";var o=n(0);n(670),n(671);var r,i,a=n(99),c=n(22),s=(n(100),n(57)),u=n(186),l=n(136),d=n(187),g=n(211),p=n(145),h=n(216),f=n(692),m=n(219),v=n(144),E=n(698);function y(e,t,n,o,r,i,a){try{var c=e[i](a),s=c.value}catch(u){return void n(u)}c.done?t(s):Promise.resolve(s).then(o,r)}a.perf.mark("inception",null==(r=window.performance)||null==(i=r.timing)?void 0:i.navigationStart),a.perf.mark("init");var b=(0,d.configureStore)({reducer:(0,c.combineReducers)({audio:g.audioReducer,chat:p.chatReducer,game:h.gameReducer,ping:m.pingReducer,settings:v.settingsReducer}),middleware:{pre:[p.chatMiddleware,m.pingMiddleware,E.telemetryMiddleware,v.settingsMiddleware,g.audioMiddleware,h.gameMiddleware]}}),S=(0,l.createRenderer)((function(){var e=n(699).Panel;return(0,o.createComponentVNode)(2,d.StoreProvider,{store:b,children:(0,o.createComponentVNode)(2,e)})})),_=function(){var e,t=(e=regeneratorRuntime.mark((function n(e){var t;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return void 0===e&&(e="output"),n.next=3,Byond.winget(e);case 3:t=n.sent,Byond.winset("browseroutput",{size:t.size});case 5:case"end":return n.stop()}}),n)})),function(){var t=this,n=arguments;return new Promise((function(o,r){var i=e.apply(t,n);function a(e){y(i,o,r,a,c,"next",e)}function c(e){y(i,o,r,a,c,"throw",e)}a(undefined)}))});return function(e){return t.apply(this,arguments)}}();!function C(){if("loading"!==document.readyState){for((0,s.setupGlobalEvents)({ignoreWindowFocus:!0}),(0,f.setupPanelFocusHacks)(),(0,u.captureExternalLinks)(),b.subscribe(S),window.update=function(e){return b.dispatch(Byond.parseJson(e))};;){var e=window.__updateQueue__.shift();if(!e)break;window.update(e)}Byond.winset("output",{"is-visible":!1}),Byond.winset("browseroutput",{"is-visible":!0,"is-disabled":!1,pos:"0x0",size:"0x0"}),_()}else document.addEventListener("DOMContentLoaded",C)}()},670:function(e,t,n){},671:function(e,t,n){},672:function(e,t,n){"use strict";t.__esModule=!0,t.useAudio=void 0;var o=n(22),r=n(212);t.useAudio=function(e){var t=(0,o.useSelector)(e,r.selectAudio),n=(0,o.useDispatch)(e);return Object.assign({},t,{toggle:function(){return n({type:"audio/toggle"})}})}},673:function(e,t,n){"use strict";t.__esModule=!0,t.audioMiddleware=void 0;var o=n(674);t.audioMiddleware=function(e){var t=new o.AudioPlayer;return t.onPlay((function(){e.dispatch({type:"audio/playing"})})),t.onStop((function(){e.dispatch({type:"audio/stopped"})})),function(e){return function(n){var o=n.type,r=n.payload;if("audio/playMusic"===o){var i=r.url,a=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(r,["url"]);return t.play(i,a),e(n)}if("audio/stopMusic"===o)return t.stop(),e(n);if("settings/update"===o||"settings/load"===o){var c=null==r?void 0:r.adminMusicVolume;return"number"==typeof c&&t.setVolume(c),e(n)}return e(n)}}}},674:function(e,t,n){"use strict";function o(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}t.__esModule=!0,t.AudioPlayer=void 0;var i=(0,n(25).createLogger)("AudioPlayer"),a=function(){function e(){var e=this;Byond.IS_LTE_IE9||(this.node=document.createElement("audio"),this.node.style.setProperty("display","none"),document.body.appendChild(this.node),this.playing=!1,this.volume=1,this.options={},this.onPlaySubscribers=[],this.onStopSubscribers=[],this.node.addEventListener("canplaythrough",(function(){i.log("canplaythrough"),e.playing=!0,e.node.playbackRate=e.options.pitch||1,e.node.currentTime=e.options.start||0,e.node.volume=e.volume,e.node.play();for(var t,n=o(e.onPlaySubscribers);!(t=n()).done;){(0,t.value)()}})),this.node.addEventListener("ended",(function(){i.log("ended"),e.stop()})),this.node.addEventListener("error",(function(t){e.playing&&(i.log("playback error",t.error),e.stop())})),this.playbackInterval=setInterval((function(){e.playing&&(e.options.end>0&&e.node.currentTime>=e.options.end&&e.stop())}),1e3))}var t=e.prototype;return t.destroy=function(){this.node&&(this.node.stop(),document.removeChild(this.node),clearInterval(this.playbackInterval))},t.play=function(e,t){void 0===t&&(t={}),this.node&&(i.log("playing",e,t),this.options=t,this.node.src=e)},t.stop=function(){if(this.node){if(this.playing)for(var e,t=o(this.onStopSubscribers);!(e=t()).done;)(0,e.value)();i.log("stopping"),this.playing=!1,this.node.src=""}},t.setVolume=function(e){this.node&&(this.volume=e,this.node.volume=e)},t.onPlay=function(e){this.node&&this.onPlaySubscribers.push(e)},t.onStop=function(e){this.node&&this.onStopSubscribers.push(e)},e}();t.AudioPlayer=a},675:function(e,t,n){"use strict";t.__esModule=!0,t.NowPlayingWidget=void 0;var o=n(0),r=n(11),i=n(22),a=n(1),c=n(144),s=n(212);t.NowPlayingWidget=function(e,t){var n,u=(0,i.useSelector)(t,s.selectAudio),l=(0,i.useDispatch)(t),d=(0,c.useSettings)(t),g=null==(n=u.meta)?void 0:n.title;return(0,o.createComponentVNode)(2,a.Flex,{align:"center",children:[u.playing&&(0,o.createFragment)([(0,o.createComponentVNode)(2,a.Flex.Item,{shrink:0,mx:.5,color:"label",children:"Now playing:"}),(0,o.createComponentVNode)(2,a.Flex.Item,{mx:.5,grow:1,style:{"white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"},children:g||"Unknown Track"})],4)||(0,o.createComponentVNode)(2,a.Flex.Item,{grow:1,color:"label",children:"Nothing to play."}),u.playing&&(0,o.createComponentVNode)(2,a.Flex.Item,{mx:.5,fontSize:"0.9em",children:(0,o.createComponentVNode)(2,a.Button,{tooltip:"Stop",icon:"stop",onClick:function(){return l({type:"audio/stopMusic"})}})}),(0,o.createComponentVNode)(2,a.Flex.Item,{mx:.5,fontSize:"0.9em",children:(0,o.createComponentVNode)(2,a.Knob,{minValue:0,maxValue:1,value:d.adminMusicVolume,step:.0025,stepPixelSize:1,format:function(e){return(0,r.toFixed)(100*e)+"%"},onDrag:function(e,t){return d.update({adminMusicVolume:t})}})})]})}},676:function(e,t,n){"use strict";t.__esModule=!0,t.useSettings=void 0;var o=n(22),r=n(65),i=n(105);t.useSettings=function(e){var t=(0,o.useSelector)(e,i.selectSettings),n=(0,o.useDispatch)(e);return Object.assign({},t,{visible:t.view.visible,toggle:function(){return n((0,r.toggleSettings)())},update:function(e){return n((0,r.updateSettings)(e))}})}},677:function(e,t,n){"use strict";t.__esModule=!0,t.settingsMiddleware=void 0;var o=n(102),r=n(213),i=n(65),a=n(105);t.settingsMiddleware=function(e){var t=!1;return function(n){return function(c){var s,u=c.type,l=c.payload;if(t||(t=!0,o.storage.get("panel-settings").then((function(t){e.dispatch((0,i.loadSettings)(t))}))),u===i.updateSettings.type||u===i.loadSettings.type){var d=null==l?void 0:l.theme;d&&(0,r.setClientTheme)(d),n(c);var g=(0,a.selectSettings)(e.getState());return s=g.fontSize,document.documentElement.style.setProperty("font-size",s+"px"),document.body.style.setProperty("font-size",s+"px"),void o.storage.set("panel-settings",g)}return n(c)}}}},678:function(e,t,n){"use strict";t.__esModule=!0,t.settingsReducer=void 0;var o=n(65),r={version:1,fontSize:13,lineHeight:1.2,theme:"light",adminMusicVolume:.5,highlightText:"",highlightColor:"#ffdd44",view:{visible:!1,activeTab:n(214).SETTINGS_TABS[0].id}};t.settingsReducer=function(e,t){void 0===e&&(e=r);var n=t.type,i=t.payload;if(n===o.updateSettings.type)return Object.assign({},e,i);if(n===o.loadSettings.type)return(null==i?void 0:i.version)?(delete i.view,Object.assign({},e,i)):e;if(n===o.toggleSettings.type)return Object.assign({},e,{view:Object.assign({},e.view,{visible:!e.view.visible})});if(n===o.openChatSettings.type)return Object.assign({},e,{view:Object.assign({},e.view,{visible:!0,activeTab:"chatPage"})});if(n===o.changeSettingsTab.type){var a=i.tabId;return Object.assign({},e,{view:Object.assign({},e.view,{activeTab:a})})}return e}},679:function(e,t,n){"use strict";t.__esModule=!0,t.SettingsGeneral=t.SettingsPanel=void 0;var o=n(0),r=n(11),i=n(22),a=n(1),c=n(145),s=n(79),u=n(213),l=n(65),d=n(214),g=n(105);t.SettingsPanel=function(e,t){var n=(0,i.useSelector)(t,g.selectActiveTab),r=(0,i.useDispatch)(t);return(0,o.createComponentVNode)(2,a.Flex,{children:[(0,o.createComponentVNode)(2,a.Flex.Item,{mr:1,children:(0,o.createComponentVNode)(2,a.Section,{fitted:!0,fill:!0,minHeight:"8em",children:(0,o.createComponentVNode)(2,a.Tabs,{vertical:!0,children:d.SETTINGS_TABS.map((function(e){return(0,o.createComponentVNode)(2,a.Tabs.Tab,{selected:e.id===n,onClick:function(){return r((0,l.changeSettingsTab)({tabId:e.id}))},children:e.name},e.id)}))})})}),(0,o.createComponentVNode)(2,a.Flex.Item,{grow:1,basis:0,children:["general"===n&&(0,o.createComponentVNode)(2,p),"chatPage"===n&&(0,o.createComponentVNode)(2,c.ChatPageSettings)]})]})};var p=function(e,t){var n=(0,i.useSelector)(t,g.selectSettings),c=n.theme,d=n.fontSize,p=n.lineHeight,h=n.highlightText,f=n.highlightColor,m=(0,i.useDispatch)(t);return(0,o.createComponentVNode)(2,a.Section,{fill:!0,children:[(0,o.createComponentVNode)(2,a.LabeledList,{children:[(0,o.createComponentVNode)(2,a.LabeledList.Item,{label:"Theme",children:(0,o.createComponentVNode)(2,a.Dropdown,{selected:c,options:u.THEMES,onSelected:function(e){return m((0,l.updateSettings)({theme:e}))}})}),(0,o.createComponentVNode)(2,a.LabeledList.Item,{label:"Font size",children:(0,o.createComponentVNode)(2,a.NumberInput,{width:"4em",step:1,stepPixelSize:10,minValue:8,maxValue:32,value:d,unit:"px",format:function(e){return(0,r.toFixed)(e)},onChange:function(e,t){return m((0,l.updateSettings)({fontSize:t}))}})}),(0,o.createComponentVNode)(2,a.LabeledList.Item,{label:"Line height",children:(0,o.createComponentVNode)(2,a.NumberInput,{width:"4em",step:.01,stepPixelSize:2,minValue:.8,maxValue:5,value:p,format:function(e){return(0,r.toFixed)(e,2)},onDrag:function(e,t){return m((0,l.updateSettings)({lineHeight:t}))}})})]}),(0,o.createComponentVNode)(2,a.Divider),(0,o.createComponentVNode)(2,a.Box,{children:[(0,o.createComponentVNode)(2,a.Flex,{mb:1,color:"label",align:"baseline",children:[(0,o.createComponentVNode)(2,a.Flex.Item,{grow:1,children:"Highlight words (comma separated):"}),(0,o.createComponentVNode)(2,a.Flex.Item,{shrink:0,children:[(0,o.createComponentVNode)(2,a.ColorBox,{mr:1,color:f}),(0,o.createComponentVNode)(2,a.Input,{width:"5em",monospace:!0,placeholder:"#ffffff",value:f,onInput:function(e,t){return m((0,l.updateSettings)({highlightColor:t}))}})]})]}),(0,o.createComponentVNode)(2,a.TextArea,{height:"3em",value:h,onChange:function(e,t){return m((0,l.updateSettings)({highlightText:t}))}})]}),(0,o.createComponentVNode)(2,a.Divider),(0,o.createComponentVNode)(2,a.Box,{children:[(0,o.createComponentVNode)(2,a.Button,{icon:"check",onClick:function(){return m((0,s.rebuildChat)())},children:"Apply now"}),(0,o.createComponentVNode)(2,a.Box,{inline:!0,fontSize:"0.9em",ml:1,color:"label",children:"Can freeze the chat for a while."})]}),(0,o.createComponentVNode)(2,a.Divider),(0,o.createComponentVNode)(2,a.Button,{icon:"save",onClick:function(){return m((0,s.saveChatToDisk)())},children:"Save chat log"})]})};t.SettingsGeneral=p},680:function(e,t,n){"use strict";t.__esModule=!0,t.ChatPageSettings=void 0;var o=n(0),r=n(22),i=n(1),a=n(79),c=n(107),s=n(146);t.ChatPageSettings=function(e,t){var n=(0,r.useSelector)(t,s.selectCurrentChatPage),u=(0,r.useDispatch)(t);return(0,o.createComponentVNode)(2,i.Section,{fill:!0,children:[(0,o.createComponentVNode)(2,i.Flex,{mx:-.5,align:"center",children:[(0,o.createComponentVNode)(2,i.Flex.Item,{mx:.5,grow:1,children:(0,o.createComponentVNode)(2,i.Input,{fluid:!0,value:n.name,onChange:function(e,t){return u((0,a.updateChatPage)({pageId:n.id,name:t}))}})}),(0,o.createComponentVNode)(2,i.Flex.Item,{mx:.5,children:(0,o.createComponentVNode)(2,i.Button,{icon:"times",color:"red",onClick:function(){return u((0,a.removeChatPage)({pageId:n.id}))},children:"Remove"})})]}),(0,o.createComponentVNode)(2,i.Divider),(0,o.createComponentVNode)(2,i.Section,{title:"Messages to display",level:2,children:[c.MESSAGE_TYPES.filter((function(e){return!e.important&&!e.admin})).map((function(e){return(0,o.createComponentVNode)(2,i.Button.Checkbox,{checked:n.acceptedTypes[e.type],onClick:function(){return u((0,a.toggleAcceptedType)({pageId:n.id,type:e.type}))},children:e.name},e.type)})),(0,o.createComponentVNode)(2,i.Collapsible,{mt:1,color:"transparent",title:"Admin stuff",children:c.MESSAGE_TYPES.filter((function(e){return!e.important&&e.admin})).map((function(e){return(0,o.createComponentVNode)(2,i.Button.Checkbox,{checked:n.acceptedTypes[e.type],onClick:function(){return u((0,a.toggleAcceptedType)({pageId:n.id,type:e.type}))},children:e.name},e.type)}))})]})]})}},681:function(e,t,n){"use strict";t.__esModule=!0,t.createUuid=void 0;t.createUuid=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}},682:function(e,t,n){"use strict";t.__esModule=!0,t.ChatPanel=void 0;var o=n(0),r=n(6),i=n(1),a=n(215);var c=function(e){var t,n;function c(){var t;return(t=e.call(this)||this).ref=(0,o.createRef)(),t.state={scrollTracking:!0},t.handleScrollTrackingChange=function(e){return t.setState({scrollTracking:e})},t}n=e,(t=c).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var s=c.prototype;return s.componentDidMount=function(){a.chatRenderer.mount(this.ref.current),a.chatRenderer.events.on("scrollTrackingChanged",this.handleScrollTrackingChange),this.componentDidUpdate()},s.componentWillUnmount=function(){a.chatRenderer.events.off("scrollTrackingChanged",this.handleScrollTrackingChange)},s.componentDidUpdate=function(e){requestAnimationFrame((function(){a.chatRenderer.ensureScrollTracking()})),(!e||(0,r.shallowDiffers)(this.props,e))&&a.chatRenderer.assignStyle({width:"100%","white-space":"pre-wrap","font-size":this.props.fontSize,"line-height":this.props.lineHeight})},s.render=function(){var e=this.state.scrollTracking;return(0,o.createFragment)([(0,o.createVNode)(1,"div","Chat",null,1,null,null,this.ref),!e&&(0,o.createComponentVNode)(2,i.Button,{className:"Chat__scrollButton",icon:"arrow-down",onClick:function(){return a.chatRenderer.scrollToBottom()},children:"Scroll to bottom"})],0)},c}(o.Component);t.ChatPanel=c},683:function(e,t,n){"use strict";t.__esModule=!0,t.linkifyNode=t.highlightNode=t.replaceInTextNode=void 0;var o=function(e,t){return function(n){for(var o,r,i=n.textContent,a=i.length,c=0,s=0;o=e.exec(i);){s+=1,r||(r=document.createDocumentFragment());var u=o[0],l=u.length,d=o.index;c<d&&r.appendChild(document.createTextNode(i.substring(c,d))),c=d+l,r.appendChild(t(u))}return r&&(c<a&&r.appendChild(document.createTextNode(i.substring(c,a))),n.parentNode.replaceChild(r,n)),s}};t.replaceInTextNode=o;var r=function(e){var t=document.createElement("span");return t.setAttribute("style","background-color:#fd4;color:#000"),t.textContent=e,t};t.highlightNode=function a(e,t,n){void 0===n&&(n=r),n||(n=r);for(var i=0,c=e.childNodes,s=0;s<c.length;s++){var u=c[s];3===u.nodeType?i+=o(t,n)(u):i+=a(u,t,n)}return i};t.linkifyNode=function c(e){for(var t=0,n=e.childNodes,o=0;o<n.length;o++){var r=n[o],a=String(r.nodeName).toLowerCase();3===r.nodeType?t+=i(r):"a"!==a&&(t+=c(r))}return t};var i=o(/(?:(?:https?:\/\/)|(?:www\.))(?:[^ ]*?\.[^ ]*?)+[-A-Za-z0-9+&@#/%?=~_|$!:,.;()]+/gi,(function(e){var t=document.createElement("a");return t.href=e,t.textContent=e,t}))},684:function(e,t,n){"use strict";t.__esModule=!0,t.ChatTabs=void 0;var o=n(0),r=n(22),i=n(1),a=n(79),c=n(146),s=n(65),u=function(e){var t=e.value;return(0,o.createComponentVNode)(2,i.Box,{style:{"font-size":"0.7em","border-radius":"0.25em",width:"1.7em","line-height":"1.55em","background-color":"crimson",color:"#fff"},children:Math.min(t,99)})};t.ChatTabs=function(e,t){var n=(0,r.useSelector)(t,c.selectChatPages),l=(0,r.useSelector)(t,c.selectCurrentChatPage),d=(0,r.useDispatch)(t);return(0,o.createComponentVNode)(2,i.Flex,{align:"center",children:[(0,o.createComponentVNode)(2,i.Flex.Item,{children:(0,o.createComponentVNode)(2,i.Tabs,{textAlign:"center",children:n.map((function(e){return(0,o.createComponentVNode)(2,i.Tabs.Tab,{selected:e===l,rightSlot:e.unreadCount>0&&(0,o.createComponentVNode)(2,u,{value:e.unreadCount}),onClick:function(){return d((0,a.changeChatPage)({pageId:e.id}))},children:e.name},e.id)}))})}),(0,o.createComponentVNode)(2,i.Flex.Item,{ml:1,children:(0,o.createComponentVNode)(2,i.Button,{color:"transparent",icon:"plus",onClick:function(){d((0,a.addChatPage)()),d((0,s.openChatSettings)())}})})]})}},685:function(e,t,n){"use strict";t.__esModule=!0,t.chatMiddleware=void 0;var o=n(102),r=n(65),i=n(105),a=n(79),c=n(107),s=n(106),u=n(215),l=n(146);n(25);function d(e,t,n,o,r,i,a){try{var c=e[i](a),s=c.value}catch(u){return void n(u)}c.done?t(s):Promise.resolve(s).then(o,r)}function g(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var i=e.apply(t,n);function a(e){d(i,o,r,a,c,"next",e)}function c(e){d(i,o,r,a,c,"throw",e)}a(undefined)}))}}var p=function(){var e=g(regeneratorRuntime.mark((function t(e){var n,r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=(0,l.selectChat)(e.getState()),r=Math.max(0,u.chatRenderer.messages.length-c.MAX_PERSISTED_MESSAGES),i=u.chatRenderer.messages.slice(r).map((function(e){return(0,s.serializeMessage)(e)})),o.storage.set("chat-state",n),o.storage.set("chat-messages",i);case 5:case"end":return t.stop()}}),t)})));return function(t){return e.apply(this,arguments)}}(),h=function(){var e=g(regeneratorRuntime.mark((function t(e){var n,r,i,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([o.storage.get("chat-state"),o.storage.get("chat-messages")]);case 2:if(n=t.sent,r=n[0],i=n[1],!(r&&r.version<=4)){t.next=8;break}return e.dispatch((0,a.loadChat)()),t.abrupt("return");case 8:i&&(c=[].concat(i,[(0,s.createMessage)({type:"internal/reconnected"})]),u.chatRenderer.processBatch(c,{prepend:!0})),e.dispatch((0,a.loadChat)(r));case 10:case"end":return t.stop()}}),t)})));return function(t){return e.apply(this,arguments)}}();t.chatMiddleware=function(e){var t=!1,n=!1;return u.chatRenderer.events.on("batchProcessed",(function(t){n&&e.dispatch((0,a.updateMessageCount)(t))})),u.chatRenderer.events.on("scrollTrackingChanged",(function(t){e.dispatch((0,a.changeScrollTracking)(t))})),setInterval((function(){return p(e)}),c.MESSAGE_SAVE_INTERVAL),function(o){return function(c){var s=c.type,d=c.payload;if(t||(t=!0,h(e)),"chat/message"!==s){if(s===a.loadChat.type){o(c);var g=(0,l.selectCurrentChatPage)(e.getState());return u.chatRenderer.changePage(g),u.chatRenderer.onStateLoaded(),void(n=!0)}if(s!==a.changeChatPage.type&&s!==a.addChatPage.type&&s!==a.removeChatPage.type&&s!==a.toggleAcceptedType.type){if(s===a.rebuildChat.type)return u.chatRenderer.rebuildChat(),o(c);if(s!==r.updateSettings.type&&s!==r.loadSettings.type){if("roundrestart"===s)return p(e),o(c);if(s!==a.saveChatToDisk.type)return o(c);u.chatRenderer.saveToDisk()}else{o(c);var f=(0,i.selectSettings)(e.getState());u.chatRenderer.setHighlight(f.highlightText,f.highlightColor)}}else{o(c);var m=(0,l.selectCurrentChatPage)(e.getState());u.chatRenderer.changePage(m)}}else{var v=Array.isArray(d)?d:[d];u.chatRenderer.processBatch(v)}}}}},686:function(e,t,n){"use strict";t.__esModule=!0,t.chatReducer=t.initialState=void 0;var o,r=n(79),i=n(106);function a(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var s=(0,i.createMainPage)(),u={version:5,currentPageId:s.id,scrollTracking:!0,pages:[s.id],pageById:(o={},o[s.id]=s,o)};t.initialState=u;t.chatReducer=function(e,t){void 0===e&&(e=u);var n,o=t.type,c=t.payload;if(o===r.loadChat.type){if((null==c?void 0:c.version)!==e.version)return e;for(var l=0,d=Object.keys(c.pageById);l<d.length;l++){var g=d[l];c.pageById[g].unreadCount=0}return Object.assign({},e,c)}if(o===r.changeScrollTracking.type){var p=c,h=Object.assign({},e,{scrollTracking:p});if(p){var f,m=e.currentPageId,v=Object.assign({},e.pageById[m],{unreadCount:0});h.pageById=Object.assign({},e.pageById,((f={})[m]=v,f))}return h}if(o===r.updateMessageCount.type){for(var E,y=c,b=e.pages.map((function(t){return e.pageById[t]})),S=e.pageById[e.currentPageId],_=Object.assign({},e.pageById),C=a(b);!(E=C()).done;){for(var A=E.value,M=0,T=0,w=Object.keys(y);T<w.length;T++){var N=w[T];(0,i.canPageAcceptType)(A,N)&&(A===S&&e.scrollTracking||A!==S&&(0,i.canPageAcceptType)(S,N)||(M+=y[N]))}M>0&&(_[A.id]=Object.assign({},A,{unreadCount:A.unreadCount+M}))}return Object.assign({},e,{pageById:_})}if(o===r.addChatPage.type)return Object.assign({},e,{currentPageId:c.id,pages:[].concat(e.pages,[c.id]),pageById:Object.assign({},e.pageById,(n={},n[c.id]=c,n))});if(o===r.changeChatPage.type){var I,x=c.pageId,P=Object.assign({},e.pageById[x],{unreadCount:0});return Object.assign({},e,{currentPageId:x,pageById:Object.assign({},e.pageById,(I={},I[x]=P,I))})}if(o===r.updateChatPage.type){var k,R=c.pageId,O=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(c,["pageId"]),V=Object.assign({},e.pageById[R],O);return Object.assign({},e,{pageById:Object.assign({},e.pageById,(k={},k[R]=V,k))})}if(o===r.toggleAcceptedType.type){var G,B=c.pageId,L=c.type,D=Object.assign({},e.pageById[B]);return D.acceptedTypes=Object.assign({},D.acceptedTypes),D.acceptedTypes[L]=!D.acceptedTypes[L],Object.assign({},e,{pageById:Object.assign({},e.pageById,(G={},G[B]=D,G))})}if(o===r.removeChatPage.type){var F=c.pageId,j=Object.assign({},e,{pages:[].concat(e.pages),pageById:Object.assign({},e.pageById)});return delete j.pageById[F],j.pages=j.pages.filter((function(e){return e!==F})),0===j.pages.length&&(j.pages.push(s.id),j.pageById[s.id]=s,j.currentPageId=s.id),j.currentPageId&&j.currentPageId!==F||(j.currentPageId=j.pages[0]),j}return e}},687:function(e,t,n){"use strict";t.__esModule=!0,t.audioReducer=void 0;var o={visible:!1,playing:!1,track:null};t.audioReducer=function(e,t){void 0===e&&(e=o);var n=t.type,r=t.payload;return"audio/playing"===n?Object.assign({},e,{visible:!0,playing:!0}):"audio/stopped"===n?Object.assign({},e,{visible:!1,playing:!1}):"audio/playMusic"===n?Object.assign({},e,{meta:r}):"audio/stopMusic"===n?Object.assign({},e,{visible:!1,playing:!1,meta:null}):"audio/toggle"===n?Object.assign({},e,{visible:!e.visible}):e}},688:function(e,t,n){"use strict";t.__esModule=!0,t.useGame=void 0;var o=n(22),r=n(217);t.useGame=function(e){return(0,o.useSelector)(e,r.selectGame)}},689:function(e,t,n){"use strict";t.__esModule=!0,t.gameMiddleware=void 0;var o=n(147),r=n(218),i=n(217),a=n(690),c=function(e){return Object.assign({},e,{meta:Object.assign({},e.meta,{now:Date.now()})})};t.gameMiddleware=function(e){var t;return setInterval((function(){var n=e.getState();if(n){var o=(0,i.selectGame)(n),s=t&&Date.now()>=t+a.CONNECTION_LOST_AFTER;!o.connectionLostAt&&s&&e.dispatch(c((0,r.connectionLost)())),o.connectionLostAt&&!s&&e.dispatch(c((0,r.connectionRestored)()))}}),1e3),function(e){return function(n){var i=n.type,a=(n.payload,n.meta);return i===o.pingSuccess.type?(t=a.now,e(n)):i===r.roundRestarted.type?e(c(n)):e(n)}}}},690:function(e,t,n){"use strict";t.__esModule=!0,t.CONNECTION_LOST_AFTER=void 0;t.CONNECTION_LOST_AFTER=15e3},691:function(e,t,n){"use strict";t.__esModule=!0,t.gameReducer=void 0;var o=n(218),r={roundId:null,roundTime:null,roundRestartedAt:null,connectionLostAt:null};t.gameReducer=function(e,t){void 0===e&&(e=r);var n=t.type,i=(t.payload,t.meta);return"roundrestart"===n?Object.assign({},e,{roundRestartedAt:i.now}):n===o.connectionLost.type?Object.assign({},e,{connectionLostAt:i.now}):n===o.connectionRestored.type?Object.assign({},e,{connectionLostAt:null}):e}},692:function(e,t,n){"use strict";(function(e){t.__esModule=!0,t.setupPanelFocusHacks=void 0;var o=n(103),r=n(57),i=n(189),a=function(){return e((function(){return(0,i.focusMap)()}))};t.setupPanelFocusHacks=function(){var e=!1,t=null;window.addEventListener("focusin",(function(t){e=(0,r.canStealFocus)(t.target)})),window.addEventListener("mousedown",(function(e){t=[e.screenX,e.screenY]})),window.addEventListener("mouseup",(function(n){if(t){var r=[n.screenX,n.screenY];(0,o.vecLength)((0,o.vecSubtract)(r,t))>=10&&(e=!0)}e||a()})),r.globalEvents.on("keydown",(function(e){e.isModifierKey()||a()}))}}).call(this,n(101).setImmediate)},693:function(e,t,n){"use strict";t.__esModule=!0,t.pingMiddleware=void 0;var o=n(2),r=n(147),i=n(220);t.pingMiddleware=function(e){var t=!1,n=0,a=[],c=function(){for(var t=0;t<i.PING_QUEUE_SIZE;t++){var c=a[t];c&&Date.now()-c.sentAt>i.PING_TIMEOUT&&(a[t]=null,e.dispatch((0,r.pingFail)()))}var s={index:n,sentAt:Date.now()};a[n]=s,(0,o.sendMessage)({type:"ping",payload:{index:n}}),n=(n+1)%i.PING_QUEUE_SIZE};return function(e){return function(n){var o=n.type,s=n.payload;if(t||(t=!0,setInterval(c,i.PING_INTERVAL),c()),"pingReply"===o){var u=s.index,l=a[u];if(!l)return;return a[u]=null,e((0,r.pingSuccess)(l))}return e(n)}}}},694:function(e,t,n){"use strict";t.__esModule=!0,t.PingIndicator=void 0;var o=n(0),r=n(695),i=n(11),a=n(22),c=n(1),s=n(696);t.PingIndicator=function(e,t){var n=(0,a.useSelector)(t,s.selectPing),u=r.Color.lookup(n.networkQuality,[new r.Color(220,40,40),new r.Color(220,200,40),new r.Color(60,220,40)]),l=n.roundtrip?(0,i.toFixed)(n.roundtrip):"--";return(0,o.createVNode)(1,"div","Ping",[(0,o.createComponentVNode)(2,c.Box,{className:"Ping__indicator",backgroundColor:u}),l],0)}},695:function(e,t,n){"use strict";t.__esModule=!0,t.Color=void 0;var o=function(){function e(e,t,n,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===o&&(o=1),this.r=e,this.g=t,this.b=n,this.a=o}return e.prototype.toString=function(){return"rgba("+(0|this.r)+", "+(0|this.g)+", "+(0|this.b)+", "+(0|this.a)+")"},e}();t.Color=o,o.fromHex=function(e){return new o(parseInt(e.substr(1,2),16),parseInt(e.substr(3,2),16),parseInt(e.substr(5,2),16))},o.lerp=function(e,t,n){return new o((t.r-e.r)*n+e.r,(t.g-e.g)*n+e.g,(t.b-e.b)*n+e.b,(t.a-e.a)*n+e.a)},o.lookup=function(e,t){void 0===t&&(t=[]);var n=t.length;if(n<2)throw new Error("Needs at least two colors!");var r=e*(n-1);if(e<1e-4)return t[0];if(e>=.9999)return t[n-1];var i=r%1,a=0|r;return o.lerp(t[a],t[a+1],i)}},696:function(e,t,n){"use strict";t.__esModule=!0,t.selectPing=void 0;t.selectPing=function(e){return e.ping}},697:function(e,t,n){"use strict";t.__esModule=!0,t.pingReducer=void 0;var o=n(11),r=n(147),i=n(220);t.pingReducer=function(e,t){void 0===e&&(e={});var n=t.type,a=t.payload;if(n===r.pingSuccess.type){var c=a.roundtrip,s=e.roundtripAvg||c,u=Math.round(.4*s+.6*c);return{roundtrip:c,roundtripAvg:u,failCount:0,networkQuality:1-(0,o.scale)(u,i.PING_ROUNDTRIP_BEST,i.PING_ROUNDTRIP_WORST)}}if(n===r.pingFail.type){var l=e.failCount,d=void 0===l?0:l,g=(0,o.clamp01)(e.networkQuality-d/i.PING_MAX_FAILS),p=Object.assign({},e,{failCount:d+1,networkQuality:g});return d>i.PING_MAX_FAILS&&(p.roundtrip=undefined,p.roundtripAvg=undefined),p}return e}},698:function(e,t,n){"use strict";t.__esModule=!0,t.telemetryMiddleware=void 0;var o=n(2),r=n(102);function i(e,t,n,o,r,i,a){try{var c=e[i](a),s=c.value}catch(u){return void n(u)}c.done?t(s):Promise.resolve(s).then(o,r)}var a=(0,n(25).createLogger)("telemetry");t.telemetryMiddleware=function(e){var t,n;return function(c){return function(s){var u,l=s.type,d=s.payload;if("telemetry/request"!==l)return"backend/update"===l?(c(s),void(u=regeneratorRuntime.mark((function h(){var o,i,c,s;return regeneratorRuntime.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:if(i=null==d||null==(o=d.config)?void 0:o.client){u.next=4;break}return a.error("backend/update payload is missing client data!"),u.abrupt("return");case 4:if(t){u.next=13;break}return u.next=7,r.storage.get("telemetry");case 7:if(u.t0=u.sent,u.t0){u.next=10;break}u.t0={};case 10:(t=u.t0).connections||(t.connections=[]),a.debug("retrieved telemetry from storage",t);case 13:c=!1,t.connections.find((function(e){return n=i,(t=e).ckey===n.ckey&&t.address===n.address&&t.computer_id===n.computer_id;var t,n}))||(c=!0,t.connections.unshift(i),t.connections.length>10&&t.connections.pop()),c&&(a.debug("saving telemetry to storage",t),r.storage.set("telemetry",t)),n&&(s=n,n=null,e.dispatch({type:"telemetry/request",payload:s}));case 18:case"end":return u.stop()}}),h)})),function(){var e=this,t=arguments;return new Promise((function(n,o){var r=u.apply(e,t);function a(e){i(r,n,o,a,c,"next",e)}function c(e){i(r,n,o,a,c,"throw",e)}a(undefined)}))})()):c(s);if(!t)return a.debug("deferred"),void(n=d);a.debug("sending");var g=(null==d?void 0:d.limits)||{},p=t.connections.slice(0,g.connections);(0,o.sendMessage)({type:"telemetry",payload:{connections:p}})}}}},699:function(e,t,n){"use strict";t.__esModule=!0,t.Panel=void 0;var o=n(0),r=n(1),i=n(3),a=n(211),c=n(145),s=n(216),u=n(700),l=n(219),d=n(144);t.Panel=function(e,t){if(Byond.IS_LTE_IE10)return(0,o.createComponentVNode)(2,g);var n=(0,a.useAudio)(t),p=(0,d.useSettings)(t),h=(0,s.useGame)(t);return(0,o.createComponentVNode)(2,i.Pane,{theme:p.theme,children:(0,o.createComponentVNode)(2,r.Flex,{direction:"column",height:"100%",children:[(0,o.createComponentVNode)(2,r.Flex.Item,{children:(0,o.createComponentVNode)(2,r.Section,{fitted:!0,children:(0,o.createComponentVNode)(2,r.Flex,{mx:.5,align:"center",children:[(0,o.createComponentVNode)(2,r.Flex.Item,{mx:.5,grow:1,overflowX:"auto",children:(0,o.createComponentVNode)(2,c.ChatTabs)}),(0,o.createComponentVNode)(2,r.Flex.Item,{mx:.5,children:(0,o.createComponentVNode)(2,l.PingIndicator)}),(0,o.createComponentVNode)(2,r.Flex.Item,{mx:.5,children:(0,o.createComponentVNode)(2,r.Button,{color:"grey",selected:n.visible,icon:"music",tooltip:"Music player",tooltipPosition:"bottom-left",onClick:function(){return n.toggle()}})}),(0,o.createComponentVNode)(2,r.Flex.Item,{mx:.5,children:(0,o.createComponentVNode)(2,r.Button,{icon:p.visible?"times":"cog",selected:p.visible,tooltip:p.visible?"Close settings":"Open settings",tooltipPosition:"bottom-left",onClick:function(){return p.toggle()}})})]})})}),n.visible&&(0,o.createComponentVNode)(2,r.Flex.Item,{mt:1,children:(0,o.createComponentVNode)(2,r.Section,{children:(0,o.createComponentVNode)(2,a.NowPlayingWidget)})}),p.visible&&(0,o.createComponentVNode)(2,r.Flex.Item,{mt:1,children:(0,o.createComponentVNode)(2,d.SettingsPanel)}),(0,o.createComponentVNode)(2,r.Flex.Item,{mt:1,grow:1,children:(0,o.createComponentVNode)(2,r.Section,{fill:!0,fitted:!0,position:"relative",children:[(0,o.createComponentVNode)(2,i.Pane.Content,{scrollable:!0,children:(0,o.createComponentVNode)(2,c.ChatPanel,{lineHeight:p.lineHeight})}),(0,o.createComponentVNode)(2,u.Notifications,{children:[h.connectionLostAt&&(0,o.createComponentVNode)(2,u.Notifications.Item,{rightSlot:(0,o.createComponentVNode)(2,r.Button,{color:"white",onClick:function(){return Byond.command(".reconnect")},children:"Reconnect"}),children:"You are either AFK, experiencing lag or the connection has closed."}),h.roundRestartedAt&&(0,o.createComponentVNode)(2,u.Notifications.Item,{children:"The connection has been closed because the server is restarting. Please wait while you automatically reconnect."})]})]})})]})})};var g=function(e,t){var n=(0,d.useSettings)(t);return(0,o.createComponentVNode)(2,i.Pane,{theme:n.theme,children:(0,o.createComponentVNode)(2,i.Pane.Content,{scrollable:!0,children:[(0,o.createComponentVNode)(2,r.Button,{style:{position:"fixed",top:"1em",right:"2em","z-index":1e3},selected:n.visible,onClick:function(){return n.toggle()},children:"Settings"}),n.visible&&(0,o.createComponentVNode)(2,r.Flex.Item,{mt:1,children:(0,o.createComponentVNode)(2,d.SettingsPanel)})||(0,o.createComponentVNode)(2,c.ChatPanel,{lineHeight:n.lineHeight})]})})}},700:function(e,t,n){"use strict";t.__esModule=!0,t.Notifications=void 0;var o=n(0),r=n(1),i=function(e){var t=e.children;return(0,o.createVNode)(1,"div","Notifications",t,0)};t.Notifications=i;i.Item=function(e){var t=e.rightSlot,n=e.children;return(0,o.createComponentVNode)(2,r.Flex,{align:"center",className:"Notification",children:[(0,o.createComponentVNode)(2,r.Flex.Item,{className:"Notification__content",grow:1,children:n}),t&&(0,o.createComponentVNode)(2,r.Flex.Item,{className:"Notification__rightSlot",children:t})]})}},79:function(e,t,n){"use strict";t.__esModule=!0,t.saveChatToDisk=t.changeScrollTracking=t.removeChatPage=t.toggleAcceptedType=t.updateChatPage=t.changeChatPage=t.addChatPage=t.updateMessageCount=t.rebuildChat=t.loadChat=void 0;var o=n(22),r=n(106),i=(0,o.createAction)("chat/load");t.loadChat=i;var a=(0,o.createAction)("chat/rebuild");t.rebuildChat=a;var c=(0,o.createAction)("chat/updateMessageCount");t.updateMessageCount=c;var s=(0,o.createAction)("chat/addPage",(function(){return{payload:(0,r.createPage)()}}));t.addChatPage=s;var u=(0,o.createAction)("chat/changePage");t.changeChatPage=u;var l=(0,o.createAction)("chat/updatePage");t.updateChatPage=l;var d=(0,o.createAction)("chat/toggleAcceptedType");t.toggleAcceptedType=d;var g=(0,o.createAction)("chat/removePage");t.removeChatPage=g;var p=(0,o.createAction)("chat/changeScrollTracking");t.changeScrollTracking=p;var h=(0,o.createAction)("chat/saveToDisk");t.saveChatToDisk=h}}); |