chromatic-lattice/assets/index.609ecad2.js

19 lines
130 KiB
JavaScript
Raw Normal View History

/* empty css */import"./vue.228877f7.js";import{q as Be,C as s,aa as B,t as M,aE as h,a0 as w,aK as xe,bu as tt,G as te,ar as Te,Z as D,ay as pt,a1 as f,J as P,O as U,aJ as he,$ as F,I as ve,a8 as y,b6 as T,a7 as V,aH as fe,aF as me,u as Mt,aG as ot,A as de,_ as q,b8 as bt,bs as Kt,aq as Re,bb as xt,T as Pn,j as En,l as pe,bv as At,b1 as oe,w as Je,b2 as Ft,ax as Vn,aL as ct,aN as se,z as Pe,br as On,bn as Ln,be as Dn}from"./@vue.8948d9b0.js";import{L as we}from"./lz-string.f2f3b7cf.js";import{c as Yt}from"./nanoevents.1080beb7.js";import{l as qn}from"./socket.io-client.03bb8f3a.js";import{n as Rn,l as Bn,t as An,r as Un}from"./unique-names-generator.9178d3e3.js";import{u as Xt,s as zn}from"./vue-toastification.97914fdb.js";import{s as jn}from"./semver.334eb41f.js";import{p as Gn}from"./vue-textarea-autosize.35804eaf.js";import{Y as Hn}from"./vue-next-select.f2be13cc.js";import{D as Wn}from"./vuedraggable.5218041c.js";import{v as Jn,n as Zn}from"./workbox-window.8d14e8b7.js";import"./lru-cache.9506e0ec.js";import"./yallist.fd762fe7.js";import"./engine.io-client.6ba5801d.js";import"./engine.io-parser.730afdce.js";import"./@socket.io.aec831e2.js";import"./socket.io-parser.0ab387d5.js";import"./sortablejs.692999e9.js";const Kn=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}};Kn();const Yn="modulepreload",Ut={},Xn="./",dt=function(t,n){return!n||n.length===0?t():Promise.all(n.map(r=>{if(r=`${Xn}${r}`,r in Ut)return;Ut[r]=!0;const i=r.endsWith(".css"),o=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${o}`))return;const c=document.createElement("link");if(c.rel=i?"stylesheet":Yn,i||(c.as="script",c.crossOrigin=""),c.href=r,document.head.appendChild(c),i)return new Promise((u,d)=>{c.addEventListener("load",u),c.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>t())},Qn="./projInfo-schema.json",er="Chromatic Latice",tr="A multiplayer game about light and hexagons",nr="chromatic",rr="thepaperpilot",ir="",ar="",or="0.0.0",sr="Initial Commit",lr=!1,ur=!1,cr=2,dr=!0,fr=null,mr="",gr=["main"],hr=3600,vr=1,pr=!0,br="base64";var R={$schema:Qn,title:er,description:tr,id:nr,author:rr,discordName:ir,discordLink:ar,versionNumber:or,versionTitle:sr,allowGoBack:lr,defaultShowSmall:ur,defaultDecimalsShown:cr,useHeader:dr,banner:fr,logo:mr,initialTabs:gr,maxTickLength:hr,offlineLimit:vr,enablePausing:pr,exportEncoding:br};const _r=Be({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var O=window.player=_r;function Tt(e){return JSON.stringify(e,(t,n)=>s(n))}var H=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n};const yr=["onClick"],wr=B({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=M(!1),r=M(null);function i(){t("click"),r.value&&clearTimeout(r.value),n.value=!1,Te(()=>{n.value=!0,r.value=setTimeout(()=>n.value=!1,500)})}return(o,c)=>(h(),w("button",{onClick:tt(i,["stop"]),class:te(["feedback",{activated:n.value,left:e.left}])},[xe(o.$slots,"default",{},void 0,!0)],10,yr))}});var Qt=H(wr,[["__scopeId","data-v-01a1b95c"]]);const _t=e=>(fe("data-v-ac351c02"),e=e(),me(),e),Nr={class:"error"},Cr={class:"error-title"},Sr={class:"error-details",style:{"margin-top":"-10px"}},Ir={key:0},$r={class:"instructions"},kr=V(" Check the console for more details, and con
`))),i=D(()=>t.errors.map(c=>c.cause==null?[]:(typeof c.cause=="string"?c.cause:JSON.stringify(c.cause)).split(`
`)));function o(){let c=Tt(O);switch(R.exportEncoding){default:console.warn(`Unknown save encoding: ${R.exportEncoding}. Defaulting to lz`);case"lz":c=we.compressToUTF16(c);break;case"base64":c=btoa(unescape(encodeURIComponent(c)));break;case"plain":break}console.log(c);const u=document.createElement("textarea");u.value=c,document.body.appendChild(u),u.select(),u.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(u)}return pt(()=>{O.autosave=!1,O.devSpeed=0}),(c,u)=>(h(),w("div",Nr,[f("h1",Cr,P(s(n).name)+": "+P(s(n).message),1),f("div",Sr,[s(n).cause?(h(),w("div",Ir,[(h(!0),w(U,null,he(s(i)[0],d=>(h(),w("div",{key:d},P(d),1))),128))])):F("",!0),s(n).stack?(h(),w("div",{key:1,style:ve(s(n).cause?"margin-top: 10px":"")},[(h(!0),w(U,null,he(s(r)[0],d=>(h(),w("div",{key:d},P(d),1))),128))],4)):F("",!0)]),f("div",$r,[kr,f("a",{href:s(R).discordLink||"https://discord.gg/yJ4fjnjU54",class:"discord-link"},"discord",8,Mr),xr,y(Qt,{onClick:o,class:"button",style:{display:"inline-flex"}},{default:T(()=>[Fr,Tr]),_:1}),Pr,e.errors.length>1?(h(),w("div",Er,Or)):F("",!0),(h(!0),w(U,null,he(e.errors.slice(1),(d,v)=>(h(),w("div",{key:v,style:{"margin-top":"20px"}},[f("details",Lr,[f("summary",null,P(d.name)+": "+P(d.message),1),d.cause?(h(),w("div",Dr,[(h(!0),w(U,null,he(s(i)[v+1],_=>(h(),w("div",{key:_},P(_),1))),128))])):F("",!0),d.stack?(h(),w("div",qr,[(h(!0),w(U,null,he(s(r)[v+1],_=>(h(),w("div",{key:_},P(_),1))),128))])):F("",!0)])]))),128))])]))}});var en=H(Rr,[["__scopeId","data-v-ac351c02"]]);class Br{constructor(t){this.map=new Map,this.first=void 0,this.last=void 0,this.maxSize=t}get size(){return this.map.size}get(t){const n=this.map.get(t);if(n!==void 0)return n!==this.first&&(n===this.last?(this.last=n.prev,this.last.next=void 0):(n.prev.next=n.next,n.next.prev=n.prev),n.next=this.first,this.first.prev=n,this.first=n),n.value}set(t,n){if(this.maxSize<1)return;if(this.map.has(t))throw new Error("Cannot update existing keys in the cache");const r=new Ar(t,n);for(this.first===void 0?(this.first=r,this.last=r):(r.next=this.first,this.first.prev=r,this.first=r),this.map.set(t,r);this.map.size>this.maxSize;){const i=this.last;this.map.delete(i.key),this.last=i.prev,this.last.next=void 0}}}class Ar{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const St=17,Ur=9e15,zr=Math.log10(9e15),jr=1/9e15,Gr=308,Hr=-324,zt=5,Wr=(1<<10)-1,Jr=function(){const e=[];for(let n=Hr+1;n<=Gr;n++)e.push(Number("1e"+n));const t=323;return function(n){return e[n+t]}}(),Ve=[2,Math.E,3,4,5,6,7,8,9,10],Zr=[[1,1.0891180521811203,1.1789767925673957,1.2701455431742086,1.3632090180450092,1.4587818160364217,1.5575237916251419,1.6601571006859253,1.767485818836978,1.8804192098842727,2],[1,1.1121114330934079,1.231038924931609,1.3583836963111375,1.4960519303993531,1.6463542337511945,1.8121385357018724,1.996971324618307,2.2053895545527546,2.4432574483385254,Math.E],[1,1.1187738849693603,1.2464963939368214,1.38527004705667,1.5376664685821402,1.7068895236551784,1.897001227148399,2.1132403089001035,2.362480153784171,2.6539010333870774,3],[1,1.1367350847096405,1.2889510672956703,1.4606478703324786,1.6570295196661111,1.8850062585672889,2.1539465047453485,2.476829779693097,2.872061932789197,3.3664204535587183,4],[1,1.1494592900767588,1.319708228183931,1.5166291280087583,1.748171114438024,2.0253263297298045,2.3636668498288547,2.7858359149579424,3.3257226212448145,4.035730287722532,5],[1,1.159225940787673,1.343712473580932,1.5611293155111927,1.8221199554561318,2.14183924486326,2.542468319282638,3.0574682501653316,3.7390572020926873,4.6719550537360774,6],[1,1.1670905356972596,1.3632807444991446,1.5979222279405536,1.8842640123816674,2.2416069644878687,2.69893426559423,3.3012632110403577,4.121250340630164,5.281493033448316,7],[1,1.1736630594087796,1.379783782386201,1.6292821855668218,1.9378971836180754,2.3289975651071977,2.8384347394720835,3.5232708454565906,4.478242031114584,5.868592169644505,8],[1,1.1793017514670474,1.394054150657457,1.65664127441059,1.985170999970283,2.4069682290577457,2.9647310119960752,3.7278665
Stack: ${ge}
Trying to pop ${n.id}`);ge.pop(),ee(n,"color"),ee(n,"display"),ee(n,"classes"),ee(n,"style"),ee(n,"name"),Fe(n,"name",n.id),ee(n,"minWidth"),Fe(n,"minWidth",600),ee(n,"minimizable"),Fe(n,"minimizable",!0),ee(n,"minimizedDisplay");const i=n.style;return n.style=D(()=>{var c,u;let o=s(n.minWidth);return(typeof o=="number"||!Number.isNaN(parseInt(o)))&&(o=o+"px"),[(c=s(i))!=null?c:"",(u=n.minimized)!=null&&u.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:o,flexBasis:o,margin:""}]}),n})}function pn(e,t){if(console.info("Adding layer",e.id),re[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,re[e.id]);return}Fe(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),re[e.id]=e,Q.emit("addLayer",e,t.layers[e.id])}function Mi(e){return re[e]}function bn(e){console.info("Removing layer",e.id),Q.emit("removeLayer",e),re[e.id]=void 0}function xi(e){bn(e),pn(e,O)}function Fi(e){const t=M(!1);return{openModal:()=>t.value=!0,modal:ne(()=>y(Ee,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},{header:()=>y("h2",null,[s(e.name)]),body:s(e.display)}))}}Q.on("update",function(t){Object.values(re).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(re).forEach(n=>{n==null||n.emit("update",t)}),Object.values(re).forEach(n=>{n==null||n.emit("postUpdate",t)})});var Ti=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:fn,UnregisterNodeInjectionKey:mn,NodesInjectionKey:gn,BoundsInjectionKey:hn,layers:re,persistentRefs:je,addingLayers:ge,createLayer:vn,addLayer:pn,getLayer:Mi,removeLayer:bn,reloadLayer:xi,setupLayerModal:Fi},Symbol.toStringTag,{value:"Module"}));const _n=l.ln(10);function st(e){return e}function Xe(e,...t){const n=t.find(r=>N(r));return n==null?(console.error("Could not invert due to no input being a variable"),0):n.invert(e)}function Pi(e,t){return N(t)?t.invert(l.neg(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ei(e,t){return N(t)?t.isIntegrable()?a.neg(t.getIntegralFormula(e)):(console.error("Could not integrate due to variable not being integrable"),a.constant(0)):(console.error("Could not integrate due to no input being a variable"),a.constant(0))}function Vi(e){return a.neg(e)}function Oi(e,t,n){return N(t)?t.invert(l.sub(e,Y(n))):N(n)?n.invert(l.sub(e,Y(t))):(console.error("Could not invert due to no input being a variable"),0)}function Li(e,t,n){var r,i;if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const o=t.getIntegralFormula(e);return a.times(n,(r=t.innermostVariable)!=null?r:0).add(o)}else if(N(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const o=n.getIntegralFormula(e);return a.times(t,(i=n.innermostVariable)!=null?i:0).add(o)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Di(e,t,n){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const r=t.getIntegralFormula(e);return a.add(r,n)}else if(N(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const r=n.getIntegralFormula(e);return a.add(r,t)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function qi(e,t,n){return N(t)?t.invert(l.add(e,Y(n))):N(n)?n.invert(l.sub(Y(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function Ri(e,t,n){var r,i;if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const o=t.getIntegralFormula(e);return a.sub(o,a.times(n,(r=t.innermostVariable)!=null?r:0))}else if(N(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const o=n.getIntegralFormula(e);return a.times(t,(i=n.innermostVariable)!=null?i:
`).slice(3,5).map(n=>n.trim()).join(`
`))!=null?t:""}function Jt(e,t){var n;l.isNaN(t)&&(K.hasNaN||(O.autosave=!1,K.hasNaN=!0,K.NaNPath=e[De],K.NaNPersistent=e),console.error(`Attempted to save NaN value to ${(n=e[De])==null?void 0:n.join(".")}`)),e[Ge].value=t}function Ot(e,t=!0){const n=pe(e)?e:M(e);pe(e)&&(e=e.value);const r=D({get(){return n.value},set(o){t?Jt(i,o):i[Ge].value=o}});r[ht]=e;const i={get value(){return n.value},set value(o){t?Jt(i,o):i[Ge].value=o},__v_isRef:!0,[Ge]:n,[ht]:e,[vt]:oo(),[kt]:!1,[Le]:r,[De]:void 0};return ge.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",i,`
Created at:
`+i[vt]):je[ge[ge.length-1]].add(i),i}function so(e){return e!=null&&typeof e=="object"&&Ge in e}Q.on("addLayer",(e,t)=>{const n=[],r=(i,o=[])=>{let c=!1;return Object.keys(i).forEach(u=>{let d=i[u];if(d!=null&&typeof d=="object"){if(d[ao]===!0)return;if($e in d&&(d=d[$e]),so(d)){if(c=!0,d[kt]){console.warn("Deleted persistent ref present in returned object. Ignoring...",d,`
Created at:
`+d[vt]);return}je[e.id].delete(d);const v=[e.id,...o,u];d[De]!=null&&JSON.stringify(v)!==JSON.stringify(d[De])&&console.error(`Persistent ref is being saved to \`${v.join(".")}\` when it's already present at \`${d[De].join(".")}\`.`,"This can cause unexpected behavior when loading saves between updates."),d[De]=v;const _=o.reduce((C,k)=>(k in C||(C[k]={}),C[k]),t),p=_[u];_[u]=d[Ge],En(_)?p!=null?_[u]=p:_[u]=d[ht]:p!=null?_[u].value=p:_[u].value=d[ht]}else!(d instanceof l)&&!(d instanceof a)&&!pe(d)&&!n.includes(d)&&(typeof d.type=="symbol"&&n.push(d),r(d,[...o,u])&&(At(d)&&!At(i)?console.warn("Found array that contains persistent values when adding layer. Keep in mind changing the order of elements in the array will mess with existing player saves.",$e in i?i[$e]:i,u):c=!0))}}),c};r(e[$e]),je[e.id].forEach(i=>{i[kt]||console.error(`Created persistent ref in ${e.id} without registering it to the layer!`,`Make sure to include everything persistent in the returned object.
Created at:
`+i[vt])}),je[e.id].clear()});const $e=Symbol("ProxyState");function yn(e,t={}){const n=t;let r=!1,i=!1;function o(){return r||(i&&console.error("Cyclical dependency detected. Cannot evaluate lazy proxy."),i=!0,Object.assign(n,e.call(n,n)),r=!0),n}return new Proxy(n,{get(c,u){if(u===$e)return o();const d=o()[u];return d!=null&&typeof d=="object"&&Le in d?d[Le]:d},set(c,u,d){return o()[u]=d,!0},has(c,u){return u===$e?!0:Reflect.has(o(),u)},ownKeys(){return Reflect.ownKeys(o())},getOwnPropertyDescriptor(c,u){return r||(Object.assign(n,e.call(n,n)),r=!0),Object.getOwnPropertyDescriptor(c,u)}})}const He=M(!1),ae=M(null),_e=M(!1),Lt=M({});M({});const Zt=Xt(),Ue=M(),lt=M("");function ze(e,...t){var n;!He.value||(n=Ue.value)==null||n.emit(e,...t)}function lo(){return O.layers.main[$e]}Q.on("loadSettings",e=>{Fe(e,"server",window.location.origin),Fe(e,"nickname",co()),oe(()=>e.server,t=>{Ue.value&&Ue.value.close(),Ue.value=qn(t),uo(Ue.value),He.value=!1,lt.value="",Ue.value.connect()},{immediate:!0}),oe(()=>e.nickname,t=>{ae.value&&ze("set nickname",t)})});function uo(e){e.on("connect",()=>{lt.value="",He.value=!0}),e.on("connect_error",t=>{lt.value=`${t.name}: ${t.message}`}),e.on("disconnect",(t,n)=>{var r;lt.value=n instanceof Error?`${n.name}: ${n.message}`:(r=n==null?void 0:n.description)!=null?r:t,He.value=!1}),e.on("server version",t=>{jn(R.versionNumber,t)||(Zt.info("Server only accepts game versions in range: "+t),e.disconnect())}),e.on("info",t=>{Zt.info(t),Q.emit("serverSentInfo")}),e.on("chat",(t,n)=>{Q.emit("chat",t,n)}),e.on("set rooms",t=>{Q.emit("setRooms",t)}),e.on("joined room",(t,n)=>{ae.value=t,_e.value=n,Q.emit("chat",void 0,"you joined "+t)}),e.on("left room",()=>{ae.value=null}),e.on("set nicknames",t=>{Lt.value=t})}function co(){return Rn({dictionaries:[Bn,An,Un],length:3,separator:" ",style:"capital"})}oe(He,e=>{!e&&ae.value&&fo()});function fo(){_e.value||Nn(),ae.value=null,_e.value=!1}function wn(e={}){return Object.assign({id:`${R.id}-0`,name:"Default Save",tabs:R.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:R.id,modVersion:R.versionNumber,layers:{}},e)}function ue(e){const t=we.compressToUTF16(Tt(e!=null?e:O));return localStorage.setItem((e!=null?e:O).id,t),t}async function Nn(){try{let e=localStorage.getItem(z.active);if(e==null){await ke(qe());return}if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=we.decompressFromUTF16(e);else throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==R.id){await ke(qe());return}t.id=z.active,await ke(t)}catch(e){console.error(`Failed to load save. Falling back to new save.
`,e),await ke(qe())}}function qe(){const e=ut(),t=wn({id:e});return ue(t),z.saves.push(e),t}function ut(){let e,t=0;do e=`${R.id}-${t++}`;while(localStorage.getItem(e)!=null);return e}const mo=M(!1);async function ke(e){console.info("Loading save",e),mo.value=!0;const{layers:t,removeLayer:n,addLayer:r}=await dt(()=>Promise.resolve().then(function(){return Ti}),void 0),{fixOldSave:i,getInitialLayers:o}=await dt(()=>Promise.resolve().then(function(){return bu}),void 0);for(const c in t){const u=t[c];u&&n(u)}o(e).forEach(c=>r(c,e)),e=wn(e),e.offlineProd&&e.time!=null&&e.time&&e.devSpeed!==0&&(e.offlineTime==null&&(e.offlineTime=0),e.offlineTime+=Math.min(e.offlineTime+(Date.now()-e.time)/1e3,R.offlineLimit*3600)),e.time=Date.now(),e.modVersion!==R.versionNumber&&(i(e.modVersion,e),e.modVersion=R.versionNumber),Object.assign(O,e),z.active=O.id,Q.emit("onLoad")}setInterval(()=>{O.autosave&&(!ae.value||_e.value)&&ue()},1e3);window.onbeforeunload=()=>{O.autosave&&(!ae.value||_e.value)&&ue()};window.save=ue;const go=window.hardReset=async()=>{await ke(qe())};window.deleteLowerSaves=()=>{const e=Object.values(z.saves).indexOf(O.id)+1;Object.values(z.saves).slice(e).forEach(t=>localStorage.removeItem(t)),z.saves=z.saves.slice(0,e)};const it=Be({active:"",saves:[],showTPS:!0,theme:Vt.Nordic,unthrottled:!1,alignUnits:!1});oe(it,e=>{const t=we.compressToUTF16(JSON.stringify(e));localStorage.setItem(R.id,t)},{deep:!0});var z=window.settings=it;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:Vt.Nordic,alignUnits:!1};Q.emit("loadSettings",e),Object.assign(it,e),go()};function ho(){try{let e=localStorage.getItem(R.id);if(e!=null&&e!==""){if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=we.decompressFromUTF16(e);else{console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(it,t)}Q.emit("loadSettings",it)}catch{}}const vo=Be([]),po=Be([]),bo=Be([]);function ye(e,t="span"){return typeof e=="function"?B({render:e}):typeof e=="string"?e.length>0?(e=e.trim(),e.charAt(0)!=="<"&&(e=`<${t}>${e}</${t}>`),B({template:e})):B({render:()=>({})}):e}function wt(e){if(et(e))return typeof e=="function"?e():ye(e);const t=e[mt];return y(t,e[Et](),null)}function _o(e){if(et(e))return typeof e=="function"?e():typeof e=="string"?y(U,null,[e]):y(e,null,null);const t=e[mt];return y(t,e[Et](),null)}function et(e){return typeof e=="string"?!0:typeof e=="object"?e==null?!1:"render"in e||"component"in e:typeof e=="function"&&e[nt]===!0}function Cn(e,t="div"){const n=Je();return Ft(()=>{n.value=ye(be(e),t)}),n}function Nt(e,t="div"){const n=Je(null);return Ft(()=>{const r=be(e);n.value=r==""||r==null?null:ye(r,t)}),n}function be(e){return s(s(e))}function J(...e){return e.includes(Object)||e.push(Object),e}const yo=B({components:{Context:dn,ErrorVue:en},props:{index:{type:Number,required:!0},display:{type:J(Object,String,Function),required:!0},minimizedDisplay:J(Object,String,Function),minimized:{type:Object,required:!0},name:{type:J(String),required:!0},color:J(String),minimizable:J(Boolean),nodes:{type:Object,required:!0}},emits:["setMinimized"],setup(e){const{display:t,index:n,minimized:r,minimizedDisplay:i}=de(e),o=Cn(t),c=Nt(i),u=D(()=>R.allowGoBack&&n.value>0&&!be(r));function d(){O.tabs.splice(s(e.index),1/0)}function v(p){e.nodes.value=p}const _=M([]);return Vn((p,C,k)=>(console.warn(`Error caught in "${e.name}" layer`,p,C,k),_.value.push(p instanceof Error?p:new Error(JSON.stringify(p))),!1)),{component:o,minimizedComponent:c,showGoBack:u,updateNodes:v,unref:s,goBack:d,errors:_}}}),wo={key:1};function No(e,t,n,r,i,o){const c=ct("ErrorVue"),u=ct("Context");return e.errors.length>0?(h(),q(c,{key:0,errors:e.errors},null,8,["errors"])):(h(),w("div",Re({key:1,class:"layer-container",style:{"--layer-color":e.unref(e.color)}},e.$attrs),[e.showGoBack?(h(),w("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...d)=>e.goBack&&e.goBack(...d))},"\u274C")):F("",!0),e.unref(e.minimized)?(h(),w("button",{key:1,class:"layer-tab minimized",onC
${j}
${x}`)}}return v[I]}oe(n,I=>{I&&Object.keys(v).forEach(x=>delete v[x])});const p=D(()=>z.saves.reduce((I,x)=>(I[x]=_(x),I),{}));function C(I){let x;switch(O.id===I?x=Tt(O):x=JSON.stringify(p.value[I]),R.exportEncoding){default:console.warn(`Unknown save encoding: ${R.exportEncoding}. Defaulting to lz`);case"lz":x=we.compressToUTF16(x);break;case"base64":x=btoa(unescape(encodeURIComponent(x)));break;case"plain":break}const j=document.createElement("textarea");j.value=x,document.body.appendChild(j),j.select(),j.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(j)}function k(I){O.id===I&&ue();const x={...p.value[I],id:ut()};ue(x),z.saves.push(x.id)}function b(I){z.saves=z.saves.filter(x=>x!==I),localStorage.removeItem(I),v[I]=void 0}function S(I){p.value[O.id].time=O.time,ue(),v[O.id]=void 0,ke(p.value[I]),v[I]=void 0}function $(I){if(c.value=I,Te(()=>{c.value=null}),I[0]!=="{")if(I[0]==="e")I=decodeURIComponent(escape(atob(I)));else if(I[0]==="\u1BE1")I=we.decompressFromUTF16(I);else{console.warn("Unable to determine preset encoding",I);return}const x=JSON.parse(I);x.id=ut(),ue(x),z.saves.push(x.id),S(x.id)}function A(I,x){const j=p.value[I];j!=null&&(j.name=x,O.id===I?(O.name=x,ue()):(ue(j),v[I]=void 0))}return(I,x)=>(h(),q(Ee,{modelValue:n.value,"onUpdate:modelValue":x[4]||(x[4]=j=>n.value=j),ref_key:"modal",ref:r},{header:T(()=>[gl]),body:T(({shown:j})=>[j&&(!s(ae)||s(_e))?(h(),q(s(Wn),{key:0,list:s(z).saves,handle:".handle",itemKey:Ce=>Ce},{item:T(({element:Ce})=>[y(ml,{save:s(p)[Ce],onOpen:Ye=>S(Ce),onExport:Ye=>C(Ce),onEditName:Ye=>A(Ce,Ye),onDuplicate:Ye=>k(Ce),onDelete:Ye=>b(Ce)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):(h(),w("div",hl,"You are connected to a server - cannot change saves"))]),footer:T(()=>[f("div",vl,[!s(ae)||s(_e)?(h(),q(Me,{key:0,modelValue:o.value,"onUpdate:modelValue":x[0]||(x[0]=j=>o.value=j),title:"Import Save",placeholder:"Paste your save here!",class:te({importingFailed:i.value})},null,8,["modelValue","class"])):F("",!0),!s(ae)||s(_e)?(h(),w("div",pl,[bl,f("div",_l,[f("button",{class:"button",onClick:x[1]||(x[1]=j=>S(s(qe)().id))},"New Game"),Object.keys(s(d)).length>0?(h(),q($n,{key:0,options:s(d),modelValue:c.value,"onUpdate:modelValue":x[2]||(x[2]=j=>$(j)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):F("",!0)])])):F("",!0),f("div",yl,[wl,f("button",{class:"button modal-default-button",onClick:x[3]||(x[3]=j=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var kn=H(Nl,[["__scopeId","data-v-f10c7950"]]);const ie=e=>(fe("data-v-1fa4f177"),e=e(),me(),e),Cl=["src","alt"],Sl={key:1,class:"title"},Il=ie(()=>f("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),$l={class:"discord"},kl={class:"discord-links"},Ml={key:0},xl=["href"],Fl=ie(()=>f("li",null,[f("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"Profectus & Friends")],-1)),Tl=ie(()=>f("li",null,[f("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),Pl={href:"https://forums.moddingtree.com/",target:"_blank"},El=ie(()=>f("span",{class:"material-icons"},"forum",-1)),Vl=ie(()=>f("span",{class:"material-icons"},"info",-1)),Ol=ie(()=>f("span",{class:"material-icons"},"library_books",-1)),Ll=ie(()=>f("span",{class:"material-icons"},"group",-1)),Dl=ie(()=>f("span",{class:"material-icons"},"settings",-1)),ql=ie(()=>f("span",{class:"material-icons"},"library_books",-1)),Rl=ie(()=>f("span",{class:"material-icons"},"group",-1)),Bl=ie(()=>f("span",{class:"material-icons"},"settings",-1)),Al=ie(()=>f("span",{class:"material-icons"},"info",-1)),Ul={href:"https://forums.moddingtree.com/",target:"_blank"},zl=ie(()=>f("span",{class:"material-icons"},"forum",-1)),jl={class:"discord"},Gl={class:"discord-links"},Hl={key:0},Wl=["href"],Jl=ie(()=>f("li",null,[f("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"Profectus & Friends")],-1)),Zl=ie(()=>f("li",null,[f("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),Kl=B({__n
Learn more at www.moddingtree.com`,"font-weight: bold; font-size: 24px; color: #A3BE8C; background: #2E3440; padding: 4px 8px; border-radius: 8px;","padding: 4px;"),ho(),window.location.pathname==="/new"?await ke(qe()):await Nn(),window.history.replaceState({},document.title,"/");const{globalBus:e}=await dt(()=>Promise.resolve().then(function(){return pi}),void 0),{startGameLoop:t}=await dt(()=>import("./gameLoop.4adf0349.js"),["assets/gameLoop.4adf0349.js","assets/@fontsource.f66d05e7.css","assets/vue.228877f7.js","assets/lru-cache.9506e0ec.js","assets/yallist.fd762fe7.js","assets/@vue.8948d9b0.js","assets/lz-string.f2f3b7cf.js","assets/nanoevents.1080beb7.js","assets/socket.io-client.03bb8f3a.js","assets/engine.io-client.6ba5801d.js","assets/engine.io-parser.730afdce.js","assets/@socket.io.aec831e2.js","assets/socket.io-parser.0ab387d5.js","assets/unique-names-generator.9178d3e3.js","assets/vue-toastification.97914fdb.js","assets/vue-toastification.4b5f8ac8.css","assets/semver.334eb41f.js","assets/vue-textarea-autosize.35804eaf.js","assets/vue-next-select.f2be13cc.js","assets/vue-next-select.9e6f4164.css","assets/vuedraggable.5218041c.js","assets/sortablejs.692999e9.js","assets/workbox-window.8d14e8b7.js"]),n=window.vue=Dn(ju);n.config.errorHandler=function(r,i,o){console.error(r,o,i)},e.emit("setupVue",n),n.mount("#app"),Te(()=>{const r=Xt(),{updateServiceWorker:i}=Hu({onNeedRefresh(){r.info("New content available, click here to update.",{timeout:!1,closeOnClick:!1,draggable:!1,icon:{iconClass:"material-icons",iconChildren:"refresh",iconTag:"i"},rtl:!1,onClick(){i()}})},onOfflineReady(){r.info("App ready to work offline")},onRegisterError:console.warn,onRegistered(o){o&&setInterval(()=>o.update(),60*60*1e3)}})}),t()});export{l as D,dt as _,K as a,R as b,bu as c,Q as g,mo as l,O as p,z as s};