diff --git a/assets/gameLoop.27ced67a.js b/assets/gameLoop.4adf0349.js similarity index 93% rename from assets/gameLoop.27ced67a.js rename to assets/gameLoop.4adf0349.js index 55799fe..18c6be8 100644 --- a/assets/gameLoop.27ced67a.js +++ b/assets/gameLoop.4adf0349.js @@ -1 +1 @@ -import{_ as d,s as p,p as e,a as n,l as T,D as l,b as r,g as u}from"./index.37cfdf05.js";import"./vue.228877f7.js";import{b1 as c}from"./@vue.8948d9b0.js";/* empty css */import"./lz-string.f2f3b7cf.js";import"./nanoevents.1080beb7.js";import"./socket.io-client.03bb8f3a.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"./unique-names-generator.9178d3e3.js";import"./vue-toastification.97914fdb.js";import"./semver.334eb41f.js";import"./lru-cache.9506e0ec.js";import"./yallist.fd762fe7.js";import"./vue-textarea-autosize.35804eaf.js";import"./vue-next-select.f2be13cc.js";import"./vuedraggable.5218041c.js";import"./sortablejs.692999e9.js";import"./workbox-window.8d14e8b7.js";let o=null,f=null;function m(){const t=Date.now();let i=(t-e.time)/1e3;e.time=t;const a=i;if(n.lastTenTicks.push(a),n.lastTenTicks.length>10&&(n.lastTenTicks=n.lastTenTicks.slice(1)),!((f==null?void 0:f.value)&&!e.keepGoing)&&!n.hasNaN&&(i=Math.max(i,0),e.devSpeed!==0)){if(T.value=!1,e.offlineTime!=null){if(l.gt(e.offlineTime,r.offlineLimit*3600)&&(e.offlineTime=r.offlineLimit*3600),l.gt(e.offlineTime,0)&&e.devSpeed!==0){const s=Math.max(e.offlineTime/10,i);e.offlineTime=e.offlineTime-s,i+=s}else e.devSpeed===0&&(e.offlineTime+=i);(!e.offlineProd||l.lt(e.offlineTime,0))&&(e.offlineTime=null)}i=Math.min(i,r.maxTickLength),e.devSpeed!=null&&(i*=e.devSpeed),Number.isFinite(i)||(i=1e308),!l.eq(i,0)&&(e.timePlayed+=i,Number.isFinite(e.timePlayed)||(e.timePlayed=1e308),u.emit("update",i,a),p.unthrottled?(requestAnimationFrame(m),o!=null&&(clearInterval(o),o=null)):o==null&&(o=setInterval(m,50)))}}async function j(){f=(await d(()=>import("./index.37cfdf05.js").then(function(t){return t.c}),["assets/index.37cfdf05.js","assets/index.2e66f9e5.css","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"])).hasWon,c(f,t=>{t&&u.emit("gameWon")}),p.unthrottled?requestAnimationFrame(m):o=setInterval(m,50)}export{j as startGameLoop}; +import{_ as d,s as p,p as e,a as n,l as T,D as l,b as r,g as u}from"./index.609ecad2.js";import"./vue.228877f7.js";import{b1 as c}from"./@vue.8948d9b0.js";/* empty css */import"./lz-string.f2f3b7cf.js";import"./nanoevents.1080beb7.js";import"./socket.io-client.03bb8f3a.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"./unique-names-generator.9178d3e3.js";import"./vue-toastification.97914fdb.js";import"./semver.334eb41f.js";import"./lru-cache.9506e0ec.js";import"./yallist.fd762fe7.js";import"./vue-textarea-autosize.35804eaf.js";import"./vue-next-select.f2be13cc.js";import"./vuedraggable.5218041c.js";import"./sortablejs.692999e9.js";import"./workbox-window.8d14e8b7.js";let o=null,f=null;function m(){const t=Date.now();let i=(t-e.time)/1e3;e.time=t;const a=i;if(n.lastTenTicks.push(a),n.lastTenTicks.length>10&&(n.lastTenTicks=n.lastTenTicks.slice(1)),!((f==null?void 0:f.value)&&!e.keepGoing)&&!n.hasNaN&&(i=Math.max(i,0),e.devSpeed!==0)){if(T.value=!1,e.offlineTime!=null){if(l.gt(e.offlineTime,r.offlineLimit*3600)&&(e.offlineTime=r.offlineLimit*3600),l.gt(e.offlineTime,0)&&e.devSpeed!==0){const s=Math.max(e.offlineTime/10,i);e.offlineTime=e.offlineTime-s,i+=s}else e.devSpeed===0&&(e.offlineTime+=i);(!e.offlineProd||l.lt(e.offlineTime,0))&&(e.offlineTime=null)}i=Math.min(i,r.maxTickLength),e.devSpeed!=null&&(i*=e.devSpeed),Number.isFinite(i)||(i=1e308),!l.eq(i,0)&&(e.timePlayed+=i,Number.isFinite(e.timePlayed)||(e.timePlayed=1e308),u.emit("update",i,a),p.unthrottled?(requestAnimationFrame(m),o!=null&&(clearInterval(o),o=null)):o==null&&(o=setInterval(m,50)))}}async function j(){f=(await d(()=>import("./index.609ecad2.js").then(function(t){return t.c}),["assets/index.609ecad2.js","assets/index.2e66f9e5.css","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"])).hasWon,c(f,t=>{t&&u.emit("gameWon")}),p.unthrottled?requestAnimationFrame(m):o=setInterval(m,50)}export{j as startGameLoop}; diff --git a/assets/index.37cfdf05.js b/assets/index.609ecad2.js similarity index 92% rename from assets/index.37cfdf05.js rename to assets/index.609ecad2.js index 5f07d42..f25db74 100644 --- a/assets/index.37cfdf05.js +++ b/assets/index.609ecad2.js @@ -1,18 +1,18 @@ -/* empty css */import"./vue.228877f7.js";import{q as Re,C as s,aa as B,t as M,aE as h,a0 as w,aK as Me,bu as tt,G as te,ar as Fe,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 qe,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 Te,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=Re({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,Fe(()=>{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}])},[Me(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 consider sharing it with the developers on "),Mr=["href"],xr=V("! "),Fr=_t(()=>f("span",{class:"material-icons",style:{"font-size":"16px"}},"content_paste",-1)),Tr=_t(()=>f("span",{style:{"margin-left":"8px","font-size":"medium"}},"Copy Save",-1)),Pr=_t(()=>f("br",null,null,-1)),Er={key:0,style:{"margin-top":"20px"}},Vr=_t(()=>f("h3",null,"Other errors",-1)),Or=[Vr],Lr={class:"error-details"},Dr={key:0,style:{"margin-top":"10px"}},qr={key:1,style:{"margin-top":"10px"}},Rr=B({__name:"Error",props:{errors:null},setup(e){const t=e,n=D(()=>t.errors[0]),r=D(()=>t.errors.map(c=>c.stack==null?[]:c.stack.split(` +/* 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 consider sharing it with the developers on "),Mr=["href"],xr=V("! "),Fr=_t(()=>f("span",{class:"material-icons",style:{"font-size":"16px"}},"content_paste",-1)),Tr=_t(()=>f("span",{style:{"margin-left":"8px","font-size":"medium"}},"Copy Save",-1)),Pr=_t(()=>f("br",null,null,-1)),Er={key:0,style:{"margin-top":"20px"}},Vr=_t(()=>f("h3",null,"Other errors",-1)),Or=[Vr],Lr={class:"error-details"},Dr={key:0,style:{"margin-top":"10px"}},qr={key:1,style:{"margin-top":"10px"}},Rr=B({__name:"Error",props:{errors:null},setup(e){const t=e,n=D(()=>t.errors[0]),r=D(()=>t.errors.map(c=>c.stack==null?[]:c.stack.split(` `))),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]}}(),Ee=[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.7278665320924946,4.814462547283592,6.436522247411611,9],[1,1.1840100246247336,1.4061375836156955,1.6802272208863964,2.026757028388619,2.4770056063449646,3.080525271755482,3.9191964192627284,5.135152840833187,6.989961179534715,10]],Kr=[[-1,-.9194161097107025,-.8335625019330468,-.7425599821143978,-.6466611521029437,-.5462617907227869,-.4419033816638769,-.3342645487554494,-.224140440909962,-.11241087890006762,0],[-1,-.90603157029014,-.80786507256596,-.7064666939634,-.60294836853664,-.49849837513117,-.39430303318768,-.29147201034755,-.19097820800866,-.09361896280296,0],[-1,-.9021579584316141,-.8005762598234203,-.6964780623319391,-.5911906810998454,-.486050182576545,-.3823089430815083,-.28106046722897615,-.1831906535795894,-.08935809204418144,0],[-1,-.8917227442365535,-.781258746326964,-.6705130326902455,-.5612813129406509,-.4551067709033134,-.35319256652135966,-.2563741554088552,-.1651412821106526,-.0796919581982668,0],[-1,-.8843387974366064,-.7678744063886243,-.6529563724510552,-.5415870994657841,-.4352842206588936,-.33504449124791424,-.24138853420685147,-.15445285440944467,-.07409659641336663,0],[-1,-.8786709358426346,-.7577735191184886,-.6399546189952064,-.527284921869926,-.4211627631006314,-.3223479611761232,-.23107655627789858,-.1472057700818259,-.07035171210706326,0],[-1,-.8740862815291583,-.7497032990976209,-.6297119746181752,-.5161838335958787,-.41036238255751956,-.31277212146489963,-.2233976621705518,-.1418697367979619,-.06762117662323441,0],[-1,-.8702632331800649,-.7430366914122081,-.6213373075161548,-.5072025698095242,-.40171437727184167,-.30517930701410456,-.21736343968190863,-.137710238299109,-.06550774483471955,0],[-1,-.8670016295947213,-.7373984232432306,-.6143173985094293,-.49973884395492807,-.394584953527678,-.2989649949848695,-.21245647317021688,-.13434688362382652,-.0638072667348083,0],[-1,-.8641642839543857,-.732534623168535,-.6083127477059322,-.4934049257184696,-.3885773075899922,-.29376029055315767,-.2083678561173622,-.13155653399373268,-.062401588652553186,0]];let g=function(t){return l.fromValue_noAlloc(t)},E=function(e,t,n){return l.fromComponents(e,t,n)},L=function(t,n,r){return l.fromComponents_noNormalize(t,n,r)};const Se=function(t,n){const r=n+1,i=Math.ceil(Math.log10(Math.abs(t))),o=Math.round(t*Math.pow(10,r-i))*Math.pow(10,i-r);return parseFloat(o.toFixed(Math.max(r-i,0)))},It=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},Yr=function(e){if(!isFinite(e))return e;if(e<-50)return e===Math.trunc(e)?Number.NEGATIVE_INFINITY:0;let t=1;for(;e<10;)t=t*e,++e;e-=1;let n=.9189385332046727;n=n+(e+.5)*Math.log(e),n=n-e;const r=e*e;let i=e;return n=n+1/(12*i),i=i*r,n=n+1/(360*i),i=i*r,n=n+1/(1260*i),i=i*r,n=n+1/(1680*i),i=i*r,n=n+1/(1188*i),i=i*r,n=n+691/(360360*i),i=i*r,n=n+7/(1092*i),i=i*r,n=n+3617/(122400*i),Math.exp(n)/t},tn=.5671432904097838,jt=function(e,t=1e-10){let n,r;if(!Number.isFinite(e)||e===0)return e;if(e===1)return tn;e<10?n=0:n=Math.log(e)-Math.log(Math.log(e));for(let i=0;i<100;++i){if(r=(e*Math.exp(-n)+n*n)/(n+1),Math.abs(r-n).5?1:-1;if(Math.random()*20<1)return L(t,0,1);const n=Math.floor(Math.random()*(e+1));let r=n===0?Math.random()*616-308:Math.random()*16;Math.random()>.9&&(r=Math.trunc(r));let i=Math.pow(10,r);return Math.random()>.9&&(i=Math.trunc(i)),E(t,n,i)}static affordGeometricSeries_core(e,t,n,r){const i=t.mul(n.pow(r));return m.floor(e.div(i).mul(n.sub(1)).add(1).log10().div(n.log10()))}static sumGeometricSeries_core(e,t,n,r){return t.mul(n.pow(r)).mul(m.sub(1,n.pow(e))).div(m.sub(1,n))}static affordArithmeticSeries_core(e,t,n,r){const o=t.add(r.mul(n)).sub(n.div(2)),c=o.pow(2);return o.neg().add(c.add(n.mul(e).mul(2)).sqrt()).div(n).floor()}static sumArithmeticSeries_core(e,t,n,r){const i=t.add(r.mul(n));return e.div(2).mul(i.mul(2).plus(e.sub(1).mul(n)))}static efficiencyOfPurchase_core(e,t,n){return e.div(t).add(e.div(n))}normalize(){if(this.sign===0||this.mag===0&&this.layer===0)return this.sign=0,this.mag=0,this.layer=0,this;if(this.layer===0&&this.mag<0&&(this.mag=-this.mag,this.sign=-this.sign),this.layer===0&&this.mag=Ur)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e0;)this.layer-=1,this.layer===0?this.mag=Math.pow(10,this.mag):(this.mag=t*Math.pow(10,e),e=Math.abs(this.mag),t=Math.sign(this.mag));return this.layer===0&&(this.mag<0?(this.mag=-this.mag,this.sign=-this.sign):this.mag===0&&(this.sign=0)),this}fromComponents(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this.normalize(),this}fromComponents_noNormalize(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this}fromMantissaExponent(e,t){return this.layer=1,this.sign=Math.sign(e),e=Math.abs(e),this.mag=t+Math.log10(e),this.normalize(),this}fromMantissaExponent_noNormalize(e,t){return this.fromMantissaExponent(e,t),this}fromDecimal(e){return this.sign=e.sign,this.layer=e.layer,this.mag=e.mag,this}fromNumber(e){return this.mag=Math.abs(e),this.sign=Math.sign(e),this.layer=0,this.normalize(),this}fromString(e){const t=e,n=m.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const r=e.split("^^^");if(r.length===2){const b=parseFloat(r[0]),S=parseFloat(r[1]),$=r[1].split(";");let A=1;if($.length===2&&(A=parseFloat($[1]),isFinite(A)||(A=1)),isFinite(b)&&isFinite(S)){const I=m.pentate(b,S,A);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const i=e.split("^^");if(i.length===2){const b=parseFloat(i[0]),S=parseFloat(i[1]),$=i[1].split(";");let A=1;if($.length===2&&(A=parseFloat($[1]),isFinite(A)||(A=1)),isFinite(b)&&isFinite(S)){const I=m.tetrate(b,S,A);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const o=e.split("^");if(o.length===2){const b=parseFloat(o[0]),S=parseFloat(o[1]);if(isFinite(b)&&isFinite(S)){const $=m.pow(b,S);return this.sign=$.sign,this.layer=$.layer,this.mag=$.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}e=e.trim().toLowerCase();let c,u,d=e.split("pt");if(d.length===2){c=10,u=parseFloat(d[0]),d[1]=d[1].replace("(",""),d[1]=d[1].replace(")","");let b=parseFloat(d[1]);if(isFinite(b)||(b=1),isFinite(c)&&isFinite(u)){const S=m.tetrate(c,u,b);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}if(d=e.split("p"),d.length===2){c=10,u=parseFloat(d[0]),d[1]=d[1].replace("(",""),d[1]=d[1].replace(")","");let b=parseFloat(d[1]);if(isFinite(b)||(b=1),isFinite(c)&&isFinite(u)){const S=m.tetrate(c,u,b);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const v=e.split("e"),_=v.length-1;if(_===0){const b=parseFloat(e);if(isFinite(b))return this.fromNumber(b),m.fromStringCache.size>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}else if(_===1){const b=parseFloat(e);if(isFinite(b)&&b!==0)return this.fromNumber(b),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}const p=e.split("e^");if(p.length===2){this.sign=1,p[0].charAt(0)=="-"&&(this.sign=-1);let b="";for(let S=0;S=43&&$<=57||$===101)b+=p[1].charAt(S);else return this.layer=parseFloat(b),this.mag=parseFloat(p[1].substr(S+1)),this.normalize(),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}if(_<1)return this.sign=0,this.layer=0,this.mag=0,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this;const C=parseFloat(v[0]);if(C===0)return this.sign=0,this.layer=0,this.mag=0,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this;let k=parseFloat(v[v.length-1]);if(_>=2){const b=parseFloat(v[v.length-2]);isFinite(b)&&(k*=Math.sign(b),k+=It(b))}if(!isFinite(C))this.sign=v[0]==="-"?-1:1,this.layer=_,this.mag=k;else if(_===1)this.sign=Math.sign(C),this.layer=1,this.mag=k+Math.log10(Math.abs(C));else if(this.sign=Math.sign(C),this.layer=_,_===2){const b=m.mul(E(1,2,k),g(C));return this.sign=b.sign,this.layer=b.layer,this.mag=b.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}else this.mag=k;return this.normalize(),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}fromValue(e){return e instanceof m?this.fromDecimal(e):typeof e=="number"?this.fromNumber(e):typeof e=="string"?this.fromString(e):(this.sign=0,this.layer=0,this.mag=0,this)}toNumber(){return Number.isFinite(this.layer)?this.layer===0?this.sign*this.mag:this.layer===1?this.sign*Math.pow(10,this.mag):this.mag>0?this.sign>0?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:0:Number.NaN}mantissaWithDecimalPlaces(e){return isNaN(this.m)?Number.NaN:this.m===0?0:Se(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Se(this.mag,e)}toString(){return isNaN(this.layer)||isNaN(this.sign)||isNaN(this.mag)?"NaN":this.mag===Number.POSITIVE_INFINITY||this.layer===Number.POSITIVE_INFINITY?this.sign===1?"Infinity":"-Infinity":this.layer===0?this.mag<1e21&&this.mag>1e-7||this.mag===0?(this.sign*this.mag).toString():this.m+"e"+this.e:this.layer===1?this.m+"e"+this.e:this.layer<=zt?(this.sign===-1?"-":"")+"e".repeat(this.layer)+this.mag:(this.sign===-1?"-":"")+"(e^"+this.layer+")"+this.mag}toExponential(e){return this.layer===0?(this.sign*this.mag).toExponential(e):this.toStringWithDecimalPlaces(e)}toFixed(e){return this.layer===0?(this.sign*this.mag).toFixed(e):this.toStringWithDecimalPlaces(e)}toPrecision(e){return this.e<=-7?this.toExponential(e-1):e>this.e?this.toFixed(e-this.exponent-1):this.toExponential(e-1)}valueOf(){return this.toString()}toJSON(){return this.toString()}toStringWithDecimalPlaces(e){return this.layer===0?this.mag<1e21&&this.mag>1e-7||this.mag===0?(this.sign*this.mag).toFixed(e):Se(this.m,e)+"e"+Se(this.e,e):this.layer===1?Se(this.m,e)+"e"+Se(this.e,e):this.layer<=zt?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Se(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Se(this.mag,e)}abs(){return L(this.sign===0?0:1,this.layer,this.mag)}neg(){return L(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?m.dZero:this.layer===0?E(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?m.dZero:this.layer===0?E(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?m.dZero:this.layer===0?E(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?m.dZero:this.layer===0?E(this.sign,0,Math.trunc(this.mag)):this}add(e){const t=g(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer)||this.sign===0)return t;if(t.sign===0)return this;if(this.sign===-t.sign&&this.layer===t.layer&&this.mag===t.mag)return L(0,0,0);let n,r;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(m.cmpabs(this,t)>0?(n=this,r=t):(n=t,r=this),n.layer===0&&r.layer===0)return m.fromNumber(n.sign*n.mag+r.sign*r.mag);const i=n.layer*Math.sign(n.mag),o=r.layer*Math.sign(r.mag);if(i-o>=2)return n;if(i===0&&o===-1){if(Math.abs(r.mag-Math.log10(n.mag))>St)return n;{const c=Math.pow(10,Math.log10(n.mag)-r.mag),u=r.sign+n.sign*c;return E(Math.sign(u),1,r.mag+Math.log10(Math.abs(u)))}}if(i===1&&o===0){if(Math.abs(n.mag-Math.log10(r.mag))>St)return n;{const c=Math.pow(10,n.mag-Math.log10(r.mag)),u=r.sign+n.sign*c;return E(Math.sign(u),1,Math.log10(r.mag)+Math.log10(Math.abs(u)))}}if(Math.abs(n.mag-r.mag)>St)return n;{const c=Math.pow(10,n.mag-r.mag),u=r.sign+n.sign*c;return E(Math.sign(u),1,r.mag+Math.log10(Math.abs(u)))}}plus(e){return this.add(e)}sub(e){return this.add(g(e).neg())}subtract(e){return this.sub(e)}minus(e){return this.sub(e)}mul(e){const t=g(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer))return t;if(this.sign===0||t.sign===0)return L(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return L(this.sign*t.sign,0,1);let n,r;if(this.layer>t.layer||this.layer==t.layer&&Math.abs(this.mag)>Math.abs(t.mag)?(n=this,r=t):(n=t,r=this),n.layer===0&&r.layer===0)return m.fromNumber(n.sign*r.sign*n.mag*r.mag);if(n.layer>=3||n.layer-r.layer>=2)return E(n.sign*r.sign,n.layer,n.mag);if(n.layer===1&&r.layer===0)return E(n.sign*r.sign,1,n.mag+Math.log10(r.mag));if(n.layer===1&&r.layer===1)return E(n.sign*r.sign,1,n.mag+r.mag);if(n.layer===2&&r.layer===1){const i=E(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(E(Math.sign(r.mag),r.layer-1,Math.abs(r.mag)));return E(n.sign*r.sign,i.layer+1,i.sign*i.mag)}if(n.layer===2&&r.layer===2){const i=E(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(E(Math.sign(r.mag),r.layer-1,Math.abs(r.mag)));return E(n.sign*r.sign,i.layer+1,i.sign*i.mag)}throw Error("Bad arguments to mul: "+this+", "+e)}multiply(e){return this.mul(e)}times(e){return this.mul(e)}div(e){const t=g(e);return this.mul(t.recip())}divide(e){return this.div(e)}divideBy(e){return this.div(e)}dividedBy(e){return this.div(e)}recip(){return this.mag===0?m.dNaN:this.layer===0?E(this.sign,0,1/this.mag):E(this.sign,this.layer,-this.mag)}reciprocal(){return this.recip()}reciprocate(){return this.recip()}cmp(e){const t=g(e);return this.sign>t.sign?1:this.sign0?this.layer:-this.layer,r=t.mag>0?t.layer:-t.layer;return n>r?1:nt.mag?1:this.mag0?t:this}clamp(e,t){return this.max(e).min(t)}clampMin(e){return this.max(e)}clampMax(e){return this.min(e)}cmp_tolerance(e,t){const n=g(e);return this.eq_tolerance(n,t)?0:this.cmp(n)}compare_tolerance(e,t){return this.cmp_tolerance(e,t)}eq_tolerance(e,t){const n=g(e);if(t==null&&(t=1e-7),this.sign!==n.sign||Math.abs(this.layer-n.layer)>1)return!1;let r=this.mag,i=n.mag;return this.layer>n.layer&&(i=It(i)),this.layer0?E(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):E(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?m.dNaN:this.layer>0?E(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):E(this.sign,0,Math.log10(this.mag))}log(e){return e=g(e),this.sign<=0||e.sign<=0||e.sign===1&&e.layer===0&&e.mag===1?m.dNaN:this.layer===0&&e.layer===0?E(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):m.div(this.log10(),e.log10())}log2(){return this.sign<=0?m.dNaN:this.layer===0?E(this.sign,0,Math.log2(this.mag)):this.layer===1?E(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?E(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):E(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?m.dNaN:this.layer===0?E(this.sign,0,Math.log(this.mag)):this.layer===1?E(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?E(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):E(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}logarithm(e){return this.log(e)}pow(e){const t=g(e),n=this,r=t;if(n.sign===0)return r.eq(0)?L(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(r.sign===0)return L(1,0,1);if(r.sign===1&&r.layer===0&&r.mag===1)return n;const i=n.absLog10().mul(r).pow10();return this.sign===-1?Math.abs(r.toNumber()%2)%2===1?i.neg():Math.abs(r.toNumber()%2)%2===0?i:m.dNaN:i}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return m.dNaN;let e=this;if(e.layer===0){const t=Math.pow(10,e.sign*e.mag);if(Number.isFinite(t)&&Math.abs(t)>=.1)return E(1,0,t);if(e.sign===0)return m.dOne;e=L(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?E(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?E(-e.sign,e.layer+1,-e.mag):m.dOne}pow_base(e){return g(e).pow(this)}root(e){const t=g(e);return this.pow(t.recip())}factorial(){return this.mag<0?this.add(1).gamma():this.layer===0?this.add(1).gamma():this.layer===1?m.exp(m.mul(this,m.ln(this).sub(1))):m.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(L(1,0,24)))return m.fromNumber(Yr(this.sign*this.mag));const e=this.mag-1;let t=.9189385332046727;t=t+(e+.5)*Math.log(e),t=t-e;const n=e*e;let r=e,i=12*r,o=1/i,c=t+o;if(c===t||(t=c,r=r*n,i=360*r,o=1/i,c=t-o,c===t))return m.exp(t);t=c,r=r*n,i=1260*r;let u=1/i;return t=t+u,r=r*n,i=1680*r,u=1/i,t=t-u,m.exp(t)}else return this.layer===1?m.exp(m.mul(this,m.ln(this).sub(1))):m.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?m.dOne:this.layer===0&&this.mag<=709.7?m.fromNumber(Math.exp(this.sign*this.mag)):this.layer===0?E(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?E(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):E(1,this.layer+1,this.sign*this.mag)}sqr(){return this.pow(2)}sqrt(){if(this.layer===0)return m.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return E(1,2,Math.log10(this.mag)-.3010299956639812);{const e=m.div(L(this.sign,this.layer-1,this.mag),L(1,0,2));return e.layer+=1,e.normalize(),e}}cube(){return this.pow(3)}cbrt(){return this.pow(1/3)}tetrate(e=2,t=L(1,0,1)){if(e===1)return m.pow(this,t);if(e===0)return new m(t);if(this.eq(m.dOne))return m.dOne;if(this.eq(-1))return m.pow(this,t);if(e===Number.POSITIVE_INFINITY){const i=this.toNumber();if(i<=1.444667861009766&&i>=.06598803584531254){if(i>1.444667861009099)return m.fromNumber(Math.E);const o=m.ln(this).neg();return o.lambertw().div(o)}else return i>1.444667861009766?m.fromNumber(Number.POSITIVE_INFINITY):m.dNaN}if(this.eq(m.dZero)){let i=Math.abs((e+1)%2);return i>1&&(i=2-i),m.fromNumber(i)}if(e<0)return m.iteratedlog(t,this,-e);t=g(t);const n=e;e=Math.trunc(e);const r=n-e;if(this.gt(m.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let i=0;i3)return L(t.sign,t.layer+(e-i-1),t.mag);if(i>1e4)return t}return t}iteratedexp(e=2,t=L(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return m.tetrate(e,-t,this);e=g(e);let n=m.fromDecimal(this);const r=t;t=Math.trunc(t);const i=r-t;if(n.layer-e.layer>3){const o=Math.min(t,n.layer-e.layer-3);t-=o,n.layer-=o}for(let o=0;o1e4)return n}return i>0&&i<1&&(e.eq(10)?n=n.layeradd10(-i):n=n.layeradd(-i,e)),n}slog(e=10,t=100){let n=.001,r=!1,i=!1,o=this.slog_internal(e).toNumber();for(let c=1;c1&&i!=d&&(r=!0),i=d,r?n/=2:n*=2,n=Math.abs(n)*(d?-1:1),o+=n,n===0)break}return m.fromNumber(o)}slog_internal(e=10){if(e=g(e),e.lte(m.dZero)||e.eq(m.dOne))return m.dNaN;if(e.lt(m.dOne))return this.eq(m.dOne)?m.dZero:this.eq(m.dZero)?m.dNegOne:m.dNaN;if(this.mag<0||this.eq(m.dZero))return m.dNegOne;let t=0,n=m.fromDecimal(this);if(n.layer-e.layer>3){const r=n.layer-e.layer-3;t+=r,n.layer-=r}for(let r=0;r<100;++r)if(n.lt(m.dZero))n=m.pow(e,n),t-=1;else{if(n.lte(m.dOne))return m.fromNumber(t+m.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=m.log(n,e)}return m.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:m.critical_section(e,t,Kr)}static tetrate_critical(e,t){return m.critical_section(e,t,Zr)}static critical_section(e,t,n){t*=10,t<0&&(t=0),t>10&&(t=10),e<2&&(e=2),e>10&&(e=10);let r=0,i=0;for(let c=0;ce){const u=(e-Ee[c])/(Ee[c+1]-Ee[c]);r=n[c][Math.floor(t)]*(1-u)+n[c+1][Math.floor(t)]*u,i=n[c][Math.ceil(t)]*(1-u)+n[c+1][Math.ceil(t)]*u;break}const o=t-Math.floor(t);return r<=0||i<=0?r*(1-o)+i*o:Math.pow(e,Math.log(r)/Math.log(e)*(1-o)+Math.log(i)/Math.log(e)*o)}layeradd10(e){e=m.fromValue_noAlloc(e).toNumber();const t=m.fromDecimal(this);if(e>=1){t.mag<0&&t.layer>0?(t.sign=0,t.mag=0,t.layer=0):t.sign===-1&&t.layer==0&&(t.sign=1,t.mag=-t.mag);const n=Math.trunc(e);e-=n,t.layer+=n}if(e<=-1){const n=Math.trunc(e);if(e-=n,t.layer+=n,t.layer<0)for(let r=0;r<100;++r){if(t.layer++,t.mag=Math.log10(t.mag),!isFinite(t.mag))return t.sign===0&&(t.sign=1),t.layer<0&&(t.layer=0),t.normalize();if(t.layer>=0)break}}for(;t.layer<0;)t.layer++,t.mag=Math.log10(t.mag);return t.sign===0&&(t.sign=1,t.mag===0&&t.layer>=1&&(t.layer-=1,t.mag=1)),t.normalize(),e!==0?t.layeradd(e,10):t}layeradd(e,t){const r=this.slog(t).toNumber()+e;return r>=0?m.tetrate(t,r):Number.isFinite(r)?r>=-1?m.log(m.tetrate(t,r+1),t):m.log(m.log(m.tetrate(t,r+2),t),t):m.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return m.fromNumber(jt(this.toNumber()));if(this.layer===0)return m.fromNumber(jt(this.sign*this.mag));if(this.layer===1)return Gt(this);if(this.layer===2)return Gt(this);if(this.layer>=3)return L(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return L(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=L(1,0,1)){t=g(t);const n=e;e=Math.trunc(e);const r=n-e;r!==0&&(t.eq(m.dOne)?(++e,t=m.fromNumber(r)):this.eq(10)?t=t.layeradd10(r):t=t.layeradd(r,this));for(let i=0;i10)return t}return t}sin(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.sin(this.sign*this.mag)):L(0,0,0)}cos(){return this.mag<0?m.dOne:this.layer===0?m.fromNumber(Math.cos(this.sign*this.mag)):L(0,0,0)}tan(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.tan(this.sign*this.mag)):L(0,0,0)}asin(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.asin(this.sign*this.mag)):L(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?m.fromNumber(Math.acos(this.toNumber())):this.layer===0?m.fromNumber(Math.acos(this.sign*this.mag)):L(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.atan(this.sign*this.mag)):m.fromNumber(Math.atan(this.sign*(1/0)))}sinh(){return this.exp().sub(this.negate().exp()).div(2)}cosh(){return this.exp().add(this.negate().exp()).div(2)}tanh(){return this.sinh().div(this.cosh())}asinh(){return m.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return m.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?L(Number.NaN,Number.NaN,Number.NaN):m.ln(this.add(1).div(m.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(m.pow(10,e))}egg(){return this.add(9)}lessThanOrEqualTo(e){return this.cmp(e)<1}lessThan(e){return this.cmp(e)<0}greaterThanOrEqualTo(e){return this.cmp(e)>-1}greaterThan(e){return this.cmp(e)>0}};let l=m;l.fromStringCache=new Br(Wr);l.dZero=L(0,0,0);l.dOne=L(1,0,1);l.dNegOne=L(-1,0,1);l.dTwo=L(1,0,2);l.dTen=L(1,0,10);l.dNaN=L(Number.NaN,Number.NaN,Number.NaN);l.dInf=L(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);l.dNegInf=L(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);l.dNumberMax=E(1,0,Number.MAX_VALUE);l.dNumberMin=E(1,0,Number.MIN_VALUE);g=l.fromValue_noAlloc;E=l.fromComponents;L=l.fromComponents_noNormalize;l.fromMantissaExponent;l.fromMantissaExponent_noNormalize;const Xr=new l(1);function Qe(e,t,n=!0){let r=l.log10(e).floor(),i=l.div(e,l.pow(10,r));i.toStringWithDecimalPlaces(t)==="10"&&(i=Xr,r=r.add(1));const o=r.gte(1e9)?ce(r,Math.max(Math.max(t,3),R.defaultDecimalsShown)):r.gte(1e4)?ft(r,0):r.toStringWithDecimalPlaces(0);return n?i.toStringWithDecimalPlaces(t)+"e"+o:"e"+o}function ft(e,t){if(e==null)return"NaN";if(e=new l(e),e.mag<.001)return 0 .toFixed(t);const r=e.toStringWithDecimalPlaces(t).split(".");return r[0]=r[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"),r.length==1?r[0]:r[0]+"."+r[1]}function nn(e,t){return e==null?"NaN":(e=new l(e),e.mag<1e-4?0 .toFixed(t):(e.mag<.1&&t!==0&&(t=Math.max(Math.max(t,e.log10().negate().ceil().toNumber()),R.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const Qr=new l("eeee1000"),ei=new l("e100000"),Ht=new l("e1000"),rn=new l(1e9),ti=new l(1e6),ni=new l(1e3),ri=new l(.98),ii=new l(.001),an=new l(0);function ce(e,t,n){if(t==null&&(t=R.defaultDecimalsShown),n=n!=null?n:R.defaultShowSmall,e=new l(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+ce(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(Qr)){const r=e.slog();return r.gte(ti)?"F"+ce(r.floor()):l.pow(10,r.sub(r.floor())).toStringWithDecimalPlaces(3)+"F"+ft(r.floor(),0)}else{if(e.gte(ei))return Qe(e,0,!1);if(e.gte(Ht))return Qe(e,0);if(e.gte(rn))return Qe(e,t);if(e.gte(ni))return ft(e,0);if(e.gte(ii)||!n)return nn(e,t);if(e.eq(an))return 0 .toFixed(t)}return e=sn(e),e.lt(Ht)?Qe(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):ce(e,t)+"\u207B\xB9"}function le(e){return e=new l(e),e.sign<0?"-"+le(e.neg()):e.gte(rn)||e.lte(ri)&&!e.eq(an)?ce(e):ce(e,0)}function on(e){return l.lt(e,0)?"-"+on(l.neg(e)):l.gt(e,2**51)?ce(l.div(e,31536e3))+"y":(e=new l(e).toNumber(),e<60?ce(e)+"s":e<3600?le(Math.floor(e/60))+"m "+ce(e%60)+"s":e<86400?le(Math.floor(e/3600))+"h "+le(Math.floor(e/60)%60)+"m "+le(e%60)+"s":e<31536e3?le(Math.floor(e/84600)%365)+"d "+le(Math.floor(e/3600)%24)+"h "+le(Math.floor(e/60)%60)+"m":le(Math.floor(e/31536e3))+"y "+le(Math.floor(e/84600)%365)+"d "+le(Math.floor(e/3600)%24)+"h")}function ai(e,t,n){e=new l(e);let r=e.toStringWithDecimalPlaces(t);return new l(r).gte(n)&&(r=l.sub(n,Math.pow(.1,t)).toStringWithDecimalPlaces(t)),r}function oi(e,t){return ce(e,t,!0)}function sn(e){let t=l.log10(e).ceil();const n=l.div(e,l.pow(10,t));return t=t.neg(),e=new l(10).pow(t).times(n),e}var si=Object.freeze(Object.defineProperty({__proto__:null,default:l,exponentialFormat:Qe,commaFormat:ft,regularFormat:nn,format:ce,formatWhole:le,formatTime:on,toPlaces:ai,formatSmall:oi,invertOOM:sn},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:li,commaFormat:ui,regularFormat:ci,format:ln,formatWhole:un,formatTime:Pt,toPlaces:di,formatSmall:fi,invertOOM:mi}=si;window.Decimal=l;window.exponentialFormat=li;window.commaFormat=ui;window.regularFormat=ci;window.format=ln;window.formatWhole=un;window.formatTime=Pt;window.toPlaces=di;window.formatSmall=fi;window.invertOOM=mi;function gi(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function $t(e){return typeof e=="function"}var G=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(G||{});const nt=Symbol("DoNotCache");function ee(e,t){const n=e[t];$t(n)&&n.length===0&&!n[nt]?e[t]=D(n.bind(e)):$t(n)&&(e[t]=n.bind(e),e[t][nt]=!0)}function Wt(e){return $t(e)&&!e[nt]&&(e=D(e)),e}const mt=Symbol("Component"),Et=Symbol("GatherProps");let hi=0;function vi(e="feature-"){return e+hi++}var rt=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(rt||{});function gt(e){const t=s(e);return t!==2&&t!==!1}function cn(e){return s(e)===1}function ne(e){return e[nt]=!0,e}function xe(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}var K=window.state=Mt({lastTenTicks:[],hasNaN:!1,NaNPath:[],errors:Re([])});const Ve={variables:{"--foreground":"#dfdfdf","--background":"#0f0f0f","--feature-foreground":"#0f0f0f","--tooltip-background":"rgba(0, 0, 0, 0.75)","--raised-background":"#0f0f0f","--points":"#ffffff","--locked":"#bf8f8f","--highlighted":"#333","--bought":"#77bf5f","--danger":"rgb(220, 53, 69)","--link":"#02f2f2","--outline":"#dfdfdf","--accent1":"#627a82","--accent2":"#658262","--accent3":"#7c6282","--border-radius":"15px","--modal-border":"solid 2px var(--color)","--feature-margin":"0px"},floatingTabs:!0,mergeAdjacent:!0,showPin:!0};var Vt=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(Vt||{}),yt={classic:Ve,paper:{...Ve,variables:{...Ve.variables,"--background":"#2a323d","--feature-foreground":"#000","--raised-background":"#333c4a","--locked":"#3a3e45","--bought":"#5C8A58","--outline":"#333c4a","--border-radius":"4px","--modal-border":"","--feature-margin":"5px"},floatingTabs:!1},nordic:{...Ve,variables:{...Ve.variables,"--foreground":"#D8DEE9","--background":"#2E3440","--feature-foreground":"#000","--raised-background":"#3B4252","--points":"#E5E9F0","--locked":"#4c566a","--highlighted":"#434c5e","--bought":"#8FBCBB","--danger":"#D08770","--link":"#88C0D0","--outline":"#3B4252","--accent1":"#B48EAD","--accent2":"#A3BE8C","--accent3":"#EBCB8B","--border-radius":"4px","--modal-border":"solid 2px #3B4252","--feature-margin":"5px"},floatingTabs:!1},aqua:{...Ve,variables:{...Ve.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}};const Q=Yt();"fonts"in document&&(document.fonts.onloadingdone=()=>Q.emit("fontsLoaded"));var pi=Object.freeze(Object.defineProperty({__proto__:null,globalBus:Q},Symbol.toStringTag,{value:"Module"}));const bi=B({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var _;const n=M({}),r=new ResizeObserver(u),i=M(null);pt(()=>{const p=i.value;p!=null&&r.observe(p)});let o=!0,c=M((_=i.value)==null?void 0:_.getBoundingClientRect());function u(){o&&(o=!1,Fe(()=>{var p;c.value=(p=i.value)==null?void 0:p.getBoundingClientRect(),Object.values(n.value).filter(C=>C).forEach(C=>C.rect=C.element.getBoundingClientRect()),t("updateNodes",n.value),o=!0}))}Q.on("fontsLoaded",u);const d={attributes:!1,childList:!0,subtree:!1};ot(fn,(p,C)=>{const k=new MutationObserver(()=>v(p));k.observe(C,d),n.value[p]={element:C,observer:k,rect:C.getBoundingClientRect()},u()}),ot(mn,p=>{var C;(C=n.value[p])==null||C.observer.disconnect(),n.value[p]=void 0,u()}),ot(gn,n),ot(hn,c);function v(p){const C=n.value[p];C!=null&&(C.rect=C.element.getBoundingClientRect(),t("updateNodes",n.value))}return(p,C)=>(h(),w(U,null,[Me(p.$slots,"default",{},void 0,!0),f("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var dn=H(bi,[["__scopeId","data-v-2b1dc1bc"]]);const _i=["onPointerdown"],yi={class:"modal-wrapper"},wi={class:"modal-container"},Ni={class:"modal-header"},Ci=V(" default header "),Si={class:"modal-body"},Ii=V(" default body "),$i={class:"modal-footer"},ki=f("div",{class:"modal-default-flex-grow"},null,-1),Pe=B({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const i=de(e),o=D(()=>s(i.modelValue)||u.value);function c(){n("update:modelValue",!1)}const u=M(!1),d=M(null),v=D(()=>{var _,p;return(p=(_=d.value)==null?void 0:_.nodes)!=null?p:null});return t({isOpen:o,nodes:v}),(_,p)=>(h(),q(Pn,{to:"#modal-root"},[y(xt,{name:"modal",onBeforeEnter:p[0]||(p[0]=C=>u.value=!0),onAfterLeave:p[1]||(p[1]=C=>u.value=!1)},{default:T(()=>[bt(f("div",qe({class:"modal-mask",onPointerdown:tt(c,["self"])},_.$attrs),[f("div",yi,[f("div",wi,[f("div",Ni,[Me(_.$slots,"header",{shown:s(o)},()=>[Ci])]),f("div",Si,[y(dn,{ref_key:"contextRef",ref:d},{default:T(()=>[Me(_.$slots,"body",{shown:s(o)},()=>[Ii])]),_:3},512)]),f("div",$i,[Me(_.$slots,"footer",{shown:s(o)},()=>[f("div",{class:"modal-default-footer"},[ki,f("button",{class:"button modal-default-button",onClick:c}," Close ")])])])])])],16,_i),[[Kt,e.modelValue]])]),_:3})]))}}),fn=Symbol("RegisterNode"),mn=Symbol("UnregisterNode"),gn=Symbol("Nodes"),hn=Symbol("Bounds"),re=Mt({});window.layers=re;const ze={},ge=[];function vn(e,t){return yn(()=>{const n={},r=n.emitter=Yt();if(n.on=r.on.bind(r),n.emit=r.emit.bind(r),n.nodes=M({}),n.id=e,ge.push(e),ze[e]=new Set,n.minimized=Ot(!1,!1),Object.assign(n,t.call(n,n)),ge[ge.length-1]==null||ge[ge.length-1]!==e)throw new Error(`Adding layers stack in invalid state. This should not happen +`)));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.7278665320924946,4.814462547283592,6.436522247411611,9],[1,1.1840100246247336,1.4061375836156955,1.6802272208863964,2.026757028388619,2.4770056063449646,3.080525271755482,3.9191964192627284,5.135152840833187,6.989961179534715,10]],Kr=[[-1,-.9194161097107025,-.8335625019330468,-.7425599821143978,-.6466611521029437,-.5462617907227869,-.4419033816638769,-.3342645487554494,-.224140440909962,-.11241087890006762,0],[-1,-.90603157029014,-.80786507256596,-.7064666939634,-.60294836853664,-.49849837513117,-.39430303318768,-.29147201034755,-.19097820800866,-.09361896280296,0],[-1,-.9021579584316141,-.8005762598234203,-.6964780623319391,-.5911906810998454,-.486050182576545,-.3823089430815083,-.28106046722897615,-.1831906535795894,-.08935809204418144,0],[-1,-.8917227442365535,-.781258746326964,-.6705130326902455,-.5612813129406509,-.4551067709033134,-.35319256652135966,-.2563741554088552,-.1651412821106526,-.0796919581982668,0],[-1,-.8843387974366064,-.7678744063886243,-.6529563724510552,-.5415870994657841,-.4352842206588936,-.33504449124791424,-.24138853420685147,-.15445285440944467,-.07409659641336663,0],[-1,-.8786709358426346,-.7577735191184886,-.6399546189952064,-.527284921869926,-.4211627631006314,-.3223479611761232,-.23107655627789858,-.1472057700818259,-.07035171210706326,0],[-1,-.8740862815291583,-.7497032990976209,-.6297119746181752,-.5161838335958787,-.41036238255751956,-.31277212146489963,-.2233976621705518,-.1418697367979619,-.06762117662323441,0],[-1,-.8702632331800649,-.7430366914122081,-.6213373075161548,-.5072025698095242,-.40171437727184167,-.30517930701410456,-.21736343968190863,-.137710238299109,-.06550774483471955,0],[-1,-.8670016295947213,-.7373984232432306,-.6143173985094293,-.49973884395492807,-.394584953527678,-.2989649949848695,-.21245647317021688,-.13434688362382652,-.0638072667348083,0],[-1,-.8641642839543857,-.732534623168535,-.6083127477059322,-.4934049257184696,-.3885773075899922,-.29376029055315767,-.2083678561173622,-.13155653399373268,-.062401588652553186,0]];let g=function(t){return l.fromValue_noAlloc(t)},E=function(e,t,n){return l.fromComponents(e,t,n)},L=function(t,n,r){return l.fromComponents_noNormalize(t,n,r)};const Se=function(t,n){const r=n+1,i=Math.ceil(Math.log10(Math.abs(t))),o=Math.round(t*Math.pow(10,r-i))*Math.pow(10,i-r);return parseFloat(o.toFixed(Math.max(r-i,0)))},It=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},Yr=function(e){if(!isFinite(e))return e;if(e<-50)return e===Math.trunc(e)?Number.NEGATIVE_INFINITY:0;let t=1;for(;e<10;)t=t*e,++e;e-=1;let n=.9189385332046727;n=n+(e+.5)*Math.log(e),n=n-e;const r=e*e;let i=e;return n=n+1/(12*i),i=i*r,n=n+1/(360*i),i=i*r,n=n+1/(1260*i),i=i*r,n=n+1/(1680*i),i=i*r,n=n+1/(1188*i),i=i*r,n=n+691/(360360*i),i=i*r,n=n+7/(1092*i),i=i*r,n=n+3617/(122400*i),Math.exp(n)/t},tn=.5671432904097838,jt=function(e,t=1e-10){let n,r;if(!Number.isFinite(e)||e===0)return e;if(e===1)return tn;e<10?n=0:n=Math.log(e)-Math.log(Math.log(e));for(let i=0;i<100;++i){if(r=(e*Math.exp(-n)+n*n)/(n+1),Math.abs(r-n).5?1:-1;if(Math.random()*20<1)return L(t,0,1);const n=Math.floor(Math.random()*(e+1));let r=n===0?Math.random()*616-308:Math.random()*16;Math.random()>.9&&(r=Math.trunc(r));let i=Math.pow(10,r);return Math.random()>.9&&(i=Math.trunc(i)),E(t,n,i)}static affordGeometricSeries_core(e,t,n,r){const i=t.mul(n.pow(r));return m.floor(e.div(i).mul(n.sub(1)).add(1).log10().div(n.log10()))}static sumGeometricSeries_core(e,t,n,r){return t.mul(n.pow(r)).mul(m.sub(1,n.pow(e))).div(m.sub(1,n))}static affordArithmeticSeries_core(e,t,n,r){const o=t.add(r.mul(n)).sub(n.div(2)),c=o.pow(2);return o.neg().add(c.add(n.mul(e).mul(2)).sqrt()).div(n).floor()}static sumArithmeticSeries_core(e,t,n,r){const i=t.add(r.mul(n));return e.div(2).mul(i.mul(2).plus(e.sub(1).mul(n)))}static efficiencyOfPurchase_core(e,t,n){return e.div(t).add(e.div(n))}normalize(){if(this.sign===0||this.mag===0&&this.layer===0)return this.sign=0,this.mag=0,this.layer=0,this;if(this.layer===0&&this.mag<0&&(this.mag=-this.mag,this.sign=-this.sign),this.layer===0&&this.mag=Ur)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e0;)this.layer-=1,this.layer===0?this.mag=Math.pow(10,this.mag):(this.mag=t*Math.pow(10,e),e=Math.abs(this.mag),t=Math.sign(this.mag));return this.layer===0&&(this.mag<0?(this.mag=-this.mag,this.sign=-this.sign):this.mag===0&&(this.sign=0)),this}fromComponents(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this.normalize(),this}fromComponents_noNormalize(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this}fromMantissaExponent(e,t){return this.layer=1,this.sign=Math.sign(e),e=Math.abs(e),this.mag=t+Math.log10(e),this.normalize(),this}fromMantissaExponent_noNormalize(e,t){return this.fromMantissaExponent(e,t),this}fromDecimal(e){return this.sign=e.sign,this.layer=e.layer,this.mag=e.mag,this}fromNumber(e){return this.mag=Math.abs(e),this.sign=Math.sign(e),this.layer=0,this.normalize(),this}fromString(e){const t=e,n=m.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const r=e.split("^^^");if(r.length===2){const b=parseFloat(r[0]),S=parseFloat(r[1]),$=r[1].split(";");let A=1;if($.length===2&&(A=parseFloat($[1]),isFinite(A)||(A=1)),isFinite(b)&&isFinite(S)){const I=m.pentate(b,S,A);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const i=e.split("^^");if(i.length===2){const b=parseFloat(i[0]),S=parseFloat(i[1]),$=i[1].split(";");let A=1;if($.length===2&&(A=parseFloat($[1]),isFinite(A)||(A=1)),isFinite(b)&&isFinite(S)){const I=m.tetrate(b,S,A);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const o=e.split("^");if(o.length===2){const b=parseFloat(o[0]),S=parseFloat(o[1]);if(isFinite(b)&&isFinite(S)){const $=m.pow(b,S);return this.sign=$.sign,this.layer=$.layer,this.mag=$.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}e=e.trim().toLowerCase();let c,u,d=e.split("pt");if(d.length===2){c=10,u=parseFloat(d[0]),d[1]=d[1].replace("(",""),d[1]=d[1].replace(")","");let b=parseFloat(d[1]);if(isFinite(b)||(b=1),isFinite(c)&&isFinite(u)){const S=m.tetrate(c,u,b);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}if(d=e.split("p"),d.length===2){c=10,u=parseFloat(d[0]),d[1]=d[1].replace("(",""),d[1]=d[1].replace(")","");let b=parseFloat(d[1]);if(isFinite(b)||(b=1),isFinite(c)&&isFinite(u)){const S=m.tetrate(c,u,b);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const v=e.split("e"),_=v.length-1;if(_===0){const b=parseFloat(e);if(isFinite(b))return this.fromNumber(b),m.fromStringCache.size>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}else if(_===1){const b=parseFloat(e);if(isFinite(b)&&b!==0)return this.fromNumber(b),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}const p=e.split("e^");if(p.length===2){this.sign=1,p[0].charAt(0)=="-"&&(this.sign=-1);let b="";for(let S=0;S=43&&$<=57||$===101)b+=p[1].charAt(S);else return this.layer=parseFloat(b),this.mag=parseFloat(p[1].substr(S+1)),this.normalize(),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}if(_<1)return this.sign=0,this.layer=0,this.mag=0,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this;const C=parseFloat(v[0]);if(C===0)return this.sign=0,this.layer=0,this.mag=0,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this;let k=parseFloat(v[v.length-1]);if(_>=2){const b=parseFloat(v[v.length-2]);isFinite(b)&&(k*=Math.sign(b),k+=It(b))}if(!isFinite(C))this.sign=v[0]==="-"?-1:1,this.layer=_,this.mag=k;else if(_===1)this.sign=Math.sign(C),this.layer=1,this.mag=k+Math.log10(Math.abs(C));else if(this.sign=Math.sign(C),this.layer=_,_===2){const b=m.mul(E(1,2,k),g(C));return this.sign=b.sign,this.layer=b.layer,this.mag=b.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}else this.mag=k;return this.normalize(),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}fromValue(e){return e instanceof m?this.fromDecimal(e):typeof e=="number"?this.fromNumber(e):typeof e=="string"?this.fromString(e):(this.sign=0,this.layer=0,this.mag=0,this)}toNumber(){return Number.isFinite(this.layer)?this.layer===0?this.sign*this.mag:this.layer===1?this.sign*Math.pow(10,this.mag):this.mag>0?this.sign>0?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:0:Number.NaN}mantissaWithDecimalPlaces(e){return isNaN(this.m)?Number.NaN:this.m===0?0:Se(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Se(this.mag,e)}toString(){return isNaN(this.layer)||isNaN(this.sign)||isNaN(this.mag)?"NaN":this.mag===Number.POSITIVE_INFINITY||this.layer===Number.POSITIVE_INFINITY?this.sign===1?"Infinity":"-Infinity":this.layer===0?this.mag<1e21&&this.mag>1e-7||this.mag===0?(this.sign*this.mag).toString():this.m+"e"+this.e:this.layer===1?this.m+"e"+this.e:this.layer<=zt?(this.sign===-1?"-":"")+"e".repeat(this.layer)+this.mag:(this.sign===-1?"-":"")+"(e^"+this.layer+")"+this.mag}toExponential(e){return this.layer===0?(this.sign*this.mag).toExponential(e):this.toStringWithDecimalPlaces(e)}toFixed(e){return this.layer===0?(this.sign*this.mag).toFixed(e):this.toStringWithDecimalPlaces(e)}toPrecision(e){return this.e<=-7?this.toExponential(e-1):e>this.e?this.toFixed(e-this.exponent-1):this.toExponential(e-1)}valueOf(){return this.toString()}toJSON(){return this.toString()}toStringWithDecimalPlaces(e){return this.layer===0?this.mag<1e21&&this.mag>1e-7||this.mag===0?(this.sign*this.mag).toFixed(e):Se(this.m,e)+"e"+Se(this.e,e):this.layer===1?Se(this.m,e)+"e"+Se(this.e,e):this.layer<=zt?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Se(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Se(this.mag,e)}abs(){return L(this.sign===0?0:1,this.layer,this.mag)}neg(){return L(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?m.dZero:this.layer===0?E(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?m.dZero:this.layer===0?E(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?m.dZero:this.layer===0?E(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?m.dZero:this.layer===0?E(this.sign,0,Math.trunc(this.mag)):this}add(e){const t=g(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer)||this.sign===0)return t;if(t.sign===0)return this;if(this.sign===-t.sign&&this.layer===t.layer&&this.mag===t.mag)return L(0,0,0);let n,r;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(m.cmpabs(this,t)>0?(n=this,r=t):(n=t,r=this),n.layer===0&&r.layer===0)return m.fromNumber(n.sign*n.mag+r.sign*r.mag);const i=n.layer*Math.sign(n.mag),o=r.layer*Math.sign(r.mag);if(i-o>=2)return n;if(i===0&&o===-1){if(Math.abs(r.mag-Math.log10(n.mag))>St)return n;{const c=Math.pow(10,Math.log10(n.mag)-r.mag),u=r.sign+n.sign*c;return E(Math.sign(u),1,r.mag+Math.log10(Math.abs(u)))}}if(i===1&&o===0){if(Math.abs(n.mag-Math.log10(r.mag))>St)return n;{const c=Math.pow(10,n.mag-Math.log10(r.mag)),u=r.sign+n.sign*c;return E(Math.sign(u),1,Math.log10(r.mag)+Math.log10(Math.abs(u)))}}if(Math.abs(n.mag-r.mag)>St)return n;{const c=Math.pow(10,n.mag-r.mag),u=r.sign+n.sign*c;return E(Math.sign(u),1,r.mag+Math.log10(Math.abs(u)))}}plus(e){return this.add(e)}sub(e){return this.add(g(e).neg())}subtract(e){return this.sub(e)}minus(e){return this.sub(e)}mul(e){const t=g(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer))return t;if(this.sign===0||t.sign===0)return L(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return L(this.sign*t.sign,0,1);let n,r;if(this.layer>t.layer||this.layer==t.layer&&Math.abs(this.mag)>Math.abs(t.mag)?(n=this,r=t):(n=t,r=this),n.layer===0&&r.layer===0)return m.fromNumber(n.sign*r.sign*n.mag*r.mag);if(n.layer>=3||n.layer-r.layer>=2)return E(n.sign*r.sign,n.layer,n.mag);if(n.layer===1&&r.layer===0)return E(n.sign*r.sign,1,n.mag+Math.log10(r.mag));if(n.layer===1&&r.layer===1)return E(n.sign*r.sign,1,n.mag+r.mag);if(n.layer===2&&r.layer===1){const i=E(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(E(Math.sign(r.mag),r.layer-1,Math.abs(r.mag)));return E(n.sign*r.sign,i.layer+1,i.sign*i.mag)}if(n.layer===2&&r.layer===2){const i=E(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(E(Math.sign(r.mag),r.layer-1,Math.abs(r.mag)));return E(n.sign*r.sign,i.layer+1,i.sign*i.mag)}throw Error("Bad arguments to mul: "+this+", "+e)}multiply(e){return this.mul(e)}times(e){return this.mul(e)}div(e){const t=g(e);return this.mul(t.recip())}divide(e){return this.div(e)}divideBy(e){return this.div(e)}dividedBy(e){return this.div(e)}recip(){return this.mag===0?m.dNaN:this.layer===0?E(this.sign,0,1/this.mag):E(this.sign,this.layer,-this.mag)}reciprocal(){return this.recip()}reciprocate(){return this.recip()}cmp(e){const t=g(e);return this.sign>t.sign?1:this.sign0?this.layer:-this.layer,r=t.mag>0?t.layer:-t.layer;return n>r?1:nt.mag?1:this.mag0?t:this}clamp(e,t){return this.max(e).min(t)}clampMin(e){return this.max(e)}clampMax(e){return this.min(e)}cmp_tolerance(e,t){const n=g(e);return this.eq_tolerance(n,t)?0:this.cmp(n)}compare_tolerance(e,t){return this.cmp_tolerance(e,t)}eq_tolerance(e,t){const n=g(e);if(t==null&&(t=1e-7),this.sign!==n.sign||Math.abs(this.layer-n.layer)>1)return!1;let r=this.mag,i=n.mag;return this.layer>n.layer&&(i=It(i)),this.layer0?E(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):E(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?m.dNaN:this.layer>0?E(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):E(this.sign,0,Math.log10(this.mag))}log(e){return e=g(e),this.sign<=0||e.sign<=0||e.sign===1&&e.layer===0&&e.mag===1?m.dNaN:this.layer===0&&e.layer===0?E(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):m.div(this.log10(),e.log10())}log2(){return this.sign<=0?m.dNaN:this.layer===0?E(this.sign,0,Math.log2(this.mag)):this.layer===1?E(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?E(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):E(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?m.dNaN:this.layer===0?E(this.sign,0,Math.log(this.mag)):this.layer===1?E(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?E(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):E(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}logarithm(e){return this.log(e)}pow(e){const t=g(e),n=this,r=t;if(n.sign===0)return r.eq(0)?L(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(r.sign===0)return L(1,0,1);if(r.sign===1&&r.layer===0&&r.mag===1)return n;const i=n.absLog10().mul(r).pow10();return this.sign===-1?Math.abs(r.toNumber()%2)%2===1?i.neg():Math.abs(r.toNumber()%2)%2===0?i:m.dNaN:i}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return m.dNaN;let e=this;if(e.layer===0){const t=Math.pow(10,e.sign*e.mag);if(Number.isFinite(t)&&Math.abs(t)>=.1)return E(1,0,t);if(e.sign===0)return m.dOne;e=L(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?E(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?E(-e.sign,e.layer+1,-e.mag):m.dOne}pow_base(e){return g(e).pow(this)}root(e){const t=g(e);return this.pow(t.recip())}factorial(){return this.mag<0?this.add(1).gamma():this.layer===0?this.add(1).gamma():this.layer===1?m.exp(m.mul(this,m.ln(this).sub(1))):m.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(L(1,0,24)))return m.fromNumber(Yr(this.sign*this.mag));const e=this.mag-1;let t=.9189385332046727;t=t+(e+.5)*Math.log(e),t=t-e;const n=e*e;let r=e,i=12*r,o=1/i,c=t+o;if(c===t||(t=c,r=r*n,i=360*r,o=1/i,c=t-o,c===t))return m.exp(t);t=c,r=r*n,i=1260*r;let u=1/i;return t=t+u,r=r*n,i=1680*r,u=1/i,t=t-u,m.exp(t)}else return this.layer===1?m.exp(m.mul(this,m.ln(this).sub(1))):m.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?m.dOne:this.layer===0&&this.mag<=709.7?m.fromNumber(Math.exp(this.sign*this.mag)):this.layer===0?E(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?E(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):E(1,this.layer+1,this.sign*this.mag)}sqr(){return this.pow(2)}sqrt(){if(this.layer===0)return m.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return E(1,2,Math.log10(this.mag)-.3010299956639812);{const e=m.div(L(this.sign,this.layer-1,this.mag),L(1,0,2));return e.layer+=1,e.normalize(),e}}cube(){return this.pow(3)}cbrt(){return this.pow(1/3)}tetrate(e=2,t=L(1,0,1)){if(e===1)return m.pow(this,t);if(e===0)return new m(t);if(this.eq(m.dOne))return m.dOne;if(this.eq(-1))return m.pow(this,t);if(e===Number.POSITIVE_INFINITY){const i=this.toNumber();if(i<=1.444667861009766&&i>=.06598803584531254){if(i>1.444667861009099)return m.fromNumber(Math.E);const o=m.ln(this).neg();return o.lambertw().div(o)}else return i>1.444667861009766?m.fromNumber(Number.POSITIVE_INFINITY):m.dNaN}if(this.eq(m.dZero)){let i=Math.abs((e+1)%2);return i>1&&(i=2-i),m.fromNumber(i)}if(e<0)return m.iteratedlog(t,this,-e);t=g(t);const n=e;e=Math.trunc(e);const r=n-e;if(this.gt(m.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let i=0;i3)return L(t.sign,t.layer+(e-i-1),t.mag);if(i>1e4)return t}return t}iteratedexp(e=2,t=L(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return m.tetrate(e,-t,this);e=g(e);let n=m.fromDecimal(this);const r=t;t=Math.trunc(t);const i=r-t;if(n.layer-e.layer>3){const o=Math.min(t,n.layer-e.layer-3);t-=o,n.layer-=o}for(let o=0;o1e4)return n}return i>0&&i<1&&(e.eq(10)?n=n.layeradd10(-i):n=n.layeradd(-i,e)),n}slog(e=10,t=100){let n=.001,r=!1,i=!1,o=this.slog_internal(e).toNumber();for(let c=1;c1&&i!=d&&(r=!0),i=d,r?n/=2:n*=2,n=Math.abs(n)*(d?-1:1),o+=n,n===0)break}return m.fromNumber(o)}slog_internal(e=10){if(e=g(e),e.lte(m.dZero)||e.eq(m.dOne))return m.dNaN;if(e.lt(m.dOne))return this.eq(m.dOne)?m.dZero:this.eq(m.dZero)?m.dNegOne:m.dNaN;if(this.mag<0||this.eq(m.dZero))return m.dNegOne;let t=0,n=m.fromDecimal(this);if(n.layer-e.layer>3){const r=n.layer-e.layer-3;t+=r,n.layer-=r}for(let r=0;r<100;++r)if(n.lt(m.dZero))n=m.pow(e,n),t-=1;else{if(n.lte(m.dOne))return m.fromNumber(t+m.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=m.log(n,e)}return m.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:m.critical_section(e,t,Kr)}static tetrate_critical(e,t){return m.critical_section(e,t,Zr)}static critical_section(e,t,n){t*=10,t<0&&(t=0),t>10&&(t=10),e<2&&(e=2),e>10&&(e=10);let r=0,i=0;for(let c=0;ce){const u=(e-Ve[c])/(Ve[c+1]-Ve[c]);r=n[c][Math.floor(t)]*(1-u)+n[c+1][Math.floor(t)]*u,i=n[c][Math.ceil(t)]*(1-u)+n[c+1][Math.ceil(t)]*u;break}const o=t-Math.floor(t);return r<=0||i<=0?r*(1-o)+i*o:Math.pow(e,Math.log(r)/Math.log(e)*(1-o)+Math.log(i)/Math.log(e)*o)}layeradd10(e){e=m.fromValue_noAlloc(e).toNumber();const t=m.fromDecimal(this);if(e>=1){t.mag<0&&t.layer>0?(t.sign=0,t.mag=0,t.layer=0):t.sign===-1&&t.layer==0&&(t.sign=1,t.mag=-t.mag);const n=Math.trunc(e);e-=n,t.layer+=n}if(e<=-1){const n=Math.trunc(e);if(e-=n,t.layer+=n,t.layer<0)for(let r=0;r<100;++r){if(t.layer++,t.mag=Math.log10(t.mag),!isFinite(t.mag))return t.sign===0&&(t.sign=1),t.layer<0&&(t.layer=0),t.normalize();if(t.layer>=0)break}}for(;t.layer<0;)t.layer++,t.mag=Math.log10(t.mag);return t.sign===0&&(t.sign=1,t.mag===0&&t.layer>=1&&(t.layer-=1,t.mag=1)),t.normalize(),e!==0?t.layeradd(e,10):t}layeradd(e,t){const r=this.slog(t).toNumber()+e;return r>=0?m.tetrate(t,r):Number.isFinite(r)?r>=-1?m.log(m.tetrate(t,r+1),t):m.log(m.log(m.tetrate(t,r+2),t),t):m.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return m.fromNumber(jt(this.toNumber()));if(this.layer===0)return m.fromNumber(jt(this.sign*this.mag));if(this.layer===1)return Gt(this);if(this.layer===2)return Gt(this);if(this.layer>=3)return L(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return L(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=L(1,0,1)){t=g(t);const n=e;e=Math.trunc(e);const r=n-e;r!==0&&(t.eq(m.dOne)?(++e,t=m.fromNumber(r)):this.eq(10)?t=t.layeradd10(r):t=t.layeradd(r,this));for(let i=0;i10)return t}return t}sin(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.sin(this.sign*this.mag)):L(0,0,0)}cos(){return this.mag<0?m.dOne:this.layer===0?m.fromNumber(Math.cos(this.sign*this.mag)):L(0,0,0)}tan(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.tan(this.sign*this.mag)):L(0,0,0)}asin(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.asin(this.sign*this.mag)):L(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?m.fromNumber(Math.acos(this.toNumber())):this.layer===0?m.fromNumber(Math.acos(this.sign*this.mag)):L(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.atan(this.sign*this.mag)):m.fromNumber(Math.atan(this.sign*(1/0)))}sinh(){return this.exp().sub(this.negate().exp()).div(2)}cosh(){return this.exp().add(this.negate().exp()).div(2)}tanh(){return this.sinh().div(this.cosh())}asinh(){return m.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return m.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?L(Number.NaN,Number.NaN,Number.NaN):m.ln(this.add(1).div(m.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(m.pow(10,e))}egg(){return this.add(9)}lessThanOrEqualTo(e){return this.cmp(e)<1}lessThan(e){return this.cmp(e)<0}greaterThanOrEqualTo(e){return this.cmp(e)>-1}greaterThan(e){return this.cmp(e)>0}};let l=m;l.fromStringCache=new Br(Wr);l.dZero=L(0,0,0);l.dOne=L(1,0,1);l.dNegOne=L(-1,0,1);l.dTwo=L(1,0,2);l.dTen=L(1,0,10);l.dNaN=L(Number.NaN,Number.NaN,Number.NaN);l.dInf=L(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);l.dNegInf=L(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);l.dNumberMax=E(1,0,Number.MAX_VALUE);l.dNumberMin=E(1,0,Number.MIN_VALUE);g=l.fromValue_noAlloc;E=l.fromComponents;L=l.fromComponents_noNormalize;l.fromMantissaExponent;l.fromMantissaExponent_noNormalize;const Xr=new l(1);function Qe(e,t,n=!0){let r=l.log10(e).floor(),i=l.div(e,l.pow(10,r));i.toStringWithDecimalPlaces(t)==="10"&&(i=Xr,r=r.add(1));const o=r.gte(1e9)?ce(r,Math.max(Math.max(t,3),R.defaultDecimalsShown)):r.gte(1e4)?ft(r,0):r.toStringWithDecimalPlaces(0);return n?i.toStringWithDecimalPlaces(t)+"e"+o:"e"+o}function ft(e,t){if(e==null)return"NaN";if(e=new l(e),e.mag<.001)return 0 .toFixed(t);const r=e.toStringWithDecimalPlaces(t).split(".");return r[0]=r[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"),r.length==1?r[0]:r[0]+"."+r[1]}function nn(e,t){return e==null?"NaN":(e=new l(e),e.mag<1e-4?0 .toFixed(t):(e.mag<.1&&t!==0&&(t=Math.max(Math.max(t,e.log10().negate().ceil().toNumber()),R.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const Qr=new l("eeee1000"),ei=new l("e100000"),Ht=new l("e1000"),rn=new l(1e9),ti=new l(1e6),ni=new l(1e3),ri=new l(.98),ii=new l(.001),an=new l(0);function ce(e,t,n){if(t==null&&(t=R.defaultDecimalsShown),n=n!=null?n:R.defaultShowSmall,e=new l(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+ce(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(Qr)){const r=e.slog();return r.gte(ti)?"F"+ce(r.floor()):l.pow(10,r.sub(r.floor())).toStringWithDecimalPlaces(3)+"F"+ft(r.floor(),0)}else{if(e.gte(ei))return Qe(e,0,!1);if(e.gte(Ht))return Qe(e,0);if(e.gte(rn))return Qe(e,t);if(e.gte(ni))return ft(e,0);if(e.gte(ii)||!n)return nn(e,t);if(e.eq(an))return 0 .toFixed(t)}return e=sn(e),e.lt(Ht)?Qe(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):ce(e,t)+"\u207B\xB9"}function le(e){return e=new l(e),e.sign<0?"-"+le(e.neg()):e.gte(rn)||e.lte(ri)&&!e.eq(an)?ce(e):ce(e,0)}function on(e){return l.lt(e,0)?"-"+on(l.neg(e)):l.gt(e,2**51)?ce(l.div(e,31536e3))+"y":(e=new l(e).toNumber(),e<60?ce(e)+"s":e<3600?le(Math.floor(e/60))+"m "+ce(e%60)+"s":e<86400?le(Math.floor(e/3600))+"h "+le(Math.floor(e/60)%60)+"m "+le(e%60)+"s":e<31536e3?le(Math.floor(e/84600)%365)+"d "+le(Math.floor(e/3600)%24)+"h "+le(Math.floor(e/60)%60)+"m":le(Math.floor(e/31536e3))+"y "+le(Math.floor(e/84600)%365)+"d "+le(Math.floor(e/3600)%24)+"h")}function ai(e,t,n){e=new l(e);let r=e.toStringWithDecimalPlaces(t);return new l(r).gte(n)&&(r=l.sub(n,Math.pow(.1,t)).toStringWithDecimalPlaces(t)),r}function oi(e,t){return ce(e,t,!0)}function sn(e){let t=l.log10(e).ceil();const n=l.div(e,l.pow(10,t));return t=t.neg(),e=new l(10).pow(t).times(n),e}var si=Object.freeze(Object.defineProperty({__proto__:null,default:l,exponentialFormat:Qe,commaFormat:ft,regularFormat:nn,format:ce,formatWhole:le,formatTime:on,toPlaces:ai,formatSmall:oi,invertOOM:sn},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:li,commaFormat:ui,regularFormat:ci,format:ln,formatWhole:un,formatTime:Pt,toPlaces:di,formatSmall:fi,invertOOM:mi}=si;window.Decimal=l;window.exponentialFormat=li;window.commaFormat=ui;window.regularFormat=ci;window.format=ln;window.formatWhole=un;window.formatTime=Pt;window.toPlaces=di;window.formatSmall=fi;window.invertOOM=mi;function gi(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function $t(e){return typeof e=="function"}var G=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(G||{});const nt=Symbol("DoNotCache");function ee(e,t){const n=e[t];$t(n)&&n.length===0&&!n[nt]?e[t]=D(n.bind(e)):$t(n)&&(e[t]=n.bind(e),e[t][nt]=!0)}function Wt(e){return $t(e)&&!e[nt]&&(e=D(e)),e}const mt=Symbol("Component"),Et=Symbol("GatherProps");let hi=0;function vi(e="feature-"){return e+hi++}var rt=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(rt||{});function gt(e){const t=s(e);return t!==2&&t!==!1}function cn(e){return s(e)===1}function ne(e){return e[nt]=!0,e}function Fe(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}var K=window.state=Mt({lastTenTicks:[],hasNaN:!1,NaNPath:[],errors:Be([])});const Oe={variables:{"--foreground":"#dfdfdf","--background":"#0f0f0f","--feature-foreground":"#0f0f0f","--tooltip-background":"rgba(0, 0, 0, 0.75)","--raised-background":"#0f0f0f","--points":"#ffffff","--locked":"#bf8f8f","--highlighted":"#333","--bought":"#77bf5f","--danger":"rgb(220, 53, 69)","--link":"#02f2f2","--outline":"#dfdfdf","--accent1":"#627a82","--accent2":"#658262","--accent3":"#7c6282","--border-radius":"15px","--modal-border":"solid 2px var(--color)","--feature-margin":"0px"},floatingTabs:!0,mergeAdjacent:!0,showPin:!0};var Vt=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(Vt||{}),yt={classic:Oe,paper:{...Oe,variables:{...Oe.variables,"--background":"#2a323d","--feature-foreground":"#000","--raised-background":"#333c4a","--locked":"#3a3e45","--bought":"#5C8A58","--outline":"#333c4a","--border-radius":"4px","--modal-border":"","--feature-margin":"5px"},floatingTabs:!1},nordic:{...Oe,variables:{...Oe.variables,"--foreground":"#D8DEE9","--background":"#2E3440","--feature-foreground":"#000","--raised-background":"#3B4252","--points":"#E5E9F0","--locked":"#4c566a","--highlighted":"#434c5e","--bought":"#8FBCBB","--danger":"#D08770","--link":"#88C0D0","--outline":"#3B4252","--accent1":"#B48EAD","--accent2":"#A3BE8C","--accent3":"#EBCB8B","--border-radius":"4px","--modal-border":"solid 2px #3B4252","--feature-margin":"5px"},floatingTabs:!1},aqua:{...Oe,variables:{...Oe.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}};const Q=Yt();"fonts"in document&&(document.fonts.onloadingdone=()=>Q.emit("fontsLoaded"));var pi=Object.freeze(Object.defineProperty({__proto__:null,globalBus:Q},Symbol.toStringTag,{value:"Module"}));const bi=B({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var _;const n=M({}),r=new ResizeObserver(u),i=M(null);pt(()=>{const p=i.value;p!=null&&r.observe(p)});let o=!0,c=M((_=i.value)==null?void 0:_.getBoundingClientRect());function u(){o&&(o=!1,Te(()=>{var p;c.value=(p=i.value)==null?void 0:p.getBoundingClientRect(),Object.values(n.value).filter(C=>C).forEach(C=>C.rect=C.element.getBoundingClientRect()),t("updateNodes",n.value),o=!0}))}Q.on("fontsLoaded",u);const d={attributes:!1,childList:!0,subtree:!1};ot(fn,(p,C)=>{const k=new MutationObserver(()=>v(p));k.observe(C,d),n.value[p]={element:C,observer:k,rect:C.getBoundingClientRect()},u()}),ot(mn,p=>{var C;(C=n.value[p])==null||C.observer.disconnect(),n.value[p]=void 0,u()}),ot(gn,n),ot(hn,c);function v(p){const C=n.value[p];C!=null&&(C.rect=C.element.getBoundingClientRect(),t("updateNodes",n.value))}return(p,C)=>(h(),w(U,null,[xe(p.$slots,"default",{},void 0,!0),f("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var dn=H(bi,[["__scopeId","data-v-2b1dc1bc"]]);const _i=["onPointerdown"],yi={class:"modal-wrapper"},wi={class:"modal-container"},Ni={class:"modal-header"},Ci=V(" default header "),Si={class:"modal-body"},Ii=V(" default body "),$i={class:"modal-footer"},ki=f("div",{class:"modal-default-flex-grow"},null,-1),Ee=B({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const i=de(e),o=D(()=>s(i.modelValue)||u.value);function c(){n("update:modelValue",!1)}const u=M(!1),d=M(null),v=D(()=>{var _,p;return(p=(_=d.value)==null?void 0:_.nodes)!=null?p:null});return t({isOpen:o,nodes:v}),(_,p)=>(h(),q(Pn,{to:"#modal-root"},[y(xt,{name:"modal",onBeforeEnter:p[0]||(p[0]=C=>u.value=!0),onAfterLeave:p[1]||(p[1]=C=>u.value=!1)},{default:T(()=>[bt(f("div",Re({class:"modal-mask",onPointerdown:tt(c,["self"])},_.$attrs),[f("div",yi,[f("div",wi,[f("div",Ni,[xe(_.$slots,"header",{shown:s(o)},()=>[Ci])]),f("div",Si,[y(dn,{ref_key:"contextRef",ref:d},{default:T(()=>[xe(_.$slots,"body",{shown:s(o)},()=>[Ii])]),_:3},512)]),f("div",$i,[xe(_.$slots,"footer",{shown:s(o)},()=>[f("div",{class:"modal-default-footer"},[ki,f("button",{class:"button modal-default-button",onClick:c}," Close ")])])])])])],16,_i),[[Kt,e.modelValue]])]),_:3})]))}}),fn=Symbol("RegisterNode"),mn=Symbol("UnregisterNode"),gn=Symbol("Nodes"),hn=Symbol("Bounds"),re=Mt({});window.layers=re;const je={},ge=[];function vn(e,t){return yn(()=>{const n={},r=n.emitter=Yt();if(n.on=r.on.bind(r),n.emit=r.emit.bind(r),n.nodes=M({}),n.id=e,ge.push(e),je[e]=new Set,n.minimized=Ot(!1,!1),Object.assign(n,t.call(n,n)),ge[ge.length-1]==null||ge[ge.length-1]!==e)throw new Error(`Adding layers stack in invalid state. This should not happen Stack: ${ge} -Trying to pop ${n.id}`);ge.pop(),ee(n,"color"),ee(n,"display"),ee(n,"classes"),ee(n,"style"),ee(n,"name"),xe(n,"name",n.id),ee(n,"minWidth"),xe(n,"minWidth",600),ee(n,"minimizable"),xe(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}xe(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(Pe,{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:ze,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:0).sub(o)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Bi(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.sub(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.sub(r,t)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Ai(e,t,n){return N(t)?t.invert(l.div(e,Y(n))):N(n)?n.invert(l.div(e,Y(t))):(console.error("Could not invert due to no input being a variable"),0)}function Ui(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.times(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.times(r,t)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function zi(e,t,n){return N(t)?a.div(e,n):N(n)?a.div(e,t):(console.error("Could not apply substitution due to no input being a variable"),a.constant(0))}function ji(e,t,n){return N(t)?t.invert(l.mul(e,Y(n))):N(n)?n.invert(l.div(Y(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function Gi(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.div(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.div(t,r)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Hi(e,t,n){return N(t)?a.mul(e,n):N(n)?a.mul(e,t):(console.error("Could not apply substitution due to no input being a variable"),a.constant(0))}function Wi(e,t){return N(t)?t.invert(l.recip(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ji(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.ln(n)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Zi(e,t){return N(t)?t.invert(l.pow10(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ki(e){return l.ln(e).sub(1).times(e).div(_n)}function Yi(e,t){if(N(t)){const n=_n.times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function Xi(e,t){return N(t)?t.isIntegrable()?new a({inputs:[t.getIntegralFormula(e)],evaluate:Ki,invert:Yi}):(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 Qi(e,t,n){return N(t)?t.invert(l.pow(Y(n),e)):N(n)?n.invert(l.root(Y(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function ea(e,t){return l.ln(e).sub(1).times(e).div(l.ln(t))}function ta(e,t,n){if(N(t)){const r=l.ln(Y(n)).times(e);return t.invert(r.div(r.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function na(e,t,n){return N(t)?t.isIntegrable()?new a({inputs:[t.getIntegralFormula(e),n],evaluate:ea,invert:ta}):(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 ra(e,t){return N(t)?t.invert(l.pow(2,e)):(console.error("Could not invert due to no input being a variable"),0)}function ia(e){return l.ln(e).sub(1).times(e).div(l.ln(2))}function aa(e,t){if(N(t)){const n=l.ln(2).times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function oa(e,t){return N(t)?t.isIntegrable()?new a({inputs:[t.getIntegralFormula(e)],evaluate:ia,invert:aa}):(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 sa(e,t){return N(t)?t.invert(l.exp(e)):(console.error("Could not invert due to no input being a variable"),0)}function la(e){return l.ln(e).sub(1).times(e)}function ua(e,t){return N(t)?t.invert(l.div(e,l.div(e,Math.E).lambertw())):(console.error("Could not invert due to no input being a variable"),0)}function ca(e,t){return N(t)?t.isIntegrable()?new a({inputs:[t.getIntegralFormula(e)],evaluate:la,invert:ua}):(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 da(e,t,n){return N(t)?t.invert(l.root(e,Y(n))):N(n)?n.invert(l.ln(e).div(l.ln(Y(t)))):(console.error("Could not invert due to no input being a variable"),0)}function fa(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),i=a.add(n,1);return a.pow(r,i).div(i)}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.pow(t,r).div(a.ln(t))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function ma(e,t){return N(t)?t.invert(l.root(e,10)):(console.error("Could not invert due to no input being a variable"),0)}function ga(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.pow10(n).div(a.ln(10))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function ha(e,t,n){return N(t)?t.invert(l.ln(e).div(l.ln(Y(n)))):N(n)?n.invert(l.root(Y(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function va(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.pow(n,r).div(a.ln(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),i=a.add(t,1);return a.pow(r,i).div(i)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function pa(e,t,n){return N(t)?t.invert(l.root(e,l.recip(Y(n)))):N(n)?n.invert(l.ln(Y(t)).div(l.ln(e))):(console.error("Could not invert due to no input being a variable"),0)}function ba(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.pow(r,a.recip(n).add(1)).times(n).div(a.add(n,1))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function _a(e,t){return N(t)?t.invert(l.ln(e)):(console.error("Could not invert due to no input being a variable"),0)}function ya(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.exp(n)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function wa(e,t=2,n=l.fromComponents_noNormalize(1,0,1)){const r=l.minabs(t,1e308).toNumber();return l.tetrate(e,r,n)}function Na(e,t,n,r){return N(t)?t.invert(l.ssqrt(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ca(e,t=2,n=l.fromComponents_noNormalize(1,0,1)){const r=l.minabs(t,1e308).toNumber();return l.iteratedexp(e,r,new l(n))}function Sa(e,t,n,r){return N(t)?t.invert(l.iteratedlog(e,Math.E,l.minabs(1e308,Y(n)).toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function Ia(e,t=10,n=2){const r=l.minabs(n,1e308).toNumber();return l.iteratedlog(e,t,r)}function $a(e,t=10){const n=l.minabs(t,1e308).toNumber();return l.slog(e,n)}function ka(e,t,n){return N(t)?t.invert(l.tetrate(e,l.minabs(1e308,Y(n)).toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function Ma(e,t,n){const r=l.minabs(t,1e308).toNumber();return l.layeradd(e,r,n)}function xa(e,t,n,r){return N(t)?t.invert(l.layeradd(e,l.minabs(1e308,Y(n)).negate().toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function Fa(e,t){return N(t)?t.invert(l.pow(Math.E,e).times(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ta(e,t){return N(t)?t.invert(l.tetrate(e,2)):(console.error("Could not invert due to no input being a variable"),0)}function Pa(e,t,n){const r=l.minabs(t,1e308).toNumber();return l.pentate(e,r,n)}function Ea(e,t){return N(t)?t.invert(l.asin(e)):(console.error("Could not invert due to no input being a variable"),0)}function Va(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.cos(n).neg()}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Oa(e,t){return N(t)?t.invert(l.acos(e)):(console.error("Could not invert due to no input being a variable"),0)}function La(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.sin(n)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Da(e,t){return N(t)?t.invert(l.atan(e)):(console.error("Could not invert due to no input being a variable"),0)}function qa(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.cos(n).ln().neg()}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Ra(e,t){return N(t)?t.invert(l.sin(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ba(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.asin(n).times(n).add(a.sqrt(a.sub(1,a.pow(n,2))))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Aa(e,t){return N(t)?t.invert(l.cos(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ua(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.acos(n).times(n).sub(a.sqrt(a.sub(1,a.pow(n,2))))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function za(e,t){return N(t)?t.invert(l.tan(e)):(console.error("Could not invert due to no input being a variable"),0)}function ja(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.atan(n).times(n).sub(a.ln(a.pow(n,2).add(1)).div(2))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Ga(e,t){return N(t)?t.invert(l.asinh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ha(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.cosh(n)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Wa(e,t){return N(t)?t.invert(l.acosh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ja(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.sinh(n)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Za(e,t){return N(t)?t.invert(l.atanh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ka(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.cosh(n).ln()}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Ya(e,t){return N(t)?t.invert(l.sinh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Xa(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.asinh(n).times(n).sub(a.pow(n,2).add(1).sqrt())}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Qa(e,t){return N(t)?t.invert(l.cosh(e)):(console.error("Could not invert due to no input being a variable"),0)}function eo(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.acosh(n).times(n).sub(a.add(n,1).sqrt().times(a.sub(n,1).sqrt()))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function to(e,t){return N(t)?t.invert(l.tanh(e)):(console.error("Could not invert due to no input being a variable"),0)}function no(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.atanh(n).times(n).add(a.sub(1,a.pow(n,2)).ln().div(2))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Ze(e){return(t,n)=>new a({inputs:[t,n],evaluate:e,invert:st})}function N(e){return e instanceof Z&&e.hasVariable()}function Y(e,t){return e instanceof Z?e.evaluate(t):s(e)}function ro(){return a.pow(this,2).div(2)}function io(){return this}const X=class{constructor(e){this.negate=this.neg,this.negated=this.neg,this.sgn=this.sign,this.plus=this.add,this.subtract=this.sub,this.minus=this.sub,this.multiply=this.mul,this.times=this.mul,this.divide=this.div,this.divideBy=this.div,this.dividedBy=this.div,this.reciprocal=this.recip,this.reciprocate=this.recip,this.logarithm=this.log;let t;"inputs"in e&&(e.inputs=e.inputs.map(n=>typeof n=="object"&&Oe in n?n[Oe]:n)),"variable"in e?(typeof e.variable=="object"&&Oe in e.variable&&(e.variable=e.variable[Oe]),t=this.setupVariable(e)):"evaluate"in e?t=this.setupFormula(e):t=this.setupConstant(e),this.inputs=t.inputs,this.internalVariables=t.internalVariables,this.innermostVariable=t.innermostVariable,this.internalEvaluate=t.internalEvaluate,this.internalInvert=t.internalInvert,this.internalIntegrate=t.internalIntegrate,this.internalIntegrateInner=t.internalIntegrateInner,this.applySubstitution=t.applySubstitution}setupVariable({variable:e}){return{inputs:[e],internalVariables:1,innermostVariable:e,internalIntegrate:ro,internalIntegrateInner:io,applySubstitution:st}}setupConstant({inputs:e}){return e.length!==1&&console.error("Evaluate function is required if inputs is not length 1"),{inputs:e,internalVariables:0}}setupFormula(e){var C,k;const{inputs:t,evaluate:n,invert:r,integrate:i,integrateInner:o,applySubstitution:c}=e,u=t.reduce((b,S)=>b+(S instanceof X?S.internalVariables:0),0),d=t.find(b=>b instanceof X&&b.hasVariable()),v=u===1?d==null?void 0:d.innermostVariable:void 0,_=(C=d==null?void 0:d.isInvertible())!=null?C:!1,p=(k=d==null?void 0:d.isIntegrable())!=null?k:!1;return{inputs:t,internalEvaluate:n,internalInvert:_?r:void 0,internalIntegrate:p?i:void 0,internalIntegrateInner:o,applySubstitution:c,innermostVariable:v,internalVariables:u}}isInvertible(){return this.hasVariable()&&(this.internalInvert!=null||this.internalEvaluate==null)}isIntegrable(){return this.hasVariable()&&this.internalIntegrate!=null}isIntegralInvertible(){return this.isIntegrable()?this.getIntegralFormula().isInvertible():!1}hasVariable(){return this.internalVariables===1}evaluate(e){var t,n,r;return(r=(n=(t=this.internalEvaluate)==null?void 0:t.call(this,...this.inputs.map(i=>Y(i,e))))!=null?n:this.hasVariable()?e:null)!=null?r:Y(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof X&&e.inputs[n]instanceof X?t.equals(e.inputs[n]):!(t instanceof X)&&!(e.inputs[n]instanceof X)&&l.eq(s(t),s(e.inputs[n])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new a({inputs:[e]})}static variable(e){return new a({variable:e})}static step(e,t,n){const r=n(a.variable(0)),i=Wt(t);function o(u){return l.lt(u,s(i))?u:l.add(r.evaluate(l.sub(u,s(i))),s(i))}function c(u,d){return N(d)&&r.isInvertible()?(l.gt(u,s(i))&&(u=l.add(r.invert(l.sub(u,s(i))),s(i))),d.invert(u)):(console.error("Could not invert due to no input being a variable"),0)}return new a({inputs:[e],evaluate:o,invert:r.isInvertible()&&r.hasVariable()?c:void 0})}static if(e,t,n,r){const i=M(0),o=a.variable(i),c=n(o),u=r==null?void 0:r(o),d=Wt(t);function v(p){return s(d)?(i.value=p,c.evaluate()):u?(i.value=p,u.evaluate()):p}function _(p,C){return!N(C)||!c.isInvertible()||u!=null&&!u.isInvertible()?(console.error("Could not invert due to no input being a variable"),0):s(d)?C.invert(c.invert(p)):u?C.invert(u.invert(p)):C.invert(p)}return new a({inputs:[e],evaluate:v,invert:c.isInvertible()&&c.hasVariable()?_:void 0})}static conditional(e,t,n,r){return a.if(e,t,n,r)}static abs(e){return new a({inputs:[e],evaluate:l.abs})}static neg(e){return new a({inputs:[e],evaluate:l.neg,invert:Pi,applySubstitution:Vi,integrate:Ei})}static sign(e){return new a({inputs:[e],evaluate:l.sign})}static round(e){return new a({inputs:[e],evaluate:l.round,invert:Xe})}static floor(e){return new a({inputs:[e],evaluate:l.floor,invert:Xe})}static ceil(e){return new a({inputs:[e],evaluate:l.ceil,invert:Xe})}static trunc(e){return new a({inputs:[e],evaluate:l.trunc,invert:Xe})}static add(e,t){return new a({inputs:[e,t],evaluate:l.add,invert:Oi,integrate:Li,integrateInner:Di,applySubstitution:st})}static sub(e,t){return new a({inputs:[e,t],evaluate:l.sub,invert:qi,integrate:Ri,integrateInner:Bi,applySubstitution:st})}static mul(e,t){return new a({inputs:[e,t],evaluate:l.mul,invert:Ai,integrate:Ui,applySubstitution:zi})}static div(e,t){return new a({inputs:[e,t],evaluate:l.div,invert:ji,integrate:Gi,applySubstitution:Hi})}static recip(e){return new a({inputs:[e],evaluate:l.recip,invert:Wi,integrate:Ji})}static clamp(e,t,n){return new a({inputs:[e,t,n],evaluate:l.clamp,invert:Xe})}static pLog10(e){return new a({inputs:[e],evaluate:l.pLog10})}static absLog10(e){return new a({inputs:[e],evaluate:l.absLog10})}static log10(e){return new a({inputs:[e],evaluate:l.log10,invert:Zi,integrate:Xi})}static log(e,t){return new a({inputs:[e,t],evaluate:l.log,invert:Qi,integrate:na})}static log2(e){return new a({inputs:[e],evaluate:l.log2,invert:ra,integrate:oa})}static ln(e){return new a({inputs:[e],evaluate:l.ln,invert:sa,integrate:ca})}static pow(e,t){return new a({inputs:[e,t],evaluate:l.pow,invert:da,integrate:fa})}static pow10(e){return new a({inputs:[e],evaluate:l.pow10,invert:ma,integrate:ga})}static pow_base(e,t){return new a({inputs:[e,t],evaluate:l.pow_base,invert:ha,integrate:va})}static root(e,t){return new a({inputs:[e,t],evaluate:l.root,invert:pa,integrate:ba})}static factorial(e){return new a({inputs:[e],evaluate:l.factorial})}static gamma(e){return new a({inputs:[e],evaluate:l.gamma})}static lngamma(e){return new a({inputs:[e],evaluate:l.lngamma})}static exp(e){return new a({inputs:[e],evaluate:l.exp,invert:_a,integrate:ya})}static sqr(e){return a.pow(e,2)}static sqrt(e){return a.root(e,2)}static cube(e){return a.pow(e,3)}static cbrt(e){return a.root(e,3)}static tetrate(e,t=2,n=l.fromComponents_noNormalize(1,0,1)){return new a({inputs:[e,t,n],evaluate:wa,invert:Na})}static iteratedexp(e,t=2,n=l.fromComponents_noNormalize(1,0,1)){return new a({inputs:[e,t,n],evaluate:Ca,invert:Sa})}static iteratedlog(e,t=10,n=1){return new a({inputs:[e,t,n],evaluate:Ia})}static slog(e,t=10){return new a({inputs:[e,t],evaluate:$a,invert:ka})}static layeradd10(e,t){return new a({inputs:[e,t],evaluate:l.layeradd10})}static layeradd(e,t,n=10){return new a({inputs:[e,t,n],evaluate:Ma,invert:xa})}static lambertw(e){return new a({inputs:[e],evaluate:l.lambertw,invert:Fa})}static ssqrt(e){return new a({inputs:[e],evaluate:l.ssqrt,invert:Ta})}static pentate(e,t=2,n=l.fromComponents_noNormalize(1,0,1)){return new a({inputs:[e,t,n],evaluate:Pa})}static sin(e){return new a({inputs:[e],evaluate:l.sin,invert:Ra,integrate:Va})}static cos(e){return new a({inputs:[e],evaluate:l.cos,invert:Aa,integrate:La})}static tan(e){return new a({inputs:[e],evaluate:l.tan,invert:za,integrate:qa})}static asin(e){return new a({inputs:[e],evaluate:l.asin,invert:Ea,integrate:Ba})}static acos(e){return new a({inputs:[e],evaluate:l.acos,invert:Oa,integrate:Ua})}static atan(e){return new a({inputs:[e],evaluate:l.atan,invert:Da,integrate:ja})}static sinh(e){return new a({inputs:[e],evaluate:l.sinh,invert:Ya,integrate:Ha})}static cosh(e){return new a({inputs:[e],evaluate:l.cosh,invert:Qa,integrate:Ja})}static tanh(e){return new a({inputs:[e],evaluate:l.tanh,invert:to,integrate:Ka})}static asinh(e){return new a({inputs:[e],evaluate:l.asinh,invert:Ga,integrate:Xa})}static acosh(e){return new a({inputs:[e],evaluate:l.acosh,invert:Wa,integrate:eo})}static atanh(e){return new a({inputs:[e],evaluate:l.atanh,invert:Za,integrate:no})}step(e,t){return a.step(this,e,t)}if(e,t){return a.if(this,e,t)}conditional(e,t){return a.if(this,e,t)}abs(){return a.abs(this)}neg(){return a.neg(this)}sign(){return a.sign(this)}round(){return a.round(this)}floor(){return a.floor(this)}ceil(){return a.ceil(this)}trunc(){return a.trunc(this)}add(e){return a.add(this,e)}sub(e){return a.sub(this,e)}mul(e){return a.mul(this,e)}div(e){return a.div(this,e)}recip(){return a.recip(this)}max(e){return a.max(this,e)}min(e){return a.min(this,e)}maxabs(e){return a.maxabs(this,e)}minabs(e){return a.minabs(this,e)}clamp(e,t){return a.clamp(this,e,t)}clampMin(e){return a.clampMin(this,e)}clampMax(e){return a.clampMax(this,e)}pLog10(){return a.pLog10(this)}absLog10(){return a.absLog10(this)}log10(){return a.log10(this)}log(e){return a.log(this,e)}log2(){return a.log2(this)}ln(){return a.ln(this)}pow(e){return a.pow(this,e)}pow10(){return a.pow10(this)}pow_base(e){return a.pow_base(this,e)}root(e){return a.root(this,e)}factorial(){return a.factorial(this)}gamma(){return a.gamma(this)}lngamma(){return a.lngamma(this)}exp(){return a.exp(this)}sqr(){return a.pow(this,2)}sqrt(){return a.root(this,2)}cube(){return a.pow(this,3)}cbrt(){return a.root(this,3)}tetrate(e=2,t=l.fromComponents_noNormalize(1,0,1)){return a.tetrate(this,e,t)}iteratedexp(e=2,t=l.fromComponents_noNormalize(1,0,1)){return a.iteratedexp(this,e,t)}iteratedlog(e=10,t=1){return a.iteratedlog(this,e,t)}slog(e=10){return a.slog(this,e)}layeradd10(e){return a.layeradd10(this,e)}layeradd(e,t){return a.layeradd(this,e,t)}lambertw(){return a.lambertw(this)}ssqrt(){return a.ssqrt(this)}pentate(e=2,t=l.fromComponents_noNormalize(1,0,1)){return a.pentate(this,e,t)}sin(){return a.sin(this)}cos(){return a.cos(this)}tan(){return a.tan(this)}asin(){return a.asin(this)}acos(){return a.acos(this)}atan(){return a.atan(this)}sinh(){return a.sinh(this)}cosh(){return a.cosh(this)}tanh(){return a.tanh(this)}asinh(){return a.asinh(this)}acosh(){return a.acosh(this)}atanh(){return a.atanh(this)}};let Z=X;Z.negate=X.neg;Z.negated=X.neg;Z.sgn=X.sign;Z.plus=X.add;Z.subtract=X.sub;Z.minus=X.sub;Z.multiply=X.mul;Z.times=X.mul;Z.divide=X.div;Z.divideBy=X.div;Z.dividedBy=X.div;Z.reciprocal=X.recip;Z.reciprocate=X.recip;Z.max=Ze(l.max);Z.min=Ze(l.min);Z.minabs=Ze(l.minabs);Z.maxabs=Ze(l.maxabs);Z.clampMin=Ze(l.clampMin);Z.clampMax=Ze(l.clampMax);Z.logarithm=X.log;class a extends Z{invert(t){return this.internalInvert&&this.hasVariable()?this.internalInvert.call(this,t,...this.inputs):this.inputs.length===1&&this.hasVariable()?t:(console.error("Cannot invert non-invertible formula"),0)}evaluateIntegral(t){return this.isIntegrable()?this.getIntegralFormula().evaluate(t):(console.error("Cannot evaluate integral of formula without integral"),0)}invertIntegral(t){return!this.isIntegrable()||!this.getIntegralFormula().isInvertible()?(console.error("Cannot invert integral of formula without invertible integral"),0):this.getIntegralFormula().invert(t)}calculateConstantOfIntegration(){const t=this.getIntegralFormula().evaluate(1),n=l.add(this.evaluate(0),this.evaluate(1)).div(2);return l.sub(n,t)}getIntegralFormula(t){if(this.integralFormula!=null&&t==null)return this.integralFormula;if(t==null){if(this.applySubstitution==null){if(t=[],this.internalIntegrate==null)return console.error("Cannot integrate formula with non-integrable operation"),a.constant(0);let n=this.internalIntegrate.call(this,t,...this.inputs);t.forEach(r=>n=r(n)),this.integralFormula=n}else if(this.internalIntegrate)this.integralFormula=this.internalIntegrate.call(this,void 0,...this.inputs);else if(this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable())this.integralFormula=this;else return console.error("Cannot integrate formula without variable"),a.constant(0);return this.integralFormula}else return this.applySubstitution==null?(console.error("Cannot have two complex operations in an integrable formula"),a.constant(0)):(t.push(n=>this.applySubstitution.call(this,n,...this.inputs)),this.internalIntegrateInner?this.internalIntegrateInner.call(this,t,...this.inputs):this.internalIntegrate?this.internalIntegrate.call(this,t,...this.inputs):this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable()?this:(console.error("Cannot integrate formula without variable"),a.constant(0)))}}const je=Symbol("PersistentState"),ht=Symbol("DefaultValue"),vt=Symbol("StackTrace"),kt=Symbol("Deleted"),Oe=Symbol("NonPersistent"),Le=Symbol("SaveDataPath"),ao=Symbol("SkipPersistence");function oo(){var e,t;return(t=(e=new Error().stack)==null?void 0:e.split(` +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:0).sub(o)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Bi(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.sub(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.sub(r,t)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Ai(e,t,n){return N(t)?t.invert(l.div(e,Y(n))):N(n)?n.invert(l.div(e,Y(t))):(console.error("Could not invert due to no input being a variable"),0)}function Ui(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.times(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.times(r,t)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function zi(e,t,n){return N(t)?a.div(e,n):N(n)?a.div(e,t):(console.error("Could not apply substitution due to no input being a variable"),a.constant(0))}function ji(e,t,n){return N(t)?t.invert(l.mul(e,Y(n))):N(n)?n.invert(l.div(Y(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function Gi(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.div(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.div(t,r)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Hi(e,t,n){return N(t)?a.mul(e,n):N(n)?a.mul(e,t):(console.error("Could not apply substitution due to no input being a variable"),a.constant(0))}function Wi(e,t){return N(t)?t.invert(l.recip(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ji(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.ln(n)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Zi(e,t){return N(t)?t.invert(l.pow10(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ki(e){return l.ln(e).sub(1).times(e).div(_n)}function Yi(e,t){if(N(t)){const n=_n.times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function Xi(e,t){return N(t)?t.isIntegrable()?new a({inputs:[t.getIntegralFormula(e)],evaluate:Ki,invert:Yi}):(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 Qi(e,t,n){return N(t)?t.invert(l.pow(Y(n),e)):N(n)?n.invert(l.root(Y(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function ea(e,t){return l.ln(e).sub(1).times(e).div(l.ln(t))}function ta(e,t,n){if(N(t)){const r=l.ln(Y(n)).times(e);return t.invert(r.div(r.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function na(e,t,n){return N(t)?t.isIntegrable()?new a({inputs:[t.getIntegralFormula(e),n],evaluate:ea,invert:ta}):(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 ra(e,t){return N(t)?t.invert(l.pow(2,e)):(console.error("Could not invert due to no input being a variable"),0)}function ia(e){return l.ln(e).sub(1).times(e).div(l.ln(2))}function aa(e,t){if(N(t)){const n=l.ln(2).times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function oa(e,t){return N(t)?t.isIntegrable()?new a({inputs:[t.getIntegralFormula(e)],evaluate:ia,invert:aa}):(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 sa(e,t){return N(t)?t.invert(l.exp(e)):(console.error("Could not invert due to no input being a variable"),0)}function la(e){return l.ln(e).sub(1).times(e)}function ua(e,t){return N(t)?t.invert(l.div(e,l.div(e,Math.E).lambertw())):(console.error("Could not invert due to no input being a variable"),0)}function ca(e,t){return N(t)?t.isIntegrable()?new a({inputs:[t.getIntegralFormula(e)],evaluate:la,invert:ua}):(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 da(e,t,n){return N(t)?t.invert(l.root(e,Y(n))):N(n)?n.invert(l.ln(e).div(l.ln(Y(t)))):(console.error("Could not invert due to no input being a variable"),0)}function fa(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),i=a.add(n,1);return a.pow(r,i).div(i)}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.pow(t,r).div(a.ln(t))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function ma(e,t){return N(t)?t.invert(l.root(e,10)):(console.error("Could not invert due to no input being a variable"),0)}function ga(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.pow10(n).div(a.ln(10))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function ha(e,t,n){return N(t)?t.invert(l.ln(e).div(l.ln(Y(n)))):N(n)?n.invert(l.root(Y(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function va(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.pow(n,r).div(a.ln(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),i=a.add(t,1);return a.pow(r,i).div(i)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function pa(e,t,n){return N(t)?t.invert(l.root(e,l.recip(Y(n)))):N(n)?n.invert(l.ln(Y(t)).div(l.ln(e))):(console.error("Could not invert due to no input being a variable"),0)}function ba(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.pow(r,a.recip(n).add(1)).times(n).div(a.add(n,1))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function _a(e,t){return N(t)?t.invert(l.ln(e)):(console.error("Could not invert due to no input being a variable"),0)}function ya(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.exp(n)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function wa(e,t=2,n=l.fromComponents_noNormalize(1,0,1)){const r=l.minabs(t,1e308).toNumber();return l.tetrate(e,r,n)}function Na(e,t,n,r){return N(t)?t.invert(l.ssqrt(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ca(e,t=2,n=l.fromComponents_noNormalize(1,0,1)){const r=l.minabs(t,1e308).toNumber();return l.iteratedexp(e,r,new l(n))}function Sa(e,t,n,r){return N(t)?t.invert(l.iteratedlog(e,Math.E,l.minabs(1e308,Y(n)).toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function Ia(e,t=10,n=2){const r=l.minabs(n,1e308).toNumber();return l.iteratedlog(e,t,r)}function $a(e,t=10){const n=l.minabs(t,1e308).toNumber();return l.slog(e,n)}function ka(e,t,n){return N(t)?t.invert(l.tetrate(e,l.minabs(1e308,Y(n)).toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function Ma(e,t,n){const r=l.minabs(t,1e308).toNumber();return l.layeradd(e,r,n)}function xa(e,t,n,r){return N(t)?t.invert(l.layeradd(e,l.minabs(1e308,Y(n)).negate().toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function Fa(e,t){return N(t)?t.invert(l.pow(Math.E,e).times(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ta(e,t){return N(t)?t.invert(l.tetrate(e,2)):(console.error("Could not invert due to no input being a variable"),0)}function Pa(e,t,n){const r=l.minabs(t,1e308).toNumber();return l.pentate(e,r,n)}function Ea(e,t){return N(t)?t.invert(l.asin(e)):(console.error("Could not invert due to no input being a variable"),0)}function Va(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.cos(n).neg()}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Oa(e,t){return N(t)?t.invert(l.acos(e)):(console.error("Could not invert due to no input being a variable"),0)}function La(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.sin(n)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Da(e,t){return N(t)?t.invert(l.atan(e)):(console.error("Could not invert due to no input being a variable"),0)}function qa(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.cos(n).ln().neg()}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Ra(e,t){return N(t)?t.invert(l.sin(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ba(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.asin(n).times(n).add(a.sqrt(a.sub(1,a.pow(n,2))))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Aa(e,t){return N(t)?t.invert(l.cos(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ua(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.acos(n).times(n).sub(a.sqrt(a.sub(1,a.pow(n,2))))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function za(e,t){return N(t)?t.invert(l.tan(e)):(console.error("Could not invert due to no input being a variable"),0)}function ja(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.atan(n).times(n).sub(a.ln(a.pow(n,2).add(1)).div(2))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Ga(e,t){return N(t)?t.invert(l.asinh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ha(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.cosh(n)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Wa(e,t){return N(t)?t.invert(l.acosh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ja(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.sinh(n)}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Za(e,t){return N(t)?t.invert(l.atanh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ka(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.cosh(n).ln()}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Ya(e,t){return N(t)?t.invert(l.sinh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Xa(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.asinh(n).times(n).sub(a.pow(n,2).add(1).sqrt())}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Qa(e,t){return N(t)?t.invert(l.cosh(e)):(console.error("Could not invert due to no input being a variable"),0)}function eo(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.acosh(n).times(n).sub(a.add(n,1).sqrt().times(a.sub(n,1).sqrt()))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function to(e,t){return N(t)?t.invert(l.tanh(e)):(console.error("Could not invert due to no input being a variable"),0)}function no(e,t){if(N(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),a.constant(0);const n=t.getIntegralFormula(e);return a.atanh(n).times(n).add(a.sub(1,a.pow(n,2)).ln().div(2))}return console.error("Could not integrate due to no input being a variable"),a.constant(0)}function Ze(e){return(t,n)=>new a({inputs:[t,n],evaluate:e,invert:st})}function N(e){return e instanceof Z&&e.hasVariable()}function Y(e,t){return e instanceof Z?e.evaluate(t):s(e)}function ro(){return a.pow(this,2).div(2)}function io(){return this}const X=class{constructor(e){this.negate=this.neg,this.negated=this.neg,this.sgn=this.sign,this.plus=this.add,this.subtract=this.sub,this.minus=this.sub,this.multiply=this.mul,this.times=this.mul,this.divide=this.div,this.divideBy=this.div,this.dividedBy=this.div,this.reciprocal=this.recip,this.reciprocate=this.recip,this.logarithm=this.log;let t;"inputs"in e&&(e.inputs=e.inputs.map(n=>typeof n=="object"&&Le in n?n[Le]:n)),"variable"in e?(typeof e.variable=="object"&&Le in e.variable&&(e.variable=e.variable[Le]),t=this.setupVariable(e)):"evaluate"in e?t=this.setupFormula(e):t=this.setupConstant(e),this.inputs=t.inputs,this.internalVariables=t.internalVariables,this.innermostVariable=t.innermostVariable,this.internalEvaluate=t.internalEvaluate,this.internalInvert=t.internalInvert,this.internalIntegrate=t.internalIntegrate,this.internalIntegrateInner=t.internalIntegrateInner,this.applySubstitution=t.applySubstitution}setupVariable({variable:e}){return{inputs:[e],internalVariables:1,innermostVariable:e,internalIntegrate:ro,internalIntegrateInner:io,applySubstitution:st}}setupConstant({inputs:e}){return e.length!==1&&console.error("Evaluate function is required if inputs is not length 1"),{inputs:e,internalVariables:0}}setupFormula(e){var C,k;const{inputs:t,evaluate:n,invert:r,integrate:i,integrateInner:o,applySubstitution:c}=e,u=t.reduce((b,S)=>b+(S instanceof X?S.internalVariables:0),0),d=t.find(b=>b instanceof X&&b.hasVariable()),v=u===1?d==null?void 0:d.innermostVariable:void 0,_=(C=d==null?void 0:d.isInvertible())!=null?C:!1,p=(k=d==null?void 0:d.isIntegrable())!=null?k:!1;return{inputs:t,internalEvaluate:n,internalInvert:_?r:void 0,internalIntegrate:p?i:void 0,internalIntegrateInner:o,applySubstitution:c,innermostVariable:v,internalVariables:u}}isInvertible(){return this.hasVariable()&&(this.internalInvert!=null||this.internalEvaluate==null)}isIntegrable(){return this.hasVariable()&&this.internalIntegrate!=null}isIntegralInvertible(){return this.isIntegrable()?this.getIntegralFormula().isInvertible():!1}hasVariable(){return this.internalVariables===1}evaluate(e){var t,n,r;return(r=(n=(t=this.internalEvaluate)==null?void 0:t.call(this,...this.inputs.map(i=>Y(i,e))))!=null?n:this.hasVariable()?e:null)!=null?r:Y(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof X&&e.inputs[n]instanceof X?t.equals(e.inputs[n]):!(t instanceof X)&&!(e.inputs[n]instanceof X)&&l.eq(s(t),s(e.inputs[n])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new a({inputs:[e]})}static variable(e){return new a({variable:e})}static step(e,t,n){const r=n(a.variable(0)),i=Wt(t);function o(u){return l.lt(u,s(i))?u:l.add(r.evaluate(l.sub(u,s(i))),s(i))}function c(u,d){return N(d)&&r.isInvertible()?(l.gt(u,s(i))&&(u=l.add(r.invert(l.sub(u,s(i))),s(i))),d.invert(u)):(console.error("Could not invert due to no input being a variable"),0)}return new a({inputs:[e],evaluate:o,invert:r.isInvertible()&&r.hasVariable()?c:void 0})}static if(e,t,n,r){const i=M(0),o=a.variable(i),c=n(o),u=r==null?void 0:r(o),d=Wt(t);function v(p){return s(d)?(i.value=p,c.evaluate()):u?(i.value=p,u.evaluate()):p}function _(p,C){return!N(C)||!c.isInvertible()||u!=null&&!u.isInvertible()?(console.error("Could not invert due to no input being a variable"),0):s(d)?C.invert(c.invert(p)):u?C.invert(u.invert(p)):C.invert(p)}return new a({inputs:[e],evaluate:v,invert:c.isInvertible()&&c.hasVariable()?_:void 0})}static conditional(e,t,n,r){return a.if(e,t,n,r)}static abs(e){return new a({inputs:[e],evaluate:l.abs})}static neg(e){return new a({inputs:[e],evaluate:l.neg,invert:Pi,applySubstitution:Vi,integrate:Ei})}static sign(e){return new a({inputs:[e],evaluate:l.sign})}static round(e){return new a({inputs:[e],evaluate:l.round,invert:Xe})}static floor(e){return new a({inputs:[e],evaluate:l.floor,invert:Xe})}static ceil(e){return new a({inputs:[e],evaluate:l.ceil,invert:Xe})}static trunc(e){return new a({inputs:[e],evaluate:l.trunc,invert:Xe})}static add(e,t){return new a({inputs:[e,t],evaluate:l.add,invert:Oi,integrate:Li,integrateInner:Di,applySubstitution:st})}static sub(e,t){return new a({inputs:[e,t],evaluate:l.sub,invert:qi,integrate:Ri,integrateInner:Bi,applySubstitution:st})}static mul(e,t){return new a({inputs:[e,t],evaluate:l.mul,invert:Ai,integrate:Ui,applySubstitution:zi})}static div(e,t){return new a({inputs:[e,t],evaluate:l.div,invert:ji,integrate:Gi,applySubstitution:Hi})}static recip(e){return new a({inputs:[e],evaluate:l.recip,invert:Wi,integrate:Ji})}static clamp(e,t,n){return new a({inputs:[e,t,n],evaluate:l.clamp,invert:Xe})}static pLog10(e){return new a({inputs:[e],evaluate:l.pLog10})}static absLog10(e){return new a({inputs:[e],evaluate:l.absLog10})}static log10(e){return new a({inputs:[e],evaluate:l.log10,invert:Zi,integrate:Xi})}static log(e,t){return new a({inputs:[e,t],evaluate:l.log,invert:Qi,integrate:na})}static log2(e){return new a({inputs:[e],evaluate:l.log2,invert:ra,integrate:oa})}static ln(e){return new a({inputs:[e],evaluate:l.ln,invert:sa,integrate:ca})}static pow(e,t){return new a({inputs:[e,t],evaluate:l.pow,invert:da,integrate:fa})}static pow10(e){return new a({inputs:[e],evaluate:l.pow10,invert:ma,integrate:ga})}static pow_base(e,t){return new a({inputs:[e,t],evaluate:l.pow_base,invert:ha,integrate:va})}static root(e,t){return new a({inputs:[e,t],evaluate:l.root,invert:pa,integrate:ba})}static factorial(e){return new a({inputs:[e],evaluate:l.factorial})}static gamma(e){return new a({inputs:[e],evaluate:l.gamma})}static lngamma(e){return new a({inputs:[e],evaluate:l.lngamma})}static exp(e){return new a({inputs:[e],evaluate:l.exp,invert:_a,integrate:ya})}static sqr(e){return a.pow(e,2)}static sqrt(e){return a.root(e,2)}static cube(e){return a.pow(e,3)}static cbrt(e){return a.root(e,3)}static tetrate(e,t=2,n=l.fromComponents_noNormalize(1,0,1)){return new a({inputs:[e,t,n],evaluate:wa,invert:Na})}static iteratedexp(e,t=2,n=l.fromComponents_noNormalize(1,0,1)){return new a({inputs:[e,t,n],evaluate:Ca,invert:Sa})}static iteratedlog(e,t=10,n=1){return new a({inputs:[e,t,n],evaluate:Ia})}static slog(e,t=10){return new a({inputs:[e,t],evaluate:$a,invert:ka})}static layeradd10(e,t){return new a({inputs:[e,t],evaluate:l.layeradd10})}static layeradd(e,t,n=10){return new a({inputs:[e,t,n],evaluate:Ma,invert:xa})}static lambertw(e){return new a({inputs:[e],evaluate:l.lambertw,invert:Fa})}static ssqrt(e){return new a({inputs:[e],evaluate:l.ssqrt,invert:Ta})}static pentate(e,t=2,n=l.fromComponents_noNormalize(1,0,1)){return new a({inputs:[e,t,n],evaluate:Pa})}static sin(e){return new a({inputs:[e],evaluate:l.sin,invert:Ra,integrate:Va})}static cos(e){return new a({inputs:[e],evaluate:l.cos,invert:Aa,integrate:La})}static tan(e){return new a({inputs:[e],evaluate:l.tan,invert:za,integrate:qa})}static asin(e){return new a({inputs:[e],evaluate:l.asin,invert:Ea,integrate:Ba})}static acos(e){return new a({inputs:[e],evaluate:l.acos,invert:Oa,integrate:Ua})}static atan(e){return new a({inputs:[e],evaluate:l.atan,invert:Da,integrate:ja})}static sinh(e){return new a({inputs:[e],evaluate:l.sinh,invert:Ya,integrate:Ha})}static cosh(e){return new a({inputs:[e],evaluate:l.cosh,invert:Qa,integrate:Ja})}static tanh(e){return new a({inputs:[e],evaluate:l.tanh,invert:to,integrate:Ka})}static asinh(e){return new a({inputs:[e],evaluate:l.asinh,invert:Ga,integrate:Xa})}static acosh(e){return new a({inputs:[e],evaluate:l.acosh,invert:Wa,integrate:eo})}static atanh(e){return new a({inputs:[e],evaluate:l.atanh,invert:Za,integrate:no})}step(e,t){return a.step(this,e,t)}if(e,t){return a.if(this,e,t)}conditional(e,t){return a.if(this,e,t)}abs(){return a.abs(this)}neg(){return a.neg(this)}sign(){return a.sign(this)}round(){return a.round(this)}floor(){return a.floor(this)}ceil(){return a.ceil(this)}trunc(){return a.trunc(this)}add(e){return a.add(this,e)}sub(e){return a.sub(this,e)}mul(e){return a.mul(this,e)}div(e){return a.div(this,e)}recip(){return a.recip(this)}max(e){return a.max(this,e)}min(e){return a.min(this,e)}maxabs(e){return a.maxabs(this,e)}minabs(e){return a.minabs(this,e)}clamp(e,t){return a.clamp(this,e,t)}clampMin(e){return a.clampMin(this,e)}clampMax(e){return a.clampMax(this,e)}pLog10(){return a.pLog10(this)}absLog10(){return a.absLog10(this)}log10(){return a.log10(this)}log(e){return a.log(this,e)}log2(){return a.log2(this)}ln(){return a.ln(this)}pow(e){return a.pow(this,e)}pow10(){return a.pow10(this)}pow_base(e){return a.pow_base(this,e)}root(e){return a.root(this,e)}factorial(){return a.factorial(this)}gamma(){return a.gamma(this)}lngamma(){return a.lngamma(this)}exp(){return a.exp(this)}sqr(){return a.pow(this,2)}sqrt(){return a.root(this,2)}cube(){return a.pow(this,3)}cbrt(){return a.root(this,3)}tetrate(e=2,t=l.fromComponents_noNormalize(1,0,1)){return a.tetrate(this,e,t)}iteratedexp(e=2,t=l.fromComponents_noNormalize(1,0,1)){return a.iteratedexp(this,e,t)}iteratedlog(e=10,t=1){return a.iteratedlog(this,e,t)}slog(e=10){return a.slog(this,e)}layeradd10(e){return a.layeradd10(this,e)}layeradd(e,t){return a.layeradd(this,e,t)}lambertw(){return a.lambertw(this)}ssqrt(){return a.ssqrt(this)}pentate(e=2,t=l.fromComponents_noNormalize(1,0,1)){return a.pentate(this,e,t)}sin(){return a.sin(this)}cos(){return a.cos(this)}tan(){return a.tan(this)}asin(){return a.asin(this)}acos(){return a.acos(this)}atan(){return a.atan(this)}sinh(){return a.sinh(this)}cosh(){return a.cosh(this)}tanh(){return a.tanh(this)}asinh(){return a.asinh(this)}acosh(){return a.acosh(this)}atanh(){return a.atanh(this)}};let Z=X;Z.negate=X.neg;Z.negated=X.neg;Z.sgn=X.sign;Z.plus=X.add;Z.subtract=X.sub;Z.minus=X.sub;Z.multiply=X.mul;Z.times=X.mul;Z.divide=X.div;Z.divideBy=X.div;Z.dividedBy=X.div;Z.reciprocal=X.recip;Z.reciprocate=X.recip;Z.max=Ze(l.max);Z.min=Ze(l.min);Z.minabs=Ze(l.minabs);Z.maxabs=Ze(l.maxabs);Z.clampMin=Ze(l.clampMin);Z.clampMax=Ze(l.clampMax);Z.logarithm=X.log;class a extends Z{invert(t){return this.internalInvert&&this.hasVariable()?this.internalInvert.call(this,t,...this.inputs):this.inputs.length===1&&this.hasVariable()?t:(console.error("Cannot invert non-invertible formula"),0)}evaluateIntegral(t){return this.isIntegrable()?this.getIntegralFormula().evaluate(t):(console.error("Cannot evaluate integral of formula without integral"),0)}invertIntegral(t){return!this.isIntegrable()||!this.getIntegralFormula().isInvertible()?(console.error("Cannot invert integral of formula without invertible integral"),0):this.getIntegralFormula().invert(t)}calculateConstantOfIntegration(){const t=this.getIntegralFormula().evaluate(1),n=l.add(this.evaluate(0),this.evaluate(1)).div(2);return l.sub(n,t)}getIntegralFormula(t){if(this.integralFormula!=null&&t==null)return this.integralFormula;if(t==null){if(this.applySubstitution==null){if(t=[],this.internalIntegrate==null)return console.error("Cannot integrate formula with non-integrable operation"),a.constant(0);let n=this.internalIntegrate.call(this,t,...this.inputs);t.forEach(r=>n=r(n)),this.integralFormula=n}else if(this.internalIntegrate)this.integralFormula=this.internalIntegrate.call(this,void 0,...this.inputs);else if(this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable())this.integralFormula=this;else return console.error("Cannot integrate formula without variable"),a.constant(0);return this.integralFormula}else return this.applySubstitution==null?(console.error("Cannot have two complex operations in an integrable formula"),a.constant(0)):(t.push(n=>this.applySubstitution.call(this,n,...this.inputs)),this.internalIntegrateInner?this.internalIntegrateInner.call(this,t,...this.inputs):this.internalIntegrate?this.internalIntegrate.call(this,t,...this.inputs):this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable()?this:(console.error("Cannot integrate formula without variable"),a.constant(0)))}}const Ge=Symbol("PersistentState"),ht=Symbol("DefaultValue"),vt=Symbol("StackTrace"),kt=Symbol("Deleted"),Le=Symbol("NonPersistent"),De=Symbol("SaveDataPath"),ao=Symbol("SkipPersistence");function oo(){var e,t;return(t=(e=new Error().stack)==null?void 0:e.split(` `).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[Le],K.NaNPersistent=e),console.error(`Attempted to save NaN value to ${(n=e[Le])==null?void 0:n.join(".")}`)),e[je].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[je].value=o}});r[ht]=e;const i={get value(){return n.value},set value(o){t?Jt(i,o):i[je].value=o},__v_isRef:!0,[je]:n,[ht]:e,[vt]:oo(),[kt]:!1,[Oe]:r,[Le]:void 0};return ge.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",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(`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]):ze[ge[ge.length-1]].add(i),i}function so(e){return e!=null&&typeof e=="object"&&je 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,` +`+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}ze[e.id].delete(d);const v=[e.id,...o,u];d[Le]!=null&&JSON.stringify(v)!==JSON.stringify(d[Le])&&console.error(`Persistent ref is being saved to \`${v.join(".")}\` when it's already present at \`${d[Le].join(".")}\`.`,"This can cause unexpected behavior when loading saves between updates."),d[Le]=v;const _=o.reduce((C,k)=>(k in C||(C[k]={}),C[k]),t),p=_[u];_[u]=d[je],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]),ze[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. +`+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])}),ze[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"&&Oe in d?d[Oe]: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(),Ae=M(),lt=M("");function Ue(e,...t){var n;!He.value||(n=Ae.value)==null||n.emit(e,...t)}function lo(){return O.layers.main[$e]}Q.on("loadSettings",e=>{xe(e,"server",window.location.origin),xe(e,"nickname",co()),oe(()=>e.server,t=>{Ae.value&&Ae.value.close(),Ae.value=qn(t),uo(Ae.value),He.value=!1,lt.value="",Ae.value.connect()},{immediate:!0}),oe(()=>e.nickname,t=>{ae.value&&Ue("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(){ho();try{let e=localStorage.getItem(z.active);if(e==null){await De(Ge());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 De(Ge());return}t.id=z.active,await De(t)}catch(e){console.error(`Failed to load save. Falling back to new save. -`,e),await De(Ge())}}function Ge(){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 De(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 De(Ge())};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=Re({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=Re([]),po=Re([]),bo=Re([]);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}`),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",qe({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",onClick:t[1]||(t[1]=d=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(h(),q(se(e.minimizedComponent),{key:0})):(h(),w("div",wo,P(e.unref(e.name)),1))])):(h(),w("div",{key:2,class:te(["layer-tab",{showGoBack:e.showGoBack}])},[y(u,{onUpdateNodes:e.updateNodes},{default:T(()=>[(h(),q(se(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(h(),w("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=d=>e.$emit("setMinimized",!0))}," \u25BC ")):F("",!0)],16))}var Co=H(yo,[["render",No],["__scopeId","data-v-a9f5b1da"]]);const Sn=e=>(fe("data-v-4b4bda40"),e=e(),me(),e),So=Sn(()=>f("h2",null,"Changelog",-1)),Io=Sn(()=>f("details",{open:""},[f("summary",null,[V("v0.0 Initial Commit - "),f("time",null,"2021-09-04")]),V(" This is the first release :D "),f("ul",null,[f("li",{class:"feature"},"Did everything"),f("li",{class:"fix"},"Had some fun"),f("li",{class:"breaking"},"Removed everything"),f("li",{class:"balancing"},"Created some bugs to fix later")])],-1)),$o=B({__name:"Changelog",setup(e,{expose:t}){const n=M(!1);return t({open(){n.value=!0}}),(r,i)=>(h(),q(Pe,{modelValue:n.value,"onUpdate:modelValue":i[0]||(i[0]=o=>n.value=o)},{header:T(()=>[So]),body:T(()=>[Io]),_:1},8,["modelValue"]))}});var ko=H($o,[["__scopeId","data-v-4b4bda40"]]);const Mo=["onSubmit"],xo={class:"field"},Fo={key:0,class:"field-title"},To=["placeholder"],Po=B({__name:"Text",props:{title:null,modelValue:null,textArea:{type:Boolean},placeholder:null,maxHeight:null,submitOnBlur:{type:Boolean}},emits:["update:modelValue","submit","cancel"],setup(e,{emit:t}){const n=e,r=Nt(Te(n,"title"),"span"),i=Je(null);pt(()=>{var d;(d=i.value)==null||d.focus()});const o=D({get(){var d;return(d=s(n.modelValue))!=null?d:""},set(d){t("update:modelValue",d)}});function c(){t("submit")}function u(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(d,v)=>(h(),w("form",{onSubmit:tt(c,["prevent"])},[f("div",xo,[s(r)?(h(),w("span",Fo,[(h(),q(se(s(r))))])):F("",!0),e.textArea?(h(),q(s(Gn),{key:1,modelValue:s(o),"onUpdate:modelValue":v[0]||(v[0]=_=>pe(o)?o.value=_:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:u,ref_key:"field",ref:i},null,8,["modelValue","placeholder","maxHeight"])):bt((h(),w("input",{key:2,type:"text","onUpdate:modelValue":v[1]||(v[1]=_=>pe(o)?o.value=_:null),placeholder:e.placeholder,class:te({fullWidth:!e.title}),onBlur:u,ref_key:"field",ref:i},null,42,To)),[[On,s(o)]])])],40,Mo))}});var ke=H(Po,[["__scopeId","data-v-90bd4994"]]);const Eo={class:"field"},Vo=B({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=D(()=>{var o;return ye((o=s(n.title))!=null?o:"","span")}),i=D({get(){return!!n.modelValue},set(o){t("update:modelValue",o)}});return(o,c)=>(h(),w("label",Eo,[bt(f("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":c[0]||(c[0]=u=>pe(i)?i.value=u:null)},null,512),[[Ln,s(i)]]),(h(),q(se(s(r))))]))}});var We=H(Vo,[["__scopeId","data-v-11046116"]]);Q.on("setupVue",e=>e.use(zn));function Oo(e="white",t="8px"){return{transform:"scale(1.05, 1.05)",borderColor:"rgba(0, 0, 0, 0.125)",boxShadow:`-4px -4px 4px rgba(0, 0, 0, 0.25) inset, 0 0 ${t} ${e}`,zIndex:1}}const Lo=B({props:{visibility:{type:J(Number,Boolean),required:!0},display:{type:J(Object,String,Function),required:!0},style:J(String,Object,Array),classes:J(Object),glowColor:J(String),active:Boolean,floating:Boolean},emits:["selectTab"],setup(e,{emit:t}){const{display:n,glowColor:r,floating:i}=de(e),o=Cn(n),c=D(()=>{const d=be(r);return d==null||d===""?{}:s(i)?Oo(d):{boxShadow:`0px 9px 5px -6px ${d}`}});function u(){t("selectTab")}return{selectTab:u,component:o,glowColorStyle:c,unref:s,Visibility:rt,isVisible:gt,isHidden:cn}}});function Do(e,t,n,r,i,o){var c;return e.isVisible(e.visibility)?(h(),w("button",{key:0,onClick:t[0]||(t[0]=(...u)=>e.selectTab&&e.selectTab(...u)),class:te(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:ve([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(c=e.unref(e.style))!=null?c:{}])},[(h(),q(se(e.component)))],6)):F("",!0)}var In=H(Lo,[["render",Do],["__scopeId","data-v-21427abb"]]);const qo=B({__name:"Sticky",setup(e){const t=M("0"),n=new ResizeObserver(i),r=Je(null);function i(){let o=r.value;if(o==null)return;let c=0;for(;o.previousSibling;){const u=o.previousSibling;u.dataset&&"vSticky"in u.dataset&&(c+=u.offsetHeight),o=u}t.value=c+"px"}return Fe(i),document.fonts.ready.then(i),pt(()=>{var c;const o=(c=r.value)==null?void 0:c.parentElement;o&&n.observe(o)}),(o,c)=>(h(),w("div",{class:"sticky",style:ve({top:t.value}),ref_key:"element",ref:r,"data-v-sticky":""},[Me(o.$slots,"default",{},void 0,!0)],4))}});var Ro=H(qo,[["__scopeId","data-v-cccac690"]]);const Bo=B({props:{visibility:{type:J(Number,Boolean),required:!0},activeTab:{type:J(Object),required:!0},selected:{type:Object,required:!0},tabs:{type:J(Object),required:!0},style:J(String,Object,Array),classes:J(Object),buttonContainerStyle:J(String,Object,Array),buttonContainerClasses:J(Object)},components:{Sticky:Ro,TabButton:In},setup(e){const{activeTab:t}=de(e),n=D(()=>yt[z.theme].floatingTabs),r=Je("");Ft(()=>{const u=be(t);if(u==null){r.value="";return}if(et(u)){r.value=ye(u);return}r.value=ye(s(u.display))});const i=D(()=>{const u=be(t);return et(u)||!u?void 0:s(u.classes)}),o=D(()=>{const u=be(t);return et(u)||!u?void 0:s(u.style)});function c(u){const{display:d,style:v,classes:_,glowColor:p,visibility:C}=u;return{display:d,style:s(v),classes:_,glowColor:p,visibility:C}}return{floating:n,tabClasses:i,tabStyle:o,Visibility:rt,component:r,gatherButtonProps:c,unref:s,isVisible:gt,isHidden:cn}}});function Ao(e,t,n,r,i,o){var d,v;const c=ct("TabButton"),u=ct("Sticky");return e.isVisible(e.visibility)?(h(),w("div",{key:0,class:te(["tab-family-container",{...e.unref(e.classes),...e.tabClasses}]),style:ve([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(d=e.unref(e.style))!=null?d:[],(v=e.tabStyle)!=null?v:[]])},[y(u,{class:te(["tab-buttons-container",e.unref(e.buttonContainerClasses)]),style:ve(e.unref(e.buttonContainerStyle))},{default:T(()=>[f("div",{class:te(["tab-buttons",{floating:e.floating}])},[(h(!0),w(U,null,he(e.unref(e.tabs),(_,p)=>(h(),q(c,qe({onSelectTab:C=>e.selected.value=p,floating:e.floating,key:p,active:e.unref(_.tab)===e.unref(e.activeTab)},e.gatherButtonProps(_)),null,16,["onSelectTab","floating","active"]))),128))],2)]),_:1},8,["class","style"]),e.unref(e.activeTab)?(h(),q(se(e.unref(e.component)),{key:0})):F("",!0)],6)):F("",!0)}var Uo=H(Bo,[["render",Ao],["__scopeId","data-v-58dbf83a"]]);const zo=Symbol("TabButton"),jo=Symbol("TabFamily");function Go(e,t){Object.keys(e).length===0&&console.error("Cannot create tab family with 0 tabs");const n=Ot(Object.keys(e)[0],!1);return yn(r=>{var c;const i=(c=t==null?void 0:t.call(r,r))!=null?c:{};i.id=vi("tabFamily-"),i.type=jo,i[mt]=Uo,i.tabs=Object.keys(e).reduce((u,d)=>{const v=e[d]();return v.type=zo,v[mt]=In,ee(v,"visibility"),xe(v,"visibility",rt.Visible),ee(v,"tab"),ee(v,"display"),ee(v,"classes"),ee(v,"style"),ee(v,"glowColor"),u[d]=v,u},{}),i.selected=n,i.activeTab=D(()=>{const u=s(o.tabs);if(n.value in u&>(u[n.value].visibility))return s(u[n.value].tab);const d=Object.values(u).find(v=>gt(v.visibility));return d?s(d.tab):null}),ee(i,"visibility"),xe(i,"visibility",rt.Visible),ee(i,"classes"),ee(i,"style"),ee(i,"buttonContainerClasses"),ee(i,"buttonContainerStyle"),i[Et]=function(){const{visibility:u,activeTab:d,selected:v,tabs:_,style:p,classes:C,buttonContainerClasses:k,buttonContainerStyle:b}=this;return{visibility:u,activeTab:d,selected:v,tabs:_,style:s(p),classes:C,buttonContainerClasses:k,buttonContainerStyle:b}};const o=i;return o})}var Ho=B({props:{element:Object,display:{type:J(Object,String,Function),required:!0},style:J(Object,String,Array),classes:J(Object),direction:J(String),xoffset:J(String),yoffset:J(String),pinned:Object},setup(e){const{element:t,display:n,pinned:r}=de(e),i=M(!1),o=D(()=>(be(r)||i.value)&&c.value),c=Nt(n),u=Je(ye(ne(()=>{const _=be(t);return _==null?"":_o(_)})));function d(_){const p=r;_.shiftKey&&p&&(p.value=!p.value,_.stopPropagation(),_.preventDefault())}const v=D(()=>be(r)&&yt[z.theme].showPin);return{Direction:G,isHovered:i,isShown:o,comp:c,elementComp:u,unref:s,togglePinned:d,showPin:v}}});const Wo={key:0,class:"material-icons pinned"};function Jo(e,t,n,r,i,o){return h(),w("div",{class:te(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=c=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=c=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...c)=>e.togglePinned&&e.togglePinned(...c))},[Me(e.$slots,"default",{},void 0,!0),e.elementComp?(h(),q(se(e.elementComp),{key:0})):F("",!0),y(xt,{name:"fade"},{default:T(()=>{var c;return[e.isShown?(h(),w("div",{key:0,class:te(["tooltip",{top:e.unref(e.direction)===e.Direction.Up,left:e.unref(e.direction)===e.Direction.Left,right:e.unref(e.direction)===e.Direction.Right,bottom:e.unref(e.direction)===e.Direction.Down,...e.unref(e.classes)}]),style:ve([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(c=e.unref(e.style))!=null?c:{}])},[e.showPin?(h(),w("span",Wo,"push_pin")):F("",!0),e.comp?(h(),q(se(e.comp),{key:1})):F("",!0)],6)):F("",!0)]}),_:1})],34)}var W=H(Ho,[["render",Jo],["__scopeId","data-v-6102fa3a"]]);const Dt=e=>(fe("data-v-a7843e62"),e=e(),me(),e),Zo={class:"room"},Ko={key:0,class:"actions"},Yo=Dt(()=>f("span",{class:"material-icons"},"check",-1)),Xo=Dt(()=>f("span",{class:"material-icons"},"close",-1)),Qo={key:1,class:"details"},es={key:0,class:"material-icons"},ts={key:1,class:"material-icons"},ns={class:"room-host"},rs={key:2,class:"details",style:{display:"flex"}},is=Dt(()=>f("span",null,"Password:",-1)),as=B({__name:"Room",props:{isPrivate:{type:Boolean},room:null},emits:["connect"],setup(e,{emit:t}){const n=e,{room:r}=de(n),i=M(!1),o=M("");oe(i,d=>{d&&(o.value="")});function c(){r.value.hasPassword?i.value=!0:t("connect")}function u(){t("connect",o.value),i.value=!1}return(d,v)=>(h(),w("div",Zo,[i.value?(h(),w("div",Ko,[f("button",{onPointerdown:u,class:"button"},[y(W,{display:"Join",direction:s(G).Left,class:"info"},{default:T(()=>[Yo]),_:1},8,["direction"])],32),f("button",{onPointerdown:v[0]||(v[0]=_=>i.value=!i.value),class:"button"},[y(W,{display:"Cancel",direction:s(G).Left,class:"info"},{default:T(()=>[Xo]),_:1},8,["direction"])],32)])):F("",!0),i.value?(h(),w("div",rs,[is,y(ke,{modelValue:o.value,"onUpdate:modelValue":v[1]||(v[1]=_=>o.value=_),class:"editname",onSubmit:u,onCancel:v[2]||(v[2]=_=>i.value=!i.value),submitOnBlur:!1},null,8,["modelValue"])])):(h(),w("div",Qo,[s(r).hasPassword?(h(),w("span",es,"lock")):F("",!0),e.isPrivate?(h(),w("span",ts,"visibility_off")):F("",!0),f("button",{class:"button open",onClick:c},[f("h3",null,P(s(r).name),1)]),f("div",ns,"Hosted by "+P(s(r).host),1)]))]))}});var os=H(as,[["__scopeId","data-v-a7843e62"]]);const Ke=e=>(fe("data-v-6c2b3a99"),e=e(),me(),e),ss=Ke(()=>f("h2",null,"Multiplayer",-1)),ls={style:{"text-align":"center"}},us=Ke(()=>f("br",null,null,-1)),cs={class:"players-list"},ds={key:0,style:{"font-size":"small",color:"grey","margin-left":"10px"}},fs=Ke(()=>f("div",{style:{"flex-grow":"1"}},null,-1)),ms=["onClick"],gs=Ke(()=>f("br",null,null,-1)),hs={key:1},vs=V(" Not connected to a server. Please set up networking in the options modal. "),ps=Ke(()=>f("br",null,null,-1)),bs=[vs,ps],_s={class:"modal-footer"},ys={class:"footer"},ws=Ke(()=>f("div",{style:{"flex-grow":"1"}},null,-1));var Ns=B({__name:"RoomsDialog",setup(e,{expose:t}){const n=M(!1),r=M(null);t({open(){n.value=!0}});const i=M(null),o=M(""),c=M(""),u=M(""),d=M(""),v=M(!1),_=Go({roomList:()=>({display:"Room List",tab:ne(()=>{var b;return y(U,null,[((b=i.value)!=null?b:[]).map(S=>y(os,{room:S,isPrivate:!1,onConnect:$=>C(S.name,$)},null)),i.value!=null&&i.value.length===0?y("div",{style:"text-align: center"},[V("No public rooms found")]):null,i.value==null?y("div",{style:"text-align: center"},[V("Loading public rooms list...")]):null,y("br",null,null),y("button",{class:"button large",onClick:p},[V("Refresh")])])})}),direct:()=>({display:"Private Room",tab:ne(()=>y(U,null,[y("div",{class:"direct-connect"},[y("div",{class:"field"},[y(ke,{"onUpdate:modelValue":b=>o.value=b,modelValue:o.value,title:"Room Name"},null)]),y("div",{class:"field"},[y(ke,{"onUpdate:modelValue":b=>c.value=b,modelValue:c.value,title:"Room Password"},null)]),y("button",{class:"button large",onClick:()=>C(o.value,c.value)},[V("Connect")])])]))}),host:()=>({display:"Host",tab:ne(()=>y(U,null,[y("div",{class:"field"},[y(ke,{"onUpdate:modelValue":b=>u.value=b,modelValue:u.value,title:"Room Name"},null)]),y("div",{class:"field"},[y(ke,{"onUpdate:modelValue":b=>d.value=b,modelValue:d.value,title:"Room Password"},null)]),y(We,{"onUpdate:modelValue":b=>v.value=b,modelValue:v.value,title:"Private"},null),y("div",{style:"font-size: small"},[V("You will host the currently active single player world, allowing other players to join and modify your save. It is recommended to backup your save frequently.")]),y("br",null,null),y("button",{class:"button large",onClick:()=>k(u.value,d.value,v.value)},[V("Host")])]))})},()=>({style:"margin-left: 0; margin-right: 0; --layer-color: var(--link)"}));oe([n,_.selected],([b,S])=>{b&&S==="roomList"?p():b&&S==="host"&&(u.value=`${z.nickname}'s ${O.name}`)}),oe(ae,b=>{b||(o.value="",c.value="",u.value=`${z.nickname}'s ${O.name}`,d.value="",p())}),Q.on("setRooms",b=>i.value=b),Q.on("serverSentInfo",()=>{n.value&&p()});function p(){i.value=null,Ue("get rooms")}function C(b,S){Ue("connect to room",b,S,z.nickname)}function k(b,S,$){Ue("create room",{name:b,password:S,nickname:z.nickname,privateRoom:$===!0,state:lo()})}return(b,S)=>(h(),q(Pe,{modelValue:n.value,"onUpdate:modelValue":S[2]||(S[2]=$=>n.value=$),ref_key:"modal",ref:r},{header:T(()=>[ss]),body:T(({shown:$})=>[$?(h(),w(U,{key:0},[s(He)?(h(),w(U,{key:0},[s(ae)?(h(),w(U,{key:0},[f("div",ls,[f("h3",null,"Connected to "+P(s(ae)),1)]),us,f("ul",cs,[(h(!0),w(U,null,he(s(Lt),(A,I)=>(h(),w("div",{key:I,style:{display:"flex"}},[f("span",null,P(A),1),A===s(z).nickname?(h(),w("span",ds,"(YOU)")):F("",!0),fs,s(_e)&&A!==s(z).nickname?(h(),w("button",{key:1,class:"button",style:{color:"red",display:"inline"},onClick:x=>s(Ue)("kick user",A)}," KICK ",8,ms)):F("",!0)]))),128))]),gs,f("button",{class:"button large",onClick:S[0]||(S[0]=()=>k(u.value,d.value,v.value))},P(s(_e)?"Close":"Leave")+" room ",1)],64)):(h(),q(se(s(wt)(s(_))),{key:1}))],64)):(h(),w("div",hs,bs))],64)):F("",!0)]),footer:T(()=>[f("div",_s,[f("div",ys,[ws,f("button",{class:"button modal-default-button",onClick:S[1]||(S[1]=$=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Cs=H(Ns,[["__scopeId","data-v-6c2b3a99"]]);const Be=e=>(fe("data-v-10effbe8"),e=e(),me(),e),Ss={class:"info-modal-header"},Is=["src","alt"],$s={class:"info-modal-title"},ks={key:0},Ms={key:0},xs={key:0},Fs=Be(()=>f("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),Ts=Be(()=>f("br",null,null,-1)),Ps=Be(()=>f("br",null,null,-1)),Es=["href"],Vs=Be(()=>f("span",{class:"material-icons info-modal-discord"},"discord",-1)),Os=Be(()=>f("div",null,[f("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[f("span",{class:"material-icons info-modal-discord"},"discord"),V(" Profectus & Friends ")])],-1)),Ls=Be(()=>f("div",null,[f("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[f("span",{class:"material-icons info-modal-discord"},"discord"),V(" The Modding Tree ")])],-1)),Ds=Be(()=>f("br",null,null,-1));var qs=B({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:r,logo:i,author:o,discordName:c,discordLink:u,versionNumber:d,versionTitle:v}=R,_=de(n),p=M(!1),C=D(()=>Pt(O.timePlayed)),k=D(()=>ye(ne(()=>y(U,null,[po.map(wt)]))));t({open(){p.value=!0}});function b(){var S;(S=s(_.changelog))==null||S.open()}return(S,$)=>(h(),q(Pe,{modelValue:p.value,"onUpdate:modelValue":$[0]||($[0]=A=>p.value=A)},{header:T(()=>[f("div",Ss,[s(i)?(h(),w("img",{key:0,class:"info-modal-logo",src:s(i),alt:s(r)},null,8,Is)):F("",!0),f("div",$s,[f("h2",null,P(s(r)),1),f("h4",null,[V(" v"+P(s(d)),1),s(v)?(h(),w("span",ks,": "+P(s(v)),1)):F("",!0)])])])]),body:T(({shown:A})=>[A?(h(),w("div",Ms,[s(o)?(h(),w("div",xs,"By "+P(s(o)),1)):F("",!0),Fs,Ts,f("div",{class:"link",onClick:b},"Changelog"),Ps,f("div",null,[s(u)?(h(),w("a",{key:0,href:s(u),class:"info-modal-discord-link",target:"_blank"},[Vs,V(" "+P(s(c)),1)],8,Es)):F("",!0)]),Os,Ls,Ds,f("div",null,"Time Played: "+P(s(C)),1),(h(),q(se(s(k))))])):F("",!0)]),_:1},8,["modelValue"]))}});var Rs=H(qs,[["__scopeId","data-v-10effbe8"]]);const Bs={class:"field"},As={key:0,class:"field-title"},$n=B({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var c;const n=e,r=Nt(Te(n,"title"),"span"),i=M((c=n.options.find(u=>u.value===n.modelValue))!=null?c:null);oe(Te(n,"modelValue"),u=>{var d;be(i)!==u&&(i.value=(d=n.options.find(v=>v.value===u))!=null?d:null)});function o(u){t("update:modelValue",u.value)}return(u,d)=>(h(),w("div",Bs,[s(r)?(h(),w("span",As,[(h(),q(se(s(r))))])):F("",!0),y(s(Hn),{options:e.options,modelValue:i.value,"onUpdate:modelValue":[d[0]||(d[0]=v=>i.value=v),o],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}}),Us=f("div",{class:"header"},[f("h2",null,"Settings")],-1);var zs=B({__name:"Options",setup(e,{expose:t}){const n=M(!1),r=M("behaviour");function i(S){return S==r.value}function o(S){r.value=S}t({isTab:i,setTab:o,save:ue,open(){n.value=!0}});const c=Object.keys(yt).map(S=>({label:gi(S),value:S})),u=D(()=>ye(ne(()=>y(U,null,[vo.map(wt)])))),{showTPS:d,theme:v,unthrottled:_,alignUnits:p}=de(z);de(O),D({get(){return O.devSpeed===0},set(S){O.devSpeed=S?0:null}}),ne(()=>y("span",{class:"option-title"},[V("Unthrottled"),y("desc",null,[V("Allow the game to run as fast as possible. Not battery friendly.")])])),ne(()=>y("span",{class:"option-title"},[V("Offline Production"),y(W,{display:"Save-specific",direction:G.Right},{default:()=>[V("*")]}),y("desc",null,[V("Simulate production that occurs while the game is closed.")])])),ne(()=>y("span",{class:"option-title"},[V("Autosave"),y(W,{display:"Save-specific",direction:G.Right},{default:()=>[V("*")]}),y("desc",null,[V("Automatically save the game every second or when the game is closed.")])])),ne(()=>y("span",{class:"option-title"},[V("Pause game"),y(W,{display:"Save-specific",direction:G.Right},{default:()=>[V("*")]}),y("desc",null,[V("Stop everything from moving.")])]));const C=ne(()=>y("span",{class:"option-title"},[V("Theme"),y("desc",null,[V("How the game looks.")])])),k=ne(()=>y("span",{class:"option-title"},[V("Show TPS"),y("desc",null,[V("Show TPS meter at the bottom-left corner of the page.")])])),b=ne(()=>y("span",{class:"option-title"},[V("Align modifier units"),y("desc",null,[V("Align numbers to the beginning of the unit in modifier view.")])]));return(S,$)=>(h(),q(Pe,{modelValue:n.value,"onUpdate:modelValue":$[3]||($[3]=A=>n.value=A)},{header:T(()=>[Us]),body:T(()=>[y($n,{title:s(C),options:s(c),modelValue:s(v),"onUpdate:modelValue":$[0]||($[0]=A=>pe(v)?v.value=A:null)},null,8,["title","options","modelValue"]),(h(),q(se(s(u)))),y(We,{title:s(k),modelValue:s(d),"onUpdate:modelValue":$[1]||($[1]=A=>pe(d)?d.value=A:null)},null,8,["title","modelValue"]),y(We,{title:s(b),modelValue:s(p),"onUpdate:modelValue":$[2]||($[2]=A=>pe(p)?p.value=A:null)},null,8,["title","modelValue"])]),_:1},8,["modelValue"]))}});const js={key:0},Gs=["onClick","disabled"],Hs={key:0},Ws=["onClick"],Js=B({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const r=de(e),i=M(!1);oe(i,u=>{t("confirmingChanged",u)});function o(){if(s(r.skipConfirm)){t("click");return}i.value&&t("click"),i.value=!i.value}function c(){i.value=!1}return(u,d)=>(h(),w("span",{class:te(["container",{confirming:i.value}])},[i.value?(h(),w("span",js,"Are you sure?")):F("",!0),f("button",{onClick:tt(o,["stop"]),class:"button danger",disabled:e.disabled},[i.value?(h(),w("span",Hs,"Yes")):Me(u.$slots,"default",{key:1},void 0,!0)],8,Gs),i.value?(h(),w("button",{key:1,class:"button",onClick:tt(c,["stop"])},"No",8,Ws)):F("",!0)],2))}});var Zs=H(Js,[["__scopeId","data-v-2f8ef34c"]]);const Ne=e=>(fe("data-v-32313015"),e=e(),me(),e),Ks=Ne(()=>f("div",{class:"handle material-icons"},"drag_handle",-1)),Ys={key:0,class:"actions"},Xs=Ne(()=>f("span",{class:"material-icons"},"content_paste",-1)),Qs=Ne(()=>f("span",{class:"material-icons"},"content_copy",-1)),el=Ne(()=>f("span",{class:"material-icons"},"edit",-1)),tl=Ne(()=>f("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),nl={key:1,class:"actions"},rl=Ne(()=>f("span",{class:"material-icons"},"check",-1)),il=Ne(()=>f("span",{class:"material-icons"},"close",-1)),al={key:2,class:"details"},ol={class:"save-version"},sl=Ne(()=>f("br",null,null,-1)),ll={key:0},ul={key:3,class:"details"},cl={key:4,class:"details error"},dl=Ne(()=>f("br",null,null,-1)),fl=B({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:r}=de(n),i=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),o=M(!1),c=M(!1),u=M("");oe(o,()=>{var p;return u.value=(p=r.value.name)!=null?p:""});const d=D(()=>r.value!=null&&r.value.id===O.id),v=D(()=>{var p;return d.value?O.time:(p=r.value!=null&&r.value.time)!=null?p:0});function _(){t("editName",u.value),o.value=!1}return(p,C)=>(h(),w("div",{class:te(["save",{active:s(d)}])},[Ks,o.value?(h(),w("div",nl,[f("button",{onClick:_,class:"button"},[y(W,{display:"Save",direction:s(G).Left,class:"info"},{default:T(()=>[rl]),_:1},8,["direction"])]),f("button",{onClick:C[5]||(C[5]=k=>o.value=!o.value),class:"button"},[y(W,{display:"Cancel",direction:s(G).Left,class:"info"},{default:T(()=>[il]),_:1},8,["direction"])])])):(h(),w("div",Ys,[s(r).error==null&&!c.value?(h(),q(Qt,{key:0,onClick:C[0]||(C[0]=k=>t("export")),class:"button",left:""},{default:T(()=>[y(W,{display:"Export",direction:s(G).Left,class:"info"},{default:T(()=>[Xs]),_:1},8,["direction"])]),_:1})):F("",!0),s(r).error==null&&!c.value?(h(),w("button",{key:1,onClick:C[1]||(C[1]=k=>t("duplicate")),class:"button"},[y(W,{display:"Duplicate",direction:s(G).Left,class:"info"},{default:T(()=>[Qs]),_:1},8,["direction"])])):F("",!0),s(r).error==null&&!c.value?(h(),w("button",{key:2,onClick:C[2]||(C[2]=k=>o.value=!o.value),class:"button"},[y(W,{display:"Edit Name",direction:s(G).Left,class:"info"},{default:T(()=>[el]),_:1},8,["direction"])])):F("",!0),y(Zs,{disabled:s(d),onClick:C[3]||(C[3]=k=>t("delete")),onConfirmingChanged:C[4]||(C[4]=k=>c.value=k)},{default:T(()=>[y(W,{display:"Delete",direction:s(G).Left,class:"info"},{default:T(()=>[tl]),_:1},8,["direction"])]),_:1},8,["disabled"])])),s(r).error==null&&!o.value?(h(),w("div",al,[f("button",{class:"button open",onClick:C[6]||(C[6]=k=>t("open"))},[f("h3",null,P(s(r).name),1)]),f("span",ol,"v"+P(s(r).modVersion),1),sl,s(v)?(h(),w("div",ll,"Last played "+P(s(i).format(s(v))),1)):F("",!0)])):s(r).error==null&&o.value?(h(),w("div",ul,[y(ke,{modelValue:u.value,"onUpdate:modelValue":C[7]||(C[7]=k=>u.value=k),class:"editname",onSubmit:_},null,8,["modelValue"])])):(h(),w("div",cl,[V(" Error: Failed to load save with id "+P(s(r).id),1),dl,V(P(s(r).error),1)]))],2))}});var ml=H(fl,[["__scopeId","data-v-32313015"]]);const qt=e=>(fe("data-v-f10c7950"),e=e(),me(),e),gl=qt(()=>f("h2",null,"Saves Manager",-1)),hl={key:1},vl={class:"modal-footer"},pl={key:1,class:"field"},bl=qt(()=>f("span",{class:"field-title"},"Create Save",-1)),_l={class:"field-buttons"},yl={class:"footer"},wl=qt(()=>f("div",{style:{"flex-grow":"1"}},null,-1)),Nl=B({__name:"SavesManager",setup(e,{expose:t}){const n=M(!1),r=M(null);t({open(){n.value=!0}});const i=M(!1),o=M(""),c=M(null);oe(o,I=>{I?Fe(()=>{try{if(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),i.value=!0;return}const x=JSON.parse(I);if(typeof x!="object"){i.value=!0;return}const j=ut();x.id=j,ue(x),o.value="",i.value=!1,z.saves.push(j)}catch{i.value=!0}}):i.value=!1});let u={},d=M(Object.keys(u).reduce((I,x)=>(I.push({label:x.split("/").slice(-1)[0].slice(0,-4),value:u[x]}),I),[]));const v=Mt({});function _(I){if(v[I]==null){let x=localStorage.getItem(I);if(x==null)v[I]={error:"Save doesn't exist in localStorage",id:I};else if(x==="dW5kZWZpbmVk")v[I]={error:"Save is undefined",id:I};else try{if(x[0]!=="{")if(x[0]==="e")x=decodeURIComponent(escape(atob(x)));else if(x[0]==="\u1BE1")x=we.decompressFromUTF16(x);else return console.warn("Unable to determine preset encoding",x),i.value=!0,v[I]={error:"Unable to determine preset encoding",id:I},v[I];v[I]={...JSON.parse(x),id:I}}catch(j){v[I]={error:j,id:I},console.warn(`SavesManager: Failed to load info about save with id ${I}: +`+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}`),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",onClick:t[1]||(t[1]=d=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(h(),q(se(e.minimizedComponent),{key:0})):(h(),w("div",wo,P(e.unref(e.name)),1))])):(h(),w("div",{key:2,class:te(["layer-tab",{showGoBack:e.showGoBack}])},[y(u,{onUpdateNodes:e.updateNodes},{default:T(()=>[(h(),q(se(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(h(),w("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=d=>e.$emit("setMinimized",!0))}," \u25BC ")):F("",!0)],16))}var Co=H(yo,[["render",No],["__scopeId","data-v-a9f5b1da"]]);const Sn=e=>(fe("data-v-4b4bda40"),e=e(),me(),e),So=Sn(()=>f("h2",null,"Changelog",-1)),Io=Sn(()=>f("details",{open:""},[f("summary",null,[V("v0.0 Initial Commit - "),f("time",null,"2021-09-04")]),V(" This is the first release :D "),f("ul",null,[f("li",{class:"feature"},"Did everything"),f("li",{class:"fix"},"Had some fun"),f("li",{class:"breaking"},"Removed everything"),f("li",{class:"balancing"},"Created some bugs to fix later")])],-1)),$o=B({__name:"Changelog",setup(e,{expose:t}){const n=M(!1);return t({open(){n.value=!0}}),(r,i)=>(h(),q(Ee,{modelValue:n.value,"onUpdate:modelValue":i[0]||(i[0]=o=>n.value=o)},{header:T(()=>[So]),body:T(()=>[Io]),_:1},8,["modelValue"]))}});var ko=H($o,[["__scopeId","data-v-4b4bda40"]]);const Mo=["onSubmit"],xo={class:"field"},Fo={key:0,class:"field-title"},To=["placeholder"],Po=B({__name:"Text",props:{title:null,modelValue:null,textArea:{type:Boolean},placeholder:null,maxHeight:null,submitOnBlur:{type:Boolean}},emits:["update:modelValue","submit","cancel"],setup(e,{emit:t}){const n=e,r=Nt(Pe(n,"title"),"span"),i=Je(null);pt(()=>{var d;(d=i.value)==null||d.focus()});const o=D({get(){var d;return(d=s(n.modelValue))!=null?d:""},set(d){t("update:modelValue",d)}});function c(){t("submit")}function u(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(d,v)=>(h(),w("form",{onSubmit:tt(c,["prevent"])},[f("div",xo,[s(r)?(h(),w("span",Fo,[(h(),q(se(s(r))))])):F("",!0),e.textArea?(h(),q(s(Gn),{key:1,modelValue:s(o),"onUpdate:modelValue":v[0]||(v[0]=_=>pe(o)?o.value=_:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:u,ref_key:"field",ref:i},null,8,["modelValue","placeholder","maxHeight"])):bt((h(),w("input",{key:2,type:"text","onUpdate:modelValue":v[1]||(v[1]=_=>pe(o)?o.value=_:null),placeholder:e.placeholder,class:te({fullWidth:!e.title}),onBlur:u,ref_key:"field",ref:i},null,42,To)),[[On,s(o)]])])],40,Mo))}});var Me=H(Po,[["__scopeId","data-v-90bd4994"]]);const Eo={class:"field"},Vo=B({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=D(()=>{var o;return ye((o=s(n.title))!=null?o:"","span")}),i=D({get(){return!!n.modelValue},set(o){t("update:modelValue",o)}});return(o,c)=>(h(),w("label",Eo,[bt(f("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":c[0]||(c[0]=u=>pe(i)?i.value=u:null)},null,512),[[Ln,s(i)]]),(h(),q(se(s(r))))]))}});var We=H(Vo,[["__scopeId","data-v-11046116"]]);Q.on("setupVue",e=>e.use(zn));function Oo(e="white",t="8px"){return{transform:"scale(1.05, 1.05)",borderColor:"rgba(0, 0, 0, 0.125)",boxShadow:`-4px -4px 4px rgba(0, 0, 0, 0.25) inset, 0 0 ${t} ${e}`,zIndex:1}}const Lo=B({props:{visibility:{type:J(Number,Boolean),required:!0},display:{type:J(Object,String,Function),required:!0},style:J(String,Object,Array),classes:J(Object),glowColor:J(String),active:Boolean,floating:Boolean},emits:["selectTab"],setup(e,{emit:t}){const{display:n,glowColor:r,floating:i}=de(e),o=Cn(n),c=D(()=>{const d=be(r);return d==null||d===""?{}:s(i)?Oo(d):{boxShadow:`0px 9px 5px -6px ${d}`}});function u(){t("selectTab")}return{selectTab:u,component:o,glowColorStyle:c,unref:s,Visibility:rt,isVisible:gt,isHidden:cn}}});function Do(e,t,n,r,i,o){var c;return e.isVisible(e.visibility)?(h(),w("button",{key:0,onClick:t[0]||(t[0]=(...u)=>e.selectTab&&e.selectTab(...u)),class:te(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:ve([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(c=e.unref(e.style))!=null?c:{}])},[(h(),q(se(e.component)))],6)):F("",!0)}var In=H(Lo,[["render",Do],["__scopeId","data-v-21427abb"]]);const qo=B({__name:"Sticky",setup(e){const t=M("0"),n=new ResizeObserver(i),r=Je(null);function i(){let o=r.value;if(o==null)return;let c=0;for(;o.previousSibling;){const u=o.previousSibling;u.dataset&&"vSticky"in u.dataset&&(c+=u.offsetHeight),o=u}t.value=c+"px"}return Te(i),document.fonts.ready.then(i),pt(()=>{var c;const o=(c=r.value)==null?void 0:c.parentElement;o&&n.observe(o)}),(o,c)=>(h(),w("div",{class:"sticky",style:ve({top:t.value}),ref_key:"element",ref:r,"data-v-sticky":""},[xe(o.$slots,"default",{},void 0,!0)],4))}});var Ro=H(qo,[["__scopeId","data-v-cccac690"]]);const Bo=B({props:{visibility:{type:J(Number,Boolean),required:!0},activeTab:{type:J(Object),required:!0},selected:{type:Object,required:!0},tabs:{type:J(Object),required:!0},style:J(String,Object,Array),classes:J(Object),buttonContainerStyle:J(String,Object,Array),buttonContainerClasses:J(Object)},components:{Sticky:Ro,TabButton:In},setup(e){const{activeTab:t}=de(e),n=D(()=>yt[z.theme].floatingTabs),r=Je("");Ft(()=>{const u=be(t);if(u==null){r.value="";return}if(et(u)){r.value=ye(u);return}r.value=ye(s(u.display))});const i=D(()=>{const u=be(t);return et(u)||!u?void 0:s(u.classes)}),o=D(()=>{const u=be(t);return et(u)||!u?void 0:s(u.style)});function c(u){const{display:d,style:v,classes:_,glowColor:p,visibility:C}=u;return{display:d,style:s(v),classes:_,glowColor:p,visibility:C}}return{floating:n,tabClasses:i,tabStyle:o,Visibility:rt,component:r,gatherButtonProps:c,unref:s,isVisible:gt,isHidden:cn}}});function Ao(e,t,n,r,i,o){var d,v;const c=ct("TabButton"),u=ct("Sticky");return e.isVisible(e.visibility)?(h(),w("div",{key:0,class:te(["tab-family-container",{...e.unref(e.classes),...e.tabClasses}]),style:ve([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(d=e.unref(e.style))!=null?d:[],(v=e.tabStyle)!=null?v:[]])},[y(u,{class:te(["tab-buttons-container",e.unref(e.buttonContainerClasses)]),style:ve(e.unref(e.buttonContainerStyle))},{default:T(()=>[f("div",{class:te(["tab-buttons",{floating:e.floating}])},[(h(!0),w(U,null,he(e.unref(e.tabs),(_,p)=>(h(),q(c,Re({onSelectTab:C=>e.selected.value=p,floating:e.floating,key:p,active:e.unref(_.tab)===e.unref(e.activeTab)},e.gatherButtonProps(_)),null,16,["onSelectTab","floating","active"]))),128))],2)]),_:1},8,["class","style"]),e.unref(e.activeTab)?(h(),q(se(e.unref(e.component)),{key:0})):F("",!0)],6)):F("",!0)}var Uo=H(Bo,[["render",Ao],["__scopeId","data-v-58dbf83a"]]);const zo=Symbol("TabButton"),jo=Symbol("TabFamily");function Go(e,t){Object.keys(e).length===0&&console.error("Cannot create tab family with 0 tabs");const n=Ot(Object.keys(e)[0],!1);return yn(r=>{var c;const i=(c=t==null?void 0:t.call(r,r))!=null?c:{};i.id=vi("tabFamily-"),i.type=jo,i[mt]=Uo,i.tabs=Object.keys(e).reduce((u,d)=>{const v=e[d]();return v.type=zo,v[mt]=In,ee(v,"visibility"),Fe(v,"visibility",rt.Visible),ee(v,"tab"),ee(v,"display"),ee(v,"classes"),ee(v,"style"),ee(v,"glowColor"),u[d]=v,u},{}),i.selected=n,i.activeTab=D(()=>{const u=s(o.tabs);if(n.value in u&>(u[n.value].visibility))return s(u[n.value].tab);const d=Object.values(u).find(v=>gt(v.visibility));return d?s(d.tab):null}),ee(i,"visibility"),Fe(i,"visibility",rt.Visible),ee(i,"classes"),ee(i,"style"),ee(i,"buttonContainerClasses"),ee(i,"buttonContainerStyle"),i[Et]=function(){const{visibility:u,activeTab:d,selected:v,tabs:_,style:p,classes:C,buttonContainerClasses:k,buttonContainerStyle:b}=this;return{visibility:u,activeTab:d,selected:v,tabs:_,style:s(p),classes:C,buttonContainerClasses:k,buttonContainerStyle:b}};const o=i;return o})}var Ho=B({props:{element:Object,display:{type:J(Object,String,Function),required:!0},style:J(Object,String,Array),classes:J(Object),direction:J(String),xoffset:J(String),yoffset:J(String),pinned:Object},setup(e){const{element:t,display:n,pinned:r}=de(e),i=M(!1),o=D(()=>(be(r)||i.value)&&c.value),c=Nt(n),u=Je(ye(ne(()=>{const _=be(t);return _==null?"":_o(_)})));function d(_){const p=r;_.shiftKey&&p&&(p.value=!p.value,_.stopPropagation(),_.preventDefault())}const v=D(()=>be(r)&&yt[z.theme].showPin);return{Direction:G,isHovered:i,isShown:o,comp:c,elementComp:u,unref:s,togglePinned:d,showPin:v}}});const Wo={key:0,class:"material-icons pinned"};function Jo(e,t,n,r,i,o){return h(),w("div",{class:te(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=c=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=c=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...c)=>e.togglePinned&&e.togglePinned(...c))},[xe(e.$slots,"default",{},void 0,!0),e.elementComp?(h(),q(se(e.elementComp),{key:0})):F("",!0),y(xt,{name:"fade"},{default:T(()=>{var c;return[e.isShown?(h(),w("div",{key:0,class:te(["tooltip",{top:e.unref(e.direction)===e.Direction.Up,left:e.unref(e.direction)===e.Direction.Left,right:e.unref(e.direction)===e.Direction.Right,bottom:e.unref(e.direction)===e.Direction.Down,...e.unref(e.classes)}]),style:ve([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(c=e.unref(e.style))!=null?c:{}])},[e.showPin?(h(),w("span",Wo,"push_pin")):F("",!0),e.comp?(h(),q(se(e.comp),{key:1})):F("",!0)],6)):F("",!0)]}),_:1})],34)}var W=H(Ho,[["render",Jo],["__scopeId","data-v-6102fa3a"]]);const Dt=e=>(fe("data-v-a7843e62"),e=e(),me(),e),Zo={class:"room"},Ko={key:0,class:"actions"},Yo=Dt(()=>f("span",{class:"material-icons"},"check",-1)),Xo=Dt(()=>f("span",{class:"material-icons"},"close",-1)),Qo={key:1,class:"details"},es={key:0,class:"material-icons"},ts={key:1,class:"material-icons"},ns={class:"room-host"},rs={key:2,class:"details",style:{display:"flex"}},is=Dt(()=>f("span",null,"Password:",-1)),as=B({__name:"Room",props:{isPrivate:{type:Boolean},room:null},emits:["connect"],setup(e,{emit:t}){const n=e,{room:r}=de(n),i=M(!1),o=M("");oe(i,d=>{d&&(o.value="")});function c(){r.value.hasPassword?i.value=!0:t("connect")}function u(){t("connect",o.value),i.value=!1}return(d,v)=>(h(),w("div",Zo,[i.value?(h(),w("div",Ko,[f("button",{onPointerdown:u,class:"button"},[y(W,{display:"Join",direction:s(G).Left,class:"info"},{default:T(()=>[Yo]),_:1},8,["direction"])],32),f("button",{onPointerdown:v[0]||(v[0]=_=>i.value=!i.value),class:"button"},[y(W,{display:"Cancel",direction:s(G).Left,class:"info"},{default:T(()=>[Xo]),_:1},8,["direction"])],32)])):F("",!0),i.value?(h(),w("div",rs,[is,y(Me,{modelValue:o.value,"onUpdate:modelValue":v[1]||(v[1]=_=>o.value=_),class:"editname",onSubmit:u,onCancel:v[2]||(v[2]=_=>i.value=!i.value),submitOnBlur:!1},null,8,["modelValue"])])):(h(),w("div",Qo,[s(r).hasPassword?(h(),w("span",es,"lock")):F("",!0),e.isPrivate?(h(),w("span",ts,"visibility_off")):F("",!0),f("button",{class:"button open",onClick:c},[f("h3",null,P(s(r).name),1)]),f("div",ns,"Hosted by "+P(s(r).host),1)]))]))}});var os=H(as,[["__scopeId","data-v-a7843e62"]]);const Ke=e=>(fe("data-v-6c2b3a99"),e=e(),me(),e),ss=Ke(()=>f("h2",null,"Multiplayer",-1)),ls={style:{"text-align":"center"}},us=Ke(()=>f("br",null,null,-1)),cs={class:"players-list"},ds={key:0,style:{"font-size":"small",color:"grey","margin-left":"10px"}},fs=Ke(()=>f("div",{style:{"flex-grow":"1"}},null,-1)),ms=["onClick"],gs=Ke(()=>f("br",null,null,-1)),hs={key:1},vs=V(" Not connected to a server. Please set up networking in the options modal. "),ps=Ke(()=>f("br",null,null,-1)),bs=[vs,ps],_s={class:"modal-footer"},ys={class:"footer"},ws=Ke(()=>f("div",{style:{"flex-grow":"1"}},null,-1));var Ns=B({__name:"RoomsDialog",setup(e,{expose:t}){const n=M(!1),r=M(null);t({open(){n.value=!0}});const i=M(null),o=M(""),c=M(""),u=M(""),d=M(""),v=M(!1),_=Go({roomList:()=>({display:"Room List",tab:ne(()=>{var b;return y(U,null,[((b=i.value)!=null?b:[]).map(S=>y(os,{room:S,isPrivate:!1,onConnect:$=>C(S.name,$)},null)),i.value!=null&&i.value.length===0?y("div",{style:"text-align: center"},[V("No public rooms found")]):null,i.value==null?y("div",{style:"text-align: center"},[V("Loading public rooms list...")]):null,y("br",null,null),y("button",{class:"button large",onClick:p},[V("Refresh")])])})}),direct:()=>({display:"Private Room",tab:ne(()=>y(U,null,[y("div",{class:"direct-connect"},[y("div",{class:"field"},[y(Me,{"onUpdate:modelValue":b=>o.value=b,modelValue:o.value,title:"Room Name"},null)]),y("div",{class:"field"},[y(Me,{"onUpdate:modelValue":b=>c.value=b,modelValue:c.value,title:"Room Password"},null)]),y("button",{class:"button large",onClick:()=>C(o.value,c.value)},[V("Connect")])])]))}),host:()=>({display:"Host",tab:ne(()=>y(U,null,[y("div",{class:"field"},[y(Me,{"onUpdate:modelValue":b=>u.value=b,modelValue:u.value,title:"Room Name"},null)]),y("div",{class:"field"},[y(Me,{"onUpdate:modelValue":b=>d.value=b,modelValue:d.value,title:"Room Password"},null)]),y(We,{"onUpdate:modelValue":b=>v.value=b,modelValue:v.value,title:"Private"},null),y("div",{style:"font-size: small"},[V("You will host the currently active single player world, allowing other players to join and modify your save. It is recommended to backup your save frequently.")]),y("br",null,null),y("button",{class:"button large",onClick:()=>k(u.value,d.value,v.value)},[V("Host")])]))})},()=>({style:"margin-left: 0; margin-right: 0; --layer-color: var(--link)"}));oe([n,_.selected],([b,S])=>{b&&S==="roomList"?p():b&&S==="host"&&(u.value=`${z.nickname}'s ${O.name}`)}),oe(ae,b=>{b||(o.value="",c.value="",u.value=`${z.nickname}'s ${O.name}`,d.value="",p())}),Q.on("setRooms",b=>i.value=b),Q.on("serverSentInfo",()=>{n.value&&p()});function p(){i.value=null,ze("get rooms")}function C(b,S){ze("connect to room",b,S,z.nickname)}function k(b,S,$){ze("create room",{name:b,password:S,nickname:z.nickname,privateRoom:$===!0,state:lo()})}return(b,S)=>(h(),q(Ee,{modelValue:n.value,"onUpdate:modelValue":S[2]||(S[2]=$=>n.value=$),ref_key:"modal",ref:r},{header:T(()=>[ss]),body:T(({shown:$})=>[$?(h(),w(U,{key:0},[s(He)?(h(),w(U,{key:0},[s(ae)?(h(),w(U,{key:0},[f("div",ls,[f("h3",null,"Connected to "+P(s(ae)),1)]),us,f("ul",cs,[(h(!0),w(U,null,he(s(Lt),(A,I)=>(h(),w("div",{key:I,style:{display:"flex"}},[f("span",null,P(A),1),A===s(z).nickname?(h(),w("span",ds,"(YOU)")):F("",!0),fs,s(_e)&&A!==s(z).nickname?(h(),w("button",{key:1,class:"button",style:{color:"red",display:"inline"},onClick:x=>s(ze)("kick user",A)}," KICK ",8,ms)):F("",!0)]))),128))]),gs,f("button",{class:"button large",onClick:S[0]||(S[0]=()=>k(u.value,d.value,v.value))},P(s(_e)?"Close":"Leave")+" room ",1)],64)):(h(),q(se(s(wt)(s(_))),{key:1}))],64)):(h(),w("div",hs,bs))],64)):F("",!0)]),footer:T(()=>[f("div",_s,[f("div",ys,[ws,f("button",{class:"button modal-default-button",onClick:S[1]||(S[1]=$=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Cs=H(Ns,[["__scopeId","data-v-6c2b3a99"]]);const Ae=e=>(fe("data-v-10effbe8"),e=e(),me(),e),Ss={class:"info-modal-header"},Is=["src","alt"],$s={class:"info-modal-title"},ks={key:0},Ms={key:0},xs={key:0},Fs=Ae(()=>f("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),Ts=Ae(()=>f("br",null,null,-1)),Ps=Ae(()=>f("br",null,null,-1)),Es=["href"],Vs=Ae(()=>f("span",{class:"material-icons info-modal-discord"},"discord",-1)),Os=Ae(()=>f("div",null,[f("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[f("span",{class:"material-icons info-modal-discord"},"discord"),V(" Profectus & Friends ")])],-1)),Ls=Ae(()=>f("div",null,[f("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[f("span",{class:"material-icons info-modal-discord"},"discord"),V(" The Modding Tree ")])],-1)),Ds=Ae(()=>f("br",null,null,-1));var qs=B({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:r,logo:i,author:o,discordName:c,discordLink:u,versionNumber:d,versionTitle:v}=R,_=de(n),p=M(!1),C=D(()=>Pt(O.timePlayed)),k=D(()=>ye(ne(()=>y(U,null,[po.map(wt)]))));t({open(){p.value=!0}});function b(){var S;(S=s(_.changelog))==null||S.open()}return(S,$)=>(h(),q(Ee,{modelValue:p.value,"onUpdate:modelValue":$[0]||($[0]=A=>p.value=A)},{header:T(()=>[f("div",Ss,[s(i)?(h(),w("img",{key:0,class:"info-modal-logo",src:s(i),alt:s(r)},null,8,Is)):F("",!0),f("div",$s,[f("h2",null,P(s(r)),1),f("h4",null,[V(" v"+P(s(d)),1),s(v)?(h(),w("span",ks,": "+P(s(v)),1)):F("",!0)])])])]),body:T(({shown:A})=>[A?(h(),w("div",Ms,[s(o)?(h(),w("div",xs,"By "+P(s(o)),1)):F("",!0),Fs,Ts,f("div",{class:"link",onClick:b},"Changelog"),Ps,f("div",null,[s(u)?(h(),w("a",{key:0,href:s(u),class:"info-modal-discord-link",target:"_blank"},[Vs,V(" "+P(s(c)),1)],8,Es)):F("",!0)]),Os,Ls,Ds,f("div",null,"Time Played: "+P(s(C)),1),(h(),q(se(s(k))))])):F("",!0)]),_:1},8,["modelValue"]))}});var Rs=H(qs,[["__scopeId","data-v-10effbe8"]]);const Bs={class:"field"},As={key:0,class:"field-title"},$n=B({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var c;const n=e,r=Nt(Pe(n,"title"),"span"),i=M((c=n.options.find(u=>u.value===n.modelValue))!=null?c:null);oe(Pe(n,"modelValue"),u=>{var d;be(i)!==u&&(i.value=(d=n.options.find(v=>v.value===u))!=null?d:null)});function o(u){t("update:modelValue",u.value)}return(u,d)=>(h(),w("div",Bs,[s(r)?(h(),w("span",As,[(h(),q(se(s(r))))])):F("",!0),y(s(Hn),{options:e.options,modelValue:i.value,"onUpdate:modelValue":[d[0]||(d[0]=v=>i.value=v),o],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}}),Us=f("div",{class:"header"},[f("h2",null,"Settings")],-1);var zs=B({__name:"Options",setup(e,{expose:t}){const n=M(!1),r=M("behaviour");function i(S){return S==r.value}function o(S){r.value=S}t({isTab:i,setTab:o,save:ue,open(){n.value=!0}});const c=Object.keys(yt).map(S=>({label:gi(S),value:S})),u=D(()=>ye(ne(()=>y(U,null,[vo.map(wt)])))),{showTPS:d,theme:v,unthrottled:_,alignUnits:p}=de(z);de(O),D({get(){return O.devSpeed===0},set(S){O.devSpeed=S?0:null}}),ne(()=>y("span",{class:"option-title"},[V("Unthrottled"),y("desc",null,[V("Allow the game to run as fast as possible. Not battery friendly.")])])),ne(()=>y("span",{class:"option-title"},[V("Offline Production"),y(W,{display:"Save-specific",direction:G.Right},{default:()=>[V("*")]}),y("desc",null,[V("Simulate production that occurs while the game is closed.")])])),ne(()=>y("span",{class:"option-title"},[V("Autosave"),y(W,{display:"Save-specific",direction:G.Right},{default:()=>[V("*")]}),y("desc",null,[V("Automatically save the game every second or when the game is closed.")])])),ne(()=>y("span",{class:"option-title"},[V("Pause game"),y(W,{display:"Save-specific",direction:G.Right},{default:()=>[V("*")]}),y("desc",null,[V("Stop everything from moving.")])]));const C=ne(()=>y("span",{class:"option-title"},[V("Theme"),y("desc",null,[V("How the game looks.")])])),k=ne(()=>y("span",{class:"option-title"},[V("Show TPS"),y("desc",null,[V("Show TPS meter at the bottom-left corner of the page.")])])),b=ne(()=>y("span",{class:"option-title"},[V("Align modifier units"),y("desc",null,[V("Align numbers to the beginning of the unit in modifier view.")])]));return(S,$)=>(h(),q(Ee,{modelValue:n.value,"onUpdate:modelValue":$[3]||($[3]=A=>n.value=A)},{header:T(()=>[Us]),body:T(()=>[y($n,{title:s(C),options:s(c),modelValue:s(v),"onUpdate:modelValue":$[0]||($[0]=A=>pe(v)?v.value=A:null)},null,8,["title","options","modelValue"]),(h(),q(se(s(u)))),y(We,{title:s(k),modelValue:s(d),"onUpdate:modelValue":$[1]||($[1]=A=>pe(d)?d.value=A:null)},null,8,["title","modelValue"]),y(We,{title:s(b),modelValue:s(p),"onUpdate:modelValue":$[2]||($[2]=A=>pe(p)?p.value=A:null)},null,8,["title","modelValue"])]),_:1},8,["modelValue"]))}});const js={key:0},Gs=["onClick","disabled"],Hs={key:0},Ws=["onClick"],Js=B({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const r=de(e),i=M(!1);oe(i,u=>{t("confirmingChanged",u)});function o(){if(s(r.skipConfirm)){t("click");return}i.value&&t("click"),i.value=!i.value}function c(){i.value=!1}return(u,d)=>(h(),w("span",{class:te(["container",{confirming:i.value}])},[i.value?(h(),w("span",js,"Are you sure?")):F("",!0),f("button",{onClick:tt(o,["stop"]),class:"button danger",disabled:e.disabled},[i.value?(h(),w("span",Hs,"Yes")):xe(u.$slots,"default",{key:1},void 0,!0)],8,Gs),i.value?(h(),w("button",{key:1,class:"button",onClick:tt(c,["stop"])},"No",8,Ws)):F("",!0)],2))}});var Zs=H(Js,[["__scopeId","data-v-2f8ef34c"]]);const Ne=e=>(fe("data-v-32313015"),e=e(),me(),e),Ks=Ne(()=>f("div",{class:"handle material-icons"},"drag_handle",-1)),Ys={key:0,class:"actions"},Xs=Ne(()=>f("span",{class:"material-icons"},"content_paste",-1)),Qs=Ne(()=>f("span",{class:"material-icons"},"content_copy",-1)),el=Ne(()=>f("span",{class:"material-icons"},"edit",-1)),tl=Ne(()=>f("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),nl={key:1,class:"actions"},rl=Ne(()=>f("span",{class:"material-icons"},"check",-1)),il=Ne(()=>f("span",{class:"material-icons"},"close",-1)),al={key:2,class:"details"},ol={class:"save-version"},sl=Ne(()=>f("br",null,null,-1)),ll={key:0},ul={key:3,class:"details"},cl={key:4,class:"details error"},dl=Ne(()=>f("br",null,null,-1)),fl=B({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:r}=de(n),i=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),o=M(!1),c=M(!1),u=M("");oe(o,()=>{var p;return u.value=(p=r.value.name)!=null?p:""});const d=D(()=>r.value!=null&&r.value.id===O.id),v=D(()=>{var p;return d.value?O.time:(p=r.value!=null&&r.value.time)!=null?p:0});function _(){t("editName",u.value),o.value=!1}return(p,C)=>(h(),w("div",{class:te(["save",{active:s(d)}])},[Ks,o.value?(h(),w("div",nl,[f("button",{onClick:_,class:"button"},[y(W,{display:"Save",direction:s(G).Left,class:"info"},{default:T(()=>[rl]),_:1},8,["direction"])]),f("button",{onClick:C[5]||(C[5]=k=>o.value=!o.value),class:"button"},[y(W,{display:"Cancel",direction:s(G).Left,class:"info"},{default:T(()=>[il]),_:1},8,["direction"])])])):(h(),w("div",Ys,[s(r).error==null&&!c.value?(h(),q(Qt,{key:0,onClick:C[0]||(C[0]=k=>t("export")),class:"button",left:""},{default:T(()=>[y(W,{display:"Export",direction:s(G).Left,class:"info"},{default:T(()=>[Xs]),_:1},8,["direction"])]),_:1})):F("",!0),s(r).error==null&&!c.value?(h(),w("button",{key:1,onClick:C[1]||(C[1]=k=>t("duplicate")),class:"button"},[y(W,{display:"Duplicate",direction:s(G).Left,class:"info"},{default:T(()=>[Qs]),_:1},8,["direction"])])):F("",!0),s(r).error==null&&!c.value?(h(),w("button",{key:2,onClick:C[2]||(C[2]=k=>o.value=!o.value),class:"button"},[y(W,{display:"Edit Name",direction:s(G).Left,class:"info"},{default:T(()=>[el]),_:1},8,["direction"])])):F("",!0),y(Zs,{disabled:s(d),onClick:C[3]||(C[3]=k=>t("delete")),onConfirmingChanged:C[4]||(C[4]=k=>c.value=k)},{default:T(()=>[y(W,{display:"Delete",direction:s(G).Left,class:"info"},{default:T(()=>[tl]),_:1},8,["direction"])]),_:1},8,["disabled"])])),s(r).error==null&&!o.value?(h(),w("div",al,[f("button",{class:"button open",onClick:C[6]||(C[6]=k=>t("open"))},[f("h3",null,P(s(r).name),1)]),f("span",ol,"v"+P(s(r).modVersion),1),sl,s(v)?(h(),w("div",ll,"Last played "+P(s(i).format(s(v))),1)):F("",!0)])):s(r).error==null&&o.value?(h(),w("div",ul,[y(Me,{modelValue:u.value,"onUpdate:modelValue":C[7]||(C[7]=k=>u.value=k),class:"editname",onSubmit:_},null,8,["modelValue"])])):(h(),w("div",cl,[V(" Error: Failed to load save with id "+P(s(r).id),1),dl,V(P(s(r).error),1)]))],2))}});var ml=H(fl,[["__scopeId","data-v-32313015"]]);const qt=e=>(fe("data-v-f10c7950"),e=e(),me(),e),gl=qt(()=>f("h2",null,"Saves Manager",-1)),hl={key:1},vl={class:"modal-footer"},pl={key:1,class:"field"},bl=qt(()=>f("span",{class:"field-title"},"Create Save",-1)),_l={class:"field-buttons"},yl={class:"footer"},wl=qt(()=>f("div",{style:{"flex-grow":"1"}},null,-1)),Nl=B({__name:"SavesManager",setup(e,{expose:t}){const n=M(!1),r=M(null);t({open(){n.value=!0}});const i=M(!1),o=M(""),c=M(null);oe(o,I=>{I?Te(()=>{try{if(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),i.value=!0;return}const x=JSON.parse(I);if(typeof x!="object"){i.value=!0;return}const j=ut();x.id=j,ue(x),o.value="",i.value=!1,z.saves.push(j)}catch{i.value=!0}}):i.value=!1});let u={},d=M(Object.keys(u).reduce((I,x)=>(I.push({label:x.split("/").slice(-1)[0].slice(0,-4),value:u[x]}),I),[]));const v=Mt({});function _(I){if(v[I]==null){let x=localStorage.getItem(I);if(x==null)v[I]={error:"Save doesn't exist in localStorage",id:I};else if(x==="dW5kZWZpbmVk")v[I]={error:"Save is undefined",id:I};else try{if(x[0]!=="{")if(x[0]==="e")x=decodeURIComponent(escape(atob(x)));else if(x[0]==="\u1BE1")x=we.decompressFromUTF16(x);else return console.warn("Unable to determine preset encoding",x),i.value=!0,v[I]={error:"Unable to determine preset encoding",id:I},v[I];v[I]={...JSON.parse(x),id:I}}catch(j){v[I]={error:j,id:I},console.warn(`SavesManager: Failed to load info about save with id ${I}: ${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,De(p.value[I]),v[I]=void 0}function $(I){if(c.value=I,Fe(()=>{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(Pe,{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(ke,{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(Ge)().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({__name:"Nav",setup(e){const t=M(null),n=M(null),r=M(null),i=M(null),o=M(null);Q.on("openMultiplayer",()=>{var k;return(k=o.value)==null?void 0:k.open()});const{useHeader:c,banner:u,title:d,discordName:v,discordLink:_,versionNumber:p}=R;function C(){window.open(_,"mywindow")}return(k,b)=>(h(),w(U,null,[s(c)?(h(),w("div",qe({key:0,class:"nav"},k.$attrs),[s(u)?(h(),w("img",{key:0,src:s(u),class:"banner",alt:s(d)},null,8,Cl)):(h(),w("div",Sl,P(s(d)),1)),f("div",{onClick:b[0]||(b[0]=S=>{var $;return($=i.value)==null?void 0:$.open()}),class:"version-container"},[y(W,{display:"Changelog",direction:s(G).Down,class:"version"},{default:T(()=>[f("span",null,"v"+P(s(p)),1)]),_:1},8,["direction"])]),Il,f("div",$l,[f("span",{onClick:C,class:"material-icons"},"discord"),f("ul",kl,[s(_)?(h(),w("li",Ml,[f("a",{href:s(_),target:"_blank"},P(s(v)),9,xl)])):F("",!0),Fl,Tl])]),f("div",null,[f("a",Pl,[y(W,{display:"Forums",direction:s(G).Down,yoffset:"5px"},{default:T(()=>[El]),_:1},8,["direction"])])]),f("div",{onClick:b[1]||(b[1]=S=>{var $;return($=t.value)==null?void 0:$.open()})},[y(W,{display:"Info",direction:s(G).Down,class:"info"},{default:T(()=>[Vl]),_:1},8,["direction"])]),f("div",{onClick:b[2]||(b[2]=S=>{var $;return($=n.value)==null?void 0:$.open()})},[y(W,{display:"Saves",direction:s(G).Down,xoffset:"-20px"},{default:T(()=>[Ol]),_:1},8,["direction"])]),f("div",{onClick:b[3]||(b[3]=S=>{var $;return($=o.value)==null?void 0:$.open()})},[y(W,{display:"Multiplayer",direction:s(G).Down,xoffset:"-20px"},{default:T(()=>[Ll]),_:1},8,["direction"])]),f("div",{onClick:b[4]||(b[4]=S=>{var $;return($=r.value)==null?void 0:$.open()})},[y(W,{display:"Settings",direction:s(G).Down,xoffset:"-66px"},{default:T(()=>[Dl]),_:1},8,["direction"])])],16)):(h(),w("div",qe({key:1,class:"overlay-nav"},k.$attrs),[f("div",{onClick:b[5]||(b[5]=S=>{var $;return($=i.value)==null?void 0:$.open()}),class:"version-container"},[y(W,{display:"Changelog",direction:s(G).Right,xoffset:"25%",class:"version"},{default:T(()=>[f("span",null,"v"+P(s(p)),1)]),_:1},8,["direction"])]),f("div",{onClick:b[6]||(b[6]=S=>{var $;return($=n.value)==null?void 0:$.open()})},[y(W,{display:"Saves",direction:s(G).Right},{default:T(()=>[ql]),_:1},8,["direction"])]),f("div",{onClick:b[7]||(b[7]=S=>{var $;return($=o.value)==null?void 0:$.open()})},[y(W,{display:"Multiplayer",direction:s(G).Right},{default:T(()=>[Rl]),_:1},8,["direction"])]),f("div",{onClick:b[8]||(b[8]=S=>{var $;return($=r.value)==null?void 0:$.open()})},[y(W,{display:"Settings",direction:s(G).Right},{default:T(()=>[Bl]),_:1},8,["direction"])]),f("div",{onClick:b[9]||(b[9]=S=>{var $;return($=t.value)==null?void 0:$.open()})},[y(W,{display:"Info",direction:s(G).Right},{default:T(()=>[Al]),_:1},8,["direction"])]),f("div",null,[f("a",Ul,[y(W,{display:"Forums",direction:s(G).Right,xoffset:"7px"},{default:T(()=>[zl]),_:1},8,["direction"])])]),f("div",jl,[f("span",{onClick:C,class:"material-icons"},"discord"),f("ul",Gl,[s(_)?(h(),w("li",Hl,[f("a",{href:s(_),target:"_blank"},P(s(v)),9,Wl)])):F("",!0),Jl,Zl])])],16)),y(Rs,{ref_key:"info",ref:t,changelog:i.value},null,8,["changelog"]),y(kn,{ref_key:"savesManager",ref:n},null,512),y(zs,{ref_key:"options",ref:r},null,512),y(ko,{ref_key:"changelog",ref:i},null,512),y(Cs,{ref_key:"roomsDialog",ref:o},null,512)],64))}});var Mn=H(Kl,[["__scopeId","data-v-1fa4f177"]]);const Yl={class:"inner-tab"},Xl=B({__name:"Game",setup(e){const t=Te(O,"tabs"),n=D(()=>Object.keys(re)),r=R.useHeader;function i(o){const{display:c,minimized:u,name:d,color:v,minimizable:_,nodes:p,minimizedDisplay:C}=o;return{display:c,minimized:u,name:d,color:v,minimizable:_,nodes:p,minimizedDisplay:C}}return(o,c)=>(h(),w("div",{class:te(["tabs-container",{useHeader:s(r)}])},[(h(!0),w(U,null,he(s(t),(u,d)=>{var v,_;return h(),w("div",{key:d,class:te(["tab",s((v=s(re)[u])==null?void 0:v.classes)]),style:ve(s((_=s(re)[u])==null?void 0:_.style))},[d===0&&!s(r)?(h(),q(Mn,{key:0})):F("",!0),f("div",Yl,[s(n).includes(u)?(h(),q(Co,qe({key:0},i(s(re)[u]),{index:d,onSetMinimized:p=>s(re)[u].minimized.value=p}),null,16,["index","onSetMinimized"])):(h(),q(se(u),{key:1,index:d},null,8,["index"]))])],6)}),128))],2))}});var Ql=H(Xl,[["__scopeId","data-v-dcd207b4"]]);const Rt=e=>(fe("data-v-2a68614e"),e=e(),me(),e),eu=Rt(()=>f("span",null,"Chat",-1)),tu={key:0,style:{"margin-left":"10px"}},nu={key:0,class:"chat-user"},ru=Rt(()=>f("hr",{style:{"margin-top":"0"}},null,-1)),iu={class:"chat-submit"},au=Rt(()=>f("span",{class:"material-icons"},"check",-1)),ou=[au],su=B({__name:"Chat",setup(e){const t=M(!1),n=M(0),r=M(""),i=Re([]),o=M(null);function c(){Ue("chat",r.value),r.value=""}Q.on("chat",(d,v)=>{i.push({user:d,message:v});const _=o.value&&o.value.scrollTop>=o.value.scrollHeight-o.value.clientHeight;_&&Fe(()=>{o.value&&(o.value.scrollTop=o.value.scrollHeight-o.value.clientHeight)}),(!_||!t.value)&&d&&n.value++});function u(){Fe(()=>{o.value&&n.value>0&&o.value.scrollTop>=o.value.scrollHeight-o.value.clientHeight&&(n.value=0)})}return oe(t,d=>{d&&(n.value=0)}),(d,v)=>bt((h(),w("div",{class:te(["chat",{open:t.value}])},[f("div",{class:"chat-toggle",onClick:v[0]||(v[0]=_=>t.value=!t.value)},[eu,n.value?(h(),w("span",tu,"["+P(n.value>9?"9+":n.value)+"]",1)):F("",!0)]),f("div",{class:"chat-messages",ref_key:"scroll",ref:o,onScrollPassive:u},[(h(!0),w(U,null,he(i,(_,p)=>(h(),w("div",{key:p,class:"chat-message-container"},[_.user?(h(),w("span",nu,P(s(Lt)[_.user]),1)):F("",!0),f("span",{class:"chat-message",style:ve(_.user?"":"font-style: italic")},P(_.message),5)]))),128))],544),ru,f("div",iu,[y(ke,{modelValue:r.value,"onUpdate:modelValue":v[1]||(v[1]=_=>r.value=_),onSubmit:c,submitOnBlur:!1},null,8,["modelValue"]),f("button",{onPointerdown:c,class:"button"},ou,32)])],2)),[[Kt,s(ae)]])}});var lu=H(su,[["__scopeId","data-v-2a68614e"]]);const xn=e=>(fe("data-v-0c47dfae"),e=e(),me(),e),uu={class:"grid"},cu=["onClick","onMouseover"],du=xn(()=>f("div",{class:"hexagon"},null,-1)),fu=xn(()=>f("div",{class:"hexagon"},null,-1)),mu=[fu],gu=B({__name:"HexGrid",props:{gridData:null,selectedColor:null},emits:["updateColor"],setup(e,{emit:t}){const n=e,{selectedColor:r}=de(n),i=M(null);function o(d,v){t("updateColor",d,v,r.value)}function c(d,v){i.value={row:d,col:v}}function u(){i.value=null}return(d,v)=>(h(),w("div",uu,[(h(!0),w(U,null,he(e.gridData,(_,p)=>(h(),w("div",{key:p,class:"row"},[(h(!0),w(U,null,he(_,(C,k)=>(h(),w("div",{key:`${p}-${k}-${C}`,class:te({"hexagon-wrapper":!0,[C]:!0}),onClick:b=>o(p,k),onMouseover:b=>c(p,k),onMouseout:u},[du,y(xt,{name:"fade"},{default:T(()=>{var b,S;return[((b=i.value)==null?void 0:b.row)===p&&((S=i.value)==null?void 0:S.col)===k&&C!==s(r)?(h(),w("div",{key:0,class:te({"hexagon-overlay":!0,[s(r)]:!0})},mu,2)):F("",!0)]}),_:2},1024)],42,cu))),128))]))),128))]))}});var hu=H(gu,[["__scopeId","data-v-0c47dfae"]]);const Ie={gray:"gray",red:"red",green:"green",blue:"blue"},Fn=vn("main",function(){const e=Ot([[Ie.gray,Ie.gray],[Ie.red,Ie.green,Ie.blue],[Ie.gray,Ie.gray]]);return{name:"Main",minimizable:!1,classes:{main:!0},grid:e,display:ne(()=>y(U,null,[y(hu,{gridData:e.value,selectedColor:Ie.red},null),y(lu,null,null)]))}}),vu=e=>[Fn],Tn=D(()=>!1);function pu(e,t){}var bu=Object.freeze(Object.defineProperty({__proto__:null,main:Fn,getInitialLayers:vu,hasWon:Tn,fixOldSave:pu},Symbol.toStringTag,{value:"Module"}));const at=e=>(fe("data-v-4a50ce42"),e=e(),me(),e),_u={class:"game-over-modal-header"},yu=["src","alt"],wu={class:"game-over-modal-title"},Nu=at(()=>f("h2",null,"Congratulations!",-1)),Cu={key:0},Su=at(()=>f("br",null,null,-1)),Iu=at(()=>f("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),$u=at(()=>f("br",null,null,-1)),ku=["href"],Mu=at(()=>f("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),xu=B({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:r,discordLink:i,versionNumber:o,versionTitle:c}=R,u=D(()=>Pt(O.timePlayed)),d=D(()=>Tn.value&&!O.keepGoing),v=Te(O,"autosave");function _(){O.keepGoing=!0}function p(){De(Ge())}return(C,k)=>(h(),q(Pe,{"model-value":s(d)},{header:T(()=>[f("div",_u,[s(n)?(h(),w("img",{key:0,class:"game-over-modal-logo",src:s(n),alt:s(t)},null,8,yu)):F("",!0),f("div",wu,[Nu,f("h4",null,"You've beaten "+P(s(t))+" v"+P(s(o))+": "+P(s(c)),1)])])]),body:T(({shown:b})=>[b?(h(),w("div",Cu,[f("div",null,"It took you "+P(s(u))+" to beat the game.",1),Su,Iu,$u,f("div",null,[f("a",{href:s(i),class:"game-over-modal-discord-link"},[Mu,V(" "+P(s(r)),1)],8,ku)]),y(We,{title:"Autosave",modelValue:s(v),"onUpdate:modelValue":k[0]||(k[0]=S=>pe(v)?v.value=S:null)},null,8,["modelValue"])])):F("",!0)]),footer:T(()=>[f("div",{class:"game-over-footer"},[f("button",{onClick:_,class:"button"},"Keep Going"),f("button",{onClick:p,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var Fu=H(xu,[["__scopeId","data-v-4a50ce42"]]);const Ct=e=>(fe("data-v-d3bb0716"),e=e(),me(),e),Tu=Ct(()=>f("div",{class:"nan-modal-header"},[f("h2",null,"NaN value detected!")],-1)),Pu={key:0},Eu=Ct(()=>f("br",null,null,-1)),Vu=["href"],Ou=Ct(()=>f("span",{class:"material-icons nan-modal-discord"},"discord",-1)),Lu=Ct(()=>f("br",null,null,-1)),Du={class:"nan-footer"},qu=B({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=R,r=M(!0),i=M(!0),o=Te(K,"hasNaN"),c=M(null);oe(o,C=>{C?(r.value=O.autosave,i.value=O.devSpeed===0):(O.autosave=r.value,O.devSpeed=i.value?0:null)});const u=D(()=>{var C;return(C=K.NaNPath)==null?void 0:C.join(".")}),d=D(()=>K.NaNPersistent!=null?K.NaNPersistent.value:null);function v(){K.NaNPersistent!=null&&(K.NaNPersistent.value=new l(0),K.hasNaN=!1)}function _(){K.NaNPersistent&&(K.NaNPersistent.value=new l(1),K.hasNaN=!1)}function p(){K.NaNPersistent&&(K.NaNPersistent.value=new l(NaN),K.hasNaN=!1)}return(C,k)=>(h(),w(U,null,[y(Pe,qe({modelValue:s(o),"onUpdate:modelValue":k[4]||(k[4]=b=>pe(o)?o.value=b:null)},C.$attrs),{header:T(()=>[Tu]),body:T(()=>[f("div",null,[V(' Attempted to assign "'+P(s(u))+'" to NaN',1),s(d)?(h(),w("span",Pu,P(" ")+"(previously "+P(s(ln)(s(d)))+")",1)):F("",!0),V(". Auto-saving has been "+P(r.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),Eu,f("div",null,[f("a",{href:s(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[Ou,V(" "+P(s(t)||"Profectus & Friends"),1)],8,Vu)]),Lu,y(We,{title:"Autosave",modelValue:r.value,"onUpdate:modelValue":k[0]||(k[0]=b=>r.value=b)},null,8,["modelValue"]),s(R).enablePausing?(h(),q(We,{key:0,title:"Pause game",modelValue:i.value,"onUpdate:modelValue":k[1]||(k[1]=b=>i.value=b)},null,8,["modelValue"])):F("",!0)]),footer:T(()=>[f("div",Du,[f("button",{onClick:k[2]||(k[2]=b=>{var S;return(S=c.value)==null?void 0:S.open()}),class:"button"},"Open Saves Manager"),f("button",{onClick:v,class:"button"},"Set to 0"),f("button",{onClick:_,class:"button"},"Set to 1"),s(d)&&s(l).neq(s(d),0)&&s(l).neq(s(d),1)?(h(),w("button",{key:0,onClick:k[3]||(k[3]=b=>o.value=!1),class:"button"}," Set to previous ")):F("",!0),f("button",{onClick:p,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),y(kn,{ref_key:"savesManager",ref:c},null,512)],64))}});var Ru=H(qu,[["__scopeId","data-v-d3bb0716"]]);const Bu={key:0,class:"tpsDisplay"},Au=B({__name:"TPS",setup(e){const t=D(()=>l.div(K.lastTenTicks.length,K.lastTenTicks.reduce((n,r)=>n+r,0)));return(n,r)=>s(t).isNan()?F("",!0):(h(),w("div",Bu,"TPS: "+P(s(un)(s(t))),1))}});var Uu=H(Au,[["__scopeId","data-v-89b89152"]]);var zu=B({__name:"App",setup(e){const t=R.useHeader,n=D(()=>yt[z.theme].variables),r=Te(z,"showTPS"),i=Te(K,"errors"),o=D(()=>ye(ne(()=>y(U,null,[bo.map(wt)]))));return(c,u)=>s(i).length>0?(h(),w("div",{key:0,class:"error-container",style:ve(s(n))},[y(en,{errors:s(i)},null,8,["errors"])],4)):(h(),w(U,{key:1},[f("div",{id:"modal-root",style:ve(s(n))},null,4),f("div",{class:te(["app",{useHeader:s(t)}]),style:ve(s(n))},[s(t)?(h(),q(Mn,{key:0})):F("",!0),y(Ql),s(s(r))?(h(),q(Uu,{key:1})):F("",!0),y(Fu),y(Ru),(h(),q(se(s(o))))],6)],64))}});var ju=H(zu,[["__scopeId","data-v-bf4e22ac"]]);function Gu(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisterError:o}=e;let c,u;const d=async(v=!0)=>{v&&(c==null||c.addEventListener("controlling",_=>{_.isUpdate&&window.location.reload()})),u&&u.waiting&&await Zn(u.waiting,{type:"SKIP_WAITING"})};if("serviceWorker"in navigator){c=new Jn("./sw.js",{scope:"./",type:"classic"}),c.addEventListener("activated",v=>{v.isUpdate||r==null||r()});{const v=()=>{n==null||n()};c.addEventListener("waiting",v),c.addEventListener("externalwaiting",v)}c.register({immediate:t}).then(v=>{u=v,i==null||i(v)}).catch(v=>{o==null||o(v)})}return d}function Hu(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisterError:o}=e,c=M(!1),u=M(!1);return{updateServiceWorker:Gu({immediate:t,onNeedRefresh(){c.value=!0,n==null||n()},onOfflineReady(){u.value=!0,r==null||r()},onRegistered:i,onRegisterError:o}),offlineReady:u,needRefresh:c}}const Bt=console.error;console.error=function(...e){Bt(...e)};window.onerror=function(e,t,n,r,i){return K.errors.push(i instanceof Error?i:new Error(JSON.stringify(i))),Bt(i),!0};window.onunhandledrejection=function(e){K.errors.push(e.reason instanceof Error?e.reason:new Error(JSON.stringify(e.reason))),Bt(e.reason)};document.title=R.title;window.projInfo=R;R.id===""&&console.error("Project ID is empty!","Please select a unique ID for this project in /src/data/projInfo.json");requestAnimationFrame(async()=>{console.log(`%cMade in Profectus%c -Learn more at www.moddingtree.com`,"font-weight: bold; font-size: 24px; color: #A3BE8C; background: #2E3440; padding: 4px 8px; border-radius: 8px;","padding: 4px;"),await Nn();const{globalBus:e}=await dt(()=>Promise.resolve().then(function(){return pi}),void 0),{startGameLoop:t}=await dt(()=>import("./gameLoop.27ced67a.js"),["assets/gameLoop.27ced67a.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"),Fe(()=>{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}; +${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({__name:"Nav",setup(e){const t=M(null),n=M(null),r=M(null),i=M(null),o=M(null);Q.on("openMultiplayer",()=>{var k;return(k=o.value)==null?void 0:k.open()});const{useHeader:c,banner:u,title:d,discordName:v,discordLink:_,versionNumber:p}=R;function C(){window.open(_,"mywindow")}return(k,b)=>(h(),w(U,null,[s(c)?(h(),w("div",Re({key:0,class:"nav"},k.$attrs),[s(u)?(h(),w("img",{key:0,src:s(u),class:"banner",alt:s(d)},null,8,Cl)):(h(),w("div",Sl,P(s(d)),1)),f("div",{onClick:b[0]||(b[0]=S=>{var $;return($=i.value)==null?void 0:$.open()}),class:"version-container"},[y(W,{display:"Changelog",direction:s(G).Down,class:"version"},{default:T(()=>[f("span",null,"v"+P(s(p)),1)]),_:1},8,["direction"])]),Il,f("div",$l,[f("span",{onClick:C,class:"material-icons"},"discord"),f("ul",kl,[s(_)?(h(),w("li",Ml,[f("a",{href:s(_),target:"_blank"},P(s(v)),9,xl)])):F("",!0),Fl,Tl])]),f("div",null,[f("a",Pl,[y(W,{display:"Forums",direction:s(G).Down,yoffset:"5px"},{default:T(()=>[El]),_:1},8,["direction"])])]),f("div",{onClick:b[1]||(b[1]=S=>{var $;return($=t.value)==null?void 0:$.open()})},[y(W,{display:"Info",direction:s(G).Down,class:"info"},{default:T(()=>[Vl]),_:1},8,["direction"])]),f("div",{onClick:b[2]||(b[2]=S=>{var $;return($=n.value)==null?void 0:$.open()})},[y(W,{display:"Saves",direction:s(G).Down,xoffset:"-20px"},{default:T(()=>[Ol]),_:1},8,["direction"])]),f("div",{onClick:b[3]||(b[3]=S=>{var $;return($=o.value)==null?void 0:$.open()})},[y(W,{display:"Multiplayer",direction:s(G).Down,xoffset:"-20px"},{default:T(()=>[Ll]),_:1},8,["direction"])]),f("div",{onClick:b[4]||(b[4]=S=>{var $;return($=r.value)==null?void 0:$.open()})},[y(W,{display:"Settings",direction:s(G).Down,xoffset:"-66px"},{default:T(()=>[Dl]),_:1},8,["direction"])])],16)):(h(),w("div",Re({key:1,class:"overlay-nav"},k.$attrs),[f("div",{onClick:b[5]||(b[5]=S=>{var $;return($=i.value)==null?void 0:$.open()}),class:"version-container"},[y(W,{display:"Changelog",direction:s(G).Right,xoffset:"25%",class:"version"},{default:T(()=>[f("span",null,"v"+P(s(p)),1)]),_:1},8,["direction"])]),f("div",{onClick:b[6]||(b[6]=S=>{var $;return($=n.value)==null?void 0:$.open()})},[y(W,{display:"Saves",direction:s(G).Right},{default:T(()=>[ql]),_:1},8,["direction"])]),f("div",{onClick:b[7]||(b[7]=S=>{var $;return($=o.value)==null?void 0:$.open()})},[y(W,{display:"Multiplayer",direction:s(G).Right},{default:T(()=>[Rl]),_:1},8,["direction"])]),f("div",{onClick:b[8]||(b[8]=S=>{var $;return($=r.value)==null?void 0:$.open()})},[y(W,{display:"Settings",direction:s(G).Right},{default:T(()=>[Bl]),_:1},8,["direction"])]),f("div",{onClick:b[9]||(b[9]=S=>{var $;return($=t.value)==null?void 0:$.open()})},[y(W,{display:"Info",direction:s(G).Right},{default:T(()=>[Al]),_:1},8,["direction"])]),f("div",null,[f("a",Ul,[y(W,{display:"Forums",direction:s(G).Right,xoffset:"7px"},{default:T(()=>[zl]),_:1},8,["direction"])])]),f("div",jl,[f("span",{onClick:C,class:"material-icons"},"discord"),f("ul",Gl,[s(_)?(h(),w("li",Hl,[f("a",{href:s(_),target:"_blank"},P(s(v)),9,Wl)])):F("",!0),Jl,Zl])])],16)),y(Rs,{ref_key:"info",ref:t,changelog:i.value},null,8,["changelog"]),y(kn,{ref_key:"savesManager",ref:n},null,512),y(zs,{ref_key:"options",ref:r},null,512),y(ko,{ref_key:"changelog",ref:i},null,512),y(Cs,{ref_key:"roomsDialog",ref:o},null,512)],64))}});var Mn=H(Kl,[["__scopeId","data-v-1fa4f177"]]);const Yl={class:"inner-tab"},Xl=B({__name:"Game",setup(e){const t=Pe(O,"tabs"),n=D(()=>Object.keys(re)),r=R.useHeader;function i(o){const{display:c,minimized:u,name:d,color:v,minimizable:_,nodes:p,minimizedDisplay:C}=o;return{display:c,minimized:u,name:d,color:v,minimizable:_,nodes:p,minimizedDisplay:C}}return(o,c)=>(h(),w("div",{class:te(["tabs-container",{useHeader:s(r)}])},[(h(!0),w(U,null,he(s(t),(u,d)=>{var v,_;return h(),w("div",{key:d,class:te(["tab",s((v=s(re)[u])==null?void 0:v.classes)]),style:ve(s((_=s(re)[u])==null?void 0:_.style))},[d===0&&!s(r)?(h(),q(Mn,{key:0})):F("",!0),f("div",Yl,[s(n).includes(u)?(h(),q(Co,Re({key:0},i(s(re)[u]),{index:d,onSetMinimized:p=>s(re)[u].minimized.value=p}),null,16,["index","onSetMinimized"])):(h(),q(se(u),{key:1,index:d},null,8,["index"]))])],6)}),128))],2))}});var Ql=H(Xl,[["__scopeId","data-v-dcd207b4"]]);const Rt=e=>(fe("data-v-2a68614e"),e=e(),me(),e),eu=Rt(()=>f("span",null,"Chat",-1)),tu={key:0,style:{"margin-left":"10px"}},nu={key:0,class:"chat-user"},ru=Rt(()=>f("hr",{style:{"margin-top":"0"}},null,-1)),iu={class:"chat-submit"},au=Rt(()=>f("span",{class:"material-icons"},"check",-1)),ou=[au],su=B({__name:"Chat",setup(e){const t=M(!1),n=M(0),r=M(""),i=Be([]),o=M(null);function c(){ze("chat",r.value),r.value=""}Q.on("chat",(d,v)=>{i.push({user:d,message:v});const _=o.value&&o.value.scrollTop>=o.value.scrollHeight-o.value.clientHeight;_&&Te(()=>{o.value&&(o.value.scrollTop=o.value.scrollHeight-o.value.clientHeight)}),(!_||!t.value)&&d&&n.value++});function u(){Te(()=>{o.value&&n.value>0&&o.value.scrollTop>=o.value.scrollHeight-o.value.clientHeight&&(n.value=0)})}return oe(t,d=>{d&&(n.value=0)}),(d,v)=>bt((h(),w("div",{class:te(["chat",{open:t.value}])},[f("div",{class:"chat-toggle",onClick:v[0]||(v[0]=_=>t.value=!t.value)},[eu,n.value?(h(),w("span",tu,"["+P(n.value>9?"9+":n.value)+"]",1)):F("",!0)]),f("div",{class:"chat-messages",ref_key:"scroll",ref:o,onScrollPassive:u},[(h(!0),w(U,null,he(i,(_,p)=>(h(),w("div",{key:p,class:"chat-message-container"},[_.user?(h(),w("span",nu,P(s(Lt)[_.user]),1)):F("",!0),f("span",{class:"chat-message",style:ve(_.user?"":"font-style: italic")},P(_.message),5)]))),128))],544),ru,f("div",iu,[y(Me,{modelValue:r.value,"onUpdate:modelValue":v[1]||(v[1]=_=>r.value=_),onSubmit:c,submitOnBlur:!1},null,8,["modelValue"]),f("button",{onPointerdown:c,class:"button"},ou,32)])],2)),[[Kt,s(ae)]])}});var lu=H(su,[["__scopeId","data-v-2a68614e"]]);const xn=e=>(fe("data-v-0c47dfae"),e=e(),me(),e),uu={class:"grid"},cu=["onClick","onMouseover"],du=xn(()=>f("div",{class:"hexagon"},null,-1)),fu=xn(()=>f("div",{class:"hexagon"},null,-1)),mu=[fu],gu=B({__name:"HexGrid",props:{gridData:null,selectedColor:null},emits:["updateColor"],setup(e,{emit:t}){const n=e,{selectedColor:r}=de(n),i=M(null);function o(d,v){t("updateColor",d,v,r.value)}function c(d,v){i.value={row:d,col:v}}function u(){i.value=null}return(d,v)=>(h(),w("div",uu,[(h(!0),w(U,null,he(e.gridData,(_,p)=>(h(),w("div",{key:p,class:"row"},[(h(!0),w(U,null,he(_,(C,k)=>(h(),w("div",{key:`${p}-${k}-${C}`,class:te({"hexagon-wrapper":!0,[C]:!0}),onClick:b=>o(p,k),onMouseover:b=>c(p,k),onMouseout:u},[du,y(xt,{name:"fade"},{default:T(()=>{var b,S;return[((b=i.value)==null?void 0:b.row)===p&&((S=i.value)==null?void 0:S.col)===k&&C!==s(r)?(h(),w("div",{key:0,class:te({"hexagon-overlay":!0,[s(r)]:!0})},mu,2)):F("",!0)]}),_:2},1024)],42,cu))),128))]))),128))]))}});var hu=H(gu,[["__scopeId","data-v-0c47dfae"]]);const Ie={gray:"gray",red:"red",green:"green",blue:"blue"},Fn=vn("main",function(){const e=Ot([[Ie.gray,Ie.gray],[Ie.red,Ie.green,Ie.blue],[Ie.gray,Ie.gray]]);return{name:"Main",minimizable:!1,classes:{main:!0},grid:e,display:ne(()=>y(U,null,[y(hu,{gridData:e.value,selectedColor:Ie.red},null),y(lu,null,null)]))}}),vu=e=>[Fn],Tn=D(()=>!1);function pu(e,t){}var bu=Object.freeze(Object.defineProperty({__proto__:null,main:Fn,getInitialLayers:vu,hasWon:Tn,fixOldSave:pu},Symbol.toStringTag,{value:"Module"}));const at=e=>(fe("data-v-4a50ce42"),e=e(),me(),e),_u={class:"game-over-modal-header"},yu=["src","alt"],wu={class:"game-over-modal-title"},Nu=at(()=>f("h2",null,"Congratulations!",-1)),Cu={key:0},Su=at(()=>f("br",null,null,-1)),Iu=at(()=>f("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),$u=at(()=>f("br",null,null,-1)),ku=["href"],Mu=at(()=>f("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),xu=B({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:r,discordLink:i,versionNumber:o,versionTitle:c}=R,u=D(()=>Pt(O.timePlayed)),d=D(()=>Tn.value&&!O.keepGoing),v=Pe(O,"autosave");function _(){O.keepGoing=!0}function p(){ke(qe())}return(C,k)=>(h(),q(Ee,{"model-value":s(d)},{header:T(()=>[f("div",_u,[s(n)?(h(),w("img",{key:0,class:"game-over-modal-logo",src:s(n),alt:s(t)},null,8,yu)):F("",!0),f("div",wu,[Nu,f("h4",null,"You've beaten "+P(s(t))+" v"+P(s(o))+": "+P(s(c)),1)])])]),body:T(({shown:b})=>[b?(h(),w("div",Cu,[f("div",null,"It took you "+P(s(u))+" to beat the game.",1),Su,Iu,$u,f("div",null,[f("a",{href:s(i),class:"game-over-modal-discord-link"},[Mu,V(" "+P(s(r)),1)],8,ku)]),y(We,{title:"Autosave",modelValue:s(v),"onUpdate:modelValue":k[0]||(k[0]=S=>pe(v)?v.value=S:null)},null,8,["modelValue"])])):F("",!0)]),footer:T(()=>[f("div",{class:"game-over-footer"},[f("button",{onClick:_,class:"button"},"Keep Going"),f("button",{onClick:p,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var Fu=H(xu,[["__scopeId","data-v-4a50ce42"]]);const Ct=e=>(fe("data-v-d3bb0716"),e=e(),me(),e),Tu=Ct(()=>f("div",{class:"nan-modal-header"},[f("h2",null,"NaN value detected!")],-1)),Pu={key:0},Eu=Ct(()=>f("br",null,null,-1)),Vu=["href"],Ou=Ct(()=>f("span",{class:"material-icons nan-modal-discord"},"discord",-1)),Lu=Ct(()=>f("br",null,null,-1)),Du={class:"nan-footer"},qu=B({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=R,r=M(!0),i=M(!0),o=Pe(K,"hasNaN"),c=M(null);oe(o,C=>{C?(r.value=O.autosave,i.value=O.devSpeed===0):(O.autosave=r.value,O.devSpeed=i.value?0:null)});const u=D(()=>{var C;return(C=K.NaNPath)==null?void 0:C.join(".")}),d=D(()=>K.NaNPersistent!=null?K.NaNPersistent.value:null);function v(){K.NaNPersistent!=null&&(K.NaNPersistent.value=new l(0),K.hasNaN=!1)}function _(){K.NaNPersistent&&(K.NaNPersistent.value=new l(1),K.hasNaN=!1)}function p(){K.NaNPersistent&&(K.NaNPersistent.value=new l(NaN),K.hasNaN=!1)}return(C,k)=>(h(),w(U,null,[y(Ee,Re({modelValue:s(o),"onUpdate:modelValue":k[4]||(k[4]=b=>pe(o)?o.value=b:null)},C.$attrs),{header:T(()=>[Tu]),body:T(()=>[f("div",null,[V(' Attempted to assign "'+P(s(u))+'" to NaN',1),s(d)?(h(),w("span",Pu,P(" ")+"(previously "+P(s(ln)(s(d)))+")",1)):F("",!0),V(". Auto-saving has been "+P(r.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),Eu,f("div",null,[f("a",{href:s(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[Ou,V(" "+P(s(t)||"Profectus & Friends"),1)],8,Vu)]),Lu,y(We,{title:"Autosave",modelValue:r.value,"onUpdate:modelValue":k[0]||(k[0]=b=>r.value=b)},null,8,["modelValue"]),s(R).enablePausing?(h(),q(We,{key:0,title:"Pause game",modelValue:i.value,"onUpdate:modelValue":k[1]||(k[1]=b=>i.value=b)},null,8,["modelValue"])):F("",!0)]),footer:T(()=>[f("div",Du,[f("button",{onClick:k[2]||(k[2]=b=>{var S;return(S=c.value)==null?void 0:S.open()}),class:"button"},"Open Saves Manager"),f("button",{onClick:v,class:"button"},"Set to 0"),f("button",{onClick:_,class:"button"},"Set to 1"),s(d)&&s(l).neq(s(d),0)&&s(l).neq(s(d),1)?(h(),w("button",{key:0,onClick:k[3]||(k[3]=b=>o.value=!1),class:"button"}," Set to previous ")):F("",!0),f("button",{onClick:p,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),y(kn,{ref_key:"savesManager",ref:c},null,512)],64))}});var Ru=H(qu,[["__scopeId","data-v-d3bb0716"]]);const Bu={key:0,class:"tpsDisplay"},Au=B({__name:"TPS",setup(e){const t=D(()=>l.div(K.lastTenTicks.length,K.lastTenTicks.reduce((n,r)=>n+r,0)));return(n,r)=>s(t).isNan()?F("",!0):(h(),w("div",Bu,"TPS: "+P(s(un)(s(t))),1))}});var Uu=H(Au,[["__scopeId","data-v-89b89152"]]);var zu=B({__name:"App",setup(e){const t=R.useHeader,n=D(()=>yt[z.theme].variables),r=Pe(z,"showTPS"),i=Pe(K,"errors"),o=D(()=>ye(ne(()=>y(U,null,[bo.map(wt)]))));return(c,u)=>s(i).length>0?(h(),w("div",{key:0,class:"error-container",style:ve(s(n))},[y(en,{errors:s(i)},null,8,["errors"])],4)):(h(),w(U,{key:1},[f("div",{id:"modal-root",style:ve(s(n))},null,4),f("div",{class:te(["app",{useHeader:s(t)}]),style:ve(s(n))},[s(t)?(h(),q(Mn,{key:0})):F("",!0),y(Ql),s(s(r))?(h(),q(Uu,{key:1})):F("",!0),y(Fu),y(Ru),(h(),q(se(s(o))))],6)],64))}});var ju=H(zu,[["__scopeId","data-v-bf4e22ac"]]);function Gu(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisterError:o}=e;let c,u;const d=async(v=!0)=>{v&&(c==null||c.addEventListener("controlling",_=>{_.isUpdate&&window.location.reload()})),u&&u.waiting&&await Zn(u.waiting,{type:"SKIP_WAITING"})};if("serviceWorker"in navigator){c=new Jn("./sw.js",{scope:"./",type:"classic"}),c.addEventListener("activated",v=>{v.isUpdate||r==null||r()});{const v=()=>{n==null||n()};c.addEventListener("waiting",v),c.addEventListener("externalwaiting",v)}c.register({immediate:t}).then(v=>{u=v,i==null||i(v)}).catch(v=>{o==null||o(v)})}return d}function Hu(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisterError:o}=e,c=M(!1),u=M(!1);return{updateServiceWorker:Gu({immediate:t,onNeedRefresh(){c.value=!0,n==null||n()},onOfflineReady(){u.value=!0,r==null||r()},onRegistered:i,onRegisterError:o}),offlineReady:u,needRefresh:c}}const Bt=console.error;console.error=function(...e){Bt(...e)};window.onerror=function(e,t,n,r,i){return K.errors.push(i instanceof Error?i:new Error(JSON.stringify(i))),Bt(i),!0};window.onunhandledrejection=function(e){K.errors.push(e.reason instanceof Error?e.reason:new Error(JSON.stringify(e.reason))),Bt(e.reason)};document.title=R.title;window.projInfo=R;R.id===""&&console.error("Project ID is empty!","Please select a unique ID for this project in /src/data/projInfo.json");requestAnimationFrame(async()=>{console.log(`%cMade in Profectus%c +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}; diff --git a/index.html b/index.html index 63bff51..e8a4168 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ Profectus - + diff --git a/sw.js b/sw.js index f09d2e6..0655abb 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()})).then((()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e})));self.define=(n,l)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const u=e=>i(e,r),a={module:{uri:r},exports:o,require:u};s[r]=Promise.all(n.map((e=>a[e]||u(e)))).then((e=>(l(...e),o)))}}define(["./workbox-958fa2bd"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"assets/@fontsource.f66d05e7.css",revision:null},{url:"assets/@socket.io.aec831e2.js",revision:null},{url:"assets/@vue.8948d9b0.js",revision:null},{url:"assets/engine.io-client.6ba5801d.js",revision:null},{url:"assets/engine.io-parser.730afdce.js",revision:null},{url:"assets/gameLoop.27ced67a.js",revision:null},{url:"assets/index.2e66f9e5.css",revision:null},{url:"assets/index.37cfdf05.js",revision:null},{url:"assets/lru-cache.9506e0ec.js",revision:null},{url:"assets/lz-string.f2f3b7cf.js",revision:null},{url:"assets/nanoevents.1080beb7.js",revision:null},{url:"assets/semver.334eb41f.js",revision:null},{url:"assets/socket.io-client.03bb8f3a.js",revision:null},{url:"assets/socket.io-parser.0ab387d5.js",revision:null},{url:"assets/sortablejs.692999e9.js",revision:null},{url:"assets/unique-names-generator.9178d3e3.js",revision:null},{url:"assets/vue-next-select.9e6f4164.css",revision:null},{url:"assets/vue-next-select.f2be13cc.js",revision:null},{url:"assets/vue-textarea-autosize.35804eaf.js",revision:null},{url:"assets/vue-toastification.4b5f8ac8.css",revision:null},{url:"assets/vue-toastification.97914fdb.js",revision:null},{url:"assets/vue.228877f7.js",revision:null},{url:"assets/vuedraggable.5218041c.js",revision:null},{url:"assets/workbox-window.8d14e8b7.js",revision:null},{url:"assets/yallist.fd762fe7.js",revision:null},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"favicon.svg",revision:"c8dd2748f1fedd25449164d7dda6aecb"},{url:"index.html",revision:"d5c54a511caff32d761f921b145b5f88"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"robots.txt",revision:"5e0bd1c281a62a380d7a948085bfe2d1"},{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"manifest.webmanifest",revision:"852433ea6749ac07c966385bbc65fdcc"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))})); +if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()})).then((()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e})));self.define=(n,l)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const u=e=>i(e,r),a={module:{uri:r},exports:o,require:u};s[r]=Promise.all(n.map((e=>a[e]||u(e)))).then((e=>(l(...e),o)))}}define(["./workbox-958fa2bd"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"assets/@fontsource.f66d05e7.css",revision:null},{url:"assets/@socket.io.aec831e2.js",revision:null},{url:"assets/@vue.8948d9b0.js",revision:null},{url:"assets/engine.io-client.6ba5801d.js",revision:null},{url:"assets/engine.io-parser.730afdce.js",revision:null},{url:"assets/gameLoop.4adf0349.js",revision:null},{url:"assets/index.2e66f9e5.css",revision:null},{url:"assets/index.609ecad2.js",revision:null},{url:"assets/lru-cache.9506e0ec.js",revision:null},{url:"assets/lz-string.f2f3b7cf.js",revision:null},{url:"assets/nanoevents.1080beb7.js",revision:null},{url:"assets/semver.334eb41f.js",revision:null},{url:"assets/socket.io-client.03bb8f3a.js",revision:null},{url:"assets/socket.io-parser.0ab387d5.js",revision:null},{url:"assets/sortablejs.692999e9.js",revision:null},{url:"assets/unique-names-generator.9178d3e3.js",revision:null},{url:"assets/vue-next-select.9e6f4164.css",revision:null},{url:"assets/vue-next-select.f2be13cc.js",revision:null},{url:"assets/vue-textarea-autosize.35804eaf.js",revision:null},{url:"assets/vue-toastification.4b5f8ac8.css",revision:null},{url:"assets/vue-toastification.97914fdb.js",revision:null},{url:"assets/vue.228877f7.js",revision:null},{url:"assets/vuedraggable.5218041c.js",revision:null},{url:"assets/workbox-window.8d14e8b7.js",revision:null},{url:"assets/yallist.fd762fe7.js",revision:null},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"favicon.svg",revision:"c8dd2748f1fedd25449164d7dda6aecb"},{url:"index.html",revision:"7b4dd2df58cdb6fa3652996e31f8b540"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"robots.txt",revision:"5e0bd1c281a62a380d7a948085bfe2d1"},{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"manifest.webmanifest",revision:"852433ea6749ac07c966385bbc65fdcc"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));