Files
S.P.L.U.R.T-Station-13/tgui/public/tgui-panel.bundle.js
2020-09-02 17:52:47 +03:00

1 line
55 KiB
JavaScript

!function(e){function t(t){for(var o,i,c=t[0],s=t[1],d=t[2],l=0,g=[];l<c.length;l++)i=c[l],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&g.push(r[i][0]),r[i]=0;for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o]);for(u&&u(t);g.length;)g.shift()();return a.push.apply(a,d||[]),n()}function n(){for(var e,t=0;t<a.length;t++){for(var n=a[t],o=!0,c=1;c<n.length;c++){var s=n[c];0!==r[s]&&(o=!1)}o&&(a.splice(t--,1),e=i(i.s=n[0]))}return e}var o={},r={2:0},a=[];function i(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,i),n.l=!0,n.exports}i.m=e,i.c=o,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var c=window.webpackJsonp=window.webpackJsonp||[],s=c.push.bind(c);c.push=t,c=c.slice();for(var d=0;d<c.length;d++)t(c[d]);var u=s;a.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 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 i(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 i(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 i(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=a(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 a=n(678);t.settingsReducer=a.settingsReducer;var i=n(679);t.SettingsPanel=i.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 a=n(684);t.ChatTabs=a.ChatTabs;var i=n(685);t.chatMiddleware=i.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 a=(0,o.createAction)("ping/fail");t.pingFail=a;var i=(0,o.createAction)("ping/reply");t.pingReply=i},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 a=n(675);t.NowPlayingWidget=a.NowPlayingWidget;var i=n(687);t.audioReducer=i.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"];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":"none","infowindow.text-color":"#000000","info.background-color":"none","info.text-color":"#000000","browseroutput.background-color":"none","browseroutput.text-color":"#000000","outputwindow.background-color":"none","outputwindow.text-color":"#000000","mainwindow.background-color":"none","split.background-color":"none","changelog.background-color":"none","changelog.text-color":"#000000","rules.background-color":"none","rules.text-color":"#000000","wiki.background-color":"none","wiki.text-color":"#000000","forum.background-color":"none","forum.text-color":"#000000","github.background-color":"none","github.text-color":"#000000","report-issue.background-color":"none","report-issue.text-color":"#000000","output.background-color":"none","output.text-color":"#000000","statwindow.background-color":"none","statwindow.text-color":"#000000","stat.background-color":"#FFFFFF","stat.tab-background-color":"none","stat.text-color":"#000000","stat.tab-text-color":"#000000","stat.prefix-color":"#000000","stat.suffix-color":"#000000","saybutton.background-color":"none","saybutton.text-color":"#000000","oocbutton.background-color":"none","oocbutton.text-color":"#000000","mebutton.background-color":"none","mebutton.text-color":"#000000","asset_cache_browser.background-color":"none","asset_cache_browser.text-color":"#000000","tooltip.background-color":"none","tooltip.text-color":"#000000"});"dark"===e&&Byond.winset({"infowindow.background-color":"#202020","infowindow.text-color":"#a4bad6","info.background-color":"#202020","info.text-color":"#a4bad6","browseroutput.background-color":"#202020","browseroutput.text-color":"#a4bad6","outputwindow.background-color":"#202020","outputwindow.text-color":"#a4bad6","mainwindow.background-color":"#202020","split.background-color":"#202020","changelog.background-color":"#494949","changelog.text-color":"#a4bad6","rules.background-color":"#494949","rules.text-color":"#a4bad6","wiki.background-color":"#494949","wiki.text-color":"#a4bad6","forum.background-color":"#494949","forum.text-color":"#a4bad6","github.background-color":"#3a3a3a","github.text-color":"#a4bad6","report-issue.background-color":"#492020","report-issue.text-color":"#a4bad6","output.background-color":"#171717","output.text-color":"#a4bad6","statwindow.background-color":"#171717","statwindow.text-color":"#a4bad6","stat.background-color":"#171717","stat.tab-background-color":"#202020","stat.text-color":"#a4bad6","stat.tab-text-color":"#a4bad6","stat.prefix-color":"#a4bad6","stat.suffix-color":"#a4bad6","saybutton.background-color":"#202020","saybutton.text-color":"#a4bad6","oocbutton.background-color":"#202020","oocbutton.text-color":"#a4bad6","mebutton.background-color":"#202020","mebutton.text-color":"#a4bad6","asset_cache_browser.background-color":"#202020","asset_cache_browser.text-color":"#a4bad6","tooltip.background-color":"#202020","tooltip.text-color":"#a4bad6"})}},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),a=n(25),i=n(107),c=n(106),s=n(683);function d(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 u(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 u(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 u(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 l=(0,a.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},m=function(e){setTimeout((function(){var t=e.target,n=parseInt(t.getAttribute("data-reload-n"),10)||0;if(n>=i.IMAGE_RETRY_LIMIT)l.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)}}),i.IMAGE_RETRY_DELAY)},f=function(e){var t=e.node,n=e.times;if(t&&n){var o=t.querySelector(".Chat__badge"),a=o||document.createElement("div");a.textContent=n,a.className=(0,r.classes)(["Chat__badge","Chat__badge--animate"]),requestAnimationFrame((function(){a.className="Chat__badge"})),o||t.appendChild(a)}},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,a=Math.abs(o-r)<24;a!==e.scrollTracking&&(e.scrollTracking=a,e.events.emit("scrollTrackingChanged",a),l.debug("tracking",e.scrollTracking))},this.ensureScrollTracking=function(){e.scrollTracking&&e.scrollToBottom()},setInterval((function(){return e.pruneMessages()}),i.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=d(this.messages);!(n=r()).done;){var a=n.value;(0,c.canPageAcceptType)(e,a.type)&&(t=a.node,o.appendChild(t),this.visibleMessages.push(a))}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-i.COMBINE_MAX_MESSAGES),a=o;a>=r;a--){var s=this.visibleMessages[a];if(!s.type.startsWith(i.MESSAGE_TYPE_INTERNAL)&&(0,c.isSameMessage)(s,e)&&t<s.createdAt+i.COMBINE_MAX_TIME_WINDOW)return s}return null},n.processBatch=function(t,n){var o=this;void 0===n&&(n={});var r=n,a=r.prepend,u=r.notifyListeners,v=void 0===u||u,y=Date.now();if(this.isReady()){for(var b,S,_=document.createDocumentFragment(),C={},E=d(t);!(S=E()).done;){var M=S.value,A=(0,c.createMessage)(M),T=this.getCombinableMessage(A);if(T)T.times=(T.times||1)+1,f(T);else{if(A.node)b=A.node;else if("internal/reconnected"===A.type)b=h();else if(b=p(),A.text?b.textContent=A.text:A.html?b.innerHTML=A.html:l.error("Error: message is missing text payload",A),!A.avoidHighlighting&&this.highlightRegex&&(0,s.highlightNode)(b,this.highlightRegex,(function(e){return g(e,o.highlightColor)}))&&(b.className+=" ChatMessage--highlighted"),(0,s.linkifyNode)(b),y<A.createdAt+i.IMAGE_RETRY_MESSAGE_AGE)for(var N=b.querySelectorAll("img"),w=0;w<N.length;w++)N[w].addEventListener("error",m);if(A.node=b,!A.type){var I=!Byond.IS_LTE_IE8&&i.MESSAGE_TYPES.find((function(e){return e.selector&&b.querySelector(e.selector)}));A.type=(null==I?void 0:I.type)||i.MESSAGE_TYPE_UNKNOWN}f(A),C[A.type]||(C[A.type]=0),C[A.type]+=1,this.messages.push(A),(0,c.canPageAcceptType)(this.page,A.type)&&(_.appendChild(b),this.visibleMessages.push(A))}}if(b){var P=this.rootNode.childNodes[0];a&&P?this.rootNode.insertBefore(_,P):this.rootNode.appendChild(_),this.scrollTracking&&e((function(){return o.scrollToBottom()}))}v&&this.events.emit("batchProcessed",C)}else this.queue=a?[].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-i.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})),l.log("pruned "+t+" visible messages")}var r=Math.max(0,this.messages.length-i.MAX_PERSISTED_MESSAGES);r>0&&(this.messages=this.messages.slice(r),l.log("pruned "+r+" stored messages"))}else l.debug("pruning delayed")},n.rebuildChat=function(){if(this.isReady()){for(var e,t=Math.max(0,this.messages.length-i.MAX_PERSISTED_MESSAGES),n=this.messages.slice(t),o=d(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 a,i="",c=d(this.messages);!(a=c()).done;){var s=a.value;s.node&&(i+=s.node.outerHTML+"\n")}var u=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'+i+"</div>\n</body>\n</html>\n"]),l=(new Date).toISOString().substring(0,19).replace(/[-:]/g,"").replace("T","-");window.navigator.msSaveBlob(u,"ss13-chatlog-"+l+".html")}},t}();window.__chatRenderer__||(window.__chatRenderer__=new v);var y=window.__chatRenderer__;t.chatRenderer=y}).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 a=n(691);t.gameReducer=a.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 a=(0,o.createAction)("game/connectionLost");t.connectionLost=a;var i=(0,o.createAction)("game/connectionRestored");t.connectionRestored=i},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 a=n(697);t.pingReducer=a.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 a=(0,o.createAction)("settings/load");t.loadSettings=a;var i=(0,o.createAction)("settings/changeTab");t.changeSettingsTab=i;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,a,i=n(99),c=n(22),s=(n(100),n(57)),d=n(186),u=n(136),l=n(187),g=n(211),p=n(145),h=n(216),m=n(692),f=n(219),v=n(144),y=n(698);function b(e,t,n,o,r,a,i){try{var c=e[a](i),s=c.value}catch(d){return void n(d)}c.done?t(s):Promise.resolve(s).then(o,r)}i.perf.mark("inception",null==(r=window.performance)||null==(a=r.timing)?void 0:a.navigationStart),i.perf.mark("init");var S=(0,l.configureStore)({reducer:(0,c.combineReducers)({audio:g.audioReducer,chat:p.chatReducer,game:h.gameReducer,ping:f.pingReducer,settings:v.settingsReducer}),middleware:{pre:[p.chatMiddleware,f.pingMiddleware,y.telemetryMiddleware,v.settingsMiddleware,g.audioMiddleware,h.gameMiddleware]}}),_=(0,u.createRenderer)((function(){var e=n(699).Panel;return(0,o.createComponentVNode)(2,l.StoreProvider,{store:S,children:(0,o.createComponentVNode)(2,e)})})),C=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 a=e.apply(t,n);function i(e){b(a,o,r,i,c,"next",e)}function c(e){b(a,o,r,i,c,"throw",e)}i(undefined)}))});return function(e){return t.apply(this,arguments)}}();!function E(){if("loading"!==document.readyState){for((0,s.setupGlobalEvents)({ignoreWindowFocus:!0}),(0,m.setupPanelFocusHacks)(),(0,d.captureExternalLinks)(),S.subscribe(_),window.update=function(e){return S.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"}),C()}else document.addEventListener("DOMContentLoaded",E)}()},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 a=r.url,i=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(r,["url"]);return t.play(a,i),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 a=(0,n(25).createLogger)("AudioPlayer"),i=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(){a.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(){a.log("ended"),e.stop()})),this.node.addEventListener("error",(function(t){e.playing&&(a.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&&(a.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)();a.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=i},675:function(e,t,n){"use strict";t.__esModule=!0,t.NowPlayingWidget=void 0;var o=n(0),r=n(11),a=n(22),i=n(1),c=n(144),s=n(212);t.NowPlayingWidget=function(e,t){var n,d=(0,a.useSelector)(t,s.selectAudio),u=(0,a.useDispatch)(t),l=(0,c.useSettings)(t),g=null==(n=d.meta)?void 0:n.title;return(0,o.createComponentVNode)(2,i.Flex,{align:"center",children:[d.playing&&(0,o.createFragment)([(0,o.createComponentVNode)(2,i.Flex.Item,{shrink:0,mx:.5,color:"label",children:"Now playing:"}),(0,o.createComponentVNode)(2,i.Flex.Item,{mx:.5,grow:1,style:{"white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"},children:g||"Unknown Track"})],4)||(0,o.createComponentVNode)(2,i.Flex.Item,{grow:1,color:"label",children:"Nothing to play."}),d.playing&&(0,o.createComponentVNode)(2,i.Flex.Item,{mx:.5,fontSize:"0.9em",children:(0,o.createComponentVNode)(2,i.Button,{tooltip:"Stop",icon:"stop",onClick:function(){return u({type:"audio/stopMusic"})}})}),(0,o.createComponentVNode)(2,i.Flex.Item,{mx:.5,fontSize:"0.9em",children:(0,o.createComponentVNode)(2,i.Knob,{minValue:0,maxValue:1,value:l.adminMusicVolume,step:.0025,stepPixelSize:1,format:function(e){return(0,r.toFixed)(100*e)+"%"},onDrag:function(e,t){return l.update({adminMusicVolume:t})}})})]})}},676:function(e,t,n){"use strict";t.__esModule=!0,t.useSettings=void 0;var o=n(22),r=n(65),a=n(105);t.useSettings=function(e){var t=(0,o.useSelector)(e,a.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),a=n(65),i=n(105);t.settingsMiddleware=function(e){var t=!1;return function(n){return function(c){var s,d=c.type,u=c.payload;if(t||(t=!0,o.storage.get("panel-settings").then((function(t){e.dispatch((0,a.loadSettings)(t))}))),d===a.updateSettings.type||d===a.loadSettings.type){var l=null==u?void 0:u.theme;l&&(0,r.setClientTheme)(l),n(c);var g=(0,i.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,a=t.payload;if(n===o.updateSettings.type)return Object.assign({},e,a);if(n===o.loadSettings.type)return(null==a?void 0:a.version)?(delete a.view,Object.assign({},e,a)):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 i=a.tabId;return Object.assign({},e,{view:Object.assign({},e.view,{activeTab:i})})}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),a=n(22),i=n(1),c=n(145),s=n(79),d=n(213),u=n(65),l=n(214),g=n(105);t.SettingsPanel=function(e,t){var n=(0,a.useSelector)(t,g.selectActiveTab),r=(0,a.useDispatch)(t);return(0,o.createComponentVNode)(2,i.Flex,{children:[(0,o.createComponentVNode)(2,i.Flex.Item,{mr:1,children:(0,o.createComponentVNode)(2,i.Section,{fitted:!0,fill:!0,minHeight:"8em",children:(0,o.createComponentVNode)(2,i.Tabs,{vertical:!0,children:l.SETTINGS_TABS.map((function(e){return(0,o.createComponentVNode)(2,i.Tabs.Tab,{selected:e.id===n,onClick:function(){return r((0,u.changeSettingsTab)({tabId:e.id}))},children:e.name},e.id)}))})})}),(0,o.createComponentVNode)(2,i.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,a.useSelector)(t,g.selectSettings),c=n.theme,l=n.fontSize,p=n.lineHeight,h=n.highlightText,m=n.highlightColor,f=(0,a.useDispatch)(t);return(0,o.createComponentVNode)(2,i.Section,{fill:!0,children:[(0,o.createComponentVNode)(2,i.LabeledList,{children:[(0,o.createComponentVNode)(2,i.LabeledList.Item,{label:"Theme",children:(0,o.createComponentVNode)(2,i.Dropdown,{selected:c,options:d.THEMES,onSelected:function(e){return f((0,u.updateSettings)({theme:e}))}})}),(0,o.createComponentVNode)(2,i.LabeledList.Item,{label:"Font size",children:(0,o.createComponentVNode)(2,i.NumberInput,{width:"4em",step:1,stepPixelSize:10,minValue:8,maxValue:32,value:l,unit:"px",format:function(e){return(0,r.toFixed)(e)},onChange:function(e,t){return f((0,u.updateSettings)({fontSize:t}))}})}),(0,o.createComponentVNode)(2,i.LabeledList.Item,{label:"Line height",children:(0,o.createComponentVNode)(2,i.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 f((0,u.updateSettings)({lineHeight:t}))}})})]}),(0,o.createComponentVNode)(2,i.Divider),(0,o.createComponentVNode)(2,i.Box,{children:[(0,o.createComponentVNode)(2,i.Flex,{mb:1,color:"label",align:"baseline",children:[(0,o.createComponentVNode)(2,i.Flex.Item,{grow:1,children:"Highlight words (comma separated):"}),(0,o.createComponentVNode)(2,i.Flex.Item,{shrink:0,children:[(0,o.createComponentVNode)(2,i.ColorBox,{mr:1,color:m}),(0,o.createComponentVNode)(2,i.Input,{width:"5em",monospace:!0,placeholder:"#ffffff",value:m,onInput:function(e,t){return f((0,u.updateSettings)({highlightColor:t}))}})]})]}),(0,o.createComponentVNode)(2,i.TextArea,{height:"3em",value:h,onChange:function(e,t){return f((0,u.updateSettings)({highlightText:t}))}})]}),(0,o.createComponentVNode)(2,i.Divider),(0,o.createComponentVNode)(2,i.Box,{children:[(0,o.createComponentVNode)(2,i.Button,{icon:"check",onClick:function(){return f((0,s.rebuildChat)())},children:"Apply now"}),(0,o.createComponentVNode)(2,i.Box,{inline:!0,fontSize:"0.9em",ml:1,color:"label",children:"Can freeze the chat for a while."})]}),(0,o.createComponentVNode)(2,i.Divider),(0,o.createComponentVNode)(2,i.Button,{icon:"save",onClick:function(){return f((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),a=n(1),i=n(79),c=n(107),s=n(146);t.ChatPageSettings=function(e,t){var n=(0,r.useSelector)(t,s.selectCurrentChatPage),d=(0,r.useDispatch)(t);return(0,o.createComponentVNode)(2,a.Section,{fill:!0,children:[(0,o.createComponentVNode)(2,a.Flex,{mx:-.5,align:"center",children:[(0,o.createComponentVNode)(2,a.Flex.Item,{mx:.5,grow:1,children:(0,o.createComponentVNode)(2,a.Input,{fluid:!0,value:n.name,onChange:function(e,t){return d((0,i.updateChatPage)({pageId:n.id,name:t}))}})}),(0,o.createComponentVNode)(2,a.Flex.Item,{mx:.5,children:(0,o.createComponentVNode)(2,a.Button,{icon:"times",color:"red",onClick:function(){return d((0,i.removeChatPage)({pageId:n.id}))},children:"Remove"})})]}),(0,o.createComponentVNode)(2,a.Divider),(0,o.createComponentVNode)(2,a.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,a.Button.Checkbox,{checked:n.acceptedTypes[e.type],onClick:function(){return d((0,i.toggleAcceptedType)({pageId:n.id,type:e.type}))},children:e.name},e.type)})),(0,o.createComponentVNode)(2,a.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,a.Button.Checkbox,{checked:n.acceptedTypes[e.type],onClick:function(){return d((0,i.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),a=n(1),i=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(){i.chatRenderer.mount(this.ref.current),i.chatRenderer.events.on("scrollTrackingChanged",this.handleScrollTrackingChange),this.componentDidUpdate()},s.componentWillUnmount=function(){i.chatRenderer.events.off("scrollTrackingChanged",this.handleScrollTrackingChange)},s.componentDidUpdate=function(e){requestAnimationFrame((function(){i.chatRenderer.ensureScrollTracking()})),(!e||(0,r.shallowDiffers)(this.props,e))&&i.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,a.Button,{className:"Chat__scrollButton",icon:"arrow-down",onClick:function(){return i.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,a=n.textContent,i=a.length,c=0,s=0;o=e.exec(a);){s+=1,r||(r=document.createDocumentFragment());var d=o[0],u=d.length,l=o.index;c<l&&r.appendChild(document.createTextNode(a.substring(c,l))),c=l+u,r.appendChild(t(d))}return r&&(c<i&&r.appendChild(document.createTextNode(a.substring(c,i))),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 i(e,t,n){void 0===n&&(n=r),n||(n=r);for(var a=0,c=e.childNodes,s=0;s<c.length;s++){var d=c[s];3===d.nodeType?a+=o(t,n)(d):a+=i(d,t,n)}return a};t.linkifyNode=function c(e){for(var t=0,n=e.childNodes,o=0;o<n.length;o++){var r=n[o],i=String(r.nodeName).toLowerCase();3===r.nodeType?t+=a(r):"a"!==i&&(t+=c(r))}return t};var a=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),a=n(1),i=n(79),c=n(146),s=n(65),d=function(e){var t=e.value;return(0,o.createComponentVNode)(2,a.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),u=(0,r.useSelector)(t,c.selectCurrentChatPage),l=(0,r.useDispatch)(t);return(0,o.createComponentVNode)(2,a.Flex,{align:"center",children:[(0,o.createComponentVNode)(2,a.Flex.Item,{children:(0,o.createComponentVNode)(2,a.Tabs,{textAlign:"center",children:n.map((function(e){return(0,o.createComponentVNode)(2,a.Tabs.Tab,{selected:e===u,rightSlot:e.unreadCount>0&&(0,o.createComponentVNode)(2,d,{value:e.unreadCount}),onClick:function(){return l((0,i.changeChatPage)({pageId:e.id}))},children:e.name},e.id)}))})}),(0,o.createComponentVNode)(2,a.Flex.Item,{ml:1,children:(0,o.createComponentVNode)(2,a.Button,{color:"transparent",icon:"plus",onClick:function(){l((0,i.addChatPage)()),l((0,s.openChatSettings)())}})})]})}},685:function(e,t,n){"use strict";t.__esModule=!0,t.chatMiddleware=void 0;var o=n(102),r=n(65),a=n(105),i=n(79),c=n(107),s=n(106),d=n(215),u=n(146);n(25);function l(e,t,n,o,r,a,i){try{var c=e[a](i),s=c.value}catch(d){return void n(d)}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 a=e.apply(t,n);function i(e){l(a,o,r,i,c,"next",e)}function c(e){l(a,o,r,i,c,"throw",e)}i(undefined)}))}}var p=function(){var e=g(regeneratorRuntime.mark((function t(e){var n,r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=(0,u.selectChat)(e.getState()),r=Math.max(0,d.chatRenderer.messages.length-c.MAX_PERSISTED_MESSAGES),a=d.chatRenderer.messages.slice(r).map((function(e){return(0,s.serializeMessage)(e)})),o.storage.set("chat-state",n),o.storage.set("chat-messages",a);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,a,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],a=n[1],!(r&&r.version<=4)){t.next=8;break}return e.dispatch((0,i.loadChat)()),t.abrupt("return");case 8:a&&(c=[].concat(a,[(0,s.createMessage)({type:"internal/reconnected"})]),d.chatRenderer.processBatch(c,{prepend:!0})),e.dispatch((0,i.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 d.chatRenderer.events.on("batchProcessed",(function(t){n&&e.dispatch((0,i.updateMessageCount)(t))})),d.chatRenderer.events.on("scrollTrackingChanged",(function(t){e.dispatch((0,i.changeScrollTracking)(t))})),setInterval((function(){return p(e)}),c.MESSAGE_SAVE_INTERVAL),function(o){return function(c){var s=c.type,l=c.payload;if(t||(t=!0,h(e)),"chat/message"!==s){if(s===i.loadChat.type){o(c);var g=(0,u.selectCurrentChatPage)(e.getState());return d.chatRenderer.changePage(g),d.chatRenderer.onStateLoaded(),void(n=!0)}if(s!==i.changeChatPage.type&&s!==i.addChatPage.type&&s!==i.removeChatPage.type&&s!==i.toggleAcceptedType.type){if(s===i.rebuildChat.type)return d.chatRenderer.rebuildChat(),o(c);if(s!==r.updateSettings.type&&s!==r.loadSettings.type){if("roundrestart"===s)return p(e),o(c);if(s!==i.saveChatToDisk.type)return o(c);d.chatRenderer.saveToDisk()}else{o(c);var m=(0,a.selectSettings)(e.getState());d.chatRenderer.setHighlight(m.highlightText,m.highlightColor)}}else{o(c);var f=(0,u.selectCurrentChatPage)(e.getState());d.chatRenderer.changePage(f)}}else{var v=Array.isArray(l)?l:[l];d.chatRenderer.processBatch(v)}}}}},686:function(e,t,n){"use strict";t.__esModule=!0,t.chatReducer=t.initialState=void 0;var o,r=n(79),a=n(106);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 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,a.createMainPage)(),d={version:5,currentPageId:s.id,scrollTracking:!0,pages:[s.id],pageById:(o={},o[s.id]=s,o)};t.initialState=d;t.chatReducer=function(e,t){void 0===e&&(e=d);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 u=0,l=Object.keys(c.pageById);u<l.length;u++){var g=l[u];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 m,f=e.currentPageId,v=Object.assign({},e.pageById[f],{unreadCount:0});h.pageById=Object.assign({},e.pageById,((m={})[f]=v,m))}return h}if(o===r.updateMessageCount.type){for(var y,b=c,S=e.pages.map((function(t){return e.pageById[t]})),_=e.pageById[e.currentPageId],C=Object.assign({},e.pageById),E=i(S);!(y=E()).done;){for(var M=y.value,A=0,T=0,N=Object.keys(b);T<N.length;T++){var w=N[T];(0,a.canPageAcceptType)(M,w)&&(M===_&&e.scrollTracking||M!==_&&(0,a.canPageAcceptType)(_,w)||(A+=b[w]))}A>0&&(C[M.id]=Object.assign({},M,{unreadCount:M.unreadCount+A}))}return Object.assign({},e,{pageById:C})}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,P=c.pageId,x=Object.assign({},e.pageById[P],{unreadCount:0});return Object.assign({},e,{currentPageId:P,pageById:Object.assign({},e.pageById,(I={},I[P]=x,I))})}if(o===r.updateChatPage.type){var k,R=c.pageId,O=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[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 j=c.pageId,F=Object.assign({},e,{pages:[].concat(e.pages),pageById:Object.assign({},e.pageById)});return delete F.pageById[j],F.pages=F.pages.filter((function(e){return e!==j})),0===F.pages.length&&(F.pages.push(s.id),F.pageById[s.id]=s,F.currentPageId=s.id),F.currentPageId&&F.currentPageId!==j||(F.currentPageId=F.pages[0]),F}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),a=n(217),i=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,a.selectGame)(n),s=t&&Date.now()>=t+i.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 a=n.type,i=(n.payload,n.meta);return a===o.pingSuccess.type?(t=i.now,e(n)):a===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,a=(t.payload,t.meta);return"roundrestart"===n?Object.assign({},e,{roundRestartedAt:a.now}):n===o.connectionLost.type?Object.assign({},e,{connectionLostAt:a.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),a=n(189),i=function(){return e((function(){return(0,a.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||i()})),r.globalEvents.on("keydown",(function(e){e.isModifierKey()||i()}))}}).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),a=n(220);t.pingMiddleware=function(e){var t=!1,n=0,i=[],c=function(){for(var t=0;t<a.PING_QUEUE_SIZE;t++){var c=i[t];c&&Date.now()-c.sentAt>a.PING_TIMEOUT&&(i[t]=null,e.dispatch((0,r.pingFail)()))}var s={index:n,sentAt:Date.now()};i[n]=s,(0,o.sendMessage)({type:"ping",payload:{index:n}}),n=(n+1)%a.PING_QUEUE_SIZE};return function(e){return function(n){var o=n.type,s=n.payload;if(t||(t=!0,setInterval(c,a.PING_INTERVAL),c()),"pingReply"===o){var d=s.index,u=i[d];if(!u)return;return i[d]=null,e((0,r.pingSuccess)(u))}return e(n)}}}},694:function(e,t,n){"use strict";t.__esModule=!0,t.PingIndicator=void 0;var o=n(0),r=n(695),a=n(11),i=n(22),c=n(1),s=n(696);t.PingIndicator=function(e,t){var n=(0,i.useSelector)(t,s.selectPing),d=r.Color.lookup(n.networkQuality,[new r.Color(220,40,40),new r.Color(220,200,40),new r.Color(60,220,40)]),u=n.roundtrip?(0,a.toFixed)(n.roundtrip):"--";return(0,o.createVNode)(1,"div","Ping",[(0,o.createComponentVNode)(2,c.Box,{className:"Ping__indicator",backgroundColor:d}),u],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 a=r%1,i=0|r;return o.lerp(t[i],t[i+1],a)}},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),a=n(220);t.pingReducer=function(e,t){void 0===e&&(e={});var n=t.type,i=t.payload;if(n===r.pingSuccess.type){var c=i.roundtrip,s=e.roundtripAvg||c,d=Math.round(.4*s+.6*c);return{roundtrip:c,roundtripAvg:d,failCount:0,networkQuality:1-(0,o.scale)(d,a.PING_ROUNDTRIP_BEST,a.PING_ROUNDTRIP_WORST)}}if(n===r.pingFail.type){var u=e.failCount,l=void 0===u?0:u,g=(0,o.clamp01)(e.networkQuality-l/a.PING_MAX_FAILS),p=Object.assign({},e,{failCount:l+1,networkQuality:g});return l>a.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 a(e,t,n,o,r,a,i){try{var c=e[a](i),s=c.value}catch(d){return void n(d)}c.done?t(s):Promise.resolve(s).then(o,r)}var i=(0,n(25).createLogger)("telemetry");t.telemetryMiddleware=function(e){var t,n;return function(c){return function(s){var d,u=s.type,l=s.payload;if("telemetry/request"!==u)return"backend/update"===u?(c(s),void(d=regeneratorRuntime.mark((function h(){var o,a,c,s;return regeneratorRuntime.wrap((function(d){for(;;)switch(d.prev=d.next){case 0:if(a=null==l||null==(o=l.config)?void 0:o.client){d.next=4;break}return i.error("backend/update payload is missing client data!"),d.abrupt("return");case 4:if(t){d.next=13;break}return d.next=7,r.storage.get("telemetry");case 7:if(d.t0=d.sent,d.t0){d.next=10;break}d.t0={};case 10:(t=d.t0).connections||(t.connections=[]),i.debug("retrieved telemetry from storage",t);case 13:c=!1,t.connections.find((function(e){return n=a,(t=e).ckey===n.ckey&&t.address===n.address&&t.computer_id===n.computer_id;var t,n}))||(c=!0,t.connections.unshift(a),t.connections.length>10&&t.connections.pop()),c&&(i.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 d.stop()}}),h)})),function(){var e=this,t=arguments;return new Promise((function(n,o){var r=d.apply(e,t);function i(e){a(r,n,o,i,c,"next",e)}function c(e){a(r,n,o,i,c,"throw",e)}i(undefined)}))})()):c(s);if(!t)return i.debug("deferred"),void(n=l);i.debug("sending");var g=(null==l?void 0:l.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),a=n(3),i=n(211),c=n(145),s=n(216),d=n(700),u=n(219),l=n(144);t.Panel=function(e,t){if(Byond.IS_LTE_IE10)return(0,o.createComponentVNode)(2,g);var n=(0,i.useAudio)(t),p=(0,l.useSettings)(t),h=(0,s.useGame)(t);return(0,o.createComponentVNode)(2,a.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,u.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,i.NowPlayingWidget)})}),p.visible&&(0,o.createComponentVNode)(2,r.Flex.Item,{mt:1,children:(0,o.createComponentVNode)(2,l.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,a.Pane.Content,{scrollable:!0,children:(0,o.createComponentVNode)(2,c.ChatPanel,{lineHeight:p.lineHeight})}),(0,o.createComponentVNode)(2,d.Notifications,{children:[h.connectionLostAt&&(0,o.createComponentVNode)(2,d.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,d.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,l.useSettings)(t);return(0,o.createComponentVNode)(2,a.Pane,{theme:n.theme,children:(0,o.createComponentVNode)(2,a.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,l.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),a=function(e){var t=e.children;return(0,o.createVNode)(1,"div","Notifications",t,0)};t.Notifications=a;a.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),a=(0,o.createAction)("chat/load");t.loadChat=a;var i=(0,o.createAction)("chat/rebuild");t.rebuildChat=i;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 d=(0,o.createAction)("chat/changePage");t.changeChatPage=d;var u=(0,o.createAction)("chat/updatePage");t.updateChatPage=u;var l=(0,o.createAction)("chat/toggleAcceptedType");t.toggleAcceptedType=l;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}});