/* empty css */import"./vue.228877f7.js";import{qasBe,Cass,aaasB,tasM,aEash,a0asw,aKasxe,buastt,Gaste,arasTe,ZasD,ayaspt,a1asf,JasP,OasU,aJashe,$asF,Iasve,a8asy,b6asT,a7asV,aHasfe,aFasme,uasMt,aGasot,Aasde,_asq,b8asbt,bsasKt,aqasRe,bbasxt,TasPn,jasEn,laspe,bvasAt,b1asoe,wasJe,b2asFt,axasVn,aLasct,aNasse,zasPe,brasOn,bnasLn,beasDn}from"./@vue.8948d9b0.js";import{Laswe}from"./lz-string.f2f3b7cf.js";import{casYt}from"./nanoevents.1080beb7.js";import{lasqn}from"./socket.io-client.03bb8f3a.js";import{nasRn,lasBn,tasAn,rasUn}from"./unique-names-generator.9178d3e3.js";import{uasXt,saszn}from"./vue-toastification.97914fdb.js";import{sasjn}from"./semver.334eb41f.js";import{pasGn}from"./vue-textarea-autosize.35804eaf.js";import{YasHn}from"./vue-next-select.f2be13cc.js";import{DasWn}from"./vuedraggable.5218041c.js";import{vasJn,nasZn}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";constKn=function(){constt=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(constiofdocument.querySelectorAll('link[rel="modulepreload"]'))r(i);newMutationObserver(i=>{for(constoofi)if(o.type==="childList")for(constcofo.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});functionn(i){consto={};returni.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}functionr(i){if(i.ep)return;i.ep=!0;consto=n(i);fetch(i.href,o)}};Kn();constYn="modulepreload",Ut={},Xn="./",dt=function(t,n){return!n||n.length===0?t():Promise.all(n.map(r=>{if(r=`${Xn}${r}`,rinUt)return;Ut[r]=!0;consti=r.endsWith(".css"),o=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${o}`))return;constc=document.createElement("link");if(c.rel=i?"stylesheet":Yn,i||(c.as="script",c.crossOrigin=""),c.href=r,document.head.appendChild(c),i)returnnewPromise((u,d)=>{c.addEventListener("load",u),c.addEventListener("error",()=>d(newError(`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";varR={$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:{}});varO=window.player=_r;functionTt(e){returnJSON.stringify(e,(t,n)=>s(n))}varH=(e,t)=>{constn=e.__vccOpts||e;for(const[r,i]oft)n[r]=i;returnn};constyr=["onClick"],wr=B({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){constn=M(!1),r=M(null);functioni(){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",{},void0,!0)],10,yr))}});varQt=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("Checktheconsoleformoredetails,andcon
Tryingtopop${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:
`))!=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(`AttemptedtosaveNaNvalueto${(n=e[De])==null?void0: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,`
`+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,`
`+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(`Persistentrefisbeingsavedto\`${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)=>(kinC||(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!(dinstanceofl)&&!(dinstanceofa)&&!pe(d)&&!n.includes(d)&&(typeofd.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.",$eini?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.
${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(`Unknownsaveencoding:${R.exportEncoding}.Defaultingtolz`);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
Learnmoreatwww.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};