mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-25 17:59:59 +00:00
18 lines
235 KiB
JavaScript
18 lines
235 KiB
JavaScript
/* empty css */import"./vue.c16a309b.js";import{_ as C,C as s,l as Fe,q as mn,t as G,b2 as ht,ab as K,aF as S,a1 as A,a2 as k,aL as Pt,G as Ne,aD as wr,w as bt,b3 as It,a9 as d,O as re,ap as ia,az as vi,as as Ht,aH as ai,A as De,$ as te,b7 as Z,b9 as Bi,ar as Yt,bv as Dn,a8 as _,bt as ra,bc as Un,T as aa,u as Li,j as sa,bw as At,aM as kt,a0 as j,aO as Je,J as de,I as Be,aI as vn,aG as hn,z as an,bo as oa,bs as la,aK as Tn,bd as ar,am as ci,H as ua,bx as ca,bf as da}from"./@vue.6b211d3c.js";import{c as _r}from"./nanoevents.1080beb7.js";import{L as tn}from"./lz-string.dccec454.js";import{Y as pa}from"./vue-next-select.ded54c4a.js";import{D as fa}from"./vuedraggable.1879de79.js";import{p as ga}from"./vue-textarea-autosize.35804eaf.js";import{P as ma}from"./vue-panzoom.8ce6f9b1.js";import{s as va,u as hi}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 ha=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 u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).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)}};ha();const ba="modulepreload",sr={},ya="./",Wn=function(t,n){return!n||n.length===0?t():Promise.all(n.map(i=>{if(i=`${ya}${i}`,i in sr)return;sr[i]=!0;const r=i.endsWith(".css"),a=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${a}`))return;const u=document.createElement("link");if(u.rel=r?"stylesheet":ba,r||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),r)return new Promise((l,c)=>{u.addEventListener("load",l),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())},wa="./projInfo-schema.json",_a="Planar Pioneers",Na="A game about controlling and exploiting planes!",Ca="planar-pioneers",ka="thepaperpilot",Ma="",Sa="",Ia="0.0",xa="Initial Commit",$a=!1,Ea=!1,Da=2,Ta=!0,Pa=null,Aa="",Ra=["main"],Fa=3600,Oa=0,qa=!0,Va="base64";var we={$schema:wa,title:_a,description:Na,id:Ca,author:ka,discordName:Ma,discordLink:Sa,versionNumber:Ia,versionTitle:xa,allowGoBack:$a,defaultShowSmall:Ea,defaultDecimalsShown:Da,useHeader:Ta,banner:Pa,logo:Aa,initialTabs:Ra,maxTickLength:Fa,offlineLimit:Oa,enablePausing:qa,exportEncoding:Va};class Ba{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 La(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 La{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const Di=17,ja=9e15,za=Math.log10(9e15),Ga=1/9e15,Ua=308,Wa=-324,or=5,Ha=(1<<10)-1,Ya=function(){const e=[];for(let n=Wa+1;n<=Ua;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],Za=[[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]],Xa=[[-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 M=function(t){return o.fromValue_noAlloc(t)},J=function(e,t,n){return o.fromComponents(e,t,n)},ie=function(t,n,i){return o.fromComponents_noNormalize(t,n,i)};const Qt=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)))},Ti=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},Ka=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},Nr=.5671432904097838,lr=function(e,t=1e-10){let n,i;if(!Number.isFinite(e)||e===0)return e;if(e===1)return Nr;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 ur(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(Nr);n=o.ln(e);for(let u=0;u<100;++u){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 w=class{constructor(e){this.sign=0,this.mag=0,this.layer=0,e instanceof w?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/Ya(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 w().fromComponents(e,t,n)}static fromComponents_noNormalize(e,t,n){return new w().fromComponents_noNormalize(e,t,n)}static fromMantissaExponent(e,t){return new w().fromMantissaExponent(e,t)}static fromMantissaExponent_noNormalize(e,t){return new w().fromMantissaExponent_noNormalize(e,t)}static fromDecimal(e){return new w().fromDecimal(e)}static fromNumber(e){return new w().fromNumber(e)}static fromString(e){return new w().fromString(e)}static fromValue(e){return new w().fromValue(e)}static fromValue_noAlloc(e){if(e instanceof w)return e;if(typeof e=="string"){const t=w.fromStringCache.get(e);return t!==void 0?t:w.fromString(e)}else return typeof e=="number"?w.fromNumber(e):w.dZero}static abs(e){return M(e).abs()}static neg(e){return M(e).neg()}static negate(e){return M(e).neg()}static negated(e){return M(e).neg()}static sign(e){return M(e).sign}static sgn(e){return M(e).sign}static round(e){return M(e).round()}static floor(e){return M(e).floor()}static ceil(e){return M(e).ceil()}static trunc(e){return M(e).trunc()}static add(e,t){return M(e).add(t)}static plus(e,t){return M(e).add(t)}static sub(e,t){return M(e).sub(t)}static subtract(e,t){return M(e).sub(t)}static minus(e,t){return M(e).sub(t)}static mul(e,t){return M(e).mul(t)}static multiply(e,t){return M(e).mul(t)}static times(e,t){return M(e).mul(t)}static div(e,t){return M(e).div(t)}static divide(e,t){return M(e).div(t)}static recip(e){return M(e).recip()}static reciprocal(e){return M(e).recip()}static reciprocate(e){return M(e).reciprocate()}static cmp(e,t){return M(e).cmp(t)}static cmpabs(e,t){return M(e).cmpabs(t)}static compare(e,t){return M(e).cmp(t)}static isNaN(e){return e=M(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag)}static isFinite(e){return e=M(e),isFinite(e.sign)&&isFinite(e.layer)&&isFinite(e.mag)}static eq(e,t){return M(e).eq(t)}static equals(e,t){return M(e).eq(t)}static neq(e,t){return M(e).neq(t)}static notEquals(e,t){return M(e).notEquals(t)}static lt(e,t){return M(e).lt(t)}static lte(e,t){return M(e).lte(t)}static gt(e,t){return M(e).gt(t)}static gte(e,t){return M(e).gte(t)}static max(e,t){return M(e).max(t)}static min(e,t){return M(e).min(t)}static minabs(e,t){return M(e).minabs(t)}static maxabs(e,t){return M(e).maxabs(t)}static clamp(e,t,n){return M(e).clamp(t,n)}static clampMin(e,t){return M(e).clampMin(t)}static clampMax(e,t){return M(e).clampMax(t)}static cmp_tolerance(e,t,n){return M(e).cmp_tolerance(t,n)}static compare_tolerance(e,t,n){return M(e).cmp_tolerance(t,n)}static eq_tolerance(e,t,n){return M(e).eq_tolerance(t,n)}static equals_tolerance(e,t,n){return M(e).eq_tolerance(t,n)}static neq_tolerance(e,t,n){return M(e).neq_tolerance(t,n)}static notEquals_tolerance(e,t,n){return M(e).notEquals_tolerance(t,n)}static lt_tolerance(e,t,n){return M(e).lt_tolerance(t,n)}static lte_tolerance(e,t,n){return M(e).lte_tolerance(t,n)}static gt_tolerance(e,t,n){return M(e).gt_tolerance(t,n)}static gte_tolerance(e,t,n){return M(e).gte_tolerance(t,n)}static pLog10(e){return M(e).pLog10()}static absLog10(e){return M(e).absLog10()}static log10(e){return M(e).log10()}static log(e,t){return M(e).log(t)}static log2(e){return M(e).log2()}static ln(e){return M(e).ln()}static logarithm(e,t){return M(e).logarithm(t)}static pow(e,t){return M(e).pow(t)}static pow10(e){return M(e).pow10()}static pow_base(e,t){return M(e).pow_base(t)}static root(e,t){return M(e).root(t)}static factorial(e,t){return M(e).factorial()}static gamma(e,t){return M(e).gamma()}static lngamma(e,t){return M(e).lngamma()}static exp(e){return M(e).exp()}static sqr(e){return M(e).sqr()}static sqrt(e){return M(e).sqrt()}static cube(e){return M(e).cube()}static cbrt(e){return M(e).cbrt()}static tetrate(e,t=2,n=ie(1,0,1)){return M(e).tetrate(t,n)}static iteratedexp(e,t=2,n=ie(1,0,1)){return M(e).iteratedexp(t,n)}static iteratedlog(e,t=10,n=1){return M(e).iteratedlog(t,n)}static layeradd10(e,t){return M(e).layeradd10(t)}static layeradd(e,t,n=10){return M(e).layeradd(t,n)}static slog(e,t=10){return M(e).slog(t)}static lambertw(e){return M(e).lambertw()}static ssqrt(e){return M(e).ssqrt()}static pentate(e,t=2,n=ie(1,0,1)){return M(e).pentate(t,n)}static sin(e){return M(e).sin()}static cos(e){return M(e).cos()}static tan(e){return M(e).tan()}static asin(e){return M(e).asin()}static acos(e){return M(e).acos()}static atan(e){return M(e).atan()}static sinh(e){return M(e).sinh()}static cosh(e){return M(e).cosh()}static tanh(e){return M(e).tanh()}static asinh(e){return M(e).asinh()}static acosh(e){return M(e).acosh()}static atanh(e){return M(e).atanh()}static affordGeometricSeries(e,t,n,i){return this.affordGeometricSeries_core(M(e),M(t),M(n),i)}static sumGeometricSeries(e,t,n,i){return this.sumGeometricSeries_core(e,M(t),M(n),i)}static affordArithmeticSeries(e,t,n,i){return this.affordArithmeticSeries_core(M(e),M(t),M(n),M(i))}static sumArithmeticSeries(e,t,n,i){return this.sumArithmeticSeries_core(M(e),M(t),M(n),M(i))}static efficiencyOfPurchase(e,t,n){return this.efficiencyOfPurchase_core(M(e),M(t),M(n))}static randomDecimalForTesting(e){if(Math.random()*20<1)return ie(0,0,0);const t=Math.random()>.5?1:-1;if(Math.random()*20<1)return ie(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)),J(t,n,r)}static affordGeometricSeries_core(e,t,n,i){const r=t.mul(n.pow(i));return w.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(w.sub(1,n.pow(e))).div(w.sub(1,n))}static affordArithmeticSeries_core(e,t,n,i){const a=t.add(i.mul(n)).sub(n.div(2)),u=a.pow(2);return a.neg().add(u.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<Ga)return this.layer+=1,this.mag=Math.log10(this.mag),this;let e=Math.abs(this.mag),t=Math.sign(this.mag);if(e>=ja)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e<za&&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=w.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const i=e.split("^^^");if(i.length===2){const y=parseFloat(i[0]),N=parseFloat(i[1]),x=i[1].split(";");let E=1;if(x.length===2&&(E=parseFloat(x[1]),isFinite(E)||(E=1)),isFinite(y)&&isFinite(N)){const I=w.pentate(y,N,E);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}const r=e.split("^^");if(r.length===2){const y=parseFloat(r[0]),N=parseFloat(r[1]),x=r[1].split(";");let E=1;if(x.length===2&&(E=parseFloat(x[1]),isFinite(E)||(E=1)),isFinite(y)&&isFinite(N)){const I=w.tetrate(y,N,E);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}const a=e.split("^");if(a.length===2){const y=parseFloat(a[0]),N=parseFloat(a[1]);if(isFinite(y)&&isFinite(N)){const x=w.pow(y,N);return this.sign=x.sign,this.layer=x.layer,this.mag=x.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}e=e.trim().toLowerCase();let u,l,c=e.split("pt");if(c.length===2){u=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let y=parseFloat(c[1]);if(isFinite(y)||(y=1),isFinite(u)&&isFinite(l)){const N=w.tetrate(u,l,y);return this.sign=N.sign,this.layer=N.layer,this.mag=N.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}if(c=e.split("p"),c.length===2){u=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let y=parseFloat(c[1]);if(isFinite(y)||(y=1),isFinite(u)&&isFinite(l)){const N=w.tetrate(u,l,y);return this.sign=N.sign,this.layer=N.layer,this.mag=N.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}const p=e.split("e"),h=p.length-1;if(h===0){const y=parseFloat(e);if(isFinite(y))return this.fromNumber(y),w.fromStringCache.size>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}else if(h===1){const y=parseFloat(e);if(isFinite(y)&&y!==0)return this.fromNumber(y),w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}const f=e.split("e^");if(f.length===2){this.sign=1,f[0].charAt(0)=="-"&&(this.sign=-1);let y="";for(let N=0;N<f[1].length;++N){const x=f[1].charCodeAt(N);if(x>=43&&x<=57||x===101)y+=f[1].charAt(N);else return this.layer=parseFloat(y),this.mag=parseFloat(f[1].substr(N+1)),this.normalize(),w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}if(h<1)return this.sign=0,this.layer=0,this.mag=0,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this;const b=parseFloat(p[0]);if(b===0)return this.sign=0,this.layer=0,this.mag=0,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this;let v=parseFloat(p[p.length-1]);if(h>=2){const y=parseFloat(p[p.length-2]);isFinite(y)&&(v*=Math.sign(y),v+=Ti(y))}if(!isFinite(b))this.sign=p[0]==="-"?-1:1,this.layer=h,this.mag=v;else if(h===1)this.sign=Math.sign(b),this.layer=1,this.mag=v+Math.log10(Math.abs(b));else if(this.sign=Math.sign(b),this.layer=h,h===2){const y=w.mul(J(1,2,v),M(b));return this.sign=y.sign,this.layer=y.layer,this.mag=y.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}else this.mag=v;return this.normalize(),w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}fromValue(e){return e instanceof w?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:Qt(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Qt(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<=or?(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):Qt(this.m,e)+"e"+Qt(this.e,e):this.layer===1?Qt(this.m,e)+"e"+Qt(this.e,e):this.layer<=or?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Qt(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Qt(this.mag,e)}abs(){return ie(this.sign===0?0:1,this.layer,this.mag)}neg(){return ie(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?w.dZero:this.layer===0?J(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?w.dZero:this.layer===0?J(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?w.dZero:this.layer===0?J(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?w.dZero:this.layer===0?J(this.sign,0,Math.trunc(this.mag)):this}add(e){const t=M(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 ie(0,0,0);let n,i;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(w.cmpabs(this,t)>0?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return w.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))>Di)return n;{const u=Math.pow(10,Math.log10(n.mag)-i.mag),l=i.sign+n.sign*u;return J(Math.sign(l),1,i.mag+Math.log10(Math.abs(l)))}}if(r===1&&a===0){if(Math.abs(n.mag-Math.log10(i.mag))>Di)return n;{const u=Math.pow(10,n.mag-Math.log10(i.mag)),l=i.sign+n.sign*u;return J(Math.sign(l),1,Math.log10(i.mag)+Math.log10(Math.abs(l)))}}if(Math.abs(n.mag-i.mag)>Di)return n;{const u=Math.pow(10,n.mag-i.mag),l=i.sign+n.sign*u;return J(Math.sign(l),1,i.mag+Math.log10(Math.abs(l)))}}plus(e){return this.add(e)}sub(e){return this.add(M(e).neg())}subtract(e){return this.sub(e)}minus(e){return this.sub(e)}mul(e){const t=M(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer))return t;if(this.sign===0||t.sign===0)return ie(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return ie(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 w.fromNumber(n.sign*i.sign*n.mag*i.mag);if(n.layer>=3||n.layer-i.layer>=2)return J(n.sign*i.sign,n.layer,n.mag);if(n.layer===1&&i.layer===0)return J(n.sign*i.sign,1,n.mag+Math.log10(i.mag));if(n.layer===1&&i.layer===1)return J(n.sign*i.sign,1,n.mag+i.mag);if(n.layer===2&&i.layer===1){const r=J(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(J(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return J(n.sign*i.sign,r.layer+1,r.sign*r.mag)}if(n.layer===2&&i.layer===2){const r=J(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(J(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return J(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=M(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?w.dNaN:this.layer===0?J(this.sign,0,1/this.mag):J(this.sign,this.layer,-this.mag)}reciprocal(){return this.recip()}reciprocate(){return this.recip()}cmp(e){const t=M(e);return this.sign>t.sign?1:this.sign<t.sign?-1:this.sign*this.cmpabs(e)}cmpabs(e){const t=M(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=M(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=M(e);return this.lt(t)?t:this}min(e){const t=M(e);return this.gt(t)?t:this}maxabs(e){const t=M(e);return this.cmpabs(t)<0?t:this}minabs(e){const t=M(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=M(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=M(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=Ti(r)),this.layer<n.layer&&(i=Ti(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=M(e);return!this.eq_tolerance(n,t)&&this.lt(n)}lte_tolerance(e,t){const n=M(e);return this.eq_tolerance(n,t)||this.lt(n)}gt_tolerance(e,t){const n=M(e);return!this.eq_tolerance(n,t)&&this.gt(n)}gte_tolerance(e,t){const n=M(e);return this.eq_tolerance(n,t)||this.gt(n)}pLog10(){return this.lt(w.dZero)?w.dZero:this.log10()}absLog10(){return this.sign===0?w.dNaN:this.layer>0?J(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):J(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?w.dNaN:this.layer>0?J(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):J(this.sign,0,Math.log10(this.mag))}log(e){return e=M(e),this.sign<=0||e.sign<=0||e.sign===1&&e.layer===0&&e.mag===1?w.dNaN:this.layer===0&&e.layer===0?J(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):w.div(this.log10(),e.log10())}log2(){return this.sign<=0?w.dNaN:this.layer===0?J(this.sign,0,Math.log2(this.mag)):this.layer===1?J(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?J(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):J(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?w.dNaN:this.layer===0?J(this.sign,0,Math.log(this.mag)):this.layer===1?J(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?J(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):J(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}logarithm(e){return this.log(e)}pow(e){const t=M(e),n=this,i=t;if(n.sign===0)return i.eq(0)?ie(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(i.sign===0)return ie(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:w.dNaN:r}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return w.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 J(1,0,t);if(e.sign===0)return w.dOne;e=ie(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?J(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?J(-e.sign,e.layer+1,-e.mag):w.dOne}pow_base(e){return M(e).pow(this)}root(e){const t=M(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?w.exp(w.mul(this,w.ln(this).sub(1))):w.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(ie(1,0,24)))return w.fromNumber(Ka(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,u=t+a;if(u===t||(t=u,i=i*n,r=360*i,a=1/r,u=t-a,u===t))return w.exp(t);t=u,i=i*n,r=1260*i;let l=1/r;return t=t+l,i=i*n,r=1680*i,l=1/r,t=t-l,w.exp(t)}else return this.layer===1?w.exp(w.mul(this,w.ln(this).sub(1))):w.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?w.dOne:this.layer===0&&this.mag<=709.7?w.fromNumber(Math.exp(this.sign*this.mag)):this.layer===0?J(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?J(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):J(1,this.layer+1,this.sign*this.mag)}sqr(){return this.pow(2)}sqrt(){if(this.layer===0)return w.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return J(1,2,Math.log10(this.mag)-.3010299956639812);{const e=w.div(ie(this.sign,this.layer-1,this.mag),ie(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=ie(1,0,1)){if(e===1)return w.pow(this,t);if(e===0)return new w(t);if(this.eq(w.dOne))return w.dOne;if(this.eq(-1))return w.pow(this,t);if(e===Number.POSITIVE_INFINITY){const r=this.toNumber();if(r<=1.444667861009766&&r>=.06598803584531254){if(r>1.444667861009099)return w.fromNumber(Math.E);const a=w.ln(this).neg();return a.lambertw().div(a)}else return r>1.444667861009766?w.fromNumber(Number.POSITIVE_INFINITY):w.dNaN}if(this.eq(w.dZero)){let r=Math.abs((e+1)%2);return r>1&&(r=2-r),w.fromNumber(r)}if(e<0)return w.iteratedlog(t,this,-e);t=M(t);const n=e;e=Math.trunc(e);const i=n-e;if(this.gt(w.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(w.dOne)?this.gt(10)?t=this.pow(i):(t=w.fromNumber(w.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 ie(t.sign,t.layer+(e-r-1),t.mag);if(r>1e4)return t}return t}iteratedexp(e=2,t=ie(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return w.tetrate(e,-t,this);e=M(e);let n=w.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 u=1;u<t;++u){const c=new w(e).tetrate(a).gt(this);if(u>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 w.fromNumber(a)}slog_internal(e=10){if(e=M(e),e.lte(w.dZero)||e.eq(w.dOne))return w.dNaN;if(e.lt(w.dOne))return this.eq(w.dOne)?w.dZero:this.eq(w.dZero)?w.dNegOne:w.dNaN;if(this.mag<0||this.eq(w.dZero))return w.dNegOne;let t=0,n=w.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(w.dZero))n=w.pow(e,n),t-=1;else{if(n.lte(w.dOne))return w.fromNumber(t+w.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=w.log(n,e)}return w.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:w.critical_section(e,t,Xa)}static tetrate_critical(e,t){return w.critical_section(e,t,Za)}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 u=0;u<ln.length;++u)if(ln[u]==e){i=n[u][Math.floor(t)],r=n[u][Math.ceil(t)];break}else if(ln[u]<e&&ln[u+1]>e){const l=(e-ln[u])/(ln[u+1]-ln[u]);i=n[u][Math.floor(t)]*(1-l)+n[u+1][Math.floor(t)]*l,r=n[u][Math.ceil(t)]*(1-l)+n[u+1][Math.ceil(t)]*l;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=w.fromValue_noAlloc(e).toNumber();const t=w.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?w.tetrate(t,i):Number.isFinite(i)?i>=-1?w.log(w.tetrate(t,i+1),t):w.log(w.log(w.tetrate(t,i+2),t),t):w.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return w.fromNumber(lr(this.toNumber()));if(this.layer===0)return w.fromNumber(lr(this.sign*this.mag));if(this.layer===1)return ur(this);if(this.layer===2)return ur(this);if(this.layer>=3)return ie(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return ie(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=ie(1,0,1)){t=M(t);const n=e;e=Math.trunc(e);const i=n-e;i!==0&&(t.eq(w.dOne)?(++e,t=w.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?w.fromNumber(Math.sin(this.sign*this.mag)):ie(0,0,0)}cos(){return this.mag<0?w.dOne:this.layer===0?w.fromNumber(Math.cos(this.sign*this.mag)):ie(0,0,0)}tan(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.tan(this.sign*this.mag)):ie(0,0,0)}asin(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.asin(this.sign*this.mag)):ie(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?w.fromNumber(Math.acos(this.toNumber())):this.layer===0?w.fromNumber(Math.acos(this.sign*this.mag)):ie(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.atan(this.sign*this.mag)):w.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 w.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return w.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?ie(Number.NaN,Number.NaN,Number.NaN):w.ln(this.add(1).div(w.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(w.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=w;o.fromStringCache=new Ba(Ha);o.dZero=ie(0,0,0);o.dOne=ie(1,0,1);o.dNegOne=ie(-1,0,1);o.dTwo=ie(1,0,2);o.dTen=ie(1,0,10);o.dNaN=ie(Number.NaN,Number.NaN,Number.NaN);o.dInf=ie(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);o.dNegInf=ie(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);o.dNumberMax=J(1,0,Number.MAX_VALUE);o.dNumberMin=J(1,0,Number.MIN_VALUE);M=o.fromValue_noAlloc;J=o.fromComponents;ie=o.fromComponents_noNormalize;o.fromMantissaExponent;o.fromMantissaExponent_noNormalize;const Ja=new o(1);function Ln(e,t,n=!0){let i=o.log10(e).floor(),r=o.div(e,o.pow(10,i));r.toStringWithDecimalPlaces(t)==="10"&&(r=Ja,i=i.add(1));const a=i.gte(1e9)?yt(i,Math.max(Math.max(t,3),we.defaultDecimalsShown)):i.gte(1e4)?di(i,0):i.toStringWithDecimalPlaces(0);return n?r.toStringWithDecimalPlaces(t)+"e"+a:"e"+a}function di(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 Cr(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()),we.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const Qa=new o("eeee1000"),es=new o("e100000"),cr=new o("e1000"),kr=new o(1e9),ts=new o(1e6),ns=new o(1e3),is=new o(.98),rs=new o(.001),Mr=new o(0);function yt(e,t,n){if(t==null&&(t=we.defaultDecimalsShown),n=n!=null?n:we.defaultShowSmall,e=new o(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+yt(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(Qa)){const i=e.slog();return i.gte(ts)?"F"+yt(i.floor()):o.pow(10,i.sub(i.floor())).toStringWithDecimalPlaces(3)+"F"+di(i.floor(),0)}else{if(e.gte(es))return Ln(e,0,!1);if(e.gte(cr))return Ln(e,0);if(e.gte(kr))return Ln(e,t);if(e.gte(ns))return di(e,0);if(e.gte(rs)||!n)return Cr(e,t);if(e.eq(Mr))return 0 .toFixed(t)}return e=Ir(e),e.lt(cr)?Ln(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):yt(e,t)+"\u207B\xB9"}function He(e){return e=new o(e),e.sign<0?"-"+He(e.neg()):e.gte(kr)||e.lte(is)&&!e.eq(Mr)?yt(e):yt(e,0)}function Sr(e){return o.lt(e,0)?"-"+Sr(o.neg(e)):o.gt(e,2**51)?yt(o.div(e,31536e3))+"y":(e=new o(e).toNumber(),e<60?yt(e)+"s":e<3600?He(Math.floor(e/60))+"m "+yt(e%60)+"s":e<86400?He(Math.floor(e/3600))+"h "+He(Math.floor(e/60)%60)+"m "+He(e%60)+"s":e<31536e3?He(Math.floor(e/84600)%365)+"d "+He(Math.floor(e/3600)%24)+"h "+He(Math.floor(e/60)%60)+"m":He(Math.floor(e/31536e3))+"y "+He(Math.floor(e/84600)%365)+"d "+He(Math.floor(e/3600)%24)+"h")}function as(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 ss(e,t){return yt(e,t,!0)}function Ir(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 os=Object.freeze(Object.defineProperty({__proto__:null,default:o,exponentialFormat:Ln,commaFormat:di,regularFormat:Cr,format:yt,formatWhole:He,formatTime:Sr,toPlaces:as,formatSmall:ss,invertOOM:Ir},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:ji,commaFormat:ls,regularFormat:us,format:xe,formatWhole:ot,formatTime:bi,toPlaces:cs,formatSmall:Wt,invertOOM:ds}=os;window.Decimal=o;window.exponentialFormat=ji;window.commaFormat=ls;window.regularFormat=us;window.format=xe;window.formatWhole=ot;window.formatTime=bi;window.toPlaces=cs;window.formatSmall=Wt;window.invertOOM=ds;function at(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function Hn(e){return typeof e=="function"}var H=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(H||{});const Yn=Symbol("DoNotCache");function D(e,t){const n=e[t];Hn(n)&&n.length===0&&!n[Yn]?e[t]=C(n.bind(e)):Hn(n)&&(e[t]=n.bind(e),e[t][Yn]=!0)}function _e(e){return Hn(e)&&!e[Yn]&&(e=C(e)),e}const ft=Symbol("Component"),ct=Symbol("GatherProps");let ps=0;function Xt(e="feature-"){return e+ps++}var Me=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(Me||{});function Ye(e){const t=s(e);return t!==2&&t!==!1}function bn(e){return s(e)===1}function z(e){return e[Yn]=!0,e}function oe(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}function Zn(e,...t){const n=[],i=r=>{Object.keys(r).forEach(a=>{const u=r[a];u!=null&&typeof u=="object"&&(t.includes(u.type)?n.push(u):!(u instanceof o)&&!Fe(u)&&i(u))})};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 zi=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(zi||{}),Ct={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 tt=_r();"fonts"in document&&(document.fonts.onloadingdone=()=>tt.emit("fontsLoaded"));var fs=Object.freeze(Object.defineProperty({__proto__:null,globalBus:tt},Symbol.toStringTag,{value:"Module"}));const gs=mn({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var X=window.player=gs;function xr(e){return JSON.stringify(e,(t,n)=>s(n))}function $r(e={}){return Object.assign({id:`${we.id}-0`,name:"Default Save",tabs:we.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:we.id,modVersion:we.versionNumber,layers:{}},e)}function vt(e){const t=tn.compressToUTF16(xr(e!=null?e:X));return localStorage.setItem((e!=null?e:X).id,t),t}async function ms(){bs();try{let e=localStorage.getItem(ce.active);if(e==null){await pn(En());return}if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=tn.decompressFromUTF16(e);else throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==we.id){await pn(En());return}t.id=ce.active,await pn(t)}catch(e){console.error(`Failed to load save. Falling back to new save.
|
|
`,e),await pn(En())}}function En(){const e=ui(),t=$r({id:e});return vt(t),ce.saves.push(e),t}function ui(){let e,t=0;do e=`${we.id}-${t++}`;while(localStorage.getItem(e)!=null);return e}const vs=G(!1);async function pn(e){console.info("Loading save",e),vs.value=!0;const{layers:t,removeLayer:n,addLayer:i}=await Wn(()=>Promise.resolve().then(function(){return gl}),void 0),{fixOldSave:r,getInitialLayers:a}=await Wn(()=>Promise.resolve().then(function(){return Sp}),void 0);for(const u in t){const l=t[u];l&&n(l)}a(e).forEach(u=>i(u,e)),e=$r(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,we.offlineLimit*3600)),e.time=Date.now(),e.modVersion!==we.versionNumber&&(r(e.modVersion,e),e.modVersion=we.versionNumber),Object.assign(X,e),ce.active=X.id,tt.emit("onLoad")}setInterval(()=>{X.autosave&&vt()},1e3);window.onbeforeunload=()=>{X.autosave&&vt()};window.save=vt;const hs=window.hardReset=async()=>{await pn(En())};window.deleteLowerSaves=()=>{const e=Object.values(ce.saves).indexOf(X.id)+1;Object.values(ce.saves).slice(e).forEach(t=>localStorage.removeItem(t)),ce.saves=ce.saves.slice(0,e)};const Xn=mn({active:"",saves:[],showTPS:!0,theme:zi.Nordic,unthrottled:!1,alignUnits:!1});ht(Xn,e=>{const t=tn.compressToUTF16(JSON.stringify(e));localStorage.setItem(we.id,t)},{deep:!0});var ce=window.settings=Xn;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:zi.Nordic,alignUnits:!1};tt.emit("loadSettings",e),Object.assign(Xn,e),hs()};function bs(){try{let e=localStorage.getItem(we.id);if(e!=null&&e!==""){if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=tn.decompressFromUTF16(e);else{console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(Xn,t)}tt.emit("loadSettings",Xn)}catch{}}const Er=mn([]);function ys(e){Er.push(e)}const ws=mn([]),_s=mn([]),Ns={class:"table"},Cs=K({__name:"Column",setup(e){const t=C(()=>Ct[ce.theme].mergeAdjacent);return(n,i)=>(S(),A("div",Ns,[k("div",{class:Ne(["col",{mergeAdjacent:s(t)}])},[Pt(n.$slots,"default")],2)]))}}),ks={class:"table"},Ms=K({__name:"Row",setup(e){const t=C(()=>Ct[ce.theme].mergeAdjacent);return(n,i)=>(S(),A("div",ks,[k("div",{class:Ne(["row",{mergeAdjacent:s(t)}])},[Pt(n.$slots,"default")],2)]))}});function Dr(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!ia(e)}function pe(e,t="span"){return typeof e=="function"?K({render:e}):typeof e=="string"?e.length>0?(e=e.trim(),e.charAt(0)!=="<"&&(e=`<${t}>${e}</${t}>`),K({template:e})):K({render:()=>({})}):e}function lt(e){if(xt(e))return typeof e=="function"?e():pe(e);const t=e[ft];return d(t,e[ct](),null)}function Pi(...e){let t;return d(Ms,null,Dr(t=e.map(lt))?t:{default:()=>[t]})}function Ss(...e){let t;return d(Cs,null,Dr(t=e.map(lt))?t:{default:()=>[t]})}function wt(e){if(xt(e))return typeof e=="function"?e():typeof e=="string"?d(re,null,[e]):d(e,null,null);const t=e[ft];return d(t,e[ct](),null)}function dr(e,t){return e.reduce((n,i)=>d(re,null,[n,t,i]))}function xt(e){return typeof e=="string"?!0:typeof e=="object"?e==null?!1:"render"in e||"component"in e:typeof e=="function"&&e[Yn]===!0}function Tr(e,t){const n=G(null),i=G(void 0);function r(l){n.value||(n.value=setInterval(u,250)),i.value=l}function a(){n.value&&(clearInterval(n.value),n.value=null)}function u(){t&&t.value?t.value():e&&e.value&&e.value(i.value)}return wr(a),{start:r,stop:a,handleHolding:u}}function Gi(e,t="div"){const n=bt();return It(()=>{n.value=pe(Ee(e),t)}),n}function An(e,t="div"){const n=bt(null);return It(()=>{const i=Ee(e);n.value=i==""||i==null?null:pe(i,t)}),n}function Ee(e){return s(s(e))}function q(...e){return e.includes(Object)||e.push(Object),e}function pr(e){const t=G(!1),n=e[ct].bind(e);return e[ct]=()=>({...n(),onPointerenter:()=>t.value=!0,onPointerleave:()=>t.value=!1}),t}var ve=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};const Is=K({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var h;const n=G({}),i=new ResizeObserver(l),r=G(null);vi(()=>{const f=r.value;f!=null&&i.observe(f)});let a=!0,u=G((h=r.value)==null?void 0:h.getBoundingClientRect());function l(){a&&(a=!1,Ht(()=>{var f;u.value=(f=r.value)==null?void 0:f.getBoundingClientRect(),Object.values(n.value).filter(b=>b).forEach(b=>b.rect=b.element.getBoundingClientRect()),t("updateNodes",n.value),a=!0}))}tt.on("fontsLoaded",l);const c={attributes:!1,childList:!0,subtree:!1};ai(Ui,(f,b)=>{const v=new MutationObserver(()=>p(f));v.observe(b,c),n.value[f]={element:b,observer:v,rect:b.getBoundingClientRect()},l()}),ai(Wi,f=>{var b;(b=n.value[f])==null||b.observer.disconnect(),n.value[f]=void 0,l()}),ai(Hi,n),ai(Yi,u);function p(f){const b=n.value[f];b!=null&&(b.rect=b.element.getBoundingClientRect(),t("updateNodes",n.value))}return(f,b)=>(S(),A(re,null,[Pt(f.$slots,"default",{},void 0,!0),k("div",{ref_key:"resizeListener",ref:r,class:"resize-listener"},null,512)],64))}});var Pr=ve(Is,[["__scopeId","data-v-2b1dc1bc"]]);const xs=["onPointerdown"],$s={class:"modal-wrapper"},Es={class:"modal-container"},Ds={class:"modal-header"},Ts={class:"modal-body"},Ps={class:"modal-footer"},As=k("div",{class:"modal-default-flex-grow"},null,-1),Rt=K({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const r=De(e),a=C(()=>s(r.modelValue)||l.value);function u(){n("update:modelValue",!1)}const l=G(!1),c=G(null),p=C(()=>{var h,f;return(f=(h=c.value)==null?void 0:h.nodes)!=null?f:null});return t({isOpen:a,nodes:p}),(h,f)=>(S(),te(aa,{to:"#modal-root"},[d(Un,{name:"modal",onBeforeEnter:f[0]||(f[0]=b=>l.value=!0),onAfterLeave:f[1]||(f[1]=b=>l.value=!1)},{default:Z(()=>[Bi(k("div",Yt({class:"modal-mask",onPointerdown:Dn(u,["self"])},h.$attrs),[k("div",$s,[k("div",Es,[k("div",Ds,[Pt(h.$slots,"header",{shown:s(a)},()=>[_(" default header ")])]),k("div",Ts,[d(Pr,{ref_key:"contextRef",ref:c},{default:Z(()=>[Pt(h.$slots,"body",{shown:s(a)},()=>[_(" default body ")])]),_:3},512)]),k("div",Ps,[Pt(h.$slots,"footer",{shown:s(a)},()=>[k("div",{class:"modal-default-footer"},[As,k("button",{class:"button modal-default-button",onClick:u}," Close ")])])])])])],16,xs),[[ra,e.modelValue]])]),_:3})]))}}),en=Symbol("ProxyState");function Qe(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,u){if(u===en)return r();const l=r()[u];return l!=null&&typeof l=="object"&&Tt in l?l[Tt]:l},set(a,u,l){return r()[u]=l,!0},has(a,u){return u===en?!0:Reflect.has(r(),u)},ownKeys(){return Reflect.ownKeys(r())},getOwnPropertyDescriptor(a,u){return i||(Object.assign(n,e.call(n,n)),i=!0),Object.getOwnPropertyDescriptor(a,u)}})}var We=window.state=Li({lastTenTicks:[],hasNaN:!1,NaNPath:[]});const Ar=o.ln(10);function jn(e){return e}function Rs(e,t){if(O(t))return t.invert(o.neg(e));throw new Error("Could not invert due to no input being a variable")}function Fs(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return m.neg(t.getIntegralFormula(e))}throw new Error("Could not integrate due to no input being a variable")}function Os(e){return m.neg(e)}function qs(e,t,n){if(O(t))return t.invert(o.sub(e,Se(n)));if(O(n))return n.invert(o.sub(e,Se(t)));throw new Error("Could not invert due to no input being a variable")}function Vs(e,t,n){var i,r;if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=t.getIntegralFormula(e);return m.times(n,(i=t.innermostVariable)!=null?i:0).add(a)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=n.getIntegralFormula(e);return m.times(t,(r=n.innermostVariable)!=null?r:0).add(a)}throw new Error("Could not integrate due to no input being a variable")}function Bs(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.add(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return m.add(i,t)}throw new Error("Could not integrate due to no input being a variable")}function Ls(e,t,n){if(O(t))return t.invert(o.add(e,Se(n)));if(O(n))return n.invert(o.sub(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function js(e,t,n){var i,r;if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=t.getIntegralFormula(e);return m.sub(a,m.times(n,(i=t.innermostVariable)!=null?i:0))}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=n.getIntegralFormula(e);return m.times(t,(r=n.innermostVariable)!=null?r:0).sub(a)}throw new Error("Could not integrate due to no input being a variable")}function zs(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.sub(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return m.sub(i,t)}throw new Error("Could not integrate due to no input being a variable")}function Gs(e,t,n){if(O(t))return t.invert(o.div(e,Se(n)));if(O(n))return n.invert(o.div(e,Se(t)));throw new Error("Could not invert due to no input being a variable")}function Us(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.times(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return m.times(i,t)}throw new Error("Could not integrate due to no input being a variable")}function Ws(e,t,n){if(O(t))return m.div(e,n);if(O(n))return m.div(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Hs(e,t,n){if(O(t))return t.invert(o.mul(e,Se(n)));if(O(n))return n.invert(o.div(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function Ys(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.div(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return m.div(t,i)}throw new Error("Could not integrate due to no input being a variable")}function Zs(e,t,n){if(O(t))return m.mul(e,n);if(O(n))return m.mul(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Xs(e,t){if(O(t))return t.invert(o.recip(e));throw new Error("Could not invert due to no input being a variable")}function Ks(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.ln(n)}throw new Error("Could not integrate due to no input being a variable")}function Js(e,t){if(O(t))return t.invert(o.pow10(e));throw new Error("Could not invert due to no input being a variable")}function Qs(e){return o.ln(e).sub(1).times(e).div(Ar)}function eo(e,t){if(O(t)){const n=Ar.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 to(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new m({inputs:[t.getIntegralFormula(e)],evaluate:Qs,invert:eo})}throw new Error("Could not integrate due to no input being a variable")}function no(e,t,n){if(O(t))return t.invert(o.pow(Se(n),e));if(O(n))return n.invert(o.root(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function io(e,t){return o.ln(e).sub(1).times(e).div(o.ln(t))}function ro(e,t,n){if(O(t)){const i=o.ln(Se(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 ao(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new m({inputs:[t.getIntegralFormula(e),n],evaluate:io,invert:ro})}throw new Error("Could not integrate due to no input being a variable")}function so(e,t){if(O(t))return t.invert(o.pow(2,e));throw new Error("Could not invert due to no input being a variable")}function oo(e){return o.ln(e).sub(1).times(e).div(o.ln(2))}function lo(e,t){if(O(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 uo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new m({inputs:[t.getIntegralFormula(e)],evaluate:oo,invert:lo})}throw new Error("Could not integrate due to no input being a variable")}function co(e,t){if(O(t))return t.invert(o.exp(e));throw new Error("Could not invert due to no input being a variable")}function po(e){return o.ln(e).sub(1).times(e)}function fo(e,t){if(O(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 go(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new m({inputs:[t.getIntegralFormula(e)],evaluate:po,invert:fo})}throw new Error("Could not integrate due to no input being a variable")}function mo(e,t,n){if(O(t))return t.invert(o.root(e,Se(n)));if(O(n))return n.invert(o.ln(e).div(o.ln(Se(t))));throw new Error("Could not invert due to no input being a variable")}function vo(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e),r=m.add(n,1);return m.pow(i,r).div(r)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return m.pow(t,i).div(m.ln(t))}throw new Error("Could not integrate due to no input being a variable")}function ho(e,t){if(O(t))return t.invert(o.root(e,10));throw new Error("Could not invert due to no input being a variable")}function bo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.pow10(n).div(m.ln(10))}throw new Error("Could not integrate due to no input being a variable")}function yo(e,t,n){if(O(t))return t.invert(o.ln(e).div(o.ln(Se(n))));if(O(n))return n.invert(o.root(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function wo(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.pow(n,i).div(m.ln(n))}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e),r=m.add(t,1);return m.pow(i,r).div(r)}throw new Error("Could not integrate due to no input being a variable")}function _o(e,t,n){if(O(t))return t.invert(o.root(e,o.recip(Se(n))));if(O(n))return n.invert(o.ln(Se(t)).div(o.ln(e)));throw new Error("Could not invert due to no input being a variable")}function No(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.pow(i,m.recip(n).add(1)).times(n).div(m.add(n,1))}throw new Error("Could not integrate due to no input being a variable")}function Co(e,t){if(O(t))return t.invert(o.ln(e));throw new Error("Could not invert due to no input being a variable")}function ko(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.exp(n)}throw new Error("Could not integrate due to no input being a variable")}function Mo(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const i=o.minabs(t,1e308).toNumber();return o.tetrate(e,i,n)}function So(e,t,n,i){if(O(t))return t.invert(o.ssqrt(e));throw new Error("Could not invert due to no input being a variable")}function Io(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 xo(e,t,n,i){if(O(t))return t.invert(o.iteratedlog(e,Math.E,o.minabs(1e308,Se(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function $o(e,t=10,n=2){const i=o.minabs(n,1e308).toNumber();return o.iteratedlog(e,t,i)}function Eo(e,t=10){const n=o.minabs(t,1e308).toNumber();return o.slog(e,n)}function Do(e,t,n){if(O(t))return t.invert(o.tetrate(e,o.minabs(1e308,Se(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function To(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.layeradd(e,i,n)}function Po(e,t,n,i){if(O(t))return t.invert(o.layeradd(e,o.minabs(1e308,Se(n)).negate().toNumber()));throw new Error("Could not invert due to no input being a variable")}function Ao(e,t){if(O(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 Ro(e,t){if(O(t))return t.invert(o.tetrate(e,2));throw new Error("Could not invert due to no input being a variable")}function Fo(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.pentate(e,i,n)}function Oo(e,t){if(O(t))return t.invert(o.asin(e));throw new Error("Could not invert due to no input being a variable")}function qo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.cos(n).neg()}throw new Error("Could not integrate due to no input being a variable")}function Vo(e,t){if(O(t))return t.invert(o.acos(e));throw new Error("Could not invert due to no input being a variable")}function Bo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.sin(n)}throw new Error("Could not integrate due to no input being a variable")}function Lo(e,t){if(O(t))return t.invert(o.atan(e));throw new Error("Could not invert due to no input being a variable")}function jo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.cos(n).ln().neg()}throw new Error("Could not integrate due to no input being a variable")}function zo(e,t){if(O(t))return t.invert(o.sin(e));throw new Error("Could not invert due to no input being a variable")}function Go(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.asin(n).times(n).add(m.sqrt(m.sub(1,m.pow(n,2))))}throw new Error("Could not integrate due to no input being a variable")}function Uo(e,t){if(O(t))return t.invert(o.cos(e));throw new Error("Could not invert due to no input being a variable")}function Wo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.acos(n).times(n).sub(m.sqrt(m.sub(1,m.pow(n,2))))}throw new Error("Could not integrate due to no input being a variable")}function Ho(e,t){if(O(t))return t.invert(o.tan(e));throw new Error("Could not invert due to no input being a variable")}function Yo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.atan(n).times(n).sub(m.ln(m.pow(n,2).add(1)).div(2))}throw new Error("Could not integrate due to no input being a variable")}function Zo(e,t){if(O(t))return t.invert(o.asinh(e));throw new Error("Could not invert due to no input being a variable")}function Xo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.cosh(n)}throw new Error("Could not integrate due to no input being a variable")}function Ko(e,t){if(O(t))return t.invert(o.acosh(e));throw new Error("Could not invert due to no input being a variable")}function Jo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.sinh(n)}throw new Error("Could not integrate due to no input being a variable")}function Qo(e,t){if(O(t))return t.invert(o.atanh(e));throw new Error("Could not invert due to no input being a variable")}function el(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.cosh(n).ln()}throw new Error("Could not integrate due to no input being a variable")}function tl(e,t){if(O(t))return t.invert(o.sinh(e));throw new Error("Could not invert due to no input being a variable")}function nl(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.asinh(n).times(n).sub(m.pow(n,2).add(1).sqrt())}throw new Error("Could not integrate due to no input being a variable")}function il(e,t){if(O(t))return t.invert(o.cosh(e));throw new Error("Could not invert due to no input being a variable")}function rl(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.acosh(n).times(n).sub(m.add(n,1).sqrt().times(m.sub(n,1).sqrt()))}throw new Error("Could not integrate due to no input being a variable")}function al(e,t){if(O(t))return t.invert(o.tanh(e));throw new Error("Could not invert due to no input being a variable")}function sl(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.atanh(n).times(n).add(m.sub(1,m.pow(n,2)).ln().div(2))}throw new Error("Could not integrate due to no input being a variable")}function Rn(e){return(t,n)=>new m({inputs:[t,n],evaluate:e,invert:jn})}function O(e){return e instanceof Te&&e.hasVariable()}function Se(e,t){return e instanceof Te?e.evaluate(t):s(e)}function ol(){return m.pow(this,2).div(2)}function ll(){return this}const Oe=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"&&Tt in n?n[Tt]:n)),"variable"in e?(typeof e.variable=="object"&&Tt in e.variable&&(e.variable=e.variable[Tt]),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:ol,internalIntegrateInner:ll,applySubstitution:jn}}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 b,v;const{inputs:t,evaluate:n,invert:i,integrate:r,integrateInner:a,applySubstitution:u}=e,l=t.reduce((y,N)=>y+(N instanceof Oe?N.internalVariables:0),0),c=t.find(y=>y instanceof Oe&&y.hasVariable()),p=l===1?c==null?void 0:c.innermostVariable:void 0,h=(b=c==null?void 0:c.isInvertible())!=null?b:!1,f=(v=c==null?void 0:c.isIntegrable())!=null?v:!1;return{inputs:t,internalEvaluate:n,internalInvert:h?i:void 0,internalIntegrate:f?r:void 0,internalIntegrateInner:a,applySubstitution:u,innermostVariable:p,internalVariables:l}}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=>Se(r,e))))!=null?n:this.hasVariable()?e:null)!=null?i:Se(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof Oe&&e.inputs[n]instanceof Oe?t.equals(e.inputs[n]):!(t instanceof Oe)&&!(e.inputs[n]instanceof Oe)&&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 m({inputs:[e]})}static variable(e){return new m({variable:e})}static step(e,t,n){const i=n(m.variable(0)),r=_e(t);function a(l){return o.lt(l,s(r))?l:o.add(i.evaluate(o.sub(l,s(r))),s(r))}function u(l,c){if(O(c)&&i.isInvertible())return o.gt(l,s(r))&&(l=o.add(i.invert(o.sub(l,s(r))),s(r))),c.invert(l);throw new Error("Could not invert due to no input being a variable")}return new m({inputs:[e],evaluate:a,invert:i.isInvertible()&&i.hasVariable()?u:void 0})}static if(e,t,n,i){const r=G(0),a=m.variable(r),u=n(a),l=i==null?void 0:i(a),c=_e(t);function p(f){return s(c)?(r.value=f,u.evaluate()):l?(r.value=f,l.evaluate()):f}function h(f,b){if(!O(b)||!u.isInvertible()||l!=null&&!l.isInvertible())throw new Error("Could not invert due to no input being a variable");return s(c)?b.invert(u.invert(f)):l?b.invert(l.invert(f)):b.invert(f)}return new m({inputs:[e],evaluate:p,invert:u.isInvertible()&&u.hasVariable()?h:void 0})}static conditional(e,t,n,i){return m.if(e,t,n,i)}static abs(e){return new m({inputs:[e],evaluate:o.abs})}static neg(e){return new m({inputs:[e],evaluate:o.neg,invert:Rs,applySubstitution:Os,integrate:Fs})}static sign(e){return new m({inputs:[e],evaluate:o.sign})}static round(e){return new m({inputs:[e],evaluate:o.round})}static floor(e){return new m({inputs:[e],evaluate:o.floor})}static ceil(e){return new m({inputs:[e],evaluate:o.ceil})}static trunc(e){return new m({inputs:[e],evaluate:o.trunc})}static add(e,t){return new m({inputs:[e,t],evaluate:o.add,invert:qs,integrate:Vs,integrateInner:Bs,applySubstitution:jn})}static sub(e,t){return new m({inputs:[e,t],evaluate:o.sub,invert:Ls,integrate:js,integrateInner:zs,applySubstitution:jn})}static mul(e,t){return new m({inputs:[e,t],evaluate:o.mul,invert:Gs,integrate:Us,applySubstitution:Ws})}static div(e,t){return new m({inputs:[e,t],evaluate:o.div,invert:Hs,integrate:Ys,applySubstitution:Zs})}static recip(e){return new m({inputs:[e],evaluate:o.recip,invert:Xs,integrate:Ks})}static clamp(e,t,n){return new m({inputs:[e,t,n],evaluate:o.clamp,invert:jn})}static pLog10(e){return new m({inputs:[e],evaluate:o.pLog10})}static absLog10(e){return new m({inputs:[e],evaluate:o.absLog10})}static log10(e){return new m({inputs:[e],evaluate:o.log10,invert:Js,integrate:to})}static log(e,t){return new m({inputs:[e,t],evaluate:o.log,invert:no,integrate:ao})}static log2(e){return new m({inputs:[e],evaluate:o.log2,invert:so,integrate:uo})}static ln(e){return new m({inputs:[e],evaluate:o.ln,invert:co,integrate:go})}static pow(e,t){return new m({inputs:[e,t],evaluate:o.pow,invert:mo,integrate:vo})}static pow10(e){return new m({inputs:[e],evaluate:o.pow10,invert:ho,integrate:bo})}static pow_base(e,t){return new m({inputs:[e,t],evaluate:o.pow_base,invert:yo,integrate:wo})}static root(e,t){return new m({inputs:[e,t],evaluate:o.root,invert:_o,integrate:No})}static factorial(e){return new m({inputs:[e],evaluate:o.factorial})}static gamma(e){return new m({inputs:[e],evaluate:o.gamma})}static lngamma(e){return new m({inputs:[e],evaluate:o.lngamma})}static exp(e){return new m({inputs:[e],evaluate:o.exp,invert:Co,integrate:ko})}static sqr(e){return m.pow(e,2)}static sqrt(e){return m.root(e,2)}static cube(e){return m.pow(e,3)}static cbrt(e){return m.root(e,3)}static tetrate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new m({inputs:[e,t,n],evaluate:Mo,invert:So})}static iteratedexp(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new m({inputs:[e,t,n],evaluate:Io,invert:xo})}static iteratedlog(e,t=10,n=1){return new m({inputs:[e,t,n],evaluate:$o})}static slog(e,t=10){return new m({inputs:[e,t],evaluate:Eo,invert:Do})}static layeradd10(e,t){return new m({inputs:[e,t],evaluate:o.layeradd10})}static layeradd(e,t,n=10){return new m({inputs:[e,t,n],evaluate:To,invert:Po})}static lambertw(e){return new m({inputs:[e],evaluate:o.lambertw,invert:Ao})}static ssqrt(e){return new m({inputs:[e],evaluate:o.ssqrt,invert:Ro})}static pentate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new m({inputs:[e,t,n],evaluate:Fo})}static sin(e){return new m({inputs:[e],evaluate:o.sin,invert:zo,integrate:qo})}static cos(e){return new m({inputs:[e],evaluate:o.cos,invert:Uo,integrate:Bo})}static tan(e){return new m({inputs:[e],evaluate:o.tan,invert:Ho,integrate:jo})}static asin(e){return new m({inputs:[e],evaluate:o.asin,invert:Oo,integrate:Go})}static acos(e){return new m({inputs:[e],evaluate:o.acos,invert:Vo,integrate:Wo})}static atan(e){return new m({inputs:[e],evaluate:o.atan,invert:Lo,integrate:Yo})}static sinh(e){return new m({inputs:[e],evaluate:o.sinh,invert:tl,integrate:Xo})}static cosh(e){return new m({inputs:[e],evaluate:o.cosh,invert:il,integrate:Jo})}static tanh(e){return new m({inputs:[e],evaluate:o.tanh,invert:al,integrate:el})}static asinh(e){return new m({inputs:[e],evaluate:o.asinh,invert:Zo,integrate:nl})}static acosh(e){return new m({inputs:[e],evaluate:o.acosh,invert:Ko,integrate:rl})}static atanh(e){return new m({inputs:[e],evaluate:o.atanh,invert:Qo,integrate:sl})}step(e,t){return m.step(this,e,t)}if(e,t){return m.if(this,e,t)}conditional(e,t){return m.if(this,e,t)}abs(){return m.abs(this)}neg(){return m.neg(this)}sign(){return m.sign(this)}round(){return m.round(this)}floor(){return m.floor(this)}ceil(){return m.ceil(this)}trunc(){return m.trunc(this)}add(e){return m.add(this,e)}sub(e){return m.sub(this,e)}mul(e){return m.mul(this,e)}div(e){return m.div(this,e)}recip(){return m.recip(this)}max(e){return m.max(this,e)}min(e){return m.min(this,e)}maxabs(e){return m.maxabs(this,e)}minabs(e){return m.minabs(this,e)}clamp(e,t){return m.clamp(this,e,t)}clampMin(e){return m.clampMin(this,e)}clampMax(e){return m.clampMax(this,e)}pLog10(){return m.pLog10(this)}absLog10(){return m.absLog10(this)}log10(){return m.log10(this)}log(e){return m.log(this,e)}log2(){return m.log2(this)}ln(){return m.ln(this)}pow(e){return m.pow(this,e)}pow10(){return m.pow10(this)}pow_base(e){return m.pow_base(this,e)}root(e){return m.root(this,e)}factorial(){return m.factorial(this)}gamma(){return m.gamma(this)}lngamma(){return m.lngamma(this)}exp(){return m.exp(this)}sqr(){return m.pow(this,2)}sqrt(){return m.root(this,2)}cube(){return m.pow(this,3)}cbrt(){return m.root(this,3)}tetrate(e=2,t=o.fromComponents_noNormalize(1,0,1)){return m.tetrate(this,e,t)}iteratedexp(e=2,t=o.fromComponents_noNormalize(1,0,1)){return m.iteratedexp(this,e,t)}iteratedlog(e=10,t=1){return m.iteratedlog(this,e,t)}slog(e=10){return m.slog(this,e)}layeradd10(e){return m.layeradd10(this,e)}layeradd(e,t){return m.layeradd(this,e,t)}lambertw(){return m.lambertw(this)}ssqrt(){return m.ssqrt(this)}pentate(e=2,t=o.fromComponents_noNormalize(1,0,1)){return m.pentate(this,e,t)}sin(){return m.sin(this)}cos(){return m.cos(this)}tan(){return m.tan(this)}asin(){return m.asin(this)}acos(){return m.acos(this)}atan(){return m.atan(this)}sinh(){return m.sinh(this)}cosh(){return m.cosh(this)}tanh(){return m.tanh(this)}asinh(){return m.asinh(this)}acosh(){return m.acosh(this)}atanh(){return m.atanh(this)}};let Te=Oe;Te.negate=Oe.neg;Te.negated=Oe.neg;Te.sgn=Oe.sign;Te.plus=Oe.add;Te.subtract=Oe.sub;Te.minus=Oe.sub;Te.multiply=Oe.mul;Te.times=Oe.mul;Te.divide=Oe.div;Te.divideBy=Oe.div;Te.dividedBy=Oe.div;Te.reciprocal=Oe.recip;Te.reciprocate=Oe.recip;Te.max=Rn(o.max);Te.min=Rn(o.min);Te.minabs=Rn(o.minabs);Te.maxabs=Rn(o.maxabs);Te.clampMin=Rn(o.clampMin);Te.clampMax=Rn(o.clampMax);Te.logarithm=Oe.log;class m extends Te{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 Rr(e,t,n=!0,i,r=o.dInf){const a=_e(n),u=_e(i),l=_e(r);return C(()=>{var b,v,y,N;const c=s(l);if(o.eq(c,1))return o.gte(t.value,e.evaluate())?o.dOne:o.dZero;const p=s(a),h=(b=s(u))!=null?b:p?10:0;let f=0;if(o.gt(c,h)){if(!e.isInvertible())throw new Error("Cannot calculate max affordable of non-invertible formula with more maxBulkAmount than directSum");if(p){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((v=s(e.innermostVariable))!=null?v:0)}else f=o.floor(e.invert(t.value))}if(f=o.clampMax(f,c),h>0){const x=f;f=o.sub(f,h).clampMin(0);let E;for(p?E=nn(e,f,!0,0):E=e.evaluate(o.add((y=s(e.innermostVariable))!=null?y:0,f));o.lt(f,c)&&o.lt(f,Number.MAX_SAFE_INTEGER)&&o.add(x,1).gte(f);){const I=e.evaluate(f.add((N=s(e.innermostVariable))!=null?N:0));if(o.add(E,I).lte(t.value))f=f.add(1),E=o.add(E,I);else break}}return f})}function nn(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 u=a;i!=null||(i=n?10:0),a=a.sub(i).clampMin(r);let l=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(l=o.sub(e.evaluateIntegral(a),e.evaluateIntegral()),u.gt(1e308))return o.add(l,o.sub(u,a).times(e.evaluate(a)))}else if(l=e.evaluate(a),a=a.add(1),u.gt(1e308))return o.sub(u,a).add(1).times(l)}for(let p=a.toNumber();p<u.toNumber();p++)l=o.add(l,e.evaluate(p));return l}const rn=Symbol("PersistentState"),Zt=Symbol("DefaultValue"),pi=Symbol("StackTrace"),fi=Symbol("Deleted"),Tt=Symbol("NonPersistent"),fn=Symbol("SaveDataPath"),Kn=Symbol("SkipPersistence");function ul(){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 fr(e,t){var n;if(o.isNaN(t))throw We.hasNaN||(X.autosave=!1,We.hasNaN=!0,We.NaNPath=e[fn],We.NaNPersistent=e),console.error("Attempted to save NaN value to",(n=e[fn])==null?void 0:n.join("."),e),new Error("Attempted to set NaN value. See above for details");e[rn].value=t}function ut(e,t=!0){const n=Fe(e)?e:G(e);Fe(e)&&(e=e.value);const i=C({get(){return n.value},set(a){t?fr(r,a):r[rn].value=a}});i[Zt]=e;const r={get value(){return n.value},set value(a){t?fr(r,a):r[rn].value=a},__v_isRef:!0,[rn]:n,[Zt]:e,[pi]:ul(),[fi]:!1,[Tt]:i,[fn]:void 0};return dt.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",r,`
|
|
Created at:
|
|
`+r[pi]):gn[dt[dt.length-1]].add(r),r}function cl(e){return e!=null&&typeof e=="object"&&rn in e}function Sn(e){return!(en in e)&&Tt in e?e[Tt]:new Proxy(e,{get(t,n){if(n!==rn)return n===Kn?!0:t[n]},set(t,n,i){return t[n]=i,!0},has(t,n){return n===rn?!1:n==Kn?!0:Reflect.has(t,n)}})}function Fr(e){dt.length===0?console.warn("Deleting a persistent ref outside of a layer. Ignoring...",e):gn[dt[dt.length-1]].delete(e),e[fi]=!0}tt.on("addLayer",(e,t)=>{const n=[],i=(r,a=[])=>{let u=!1;return Object.keys(r).forEach(l=>{let c=r[l];if(c!=null&&typeof c=="object"){if(c[Kn]===!0)return;if(en in c&&(c=c[en]),cl(c)){if(u=!0,c[fi]){console.warn("Deleted persistent ref present in returned object. Ignoring...",c,`
|
|
Created at:
|
|
`+c[pi]);return}gn[e.id].delete(c);const p=[e.id,...a,l];c[fn]!=null&&JSON.stringify(p)!==JSON.stringify(c[fn])&&console.error(`Persistent ref is being saved to \`${p.join(".")}\` when it's already present at \`${c[fn].join(".")}\`. This can cause unexpected behavior when loading saves between updates.`,c),c[fn]=p;const h=a.reduce((b,v)=>(v in b||(b[v]={}),b[v]),t),f=h[l];h[l]=c[rn],sa(h)?f!=null?h[l]=f:h[l]=c[Zt]:f!=null?h[l].value=f:h[l].value=c[Zt]}else!(c instanceof o)&&!(c instanceof m)&&!Fe(c)&&!n.includes(c)&&(typeof c.type=="symbol"&&n.push(c),i(c,[...a,l])&&(At(c)&&!At(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.",en in r?r[en]:r,l):u=!0))}}),u};i(e[en]),gn[e.id].forEach(r=>{r[fi]||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[pi])}),gn[e.id].clear()});const Ui=Symbol("RegisterNode"),Wi=Symbol("UnregisterNode"),Hi=Symbol("Nodes"),Yi=Symbol("Bounds"),ge=Li({});window.layers=ge;const gn={},dt=[];function Zi(e,t){return Qe(()=>{const n={},i=n.emitter=_r();if(n.on=i.on.bind(i),n.emit=i.emit.bind(i),n.nodes=G({}),n.id=e,dt.push(e),gn[e]=new Set,n.minimized=ut(!1,!1),Object.assign(n,t.call(n,n)),dt[dt.length-1]==null||dt[dt.length-1]!==e)throw`Adding layers stack in invalid state. This should not happen
|
|
Stack: ${dt}
|
|
Trying to pop ${n.id}`;dt.pop(),D(n,"color"),D(n,"display"),D(n,"classes"),D(n,"style"),D(n,"name"),oe(n,"name",n.id),D(n,"minWidth"),oe(n,"minWidth",600),D(n,"minimizable"),oe(n,"minimizable",!0),D(n,"minimizedDisplay");const r=n.style;return n.style=C(()=>{var u,l;let a=s(n.minWidth);return(typeof a=="number"||!Number.isNaN(parseInt(a)))&&(a=a+"px"),[(u=s(r))!=null?u:"",(l=n.minimized)!=null&&l.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:a,flexBasis:a,margin:""}]}),n})}function Xi(e,t){if(console.info("Adding layer",e.id),ge[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,ge[e.id]);return}oe(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),ge[e.id]=e,tt.emit("addLayer",e,t.layers[e.id])}function dl(e){return ge[e]}function Ki(e){console.info("Removing layer",e.id),tt.emit("removeLayer",e),ge[e.id]=void 0}function pl(e){Ki(e),Xi(e,X)}function fl(e){const t=G(!1);return{openModal:()=>t.value=!0,modal:z(()=>d(Rt,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},{header:()=>d("h2",null,[s(e.name)]),body:s(e.display)}))}}tt.on("update",function(t){Object.values(ge).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(ge).forEach(n=>{n==null||n.emit("update",t)}),Object.values(ge).forEach(n=>{n==null||n.emit("postUpdate",t)})});var gl=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:Ui,UnregisterNodeInjectionKey:Wi,NodesInjectionKey:Hi,BoundsInjectionKey:Yi,layers:ge,persistentRefs:gn,addingLayers:dt,createLayer:Zi,addLayer:Xi,getLayer:dl,removeLayer:Ki,reloadLayer:pl,setupLayerModal:fl},Symbol.toStringTag,{value:"Module"}));const ml=K({components:{Context:Pr},props:{index:{type:Number,required:!0},display:{type:q(Object,String,Function),required:!0},minimizedDisplay:q(Object,String,Function),minimized:{type:Object,required:!0},name:{type:q(String),required:!0},color:q(String),minimizable:q(Boolean),nodes:{type:Object,required:!0}},emits:["setMinimized"],setup(e){const{display:t,index:n,minimized:i,minimizedDisplay:r}=De(e),a=Gi(t),u=An(r),l=C(()=>we.allowGoBack&&n.value>0&&!Ee(i));function c(){X.tabs.splice(s(e.index),1/0)}function p(h){e.nodes.value=h}return{component:a,minimizedComponent:u,showGoBack:l,updateNodes:p,unref:s,goBack:c}}}),vl={key:1};function hl(e,t,n,i,r,a){const u=kt("Context");return S(),A("div",{class:"layer-container",style:Be({"--layer-color":e.unref(e.color)})},[e.showGoBack?(S(),A("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...l)=>e.goBack&&e.goBack(...l))},"\u274C")):j("",!0),e.unref(e.minimized)?(S(),A("button",{key:1,class:"layer-tab minimized",onClick:t[1]||(t[1]=l=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(S(),te(Je(e.minimizedComponent),{key:0})):(S(),A("div",vl,de(e.unref(e.name)),1))])):(S(),A("div",{key:2,class:Ne(["layer-tab",{showGoBack:e.showGoBack}])},[d(u,{onUpdateNodes:e.updateNodes},{default:Z(()=>[(S(),te(Je(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(S(),A("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=l=>e.$emit("setMinimized",!0))}," \u25BC ")):j("",!0)],4)}var bl=ve(ml,[["render",hl],["__scopeId","data-v-72dd78b1"]]);const Or=e=>(vn("data-v-4b4bda40"),e=e(),hn(),e),yl=Or(()=>k("h2",null,"Changelog",-1)),wl=Or(()=>k("details",{open:""},[k("summary",null,[_("v0.0 Initial Commit - "),k("time",null,"2021-09-04")]),_(" This is the first release :D "),k("ul",null,[k("li",{class:"feature"},"Did everything"),k("li",{class:"fix"},"Had some fun"),k("li",{class:"breaking"},"Removed everything"),k("li",{class:"balancing"},"Created some bugs to fix later")])],-1)),_l=K({__name:"Changelog",setup(e,{expose:t}){const n=G(!1);return t({open(){n.value=!0}}),(i,r)=>(S(),te(Rt,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a)},{header:Z(()=>[yl]),body:Z(()=>[wl]),_:1},8,["modelValue"]))}});var Nl=ve(_l,[["__scopeId","data-v-4b4bda40"]]),Cl=K({props:{element:Object,display:{type:q(Object,String,Function),required:!0},style:q(Object,String,Array),classes:q(Object),direction:q(String),xoffset:q(String),yoffset:q(String),pinned:Object},setup(e){const{element:t,display:n,pinned:i}=De(e),r=G(!1),a=C(()=>(Ee(i)||r.value)&&u.value),u=An(n),l=bt(pe(z(()=>{const h=Ee(t);return h==null?"":wt(h)})));function c(h){const f=i;h.shiftKey&&f&&(f.value=!f.value,h.stopPropagation(),h.preventDefault())}const p=C(()=>Ee(i)&&Ct[ce.theme].showPin);return{Direction:H,isHovered:r,isShown:a,comp:u,elementComp:l,unref:s,togglePinned:c,showPin:p}}});const kl={key:0,class:"material-icons pinned"};function Ml(e,t,n,i,r,a){return S(),A("div",{class:Ne(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=u=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=u=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...u)=>e.togglePinned&&e.togglePinned(...u))},[Pt(e.$slots,"default",{},void 0,!0),e.elementComp?(S(),te(Je(e.elementComp),{key:0})):j("",!0),d(Un,{name:"fade"},{default:Z(()=>{var u;return[e.isShown?(S(),A("div",{key:0,class:Ne(["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:Be([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(u=e.unref(e.style))!=null?u:{}])},[e.showPin?(S(),A("span",kl,"push_pin")):j("",!0),e.comp?(S(),te(Je(e.comp),{key:1})):j("",!0)],6)):j("",!0)]}),_:1})],34)}var Re=ve(Cl,[["render",Ml],["__scopeId","data-v-6102fa3a"]]);const yn=e=>(vn("data-v-4f97aa40"),e=e(),hn(),e),Sl={class:"info-modal-header"},Il=["src","alt"],xl={class:"info-modal-title"},$l={key:0},El={key:0},Dl={key:0},Tl=yn(()=>k("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),Pl=yn(()=>k("br",null,null,-1)),Al=yn(()=>k("br",null,null,-1)),Rl=["href"],Fl=yn(()=>k("span",{class:"material-icons info-modal-discord"},"discord",-1)),Ol=yn(()=>k("div",null,[k("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[k("span",{class:"material-icons info-modal-discord"},"discord"),_(" The Paper Pilot Community ")])],-1)),ql=yn(()=>k("div",null,[k("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[k("span",{class:"material-icons info-modal-discord"},"discord"),_(" The Modding Tree ")])],-1)),Vl=yn(()=>k("br",null,null,-1));var Bl=K({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:i,logo:r,author:a,discordName:u,discordLink:l,versionNumber:c,versionTitle:p}=we,h=De(n),f=G(!1),b=C(()=>bi(X.timePlayed)),v=C(()=>pe(z(()=>d(re,null,[ws.map(lt)]))));t({open(){f.value=!0}});function y(){var N;(N=s(h.changelog))==null||N.open()}return(N,x)=>(S(),te(Rt,{modelValue:f.value,"onUpdate:modelValue":x[0]||(x[0]=E=>f.value=E)},{header:Z(()=>[k("div",Sl,[s(r)?(S(),A("img",{key:0,class:"info-modal-logo",src:s(r),alt:s(i)},null,8,Il)):j("",!0),k("div",xl,[k("h2",null,de(s(i)),1),k("h4",null,[_(" v"+de(s(c)),1),s(p)?(S(),A("span",$l,": "+de(s(p)),1)):j("",!0)])])])]),body:Z(({shown:E})=>[E?(S(),A("div",El,[s(a)?(S(),A("div",Dl,"By "+de(s(a)),1)):j("",!0),Tl,Pl,k("div",{class:"link",onClick:y},"Changelog"),Al,k("div",null,[s(l)?(S(),A("a",{key:0,href:s(l),class:"info-modal-discord-link",target:"_blank"},[Fl,_(" "+de(s(u)),1)],8,Rl)):j("",!0)]),Ol,ql,Vl,k("div",null,"Time Played: "+de(s(b)),1),(S(),te(Je(s(v))))])):j("",!0)]),_:1},8,["modelValue"]))}});var Ll=ve(Bl,[["__scopeId","data-v-4f97aa40"]]);const jl={class:"field"},zl={key:0,class:"field-title"},Ji=K({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var u;const n=e,i=An(an(n,"title"),"span"),r=G((u=n.options.find(l=>l.value===n.modelValue))!=null?u:null);ht(an(n,"modelValue"),l=>{var c;Ee(r)!==l&&(r.value=(c=n.options.find(p=>p.value===l))!=null?c:null)});function a(l){t("update:modelValue",l.value)}return(l,c)=>(S(),A("div",jl,[s(i)?(S(),A("span",zl,[(S(),te(Je(s(i))))])):j("",!0),d(s(pa),{options:e.options,modelValue:r.value,"onUpdate:modelValue":[c[0]||(c[0]=p=>r.value=p),a],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}});const Gl={class:"field"},Ul=K({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,i=C(()=>{var a;return pe((a=s(n.title))!=null?a:"<span></span>","span")}),r=C({get(){return!!n.modelValue},set(a){t("update:modelValue",a)}});return(a,u)=>(S(),A("label",Gl,[Bi(k("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":u[0]||(u[0]=l=>Fe(r)?r.value=l:null)},null,512),[[oa,s(r)]]),(S(),te(Je(s(i))))]))}});var Gt=ve(Ul,[["__scopeId","data-v-11046116"]]);const Wl=["onClick"],Hl=K({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=G(!1),i=G(null);function r(){t("click"),i.value&&clearTimeout(i.value),n.value=!1,Ht(()=>{n.value=!0,i.value=setTimeout(()=>n.value=!1,500)})}return(a,u)=>(S(),A("button",{onClick:Dn(r,["stop"]),class:Ne(["feedback",{activated:n.value,left:e.left}])},[Pt(a.$slots,"default",{},void 0,!0)],10,Wl))}});var qr=ve(Hl,[["__scopeId","data-v-01a1b95c"]]);const Yl={class:"header"},Zl=k("h2",null,"Settings",-1),Xl={class:"option-tabs"},Kl={key:0},Jl={key:1};var Ql=K({__name:"Options",setup(e,{expose:t}){const n=G(!1),i=G("behaviour");function r(ae){return ae==i.value}function a(ae){i.value=ae}t({isTab:r,setTab:a,save:vt,open(){n.value=!0}});const u=Object.keys(Ct).map(ae=>({label:at(ae),value:ae})),l=C(()=>pe(z(()=>d(re,null,[Er.map(lt)])))),{showTPS:c,theme:p,unthrottled:h,alignUnits:f}=De(ce),{autosave:b,offlineProd:v}=De(X),y=C({get(){return X.devSpeed===0},set(ae){X.devSpeed=ae?0:null}}),N=z(()=>d("span",{class:"option-title"},[_("Unthrottled"),d("desc",null,[_("Allow the game to run as fast as possible. Not battery friendly.")])])),x=z(()=>d("span",{class:"option-title"},[_("Offline Production"),d(Re,{display:"Save-specific",direction:H.Right},{default:()=>[_("*")]}),d("desc",null,[_("Simulate production that occurs while the game is closed.")])])),E=z(()=>d("span",{class:"option-title"},[_("Autosave"),d(Re,{display:"Save-specific",direction:H.Right},{default:()=>[_("*")]}),d("desc",null,[_("Automatically save the game every second or when the game is closed.")])])),I=z(()=>d("span",{class:"option-title"},[_("Pause game"),d(Re,{display:"Save-specific",direction:H.Right},{default:()=>[_("*")]}),d("desc",null,[_("Stop everything from moving.")])])),P=z(()=>d("span",{class:"option-title"},[_("Theme"),d("desc",null,[_("How the game looks.")])])),B=z(()=>d("span",{class:"option-title"},[_("Show TPS"),d("desc",null,[_("Show TPS meter at the bottom-left corner of the page.")])])),le=z(()=>d("span",{class:"option-title"},[_("Align modifier units"),d("desc",null,[_("Align numbers to the beginning of the unit in modifier view.")])]));return(ae,ne)=>(S(),te(Rt,{modelValue:n.value,"onUpdate:modelValue":ne[10]||(ne[10]=Q=>n.value=Q)},{header:Z(()=>[k("div",Yl,[Zl,k("div",Xl,[k("button",{class:Ne({selected:r("behaviour")}),onClick:ne[0]||(ne[0]=Q=>a("behaviour"))},"Behaviour",2),k("button",{class:Ne({selected:r("appearance")}),onClick:ne[1]||(ne[1]=Q=>a("appearance"))},"Appearance",2)])])]),body:Z(()=>[r("behaviour")?(S(),A("div",Kl,[d(Gt,{title:s(N),modelValue:s(h),"onUpdate:modelValue":ne[2]||(ne[2]=Q=>Fe(h)?h.value=Q:null)},null,8,["title","modelValue"]),s(we).enablePausing?(S(),te(Gt,{key:0,title:s(I),modelValue:s(y),"onUpdate:modelValue":ne[3]||(ne[3]=Q=>Fe(y)?y.value=Q:null)},null,8,["title","modelValue"])):j("",!0),d(Gt,{title:s(x),modelValue:s(v),"onUpdate:modelValue":ne[4]||(ne[4]=Q=>Fe(v)?v.value=Q:null)},null,8,["title","modelValue"]),d(Gt,{title:s(E),modelValue:s(b),"onUpdate:modelValue":ne[5]||(ne[5]=Q=>Fe(b)?b.value=Q:null)},null,8,["title","modelValue"]),s(b)?j("",!0):(S(),te(qr,{key:1,class:"button save-button",onClick:ne[6]||(ne[6]=Q=>s(vt)())},{default:Z(()=>[_("Manually save")]),_:1}))])):j("",!0),r("appearance")?(S(),A("div",Jl,[d(Ji,{title:s(P),options:s(u),modelValue:s(p),"onUpdate:modelValue":ne[7]||(ne[7]=Q=>Fe(p)?p.value=Q:null)},null,8,["title","options","modelValue"]),(S(),te(Je(s(l)))),d(Gt,{title:s(B),modelValue:s(c),"onUpdate:modelValue":ne[8]||(ne[8]=Q=>Fe(c)?c.value=Q:null)},null,8,["title","modelValue"]),d(Gt,{title:s(le),modelValue:s(f),"onUpdate:modelValue":ne[9]||(ne[9]=Q=>Fe(f)?f.value=Q:null)},null,8,["title","modelValue"])])):j("",!0)]),_:1},8,["modelValue"]))}});const eu=["onSubmit"],tu={class:"field"},nu={key:0,class:"field-title"},iu=["placeholder"],ru=K({__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=An(an(n,"title"),"span"),r=bt(null);vi(()=>{var c;(c=r.value)==null||c.focus()});const a=C({get(){var c;return(c=s(n.modelValue))!=null?c:""},set(c){t("update:modelValue",c)}});function u(){t("submit")}function l(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(c,p)=>(S(),A("form",{onSubmit:Dn(u,["prevent"])},[k("div",tu,[s(i)?(S(),A("span",nu,[(S(),te(Je(s(i))))])):j("",!0),e.textArea?(S(),te(s(ga),{key:1,modelValue:s(a),"onUpdate:modelValue":p[0]||(p[0]=h=>Fe(a)?a.value=h:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:l,ref_key:"field",ref:r},null,8,["modelValue","placeholder","maxHeight"])):Bi((S(),A("input",{key:2,type:"text","onUpdate:modelValue":p[1]||(p[1]=h=>Fe(a)?a.value=h:null),placeholder:e.placeholder,class:Ne({fullWidth:!e.title}),onBlur:l,ref_key:"field",ref:r},null,42,iu)),[[la,s(a)]])])],40,eu))}});var Vr=ve(ru,[["__scopeId","data-v-90bd4994"]]);const au={key:0},su=["onClick","disabled"],ou={key:0},lu=["onClick"],uu=K({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const i=De(e),r=G(!1);ht(r,l=>{t("confirmingChanged",l)});function a(){if(s(i.skipConfirm)){t("click");return}r.value&&t("click"),r.value=!r.value}function u(){r.value=!1}return(l,c)=>(S(),A("span",{class:Ne(["container",{confirming:r.value}])},[r.value?(S(),A("span",au,"Are you sure?")):j("",!0),k("button",{onClick:Dn(a,["stop"]),class:"button danger",disabled:e.disabled},[r.value?(S(),A("span",ou,"Yes")):Pt(l.$slots,"default",{key:1},void 0,!0)],8,su),r.value?(S(),A("button",{key:1,class:"button",onClick:Dn(u,["stop"])},"No",8,lu)):j("",!0)],2))}});var cu=ve(uu,[["__scopeId","data-v-2f8ef34c"]]);const Kt=e=>(vn("data-v-32313015"),e=e(),hn(),e),du=Kt(()=>k("div",{class:"handle material-icons"},"drag_handle",-1)),pu={key:0,class:"actions"},fu=Kt(()=>k("span",{class:"material-icons"},"content_paste",-1)),gu=Kt(()=>k("span",{class:"material-icons"},"content_copy",-1)),mu=Kt(()=>k("span",{class:"material-icons"},"edit",-1)),vu=Kt(()=>k("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),hu={key:1,class:"actions"},bu=Kt(()=>k("span",{class:"material-icons"},"check",-1)),yu=Kt(()=>k("span",{class:"material-icons"},"close",-1)),wu={key:2,class:"details"},_u={class:"save-version"},Nu=Kt(()=>k("br",null,null,-1)),Cu={key:0},ku={key:3,class:"details"},Mu={key:4,class:"details error"},Su=Kt(()=>k("br",null,null,-1)),Iu=K({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:i}=De(n),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),a=G(!1),u=G(!1),l=G("");ht(a,()=>{var f;return l.value=(f=i.value.name)!=null?f:""});const c=C(()=>i.value!=null&&i.value.id===X.id),p=C(()=>{var f;return c.value?X.time:(f=i.value!=null&&i.value.time)!=null?f:0});function h(){t("editName",l.value),a.value=!1}return(f,b)=>(S(),A("div",{class:Ne(["save",{active:s(c)}])},[du,a.value?(S(),A("div",hu,[k("button",{onClick:h,class:"button"},[d(Re,{display:"Save",direction:s(H).Left,class:"info"},{default:Z(()=>[bu]),_:1},8,["direction"])]),k("button",{onClick:b[5]||(b[5]=v=>a.value=!a.value),class:"button"},[d(Re,{display:"Cancel",direction:s(H).Left,class:"info"},{default:Z(()=>[yu]),_:1},8,["direction"])])])):(S(),A("div",pu,[s(i).error==null&&!u.value?(S(),te(qr,{key:0,onClick:b[0]||(b[0]=v=>t("export")),class:"button",left:""},{default:Z(()=>[d(Re,{display:"Export",direction:s(H).Left,class:"info"},{default:Z(()=>[fu]),_:1},8,["direction"])]),_:1})):j("",!0),s(i).error==null&&!u.value?(S(),A("button",{key:1,onClick:b[1]||(b[1]=v=>t("duplicate")),class:"button"},[d(Re,{display:"Duplicate",direction:s(H).Left,class:"info"},{default:Z(()=>[gu]),_:1},8,["direction"])])):j("",!0),s(i).error==null&&!u.value?(S(),A("button",{key:2,onClick:b[2]||(b[2]=v=>a.value=!a.value),class:"button"},[d(Re,{display:"Edit Name",direction:s(H).Left,class:"info"},{default:Z(()=>[mu]),_:1},8,["direction"])])):j("",!0),d(cu,{disabled:s(c),onClick:b[3]||(b[3]=v=>t("delete")),onConfirmingChanged:b[4]||(b[4]=v=>u.value=v)},{default:Z(()=>[d(Re,{display:"Delete",direction:s(H).Left,class:"info"},{default:Z(()=>[vu]),_:1},8,["direction"])]),_:1},8,["disabled"])])),s(i).error==null&&!a.value?(S(),A("div",wu,[k("button",{class:"button open",onClick:b[6]||(b[6]=v=>t("open"))},[k("h3",null,de(s(i).name),1)]),k("span",_u,"v"+de(s(i).modVersion),1),Nu,s(p)?(S(),A("div",Cu,"Last played "+de(s(r).format(s(p))),1)):j("",!0)])):s(i).error==null&&a.value?(S(),A("div",ku,[d(Vr,{modelValue:l.value,"onUpdate:modelValue":b[7]||(b[7]=v=>l.value=v),class:"editname",onSubmit:h},null,8,["modelValue"])])):(S(),A("div",Mu,[_(" Error: Failed to load save with id "+de(s(i).id),1),Su,_(de(s(i).error),1)]))],2))}});var xu=ve(Iu,[["__scopeId","data-v-32313015"]]);const Qi=e=>(vn("data-v-2a4275be"),e=e(),hn(),e),$u=Qi(()=>k("h2",null,"Saves Manager",-1)),Eu={class:"modal-footer"},Du={class:"field"},Tu=Qi(()=>k("span",{class:"field-title"},"Create Save",-1)),Pu={class:"field-buttons"},Au={class:"footer"},Ru=Qi(()=>k("div",{style:{"flex-grow":"1"}},null,-1)),Fu=K({__name:"SavesManager",setup(e,{expose:t}){const n=G(!1),i=G(null);t({open(){n.value=!0}});const r=G(!1),a=G(""),u=G(null);ht(a,I=>{I?Ht(()=>{try{if(I[0]!=="{")if(I[0]==="e")I=decodeURIComponent(escape(atob(I)));else if(I[0]==="\u1BE1")I=tn.decompressFromUTF16(I);else{console.warn("Unable to determine preset encoding",I),r.value=!0;return}const P=JSON.parse(I);if(typeof P!="object"){r.value=!0;return}const B=ui();P.id=B,vt(P),a.value="",r.value=!1,ce.saves.push(B)}catch{r.value=!0}}):r.value=!1});let l={},c=G(Object.keys(l).reduce((I,P)=>(I.push({label:P.split("/").slice(-1)[0].slice(0,-4),value:l[P]}),I),[]));const p=Li({});function h(I){if(p[I]==null){let P=localStorage.getItem(I);if(P==null)p[I]={error:"Save doesn't exist in localStorage",id:I};else if(P==="dW5kZWZpbmVk")p[I]={error:"Save is undefined",id:I};else try{if(P[0]!=="{")if(P[0]==="e")P=decodeURIComponent(escape(atob(P)));else if(P[0]==="\u1BE1")P=tn.decompressFromUTF16(P);else return console.warn("Unable to determine preset encoding",P),r.value=!0,p[I]={error:"Unable to determine preset encoding",id:I},p[I];p[I]={...JSON.parse(P),id:I}}catch(B){p[I]={error:B,id:I},console.warn(`SavesManager: Failed to load info about save with id ${I}:
|
|
${B}
|
|
${P}`)}}return p[I]}ht(n,I=>{I&&Object.keys(p).forEach(P=>delete p[P])});const f=C(()=>ce.saves.reduce((I,P)=>(I[P]=h(P),I),{}));function b(I){let P;switch(X.id===I?P=xr(X):P=JSON.stringify(f.value[I]),we.exportEncoding){default:console.warn(`Unknown save encoding: ${we.exportEncoding}. Defaulting to lz`);case"lz":P=tn.compressToUTF16(P);break;case"base64":P=btoa(unescape(encodeURIComponent(P)));break;case"plain":break}const B=document.createElement("textarea");B.value=P,document.body.appendChild(B),B.select(),B.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(B)}function v(I){X.id===I&&vt();const P={...f.value[I],id:ui()};vt(P),ce.saves.push(P.id)}function y(I){ce.saves=ce.saves.filter(P=>P!==I),localStorage.removeItem(I),p[I]=void 0}function N(I){f.value[X.id].time=X.time,vt(),p[X.id]=void 0,pn(f.value[I]),p[I]=void 0}function x(I){if(u.value=I,Ht(()=>{u.value=null}),I[0]!=="{")if(I[0]==="e")I=decodeURIComponent(escape(atob(I)));else if(I[0]==="\u1BE1")I=tn.decompressFromUTF16(I);else{console.warn("Unable to determine preset encoding",I);return}const P=JSON.parse(I);P.id=ui(),vt(P),ce.saves.push(P.id),N(P.id)}function E(I,P){const B=f.value[I];B!=null&&(B.name=P,X.id===I?(X.name=P,vt()):(vt(B),p[I]=void 0))}return(I,P)=>(S(),te(Rt,{modelValue:n.value,"onUpdate:modelValue":P[4]||(P[4]=B=>n.value=B),ref_key:"modal",ref:i},{header:Z(()=>[$u]),body:Z(({shown:B})=>[B?(S(),te(s(fa),{key:0,list:s(ce).saves,handle:".handle",itemKey:le=>le},{item:Z(({element:le})=>[d(xu,{save:s(f)[le],onOpen:ae=>N(le),onExport:ae=>b(le),onEditName:ae=>E(le,ae),onDuplicate:ae=>v(le),onDelete:ae=>y(le)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):j("",!0)]),footer:Z(()=>[k("div",Eu,[d(Vr,{modelValue:a.value,"onUpdate:modelValue":P[0]||(P[0]=B=>a.value=B),title:"Import Save",placeholder:"Paste your save here!",class:Ne({importingFailed:r.value})},null,8,["modelValue","class"]),k("div",Du,[Tu,k("div",Pu,[k("button",{class:"button",onClick:P[1]||(P[1]=B=>N(s(En)().id))},"New Game"),Object.keys(s(c)).length>0?(S(),te(Ji,{key:0,options:s(c),modelValue:u.value,"onUpdate:modelValue":P[2]||(P[2]=B=>x(B)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):j("",!0)])]),k("div",Au,[Ru,k("button",{class:"button modal-default-button",onClick:P[3]||(P[3]=B=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Br=ve(Fu,[["__scopeId","data-v-2a4275be"]]);const _t=e=>(vn("data-v-318a1c31"),e=e(),hn(),e),Ou=["src","alt"],qu={key:1,class:"title"},Vu=_t(()=>k("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),Bu={class:"discord"},Lu={class:"discord-links"},ju={key:0},zu=["href"],Gu=_t(()=>k("li",null,[k("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),Uu=_t(()=>k("li",null,[k("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),Wu={href:"https://forums.moddingtree.com/",target:"_blank"},Hu=_t(()=>k("span",{class:"material-icons"},"forum",-1)),Yu=_t(()=>k("span",{class:"material-icons"},"info",-1)),Zu=_t(()=>k("span",{class:"material-icons"},"library_books",-1)),Xu=_t(()=>k("span",{class:"material-icons"},"settings",-1)),Ku=_t(()=>k("span",{class:"material-icons"},"library_books",-1)),Ju=_t(()=>k("span",{class:"material-icons"},"settings",-1)),Qu=_t(()=>k("span",{class:"material-icons"},"info",-1)),ec={href:"https://forums.moddingtree.com/",target:"_blank"},tc=_t(()=>k("span",{class:"material-icons"},"forum",-1)),nc={class:"discord"},ic={class:"discord-links"},rc={key:0},ac=["href"],sc=_t(()=>k("li",null,[k("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),oc=_t(()=>k("li",null,[k("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),lc=K({__name:"Nav",setup(e){const t=G(null),n=G(null),i=G(null),r=G(null),{useHeader:a,banner:u,title:l,discordName:c,discordLink:p,versionNumber:h}=we;function f(){window.open(p,"mywindow")}return(b,v)=>(S(),A(re,null,[s(a)?(S(),A("div",Yt({key:0,class:"nav"},b.$attrs),[s(u)?(S(),A("img",{key:0,src:s(u),class:"banner",alt:s(l)},null,8,Ou)):(S(),A("div",qu,de(s(l)),1)),k("div",{onClick:v[0]||(v[0]=y=>{var N;return(N=r.value)==null?void 0:N.open()}),class:"version-container"},[d(Re,{display:"Changelog",direction:s(H).Down,class:"version"},{default:Z(()=>[k("span",null,"v"+de(s(h)),1)]),_:1},8,["direction"])]),Vu,k("div",Bu,[k("span",{onClick:f,class:"material-icons"},"discord"),k("ul",Lu,[s(p)?(S(),A("li",ju,[k("a",{href:s(p),target:"_blank"},de(s(c)),9,zu)])):j("",!0),Gu,Uu])]),k("div",null,[k("a",Wu,[d(Re,{display:"Forums",direction:s(H).Down,yoffset:"5px"},{default:Z(()=>[Hu]),_:1},8,["direction"])])]),k("div",{onClick:v[1]||(v[1]=y=>{var N;return(N=t.value)==null?void 0:N.open()})},[d(Re,{display:"Info",direction:s(H).Down,class:"info"},{default:Z(()=>[Yu]),_:1},8,["direction"])]),k("div",{onClick:v[2]||(v[2]=y=>{var N;return(N=n.value)==null?void 0:N.open()})},[d(Re,{display:"Saves",direction:s(H).Down,xoffset:"-20px"},{default:Z(()=>[Zu]),_:1},8,["direction"])]),k("div",{onClick:v[3]||(v[3]=y=>{var N;return(N=i.value)==null?void 0:N.open()})},[d(Re,{display:"Settings",direction:s(H).Down,xoffset:"-66px"},{default:Z(()=>[Xu]),_:1},8,["direction"])])],16)):(S(),A("div",Yt({key:1,class:"overlay-nav"},b.$attrs),[k("div",{onClick:v[4]||(v[4]=y=>{var N;return(N=r.value)==null?void 0:N.open()}),class:"version-container"},[d(Re,{display:"Changelog",direction:s(H).Right,xoffset:"25%",class:"version"},{default:Z(()=>[k("span",null,"v"+de(s(h)),1)]),_:1},8,["direction"])]),k("div",{onClick:v[5]||(v[5]=y=>{var N;return(N=n.value)==null?void 0:N.open()})},[d(Re,{display:"Saves",direction:s(H).Right},{default:Z(()=>[Ku]),_:1},8,["direction"])]),k("div",{onClick:v[6]||(v[6]=y=>{var N;return(N=i.value)==null?void 0:N.open()})},[d(Re,{display:"Settings",direction:s(H).Right},{default:Z(()=>[Ju]),_:1},8,["direction"])]),k("div",{onClick:v[7]||(v[7]=y=>{var N;return(N=t.value)==null?void 0:N.open()})},[d(Re,{display:"Info",direction:s(H).Right},{default:Z(()=>[Qu]),_:1},8,["direction"])]),k("div",null,[k("a",ec,[d(Re,{display:"Forums",direction:s(H).Right,xoffset:"7px"},{default:Z(()=>[tc]),_:1},8,["direction"])])]),k("div",nc,[k("span",{onClick:f,class:"material-icons"},"discord"),k("ul",ic,[s(p)?(S(),A("li",rc,[k("a",{href:s(p),target:"_blank"},de(s(c)),9,ac)])):j("",!0),sc,oc])])],16)),d(Ll,{ref_key:"info",ref:t,changelog:r.value},null,8,["changelog"]),d(Br,{ref_key:"savesManager",ref:n},null,512),d(Ql,{ref_key:"options",ref:i},null,512),d(Nl,{ref_key:"changelog",ref:r},null,512)],64))}});var Lr=ve(lc,[["__scopeId","data-v-318a1c31"]]);const uc={class:"inner-tab"},cc=K({__name:"Game",setup(e){const t=an(X,"tabs"),n=C(()=>Object.keys(ge)),i=we.useHeader;function r(a){const{display:u,minimized:l,name:c,color:p,minimizable:h,nodes:f,minimizedDisplay:b}=a;return{display:u,minimized:l,name:c,color:p,minimizable:h,nodes:f,minimizedDisplay:b}}return(a,u)=>(S(),A("div",{class:Ne(["tabs-container",{useHeader:s(i)}])},[(S(!0),A(re,null,Tn(s(t),(l,c)=>{var p,h;return S(),A("div",{key:c,class:Ne(["tab",s((p=s(ge)[l])==null?void 0:p.classes)]),style:Be(s((h=s(ge)[l])==null?void 0:h.style))},[c===0&&!s(i)?(S(),te(Lr,{key:0})):j("",!0),k("div",uc,[s(n).includes(l)?(S(),te(bl,Yt({key:0},r(s(ge)[l]),{index:c,onSetMinimized:f=>s(ge)[l].minimized.value=f}),null,16,["index","onSetMinimized"])):(S(),te(Je(l),{key:1,index:c},null,8,["index"]))])],6)}),128))],2))}});var dc=ve(cc,[["__scopeId","data-v-dcd207b4"]]);const pc=K({__name:"Sticky",setup(e){const t=G("0"),n=new ResizeObserver(r),i=bt(null);function r(){let a=i.value;if(a==null)return;let u=0;for(;a.previousSibling;){const l=a.previousSibling;l.dataset&&"vSticky"in l.dataset&&(u+=l.offsetHeight),a=l}t.value=u+"px"}return Ht(r),document.fonts.ready.then(r),vi(()=>{var u;const a=(u=i.value)==null?void 0:u.parentElement;a&&n.observe(a)}),(a,u)=>(S(),A("div",{class:"sticky",style:Be({top:t.value}),ref_key:"element",ref:i,"data-v-sticky":""},[Pt(a.$slots,"default",{},void 0,!0)],4))}});var gi=ve(pc,[["__scopeId","data-v-cccac690"]]);const fc=["x1","y1","x2","y2"],gc=K({__name:"BoardLink",props:{link:null},setup(e){const n=De(e),i=C(()=>{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=C(()=>{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,u)=>(S(),A("line",Yt({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,fc))}});var mc=ve(gc,[["__scopeId","data-v-57c4970a"]]);const vc={key:0},hc=["transform","onMousedown","onTouchstart","onMouseup","onTouchend"],bc=["fill","stroke-width","stroke"],yc=["fill"],wc=K({__name:"BoardNodeAction",props:{node:null,nodeType:null,actions:null,isSelected:{type:Boolean},selectedAction:null},emits:["clickAction"],setup(e,{emit:t}){const i=De(e),r=C(()=>me(i.nodeType.value.size,s(i.node))),a=C(()=>{var h;return(h=me(i.nodeType.value.outlineColor,s(i.node)))!=null?h:Ct[ce.theme].variables["--outline"]}),u=C(()=>{var h;return(h=me(i.nodeType.value.titleColor,s(i.node)))!=null?h:Ct[ce.theme].variables["--foreground"]}),l=C(()=>me(i.nodeType.value.actionDistance,s(i.node)));function c(h,f){t("clickAction",f.id),h.preventDefault(),h.stopPropagation()}function p(h,f){var b;((b=s(i.selectedAction))==null?void 0:b.id)===f.id&&(h.preventDefault(),h.stopPropagation())}return(h,f)=>(S(),te(Un,{name:"actions",appear:""},{default:Z(()=>[e.isSelected&&e.actions?(S(),A("g",vc,[(S(!0),A(re,null,Tn(e.actions,(b,v)=>{var y,N;return S(),A("g",{key:b.id,class:Ne(["action",{selected:((y=e.selectedAction)==null?void 0:y.id)===b.id}]),transform:`translate(
|
|
${(-s(r)-30)*Math.sin(((e.actions.length-1)/2-v)*s(l))},
|
|
${(s(r)+30)*Math.cos(((e.actions.length-1)/2-v)*s(l))}
|
|
)`,onMousedown:x=>c(x,b),onTouchstart:x=>c(x,b),onMouseup:x=>p(x,b),onTouchend:Dn(x=>p(x,b),["stop"])},[k("circle",{fill:s(me)(b.fillColor,e.node),r:"20","stroke-width":((N=e.selectedAction)==null?void 0:N.id)===b.id?4:0,stroke:s(a)},null,8,bc),k("text",{fill:s(u),class:"material-icons"},de(s(me)(b.icon,e.node)),9,yc)],42,hc)}),128))])):j("",!0)]),_:1}))}});var _c=ve(wc,[["__scopeId","data-v-9efb2a56"]]);const Nc=["transform"],Cc={key:0},kc=["r","fill","stroke"],Mc=["r","fill","stroke"],Sc=["r","fill"],Ic=["r","stroke-dasharray","stroke-dashoffset","stroke"],xc={key:1,transform:"rotate(45, 0, 0)"},$c=["width","height","transform","fill","stroke"],Ec=["width","height","transform","fill","stroke"],Dc=["width","height","transform","fill"],Tc=["width","height","transform","stroke-dasharray","stroke-dashoffset","stroke"],Pc=["fill","y"],Ac=["fill"],Rc=["fill","y"],Fc={key:0},Oc=["fill","y"],qc=["fill","y"],Vc=K({__name:"BoardNode",props:{node:null,nodeType:null,dragging:null,dragged:null,hasDragged:{type:Boolean},receivingNode:{type:Boolean},isSelected:{type:Boolean},selectedAction:null},emits:["mouseDown","endDragging","clickAction"],setup(e,{emit:t}){const n=e,i=Math.sqrt(2),r=De(n),a=C(()=>me(r.nodeType.value.draggable,s(r.node)));ht(a,W=>{const be=s(r.node);s(r.dragging)===be&&!W&&t("endDragging",be)});const u=C(()=>{var be;const W=s(r.node);return(be=me(r.nodeType.value.actions,W))==null?void 0:be.filter(je=>Ye(me(je.visibility,W)))}),l=C(()=>{var be;const W=s(r.node);if(me(r.nodeType.value.draggable,W)&&((be=s(r.dragging))==null?void 0:be.id)===W.id&&s(r.dragged)!=null){const{x:je,y:gt}=s(r.dragged);return{x:W.position.x+Math.round(je/25)*25,y:W.position.y+Math.round(gt/25)*25}}return W.position}),c=C(()=>me(r.nodeType.value.shape,s(r.node))),p=C(()=>me(r.nodeType.value.title,s(r.node))),h=C(()=>me(r.nodeType.value.subtitle,s(r.node))),f=C(()=>me(r.nodeType.value.otherSubtitle,s(r.node))),b=C(()=>{var W;return(W=r.isSelected.value?s(r.selectedAction)&&me(s(r.selectedAction).tooltip,s(r.node)):null)!=null?W:me(r.nodeType.value.label,s(r.node))}),v=C(()=>{var W,be;return me((be=(W=s(r.selectedAction))==null?void 0:W.confirmationLabel)!=null?be:{text:"Tap again to confirm"},s(r.node))}),y=C(()=>me(r.nodeType.value.size,s(r.node))),N=C(()=>{var W;return(W=me(r.nodeType.value.progress,s(r.node)))!=null?W:0}),x=C(()=>Ct[ce.theme].variables["--background"]),E=C(()=>{var W;return(W=me(r.nodeType.value.outlineColor,s(r.node)))!=null?W:Ct[ce.theme].variables["--outline"]}),I=C(()=>{var W;return(W=me(r.nodeType.value.fillColor,s(r.node)))!=null?W:Ct[ce.theme].variables["--raised-background"]}),P=C(()=>me(r.nodeType.value.progressColor,s(r.node))),B=C(()=>{var W;return(W=me(r.nodeType.value.titleColor,s(r.node)))!=null?W:Ct[ce.theme].variables["--foreground"]}),le=C(()=>me(r.nodeType.value.progressDisplay,s(r.node))),ae=C(()=>r.dragging.value!=null&&s(r.hasDragged)&&me(r.nodeType.value.canAccept,s(r.node),r.dragging.value)),ne=C(()=>me(r.nodeType.value.style,s(r.node))),Q=C(()=>me(r.nodeType.value.classes,s(r.node)));function Ie(W){t("mouseDown",W,r.node.value,a.value)}function he(W){var be,je,gt;(be=r.hasDragged)!=null&&be.value||(t("endDragging",r.node.value),(gt=(je=r.nodeType.value).onClick)==null||gt.call(je,r.node.value),W.stopPropagation())}return(W,be)=>{var je,gt,Vt;return S(),A("g",{class:Ne(["boardnode",{[e.node.type]:!0,isSelected:e.isSelected,isDraggable:s(a),...s(Q)}]),style:Be([{opacity:((je=e.dragging)==null?void 0:je.id)===e.node.id&&e.hasDragged?.5:1},(gt=s(ne))!=null?gt:[]]),transform:`translate(${s(l).x},${s(l).y})${e.isSelected?" scale(1.2)":""}`},[d(_c,{actions:(Vt=s(u))!=null?Vt:[],"is-selected":e.isSelected,node:e.node,"node-type":e.nodeType,"selected-action":e.selectedAction,onClickAction:be[0]||(be[0]=mt=>t("clickAction",mt))},null,8,["actions","is-selected","node","node-type","selected-action"]),k("g",{class:"node-container",onMousedown:Ie,onTouchstartPassive:Ie,onMouseup:he,onTouchendPassive:he},[s(c)===s(Le).Circle?(S(),A("g",Cc,[s(ae)?(S(),A("circle",{key:0,class:"receiver",r:s(y)+8,fill:s(x),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,kc)):j("",!0),k("circle",{class:"body",r:s(y),fill:s(I),stroke:s(E),"stroke-width":4},null,8,Mc),s(le)===s(sn).Fill?(S(),A("circle",{key:1,class:"progress progressFill",r:Math.max(s(y)*s(N)-2,0),fill:s(P)},null,8,Sc)):(S(),A("circle",{key:2,r:s(y)+4.5,class:"progress progressRing",fill:"transparent","stroke-dasharray":(s(y)+4.5)*2*Math.PI,"stroke-width":5,"stroke-dashoffset":(s(y)+4.5)*2*Math.PI-s(N)*(s(y)+4.5)*2*Math.PI,stroke:s(P)},null,8,Ic))])):s(c)===s(Le).Diamond?(S(),A("g",xc,[s(ae)?(S(),A("rect",{key:0,class:"receiver",width:s(y)*s(i)+16,height:s(y)*s(i)+16,transform:`translate(${-(s(y)*s(i)+16)/2}, ${-(s(y)*s(i)+16)/2})`,fill:s(x),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,$c)):j("",!0),k("rect",{class:"body",width:s(y)*s(i),height:s(y)*s(i),transform:`translate(${-s(y)*s(i)/2}, ${-s(y)*s(i)/2})`,fill:s(I),stroke:s(E),"stroke-width":4},null,8,Ec),s(le)===s(sn).Fill?(S(),A("rect",{key:1,class:"progress progressFill",width:Math.max(s(y)*s(i)*s(N)-2,0),height:Math.max(s(y)*s(i)*s(N)-2,0),transform:`translate(${-Math.max(s(y)*s(i)*s(N)-2,0)/2}, ${-Math.max(s(y)*s(i)*s(N)-2,0)/2})`,fill:s(P)},null,8,Dc)):(S(),A("rect",{key:2,class:"progress progressDiamond",width:s(y)*s(i)+9,height:s(y)*s(i)+9,transform:`translate(${-(s(y)*s(i)+9)/2}, ${-(s(y)*s(i)+9)/2})`,fill:"transparent","stroke-dasharray":(s(y)*s(i)+9)*4,"stroke-width":5,"stroke-dashoffset":(s(y)*s(i)+9)*4-s(N)*(s(y)*s(i)+9)*4,stroke:s(P)},null,8,Tc))])):j("",!0),k("text",{fill:s(B),class:"node-title",y:s(f)&&!s(h)?-10:0},de(s(p)),9,Pc),s(h)?(S(),A("text",{key:2,fill:s(B),class:"node-subtitle",y:"-25"},de(s(h)),9,Ac)):j("",!0),s(f)?(S(),A("text",{key:3,fill:s(B),class:"node-subtitle",y:s(h)?25:15},de(s(f)),9,Rc)):j("",!0)],32),d(Un,{name:"fade",appear:""},{default:Z(()=>{var mt;return[s(b)?(S(),A("g",Fc,[k("text",{fill:(mt=s(b).color)!=null?mt:s(B),class:Ne(["node-title",{pulsing:s(b).pulsing}]),y:-s(y)-20},de(s(b).text),11,Oc)])):j("",!0)]}),_:1}),d(Un,{name:"fade",appear:""},{default:Z(()=>{var mt;return[e.isSelected&&e.selectedAction?(S(),A("text",{key:0,fill:(mt=s(v).color)!=null?mt:s(B),class:Ne(["node-title",{pulsing:s(v).pulsing}]),y:s(y)+75},de(s(v).text),11,qc)):j("",!0)]}),_:1})],14,Nc)}}});var Bc=ve(Vc,[["__scopeId","data-v-19cf948c"]]);const Lc={class:"stage",width:"100%",height:"100%"},jc={class:"g1"},zc=K({__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=De(e),i=G({x:0,y:0}),r=G({x:0,y:0}),a=G(!1),u=G(null),l=C(()=>{const v=n.nodes.value.slice();if(n.selectedNode.value){const y=v.splice(v.indexOf(n.selectedNode.value),1)[0];v.push(y)}if(n.draggingNode.value){const y=v.splice(v.indexOf(n.draggingNode.value),1)[0];v.push(y)}return v});It(()=>{const v=n.draggingNode.value;if(v==null)return null;const y={x:v.position.x+r.value.x,y:v.position.y+r.value.y};let N=Number.MAX_VALUE;n.setReceivingNode.value(n.nodes.value.reduce((x,E)=>{if(E.id===v.id)return x;const I=n.types.value[E.type];if(!me(I.canAccept,E,v))return x;const B=Math.pow(y.x-E.position.x,2)+Math.pow(y.y-E.position.y,2);let le=me(I.size,E);return B>N||B>le*le?x:(N=B,E)},null))});function c(v){v.setTransformOrigin(null),v.moveTo(u.value.$el.clientWidth/2,u.value.$el.clientHeight/2)}function p(v,y=null,N=!1){if(n.draggingNode.value==null){v.preventDefault(),v.stopPropagation();let x,E;if("touches"in v)if(v.touches.length===1)x=v.touches[0].clientX,E=v.touches[0].clientY;else return;else x=v.clientX,E=v.clientY;i.value={x,y:E},r.value={x:0,y:0},a.value=!1,N&&n.setDraggingNode.value(y)}y!=null&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function h(v){const{x:y,y:N,scale:x}=u.value.panZoomInstance.getTransform();let E,I;if("touches"in v)if(v.touches.length===1)E=v.touches[0].clientX,I=v.touches[0].clientY;else{f(n.draggingNode.value),n.mousePosition.value=null;return}else E=v.clientX,I=v.clientY;n.mousePosition.value={x:(E-y)/x,y:(I-N)/x},r.value={x:r.value.x+(E-i.value.x)/x,y:r.value.y+(I-i.value.y)/x},i.value={x:E,y:I},(Math.abs(r.value.x)>10||Math.abs(r.value.y)>10)&&(a.value=!0),n.draggingNode.value!=null&&(v.preventDefault(),v.stopPropagation())}function f(v,y=!1){var N,x;if(n.draggingNode.value!=null&&n.draggingNode.value===v){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 E=n.nodes.value;E.push(E.splice(E.indexOf(n.draggingNode.value),1)[0]),n.receivingNode.value&&((x=(N=n.types.value[n.receivingNode.value.type]).onDrop)==null||x.call(N,n.receivingNode.value,n.draggingNode.value)),n.setDraggingNode.value(null)}else!a.value&&!y&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function b(v,y){var x,E;const N=n.types.value[v.type];me((E=(x=N.actions)==null?void 0:x.find(I=>I.id===y))==null?void 0:E.confirmationLabel,v)==null&&(n.state.value.selectedAction=y),n.state.value.selectedAction===y?s(n.selectedAction).onClick(s(n.selectedNode)):n.state.value={...n.state.value,selectedAction:y}}return(v,y)=>{const N=kt("panZoom");return s(Ye)(e.visibility)?(S(),te(N,{key:0,style:Be([{width:e.width,height:e.height},e.style]),class:Ne(e.classes),selector:".g1",options:{initialZoom:1,minZoom:.1,maxZoom:10,zoomDoubleClickSpeed:1},ref_key:"stage",ref:u,onInit:c,onMousemove:h,onTouchmove:h,onMousedown:y[0]||(y[0]=x=>p(x)),onTouchstart:y[1]||(y[1]=x=>p(x)),onMouseup:y[2]||(y[2]=()=>f(s(e.draggingNode))),onTouchendPassive:y[3]||(y[3]=()=>f(s(e.draggingNode))),onMouseleave:y[4]||(y[4]=()=>f(s(e.draggingNode),!0))},{default:Z(()=>[(S(),A("svg",Lc,[k("g",jc,[d(ar,{name:"link",appear:""},{default:Z(()=>[(S(!0),A(re,null,Tn(s(e.links)||[],x=>(S(),A("g",{key:`${x.startNode.id}-${x.endNode.id}`},[d(mc,{link:x},null,8,["link"])]))),128))]),_:1}),d(ar,{name:"grow",duration:500,appear:""},{default:Z(()=>[(S(!0),A(re,null,Tn(s(l),x=>(S(),A("g",{key:x.id,style:{"transition-duration":"0s"}},[d(Bc,{node:x,nodeType:e.types[x.type],dragging:s(e.draggingNode),dragged:s(e.draggingNode)===x?r.value:void 0,hasDragged:s(e.draggingNode)==null?!1:a.value,receivingNode:s(e.receivingNode)===x,isSelected:s(e.selectedNode)===x,selectedAction:s(e.selectedNode)===x?s(e.selectedAction):null,onMouseDown:p,onEndDragging:f,onClickAction:E=>b(x,E)},null,8,["node","nodeType","dragging","dragged","hasDragged","receivingNode","isSelected","selectedAction","onClickAction"])]))),128))]),_:1})])]))]),_:1},8,["style","class","options"])):j("",!0)}}});tt.on("setupVue",e=>ma.install(e));const jr=Symbol("Board");var sn=(e=>(e.Outline="Outline",e.Fill="Fill",e))(sn||{}),Le=(e=>(e.Circle="Circle",e.Diamond="Triangle",e))(Le||{});function Gc(e){const t=ut({nodes:[],selectedNode:null,selectedAction:null},!1);return Qe(n=>{const i=e.call(n,n);i.id=Xt("board-"),i.type=jr,i[ft]=zc,i.state?(Fr(t),D(i,"state")):(t[Zt]={nodes:i.startNodes().map((l,c)=>(l.id=c,l)),selectedNode:null,selectedAction:null},i.state=t),i.nodes=C(()=>s(u.state).nodes),i.selectedNode=C({get(){return u.nodes.value.find(l=>l.id===s(u.state).selectedNode)||null},set(l){var c,p;Fe(u.state)?u.state.value={...u.state.value,selectedNode:(c=l==null?void 0:l.id)!=null?c:null}:u.state.selectedNode=(p=l==null?void 0:l.id)!=null?p:null}}),i.selectedAction=C({get(){const l=u.selectedNode.value;if(l==null)return null;const c=u.types[l.type];return c.actions==null?null:c.actions.find(p=>p.id===s(u.state).selectedAction)||null},set(l){var c,p;Fe(u.state)?u.state.value={...u.state.value,selectedAction:(c=l==null?void 0:l.id)!=null?c:null}:u.state.selectedAction=(p=l==null?void 0:l.id)!=null?p:null}}),i.mousePosition=G(null),i.links?D(i,"links"):i.links=C(()=>u.selectedAction.value==null?null:u.selectedAction.value.links&&u.selectedNode.value?me(u.selectedAction.value.links,u.selectedNode.value):null),i.draggingNode=G(null),i.receivingNode=G(null),D(i,"visibility"),oe(i,"visibility",Me.Visible),D(i,"width"),oe(i,"width","100%"),D(i,"height"),oe(i,"height","100%"),D(i,"classes"),D(i,"style");for(const l in i.types){const c=i.types[l];if(D(c,"title"),D(c,"subtitle"),D(c,"otherSubtitle"),D(c,"label"),D(c,"size"),oe(c,"size",50),D(c,"style"),D(c,"classes"),D(c,"draggable"),oe(c,"draggable",!1),D(c,"shape"),oe(c,"shape","Circle"),D(c,"canAccept"),oe(c,"canAccept",!1),D(c,"progress"),D(c,"progressDisplay"),oe(c,"progressDisplay","Fill"),D(c,"progressColor"),oe(c,"progressColor","none"),D(c,"fillColor"),D(c,"outlineColor"),D(c,"titleColor"),D(c,"actionDistance"),oe(c,"actionDistance",Math.PI/6),c.nodes=C(()=>s(u.state).nodes.filter(p=>p.type===l)),oe(c,"onClick",function(p){s(u.state).selectedNode=p.id}),c.actions)for(const p of c.actions)D(p,"visibility"),oe(p,"visibility",Me.Visible),D(p,"icon"),D(p,"fillColor"),D(p,"tooltip"),D(p,"confirmationLabel"),oe(p,"confirmationLabel",{text:"Tap again to confirm"}),D(p,"links")}function r(l){i.draggingNode.value=l}function a(l){i.receivingNode.value=l}i.placeInAvailableSpace=function(l,c=100,p=H.Right){const h=u.nodes.value.slice().filter(f=>f===l||(p===H.Down||p===H.Up)&&Math.abs(f.position.x-l.position.x)>c||(p===H.Left||p===H.Right)&&Math.abs(f.position.y-l.position.y)>c?!1:!(p===H.Right&&f.position.x<l.position.x-c||p===H.Left&&f.position.x>l.position.x+c||p===H.Up&&f.position.y>l.position.y+c||p===H.Down&&f.position.y<l.position.y-c)).sort(p===H.Right?(f,b)=>f.position.x-b.position.x:p===H.Left?(f,b)=>b.position.x-f.position.x:p===H.Up?(f,b)=>b.position.y-f.position.y:(f,b)=>f.position.y-b.position.y);for(let f=0;f<h.length;f++){const b=h[f],v=p===H.Right||p===H.Left?Math.abs(l.position.x-b.position.x):Math.abs(l.position.y-b.position.y);if(v<c)p===H.Right?l.position.x=b.position.x+c:p===H.Left?l.position.x=b.position.x-c:p===H.Up?l.position.y=b.position.y-c:p===H.Down&&(l.position.y=b.position.y+c);else if(f>0&&v>c)break}},i[ct]=function(){const{nodes:l,types:c,state:p,visibility:h,width:f,height:b,style:v,classes:y,links:N,selectedAction:x,selectedNode:E,mousePosition:I,draggingNode:P,receivingNode:B}=this;return{nodes:l,types:c,state:p,visibility:h,width:f,height:b,style:s(v),classes:y,links:N,selectedAction:x,selectedNode:E,mousePosition:I,draggingNode:P,receivingNode:B,setDraggingNode:r,setReceivingNode:a}};const u=i;return u})}function me(e,t,...n){return Hn(e)?e(t,...n):s(e)}function Pn(e){let t=0;return e.nodes.value.forEach(n=>{n.id>=t&&(t=n.id+1)}),t}const zn={};tt.on("addLayer",e=>{const t=Zn(e,jr);zn[e.id]=e.on("postUpdate",n=>{t.forEach(i=>{Object.values(i.types).forEach(r=>r.nodes.value.forEach(a=>{var u;return(u=r.update)==null?void 0:u.call(r,a,n)}))})})});tt.on("removeLayer",e=>{var t;(t=zn[e.id])==null||t.call(zn),zn[e.id]=void 0});function xn(e,t="points",n=0,i=void 0){const r=Fe(e)?e:ut(e);if(r.displayName=t,r.precision=n,r.small=i,!Fe(e)){const a=r[Tt];a.displayName=t,a.precision=n,a.small=i}return r}new o("10^^8");new o("1e100");function mi(e,t){const n=t!=null?t:e.value;return o.eq(e.precision,0)?ot(e.small?n:o.floor(n)):xe(n,e.precision,e.small)}tt.on("setupVue",e=>e.use(va));function Uc(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 Wc=K({props:{visibility:{type:q(Number,Boolean),required:!0},display:{type:q(Object,String,Function),required:!0},style:q(String,Object,Array),classes:q(Object),glowColor:q(String),active:Boolean,floating:Boolean},emits:["selectTab"],setup(e,{emit:t}){const{display:n,glowColor:i,floating:r}=De(e),a=Gi(n),u=C(()=>{const c=Ee(i);return c==null||c===""?{}:s(r)?Uc(c):{boxShadow:`0px 9px 5px -6px ${c}`}});function l(){t("selectTab")}return{selectTab:l,component:a,glowColorStyle:u,unref:s,Visibility:Me,isVisible:Ye,isHidden:bn}}});function Hc(e,t,n,i,r,a){var u;return e.isVisible(e.visibility)?(S(),A("button",{key:0,onClick:t[0]||(t[0]=(...l)=>e.selectTab&&e.selectTab(...l)),class:Ne(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(u=e.unref(e.style))!=null?u:{}])},[(S(),te(Je(e.component)))],6)):j("",!0)}var zr=ve(Wc,[["render",Hc],["__scopeId","data-v-21427abb"]]);const Yc=K({props:{visibility:{type:q(Number,Boolean),required:!0},activeTab:{type:q(Object),required:!0},selected:{type:Object,required:!0},tabs:{type:q(Object),required:!0},style:q(String,Object,Array),classes:q(Object),buttonContainerStyle:q(String,Object,Array),buttonContainerClasses:q(Object)},components:{Sticky:gi,TabButton:zr},setup(e){const{activeTab:t}=De(e),n=C(()=>Ct[ce.theme].floatingTabs),i=bt("");It(()=>{const l=Ee(t);if(l==null){i.value="";return}if(xt(l)){i.value=pe(l);return}i.value=pe(s(l.display))});const r=C(()=>{const l=Ee(t);return xt(l)||!l?void 0:s(l.classes)}),a=C(()=>{const l=Ee(t);return xt(l)||!l?void 0:s(l.style)});function u(l){const{display:c,style:p,classes:h,glowColor:f,visibility:b}=l;return{display:c,style:s(p),classes:h,glowColor:f,visibility:b}}return{floating:n,tabClasses:r,tabStyle:a,Visibility:Me,component:i,gatherButtonProps:u,unref:s,isVisible:Ye,isHidden:bn}}});function Zc(e,t,n,i,r,a){var c,p;const u=kt("TabButton"),l=kt("Sticky");return e.isVisible(e.visibility)?(S(),A("div",{key:0,class:Ne(["tab-family-container",{...e.unref(e.classes),...e.tabClasses}]),style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[],(p=e.tabStyle)!=null?p:[]])},[d(l,{class:Ne(["tab-buttons-container",e.unref(e.buttonContainerClasses)]),style:Be(e.unref(e.buttonContainerStyle))},{default:Z(()=>[k("div",{class:Ne(["tab-buttons",{floating:e.floating}])},[(S(!0),A(re,null,Tn(e.unref(e.tabs),(h,f)=>(S(),te(u,Yt({onSelectTab:b=>e.selected.value=f,floating:e.floating,key:f,active:e.unref(h.tab)===e.unref(e.activeTab)},e.gatherButtonProps(h)),null,16,["onSelectTab","floating","active"]))),128))],2)]),_:1},8,["class","style"]),e.unref(e.activeTab)?(S(),te(Je(e.unref(e.component)),{key:0})):j("",!0)],6)):j("",!0)}var Xc=ve(Yc,[["render",Zc],["__scopeId","data-v-58dbf83a"]]);const Kc=Symbol("TabButton"),Jc=Symbol("TabFamily");function Gr(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=ut(Object.keys(e)[0],!1);return Qe(i=>{var u;const r=(u=t==null?void 0:t.call(i,i))!=null?u:{};r.id=Xt("tabFamily-"),r.type=Jc,r[ft]=Xc,r.tabs=Object.keys(e).reduce((l,c)=>{const p=e[c]();return p.type=Kc,p[ft]=zr,D(p,"visibility"),oe(p,"visibility",Me.Visible),D(p,"tab"),D(p,"display"),D(p,"classes"),D(p,"style"),D(p,"glowColor"),l[c]=p,l},{}),r.selected=n,r.activeTab=C(()=>{const l=s(a.tabs);if(n.value in l&&Ye(l[n.value].visibility))return s(l[n.value].tab);const c=Object.values(l).find(p=>Ye(p.visibility));return c?s(c.tab):null}),D(r,"visibility"),oe(r,"visibility",Me.Visible),D(r,"classes"),D(r,"style"),D(r,"buttonContainerClasses"),D(r,"buttonContainerStyle"),r[ct]=function(){const{visibility:l,activeTab:c,selected:p,tabs:h,style:f,classes:b,buttonContainerClasses:v,buttonContainerStyle:y}=this;return{visibility:l,activeTab:c,selected:p,tabs:h,style:s(f),classes:b,buttonContainerClasses:v,buttonContainerStyle:y}};const a=r;return a})}function Ut(e){return Qe(t=>{const{addend:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),u=_e(n),l=_e(i),c=r==null?void 0:_e(r);return{apply:p=>o.add(p,s(u)),invert:p=>o.sub(p,s(u)),getFormula:p=>m.add(p,u),enabled:c,description:i==null?void 0:z(()=>d("div",{class:"modifier-container"},[s(l)!=null?d("span",{class:"modifier-description"},[wt(s(l))]):null,d("span",{class:"modifier-amount",style:(a===!0?o.gt(s(u),0):o.lt(s(u),0))?"color: var(--danger)":""},[o.gte(s(u),0)?"+":"",Wt(s(u))])]))}})}function ke(e){return Qe(t=>{const{multiplier:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),u=_e(n),l=_e(i),c=r==null?void 0:_e(r);return{apply:p=>o.times(p,s(u)),invert:p=>o.div(p,s(u)),getFormula:p=>m.times(p,u),enabled:c,description:i==null?void 0:z(()=>d("div",{class:"modifier-container"},[s(l)!=null?d("span",{class:"modifier-description"},[wt(s(l))]):null,d("span",{class:"modifier-amount",style:(a===!0?o.gt(s(u),1):o.lt(s(u),1))?"color: var(--danger)":""},[_("\xD7"),Wt(s(u))])]))}})}function Qc(e){return Qe(t=>{const{exponent:n,description:i,enabled:r,supportLowNumbers:a,smallerIsBetter:u}=e.call(t,t),l=_e(n),c=_e(i),p=r==null?void 0:_e(r);return{apply:h=>{let f=h;return a&&(f=o.add(f,1)),f=o.pow(f,s(l)),a&&(f=o.sub(f,1)),f},invert:h=>{let f=h;return a&&(f=o.add(f,1)),f=o.root(f,s(l)),a&&(f=o.sub(f,1)),f},getFormula:h=>a?m.add(h,1).pow(l).sub(1):m.pow(h,l),enabled:p,description:i==null?void 0:z(()=>d("div",{class:"modifier-container"},[s(c)!=null?d("span",{class:"modifier-description"},[wt(s(c)),a?" (+1 effective)":null]):null,d("span",{class:"modifier-amount",style:(u===!0?o.gt(s(l),1):o.lt(s(l),1))?"color: var(--danger)":""},[_("^"),Wt(s(l))])]))}})}function Nt(e){return Qe(()=>{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)?C(()=>t.filter(n=>s(n.enabled)!==!1).length>0):void 0,description:t.some(n=>n.description!=null)?z(()=>d(re,null,[t.filter(n=>s(n.enabled)!==!1).map(n=>s(n.description)).filter(n=>n).map(wt)])):void 0}})}const Vi=m.variable(0).step(2e3,e=>e.pow_base(1.02)).step(100,e=>e.pow(1.5)).step(o.pow(900,1.5).add(100),e=>e.pow(1.5)).pow(1.5),on={id:"deselect",icon:"close",tooltip:e=>({text:"portals"in e.state?"Disconnect portals":"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:[]}:"portals"in e.state?e.state={...e.state,portals:[]}:"resources"in e.state?e.state={...e.state,resources:[]}:"tools"in e.state&&(e.state={...e.state,tools:[]}),g.board.selectedAction.value=null,g.board.selectedNode.value=null},visibility:e=>{var t;return Array.isArray((t=e.state)==null?void 0:t.data)?e.state.data.length>0:"portals"in e.state?e.state.portals.length>0:"resources"in e.state?e.state.resources.length>0:"tools"in e.state?e.state.tools.length>0:!1}},Ft={id:"toggle",icon:"bolt",tooltip:e=>({text:e.state.powered?"Turn Off":`Turn On - Always runs for ${ot(g.nextPowerCost.value)} energy/s`}),onClick(e){e.state={...e.state,powered:!e.state.powered},g.board.selectedAction.value=null},fillColor:e=>e.state.powered?"var(--accent1)":"var(--locked)"};function wn(e,t=1/0){const n=e(m.variable(0));return{id:"moreConnections",icon:"hub",formula:n,tooltip(i){return{text:`Increase Connections - ${ot(n.evaluate(i.state.maxConnections))} energy`}},fillColor(i){return o.gte(g.energy.value,n.evaluate(i.state.maxConnections))?"var(--bought)":"var(--locked)"},confirmationLabel:i=>o.gte(g.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(g.energy.value,r)&&(g.energy.value=o.sub(g.energy.value,r),i.state={...i.state,maxConnections:o.add(i.state.maxConnections,1)},g.board.selectedAction.value=null)},visibility:i=>o.add(i.state.maxConnections,g.computedBonusConnectionsModifier.value).lt(t)}}function Ur(e,t){var n,i;if(((n=g.board.draggingNode.value)==null?void 0:n.type)==="resource"){const r=((i=g.board.draggingNode.value)==null?void 0:i.state).type,{maxConnections:a,resources:u}=e.state;return u.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,g.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function ed(e,t){var n,i;if(((n=g.board.draggingNode.value)==null?void 0:n.type)==="passive"){const r=(i=g.board.draggingNode.value)==null?void 0:i.state,{maxConnections:a,tools:u}=e.state;return u.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,g.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function yi(e,t){var n,i;if(((n=g.board.draggingNode.value)==null?void 0:n.type)==="portal"){const r=((i=g.board.draggingNode.value)==null?void 0:i.state).id,{maxConnections:a,portals:u}=e.state;return u.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,g.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function Wr(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,g.computedBonusConnectionsModifier.value).lte(r.length)}function Hr(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]},g.board.selectedNode.value=e}function td(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,g.computedBonusConnectionsModifier.value).lte(r.length)}function nd(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]},g.board.selectedNode.value=e}function wi(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,g.computedBonusConnectionsModifier.value).lte(r.length)}function _i(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]},g.board.selectedNode.value=e}function Ce(e){return e===g.board.selectedNode.value||e.state.powered}function ee(e){return g.empowerer.value!=null&&Ce(g.empowerer.value)&&g.empowerer.value.state.tools.includes(e)}function id(e){var a,u,l;const t=(l=(u=(a=g.resourceNodes.value[e])==null?void 0:a.state)==null?void 0:u.amount)!=null?l:0,n=g.resourceLevels.value[e],i=Vi.evaluate(n),r=Vi.evaluate(o.add(n,1));return o.sub(t,i).max(0).div(o.sub(r,i)).toNumber()}function cn(e,t,n){if(t.value){const i=t.value.state,r=i[n],a=i.maxConnections;o.gt(r.length,o.add(a,e))&&(t.value.state={...t.value.state,[n]:r.slice(0,o.add(a,e).toNumber())})}}function Ot(e){return{id:"help",icon:"question_mark",tooltip:{text:"Help"},onClick(){g.helpModals[e].showModal.value=!0,g.board.selectedAction.value=null},confirmationLabel:null}}const rd={key:0},ad={key:0,class:"mark star"},sd=["src"],od=K({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(S(),A("div",rd,[e.mark===!0?(S(),A("div",ad)):(S(),A("img",{key:1,class:"mark",src:e.mark},null,8,sd))])):j("",!0)}});var Jn=ve(od,[["__scopeId","data-v-2207999f"]]);const ld=K({__name:"Node",props:{id:null},setup(e){const n=De(e),i=ci(Ui,()=>{}),r=ci(Wi,()=>{}),a=bt(null),u=C(()=>a.value&&a.value.parentElement);return ht([u,n.id],([l,c],[p,h])=>{p&&r(s(h)),l&&i(c,l)}),wr(()=>r(s(n.id))),(l,c)=>(S(),A("div",{class:"node",ref_key:"node",ref:a},null,512))}});var Qn=ve(ld,[["__scopeId","data-v-a48cb382"]]),ud=K({props:{display:{type:q(Object,String,Function),required:!0},visibility:{type:q(Number,Boolean),required:!0},style:q(Object,String,Array),classes:q(Object),onClick:Function,onHold:Function,canClick:{type:q(Boolean),required:!0},small:Boolean,mark:q(Boolean,String),id:{type:String,required:!0}},components:{Node:Qn,MarkNode:Jn},setup(e){const{display:t,onClick:n,onHold:i}=De(e),r=bt("");It(()=>{var h;const l=Ee(t);if(l==null){r.value="";return}if(xt(l)){r.value=pe(l);return}const c=pe((h=l.title)!=null?h:"","h3"),p=pe(l.description,"div");r.value=pe(z(()=>d("span",null,[l.title!=null?d("div",null,[d(c,null,null)]):null,d(p,null,null)])))});const{start:a,stop:u}=Tr(n,i);return{start:a,stop:u,comp:r,Visibility:Me,isVisible:Ye,isHidden:bn,unref:s}}});function cd(e,t,n,i,r,a){var c;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(S(),A("button",{key:0,style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[]]),onClick:t[0]||(t[0]=(...p)=>e.onClick&&e.onClick(...p)),onMousedown:t[1]||(t[1]=(...p)=>e.start&&e.start(...p)),onMouseleave:t[2]||(t[2]=(...p)=>e.stop&&e.stop(...p)),onMouseup:t[3]||(t[3]=(...p)=>e.stop&&e.stop(...p)),onTouchstartPassive:t[4]||(t[4]=(...p)=>e.start&&e.start(...p)),onTouchendPassive:t[5]||(t[5]=(...p)=>e.stop&&e.stop(...p)),onTouchcancelPassive:t[6]||(t[6]=(...p)=>e.stop&&e.stop(...p)),class:Ne({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)?(S(),te(Je(e.unref(e.comp)),{key:0})):j("",!0),d(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],38)):j("",!0)}var Yr=ve(ud,[["render",cd],["__scopeId","data-v-211328c0"]]);const Zr=Symbol("Clickable");function dd(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return Qe(i=>{var u,l,c;const r=(u=e==null?void 0:e.call(i,i))!=null?u:{};r.id=Xt("clickable-"),r.type=Zr,r[ft]=Yr;for(const p of t)(l=p.preConstruct)==null||l.call(p,r);if(Object.assign(r,n),D(r,"visibility"),oe(r,"visibility",Me.Visible),D(r,"canClick"),oe(r,"canClick",!0),D(r,"classes"),D(r,"style"),D(r,"mark"),D(r,"display"),r.onClick){const p=r.onClick.bind(r);r.onClick=function(h){s(r.canClick)!==!1&&p(h)}}if(r.onHold){const p=r.onHold.bind(r);r.onHold=function(){s(r.canClick)!==!1&&p()}}for(const p of t)(c=p.postConstruct)==null||c.call(p,r);const a=t.reduce((p,h)=>{var f;return Object.assign(p,(f=h.getGatheredProps)==null?void 0:f.call(h,r))},{});return r[ct]=function(){const{display:p,visibility:h,style:f,classes:b,onClick:v,onHold:y,canClick:N,small:x,mark:E,id:I}=this;return{display:p,visibility:h,style:s(f),classes:b,onClick:v,onHold:y,canClick:N,small:x,mark:E,id:I,...a}},r})}function pd(e,t,n=[]){n=n.length===0?Zn(e,Zr):n;const i=typeof t=="function"?C(t):t;return e.on("update",()=>{s(i)&&n.filter(r=>s(r.canClick)).forEach(r=>{var a;return(a=r.onClick)==null?void 0:a.call(r)})})}const fd=["x1","y1","x2","y2"],gd=K({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const n=De(e),i=C(()=>{const a=n.startNode.value.rect,u=n.boundingRect.value,l=u?{x:a.x+a.width/2-u.x,y:a.y+a.height/2-u.y}:{x:0,y:0};return n.link.value.offsetStart&&(l.x+=n.link.value.offsetStart.x,l.y+=n.link.value.offsetStart.y),l}),r=C(()=>{const a=n.endNode.value.rect,u=n.boundingRect.value,l=u?{x:a.x+a.width/2-u.x,y:a.y+a.height/2-u.y}:{x:0,y:0};return n.link.value.offsetEnd&&(l.x+=n.link.value.offsetEnd.x,l.y+=n.link.value.offsetEnd.y),l});return(a,u)=>(S(),A("line",Yt({"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,fd))}});const md=K({__name:"Links",props:{links:null},setup(e){var c;const n=an(e,"links"),i=G(null),r=ci(Hi,G({})),a=ci(Yi,G(void 0)),u=G((c=i.value)==null?void 0:c.getBoundingClientRect());ht(a,()=>{var p;return u.value=(p=i.value)==null?void 0:p.getBoundingClientRect()}),vi(()=>{var p;return u.value=(p=i.value)==null?void 0:p.getBoundingClientRect()});const l=C(()=>{var h,f;const p=r.value;return(f=(h=n.value)==null?void 0:h.filter(b=>{var v,y;return((v=p[b.startNode.id])==null?void 0:v.rect)&&((y=p[b.startNode.id])==null?void 0:y.rect)}))!=null?f:[]});return(p,h)=>(S(),A(re,null,[s(l)?(S(),A("svg",ua(Yt({key:0},p.$attrs)),[(S(!0),A(re,null,Tn(s(l),(f,b)=>(S(),te(gd,{key:b,link:f,boundingRect:u.value,startNode:s(r)[f.startNode.id],endNode:s(r)[f.endNode.id]},null,8,["link","boundingRect","startNode","endNode"]))),128))],16)):j("",!0),k("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var vd=ve(md,[["__scopeId","data-v-063f6d6b"]]);K({props:{nodes:{type:q(Array),required:!0},leftSideNodes:q(Array),rightSideNodes:q(Array),branches:q(Array)},components:{Links:vd},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:i}=De(e),r=bt();It(()=>{const l=Ee(t);r.value=pe(z(()=>d(re,null,[l.map(c=>d("span",{class:"row tree-row",style:"margin: 50px auto;"},[c.map(wt)]))])))});const a=bt();It(()=>{const l=Ee(n);a.value=l?pe(z(()=>d("span",{class:"left-side-nodes small"},[l.map(wt)]))):""});const u=bt();return It(()=>{const l=Ee(i);u.value=l?pe(z(()=>d("span",{class:"side-nodes small"},[l.map(wt)]))):""}),{unref:s,nodesComp:r,leftNodesComp:a,rightNodesComp:u}}});K({props:{display:q(Object,String,Function),visibility:{type:q(Number,Boolean),required:!0},style:q(String,Object,Array),classes:q(Object),onClick:Function,onHold:Function,color:q(String),glowColor:q(String),canClick:{type:q(Boolean),required:!0},mark:q(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Jn,Node:Qn},setup(e){const{onClick:t,onHold:n,display:i}=De(e),r=An(i),{start:a,stop:u}=Tr(t,n);return{start:a,stop:u,comp:r,unref:s,Visibility:Me,isCoercableComponent:xt,isVisible:Ye,isHidden:bn}}});function Gn(e){const t=[],n={};let i=!1;function r(){return i||(t.push(...e()),n.base=t.map(l=>_e(l.base)),n.baseText=t.map(l=>_e(l.baseText)),n.visible=t.map(l=>_e(l.visible)),n.title=t.map(l=>_e(l.title)),n.subtitle=t.map(l=>_e(l.subtitle)),i=!0),t}const a=ut({},!1);return[z(()=>{const l=r();let c=!0;const p=l.map((h,f)=>{var E,I,P;if(s(n.visible[f])===!1)return null;const b=d("h3",{onClick:()=>a.value[f]=!a.value[f],style:"cursor: pointer"},[d("span",{class:"modifier-toggle"+(s(a.value[f])?" collapsed":"")},[_("\u25BC")]),s(n.title[f]),s(n.subtitle[f])!=null?d("span",{class:"subtitle"},[_(" ("),s(n.subtitle[f]),_(")")]):null]),v=s(a.value[f])?null:d(re,null,[d("div",{class:"modifier-container"},[d("span",{class:"modifier-description"},[wt((E=s(n.baseText[f]))!=null?E:"Base")]),d("span",{class:"modifier-amount"},[xe((I=s(n.base[f]))!=null?I:1),h.unit])]),h.modifier.description==null?null:wt(s(h.modifier.description))]),y=!c;c=!1;const N=(P=s(n.base[f]))!=null?P:1,x=h.modifier.apply(N);return d(re,null,[y?d("br",null,null):null,d("div",{style:{"--unit":ce.alignUnits&&h.unit!=null?"'"+h.unit+"'":""}},[b,d("br",null,null),v,d("hr",null,null),d("div",{class:"modifier-container"},[d("span",{class:"modifier-description"},[_("Total")]),d("span",{class:"modifier-amount",style:(h.smallerIsBetter===!0?o.gt(x,N!=null?N:1):o.lt(x,N!=null?N:1))?"color: var(--danger)":""},[Wt(x),h.unit])])])])});return d(re,null,[p])}),a]}function Ai(e,t,n){const i=_e(t),r=_e(n);return C(()=>{const a=s(i),u=s(r);return o.gte(e.value,u)?"Now":o.lte(a,0)?"Never":bi(o.sub(u,e.value).div(a))})}function dn(e,t,n=1){const i=_e(t),r=_e(n);if(!e.hasVariable())throw new Error("Cannot create formula preview if the formula does not have a variable");return z(()=>{var a;if(s(i)){const u=Wt(e.evaluate()),l=Wt(e.evaluate(o.add(s((a=e.innermostVariable)!=null?a:0),s(r))));return d(re,null,[d("b",null,[d("i",null,[u,_(" \u2192 "),l])])])}return d(re,null,[Wt(e.evaluate())])})}const St={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},zt=Object.keys(St),Ve={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:"AI",type:"passive",state:"emerald"},platinum:{cost:1e24,name:"Upgrader",type:"upgrader",state:{portals:[],maxConnections:1,powered:!1}},diamond:{cost:1e30,name:"ML",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}}},Dt={dirt:"BOGO Coupon",sand:"Metal Detector",gravel:"Neural Nets",wood:"Mining Laser",stone:"Replicator",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:"OC'ed Portals",ultimatum:"Rebates"},hd={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 40% stronger":"Material level is 20% stronger"},silver:{description:e=>e?"Quadruples each plane's resource gain":"Doubles 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?"2 free levels for repeatables":"1 free level for repeatables"},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 (diminishing)":"+1% plane's resource gain per repeatable purchase (diminishing)"},woodRelic:{description:e=>e?"(Relics)^2 boost mine speed":"Relics boost mine speed"},stoneRelic:{description:e=>e?"All upgrades apply twice":"Non-multiplicative upgrades apply twice"},coalRelic:{description:e=>e?"Every treasure boosts planar speed by +20%":"Every treasure boosts planar speed by +10%"},copperRelic:{description:e=>e?"Power 2 machines free":"Power 1 machine free"},ironRelic:{description:e=>e?"Conversions give quadruple output":"Conversions give double output"},silverRelic:{description:e=>e?"(Powered machines)^2 boost quarry speed":"Powered machines boost quarry speed"},goldRelic:{description:e=>e?"Each treasure gives +50% XP gain":"Each treasure gives +25% XP gain"},emeraldRelic:{description:e=>e?"Creating portals costs 20x less energy":"Creating portals costs 10x less energy"},platinumRelic:{description:e=>e?"Quadruple 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?"log(energy)^0.5 boosts planes' resource gain":"log(energy)^0.25 boosts planes' resource gain"},unobtainiumRelic:{description:e=>e?"Upgrades/repeatables/dimensions/prestige no longer spend on purchase":"Upgrades/repeatables no longer spend on purchase"}},pt={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:"+difficulty",description:"Increase difficulty/rewards odds",cost:10,initialData:void 0},decreaseDiff:{display:"-difficulty",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}},si=m.variable(0).add(8).times(2).pow10(),bd=K({__name:"Tab",props:{display:null},setup(e){const t=e,{display:n}=De(t),i=Gi(n);return(r,a)=>(S(),te(Je(s(i))))}}),yd=Symbol("Tab");function Ri(e){return Qe(t=>{const n=e.call(t,t);return n.id=Xt("tab-"),n.type=yd,n[ft]=bd,n[ct]=function(){const{display:i}=this;return{display:i}},n})}function qt(e,t,n={}){const i=ut(!1);return{modal:z(()=>d(Rt,{modelValue:i.value,"onUpdate:modelValue":a=>i.value=a},{header:()=>d("h2",null,[e]),body:t})),showModal:i,...n}}function wd(){return qt("Getting Started",z(()=>d("div",null,[d("p",null,[_(`Welcome to Planar Pioneers! Your job is to gather resources and eventually explore and conquer increasingly difficult "planes", which are like alien worlds. To start you'll use the mine (\u26CF\uFE0F) machine to gather resources.`)]),d("br",null,null),d("p",null,[_(`You'll gain energy every second based on how much of each resource you have. You can check the exact calculation and various other information by clicking the "modifiers" button near the top of the screen.`)]),d("br",null,null),d("p",null,[_("Select the machine by clicking it to make the mine active. You can also drag them around to organize your various machines and other objects. While selected machines will have various actions you can take, such as viewing the help for that machine. There's also an action to power the machine, allowing it to be active even while not selected, at the cost of energy per second (cost increases based on the total number of machines being powered).")])])))}function _d(){return qt("Forging",z(()=>d("div",null,[d("p",null,[_("You've repaired the forge (\u{1F6E0}\uFE0F)! This is the next main line of progression. Here you'll be able to craft a total of 16 machines and passive bonuses to create - one for each resource!")]),d("br",null,null),d("p",null,[_("Drag a resource onto the forge to select that resource tier. You can then use an action on the forge to create that item, at the cost of energy based on the resource tier. You can only have 1 of each item.")])])))}function Nd(){return qt("Dowsing",z(()=>d("div",null,[d("p",null,[_("You've created the dowsing rod (\u{1F962})! This machine let's you bias the odds of specified resources from mining. It will double the odds of each specified resource, so keep in mind rare resources will still be fairly rare.")]),d("br",null,null),d("p",null,[_("Specify resources to boost by dragging them to the dowsing rod. You can only select a single resource to start, but that can be increased using an action.")])])))}function Cd(){return qt("Quarry",z(()=>d("div",null,[d("p",null,[_("You've created the Quarry (\u26F0\uFE0F)! This machine let's you gather specified resources. Unlike the mine, this machine will always output the same resources. However, rarer resources will take longer to gather.")]),d("br",null,null),d("p",null,[_("Specify resources to gather by dragging them to the quarry. You can only select a single resource to start, but that can be increased using an action.")])])))}function kd(){return qt("Tool Empowerer",z(()=>d("div",null,[d("p",null,[_("You've created the Tool Empowerer (\u{1F50C})! This machine let's you increase the effect of specified passives. Experimenting with which passives to empower can really help you progress!")]),d("br",null,null),d("p",null,[_("Specify passives to empower by dragging them to the empowerer. You can only select a single passive to start, but that can be increased using an action.")])])))}function Md(){const e=Gr({general:()=>({display:"General",glowColor(){return e.activeTab.value===this.tab?"white":""},tab:Ri(()=>({display:z(()=>d("div",null,[d("p",null,[_("You've created the Portal Generator (\u26E9\uFE0F)! This machine let's you create portals to other planes, which will have treasures that help you in various ways! To create a portal you need to specify a tier by dragging a resource to the generator - higher tier planes cost more energy to generate portals for, but offer more and better treasures! Keep in mind time in planes will be paused if the portal is inactive (not selected nor powered).")]),d("br",null,null),d("p",null,[_("You've also gained a trash can for portals (\u{1F5D1}\uFE0F). Dragging a portal here will permanently destroy it. Any treasures that require the portal to be active will no longer work. This can be used to keep your workspace clean from old portals you no longer need or want.")])]))}))}),treasures:()=>({display:"Treasures",glowColor(){return e.activeTab.value===this.tab?"white":""},tab:Ri(()=>({display:z(()=>d("div",null,[_("Types of potential treasures:"),d("ul",{style:"list-style-type: unset"},[d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("Caches")]),_(": Gain an amount of a resource based on your current amount.")]),d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("Gen")]),_(": Passively gain an amount of a resource while the portal is active (selected or powered).")]),d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("Resource Mult")]),_(": Increase the amount gained of a resource from all sources (except caches) while the portal is active (selected or powered).")]),d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("Energy Mult")]),_(": Increase the energy gained per second while the portal is active (selected or powered).")]),d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("Influences")]),_(": Gain a influence. See the influences tab for details. You can only have 1 of each influence.")]),d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("Relic")]),_(": Gain the relic unique to this tier of plane. These are powerful passive boosts that can be empowered. You can only have 1 of each relic. Relics can only appear with the +relic influence, and will always be the last treasure on a plane.")])])]))}))}),influences:()=>({display:"Influences",glowColor(){return e.activeTab.value===this.tab?"white":""},tab:Ri(()=>({display:z(()=>d("div",null,[d("p",null,[_("Some treasures will grant you influences that can help the portal generator create portals to planes with specified qualities. Each influence will multiply the energy cost of creating the portal.")]),d("br",null,null),Object.keys(g.influenceNodes.value).length>0?d("div",null,[_("Discovered influences:"),d("ul",{style:"list-style-type: unset"},[g.influenceNodes.value.increaseResources==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("+resource")]),_(": Can be connected to resources and will cause any treasures that reference resources (caches, gens, and resource mults) to have increased odds of picking a selected resource.")]),g.influenceNodes.value.decreaseResources==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("-resource")]),_(": Can be connected to resources and will cause any treasures that reference resources (caches, gens, and resource mults) to have decreased odds of picking a selected resource.")]),g.influenceNodes.value.increaseLength==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("+length")]),_(": Cause the plane to have 1 extra treasure than it otherwise would have.")]),g.influenceNodes.value.increaseCaches==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("+caches")]),_(": Causes treasures to have an increased chance to be caches.")]),g.influenceNodes.value.increaseGens==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("+gens")]),_(": Causes treasures to have an increased chance to be gens.")]),g.influenceNodes.value.increaseResourceMults==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("+resource mults")]),_(": Causes treasures to have an increased chance to be resource mults.")]),g.influenceNodes.value.increaseEnergyMults==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("+energy mults")]),_(": Causes treasures to have an increased chance to be energy mults.")]),g.influenceNodes.value.increaseInfluences==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("+influences")]),_(": Causes treasures to have an increased chance to be influences.")]),g.influenceNodes.value.relic==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("+relic")]),_(": Maximizes length and difficulty for this tier of plane, and makes the last treasure a relic (unique per tier of plane). Overrides any other difficulty-changing influences.")]),g.influenceNodes.value.increaseDiff==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("+difficulty")]),_(": Causes the difficulty and rewards to be in the upper half of what's possible at this tier.")]),g.influenceNodes.value.decreaseDiff==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("-difficulty")]),_(": Causes the difficulty and rewards to be in the lower half of what's possible at this tier.")]),g.influenceNodes.value.increaseRewards==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[_("+rewards")]),_(": Causes the quality of treasures to be 1 tier higher. Does not affect influences or relics treasures.")])])]):d("div",null,[_("Once you discover influences, summaries will appear here describing their effects.")])]))}))})});return qt("Portal Generator",z(()=>wt(e)),{tabFamily:e})}function Sd(){return qt("Booster",z(()=>d("div",null,[d("p",null,[_("You've created the Booster (\u231B)! This machine let's you increase the rate of time of planes! This affects its resource gain, gen treasures, and any other effects of time.")]),d("br",null,null),d("p",null,[_("Specify planes to boost by dragging their portals to the booster. You can only select a single plane to start, but that can be increased using an action.")]),d("br",null,null),d("p",null,[_("Initially the booster will double the rate of time, but that can be increased using an action.")])])))}function Id(){return qt("Upgrader",z(()=>d("div",null,[d("p",null,[_("You've created the Upgrader (\u{1F916})! This machine let's you automatically purchase upgrades within planes (includes prestiges but not repeatables or dimensions)!")]),d("br",null,null),d("p",null,[_("Specify planes to auto-purchase upgrades from by dragging their portals to the booster. You can only select a single plane to start, but that can be increased using an action.")])])))}function xd(){return qt("Automator",z(()=>d("div",null,[d("p",null,[_("You've created the Automator (\u{1F9BE})! This machine let's you automatically purchase repeatables and dimensions within planes!")]),d("br",null,null),d("p",null,[_("Specify planes to auto-purchase repeatables and dimensions from by dragging their portals to the booster. You can only select a single plane to start, but that can be increased using an action.")])])))}function $d(){return qt("Investments",z(()=>d("div",null,[d("p",null,[_("You've created the Investments machine (\u{1F4B1})! This machine let's you automatically gain the resources from conversions without spending the plane's primary resource!")]),d("br",null,null),d("p",null,[_("Specify planes to gain converted resources from by dragging their portals to the booster. You can only select a single plane to start, but that can be increased using an action.")])])))}const Ed=K({__name:"Spacer",props:{width:{default:"8px"},height:{default:"17px"}},setup(e){return(t,n)=>(S(),A("div",{style:Be({width:e.width,height:e.height})},null,4))}});function Vn(e){return Qe(t=>{var i;const n=e.call(t,t);return n.partialDisplay=r=>d("span",{style:s(n.requirementMet)?"":"color: var(--danger)"},[mi(n.resource,n.cost instanceof m?nn(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),n.display=r=>d("div",null,[s(n.requiresPay)?"Costs: ":"Requires: ",mi(n.resource,n.cost instanceof m?nn(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),D(n,"visibility"),oe(n,"visibility",Me.Visible),D(n,"cost"),D(n,"requiresPay"),oe(n,"requiresPay",!0),D(n,"cumulativeCost"),oe(n,"cumulativeCost",!0),D(n,"maxBulkAmount"),oe(n,"maxBulkAmount",1),D(n,"directSum"),oe(n,"pay",function(r){const a=n.cost instanceof m?nn(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=C(()=>{var l;if(!(n.cost instanceof m))return!1;const r=s(n.maxBulkAmount);if(o.lte(r,1))return!1;const a=s(n.cumulativeCost),u=(l=s(n.directSum))!=null?l:a?10:0;return o.lte(r,u)?!0:!(!n.cost.isInvertible()||a===!0&&!n.cost.isIntegrable())}),n.cost instanceof m?n.requirementMet=Rr(n.cost,n.resource,(i=n.cumulativeCost)!=null?i:!0,n.directSum,n.maxBulkAmount):n.requirementMet=C(()=>o.gte(n.resource.value,s(n.cost))),n})}function er(e){return Qe(()=>({requirementMet:C(()=>Ye(e.visibility)),visibility:Me.None,requiresPay:!1}))}function Dd(e,t){return Qe(()=>({requirementMet:_e(e),partialDisplay:t==null?void 0:z(()=>wt(t)),display:t==null?void 0:z(()=>d(re,null,[_("Req: "),wt(t)])),visibility:t==null?Me.None:Me.Visible,requiresPay:!1}))}function Ni(e){if(At(e))return e.every(Ni);const t=s(e.requirementMet);return typeof t=="boolean"?t:o.gt(t,0)}function Xr(e){if(At(e))return e.map(Xr).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 Ci(e,t=1){var n,i;if(At(e)&&(e=e.filter(r=>Ye(r.visibility)),e.length===1&&(e=e[0])),At(e)){e=e.filter(u=>"partialDisplay"in u);const r=e.filter(u=>s(u.requiresPay)),a=e.filter(u=>!s(u.requiresPay));return d(re,null,[r.length>0?d("div",null,[_("Costs:")," ",dr(r.map(u=>u.partialDisplay(t)),d(re,null,[_(", ")]))]):null,a.length>0?d("div",null,[_("Requires:")," ",dr(a.map(u=>u.partialDisplay(t)),d(re,null,[_(", ")]))]):null])}return(i=(n=e.display)==null?void 0:n.call(e))!=null?i:d(re,null,null)}function Kr(e,t=1){var n;At(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 Td=K({props:{visibility:{type:q(Number,Boolean),required:!0},display:q(Object,String,Function),earned:{type:q(Boolean),required:!0},requirements:q(Object,Array),image:q(String),style:q(String,Object,Array),classes:q(Object),mark:q(Boolean,String),small:q(Boolean),id:{type:String,required:!0}},components:{Node:Qn,MarkNode:Jn},setup(e){const{display:t,requirements:n,earned:i}=De(e),r=bt("");return It(()=>{const a=Ee(t);if(a==null){r.value="";return}if(xt(a)){r.value=pe(a);return}const u=pe(a.requirement?a.requirement:z(()=>{var p;return Ci((p=Ee(n))!=null?p:[])}),"h3"),l=pe(a.effectDisplay||"","b"),c=Ee(i)?pe(a.optionsDisplay||"","span"):"";r.value=pe(z(()=>d("span",null,[d(u,null,null),a.effectDisplay!=null?d("div",null,[d(l,null,null)]):null,a.optionsDisplay!=null?d("div",{class:"equal-spaced"},[d(c,null,null)]):null])))}),{comp:r,unref:s,Visibility:Me,isVisible:Ye,isHidden:bn}}});function Pd(e,t,n,i,r,a){var c;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(S(),A("div",{key:0,style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0,backgroundImage:e.earned&&e.image&&`url(${e.image})`||""},(c=e.unref(e.style))!=null?c:[]]),class:Ne({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?(S(),te(Je(e.comp),{key:0})):j("",!0),d(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],6)):j("",!0)}var Ad=ve(Td,[["render",Pd],["__scopeId","data-v-5673325a"]]);const Rd=hi(),Fd=Symbol("Achievement");let $n=function(e){return e.All="all",e.Configurable="configurable",e.Incomplete="incomplete",e.None="none",e}({});function Od(e,...t){const n=ut(!1,!1),i=t.reduce((r,a)=>{var u;return Object.assign(r,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return Qe(r=>{var c,p,h;const a=(c=e==null?void 0:e.call(r,r))!=null?c:{};a.id=Xt("achievement-"),a.type=Fd,a[ft]=Ad;for(const f of t)(p=f.preConstruct)==null||p.call(f,a);a.earned=n,a.complete=function(){var b,v;if(n.value)return;n.value=!0;const f=a;if((b=f.onComplete)==null||b.call(f),f.display!=null&&s(f.showPopups)===!0){const y=s(f.display);let N;xt(y)?N=pe(y):y.requirement!=null?N=pe(y.requirement):N=Ci((v=f.requirements)!=null?v:[]),Rd.info(d("div",null,[d("h3",null,[_("Treasure earned!")]),d("div",null,[d(N,null,null)])]))}},Object.assign(a,i),D(a,"visibility"),oe(a,"visibility",Me.Visible);const u=a.visibility;a.visibility=ca(()=>{const f=s(a.display);switch(ce.msDisplay){default:case $n.All:return s(u);case $n.Configurable:return s(a.earned)&&!(f!=null&&typeof f=="object"&&"optionsDisplay"in f)?Me.None:s(u);case $n.Incomplete:return s(a.earned)?Me.None:s(u);case $n.None:return Me.None}}),D(a,"display"),D(a,"mark"),D(a,"small"),D(a,"image"),D(a,"style"),D(a,"classes"),D(a,"showPopups"),oe(a,"showPopups",!0);for(const f of t)(h=f.postConstruct)==null||h.call(f,a);const l=t.reduce((f,b)=>{var v;return Object.assign(f,(v=b.getGatheredProps)==null?void 0:v.call(b,a))},{});if(a[ct]=function(){const{visibility:f,display:b,requirements:v,earned:y,image:N,style:x,classes:E,mark:I,small:P,id:B}=this;return{visibility:f,display:b,requirements:v,earned:y,image:N,style:s(x),classes:E,mark:I,small:P,id:B,...l}},a.requirements){const f=a,b=[er(f),Dd(()=>!f.earned.value),...At(a.requirements)?a.requirements:[a.requirements]];It(()=>{ce.active===X.id&&Ni(b)&&f.complete()})}return a})}tt.on("loadSettings",e=>{oe(e,"msDisplay",$n.All)});const qd=Object.values($n).map(e=>({label:at(e),value:e}));ys(z(()=>d(Ji,{title:z(()=>d("span",{class:"option-title"},[_("Show achievements"),d("desc",null,[_("Select which achievements to display based on criterias.")])])),options:qd,"onUpdate:modelValue":e=>ce.msDisplay=e,modelValue:ce.msDisplay},null)));const Vd=K({props:{progress:{type:q(String,Object,Number),required:!0},width:{type:q(Number),required:!0},height:{type:q(Number),required:!0},direction:{type:q(String),required:!0},display:q(Object,String,Function),visibility:{type:q(Number,Boolean),required:!0},style:q(Object,String,Array),classes:q(Object),borderStyle:q(Object,String,Array),textStyle:q(Object,String,Array),baseStyle:q(Object,String,Array),fillStyle:q(Object,String,Array),mark:q(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Jn,Node:Qn},setup(e){const{progress:t,width:n,height:i,direction:r,display:a}=De(e),u=C(()=>{let p=t.value instanceof o?t.value.toNumber():Number(t.value);return(1-Math.min(Math.max(p,0),1))*100}),l=C(()=>{const p={width:Ee(n)+.5+"px",height:Ee(i)+.5+"px"};switch(s(r)){case H.Up:p.clipPath=`inset(${u.value}% 0% 0% 0%)`,p.width=Ee(n)+1+"px";break;case H.Down:p.clipPath=`inset(0% 0% ${u.value}% 0%)`,p.width=Ee(n)+1+"px";break;case H.Right:p.clipPath=`inset(0% ${u.value}% 0% 0%)`;break;case H.Left:p.clipPath=`inset(0% 0% 0% ${u.value} + '%)`;break;case H.Default:p.clipPath="inset(0% 50% 0% 0%)";break}return p}),c=An(a);return{normalizedProgress:u,barStyle:l,component:c,unref:s,Visibility:Me,isVisible:Ye,isHidden:bn}}});function Bd(e,t,n,i,r,a){var c,p,h,f,b,v,y;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(S(),A("div",{key:0,style:Be([{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:Ne({bar:!0,...e.unref(e.classes)})},[k("div",{class:"overlayTextContainer border",style:Be([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(p=e.unref(e.borderStyle))!=null?p:{}])},[e.component?(S(),A("span",{key:0,class:"overlayText",style:Be(e.unref(e.textStyle))},[(S(),te(Je(e.component)))],4)):j("",!0)],4),k("div",{class:"border",style:Be([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(h=e.unref(e.style))!=null?h:{},(f=e.unref(e.baseStyle))!=null?f:{},(b=e.unref(e.borderStyle))!=null?b:{}])},[k("div",{class:"fill",style:Be([e.barStyle,(v=e.unref(e.style))!=null?v:{},(y=e.unref(e.fillStyle))!=null?y:{}])},null,4)],4),d(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],6)):j("",!0)}var Ld=ve(Vd,[["render",Bd],["__scopeId","data-v-6bd06b56"]]);const jd=Symbol("Bar");function zd(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return Qe(i=>{var u,l;const r=e.call(i,i);r.id=Xt("bar-"),r.type=jd,r[ft]=Ld;for(const c of t)(u=c.preConstruct)==null||u.call(c,r);Object.assign(r,n),D(r,"visibility"),oe(r,"visibility",Me.Visible),D(r,"width"),D(r,"height"),D(r,"direction"),D(r,"style"),D(r,"classes"),D(r,"borderStyle"),D(r,"baseStyle"),D(r,"textStyle"),D(r,"fillStyle"),D(r,"progress"),D(r,"display"),D(r,"mark");for(const c of t)(l=c.postConstruct)==null||l.call(c,r);const a=t.reduce((c,p)=>{var h;return Object.assign(c,(h=p.getGatheredProps)==null?void 0:h.call(p,r))},{});return r[ct]=function(){const{progress:c,width:p,height:h,direction:f,display:b,visibility:v,style:y,classes:N,borderStyle:x,textStyle:E,baseStyle:I,fillStyle:P,mark:B,id:le}=this;return{progress:c,width:p,height:h,direction:f,display:b,visibility:v,style:s(y),classes:N,borderStyle:x,textStyle:E,baseStyle:I,fillStyle:P,mark:B,id:le,...a}},r})}function Gd(e,...t){return Qe(n=>{var r,a;const i=e.call(n,n);for(const u of t)(r=u.preConstruct)==null||r.call(u,i);i.formula=i.formula(m.variable(i.baseResource)),i.currentGain==null&&(i.currentGain=C(()=>{let u=o.floor(i.formula.evaluate(i.baseResource.value)).max(0);return s(i.buyMax)===!1&&(u=u.min(1)),u})),i.actualGain==null&&(i.actualGain=i.currentGain),i.currentAt==null&&(i.currentAt=C(()=>i.formula.invert(o.floor(s(i.currentGain))))),i.nextAt==null&&(i.nextAt=C(()=>i.formula.invert(o.floor(s(i.currentGain)).add(1)))),i.convert==null&&(i.convert=function(){var l;const u=s(i.currentGain);i.gainResource.value=o.add(i.gainResource.value,u),i.spend(u),(l=i.onConvert)==null||l.call(i,u)}),i.spend==null&&(i.spend=function(){i.baseResource.value=0}),D(i,"currentGain"),D(i,"actualGain"),D(i,"currentAt"),D(i,"nextAt"),D(i,"buyMax"),oe(i,"buyMax",!0);for(const u of t)(a=u.postConstruct)==null||a.call(u,i);return i})}function Ud(e){return Gd(e)}function Wd(e,t,n=1,i=o.dInf){const r=_e(n),a=_e(i);e.on("preUpdate",u=>{const l=s(r);o.neq(l,0)&&(t.gainResource.value=o.add(t.gainResource.value,o.times(l,u).times(o.ceil(s(t.actualGain)))).min(s(a)).max(t.gainResource.value))})}const Hd={postConstruct(e){e.amount===void 0&&console.error(`Decorated feature ${e.id} does not contain the required 'amount' property"`),D(e,"bonusAmount"),e.totalAmount===void 0&&(e.totalAmount=C(()=>{var t;return o.add(s((t=e.amount)!=null?t:0),s(e.bonusAmount))}))}},Jr=Symbol("Repeatable");function gr(e,...t){const n=ut(0),i=t.reduce((r,a)=>{var u;return Object.assign(r,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return Qe(r=>{var b,v,y;const a=e.call(r,r);a.id=Xt("repeatable-"),a.type=Jr,a[ft]=Yr;for(const N of t)(b=N.preConstruct)==null||b.call(N,a);a.amount=n,a.amount[Zt]=(v=a.initialAmount)!=null?v:0,Object.assign(a,i);const u={requirementMet:C(()=>o.sub(s(a.limit),a.amount.value)),requiresPay:!1,visibility:Me.None,canMaximize:!0},l=er(a);At(a.requirements)?(a.requirements.unshift(l),a.requirements.push(u)):a.requirements=[l,a.requirements,u],a.maxed=C(()=>o.gte(a.amount.value,s(a.limit))),D(a,"classes");const c=a.classes;a.classes=C(()=>{const N=s(c)||{};return a.maxed.value&&(N.bought=!0),N}),a.amountToIncrease=C(()=>o.clampMin(Xr(a.requirements),1)),a.canClick=C(()=>Ni(a.requirements));const p=a.onClick;a.onClick=function(N){var I;const x=a;if(!s(x.canClick))return;const E=(I=s(a.amountToIncrease))!=null?I:1;Kr(a.requirements,E),x.amount.value=o.add(x.amount.value,E),p==null||p(N)},D(a,"display");const h=a.display;a.display=z(()=>{var x,E,I;const N=s(h);if(xt(N)){const P=pe(N);return d(P,null,null)}if(N!=null){const P=a,B=pe((x=N.title)!=null?x:"","h3"),le=pe((E=N.description)!=null?E:""),ae=pe((I=N.effectDisplay)!=null?I:"");return d("span",null,[N.title==null?null:d("div",null,[d(B,null,null)]),N.description==null?null:d(le,null,null),N.showAmount===!1?null:d("div",null,[d("br",null,null),d(re,null,[_("Amount: "),ot(P.amount.value)]),o.isFinite(s(P.limit))?d(re,null,[_(" / "),ot(s(P.limit))]):void 0]),N.effectDisplay==null?null:d("div",null,[d("br",null,null),_("Currently: "),d(ae,null,null)]),P.maxed.value?null:d("div",null,[d("br",null,null),Ci(P.requirements,s(a.amountToIncrease))])])}return""}),D(a,"visibility"),oe(a,"visibility",Me.Visible),D(a,"limit"),oe(a,"limit",o.dInf),D(a,"style"),D(a,"mark"),D(a,"small");for(const N of t)(y=N.postConstruct)==null||y.call(N,a);const f=t.reduce((N,x)=>{var E;return Object.assign(N,(E=x.getGatheredProps)==null?void 0:E.call(x,a))},{});return a[ct]=function(){const{display:N,visibility:x,style:E,classes:I,onClick:P,canClick:B,small:le,mark:ae,id:ne}=this;return{display:N,visibility:x,style:s(E),classes:I,onClick:P,canClick:B,small:le,mark:ae,id:ne,...f}},a})}const Yd=Symbol("Reset");function Zd(e){return Qe(t=>{const n=e.call(t,t);return n.id=Xt("reset-"),n.type=Yd,n.reset=function(){var r;const i=a=>{if(a!=null&&typeof a=="object"&&!(a instanceof o)&&!(a instanceof m)){if(Kn in a&&a[Kn]===!0)return;if(Zt in a){const u=a;u.value=u[Zt]}else!(a instanceof o)&&!Fe(a)&&Object.values(a).forEach(u=>i(u))}};s(n.thingsToReset).forEach(i),tt.emit("reset",n),(r=n.onReset)==null||r.call(n)},D(n,"thingsToReset"),n})}const oi={};tt.on("removeLayer",e=>{var t;(t=oi[e.id])==null||t.call(oi),oi[e.id]=void 0});function Fi(e,t){return D(t,"display"),D(t,"classes"),D(t,"style"),D(t,"direction"),oe(t,"direction",H.Up),D(t,"xoffset"),D(t,"yoffset"),t.pinnable&&(t.pinned=ut(!1,!1)),Ht(()=>{t.pinnable&&("pinned"in e?(console.error("Cannot add pinnable tooltip to element that already has a property called 'pinned'"),t.pinnable=!1,Fr(t.pinned)):e.pinned=t.pinned);const n=e[ft];e[ft]=Re;const i=e[ct].bind(e);e[ct]=function(){const{display:a,classes:u,style:l,direction:c,xoffset:p,yoffset:h,pinned:f}=this;return{element:{[ft]:n,[ct]:i},display:a,classes:u,style:s(l),direction:c,xoffset:p,yoffset:h,pinned:f}}.bind(t)}),t}var Xd=K({props:{display:{type:q(String,Object,Function),required:!0},visibility:{type:q(Number,Boolean),required:!0},style:q(String,Object,Array),classes:q(Object),requirements:{type:Object,required:!0},canPurchase:{type:q(Boolean),required:!0},bought:{type:q(Boolean),required:!0},mark:q(Boolean,String),id:{type:String,required:!0},purchase:{type:Function,required:!0}},components:{Node:Qn,MarkNode:Jn},setup(e){const{display:t,requirements:n,bought:i}=De(e),r=bt("");return It(()=>{const a=Ee(t);if(a==null){r.value="";return}if(xt(a)){r.value=pe(a);return}const u=pe(a.title||"","h3"),l=pe(a.description,"div"),c=pe(a.effectDisplay||"");r.value=pe(z(()=>d("span",null,[a.title!=null?d("div",null,[d(u,null,null)]):null,d(l,null,null),a.effectDisplay!=null?d("div",null,[_("Currently: "),d(c,null,null)]):null,i.value?null:d(re,null,[d("br",null,null),Ci(n.value)])])))}),{component:r,unref:s,Visibility:Me,isVisible:Ye,isHidden:bn}}});const Kd=["disabled"];function Jd(e,t,n,i,r,a){var c;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(S(),A("button",{key:0,style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:{}]),onClick:t[0]||(t[0]=(...p)=>e.purchase&&e.purchase(...p)),class:Ne({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)?(S(),te(Je(e.unref(e.component)),{key:0})):j("",!0),d(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],14,Kd)):j("",!0)}var Qd=ve(Xd,[["render",Jd],["__scopeId","data-v-9be6bac0"]]);const tr=Symbol("Upgrade");function mr(e,...t){const n=ut(!1,!1),i=t.reduce((r,a)=>{var u;return Object.assign(r,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return Qe(r=>{var c,p;const a=e.call(r,r);a.id=Xt("upgrade-"),a.type=tr,a[ft]=Qd;for(const h of t)(c=h.preConstruct)==null||c.call(h,a);a.bought=n,Object.assign(a,i),a.canPurchase=C(()=>!n.value&&Ni(a.requirements)),a.purchase=function(){var f;const h=a;!s(h.canPurchase)||(Kr(a.requirements),n.value=!0,(f=h.onPurchase)==null||f.call(h))};const u=er(a);At(a.requirements)?a.requirements.unshift(u):a.requirements=[u,a.requirements],D(a,"visibility"),oe(a,"visibility",Me.Visible),D(a,"classes"),D(a,"style"),D(a,"display"),D(a,"mark");for(const h of t)(p=h.postConstruct)==null||p.call(h,a);const l=t.reduce((h,f)=>{var b;return Object.assign(h,(b=f.getGatheredProps)==null?void 0:b.call(f,a))},{});return a[ct]=function(){const{display:h,visibility:f,style:b,classes:v,requirements:y,canPurchase:N,bought:x,mark:E,id:I,purchase:P}=this;return{display:h,visibility:f,style:s(b),classes:v,requirements:y,canPurchase:N,bought:x,mark:E,id:I,purchase:P,...l}},a})}function ep(e,t,n=[]){n=n.length===0?Zn(e,tr):n;const i=Hn(t)?C(t):t;e.on("update",()=>{s(i)&&n.forEach(r=>r.purchase())})}function tp(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 np={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"]},vr=[[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 Oi(e){const t=vr[Math.floor(e()*vr.length)];let n="";for(let i=0;i<t.length;i++){const r=np[t[i]];n+=r[Math.floor(e()*r.length)]}return at(n)}const ip={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"]},hr=[[1,2,1,4,5],[1,4,5],[2,1,4,5],[1,2,3,4,5],[3,4,5]];function In(e){const t=hr[Math.floor(e()*hr.length)];let n="";for(let i=0;i<t.length;i++){const r=ip[t[i]];n+=r[Math.floor(e()*r.length)]}return at(n)}function Bn(e,t){const[n,i,r]=rp(...e),[a,u,l]=ap(Math.floor(t()*360),i,r);return`rgb(${a*255}, ${u*255}, ${l*255})`}function rp(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 ap(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 br=hi();function Qr(e,t,n,i){return Zi(e,function(){const r=tp(0,n>>0,n>>32,1);for(let V=0;V<12;V++)r();const a=Oi(r),u=Bn([.64,.75,.55],r),l=Bn([.18,.2,.25],r),c=xn(0,Oi(r)),p=ut(0),h=zt.indexOf(t);let f=r();const b=i.reduce((V,L)=>(V[L.type]=L.data,V),{});"increaseDiff"in b&&(f=f/2+.5),"decreaseDiff"in b&&(f=f/2),"relic"in b&&(f=1);const v=f+h+1,y=g.toolNodes.value.sandRelic!=null?ee("sandRelic")?2:1:0,N=ut(y),x=C(()=>("increaseRewards"in b?v+1:v)+N.value);let E="relic"in b?h+2:Math.ceil(r()*(h+2));"increaseLength"in b&&E++;const I=[],P=Nt(()=>I),B=C(()=>P.apply(0)),le=[],ae={};function ne({feature:V,canClick:L,modifier:$e,cost:nt,previewModifier:Cn,showETA:ze,previewCost:Et}){L=_e(L),ze=_e(ze);const Lt=pr(V);le.push({shouldShowPreview:C(()=>s(L)&&Lt.value),modifier:Nt(()=>{const jt=I.slice();return jt.splice(jt.indexOf($e),1,Cn),jt}),cost:Et!=null?Et:nt}),I.push($e);const Mt=Ai(c,B,()=>Se(nt)),it=Fi(V,{display:ze==null?Mt:()=>s(ze)?Mt.value:"",direction:H.Down});return{isHovering:Lt,eta:Mt,tooltip:it}}const Q=[],Ie=G(0);let he=m.variable(Ie).times(0),W=0,be=!0;const je=C(()=>o.add(v,r()-.5).pow_base(2).times(10).times(he.evaluate())),gt=[];for(let V=0;V<E;V++){const L={upgrades:32,repeatables:V<=1?0:16,conversion:V<=2?0:12,xp:V<=3?0:8,dimensions:V<=4?0:6,prestige:V<=5||V>=E-1?0:4};switch(li(L,r)){case"upgrades":const T=[];for(let R=0;R<4;R++){const Y=li({add:1,mult:V===0&&R===0?0:1},r),Ge=je.value,Xe=In(r);let qe="",Ae,fe;switch(Y){case"add":{const ue=o.add(Ge,10).pow(r()/4+1);qe=`Gain ${xe(ue)} ${c.displayName}/s`,he=he.add(ue),Ae=rt=>Ut(()=>({addend:ue,description:Xe,enabled:rt==null?ye.bought:()=>rt()&&ye.bought.value})),fe=Ut(()=>({addend:ue}));break}case"mult":{const ue=r()*5+1;qe=`Multiply previous ${c.displayName} gain by x${xe(ue)}.`;const rt=W;he=he.add(o.sub(ue,1).times(rt)),Ae=Ke=>ke(()=>({multiplier:ue,description:Xe,enabled:Ke==null?ye.bought:()=>Ke()&&ye.bought.value})),fe=ke(()=>({multiplier:ue}));break}}W=he.evaluate(),Ie.value++;const Pe=be,ye=mr(()=>({requirements:Vn(()=>({resource:Sn(c),cost:Ge,requiresPay:()=>g.toolNodes.value.unobtainiumRelic==null})),display:{title:Xe,description:qe},visibility:Pe}));ne({feature:ye,canClick:()=>ye.canPurchase.value,modifier:Ae(),cost:Ge,previewCost:C(()=>g.toolNodes.value.unobtainiumRelic==null?Ge:0),showETA:()=>!ye.bought.value,previewModifier:fe}),I.push(Ae(()=>Y==="add"?g.toolNodes.value.stoneRelic!=null:ee("stoneRelic"))),T.push(ye)}Q.push(T);break;case"repeatables":const F=[];for(let R=0;R<3;R++){const Y=li({add:1.5,mult:3},r),Ge=Ie.value,Xe=je.value,qe=In(r);let Ae="",fe,Pe,ye,ue;const rt=m.variable(C(()=>se.amount.value)).times(2);switch(Y){case"add":{const Ue=o.add(Xe,10).times(r()+.5);Ae=`Gain ${xe(Ue)} ${c.displayName}/s`,ue=rt.add(1).times(Xe),he=he.add(C(()=>o.sub(Ie.value,Ge).times(2).add(1).pow(2).clampMax(100).times(Ue))),fe=C(()=>xe(o.times(Ue,s(se.totalAmount)))+"/s"),Pe=Ut(()=>({addend:()=>o.times(Ue,s(se.totalAmount)),description:qe,enabled:()=>o.gt(s(se.totalAmount),0)})),ye=Ut(()=>({addend:()=>o.add(s(se.totalAmount),se.amountToIncrease.value).times(Ue)}));break}case"mult":{const Ue=r()*.75+1.25;Ae=`Multiply previous ${c.displayName} gain by x${xe(Ue)}.`,ue=rt.add(1).pow_base(Ue).times(Xe);const st=W;he=he.add(C(()=>o.sub(Ie.value,Ge).times(2).add(1).pow(2).clampMax(100).pow_base(Ue).sub(1).times(st))),fe=C(()=>"x"+xe(o.pow(Ue,s(se.totalAmount)))),Pe=ke(()=>({multiplier:()=>o.pow(Ue,s(se.totalAmount)),description:qe,enabled:()=>o.gt(s(se.totalAmount),0)})),ye=ke(()=>({multiplier:()=>o.add(s(se.totalAmount),se.amountToIncrease.value).pow_base(Ue)}));break}}W=he.evaluate(),Ie.value++;const Ke=be,se=gr(()=>({requirements:Vn(()=>({resource:Sn(c),cost:ue,maxBulkAmount:()=>g.toolNodes.value.diamondRelic!=null?o.dInf:1,requiresPay:()=>g.toolNodes.value.unobtainiumRelic==null})),display:()=>({title:qe,description:`${Ae}<br/><br/>Amount: ${ot(se.amount.value)}${o.gt(s(se.bonusAmount),0)?` [+${ot(s(se.bonusAmount))}]`:""}`,effectDisplay:s(fe),showAmount:!1}),visibility:Ke,limit:100,bonusAmount:()=>o.gt(se.amount.value,0)?ee("dirtRelic")?2:g.toolNodes.value.dirtRelic!=null?1:0:0}),Hd);ne({feature:se,canClick:()=>s(se.canClick),modifier:Pe,cost:ue,previewModifier:ye,previewCost:C(()=>g.toolNodes.value.unobtainiumRelic==null?nn(ue,se.amountToIncrease.value):0),showETA:()=>!se.maxed.value}),F.push(se)}Q.push(F);break;case"conversion":{const R=xn(0,Oi(r)),U=Bn([.64,.75,.55],r),Y=je.value,Ge=r()/2+.25,Xe=r()/2+.25,qe=Ie.value,Ae=W;he=he.add(C(()=>o.sub(Ie.value,qe).add(1).times(2).pow10().times(Ae)));const fe=Ud(()=>({baseResource:Sn(c),gainResource:R,formula:Ei=>Ei.div(Y).pow(Ge).times(C(()=>g.toolNodes.value.ironRelic!=null?ee("ironRelic")?4:2:1)),spend(){c.value=0}}));W=he.evaluate(),Ie.value+=2;const Pe=be,ye=In(r),ue=m.variable(R).pow(Xe).add(1),rt=ke(()=>({multiplier:()=>ue.evaluate(),description:ye,enabled:()=>o.gt(R.value,0)})),Ke=ke(()=>({multiplier:()=>ue.evaluate(o.add(R.value,fe.actualGain.value))})),se=dd(()=>({display:{title:ye,description:z(()=>d("span",null,[_("Reset "),c.displayName,_(" for")," ",mi(R,o.clampMin(fe.actualGain.value,1))," ",R.displayName,d("br",null,null),d("div",null,[_("Next:")," ",mi(c,o.lt(fe.actualGain.value,1)?fe.currentAt.value:fe.nextAt.value)," ",c.displayName])]))},style:{width:"200px",minHeight:"100px"},canClick:()=>o.gte(fe.actualGain.value,1),prestigeResource:R,onClick:fe.convert,visibility:Pe})),{isHovering:Ue}=ne({feature:se,canClick:()=>s(se.canClick),modifier:rt,cost:Y,previewCost:c,previewModifier:Ke}),st=C(()=>Ue.value&&se.canClick.value);Q.push([se]);const qn=dn(m.variable(R),st,fe.actualGain),et=dn(ue,st,fe.actualGain);ae[V*2]=z(()=>d(re,null,[Ye(se.visibility)?d("div",{style:"margin: 10px"},[_("You have")," ",d("h2",{style:{color:U,textShadow:`0px 0px 10px ${U}`}},[qn()])," ",R.displayName,_(","),d("br",null,null),_("providing a "),et(),_("x multiplier to previous")," ",c.displayName,_(" gain")]):null,Pi(se)])),Wd(this,fe,()=>Ze.value.length<E&&g.investments.value!=null&&Ce(g.investments.value)&&g.investments.value.state.portals.includes(e)?o.div($t.value,100):0);break}case"xp":{const R=xn(0),U=be,Y=Ie.value,Ge=In(r),Xe=o.add(v,r()-.5).pow_base(1.25).times(10),qe=r()/4+1.125,Ae=r()/2+1.25,fe=m.variable(0).pow(qe).times(Xe),Pe=Rr(fe,R,!0,10,o.dInf),ye=C(()=>nn(fe,Pe.value,!0,10)),ue=C(()=>nn(fe,o.add(Pe.value,1),!0,10)),rt=C(()=>o.pow(Ae,Pe.value)),Ke=ke(()=>({multiplier:rt,description:Ge,enabled:()=>Ye(st.visibility)})),se=W;he=he.add(C(()=>o.sub(Ie.value,Y).add(1).times(3).pow(Ae).times(se))),W=he.evaluate(),Ie.value+=3;const Ue=Bn([.64,.75,.55],r),st=zd(()=>({direction:H.Right,width:300,height:20,progress:()=>o.sub(R.value,ye.value).div(o.sub(ue.value,ye.value)).toNumber(),visibility:U,xp:R,display:z(()=>d("span",null,[xe(R.value),_("/"),xe(ue.value)])),fillStyle:`background-color: ${Ue}`,textStyle:"text-shadow: 5px 0 10px black"}));this.on("preUpdate",qn=>{if(Ze.value.length<E&&g.activePortals.value.some(et=>et.state.id===e)&&Ye(st.visibility)){let et=o.times($t.value,qn);g.toolNodes.value.goldRelic!=null&&(et=o.times(ee("goldRelic")?.5:.25,Ze.value.length).add(1).times(et)),R.value=o.add(et,R.value)}}),I.push(Ke),Q.push([st]),ae[V*2]=z(()=>d(re,null,[Ye(st.visibility)?d("div",{style:"margin: 10px"},[_("You have "),d("h3",null,[Ge]),_(" Lv. "),ot(Pe.value),_(","),d("br",null,null),_("providing a "),xe(rt.value),_("x multiplier to previous")," ",c.displayName,_(" gain"),d("br",null,null)]):null,Pi(st)]));break}case"dimensions":{const R=In(r),U=xn(0,R+" energy"),Y=Bn([.64,.75,.55],r),Ge=Ie.value,Xe=W;he=he.add(C(()=>o.sub(Ie.value,Ge).add(1).pow_base(32).add(1).log2().add(1).times(Xe)));const qe=C(()=>o.add(U.value,1).log2().add(1)),Ae=ke(()=>({multiplier:qe,description:R,enabled:()=>o.gt(U.value,0)}));I.push(Ae);const fe=be,Pe=[];for(let ye=0;ye<4;ye++){const ue=o.add(v,r()-.5).pow_base(2).times(10).recip(),rt=je.value,Ke=m.variable(C(()=>et.amount.value)),se=Ke.pow_base(o.pow10(ye+1)).times(rt),Ue=["First","Second","Third","Fourth"][ye]+" "+R+" Dimension",st=xn(0,Ue),qn=Ke.sub(1).pow_base(2).times(ue).times(C(()=>o.add(et.amount.value,st.value))),et=gr(()=>({display:{title:Ue,description:z(()=>d("div",null,[d("div",null,[_("Amount:")," ",xe(o.add(st.value,et.amount.value))," ",_("["),ot(et.amount.value),_("]")])])),effectDisplay:z(()=>d("span",null,[ta()," ",ye===0?U.displayName:["First","Second","Third","Fourth"][ye-1]+" "+R+" Dimension",_("/s")])),showAmount:!1},style:{width:"400px"},effect:qn,dimensions:st,limit:100,energy:ye===0?U:void 0,requirements:Vn(()=>({resource:Sn(c),cost:se,maxBulkAmount:()=>ee("diamondRelic")!=null?o.dInf:1,requiresPay:()=>!ee("unobtainiumRelic")})),visibility:fe}));Pe.push(et);const Ei=pr(et),ir=C(()=>s(et.canClick)&&Ei.value),ea=new m({inputs:[Ke],evaluate(rr){return o.sub(rr,1).pow_base(2).times(ue).times(o.add(rr,st.value))}}),ta=dn(ea,ir);le.push({shouldShowPreview:ir,cost:C(()=>ee("unobtainiumRelic")?0:nn(se,et.amountToIncrease.value))});const na=Ai(c,B,()=>Se(se));Fi(et,{display:na,direction:H.Down}),W=he.evaluate(),Ie.value++}this.on("preUpdate",ye=>{if(Ze.value.length<E&&g.activePortals.value.some(ue=>ue.state.id===e)&&Ye(fe)){let ue=o.times($t.value,ye);g.toolNodes.value.platinumRelic!=null&&(ue=o.times(ee("platinumRelic")?4:2,ue));const rt=Pe[0].effect.evaluate();U.value=o.times(rt,ue).add(U.value);for(let Ke=1;Ke<4;Ke++){const se=Pe[Ke].effect.evaluate();Pe[Ke-1].dimensions.value=o.times(se,ue).add(Pe[Ke-1].dimensions.value)}}}),Q.push(Pe),ae[V*2]=z(()=>d(re,null,[Ye(fe)?d("div",{style:"margin: 10px"},[_("You have")," ",d("h2",{style:{color:Y,textShadow:`0px 0px 10px ${Y}`}},[xe(U.value)])," ",U.displayName,_(","),d("br",null,null),_("providing a "),xe(qe.value),_("x multiplier to previous")," ",c.displayName,_(" gain")]):null,Ss(...Pe)]));break}case"prestige":{const R=In(r),U=be,Y=r()/10+1.1,Ge=je.value;he=he.pow(Y);const Xe=Qc(()=>({exponent:Y,description:R,enabled:fe.bought}));W=he.evaluate(),Ie.value+=20;const qe=Q.filter((ye,ue)=>ue%2===0),Ae=Zd(()=>({thingsToReset:qe,onReset(){c.value=0}})),fe=mr(()=>({display:{title:R,description:`Reset all previous ${a} content to raise all previous ${c.displayName} gain to the ^${xe(Y)}`},style:{width:"200px",minHeight:"100px"},onPurchase:()=>{ee("unobtainiumRelic")||Ae.reset()},visibility:U,requirements:Vn(()=>({resource:Sn(c),cost:Ge,requiresPay:!1}))})),Pe=ke(()=>({multiplier:0}));ne({feature:fe,canClick:()=>s(fe.canPurchase),modifier:Xe,cost:Ge,previewCost:C(()=>ee("unobtainiumRelic")?0:c.value),previewModifier:Pe,showETA:()=>!s(fe.bought)}),Q.push([fe]);break}}const nt={cache:"increaseCaches"in b?10:1,generation:"increaseGens"in b?10:1,resourceMulti:"increaseResourceMults"in b?10:1,energyMulti:"increaseEnergyMults"in b?2.5:.25,influences:Object.keys(g.influenceNodes.value).length+gt.length===Object.keys(pt).length?0:"increaseInfluences"in b?20:2,relic:0};let Cn=li(nt,r);V===E-1&&"relic"in b&&(Cn="relic");let ze="",Et,Lt,Mt,it,jt,Jt;switch(Cn){case"cache":it=qi(r,i),ze=`Cache: Gain ${xe(o.div(x.value,12))}x your current ${it} (no modifiers).`,Lt=()=>{var R,U,Y;return g.grantResource(it,o.times((Y=(U=(R=g.resourceNodes.value[it])==null?void 0:R.state)==null?void 0:U.amount)!=null?Y:0,o.div(x.value,12)))};break;case"generation":it=qi(r,i);const T=o.div(x.value,40).times(St[it]);ze=`Gen: Gain ${xe(T)} ${it}/s while plane is active.`,Et=R=>g.grantResource(it,o.times(R,T)),Mt=C(()=>g.resourceNodes.value[it]);break;case"resourceMulti":jt=it=qi(r,i),Jt=o.div(x.value,10).pow_base(2),ze=`Resource Mult: Gain ${xe(Jt)}x ${it} while plane is active.`;break;case"energyMulti":jt="energy",Jt=o.div(x.value,8).add(1),ze=`Energy Mult: Gain ${xe(Jt)}x energy while plane is active.`;break;case"influences":const F=Object.keys(pt)[Math.floor(r()*Object.keys(pt).length)];gt.push(F),ze=`Influence: Gain a portal influence (${pt[F].display})`,Lt=()=>{if(F in g.influenceNodes.value){br.warning(`You already have a ${pt[F].display} influence, skipping treasure`);return}const R={id:Pn(g.board),position:{...g.board.types.portal.nodes.value.find(U=>U.state.id===e).position},type:"influence",state:{type:F,data:pt[F].initialData}};g.board.placeInAvailableSpace(R),g.board.nodes.value.push(R)};break;case"relic":ze=t==="ultimatum"?"Win the game!":`Relic: Gain the ${t}-tier planar relic (${Dt[t]})`,Lt=()=>{if(t==="ultimatum"){nr.value=!0;return}if(`${t}Relic`in g.toolNodes.value)br.warning(`You already have a ${Dt[t]} relic, skipping treasure`);else{const R={id:Pn(g.board),position:{...g.board.types.portal.nodes.value.find(U=>U.state.id===e).position},type:"passive",state:`${t}Relic`};g.board.placeInAvailableSpace(R),g.board.nodes.value.push(R)}}}const $i=be,kn=je.value,Mn=Od(()=>({requirements:Vn(()=>({resource:Sn(c),cost:kn})),visibility:$i,display:{requirement:`${xe(kn)} ${c.displayName}`,effectDisplay:ze},style:"width: 100%",classes:{final:V===E-1},update:Et,onComplete:Lt,link:Mt,effectedResource:jt,resourceMulti:Jt})),$=Ai(c,B,kn);Fi(Mn,{display:()=>Mn.earned.value?"":$.value,direction:H.Down}),Q.push([Mn]),be=C(()=>Mn.earned.value)}const Vt=Zn(Q,tr),mt=Zn(Q,Jr);I.push(ke(()=>({multiplier:()=>ee("silver")?4:2,description:()=>(ee("silver")?"Empowered ":"")+Ve.silver.name,enabled:()=>g.toolNodes.value.silver!=null})),ke(()=>({multiplier:()=>o.add(1,(ee("diamond")?2:1)*Vt.filter(V=>V.bought.value).length/10),description:()=>(ee("diamond")?"Empowered ":"")+Ve.diamond.name,enabled:()=>g.toolNodes.value.diamond!=null})),ke(()=>({multiplier:()=>o.div(p.value,6e3).times(ee("emerald")?2:1).add(1),description:()=>(ee("emerald")?"Empowered ":"")+Ve.emerald.name,enabled:()=>g.toolNodes.value.emerald!=null})),ke(()=>({multiplier:()=>o.div(mt.reduce((V,L)=>V.add(s(L.totalAmount)),o.dZero),100).times(ee("gravelRelic")?2:1).add(1).pow(.75),description:()=>(ee("gravelRelic")?"Empowered ":"")+Dt.gravel,enabled:()=>g.toolNodes.value.gravelRelic!=null})),ke(()=>({multiplier:()=>o.add(g.energy.value,1).log10().add(1).pow(ee("beryliumRelic")?.5:.25),description:()=>(ee("beryliumRelic")?"Empowered ":"")+Dt.berylium,enabled:()=>g.toolNodes.value.beryliumRelic!=null})));const _n=Nt(()=>[ke(()=>({multiplier:()=>{var V,L,$e;return o.add(($e=(L=(V=g.board.types.booster.nodes.value[0])==null?void 0:V.state)==null?void 0:L.level)!=null?$e:0,1)},description:"Booster",enabled:()=>{var V,L,$e;return($e=(L=(V=g.board.types.booster.nodes.value[0])==null?void 0:V.state)==null?void 0:L.portals.includes(e))!=null?$e:!1}})),ke(()=>({multiplier:()=>o.times(ee("coalRelic")?.2:.1,Ze.value.length).add(1),description:()=>(ee("coalRelic")?"Empowered ":"")+Dt.coal,enabled:()=>g.toolNodes.value.coalRelic!=null}))]),$t=C(()=>_n.apply(1)),[Mi,ti]=Gn(()=>[{title:`${at(c.displayName)} Gain`,modifier:P,base:0,unit:"/s"},{title:`${at(c.displayName)} Time Speed`,modifier:_n,base:1,visible:()=>o.gt($t.value,1)}]),Nn=G(!1),ni=z(()=>d(Rt,{modelValue:Nn.value,"onUpdate:modelValue":V=>Nn.value=V},{header:()=>d("h2",null,[_("Modifiers")]),body:()=>lt(Mi)}));this.on("preUpdate",V=>{if(!g.activePortals.value.some($e=>$e.state.id===e))return;const L=o.times($t.value,V);p.value=o.add(p.value,L),Ze.value.length<E&&(c.value=o.times(B.value,L).add(c.value)),Ze.value.forEach($e=>{var nt;(nt=$e.update)==null||nt.call($e,L)})}),ep(this,()=>Ze.value.length<E&&g.upgrader.value!=null&&Ce(g.upgrader.value)&&g.upgrader.value.state.portals.includes(e),Vt),pd(this,()=>Ze.value.length<E&&g.automator.value!=null&&Ce(g.automator.value)&&g.automator.value.state.portals.includes(e),mt);const Fn=C(()=>{const V=le.find(L=>L.shouldShowPreview.value);return V?o.neg(Se(V.cost)):0}),Bt=C(()=>{const V=le.find(L=>L.shouldShowPreview.value);return V&&V.modifier?o.sub(V.modifier.apply(0),B.value):0}),On=dn(m.variable(0).add(c),()=>o.neq(Fn.value,0),Fn),ii=dn(m.variable(0).add(B),()=>o.neq(Bt.value,0),Bt),ri=C(()=>{const V=[];return Ze.value.forEach(L=>{L.link&&V.push(L.link)}),V}),Si=C(()=>{const V={};return Ze.value.forEach(L=>{L.effectedResource!=null&&L.resourceMulti!=null&&(V[L.effectedResource]!=null?V[L.effectedResource]=o.times(V[L.effectedResource],L.resourceMulti):V[L.effectedResource]=L.resourceMulti)}),V}),Ze=C(()=>{const V=[];for(let L=1;L<Q.length;L+=2){const $e=Q[L][0];$e.earned.value&&V.push($e)}return V}),Ii=C(()=>o.lt(Ze.value.length,E)&&Q.some(V=>V.some(L=>"earned"in L&&s(L.earned)||"bought"in L&&s(L.bought)?!1:("canClick"in L&&s(L.canClick)||"canPurchase"in L&&s(L.canPurchase),!0)))),xi=C(()=>{const V=Q.findIndex(($e,nt)=>nt>0&&nt%2===0&&!Q[nt-1][0].earned.value);let L;return V===-1?L=Q:L=Q.slice(0,V),L.map(($e,nt)=>nt in ae?lt(ae[nt]):Pi(...$e))});return{tier:ut(t),seed:ut(n),influences:ut(i),name:a,color:u,resource:c,background:l,style:{background:l,"--background":l},features:Q,resourceTabCollapsed:ti,links:ri,resourceMultis:Si,earnedTreasures:Ze,showNotif:Ii,timeActive:p,bonusRewardsLevel:N,display:z(()=>d(re,null,[d(gi,{class:"nav-container",style:"z-index: 5"},{default:()=>[d("span",{class:"nav-segment"},[d("h2",null,[a])]),d("span",{class:"nav-segment"},[d("h3",null,[t,_("-tier")])]),i.length===0?null:d("span",{class:"nav-segment"},[d(Re,{display:i.map(V=>{const L=pt[V.type].description;return typeof L=="function"?L(V):L}).join("<br/>"),direction:H.Down,style:"width: 300px"},{default:()=>[d("h3",null,[i.length,_(" influences")])]})]),d("span",{class:"nav-segment"},[d("button",{class:"button",style:"display: inline",onClick:()=>Nn.value=!0},[_("modifiers")])])]}),d(gi,{class:"nav-container"},{default:()=>[d("span",{class:"nav-segment"},[d("h3",{style:`color: ${u}; text-shadow: 0px 0px 10px ${u};`},[lt(On)])," ",c.displayName]),d("span",{class:"nav-segment"},[_("("),d("h3",{style:`color: ${u}; text-shadow: 0px 0px 10px ${u};`},[o.gt(B.value,0)?"+":"",lt(ii)]),_("/s)")]),o.neq($t.value,1)?d("span",{class:"nav-segment"},[_("Speed: "),xe($t.value),_("x")]):null]}),d(Ed,{height:"60px"},null),xi.value,Ze.value.length+1<E?d("div",null,[_("+"),ot(E-Ze.value.length-1),_(" remaining treasures")]):null,lt(ni)])),minimizedDisplay:z(()=>d("div",null,[d("span",null,[a]),d("span",{style:"font-size: large; vertical-align: sub;"},[" ",Ze.value.length,_("/"),E,_(" treasures")])]))}})}function qi(e,t){t=t.filter(l=>l.type==="increaseResources"||l.type==="decreaseResources");const n=Object.keys(St).reduce((l,c)=>{let p=St[c];return t.filter(h=>h.data===c).forEach(h=>{h.type==="increaseResources"?p*=1e3:p/=1e3}),l+p},0),i=Object.keys(St),r=Math.floor(e()*n);let a=0,u;for(let l=0;l<i.length;l++){const c=i[l];if(a+=St[c],r<a){u=c;break}}return u}function li(e,t){const n=Object.values(e).reduce((l,c)=>l+c),i=Object.keys(e);let r=0,a=null;const u=t()*n;for(let l=0;l<i.length;l++){const c=i[l];if(r+=e[c],u<r){a=c;break}}if(a==null)throw new Error("Failed to pick random. This should not happen");return a}const sp={shape:Le.Diamond,size:50,title:"\u26CF\uFE0F",label:e=>e===g.board.selectedNode.value?{text:"Mining"}:Object.keys(g.resourceNodes.value).length===0?{text:"Click me!"}:null,actionDistance:Math.PI/4,actions:[Ft,Ot("mine")],progress:e=>Ce(e)?new o(e.state.progress).toNumber():0,progressDisplay:sn.Outline,progressColor:"var(--accent2)",classes:e=>({running:Ce(e)}),draggable:!0},op={shape:Le.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>e===g.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(g.energy.value,100)&&(e.type="factory",g.energy.value=o.sub(g.energy.value,100),g.helpModals.factory.showModal.value=!0)},confirmationLabel:()=>o.gte(g.energy.value,100)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}}],draggable:!0},lp={shape:Le.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>{var t,n;if(e===g.board.selectedNode.value)return{text:e.state==null?"Forge - Drag a resource to me!":`Forging ${Ve[e.state].name}`};if(((t=g.board.draggingNode.value)==null?void 0:t.type)==="resource"){const i=((n=g.board.draggingNode.value)==null?void 0:n.state).type,r=e.state===i?"Disconnect":g.toolNodes.value[i]==null?Ve[i].name:"Already crafted",a=e.state===i||g.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,g.board.selectedAction.value=null,g.board.selectedNode.value=null},visibility:e=>e.state!=null},{id:"craft",icon:"done",tooltip:e=>({text:`Forge ${Ve[e.state].name} - ${He(Ve[e.state].cost)} energy`}),onClick(e){const t=Ve[e.state];if(o.gte(g.energy.value,t.cost)&&g.toolNodes.value[e.state]==null){g.energy.value=o.sub(g.energy.value,t.cost);const n={id:Pn(g.board),position:{...e.position},type:t.type,state:"state"in t?t.state:void 0};if(g.board.placeInAvailableSpace(n),g.board.nodes.value.push(n),e.state==="iron"){const i={id:Pn(g.board),position:{...e.position},type:"trashCan"};g.board.placeInAvailableSpace(i),g.board.nodes.value.push(i)}g.board.selectedAction.value=null,g.board.selectedNode.value=null,e.state=void 0,t.type in g.helpModals&&(g.helpModals[t.type].showModal.value=!0)}},fillColor:e=>o.gte(g.energy.value,Ve[e.state].cost)&&g.toolNodes.value[e.state]==null?"var(--accent2)":"var(--danger)",visibility:e=>e.state!=null,confirmationLabel:e=>o.gte(g.energy.value,Ve[e.state].cost)?g.toolNodes.value[e.state]==null?{text:"Tap again to confirm"}:{text:"Already crafted",color:"var(--danger)"}:{text:"Cannot afford",color:"var(--danger)"}},Ot("factory")],progress:e=>e.state==null||g.toolNodes.value[e.state]!=null?0:o.div(o.sqrt(g.energy.value),o.sqrt(Ve[e.state].cost)).clampMax(1).toNumber(),progressDisplay:sn.Fill,progressColor:e=>e.state!=null&&o.gte(g.energy.value,Ve[e.state].cost)?"var(--accent2)":"var(--foreground)",canAccept(e,t){var i;if(t.type!=="resource")return!1;const n=((i=g.board.draggingNode.value)==null?void 0:i.state).type;return g.toolNodes.value[n]==null},onDrop(e,t){const n=t.state.type;e.state===n?e.state=void 0:e.state=n,g.board.selectedNode.value=e},draggable:!0},up=["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI"],cp={shape:Le.Circle,size:50,title:e=>at(e.state.type),subtitle:e=>He(e.state.amount),otherSubtitle:e=>up[zt.indexOf(e.state.type)],progress:e=>id(e.state.type),onClick(){},progressDisplay:sn.Outline,progressColor:"var(--accent3)",classes:e=>{var t;return{"affected-node":g.dowsing.value!=null&&Ce(g.dowsing.value)&&g.dowsing.value.state.resources.includes(e.state.type)||o.neq((t=g.planarMultis.value[e.state.type])!=null?t:1,1)}},draggable:!0},dp={shape:Le.Circle,size:50,title:e=>{const t=e.state;return t.includes("Relic")?Dt[t.slice(0,-5)]:Ve[t].name},label:e=>e===g.board.selectedNode.value?{text:hd[e.state].description(ee(e.state))}:null,outlineColor:"var(--bought)",classes:e=>({"affected-node":ee(e.state)}),draggable:!0},pp={shape:Le.Diamond,size:50,title:"\u{1F962}",label:e=>e===g.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,g.computedBonusConnectionsModifier.value)})`}:Ur(e,t=>`Double ${t} odds`),actionDistance:Math.PI/4,actions:[on,wn(e=>e.add(2).pow_base(100),16),Ft,Ot("dowsing")],classes:e=>({running:Ce(e)}),canAccept:Wr,onDrop:Hr,draggable:!0},fp={shape:Le.Diamond,size:50,title:"\u26F0\uFE0F",label:e=>e===g.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,g.computedBonusConnectionsModifier.value)})`}:Ur(e,t=>`Gather ${yt(o.div(g.dropRates[t].computedModifier.value,100))} ${t}/s`),actionDistance:Math.PI/4,actions:[on,wn(e=>e.add(2).pow_base(1e4),16),Ft,Ot("quarry")],progress:e=>Ce(e)?o.eq(g.quarryProgressRequired.value,0)?0:new o(e.state.progress).div(g.quarryProgressRequired.value).toNumber():0,progressDisplay:sn.Outline,progressColor:"var(--accent2)",canAccept:Wr,onDrop:Hr,classes:e=>({running:Ce(e)}),draggable:!0},gp={shape:Le.Diamond,size:50,title:"\u{1F50C}",label:e=>e===g.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,g.computedBonusConnectionsModifier.value)})`}:ed(e,t=>t.includes("Relic")?`Double ${Dt[t.slice(0,-5)]}'s effect`:`Double ${Ve[t].name}'s effect`),actionDistance:Math.PI/4,actions:[on,wn(e=>e.add(3).pow_base(1e3),24),Ft,Ot("empowerer")],canAccept:td,onDrop:nd,classes:e=>({running:Ce(e)}),draggable:!0},mp={shape:Le.Diamond,size:50,title:"\u26E9\uFE0F",label:e=>{if(e===g.board.selectedNode.value)return{text:e.state.tier==null?"Portal Spawner - Drag a resource to me!":`Spawning ${e.state.tier}-tier portal`};const t=g.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type;return{text:e.state.tier===n?"Disconnect":`${at(n)}-tier Portal`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="influence"){const n=t.state.type;if(e.state.influences.includes(n))return{text:"Disconnect",color:"var(--accent2)"};const r=pt[n].cost;let a;return o.lt(r,1e3)?a=He(r):a=ji(r,0),{text:`Add influence (${a}x cost)`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="portal")return{text:`Copy tier/influences from ${ge[t.state.id].name}`};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:[]},g.board.selectedAction.value=null,g.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 - ${He(g.computedPortalCost.value)} energy`}),fillColor:()=>o.gte(g.energy.value,g.computedPortalCost.value)?"var(--accent2)":"var(--danger)",confirmationLabel:()=>o.gte(g.energy.value,g.computedPortalCost.value)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"},onClick(e){if(o.lt(g.energy.value,g.computedPortalCost.value))return;let t=0;for(;`portal-${t}`in ge;)t++;g.energy.value=o.sub(g.energy.value,g.computedPortalCost.value);const{tier:n,influences:i}=e.state;Xi(Qr(`portal-${t}`,n,Math.floor(Math.random()*4294967296),i.map(a=>g.influenceNodes.value[a].state)),X);const r={id:Pn(g.board),position:{...e.position},type:"portal",state:{id:`portal-${t}`,powered:!1}};g.board.placeInAvailableSpace(r),g.board.nodes.value.push(r),g.board.selectedAction.value=null,g.board.selectedNode.value=null,e.state={tier:void 0,influences:[]}},visibility:e=>e.state.tier!=null},Ot("portalGenerator")],canAccept(e,t){return t.type==="resource"||t.type==="influence"||t.type==="portal"},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]}}else if(t.type==="portal"){const n=ge[t.state.id];e.state={...e.state,tier:n.tier.value,influences:n.influences.value.map(i=>i.type)}}g.board.selectedNode.value=e},progress:e=>e.state.tier==null?0:o.div(o.sqrt(g.energy.value),o.sqrt(g.computedPortalCost.value)).clampMax(1).toNumber(),progressDisplay:sn.Fill,progressColor:e=>e.state.tier!=null&&o.gte(g.energy.value,g.computedPortalCost.value)?"var(--accent2)":"var(--foreground)",draggable:!0},vp={shape:Le.Diamond,size:50,title:"\u{1F300}",label:e=>e===g.board.selectedNode.value?{text:`Portal to ${ge[e.state.id].name}`,color:ge[e.state.id].color}:null,actionDistance:Math.PI/4,actions:[Ft],classes:e=>({running:Ce(e),showNotif:ge[e.state.id].showNotif.value,"affected-node":g.booster.value!=null&&Ce(g.booster.value)&&g.booster.value.state.portals.includes(e.state.id)}),outlineColor:e=>ge[e.state.id].background,draggable:!0},hp={shape:e=>e.state.type==="increaseResources"||e.state.type==="decreaseResources"?Le.Diamond:Le.Circle,size:50,title:e=>pt[e.state.type].display,otherSubtitle:e=>{const t=pt[e.state.type].cost;return o.lt(t,1e3)?`${He(t)}x cost`:`${ji(t,0)}x cost`},label:e=>{if(e===g.board.selectedNode.value){const n=e.state,i=pt[n.type].description;return{text:typeof i=="function"?i(n):i}}const t=g.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 ${at(n)} odds`;else if(i==="decreaseResources")a=`Decrease ${at(n)} odds`;else return null;return{text:a,color:"var(--accent2)"}}return null},actionDistance:Math.PI/4,actions:[on],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]},g.board.selectedNode.value=e)},outlineColor:"var(--danger)",draggable:!0},bp={shape:Le.Diamond,size:50,title:"\u231B",label:e=>e===g.board.selectedNode.value?{text:e.state.portals.length===0?"Booster - Drag a portal to me!":`Boosting by ${He(o.add(1,e.state.level))}x (${e.state.portals.length}/${o.add(e.state.maxConnections,g.computedBonusConnectionsModifier.value)})`}:yi(e,t=>`Boost ${ge[t].name}'s speed`),actionDistance:Math.PI/4,actions:[on,wn(e=>e.add(6).pow_base(1e3)),{id:"increaseBoost",icon:"arrow_upward",tooltip(e){return{text:`Increase boost - ${He(si.evaluate(e.state.level))} energy`}},fillColor(e){return o.gte(g.energy.value,si.evaluate(e.state.level))?"var(--bought)":"var(--locked)"},confirmationLabel(e){return o.gte(g.energy.value,si.evaluate(e.state.level))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}},onClick(e){const t=si.evaluate(e.state.level);o.gte(g.energy.value,t)&&(g.energy.value=o.sub(g.energy.value,t),e.state={...e.state,level:o.add(e.state.level,1)},g.board.selectedAction.value=null)}},Ft,Ot("booster")],canAccept:wi,onDrop:_i,classes:e=>({running:Ce(e)}),draggable:!0},yp={shape:Le.Diamond,size:50,title:"\u{1F916}",label:e=>e===g.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,g.computedBonusConnectionsModifier.value)})`}:yi(e,t=>`Auto-buy ${ge[t].name}'s upgrades and prestiges`),actionDistance:Math.PI/4,actions:[on,wn(e=>e.add(4).pow_base(1e6)),Ft,Ot("upgrader")],canAccept:wi,onDrop:_i,classes:e=>({running:Ce(e)}),draggable:!0},wp={shape:Le.Diamond,size:50,title:"\u{1F9BE}",label:e=>e===g.board.selectedNode.value?{text:e.state.portals.length===0?"Automator - Drag a portal to me!":`Automatating (${e.state.portals.length}/${o.add(e.state.maxConnections,g.computedBonusConnectionsModifier.value)})`}:yi(e,t=>`Auto-buy ${ge[t].name}'s repeatables and dimensions`),actionDistance:Math.PI/4,actions:[on,wn(e=>e.add(4).pow_base(1e6)),Ft,Ot("automator")],canAccept:wi,onDrop:_i,classes:e=>({running:Ce(e)}),draggable:!0},_p={shape:Le.Diamond,size:50,title:"\u{1F4B1}",label:e=>e===g.board.selectedNode.value?{text:e.state.portals.length===0?"Investments - Drag a portal to me!":`Investing (${e.state.portals.length}/${o.add(e.state.maxConnections,g.computedBonusConnectionsModifier.value)})`}:yi(e,t=>`Passively generate ${ge[t].name}'s conversions`),actionDistance:Math.PI/4,actions:[on,wn(e=>e.add(3).pow_base(1e8)),Ft,Ot("investments")],canAccept:wi,onDrop:_i,classes:e=>({running:Ce(e)}),draggable:!0},Np={shape:Le.Diamond,size:50,title:"\u{1F5D1}\uFE0F",label:e=>{var t;if(e===g.board.selectedNode.value)return{text:"Trash Can - Drag a portal to me!"};if(((t=g.board.draggingNode.value)==null?void 0:t.type)==="portal"){const n=g.board.draggingNode.value.state.id;return{text:`Delete ${ge[n].name}!`,color:"var(--danger)"}}return null},canAccept:(e,t)=>t.type==="portal",onDrop:(e,t)=>{const n=t.state.id;Ki(ge[n]),delete X.layers[n],g.board.state.value.nodes=g.board.state.value.nodes.filter(i=>i!==t),g.booster.value&&(g.booster.value.state={...g.booster.value.state,portals:g.booster.value.state.portals.filter(i=>i!==n)}),g.upgrader.value&&(g.upgrader.value.state={...g.upgrader.value.state,portals:g.upgrader.value.state.portals.filter(i=>i!==n)}),g.automator.value&&(g.automator.value.state={...g.automator.value.state,portals:g.automator.value.state.portals.filter(i=>i!==n)}),g.investments.value&&(g.investments.value.state={...g.investments.value.state,portals:g.investments.value.state.portals.filter(i=>i!==n)}),X.tabs=X.tabs.filter(i=>i!==n)},draggable:!0},yr=hi(),Cp={mine:sp,brokenFactory:op,factory:lp,resource:cp,passive:dp,dowsing:pp,quarry:fp,empowerer:gp,portalGenerator:mp,portal:vp,influence:hp,booster:bp,upgrader:yp,automator:wp,investments:_p,trashCan:Np},g=Zi("main",function(){const e=xn(0,"energy"),t=C(()=>v.types.resource.nodes.value.reduce(($,T)=>($[T.state.type]=T,$),{})),n=C(()=>({...v.types.passive.nodes.value.reduce(($,T)=>($[T.state]=T,$),{}),sand:v.types.dowsing.nodes.value[0],wood:v.types.quarry.nodes.value[0],coal:v.types.empowerer.nodes.value[0],iron:v.types.portalGenerator.nodes.value[0],gold:v.types.booster.nodes.value[0],platinum:v.types.upgrader.nodes.value[0],berylium:v.types.automator.nodes.value[0],ultimatum:v.types.investments.nodes.value[0]})),i=C(()=>Object.keys(Dt).filter($=>`${$}Relic`in n.value).length),r=C(()=>({...v.types.influence.nodes.value.reduce(($,T)=>($[T.state.type]=T,$),{})})),a=C(()=>({...v.types.portal.nodes.value.reduce(($,T)=>($[T.state.id]=T,$),{})})),u=C(()=>zt.reduce(($,T)=>{var R,U,Y;const F=(Y=(U=(R=t.value[T])==null?void 0:R.state)==null?void 0:U.amount)!=null?Y:0;return $[T]=o.floor(Vi.invert(F)),$},{})),l=mn({}),c=mn({});Ht(()=>{zt.forEach($=>{ht(()=>u.value[$],(T,F)=>{const R=o.sub(T,F);o.gt(R,1)&&ce.active===X.id&&yr.info(d("div",null,[d("h3",null,[o.eq(T,1)?`${at($)} discovered`:`${at($)} is now Level ${ot(T)}`,_("!")]),o.gt(R,1)?d("div",null,[_("Gained "),ot(R),_(" levels")]):null]))})})});const p=C(()=>Q.filter($=>{var T,F;return(F=(T=$.value)==null?void 0:T.state)==null?void 0:F.powered}).length+v.types.portal.nodes.value.filter($=>$.state.powered).length),h=C(()=>{let $=p.value;return n.value.copperRelic!=null&&($--,ee("copperRelic")&&$--),$}),f=C(()=>{const $=h.value;return o.lt($,0)?0:o.eq($,0)?10:o.add($,1).pow_base(100).div(10).times(.99)}),b=C(()=>{if(E.value==null)return 0;let T=E.value.state.resources.reduce((F,R)=>o.div(100,Bt[R].computedModifier.value).add(F),o.dZero);return n.value.silverRelic!=null&&(T=o.div(T,o.add(p.value,1)),ee("silverRelic")&&(T=o.div(T,o.add(p.value,1)))),T}),v=Gc($=>({startNodes:()=>[{position:{x:0,y:0},type:"mine",state:{progress:0,powered:!1}},{position:{x:0,y:-200},type:"brokenFactory"}],types:Cp,style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden"},links(){const T=[];if(T.push(...Object.keys(l).map(F=>({startNode:y.value,endNode:t.value[F],stroke:"var(--accent3)",strokeWidth:5}))),N.value!=null&&N.value.state!=null&&T.push({startNode:N.value,endNode:t.value[N.value.state],stroke:"var(--foreground)",strokeWidth:4}),x.value!=null&&x.value.state.resources.forEach(F=>{T.push({startNode:x.value,endNode:t.value[F],stroke:Ce(x.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),E.value!=null&&E.value.state.resources.forEach(F=>{T.push({startNode:E.value,endNode:t.value[F],stroke:"var(--foreground)",strokeWidth:4})}),T.push(...Object.keys(c).map(F=>({startNode:E.value,endNode:t.value[F],stroke:"var(--accent3)",strokeWidth:5}))),I.value!=null&&I.value.state.tools.forEach(F=>{T.push({startNode:I.value,endNode:n.value[F],stroke:Ce(I.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),P.value!=null){const F=P.value.state;F.tier!=null&&T.push({startNode:P.value,endNode:t.value[F.tier],stroke:"var(--foreground)",strokeWidth:4}),F.influences.forEach(R=>{T.push({startNode:P.value,endNode:r.value[R],stroke:"var(--foreground)",strokeWidth:4})}),$.types.portal.nodes.value.forEach(R=>{const U=ge[R.state.id];return U.links.value.forEach(Y=>{Y.value!=null&&T.push({startNode:R,endNode:Y.value,stroke:Ce(R)?"var(--accent3)":"var(--foreground)",strokeWidth:4})}),Object.keys(U.resourceMultis.value).forEach(Y=>{Y!=="energy"&&Y in t.value&&T.push({startNode:R,endNode:t.value[Y],stroke:Ce(R)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),T})}return B.value!=null&&B.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{T.push({startNode:B.value,endNode:a.value[F],stroke:Ce(B.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),le.value!=null&&le.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{T.push({startNode:le.value,endNode:a.value[F],stroke:"var(--foreground)",strokeWidth:4})}),ae.value!=null&&ae.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{T.push({startNode:ae.value,endNode:a.value[F],stroke:"var(--foreground)",strokeWidth:4})}),ne.value!=null&&ne.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{T.push({startNode:ne.value,endNode:a.value[F],stroke:"var(--foreground)",strokeWidth:4})}),Object.values(r.value).forEach(F=>{const R=F.state;(R.type==="increaseResources"||R.type==="decreaseResources")&&R.data.forEach(U=>{T.push({startNode:F,endNode:t.value[U],stroke:"var(--foreground)",strokeWidth:4})})}),T}})),y=C(()=>v.types.mine.nodes.value[0]),N=C(()=>v.types.factory.nodes.value[0]),x=C(()=>n.value.sand),E=C(()=>n.value.wood),I=C(()=>n.value.coal),P=C(()=>n.value.iron),B=C(()=>n.value.gold),le=C(()=>n.value.platinum),ae=C(()=>n.value.berylium),ne=C(()=>n.value.ultimatum),Q=[y,x,E,I,B,le,ae,ne];function Ie($,T){let F=t.value[$];if(T=o.times(T,On[$].computedModifier.value),F==null)F={id:Pn(v),position:{...y.value.position},type:"resource",state:{type:$,amount:T}},v.placeInAvailableSpace(F),v.nodes.value.push(F);else{const R=F.state;F.state={...R,amount:o.add(R.amount,T)}}}const he=C(()=>Object.keys(St).reduce(($,T)=>$+new o(Bt[T].computedModifier.value).toNumber(),0)),W=C(()=>{const $={};return v.types.portal.nodes.value.forEach(T=>{if(!Ce(T))return;const R=ge[T.state.id].resourceMultis.value;Object.keys(R).forEach(U=>{$[U]!=null?$[U]=o.times($[U],R[U]):$[U]=R[U]})}),$}),be=Nt(()=>zt.map($=>Ut(()=>({description:()=>at($),addend:()=>u.value[$],enabled:()=>o.gt(u.value[$],0)})))),je=C(()=>be.apply(0)),gt=Nt(()=>[Ut(()=>({addend:je,description:"Resource Levels"})),ke(()=>({multiplier:()=>o.pow(Fn.value,je.value),description:()=>`${Wt(Fn.value,3)}x per Resource Level`})),ke(()=>({multiplier:()=>ee("stone")?4:2,description:()=>(ee("stone")?"Empowered ":"")+Ve.stone.name,enabled:()=>n.value.stone!=null})),ke(()=>({multiplier:()=>{var $;return($=W.value.energy)!=null?$:1},description:"Planar Treasures",enabled:()=>{var $;return o.neq(($=W.value.energy)!=null?$:1,1)}})),Ut(()=>({addend:()=>o.pow(100,h.value).div(10).neg(),description:"Powered Machines (100^n/10 energy/s)",enabled:()=>o.gt(h.value,0)}))]),Vt=C(()=>gt.apply(0)),mt=Nt(()=>[Ut(()=>({addend:()=>ee("unobtainium")?2:1,description:()=>(ee("unobtainium")?"Empowered ":"")+Ve.unobtainium.name,enabled:()=>n.value.unobtainium!=null}))]),_n=C(()=>mt.apply(0)),$t=Nt(()=>[ke(()=>({multiplier:()=>ee("dirt")?4:2,description:()=>(ee("dirt")?"Empowered ":"")+Ve.dirt.name,enabled:()=>n.value.dirt!=null})),ke(()=>({multiplier:()=>o.pow(i.value,ee("woodRelic")?2:1),description:()=>(ee("woodRelic")?"Empowered ":"")+Dt.wood,enabled:()=>n.value.woodRelic!=null}))]),Mi=C(()=>$t.apply(1)),ti=Nt(()=>[ke(()=>({multiplier:()=>ee("gravel")?4:2,description:()=>(ee("gravel")?"Empowered ":"")+Ve.gravel.name,enabled:()=>n.value.gravel!=null}))]),Nn=C(()=>ti.apply(1)),ni=Nt(()=>[Ut(()=>({addend:()=>ee("copper")?.004:.002,description:()=>(ee("copper")?"Empowered ":"")+Ve.copper.name,enabled:()=>n.value.copper!=null}))]),Fn=C(()=>ni.apply(1.01)),Bt=Object.keys(St).reduce(($,T)=>{const F=Nt(()=>[ke(()=>({multiplier:2,description:"Dowsing",enabled:()=>x.value!=null&&Ce(x.value)&&x.value.state.resources.includes(T)}))]),R=C(()=>F.apply(St[T])),U={title:`${at(T)} Drop Rate`,modifier:F,base:St[T]};return $[T]={modifier:F,computedModifier:R,section:U},$},{}),On=Object.keys(St).reduce(($,T)=>{const F=Nt(()=>[ke(()=>({multiplier:()=>{var Y;return(Y=W.value[T])!=null?Y:1},description:"Planar Treasures",enabled:()=>{var Y;return o.neq((Y=W.value[T])!=null?Y:1,1)}}))]),R=C(()=>F.apply(1)),U={title:`${at(T)} Gain`,modifier:F};return $[T]={modifier:F,computedModifier:R,section:U},$},{}),ii=C(()=>{var T,F,R;const $=zt.indexOf((R=(F=(T=P.value)==null?void 0:T.state)==null?void 0:F.tier)!=null?R:"dirt");return o.add($,1).times($).div(2).add(9).pow10()}),ri=Nt(()=>[...Object.keys(pt).map($=>ke(()=>({multiplier:pt[$].cost,description:pt[$].display,enabled:()=>{var T,F,R;return(R=(F=(T=P.value)==null?void 0:T.state)==null?void 0:F.influences.includes($))!=null?R:!1},smallerIsBetter:!0}))),ke(()=>({multiplier:()=>ee("emeraldRelic")?.05:.1,description:()=>(ee("emeraldRelic")?"Empowered ":"")+Dt.emerald,enabled:()=>n.value.emeraldRelic!=null,smallerIsBetter:!0}))]),Si=C(()=>ri.apply(ii.value)),[Ze,Ii]=Gn(()=>[{title:"Resource Levels",modifier:be,base:0},{title:"Energy Gain",modifier:gt,base:0,unit:"/s"},{title:"Portal Cost",modifier:ri,base:ii,unit:" energy",baseText:()=>{var $,T,F;return`${at((F=(T=($=P.value)==null?void 0:$.state)==null?void 0:T.tier)!=null?F:"dirt")}-tier Base Cost`},visible:()=>P.value!=null,smallerIsBetter:!0},{title:"Bonus Connections",modifier:mt,base:0,visible:()=>o.gt(_n.value,0)}]),[xi,V]=Gn(()=>[{title:"Mining Speed",modifier:$t,base:1,unit:"/s",visible:()=>n.value.dirt!=null},{title:"Ore Dropped",modifier:ti,base:1,visible:()=>n.value.gravel!=null},{title:"Material Level Effect",modifier:ni,base:1.01,visible:()=>n.value.copper!=null}]),[L,$e]=Gn(()=>Object.values(Bt).map($=>$.section)),[nt,Cn]=Gn(()=>Object.values(On).map($=>$.section)),ze=Gr({general:()=>({display:"General",glowColor(){return ze.activeTab.value===this.tab?"white":""},tab:Ze,energyTabCollapsed:Ii}),mining:()=>({display:"Mine",glowColor(){return ze.activeTab.value===this.tab?"white":""},visibility:()=>Object.keys(n.value).length>0,tab:xi,miningTabCollapsed:V}),resources:()=>({display:"Ore Rates",glowColor(){return ze.activeTab.value===this.tab?"white":""},visibility:()=>x.value!=null,tab:L,resourcesCollapsed:$e}),resourcesGain:()=>({display:"Ore Gain",glowColor(){return ze.activeTab.value===this.tab?"white":""},visibility:()=>Object.values(On).some($=>o.neq($.computedModifier.value,1)),tab:nt,resourceGainCollapsed:Cn})}),Et=G(!1),Lt=z(()=>d(Rt,{modelValue:Et.value,"onUpdate:modelValue":$=>Et.value=$},{header:()=>d("h2",null,[_("Modifiers")]),body:()=>lt(ze)})),Mt={mine:wd(),factory:_d(),dowsing:Nd(),quarry:Cd(),empowerer:kd(),portalGenerator:Md(),booster:Sd(),upgrader:Id(),automator:xd(),investments:$d()};Mt.mine.showModal[Zt]=!0,Mt.mine.showModal.value=!0,this.on("preUpdate",$=>{if(Object.keys(l).forEach(T=>{l[T]-=$,l[T]<=0&&delete l[T]}),Object.keys(c).forEach(T=>{c[T]-=$,c[T]<=0&&delete c[T]}),Ce(y.value)){const T=o.add(y.value.state.progress,o.times(Mi.value,$)),F=T.floor();y.value.state={...y.value.state,progress:o.sub(T,F)};const R=F.div(he.value).floor();R.gt(0)&&zt.forEach(Y=>{Ie(Y,o.times(new o(Bt[Y].computedModifier.value).toNumber(),R).times(Nn.value)),l[Y]=.3});const U=o.sub(F,R).toNumber();for(let Y=0;Y<U;Y++){const Ge=Math.floor(Math.random()*he.value);let Xe=0;for(let qe=0;qe<zt.length;qe++){const Ae=zt[qe];if(Xe+=new o(Bt[Ae].computedModifier.value).toNumber(),Ge<Xe){Ie(Ae,Nn.value),l[Ae]=.3;break}}}}if(E.value!=null&&Ce(E.value)){const{progress:T,resources:F}=E.value.state;if(F.length>0){let R=o.add(T,$);const U=o.div(T,b.value).floor();R=o.sub(R,o.times(U,b.value)),E.value.state={...E.value.state,progress:R},o.gt(U,0)&&F.forEach(Y=>{Ie(Y,U),c[Y]=.3})}}e.value=o.add(e.value,o.times(Vt.value,$)),o.lt(e.value,0)&&(e.value=0,Q.forEach(T=>{var F;((F=T.value)==null?void 0:F.state).powered=!1}),Object.values(a.value).forEach(T=>{T.state.powered=!1}),y.value.state={...y.value.state,powered:!1},yr.warning(d("div",null,[d("h3",null,[_("Ran out of energy!")]),d("div",null,[_("All machines have been turned off.")])])))});const it=C(()=>{var $,T;return v.selectedAction.value===v.types.brokenFactory.actions[0]?-100:v.selectedAction.value===v.types.factory.actions[1]?o.neg(Ve[v.selectedNode.value.state].cost):(($=v.selectedAction.value)==null?void 0:$.id)==="moreConnections"?o.neg(v.selectedAction.value.formula.evaluate(((T=v.selectedNode.value)==null?void 0:T.state).maxConnections)):0}),jt=dn(m.variable(0).add(e),()=>o.neq(it.value,0),it),Jt=C(()=>{var $;return v.selectedAction.value===Ft?(($=v.selectedNode.value)==null?void 0:$.state).powered?o.eq(p.value,1)?10:o.pow(100,p.value).div(10).times(.99):o.neg(f.value):0}),$i=dn(m.variable(0).add(Vt),()=>o.neq(Jt.value,0),Jt),kn=C(()=>v.types.portal.nodes.value.filter($=>Ce($))),Mn=C(()=>kn.value.sort(($,T)=>{var U,Y;const F=(U=ge[$.state.id])!=null&&U.minimized.value?1:0,R=(Y=ge[T.state.id])!=null&&Y.minimized.value?1:0;return F-R}).map($=>$.state.id));return ht(Mn,$=>{Ht(()=>{X.tabs=["main",...$]})}),ht(_n,($,T)=>{o.lt($,T)&&(cn($,x,"resources"),cn($,E,"resources"),cn($,I,"tools"),cn($,B,"portals"),cn($,le,"portals"),cn($,ae,"portals"),cn($,ne,"portals"))}),{name:"World",board:v,energy:e,modifierTabs:ze,resourceNodes:t,toolNodes:n,influenceNodes:r,grantResource:Ie,activePortals:kn,nextPowerCost:f,computedBonusConnectionsModifier:_n,quarryProgressRequired:b,dropRates:Bt,dowsing:x,empowerer:I,booster:B,upgrader:le,automator:ae,investments:ne,resourceLevels:u,planarMultis:W,computedPortalCost:Si,helpModals:Mt,display:z(()=>d(re,null,[d(gi,{class:"nav-container"},{default:()=>[d("span",{class:"nav-segment"},[d("h2",{style:"color: white; text-shadow: 0px 0px 10px white;"},[lt(jt)])," ",_("energy")]),d("span",{class:"nav-segment"},[_("("),d("h3",{style:"color: white; text-shadow: 0px 0px 10px white;"},[o.gt(Vt.value,0)?"+":"",lt($i)]),_("/s)")]),o.gt(p.value,0)?d("span",{class:"nav-segment"},[d("h3",{style:"color: var(--accent1); text-shadow: 0px 0px 10px var(--accent1);"},[ot(p.value)])," ",_("machines powered")]):null,d("span",{class:"nav-segment"},[d("button",{class:"button",style:"display: inline",onClick:()=>Et.value=!0},[_("modifiers")])]),X.devSpeed===0?d("span",{class:"nav-segment"},[_("Game Paused")]):X.devSpeed!=null&&X.devSpeed!==1?d("span",{class:"nav-segment"},[_("Dev Speed: "),xe(X.devSpeed),_("x")]):null]}),lt(v),lt(Lt),Object.values(Mt).map(({modal:$})=>$())]))}}),kp=e=>{var n,i,r,a,u;const t=[g];return(u=(a=(r=(i=(n=e.layers)==null?void 0:n.main)==null?void 0:i.board)==null?void 0:r.state)==null?void 0:a.nodes)==null||u.filter(l=>(l==null?void 0:l.type)==="portal").map(l=>{var c,p;return(p=(c=l==null?void 0:l.state)==null?void 0:c.id)!=null?p:""}).forEach(l=>{var p,h,f,b;const c=(p=e.layers)==null?void 0:p[l];t.push(Qr(l,(h=c.tier)!=null?h:"dirt",(f=c.seed)!=null?f:Math.floor(Math.random()*4294967296),(b=c.influences)!=null?b:[]))}),t},nr=G(!1);function Mp(e,t){}var Sp=Object.freeze(Object.defineProperty({__proto__:null,main:g,getInitialLayers:kp,hasWon:nr,fixOldSave:Mp},Symbol.toStringTag,{value:"Module"}));const ei=e=>(vn("data-v-4a50ce42"),e=e(),hn(),e),Ip={class:"game-over-modal-header"},xp=["src","alt"],$p={class:"game-over-modal-title"},Ep=ei(()=>k("h2",null,"Congratulations!",-1)),Dp={key:0},Tp=ei(()=>k("br",null,null,-1)),Pp=ei(()=>k("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),Ap=ei(()=>k("br",null,null,-1)),Rp=["href"],Fp=ei(()=>k("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),Op=K({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:i,discordLink:r,versionNumber:a,versionTitle:u}=we,l=C(()=>bi(X.timePlayed)),c=C(()=>nr.value&&!X.keepGoing),p=an(X,"autosave");function h(){X.keepGoing=!0}function f(){pn(En())}return(b,v)=>(S(),te(Rt,{"model-value":s(c)},{header:Z(()=>[k("div",Ip,[s(n)?(S(),A("img",{key:0,class:"game-over-modal-logo",src:s(n),alt:s(t)},null,8,xp)):j("",!0),k("div",$p,[Ep,k("h4",null,"You've beaten "+de(s(t))+" v"+de(s(a))+": "+de(s(u)),1)])])]),body:Z(({shown:y})=>[y?(S(),A("div",Dp,[k("div",null,"It took you "+de(s(l))+" to beat the game.",1),Tp,Pp,Ap,k("div",null,[k("a",{href:s(r),class:"game-over-modal-discord-link"},[Fp,_(" "+de(s(i)),1)],8,Rp)]),d(Gt,{title:"Autosave",modelValue:s(p),"onUpdate:modelValue":v[0]||(v[0]=N=>Fe(p)?p.value=N:null)},null,8,["modelValue"])])):j("",!0)]),footer:Z(()=>[k("div",{class:"game-over-footer"},[k("button",{onClick:h,class:"button"},"Keep Going"),k("button",{onClick:f,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var qp=ve(Op,[["__scopeId","data-v-4a50ce42"]]);const ki=e=>(vn("data-v-2776d67d"),e=e(),hn(),e),Vp=ki(()=>k("div",{class:"nan-modal-header"},[k("h2",null,"NaN value detected!")],-1)),Bp={key:0},Lp=ki(()=>k("br",null,null,-1)),jp=["href"],zp=ki(()=>k("span",{class:"material-icons nan-modal-discord"},"discord",-1)),Gp=ki(()=>k("br",null,null,-1)),Up={class:"nan-footer"},Wp=K({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=we,i=G(!0),r=G(!0),a=an(We,"hasNaN"),u=G(null);ht(a,b=>{b?(i.value=X.autosave,r.value=X.devSpeed===0):(X.autosave=i.value,X.devSpeed=r.value?0:null)});const l=C(()=>{var b;return(b=We.NaNPath)==null?void 0:b.join(".")}),c=C(()=>We.NaNPersistent!=null?We.NaNPersistent.value:null);function p(){We.NaNPersistent!=null&&(We.NaNPersistent.value=new o(0),We.hasNaN=!1)}function h(){We.NaNPersistent&&(We.NaNPersistent.value=new o(1),We.hasNaN=!1)}function f(){We.NaNPersistent&&(We.NaNPersistent.value=new o(NaN),We.hasNaN=!1)}return(b,v)=>(S(),A(re,null,[d(Rt,Yt({modelValue:s(a),"onUpdate:modelValue":v[4]||(v[4]=y=>Fe(a)?a.value=y:null)},b.$attrs),{header:Z(()=>[Vp]),body:Z(()=>[k("div",null,[_(' Attempted to assign "'+de(s(l))+'" to NaN',1),s(c)?(S(),A("span",Bp,de(" ")+"(previously "+de(s(xe)(s(c)))+")",1)):j("",!0),_(". Auto-saving has been "+de(i.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),Lp,k("div",null,[k("a",{href:s(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[zp,_(" "+de(s(t)||"The Paper Pilot Community"),1)],8,jp)]),Gp,d(Gt,{title:"Autosave",modelValue:i.value,"onUpdate:modelValue":v[0]||(v[0]=y=>i.value=y)},null,8,["modelValue"]),s(we).enablePausing?(S(),te(Gt,{key:0,title:"Pause game",modelValue:r.value,"onUpdate:modelValue":v[1]||(v[1]=y=>r.value=y)},null,8,["modelValue"])):j("",!0)]),footer:Z(()=>[k("div",Up,[k("button",{onClick:v[2]||(v[2]=y=>{var N;return(N=u.value)==null?void 0:N.open()}),class:"button"},"Open Saves Manager"),k("button",{onClick:p,class:"button"},"Set to 0"),k("button",{onClick:h,class:"button"},"Set to 1"),s(c)&&s(o).neq(s(c),0)&&s(o).neq(s(c),1)?(S(),A("button",{key:0,onClick:v[3]||(v[3]=y=>a.value=!1),class:"button"}," Set to previous ")):j("",!0),k("button",{onClick:f,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),d(Br,{ref_key:"savesManager",ref:u},null,512)],64))}});var Hp=ve(Wp,[["__scopeId","data-v-2776d67d"]]);const Yp={key:0,class:"tpsDisplay"},Zp=K({__name:"TPS",setup(e){const t=C(()=>o.div(We.lastTenTicks.length,We.lastTenTicks.reduce((n,i)=>n+i,0)));return(n,i)=>s(t).isNan()?j("",!0):(S(),A("div",Yp,"TPS: "+de(s(ot)(s(t))),1))}});var Xp=ve(Zp,[["__scopeId","data-v-89b89152"]]);var Kp=K({__name:"App",setup(e){const t=we.useHeader,n=C(()=>Ct[ce.theme].variables),i=an(ce,"showTPS"),r=C(()=>pe(z(()=>d(re,null,[_s.map(lt)]))));return(a,u)=>(S(),A(re,null,[k("div",{id:"modal-root",style:Be(s(n))},null,4),k("div",{class:Ne(["app",{useHeader:s(t)}]),style:Be(s(n))},[s(t)?(S(),te(Lr,{key:0})):j("",!0),d(dc),s(s(i))?(S(),te(Xp,{key:1})):j("",!0),d(qp),d(Hp),(S(),te(Je(s(r))))],6)],64))}});var Jp=ve(Kp,[["__scopeId","data-v-41d15e5e"]]);function Qp(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:u}=e;let l,c,p,h;const f=async(v=!0)=>{await p,v&&(l==null||l.addEventListener("controlling",y=>{y.isUpdate&&window.location.reload()})),await(h==null?void 0:h())};async function b(){if("serviceWorker"in navigator){const{Workbox:v,messageSW:y}=await Wn(()=>import("./workbox-window.4a8794bb.js"),[]);h=async()=>{c&&c.waiting&&await y(c.waiting,{type:"SKIP_WAITING"})},l=new v("./sw.js",{scope:"./",type:"classic"}),l.addEventListener("activated",N=>{N.isUpdate||i==null||i()});{const N=()=>{n==null||n()};l.addEventListener("waiting",N),l.addEventListener("externalwaiting",N)}l.register({immediate:t}).then(N=>{c=N,a?a("./sw.js",N):r==null||r(N)}).catch(N=>{u==null||u(N)})}}return p=b(),f}function ef(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:u}=e,l=G(!1),c=G(!1);return{updateServiceWorker:Qp({immediate:t,onNeedRefresh(){l.value=!0,n==null||n()},onOfflineReady(){c.value=!0,i==null||i()},onRegistered:r,onRegisteredSW:a,onRegisterError:u}),offlineReady:c,needRefresh:l}}document.title=we.title;window.projInfo=we;if(we.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 ms();const{globalBus:e}=await Wn(()=>Promise.resolve().then(function(){return fs}),void 0),{startGameLoop:t}=await Wn(()=>import("./gameLoop.e956ac2e.js"),["assets/gameLoop.e956ac2e.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=da(Jp);e.emit("setupVue",n),n.mount("#app"),Ht(()=>{const i=hi(),{updateServiceWorker:r}=ef({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,Wn as _,We as a,we as b,Sp as c,tt as g,vs as l,X as p,ce as s};
|