Planar-Pioneers/assets/index.83d67942.js

18 lines
213 KiB
JavaScript

/* empty css */import"./vue.c16a309b.js";import{_ as N,C as s,l as De,q as vn,t as V,b2 as dt,ab as J,aF as M,a1 as E,a2 as _,aL as Et,G as pe,aD as vr,w as ft,b3 as _t,a9 as p,O as ne,ap as ca,az as ci,as as jt,aH as Qn,A as $e,$ as ee,b7 as H,b9 as Ai,ar as zt,bv as $n,a8 as x,bt as da,bc as xn,T as fa,u as Oi,j as pa,bw as Pt,aM as Ct,a0 as B,aO as Ue,J as ae,I as Re,aI as bn,aG as yn,z as tn,bo as ga,bs as ma,aK as En,bd as tr,am as ii,H as va,bx as ha,bf as ba}from"./@vue.6b211d3c.js";import{c as hr}from"./nanoevents.1080beb7.js";import{L as Kt}from"./lz-string.dccec454.js";import{Y as ya}from"./vue-next-select.ded54c4a.js";import{D as wa}from"./vuedraggable.1879de79.js";import{p as _a}from"./vue-textarea-autosize.35804eaf.js";import{P as Na}from"./vue-panzoom.8ce6f9b1.js";import{s as Ca,u as di}from"./vue-toastification.9c2dad53.js";import"./amator.1e5a40c8.js";import"./bezier-easing.a990b400.js";import"./sortablejs.a0f68e5e.js";import"./panzoom.30c56ba6.js";import"./wheel.f2ae740f.js";import"./ngraph.events.083734c6.js";const ka=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}};ka();const Ma="modulepreload",nr={},Sa="./",jn=function(t,n){return!n||n.length===0?t():Promise.all(n.map(i=>{if(i=`${Sa}${i}`,i in nr)return;nr[i]=!0;const r=i.endsWith(".css"),a=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${a}`))return;const l=document.createElement("link");if(l.rel=r?"stylesheet":Ma,r||(l.as="script",l.crossOrigin=""),l.href=i,document.head.appendChild(l),r)return new Promise((u,c)=>{l.addEventListener("load",u),l.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())},Ia="./projInfo-schema.json",$a="Planar Pioneers",xa="A game about controlling and exploiting planes!",Ea="planar-pioneers",Pa="thepaperpilot",Ta="",Da="",Fa="0.0",Aa="Initial Commit",Oa=!1,Ra=!1,qa=2,Va=!0,Ba=null,La="",ja=["main"],za=3600,Ua=0,Ga=!0,Wa="base64";var fe={$schema:Ia,title:$a,description:xa,id:Ea,author:Pa,discordName:Ta,discordLink:Da,versionNumber:Fa,versionTitle:Aa,allowGoBack:Oa,defaultShowSmall:Ra,defaultDecimalsShown:qa,useHeader:Va,banner:Ba,logo:La,initialTabs:ja,maxTickLength:za,offlineLimit:Ua,enablePausing:Ga,exportEncoding:Wa};class Ha{constructor(t){this.map=new Map,this.first=void 0,this.last=void 0,this.maxSize=t}get size(){return this.map.size}get(t){const n=this.map.get(t);if(n!==void 0)return n!==this.first&&(n===this.last?(this.last=n.prev,this.last.next=void 0):(n.prev.next=n.next,n.next.prev=n.prev),n.next=this.first,this.first.prev=n,this.first=n),n.value}set(t,n){if(this.maxSize<1)return;if(this.map.has(t))throw new Error("Cannot update existing keys in the cache");const i=new Za(t,n);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(t,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 Za{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const ki=17,Ya=9e15,Xa=Math.log10(9e15),Ja=1/9e15,Ka=308,Qa=-324,ir=5,es=(1<<10)-1,ts=function(){const e=[];for(let n=Qa+1;n<=Ka;n++)e.push(Number("1e"+n));const t=323;return function(n){return e[n+t]}}(),ln=[2,Math.E,3,4,5,6,7,8,9,10],ns=[[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]],is=[[-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 k=function(t){return o.fromValue_noAlloc(t)},X=function(e,t,n){return o.fromComponents(e,t,n)},te=function(t,n,i){return o.fromComponents_noNormalize(t,n,i)};const Xt=function(t,n){const i=n+1,r=Math.ceil(Math.log10(Math.abs(t))),a=Math.round(t*Math.pow(10,i-r))*Math.pow(10,r-i);return parseFloat(a.toFixed(Math.max(i-r,0)))},Mi=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},rs=function(e){if(!isFinite(e))return e;if(e<-50)return e===Math.trunc(e)?Number.NEGATIVE_INFINITY:0;let t=1;for(;e<10;)t=t*e,++e;e-=1;let n=.9189385332046727;n=n+(e+.5)*Math.log(e),n=n-e;const i=e*e;let r=e;return n=n+1/(12*r),r=r*i,n=n+1/(360*r),r=r*i,n=n+1/(1260*r),r=r*i,n=n+1/(1680*r),r=r*i,n=n+1/(1188*r),r=r*i,n=n+691/(360360*r),r=r*i,n=n+7/(1092*r),r=r*i,n=n+3617/(122400*r),Math.exp(n)/t},br=.5671432904097838,rr=function(e,t=1e-10){let n,i;if(!Number.isFinite(e)||e===0)return e;if(e===1)return br;e<10?n=0:n=Math.log(e)-Math.log(Math.log(e));for(let r=0;r<100;++r){if(i=(e*Math.exp(-n)+n*n)/(n+1),Math.abs(i-n)<t*Math.abs(i))return i;n=i}throw Error(`Iteration failed to converge: ${e.toString()}`)};function ar(e,t=1e-10){let n,i,r,a;if(!Number.isFinite(e.mag)||e.eq(o.dZero))return e;if(e.eq(o.dOne))return o.fromNumber(br);n=o.ln(e);for(let l=0;l<100;++l){if(i=n.neg().exp(),r=n.sub(e.mul(i)),a=n.sub(r.div(n.add(1).sub(n.add(2).mul(r).div(o.mul(2,n).add(2))))),o.abs(a.sub(n)).lt(o.abs(a).mul(t)))return a;n=a}throw Error(`Iteration failed to converge: ${e.toString()}`)}const y=class{constructor(e){this.sign=0,this.mag=0,this.layer=0,e instanceof y?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/ts(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,n){return new y().fromComponents(e,t,n)}static fromComponents_noNormalize(e,t,n){return new y().fromComponents_noNormalize(e,t,n)}static fromMantissaExponent(e,t){return new y().fromMantissaExponent(e,t)}static fromMantissaExponent_noNormalize(e,t){return new y().fromMantissaExponent_noNormalize(e,t)}static fromDecimal(e){return new y().fromDecimal(e)}static fromNumber(e){return new y().fromNumber(e)}static fromString(e){return new y().fromString(e)}static fromValue(e){return new y().fromValue(e)}static fromValue_noAlloc(e){if(e instanceof y)return e;if(typeof e=="string"){const t=y.fromStringCache.get(e);return t!==void 0?t:y.fromString(e)}else return typeof e=="number"?y.fromNumber(e):y.dZero}static abs(e){return k(e).abs()}static neg(e){return k(e).neg()}static negate(e){return k(e).neg()}static negated(e){return k(e).neg()}static sign(e){return k(e).sign}static sgn(e){return k(e).sign}static round(e){return k(e).round()}static floor(e){return k(e).floor()}static ceil(e){return k(e).ceil()}static trunc(e){return k(e).trunc()}static add(e,t){return k(e).add(t)}static plus(e,t){return k(e).add(t)}static sub(e,t){return k(e).sub(t)}static subtract(e,t){return k(e).sub(t)}static minus(e,t){return k(e).sub(t)}static mul(e,t){return k(e).mul(t)}static multiply(e,t){return k(e).mul(t)}static times(e,t){return k(e).mul(t)}static div(e,t){return k(e).div(t)}static divide(e,t){return k(e).div(t)}static recip(e){return k(e).recip()}static reciprocal(e){return k(e).recip()}static reciprocate(e){return k(e).reciprocate()}static cmp(e,t){return k(e).cmp(t)}static cmpabs(e,t){return k(e).cmpabs(t)}static compare(e,t){return k(e).cmp(t)}static isNaN(e){return e=k(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag)}static isFinite(e){return e=k(e),isFinite(e.sign)&&isFinite(e.layer)&&isFinite(e.mag)}static eq(e,t){return k(e).eq(t)}static equals(e,t){return k(e).eq(t)}static neq(e,t){return k(e).neq(t)}static notEquals(e,t){return k(e).notEquals(t)}static lt(e,t){return k(e).lt(t)}static lte(e,t){return k(e).lte(t)}static gt(e,t){return k(e).gt(t)}static gte(e,t){return k(e).gte(t)}static max(e,t){return k(e).max(t)}static min(e,t){return k(e).min(t)}static minabs(e,t){return k(e).minabs(t)}static maxabs(e,t){return k(e).maxabs(t)}static clamp(e,t,n){return k(e).clamp(t,n)}static clampMin(e,t){return k(e).clampMin(t)}static clampMax(e,t){return k(e).clampMax(t)}static cmp_tolerance(e,t,n){return k(e).cmp_tolerance(t,n)}static compare_tolerance(e,t,n){return k(e).cmp_tolerance(t,n)}static eq_tolerance(e,t,n){return k(e).eq_tolerance(t,n)}static equals_tolerance(e,t,n){return k(e).eq_tolerance(t,n)}static neq_tolerance(e,t,n){return k(e).neq_tolerance(t,n)}static notEquals_tolerance(e,t,n){return k(e).notEquals_tolerance(t,n)}static lt_tolerance(e,t,n){return k(e).lt_tolerance(t,n)}static lte_tolerance(e,t,n){return k(e).lte_tolerance(t,n)}static gt_tolerance(e,t,n){return k(e).gt_tolerance(t,n)}static gte_tolerance(e,t,n){return k(e).gte_tolerance(t,n)}static pLog10(e){return k(e).pLog10()}static absLog10(e){return k(e).absLog10()}static log10(e){return k(e).log10()}static log(e,t){return k(e).log(t)}static log2(e){return k(e).log2()}static ln(e){return k(e).ln()}static logarithm(e,t){return k(e).logarithm(t)}static pow(e,t){return k(e).pow(t)}static pow10(e){return k(e).pow10()}static pow_base(e,t){return k(e).pow_base(t)}static root(e,t){return k(e).root(t)}static factorial(e,t){return k(e).factorial()}static gamma(e,t){return k(e).gamma()}static lngamma(e,t){return k(e).lngamma()}static exp(e){return k(e).exp()}static sqr(e){return k(e).sqr()}static sqrt(e){return k(e).sqrt()}static cube(e){return k(e).cube()}static cbrt(e){return k(e).cbrt()}static tetrate(e,t=2,n=te(1,0,1)){return k(e).tetrate(t,n)}static iteratedexp(e,t=2,n=te(1,0,1)){return k(e).iteratedexp(t,n)}static iteratedlog(e,t=10,n=1){return k(e).iteratedlog(t,n)}static layeradd10(e,t){return k(e).layeradd10(t)}static layeradd(e,t,n=10){return k(e).layeradd(t,n)}static slog(e,t=10){return k(e).slog(t)}static lambertw(e){return k(e).lambertw()}static ssqrt(e){return k(e).ssqrt()}static pentate(e,t=2,n=te(1,0,1)){return k(e).pentate(t,n)}static sin(e){return k(e).sin()}static cos(e){return k(e).cos()}static tan(e){return k(e).tan()}static asin(e){return k(e).asin()}static acos(e){return k(e).acos()}static atan(e){return k(e).atan()}static sinh(e){return k(e).sinh()}static cosh(e){return k(e).cosh()}static tanh(e){return k(e).tanh()}static asinh(e){return k(e).asinh()}static acosh(e){return k(e).acosh()}static atanh(e){return k(e).atanh()}static affordGeometricSeries(e,t,n,i){return this.affordGeometricSeries_core(k(e),k(t),k(n),i)}static sumGeometricSeries(e,t,n,i){return this.sumGeometricSeries_core(e,k(t),k(n),i)}static affordArithmeticSeries(e,t,n,i){return this.affordArithmeticSeries_core(k(e),k(t),k(n),k(i))}static sumArithmeticSeries(e,t,n,i){return this.sumArithmeticSeries_core(k(e),k(t),k(n),k(i))}static efficiencyOfPurchase(e,t,n){return this.efficiencyOfPurchase_core(k(e),k(t),k(n))}static randomDecimalForTesting(e){if(Math.random()*20<1)return te(0,0,0);const t=Math.random()>.5?1:-1;if(Math.random()*20<1)return te(t,0,1);const n=Math.floor(Math.random()*(e+1));let i=n===0?Math.random()*616-308:Math.random()*16;Math.random()>.9&&(i=Math.trunc(i));let r=Math.pow(10,i);return Math.random()>.9&&(r=Math.trunc(r)),X(t,n,r)}static affordGeometricSeries_core(e,t,n,i){const r=t.mul(n.pow(i));return y.floor(e.div(r).mul(n.sub(1)).add(1).log10().div(n.log10()))}static sumGeometricSeries_core(e,t,n,i){return t.mul(n.pow(i)).mul(y.sub(1,n.pow(e))).div(y.sub(1,n))}static affordArithmeticSeries_core(e,t,n,i){const a=t.add(i.mul(n)).sub(n.div(2)),l=a.pow(2);return a.neg().add(l.add(n.mul(e).mul(2)).sqrt()).div(n).floor()}static sumArithmeticSeries_core(e,t,n,i){const r=t.add(i.mul(n));return e.div(2).mul(r.mul(2).plus(e.sub(1).mul(n)))}static efficiencyOfPurchase_core(e,t,n){return e.div(t).add(e.div(n))}normalize(){if(this.sign===0||this.mag===0&&this.layer===0)return this.sign=0,this.mag=0,this.layer=0,this;if(this.layer===0&&this.mag<0&&(this.mag=-this.mag,this.sign=-this.sign),this.layer===0&&this.mag<Ja)return this.layer+=1,this.mag=Math.log10(this.mag),this;let e=Math.abs(this.mag),t=Math.sign(this.mag);if(e>=Ya)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e<Xa&&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,n){return this.sign=e,this.layer=t,this.mag=n,this.normalize(),this}fromComponents_noNormalize(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this}fromMantissaExponent(e,t){return this.layer=1,this.sign=Math.sign(e),e=Math.abs(e),this.mag=t+Math.log10(e),this.normalize(),this}fromMantissaExponent_noNormalize(e,t){return this.fromMantissaExponent(e,t),this}fromDecimal(e){return this.sign=e.sign,this.layer=e.layer,this.mag=e.mag,this}fromNumber(e){return this.mag=Math.abs(e),this.sign=Math.sign(e),this.layer=0,this.normalize(),this}fromString(e){const t=e,n=y.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const i=e.split("^^^");if(i.length===2){const v=parseFloat(i[0]),b=parseFloat(i[1]),I=i[1].split(";");let A=1;if(I.length===2&&(A=parseFloat(I[1]),isFinite(A)||(A=1)),isFinite(v)&&isFinite(b)){const S=y.pentate(v,b,A);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}const r=e.split("^^");if(r.length===2){const v=parseFloat(r[0]),b=parseFloat(r[1]),I=r[1].split(";");let A=1;if(I.length===2&&(A=parseFloat(I[1]),isFinite(A)||(A=1)),isFinite(v)&&isFinite(b)){const S=y.tetrate(v,b,A);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}const a=e.split("^");if(a.length===2){const v=parseFloat(a[0]),b=parseFloat(a[1]);if(isFinite(v)&&isFinite(b)){const I=y.pow(v,b);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}e=e.trim().toLowerCase();let l,u,c=e.split("pt");if(c.length===2){l=10,u=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let v=parseFloat(c[1]);if(isFinite(v)||(v=1),isFinite(l)&&isFinite(u)){const b=y.tetrate(l,u,v);return this.sign=b.sign,this.layer=b.layer,this.mag=b.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}if(c=e.split("p"),c.length===2){l=10,u=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let v=parseFloat(c[1]);if(isFinite(v)||(v=1),isFinite(l)&&isFinite(u)){const b=y.tetrate(l,u,v);return this.sign=b.sign,this.layer=b.layer,this.mag=b.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}const d=e.split("e"),m=d.length-1;if(m===0){const v=parseFloat(e);if(isFinite(v))return this.fromNumber(v),y.fromStringCache.size>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}else if(m===1){const v=parseFloat(e);if(isFinite(v)&&v!==0)return this.fromNumber(v),y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}const f=e.split("e^");if(f.length===2){this.sign=1,f[0].charAt(0)=="-"&&(this.sign=-1);let v="";for(let b=0;b<f[1].length;++b){const I=f[1].charCodeAt(b);if(I>=43&&I<=57||I===101)v+=f[1].charAt(b);else return this.layer=parseFloat(v),this.mag=parseFloat(f[1].substr(b+1)),this.normalize(),y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}if(m<1)return this.sign=0,this.layer=0,this.mag=0,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this;const h=parseFloat(d[0]);if(h===0)return this.sign=0,this.layer=0,this.mag=0,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this;let w=parseFloat(d[d.length-1]);if(m>=2){const v=parseFloat(d[d.length-2]);isFinite(v)&&(w*=Math.sign(v),w+=Mi(v))}if(!isFinite(h))this.sign=d[0]==="-"?-1:1,this.layer=m,this.mag=w;else if(m===1)this.sign=Math.sign(h),this.layer=1,this.mag=w+Math.log10(Math.abs(h));else if(this.sign=Math.sign(h),this.layer=m,m===2){const v=y.mul(X(1,2,w),k(h));return this.sign=v.sign,this.layer=v.layer,this.mag=v.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}else this.mag=w;return this.normalize(),y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}fromValue(e){return e instanceof y?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:Xt(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Xt(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<=ir?(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):Xt(this.m,e)+"e"+Xt(this.e,e):this.layer===1?Xt(this.m,e)+"e"+Xt(this.e,e):this.layer<=ir?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Xt(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Xt(this.mag,e)}abs(){return te(this.sign===0?0:1,this.layer,this.mag)}neg(){return te(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?y.dZero:this.layer===0?X(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?y.dZero:this.layer===0?X(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?y.dZero:this.layer===0?X(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?y.dZero:this.layer===0?X(this.sign,0,Math.trunc(this.mag)):this}add(e){const t=k(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 te(0,0,0);let n,i;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(y.cmpabs(this,t)>0?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return y.fromNumber(n.sign*n.mag+i.sign*i.mag);const r=n.layer*Math.sign(n.mag),a=i.layer*Math.sign(i.mag);if(r-a>=2)return n;if(r===0&&a===-1){if(Math.abs(i.mag-Math.log10(n.mag))>ki)return n;{const l=Math.pow(10,Math.log10(n.mag)-i.mag),u=i.sign+n.sign*l;return X(Math.sign(u),1,i.mag+Math.log10(Math.abs(u)))}}if(r===1&&a===0){if(Math.abs(n.mag-Math.log10(i.mag))>ki)return n;{const l=Math.pow(10,n.mag-Math.log10(i.mag)),u=i.sign+n.sign*l;return X(Math.sign(u),1,Math.log10(i.mag)+Math.log10(Math.abs(u)))}}if(Math.abs(n.mag-i.mag)>ki)return n;{const l=Math.pow(10,n.mag-i.mag),u=i.sign+n.sign*l;return X(Math.sign(u),1,i.mag+Math.log10(Math.abs(u)))}}plus(e){return this.add(e)}sub(e){return this.add(k(e).neg())}subtract(e){return this.sub(e)}minus(e){return this.sub(e)}mul(e){const t=k(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer))return t;if(this.sign===0||t.sign===0)return te(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return te(this.sign*t.sign,0,1);let n,i;if(this.layer>t.layer||this.layer==t.layer&&Math.abs(this.mag)>Math.abs(t.mag)?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return y.fromNumber(n.sign*i.sign*n.mag*i.mag);if(n.layer>=3||n.layer-i.layer>=2)return X(n.sign*i.sign,n.layer,n.mag);if(n.layer===1&&i.layer===0)return X(n.sign*i.sign,1,n.mag+Math.log10(i.mag));if(n.layer===1&&i.layer===1)return X(n.sign*i.sign,1,n.mag+i.mag);if(n.layer===2&&i.layer===1){const r=X(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(X(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return X(n.sign*i.sign,r.layer+1,r.sign*r.mag)}if(n.layer===2&&i.layer===2){const r=X(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(X(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return X(n.sign*i.sign,r.layer+1,r.sign*r.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=k(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?y.dNaN:this.layer===0?X(this.sign,0,1/this.mag):X(this.sign,this.layer,-this.mag)}reciprocal(){return this.recip()}reciprocate(){return this.recip()}cmp(e){const t=k(e);return this.sign>t.sign?1:this.sign<t.sign?-1:this.sign*this.cmpabs(e)}cmpabs(e){const t=k(e),n=this.mag>0?this.layer:-this.layer,i=t.mag>0?t.layer:-t.layer;return n>i?1:n<i?-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=k(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=k(e);return this.lt(t)?t:this}min(e){const t=k(e);return this.gt(t)?t:this}maxabs(e){const t=k(e);return this.cmpabs(t)<0?t:this}minabs(e){const t=k(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 n=k(e);return this.eq_tolerance(n,t)?0:this.cmp(n)}compare_tolerance(e,t){return this.cmp_tolerance(e,t)}eq_tolerance(e,t){const n=k(e);if(t==null&&(t=1e-7),this.sign!==n.sign||Math.abs(this.layer-n.layer)>1)return!1;let i=this.mag,r=n.mag;return this.layer>n.layer&&(r=Mi(r)),this.layer<n.layer&&(i=Mi(i)),Math.abs(i-r)<=t*Math.max(Math.abs(i),Math.abs(r))}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 n=k(e);return!this.eq_tolerance(n,t)&&this.lt(n)}lte_tolerance(e,t){const n=k(e);return this.eq_tolerance(n,t)||this.lt(n)}gt_tolerance(e,t){const n=k(e);return!this.eq_tolerance(n,t)&&this.gt(n)}gte_tolerance(e,t){const n=k(e);return this.eq_tolerance(n,t)||this.gt(n)}pLog10(){return this.lt(y.dZero)?y.dZero:this.log10()}absLog10(){return this.sign===0?y.dNaN:this.layer>0?X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):X(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?y.dNaN:this.layer>0?X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):X(this.sign,0,Math.log10(this.mag))}log(e){return e=k(e),this.sign<=0||e.sign<=0||e.sign===1&&e.layer===0&&e.mag===1?y.dNaN:this.layer===0&&e.layer===0?X(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):y.div(this.log10(),e.log10())}log2(){return this.sign<=0?y.dNaN:this.layer===0?X(this.sign,0,Math.log2(this.mag)):this.layer===1?X(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?X(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?y.dNaN:this.layer===0?X(this.sign,0,Math.log(this.mag)):this.layer===1?X(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?X(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}logarithm(e){return this.log(e)}pow(e){const t=k(e),n=this,i=t;if(n.sign===0)return i.eq(0)?te(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(i.sign===0)return te(1,0,1);if(i.sign===1&&i.layer===0&&i.mag===1)return n;const r=n.absLog10().mul(i).pow10();return this.sign===-1?Math.abs(i.toNumber()%2)%2===1?r.neg():Math.abs(i.toNumber()%2)%2===0?r:y.dNaN:r}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return y.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 X(1,0,t);if(e.sign===0)return y.dOne;e=te(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?X(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?X(-e.sign,e.layer+1,-e.mag):y.dOne}pow_base(e){return k(e).pow(this)}root(e){const t=k(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?y.exp(y.mul(this,y.ln(this).sub(1))):y.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(te(1,0,24)))return y.fromNumber(rs(this.sign*this.mag));const e=this.mag-1;let t=.9189385332046727;t=t+(e+.5)*Math.log(e),t=t-e;const n=e*e;let i=e,r=12*i,a=1/r,l=t+a;if(l===t||(t=l,i=i*n,r=360*i,a=1/r,l=t-a,l===t))return y.exp(t);t=l,i=i*n,r=1260*i;let u=1/r;return t=t+u,i=i*n,r=1680*i,u=1/r,t=t-u,y.exp(t)}else return this.layer===1?y.exp(y.mul(this,y.ln(this).sub(1))):y.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?y.dOne:this.layer===0&&this.mag<=709.7?y.fromNumber(Math.exp(this.sign*this.mag)):this.layer===0?X(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?X(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):X(1,this.layer+1,this.sign*this.mag)}sqr(){return this.pow(2)}sqrt(){if(this.layer===0)return y.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return X(1,2,Math.log10(this.mag)-.3010299956639812);{const e=y.div(te(this.sign,this.layer-1,this.mag),te(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=te(1,0,1)){if(e===1)return y.pow(this,t);if(e===0)return new y(t);if(this.eq(y.dOne))return y.dOne;if(this.eq(-1))return y.pow(this,t);if(e===Number.POSITIVE_INFINITY){const r=this.toNumber();if(r<=1.444667861009766&&r>=.06598803584531254){if(r>1.444667861009099)return y.fromNumber(Math.E);const a=y.ln(this).neg();return a.lambertw().div(a)}else return r>1.444667861009766?y.fromNumber(Number.POSITIVE_INFINITY):y.dNaN}if(this.eq(y.dZero)){let r=Math.abs((e+1)%2);return r>1&&(r=2-r),y.fromNumber(r)}if(e<0)return y.iteratedlog(t,this,-e);t=k(t);const n=e;e=Math.trunc(e);const i=n-e;if(this.gt(y.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let r=0;r<e;++r){const a=t;if(t=this.pow(t),a.eq(t))return t}if(i!=0){const r=this.pow(t);return t.mul(1-i).add(r.mul(i))}return t}i!==0&&(t.eq(y.dOne)?this.gt(10)?t=this.pow(i):(t=y.fromNumber(y.tetrate_critical(this.toNumber(),i)),this.lt(2)&&(t=t.sub(1).mul(this.minus(1)).plus(1))):this.eq(10)?t=t.layeradd10(i):t=t.layeradd(i,this));for(let r=0;r<e;++r){if(t=this.pow(t),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(t.layer-this.layer>3)return te(t.sign,t.layer+(e-r-1),t.mag);if(r>1e4)return t}return t}iteratedexp(e=2,t=te(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return y.tetrate(e,-t,this);e=k(e);let n=y.fromDecimal(this);const i=t;t=Math.trunc(t);const r=i-t;if(n.layer-e.layer>3){const a=Math.min(t,n.layer-e.layer-3);t-=a,n.layer-=a}for(let a=0;a<t;++a){if(n=n.log(e),!isFinite(n.layer)||!isFinite(n.mag))return n.normalize();if(a>1e4)return n}return r>0&&r<1&&(e.eq(10)?n=n.layeradd10(-r):n=n.layeradd(-r,e)),n}slog(e=10,t=100){let n=.001,i=!1,r=!1,a=this.slog_internal(e).toNumber();for(let l=1;l<t;++l){const c=new y(e).tetrate(a).gt(this);if(l>1&&r!=c&&(i=!0),r=c,i?n/=2:n*=2,n=Math.abs(n)*(c?-1:1),a+=n,n===0)break}return y.fromNumber(a)}slog_internal(e=10){if(e=k(e),e.lte(y.dZero)||e.eq(y.dOne))return y.dNaN;if(e.lt(y.dOne))return this.eq(y.dOne)?y.dZero:this.eq(y.dZero)?y.dNegOne:y.dNaN;if(this.mag<0||this.eq(y.dZero))return y.dNegOne;let t=0,n=y.fromDecimal(this);if(n.layer-e.layer>3){const i=n.layer-e.layer-3;t+=i,n.layer-=i}for(let i=0;i<100;++i)if(n.lt(y.dZero))n=y.pow(e,n),t-=1;else{if(n.lte(y.dOne))return y.fromNumber(t+y.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=y.log(n,e)}return y.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:y.critical_section(e,t,is)}static tetrate_critical(e,t){return y.critical_section(e,t,ns)}static critical_section(e,t,n){t*=10,t<0&&(t=0),t>10&&(t=10),e<2&&(e=2),e>10&&(e=10);let i=0,r=0;for(let l=0;l<ln.length;++l)if(ln[l]==e){i=n[l][Math.floor(t)],r=n[l][Math.ceil(t)];break}else if(ln[l]<e&&ln[l+1]>e){const u=(e-ln[l])/(ln[l+1]-ln[l]);i=n[l][Math.floor(t)]*(1-u)+n[l+1][Math.floor(t)]*u,r=n[l][Math.ceil(t)]*(1-u)+n[l+1][Math.ceil(t)]*u;break}const a=t-Math.floor(t);return i<=0||r<=0?i*(1-a)+r*a:Math.pow(e,Math.log(i)/Math.log(e)*(1-a)+Math.log(r)/Math.log(e)*a)}layeradd10(e){e=y.fromValue_noAlloc(e).toNumber();const t=y.fromDecimal(this);if(e>=1){t.mag<0&&t.layer>0?(t.sign=0,t.mag=0,t.layer=0):t.sign===-1&&t.layer==0&&(t.sign=1,t.mag=-t.mag);const n=Math.trunc(e);e-=n,t.layer+=n}if(e<=-1){const n=Math.trunc(e);if(e-=n,t.layer+=n,t.layer<0)for(let i=0;i<100;++i){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 i=this.slog(t).toNumber()+e;return i>=0?y.tetrate(t,i):Number.isFinite(i)?i>=-1?y.log(y.tetrate(t,i+1),t):y.log(y.log(y.tetrate(t,i+2),t),t):y.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return y.fromNumber(rr(this.toNumber()));if(this.layer===0)return y.fromNumber(rr(this.sign*this.mag));if(this.layer===1)return ar(this);if(this.layer===2)return ar(this);if(this.layer>=3)return te(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return te(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=te(1,0,1)){t=k(t);const n=e;e=Math.trunc(e);const i=n-e;i!==0&&(t.eq(y.dOne)?(++e,t=y.fromNumber(i)):this.eq(10)?t=t.layeradd10(i):t=t.layeradd(i,this));for(let r=0;r<e;++r){if(t=this.tetrate(t.toNumber()),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(r>10)return t}return t}sin(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.sin(this.sign*this.mag)):te(0,0,0)}cos(){return this.mag<0?y.dOne:this.layer===0?y.fromNumber(Math.cos(this.sign*this.mag)):te(0,0,0)}tan(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.tan(this.sign*this.mag)):te(0,0,0)}asin(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.asin(this.sign*this.mag)):te(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?y.fromNumber(Math.acos(this.toNumber())):this.layer===0?y.fromNumber(Math.acos(this.sign*this.mag)):te(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.atan(this.sign*this.mag)):y.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 y.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return y.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?te(Number.NaN,Number.NaN,Number.NaN):y.ln(this.add(1).div(y.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(y.pow(10,e))}egg(){return this.add(9)}lessThanOrEqualTo(e){return this.cmp(e)<1}lessThan(e){return this.cmp(e)<0}greaterThanOrEqualTo(e){return this.cmp(e)>-1}greaterThan(e){return this.cmp(e)>0}};let o=y;o.fromStringCache=new Ha(es);o.dZero=te(0,0,0);o.dOne=te(1,0,1);o.dNegOne=te(-1,0,1);o.dTwo=te(1,0,2);o.dTen=te(1,0,10);o.dNaN=te(Number.NaN,Number.NaN,Number.NaN);o.dInf=te(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);o.dNegInf=te(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);o.dNumberMax=X(1,0,Number.MAX_VALUE);o.dNumberMin=X(1,0,Number.MIN_VALUE);k=o.fromValue_noAlloc;X=o.fromComponents;te=o.fromComponents_noNormalize;o.fromMantissaExponent;o.fromMantissaExponent_noNormalize;const as=new o(1);function Rn(e,t,n=!0){let i=o.log10(e).floor(),r=o.div(e,o.pow(10,i));r.toStringWithDecimalPlaces(t)==="10"&&(r=as,i=i.add(1));const a=i.gte(1e9)?pt(i,Math.max(Math.max(t,3),fe.defaultDecimalsShown)):i.gte(1e4)?ri(i,0):i.toStringWithDecimalPlaces(0);return n?r.toStringWithDecimalPlaces(t)+"e"+a:"e"+a}function ri(e,t){if(e==null)return"NaN";if(e=new o(e),e.mag<.001)return 0 .toFixed(t);const i=e.toStringWithDecimalPlaces(t).split(".");return i[0]=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"),i.length==1?i[0]:i[0]+"."+i[1]}function yr(e,t){return e==null?"NaN":(e=new o(e),e.mag<1e-4?0 .toFixed(t):(e.mag<.1&&t!==0&&(t=Math.max(Math.max(t,e.log10().negate().ceil().toNumber()),fe.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const ss=new o("eeee1000"),os=new o("e100000"),sr=new o("e1000"),wr=new o(1e9),ls=new o(1e6),us=new o(1e3),cs=new o(.98),ds=new o(.001),_r=new o(0);function pt(e,t,n){if(t==null&&(t=fe.defaultDecimalsShown),n=n!=null?n:fe.defaultShowSmall,e=new o(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+pt(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(ss)){const i=e.slog();return i.gte(ls)?"F"+pt(i.floor()):o.pow(10,i.sub(i.floor())).toStringWithDecimalPlaces(3)+"F"+ri(i.floor(),0)}else{if(e.gte(os))return Rn(e,0,!1);if(e.gte(sr))return Rn(e,0);if(e.gte(wr))return Rn(e,t);if(e.gte(us))return ri(e,0);if(e.gte(ds)||!n)return yr(e,t);if(e.eq(_r))return 0 .toFixed(t)}return e=Cr(e),e.lt(sr)?Rn(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):pt(e,t)+"\u207B\xB9"}function Ye(e){return e=new o(e),e.sign<0?"-"+Ye(e.neg()):e.gte(wr)||e.lte(cs)&&!e.eq(_r)?pt(e):pt(e,0)}function Nr(e){return o.lt(e,0)?"-"+Nr(o.neg(e)):o.gt(e,2**51)?pt(o.div(e,31536e3))+"y":(e=new o(e).toNumber(),e<60?pt(e)+"s":e<3600?Ye(Math.floor(e/60))+"m "+pt(e%60)+"s":e<86400?Ye(Math.floor(e/3600))+"h "+Ye(Math.floor(e/60)%60)+"m "+Ye(e%60)+"s":e<31536e3?Ye(Math.floor(e/84600)%365)+"d "+Ye(Math.floor(e/3600)%24)+"h "+Ye(Math.floor(e/60)%60)+"m":Ye(Math.floor(e/31536e3))+"y "+Ye(Math.floor(e/84600)%365)+"d "+Ye(Math.floor(e/3600)%24)+"h")}function fs(e,t,n){e=new o(e);let i=e.toStringWithDecimalPlaces(t);return new o(i).gte(n)&&(i=o.sub(n,Math.pow(.1,t)).toStringWithDecimalPlaces(t)),i}function ps(e,t){return pt(e,t,!0)}function Cr(e){let t=o.log10(e).ceil();const n=o.div(e,o.pow(10,t));return t=t.neg(),e=new o(10).pow(t).times(n),e}var gs=Object.freeze(Object.defineProperty({__proto__:null,default:o,exponentialFormat:Rn,commaFormat:ri,regularFormat:yr,format:pt,formatWhole:Ye,formatTime:Nr,toPlaces:fs,formatSmall:ps,invertOOM:Cr},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:ms,commaFormat:vs,regularFormat:hs,format:me,formatWhole:gt,formatTime:fi,toPlaces:bs,formatSmall:Qt,invertOOM:ys}=gs;window.Decimal=o;window.exponentialFormat=ms;window.commaFormat=vs;window.regularFormat=hs;window.format=me;window.formatWhole=gt;window.formatTime=fi;window.toPlaces=bs;window.formatSmall=Qt;window.invertOOM=ys;function Ke(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function zn(e){return typeof e=="function"}var G=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(G||{});const Un=Symbol("DoNotCache");function $(e,t){const n=e[t];zn(n)&&n.length===0&&!n[Un]?e[t]=N(n.bind(e)):zn(n)&&(e[t]=n.bind(e),e[t][Un]=!0)}function ve(e){return zn(e)&&!e[Un]&&(e=N(e)),e}const mt=Symbol("Component"),at=Symbol("GatherProps");let ws=0;function rn(e="feature-"){return e+ws++}var he=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(he||{});function Le(e){const t=s(e);return t!==2&&t!==!1}function wn(e){return s(e)===1}function K(e){return e[Un]=!0,e}function ie(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}function ai(e,...t){const n=[],i=r=>{Object.keys(r).forEach(a=>{const l=r[a];l!=null&&typeof l=="object"&&(t.includes(l.type)?n.push(l):!(l instanceof o)&&!De(l)&&i(l))})};return i(e),n}const un={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 Ri=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(Ri||{}),wt={classic:un,paper:{...un,variables:{...un.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:{...un,variables:{...un.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:{...un,variables:{...un.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}};const We=hr();"fonts"in document&&(document.fonts.onloadingdone=()=>We.emit("fontsLoaded"));var _s=Object.freeze(Object.defineProperty({__proto__:null,globalBus:We},Symbol.toStringTag,{value:"Module"}));const Ns=vn({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var Q=window.player=Ns;function kr(e){return JSON.stringify(e,(t,n)=>s(n))}function Mr(e={}){return Object.assign({id:`${fe.id}-0`,name:"Default Save",tabs:fe.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:fe.id,modVersion:fe.versionNumber,layers:{}},e)}function ut(e){const t=Kt.compressToUTF16(kr(e!=null?e:Q));return localStorage.setItem((e!=null?e:Q).id,t),t}async function Cs(){Ss();try{let e=localStorage.getItem(re.active);if(e==null){await fn(In());return}if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Kt.decompressFromUTF16(e);else throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==fe.id){await fn(In());return}t.id=re.active,await fn(t)}catch(e){console.error(`Failed to load save. Falling back to new save.
`,e),await fn(In())}}function In(){const e=ni(),t=Mr({id:e});return ut(t),re.saves.push(e),t}function ni(){let e,t=0;do e=`${fe.id}-${t++}`;while(localStorage.getItem(e)!=null);return e}const ks=V(!1);async function fn(e){console.info("Loading save",e),ks.value=!0;const{layers:t,removeLayer:n,addLayer:i}=await jn(()=>Promise.resolve().then(function(){return Zs}),void 0),{fixOldSave:r,getInitialLayers:a}=await jn(()=>Promise.resolve().then(function(){return vf}),void 0);for(const l in t){const u=t[l];u&&n(u)}a(e).forEach(l=>i(l,e)),e=Mr(e),e.offlineProd&&e.time!=null&&e.time&&e.devSpeed!==0&&(e.offlineTime==null&&(e.offlineTime=0),e.offlineTime+=Math.min(e.offlineTime+(Date.now()-e.time)/1e3,fe.offlineLimit*3600)),e.time=Date.now(),e.modVersion!==fe.versionNumber&&(r(e.modVersion,e),e.modVersion=fe.versionNumber),Object.assign(Q,e),re.active=Q.id,We.emit("onLoad")}setInterval(()=>{Q.autosave&&ut()},1e3);window.onbeforeunload=()=>{Q.autosave&&ut()};window.save=ut;const Ms=window.hardReset=async()=>{await fn(In())};window.deleteLowerSaves=()=>{const e=Object.values(re.saves).indexOf(Q.id)+1;Object.values(re.saves).slice(e).forEach(t=>localStorage.removeItem(t)),re.saves=re.saves.slice(0,e)};const Gn=vn({active:"",saves:[],showTPS:!0,theme:Ri.Nordic,unthrottled:!1,alignUnits:!1});dt(Gn,e=>{const t=Kt.compressToUTF16(JSON.stringify(e));localStorage.setItem(fe.id,t)},{deep:!0});var re=window.settings=Gn;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:Ri.Nordic,alignUnits:!1};We.emit("loadSettings",e),Object.assign(Gn,e),Ms()};function Ss(){try{let e=localStorage.getItem(fe.id);if(e!=null&&e!==""){if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Kt.decompressFromUTF16(e);else{console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(Gn,t)}We.emit("loadSettings",Gn)}catch{}}const Sr=vn([]);function Is(e){Sr.push(e)}const $s=vn([]),xs=vn([]),Es={class:"table"},Ps=J({__name:"Column",setup(e){const t=N(()=>wt[re.theme].mergeAdjacent);return(n,i)=>(M(),E("div",Es,[_("div",{class:pe(["col",{mergeAdjacent:s(t)}])},[Et(n.$slots,"default")],2)]))}}),Ts={class:"table"},Ds=J({__name:"Row",setup(e){const t=N(()=>wt[re.theme].mergeAdjacent);return(n,i)=>(M(),E("div",Ts,[_("div",{class:pe(["row",{mergeAdjacent:s(t)}])},[Et(n.$slots,"default")],2)]))}});function Ir(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!ca(e)}function se(e,t="span"){return typeof e=="function"?J({render:e}):typeof e=="string"?e.length>0?(e=e.trim(),e.charAt(0)!=="<"&&(e=`<${t}>${e}</${t}>`),J({template:e})):J({render:()=>({})}):e}function Qe(e){if(St(e))return typeof e=="function"?e():se(e);const t=e[mt];return p(t,e[at](),null)}function Si(...e){let t;return p(Ds,null,Ir(t=e.map(Qe))?t:{default:()=>[t]})}function Fs(...e){let t;return p(Ps,null,Ir(t=e.map(Qe))?t:{default:()=>[t]})}function Nt(e){if(St(e))return typeof e=="function"?e():typeof e=="string"?p(ne,null,[e]):p(e,null,null);const t=e[mt];return p(t,e[at](),null)}function or(e,t){return e.reduce((n,i)=>p(ne,null,[n,t,i]))}function St(e){return typeof e=="string"?!0:typeof e=="object"?e==null?!1:"render"in e||"component"in e:typeof e=="function"&&e[Un]===!0}function $r(e,t){const n=V(null),i=V(void 0);function r(u){n.value||(n.value=setInterval(l,250)),i.value=u}function a(){n.value&&(clearInterval(n.value),n.value=null)}function l(){t&&t.value?t.value():e&&e.value&&e.value(i.value)}return vr(a),{start:r,stop:a,handleHolding:l}}function xr(e,t="div"){const n=ft();return _t(()=>{n.value=se(Ce(e),t)}),n}function Pn(e,t="div"){const n=ft(null);return _t(()=>{const i=Ce(e);n.value=i==""||i==null?null:se(i,t)}),n}function Ce(e){return s(s(e))}function R(...e){return e.includes(Object)||e.push(Object),e}function lr(e){const t=V(!1),n=e[at].bind(e);return e[at]=()=>({...n(),onPointerenter:()=>t.value=!0,onPointerleave:()=>t.value=!1}),t}var ce=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};const As=J({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var m;const n=V({}),i=new ResizeObserver(u),r=V(null);ci(()=>{const f=r.value;f!=null&&i.observe(f)});let a=!0,l=V((m=r.value)==null?void 0:m.getBoundingClientRect());function u(){a&&(a=!1,jt(()=>{var f;l.value=(f=r.value)==null?void 0:f.getBoundingClientRect(),Object.values(n.value).filter(h=>h).forEach(h=>h.rect=h.element.getBoundingClientRect()),t("updateNodes",n.value),a=!0}))}We.on("fontsLoaded",u);const c={attributes:!1,childList:!0,subtree:!1};Qn(qi,(f,h)=>{const w=new MutationObserver(()=>d(f));w.observe(h,c),n.value[f]={element:h,observer:w,rect:h.getBoundingClientRect()},u()}),Qn(Vi,f=>{var h;(h=n.value[f])==null||h.observer.disconnect(),n.value[f]=void 0,u()}),Qn(Bi,n),Qn(Li,l);function d(f){const h=n.value[f];h!=null&&(h.rect=h.element.getBoundingClientRect(),t("updateNodes",n.value))}return(f,h)=>(M(),E(ne,null,[Et(f.$slots,"default",{},void 0,!0),_("div",{ref_key:"resizeListener",ref:r,class:"resize-listener"},null,512)],64))}});var Er=ce(As,[["__scopeId","data-v-2b1dc1bc"]]);const Os=["onPointerdown"],Rs={class:"modal-wrapper"},qs={class:"modal-container"},Vs={class:"modal-header"},Bs={class:"modal-body"},Ls={class:"modal-footer"},js=_("div",{class:"modal-default-flex-grow"},null,-1),Ut=J({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const r=$e(e),a=N(()=>s(r.modelValue)||u.value);function l(){n("update:modelValue",!1)}const u=V(!1),c=V(null),d=N(()=>{var m,f;return(f=(m=c.value)==null?void 0:m.nodes)!=null?f:null});return t({isOpen:a,nodes:d}),(m,f)=>(M(),ee(fa,{to:"#modal-root"},[p(xn,{name:"modal",onBeforeEnter:f[0]||(f[0]=h=>u.value=!0),onAfterLeave:f[1]||(f[1]=h=>u.value=!1)},{default:H(()=>[Ai(_("div",zt({class:"modal-mask",onPointerdown:$n(l,["self"])},m.$attrs),[_("div",Rs,[_("div",qs,[_("div",Vs,[Et(m.$slots,"header",{shown:s(a)},()=>[x(" default header ")])]),_("div",Bs,[p(Er,{ref_key:"contextRef",ref:c},{default:H(()=>[Et(m.$slots,"body",{shown:s(a)},()=>[x(" default body ")])]),_:3},512)]),_("div",Ls,[Et(m.$slots,"footer",{shown:s(a)},()=>[_("div",{class:"modal-default-footer"},[js,_("button",{class:"button modal-default-button",onClick:l}," Close ")])])])])])],16,Os),[[da,e.modelValue]])]),_:3})]))}}),Jt=Symbol("ProxyState");function He(e,t={}){const n=t;let i=!1;function r(){return i||(Object.assign(n,e.call(n,n)),i=!0),n}return new Proxy(n,{get(a,l){if(l===Jt)return r();const u=r()[l];return u!=null&&typeof u=="object"&&xt in u?u[xt]:u},set(a,l,u){return r()[l]=u,!0},has(a,l){return l===Jt?!0:Reflect.has(r(),l)},ownKeys(){return Reflect.ownKeys(r())},getOwnPropertyDescriptor(a,l){return i||(Object.assign(n,e.call(n,n)),i=!0),Object.getOwnPropertyDescriptor(a,l)}})}var Be=window.state=Oi({lastTenTicks:[],hasNaN:!1,NaNPath:[]});const en=Symbol("PersistentState"),nn=Symbol("DefaultValue"),si=Symbol("StackTrace"),oi=Symbol("Deleted"),xt=Symbol("NonPersistent"),pn=Symbol("SaveDataPath"),Di=Symbol("SkipPersistence");function zs(){var e,t;return(t=(e=new Error().stack)==null?void 0:e.split(`
`).slice(3,5).map(n=>n.trim()).join(`
`))!=null?t:""}function ur(e,t){var n;if(o.isNaN(t))throw Be.hasNaN||(Q.autosave=!1,Be.hasNaN=!0,Be.NaNPath=e[pn],Be.NaNPersistent=e),console.error("Attempted to save NaN value to",(n=e[pn])==null?void 0:n.join("."),e),new Error("Attempted to set NaN value. See above for details");e[en].value=t}function ct(e,t=!0){const n=De(e)?e:V(e);De(e)&&(e=e.value);const i=N({get(){return n.value},set(a){t?ur(r,a):r[en].value=a}});i[nn]=e;const r={get value(){return n.value},set value(a){t?ur(r,a):r[en].value=a},__v_isRef:!0,[en]:n,[nn]:e,[si]:zs(),[oi]:!1,[xt]:i,[pn]:void 0};return rt.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",r,`
Created at:
`+r[si]):mn[rt[rt.length-1]].add(r),r}function Us(e){return e!=null&&typeof e=="object"&&en in e}function Cn(e){return!(Jt in e)&&xt in e?e[xt]:new Proxy(e,{get(t,n){if(n!==en)return n===Di?!0:t[n]},set(t,n,i){return t[n]=i,!0},has(t,n){return n===en?!1:n==Di?!0:Reflect.has(t,n)}})}function Pr(e){rt.length===0?console.warn("Deleting a persistent ref outside of a layer. Ignoring...",e):mn[rt[rt.length-1]].delete(e),e[oi]=!0}We.on("addLayer",(e,t)=>{const n=[],i=(r,a=[])=>{let l=!1;return Object.keys(r).forEach(u=>{let c=r[u];if(c!=null&&typeof c=="object"){if(c[Di]===!0)return;if(Jt in c&&(c=c[Jt]),Us(c)){if(l=!0,c[oi]){console.warn("Deleted persistent ref present in returned object. Ignoring...",c,`
Created at:
`+c[si]);return}mn[e.id].delete(c);const d=[e.id,...a,u];c[pn]!=null&&JSON.stringify(d)!==JSON.stringify(c[pn])&&console.error(`Persistent ref is being saved to \`${d.join(".")}\` when it's already present at \`${c[pn].join(".")}\`. This can cause unexpected behavior when loading saves between updates.`,c),c[pn]=d;const m=a.reduce((h,w)=>(w in h||(h[w]={}),h[w]),t),f=m[u];m[u]=c[en],pa(m)?f!=null?m[u]=f:m[u]=c[nn]:f!=null?m[u].value=f:m[u].value=c[nn]}else!(c instanceof o)&&!De(c)&&!n.includes(c)&&(typeof c.type=="symbol"&&n.push(c),i(c,[...a,u])&&(Pt(c)&&!Pt(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.",Jt in r?r[Jt]:r,u):l=!0))}}),l};i(e[Jt]),mn[e.id].forEach(r=>{r[oi]||console.error(`Created persistent ref in ${e.id} without registering it to the layer! Make sure to include everything persistent in the returned object`,r,`
Created at:
`+r[si])}),mn[e.id].clear()});const qi=Symbol("RegisterNode"),Vi=Symbol("UnregisterNode"),Bi=Symbol("Nodes"),Li=Symbol("Bounds"),we=Oi({});window.layers=we;const mn={},rt=[];function ji(e,t){return He(()=>{const n={},i=n.emitter=hr();if(n.on=i.on.bind(i),n.emit=i.emit.bind(i),n.nodes=V({}),n.id=e,rt.push(e),mn[e]=new Set,n.minimized=ct(!1,!1),Object.assign(n,t.call(n,n)),rt[rt.length-1]==null||rt[rt.length-1]!==e)throw`Adding layers stack in invalid state. This should not happen
Stack: ${rt}
Trying to pop ${n.id}`;rt.pop(),$(n,"color"),$(n,"display"),$(n,"classes"),$(n,"style"),$(n,"name"),ie(n,"name",n.id),$(n,"minWidth"),ie(n,"minWidth",600),$(n,"minimizable"),ie(n,"minimizable",!0),$(n,"minimizedDisplay");const r=n.style;return n.style=N(()=>{var l,u;let a=s(n.minWidth);return(typeof a=="number"||!Number.isNaN(parseInt(a)))&&(a=a+"px"),[(l=s(r))!=null?l:"",(u=n.minimized)!=null&&u.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:a,flexBasis:a,margin:""}]}),n})}function zi(e,t){if(console.info("Adding layer",e.id),we[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,we[e.id]);return}ie(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),we[e.id]=e,We.emit("addLayer",e,t.layers[e.id])}function Gs(e){return we[e]}function Tr(e){console.info("Removing layer",e.id),We.emit("removeLayer",e),we[e.id]=void 0}function Ws(e){Tr(e),zi(e,Q)}function Hs(e){const t=V(!1);return{openModal:()=>t.value=!0,modal:K(()=>p(Ut,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},{header:()=>p("h2",null,[s(e.name)]),body:s(e.display)}))}}We.on("update",function(t){Object.values(we).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(we).forEach(n=>{n==null||n.emit("update",t)}),Object.values(we).forEach(n=>{n==null||n.emit("postUpdate",t)})});var Zs=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:qi,UnregisterNodeInjectionKey:Vi,NodesInjectionKey:Bi,BoundsInjectionKey:Li,layers:we,persistentRefs:mn,addingLayers:rt,createLayer:ji,addLayer:zi,getLayer:Gs,removeLayer:Tr,reloadLayer:Ws,setupLayerModal:Hs},Symbol.toStringTag,{value:"Module"}));const Ys=J({components:{Context:Er},props:{index:{type:Number,required:!0},display:{type:R(Object,String,Function),required:!0},minimizedDisplay:R(Object,String,Function),minimized:{type:Object,required:!0},name:{type:R(String),required:!0},color:R(String),minimizable:R(Boolean),nodes:{type:Object,required:!0}},emits:["setMinimized"],setup(e){const{display:t,index:n,minimized:i,minimizedDisplay:r}=$e(e),a=xr(t),l=Pn(r),u=N(()=>fe.allowGoBack&&n.value>0&&!Ce(i));function c(){Q.tabs.splice(s(e.index),1/0)}function d(m){e.nodes.value=m}return{component:a,minimizedComponent:l,showGoBack:u,updateNodes:d,unref:s,goBack:c}}}),Xs={key:1};function Js(e,t,n,i,r,a){const l=Ct("Context");return M(),E("div",{class:"layer-container",style:Re({"--layer-color":e.unref(e.color)})},[e.showGoBack?(M(),E("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...u)=>e.goBack&&e.goBack(...u))},"\u274C")):B("",!0),e.unref(e.minimized)?(M(),E("button",{key:1,class:"layer-tab minimized",onClick:t[1]||(t[1]=u=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(M(),ee(Ue(e.minimizedComponent),{key:0})):(M(),E("div",Xs,ae(e.unref(e.name)),1))])):(M(),E("div",{key:2,class:pe(["layer-tab",{showGoBack:e.showGoBack}])},[p(l,{onUpdateNodes:e.updateNodes},{default:H(()=>[(M(),ee(Ue(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(M(),E("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=u=>e.$emit("setMinimized",!0))}," \u25BC ")):B("",!0)],4)}var Ks=ce(Ys,[["render",Js],["__scopeId","data-v-72dd78b1"]]);const Dr=e=>(bn("data-v-4b4bda40"),e=e(),yn(),e),Qs=Dr(()=>_("h2",null,"Changelog",-1)),eo=Dr(()=>_("details",{open:""},[_("summary",null,[x("v0.0 Initial Commit - "),_("time",null,"2021-09-04")]),x(" This is the first release :D "),_("ul",null,[_("li",{class:"feature"},"Did everything"),_("li",{class:"fix"},"Had some fun"),_("li",{class:"breaking"},"Removed everything"),_("li",{class:"balancing"},"Created some bugs to fix later")])],-1)),to=J({__name:"Changelog",setup(e,{expose:t}){const n=V(!1);return t({open(){n.value=!0}}),(i,r)=>(M(),ee(Ut,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a)},{header:H(()=>[Qs]),body:H(()=>[eo]),_:1},8,["modelValue"]))}});var no=ce(to,[["__scopeId","data-v-4b4bda40"]]),io=J({props:{element:Object,display:{type:R(Object,String,Function),required:!0},style:R(Object,String,Array),classes:R(Object),direction:R(String),xoffset:R(String),yoffset:R(String),pinned:Object},setup(e){const{element:t,display:n,pinned:i}=$e(e),r=V(!1),a=N(()=>(Ce(i)||r.value)&&l.value),l=Pn(n),u=ft(se(K(()=>{const m=Ce(t);return m==null?"":Nt(m)})));function c(m){const f=i;m.shiftKey&&f&&(f.value=!f.value,m.stopPropagation(),m.preventDefault())}const d=N(()=>Ce(i)&&wt[re.theme].showPin);return{Direction:G,isHovered:r,isShown:a,comp:l,elementComp:u,unref:s,togglePinned:c,showPin:d}}});const ro={key:0,class:"material-icons pinned"};function ao(e,t,n,i,r,a){return M(),E("div",{class:pe(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=l=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=l=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...l)=>e.togglePinned&&e.togglePinned(...l))},[Et(e.$slots,"default",{},void 0,!0),e.elementComp?(M(),ee(Ue(e.elementComp),{key:0})):B("",!0),p(xn,{name:"fade"},{default:H(()=>{var l;return[e.isShown?(M(),E("div",{key:0,class:pe(["tooltip",{top:e.unref(e.direction)===e.Direction.Up,left:e.unref(e.direction)===e.Direction.Left,right:e.unref(e.direction)===e.Direction.Right,bottom:e.unref(e.direction)===e.Direction.Down,...e.unref(e.classes)}]),style:Re([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(l=e.unref(e.style))!=null?l:{}])},[e.showPin?(M(),E("span",ro,"push_pin")):B("",!0),e.comp?(M(),ee(Ue(e.comp),{key:1})):B("",!0)],6)):B("",!0)]}),_:1})],34)}var Pe=ce(io,[["render",ao],["__scopeId","data-v-6102fa3a"]]);const _n=e=>(bn("data-v-4f97aa40"),e=e(),yn(),e),so={class:"info-modal-header"},oo=["src","alt"],lo={class:"info-modal-title"},uo={key:0},co={key:0},fo={key:0},po=_n(()=>_("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),go=_n(()=>_("br",null,null,-1)),mo=_n(()=>_("br",null,null,-1)),vo=["href"],ho=_n(()=>_("span",{class:"material-icons info-modal-discord"},"discord",-1)),bo=_n(()=>_("div",null,[_("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[_("span",{class:"material-icons info-modal-discord"},"discord"),x(" The Paper Pilot Community ")])],-1)),yo=_n(()=>_("div",null,[_("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[_("span",{class:"material-icons info-modal-discord"},"discord"),x(" The Modding Tree ")])],-1)),wo=_n(()=>_("br",null,null,-1));var _o=J({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:i,logo:r,author:a,discordName:l,discordLink:u,versionNumber:c,versionTitle:d}=fe,m=$e(n),f=V(!1),h=N(()=>fi(Q.timePlayed)),w=N(()=>se(K(()=>p(ne,null,[$s.map(Qe)]))));t({open(){f.value=!0}});function v(){var b;(b=s(m.changelog))==null||b.open()}return(b,I)=>(M(),ee(Ut,{modelValue:f.value,"onUpdate:modelValue":I[0]||(I[0]=A=>f.value=A)},{header:H(()=>[_("div",so,[s(r)?(M(),E("img",{key:0,class:"info-modal-logo",src:s(r),alt:s(i)},null,8,oo)):B("",!0),_("div",lo,[_("h2",null,ae(s(i)),1),_("h4",null,[x(" v"+ae(s(c)),1),s(d)?(M(),E("span",uo,": "+ae(s(d)),1)):B("",!0)])])])]),body:H(({shown:A})=>[A?(M(),E("div",co,[s(a)?(M(),E("div",fo,"By "+ae(s(a)),1)):B("",!0),po,go,_("div",{class:"link",onClick:v},"Changelog"),mo,_("div",null,[s(u)?(M(),E("a",{key:0,href:s(u),class:"info-modal-discord-link",target:"_blank"},[ho,x(" "+ae(s(l)),1)],8,vo)):B("",!0)]),bo,yo,wo,_("div",null,"Time Played: "+ae(s(h)),1),(M(),ee(Ue(s(w))))])):B("",!0)]),_:1},8,["modelValue"]))}});var No=ce(_o,[["__scopeId","data-v-4f97aa40"]]);const Co={class:"field"},ko={key:0,class:"field-title"},Ui=J({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var l;const n=e,i=Pn(tn(n,"title"),"span"),r=V((l=n.options.find(u=>u.value===n.modelValue))!=null?l:null);dt(tn(n,"modelValue"),u=>{var c;Ce(r)!==u&&(r.value=(c=n.options.find(d=>d.value===u))!=null?c:null)});function a(u){t("update:modelValue",u.value)}return(u,c)=>(M(),E("div",Co,[s(i)?(M(),E("span",ko,[(M(),ee(Ue(s(i))))])):B("",!0),p(s(ya),{options:e.options,modelValue:r.value,"onUpdate:modelValue":[c[0]||(c[0]=d=>r.value=d),a],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}});const Mo={class:"field"},So=J({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,i=N(()=>{var a;return se((a=s(n.title))!=null?a:"<span></span>","span")}),r=N({get(){return!!n.modelValue},set(a){t("update:modelValue",a)}});return(a,l)=>(M(),E("label",Mo,[Ai(_("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":l[0]||(l[0]=u=>De(r)?r.value=u:null)},null,512),[[ga,s(r)]]),(M(),ee(Ue(s(i))))]))}});var Bt=ce(So,[["__scopeId","data-v-11046116"]]);const Io=["onClick"],$o=J({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=V(!1),i=V(null);function r(){t("click"),i.value&&clearTimeout(i.value),n.value=!1,jt(()=>{n.value=!0,i.value=setTimeout(()=>n.value=!1,500)})}return(a,l)=>(M(),E("button",{onClick:$n(r,["stop"]),class:pe(["feedback",{activated:n.value,left:e.left}])},[Et(a.$slots,"default",{},void 0,!0)],10,Io))}});var Fr=ce($o,[["__scopeId","data-v-01a1b95c"]]);const xo={class:"header"},Eo=_("h2",null,"Settings",-1),Po={class:"option-tabs"},To={key:0},Do={key:1};var Fo=J({__name:"Options",setup(e,{expose:t}){const n=V(!1),i=V("behaviour");function r(Z){return Z==i.value}function a(Z){i.value=Z}t({isTab:r,setTab:a,save:ut,open(){n.value=!0}});const l=Object.keys(wt).map(Z=>({label:Ke(Z),value:Z})),u=N(()=>se(K(()=>p(ne,null,[Sr.map(Qe)])))),{showTPS:c,theme:d,unthrottled:m,alignUnits:f}=$e(re),{autosave:h,offlineProd:w}=$e(Q),v=N({get(){return Q.devSpeed===0},set(Z){Q.devSpeed=Z?0:null}}),b=K(()=>p("span",{class:"option-title"},[x("Unthrottled"),p("desc",null,[x("Allow the game to run as fast as possible. Not battery friendly.")])])),I=K(()=>p("span",{class:"option-title"},[x("Offline Production"),p(Pe,{display:"Save-specific",direction:G.Right},{default:()=>[x("*")]}),p("desc",null,[x("Simulate production that occurs while the game is closed.")])])),A=K(()=>p("span",{class:"option-title"},[x("Autosave"),p(Pe,{display:"Save-specific",direction:G.Right},{default:()=>[x("*")]}),p("desc",null,[x("Automatically save the game every second or when the game is closed.")])])),S=K(()=>p("span",{class:"option-title"},[x("Pause game"),p(Pe,{display:"Save-specific",direction:G.Right},{default:()=>[x("*")]}),p("desc",null,[x("Stop everything from moving.")])])),P=K(()=>p("span",{class:"option-title"},[x("Theme"),p("desc",null,[x("How the game looks.")])])),L=K(()=>p("span",{class:"option-title"},[x("Show TPS"),p("desc",null,[x("Show TPS meter at the bottom-left corner of the page.")])])),le=K(()=>p("span",{class:"option-title"},[x("Align modifier units"),p("desc",null,[x("Align numbers to the beginning of the unit in modifier view.")])]));return(Z,z)=>(M(),ee(Ut,{modelValue:n.value,"onUpdate:modelValue":z[10]||(z[10]=U=>n.value=U)},{header:H(()=>[_("div",xo,[Eo,_("div",Po,[_("button",{class:pe({selected:r("behaviour")}),onClick:z[0]||(z[0]=U=>a("behaviour"))},"Behaviour",2),_("button",{class:pe({selected:r("appearance")}),onClick:z[1]||(z[1]=U=>a("appearance"))},"Appearance",2)])])]),body:H(()=>[r("behaviour")?(M(),E("div",To,[p(Bt,{title:s(b),modelValue:s(m),"onUpdate:modelValue":z[2]||(z[2]=U=>De(m)?m.value=U:null)},null,8,["title","modelValue"]),s(fe).enablePausing?(M(),ee(Bt,{key:0,title:s(S),modelValue:s(v),"onUpdate:modelValue":z[3]||(z[3]=U=>De(v)?v.value=U:null)},null,8,["title","modelValue"])):B("",!0),p(Bt,{title:s(I),modelValue:s(w),"onUpdate:modelValue":z[4]||(z[4]=U=>De(w)?w.value=U:null)},null,8,["title","modelValue"]),p(Bt,{title:s(A),modelValue:s(h),"onUpdate:modelValue":z[5]||(z[5]=U=>De(h)?h.value=U:null)},null,8,["title","modelValue"]),s(h)?B("",!0):(M(),ee(Fr,{key:1,class:"button save-button",onClick:z[6]||(z[6]=U=>s(ut)())},{default:H(()=>[x("Manually save")]),_:1}))])):B("",!0),r("appearance")?(M(),E("div",Do,[p(Ui,{title:s(P),options:s(l),modelValue:s(d),"onUpdate:modelValue":z[7]||(z[7]=U=>De(d)?d.value=U:null)},null,8,["title","options","modelValue"]),(M(),ee(Ue(s(u)))),p(Bt,{title:s(L),modelValue:s(c),"onUpdate:modelValue":z[8]||(z[8]=U=>De(c)?c.value=U:null)},null,8,["title","modelValue"]),p(Bt,{title:s(le),modelValue:s(f),"onUpdate:modelValue":z[9]||(z[9]=U=>De(f)?f.value=U:null)},null,8,["title","modelValue"])])):B("",!0)]),_:1},8,["modelValue"]))}});const Ao=["onSubmit"],Oo={class:"field"},Ro={key:0,class:"field-title"},qo=["placeholder"],Vo=J({__name:"Text",props:{title:null,modelValue:null,textArea:{type:Boolean},placeholder:null,maxHeight:null,submitOnBlur:{type:Boolean}},emits:["update:modelValue","submit","cancel"],setup(e,{emit:t}){const n=e,i=Pn(tn(n,"title"),"span"),r=ft(null);ci(()=>{var c;(c=r.value)==null||c.focus()});const a=N({get(){var c;return(c=s(n.modelValue))!=null?c:""},set(c){t("update:modelValue",c)}});function l(){t("submit")}function u(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(c,d)=>(M(),E("form",{onSubmit:$n(l,["prevent"])},[_("div",Oo,[s(i)?(M(),E("span",Ro,[(M(),ee(Ue(s(i))))])):B("",!0),e.textArea?(M(),ee(s(_a),{key:1,modelValue:s(a),"onUpdate:modelValue":d[0]||(d[0]=m=>De(a)?a.value=m:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:u,ref_key:"field",ref:r},null,8,["modelValue","placeholder","maxHeight"])):Ai((M(),E("input",{key:2,type:"text","onUpdate:modelValue":d[1]||(d[1]=m=>De(a)?a.value=m:null),placeholder:e.placeholder,class:pe({fullWidth:!e.title}),onBlur:u,ref_key:"field",ref:r},null,42,qo)),[[ma,s(a)]])])],40,Ao))}});var Ar=ce(Vo,[["__scopeId","data-v-90bd4994"]]);const Bo={key:0},Lo=["onClick","disabled"],jo={key:0},zo=["onClick"],Uo=J({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const i=$e(e),r=V(!1);dt(r,u=>{t("confirmingChanged",u)});function a(){if(s(i.skipConfirm)){t("click");return}r.value&&t("click"),r.value=!r.value}function l(){r.value=!1}return(u,c)=>(M(),E("span",{class:pe(["container",{confirming:r.value}])},[r.value?(M(),E("span",Bo,"Are you sure?")):B("",!0),_("button",{onClick:$n(a,["stop"]),class:"button danger",disabled:e.disabled},[r.value?(M(),E("span",jo,"Yes")):Et(u.$slots,"default",{key:1},void 0,!0)],8,Lo),r.value?(M(),E("button",{key:1,class:"button",onClick:$n(l,["stop"])},"No",8,zo)):B("",!0)],2))}});var Go=ce(Uo,[["__scopeId","data-v-2f8ef34c"]]);const Gt=e=>(bn("data-v-32313015"),e=e(),yn(),e),Wo=Gt(()=>_("div",{class:"handle material-icons"},"drag_handle",-1)),Ho={key:0,class:"actions"},Zo=Gt(()=>_("span",{class:"material-icons"},"content_paste",-1)),Yo=Gt(()=>_("span",{class:"material-icons"},"content_copy",-1)),Xo=Gt(()=>_("span",{class:"material-icons"},"edit",-1)),Jo=Gt(()=>_("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),Ko={key:1,class:"actions"},Qo=Gt(()=>_("span",{class:"material-icons"},"check",-1)),el=Gt(()=>_("span",{class:"material-icons"},"close",-1)),tl={key:2,class:"details"},nl={class:"save-version"},il=Gt(()=>_("br",null,null,-1)),rl={key:0},al={key:3,class:"details"},sl={key:4,class:"details error"},ol=Gt(()=>_("br",null,null,-1)),ll=J({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:i}=$e(n),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),a=V(!1),l=V(!1),u=V("");dt(a,()=>{var f;return u.value=(f=i.value.name)!=null?f:""});const c=N(()=>i.value!=null&&i.value.id===Q.id),d=N(()=>{var f;return c.value?Q.time:(f=i.value!=null&&i.value.time)!=null?f:0});function m(){t("editName",u.value),a.value=!1}return(f,h)=>(M(),E("div",{class:pe(["save",{active:s(c)}])},[Wo,a.value?(M(),E("div",Ko,[_("button",{onClick:m,class:"button"},[p(Pe,{display:"Save",direction:s(G).Left,class:"info"},{default:H(()=>[Qo]),_:1},8,["direction"])]),_("button",{onClick:h[5]||(h[5]=w=>a.value=!a.value),class:"button"},[p(Pe,{display:"Cancel",direction:s(G).Left,class:"info"},{default:H(()=>[el]),_:1},8,["direction"])])])):(M(),E("div",Ho,[s(i).error==null&&!l.value?(M(),ee(Fr,{key:0,onClick:h[0]||(h[0]=w=>t("export")),class:"button",left:""},{default:H(()=>[p(Pe,{display:"Export",direction:s(G).Left,class:"info"},{default:H(()=>[Zo]),_:1},8,["direction"])]),_:1})):B("",!0),s(i).error==null&&!l.value?(M(),E("button",{key:1,onClick:h[1]||(h[1]=w=>t("duplicate")),class:"button"},[p(Pe,{display:"Duplicate",direction:s(G).Left,class:"info"},{default:H(()=>[Yo]),_:1},8,["direction"])])):B("",!0),s(i).error==null&&!l.value?(M(),E("button",{key:2,onClick:h[2]||(h[2]=w=>a.value=!a.value),class:"button"},[p(Pe,{display:"Edit Name",direction:s(G).Left,class:"info"},{default:H(()=>[Xo]),_:1},8,["direction"])])):B("",!0),p(Go,{disabled:s(c),onClick:h[3]||(h[3]=w=>t("delete")),onConfirmingChanged:h[4]||(h[4]=w=>l.value=w)},{default:H(()=>[p(Pe,{display:"Delete",direction:s(G).Left,class:"info"},{default:H(()=>[Jo]),_:1},8,["direction"])]),_:1},8,["disabled"])])),s(i).error==null&&!a.value?(M(),E("div",tl,[_("button",{class:"button open",onClick:h[6]||(h[6]=w=>t("open"))},[_("h3",null,ae(s(i).name),1)]),_("span",nl,"v"+ae(s(i).modVersion),1),il,s(d)?(M(),E("div",rl,"Last played "+ae(s(r).format(s(d))),1)):B("",!0)])):s(i).error==null&&a.value?(M(),E("div",al,[p(Ar,{modelValue:u.value,"onUpdate:modelValue":h[7]||(h[7]=w=>u.value=w),class:"editname",onSubmit:m},null,8,["modelValue"])])):(M(),E("div",sl,[x(" Error: Failed to load save with id "+ae(s(i).id),1),ol,x(ae(s(i).error),1)]))],2))}});var ul=ce(ll,[["__scopeId","data-v-32313015"]]);const Gi=e=>(bn("data-v-2a4275be"),e=e(),yn(),e),cl=Gi(()=>_("h2",null,"Saves Manager",-1)),dl={class:"modal-footer"},fl={class:"field"},pl=Gi(()=>_("span",{class:"field-title"},"Create Save",-1)),gl={class:"field-buttons"},ml={class:"footer"},vl=Gi(()=>_("div",{style:{"flex-grow":"1"}},null,-1)),hl=J({__name:"SavesManager",setup(e,{expose:t}){const n=V(!1),i=V(null);t({open(){n.value=!0}});const r=V(!1),a=V(""),l=V(null);dt(a,S=>{S?jt(()=>{try{if(S[0]!=="{")if(S[0]==="e")S=decodeURIComponent(escape(atob(S)));else if(S[0]==="\u1BE1")S=Kt.decompressFromUTF16(S);else{console.warn("Unable to determine preset encoding",S),r.value=!0;return}const P=JSON.parse(S);if(typeof P!="object"){r.value=!0;return}const L=ni();P.id=L,ut(P),a.value="",r.value=!1,re.saves.push(L)}catch{r.value=!0}}):r.value=!1});let u={},c=V(Object.keys(u).reduce((S,P)=>(S.push({label:P.split("/").slice(-1)[0].slice(0,-4),value:u[P]}),S),[]));const d=Oi({});function m(S){if(d[S]==null){let P=localStorage.getItem(S);if(P==null)d[S]={error:"Save doesn't exist in localStorage",id:S};else if(P==="dW5kZWZpbmVk")d[S]={error:"Save is undefined",id:S};else try{if(P[0]!=="{")if(P[0]==="e")P=decodeURIComponent(escape(atob(P)));else if(P[0]==="\u1BE1")P=Kt.decompressFromUTF16(P);else return console.warn("Unable to determine preset encoding",P),r.value=!0,d[S]={error:"Unable to determine preset encoding",id:S},d[S];d[S]={...JSON.parse(P),id:S}}catch(L){d[S]={error:L,id:S},console.warn(`SavesManager: Failed to load info about save with id ${S}:
${L}
${P}`)}}return d[S]}dt(n,S=>{S&&Object.keys(d).forEach(P=>delete d[P])});const f=N(()=>re.saves.reduce((S,P)=>(S[P]=m(P),S),{}));function h(S){let P;switch(Q.id===S?P=kr(Q):P=JSON.stringify(f.value[S]),fe.exportEncoding){default:console.warn(`Unknown save encoding: ${fe.exportEncoding}. Defaulting to lz`);case"lz":P=Kt.compressToUTF16(P);break;case"base64":P=btoa(unescape(encodeURIComponent(P)));break;case"plain":break}const L=document.createElement("textarea");L.value=P,document.body.appendChild(L),L.select(),L.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(L)}function w(S){Q.id===S&&ut();const P={...f.value[S],id:ni()};ut(P),re.saves.push(P.id)}function v(S){re.saves=re.saves.filter(P=>P!==S),localStorage.removeItem(S),d[S]=void 0}function b(S){f.value[Q.id].time=Q.time,ut(),d[Q.id]=void 0,fn(f.value[S]),d[S]=void 0}function I(S){if(l.value=S,jt(()=>{l.value=null}),S[0]!=="{")if(S[0]==="e")S=decodeURIComponent(escape(atob(S)));else if(S[0]==="\u1BE1")S=Kt.decompressFromUTF16(S);else{console.warn("Unable to determine preset encoding",S);return}const P=JSON.parse(S);P.id=ni(),ut(P),re.saves.push(P.id),b(P.id)}function A(S,P){const L=f.value[S];L!=null&&(L.name=P,Q.id===S?(Q.name=P,ut()):(ut(L),d[S]=void 0))}return(S,P)=>(M(),ee(Ut,{modelValue:n.value,"onUpdate:modelValue":P[4]||(P[4]=L=>n.value=L),ref_key:"modal",ref:i},{header:H(()=>[cl]),body:H(({shown:L})=>[L?(M(),ee(s(wa),{key:0,list:s(re).saves,handle:".handle",itemKey:le=>le},{item:H(({element:le})=>[p(ul,{save:s(f)[le],onOpen:Z=>b(le),onExport:Z=>h(le),onEditName:Z=>A(le,Z),onDuplicate:Z=>w(le),onDelete:Z=>v(le)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):B("",!0)]),footer:H(()=>[_("div",dl,[p(Ar,{modelValue:a.value,"onUpdate:modelValue":P[0]||(P[0]=L=>a.value=L),title:"Import Save",placeholder:"Paste your save here!",class:pe({importingFailed:r.value})},null,8,["modelValue","class"]),_("div",fl,[pl,_("div",gl,[_("button",{class:"button",onClick:P[1]||(P[1]=L=>b(s(In)().id))},"New Game"),Object.keys(s(c)).length>0?(M(),ee(Ui,{key:0,options:s(c),modelValue:l.value,"onUpdate:modelValue":P[2]||(P[2]=L=>I(L)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):B("",!0)])]),_("div",ml,[vl,_("button",{class:"button modal-default-button",onClick:P[3]||(P[3]=L=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Or=ce(hl,[["__scopeId","data-v-2a4275be"]]);const vt=e=>(bn("data-v-318a1c31"),e=e(),yn(),e),bl=["src","alt"],yl={key:1,class:"title"},wl=vt(()=>_("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),_l={class:"discord"},Nl={class:"discord-links"},Cl={key:0},kl=["href"],Ml=vt(()=>_("li",null,[_("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),Sl=vt(()=>_("li",null,[_("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),Il={href:"https://forums.moddingtree.com/",target:"_blank"},$l=vt(()=>_("span",{class:"material-icons"},"forum",-1)),xl=vt(()=>_("span",{class:"material-icons"},"info",-1)),El=vt(()=>_("span",{class:"material-icons"},"library_books",-1)),Pl=vt(()=>_("span",{class:"material-icons"},"settings",-1)),Tl=vt(()=>_("span",{class:"material-icons"},"library_books",-1)),Dl=vt(()=>_("span",{class:"material-icons"},"settings",-1)),Fl=vt(()=>_("span",{class:"material-icons"},"info",-1)),Al={href:"https://forums.moddingtree.com/",target:"_blank"},Ol=vt(()=>_("span",{class:"material-icons"},"forum",-1)),Rl={class:"discord"},ql={class:"discord-links"},Vl={key:0},Bl=["href"],Ll=vt(()=>_("li",null,[_("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),jl=vt(()=>_("li",null,[_("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),zl=J({__name:"Nav",setup(e){const t=V(null),n=V(null),i=V(null),r=V(null),{useHeader:a,banner:l,title:u,discordName:c,discordLink:d,versionNumber:m}=fe;function f(){window.open(d,"mywindow")}return(h,w)=>(M(),E(ne,null,[s(a)?(M(),E("div",zt({key:0,class:"nav"},h.$attrs),[s(l)?(M(),E("img",{key:0,src:s(l),class:"banner",alt:s(u)},null,8,bl)):(M(),E("div",yl,ae(s(u)),1)),_("div",{onClick:w[0]||(w[0]=v=>{var b;return(b=r.value)==null?void 0:b.open()}),class:"version-container"},[p(Pe,{display:"Changelog",direction:s(G).Down,class:"version"},{default:H(()=>[_("span",null,"v"+ae(s(m)),1)]),_:1},8,["direction"])]),wl,_("div",_l,[_("span",{onClick:f,class:"material-icons"},"discord"),_("ul",Nl,[s(d)?(M(),E("li",Cl,[_("a",{href:s(d),target:"_blank"},ae(s(c)),9,kl)])):B("",!0),Ml,Sl])]),_("div",null,[_("a",Il,[p(Pe,{display:"Forums",direction:s(G).Down,yoffset:"5px"},{default:H(()=>[$l]),_:1},8,["direction"])])]),_("div",{onClick:w[1]||(w[1]=v=>{var b;return(b=t.value)==null?void 0:b.open()})},[p(Pe,{display:"Info",direction:s(G).Down,class:"info"},{default:H(()=>[xl]),_:1},8,["direction"])]),_("div",{onClick:w[2]||(w[2]=v=>{var b;return(b=n.value)==null?void 0:b.open()})},[p(Pe,{display:"Saves",direction:s(G).Down,xoffset:"-20px"},{default:H(()=>[El]),_:1},8,["direction"])]),_("div",{onClick:w[3]||(w[3]=v=>{var b;return(b=i.value)==null?void 0:b.open()})},[p(Pe,{display:"Settings",direction:s(G).Down,xoffset:"-66px"},{default:H(()=>[Pl]),_:1},8,["direction"])])],16)):(M(),E("div",zt({key:1,class:"overlay-nav"},h.$attrs),[_("div",{onClick:w[4]||(w[4]=v=>{var b;return(b=r.value)==null?void 0:b.open()}),class:"version-container"},[p(Pe,{display:"Changelog",direction:s(G).Right,xoffset:"25%",class:"version"},{default:H(()=>[_("span",null,"v"+ae(s(m)),1)]),_:1},8,["direction"])]),_("div",{onClick:w[5]||(w[5]=v=>{var b;return(b=n.value)==null?void 0:b.open()})},[p(Pe,{display:"Saves",direction:s(G).Right},{default:H(()=>[Tl]),_:1},8,["direction"])]),_("div",{onClick:w[6]||(w[6]=v=>{var b;return(b=i.value)==null?void 0:b.open()})},[p(Pe,{display:"Settings",direction:s(G).Right},{default:H(()=>[Dl]),_:1},8,["direction"])]),_("div",{onClick:w[7]||(w[7]=v=>{var b;return(b=t.value)==null?void 0:b.open()})},[p(Pe,{display:"Info",direction:s(G).Right},{default:H(()=>[Fl]),_:1},8,["direction"])]),_("div",null,[_("a",Al,[p(Pe,{display:"Forums",direction:s(G).Right,xoffset:"7px"},{default:H(()=>[Ol]),_:1},8,["direction"])])]),_("div",Rl,[_("span",{onClick:f,class:"material-icons"},"discord"),_("ul",ql,[s(d)?(M(),E("li",Vl,[_("a",{href:s(d),target:"_blank"},ae(s(c)),9,Bl)])):B("",!0),Ll,jl])])],16)),p(No,{ref_key:"info",ref:t,changelog:r.value},null,8,["changelog"]),p(Or,{ref_key:"savesManager",ref:n},null,512),p(Fo,{ref_key:"options",ref:i},null,512),p(no,{ref_key:"changelog",ref:r},null,512)],64))}});var Rr=ce(zl,[["__scopeId","data-v-318a1c31"]]);const Ul={class:"inner-tab"},Gl=J({__name:"Game",setup(e){const t=tn(Q,"tabs"),n=N(()=>Object.keys(we)),i=fe.useHeader;function r(a){const{display:l,minimized:u,name:c,color:d,minimizable:m,nodes:f,minimizedDisplay:h}=a;return{display:l,minimized:u,name:c,color:d,minimizable:m,nodes:f,minimizedDisplay:h}}return(a,l)=>(M(),E("div",{class:pe(["tabs-container",{useHeader:s(i)}])},[(M(!0),E(ne,null,En(s(t),(u,c)=>{var d,m;return M(),E("div",{key:c,class:pe(["tab",s((d=s(we)[u])==null?void 0:d.classes)]),style:Re(s((m=s(we)[u])==null?void 0:m.style))},[c===0&&!s(i)?(M(),ee(Rr,{key:0})):B("",!0),_("div",Ul,[s(n).includes(u)?(M(),ee(Ks,zt({key:0},r(s(we)[u]),{index:c,onSetMinimized:f=>s(we)[u].minimized.value=f}),null,16,["index","onSetMinimized"])):(M(),ee(Ue(u),{key:1,index:c},null,8,["index"]))])],6)}),128))],2))}});var Wl=ce(Gl,[["__scopeId","data-v-dcd207b4"]]);const Hl=J({__name:"Sticky",setup(e){const t=V("0"),n=new ResizeObserver(r),i=ft(null);function r(){let a=i.value;if(a==null)return;let l=0;for(;a.previousSibling;){const u=a.previousSibling;u.dataset&&"vSticky"in u.dataset&&(l+=u.offsetHeight),a=u}t.value=l+"px"}return jt(r),document.fonts.ready.then(r),ci(()=>{var l;const a=(l=i.value)==null?void 0:l.parentElement;a&&n.observe(a)}),(a,l)=>(M(),E("div",{class:"sticky",style:Re({top:t.value}),ref_key:"element",ref:i,"data-v-sticky":""},[Et(a.$slots,"default",{},void 0,!0)],4))}});var li=ce(Hl,[["__scopeId","data-v-cccac690"]]);const Zl=["x1","y1","x2","y2"],Yl=J({__name:"BoardLink",props:{link:null},setup(e){const n=$e(e),i=N(()=>{const a=n.link.value.startNode.position;return n.link.value.offsetStart&&(a.x+=s(n.link.value.offsetStart).x,a.y+=s(n.link.value.offsetStart).y),a}),r=N(()=>{const a=n.link.value.endNode.position;return n.link.value.offsetEnd&&(a.x+=s(n.link.value.offsetEnd).x,a.y+=s(n.link.value.offsetEnd).y),a});return(a,l)=>(M(),E("line",zt({class:"link"},e.link,{class:{pulsing:e.link.pulsing},x1:s(i).x,y1:s(i).y,x2:s(r).x,y2:s(r).y}),null,16,Zl))}});var Xl=ce(Yl,[["__scopeId","data-v-57c4970a"]]);const Jl={key:0},Kl=["transform","onMousedown","onTouchstart","onMouseup","onTouchend"],Ql=["fill","stroke-width","stroke"],eu=["fill"],tu=J({__name:"BoardNodeAction",props:{node:null,nodeType:null,actions:null,isSelected:{type:Boolean},selectedAction:null},emits:["clickAction"],setup(e,{emit:t}){const i=$e(e),r=N(()=>de(i.nodeType.value.size,s(i.node))),a=N(()=>{var m;return(m=de(i.nodeType.value.outlineColor,s(i.node)))!=null?m:wt[re.theme].variables["--outline"]}),l=N(()=>{var m;return(m=de(i.nodeType.value.titleColor,s(i.node)))!=null?m:wt[re.theme].variables["--foreground"]}),u=N(()=>de(i.nodeType.value.actionDistance,s(i.node)));function c(m,f){t("clickAction",f.id),m.preventDefault(),m.stopPropagation()}function d(m,f){var h;((h=s(i.selectedAction))==null?void 0:h.id)===f.id&&(m.preventDefault(),m.stopPropagation())}return(m,f)=>(M(),ee(xn,{name:"actions",appear:""},{default:H(()=>[e.isSelected&&e.actions?(M(),E("g",Jl,[(M(!0),E(ne,null,En(e.actions,(h,w)=>{var v,b;return M(),E("g",{key:h.id,class:pe(["action",{selected:((v=e.selectedAction)==null?void 0:v.id)===h.id}]),transform:`translate(
${(-s(r)-30)*Math.sin(((e.actions.length-1)/2-w)*s(u))},
${(s(r)+30)*Math.cos(((e.actions.length-1)/2-w)*s(u))}
)`,onMousedown:I=>c(I,h),onTouchstart:I=>c(I,h),onMouseup:I=>d(I,h),onTouchend:$n(I=>d(I,h),["stop"])},[_("circle",{fill:s(de)(h.fillColor,e.node),r:"20","stroke-width":((b=e.selectedAction)==null?void 0:b.id)===h.id?4:0,stroke:s(a)},null,8,Ql),_("text",{fill:s(l),class:"material-icons"},ae(s(de)(h.icon,e.node)),9,eu)],42,Kl)}),128))])):B("",!0)]),_:1}))}});var nu=ce(tu,[["__scopeId","data-v-9efb2a56"]]);const iu=["transform"],ru={key:0},au=["r","fill","stroke"],su=["r","fill","stroke"],ou=["r","fill"],lu=["r","stroke-dasharray","stroke-dashoffset","stroke"],uu={key:1,transform:"rotate(45, 0, 0)"},cu=["width","height","transform","fill","stroke"],du=["width","height","transform","fill","stroke"],fu=["width","height","transform","fill"],pu=["width","height","transform","stroke-dasharray","stroke-dashoffset","stroke"],gu=["fill","y"],mu=["fill"],vu={key:0},hu=["fill","y"],bu=["fill","y"],yu=J({__name:"BoardNode",props:{node:null,nodeType:null,dragging:null,dragged:null,hasDragged:{type:Boolean},receivingNode:{type:Boolean},selectedNode:null,selectedAction:null},emits:["mouseDown","endDragging","clickAction"],setup(e,{emit:t}){const n=e,i=Math.sqrt(2),r=$e(n),a=N(()=>s(r.selectedNode)===s(r.node)),l=N(()=>de(r.nodeType.value.draggable,s(r.node)));dt(l,Y=>{const Me=s(r.node);s(r.dragging)===Me&&!Y&&t("endDragging",Me)});const u=N(()=>{var Me;const Y=s(r.node);return(Me=de(r.nodeType.value.actions,Y))==null?void 0:Me.filter(Xe=>Le(de(Xe.visibility,Y)))}),c=N(()=>{var Me;const Y=s(r.node);if(de(r.nodeType.value.draggable,Y)&&((Me=s(r.dragging))==null?void 0:Me.id)===Y.id&&s(r.dragged)!=null){const{x:Xe,y:st}=s(r.dragged);return{x:Y.position.x+Math.round(Xe/25)*25,y:Y.position.y+Math.round(st/25)*25}}return Y.position}),d=N(()=>de(r.nodeType.value.shape,s(r.node))),m=N(()=>de(r.nodeType.value.title,s(r.node))),f=N(()=>de(r.nodeType.value.subtitle,s(r.node))),h=N(()=>{var Y;return(Y=a.value?s(r.selectedAction)&&de(s(r.selectedAction).tooltip,s(r.node)):null)!=null?Y:de(r.nodeType.value.label,s(r.node))}),w=N(()=>{var Y,Me;return de((Me=(Y=s(r.selectedAction))==null?void 0:Y.confirmationLabel)!=null?Me:{text:"Tap again to confirm"},s(r.node))}),v=N(()=>de(r.nodeType.value.size,s(r.node))),b=N(()=>{var Y;return(Y=de(r.nodeType.value.progress,s(r.node)))!=null?Y:0}),I=N(()=>wt[re.theme].variables["--background"]),A=N(()=>{var Y;return(Y=de(r.nodeType.value.outlineColor,s(r.node)))!=null?Y:wt[re.theme].variables["--outline"]}),S=N(()=>{var Y;return(Y=de(r.nodeType.value.fillColor,s(r.node)))!=null?Y:wt[re.theme].variables["--raised-background"]}),P=N(()=>de(r.nodeType.value.progressColor,s(r.node))),L=N(()=>{var Y;return(Y=de(r.nodeType.value.titleColor,s(r.node)))!=null?Y:wt[re.theme].variables["--foreground"]}),le=N(()=>de(r.nodeType.value.progressDisplay,s(r.node))),Z=N(()=>r.dragging.value!=null&&s(r.hasDragged)&&de(r.nodeType.value.canAccept,s(r.node),r.dragging.value)),z=N(()=>de(r.nodeType.value.style,s(r.node))),U=N(()=>de(r.nodeType.value.classes,s(r.node)));function qe(Y){t("mouseDown",Y,r.node.value,l.value)}function et(Y){var Me,Xe,st;(Me=r.hasDragged)!=null&&Me.value||(t("endDragging",r.node.value),(st=(Xe=r.nodeType.value).onClick)==null||st.call(Xe,r.node.value),Y.stopPropagation())}return(Y,Me)=>{var Xe,st,ht;return M(),E("g",{class:pe(["boardnode",{[e.node.type]:!0,isSelected:s(a),isDraggable:s(l),...s(U)}]),style:Re([{opacity:((Xe=e.dragging)==null?void 0:Xe.id)===e.node.id&&e.hasDragged?.5:1},(st=s(z))!=null?st:[]]),transform:`translate(${s(c).x},${s(c).y})${s(a)?" scale(1.2)":""}`},[p(nu,{actions:(ht=s(u))!=null?ht:[],"is-selected":s(a),node:e.node,"node-type":e.nodeType,"selected-action":e.selectedAction,onClickAction:Me[0]||(Me[0]=bt=>t("clickAction",bt))},null,8,["actions","is-selected","node","node-type","selected-action"]),_("g",{class:"node-container",onMousedown:qe,onTouchstartPassive:qe,onMouseup:et,onTouchendPassive:et},[s(d)===s(Ge).Circle?(M(),E("g",ru,[s(Z)?(M(),E("circle",{key:0,class:"receiver",r:s(v)+8,fill:s(I),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,au)):B("",!0),_("circle",{class:"body",r:s(v),fill:s(S),stroke:s(A),"stroke-width":4},null,8,su),s(le)===s(hn).Fill?(M(),E("circle",{key:1,class:"progress progressFill",r:Math.max(s(v)*s(b)-2,0),fill:s(P)},null,8,ou)):(M(),E("circle",{key:2,r:s(v)+4.5,class:"progress progressRing",fill:"transparent","stroke-dasharray":(s(v)+4.5)*2*Math.PI,"stroke-width":5,"stroke-dashoffset":(s(v)+4.5)*2*Math.PI-s(b)*(s(v)+4.5)*2*Math.PI,stroke:s(P)},null,8,lu))])):s(d)===s(Ge).Diamond?(M(),E("g",uu,[s(Z)?(M(),E("rect",{key:0,class:"receiver",width:s(v)*s(i)+16,height:s(v)*s(i)+16,transform:`translate(${-(s(v)*s(i)+16)/2}, ${-(s(v)*s(i)+16)/2})`,fill:s(I),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,cu)):B("",!0),_("rect",{class:"body",width:s(v)*s(i),height:s(v)*s(i),transform:`translate(${-s(v)*s(i)/2}, ${-s(v)*s(i)/2})`,fill:s(S),stroke:s(A),"stroke-width":4},null,8,du),s(le)===s(hn).Fill?(M(),E("rect",{key:1,class:"progress progressFill",width:Math.max(s(v)*s(i)*s(b)-2,0),height:Math.max(s(v)*s(i)*s(b)-2,0),transform:`translate(${-Math.max(s(v)*s(i)*s(b)-2,0)/2}, ${-Math.max(s(v)*s(i)*s(b)-2,0)/2})`,fill:s(P)},null,8,fu)):(M(),E("rect",{key:2,class:"progress progressDiamond",width:s(v)*s(i)+9,height:s(v)*s(i)+9,transform:`translate(${-(s(v)*s(i)+9)/2}, ${-(s(v)*s(i)+9)/2})`,fill:"transparent","stroke-dasharray":(s(v)*s(i)+9)*4,"stroke-width":5,"stroke-dashoffset":(s(v)*s(i)+9)*4-s(b)*(s(v)*s(i)+9)*4,stroke:s(P)},null,8,pu))])):B("",!0),_("text",{fill:s(L),class:"node-title",y:s(f)?10:0},ae(s(m)),9,gu),s(f)?(M(),E("text",{key:2,fill:s(L),class:"node-subtitle",y:"-15"},ae(s(f)),9,mu)):B("",!0)],32),p(xn,{name:"fade",appear:""},{default:H(()=>{var bt;return[s(h)?(M(),E("g",vu,[_("text",{fill:(bt=s(h).color)!=null?bt:s(L),class:pe(["node-title",{pulsing:s(h).pulsing}]),y:-s(v)-20},ae(s(h).text),11,hu)])):B("",!0)]}),_:1}),p(xn,{name:"fade",appear:""},{default:H(()=>{var bt;return[s(a)&&e.selectedAction?(M(),E("text",{key:0,fill:(bt=s(w).color)!=null?bt:s(L),class:pe(["node-title",{pulsing:s(w).pulsing}]),y:s(v)+75},ae(s(w).text),11,bu)):B("",!0)]}),_:1})],14,iu)}}});var wu=ce(yu,[["__scopeId","data-v-4654be02"]]);const _u={class:"stage",width:"100%",height:"100%"},Nu={class:"g1"},Cu=J({__name:"Board",props:{nodes:null,types:null,state:null,visibility:null,width:null,height:null,style:null,classes:null,links:null,selectedAction:null,selectedNode:null,draggingNode:null,receivingNode:null,mousePosition:null,setReceivingNode:{type:Function},setDraggingNode:{type:Function}},setup(e){const n=$e(e),i=V({x:0,y:0}),r=V({x:0,y:0}),a=V(!1),l=V(null),u=N(()=>{const w=n.nodes.value.slice();if(n.draggingNode.value){const v=w.splice(w.indexOf(n.draggingNode.value),1)[0];w.push(v)}return w});_t(()=>{const w=n.draggingNode.value;if(w==null)return null;const v={x:w.position.x+r.value.x,y:w.position.y+r.value.y};let b=Number.MAX_VALUE;n.setReceivingNode.value(n.nodes.value.reduce((I,A)=>{if(A.id===w.id)return I;const S=n.types.value[A.type];if(!de(S.canAccept,A,w))return I;const L=Math.pow(v.x-A.position.x,2)+Math.pow(v.y-A.position.y,2);let le=de(S.size,A);return L>b||L>le*le?I:(b=L,A)},null))});function c(w){w.setTransformOrigin(null),w.moveTo(l.value.$el.clientWidth/2,l.value.$el.clientHeight/2)}function d(w,v=null,b=!1){if(n.draggingNode.value==null){w.preventDefault(),w.stopPropagation();let I,A;if("touches"in w)if(w.touches.length===1)I=w.touches[0].clientX,A=w.touches[0].clientY;else return;else I=w.clientX,A=w.clientY;i.value={x:I,y:A},r.value={x:0,y:0},a.value=!1,b&&n.setDraggingNode.value(v)}v!=null&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function m(w){const{x:v,y:b,scale:I}=l.value.panZoomInstance.getTransform();let A,S;if("touches"in w)if(w.touches.length===1)A=w.touches[0].clientX,S=w.touches[0].clientY;else{f(n.draggingNode.value),n.mousePosition.value=null;return}else A=w.clientX,S=w.clientY;n.mousePosition.value={x:(A-v)/I,y:(S-b)/I},r.value={x:r.value.x+(A-i.value.x)/I,y:r.value.y+(S-i.value.y)/I},i.value={x:A,y:S},(Math.abs(r.value.x)>10||Math.abs(r.value.y)>10)&&(a.value=!0),n.draggingNode.value!=null&&(w.preventDefault(),w.stopPropagation())}function f(w,v=!1){var b,I;if(n.draggingNode.value!=null&&n.draggingNode.value===w){n.receivingNode.value==null&&(n.draggingNode.value.position.x+=Math.round(r.value.x/25)*25,n.draggingNode.value.position.y+=Math.round(r.value.y/25)*25);const A=n.nodes.value;A.push(A.splice(A.indexOf(n.draggingNode.value),1)[0]),n.receivingNode.value&&((I=(b=n.types.value[n.receivingNode.value.type]).onDrop)==null||I.call(b,n.receivingNode.value,n.draggingNode.value)),n.setDraggingNode.value(null)}else!a.value&&!v&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function h(w,v){n.state.value.selectedAction===v?s(n.selectedAction).onClick(s(n.selectedNode)):n.state.value={...n.state.value,selectedAction:v}}return(w,v)=>{const b=Ct("panZoom");return s(Le)(e.visibility)?(M(),ee(b,{key:0,style:Re([{width:e.width,height:e.height},e.style]),class:pe(e.classes),selector:".g1",options:{initialZoom:1,minZoom:.1,maxZoom:10,zoomDoubleClickSpeed:1},ref_key:"stage",ref:l,onInit:c,onMousemove:m,onTouchmove:m,onMousedown:v[0]||(v[0]=I=>d(I)),onTouchstart:v[1]||(v[1]=I=>d(I)),onMouseup:v[2]||(v[2]=()=>f(s(e.draggingNode))),onTouchendPassive:v[3]||(v[3]=()=>f(s(e.draggingNode))),onMouseleave:v[4]||(v[4]=()=>f(s(e.draggingNode),!0))},{default:H(()=>[(M(),E("svg",_u,[_("g",Nu,[p(tr,{name:"link",appear:""},{default:H(()=>[(M(!0),E(ne,null,En(s(e.links)||[],I=>(M(),E("g",{key:`${I.startNode.id}-${I.endNode.id}`},[p(Xl,{link:I},null,8,["link"])]))),128))]),_:1}),p(tr,{name:"grow",duration:500,appear:""},{default:H(()=>[(M(!0),E(ne,null,En(s(u),I=>{var A;return M(),E("g",{key:I.id,style:{"transition-duration":"0s"}},[p(wu,{node:I,nodeType:e.types[I.type],dragging:s(e.draggingNode),dragged:s(e.draggingNode)===I?r.value:void 0,hasDragged:a.value,receivingNode:((A=s(e.receivingNode))==null?void 0:A.id)===I.id,selectedNode:s(e.selectedNode),selectedAction:s(e.selectedAction),onMouseDown:d,onEndDragging:f,onClickAction:S=>h(I,S)},null,8,["node","nodeType","dragging","dragged","hasDragged","receivingNode","selectedNode","selectedAction","onClickAction"])])}),128))]),_:1})])]))]),_:1},8,["style","class","options"])):B("",!0)}}});We.on("setupVue",e=>Na.install(e));const qr=Symbol("Board");var hn=(e=>(e.Outline="Outline",e.Fill="Fill",e))(hn||{}),Ge=(e=>(e.Circle="Circle",e.Diamond="Triangle",e))(Ge||{});function ku(e){const t=ct({nodes:[],selectedNode:null,selectedAction:null},!1);return He(n=>{const i=e.call(n,n);i.id=rn("board-"),i.type=qr,i[mt]=Cu,i.state?(Pr(t),$(i,"state")):(t[nn]={nodes:i.startNodes().map((u,c)=>(u.id=c,u)),selectedNode:null,selectedAction:null},i.state=t),i.nodes=N(()=>s(l.state).nodes),i.selectedNode=N({get(){return l.nodes.value.find(u=>u.id===s(l.state).selectedNode)||null},set(u){var c,d;De(l.state)?l.state.value={...l.state.value,selectedNode:(c=u==null?void 0:u.id)!=null?c:null}:l.state.selectedNode=(d=u==null?void 0:u.id)!=null?d:null}}),i.selectedAction=N({get(){const u=l.selectedNode.value;if(u==null)return null;const c=l.types[u.type];return c.actions==null?null:c.actions.find(d=>d.id===s(l.state).selectedAction)||null},set(u){var c,d;De(l.state)?l.state.value={...l.state.value,selectedAction:(c=u==null?void 0:u.id)!=null?c:null}:l.state.selectedAction=(d=u==null?void 0:u.id)!=null?d:null}}),i.mousePosition=V(null),i.links?$(i,"links"):i.links=N(()=>l.selectedAction.value==null?null:l.selectedAction.value.links&&l.selectedNode.value?de(l.selectedAction.value.links,l.selectedNode.value):null),i.draggingNode=V(null),i.receivingNode=V(null),$(i,"visibility"),ie(i,"visibility",he.Visible),$(i,"width"),ie(i,"width","100%"),$(i,"height"),ie(i,"height","100%"),$(i,"classes"),$(i,"style");for(const u in i.types){const c=i.types[u];if($(c,"title"),$(c,"subtitle"),$(c,"label"),$(c,"size"),ie(c,"size",50),$(c,"style"),$(c,"classes"),$(c,"draggable"),ie(c,"draggable",!1),$(c,"shape"),ie(c,"shape","Circle"),$(c,"canAccept"),ie(c,"canAccept",!1),$(c,"progress"),$(c,"progressDisplay"),ie(c,"progressDisplay","Fill"),$(c,"progressColor"),ie(c,"progressColor","none"),$(c,"fillColor"),$(c,"outlineColor"),$(c,"titleColor"),$(c,"actionDistance"),ie(c,"actionDistance",Math.PI/6),c.nodes=N(()=>s(l.state).nodes.filter(d=>d.type===u)),ie(c,"onClick",function(d){s(l.state).selectedNode=d.id}),c.actions)for(const d of c.actions)$(d,"visibility"),ie(d,"visibility",he.Visible),$(d,"icon"),$(d,"fillColor"),$(d,"tooltip"),$(d,"confirmationLabel"),ie(d,"confirmationLabel",{text:"Tap again to confirm"}),$(d,"links")}function r(u){i.draggingNode.value=u}function a(u){i.receivingNode.value=u}i.placeInAvailableSpace=function(u,c=100,d=G.Right){const m=l.nodes.value.slice().filter(f=>f===u||(d===G.Down||d===G.Up)&&Math.abs(f.position.x-u.position.x)>c||(d===G.Left||d===G.Right)&&Math.abs(f.position.y-u.position.y)>c?!1:!(d===G.Right&&f.position.x<u.position.x-c||d===G.Left&&f.position.x>u.position.x+c||d===G.Up&&f.position.y>u.position.y+c||d===G.Down&&f.position.y<u.position.y-c)).sort(d===G.Right?(f,h)=>f.position.x-h.position.x:d===G.Left?(f,h)=>h.position.x-f.position.x:d===G.Up?(f,h)=>h.position.y-f.position.y:(f,h)=>f.position.y-h.position.y);for(let f=0;f<m.length;f++){const h=m[f],w=d===G.Right||d===G.Left?Math.abs(u.position.x-h.position.x):Math.abs(u.position.y-h.position.y);if(w<c)d===G.Right?u.position.x=h.position.x+c:d===G.Left?u.position.x=h.position.x-c:d===G.Up?u.position.y=h.position.y-c:d===G.Down&&(u.position.y=h.position.y+c);else if(f>0&&w>c)break}},i[at]=function(){const{nodes:u,types:c,state:d,visibility:m,width:f,height:h,style:w,classes:v,links:b,selectedAction:I,selectedNode:A,mousePosition:S,draggingNode:P,receivingNode:L}=this;return{nodes:u,types:c,state:d,visibility:m,width:f,height:h,style:s(w),classes:v,links:b,selectedAction:I,selectedNode:A,mousePosition:S,draggingNode:P,receivingNode:L,setDraggingNode:r,setReceivingNode:a}};const l=i;return l})}function de(e,t,...n){return zn(e)?e(t,...n):s(e)}function Wn(e){let t=0;return e.nodes.value.forEach(n=>{n.id>=t&&(t=n.id+1)}),t}const qn={};We.on("addLayer",e=>{const t=ai(e,qr);qn[e.id]=e.on("postUpdate",n=>{t.forEach(i=>{Object.values(i.types).forEach(r=>r.nodes.value.forEach(a=>{var l;return(l=r.update)==null?void 0:l.call(r,a,n)}))})})});We.on("removeLayer",e=>{var t;(t=qn[e.id])==null||t.call(qn),qn[e.id]=void 0});function Mn(e,t="points",n=0,i=void 0){const r=De(e)?e:ct(e);if(r.displayName=t,r.precision=n,r.small=i,!De(e)){const a=r[xt];a.displayName=t,a.precision=n,a.small=i}return r}new o("10^^8");new o("1e100");function ui(e,t){const n=t!=null?t:e.value;return o.eq(e.precision,0)?gt(e.small?n:o.floor(n)):me(n,e.precision,e.small)}We.on("setupVue",e=>e.use(Ca));function Mu(e="white",t="8px"){return{transform:"scale(1.05, 1.05)",borderColor:"rgba(0, 0, 0, 0.125)",boxShadow:`-4px -4px 4px rgba(0, 0, 0, 0.25) inset, 0 0 ${t} ${e}`,zIndex:1}}const Su=J({props:{visibility:{type:R(Number,Boolean),required:!0},display:{type:R(Object,String,Function),required:!0},style:R(String,Object,Array),classes:R(Object),glowColor:R(String),active:Boolean,floating:Boolean},emits:["selectTab"],setup(e,{emit:t}){const{display:n,glowColor:i,floating:r}=$e(e),a=xr(n),l=N(()=>{const c=Ce(i);return c==null||c===""?{}:s(r)?Mu(c):{boxShadow:`0px 9px 5px -6px ${c}`}});function u(){t("selectTab")}return{selectTab:u,component:a,glowColorStyle:l,unref:s,Visibility:he,isVisible:Le,isHidden:wn}}});function Iu(e,t,n,i,r,a){var l;return e.isVisible(e.visibility)?(M(),E("button",{key:0,onClick:t[0]||(t[0]=(...u)=>e.selectTab&&e.selectTab(...u)),class:pe(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:Re([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(l=e.unref(e.style))!=null?l:{}])},[(M(),ee(Ue(e.component)))],6)):B("",!0)}var Vr=ce(Su,[["render",Iu],["__scopeId","data-v-21427abb"]]);const $u=J({props:{visibility:{type:R(Number,Boolean),required:!0},activeTab:{type:R(Object),required:!0},selected:{type:Object,required:!0},tabs:{type:R(Object),required:!0},style:R(String,Object,Array),classes:R(Object),buttonContainerStyle:R(String,Object,Array),buttonContainerClasses:R(Object)},components:{Sticky:li,TabButton:Vr},setup(e){const{activeTab:t}=$e(e),n=N(()=>wt[re.theme].floatingTabs),i=ft("");_t(()=>{const u=Ce(t);if(u==null){i.value="";return}if(St(u)){i.value=se(u);return}i.value=se(s(u.display))});const r=N(()=>{const u=Ce(t);return St(u)||!u?void 0:s(u.classes)}),a=N(()=>{const u=Ce(t);return St(u)||!u?void 0:s(u.style)});function l(u){const{display:c,style:d,classes:m,glowColor:f,visibility:h}=u;return{display:c,style:s(d),classes:m,glowColor:f,visibility:h}}return{floating:n,tabClasses:r,tabStyle:a,Visibility:he,component:i,gatherButtonProps:l,unref:s,isVisible:Le,isHidden:wn}}});function xu(e,t,n,i,r,a){var c,d;const l=Ct("TabButton"),u=Ct("Sticky");return e.isVisible(e.visibility)?(M(),E("div",{key:0,class:pe(["tab-family-container",{...e.unref(e.classes),...e.tabClasses}]),style:Re([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[],(d=e.tabStyle)!=null?d:[]])},[p(u,{class:pe(["tab-buttons-container",e.unref(e.buttonContainerClasses)]),style:Re(e.unref(e.buttonContainerStyle))},{default:H(()=>[_("div",{class:pe(["tab-buttons",{floating:e.floating}])},[(M(!0),E(ne,null,En(e.unref(e.tabs),(m,f)=>(M(),ee(l,zt({onSelectTab:h=>e.selected.value=f,floating:e.floating,key:f,active:e.unref(m.tab)===e.unref(e.activeTab)},e.gatherButtonProps(m)),null,16,["onSelectTab","floating","active"]))),128))],2)]),_:1},8,["class","style"]),e.unref(e.activeTab)?(M(),ee(Ue(e.unref(e.component)),{key:0})):B("",!0)],6)):B("",!0)}var Eu=ce($u,[["render",xu],["__scopeId","data-v-58dbf83a"]]);const Pu=Symbol("TabButton"),Tu=Symbol("TabFamily");function Du(e,t){if(Object.keys(e).length===0)throw console.warn("Cannot create tab family with 0 tabs"),new Error("Cannot create tab family with 0 tabs");const n=ct(Object.keys(e)[0],!1);return He(i=>{var l;const r=(l=t==null?void 0:t.call(i,i))!=null?l:{};r.id=rn("tabFamily-"),r.type=Tu,r[mt]=Eu,r.tabs=Object.keys(e).reduce((u,c)=>{const d=e[c]();return d.type=Pu,d[mt]=Vr,$(d,"visibility"),ie(d,"visibility",he.Visible),$(d,"tab"),$(d,"display"),$(d,"classes"),$(d,"style"),$(d,"glowColor"),u[c]=d,u},{}),r.selected=n,r.activeTab=N(()=>{const u=s(a.tabs);if(n.value in u&&Le(u[n.value].visibility))return s(u[n.value].tab);const c=Object.values(u).find(d=>Le(d.visibility));return c?s(c.tab):null}),$(r,"visibility"),ie(r,"visibility",he.Visible),$(r,"classes"),$(r,"style"),$(r,"buttonContainerClasses"),$(r,"buttonContainerStyle"),r[at]=function(){const{visibility:u,activeTab:c,selected:d,tabs:m,style:f,classes:h,buttonContainerClasses:w,buttonContainerStyle:v}=this;return{visibility:u,activeTab:c,selected:d,tabs:m,style:s(f),classes:h,buttonContainerClasses:w,buttonContainerStyle:v}};const a=r;return a})}const Br=o.ln(10);function Vn(e){return e}function Fu(e,t){if(F(t))return t.invert(o.neg(e));throw new Error("Could not invert due to no input being a variable")}function Au(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return g.neg(t.getIntegralFormula(e))}throw new Error("Could not integrate due to no input being a variable")}function Ou(e){return g.neg(e)}function Ru(e,t,n){if(F(t))return t.invert(o.sub(e,be(n)));if(F(n))return n.invert(o.sub(e,be(t)));throw new Error("Could not invert due to no input being a variable")}function qu(e,t,n){var i,r;if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=t.getIntegralFormula(e);return g.times(n,(i=t.innermostVariable)!=null?i:0).add(a)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=n.getIntegralFormula(e);return g.times(t,(r=n.innermostVariable)!=null?r:0).add(a)}throw new Error("Could not integrate due to no input being a variable")}function Vu(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.add(i,n)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.add(i,t)}throw new Error("Could not integrate due to no input being a variable")}function Bu(e,t,n){if(F(t))return t.invert(o.add(e,be(n)));if(F(n))return n.invert(o.sub(be(t),e));throw new Error("Could not invert due to no input being a variable")}function Lu(e,t,n){var i,r;if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=t.getIntegralFormula(e);return g.sub(a,g.times(n,(i=t.innermostVariable)!=null?i:0))}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=n.getIntegralFormula(e);return g.times(t,(r=n.innermostVariable)!=null?r:0).sub(a)}throw new Error("Could not integrate due to no input being a variable")}function ju(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.sub(i,n)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.sub(i,t)}throw new Error("Could not integrate due to no input being a variable")}function zu(e,t,n){if(F(t))return t.invert(o.div(e,be(n)));if(F(n))return n.invert(o.div(e,be(t)));throw new Error("Could not invert due to no input being a variable")}function Uu(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.times(i,n)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.times(i,t)}throw new Error("Could not integrate due to no input being a variable")}function Gu(e,t,n){if(F(t))return g.div(e,n);if(F(n))return g.div(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Wu(e,t,n){if(F(t))return t.invert(o.mul(e,be(n)));if(F(n))return n.invert(o.div(be(t),e));throw new Error("Could not invert due to no input being a variable")}function Hu(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.div(i,n)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.div(t,i)}throw new Error("Could not integrate due to no input being a variable")}function Zu(e,t,n){if(F(t))return g.mul(e,n);if(F(n))return g.mul(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Yu(e,t){if(F(t))return t.invert(o.recip(e));throw new Error("Could not invert due to no input being a variable")}function Xu(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.ln(n)}throw new Error("Could not integrate due to no input being a variable")}function Ju(e,t){if(F(t))return t.invert(o.pow10(e));throw new Error("Could not invert due to no input being a variable")}function Ku(e){return o.ln(e).sub(1).times(e).div(Br)}function Qu(e,t){if(F(t)){const n=Br.times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}throw new Error("Could not invert due to no input being a variable")}function ec(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:Ku,invert:Qu})}throw new Error("Could not integrate due to no input being a variable")}function tc(e,t,n){if(F(t))return t.invert(o.pow(be(n),e));if(F(n))return n.invert(o.root(be(t),e));throw new Error("Could not invert due to no input being a variable")}function nc(e,t){return o.ln(e).sub(1).times(e).div(o.ln(t))}function ic(e,t,n){if(F(t)){const i=o.ln(be(n)).times(e);return t.invert(i.div(i.div(Math.E).lambertw()))}throw new Error("Could not invert due to no input being a variable")}function rc(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e),n],evaluate:nc,invert:ic})}throw new Error("Could not integrate due to no input being a variable")}function ac(e,t){if(F(t))return t.invert(o.pow(2,e));throw new Error("Could not invert due to no input being a variable")}function sc(e){return o.ln(e).sub(1).times(e).div(o.ln(2))}function oc(e,t){if(F(t)){const n=o.ln(2).times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}throw new Error("Could not invert due to no input being a variable")}function lc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:sc,invert:oc})}throw new Error("Could not integrate due to no input being a variable")}function uc(e,t){if(F(t))return t.invert(o.exp(e));throw new Error("Could not invert due to no input being a variable")}function cc(e){return o.ln(e).sub(1).times(e)}function dc(e,t){if(F(t))return t.invert(o.div(e,o.div(e,Math.E).lambertw()));throw new Error("Could not invert due to no input being a variable")}function fc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:cc,invert:dc})}throw new Error("Could not integrate due to no input being a variable")}function pc(e,t,n){if(F(t))return t.invert(o.root(e,be(n)));if(F(n))return n.invert(o.ln(e).div(o.ln(be(t))));throw new Error("Could not invert due to no input being a variable")}function gc(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e),r=g.add(n,1);return g.pow(i,r).div(r)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.pow(t,i).div(g.ln(t))}throw new Error("Could not integrate due to no input being a variable")}function mc(e,t){if(F(t))return t.invert(o.root(e,10));throw new Error("Could not invert due to no input being a variable")}function vc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.pow10(n).div(g.ln(10))}throw new Error("Could not integrate due to no input being a variable")}function hc(e,t,n){if(F(t))return t.invert(o.ln(e).div(be(n)));if(F(n))return n.invert(o.root(be(t),e));throw new Error("Could not invert due to no input being a variable")}function bc(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.pow(n,i).div(g.ln(n))}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e),r=g.add(t,1);return g.pow(i,r).div(r)}throw new Error("Could not integrate due to no input being a variable")}function yc(e,t,n){if(F(t))return t.invert(o.root(e,o.recip(be(n))));if(F(n))return n.invert(o.ln(be(t)).div(o.ln(e)));throw new Error("Could not invert due to no input being a variable")}function wc(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.pow(i,g.recip(n).add(1)).times(n).div(g.add(n,1))}throw new Error("Could not integrate due to no input being a variable")}function _c(e,t){if(F(t))return t.invert(o.ln(e));throw new Error("Could not invert due to no input being a variable")}function Nc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.exp(n)}throw new Error("Could not integrate due to no input being a variable")}function Cc(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const i=o.minabs(t,1e308).toNumber();return o.tetrate(e,i,n)}function kc(e,t,n,i){if(F(t))return t.invert(o.ssqrt(e));throw new Error("Could not invert due to no input being a variable")}function Mc(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const i=o.minabs(t,1e308).toNumber();return o.iteratedexp(e,i,new o(n))}function Sc(e,t,n,i){if(F(t))return t.invert(o.iteratedlog(e,Math.E,o.minabs(1e308,be(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function Ic(e,t=10,n=2){const i=o.minabs(n,1e308).toNumber();return o.iteratedlog(e,t,i)}function $c(e,t=10){const n=o.minabs(t,1e308).toNumber();return o.slog(e,n)}function xc(e,t,n){if(F(t))return t.invert(o.tetrate(e,o.minabs(1e308,be(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function Ec(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.layeradd(e,i,n)}function Pc(e,t,n,i){if(F(t))return t.invert(o.layeradd(e,o.minabs(1e308,be(n)).negate().toNumber()));throw new Error("Could not invert due to no input being a variable")}function Tc(e,t){if(F(t))return t.invert(o.pow(Math.E,e).times(e));throw new Error("Could not invert due to no input being a variable")}function Dc(e,t){if(F(t))return t.invert(o.tetrate(e,2));throw new Error("Could not invert due to no input being a variable")}function Fc(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.pentate(e,i,n)}function Ac(e,t){if(F(t))return t.invert(o.asin(e));throw new Error("Could not invert due to no input being a variable")}function Oc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cos(n).neg()}throw new Error("Could not integrate due to no input being a variable")}function Rc(e,t){if(F(t))return t.invert(o.acos(e));throw new Error("Could not invert due to no input being a variable")}function qc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.sin(n)}throw new Error("Could not integrate due to no input being a variable")}function Vc(e,t){if(F(t))return t.invert(o.atan(e));throw new Error("Could not invert due to no input being a variable")}function Bc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cos(n).ln().neg()}throw new Error("Could not integrate due to no input being a variable")}function Lc(e,t){if(F(t))return t.invert(o.sin(e));throw new Error("Could not invert due to no input being a variable")}function jc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.asin(n).times(n).add(g.sqrt(g.sub(1,g.pow(n,2))))}throw new Error("Could not integrate due to no input being a variable")}function zc(e,t){if(F(t))return t.invert(o.cos(e));throw new Error("Could not invert due to no input being a variable")}function Uc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.acos(n).times(n).sub(g.sqrt(g.sub(1,g.pow(n,2))))}throw new Error("Could not integrate due to no input being a variable")}function Gc(e,t){if(F(t))return t.invert(o.tan(e));throw new Error("Could not invert due to no input being a variable")}function Wc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.atan(n).times(n).sub(g.ln(g.pow(n,2).add(1)).div(2))}throw new Error("Could not integrate due to no input being a variable")}function Hc(e,t){if(F(t))return t.invert(o.asinh(e));throw new Error("Could not invert due to no input being a variable")}function Zc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cosh(n)}throw new Error("Could not integrate due to no input being a variable")}function Yc(e,t){if(F(t))return t.invert(o.acosh(e));throw new Error("Could not invert due to no input being a variable")}function Xc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.sinh(n)}throw new Error("Could not integrate due to no input being a variable")}function Jc(e,t){if(F(t))return t.invert(o.atanh(e));throw new Error("Could not invert due to no input being a variable")}function Kc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cosh(n).ln()}throw new Error("Could not integrate due to no input being a variable")}function Qc(e,t){if(F(t))return t.invert(o.sinh(e));throw new Error("Could not invert due to no input being a variable")}function ed(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.asinh(n).times(n).sub(g.pow(n,2).add(1).sqrt())}throw new Error("Could not integrate due to no input being a variable")}function td(e,t){if(F(t))return t.invert(o.cosh(e));throw new Error("Could not invert due to no input being a variable")}function nd(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.acosh(n).times(n).sub(g.add(n,1).sqrt().times(g.sub(n,1).sqrt()))}throw new Error("Could not integrate due to no input being a variable")}function id(e,t){if(F(t))return t.invert(o.tanh(e));throw new Error("Could not invert due to no input being a variable")}function rd(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.atanh(n).times(n).add(g.sub(1,g.pow(n,2)).ln().div(2))}throw new Error("Could not integrate due to no input being a variable")}function Tn(e){return(t,n)=>new g({inputs:[t,n],evaluate:e,invert:Vn})}function F(e){return e instanceof ke&&e.hasVariable()}function be(e,t){return e instanceof ke?e.evaluate(t):s(e)}function ad(){return g.pow(this,2).div(2)}function sd(){return this}const Fe=class{constructor(e){this.negate=this.neg,this.negated=this.neg,this.sgn=this.sign,this.plus=this.add,this.subtract=this.sub,this.minus=this.sub,this.multiply=this.mul,this.times=this.mul,this.divide=this.div,this.divideBy=this.div,this.dividedBy=this.div,this.reciprocal=this.recip,this.reciprocate=this.recip,this.logarithm=this.log;let t;"inputs"in e&&(e.inputs=e.inputs.map(n=>typeof n=="object"&&xt in n?n[xt]:n)),"variable"in e?(typeof e.variable=="object"&&xt in e.variable&&(e.variable=e.variable[xt]),t=this.setupVariable(e)):"evaluate"in e?t=this.setupFormula(e):t=this.setupConstant(e),this.inputs=t.inputs,this.internalVariables=t.internalVariables,this.innermostVariable=t.innermostVariable,this.internalEvaluate=t.internalEvaluate,this.internalInvert=t.internalInvert,this.internalIntegrate=t.internalIntegrate,this.internalIntegrateInner=t.internalIntegrateInner,this.applySubstitution=t.applySubstitution}setupVariable({variable:e}){return{inputs:[e],internalVariables:1,innermostVariable:e,internalIntegrate:ad,internalIntegrateInner:sd,applySubstitution:Vn}}setupConstant({inputs:e}){if(e.length!==1)throw new Error("Evaluate function is required if inputs is not length 1");return{inputs:e,internalVariables:0}}setupFormula(e){var h,w;const{inputs:t,evaluate:n,invert:i,integrate:r,integrateInner:a,applySubstitution:l}=e,u=t.reduce((v,b)=>v+(b instanceof Fe?b.internalVariables:0),0),c=t.find(v=>v instanceof Fe&&v.hasVariable()),d=u===1?c==null?void 0:c.innermostVariable:void 0,m=(h=c==null?void 0:c.isInvertible())!=null?h:!1,f=(w=c==null?void 0:c.isIntegrable())!=null?w:!1;return{inputs:t,internalEvaluate:n,internalInvert:m?i:void 0,internalIntegrate:f?r:void 0,internalIntegrateInner:a,applySubstitution:l,innermostVariable:d,internalVariables:u}}isInvertible(){return this.hasVariable()&&(this.internalInvert!=null||this.internalEvaluate==null)}isIntegrable(){return this.hasVariable()&&this.internalIntegrate!=null}isIntegralInvertible(){return this.isIntegrable()?this.getIntegralFormula().isInvertible():!1}hasVariable(){return this.internalVariables===1}evaluate(e){var t,n,i;return(i=(n=(t=this.internalEvaluate)==null?void 0:t.call(this,...this.inputs.map(r=>be(r,e))))!=null?n:this.hasVariable()?e:null)!=null?i:be(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof Fe&&e.inputs[n]instanceof Fe?t.equals(e.inputs[n]):!(t instanceof Fe)&&!(e.inputs[n]instanceof Fe)&&o.eq(s(t),s(e.inputs[n])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new g({inputs:[e]})}static variable(e){return new g({variable:e})}static step(e,t,n){const i=V(0),r=n(g.variable(i)),a=ve(t);function l(c){return o.lt(c,s(a))?c:(i.value=o.sub(c,s(a)),o.add(r.evaluate(),s(a)))}function u(c,d){if(F(d)&&r.isInvertible())return o.gt(c,s(a))&&(c=o.add(r.invert(o.sub(c,s(a))),s(a))),d.invert(c);throw new Error("Could not invert due to no input being a variable")}return new g({inputs:[e],evaluate:l,invert:r.isInvertible()&&r.hasVariable()?u:void 0})}static if(e,t,n,i){const r=V(0),a=g.variable(r),l=n(a),u=i==null?void 0:i(a),c=ve(t);function d(f){return s(c)?(r.value=f,l.evaluate()):u?(r.value=f,u.evaluate()):f}function m(f,h){if(!F(h)||!l.isInvertible()||u!=null&&!u.isInvertible())throw new Error("Could not invert due to no input being a variable");return s(c)?h.invert(l.invert(f)):u?h.invert(u.invert(f)):h.invert(f)}return new g({inputs:[e],evaluate:d,invert:l.isInvertible()&&l.hasVariable()?m:void 0})}static conditional(e,t,n,i){return g.if(e,t,n,i)}static abs(e){return new g({inputs:[e],evaluate:o.abs})}static neg(e){return new g({inputs:[e],evaluate:o.neg,invert:Fu,applySubstitution:Ou,integrate:Au})}static sign(e){return new g({inputs:[e],evaluate:o.sign})}static round(e){return new g({inputs:[e],evaluate:o.round})}static floor(e){return new g({inputs:[e],evaluate:o.floor})}static ceil(e){return new g({inputs:[e],evaluate:o.ceil})}static trunc(e){return new g({inputs:[e],evaluate:o.trunc})}static add(e,t){return new g({inputs:[e,t],evaluate:o.add,invert:Ru,integrate:qu,integrateInner:Vu,applySubstitution:Vn})}static sub(e,t){return new g({inputs:[e,t],evaluate:o.sub,invert:Bu,integrate:Lu,integrateInner:ju,applySubstitution:Vn})}static mul(e,t){return new g({inputs:[e,t],evaluate:o.mul,invert:zu,integrate:Uu,applySubstitution:Gu})}static div(e,t){return new g({inputs:[e,t],evaluate:o.div,invert:Wu,integrate:Hu,applySubstitution:Zu})}static recip(e){return new g({inputs:[e],evaluate:o.recip,invert:Yu,integrate:Xu})}static clamp(e,t,n){return new g({inputs:[e,t,n],evaluate:o.clamp,invert:Vn})}static pLog10(e){return new g({inputs:[e],evaluate:o.pLog10})}static absLog10(e){return new g({inputs:[e],evaluate:o.absLog10})}static log10(e){return new g({inputs:[e],evaluate:o.log10,invert:Ju,integrate:ec})}static log(e,t){return new g({inputs:[e,t],evaluate:o.log,invert:tc,integrate:rc})}static log2(e){return new g({inputs:[e],evaluate:o.log2,invert:ac,integrate:lc})}static ln(e){return new g({inputs:[e],evaluate:o.ln,invert:uc,integrate:fc})}static pow(e,t){return new g({inputs:[e,t],evaluate:o.pow,invert:pc,integrate:gc})}static pow10(e){return new g({inputs:[e],evaluate:o.pow10,invert:mc,integrate:vc})}static pow_base(e,t){return new g({inputs:[e,t],evaluate:o.pow_base,invert:hc,integrate:bc})}static root(e,t){return new g({inputs:[e,t],evaluate:o.root,invert:yc,integrate:wc})}static factorial(e){return new g({inputs:[e],evaluate:o.factorial})}static gamma(e){return new g({inputs:[e],evaluate:o.gamma})}static lngamma(e){return new g({inputs:[e],evaluate:o.lngamma})}static exp(e){return new g({inputs:[e],evaluate:o.exp,invert:_c,integrate:Nc})}static sqr(e){return g.pow(e,2)}static sqrt(e){return g.root(e,2)}static cube(e){return g.pow(e,3)}static cbrt(e){return g.root(e,3)}static tetrate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:Cc,invert:kc})}static iteratedexp(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:Mc,invert:Sc})}static iteratedlog(e,t=10,n=1){return new g({inputs:[e,t,n],evaluate:Ic})}static slog(e,t=10){return new g({inputs:[e,t],evaluate:$c,invert:xc})}static layeradd10(e,t){return new g({inputs:[e,t],evaluate:o.layeradd10})}static layeradd(e,t,n=10){return new g({inputs:[e,t,n],evaluate:Ec,invert:Pc})}static lambertw(e){return new g({inputs:[e],evaluate:o.lambertw,invert:Tc})}static ssqrt(e){return new g({inputs:[e],evaluate:o.ssqrt,invert:Dc})}static pentate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:Fc})}static sin(e){return new g({inputs:[e],evaluate:o.sin,invert:Lc,integrate:Oc})}static cos(e){return new g({inputs:[e],evaluate:o.cos,invert:zc,integrate:qc})}static tan(e){return new g({inputs:[e],evaluate:o.tan,invert:Gc,integrate:Bc})}static asin(e){return new g({inputs:[e],evaluate:o.asin,invert:Ac,integrate:jc})}static acos(e){return new g({inputs:[e],evaluate:o.acos,invert:Rc,integrate:Uc})}static atan(e){return new g({inputs:[e],evaluate:o.atan,invert:Vc,integrate:Wc})}static sinh(e){return new g({inputs:[e],evaluate:o.sinh,invert:Qc,integrate:Zc})}static cosh(e){return new g({inputs:[e],evaluate:o.cosh,invert:td,integrate:Xc})}static tanh(e){return new g({inputs:[e],evaluate:o.tanh,invert:id,integrate:Kc})}static asinh(e){return new g({inputs:[e],evaluate:o.asinh,invert:Hc,integrate:ed})}static acosh(e){return new g({inputs:[e],evaluate:o.acosh,invert:Yc,integrate:nd})}static atanh(e){return new g({inputs:[e],evaluate:o.atanh,invert:Jc,integrate:rd})}step(e,t){return g.step(this,e,t)}if(e,t){return g.if(this,e,t)}conditional(e,t){return g.if(this,e,t)}abs(){return g.abs(this)}neg(){return g.neg(this)}sign(){return g.sign(this)}round(){return g.round(this)}floor(){return g.floor(this)}ceil(){return g.ceil(this)}trunc(){return g.trunc(this)}add(e){return g.add(this,e)}sub(e){return g.sub(this,e)}mul(e){return g.mul(this,e)}div(e){return g.div(this,e)}recip(){return g.recip(this)}max(e){return g.max(this,e)}min(e){return g.min(this,e)}maxabs(e){return g.maxabs(this,e)}minabs(e){return g.minabs(this,e)}clamp(e,t){return g.clamp(this,e,t)}clampMin(e){return g.clampMin(this,e)}clampMax(e){return g.clampMax(this,e)}pLog10(){return g.pLog10(this)}absLog10(){return g.absLog10(this)}log10(){return g.log10(this)}log(e){return g.log(this,e)}log2(){return g.log2(this)}ln(){return g.ln(this)}pow(e){return g.pow(this,e)}pow10(){return g.pow10(this)}pow_base(e){return g.pow_base(this,e)}root(e){return g.root(this,e)}factorial(){return g.factorial(this)}gamma(){return g.gamma(this)}lngamma(){return g.lngamma(this)}exp(){return g.exp(this)}sqr(){return g.pow(this,2)}sqrt(){return g.root(this,2)}cube(){return g.pow(this,3)}cbrt(){return g.root(this,3)}tetrate(e=2,t=o.fromComponents_noNormalize(1,0,1)){return g.tetrate(this,e,t)}iteratedexp(e=2,t=o.fromComponents_noNormalize(1,0,1)){return g.iteratedexp(this,e,t)}iteratedlog(e=10,t=1){return g.iteratedlog(this,e,t)}slog(e=10){return g.slog(this,e)}layeradd10(e){return g.layeradd10(this,e)}layeradd(e,t){return g.layeradd(this,e,t)}lambertw(){return g.lambertw(this)}ssqrt(){return g.ssqrt(this)}pentate(e=2,t=o.fromComponents_noNormalize(1,0,1)){return g.pentate(this,e,t)}sin(){return g.sin(this)}cos(){return g.cos(this)}tan(){return g.tan(this)}asin(){return g.asin(this)}acos(){return g.acos(this)}atan(){return g.atan(this)}sinh(){return g.sinh(this)}cosh(){return g.cosh(this)}tanh(){return g.tanh(this)}asinh(){return g.asinh(this)}acosh(){return g.acosh(this)}atanh(){return g.atanh(this)}};let ke=Fe;ke.negate=Fe.neg;ke.negated=Fe.neg;ke.sgn=Fe.sign;ke.plus=Fe.add;ke.subtract=Fe.sub;ke.minus=Fe.sub;ke.multiply=Fe.mul;ke.times=Fe.mul;ke.divide=Fe.div;ke.divideBy=Fe.div;ke.dividedBy=Fe.div;ke.reciprocal=Fe.recip;ke.reciprocate=Fe.recip;ke.max=Tn(o.max);ke.min=Tn(o.min);ke.minabs=Tn(o.minabs);ke.maxabs=Tn(o.maxabs);ke.clampMin=Tn(o.clampMin);ke.clampMax=Tn(o.clampMax);ke.logarithm=Fe.log;class g extends ke{invert(t){if(this.internalInvert&&this.hasVariable())return this.internalInvert.call(this,t,...this.inputs);if(this.inputs.length===1&&this.hasVariable())return t;throw new Error("Cannot invert non-invertible formula")}evaluateIntegral(t){if(!this.isIntegrable())throw new Error("Cannot evaluate integral of formula without integral");return this.getIntegralFormula().evaluate(t)}invertIntegral(t){if(!this.isIntegrable()||!this.getIntegralFormula().isInvertible())throw new Error("Cannot invert integral of formula without invertible integral");return this.getIntegralFormula().invert(t)}calculateConstantOfIntegration(){const t=this.getIntegralFormula().evaluate(1),n=o.add(this.evaluate(0),this.evaluate(1)).div(2);return o.sub(n,t)}getIntegralFormula(t){if(this.integralFormula!=null&&t==null)return this.integralFormula;if(t==null){if(this.applySubstitution==null){if(t=[],this.internalIntegrate==null)throw new Error("Cannot integrate formula with non-integrable operation");let n=this.internalIntegrate.call(this,t,...this.inputs);t.forEach(i=>n=i(n)),this.integralFormula=n}else if(this.internalIntegrate)this.integralFormula=this.internalIntegrate.call(this,void 0,...this.inputs);else if(this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable())this.integralFormula=this;else throw new Error("Cannot integrate formula without variable");return this.integralFormula}else{if(this.applySubstitution==null)throw new Error("Cannot have two complex operations in an integrable formula");if(t.push(n=>this.applySubstitution.call(this,n,...this.inputs)),this.internalIntegrateInner)return this.internalIntegrateInner.call(this,t,...this.inputs);if(this.internalIntegrate)return this.internalIntegrate.call(this,t,...this.inputs);if(this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable())return this;throw new Error("Cannot integrate formula without variable")}}}function Lr(e,t,n=!0,i,r=o.dInf){const a=ve(n),l=ve(i),u=ve(r);return N(()=>{var h,w,v,b;const c=s(u);if(o.eq(c,1))return o.gte(t.value,e.evaluate())?o.dOne:o.dZero;const d=s(a),m=(h=s(l))!=null?h:d?10:0;let f=0;if(o.gt(c,m)){if(!e.isInvertible())throw new Error("Cannot calculate max affordable of non-invertible formula with more maxBulkAmount than directSum");if(d){if(!e.isIntegralInvertible())throw new Error("Cannot calculate max affordable of formula with non-invertible integral");f=o.floor(e.invertIntegral(o.add(t.value,e.evaluateIntegral()))).sub((w=s(e.innermostVariable))!=null?w:0)}else f=o.floor(e.invert(t.value))}if(f=o.clampMax(f,c),m>0){f=o.sub(f,m).clampMin(0);let I;for(d?I=Lt(e,f,!0,0):I=e.evaluate(o.add((v=s(e.innermostVariable))!=null?v:0,f));o.lt(f,c)&&o.lt(f,Number.MAX_SAFE_INTEGER);){const A=e.evaluate(f.add((b=s(e.innermostVariable))!=null?b:0));if(o.add(I,A).lte(t.value))f=f.add(1),I=o.add(I,A);else break}}return f})}function Lt(e,t,n=!0,i){var c;if(o.eq(t,1))return e.evaluate();const r=(c=s(e.innermostVariable))!=null?c:0;let a=o.add(t,r);const l=a;i!=null||(i=n?10:0),a=a.sub(i).clampMin(r);let u=0;if(o.gt(t,i)){if(!e.isInvertible())throw new Error("Cannot calculate cost with indirect sum of non-invertible formula");if(n){if(!e.isIntegrable())throw new Error("Cannot calculate cost with cumulative cost of non-integrable formula");if(u=o.sub(e.evaluateIntegral(a),e.evaluateIntegral()),l.gt(1e308))return o.add(u,o.sub(l,a).times(e.evaluate(a)))}else if(u=e.evaluate(a),a=a.add(1),l.gt(1e308))return o.sub(l,a).add(1).times(u)}for(let d=a.toNumber();d<l.toNumber();d++)u=o.add(u,e.evaluate(d));return u}function gn(e){return He(t=>{const{addend:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),l=ve(n),u=ve(i),c=r==null?void 0:ve(r);return{apply:d=>o.add(d,s(l)),invert:d=>o.sub(d,s(l)),getFormula:d=>g.add(d,l),enabled:c,description:i==null?void 0:K(()=>p("div",{class:"modifier-container"},[s(u)!=null?p("span",{class:"modifier-description"},[Nt(s(u))]):null,p("span",{class:"modifier-amount",style:(a===!0?o.gt(s(l),0):o.lt(s(l),0))?"color: var(--danger)":""},[o.gte(s(l),0)?"+":"",Qt(s(l))])]))}})}function Oe(e){return He(t=>{const{multiplier:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),l=ve(n),u=ve(i),c=r==null?void 0:ve(r);return{apply:d=>o.times(d,s(l)),invert:d=>o.div(d,s(l)),getFormula:d=>g.times(d,l),enabled:c,description:i==null?void 0:K(()=>p("div",{class:"modifier-container"},[s(u)!=null?p("span",{class:"modifier-description"},[Nt(s(u))]):null,p("span",{class:"modifier-amount",style:(a===!0?o.gt(s(l),1):o.lt(s(l),1))?"color: var(--danger)":""},[x("\xD7"),Qt(s(l))])]))}})}function Ii(e){return He(t=>{const{exponent:n,description:i,enabled:r,supportLowNumbers:a,smallerIsBetter:l}=e.call(t,t),u=ve(n),c=ve(i),d=r==null?void 0:ve(r);return{apply:m=>{let f=m;return a&&(f=o.add(f,1)),f=o.pow(f,s(u)),a&&(f=o.sub(f,1)),f},invert:m=>{let f=m;return a&&(f=o.add(f,1)),f=o.root(f,s(u)),a&&(f=o.sub(f,1)),f},getFormula:m=>a?g.add(m,1).pow(u).sub(1):g.pow(m,u),enabled:d,description:i==null?void 0:K(()=>p("div",{class:"modifier-container"},[s(c)!=null?p("span",{class:"modifier-description"},[Nt(s(c)),a?" (+1 effective)":null]):null,p("span",{class:"modifier-amount",style:(l===!0?o.gt(s(u),1):o.lt(s(u),1))?"color: var(--danger)":""},[x("^"),Qt(s(u))])]))}})}function $t(e){return He(()=>{const t=e();return{apply:n=>t.filter(i=>s(i.enabled)!==!1).reduce((i,r)=>r.apply(i),n),invert:t.every(n=>n.invert!=null)?n=>t.filter(i=>s(i.enabled)!==!1).reduceRight((i,r)=>r.invert(i),n):void 0,getFormula:t.every(n=>n.getFormula!=null)?n=>t.filter(i=>s(i.enabled)!==!1).reduce((i,r)=>r.getFormula(i),n):void 0,enabled:t.some(n=>n.enabled!=null)?N(()=>t.filter(n=>s(n.enabled)!==!1).length>0):void 0,description:t.some(n=>n.description!=null)?K(()=>p(ne,null,[t.filter(n=>s(n.enabled)!==!1).map(n=>s(n.description)).filter(n=>n).map(Nt)])):void 0}})}const Ln=g.variable(0).add(1),pi={id:"deselect",icon:"close",tooltip:e=>({text:"tools"in e.state?"Disconnect tools":"Disconnect resources"}),onClick(e){var t;Array.isArray((t=e.state)==null?void 0:t.data)?e.state={...e.state,data:[]}:"resources"in e.state?e.state={...e.state,resources:[]}:"tools"in e.state&&(e.state={...e.state,tools:[]}),C.board.selectedAction.value=null,C.board.selectedNode.value=null},visibility:e=>{var t;return Array.isArray((t=e.state)==null?void 0:t.data)?e.state.data.length>0:"resources"in e.state?e.state.resources.length>0:"tools"in e.state?e.state.tools.length>0:!1}},an={id:"toggle",icon:"bolt",tooltip:e=>({text:e.state.powered?"Turn Off":`Turn On - Always runs for ${gt(C.nextPowerCost.value)} energy/s`}),onClick(e){e.state={...e.state,powered:!e.state.powered},C.board.selectedAction.value=null},fillColor:e=>e.state.powered?"var(--accent1)":"var(--locked)"};function Hn(e,t=1/0){const n=e(g.variable(0));return{id:"moreConnections",icon:"hub",formula:n,tooltip(i){return{text:`Increase Connections - ${gt(n.evaluate(i.state.maxConnections))} energy`}},confirmationLabel:i=>o.gte(C.energy.value,n.evaluate(i.state.maxConnections))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"},onClick(i){const r=n.evaluate(i.state.maxConnections);o.gte(C.energy.value,r)&&(C.energy.value=o.sub(C.energy.value,r)),i.state={...i.state,maxConnections:o.add(i.state.maxConnections,1)},C.board.selectedAction.value=null},visibility:i=>o.add(i.state.maxConnections,C.computedBonusConnectionsModifier.value).lt(t)}}function jr(e,t){var n,i;if(((n=C.board.draggingNode.value)==null?void 0:n.type)==="resource"){const r=((i=C.board.draggingNode.value)==null?void 0:i.state).type,{maxConnections:a,resources:l}=e.state;return l.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,C.computedBonusConnectionsModifier.value).lte(l.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function od(e,t){var n,i;if(((n=C.board.draggingNode.value)==null?void 0:n.type)==="passive"){const r=(i=C.board.draggingNode.value)==null?void 0:i.state,{maxConnections:a,tools:l}=e.state;return l.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,C.computedBonusConnectionsModifier.value).lte(l.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function zr(e,t){var n,i;if(((n=C.board.draggingNode.value)==null?void 0:n.type)==="portal"){const r=((i=C.board.draggingNode.value)==null?void 0:i.state).id,{maxConnections:a,portals:l}=e.state;return l.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,C.computedBonusConnectionsModifier.value).lte(l.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function Ur(e,t){if(t.type!=="resource")return!1;const n=t.state.type,{maxConnections:i,resources:r}=e.state;return r.includes(n)?!0:!o.add(i,C.computedBonusConnectionsModifier.value).lte(r.length)}function Gr(e,t){if(t.type!=="resource")return;const n=t.state.type,i=e.state.resources;i.includes(n)?e.state={...e.state,resources:i.filter(r=>r!==n)}:e.state={...e.state,resources:[...i,n]},C.board.selectedNode.value=e}function ld(e,t){if(t.type!=="passive")return!1;const n=t.state,{maxConnections:i,tools:r}=e.state;return r.includes(n)?!0:!o.add(i,C.computedBonusConnectionsModifier.value).lte(r.length)}function ud(e,t){if(t.type!=="passive")return;const n=t.state,i=e.state.tools;i.includes(n)?e.state={...e.state,tools:i.filter(r=>r!==n)}:e.state={...e.state,tools:[...i,n]},C.board.selectedNode.value=e}function Wr(e,t){if(t.type!=="portal")return!1;const n=t.state.id,{maxConnections:i,portals:r}=e.state;return r.includes(n)?!0:!o.add(i,C.computedBonusConnectionsModifier.value).lte(r.length)}function Hr(e,t){if(t.type!=="portal")return;const n=t.state.id,{portals:i}=e.state;i.includes(n)?e.state={...e.state,portals:i.filter(r=>r!==n)}:e.state={...e.state,portals:[...i,n]},C.board.selectedNode.value=e}function Ne(e){return e===C.board.selectedNode.value||e.state.powered}function lt(e){return C.empowerer.value!=null&&Ne(C.empowerer.value)&&C.empowerer.value.state.tools.includes(e)}function cd(e){var a,l,u;const t=(u=(l=(a=C.resourceNodes.value[e])==null?void 0:a.state)==null?void 0:l.amount)!=null?u:0,n=C.resourceLevels.value[e],i=Lt(Ln,n,!0),r=Lt(Ln,o.add(n,1),!0);return o.sub(t,i).max(0).div(o.sub(r,i)).toNumber()}function Fn(e,t,n){if(t.value){const i=t.value.state,r=i[n],a=i.maxConnections;o.lt(r.length,o.add(a,e))&&(t.value.state={...t.value.state,[n]:r.slice(0,o.add(a,e).toNumber())})}}const dd={key:0},fd={key:0,class:"mark star"},pd=["src"],gd=J({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(M(),E("div",dd,[e.mark===!0?(M(),E("div",fd)):(M(),E("img",{key:1,class:"mark",src:e.mark},null,8,pd))])):B("",!0)}});var Zn=ce(gd,[["__scopeId","data-v-2207999f"]]);const md=J({__name:"Node",props:{id:null},setup(e){const n=$e(e),i=ii(qi,()=>{}),r=ii(Vi,()=>{}),a=ft(null),l=N(()=>a.value&&a.value.parentElement);return dt([l,n.id],([u,c],[d,m])=>{d&&r(s(m)),u&&i(c,u)}),vr(()=>r(s(n.id))),(u,c)=>(M(),E("div",{class:"node",ref_key:"node",ref:a},null,512))}});var Yn=ce(md,[["__scopeId","data-v-a48cb382"]]),vd=J({props:{display:{type:R(Object,String,Function),required:!0},visibility:{type:R(Number,Boolean),required:!0},style:R(Object,String,Array),classes:R(Object),onClick:Function,onHold:Function,canClick:{type:R(Boolean),required:!0},small:Boolean,mark:R(Boolean,String),id:{type:String,required:!0}},components:{Node:Yn,MarkNode:Zn},setup(e){const{display:t,onClick:n,onHold:i}=$e(e),r=ft("");_t(()=>{var m;const u=Ce(t);if(u==null){r.value="";return}if(St(u)){r.value=se(u);return}const c=se((m=u.title)!=null?m:"","h3"),d=se(u.description,"div");r.value=se(K(()=>p("span",null,[u.title!=null?p("div",null,[p(c,null,null)]):null,p(d,null,null)])))});const{start:a,stop:l}=$r(n,i);return{start:a,stop:l,comp:r,Visibility:he,isVisible:Le,isHidden:wn,unref:s}}});function hd(e,t,n,i,r,a){var c;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(M(),E("button",{key:0,style:Re([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[]]),onClick:t[0]||(t[0]=(...d)=>e.onClick&&e.onClick(...d)),onMousedown:t[1]||(t[1]=(...d)=>e.start&&e.start(...d)),onMouseleave:t[2]||(t[2]=(...d)=>e.stop&&e.stop(...d)),onMouseup:t[3]||(t[3]=(...d)=>e.stop&&e.stop(...d)),onTouchstartPassive:t[4]||(t[4]=(...d)=>e.start&&e.start(...d)),onTouchendPassive:t[5]||(t[5]=(...d)=>e.stop&&e.stop(...d)),onTouchcancelPassive:t[6]||(t[6]=(...d)=>e.stop&&e.stop(...d)),class:pe({feature:!0,clickable:!0,can:e.unref(e.canClick),locked:!e.unref(e.canClick),small:e.small,...e.unref(e.classes)})},[e.unref(e.comp)?(M(),ee(Ue(e.unref(e.comp)),{key:0})):B("",!0),p(l,{mark:e.unref(e.mark)},null,8,["mark"]),p(u,{id:e.id},null,8,["id"])],38)):B("",!0)}var Zr=ce(vd,[["render",hd],["__scopeId","data-v-211328c0"]]);const bd=Symbol("Clickable");function yd(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return He(i=>{var l,u,c;const r=(l=e==null?void 0:e.call(i,i))!=null?l:{};r.id=rn("clickable-"),r.type=bd,r[mt]=Zr;for(const d of t)(u=d.preConstruct)==null||u.call(d,r);if(Object.assign(r,n),$(r,"visibility"),ie(r,"visibility",he.Visible),$(r,"canClick"),ie(r,"canClick",!0),$(r,"classes"),$(r,"style"),$(r,"mark"),$(r,"display"),r.onClick){const d=r.onClick.bind(r);r.onClick=function(m){s(r.canClick)!==!1&&d(m)}}if(r.onHold){const d=r.onHold.bind(r);r.onHold=function(){s(r.canClick)!==!1&&d()}}for(const d of t)(c=d.postConstruct)==null||c.call(d,r);const a=t.reduce((d,m)=>{var f;return Object.assign(d,(f=m.getGatheredProps)==null?void 0:f.call(m,r))},{});return r[at]=function(){const{display:d,visibility:m,style:f,classes:h,onClick:w,onHold:v,canClick:b,small:I,mark:A,id:S}=this;return{display:d,visibility:m,style:s(f),classes:h,onClick:w,onHold:v,canClick:b,small:I,mark:A,id:S,...a}},r})}const wd=["x1","y1","x2","y2"],_d=J({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const n=$e(e),i=N(()=>{const a=n.startNode.value.rect,l=n.boundingRect.value,u=l?{x:a.x+a.width/2-l.x,y:a.y+a.height/2-l.y}:{x:0,y:0};return n.link.value.offsetStart&&(u.x+=n.link.value.offsetStart.x,u.y+=n.link.value.offsetStart.y),u}),r=N(()=>{const a=n.endNode.value.rect,l=n.boundingRect.value,u=l?{x:a.x+a.width/2-l.x,y:a.y+a.height/2-l.y}:{x:0,y:0};return n.link.value.offsetEnd&&(u.x+=n.link.value.offsetEnd.x,u.y+=n.link.value.offsetEnd.y),u});return(a,l)=>(M(),E("line",zt({"stroke-width":"15px",stroke:"white"},e.link,{x1:s(i).x,y1:s(i).y,x2:s(r).x,y2:s(r).y}),null,16,wd))}});const Nd=J({__name:"Links",props:{links:null},setup(e){var c;const n=tn(e,"links"),i=V(null),r=ii(Bi,V({})),a=ii(Li,V(void 0)),l=V((c=i.value)==null?void 0:c.getBoundingClientRect());dt(a,()=>{var d;return l.value=(d=i.value)==null?void 0:d.getBoundingClientRect()}),ci(()=>{var d;return l.value=(d=i.value)==null?void 0:d.getBoundingClientRect()});const u=N(()=>{var m,f;const d=r.value;return(f=(m=n.value)==null?void 0:m.filter(h=>{var w,v;return((w=d[h.startNode.id])==null?void 0:w.rect)&&((v=d[h.startNode.id])==null?void 0:v.rect)}))!=null?f:[]});return(d,m)=>(M(),E(ne,null,[s(u)?(M(),E("svg",va(zt({key:0},d.$attrs)),[(M(!0),E(ne,null,En(s(u),(f,h)=>(M(),ee(_d,{key:h,link:f,boundingRect:l.value,startNode:s(r)[f.startNode.id],endNode:s(r)[f.endNode.id]},null,8,["link","boundingRect","startNode","endNode"]))),128))],16)):B("",!0),_("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var Cd=ce(Nd,[["__scopeId","data-v-063f6d6b"]]);J({props:{nodes:{type:R(Array),required:!0},leftSideNodes:R(Array),rightSideNodes:R(Array),branches:R(Array)},components:{Links:Cd},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:i}=$e(e),r=ft();_t(()=>{const u=Ce(t);r.value=se(K(()=>p(ne,null,[u.map(c=>p("span",{class:"row tree-row",style:"margin: 50px auto;"},[c.map(Nt)]))])))});const a=ft();_t(()=>{const u=Ce(n);a.value=u?se(K(()=>p("span",{class:"left-side-nodes small"},[u.map(Nt)]))):""});const l=ft();return _t(()=>{const u=Ce(i);l.value=u?se(K(()=>p("span",{class:"side-nodes small"},[u.map(Nt)]))):""}),{unref:s,nodesComp:r,leftNodesComp:a,rightNodesComp:l}}});J({props:{display:R(Object,String,Function),visibility:{type:R(Number,Boolean),required:!0},style:R(String,Object,Array),classes:R(Object),onClick:Function,onHold:Function,color:R(String),glowColor:R(String),canClick:{type:R(Boolean),required:!0},mark:R(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Zn,Node:Yn},setup(e){const{onClick:t,onHold:n,display:i}=$e(e),r=Pn(i),{start:a,stop:l}=$r(t,n);return{start:a,stop:l,comp:r,unref:s,Visibility:he,isCoercableComponent:St,isVisible:Le,isHidden:wn}}});function Bn(e){const t=[],n={};let i=!1;function r(){return i||(t.push(...e()),n.base=t.map(u=>ve(u.base)),n.baseText=t.map(u=>ve(u.baseText)),n.visible=t.map(u=>ve(u.visible)),n.title=t.map(u=>ve(u.title)),n.subtitle=t.map(u=>ve(u.subtitle)),i=!0),t}const a=ct({},!1);return[K(()=>{const u=r();let c=!0;const d=u.map((m,f)=>{var A,S,P;if(s(n.visible[f])===!1)return null;const h=p("h3",{onClick:()=>a.value[f]=!a.value[f],style:"cursor: pointer"},[p("span",{class:"modifier-toggle"+(s(a.value[f])?" collapsed":"")},[x("\u25BC")]),s(n.title[f]),s(n.subtitle[f])!=null?p("span",{class:"subtitle"},[x(" ("),s(n.subtitle[f]),x(")")]):null]),w=s(a.value[f])?null:p(ne,null,[p("div",{class:"modifier-container"},[p("span",{class:"modifier-description"},[Nt((A=s(n.baseText[f]))!=null?A:"Base")]),p("span",{class:"modifier-amount"},[me((S=s(n.base[f]))!=null?S:1),m.unit])]),m.modifier.description==null?null:Nt(s(m.modifier.description))]),v=!c;c=!1;const b=(P=s(n.base[f]))!=null?P:1,I=m.modifier.apply(b);return p(ne,null,[v?p("br",null,null):null,p("div",{style:{"--unit":re.alignUnits&&m.unit!=null?"'"+m.unit+"'":""}},[h,p("br",null,null),w,p("hr",null,null),p("div",{class:"modifier-container"},[p("span",{class:"modifier-description"},[x("Total")]),p("span",{class:"modifier-amount",style:(m.smallerIsBetter===!0?o.gt(I,b!=null?b:1):o.lt(I,b!=null?b:1))?"color: var(--danger)":""},[Qt(I),m.unit])])])])});return p(ne,null,[d])}),a]}function $i(e,t,n){const i=ve(t),r=ve(n);return N(()=>{const a=s(i),l=s(r);return o.gte(e.value,l)?"Now":o.lte(a,0)?"Never":fi(o.sub(l,e.value).div(a))})}function dn(e,t,n=1){const i=ve(t),r=ve(n);if(!e.hasVariable())throw new Error("Cannot create formula preview if the formula does not have a variable");return K(()=>{var a;if(s(i)){const l=Qt(e.evaluate()),u=Qt(e.evaluate(o.add(s((a=e.innermostVariable)!=null?a:0),s(r))));return p(ne,null,[p("b",null,[p("i",null,[l,x(" \u2192 "),u])])])}return p(ne,null,[Qt(e.evaluate())])})}const Mt={dirt:120,sand:60,gravel:40,wood:30,stone:24,coal:20,copper:15,iron:12,silver:10,gold:8,emerald:6,platinum:5,diamond:4,berylium:3,unobtainium:2,ultimatum:1},cn=Object.keys(Mt),Te={dirt:{cost:1e3,name:"Pickaxe",type:"passive",state:"dirt"},sand:{cost:1e4,name:"Dowsing Rod",type:"dowsing",state:{resources:[],maxConnections:1,powered:!1}},gravel:{cost:1e5,name:"Ore Processor",type:"passive",state:"gravel"},wood:{cost:1e6,name:"Quarry",type:"quarry",state:{resources:[],maxConnections:1,powered:!1,progress:0}},stone:{cost:1e7,name:"Energizer",type:"passive",state:"stone"},coal:{cost:1e8,name:"Tool Empowerer",type:"empowerer",state:{tools:[],maxConnections:1,powered:!1}},copper:{cost:1e9,name:"Book",type:"passive",state:"copper"},iron:{cost:1e10,name:"Portal Generator",type:"portalGenerator",state:{tier:void 0,influences:[]}},silver:{cost:1e12,name:"Robotics",type:"passive",state:"silver"},gold:{cost:1e15,name:"Booster",type:"booster",state:{portals:[],maxConnections:1,powered:!1,level:1}},emerald:{cost:1e19,name:"Artificial Intelligence",type:"passive",state:"emerald"},platinum:{cost:1e24,name:"Upgrader",type:"upgrader",state:{portals:[],maxConnections:1,powered:!1}},diamond:{cost:1e30,name:"Machine Learning",type:"passive",state:"diamond"},berylium:{cost:1e37,name:"Automator",type:"automator",state:{portals:[],maxConnections:1,powered:!1}},unobtainium:{cost:1e45,name:"National Grid",type:"passive",state:"unobtainium"},ultimatum:{cost:1e54,name:"Investments",type:"investments",state:{portals:[],maxConnections:1,powered:!1}}},Fi={dirt:"Replicator",sand:"Metal Detector",gravel:"Neural Networks",wood:"Mining Laser",stone:"BOGO Coupon",coal:"Planar Intelligence",copper:"Efficient Code",iron:"Trade Agreements",silver:"Machine Synergizer",gold:"XP Market",emerald:"Efficient Portals",platinum:"Time Dilation",diamond:"Paypal",berylium:"Tiered Mining",unobtainium:"Overclocked Portals",ultimatum:"Rebates"},kd={dirt:{description:e=>e?"Quadruples mining speed":"Doubles mining speed"},gravel:{description:e=>e?"Quadruples mine ore drops":"Doubles mine ore drops"},stone:{description:e=>e?"Quadruples energy gain":"Doubles energy gain"},copper:{description:e=>e?"Material level is 20% stronger":"Material level is 10% stronger"},silver:{description:e=>e?"Doubles each plane's resource gain":"Quadruples each plane's resource gain"},diamond:{description:e=>e?"+20% plane's resource gain per upgrade bought":"+10% plane's resource gain per upgrade bought"},emerald:{description:e=>e?"+2% plane's resource gain per minute active":"+1% plane's resource gain per minute active"},unobtainium:{description:e=>e?"+2 max connections per machine":"+1 max connections per machine"},dirtRelic:{description:e=>e?"Upgrades apply thrice":"Upgrades apply twice"},sandRelic:{description:e=>e?"Treasure's 2 tiers stronger":"Treasure's 1 tier stronger"},gravelRelic:{description:e=>e?"+2% plane's resource gain per repeatable purchase":"+1% plane's resource gain per repeatable purchase"},woodRelic:{description:e=>e?"(Relics)^2 boost mine speed":"Relics boost mine speed"},stoneRelic:{description:e=>e?"2 free levels for repeatables":"1 free level for repeatables"},coalRelic:{description:e=>e?"(Treasures)^2 boost planar speed":"Treasures boost planar speed"},copperRelic:{description:e=>e?"Power 2 machines free":"Power 1 machine free"},ironRelic:{description:e=>e?"Conversions give triple output":"Conversions give double output"},silverRelic:{description:e=>e?"(Power machines)^2 boost ore dropped":"Power machines boost ore dropped"},goldRelic:{description:e=>e?"Each treasure quadruples XP gain":"Each treasure doubles XP gain"},emeraldRelic:{description:e=>e?"Creating portals costs a third the energy":"Creating portals costs half the energy"},platinumRelic:{description:e=>e?"Triple dimensions' tick rate":"Double dimensions' tick rate"},diamondRelic:{description:e=>e?"Repeatables/dimensions buy max at once":"Repeatables buy max at once"},beryliumRelic:{description:e=>e?"ln(energy) boosts planar speed":"log(energy) boosts planar speed"},unobtainiumRelic:{description:e=>e?"Upgrades/repeatables/dimensions/prestige no longer spend on purchase":"Upgrades/repeatables no longer spend on purchase"}},Vt={increaseResources:{display:"+resource",description:e=>{const t=e.data;return t.length===0?"Increase resource odds - Drag a resource to me!":t.length===1?`Increase ${t[0]}'s odds`:`Increase ${t.length} resources' odds`},cost:2,initialData:[]},decreaseResources:{display:"-resource",description:e=>{const t=e.data;return t.length===0?"Decrease resource odds - Drag a resource to me!":t.length===1?`Decrease ${t[0]}'s odds`:`Decrease ${t.length} resources' odds`},cost:2,initialData:[]},increaseLength:{display:"+length",description:"Increase length",cost:100,initialData:void 0},increaseCaches:{display:"+caches",description:"Increase caches odds",cost:10,initialData:void 0},increaseGens:{display:"+gens",description:"Increase generators odds",cost:10,initialData:void 0},increaseInfluences:{display:"+influences",description:"Increase influences odds",cost:10,initialData:void 0},increaseEnergyMults:{display:"+energy mults",description:"Increase energy mults odds",cost:10,initialData:void 0},increaseResourceMults:{display:"+resource mults",description:"Increase resource mults odds",cost:10,initialData:void 0},increaseDiff:{display:"+diff",description:"Increase difficulty/rewards odds",cost:10,initialData:void 0},decreaseDiff:{display:"-diff",description:"Decrease difficulty/rewards odds",cost:10,initialData:void 0},increaseRewards:{display:"+rewards",description:"Increase rewards level",cost:1e4,initialData:void 0},relic:{display:"+relic",description:"Max length/difficulty, add tier-unique relic",cost:1e6,initialData:void 0}},xi=g.variable(0).add(8).times(2).pow10();const Md=J({__name:"Spacer",props:{width:{default:"8px"},height:{default:"17px"}},setup(e){return(t,n)=>(M(),E("div",{style:Re({width:e.width,height:e.height})},null,4))}});function An(e){return He(t=>{var i;const n=e.call(t,t);return n.partialDisplay=r=>p("span",{style:s(n.requirementMet)?"":"color: var(--danger)"},[ui(n.resource,n.cost instanceof g?Lt(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),n.display=r=>p("div",null,[s(n.requiresPay)?"Costs: ":"Requires: ",ui(n.resource,n.cost instanceof g?Lt(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),$(n,"visibility"),ie(n,"visibility",he.Visible),$(n,"cost"),$(n,"requiresPay"),ie(n,"requiresPay",!0),$(n,"cumulativeCost"),ie(n,"cumulativeCost",!0),$(n,"maxBulkAmount"),ie(n,"maxBulkAmount",1),$(n,"directSum"),ie(n,"pay",function(r){const a=n.cost instanceof g?Lt(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost);n.resource.value=o.sub(n.resource.value,a).max(0)}),n.canMaximize=N(()=>{var u;if(!(n.cost instanceof g))return!1;const r=s(n.maxBulkAmount);if(o.lte(r,1))return!1;const a=s(n.cumulativeCost),l=(u=s(n.directSum))!=null?u:a?10:0;return o.lte(r,l)?!0:!(!n.cost.isInvertible()||a===!0&&!n.cost.isIntegrable())}),n.cost instanceof g?n.requirementMet=Lr(n.cost,n.resource,(i=n.cumulativeCost)!=null?i:!0,n.directSum,n.maxBulkAmount):n.requirementMet=N(()=>o.gte(n.resource.value,s(n.cost))),n})}function Wi(e){return He(()=>({requirementMet:N(()=>Le(e.visibility)),visibility:he.None,requiresPay:!1}))}function Sd(e,t){return He(()=>({requirementMet:ve(e),partialDisplay:t==null?void 0:K(()=>Nt(t)),display:t==null?void 0:K(()=>p(ne,null,[x("Req: "),Nt(t)])),visibility:t==null?he.None:he.Visible,requiresPay:!1}))}function gi(e){if(Pt(e))return e.every(gi);const t=s(e.requirementMet);return typeof t=="boolean"?t:o.gt(t,0)}function Yr(e){if(Pt(e))return e.map(Yr).reduce(o.min);const t=s(e.requirementMet);return typeof t=="boolean"?t?o.dInf:0:o.gt(t,1)&&s(e.canMaximize)!==!0?1:t}function mi(e,t=1){var n,i;if(Pt(e)&&(e=e.filter(r=>Le(r.visibility)),e.length===1&&(e=e[0])),Pt(e)){e=e.filter(l=>"partialDisplay"in l);const r=e.filter(l=>s(l.requiresPay)),a=e.filter(l=>!s(l.requiresPay));return p(ne,null,[r.length>0?p("div",null,[x("Costs:")," ",or(r.map(l=>l.partialDisplay(t)),p(ne,null,[x(", ")]))]):null,a.length>0?p("div",null,[x("Requires:")," ",or(a.map(l=>l.partialDisplay(t)),p(ne,null,[x(", ")]))]):null])}return(i=(n=e.display)==null?void 0:n.call(e))!=null?i:p(ne,null,null)}function Xr(e,t=1){var n;Pt(e)?e.filter(i=>s(i.requiresPay)).forEach(i=>{var r;return(r=i.pay)==null?void 0:r.call(i,t)}):s(e.requiresPay)&&((n=e.pay)==null||n.call(e,t))}var Id=J({props:{visibility:{type:R(Number,Boolean),required:!0},display:R(Object,String,Function),earned:{type:R(Boolean),required:!0},requirements:R(Object,Array),image:R(String),style:R(String,Object,Array),classes:R(Object),mark:R(Boolean,String),small:R(Boolean),id:{type:String,required:!0}},components:{Node:Yn,MarkNode:Zn},setup(e){const{display:t,requirements:n,earned:i}=$e(e),r=ft("");return _t(()=>{const a=Ce(t);if(a==null){r.value="";return}if(St(a)){r.value=se(a);return}const l=se(a.requirement?a.requirement:K(()=>{var d;return mi((d=Ce(n))!=null?d:[])}),"h3"),u=se(a.effectDisplay||"","b"),c=Ce(i)?se(a.optionsDisplay||"","span"):"";r.value=se(K(()=>p("span",null,[p(l,null,null),a.effectDisplay!=null?p("div",null,[p(u,null,null)]):null,a.optionsDisplay!=null?p("div",{class:"equal-spaced"},[p(c,null,null)]):null])))}),{comp:r,unref:s,Visibility:he,isVisible:Le,isHidden:wn}}});function $d(e,t,n,i,r,a){var c;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(M(),E("div",{key:0,style:Re([{visibility:e.isHidden(e.visibility)?"hidden":void 0,backgroundImage:e.earned&&e.image&&`url(${e.image})`||""},(c=e.unref(e.style))!=null?c:[]]),class:pe({feature:!0,achievement:!0,locked:!e.unref(e.earned),done:e.unref(e.earned),small:e.unref(e.small),...e.unref(e.classes)})},[e.comp?(M(),ee(Ue(e.comp),{key:0})):B("",!0),p(l,{mark:e.unref(e.mark)},null,8,["mark"]),p(u,{id:e.id},null,8,["id"])],6)):B("",!0)}var xd=ce(Id,[["render",$d],["__scopeId","data-v-5673325a"]]);const Ed=di(),Pd=Symbol("Achievement");let Sn=function(e){return e.All="all",e.Configurable="configurable",e.Incomplete="incomplete",e.None="none",e}({});function Td(e,...t){const n=ct(!1,!1),i=t.reduce((r,a)=>{var l;return Object.assign(r,(l=a.getPersistentData)==null?void 0:l.call(a))},{});return He(r=>{var c,d,m;const a=(c=e==null?void 0:e.call(r,r))!=null?c:{};a.id=rn("achievement-"),a.type=Pd,a[mt]=xd;for(const f of t)(d=f.preConstruct)==null||d.call(f,a);a.earned=n,a.complete=function(){var h,w;n.value=!0;const f=a;if((h=f.onComplete)==null||h.call(f),f.display!=null&&s(f.showPopups)===!0){const v=s(f.display);let b;St(v)?b=se(v):v.requirement!=null?b=se(v.requirement):b=mi((w=f.requirements)!=null?w:[]),Ed.info(p("div",null,[p("h3",null,[x("Achievement earned!")]),p("div",null,[p(b,null,null)])]))}},Object.assign(a,i),$(a,"visibility"),ie(a,"visibility",he.Visible);const l=a.visibility;a.visibility=ha(()=>{const f=s(a.display);switch(re.msDisplay){default:case Sn.All:return s(l);case Sn.Configurable:return s(a.earned)&&!(f!=null&&typeof f=="object"&&"optionsDisplay"in f)?he.None:s(l);case Sn.Incomplete:return s(a.earned)?he.None:s(l);case Sn.None:return he.None}}),$(a,"display"),$(a,"mark"),$(a,"small"),$(a,"image"),$(a,"style"),$(a,"classes"),$(a,"showPopups"),ie(a,"showPopups",!0);for(const f of t)(m=f.postConstruct)==null||m.call(f,a);const u=t.reduce((f,h)=>{var w;return Object.assign(f,(w=h.getGatheredProps)==null?void 0:w.call(h,a))},{});if(a[at]=function(){const{visibility:f,display:h,requirements:w,earned:v,image:b,style:I,classes:A,mark:S,small:P,id:L}=this;return{visibility:f,display:h,requirements:w,earned:v,image:b,style:s(I),classes:A,mark:S,small:P,id:L,...u}},a.requirements){const f=a,h=[Wi(f),Sd(()=>!f.earned.value),...Pt(a.requirements)?a.requirements:[a.requirements]];_t(()=>{re.active===Q.id&&gi(h)&&f.complete()})}return a})}We.on("loadSettings",e=>{ie(e,"msDisplay",Sn.All)});const Dd=Object.values(Sn).map(e=>({label:Ke(e),value:e}));Is(K(()=>p(Ui,{title:K(()=>p("span",{class:"option-title"},[x("Show achievements"),p("desc",null,[x("Select which achievements to display based on criterias.")])])),options:Dd,"onUpdate:modelValue":e=>re.msDisplay=e,modelValue:re.msDisplay},null)));const Fd=J({props:{progress:{type:R(String,Object,Number),required:!0},width:{type:R(Number),required:!0},height:{type:R(Number),required:!0},direction:{type:R(String),required:!0},display:R(Object,String,Function),visibility:{type:R(Number,Boolean),required:!0},style:R(Object,String,Array),classes:R(Object),borderStyle:R(Object,String,Array),textStyle:R(Object,String,Array),baseStyle:R(Object,String,Array),fillStyle:R(Object,String,Array),mark:R(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Zn,Node:Yn},setup(e){const{progress:t,width:n,height:i,direction:r,display:a}=$e(e),l=N(()=>{let d=t.value instanceof o?t.value.toNumber():Number(t.value);return(1-Math.min(Math.max(d,0),1))*100}),u=N(()=>{const d={width:Ce(n)+.5+"px",height:Ce(i)+.5+"px"};switch(s(r)){case G.Up:d.clipPath=`inset(${l.value}% 0% 0% 0%)`,d.width=Ce(n)+1+"px";break;case G.Down:d.clipPath=`inset(0% 0% ${l.value}% 0%)`,d.width=Ce(n)+1+"px";break;case G.Right:d.clipPath=`inset(0% ${l.value}% 0% 0%)`;break;case G.Left:d.clipPath=`inset(0% 0% 0% ${l.value} + '%)`;break;case G.Default:d.clipPath="inset(0% 50% 0% 0%)";break}return d}),c=Pn(a);return{normalizedProgress:l,barStyle:u,component:c,unref:s,Visibility:he,isVisible:Le,isHidden:wn}}});function Ad(e,t,n,i,r,a){var c,d,m,f,h,w,v;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(M(),E("div",{key:0,style:Re([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px",visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:{}]),class:pe({bar:!0,...e.unref(e.classes)})},[_("div",{class:"overlayTextContainer border",style:Re([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(d=e.unref(e.borderStyle))!=null?d:{}])},[e.component?(M(),E("span",{key:0,class:"overlayText",style:Re(e.unref(e.textStyle))},[(M(),ee(Ue(e.component)))],4)):B("",!0)],4),_("div",{class:"border",style:Re([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(m=e.unref(e.style))!=null?m:{},(f=e.unref(e.baseStyle))!=null?f:{},(h=e.unref(e.borderStyle))!=null?h:{}])},[_("div",{class:"fill",style:Re([e.barStyle,(w=e.unref(e.style))!=null?w:{},(v=e.unref(e.fillStyle))!=null?v:{}])},null,4)],4),p(l,{mark:e.unref(e.mark)},null,8,["mark"]),p(u,{id:e.id},null,8,["id"])],6)):B("",!0)}var Od=ce(Fd,[["render",Ad],["__scopeId","data-v-6bd06b56"]]);const Rd=Symbol("Bar");function qd(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return He(i=>{var l,u;const r=e.call(i,i);r.id=rn("bar-"),r.type=Rd,r[mt]=Od;for(const c of t)(l=c.preConstruct)==null||l.call(c,r);Object.assign(r,n),$(r,"visibility"),ie(r,"visibility",he.Visible),$(r,"width"),$(r,"height"),$(r,"direction"),$(r,"style"),$(r,"classes"),$(r,"borderStyle"),$(r,"baseStyle"),$(r,"textStyle"),$(r,"fillStyle"),$(r,"progress"),$(r,"display"),$(r,"mark");for(const c of t)(u=c.postConstruct)==null||u.call(c,r);const a=t.reduce((c,d)=>{var m;return Object.assign(c,(m=d.getGatheredProps)==null?void 0:m.call(d,r))},{});return r[at]=function(){const{progress:c,width:d,height:m,direction:f,display:h,visibility:w,style:v,classes:b,borderStyle:I,textStyle:A,baseStyle:S,fillStyle:P,mark:L,id:le}=this;return{progress:c,width:d,height:m,direction:f,display:h,visibility:w,style:s(v),classes:b,borderStyle:I,textStyle:A,baseStyle:S,fillStyle:P,mark:L,id:le,...a}},r})}function Vd(e,...t){return He(n=>{var r,a;const i=e.call(n,n);for(const l of t)(r=l.preConstruct)==null||r.call(l,i);i.formula=i.formula(g.variable(i.baseResource)),i.currentGain==null&&(i.currentGain=N(()=>{let l=o.floor(i.formula.evaluate(i.baseResource.value)).max(0);return s(i.buyMax)===!1&&(l=l.min(1)),l})),i.actualGain==null&&(i.actualGain=i.currentGain),i.currentAt==null&&(i.currentAt=N(()=>i.formula.invert(o.floor(s(i.currentGain))))),i.nextAt==null&&(i.nextAt=N(()=>i.formula.invert(o.floor(s(i.currentGain)).add(1)))),i.convert==null&&(i.convert=function(){var u;const l=s(i.currentGain);i.gainResource.value=o.add(i.gainResource.value,l),i.spend(l),(u=i.onConvert)==null||u.call(i,l)}),i.spend==null&&(i.spend=function(){i.baseResource.value=0}),$(i,"currentGain"),$(i,"actualGain"),$(i,"currentAt"),$(i,"nextAt"),$(i,"buyMax"),ie(i,"buyMax",!0);for(const l of t)(a=l.postConstruct)==null||a.call(l,i);return i})}function Bd(e){return Vd(e)}const Jr=Symbol("Repeatable");function cr(e,...t){const n=ct(0),i=t.reduce((r,a)=>{var l;return Object.assign(r,(l=a.getPersistentData)==null?void 0:l.call(a))},{});return He(r=>{var h,w,v;const a=e.call(r,r);a.id=rn("repeatable-"),a.type=Jr,a[mt]=Zr;for(const b of t)(h=b.preConstruct)==null||h.call(b,a);a.amount=n,a.amount[nn]=(w=a.initialAmount)!=null?w:0,Object.assign(a,i);const l={requirementMet:N(()=>o.sub(s(a.limit),a.amount.value)),requiresPay:!1,visibility:he.None},u=Wi(a);Pt(a.requirements)?(a.requirements.unshift(u),a.requirements.push(l)):a.requirements=[u,a.requirements,l],a.maxed=N(()=>o.gte(a.amount.value,s(a.limit))),$(a,"classes");const c=a.classes;a.classes=N(()=>{const b=s(c)||{};return a.maxed.value&&(b.bought=!0),b}),a.amountToIncrease=N(()=>o.clampMin(Yr(a.requirements),1)),a.canClick=N(()=>gi(a.requirements));const d=a.onClick;a.onClick=function(b){const I=a;!s(I.canClick)||(Xr(a.requirements,s(a.amountToIncrease)),I.amount.value=o.add(I.amount.value,1),d==null||d(b))},$(a,"display");const m=a.display;a.display=K(()=>{var I,A,S;const b=s(m);if(St(b)){const P=se(b);return p(P,null,null)}if(b!=null){const P=a,L=se((I=b.title)!=null?I:"","h3"),le=se((A=b.description)!=null?A:""),Z=se((S=b.effectDisplay)!=null?S:"");return p("span",null,[b.title==null?null:p("div",null,[p(L,null,null)]),b.description==null?null:p(le,null,null),b.showAmount===!1?null:p("div",null,[p("br",null,null),p(ne,null,[x("Amount: "),gt(P.amount.value)]),o.isFinite(s(P.limit))?p(ne,null,[x(" / "),gt(s(P.limit))]):void 0]),b.effectDisplay==null?null:p("div",null,[p("br",null,null),x("Currently: "),p(Z,null,null)]),P.maxed.value?null:p("div",null,[p("br",null,null),mi(P.requirements,s(a.amountToIncrease))])])}return""}),$(a,"visibility"),ie(a,"visibility",he.Visible),$(a,"limit"),ie(a,"limit",o.dInf),$(a,"style"),$(a,"mark"),$(a,"small");for(const b of t)(v=b.postConstruct)==null||v.call(b,a);const f=t.reduce((b,I)=>{var A;return Object.assign(b,(A=I.getGatheredProps)==null?void 0:A.call(I,a))},{});return a[at]=function(){const{display:b,visibility:I,style:A,classes:S,onClick:P,canClick:L,small:le,mark:Z,id:z}=this;return{display:b,visibility:I,style:s(A),classes:S,onClick:P,canClick:L,small:le,mark:Z,id:z,...f}},a})}const Ld=Symbol("Reset");function jd(e){return He(t=>{const n=e.call(t,t);return n.id=rn("reset-"),n.type=Ld,n.reset=function(){var r;const i=a=>{if(a!=null&&typeof a=="object")if(nn in a){const l=a;l.value=l[nn]}else!(a instanceof o)&&!De(a)&&Object.values(a).forEach(l=>i(l))};s(n.thingsToReset).forEach(i),We.emit("reset",n),(r=n.onReset)==null||r.call(n)},$(n,"thingsToReset"),n})}const ei={};We.on("removeLayer",e=>{var t;(t=ei[e.id])==null||t.call(ei),ei[e.id]=void 0});function Ei(e,t){return $(t,"display"),$(t,"classes"),$(t,"style"),$(t,"direction"),ie(t,"direction",G.Up),$(t,"xoffset"),$(t,"yoffset"),t.pinnable&&(t.pinned=ct(!1,!1)),jt(()=>{t.pinnable&&("pinned"in e?(console.error("Cannot add pinnable tooltip to element that already has a property called 'pinned'"),t.pinnable=!1,Pr(t.pinned)):e.pinned=t.pinned);const n=e[mt];e[mt]=Pe;const i=e[at].bind(e);e[at]=function(){const{display:a,classes:l,style:u,direction:c,xoffset:d,yoffset:m,pinned:f}=this;return{element:{[mt]:n,[at]:i},display:a,classes:l,style:s(u),direction:c,xoffset:d,yoffset:m,pinned:f}}.bind(t)}),t}var zd=J({props:{display:{type:R(String,Object,Function),required:!0},visibility:{type:R(Number,Boolean),required:!0},style:R(String,Object,Array),classes:R(Object),requirements:{type:Object,required:!0},canPurchase:{type:R(Boolean),required:!0},bought:{type:R(Boolean),required:!0},mark:R(Boolean,String),id:{type:String,required:!0},purchase:{type:Function,required:!0}},components:{Node:Yn,MarkNode:Zn},setup(e){const{display:t,requirements:n,bought:i}=$e(e),r=ft("");return _t(()=>{const a=Ce(t);if(a==null){r.value="";return}if(St(a)){r.value=se(a);return}const l=se(a.title||"","h3"),u=se(a.description,"div"),c=se(a.effectDisplay||"");r.value=se(K(()=>p("span",null,[a.title!=null?p("div",null,[p(l,null,null)]):null,p(u,null,null),a.effectDisplay!=null?p("div",null,[x("Currently: "),p(c,null,null)]):null,i.value?null:p(ne,null,[p("br",null,null),mi(n.value)])])))}),{component:r,unref:s,Visibility:he,isVisible:Le,isHidden:wn}}});const Ud=["disabled"];function Gd(e,t,n,i,r,a){var c;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(M(),E("button",{key:0,style:Re([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:{}]),onClick:t[0]||(t[0]=(...d)=>e.purchase&&e.purchase(...d)),class:pe({feature:!0,upgrade:!0,can:e.unref(e.canPurchase),locked:!e.unref(e.canPurchase),bought:e.unref(e.bought),...e.unref(e.classes)}),disabled:!e.unref(e.canPurchase)},[e.unref(e.component)?(M(),ee(Ue(e.unref(e.component)),{key:0})):B("",!0),p(l,{mark:e.unref(e.mark)},null,8,["mark"]),p(u,{id:e.id},null,8,["id"])],14,Ud)):B("",!0)}var Wd=ce(zd,[["render",Gd],["__scopeId","data-v-9be6bac0"]]);const Hi=Symbol("Upgrade");function dr(e,...t){const n=ct(!1,!1),i=t.reduce((r,a)=>{var l;return Object.assign(r,(l=a.getPersistentData)==null?void 0:l.call(a))},{});return He(r=>{var c,d;const a=e.call(r,r);a.id=rn("upgrade-"),a.type=Hi,a[mt]=Wd;for(const m of t)(c=m.preConstruct)==null||c.call(m,a);a.bought=n,Object.assign(a,i),a.canPurchase=N(()=>!n.value&&gi(a.requirements)),a.purchase=function(){var f;const m=a;!s(m.canPurchase)||(Xr(a.requirements),n.value=!0,(f=m.onPurchase)==null||f.call(m))};const l=Wi(a);Pt(a.requirements)?a.requirements.unshift(l):a.requirements=[l,a.requirements],$(a,"visibility"),ie(a,"visibility",he.Visible),$(a,"classes"),$(a,"style"),$(a,"display"),$(a,"mark");for(const m of t)(d=m.postConstruct)==null||d.call(m,a);const u=t.reduce((m,f)=>{var h;return Object.assign(m,(h=f.getGatheredProps)==null?void 0:h.call(f,a))},{});return a[at]=function(){const{display:m,visibility:f,style:h,classes:w,requirements:v,canPurchase:b,bought:I,mark:A,id:S,purchase:P}=this;return{display:m,visibility:f,style:s(h),classes:w,requirements:v,canPurchase:b,bought:I,mark:A,id:S,purchase:P,...u}},a})}function Hd(e,t,n=[]){n=n.length===0?ai(e,Hi):n;const i=zn(t)?N(t):t;e.on("update",()=>{s(i)&&n.forEach(r=>r.purchase())})}function Zd(e,t,n,i){return function(){e>>>=0,t>>>=0,n>>>=0,i>>>=0;let r=e+t|0;return e=t^t>>>9,t=n+(n<<3)|0,n=n<<21|n>>>11,i=i+1|0,r=r+i|0,n=n+r|0,(r>>>0)/4294967296}}const Yd={1:["b","c","d","f","g","h","i","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z"],2:["a","e","o","u"],3:["br","cr","dr","fr","gr","pr","str","tr","bl","cl","fl","gl","pl","sl","sc","sk","sm","sn","sp","st","sw","ch","sh","th","wh"],4:["ae","ai","ao","au","a","ay","ea","ei","eo","eu","e","ey","ua","ue","ui","uo","u","uy","ia","ie","iu","io","iy","oa","oe","ou","oi","o","oy"],5:["turn","ter","nus","rus","tania","hiri","hines","gawa","nides","carro","rilia","stea","lia","lea","ria","nov","phus","mia","nerth","wei","ruta","tov","zuno","vis","lara","nia","liv","tera","gantu","yama","tune","ter","nus","cury","bos","pra","thea","nope","tis","clite"],6:["una","ion","iea","iri","illes","ides","agua","olla","inda","eshan","oria","ilia","erth","arth","orth","oth","illon","ichi","ov","arvis","ara","ars","yke","yria","onoe","ippe","osie","one","ore","ade","adus","urn","ypso","ora","iuq","orix","apus","ion","eon","eron","ao","omia"]},fr=[[1,2,5],[2,3,6],[3,4,5],[4,3,6],[3,4,2,5],[2,1,3,6],[3,4,2,5],[4,3,1,6],[3,4,1,4,5],[4,1,4,3,6]];function Pi(e){const t=fr[Math.floor(e()*fr.length)];let n="";for(let i=0;i<t.length;i++){const r=Yd[t[i]];n+=r[Math.floor(e()*r.length)]}return Ke(n)}const Xd={1:["a","e","i","o","u"],2:["ph","th","ch","sh","br","cr","dr","fr","gr","pr","tr","str","sc","sk","sm","sn","sp","st","sw"],3:["ae","ai","ao","au","ay","ea","ei","eo","eu","ey","ua","ue","ui","uo","uy","ia","ie","iu","io","iy","oa","oe","ou","oi","oy"],4:["morp","flux","syn","void","rift","dyn","nov","chron","lum","par","ter","psy","phan","man","grav","pyr","cry","hydr","elec","kin","nan","omni"],5:["ance","ation","esis","ergy","tide","al","ism","ity","mancy","urgy","pathy","port","shift","burst","pulse","wave","field","storm","force","blade"]},pr=[[1,2,1,4,5],[1,4,5],[2,1,4,5],[1,2,3,4,5],[3,4,5]];function kn(e){const t=pr[Math.floor(e()*pr.length)];let n="";for(let i=0;i<t.length;i++){const r=Xd[t[i]];n+=r[Math.floor(e()*r.length)]}return Ke(n)}function On(e,t){const[n,i,r]=Jd(...e),[a,l,u]=Kd(Math.floor(t()*360),i,r);return`rgb(${a*255}, ${l*255}, ${u*255})`}function Jd(e,t,n){const i=Math.max(e,t,n),r=i-Math.min(e,t,n),a=r&&(i==e?(t-n)/r:i==t?2+(n-e)/r:4+(e-t)/r);return[60*(a<0?a+6:a),i&&r/i,i]}function Kd(e,t,n){const i=(r,a=(r+e/60)%6)=>n-n*t*Math.max(Math.min(a,4-a,1),0);return[i(5),i(3),i(1)]}const gr=di();function Kr(e,t,n,i){return ji(e,function(){const r=Zd(0,n>>0,n>>32,1);for(let q=0;q<12;q++)r();const a=Pi(r),l=On([.64,.75,.55],r),u=On([.18,.2,.25],r),c=Mn(0,Pi(r)),d=ct(0),m=cn.indexOf(t);let f=r();const h=i.reduce((q,j)=>(q[j.type]=j.data,q),{});"increaseDiff"in h&&(f=f/2+.5),"decreaseDiff"in h&&(f=f/2),"relic"in h&&(f=1);const w=f+m+1,v="increaseRewards"in h?w+1:w;let b="relic"in h?m+2:Math.ceil(r()*(m+2));"increaseLength"in h&&b++;const I=[],A=$t(()=>[...I,Oe(()=>({multiplier:()=>C.isEmpowered("silver")?4:2,description:()=>(C.isEmpowered("silver")?"Empowered ":"")+Te.silver.name,enabled:()=>C.toolNodes.value.silver!=null})),Oe(()=>({multiplier:()=>(C.isEmpowered("diamond")?2:1)*Xe.filter(q=>q.bought.value).length/10,description:()=>(C.isEmpowered("diamond")?"Empowered ":"")+Te.diamond.name,enabled:()=>C.toolNodes.value.diamond!=null})),Oe(()=>({multiplier:()=>o.div(d.value,6e3).times(C.isEmpowered("emerald")?2:1),description:()=>(C.isEmpowered("emerald")?"Empowered ":"")+Te.emerald.name,enabled:()=>C.toolNodes.value.emerald!=null}))]),S=N(()=>A.apply(0)),P=[],L={};function le({feature:q,canClick:j,modifier:xe,cost:Tt,previewModifier:on,showETA:tt,previewCost:Dt}){j=ve(j),tt=ve(tt);const T=lr(q);P.push({shouldShowPreview:N(()=>s(j)&&T.value),modifier:$t(()=>{const W=I.slice();return W.splice(W.indexOf(xe),1,on),W}),cost:Dt!=null?Dt:Tt}),I.push(xe);const D=$i(c,S,()=>be(Tt)),O=Ei(q,{display:tt==null?D:()=>s(tt)?D.value:"",direction:G.Down});return{isHovering:T,eta:D,tooltip:O}}const Z=[],z=V(0);let U=g.variable(z).times(0);const qe={};let et=!0;const Y=N(()=>o.add(w,r()-.5).pow_base(2).times(10).times(U.evaluate())),Me=[];for(let q=0;q<b;q++){const j={upgrades:32,repeatables:q<=1?0:16,conversion:q<=3?0:8,xp:q<=5?0:4,dimensions:q<=7?0:2,prestige:q<=7||q>=b-1?0:1};switch(ti(j,r)){case"upgrades":const Ft=[];for(let Se=0;Se<4;Se++){const ot=ti({add:1,mult:q===0&&Se===0?0:1,pow:q===0?0:.5},r),Ze=Y.value,Je=kn(r);let it="",Ee,ye;const Ie=z.value;switch(ot){case"add":{const ue=o.add(Ze,10).pow(r()/4+.875);it=`Gain ${me(ue)} ${c.displayName}/s`,U=U.add(ue),Ee=gn(()=>({addend:ue,description:Je,enabled:Ve.bought})),ye=gn(()=>({addend:ue}));break}case"mult":{const ue=r()*5+1;it=`Multiply previous ${c.displayName} gain by x${me(ue)}.`,U=U.add(o.sub(ue,1).times(qe[Ie-1])),Ee=Oe(()=>({multiplier:ue,description:Je,enabled:Ve.bought})),ye=Oe(()=>({multiplier:ue}));break}case"pow":{const ue=r()/10+1.05;it=`Raise previous ${c.displayName} gain to the ^${me(ue)}`,U=U.add(o.pow(qe[Ie-1],ue)).sub(qe[Ie-1]),Ee=Ii(()=>({exponent:ue,description:Je,enabled:Ve.bought})),ye=Ii(()=>({exponent:ue}))}}qe[z.value]=U.evaluate(),z.value++;const je=et,Ve=dr(()=>({requirements:An(()=>({resource:Cn(c),cost:Ze})),display:{title:Je,description:it},visibility:je}));le({feature:Ve,canClick:()=>Ve.canPurchase.value,modifier:Ee,cost:Ze,showETA:()=>!Ve.bought.value,previewModifier:ye}),Ft.push(Ve)}Z.push(Ft);break;case"repeatables":const At=[];for(let Se=0;Se<3;Se++){const ot=ti({add:1.5,mult:3},r),Ze=z.value,Je=Y.value,it=kn(r);let Ee="",ye,Ie,je,Ve;const ue=g.variable(N(()=>ze.amount.value)).times(2);switch(ot){case"add":{const _e=o.add(Je,10).times(r()+.5);Ee=`Gain ${me(_e)} ${c.displayName}/s`,Ve=ue.add(1).times(Je),U=U.add(N(()=>o.sub(z.value,Ze).add(1).times(5).times(_e))),ye=N(()=>me(o.times(_e,ze.amount.value))+"/s"),Ie=gn(()=>({addend:()=>o.times(_e,ze.amount.value),description:it,enabled:()=>o.gt(ze.amount.value,0)})),je=gn(()=>({addend:()=>o.add(ze.amount.value,1).times(_e)}));break}case"mult":{const _e=r()*.75+1.25;Ee=`Multiply previous ${c.displayName} gain by x${me(_e)}.`,Ve=ue.pow_base(_e).times(Je),U=U.add(N(()=>o.sub(z.value,Ze).add(1).times(5).pow_base(_e).sub(1).times(qe[Ze-1]))),ye=N(()=>"x"+me(o.pow(_e,ze.amount.value))),Ie=Oe(()=>({multiplier:()=>o.pow(_e,ze.amount.value),description:it,enabled:()=>o.gt(ze.amount.value,0)})),je=Oe(()=>({multiplier:()=>o.add(ze.amount.value,1).pow_base(_e)}));break}}qe[z.value]=U.evaluate(),z.value++;const qt=et,ze=cr(()=>({requirements:An(()=>({resource:Cn(c),cost:Ve})),display:()=>({title:it,description:Ee,effectDisplay:s(ye)}),visibility:qt}));le({feature:ze,canClick:()=>s(ze.canClick),modifier:Ie,cost:Ve,previewModifier:je}),At.push(ze)}Z.push(At);break;case"conversion":const Ae=Mn(0,Pi(r)),Ot=On([.64,.75,.55],r),Dn=Y.value,Qr=r()/2+.25,Yi=r()/2+.25,Xi=z.value;U=U.add(N(()=>o.sub(z.value,Xi).add(1).pow_base(5).pow(Yi).times(qe[Xi-1])));const Rt=Bd(()=>({baseResource:Cn(c),gainResource:Ae,formula:Se=>Se.div(Dn).pow(Qr),spend(){c.value=0}}));qe[z.value]=U.evaluate(),z.value+=2;const ea=et,Ji=kn(r),Ni=g.variable(Ae).pow(Yi).add(1),ta=Oe(()=>({multiplier:()=>Ni.evaluate(),description:Ji,enabled:()=>o.gt(Ae.value,0)})),na=Oe(()=>({multiplier:()=>Ni.evaluate(o.add(Ae.value,Rt.actualGain.value))})),Nn=yd(()=>({display:{title:Ji,description:K(()=>p("span",null,[x("Reset "),c.displayName,x(" for")," ",ui(Ae,o.clampMin(Rt.actualGain.value,1))," ",Ae.displayName,p("br",null,null),p("div",null,[x("Next:")," ",ui(c,o.lt(Rt.actualGain.value,1)?Rt.currentAt.value:Rt.nextAt.value)," ",c.displayName])]))},style:{width:"200px",minHeight:"100px"},canClick:()=>o.gte(Rt.actualGain.value,1),prestigeResource:Ae,onClick:Rt.convert,visibility:ea})),{isHovering:ia}=le({feature:Nn,canClick:()=>s(Nn.canClick),modifier:ta,cost:Dn,previewCost:c,previewModifier:na}),Ki=N(()=>ia.value&&Nn.canClick.value);Z.push([Nn]);const ra=dn(g.variable(Ae),Ki,Rt.actualGain),aa=dn(Ni,Ki,Rt.actualGain);L[q*2]=K(()=>p(ne,null,[Le(Nn.visibility)?p("div",{style:"margin: 10px"},[x("You have")," ",p("h2",{style:{color:Ot,textShadow:`0px 0px 10px ${Ot}`}},[ra()])," ",Ae.displayName,x(","),p("br",null,null),x("providing a "),aa(),x("x multiplier to previous")," ",c.displayName,x(" gain")]):null,Si(Nn)]));break;case"xp":{const Se=Mn(0),nt=et,ot=z.value,Ze=kn(r),Je=o.add(w,r()-.5).pow_base(2).times(10),it=r()/4+1.125,Ee=r()/2+1.25,ye=g.variable(0).pow(it).times(Je),Ie=Lr(ye,Se,!0,10,o.dInf),je=N(()=>Lt(ye,Ie.value,!0,10)),Ve=N(()=>Lt(ye,o.add(Ie.value,1),!0,10)),ue=N(()=>o.pow(Ee,Ie.value)),qt=Oe(()=>({multiplier:ue,description:Ze,enabled:()=>Le(_e.visibility)}));U=U.add(N(()=>o.sub(z.value,ot).add(1).sqrt().times(3).pow(Ee).times(qe[ot-1]))),qe[z.value]=U.evaluate(),z.value+=2;const ze=On([.18,.2,.25],r),_e=qd(()=>({direction:G.Right,width:300,height:20,progress:()=>o.sub(Se.value,je.value).div(o.sub(Ve.value,je.value)).toNumber(),visibility:nt,xp:Se,display:K(()=>p("span",null,[me(Se.value),x("/"),me(Ve.value)])),fillStyle:`background-color: ${ze}`}));this.on("preUpdate",Ci=>{if(kt.value.length<b&&C.activePortals.value.some(yt=>yt.state.id===e)&&Le(_e.visibility)){const yt=o.times(ht.value,Ci);Se.value=o.add(yt,Se.value)}}),I.push(qt),Z.push([_e]),L[q*2]=K(()=>p(ne,null,[Le(_e.visibility)?p("div",{style:"margin: 10px"},[x("You have "),p("h3",null,[Ze]),x(" Lv. "),gt(Ie.value),x(","),p("br",null,null),x("providing a "),me(ue.value),x("x multiplier to previous")," ",c.displayName,x(" gain"),p("br",null,null)]):null,Si(_e)]));break}case"dimensions":{const Se=kn(r),nt=Mn(0,Se+" energy"),ot=On([.64,.75,.55],r),Ze=z.value;U=U.add(N(()=>o.sub(z.value,Ze).add(1).pow_base(32).add(1).log2().add(1).times(qe[Ze-1])));const Je=N(()=>o.add(nt.value,1).log2().add(1)),it=Oe(()=>({multiplier:Je,description:Se,enabled:()=>o.gt(nt.value,0)}));I.push(it);const Ee=et,ye=[];for(let Ie=0;Ie<4;Ie++){const je=o.add(w,r()-.5).pow_base(2).times(10).recip(),Ve=Y.value,ue=g.variable(N(()=>yt.amount.value)),qt=ue.pow_base(o.pow10(Ie+1)).times(Ve),ze=["First","Second","Third","Fourth"][Ie]+" "+Se+" Dimension",_e=Mn(0,ze),Ci=ue.sub(1).pow_base(2).times(je).times(N(()=>o.add(yt.amount.value,_e.value))),yt=cr(()=>({display:{title:ze,description:K(()=>p("div",null,[p("div",null,[x("Amount:")," ",me(o.add(_e.value,yt.amount.value))," ",x("["),gt(yt.amount.value),x("]")])])),effectDisplay:K(()=>p("span",null,[la()," ",Ie===0?nt.displayName:ye[ye.length-1].display.title,x("/s")])),showAmount:!1},style:{width:"400px"},effect:Ci,dimensions:_e,energy:Ie===0?nt:void 0,requirements:An(()=>({resource:Cn(c),cost:qt})),visibility:Ee}));ye.push(yt);const sa=lr(yt),Qi=N(()=>s(yt.canClick)&&sa.value),oa=new g({inputs:[ue],evaluate(er){return o.sub(er,1).pow_base(2).times(je).times(o.add(er,_e.value))}}),la=dn(oa,Qi);P.push({shouldShowPreview:Qi,cost:qt});const ua=$i(c,S,()=>be(qt));Ei(yt,{display:ua,direction:G.Down}),qe[z.value]=U.evaluate(),z.value++}this.on("preUpdate",Ie=>{if(kt.value.length<b&&C.activePortals.value.some(je=>je.state.id===e)&&Le(Ee)){const je=o.times(ht.value,Ie),Ve=ye[0].effect.evaluate();nt.value=o.times(Ve,je).add(nt.value);for(let ue=1;ue<4;ue++){const qt=ye[ue].effect.evaluate();ye[ue-1].dimensions.value=o.times(qt,je).add(ye[ue-1].dimensions.value)}}}),Z.push(ye),L[q*2]=K(()=>p(ne,null,[Le(Ee)?p("div",{style:"margin: 10px"},[x("You have")," ",p("h2",{style:{color:ot,textShadow:`0px 0px 10px ${ot}`}},[me(nt.value)])," ",nt.displayName,x(","),p("br",null,null),x("providing a "),me(Je.value),x("x multiplier to previous")," ",c.displayName,x(" gain")]):null,Fs(...ye)]));break}case"prestige":{const Se=kn(r),nt=et,ot=r()/2+1.25,Ze=Y.value;U=U.pow(ot);const Je=Ii(()=>({exponent:ot,description:Se,enabled:Ee.bought}));qe[z.value]=U.evaluate(),z.value++;const it=jd(()=>({thingsToReset:Z.filter((Ie,je)=>je%2===0),onReset(){c.value=0}})),Ee=dr(()=>({display:{title:Se,description:`Reset all previous ${a} content to raise all previous ${c.displayName} gain to the ^${me(ot)}`},style:{width:"200px",minHeight:"100px"},onPurchase:it.reset,visibility:nt,requirements:An(()=>({resource:Cn(c),cost:Ze}))})),ye=Oe(()=>({multiplier:0}));le({feature:Ee,canClick:()=>s(Ee.canPurchase),modifier:Je,cost:Ze,previewCost:c,previewModifier:ye,showETA:()=>!s(Ee.bought)}),Z.push([Ee]);break}}const Tt={cache:"increaseCaches"in h?10:1,generation:"increaseGens"in h?10:1,resourceMulti:"increaseResourceMults"in h?10:1,energyMulti:"increaseEnergyMults"in h?2.5:.25,influences:Object.keys(C.influenceNodes.value).length+Me.length===Object.keys(Vt).length?0:"increaseInfluences"in h?20:2,relic:0};let on=ti(Tt,r);q===b-1&&"relic"in h&&(on="relic");let tt="",Dt,T,D,O,W,oe;switch(on){case"cache":O=Ti(r,i),tt=`Gain ${me(v)}x your current ${O}.`,T=()=>{var Ae,Ot,Dn;return C.grantResource(O,o.times((Dn=(Ot=(Ae=C.resourceNodes.value[O])==null?void 0:Ae.state)==null?void 0:Ot.amount)!=null?Dn:0,v))};break;case"generation":O=Ti(r,i);const Ft=o.div(v,120).times(Mt[O]);tt=`Gain ${me(Ft)} ${O}/s while plane is active.`,Dt=Ae=>C.grantResource(O,o.times(Ae,Ft)),D=N(()=>C.resourceNodes.value[O]);break;case"resourceMulti":W=O=Ti(r,i),oe=o.div(v,17).pow_base(2),tt=`Gain ${me(oe)}x ${O} while plane is active.`;break;case"energyMulti":W="energy",oe=o.div(v,17).add(1),tt=`Gain ${me(oe)}x energy while plane is active.`;break;case"influences":const At=Object.keys(Vt)[Math.floor(r()*Object.keys(Vt).length)];Me.push(At),tt=`Gain a new portal influence (${Vt[At].display})`,T=()=>{if(At in C.influenceNodes.value){gr.warning(`Error: ignoring duplicate portal influence (${Vt[At].display})`);return}const Ae={id:Wn(C.board),position:{...C.board.types.portal.nodes.value.find(Ot=>Ot.state.id===e).position},type:"influence",state:{type:At,data:Vt[At].initialData}};C.board.placeInAvailableSpace(Ae),C.board.nodes.value.push(Ae)};break;case"relic":tt=t==="ultimatum"?"Win the game!":`Gain the ${t}-tier planar relic (${Fi[t]})`,T=()=>{if(t==="ultimatum"){Zi.value=!0;return}if(`${t}Relic`in C.toolNodes.value)gr.warning(`Error: ignoring duplicate relic (${Fi[t]})`);else{const Ae={id:Wn(C.board),position:{...C.board.types.portal.nodes.value.find(Ot=>Ot.state.id===e).position},type:"passive",state:`${t}Relic`};C.board.placeInAvailableSpace(Ae),C.board.nodes.value.push(Ae)}}}const ge=et,Zt=Y.value,It=Td(()=>({requirements:An(()=>({resource:Cn(c),cost:Zt})),visibility:ge,display:{requirement:`${me(Zt)} ${c.displayName}`,effectDisplay:tt},style:"width: 100%",classes:{final:q===b-1},update:Dt,onComplete:T,link:D,effectedResource:W,resourceMulti:oe})),Yt=$i(c,S,Zt);Ei(It,{display:()=>It.earned.value?"":Yt.value,direction:G.Down}),Z.push([It]),et=It.earned}const Xe=ai(Z,Hi);ai(Z,Jr);const st=$t(()=>[Oe(()=>({multiplier:()=>{var q,j,xe;return o.add((xe=(j=(q=C.board.types.booster.nodes.value[0])==null?void 0:q.state)==null?void 0:j.level)!=null?xe:0,1)},description:"Booster",enabled:()=>{var q,j,xe;return(xe=(j=(q=C.board.types.booster.nodes.value[0])==null?void 0:q.state)==null?void 0:j.portals.includes(e))!=null?xe:!1}}))]),ht=N(()=>st.apply(1)),[bt,Wt]=Bn(()=>[{title:`${Ke(c.displayName)} Gain`,modifier:A,base:0,unit:"/s"},{title:`${Ke(c.displayName)} Time Speed`,modifier:st,base:1,visible:()=>o.gt(ht.value,1)}]),sn=V(!1),hi=K(()=>p(Ut,{modelValue:sn.value,"onUpdate:modelValue":q=>sn.value=q},{header:()=>p("h2",null,[x("Modifiers")]),body:()=>Qe(bt)}));this.on("preUpdate",q=>{if(!C.activePortals.value.some(xe=>xe.state.id===e))return;const j=o.times(ht.value,q);d.value=o.add(d.value,j),kt.value.length<b&&(c.value=o.times(S.value,j).add(c.value)),kt.value.forEach(xe=>{var Tt;(Tt=xe.update)==null||Tt.call(xe,j)})}),Hd(this,()=>C.upgrader.value!=null&&Ne(C.upgrader.value),Xe);const Jn=N(()=>{const q=P.find(j=>j.shouldShowPreview.value);return q?o.neg(be(q.cost)):0}),Kn=N(()=>{const q=P.find(j=>j.shouldShowPreview.value);return q&&q.modifier?o.sub(q.modifier.apply(0),S.value):0}),bi=dn(g.variable(0).add(c),()=>o.neq(Jn.value,0),Jn),yi=dn(g.variable(0).add(S),()=>o.neq(Kn.value,0),Kn),wi=N(()=>{const q=[];return kt.value.forEach(j=>{j.link&&q.push(j.link)}),q}),_i=N(()=>{const q={};return kt.value.forEach(j=>{j.effectedResource!=null&&j.resourceMulti!=null&&(q[j.effectedResource]!=null?q[j.effectedResource]=o.times(q[j.effectedResource],j.resourceMulti):q[j.effectedResource]=j.resourceMulti)}),q}),kt=N(()=>{const q=[];for(let j=1;j<Z.length;j+=2){const xe=Z[j][0];xe.earned.value&&q.push(xe)}return q}),Ht=N(()=>o.lt(kt.value.length,b)&&Z.some(q=>q.some(j=>"earned"in j&&s(j.earned)||"bought"in j&&s(j.bought)?!1:("canClick"in j&&s(j.canClick)||"canPurchase"in j&&s(j.canPurchase),!0))));return{tier:ct(t),seed:ct(n),influences:ct(i),name:a,color:l,resource:c,background:u,style:{background:u,"--background":u},features:Z,resourceTabCollapsed:Wt,links:wi,resourceMultis:_i,earnedTreasures:kt,showNotif:Ht,timeActive:d,display:K(()=>p(ne,null,[p(li,{class:"nav-container",style:"z-index: 5"},{default:()=>[p("span",{class:"nav-segment"},[p("h2",null,[a])]),p("span",{class:"nav-segment"},[p("h3",null,[t,x("-tier")])]),i.length===0?null:p("span",{class:"nav-segment"},[p(Pe,{display:i.map(q=>{const j=Vt[q.type].description;return typeof j=="function"?j(q):j}).join("<br/>"),direction:G.Down,style:"width: 300px"},{default:()=>[p("h3",null,[i.length,x(" influences")])]})]),p("span",{class:"nav-segment"},[p("button",{class:"button",style:"display: inline",onClick:()=>sn.value=!0},[x("modifiers")])])]}),p(li,{class:"nav-container"},{default:()=>[p("span",{class:"nav-segment"},[p("h3",{style:`color: ${l}; text-shadow: 0px 0px 10px ${l};`},[Qe(bi)])," ",c.displayName]),p("span",{class:"nav-segment"},[x("("),p("h3",{style:`color: ${l}; text-shadow: 0px 0px 10px ${l};`},[o.gt(S.value,0)?"+":"",Qe(yi)]),x("/s)")]),o.neq(ht.value,1)?p("span",{class:"nav-segment"},[x("Speed: "),me(ht.value),x("x")]):null]}),p(Md,{height:"60px"},null),Z.map((q,j)=>j in L?Qe(L[j]):Si(...q)),Qe(hi)])),minimizedDisplay:K(()=>p("div",null,[p("span",null,[a]),p("span",{style:"font-size: large; vertical-align: sub;"},[" ",kt.value.length,x("/"),b,x(" treasures")])]))}})}function Ti(e,t){t=t.filter(u=>u.type==="increaseResources"||u.type==="decreaseResources");const n=Object.keys(Mt).reduce((u,c)=>{let d=Mt[c];return t.filter(m=>m.data===c).forEach(m=>{m.type==="increaseResources"?d*=1e3:d/=1e3}),u+d},0),i=Object.keys(Mt),r=Math.floor(e()*n);let a=0,l;for(let u=0;u<i.length;u++){const c=i[u];if(a+=Mt[c],r<a){l=c;break}}return l}function ti(e,t){const n=Object.values(e).reduce((u,c)=>u+c),i=Object.keys(e);let r=0,a=null;const l=t()*n;for(let u=0;u<i.length;u++){const c=i[u];if(r+=e[c],l<r){a=c;break}}if(a==null)throw new Error("Failed to pick random. This should not happen");return a}const Qd={shape:Ge.Diamond,size:50,title:"\u{1FAA8}",label:e=>e===C.board.selectedNode.value?{text:"Mining"}:Object.keys(C.resourceNodes.value).length===0?{text:"Click me!"}:null,actionDistance:Math.PI/4,actions:[an],progress:e=>Ne(e)?new o(e.state.progress).toNumber():0,progressDisplay:hn.Outline,progressColor:"var(--accent2)",classes:e=>({running:Ne(e)}),draggable:!0},ef={shape:Ge.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>e===C.board.selectedNode.value?{text:"Broken Forge"}:null,actionDistance:Math.PI/4,actions:[{id:"repair",icon:"build",tooltip:{text:"Repair - 100 energy"},onClick(e){o.gte(C.energy.value,100)&&(e.type="factory",C.energy.value=o.sub(C.energy.value,100))},confirmationLabel:()=>o.gte(C.energy.value,1e3)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}}],draggable:!0},tf={shape:Ge.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>{var t,n;if(e===C.board.selectedNode.value)return{text:e.state==null?"Forge - Drag a resource to me!":`Forging ${Te[e.state].name}`};if(((t=C.board.draggingNode.value)==null?void 0:t.type)==="resource"){const i=((n=C.board.draggingNode.value)==null?void 0:n.state).type,r=e.state===i?"Disconnect":Te[i].name,a=e.state===i||o.gte(C.energy.value,Te[i].cost)&&C.toolNodes.value[i]==null?"var(--accent2)":"var(--danger)";return{text:r,color:a}}return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect resource"},onClick(e){e.state=void 0,C.board.selectedAction.value=null,C.board.selectedNode.value=null},visibility:e=>e.state!=null},{id:"craft",icon:"done",tooltip:e=>({text:`Forge ${Te[e.state].name} - ${Ye(Te[e.state].cost)} energy`}),onClick(e){const t=Te[e.state];if(o.gte(C.energy.value,t.cost)&&C.toolNodes.value[e.state]==null){C.energy.value=o.sub(C.energy.value,t.cost);const n={id:Wn(C.board),position:{...e.position},type:t.type,state:"state"in t?t.state:void 0};C.board.placeInAvailableSpace(n),C.board.nodes.value.push(n),C.board.selectedAction.value=null,C.board.selectedNode.value=null,e.state=void 0}},fillColor:e=>o.gte(C.energy.value,Te[e.state].cost)&&C.toolNodes.value[e.state]==null?"var(--accent2)":"var(--danger)",visibility:e=>e.state!=null,confirmationLabel:e=>o.gte(C.energy.value,Te[e.state].cost)?C.toolNodes.value[e.state]==null?{text:"Tap again to confirm"}:{text:"Already crafted",color:"var(--danger)"}:{text:"Cannot afford",color:"var(--danger)"}}],progress:e=>e.state==null||C.toolNodes.value[e.state]!=null?0:o.div(C.energy.value,Te[e.state].cost).clampMax(1).toNumber(),progressDisplay:hn.Fill,progressColor:e=>e.state!=null&&o.gte(C.energy.value,Te[e.state].cost)?"var(--accent2)":"var(--foreground)",canAccept(e,t){return t.type==="resource"},onDrop(e,t){const n=t.state.type;e.state===n?e.state=void 0:e.state=n,C.board.selectedNode.value=e},draggable:!0},nf={shape:Ge.Circle,size:50,title:e=>Ke(e.state.type),subtitle:e=>Ye(e.state.amount),progress:e=>cd(e.state.type),onClick(){},progressDisplay:hn.Outline,progressColor:"var(--accent3)",classes:e=>{var t;return{"affected-node":C.dowsing.value!=null&&Ne(C.dowsing.value)&&C.dowsing.value.state.resources.includes(e.state.type)||o.neq((t=C.planarMultis.value[e.state.type])!=null?t:1,1)}},draggable:!0},rf={shape:Ge.Circle,size:50,title:e=>Te[e.state].name,label:e=>e===C.board.selectedNode.value?{text:kd[e.state].description(lt(e.state))}:null,outlineColor:"var(--bought)",classes:e=>({"affected-node":lt(e.state)}),draggable:!0},af={shape:Ge.Diamond,size:50,title:"\u{1F962}",label:e=>e===C.board.selectedNode.value?{text:e.state.resources.length===0?"Dowsing - Drag a resource to me!":`Dowsing (${e.state.resources.length}/${o.add(e.state.maxConnections,C.computedBonusConnectionsModifier.value)})`}:jr(e,t=>`Double ${t} odds`),actionDistance:Math.PI/4,actions:[pi,Hn(e=>e.add(2).pow_base(100),16),an],classes:e=>({running:Ne(e)}),canAccept:Ur,onDrop:Gr,draggable:!0},sf={shape:Ge.Diamond,size:50,title:"\u26CF\uFE0F",label:e=>e===C.board.selectedNode.value?{text:e.state.resources.length===0?"Quarry - Drag a resource to me!":`Quarrying (${e.state.resources.length}/${o.add(e.state.maxConnections,C.computedBonusConnectionsModifier.value)})`}:jr(e,t=>`Gather ${pt(o.div(C.dropRates[t].computedModifier.value,100))} ${t}/s`),actionDistance:Math.PI/4,actions:[pi,Hn(e=>e.add(2).pow_base(1e4),16),an],progress:e=>Ne(e)?o.eq(C.quarryProgressRequired.value,0)?0:new o(e.state.progress).div(C.quarryProgressRequired.value).toNumber():0,progressDisplay:hn.Outline,progressColor:"var(--accent2)",canAccept:Ur,onDrop:Gr,classes:e=>({running:Ne(e)}),draggable:!0},of={shape:Ge.Diamond,size:50,title:"\u{1F50C}",label:e=>e===C.board.selectedNode.value?{text:e.state.tools.length===0?"Empowerer - Drag a tool to me!":`Empowering (${e.state.tools.length}/${o.add(e.state.maxConnections,C.computedBonusConnectionsModifier.value)})`}:od(e,t=>t.includes("Relic")?`Double ${Fi[t.slice(0,-5)]}'s effect`:`Double ${Te[t].name}'s effect`),actionDistance:Math.PI/4,actions:[pi,Hn(e=>e.add(3).pow_base(1e3),16),an],canAccept:ld,onDrop:ud,classes:e=>({running:Ne(e)}),draggable:!0},lf={shape:Ge.Diamond,size:50,title:"\u26E9\uFE0F",label:e=>{if(e===C.board.selectedNode.value)return{text:e.state.tier==null?"Portal Spawner - Drag a resource to me!":`Spawning ${e.state.tier}-tier portal`};const t=C.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type;return{text:e.state.tier===n?"Disconnect":`${Ke(n)}-tier Portal`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="influence"){const n=t.state.type,{influences:i}=e.state;return i.includes(n)?{text:"Disconnect",color:"var(--accent2)"}:{text:"Add influence",color:"var(--accent2)"}}return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect all"},onClick(e){e.state={...e.state,tier:void 0,influences:[]},C.board.selectedAction.value=null,C.board.selectedNode.value=null},visibility:e=>{const{tier:t,influences:n}=e.state;return t!=null||n.length>0}},{id:"makePortal",icon:"done",tooltip:e=>({text:`Spawn ${e.state.tier}-tier portal`}),onClick(e){let t=0;for(;`portal-${t}`in we;)t++;const{tier:n,influences:i}=e.state;zi(Kr(`portal-${t}`,n,Math.floor(Math.random()*4294967296),i.map(a=>C.influenceNodes.value[a].state)),Q);const r={id:Wn(C.board),position:{...e.position},type:"portal",state:{id:`portal-${t}`,powered:!1}};C.board.placeInAvailableSpace(r),C.board.nodes.value.push(r),C.board.selectedAction.value=null,C.board.selectedNode.value=null,e.state={tier:void 0,influences:[]}},visibility:e=>e.state.tier!=null}],canAccept(e,t){return t.type==="resource"||t.type==="influence"},onDrop(e,t){if(t.type==="resource"){const n=t.state.type,i=e.state.tier;e.state={...e.state,tier:n===i?void 0:n}}else if(t.type==="influence"){const n=t.state.type,i=e.state.influences;i.includes(n)?e.state={...e.state,influences:i.filter(r=>r!==n)}:e.state={...e.state,influences:[...i,n]}}C.board.selectedNode.value=e},draggable:!0},uf={shape:Ge.Diamond,size:50,title:"\u{1F300}",label:e=>e===C.board.selectedNode.value?{text:`Portal to ${we[e.state.id].name}`,color:we[e.state.id].color}:null,actionDistance:Math.PI/4,actions:[an],classes:e=>({running:Ne(e),showNotif:we[e.state.id].showNotif.value,"affected-node":C.booster.value!=null&&Ne(C.booster.value)&&C.booster.value.state.portals.includes(e.state.id)}),outlineColor:e=>we[e.state.id].background,draggable:!0},cf={shape:e=>e.state.type==="increaseResources"||e.state.type==="decreaseResources"?Ge.Diamond:Ge.Circle,size:50,title:e=>Vt[e.state.type].display,label:e=>{if(e===C.board.selectedNode.value){const n=e.state,i=Vt[n.type].description;return{text:typeof i=="function"?i(n):i}}const t=C.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type,{type:i,data:r}=e.state;let a;if(Array.isArray(r)&&r.includes(n))a="Disconnect";else if(i==="increaseResources")a=`Increase ${Ke(n)} odds`;else if(i==="decreaseResources")a=`Decrease ${Ke(n)} odds`;else return null;return{text:a,color:"var(--accent2)"}}return null},actionDistance:Math.PI/4,actions:[pi],canAccept:(e,t)=>t.type!=="resource"?!1:Array.isArray(e.state.data),onDrop:(e,t)=>{if(t.type!=="resource")return;const n=t.state.type,i=e.state.data;i!=null&&(i.includes(n)?e.state={...e.state,data:i.filter(r=>r!==n)}:e.state={...e.state,data:[...i,n]},C.board.selectedNode.value=e)},outlineColor:"var(--danger)",draggable:!0},df={shape:Ge.Diamond,size:50,title:"\u231B",label:e=>e===C.board.selectedNode.value?{text:e.state.portals.length===0?"Booster - Drag a portal to me!":`Boosting by ${Ye(o.add(1,e.state.level))}x (${e.state.portals.length}/${o.add(e.state.maxConnections,C.computedBonusConnectionsModifier.value)})`}:zr(e,t=>`Boost ${we[t].name}'s speed`),actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect portals"},onClick(e){e.state={...e.state,portals:[]},C.board.selectedAction.value=null,C.board.selectedNode.value=null},visibility:e=>{var t,n;return(n=(t=e.state)==null?void 0:t.portals.length)!=null?n:0>0}},Hn(e=>e.add(6).pow_base(1e3)),{id:"increaseBoost",icon:"arrow_upward",tooltip(e){return{text:`Increase boost - ${Ye(xi.evaluate(e.state.level))} energy`}},confirmationLabel(e){return o.gte(C.energy.value,xi.evaluate(e.state.level))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}},onClick(e){const t=xi.evaluate(e.state.level);o.gte(C.energy.value,t)&&(C.energy.value=o.sub(C.energy.value,t)),e.state={...e.state,level:o.add(e.state.level,1)},C.board.selectedAction.value=null}},an],canAccept:Wr,onDrop:Hr,classes:e=>({running:Ne(e)}),draggable:!0},ff={shape:Ge.Diamond,size:50,title:"\u{1F916}",label:e=>e===C.board.selectedNode.value?{text:e.state.portals.length===0?"Upgrader - Drag a portal to me!":`Auto-Upgrading (${e.state.portals.length}/${o.add(e.state.maxConnections,C.computedBonusConnectionsModifier.value)})`}:zr(e,t=>`Auto-buy ${we[t].name}'s upgrades`),actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect portals"},onClick(e){e.state={...e.state,portals:[]},C.board.selectedAction.value=null,C.board.selectedNode.value=null},visibility:e=>{var t,n;return(n=(t=e.state)==null?void 0:t.portals.length)!=null?n:0>0}},Hn(e=>e.add(4).pow_base(1e6)),an],canAccept:Wr,onDrop:Hr,classes:e=>({running:Ne(e)}),draggable:!0},mr=di(),pf={mine:Qd,brokenFactory:ef,factory:tf,resource:nf,passive:rf,dowsing:af,quarry:sf,empowerer:of,portalGenerator:lf,portal:uf,influence:cf,booster:df,upgrader:ff},C=ji("main",function(){const e=Mn(0,"energy"),t=N(()=>m.types.resource.nodes.value.reduce((T,D)=>(T[D.state.type]=D,T),{})),n=N(()=>({...m.types.passive.nodes.value.reduce((T,D)=>(T[D.state]=D,T),{}),sand:m.types.dowsing.nodes.value[0],wood:m.types.quarry.nodes.value[0],coal:m.types.empowerer.nodes.value[0],iron:m.types.portalGenerator.nodes.value[0],gold:m.types.booster.nodes.value[0],platinum:m.types.upgrader.nodes.value[0]})),i=N(()=>({...m.types.influence.nodes.value.reduce((T,D)=>(T[D.state.type]=D,T),{})})),r=N(()=>cn.reduce((T,D)=>{var ge,Zt,It;const O=(It=(Zt=(ge=t.value[D])==null?void 0:ge.state)==null?void 0:Zt.amount)!=null?It:0;let W=o.floor(Ln.invertIntegral(O)).sub(10).clampMin(0),oe=Lt(Ln,W,!0,0);for(;;){const Yt=Ln.evaluate(W);if(o.add(oe,Yt).lte(O))W=W.add(1),oe=o.add(oe,Yt);else break}return T[D]=W,T},{})),a=vn({}),l=vn({});jt(()=>{cn.forEach(T=>{dt(()=>r.value[T],(D,O)=>{o.gt(D,O)&&re.active===Q.id&&o.lte(D,100)&&mr.info(p("div",null,[p("h3",null,[o.eq(D,1)?`${Ke(T)} discovered`:`${Ke(T)} is now Level ${gt(D)}`,x("!")]),p("div",null,[x("Energy gain is now 1.01x higher.")])]))})})});const u=N(()=>P.filter(T=>{var D,O;return(O=(D=T.value)==null?void 0:D.state)==null?void 0:O.powered}).length+m.types.portal.nodes.value.filter(T=>T.state.powered).length),c=N(()=>o.eq(u.value,0)?10:o.add(u.value,1).pow_base(100).div(10).times(.99)),d=N(()=>v.value==null?0:v.value.state.resources.reduce((D,O)=>o.div(100,Wt[O].computedModifier.value).add(D),o.dZero)),m=ku(T=>({startNodes:()=>[{position:{x:0,y:0},type:"mine",state:{progress:0,powered:!1}},{position:{x:0,y:-200},type:"brokenFactory"}],types:pf,style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden"},links(){const D=[];if(D.push(...Object.keys(a).map(O=>({startNode:f.value,endNode:t.value[O],stroke:"var(--accent3)",strokeWidth:5}))),h.value!=null&&h.value.state!=null&&D.push({startNode:h.value,endNode:t.value[h.value.state],stroke:"var(--foreground)",strokeWidth:4}),w.value!=null&&w.value.state.resources.forEach(O=>{D.push({startNode:w.value,endNode:t.value[O],stroke:Ne(w.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),v.value!=null&&v.value.state.resources.forEach(O=>{D.push({startNode:v.value,endNode:t.value[O],stroke:"var(--foreground)",strokeWidth:4})}),D.push(...Object.keys(l).map(O=>({startNode:v.value,endNode:t.value[O],stroke:"var(--accent3)",strokeWidth:5}))),b.value!=null&&b.value.state.tools.forEach(O=>{D.push({startNode:b.value,endNode:n.value[O],stroke:Ne(b.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),I.value!=null){const O=I.value.state;O.tier!=null&&D.push({startNode:I.value,endNode:t.value[O.tier],stroke:"var(--foreground)",strokeWidth:4}),O.influences.forEach(W=>{D.push({startNode:I.value,endNode:i.value[W],stroke:"var(--foreground)",strokeWidth:4})}),T.types.portal.nodes.value.forEach(W=>{const oe=we[W.state.id];return oe.links.value.forEach(ge=>{ge.value!=null&&D.push({startNode:W,endNode:ge.value,stroke:Ne(W)?"var(--accent3)":"var(--foreground)",strokeWidth:4})}),Object.keys(oe.resourceMultis.value).forEach(ge=>{ge!=="energy"&&ge in t.value&&D.push({startNode:W,endNode:t.value[ge],stroke:Ne(W)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),D})}return A.value!=null&&A.value.state.portals.forEach(O=>{D.push({startNode:A.value,endNode:T.types.portal.nodes.value.find(W=>W.state.id===O),stroke:Ne(A.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),S.value!=null&&S.value.state.portals.forEach(O=>{D.push({startNode:S.value,endNode:T.types.portal.nodes.value.find(W=>W.state.id===O),stroke:"var(--foreground)",strokeWidth:4})}),Object.values(i.value).forEach(O=>{const W=O.state;(W.type==="increaseResources"||W.type==="decreaseResources")&&W.data.forEach(oe=>{D.push({startNode:O,endNode:t.value[oe],stroke:"var(--foreground)",strokeWidth:4})})}),D}})),f=N(()=>m.types.mine.nodes.value[0]),h=N(()=>m.types.factory.nodes.value[0]),w=N(()=>n.value.sand),v=N(()=>n.value.wood),b=N(()=>n.value.coal),I=N(()=>n.value.iron),A=N(()=>n.value.gold),S=N(()=>n.value.platinum),P=[f,w,v,b,A,S];function L(T,D){let O=t.value[T];if(D=o.times(D,sn[T].computedModifier.value),O==null)O={id:Wn(m),position:{...f.value.position},type:"resource",state:{type:T,amount:D}},m.placeInAvailableSpace(O),m.nodes.value.push(O);else{const W=O.state;O.state={...W,amount:o.add(W.amount,D)}}}const le=N(()=>Object.keys(Mt).reduce((T,D)=>T+new o(Wt[D].computedModifier.value).toNumber(),0)),Z=N(()=>{const T={};return m.types.portal.nodes.value.forEach(D=>{if(!Ne(D))return;const W=we[D.state.id].resourceMultis.value;Object.keys(W).forEach(oe=>{T[oe]!=null?T[oe]=o.times(T[oe],W[oe]):T[oe]=W[oe]})}),T}),z=$t(()=>[...cn.map(T=>Oe(()=>({description:()=>`${Ke(T)} (Lv. ${gt(r.value[T])}) (${me(bt.value)}x per level)`,multiplier:()=>o.pow(bt.value,r.value[T]),enabled:()=>{var D,O;return T in t.value&&o.gt((O=(D=t.value[T].state)==null?void 0:D.amount)!=null?O:0,0)}}))),Oe(()=>({multiplier:()=>lt("stone")?4:2,description:()=>(lt("stone")?"Empowered ":"")+Te.stone.name,enabled:()=>n.value.stone!=null})),Oe(()=>({multiplier:()=>{var T;return(T=Z.value.energy)!=null?T:1},description:"Planar Treasures",enabled:()=>{var T;return o.neq((T=Z.value.energy)!=null?T:1,1)}})),gn(()=>({addend:()=>o.pow(100,u.value).div(10).neg(),description:"Powered Machines (100^n/10 energy/s)",enabled:()=>o.gt(u.value,0)}))]),U=N(()=>z.apply(1)),qe=$t(()=>[gn(()=>({addend:()=>lt("unobtainium")?2:1,description:()=>(lt("unobtainium")?"Empowered ":"")+Te.unobtainium.name,enabled:()=>n.value.unobtainium!=null}))]),et=N(()=>qe.apply(0)),Y=$t(()=>[Oe(()=>({multiplier:()=>lt("dirt")?4:2,description:()=>(lt("dirt")?"Empowered ":"")+Te.dirt.name,enabled:()=>n.value.dirt!=null}))]),Me=N(()=>Y.apply(1)),Xe=$t(()=>[Oe(()=>({multiplier:()=>lt("gravel")?4:2,description:()=>(lt("gravel")?"Empowered ":"")+Te.gravel.name,enabled:()=>n.value.gravel!=null}))]),st=N(()=>Xe.apply(1)),ht=$t(()=>[gn(()=>({addend:()=>lt("copper")?.002:.001,description:()=>(lt("copper")?"Empowered ":"")+Te.copper.name,enabled:()=>n.value.copper!=null}))]),bt=N(()=>ht.apply(1.01)),Wt=Object.keys(Mt).reduce((T,D)=>{const O=$t(()=>[Oe(()=>({multiplier:2,description:"Dowsing",enabled:()=>w.value!=null&&Ne(w.value)&&w.value.state.resources.includes(D)}))]),W=N(()=>O.apply(Mt[D])),oe={title:`${Ke(D)} Drop Rate`,modifier:O,base:Mt[D]};return T[D]={modifier:O,computedModifier:W,section:oe},T},{}),sn=Object.keys(Mt).reduce((T,D)=>{const O=$t(()=>[Oe(()=>({multiplier:()=>{var ge;return(ge=Z.value[D])!=null?ge:1},description:"Planar Treasures",enabled:()=>{var ge;return o.neq((ge=Z.value[D])!=null?ge:1,1)}}))]),W=N(()=>O.apply(1)),oe={title:`${Ke(D)} Gain`,modifier:O};return T[D]={modifier:O,computedModifier:W,section:oe},T},{}),[hi,Jn]=Bn(()=>[{title:"Energy Gain",modifier:z,base:1,unit:"/s"},{title:"Bonus Connections",modifier:qe,base:0}]),[Kn,bi]=Bn(()=>[{title:"Mining Speed",modifier:Y,base:1,unit:"/s",visible:()=>n.value.dirt!=null},{title:"Ore Dropped",modifier:Xe,base:1,visible:()=>n.value.gravel!=null},{title:"Material Level Effect",modifier:ht,base:1.01,visible:()=>n.value.copper!=null}]),[yi,wi]=Bn(()=>Object.values(Wt).map(T=>T.section)),[_i,kt]=Bn(()=>Object.values(sn).map(T=>T.section)),Ht=Du({general:()=>({display:"General",glowColor(){return Ht.activeTab.value===this.tab?"white":""},tab:hi,energyTabCollapsed:Jn}),mining:()=>({display:"Mine",glowColor(){return Ht.activeTab.value===this.tab?"white":""},visibility:()=>Object.keys(n.value).length>0,tab:Kn,miningTabCollapsed:bi}),resources:()=>({display:"Mine Rates",glowColor(){return Ht.activeTab.value===this.tab?"white":""},visibility:()=>w.value!=null,tab:yi,resourcesCollapsed:wi}),resourcesGain:()=>({display:"Resource Gain",glowColor(){return Ht.activeTab.value===this.tab?"white":""},visibility:()=>Object.values(sn).some(T=>o.neq(T.computedModifier.value,1)),tab:_i,resourceGainCollapsed:kt})}),q=V(!1),j=K(()=>p(Ut,{modelValue:q.value,"onUpdate:modelValue":T=>q.value=T},{header:()=>p("h2",null,[x("Modifiers")]),body:()=>Qe(Ht)}));this.on("preUpdate",T=>{if(Object.keys(a).forEach(D=>{a[D]-=T,a[D]<=0&&delete a[D]}),Object.keys(l).forEach(D=>{l[D]-=T,l[D]<=0&&delete l[D]}),Ne(f.value)){const D=o.add(f.value.state.progress,o.times(Me.value,T)),O=D.floor();f.value.state={...f.value.state,progress:o.sub(D,O)};const W=O.div(le.value).floor();W.gt(0)&&cn.forEach(ge=>{L(ge,o.times(new o(Wt[ge].computedModifier.value).toNumber(),W).times(st.value)),a[ge]=.3});const oe=o.sub(O,W).toNumber();for(let ge=0;ge<oe;ge++){const Zt=Math.floor(Math.random()*le.value);let It=0;for(let Yt=0;Yt<cn.length;Yt++){const Ft=cn[Yt];if(It+=new o(Wt[Ft].computedModifier.value).toNumber(),Zt<It){L(Ft,st.value),a[Ft]=.3;break}}}}if(v.value!=null&&Ne(v.value)){const{progress:D,resources:O}=v.value.state;if(O.length>0){let W=o.add(D,T);const oe=o.div(D,d.value).floor();W=o.sub(W,o.times(oe,d.value)),v.value.state={...v.value.state,progress:W},o.gt(oe,0)&&O.forEach(ge=>{L(ge,oe),l[ge]=.3})}}e.value=o.add(e.value,o.times(U.value,T)),o.lt(e.value,0)&&(e.value=0,f.value.state={...f.value.state,powered:!1},mr.warning(p("div",null,[p("h3",null,[x("Ran out of energy!")]),p("div",null,[x("All machines have been turned off.")])])))});const xe=N(()=>{var T,D;return m.selectedAction.value===m.types.brokenFactory.actions[0]?-100:m.selectedAction.value===m.types.factory.actions[1]?o.neg(Te[m.selectedNode.value.state].cost):((T=m.selectedAction.value)==null?void 0:T.id)==="moreConnections"?o.neg(m.selectedAction.value.formula.evaluate(((D=m.selectedNode.value)==null?void 0:D.state).maxConnections)):0}),Tt=dn(g.variable(0).add(e),()=>o.neq(xe.value,0),xe),on=N(()=>{var T;return m.selectedAction.value===an?((T=m.selectedNode.value)==null?void 0:T.state).powered?o.eq(u.value,1)?10:o.pow(100,u.value).div(10).times(.99):o.neg(c.value):0}),tt=dn(g.variable(0).add(U),()=>o.neq(on.value,0),on),Dt=N(()=>m.types.portal.nodes.value.filter(T=>Ne(T)));return dt(Dt,T=>{jt(()=>{Q.tabs=["main",...T.map(D=>D.state.id)]})}),dt(et,(T,D)=>{o.lt(T,D)&&(Fn(T,w,"resources"),Fn(T,v,"resources"),Fn(T,b,"tools"),Fn(T,A,"portals"),Fn(T,S,"portals"))}),{name:"World",board:m,energy:e,modifierTabs:Ht,resourceNodes:t,toolNodes:n,influenceNodes:i,grantResource:L,activePortals:Dt,isEmpowered:lt,nextPowerCost:c,computedBonusConnectionsModifier:et,quarryProgressRequired:d,dropRates:Wt,dowsing:w,empowerer:b,booster:A,upgrader:S,resourceLevels:r,planarMultis:Z,display:K(()=>p(ne,null,[p(li,{class:"nav-container"},{default:()=>[p("span",{class:"nav-segment"},[p("h2",{style:"color: white; text-shadow: 0px 0px 10px white;"},[Qe(Tt)])," ",x("energy")]),p("span",{class:"nav-segment"},[x("("),p("h3",{style:"color: white; text-shadow: 0px 0px 10px white;"},[o.gt(U.value,0)?"+":"",Qe(tt)]),x("/s)")]),o.gt(u.value,0)?p("span",{class:"nav-segment"},[p("h3",{style:"color: var(--accent1); text-shadow: 0px 0px 10px var(--accent1);"},[gt(u.value)])," ",x("machines powered")]):null,p("span",{class:"nav-segment"},[p("button",{class:"button",style:"display: inline",onClick:()=>q.value=!0},[x("modifiers")])]),Q.devSpeed===0?p("span",{class:"nav-segment"},[x("Game Paused")]):Q.devSpeed!=null&&Q.devSpeed!==1?p("span",{class:"nav-segment"},[x("Dev Speed: "),me(Q.devSpeed),x("x")]):null]}),Qe(m),Qe(j)]))}}),gf=e=>{var i,r,a,l,u;const t=[C];let n=0;for(;`portal-${n}`in((i=e.layers)!=null?i:{});){const c=(r=e.layers)==null?void 0:r[`portal-${n}`];t.push(Kr(`portal-${n}`,(a=c.tier)!=null?a:"dirt",(l=c.seed)!=null?l:Math.floor(Math.random()*4294967296),(u=c.influences)!=null?u:[])),n++}return t},Zi=V(!1);function mf(e,t){}var vf=Object.freeze(Object.defineProperty({__proto__:null,main:C,getInitialLayers:gf,hasWon:Zi,fixOldSave:mf},Symbol.toStringTag,{value:"Module"}));const Xn=e=>(bn("data-v-4a50ce42"),e=e(),yn(),e),hf={class:"game-over-modal-header"},bf=["src","alt"],yf={class:"game-over-modal-title"},wf=Xn(()=>_("h2",null,"Congratulations!",-1)),_f={key:0},Nf=Xn(()=>_("br",null,null,-1)),Cf=Xn(()=>_("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),kf=Xn(()=>_("br",null,null,-1)),Mf=["href"],Sf=Xn(()=>_("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),If=J({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:i,discordLink:r,versionNumber:a,versionTitle:l}=fe,u=N(()=>fi(Q.timePlayed)),c=N(()=>Zi.value&&!Q.keepGoing),d=tn(Q,"autosave");function m(){Q.keepGoing=!0}function f(){fn(In())}return(h,w)=>(M(),ee(Ut,{"model-value":s(c)},{header:H(()=>[_("div",hf,[s(n)?(M(),E("img",{key:0,class:"game-over-modal-logo",src:s(n),alt:s(t)},null,8,bf)):B("",!0),_("div",yf,[wf,_("h4",null,"You've beaten "+ae(s(t))+" v"+ae(s(a))+": "+ae(s(l)),1)])])]),body:H(({shown:v})=>[v?(M(),E("div",_f,[_("div",null,"It took you "+ae(s(u))+" to beat the game.",1),Nf,Cf,kf,_("div",null,[_("a",{href:s(r),class:"game-over-modal-discord-link"},[Sf,x(" "+ae(s(i)),1)],8,Mf)]),p(Bt,{title:"Autosave",modelValue:s(d),"onUpdate:modelValue":w[0]||(w[0]=b=>De(d)?d.value=b:null)},null,8,["modelValue"])])):B("",!0)]),footer:H(()=>[_("div",{class:"game-over-footer"},[_("button",{onClick:m,class:"button"},"Keep Going"),_("button",{onClick:f,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var $f=ce(If,[["__scopeId","data-v-4a50ce42"]]);const vi=e=>(bn("data-v-2776d67d"),e=e(),yn(),e),xf=vi(()=>_("div",{class:"nan-modal-header"},[_("h2",null,"NaN value detected!")],-1)),Ef={key:0},Pf=vi(()=>_("br",null,null,-1)),Tf=["href"],Df=vi(()=>_("span",{class:"material-icons nan-modal-discord"},"discord",-1)),Ff=vi(()=>_("br",null,null,-1)),Af={class:"nan-footer"},Of=J({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=fe,i=V(!0),r=V(!0),a=tn(Be,"hasNaN"),l=V(null);dt(a,h=>{h?(i.value=Q.autosave,r.value=Q.devSpeed===0):(Q.autosave=i.value,Q.devSpeed=r.value?0:null)});const u=N(()=>{var h;return(h=Be.NaNPath)==null?void 0:h.join(".")}),c=N(()=>Be.NaNPersistent!=null?Be.NaNPersistent.value:null);function d(){Be.NaNPersistent!=null&&(Be.NaNPersistent.value=new o(0),Be.hasNaN=!1)}function m(){Be.NaNPersistent&&(Be.NaNPersistent.value=new o(1),Be.hasNaN=!1)}function f(){Be.NaNPersistent&&(Be.NaNPersistent.value=new o(NaN),Be.hasNaN=!1)}return(h,w)=>(M(),E(ne,null,[p(Ut,zt({modelValue:s(a),"onUpdate:modelValue":w[4]||(w[4]=v=>De(a)?a.value=v:null)},h.$attrs),{header:H(()=>[xf]),body:H(()=>[_("div",null,[x(' Attempted to assign "'+ae(s(u))+'" to NaN',1),s(c)?(M(),E("span",Ef,ae(" ")+"(previously "+ae(s(me)(s(c)))+")",1)):B("",!0),x(". Auto-saving has been "+ae(i.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),Pf,_("div",null,[_("a",{href:s(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[Df,x(" "+ae(s(t)||"The Paper Pilot Community"),1)],8,Tf)]),Ff,p(Bt,{title:"Autosave",modelValue:i.value,"onUpdate:modelValue":w[0]||(w[0]=v=>i.value=v)},null,8,["modelValue"]),s(fe).enablePausing?(M(),ee(Bt,{key:0,title:"Pause game",modelValue:r.value,"onUpdate:modelValue":w[1]||(w[1]=v=>r.value=v)},null,8,["modelValue"])):B("",!0)]),footer:H(()=>[_("div",Af,[_("button",{onClick:w[2]||(w[2]=v=>{var b;return(b=l.value)==null?void 0:b.open()}),class:"button"},"Open Saves Manager"),_("button",{onClick:d,class:"button"},"Set to 0"),_("button",{onClick:m,class:"button"},"Set to 1"),s(c)&&s(o).neq(s(c),0)&&s(o).neq(s(c),1)?(M(),E("button",{key:0,onClick:w[3]||(w[3]=v=>a.value=!1),class:"button"}," Set to previous ")):B("",!0),_("button",{onClick:f,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),p(Or,{ref_key:"savesManager",ref:l},null,512)],64))}});var Rf=ce(Of,[["__scopeId","data-v-2776d67d"]]);const qf={key:0,class:"tpsDisplay"},Vf={key:0,class:"low"},Bf=J({__name:"TPS",setup(e){const t=N(()=>o.div(Be.lastTenTicks.length,Be.lastTenTicks.reduce((a,l)=>a+l,0))),n=V([]);_t(()=>{n.value.push(Math.round(t.value.toNumber())),n.value.length>10&&(n.value=n.value.slice(1))});const i=N(()=>n.value.reduce((a,l)=>o.max(a,l),0)),r=N(()=>o.sub(t.value,i.value).gt(1));return(a,l)=>s(t).isNan()?B("",!0):(M(),E("div",qf,[x(" TPS: "+ae(s(gt)(s(t)))+" ",1),p(xn,{name:"fade"},{default:H(()=>[s(r)?(M(),E("span",Vf,ae(s(gt)(s(i))),1)):B("",!0)]),_:1})]))}});var Lf=ce(Bf,[["__scopeId","data-v-46a3ed5b"]]);var jf=J({__name:"App",setup(e){const t=fe.useHeader,n=N(()=>wt[re.theme].variables),i=tn(re,"showTPS"),r=N(()=>se(K(()=>p(ne,null,[xs.map(Qe)]))));return(a,l)=>(M(),E(ne,null,[_("div",{id:"modal-root",style:Re(s(n))},null,4),_("div",{class:pe(["app",{useHeader:s(t)}]),style:Re(s(n))},[s(t)?(M(),ee(Rr,{key:0})):B("",!0),p(Wl),s(s(i))?(M(),ee(Lf,{key:1})):B("",!0),p($f),p(Rf),(M(),ee(Ue(s(r))))],6)],64))}});var zf=ce(jf,[["__scopeId","data-v-41d15e5e"]]);function Uf(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:l}=e;let u,c,d,m;const f=async(w=!0)=>{await d,w&&(u==null||u.addEventListener("controlling",v=>{v.isUpdate&&window.location.reload()})),await(m==null?void 0:m())};async function h(){if("serviceWorker"in navigator){const{Workbox:w,messageSW:v}=await jn(()=>import("./workbox-window.4a8794bb.js"),[]);m=async()=>{c&&c.waiting&&await v(c.waiting,{type:"SKIP_WAITING"})},u=new w("./sw.js",{scope:"./",type:"classic"}),u.addEventListener("activated",b=>{b.isUpdate||i==null||i()});{const b=()=>{n==null||n()};u.addEventListener("waiting",b),u.addEventListener("externalwaiting",b)}u.register({immediate:t}).then(b=>{c=b,a?a("./sw.js",b):r==null||r(b)}).catch(b=>{l==null||l(b)})}}return d=h(),f}function Gf(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:l}=e,u=V(!1),c=V(!1);return{updateServiceWorker:Uf({immediate:t,onNeedRefresh(){u.value=!0,n==null||n()},onOfflineReady(){c.value=!0,i==null||i()},onRegistered:r,onRegisteredSW:a,onRegisterError:l}),offlineReady:c,needRefresh:u}}document.title=fe.title;window.projInfo=fe;if(fe.id==="")throw new 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 Cs();const{globalBus:e}=await jn(()=>Promise.resolve().then(function(){return _s}),void 0),{startGameLoop:t}=await jn(()=>import("./gameLoop.d76271d7.js"),["assets/gameLoop.d76271d7.js","assets/@fontsource.f66d05e7.css","assets/vue.c16a309b.js","assets/amator.1e5a40c8.js","assets/bezier-easing.a990b400.js","assets/@vue.6b211d3c.js","assets/nanoevents.1080beb7.js","assets/lz-string.dccec454.js","assets/vue-next-select.ded54c4a.js","assets/vue-next-select.9e6f4164.css","assets/vuedraggable.1879de79.js","assets/sortablejs.a0f68e5e.js","assets/vue-textarea-autosize.35804eaf.js","assets/vue-panzoom.8ce6f9b1.js","assets/panzoom.30c56ba6.js","assets/wheel.f2ae740f.js","assets/ngraph.events.083734c6.js","assets/vue-toastification.9c2dad53.js","assets/vue-toastification.4b5f8ac8.css"]),n=window.vue=ba(zf);e.emit("setupVue",n),n.mount("#app"),jt(()=>{const i=di(),{updateServiceWorker:r}=Gf({onNeedRefresh(){i.info("New content available, click here to update.",{timeout:!1,closeOnClick:!1,draggable:!1,icon:{iconClass:"material-icons",iconChildren:"refresh",iconTag:"i"},rtl:!1,onClick(){r()}})},onOfflineReady(){i.info("App ready to work offline")},onRegisterError:console.warn,onRegistered(a){a&&setInterval(()=>a.update(),60*60*1e3)}})}),t()});export{o as D,jn as _,Be as a,fe as b,vf as c,We as g,ks as l,Q as p,re as s};