Planar-Pioneers/assets/index.702ace04.js

18 lines
143 KiB
JavaScript

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