Planar-Pioneers/assets/index.352dc0ae.js

18 lines
144 KiB
JavaScript

/* empty css */import"./vue.804e2479.js";import{_ as E,C as a,l as fe,q as ct,t as F,b2 as xe,ab as W,aD as dn,w as Ie,b3 as Le,a9 as y,O as Q,az as Dt,as as Qe,aF as _,a1 as I,aL as Be,a2 as m,aH as kt,A as de,$ as G,b7 as A,b9 as Wt,ar as Te,bv as st,a8 as D,bt as Un,bc as lt,T as jn,u as Gt,j as Wn,bw as tn,aM as Et,a0 as P,aO as we,J as H,G as oe,I as Me,aI as et,aG as tt,z as Re,bo as Gn,bs as Hn,aK as ut,bd as nn,am as $t,H as Zn,bf as Yn}from"./@vue.6f8187b0.js";import{c as gn}from"./nanoevents.1080beb7.js";import{L as Oe}from"./lz-string.dccec454.js";import{Y as Jn}from"./vue-next-select.f5f69b1a.js";import{D as Kn}from"./vuedraggable.ce650350.js";import{p as Xn}from"./vue-textarea-autosize.35804eaf.js";import{P as Qn}from"./vue-panzoom.89be130f.js";import{s as ei,u as fn}from"./vue-toastification.5231d1bd.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 ti=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 o of r)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerpolicy&&(o.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?o.credentials="include":r.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}};ti();const ni="modulepreload",rn={},ii="./",vt=function(t,n){return!n||n.length===0?t():Promise.all(n.map(i=>{if(i=`${ii}${i}`,i in rn)return;rn[i]=!0;const r=i.endsWith(".css"),o=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${o}`))return;const s=document.createElement("link");if(s.rel=r?"stylesheet":ni,r||(s.as="script",s.crossOrigin=""),s.href=i,document.head.appendChild(s),r)return new Promise((l,c)=>{s.addEventListener("load",l),s.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())},ri="./projInfo-schema.json",ai="Planar Pioneers",oi="A game about controlling and exploiting planes!",si="planar-pioneers",li="thepaperpilot",ui="",ci="",di="0.0",gi="Initial Commit",fi=!0,mi=!1,hi=2,vi=!0,pi=null,bi="",yi=["main"],_i=3600,wi=0,Ni=!0,Ci="base64";var Y={$schema:ri,title:ai,description:oi,id:si,author:li,discordName:ui,discordLink:ci,versionNumber:di,versionTitle:gi,allowGoBack:fi,defaultShowSmall:mi,defaultDecimalsShown:hi,useHeader:vi,banner:pi,logo:bi,initialTabs:yi,maxTickLength:_i,offlineLimit:wi,enablePausing:Ni,exportEncoding:Ci};class Si{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 ki(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 ki{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const zt=17,Ii=9e15,xi=Math.log10(9e15),Mi=1/9e15,Ei=308,$i=-324,an=5,Ti=(1<<10)-1,Fi=function(){const e=[];for(let n=$i+1;n<=Ei;n++)e.push(Number("1e"+n));const t=323;return function(n){return e[n+t]}}(),We=[2,Math.E,3,4,5,6,7,8,9,10],Pi=[[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]],Vi=[[-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 v=function(t){return u.fromValue_noAlloc(t)},B=function(e,t,n){return u.fromComponents(e,t,n)},j=function(t,n,i){return u.fromComponents_noNormalize(t,n,i)};const Ve=function(t,n){const i=n+1,r=Math.ceil(Math.log10(Math.abs(t))),o=Math.round(t*Math.pow(10,i-r))*Math.pow(10,r-i);return parseFloat(o.toFixed(Math.max(i-r,0)))},Ut=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},Di=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},mn=.5671432904097838,on=function(e,t=1e-10){let n,i;if(!Number.isFinite(e)||e===0)return e;if(e===1)return mn;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 sn(e,t=1e-10){let n,i,r,o;if(!Number.isFinite(e.mag)||e.eq(u.dZero))return e;if(e.eq(u.dOne))return u.fromNumber(mn);n=u.ln(e);for(let s=0;s<100;++s){if(i=n.neg().exp(),r=n.sub(e.mul(i)),o=n.sub(r.div(n.add(1).sub(n.add(2).mul(r).div(u.mul(2,n).add(2))))),u.abs(o.sub(n)).lt(u.abs(o).mul(t)))return o;n=o}throw Error(`Iteration failed to converge: ${e.toString()}`)}const g=class{constructor(e){this.sign=0,this.mag=0,this.layer=0,e instanceof g?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/Fi(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 g().fromComponents(e,t,n)}static fromComponents_noNormalize(e,t,n){return new g().fromComponents_noNormalize(e,t,n)}static fromMantissaExponent(e,t){return new g().fromMantissaExponent(e,t)}static fromMantissaExponent_noNormalize(e,t){return new g().fromMantissaExponent_noNormalize(e,t)}static fromDecimal(e){return new g().fromDecimal(e)}static fromNumber(e){return new g().fromNumber(e)}static fromString(e){return new g().fromString(e)}static fromValue(e){return new g().fromValue(e)}static fromValue_noAlloc(e){if(e instanceof g)return e;if(typeof e=="string"){const t=g.fromStringCache.get(e);return t!==void 0?t:g.fromString(e)}else return typeof e=="number"?g.fromNumber(e):g.dZero}static abs(e){return v(e).abs()}static neg(e){return v(e).neg()}static negate(e){return v(e).neg()}static negated(e){return v(e).neg()}static sign(e){return v(e).sign}static sgn(e){return v(e).sign}static round(e){return v(e).round()}static floor(e){return v(e).floor()}static ceil(e){return v(e).ceil()}static trunc(e){return v(e).trunc()}static add(e,t){return v(e).add(t)}static plus(e,t){return v(e).add(t)}static sub(e,t){return v(e).sub(t)}static subtract(e,t){return v(e).sub(t)}static minus(e,t){return v(e).sub(t)}static mul(e,t){return v(e).mul(t)}static multiply(e,t){return v(e).mul(t)}static times(e,t){return v(e).mul(t)}static div(e,t){return v(e).div(t)}static divide(e,t){return v(e).div(t)}static recip(e){return v(e).recip()}static reciprocal(e){return v(e).recip()}static reciprocate(e){return v(e).reciprocate()}static cmp(e,t){return v(e).cmp(t)}static cmpabs(e,t){return v(e).cmpabs(t)}static compare(e,t){return v(e).cmp(t)}static isNaN(e){return e=v(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag)}static isFinite(e){return e=v(e),isFinite(e.sign)&&isFinite(e.layer)&&isFinite(e.mag)}static eq(e,t){return v(e).eq(t)}static equals(e,t){return v(e).eq(t)}static neq(e,t){return v(e).neq(t)}static notEquals(e,t){return v(e).notEquals(t)}static lt(e,t){return v(e).lt(t)}static lte(e,t){return v(e).lte(t)}static gt(e,t){return v(e).gt(t)}static gte(e,t){return v(e).gte(t)}static max(e,t){return v(e).max(t)}static min(e,t){return v(e).min(t)}static minabs(e,t){return v(e).minabs(t)}static maxabs(e,t){return v(e).maxabs(t)}static clamp(e,t,n){return v(e).clamp(t,n)}static clampMin(e,t){return v(e).clampMin(t)}static clampMax(e,t){return v(e).clampMax(t)}static cmp_tolerance(e,t,n){return v(e).cmp_tolerance(t,n)}static compare_tolerance(e,t,n){return v(e).cmp_tolerance(t,n)}static eq_tolerance(e,t,n){return v(e).eq_tolerance(t,n)}static equals_tolerance(e,t,n){return v(e).eq_tolerance(t,n)}static neq_tolerance(e,t,n){return v(e).neq_tolerance(t,n)}static notEquals_tolerance(e,t,n){return v(e).notEquals_tolerance(t,n)}static lt_tolerance(e,t,n){return v(e).lt_tolerance(t,n)}static lte_tolerance(e,t,n){return v(e).lte_tolerance(t,n)}static gt_tolerance(e,t,n){return v(e).gt_tolerance(t,n)}static gte_tolerance(e,t,n){return v(e).gte_tolerance(t,n)}static pLog10(e){return v(e).pLog10()}static absLog10(e){return v(e).absLog10()}static log10(e){return v(e).log10()}static log(e,t){return v(e).log(t)}static log2(e){return v(e).log2()}static ln(e){return v(e).ln()}static logarithm(e,t){return v(e).logarithm(t)}static pow(e,t){return v(e).pow(t)}static pow10(e){return v(e).pow10()}static pow_base(e,t){return v(e).pow_base(t)}static root(e,t){return v(e).root(t)}static factorial(e,t){return v(e).factorial()}static gamma(e,t){return v(e).gamma()}static lngamma(e,t){return v(e).lngamma()}static exp(e){return v(e).exp()}static sqr(e){return v(e).sqr()}static sqrt(e){return v(e).sqrt()}static cube(e){return v(e).cube()}static cbrt(e){return v(e).cbrt()}static tetrate(e,t=2,n=j(1,0,1)){return v(e).tetrate(t,n)}static iteratedexp(e,t=2,n=j(1,0,1)){return v(e).iteratedexp(t,n)}static iteratedlog(e,t=10,n=1){return v(e).iteratedlog(t,n)}static layeradd10(e,t){return v(e).layeradd10(t)}static layeradd(e,t,n=10){return v(e).layeradd(t,n)}static slog(e,t=10){return v(e).slog(t)}static lambertw(e){return v(e).lambertw()}static ssqrt(e){return v(e).ssqrt()}static pentate(e,t=2,n=j(1,0,1)){return v(e).pentate(t,n)}static sin(e){return v(e).sin()}static cos(e){return v(e).cos()}static tan(e){return v(e).tan()}static asin(e){return v(e).asin()}static acos(e){return v(e).acos()}static atan(e){return v(e).atan()}static sinh(e){return v(e).sinh()}static cosh(e){return v(e).cosh()}static tanh(e){return v(e).tanh()}static asinh(e){return v(e).asinh()}static acosh(e){return v(e).acosh()}static atanh(e){return v(e).atanh()}static affordGeometricSeries(e,t,n,i){return this.affordGeometricSeries_core(v(e),v(t),v(n),i)}static sumGeometricSeries(e,t,n,i){return this.sumGeometricSeries_core(e,v(t),v(n),i)}static affordArithmeticSeries(e,t,n,i){return this.affordArithmeticSeries_core(v(e),v(t),v(n),v(i))}static sumArithmeticSeries(e,t,n,i){return this.sumArithmeticSeries_core(v(e),v(t),v(n),v(i))}static efficiencyOfPurchase(e,t,n){return this.efficiencyOfPurchase_core(v(e),v(t),v(n))}static randomDecimalForTesting(e){if(Math.random()*20<1)return j(0,0,0);const t=Math.random()>.5?1:-1;if(Math.random()*20<1)return j(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)),B(t,n,r)}static affordGeometricSeries_core(e,t,n,i){const r=t.mul(n.pow(i));return g.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(g.sub(1,n.pow(e))).div(g.sub(1,n))}static affordArithmeticSeries_core(e,t,n,i){const o=t.add(i.mul(n)).sub(n.div(2)),s=o.pow(2);return o.neg().add(s.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<Mi)return this.layer+=1,this.mag=Math.log10(this.mag),this;let e=Math.abs(this.mag),t=Math.sign(this.mag);if(e>=Ii)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e<xi&&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=g.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const i=e.split("^^^");if(i.length===2){const S=parseFloat(i[0]),p=parseFloat(i[1]),T=i[1].split(";");let U=1;if(T.length===2&&(U=parseFloat(T[1]),isFinite(U)||(U=1)),isFinite(S)&&isFinite(p)){const w=g.pentate(S,p,U);return this.sign=w.sign,this.layer=w.layer,this.mag=w.mag,g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this}}const r=e.split("^^");if(r.length===2){const S=parseFloat(r[0]),p=parseFloat(r[1]),T=r[1].split(";");let U=1;if(T.length===2&&(U=parseFloat(T[1]),isFinite(U)||(U=1)),isFinite(S)&&isFinite(p)){const w=g.tetrate(S,p,U);return this.sign=w.sign,this.layer=w.layer,this.mag=w.mag,g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this}}const o=e.split("^");if(o.length===2){const S=parseFloat(o[0]),p=parseFloat(o[1]);if(isFinite(S)&&isFinite(p)){const T=g.pow(S,p);return this.sign=T.sign,this.layer=T.layer,this.mag=T.mag,g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this}}e=e.trim().toLowerCase();let s,l,c=e.split("pt");if(c.length===2){s=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let S=parseFloat(c[1]);if(isFinite(S)||(S=1),isFinite(s)&&isFinite(l)){const p=g.tetrate(s,l,S);return this.sign=p.sign,this.layer=p.layer,this.mag=p.mag,g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this}}if(c=e.split("p"),c.length===2){s=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let S=parseFloat(c[1]);if(isFinite(S)||(S=1),isFinite(s)&&isFinite(l)){const p=g.tetrate(s,l,S);return this.sign=p.sign,this.layer=p.layer,this.mag=p.mag,g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this}}const f=e.split("e"),b=f.length-1;if(b===0){const S=parseFloat(e);if(isFinite(S))return this.fromNumber(S),g.fromStringCache.size>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this}else if(b===1){const S=parseFloat(e);if(isFinite(S)&&S!==0)return this.fromNumber(S),g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this}const h=e.split("e^");if(h.length===2){this.sign=1,h[0].charAt(0)=="-"&&(this.sign=-1);let S="";for(let p=0;p<h[1].length;++p){const T=h[1].charCodeAt(p);if(T>=43&&T<=57||T===101)S+=h[1].charAt(p);else return this.layer=parseFloat(S),this.mag=parseFloat(h[1].substr(p+1)),this.normalize(),g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this}}if(b<1)return this.sign=0,this.layer=0,this.mag=0,g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this;const C=parseFloat(f[0]);if(C===0)return this.sign=0,this.layer=0,this.mag=0,g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this;let N=parseFloat(f[f.length-1]);if(b>=2){const S=parseFloat(f[f.length-2]);isFinite(S)&&(N*=Math.sign(S),N+=Ut(S))}if(!isFinite(C))this.sign=f[0]==="-"?-1:1,this.layer=b,this.mag=N;else if(b===1)this.sign=Math.sign(C),this.layer=1,this.mag=N+Math.log10(Math.abs(C));else if(this.sign=Math.sign(C),this.layer=b,b===2){const S=g.mul(B(1,2,N),v(C));return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this}else this.mag=N;return this.normalize(),g.fromStringCache.maxSize>=1&&g.fromStringCache.set(t,g.fromDecimal(this)),this}fromValue(e){return e instanceof g?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:Ve(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Ve(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<=an?(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):Ve(this.m,e)+"e"+Ve(this.e,e):this.layer===1?Ve(this.m,e)+"e"+Ve(this.e,e):this.layer<=an?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Ve(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Ve(this.mag,e)}abs(){return j(this.sign===0?0:1,this.layer,this.mag)}neg(){return j(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?g.dZero:this.layer===0?B(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?g.dZero:this.layer===0?B(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?g.dZero:this.layer===0?B(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?g.dZero:this.layer===0?B(this.sign,0,Math.trunc(this.mag)):this}add(e){const t=v(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 j(0,0,0);let n,i;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(g.cmpabs(this,t)>0?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return g.fromNumber(n.sign*n.mag+i.sign*i.mag);const r=n.layer*Math.sign(n.mag),o=i.layer*Math.sign(i.mag);if(r-o>=2)return n;if(r===0&&o===-1){if(Math.abs(i.mag-Math.log10(n.mag))>zt)return n;{const s=Math.pow(10,Math.log10(n.mag)-i.mag),l=i.sign+n.sign*s;return B(Math.sign(l),1,i.mag+Math.log10(Math.abs(l)))}}if(r===1&&o===0){if(Math.abs(n.mag-Math.log10(i.mag))>zt)return n;{const s=Math.pow(10,n.mag-Math.log10(i.mag)),l=i.sign+n.sign*s;return B(Math.sign(l),1,Math.log10(i.mag)+Math.log10(Math.abs(l)))}}if(Math.abs(n.mag-i.mag)>zt)return n;{const s=Math.pow(10,n.mag-i.mag),l=i.sign+n.sign*s;return B(Math.sign(l),1,i.mag+Math.log10(Math.abs(l)))}}plus(e){return this.add(e)}sub(e){return this.add(v(e).neg())}subtract(e){return this.sub(e)}minus(e){return this.sub(e)}mul(e){const t=v(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer))return t;if(this.sign===0||t.sign===0)return j(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return j(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 g.fromNumber(n.sign*i.sign*n.mag*i.mag);if(n.layer>=3||n.layer-i.layer>=2)return B(n.sign*i.sign,n.layer,n.mag);if(n.layer===1&&i.layer===0)return B(n.sign*i.sign,1,n.mag+Math.log10(i.mag));if(n.layer===1&&i.layer===1)return B(n.sign*i.sign,1,n.mag+i.mag);if(n.layer===2&&i.layer===1){const r=B(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(B(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return B(n.sign*i.sign,r.layer+1,r.sign*r.mag)}if(n.layer===2&&i.layer===2){const r=B(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(B(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return B(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=v(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?g.dNaN:this.layer===0?B(this.sign,0,1/this.mag):B(this.sign,this.layer,-this.mag)}reciprocal(){return this.recip()}reciprocate(){return this.recip()}cmp(e){const t=v(e);return this.sign>t.sign?1:this.sign<t.sign?-1:this.sign*this.cmpabs(e)}cmpabs(e){const t=v(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=v(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=v(e);return this.lt(t)?t:this}min(e){const t=v(e);return this.gt(t)?t:this}maxabs(e){const t=v(e);return this.cmpabs(t)<0?t:this}minabs(e){const t=v(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=v(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=v(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=Ut(r)),this.layer<n.layer&&(i=Ut(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=v(e);return!this.eq_tolerance(n,t)&&this.lt(n)}lte_tolerance(e,t){const n=v(e);return this.eq_tolerance(n,t)||this.lt(n)}gt_tolerance(e,t){const n=v(e);return!this.eq_tolerance(n,t)&&this.gt(n)}gte_tolerance(e,t){const n=v(e);return this.eq_tolerance(n,t)||this.gt(n)}pLog10(){return this.lt(g.dZero)?g.dZero:this.log10()}absLog10(){return this.sign===0?g.dNaN:this.layer>0?B(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):B(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?g.dNaN:this.layer>0?B(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):B(this.sign,0,Math.log10(this.mag))}log(e){return e=v(e),this.sign<=0||e.sign<=0||e.sign===1&&e.layer===0&&e.mag===1?g.dNaN:this.layer===0&&e.layer===0?B(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):g.div(this.log10(),e.log10())}log2(){return this.sign<=0?g.dNaN:this.layer===0?B(this.sign,0,Math.log2(this.mag)):this.layer===1?B(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?B(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):B(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?g.dNaN:this.layer===0?B(this.sign,0,Math.log(this.mag)):this.layer===1?B(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?B(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):B(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}logarithm(e){return this.log(e)}pow(e){const t=v(e),n=this,i=t;if(n.sign===0)return i.eq(0)?j(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(i.sign===0)return j(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:g.dNaN:r}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return g.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 B(1,0,t);if(e.sign===0)return g.dOne;e=j(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?B(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?B(-e.sign,e.layer+1,-e.mag):g.dOne}pow_base(e){return v(e).pow(this)}root(e){const t=v(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?g.exp(g.mul(this,g.ln(this).sub(1))):g.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(j(1,0,24)))return g.fromNumber(Di(this.sign*this.mag));const e=this.mag-1;let t=.9189385332046727;t=t+(e+.5)*Math.log(e),t=t-e;const n=e*e;let i=e,r=12*i,o=1/r,s=t+o;if(s===t||(t=s,i=i*n,r=360*i,o=1/r,s=t-o,s===t))return g.exp(t);t=s,i=i*n,r=1260*i;let l=1/r;return t=t+l,i=i*n,r=1680*i,l=1/r,t=t-l,g.exp(t)}else return this.layer===1?g.exp(g.mul(this,g.ln(this).sub(1))):g.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?g.dOne:this.layer===0&&this.mag<=709.7?g.fromNumber(Math.exp(this.sign*this.mag)):this.layer===0?B(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?B(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):B(1,this.layer+1,this.sign*this.mag)}sqr(){return this.pow(2)}sqrt(){if(this.layer===0)return g.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return B(1,2,Math.log10(this.mag)-.3010299956639812);{const e=g.div(j(this.sign,this.layer-1,this.mag),j(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=j(1,0,1)){if(e===1)return g.pow(this,t);if(e===0)return new g(t);if(this.eq(g.dOne))return g.dOne;if(this.eq(-1))return g.pow(this,t);if(e===Number.POSITIVE_INFINITY){const r=this.toNumber();if(r<=1.444667861009766&&r>=.06598803584531254){if(r>1.444667861009099)return g.fromNumber(Math.E);const o=g.ln(this).neg();return o.lambertw().div(o)}else return r>1.444667861009766?g.fromNumber(Number.POSITIVE_INFINITY):g.dNaN}if(this.eq(g.dZero)){let r=Math.abs((e+1)%2);return r>1&&(r=2-r),g.fromNumber(r)}if(e<0)return g.iteratedlog(t,this,-e);t=v(t);const n=e;e=Math.trunc(e);const i=n-e;if(this.gt(g.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let r=0;r<e;++r){const o=t;if(t=this.pow(t),o.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(g.dOne)?this.gt(10)?t=this.pow(i):(t=g.fromNumber(g.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 j(t.sign,t.layer+(e-r-1),t.mag);if(r>1e4)return t}return t}iteratedexp(e=2,t=j(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return g.tetrate(e,-t,this);e=v(e);let n=g.fromDecimal(this);const i=t;t=Math.trunc(t);const r=i-t;if(n.layer-e.layer>3){const o=Math.min(t,n.layer-e.layer-3);t-=o,n.layer-=o}for(let o=0;o<t;++o){if(n=n.log(e),!isFinite(n.layer)||!isFinite(n.mag))return n.normalize();if(o>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,o=this.slog_internal(e).toNumber();for(let s=1;s<t;++s){const c=new g(e).tetrate(o).gt(this);if(s>1&&r!=c&&(i=!0),r=c,i?n/=2:n*=2,n=Math.abs(n)*(c?-1:1),o+=n,n===0)break}return g.fromNumber(o)}slog_internal(e=10){if(e=v(e),e.lte(g.dZero)||e.eq(g.dOne))return g.dNaN;if(e.lt(g.dOne))return this.eq(g.dOne)?g.dZero:this.eq(g.dZero)?g.dNegOne:g.dNaN;if(this.mag<0||this.eq(g.dZero))return g.dNegOne;let t=0,n=g.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(g.dZero))n=g.pow(e,n),t-=1;else{if(n.lte(g.dOne))return g.fromNumber(t+g.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=g.log(n,e)}return g.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:g.critical_section(e,t,Vi)}static tetrate_critical(e,t){return g.critical_section(e,t,Pi)}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 s=0;s<We.length;++s)if(We[s]==e){i=n[s][Math.floor(t)],r=n[s][Math.ceil(t)];break}else if(We[s]<e&&We[s+1]>e){const l=(e-We[s])/(We[s+1]-We[s]);i=n[s][Math.floor(t)]*(1-l)+n[s+1][Math.floor(t)]*l,r=n[s][Math.ceil(t)]*(1-l)+n[s+1][Math.ceil(t)]*l;break}const o=t-Math.floor(t);return i<=0||r<=0?i*(1-o)+r*o:Math.pow(e,Math.log(i)/Math.log(e)*(1-o)+Math.log(r)/Math.log(e)*o)}layeradd10(e){e=g.fromValue_noAlloc(e).toNumber();const t=g.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?g.tetrate(t,i):Number.isFinite(i)?i>=-1?g.log(g.tetrate(t,i+1),t):g.log(g.log(g.tetrate(t,i+2),t),t):g.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return g.fromNumber(on(this.toNumber()));if(this.layer===0)return g.fromNumber(on(this.sign*this.mag));if(this.layer===1)return sn(this);if(this.layer===2)return sn(this);if(this.layer>=3)return j(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return j(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=j(1,0,1)){t=v(t);const n=e;e=Math.trunc(e);const i=n-e;i!==0&&(t.eq(g.dOne)?(++e,t=g.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?g.fromNumber(Math.sin(this.sign*this.mag)):j(0,0,0)}cos(){return this.mag<0?g.dOne:this.layer===0?g.fromNumber(Math.cos(this.sign*this.mag)):j(0,0,0)}tan(){return this.mag<0?this:this.layer===0?g.fromNumber(Math.tan(this.sign*this.mag)):j(0,0,0)}asin(){return this.mag<0?this:this.layer===0?g.fromNumber(Math.asin(this.sign*this.mag)):j(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?g.fromNumber(Math.acos(this.toNumber())):this.layer===0?g.fromNumber(Math.acos(this.sign*this.mag)):j(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?g.fromNumber(Math.atan(this.sign*this.mag)):g.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 g.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return g.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?j(Number.NaN,Number.NaN,Number.NaN):g.ln(this.add(1).div(g.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(g.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 u=g;u.fromStringCache=new Si(Ti);u.dZero=j(0,0,0);u.dOne=j(1,0,1);u.dNegOne=j(-1,0,1);u.dTwo=j(1,0,2);u.dTen=j(1,0,10);u.dNaN=j(Number.NaN,Number.NaN,Number.NaN);u.dInf=j(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);u.dNegInf=j(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);u.dNumberMax=B(1,0,Number.MAX_VALUE);u.dNumberMin=B(1,0,Number.MIN_VALUE);v=u.fromValue_noAlloc;B=u.fromComponents;j=u.fromComponents_noNormalize;u.fromMantissaExponent;u.fromMantissaExponent_noNormalize;const Oi=new u(1);function ft(e,t,n=!0){let i=u.log10(e).floor(),r=u.div(e,u.pow(10,i));r.toStringWithDecimalPlaces(t)==="10"&&(r=Oi,i=i.add(1));const o=i.gte(1e9)?ke(i,Math.max(Math.max(t,3),Y.defaultDecimalsShown)):i.gte(1e4)?Tt(i,0):i.toStringWithDecimalPlaces(0);return n?r.toStringWithDecimalPlaces(t)+"e"+o:"e"+o}function Tt(e,t){if(e==null)return"NaN";if(e=new u(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 hn(e,t){return e==null?"NaN":(e=new u(e),e.mag<1e-4?0 .toFixed(t):(e.mag<.1&&t!==0&&(t=Math.max(Math.max(t,e.log10().negate().ceil().toNumber()),Y.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const Ai=new u("eeee1000"),Li=new u("e100000"),ln=new u("e1000"),vn=new u(1e9),Bi=new u(1e6),qi=new u(1e3),Ri=new u(.98),zi=new u(.001),pn=new u(0);function ke(e,t,n){if(t==null&&(t=Y.defaultDecimalsShown),n=n!=null?n:Y.defaultShowSmall,e=new u(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+ke(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(Ai)){const i=e.slog();return i.gte(Bi)?"F"+ke(i.floor()):u.pow(10,i.sub(i.floor())).toStringWithDecimalPlaces(3)+"F"+Tt(i.floor(),0)}else{if(e.gte(Li))return ft(e,0,!1);if(e.gte(ln))return ft(e,0);if(e.gte(vn))return ft(e,t);if(e.gte(qi))return Tt(e,0);if(e.gte(zi)||!n)return hn(e,t);if(e.eq(pn))return 0 .toFixed(t)}return e=yn(e),e.lt(ln)?ft(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):ke(e,t)+"\u207B\xB9"}function Ce(e){return e=new u(e),e.sign<0?"-"+Ce(e.neg()):e.gte(vn)||e.lte(Ri)&&!e.eq(pn)?ke(e):ke(e,0)}function bn(e){return u.lt(e,0)?"-"+bn(u.neg(e)):u.gt(e,2**51)?ke(u.div(e,31536e3))+"y":(e=new u(e).toNumber(),e<60?ke(e)+"s":e<3600?Ce(Math.floor(e/60))+"m "+ke(e%60)+"s":e<86400?Ce(Math.floor(e/3600))+"h "+Ce(Math.floor(e/60)%60)+"m "+Ce(e%60)+"s":e<31536e3?Ce(Math.floor(e/84600)%365)+"d "+Ce(Math.floor(e/3600)%24)+"h "+Ce(Math.floor(e/60)%60)+"m":Ce(Math.floor(e/31536e3))+"y "+Ce(Math.floor(e/84600)%365)+"d "+Ce(Math.floor(e/3600)%24)+"h")}function Ui(e,t,n){e=new u(e);let i=e.toStringWithDecimalPlaces(t);return new u(i).gte(n)&&(i=u.sub(n,Math.pow(.1,t)).toStringWithDecimalPlaces(t)),i}function ji(e,t){return ke(e,t,!0)}function yn(e){let t=u.log10(e).ceil();const n=u.div(e,u.pow(10,t));return t=t.neg(),e=new u(10).pow(t).times(n),e}var Wi=Object.freeze(Object.defineProperty({__proto__:null,default:u,exponentialFormat:ft,commaFormat:Tt,regularFormat:hn,format:ke,formatWhole:Ce,formatTime:bn,toPlaces:Ui,formatSmall:ji,invertOOM:yn},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:Gi,commaFormat:Hi,regularFormat:Zi,format:Ot,formatWhole:it,formatTime:Ht,toPlaces:Yi,formatSmall:rt,invertOOM:Ji}=Wi;window.Decimal=u;window.exponentialFormat=Gi;window.commaFormat=Hi;window.regularFormat=Zi;window.format=Ot;window.formatWhole=it;window.formatTime=Ht;window.toPlaces=Yi;window.formatSmall=rt;window.invertOOM=Ji;function xt(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function Ft(e){return typeof e=="function"}var re=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(re||{});const pt=Symbol("DoNotCache");function O(e,t){const n=e[t];Ft(n)&&n.length===0&&!n[pt]?e[t]=E(n.bind(e)):Ft(n)&&(e[t]=n.bind(e),e[t][pt]=!0)}function Se(e){return Ft(e)&&!e[pt]&&(e=E(e)),e}const bt=Symbol("Component"),At=Symbol("GatherProps");let Ki=0;function _n(e="feature-"){return e+Ki++}var Fe=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(Fe||{});function ze(e){const t=a(e);return t!==2&&t!==!1}function Lt(e){return a(e)===1}function ne(e){return e[pt]=!0,e}function ge(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}function Xi(e,...t){const n=[],i=r=>{Object.keys(r).forEach(o=>{const s=r[o];s!=null&&typeof s=="object"&&(t.includes(s.type)?n.push(s):!(s instanceof u)&&!fe(s)&&i(s))})};return i(e),n}const Ge={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 Zt=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(Zt||{}),Ee={classic:Ge,paper:{...Ge,variables:{...Ge.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:{...Ge,variables:{...Ge.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:{...Ge,variables:{...Ge.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}};const ye=gn();"fonts"in document&&(document.fonts.onloadingdone=()=>ye.emit("fontsLoaded"));var Qi=Object.freeze(Object.defineProperty({__proto__:null,globalBus:ye},Symbol.toStringTag,{value:"Module"}));const er=ct({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var z=window.player=er;function wn(e){return JSON.stringify(e,(t,n)=>a(n))}function Nn(e={}){return Object.assign({id:`${Y.id}-0`,name:"Default Save",tabs:Y.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:Y.id,modVersion:Y.versionNumber,layers:{}},e)}function _e(e){const t=Oe.compressToUTF16(wn(e!=null?e:z));return localStorage.setItem((e!=null?e:z).id,t),t}async function tr(){rr();try{let e=localStorage.getItem(K.active);if(e==null){await Ze(at());return}if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Oe.decompressFromUTF16(e);else throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==Y.id){await Ze(at());return}t.id=K.active,await Ze(t)}catch(e){console.error(`Failed to load save. Falling back to new save.
`,e),await Ze(at())}}function at(){const e=Mt(),t=Nn({id:e});return _e(t),K.saves.push(e),t}function Mt(){let e,t=0;do e=`${Y.id}-${t++}`;while(localStorage.getItem(e)!=null);return e}const nr=F(!1);async function Ze(e){console.info("Loading save",e),nr.value=!0;const{layers:t,removeLayer:n,addLayer:i}=await vt(()=>Promise.resolve().then(function(){return Cr}),void 0),{fixOldSave:r,getInitialLayers:o}=await vt(()=>Promise.resolve().then(function(){return Ql}),void 0);for(const s in t){const l=t[s];l&&n(l)}o(e).forEach(s=>i(s,e)),e=Nn(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,Y.offlineLimit*3600)),e.time=Date.now(),e.modVersion!==Y.versionNumber&&(r(e.modVersion,e),e.modVersion=Y.versionNumber),Object.assign(z,e),K.active=z.id,ye.emit("onLoad")}setInterval(()=>{z.autosave&&_e()},1e3);window.onbeforeunload=()=>{z.autosave&&_e()};window.save=_e;const ir=window.hardReset=async()=>{await Ze(at())};window.deleteLowerSaves=()=>{const e=Object.values(K.saves).indexOf(z.id)+1;Object.values(K.saves).slice(e).forEach(t=>localStorage.removeItem(t)),K.saves=K.saves.slice(0,e)};const yt=ct({active:"",saves:[],showTPS:!0,theme:Zt.Nordic,unthrottled:!1,alignUnits:!1});xe(yt,e=>{const t=Oe.compressToUTF16(JSON.stringify(e));localStorage.setItem(Y.id,t)},{deep:!0});var K=window.settings=yt;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:Zt.Nordic,alignUnits:!1};ye.emit("loadSettings",e),Object.assign(yt,e),ir()};function rr(){try{let e=localStorage.getItem(Y.id);if(e!=null&&e!==""){if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Oe.decompressFromUTF16(e);else{console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(yt,t)}ye.emit("loadSettings",yt)}catch{}}const ar=ct([]),or=ct([]),sr=ct([]);function me(e,t="span"){return typeof e=="function"?W({render:e}):typeof e=="string"?e.length>0?(e=e.trim(),e.charAt(0)!=="<"&&(e=`<${t}>${e}</${t}>`),W({template:e})):W({render:()=>({})}):e}function De(e){if(Ke(e))return typeof e=="function"?e():me(e);const t=e[bt];return y(t,e[At](),null)}function qe(e){if(Ke(e))return typeof e=="function"?e():typeof e=="string"?y(Q,null,[e]):y(e,null,null);const t=e[bt];return y(t,e[At](),null)}function Ke(e){return typeof e=="string"?!0:typeof e=="object"?e==null?!1:"render"in e||"component"in e:typeof e=="function"&&e[pt]===!0}function Cn(e,t){const n=F(null),i=F(void 0);function r(l){n.value||(n.value=setInterval(s,250)),i.value=l}function o(){n.value&&(clearInterval(n.value),n.value=null)}function s(){t&&t.value?t.value():e&&e.value&&e.value(i.value)}return dn(o),{start:r,stop:o,handleHolding:s}}function Sn(e,t="div"){const n=Ie();return Le(()=>{n.value=me(pe(e),t)}),n}function Nt(e,t="div"){const n=Ie(null);return Le(()=>{const i=pe(e);n.value=i==""||i==null?null:me(i,t)}),n}function pe(e){return a(a(e))}function R(...e){return e.includes(Object)||e.push(Object),e}var X=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};const lr=W({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var b;const n=F({}),i=new ResizeObserver(l),r=F(null);Dt(()=>{const h=r.value;h!=null&&i.observe(h)});let o=!0,s=F((b=r.value)==null?void 0:b.getBoundingClientRect());function l(){o&&(o=!1,Qe(()=>{var h;s.value=(h=r.value)==null?void 0:h.getBoundingClientRect(),Object.values(n.value).filter(C=>C).forEach(C=>C.rect=C.element.getBoundingClientRect()),t("updateNodes",n.value),o=!0}))}ye.on("fontsLoaded",l);const c={attributes:!1,childList:!0,subtree:!1};kt(Yt,(h,C)=>{const N=new MutationObserver(()=>f(h));N.observe(C,c),n.value[h]={element:C,observer:N,rect:C.getBoundingClientRect()},l()}),kt(Jt,h=>{var C;(C=n.value[h])==null||C.observer.disconnect(),n.value[h]=void 0,l()}),kt(Kt,n),kt(Xt,s);function f(h){const C=n.value[h];C!=null&&(C.rect=C.element.getBoundingClientRect(),t("updateNodes",n.value))}return(h,C)=>(_(),I(Q,null,[Be(h.$slots,"default",{},void 0,!0),m("div",{ref_key:"resizeListener",ref:r,class:"resize-listener"},null,512)],64))}});var kn=X(lr,[["__scopeId","data-v-2b1dc1bc"]]);const ur=["onPointerdown"],cr={class:"modal-wrapper"},dr={class:"modal-container"},gr={class:"modal-header"},fr={class:"modal-body"},mr={class:"modal-footer"},hr=m("div",{class:"modal-default-flex-grow"},null,-1),Ue=W({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const r=de(e),o=E(()=>a(r.modelValue)||l.value);function s(){n("update:modelValue",!1)}const l=F(!1),c=F(null),f=E(()=>{var b,h;return(h=(b=c.value)==null?void 0:b.nodes)!=null?h:null});return t({isOpen:o,nodes:f}),(b,h)=>(_(),G(jn,{to:"#modal-root"},[y(lt,{name:"modal",onBeforeEnter:h[0]||(h[0]=C=>l.value=!0),onAfterLeave:h[1]||(h[1]=C=>l.value=!1)},{default:A(()=>[Wt(m("div",Te({class:"modal-mask",onPointerdown:st(s,["self"])},b.$attrs),[m("div",cr,[m("div",dr,[m("div",gr,[Be(b.$slots,"header",{shown:a(o)},()=>[D(" default header ")])]),m("div",fr,[y(kn,{ref_key:"contextRef",ref:c},{default:A(()=>[Be(b.$slots,"body",{shown:a(o)},()=>[D(" default body ")])]),_:3},512)]),m("div",mr,[Be(b.$slots,"footer",{shown:a(o)},()=>[m("div",{class:"modal-default-footer"},[hr,m("button",{class:"button modal-default-button",onClick:s}," Close ")])])])])])],16,ur),[[Un,e.modelValue]])]),_:3})]))}}),He=Symbol("ProxyState");function Ct(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(o,s){if(s===He)return r();const l=r()[s];return l!=null&&typeof l=="object"&&Ae in l?l[Ae]:l},set(o,s,l){return r()[s]=l,!0},has(o,s){return s===He?!0:Reflect.has(r(),s)},ownKeys(){return Reflect.ownKeys(r())},getOwnPropertyDescriptor(o,s){return i||(Object.assign(n,e.call(n,n)),i=!0),Object.getOwnPropertyDescriptor(o,s)}})}var ue=window.state=Gt({lastTenTicks:[],hasNaN:!1,NaNPath:[]});const ot=Symbol("PersistentState"),_t=Symbol("DefaultValue"),Pt=Symbol("StackTrace"),Vt=Symbol("Deleted"),Ae=Symbol("NonPersistent"),Ye=Symbol("SaveDataPath"),vr=Symbol("SkipPersistence");function pr(){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 un(e,t){var n;if(u.isNaN(t))throw ue.hasNaN||(z.autosave=!1,ue.hasNaN=!0,ue.NaNPath=e[Ye],ue.NaNPersistent=e),console.error("Attempted to save NaN value to",(n=e[Ye])==null?void 0:n.join("."),e),new Error("Attempted to set NaN value. See above for details");e[ot].value=t}function dt(e,t=!0){const n=fe(e)?e:F(e);fe(e)&&(e=e.value);const i=E({get(){return n.value},set(o){t?un(r,o):r[ot].value=o}});i[_t]=e;const r={get value(){return n.value},set value(o){t?un(r,o):r[ot].value=o},__v_isRef:!0,[ot]:n,[_t]:e,[Pt]:pr(),[Vt]:!1,[Ae]:i,[Ye]:void 0};return be.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",r,`
Created at:
`+r[Pt]):Xe[be[be.length-1]].add(r),r}function br(e){return e!=null&&typeof e=="object"&&ot in e}function yr(e){be.length===0?console.warn("Deleting a persistent ref outside of a layer. Ignoring...",e):Xe[be[be.length-1]].delete(e),e[Vt]=!0}ye.on("addLayer",(e,t)=>{const n=[],i=(r,o=[])=>{let s=!1;return Object.keys(r).forEach(l=>{let c=r[l];if(c!=null&&typeof c=="object"){if(c[vr]===!0)return;if(He in c&&(c=c[He]),br(c)){if(s=!0,c[Vt]){console.warn("Deleted persistent ref present in returned object. Ignoring...",c,`
Created at:
`+c[Pt]);return}Xe[e.id].delete(c);const f=[e.id,...o,l];c[Ye]!=null&&JSON.stringify(f)!==JSON.stringify(c[Ye])&&console.error(`Persistent ref is being saved to \`${f.join(".")}\` when it's already present at \`${c[Ye].join(".")}\`. This can cause unexpected behavior when loading saves between updates.`,c),c[Ye]=f;const b=o.reduce((C,N)=>(N in C||(C[N]={}),C[N]),t),h=b[l];b[l]=c[ot],Wn(b)?h!=null?b[l]=h:b[l]=c[_t]:h!=null?b[l].value=h:b[l].value=c[_t]}else!(c instanceof u)&&!fe(c)&&!n.includes(c)&&(typeof c.type=="symbol"&&n.push(c),i(c,[...o,l])&&(tn(c)&&!tn(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.",He in r?r[He]:r,l):s=!0))}}),s};i(e[He]),Xe[e.id].forEach(r=>{r[Vt]||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[Pt])}),Xe[e.id].clear()});const Yt=Symbol("RegisterNode"),Jt=Symbol("UnregisterNode"),Kt=Symbol("Nodes"),Xt=Symbol("Bounds"),ve=Gt({});window.layers=ve;const Xe={},be=[];function In(e,t){return Ct(()=>{const n={},i=n.emitter=gn();if(n.on=i.on.bind(i),n.emit=i.emit.bind(i),n.nodes=F({}),n.id=e,be.push(e),Xe[e]=new Set,n.minimized=dt(!1,!1),Object.assign(n,t.call(n,n)),be[be.length-1]==null||be[be.length-1]!==e)throw`Adding layers stack in invalid state. This should not happen
Stack: ${be}
Trying to pop ${n.id}`;be.pop(),O(n,"color"),O(n,"display"),O(n,"classes"),O(n,"style"),O(n,"name"),ge(n,"name",n.id),O(n,"minWidth"),ge(n,"minWidth",600),O(n,"minimizable"),ge(n,"minimizable",!0),O(n,"minimizedDisplay");const r=n.style;return n.style=E(()=>{var s,l;let o=a(n.minWidth);return(typeof o=="number"||!Number.isNaN(parseInt(o)))&&(o=o+"px"),[(s=a(r))!=null?s:"",(l=n.minimized)!=null&&l.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:o,flexBasis:o,margin:""}]}),n})}function xn(e,t){if(console.info("Adding layer",e.id),ve[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,ve[e.id]);return}ge(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),ve[e.id]=e,ye.emit("addLayer",e,t.layers[e.id])}function _r(e){return ve[e]}function Mn(e){console.info("Removing layer",e.id),ye.emit("removeLayer",e),ve[e.id]=void 0}function wr(e){Mn(e),xn(e,z)}function Nr(e){const t=F(!1);return{openModal:()=>t.value=!0,modal:ne(()=>y(Ue,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},{header:()=>y("h2",null,[a(e.name)]),body:a(e.display)}))}}ye.on("update",function(t){Object.values(ve).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(ve).forEach(n=>{n==null||n.emit("update",t)}),Object.values(ve).forEach(n=>{n==null||n.emit("postUpdate",t)})});var Cr=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:Yt,UnregisterNodeInjectionKey:Jt,NodesInjectionKey:Kt,BoundsInjectionKey:Xt,layers:ve,persistentRefs:Xe,addingLayers:be,createLayer:In,addLayer:xn,getLayer:_r,removeLayer:Mn,reloadLayer:wr,setupLayerModal:Nr},Symbol.toStringTag,{value:"Module"}));const Sr=W({components:{Context:kn},props:{index:{type:Number,required:!0},display:{type:R(Object,String,Function),required:!0},minimizedDisplay:R(Object,String,Function),minimized:{type:Object,required:!0},name:{type:R(String),required:!0},color:R(String),minimizable:R(Boolean),nodes:{type:Object,required:!0}},emits:["setMinimized"],setup(e){const{display:t,index:n,minimized:i,minimizedDisplay:r}=de(e),o=Sn(t),s=Nt(r),l=E(()=>Y.allowGoBack&&n.value>0&&!pe(i));function c(){z.tabs.splice(a(e.index),1/0)}function f(b){e.nodes.value=b}return{component:o,minimizedComponent:s,showGoBack:l,updateNodes:f,unref:a,goBack:c}}}),kr={key:1};function Ir(e,t,n,i,r,o){const s=Et("Context");return _(),I("div",{class:"layer-container",style:Me({"--layer-color":e.unref(e.color)})},[e.showGoBack?(_(),I("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...l)=>e.goBack&&e.goBack(...l))},"\u274C")):P("",!0),e.unref(e.minimized)?(_(),I("button",{key:1,class:"layer-tab minimized",onClick:t[1]||(t[1]=l=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(_(),G(we(e.minimizedComponent),{key:0})):(_(),I("div",kr,H(e.unref(e.name)),1))])):(_(),I("div",{key:2,class:oe(["layer-tab",{showGoBack:e.showGoBack}])},[y(s,{onUpdateNodes:e.updateNodes},{default:A(()=>[(_(),G(we(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(_(),I("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=l=>e.$emit("setMinimized",!0))}," \u25BC ")):P("",!0)],4)}var xr=X(Sr,[["render",Ir],["__scopeId","data-v-72dd78b1"]]);const En=e=>(et("data-v-4b4bda40"),e=e(),tt(),e),Mr=En(()=>m("h2",null,"Changelog",-1)),Er=En(()=>m("details",{open:""},[m("summary",null,[D("v0.0 Initial Commit - "),m("time",null,"2021-09-04")]),D(" This is the first release :D "),m("ul",null,[m("li",{class:"feature"},"Did everything"),m("li",{class:"fix"},"Had some fun"),m("li",{class:"breaking"},"Removed everything"),m("li",{class:"balancing"},"Created some bugs to fix later")])],-1)),$r=W({__name:"Changelog",setup(e,{expose:t}){const n=F(!1);return t({open(){n.value=!0}}),(i,r)=>(_(),G(Ue,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=o=>n.value=o)},{header:A(()=>[Mr]),body:A(()=>[Er]),_:1},8,["modelValue"]))}});var Tr=X($r,[["__scopeId","data-v-4b4bda40"]]),Fr=W({props:{element:Object,display:{type:R(Object,String,Function),required:!0},style:R(Object,String,Array),classes:R(Object),direction:R(String),xoffset:R(String),yoffset:R(String),pinned:Object},setup(e){const{element:t,display:n,pinned:i}=de(e),r=F(!1),o=E(()=>(pe(i)||r.value)&&s.value),s=Nt(n),l=Ie(me(ne(()=>{const b=pe(t);return b==null?"":qe(b)})));function c(b){const h=i;b.shiftKey&&h&&(h.value=!h.value,b.stopPropagation(),b.preventDefault())}const f=E(()=>pe(i)&&Ee[K.theme].showPin);return{Direction:re,isHovered:r,isShown:o,comp:s,elementComp:l,unref:a,togglePinned:c,showPin:f}}});const Pr={key:0,class:"material-icons pinned"};function Vr(e,t,n,i,r,o){return _(),I("div",{class:oe(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=s=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=s=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...s)=>e.togglePinned&&e.togglePinned(...s))},[Be(e.$slots,"default",{},void 0,!0),e.elementComp?(_(),G(we(e.elementComp),{key:0})):P("",!0),y(lt,{name:"fade"},{default:A(()=>{var s;return[e.isShown?(_(),I("div",{key:0,class:oe(["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:Me([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(s=e.unref(e.style))!=null?s:{}])},[e.showPin?(_(),I("span",Pr,"push_pin")):P("",!0),e.comp?(_(),G(we(e.comp),{key:1})):P("",!0)],6)):P("",!0)]}),_:1})],34)}var ce=X(Fr,[["render",Vr],["__scopeId","data-v-6102fa3a"]]);const nt=e=>(et("data-v-4f97aa40"),e=e(),tt(),e),Dr={class:"info-modal-header"},Or=["src","alt"],Ar={class:"info-modal-title"},Lr={key:0},Br={key:0},qr={key:0},Rr=nt(()=>m("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),zr=nt(()=>m("br",null,null,-1)),Ur=nt(()=>m("br",null,null,-1)),jr=["href"],Wr=nt(()=>m("span",{class:"material-icons info-modal-discord"},"discord",-1)),Gr=nt(()=>m("div",null,[m("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[m("span",{class:"material-icons info-modal-discord"},"discord"),D(" The Paper Pilot Community ")])],-1)),Hr=nt(()=>m("div",null,[m("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[m("span",{class:"material-icons info-modal-discord"},"discord"),D(" The Modding Tree ")])],-1)),Zr=nt(()=>m("br",null,null,-1));var Yr=W({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:i,logo:r,author:o,discordName:s,discordLink:l,versionNumber:c,versionTitle:f}=Y,b=de(n),h=F(!1),C=E(()=>Ht(z.timePlayed)),N=E(()=>me(ne(()=>y(Q,null,[or.map(De)]))));t({open(){h.value=!0}});function S(){var p;(p=a(b.changelog))==null||p.open()}return(p,T)=>(_(),G(Ue,{modelValue:h.value,"onUpdate:modelValue":T[0]||(T[0]=U=>h.value=U)},{header:A(()=>[m("div",Dr,[a(r)?(_(),I("img",{key:0,class:"info-modal-logo",src:a(r),alt:a(i)},null,8,Or)):P("",!0),m("div",Ar,[m("h2",null,H(a(i)),1),m("h4",null,[D(" v"+H(a(c)),1),a(f)?(_(),I("span",Lr,": "+H(a(f)),1)):P("",!0)])])])]),body:A(({shown:U})=>[U?(_(),I("div",Br,[a(o)?(_(),I("div",qr,"By "+H(a(o)),1)):P("",!0),Rr,zr,m("div",{class:"link",onClick:S},"Changelog"),Ur,m("div",null,[a(l)?(_(),I("a",{key:0,href:a(l),class:"info-modal-discord-link",target:"_blank"},[Wr,D(" "+H(a(s)),1)],8,jr)):P("",!0)]),Gr,Hr,Zr,m("div",null,"Time Played: "+H(a(C)),1),(_(),G(we(a(N))))])):P("",!0)]),_:1},8,["modelValue"]))}});var Jr=X(Yr,[["__scopeId","data-v-4f97aa40"]]);const Kr={class:"field"},Xr={key:0,class:"field-title"},$n=W({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var s;const n=e,i=Nt(Re(n,"title"),"span"),r=F((s=n.options.find(l=>l.value===n.modelValue))!=null?s:null);xe(Re(n,"modelValue"),l=>{var c;pe(r)!==l&&(r.value=(c=n.options.find(f=>f.value===l))!=null?c:null)});function o(l){t("update:modelValue",l.value)}return(l,c)=>(_(),I("div",Kr,[a(i)?(_(),I("span",Xr,[(_(),G(we(a(i))))])):P("",!0),y(a(Jn),{options:e.options,modelValue:r.value,"onUpdate:modelValue":[c[0]||(c[0]=f=>r.value=f),o],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}});const Qr={class:"field"},ea=W({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,i=E(()=>{var o;return me((o=a(n.title))!=null?o:"<span></span>","span")}),r=E({get(){return!!n.modelValue},set(o){t("update:modelValue",o)}});return(o,s)=>(_(),I("label",Qr,[Wt(m("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":s[0]||(s[0]=l=>fe(r)?r.value=l:null)},null,512),[[Gn,a(r)]]),(_(),G(we(a(i))))]))}});var $e=X(ea,[["__scopeId","data-v-11046116"]]);const ta=["onClick"],na=W({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=F(!1),i=F(null);function r(){t("click"),i.value&&clearTimeout(i.value),n.value=!1,Qe(()=>{n.value=!0,i.value=setTimeout(()=>n.value=!1,500)})}return(o,s)=>(_(),I("button",{onClick:st(r,["stop"]),class:oe(["feedback",{activated:n.value,left:e.left}])},[Be(o.$slots,"default",{},void 0,!0)],10,ta))}});var Tn=X(na,[["__scopeId","data-v-01a1b95c"]]);const ia={class:"header"},ra=m("h2",null,"Settings",-1),aa={class:"option-tabs"},oa={key:0},sa={key:1};var la=W({__name:"Options",setup(e,{expose:t}){const n=F(!1),i=F("behaviour");function r($){return $==i.value}function o($){i.value=$}t({isTab:r,setTab:o,save:_e,open(){n.value=!0}});const s=Object.keys(Ee).map($=>({label:xt($),value:$})),l=E(()=>me(ne(()=>y(Q,null,[ar.map(De)])))),{showTPS:c,theme:f,unthrottled:b,alignUnits:h}=de(K),{autosave:C,offlineProd:N}=de(z),S=E({get(){return z.devSpeed===0},set($){z.devSpeed=$?0:null}}),p=ne(()=>y("span",{class:"option-title"},[D("Unthrottled"),y("desc",null,[D("Allow the game to run as fast as possible. Not battery friendly.")])])),T=ne(()=>y("span",{class:"option-title"},[D("Offline Production"),y(ce,{display:"Save-specific",direction:re.Right},{default:()=>[D("*")]}),y("desc",null,[D("Simulate production that occurs while the game is closed.")])])),U=ne(()=>y("span",{class:"option-title"},[D("Autosave"),y(ce,{display:"Save-specific",direction:re.Right},{default:()=>[D("*")]}),y("desc",null,[D("Automatically save the game every second or when the game is closed.")])])),w=ne(()=>y("span",{class:"option-title"},[D("Pause game"),y(ce,{display:"Save-specific",direction:re.Right},{default:()=>[D("*")]}),y("desc",null,[D("Stop everything from moving.")])])),k=ne(()=>y("span",{class:"option-title"},[D("Theme"),y("desc",null,[D("How the game looks.")])])),q=ne(()=>y("span",{class:"option-title"},[D("Show TPS"),y("desc",null,[D("Show TPS meter at the bottom-left corner of the page.")])])),he=ne(()=>y("span",{class:"option-title"},[D("Align modifier units"),y("desc",null,[D("Align numbers to the beginning of the unit in modifier view.")])]));return($,M)=>(_(),G(Ue,{modelValue:n.value,"onUpdate:modelValue":M[10]||(M[10]=V=>n.value=V)},{header:A(()=>[m("div",ia,[ra,m("div",aa,[m("button",{class:oe({selected:r("behaviour")}),onClick:M[0]||(M[0]=V=>o("behaviour"))},"Behaviour",2),m("button",{class:oe({selected:r("appearance")}),onClick:M[1]||(M[1]=V=>o("appearance"))},"Appearance",2)])])]),body:A(()=>[r("behaviour")?(_(),I("div",oa,[y($e,{title:a(p),modelValue:a(b),"onUpdate:modelValue":M[2]||(M[2]=V=>fe(b)?b.value=V:null)},null,8,["title","modelValue"]),a(Y).enablePausing?(_(),G($e,{key:0,title:a(w),modelValue:a(S),"onUpdate:modelValue":M[3]||(M[3]=V=>fe(S)?S.value=V:null)},null,8,["title","modelValue"])):P("",!0),y($e,{title:a(T),modelValue:a(N),"onUpdate:modelValue":M[4]||(M[4]=V=>fe(N)?N.value=V:null)},null,8,["title","modelValue"]),y($e,{title:a(U),modelValue:a(C),"onUpdate:modelValue":M[5]||(M[5]=V=>fe(C)?C.value=V:null)},null,8,["title","modelValue"]),a(C)?P("",!0):(_(),G(Tn,{key:1,class:"button save-button",onClick:M[6]||(M[6]=V=>a(_e)())},{default:A(()=>[D("Manually save")]),_:1}))])):P("",!0),r("appearance")?(_(),I("div",sa,[y($n,{title:a(k),options:a(s),modelValue:a(f),"onUpdate:modelValue":M[7]||(M[7]=V=>fe(f)?f.value=V:null)},null,8,["title","options","modelValue"]),(_(),G(we(a(l)))),y($e,{title:a(q),modelValue:a(c),"onUpdate:modelValue":M[8]||(M[8]=V=>fe(c)?c.value=V:null)},null,8,["title","modelValue"]),y($e,{title:a(he),modelValue:a(h),"onUpdate:modelValue":M[9]||(M[9]=V=>fe(h)?h.value=V:null)},null,8,["title","modelValue"])])):P("",!0)]),_:1},8,["modelValue"]))}});const ua=["onSubmit"],ca={class:"field"},da={key:0,class:"field-title"},ga=["placeholder"],fa=W({__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=Nt(Re(n,"title"),"span"),r=Ie(null);Dt(()=>{var c;(c=r.value)==null||c.focus()});const o=E({get(){var c;return(c=a(n.modelValue))!=null?c:""},set(c){t("update:modelValue",c)}});function s(){t("submit")}function l(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(c,f)=>(_(),I("form",{onSubmit:st(s,["prevent"])},[m("div",ca,[a(i)?(_(),I("span",da,[(_(),G(we(a(i))))])):P("",!0),e.textArea?(_(),G(a(Xn),{key:1,modelValue:a(o),"onUpdate:modelValue":f[0]||(f[0]=b=>fe(o)?o.value=b:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:l,ref_key:"field",ref:r},null,8,["modelValue","placeholder","maxHeight"])):Wt((_(),I("input",{key:2,type:"text","onUpdate:modelValue":f[1]||(f[1]=b=>fe(o)?o.value=b:null),placeholder:e.placeholder,class:oe({fullWidth:!e.title}),onBlur:l,ref_key:"field",ref:r},null,42,ga)),[[Hn,a(o)]])])],40,ua))}});var Fn=X(fa,[["__scopeId","data-v-90bd4994"]]);const ma={key:0},ha=["onClick","disabled"],va={key:0},pa=["onClick"],ba=W({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const i=de(e),r=F(!1);xe(r,l=>{t("confirmingChanged",l)});function o(){if(a(i.skipConfirm)){t("click");return}r.value&&t("click"),r.value=!r.value}function s(){r.value=!1}return(l,c)=>(_(),I("span",{class:oe(["container",{confirming:r.value}])},[r.value?(_(),I("span",ma,"Are you sure?")):P("",!0),m("button",{onClick:st(o,["stop"]),class:"button danger",disabled:e.disabled},[r.value?(_(),I("span",va,"Yes")):Be(l.$slots,"default",{key:1},void 0,!0)],8,ha),r.value?(_(),I("button",{key:1,class:"button",onClick:st(s,["stop"])},"No",8,pa)):P("",!0)],2))}});var ya=X(ba,[["__scopeId","data-v-2f8ef34c"]]);const Pe=e=>(et("data-v-32313015"),e=e(),tt(),e),_a=Pe(()=>m("div",{class:"handle material-icons"},"drag_handle",-1)),wa={key:0,class:"actions"},Na=Pe(()=>m("span",{class:"material-icons"},"content_paste",-1)),Ca=Pe(()=>m("span",{class:"material-icons"},"content_copy",-1)),Sa=Pe(()=>m("span",{class:"material-icons"},"edit",-1)),ka=Pe(()=>m("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),Ia={key:1,class:"actions"},xa=Pe(()=>m("span",{class:"material-icons"},"check",-1)),Ma=Pe(()=>m("span",{class:"material-icons"},"close",-1)),Ea={key:2,class:"details"},$a={class:"save-version"},Ta=Pe(()=>m("br",null,null,-1)),Fa={key:0},Pa={key:3,class:"details"},Va={key:4,class:"details error"},Da=Pe(()=>m("br",null,null,-1)),Oa=W({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:i}=de(n),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),o=F(!1),s=F(!1),l=F("");xe(o,()=>{var h;return l.value=(h=i.value.name)!=null?h:""});const c=E(()=>i.value!=null&&i.value.id===z.id),f=E(()=>{var h;return c.value?z.time:(h=i.value!=null&&i.value.time)!=null?h:0});function b(){t("editName",l.value),o.value=!1}return(h,C)=>(_(),I("div",{class:oe(["save",{active:a(c)}])},[_a,o.value?(_(),I("div",Ia,[m("button",{onClick:b,class:"button"},[y(ce,{display:"Save",direction:a(re).Left,class:"info"},{default:A(()=>[xa]),_:1},8,["direction"])]),m("button",{onClick:C[5]||(C[5]=N=>o.value=!o.value),class:"button"},[y(ce,{display:"Cancel",direction:a(re).Left,class:"info"},{default:A(()=>[Ma]),_:1},8,["direction"])])])):(_(),I("div",wa,[a(i).error==null&&!s.value?(_(),G(Tn,{key:0,onClick:C[0]||(C[0]=N=>t("export")),class:"button",left:""},{default:A(()=>[y(ce,{display:"Export",direction:a(re).Left,class:"info"},{default:A(()=>[Na]),_:1},8,["direction"])]),_:1})):P("",!0),a(i).error==null&&!s.value?(_(),I("button",{key:1,onClick:C[1]||(C[1]=N=>t("duplicate")),class:"button"},[y(ce,{display:"Duplicate",direction:a(re).Left,class:"info"},{default:A(()=>[Ca]),_:1},8,["direction"])])):P("",!0),a(i).error==null&&!s.value?(_(),I("button",{key:2,onClick:C[2]||(C[2]=N=>o.value=!o.value),class:"button"},[y(ce,{display:"Edit Name",direction:a(re).Left,class:"info"},{default:A(()=>[Sa]),_:1},8,["direction"])])):P("",!0),y(ya,{disabled:a(c),onClick:C[3]||(C[3]=N=>t("delete")),onConfirmingChanged:C[4]||(C[4]=N=>s.value=N)},{default:A(()=>[y(ce,{display:"Delete",direction:a(re).Left,class:"info"},{default:A(()=>[ka]),_:1},8,["direction"])]),_:1},8,["disabled"])])),a(i).error==null&&!o.value?(_(),I("div",Ea,[m("button",{class:"button open",onClick:C[6]||(C[6]=N=>t("open"))},[m("h3",null,H(a(i).name),1)]),m("span",$a,"v"+H(a(i).modVersion),1),Ta,a(f)?(_(),I("div",Fa,"Last played "+H(a(r).format(a(f))),1)):P("",!0)])):a(i).error==null&&o.value?(_(),I("div",Pa,[y(Fn,{modelValue:l.value,"onUpdate:modelValue":C[7]||(C[7]=N=>l.value=N),class:"editname",onSubmit:b},null,8,["modelValue"])])):(_(),I("div",Va,[D(" Error: Failed to load save with id "+H(a(i).id),1),Da,D(H(a(i).error),1)]))],2))}});var Aa=X(Oa,[["__scopeId","data-v-32313015"]]);const Qt=e=>(et("data-v-2a4275be"),e=e(),tt(),e),La=Qt(()=>m("h2",null,"Saves Manager",-1)),Ba={class:"modal-footer"},qa={class:"field"},Ra=Qt(()=>m("span",{class:"field-title"},"Create Save",-1)),za={class:"field-buttons"},Ua={class:"footer"},ja=Qt(()=>m("div",{style:{"flex-grow":"1"}},null,-1)),Wa=W({__name:"SavesManager",setup(e,{expose:t}){const n=F(!1),i=F(null);t({open(){n.value=!0}});const r=F(!1),o=F(""),s=F(null);xe(o,w=>{w?Qe(()=>{try{if(w[0]!=="{")if(w[0]==="e")w=decodeURIComponent(escape(atob(w)));else if(w[0]==="\u1BE1")w=Oe.decompressFromUTF16(w);else{console.warn("Unable to determine preset encoding",w),r.value=!0;return}const k=JSON.parse(w);if(typeof k!="object"){r.value=!0;return}const q=Mt();k.id=q,_e(k),o.value="",r.value=!1,K.saves.push(q)}catch{r.value=!0}}):r.value=!1});let l={},c=F(Object.keys(l).reduce((w,k)=>(w.push({label:k.split("/").slice(-1)[0].slice(0,-4),value:l[k]}),w),[]));const f=Gt({});function b(w){if(f[w]==null){let k=localStorage.getItem(w);if(k==null)f[w]={error:"Save doesn't exist in localStorage",id:w};else if(k==="dW5kZWZpbmVk")f[w]={error:"Save is undefined",id:w};else try{if(k[0]!=="{")if(k[0]==="e")k=decodeURIComponent(escape(atob(k)));else if(k[0]==="\u1BE1")k=Oe.decompressFromUTF16(k);else return console.warn("Unable to determine preset encoding",k),r.value=!0,f[w]={error:"Unable to determine preset encoding",id:w},f[w];f[w]={...JSON.parse(k),id:w}}catch(q){f[w]={error:q,id:w},console.warn(`SavesManager: Failed to load info about save with id ${w}:
${q}
${k}`)}}return f[w]}xe(n,w=>{w&&Object.keys(f).forEach(k=>delete f[k])});const h=E(()=>K.saves.reduce((w,k)=>(w[k]=b(k),w),{}));function C(w){let k;switch(z.id===w?k=wn(z):k=JSON.stringify(h.value[w]),Y.exportEncoding){default:console.warn(`Unknown save encoding: ${Y.exportEncoding}. Defaulting to lz`);case"lz":k=Oe.compressToUTF16(k);break;case"base64":k=btoa(unescape(encodeURIComponent(k)));break;case"plain":break}const q=document.createElement("textarea");q.value=k,document.body.appendChild(q),q.select(),q.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(q)}function N(w){z.id===w&&_e();const k={...h.value[w],id:Mt()};_e(k),K.saves.push(k.id)}function S(w){K.saves=K.saves.filter(k=>k!==w),localStorage.removeItem(w),f[w]=void 0}function p(w){h.value[z.id].time=z.time,_e(),f[z.id]=void 0,Ze(h.value[w]),f[w]=void 0}function T(w){if(s.value=w,Qe(()=>{s.value=null}),w[0]!=="{")if(w[0]==="e")w=decodeURIComponent(escape(atob(w)));else if(w[0]==="\u1BE1")w=Oe.decompressFromUTF16(w);else{console.warn("Unable to determine preset encoding",w);return}const k=JSON.parse(w);k.id=Mt(),_e(k),K.saves.push(k.id),p(k.id)}function U(w,k){const q=h.value[w];q!=null&&(q.name=k,z.id===w?(z.name=k,_e()):(_e(q),f[w]=void 0))}return(w,k)=>(_(),G(Ue,{modelValue:n.value,"onUpdate:modelValue":k[4]||(k[4]=q=>n.value=q),ref_key:"modal",ref:i},{header:A(()=>[La]),body:A(({shown:q})=>[q?(_(),G(a(Kn),{key:0,list:a(K).saves,handle:".handle",itemKey:he=>he},{item:A(({element:he})=>[y(Aa,{save:a(h)[he],onOpen:$=>p(he),onExport:$=>C(he),onEditName:$=>U(he,$),onDuplicate:$=>N(he),onDelete:$=>S(he)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):P("",!0)]),footer:A(()=>[m("div",Ba,[y(Fn,{modelValue:o.value,"onUpdate:modelValue":k[0]||(k[0]=q=>o.value=q),title:"Import Save",placeholder:"Paste your save here!",class:oe({importingFailed:r.value})},null,8,["modelValue","class"]),m("div",qa,[Ra,m("div",za,[m("button",{class:"button",onClick:k[1]||(k[1]=q=>p(a(at)().id))},"New Game"),Object.keys(a(c)).length>0?(_(),G($n,{key:0,options:a(c),modelValue:s.value,"onUpdate:modelValue":k[2]||(k[2]=q=>T(q)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):P("",!0)])]),m("div",Ua,[ja,m("button",{class:"button modal-default-button",onClick:k[3]||(k[3]=q=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Pn=X(Wa,[["__scopeId","data-v-2a4275be"]]);const Ne=e=>(et("data-v-318a1c31"),e=e(),tt(),e),Ga=["src","alt"],Ha={key:1,class:"title"},Za=Ne(()=>m("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),Ya={class:"discord"},Ja={class:"discord-links"},Ka={key:0},Xa=["href"],Qa=Ne(()=>m("li",null,[m("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),eo=Ne(()=>m("li",null,[m("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),to={href:"https://forums.moddingtree.com/",target:"_blank"},no=Ne(()=>m("span",{class:"material-icons"},"forum",-1)),io=Ne(()=>m("span",{class:"material-icons"},"info",-1)),ro=Ne(()=>m("span",{class:"material-icons"},"library_books",-1)),ao=Ne(()=>m("span",{class:"material-icons"},"settings",-1)),oo=Ne(()=>m("span",{class:"material-icons"},"library_books",-1)),so=Ne(()=>m("span",{class:"material-icons"},"settings",-1)),lo=Ne(()=>m("span",{class:"material-icons"},"info",-1)),uo={href:"https://forums.moddingtree.com/",target:"_blank"},co=Ne(()=>m("span",{class:"material-icons"},"forum",-1)),go={class:"discord"},fo={class:"discord-links"},mo={key:0},ho=["href"],vo=Ne(()=>m("li",null,[m("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),po=Ne(()=>m("li",null,[m("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),bo=W({__name:"Nav",setup(e){const t=F(null),n=F(null),i=F(null),r=F(null),{useHeader:o,banner:s,title:l,discordName:c,discordLink:f,versionNumber:b}=Y;function h(){window.open(f,"mywindow")}return(C,N)=>(_(),I(Q,null,[a(o)?(_(),I("div",Te({key:0,class:"nav"},C.$attrs),[a(s)?(_(),I("img",{key:0,src:a(s),class:"banner",alt:a(l)},null,8,Ga)):(_(),I("div",Ha,H(a(l)),1)),m("div",{onClick:N[0]||(N[0]=S=>{var p;return(p=r.value)==null?void 0:p.open()}),class:"version-container"},[y(ce,{display:"Changelog",direction:a(re).Down,class:"version"},{default:A(()=>[m("span",null,"v"+H(a(b)),1)]),_:1},8,["direction"])]),Za,m("div",Ya,[m("span",{onClick:h,class:"material-icons"},"discord"),m("ul",Ja,[a(f)?(_(),I("li",Ka,[m("a",{href:a(f),target:"_blank"},H(a(c)),9,Xa)])):P("",!0),Qa,eo])]),m("div",null,[m("a",to,[y(ce,{display:"Forums",direction:a(re).Down,yoffset:"5px"},{default:A(()=>[no]),_:1},8,["direction"])])]),m("div",{onClick:N[1]||(N[1]=S=>{var p;return(p=t.value)==null?void 0:p.open()})},[y(ce,{display:"Info",direction:a(re).Down,class:"info"},{default:A(()=>[io]),_:1},8,["direction"])]),m("div",{onClick:N[2]||(N[2]=S=>{var p;return(p=n.value)==null?void 0:p.open()})},[y(ce,{display:"Saves",direction:a(re).Down,xoffset:"-20px"},{default:A(()=>[ro]),_:1},8,["direction"])]),m("div",{onClick:N[3]||(N[3]=S=>{var p;return(p=i.value)==null?void 0:p.open()})},[y(ce,{display:"Settings",direction:a(re).Down,xoffset:"-66px"},{default:A(()=>[ao]),_:1},8,["direction"])])],16)):(_(),I("div",Te({key:1,class:"overlay-nav"},C.$attrs),[m("div",{onClick:N[4]||(N[4]=S=>{var p;return(p=r.value)==null?void 0:p.open()}),class:"version-container"},[y(ce,{display:"Changelog",direction:a(re).Right,xoffset:"25%",class:"version"},{default:A(()=>[m("span",null,"v"+H(a(b)),1)]),_:1},8,["direction"])]),m("div",{onClick:N[5]||(N[5]=S=>{var p;return(p=n.value)==null?void 0:p.open()})},[y(ce,{display:"Saves",direction:a(re).Right},{default:A(()=>[oo]),_:1},8,["direction"])]),m("div",{onClick:N[6]||(N[6]=S=>{var p;return(p=i.value)==null?void 0:p.open()})},[y(ce,{display:"Settings",direction:a(re).Right},{default:A(()=>[so]),_:1},8,["direction"])]),m("div",{onClick:N[7]||(N[7]=S=>{var p;return(p=t.value)==null?void 0:p.open()})},[y(ce,{display:"Info",direction:a(re).Right},{default:A(()=>[lo]),_:1},8,["direction"])]),m("div",null,[m("a",uo,[y(ce,{display:"Forums",direction:a(re).Right,xoffset:"7px"},{default:A(()=>[co]),_:1},8,["direction"])])]),m("div",go,[m("span",{onClick:h,class:"material-icons"},"discord"),m("ul",fo,[a(f)?(_(),I("li",mo,[m("a",{href:a(f),target:"_blank"},H(a(c)),9,ho)])):P("",!0),vo,po])])],16)),y(Jr,{ref_key:"info",ref:t,changelog:r.value},null,8,["changelog"]),y(Pn,{ref_key:"savesManager",ref:n},null,512),y(la,{ref_key:"options",ref:i},null,512),y(Tr,{ref_key:"changelog",ref:r},null,512)],64))}});var Vn=X(bo,[["__scopeId","data-v-318a1c31"]]);const yo={class:"inner-tab"},_o=W({__name:"Game",setup(e){const t=Re(z,"tabs"),n=E(()=>Object.keys(ve)),i=Y.useHeader;function r(o){const{display:s,minimized:l,name:c,color:f,minimizable:b,nodes:h,minimizedDisplay:C}=o;return{display:s,minimized:l,name:c,color:f,minimizable:b,nodes:h,minimizedDisplay:C}}return(o,s)=>(_(),I("div",{class:oe(["tabs-container",{useHeader:a(i)}])},[(_(!0),I(Q,null,ut(a(t),(l,c)=>{var f,b;return _(),I("div",{key:c,class:oe(["tab",a((f=a(ve)[l])==null?void 0:f.classes)]),style:Me(a((b=a(ve)[l])==null?void 0:b.style))},[c===0&&!a(i)?(_(),G(Vn,{key:0})):P("",!0),m("div",yo,[a(n).includes(l)?(_(),G(xr,Te({key:0},r(a(ve)[l]),{index:c,onSetMinimized:h=>a(ve)[l].minimized.value=h}),null,16,["index","onSetMinimized"])):(_(),G(we(l),{key:1,index:c},null,8,["index"]))])],6)}),128))],2))}});var wo=X(_o,[["__scopeId","data-v-dcd207b4"]]);const No=W({__name:"Sticky",setup(e){const t=F("0"),n=new ResizeObserver(r),i=Ie(null);function r(){let o=i.value;if(o==null)return;let s=0;for(;o.previousSibling;){const l=o.previousSibling;l.dataset&&"vSticky"in l.dataset&&(s+=l.offsetHeight),o=l}t.value=s+"px"}return Qe(r),document.fonts.ready.then(r),Dt(()=>{var s;const o=(s=i.value)==null?void 0:s.parentElement;o&&n.observe(o)}),(o,s)=>(_(),I("div",{class:"sticky",style:Me({top:t.value}),ref_key:"element",ref:i,"data-v-sticky":""},[Be(o.$slots,"default",{},void 0,!0)],4))}});var Dn=X(No,[["__scopeId","data-v-cccac690"]]);const Co=["x1","y1","x2","y2"],So=W({__name:"BoardLink",props:{link:null},setup(e){const n=de(e),i=E(()=>{const o=n.link.value.startNode.position;return n.link.value.offsetStart&&(o.x+=a(n.link.value.offsetStart).x,o.y+=a(n.link.value.offsetStart).y),o}),r=E(()=>{const o=n.link.value.endNode.position;return n.link.value.offsetEnd&&(o.x+=a(n.link.value.offsetEnd).x,o.y+=a(n.link.value.offsetEnd).y),o});return(o,s)=>(_(),I("line",Te({class:"link"},e.link,{class:{pulsing:e.link.pulsing},x1:a(i).x,y1:a(i).y,x2:a(r).x,y2:a(r).y}),null,16,Co))}});var ko=X(So,[["__scopeId","data-v-57c4970a"]]);const Io={key:0},xo=["transform","onMousedown","onTouchstart","onMouseup","onTouchend"],Mo=["fill","stroke-width","stroke"],Eo=["fill"],$o=W({__name:"BoardNodeAction",props:{node:null,nodeType:null,actions:null,isSelected:{type:Boolean},selectedAction:null},setup(e){const n=de(e),i=E(()=>J(n.nodeType.value.size,a(n.node))),r=E(()=>{var f;return(f=J(n.nodeType.value.outlineColor,a(n.node)))!=null?f:Ee[K.theme].variables["--outline"]}),o=E(()=>{var f;return(f=J(n.nodeType.value.titleColor,a(n.node)))!=null?f:Ee[K.theme].variables["--foreground"]}),s=E(()=>J(n.nodeType.value.actionDistance,a(n.node)));function l(f,b){var h;(b.onClick(a(n.node))||((h=a(n.selectedAction))==null?void 0:h.id)===b.id)&&(f.preventDefault(),f.stopPropagation())}function c(f,b){var h;((h=a(n.selectedAction))==null?void 0:h.id)===b.id&&(f.preventDefault(),f.stopPropagation())}return(f,b)=>(_(),G(lt,{name:"actions",appear:""},{default:A(()=>[e.isSelected&&e.actions?(_(),I("g",Io,[(_(!0),I(Q,null,ut(e.actions,(h,C)=>{var N,S;return _(),I("g",{key:h.id,class:oe(["action",{selected:((N=e.selectedAction)==null?void 0:N.id)===h.id}]),transform:`translate(
${(-a(i)-30)*Math.sin(((e.actions.length-1)/2-C)*a(s))},
${(a(i)+30)*Math.cos(((e.actions.length-1)/2-C)*a(s))}
)`,onMousedown:p=>l(p,h),onTouchstart:p=>l(p,h),onMouseup:p=>c(p,h),onTouchend:st(p=>c(p,h),["stop"])},[m("circle",{fill:a(J)(h.fillColor,e.node),r:"20","stroke-width":((S=e.selectedAction)==null?void 0:S.id)===h.id?4:0,stroke:a(r)},null,8,Mo),m("text",{fill:a(o),class:"material-icons"},H(a(J)(h.icon,e.node)),9,Eo)],42,xo)}),128))])):P("",!0)]),_:1}))}});var To=X($o,[["__scopeId","data-v-51fdd2a0"]]);const Fo=["transform"],Po={key:0},Vo=["r","fill","stroke"],Do=["r","fill","stroke"],Oo=["r","fill"],Ao=["r","stroke-dasharray","stroke-dashoffset","stroke"],Lo={key:1,transform:"rotate(45, 0, 0)"},Bo=["width","height","transform","fill","stroke"],qo=["width","height","transform","fill","stroke"],Ro=["width","height","transform","fill"],zo=["width","height","transform","stroke-dasharray","stroke-dashoffset","stroke"],Uo=["fill","y"],jo=["fill"],Wo={key:0},Go=["fill","y"],Ho=["fill","y"],Zo=W({__name:"BoardNode",props:{node:null,nodeType:null,dragging:null,dragged:null,hasDragged:{type:Boolean},receivingNode:{type:Boolean},selectedNode:null,selectedAction:null},emits:["mouseDown","endDragging"],setup(e,{emit:t}){const n=e,i=Math.sqrt(2),r=de(n),o=E(()=>a(r.selectedNode)===a(r.node)),s=E(()=>J(r.nodeType.value.draggable,a(r.node)));xe(s,L=>{const Z=a(r.node);a(r.dragging)===Z&&!L&&t("endDragging",Z.id)});const l=E(()=>{var Z;const L=a(r.node);return(Z=J(r.nodeType.value.actions,L))==null?void 0:Z.filter(le=>ze(J(le.visibility,L)))}),c=E(()=>{var Z;const L=a(r.node);if(J(r.nodeType.value.draggable,L)&&((Z=a(r.dragging))==null?void 0:Z.id)===L.id&&a(r.dragged)!=null){const{x:le,y:se}=a(r.dragged);return{x:L.position.x+Math.round(le/25)*25,y:L.position.y+Math.round(se/25)*25}}return L.position}),f=E(()=>J(r.nodeType.value.shape,a(r.node))),b=E(()=>J(r.nodeType.value.title,a(r.node))),h=E(()=>J(r.nodeType.value.subtitle,a(r.node))),C=E(()=>{var L;return(L=o.value?a(r.selectedAction)&&J(a(r.selectedAction).tooltip,a(r.node)):null)!=null?L:J(r.nodeType.value.label,a(r.node))}),N=E(()=>J(r.nodeType.value.size,a(r.node))),S=E(()=>{var L;return(L=J(r.nodeType.value.progress,a(r.node)))!=null?L:0}),p=E(()=>Ee[K.theme].variables["--background"]),T=E(()=>{var L;return(L=J(r.nodeType.value.outlineColor,a(r.node)))!=null?L:Ee[K.theme].variables["--outline"]}),U=E(()=>{var L;return(L=J(r.nodeType.value.fillColor,a(r.node)))!=null?L:Ee[K.theme].variables["--raised-background"]}),w=E(()=>J(r.nodeType.value.progressColor,a(r.node))),k=E(()=>{var L;return(L=J(r.nodeType.value.titleColor,a(r.node)))!=null?L:Ee[K.theme].variables["--foreground"]}),q=E(()=>J(r.nodeType.value.progressDisplay,a(r.node))),he=E(()=>a(r.dragging)!=null&&a(r.hasDragged)&&J(r.nodeType.value.canAccept,a(r.node))),$=E(()=>J(r.nodeType.value.style,a(r.node))),M=E(()=>J(r.nodeType.value.classes,a(r.node)));function V(L){t("mouseDown",L,r.node.value.id,s.value)}function te(L){var Z,le,se;(Z=r.hasDragged)!=null&&Z.value||(t("endDragging",r.node.value.id),(se=(le=r.nodeType.value).onClick)==null||se.call(le,r.node.value),L.stopPropagation())}return(L,Z)=>{var le,se,je;return _(),I("g",{class:oe(["boardnode",{[e.node.type]:!0,isSelected:a(o),isDraggable:a(s),...a(M)}]),style:Me([{opacity:((le=e.dragging)==null?void 0:le.id)===e.node.id&&e.hasDragged?.5:1},(se=a($))!=null?se:[]]),transform:`translate(${a(c).x},${a(c).y})${a(o)?" scale(1.2)":""}`},[y(To,{actions:(je=a(l))!=null?je:[],"is-selected":a(o),node:e.node,"node-type":e.nodeType,"selected-action":e.selectedAction},null,8,["actions","is-selected","node","node-type","selected-action"]),m("g",{class:"node-container",onMousedown:V,onTouchstartPassive:V,onMouseup:te,onTouchendPassive:te},[a(f)===a(Je).Circle?(_(),I("g",Po,[a(he)?(_(),I("circle",{key:0,class:"receiver",r:a(N)+8,fill:a(p),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Vo)):P("",!0),m("circle",{class:"body",r:a(N),fill:a(U),stroke:a(T),"stroke-width":4},null,8,Do),a(q)===a(wt).Fill?(_(),I("circle",{key:1,class:"progress progressFill",r:Math.max(a(N)*a(S)-2,0),fill:a(w)},null,8,Oo)):(_(),I("circle",{key:2,r:a(N)+4.5,class:"progress progressRing",fill:"transparent","stroke-dasharray":(a(N)+4.5)*2*Math.PI,"stroke-width":5,"stroke-dashoffset":(a(N)+4.5)*2*Math.PI-a(S)*(a(N)+4.5)*2*Math.PI,stroke:a(w)},null,8,Ao))])):a(f)===a(Je).Diamond?(_(),I("g",Lo,[a(he)?(_(),I("rect",{key:0,class:"receiver",width:a(N)*a(i)+16,height:a(N)*a(i)+16,transform:`translate(${-(a(N)*a(i)+16)/2}, ${-(a(N)*a(i)+16)/2})`,fill:a(p),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Bo)):P("",!0),m("rect",{class:"body",width:a(N)*a(i),height:a(N)*a(i),transform:`translate(${-a(N)*a(i)/2}, ${-a(N)*a(i)/2})`,fill:a(U),stroke:a(T),"stroke-width":4},null,8,qo),a(q)===a(wt).Fill?(_(),I("rect",{key:1,class:"progress progressFill",width:Math.max(a(N)*a(i)*a(S)-2,0),height:Math.max(a(N)*a(i)*a(S)-2,0),transform:`translate(${-Math.max(a(N)*a(i)*a(S)-2,0)/2}, ${-Math.max(a(N)*a(i)*a(S)-2,0)/2})`,fill:a(w)},null,8,Ro)):(_(),I("rect",{key:2,class:"progress progressDiamond",width:a(N)*a(i)+9,height:a(N)*a(i)+9,transform:`translate(${-(a(N)*a(i)+9)/2}, ${-(a(N)*a(i)+9)/2})`,fill:"transparent","stroke-dasharray":(a(N)*a(i)+9)*4,"stroke-width":5,"stroke-dashoffset":(a(N)*a(i)+9)*4-a(S)*(a(N)*a(i)+9)*4,stroke:a(w)},null,8,zo))])):P("",!0),m("text",{fill:a(k),class:"node-title",y:a(h)?10:0},H(a(b)),9,Uo),a(h)?(_(),I("text",{key:2,fill:a(k),class:"node-subtitle",y:"-15"},H(a(h)),9,jo)):P("",!0)],32),y(lt,{name:"fade",appear:""},{default:A(()=>[a(C)?(_(),I("g",Wo,[m("text",{fill:a(C).color||a(k),class:oe(["node-title",{pulsing:a(C).pulsing}]),y:-a(N)-20},H(a(C).text),11,Go)])):P("",!0)]),_:1}),y(lt,{name:"fade",appear:""},{default:A(()=>[a(o)&&e.selectedAction?(_(),I("text",{key:0,fill:a(k),class:"node-title",y:a(N)+75},"Tap again to confirm",8,Ho)):P("",!0)]),_:1})],14,Fo)}}});var Yo=X(Zo,[["__scopeId","data-v-0e90eee7"]]);const Jo={class:"stage",width:"100%",height:"100%"},Ko={class:"g1"},Xo=W({__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,mousePosition:null},setup(e){const n=de(e),i=F({x:0,y:0}),r=F({x:0,y:0}),o=F(null),s=F(!1),l=F(null),c=E(()=>o.value==null?void 0:n.nodes.value.find(p=>p.id===o.value)),f=E(()=>{const p=n.nodes.value.slice();if(c.value){const T=p.splice(p.indexOf(c.value),1)[0];p.push(T)}return p}),b=E(()=>{const p=c.value;if(p==null)return null;const T={x:p.position.x+r.value.x,y:p.position.y+r.value.y};let U=Number.MAX_VALUE;return n.nodes.value.reduce((w,k)=>{if(k.id===p.id)return w;const q=n.types.value[k.type];if(!J(q.canAccept,k))return w;const $=Math.pow(T.x-k.position.x,2)+Math.pow(T.y-k.position.y,2);let M=J(q.size,k);return $>U||$>M*M?w:(U=$,k)},null)});function h(p){p.setTransformOrigin(null),p.moveTo(l.value.$el.clientWidth/2,l.value.$el.clientHeight/2)}function C(p,T=null,U=!1){if(o.value==null){p.preventDefault(),p.stopPropagation();let w,k;if("touches"in p)if(p.touches.length===1)w=p.touches[0].clientX,k=p.touches[0].clientY;else return;else w=p.clientX,k=p.clientY;i.value={x:w,y:k},r.value={x:0,y:0},s.value=!1,U&&(o.value=T)}T!=null&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function N(p){const{x:T,y:U,scale:w}=l.value.panZoomInstance.getTransform();let k,q;if("touches"in p)if(p.touches.length===1)k=p.touches[0].clientX,q=p.touches[0].clientY;else{S(o.value),n.mousePosition.value=null;return}else k=p.clientX,q=p.clientY;n.mousePosition.value={x:(k-T)/w,y:(q-U)/w},r.value={x:r.value.x+(k-i.value.x)/w,y:r.value.y+(q-i.value.y)/w},i.value={x:k,y:q},(Math.abs(r.value.x)>10||Math.abs(r.value.y)>10)&&(s.value=!0),o.value!=null&&(p.preventDefault(),p.stopPropagation())}function S(p){var T,U;if(o.value!=null&&o.value===p&&c.value!=null){c.value.position.x+=Math.round(r.value.x/25)*25,c.value.position.y+=Math.round(r.value.y/25)*25;const w=n.nodes.value;w.push(w.splice(w.indexOf(c.value),1)[0]),b.value&&((U=(T=n.types.value[b.value.type]).onDrop)==null||U.call(T,b.value,c.value)),o.value=null}else s.value||(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}return(p,T)=>{const U=Et("panZoom");return a(ze)(e.visibility)?(_(),G(U,{key:0,style:Me([{width:e.width,height:e.height},e.style]),class:oe(e.classes),selector:".g1",options:{initialZoom:1,minZoom:.1,maxZoom:10,zoomDoubleClickSpeed:1},ref_key:"stage",ref:l,onInit:h,onMousemove:N,onTouchmove:N,onMousedown:T[0]||(T[0]=w=>C(w)),onTouchstart:T[1]||(T[1]=w=>C(w)),onMouseup:T[2]||(T[2]=()=>S(o.value)),onTouchendPassive:T[3]||(T[3]=()=>S(o.value)),onMouseleave:T[4]||(T[4]=()=>S(o.value))},{default:A(()=>[(_(),I("svg",Jo,[m("g",Ko,[y(nn,{name:"link",appear:""},{default:A(()=>[(_(!0),I(Q,null,ut(a(e.links)||[],w=>(_(),I("g",{key:`${w.startNode.id}-${w.endNode.id}`},[y(ko,{link:w},null,8,["link"])]))),128))]),_:1}),y(nn,{name:"grow",duration:500,appear:""},{default:A(()=>[(_(!0),I(Q,null,ut(a(f),w=>{var k;return _(),I("g",{key:w.id,style:{"transition-duration":"0s"}},[y(Yo,{node:w,nodeType:e.types[w.type],dragging:a(c),dragged:a(c)===w?r.value:void 0,hasDragged:s.value,receivingNode:((k=a(b))==null?void 0:k.id)===w.id,selectedNode:a(e.selectedNode),selectedAction:a(e.selectedAction),onMouseDown:C,onEndDragging:S},null,8,["node","nodeType","dragging","dragged","hasDragged","receivingNode","selectedNode","selectedAction"])])}),128))]),_:1})])]))]),_:1},8,["style","class","options"])):P("",!0)}}});ye.on("setupVue",e=>Qn.install(e));const On=Symbol("Board");var wt=(e=>(e.Outline="Outline",e.Fill="Fill",e))(wt||{}),Je=(e=>(e.Circle="Circle",e.Diamond="Triangle",e))(Je||{});function Qo(e){const t=dt({nodes:[],selectedNode:null,selectedAction:null},!1);return Ct(n=>{const i=e.call(n,n);i.id=_n("board-"),i.type=On,i[bt]=Xo,i.state?(yr(t),O(i,"state")):(t[_t]={nodes:i.startNodes().map((o,s)=>(o.id=s,o)),selectedNode:null,selectedAction:null},i.state=t),i.nodes=E(()=>a(r.state).nodes),i.selectedNode=E(()=>r.nodes.value.find(o=>o.id===a(r.state).selectedNode)||null),i.selectedAction=E(()=>{const o=r.selectedNode.value;if(o==null)return null;const s=r.types[o.type];return s.actions==null?null:s.actions.find(l=>l.id===a(r.state).selectedAction)||null}),i.mousePosition=F(null),i.links?O(i,"links"):i.links=E(()=>r.selectedAction.value==null?null:r.selectedAction.value.links&&r.selectedNode.value?J(r.selectedAction.value.links,r.selectedNode.value):null),O(i,"visibility"),ge(i,"visibility",Fe.Visible),O(i,"width"),ge(i,"width","100%"),O(i,"height"),ge(i,"height","100%"),O(i,"classes"),O(i,"style");for(const o in i.types){const s=i.types[o];if(O(s,"title"),O(s,"subtitle"),O(s,"label"),O(s,"size"),ge(s,"size",50),O(s,"style"),O(s,"classes"),O(s,"draggable"),ge(s,"draggable",!1),O(s,"shape"),ge(s,"shape","Circle"),O(s,"canAccept"),ge(s,"canAccept",!1),O(s,"progress"),O(s,"progressDisplay"),ge(s,"progressDisplay","Fill"),O(s,"progressColor"),ge(s,"progressColor","none"),O(s,"fillColor"),O(s,"outlineColor"),O(s,"titleColor"),O(s,"actionDistance"),ge(s,"actionDistance",Math.PI/6),s.nodes=E(()=>a(r.state).nodes.filter(l=>l.type===o)),ge(s,"onClick",function(l){a(r.state).selectedNode=l.id}),s.actions)for(const l of s.actions)O(l,"visibility"),ge(l,"visibility",Fe.Visible),O(l,"icon"),O(l,"fillColor"),O(l,"tooltip"),O(l,"links")}i[At]=function(){const{nodes:o,types:s,state:l,visibility:c,width:f,height:b,style:h,classes:C,links:N,selectedAction:S,selectedNode:p,mousePosition:T}=this;return{nodes:o,types:s,state:l,visibility:c,width:f,height:b,style:a(h),classes:C,links:N,selectedAction:S,selectedNode:p,mousePosition:T}};const r=i;return r})}function J(e,t){return Ft(e)?e(t):a(e)}function es(e){let t=0;return e.nodes.value.forEach(n=>{n.id>=t&&(t=n.id+1)}),t}const mt={};ye.on("addLayer",e=>{const t=Xi(e,On);mt[e.id]=e.on("postUpdate",n=>{t.forEach(i=>{Object.values(i.types).forEach(r=>r.nodes.value.forEach(o=>{var s;return(s=r.update)==null?void 0:s.call(r,o,n)}))})})});ye.on("removeLayer",e=>{var t;(t=mt[e.id])==null||t.call(mt),mt[e.id]=void 0});function ts(e,t="points",n=0,i=void 0){const r=fe(e)?e:dt(e);if(r.displayName=t,r.precision=n,r.small=i,!fe(e)){const o=r[Ae];o.displayName=t,o.precision=n,o.small=i}return r}new u("10^^8");new u("1e100");ye.on("setupVue",e=>e.use(ei));function ns(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 is=W({props:{visibility:{type:R(Number,Boolean),required:!0},display:{type:R(Object,String,Function),required:!0},style:R(String,Object,Array),classes:R(Object),glowColor:R(String),active:Boolean,floating:Boolean},emits:["selectTab"],setup(e,{emit:t}){const{display:n,glowColor:i,floating:r}=de(e),o=Sn(n),s=E(()=>{const c=pe(i);return c==null||c===""?{}:a(r)?ns(c):{boxShadow:`0px 9px 5px -6px ${c}`}});function l(){t("selectTab")}return{selectTab:l,component:o,glowColorStyle:s,unref:a,Visibility:Fe,isVisible:ze,isHidden:Lt}}});function rs(e,t,n,i,r,o){var s;return e.isVisible(e.visibility)?(_(),I("button",{key:0,onClick:t[0]||(t[0]=(...l)=>e.selectTab&&e.selectTab(...l)),class:oe(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:Me([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(s=e.unref(e.style))!=null?s:{}])},[(_(),G(we(e.component)))],6)):P("",!0)}var An=X(is,[["render",rs],["__scopeId","data-v-21427abb"]]);const as=W({props:{visibility:{type:R(Number,Boolean),required:!0},activeTab:{type:R(Object),required:!0},selected:{type:Object,required:!0},tabs:{type:R(Object),required:!0},style:R(String,Object,Array),classes:R(Object),buttonContainerStyle:R(String,Object,Array),buttonContainerClasses:R(Object)},components:{Sticky:Dn,TabButton:An},setup(e){const{activeTab:t}=de(e),n=E(()=>Ee[K.theme].floatingTabs),i=Ie("");Le(()=>{const l=pe(t);if(l==null){i.value="";return}if(Ke(l)){i.value=me(l);return}i.value=me(a(l.display))});const r=E(()=>{const l=pe(t);return Ke(l)||!l?void 0:a(l.classes)}),o=E(()=>{const l=pe(t);return Ke(l)||!l?void 0:a(l.style)});function s(l){const{display:c,style:f,classes:b,glowColor:h,visibility:C}=l;return{display:c,style:a(f),classes:b,glowColor:h,visibility:C}}return{floating:n,tabClasses:r,tabStyle:o,Visibility:Fe,component:i,gatherButtonProps:s,unref:a,isVisible:ze,isHidden:Lt}}});function os(e,t,n,i,r,o){var c,f;const s=Et("TabButton"),l=Et("Sticky");return e.isVisible(e.visibility)?(_(),I("div",{key:0,class:oe(["tab-family-container",{...e.unref(e.classes),...e.tabClasses}]),style:Me([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[],(f=e.tabStyle)!=null?f:[]])},[y(l,{class:oe(["tab-buttons-container",e.unref(e.buttonContainerClasses)]),style:Me(e.unref(e.buttonContainerStyle))},{default:A(()=>[m("div",{class:oe(["tab-buttons",{floating:e.floating}])},[(_(!0),I(Q,null,ut(e.unref(e.tabs),(b,h)=>(_(),G(s,Te({onSelectTab:C=>e.selected.value=h,floating:e.floating,key:h,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)?(_(),G(we(e.unref(e.component)),{key:0})):P("",!0)],6)):P("",!0)}var ss=X(as,[["render",os],["__scopeId","data-v-58dbf83a"]]);const ls=Symbol("TabButton"),us=Symbol("TabFamily");function cs(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=dt(Object.keys(e)[0],!1);return Ct(i=>{var s;const r=(s=t==null?void 0:t.call(i,i))!=null?s:{};r.id=_n("tabFamily-"),r.type=us,r[bt]=ss,r.tabs=Object.keys(e).reduce((l,c)=>{const f=e[c]();return f.type=ls,f[bt]=An,O(f,"visibility"),ge(f,"visibility",Fe.Visible),O(f,"tab"),O(f,"display"),O(f,"classes"),O(f,"style"),O(f,"glowColor"),l[c]=f,l},{}),r.selected=n,r.activeTab=E(()=>{const l=a(o.tabs);if(n.value in l&&ze(l[n.value].visibility))return a(l[n.value].tab);const c=Object.values(l).find(f=>ze(f.visibility));return c?a(c.tab):null}),O(r,"visibility"),ge(r,"visibility",Fe.Visible),O(r,"classes"),O(r,"style"),O(r,"buttonContainerClasses"),O(r,"buttonContainerStyle"),r[At]=function(){const{visibility:l,activeTab:c,selected:f,tabs:b,style:h,classes:C,buttonContainerClasses:N,buttonContainerStyle:S}=this;return{visibility:l,activeTab:c,selected:f,tabs:b,style:a(h),classes:C,buttonContainerClasses:N,buttonContainerStyle:S}};const o=r;return o})}const Ln=u.ln(10);function ht(e){return e}function ds(e,t){if(x(t))return t.invert(u.neg(e));throw new Error("Could not invert due to no input being a variable")}function gs(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return d.neg(t.getIntegralFormula(e))}throw new Error("Could not integrate due to no input being a variable")}function fs(e){return d.neg(e)}function ms(e,t,n){if(x(t))return t.invert(u.sub(e,ie(n)));if(x(n))return n.invert(u.sub(e,ie(t)));throw new Error("Could not invert due to no input being a variable")}function hs(e,t,n){var i,r;if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const o=t.getIntegralFormula(e);return d.times(n,(i=t.innermostVariable)!=null?i:0).add(o)}else if(x(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const o=n.getIntegralFormula(e);return d.times(t,(r=n.innermostVariable)!=null?r:0).add(o)}throw new Error("Could not integrate due to no input being a variable")}function vs(e,t,n){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return d.add(i,n)}else if(x(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return d.add(i,t)}throw new Error("Could not integrate due to no input being a variable")}function ps(e,t,n){if(x(t))return t.invert(u.add(e,ie(n)));if(x(n))return n.invert(u.sub(ie(t),e));throw new Error("Could not invert due to no input being a variable")}function bs(e,t,n){var i,r;if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const o=t.getIntegralFormula(e);return d.sub(o,d.times(n,(i=t.innermostVariable)!=null?i:0))}else if(x(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const o=n.getIntegralFormula(e);return d.times(t,(r=n.innermostVariable)!=null?r:0).sub(o)}throw new Error("Could not integrate due to no input being a variable")}function ys(e,t,n){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return d.sub(i,n)}else if(x(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return d.sub(i,t)}throw new Error("Could not integrate due to no input being a variable")}function _s(e,t,n){if(x(t))return t.invert(u.div(e,ie(n)));if(x(n))return n.invert(u.div(e,ie(t)));throw new Error("Could not invert due to no input being a variable")}function ws(e,t,n){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return d.times(i,n)}else if(x(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return d.times(i,t)}throw new Error("Could not integrate due to no input being a variable")}function Ns(e,t,n){if(x(t))return d.div(e,n);if(x(n))return d.div(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Cs(e,t,n){if(x(t))return t.invert(u.mul(e,ie(n)));if(x(n))return n.invert(u.div(ie(t),e));throw new Error("Could not invert due to no input being a variable")}function Ss(e,t,n){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return d.div(i,n)}else if(x(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return d.div(t,i)}throw new Error("Could not integrate due to no input being a variable")}function ks(e,t,n){if(x(t))return d.mul(e,n);if(x(n))return d.mul(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Is(e,t){if(x(t))return t.invert(u.recip(e));throw new Error("Could not invert due to no input being a variable")}function xs(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.ln(n)}throw new Error("Could not integrate due to no input being a variable")}function Ms(e,t){if(x(t))return t.invert(u.pow10(e));throw new Error("Could not invert due to no input being a variable")}function Es(e){return u.ln(e).sub(1).times(e).div(Ln)}function $s(e,t){if(x(t)){const n=Ln.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 Ts(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new d({inputs:[t.getIntegralFormula(e)],evaluate:Es,invert:$s})}throw new Error("Could not integrate due to no input being a variable")}function Fs(e,t,n){if(x(t))return t.invert(u.pow(ie(n),e));if(x(n))return n.invert(u.root(ie(t),e));throw new Error("Could not invert due to no input being a variable")}function Ps(e,t){return u.ln(e).sub(1).times(e).div(u.ln(t))}function Vs(e,t,n){if(x(t)){const i=u.ln(ie(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 Ds(e,t,n){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new d({inputs:[t.getIntegralFormula(e),n],evaluate:Ps,invert:Vs})}throw new Error("Could not integrate due to no input being a variable")}function Os(e,t){if(x(t))return t.invert(u.pow(2,e));throw new Error("Could not invert due to no input being a variable")}function As(e){return u.ln(e).sub(1).times(e).div(u.ln(2))}function Ls(e,t){if(x(t)){const n=u.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 Bs(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new d({inputs:[t.getIntegralFormula(e)],evaluate:As,invert:Ls})}throw new Error("Could not integrate due to no input being a variable")}function qs(e,t){if(x(t))return t.invert(u.exp(e));throw new Error("Could not invert due to no input being a variable")}function Rs(e){return u.ln(e).sub(1).times(e)}function zs(e,t){if(x(t))return t.invert(u.div(e,u.div(e,Math.E).lambertw()));throw new Error("Could not invert due to no input being a variable")}function Us(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new d({inputs:[t.getIntegralFormula(e)],evaluate:Rs,invert:zs})}throw new Error("Could not integrate due to no input being a variable")}function js(e,t,n){if(x(t))return t.invert(u.root(e,ie(n)));if(x(n))return n.invert(u.ln(e).div(u.ln(ie(t))));throw new Error("Could not invert due to no input being a variable")}function Ws(e,t,n){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e),r=d.add(n,1);return d.pow(i,r).div(r)}else if(x(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return d.pow(t,i).div(d.ln(t))}throw new Error("Could not integrate due to no input being a variable")}function Gs(e,t){if(x(t))return t.invert(u.root(e,10));throw new Error("Could not invert due to no input being a variable")}function Hs(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.pow10(n).div(d.ln(10))}throw new Error("Could not integrate due to no input being a variable")}function Zs(e,t,n){if(x(t))return t.invert(u.ln(e).div(ie(n)));if(x(n))return n.invert(u.root(ie(t),e));throw new Error("Could not invert due to no input being a variable")}function Ys(e,t,n){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return d.pow(n,i).div(d.ln(n))}else if(x(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e),r=d.add(t,1);return d.pow(i,r).div(r)}throw new Error("Could not integrate due to no input being a variable")}function Js(e,t,n){if(x(t))return t.invert(u.root(e,u.recip(ie(n))));if(x(n))return n.invert(u.ln(ie(t)).div(u.ln(e)));throw new Error("Could not invert due to no input being a variable")}function Ks(e,t,n){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return d.pow(i,d.recip(n).add(1)).times(n).div(d.add(n,1))}throw new Error("Could not integrate due to no input being a variable")}function Xs(e,t){if(x(t))return t.invert(u.ln(e));throw new Error("Could not invert due to no input being a variable")}function Qs(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.exp(n)}throw new Error("Could not integrate due to no input being a variable")}function el(e,t=2,n=u.fromComponents_noNormalize(1,0,1)){const i=u.minabs(t,1e308).toNumber();return u.tetrate(e,i,n)}function tl(e,t,n,i){if(x(t))return t.invert(u.ssqrt(e));throw new Error("Could not invert due to no input being a variable")}function nl(e,t=2,n=u.fromComponents_noNormalize(1,0,1)){const i=u.minabs(t,1e308).toNumber();return u.iteratedexp(e,i,new u(n))}function il(e,t,n,i){if(x(t))return t.invert(u.iteratedlog(e,Math.E,u.minabs(1e308,ie(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function rl(e,t=10,n=2){const i=u.minabs(n,1e308).toNumber();return u.iteratedlog(e,t,i)}function al(e,t=10){const n=u.minabs(t,1e308).toNumber();return u.slog(e,n)}function ol(e,t,n){if(x(t))return t.invert(u.tetrate(e,u.minabs(1e308,ie(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function sl(e,t,n){const i=u.minabs(t,1e308).toNumber();return u.layeradd(e,i,n)}function ll(e,t,n,i){if(x(t))return t.invert(u.layeradd(e,u.minabs(1e308,ie(n)).negate().toNumber()));throw new Error("Could not invert due to no input being a variable")}function ul(e,t){if(x(t))return t.invert(u.pow(Math.E,e).times(e));throw new Error("Could not invert due to no input being a variable")}function cl(e,t){if(x(t))return t.invert(u.tetrate(e,2));throw new Error("Could not invert due to no input being a variable")}function dl(e,t,n){const i=u.minabs(t,1e308).toNumber();return u.pentate(e,i,n)}function gl(e,t){if(x(t))return t.invert(u.asin(e));throw new Error("Could not invert due to no input being a variable")}function fl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.cos(n).neg()}throw new Error("Could not integrate due to no input being a variable")}function ml(e,t){if(x(t))return t.invert(u.acos(e));throw new Error("Could not invert due to no input being a variable")}function hl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.sin(n)}throw new Error("Could not integrate due to no input being a variable")}function vl(e,t){if(x(t))return t.invert(u.atan(e));throw new Error("Could not invert due to no input being a variable")}function pl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.cos(n).ln().neg()}throw new Error("Could not integrate due to no input being a variable")}function bl(e,t){if(x(t))return t.invert(u.sin(e));throw new Error("Could not invert due to no input being a variable")}function yl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.asin(n).times(n).add(d.sqrt(d.sub(1,d.pow(n,2))))}throw new Error("Could not integrate due to no input being a variable")}function _l(e,t){if(x(t))return t.invert(u.cos(e));throw new Error("Could not invert due to no input being a variable")}function wl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.acos(n).times(n).sub(d.sqrt(d.sub(1,d.pow(n,2))))}throw new Error("Could not integrate due to no input being a variable")}function Nl(e,t){if(x(t))return t.invert(u.tan(e));throw new Error("Could not invert due to no input being a variable")}function Cl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.atan(n).times(n).sub(d.ln(d.pow(n,2).add(1)).div(2))}throw new Error("Could not integrate due to no input being a variable")}function Sl(e,t){if(x(t))return t.invert(u.asinh(e));throw new Error("Could not invert due to no input being a variable")}function kl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.cosh(n)}throw new Error("Could not integrate due to no input being a variable")}function Il(e,t){if(x(t))return t.invert(u.acosh(e));throw new Error("Could not invert due to no input being a variable")}function xl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.sinh(n)}throw new Error("Could not integrate due to no input being a variable")}function Ml(e,t){if(x(t))return t.invert(u.atanh(e));throw new Error("Could not invert due to no input being a variable")}function El(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.cosh(n).ln()}throw new Error("Could not integrate due to no input being a variable")}function $l(e,t){if(x(t))return t.invert(u.sinh(e));throw new Error("Could not invert due to no input being a variable")}function Tl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.asinh(n).times(n).sub(d.pow(n,2).add(1).sqrt())}throw new Error("Could not integrate due to no input being a variable")}function Fl(e,t){if(x(t))return t.invert(u.cosh(e));throw new Error("Could not invert due to no input being a variable")}function Pl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.acosh(n).times(n).sub(d.add(n,1).sqrt().times(d.sub(n,1).sqrt()))}throw new Error("Could not integrate due to no input being a variable")}function Vl(e,t){if(x(t))return t.invert(u.tanh(e));throw new Error("Could not invert due to no input being a variable")}function Dl(e,t){if(x(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return d.atanh(n).times(n).add(d.sub(1,d.pow(n,2)).ln().div(2))}throw new Error("Could not integrate due to no input being a variable")}function gt(e){return(t,n)=>new d({inputs:[t,n],evaluate:e,invert:ht})}function x(e){return e instanceof ee&&e.hasVariable()}function ie(e,t){return e instanceof ee?e.evaluate(t):a(e)}function Ol(){return d.pow(this,2).div(2)}function Al(){return this}const ae=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"&&Ae in n?n[Ae]:n)),"variable"in e?(typeof e.variable=="object"&&Ae in e.variable&&(e.variable=e.variable[Ae]),t=this.setupVariable(e)):"evaluate"in e?t=this.setupFormula(e):t=this.setupConstant(e),this.inputs=t.inputs,this.internalVariables=t.internalVariables,this.innermostVariable=t.innermostVariable,this.internalEvaluate=t.internalEvaluate,this.internalInvert=t.internalInvert,this.internalIntegrate=t.internalIntegrate,this.internalIntegrateInner=t.internalIntegrateInner,this.applySubstitution=t.applySubstitution}setupVariable({variable:e}){return{inputs:[e],internalVariables:1,innermostVariable:e,internalIntegrate:Ol,internalIntegrateInner:Al,applySubstitution:ht}}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){const{inputs:t,evaluate:n,invert:i,integrate:r,integrateInner:o,applySubstitution:s}=e,l=t.reduce((b,h)=>b+(h instanceof ae?h.internalVariables:0),0),c=t.find(b=>b instanceof ae&&b.hasVariable()),f=l===1?c==null?void 0:c.innermostVariable:void 0;return{inputs:t,internalEvaluate:n,internalInvert:i,internalIntegrate:r,internalIntegrateInner:o,applySubstitution:s,innermostVariable:f,internalVariables:l}}isInvertible(){return this.hasVariable()&&(this.internalInvert!=null||this.internalEvaluate==null)}isIntegrable(){return this.hasVariable()&&this.internalIntegrate!=null}isIntegralInvertible(){return this.isIntegrable()?this.getIntegralFormula().isInvertible():!1}hasVariable(){return this.internalVariables===1}evaluate(e){var t,n,i;return(i=(n=(t=this.internalEvaluate)==null?void 0:t.call(this,...this.inputs.map(r=>ie(r,e))))!=null?n:this.hasVariable()?e:null)!=null?i:ie(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof ae&&e.inputs[n]instanceof ae?t.equals(e.inputs[n]):!(t instanceof ae)&&!(e.inputs[n]instanceof ae)&&u.eq(a(t),a(e.inputs[n])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new d({inputs:[e]})}static variable(e){return new d({variable:e})}static step(e,t,n){const i=F(0),r=n(d.variable(i)),o=Se(t);function s(c){return u.lt(c,a(o))?c:(i.value=u.sub(c,a(o)),u.add(r.evaluate(),a(o)))}function l(c,f){if(x(f)&&r.isInvertible())return u.gt(c,a(o))&&(c=u.add(r.invert(u.sub(c,a(o))),a(o))),f.invert(c);throw new Error("Could not invert due to no input being a variable")}return new d({inputs:[e],evaluate:s,invert:r.isInvertible()&&r.hasVariable()?l:void 0})}static if(e,t,n,i){const r=F(0),o=d.variable(r),s=n(o),l=i==null?void 0:i(o),c=Se(t);function f(h){return a(c)?(r.value=h,s.evaluate()):l?(r.value=h,l.evaluate()):h}function b(h,C){if(!x(C)||!s.isInvertible()||l!=null&&!l.isInvertible())throw new Error("Could not invert due to no input being a variable");return a(c)?C.invert(s.invert(h)):l?C.invert(l.invert(h)):C.invert(h)}return new d({inputs:[e],evaluate:f,invert:s.isInvertible()&&s.hasVariable()?b:void 0})}static conditional(e,t,n,i){return d.if(e,t,n,i)}static abs(e){return new d({inputs:[e],evaluate:u.abs})}static neg(e){return new d({inputs:[e],evaluate:u.neg,invert:ds,applySubstitution:fs,integrate:gs})}static sign(e){return new d({inputs:[e],evaluate:u.sign})}static round(e){return new d({inputs:[e],evaluate:u.round})}static floor(e){return new d({inputs:[e],evaluate:u.floor})}static ceil(e){return new d({inputs:[e],evaluate:u.ceil})}static trunc(e){return new d({inputs:[e],evaluate:u.trunc})}static add(e,t){return new d({inputs:[e,t],evaluate:u.add,invert:ms,integrate:hs,integrateInner:vs,applySubstitution:ht})}static sub(e,t){return new d({inputs:[e,t],evaluate:u.sub,invert:ps,integrate:bs,integrateInner:ys,applySubstitution:ht})}static mul(e,t){return new d({inputs:[e,t],evaluate:u.mul,invert:_s,integrate:ws,applySubstitution:Ns})}static div(e,t){return new d({inputs:[e,t],evaluate:u.div,invert:Cs,integrate:Ss,applySubstitution:ks})}static recip(e){return new d({inputs:[e],evaluate:u.recip,invert:Is,integrate:xs})}static clamp(e,t,n){return new d({inputs:[e,t,n],evaluate:u.clamp,invert:ht})}static pLog10(e){return new d({inputs:[e],evaluate:u.pLog10})}static absLog10(e){return new d({inputs:[e],evaluate:u.absLog10})}static log10(e){return new d({inputs:[e],evaluate:u.log10,invert:Ms,integrate:Ts})}static log(e,t){return new d({inputs:[e,t],evaluate:u.log,invert:Fs,integrate:Ds})}static log2(e){return new d({inputs:[e],evaluate:u.log2,invert:Os,integrate:Bs})}static ln(e){return new d({inputs:[e],evaluate:u.ln,invert:qs,integrate:Us})}static pow(e,t){return new d({inputs:[e,t],evaluate:u.pow,invert:js,integrate:Ws})}static pow10(e){return new d({inputs:[e],evaluate:u.pow10,invert:Gs,integrate:Hs})}static pow_base(e,t){return new d({inputs:[e,t],evaluate:u.pow_base,invert:Zs,integrate:Ys})}static root(e,t){return new d({inputs:[e,t],evaluate:u.root,invert:Js,integrate:Ks})}static factorial(e){return new d({inputs:[e],evaluate:u.factorial})}static gamma(e){return new d({inputs:[e],evaluate:u.gamma})}static lngamma(e){return new d({inputs:[e],evaluate:u.lngamma})}static exp(e){return new d({inputs:[e],evaluate:u.exp,invert:Xs,integrate:Qs})}static sqr(e){return d.pow(e,2)}static sqrt(e){return d.root(e,2)}static cube(e){return d.pow(e,3)}static cbrt(e){return d.root(e,3)}static tetrate(e,t=2,n=u.fromComponents_noNormalize(1,0,1)){return new d({inputs:[e,t,n],evaluate:el,invert:tl})}static iteratedexp(e,t=2,n=u.fromComponents_noNormalize(1,0,1)){return new d({inputs:[e,t,n],evaluate:nl,invert:il})}static iteratedlog(e,t=10,n=1){return new d({inputs:[e,t,n],evaluate:rl})}static slog(e,t=10){return new d({inputs:[e,t],evaluate:al,invert:ol})}static layeradd10(e,t){return new d({inputs:[e,t],evaluate:u.layeradd10})}static layeradd(e,t,n=10){return new d({inputs:[e,t,n],evaluate:sl,invert:ll})}static lambertw(e){return new d({inputs:[e],evaluate:u.lambertw,invert:ul})}static ssqrt(e){return new d({inputs:[e],evaluate:u.ssqrt,invert:cl})}static pentate(e,t=2,n=u.fromComponents_noNormalize(1,0,1)){return new d({inputs:[e,t,n],evaluate:dl})}static sin(e){return new d({inputs:[e],evaluate:u.sin,invert:bl,integrate:fl})}static cos(e){return new d({inputs:[e],evaluate:u.cos,invert:_l,integrate:hl})}static tan(e){return new d({inputs:[e],evaluate:u.tan,invert:Nl,integrate:pl})}static asin(e){return new d({inputs:[e],evaluate:u.asin,invert:gl,integrate:yl})}static acos(e){return new d({inputs:[e],evaluate:u.acos,invert:ml,integrate:wl})}static atan(e){return new d({inputs:[e],evaluate:u.atan,invert:vl,integrate:Cl})}static sinh(e){return new d({inputs:[e],evaluate:u.sinh,invert:$l,integrate:kl})}static cosh(e){return new d({inputs:[e],evaluate:u.cosh,invert:Fl,integrate:xl})}static tanh(e){return new d({inputs:[e],evaluate:u.tanh,invert:Vl,integrate:El})}static asinh(e){return new d({inputs:[e],evaluate:u.asinh,invert:Sl,integrate:Tl})}static acosh(e){return new d({inputs:[e],evaluate:u.acosh,invert:Il,integrate:Pl})}static atanh(e){return new d({inputs:[e],evaluate:u.atanh,invert:Ml,integrate:Dl})}step(e,t){return d.step(this,e,t)}if(e,t){return d.if(this,e,t)}conditional(e,t){return d.if(this,e,t)}abs(){return d.abs(this)}neg(){return d.neg(this)}sign(){return d.sign(this)}round(){return d.round(this)}floor(){return d.floor(this)}ceil(){return d.ceil(this)}trunc(){return d.trunc(this)}add(e){return d.add(this,e)}sub(e){return d.sub(this,e)}mul(e){return d.mul(this,e)}div(e){return d.div(this,e)}recip(){return d.recip(this)}max(e){return d.max(this,e)}min(e){return d.min(this,e)}maxabs(e){return d.maxabs(this,e)}minabs(e){return d.minabs(this,e)}clamp(e,t){return d.clamp(this,e,t)}clampMin(e){return d.clampMin(this,e)}clampMax(e){return d.clampMax(this,e)}pLog10(){return d.pLog10(this)}absLog10(){return d.absLog10(this)}log10(){return d.log10(this)}log(e){return d.log(this,e)}log2(){return d.log2(this)}ln(){return d.ln(this)}pow(e){return d.pow(this,e)}pow10(){return d.pow10(this)}pow_base(e){return d.pow_base(this,e)}root(e){return d.root(this,e)}factorial(){return d.factorial(this)}gamma(){return d.gamma(this)}lngamma(){return d.lngamma(this)}exp(){return d.exp(this)}sqr(){return d.pow(this,2)}sqrt(){return d.root(this,2)}cube(){return d.pow(this,3)}cbrt(){return d.root(this,3)}tetrate(e=2,t=u.fromComponents_noNormalize(1,0,1)){return d.tetrate(this,e,t)}iteratedexp(e=2,t=u.fromComponents_noNormalize(1,0,1)){return d.iteratedexp(this,e,t)}iteratedlog(e=10,t=1){return d.iteratedlog(this,e,t)}slog(e=10){return d.slog(this,e)}layeradd10(e){return d.layeradd10(this,e)}layeradd(e,t){return d.layeradd(this,e,t)}lambertw(){return d.lambertw(this)}ssqrt(){return d.ssqrt(this)}pentate(e=2,t=u.fromComponents_noNormalize(1,0,1)){return d.pentate(this,e,t)}sin(){return d.sin(this)}cos(){return d.cos(this)}tan(){return d.tan(this)}asin(){return d.asin(this)}acos(){return d.acos(this)}atan(){return d.atan(this)}sinh(){return d.sinh(this)}cosh(){return d.cosh(this)}tanh(){return d.tanh(this)}asinh(){return d.asinh(this)}acosh(){return d.acosh(this)}atanh(){return d.atanh(this)}};let ee=ae;ee.negate=ae.neg;ee.negated=ae.neg;ee.sgn=ae.sign;ee.plus=ae.add;ee.subtract=ae.sub;ee.minus=ae.sub;ee.multiply=ae.mul;ee.times=ae.mul;ee.divide=ae.div;ee.divideBy=ae.div;ee.dividedBy=ae.div;ee.reciprocal=ae.recip;ee.reciprocate=ae.recip;ee.max=gt(u.max);ee.min=gt(u.min);ee.minabs=gt(u.minabs);ee.maxabs=gt(u.maxabs);ee.clampMin=gt(u.clampMin);ee.clampMax=gt(u.clampMax);ee.logarithm=ae.log;class d extends ee{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=u.add(this.evaluate(0),this.evaluate(1)).div(2);return u.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 jt(e,t,n=!0,i){var o,s,l;let r=u.add(t,(o=a(e.innermostVariable))!=null?o:0);if(n){if(!e.isIntegrable())throw new Error("Cannot calculate cost with spending resources of non-integrable formula");const c=r;r=r.sub(i!=null?i:10).clampMin((s=a(e.innermostVariable))!=null?s:0);let f=u.sub(e.evaluateIntegral(r),e.evaluateIntegral());if(c.gt(1e308))return f.add(u.sub(c,r).times(e.evaluate(r)));for(let b=r.toNumber();b<c.toNumber();b++)f=f.add(e.evaluate(b));return f}else{const c=r;r=r.sub(i!=null?i:0).clampMin((l=a(e.innermostVariable))!=null?l:0);let f=e.evaluate(r);if(c.gt(1e308))return u.sub(c,r).add(1).times(f);for(let b=r.toNumber();b<c.toNumber();b++)f=u.add(f,e.evaluate(b));return f}}function Ll(e){return Ct(t=>{const{multiplier:n,description:i,enabled:r,smallerIsBetter:o}=e.call(t,t),s=Se(n),l=Se(i),c=r==null?void 0:Se(r);return{apply:f=>u.times(f,a(s)),invert:f=>u.div(f,a(s)),getFormula:f=>d.times(f,s),enabled:c,description:i==null?void 0:ne(()=>y("div",{class:"modifier-container"},[a(l)!=null?y("span",{class:"modifier-description"},[qe(a(l))]):null,y("span",{class:"modifier-amount",style:(o===!0?u.gt(a(s),1):u.lt(a(s),1))?"color: var(--danger)":""},[D("\xD7"),rt(a(s))])]))}})}function Bl(e){return Ct(()=>{const t=e();return{apply:n=>t.filter(i=>a(i.enabled)!==!1).reduce((i,r)=>r.apply(i),n),invert:t.every(n=>n.invert!=null)?n=>t.filter(i=>a(i.enabled)!==!1).reduceRight((i,r)=>r.invert(i),n):void 0,getFormula:t.every(n=>n.getFormula!=null)?n=>t.filter(i=>a(i.enabled)!==!1).reduce((i,r)=>r.getFormula(i),n):void 0,enabled:t.some(n=>n.enabled!=null)?E(()=>t.filter(n=>a(n.enabled)!==!1).length>0):void 0,description:t.some(n=>n.description!=null)?ne(()=>y(Q,null,[t.filter(n=>a(n.enabled)!==!1).map(n=>a(n.description)).filter(n=>n).map(qe)])):void 0}})}const ql={key:0},Rl={key:0,class:"mark star"},zl=["src"],Ul=W({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(_(),I("div",ql,[e.mark===!0?(_(),I("div",Rl)):(_(),I("img",{key:1,class:"mark",src:e.mark},null,8,zl))])):P("",!0)}});var Bn=X(Ul,[["__scopeId","data-v-2207999f"]]);const jl=W({__name:"Node",props:{id:null},setup(e){const n=de(e),i=$t(Yt,()=>{}),r=$t(Jt,()=>{}),o=Ie(null),s=E(()=>o.value&&o.value.parentElement);return xe([s,n.id],([l,c],[f,b])=>{f&&r(a(b)),l&&i(c,l)}),dn(()=>r(a(n.id))),(l,c)=>(_(),I("div",{class:"node",ref_key:"node",ref:o},null,512))}});var qn=X(jl,[["__scopeId","data-v-a48cb382"]]);W({props:{display:{type:R(Object,String,Function),required:!0},visibility:{type:R(Number,Boolean),required:!0},style:R(Object,String,Array),classes:R(Object),onClick:Function,onHold:Function,canClick:{type:R(Boolean),required:!0},small:Boolean,mark:R(Boolean,String),id:{type:String,required:!0}},components:{Node:qn,MarkNode:Bn},setup(e){const{display:t,onClick:n,onHold:i}=de(e),r=Ie("");Le(()=>{var b;const l=pe(t);if(l==null){r.value="";return}if(Ke(l)){r.value=me(l);return}const c=me((b=l.title)!=null?b:"","h3"),f=me(l.description,"div");r.value=me(ne(()=>y("span",null,[l.title!=null?y("div",null,[y(c,null,null)]):null,y(f,null,null)])))});const{start:o,stop:s}=Cn(n,i);return{start:o,stop:s,comp:r,Visibility:Fe,isVisible:ze,isHidden:Lt,unref:a}}});const Wl=["x1","y1","x2","y2"],Gl=W({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const n=de(e),i=E(()=>{const o=n.startNode.value.rect,s=n.boundingRect.value,l=s?{x:o.x+o.width/2-s.x,y:o.y+o.height/2-s.y}:{x:0,y:0};return n.link.value.offsetStart&&(l.x+=n.link.value.offsetStart.x,l.y+=n.link.value.offsetStart.y),l}),r=E(()=>{const o=n.endNode.value.rect,s=n.boundingRect.value,l=s?{x:o.x+o.width/2-s.x,y:o.y+o.height/2-s.y}:{x:0,y:0};return n.link.value.offsetEnd&&(l.x+=n.link.value.offsetEnd.x,l.y+=n.link.value.offsetEnd.y),l});return(o,s)=>(_(),I("line",Te({"stroke-width":"15px",stroke:"white"},e.link,{x1:a(i).x,y1:a(i).y,x2:a(r).x,y2:a(r).y}),null,16,Wl))}});const Hl=W({__name:"Links",props:{links:null},setup(e){var c;const n=Re(e,"links"),i=F(null),r=$t(Kt,F({})),o=$t(Xt,F(void 0)),s=F((c=i.value)==null?void 0:c.getBoundingClientRect());xe(o,()=>{var f;return s.value=(f=i.value)==null?void 0:f.getBoundingClientRect()}),Dt(()=>{var f;return s.value=(f=i.value)==null?void 0:f.getBoundingClientRect()});const l=E(()=>{var b,h;const f=r.value;return(h=(b=n.value)==null?void 0:b.filter(C=>{var N,S;return((N=f[C.startNode.id])==null?void 0:N.rect)&&((S=f[C.startNode.id])==null?void 0:S.rect)}))!=null?h:[]});return(f,b)=>(_(),I(Q,null,[a(l)?(_(),I("svg",Zn(Te({key:0},f.$attrs)),[(_(!0),I(Q,null,ut(a(l),(h,C)=>(_(),G(Gl,{key:C,link:h,boundingRect:s.value,startNode:a(r)[h.startNode.id],endNode:a(r)[h.endNode.id]},null,8,["link","boundingRect","startNode","endNode"]))),128))],16)):P("",!0),m("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var Zl=X(Hl,[["__scopeId","data-v-063f6d6b"]]);W({props:{nodes:{type:R(Array),required:!0},leftSideNodes:R(Array),rightSideNodes:R(Array),branches:R(Array)},components:{Links:Zl},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:i}=de(e),r=Ie();Le(()=>{const l=pe(t);r.value=me(ne(()=>y(Q,null,[l.map(c=>y("span",{class:"row tree-row",style:"margin: 50px auto;"},[c.map(qe)]))])))});const o=Ie();Le(()=>{const l=pe(n);o.value=l?me(ne(()=>y("span",{class:"left-side-nodes small"},[l.map(qe)]))):""});const s=Ie();return Le(()=>{const l=pe(i);s.value=l?me(ne(()=>y("span",{class:"side-nodes small"},[l.map(qe)]))):""}),{unref:a,nodesComp:r,leftNodesComp:o,rightNodesComp:s}}});W({props:{display:R(Object,String,Function),visibility:{type:R(Number,Boolean),required:!0},style:R(String,Object,Array),classes:R(Object),onClick:Function,onHold:Function,color:R(String),glowColor:R(String),canClick:{type:R(Boolean),required:!0},mark:R(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Bn,Node:qn},setup(e){const{onClick:t,onHold:n,display:i}=de(e),r=Nt(i),{start:o,stop:s}=Cn(t,n);return{start:o,stop:s,comp:r,unref:a,Visibility:Fe,isCoercableComponent:Ke,isVisible:ze,isHidden:Lt}}});function Yl(e){const t=[],n={};let i=!1;function r(){return i||(t.push(...e()),n.base=t.map(l=>Se(l.base)),n.baseText=t.map(l=>Se(l.baseText)),n.visible=t.map(l=>Se(l.visible)),n.title=t.map(l=>Se(l.title)),n.subtitle=t.map(l=>Se(l.subtitle)),i=!0),t}const o=dt({},!1);return[ne(()=>{const l=r();let c=!0;const f=l.map((b,h)=>{var U,w,k;if(a(n.visible[h])===!1)return null;const C=y("h3",{onClick:()=>o.value[h]=!o.value[h],style:"cursor: pointer"},[y("span",{class:"modifier-toggle"+(a(o.value[h])?" collapsed":"")},[D("\u25BC")]),a(n.title[h]),a(n.subtitle[h])!=null?y("span",{class:"subtitle"},[D(" ("),a(n.subtitle[h]),D(")")]):null]),N=a(o.value[h])?null:y(Q,null,[y("div",{class:"modifier-container"},[y("span",{class:"modifier-description"},[qe((U=a(n.baseText[h]))!=null?U:"Base")]),y("span",{class:"modifier-amount"},[Ot((w=a(n.base[h]))!=null?w:1),b.unit])]),b.modifier.description==null?null:qe(a(b.modifier.description))]),S=!c;c=!1;const p=(k=a(n.base[h]))!=null?k:1,T=b.modifier.apply(p);return y(Q,null,[S?y("br",null,null):null,y("div",{style:{"--unit":K.alignUnits&&b.unit!=null?"'"+b.unit+"'":""}},[C,y("br",null,null),N,y("hr",null,null),y("div",{class:"modifier-container"},[y("span",{class:"modifier-description"},[D("Total")]),y("span",{class:"modifier-amount",style:(b.smallerIsBetter===!0?u.gt(T,p!=null?p:1):u.lt(T,p!=null?p:1))?"color: var(--danger)":""},[rt(T),b.unit])])])])});return y(Q,null,[f])}),o]}function cn(e,t,n=1){const i=Se(t),r=Se(n);if(!e.hasVariable())throw new Error("Cannot create formula preview if the formula does not have a variable");return ne(()=>{var o;if(a(i)){const s=rt(e.evaluate()),l=rt(e.evaluate(u.add(a((o=e.innermostVariable)!=null?o:0),a(r))));return y(Q,null,[y("b",null,[y("i",null,[s,D(" \u2192 "),l])])])}return y(Q,null,[rt(e.evaluate())])})}const Jl=fn(),It={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},Rn=In("main",function(){const e=ts(0,"energy"),t=dt(!1),n=d.variable(0).add(1),i=E(()=>l.nodes.value.reduce(($,M)=>(M.type==="resource"&&($[M.state.type]=M),$),{})),r=E(()=>b.reduce(($,M)=>{var Z,le,se;const V=(se=(le=(Z=i.value[M])==null?void 0:Z.state)==null?void 0:le.amount)!=null?se:0;let te=u.floor(n.invertIntegral(V)).sub(10).clampMin(0),L=jt(n,te,!0,0);for(;;){const je=n.evaluate(te);if(u.add(L,je).lte(V))te=te.add(1),L=u.add(L,je);else break}return $[M]=te,$},{}));function o($){var Z,le,se;const M=(se=(le=(Z=i.value[$])==null?void 0:Z.state)==null?void 0:le.amount)!=null?se:0,V=r.value[$],te=jt(n,V,!0),L=jt(n,u.add(V,1),!0);return u.sub(M,te).max(0).div(u.sub(L,te)).toNumber()}const s=ct({});Qe(()=>{b.forEach($=>{xe(()=>r.value[$],(M,V)=>{u.gt(M,V)&&K.active===z.id&&Jl.info(y("div",null,[y("h3",null,[u.eq(M,1)?`${xt($)} discovered`:`${xt($)} is now Level ${it(M)}`,D("!")]),y("div",null,[D("Energy gain is now 1.01x higher.")])]))})})});const l=Qo($=>({startNodes:()=>[{position:{x:0,y:0},type:"mine",state:0},{position:{x:0,y:-200},type:"brokenFactory"}],types:{mine:{shape:Je.Diamond,size:50,title:"\u{1FAA8}",label:M=>M===$.selectedNode.value?{text:"Mining..."}:Object.keys(i.value).length===0?{text:"Click me!"}:null,progress:M=>M==$.selectedNode.value?new u(M.state).toNumber():0,progressDisplay:wt.Outline,progressColor:"var(--accent2)",classes:M=>({running:M===$.selectedNode.value}),draggable:!0},brokenFactory:{shape:Je.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:M=>M===$.selectedNode.value?{text:"Broken Forge"}:null,actionDistance:100,actions:[{id:"repair",icon:"build",tooltip:{text:"Repair - 1000 energy"},onClick(M){return $.selectedAction.value===this?u.gte(e.value,1e3)&&(M.type="factory",e.value=u.sub(e.value,1e3)):$.state.value={...$.state.value,selectedAction:this.id},!0}}],draggable:!0},factory:{shape:Je.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:M=>M===$.selectedNode.value?{text:t.value?"Forge":"Forge - Drag a material to me!"}:null,actionDistance:100,actions:[{id:"deselect",icon:"",tooltip:{text:"De-select material"},onClick(M){return $.selectedAction.value===this?M.state=void 0:$.state.value={...$.state.value,selectedAction:this.id},!0},visibility:M=>M.state!=null},{id:"craft",icon:"",tooltip:M=>({text:"Craft unknown item"}),onClick(M){return $.selectedAction.value===this||($.state.value={...$.state.value,selectedAction:this.id}),!0},visibility:M=>M.state!=null}],draggable:!0},resource:{shape:Je.Circle,size:50,title:M=>M.state.type,subtitle:M=>it(M.state.amount),progress:M=>o(M.state.type),onClick(){},progressDisplay:wt.Outline,progressColor:"var(--accent3)",draggable:!0}},style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden"},links(){const M=$.nodes.value.find(V=>V.type==="mine");return Object.keys(s).map(V=>({startNode:M,endNode:i.value[V],stroke:"var(--accent3)",strokeWidth:5}))}}));function c($,M){let V=i.value[$];if(V==null){const te=l.nodes.value.find(Z=>Z.type==="mine");let L=te.position.x;L=l.nodes.value.filter(Z=>Z.position.y<te.position.y+50&&Z.position.y>te.position.y-50).reduce((Z,le)=>Math.max(Z,le.position.x+100),0),V={id:es(l),position:{x:L,y:te.position.y},type:"resource",state:{type:$,amount:M}},l.nodes.value.push(V)}else{const te=V.state;V.state={...te,amount:u.add(te.amount,M)}}}const f=Object.values(It).reduce(($,M)=>$+M),b=Object.keys(It),h=Bl(()=>b.map($=>Ll(()=>({description:()=>`${xt($)} (Lv. ${it(r.value[$])})`,multiplier:()=>u.pow(1.01,r.value[$]),enabled:()=>{var M,V;return $ in i.value&&u.gt((V=(M=i.value[$].state)==null?void 0:M.amount)!=null?V:0,0)}})))),C=E(()=>h.apply(1)),[N,S]=Yl(()=>[{title:"Energy Gain",modifier:h,base:1,unit:"/s"}]),p=cs({general:()=>({display:"Energy",glowColor(){return p.activeTab.value===this.tab?"white":""},tab:N,energyTabCollapsed:S})}),T=F(!1),U=ne(()=>y(Ue,{modelValue:T.value,"onUpdate:modelValue":$=>T.value=$},{header:()=>y("h2",null,[D("Modifiers")]),body:()=>De(p)}));this.on("preUpdate",$=>{var M;if(Object.keys(s).forEach(V=>{s[V]-=$,s[V]<=0&&delete s[V]}),((M=l.selectedNode.value)==null?void 0:M.type)==="mine"){const V=l.selectedNode.value,te=u.add(V.state,$),L=te.floor();V.state=u.sub(te,L);const Z=L.div(f).floor();Z.gt(0)&&b.forEach(se=>{c(se,u.times(It[se],Z)),s[se]=.3});const le=u.sub(L,Z).toNumber();for(let se=0;se<le;se++){const je=Math.floor(Math.random()*f);let en=0;for(let qt=0;qt<b.length;qt++){const Rt=b[qt];if(en+=It[Rt],je<=en){c(Rt,1),s[Rt]=.3;break}}}}e.value=u.add(e.value,u.times(C.value,$))});const w=E(()=>l.selectedAction.value===l.types.brokenFactory.actions[0]?-1e3:0),k=cn(d.variable(0).add(e),()=>u.neq(w.value,0),w),q=E(()=>0),he=cn(d.variable(0).add(C),()=>u.neq(q.value,0),q);return{name:"World",board:l,energy:e,modifierTabs:p,hasForged:t,display:ne(()=>y(Q,null,[y(Dn,{class:"nav-container"},{default:()=>[y("span",{class:"nav-segment"},[y("h2",{style:"color: white; text-shadow: 0px 0px 10px white;"},[De(k)])," ",D("energy")]),y("span",{class:"nav-segment"},[D("("),y("h3",{style:"color: white; text-shadow: 0px 0px 10px white;"},[u.gt(C.value,0)?"+":"",De(he)]),D("/s)")]),y("span",{class:"nav-segment"},[y("button",{class:"button",style:"display: inline",onClick:()=>T.value=!0},[D("open modifiers")])]),z.devSpeed===0?y("span",{class:"nav-segment"},[D("Game Paused")]):z.devSpeed!=null&&z.devSpeed!==1?y("span",{class:"nav-segment"},[D("Dev Speed: "),Ot(z.devSpeed),D("x")]):null]}),De(l),De(U)]))}}),Kl=e=>[Rn],zn=E(()=>!1);function Xl(e,t){}var Ql=Object.freeze(Object.defineProperty({__proto__:null,main:Rn,getInitialLayers:Kl,hasWon:zn,fixOldSave:Xl},Symbol.toStringTag,{value:"Module"}));const St=e=>(et("data-v-4a50ce42"),e=e(),tt(),e),eu={class:"game-over-modal-header"},tu=["src","alt"],nu={class:"game-over-modal-title"},iu=St(()=>m("h2",null,"Congratulations!",-1)),ru={key:0},au=St(()=>m("br",null,null,-1)),ou=St(()=>m("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),su=St(()=>m("br",null,null,-1)),lu=["href"],uu=St(()=>m("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),cu=W({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:i,discordLink:r,versionNumber:o,versionTitle:s}=Y,l=E(()=>Ht(z.timePlayed)),c=E(()=>zn.value&&!z.keepGoing),f=Re(z,"autosave");function b(){z.keepGoing=!0}function h(){Ze(at())}return(C,N)=>(_(),G(Ue,{"model-value":a(c)},{header:A(()=>[m("div",eu,[a(n)?(_(),I("img",{key:0,class:"game-over-modal-logo",src:a(n),alt:a(t)},null,8,tu)):P("",!0),m("div",nu,[iu,m("h4",null,"You've beaten "+H(a(t))+" v"+H(a(o))+": "+H(a(s)),1)])])]),body:A(({shown:S})=>[S?(_(),I("div",ru,[m("div",null,"It took you "+H(a(l))+" to beat the game.",1),au,ou,su,m("div",null,[m("a",{href:a(r),class:"game-over-modal-discord-link"},[uu,D(" "+H(a(i)),1)],8,lu)]),y($e,{title:"Autosave",modelValue:a(f),"onUpdate:modelValue":N[0]||(N[0]=p=>fe(f)?f.value=p:null)},null,8,["modelValue"])])):P("",!0)]),footer:A(()=>[m("div",{class:"game-over-footer"},[m("button",{onClick:b,class:"button"},"Keep Going"),m("button",{onClick:h,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var du=X(cu,[["__scopeId","data-v-4a50ce42"]]);const Bt=e=>(et("data-v-2776d67d"),e=e(),tt(),e),gu=Bt(()=>m("div",{class:"nan-modal-header"},[m("h2",null,"NaN value detected!")],-1)),fu={key:0},mu=Bt(()=>m("br",null,null,-1)),hu=["href"],vu=Bt(()=>m("span",{class:"material-icons nan-modal-discord"},"discord",-1)),pu=Bt(()=>m("br",null,null,-1)),bu={class:"nan-footer"},yu=W({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=Y,i=F(!0),r=F(!0),o=Re(ue,"hasNaN"),s=F(null);xe(o,C=>{C?(i.value=z.autosave,r.value=z.devSpeed===0):(z.autosave=i.value,z.devSpeed=r.value?0:null)});const l=E(()=>{var C;return(C=ue.NaNPath)==null?void 0:C.join(".")}),c=E(()=>ue.NaNPersistent!=null?ue.NaNPersistent.value:null);function f(){ue.NaNPersistent!=null&&(ue.NaNPersistent.value=new u(0),ue.hasNaN=!1)}function b(){ue.NaNPersistent&&(ue.NaNPersistent.value=new u(1),ue.hasNaN=!1)}function h(){ue.NaNPersistent&&(ue.NaNPersistent.value=new u(NaN),ue.hasNaN=!1)}return(C,N)=>(_(),I(Q,null,[y(Ue,Te({modelValue:a(o),"onUpdate:modelValue":N[4]||(N[4]=S=>fe(o)?o.value=S:null)},C.$attrs),{header:A(()=>[gu]),body:A(()=>[m("div",null,[D(' Attempted to assign "'+H(a(l))+'" to NaN',1),a(c)?(_(),I("span",fu,H(" ")+"(previously "+H(a(Ot)(a(c)))+")",1)):P("",!0),D(". Auto-saving has been "+H(i.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),mu,m("div",null,[m("a",{href:a(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[vu,D(" "+H(a(t)||"The Paper Pilot Community"),1)],8,hu)]),pu,y($e,{title:"Autosave",modelValue:i.value,"onUpdate:modelValue":N[0]||(N[0]=S=>i.value=S)},null,8,["modelValue"]),a(Y).enablePausing?(_(),G($e,{key:0,title:"Pause game",modelValue:r.value,"onUpdate:modelValue":N[1]||(N[1]=S=>r.value=S)},null,8,["modelValue"])):P("",!0)]),footer:A(()=>[m("div",bu,[m("button",{onClick:N[2]||(N[2]=S=>{var p;return(p=s.value)==null?void 0:p.open()}),class:"button"},"Open Saves Manager"),m("button",{onClick:f,class:"button"},"Set to 0"),m("button",{onClick:b,class:"button"},"Set to 1"),a(c)&&a(u).neq(a(c),0)&&a(u).neq(a(c),1)?(_(),I("button",{key:0,onClick:N[3]||(N[3]=S=>o.value=!1),class:"button"}," Set to previous ")):P("",!0),m("button",{onClick:h,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),y(Pn,{ref_key:"savesManager",ref:s},null,512)],64))}});var _u=X(yu,[["__scopeId","data-v-2776d67d"]]);const wu={key:0,class:"tpsDisplay"},Nu={key:0,class:"low"},Cu=W({__name:"TPS",setup(e){const t=E(()=>u.div(ue.lastTenTicks.length,ue.lastTenTicks.reduce((o,s)=>o+s,0))),n=F([]);Le(()=>{n.value.push(Math.round(t.value.toNumber())),n.value.length>10&&(n.value=n.value.slice(1))});const i=E(()=>n.value.reduce((o,s)=>u.max(o,s),0)),r=E(()=>u.sub(t.value,i.value).gt(1));return(o,s)=>a(t).isNan()?P("",!0):(_(),I("div",wu,[D(" TPS: "+H(a(it)(a(t)))+" ",1),y(lt,{name:"fade"},{default:A(()=>[a(r)?(_(),I("span",Nu,H(a(it)(a(i))),1)):P("",!0)]),_:1})]))}});var Su=X(Cu,[["__scopeId","data-v-46a3ed5b"]]);var ku=W({__name:"App",setup(e){const t=Y.useHeader,n=E(()=>Ee[K.theme].variables),i=Re(K,"showTPS"),r=E(()=>me(ne(()=>y(Q,null,[sr.map(De)]))));return(o,s)=>(_(),I(Q,null,[m("div",{id:"modal-root",style:Me(a(n))},null,4),m("div",{class:oe(["app",{useHeader:a(t)}]),style:Me(a(n))},[a(t)?(_(),G(Vn,{key:0})):P("",!0),y(wo),a(a(i))?(_(),G(Su,{key:1})):P("",!0),y(du),y(_u),(_(),G(we(a(r))))],6)],64))}});var Iu=X(ku,[["__scopeId","data-v-41d15e5e"]]);function xu(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:o,onRegisterError:s}=e;let l,c,f,b;const h=async(N=!0)=>{await f,N&&(l==null||l.addEventListener("controlling",S=>{S.isUpdate&&window.location.reload()})),await(b==null?void 0:b())};async function C(){if("serviceWorker"in navigator){const{Workbox:N,messageSW:S}=await vt(()=>import("./workbox-window.4a8794bb.js"),[]);b=async()=>{c&&c.waiting&&await S(c.waiting,{type:"SKIP_WAITING"})},l=new N("./sw.js",{scope:"./",type:"classic"}),l.addEventListener("activated",p=>{p.isUpdate||i==null||i()});{const p=()=>{n==null||n()};l.addEventListener("waiting",p),l.addEventListener("externalwaiting",p)}l.register({immediate:t}).then(p=>{c=p,o?o("./sw.js",p):r==null||r(p)}).catch(p=>{s==null||s(p)})}}return f=C(),h}function Mu(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:o,onRegisterError:s}=e,l=F(!1),c=F(!1);return{updateServiceWorker:xu({immediate:t,onNeedRefresh(){l.value=!0,n==null||n()},onOfflineReady(){c.value=!0,i==null||i()},onRegistered:r,onRegisteredSW:o,onRegisterError:s}),offlineReady:c,needRefresh:l}}document.title=Y.title;window.projInfo=Y;if(Y.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 tr();const{globalBus:e}=await vt(()=>Promise.resolve().then(function(){return Qi}),void 0),{startGameLoop:t}=await vt(()=>import("./gameLoop.1677b2ed.js"),["assets/gameLoop.1677b2ed.js","assets/@fontsource.f66d05e7.css","assets/vue.804e2479.js","assets/amator.1e5a40c8.js","assets/bezier-easing.a990b400.js","assets/@vue.6f8187b0.js","assets/nanoevents.1080beb7.js","assets/lz-string.dccec454.js","assets/vue-next-select.f5f69b1a.js","assets/vue-next-select.9e6f4164.css","assets/vuedraggable.ce650350.js","assets/sortablejs.a0f68e5e.js","assets/vue-textarea-autosize.35804eaf.js","assets/vue-panzoom.89be130f.js","assets/panzoom.30c56ba6.js","assets/wheel.f2ae740f.js","assets/ngraph.events.083734c6.js","assets/vue-toastification.5231d1bd.js","assets/vue-toastification.4b5f8ac8.css"]),n=window.vue=Yn(Iu);e.emit("setupVue",n),n.mount("#app"),Qe(()=>{const i=fn(),{updateServiceWorker:r}=Mu({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(o){o&&setInterval(()=>o.update(),60*60*1e3)}})}),t()});export{u as D,vt as _,ue as a,Y as b,Ql as c,ye as g,nr as l,z as p,K as s};