Planar-Pioneers/assets/index.6448276a.js

18 lines
203 KiB
JavaScript

/* empty css */import"./vue.c16a309b.js";import{_ as S,C as s,l as De,q as fn,t as B,b2 as nt,ab as X,aF as I,a1 as T,a2 as k,aL as Tt,G as be,aD as nr,w as it,b3 as pt,a9 as g,O as ae,ap as Rr,az as ai,as as Dt,aH as Hn,A as Ee,$ as ne,b7 as H,b9 as Ii,ar as Pt,bv as wn,a8 as O,bt as qr,bc as _n,T as Vr,u as xi,j as Lr,bw as Mt,aM as St,a0 as j,aO as Le,J as re,I as Ue,aI as pn,aG as gn,z as Kt,bo as Br,bs as jr,aK as Nn,bd as Li,am as Kn,H as zr,bx as Ur,bf as Gr}from"./@vue.6b211d3c.js";import{c as ir}from"./nanoevents.1080beb7.js";import{L as Ht}from"./lz-string.dccec454.js";import{Y as Wr}from"./vue-next-select.ded54c4a.js";import{D as Hr}from"./vuedraggable.1879de79.js";import{p as Zr}from"./vue-textarea-autosize.35804eaf.js";import{P as Yr}from"./vue-panzoom.8ce6f9b1.js";import{s as Jr,u as si}from"./vue-toastification.9c2dad53.js";import{n as Kr,t as Xr,l as Qr}from"./unique-names-generator.5494b30b.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 ea=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}};ea();const ta="modulepreload",Bi={},na="./",Vn=function(t,n){return!n||n.length===0?t():Promise.all(n.map(i=>{if(i=`${na}${i}`,i in Bi)return;Bi[i]=!0;const r=i.endsWith(".css"),a=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${a}`))return;const l=document.createElement("link");if(l.rel=r?"stylesheet":ta,r||(l.as="script",l.crossOrigin=""),l.href=i,document.head.appendChild(l),r)return new Promise((u,c)=>{l.addEventListener("load",u),l.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())},ia="./projInfo-schema.json",ra="Planar Pioneers",aa="A game about controlling and exploiting planes!",sa="planar-pioneers",oa="thepaperpilot",la="",ua="",ca="0.0",da="Initial Commit",fa=!1,pa=!1,ga=2,ma=!0,va=null,ha="",ba=["main"],ya=3600,wa=0,_a=!0,Na="base64";var ge={$schema:ia,title:ra,description:aa,id:sa,author:oa,discordName:la,discordLink:ua,versionNumber:ca,versionTitle:da,allowGoBack:fa,defaultShowSmall:pa,defaultDecimalsShown:ga,useHeader:ma,banner:va,logo:ha,initialTabs:ba,maxTickLength:ya,offlineLimit:wa,enablePausing:_a,exportEncoding:Na};class Ca{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 ka(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 ka{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const vi=17,Ma=9e15,Sa=Math.log10(9e15),Ia=1/9e15,xa=308,$a=-324,ji=5,Ea=(1<<10)-1,Ta=function(){const e=[];for(let n=$a+1;n<=xa;n++)e.push(Number("1e"+n));const t=323;return function(n){return e[n+t]}}(),rn=[2,Math.E,3,4,5,6,7,8,9,10],Da=[[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]],Pa=[[-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)},Z=function(e,t,n){return o.fromComponents(e,t,n)},ee=function(t,n,i){return o.fromComponents_noNormalize(t,n,i)};const Ut=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)))},hi=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},Fa=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},rr=.5671432904097838,zi=function(e,t=1e-10){let n,i;if(!Number.isFinite(e)||e===0)return e;if(e===1)return rr;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 Ui(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(rr);n=o.ln(e);for(let l=0;l<100;++l){if(i=n.neg().exp(),r=n.sub(e.mul(i)),a=n.sub(r.div(n.add(1).sub(n.add(2).mul(r).div(o.mul(2,n).add(2))))),o.abs(a.sub(n)).lt(o.abs(a).mul(t)))return a;n=a}throw Error(`Iteration failed to converge: ${e.toString()}`)}const y=class{constructor(e){this.sign=0,this.mag=0,this.layer=0,e instanceof y?this.fromDecimal(e):typeof e=="number"?this.fromNumber(e):typeof e=="string"&&this.fromString(e)}get m(){if(this.sign===0)return 0;if(this.layer===0){const e=Math.floor(Math.log10(this.mag));let t;return this.mag===5e-324?t=5:t=this.mag/Ta(e),this.sign*t}else if(this.layer===1){const e=this.mag-Math.floor(this.mag);return this.sign*Math.pow(10,e)}else return this.sign}set m(e){this.layer<=2?this.fromMantissaExponent(e,this.e):(this.sign=Math.sign(e),this.sign===0&&(this.layer=0,this.exponent=0))}get e(){return this.sign===0?0:this.layer===0?Math.floor(Math.log10(this.mag)):this.layer===1?Math.floor(this.mag):this.layer===2?Math.floor(Math.sign(this.mag)*Math.pow(10,Math.abs(this.mag))):this.mag*Number.POSITIVE_INFINITY}set e(e){this.fromMantissaExponent(this.m,e)}get s(){return this.sign}set s(e){e===0?(this.sign=0,this.layer=0,this.mag=0):this.sign=e}get mantissa(){return this.m}set mantissa(e){this.m=e}get exponent(){return this.e}set exponent(e){this.e=e}static fromComponents(e,t,n){return new y().fromComponents(e,t,n)}static fromComponents_noNormalize(e,t,n){return new y().fromComponents_noNormalize(e,t,n)}static fromMantissaExponent(e,t){return new y().fromMantissaExponent(e,t)}static fromMantissaExponent_noNormalize(e,t){return new y().fromMantissaExponent_noNormalize(e,t)}static fromDecimal(e){return new y().fromDecimal(e)}static fromNumber(e){return new y().fromNumber(e)}static fromString(e){return new y().fromString(e)}static fromValue(e){return new y().fromValue(e)}static fromValue_noAlloc(e){if(e instanceof y)return e;if(typeof e=="string"){const t=y.fromStringCache.get(e);return t!==void 0?t:y.fromString(e)}else return typeof e=="number"?y.fromNumber(e):y.dZero}static abs(e){return 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=ee(1,0,1)){return M(e).tetrate(t,n)}static iteratedexp(e,t=2,n=ee(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=ee(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 ee(0,0,0);const t=Math.random()>.5?1:-1;if(Math.random()*20<1)return ee(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)),Z(t,n,r)}static affordGeometricSeries_core(e,t,n,i){const r=t.mul(n.pow(i));return y.floor(e.div(r).mul(n.sub(1)).add(1).log10().div(n.log10()))}static sumGeometricSeries_core(e,t,n,i){return t.mul(n.pow(i)).mul(y.sub(1,n.pow(e))).div(y.sub(1,n))}static affordArithmeticSeries_core(e,t,n,i){const a=t.add(i.mul(n)).sub(n.div(2)),l=a.pow(2);return a.neg().add(l.add(n.mul(e).mul(2)).sqrt()).div(n).floor()}static sumArithmeticSeries_core(e,t,n,i){const r=t.add(i.mul(n));return e.div(2).mul(r.mul(2).plus(e.sub(1).mul(n)))}static efficiencyOfPurchase_core(e,t,n){return e.div(t).add(e.div(n))}normalize(){if(this.sign===0||this.mag===0&&this.layer===0)return this.sign=0,this.mag=0,this.layer=0,this;if(this.layer===0&&this.mag<0&&(this.mag=-this.mag,this.sign=-this.sign),this.layer===0&&this.mag<Ia)return this.layer+=1,this.mag=Math.log10(this.mag),this;let e=Math.abs(this.mag),t=Math.sign(this.mag);if(e>=Ma)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e<Sa&&this.layer>0;)this.layer-=1,this.layer===0?this.mag=Math.pow(10,this.mag):(this.mag=t*Math.pow(10,e),e=Math.abs(this.mag),t=Math.sign(this.mag));return this.layer===0&&(this.mag<0?(this.mag=-this.mag,this.sign=-this.sign):this.mag===0&&(this.sign=0)),this}fromComponents(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this.normalize(),this}fromComponents_noNormalize(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this}fromMantissaExponent(e,t){return this.layer=1,this.sign=Math.sign(e),e=Math.abs(e),this.mag=t+Math.log10(e),this.normalize(),this}fromMantissaExponent_noNormalize(e,t){return this.fromMantissaExponent(e,t),this}fromDecimal(e){return this.sign=e.sign,this.layer=e.layer,this.mag=e.mag,this}fromNumber(e){return this.mag=Math.abs(e),this.sign=Math.sign(e),this.layer=0,this.normalize(),this}fromString(e){const t=e,n=y.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const i=e.split("^^^");if(i.length===2){const _=parseFloat(i[0]),N=parseFloat(i[1]),E=i[1].split(";");let R=1;if(E.length===2&&(R=parseFloat(E[1]),isFinite(R)||(R=1)),isFinite(_)&&isFinite(N)){const $=y.pentate(_,N,R);return this.sign=$.sign,this.layer=$.layer,this.mag=$.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}const r=e.split("^^");if(r.length===2){const _=parseFloat(r[0]),N=parseFloat(r[1]),E=r[1].split(";");let R=1;if(E.length===2&&(R=parseFloat(E[1]),isFinite(R)||(R=1)),isFinite(_)&&isFinite(N)){const $=y.tetrate(_,N,R);return this.sign=$.sign,this.layer=$.layer,this.mag=$.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}const a=e.split("^");if(a.length===2){const _=parseFloat(a[0]),N=parseFloat(a[1]);if(isFinite(_)&&isFinite(N)){const E=y.pow(_,N);return this.sign=E.sign,this.layer=E.layer,this.mag=E.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}e=e.trim().toLowerCase();let l,u,c=e.split("pt");if(c.length===2){l=10,u=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let _=parseFloat(c[1]);if(isFinite(_)||(_=1),isFinite(l)&&isFinite(u)){const N=y.tetrate(l,u,_);return this.sign=N.sign,this.layer=N.layer,this.mag=N.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}if(c=e.split("p"),c.length===2){l=10,u=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let _=parseFloat(c[1]);if(isFinite(_)||(_=1),isFinite(l)&&isFinite(u)){const N=y.tetrate(l,u,_);return this.sign=N.sign,this.layer=N.layer,this.mag=N.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}const f=e.split("e"),b=f.length-1;if(b===0){const _=parseFloat(e);if(isFinite(_))return this.fromNumber(_),y.fromStringCache.size>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}else if(b===1){const _=parseFloat(e);if(isFinite(_)&&_!==0)return this.fromNumber(_),y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}const p=e.split("e^");if(p.length===2){this.sign=1,p[0].charAt(0)=="-"&&(this.sign=-1);let _="";for(let N=0;N<p[1].length;++N){const E=p[1].charCodeAt(N);if(E>=43&&E<=57||E===101)_+=p[1].charAt(N);else return this.layer=parseFloat(_),this.mag=parseFloat(p[1].substr(N+1)),this.normalize(),y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}if(b<1)return this.sign=0,this.layer=0,this.mag=0,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this;const w=parseFloat(f[0]);if(w===0)return this.sign=0,this.layer=0,this.mag=0,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this;let C=parseFloat(f[f.length-1]);if(b>=2){const _=parseFloat(f[f.length-2]);isFinite(_)&&(C*=Math.sign(_),C+=hi(_))}if(!isFinite(w))this.sign=f[0]==="-"?-1:1,this.layer=b,this.mag=C;else if(b===1)this.sign=Math.sign(w),this.layer=1,this.mag=C+Math.log10(Math.abs(w));else if(this.sign=Math.sign(w),this.layer=b,b===2){const _=y.mul(Z(1,2,C),M(w));return this.sign=_.sign,this.layer=_.layer,this.mag=_.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}else this.mag=C;return this.normalize(),y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}fromValue(e){return e instanceof y?this.fromDecimal(e):typeof e=="number"?this.fromNumber(e):typeof e=="string"?this.fromString(e):(this.sign=0,this.layer=0,this.mag=0,this)}toNumber(){return Number.isFinite(this.layer)?this.layer===0?this.sign*this.mag:this.layer===1?this.sign*Math.pow(10,this.mag):this.mag>0?this.sign>0?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:0:Number.NaN}mantissaWithDecimalPlaces(e){return isNaN(this.m)?Number.NaN:this.m===0?0:Ut(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Ut(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<=ji?(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):Ut(this.m,e)+"e"+Ut(this.e,e):this.layer===1?Ut(this.m,e)+"e"+Ut(this.e,e):this.layer<=ji?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Ut(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Ut(this.mag,e)}abs(){return ee(this.sign===0?0:1,this.layer,this.mag)}neg(){return ee(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?y.dZero:this.layer===0?Z(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?y.dZero:this.layer===0?Z(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?y.dZero:this.layer===0?Z(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?y.dZero:this.layer===0?Z(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 ee(0,0,0);let n,i;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(y.cmpabs(this,t)>0?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return y.fromNumber(n.sign*n.mag+i.sign*i.mag);const r=n.layer*Math.sign(n.mag),a=i.layer*Math.sign(i.mag);if(r-a>=2)return n;if(r===0&&a===-1){if(Math.abs(i.mag-Math.log10(n.mag))>vi)return n;{const l=Math.pow(10,Math.log10(n.mag)-i.mag),u=i.sign+n.sign*l;return Z(Math.sign(u),1,i.mag+Math.log10(Math.abs(u)))}}if(r===1&&a===0){if(Math.abs(n.mag-Math.log10(i.mag))>vi)return n;{const l=Math.pow(10,n.mag-Math.log10(i.mag)),u=i.sign+n.sign*l;return Z(Math.sign(u),1,Math.log10(i.mag)+Math.log10(Math.abs(u)))}}if(Math.abs(n.mag-i.mag)>vi)return n;{const l=Math.pow(10,n.mag-i.mag),u=i.sign+n.sign*l;return Z(Math.sign(u),1,i.mag+Math.log10(Math.abs(u)))}}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 ee(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return ee(this.sign*t.sign,0,1);let n,i;if(this.layer>t.layer||this.layer==t.layer&&Math.abs(this.mag)>Math.abs(t.mag)?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return y.fromNumber(n.sign*i.sign*n.mag*i.mag);if(n.layer>=3||n.layer-i.layer>=2)return Z(n.sign*i.sign,n.layer,n.mag);if(n.layer===1&&i.layer===0)return Z(n.sign*i.sign,1,n.mag+Math.log10(i.mag));if(n.layer===1&&i.layer===1)return Z(n.sign*i.sign,1,n.mag+i.mag);if(n.layer===2&&i.layer===1){const r=Z(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(Z(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return Z(n.sign*i.sign,r.layer+1,r.sign*r.mag)}if(n.layer===2&&i.layer===2){const r=Z(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(Z(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return Z(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?y.dNaN:this.layer===0?Z(this.sign,0,1/this.mag):Z(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=hi(r)),this.layer<n.layer&&(i=hi(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(y.dZero)?y.dZero:this.log10()}absLog10(){return this.sign===0?y.dNaN:this.layer>0?Z(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):Z(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?y.dNaN:this.layer>0?Z(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):Z(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?y.dNaN:this.layer===0&&e.layer===0?Z(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):y.div(this.log10(),e.log10())}log2(){return this.sign<=0?y.dNaN:this.layer===0?Z(this.sign,0,Math.log2(this.mag)):this.layer===1?Z(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?Z(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):Z(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?y.dNaN:this.layer===0?Z(this.sign,0,Math.log(this.mag)):this.layer===1?Z(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?Z(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):Z(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)?ee(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(i.sign===0)return ee(1,0,1);if(i.sign===1&&i.layer===0&&i.mag===1)return n;const r=n.absLog10().mul(i).pow10();return this.sign===-1?Math.abs(i.toNumber()%2)%2===1?r.neg():Math.abs(i.toNumber()%2)%2===0?r:y.dNaN:r}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return y.dNaN;let e=this;if(e.layer===0){const t=Math.pow(10,e.sign*e.mag);if(Number.isFinite(t)&&Math.abs(t)>=.1)return Z(1,0,t);if(e.sign===0)return y.dOne;e=ee(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?Z(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?Z(-e.sign,e.layer+1,-e.mag):y.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?y.exp(y.mul(this,y.ln(this).sub(1))):y.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(ee(1,0,24)))return y.fromNumber(Fa(this.sign*this.mag));const e=this.mag-1;let t=.9189385332046727;t=t+(e+.5)*Math.log(e),t=t-e;const n=e*e;let i=e,r=12*i,a=1/r,l=t+a;if(l===t||(t=l,i=i*n,r=360*i,a=1/r,l=t-a,l===t))return y.exp(t);t=l,i=i*n,r=1260*i;let u=1/r;return t=t+u,i=i*n,r=1680*i,u=1/r,t=t-u,y.exp(t)}else return this.layer===1?y.exp(y.mul(this,y.ln(this).sub(1))):y.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?y.dOne:this.layer===0&&this.mag<=709.7?y.fromNumber(Math.exp(this.sign*this.mag)):this.layer===0?Z(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?Z(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):Z(1,this.layer+1,this.sign*this.mag)}sqr(){return this.pow(2)}sqrt(){if(this.layer===0)return y.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return Z(1,2,Math.log10(this.mag)-.3010299956639812);{const e=y.div(ee(this.sign,this.layer-1,this.mag),ee(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=ee(1,0,1)){if(e===1)return y.pow(this,t);if(e===0)return new y(t);if(this.eq(y.dOne))return y.dOne;if(this.eq(-1))return y.pow(this,t);if(e===Number.POSITIVE_INFINITY){const r=this.toNumber();if(r<=1.444667861009766&&r>=.06598803584531254){if(r>1.444667861009099)return y.fromNumber(Math.E);const a=y.ln(this).neg();return a.lambertw().div(a)}else return r>1.444667861009766?y.fromNumber(Number.POSITIVE_INFINITY):y.dNaN}if(this.eq(y.dZero)){let r=Math.abs((e+1)%2);return r>1&&(r=2-r),y.fromNumber(r)}if(e<0)return y.iteratedlog(t,this,-e);t=M(t);const n=e;e=Math.trunc(e);const i=n-e;if(this.gt(y.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let r=0;r<e;++r){const a=t;if(t=this.pow(t),a.eq(t))return t}if(i!=0){const r=this.pow(t);return t.mul(1-i).add(r.mul(i))}return t}i!==0&&(t.eq(y.dOne)?this.gt(10)?t=this.pow(i):(t=y.fromNumber(y.tetrate_critical(this.toNumber(),i)),this.lt(2)&&(t=t.sub(1).mul(this.minus(1)).plus(1))):this.eq(10)?t=t.layeradd10(i):t=t.layeradd(i,this));for(let r=0;r<e;++r){if(t=this.pow(t),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(t.layer-this.layer>3)return ee(t.sign,t.layer+(e-r-1),t.mag);if(r>1e4)return t}return t}iteratedexp(e=2,t=ee(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return y.tetrate(e,-t,this);e=M(e);let n=y.fromDecimal(this);const i=t;t=Math.trunc(t);const r=i-t;if(n.layer-e.layer>3){const a=Math.min(t,n.layer-e.layer-3);t-=a,n.layer-=a}for(let a=0;a<t;++a){if(n=n.log(e),!isFinite(n.layer)||!isFinite(n.mag))return n.normalize();if(a>1e4)return n}return r>0&&r<1&&(e.eq(10)?n=n.layeradd10(-r):n=n.layeradd(-r,e)),n}slog(e=10,t=100){let n=.001,i=!1,r=!1,a=this.slog_internal(e).toNumber();for(let l=1;l<t;++l){const c=new y(e).tetrate(a).gt(this);if(l>1&&r!=c&&(i=!0),r=c,i?n/=2:n*=2,n=Math.abs(n)*(c?-1:1),a+=n,n===0)break}return y.fromNumber(a)}slog_internal(e=10){if(e=M(e),e.lte(y.dZero)||e.eq(y.dOne))return y.dNaN;if(e.lt(y.dOne))return this.eq(y.dOne)?y.dZero:this.eq(y.dZero)?y.dNegOne:y.dNaN;if(this.mag<0||this.eq(y.dZero))return y.dNegOne;let t=0,n=y.fromDecimal(this);if(n.layer-e.layer>3){const i=n.layer-e.layer-3;t+=i,n.layer-=i}for(let i=0;i<100;++i)if(n.lt(y.dZero))n=y.pow(e,n),t-=1;else{if(n.lte(y.dOne))return y.fromNumber(t+y.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=y.log(n,e)}return y.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:y.critical_section(e,t,Pa)}static tetrate_critical(e,t){return y.critical_section(e,t,Da)}static critical_section(e,t,n){t*=10,t<0&&(t=0),t>10&&(t=10),e<2&&(e=2),e>10&&(e=10);let i=0,r=0;for(let l=0;l<rn.length;++l)if(rn[l]==e){i=n[l][Math.floor(t)],r=n[l][Math.ceil(t)];break}else if(rn[l]<e&&rn[l+1]>e){const u=(e-rn[l])/(rn[l+1]-rn[l]);i=n[l][Math.floor(t)]*(1-u)+n[l+1][Math.floor(t)]*u,r=n[l][Math.ceil(t)]*(1-u)+n[l+1][Math.ceil(t)]*u;break}const a=t-Math.floor(t);return i<=0||r<=0?i*(1-a)+r*a:Math.pow(e,Math.log(i)/Math.log(e)*(1-a)+Math.log(r)/Math.log(e)*a)}layeradd10(e){e=y.fromValue_noAlloc(e).toNumber();const t=y.fromDecimal(this);if(e>=1){t.mag<0&&t.layer>0?(t.sign=0,t.mag=0,t.layer=0):t.sign===-1&&t.layer==0&&(t.sign=1,t.mag=-t.mag);const n=Math.trunc(e);e-=n,t.layer+=n}if(e<=-1){const n=Math.trunc(e);if(e-=n,t.layer+=n,t.layer<0)for(let i=0;i<100;++i){if(t.layer++,t.mag=Math.log10(t.mag),!isFinite(t.mag))return t.sign===0&&(t.sign=1),t.layer<0&&(t.layer=0),t.normalize();if(t.layer>=0)break}}for(;t.layer<0;)t.layer++,t.mag=Math.log10(t.mag);return t.sign===0&&(t.sign=1,t.mag===0&&t.layer>=1&&(t.layer-=1,t.mag=1)),t.normalize(),e!==0?t.layeradd(e,10):t}layeradd(e,t){const i=this.slog(t).toNumber()+e;return i>=0?y.tetrate(t,i):Number.isFinite(i)?i>=-1?y.log(y.tetrate(t,i+1),t):y.log(y.log(y.tetrate(t,i+2),t),t):y.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return y.fromNumber(zi(this.toNumber()));if(this.layer===0)return y.fromNumber(zi(this.sign*this.mag));if(this.layer===1)return Ui(this);if(this.layer===2)return Ui(this);if(this.layer>=3)return ee(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return ee(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=ee(1,0,1)){t=M(t);const n=e;e=Math.trunc(e);const i=n-e;i!==0&&(t.eq(y.dOne)?(++e,t=y.fromNumber(i)):this.eq(10)?t=t.layeradd10(i):t=t.layeradd(i,this));for(let r=0;r<e;++r){if(t=this.tetrate(t.toNumber()),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(r>10)return t}return t}sin(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.sin(this.sign*this.mag)):ee(0,0,0)}cos(){return this.mag<0?y.dOne:this.layer===0?y.fromNumber(Math.cos(this.sign*this.mag)):ee(0,0,0)}tan(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.tan(this.sign*this.mag)):ee(0,0,0)}asin(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.asin(this.sign*this.mag)):ee(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?y.fromNumber(Math.acos(this.toNumber())):this.layer===0?y.fromNumber(Math.acos(this.sign*this.mag)):ee(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.atan(this.sign*this.mag)):y.fromNumber(Math.atan(this.sign*(1/0)))}sinh(){return this.exp().sub(this.negate().exp()).div(2)}cosh(){return this.exp().add(this.negate().exp()).div(2)}tanh(){return this.sinh().div(this.cosh())}asinh(){return y.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return y.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?ee(Number.NaN,Number.NaN,Number.NaN):y.ln(this.add(1).div(y.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(y.pow(10,e))}egg(){return this.add(9)}lessThanOrEqualTo(e){return this.cmp(e)<1}lessThan(e){return this.cmp(e)<0}greaterThanOrEqualTo(e){return this.cmp(e)>-1}greaterThan(e){return this.cmp(e)>0}};let o=y;o.fromStringCache=new Ca(Ea);o.dZero=ee(0,0,0);o.dOne=ee(1,0,1);o.dNegOne=ee(-1,0,1);o.dTwo=ee(1,0,2);o.dTen=ee(1,0,10);o.dNaN=ee(Number.NaN,Number.NaN,Number.NaN);o.dInf=ee(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);o.dNegInf=ee(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);o.dNumberMax=Z(1,0,Number.MAX_VALUE);o.dNumberMin=Z(1,0,Number.MIN_VALUE);M=o.fromValue_noAlloc;Z=o.fromComponents;ee=o.fromComponents_noNormalize;o.fromMantissaExponent;o.fromMantissaExponent_noNormalize;const Aa=new o(1);function Fn(e,t,n=!0){let i=o.log10(e).floor(),r=o.div(e,o.pow(10,i));r.toStringWithDecimalPlaces(t)==="10"&&(r=Aa,i=i.add(1));const a=i.gte(1e9)?we(i,Math.max(Math.max(t,3),ge.defaultDecimalsShown)):i.gte(1e4)?Xn(i,0):i.toStringWithDecimalPlaces(0);return n?r.toStringWithDecimalPlaces(t)+"e"+a:"e"+a}function Xn(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 ar(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()),ge.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const Oa=new o("eeee1000"),Ra=new o("e100000"),Gi=new o("e1000"),sr=new o(1e9),qa=new o(1e6),Va=new o(1e3),La=new o(.98),Ba=new o(.001),or=new o(0);function we(e,t,n){if(t==null&&(t=ge.defaultDecimalsShown),n=n!=null?n:ge.defaultShowSmall,e=new o(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+we(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(Oa)){const i=e.slog();return i.gte(qa)?"F"+we(i.floor()):o.pow(10,i.sub(i.floor())).toStringWithDecimalPlaces(3)+"F"+Xn(i.floor(),0)}else{if(e.gte(Ra))return Fn(e,0,!1);if(e.gte(Gi))return Fn(e,0);if(e.gte(sr))return Fn(e,t);if(e.gte(Va))return Xn(e,0);if(e.gte(Ba)||!n)return ar(e,t);if(e.eq(or))return 0 .toFixed(t)}return e=ur(e),e.lt(Gi)?Fn(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):we(e,t)+"\u207B\xB9"}function ft(e){return e=new o(e),e.sign<0?"-"+ft(e.neg()):e.gte(sr)||e.lte(La)&&!e.eq(or)?we(e):we(e,0)}function lr(e){return o.lt(e,0)?"-"+lr(o.neg(e)):o.gt(e,2**51)?we(o.div(e,31536e3))+"y":(e=new o(e).toNumber(),e<60?we(e)+"s":e<3600?ft(Math.floor(e/60))+"m "+we(e%60)+"s":e<86400?ft(Math.floor(e/3600))+"h "+ft(Math.floor(e/60)%60)+"m "+ft(e%60)+"s":e<31536e3?ft(Math.floor(e/84600)%365)+"d "+ft(Math.floor(e/3600)%24)+"h "+ft(Math.floor(e/60)%60)+"m":ft(Math.floor(e/31536e3))+"y "+ft(Math.floor(e/84600)%365)+"d "+ft(Math.floor(e/3600)%24)+"h")}function ja(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 za(e,t){return we(e,t,!0)}function ur(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 Ua=Object.freeze(Object.defineProperty({__proto__:null,default:o,exponentialFormat:Fn,commaFormat:Xn,regularFormat:ar,format:we,formatWhole:ft,formatTime:lr,toPlaces:ja,formatSmall:za,invertOOM:ur},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:Ga,commaFormat:Wa,regularFormat:Ha,format:cn,formatWhole:je,formatTime:oi,toPlaces:Za,formatSmall:Zt,invertOOM:Ya}=Ua;window.Decimal=o;window.exponentialFormat=Ga;window.commaFormat=Wa;window.regularFormat=Ha;window.format=cn;window.formatWhole=je;window.formatTime=oi;window.toPlaces=Za;window.formatSmall=Zt;window.invertOOM=Ya;function ze(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function Qn(e){return typeof e=="function"}var Y=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(Y||{});const Ln=Symbol("DoNotCache");function P(e,t){const n=e[t];Qn(n)&&n.length===0&&!n[Ln]?e[t]=S(n.bind(e)):Qn(n)&&(e[t]=n.bind(e),e[t][Ln]=!0)}function _e(e){return Qn(e)&&!e[Ln]&&(e=S(e)),e}const gt=Symbol("Component"),rt=Symbol("GatherProps");let Ja=0;function kn(e="feature-"){return e+Ja++}var ke=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(ke||{});function at(e){const t=s(e);return t!==2&&t!==!1}function Mn(e){return s(e)===1}function te(e){return e[Ln]=!0,e}function se(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}function ki(e,...t){const n=[],i=r=>{Object.keys(r).forEach(a=>{const l=r[a];l!=null&&typeof l=="object"&&(t.includes(l.type)?n.push(l):!(l instanceof o)&&!De(l)&&i(l))})};return i(e),n}const an={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 $i=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))($i||{}),bt={classic:an,paper:{...an,variables:{...an.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:{...an,variables:{...an.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:{...an,variables:{...an.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}};const Ge=ir();"fonts"in document&&(document.fonts.onloadingdone=()=>Ge.emit("fontsLoaded"));var Ka=Object.freeze(Object.defineProperty({__proto__:null,globalBus:Ge},Symbol.toStringTag,{value:"Module"}));const Xa=fn({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var K=window.player=Xa;function cr(e){return JSON.stringify(e,(t,n)=>s(n))}function dr(e={}){return Object.assign({id:`${ge.id}-0`,name:"Default Save",tabs:ge.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:ge.id,modVersion:ge.versionNumber,layers:{}},e)}function Qe(e){const t=Ht.compressToUTF16(cr(e!=null?e:K));return localStorage.setItem((e!=null?e:K).id,t),t}async function Qa(){ns();try{let e=localStorage.getItem(oe.active);if(e==null){await sn(yn());return}if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Ht.decompressFromUTF16(e);else throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==ge.id){await sn(yn());return}t.id=oe.active,await sn(t)}catch(e){console.error(`Failed to load save. Falling back to new save.
`,e),await sn(yn())}}function yn(){const e=Jn(),t=dr({id:e});return Qe(t),oe.saves.push(e),t}function Jn(){let e,t=0;do e=`${ge.id}-${t++}`;while(localStorage.getItem(e)!=null);return e}const es=B(!1);async function sn(e){console.info("Loading save",e),es.value=!0;const{layers:t,removeLayer:n,addLayer:i}=await Vn(()=>Promise.resolve().then(function(){return Cs}),void 0),{fixOldSave:r,getInitialLayers:a}=await Vn(()=>Promise.resolve().then(function(){return yd}),void 0);for(const l in t){const u=t[l];u&&n(u)}a(e).forEach(l=>i(l,e)),e=dr(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,ge.offlineLimit*3600)),e.time=Date.now(),e.modVersion!==ge.versionNumber&&(r(e.modVersion,e),e.modVersion=ge.versionNumber),Object.assign(K,e),oe.active=K.id,Ge.emit("onLoad")}setInterval(()=>{K.autosave&&Qe()},1e3);window.onbeforeunload=()=>{K.autosave&&Qe()};window.save=Qe;const ts=window.hardReset=async()=>{await sn(yn())};window.deleteLowerSaves=()=>{const e=Object.values(oe.saves).indexOf(K.id)+1;Object.values(oe.saves).slice(e).forEach(t=>localStorage.removeItem(t)),oe.saves=oe.saves.slice(0,e)};const Bn=fn({active:"",saves:[],showTPS:!0,theme:$i.Nordic,unthrottled:!1,alignUnits:!1});nt(Bn,e=>{const t=Ht.compressToUTF16(JSON.stringify(e));localStorage.setItem(ge.id,t)},{deep:!0});var oe=window.settings=Bn;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:$i.Nordic,alignUnits:!1};Ge.emit("loadSettings",e),Object.assign(Bn,e),ts()};function ns(){try{let e=localStorage.getItem(ge.id);if(e!=null&&e!==""){if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Ht.decompressFromUTF16(e);else{console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(Bn,t)}Ge.emit("loadSettings",Bn)}catch{}}const fr=fn([]);function is(e){fr.push(e)}const rs=fn([]),as=fn([]),ss={class:"table"},os=X({__name:"Row",setup(e){const t=S(()=>bt[oe.theme].mergeAdjacent);return(n,i)=>(I(),T("div",ss,[k("div",{class:be(["row",{mergeAdjacent:s(t)}])},[Tt(n.$slots,"default")],2)]))}});function ls(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Rr(e)}function le(e,t="span"){return typeof e=="function"?X({render:e}):typeof e=="string"?e.length>0?(e=e.trim(),e.charAt(0)!=="<"&&(e=`<${t}>${e}</${t}>`),X({template:e})):X({render:()=>({})}):e}function Je(e){if(yt(e))return typeof e=="function"?e():le(e);const t=e[gt];return g(t,e[rt](),null)}function Wi(...e){let t;return g(os,null,ls(t=e.map(Je))?t:{default:()=>[t]})}function mt(e){if(yt(e))return typeof e=="function"?e():typeof e=="string"?g(ae,null,[e]):g(e,null,null);const t=e[gt];return g(t,e[rt](),null)}function Hi(e,t){return e.reduce((n,i)=>g(ae,null,[n,t,i]))}function yt(e){return typeof e=="string"?!0:typeof e=="object"?e==null?!1:"render"in e||"component"in e:typeof e=="function"&&e[Ln]===!0}function pr(e,t){const n=B(null),i=B(void 0);function r(u){n.value||(n.value=setInterval(l,250)),i.value=u}function a(){n.value&&(clearInterval(n.value),n.value=null)}function l(){t&&t.value?t.value():e&&e.value&&e.value(i.value)}return nr(a),{start:r,stop:a,handleHolding:l}}function gr(e,t="div"){const n=it();return pt(()=>{n.value=le(Ae(e),t)}),n}function jn(e,t="div"){const n=it(null);return pt(()=>{const i=Ae(e);n.value=i==""||i==null?null:le(i,t)}),n}function Ae(e){return s(s(e))}function L(...e){return e.includes(Object)||e.push(Object),e}function us(e){const t=B(!1),n=e[rt].bind(e);return e[rt]=()=>({...n(),onPointerenter:()=>t.value=!0,onPointerleave:()=>t.value=!1}),t}var me=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};const cs=X({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var b;const n=B({}),i=new ResizeObserver(u),r=B(null);ai(()=>{const p=r.value;p!=null&&i.observe(p)});let a=!0,l=B((b=r.value)==null?void 0:b.getBoundingClientRect());function u(){a&&(a=!1,Dt(()=>{var p;l.value=(p=r.value)==null?void 0:p.getBoundingClientRect(),Object.values(n.value).filter(w=>w).forEach(w=>w.rect=w.element.getBoundingClientRect()),t("updateNodes",n.value),a=!0}))}Ge.on("fontsLoaded",u);const c={attributes:!1,childList:!0,subtree:!1};Hn(Ei,(p,w)=>{const C=new MutationObserver(()=>f(p));C.observe(w,c),n.value[p]={element:w,observer:C,rect:w.getBoundingClientRect()},u()}),Hn(Ti,p=>{var w;(w=n.value[p])==null||w.observer.disconnect(),n.value[p]=void 0,u()}),Hn(Di,n),Hn(Pi,l);function f(p){const w=n.value[p];w!=null&&(w.rect=w.element.getBoundingClientRect(),t("updateNodes",n.value))}return(p,w)=>(I(),T(ae,null,[Tt(p.$slots,"default",{},void 0,!0),k("div",{ref_key:"resizeListener",ref:r,class:"resize-listener"},null,512)],64))}});var mr=me(cs,[["__scopeId","data-v-2b1dc1bc"]]);const ds=["onPointerdown"],fs={class:"modal-wrapper"},ps={class:"modal-container"},gs={class:"modal-header"},ms={class:"modal-body"},vs={class:"modal-footer"},hs=k("div",{class:"modal-default-flex-grow"},null,-1),Ft=X({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const r=Ee(e),a=S(()=>s(r.modelValue)||u.value);function l(){n("update:modelValue",!1)}const u=B(!1),c=B(null),f=S(()=>{var b,p;return(p=(b=c.value)==null?void 0:b.nodes)!=null?p:null});return t({isOpen:a,nodes:f}),(b,p)=>(I(),ne(Vr,{to:"#modal-root"},[g(_n,{name:"modal",onBeforeEnter:p[0]||(p[0]=w=>u.value=!0),onAfterLeave:p[1]||(p[1]=w=>u.value=!1)},{default:H(()=>[Ii(k("div",Pt({class:"modal-mask",onPointerdown:wn(l,["self"])},b.$attrs),[k("div",fs,[k("div",ps,[k("div",gs,[Tt(b.$slots,"header",{shown:s(a)},()=>[O(" default header ")])]),k("div",ms,[g(mr,{ref_key:"contextRef",ref:c},{default:H(()=>[Tt(b.$slots,"body",{shown:s(a)},()=>[O(" default body ")])]),_:3},512)]),k("div",vs,[Tt(b.$slots,"footer",{shown:s(a)},()=>[k("div",{class:"modal-default-footer"},[hs,k("button",{class:"button modal-default-button",onClick:l}," Close ")])])])])])],16,ds),[[qr,e.modelValue]])]),_:3})]))}}),Wt=Symbol("ProxyState");function We(e,t={}){const n=t;let i=!1;function r(){return i||(Object.assign(n,e.call(n,n)),i=!0),n}return new Proxy(n,{get(a,l){if(l===Wt)return r();const u=r()[l];return u!=null&&typeof u=="object"&&kt in u?u[kt]:u},set(a,l,u){return r()[l]=u,!0},has(a,l){return l===Wt?!0:Reflect.has(r(),l)},ownKeys(){return Reflect.ownKeys(r())},getOwnPropertyDescriptor(a,l){return i||(Object.assign(n,e.call(n,n)),i=!0),Object.getOwnPropertyDescriptor(a,l)}})}var Fe=window.state=xi({lastTenTicks:[],hasNaN:!1,NaNPath:[]});const Yt=Symbol("PersistentState"),Cn=Symbol("DefaultValue"),ei=Symbol("StackTrace"),ti=Symbol("Deleted"),kt=Symbol("NonPersistent"),on=Symbol("SaveDataPath"),Mi=Symbol("SkipPersistence");function bs(){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 Zi(e,t){var n;if(o.isNaN(t))throw Fe.hasNaN||(K.autosave=!1,Fe.hasNaN=!0,Fe.NaNPath=e[on],Fe.NaNPersistent=e),console.error("Attempted to save NaN value to",(n=e[on])==null?void 0:n.join("."),e),new Error("Attempted to set NaN value. See above for details");e[Yt].value=t}function tt(e,t=!0){const n=De(e)?e:B(e);De(e)&&(e=e.value);const i=S({get(){return n.value},set(a){t?Zi(r,a):r[Yt].value=a}});i[Cn]=e;const r={get value(){return n.value},set value(a){t?Zi(r,a):r[Yt].value=a},__v_isRef:!0,[Yt]:n,[Cn]:e,[ei]:bs(),[ti]:!1,[kt]:i,[on]:void 0};return Ye.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",r,`
Created at:
`+r[ei]):dn[Ye[Ye.length-1]].add(r),r}function ys(e){return e!=null&&typeof e=="object"&&Yt in e}function Zn(e){return!(Wt in e)&&kt in e?e[kt]:new Proxy(e,{get(t,n){if(n!==Yt)return n===Mi?!0:t[n]},set(t,n,i){return t[n]=i,!0},has(t,n){return n===Yt?!1:n==Mi?!0:Reflect.has(t,n)}})}function vr(e){Ye.length===0?console.warn("Deleting a persistent ref outside of a layer. Ignoring...",e):dn[Ye[Ye.length-1]].delete(e),e[ti]=!0}Ge.on("addLayer",(e,t)=>{const n=[],i=(r,a=[])=>{let l=!1;return Object.keys(r).forEach(u=>{let c=r[u];if(c!=null&&typeof c=="object"){if(c[Mi]===!0)return;if(Wt in c&&(c=c[Wt]),ys(c)){if(l=!0,c[ti]){console.warn("Deleted persistent ref present in returned object. Ignoring...",c,`
Created at:
`+c[ei]);return}dn[e.id].delete(c);const f=[e.id,...a,u];c[on]!=null&&JSON.stringify(f)!==JSON.stringify(c[on])&&console.error(`Persistent ref is being saved to \`${f.join(".")}\` when it's already present at \`${c[on].join(".")}\`. This can cause unexpected behavior when loading saves between updates.`,c),c[on]=f;const b=a.reduce((w,C)=>(C in w||(w[C]={}),w[C]),t),p=b[u];b[u]=c[Yt],Lr(b)?p!=null?b[u]=p:b[u]=c[Cn]:p!=null?b[u].value=p:b[u].value=c[Cn]}else!(c instanceof o)&&!De(c)&&!n.includes(c)&&(typeof c.type=="symbol"&&n.push(c),i(c,[...a,u])&&(Mt(c)&&!Mt(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.",Wt in r?r[Wt]:r,u):l=!0))}}),l};i(e[Wt]),dn[e.id].forEach(r=>{r[ti]||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[ei])}),dn[e.id].clear()});const Ei=Symbol("RegisterNode"),Ti=Symbol("UnregisterNode"),Di=Symbol("Nodes"),Pi=Symbol("Bounds"),Ce=xi({});window.layers=Ce;const dn={},Ye=[];function Fi(e,t){return We(()=>{const n={},i=n.emitter=ir();if(n.on=i.on.bind(i),n.emit=i.emit.bind(i),n.nodes=B({}),n.id=e,Ye.push(e),dn[e]=new Set,n.minimized=tt(!1,!1),Object.assign(n,t.call(n,n)),Ye[Ye.length-1]==null||Ye[Ye.length-1]!==e)throw`Adding layers stack in invalid state. This should not happen
Stack: ${Ye}
Trying to pop ${n.id}`;Ye.pop(),P(n,"color"),P(n,"display"),P(n,"classes"),P(n,"style"),P(n,"name"),se(n,"name",n.id),P(n,"minWidth"),se(n,"minWidth",600),P(n,"minimizable"),se(n,"minimizable",!0),P(n,"minimizedDisplay");const r=n.style;return n.style=S(()=>{var l,u;let a=s(n.minWidth);return(typeof a=="number"||!Number.isNaN(parseInt(a)))&&(a=a+"px"),[(l=s(r))!=null?l:"",(u=n.minimized)!=null&&u.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:a,flexBasis:a,margin:""}]}),n})}function Ai(e,t){if(console.info("Adding layer",e.id),Ce[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,Ce[e.id]);return}se(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),Ce[e.id]=e,Ge.emit("addLayer",e,t.layers[e.id])}function ws(e){return Ce[e]}function hr(e){console.info("Removing layer",e.id),Ge.emit("removeLayer",e),Ce[e.id]=void 0}function _s(e){hr(e),Ai(e,K)}function Ns(e){const t=B(!1);return{openModal:()=>t.value=!0,modal:te(()=>g(Ft,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},{header:()=>g("h2",null,[s(e.name)]),body:s(e.display)}))}}Ge.on("update",function(t){Object.values(Ce).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(Ce).forEach(n=>{n==null||n.emit("update",t)}),Object.values(Ce).forEach(n=>{n==null||n.emit("postUpdate",t)})});var Cs=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:Ei,UnregisterNodeInjectionKey:Ti,NodesInjectionKey:Di,BoundsInjectionKey:Pi,layers:Ce,persistentRefs:dn,addingLayers:Ye,createLayer:Fi,addLayer:Ai,getLayer:ws,removeLayer:hr,reloadLayer:_s,setupLayerModal:Ns},Symbol.toStringTag,{value:"Module"}));const ks=X({components:{Context:mr},props:{index:{type:Number,required:!0},display:{type:L(Object,String,Function),required:!0},minimizedDisplay:L(Object,String,Function),minimized:{type:Object,required:!0},name:{type:L(String),required:!0},color:L(String),minimizable:L(Boolean),nodes:{type:Object,required:!0}},emits:["setMinimized"],setup(e){const{display:t,index:n,minimized:i,minimizedDisplay:r}=Ee(e),a=gr(t),l=jn(r),u=S(()=>ge.allowGoBack&&n.value>0&&!Ae(i));function c(){K.tabs.splice(s(e.index),1/0)}function f(b){e.nodes.value=b}return{component:a,minimizedComponent:l,showGoBack:u,updateNodes:f,unref:s,goBack:c}}}),Ms={key:1};function Ss(e,t,n,i,r,a){const l=St("Context");return I(),T("div",{class:"layer-container",style:Ue({"--layer-color":e.unref(e.color)})},[e.showGoBack?(I(),T("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...u)=>e.goBack&&e.goBack(...u))},"\u274C")):j("",!0),e.unref(e.minimized)?(I(),T("button",{key:1,class:"layer-tab minimized",onClick:t[1]||(t[1]=u=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(I(),ne(Le(e.minimizedComponent),{key:0})):(I(),T("div",Ms,re(e.unref(e.name)),1))])):(I(),T("div",{key:2,class:be(["layer-tab",{showGoBack:e.showGoBack}])},[g(l,{onUpdateNodes:e.updateNodes},{default:H(()=>[(I(),ne(Le(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(I(),T("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=u=>e.$emit("setMinimized",!0))}," \u25BC ")):j("",!0)],4)}var Is=me(ks,[["render",Ss],["__scopeId","data-v-72dd78b1"]]);const br=e=>(pn("data-v-4b4bda40"),e=e(),gn(),e),xs=br(()=>k("h2",null,"Changelog",-1)),$s=br(()=>k("details",{open:""},[k("summary",null,[O("v0.0 Initial Commit - "),k("time",null,"2021-09-04")]),O(" 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)),Es=X({__name:"Changelog",setup(e,{expose:t}){const n=B(!1);return t({open(){n.value=!0}}),(i,r)=>(I(),ne(Ft,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a)},{header:H(()=>[xs]),body:H(()=>[$s]),_:1},8,["modelValue"]))}});var Ts=me(Es,[["__scopeId","data-v-4b4bda40"]]),Ds=X({props:{element:Object,display:{type:L(Object,String,Function),required:!0},style:L(Object,String,Array),classes:L(Object),direction:L(String),xoffset:L(String),yoffset:L(String),pinned:Object},setup(e){const{element:t,display:n,pinned:i}=Ee(e),r=B(!1),a=S(()=>(Ae(i)||r.value)&&l.value),l=jn(n),u=it(le(te(()=>{const b=Ae(t);return b==null?"":mt(b)})));function c(b){const p=i;b.shiftKey&&p&&(p.value=!p.value,b.stopPropagation(),b.preventDefault())}const f=S(()=>Ae(i)&&bt[oe.theme].showPin);return{Direction:Y,isHovered:r,isShown:a,comp:l,elementComp:u,unref:s,togglePinned:c,showPin:f}}});const Ps={key:0,class:"material-icons pinned"};function Fs(e,t,n,i,r,a){return I(),T("div",{class:be(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=l=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=l=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...l)=>e.togglePinned&&e.togglePinned(...l))},[Tt(e.$slots,"default",{},void 0,!0),e.elementComp?(I(),ne(Le(e.elementComp),{key:0})):j("",!0),g(_n,{name:"fade"},{default:H(()=>{var l;return[e.isShown?(I(),T("div",{key:0,class:be(["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:Ue([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(l=e.unref(e.style))!=null?l:{}])},[e.showPin?(I(),T("span",Ps,"push_pin")):j("",!0),e.comp?(I(),ne(Le(e.comp),{key:1})):j("",!0)],6)):j("",!0)]}),_:1})],34)}var xe=me(Ds,[["render",Fs],["__scopeId","data-v-6102fa3a"]]);const mn=e=>(pn("data-v-4f97aa40"),e=e(),gn(),e),As={class:"info-modal-header"},Os=["src","alt"],Rs={class:"info-modal-title"},qs={key:0},Vs={key:0},Ls={key:0},Bs=mn(()=>k("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),js=mn(()=>k("br",null,null,-1)),zs=mn(()=>k("br",null,null,-1)),Us=["href"],Gs=mn(()=>k("span",{class:"material-icons info-modal-discord"},"discord",-1)),Ws=mn(()=>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"),O(" The Paper Pilot Community ")])],-1)),Hs=mn(()=>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"),O(" The Modding Tree ")])],-1)),Zs=mn(()=>k("br",null,null,-1));var Ys=X({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:i,logo:r,author:a,discordName:l,discordLink:u,versionNumber:c,versionTitle:f}=ge,b=Ee(n),p=B(!1),w=S(()=>oi(K.timePlayed)),C=S(()=>le(te(()=>g(ae,null,[rs.map(Je)]))));t({open(){p.value=!0}});function _(){var N;(N=s(b.changelog))==null||N.open()}return(N,E)=>(I(),ne(Ft,{modelValue:p.value,"onUpdate:modelValue":E[0]||(E[0]=R=>p.value=R)},{header:H(()=>[k("div",As,[s(r)?(I(),T("img",{key:0,class:"info-modal-logo",src:s(r),alt:s(i)},null,8,Os)):j("",!0),k("div",Rs,[k("h2",null,re(s(i)),1),k("h4",null,[O(" v"+re(s(c)),1),s(f)?(I(),T("span",qs,": "+re(s(f)),1)):j("",!0)])])])]),body:H(({shown:R})=>[R?(I(),T("div",Vs,[s(a)?(I(),T("div",Ls,"By "+re(s(a)),1)):j("",!0),Bs,js,k("div",{class:"link",onClick:_},"Changelog"),zs,k("div",null,[s(u)?(I(),T("a",{key:0,href:s(u),class:"info-modal-discord-link",target:"_blank"},[Gs,O(" "+re(s(l)),1)],8,Us)):j("",!0)]),Ws,Hs,Zs,k("div",null,"Time Played: "+re(s(w)),1),(I(),ne(Le(s(C))))])):j("",!0)]),_:1},8,["modelValue"]))}});var Js=me(Ys,[["__scopeId","data-v-4f97aa40"]]);const Ks={class:"field"},Xs={key:0,class:"field-title"},Oi=X({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var l;const n=e,i=jn(Kt(n,"title"),"span"),r=B((l=n.options.find(u=>u.value===n.modelValue))!=null?l:null);nt(Kt(n,"modelValue"),u=>{var c;Ae(r)!==u&&(r.value=(c=n.options.find(f=>f.value===u))!=null?c:null)});function a(u){t("update:modelValue",u.value)}return(u,c)=>(I(),T("div",Ks,[s(i)?(I(),T("span",Xs,[(I(),ne(Le(s(i))))])):j("",!0),g(s(Wr),{options:e.options,modelValue:r.value,"onUpdate:modelValue":[c[0]||(c[0]=f=>r.value=f),a],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}});const Qs={class:"field"},eo=X({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,i=S(()=>{var a;return le((a=s(n.title))!=null?a:"<span></span>","span")}),r=S({get(){return!!n.modelValue},set(a){t("update:modelValue",a)}});return(a,l)=>(I(),T("label",Qs,[Ii(k("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":l[0]||(l[0]=u=>De(r)?r.value=u:null)},null,512),[[Br,s(r)]]),(I(),ne(Le(s(i))))]))}});var Et=me(eo,[["__scopeId","data-v-11046116"]]);const to=["onClick"],no=X({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=B(!1),i=B(null);function r(){t("click"),i.value&&clearTimeout(i.value),n.value=!1,Dt(()=>{n.value=!0,i.value=setTimeout(()=>n.value=!1,500)})}return(a,l)=>(I(),T("button",{onClick:wn(r,["stop"]),class:be(["feedback",{activated:n.value,left:e.left}])},[Tt(a.$slots,"default",{},void 0,!0)],10,to))}});var yr=me(no,[["__scopeId","data-v-01a1b95c"]]);const io={class:"header"},ro=k("h2",null,"Settings",-1),ao={class:"option-tabs"},so={key:0},oo={key:1};var lo=X({__name:"Options",setup(e,{expose:t}){const n=B(!1),i=B("behaviour");function r(ie){return ie==i.value}function a(ie){i.value=ie}t({isTab:r,setTab:a,save:Qe,open(){n.value=!0}});const l=Object.keys(bt).map(ie=>({label:ze(ie),value:ie})),u=S(()=>le(te(()=>g(ae,null,[fr.map(Je)])))),{showTPS:c,theme:f,unthrottled:b,alignUnits:p}=Ee(oe),{autosave:w,offlineProd:C}=Ee(K),_=S({get(){return K.devSpeed===0},set(ie){K.devSpeed=ie?0:null}}),N=te(()=>g("span",{class:"option-title"},[O("Unthrottled"),g("desc",null,[O("Allow the game to run as fast as possible. Not battery friendly.")])])),E=te(()=>g("span",{class:"option-title"},[O("Offline Production"),g(xe,{display:"Save-specific",direction:Y.Right},{default:()=>[O("*")]}),g("desc",null,[O("Simulate production that occurs while the game is closed.")])])),R=te(()=>g("span",{class:"option-title"},[O("Autosave"),g(xe,{display:"Save-specific",direction:Y.Right},{default:()=>[O("*")]}),g("desc",null,[O("Automatically save the game every second or when the game is closed.")])])),$=te(()=>g("span",{class:"option-title"},[O("Pause game"),g(xe,{display:"Save-specific",direction:Y.Right},{default:()=>[O("*")]}),g("desc",null,[O("Stop everything from moving.")])])),D=te(()=>g("span",{class:"option-title"},[O("Theme"),g("desc",null,[O("How the game looks.")])])),U=te(()=>g("span",{class:"option-title"},[O("Show TPS"),g("desc",null,[O("Show TPS meter at the bottom-left corner of the page.")])])),he=te(()=>g("span",{class:"option-title"},[O("Align modifier units"),g("desc",null,[O("Align numbers to the beginning of the unit in modifier view.")])]));return(ie,J)=>(I(),ne(Ft,{modelValue:n.value,"onUpdate:modelValue":J[10]||(J[10]=Q=>n.value=Q)},{header:H(()=>[k("div",io,[ro,k("div",ao,[k("button",{class:be({selected:r("behaviour")}),onClick:J[0]||(J[0]=Q=>a("behaviour"))},"Behaviour",2),k("button",{class:be({selected:r("appearance")}),onClick:J[1]||(J[1]=Q=>a("appearance"))},"Appearance",2)])])]),body:H(()=>[r("behaviour")?(I(),T("div",so,[g(Et,{title:s(N),modelValue:s(b),"onUpdate:modelValue":J[2]||(J[2]=Q=>De(b)?b.value=Q:null)},null,8,["title","modelValue"]),s(ge).enablePausing?(I(),ne(Et,{key:0,title:s($),modelValue:s(_),"onUpdate:modelValue":J[3]||(J[3]=Q=>De(_)?_.value=Q:null)},null,8,["title","modelValue"])):j("",!0),g(Et,{title:s(E),modelValue:s(C),"onUpdate:modelValue":J[4]||(J[4]=Q=>De(C)?C.value=Q:null)},null,8,["title","modelValue"]),g(Et,{title:s(R),modelValue:s(w),"onUpdate:modelValue":J[5]||(J[5]=Q=>De(w)?w.value=Q:null)},null,8,["title","modelValue"]),s(w)?j("",!0):(I(),ne(yr,{key:1,class:"button save-button",onClick:J[6]||(J[6]=Q=>s(Qe)())},{default:H(()=>[O("Manually save")]),_:1}))])):j("",!0),r("appearance")?(I(),T("div",oo,[g(Oi,{title:s(D),options:s(l),modelValue:s(f),"onUpdate:modelValue":J[7]||(J[7]=Q=>De(f)?f.value=Q:null)},null,8,["title","options","modelValue"]),(I(),ne(Le(s(u)))),g(Et,{title:s(U),modelValue:s(c),"onUpdate:modelValue":J[8]||(J[8]=Q=>De(c)?c.value=Q:null)},null,8,["title","modelValue"]),g(Et,{title:s(he),modelValue:s(p),"onUpdate:modelValue":J[9]||(J[9]=Q=>De(p)?p.value=Q:null)},null,8,["title","modelValue"])])):j("",!0)]),_:1},8,["modelValue"]))}});const uo=["onSubmit"],co={class:"field"},fo={key:0,class:"field-title"},po=["placeholder"],go=X({__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=jn(Kt(n,"title"),"span"),r=it(null);ai(()=>{var c;(c=r.value)==null||c.focus()});const a=S({get(){var c;return(c=s(n.modelValue))!=null?c:""},set(c){t("update:modelValue",c)}});function l(){t("submit")}function u(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(c,f)=>(I(),T("form",{onSubmit:wn(l,["prevent"])},[k("div",co,[s(i)?(I(),T("span",fo,[(I(),ne(Le(s(i))))])):j("",!0),e.textArea?(I(),ne(s(Zr),{key:1,modelValue:s(a),"onUpdate:modelValue":f[0]||(f[0]=b=>De(a)?a.value=b:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:u,ref_key:"field",ref:r},null,8,["modelValue","placeholder","maxHeight"])):Ii((I(),T("input",{key:2,type:"text","onUpdate:modelValue":f[1]||(f[1]=b=>De(a)?a.value=b:null),placeholder:e.placeholder,class:be({fullWidth:!e.title}),onBlur:u,ref_key:"field",ref:r},null,42,po)),[[jr,s(a)]])])],40,uo))}});var wr=me(go,[["__scopeId","data-v-90bd4994"]]);const mo={key:0},vo=["onClick","disabled"],ho={key:0},bo=["onClick"],yo=X({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const i=Ee(e),r=B(!1);nt(r,u=>{t("confirmingChanged",u)});function a(){if(s(i.skipConfirm)){t("click");return}r.value&&t("click"),r.value=!r.value}function l(){r.value=!1}return(u,c)=>(I(),T("span",{class:be(["container",{confirming:r.value}])},[r.value?(I(),T("span",mo,"Are you sure?")):j("",!0),k("button",{onClick:wn(a,["stop"]),class:"button danger",disabled:e.disabled},[r.value?(I(),T("span",ho,"Yes")):Tt(u.$slots,"default",{key:1},void 0,!0)],8,vo),r.value?(I(),T("button",{key:1,class:"button",onClick:wn(l,["stop"])},"No",8,bo)):j("",!0)],2))}});var wo=me(yo,[["__scopeId","data-v-2f8ef34c"]]);const At=e=>(pn("data-v-32313015"),e=e(),gn(),e),_o=At(()=>k("div",{class:"handle material-icons"},"drag_handle",-1)),No={key:0,class:"actions"},Co=At(()=>k("span",{class:"material-icons"},"content_paste",-1)),ko=At(()=>k("span",{class:"material-icons"},"content_copy",-1)),Mo=At(()=>k("span",{class:"material-icons"},"edit",-1)),So=At(()=>k("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),Io={key:1,class:"actions"},xo=At(()=>k("span",{class:"material-icons"},"check",-1)),$o=At(()=>k("span",{class:"material-icons"},"close",-1)),Eo={key:2,class:"details"},To={class:"save-version"},Do=At(()=>k("br",null,null,-1)),Po={key:0},Fo={key:3,class:"details"},Ao={key:4,class:"details error"},Oo=At(()=>k("br",null,null,-1)),Ro=X({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:i}=Ee(n),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),a=B(!1),l=B(!1),u=B("");nt(a,()=>{var p;return u.value=(p=i.value.name)!=null?p:""});const c=S(()=>i.value!=null&&i.value.id===K.id),f=S(()=>{var p;return c.value?K.time:(p=i.value!=null&&i.value.time)!=null?p:0});function b(){t("editName",u.value),a.value=!1}return(p,w)=>(I(),T("div",{class:be(["save",{active:s(c)}])},[_o,a.value?(I(),T("div",Io,[k("button",{onClick:b,class:"button"},[g(xe,{display:"Save",direction:s(Y).Left,class:"info"},{default:H(()=>[xo]),_:1},8,["direction"])]),k("button",{onClick:w[5]||(w[5]=C=>a.value=!a.value),class:"button"},[g(xe,{display:"Cancel",direction:s(Y).Left,class:"info"},{default:H(()=>[$o]),_:1},8,["direction"])])])):(I(),T("div",No,[s(i).error==null&&!l.value?(I(),ne(yr,{key:0,onClick:w[0]||(w[0]=C=>t("export")),class:"button",left:""},{default:H(()=>[g(xe,{display:"Export",direction:s(Y).Left,class:"info"},{default:H(()=>[Co]),_:1},8,["direction"])]),_:1})):j("",!0),s(i).error==null&&!l.value?(I(),T("button",{key:1,onClick:w[1]||(w[1]=C=>t("duplicate")),class:"button"},[g(xe,{display:"Duplicate",direction:s(Y).Left,class:"info"},{default:H(()=>[ko]),_:1},8,["direction"])])):j("",!0),s(i).error==null&&!l.value?(I(),T("button",{key:2,onClick:w[2]||(w[2]=C=>a.value=!a.value),class:"button"},[g(xe,{display:"Edit Name",direction:s(Y).Left,class:"info"},{default:H(()=>[Mo]),_:1},8,["direction"])])):j("",!0),g(wo,{disabled:s(c),onClick:w[3]||(w[3]=C=>t("delete")),onConfirmingChanged:w[4]||(w[4]=C=>l.value=C)},{default:H(()=>[g(xe,{display:"Delete",direction:s(Y).Left,class:"info"},{default:H(()=>[So]),_:1},8,["direction"])]),_:1},8,["disabled"])])),s(i).error==null&&!a.value?(I(),T("div",Eo,[k("button",{class:"button open",onClick:w[6]||(w[6]=C=>t("open"))},[k("h3",null,re(s(i).name),1)]),k("span",To,"v"+re(s(i).modVersion),1),Do,s(f)?(I(),T("div",Po,"Last played "+re(s(r).format(s(f))),1)):j("",!0)])):s(i).error==null&&a.value?(I(),T("div",Fo,[g(wr,{modelValue:u.value,"onUpdate:modelValue":w[7]||(w[7]=C=>u.value=C),class:"editname",onSubmit:b},null,8,["modelValue"])])):(I(),T("div",Ao,[O(" Error: Failed to load save with id "+re(s(i).id),1),Oo,O(re(s(i).error),1)]))],2))}});var qo=me(Ro,[["__scopeId","data-v-32313015"]]);const Ri=e=>(pn("data-v-2a4275be"),e=e(),gn(),e),Vo=Ri(()=>k("h2",null,"Saves Manager",-1)),Lo={class:"modal-footer"},Bo={class:"field"},jo=Ri(()=>k("span",{class:"field-title"},"Create Save",-1)),zo={class:"field-buttons"},Uo={class:"footer"},Go=Ri(()=>k("div",{style:{"flex-grow":"1"}},null,-1)),Wo=X({__name:"SavesManager",setup(e,{expose:t}){const n=B(!1),i=B(null);t({open(){n.value=!0}});const r=B(!1),a=B(""),l=B(null);nt(a,$=>{$?Dt(()=>{try{if($[0]!=="{")if($[0]==="e")$=decodeURIComponent(escape(atob($)));else if($[0]==="\u1BE1")$=Ht.decompressFromUTF16($);else{console.warn("Unable to determine preset encoding",$),r.value=!0;return}const D=JSON.parse($);if(typeof D!="object"){r.value=!0;return}const U=Jn();D.id=U,Qe(D),a.value="",r.value=!1,oe.saves.push(U)}catch{r.value=!0}}):r.value=!1});let u={},c=B(Object.keys(u).reduce(($,D)=>($.push({label:D.split("/").slice(-1)[0].slice(0,-4),value:u[D]}),$),[]));const f=xi({});function b($){if(f[$]==null){let D=localStorage.getItem($);if(D==null)f[$]={error:"Save doesn't exist in localStorage",id:$};else if(D==="dW5kZWZpbmVk")f[$]={error:"Save is undefined",id:$};else try{if(D[0]!=="{")if(D[0]==="e")D=decodeURIComponent(escape(atob(D)));else if(D[0]==="\u1BE1")D=Ht.decompressFromUTF16(D);else return console.warn("Unable to determine preset encoding",D),r.value=!0,f[$]={error:"Unable to determine preset encoding",id:$},f[$];f[$]={...JSON.parse(D),id:$}}catch(U){f[$]={error:U,id:$},console.warn(`SavesManager: Failed to load info about save with id ${$}:
${U}
${D}`)}}return f[$]}nt(n,$=>{$&&Object.keys(f).forEach(D=>delete f[D])});const p=S(()=>oe.saves.reduce(($,D)=>($[D]=b(D),$),{}));function w($){let D;switch(K.id===$?D=cr(K):D=JSON.stringify(p.value[$]),ge.exportEncoding){default:console.warn(`Unknown save encoding: ${ge.exportEncoding}. Defaulting to lz`);case"lz":D=Ht.compressToUTF16(D);break;case"base64":D=btoa(unescape(encodeURIComponent(D)));break;case"plain":break}const U=document.createElement("textarea");U.value=D,document.body.appendChild(U),U.select(),U.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(U)}function C($){K.id===$&&Qe();const D={...p.value[$],id:Jn()};Qe(D),oe.saves.push(D.id)}function _($){oe.saves=oe.saves.filter(D=>D!==$),localStorage.removeItem($),f[$]=void 0}function N($){p.value[K.id].time=K.time,Qe(),f[K.id]=void 0,sn(p.value[$]),f[$]=void 0}function E($){if(l.value=$,Dt(()=>{l.value=null}),$[0]!=="{")if($[0]==="e")$=decodeURIComponent(escape(atob($)));else if($[0]==="\u1BE1")$=Ht.decompressFromUTF16($);else{console.warn("Unable to determine preset encoding",$);return}const D=JSON.parse($);D.id=Jn(),Qe(D),oe.saves.push(D.id),N(D.id)}function R($,D){const U=p.value[$];U!=null&&(U.name=D,K.id===$?(K.name=D,Qe()):(Qe(U),f[$]=void 0))}return($,D)=>(I(),ne(Ft,{modelValue:n.value,"onUpdate:modelValue":D[4]||(D[4]=U=>n.value=U),ref_key:"modal",ref:i},{header:H(()=>[Vo]),body:H(({shown:U})=>[U?(I(),ne(s(Hr),{key:0,list:s(oe).saves,handle:".handle",itemKey:he=>he},{item:H(({element:he})=>[g(qo,{save:s(p)[he],onOpen:ie=>N(he),onExport:ie=>w(he),onEditName:ie=>R(he,ie),onDuplicate:ie=>C(he),onDelete:ie=>_(he)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):j("",!0)]),footer:H(()=>[k("div",Lo,[g(wr,{modelValue:a.value,"onUpdate:modelValue":D[0]||(D[0]=U=>a.value=U),title:"Import Save",placeholder:"Paste your save here!",class:be({importingFailed:r.value})},null,8,["modelValue","class"]),k("div",Bo,[jo,k("div",zo,[k("button",{class:"button",onClick:D[1]||(D[1]=U=>N(s(yn)().id))},"New Game"),Object.keys(s(c)).length>0?(I(),ne(Oi,{key:0,options:s(c),modelValue:l.value,"onUpdate:modelValue":D[2]||(D[2]=U=>E(U)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):j("",!0)])]),k("div",Uo,[Go,k("button",{class:"button modal-default-button",onClick:D[3]||(D[3]=U=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var _r=me(Wo,[["__scopeId","data-v-2a4275be"]]);const st=e=>(pn("data-v-318a1c31"),e=e(),gn(),e),Ho=["src","alt"],Zo={key:1,class:"title"},Yo=st(()=>k("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),Jo={class:"discord"},Ko={class:"discord-links"},Xo={key:0},Qo=["href"],el=st(()=>k("li",null,[k("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),tl=st(()=>k("li",null,[k("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),nl={href:"https://forums.moddingtree.com/",target:"_blank"},il=st(()=>k("span",{class:"material-icons"},"forum",-1)),rl=st(()=>k("span",{class:"material-icons"},"info",-1)),al=st(()=>k("span",{class:"material-icons"},"library_books",-1)),sl=st(()=>k("span",{class:"material-icons"},"settings",-1)),ol=st(()=>k("span",{class:"material-icons"},"library_books",-1)),ll=st(()=>k("span",{class:"material-icons"},"settings",-1)),ul=st(()=>k("span",{class:"material-icons"},"info",-1)),cl={href:"https://forums.moddingtree.com/",target:"_blank"},dl=st(()=>k("span",{class:"material-icons"},"forum",-1)),fl={class:"discord"},pl={class:"discord-links"},gl={key:0},ml=["href"],vl=st(()=>k("li",null,[k("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),hl=st(()=>k("li",null,[k("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),bl=X({__name:"Nav",setup(e){const t=B(null),n=B(null),i=B(null),r=B(null),{useHeader:a,banner:l,title:u,discordName:c,discordLink:f,versionNumber:b}=ge;function p(){window.open(f,"mywindow")}return(w,C)=>(I(),T(ae,null,[s(a)?(I(),T("div",Pt({key:0,class:"nav"},w.$attrs),[s(l)?(I(),T("img",{key:0,src:s(l),class:"banner",alt:s(u)},null,8,Ho)):(I(),T("div",Zo,re(s(u)),1)),k("div",{onClick:C[0]||(C[0]=_=>{var N;return(N=r.value)==null?void 0:N.open()}),class:"version-container"},[g(xe,{display:"Changelog",direction:s(Y).Down,class:"version"},{default:H(()=>[k("span",null,"v"+re(s(b)),1)]),_:1},8,["direction"])]),Yo,k("div",Jo,[k("span",{onClick:p,class:"material-icons"},"discord"),k("ul",Ko,[s(f)?(I(),T("li",Xo,[k("a",{href:s(f),target:"_blank"},re(s(c)),9,Qo)])):j("",!0),el,tl])]),k("div",null,[k("a",nl,[g(xe,{display:"Forums",direction:s(Y).Down,yoffset:"5px"},{default:H(()=>[il]),_:1},8,["direction"])])]),k("div",{onClick:C[1]||(C[1]=_=>{var N;return(N=t.value)==null?void 0:N.open()})},[g(xe,{display:"Info",direction:s(Y).Down,class:"info"},{default:H(()=>[rl]),_:1},8,["direction"])]),k("div",{onClick:C[2]||(C[2]=_=>{var N;return(N=n.value)==null?void 0:N.open()})},[g(xe,{display:"Saves",direction:s(Y).Down,xoffset:"-20px"},{default:H(()=>[al]),_:1},8,["direction"])]),k("div",{onClick:C[3]||(C[3]=_=>{var N;return(N=i.value)==null?void 0:N.open()})},[g(xe,{display:"Settings",direction:s(Y).Down,xoffset:"-66px"},{default:H(()=>[sl]),_:1},8,["direction"])])],16)):(I(),T("div",Pt({key:1,class:"overlay-nav"},w.$attrs),[k("div",{onClick:C[4]||(C[4]=_=>{var N;return(N=r.value)==null?void 0:N.open()}),class:"version-container"},[g(xe,{display:"Changelog",direction:s(Y).Right,xoffset:"25%",class:"version"},{default:H(()=>[k("span",null,"v"+re(s(b)),1)]),_:1},8,["direction"])]),k("div",{onClick:C[5]||(C[5]=_=>{var N;return(N=n.value)==null?void 0:N.open()})},[g(xe,{display:"Saves",direction:s(Y).Right},{default:H(()=>[ol]),_:1},8,["direction"])]),k("div",{onClick:C[6]||(C[6]=_=>{var N;return(N=i.value)==null?void 0:N.open()})},[g(xe,{display:"Settings",direction:s(Y).Right},{default:H(()=>[ll]),_:1},8,["direction"])]),k("div",{onClick:C[7]||(C[7]=_=>{var N;return(N=t.value)==null?void 0:N.open()})},[g(xe,{display:"Info",direction:s(Y).Right},{default:H(()=>[ul]),_:1},8,["direction"])]),k("div",null,[k("a",cl,[g(xe,{display:"Forums",direction:s(Y).Right,xoffset:"7px"},{default:H(()=>[dl]),_:1},8,["direction"])])]),k("div",fl,[k("span",{onClick:p,class:"material-icons"},"discord"),k("ul",pl,[s(f)?(I(),T("li",gl,[k("a",{href:s(f),target:"_blank"},re(s(c)),9,ml)])):j("",!0),vl,hl])])],16)),g(Js,{ref_key:"info",ref:t,changelog:r.value},null,8,["changelog"]),g(_r,{ref_key:"savesManager",ref:n},null,512),g(lo,{ref_key:"options",ref:i},null,512),g(Ts,{ref_key:"changelog",ref:r},null,512)],64))}});var Nr=me(bl,[["__scopeId","data-v-318a1c31"]]);const yl={class:"inner-tab"},wl=X({__name:"Game",setup(e){const t=Kt(K,"tabs"),n=S(()=>Object.keys(Ce)),i=ge.useHeader;function r(a){const{display:l,minimized:u,name:c,color:f,minimizable:b,nodes:p,minimizedDisplay:w}=a;return{display:l,minimized:u,name:c,color:f,minimizable:b,nodes:p,minimizedDisplay:w}}return(a,l)=>(I(),T("div",{class:be(["tabs-container",{useHeader:s(i)}])},[(I(!0),T(ae,null,Nn(s(t),(u,c)=>{var f,b;return I(),T("div",{key:c,class:be(["tab",s((f=s(Ce)[u])==null?void 0:f.classes)]),style:Ue(s((b=s(Ce)[u])==null?void 0:b.style))},[c===0&&!s(i)?(I(),ne(Nr,{key:0})):j("",!0),k("div",yl,[s(n).includes(u)?(I(),ne(Is,Pt({key:0},r(s(Ce)[u]),{index:c,onSetMinimized:p=>s(Ce)[u].minimized.value=p}),null,16,["index","onSetMinimized"])):(I(),ne(Le(u),{key:1,index:c},null,8,["index"]))])],6)}),128))],2))}});var _l=me(wl,[["__scopeId","data-v-dcd207b4"]]);const Nl=X({__name:"Sticky",setup(e){const t=B("0"),n=new ResizeObserver(r),i=it(null);function r(){let a=i.value;if(a==null)return;let l=0;for(;a.previousSibling;){const u=a.previousSibling;u.dataset&&"vSticky"in u.dataset&&(l+=u.offsetHeight),a=u}t.value=l+"px"}return Dt(r),document.fonts.ready.then(r),ai(()=>{var l;const a=(l=i.value)==null?void 0:l.parentElement;a&&n.observe(a)}),(a,l)=>(I(),T("div",{class:"sticky",style:Ue({top:t.value}),ref_key:"element",ref:i,"data-v-sticky":""},[Tt(a.$slots,"default",{},void 0,!0)],4))}});var ni=me(Nl,[["__scopeId","data-v-cccac690"]]);const Cl=["x1","y1","x2","y2"],kl=X({__name:"BoardLink",props:{link:null},setup(e){const n=Ee(e),i=S(()=>{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=S(()=>{const a=n.link.value.endNode.position;return n.link.value.offsetEnd&&(a.x+=s(n.link.value.offsetEnd).x,a.y+=s(n.link.value.offsetEnd).y),a});return(a,l)=>(I(),T("line",Pt({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,Cl))}});var Ml=me(kl,[["__scopeId","data-v-57c4970a"]]);const Sl={key:0},Il=["transform","onMousedown","onTouchstart","onMouseup","onTouchend"],xl=["fill","stroke-width","stroke"],$l=["fill"],El=X({__name:"BoardNodeAction",props:{node:null,nodeType:null,actions:null,isSelected:{type:Boolean},selectedAction:null},emits:["clickAction"],setup(e,{emit:t}){const i=Ee(e),r=S(()=>pe(i.nodeType.value.size,s(i.node))),a=S(()=>{var b;return(b=pe(i.nodeType.value.outlineColor,s(i.node)))!=null?b:bt[oe.theme].variables["--outline"]}),l=S(()=>{var b;return(b=pe(i.nodeType.value.titleColor,s(i.node)))!=null?b:bt[oe.theme].variables["--foreground"]}),u=S(()=>pe(i.nodeType.value.actionDistance,s(i.node)));function c(b,p){t("clickAction",p.id),b.preventDefault(),b.stopPropagation()}function f(b,p){var w;((w=s(i.selectedAction))==null?void 0:w.id)===p.id&&(b.preventDefault(),b.stopPropagation())}return(b,p)=>(I(),ne(_n,{name:"actions",appear:""},{default:H(()=>[e.isSelected&&e.actions?(I(),T("g",Sl,[(I(!0),T(ae,null,Nn(e.actions,(w,C)=>{var _,N;return I(),T("g",{key:w.id,class:be(["action",{selected:((_=e.selectedAction)==null?void 0:_.id)===w.id}]),transform:`translate(
${(-s(r)-30)*Math.sin(((e.actions.length-1)/2-C)*s(u))},
${(s(r)+30)*Math.cos(((e.actions.length-1)/2-C)*s(u))}
)`,onMousedown:E=>c(E,w),onTouchstart:E=>c(E,w),onMouseup:E=>f(E,w),onTouchend:wn(E=>f(E,w),["stop"])},[k("circle",{fill:s(pe)(w.fillColor,e.node),r:"20","stroke-width":((N=e.selectedAction)==null?void 0:N.id)===w.id?4:0,stroke:s(a)},null,8,xl),k("text",{fill:s(l),class:"material-icons"},re(s(pe)(w.icon,e.node)),9,$l)],42,Il)}),128))])):j("",!0)]),_:1}))}});var Tl=me(El,[["__scopeId","data-v-9efb2a56"]]);const Dl=["transform"],Pl={key:0},Fl=["r","fill","stroke"],Al=["r","fill","stroke"],Ol=["r","fill"],Rl=["r","stroke-dasharray","stroke-dashoffset","stroke"],ql={key:1,transform:"rotate(45, 0, 0)"},Vl=["width","height","transform","fill","stroke"],Ll=["width","height","transform","fill","stroke"],Bl=["width","height","transform","fill"],jl=["width","height","transform","stroke-dasharray","stroke-dashoffset","stroke"],zl=["fill","y"],Ul=["fill"],Gl={key:0},Wl=["fill","y"],Hl=["fill","y"],Zl=X({__name:"BoardNode",props:{node:null,nodeType:null,dragging:null,dragged:null,hasDragged:{type:Boolean},receivingNode:{type:Boolean},selectedNode:null,selectedAction:null},emits:["mouseDown","endDragging","clickAction"],setup(e,{emit:t}){const n=e,i=Math.sqrt(2),r=Ee(n),a=S(()=>s(r.selectedNode)===s(r.node)),l=S(()=>pe(r.nodeType.value.draggable,s(r.node)));nt(l,W=>{const ye=s(r.node);s(r.dragging)===ye&&!W&&t("endDragging",ye)});const u=S(()=>{var ye;const W=s(r.node);return(ye=pe(r.nodeType.value.actions,W))==null?void 0:ye.filter(ce=>at(pe(ce.visibility,W)))}),c=S(()=>{var ye;const W=s(r.node);if(pe(r.nodeType.value.draggable,W)&&((ye=s(r.dragging))==null?void 0:ye.id)===W.id&&s(r.dragged)!=null){const{x:ce,y:fe}=s(r.dragged);return{x:W.position.x+Math.round(ce/25)*25,y:W.position.y+Math.round(fe/25)*25}}return W.position}),f=S(()=>pe(r.nodeType.value.shape,s(r.node))),b=S(()=>pe(r.nodeType.value.title,s(r.node))),p=S(()=>pe(r.nodeType.value.subtitle,s(r.node))),w=S(()=>{var W;return(W=a.value?s(r.selectedAction)&&pe(s(r.selectedAction).tooltip,s(r.node)):null)!=null?W:pe(r.nodeType.value.label,s(r.node))}),C=S(()=>{var W,ye;return pe((ye=(W=s(r.selectedAction))==null?void 0:W.confirmationLabel)!=null?ye:{text:"Tap again to confirm"},s(r.node))}),_=S(()=>pe(r.nodeType.value.size,s(r.node))),N=S(()=>{var W;return(W=pe(r.nodeType.value.progress,s(r.node)))!=null?W:0}),E=S(()=>bt[oe.theme].variables["--background"]),R=S(()=>{var W;return(W=pe(r.nodeType.value.outlineColor,s(r.node)))!=null?W:bt[oe.theme].variables["--outline"]}),$=S(()=>{var W;return(W=pe(r.nodeType.value.fillColor,s(r.node)))!=null?W:bt[oe.theme].variables["--raised-background"]}),D=S(()=>pe(r.nodeType.value.progressColor,s(r.node))),U=S(()=>{var W;return(W=pe(r.nodeType.value.titleColor,s(r.node)))!=null?W:bt[oe.theme].variables["--foreground"]}),he=S(()=>pe(r.nodeType.value.progressDisplay,s(r.node))),ie=S(()=>r.dragging.value!=null&&s(r.hasDragged)&&pe(r.nodeType.value.canAccept,s(r.node),r.dragging.value)),J=S(()=>pe(r.nodeType.value.style,s(r.node))),Q=S(()=>pe(r.nodeType.value.classes,s(r.node)));function z(W){t("mouseDown",W,r.node.value,l.value)}function de(W){var ye,ce,fe;(ye=r.hasDragged)!=null&&ye.value||(t("endDragging",r.node.value),(fe=(ce=r.nodeType.value).onClick)==null||fe.call(ce,r.node.value),W.stopPropagation())}return(W,ye)=>{var ce,fe,Te;return I(),T("g",{class:be(["boardnode",{[e.node.type]:!0,isSelected:s(a),isDraggable:s(l),...s(Q)}]),style:Ue([{opacity:((ce=e.dragging)==null?void 0:ce.id)===e.node.id&&e.hasDragged?.5:1},(fe=s(J))!=null?fe:[]]),transform:`translate(${s(c).x},${s(c).y})${s(a)?" scale(1.2)":""}`},[g(Tl,{actions:(Te=s(u))!=null?Te:[],"is-selected":s(a),node:e.node,"node-type":e.nodeType,"selected-action":e.selectedAction,onClickAction:ye[0]||(ye[0]=He=>t("clickAction",He))},null,8,["actions","is-selected","node","node-type","selected-action"]),k("g",{class:"node-container",onMousedown:z,onTouchstartPassive:z,onMouseup:de,onTouchendPassive:de},[s(f)===s(Ve).Circle?(I(),T("g",Pl,[s(ie)?(I(),T("circle",{key:0,class:"receiver",r:s(_)+8,fill:s(E),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Fl)):j("",!0),k("circle",{class:"body",r:s(_),fill:s($),stroke:s(R),"stroke-width":4},null,8,Al),s(he)===s(ln).Fill?(I(),T("circle",{key:1,class:"progress progressFill",r:Math.max(s(_)*s(N)-2,0),fill:s(D)},null,8,Ol)):(I(),T("circle",{key:2,r:s(_)+4.5,class:"progress progressRing",fill:"transparent","stroke-dasharray":(s(_)+4.5)*2*Math.PI,"stroke-width":5,"stroke-dashoffset":(s(_)+4.5)*2*Math.PI-s(N)*(s(_)+4.5)*2*Math.PI,stroke:s(D)},null,8,Rl))])):s(f)===s(Ve).Diamond?(I(),T("g",ql,[s(ie)?(I(),T("rect",{key:0,class:"receiver",width:s(_)*s(i)+16,height:s(_)*s(i)+16,transform:`translate(${-(s(_)*s(i)+16)/2}, ${-(s(_)*s(i)+16)/2})`,fill:s(E),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Vl)):j("",!0),k("rect",{class:"body",width:s(_)*s(i),height:s(_)*s(i),transform:`translate(${-s(_)*s(i)/2}, ${-s(_)*s(i)/2})`,fill:s($),stroke:s(R),"stroke-width":4},null,8,Ll),s(he)===s(ln).Fill?(I(),T("rect",{key:1,class:"progress progressFill",width:Math.max(s(_)*s(i)*s(N)-2,0),height:Math.max(s(_)*s(i)*s(N)-2,0),transform:`translate(${-Math.max(s(_)*s(i)*s(N)-2,0)/2}, ${-Math.max(s(_)*s(i)*s(N)-2,0)/2})`,fill:s(D)},null,8,Bl)):(I(),T("rect",{key:2,class:"progress progressDiamond",width:s(_)*s(i)+9,height:s(_)*s(i)+9,transform:`translate(${-(s(_)*s(i)+9)/2}, ${-(s(_)*s(i)+9)/2})`,fill:"transparent","stroke-dasharray":(s(_)*s(i)+9)*4,"stroke-width":5,"stroke-dashoffset":(s(_)*s(i)+9)*4-s(N)*(s(_)*s(i)+9)*4,stroke:s(D)},null,8,jl))])):j("",!0),k("text",{fill:s(U),class:"node-title",y:s(p)?10:0},re(s(b)),9,zl),s(p)?(I(),T("text",{key:2,fill:s(U),class:"node-subtitle",y:"-15"},re(s(p)),9,Ul)):j("",!0)],32),g(_n,{name:"fade",appear:""},{default:H(()=>{var He;return[s(w)?(I(),T("g",Gl,[k("text",{fill:(He=s(w).color)!=null?He:s(U),class:be(["node-title",{pulsing:s(w).pulsing}]),y:-s(_)-20},re(s(w).text),11,Wl)])):j("",!0)]}),_:1}),g(_n,{name:"fade",appear:""},{default:H(()=>{var He;return[s(a)&&e.selectedAction?(I(),T("text",{key:0,fill:(He=s(C).color)!=null?He:s(U),class:be(["node-title",{pulsing:s(C).pulsing}]),y:s(_)+75},re(s(C).text),11,Hl)):j("",!0)]}),_:1})],14,Dl)}}});var Yl=me(Zl,[["__scopeId","data-v-4654be02"]]);const Jl={class:"stage",width:"100%",height:"100%"},Kl={class:"g1"},Xl=X({__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=Ee(e),i=B({x:0,y:0}),r=B({x:0,y:0}),a=B(!1),l=B(null),u=S(()=>{const C=n.nodes.value.slice();if(n.draggingNode.value){const _=C.splice(C.indexOf(n.draggingNode.value),1)[0];C.push(_)}return C});pt(()=>{const C=n.draggingNode.value;if(C==null)return null;const _={x:C.position.x+r.value.x,y:C.position.y+r.value.y};let N=Number.MAX_VALUE;n.setReceivingNode.value(n.nodes.value.reduce((E,R)=>{if(R.id===C.id)return E;const $=n.types.value[R.type];if(!pe($.canAccept,R,C))return E;const U=Math.pow(_.x-R.position.x,2)+Math.pow(_.y-R.position.y,2);let he=pe($.size,R);return U>N||U>he*he?E:(N=U,R)},null))});function c(C){C.setTransformOrigin(null),C.moveTo(l.value.$el.clientWidth/2,l.value.$el.clientHeight/2)}function f(C,_=null,N=!1){if(n.draggingNode.value==null){C.preventDefault(),C.stopPropagation();let E,R;if("touches"in C)if(C.touches.length===1)E=C.touches[0].clientX,R=C.touches[0].clientY;else return;else E=C.clientX,R=C.clientY;i.value={x:E,y:R},r.value={x:0,y:0},a.value=!1,N&&n.setDraggingNode.value(_)}_!=null&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function b(C){const{x:_,y:N,scale:E}=l.value.panZoomInstance.getTransform();let R,$;if("touches"in C)if(C.touches.length===1)R=C.touches[0].clientX,$=C.touches[0].clientY;else{p(n.draggingNode.value),n.mousePosition.value=null;return}else R=C.clientX,$=C.clientY;n.mousePosition.value={x:(R-_)/E,y:($-N)/E},r.value={x:r.value.x+(R-i.value.x)/E,y:r.value.y+($-i.value.y)/E},i.value={x:R,y:$},(Math.abs(r.value.x)>10||Math.abs(r.value.y)>10)&&(a.value=!0),n.draggingNode.value!=null&&(C.preventDefault(),C.stopPropagation())}function p(C,_=!1){var N,E;if(n.draggingNode.value!=null&&n.draggingNode.value===C){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 R=n.nodes.value;R.push(R.splice(R.indexOf(n.draggingNode.value),1)[0]),n.receivingNode.value&&((E=(N=n.types.value[n.receivingNode.value.type]).onDrop)==null||E.call(N,n.receivingNode.value,n.draggingNode.value)),n.setDraggingNode.value(null)}else!a.value&&!_&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function w(C,_){n.state.value.selectedAction===_?s(n.selectedAction).onClick(s(n.selectedNode)):n.state.value={...n.state.value,selectedAction:_}}return(C,_)=>{const N=St("panZoom");return s(at)(e.visibility)?(I(),ne(N,{key:0,style:Ue([{width:e.width,height:e.height},e.style]),class:be(e.classes),selector:".g1",options:{initialZoom:1,minZoom:.1,maxZoom:10,zoomDoubleClickSpeed:1},ref_key:"stage",ref:l,onInit:c,onMousemove:b,onTouchmove:b,onMousedown:_[0]||(_[0]=E=>f(E)),onTouchstart:_[1]||(_[1]=E=>f(E)),onMouseup:_[2]||(_[2]=()=>p(s(e.draggingNode))),onTouchendPassive:_[3]||(_[3]=()=>p(s(e.draggingNode))),onMouseleave:_[4]||(_[4]=()=>p(s(e.draggingNode),!0))},{default:H(()=>[(I(),T("svg",Jl,[k("g",Kl,[g(Li,{name:"link",appear:""},{default:H(()=>[(I(!0),T(ae,null,Nn(s(e.links)||[],E=>(I(),T("g",{key:`${E.startNode.id}-${E.endNode.id}`},[g(Ml,{link:E},null,8,["link"])]))),128))]),_:1}),g(Li,{name:"grow",duration:500,appear:""},{default:H(()=>[(I(!0),T(ae,null,Nn(s(u),E=>{var R;return I(),T("g",{key:E.id,style:{"transition-duration":"0s"}},[g(Yl,{node:E,nodeType:e.types[E.type],dragging:s(e.draggingNode),dragged:s(e.draggingNode)===E?r.value:void 0,hasDragged:a.value,receivingNode:((R=s(e.receivingNode))==null?void 0:R.id)===E.id,selectedNode:s(e.selectedNode),selectedAction:s(e.selectedAction),onMouseDown:f,onEndDragging:p,onClickAction:$=>w(E,$)},null,8,["node","nodeType","dragging","dragged","hasDragged","receivingNode","selectedNode","selectedAction","onClickAction"])])}),128))]),_:1})])]))]),_:1},8,["style","class","options"])):j("",!0)}}});Ge.on("setupVue",e=>Yr.install(e));const Cr=Symbol("Board");var ln=(e=>(e.Outline="Outline",e.Fill="Fill",e))(ln||{}),Ve=(e=>(e.Circle="Circle",e.Diamond="Triangle",e))(Ve||{});function Ql(e){const t=tt({nodes:[],selectedNode:null,selectedAction:null},!1);return We(n=>{const i=e.call(n,n);i.id=kn("board-"),i.type=Cr,i[gt]=Xl,i.state?(vr(t),P(i,"state")):(t[Cn]={nodes:i.startNodes().map((u,c)=>(u.id=c,u)),selectedNode:null,selectedAction:null},i.state=t),i.nodes=S(()=>s(l.state).nodes),i.selectedNode=S({get(){return l.nodes.value.find(u=>u.id===s(l.state).selectedNode)||null},set(u){var c,f;De(l.state)?l.state.value={...l.state.value,selectedNode:(c=u==null?void 0:u.id)!=null?c:null}:l.state.selectedNode=(f=u==null?void 0:u.id)!=null?f:null}}),i.selectedAction=S({get(){const u=l.selectedNode.value;if(u==null)return null;const c=l.types[u.type];return c.actions==null?null:c.actions.find(f=>f.id===s(l.state).selectedAction)||null},set(u){var c,f;De(l.state)?l.state.value={...l.state.value,selectedAction:(c=u==null?void 0:u.id)!=null?c:null}:l.state.selectedAction=(f=u==null?void 0:u.id)!=null?f:null}}),i.mousePosition=B(null),i.links?P(i,"links"):i.links=S(()=>l.selectedAction.value==null?null:l.selectedAction.value.links&&l.selectedNode.value?pe(l.selectedAction.value.links,l.selectedNode.value):null),i.draggingNode=B(null),i.receivingNode=B(null),P(i,"visibility"),se(i,"visibility",ke.Visible),P(i,"width"),se(i,"width","100%"),P(i,"height"),se(i,"height","100%"),P(i,"classes"),P(i,"style");for(const u in i.types){const c=i.types[u];if(P(c,"title"),P(c,"subtitle"),P(c,"label"),P(c,"size"),se(c,"size",50),P(c,"style"),P(c,"classes"),P(c,"draggable"),se(c,"draggable",!1),P(c,"shape"),se(c,"shape","Circle"),P(c,"canAccept"),se(c,"canAccept",!1),P(c,"progress"),P(c,"progressDisplay"),se(c,"progressDisplay","Fill"),P(c,"progressColor"),se(c,"progressColor","none"),P(c,"fillColor"),P(c,"outlineColor"),P(c,"titleColor"),P(c,"actionDistance"),se(c,"actionDistance",Math.PI/6),c.nodes=S(()=>s(l.state).nodes.filter(f=>f.type===u)),se(c,"onClick",function(f){s(l.state).selectedNode=f.id}),c.actions)for(const f of c.actions)P(f,"visibility"),se(f,"visibility",ke.Visible),P(f,"icon"),P(f,"fillColor"),P(f,"tooltip"),P(f,"confirmationLabel"),se(f,"confirmationLabel",{text:"Tap again to confirm"}),P(f,"links")}function r(u){i.draggingNode.value=u}function a(u){i.receivingNode.value=u}i.placeInAvailableSpace=function(u,c=100,f=Y.Right){const b=l.nodes.value.slice().filter(p=>p===u||(f===Y.Down||f===Y.Up)&&Math.abs(p.position.x-u.position.x)>c||(f===Y.Left||f===Y.Right)&&Math.abs(p.position.y-u.position.y)>c?!1:!(f===Y.Right&&p.position.x<u.position.x-c||f===Y.Left&&p.position.x>u.position.x+c||f===Y.Up&&p.position.y>u.position.y+c||f===Y.Down&&p.position.y<u.position.y-c)).sort(f===Y.Right?(p,w)=>p.position.x-w.position.x:f===Y.Left?(p,w)=>w.position.x-p.position.x:f===Y.Up?(p,w)=>w.position.y-p.position.y:(p,w)=>p.position.y-w.position.y);for(let p=0;p<b.length;p++){const w=b[p],C=f===Y.Right||f===Y.Left?Math.abs(u.position.x-w.position.x):Math.abs(u.position.y-w.position.y);if(C<c)f===Y.Right?u.position.x=w.position.x+c:f===Y.Left?u.position.x=w.position.x-c:f===Y.Up?u.position.y=w.position.y-c:f===Y.Down&&(u.position.y=w.position.y+c);else if(p>0&&C>c)break}},i[rt]=function(){const{nodes:u,types:c,state:f,visibility:b,width:p,height:w,style:C,classes:_,links:N,selectedAction:E,selectedNode:R,mousePosition:$,draggingNode:D,receivingNode:U}=this;return{nodes:u,types:c,state:f,visibility:b,width:p,height:w,style:s(C),classes:_,links:N,selectedAction:E,selectedNode:R,mousePosition:$,draggingNode:D,receivingNode:U,setDraggingNode:r,setReceivingNode:a}};const l=i;return l})}function pe(e,t,...n){return Qn(e)?e(t,...n):s(e)}function qn(e){let t=0;return e.nodes.value.forEach(n=>{n.id>=t&&(t=n.id+1)}),t}const An={};Ge.on("addLayer",e=>{const t=ki(e,Cr);An[e.id]=e.on("postUpdate",n=>{t.forEach(i=>{Object.values(i.types).forEach(r=>r.nodes.value.forEach(a=>{var l;return(l=r.update)==null?void 0:l.call(r,a,n)}))})})});Ge.on("removeLayer",e=>{var t;(t=An[e.id])==null||t.call(An),An[e.id]=void 0});function Si(e,t="points",n=0,i=void 0){const r=De(e)?e:tt(e);if(r.displayName=t,r.precision=n,r.small=i,!De(e)){const a=r[kt];a.displayName=t,a.precision=n,a.small=i}return r}new o("10^^8");new o("1e100");function ii(e,t){const n=t!=null?t:e.value;return o.eq(e.precision,0)?je(e.small?n:o.floor(n)):cn(n,e.precision,e.small)}Ge.on("setupVue",e=>e.use(Jr));function eu(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 tu=X({props:{visibility:{type:L(Number,Boolean),required:!0},display:{type:L(Object,String,Function),required:!0},style:L(String,Object,Array),classes:L(Object),glowColor:L(String),active:Boolean,floating:Boolean},emits:["selectTab"],setup(e,{emit:t}){const{display:n,glowColor:i,floating:r}=Ee(e),a=gr(n),l=S(()=>{const c=Ae(i);return c==null||c===""?{}:s(r)?eu(c):{boxShadow:`0px 9px 5px -6px ${c}`}});function u(){t("selectTab")}return{selectTab:u,component:a,glowColorStyle:l,unref:s,Visibility:ke,isVisible:at,isHidden:Mn}}});function nu(e,t,n,i,r,a){var l;return e.isVisible(e.visibility)?(I(),T("button",{key:0,onClick:t[0]||(t[0]=(...u)=>e.selectTab&&e.selectTab(...u)),class:be(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:Ue([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(l=e.unref(e.style))!=null?l:{}])},[(I(),ne(Le(e.component)))],6)):j("",!0)}var kr=me(tu,[["render",nu],["__scopeId","data-v-21427abb"]]);const iu=X({props:{visibility:{type:L(Number,Boolean),required:!0},activeTab:{type:L(Object),required:!0},selected:{type:Object,required:!0},tabs:{type:L(Object),required:!0},style:L(String,Object,Array),classes:L(Object),buttonContainerStyle:L(String,Object,Array),buttonContainerClasses:L(Object)},components:{Sticky:ni,TabButton:kr},setup(e){const{activeTab:t}=Ee(e),n=S(()=>bt[oe.theme].floatingTabs),i=it("");pt(()=>{const u=Ae(t);if(u==null){i.value="";return}if(yt(u)){i.value=le(u);return}i.value=le(s(u.display))});const r=S(()=>{const u=Ae(t);return yt(u)||!u?void 0:s(u.classes)}),a=S(()=>{const u=Ae(t);return yt(u)||!u?void 0:s(u.style)});function l(u){const{display:c,style:f,classes:b,glowColor:p,visibility:w}=u;return{display:c,style:s(f),classes:b,glowColor:p,visibility:w}}return{floating:n,tabClasses:r,tabStyle:a,Visibility:ke,component:i,gatherButtonProps:l,unref:s,isVisible:at,isHidden:Mn}}});function ru(e,t,n,i,r,a){var c,f;const l=St("TabButton"),u=St("Sticky");return e.isVisible(e.visibility)?(I(),T("div",{key:0,class:be(["tab-family-container",{...e.unref(e.classes),...e.tabClasses}]),style:Ue([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[],(f=e.tabStyle)!=null?f:[]])},[g(u,{class:be(["tab-buttons-container",e.unref(e.buttonContainerClasses)]),style:Ue(e.unref(e.buttonContainerStyle))},{default:H(()=>[k("div",{class:be(["tab-buttons",{floating:e.floating}])},[(I(!0),T(ae,null,Nn(e.unref(e.tabs),(b,p)=>(I(),ne(l,Pt({onSelectTab:w=>e.selected.value=p,floating:e.floating,key:p,active:e.unref(b.tab)===e.unref(e.activeTab)},e.gatherButtonProps(b)),null,16,["onSelectTab","floating","active"]))),128))],2)]),_:1},8,["class","style"]),e.unref(e.activeTab)?(I(),ne(Le(e.unref(e.component)),{key:0})):j("",!0)],6)):j("",!0)}var au=me(iu,[["render",ru],["__scopeId","data-v-58dbf83a"]]);const su=Symbol("TabButton"),ou=Symbol("TabFamily");function lu(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=tt(Object.keys(e)[0],!1);return We(i=>{var l;const r=(l=t==null?void 0:t.call(i,i))!=null?l:{};r.id=kn("tabFamily-"),r.type=ou,r[gt]=au,r.tabs=Object.keys(e).reduce((u,c)=>{const f=e[c]();return f.type=su,f[gt]=kr,P(f,"visibility"),se(f,"visibility",ke.Visible),P(f,"tab"),P(f,"display"),P(f,"classes"),P(f,"style"),P(f,"glowColor"),u[c]=f,u},{}),r.selected=n,r.activeTab=S(()=>{const u=s(a.tabs);if(n.value in u&&at(u[n.value].visibility))return s(u[n.value].tab);const c=Object.values(u).find(f=>at(f.visibility));return c?s(c.tab):null}),P(r,"visibility"),se(r,"visibility",ke.Visible),P(r,"classes"),P(r,"style"),P(r,"buttonContainerClasses"),P(r,"buttonContainerStyle"),r[rt]=function(){const{visibility:u,activeTab:c,selected:f,tabs:b,style:p,classes:w,buttonContainerClasses:C,buttonContainerStyle:_}=this;return{visibility:u,activeTab:c,selected:f,tabs:b,style:s(p),classes:w,buttonContainerClasses:C,buttonContainerStyle:_}};const a=r;return a})}const Mr=o.ln(10);function On(e){return e}function uu(e,t){if(F(t))return t.invert(o.neg(e));throw new Error("Could not invert due to no input being a variable")}function cu(e,t){if(F(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 du(e){return m.neg(e)}function fu(e,t,n){if(F(t))return t.invert(o.sub(e,Ne(n)));if(F(n))return n.invert(o.sub(e,Ne(t)));throw new Error("Could not invert due to no input being a variable")}function pu(e,t,n){var i,r;if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=t.getIntegralFormula(e);return m.times(n,(i=t.innermostVariable)!=null?i:0).add(a)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=n.getIntegralFormula(e);return 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 gu(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.add(i,n)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return m.add(i,t)}throw new Error("Could not integrate due to no input being a variable")}function mu(e,t,n){if(F(t))return t.invert(o.add(e,Ne(n)));if(F(n))return n.invert(o.sub(Ne(t),e));throw new Error("Could not invert due to no input being a variable")}function vu(e,t,n){var i,r;if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=t.getIntegralFormula(e);return m.sub(a,m.times(n,(i=t.innermostVariable)!=null?i:0))}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=n.getIntegralFormula(e);return 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 hu(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.sub(i,n)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return m.sub(i,t)}throw new Error("Could not integrate due to no input being a variable")}function bu(e,t,n){if(F(t))return t.invert(o.div(e,Ne(n)));if(F(n))return n.invert(o.div(e,Ne(t)));throw new Error("Could not invert due to no input being a variable")}function yu(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.times(i,n)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return m.times(i,t)}throw new Error("Could not integrate due to no input being a variable")}function wu(e,t,n){if(F(t))return m.div(e,n);if(F(n))return m.div(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function _u(e,t,n){if(F(t))return t.invert(o.mul(e,Ne(n)));if(F(n))return n.invert(o.div(Ne(t),e));throw new Error("Could not invert due to no input being a variable")}function Nu(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.div(i,n)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return m.div(t,i)}throw new Error("Could not integrate due to no input being a variable")}function Cu(e,t,n){if(F(t))return m.mul(e,n);if(F(n))return m.mul(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function ku(e,t){if(F(t))return t.invert(o.recip(e));throw new Error("Could not invert due to no input being a variable")}function Mu(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.ln(n)}throw new Error("Could not integrate due to no input being a variable")}function Su(e,t){if(F(t))return t.invert(o.pow10(e));throw new Error("Could not invert due to no input being a variable")}function Iu(e){return o.ln(e).sub(1).times(e).div(Mr)}function xu(e,t){if(F(t)){const n=Mr.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 $u(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new m({inputs:[t.getIntegralFormula(e)],evaluate:Iu,invert:xu})}throw new Error("Could not integrate due to no input being a variable")}function Eu(e,t,n){if(F(t))return t.invert(o.pow(Ne(n),e));if(F(n))return n.invert(o.root(Ne(t),e));throw new Error("Could not invert due to no input being a variable")}function Tu(e,t){return o.ln(e).sub(1).times(e).div(o.ln(t))}function Du(e,t,n){if(F(t)){const i=o.ln(Ne(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 Pu(e,t,n){if(F(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:Tu,invert:Du})}throw new Error("Could not integrate due to no input being a variable")}function Fu(e,t){if(F(t))return t.invert(o.pow(2,e));throw new Error("Could not invert due to no input being a variable")}function Au(e){return o.ln(e).sub(1).times(e).div(o.ln(2))}function Ou(e,t){if(F(t)){const n=o.ln(2).times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}throw new Error("Could not invert due to no input being a variable")}function Ru(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new m({inputs:[t.getIntegralFormula(e)],evaluate:Au,invert:Ou})}throw new Error("Could not integrate due to no input being a variable")}function qu(e,t){if(F(t))return t.invert(o.exp(e));throw new Error("Could not invert due to no input being a variable")}function Vu(e){return o.ln(e).sub(1).times(e)}function Lu(e,t){if(F(t))return t.invert(o.div(e,o.div(e,Math.E).lambertw()));throw new Error("Could not invert due to no input being a variable")}function Bu(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new m({inputs:[t.getIntegralFormula(e)],evaluate:Vu,invert:Lu})}throw new Error("Could not integrate due to no input being a variable")}function ju(e,t,n){if(F(t))return t.invert(o.root(e,Ne(n)));if(F(n))return n.invert(o.ln(e).div(o.ln(Ne(t))));throw new Error("Could not invert due to no input being a variable")}function zu(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e),r=m.add(n,1);return m.pow(i,r).div(r)}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return m.pow(t,i).div(m.ln(t))}throw new Error("Could not integrate due to no input being a variable")}function Uu(e,t){if(F(t))return t.invert(o.root(e,10));throw new Error("Could not invert due to no input being a variable")}function Gu(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.pow10(n).div(m.ln(10))}throw new Error("Could not integrate due to no input being a variable")}function Wu(e,t,n){if(F(t))return t.invert(o.ln(e).div(Ne(n)));if(F(n))return n.invert(o.root(Ne(t),e));throw new Error("Could not invert due to no input being a variable")}function Hu(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return m.pow(n,i).div(m.ln(n))}else if(F(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e),r=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 Zu(e,t,n){if(F(t))return t.invert(o.root(e,o.recip(Ne(n))));if(F(n))return n.invert(o.ln(Ne(t)).div(o.ln(e)));throw new Error("Could not invert due to no input being a variable")}function Yu(e,t,n){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return 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 Ju(e,t){if(F(t))return t.invert(o.ln(e));throw new Error("Could not invert due to no input being a variable")}function Ku(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.exp(n)}throw new Error("Could not integrate due to no input being a variable")}function Xu(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const i=o.minabs(t,1e308).toNumber();return o.tetrate(e,i,n)}function Qu(e,t,n,i){if(F(t))return t.invert(o.ssqrt(e));throw new Error("Could not invert due to no input being a variable")}function ec(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 tc(e,t,n,i){if(F(t))return t.invert(o.iteratedlog(e,Math.E,o.minabs(1e308,Ne(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function nc(e,t=10,n=2){const i=o.minabs(n,1e308).toNumber();return o.iteratedlog(e,t,i)}function ic(e,t=10){const n=o.minabs(t,1e308).toNumber();return o.slog(e,n)}function rc(e,t,n){if(F(t))return t.invert(o.tetrate(e,o.minabs(1e308,Ne(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function ac(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.layeradd(e,i,n)}function sc(e,t,n,i){if(F(t))return t.invert(o.layeradd(e,o.minabs(1e308,Ne(n)).negate().toNumber()));throw new Error("Could not invert due to no input being a variable")}function oc(e,t){if(F(t))return t.invert(o.pow(Math.E,e).times(e));throw new Error("Could not invert due to no input being a variable")}function lc(e,t){if(F(t))return t.invert(o.tetrate(e,2));throw new Error("Could not invert due to no input being a variable")}function uc(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.pentate(e,i,n)}function cc(e,t){if(F(t))return t.invert(o.asin(e));throw new Error("Could not invert due to no input being a variable")}function dc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.cos(n).neg()}throw new Error("Could not integrate due to no input being a variable")}function fc(e,t){if(F(t))return t.invert(o.acos(e));throw new Error("Could not invert due to no input being a variable")}function pc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.sin(n)}throw new Error("Could not integrate due to no input being a variable")}function gc(e,t){if(F(t))return t.invert(o.atan(e));throw new Error("Could not invert due to no input being a variable")}function mc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.cos(n).ln().neg()}throw new Error("Could not integrate due to no input being a variable")}function vc(e,t){if(F(t))return t.invert(o.sin(e));throw new Error("Could not invert due to no input being a variable")}function hc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return 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 bc(e,t){if(F(t))return t.invert(o.cos(e));throw new Error("Could not invert due to no input being a variable")}function yc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return 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 wc(e,t){if(F(t))return t.invert(o.tan(e));throw new Error("Could not invert due to no input being a variable")}function _c(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return 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 Nc(e,t){if(F(t))return t.invert(o.asinh(e));throw new Error("Could not invert due to no input being a variable")}function Cc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.cosh(n)}throw new Error("Could not integrate due to no input being a variable")}function kc(e,t){if(F(t))return t.invert(o.acosh(e));throw new Error("Could not invert due to no input being a variable")}function Mc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.sinh(n)}throw new Error("Could not integrate due to no input being a variable")}function Sc(e,t){if(F(t))return t.invert(o.atanh(e));throw new Error("Could not invert due to no input being a variable")}function Ic(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return m.cosh(n).ln()}throw new Error("Could not integrate due to no input being a variable")}function xc(e,t){if(F(t))return t.invert(o.sinh(e));throw new Error("Could not invert due to no input being a variable")}function $c(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return 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 Ec(e,t){if(F(t))return t.invert(o.cosh(e));throw new Error("Could not invert due to no input being a variable")}function Tc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return 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 Dc(e,t){if(F(t))return t.invert(o.tanh(e));throw new Error("Could not invert due to no input being a variable")}function Pc(e,t){if(F(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return 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 Sn(e){return(t,n)=>new m({inputs:[t,n],evaluate:e,invert:On})}function F(e){return e instanceof Me&&e.hasVariable()}function Ne(e,t){return e instanceof Me?e.evaluate(t):s(e)}function Fc(){return m.pow(this,2).div(2)}function Ac(){return this}const $e=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"&&kt in n?n[kt]:n)),"variable"in e?(typeof e.variable=="object"&&kt in e.variable&&(e.variable=e.variable[kt]),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:Fc,internalIntegrateInner:Ac,applySubstitution:On}}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 w,C;const{inputs:t,evaluate:n,invert:i,integrate:r,integrateInner:a,applySubstitution:l}=e,u=t.reduce((_,N)=>_+(N instanceof $e?N.internalVariables:0),0),c=t.find(_=>_ instanceof $e&&_.hasVariable()),f=u===1?c==null?void 0:c.innermostVariable:void 0,b=(w=c==null?void 0:c.isInvertible())!=null?w:!1,p=(C=c==null?void 0:c.isIntegrable())!=null?C:!1;return{inputs:t,internalEvaluate:n,internalInvert:b?i:void 0,internalIntegrate:p?r:void 0,internalIntegrateInner:a,applySubstitution:l,innermostVariable:f,internalVariables:u}}isInvertible(){return this.hasVariable()&&(this.internalInvert!=null||this.internalEvaluate==null)}isIntegrable(){return this.hasVariable()&&this.internalIntegrate!=null}isIntegralInvertible(){return this.isIntegrable()?this.getIntegralFormula().isInvertible():!1}hasVariable(){return this.internalVariables===1}evaluate(e){var t,n,i;return(i=(n=(t=this.internalEvaluate)==null?void 0:t.call(this,...this.inputs.map(r=>Ne(r,e))))!=null?n:this.hasVariable()?e:null)!=null?i:Ne(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof $e&&e.inputs[n]instanceof $e?t.equals(e.inputs[n]):!(t instanceof $e)&&!(e.inputs[n]instanceof $e)&&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=B(0),r=n(m.variable(i)),a=_e(t);function l(c){return o.lt(c,s(a))?c:(i.value=o.sub(c,s(a)),o.add(r.evaluate(),s(a)))}function u(c,f){if(F(f)&&r.isInvertible())return o.gt(c,s(a))&&(c=o.add(r.invert(o.sub(c,s(a))),s(a))),f.invert(c);throw new Error("Could not invert due to no input being a variable")}return new m({inputs:[e],evaluate:l,invert:r.isInvertible()&&r.hasVariable()?u:void 0})}static if(e,t,n,i){const r=B(0),a=m.variable(r),l=n(a),u=i==null?void 0:i(a),c=_e(t);function f(p){return s(c)?(r.value=p,l.evaluate()):u?(r.value=p,u.evaluate()):p}function b(p,w){if(!F(w)||!l.isInvertible()||u!=null&&!u.isInvertible())throw new Error("Could not invert due to no input being a variable");return s(c)?w.invert(l.invert(p)):u?w.invert(u.invert(p)):w.invert(p)}return new m({inputs:[e],evaluate:f,invert:l.isInvertible()&&l.hasVariable()?b: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:uu,applySubstitution:du,integrate:cu})}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:fu,integrate:pu,integrateInner:gu,applySubstitution:On})}static sub(e,t){return new m({inputs:[e,t],evaluate:o.sub,invert:mu,integrate:vu,integrateInner:hu,applySubstitution:On})}static mul(e,t){return new m({inputs:[e,t],evaluate:o.mul,invert:bu,integrate:yu,applySubstitution:wu})}static div(e,t){return new m({inputs:[e,t],evaluate:o.div,invert:_u,integrate:Nu,applySubstitution:Cu})}static recip(e){return new m({inputs:[e],evaluate:o.recip,invert:ku,integrate:Mu})}static clamp(e,t,n){return new m({inputs:[e,t,n],evaluate:o.clamp,invert:On})}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:Su,integrate:$u})}static log(e,t){return new m({inputs:[e,t],evaluate:o.log,invert:Eu,integrate:Pu})}static log2(e){return new m({inputs:[e],evaluate:o.log2,invert:Fu,integrate:Ru})}static ln(e){return new m({inputs:[e],evaluate:o.ln,invert:qu,integrate:Bu})}static pow(e,t){return new m({inputs:[e,t],evaluate:o.pow,invert:ju,integrate:zu})}static pow10(e){return new m({inputs:[e],evaluate:o.pow10,invert:Uu,integrate:Gu})}static pow_base(e,t){return new m({inputs:[e,t],evaluate:o.pow_base,invert:Wu,integrate:Hu})}static root(e,t){return new m({inputs:[e,t],evaluate:o.root,invert:Zu,integrate:Yu})}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:Ju,integrate:Ku})}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:Xu,invert:Qu})}static iteratedexp(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new m({inputs:[e,t,n],evaluate:ec,invert:tc})}static iteratedlog(e,t=10,n=1){return new m({inputs:[e,t,n],evaluate:nc})}static slog(e,t=10){return new m({inputs:[e,t],evaluate:ic,invert:rc})}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:ac,invert:sc})}static lambertw(e){return new m({inputs:[e],evaluate:o.lambertw,invert:oc})}static ssqrt(e){return new m({inputs:[e],evaluate:o.ssqrt,invert:lc})}static pentate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new m({inputs:[e,t,n],evaluate:uc})}static sin(e){return new m({inputs:[e],evaluate:o.sin,invert:vc,integrate:dc})}static cos(e){return new m({inputs:[e],evaluate:o.cos,invert:bc,integrate:pc})}static tan(e){return new m({inputs:[e],evaluate:o.tan,invert:wc,integrate:mc})}static asin(e){return new m({inputs:[e],evaluate:o.asin,invert:cc,integrate:hc})}static acos(e){return new m({inputs:[e],evaluate:o.acos,invert:fc,integrate:yc})}static atan(e){return new m({inputs:[e],evaluate:o.atan,invert:gc,integrate:_c})}static sinh(e){return new m({inputs:[e],evaluate:o.sinh,invert:xc,integrate:Cc})}static cosh(e){return new m({inputs:[e],evaluate:o.cosh,invert:Ec,integrate:Mc})}static tanh(e){return new m({inputs:[e],evaluate:o.tanh,invert:Dc,integrate:Ic})}static asinh(e){return new m({inputs:[e],evaluate:o.asinh,invert:Nc,integrate:$c})}static acosh(e){return new m({inputs:[e],evaluate:o.acosh,invert:kc,integrate:Tc})}static atanh(e){return new m({inputs:[e],evaluate:o.atanh,invert:Sc,integrate:Pc})}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 Me=$e;Me.negate=$e.neg;Me.negated=$e.neg;Me.sgn=$e.sign;Me.plus=$e.add;Me.subtract=$e.sub;Me.minus=$e.sub;Me.multiply=$e.mul;Me.times=$e.mul;Me.divide=$e.div;Me.divideBy=$e.div;Me.dividedBy=$e.div;Me.reciprocal=$e.recip;Me.reciprocate=$e.recip;Me.max=Sn(o.max);Me.min=Sn(o.min);Me.minabs=Sn(o.minabs);Me.maxabs=Sn(o.maxabs);Me.clampMin=Sn(o.clampMin);Me.clampMax=Sn(o.clampMax);Me.logarithm=$e.log;class m extends Me{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 Oc(e,t,n=!0,i){const r=_e(n);return S(()=>{var l,u;let a;if(s(r)){if(!e.isIntegrable()||!e.isIntegralInvertible())throw new Error("Cannot calculate max affordable of formula with non-invertible integral");a=o.floor(e.invertIntegral(o.add(t.value,e.evaluateIntegral()))).sub((l=s(e.innermostVariable))!=null?l:0),i==null&&(i=10)}else{if(!e.isInvertible())throw new Error("Cannot calculate max affordable of non-invertible formula");a=o.floor(e.invert(t.value)),i==null&&(i=0)}if(i>0&&o.lt(Jt(e,a,!0,0),1e308)){a=a.sub(i).clampMin(0);let c=Jt(e,a,!0,0);for(;;){const f=e.evaluate(a.add((u=s(e.innermostVariable))!=null?u:0));if(o.add(c,f).lte(t.value))a=a.add(1),c=o.add(c,f);else break}}return a})}function Jt(e,t,n=!0,i){var c;const r=(c=s(e.innermostVariable))!=null?c:0;let a=o.add(t,r);const l=a;i!=null||(i=n?10:0),a=a.sub(i).clampMin(r);let u=0;if(n){if(o.gt(t,i)){if(!e.isIntegrable())throw new Error("Cannot calculate cost with spending resources of non-integrable formula");u=o.sub(e.evaluateIntegral(a),e.evaluateIntegral())}if(l.gt(1e308))return o.add(u,o.sub(l,a).times(e.evaluate(a)));for(let f=a.toNumber();f<l.toNumber();f++)u=o.add(u,e.evaluate(f))}else{if(u=e.evaluate(a),a=a.add(1),l.gt(1e308))return o.sub(l,a).add(1).times(u);for(let f=a.toNumber();f<l.toNumber();f++)u=o.add(u,e.evaluate(f))}return u}function un(e){return We(t=>{const{addend:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),l=_e(n),u=_e(i),c=r==null?void 0:_e(r);return{apply:f=>o.add(f,s(l)),invert:f=>o.sub(f,s(l)),getFormula:f=>m.add(f,l),enabled:c,description:i==null?void 0:te(()=>g("div",{class:"modifier-container"},[s(u)!=null?g("span",{class:"modifier-description"},[mt(s(u))]):null,g("span",{class:"modifier-amount",style:(a===!0?o.gt(s(l),0):o.lt(s(l),0))?"color: var(--danger)":""},[o.gte(s(l),0)?"+":"",Zt(s(l))])]))}})}function Re(e){return We(t=>{const{multiplier:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),l=_e(n),u=_e(i),c=r==null?void 0:_e(r);return{apply:f=>o.times(f,s(l)),invert:f=>o.div(f,s(l)),getFormula:f=>m.times(f,l),enabled:c,description:i==null?void 0:te(()=>g("div",{class:"modifier-container"},[s(u)!=null?g("span",{class:"modifier-description"},[mt(s(u))]):null,g("span",{class:"modifier-amount",style:(a===!0?o.gt(s(l),1):o.lt(s(l),1))?"color: var(--danger)":""},[O("\xD7"),Zt(s(l))])]))}})}function Yi(e){return We(t=>{const{exponent:n,description:i,enabled:r,supportLowNumbers:a,smallerIsBetter:l}=e.call(t,t),u=_e(n),c=_e(i),f=r==null?void 0:_e(r);return{apply:b=>{let p=b;return a&&(p=o.add(p,1)),p=o.pow(p,s(u)),a&&(p=o.sub(p,1)),p},invert:b=>{let p=b;return a&&(p=o.add(p,1)),p=o.root(p,s(u)),a&&(p=o.sub(p,1)),p},getFormula:b=>a?m.add(b,1).pow(u).sub(1):m.pow(b,u),enabled:f,description:i==null?void 0:te(()=>g("div",{class:"modifier-container"},[s(c)!=null?g("span",{class:"modifier-description"},[mt(s(c)),a?" (+1 effective)":null]):null,g("span",{class:"modifier-amount",style:(l===!0?o.gt(s(u),1):o.lt(s(u),1))?"color: var(--danger)":""},[O("^"),Zt(s(u))])]))}})}function Nt(e){return We(()=>{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)?S(()=>t.filter(n=>s(n.enabled)!==!1).length>0):void 0,description:t.some(n=>n.description!=null)?te(()=>g(ae,null,[t.filter(n=>s(n.enabled)!==!1).map(n=>s(n.description)).filter(n=>n).map(mt)])):void 0}})}const Rc={key:0},qc={key:0,class:"mark star"},Vc=["src"],Lc=X({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(I(),T("div",Rc,[e.mark===!0?(I(),T("div",qc)):(I(),T("img",{key:1,class:"mark",src:e.mark},null,8,Vc))])):j("",!0)}});var li=me(Lc,[["__scopeId","data-v-2207999f"]]);const Bc=X({__name:"Node",props:{id:null},setup(e){const n=Ee(e),i=Kn(Ei,()=>{}),r=Kn(Ti,()=>{}),a=it(null),l=S(()=>a.value&&a.value.parentElement);return nt([l,n.id],([u,c],[f,b])=>{f&&r(s(b)),u&&i(c,u)}),nr(()=>r(s(n.id))),(u,c)=>(I(),T("div",{class:"node",ref_key:"node",ref:a},null,512))}});var ui=me(Bc,[["__scopeId","data-v-a48cb382"]]),jc=X({props:{display:{type:L(Object,String,Function),required:!0},visibility:{type:L(Number,Boolean),required:!0},style:L(Object,String,Array),classes:L(Object),onClick:Function,onHold:Function,canClick:{type:L(Boolean),required:!0},small:Boolean,mark:L(Boolean,String),id:{type:String,required:!0}},components:{Node:ui,MarkNode:li},setup(e){const{display:t,onClick:n,onHold:i}=Ee(e),r=it("");pt(()=>{var b;const u=Ae(t);if(u==null){r.value="";return}if(yt(u)){r.value=le(u);return}const c=le((b=u.title)!=null?b:"","h3"),f=le(u.description,"div");r.value=le(te(()=>g("span",null,[u.title!=null?g("div",null,[g(c,null,null)]):null,g(f,null,null)])))});const{start:a,stop:l}=pr(n,i);return{start:a,stop:l,comp:r,Visibility:ke,isVisible:at,isHidden:Mn,unref:s}}});function zc(e,t,n,i,r,a){var c;const l=St("MarkNode"),u=St("Node");return e.isVisible(e.visibility)?(I(),T("button",{key:0,style:Ue([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[]]),onClick:t[0]||(t[0]=(...f)=>e.onClick&&e.onClick(...f)),onMousedown:t[1]||(t[1]=(...f)=>e.start&&e.start(...f)),onMouseleave:t[2]||(t[2]=(...f)=>e.stop&&e.stop(...f)),onMouseup:t[3]||(t[3]=(...f)=>e.stop&&e.stop(...f)),onTouchstartPassive:t[4]||(t[4]=(...f)=>e.start&&e.start(...f)),onTouchendPassive:t[5]||(t[5]=(...f)=>e.stop&&e.stop(...f)),onTouchcancelPassive:t[6]||(t[6]=(...f)=>e.stop&&e.stop(...f)),class:be({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)?(I(),ne(Le(e.unref(e.comp)),{key:0})):j("",!0),g(l,{mark:e.unref(e.mark)},null,8,["mark"]),g(u,{id:e.id},null,8,["id"])],38)):j("",!0)}var Sr=me(jc,[["render",zc],["__scopeId","data-v-211328c0"]]);const Uc=Symbol("Clickable");function Gc(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return We(i=>{var l,u,c;const r=(l=e==null?void 0:e.call(i,i))!=null?l:{};r.id=kn("clickable-"),r.type=Uc,r[gt]=Sr;for(const f of t)(u=f.preConstruct)==null||u.call(f,r);if(Object.assign(r,n),P(r,"visibility"),se(r,"visibility",ke.Visible),P(r,"canClick"),se(r,"canClick",!0),P(r,"classes"),P(r,"style"),P(r,"mark"),P(r,"display"),r.onClick){const f=r.onClick.bind(r);r.onClick=function(b){s(r.canClick)!==!1&&f(b)}}if(r.onHold){const f=r.onHold.bind(r);r.onHold=function(){s(r.canClick)!==!1&&f()}}for(const f of t)(c=f.postConstruct)==null||c.call(f,r);const a=t.reduce((f,b)=>{var p;return Object.assign(f,(p=b.getGatheredProps)==null?void 0:p.call(b,r))},{});return r[rt]=function(){const{display:f,visibility:b,style:p,classes:w,onClick:C,onHold:_,canClick:N,small:E,mark:R,id:$}=this;return{display:f,visibility:b,style:s(p),classes:w,onClick:C,onHold:_,canClick:N,small:E,mark:R,id:$,...a}},r})}const Wc=["x1","y1","x2","y2"],Hc=X({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const n=Ee(e),i=S(()=>{const a=n.startNode.value.rect,l=n.boundingRect.value,u=l?{x:a.x+a.width/2-l.x,y:a.y+a.height/2-l.y}:{x:0,y:0};return n.link.value.offsetStart&&(u.x+=n.link.value.offsetStart.x,u.y+=n.link.value.offsetStart.y),u}),r=S(()=>{const a=n.endNode.value.rect,l=n.boundingRect.value,u=l?{x:a.x+a.width/2-l.x,y:a.y+a.height/2-l.y}:{x:0,y:0};return n.link.value.offsetEnd&&(u.x+=n.link.value.offsetEnd.x,u.y+=n.link.value.offsetEnd.y),u});return(a,l)=>(I(),T("line",Pt({"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,Wc))}});const Zc=X({__name:"Links",props:{links:null},setup(e){var c;const n=Kt(e,"links"),i=B(null),r=Kn(Di,B({})),a=Kn(Pi,B(void 0)),l=B((c=i.value)==null?void 0:c.getBoundingClientRect());nt(a,()=>{var f;return l.value=(f=i.value)==null?void 0:f.getBoundingClientRect()}),ai(()=>{var f;return l.value=(f=i.value)==null?void 0:f.getBoundingClientRect()});const u=S(()=>{var b,p;const f=r.value;return(p=(b=n.value)==null?void 0:b.filter(w=>{var C,_;return((C=f[w.startNode.id])==null?void 0:C.rect)&&((_=f[w.startNode.id])==null?void 0:_.rect)}))!=null?p:[]});return(f,b)=>(I(),T(ae,null,[s(u)?(I(),T("svg",zr(Pt({key:0},f.$attrs)),[(I(!0),T(ae,null,Nn(s(u),(p,w)=>(I(),ne(Hc,{key:w,link:p,boundingRect:l.value,startNode:s(r)[p.startNode.id],endNode:s(r)[p.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 Yc=me(Zc,[["__scopeId","data-v-063f6d6b"]]);X({props:{nodes:{type:L(Array),required:!0},leftSideNodes:L(Array),rightSideNodes:L(Array),branches:L(Array)},components:{Links:Yc},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:i}=Ee(e),r=it();pt(()=>{const u=Ae(t);r.value=le(te(()=>g(ae,null,[u.map(c=>g("span",{class:"row tree-row",style:"margin: 50px auto;"},[c.map(mt)]))])))});const a=it();pt(()=>{const u=Ae(n);a.value=u?le(te(()=>g("span",{class:"left-side-nodes small"},[u.map(mt)]))):""});const l=it();return pt(()=>{const u=Ae(i);l.value=u?le(te(()=>g("span",{class:"side-nodes small"},[u.map(mt)]))):""}),{unref:s,nodesComp:r,leftNodesComp:a,rightNodesComp:l}}});X({props:{display:L(Object,String,Function),visibility:{type:L(Number,Boolean),required:!0},style:L(String,Object,Array),classes:L(Object),onClick:Function,onHold:Function,color:L(String),glowColor:L(String),canClick:{type:L(Boolean),required:!0},mark:L(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:li,Node:ui},setup(e){const{onClick:t,onHold:n,display:i}=Ee(e),r=jn(i),{start:a,stop:l}=pr(t,n);return{start:a,stop:l,comp:r,unref:s,Visibility:ke,isCoercableComponent:yt,isVisible:at,isHidden:Mn}}});function Rn(e){const t=[],n={};let i=!1;function r(){return i||(t.push(...e()),n.base=t.map(u=>_e(u.base)),n.baseText=t.map(u=>_e(u.baseText)),n.visible=t.map(u=>_e(u.visible)),n.title=t.map(u=>_e(u.title)),n.subtitle=t.map(u=>_e(u.subtitle)),i=!0),t}const a=tt({},!1);return[te(()=>{const u=r();let c=!0;const f=u.map((b,p)=>{var R,$,D;if(s(n.visible[p])===!1)return null;const w=g("h3",{onClick:()=>a.value[p]=!a.value[p],style:"cursor: pointer"},[g("span",{class:"modifier-toggle"+(s(a.value[p])?" collapsed":"")},[O("\u25BC")]),s(n.title[p]),s(n.subtitle[p])!=null?g("span",{class:"subtitle"},[O(" ("),s(n.subtitle[p]),O(")")]):null]),C=s(a.value[p])?null:g(ae,null,[g("div",{class:"modifier-container"},[g("span",{class:"modifier-description"},[mt((R=s(n.baseText[p]))!=null?R:"Base")]),g("span",{class:"modifier-amount"},[cn(($=s(n.base[p]))!=null?$:1),b.unit])]),b.modifier.description==null?null:mt(s(b.modifier.description))]),_=!c;c=!1;const N=(D=s(n.base[p]))!=null?D:1,E=b.modifier.apply(N);return g(ae,null,[_?g("br",null,null):null,g("div",{style:{"--unit":oe.alignUnits&&b.unit!=null?"'"+b.unit+"'":""}},[w,g("br",null,null),C,g("hr",null,null),g("div",{class:"modifier-container"},[g("span",{class:"modifier-description"},[O("Total")]),g("span",{class:"modifier-amount",style:(b.smallerIsBetter===!0?o.gt(E,N!=null?N:1):o.lt(E,N!=null?N:1))?"color: var(--danger)":""},[Zt(E),b.unit])])])])});return g(ae,null,[f])}),a]}function Ji(e,t,n){const i=_e(t),r=_e(n);return S(()=>{const a=s(i),l=s(r);return o.gte(e.value,l)?"Now":o.lte(a,0)?"Never":oi(o.sub(l,e.value).div(a))})}function hn(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 te(()=>{var a;if(s(i)){const l=Zt(e.evaluate()),u=Zt(e.evaluate(o.add(s((a=e.innermostVariable)!=null?a:0),s(r))));return g(ae,null,[g("b",null,[g("i",null,[l,O(" \u2192 "),u])])])}return g(ae,null,[Zt(e.evaluate())])})}const Jc=X({__name:"Spacer",props:{width:{default:"8px"},height:{default:"17px"}},setup(e){return(t,n)=>(I(),T("div",{style:Ue({width:e.width,height:e.height})},null,4))}});function bi(e){return We(t=>{const n=e.call(t,t);if(n.partialDisplay=i=>g("span",{style:s(n.requirementMet)?"":"color: var(--danger)"},[ii(n.resource,n.cost instanceof m?Jt(n.cost,i!=null?i:1,s(n.spendResources)):s(n.cost))," ",n.resource.displayName]),n.display=i=>g("div",null,[s(n.requiresPay)?"Costs: ":"Requires: ",ii(n.resource,n.cost instanceof m?Jt(n.cost,i!=null?i:1,s(n.spendResources)):s(n.cost))," ",n.resource.displayName]),P(n,"visibility"),se(n,"visibility",ke.Visible),P(n,"cost"),P(n,"requiresPay"),se(n,"requiresPay",!0),P(n,"spendResources"),se(n,"spendResources",!0),se(n,"pay",function(i){const r=n.cost instanceof m?Jt(n.cost,i!=null?i:1,s(n.spendResources)):s(n.cost);n.resource.value=o.sub(n.resource.value,r).max(0)}),n.canMaximize=S(()=>n.cost instanceof m&&n.cost.isInvertible()&&(s(n.spendResources)===!1||n.cost.isIntegrable())),n.cost instanceof m&&n.cost.isInvertible()){const i=Oc(n.cost,n.resource,s(n.spendResources));n.requirementMet=S(()=>s(n.canMaximize)?i.value:n.cost instanceof m?o.gte(n.resource.value,n.cost.evaluate()):o.gte(n.resource.value,s(n.cost)))}else n.requirementMet=S(()=>n.cost instanceof m?o.gte(n.resource.value,n.cost.evaluate()):o.gte(n.resource.value,s(n.cost)));return n})}function qi(e){return We(()=>({requirementMet:S(()=>at(e.visibility)),visibility:ke.None,requiresPay:!1}))}function Kc(e,t){return We(()=>({requirementMet:_e(e),partialDisplay:t==null?void 0:te(()=>mt(t)),display:t==null?void 0:te(()=>g(ae,null,[O("Req: "),mt(t)])),visibility:t==null?ke.None:ke.Visible,requiresPay:!1}))}function ci(e){if(Mt(e))return e.every(ci);const t=s(e.requirementMet);return typeof t=="boolean"?t:o.gt(t,0)}function Ir(e){if(Mt(e))return e.map(Ir).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 di(e,t=1){var n,i;if(Mt(e)&&(e=e.filter(r=>at(r.visibility)),e.length===1&&(e=e[0])),Mt(e)){e=e.filter(l=>"partialDisplay"in l);const r=e.filter(l=>s(l.requiresPay)),a=e.filter(l=>!s(l.requiresPay));return g(ae,null,[r.length>0?g("div",null,[O("Costs:")," ",Hi(r.map(l=>l.partialDisplay(t)),g(ae,null,[O(", ")]))]):null,a.length>0?g("div",null,[O("Requires:")," ",Hi(a.map(l=>l.partialDisplay(t)),g(ae,null,[O(", ")]))]):null])}return(i=(n=e.display)==null?void 0:n.call(e))!=null?i:g(ae,null,null)}function xr(e,t=1){var n;Mt(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 Xc=X({props:{visibility:{type:L(Number,Boolean),required:!0},display:L(Object,String,Function),earned:{type:L(Boolean),required:!0},requirements:L(Object,Array),image:L(String),style:L(String,Object,Array),classes:L(Object),mark:L(Boolean,String),small:L(Boolean),id:{type:String,required:!0}},components:{Node:ui,MarkNode:li},setup(e){const{display:t,requirements:n,earned:i}=Ee(e),r=it("");return pt(()=>{const a=Ae(t);if(a==null){r.value="";return}if(yt(a)){r.value=le(a);return}const l=le(a.requirement?a.requirement:te(()=>{var f;return di((f=Ae(n))!=null?f:[])}),"h3"),u=le(a.effectDisplay||"","b"),c=Ae(i)?le(a.optionsDisplay||"","span"):"";r.value=le(te(()=>g("span",null,[g(l,null,null),a.effectDisplay!=null?g("div",null,[g(u,null,null)]):null,a.optionsDisplay!=null?g("div",{class:"equal-spaced"},[g(c,null,null)]):null])))}),{comp:r,unref:s,Visibility:ke,isVisible:at,isHidden:Mn}}});function Qc(e,t,n,i,r,a){var c;const l=St("MarkNode"),u=St("Node");return e.isVisible(e.visibility)?(I(),T("div",{key:0,style:Ue([{visibility:e.isHidden(e.visibility)?"hidden":void 0,backgroundImage:e.earned&&e.image&&`url(${e.image})`||""},(c=e.unref(e.style))!=null?c:[]]),class:be({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?(I(),ne(Le(e.comp),{key:0})):j("",!0),g(l,{mark:e.unref(e.mark)},null,8,["mark"]),g(u,{id:e.id},null,8,["id"])],6)):j("",!0)}var ed=me(Xc,[["render",Qc],["__scopeId","data-v-5673325a"]]);const td=si(),nd=Symbol("Achievement");let bn=function(e){return e.All="all",e.Configurable="configurable",e.Incomplete="incomplete",e.None="none",e}({});function id(e,...t){const n=tt(!1,!1),i=t.reduce((r,a)=>{var l;return Object.assign(r,(l=a.getPersistentData)==null?void 0:l.call(a))},{});return We(r=>{var c,f,b;const a=(c=e==null?void 0:e.call(r,r))!=null?c:{};a.id=kn("achievement-"),a.type=nd,a[gt]=ed;for(const p of t)(f=p.preConstruct)==null||f.call(p,a);a.earned=n,a.complete=function(){var w,C;n.value=!0;const p=a;if((w=p.onComplete)==null||w.call(p),p.display!=null&&s(p.showPopups)===!0){const _=s(p.display);let N;yt(_)?N=le(_):_.requirement!=null?N=le(_.requirement):N=di((C=p.requirements)!=null?C:[]),td.info(g("div",null,[g("h3",null,[O("Achievement earned!")]),g("div",null,[g(N,null,null)])]))}},Object.assign(a,i),P(a,"visibility"),se(a,"visibility",ke.Visible);const l=a.visibility;a.visibility=Ur(()=>{const p=s(a.display);switch(oe.msDisplay){default:case bn.All:return s(l);case bn.Configurable:return s(a.earned)&&!(p!=null&&typeof p=="object"&&"optionsDisplay"in p)?ke.None:s(l);case bn.Incomplete:return s(a.earned)?ke.None:s(l);case bn.None:return ke.None}}),P(a,"display"),P(a,"mark"),P(a,"small"),P(a,"image"),P(a,"style"),P(a,"classes"),P(a,"showPopups"),se(a,"showPopups",!0);for(const p of t)(b=p.postConstruct)==null||b.call(p,a);const u=t.reduce((p,w)=>{var C;return Object.assign(p,(C=w.getGatheredProps)==null?void 0:C.call(w,a))},{});if(a[rt]=function(){const{visibility:p,display:w,requirements:C,earned:_,image:N,style:E,classes:R,mark:$,small:D,id:U}=this;return{visibility:p,display:w,requirements:C,earned:_,image:N,style:s(E),classes:R,mark:$,small:D,id:U,...u}},a.requirements){const p=a,w=[qi(p),Kc(()=>!p.earned.value),...Mt(a.requirements)?a.requirements:[a.requirements]];pt(()=>{oe.active===K.id&&ci(w)&&p.complete()})}return a})}Ge.on("loadSettings",e=>{se(e,"msDisplay",bn.All)});const rd=Object.values(bn).map(e=>({label:ze(e),value:e}));is(te(()=>g(Oi,{title:te(()=>g("span",{class:"option-title"},[O("Show achievements"),g("desc",null,[O("Select which achievements to display based on criterias.")])])),options:rd,"onUpdate:modelValue":e=>oe.msDisplay=e,modelValue:oe.msDisplay},null)));const $r=Symbol("Repeatable");function ad(e,...t){const n=tt(0),i=t.reduce((r,a)=>{var l;return Object.assign(r,(l=a.getPersistentData)==null?void 0:l.call(a))},{});return We(r=>{var w,C,_;const a=e.call(r,r);a.id=kn("repeatable-"),a.type=$r,a[gt]=Sr;for(const N of t)(w=N.preConstruct)==null||w.call(N,a);a.amount=n,a.amount[Cn]=(C=a.initialAmount)!=null?C:0,Object.assign(a,i);const l={requirementMet:S(()=>o.sub(s(a.limit),a.amount.value)),requiresPay:!1,visibility:ke.None},u=qi(a);Mt(a.requirements)?(a.requirements.unshift(u),a.requirements.push(l)):a.requirements=[u,a.requirements,l],a.maxed=S(()=>o.gte(a.amount.value,s(a.limit))),P(a,"classes");const c=a.classes;a.classes=S(()=>{const N=s(c)||{};return a.maxed.value&&(N.bought=!0),N}),a.amountToIncrease=S(()=>s(a.maximize)?Ir(a.requirements):1),a.canClick=S(()=>ci(a.requirements));const f=a.onClick;a.onClick=function(N){const E=a;!s(E.canClick)||(xr(a.requirements,s(a.amountToIncrease)),E.amount.value=o.add(E.amount.value,1),f==null||f(N))},P(a,"display");const b=a.display;a.display=te(()=>{var E,R,$;const N=s(b);if(yt(N)){const D=le(N);return g(D,null,null)}if(N!=null){const D=a,U=le((E=N.title)!=null?E:"","h3"),he=le((R=N.description)!=null?R:""),ie=le(($=N.effectDisplay)!=null?$:"");return g("span",null,[N.title==null?null:g("div",null,[g(U,null,null)]),N.description==null?null:g(he,null,null),N.showAmount===!1?null:g("div",null,[g("br",null,null),g(ae,null,[O("Amount: "),je(D.amount.value)]),o.isFinite(s(D.limit))?g(ae,null,[O(" / "),je(s(D.limit))]):void 0]),N.effectDisplay==null?null:g("div",null,[g("br",null,null),O("Currently: "),g(ie,null,null)]),D.maxed.value?null:g("div",null,[g("br",null,null),di(D.requirements,s(a.amountToIncrease))])])}return""}),P(a,"visibility"),se(a,"visibility",ke.Visible),P(a,"limit"),se(a,"limit",o.dInf),P(a,"style"),P(a,"mark"),P(a,"small"),P(a,"maximize");for(const N of t)(_=N.postConstruct)==null||_.call(N,a);const p=t.reduce((N,E)=>{var R;return Object.assign(N,(R=E.getGatheredProps)==null?void 0:R.call(E,a))},{});return a[rt]=function(){const{display:N,visibility:E,style:R,classes:$,onClick:D,canClick:U,small:he,mark:ie,id:J}=this;return{display:N,visibility:E,style:s(R),classes:$,onClick:D,canClick:U,small:he,mark:ie,id:J,...p}},a})}function Ki(e,t){return P(t,"display"),P(t,"classes"),P(t,"style"),P(t,"direction"),se(t,"direction",Y.Up),P(t,"xoffset"),P(t,"yoffset"),t.pinnable&&(t.pinned=tt(!1,!1)),Dt(()=>{t.pinnable&&("pinned"in e?(console.error("Cannot add pinnable tooltip to element that already has a property called 'pinned'"),t.pinnable=!1,vr(t.pinned)):e.pinned=t.pinned);const n=e[gt];e[gt]=xe;const i=e[rt].bind(e);e[rt]=function(){const{display:a,classes:l,style:u,direction:c,xoffset:f,yoffset:b,pinned:p}=this;return{element:{[gt]:n,[rt]:i},display:a,classes:l,style:s(u),direction:c,xoffset:f,yoffset:b,pinned:p}}.bind(t)}),t}var sd=X({props:{display:{type:L(String,Object,Function),required:!0},visibility:{type:L(Number,Boolean),required:!0},style:L(String,Object,Array),classes:L(Object),requirements:{type:Object,required:!0},canPurchase:{type:L(Boolean),required:!0},bought:{type:L(Boolean),required:!0},mark:L(Boolean,String),id:{type:String,required:!0},purchase:{type:Function,required:!0}},components:{Node:ui,MarkNode:li},setup(e){const{display:t,requirements:n,bought:i}=Ee(e),r=it("");return pt(()=>{const a=Ae(t);if(a==null){r.value="";return}if(yt(a)){r.value=le(a);return}const l=le(a.title||"","h3"),u=le(a.description,"div"),c=le(a.effectDisplay||"");r.value=le(te(()=>g("span",null,[a.title!=null?g("div",null,[g(l,null,null)]):null,g(u,null,null),a.effectDisplay!=null?g("div",null,[O("Currently: "),g(c,null,null)]):null,i.value?null:g(ae,null,[g("br",null,null),di(n.value)])])))}),{component:r,unref:s,Visibility:ke,isVisible:at,isHidden:Mn}}});const od=["disabled"];function ld(e,t,n,i,r,a){var c;const l=St("MarkNode"),u=St("Node");return e.isVisible(e.visibility)?(I(),T("button",{key:0,style:Ue([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:{}]),onClick:t[0]||(t[0]=(...f)=>e.purchase&&e.purchase(...f)),class:be({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)?(I(),ne(Le(e.unref(e.component)),{key:0})):j("",!0),g(l,{mark:e.unref(e.mark)},null,8,["mark"]),g(u,{id:e.id},null,8,["id"])],14,od)):j("",!0)}var ud=me(sd,[["render",ld],["__scopeId","data-v-9be6bac0"]]);const Er=Symbol("Upgrade");function cd(e,...t){const n=tt(!1,!1),i=t.reduce((r,a)=>{var l;return Object.assign(r,(l=a.getPersistentData)==null?void 0:l.call(a))},{});return We(r=>{var c,f;const a=e.call(r,r);a.id=kn("upgrade-"),a.type=Er,a[gt]=ud;for(const b of t)(c=b.preConstruct)==null||c.call(b,a);a.bought=n,Object.assign(a,i),a.canPurchase=S(()=>!n.value&&ci(a.requirements)),a.purchase=function(){var p;const b=a;!s(b.canPurchase)||(xr(a.requirements),n.value=!0,(p=b.onPurchase)==null||p.call(b))};const l=qi(a);Mt(a.requirements)?a.requirements.unshift(l):a.requirements=[l,a.requirements],P(a,"visibility"),se(a,"visibility",ke.Visible),P(a,"classes"),P(a,"style"),P(a,"display"),P(a,"mark");for(const b of t)(f=b.postConstruct)==null||f.call(b,a);const u=t.reduce((b,p)=>{var w;return Object.assign(b,(w=p.getGatheredProps)==null?void 0:w.call(p,a))},{});return a[rt]=function(){const{display:b,visibility:p,style:w,classes:C,requirements:_,canPurchase:N,bought:E,mark:R,id:$,purchase:D}=this;return{display:b,visibility:p,style:s(w),classes:C,requirements:_,canPurchase:N,bought:E,mark:R,id:$,purchase:D,...u}},a})}function dd(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 fd={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"]},Xi=[[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 yi(e){const t=Xi[Math.floor(e()*Xi.length)];let n="";for(let i=0;i<t.length;i++){const r=fd[t[i]];n+=r[Math.floor(e()*r.length)]}return ze(n)}function wi(e,t){const[n,i,r]=pd(...e),[a,l,u]=gd(Math.floor(t()*360),i,r);return`rgb(${a*255}, ${l*255}, ${u*255})`}function pd(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 gd(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)]}function md(e,...t){return We(n=>{var r,a;const i=e.call(n,n);for(const l of t)(r=l.preConstruct)==null||r.call(l,i);i.formula=i.formula(m.variable(i.baseResource)),i.currentGain==null&&(i.currentGain=S(()=>{let l=o.floor(i.formula.evaluate(i.baseResource.value)).max(0);return s(i.buyMax)===!1&&(l=l.min(1)),l})),i.actualGain==null&&(i.actualGain=i.currentGain),i.currentAt==null&&(i.currentAt=S(()=>i.formula.invert(o.floor(s(i.currentGain))))),i.nextAt==null&&(i.nextAt=S(()=>i.formula.invert(o.floor(s(i.currentGain)).add(1)))),i.convert==null&&(i.convert=function(){var u;const l=s(i.currentGain);i.gainResource.value=o.add(i.gainResource.value,l),i.spend(l),(u=i.onConvert)==null||u.call(i,l)}),i.spend==null&&(i.spend=function(){i.baseResource.value=0}),P(i,"currentGain"),P(i,"actualGain"),P(i,"currentAt"),P(i,"nextAt"),P(i,"buyMax"),se(i,"buyMax",!0);for(const l of t)(a=l.postConstruct)==null||a.call(l,i);return i})}function vd(e){return md(e)}const Qi=si();function Tr(e,t,n,i){return Fi(e,function(){const r=dd(0,n>>0,n>>32,1);for(let q=0;q<12;q++)r();const a=yi(r),l=wi([.64,.75,.55],r),u=wi([.18,.2,.25],r),c=Si(0,yi(r)),f=tt(0),b=Gt.indexOf(t);let p=r();const w=i.reduce((q,V)=>(q[V.type]=V.data,q),{});"increaseDiff"in w&&(p=p/2+.5),"decreaseDiff"in w&&(p=p/2),"relic"in w&&(p=1);const C=p+b+1,_="increaseRewards"in w?C+1:C;let N="relic"in w?b+2:Math.ceil(r()*(b+2));"increaseLength"in w&&N++;const E=[],R=Nt(()=>[...E,Re(()=>({multiplier:()=>ue.isEmpowered("silver")?4:2,description:()=>(ue.isEmpowered("silver")?"Empowered ":"")+ue.tools.silver.name,enabled:()=>ue.toolNodes.value.silver!=null})),Re(()=>({multiplier:()=>(ue.isEmpowered("diamond")?2:1)*ce.filter(q=>q.bought.value).length/10,description:()=>(ue.isEmpowered("diamond")?"Empowered ":"")+ue.tools.diamond.name,enabled:()=>ue.toolNodes.value.diamond!=null})),Re(()=>({multiplier:()=>o.div(f.value,6e3).times(ue.isEmpowered("emerald")?2:1),description:()=>(ue.isEmpowered("emerald")?"Empowered ":"")+ue.tools.emerald.name,enabled:()=>ue.toolNodes.value.emerald!=null}))]),$=S(()=>R.apply(0)),D=[],U={};function he({feature:q,canClick:V,modifier:Ie,cost:wt,previewModifier:vt,showETA:qe,previewCost:Rt}){V=_e(V),qe=_e(qe);const xt=us(q);D.push({shouldShowPreview:S(()=>s(V)&&xt.value),modifier:Nt(()=>{const $t=E.slice();return $t.splice($t.indexOf(Ie),1,vt),$t}),cost:Rt!=null?Rt:wt}),E.push(Ie);const qt=Ji(c,$,()=>Ne(wt)),Be=Ki(q,{display:qe==null?qt:()=>s(qe)?qt.value:"",direction:Y.Down});return{isHovering:xt,eta:qt,tooltip:Be}}const ie=[],J=B(0);let Q=m.variable(J).times(0);const z={};let de=!0;const W=S(()=>o.add(C,r()-.5).pow_base(2).times(10).times(Q.evaluate())),ye=[];for(let q=0;q<N;q++){const V={upgrades:32,repeatables:q<=1?0:16,conversion:q<=3?0:8};switch(Yn(V,r)){case"upgrades":const Qt=[];for(let Vt=0;Vt<4;Vt++){const mi=Yn({add:1,mult:q===0&&Vt===0?0:1,pow:q===0?0:.5},r),tn=W.value,Lt=Ni(r);let Bt="",jt,zt;const nn=J.value;switch(mi){case"add":{const Oe=o.add(tn,10).pow(r()/4+.875);Bt=`Gain ${we(Oe)} ${c.displayName}/s`,Q=Q.add(Oe),jt=un(()=>({addend:Oe,description:Lt,enabled:ut.bought})),zt=un(()=>({addend:Oe}));break}case"mult":{const Oe=r()*5+1;Bt=`Multiply previous ${c.displayName} gain by x${we(Oe)}.`,Q=Q.add(o.sub(Oe,1).times(z[nn-1])),jt=Re(()=>({multiplier:Oe,description:Lt,enabled:ut.bought})),zt=Re(()=>({multiplier:Oe}));break}case"pow":{const Oe=r()/5+1.1;Bt=`Raise previous ${c.displayName} gain to the ^${we(Oe)}`,Q=Q.add(o.pow(z[nn-1],Oe)).sub(z[nn-1]),jt=Yi(()=>({exponent:Oe,description:Lt,enabled:ut.bought})),zt=Yi(()=>({exponent:Oe}))}}z[J.value]=Q.evaluate(),J.value++;const Pn=de,ut=cd(()=>({requirements:bi(()=>({resource:Zn(c),cost:tn})),display:{title:Lt,description:Bt},visibility:Pn}));he({feature:ut,canClick:()=>ut.canPurchase.value,modifier:jt,cost:tn,showETA:()=>!ut.bought.value,previewModifier:zt}),Qt.push(ut)}ie.push(Qt);break;case"repeatables":const ot=[];for(let Vt=0;Vt<3;Vt++){const mi=Yn({add:1.5,mult:3},r),tn=J.value,Lt=W.value,Bt=Ni(r);let jt="",zt,nn,Pn,ut;const Oe=m.variable(S(()=>ct.amount.value)).times(2);switch(mi){case"add":{const dt=o.add(Lt,10).times(r()+.5);jt=`Gain ${we(dt)} ${c.displayName}/s`,ut=Oe.add(1).times(Lt),Q=Q.add(S(()=>o.sub(J.value,tn).add(1).times(5).times(dt))),zt=S(()=>we(o.times(dt,ct.amount.value))+"/s"),nn=un(()=>({addend:()=>o.times(dt,ct.amount.value),description:Bt,enabled:()=>o.gt(ct.amount.value,0)})),Pn=un(()=>({addend:()=>o.add(ct.amount.value,1).times(dt)}));break}case"mult":{const dt=r()*.75+1.25;jt=`Multiply previous ${c.displayName} gain by x${we(dt)}.`,ut=Oe.pow_base(dt).times(Lt),Q=Q.add(S(()=>o.sub(J.value,tn).add(1).times(5).pow_base(dt).sub(1).times(z[tn-1]))),zt=S(()=>"x"+we(o.pow(dt,ct.amount.value))),nn=Re(()=>({multiplier:()=>o.pow(dt,ct.amount.value),description:Bt,enabled:()=>o.gt(ct.amount.value,0)})),Pn=Re(()=>({multiplier:()=>o.add(ct.amount.value,1).pow_base(dt)}));break}}z[J.value]=Q.evaluate(),J.value++;const Or=de,ct=ad(()=>({requirements:bi(()=>({resource:Zn(c),cost:ut})),display:()=>({title:Bt,description:jt,effectDisplay:s(zt)}),visibility:Or}));he({feature:ct,canClick:()=>s(ct.canClick),modifier:nn,cost:ut,previewModifier:Pn}),ot.push(ct)}ie.push(ot);break;case"conversion":const Se=Si(0,yi(r)),lt=wi([.64,.75,.55],r),en=W.value,Wn=r()/2+.25,v=r()/2+.25,d=J.value;Q=Q.add(S(()=>o.sub(J.value,d).add(1).pow_base(5).pow(v).times(z[d-1])));const h=vd(()=>({baseResource:Zn(c),gainResource:Se,formula:Vt=>Vt.div(en).pow(Wn),spend(){c.value=0}}));z[J.value]=Q.evaluate(),J.value+=2;const x=de,A=Ni(r),G=m.variable(Se).pow(v).add(1),ve=Re(()=>({multiplier:()=>G.evaluate(),description:A,enabled:()=>o.gt(Se.value,0)})),_t=Re(()=>({multiplier:()=>G.evaluate(o.add(Se.value,h.actualGain.value))})),Xe=Gc(()=>({display:{title:A,description:te(()=>g("span",null,[O("Reset "),c.displayName,O(" for")," ",ii(Se,o.clampMin(h.actualGain.value,1))," ",Se.displayName,g("br",null,null),g("div",null,[O("Next:")," ",ii(c,o.lt(h.actualGain.value,1)?h.currentAt.value:h.nextAt.value)," ",c.displayName])]))},style:{width:"200px",minHeight:"100px"},canClick:()=>o.gte(h.actualGain.value,1),prestigeResource:Se,onClick:h.convert,visibility:x})),{isHovering:Dn}=he({feature:Xe,canClick:()=>s(Xe.canClick),modifier:ve,cost:en,previewCost:c,previewModifier:_t}),Vi=S(()=>Dn.value&&Xe.canClick.value);ie.push([Xe]);const Pr=hn(m.variable(Se),Vi,h.actualGain),Fr=hn(G,Vi,h.actualGain);U[q*2]=te(()=>g(ae,null,[at(Xe.visibility)?g("div",{style:"margin: 10px"},[O("You have")," ",g("h2",{style:{color:lt,textShadow:`0px 0px 10px ${lt}`}},[Pr()])," ",Se.displayName,O(","),g("br",null,null),O("providing a "),Fr(),O("x multiplier to previous")," ",c.displayName,O(" gain")]):null,Wi(Xe)]));break}const wt={cache:"increaseCaches"in w?10:1,generation:"increaseGens"in w?10:1,resourceMulti:"increaseResourceMults"in w?10:1,energyMulti:"increaseEnergyMults"in w?2.5:.25,influences:Object.keys(ue.influenceNodes.value).length+ye.length===Object.keys(Ct).length?0:"increaseInfluences"in w?20:2,relic:0};let vt=Yn(wt,r);q===N-1&&"relic"in w&&(vt="relic");let qe="",Rt,xt,qt,Be,$t,Xt;switch(vt){case"cache":Be=_i(r,i),qe=`Gain ${we(_)}x your current ${Be}.`,xt=()=>{var Se,lt,en;return ue.grantResource(Be,o.times((en=(lt=(Se=ue.resourceNodes.value[Be])==null?void 0:Se.state)==null?void 0:lt.amount)!=null?en:0,_))};break;case"generation":Be=_i(r,i);const Qt=o.div(_,120).times(et[Be]);qe=`Gain ${we(Qt)} ${Be}/s while plane is active.`,Rt=Se=>ue.grantResource(Be,o.times(Se,Qt)),qt=S(()=>ue.resourceNodes.value[Be]);break;case"resourceMulti":$t=Be=_i(r,i),Xt=o.div(_,17).pow_base(2),qe=`Gain ${we(Xt)}x ${Be} while plane is active.`;break;case"energyMulti":$t="energy",Xt=o.div(_,17),qe=`Gain ${we(Xt)}x energy while plane is active.`;break;case"influences":const ot=Object.keys(Ct)[Math.floor(r()*Object.keys(Ct).length)];ye.push(ot),qe=`Gain a new portal influence (${Ct[ot].display})`,xt=()=>{if(ot in ue.influenceNodes.value){Qi.warning(`Error: ignoring duplicate portal influence (${Ct[ot].display})`);return}const Se={id:qn(ue.board),position:{...ue.board.types.portal.nodes.value.find(lt=>lt.state.id===e).position},type:"influence",state:{type:ot,data:Ct[ot].initialData}};ue.board.placeInAvailableSpace(Se),ue.board.nodes.value.push(Se)};break;case"relic":qe=`Gain the ${t}-tier planar relic (${ri[t]})`,xt=()=>{if(`${t}Relic`in ue.toolNodes.value)Qi.warning(`Error: ignoring duplicate relic (${ri[t]})`);else{const Se={id:qn(ue.board),position:{...ue.board.types.portal.nodes.value.find(lt=>lt.state.id===e).position},type:"passive",state:`${t}Relic`};ue.board.placeInAvailableSpace(Se),ue.board.nodes.value.push(Se)}}}const gi=de,En=W.value,ht=id(()=>({requirements:bi(()=>({resource:Zn(c),cost:En})),visibility:gi,display:{requirement:`${we(En)} ${c.displayName}`,effectDisplay:qe},style:"width: 100%",classes:{final:q===N-1},update:Rt,onComplete:xt,link:qt,effectedResource:$t,resourceMulti:Xt})),Tn=Ji(c,$,En);Ki(ht,{display:()=>ht.earned.value?"":Tn.value,direction:Y.Down}),ie.push([ht]),de=ht.earned}const ce=ki(ie,Er);ki(ie,$r);const fe=Nt(()=>[Re(()=>({multiplier:()=>{var q,V,Ie;return o.add((Ie=(V=(q=ue.board.types.booster.nodes.value[0])==null?void 0:q.state)==null?void 0:V.level)!=null?Ie:0,1)},description:"Booster",enabled:()=>{var q,V,Ie;return(Ie=(V=(q=ue.board.types.booster.nodes.value[0])==null?void 0:q.state)==null?void 0:V.portals.includes(e))!=null?Ie:!1}}))]),Te=S(()=>fe.apply(1)),[He,Ke]=Rn(()=>[{title:`${ze(c.displayName)} Gain`,modifier:R,base:0,unit:"/s"},{title:`${ze(c.displayName)} Time Speed`,modifier:fe,base:1,visible:()=>o.gt(Te.value,1)}]),In=B(!1),vn=te(()=>g(Ft,{modelValue:In.value,"onUpdate:modelValue":q=>In.value=q},{header:()=>g("h2",null,[O("Modifiers")]),body:()=>Je(He)}));this.on("preUpdate",q=>{if(!ue.activePortals.value.some(Ie=>Ie.state.id===e))return;const V=o.times(Te.value,q);f.value=o.add(f.value,V),c.value=o.times($.value,V).add(c.value),It.value.forEach(Ie=>{var wt;(wt=Ie.update)==null||wt.call(Ie,V)})});const xn=S(()=>{const q=D.find(V=>V.shouldShowPreview.value);return q?o.neg(Ne(q.cost)):0}),Ot=S(()=>{const q=D.find(V=>V.shouldShowPreview.value);return q?o.sub(q.modifier.apply(0),$.value):0}),Un=hn(m.variable(0).add(c),()=>o.neq(xn.value,0),xn),$n=hn(m.variable(0).add($),()=>o.neq(Ot.value,0),Ot),Gn=S(()=>{const q=[];return It.value.forEach(V=>{V.link&&q.push(V.link)}),q}),Ze=S(()=>{const q={};return It.value.forEach(V=>{V.effectedResource!=null&&V.resourceMulti!=null&&(q[V.effectedResource]!=null?q[V.effectedResource]=o.times(q[V.effectedResource],V.resourceMulti):q[V.effectedResource]=V.resourceMulti)}),q}),It=S(()=>{const q=[];for(let V=1;V<ie.length;V+=2){const Ie=ie[V][0];Ie.earned.value&&q.push(Ie)}return q}),pi=S(()=>o.lt(It.value.length,N)&&ie.some(q=>q.some(V=>"earned"in V&&s(V.earned)||"bought"in V&&s(V.bought)?!1:("canClick"in V&&s(V.canClick)||"canPurchase"in V&&s(V.canPurchase),!0))));return{tier:tt(t),seed:tt(n),influences:tt(i),name:a,color:l,resource:c,background:u,style:{background:u,"--background":u},features:ie,resourceTabCollapsed:Ke,links:Gn,resourceMultis:Ze,earnedTreasures:It,showNotif:pi,timeActive:f,display:te(()=>g(ae,null,[g(ni,{class:"nav-container",style:"z-index: 5"},{default:()=>[g("span",{class:"nav-segment"},[g("h2",null,[a])]),g("span",{class:"nav-segment"},[g("h3",null,[t,O("-tier")])]),i.length===0?null:g("span",{class:"nav-segment"},[g(xe,{display:i.map(q=>{const V=Ct[q.type].description;return typeof V=="function"?V(q):V}).join("<br/>"),direction:Y.Down,style:"width: 300px"},{default:()=>[g("h3",null,[i.length,O(" influences")])]})]),g("span",{class:"nav-segment"},[g("button",{class:"button",style:"display: inline",onClick:()=>In.value=!0},[O("modifiers")])])]}),g(ni,{class:"nav-container"},{default:()=>[g("span",{class:"nav-segment"},[g("h3",{style:`color: ${l}; text-shadow: 0px 0px 10px ${l};`},[Je(Un)])," ",c.displayName]),g("span",{class:"nav-segment"},[O("("),g("h3",{style:`color: ${l}; text-shadow: 0px 0px 10px ${l};`},[o.gt($.value,0)?"+":"",Je($n)]),O("/s)")])]}),g(Jc,{height:"60px"},null),ie.map((q,V)=>V in U?Je(U[V]):Wi(...q)),Je(vn)])),minimizedDisplay:te(()=>g("div",null,[g("span",null,[a]),g("span",{style:"font-size: large; vertical-align: sub;"},[" ",It.value.length,O("/"),N,O(" treasures")])]))}})}function _i(e,t){t=t.filter(u=>u.type==="increaseResources"||u.type==="decreaseResources");const n=Object.keys(et).reduce((u,c)=>{let f=et[c];return t.filter(b=>b.data===c).forEach(b=>{b.type==="increaseResources"?f*=1e3:f/=1e3}),u+f},0),i=Object.keys(et),r=Math.floor(e()*n);let a=0,l;for(let u=0;u<i.length;u++){const c=i[u];if(a+=et[c],r<a){l=c;break}}return l}function Yn(e,t){const n=Object.values(e).reduce((u,c)=>u+c),i=Object.keys(e);let r=0,a=null;const l=t()*n;for(let u=0;u<i.length;u++){const c=i[u];if(r+=e[c],l<r){a=c;break}}if(a==null)throw new Error("Failed to pick random. This should not happen");return a}function Ni(e){return ze(Kr({dictionaries:[Xr,Qr],seed:e()*4294967296,separator:" "})+"ity")}const er=si(),et={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},Gt=Object.keys(et),Pe={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:{planes:[],maxConnections:1,powered:!1,level:1}},emerald:{cost:1e19,name:"Artificial Intelligence",type:"passive",state:"emerald"},platinum:{cost:1e24,name:"Upgrader",type:"upgrader",state:{planes:[],maxConnections:1,powered:!1}},diamond:{cost:1e30,name:"Machine Learning",type:"passive",state:"diamond"},berylium:{cost:1e37,name:"Automator",type:"automator",state:{planes:[],maxConnections:1,powered:!1}},unobtainium:{cost:1e45,name:"National Grid",type:"passive",state:"unobtainium"},ultimatum:{cost:1e54,name:"Investments",type:"investments",state:{planes:[],maxConnections:1,powered:!1}}},ri={dirt:"Replicator",sand:"Metal Detector",gravel:"Neural Networks",wood:"Mining Laser",stone:"BOGO Coupon",coal:"Planar Intelligence",copper:"Efficient Code",iron:"Trade Agreements",silver:"Machine Synergizer",gold:"XP Market",emerald:"Efficient Portals",platinum:"Time Dilation",diamond:"Paypal",berylium:"Tiered Mining",unobtainium:"Overclocked Portals",ultimatum:"Rebates"},tr={dirt:{description:e=>e?"Quadruples mining speed":"Doubles mining speed"},gravel:{description:e=>e?"Quadruples mine ore drops":"Doubles mine ore drops"},stone:{description:e=>e?"Quadruples energy gain":"Doubles energy gain"},copper:{description:e=>e?"Material level is 20% stronger":"Material level is 10% stronger"},silver:{description:e=>e?"Doubles each plane's resource gain":"Quadruples each plane's resource gain"},diamond:{description:e=>e?"+20% plane's resource gain per upgrade bought":"+10% plane's resource gain per upgrade bought"},emerald:{description:e=>e?"+2% plane's resource gain per minute active":"+1% plane's resource gain per minute active"},unobtainium:{description:e=>e?"+2 max connections per machine":"+1 max connections per machine"},dirtRelic:{description:e=>e?"Upgrades apply thrice":"Upgrades apply twice"},sandRelic:{description:e=>e?"Treasure's 2 tiers stronger":"Treasure's 1 tier stronger"},gravelRelic:{description:e=>e?"+2% plane's resource gain per repeatable purchase":"+1% plane's resource gain per repeatable purchase"},woodRelic:{description:e=>e?"(Relics)^2 boost mine speed":"Relics boost mine speed"},stoneRelic:{description:e=>e?"2 free levels for repeatables":"1 free level for repeatables"},coalRelic:{description:e=>e?"(Treasures)^2 boost planar speed":"Treasures boost planar speed"},copperRelic:{description:e=>e?"Power 2 machines free":"Power 1 machine free"},ironRelic:{description:e=>e?"Conversions give triple output":"Conversions give double output"},silverRelic:{description:e=>e?"(Power machines)^2 boost ore dropped":"Power machines boost ore dropped"},goldRelic:{description:e=>e?"Each treasure quadruples XP gain":"Each treasure doubles XP gain"},emeraldRelic:{description:e=>e?"Creating portals costs a third the energy":"Creating portals costs half the energy"},platinumRelic:{description:e=>e?"Triple dimensions' tick rate":"Double dimensions' tick rate"},diamondRelic:{description:e=>e?"Repeatables/dimensions buy max at once":"Repeatables buy max at once"},beryliumRelic:{description:e=>e?"(Max tier plane finished)^2 boosts quarry speed":"Max tier plane finished boosts quarry speed"},unobtainiumRelic:{description:e=>e?"ln(energy) boosts planar speed":"log(energy) boosts planar speed"},ultimatumRelic:{description:e=>e?"Upgrades/repeatables/dimensions/prestige no longer spend on purchase":"Upgrades/repeatables no longer spend on purchase"}},Ct={increaseResources:{display:"+resource",description:e=>{const t=e.data;return t.length===0?"Increase resource odds - Drag a resource to me!":t.length===1?`Increase ${t[0]}'s odds`:`Increase ${t.length} resources' odds`},cost:2,initialData:[]},decreaseResources:{display:"-resource",description:e=>{const t=e.data;return t.length===0?"Decrease resource odds - Drag a resource to me!":t.length===1?`Decrease ${t[0]}'s odds`:`Decrease ${t.length} resources' odds`},cost:2,initialData:[]},increaseLength:{display:"+length",description:"Increase length",cost:100,initialData:void 0},increaseCaches:{display:"+caches",description:"Increase caches odds",cost:10,initialData:void 0},increaseGens:{display:"+gens",description:"Increase generators odds",cost:10,initialData:void 0},increaseInfluences:{display:"+influences",description:"Increase influences odds",cost:10,initialData:void 0},increaseEnergyMults:{display:"+energy mults",description:"Increase energy mults odds",cost:10,initialData:void 0},increaseResourceMults:{display:"+resource mults",description:"Increase resource mults odds",cost:10,initialData:void 0},increaseDiff:{display:"+diff",description:"Increase difficulty/rewards odds",cost:10,initialData:void 0},decreaseDiff:{display:"-diff",description:"Decrease difficulty/rewards odds",cost:10,initialData:void 0},increaseRewards:{display:"+rewards",description:"Increase rewards level",cost:1e4,initialData:void 0},relic:{display:"+relic",description:"Max length/difficulty, add tier-unique relic",cost:1e6,initialData:void 0}},Ci=m.variable(0).add(8).times(2).pow10(),ue=Fi("main",function(){const e=Si(0,"energy"),t=m.variable(0).add(1),n=S(()=>z.types.resource.nodes.value.reduce((v,d)=>(v[d.state.type]=d,v),{})),i=S(()=>({...z.types.passive.nodes.value.reduce((v,d)=>(v[d.state]=d,v),{}),sand:z.types.dowsing.nodes.value[0],wood:z.types.quarry.nodes.value[0],coal:z.types.empowerer.nodes.value[0],iron:z.types.portalGenerator.nodes.value[0],gold:z.types.booster.nodes.value[0]})),r=S(()=>({...z.types.influence.nodes.value.reduce((v,d)=>(v[d.state.type]=d,v),{})}));function a(v){return Te.value!=null&&de(Te.value)&&Te.value.state.tools.includes(v)}const l=S(()=>Gt.reduce((v,d)=>{var G,ve,_t;const h=(_t=(ve=(G=n.value[d])==null?void 0:G.state)==null?void 0:ve.amount)!=null?_t:0;let x=o.floor(t.invertIntegral(h)).sub(10).clampMin(0),A=Jt(t,x,!0,0);for(;;){const Xe=t.evaluate(x);if(o.add(A,Xe).lte(h))x=x.add(1),A=o.add(A,Xe);else break}return v[d]=x,v},{}));function u(v){var G,ve,_t;const d=(_t=(ve=(G=n.value[v])==null?void 0:G.state)==null?void 0:ve.amount)!=null?_t:0,h=l.value[v],x=Jt(t,h,!0),A=Jt(t,o.add(h,1),!0);return o.sub(d,x).max(0).div(o.sub(A,x)).toNumber()}const c=fn({}),f=fn({});Dt(()=>{Gt.forEach(v=>{nt(()=>l.value[v],(d,h)=>{o.gt(d,h)&&oe.active===K.id&&er.info(g("div",null,[g("h3",null,[o.eq(d,1)?`${ze(v)} discovered`:`${ze(v)} is now Level ${je(d)}`,O("!")]),g("div",null,[O("Energy gain is now 1.01x higher.")])]))})})});const b=S(()=>In.filter(v=>{var d,h;return(h=(d=v.value)==null?void 0:d.state)==null?void 0:h.powered}).length+z.types.portal.nodes.value.filter(v=>v.state.powered).length),p=S(()=>o.eq(b.value,0)?10:o.add(b.value,1).pow_base(100).div(10).times(.99)),w=S(()=>fe.value==null?0:fe.value.state.resources.reduce((d,h)=>o.div(100,vt[h].computedModifier.value).add(d),o.dZero)),C={id:"deselect",icon:"close",tooltip:v=>({text:"tools"in v.state?"Disconnect tools":"Disconnect resources"}),onClick(v){var d;Array.isArray((d=v.state)==null?void 0:d.data)?v.state={...v.state,data:[]}:"resources"in v.state?v.state={...v.state,resources:[]}:"tools"in v.state&&(v.state={...v.state,tools:[]}),z.selectedAction.value=null,z.selectedNode.value=null},visibility:v=>{var d;return Array.isArray((d=v.state)==null?void 0:d.data)?v.state.data.length>0:"resources"in v.state?v.state.resources.length>0:"tools"in v.state?v.state.tools.length>0:!1}},_={id:"toggle",icon:"bolt",tooltip:v=>({text:v.state.powered?"Turn Off":`Turn On - Always runs for ${je(p.value)} energy/s`}),onClick(v){v.state={...v.state,powered:!v.state.powered},z.selectedAction.value=null},fillColor:v=>v.state.powered?"var(--accent1)":"var(--locked)"};function N(v,d=1/0){const h=v(m.variable(0));return{id:"moreConnections",icon:"hub",formula:h,tooltip(x){return{text:`Increase Connections - ${je(h.evaluate(x.state.maxConnections))} energy`}},confirmationLabel:x=>o.gte(e.value,h.evaluate(x.state.maxConnections))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"},onClick(x){const A=h.evaluate(x.state.maxConnections);o.gte(e.value,A)&&(e.value=o.sub(e.value,A)),x.state={...x.state,maxConnections:o.add(x.state.maxConnections,1)},z.selectedAction.value=null},visibility:x=>o.add(x.state.maxConnections,Ze.value).lt(d)}}function E(v,d){var h,x;if(((h=z.draggingNode.value)==null?void 0:h.type)==="resource"){const A=((x=z.draggingNode.value)==null?void 0:x.state).type,{maxConnections:G,resources:ve}=v.state;return ve.includes(A)?{text:"Disconnect",color:"var(--accent2)"}:o.add(G,Ze.value).lte(ve.length)?{text:"Max connections",color:"var(--danger)"}:{text:d(A),color:"var(--accent2)"}}return null}function R(v,d){var h,x;if(((h=z.draggingNode.value)==null?void 0:h.type)==="passive"){const A=(x=z.draggingNode.value)==null?void 0:x.state,{maxConnections:G,tools:ve}=v.state;return ve.includes(A)?{text:"Disconnect",color:"var(--accent2)"}:o.add(G,Ze.value).lte(ve.length)?{text:"Max connections",color:"var(--danger)"}:{text:d(A),color:"var(--accent2)"}}return null}function $(v,d){var h,x;if(((h=z.draggingNode.value)==null?void 0:h.type)==="portal"){const A=((x=z.draggingNode.value)==null?void 0:x.state).id,{maxConnections:G,portals:ve}=v.state;return ve.includes(A)?{text:"Disconnect",color:"var(--accent2)"}:o.add(G,Ze.value).lte(ve.length)?{text:"Max connections",color:"var(--danger)"}:{text:d(A),color:"var(--accent2)"}}return null}function D(v,d){if(d.type!=="resource")return!1;const h=d.state.type,{maxConnections:x,resources:A}=v.state;return A.includes(h)?!0:!o.add(x,Ze.value).lte(A.length)}function U(v,d){if(d.type!=="resource")return;const h=d.state.type,x=v.state.resources;x.includes(h)?v.state={...v.state,resources:x.filter(A=>A!==h)}:v.state={...v.state,resources:[...x,h]},z.selectedNode.value=v}function he(v,d){if(d.type!=="passive")return!1;const h=d.state,{maxConnections:x,tools:A}=v.state;return A.includes(h)?!0:!o.add(x,Ze.value).lte(A.length)}function ie(v,d){if(d.type!=="passive")return;const h=d.state,x=v.state.tools;x.includes(h)?v.state={...v.state,tools:x.filter(A=>A!==h)}:v.state={...v.state,tools:[...x,h]},z.selectedNode.value=v}function J(v,d){if(d.type!=="portal")return!1;const h=d.state.id,{maxConnections:x,portals:A}=v.state;return A.includes(h)?!0:!o.add(x,Ze.value).lte(A.length)}function Q(v,d){if(d.type!=="portal")return;const h=d.state.id,{portals:x}=v.state;x.includes(h)?v.state={...v.state,tools:x.filter(A=>A!==h)}:v.state={...v.state,tools:[...x,h]},z.selectedNode.value=v}const z=Ql(v=>({startNodes:()=>[{position:{x:0,y:0},type:"mine",state:{progress:0,powered:!1}},{position:{x:0,y:-200},type:"brokenFactory"}],types:{mine:{shape:Ve.Diamond,size:50,title:"\u{1FAA8}",label:d=>d===v.selectedNode.value?{text:"Mining"}:Object.keys(n.value).length===0?{text:"Click me!"}:null,actionDistance:Math.PI/4,actions:[_],progress:d=>de(d)?new o(d.state.progress).toNumber():0,progressDisplay:ln.Outline,progressColor:"var(--accent2)",classes:d=>({running:de(d)}),draggable:!0},brokenFactory:{shape:Ve.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:d=>d===v.selectedNode.value?{text:"Broken Forge"}:null,actionDistance:Math.PI/4,actions:[{id:"repair",icon:"build",tooltip:{text:"Repair - 100 energy"},onClick(d){o.gte(e.value,100)&&(d.type="factory",e.value=o.sub(e.value,100))},confirmationLabel:()=>o.gte(e.value,1e3)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}}],draggable:!0},factory:{shape:Ve.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:d=>{var h,x;if(d===v.selectedNode.value)return{text:d.state==null?"Forge - Drag a resource to me!":`Forging ${Pe[d.state].name}`};if(((h=v.draggingNode.value)==null?void 0:h.type)==="resource"){const A=((x=v.draggingNode.value)==null?void 0:x.state).type,G=d.state===A?"Disconnect":Pe[A].name,ve=d.state===A||o.gte(e.value,Pe[A].cost)&&i.value[A]==null?"var(--accent2)":"var(--danger)";return{text:G,color:ve}}return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect resource"},onClick(d){d.state=void 0,v.selectedAction.value=null,v.selectedNode.value=null},visibility:d=>d.state!=null},{id:"craft",icon:"done",tooltip:d=>({text:`Forge ${Pe[d.state].name} - ${je(Pe[d.state].cost)} energy`}),onClick(d){const h=Pe[d.state];if(o.gte(e.value,h.cost)&&i.value[d.state]==null){e.value=o.sub(e.value,h.cost);const x={id:qn(v),position:{...d.position},type:h.type,state:"state"in h?h.state:void 0};v.placeInAvailableSpace(x),v.nodes.value.push(x),v.selectedAction.value=null,v.selectedNode.value=null,d.state=void 0}},fillColor:d=>o.gte(e.value,Pe[d.state].cost)&&i.value[d.state]==null?"var(--accent2)":"var(--danger)",visibility:d=>d.state!=null,confirmationLabel:d=>o.gte(e.value,Pe[d.state].cost)?i.value[d.state]==null?{text:"Tap again to confirm"}:{text:"Already crafted",color:"var(--danger)"}:{text:"Cannot afford",color:"var(--danger)"}}],progress:d=>d.state==null||i.value[d.state]!=null?0:o.div(e.value,Pe[d.state].cost).clampMax(1).toNumber(),progressDisplay:ln.Fill,progressColor:d=>d.state!=null&&o.gte(e.value,Pe[d.state].cost)?"var(--accent2)":"var(--foreground)",canAccept(d,h){return h.type==="resource"},onDrop(d,h){const x=h.state.type;d.state===x?d.state=void 0:d.state=x,v.selectedNode.value=d},draggable:!0},resource:{shape:Ve.Circle,size:50,title:d=>ze(d.state.type),subtitle:d=>je(d.state.amount),progress:d=>u(d.state.type),onClick(){},progressDisplay:ln.Outline,progressColor:"var(--accent3)",classes:d=>{var h;return{"affected-node":ce.value!=null&&de(ce.value)&&ce.value.state.resources.includes(d.state.type)||o.neq((h=Ot.value[d.state.type])!=null?h:1,1)}},draggable:!0},passive:{shape:Ve.Circle,size:50,title:d=>Pe[d.state].name,label:d=>d===v.selectedNode.value?{text:tr[d.state].description(a(d.state))}:null,outlineColor:"var(--bought)",classes:d=>({"affected-node":a(d.state)}),draggable:!0},dowsing:{shape:Ve.Diamond,size:50,title:"\u{1F962}",label:d=>d===v.selectedNode.value?{text:d.state.resources.length===0?"Dowsing - Drag a resource to me!":`Dowsing (${d.state.resources.length}/${o.add(d.state.maxConnections,Ze.value)})`}:E(d,h=>`Double ${h} odds`),actionDistance:Math.PI/4,actions:[C,N(d=>d.add(2).pow_base(100),16),_],classes:d=>({running:de(d)}),canAccept:D,onDrop:U,draggable:!0},quarry:{shape:Ve.Diamond,size:50,title:"\u26CF\uFE0F",label:d=>d===v.selectedNode.value?{text:d.state.resources.length===0?"Quarry - Drag a resource to me!":`Quarrying (${d.state.resources.length}/${o.add(d.state.maxConnections,Ze.value)})`}:E(d,h=>`Gather ${cn(o.div(vt[h].computedModifier.value,100))} ${h}/s`),actionDistance:Math.PI/4,actions:[C,N(d=>d.add(2).pow_base(1e4),16),_],progress:d=>de(d)?o.eq(w.value,0)?0:new o(d.state.progress).div(w.value).toNumber():0,progressDisplay:ln.Outline,progressColor:"var(--accent2)",canAccept:D,onDrop:U,classes:d=>({running:de(d)}),draggable:!0},empowerer:{shape:Ve.Diamond,size:50,title:"\u{1F50C}",label:d=>d===v.selectedNode.value?{text:d.state.tools.length===0?"Empowerer - Drag a tool to me!":`Empowering (${d.state.tools.length}/${o.add(d.state.maxConnections,Ze.value)})`}:R(d,h=>h.includes("Relic")?`Double ${ri[h.slice(0,-5)]}'s effect`:`Double ${Pe[h].name}'s effect`),actionDistance:Math.PI/4,actions:[C,N(d=>d.add(3).pow_base(1e3),16),_],canAccept:he,onDrop:ie,classes:d=>({running:de(d)}),draggable:!0},portalGenerator:{shape:Ve.Diamond,size:50,title:"\u26E9\uFE0F",label:d=>{if(d===v.selectedNode.value)return{text:d.state.tier==null?"Portal Spawner - Drag a resource to me!":`Spawning ${d.state.tier}-tier portal`};const h=v.draggingNode.value;if((h==null?void 0:h.type)==="resource"){const x=h.state.type;return{text:d.state.tier===x?"Disconnect":`${ze(x)}-tier Portal`,color:"var(--accent2)"}}else if((h==null?void 0:h.type)==="influence"){const x=h.state.type,{influences:A}=d.state;return A.includes(x)?{text:"Disconnect",color:"var(--accent2)"}:{text:"Add influence",color:"var(--accent2)"}}return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect all"},onClick(d){d.state={...d.state,tier:void 0,influences:[]},v.selectedAction.value=null,v.selectedNode.value=null},visibility:d=>{const{tier:h,influences:x}=d.state;return h!=null||x.length>0}},{id:"makePortal",icon:"done",tooltip:d=>({text:`Spawn ${d.state.tier}-tier portal`}),onClick(d){let h=0;for(;`portal-${h}`in Ce;)h++;const{tier:x,influences:A}=d.state;Ai(Tr(`portal-${h}`,x,Math.floor(Math.random()*4294967296),A.map(ve=>r.value[ve].state)),K);const G={id:qn(v),position:{...d.position},type:"portal",state:{id:`portal-${h}`,powered:!1}};v.placeInAvailableSpace(G),v.nodes.value.push(G),v.selectedAction.value=null,v.selectedNode.value=null,d.state={tier:void 0,influences:[]}},visibility:d=>d.state.tier!=null}],canAccept(d,h){return h.type==="resource"||h.type==="influence"},onDrop(d,h){if(h.type==="resource"){const x=h.state.type,A=d.state.tier;d.state={...d.state,tier:x===A?void 0:x}}else if(h.type==="influence"){const x=h.state.type,A=d.state.influences;A.includes(x)?d.state={...d.state,influences:A.filter(G=>G!==x)}:d.state={...d.state,influences:[...A,x]}}v.selectedNode.value=d},draggable:!0},portal:{shape:Ve.Diamond,size:50,title:"\u{1F300}",label:d=>d===v.selectedNode.value?{text:`Portal to ${Ce[d.state.id].name}`,color:Ce[d.state.id].color}:null,actionDistance:Math.PI/4,actions:[_],classes:d=>({running:de(d),showNotif:Ce[d.state.id].showNotif.value}),outlineColor:d=>Ce[d.state.id].background,draggable:!0},influence:{shape:d=>d.state.type==="increaseResources"||d.state.type==="decreaseResources"?Ve.Diamond:Ve.Circle,size:50,title:d=>Ct[d.state.type].display,label:d=>{if(d===v.selectedNode.value){const x=d.state,A=Ct[x.type].description;return{text:typeof A=="function"?A(x):A}}const h=v.draggingNode.value;if((h==null?void 0:h.type)==="resource"){const x=h.state.type,{type:A,data:G}=d.state;let ve;if(Array.isArray(G)&&G.includes(x))ve="Disconnect";else if(A==="increaseResources")ve=`Increase ${ze(x)} odds`;else if(A==="decreaseResources")ve=`Decrease ${ze(x)} odds`;else return null;return{text:ve,color:"var(--accent2)"}}return null},actionDistance:Math.PI/4,actions:[C],canAccept:(d,h)=>h.type!=="resource"?!1:Array.isArray(d.state.data),onDrop:(d,h)=>{if(h.type!=="resource")return;const x=h.state.type,A=d.state.data;A!=null&&(A.includes(x)?d.state={...d.state,data:A.filter(G=>G!==x)}:d.state={...d.state,data:[...A,x]},v.selectedNode.value=d)},outlineColor:"var(--danger)",draggable:!0},booster:{shape:Ve.Diamond,size:50,title:"\u231B",label:d=>d===v.selectedNode.value?{text:d.state.portals.length===0?"Booster - Drag a portal to me!":`Boosting by ${je(o.add(1,d.state.level))}x (${d.state.tools.length}/${o.add(d.state.maxConnections,Ze.value)})`}:$(d,h=>`Boost ${Ce[h].name}'s speed`),actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect portals"},onClick(d){d.state={...d.state,portals:[]},v.selectedAction.value=null,v.selectedNode.value=null},visibility:d=>{var h,x;return(x=(h=d.state)==null?void 0:h.portals.length)!=null?x:0>0}},N(d=>d.add(6).pow_base(1e3)),{id:"increaseBoost",icon:"arrow_upward",tooltip(d){return{text:`Increase boost - ${je(Ci.evaluate(d.state.level))} energy`}},confirmationLabel(d){return o.gte(e.value,Ci.evaluate(d.state.level))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}},onClick(d){const h=Ci.evaluate(d.state.level);o.gte(e.value,h)&&(e.value=o.sub(e.value,h)),d.state={...d.state,level:o.add(d.state.level,1)},v.selectedAction.value=null}},_],canAccept:J,onDrop:Q,classes:d=>({running:de(d)}),draggable:!0}},style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden"},links(){const d=[];if(d.push(...Object.keys(c).map(h=>({startNode:W.value,endNode:n.value[h],stroke:"var(--accent3)",strokeWidth:5}))),ye.value!=null&&ye.value.state!=null&&d.push({startNode:ye.value,endNode:n.value[ye.value.state],stroke:"var(--foreground)",strokeWidth:4}),ce.value!=null&&ce.value.state.resources.forEach(h=>{d.push({startNode:ce.value,endNode:n.value[h],stroke:de(ce.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),fe.value!=null&&fe.value.state.resources.forEach(h=>{d.push({startNode:fe.value,endNode:n.value[h],stroke:"var(--foreground)",strokeWidth:4})}),d.push(...Object.keys(f).map(h=>({startNode:fe.value,endNode:n.value[h],stroke:"var(--accent3)",strokeWidth:5}))),Te.value!=null&&Te.value.state.tools.forEach(h=>{d.push({startNode:Te.value,endNode:i.value[h],stroke:de(Te.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),He.value!=null){const h=He.value.state;h.tier!=null&&d.push({startNode:He.value,endNode:n.value[h.tier],stroke:"var(--foreground)",strokeWidth:4}),h.influences.forEach(x=>{d.push({startNode:He.value,endNode:r.value[x],stroke:"var(--foreground)",strokeWidth:4})}),v.types.portal.nodes.value.forEach(x=>{const A=Ce[x.state.id];return A.links.value.forEach(G=>{G.value!=null&&d.push({startNode:x,endNode:G.value,stroke:de(x)?"var(--accent3)":"var(--foreground)",strokeWidth:4})}),Object.keys(A.resourceMultis.value).forEach(G=>{G!=="energy"&&G in n.value&&d.push({startNode:x,endNode:n.value[G],stroke:de(x)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),d})}return Ke.value!=null&&Ke.value.state.portals.forEach(h=>{d.push({startNode:Ke.value,endNode:v.types.portal.nodes.value.find(x=>x.state.id===h),stroke:de(Ke.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),Object.values(r.value).forEach(h=>{const x=h.state;(x.type==="increaseResources"||x.type==="decreaseResources")&&x.data.forEach(A=>{d.push({startNode:h,endNode:n.value[A],stroke:"var(--foreground)",strokeWidth:4})})}),d}}));function de(v){return v===z.selectedNode.value||v.state.powered}const W=S(()=>z.types.mine.nodes.value[0]),ye=S(()=>z.types.factory.nodes.value[0]),ce=S(()=>i.value.sand),fe=S(()=>i.value.wood),Te=S(()=>i.value.coal),He=S(()=>i.value.iron),Ke=S(()=>i.value.gold),In=[W,ce,fe,Te,Ke];function vn(v,d){let h=n.value[v];if(d=o.times(d,qe[v].computedModifier.value),h==null)h={id:qn(z),position:{...W.value.position},type:"resource",state:{type:v,amount:d}},z.placeInAvailableSpace(h),z.nodes.value.push(h);else{const x=h.state;h.state={...x,amount:o.add(x.amount,d)}}}const xn=S(()=>Object.keys(et).reduce((v,d)=>v+new o(vt[d].computedModifier.value).toNumber(),0)),Ot=S(()=>{const v={};return z.types.portal.nodes.value.forEach(d=>{if(!de(d))return;const x=Ce[d.state.id].resourceMultis.value;Object.keys(x).forEach(A=>{v[A]!=null?v[A]=o.times(v[A],x[A]):v[A]=x[A]})}),v}),Un=Nt(()=>[...Gt.map(v=>Re(()=>({description:()=>`${ze(v)} (Lv. ${je(l.value[v])}) (${cn(wt.value)}x per level)`,multiplier:()=>o.pow(wt.value,l.value[v]),enabled:()=>{var d,h;return v in n.value&&o.gt((h=(d=n.value[v].state)==null?void 0:d.amount)!=null?h:0,0)}}))),Re(()=>({multiplier:()=>a("stone")?4:2,description:()=>(a("stone")?"Empowered ":"")+Pe.stone.name,enabled:()=>i.value.stone!=null})),Re(()=>({multiplier:()=>{var v;return(v=Ot.value.energy)!=null?v:1},description:"Planar Treasures",enabled:()=>{var v;return o.neq((v=Ot.value.energy)!=null?v:1,1)}})),un(()=>({addend:()=>o.pow(100,b.value).div(10).neg(),description:"Powered Machines (100^n/10 energy/s)",enabled:()=>o.gt(b.value,0)}))]),$n=S(()=>Un.apply(1)),Gn=Nt(()=>[un(()=>({addend:()=>a("unobtainium")?2:1,description:()=>(a("unobtainium")?"Empowered ":"")+Pe.unobtainium.name,enabled:()=>i.value.unobtainium!=null}))]),Ze=S(()=>Gn.apply(0)),It=Nt(()=>[Re(()=>({multiplier:()=>a("dirt")?4:2,description:()=>(a("dirt")?"Empowered ":"")+Pe.dirt.name,enabled:()=>i.value.dirt!=null}))]),pi=S(()=>It.apply(1)),q=Nt(()=>[Re(()=>({multiplier:()=>a("gravel")?4:2,description:()=>(a("gravel")?"Empowered ":"")+Pe.gravel.name,enabled:()=>i.value.gravel!=null}))]),V=S(()=>q.apply(1)),Ie=Nt(()=>[un(()=>({addend:()=>a("copper")?.002:.001,description:()=>(a("copper")?"Empowered ":"")+Pe.copper.name,enabled:()=>i.value.copper!=null}))]),wt=S(()=>Ie.apply(1.01)),vt=Object.keys(et).reduce((v,d)=>{const h=Nt(()=>[Re(()=>({multiplier:2,description:"Dowsing",enabled:()=>ce.value!=null&&de(ce.value)&&ce.value.state.resources.includes(d)}))]),x=S(()=>h.apply(et[d])),A={title:`${ze(d)} Drop Rate`,modifier:h,base:et[d]};return v[d]={modifier:h,computedModifier:x,section:A},v},{}),qe=Object.keys(et).reduce((v,d)=>{const h=Nt(()=>[Re(()=>({multiplier:()=>{var G;return(G=Ot.value[d])!=null?G:1},description:"Planar Treasures",enabled:()=>{var G;return o.neq((G=Ot.value[d])!=null?G:1,1)}}))]),x=S(()=>h.apply(1)),A={title:`${ze(d)} Gain`,modifier:h};return v[d]={modifier:h,computedModifier:x,section:A},v},{}),[Rt,xt]=Rn(()=>[{title:"Energy Gain",modifier:Un,base:1,unit:"/s"},{title:"Bonus Connections",modifier:Gn,base:0}]),[qt,Be]=Rn(()=>[{title:"Mining Speed",modifier:It,base:1,unit:"/s",visible:()=>i.value.dirt!=null},{title:"Ore Dropped",modifier:q,base:1,visible:()=>i.value.gravel!=null},{title:"Material Level Effect",modifier:Ie,base:1.01,visible:()=>i.value.copper!=null}]),[$t,Xt]=Rn(()=>Object.values(vt).map(v=>v.section)),[gi,En]=Rn(()=>Object.values(qe).map(v=>v.section)),ht=lu({general:()=>({display:"General",glowColor(){return ht.activeTab.value===this.tab?"white":""},tab:Rt,energyTabCollapsed:xt}),mining:()=>({display:"Mine",glowColor(){return ht.activeTab.value===this.tab?"white":""},visibility:()=>Object.keys(i.value).length>0,tab:qt,miningTabCollapsed:Be}),resources:()=>({display:"Mine Rates",glowColor(){return ht.activeTab.value===this.tab?"white":""},visibility:()=>ce.value!=null,tab:$t,resourcesCollapsed:Xt}),resourcesGain:()=>({display:"Resource Gain",glowColor(){return ht.activeTab.value===this.tab?"white":""},visibility:()=>Object.values(qe).some(v=>o.neq(v.computedModifier.value,1)),tab:gi,resourceGainCollapsed:En})}),Tn=B(!1),Qt=te(()=>g(Ft,{modelValue:Tn.value,"onUpdate:modelValue":v=>Tn.value=v},{header:()=>g("h2",null,[O("Modifiers")]),body:()=>Je(ht)}));this.on("preUpdate",v=>{if(Object.keys(c).forEach(d=>{c[d]-=v,c[d]<=0&&delete c[d]}),Object.keys(f).forEach(d=>{f[d]-=v,f[d]<=0&&delete f[d]}),de(W.value)){const d=o.add(W.value.state.progress,o.times(pi.value,v)),h=d.floor();W.value.state={...W.value.state,progress:o.sub(d,h)};const x=h.div(xn.value).floor();x.gt(0)&&Gt.forEach(G=>{vn(G,o.times(new o(vt[G].computedModifier.value).toNumber(),x).times(V.value)),c[G]=.3});const A=o.sub(h,x).toNumber();for(let G=0;G<A;G++){const ve=Math.floor(Math.random()*xn.value);let _t=0;for(let Xe=0;Xe<Gt.length;Xe++){const Dn=Gt[Xe];if(_t+=new o(vt[Dn].computedModifier.value).toNumber(),ve<_t){vn(Dn,V.value),c[Dn]=.3;break}}}}if(fe.value!=null&&de(fe.value)){const{progress:d,resources:h}=fe.value.state;if(h.length>0){let x=o.add(d,v);const A=o.div(d,w.value).floor();x=o.sub(x,o.times(A,w.value)),fe.value.state={...fe.value.state,progress:x},o.gt(A,0)&&h.forEach(G=>{vn(G,A),f[G]=.3})}}e.value=o.add(e.value,o.times($n.value,v)),o.lt(e.value,0)&&(e.value=0,W.value.state={...W.value.state,powered:!1},er.warning(g("div",null,[g("h3",null,[O("Ran out of energy!")]),g("div",null,[O("All machines have been turned off.")])])))});const ot=S(()=>{var v,d;return z.selectedAction.value===z.types.brokenFactory.actions[0]?-100:z.selectedAction.value===z.types.factory.actions[1]?o.neg(Pe[z.selectedNode.value.state].cost):((v=z.selectedAction.value)==null?void 0:v.id)==="moreConnections"?o.neg(z.selectedAction.value.formula.evaluate(((d=z.selectedNode.value)==null?void 0:d.state).maxConnections)):0}),Se=hn(m.variable(0).add(e),()=>o.neq(ot.value,0),ot),lt=S(()=>{var v;return z.selectedAction.value===_?((v=z.selectedNode.value)==null?void 0:v.state).powered?o.eq(b.value,1)?10:o.pow(100,b.value).div(10).times(.99):o.neg(p.value):0}),en=hn(m.variable(0).add($n),()=>o.neq(lt.value,0),lt),Wn=S(()=>z.types.portal.nodes.value.filter(v=>de(v)));return nt(Wn,v=>{Dt(()=>{K.tabs=["main",...v.map(d=>d.state.id)]})}),nt(Ze,(v,d)=>{if(o.lt(v,d)){if(ce.value){const h=ce.value.state.maxConnections;o.lt(ce.value.state.resources.length,o.add(h,v))&&(ce.value.state={...ce.value.state,resources:ce.value.state.resources.slice(0,o.add(h,v).toNumber())})}if(fe.value){const h=fe.value.state.maxConnections;o.lt(fe.value.state.resources.length,o.add(h,v))&&(fe.value.state={...fe.value.state,resources:fe.value.state.resources.slice(0,o.add(h,v).toNumber())})}if(Te.value){const h=Te.value.state.maxConnections;o.lt(Te.value.state.tools.length,o.add(h,v))&&(Te.value.state={...Te.value.state,resources:Te.value.state.tools.slice(0,o.add(h,v).toNumber())})}if(Ke.value){const h=Ke.value.state.maxConnections;o.lt(Ke.value.state.portals.length,o.add(h,v))&&(Ke.value.state={...Ke.value.state,resources:Ke.value.state.portals.slice(0,o.add(h,v).toNumber())})}}}),{name:"World",board:z,energy:e,modifierTabs:ht,mineLootTable:et,tools:Pe,passives:tr,resourceNodes:n,toolNodes:i,influenceNodes:r,grantResource:vn,activePortals:Wn,isEmpowered:a,display:te(()=>g(ae,null,[g(ni,{class:"nav-container"},{default:()=>[g("span",{class:"nav-segment"},[g("h2",{style:"color: white; text-shadow: 0px 0px 10px white;"},[Je(Se)])," ",O("energy")]),g("span",{class:"nav-segment"},[O("("),g("h3",{style:"color: white; text-shadow: 0px 0px 10px white;"},[o.gt($n.value,0)?"+":"",Je(en)]),O("/s)")]),o.gt(b.value,0)?g("span",{class:"nav-segment"},[g("h3",{style:"color: var(--accent1); text-shadow: 0px 0px 10px var(--accent1);"},[je(b.value)])," ",O("machines powered")]):null,g("span",{class:"nav-segment"},[g("button",{class:"button",style:"display: inline",onClick:()=>Tn.value=!0},[O("modifiers")])]),K.devSpeed===0?g("span",{class:"nav-segment"},[O("Game Paused")]):K.devSpeed!=null&&K.devSpeed!==1?g("span",{class:"nav-segment"},[O("Dev Speed: "),cn(K.devSpeed),O("x")]):null]}),Je(z),Je(Qt)]))}}),hd=e=>{var i,r,a,l,u;const t=[ue];let n=0;for(;`portal-${n}`in((i=e.layers)!=null?i:{});){const c=(r=e.layers)==null?void 0:r[`portal-${n}`];t.push(Tr(`portal-${n}`,(a=c.tier)!=null?a:"dirt",(l=c.seed)!=null?l:Math.floor(Math.random()*4294967296),(u=c.influences)!=null?u:[])),n++}return t},Dr=S(()=>!1);function bd(e,t){}var yd=Object.freeze(Object.defineProperty({__proto__:null,mineLootTable:et,resourceNames:Gt,relics:ri,influences:Ct,main:ue,getInitialLayers:hd,hasWon:Dr,fixOldSave:bd},Symbol.toStringTag,{value:"Module"}));const zn=e=>(pn("data-v-4a50ce42"),e=e(),gn(),e),wd={class:"game-over-modal-header"},_d=["src","alt"],Nd={class:"game-over-modal-title"},Cd=zn(()=>k("h2",null,"Congratulations!",-1)),kd={key:0},Md=zn(()=>k("br",null,null,-1)),Sd=zn(()=>k("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),Id=zn(()=>k("br",null,null,-1)),xd=["href"],$d=zn(()=>k("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),Ed=X({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:i,discordLink:r,versionNumber:a,versionTitle:l}=ge,u=S(()=>oi(K.timePlayed)),c=S(()=>Dr.value&&!K.keepGoing),f=Kt(K,"autosave");function b(){K.keepGoing=!0}function p(){sn(yn())}return(w,C)=>(I(),ne(Ft,{"model-value":s(c)},{header:H(()=>[k("div",wd,[s(n)?(I(),T("img",{key:0,class:"game-over-modal-logo",src:s(n),alt:s(t)},null,8,_d)):j("",!0),k("div",Nd,[Cd,k("h4",null,"You've beaten "+re(s(t))+" v"+re(s(a))+": "+re(s(l)),1)])])]),body:H(({shown:_})=>[_?(I(),T("div",kd,[k("div",null,"It took you "+re(s(u))+" to beat the game.",1),Md,Sd,Id,k("div",null,[k("a",{href:s(r),class:"game-over-modal-discord-link"},[$d,O(" "+re(s(i)),1)],8,xd)]),g(Et,{title:"Autosave",modelValue:s(f),"onUpdate:modelValue":C[0]||(C[0]=N=>De(f)?f.value=N:null)},null,8,["modelValue"])])):j("",!0)]),footer:H(()=>[k("div",{class:"game-over-footer"},[k("button",{onClick:b,class:"button"},"Keep Going"),k("button",{onClick:p,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var Td=me(Ed,[["__scopeId","data-v-4a50ce42"]]);const fi=e=>(pn("data-v-2776d67d"),e=e(),gn(),e),Dd=fi(()=>k("div",{class:"nan-modal-header"},[k("h2",null,"NaN value detected!")],-1)),Pd={key:0},Fd=fi(()=>k("br",null,null,-1)),Ad=["href"],Od=fi(()=>k("span",{class:"material-icons nan-modal-discord"},"discord",-1)),Rd=fi(()=>k("br",null,null,-1)),qd={class:"nan-footer"},Vd=X({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=ge,i=B(!0),r=B(!0),a=Kt(Fe,"hasNaN"),l=B(null);nt(a,w=>{w?(i.value=K.autosave,r.value=K.devSpeed===0):(K.autosave=i.value,K.devSpeed=r.value?0:null)});const u=S(()=>{var w;return(w=Fe.NaNPath)==null?void 0:w.join(".")}),c=S(()=>Fe.NaNPersistent!=null?Fe.NaNPersistent.value:null);function f(){Fe.NaNPersistent!=null&&(Fe.NaNPersistent.value=new o(0),Fe.hasNaN=!1)}function b(){Fe.NaNPersistent&&(Fe.NaNPersistent.value=new o(1),Fe.hasNaN=!1)}function p(){Fe.NaNPersistent&&(Fe.NaNPersistent.value=new o(NaN),Fe.hasNaN=!1)}return(w,C)=>(I(),T(ae,null,[g(Ft,Pt({modelValue:s(a),"onUpdate:modelValue":C[4]||(C[4]=_=>De(a)?a.value=_:null)},w.$attrs),{header:H(()=>[Dd]),body:H(()=>[k("div",null,[O(' Attempted to assign "'+re(s(u))+'" to NaN',1),s(c)?(I(),T("span",Pd,re(" ")+"(previously "+re(s(cn)(s(c)))+")",1)):j("",!0),O(". Auto-saving has been "+re(i.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),Fd,k("div",null,[k("a",{href:s(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[Od,O(" "+re(s(t)||"The Paper Pilot Community"),1)],8,Ad)]),Rd,g(Et,{title:"Autosave",modelValue:i.value,"onUpdate:modelValue":C[0]||(C[0]=_=>i.value=_)},null,8,["modelValue"]),s(ge).enablePausing?(I(),ne(Et,{key:0,title:"Pause game",modelValue:r.value,"onUpdate:modelValue":C[1]||(C[1]=_=>r.value=_)},null,8,["modelValue"])):j("",!0)]),footer:H(()=>[k("div",qd,[k("button",{onClick:C[2]||(C[2]=_=>{var N;return(N=l.value)==null?void 0:N.open()}),class:"button"},"Open Saves Manager"),k("button",{onClick:f,class:"button"},"Set to 0"),k("button",{onClick:b,class:"button"},"Set to 1"),s(c)&&s(o).neq(s(c),0)&&s(o).neq(s(c),1)?(I(),T("button",{key:0,onClick:C[3]||(C[3]=_=>a.value=!1),class:"button"}," Set to previous ")):j("",!0),k("button",{onClick:p,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),g(_r,{ref_key:"savesManager",ref:l},null,512)],64))}});var Ld=me(Vd,[["__scopeId","data-v-2776d67d"]]);const Bd={key:0,class:"tpsDisplay"},jd={key:0,class:"low"},zd=X({__name:"TPS",setup(e){const t=S(()=>o.div(Fe.lastTenTicks.length,Fe.lastTenTicks.reduce((a,l)=>a+l,0))),n=B([]);pt(()=>{n.value.push(Math.round(t.value.toNumber())),n.value.length>10&&(n.value=n.value.slice(1))});const i=S(()=>n.value.reduce((a,l)=>o.max(a,l),0)),r=S(()=>o.sub(t.value,i.value).gt(1));return(a,l)=>s(t).isNan()?j("",!0):(I(),T("div",Bd,[O(" TPS: "+re(s(je)(s(t)))+" ",1),g(_n,{name:"fade"},{default:H(()=>[s(r)?(I(),T("span",jd,re(s(je)(s(i))),1)):j("",!0)]),_:1})]))}});var Ud=me(zd,[["__scopeId","data-v-46a3ed5b"]]);var Gd=X({__name:"App",setup(e){const t=ge.useHeader,n=S(()=>bt[oe.theme].variables),i=Kt(oe,"showTPS"),r=S(()=>le(te(()=>g(ae,null,[as.map(Je)]))));return(a,l)=>(I(),T(ae,null,[k("div",{id:"modal-root",style:Ue(s(n))},null,4),k("div",{class:be(["app",{useHeader:s(t)}]),style:Ue(s(n))},[s(t)?(I(),ne(Nr,{key:0})):j("",!0),g(_l),s(s(i))?(I(),ne(Ud,{key:1})):j("",!0),g(Td),g(Ld),(I(),ne(Le(s(r))))],6)],64))}});var Wd=me(Gd,[["__scopeId","data-v-41d15e5e"]]);function Hd(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:l}=e;let u,c,f,b;const p=async(C=!0)=>{await f,C&&(u==null||u.addEventListener("controlling",_=>{_.isUpdate&&window.location.reload()})),await(b==null?void 0:b())};async function w(){if("serviceWorker"in navigator){const{Workbox:C,messageSW:_}=await Vn(()=>import("./workbox-window.4a8794bb.js"),[]);b=async()=>{c&&c.waiting&&await _(c.waiting,{type:"SKIP_WAITING"})},u=new C("./sw.js",{scope:"./",type:"classic"}),u.addEventListener("activated",N=>{N.isUpdate||i==null||i()});{const N=()=>{n==null||n()};u.addEventListener("waiting",N),u.addEventListener("externalwaiting",N)}u.register({immediate:t}).then(N=>{c=N,a?a("./sw.js",N):r==null||r(N)}).catch(N=>{l==null||l(N)})}}return f=w(),p}function Zd(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:l}=e,u=B(!1),c=B(!1);return{updateServiceWorker:Hd({immediate:t,onNeedRefresh(){u.value=!0,n==null||n()},onOfflineReady(){c.value=!0,i==null||i()},onRegistered:r,onRegisteredSW:a,onRegisterError:l}),offlineReady:c,needRefresh:u}}document.title=ge.title;window.projInfo=ge;if(ge.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 Qa();const{globalBus:e}=await Vn(()=>Promise.resolve().then(function(){return Ka}),void 0),{startGameLoop:t}=await Vn(()=>import("./gameLoop.d7a7e16a.js"),["assets/gameLoop.d7a7e16a.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","assets/unique-names-generator.5494b30b.js"]),n=window.vue=Gr(Wd);e.emit("setupVue",n),n.mount("#app"),Dt(()=>{const i=si(),{updateServiceWorker:r}=Zd({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,Vn as _,Fe as a,ge as b,yd as c,Ge as g,es as l,K as p,oe as s};