Profectus/assets/index-DxM-pCoC.js

18 lines
139 KiB
JavaScript

var kn=Object.defineProperty;var Cn=(n,e,t)=>e in n?kn(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var $=(n,e,t)=>Cn(n,typeof e!="symbol"?e+"":e,t);/* empty css */import"./vue-GVBARt8q.js";import{aX as He,bo as d,X as z,aZ as F,aR as b,A as C,b0 as xe,bS as Xe,aA as K,az as Be,w as L,aJ as it,G as g,bf as O,F as j,a$ as Se,z as E,aC as fe,P as V,Q as v,bN as _,b9 as bt,aT as at,y as J,bP as Tt,bF as Sn,ay as ke,l as Ht,T as In,ap as xn,ar as se,am as ct,bb as rt,bI as ae,bj as Oe,aO as Wt,bl as jt,aB as Mn,bJ as Jt,au as Tn,bi as Ot,bE as $n,bA as Pn,aI as En,bk as Lt,b3 as Fn,x as Vn}from"./@vue-CCfogNd1.js";import{L as $e}from"./lz-string-BZNGtwso.js";import{c as Zt}from"./nanoevents-BxCKNB1V.js";import{i as _n}from"./unofficial-galaxy-sdk-C_siawBx.js";import{D as On}from"./vuedraggable-BgvaSe-I.js";import{Y as Ln}from"./vue-next-select-CgtHQcl0.js";import{p as Dn}from"./vue-textarea-autosize-DLc4kbjP.js";import{s as An,u as Rn}from"./vue-toastification-CjoTmBGg.js";import"./sortablejs-BZuNQ3iR.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const u of s.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();const qn="./projInfo-schema.json",Un="Profectus",Bn="A project made in Profectus",zn="",Gn="",Hn="",Wn="",jn="0.0",Jn="Initial Commit",Zn=!0,Yn=!1,Kn=2,Xn=!0,Qn=null,ei="",ti=["main"],ni=3600,ii=1,ri=!0,si="base64",ai=!1,B={$schema:qn,title:Un,description:Bn,id:zn,author:Gn,discordName:Hn,discordLink:Wn,versionNumber:jn,versionTitle:Jn,allowGoBack:Zn,defaultShowSmall:Yn,defaultDecimalsShown:Kn,useHeader:Xn,banner:Qn,logo:ei,initialTabs:ti,maxTickLength:ni,offlineLimit:ii,enablePausing:ri,exportEncoding:si,disableHealthWarning:ai},oi=He({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}}),x=window.player=oi;function ze(n){return JSON.stringify(n,(e,t)=>d(t)??null)}const li=z({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(n,{emit:e}){const t=e,i=F(!1),r=F(null);function s(){t("click"),r.value!=null&&clearTimeout(r.value),i.value=!1,Be(()=>{i.value=!0,r.value=setTimeout(()=>i.value=!1,500)})}return(u,a)=>(b(),C("button",{onClick:Xe(s,["stop"]),class:K(["feedback",{activated:i.value,left:u.left}])},[xe(u.$slots,"default",{},void 0,!0)],2))}}),Z=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},$t=Z(li,[["__scopeId","data-v-f82eae5d"]]),ui={class:"error"},ci={class:"error-title"},di={class:"error-details",style:{"margin-top":"-10px"}},fi={key:0},mi={class:"instructions"},gi=["href"],pi={key:0,style:{"margin-top":"20px"}},hi={class:"error-details"},vi={key:0,style:{"margin-top":"10px"}},bi={key:1,style:{"margin-top":"10px"}},yi=z({__name:"Error",props:{errors:{}},setup(n){const e=n,t=L(()=>e.errors[0]),i=L(()=>e.errors.map(u=>u.stack==null?[]:u.stack.split(`
`))),r=L(()=>e.errors.map(u=>u.cause==null?[]:(typeof u.cause=="string"?u.cause:JSON.stringify(u.cause)).split(`
`)));function s(){let u=ze(x);switch(B.exportEncoding){default:console.warn(`Unknown save encoding: ${B.exportEncoding}. Defaulting to lz`);case"lz":u=$e.compressToUTF16(u);break;case"base64":u=btoa(unescape(encodeURIComponent(u)));break;case"plain":break}console.log(u);const a=document.createElement("textarea");a.value=u,document.body.appendChild(a),a.select(),a.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(a)}return it(()=>{x.autosave=!1,x.devSpeed=0}),(u,a)=>(b(),C("div",ui,[g("h1",ci,O(t.value.name)+": "+O(t.value.message),1),g("div",di,[t.value.cause?(b(),C("div",fi,[(b(!0),C(j,null,Se(r.value[0],o=>(b(),C("div",{key:o},O(o),1))),128))])):E("",!0),t.value.stack?(b(),C("div",{key:1,style:fe(t.value.cause?"margin-top: 10px":"")},[(b(!0),C(j,null,Se(i.value[0],o=>(b(),C("div",{key:o},O(o),1))),128))],4)):E("",!0)]),g("div",mi,[a[2]||(a[2]=V(" Check the console for more details, and consider sharing it with the developers on ")),g("a",{href:d(B).discordLink||"https://discord.gg/yJ4fjnjU54",class:"discord-link"},"discord",8,gi),a[3]||(a[3]=V("! ")),v($t,{onClick:s,class:"button",style:{display:"inline-flex"}},{default:_(()=>a[0]||(a[0]=[g("span",{class:"material-icons",style:{"font-size":"16px"}},"content_paste",-1),g("span",{style:{"margin-left":"8px","font-size":"medium"}},"Copy Save",-1)])),_:1}),a[4]||(a[4]=g("br",null,null,-1)),u.errors.length>1?(b(),C("div",pi,a[1]||(a[1]=[g("h3",null,"Other errors",-1)]))):E("",!0),(b(!0),C(j,null,Se(u.errors.slice(1),(o,f)=>(b(),C("div",{key:f,style:{"margin-top":"20px"}},[g("details",hi,[g("summary",null,O(o.name)+": "+O(o.message),1),o.cause?(b(),C("div",vi,[(b(!0),C(j,null,Se(r.value[f+1],y=>(b(),C("div",{key:y},O(y),1))),128))])):E("",!0),o.stack?(b(),C("div",bi,[(b(!0),C(j,null,Se(i.value[f+1],y=>(b(),C("div",{key:y},O(y),1))),128))])):E("",!0)])]))),128))])]))}}),Yt=Z(yi,[["__scopeId","data-v-2524e23e"]]),Fe={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 Pt=(n=>(n.Classic="classic",n.Paper="paper",n.Nordic="nordic",n.Aqua="aqua",n))(Pt||{});const Et={classic:Fe,paper:{...Fe,variables:{...Fe.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:{...Fe,variables:{...Fe.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:{...Fe,variables:{...Fe.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}},G=window.state=bt({lastTenTicks:[],mouseActivity:[!1],hasNaN:!1,NaNPath:[],errors:He([])}),ne=Zt();"fonts"in document&&(document.fonts.onloadingdone=()=>ne.emit("fontsLoaded"));document.onmousemove=function(){G.mouseActivity[G.mouseActivity.length-1]=!0};const wi=z({__name:"Context",emits:["updateNodes"],setup(n,{emit:e}){var N;const t=e,i=F({}),r=new ResizeObserver(o),s=F(null);it(()=>{const w=s.value;w!=null&&r.observe(w)});let u=!0,a=F((N=s.value)==null?void 0:N.getBoundingClientRect());function o(){u&&(u=!1,Be(()=>{var w;a.value=(w=s.value)==null?void 0:w.getBoundingClientRect(),Object.values(i.value).filter(p=>p).forEach(p=>p.rect=p.element.getBoundingClientRect()),t("updateNodes",i.value),u=!0}))}ne.on("fontsLoaded",o);const f={attributes:!1,childList:!0,subtree:!1};at(on,(w,p)=>{const k=new MutationObserver(()=>y(w));k.observe(p,f),i.value[w]={element:p,observer:k,rect:p.getBoundingClientRect()},o()}),at(ln,w=>{var p;(p=i.value[w])==null||p.observer.disconnect(),i.value[w]=void 0,o()}),at(un,i),at(cn,a);function y(w){const p=i.value[w];p!=null&&(p.rect=p.element.getBoundingClientRect(),t("updateNodes",i.value))}return(w,p)=>(b(),C(j,null,[xe(w.$slots,"default",{},void 0,!0),g("div",{ref_key:"resizeListener",ref:s,class:"resize-listener"},null,512)],64))}}),Kt=Z(wi,[["__scopeId","data-v-4fc505f1"]]),Ni={class:"modal-wrapper"},ki=["width"],Ci={class:"modal-header"},Si={class:"modal-body"},Ii={class:"modal-footer"},Pe=z({__name:"Modal",props:{modelValue:{type:Boolean},preventClosing:{type:Boolean},width:{}},emits:["update:modelValue"],setup(n,{expose:e,emit:t}){const i=n,r=t,s=L(()=>i.modelValue||a.value);function u(){i.preventClosing!==!0&&r("update:modelValue",!1)}const a=F(!1),o=F(null),f=L(()=>{var y;return((y=o.value)==null?void 0:y.nodes)??null});return e({isOpen:s,nodes:f}),(y,N)=>(b(),J(In,{to:"#modal-root"},[v(Ht,{name:"modal",onBeforeEnter:N[0]||(N[0]=w=>a.value=!0),onAfterLeave:N[1]||(N[1]=w=>a.value=!1),appear:""},{default:_(()=>[Tt(g("div",ke({class:"modal-mask",onPointerdown:Xe(u,["self"])},y.$attrs),[g("div",Ni,[g("div",{class:"modal-container",width:y.width},[g("div",Ci,[xe(y.$slots,"header",{shown:s.value})]),g("div",Si,[v(Kt,{ref_key:"contextRef",ref:o},{default:_(()=>[xe(y.$slots,"body",{shown:s.value})]),_:3},512)]),g("div",Ii,[xe(y.$slots,"footer",{shown:s.value},()=>[g("div",{class:"modal-default-footer"},[N[2]||(N[2]=g("div",{class:"modal-default-flex-grow"},null,-1)),g("button",{class:"button modal-default-button",onClick:u}," Close ")])])])],8,ki)])],16),[[Sn,y.modelValue]])]),_:3})]))}});class xi{constructor(e){$(this,"map",new Map);$(this,"first");$(this,"last");$(this,"maxSize");this.maxSize=e}get size(){return this.map.size}get(e){const t=this.map.get(e);if(t!==void 0)return t!==this.first&&(t===this.last?(this.last=t.prev,this.last.next=void 0):(t.prev.next=t.next,t.next.prev=t.prev),t.next=this.first,this.first.prev=t,this.first=t),t.value}set(e,t){if(this.maxSize<1)return;if(this.map.has(e))throw new Error("Cannot update existing keys in the cache");const i=new Mi(e,t);for(this.first===void 0?(this.first=i,this.last=i):(i.next=this.first,this.first.prev=i,this.first=i),this.map.set(e,i);this.map.size>this.maxSize;){const r=this.last;this.map.delete(r.key),this.last=r.prev,this.last.next=void 0}}}class Mi{constructor(e,t){$(this,"key");$(this,"value");$(this,"next");$(this,"prev");this.key=e,this.value=t}}const St=17,Ti=9e15,$i=Math.log10(9e15),Pi=1/9e15,Ei=308,Fi=-324,Dt=5,Vi=1023,_i=function(){const n=[];for(let t=Fi+1;t<=Ei;t++)n.push(+("1e"+t));const e=323;return function(t){return n[t+e]}}(),Ve=[2,Math.E,3,4,5,6,7,8,9,10],Oi=[[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]],Li=[[-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 h=function(e){return c.fromValue_noAlloc(e)},A=function(n,e,t){return c.fromComponents(n,e,t)},U=function(e,t,i){return c.fromComponents_noNormalize(e,t,i)};const Ce=function(e,t){const i=t+1,r=Math.ceil(Math.log10(Math.abs(e))),s=Math.round(e*Math.pow(10,i-r))*Math.pow(10,r-i);return parseFloat(s.toFixed(Math.max(i-r,0)))},It=function(n){return Math.sign(n)*Math.log10(Math.abs(n))},Di=function(n){if(!isFinite(n))return n;if(n<-50)return n===Math.trunc(n)?Number.NEGATIVE_INFINITY:0;let e=1;for(;n<10;)e=e*n,++n;n-=1;let t=.9189385332046727;t=t+(n+.5)*Math.log(n),t=t-n;const i=n*n;let r=n;return t=t+1/(12*r),r=r*i,t=t+1/(360*r),r=r*i,t=t+1/(1260*r),r=r*i,t=t+1/(1680*r),r=r*i,t=t+1/(1188*r),r=r*i,t=t+691/(360360*r),r=r*i,t=t+7/(1092*r),r=r*i,t=t+3617/(122400*r),Math.exp(t)/e},Xt=.5671432904097838,At=function(n,e=1e-10){let t,i;if(!Number.isFinite(n)||n===0)return n;if(n===1)return Xt;n<10?t=0:t=Math.log(n)-Math.log(Math.log(n));for(let r=0;r<100;++r){if(i=(n*Math.exp(-t)+t*t)/(t+1),Math.abs(i-t)<e*Math.abs(i))return i;t=i}throw Error(`Iteration failed to converge: ${n.toString()}`)};function Rt(n,e=1e-10){let t,i,r,s;if(!Number.isFinite(n.mag)||n.eq(c.dZero))return n;if(n.eq(c.dOne))return c.fromNumber(Xt);t=c.ln(n);for(let u=0;u<100;++u){if(i=t.neg().exp(),r=t.sub(n.mul(i)),s=t.sub(r.div(t.add(1).sub(t.add(2).mul(r).div(c.mul(2,t).add(2))))),c.abs(s.sub(t)).lt(c.abs(s).mul(e)))return s;t=s}throw Error(`Iteration failed to converge: ${n.toString()}`)}const m=class m{constructor(e){$(this,"sign",0);$(this,"mag",0);$(this,"layer",0);e instanceof m?this.fromDecimal(e):typeof e=="number"?this.fromNumber(e):typeof e=="string"&&this.fromString(e)}get m(){if(this.sign===0)return 0;if(this.layer===0){const e=Math.floor(Math.log10(this.mag));let t;return this.mag===5e-324?t=5:t=this.mag/_i(e),this.sign*t}else if(this.layer===1){const e=this.mag-Math.floor(this.mag);return this.sign*Math.pow(10,e)}else return this.sign}set m(e){this.layer<=2?this.fromMantissaExponent(e,this.e):(this.sign=Math.sign(e),this.sign===0&&(this.layer=0,this.exponent=0))}get e(){return this.sign===0?0:this.layer===0?Math.floor(Math.log10(this.mag)):this.layer===1?Math.floor(this.mag):this.layer===2?Math.floor(Math.sign(this.mag)*Math.pow(10,Math.abs(this.mag))):this.mag*Number.POSITIVE_INFINITY}set e(e){this.fromMantissaExponent(this.m,e)}get s(){return this.sign}set s(e){e===0?(this.sign=0,this.layer=0,this.mag=0):this.sign=e}get mantissa(){return this.m}set mantissa(e){this.m=e}get exponent(){return this.e}set exponent(e){this.e=e}static fromComponents(e,t,i){return new m().fromComponents(e,t,i)}static fromComponents_noNormalize(e,t,i){return new m().fromComponents_noNormalize(e,t,i)}static fromMantissaExponent(e,t){return new m().fromMantissaExponent(e,t)}static fromMantissaExponent_noNormalize(e,t){return new m().fromMantissaExponent_noNormalize(e,t)}static fromDecimal(e){return new m().fromDecimal(e)}static fromNumber(e){return new m().fromNumber(e)}static fromString(e){return new m().fromString(e)}static fromValue(e){return new m().fromValue(e)}static fromValue_noAlloc(e){if(e instanceof m)return e;if(typeof e=="string"){const t=m.fromStringCache.get(e);return t!==void 0?t:m.fromString(e)}else return typeof e=="number"?m.fromNumber(e):m.dZero}static abs(e){return h(e).abs()}static neg(e){return h(e).neg()}static negate(e){return h(e).neg()}static negated(e){return h(e).neg()}static sign(e){return h(e).sign}static sgn(e){return h(e).sign}static round(e){return h(e).round()}static floor(e){return h(e).floor()}static ceil(e){return h(e).ceil()}static trunc(e){return h(e).trunc()}static add(e,t){return h(e).add(t)}static plus(e,t){return h(e).add(t)}static sub(e,t){return h(e).sub(t)}static subtract(e,t){return h(e).sub(t)}static minus(e,t){return h(e).sub(t)}static mul(e,t){return h(e).mul(t)}static multiply(e,t){return h(e).mul(t)}static times(e,t){return h(e).mul(t)}static div(e,t){return h(e).div(t)}static divide(e,t){return h(e).div(t)}static recip(e){return h(e).recip()}static reciprocal(e){return h(e).recip()}static reciprocate(e){return h(e).reciprocate()}static cmp(e,t){return h(e).cmp(t)}static cmpabs(e,t){return h(e).cmpabs(t)}static compare(e,t){return h(e).cmp(t)}static isNaN(e){return e=h(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag)}static isFinite(e){return e=h(e),isFinite(e.sign)&&isFinite(e.layer)&&isFinite(e.mag)}static eq(e,t){return h(e).eq(t)}static equals(e,t){return h(e).eq(t)}static neq(e,t){return h(e).neq(t)}static notEquals(e,t){return h(e).notEquals(t)}static lt(e,t){return h(e).lt(t)}static lte(e,t){return h(e).lte(t)}static gt(e,t){return h(e).gt(t)}static gte(e,t){return h(e).gte(t)}static max(e,t){return h(e).max(t)}static min(e,t){return h(e).min(t)}static minabs(e,t){return h(e).minabs(t)}static maxabs(e,t){return h(e).maxabs(t)}static clamp(e,t,i){return h(e).clamp(t,i)}static clampMin(e,t){return h(e).clampMin(t)}static clampMax(e,t){return h(e).clampMax(t)}static cmp_tolerance(e,t,i){return h(e).cmp_tolerance(t,i)}static compare_tolerance(e,t,i){return h(e).cmp_tolerance(t,i)}static eq_tolerance(e,t,i){return h(e).eq_tolerance(t,i)}static equals_tolerance(e,t,i){return h(e).eq_tolerance(t,i)}static neq_tolerance(e,t,i){return h(e).neq_tolerance(t,i)}static notEquals_tolerance(e,t,i){return h(e).notEquals_tolerance(t,i)}static lt_tolerance(e,t,i){return h(e).lt_tolerance(t,i)}static lte_tolerance(e,t,i){return h(e).lte_tolerance(t,i)}static gt_tolerance(e,t,i){return h(e).gt_tolerance(t,i)}static gte_tolerance(e,t,i){return h(e).gte_tolerance(t,i)}static pLog10(e){return h(e).pLog10()}static absLog10(e){return h(e).absLog10()}static log10(e){return h(e).log10()}static log(e,t){return h(e).log(t)}static log2(e){return h(e).log2()}static ln(e){return h(e).ln()}static logarithm(e,t){return h(e).logarithm(t)}static pow(e,t){return h(e).pow(t)}static pow10(e){return h(e).pow10()}static pow_base(e,t){return h(e).pow_base(t)}static root(e,t){return h(e).root(t)}static factorial(e,t){return h(e).factorial()}static gamma(e,t){return h(e).gamma()}static lngamma(e,t){return h(e).lngamma()}static exp(e){return h(e).exp()}static sqr(e){return h(e).sqr()}static sqrt(e){return h(e).sqrt()}static cube(e){return h(e).cube()}static cbrt(e){return h(e).cbrt()}static tetrate(e,t=2,i=U(1,0,1)){return h(e).tetrate(t,i)}static iteratedexp(e,t=2,i=U(1,0,1)){return h(e).iteratedexp(t,i)}static iteratedlog(e,t=10,i=1){return h(e).iteratedlog(t,i)}static layeradd10(e,t){return h(e).layeradd10(t)}static layeradd(e,t,i=10){return h(e).layeradd(t,i)}static slog(e,t=10){return h(e).slog(t)}static lambertw(e){return h(e).lambertw()}static ssqrt(e){return h(e).ssqrt()}static pentate(e,t=2,i=U(1,0,1)){return h(e).pentate(t,i)}static sin(e){return h(e).sin()}static cos(e){return h(e).cos()}static tan(e){return h(e).tan()}static asin(e){return h(e).asin()}static acos(e){return h(e).acos()}static atan(e){return h(e).atan()}static sinh(e){return h(e).sinh()}static cosh(e){return h(e).cosh()}static tanh(e){return h(e).tanh()}static asinh(e){return h(e).asinh()}static acosh(e){return h(e).acosh()}static atanh(e){return h(e).atanh()}static affordGeometricSeries(e,t,i,r){return this.affordGeometricSeries_core(h(e),h(t),h(i),r)}static sumGeometricSeries(e,t,i,r){return this.sumGeometricSeries_core(e,h(t),h(i),r)}static affordArithmeticSeries(e,t,i,r){return this.affordArithmeticSeries_core(h(e),h(t),h(i),h(r))}static sumArithmeticSeries(e,t,i,r){return this.sumArithmeticSeries_core(h(e),h(t),h(i),h(r))}static efficiencyOfPurchase(e,t,i){return this.efficiencyOfPurchase_core(h(e),h(t),h(i))}static randomDecimalForTesting(e){if(Math.random()*20<1)return U(0,0,0);const t=Math.random()>.5?1:-1;if(Math.random()*20<1)return U(t,0,1);const i=Math.floor(Math.random()*(e+1));let r=i===0?Math.random()*616-308:Math.random()*16;Math.random()>.9&&(r=Math.trunc(r));let s=Math.pow(10,r);return Math.random()>.9&&(s=Math.trunc(s)),A(t,i,s)}static affordGeometricSeries_core(e,t,i,r){const s=t.mul(i.pow(r));return m.floor(e.div(s).mul(i.sub(1)).add(1).log10().div(i.log10()))}static sumGeometricSeries_core(e,t,i,r){return t.mul(i.pow(r)).mul(m.sub(1,i.pow(e))).div(m.sub(1,i))}static affordArithmeticSeries_core(e,t,i,r){const u=t.add(r.mul(i)).sub(i.div(2)),a=u.pow(2);return u.neg().add(a.add(i.mul(e).mul(2)).sqrt()).div(i).floor()}static sumArithmeticSeries_core(e,t,i,r){const s=t.add(r.mul(i));return e.div(2).mul(s.mul(2).plus(e.sub(1).mul(i)))}static efficiencyOfPurchase_core(e,t,i){return e.div(t).add(e.div(i))}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<Pi)return this.layer+=1,this.mag=Math.log10(this.mag),this;let e=Math.abs(this.mag),t=Math.sign(this.mag);if(e>=Ti)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e<$i&&this.layer>0;)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,i){return this.sign=e,this.layer=t,this.mag=i,this.normalize(),this}fromComponents_noNormalize(e,t,i){return this.sign=e,this.layer=t,this.mag=i,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,i=m.fromStringCache.get(t);if(i!==void 0)return this.fromDecimal(i);e=e.replace(",","");const r=e.split("^^^");if(r.length===2){const S=parseFloat(r[0]),M=parseFloat(r[1]),T=r[1].split(";");let P=1;if(T.length===2&&(P=parseFloat(T[1]),isFinite(P)||(P=1)),isFinite(S)&&isFinite(M)){const q=m.pentate(S,M,P);return this.sign=q.sign,this.layer=q.layer,this.mag=q.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const s=e.split("^^");if(s.length===2){const S=parseFloat(s[0]),M=parseFloat(s[1]),T=s[1].split(";");let P=1;if(T.length===2&&(P=parseFloat(T[1]),isFinite(P)||(P=1)),isFinite(S)&&isFinite(M)){const q=m.tetrate(S,M,P);return this.sign=q.sign,this.layer=q.layer,this.mag=q.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const u=e.split("^");if(u.length===2){const S=parseFloat(u[0]),M=parseFloat(u[1]);if(isFinite(S)&&isFinite(M)){const T=m.pow(S,M);return this.sign=T.sign,this.layer=T.layer,this.mag=T.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}e=e.trim().toLowerCase();let a,o,f=e.split("pt");if(f.length===2){a=10,o=parseFloat(f[0]),f[1]=f[1].replace("(",""),f[1]=f[1].replace(")","");let S=parseFloat(f[1]);if(isFinite(S)||(S=1),isFinite(a)&&isFinite(o)){const M=m.tetrate(a,o,S);return this.sign=M.sign,this.layer=M.layer,this.mag=M.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}if(f=e.split("p"),f.length===2){a=10,o=parseFloat(f[0]),f[1]=f[1].replace("(",""),f[1]=f[1].replace(")","");let S=parseFloat(f[1]);if(isFinite(S)||(S=1),isFinite(a)&&isFinite(o)){const M=m.tetrate(a,o,S);return this.sign=M.sign,this.layer=M.layer,this.mag=M.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const y=e.split("e"),N=y.length-1;if(N===0){const S=parseFloat(e);if(isFinite(S))return this.fromNumber(S),m.fromStringCache.size>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}else if(N===1){const S=parseFloat(e);if(isFinite(S)&&S!==0)return this.fromNumber(S),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}const w=e.split("e^");if(w.length===2){this.sign=1,w[0].charAt(0)=="-"&&(this.sign=-1);let S="";for(let M=0;M<w[1].length;++M){const T=w[1].charCodeAt(M);if(T>=43&&T<=57||T===101)S+=w[1].charAt(M);else return this.layer=parseFloat(S),this.mag=parseFloat(w[1].substr(M+1)),this.normalize(),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}if(N<1)return this.sign=0,this.layer=0,this.mag=0,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this;const p=parseFloat(y[0]);if(p===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(y[y.length-1]);if(N>=2){const S=parseFloat(y[y.length-2]);isFinite(S)&&(k*=Math.sign(S),k+=It(S))}if(!isFinite(p))this.sign=y[0]==="-"?-1:1,this.layer=N,this.mag=k;else if(N===1)this.sign=Math.sign(p),this.layer=1,this.mag=k+Math.log10(Math.abs(p));else if(this.sign=Math.sign(p),this.layer=N,N===2){const S=m.mul(A(1,2,k),h(p));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}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:Ce(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Ce(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<=Dt?(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):Ce(this.m,e)+"e"+Ce(this.e,e):this.layer===1?Ce(this.m,e)+"e"+Ce(this.e,e):this.layer<=Dt?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Ce(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Ce(this.mag,e)}abs(){return U(this.sign===0?0:1,this.layer,this.mag)}neg(){return U(-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?A(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?m.dZero:this.layer===0?A(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?m.dZero:this.layer===0?A(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?m.dZero:this.layer===0?A(this.sign,0,Math.trunc(this.mag)):this}add(e){const t=h(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 U(0,0,0);let i,r;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(m.cmpabs(this,t)>0?(i=this,r=t):(i=t,r=this),i.layer===0&&r.layer===0)return m.fromNumber(i.sign*i.mag+r.sign*r.mag);const s=i.layer*Math.sign(i.mag),u=r.layer*Math.sign(r.mag);if(s-u>=2)return i;if(s===0&&u===-1){if(Math.abs(r.mag-Math.log10(i.mag))>St)return i;{const a=Math.pow(10,Math.log10(i.mag)-r.mag),o=r.sign+i.sign*a;return A(Math.sign(o),1,r.mag+Math.log10(Math.abs(o)))}}if(s===1&&u===0){if(Math.abs(i.mag-Math.log10(r.mag))>St)return i;{const a=Math.pow(10,i.mag-Math.log10(r.mag)),o=r.sign+i.sign*a;return A(Math.sign(o),1,Math.log10(r.mag)+Math.log10(Math.abs(o)))}}if(Math.abs(i.mag-r.mag)>St)return i;{const a=Math.pow(10,i.mag-r.mag),o=r.sign+i.sign*a;return A(Math.sign(o),1,r.mag+Math.log10(Math.abs(o)))}}plus(e){return this.add(e)}sub(e){return this.add(h(e).neg())}subtract(e){return this.sub(e)}minus(e){return this.sub(e)}mul(e){const t=h(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer))return t;if(this.sign===0||t.sign===0)return U(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return U(this.sign*t.sign,0,1);let i,r;if(this.layer>t.layer||this.layer==t.layer&&Math.abs(this.mag)>Math.abs(t.mag)?(i=this,r=t):(i=t,r=this),i.layer===0&&r.layer===0)return m.fromNumber(i.sign*r.sign*i.mag*r.mag);if(i.layer>=3||i.layer-r.layer>=2)return A(i.sign*r.sign,i.layer,i.mag);if(i.layer===1&&r.layer===0)return A(i.sign*r.sign,1,i.mag+Math.log10(r.mag));if(i.layer===1&&r.layer===1)return A(i.sign*r.sign,1,i.mag+r.mag);if(i.layer===2&&r.layer===1){const s=A(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)).add(A(Math.sign(r.mag),r.layer-1,Math.abs(r.mag)));return A(i.sign*r.sign,s.layer+1,s.sign*s.mag)}if(i.layer===2&&r.layer===2){const s=A(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)).add(A(Math.sign(r.mag),r.layer-1,Math.abs(r.mag)));return A(i.sign*r.sign,s.layer+1,s.sign*s.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=h(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?A(this.sign,0,1/this.mag):A(this.sign,this.layer,-this.mag)}reciprocal(){return this.recip()}reciprocate(){return this.recip()}cmp(e){const t=h(e);return this.sign>t.sign?1:this.sign<t.sign?-1:this.sign*this.cmpabs(e)}cmpabs(e){const t=h(e),i=this.mag>0?this.layer:-this.layer,r=t.mag>0?t.layer:-t.layer;return i>r?1:i<r?-1:this.mag>t.mag?1:this.mag<t.mag?-1:0}compare(e){return this.cmp(e)}isNan(){return isNaN(this.sign)||isNaN(this.layer)||isNaN(this.mag)}isFinite(){return isFinite(this.sign)&&isFinite(this.layer)&&isFinite(this.mag)}eq(e){const t=h(e);return this.sign===t.sign&&this.layer===t.layer&&this.mag===t.mag}equals(e){return this.eq(e)}neq(e){return!this.eq(e)}notEquals(e){return this.neq(e)}lt(e){return this.cmp(e)===-1}lte(e){return!this.gt(e)}gt(e){return this.cmp(e)===1}gte(e){return!this.lt(e)}max(e){const t=h(e);return this.lt(t)?t:this}min(e){const t=h(e);return this.gt(t)?t:this}maxabs(e){const t=h(e);return this.cmpabs(t)<0?t:this}minabs(e){const t=h(e);return this.cmpabs(t)>0?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 i=h(e);return this.eq_tolerance(i,t)?0:this.cmp(i)}compare_tolerance(e,t){return this.cmp_tolerance(e,t)}eq_tolerance(e,t){const i=h(e);if(t==null&&(t=1e-7),this.sign!==i.sign||Math.abs(this.layer-i.layer)>1)return!1;let r=this.mag,s=i.mag;return this.layer>i.layer&&(s=It(s)),this.layer<i.layer&&(r=It(r)),Math.abs(r-s)<=t*Math.max(Math.abs(r),Math.abs(s))}equals_tolerance(e,t){return this.eq_tolerance(e,t)}neq_tolerance(e,t){return!this.eq_tolerance(e,t)}notEquals_tolerance(e,t){return this.neq_tolerance(e,t)}lt_tolerance(e,t){const i=h(e);return!this.eq_tolerance(i,t)&&this.lt(i)}lte_tolerance(e,t){const i=h(e);return this.eq_tolerance(i,t)||this.lt(i)}gt_tolerance(e,t){const i=h(e);return!this.eq_tolerance(i,t)&&this.gt(i)}gte_tolerance(e,t){const i=h(e);return this.eq_tolerance(i,t)||this.gt(i)}pLog10(){return this.lt(m.dZero)?m.dZero:this.log10()}absLog10(){return this.sign===0?m.dNaN:this.layer>0?A(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):A(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?m.dNaN:this.layer>0?A(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):A(this.sign,0,Math.log10(this.mag))}log(e){return e=h(e),this.sign<=0||e.sign<=0||e.sign===1&&e.layer===0&&e.mag===1?m.dNaN:this.layer===0&&e.layer===0?A(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?A(this.sign,0,Math.log2(this.mag)):this.layer===1?A(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?A(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):A(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?m.dNaN:this.layer===0?A(this.sign,0,Math.log(this.mag)):this.layer===1?A(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?A(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):A(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}logarithm(e){return this.log(e)}pow(e){const t=h(e),i=this,r=t;if(i.sign===0)return r.eq(0)?U(1,0,1):i;if(i.sign===1&&i.layer===0&&i.mag===1)return i;if(r.sign===0)return U(1,0,1);if(r.sign===1&&r.layer===0&&r.mag===1)return i;const s=i.absLog10().mul(r).pow10();return this.sign===-1?Math.abs(r.toNumber()%2)%2===1?s.neg():Math.abs(r.toNumber()%2)%2===0?s:m.dNaN:s}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 A(1,0,t);if(e.sign===0)return m.dOne;e=U(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?A(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?A(-e.sign,e.layer+1,-e.mag):m.dOne}pow_base(e){return h(e).pow(this)}root(e){const t=h(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(U(1,0,24)))return m.fromNumber(Di(this.sign*this.mag));const e=this.mag-1;let t=.9189385332046727;t=t+(e+.5)*Math.log(e),t=t-e;const i=e*e;let r=e,s=12*r,u=1/s,a=t+u;if(a===t||(t=a,r=r*i,s=360*r,u=1/s,a=t-u,a===t))return m.exp(t);t=a,r=r*i,s=1260*r;let o=1/s;return t=t+o,r=r*i,s=1680*r,o=1/s,t=t-o,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?A(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?A(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):A(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 A(1,2,Math.log10(this.mag)-.3010299956639812);{const e=m.div(U(this.sign,this.layer-1,this.mag),U(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=U(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 s=this.toNumber();if(s<=1.444667861009766&&s>=.06598803584531254){if(s>1.444667861009099)return m.fromNumber(Math.E);const u=m.ln(this).neg();return u.lambertw().div(u)}else return s>1.444667861009766?m.fromNumber(Number.POSITIVE_INFINITY):m.dNaN}if(this.eq(m.dZero)){let s=Math.abs((e+1)%2);return s>1&&(s=2-s),m.fromNumber(s)}if(e<0)return m.iteratedlog(t,this,-e);t=h(t);const i=e;e=Math.trunc(e);const r=i-e;if(this.gt(m.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let s=0;s<e;++s){const u=t;if(t=this.pow(t),u.eq(t))return t}if(r!=0){const s=this.pow(t);return t.mul(1-r).add(s.mul(r))}return t}r!==0&&(t.eq(m.dOne)?this.gt(10)?t=this.pow(r):(t=m.fromNumber(m.tetrate_critical(this.toNumber(),r)),this.lt(2)&&(t=t.sub(1).mul(this.minus(1)).plus(1))):this.eq(10)?t=t.layeradd10(r):t=t.layeradd(r,this));for(let s=0;s<e;++s){if(t=this.pow(t),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(t.layer-this.layer>3)return U(t.sign,t.layer+(e-s-1),t.mag);if(s>1e4)return t}return t}iteratedexp(e=2,t=U(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return m.tetrate(e,-t,this);e=h(e);let i=m.fromDecimal(this);const r=t;t=Math.trunc(t);const s=r-t;if(i.layer-e.layer>3){const u=Math.min(t,i.layer-e.layer-3);t-=u,i.layer-=u}for(let u=0;u<t;++u){if(i=i.log(e),!isFinite(i.layer)||!isFinite(i.mag))return i.normalize();if(u>1e4)return i}return s>0&&s<1&&(e.eq(10)?i=i.layeradd10(-s):i=i.layeradd(-s,e)),i}slog(e=10,t=100){let i=.001,r=!1,s=!1,u=this.slog_internal(e).toNumber();for(let a=1;a<t;++a){const f=new m(e).tetrate(u).gt(this);if(a>1&&s!=f&&(r=!0),s=f,r?i/=2:i*=2,i=Math.abs(i)*(f?-1:1),u+=i,i===0)break}return m.fromNumber(u)}slog_internal(e=10){if(e=h(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,i=m.fromDecimal(this);if(i.layer-e.layer>3){const r=i.layer-e.layer-3;t+=r,i.layer-=r}for(let r=0;r<100;++r)if(i.lt(m.dZero))i=m.pow(e,i),t-=1;else{if(i.lte(m.dOne))return m.fromNumber(t+m.slog_critical(e.toNumber(),i.toNumber()));t+=1,i=m.log(i,e)}return m.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:m.critical_section(e,t,Li)}static tetrate_critical(e,t){return m.critical_section(e,t,Oi)}static critical_section(e,t,i){t*=10,t<0&&(t=0),t>10&&(t=10),e<2&&(e=2),e>10&&(e=10);let r=0,s=0;for(let a=0;a<Ve.length;++a)if(Ve[a]==e){r=i[a][Math.floor(t)],s=i[a][Math.ceil(t)];break}else if(Ve[a]<e&&Ve[a+1]>e){const o=(e-Ve[a])/(Ve[a+1]-Ve[a]);r=i[a][Math.floor(t)]*(1-o)+i[a+1][Math.floor(t)]*o,s=i[a][Math.ceil(t)]*(1-o)+i[a+1][Math.ceil(t)]*o;break}const u=t-Math.floor(t);return r<=0||s<=0?r*(1-u)+s*u:Math.pow(e,Math.log(r)/Math.log(e)*(1-u)+Math.log(s)/Math.log(e)*u)}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 i=Math.trunc(e);e-=i,t.layer+=i}if(e<=-1){const i=Math.trunc(e);if(e-=i,t.layer+=i,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(At(this.toNumber()));if(this.layer===0)return m.fromNumber(At(this.sign*this.mag));if(this.layer===1)return Rt(this);if(this.layer===2)return Rt(this);if(this.layer>=3)return U(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return U(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=U(1,0,1)){t=h(t);const i=e;e=Math.trunc(e);const r=i-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 s=0;s<e;++s){if(t=this.tetrate(t.toNumber()),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(s>10)return t}return t}sin(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.sin(this.sign*this.mag)):U(0,0,0)}cos(){return this.mag<0?m.dOne:this.layer===0?m.fromNumber(Math.cos(this.sign*this.mag)):U(0,0,0)}tan(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.tan(this.sign*this.mag)):U(0,0,0)}asin(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.asin(this.sign*this.mag)):U(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)):U(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)?U(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}};$(m,"dZero"),$(m,"dOne"),$(m,"dNegOne"),$(m,"dTwo"),$(m,"dTen"),$(m,"dNaN"),$(m,"dInf"),$(m,"dNegInf"),$(m,"dNumberMax"),$(m,"dNumberMin"),$(m,"fromStringCache",new xi(Vi));let c=m;c.dZero=U(0,0,0);c.dOne=U(1,0,1);c.dNegOne=U(-1,0,1);c.dTwo=U(1,0,2);c.dTen=U(1,0,10);c.dNaN=U(Number.NaN,Number.NaN,Number.NaN);c.dInf=U(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);c.dNegInf=U(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);c.dNumberMax=A(1,0,Number.MAX_VALUE);c.dNumberMin=A(1,0,Number.MIN_VALUE);h=c.fromValue_noAlloc;A=c.fromComponents;U=c.fromComponents_noNormalize;c.fromMantissaExponent;c.fromMantissaExponent_noNormalize;const Ai=new c(1);function Ze(n,e,t=!0){let i=c.log10(n).floor(),r=c.div(n,c.pow(10,i));r.toStringWithDecimalPlaces(e)==="10"&&(r=Ai,i=i.add(1));const s=i.gte(1e9)?me(i,Math.max(Math.max(e,3),B.defaultDecimalsShown)):i.gte(1e4)?dt(i,0):i.toStringWithDecimalPlaces(0);return t?r.toStringWithDecimalPlaces(e)+"e"+s:"e"+s}function dt(n,e){if(n==null)return"NaN";if(n=new c(n),n.mag<.001)return 0 .toFixed(e);const i=n.toStringWithDecimalPlaces(e).split(".");return i[0]=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"),i.length===1?i[0]:i[0]+"."+i[1]}function Qt(n,e){return n==null?"NaN":(n=new c(n),n.mag<1e-4?0 .toFixed(e):(n.mag<.1&&e!==0&&(e=Math.max(Math.max(e,n.log10().negate().ceil().toNumber()),B.defaultDecimalsShown)),n.toStringWithDecimalPlaces(e)))}const Ri=new c("eeee1000"),qi=new c("e100000"),qt=new c("e1000"),en=new c(1e9),Ui=new c(1e6),Bi=new c(1e3),zi=new c(.98),Gi=new c(.001),tn=new c(0);function me(n,e,t){if(e==null&&(e=B.defaultDecimalsShown),t=t??B.defaultShowSmall,n=new c(n),isNaN(n.sign)||isNaN(n.layer)||isNaN(n.mag))return"NaN";if(n.sign<0)return"-"+me(n.neg(),e);if(n.mag===Number.POSITIVE_INFINITY)return"Infinity";if(n.gte(Ri)){const i=n.slog();return i.gte(Ui)?"F"+me(i.floor()):c.pow(10,i.sub(i.floor())).toStringWithDecimalPlaces(3)+"F"+dt(i.floor(),0)}else{if(n.gte(qi))return Ze(n,0,!1);if(n.gte(qt))return Ze(n,0);if(n.gte(en))return Ze(n,e);if(n.gte(Bi))return dt(n,0);if(n.gte(Gi)||!t)return Qt(n,e);if(n.eq(tn))return 0 .toFixed(e)}return n=rn(n),n.lt(qt)?Ze(n,e).replace(/([^(?:e|F)]*)$/,"-$1"):me(n,e)+"⁻¹"}function de(n){return n=new c(n),n.sign<0?"-"+de(n.neg()):n.gte(en)||n.lte(zi)&&!n.eq(tn)?me(n):me(n,0)}function nn(n){return c.lt(n,0)?"-"+nn(c.neg(n)):c.gt(n,2**51)?me(c.div(n,31536e3))+"y":(n=new c(n).toNumber(),n<60?me(n)+"s":n<3600?de(Math.floor(n/60))+"m "+me(n%60)+"s":n<86400?de(Math.floor(n/3600))+"h "+de(Math.floor(n/60)%60)+"m "+de(n%60)+"s":n<31536e3?de(Math.floor(n/84600)%365)+"d "+de(Math.floor(n/3600)%24)+"h "+de(Math.floor(n/60)%60)+"m":de(Math.floor(n/31536e3))+"y "+de(Math.floor(n/84600)%365)+"d "+de(Math.floor(n/3600)%24)+"h")}function Hi(n,e,t){n=new c(n);let i=n.toStringWithDecimalPlaces(e);return new c(i).gte(t)&&(i=c.sub(t,Math.pow(.1,e)).toStringWithDecimalPlaces(e)),i}function Wi(n,e){return me(n,e,!0)}function rn(n){let e=c.log10(n).ceil();const t=c.div(n,c.pow(10,e));return e=e.neg(),n=new c(10).pow(e).times(t),n}const ji=Object.freeze(Object.defineProperty({__proto__:null,commaFormat:dt,default:c,exponentialFormat:Ze,format:me,formatSmall:Wi,formatTime:nn,formatWhole:de,invertOOM:rn,regularFormat:Qt,toPlaces:Hi},Symbol.toStringTag,{value:"Module"})),{exponentialFormat:Ji,commaFormat:Zi,regularFormat:Yi,format:pe,formatWhole:Qe,formatTime:yt,toPlaces:Ki,formatSmall:Xi,invertOOM:Qi}=ji;window.Decimal=c;window.exponentialFormat=Ji;window.commaFormat=Zi;window.regularFormat=Yi;window.format=pe;window.formatWhole=Qe;window.formatTime=yt;window.toPlaces=Ki;window.formatSmall=Xi;window.invertOOM=Qi;const Ie=Symbol("ProxyState"),ft=Symbol("AfterEvaluation");function Ee(n,e={}){const t=e;let i=!1,r=!1;const s=[];function u(){if(!i){if(r)throw new Error("Cyclical dependency detected. Cannot evaluate lazy proxy.");r=!0,Object.assign(t,n.call(t,t)),i=!0,s.forEach(o=>o(t))}return t}function a(o){i?o(t):s.push(o)}return new Proxy(t,{get(o,f){if(f===Ie)return u();if(f===ft)return a;const y=u()[f];return y!=null&&typeof y=="object"&&ye in y?y[ye]:y},set(o,f,y){return u()[f]=y,!0},has(o,f){return f===Ie||f===ft?!0:Reflect.has(u(),f)},ownKeys(){return Reflect.ownKeys(u())},getOwnPropertyDescriptor(o,f){return i||(Object.assign(t,n.call(t,t)),i=!0),Object.getOwnPropertyDescriptor(o,f)}})}function er(n,e){ft in n?n[ft](e):e(n)}function tr(n){let e=n.replace(/([A-Z])/g," $1");return e=e.charAt(0).toUpperCase()+e.slice(1),e}function nr(n){return(n[0]+n.slice(1).replace(/[A-Z]/g,e=>`-${e}`)).toLowerCase()}function ir(n){return typeof n=="function"}var Y=(n=>(n.Up="Up",n.Down="Down",n.Left="Left",n.Right="Right",n.Default="Up",n))(Y||{});function R(n){return ir(n)&&n.length===0?L(n):n}const sn=c.ln(10);function ut(n){return n}function je(n,...e){const t=e.find(i=>I(i));return t==null?(console.error("Could not invert due to no input being a variable"),0):t.invert(n)}function rr(n,e){return I(e)?e.invert(c.neg(n)):(console.error("Could not invert due to no input being a variable"),0)}function sr(n,e){return I(e)?e.isIntegrable()?l.neg(e.getIntegralFormula(n)):(console.error("Could not integrate due to variable not being integrable"),l.constant(0)):(console.error("Could not integrate due to no input being a variable"),l.constant(0))}function ar(n){return l.neg(n)}function or(n,e,t){return I(e)?e.invert(c.sub(n,X(t))):I(t)?t.invert(c.sub(n,X(e))):(console.error("Could not invert due to no input being a variable"),0)}function lr(n,e,t){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=e.getIntegralFormula(n);return l.times(t,e.innermostVariable??0).add(i)}else if(I(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=t.getIntegralFormula(n);return l.times(e,t.innermostVariable??0).add(i)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function ur(n,e,t){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=e.getIntegralFormula(n);return l.add(i,t)}else if(I(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=t.getIntegralFormula(n);return l.add(i,e)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function cr(n,e,t){return I(e)?e.invert(c.add(n,X(t))):I(t)?t.invert(c.sub(X(e),n)):(console.error("Could not invert due to no input being a variable"),0)}function dr(n,e,t){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=e.getIntegralFormula(n);return l.sub(i,l.times(t,e.innermostVariable??0))}else if(I(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=t.getIntegralFormula(n);return l.times(e,t.innermostVariable??0).sub(i)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function fr(n,e,t){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=e.getIntegralFormula(n);return l.sub(i,t)}else if(I(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=t.getIntegralFormula(n);return l.sub(i,e)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function mr(n,e,t){return I(e)?e.invert(c.div(n,X(t))):I(t)?t.invert(c.div(n,X(e))):(console.error("Could not invert due to no input being a variable"),0)}function gr(n,e,t){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=e.getIntegralFormula(n);return l.times(i,t)}else if(I(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=t.getIntegralFormula(n);return l.times(i,e)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function pr(n,e,t){return I(e)?l.div(n,t):I(t)?l.div(n,e):(console.error("Could not apply substitution due to no input being a variable"),l.constant(0))}function hr(n,e,t){return I(e)?e.invert(c.mul(n,X(t))):I(t)?t.invert(c.div(X(e),n)):(console.error("Could not invert due to no input being a variable"),0)}function vr(n,e,t){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=e.getIntegralFormula(n);return l.div(i,t)}else if(I(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=t.getIntegralFormula(n);return l.div(e,i)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function br(n,e,t){return I(e)?l.mul(n,t):I(t)?l.mul(n,e):(console.error("Could not apply substitution due to no input being a variable"),l.constant(0))}function yr(n,e){return I(e)?e.invert(c.recip(n)):(console.error("Could not invert due to no input being a variable"),0)}function wr(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.ln(t)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function Nr(n,e){return I(e)?e.invert(c.pow10(n)):(console.error("Could not invert due to no input being a variable"),0)}function kr(n){return c.ln(n).sub(1).times(n).div(sn)}function Cr(n,e){if(I(e)){const t=sn.times(n);return e.invert(t.div(t.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function Sr(n,e){return I(e)?e.isIntegrable()?new l({inputs:[e.getIntegralFormula(n)],evaluate:kr,invert:Cr}):(console.error("Could not integrate due to variable not being integrable"),l.constant(0)):(console.error("Could not integrate due to no input being a variable"),l.constant(0))}function Ir(n,e,t){return I(e)?e.invert(c.pow(X(t),n)):I(t)?t.invert(c.root(X(e),n)):(console.error("Could not invert due to no input being a variable"),0)}function xr(n,e){return c.ln(n).sub(1).times(n).div(c.ln(e))}function Mr(n,e,t){if(I(e)){const i=c.ln(X(t)).times(n);return e.invert(i.div(i.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function Tr(n,e,t){return I(e)?e.isIntegrable()?new l({inputs:[e.getIntegralFormula(n),t],evaluate:xr,invert:Mr}):(console.error("Could not integrate due to variable not being integrable"),l.constant(0)):(console.error("Could not integrate due to no input being a variable"),l.constant(0))}function $r(n,e){return I(e)?e.invert(c.pow(2,n)):(console.error("Could not invert due to no input being a variable"),0)}function Pr(n){return c.ln(n).sub(1).times(n).div(c.ln(2))}function Er(n,e){if(I(e)){const t=c.ln(2).times(n);return e.invert(t.div(t.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function Fr(n,e){return I(e)?e.isIntegrable()?new l({inputs:[e.getIntegralFormula(n)],evaluate:Pr,invert:Er}):(console.error("Could not integrate due to variable not being integrable"),l.constant(0)):(console.error("Could not integrate due to no input being a variable"),l.constant(0))}function Vr(n,e){return I(e)?e.invert(c.exp(n)):(console.error("Could not invert due to no input being a variable"),0)}function _r(n){return c.ln(n).sub(1).times(n)}function Or(n,e){return I(e)?e.invert(c.div(n,c.div(n,Math.E).lambertw())):(console.error("Could not invert due to no input being a variable"),0)}function Lr(n,e){return I(e)?e.isIntegrable()?new l({inputs:[e.getIntegralFormula(n)],evaluate:_r,invert:Or}):(console.error("Could not integrate due to variable not being integrable"),l.constant(0)):(console.error("Could not integrate due to no input being a variable"),l.constant(0))}function Dr(n,e,t){return I(e)?e.invert(c.root(n,X(t))):I(t)?t.invert(c.ln(n).div(c.ln(X(e)))):(console.error("Could not invert due to no input being a variable"),0)}function Ar(n,e,t){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=e.getIntegralFormula(n),r=l.add(t,1);return l.pow(i,r).div(r)}else if(I(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=t.getIntegralFormula(n);return l.pow(e,i).div(l.ln(e))}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function Rr(n,e){return I(e)?e.invert(c.root(n,10)):(console.error("Could not invert due to no input being a variable"),0)}function qr(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.pow10(t).div(l.ln(10))}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function Ur(n,e,t){return I(e)?e.invert(c.ln(n).div(c.ln(X(t)))):I(t)?t.invert(c.root(X(e),n)):(console.error("Could not invert due to no input being a variable"),0)}function Br(n,e,t){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=e.getIntegralFormula(n);return l.pow(t,i).div(l.ln(t))}else if(I(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=t.getIntegralFormula(n),r=l.add(e,1);return l.pow(i,r).div(r)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function zr(n,e,t){return I(e)?e.invert(c.root(n,c.recip(X(t)))):I(t)?t.invert(c.ln(X(e)).div(c.ln(n))):(console.error("Could not invert due to no input being a variable"),0)}function Gr(n,e,t){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const i=e.getIntegralFormula(n);return l.pow(i,l.recip(t).add(1)).times(t).div(l.add(t,1))}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function Hr(n,e){return I(e)?e.invert(c.ln(n)):(console.error("Could not invert due to no input being a variable"),0)}function Wr(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.exp(t)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function jr(n,e=2,t=c.fromComponents_noNormalize(1,0,1)){const i=c.minabs(e,1e308).toNumber();return c.tetrate(n,i,t)}function Jr(n,e,t,i){return I(e)?e.invert(c.ssqrt(n)):(console.error("Could not invert due to no input being a variable"),0)}function Zr(n,e=2,t=c.fromComponents_noNormalize(1,0,1)){const i=c.minabs(e,1e308).toNumber();return c.iteratedexp(n,i,new c(t))}function Yr(n,e,t,i){return I(e)?e.invert(c.iteratedlog(n,Math.E,c.minabs(1e308,X(t)).toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function Kr(n,e=10,t=2){const i=c.minabs(t,1e308).toNumber();return c.iteratedlog(n,e,i)}function Xr(n,e=10){const t=c.minabs(e,1e308).toNumber();return c.slog(n,t)}function Qr(n,e,t){return I(e)?e.invert(c.tetrate(n,c.minabs(1e308,X(t)).toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function es(n,e,t){const i=c.minabs(e,1e308).toNumber();return c.layeradd(n,i,t)}function ts(n,e,t,i){return I(e)?e.invert(c.layeradd(n,c.minabs(1e308,X(t)).negate().toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function ns(n,e){return I(e)?e.invert(c.pow(Math.E,n).times(n)):(console.error("Could not invert due to no input being a variable"),0)}function is(n,e){return I(e)?e.invert(c.tetrate(n,2)):(console.error("Could not invert due to no input being a variable"),0)}function rs(n,e,t){const i=c.minabs(e,1e308).toNumber();return c.pentate(n,i,t)}function ss(n,e){return I(e)?e.invert(c.asin(n)):(console.error("Could not invert due to no input being a variable"),0)}function as(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.cos(t).neg()}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function os(n,e){return I(e)?e.invert(c.acos(n)):(console.error("Could not invert due to no input being a variable"),0)}function ls(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.sin(t)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function us(n,e){return I(e)?e.invert(c.atan(n)):(console.error("Could not invert due to no input being a variable"),0)}function cs(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.cos(t).ln().neg()}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function ds(n,e){return I(e)?e.invert(c.sin(n)):(console.error("Could not invert due to no input being a variable"),0)}function fs(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.asin(t).times(t).add(l.sqrt(l.sub(1,l.pow(t,2))))}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function ms(n,e){return I(e)?e.invert(c.cos(n)):(console.error("Could not invert due to no input being a variable"),0)}function gs(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.acos(t).times(t).sub(l.sqrt(l.sub(1,l.pow(t,2))))}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function ps(n,e){return I(e)?e.invert(c.tan(n)):(console.error("Could not invert due to no input being a variable"),0)}function hs(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.atan(t).times(t).sub(l.ln(l.pow(t,2).add(1)).div(2))}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function vs(n,e){return I(e)?e.invert(c.asinh(n)):(console.error("Could not invert due to no input being a variable"),0)}function bs(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.cosh(t)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function ys(n,e){return I(e)?e.invert(c.acosh(n)):(console.error("Could not invert due to no input being a variable"),0)}function ws(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.sinh(t)}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function Ns(n,e){return I(e)?e.invert(c.atanh(n)):(console.error("Could not invert due to no input being a variable"),0)}function ks(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.cosh(t).ln()}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function Cs(n,e){return I(e)?e.invert(c.sinh(n)):(console.error("Could not invert due to no input being a variable"),0)}function Ss(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.asinh(t).times(t).sub(l.pow(t,2).add(1).sqrt())}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function Is(n,e){return I(e)?e.invert(c.cosh(n)):(console.error("Could not invert due to no input being a variable"),0)}function xs(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.acosh(t).times(t).sub(l.add(t,1).sqrt().times(l.sub(t,1).sqrt()))}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function Ms(n,e){return I(e)?e.invert(c.tanh(n)):(console.error("Could not invert due to no input being a variable"),0)}function Ts(n,e){if(I(e)){if(!e.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),l.constant(0);const t=e.getIntegralFormula(n);return l.atanh(t).times(t).add(l.sub(1,l.pow(t,2)).ln().div(2))}return console.error("Could not integrate due to no input being a variable"),l.constant(0)}function De(n){return(e,t)=>new l({inputs:[e,t],evaluate:n,invert:ut})}function I(n){return n instanceof et&&n.hasVariable()}function X(n,e){return n instanceof et?n.evaluate(e):d(n)}function $s(){return l.pow(this,2).div(2)}function Ps(){return this}const D=class D{constructor(e){$(this,"inputs");$(this,"internalEvaluate");$(this,"internalInvert");$(this,"internalIntegrate");$(this,"internalIntegrateInner");$(this,"applySubstitution");$(this,"description");$(this,"internalVariables");$(this,"innermostVariable");$(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(i=>typeof i=="object"&&ye in i?i[ye]:i)),"variable"in e?(typeof e.variable=="object"&&ye in e.variable&&(e.variable=e.variable[ye]),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,this.description=e.description}setupVariable({variable:e}){return{inputs:[e],internalVariables:1,innermostVariable:e,internalIntegrate:$s,internalIntegrateInner:Ps,applySubstitution:ut}}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){const{inputs:t,evaluate:i,invert:r,integrate:s,integrateInner:u,applySubstitution:a}=e,o=t.reduce((p,k)=>p+(k instanceof D?k.internalVariables:0),0),f=t.find(p=>p instanceof D&&p.hasVariable()),y=o===1?f==null?void 0:f.innermostVariable:void 0,N=(f==null?void 0:f.isInvertible())??!1,w=(f==null?void 0:f.isIntegrable())??!1;return{inputs:t,internalEvaluate:i,internalInvert:N?r:void 0,internalIntegrate:w?s:void 0,internalIntegrateInner:u,applySubstitution:a,innermostVariable:y,internalVariables:o}}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;return((t=this.internalEvaluate)==null?void 0:t.call(this,...this.inputs.map(i=>X(i,e))))??(this.hasVariable()?e:null)??X(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,i)=>t instanceof D&&e.inputs[i]instanceof D?t.equals(e.inputs[i]):!(t instanceof D)&&!(e.inputs[i]instanceof D)&&c.eq(d(t),d(e.inputs[i])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new l({inputs:[e]})}static variable(e){return new l({variable:e})}static stringify(e){return e instanceof D?e.description!=null?e.description:e.internalEvaluate==null?e.hasVariable()?"x":pe(e.inputs[0]??0):`${e.internalEvaluate.name}(${e.inputs.map(l.stringify).join(", ")})`:pe(d(e))}static step(e,t,i){const r=i(l.variable(0)),s=R(t);function u(o){return c.lt(o,d(s))?o:c.add(r.evaluate(c.sub(o,d(s))),d(s))}function a(o,f){return I(f)&&r.isInvertible()?(c.gt(o,d(s))&&(o=c.add(r.invert(c.sub(o,d(s))),d(s))),f.invert(o)):(console.error("Could not invert due to no input being a variable"),0)}return new l({inputs:[e],evaluate:u,invert:r.isInvertible()&&r.hasVariable()?a:void 0,description:"indeterminate"})}static if(e,t,i,r){const s=F(0),u=l.variable(s),a=i(u),o=r==null?void 0:r(u),f=R(t);function y(w){return d(f)?(s.value=w,a.evaluate()):o?(s.value=w,o.evaluate()):w}function N(w,p){return!I(p)||!a.isInvertible()||o!=null&&!o.isInvertible()?(console.error("Could not invert due to no input being a variable"),0):d(f)?p.invert(a.invert(w)):o?p.invert(o.invert(w)):p.invert(w)}return new l({inputs:[e],evaluate:y,invert:a.isInvertible()&&a.hasVariable()?N:void 0,description:"indeterminate"})}static conditional(e,t,i,r){return l.if(e,t,i,r)}static abs(e){return new l({inputs:[e],evaluate:c.abs})}static neg(e){return new l({inputs:[e],evaluate:c.neg,invert:rr,applySubstitution:ar,integrate:sr})}static sign(e){return new l({inputs:[e],evaluate:c.sign})}static round(e){return new l({inputs:[e],evaluate:c.round,invert:je})}static floor(e){return new l({inputs:[e],evaluate:c.floor,invert:je})}static ceil(e){return new l({inputs:[e],evaluate:c.ceil,invert:je})}static trunc(e){return new l({inputs:[e],evaluate:c.trunc,invert:je})}static add(e,t){return new l({inputs:[e,t],evaluate:c.add,invert:or,integrate:lr,integrateInner:ur,applySubstitution:ut})}static sub(e,t){return new l({inputs:[e,t],evaluate:c.sub,invert:cr,integrate:dr,integrateInner:fr,applySubstitution:ut})}static mul(e,t){return new l({inputs:[e,t],evaluate:c.mul,invert:mr,integrate:gr,applySubstitution:pr})}static div(e,t){return new l({inputs:[e,t],evaluate:c.div,invert:hr,integrate:vr,applySubstitution:br})}static recip(e){return new l({inputs:[e],evaluate:c.recip,invert:yr,integrate:wr})}static clamp(e,t,i){return new l({inputs:[e,t,i],evaluate:c.clamp,invert:je})}static pLog10(e){return new l({inputs:[e],evaluate:c.pLog10})}static absLog10(e){return new l({inputs:[e],evaluate:c.absLog10})}static log10(e){return new l({inputs:[e],evaluate:c.log10,invert:Nr,integrate:Sr})}static log(e,t){return new l({inputs:[e,t],evaluate:c.log,invert:Ir,integrate:Tr})}static log2(e){return new l({inputs:[e],evaluate:c.log2,invert:$r,integrate:Fr})}static ln(e){return new l({inputs:[e],evaluate:c.ln,invert:Vr,integrate:Lr})}static pow(e,t){return new l({inputs:[e,t],evaluate:c.pow,invert:Dr,integrate:Ar})}static pow10(e){return new l({inputs:[e],evaluate:c.pow10,invert:Rr,integrate:qr})}static pow_base(e,t){return new l({inputs:[e,t],evaluate:c.pow_base,invert:Ur,integrate:Br})}static root(e,t){return new l({inputs:[e,t],evaluate:c.root,invert:zr,integrate:Gr})}static factorial(e){return new l({inputs:[e],evaluate:c.factorial})}static gamma(e){return new l({inputs:[e],evaluate:c.gamma})}static lngamma(e){return new l({inputs:[e],evaluate:c.lngamma})}static exp(e){return new l({inputs:[e],evaluate:c.exp,invert:Hr,integrate:Wr})}static sqr(e){return l.pow(e,2)}static sqrt(e){return l.root(e,2)}static cube(e){return l.pow(e,3)}static cbrt(e){return l.root(e,3)}static tetrate(e,t=2,i=c.fromComponents_noNormalize(1,0,1)){return new l({inputs:[e,t,i],evaluate:jr,invert:Jr})}static iteratedexp(e,t=2,i=c.fromComponents_noNormalize(1,0,1)){return new l({inputs:[e,t,i],evaluate:Zr,invert:Yr})}static iteratedlog(e,t=10,i=1){return new l({inputs:[e,t,i],evaluate:Kr})}static slog(e,t=10){return new l({inputs:[e,t],evaluate:Xr,invert:Qr})}static layeradd10(e,t){return new l({inputs:[e,t],evaluate:c.layeradd10})}static layeradd(e,t,i=10){return new l({inputs:[e,t,i],evaluate:es,invert:ts})}static lambertw(e){return new l({inputs:[e],evaluate:c.lambertw,invert:ns})}static ssqrt(e){return new l({inputs:[e],evaluate:c.ssqrt,invert:is})}static pentate(e,t=2,i=c.fromComponents_noNormalize(1,0,1)){return new l({inputs:[e,t,i],evaluate:rs})}static sin(e){return new l({inputs:[e],evaluate:c.sin,invert:ds,integrate:as})}static cos(e){return new l({inputs:[e],evaluate:c.cos,invert:ms,integrate:ls})}static tan(e){return new l({inputs:[e],evaluate:c.tan,invert:ps,integrate:cs})}static asin(e){return new l({inputs:[e],evaluate:c.asin,invert:ss,integrate:fs})}static acos(e){return new l({inputs:[e],evaluate:c.acos,invert:os,integrate:gs})}static atan(e){return new l({inputs:[e],evaluate:c.atan,invert:us,integrate:hs})}static sinh(e){return new l({inputs:[e],evaluate:c.sinh,invert:Cs,integrate:bs})}static cosh(e){return new l({inputs:[e],evaluate:c.cosh,invert:Is,integrate:ws})}static tanh(e){return new l({inputs:[e],evaluate:c.tanh,invert:Ms,integrate:ks})}static asinh(e){return new l({inputs:[e],evaluate:c.asinh,invert:vs,integrate:Ss})}static acosh(e){return new l({inputs:[e],evaluate:c.acosh,invert:ys,integrate:xs})}static atanh(e){return new l({inputs:[e],evaluate:c.atanh,invert:Ns,integrate:Ts})}stringify(){return l.stringify(this)}step(e,t){return l.step(this,e,t)}if(e,t){return l.if(this,e,t)}conditional(e,t){return l.if(this,e,t)}abs(){return l.abs(this)}neg(){return l.neg(this)}sign(){return l.sign(this)}round(){return l.round(this)}floor(){return l.floor(this)}ceil(){return l.ceil(this)}trunc(){return l.trunc(this)}add(e){return l.add(this,e)}sub(e){return l.sub(this,e)}mul(e){return l.mul(this,e)}div(e){return l.div(this,e)}recip(){return l.recip(this)}max(e){return l.max(this,e)}min(e){return l.min(this,e)}maxabs(e){return l.maxabs(this,e)}minabs(e){return l.minabs(this,e)}clamp(e,t){return l.clamp(this,e,t)}clampMin(e){return l.clampMin(this,e)}clampMax(e){return l.clampMax(this,e)}pLog10(){return l.pLog10(this)}absLog10(){return l.absLog10(this)}log10(){return l.log10(this)}log(e){return l.log(this,e)}log2(){return l.log2(this)}ln(){return l.ln(this)}pow(e){return l.pow(this,e)}pow10(){return l.pow10(this)}pow_base(e){return l.pow_base(this,e)}root(e){return l.root(this,e)}factorial(){return l.factorial(this)}gamma(){return l.gamma(this)}lngamma(){return l.lngamma(this)}exp(){return l.exp(this)}sqr(){return l.pow(this,2)}sqrt(){return l.root(this,2)}cube(){return l.pow(this,3)}cbrt(){return l.root(this,3)}tetrate(e=2,t=c.fromComponents_noNormalize(1,0,1)){return l.tetrate(this,e,t)}iteratedexp(e=2,t=c.fromComponents_noNormalize(1,0,1)){return l.iteratedexp(this,e,t)}iteratedlog(e=10,t=1){return l.iteratedlog(this,e,t)}slog(e=10){return l.slog(this,e)}layeradd10(e){return l.layeradd10(this,e)}layeradd(e,t){return l.layeradd(this,e,t)}lambertw(){return l.lambertw(this)}ssqrt(){return l.ssqrt(this)}pentate(e=2,t=c.fromComponents_noNormalize(1,0,1)){return l.pentate(this,e,t)}sin(){return l.sin(this)}cos(){return l.cos(this)}tan(){return l.tan(this)}asin(){return l.asin(this)}acos(){return l.acos(this)}atan(){return l.atan(this)}sinh(){return l.sinh(this)}cosh(){return l.cosh(this)}tanh(){return l.tanh(this)}asinh(){return l.asinh(this)}acosh(){return l.acosh(this)}atanh(){return l.atanh(this)}};$(D,"negate",D.neg),$(D,"negated",D.neg),$(D,"sgn",D.sign),$(D,"plus",D.add),$(D,"subtract",D.sub),$(D,"minus",D.sub),$(D,"multiply",D.mul),$(D,"times",D.mul),$(D,"divide",D.div),$(D,"divideBy",D.div),$(D,"dividedBy",D.div),$(D,"reciprocal",D.recip),$(D,"reciprocate",D.recip),$(D,"max",De(c.max)),$(D,"min",De(c.min)),$(D,"minabs",De(c.minabs)),$(D,"maxabs",De(c.maxabs)),$(D,"clampMin",De(c.clampMin)),$(D,"clampMax",De(c.clampMax)),$(D,"logarithm",D.log);let et=D;class l extends et{constructor(){super(...arguments);$(this,"integralFormula")}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),i=c.add(this.evaluate(0),this.evaluate(1)).div(2);return c.sub(i,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"),l.constant(0);let i=this.internalIntegrate.call(this,t,...this.inputs);t.forEach(r=>i=r(i)),this.integralFormula=i}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"),l.constant(0);return this.integralFormula}else return this.applySubstitution==null?(console.error("Cannot have two complex operations in an integrable formula"),l.constant(0)):(t.push(i=>this.applySubstitution.call(this,i,...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"),l.constant(0)))}}const Me=Symbol("PersistentState"),Le=Symbol("DefaultValue"),mt=Symbol("StackTrace"),gt=Symbol("Deleted"),ye=Symbol("NonPersistent"),_e=Symbol("SaveDataPath"),Ge=Symbol("SkipPersistence");function Es(){var n;return((n=new Error().stack)==null?void 0:n.split(`
`).slice(3,5).map(e=>e.trim()).join(`
`))??""}function Ut(n,e){var t;c.isNaN(e)&&(G.hasNaN||(x.autosave=!1,G.hasNaN=!0,G.NaNPath=n[_e],G.NaNPersistent=n),console.error(`Attempted to save NaN value to ${(t=n[_e])==null?void 0:t.join(".")}`)),n[Me].value=e}function st(n,e=!0){const t=se(n)?n:F(n);se(n)&&(n=n.value);const i=L({get(){return t.value},set(s){e?Ut(r,s):r[Me].value=s}});i[Le]=n;const r={get value(){return t.value},set value(s){e?Ut(r,s):r[Me].value=s},__v_isRef:!0,[Me]:t,[Le]:n,[mt]:Es(),[gt]:!1,[ye]:i,[_e]:void 0};return le.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",r,`
Created at:
`+r[mt]):Re[le[le.length-1]].add(r),r}function Fs(n){return n!=null&&typeof n=="object"&&Me in n}function an(n){return!(Ie in n)&&ye in n?n[ye]:new Proxy(n,{get(e,t){if(t!==Me)return t===Ge?!0:e[t]},set(e,t,i){return e[t]=i,!0},has(e,t){return t===Me?!1:t===Ge?!0:Reflect.has(e,t)}})}function Vs(n){le.length===0?console.warn("Deleting a persistent ref outside of a layer. Ignoring...",n):Re[le[le.length-1]].delete(n),n[gt]=!0}ne.on("addLayer",(n,e)=>{const t=[],i=(r,s=[])=>{let u=!1;return Object.keys(r).forEach(a=>{let o=r[a];if(o!=null&&typeof o=="object"){if(Ge in o&&o[Ge]===!0)return;if(Ie in o&&(o=o[Ie]),Fs(o)){if(u=!0,o[gt]){console.warn("Deleted persistent ref present in returned object. Ignoring...",o,`
Created at:
`+o[mt]);return}Re[n.id].delete(o);const f=[n.id,...s,a];o[_e]!=null&&JSON.stringify(f)!==JSON.stringify(o[_e])&&console.error(`Persistent ref is being saved to \`${f.join(".")}\` when it's already present at \`${o[_e].join(".")}\`.`,"This can cause unexpected behavior when loading saves between updates."),o[_e]=f;const y=s.reduce((w,p)=>(p in w||(w[p]={}),w[p]),e),N=y[a];y[a]=o[Me],xn(y)?N!=null?y[a]=N:y[a]=o[Le]:N!=null?y[a].value=N:y[a].value=o[Le]}else!(o instanceof c)&&!(o instanceof l)&&!se(o)&&!t.includes(o)&&(typeof o.type=="symbol"&&t.push(o),i(o,[...s,a])&&(Array.isArray(o)&&!Array.isArray(r)?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.",Ie in r?r[Ie]:r,a):u=!0))}}),u};i(n[Ie]),Re[n.id].forEach(r=>{r[gt]||console.error(`Created persistent ref in "${n.id}" without registering it to the layer!`,`Make sure to include everything persistent in the returned object.
Created at:
`+r[mt])}),Re[n.id].clear()});const on=Symbol("RegisterNode"),ln=Symbol("UnregisterNode"),un=Symbol("Nodes"),cn=Symbol("Bounds"),re=bt({});window.layers=re;const Re={},le=[];function dn(n,e){return Ee(()=>{const t=Zt();le.push(n),Re[n]=new Set;const i={id:n,emitter:t,...t,nodes:F({}),minimized:st(!1,!1)},r=e(i),{color:s,display:u,classes:a,style:o,name:f,forceHideGoBack:y,minWidth:N,minimizable:w,minimizedDisplay:p,...k}=r;if(le[le.length-1]==null||le[le.length-1]!==n)throw new Error(`Adding layers stack in invalid state. This should not happen
Stack: ${le}
Trying to pop ${n}`);le.pop();const S=R(o),M={...i,...k,color:R(s),display:u,classes:R(a),style:L(()=>{let T=d(M.minWidth);return(typeof T=="number"||!Number.isNaN(parseInt(T)))&&(T=T+"px"),{...d(S),...i.minimized.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:T,flexBasis:T,margin:""}}}),name:R(f)??n,forceHideGoBack:R(y),minWidth:R(N)??600,minimizable:R(w)??!0,minimizedDisplay:p};return M})}function _s(n,e){if(console.info("Adding layer",n.id),re[n.id]!=null){console.error("Attempted to add layer with same ID as existing layer",n.id,re[n.id]);return}e.layers??(e.layers={}),e.layers[n.id]==null&&(e.layers[n.id]={}),re[n.id]=n,ne.emit("addLayer",n,e.layers[n.id])}function Os(n){console.info("Removing layer",n.id),ne.emit("removeLayer",n),delete re[n.id]}ne.on("update",function(e){Object.values(re).forEach(t=>{t==null||t.emit("preUpdate",e)}),Object.values(re).forEach(t=>{t==null||t.emit("update",e)}),Object.values(re).forEach(t=>{t==null||t.emit("postUpdate",e)})});const Ls=z({__name:"Node",props:{id:{}},setup(n){const e=n,t=ct(on,()=>{}),i=ct(ln,()=>{}),r=rt(null),s=L(()=>r.value&&r.value.parentElement);return ae([s,Oe(e,"id")],([u,a],[o,f])=>{o&&i(d(f)),u&&t(a,u)}),Wt(()=>i(e.id)),(u,a)=>(b(),C("div",{class:"node",ref_key:"node",ref:r},null,512))}}),Ye=Z(Ls,[["__scopeId","data-v-4673aca5"]]),Ds=z({__name:"Spacer",props:{width:{default:"8px"},height:{default:"17px"}},setup(n){return(e,t)=>(b(),C("div",{style:fe({width:e.width,height:e.height})},null,4))}});function fn(n,e="points",t=0,i=void 0){const r=se(n)?n:st(n);if(r.displayName=e,r.precision=t,r.small=i,!se(n)){const s=r[ye];s.displayName=e,s.precision=t,s.small=i}return r}function As(n){const e=st(n.value);return ae(n,t=>{Nt.value||c.gt(t,e.value)&&(e.value=t)}),e}function Rs(n){const e=st(n.value);return ae(n,(t,i)=>{Nt.value||c.gt(t,i)&&(e.value=c.add(e.value,c.sub(t,i)))}),e}const qs=new c("10^^8"),Us=new c("1e100");function Bs(n,e){const t=F(0),i=F(0),r=F(0);return ne.on("update",u=>{if(i.value=0,c.lte(n.value,Us)){r.value=n.value;return}let a=n.value,o=r.value;if(r.value=a,c.gt(a,o))if(c.gte(a,qs))a=c.slog(a,1e10),o=c.slog(o,1e10),t.value=a.sub(o).div(u),i.value=-1;else for(;c.div(a,o).log(10).div(u).gte("100")&&i.value<=5&&c.gt(o,0);)a=c.log10(a),o=c.log10(o),t.value=a.sub(o).div(u),i.value++}),L(()=>i.value===0?e?pe(e.value,n.precision,n.small)+" "+n.displayName+"/s":"":pe(t.value)+" OOM"+(i.value<0?"^OOM":"^"+i.value)+"s/sec")}function pt(n,e){const t=e??n.value;return c.eq(n.precision,0)?Qe(n.small?t:c.floor(t)):pe(t,n.precision,n.small)}let zs=0;function Gs(n="feature-"){return n+zs++}function mn(n){const e=d(n);return e!==2&&e!==!1}function Hs(n){return d(n)===1}function gn(n,...e){const t=[],i=r=>{Object.keys(r).forEach(s=>{const u=r[s];u!=null&&typeof u=="object"&&u.__v_isVNode!==!0&&(e.includes(u.type)?t.push(u):!(u instanceof c)&&!se(u)&&i(u))})};return i(n),t}const Ws=z({__name:"VueFeature",props:{id:{},components:{},wrappers:{},visibility:{default:!0},style:{default:()=>({})},classes:{default:()=>({})}},setup(n){const e=n,t=()=>e.wrappers.reduce((i,r)=>()=>r(i),()=>v(j,null,[e.components.map(i=>te(i))]))();return(i,r)=>d(mn)(d(i.visibility))?(b(),C("div",{key:0,style:fe([{visibility:d(Hs)(d(i.visibility))?"hidden":void 0},d(i.style)]),class:K({feature:!0,...d(i.classes)})},[v(t),v(Ye,{id:i.id},null,8,["id"])],6)):E("",!0)}}),pn=Symbol("VueFeature");function wt(n,e,t){return{id:Gs(n),visibility:R(e.visibility),classes:R(e.classes),style:R(e.style),components:t==null?[]:[t],wrappers:[],[pn]:!0}}function te(n,e){if(typeof n=="object"&&pn in n){const{id:t,visibility:i,style:r,classes:s,components:u,wrappers:a}=n;return v(Ws,{id:t,visibility:i,style:r,classes:s,components:u,wrappers:a},null)}return n=jt(n),(e==null?void 0:e(n))??n}function js(n){return n!=null&&typeof n=="object"&&"type"in n&&"children"in n}function hn(n){const e=F(null),t=F(void 0);function i(u){e.value==null&&(e.value=setInterval(s,250)),t.value=u}function r(){e.value!=null&&(clearInterval(e.value),e.value=null)}function s(){n(t.value)}return Wt(r),{start:i,stop:r,handleHolding:s}}function Js(n){return Object.keys(n).reduce((e,t)=>(e[nr(t)]=n[t],e),{})}const Zs=["x1","y1","x2","y2"],Ys=z({__name:"Link",props:{link:{},startNode:{},endNode:{},boundingRect:{}},setup(n){const e=n,t=L(()=>{const s=e.startNode.rect,u=e.boundingRect,a=u?{x:s.x+s.width/2-u.x,y:s.y+s.height/2-u.y}:{x:0,y:0};return e.link.offsetStart&&(a.x+=e.link.offsetStart.x,a.y+=e.link.offsetStart.y),a}),i=L(()=>{const s=e.endNode.rect,u=e.boundingRect,a=u?{x:s.x+s.width/2-u.x,y:s.y+s.height/2-u.y}:{x:0,y:0};return e.link.offsetEnd&&(a.x+=e.link.offsetEnd.x,a.y+=e.link.offsetEnd.y),a}),r=L(()=>Js(e.link));return(s,u)=>(b(),C("line",ke({"stroke-width":"15px",stroke:"white"},r.value,{x1:t.value.x,y1:t.value.y,x2:i.value.x,y2:i.value.y}),null,16,Zs))}}),Ks=z({__name:"Links",props:{links:{}},setup(n){var f;const e=n;function t(){var y;a.value=(y=r.value)==null?void 0:y.getBoundingClientRect()}const i=new ResizeObserver(t),r=rt(null),s=ct(un,F({})),u=ct(cn,F(void 0)),a=F((f=r.value)==null?void 0:f.getBoundingClientRect());ae(u,t),it(()=>{const y=r.value;y!=null&&i.observe(y),t()});const o=L(()=>{var N;const y=s.value;return((N=d(e.links))==null?void 0:N.filter(w=>{var p,k;return((p=y[w.startNode.id])==null?void 0:p.rect)&&((k=y[w.endNode.id])==null?void 0:k.rect)}))??[]});return(y,N)=>(b(),C(j,null,[o.value?(b(),C("svg",Mn(ke({key:0},y.$attrs)),[(b(!0),C(j,null,Se(o.value,(w,p)=>(b(),J(Ys,{key:p,link:w,boundingRect:a.value,startNode:d(s)[w.startNode.id],endNode:d(s)[w.endNode.id]},null,8,["link","boundingRect","startNode","endNode"]))),128))],16)):E("",!0),g("div",{ref_key:"resizeListener",ref:r,class:"resize-listener"},null,512)],64))}}),Xs=Z(Ks,[["__scopeId","data-v-95f1a2c2"]]),Qs=z({__name:"Tree",props:{nodes:{},leftSideNodes:{},rightSideNodes:{},branches:{}},setup(n){const e=n,t=()=>d(e.nodes).map(s=>v("span",{class:"row tree-row",style:"margin: 50px auto;"},[s.map(u=>te(u))])),i=()=>e.leftSideNodes==null?v(j,null,null):v("span",{class:"left-side-nodes small"},[d(e.leftSideNodes).map(s=>te(s))]),r=()=>e.rightSideNodes==null?v(j,null,null):v("span",{class:"side-nodes small"},[d(e.rightSideNodes).map(s=>te(s))]);return(s,u)=>(b(),C(j,null,[v(t),s.leftSideNodes?(b(),J(i,{key:0})):E("",!0),s.rightSideNodes?(b(),J(r,{key:1})):E("",!0),s.branches?(b(),J(Xs,{key:2,links:d(s.branches)},null,8,["links"])):E("",!0)],64))}}),ea=Z(Qs,[["__scopeId","data-v-b63a12ba"]]),ta=z({__name:"TreeNode",props:{canClick:{},display:{},color:{},glowColor:{}},emits:["click","hold"],setup(n,{emit:e}){const t=n,i=e,r=()=>t.display==null?v(j,null,null):te(t.display,a=>v("div",null,[a])),{start:s,stop:u}=hn(()=>i("hold"));return(a,o)=>(b(),C("button",{style:fe({backgroundColor:d(a.color),boxShadow:`-4px -4px 4px rgba(0, 0, 0, 0.25) inset, 0 0 20px ${d(a.glowColor)}`}),class:K({treeNode:!0,can:d(a.canClick)}),onClick:o[0]||(o[0]=f=>i("click",f)),onMousedown:o[1]||(o[1]=(...f)=>d(s)&&d(s)(...f)),onMouseleave:o[2]||(o[2]=(...f)=>d(u)&&d(u)(...f)),onMouseup:o[3]||(o[3]=(...f)=>d(u)&&d(u)(...f)),onTouchstartPassive:o[4]||(o[4]=(...f)=>d(s)&&d(s)(...f)),onTouchendPassive:o[5]||(o[5]=(...f)=>d(u)&&d(u)(...f)),onTouchcancelPassive:o[6]||(o[6]=(...f)=>d(u)&&d(u)(...f))},[v(r)],38))}}),na=Z(ta,[["__scopeId","data-v-80b5b7b8"]]),ia=Symbol("TreeNode"),ra=Symbol("Tree");function sa(n){return Ee(()=>{const e=(n==null?void 0:n())??{},{canClick:t,color:i,display:r,glowColor:s,onClick:u,onHold:a,...o}=e,f={type:ia,...o,...wt("treeNode",e,()=>v(na,{canClick:f.canClick,display:f.display,onClick:f.onClick,onHold:f.onHold,color:f.color,glowColor:f.glowColor},null)),canClick:R(t)??!0,color:R(i),display:r,glowColor:R(s),onClick:u==null?void 0:function(y){d(f.canClick)!==!1&&u.call(f,y)},onHold:a==null?void 0:function(){d(f.canClick)!==!1&&a.call(f)}};return f})}function aa(n){return Ee(()=>{const e=n(),{branches:t,nodes:i,leftSideNodes:r,rightSideNodes:s,resetPropagation:u,onReset:a,style:o,...f}=e,y=R(o);e.style=()=>({position:"static",...d(y)??{}});const N=t==null?void 0:R(t),w={type:ra,...f,...wt("tree",e,()=>v(ea,{nodes:w.nodes,leftSideNodes:w.leftSideNodes,rightSideNodes:w.rightSideNodes,branches:w.branches},null)),branches:N,isResetting:F(!1),resettingNode:rt(null),nodes:R(i),leftSideNodes:R(r),rightSideNodes:R(s),links:N==null?[]:an(N),resetPropagation:u,onReset:a,reset:function(p){var k,S;w.isResetting.value=!0,w.resettingNode.value=p,(k=w.resetPropagation)==null||k.call(w,w,p),(S=w.onReset)==null||S.call(w,p),w.isResetting.value=!1,w.resettingNode.value=null}};return w})}const oa=function(n,e){var s;const t=d(n.branches);if(t==null)return;const i=[];let r=[e];for(;r.length!==0;){const u=[];for(const a of r)for(const o of t.filter(f=>f.startNode===a))[...i,...r].includes(o.endNode)||(u.push(o.endNode),(s=o.endNode.reset)==null||s.reset());i.push(...r),r=u}};function la(n,e=null,t=0){const i=R(t);return()=>e==null||c.gte(n.value,d(i))?pt(n)+" "+n.displayName:`Reach ${c.eq(e.precision,0)?Qe(d(i)):pe(d(i),e.precision)} ${e.displayName} to unlock (You have ${c.eq(e.precision,0)?Qe(e.value):pe(e.value,e.precision)})`}const ua=Symbol("Conversion");function ca(n){return Ee(()=>{const e=n(),{baseResource:t,gainResource:i,formula:r,currentGain:s,actualGain:u,currentAt:a,nextAt:o,convert:f,spend:y,buyMax:N,onConvert:w,...p}=e,k=s==null?L(()=>{let M=c.floor(S.formula.evaluate(t.value)).max(0);return d(S.buyMax)===!1&&(M=M.min(1)),M}):R(s),S={type:ua,...p,baseResource:t,gainResource:i,formula:r(l.variable(t)),currentGain:k,actualGain:u==null?k:R(u),currentAt:a==null?L(()=>S.formula.invert(c.floor(d(S.currentGain)))):R(a),nextAt:o==null?L(()=>S.formula.invert(c.floor(d(S.currentGain)).add(1))):R(o),convert:f??function(){const M=d(S.currentGain);i.value=c.add(i.value,M),S.spend(M),w==null||w(M)},spend:y??(()=>t.value=0),buyMax:R(N)??!0,onConvert:w};return S})}function da(n){return ca(n)}const fa={class:"key"},ma=z({__name:"Hotkey",props:{hotkey:{}},setup(n){const e=n;let t="",i=!1,r=!1,s=!1;return Jt(()=>{t=e.hotkey.key,i=t.startsWith("ctrl+"),i&&(t=t.slice(5)),r=t.startsWith("shift+"),r&&(t=t.slice(6)),s=t.length==1&&t.toLowerCase()!=t.toUpperCase(),s&&(t=t.toUpperCase())}),(u,a)=>(b(),C(j,null,[d(i)?(b(),C(j,{key:0},[a[0]||(a[0]=g("div",{class:"key"},"Ctrl",-1)),a[1]||(a[1]=V("+"))],64)):E("",!0),d(r)?(b(),C(j,{key:1},[a[2]||(a[2]=g("div",{class:"key"},"Shift",-1)),a[3]||(a[3]=V("+"))],64)):E("",!0),g("div",fa,O(d(t)),1)],64))}}),ga=Z(ma,[["__scopeId","data-v-7bcb4952"]]),tt=bt({}),Ft=Symbol("Hotkey"),Je=[")","!","@","#","$","%","^","&","*","("];function pa(n){return Ee(()=>{const e=n(),{enabled:t,description:i,key:r,onPress:s,...u}=e;return{type:Ft,...u,enabled:R(t)??!0,description:R(i),key:r,onPress:s}})}ne.on("addLayer",n=>{gn(n,Ft).forEach(e=>{tt[e.key]=e})});ne.on("removeLayer",n=>{gn(n,Ft).forEach(e=>{tt[e.key]=void 0})});document.onkeydown=function(n){var i;if(((i=n.target)==null?void 0:i.tagName)==="INPUT"||qe.value&&!x.keepGoing)return;const e=[n.key];n.shiftKey&&n.ctrlKey?(e.splice(0,1),e.push("ctrl+shift+"+n.key.toUpperCase()),e.push("shift+ctrl+"+n.key.toUpperCase()),Je.includes(n.key)?(e.push("ctrl+shift+"+Je.indexOf(n.key)),e.push("shift+ctrl+"+Je.indexOf(n.key))):(e.push("ctrl+shift+"+n.key.toLowerCase()),e.push("shift+ctrl+"+n.key.toLowerCase()))):Je.includes(n.key)?(e.push("shift+"+n.key),e.push("shift+"+Je.indexOf(n.key))):n.shiftKey?(e.push("shift+"+n.key.toUpperCase()),e.push("shift+"+n.key.toLowerCase())):n.ctrlKey&&(e.splice(0,1),e.push("ctrl+"+n.key));const t=tt[e.find(r=>r in tt)??""];t!=null&&d(t.enabled)!==!1&&(n.preventDefault(),t.onPress())};ne.on("setupVue",()=>Ba(()=>{const n=Object.values(tt).filter(e=>d(e==null?void 0:e.enabled));return n.length===0?"":v("div",null,[v("br",null,null),v("h4",null,[V("Hotkeys")]),v("div",{style:"column-count: 2"},[n.map(e=>v("div",null,[v(ga,{hotkey:e},null),V(" "),d(e==null?void 0:e.description)]))])])}));const ha=Symbol("Reset");function va(n){return Ee(()=>{const e=n(),{thingsToReset:t,onReset:i,...r}=e,s={type:ha,...r,onReset:i,thingsToReset:R(t),reset:function(){const u=a=>{if(a!=null&&typeof a=="object"&&!(a instanceof c)&&!(a instanceof l)){if(Ge in a&&a[Ge]===!0)return;if(Le in a){const o=a;o.value=o[Le]}else!(a instanceof c)&&!se(a)&&Object.values(a).forEach(o=>u(o))}};d(s.thingsToReset).forEach(u),ne.emit("reset",s),i==null||i()}};return s})}const ot={};ne.on("removeLayer",n=>{var e;(e=ot[n.id])==null||e.call(ot),ot[n.id]=void 0});const ba=z({__name:"Sticky",setup(n){const e=F("0"),t=new ResizeObserver(r),i=rt(null);function r(){let s=i.value;if(s==null)return;let u=0;for(;s.previousSibling;){const a=s.previousSibling;a.dataset&&"vSticky"in a.dataset&&(u+=a.offsetHeight),s=a}e.value=u+"px"}return Be(r),document.fonts.ready.then(r),it(()=>{var u;const s=(u=i.value)==null?void 0:u.parentElement;s&&t.observe(s)}),(s,u)=>(b(),C("div",{class:"sticky",style:fe({top:e.value}),ref_key:"element",ref:i,"data-v-sticky":""},[xe(s.$slots,"default",{},void 0,!0)],4))}}),ya=Z(ba,[["__scopeId","data-v-10a04be9"]]),wa=z({__name:"Resource",props:{resource:{},color:{}},setup(n){const e=n,t=L(()=>pt(e.resource));return(i,r)=>(b(),C("h2",{style:fe({color:i.color,"text-shadow":"0px 0px 10px "+i.color})},O(t.value),5))}}),Na={key:0},ka={key:1},Ca=z({__name:"MainDisplay",props:{resource:{},color:{},classes:{},style:{},effectDisplay:{}},setup(n){const e=n,t=F(null),i=()=>jt(e.effectDisplay),r=L(()=>c.lt(e.resource.value,"1e1000"));return(s,u)=>(b(),J(ya,null,{default:_(()=>{var a;return[g("div",{class:K(["main-display-container",s.classes??{}]),style:fe([{height:`${(((a=t.value)==null?void 0:a.clientHeight)??0)+20}px`},s.style??{}])},[g("div",{class:"main-display",ref_key:"displayRef",ref:t},[r.value?(b(),C("span",Na,"You have ")):E("",!0),v(wa,{resource:s.resource,color:s.color||"white"},null,8,["resource","color"]),V(" "+O(s.resource.displayName)+" ",1),s.effectDisplay?(b(),C("span",ka,[u[0]||(u[0]=V(", ")),v(i)])):E("",!0)],512)],6)]}),_:1}))}}),Sa={key:0,class:"material-icons pinned"},Ia=z({__name:"Tooltip",props:{pinned:{},display:{},style:{},classes:{},direction:{},xoffset:{},yoffset:{}},setup(n){const e=n,t=F(!1),i=L(()=>{var a;return((a=e.pinned)==null?void 0:a.value)===!0||t.value}),r=()=>te(e.display);function s(a){const o=e.pinned;a.shiftKey&&o!=null&&(o.value=!o.value,a.stopPropagation(),a.preventDefault())}const u=L(()=>{var a;return((a=e.pinned)==null?void 0:a.value)===!0&&Et[H.theme].showPin});return(a,o)=>(b(),C("div",{class:K(["tooltip-container",{shown:i.value}]),onMouseenter:o[0]||(o[0]=f=>t.value=!0),onMouseleave:o[1]||(o[1]=f=>t.value=!1),onClickCapture:s},[xe(a.$slots,"default",{},void 0,!0),v(Ht,{name:"fade"},{default:_(()=>[i.value?(b(),C("div",{key:0,class:K(["tooltip",{top:d(a.direction)===d(Y).Up,left:d(a.direction)===d(Y).Left,right:d(a.direction)===d(Y).Right,bottom:d(a.direction)===d(Y).Down,...d(a.classes)}]),style:fe([{"--xoffset":d(a.xoffset)||"0px","--yoffset":d(a.yoffset)||"0px"},d(a.style)??{}])},[u.value?(b(),C("span",Sa,"push_pin")):E("",!0),v(r)],6)):E("",!0)]),_:1})],34))}}),Q=Z(Ia,[["__scopeId","data-v-ad4ea959"]]);function xa(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!Tn(n)}function Ma(n,e){const t=st(!1,!1),i=Ee(()=>{const r=e(),{pinnable:s,display:u,direction:a,xoffset:o,yoffset:f,...y}=r;return s===!1&&Vs(t),{...y,...wt("tooltip",r),pinnable:s??!0,pinned:s===!1?void 0:t,display:u,direction:R(a??Y.Up),xoffset:R(o),yoffset:R(f)}});er(n,r=>{i.id,r.tooltip=i,r.wrappers.push(s=>mn(i.visibility??!0)?v(Q,{pinned:i.pinned,display:i.display,classes:i.classes,style:i.style,direction:i.direction,xoffset:i.xoffset,yoffset:i.yoffset},xa(s)?s:{default:()=>[s]}):v(j,null,[s]))})}const Ta=["disabled"],$a=z({__name:"Clickable",props:{canClick:{},display:{}},emits:["click","hold"],setup(n,{emit:e}){const t=n,i=e,r=()=>t.display==null?v(j,null,null):te(t.display),{start:s,stop:u}=hn(()=>i("hold"));return(a,o)=>(b(),C("button",{onClick:o[0]||(o[0]=f=>i("click",f)),onMousedown:o[1]||(o[1]=(...f)=>d(s)&&d(s)(...f)),onMouseleave:o[2]||(o[2]=(...f)=>d(u)&&d(u)(...f)),onMouseup:o[3]||(o[3]=(...f)=>d(u)&&d(u)(...f)),onTouchstartPassive:o[4]||(o[4]=(...f)=>d(s)&&d(s)(...f)),onTouchendPassive:o[5]||(o[5]=(...f)=>d(u)&&d(u)(...f)),onTouchcancelPassive:o[6]||(o[6]=(...f)=>d(u)&&d(u)(...f)),class:K({clickable:!0,can:d(a.canClick),locked:!d(a.canClick)}),disabled:!d(a.canClick)},[v(r)],42,Ta))}}),Pa=Z($a,[["__scopeId","data-v-396784a5"]]),Ea=Symbol("Clickable");function Fa(n){return Ee(()=>{const e=(n==null?void 0:n())??{},{canClick:t,display:i,onClick:r,onHold:s,...u}=e;let a;typeof i=="object"&&!js(i)?a=()=>v("span",null,[i.title!=null?v("div",null,[te(i.title,f=>v("h3",null,[f]))]):null,te(i.description,f=>v("div",null,[f]))]):i!=null&&(a=i);const o={type:Ea,...u,...wt("clickable",e,()=>v(Pa,{canClick:o.canClick,onClick:o.onClick,onHold:o.onClick,display:o.display},null)),canClick:R(t)??!0,display:a,onClick:r==null?void 0:function(f){d(o.canClick)!==!1&&r.call(o,f)},onHold:s==null?void 0:function(){d(o.canClick)!==!1&&s.call(o)}};return o})}function Va(n){const e=Fa(()=>{const t=n(),{conversion:i,tree:r,treeNode:s,resetTime:u,resetDescription:a,showNextAt:o,minimumGain:f,display:y,canClick:N,onClick:w,...p}=t;return{...p,conversion:i,tree:r,treeNode:s,resetTime:u,resetDescription:R(a)??L(()=>c.lt(i.gainResource.value,1e3)?"Reset for ":""),showNextAt:R(o)??!0,minimumGain:R(f)??1,canClick:R(N)??L(()=>c.gte(d(i.actualGain),d(e.minimumGain))),display:y??(()=>v("span",null,[d(e.resetDescription),v("b",null,[pt(i.gainResource,c.max(d(i.actualGain),d(e.minimumGain)))])," ",i.gainResource.displayName,d(e.showNextAt)!=null?v("div",null,[v("br",null,null),d(i.buyMax)?"Next:":"Req:"," ",pt(i.baseResource,!d(i.buyMax)&&c.gte(d(i.actualGain),1)?d(i.currentAt):d(i.nextAt))," ",i.baseResource.displayName]):null])),onClick:function(k){d(e.canClick)!==!1&&(i.convert(),r.reset(s),u&&(u.value=u[Le]),w==null||w.call(e,k))}}});return e}function _a(n){const e=sa(()=>{const t=n(),{display:i,append:r,layerID:s,...u}=t;return{...u,layerID:s,display:i??s,append:R(r)??!0,onClick(){if(d(e.append))if(x.tabs.includes(s)){const a=x.tabs.lastIndexOf(s);x.tabs.splice(a,1)}else x.tabs.push(s);else x.tabs.splice(1,1,s)}}});return e}const Bt="p",ht=dn(Bt,()=>{const n="Prestige",e="#4BDC13",t=fn(0,"prestige points"),i=da(()=>({formula:f=>f.div(10).sqrt(),baseResource:xt.points,gainResource:t})),r=va(()=>({thingsToReset:()=>[ht]})),s=_a(()=>({layerID:Bt,color:e,reset:r})),u=Ma(s,()=>({display:la(t),pinnable:!0})),a=Va(()=>({conversion:i,tree:xt.tree,treeNode:s})),o=pa(()=>({description:"Reset for prestige points",key:"p",onPress:a.onClick}));return{name:n,color:e,points:t,tooltip:u,display:()=>v(j,null,[v(Ca,{resource:t,color:e},null),te(a)]),treeNode:s,hotkey:o}}),xt=dn("main",n=>{const e=fn(10),t=As(e),i=Rs(e),r=L(()=>new c(1));n.on("update",a=>{e.value=c.add(e.value,c.times(r.value,a))});const s=Bs(e,r),u=aa(()=>({nodes:an([[ht.treeNode]]),branches:[],onReset(){e.value=Ot(u.resettingNode.value)===Ot(ht.treeNode)?0:10,t.value=e.value,i.value=e.value},resetPropagation:oa}));return{name:"Tree",links:u.links,display:()=>v(j,null,[x.devSpeed===0?v("div",null,[V("Game Paused"),v(Ye,{id:"paused"},null)]):null,x.devSpeed!=null&&x.devSpeed!==0&&x.devSpeed!==1?v("div",null,[V("Dev Speed: "),pe(x.devSpeed),V("x"),v(Ye,{id:"devspeed"},null)]):null,x.offlineTime!=null&&x.offlineTime!==0?v("div",null,[V("Offline Time: "),yt(x.offlineTime),v(Ye,{id:"offline"},null)]):null,v("div",null,[c.lt(e.value,"1e1000")?v("span",null,[V("You have ")]):null,v("h2",null,[pe(e.value)]),c.lt(e.value,"1e1e6")?v("span",null,[V(" points")]):null]),c.gt(r.value,0)?v("div",null,[V("("),s.value,V(")"),v(Ye,{id:"oomps"},null)]):null,v(Ds,null,null),te(u)]),points:e,best:t,total:i,oomps:s,tree:u}}),Oa=n=>[xt,ht],qe=L(()=>!1);function we(n={}){return Object.assign({id:`${B.id}-0`,name:"Default Save",tabs:B.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:B.id,modVersion:B.versionNumber,layers:{}},n)}function ie(n){const e=$e.compressToUTF16(ze(n??x));return localStorage.setItem((n??x).id,e),e}async function La(){qa();try{let n=localStorage.getItem(H.active);if(n==null){await Ne(Ue());return}if(n=Te(n),n==null)throw"Unable to determine save encoding";const e=JSON.parse(n);if(e.modID!==B.id){await Ne(Ue());return}e.id=H.active,await Ne(e)}catch(n){console.error(`Failed to load save. Falling back to new save.
`,n),await Ne(Ue())}}function Te(n){if(n[0]!=="{")if(n[0]==="e")n=decodeURIComponent(escape(atob(n)));else if(n[0]==="ᯡ")n=$e.decompressFromUTF16(n);else return console.warn("Unable to determine preset encoding",n),null;return n}function Ue(){const n=Ke(),e=we({id:n});return ie(e),H.saves.push(n),e}function Ke(){let n,e=0;do n=`${B.id}-${e++}`;while(localStorage.getItem(n)!=null);return n}const Nt=F(!1);async function Ne(n){console.info("Loading save",n),Nt.value=!0;for(const e in re){const t=re[e];t!=null&&Os(t)}Oa().forEach(e=>_s(e,n)),n=we(n),n.offlineProd&&n.time!=null&&n.time&&n.devSpeed!==0&&(n.offlineTime==null&&(n.offlineTime=0),n.offlineTime+=Math.min(n.offlineTime+(Date.now()-n.time)/1e3,B.offlineLimit*3600)),n.time=Date.now(),n.modVersion!==B.versionNumber&&(n.modVersion,n.modVersion=B.versionNumber),Object.assign(x,n),H.active=x.id,ne.emit("onLoad")}const ge=bt({});function Da(n){if(ge[n]==null){let e=localStorage.getItem(n);if(e==null)ge[n]={error:"Save doesn't exist in localStorage",id:n};else if(e==="dW5kZWZpbmVk")ge[n]={error:"Save is undefined",id:n};else try{if(e=Te(e),e==null)return console.warn("Unable to determine preset encoding",e),ge[n]={error:"Unable to determine preset encoding",id:n},ge[n];ge[n]={...JSON.parse(e),id:n}}catch(t){ge[n]={error:t,id:n},console.warn(`Failed to load info about save with id ${n}:
${t}
${e}`)}}return ge[n]}function Aa(){Object.keys(ge).forEach(n=>delete ge[n])}function lt(n){ge[n]=void 0}setInterval(()=>{x.autosave&&ie()},1e3);window.onbeforeunload=()=>{x.autosave&&ie()};window.save=ie;const Ra=window.hardReset=async()=>{await Ne(Ue())};window.deleteLowerSaves=()=>{const n=Object.values(H.saves).indexOf(x.id)+1;Object.values(H.saves).slice(n).forEach(e=>localStorage.removeItem(e)),H.saves=H.saves.slice(0,n)};const nt=He({active:"",saves:[],showTPS:!0,theme:Pt.Nordic,unthrottled:!1,alignUnits:!1,showHealthWarning:!0});ae(nt,n=>{const e=$e.compressToUTF16(JSON.stringify(n));localStorage.setItem(B.id,e)},{deep:!0});const H=window.settings=nt;window.hardResetSettings=()=>{const n={active:"",saves:[],showTPS:!0,theme:Pt.Nordic,unthrottled:!1,alignUnits:!1,showHealthWarning:!0};ne.emit("loadSettings",n),Object.assign(nt,n),Ra()};function qa(){try{let n=localStorage.getItem(B.id);if(n!=null&&n!==""){if(n=Te(n),n==null){console.warn("Unable to determine settings encoding",n);return}const e=JSON.parse(n);typeof e=="object"&&Object.assign(nt,e)}ne.emit("loadSettings",nt)}catch{}}const Ua=He([]),vn=He([]);function Ba(n){vn.push(n)}const za=He([]),ue=F(),ve=F([]),We=F([]);function Ga(){var n;((n=ue.value)==null?void 0:n.loggedIn)===!0&&(ve.value.length>0||ue.value.getSaveList().then(bn).then(e=>{We.value=e.map(t=>t.content.id)}).catch(console.error))}_n({supportsSaving:!0,supportsSaveManager:!0,onLoggedInChanged:zt}).then(n=>{ue.value=n,zt(n)}).catch(console.error);function zt(n){n.loggedIn===!0&&(ve.value.length>0||(n.getSaveList().then(e=>{const t=bn(e);if(We.value=t.map(i=>i.content.id),x.timePlayed<120*1e3&&t.length>0){const i=t.reduce((r,s)=>r.content.time<s.content.time?s:r);Ne(i.content)}}).catch(console.error),setInterval(Ga,60*1e3)))}function bn(n){const e=new Set(H.saves.slice()),t=new Set(new Array(11).fill(0).map((r,s)=>s)),i=Object.keys(n).map(r=>{const{label:s,content:u}=n[parseInt(r)];try{return{slot:parseInt(r),label:s,content:JSON.parse(Te(u)??"")}}catch{return null}}).filter(r=>r!=null&&typeof r.content.id=="string"&&typeof r.content.time=="number"&&typeof r.content.timePlayed=="number").filter(r=>{var u;r.label!=null&&(r.content.name=r.label),t.delete(r.slot);const s=H.saves.find(a=>a===r.content.id);if(s==null)H.saves.push(r.content.id),ie(we(r.content));else{e.delete(s);try{const a=JSON.parse(Te(localStorage.getItem(s)??"")??"");if(a==null)return!1;a.id=s,a.time=a.time??0,a.timePlayed=a.timePlayed??0;const o=Math.abs(a.timePlayed-r.content.timePlayed),f=Math.abs(a.time-r.content.time);o<120*1e3&&f<120*1e3?a.time<r.content.time?(ie(we(r.content)),H.active===s&&Ne(r.content)):((u=ue.value)==null||u.save(r.slot,$e.compressToUTF16(ze(we(a))),a.name??r.label).catch(console.error),r.content=a):ve.value.push({id:s,cloud:r.content,local:a,slot:r.slot})}catch{return!1}}return!0});return e.forEach(r=>{var s;try{if(t.size>0){const u=localStorage.getItem(r)??"",a=JSON.parse(Te(u)??""),o=t.values().next().value;if(o==null)return;(s=ue.value)==null||s.save(o,u,a.name).then(()=>We.value.push(a.id)).catch(console.error),t.delete(o)}}catch{}}),i}const Ha={class:"field"},Wa={key:0,class:"field-title"},yn=z({__name:"Select",props:{title:{},modelValue:{},options:{},placeholder:{},closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,i=e,r=()=>t.title?te(t.title,a=>v("span",null,[a])):v(j,null,null),s=F(t.options.find(a=>a.value===t.modelValue)??null);ae(Oe(t,"modelValue"),a=>{d(s)!==a&&(s.value=t.options.find(o=>o.value===a)??null)});function u(a){i("update:modelValue",a.value)}return(a,o)=>(b(),C("div",Ha,[a.title?(b(),C("span",Wa,[v(r)])):E("",!0),v(d(Ln),{options:a.options,modelValue:s.value,"onUpdate:modelValue":[o[0]||(o[0]=f=>s.value=f),u],min:1,placeholder:a.placeholder,"close-on-select":a.closeOnSelect,"label-by":"label"},null,8,["options","modelValue","placeholder","close-on-select"])]))}}),ja={class:"field"},Ja={key:0,class:"field-title"},Za=["placeholder"],Ya=z({__name:"Text",props:{title:{},modelValue:{},textArea:{type:Boolean},placeholder:{},maxHeight:{},submitOnBlur:{type:Boolean}},emits:["update:modelValue","submit","cancel"],setup(n,{emit:e}){const t=n,i=e,r=()=>t.title==null?v(j,null,null):te(t.title,f=>v("span",null,[f])),s=rt(null);it(()=>{var f;(f=s.value)==null||f.focus()});const u=L({get(){return d(t.modelValue)??""},set(f){i("update:modelValue",f)}});function a(){i("submit")}function o(){t.submitOnBlur!==!1?i("submit"):i("cancel")}return(f,y)=>(b(),C("form",{onSubmit:Xe(a,["prevent"])},[g("div",ja,[f.title?(b(),C("span",Ja,[v(r)])):E("",!0),f.textArea?(b(),J(d(Dn),{key:1,modelValue:u.value,"onUpdate:modelValue":y[0]||(y[0]=N=>u.value=N),placeholder:f.placeholder,maxHeight:f.maxHeight,onBlur:o,ref_key:"field",ref:s},null,8,["modelValue","placeholder","maxHeight"])):Tt((b(),C("input",{key:2,type:"text","onUpdate:modelValue":y[1]||(y[1]=N=>u.value=N),placeholder:f.placeholder,class:K({fullWidth:!f.title}),onBlur:o,ref_key:"field",ref:s},null,42,Za)),[[$n,u.value]])])],32))}}),wn=Z(Ya,[["__scopeId","data-v-495d5085"]]),Ka={key:0},Xa=["disabled"],Qa={key:0},eo=z({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(n,{emit:e}){const t=n,i=e,r=F(!1);ae(r,a=>{i("confirmingChanged",a)});function s(){if(t.skipConfirm){i("click");return}r.value&&i("click"),r.value=!r.value}function u(){r.value=!1}return(a,o)=>(b(),C("span",{class:K(["container",{confirming:r.value}])},[r.value?(b(),C("span",Ka,"Are you sure?")):E("",!0),g("button",{onClick:Xe(s,["stop"]),class:"button danger",disabled:a.disabled},[r.value?(b(),C("span",Qa,"Yes")):xe(a.$slots,"default",{key:1},void 0,!0)],8,Xa),r.value?(b(),C("button",{key:1,class:"button",onClick:Xe(u,["stop"])},"No")):E("",!0)],2))}}),to=Z(eo,[["__scopeId","data-v-b3b9693a"]]),no={key:0,class:"handle material-icons"},io={key:1,class:"actions"},ro={key:2,class:"actions"},so={key:3,class:"details"},ao=["disabled"],oo={class:"save-version"},lo={key:1,class:"time"},uo={key:4,class:"details"},co={key:5,class:"details error"},fo=z({__name:"Save",props:{save:{},readonly:{type:Boolean}},emits:["export","open","duplicate","delete","editName"],setup(n,{emit:e}){const t=n,i=e,r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),s=F(!1),u=F(!1),a=F("");ae(s,()=>a.value=t.save.name??"");const o=L(()=>t.save!=null&&t.save.id===x.id&&!t.readonly),f=L(()=>o.value?x.time:(t.save!=null&&t.save.time)??0),y=L(()=>{var w;return!t.readonly&&((w=ue.value)==null?void 0:w.loggedIn)===!0&&We.value.includes(t.save.id)});function N(){i("editName",a.value),s.value=!1}return(w,p)=>(b(),C("div",{class:K(["save",{active:o.value,readonly:w.readonly}])},[w.readonly!==!0?(b(),C("div",no,"drag_handle")):E("",!0),!s.value&&w.readonly!==!0?(b(),C("div",io,[w.save.error==null&&!u.value?(b(),J($t,{key:0,onClick:p[0]||(p[0]=k=>i("export")),class:"button",left:""},{default:_(()=>[v(Q,{display:"Export",direction:d(Y).Left,class:"info"},{default:_(()=>p[8]||(p[8]=[g("span",{class:"material-icons"},"content_paste",-1)])),_:1},8,["direction"])]),_:1})):E("",!0),w.save.error==null&&!u.value?(b(),C("button",{key:1,onClick:p[1]||(p[1]=k=>i("duplicate")),class:"button"},[v(Q,{display:"Duplicate",direction:d(Y).Left,class:"info"},{default:_(()=>p[9]||(p[9]=[g("span",{class:"material-icons"},"content_copy",-1)])),_:1},8,["direction"])])):E("",!0),w.save.error==null&&!u.value?(b(),C("button",{key:2,onClick:p[2]||(p[2]=k=>s.value=!s.value),class:"button"},[v(Q,{display:"Edit Name",direction:d(Y).Left,class:"info"},{default:_(()=>p[10]||(p[10]=[g("span",{class:"material-icons"},"edit",-1)])),_:1},8,["direction"])])):E("",!0),v(to,{disabled:o.value,onClick:p[3]||(p[3]=k=>i("delete")),onConfirmingChanged:p[4]||(p[4]=k=>u.value=k)},{default:_(()=>[v(Q,{display:"Delete",direction:d(Y).Left,class:"info"},{default:_(()=>p[11]||(p[11]=[g("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)])),_:1},8,["direction"])]),_:1},8,["disabled"])])):w.readonly!==!0?(b(),C("div",ro,[g("button",{onClick:N,class:"button"},[v(Q,{display:"Save",direction:d(Y).Left,class:"info"},{default:_(()=>p[12]||(p[12]=[g("span",{class:"material-icons"},"check",-1)])),_:1},8,["direction"])]),g("button",{onClick:p[5]||(p[5]=k=>s.value=!s.value),class:"button"},[v(Q,{display:"Cancel",direction:d(Y).Left,class:"info"},{default:_(()=>p[13]||(p[13]=[g("span",{class:"material-icons"},"close",-1)])),_:1},8,["direction"])])])):E("",!0),w.save.error==null&&!s.value?(b(),C("div",so,[y.value?(b(),J(Q,{key:0,display:"Synced!",direction:d(Y).Right},{default:_(()=>p[14]||(p[14]=[g("span",{class:"material-icons synced"},"cloud",-1)])),_:1},8,["direction"])):E("",!0),g("button",{class:"button open",onClick:p[6]||(p[6]=k=>i("open")),disabled:w.readonly},[g("h3",null,O(w.save.name),1)],8,ao),g("span",oo,"v"+O(w.save.modVersion),1),p[15]||(p[15]=g("br",null,null,-1)),f.value?(b(),C("div",lo," Last played "+O(d(r).format(f.value)),1)):E("",!0)])):w.save.error==null&&s.value?(b(),C("div",uo,[v(wn,{modelValue:a.value,"onUpdate:modelValue":p[7]||(p[7]=k=>a.value=k),class:"editname",onSubmit:N},null,8,["modelValue"])])):(b(),C("div",co,[V(" Error: Failed to load save with id "+O(w.save.id),1),p[16]||(p[16]=g("br",null,null,-1)),V(O(w.save.error),1)]))],2))}}),Mt=Z(fo,[["__scopeId","data-v-0058f767"]]),mo={key:0,style:{color:"var(--danger)"}},go={class:"modal-footer"},po={class:"field"},ho={class:"field-buttons"},vo={class:"footer"},bo=z({__name:"SavesManager",setup(n,{expose:e}){const t=F(!1),i=F(null);e({open(){t.value=!0}});const r=F(!1),s=F(""),u=F(null);ae(s,T=>{T?Be(()=>{try{if(T=Te(T)??"",T===""){console.warn("Unable to determine preset encoding",T),r.value=!0;return}const P=JSON.parse(T);if(typeof P!="object"){r.value=!0;return}const q=Ke();P.id=q,ie(P),s.value="",r.value=!1,H.saves.push(q)}catch{r.value=!0}}):r.value=!1});let a=Object.assign({}),o=F(Object.keys(a).reduce((T,P)=>(T.push({label:P.split("/").slice(-1)[0].slice(0,-4),value:a[P]}),T),[]));ae(t,T=>{T&&Aa()});const f=L(()=>H.saves.reduce((T,P)=>(T[P]=Da(P),T),{})),y=L(()=>{var T;return((T=ue.value)==null?void 0:T.loggedIn)===!0&&H.saves.length<We.value.length});function N(T){let P;switch(x.id===T?P=ze(x):P=JSON.stringify(f.value[T]),B.exportEncoding){default:console.warn(`Unknown save encoding: ${B.exportEncoding}. Defaulting to lz`);case"lz":P=$e.compressToUTF16(P);break;case"base64":P=btoa(unescape(encodeURIComponent(P)));break;case"plain":break}const q=document.createElement("textarea");q.value=P,document.body.appendChild(q),q.select(),q.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(q)}function w(T){x.id===T&&ie();const P={...f.value[T],id:Ke()};ie(P),H.saves.push(P.id)}function p(T){var P;((P=ue.value)==null?void 0:P.loggedIn)===!0&&ue.value.getSaveList().then(q=>{var he;const oe=Object.keys(q).find(kt=>{const Ct=q[parseInt(kt)].content;try{if(JSON.parse(Ct).id===T)return!0}catch{return!1}});oe!=null&&((he=ue.value)==null||he.save(parseInt(oe),"","").catch(console.error))}),H.saves=H.saves.filter(q=>q!==T),localStorage.removeItem(T),lt(T)}function k(T){f.value[x.id].time=x.time,ie(),lt(x.id),Ne(f.value[T]),lt(T)}function S(T){if(u.value=T,Be(()=>{u.value=null}),T=Te(T)??"",T===""){console.warn("Unable to determine preset encoding",T);return}const P=JSON.parse(T);P.id=Ke(),ie(P),H.saves.push(P.id),k(P.id)}function M(T,P){const q=f.value[T];q!=null&&(q.name=P,x.id===T?(x.name=P,ie()):(ie(q),lt(T)))}return(T,P)=>(b(),J(Pe,{modelValue:t.value,"onUpdate:modelValue":P[4]||(P[4]=q=>t.value=q),ref_key:"modal",ref:i},{header:_(()=>P[5]||(P[5]=[g("h2",null,"Saves Manager",-1)])),body:_(({shown:q})=>[y.value?(b(),C("div",mo," Not all saves are synced! You may need to delete stale saves. ")):E("",!0),q?(b(),J(d(On),{key:1,list:d(H).saves,handle:".handle",itemKey:oe=>oe},{item:_(({element:oe})=>[v(Mt,{save:f.value[oe],onOpen:he=>k(oe),onExport:he=>N(oe),onEditName:he=>M(oe,he),onDuplicate:he=>w(oe),onDelete:he=>p(oe)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):E("",!0)]),footer:_(()=>[g("div",go,[v(wn,{modelValue:s.value,"onUpdate:modelValue":P[0]||(P[0]=q=>s.value=q),title:"Import Save",placeholder:"Paste your save here!",class:K({importingFailed:r.value})},null,8,["modelValue","class"]),g("div",po,[P[6]||(P[6]=g("span",{class:"field-title"},"Create Save",-1)),g("div",ho,[g("button",{class:"button",onClick:P[1]||(P[1]=q=>k(d(Ue)().id))},"New Game"),Object.keys(d(o)).length>0?(b(),J(yn,{key:0,options:d(o),modelValue:u.value,"onUpdate:modelValue":P[2]||(P[2]=q=>S(q)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):E("",!0)])]),g("div",vo,[P[7]||(P[7]=g("div",{style:{"flex-grow":"1"}},null,-1)),g("button",{class:"button modal-default-button",onClick:P[3]||(P[3]=q=>t.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}}),Vt=Z(bo,[["__scopeId","data-v-99458d64"]]),yo={class:"vga-footer"},wo=z({__name:"AddictionWarning",setup(n){const e=F(!1);Jt(()=>{B.disableHealthWarning===!1&&H.showHealthWarning&&G.mouseActivity.filter(i=>i).length>6&&(e.value=!0)});function t(){H.showHealthWarning=!1,e.value=!1}return(i,r)=>(b(),C(j,null,[v(Pe,ke({modelValue:e.value,"onUpdate:modelValue":r[1]||(r[1]=s=>e.value=s)},i.$attrs),{header:_(()=>r[2]||(r[2]=[g("div",{class:"vga-modal-header"},[g("h2",null,"Kindly consider taking a break.")],-1)])),body:_(()=>r[3]||(r[3]=[g("p",null," You've been actively enjoying this game for awhile recently - and it's great that you've been having a good time! That said, there are dangers to games like these that you should be aware of: ",-1),g("p",null," While incremental games can be fun and even healthy in certain contexts, they can exacerbate video game addiction even more than other genres. If you feel like playing incremental games is taking priority over other things in your life, or manipulating your sleep schedule, it may be prudent to seek help. ",-1),g("h4",null,"Resources:",-1),g("p",null,[g("span",null,[g("a",{style:{display:"inline"},href:"https://www.samhsa.gov/",target:"_blank"}," SAMHSA "),V(" ("),g("a",{style:{display:"inline"},href:"tel:1-800-662-4357"},"1-800-662-HELP"),V(") ")]),g("br"),g("a",{href:"https://www.reddit.com/r/StopGaming/"},"r/StopGaming")],-1)])),footer:_(()=>[g("div",yo,[g("button",{onClick:t,class:"button"},"Never show this again"),g("button",{onClick:r[0]||(r[0]=s=>e.value=!1),class:"button"},"Close")])]),_:1},16,["modelValue"]),v(Vt,{ref:"savesManager"},null,512)],64))}}),No=Z(wo,[["__scopeId","data-v-84eac81b"]]),ko={class:"cloud-saves-modal-header"},Co=["onClick"],So={key:0,class:"note"},Io={key:1,class:"note"},xo=["onClick"],Mo={key:0,class:"note"},To={key:1,class:"note"},$o=["onClick"],Po=z({__name:"CloudSaveResolver",setup(n){const e=F(!1),t=F([]),i=L(()=>ve.value.length>1?"saves":"save"),r=F(null);ae(()=>ve.value.length>0,f=>{f&&(t.value=ve.value.map(({local:y,cloud:N})=>(y.time??0)<(N.time??0)?"cloud":"local"),e.value=!0)},{immediate:!0}),ae(()=>{var f;return(f=r.value)==null?void 0:f.isOpen},f=>{f===!1&&(ve.value=[])});function s(f){t.value[f]="local"}function u(f){t.value[f]="cloud"}function a(f){t.value[f]="both"}function o(){var f,y;for(let N=0;N<t.value.length;N++){const{slot:w,local:p,cloud:k}=ve.value[N];switch(t.value[N]){case"local":(f=ue.value)==null||f.save(w,$e.compressToUTF16(ze(we(p))),k.name).catch(console.error);break;case"cloud":ie(we(k));break;case"both":const S=Ke();ie({...we(k),id:S}),H.saves.push(S),(y=ue.value)==null||y.save(w,$e.compressToUTF16(ze(we(p))),k.name).catch(console.error);break}}e.value=!1}return(f,y)=>(b(),J(Pe,{modelValue:e.value,"onUpdate:modelValue":y[0]||(y[0]=N=>e.value=N),width:"960px",ref_key:"modal",ref:r,"prevent-closing":!0},{header:_(()=>[g("div",ko,[g("h2",null,"Cloud "+O(i.value)+" loaded!",1)])]),body:_(()=>[g("div",null," Upon loading, your cloud "+O(i.value)+" "+O(d(ve).length>1?"appear":"appears")+" to be out of sync with your local "+O(i.value)+". Which "+O(i.value)+" do you want to keep? ",1),y[4]||(y[4]=g("br",null,null,-1)),(b(!0),C(j,null,Se(d(d(ve)),(N,w)=>(b(),C("div",{key:N.id,class:"conflict-container"},[g("div",{onClick:p=>u(w),class:K({selected:t.value[w]==="cloud"})},[g("h2",null,[y[1]||(y[1]=V(" Cloud ")),(N.cloud.time??0)>(N.local.time??0)?(b(),C("span",So,"(more recent)")):E("",!0),(N.cloud.timePlayed??0)>(N.local.timePlayed??0)?(b(),C("span",Io,"(more playtime)")):E("",!0)]),v(Mt,{save:N.cloud,readonly:!0},null,8,["save"])],10,Co),g("div",{onClick:p=>s(w),class:K({selected:t.value[w]==="local"})},[g("h2",null,[y[2]||(y[2]=V(" Local ")),(N.cloud.time??0)<=(N.local.time??0)?(b(),C("span",Mo,"(more recent)")):E("",!0),(N.cloud.timePlayed??0)<=(N.local.timePlayed??0)?(b(),C("span",To,"(more playtime)")):E("",!0)]),v(Mt,{save:N.local,readonly:!0},null,8,["save"])],10,xo),g("div",{onClick:p=>a(w),class:K({selected:t.value[w]==="both"}),style:{"flex-basis":"30%"}},y[3]||(y[3]=[g("h2",null,"Both",-1),g("div",{class:"save"},"Keep Both",-1)]),10,$o)]))),128))]),footer:_(()=>[g("div",{class:"cloud-saves-footer"},[g("button",{onClick:o,class:"button"},"Confirm")])]),_:1},8,["modelValue"]))}}),Eo=Z(Po,[["__scopeId","data-v-c79a1b2e"]]),Fo={class:"field"},Vo=z({__name:"Toggle",props:{title:{},modelValue:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,i=e,r=()=>te(t.title??"",u=>v("span",null,[u])),s=L({get(){return!!t.modelValue},set(u){i("update:modelValue",u)}});return(u,a)=>(b(),C("label",Fo,[Tt(g("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":a[0]||(a[0]=o=>s.value=o)},null,512),[[Pn,s.value]]),v(r)]))}}),be=Z(Vo,[["__scopeId","data-v-faad62a6"]]),_o={class:"game-over-modal-header"},Oo=["src","alt"],Lo={class:"game-over-modal-title"},Do={key:0},Ao={key:0},Ro=["href"],qo={key:1},Uo=z({__name:"GameOverScreen",setup(n){const{title:e,logo:t,discordName:i,discordLink:r,versionNumber:s,versionTitle:u}=B,a=L(()=>yt(x.timePlayed)),o=L(()=>qe.value&&!x.keepGoing),f=Oe(x,"autosave");function y(){x.keepGoing=!0}function N(){Ne(Ue())}return(w,p)=>(b(),J(Pe,{"model-value":o.value},{header:_(()=>[g("div",_o,[d(t)?(b(),C("img",{key:0,class:"game-over-modal-logo",src:d(t),alt:d(e)},null,8,Oo)):E("",!0),g("div",Lo,[p[1]||(p[1]=g("h2",null,"Congratulations!",-1)),g("h4",null,"You've beaten "+O(d(e))+" v"+O(d(s))+": "+O(d(u)),1)])])]),body:_(({shown:k})=>[k?(b(),C("div",Do,[g("div",null,"It took you "+O(a.value)+" to beat the game.",1),p[4]||(p[4]=g("br",null,null,-1)),p[5]||(p[5]=g("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),p[6]||(p[6]=g("br",null,null,-1)),d(r)&&d(i)?(b(),C("div",Ao,[g("a",{href:d(r),class:"game-over-modal-discord-link"},[p[2]||(p[2]=g("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),V(" "+O(d(i)),1)],8,Ro)])):(b(),C("div",qo,p[3]||(p[3]=[g("a",{href:"https://discord.gg/yJ4fjnjU54",class:"game-over-modal-discord-link"},[g("span",{class:"material-icons game-over-modal-discord"},"discord"),V(" Profectus & Friends ")],-1)]))),v(be,{title:"Autosave",modelValue:f.value,"onUpdate:modelValue":p[0]||(p[0]=S=>f.value=S)},null,8,["modelValue"])])):E("",!0)]),footer:_(()=>[g("div",{class:"game-over-footer"},[g("button",{onClick:y,class:"button"},"Keep Going"),g("button",{onClick:N,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}}),Bo=Z(Uo,[["__scopeId","data-v-c9c5bad4"]]),zo={key:0},Go=["href"],Ho={class:"nan-footer"},Wo=z({__name:"NaNScreen",setup(n){const{discordName:e,discordLink:t}=B,i=F(!0),r=F(!0),s=Oe(G,"hasNaN"),u=F(null);ae(s,w=>{w?(i.value=x.autosave,r.value=x.devSpeed===0):(x.autosave=i.value,x.devSpeed=r.value?0:null)});const a=L(()=>{var w;return(w=G.NaNPath)==null?void 0:w.join(".")}),o=L(()=>G.NaNPersistent!=null?G.NaNPersistent.value:null);function f(){G.NaNPersistent!=null&&(G.NaNPersistent.value=new c(0),G.hasNaN=!1)}function y(){G.NaNPersistent&&(G.NaNPersistent.value=new c(1),G.hasNaN=!1)}function N(){G.NaNPersistent&&(G.NaNPersistent.value=new c(NaN),G.hasNaN=!1)}return(w,p)=>(b(),C(j,null,[v(Pe,ke({modelValue:s.value,"onUpdate:modelValue":p[4]||(p[4]=k=>s.value=k)},w.$attrs),{header:_(()=>p[5]||(p[5]=[g("div",{class:"nan-modal-header"},[g("h2",null,"NaN value detected!")],-1)])),body:_(()=>[g("div",null,[V(' Attempted to assign "'+O(a.value)+'" to NaN',1),o.value?(b(),C("span",zo,O(" ")+"(previously "+O(d(pe)(o.value))+")",1)):E("",!0),V(". Auto-saving has been "+O(i.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),p[7]||(p[7]=g("br",null,null,-1)),g("div",null,[g("a",{href:d(t)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[p[6]||(p[6]=g("span",{class:"material-icons nan-modal-discord"},"discord",-1)),V(" "+O(d(e)||"Profectus & Friends"),1)],8,Go)]),p[8]||(p[8]=g("br",null,null,-1)),v(be,{title:"Autosave",modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=k=>i.value=k)},null,8,["modelValue"]),d(B).enablePausing?(b(),J(be,{key:0,title:"Pause game",modelValue:r.value,"onUpdate:modelValue":p[1]||(p[1]=k=>r.value=k)},null,8,["modelValue"])):E("",!0)]),footer:_(()=>[g("div",Ho,[g("button",{onClick:p[2]||(p[2]=k=>{var S;return(S=u.value)==null?void 0:S.open()}),class:"button"},"Open Saves Manager"),g("button",{onClick:f,class:"button"},"Set to 0"),g("button",{onClick:y,class:"button"},"Set to 1"),o.value&&d(c).neq(o.value,0)&&d(c).neq(o.value,1)?(b(),C("button",{key:0,onClick:p[3]||(p[3]=k=>s.value=!1),class:"button"}," Set to previous ")):E("",!0),g("button",{onClick:N,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),v(Vt,{ref_key:"savesManager",ref:u},null,512)],64))}}),jo=Z(Wo,[["__scopeId","data-v-cab8d401"]]),Jo={key:1},Zo=z({__name:"Layer",props:{display:{},minimizedDisplay:{},minimized:{},name:{},color:{},minimizable:{},nodes:{},forceHideGoBack:{},index:{}},setup(n){const e=n,t=()=>te(e.display),i=()=>e.minimizedDisplay==null?void 0:te(e.minimizedDisplay),r=L(()=>B.allowGoBack&&!d(e.forceHideGoBack)&&e.index>0&&!d(e.minimized));function s(){x.tabs.splice(d(e.index),1/0)}function u(o){e.nodes.value=o}const a=F([]);return En((o,f,y)=>(console.warn(`Error caught in "${e.name}" layer`,o,f,y),a.value.push(o instanceof Error?o:new Error(JSON.stringify(o))),!1)),(o,f)=>a.value.length>0?(b(),J(Yt,{key:0,errors:a.value},null,8,["errors"])):(b(),C("div",ke({key:1,class:"layer-container",style:{"--layer-color":d(o.color)}},o.$attrs),[r.value?(b(),C("button",{key:0,class:"goBack",onClick:s},"❌")):E("",!0),d(o.minimized)?(b(),C("button",{key:1,class:"layer-tab minimized",onClick:f[0]||(f[0]=y=>o.$emit("setMinimized",!1))},[o.minimizedDisplay?(b(),J(i,{key:0})):(b(),C("div",Jo,O(d(o.name)),1))])):(b(),C("div",{key:2,class:K(["layer-tab",{showGoBack:r.value}])},[v(Kt,{onUpdateNodes:u},{default:_(()=>[v(t)]),_:1})],2)),d(o.minimizable)?(b(),C("button",{key:3,class:"minimize",onClick:f[1]||(f[1]=y=>o.$emit("setMinimized",!0))}," ▼ ")):E("",!0)],16))}}),Yo=Z(Zo,[["__scopeId","data-v-bac44152"]]),Ko=z({__name:"Changelog",setup(n,{expose:e}){const t=F(!1);return e({open(){t.value=!0}}),(i,r)=>(b(),J(Pe,{modelValue:t.value,"onUpdate:modelValue":r[0]||(r[0]=s=>t.value=s)},{header:_(()=>r[1]||(r[1]=[g("h2",null,"Changelog",-1)])),body:_(()=>r[2]||(r[2]=[g("details",{open:""},[g("summary",null,[V("v0.0 Initial Commit - "),g("time",null,"2021-09-04")]),V(" This is the first release :D "),g("ul",null,[g("li",{class:"feature"},"Did everything"),g("li",{class:"fix"},"Had some fun"),g("li",{class:"breaking"},"Removed everything"),g("li",{class:"balancing"},"Created some bugs to fix later")])],-1)])),_:1},8,["modelValue"]))}}),Xo=Z(Ko,[["__scopeId","data-v-0fdea059"]]),Qo={class:"info-modal-header"},el=["src","alt"],tl={class:"info-modal-title"},nl={key:0},il={key:0},rl={key:0},sl=["href"],al=z({__name:"Info",emits:["openChangelog"],setup(n,{expose:e,emit:t}){const{title:i,logo:r,author:s,discordName:u,discordLink:a,versionNumber:o,versionTitle:f}=B,y=t,N=F(!1),w=L(()=>yt(x.timePlayed)),p=()=>vn.map(k=>te(k));return e({open(){N.value=!0}}),(k,S)=>(b(),J(Pe,{modelValue:N.value,"onUpdate:modelValue":S[1]||(S[1]=M=>N.value=M)},{header:_(()=>[g("div",Qo,[d(r)?(b(),C("img",{key:0,class:"info-modal-logo",src:d(r),alt:d(i)},null,8,el)):E("",!0),g("div",tl,[g("h2",null,O(d(i)),1),g("h4",null,[V(" v"+O(d(o)),1),d(f)?(b(),C("span",nl,": "+O(d(f)),1)):E("",!0)])])])]),body:_(({shown:M})=>[M?(b(),C("div",il,[d(s)?(b(),C("div",rl,"By "+O(d(s)),1)):E("",!0),S[3]||(S[3]=g("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),S[4]||(S[4]=g("br",null,null,-1)),g("div",{class:"link",onClick:S[0]||(S[0]=T=>y("openChangelog"))},"Changelog"),S[5]||(S[5]=g("br",null,null,-1)),g("div",null,[d(a)?(b(),C("a",{key:0,href:d(a),class:"info-modal-discord-link",target:"_blank"},[S[2]||(S[2]=g("span",{class:"material-icons info-modal-discord"},"discord",-1)),V(" "+O(d(u)),1)],8,sl)):E("",!0)]),S[6]||(S[6]=g("div",null,[g("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[g("span",{class:"material-icons info-modal-discord"},"discord"),V(" Profectus & Friends ")])],-1)),S[7]||(S[7]=g("div",null,[g("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[g("span",{class:"material-icons info-modal-discord"},"discord"),V(" The Modding Tree ")])],-1)),S[8]||(S[8]=g("br",null,null,-1)),g("div",null,"Time Played: "+O(w.value),1),v(p)])):E("",!0)]),_:1},8,["modelValue"]))}}),ol=Z(al,[["__scopeId","data-v-e80d3d22"]]),ll={class:"header"},ul={class:"option-tabs"},cl={key:0},dl={key:1},fl=z({__name:"Options",setup(n,{expose:e}){const t=F(!1),i=F("behaviour");function r(ce){return ce==i.value}function s(ce){i.value=ce}e({isTab:r,setTab:s,save:ie,open(){t.value=!0}});const u=Object.keys(Et).map(ce=>({label:tr(ce),value:ce})),a=()=>Ua.map(ce=>te(ce)),{showTPS:o,theme:f,unthrottled:y,alignUnits:N,showHealthWarning:w}=Lt(H),{autosave:p,offlineProd:k}=Lt(x),S=L({get(){return x.devSpeed===0},set(ce){x.devSpeed=ce?0:null}}),M=v("span",{class:"option-title"},[V("Unthrottled"),v("desc",null,[V("Allow the game to run as fast as possible. Not battery friendly.")])]),T=v("span",{class:"option-title"},[V("Offline production"),v(Q,{display:"Save-specific",direction:Y.Right},{default:()=>[V("*")]}),v("desc",null,[V("Simulate production that occurs while the game is closed.")])]),P=v("span",{class:"option-title"},[V("Show videogame addiction warning"),v("desc",null,[V("Show a helpful warning after playing for a long time about video game addiction and encouraging you to take a break.")])]),q=v("span",{class:"option-title"},[V("Autosave"),v(Q,{display:"Save-specific",direction:Y.Right},{default:()=>[V("*")]}),v("desc",null,[V("Automatically save the game every second or when the game is closed.")])]),oe=v("span",{class:"option-title"},[V("Pause game"),v(Q,{display:"Save-specific",direction:Y.Right},{default:()=>[V("*")]}),v("desc",null,[V("Stop everything from moving.")])]),he=v("span",{class:"option-title"},[V("Theme"),v("desc",null,[V("How the game looks.")])]),kt=v("span",{class:"option-title"},[V("Show TPS"),v("desc",null,[V("Show TPS meter at the bottom-left corner of the page.")])]),Ct=v("span",{class:"option-title"},[V("Align modifier units"),v("desc",null,[V("Align numbers to the beginning of the unit in modifier view.")])]);return(ce,W)=>(b(),J(Pe,{modelValue:t.value,"onUpdate:modelValue":W[11]||(W[11]=ee=>t.value=ee)},{header:_(()=>[g("div",ll,[W[12]||(W[12]=g("h2",null,"Settings",-1)),g("div",ul,[g("button",{class:K({selected:r("behaviour")}),onClick:W[0]||(W[0]=ee=>s("behaviour"))},"Behaviour",2),g("button",{class:K({selected:r("appearance")}),onClick:W[1]||(W[1]=ee=>s("appearance"))},"Appearance",2)])])]),body:_(()=>[r("behaviour")?(b(),C("div",cl,[v(be,{title:d(M),modelValue:d(y),"onUpdate:modelValue":W[2]||(W[2]=ee=>se(y)?y.value=ee:null)},null,8,["title","modelValue"]),d(B).enablePausing?(b(),J(be,{key:0,title:d(oe),modelValue:S.value,"onUpdate:modelValue":W[3]||(W[3]=ee=>S.value=ee)},null,8,["title","modelValue"])):E("",!0),v(be,{title:d(T),modelValue:d(k),"onUpdate:modelValue":W[4]||(W[4]=ee=>se(k)?k.value=ee:null)},null,8,["title","modelValue"]),d(B).disableHealthWarning?E("",!0):(b(),J(be,{key:1,title:d(P),modelValue:d(w),"onUpdate:modelValue":W[5]||(W[5]=ee=>se(w)?w.value=ee:null)},null,8,["title","modelValue"])),v(be,{title:d(q),modelValue:d(p),"onUpdate:modelValue":W[6]||(W[6]=ee=>se(p)?p.value=ee:null)},null,8,["title","modelValue"]),d(p)?E("",!0):(b(),J($t,{key:2,class:"button save-button",onClick:W[7]||(W[7]=ee=>d(ie)())},{default:_(()=>W[13]||(W[13]=[V("Manually save")])),_:1}))])):E("",!0),r("appearance")?(b(),C("div",dl,[v(yn,{title:d(he),options:d(u),modelValue:d(f),"onUpdate:modelValue":W[8]||(W[8]=ee=>se(f)?f.value=ee:null)},null,8,["title","options","modelValue"]),v(a),v(be,{title:d(kt),modelValue:d(o),"onUpdate:modelValue":W[9]||(W[9]=ee=>se(o)?o.value=ee:null)},null,8,["title","modelValue"]),v(be,{title:d(Ct),modelValue:d(N),"onUpdate:modelValue":W[10]||(W[10]=ee=>se(N)?N.value=ee:null)},null,8,["title","modelValue"])])):E("",!0)]),_:1},8,["modelValue"]))}}),ml=["src","alt"],gl={key:1,class:"title"},pl={class:"discord"},hl={class:"discord-links"},vl={key:0},bl=["href"],yl={href:"https://forums.moddingtree.com/",target:"_blank"},wl={href:"https://forums.moddingtree.com/",target:"_blank"},Nl={class:"discord"},kl={class:"discord-links"},Cl={key:0},Sl=["href"],Il=z({__name:"Nav",setup(n){const e=F(null),t=F(null),i=F(null),r=F(null),{useHeader:s,banner:u,title:a,discordName:o,discordLink:f,versionNumber:y}=B;function N(){window.open(f,"mywindow")}const w=L(()=>{var p;return((p=ue.value)==null?void 0:p.loggedIn)===!0&&!We.value.includes(H.active)});return(p,k)=>(b(),C(j,null,[d(s)?(b(),C("div",ke({key:0,class:"nav"},p.$attrs),[d(u)?(b(),C("img",{key:0,src:d(u),class:"banner",alt:d(a)},null,8,ml)):(b(),C("div",gl,O(d(a)),1)),g("div",{onClick:k[0]||(k[0]=S=>{var M;return(M=r.value)==null?void 0:M.open()}),class:"version-container"},[v(Q,{display:"Changelog",direction:d(Y).Down,class:"version"},{default:_(()=>[g("span",null,"v"+O(d(y)),1)]),_:1},8,["direction"])]),k[14]||(k[14]=g("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),g("div",pl,[g("span",{onClick:N,class:"material-icons"},"discord"),g("ul",hl,[d(f)?(b(),C("li",vl,[g("a",{href:d(f),target:"_blank"},O(d(o)),9,bl)])):E("",!0),k[9]||(k[9]=g("li",null,[g("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"Profectus & Friends")],-1)),k[10]||(k[10]=g("li",null,[g("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1))])]),g("div",null,[g("a",yl,[v(Q,{display:"Forums",direction:d(Y).Down,yoffset:"5px"},{default:_(()=>k[11]||(k[11]=[g("span",{class:"material-icons"},"forum",-1)])),_:1},8,["direction"])])]),g("div",{onClick:k[1]||(k[1]=S=>{var M;return(M=e.value)==null?void 0:M.open()})},[v(Q,{display:"Info",direction:d(Y).Down,class:"info"},{default:_(()=>k[12]||(k[12]=[g("span",{class:"material-icons"},"info",-1)])),_:1},8,["direction"])]),g("div",{onClick:k[2]||(k[2]=S=>{var M;return(M=t.value)==null?void 0:M.open()})},[v(Q,{display:"Saves",direction:d(Y).Down,xoffset:"-20px"},{default:_(()=>[g("span",{class:K(["material-icons",{needsSync:w.value}])},"library_books",2)]),_:1},8,["direction"])]),g("div",{onClick:k[3]||(k[3]=S=>{var M;return(M=i.value)==null?void 0:M.open()})},[v(Q,{display:"Settings",direction:d(Y).Down,xoffset:"-66px"},{default:_(()=>k[13]||(k[13]=[g("span",{class:"material-icons"},"settings",-1)])),_:1},8,["direction"])])],16)):(b(),C("div",ke({key:1,class:"overlay-nav"},p.$attrs),[g("div",{onClick:k[4]||(k[4]=S=>{var M;return(M=r.value)==null?void 0:M.open()}),class:"version-container"},[v(Q,{display:"Changelog",direction:d(Y).Right,xoffset:"25%",class:"version"},{default:_(()=>[g("span",null,"v"+O(d(y)),1)]),_:1},8,["direction"])]),g("div",{onClick:k[5]||(k[5]=S=>{var M;return(M=t.value)==null?void 0:M.open()})},[v(Q,{display:"Saves",direction:d(Y).Right},{default:_(()=>[g("span",{class:K(["material-icons",{needsSync:w.value}])},"library_books",2)]),_:1},8,["direction"])]),g("div",{onClick:k[6]||(k[6]=S=>{var M;return(M=i.value)==null?void 0:M.open()})},[v(Q,{display:"Settings",direction:d(Y).Right},{default:_(()=>k[15]||(k[15]=[g("span",{class:"material-icons"},"settings",-1)])),_:1},8,["direction"])]),g("div",{onClick:k[7]||(k[7]=S=>{var M;return(M=e.value)==null?void 0:M.open()})},[v(Q,{display:"Info",direction:d(Y).Right},{default:_(()=>k[16]||(k[16]=[g("span",{class:"material-icons"},"info",-1)])),_:1},8,["direction"])]),g("div",null,[g("a",wl,[v(Q,{display:"Forums",direction:d(Y).Right,xoffset:"7px"},{default:_(()=>k[17]||(k[17]=[g("span",{class:"material-icons"},"forum",-1)])),_:1},8,["direction"])])]),g("div",Nl,[g("span",{onClick:N,class:"material-icons"},"discord"),g("ul",kl,[d(f)?(b(),C("li",Cl,[g("a",{href:d(f),target:"_blank"},O(d(o)),9,Sl)])):E("",!0),k[18]||(k[18]=g("li",null,[g("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"Profectus & Friends")],-1)),k[19]||(k[19]=g("li",null,[g("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1))])])],16)),v(ol,{ref_key:"info",ref:e,onOpenChangelog:k[8]||(k[8]=S=>{var M;return(M=r.value)==null?void 0:M.open()})},null,512),v(Vt,{ref_key:"savesManager",ref:t},null,512),v(fl,{ref_key:"options",ref:i},null,512),v(Xo,{ref_key:"changelog",ref:r},null,512)],64))}}),Nn=Z(Il,[["__scopeId","data-v-fcec1ed1"]]),xl={class:"inner-tab"},Ml=z({__name:"Game",setup(n){const e=Oe(x,"tabs"),t=L(()=>Object.keys(re)),i=B.useHeader;function r(s){const{display:u,name:a,color:o,minimizable:f,minimizedDisplay:y,minimized:N,nodes:w,forceHideGoBack:p}=s;return{display:u,name:a,color:o,minimizable:f,minimizedDisplay:y,minimized:N,nodes:w,forceHideGoBack:p}}return(s,u)=>(b(),C("div",{class:K(["tabs-container",{useHeader:d(i)}])},[(b(!0),C(j,null,Se(e.value,(a,o)=>{var f,y;return b(),C("div",{key:o,class:K(["tab",d((f=d(re)[a])==null?void 0:f.classes)]),style:fe(d((y=d(re)[a])==null?void 0:y.style))},[o===0&&!d(i)?(b(),J(Nn,{key:0})):E("",!0),g("div",xl,[t.value.includes(a)?(b(),J(Yo,ke({key:0,ref_for:!0},r(d(re)[a]),{index:o,onSetMinimized:N=>d(re)[a].minimized.value=N}),null,16,["index","onSetMinimized"])):(b(),J(Fn(a),{key:1,index:o},null,8,["index"]))])],6)}),128))],2))}}),Tl=Z(Ml,[["__scopeId","data-v-d0a3afce"]]),$l={key:0,class:"tpsDisplay"},Pl=z({__name:"TPS",setup(n){const e=L(()=>c.div(G.lastTenTicks.length,G.lastTenTicks.reduce((t,i)=>t+i,0)));return(t,i)=>e.value.isNan()?E("",!0):(b(),C("div",$l,"TPS: "+O(d(Qe)(e.value)),1))}}),El=Z(Pl,[["__scopeId","data-v-7df31503"]]),Fl=z({__name:"App",setup(n){const e=B.useHeader,t=L(()=>Et[H.theme].variables),i=Oe(H,"showTPS"),r=Oe(G,"errors"),s=()=>za.map(u=>te(u));return(u,a)=>r.value.length>0?(b(),C("div",{key:0,class:"error-container",style:fe(t.value)},[v(Yt,{errors:r.value},null,8,["errors"])],4)):(b(),C(j,{key:1},[g("div",{id:"modal-root",style:fe(t.value)},null,4),g("div",{class:K(["app",{useHeader:d(e)}]),style:fe(t.value)},[d(e)?(b(),J(Nn,{key:0})):E("",!0),v(Tl),d(i.value)?(b(),J(El,{key:1})):E("",!0),v(No),v(Bo),v(jo),v(Eo),v(s)],6)],64))}}),Vl=Z(Fl,[["__scopeId","data-v-b45f2ee2"]]);ne.on("setupVue",n=>n.use(An));const _l="modulepreload",Ol=function(n,e){return new URL(n,e).href},Gt={},Ll=function(e,t,i){let r=Promise.resolve();if(t&&t.length>0){const u=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=Promise.allSettled(t.map(f=>{if(f=Ol(f,i),f in Gt)return;Gt[f]=!0;const y=f.endsWith(".css"),N=y?'[rel="stylesheet"]':"";if(!!i)for(let k=u.length-1;k>=0;k--){const S=u[k];if(S.href===f&&(!y||S.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${N}`))return;const p=document.createElement("link");if(p.rel=y?"stylesheet":_l,y||(p.as="script"),p.crossOrigin="",p.href=f,o&&p.setAttribute("nonce",o),document.head.appendChild(p),y)return new Promise((k,S)=>{p.addEventListener("load",k),p.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function s(u){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=u,window.dispatchEvent(a),!a.defaultPrevented)throw u}return r.then(u=>{for(const a of u||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};function Dl(n={}){const{immediate:e=!1,onNeedRefresh:t,onOfflineReady:i,onRegistered:r,onRegisteredSW:s,onRegisterError:u}=n;let a,o;const f=async(N=!0)=>{await o};async function y(){if("serviceWorker"in navigator){if(a=await Ll(async()=>{const{Workbox:N}=await import("./workbox-window-D5gOYdM7.js");return{Workbox:N}},[],import.meta.url).then(({Workbox:N})=>new N("./sw.js",{scope:"./",type:"classic"})).catch(N=>{u==null||u(N)}),!a)return;a.addEventListener("activated",N=>{(N.isUpdate||N.isExternal)&&window.location.reload()}),a.addEventListener("installed",N=>{N.isUpdate||i==null||i()}),a.register({immediate:e}).then(N=>{s?s("./sw.js",N):r==null||r(N)}).catch(N=>{u==null||u(N)})}}return o=y(),f}function Al(n={}){const{immediate:e=!0,onNeedRefresh:t,onOfflineReady:i,onRegistered:r,onRegisteredSW:s,onRegisterError:u}=n,a=F(!1),o=F(!1);return{updateServiceWorker:Dl({immediate:e,onNeedRefresh(){a.value=!0,t==null||t()},onOfflineReady(){o.value=!0,i==null||i()},onRegistered:r,onRegisteredSW:s,onRegisterError:u}),offlineReady:o,needRefresh:a}}let Ae=null;function vt(){const n=Date.now();let e=(n-x.time)/1e3;x.time=n;const t=e;if(G.lastTenTicks.push(t),G.lastTenTicks.length>10&&(G.lastTenTicks=G.lastTenTicks.slice(1)),!(qe!=null&&qe.value&&!x.keepGoing)&&!G.hasNaN&&(e=Math.max(e,0),x.devSpeed!==0)){if(Nt.value=!1,x.offlineTime!=null){if(c.gt(x.offlineTime,B.offlineLimit*3600)&&(x.offlineTime=B.offlineLimit*3600),c.gt(x.offlineTime,0)&&x.devSpeed!==0){const i=Math.max(x.offlineTime/10,e);x.offlineTime=x.offlineTime-i,e+=i}else x.devSpeed===0&&(x.offlineTime+=e);(!x.offlineProd||c.lt(x.offlineTime,0))&&(x.offlineTime=null)}e=Math.min(e,B.maxTickLength),x.devSpeed!=null&&(e*=x.devSpeed),Number.isFinite(e)||(e=1e308),!c.eq(e,0)&&(x.timePlayed+=e,Number.isFinite(x.timePlayed)||(x.timePlayed=1e308),ne.emit("update",e,t),H.unthrottled?(requestAnimationFrame(vt),Ae!=null&&(clearInterval(Ae),Ae=null)):Ae==null&&(Ae=setInterval(vt,50)))}}async function Rl(){H.unthrottled?requestAnimationFrame(vt):Ae=setInterval(vt,50)}ae(qe,n=>{n&&ne.emit("gameWon")});setInterval(()=>{G.mouseActivity=[...G.mouseActivity.slice(-7),!1]},1e3*60*60);const _t=console.error;console.error=function(...n){_t(...n)};window.onerror=function(n,e,t,i,r){return G.errors.push(r instanceof Error?r:new Error(JSON.stringify(r))),_t(r),!0};window.onunhandledrejection=function(n){G.errors.push(n.reason instanceof Error?n.reason:new Error(JSON.stringify(n.reason))),_t(n.reason)};document.title=B.title;window.projInfo=B;B.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 La();const n=window.vue=Vn(Vl);n.config.errorHandler=function(e,t,i){console.error(e,i,t)},ne.emit("setupVue",n),n.mount("#app"),Be(()=>{const e=Rn();Al({immediate:!0,onOfflineReady(){e.info("App ready to work offline")},onRegisterError:console.warn,onRegistered:console.info})}),Rl()});