var app=function(){"use strict";function e(e){return{enumerable:!0,value:e}}function t(e){return{enumerable:!0,writable:!0,value:e}}let n={},r=()=>!0,o=()=>({}),s=e=>e,i=(e,t,n,r)=>e.apply(n,r)&&t.apply(n,r),l=(e,t,n,[r,o])=>t.call(n,e.call(n,r,o),o),a=(e,t)=>Object.freeze(Object.create(e,t));function c(e,t,n){return e.reduce(((e,t)=>function(...r){return n(e,t,this,r)}),t)}function u(t){return a(this,{fn:e(t)})}let d={},f=u.bind(d),m=e=>f(((t,n)=>!!~e(t,n)&&t)),g={},p=u.bind(g);function h(e,t){return t.filter((t=>e.isPrototypeOf(t)))}function y(t,n,...o){let u=c(h(g,o).map((e=>e.fn)),r,i),f=c(h(d,o).map((e=>e.fn)),s,l);return a(this,{from:e(t),to:e(n),guards:e(u),reducers:e(f)})}let v={},w={},x=y.bind(v);function b(e,t,n){return z(t,e,n,this.immediates)||e}function $(e){let t=new Map;for(let n of e)t.has(n.from)||t.set(n.from,[]),t.get(n.from).push(n);return t}y.bind(w,null);let _={enter:s};function k(...t){let n=h(v,t),r=h(w,t),o={final:e(0===t.length),transitions:e($(n))};return r.length&&(o.immediates=e(r),o.enter=e(b)),a(_,o)}let C={enter(e,t,n){return this.fn.call(t,t.context,n).then((e=>t.send({type:"done",data:e}))).catch((e=>t.send({type:"error",error:e}))),e}},O={enter(e,t,n){if(t.child=M(this.machine,(e=>{t.onChange(e),t.child==e&&e.machine.state.value.final&&(delete t.child,t.send({type:"done",data:e.context}))}),t.context,n),t.child.machine.state.value.final){let n=t.child.context;return delete t.child,z(t,e,{type:"done",data:n},this.transitions.get("done"))}return e}};function j(t,...n){let r=e($(n));return L.isPrototypeOf(t)?a(O,{machine:e(t),transitions:r}):a(C,{fn:e(t),transitions:r})}let L={get state(){return{name:this.current,value:this.states[this.current]}}};function z(t,r,o,s){let{context:i}=t;for(let{to:l,guards:c,reducers:u}of s)if(c(i,o)){t.context=u.call(t,i,o);let s=r.original||r,c=a(s,{current:e(l),original:{value:s}});return n._onEnter&&n._onEnter(r,l,t.context,i,o),c.state.value.enter(c,t,o)}}let E={send(e){this.machine=function(e,t){let r=t.type||t,{machine:o}=e,{value:s,name:i}=o.state;return s.transitions.has(r)?z(e,o,t,s.transitions.get(r))||o:(n._send&&n._send(r,i),o)}(this,e),this.onChange(this)}};function M(n,r,o,s){let i=Object.create(E,{machine:t(n),context:t(n.context(o,s)),onChange:e(r)});return i.send=i.send.bind(i),i.machine=i.machine.state.value.enter(i.machine,i,s),i}const T=Object.getPrototypeOf(j(Promise.resolve()));function S(e,t){throw new Error(`Cannot transition from ${e} to unknown state: ${t}`)}function I(){}n._create=function(e,t){if(!(e in t))throw new Error(`Initial state [${e}] is not a known state.`);for(let e in t){let n=t[e];for(let[,r]of n.transitions)for(let{to:n}of r)n in t||S(e,n);if(T.isPrototypeOf(n)){let t=!1;for(let[,e]of n.transitions)for(let{from:n}of e)"error"===n&&(t=!0);t||console.warn(`When using invoke [current state: ${e}] with Promise-returning function, you need to add 'error' state. Otherwise, robot will hide errors in Promise-returning function`)}}},n._send=function(e,t){throw new Error(`No transitions for event ${e} from the current state [${t}]`)};const P=e=>e;function N(e,t){for(const n in t)e[n]=t[n];return e}function D(e){return e()}function A(){return Object.create(null)}function R(e){e.forEach(D)}function H(e){return"function"==typeof e}function B(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function q(e,t,n){e.$$.on_destroy.push(function(e,...t){if(null==e)return I;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}(t,n))}function V(e,t,n,r){if(e){const o=W(e,t,n,r);return e[0](o)}}function W(e,t,n,r){return e[1]&&r?N(n.ctx.slice(),e[1](r(t))):n.ctx}function F(e,t,n,r){if(e[2]&&r){const o=e[2](r(n));if(void 0===t.dirty)return o;if("object"==typeof o){const e=[],n=Math.max(t.dirty.length,o.length);for(let r=0;r<n;r+=1)e[r]=t.dirty[r]|o[r];return e}return t.dirty|o}return t.dirty}function G(e,t,n,r,o,s){if(o){const i=W(t,n,r,s);e.p(i,o)}}function U(e){if(e.ctx.length>32){const t=[],n=e.ctx.length/32;for(let e=0;e<n;e++)t[e]=-1;return t}return-1}const J="undefined"!=typeof window;let Z=J?()=>window.performance.now():()=>Date.now(),Q=J?e=>requestAnimationFrame(e):I;const Y=new Set;function K(e){Y.forEach((t=>{t.c(e)||(Y.delete(t),t.f())})),0!==Y.size&&Q(K)}function X(e){let t;return 0===Y.size&&Q(K),{promise:new Promise((n=>{Y.add(t={c:e,f:n})})),abort(){Y.delete(t)}}}function ee(e,t){e.appendChild(t)}function te(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function ne(e){const t=ie("style");return function(e,t){ee(e.head||e,t)}(te(e),t),t.sheet}function re(e,t,n){e.insertBefore(t,n||null)}function oe(e){e.parentNode.removeChild(e)}function se(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function ie(e){return document.createElement(e)}function le(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function ae(e){return document.createTextNode(e)}function ce(){return ae(" ")}function ue(){return ae("")}function de(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function fe(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function me(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function ge(e,t){e.value=null==t?"":t}function pe(e,t,n,r){null===n?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function he(e,t,n){e.classList[n?"add":"remove"](t)}function ye(e,t,n=!1){const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,n,!1,t),r}const ve=new Map;let we,xe=0;function be(e,t,n,r,o,s,i,l=0){const a=16.666/r;let c="{\n";for(let e=0;e<=1;e+=a){const r=t+(n-t)*s(e);c+=100*e+`%{${i(r,1-r)}}\n`}const u=c+`100% {${i(n,1-n)}}\n}`,d=`__svelte_${function(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}(u)}_${l}`,f=te(e),{stylesheet:m,rules:g}=ve.get(f)||function(e,t){const n={stylesheet:ne(t),rules:{}};return ve.set(e,n),n}(f,e);g[d]||(g[d]=!0,m.insertRule(`@keyframes ${d} ${u}`,m.cssRules.length));const p=e.style.animation||"";return e.style.animation=`${p?`${p}, `:""}${d} ${r}ms linear ${o}ms 1 both`,xe+=1,d}function $e(e,t){const n=(e.style.animation||"").split(", "),r=n.filter(t?e=>e.indexOf(t)<0:e=>-1===e.indexOf("__svelte")),o=n.length-r.length;o&&(e.style.animation=r.join(", "),xe-=o,xe||Q((()=>{xe||(ve.forEach((e=>{const{stylesheet:t}=e;let n=t.cssRules.length;for(;n--;)t.deleteRule(n);e.rules={}})),ve.clear())})))}function _e(e,t,n,r){if(!t)return I;const o=e.getBoundingClientRect();if(t.left===o.left&&t.right===o.right&&t.top===o.top&&t.bottom===o.bottom)return I;const{delay:s=0,duration:i=300,easing:l=P,start:a=Z()+s,end:c=a+i,tick:u=I,css:d}=n(e,{from:t,to:o},r);let f,m=!0,g=!1;function p(){d&&$e(e,f),m=!1}return X((e=>{if(!g&&e>=a&&(g=!0),g&&e>=c&&(u(1,0),p()),!m)return!1;if(g){const t=0+1*l((e-a)/i);u(t,1-t)}return!0})),d&&(f=be(e,0,1,i,s,l,d)),s||(g=!0),u(0,1),p}function ke(e){const t=getComputedStyle(e);if("absolute"!==t.position&&"fixed"!==t.position){const{width:n,height:r}=t,o=e.getBoundingClientRect();e.style.position="absolute",e.style.width=n,e.style.height=r,Ce(e,o)}}function Ce(e,t){const n=e.getBoundingClientRect();if(t.left!==n.left||t.top!==n.top){const r=getComputedStyle(e),o="none"===r.transform?"":r.transform;e.style.transform=`${o} translate(${t.left-n.left}px, ${t.top-n.top}px)`}}function Oe(e){we=e}function je(){if(!we)throw new Error("Function called outside component initialization");return we}function Le(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach((e=>e.call(this,t)))}const ze=[],Ee=[],Me=[],Te=[],Se=Promise.resolve();let Ie=!1;function Pe(){Ie||(Ie=!0,Se.then(He))}function Ne(e){Me.push(e)}const De=new Set;let Ae,Re=0;function He(){const e=we;do{for(;Re<ze.length;){const e=ze[Re];Re++,Oe(e),Be(e.$$)}for(Oe(null),ze.length=0,Re=0;Ee.length;)Ee.pop()();for(let e=0;e<Me.length;e+=1){const t=Me[e];De.has(t)||(De.add(t),t())}Me.length=0}while(ze.length);for(;Te.length;)Te.pop()();Ie=!1,De.clear(),Oe(e)}function Be(e){if(null!==e.fragment){e.update(),R(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(Ne)}}function qe(){return Ae||(Ae=Promise.resolve(),Ae.then((()=>{Ae=null}))),Ae}function Ve(e,t,n){e.dispatchEvent(ye(`${t?"intro":"outro"}${n}`))}const We=new Set;let Fe;function Ge(){Fe={r:0,c:[],p:Fe}}function Ue(){Fe.r||R(Fe.c),Fe=Fe.p}function Je(e,t){e&&e.i&&(We.delete(e),e.i(t))}function Ze(e,t,n,r){if(e&&e.o){if(We.has(e))return;We.add(e),Fe.c.push((()=>{We.delete(e),r&&(n&&e.d(1),r())})),e.o(t)}}const Qe={duration:0};function Ye(e,t,n){let r,o,s=t(e,n),i=!1,l=0;function a(){r&&$e(e,r)}function c(){const{delay:t=0,duration:n=300,easing:c=P,tick:u=I,css:d}=s||Qe;d&&(r=be(e,0,1,n,t,c,d,l++)),u(0,1);const f=Z()+t,m=f+n;o&&o.abort(),i=!0,Ne((()=>Ve(e,!0,"start"))),o=X((t=>{if(i){if(t>=m)return u(1,0),Ve(e,!0,"end"),a(),i=!1;if(t>=f){const e=c((t-f)/n);u(e,1-e)}}return i}))}let u=!1;return{start(){u||(u=!0,$e(e),H(s)?(s=s(),qe().then(c)):c())},invalidate(){u=!1},end(){i&&(a(),i=!1)}}}function Ke(e,t,n){let r,o=t(e,n),s=!0;const i=Fe;function l(){const{delay:t=0,duration:n=300,easing:l=P,tick:a=I,css:c}=o||Qe;c&&(r=be(e,1,0,n,t,l,c));const u=Z()+t,d=u+n;Ne((()=>Ve(e,!1,"start"))),X((t=>{if(s){if(t>=d)return a(0,1),Ve(e,!1,"end"),--i.r||R(i.c),!1;if(t>=u){const e=l((t-u)/n);a(1-e,e)}}return s}))}return i.r+=1,H(o)?qe().then((()=>{o=o(),l()})):l(),{end(t){t&&o.tick&&o.tick(1,0),s&&(r&&$e(e,r),s=!1)}}}function Xe(e,t,n,r){let o=t(e,n),s=r?0:1,i=null,l=null,a=null;function c(){a&&$e(e,a)}function u(e,t){const n=e.b-s;return t*=Math.abs(n),{a:s,b:e.b,d:n,duration:t,start:e.start,end:e.start+t,group:e.group}}function d(t){const{delay:n=0,duration:r=300,easing:d=P,tick:f=I,css:m}=o||Qe,g={start:Z()+n,b:t};t||(g.group=Fe,Fe.r+=1),i||l?l=g:(m&&(c(),a=be(e,s,t,r,n,d,m)),t&&f(0,1),i=u(g,r),Ne((()=>Ve(e,t,"start"))),X((t=>{if(l&&t>l.start&&(i=u(l,r),l=null,Ve(e,i.b,"start"),m&&(c(),a=be(e,s,i.b,i.duration,0,d,o.css))),i)if(t>=i.end)f(s=i.b,1-s),Ve(e,i.b,"end"),l||(i.b?c():--i.group.r||R(i.group.c)),i=null;else if(t>=i.start){const e=t-i.start;s=i.a+i.d*d(e/i.duration),f(s,1-s)}return!(!i&&!l)})))}return{run(e){H(o)?qe().then((()=>{o=o(),d(e)})):d(e)},end(){c(),i=l=null}}}function et(e,t){Ze(e,1,1,(()=>{t.delete(e.key)}))}function tt(e,t){e.f(),et(e,t)}function nt(e,t,n,r,o,s,i,l,a,c,u,d){let f=e.length,m=s.length,g=f;const p={};for(;g--;)p[e[g].key]=g;const h=[],y=new Map,v=new Map;for(g=m;g--;){const e=d(o,s,g),l=n(e);let a=i.get(l);a?r&&a.p(e,t):(a=c(l,e),a.c()),y.set(l,h[g]=a),l in p&&v.set(l,Math.abs(g-p[l]))}const w=new Set,x=new Set;function b(e){Je(e,1),e.m(l,u),i.set(e.key,e),u=e.first,m--}for(;f&&m;){const t=h[m-1],n=e[f-1],r=t.key,o=n.key;t===n?(u=t.first,f--,m--):y.has(o)?!i.has(r)||w.has(r)?b(t):x.has(o)?f--:v.get(r)>v.get(o)?(x.add(r),b(t)):(w.add(o),f--):(a(n,i),f--)}for(;f--;){const t=e[f];y.has(t.key)||a(t,i)}for(;m;)b(h[m-1]);return h}function rt(e){e&&e.c()}function ot(e,t,n,r){const{fragment:o,on_mount:s,on_destroy:i,after_update:l}=e.$$;o&&o.m(t,n),r||Ne((()=>{const t=s.map(D).filter(H);i?i.push(...t):R(t),e.$$.on_mount=[]})),l.forEach(Ne)}function st(e,t){const n=e.$$;null!==n.fragment&&(R(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function it(e,t,n,r,o,s,i,l=[-1]){const a=we;Oe(e);const c=e.$$={fragment:null,ctx:null,props:s,update:I,not_equal:o,bound:A(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(a?a.$$.context:[])),callbacks:A(),dirty:l,skip_bound:!1,root:t.target||a.$$.root};i&&i(c.root);let u=!1;if(c.ctx=n?n(e,t.props||{},((t,n,...r)=>{const s=r.length?r[0]:n;return c.ctx&&o(c.ctx[t],c.ctx[t]=s)&&(!c.skip_bound&&c.bound[t]&&c.bound[t](s),u&&function(e,t){-1===e.$$.dirty[0]&&(ze.push(e),Pe(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),n})):[],c.update(),u=!0,R(c.before_update),c.fragment=!!r&&r(c.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);c.fragment&&c.fragment.l(e),e.forEach(oe)}else c.fragment&&c.fragment.c();t.intro&&Je(e.$$.fragment),ot(e,t.target,t.anchor,t.customElement),He()}Oe(a)}class lt{$destroy(){st(this,1),this.$destroy=I}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function at(e){let t,n;return{c(){t=le("svg"),n=le("path"),fe(n,"fill","currentColor"),fe(n,"d","M494.2 221.9l-59.8-40.5 13.7-71c2.6-13.2-1.6-26.8-11.1-36.4-9.6-9.5-23.2-13.7-36.2-11.1l-70.9 13.7-40.4-59.9c-15.1-22.3-51.9-22.3-67 0l-40.4 59.9-70.8-13.7C98 60.4 84.5 64.5 75 74.1c-9.5 9.6-13.7 23.1-11.1 36.3l13.7 71-59.8 40.5C6.6 229.5 0 242 0 255.5s6.7 26 17.8 33.5l59.8 40.5-13.7 71c-2.6 13.2 1.6 26.8 11.1 36.3 9.5 9.5 22.9 13.7 36.3 11.1l70.8-13.7 40.4 59.9C230 505.3 242.6 512 256 512s26-6.7 33.5-17.8l40.4-59.9 70.9 13.7c13.4 2.7 26.8-1.6 36.3-11.1 9.5-9.5 13.6-23.1 11.1-36.3l-13.7-71 59.8-40.5c11.1-7.5 17.8-20.1 17.8-33.5-.1-13.6-6.7-26.1-17.9-33.7zm-112.9 85.6l17.6 91.2-91-17.6L256 458l-51.9-77-90.9 17.6 17.6-91.2-76.8-52 76.8-52-17.6-91.2 91 17.6L256 53l51.9 76.9 91-17.6-17.6 91.1 76.8 52-76.8 52.1zM256 152c-57.3 0-104 46.7-104 104s46.7 104 104 104 104-46.7 104-104-46.7-104-104-104zm0 160c-30.9 0-56-25.1-56-56s25.1-56 56-56 56 25.1 56 56-25.1 56-56 56z"),fe(t,"aria-hidden","true"),fe(t,"focusable","false"),fe(t,"data-prefix","far"),fe(t,"data-icon","sun"),fe(t,"class","svg-inline--fa fa-sun fa-w-16"),fe(t,"role","img"),fe(t,"xmlns","http://www.w3.org/2000/svg"),fe(t,"viewBox","0 0 512 512")},m(e,r){re(e,t,r),ee(t,n)},d(e){e&&oe(t)}}}function ct(e){let t,n;return{c(){t=le("svg"),n=le("path"),fe(n,"fill","currentColor"),fe(n,"d","M279.135 512c78.756 0 150.982-35.804 198.844-94.775 28.27-34.831-2.558-85.722-46.249-77.401-82.348 15.683-158.272-47.268-158.272-130.792 0-48.424 26.06-92.292 67.434-115.836 38.745-22.05 28.999-80.788-15.022-88.919A257.936 257.936 0 0 0 279.135 0c-141.36 0-256 114.575-256 256 0 141.36 114.576 256 256 256zm0-464c12.985 0 25.689 1.201 38.016 3.478-54.76 31.163-91.693 90.042-91.693 157.554 0 113.848 103.641 199.2 215.252 177.944C402.574 433.964 344.366 464 279.135 464c-114.875 0-208-93.125-208-208s93.125-208 208-208z"),fe(t,"aria-hidden","true"),fe(t,"focusable","false"),fe(t,"data-prefix","far"),fe(t,"data-icon","moon"),fe(t,"class","svg-inline--fa fa-moon fa-w-16"),fe(t,"role","img"),fe(t,"xmlns","http://www.w3.org/2000/svg"),fe(t,"viewBox","0 0 512 512")},m(e,r){re(e,t,r),ee(t,n)},d(e){e&&oe(t)}}}function ut(e){let t,n,r;function o(e,t){return e[0]?ct:at}let s=o(e),i=s(e);return{c(){t=ie("div"),i.c(),fe(t,"class","absolute top-0 right-0 w-8 h-8 p-2 z-50 text-svelte cursor-pointer")},m(o,s){re(o,t,s),i.m(t,null),n||(r=de(t,"click",e[1]),n=!0)},p(e,[n]){s!==(s=o(e))&&(i.d(1),i=s(e),i&&(i.c(),i.m(t,null)))},i:I,o:I,d(e){e&&oe(t),i.d(),n=!1,r()}}}const dt="themePreference";function ft(e,t,n){let r=!1;function o(e){n(0,r=e),document.documentElement.classList.toggle("dark",r)}var s;return s=()=>{const e=window.localStorage.getItem(dt);("dark"===e||null==e&&window.matchMedia("(prefers-color-scheme: dark)").matches)&&o(!0)},je().$$.on_mount.push(s),[r,function(){o(!r),window.localStorage.setItem(dt,r?"dark":"light")}]}class mt extends lt{constructor(e){super(),it(this,e,ft,ut,B,{})}}class gt extends lt{constructor(e){super(),it(this,e,null,null,B,{})}}function pt(){}Promise.resolve();const ht=[];function yt(e,t){return Object.assign(Object.assign({},t),{type:e})}const vt="gameid",wt="login",xt="new_game",bt="start_game",$t="next_server",_t="roll_die",kt="leave",Ct=f(((e,t)=>Object.assign(Object.assign({},e),{me:{name:t.name,agent:e.me.agent,host:e.me.host}}))),Ot=f((e=>Object.assign(Object.assign({},e),{me:{name:e.me.name,agent:e.me.agent,host:!0}}))),jt=f(((e,t)=>Object.assign(Object.assign({},e),{cid:t.cid}))),Lt=f(((e,t)=>Object.assign(Object.assign({},e),{gameId:t.gameId||t.data||""}))),zt=f(((e,t)=>Object.assign(Object.assign({},e),{observers:"obs"!==t.role||e.observers.includes(t.name)?e.observers:[...e.observers,t.name],players:"agent"!==t.role||e.players.includes(t.name)?e.players:[...e.players,t.name]}))),Et=f(((e,t)=>Object.assign(Object.assign({},e),{observers:e.observers.filter((e=>e!==t.name)),players:e.players.filter((e=>e!==t.name))}))),Mt=f(((e,t)=>Object.assign(Object.assign({},e),{me:{name:e.me.name,agent:e.me.agent,host:t.host}}))),Tt=f(((e,t)=>Object.assign(Object.assign({},e),{me:{name:e.me.name,agent:t.you||"",host:e.me.host},players:t.order,agents:t.agents.map((e=>({name:e,files:0}))),farm:[{name:"A",agents:t.agents}].concat(e.farm.slice(1))}))),St=f(((e,t)=>{const n=[...e.farm],r=n.findIndex((e=>e.name===t.from)),o=n.findIndex((e=>e.name===t.to));return n[r]=Object.assign(Object.assign({},n[r]),{agents:n[r].agents.filter((e=>e!==t.agent))}),n[o]=Object.assign(Object.assign({},n[o]),{agents:[...n[o].agents,t.agent]}),Object.assign(Object.assign({},e),{farm:n,moves:t.moves})})),It=f(((e,t)=>Object.assign(Object.assign({},e),{moves:t.value}))),Pt=f(((e,t)=>Object.assign(Object.assign({},e),{turn:t.name,moves:null}))),Nt=f(((e,t)=>Object.assign(Object.assign({},e),{trigger:t.trigger,agents:t.files.map((e=>({name:e.agent,files:e.total})))}))),Dt=f(((e,t)=>Object.assign(Object.assign({},e),{gameOver:t})));
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0

  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.

  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
var At=function(e,t){return(At=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function Rt(e,t){function n(){this.constructor=e}At(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Ht(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}function Bt(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Ht(arguments[t]));return e}var qt=function(e,t){this.target=t,this.type=e},Vt=function(e){function t(t,n){var r=e.call(this,"error",n)||this;return r.message=t.message,r.error=t,r}return Rt(t,e),t}(qt),Wt=function(e){function t(t,n,r){void 0===t&&(t=1e3),void 0===n&&(n="");var o=e.call(this,"close",r)||this;return o.wasClean=!0,o.code=t,o.reason=n,o}return Rt(t,e),t}(qt),Ft=function(){if("undefined"!=typeof WebSocket)return WebSocket},Gt={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+4e3*Math.random(),minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},Ut=function(){function e(e,t,n){var r=this;void 0===n&&(n={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(e){r._debug("open event");var t=r._options.minUptime,n=void 0===t?Gt.minUptime:t;clearTimeout(r._connectTimeout),r._uptimeTimeout=setTimeout((function(){return r._acceptOpen()}),n),r._ws.binaryType=r._binaryType,r._messageQueue.forEach((function(e){return r._ws.send(e)})),r._messageQueue=[],r.onopen&&r.onopen(e),r._listeners.open.forEach((function(t){return r._callEventListener(e,t)}))},this._handleMessage=function(e){r._debug("message event"),r.onmessage&&r.onmessage(e),r._listeners.message.forEach((function(t){return r._callEventListener(e,t)}))},this._handleError=function(e){r._debug("error event",e.message),r._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),r.onerror&&r.onerror(e),r._debug("exec error listeners"),r._listeners.error.forEach((function(t){return r._callEventListener(e,t)})),r._connect()},this._handleClose=function(e){r._debug("close event"),r._clearTimeouts(),r._shouldReconnect&&r._connect(),r.onclose&&r.onclose(e),r._listeners.close.forEach((function(t){return r._callEventListener(e,t)}))},this._url=e,this._protocols=t,this._options=n,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){return this._messageQueue.reduce((function(e,t){return"string"==typeof t?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e}),0)+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(e,t){void 0===e&&(e=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),this._ws?this._ws.readyState!==this.CLOSED?this._ws.close(e,t):this._debug("close: already closed"):this._debug("close enqueued: no ws instance")},e.prototype.reconnect=function(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED?(this._disconnect(e,t),this._connect()):this._connect()},e.prototype.send=function(e){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",e),this._ws.send(e);else{var t=this._options.maxEnqueuedMessages,n=void 0===t?Gt.maxEnqueuedMessages:t;this._messageQueue.length<n&&(this._debug("enqueue",e),this._messageQueue.push(e))}},e.prototype.addEventListener=function(e,t){this._listeners[e]&&this._listeners[e].push(t)},e.prototype.dispatchEvent=function(e){var t,n,r=this._listeners[e.type];if(r)try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(r),s=o.next();!s.done;s=o.next()){var i=s.value;this._callEventListener(e,i)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return!0},e.prototype.removeEventListener=function(e,t){this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter((function(e){return e!==t})))},e.prototype._debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._options.debug&&console.log.apply(console,Bt(["RWS>"],e))},e.prototype._getNextDelay=function(){var e=this._options,t=e.reconnectionDelayGrowFactor,n=void 0===t?Gt.reconnectionDelayGrowFactor:t,r=e.minReconnectionDelay,o=void 0===r?Gt.minReconnectionDelay:r,s=e.maxReconnectionDelay,i=void 0===s?Gt.maxReconnectionDelay:s,l=0;return this._retryCount>0&&(l=o*Math.pow(n,this._retryCount-1))>i&&(l=i),this._debug("next delay",l),l},e.prototype._wait=function(){var e=this;return new Promise((function(t){setTimeout(t,e._getNextDelay())}))},e.prototype._getNextUrl=function(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){var t=e();if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")},e.prototype._connect=function(){var e=this;if(!this._connectLock&&this._shouldReconnect){this._connectLock=!0;var t=this._options,n=t.maxRetries,r=void 0===n?Gt.maxRetries:n,o=t.connectionTimeout,s=void 0===o?Gt.connectionTimeout:o,i=t.WebSocket,l=void 0===i?Ft():i;if(this._retryCount>=r)this._debug("max retries reached",this._retryCount,">=",r);else{if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),void 0===(a=l)||!a||2!==a.CLOSING)throw Error("No valid WebSocket class provided");var a;this._wait().then((function(){return e._getNextUrl(e._url)})).then((function(t){e._closeCalled||(e._debug("connect",{url:t,protocols:e._protocols}),e._ws=e._protocols?new l(t,e._protocols):new l(t),e._ws.binaryType=e._binaryType,e._connectLock=!1,e._addListeners(),e._connectTimeout=setTimeout((function(){return e._handleTimeout()}),s))}))}}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new Vt(Error("TIMEOUT"),this))},e.prototype._disconnect=function(e,t){if(void 0===e&&(e=1e3),this._clearTimeouts(),this._ws){this._removeListeners();try{this._ws.close(e,t),this._handleClose(new Wt(e,t,this))}catch(e){}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(e,t){"handleEvent"in t?t.handleEvent(e):t(e)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}();const Jt=[];const Zt=function(e,t=I){let n;const r=new Set;function o(t){if(B(e,t)&&(e=t,n)){const t=!Jt.length;for(const t of r)t[1](),Jt.push(t,e);if(t){for(let e=0;e<Jt.length;e+=2)Jt[e][0](Jt[e+1]);Jt.length=0}}}return{set:o,update:function(t){o(t(e))},subscribe:function(s,i=I){const l=[s,i];return r.add(l),1===r.size&&(n=t(o)||I),s(e),()=>{r.delete(l),0===r.size&&(n(),n=null)}}}}([]);function Qt(e){const t="string"==typeof e?{title:e}:e;Zt.update((e=>[...e,t]))}function Yt(e){Zt.update((t=>t.filter((t=>t!==e))))}const Kt="https://secret-agent-api.colinbate.workers.dev/";let Xt;const en=new Promise((e=>Xt=e));let tn;const nn=new Ut((async function(){return`wss://secret-agent-api.colinbate.workers.dev//game/${await en}/ws`}));function rn(e,t){const n=JSON.stringify(Object.assign(Object.assign({},t),{action:e}));nn.send(n)}async function on(e,t){const n=await fetch(e,{method:"POST",body:JSON.stringify(t)});return 200===n.status?await n.json():""}nn.addEventListener("open",(e=>{console.log("WebSocket OPEN",e)})),nn.addEventListener("message",(e=>{if(tn){const t=JSON.parse(e.data);switch(t.type){case"error":Qt({title:"Error",desc:t.msg});break;default:tn(t)}console.log("WebSocket MSG",t)}}));const sn={alpha:"crimson",beta:"darkorange",gamma:"gold",delta:"seagreen",epsilon:"dodgerblue",zeta:"darkviolet",eta:"saddlebrown"};function ln(e){return function(e){return e in sn}(e)?sn[e]:"black"}function an(e,t){console.log("EVENT",t,"CTX",e)}const cn=function(e,t){var n=function(e,t=pt){let n;const r=[];function o(t){if(s=t,((o=e)!=o?s==s:o!==s||o&&"object"==typeof o||"function"==typeof o)&&(e=t,n)){const t=!ht.length;for(let t=0;t<r.length;t+=1){const n=r[t];n[1](),ht.push(n,e)}if(t){for(let e=0;e<ht.length;e+=2)ht[e][0](ht[e+1]);ht.length=0}}var o,s}return{set:o,update:function(t){o(t(e))},subscribe:function(s,i=pt){const l=[s,i];return r.push(l),1===r.length&&(n=t(o)||pt),s(e),()=>{const e=r.indexOf(l);-1!==e&&r.splice(e,1),0===r.length&&(n(),n=null)}}}}(M(e,(function(e){return o(e)}),t)),r=n.subscribe,o=n.set;return{subscribe:r}}(function(t,r,s=o){return"string"!=typeof t&&(s=r||o,r=t,t=Object.keys(r)[0]),n._create&&n._create(t,r),a(L,{context:e(s),current:e(t),states:e(r)})}({init:k(x("cid","init",jt),x(vt,"create",p(((e,t)=>!t.gameId)),m(an)),x(vt,"welcome",Lt,m(an))),create:k(x(xt,"creating",m(an))),creating:j((async function(e){const t=`${Kt}create`,n=e.cid,{gameId:r}=await on(t,{host:n});return r}),x("done","welcome",Lt,Ot,m((function(e){const t=`/g/${e.gameId}`;window.history.pushState(null,"",t)})),m(an))),welcome:k(x(wt,"waiting",Ct,m((function(e,t){const{cid:n}=e,{name:r,role:o}=t;rn("join",{cid:n,name:r,role:o})})))),waiting:k(x("joined","waiting",zt),x("welcome","waiting",Mt),x(kt,"waiting",Et),x(bt,"waiting",m((async function(e){const{gameId:t,cid:n}=e,r=`${Kt}game/${t}/start`;return await on(r,{cid:n})}))),x("start","playing",Tt,m((function(e,t){Qt({title:"Welcome",desc:`Agent ${e.me.name}, you will using the laptop corresponding to the color of this\n     token. Don't let the others know which color you are. On your turn move anyone's laptop by clicking it.`,icon:{type:"agent",color:t.you?ln(t.you):""}})})))),playing:k(x($t,"playing",m((function(e,t){const{cid:n,farm:r}=e,{agent:o,current:s}=t;rn("move",{cid:n,agent:o,to:r[(s+1)%r.length].name})}))),x(kt,"playing",Et),x("move","playing",St),x("roll","playing",It),x(_t,"playing",m((async function(e){const{gameId:t,cid:n}=e,r=`${Kt}game/${t}/roll`;return await on(r,{cid:n})}))),x("turn","playing",Pt,m((function(e,t){if(e.me.name!==t.name){const e={title:"New turn",desc:`It is now Agent ${t.name}'s turn.`,icon:{type:"agent"}};Qt(e),setTimeout((()=>{Yt(e)}),5e3)}}))),x("virus","playing",m((function(e,t){Qt({title:"Virus Detected!",desc:`A virus has been detected on server ${t.server}.`,icon:{type:"virus"}})}))),x("files","playing",Nt,m((function(e,t){const n={title:"Files Received!",desc:`A file dump was triggered, new trigger set to server ${t.trigger}.`,icon:{type:"usb"}};Qt(n),setTimeout((()=>{Yt(n)}),1e4)}))),x("winners","gameover",Dt)),gameover:k()},(()=>({cid:"",gameId:"",me:{name:"",agent:"",host:!1},players:[],observers:[],turn:null,moves:null,trigger:"G",farm:[{name:"A",agents:["crimson","seagreen","darkorange","dodgerblue","darkviolet","gold","saddlebrown"]},{name:"B",agents:[]},{name:"C",agents:[]},{name:"D",agents:[]},{name:"E",agents:[]},{name:"F",agents:[]},{name:"G",agents:[]},{name:"H",agents:[]},{name:"I",agents:[]},{name:"J",agents:[]}],agents:[],gameOver:{winners:[],roster:[]}}))),{});function un(e){let t,n,r,o,s,i;const l=e[1].default,a=V(l,e,e[0],null),c=a||function(e){let t;return{c(){t=ae("Secret Agent")},m(e,n){re(e,t,n)},d(e){e&&oe(t)}}}();return{c(){t=ie("h1"),n=le("svg"),r=le("path"),o=ce(),s=ie("span"),c&&c.c(),fe(r,"fill","currentColor"),fe(r,"d","M383.9 308.3l23.9-62.6c4-10.5-3.7-21.7-15-21.7h-58.5c11-18.9 17.8-40.6 17.8-64v-.3c39.2-7.8 64-19.1 64-31.7 0-13.3-27.3-25.1-70.1-33-9.2-32.8-27-65.8-40.6-82.8-9.5-11.9-25.9-15.6-39.5-8.8l-27.6 13.8c-9 4.5-19.6 4.5-28.6 0L182.1 3.4c-13.6-6.8-30-3.1-39.5 8.8-13.5 17-31.4 50-40.6 82.8-42.7 7.9-70 19.7-70 33 0 12.6 24.8 23.9 64 31.7v.3c0 23.4 6.8 45.1 17.8 64H56.3c-11.5 0-19.2 11.7-14.7 22.3l25.8 60.2C27.3 329.8 0 372.7 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-48.4-25.8-90.4-64.1-114.1zM176 480l-41.6-192 49.6 32 24 40-32 120zm96 0l-32-120 24-40 49.6-32L272 480zm41.7-298.5c-3.9 11.9-7 24.6-16.5 33.4-10.1 9.3-48 22.4-64-25-2.8-8.4-15.4-8.4-18.3 0-17 50.2-56 32.4-64 25-9.5-8.8-12.7-21.5-16.5-33.4-.8-2.5-6.3-5.7-6.3-5.8v-10.8c28.3 3.6 61 5.8 96 5.8s67.7-2.1 96-5.8v10.8c-.1.1-5.6 3.2-6.4 5.8z"),fe(n,"aria-hidden","true"),fe(n,"focusable","false"),fe(n,"data-prefix","fas"),fe(n,"data-icon","user-secret"),fe(n,"class","inline-block w-8 lg:w-14 fa-user-secret fa-w-14"),fe(n,"role","img"),fe(n,"xmlns","http://www.w3.org/2000/svg"),fe(n,"viewBox","0 0 448 512"),fe(s,"class","px-4"),fe(t,"class","uppercase text-4xl lg:text-6xl leading-none font-light text-svelte flex items-center justify-center py-6")},m(e,l){re(e,t,l),ee(t,n),ee(n,r),ee(t,o),ee(t,s),c&&c.m(s,null),i=!0},p(e,[t]){a&&a.p&&(!i||1&t)&&G(a,l,e,e[0],i?F(l,e[0],t,null):U(e[0]),null)},i(e){i||(Je(c,e),i=!0)},o(e){Ze(c,e),i=!1},d(e){e&&oe(t),c&&c.d(e)}}}function dn(e,t,n){let{$$slots:r={},$$scope:o}=t;return e.$$set=e=>{"$$scope"in e&&n(0,o=e.$$scope)},[o,r]}cn.subscribe((e=>{tn=e.send,e.context.gameId&&Xt(e.context.gameId)}));class fn extends lt{constructor(e){super(),it(this,e,dn,un,B,{})}}function mn(e){let t;return{c(){t=ie("footer"),t.innerHTML='<span>Made with</span> \n  <span title="love" class="mx-0.5 relative -top-px"><span class="sr-only">love</span><svg aria-hidden="false" aria-label="love" title="love" focusable="false" data-prefix="fas" data-icon="heart" class="inline w-5 mx-1" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"></path></svg></span> \n  <span>and</span> \n  <span title="COVID" class="mx-0.5 relative -top-px"><span class="sr-only">COVID</span><svg aria-hidden="false" aria-label="COVID" title="COVID" focusable="false" data-prefix="fas" data-icon="virus" class="inline w-5 mx-1" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M483.55,227.55H462c-50.68,0-76.07-61.27-40.23-97.11L437,115.19A28.44,28.44,0,0,0,396.8,75L381.56,90.22c-35.84,35.83-97.11,10.45-97.11-40.23V28.44a28.45,28.45,0,0,0-56.9,0V50c0,50.68-61.27,76.06-97.11,40.23L115.2,75A28.44,28.44,0,0,0,75,115.19l15.25,15.25c35.84,35.84,10.45,97.11-40.23,97.11H28.45a28.45,28.45,0,1,0,0,56.89H50c50.68,0,76.07,61.28,40.23,97.12L75,396.8A28.45,28.45,0,0,0,115.2,437l15.24-15.25c35.84-35.84,97.11-10.45,97.11,40.23v21.54a28.45,28.45,0,0,0,56.9,0V462c0-50.68,61.27-76.07,97.11-40.23L396.8,437A28.45,28.45,0,0,0,437,396.8l-15.25-15.24c-35.84-35.84-10.45-97.12,40.23-97.12h21.54a28.45,28.45,0,1,0,0-56.89ZM224,272a48,48,0,1,1,48-48A48,48,0,0,1,224,272Zm80,56a24,24,0,1,1,24-24A24,24,0,0,1,304,328Z"></path></svg></span> \n  <span>in Bermuda.</span>',fe(t,"class","flex items-center justify-center border-gray-300 dark:border-gray-600 border-t p-5 casual mt-5 text-gray-500 dark:text-gray-300")},m(e,n){re(e,t,n)},p:I,i:I,o:I,d(e){e&&oe(t)}}}class gn extends lt{constructor(e){super(),it(this,e,null,mn,B,{})}}function pn(e){let t;return{c(){t=ie("span"),t.innerHTML='<span>Secret Agent</span> \n      <span class="ml-3 inline-flex items-center px-3 py-0.5 rounded-full text-sm font-medium bg-green-100 text-green-800">Beta</span>',fe(t,"class","inline-flex items-start")},m(e,n){re(e,t,n)},d(e){e&&oe(t)}}}function hn(e){let t,n,r,o,s,i,l,a,c,u,d,f,m,g,p,h,y,v,w,x,b,$,_;return n=new fn({props:{$$slots:{default:[pn]},$$scope:{ctx:e}}}),x=new gn({}),{c(){t=ie("article"),rt(n.$$.fragment),r=ce(),o=ie("div"),s=ie("div"),i=ie("p"),i.textContent="Welcome to Secret Agent. This is a turn-based, multiplayer, online game for 2-7 players.\n        You can create a new game below and send the link to your\n        friends.",l=ce(),a=ie("p"),a.innerHTML='If you were expecting to join someone else&#39;s game, then make sure\n        you were given a link that ends in\n        <code class="font-mono">/g/&lt;64 digits and letters&gt;</code>',c=ce(),u=ie("p"),u.textContent="You play as a secret agent sent to determine which files have\n        been leaked to the dark web. You and fellow agents compete to\n        recover copies of all 100 files.",d=ce(),f=ie("p"),f.textContent="On your turn you can switch to different servers, and also reroute\n        fellow agents to other servers as well. If you trigger the script on\n        the correct server, everyone receives a cache of files. Can you find\n        all the files first?",m=ce(),g=ie("button"),g.textContent="Create Game",p=ce(),h=ie("p"),h.textContent="There are no communication mechanisms within the game. It is possible to\n        play like that, but you may find it more fun if you have an external chat\n        happening.",y=ce(),v=ie("div"),v.innerHTML='<div class="bg-white dark:bg-gray-900 overflow-hidden shadow dark:shadow-lg sm:rounded-lg sm:ml-6"><div class="bg-white dark:bg-gray-900 px-4 py-5 border-b border-gray-200 dark:border-gray-700 sm:px-6"><h2 class="text-lg leading-6 font-medium text-gray-900 dark:text-white">Known Issues</h2></div> \n        <div class=""><ul class=""><li class="px-4 py-5 sm:p-6">The number of files per server will be randomized soon.</li> \n            <li class="px-4 py-5 sm:p-6 bg-gray-50 dark:bg-black">The game doesn&#39;t handle reloading the page mid-game.</li> \n            <li class="px-4 py-5 sm:p-6">Likewise, network disconnections will probably break things.</li></ul></div></div>',w=ce(),rt(x.$$.fragment),fe(i,"class","mt-6 mb-4"),fe(a,"class","my-4"),fe(u,"class","my-4 border-t border-gray-500 pt-4"),fe(f,"class","my-4"),fe(g,"type","button"),fe(g,"class","mt-3 w-full inline-flex items-center justify-center px-4 py-2 border border-transparent shadow-sm font-medium rounded-md text-white bg-svelte-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500 sm:mt-4 sm:w-auto sm:text-sm"),fe(h,"class","my-4 rounded-lg p-4 bg-white dark:bg-gray-900"),fe(s,"class","col-span-2"),fe(v,"class","my-6 sm:col-span-1"),fe(o,"class","sm:grid sm:grid-cols-3 sm:gap-6"),fe(t,"class","max-w-7xl mx-auto px-2 sm:px-6 lg:px-8")},m(k,C){re(k,t,C),ot(n,t,null),ee(t,r),ee(t,o),ee(o,s),ee(s,i),ee(s,l),ee(s,a),ee(s,c),ee(s,u),ee(s,d),ee(s,f),ee(s,m),ee(s,g),ee(s,p),ee(s,h),ee(o,y),ee(o,v),ee(t,w),ot(x,t,null),b=!0,$||(_=de(g,"click",e[0]),$=!0)},p(e,[t]){const r={};4&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){b||(Je(n.$$.fragment,e),Je(x.$$.fragment,e),b=!0)},o(e){Ze(n.$$.fragment,e),Ze(x.$$.fragment,e),b=!1},d(e){e&&oe(t),st(n),st(x),$=!1,_()}}}function yn(e,t,n){let r;return q(e,cn,(e=>n(1,r=e))),[async function(){r.send(yt(xt,{}))}]}class vn extends lt{constructor(e){super(),it(this,e,yn,hn,B,{})}}function wn(e){let t,n,r,o,s,i,l,a,c,u,d,f,m,g,p,h,y,v,w,x,b;return{c(){t=ie("div"),n=ie("div"),r=ie("h3"),r.textContent="Login to the dark web",o=ce(),s=ie("div"),s.innerHTML="<p>Enter your name as you want to be known on the dark web servers.</p>",i=ce(),l=ie("form"),a=ie("div"),c=ie("label"),c.textContent="Agent name",u=ce(),d=ie("input"),f=ce(),m=ie("div"),g=ie("div"),p=ie("input"),h=ce(),y=ie("div"),y.innerHTML='<label for="candidates" class="font-medium text-gray-700 dark:text-gray-400">Observer</label> \n          <p class="text-gray-600 dark:text-gray-400">Login as an overseer who won&#39;t be collecting files.</p>',v=ce(),w=ie("button"),w.textContent="Enter",fe(r,"class","text-lg leading-6 font-medium text-gray-900 dark:text-white"),fe(s,"class","mt-2 max-w-xl text-sm text-gray-600 dark:text-gray-400"),fe(c,"for","agentname"),fe(c,"class","sr-only"),fe(d,"type","text"),fe(d,"name","agentname"),fe(d,"id","agentname"),fe(d,"class","shadow-sm font-mono focus:ring-svelte focus:border-svelte block w-full sm:text-sm border-gray-700 dark:border-gray-300 rounded-md dark:bg-gray-900"),fe(d,"placeholder","Zero Cool"),fe(a,"class","w-full sm:max-w-xs"),fe(p,"id","observer"),fe(p,"name","observer"),fe(p,"type","checkbox"),fe(p,"class","focus:ring-svelte h-4 w-4 text-svelte border-gray-700 rounded dark:border-gray-300 dark:bg-black"),fe(g,"class","flex items-center h-5"),fe(y,"class","ml-3 text-sm"),fe(m,"class","relative flex items-start mt-3"),fe(w,"type","submit"),fe(w,"class","mt-3 w-full inline-flex items-center justify-center px-4 py-2 border border-transparent shadow-sm font-medium rounded-md text-white bg-svelte-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500 sm:w-auto sm:text-sm"),fe(l,"class","mt-5 sm:flex sm:flex-col sm:items-start"),fe(n,"class","px-4 py-5 sm:p-6"),fe(t,"class","bg-white shadow rounded sm:rounded-lg dark:bg-gray-900 dark:shadow-lg")},m($,_){var k;re($,t,_),ee(t,n),ee(n,r),ee(n,o),ee(n,s),ee(n,i),ee(n,l),ee(l,a),ee(a,c),ee(a,u),ee(a,d),ge(d,e[0]),ee(l,f),ee(l,m),ee(m,g),ee(g,p),p.checked=e[1],ee(m,h),ee(m,y),ee(l,v),ee(l,w),x||(b=[de(d,"input",e[3]),de(p,"change",e[4]),de(l,"submit",(k=e[2],function(e){return e.preventDefault(),k.call(this,e)}))],x=!0)},p(e,[t]){1&t&&d.value!==e[0]&&ge(d,e[0]),2&t&&(p.checked=e[1])},i:I,o:I,d(e){e&&oe(t),x=!1,R(b)}}}function xn(e,t,n){let r;q(e,cn,(e=>n(5,r=e)));let{name:o=""}=t,s=!1;return e.$$set=e=>{"name"in e&&n(0,o=e.name)},[o,s,async function(){r.send(yt(wt,{name:o,role:s?"obs":"agent"})),n(0,o="")},function(){o=this.value,n(0,o)},function(){s=this.checked,n(1,s)}]}class bn extends lt{constructor(e){super(),it(this,e,xn,wn,B,{name:0})}}function $n(e,t,n){const r=e.slice();return r[5]=t[n],r}function _n(e,t,n){const r=e.slice();return r[8]=t[n],r}function kn(e){let t;return{c(){t=ie("li"),t.textContent="No agents yet",fe(t,"class","col-span-1 text-gray-400 italic")},m(e,n){re(e,t,n)},d(e){e&&oe(t)}}}function Cn(e){let t,n,r,o,s,i,l,a,c=e[8]+"";return{c(){t=ie("li"),n=ie("div"),n.innerHTML='<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-secret" class="inline-block w-10" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M383.9 308.3l23.9-62.6c4-10.5-3.7-21.7-15-21.7h-58.5c11-18.9 17.8-40.6 17.8-64v-.3c39.2-7.8 64-19.1 64-31.7 0-13.3-27.3-25.1-70.1-33-9.2-32.8-27-65.8-40.6-82.8-9.5-11.9-25.9-15.6-39.5-8.8l-27.6 13.8c-9 4.5-19.6 4.5-28.6 0L182.1 3.4c-13.6-6.8-30-3.1-39.5 8.8-13.5 17-31.4 50-40.6 82.8-42.7 7.9-70 19.7-70 33 0 12.6 24.8 23.9 64 31.7v.3c0 23.4 6.8 45.1 17.8 64H56.3c-11.5 0-19.2 11.7-14.7 22.3l25.8 60.2C27.3 329.8 0 372.7 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-48.4-25.8-90.4-64.1-114.1zM176 480l-41.6-192 49.6 32 24 40-32 120zm96 0l-32-120 24-40 49.6-32L272 480zm41.7-298.5c-3.9 11.9-7 24.6-16.5 33.4-10.1 9.3-48 22.4-64-25-2.8-8.4-15.4-8.4-18.3 0-17 50.2-56 32.4-64 25-9.5-8.8-12.7-21.5-16.5-33.4-.8-2.5-6.3-5.7-6.3-5.8v-10.8c28.3 3.6 61 5.8 96 5.8s67.7-2.1 96-5.8v10.8c-.1.1-5.6 3.2-6.4 5.8z"></path></svg>',r=ce(),o=ie("div"),s=ie("div"),i=ie("span"),l=ae(c),a=ce(),fe(n,"class","flex-shrink-0 flex items-center justify-center w-16 h-14 bg-gray-600 text-white text-sm font-medium rounded-l-md"),fe(i,"class","text-gray-900 dark:text-white font-medium"),fe(s,"class","flex-1 px-4 py-2 text-md truncate"),fe(o,"class","flex-1 flex items-center justify-between border-t border-r border-b border-gray-200 bg-white dark:bg-gray-900 dark:border-gray-700 rounded-r-md truncate"),fe(t,"class","col-span-1 flex shadow-sm rounded-md")},m(e,c){re(e,t,c),ee(t,n),ee(t,r),ee(t,o),ee(o,s),ee(s,i),ee(i,l),ee(t,a)},p(e,t){2&t&&c!==(c=e[8]+"")&&me(l,c)},d(e){e&&oe(t)}}}function On(e){let t,n,r,o,s=e[0],i=[];for(let t=0;t<s.length;t+=1)i[t]=jn($n(e,s,t));return{c(){t=ie("div"),n=ie("h2"),n.textContent="Observers",r=ce(),o=ie("ul");for(let e=0;e<i.length;e+=1)i[e].c();fe(n,"class","text-gray-500 text-lg font-medium uppercase tracking-wide"),fe(o,"class","mt-3 grid grid-cols-1 gap-5 sm:gap-6 sm:grid-cols-2 lg:grid-cols-5"),fe(t,"class","mt-8")},m(e,s){re(e,t,s),ee(t,n),ee(t,r),ee(t,o);for(let e=0;e<i.length;e+=1)i[e].m(o,null)},p(e,t){if(1&t){let n;for(s=e[0],n=0;n<s.length;n+=1){const r=$n(e,s,n);i[n]?i[n].p(r,t):(i[n]=jn(r),i[n].c(),i[n].m(o,null))}for(;n<i.length;n+=1)i[n].d(1);i.length=s.length}},d(e){e&&oe(t),se(i,e)}}}function jn(e){let t,n,r,o,s,i,l,a,c=e[5]+"";return{c(){t=ie("li"),n=ie("div"),n.innerHTML='<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="eye" class="inline-block w-10" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"></path></svg>',r=ce(),o=ie("div"),s=ie("div"),i=ie("span"),l=ae(c),a=ce(),fe(n,"class","flex-shrink-0 flex items-center justify-center w-16 h-14 bg-gray-600 text-white text-sm font-medium rounded-l-md"),fe(i,"class","text-gray-900 dark:text-white font-medium"),fe(s,"class","flex-1 px-4 py-2 text-md truncate"),fe(o,"class","flex-1 flex items-center justify-between border-t border-r border-b border-gray-200 bg-white dark:bg-gray-900 dark:border-gray-700 rounded-r-md truncate"),fe(t,"class","col-span-1 flex shadow-sm rounded-md")},m(e,c){re(e,t,c),ee(t,n),ee(t,r),ee(t,o),ee(o,s),ee(s,i),ee(i,l),ee(t,a)},p(e,t){1&t&&c!==(c=e[5]+"")&&me(l,c)},d(e){e&&oe(t)}}}function Ln(e){let t;return{c(){t=ie("div"),t.textContent="Waiting on at least two agents.",fe(t,"class","bg-gray-200 dark:bg-gray-700 mt-8 p-2")},m(e,n){re(e,t,n)},p:I,d(e){e&&oe(t)}}}function zn(e){let t,n,r;return{c(){t=ie("button"),t.textContent="Start",fe(t,"type","button"),fe(t,"class","bg-svelte-dark text-white mt-8 px-4 py-2 border border-transparent shadow-sm font-medium rounded-md")},m(o,s){re(o,t,s),n||(r=de(t,"click",e[3]),n=!0)},p:I,d(e){e&&oe(t),n=!1,r()}}}function En(e){let t,n,r,o,s,i,l,a=e[1],c=[];for(let t=0;t<a.length;t+=1)c[t]=Cn(_n(e,a,t));let u=null;a.length||(u=kn());let d=e[0].length&&On(e);function f(e,t){return e[2].host&&e[1].length>1?zn:e[2].host&&e[1].length<=1?Ln:void 0}let m=f(e),g=m&&m(e);return{c(){t=ie("div"),n=ie("div"),r=ie("h2"),r.textContent="Agents",o=ce(),s=ie("ul");for(let e=0;e<c.length;e+=1)c[e].c();u&&u.c(),i=ce(),d&&d.c(),l=ce(),g&&g.c(),fe(r,"class","text-gray-500 text-lg font-medium uppercase tracking-wide"),fe(s,"class","mt-3 grid grid-cols-1 gap-5 sm:gap-6 sm:grid-cols-2 lg:grid-cols-5"),fe(n,"class","mt-4"),fe(t,"class","")},m(e,a){re(e,t,a),ee(t,n),ee(n,r),ee(n,o),ee(n,s);for(let e=0;e<c.length;e+=1)c[e].m(s,null);u&&u.m(s,null),ee(t,i),d&&d.m(t,null),ee(t,l),g&&g.m(t,null)},p(e,[n]){if(2&n){let t;for(a=e[1],t=0;t<a.length;t+=1){const r=_n(e,a,t);c[t]?c[t].p(r,n):(c[t]=Cn(r),c[t].c(),c[t].m(s,null))}for(;t<c.length;t+=1)c[t].d(1);c.length=a.length,a.length?u&&(u.d(1),u=null):u||(u=kn(),u.c(),u.m(s,null))}e[0].length?d?d.p(e,n):(d=On(e),d.c(),d.m(t,l)):d&&(d.d(1),d=null),m===(m=f(e))&&g?g.p(e,n):(g&&g.d(1),g=m&&m(e),g&&(g.c(),g.m(t,null)))},i:I,o:I,d(e){e&&oe(t),se(c,e),u&&u.d(),d&&d.d(),g&&g.d()}}}function Mn(e,t,n){let r,o,s,i;return q(e,cn,(e=>n(4,i=e))),e.$$.update=()=>{16&e.$$.dirty&&n(2,r=i.context.me),16&e.$$.dirty&&n(1,o=i.context.players),16&e.$$.dirty&&n(0,s=i.context.observers)},[s,o,r,function(){i.send(yt(bt,{}))},i]}class Tn extends lt{constructor(e){super(),it(this,e,Mn,En,B,{})}}function Sn(e){let t,n;return t=new Tn({}),{c(){rt(t.$$.fragment)},m(e,r){ot(t,e,r),n=!0},p:I,i(e){n||(Je(t.$$.fragment,e),n=!0)},o(e){Ze(t.$$.fragment,e),n=!1},d(e){st(t,e)}}}function In(e){let t,n,r;function o(t){e[5](t)}let s={};return void 0!==e[0]&&(s.name=e[0]),t=new bn({props:s}),Ee.push((()=>function(e,t,n){const r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}(t,"name",o))),{c(){rt(t.$$.fragment)},m(e,n){ot(t,e,n),r=!0},p(e,r){const o={};var s;!n&&1&r&&(n=!0,o.name=e[0],s=()=>n=!1,Te.push(s)),t.$set(o)},i(e){r||(Je(t.$$.fragment,e),r=!0)},o(e){Ze(t.$$.fragment,e),r=!1},d(e){st(t,e)}}}function Pn(e){let t,n,r,o,s,i,l,a,c,u,d,f,m,g,p,h,y,v,w,x,b,$,_,k,C,O,j,L,z,E,M,T,S;n=new fn({});const I=[In,Sn],P=[];function N(e,t){return"welcome"===e[1]?0:1}return z=N(e),E=P[z]=I[z](e),T=new gn({}),{c(){t=ie("article"),rt(n.$$.fragment),r=ce(),o=ie("div"),s=ie("p"),i=ae("Welcome Agent "),l=ae(e[0]),a=ae("\n      please help us save the world. If you know of any\n      other agents who may be able to help, send them to:\n      "),c=ie("a"),u=ae(e[3]),d=ce(),f=ie("a"),m=ae("The current page."),g=ce(),p=ie("p"),p.textContent="We have learned that a cache of top secret files\n      has been leaked onto the dark web.",h=ce(),y=ie("p"),y.textContent="We don't know how many, if any, are our files.\n      We need to find out exactly which files were leaked\n      so we can mitigate the damage if they were to fall\n      into the wrong hands.",v=ce(),w=ie("p"),w.textContent="We've learned that there are ten dark web servers\n      providing the files. Each server is providing a different number\n      of files. It isn't known how many each has at the moment.",x=ce(),b=ie("p"),b.textContent="What is known, is that someone has created a trigger script that\n      will run when accessing one of these servers. That script causes\n      any available files to be sent from all of the servers to\n      anyone connected.",$=ce(),_=ie("p"),_.textContent="Following that, the trigger sends itself to another server and\n      deletes itself locally. Thankfully we are able to detect and track the\n      location of this trigger script for you.",k=ce(),C=ie("p"),C.textContent="Your job is to collect 100 files first. You must use your skills\n      to move from server to server in search of files while also\n      disconnecting other agents, forcing them onto servers\n      with fewer files.",O=ce(),j=ie("p"),j.textContent="Find all 100 files from the dark web servers before the other agents do.",L=ce(),E.c(),M=ce(),rt(T.$$.fragment),fe(c,"class","hidden sm:block font-mono text-svelte-dark dark:text-svelte-light underline"),fe(c,"href",e[2]),fe(f,"class","block sm:hidden text-svelte-dark dark:text-svelte-light underline"),fe(f,"href",e[2]),fe(s,"class","my-4"),fe(p,"class","my-4"),fe(y,"class","my-4"),fe(w,"class","my-4"),fe(b,"class","my-4"),fe(_,"class","my-4"),fe(C,"class","my-4"),fe(j,"class","my-4 font-bold"),fe(o,"class","border-gray-700 text-lg dark:border-gray-200 bg-white dark:bg-black dark:text-gecko px-4 mb-4 font-mono border-2"),fe(t,"class","max-w-7xl mx-auto px-3 py-3 sm:px-6 lg:px-8")},m(e,E){re(e,t,E),ot(n,t,null),ee(t,r),ee(t,o),ee(o,s),ee(s,i),ee(s,l),ee(s,a),ee(s,c),ee(c,u),ee(s,d),ee(s,f),ee(f,m),ee(o,g),ee(o,p),ee(o,h),ee(o,y),ee(o,v),ee(o,w),ee(o,x),ee(o,b),ee(o,$),ee(o,_),ee(o,k),ee(o,C),ee(o,O),ee(o,j),ee(t,L),P[z].m(t,null),ee(t,M),ot(T,t,null),S=!0},p(e,[n]){(!S||1&n)&&me(l,e[0]),(!S||8&n)&&me(u,e[3]),(!S||4&n)&&fe(c,"href",e[2]),(!S||4&n)&&fe(f,"href",e[2]);let r=z;z=N(e),z===r?P[z].p(e,n):(Ge(),Ze(P[r],1,1,(()=>{P[r]=null})),Ue(),E=P[z],E?E.p(e,n):(E=P[z]=I[z](e),E.c()),Je(E,1),E.m(t,M))},i(e){S||(Je(n.$$.fragment,e),Je(E),Je(T.$$.fragment,e),S=!0)},o(e){Ze(n.$$.fragment,e),Ze(E),Ze(T.$$.fragment,e),S=!1},d(e){e&&oe(t),st(n),P[z].d(),st(T)}}}function Nn(e,t,n){let r,o,{gameId:s}=t,{state:i}=t,{name:l=""}=t;return e.$$set=e=>{"gameId"in e&&n(4,s=e.gameId),"state"in e&&n(1,i=e.state),"name"in e&&n(0,l=e.name)},e.$$.update=()=>{16&e.$$.dirty&&n(2,r=`/g/${s}`),4&e.$$.dirty&&n(3,o=`${window.location.origin}${r}`)},[l,i,r,o,s,function(e){l=e,n(0,l)}]}class Dn extends lt{constructor(e){super(),it(this,e,Nn,Pn,B,{gameId:4,state:1,name:0})}}function An(e,t,n){const r=e.slice();return r[8]=t[n],r}function Rn(e,t,n){const r=e.slice();return r[8]=t[n],r}function Hn(e){let t,n;return{c(){t=ie("span"),n=ae(e[2]),fe(t,"class","inline-flex items-center ml-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800")},m(e,r){re(e,t,r),ee(t,n)},p(e,t){4&t&&me(n,e[2])},d(e){e&&oe(t)}}}function Bn(e){let t,n,r=e[8]+"",o=null!=e[2]&&e[8]===e[1]&&Hn(e);return{c(){t=ie("span"),n=ae(r),o&&o.c(),fe(t,"class","px-3 py-2 rounded-md text-sm font-medium"),he(t,"text-white",e[1]===e[8]),he(t,"bg-gray-700",e[1]===e[8]),he(t,"text-gray-300",e[1]!==e[8])},m(e,r){re(e,t,r),ee(t,n),o&&o.m(t,null)},p(e,s){1&s&&r!==(r=e[8]+"")&&me(n,r),null!=e[2]&&e[8]===e[1]?o?o.p(e,s):(o=Hn(e),o.c(),o.m(t,null)):o&&(o.d(1),o=null),3&s&&he(t,"text-white",e[1]===e[8]),3&s&&he(t,"bg-gray-700",e[1]===e[8]),3&s&&he(t,"text-gray-300",e[1]!==e[8])},d(e){e&&oe(t),o&&o.d()}}}function qn(e){let t,n;return{c(){t=ie("span"),n=ae(e[2]),fe(t,"class","inline-flex items-center ml-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800")},m(e,r){re(e,t,r),ee(t,n)},p(e,t){4&t&&me(n,e[2])},d(e){e&&oe(t)}}}function Vn(e){let t,n,r=e[8]+"",o=null!=e[2]&&e[8]===e[1]&&qn(e);return{c(){t=ie("span"),n=ae(r),o&&o.c(),fe(t,"class","block px-3 py-2 rounded-md text-base font-medium"),he(t,"text-white",e[1]===e[8]),he(t,"bg-gray-700",e[1]===e[8]),he(t,"text-gray-300",e[1]!==e[8])},m(e,r){re(e,t,r),ee(t,n),o&&o.m(t,null)},p(e,s){1&s&&r!==(r=e[8]+"")&&me(n,r),null!=e[2]&&e[8]===e[1]?o?o.p(e,s):(o=qn(e),o.c(),o.m(t,null)):o&&(o.d(1),o=null),3&s&&he(t,"text-white",e[1]===e[8]),3&s&&he(t,"bg-gray-700",e[1]===e[8]),3&s&&he(t,"text-gray-300",e[1]!==e[8])},d(e){e&&oe(t),o&&o.d()}}}function Wn(e){let t,n,r,o,s,i,l,a,c,u,d,f,m,g,p,h,y,v,w,x,b,$,_,k,C,O=e[3].name+"";const j=e[7].default,L=V(j,e,e[6],null);let z=e[0],E=[];for(let t=0;t<z.length;t+=1)E[t]=Bn(Rn(e,z,t));let M=e[0],T=[];for(let t=0;t<M.length;t+=1)T[t]=Vn(An(e,M,t));return{c(){t=ie("nav"),n=ie("div"),r=ie("div"),o=ie("div"),s=ie("div"),i=ie("div"),i.innerHTML='<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-secret" class="svg-inline--fa fa-user-secret fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M383.9 308.3l23.9-62.6c4-10.5-3.7-21.7-15-21.7h-58.5c11-18.9 17.8-40.6 17.8-64v-.3c39.2-7.8 64-19.1 64-31.7 0-13.3-27.3-25.1-70.1-33-9.2-32.8-27-65.8-40.6-82.8-9.5-11.9-25.9-15.6-39.5-8.8l-27.6 13.8c-9 4.5-19.6 4.5-28.6 0L182.1 3.4c-13.6-6.8-30-3.1-39.5 8.8-13.5 17-31.4 50-40.6 82.8-42.7 7.9-70 19.7-70 33 0 12.6 24.8 23.9 64 31.7v.3c0 23.4 6.8 45.1 17.8 64H56.3c-11.5 0-19.2 11.7-14.7 22.3l25.8 60.2C27.3 329.8 0 372.7 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-48.4-25.8-90.4-64.1-114.1zM176 480l-41.6-192 49.6 32 24 40-32 120zm96 0l-32-120 24-40 49.6-32L272 480zm41.7-298.5c-3.9 11.9-7 24.6-16.5 33.4-10.1 9.3-48 22.4-64-25-2.8-8.4-15.4-8.4-18.3 0-17 50.2-56 32.4-64 25-9.5-8.8-12.7-21.5-16.5-33.4-.8-2.5-6.3-5.7-6.3-5.8v-10.8c28.3 3.6 61 5.8 96 5.8s67.7-2.1 96-5.8v10.8c-.1.1-5.6 3.2-6.4 5.8z"></path></svg>',l=ce(),a=ie("div"),L&&L.c(),c=ce(),u=ie("div"),d=ie("div");for(let e=0;e<E.length;e+=1)E[e].c();f=ce(),m=ie("div"),g=ie("span"),p=ae(O),h=ce(),y=ie("div"),v=le("svg"),w=le("path"),x=ce(),b=ie("div"),$=ie("div");for(let e=0;e<T.length;e+=1)T[e].c();fe(i,"class","block h-8 w-8 text-white"),fe(a,"class","top-0 absolute z-10 left-8"),he(a,"hidden",!e[4]),fe(s,"class","flex-shrink-0 flex items-center relative"),fe(d,"class","flex space-x-4"),fe(u,"class","hidden sm:block sm:ml-6"),fe(o,"class","flex-1 flex items-center justify-center sm:items-stretch sm:justify-start"),fe(g,"class","text-white mr-3"),fe(w,"fill","currentColor"),fe(w,"d","M383.9 308.3l23.9-62.6c4-10.5-3.7-21.7-15-21.7h-58.5c11-18.9 17.8-40.6 17.8-64v-.3c39.2-7.8 64-19.1 64-31.7 0-13.3-27.3-25.1-70.1-33-9.2-32.8-27-65.8-40.6-82.8-9.5-11.9-25.9-15.6-39.5-8.8l-27.6 13.8c-9 4.5-19.6 4.5-28.6 0L182.1 3.4c-13.6-6.8-30-3.1-39.5 8.8-13.5 17-31.4 50-40.6 82.8-42.7 7.9-70 19.7-70 33 0 12.6 24.8 23.9 64 31.7v.3c0 23.4 6.8 45.1 17.8 64H56.3c-11.5 0-19.2 11.7-14.7 22.3l25.8 60.2C27.3 329.8 0 372.7 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-48.4-25.8-90.4-64.1-114.1zM176 480l-41.6-192 49.6 32 24 40-32 120zm96 0l-32-120 24-40 49.6-32L272 480zm41.7-298.5c-3.9 11.9-7 24.6-16.5 33.4-10.1 9.3-48 22.4-64-25-2.8-8.4-15.4-8.4-18.3 0-17 50.2-56 32.4-64 25-9.5-8.8-12.7-21.5-16.5-33.4-.8-2.5-6.3-5.7-6.3-5.8v-10.8c28.3 3.6 61 5.8 96 5.8s67.7-2.1 96-5.8v10.8c-.1.1-5.6 3.2-6.4 5.8z"),fe(v,"aria-hidden","true"),fe(v,"focusable","false"),fe(v,"data-prefix","fas"),fe(v,"data-icon","user-secret"),fe(v,"class","svg-inline--fa fa-user-secret fa-w-14"),fe(v,"role","img"),fe(v,"xmlns","http://www.w3.org/2000/svg"),fe(v,"viewBox","0 0 448 512"),fe(y,"class","block h-6 w-6"),pe(y,"color",ln(e[3].agent)),fe(m,"class","absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0"),fe(r,"class","relative flex items-center justify-between h-16"),fe(n,"class","max-w-7xl mx-auto px-2 sm:px-6 lg:px-8"),fe($,"class","px-2 pt-2 pb-3 space-y-1"),fe(b,"class","sm:hidden"),fe(b,"id","mobile-menu"),fe(t,"class","bg-gray-800 dark:bg-gray-900 dark:border-b border-gray-500")},m(O,j){re(O,t,j),ee(t,n),ee(n,r),ee(r,o),ee(o,s),ee(s,i),ee(s,l),ee(s,a),L&&L.m(a,null),ee(o,c),ee(o,u),ee(u,d);for(let e=0;e<E.length;e+=1)E[e].m(d,null);ee(r,f),ee(r,m),ee(m,g),ee(g,p),ee(m,h),ee(m,y),ee(y,v),ee(v,w),ee(t,x),ee(t,b),ee(b,$);for(let e=0;e<T.length;e+=1)T[e].m($,null);_=!0,k||(C=de(i,"click",e[5]),k=!0)},p(e,[t]){if(L&&L.p&&(!_||64&t)&&G(L,j,e,e[6],_?F(j,e[6],t,null):U(e[6]),null),16&t&&he(a,"hidden",!e[4]),7&t){let n;for(z=e[0],n=0;n<z.length;n+=1){const r=Rn(e,z,n);E[n]?E[n].p(r,t):(E[n]=Bn(r),E[n].c(),E[n].m(d,null))}for(;n<E.length;n+=1)E[n].d(1);E.length=z.length}if((!_||8&t)&&O!==(O=e[3].name+"")&&me(p,O),(!_||8&t)&&pe(y,"color",ln(e[3].agent)),7&t){let n;for(M=e[0],n=0;n<M.length;n+=1){const r=An(e,M,n);T[n]?T[n].p(r,t):(T[n]=Vn(r),T[n].c(),T[n].m($,null))}for(;n<T.length;n+=1)T[n].d(1);T.length=M.length}},i(e){_||(Je(L,e),_=!0)},o(e){Ze(L,e),_=!1},d(e){e&&oe(t),L&&L.d(e),se(E,e),se(T,e),k=!1,C()}}}function Fn(e,t,n){let{$$slots:r={},$$scope:o}=t,{list:s}=t,{turn:i}=t,{moves:l}=t,{current:a}=t,c=!1;return e.$$set=e=>{"list"in e&&n(0,s=e.list),"turn"in e&&n(1,i=e.turn),"moves"in e&&n(2,l=e.moves),"current"in e&&n(3,a=e.current),"$$scope"in e&&n(6,o=e.$$scope)},[s,i,l,a,c,function(){n(4,c=!c)},o,r]}class Gn extends lt{constructor(e){super(),it(this,e,Fn,Wn,B,{list:0,turn:1,moves:2,current:3})}}function Un(e){const t=e-1;return t*t*t+1}function Jn(e){return-e*(e-2)}function Zn(e){return--e*e*e*e*e+1}const Qn=2147483647,Yn="abcdefghijkmnpqrstuvwxyz-ABCDEFGHJKLMNPQRSTUVWXYZ_23456789",Kn=Yn.length;function Xn(){const e=new Uint32Array(1);return window.crypto.getRandomValues(e),(e[0]&Qn)/Qn}function er(e){return Math.floor(Xn()*e)+1}function tr(e=5){let t="";for(;e;){const n=Xn()*Kn;t+=Yn.charAt(n),e-=1}return t}function nr(e,{duration:t,disable:n}){if(n)return{duration:t,easing:Jn,css:e=>`opacity: ${e}`};const r=2*er(2)-3,o=er(360),s=er(120)+60;return e.style.transform=`translate3d(0, 0, 0) rotate(${r*s+o}deg)`,{duration:t,easing:Jn,css:(e,t)=>`transform: translate3d(0, ${200*t}%, 0) rotate(${e*r*s+o}deg)`}}function rr(e){let t,n,r,o,s,i,l,a,c,u,d,f,m,g,p,h,y;return{c(){t=ie("div"),n=ie("div"),r=ce(),o=ie("div"),s=ce(),i=ie("div"),l=ce(),a=ie("div"),c=ce(),u=ie("div"),d=ce(),f=ie("div"),fe(n,"class","dot1 dot svelte-15t0plq"),fe(o,"class","dot2 dot svelte-15t0plq"),fe(i,"class","dot3 dot svelte-15t0plq"),fe(a,"class","dot4 dot svelte-15t0plq"),fe(u,"class","dot5 dot svelte-15t0plq"),fe(f,"class","dot6 dot svelte-15t0plq"),fe(t,"class",m="die "+e[3]+" svelte-15t0plq"),fe(t,"data-die-id",g=e[0].id),pe(t,"background-color","var(--dice-color, "+e[1]+")")},m(m,g){re(m,t,g),ee(t,n),ee(t,r),ee(t,o),ee(t,s),ee(t,i),ee(t,l),ee(t,a),ee(t,c),ee(t,u),ee(t,d),ee(t,f),h||(y=de(t,"click",e[4]),h=!0)},p(n,[r]){e=n,8&r&&m!==(m="die "+e[3]+" svelte-15t0plq")&&fe(t,"class",m),1&r&&g!==(g=e[0].id)&&fe(t,"data-die-id",g),2&r&&pe(t,"background-color","var(--dice-color, "+e[1]+")")},i(n){p||Ne((()=>{p=Ye(t,nr,{duration:700,disable:e[2]}),p.start()}))},o:I,d(e){e&&oe(t),h=!1,y()}}}function or(e,t,n){let r,{value:o}=t,{color:s="#fff"}=t,{noToss:i=!1}=t;return e.$$set=e=>{"value"in e&&n(0,o=e.value),"color"in e&&n(1,s=e.color),"noToss"in e&&n(2,i=e.noToss)},e.$$.update=()=>{1&e.$$.dirty&&n(3,r="n"+o.value)},[o,s,i,r,function(t){Le.call(this,e,t)}]}class sr extends lt{constructor(e){super(),it(this,e,or,rr,B,{value:0,color:1,noToss:2})}}function ir(e,{count:t,padding:n}){const{offsetHeight:r,offsetWidth:o}=e;if(r){const s=function(e,t,n){const r=Math.floor(Math.sqrt(e));let o=0;const[s,i]=t>n?[t,n]:[n,t];for(let t=1;t<=r;t+=1){const n=Math.ceil(e/t),[r,l]=n>t?[n,t]:[t,n],a=Math.min(s/r,i/l);a>o&&(o=a)}return console.log(`Found best size for ${e} dice on a ${t}x${n} table = ${o}px`),o}(t,o-n,r-n)/1.41422;e.style.setProperty("--dice-size",s+"px"),e.style.setProperty("--die-size",s+"px")}else requestAnimationFrame((()=>ir(e,{count:t,padding:n})))}function lr(e,t){if(t.enable)return ir(e,t),{update(t){ir(e,t)}}}const ar=e=>t=>({value:t||er(e),id:tr(),type:`d${e}`}),cr={d4:ar(4),d6:ar(6),d8:ar(8),d10:ar(10),d12:ar(12),d20:ar(20),d100:ar(100)};function ur(e,t,n){const r=e.slice();return r[21]=t[n],r[23]=n,r}function dr(e,t){let n,r,o;return r=new sr({props:{color:t[3],value:t[21],noToss:!t[7]}}),r.$on("click",(function(...e){return t[17](t[23],...e)})),{key:e,first:null,c(){n=ue(),rt(r.$$.fragment),this.first=n},m(e,t){re(e,n,t),ot(r,e,t),o=!0},p(e,n){t=e;const o={};8&n&&(o.color=t[3]),64&n&&(o.value=t[21]),128&n&&(o.noToss=!t[7]),r.$set(o)},i(e){o||(Je(r.$$.fragment,e),o=!0)},o(e){Ze(r.$$.fragment,e),o=!1},d(e){e&&oe(n),st(r,e)}}}function fr(e){let t,n,r,o,s,i=[],l=new Map,a=e[6];const c=e=>e[21].id;for(let t=0;t<a.length;t+=1){let n=ur(e,a,t),r=c(n);l.set(r,i[t]=dr(r,n))}return{c(){t=ie("div");for(let e=0;e<i.length;e+=1)i[e].c();fe(t,"class","table svelte-121fxfh"),he(t,"wooden",!e[4])},m(l,a){re(l,t,a);for(let e=0;e<i.length;e+=1)i[e].m(t,null);var c;e[18](t),r=!0,o||(s=[de(t,"click",e[9]),(c=n=lr.call(null,t,{count:e[1]||e[0],padding:e[5],enable:e[2]}),c&&H(c.destroy)?c.destroy:I)],o=!0)},p(e,[r]){1224&r&&(a=e[6],Ge(),i=nt(i,r,c,1,e,a,l,t,et,dr,null,ur),Ue()),n&&H(n.update)&&39&r&&n.update.call(null,{count:e[1]||e[0],padding:e[5],enable:e[2]}),16&r&&he(t,"wooden",!e[4])},i(e){if(!r){for(let e=0;e<a.length;e+=1)Je(i[e]);r=!0}},o(e){for(let e=0;e<i.length;e+=1)Ze(i[e]);r=!1},d(n){n&&oe(t);for(let e=0;e<i.length;e+=1)i[e].d();e[18](null),o=!1,R(s)}}}function mr(e,t,n){let r,o,{numberOfDice:s=1}=t,{fixedSizeFor:i}=t,{autoDiceSize:l=!0}=t,{tapToRoll:a=!0}=t,{diceColor:c="#fff"}=t,{transparent:u=!1}=t,{captureDiceClick:d=!1}=t,{padding:f=32}=t,m=[],g=!1;const p=function(){const e=je();return(t,n)=>{const r=e.$$.callbacks[t];if(r){const o=ye(t,n);r.slice().forEach((t=>{t.call(e,o)}))}}}();async function h(e,t=[]){var r;n(7,g=!0),e&&(n(0,s=e),await(Pe(),Se)),m.length&&(n(6,m=[]),await(r=300,new Promise((e=>setTimeout(e,r)))));const i=t.length?o.map(((e,n)=>e(t[n%t.length]))):o.map((e=>e())),l=i.reduce(((e,t)=>e+t.value),0),a={results:[...i],sum:l};return n(6,m=i),p("rolled",a),a}function y(e,t){if(d){e.preventDefault(),e.stopPropagation();const n={index:t,result:m[t],node:e.target};p("diceclick",n)}}return e.$$set=e=>{"numberOfDice"in e&&n(0,s=e.numberOfDice),"fixedSizeFor"in e&&n(1,i=e.fixedSizeFor),"autoDiceSize"in e&&n(2,l=e.autoDiceSize),"tapToRoll"in e&&n(11,a=e.tapToRoll),"diceColor"in e&&n(3,c=e.diceColor),"transparent"in e&&n(4,u=e.transparent),"captureDiceClick"in e&&n(12,d=e.captureDiceClick),"padding"in e&&n(5,f=e.padding)},e.$$.update=()=>{3&e.$$.dirty&&("string"==typeof s&&n(0,s=parseInt(s,10)),s>36?(n(0,s=36),console.warn("Max number of dice is 36")):s<1&&(n(0,s=1),console.warn("Min number of dice is 1")),null!=i&&i<s&&n(1,i=s)),1&e.$$.dirty&&(o=Array(s).fill(cr.d6))},[s,i,l,c,u,f,m,g,r,function(){a&&h()},y,a,d,h,function(){n(6,m=[]),p("cleared")},function(e){n(7,g=!1),n(6,m=[...m,e])},function(e){const t=m.findIndex((t=>t.id===e));if(!(t<0))return{index:t,result:m[t],node:r.querySelector(`[data-die-id="${m[t].id}"]`)}},(e,t)=>y(t,e),function(e){Ee[e?"unshift":"push"]((()=>{r=e,n(8,r)}))}]}class gr extends lt{constructor(e){super(),it(this,e,mr,fr,B,{numberOfDice:0,fixedSizeFor:1,autoDiceSize:2,tapToRoll:11,diceColor:3,transparent:4,captureDiceClick:12,padding:5,roll:13,clear:14,add:15,getById:16})}get roll(){return this.$$.ctx[13]}get clear(){return this.$$.ctx[14]}get add(){return this.$$.ctx[15]}get getById(){return this.$$.ctx[16]}}
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */function pr(e,{delay:t=0,duration:n=400,easing:r=P}={}){const o=+getComputedStyle(e).opacity;return{delay:t,duration:n,easing:r,css:e=>"opacity: "+e*o}}function hr(e,{delay:t=0,duration:n=400,easing:r=Un,start:o=0,opacity:s=0}={}){const i=getComputedStyle(e),l=+i.opacity,a="none"===i.transform?"":i.transform,c=1-o,u=l*(1-s);return{delay:t,duration:n,easing:r,css:(e,t)=>`\n\t\t\ttransform: ${a} scale(${1-c*t});\n\t\t\topacity: ${l-u*t}\n\t\t`}}function yr(e){var{fallback:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["fallback"]);const r=new Map,o=new Map;function s(e,r,o){return(s,i)=>(e.set(i.key,{rect:s.getBoundingClientRect()}),()=>{if(r.has(i.key)){const{rect:e}=r.get(i.key);return r.delete(i.key),function(e,t,r){const{delay:o=0,duration:s=(e=>30*Math.sqrt(e)),easing:i=Un}=N(N({},n),r),l=t.getBoundingClientRect(),a=e.left-l.left,c=e.top-l.top,u=e.width/l.width,d=e.height/l.height,f=Math.sqrt(a*a+c*c),m=getComputedStyle(t),g="none"===m.transform?"":m.transform,p=+m.opacity;return{delay:o,duration:H(s)?s(f):s,easing:i,css:(e,t)=>`\n\t\t\t\topacity: ${e*p};\n\t\t\t\ttransform-origin: top left;\n\t\t\t\ttransform: ${g} translate(${t*a}px,${t*c}px) scale(${e+(1-e)*u}, ${e+(1-e)*d});\n\t\t\t`}}(e,s,i)}return e.delete(i.key),t&&t(s,i,o)})}return[s(o,r,!1),s(r,o,!0)]}function vr(e){let t,n,r,o,s,i,l,a,c;const u=e[3].default,d=V(u,e,e[2],null);return{c(){t=ie("div"),n=ie("div"),d&&d.c(),r=ce(),o=le("svg"),s=le("path"),i=ce(),l=ie("span"),a=ae(e[0]),fe(n,"class","flex flex-wrap items-end justify-center max-w-sm"),fe(s,"fill","currentColor"),fe(s,"d","M480 160H32c-17.673 0-32-14.327-32-32V64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z"),fe(o,"aria-hidden","true"),fe(o,"focusable","false"),fe(o,"data-prefix","fas"),fe(o,"data-icon","server"),fe(o,"class","inline w-16"),fe(o,"role","img"),fe(o,"xmlns","http://www.w3.org/2000/svg"),fe(o,"viewBox","0 0 512 512"),he(o,"text-red-400",e[1]),fe(l,"class","text-lg font-bold font-mono"),fe(t,"class","flex flex-col items-center w-1/5")},m(e,u){re(e,t,u),ee(t,n),d&&d.m(n,null),ee(t,r),ee(t,o),ee(o,s),ee(t,i),ee(t,l),ee(l,a),c=!0},p(e,[t]){d&&d.p&&(!c||4&t)&&G(d,u,e,e[2],c?F(u,e[2],t,null):U(e[2]),null),2&t&&he(o,"text-red-400",e[1]),(!c||1&t)&&me(a,e[0])},i(e){c||(Je(d,e),c=!0)},o(e){Ze(d,e),c=!1},d(e){e&&oe(t),d&&d.d(e)}}}function wr(e,t,n){let{$$slots:r={},$$scope:o}=t,{name:s}=t,{trigger:i}=t;return e.$$set=e=>{"name"in e&&n(0,s=e.name),"trigger"in e&&n(1,i=e.trigger),"$$scope"in e&&n(2,o=e.$$scope)},[s,i,o,r]}class xr extends lt{constructor(e){super(),it(this,e,wr,vr,B,{name:0,trigger:1})}}function br(e){let t,n,r,o,s;return{c(){t=ie("span"),n=le("svg"),r=le("path"),fe(r,"fill","currentColor"),fe(r,"d","M624 416H381.54c-.74 19.81-14.71 32-32.74 32H288c-18.69 0-33.02-17.47-32.77-32H16c-8.8 0-16 7.2-16 16v16c0 35.2 28.8 64 64 64h512c35.2 0 64-28.8 64-64v-16c0-8.8-7.2-16-16-16zM576 48c0-26.4-21.6-48-48-48H112C85.6 0 64 21.6 64 48v336h512V48zm-64 272H128V64h384v256z"),fe(n,"aria-hidden","true"),fe(n,"focusable","false"),fe(n,"data-prefix","fas"),fe(n,"data-icon","laptop"),fe(n,"class","inline w-20"),fe(n,"role","img"),fe(n,"xmlns","http://www.w3.org/2000/svg"),fe(n,"viewBox","0 0 640 512"),pe(t,"color",ln(e[0])),fe(t,"class","inline relative m-1"),he(t,"cursor-pointer",e[1])},m(i,l){re(i,t,l),ee(t,n),ee(n,r),o||(s=de(t,"click",e[2]),o=!0)},p(e,[n]){1&n&&pe(t,"color",ln(e[0])),2&n&&he(t,"cursor-pointer",e[1])},i:I,o:I,d(e){e&&oe(t),o=!1,s()}}}function $r(e,t,n){let{agent:r}=t,{myturn:o}=t;return e.$$set=e=>{"agent"in e&&n(0,r=e.agent),"myturn"in e&&n(1,o=e.myturn)},[r,o,function(t){Le.call(this,e,t)}]}class _r extends lt{constructor(e){super(),it(this,e,$r,br,B,{agent:0,myturn:1})}}function kr(e,{from:t,to:n},r={}){const o=getComputedStyle(e),s="none"===o.transform?"":o.transform,[i,l]=o.transformOrigin.split(" ").map(parseFloat),a=t.left+t.width*i/n.width-(n.left+i),c=t.top+t.height*l/n.height-(n.top+l),{delay:u=0,duration:d=(e=>120*Math.sqrt(e)),easing:f=Un}=r;return{delay:u,duration:H(d)?d(Math.sqrt(a*a+c*c)):d,easing:f,css:(e,r)=>{const o=r*a,i=r*c,l=e+r*t.width/n.width,u=e+r*t.height/n.height;return`transform: ${s} translate(${o}px, ${i}px) scale(${l}, ${u});`}}}function Cr(e,t,n){const r=e.slice();return r[14]=t[n],r[16]=n,r}function Or(e,t,n){const r=e.slice();return r[17]=t[n],r}function jr(e,t){let n,r,o,s,i,l,a=I;return r=new _r({props:{agent:t[17],myturn:t[2]}}),r.$on("click",(function(){return t[13](t[16],t[17])})),{key:e,first:null,c(){n=ie("span"),rt(r.$$.fragment),fe(n,"class","inline relative m-1"),this.first=n},m(e,t){re(e,n,t),ot(r,n,null),l=!0},p(e,n){t=e;const o={};1&n&&(o.agent=t[17]),4&n&&(o.myturn=t[2]),r.$set(o)},r(){i=n.getBoundingClientRect()},f(){ke(n),a(),Ce(n,i)},a(){a(),a=_e(n,i,kr,{duration:200})},i(e){l||(Je(r.$$.fragment,e),e&&Ne((()=>{s&&s.end(1),o=Ye(n,t[6],{key:t[17]}),o.start()})),l=!0)},o(e){Ze(r.$$.fragment,e),o&&o.invalidate(),e&&(s=Ke(n,t[5],{key:t[17]})),l=!1},d(e){e&&oe(n),st(r),e&&s&&s.end()}}}function Lr(e){let t,n,r=[],o=new Map,s=e[14].agents;const i=e=>e[17];for(let t=0;t<s.length;t+=1){let n=Or(e,s,t),l=i(n);o.set(l,r[t]=jr(l,n))}return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=ce()},m(e,o){for(let t=0;t<r.length;t+=1)r[t].m(e,o);re(e,t,o),n=!0},p(e,n){if(133&n){s=e[14].agents,Ge();for(let e=0;e<r.length;e+=1)r[e].r();r=nt(r,n,i,1,e,s,o,t.parentNode,tt,jr,t,Or);for(let e=0;e<r.length;e+=1)r[e].a();Ue()}},i(e){if(!n){for(let e=0;e<s.length;e+=1)Je(r[e]);n=!0}},o(e){for(let e=0;e<r.length;e+=1)Ze(r[e]);n=!1},d(e){for(let t=0;t<r.length;t+=1)r[t].d(e);e&&oe(t)}}}function zr(e){let t,n;return t=new xr({props:{name:e[14].name,trigger:e[14].name===e[3],$$slots:{default:[Lr]},$$scope:{ctx:e}}}),{c(){rt(t.$$.fragment)},m(e,r){ot(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.name=e[14].name),9&n&&(r.trigger=e[14].name===e[3]),1048581&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(Je(t.$$.fragment,e),n=!0)},o(e){Ze(t.$$.fragment,e),n=!1},d(e){st(t,e)}}}function Er(e){let t,n,r,o,s;return{c(){t=ie("div"),t.innerHTML='<div class="text-5xl casual text-center leading-relaxed">It&#39;s your turn<br/>Tap/click to roll...<br/>or hit Space</div>',fe(t,"class","absolute z-40 cursor-pointer inset-0 flex items-center justify-center bg-white dark:bg-gray-900 bg-opacity-60 dark:bg-opacity-80")},m(n,i){re(n,t,i),r=!0,o||(s=de(t,"click",e[8]),o=!0)},p:I,i(e){r||(Ne((()=>{n||(n=Xe(t,pr,{duration:250},!0)),n.run(1)})),r=!0)},o(e){n||(n=Xe(t,pr,{duration:250},!1)),n.run(0),r=!1},d(e){e&&oe(t),e&&n&&n.end(),o=!1,s()}}}function Mr(e){let t,n,r,o,s,i,l,a,c,u;r=new gr({props:{tapToRoll:!1,transparent:!0}}),e[12](r);let d=e[0],f=[];for(let t=0;t<d.length;t+=1)f[t]=zr(Cr(e,d,t));const m=e=>Ze(f[e],1,1,(()=>{f[e]=null}));let g=e[4]&&Er(e);return{c(){t=ie("div"),n=ie("div"),rt(r.$$.fragment),o=ce(),s=ie("div");for(let e=0;e<f.length;e+=1)f[e].c();i=ce(),g&&g.c(),l=ue(),fe(n,"class","absolute h-full w-full left-0"),fe(s,"class","flex flex-wrap justify-center items-end py-4 w-full"),fe(t,"class","flex-grow max-w-7xl mx-auto px-2 sm:px-6 lg:px-8 relative")},m(d,m){re(d,t,m),ee(t,n),ot(r,n,null),ee(t,o),ee(t,s);for(let e=0;e<f.length;e+=1)f[e].m(s,null);re(d,i,m),g&&g.m(d,m),re(d,l,m),a=!0,c||(u=de(window,"keydown",e[9]),c=!0)},p(e,[t]){if(r.$set({}),141&t){let n;for(d=e[0],n=0;n<d.length;n+=1){const r=Cr(e,d,n);f[n]?(f[n].p(r,t),Je(f[n],1)):(f[n]=zr(r),f[n].c(),Je(f[n],1),f[n].m(s,null))}for(Ge(),n=d.length;n<f.length;n+=1)m(n);Ue()}e[4]?g?(g.p(e,t),16&t&&Je(g,1)):(g=Er(e),g.c(),Je(g,1),g.m(l.parentNode,l)):g&&(Ge(),Ze(g,1,1,(()=>{g=null})),Ue())},i(e){if(!a){Je(r.$$.fragment,e);for(let e=0;e<d.length;e+=1)Je(f[e]);Je(g),a=!0}},o(e){Ze(r.$$.fragment,e),f=f.filter(Boolean);for(let e=0;e<f.length;e+=1)Ze(f[e]);Ze(g),a=!1},d(n){n&&oe(t),e[12](null),st(r),se(f,n),n&&oe(i),g&&g.d(n),n&&oe(l),c=!1,u()}}}function Tr(e,t,n){let r,o,s,i;q(e,cn,(e=>n(11,i=e)));const[l,a]=yr({duration:e=>Math.sqrt(200*e),fallback(e,t){const n=getComputedStyle(e),r="none"===n.transform?"":n.transform;return{duration:600,easing:Zn,css:e=>`\n        transform: ${r} scale(${e});\n        opacity: ${e}\n      `}}});let c,{servers:u}=t;function d(e,t){s&&i.send(yt($t,{agent:t,current:e})),c.clear()}let f=null;function m(){i.send(yt(_t,{}))}return e.$$set=e=>{"servers"in e&&n(0,u=e.servers)},e.$$.update=()=>{3074&e.$$.dirty&&(null!=i.context.moves&&(null==f||i.context.moves>f)&&(c.roll(0,[i.context.moves]),setTimeout((()=>{c.clear()}),3e3)),n(10,f=i.context.moves)),2048&e.$$.dirty&&n(4,r=i.context.turn===i.context.me.name&&null==i.context.moves),2048&e.$$.dirty&&n(3,o=i.context.trigger),2048&e.$$.dirty&&n(2,s=i.context.turn===i.context.me.name&&null!=i.context.moves&&i.context.moves>0)},[u,c,s,o,r,l,a,d,m,function(e){"Space"===e.code&&m()},f,i,function(e){Ee[e?"unshift":"push"]((()=>{c=e,n(1,c)}))},(e,t)=>d(e,t)]}class Sr extends lt{constructor(e){super(),it(this,e,Tr,Mr,B,{servers:0})}}function Ir(e){let t,n,r,o,s,i,l;return{c(){t=ie("span"),n=ie("span"),r=ae(e[0]),s=ce(),i=le("svg"),l=le("path"),fe(n,"class",o="absolute right-6 font-bold font-mono top-1/2 transform -translate-y-1/2 text-right "+e[1]),fe(l,"fill","currentColor"),fe(l,"d","M624 128H480v256h144a16 16 0 0 0 16-16V144a16 16 0 0 0-16-16zm-40 184a16 16 0 0 1-16 16h-16a16 16 0 0 1-16-16v-16a16 16 0 0 1 16-16h16a16 16 0 0 1 16 16zm0-96a16 16 0 0 1-16 16h-16a16 16 0 0 1-16-16v-16a16 16 0 0 1 16-16h16a16 16 0 0 1 16 16zM432 96H64a64 64 0 0 0-64 64v192a64 64 0 0 0 64 64h368a16 16 0 0 0 16-16V112a16 16 0 0 0-16-16z"),fe(i,"aria-hidden","true"),fe(i,"focusable","false"),fe(i,"data-prefix","fas"),fe(i,"class","inline w-16"),fe(i,"role","img"),fe(i,"xmlns","http://www.w3.org/2000/svg"),fe(i,"viewBox","0 0 640 512"),pe(t,"color",e[2]),fe(t,"class","inline relative mx-4")},m(e,o){re(e,t,o),ee(t,n),ee(n,r),ee(t,s),ee(t,i),ee(i,l)},p(e,[s]){1&s&&me(r,e[0]),2&s&&o!==(o="absolute right-6 font-bold font-mono top-1/2 transform -translate-y-1/2 text-right "+e[1])&&fe(n,"class",o),4&s&&pe(t,"color",e[2])},i:I,o:I,d(e){e&&oe(t)}}}function Pr(e,t,n){let r,o,{name:s}=t,{files:i}=t;return e.$$set=e=>{"name"in e&&n(3,s=e.name),"files"in e&&n(0,i=e.files)},e.$$.update=()=>{8&e.$$.dirty&&n(2,r=ln(s)),8&e.$$.dirty&&n(1,o="eta"===s||"zeta"===s?"text-white":"text-black")},[i,o,r,s]}class Nr extends lt{constructor(e){super(),it(this,e,Pr,Ir,B,{name:3,files:0})}}function Dr(e,t,n){const r=e.slice();return r[1]=t[n],r}function Ar(e){let t,n;return t=new Nr({props:{name:e[1].name,files:e[1].files}}),{c(){rt(t.$$.fragment)},m(e,r){ot(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.name=e[1].name),1&n&&(r.files=e[1].files),t.$set(r)},i(e){n||(Je(t.$$.fragment,e),n=!0)},o(e){Ze(t.$$.fragment,e),n=!1},d(e){st(t,e)}}}function Rr(e){let t,n,r,o,s=e[0],i=[];for(let t=0;t<s.length;t+=1)i[t]=Ar(Dr(e,s,t));const l=e=>Ze(i[e],1,1,(()=>{i[e]=null}));return{c(){t=ie("div"),n=ie("div"),r=ie("div");for(let e=0;e<i.length;e+=1)i[e].c();fe(r,"class","flex items-center justify-center"),fe(n,"class","max-w-7xl mx-auto px-2 sm:px-6 lg:px-8"),fe(t,"class","bg-gray-300 dark:bg-gray-600")},m(e,s){re(e,t,s),ee(t,n),ee(n,r);for(let e=0;e<i.length;e+=1)i[e].m(r,null);o=!0},p(e,[t]){if(1&t){let n;for(s=e[0],n=0;n<s.length;n+=1){const o=Dr(e,s,n);i[n]?(i[n].p(o,t),Je(i[n],1)):(i[n]=Ar(o),i[n].c(),Je(i[n],1),i[n].m(r,null))}for(Ge(),n=s.length;n<i.length;n+=1)l(n);Ue()}},i(e){if(!o){for(let e=0;e<s.length;e+=1)Je(i[e]);o=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ze(i[e]);o=!1},d(e){e&&oe(t),se(i,e)}}}function Hr(e,t,n){let{list:r}=t;return e.$$set=e=>{"list"in e&&n(0,r=e.list)},[r]}class Br extends lt{constructor(e){super(),it(this,e,Hr,Rr,B,{list:0})}}function qr(e){let t,n,r,o,s=e[0].machine.current+"",i=JSON.stringify(e[0].context,null,2)+"";return{c(){t=ie("pre"),n=ae(s),r=ae("\n      \n      "),o=ae(i),fe(t,"class","bg-gray-400 p-4 text-left rounded shadow-lg")},m(e,s){re(e,t,s),ee(t,n),ee(t,r),ee(t,o)},p(e,t){1&t&&s!==(s=e[0].machine.current+"")&&me(n,s),1&t&&i!==(i=JSON.stringify(e[0].context,null,2)+"")&&me(o,i)},d(e){e&&oe(t)}}}function Vr(e){let t,n,r,o,s,i,l;return n=new Gn({props:{list:e[6],current:e[3],turn:e[5],moves:e[4],$$slots:{default:[qr]},$$scope:{ctx:e}}}),o=new Sr({props:{servers:e[2]}}),i=new Br({props:{list:e[1]}}),{c(){t=ie("div"),rt(n.$$.fragment),r=ce(),rt(o.$$.fragment),s=ce(),rt(i.$$.fragment),fe(t,"class","flex flex-col min-h-screen")},m(e,a){re(e,t,a),ot(n,t,null),ee(t,r),ot(o,t,null),ee(t,s),ot(i,t,null),l=!0},p(e,[t]){const r={};64&t&&(r.list=e[6]),8&t&&(r.current=e[3]),32&t&&(r.turn=e[5]),16&t&&(r.moves=e[4]),129&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const s={};4&t&&(s.servers=e[2]),o.$set(s);const l={};2&t&&(l.list=e[1]),i.$set(l)},i(e){l||(Je(n.$$.fragment,e),Je(o.$$.fragment,e),Je(i.$$.fragment,e),l=!0)},o(e){Ze(n.$$.fragment,e),Ze(o.$$.fragment,e),Ze(i.$$.fragment,e),l=!1},d(e){e&&oe(t),st(n),st(o),st(i)}}}function Wr(e,t,n){let r,o,s,i,l,a,c;return q(e,cn,(e=>n(0,c=e))),e.$$.update=()=>{1&e.$$.dirty&&n(6,r=c.context.players),1&e.$$.dirty&&n(5,o=c.context.turn),1&e.$$.dirty&&n(4,s=c.context.moves),1&e.$$.dirty&&n(3,i=c.context.me),1&e.$$.dirty&&n(2,l=c.context.farm),1&e.$$.dirty&&n(1,a=c.context.agents)},[c,a,l,i,s,o,r]}class Fr extends lt{constructor(e){super(),it(this,e,Wr,Vr,B,{})}}function Gr(e,t,n){const r=e.slice();return r[2]=t[n],r}function Ur(e,t,n){const r=e.slice();return r[5]=t[n],r}function Jr(e){let t;return{c(){t=ae("Game Over")},m(e,n){re(e,t,n)},d(e){e&&oe(t)}}}function Zr(e){let t;return{c(){t=ae("s")},m(e,n){re(e,t,n)},d(e){e&&oe(t)}}}function Qr(e){let t,n,r,o,s;return{c(){t=ie("li"),n=ie("div"),r=le("svg"),o=le("path"),s=ce(),fe(o,"fill","currentColor"),fe(o,"d","M383.9 308.3l23.9-62.6c4-10.5-3.7-21.7-15-21.7h-58.5c11-18.9 17.8-40.6 17.8-64v-.3c39.2-7.8 64-19.1 64-31.7 0-13.3-27.3-25.1-70.1-33-9.2-32.8-27-65.8-40.6-82.8-9.5-11.9-25.9-15.6-39.5-8.8l-27.6 13.8c-9 4.5-19.6 4.5-28.6 0L182.1 3.4c-13.6-6.8-30-3.1-39.5 8.8-13.5 17-31.4 50-40.6 82.8-42.7 7.9-70 19.7-70 33 0 12.6 24.8 23.9 64 31.7v.3c0 23.4 6.8 45.1 17.8 64H56.3c-11.5 0-19.2 11.7-14.7 22.3l25.8 60.2C27.3 329.8 0 372.7 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-48.4-25.8-90.4-64.1-114.1zM176 480l-41.6-192 49.6 32 24 40-32 120zm96 0l-32-120 24-40 49.6-32L272 480zm41.7-298.5c-3.9 11.9-7 24.6-16.5 33.4-10.1 9.3-48 22.4-64-25-2.8-8.4-15.4-8.4-18.3 0-17 50.2-56 32.4-64 25-9.5-8.8-12.7-21.5-16.5-33.4-.8-2.5-6.3-5.7-6.3-5.8v-10.8c28.3 3.6 61 5.8 96 5.8s67.7-2.1 96-5.8v10.8c-.1.1-5.6 3.2-6.4 5.8z"),fe(r,"aria-hidden","true"),fe(r,"focusable","false"),fe(r,"data-prefix","fas"),fe(r,"data-icon","user-secret"),fe(r,"class","inline-block w-10"),fe(r,"role","img"),fe(r,"xmlns","http://www.w3.org/2000/svg"),fe(r,"viewBox","0 0 448 512"),pe(n,"color",ln(e[5])),fe(n,"class","flex-shrink-0 flex items-center justify-center w-16 h-14 text-sm font-medium rounded-l-md"),fe(t,"class","col-span-1 flex rounded-md")},m(e,i){re(e,t,i),ee(t,n),ee(n,r),ee(r,o),ee(t,s)},p(e,t){1&t&&pe(n,"color",ln(e[5]))},d(e){e&&oe(t)}}}function Yr(e){let t,n,r,o,s,i,l,a,c,u,d,f,m,g=(e[2].name||"???")+"",p=e[2].files+"";return{c(){t=ie("li"),n=ie("div"),r=le("svg"),o=le("path"),s=ce(),i=ie("div"),l=ie("div"),a=ie("span"),c=ae(g),u=ae(" ("),d=ae(p),f=ae(")"),m=ce(),fe(o,"fill","currentColor"),fe(o,"d","M383.9 308.3l23.9-62.6c4-10.5-3.7-21.7-15-21.7h-58.5c11-18.9 17.8-40.6 17.8-64v-.3c39.2-7.8 64-19.1 64-31.7 0-13.3-27.3-25.1-70.1-33-9.2-32.8-27-65.8-40.6-82.8-9.5-11.9-25.9-15.6-39.5-8.8l-27.6 13.8c-9 4.5-19.6 4.5-28.6 0L182.1 3.4c-13.6-6.8-30-3.1-39.5 8.8-13.5 17-31.4 50-40.6 82.8-42.7 7.9-70 19.7-70 33 0 12.6 24.8 23.9 64 31.7v.3c0 23.4 6.8 45.1 17.8 64H56.3c-11.5 0-19.2 11.7-14.7 22.3l25.8 60.2C27.3 329.8 0 372.7 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-48.4-25.8-90.4-64.1-114.1zM176 480l-41.6-192 49.6 32 24 40-32 120zm96 0l-32-120 24-40 49.6-32L272 480zm41.7-298.5c-3.9 11.9-7 24.6-16.5 33.4-10.1 9.3-48 22.4-64-25-2.8-8.4-15.4-8.4-18.3 0-17 50.2-56 32.4-64 25-9.5-8.8-12.7-21.5-16.5-33.4-.8-2.5-6.3-5.7-6.3-5.8v-10.8c28.3 3.6 61 5.8 96 5.8s67.7-2.1 96-5.8v10.8c-.1.1-5.6 3.2-6.4 5.8z"),fe(r,"aria-hidden","true"),fe(r,"focusable","false"),fe(r,"data-prefix","fas"),fe(r,"data-icon","user-secret"),fe(r,"class","inline-block w-10"),fe(r,"role","img"),fe(r,"xmlns","http://www.w3.org/2000/svg"),fe(r,"viewBox","0 0 448 512"),pe(n,"background-color",ln(e[2].agent)),fe(n,"class","flex-shrink-0 flex items-center justify-center w-16 h-14 text-white text-sm font-medium rounded-l-md"),fe(a,"class","text-gray-900 dark:text-white font-medium"),fe(l,"class","flex-1 px-4 py-2 text-md truncate"),fe(i,"class","flex-1 flex items-center justify-between border-t border-r border-b border-gray-200 bg-white dark:bg-gray-900 dark:border-gray-700 rounded-r-md truncate"),fe(t,"class","col-span-1 flex shadow-sm rounded-md")},m(e,g){re(e,t,g),ee(t,n),ee(n,r),ee(r,o),ee(t,s),ee(t,i),ee(i,l),ee(l,a),ee(a,c),ee(a,u),ee(a,d),ee(a,f),ee(t,m)},p(e,t){2&t&&pe(n,"background-color",ln(e[2].agent)),2&t&&g!==(g=(e[2].name||"???")+"")&&me(c,g),2&t&&p!==(p=e[2].files+"")&&me(d,p)},d(e){e&&oe(t)}}}function Kr(e){let t,n,r,o,s,i,l,a,c,u,d,f,m,g;n=new fn({props:{$$slots:{default:[Jr]},$$scope:{ctx:e}}});let p=e[0].winners.length>1&&Zr(),h=e[0].winners,y=[];for(let t=0;t<h.length;t+=1)y[t]=Qr(Ur(e,h,t));let v=e[1],w=[];for(let t=0;t<v.length;t+=1)w[t]=Yr(Gr(e,v,t));return{c(){t=ie("article"),rt(n.$$.fragment),r=ce(),o=ie("div"),s=ie("h2"),i=ae("Winner"),p&&p.c(),l=ce(),a=ie("ul");for(let e=0;e<y.length;e+=1)y[e].c();c=ce(),u=ie("div"),d=ie("h2"),d.textContent="Agent Roster",f=ce(),m=ie("ul");for(let e=0;e<w.length;e+=1)w[e].c();fe(s,"class","text-gray-500 text-lg font-medium uppercase tracking-wide"),fe(a,"class","mt-3 grid grid-cols-1 gap-5 sm:gap-6 sm:grid-cols-2 lg:grid-cols-5"),fe(o,"class","mt-4"),fe(d,"class","text-gray-500 text-lg font-medium uppercase tracking-wide"),fe(m,"class","mt-3 grid grid-cols-1 gap-5 sm:gap-6 sm:grid-cols-2 lg:grid-cols-5"),fe(u,"class","mt-4"),fe(t,"class","max-w-7xl mx-auto px-2 sm:px-6 lg:px-8")},m(e,h){re(e,t,h),ot(n,t,null),ee(t,r),ee(t,o),ee(o,s),ee(s,i),p&&p.m(s,null),ee(o,l),ee(o,a);for(let e=0;e<y.length;e+=1)y[e].m(a,null);ee(t,c),ee(t,u),ee(u,d),ee(u,f),ee(u,m);for(let e=0;e<w.length;e+=1)w[e].m(m,null);g=!0},p(e,[t]){const r={};if(256&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r),e[0].winners.length>1?p||(p=Zr(),p.c(),p.m(s,null)):p&&(p.d(1),p=null),1&t){let n;for(h=e[0].winners,n=0;n<h.length;n+=1){const r=Ur(e,h,n);y[n]?y[n].p(r,t):(y[n]=Qr(r),y[n].c(),y[n].m(a,null))}for(;n<y.length;n+=1)y[n].d(1);y.length=h.length}if(2&t){let n;for(v=e[1],n=0;n<v.length;n+=1){const r=Gr(e,v,n);w[n]?w[n].p(r,t):(w[n]=Yr(r),w[n].c(),w[n].m(m,null))}for(;n<w.length;n+=1)w[n].d(1);w.length=v.length}},i(e){g||(Je(n.$$.fragment,e),g=!0)},o(e){Ze(n.$$.fragment,e),g=!1},d(e){e&&oe(t),st(n),p&&p.d(),se(y,e),se(w,e)}}}function Xr(e,t){return e.files===t.files?null!=e.name&&null!=t.name?e.name.localeCompare(t.name):null==e.name?null==t.name?0:1:-1:t.files-e.files}function eo(e,t,n){let r,{gameover:o}=t;return Zt.set([]),e.$$set=e=>{"gameover"in e&&n(0,o=e.gameover)},e.$$.update=()=>{1&e.$$.dirty&&n(1,r=o.roster.slice(0).sort(Xr))},[o,r]}class to extends lt{constructor(e){super(),it(this,e,eo,Kr,B,{gameover:0})}}function no(e,t,n){const r=e.slice();return r[2]=t[n],r}function ro(e){let t,n,r,o;return{c(){t=ie("span"),n=le("svg"),r=le("path"),fe(r,"fill","currentColor"),fe(r,"d","M483.55,227.55H462c-50.68,0-76.07-61.27-40.23-97.11L437,115.19A28.44,28.44,0,0,0,396.8,75L381.56,90.22c-35.84,35.83-97.11,10.45-97.11-40.23V28.44a28.45,28.45,0,0,0-56.9,0V50c0,50.68-61.27,76.06-97.11,40.23L115.2,75A28.44,28.44,0,0,0,75,115.19l15.25,15.25c35.84,35.84,10.45,97.11-40.23,97.11H28.45a28.45,28.45,0,1,0,0,56.89H50c50.68,0,76.07,61.28,40.23,97.12L75,396.8A28.45,28.45,0,0,0,115.2,437l15.24-15.25c35.84-35.84,97.11-10.45,97.11,40.23v21.54a28.45,28.45,0,0,0,56.9,0V462c0-50.68,61.27-76.07,97.11-40.23L396.8,437A28.45,28.45,0,0,0,437,396.8l-15.25-15.24c-35.84-35.84-10.45-97.12,40.23-97.12h21.54a28.45,28.45,0,1,0,0-56.89ZM224,272a48,48,0,1,1,48-48A48,48,0,0,1,224,272Zm80,56a24,24,0,1,1,24-24A24,24,0,0,1,304,328Z"),fe(n,"aria-hidden","false"),fe(n,"focusable","false"),fe(n,"data-prefix","fas"),fe(n,"data-icon","virus"),fe(n,"class","inline-block w-6"),fe(n,"role","img"),fe(n,"xmlns","http://www.w3.org/2000/svg"),fe(n,"viewBox","0 0 512 512"),fe(t,"style",o=e[2].icon.color?`color: ${e[2].icon.color}`:void 0)},m(e,o){re(e,t,o),ee(t,n),ee(n,r)},p(e,n){1&n&&o!==(o=e[2].icon.color?`color: ${e[2].icon.color}`:void 0)&&fe(t,"style",o)},d(e){e&&oe(t)}}}function oo(e){let t,n,r,o;return{c(){t=ie("span"),n=le("svg"),r=le("path"),fe(r,"fill","currentColor"),fe(r,"d","M624 128H480v256h144a16 16 0 0 0 16-16V144a16 16 0 0 0-16-16zm-40 184a16 16 0 0 1-16 16h-16a16 16 0 0 1-16-16v-16a16 16 0 0 1 16-16h16a16 16 0 0 1 16 16zm0-96a16 16 0 0 1-16 16h-16a16 16 0 0 1-16-16v-16a16 16 0 0 1 16-16h16a16 16 0 0 1 16 16zM432 96H64a64 64 0 0 0-64 64v192a64 64 0 0 0 64 64h368a16 16 0 0 0 16-16V112a16 16 0 0 0-16-16z"),fe(n,"aria-hidden","true"),fe(n,"focusable","false"),fe(n,"data-prefix","fas"),fe(n,"class","inline-block w-6"),fe(n,"role","img"),fe(n,"xmlns","http://www.w3.org/2000/svg"),fe(n,"viewBox","0 0 640 512"),fe(t,"style",o=e[2].icon.color?`color: ${e[2].icon.color}`:void 0)},m(e,o){re(e,t,o),ee(t,n),ee(n,r)},p(e,n){1&n&&o!==(o=e[2].icon.color?`color: ${e[2].icon.color}`:void 0)&&fe(t,"style",o)},d(e){e&&oe(t)}}}function so(e){let t,n,r,o;return{c(){t=ie("span"),n=le("svg"),r=le("path"),fe(r,"fill","currentColor"),fe(r,"d","M383.9 308.3l23.9-62.6c4-10.5-3.7-21.7-15-21.7h-58.5c11-18.9 17.8-40.6 17.8-64v-.3c39.2-7.8 64-19.1 64-31.7 0-13.3-27.3-25.1-70.1-33-9.2-32.8-27-65.8-40.6-82.8-9.5-11.9-25.9-15.6-39.5-8.8l-27.6 13.8c-9 4.5-19.6 4.5-28.6 0L182.1 3.4c-13.6-6.8-30-3.1-39.5 8.8-13.5 17-31.4 50-40.6 82.8-42.7 7.9-70 19.7-70 33 0 12.6 24.8 23.9 64 31.7v.3c0 23.4 6.8 45.1 17.8 64H56.3c-11.5 0-19.2 11.7-14.7 22.3l25.8 60.2C27.3 329.8 0 372.7 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-48.4-25.8-90.4-64.1-114.1zM176 480l-41.6-192 49.6 32 24 40-32 120zm96 0l-32-120 24-40 49.6-32L272 480zm41.7-298.5c-3.9 11.9-7 24.6-16.5 33.4-10.1 9.3-48 22.4-64-25-2.8-8.4-15.4-8.4-18.3 0-17 50.2-56 32.4-64 25-9.5-8.8-12.7-21.5-16.5-33.4-.8-2.5-6.3-5.7-6.3-5.8v-10.8c28.3 3.6 61 5.8 96 5.8s67.7-2.1 96-5.8v10.8c-.1.1-5.6 3.2-6.4 5.8z"),fe(n,"aria-hidden","true"),fe(n,"focusable","false"),fe(n,"data-prefix","fas"),fe(n,"data-icon","user-secret"),fe(n,"class","inline-block w-6"),fe(n,"role","img"),fe(n,"xmlns","http://www.w3.org/2000/svg"),fe(n,"viewBox","0 0 448 512"),fe(t,"style",o=e[2].icon.color?`color: ${e[2].icon.color}`:void 0)},m(e,o){re(e,t,o),ee(t,n),ee(n,r)},p(e,n){1&n&&o!==(o=e[2].icon.color?`color: ${e[2].icon.color}`:void 0)&&fe(t,"style",o)},d(e){e&&oe(t)}}}function io(e){let t,n;return{c(){t=le("svg"),n=le("path"),fe(n,"stroke-linecap","round"),fe(n,"stroke-linejoin","round"),fe(n,"stroke-width","2"),fe(n,"d","M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"),fe(t,"xmlns","http://www.w3.org/2000/svg"),fe(t,"class","h-6 w-6 text-red-400"),fe(t,"fill","none"),fe(t,"viewBox","0 0 24 24"),fe(t,"stroke","currentColor"),fe(t,"aria-hidden","true")},m(e,r){re(e,t,r),ee(t,n)},p:I,d(e){e&&oe(t)}}}function lo(e){let t,n,r=e[2].desc+"";return{c(){t=ie("p"),n=ae(r),fe(t,"class","mt-1 text-sm text-gray-600 dark:text-gray-300")},m(e,r){re(e,t,r),ee(t,n)},p(e,t){1&t&&r!==(r=e[2].desc+"")&&me(n,r)},d(e){e&&oe(t)}}}function ao(e,t){let n,r,o,s,i,l,a,c,u,d,f,m,g,p,h,y,v,w,x,b=t[2].title+"",$=I;function _(e,t){return e[2].icon&&"error"!==e[2].icon.type?"agent"===e[2].icon.type?so:"usb"===e[2].icon.type?oo:"virus"===e[2].icon.type?ro:void 0:io}let k=_(t),C=k&&k(t),O=t[2].desc&&lo(t);function j(){return t[1](t[2])}return{key:e,first:null,c(){n=ie("div"),r=ie("div"),o=ie("div"),s=ie("div"),C&&C.c(),i=ce(),l=ie("div"),a=ie("p"),c=ae(b),u=ce(),O&&O.c(),d=ce(),f=ie("div"),m=ie("button"),m.innerHTML='<span class="sr-only">Close</span> \n            \n            <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>',g=ce(),fe(s,"class","flex-shrink-0"),fe(a,"class","text-sm font-medium text-gray-900 dark:text-white"),fe(l,"class","ml-3 w-0 flex-1 pt-0.5"),fe(m,"class","rounded-md inline-flex text-gray-400 dark:text-gray-600 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-svelte"),fe(f,"class","ml-4 flex-shrink-0 flex"),fe(o,"class","flex items-start"),fe(r,"class","p-4"),fe(n,"class","max-w-sm w-full mb-4 bg-white shadow-lg dark:bg-gray-900 dark:shadow-xl dark:border border-gray-500 rounded-lg pointer-events-auto ring-1 ring-black ring-opacity-5 overflow-hidden z-50"),this.first=n},m(e,t){re(e,n,t),ee(n,r),ee(r,o),ee(o,s),C&&C.m(s,null),ee(o,i),ee(o,l),ee(l,a),ee(a,c),ee(l,u),O&&O.m(l,null),ee(o,d),ee(o,f),ee(f,m),ee(n,g),v=!0,w||(x=de(m,"click",j),w=!0)},p(e,n){k===(k=_(t=e))&&C?C.p(t,n):(C&&C.d(1),C=k&&k(t),C&&(C.c(),C.m(s,null))),(!v||1&n)&&b!==(b=t[2].title+"")&&me(c,b),t[2].desc?O?O.p(t,n):(O=lo(t),O.c(),O.m(l,null)):O&&(O.d(1),O=null)},r(){y=n.getBoundingClientRect()},f(){ke(n),$(),Ce(n,y)},a(){$(),$=_e(n,y,kr,{duration:250})},i(e){v||(Ne((()=>{h&&h.end(1),p=Ye(n,hr,{duration:400}),p.start()})),v=!0)},o(e){p&&p.invalidate(),h=Ke(n,hr,{duration:250}),v=!1},d(e){e&&oe(n),C&&C.d(),O&&O.d(),e&&h&&h.end(),w=!1,x()}}}function co(e){let t,n,r=[],o=new Map,s=e[0];const i=e=>e[2];for(let t=0;t<s.length;t+=1){let n=no(e,s,t),l=i(n);o.set(l,r[t]=ao(l,n))}return{c(){t=ie("div");for(let e=0;e<r.length;e+=1)r[e].c();fe(t,"aria-live","assertive"),fe(t,"class","fixed inset-0 flex flex-col-reverse items-end justify-center px-4 py-6 pointer-events-none sm:p-6 sm:items-end sm:justify-end z-50")},m(e,o){re(e,t,o);for(let e=0;e<r.length;e+=1)r[e].m(t,null);n=!0},p(e,[n]){if(1&n){s=e[0],Ge();for(let e=0;e<r.length;e+=1)r[e].r();r=nt(r,n,i,1,e,s,o,t,tt,ao,null,no);for(let e=0;e<r.length;e+=1)r[e].a();Ue()}},i(e){if(!n){for(let e=0;e<s.length;e+=1)Je(r[e]);n=!0}},o(e){for(let e=0;e<r.length;e+=1)Ze(r[e]);n=!1},d(e){e&&oe(t);for(let e=0;e<r.length;e+=1)r[e].d()}}}function uo(e,t,n){let r;q(e,Zt,(e=>n(0,r=e)));return[r,e=>Yt(e)]}class fo extends lt{constructor(e){super(),it(this,e,uo,co,B,{})}}function mo(e){let t,n;return t=new Fr({}),{c(){rt(t.$$.fragment)},m(e,r){ot(t,e,r),n=!0},p:I,i(e){n||(Je(t.$$.fragment,e),n=!0)},o(e){Ze(t.$$.fragment,e),n=!1},d(e){st(t,e)}}}function go(e){let t,n;return t=new to({props:{gameover:e[0].context.gameOver}}),{c(){rt(t.$$.fragment)},m(e,r){ot(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.gameover=e[0].context.gameOver),t.$set(r)},i(e){n||(Je(t.$$.fragment,e),n=!0)},o(e){Ze(t.$$.fragment,e),n=!1},d(e){st(t,e)}}}function po(e){let t,n;return t=new Dn({props:{gameId:e[0].context.gameId,state:e[0].machine.current,name:e[0].context.me.name}}),{c(){rt(t.$$.fragment)},m(e,r){ot(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.gameId=e[0].context.gameId),1&n&&(r.state=e[0].machine.current),1&n&&(r.name=e[0].context.me.name),t.$set(r)},i(e){n||(Je(t.$$.fragment,e),n=!0)},o(e){Ze(t.$$.fragment,e),n=!1},d(e){st(t,e)}}}function ho(e){let t;return{c(){t=ie("h1"),t.textContent="Init"},m(e,n){re(e,t,n)},p:I,i:I,o:I,d(e){e&&oe(t)}}}function yo(e){let t,n;return t=new vn({}),{c(){rt(t.$$.fragment)},m(e,r){ot(t,e,r),n=!0},p:I,i(e){n||(Je(t.$$.fragment,e),n=!0)},o(e){Ze(t.$$.fragment,e),n=!1},d(e){st(t,e)}}}function vo(e){let t,n,r,o,s;const i=[yo,ho,po,go,mo],l=[];function a(e,t){return"create"===e[0].machine.current||"creating"===e[0].machine.current?0:"init"===e[0].machine.current?1:"welcome"===e[0].machine.current||"waiting"===e[0].machine.current?2:"gameover"===e[0].machine.current?3:4}return t=a(e),n=l[t]=i[t](e),o=new fo({}),{c(){n.c(),r=ce(),rt(o.$$.fragment)},m(e,n){l[t].m(e,n),re(e,r,n),ot(o,e,n),s=!0},p(e,[o]){let s=t;t=a(e),t===s?l[t].p(e,o):(Ge(),Ze(l[s],1,1,(()=>{l[s]=null})),Ue(),n=l[t],n?n.p(e,o):(n=l[t]=i[t](e),n.c()),Je(n,1),n.m(r.parentNode,r))},i(e){s||(Je(n),Je(o.$$.fragment,e),s=!0)},o(e){Ze(n),Ze(o.$$.fragment,e),s=!1},d(e){l[t].d(e),e&&oe(r),st(o,e)}}}function wo(e,t,n){let r;q(e,cn,(e=>n(0,r=e)));let{cid:o}=t,{gid:s}=t;return r.send(yt("cid",{cid:o})),r.send(yt(vt,{gameId:s})),e.$$set=e=>{"cid"in e&&n(1,o=e.cid),"gid"in e&&n(2,s=e.gid)},[r,o,s]}class xo extends lt{constructor(e){super(),it(this,e,wo,vo,B,{cid:1,gid:2})}}const bo=2147483647,$o="abcdefghijkmnpqrstuvwxyz-ABCDEFGHJKLMNPQRSTUVWXYZ_23456789",_o=$o.length;function ko(){const e=new Uint32Array(1);return window.crypto.getRandomValues(e),(e[0]&bo)/bo}function Co(e="local"){return"local"===e?"localStorage":"sessionStorage"}function Oo(e){return function(e,t){const n=window[Co(t)].getItem(e)||"null";return JSON.parse(n)}(e,"local")}function jo(e,t){return function(e,t,n){void 0===t&&(t=null);const r=JSON.stringify(t);return window[Co(n)].setItem(e,r),r}(e,t,"local")}function Lo(e){let t,n,r,o,s,i;return t=new gt({}),r=new mt({}),s=new xo({props:{cid:e[0],gid:e[1]}}),{c(){rt(t.$$.fragment),n=ce(),rt(r.$$.fragment),o=ce(),rt(s.$$.fragment)},m(e,l){ot(t,e,l),re(e,n,l),ot(r,e,l),re(e,o,l),ot(s,e,l),i=!0},p(e,[t]){const n={};1&t&&(n.cid=e[0]),2&t&&(n.gid=e[1]),s.$set(n)},i(e){i||(Je(t.$$.fragment,e),Je(r.$$.fragment,e),Je(s.$$.fragment,e),i=!0)},o(e){Ze(t.$$.fragment,e),Ze(r.$$.fragment,e),Ze(s.$$.fragment,e),i=!1},d(e){st(t,e),e&&oe(n),st(r,e),e&&oe(o),st(s,e)}}}function zo(e,t,n){const r=Oo("CID");let o="";null==r?(o=function(e=7){let t="";for(;e;){const n=ko()*_o;t+=$o.charAt(n),e-=1}return t}(),jo("CID",o)):o=r;let[s,i]=window.location.pathname.slice(1).split("/");return"g"===s&&i.match(/^[0-9a-f]{64}$/)||(i=""),[o,i]}return new class extends lt{constructor(e){super(),it(this,e,zo,Lo,B,{})}}({target:document.body})}();
