@kitten-science/kitten-scientists 2.0.0-beta.11-dev → 2.0.0-beta.11-dev.20250518

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ // ==UserScript==
2
+ // @name Kitten Scientists
3
+ // @description Add-on for the wonderful incremental browser game: https://kittensgame.com/web/
4
+ // @namespace https://kitten-science.com/
5
+ // @author Oliver Salzburg <oliver.salzburg@gmail.com>
6
+ // @icon https://kitten-science.com/assets/images/organization-logo64.png
7
+ // @match https://kittensgame.com/web/
8
+ // @match https://kittensgame.com/beta/
9
+ // @match https://kittensgame.com/alpha/
10
+ // @downloadURL https://kitten-science.com/fixed.js
11
+ // @homepageURL https://github.com/kitten-science/kitten-scientists
12
+ // @updateURL https://kitten-science.com/fixed.min.js
13
+ // @version 0.0.0-ci
14
+ // @grant none
15
+ // ==/UserScript==
16
+ (function(t){typeof define=="function"&&define.amd?define(t):t()})(function(){"use strict";var c=Object.defineProperty;var u=(t,i,s)=>i in t?c(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s;var h=(t,i,s)=>u(t,typeof i!="symbol"?i+"":i,s);function t(a){return a==null}const i=a=>e=>{a.error(e)};class s extends Error{constructor(e,l,r){super(l);h(this,"status");h(this,"code");this.code=e,this.name="AbstractError",this.status=r,typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,s)}static isAbstractError(e,l=!0){if(e instanceof s)return!0;if(l){const r=e;if(Object(e)===e&&"code"in r&&typeof r.code=="string"&&e.code.match(/^ERR_OS_/))return!0}return!1}}class o extends s{constructor(n,e=400){super("ERR_OS_INVALID_OPERATION",n,e),this.name="InvalidOperationError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,o)}}(async()=>{const a=document.querySelector("#ks-loader-singleton");if(!t(a))throw new o("The Kitten Science script loader was already created. This is unexpected.");if(typeof GM<"u"){const n=document.createElement("script");n.id="ks-loader-singleton",n.textContent='(function(m){typeof define=="function"&&define.amd?define(["dojo"],m):m()})(function(){"use strict";var jo=Object.defineProperty;var $s=m=>{throw TypeError(m)};var Jo=(m,N,j)=>N in m?jo(m,N,{enumerable:!0,configurable:!0,writable:!0,value:j}):m[N]=j;var u=(m,N,j)=>Jo(m,typeof N!="symbol"?N+"":N,j),Ls=(m,N,j)=>N.has(m)||$s("Cannot "+j);var P=(m,N,j)=>(Ls(m,N,"read from private field"),j?j.call(m):N.get(m)),I=(m,N,j)=>N.has(m)?$s("Cannot add the same private member more than once"):N instanceof WeakSet?N.add(m):N.set(m,j),L=(m,N,j,p)=>(Ls(m,N,"write to private field"),p?p.call(m,j):N.set(m,j),j);var Ue,De,Ne,qe,ze,Fe,He,We,Ge,Ze,Ke,Ve,je,Je,Xe,Ye,Qe,et,tt,it,st,nt,at,rt,ot,lt,ct,ht,ut,dt;function m(c){return c==null}function N(c,s){return!m(c)&&c instanceof s}class j extends Error{constructor(s="unexpected nil value"){super(s)}}function p(c,s){if(m(c))throw new j(s);return c}function ft(c,s){const e=new Array;for(const t of c)m(t)?m(s)||e.push(s):e.push(t);return e}const se=c=>e=>{c.error(e)};class be extends Error{constructor(e,t,i){super(t);u(this,"status");u(this,"code");this.code=e,this.name="AbstractError",this.status=i,typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,be)}static isAbstractError(e,t=!0){if(e instanceof be)return!0;if(t){const i=e;if(Object(e)===e&&"code"in i&&typeof i.code=="string"&&e.code.match(/^ERR_OS_/))return!0}return!1}}class bt extends be{constructor(s,e=400){super("ERR_OS_INVALID_OPERATION",s,e),this.name="InvalidOperationError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,bt)}}var qt,Pi;function Ii(){return Pi||(Pi=1,qt=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\\bsemver\\b/i.test(process.env.NODE_DEBUG)?(...s)=>console.error("SEMVER",...s):()=>{}),qt}var zt,$i;function Li(){if($i)return zt;$i=1;const c="2.0.0",s=256,e=Number.MAX_SAFE_INTEGER||9007199254740991,t=16,i=s-6;return zt={MAX_LENGTH:s,MAX_SAFE_COMPONENT_LENGTH:t,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:c,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},zt}var pt={exports:{}},Oi;function Os(){return Oi||(Oi=1,function(c,s){const{MAX_SAFE_COMPONENT_LENGTH:e,MAX_SAFE_BUILD_LENGTH:t,MAX_LENGTH:i}=Li(),n=Ii();s=c.exports={};const a=s.re=[],r=s.safeRe=[],o=s.src=[],l=s.safeSrc=[],h=s.t={};let d=0;const g="[a-zA-Z0-9-]",f=[["\\\\s",1],["\\\\d",i],[g,t]],w=k=>{for(const[y,A]of f)k=k.split(`${y}*`).join(`${y}{0,${A}}`).split(`${y}+`).join(`${y}{1,${A}}`);return k},b=(k,y,A)=>{const V=w(y),Q=d++;n(k,Q,y),h[k]=Q,o[Q]=y,l[Q]=V,a[Q]=new RegExp(y,A?"g":void 0),r[Q]=new RegExp(V,A?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\\\d*"),b("NUMERICIDENTIFIERLOOSE","\\\\d+"),b("NONNUMERICIDENTIFIER",`\\\\d*[a-zA-Z-]${g}*`),b("MAINVERSION",`(${o[h.NUMERICIDENTIFIER]})\\\\.(${o[h.NUMERICIDENTIFIER]})\\\\.(${o[h.NUMERICIDENTIFIER]})`),b("MAINVERSIONLOOSE",`(${o[h.NUMERICIDENTIFIERLOOSE]})\\\\.(${o[h.NUMERICIDENTIFIERLOOSE]})\\\\.(${o[h.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASEIDENTIFIER",`(?:${o[h.NONNUMERICIDENTIFIER]}|${o[h.NUMERICIDENTIFIER]})`),b("PRERELEASEIDENTIFIERLOOSE",`(?:${o[h.NONNUMERICIDENTIFIER]}|${o[h.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASE",`(?:-(${o[h.PRERELEASEIDENTIFIER]}(?:\\\\.${o[h.PRERELEASEIDENTIFIER]})*))`),b("PRERELEASELOOSE",`(?:-?(${o[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\\\.${o[h.PRERELEASEIDENTIFIERLOOSE]})*))`),b("BUILDIDENTIFIER",`${g}+`),b("BUILD",`(?:\\\\+(${o[h.BUILDIDENTIFIER]}(?:\\\\.${o[h.BUILDIDENTIFIER]})*))`),b("FULLPLAIN",`v?${o[h.MAINVERSION]}${o[h.PRERELEASE]}?${o[h.BUILD]}?`),b("FULL",`^${o[h.FULLPLAIN]}$`),b("LOOSEPLAIN",`[v=\\\\s]*${o[h.MAINVERSIONLOOSE]}${o[h.PRERELEASELOOSE]}?${o[h.BUILD]}?`),b("LOOSE",`^${o[h.LOOSEPLAIN]}$`),b("GTLT","((?:<|>)?=?)"),b("XRANGEIDENTIFIERLOOSE",`${o[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`),b("XRANGEIDENTIFIER",`${o[h.NUMERICIDENTIFIER]}|x|X|\\\\*`),b("XRANGEPLAIN",`[v=\\\\s]*(${o[h.XRANGEIDENTIFIER]})(?:\\\\.(${o[h.XRANGEIDENTIFIER]})(?:\\\\.(${o[h.XRANGEIDENTIFIER]})(?:${o[h.PRERELEASE]})?${o[h.BUILD]}?)?)?`),b("XRANGEPLAINLOOSE",`[v=\\\\s]*(${o[h.XRANGEIDENTIFIERLOOSE]})(?:\\\\.(${o[h.XRANGEIDENTIFIERLOOSE]})(?:\\\\.(${o[h.XRANGEIDENTIFIERLOOSE]})(?:${o[h.PRERELEASELOOSE]})?${o[h.BUILD]}?)?)?`),b("XRANGE",`^${o[h.GTLT]}\\\\s*${o[h.XRANGEPLAIN]}$`),b("XRANGELOOSE",`^${o[h.GTLT]}\\\\s*${o[h.XRANGEPLAINLOOSE]}$`),b("COERCEPLAIN",`(^|[^\\\\d])(\\\\d{1,${e}})(?:\\\\.(\\\\d{1,${e}}))?(?:\\\\.(\\\\d{1,${e}}))?`),b("COERCE",`${o[h.COERCEPLAIN]}(?:$|[^\\\\d])`),b("COERCEFULL",o[h.COERCEPLAIN]+`(?:${o[h.PRERELEASE]})?(?:${o[h.BUILD]})?(?:$|[^\\\\d])`),b("COERCERTL",o[h.COERCE],!0),b("COERCERTLFULL",o[h.COERCEFULL],!0),b("LONETILDE","(?:~>?)"),b("TILDETRIM",`(\\\\s*)${o[h.LONETILDE]}\\\\s+`,!0),s.tildeTrimReplace="$1~",b("TILDE",`^${o[h.LONETILDE]}${o[h.XRANGEPLAIN]}$`),b("TILDELOOSE",`^${o[h.LONETILDE]}${o[h.XRANGEPLAINLOOSE]}$`),b("LONECARET","(?:\\\\^)"),b("CARETTRIM",`(\\\\s*)${o[h.LONECARET]}\\\\s+`,!0),s.caretTrimReplace="$1^",b("CARET",`^${o[h.LONECARET]}${o[h.XRANGEPLAIN]}$`),b("CARETLOOSE",`^${o[h.LONECARET]}${o[h.XRANGEPLAINLOOSE]}$`),b("COMPARATORLOOSE",`^${o[h.GTLT]}\\\\s*(${o[h.LOOSEPLAIN]})$|^$`),b("COMPARATOR",`^${o[h.GTLT]}\\\\s*(${o[h.FULLPLAIN]})$|^$`),b("COMPARATORTRIM",`(\\\\s*)${o[h.GTLT]}\\\\s*(${o[h.LOOSEPLAIN]}|${o[h.XRANGEPLAIN]})`,!0),s.comparatorTrimReplace="$1$2$3",b("HYPHENRANGE",`^\\\\s*(${o[h.XRANGEPLAIN]})\\\\s+-\\\\s+(${o[h.XRANGEPLAIN]})\\\\s*$`),b("HYPHENRANGELOOSE",`^\\\\s*(${o[h.XRANGEPLAINLOOSE]})\\\\s+-\\\\s+(${o[h.XRANGEPLAINLOOSE]})\\\\s*$`),b("STAR","(<|>)?=?\\\\s*\\\\*"),b("GTE0","^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$"),b("GTE0PRE","^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$")}(pt,pt.exports)),pt.exports}var Ft,Ui;function Us(){if(Ui)return Ft;Ui=1;const c=Object.freeze({loose:!0}),s=Object.freeze({});return Ft=t=>t?typeof t!="object"?c:t:s,Ft}var Ht,Di;function Ds(){if(Di)return Ht;Di=1;const c=/^[0-9]+$/,s=(t,i)=>{const n=c.test(t),a=c.test(i);return n&&a&&(t=+t,i=+i),t===i?0:n&&!a?-1:a&&!n?1:t<i?-1:1};return Ht={compareIdentifiers:s,rcompareIdentifiers:(t,i)=>s(i,t)},Ht}var Wt,Ni;function Ns(){if(Ni)return Wt;Ni=1;const c=Ii(),{MAX_LENGTH:s,MAX_SAFE_INTEGER:e}=Li(),{safeRe:t,t:i}=Os(),n=Us(),{compareIdentifiers:a}=Ds();class r{constructor(l,h){if(h=n(h),l instanceof r){if(l.loose===!!h.loose&&l.includePrerelease===!!h.includePrerelease)return l;l=l.version}else if(typeof l!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof l}".`);if(l.length>s)throw new TypeError(`version is longer than ${s} characters`);c("SemVer",l,h),this.options=h,this.loose=!!h.loose,this.includePrerelease=!!h.includePrerelease;const d=l.trim().match(h.loose?t[i.LOOSE]:t[i.FULL]);if(!d)throw new TypeError(`Invalid Version: ${l}`);if(this.raw=l,this.major=+d[1],this.minor=+d[2],this.patch=+d[3],this.major>e||this.major<0)throw new TypeError("Invalid major version");if(this.minor>e||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>e||this.patch<0)throw new TypeError("Invalid patch version");d[4]?this.prerelease=d[4].split(".").map(g=>{if(/^[0-9]+$/.test(g)){const f=+g;if(f>=0&&f<e)return f}return g}):this.prerelease=[],this.build=d[5]?d[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(l){if(c("SemVer.compare",this.version,this.options,l),!(l instanceof r)){if(typeof l=="string"&&l===this.version)return 0;l=new r(l,this.options)}return l.version===this.version?0:this.compareMain(l)||this.comparePre(l)}compareMain(l){return l instanceof r||(l=new r(l,this.options)),a(this.major,l.major)||a(this.minor,l.minor)||a(this.patch,l.patch)}comparePre(l){if(l instanceof r||(l=new r(l,this.options)),this.prerelease.length&&!l.prerelease.length)return-1;if(!this.prerelease.length&&l.prerelease.length)return 1;if(!this.prerelease.length&&!l.prerelease.length)return 0;let h=0;do{const d=this.prerelease[h],g=l.prerelease[h];if(c("prerelease compare",h,d,g),d===void 0&&g===void 0)return 0;if(g===void 0)return 1;if(d===void 0)return-1;if(d===g)continue;return a(d,g)}while(++h)}compareBuild(l){l instanceof r||(l=new r(l,this.options));let h=0;do{const d=this.build[h],g=l.build[h];if(c("build compare",h,d,g),d===void 0&&g===void 0)return 0;if(g===void 0)return 1;if(d===void 0)return-1;if(d===g)continue;return a(d,g)}while(++h)}inc(l,h,d){if(l.startsWith("pre")){if(!h&&d===!1)throw new Error("invalid increment argument: identifier is empty");if(h){const g=`-${h}`.match(this.options.loose?t[i.PRERELEASELOOSE]:t[i.PRERELEASE]);if(!g||g[1]!==h)throw new Error(`invalid identifier: ${h}`)}}switch(l){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",h,d);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",h,d);break;case"prepatch":this.prerelease.length=0,this.inc("patch",h,d),this.inc("pre",h,d);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",h,d),this.inc("pre",h,d);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const g=Number(d)?1:0;if(this.prerelease.length===0)this.prerelease=[g];else{let f=this.prerelease.length;for(;--f>=0;)typeof this.prerelease[f]=="number"&&(this.prerelease[f]++,f=-2);if(f===-1){if(h===this.prerelease.join(".")&&d===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(g)}}if(h){let f=[h,g];d===!1&&(f=[h]),a(this.prerelease[0],h)===0?isNaN(this.prerelease[1])&&(this.prerelease=f):this.prerelease=f}break}default:throw new Error(`invalid increment argument: ${l}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Wt=r,Wt}var Gt,qi;function qs(){if(qi)return Gt;qi=1;const c=Ns();return Gt=(e,t,i)=>new c(e,i).compare(new c(t,i)),Gt}var Zt,zi;function zs(){if(zi)return Zt;zi=1;const c=qs();return Zt=(e,t,i)=>c(e,t,i)>0,Zt}zs();class Be extends be{constructor(s,e=500){super("ERR_OS_INTERNAL",s,e),this.name="InternalError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,Be)}static fromError(s){const e=new Be(s.message);return Object.assign(e,s,new Be(s.message)),e.stack=s.stack,e}}class Kt extends be{constructor(s,e=500){super("ERR_OS_UNKNOWN",s,e),this.name="UnknownError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,Kt)}}const Fs=c=>c instanceof Error||Object.prototype.toString.call(c)==="[object Error]",Hs=c=>be.isAbstractError(c)?c:Fs(c)?Be.fromError(c):new Kt(String(c)),ye=c=>{const s=performance.now();return[c(),performance.now()-s]},vt=async c=>{const s=performance.now();return[await c(),performance.now()-s]},ae=(c,s)=>c.filter(e=>!s.includes(e)),v=(...c)=>["👩‍🔬",...c.filter(s=>s!=="").flatMap(s=>{if(N(s,Error)){const e=s;return[e.name,e.message,e.stack]}return s})];function q(c){return Object.entries(c)}function z(c,s,e){if(m(s))return console.warn(...v("No source data was provided.")),c;for(const[t,i]of q(c))t in s||console.info(...v(`Entry \'${t}\' is missing in source. Using default value.`)),e(i,s[t]);for(const[t]of q(s))t in c||console.warn(...v(`Entry \'${t}\' was found in source, but it is not expected by the subject schema. This entry will be ignored.`));return c}class yt{constructor(s){u(this,"_elem");this._elem=structuredClone(s)}unwrap(){return structuredClone(this._elem)}replace(s){this._elem=structuredClone(s)}toJSON(){return this.unwrap()}}function X(c){return c.charAt(0).toUpperCase()+c.slice(1)}function Ws(c){return Math.round(c*100)/100}function Y(c){return c===-1?Number.POSITIVE_INFINITY:c}class wt{constructor(s,e){u(this,"_host");u(this,"_workshopManager");this._host=s,this._workshopManager=e}bulk(s,e,t,i){const n=[];let a=0;for(const[h,d]of q(s)){const g=oe.evaluateSubSectionTrigger(t,d.trigger),f=p(e[h]);if(!d.enabled||g<0||"tHidden"in f&&f.tHidden===!0||"rHidden"in f&&f.rHidden===!0||f.unlocked===!1||!m(d.max)&&-1<d.max&&d.max<=f.val||h==="cryochambers"&&(p(this._host.game.time.getVSU("usedCryochambers")).val>0||this._host.game.bld.getBuildingExt("chronosphere").meta.val<=f.val)||h==="ressourceRetrieval"&&f.val>=100)continue;const w=p(this._isStagedBuild(f)?f.stages[f.stage].prices:f.prices),b=this.getPriceRatio(f,i);if(!this.singleBuildPossible(f,w,b,i))continue;if(w.map(A=>this._workshopManager.getResource(A.name)).filter(A=>0<A.maxValue).filter(A=>A.value/A.maxValue<g).length===0){if(this._isStagedBuild(f)&&typeof d.stage<"u"&&d.stage!==f.stage)continue;const A=[],Q=1-this._host.game.getLimitedDR(this._host.game.getEffect(`${h}CostReduction`),1);for(const ce of w){const ee=1-this._host.game.getLimitedDR(this._host.game.getEffect(`${ce.name}CostReduction`),1);A.push({name:ce.name,val:ce.val*Q*ee})}n.push({count:0,id:h,label:d.label,limit:d.max||0,name:d.baseBuilding??d.building,priceRatio:b,prices:A,source:i,spot:a,val:f.val,variant:d.variant}),a++}}if(n.length===0)return[];const r={};for(const h of this._host.game.resPool.resources)r[h.name]=this._workshopManager.getValueAvailable(h.name);let o=0;const l=new Array;for(;o<1e5;){const h=ae(n,l);let d=0;const g=[];let f={...r};for(const w of l)f=this._precalculateBuilds({...w,limit:w.val+w.count},e,f).remainingResources;for(const w of h){const b=w.count+1,k=this._precalculateBuilds({...w,limit:Math.min(Y(w.limit),w.val+b)},e,f);if(k.count<b){g.push(w);continue}w.count=b,f=k.remainingResources,d++}if(l.push(...g),o++,d===0)break}return console.debug(...v(`Took \'${o}\' iterations to evaluate bulk build request.`)),l}_precalculateBuilds(s,e,t={}){let i=0;const n=Object.assign({},t),a=p(e[s.id]),r=s.prices,o=s.priceRatio,l=s.source;let h=!1;if(r.length===0)return{count:0,remainingResources:n};for(;!h;){for(let d=0;d<r.length;d++){let g=!1,f=!1,w=Number.POSITIVE_INFINITY,b=Number.POSITIVE_INFINITY;if(l==="Space"&&r[d].name==="oil"){g=!0;const k=this._host.game.getEffect("oilReductionRatio");w=r[d].val*(1-this._host.game.getLimitedDR(k,.75))}else if(s.id==="cryochambers"&&r[d].name==="karma"){f=!0;const k=this._host.game.prestige.getBurnedParagonRatio();b=r[d].val*(1-this._host.game.getLimitedDR(.01*k,1))}if(g?h=n.oil<w*1.05**(i+a.val):f?h=n.karma<b*o**(i+a.val):h=n[r[d].name]<r[d].val*o**(i+a.val),h||"noStackable"in a&&a.noStackable&&i+a.val>=1||s.id==="ressourceRetrieval"&&i+a.val>=100||s.id==="cryochambers"&&this._host.game.bld.getBuildingExt("chronosphere").meta.val<=i+a.val){for(let k=0;k<d;k++)if(l==="Space"&&r[k].name==="oil"){const y=this._host.game.getEffect("oilReductionRatio"),A=r[k].val*(1-this._host.game.getLimitedDR(y,.75));n.oil+=A*1.05**(i+a.val)}else if(s.id==="cryochambers"&&r[k].name==="karma"){const y=this._host.game.prestige.getBurnedParagonRatio(),A=r[k].val*(1-this._host.game.getLimitedDR(.01*y,1));n.karma+=A*o**(i+a.val)}else{const y=r[k].val*o**(i+a.val);n[r[k].name]+=r[k].name==="void"?Math.ceil(y):y}return s.limit&&s.limit!==-1&&(i=Math.max(0,Math.min(i,s.limit-s.val))),{count:i,remainingResources:n}}if(g)n.oil-=w*1.05**(i+a.val);else if(f)n.karma-=b*o**(i+a.val);else{const k=r[d].val*o**(i+a.val);n[r[d].name]-=r[d].name==="void"?Math.ceil(k):k}}++i}return{count:i,remainingResources:n}}construct(s,e,t){if(!("name"in s)||!("controller"in s.options)||!("getMetadata"in s.options.controller))return 0;const i=s.metadata;let n=0,a=t;const r=i;if(!m(r.limitBuild)&&r.limitBuild-r.val<a&&(a=r.limitBuild-r.val),s.enabled&&e.hasResources(s)||this._host.game.devMode){for(;e.hasResources(s)&&a>0;)s.prices=e.getPrices(s),e.payPrice(s),e.incrementValue(s),n++,a--;r.breakIronWill&&(this._host.game.ironWill=!1),m(i)||("unlocks"in i&&!m(i.unlocks)&&this._host.game.unlock(i.unlocks),"upgrades"in i&&!m(i.upgrades)&&this._host.game.upgrade(i.upgrades))}return n}_isStagedBuild(s){return"stage"in s&&"stages"in s&&!m(s.stage)&&!m(s.stages)}getPriceRatio(s,e){const t=this._isStagedBuild(s)?s.priceRatio||s.stages[s.stage].priceRatio:s.priceRatio??0;let i=0;return e&&e==="Bonfire"&&(i=this._host.game.getEffect(`${s.name}PriceRatio`)+this._host.game.getEffect("priceRatio")+this._host.game.getEffect("mapPriceReduction"),i=this._host.game.getLimitedDR(i,t-1)),t+i}singleBuildPossible(s,e,t,i){const a=1-this._host.game.getLimitedDR(this._host.game.getEffect(`${s.name}CostReduction`),1);for(const r of e){const l=1-this._host.game.getLimitedDR(this._host.game.getEffect(`${r.name}CostReduction`),1),h=r.val*a*l;if(i&&i==="Space"&&r.name==="oil"){const d=this._host.game.getLimitedDR(this._host.game.getEffect("oilReductionRatio"),.75),g=h*(1-d);if(this._workshopManager.getValueAvailable("oil")<g*1.05**s.val)return!1}else if(s.name==="cryochambers"&&r.name==="karma"){const d=this._host.game.getLimitedDR(.01*this._host.game.prestige.getBurnedParagonRatio(),1),g=h*(1-d);if(this._workshopManager.getValueAvailable("karma")<g*t**s.val)return!1}else if(this._workshopManager.getValueAvailable(r.name)<h*t**s.val)return!1}return!0}}const Fi=["academy","accelerator","aiCore","amphitheatre","aqueduct","barn","biolab","brewery","calciner","chapel","chronosphere","factory","field","harbor","hut","library","logHouse","lumberMill","magneto","mansion","mine","mint","observatory","oilWell","pasture","quarry","reactor","smelter","steamworks","temple","tradepost","unicornPasture","warehouse","workshop","zebraForge","zebraOutpost","zebraWorkshop","ziggurat"],Vt=["broadcasttower","dataCenter","hydroplant","solarfarm","spaceport"],Gs=["autumn","spring","summer","winter"],we=["charon","umbra","yarn","helios","cath","redmoon","dune","piscine","terminus","kairo"],Hi=["alloy","beam","bloodstone","blueprint","compedium","concrate","eludium","gear","kerosene","manuscript","megalith","parchment","plate","scaffold","ship","slab","steel","tanker","tMythril","thorium","wood"],Wi=[...Hi,"alicorn","antimatter","blackcoin","burnedParagon","catnip","coal","culture","elderBox","faith","furs","gflops","gold","hashrates","iron","ivory","karma","kittens","manpower","minerals","necrocorn","oil","paragon","relic","science","sorrow","spice","starchart","tears","temporalFlux","timeCrystal","titanium","unicorns","unobtainium","uranium","void","wrappingPaper","zebras"],Gi=["any","engineer","farmer","geologist","hunter","miner","priest","scholar","woodcutter"],Zs=["chemist","engineer","manager","metallurgist","merchant","none","scientist","wise"];var H=(c=>(c.Cryptotheology="c",c.OrderOfTheSun="s",c.Ziggurat="z",c.UnicornPasture="zp",c))(H||{});const Zi=["apocripha","basilica","goldenSpire","scholasticism","solarRevolution","solarchant","stainedGlass","sunAltar","templars","transcendence"],Ki=["blackCore","blackLibrary","blackNexus","blackObelisk","blackRadiance","blazar","darkNova","holyGenocide","mausoleum","singularity"],Vi=["blackPyramid","ivoryCitadel","ivoryTower","marker","skyPalace","sunspire","unicornGraveyard","unicornNecropolis","unicornTomb","unicornUtopia"],ji=["dragons","griffins","nagas","leviathans","lizards","sharks","spiders","zebras"],Ks=["authocracy","bigStickPolicy","carnivale","cityOnAHill","clearCutting","communism","conservation","cryochamberExtraction","culturalExchange","diplomacy","dragonRelationsAstrologers","dragonRelationsDynamicists","dragonRelationsPhysicists","environmentalism","epicurianism","expansionism","extravagance","fascism","frugality","fullIndustrialization","griffinRelationsMachinists","griffinRelationsMetallurgists","griffinRelationsScouts","isolationism","knowledgeSharing","liberalism","liberty","lizardRelationsDiplomats","lizardRelationsEcologists","lizardRelationsPriests","militarizeSpace","monarchy","mysticism","nagaRelationsArchitects","nagaRelationsCultists","nagaRelationsMasons","necrocracy","openWoodlands","outerSpaceTreaty","radicalXenophobia","rationality","rationing","republic","scientificCommunism","sharkRelationsBotanists","sharkRelationsMerchants","sharkRelationsScribes","siphoning","socialism","spiderRelationsChemists","spiderRelationsGeologists","spiderRelationsPaleontologists","stoicism","stripMining","sustainability","technocracy","terraformingInsight","theocracy","tradition","transkittenism","zebraRelationsAppeasement","zebraRelationsBellicosity"],Ji=["brewery"],Vs=["acoustics","advExogeology","agriculture","ai","animal","antimatter","archeology","archery","architecture","artificialGravity","astronomy","biochemistry","biology","blackchain","calendar","chemistry","chronophysics","civil","combustion","construction","cryptotheology","currency","dimensionalPhysics","drama","ecology","electricity","electronics","engineering","exogeology","exogeophysics","genetics","hydroponics","industrialization","machinery","math","mechanization","metal","metalurgy","metaphysics","mining","nanotechnology","navigation","nuclearFission","oilProcessing","orbitalEngineering","paradoxalKnowledge","particlePhysics","philosophy","physics","quantumCryptography","robotics","rocketry","sattelites","steel","superconductors","tachyonTheory","terraformation","theology","thorium","voidSpace","writing"],js=["centaurusSystemMission","charonMission","duneMission","furthestRingMission","heliosMission","kairoMission","moonMission","orbitalLaunch","piscineMission","rorschachMission","terminusMission","umbraMission","yarnMission"],Xi=["containmentChamber","cryostation","entangler","heatsink","hrHarvester","hydrofracturer","hydroponics","moltenCore","moonBase","moonOutpost","orbitalArray","planetCracker","researchVessel","sattelite","spaceBeacon","spaceElevator","spaceStation","spiceRefinery","sunforge","sunlifter","tectonic","terraformingStation"],Yi=["blastFurnace","ressourceRetrieval","temporalAccelerator","temporalBattery","temporalImpedance","temporalPress","timeBoiler"],Qi=["cryochambers","usedCryochambers","voidHoover","voidRift","chronocontrol","voidResonator"],es=["advancedAutomation","advancedRefinement","aiBases","aiEngineers","alloyArmor","alloyAxe","alloyBarns","alloySaw","alloyWarehouses","amBases","amDrive","amFission","amReactors","amReactorsMK2","assistance","astrolabe","astrophysicists","augumentation","automatedPlants","barges","biofuel","bolas","cadSystems","caravanserai","carbonSequestration","cargoShips","celestialMechanics","chronoEngineers","chronoforge","coalFurnace","coldFusion","combustionEngine","compositeBow","concreteBarns","concreteHuts","concreteWarehouses","crossbow","cryocomputing","darkEnergy","deepMining","distorsion","electrolyticSmelting","eludiumCracker","eludiumHuts","eludiumReflectors","energyRifts","enrichedThorium","enrichedUranium","factoryAutomation","factoryLogistics","factoryOptimization","factoryProcessing","factoryRobotics","fluidizedReactors","fluxCondensator","fuelInjectors","geodesy","gmo","goldOre","hubbleTelescope","huntingArmor","hydroPlantTurbines","internet","invisibleBlackHand","ironAxes","ironHoes","ironwood","lhc","logistics","longRangeSpaceships","machineLearning","mineralAxes","mineralHoes","miningDrill","mWReactor","nanosuits","neuralNetworks","nuclearPlants","nuclearSmelters","offsetPress","oilDistillation","oilRefinery","orbitalGeodesy","oxidation","photolithography","photovoltaic","pneumaticPress","printingPress","pumpjack","pyrolysis","qdot","railgun","reactorVessel","refrigeration","register","reinforcedBarns","reinforcedSaw","reinforcedWarehouses","relicStation","rotaryKiln","satelliteRadio","satnav","seti","silos","solarSatellites","spaceEngineers","spaceManufacturing","spiceNavigation","starlink","stasisChambers","steelArmor","steelAxe","steelPlants","steelSaw","stoneBarns","storageBunkers","strenghtenBuild","tachyonAccelerators","thinFilm","thoriumEngine","thoriumReactors","titaniumAxe","titaniumBarns","titaniumMirrors","titaniumSaw","titaniumWarehouses","turnSmoothly","unicornSelection","unobtainiumAxe","unobtainiumDrill","unobtainiumHuts","unobtainiumReflectors","unobtainiumSaw","uplink","voidAspiration","voidEnergy","voidReactors"];var he=(c=>(c.Chronoforge="chrono",c.VoidSpace="void",c))(he||{});const kt=["ivoryCitadel","ivoryTower","skyPalace","sunspire","unicornPasture","unicornTomb","unicornUtopia"],Js=["sacrificeUnicorns","sacrificeAlicorns","refineTears","refineTimeCrystals","transcend","adore","autoPraise"];class _{constructor(s=!1){u(this,"enabled");this.enabled=s}load(s){m(s)||(this.enabled=s.enabled??this.enabled)}serialize(){return this}}class ts extends _{constructor(e=!1,t=!1){super(e);u(this,"limited");this.limited=t}load(e){m(e)||(super.load(e),this.limited=e.limited??this.limited)}}class K extends _{constructor(e=!1,t=-1){super(e);u(this,"trigger");this.trigger=t}load(e){m(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class re extends _{constructor(e=!1,t=1){super(e);u(this,"trigger");this.trigger=t}load(e){m(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class is extends _{constructor(e=!1,t=0){super(e);u(this,"max");this.max=t}load(e){m(e)||(super.load(e),this.max=e.max??this.max)}}class Xs extends ts{constructor(e=!1,t=!1,i=0){super(e,t);u(this,"max");this.max=i}load(e){m(e)||(super.load(e),this.max=e.max??this.max)}}class Ys extends Xs{constructor(e=!1,t=!1,i=0,n=-1){super(e,t,i);u(this,"trigger");this.trigger=n}load(e){m(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class Qs extends ts{constructor(e=!1,t=!1,i=-1){super(e,t);u(this,"trigger");this.trigger=i}load(e){m(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class _t extends K{constructor(e=!1,t=-1,i=0){super(e,t);u(this,"max");this.max=i}load(e){m(e)||(super.load(e),this.max=e.max??this.max)}}class en extends re{constructor(e=!1,t=1,i=0){super(e,t);u(this,"max");this.max=i}load(e){m(e)||(super.load(e),this.max=e.max??this.max)}}class jt{constructor(s,e=new Array){I(this,Ue);u(this,"selected");if(m(e.find(t=>t.value===s)))throw new Error("Provided selected value is not in provided options.");this.selected=s,L(this,Ue,e)}get options(){return P(this,Ue)}load(s){m(s)||(this.selected=s.selected??this.selected)}}Ue=new WeakMap;class tn extends re{constructor(e=!1,t=950,i=1e3,n=1){super(e,n);u(this,"buy");u(this,"sell");this.buy=t,this.sell=i}load(e){m(e)||(super.load(e),this.buy=e.buy??this.buy,this.sell=e.sell??this.sell)}}class sn extends _{constructor(e,t=!1){super(t);I(this,De);L(this,De,e)}get upgrade(){return P(this,De)}}De=new WeakMap;class nn extends _{constructor(e=!1){super(e);u(this,"buildings");this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of Vt)e[t]=new sn(t);return e}load(e){m(e)||(super.load(e),z(this.buildings,e.buildings,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled}))}}class Jt extends _t{constructor(e,t=!1,i=-1,n=0,a){super(t,i,n);I(this,Ne);I(this,qe);I(this,ze,0);L(this,qe,e),a&&(L(this,ze,1),L(this,Ne,a))}get baseBuilding(){return P(this,Ne)}get building(){return P(this,qe)}get stage(){return P(this,ze)}}Ne=new WeakMap,qe=new WeakMap,ze=new WeakMap;class Xt extends K{constructor(e=!1,t=-1,i=new _,n=new _,a=new _,r=new _,o=new nn){super(e,t);u(this,"buildings");u(this,"gatherCatnip");u(this,"turnOnMagnetos");u(this,"turnOnSteamworks");u(this,"turnOnReactors");u(this,"upgradeBuildings");this.buildings=this.initBuildings(),this.gatherCatnip=i,this.turnOnSteamworks=n,this.turnOnMagnetos=a,this.turnOnReactors=r,this.upgradeBuildings=o}initBuildings(){const e={broadcasttower:"amphitheatre",dataCenter:"library",hydroplant:"aqueduct",solarfarm:"pasture",spaceport:"warehouse"},t={};for(const i of Fi)i!=="unicornPasture"&&(t[i]=new Jt(i));for(const i of Vt)t[i]=new Jt(i,!1,-1,0,e[i]);return t}load(e){var t,i,n,a;m(e)||(super.load(e),z(this.buildings,e.buildings,(r,o)=>{r.enabled=(o==null?void 0:o.enabled)??r.enabled,r.max=(o==null?void 0:o.max)??r.max,r.trigger=(o==null?void 0:o.trigger)??r.trigger}),this.gatherCatnip.enabled=((t=e.gatherCatnip)==null?void 0:t.enabled)??this.gatherCatnip.enabled,this.turnOnSteamworks.enabled=((i=e.turnOnSteamworks)==null?void 0:i.enabled)??this.turnOnSteamworks.enabled,this.turnOnMagnetos.enabled=((n=e.turnOnMagnetos)==null?void 0:n.enabled)??this.turnOnMagnetos.enabled,this.turnOnReactors.enabled=((a=e.turnOnReactors)==null?void 0:a.enabled)??this.turnOnReactors.enabled,this.upgradeBuildings.load(e.upgradeBuildings))}}class me{constructor(s,e){u(this,"_host");u(this,"tab");this._host=s;const t=this._host.game.tabs.find(i=>i.tabId===e);if(m(t))throw new Error(`Unable to find tab ${e}`);this.tab=t,this.render()}render(){return this._host.game.ui.activeTabId!==this.tab.tabId&&this.tab.render(),this}}class an{constructor(s,e,t=new Xt){u(this,"_host");u(this,"settings");u(this,"manager");u(this,"_bulkManager");u(this,"_workshopManager");this._host=s,this.settings=t,this.manager=new me(this._host,"Bonfire"),this._workshopManager=e,this._bulkManager=new wt(this._host,this._workshopManager)}tick(s){this.settings.enabled&&(this.manager.render(),this.autoBuild(s),this.autoMisc(s))}autoBuild(s,e=this.settings.buildings){const t=this._bulkManager,i={};for(const r of Object.values(e))i[r.building]=this.getBuild(r.baseBuilding??r.building).meta;const n=this.settings.trigger,a=t.bulk(e,i,n,"Bonfire");for(const r of a.filter(o=>0<o.count))this.build(r.name||r.id,r.stage,r.count),s.requestGameUiRefresh=!0}autoUpgrade(s){var l,h,d,g,f,w,b;const e=this._host.game.bld.getBuildingExt("pasture").meta.stage===0?this._host.game.bld.getBuildingExt("pasture").meta.val:0,t=this._host.game.bld.getBuildingExt("aqueduct").meta.stage===0?this._host.game.bld.getBuildingExt("aqueduct").meta.val:0,i=this._host.game.bld.getBuildingExt("pasture").meta;if(this.settings.upgradeBuildings.buildings.solarfarm.enabled&&i.unlocked&&i.stage===0&&p(i.stages)[1].stageUnlocked&&this._workshopManager.getPotentialCatnip(!0,0,t)>0){const k=p(i.stages)[1].prices;if(this._bulkManager.singleBuildPossible(i,k,1)){const y=this.getBuildButton("pasture",0);m(y==null?void 0:y.model)||(y.controller.sellInternal(y.model,0,!1),i.on=0,i.val=0,i.stage=1,this._host.engine.iactivity("upgrade.building.pasture",[],"ks-upgrade"),(l=this._host.game.ui)==null||l.render(),this.build("pasture",1,1),s.requestGameUiRefresh=!0)}}const n=this._host.game.bld.getBuildingExt("aqueduct").meta;if(this.settings.upgradeBuildings.buildings.hydroplant.enabled&&n.unlocked&&n.stage===0&&p(n.stages)[1].stageUnlocked&&this._workshopManager.getPotentialCatnip(!0,e,0)>0){const k=p(n.stages)[1].prices;if(this._bulkManager.singleBuildPossible(n,k,1)){const y=this.getBuildButton("aqueduct",0);m(y==null?void 0:y.model)||(y.controller.sellInternal(y.model,0,!1),n.on=0,n.val=0,n.stage=1,(h=n.calculateEffects)==null||h.call(n,n,this._host.game),this._host.engine.iactivity("upgrade.building.aqueduct",[],"ks-upgrade"),(d=this._host.game.ui)==null||d.render(),this.build("aqueduct",1,1),s.requestGameUiRefresh=!0)}}const a=this._host.game.bld.getBuildingExt("library").meta;if(this.settings.upgradeBuildings.buildings.dataCenter.enabled&&a.unlocked&&a.stage===0&&p(a.stages)[1].stageUnlocked){let k=this._host.game.workshop.get("cryocomputing").researched?1:2;this._host.game.challenges.currentChallenge==="energy"&&(k*=2);let y=3;if(this._host.game.workshop.get("uplink").researched&&(y*=1+this._host.game.bld.getBuildingExt("biolab").meta.val*this._host.game.getEffect("uplinkDCRatio")),this._host.game.workshop.get("machineLearning").researched&&(y*=1+this._host.game.bld.getBuildingExt("aiCore").meta.on*this._host.game.getEffect("dataCenterAIRatio")),this._host.game.resPool.energyProd>=this._host.game.resPool.energyCons+k*a.val/y){const A=p(a.stages)[1].prices;if(this._bulkManager.singleBuildPossible(a,A,1)){const V=p(this.getBuildButton("library",0));if(m(V.model))return;V.controller.sellInternal(V.model,0,!1),a.on=0,a.val=0,a.stage=1,(g=a.calculateEffects)==null||g.call(a,a,this._host.game),this._host.engine.iactivity("upgrade.building.library",[],"ks-upgrade"),(f=this._host.game.ui)==null||f.render(),this.build("library",1,1),s.requestGameUiRefresh=!0;return}}}const r=this._host.game.bld.getBuildingExt("warehouse").meta;if(this.settings.upgradeBuildings.buildings.spaceport.enabled&&r.unlocked&&r.stage===0&&p(r.stages)[1].stageUnlocked){const k=p(r.stages)[1].prices;if(this._bulkManager.singleBuildPossible(r,k,1)){const y=this.getBuildButton("warehouse",0);if(!m(y==null?void 0:y.model)){y.controller.sellInternal(y.model,0,!1),r.on=0,r.val=0,r.stage=1,this._host.engine.iactivity("upgrade.building.warehouse",[],"ks-upgrade"),(w=this._host.game.ui)==null||w.render(),this.build("warehouse",1,1),s.requestGameUiRefresh=!0;return}}}const o=this._host.game.bld.getBuildingExt("amphitheatre").meta;if(this.settings.upgradeBuildings.buildings.broadcasttower.enabled&&o.unlocked&&o.stage===0&&p(o.stages)[1].stageUnlocked){const k=p(o.stages)[1].prices;if(this._bulkManager.singleBuildPossible(o,k,1)){const y=this.getBuildButton("amphitheatre",0);m(y==null?void 0:y.model)||(y.controller.sellInternal(y.model,0,!1),o.on=0,o.val=0,o.stage=1,this._host.engine.iactivity("upgrade.building.amphitheatre",[],"ks-upgrade"),(b=this._host.game.ui)==null||b.render(),this.build("amphitheatre",1,1),s.requestGameUiRefresh=!0)}}}autoMisc(s){if(this.settings.turnOnSteamworks.enabled){const e=this._host.game.bld.getBuildingExt("steamworks");if(e.meta.val&&e.meta.on===0){const t=p(this.getBuildButton("steamworks"));if(m(t.model))return;t.controller.onAll(t.model)}}if(this.settings.turnOnMagnetos.enabled){const e=this._host.game.bld.getBuildingExt("magneto");if(e.meta.val&&e.meta.on<e.meta.val){const t=p(this.getBuildButton("magneto"));if(m(t.model))return;t.controller.onAll(t.model)}}if(this.settings.turnOnReactors.enabled){const e=this._host.game.bld.getBuildingExt("reactor");if(e.meta.val&&e.meta.on<e.meta.val){const t=p(this.getBuildButton("reactor"));if(m(t.model))return;t.controller.onAll(t.model)}}this.settings.upgradeBuildings.enabled&&this.autoUpgrade(s),this.settings.gatherCatnip.enabled&&this.autoGather()}autoGather(){const s=new classes.game.ui.GatherCatnipButtonController(this._host.game);for(let e=0;e<Math.floor(this._host.engine.settings.interval/20);++e)s.buyItem(void 0,null)}build(s,e,t){let i=t;const n=i;let a;const r=game.getUnlockByName(s,"buildings"),o=new classes.BuildingMeta(r).getMeta();if("stages"in o){const l=new classes.ui.btn.StagingBldBtnController(this._host.game),h=l.fetchModel({building:s,controller:l,description:p(o.description),name:p(o.label),twoRow:!1});i=this._bulkManager.construct(h,l,i),a=o.label??""}else{const l=new classes.ui.btn.BuildingBtnModernController(this._host.game),h=l.fetchModel({building:s,controller:l,description:p(o.description),name:p(o.label),twoRow:!1});i=this._bulkManager.construct(h,l,i),a=o.label??""}i!==n&&(console.warn(...v(`${a} Amount ordered: ${n} Amount Constructed: ${i}`)),i===0)||(this._host.engine.storeForSummary(a,i,"build"),i===1?this._host.engine.iactivity("act.build",[a],"ks-build"):this._host.engine.iactivity("act.builds",[a,this._host.renderAbsolute(i)],"ks-build"))}_getBuildLabel(s,e){return s.stages&&!m(e)?s.stages[e].label:p(s.label)}getBuild(s){return this._host.game.bld.getBuildingExt(s)}getBuildButton(s,e=0){const t=game.bld.get(s),i=new classes.BuildingMeta(t).getMeta(),n=m(i.stages)?t:i.stages[e],a="stages"in n?new classes.ui.btn.StagingBldBtnController(this._host.game):new classes.ui.btn.BuildingBtnModernController(this._host.game),r=a.fetchModel({building:s,description:n.description,key:s,name:n.label});return{controller:a,model:r}}}class rn{constructor(s){u(this,"_host");u(this,"_lastday");u(this,"_lastyear");u(this,"_sections",new Map);this._host=s,this.resetActivity()}resetActivity(){this._sections=new Map,this._lastday=this._host.game.calendar.day,this._lastyear=this._host.game.calendar.year}storeActivity(s,e=1,t="other"){this._sections.has(t)||this._sections.set(t,new Map);const i=p(this._sections.get(t));i.has(s)||i.set(s,0),i.set(s,p(i.get(s))+e)}renderSummary(){const s=new Array;if(this._sections.has("other")&&p(this._sections.get("other")).forEach((t,i)=>s.push(this._host.engine.i18n(`summary.${i}`,[this._host.game.getDisplayValueExt(t)]))),this._sections.has("research")&&p(this._sections.get("research")).forEach((t,i)=>{s.push(this._host.engine.i18n("summary.tech",[X(i)]))}),this._sections.has("upgrade")&&p(this._sections.get("upgrade")).forEach((t,i)=>{s.push(this._host.engine.i18n("summary.upgrade",[X(i)]))}),this._sections.has("build")&&p(this._sections.get("build")).forEach((t,i)=>{s.push(this._host.engine.i18n("summary.building",[this._host.game.getDisplayValueExt(t),X(i)]))}),this._sections.has("refine")&&p(this._sections.get("refine")).forEach((t,i)=>{s.push(this._host.engine.i18n("summary.refine",[this._host.game.getDisplayValueExt(t),X(i)]))}),this._sections.has("faith")&&p(this._sections.get("faith")).forEach((t,i)=>{s.push(this._host.engine.i18n("summary.sun",[this._host.game.getDisplayValueExt(t),X(i)]))}),this._sections.has("craft")&&p(this._sections.get("craft")).forEach((t,i)=>{s.push(this._host.engine.i18n("summary.craft",[this._host.game.getDisplayValueExt(t),X(i)]))}),this._sections.has("trade")&&p(this._sections.get("trade")).forEach((t,i)=>{s.push(this._host.engine.i18n("summary.trade",[this._host.game.getDisplayValueExt(t),X(i)]))}),this._lastday&&this._lastyear){let e=this._host.game.calendar.year-this._lastyear,t=this._host.game.calendar.day-this._lastday;t<0&&(e-=1,t+=400);let i="";e>0&&(i+=`${e} `,i+=e===1?this._host.engine.i18n("summary.year"):this._host.engine.i18n("summary.years")),t>=0&&(e>0&&(i+=this._host.engine.i18n("summary.separator")),i+=`${Ws(t)} `,i+=t===1?this._host.engine.i18n("summary.day"):this._host.engine.i18n("summary.days")),s.push(this._host.engine.i18n("summary.head",[i]))}return s}}const on={"act.accelerate":"Accelerate time!","act.adore":"Adore the galaxy! Accumulated {0} worship to {1} epiphany","act.blackcoin.buy":"Kittens sold your Relics and bought {0} Blackcoins","act.blackcoin.sell":"Kittens sold your Blackcoins and bought {0} Relics","act.build":"Kittens have built a new {0}","act.builds":"Kittens have built a new {0} {1} times","act.craft":"Kittens have crafted {0} {1}","act.distribute":"Distributed a kitten to {0}","act.elect":"Kittens have elected a new leader.","act.feed":"Kittens fed the Elders. The elders are pleased","act.fix.cry":"Kittens fixed {0} Cryochambers","act.hunt":"Sent kittens on {0} hunts","act.observe":"Kitten Scientists have observed a star","act.praise":"Praised the sun! Accumulated {0} faith to {1} worship","act.promote":"Kittens\' leader has been promoted to rank {0}","act.refineTCs":"Refined {0} time crystals","act.refineTears":"Refined {0} tears into BLS","act.sacrificeAlicorns":"Sacrificed {0} alicorns","act.sacrificeUnicorns":"Sacrificed {0} unicorns","act.sun.discover":"Kittens have discovered {0}","act.sun.discovers":"Kittens have discovered {0} {1} times","act.time.activeHeatTransferEnd":"End active Heat Transfer","act.time.activeHeatTransferStart":"Start active Heat Transfer","act.time.getTemporalFlux":"Burn crystals to obtain time flux to maintain time acceleration","act.time.skip":"Kittens combust a time crystal, {0} years skipped!","act.trade":"Kittens have traded {0} times with {1}","act.transcend":"Spent {0} epiphany, Transcended to T-level: {1}","blackcoin.buy":"Buy Limit: {0}","blackcoin.buy.prompt":"Enter at which price you want to stop buying blackcoins.","blackcoin.buy.promptExplainer":"Blackcoin price always rises from 800 to 1100 (roughly), then it crashes. You usually want to buy until shortly before you sell.","blackcoin.buy.promptTitle":"Buy Limit for Blackcoins (Current: {0})","blackcoin.buy.title":"Buy Blackcoins until price reaches {0}","blackcoin.buy.trigger":"buying Blackcoins (in relics)","blackcoin.sell":"Sell Order: {0}","blackcoin.sell.prompt":"Enter at which price you want to sell all your blackcoins.","blackcoin.sell.promptExplainer":"Blackcoin price always rises from 800 to 1100 (roughly), then it crashes. You usually want to sell close to the highest possible price.","blackcoin.sell.promptTitle":"Sell Order for Blackcoins (Current: {0})","blackcoin.sell.title":"Sell Blackcoins when price reaches {0}","build.embassies":"Built {0} embassies for {1}","build.embassy":"Built {0} embassy for {1}",copy:"Copy","craft.limited":"Crafting {0}: limited to be proportional to cost ratio","craft.unlimited":"Crafting {0}: unlimited",delete:"Delete","dispose.necrocorn":"Kittens disposed of inefficient necrocorns","festival.extend":"Kittens extend the festival","festival.hold":"Kittens begin holding a festival","filter.accelerate":"Tempus Fugit","filter.adore":"Adoring","filter.allKG":"All KG log entries.","filter.build":"Building","filter.craft":"Crafting","filter.disable":"Disabled {0} log messages","filter.distribute":"Distribute","filter.enable":"Enabled {0} log messages","filter.explainer":"Disabled items are hidden from the log.","filter.faith":"Order of the Sun","filter.festival":"Festivals","filter.hunt":"Hunting","filter.misc":"Miscellaneous","filter.praise":"Praising","filter.promote":"Promote leader","filter.research":"Researching","filter.star":"Astronomical Events","filter.timeSkip":"Time Skip","filter.trade":"Trading","filter.transcend":"Transcend","filter.upgrade":"Upgrading","option.accelerate":"Tempus Fugit","option.autofeed":"Feed Leviathans","option.catnip":"Gather Catnip","option.crypto":"Trade Blackcoin","option.elect":"Elect leader","option.elect.job":"Job","option.elect.job.any":"Any","option.elect.trait":"Trait","option.embassies":"Build Embassies","option.faith.adore":"Adore the Galaxy","option.faith.autoPraise":"Praise the Sun","option.faith.best.unicorn":"Automate Build Order","option.faith.refineTears":"Refine Tears","option.faith.refineTimeCrystals":"Refine TCs","option.faith.sacrificeAlicorns":"Sacrifice Alicorns","option.faith.sacrificeUnicorns":"Sacrifice Unicorns","option.faith.transcend":"Transcend","option.festival":"Hold festivals","option.fix.cry":"Fix Cryochamber","option.hunt":"Hunt","option.magnetos":"Turn on Magnetos","option.observe":"Observe Astro Events","option.praise":"Praise the Sun","option.promote":"Promote leader","option.promotekittens":"Promote kittens","option.reactors":"Turn on Reactors","option.shipOverride":"Force Ships to 243","option.steamworks":"Turn on Steamworks","option.time.activeHeatTransfer":"Active Heat Transfer","option.time.reset":"Reset Timeline (Danger!)","option.time.skip":"Time Skip","option.time.skip.ignoreOverheat":"Ignore overheat",reset:"Reset","reset.after":"Nice to meet you, the cute Kitten Scientists will serve you","reset.cancel.activity":"Meoston, We Have a Problem","reset.cancel.message":"Timeline Reset canceled","reset.check":"Trigger for {0}: {1}, you have {2}","reset.checked":"All conditions are met, the timeline will restart in the next few seconds!","reset.countdown.0":"0 - Temporal rifts opened!","reset.countdown.1":"1 - Time engine start","reset.countdown.2":"2 - Boosting the chronoforge","reset.countdown.3":"3 - Opening temporal rifts","reset.countdown.4":"4 - Turning off satellite","reset.countdown.5":"5 - Melting blackcoins","reset.countdown.6":"6 - Starting time engines","reset.countdown.7":"7 - Disassembling railguns","reset.countdown.8":"8 - Releasing lizards","reset.countdown.9":"9 - Sacrificing unicorns","reset.countdown.10":"10 - Harvesting catnip","reset.last.message":"See you next poincaré recurrence","reset.tip":\'You can cancel this reset by disabling "Enable Kitten Scientists" at the top of the settings.\',"resources.consume":"Consume: {0}","resources.consume.prompt":"Enter how much of the resource you want automations to consume as a percentage between 0.0 and 100.0.","resources.consume.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","resources.consume.promptTitle":"Consumption Share for {0} (Current: {1})","resources.consume.set":"Consume rate for {0}","resources.consume.title":"Consuming {0} of {1}","resources.consume.titleZero":"Not consuming {0}","resources.stock.prompt":"Enter how much of the resource you always want to keep in stock.","resources.stock.promptExplainer":"All notations that the game supports are accepted. If you submit an empty value, or a negative value, the limit will be set to infinity. If you set the limit to 0, this option will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","resources.stock.promptTitle":"Stock value for {0} (Current: {1})","resources.stock.title":"Keeping {0} {1} in stock","resources.stock.titleInfinite":"Keeping all {0} in stock","resources.stock.titleZero":"Not keeping any {0} in stock","state.compress":"Compress copied Kittens Game saves","state.confirmDestruction":"Are you sure?","state.copied.game":"Save \'{0}\' copied to clipboard.","state.copied.gameCurrent":"Current save copied to clipboard.","state.copied.state":"State \'{0}\' copied to clipboard.","state.copied.stateCurrent":"Current state copied to clipboard.","state.copy.game":"Copy this save to the clipboard.","state.copy.gameCurrent":"Copy the entire Kittens Game save (includes KS settings) to the clipboard.","state.copy.state":"Copy these settings to the clipboard.","state.copy.stateCurrent":"Copy the current Kitten Scientists settings to the clipboard.","state.delete.game":"Delete this save.","state.delete.state":"Delete these settings.","state.deleted.game":"Save \'{0}\' deleted.","state.deleted.state":"State \'{0}\' deleted.","state.edit.game":"Change the name of this save.","state.edit.state":"Change the name of these settings.","state.exportAll":"Backup","state.exportAllTitle":"Stores all local states in a single file and downloads it.","state.import":"Import settings/saves","state.imported.game":"Save imported.","state.imported.state":"State imported.","state.importedState":"Imported state {0}","state.importTitle":`Paste a save or settings from your clipboard.\nContents will be automatically detected and handled accordingly.`,"state.loaded.game":"Save \'{0}\' loaded.","state.loaded.state":"State \'{0}\' loaded.","state.loadPrompt":"Paste your (un/compressed) save or settings here:","state.local":"Local storage management","state.localGames":"Kittens Game Saves","state.localStates":"Kitten Scientists Settings","state.new":"New","state.noConfirm":"Don\'t ask for confirmation","state.store":"Store","state.stored.game":"Save stored.","state.stored.state":"State stored.","state.storeFactory":"Create a new state from factory defaults.","state.storeGame":"Create a new save from the current game.","state.storeGame.prompt":"Provide a label for this save:","state.storeState":"Create a new state from current settings.","state.storeState.prompt":"Provide a label for this state:","state.title":"State Management","state.unlabeledGame":"unlabeled save","state.unlabeledState":"unlabeled state","state.update.game":"Save the current game into this slot.","state.update.state":"Save the current settings into this slot.","state.updated.game":"Save \'{0}\' updated.","state.updated.state":"State \'{0}\' updated.","status.auto.disable":"Disabled Auto {0}","status.auto.enable":"Enabled Auto {0}","status.ks.disable":"Disabling the Kitten Scientists!","status.ks.enable":"Enabling the Kitten Scientists!","status.ks.init":"Kitten Scientists initialized.","status.ks.upgrade":"Kitten Scientists {0} (ours is {1}) is available at {2}.","status.reset.check.disable":"Disabled check {0} before Reset Timeline","status.reset.check.enable":"Enabled check {0} before Reset Timeline","status.resource.disable":"Disabled {0} resource management","status.resource.enable":"Enabled {0} resource management","status.sub.disable":"Disabled {0}","status.sub.enable":"Enabled {0}","summary.accelerate":"Accelerated time {0} times","summary.adore":"Accumulated {0} epiphany by adoring the galaxy","summary.building":"Built {0} {1}","summary.craft":"Crafted {0} {1}","summary.day":"day","summary.days":"days","summary.distribute":"Helped {0} kittens find a job","summary.embassy":"Built {0} embassies","summary.feed":"Fed the elders {0} necrocorns","summary.festival":"Held {0} festivals","summary.fix.cry":"Fixed {0} cryochambers","summary.head":"Summary of the last {0}","summary.hunt":"Sent adorable kitten hunters on {0} hunts","summary.praise":"Accumulated {0} worship by praising the sun","summary.promote":"Promoted our leader {0} times","summary.refine":"Refined {0} {1}","summary.separator":" and ","summary.show":"Show activity","summary.stars":"Observed {0} stars","summary.sun":"Discovered {0} {1}","summary.tech":"Researched {0}","summary.time.activeHeatTransferStart":"Active Heat Transfer {0} times","summary.time.getTemporalFlux":"Burn crystal to gain time flux {0} times","summary.time.reset.content":"Gained {0} Karma.<br>Gained {1} Paragon","summary.time.reset.title":"Summary of the last {0} timelines","summary.time.skip":"Skipped {0} years","summary.trade":"Traded {0} times with {1}","summary.transcend":"Transcended {0} times","summary.upgrade":"Upgraded {0}","summary.year":"year","summary.years":"years","time.heatTransfer.cycle.disable":"Disabled active heat transfer in cycle {0}","time.heatTransfer.cycle.enable":"Enabled active heat transfer in cycle {0}","time.skip.cycle.disable":"Disabled time skip in cycle {0} and disallow skip over this cycle","time.skip.cycle.enable":"Enabled time skip in cycle {0} and allow skip over this cycle","time.skip.season.disable":"Disabled time skip in the {0}","time.skip.season.enable":"Enabled time skip in the {0}","trade.limited":"Trading with {0}: limited to only occur when profitable based off relative production time","trade.season.disable":"Disabled trading with {0} in the {1}","trade.season.enable":"Enabled trading with {0} in the {1}","trade.seasons":"seasons","trade.unlimited":"Trading with {0}: unlimited","ui.additional":"Additional options","ui.build":"Bonfire","ui.close":"close","ui.craft":"Workshop","ui.craft.resources":"Resources","ui.cycles":"cycles","ui.disable.all":"Disable all options in this list.","ui.distribute":"Village","ui.enable.all":"Enable all options in this list.","ui.engine":"Enable Kitten Scientists","ui.faith":"Religion","ui.filter":"Log Filters","ui.infinity":"∞","ui.internals":"Internals","ui.internals.interval":"Interval: {0}","ui.internals.interval.prompt":"Enter the new amount of milliseconds as an absolute value between 0 and Infinity.","ui.internals.interval.promptExplainer":"All notations that the game supports are accepted. If you set the limit to 0, Kitten Scientists will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.internals.interval.promptTitle":"Kitten Scientists Execution Interval (Current: {0})","ui.itemsHide":"Collapse section","ui.itemsShow":"Expand section","ui.ksColumn":"Display KS in fourth column in UI","ui.language":"Language","ui.limit":"Limited","ui.limited.off":"Unlimited","ui.limited.on":"Eco Mode","ui.max":"Max: {0}","ui.max.build.prompt":"Limit for {0} (Current: {1})","ui.max.build.promptExplainer":"All notations that the game supports are accepted. If you submit an empty value, or a negative value, the limit will be set to infinity. If you set the limit to 0, this option will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.max.build.title":"Build {0} {1}","ui.max.build.titleInfinite":"Never stop building {0}","ui.max.build.titleZero":"Don\'t build {0}","ui.max.craft.prompt":"Enter the new limit of how many {0} to craft as an absolute value between 0 and Infinity.","ui.max.craft.promptExplainer":"All notations that the game supports are accepted. If you submit an empty value, or a negative value, the limit will be set to infinity. If you set the limit to 0, this option will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.max.craft.promptTitle":"Limit for Crafting {0} (Current: {1})","ui.max.craft.title":"Craft {0} {1}","ui.max.craft.titleInfinite":"Never stop crafting {0}","ui.max.craft.titleZero":"Don\'t craft {0}","ui.max.distribute.prompt":"Enter the new amount of kittens to assign as {0} as an absolute value between 0 and Infinity.","ui.max.distribute.promptExplainer":"All notations that the game supports are accepted. If you submit an empty value, or a negative value, the limit will be set to infinity. If you set the limit to 0, this option will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.max.distribute.promptTitle":"Assign Max. Kittens as {0} (Current: {1})","ui.max.distribute.title":"Assign {0} kittens as {1}","ui.max.distribute.titleInfinite":"Assign as many kittens as possible as {0}","ui.max.distribute.titleZero":"Don\'t assign any kittens as {0}","ui.max.embassy.title":"Build {0} embassy for {1}","ui.max.embassy.titleInfinite":"Never stop building embassies for {0}","ui.max.embassy.titleZero":"Don\'t build embassies for {0}","ui.max.prompt.absolute":"Enter the new limit as an absolute value between 0 and Infinity.","ui.max.prompt.float":"Enter the new limit as an absolute value between 0.0 and Infinity.","ui.max.set":"Maximum for {0}","ui.max.timeSkip.prompt":"Enter the new amount of years as an absolute value between 0 and Infinity.","ui.max.timeSkip.promptExplainer":"All notations that the game supports are accepted. If you submit an empty value, or a negative value, the limit will be set to infinity. If you set the limit to 0, this option will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.max.timeSkip.promptTitle":"Max. Years to skip (Current: {0})","ui.max.timeSkip.title":"Skip {0} years at once","ui.max.timeSkip.titleInfinite":"Skip as many years as possible","ui.max.timeSkip.titleZero":"Don\'t skip time","ui.maximum":"Maximum","ui.min":"Min: {0}","ui.options":"Options","ui.reset":"Reset list options to default configuration.","ui.resources":"Resource Control","ui.space":"Space","ui.time":"Time","ui.timeCtrl":"Time Control","ui.trade":"Trade","ui.trigger":"Trigger: {0}","ui.trigger.accelerateTime.prompt":"Enter the new temporal flux storage level at which to enable Tempus Fugit as a percentage between 0.0 and 100.0.","ui.trigger.accelerateTime.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.accelerateTime.promptTitle":"Trigger to Accelerate Time (Current: {0})","ui.trigger.activeHeatTransfer.prompt":"Enter the new temporal heat storage level at which to enable heat transfer as a percentage between 0.0 and 100.0.","ui.trigger.activeHeatTransfer.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.activeHeatTransfer.promptTitle":"Trigger for Heat Transfer (Current: {0})","ui.trigger.build.blocked":`∞\n🛈 The {0} section has no trigger set. This build will not be triggered!`,"ui.trigger.build.inherited":"inherited from section","ui.trigger.build.prompt":"Trigger for {0} (Current: {1})","ui.trigger.build.promptExplainer":"If you submit an empty value, or a negative value, the section trigger is used instead. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.trigger.crypto.prompt":"Enter the new relic storage level at which to trade blackcoin as an absolute value between 0.0 and Infinity.","ui.trigger.crypto.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.crypto.promptTitle":"Trigger to Trade Blackcoin (Current: {0})","ui.trigger.embassies.prompt":"Enter the new culture storage level at which to build embassies as a percentage between 0.0 and 100.0.","ui.trigger.embassies.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.embassies.promptTitle":"Trigger to Build Embassies (Current: {0})","ui.trigger.hunt.prompt":"Trigger for Hunting (Current: {0})","ui.trigger.hunt.promptExplainer":"If you submit a negative value, hunting will be disabled. If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.inactive":"inactive","ui.trigger.promoteKittens.prompt":"Enter the new gold storage level at which to promote kittens as a percentage between 0.0 and 100.0.","ui.trigger.promoteKittens.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.promoteKittens.promptTitle":"Trigger to Promote Kittens (Current: {0})","ui.trigger.prompt.absolute":"Enter the new trigger value as an absolute value between 0 and Infinity.","ui.trigger.prompt.float":"Enter the new trigger value as an absolute value between 0.0 and Infinity.","ui.trigger.prompt.percentage":"Enter the new trigger value as a percentage between 0.0 and 100.0.","ui.trigger.reset.promptExplainer":"If you submit a negative value, the item will be disabled. If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.section":"Section default trigger: {0}","ui.trigger.section.blocked":`∞\n🛈 The {0} section has no trigger set. This automation will not be triggered!`,"ui.trigger.section.inactive":"∞ (nothing is triggered automatically)","ui.trigger.section.inherited":"inherited from section","ui.trigger.section.prompt":"Trigger for section {0} (Current: {1})","ui.trigger.section.promptExplainer":`If you submit an empty value, or a negative value, the section trigger will be set to infinity (∞). Individual automations in this section need to have their own trigger set to be activated.\nIf you submit an invalid value, it will be treated as if you hit Cancel.`,"ui.trigger.setinteger":"Enter a new trigger value for {0}. Should be in the range from 0 up to any number. -1 means infinity.","ui.trigger.setinteger.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.setpercentage":"Enter a new trigger value for {0}. Should be in the range from 0 to 100.","ui.trigger.setpercentage.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.timeSkip.prompt":"Enter the new amount of Time Crystals at which to skip time as an absolute value between 1 and Infinity.","ui.trigger.timeSkip.promptExplainer":"If you submit a negative value, time skipping will be disabled. If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.timeSkip.promptTitle":"Trigger for Time Skip (Current: {0})","ui.upgrade":"Science","ui.upgrade.buildings":"Upgrade buildings","ui.upgrade.missions":"Start missions","ui.upgrade.policies":"Research policies","ui.upgrade.races":"Explore new races","ui.upgrade.techs":"Research technologies","ui.upgrade.upgrades":"Research upgrades","ui.upgrades":"Upgrades",update:"Update","upgrade.building.amphitheatre":"Upgraded amphitheatres to broadcast towers!","upgrade.building.aqueduct":"Upgraded aqueducts to hydro plants!","upgrade.building.library":"Upgraded libraries to data centers!","upgrade.building.pasture":"Upgraded pastures to solar farms!","upgrade.building.warehouse":"Upgraded warehouses to spaceports!","upgrade.policy":"Kittens have passed {0}","upgrade.race":"Kittens met the {0}","upgrade.space":"Kittens conducted a {0}","upgrade.space.mission":"Kittens conducted a mission to {0}","upgrade.tech":"Kittens have bought the tech {0}","upgrade.upgrade":"Kittens have bought the upgrade {0}"},ln={"act.accelerate":"Zeit beschleunigen!","act.adore":"Verehre die Galaxie! Kumulierte {0} Anbetung zu {1} Offenbarung","act.blackcoin.buy":"Kätzchen haben deine Relikte verkauft und {0} Blackcoins gekauft","act.blackcoin.sell":"Kätzchen haben deine Blackcoins verkauft und {0} Relikte gekauft","act.build":"Kätzchen haben ein neues {0} gebaut","act.builds":"Kätzchen haben ein neues {0} {1} Mal gebaut","act.craft":"Kätzchen haben {0} {1} hergestellt","act.distribute":"Ein Kätzchen an {0} verteilt","act.elect":"Kätzchen haben einen neuen Anführer gewählt.","act.feed":"Kätzchen haben die Ältesten gefüttert. Die Ältesten sind zufrieden","act.fix.cry":"Kätzchen haben {0} Kryokammern repariert","act.hunt":"Kätzchen auf {0} Jagden entsendet","act.observe":"Kitten Scientists haben einen Stern beobachtet","act.praise":"Die Sonne gelobt! {0} Glaube zu {1} Anbetung kumuliert","act.promote":"Der Anführer der Kätzchen wurde zum Rang {0} befördert","act.refineTCs":"{0} Zeit-Kristalle verfeinert","act.refineTears":"{0} Tränen zu STF verfeinert","act.sacrificeAlicorns":"{0} Alihörner geopfert","act.sacrificeUnicorns":"{0} Einhörner geopfert","act.sun.discover":"Kätzchen haben {0} entdeckt","act.sun.discovers":"Kätzchen haben {0} {1} mal entdeckt","act.time.activeHeatTransferEnd":"Aktiver Wärmetransfer beendet","act.time.activeHeatTransferStart":"Starte aktiven Wärmetransfer","act.time.getTemporalFlux":"Verbrennt Kristalle, um Flux zur Erhaltung der Zeitbeschleunigung zu bekommen","act.time.skip":"Kätzchen verbrennen einen Zeit-Kristall, {0} Jahre übersprungen!","act.trade":"Kätzchen haben {0} mal mit {1} gehandelt","act.transcend":"{0} Offenbarung ausgegeben, auf T-Level {1} aufgestiegen","blackcoin.buy":"Kauf-Limit: {0}","blackcoin.buy.prompt":"Gib den Preis ein, ab welchem du keine Blackcoins mehr kaufen möchtest.","blackcoin.buy.promptExplainer":"Der Blackcoin-Preis steigt immer von 800 auf 1100 (ungefähr), dann stürzt er ab. Du möchtest normalerweise bis kurz vor dem Verkauf einkaufen.","blackcoin.buy.promptTitle":"Kauf-Limit für Blackcoins (Aktuell: {0})","blackcoin.buy.title":"Blackcoins kaufen bis der Preis {0} erreicht","blackcoin.buy.trigger":"kaufe Blackcoins (in Relikten)","blackcoin.sell":"Verkauf-Order: {0}","blackcoin.sell.prompt":"Gib den Preis ein, zu welchem du deine Blackcoins verkaufen möchtest.","blackcoin.sell.promptExplainer":"Der Blackcoin-Preis steigt immer von 800 auf 1100 (ungefähr), dann stürzt er ab. Du möchtest normalerweise nahe dem höchstmöglichen Preis verkaufen.","blackcoin.sell.promptTitle":"Verkauf-Order für Blackcoins (Aktuell: {0})","blackcoin.sell.title":"Blackcoins verkaufen, wenn der Preis {0} erreicht","build.embassies":"{0} Botschaften für {1} gebaut","build.embassy":"{0} Botschaft für {1} gebaut",copy:"Kopieren","craft.limited":"Herstellen von {0}: im Verhältnis zum Kostenverhältnis begrenzt","craft.unlimited":"Herstellung von {0}: unbegrenzt",delete:"Löschen","dispose.necrocorn":"Kätzchen haben ineffiziente Necrocorns entsorgt","festival.extend":"Kätzchen haben das Festival verlängert","festival.hold":"Kätzchen fangen an, ein Festival abzuhalten","filter.accelerate":"Tempus Fugit","filter.adore":"Bewundern","filter.allKG":"Alle KG Protokollnachrichten.","filter.build":"Bauen","filter.craft":"Herstellen","filter.disable":"{0} Protokollnachrichten deaktiviert","filter.distribute":"Verteilen","filter.enable":"{0} Protokollnachrichten aktiviert","filter.explainer":"Deaktivierte Nachrichtentypen erscheinen nicht im Protokoll.","filter.faith":"Orden der Sonne","filter.festival":"Festivals","filter.hunt":"Jagen","filter.misc":"Diverses","filter.praise":"Bewundern","filter.promote":"Anführer befördern","filter.research":"Erforschen","filter.star":"Astronomische Ereignisse","filter.timeSkip":"Zeitsprung","filter.trade":"Handeln","filter.transcend":"Transzendenz","filter.upgrade":"Verbesserungen","option.accelerate":"Tempus Fugit","option.autofeed":"Leviathane füttern","option.catnip":"Katzenminze sammeln","option.crypto":"Blackcoin handeln","option.elect":"Anführer benennen","option.elect.job":"Beruf","option.elect.job.any":"Beliebig","option.elect.trait":"Eigenschaft","option.embassies":"Botschaften bauen","option.faith.adore":"Bewundere die Galaxie","option.faith.autoPraise":"Lobe die Sonne","option.faith.best.unicorn":"Reihenfolge automatisch optimieren","option.faith.refineTears":"Tränen verfeinern","option.faith.refineTimeCrystals":"ZKs verfeinern","option.faith.sacrificeAlicorns":"Alihörner opfern","option.faith.sacrificeUnicorns":"Einhörner opfern","option.faith.transcend":"Transzendenz","option.festival":"Festivals veranstalten","option.fix.cry":"Kryokammern reparieren","option.hunt":"Jagen","option.magnetos":"Magnetos einschalten","option.observe":"Astro-Ereignisse beobachten","option.praise":"Lobe die Sonne","option.promote":"Anführer befördern","option.promotekittens":"Kätzchen befördern","option.reactors":"Reaktoren einschalten","option.shipOverride":"Erzwinge 243 Schiffe","option.steamworks":"Dampfmaschinen einschalten","option.time.activeHeatTransfer":"Aktiver Wärmetransfer","option.time.reset":"Zeitleiste zurücksetzen (Gefahr!)","option.time.skip":"Zeitsprung","option.time.skip.ignoreOverheat":"Überhitzen ignorieren",reset:"Zurücksetzen","reset.after":"Schön, dich kennenzulernen, die niedlichen Kitten Scientists werden dir dienen","reset.cancel.activity":"Miauston, wir haben ein Problem","reset.cancel.message":"Zeitleiste zurücksetzen abgebrochen","reset.check":"Auslöser für {0}: {1}, du hast {2}","reset.checked":"Alle Bedingungen sind erfüllt, die Zeitlinie wird in den nächsten Sekunden neu gestartet!","reset.countdown.0":"0 - Temporale Risse geöffnet!","reset.countdown.1":"1 - Start der Zeitmaschine","reset.countdown.2":"2 - Chronoschmiede wird beschleunigt","reset.countdown.3":"3 - Zeit-Risse werden geöffnet","reset.countdown.4":"4 - Satellit wird ausgeschaltet","reset.countdown.5":"5 - Schmelze Blackcoins","reset.countdown.6":"6 - Zeit-Motoren werden gestartet","reset.countdown.7":"7 - Strahlenkanonen werden demontiert","reset.countdown.8":"8 - Freisetzung von Echsen","reset.countdown.9":"9 - Opfere Einhörner","reset.countdown.10":"10 - Katzenminzeernte","reset.last.message":"Wir sehen uns bei der nächsten poincaréschen Wiederkehr","reset.tip":\'Du kannst diesen Neustart abbrechen, indem du "Kitten Scientists aktivieren" oben in den Einstellungen deaktivierst.\',"resources.consume":"Verbrauch: {0}","resources.consume.prompt":"Gib ein wie viel von der Ressource von Automatisierungen verbraucht werden darf. Der Wert sollte zwischen 0,0 und 100,0 liegen.","resources.consume.promptExplainer":"Wenn du einen leeren oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hättest.","resources.consume.promptTitle":"Verbrauchsanteil für {0} (Aktuell: {1})","resources.consume.set":"Verbrauchs-Rate für {0}","resources.consume.title":"Verbraucht {0} von {1}","resources.consume.titleZero":"{0} werden nicht verbraucht","resources.stock.prompt":"Gib ein wie viel von der Ressource jederzeit im Lager bleiben soll.","resources.stock.promptExplainer":"Alle Notationen, die das Spiel unterstützt werden, akzeptiert. Wenn du gar nichts, oder einen negativen Wert eingibst, wird die Grenze auf unendlich gesetzt. Wenn du die Grenze auf 0 setzt, wird Zeit Überspringen deaktiviert. Wenn du einen ungültigen Wert eingibst, wird das genauso behandelt als ob du Abbrechen gedrückt hättest.","resources.stock.promptTitle":"Mindest-Lagerbestand von {0} (Aktuell: {1})","resources.stock.title":"{0} {1} werden auf Lager gehalten","resources.stock.titleInfinite":"Alle {0} werden auf Lager gehalten","resources.stock.titleZero":"{0} werden nicht auf Lager gehalten","state.compress":"Kopierte Kittens Game Spielstände komprimieren","state.confirmDestruction":"Bist du sicher?","state.copied.game":"Spielstand \'{0}\' in die Zwischenablage kopiert.","state.copied.gameCurrent":"Aktueller Spielstand in Zwischenablage kopiert.","state.copied.state":"Zustand \'{0}\' in Zwischenablage kopiert.","state.copied.stateCurrent":"Aktueller Zustand wurde in die Zwischenablage kopiert.","state.copy.game":"Diesen Spielstand in die Zwischenablage kopieren.","state.copy.gameCurrent":"Kopiere den gesamten Kittens Game Spielstand (inklusive KS-Einstellungen) in die Zwischenablage.","state.copy.state":"Diese Einstellungen in die Zwischenablage kopieren.","state.copy.stateCurrent":"Kopiere die aktuellen Kitten Scientists Einstellungen in die Zwischenablage.","state.delete.game":"Diesen Spielstand löschen.","state.delete.state":"Diese Einstellungen löschen.","state.deleted.game":"Spielstand \'{0}\' gelöscht.","state.deleted.state":"Zustand \'{0}\' gelöscht.","state.edit.game":"Ändere den Namen von diesem Spielstand.","state.edit.state":"Ändere den Namen von diesen Einstellungen.","state.exportAll":"Export","state.exportAllTitle":"Speichert alle lokalen Zustände in einer Datei und lädt sie herunter.","state.import":"Einstellungen/Spielstände importieren","state.imported.game":"Spielstand importiert.","state.imported.state":"Zustand importiert.","state.importedState":"Importierter Stand {0}","state.importTitle":`Füge ein Spielstand oder Einstellungen aus deiner Zwischenablage ein.\nInhalte werden automatisch erkannt und entsprechend behandelt.`,"state.loaded.game":"Spielstand \'{0}\' geladen.","state.loaded.state":"Zustand \'{0}\' geladen.","state.loadPrompt":"Füge deinen (un/komprimierten) Spielstand oder deine Einstellungen hier ein:","state.local":"Lokale Speicherverwaltung","state.localGames":"Kittens Game Spielstände","state.localStates":"Kitten Scientists Einstellungen","state.new":"Neu","state.noConfirm":"Nicht nach Bestätigung fragen","state.store":"Speichern","state.stored.game":"Spielstand gespeichert.","state.stored.state":"Zustand gespeichert.","state.storeFactory":"Neuen Zustand aus Werkseinstellungen erstellen.","state.storeGame":"Neuen Spielstand vom aktuellen Spiel erstellen.","state.storeGame.prompt":"Gib eine Beschreibung für diesen Spielstand ein:","state.storeState":"Erstelle einen neuen Zustand aus den aktuellen Einstellungen.","state.storeState.prompt":"Gib eine Beschreibung für diesen Zustand ein:","state.title":"Zustandsverwaltung","state.unlabeledGame":"unbeschriftetes Spiel","state.unlabeledState":"unbeschrifteter Zustand","state.update.game":"Speichere das aktuelle Spiel in diesem Slot.","state.update.state":"Speichere die aktuellen Einstellungen in diesem Slot.","state.updated.game":"Spielstand \'{0}\' aktualisiert.","state.updated.state":"Zustand \'{0}\' aktualisiert.","status.auto.disable":"Auto {0} deaktiviert","status.auto.enable":"Auto {0} aktiviert","status.ks.disable":"Deaktiviere die Kitten Scientists!","status.ks.enable":"Aktiviere die Kitten Scientists!","status.ks.init":"Kitten Scientists initialisiert.","status.ks.upgrade":"Kitten Scientists {0} (unsere ist {1}) ist unter {2} verfügbar.","status.reset.check.disable":"Überprüfung von {0} vor dem Zurücksetzen der Zeitlinie deaktiviert","status.reset.check.enable":"Überprüfung von {0} vor dem Zurücksetzen der Zeitlinie aktiviert","status.resource.disable":"{0} Ressourcenverwaltung deaktiviert","status.resource.enable":"{0} Ressourcenverwaltung aktiviert","status.sub.disable":"{0} deaktiviert","status.sub.enable":"{0} aktiviert","summary.accelerate":"Zeit {0} Mal beschleunigt","summary.adore":"{0} Offenbarung durch das Bewundern der Galaxie akkumuliert","summary.building":"{0} {1} gebaut","summary.craft":"{0} {1} hergestellt","summary.day":"Tag","summary.days":"Tage","summary.distribute":"{0} Kätzchen geholfen einen Beruf zu finden","summary.embassy":"{0} Botschaften gebaut","summary.feed":"{0} Necrocorns an die Ältesten verfüttert","summary.festival":"{0} Festivals veranstaltet","summary.fix.cry":"{0} Kryokammern repariert","summary.head":"Zusammenfassung der letzten {0}","summary.hunt":"Niedliche Jäger Kätzchen auf {0} Jagden versandt","summary.praise":"{0} Anbetung durch Loben der Sonne akkumuliert","summary.promote":"Unseren Anführer {0} mal befördert","summary.refine":"{0} {1} verfeinert","summary.separator":" und ","summary.show":"Aktivitäten anzeigen","summary.stars":"{0} Sterne beobachtet","summary.sun":"{0} {1} entdeckt","summary.tech":"{0} erforscht","summary.time.activeHeatTransferStart":"Aktive Wärmeübertragung {0} mal","summary.time.getTemporalFlux":"{0} Mal Kristalle verbrannt, um Zeit Flux zu generieren","summary.time.reset.content":"{0} Karma erhalten.<br>{1} Paragon erhalten","summary.time.reset.title":"Zusammenfassung der letzten {0} Zeitleisten","summary.time.skip":"{0} Jahre übersprungen","summary.trade":"{0} mal mit {1} gehandelt","summary.transcend":"{0} mal aufgestiegen","summary.upgrade":"{0} verbessert","summary.year":"Jahr","summary.years":"Jahre","time.heatTransfer.cycle.disable":"Aktiver Wärmetransfer im Zyklus {0} deaktiviert","time.heatTransfer.cycle.enable":"Aktiver Wärmetransfer im Zyklus {0} aktiviert","time.skip.cycle.disable":"Zeitsprung im Zyklus {0} und Überspringen über diesen Zyklus verboten","time.skip.cycle.enable":"Zeitsprung im Zyklus {0} und Überspringen über diesen Zyklus erlaubt","time.skip.season.disable":"Zeitsprung in {0} deaktiviert","time.skip.season.enable":"Zeitsprung in {0} aktiviert","trade.limited":"Handel mit {0}: limitiert auf nur, wenn profitabel auf Basis der relativen Produktionszeit","trade.season.disable":"Handel mit {0} in {1} deaktiviert","trade.season.enable":"Handel mit {0} in {1} aktiviert","trade.seasons":"Jahreszeiten","trade.unlimited":"Handel mit {0}: unbegrenzt","ui.additional":"Weitere Optionen","ui.build":"Lagerfeuer","ui.close":"schließen","ui.craft":"Werkstatt","ui.craft.resources":"Ressourcen","ui.cycles":"Zyklen","ui.disable.all":"Alle Optionen in dieser Liste deaktivieren.","ui.distribute":"Dorf","ui.enable.all":"Alle Optionen in dieser Liste aktivieren.","ui.engine":"Kitten Scientists aktivieren","ui.faith":"Religion","ui.filter":"Protokollfilter","ui.infinity":"∞","ui.internals":"Intern","ui.internals.interval":"Intervall: {0}","ui.internals.interval.prompt":"Gib die neue Anzahl an Millisekunden als absoluten Wert zwischen 0 und unendlich ein.","ui.internals.interval.promptExplainer":"Alle Notationen, die das Spiel unterstützt werden, akzeptiert. Wenn du die Grenze auf 0 setzt, werden die Kitten Scientists deaktiviert. Wenn du einen ungültigen Wert eingibst, wird das genauso behandelt als ob du Abbrechen gedrückt hättest.","ui.internals.interval.promptTitle":"Kitten Scientists Ausführungsintervall (Aktuell: {0})","ui.itemsHide":"Abschnitt einklappen","ui.itemsShow":"Abschnitt ausklappen","ui.ksColumn":"KS in vierter Spalte im UI anzeigen","ui.language":"Sprache","ui.limit":"Begrenzt","ui.limited.off":"Unbegrenzt","ui.limited.on":"Öko-Modus","ui.max":"Max: {0}","ui.max.build.prompt":"Grenze für {0} (Aktuell: {1})","ui.max.build.promptExplainer":"Alle Notationen, die das Spiel unterstützt werden, akzeptiert. Wenn du gar nichts, oder einen negativen Wert eingibst, wird die Grenze auf unendlich gesetzt. Wenn du die Grenze auf 0 setzt, wird Zeit Überspringen deaktiviert. Wenn du einen ungültigen Wert eingibst, wird das genauso behandelt als ob du Abbrechen gedrückt hättest.","ui.max.build.title":"Baue {0} {1}","ui.max.build.titleInfinite":"Nie aufhören {0} zu bauen","ui.max.build.titleZero":"{0} nicht bauen","ui.max.craft.prompt":"Gib die neue Grenze zum Herstellen von {0} als absoluten Wert zwischen 0 und unendlich ein.","ui.max.craft.promptExplainer":"Alle Notationen, die das Spiel unterstützt werden, akzeptiert. Wenn du gar nichts, oder einen negativen Wert eingibst, wird die Grenze auf unendlich gesetzt. Wenn du die Grenze auf 0 setzt, wird Zeit Überspringen deaktiviert. Wenn du einen ungültigen Wert eingibst, wird das genauso behandelt als ob du Abbrechen gedrückt hättest.","ui.max.craft.promptTitle":"Grenze für Herstellen von {0} (Aktuell: {1})","ui.max.craft.title":"{0} {1} herstellen","ui.max.craft.titleInfinite":"Nie aufhören {0} herzustellen","ui.max.craft.titleZero":"{0} nicht herstellen","ui.max.distribute.prompt":"Gib die neue Anzahl an Kätzchen im {0} Beruf als absoluten Wert zwischen 0 und unendlich ein.","ui.max.distribute.promptExplainer":"Alle Notationen, die das Spiel unterstützt werden, akzeptiert. Wenn du gar nichts, oder einen negativen Wert eingibst, wird die Grenze auf unendlich gesetzt. Wenn du die Grenze auf 0 setzt, wird Zeit Überspringen deaktiviert. Wenn du einen ungültigen Wert eingibst, wird das genauso behandelt als ob du Abbrechen gedrückt hättest.","ui.max.distribute.promptTitle":"Max. Kätzchen als {0} zuweisen (Aktuell: {1})","ui.max.distribute.title":"{0} Kätzchen als {1} zuweisen","ui.max.distribute.titleInfinite":"So viele Kätzchen wie möglich als {0} zuweisen","ui.max.distribute.titleZero":"Keine Kätzchen als {0} zuweisen","ui.max.embassy.title":"Baue {0} Botschaften für {1}","ui.max.embassy.titleInfinite":"Nie aufhören Botschaften für {0} zu bauen","ui.max.embassy.titleZero":"Keine Botschaften für {0} bauen","ui.max.prompt.absolute":"Gib die neue Grenze als absoluten Wert zwischen 0 und unendlich ein.","ui.max.prompt.float":"Gib die neue Grenze als absoluten Wert zwischen 0,0 und unendlich ein.","ui.max.set":"Maximum für {0}","ui.max.timeSkip.prompt":"Gib die neue Anzahl an Jahren als absoluten Wert zwischen 0 und unendlich ein.","ui.max.timeSkip.promptExplainer":"Alle Notationen, die das Spiel unterstützt werden, akzeptiert. Wenn du gar nichts, oder einen negativen Wert eingibst, wird die Grenze auf unendlich gesetzt. Wenn du die Grenze auf 0 setzt, wird Zeit Überspringen deaktiviert. Wenn du einen ungültigen Wert eingibst, wird das genauso behandelt als ob du Abbrechen gedrückt hättest.","ui.max.timeSkip.promptTitle":"Max. Jahre zum Überspringen (Aktuell: {0})","ui.max.timeSkip.title":"{0} Jahre auf einmal überspringen","ui.max.timeSkip.titleInfinite":"So viele Jahre wie möglich überspringen","ui.max.timeSkip.titleZero":"Keine Zeit überspringen","ui.maximum":"Maximum","ui.min":"Min. {0}","ui.options":"Optionen","ui.reset":"Optionen in der Liste auf Standardkonfiguration zurücksetzen.","ui.resources":"Ressourcensteuerung","ui.space":"Weltraum","ui.time":"Zeit","ui.timeCtrl":"Zeitsteuerung","ui.trade":"Handel","ui.trigger":"Auslöser: {0}","ui.trigger.accelerateTime.prompt":"Gib den neuen Lagerbestand von Temporalem Flux, bei welchem Tempus Fugit aktiviert werden soll, als Prozentzahl ein. Der Wert sollte zwischen 0,0 und 100,0 liegen.","ui.trigger.accelerateTime.promptExplainer":"Wenn du einen leeren oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hättest.","ui.trigger.accelerateTime.promptTitle":"Auslöser zur Zeit-Beschleunigung (Aktuell: {0})","ui.trigger.activeHeatTransfer.prompt":"Gib den neuen Stand von Chronohitze, bei welchem aktiver Wärmetransfer aktiviert werden sollen, als Prozentzahl ein. Der Wert sollte zwischen 0,0 und 100,0 liegen.","ui.trigger.activeHeatTransfer.promptExplainer":"Wenn du einen leeren oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hättest.","ui.trigger.activeHeatTransfer.promptTitle":"Auslöser für Wärmetransfer (Aktuell: {0})","ui.trigger.build.blocked":`∞\n🛈 Der Abschnitt {0} hat keinen Auslöser gesetzt. Diese Option wird nie ausgelöst!`,"ui.trigger.build.inherited":"von Abschnitt übernommen","ui.trigger.build.prompt":"Auslöser für {0} (Aktuell: {1})","ui.trigger.build.promptExplainer":\'Wenn du gar nichts, oder eine negative Zahl eingibst, wird der Auslöser des Abschnitts geerbt. Ungültige Eingaben werden so behandelt als ob du "Abbrechen" drückst.\',"ui.trigger.crypto.prompt":"Gib den neuen Lagerbestand von Relikten, bei welchem Blackcoins gehandelt werden sollen, als absoluten Wert zwischen 0,0 und unendlich ein.","ui.trigger.crypto.promptExplainer":"Wenn du einen leeren oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hättest.","ui.trigger.crypto.promptTitle":"Auslöser um Blackcoin zu handeln (Aktuell: {0})","ui.trigger.embassies.prompt":"Gib den neuen Lagerbestand von Kultur, bei welchem Botschaften gebaut werden sollen, als Prozentzahl ein. Der Wert sollte zwischen 0,0 und 100,0 liegen.","ui.trigger.embassies.promptExplainer":"Wenn du einen leeren oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hättest.","ui.trigger.embassies.promptTitle":"Auslöser für den Bau von Botschaften (Aktuell: {0})","ui.trigger.hunt.prompt":"Auslöser für Jagd (Aktuell: {0})","ui.trigger.hunt.promptExplainer":"Wenn du einen negativen Wert eingibst, wird Jagen deaktiviert. Wenn du einen leeren Wert oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hast.","ui.trigger.inactive":"inaktiv","ui.trigger.promoteKittens.prompt":"Gib den neuen Lagerbestand von Gold, bei welchem Kätzchen befördert werden sollen, als Prozentzahl ein. Der Wert sollte zwischen 0,0 und 100,0 liegen.","ui.trigger.promoteKittens.promptExplainer":"Wenn du einen leeren oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hättest.","ui.trigger.promoteKittens.promptTitle":"Auslöser um Kätzchen zu befördern (Aktuell: {0})","ui.trigger.prompt.absolute":"Gib den neuen Auslöser als absoluten Wert zwischen 0 und unendlich ein.","ui.trigger.prompt.float":"Gib den neuen Auslöser als absoluten Wert zwischen 0,0 und unendlich ein.","ui.trigger.prompt.percentage":"Gib den neuen Auslöser als Prozentzahl zwischen 0,0 und 100,0 ein.","ui.trigger.reset.promptExplainer":"Wenn du einen negativen Wert eingibst, wird die Option deaktiviert. Wenn du einen leeren Wert oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hast.","ui.trigger.section":"Abschnitt Standard-Auslöser: {0}","ui.trigger.section.blocked":`∞\n🛈 Der Abschnitt {0} hat keinen Auslöser gesetzt. Diese Option wird nie ausgelöst!`,"ui.trigger.section.inactive":"∞ (nichts wird automatisch ausgelöst)","ui.trigger.section.inherited":"von Abschnitt übernommen","ui.trigger.section.prompt":"Auslöser für Abschnitt {0} (Aktuell: {1})","ui.trigger.section.promptExplainer":`Wenn du einen leeren Wert oder einen negativen Wert eingibst, wird der Auslöser des Abschnitts auf Unendlichkeit gesetzt (∞), was alle Optionen deaktiviert, es sei denn, sie haben einen eigenen Auslöser gesetzt.\nWenn du einen ungültigen Wert eingibst, wird er so behandelt, als ob du "Abbrechen" drückst.`,"ui.trigger.setinteger":"Gib einen neuen Auslöser für {0} ein. Sollte im Bereich von 0 bis zu einer beliebigen Zahl liegen. -1 bedeutet unendlich.","ui.trigger.setinteger.promptExplainer":"Wenn du einen leeren oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hättest.","ui.trigger.setpercentage":"Geben Sie einen neuen Auslöser für {0} ein. Sollte im Bereich von 0 bis 100 liegen.","ui.trigger.setpercentage.promptExplainer":"Wenn du einen leeren oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hättest.","ui.trigger.timeSkip.prompt":"Gib die neue Menge an Zeitkristallen ein, bei welcher Zeit übersprungen werden soll. Der Wert sollte zwischen 1 und unendlich liegen.","ui.trigger.timeSkip.promptExplainer":"Wenn du einen negativen Wert eingibst, werden Zeit-Sprünge deaktiviert. Wenn du einen leeren Wert oder einen ungültigen Wert eingibst, wird das so behandelt, als ob du Abbrechen gedrückt hast.","ui.trigger.timeSkip.promptTitle":"Auslöser für Zeitsprung (Aktuell: {0})","ui.upgrade":"Wissenschaft","ui.upgrade.buildings":"Gebäude verbessern","ui.upgrade.missions":"Missionen starten","ui.upgrade.policies":"Politik erforschen","ui.upgrade.races":"Neue Völker erforschen","ui.upgrade.techs":"Technologien erforschen","ui.upgrade.upgrades":"Verbesserungen erforschen","ui.upgrades":"Verbesserungen",update:"Aktualisieren","upgrade.building.amphitheatre":"Amphitheater zu Sendetürmen verbessert!","upgrade.building.aqueduct":"Aquädukte zu Wasserwerken verbessert!","upgrade.building.library":"Bibliotheken zu Rechenzentren verbessert!","upgrade.building.pasture":"Weiden zu Solarfarmen verbessert!","upgrade.building.warehouse":"Lagerhäuser zu Raumhäfen verbessert!","upgrade.policy":"Kätzchen haben {0} veranlasst","upgrade.race":"Kätzchen haben die {0} getroffen","upgrade.space":"Kätzchen haben {0} durchgeführt","upgrade.space.mission":"Kätzchen haben eine Mission zu {0} durchgeführt","upgrade.tech":"Kätzchen haben die Technologie {0} gekauft","upgrade.upgrade":"Kätzchen haben die Verbesserung {0} gekauft"},cn={"act.accelerate":"האץ את הזמן!","act.adore":"העריץ את הגלקסיה! נאסף {0} פולחן ל-{1} תגלית","act.blackcoin.buy":"Kittens sold your Relics and bought {0} Blackcoins","act.blackcoin.sell":"Kittens sold your Blackcoins and bought {0} Relics","act.build":"חתלתולים בנו {0} חדש","act.builds":"חתלתולים בנו {0} חדש {1} פעמים","act.craft":"חתלתולים יצרו {0} {1}","act.distribute":"הופץ חתלתול ל-{0}","act.elect":"חתלתולים בחרו מנהיג חדש.","act.feed":"חתלתולים האכילו את העתיקים. העתיקים מרוצים","act.fix.cry":"חתלתולים תיקנו {0} תאי קריו","act.hunt":"נשלחו חתלתולים {0} פעמים לציד","act.observe":"מדעניתלתול צפו בכוכב","act.praise":"הריעו לשמש! נצבר {0} אמונה עבור {1} פולחן","act.promote":"מנהיג החתלתולים קודם לדרגה {0}","act.refineTCs":"זוקקו {0} בדולחי זמן","act.refineTears":"Refined {0} tears into BLS","act.sacrificeAlicorns":"הוקרבו {0} מכונפי קרן","act.sacrificeUnicorns":"Sacrificed {0} unicorns","act.sun.discover":"חתותולים גילו {0}","act.sun.discovers":"חתלתולים גילו {0} {1} פעמים","act.time.activeHeatTransferEnd":"End active Heat Transfer","act.time.activeHeatTransferStart":"Start active Heat Transfer","act.time.getTemporalFlux":"Burn crystals to obtain time flux to maintain time acceleration","act.time.skip":"חתלתולים שרפו בדולח זמן, ופסחו על {0} שנים!","act.trade":"חתלתולים סחרו {0} פעמים עם {1}","act.transcend":"נוצל {0} תגלית, התעלה לרמת התעלות: {1}","blackcoin.buy":"Buy Limit: {0}","blackcoin.buy.prompt":"Enter at which price you want to stop buying blackcoins.","blackcoin.buy.promptExplainer":"Blackcoin price always rises from 800 to 1100 (roughly), then it crashes. You usually want to buy until shortly before you sell.","blackcoin.buy.promptTitle":"Buy Limit for Blackcoins (Current: {0})","blackcoin.buy.title":"Buy Blackcoins until price reaches {0}","blackcoin.buy.trigger":"קונה מטבעותשחור (בשרידים)","blackcoin.sell":"Sell Order: {0}","blackcoin.sell.prompt":"Enter at which price you want to sell all your blackcoins.","blackcoin.sell.promptExplainer":"Blackcoin price always rises from 800 to 1100 (roughly), then it crashes. You usually want to sell close to the highest possible price.","blackcoin.sell.promptTitle":"Sell Order for Blackcoins (Current: {0})","blackcoin.sell.title":"Sell Blackcoins when price reaches {0}","build.embassies":"נבנו {0} שגרירויות של {1}","build.embassy":"נבנו {0} שגרירויות של {1}",copy:"Copy","craft.limited":"יוצר {0}: מוגבל לעלות היחסית","craft.unlimited":"יוצר {0}: ללא הגבלה",delete:"Delete","dispose.necrocorn":"חתלתולים נפטרו מאלמתי קרן לא יעילים","festival.extend":"חתלתולים האריכו את החגיגה","festival.hold":"חתלתולים החלו לערוך חגיגה","filter.accelerate":"הזמן עובר לו","filter.adore":"מעריץ","filter.allKG":"All KG log entries.","filter.build":"בנייה","filter.craft":"יצירה","filter.disable":"נכבו {0} רשומות","filter.distribute":"חלוקה","filter.enable":"Enabled {0} log messages","filter.explainer":"Disabled items are hidden from the log.","filter.faith":"מסדר השמש","filter.festival":"חגיגות","filter.hunt":"ציד","filter.misc":"שונות","filter.praise":"הילול","filter.promote":"העלאות דרגה","filter.research":"חקר","filter.star":"אירועים אסטרונומיים","filter.timeSkip":"קפיצת זמן","filter.trade":"סחר","filter.transcend":"עילוי","filter.upgrade":"שדרוג","option.accelerate":"הזמן עובר לו","option.autofeed":"האכל לוויתנים","option.catnip":"Gather Catnip","option.crypto":"סחור במטבעשחור","option.elect":"בחר מנהיג","option.elect.job":"Job","option.elect.job.any":"Any","option.elect.trait":"Trait","option.embassies":"בנה שגרירויות","option.faith.adore":"הערץ את הגלקסיה","option.faith.autoPraise":"הלל את השמש","option.faith.best.unicorn":"Automate Build Order","option.faith.refineTears":"זקק דמעות","option.faith.refineTimeCrystals":"זקק TCים","option.faith.sacrificeAlicorns":"הקרב מכונפי קרן","option.faith.sacrificeUnicorns":"Sacrifice Unicorns","option.faith.transcend":"עילוי","option.festival":"ארגן חגיגות","option.fix.cry":"תקן תאי קריו","option.hunt":"צוד","option.magnetos":"הפעל מגנטוים","option.observe":"צפה באירועים אסטרונומיים","option.praise":"הלל את השמש","option.promote":"העלאות דרגה","option.promotekittens":"העלה את דרגת החתלתולים","option.reactors":"Turn on Reactors","option.shipOverride":"הכרח ספינות ל-243","option.steamworks":"הפעל את מנוע הקיטור","option.time.activeHeatTransfer":"Active Heat Transfer","option.time.reset":"אתחל מחדש את ציר הזמן (סכנה!)","option.time.skip":"קפיצת זמן","option.time.skip.ignoreOverheat":"Ignore overheat",reset:"Reset","reset.after":"Nice to meet you, the cute Kitten Scientists will serve you","reset.cancel.activity":"מאוסטון, יש לנו בעיה","reset.cancel.message":"אתחול ציר הזמן בוטל","reset.check":"Trigger for {0}: {1}, you have {2}","reset.checked":"All conditions are met, the timeline will restart in the next few seconds!","reset.countdown.0":"0 - Temporal rifts opened!","reset.countdown.1":"1 - Time engine start","reset.countdown.2":"2 - Boosting the chronoforge","reset.countdown.3":"3 - Opening temporal rifts","reset.countdown.4":"4 - Turning off satellite","reset.countdown.5":"5 - Melting blackcoins","reset.countdown.6":"6 - Starting time engines","reset.countdown.7":"7 - Disassembling railguns","reset.countdown.8":"8 - Releasing lizards","reset.countdown.9":"9 - Sacrificing unicorns","reset.countdown.10":"10 - קוצר נפית חתולים","reset.last.message":"נתראה בהישנות פואנקרה הבאה","reset.tip":\'You can cancel this reset by disabling "Enable Kitten Scientists" at the top of the settings.\',"resources.consume":"צרוך: {0}","resources.consume.prompt":"Enter how much of the resource you want automations to consume as a percentage between 0.0 and 100.0.","resources.consume.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","resources.consume.promptTitle":"Consumption Share for {0} (Current: {1})","resources.consume.set":"קצב צריכה עבור {0}","resources.consume.title":"Consuming {0} of {1}","resources.consume.titleZero":"Not consuming {0}","resources.stock.prompt":"Enter how much of the resource you always want to keep in stock.","resources.stock.promptExplainer":"All notations that the game supports are accepted. If you submit an empty value, or a negative value, the limit will be set to infinity. If you set the limit to 0, this option will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","resources.stock.promptTitle":"Stock value for {0} (Current: {1})","resources.stock.title":"Keeping {0} {1} in stock","resources.stock.titleInfinite":"Keeping all {0} in stock","resources.stock.titleZero":"Not keeping any {0} in stock","state.compress":"Compress data","state.confirmDestruction":"האם אתה בטוח?","state.copied.game":"Save \'{0}\' copied to clipboard.","state.copied.gameCurrent":"Current save copied to clipboard.","state.copied.state":"State \'{0}\' copied to clipboard.","state.copied.stateCurrent":"Current state copied to clipboard.","state.copy.game":"Copy this save to the clipboard.","state.copy.gameCurrent":"Copy the entire Kittens Game save (includes KS settings) to the clipboard.","state.copy.state":"Copy these settings to the clipboard.","state.copy.stateCurrent":"Copy the current Kitten Scientists settings to the clipboard.","state.delete.game":"Delete this save.","state.delete.state":"Delete these settings.","state.deleted.game":"Save \'{0}\' deleted.","state.deleted.state":"State \'{0}\' deleted.","state.edit.game":"Change the name of this save.","state.edit.state":"Change the name of these settings.","state.exportAll":"Backup","state.exportAllTitle":"Stores all local states in a single file and downloads it.","state.import":"Import from clipboard","state.imported.game":"Save imported.","state.imported.state":"State imported.","state.importedState":"Imported state {0}","state.importTitle":`Paste a save or settings from your clipboard.\nContents will be automatically detected and handled accordingly.`,"state.loaded.game":"Save \'{0}\' loaded.","state.loaded.state":"State \'{0}\' loaded.","state.loadPrompt":"Paste your (un/compressed) save or settings here:","state.local":"Local states","state.localGames":"Kittens Game Saves","state.localStates":"Kitten Scientists Settings","state.new":"New","state.noConfirm":"Do NOT confirm destructive actions. (Danger!)","state.store":"Store","state.stored.game":"Save stored.","state.stored.state":"State stored.","state.storeFactory":"Create a new state from factory defaults.","state.storeGame":"Create a new save from the current game.","state.storeGame.prompt":"Provide a label for this save:","state.storeState":"Create a new state from current settings.","state.storeState.prompt":"Provide a label for this state:","state.title":"State Management","state.unlabeledGame":"unlabeled save","state.unlabeledState":"unlabeled state","state.update.game":"Save the current game into this slot.","state.update.state":"Save the current settings into this slot.","state.updated.game":"Save \'{0}\' updated.","state.updated.state":"State \'{0}\' updated.","status.auto.disable":"Disabled Auto {0}","status.auto.enable":"Enabled Auto {0}","status.ks.disable":"מבטל את המדעניתלתול!","status.ks.enable":"מאפשר את המדעניתלתול!","status.ks.init":"Kitten Scientists initialized.","status.ks.upgrade":"Kitten Scientists {0} (ours is {1}) is available at {2}.","status.reset.check.disable":"Disabled check {0} before Reset Timeline","status.reset.check.enable":"Enabled check {0} before Reset Timeline","status.resource.disable":"כבה ניהול משאבי {0}","status.resource.enable":"הפעל ניהול משאבי {0}","status.sub.disable":"{0} הושבת","status.sub.enable":"{0} אופשר","summary.accelerate":"הזמן הועץ {0} פעמים","summary.adore":"נצבר {0} תגלית על ידי הערצת הגלקסיה","summary.building":"נבנה {0} {1}","summary.craft":"נוצר {0} {1}","summary.day":"יום","summary.days":"ימים","summary.distribute":"עזרת ל-{0} חתלתולים למצוא עבודה","summary.embassy":"נבנו {0} שגרירויות","summary.feed":"האכלת את הוותיקים {0} אלמתי קרן","summary.festival":"אורגנו {0} חגיגות","summary.fix.cry":"תוקנו {0} תאי קריו","summary.head":"תקציר {0} האחרונים","summary.hunt":"צידיתלתול יצאו לצוד {0} פעמים","summary.praise":"נצבר {0} פולחן על ידי הילול השמש","summary.promote":"המנהיג קודם {0} פעמים","summary.refine":"זוקק {0} {1}","summary.separator":" ועוד ","summary.show":"הצג פעילות","summary.stars":"נצפו {0} כוכבים","summary.sun":"התגלו {0} {1}","summary.tech":"נחקרו {0}","summary.time.activeHeatTransferStart":"Active Heat Transfer {0} times","summary.time.getTemporalFlux":"Burn crystal to gain time flux {0} times","summary.time.reset.content":"נאסף {0} קרמה.<br>נאסף {1} מופת","summary.time.reset.title":"סיכום {0} צירי הזמן האחרונים","summary.time.skip":"{0} שנים נפסחו","summary.trade":"סחרת {0} פעמים עם {1}","summary.transcend":"התעלית {0} פעמים","summary.upgrade":"שודרג {0}","summary.year":"שנה","summary.years":"שנים","time.heatTransfer.cycle.disable":"Disabled active heat transfer in cycle {0}","time.heatTransfer.cycle.enable":"Enabled active heat transfer in cycle {0}","time.skip.cycle.disable":"Disabled time skip in cycle {0} and disallow skip over this cycle","time.skip.cycle.enable":"Enabled time skip in cycle {0} and allow skip over this cycle","time.skip.season.disable":"Disabled time skip in the {0}","time.skip.season.enable":"Enabled time skip in the {0}","trade.limited":"סחר עם {0}: מוגבל רק כאשר זה רווחי ביחס לזמן ייצור","trade.season.disable":"בוטל הסחר עם {0} עבור {1}","trade.season.enable":"אופשר הסחר עם {0} עבור {1}","trade.seasons":"עונות","trade.unlimited":"סחר עם {0}: ללא הגבלה","ui.additional":"Additional options","ui.build":"מדורה","ui.close":"סגור","ui.craft":"סדנא","ui.craft.resources":"משאבים","ui.cycles":"מחזורים","ui.disable.all":"Disable all options in this list.","ui.distribute":"כפר","ui.enable.all":"Enable all options in this list.","ui.engine":"Enable Kitten Scientists","ui.faith":"דת","ui.filter":"סנני רשומות","ui.infinity":"∞","ui.internals":"Internals","ui.internals.interval":"Interval: {0}","ui.internals.interval.prompt":"Enter the new amount of milliseconds as an absolute value between 0 and Infinity.","ui.internals.interval.promptExplainer":"All notations that the game supports are accepted. If you set the limit to 0, Kitten Scientists will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.internals.interval.promptTitle":"Kitten Scientists Execution Interval (Current: {0})","ui.itemsHide":"Collapse section","ui.itemsShow":"Expand section","ui.ksColumn":"Display in fourth column","ui.language":"Language","ui.limit":"מוגבל","ui.limited.off":"Unlimited","ui.limited.on":"Eco Mode","ui.max":"מירבי: {0}","ui.max.build.prompt":"Limit for {0} (Current: {1})","ui.max.build.promptExplainer":"All notations that the game supports are accepted. If you submit an empty value, or a negative value, the limit will be set to infinity. If you set the limit to 0, this option will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.max.build.title":"Build {0} {1}","ui.max.build.titleInfinite":"Never stop building {0}","ui.max.build.titleZero":"Don\'t build {0}","ui.max.craft.prompt":"Enter the new limit of how many {0} to craft as an absolute value between 0 and Infinity.","ui.max.craft.promptExplainer":"All notations that the game supports are accepted. If you submit an empty value, or a negative value, the limit will be set to infinity. If you set the limit to 0, this option will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.max.craft.promptTitle":"Limit for Crafting {0} (Current: {1})","ui.max.craft.title":"Craft {0} {1}","ui.max.craft.titleInfinite":"Never stop crafting {0}","ui.max.craft.titleZero":"Don\'t craft {0}","ui.max.distribute.prompt":"Enter the new amount of kittens to assign as {0} as an absolute value between 0 and Infinity.","ui.max.distribute.promptExplainer":"All notations that the game supports are accepted. If you submit an empty value, or a negative value, the limit will be set to infinity. If you set the limit to 0, this option will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.max.distribute.promptTitle":"Assign Max. Kittens as {0} (Current: {1})","ui.max.distribute.title":"Assign {0} kittens as {1}","ui.max.distribute.titleInfinite":"Assign as many kittens as possible as {0}","ui.max.distribute.titleZero":"Don\'t assign any kittens as {0}","ui.max.embassy.title":"Build {0} embassy for {1}","ui.max.embassy.titleInfinite":"Never stop building embassies for {0}","ui.max.embassy.titleZero":"Don\'t build embassies for {0}","ui.max.prompt.absolute":"Enter the new limit as an absolute value between 0 and Infinity.","ui.max.prompt.float":"Enter the new limit as an absolute value between 0.0 and Infinity.","ui.max.set":"מירבי עבור {0}","ui.max.timeSkip.prompt":"Enter the new amount of years as an absolute value between 0 and Infinity.","ui.max.timeSkip.promptExplainer":"All notations that the game supports are accepted. If you submit an empty value, or a negative value, the limit will be set to infinity. If you set the limit to 0, this option will be automatically disabled. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.max.timeSkip.promptTitle":"Max. Years to skip (Current: {0})","ui.max.timeSkip.title":"Skip {0} years at once","ui.max.timeSkip.titleInfinite":"Skip as many years as possible","ui.max.timeSkip.titleZero":"Don\'t skip time","ui.maximum":"מירבי","ui.min":"מינימלי: {0}","ui.options":"אפשרויות","ui.reset":"Reset list options to default configuration.","ui.resources":"בקרת משאבים","ui.space":"חלל","ui.time":"זמן","ui.timeCtrl":"שליטה בזמן","ui.trade":"סחר","ui.trigger":"מפעיל: {0}","ui.trigger.accelerateTime.prompt":"Enter the new temporal flux storage level at which to enable Tempus Fugit as a percentage between 0.0 and 100.0.","ui.trigger.accelerateTime.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.accelerateTime.promptTitle":"Trigger to Accelerate Time (Current: {0})","ui.trigger.activeHeatTransfer.prompt":"Enter the new temporal heat storage level at which to enable heat transfer as a percentage between 0.0 and 100.0.","ui.trigger.activeHeatTransfer.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.activeHeatTransfer.promptTitle":"Trigger for Heat Transfer (Current: {0})","ui.trigger.build.blocked":`∞\n🛈 The {0} section has no trigger set. This build will not be triggered!`,"ui.trigger.build.inherited":"inherited from section","ui.trigger.build.prompt":"Trigger for {0} (Current: {1})","ui.trigger.build.promptExplainer":"If you submit an empty value, or a negative value, the section trigger is used instead. If you submit an invalid value, it will be treated as if you hit Cancel.","ui.trigger.crypto.prompt":"Enter the new relic storage level at which to trade blackcoin as an absolute value between 0.0 and Infinity.","ui.trigger.crypto.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.crypto.promptTitle":"Trigger to Trade Blackcoin (Current: {0})","ui.trigger.embassies.prompt":"Enter the new culture storage level at which to build embassies as a percentage between 0.0 and 100.0.","ui.trigger.embassies.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.embassies.promptTitle":"Trigger to Build Embassies (Current: {0})","ui.trigger.hunt.prompt":"Trigger for Hunting (Current: {0})","ui.trigger.hunt.promptExplainer":"If you submit a negative value, hunting will be disabled. If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.inactive":"inactive","ui.trigger.promoteKittens.prompt":"Enter the new gold storage level at which to promote kittens as a percentage between 0.0 and 100.0.","ui.trigger.promoteKittens.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.promoteKittens.promptTitle":"Trigger to Promote Kittens (Current: {0})","ui.trigger.prompt.absolute":"Enter the new trigger value as an absolute value between 0 and Infinity.","ui.trigger.prompt.float":"Enter the new trigger value as an absolute value between 0.0 and Infinity.","ui.trigger.prompt.percentage":"Enter the new trigger value as a percentage between 0.0 and 100.0.","ui.trigger.reset.promptExplainer":"If you submit a negative value, the item will be disabled. If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.section":"Section default trigger: {0}","ui.trigger.section.blocked":`∞\n🛈 The {0} section has no trigger set. This automation will not be triggered!`,"ui.trigger.section.inactive":"∞ (nothing is triggered automatically)","ui.trigger.section.inherited":"inherited from section","ui.trigger.section.prompt":"Trigger for section {0} (Current: {1})","ui.trigger.section.promptExplainer":`If you submit an empty value, or a negative value, the section trigger will be set to infinity (∞). Individual automations in this section need to have their own trigger set to be activated.\nIf you submit an invalid value, it will be treated as if you hit Cancel.`,"ui.trigger.setinteger":"Enter a new trigger value for {0}. Should be in the range from 0 up to any number. -1 means infinity.","ui.trigger.setinteger.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.setpercentage":"Enter a new trigger value for {0}. Should be in the range from 0 to 100.","ui.trigger.setpercentage.promptExplainer":"If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.timeSkip.prompt":"Enter the new amount of Time Crystals at which to skip time as an absolute value between 1 and Infinity.","ui.trigger.timeSkip.promptExplainer":"If you submit a negative value, time skipping will be disabled. If you submit an empty value, or an invalid value, it will be treated as if you hit Cancel.","ui.trigger.timeSkip.promptTitle":"Trigger for Time Skip (Current: {0})","ui.upgrade":"מדע","ui.upgrade.buildings":"שדרג בניינים","ui.upgrade.missions":"התחל משימות","ui.upgrade.policies":"פוליסת מחקר","ui.upgrade.races":"גלה גזעים חדשים","ui.upgrade.techs":"חקור טכנולוגיות","ui.upgrade.upgrades":"חקור שדרוגים","ui.upgrades":"Upgrades",update:"Update","upgrade.building.amphitheatre":"אמפיטאטראות שודרגו למגדלי שידור!","upgrade.building.aqueduct":"אקוודוקטים שודרגו למפעלי מים!","upgrade.building.library":"ספריות שודרגו למרכזיות מידע!","upgrade.building.pasture":"אדמות חקלאיות שודרגו לשדות קולטני שמש!","upgrade.building.warehouse":"Upgraded warehouses to spaceports!","upgrade.policy":"חתלתולים העבירו {0}","upgrade.race":"חתלתולים פגשו את {0}","upgrade.space":"חתלתולים ביצעו {0}","upgrade.space.mission":"חתלתולים ביצעו משימה אל {0}","upgrade.tech":"חתלתולים קנו את הטכנולוגיה {0}","upgrade.upgrade":"חתלתולים קנו את השדרוג {0}"},hn={"act.accelerate":"固有时制御,二倍速!","act.adore":"赞美群星! 转化 {0} 虔诚为 {1} 顿悟","act.blackcoin.buy":"小猫出售遗物并买入 {0} 黑币","act.blackcoin.sell":"小猫出售黑币并买入了 {0} 遗物","act.build":"小猫建造了一个 {0}","act.builds":"小猫建造了 {1} 个新的 {0}","act.craft":"小猫制作了 {0} {1}","act.distribute":"分配一只猫猫成为 {0}","act.elect":"小猫选出了一位新领导人","act.feed":"小猫向上古神献上祭品。上古神很高兴","act.fix.cry":"小猫修复了 {0} 个冷冻仓","act.hunt":"派出 {0} 波小猫去打猎","act.observe":"小猫珂学家观测到一颗流星","act.praise":"赞美太阳! 转化 {0} 信仰为 {1} 虔诚","act.promote":"领袖被提拔到 {0} 级","act.refineTCs":"精炼 {0} 时间水晶","act.refineTears":"将 {0} 泪水提炼成黑色眼泪","act.sacrificeAlicorns":"献祭了 {0} 只天角兽","act.sacrificeUnicorns":"已献祭的独角兽数:{0}","act.sun.discover":"小猫在 {0} 方面获得顿悟","act.sun.discovers":"小猫在 {0} 方面获得 {1} 次顿悟","act.time.activeHeatTransferEnd":"主动散热完成","act.time.activeHeatTransferStart":"开始主动散热","act.time.getTemporalFlux":"烧水晶获取时间通量以维持时间加速","act.time.skip":"燃烧时间水晶, 跳过接下来的 {0} 年!","act.trade":"小猫与 {1} 交易 {0} 次","act.transcend":"消耗 {0} 顿悟,达到超越 {1}","blackcoin.buy":"买入单价:{0}","blackcoin.buy.prompt":"输入您想要停止购买黑币的价格。","blackcoin.buy.promptExplainer":"黑币价格总是从 800 上涨到 1100 (大致),然后暴跌。你通常应该一直买入直到卖出前不久。","blackcoin.buy.promptTitle":"黑币购买限额 (当前:{0})","blackcoin.buy.title":"购买黑币直至价格达到 {0}","blackcoin.buy.trigger":"购买黑币(遗迹)","blackcoin.sell":"卖出单价:{0}","blackcoin.sell.prompt":"输入您想要出售所有黑币的价格。","blackcoin.sell.promptExplainer":"黑币价格总是从 800 上涨到 1100 (大致),然后暴跌。你通常希望以接近最高价的价格出售。","blackcoin.sell.promptTitle":"黑币卖单 (当前:{0})","blackcoin.sell.title":"当价格达到 {0} 时出售黑币","build.embassies":"在 {1} 设立了 {0} 个大使馆","build.embassy":"在 {1} 设立了 {0} 个大使馆",copy:"复制","craft.limited":"制作 {0} 受库存消耗比率的限制","craft.unlimited":"制作 {0} 不受限制",delete:"删除","dispose.necrocorn":"小猫处理掉了影响效率的多余死灵兽","festival.extend":"小猫延长了节日","festival.hold":"小猫开始举办节日","filter.accelerate":"时间加速","filter.adore":"赞美群星","filter.allKG":"所有游戏日志","filter.build":"建筑","filter.craft":"工艺","filter.disable":"过滤 {0} 日志消息","filter.distribute":"猫口分配","filter.enable":"启用 {0} 日志消息","filter.explainer":"已禁用的项目不会显示在日志中。","filter.faith":"太阳秩序","filter.festival":"节日","filter.hunt":"狩猎","filter.misc":"杂项","filter.praise":"赞美太阳","filter.promote":"提拔领袖","filter.research":"研究","filter.star":"天文事件","filter.timeSkip":"时间跳转","filter.trade":"贸易","filter.transcend":"超越","filter.upgrade":"升级","option.accelerate":"时间加速","option.autofeed":"献祭上古神","option.catnip":"采集猫薄荷","option.crypto":"黑币交易","option.elect":"选择领导人","option.elect.job":"工作","option.elect.job.any":"任何","option.elect.trait":"特质","option.embassies":"建造大使馆","option.faith.adore":"赞美群星","option.faith.autoPraise":"赞美太阳","option.faith.best.unicorn":"优先最佳独角兽建筑","option.faith.refineTears":"提炼眼泪","option.faith.refineTimeCrystals":"精炼时间水晶","option.faith.sacrificeAlicorns":"献祭天角兽","option.faith.sacrificeUnicorns":"献祭独角兽","option.faith.transcend":"自动超越","option.festival":"举办节日","option.fix.cry":"修复冷冻仓","option.hunt":"狩猎","option.magnetos":"开启磁电机","option.observe":"观测天文事件","option.praise":"赞美太阳","option.promote":"提拔领袖","option.promotekittens":"提拔小猫","option.reactors":"开启反应堆","option.shipOverride":"强制243船","option.steamworks":"启动蒸汽工房","option.time.activeHeatTransfer":"主动散热","option.time.reset":"重启时间线 (危险!)","option.time.skip":"时间跳转","option.time.skip.ignoreOverheat":"忽略过热",reset:"重置","reset.after":"初次见面,可爱的猫猫科学家为您服务","reset.cancel.activity":"喵斯顿,我们有麻烦了","reset.cancel.message":"重启时间线计划取消","reset.check":"{0} 的触发值: {1}, 现在共有 {2}","reset.checked":"所有条件都已满足,时间线将在几秒后重启!","reset.countdown.0":"&nbsp;0 - 时空裂缝已打开!","reset.countdown.1":"&nbsp;1 - 时间引擎已启动!","reset.countdown.2":"&nbsp;2 - 正在启动时间锻造","reset.countdown.3":"&nbsp;3 - 正在打开时空裂隙","reset.countdown.4":"&nbsp;4 - 正在关闭卫星","reset.countdown.5":"&nbsp;5 - 正在融化黑币","reset.countdown.6":"&nbsp;6 - 正在启动时间引擎","reset.countdown.7":"&nbsp;7 - 正在拆解电磁炮","reset.countdown.8":"&nbsp;8 - 正在放生蜥蜴","reset.countdown.9":"&nbsp;9 - 正在献祭独角兽","reset.countdown.10":"&nbsp;10 - 正在收获猫薄荷","reset.last.message":"我们下个庞加莱回归再见","reset.tip":"您可以通过在设置顶部禁用“启用小猫珂学家”选项来取消此重置。","resources.consume":"消耗率: {0}","resources.consume.prompt":"输入您希望自动化消耗的资源量,以 0.0 到 100.0 之间的百分比表示。","resources.consume.promptExplainer":"如果您提交一个空值或者一个无效值,则被视为您点击了取消。","resources.consume.promptTitle":"{0} 的消耗份额 (当前:{1})","resources.consume.set":"设置 {0} 的消耗率","resources.consume.title":"消耗 {0} 的 {1}","resources.consume.titleZero":"不消耗 {0}","resources.stock.prompt":"输入您希望始终保留的资源库存量。","resources.stock.promptExplainer":"游戏支持的所有符号均可接受。如果您提交空值或负值,限制将设置为无穷大。如果您将限制设置为 0,此选项将自动禁用。如果您提交无效值,将被视为您点击了“取消”。","resources.stock.promptTitle":"{0} 的库存值 (当前:{1})","resources.stock.title":"保持 {0} {1} 库存","resources.stock.titleInfinite":"保持所有 {0} 库存","resources.stock.titleZero":"不保留任何 {0} 库存","state.compress":"压缩数据","state.confirmDestruction":"你确定吗?","state.copied.game":"保存“{0}”复制到剪贴板。","state.copied.gameCurrent":"当前保存已复制到剪贴板。","state.copied.state":"状态“{0}”已复制到剪贴板。","state.copied.stateCurrent":"当前状态已复制到剪贴板。","state.copy.game":"将此保存复制到剪贴板。","state.copy.gameCurrent":"将整个小猫游戏保存 (包括 KS 设置) 复制到剪贴板。","state.copy.state":"将这些设置复制到剪贴板。","state.copy.stateCurrent":"将当前的 Kitten Scientists 设置复制到剪贴板。","state.delete.game":"删除此保存。","state.delete.state":"删除这些设置。","state.deleted.game":"保存“{0}”已删除。","state.deleted.state":"状态“{0}”已删除。","state.edit.game":"更改此保存的名称。","state.edit.state":"更改这些设置的名称。","state.exportAll":"备份","state.exportAllTitle":"将所有本地状态存储在单个文件中并下载。","state.import":"从剪贴板导入","state.imported.game":"保存导入。","state.imported.state":"状态导入。","state.importedState":"Imported state {0}","state.importTitle":`从剪贴板粘贴保存或设置。\n内容将被自动检测并进行相应处理。`,"state.loaded.game":"已加载保存“{0}”。","state.loaded.state":"已加载状态“{0}”。","state.loadPrompt":"在此处粘贴您的 (未压缩的) 保存或设置:","state.local":"本地状态","state.localGames":"小猫游戏保存","state.localStates":"小猫科学家设置","state.new":"新的","state.noConfirm":"不要求确认","state.store":"储存","state.stored.game":"保存储存。","state.stored.state":"状态储存。","state.storeFactory":"根据出厂默认设置创建新状态。","state.storeGame":"从当前游戏中创建一个新的保存。","state.storeGame.prompt":"为此次保存提供标签:","state.storeState":"根据当前设置创建一个新状态。","state.storeState.prompt":"为该状态提供标签:","state.title":"状态管理器","state.unlabeledGame":"未标记的保存","state.unlabeledState":"未标记状态","state.update.game":"将当前游戏保存到此位置。","state.update.state":"将当前设置保存到此槽中。","state.updated.game":"保存\'{0}\'已更新。","state.updated.state":"状态“{0}”已更新。","status.auto.disable":"禁用自动化 {0}","status.auto.enable":"启用自动化 {0}","status.ks.disable":"太敬业了,该歇了","status.ks.enable":"神说,要有猫猫珂学家!","status.ks.init":"小猫珂学家已初始化。","status.ks.upgrade":"小猫珂学家 (当前版本:{1}) {0} 可在这里获取:{2} 。","status.reset.check.disable":"在重启时间线前不检查 {0}","status.reset.check.enable":"在重启时间线前检查 {0}","status.resource.disable":"禁用 {0} 资源管理","status.resource.enable":"启用 {0} 资源管理","status.sub.disable":"禁用 {0}","status.sub.enable":"启用 {0}","summary.accelerate":"加速时间 {0} 次","summary.adore":"通过赞美群星积累了 {0} 顿悟","summary.building":"建造了 {0} 个 {1}","summary.craft":"制作了 {0} 个 {1}","summary.day":"天","summary.days":"天","summary.distribute":"帮助 {0} 只猫猫找到工作","summary.embassy":"设立了 {0} 个大使馆","summary.feed":"向上古神献祭 {0} 只死灵兽","summary.festival":"举办了 {0} 次节日","summary.fix.cry":"修复了 {0} 个冷冻仓","summary.head":"过去 {0} 的总结","summary.hunt":"派出了 {0} 批可爱的小猫猎人","summary.praise":"通过赞美太阳积累了 {0} 虔诚","summary.promote":"提拔领袖 {0} 次","summary.refine":"已精炼 {0} {1}","summary.separator":" ","summary.show":"总结","summary.stars":"观测了 {0} 颗流星","summary.sun":"在 {1} 方面顿悟 {0} 次","summary.tech":"掌握了 {0}","summary.time.activeHeatTransferStart":"主动散热 {0} 次","summary.time.getTemporalFlux":"烧水晶获取时间通量 {0} 次","summary.time.reset.content":"获得 {0} 业.<br>获得 {1} 领导力","summary.time.reset.title":"过去 {0} 个时间线的总结","summary.time.skip":"跳过 {0} 年","summary.trade":"与 {1} 贸易了 {0} 次","summary.transcend":"超越了 {0} 次","summary.upgrade":"发明了 {0}","summary.year":"年","summary.years":"年","time.heatTransfer.cycle.disable":"停止在 {0} 主动散热","time.heatTransfer.cycle.enable":"启用在 {0} 主动散热","time.skip.cycle.disable":"停止在 {0} 跳转时间并禁止跳过该周期","time.skip.cycle.enable":"启用在 {0} 跳转时间并允许跳过该周期","time.skip.season.disable":"停止在 {0} 跳转时间","time.skip.season.enable":"启用在 {0} 跳转时间","trade.limited":"与 {0} 的交易限制为比产量更优时才会触发","trade.season.disable":"停止在 {1} 与 {0} 的交易","trade.season.enable":"启用在 {1} 与 {0} 的交易","trade.seasons":"季节","trade.unlimited":"取消与 {0} 交易的限制","ui.additional":"附加选项","ui.build":"营火","ui.close":"关闭","ui.craft":"工艺","ui.craft.resources":"资源","ui.cycles":"周期","ui.disable.all":"全部禁用","ui.distribute":"猫力资源","ui.enable.all":"全部启用","ui.engine":"启用小猫珂学家","ui.faith":"宗教","ui.filter":"日志过滤","ui.infinity":"∞","ui.internals":"小喵设置","ui.internals.interval":"运行间隔(ms): {0}","ui.internals.interval.prompt":"输入新的毫秒数作为 0 到无穷大之间的绝对值。","ui.internals.interval.promptExplainer":"游戏支持的所有符号均可接受。如果您将限制设置为 0,Kitten Scientists 将自动禁用。如果您提交了无效值,则将被视为您点击了“取消”。","ui.internals.interval.promptTitle":"小猫科学家执行间隔 (当前:{0})","ui.itemsHide":"隐藏选项","ui.itemsShow":"显示选项","ui.ksColumn":"显示在第四栏","ui.language":"语言","ui.limit":"限制","ui.limited.off":"无限","ui.limited.on":"环保模式","ui.max":"最大值:{0}","ui.max.build.prompt":"{0} 的限制 (当前:{1})","ui.max.build.promptExplainer":"游戏支持的所有符号均可接受。如果您提交空值或负值,限制将设置为无穷大。如果您将限制设置为 0,此选项将自动禁用。如果您提交无效值,将被视为您点击了“取消”。","ui.max.build.title":"构建 {0} {1}","ui.max.build.titleInfinite":"永不停止建设{0}","ui.max.build.titleZero":"不要构建{0}","ui.max.craft.prompt":"输入要制作的 {0} 数量的新限制,以 0 到无穷大之间的绝对值表示。","ui.max.craft.promptExplainer":"游戏支持的所有符号均可接受。如果您提交空值或负值,限制将设置为无穷大。如果您将限制设置为 0,此选项将自动禁用。如果您提交无效值,将被视为您点击了“取消”。","ui.max.craft.promptTitle":"制作限制 {0} (当前:{1})","ui.max.craft.title":"制造 {0} {1}","ui.max.craft.titleInfinite":"永不停止创造{0}","ui.max.craft.titleZero":"不要制造 {0}","ui.max.distribute.prompt":"输入要分配的新小猫数量 {0},作为 0 到无穷大之间的绝对值。","ui.max.distribute.promptExplainer":"游戏支持的所有符号均可接受。如果您提交空值或负值,限制将设置为无穷大。如果您将限制设置为 0,此选项将自动禁用。如果您提交无效值,将被视为您点击了“取消”。","ui.max.distribute.promptTitle":"将最大小猫数量指定为 {0} (当前:{1})","ui.max.distribute.title":"将 {0} 只小猫指定为 {1}","ui.max.distribute.titleInfinite":"分配尽可能多的小猫作为{0}","ui.max.distribute.titleZero":"不将任何小猫指定为{0}","ui.max.embassy.title":"为{1}建造{0}大使馆","ui.max.embassy.titleInfinite":"永不停止为{0}修建大使馆","ui.max.embassy.titleZero":"不要为{0}建造大使馆","ui.max.prompt.absolute":"输入新的限制作为 0 到无穷大之间的绝对值。","ui.max.prompt.float":"输入新的限制作为 0.0 和无穷大之间的绝对值。","ui.max.set":"设置 {0} 的最大值","ui.max.timeSkip.prompt":"输入新的年数作为 0 至无穷大之间的绝对值。","ui.max.timeSkip.promptExplainer":"游戏支持的所有符号均可接受。如果您提交空值或负值,限制将设置为无穷大。如果您将限制设置为 0,此选项将自动禁用。如果您提交无效值,将被视为您点击了“取消”。","ui.max.timeSkip.promptTitle":"最多跳过年份 (当前:{0})","ui.max.timeSkip.title":"一次跳过 {0} 年","ui.max.timeSkip.titleInfinite":"跳过尽可能多的年份","ui.max.timeSkip.titleZero":"不要跳过时间","ui.maximum":"上限","ui.min":"最小值 {0}","ui.options":"选项","ui.reset":"恢复至默认","ui.resources":"资源控制","ui.space":"太空","ui.time":"时间","ui.timeCtrl":"时间操纵","ui.trade":"贸易","ui.trigger":"触发值:{0}","ui.trigger.accelerateTime.prompt":"输入启用 Tempus Fugit 的新时间通量存储级别,以 0.0 至 100.0 之间的百分比表示。","ui.trigger.accelerateTime.promptExplainer":"如果您提交一个空值或者一个无效值,则被视为您点击了取消。","ui.trigger.accelerateTime.promptTitle":"加速时间的触发值 (当前:{0})","ui.trigger.activeHeatTransfer.prompt":"输入新的启用热传递的时间热存储量,以 0.0 到 100.0 之间的百分比表示。","ui.trigger.activeHeatTransfer.promptExplainer":"如果您提交一个空值或者一个无效值,则被视为您点击了取消。","ui.trigger.activeHeatTransfer.promptTitle":"热传递触发值 (当前:{0})","ui.trigger.build.blocked":`∞\n🛈 {0} 部分未设置触发值。此构建不会被触发!`,"ui.trigger.build.inherited":"继承自部分","ui.trigger.build.prompt":"{0} 的触发值 (当前:{1})","ui.trigger.build.promptExplainer":"如果您提交了空值或负值,则将使用部分触发值。如果您提交了无效值,则将被视为您点击了“取消”。","ui.trigger.crypto.prompt":"输入交易黑币的新文物存储级别,以 0.0 到 Infinity 之间的绝对值表示。","ui.trigger.crypto.promptExplainer":"如果您提交一个空值或者一个无效值,则被视为您点击了取消。","ui.trigger.crypto.promptTitle":"触发黑币交易 (当前:{0})","ui.trigger.embassies.prompt":"以 0.0 至 100.0 之间的百分比输入建造大使馆的新文化存储级别。","ui.trigger.embassies.promptExplainer":"如果您提交一个空值或者一个无效值,则被视为您点击了取消。","ui.trigger.embassies.promptTitle":"建立大使馆的触发值 (当前:{0})","ui.trigger.hunt.prompt":"狩猎触发值 (当前:{0})","ui.trigger.hunt.promptExplainer":"如果您提交了负值,则搜索将被禁用。如果您提交了空值或无效值,则将被视为您点击了“取消”。","ui.trigger.inactive":"不活跃","ui.trigger.promoteKittens.prompt":"输入新的可用于升级小猫的黄金库存量,以 0.0 到 100.0 之间的百分比表示。","ui.trigger.promoteKittens.promptExplainer":"如果您提交一个空值或者一个无效值,则被视为您点击了取消。","ui.trigger.promoteKittens.promptTitle":"小猫促销触发值 (当前:{0})","ui.trigger.prompt.absolute":"输入新的触发值作为 0 到无穷大之间的绝对值。","ui.trigger.prompt.float":"输入新的触发值作为 0.0 到无穷大之间的绝对值。","ui.trigger.prompt.percentage":"以 0.0 至 100.0 之间的百分比形式输入新的触发值。","ui.trigger.reset.promptExplainer":"如果您提交了负值,则该项目将被禁用。如果您提交了空值或无效值,则将被视为您点击了“取消”。","ui.trigger.section":"部分默认触发值:{0}","ui.trigger.section.blocked":`∞\n🛈 The {0} section has no trigger set. This automation will not be triggered!`,"ui.trigger.section.inactive":"∞ (nothing is triggered automatically)","ui.trigger.section.inherited":"继承自部分","ui.trigger.section.prompt":"{0} 部分的触发值 (当前:{1})","ui.trigger.section.promptExplainer":`If you submit an empty value, or a negative value, the section trigger will be set to infinity (∞). Individual automations in this section need to have their own trigger set to be activated.\nIf you submit an invalid value, it will be treated as if you hit Cancel.`,"ui.trigger.setinteger":"输入 {0} 的新触发值。范围应在 0 到任意数字之间。-1表示无穷大。","ui.trigger.setinteger.promptExplainer":"如果您提交一个空值或者一个无效值,则被视为您点击了取消。","ui.trigger.setpercentage":"输入新的 {0} 触发值,取值范围为 0 到 100 的小数。","ui.trigger.setpercentage.promptExplainer":"如果您提交一个空值或者一个无效值,则被视为您点击了取消。","ui.trigger.timeSkip.prompt":"输入跳过时间所需的时间水晶的新数量,以 1 到无穷大之间的绝对值表示。","ui.trigger.timeSkip.promptExplainer":"如果您提交了负值,时间跳过将被禁用。如果您提交了空值或无效值,它将被视为您点击了“取消”。","ui.trigger.timeSkip.promptTitle":"时间跳跃触发值 (当前:{0})","ui.upgrade":"升级","ui.upgrade.buildings":"升级建筑","ui.upgrade.missions":"探索星球","ui.upgrade.policies":"政策","ui.upgrade.races":"探险队出发!","ui.upgrade.techs":"科技","ui.upgrade.upgrades":"升级","ui.upgrades":"升级",update:"更新","upgrade.building.amphitheatre":"剧场 升级为 广播塔!","upgrade.building.aqueduct":"水渠 升级为 水电站!","upgrade.building.library":"图书馆 升级为 数据中心!","upgrade.building.pasture":"牧场 升级为 太阳能发电站!","upgrade.building.warehouse":"已将仓库升级为太空港!","upgrade.policy":"小猫通过了 {0} 法案","upgrade.race":"小猫遇到了 {0}","upgrade.space":"小猫执行了 {0}","upgrade.space.mission":"小猫执行了 {0} 的任务","upgrade.tech":"小猫掌握了 {0}","upgrade.upgrade":"小猫发明了 {0}"};class Ct extends _t{constructor(e,t,i=!1){super(i);I(this,Fe);I(this,He);L(this,Fe,e),L(this,He,t)}get building(){return P(this,Fe)}get variant(){return P(this,He)}}Fe=new WeakMap,He=new WeakMap;class Yt extends K{constructor(e=!1,t=-1,i=new _,n=new re(!1,-1),a=new re(!1,-1),r=new re(!1,-1),o=new re(!1,-1),l=new K(!1,1),h=new K(!1,1),d=new _){super(e,t);u(this,"buildings");u(this,"bestUnicornBuilding");u(this,"bestUnicornBuildingCurrent");u(this,"sacrificeAlicorns");u(this,"sacrificeUnicorns");u(this,"refineTears");u(this,"refineTimeCrystals");u(this,"autoPraise");u(this,"adore");u(this,"transcend");this.buildings=this.initBuildings(),this.bestUnicornBuilding=i,this.sacrificeAlicorns=n,this.sacrificeUnicorns=a,this.refineTears=r,this.refineTimeCrystals=o,this.autoPraise=l,this.adore=h,this.transcend=d,this.bestUnicornBuildingCurrent=null}initBuildings(){const e={};for(const t of Zi)e[t]=new Ct(t,H.OrderOfTheSun);for(const t of Ki)e[t]=new Ct(t,H.Cryptotheology);for(const t of Vi)e[t]=new Ct(t,H.Ziggurat);return e.unicornPasture=new Ct("unicornPasture",H.UnicornPasture),e}load(e){m(e)||(super.load(e),z(this.buildings,e.buildings,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.max=(i==null?void 0:i.max)??t.max,t.trigger=(i==null?void 0:i.trigger)??t.trigger}),this.bestUnicornBuilding.load(e.bestUnicornBuilding),this.sacrificeAlicorns.load(e.sacrificeAlicorns),this.sacrificeUnicorns.load(e.sacrificeUnicorns),this.refineTears.load(e.refineTears),this.refineTimeCrystals.load(e.refineTimeCrystals),this.autoPraise.load(e.autoPraise),this.adore.load(e.adore),this.transcend.load(e.transcend),this.bestUnicornBuildingCurrent=e.bestUnicornBuildingCurrent??this.bestUnicornBuildingCurrent)}}class un{constructor(s,e,t,i=new Yt){u(this,"_host");u(this,"settings");u(this,"manager");u(this,"_bulkManager");u(this,"_bonfireManager");u(this,"_workshopManager");this._host=s,this.settings=i,this.manager=new me(this._host,"Religion"),this._workshopManager=t,this._bulkManager=new wt(this._host,this._workshopManager),this._bonfireManager=e}async tick(s){this.settings.enabled&&(this.manager.render(),this._autoBuild(s),this.settings.sacrificeUnicorns.enabled&&await this._autoSacrificeUnicorns(),this.settings.sacrificeAlicorns.enabled&&await this._autoSacrificeAlicorns(s),this.settings.refineTears.enabled&&this._autoTears(s),this.settings.refineTimeCrystals.enabled&&await this._autoTCs(s),this._autoTAP())}_autoBuild(s){if(this.settings.bestUnicornBuilding.enabled)this._buildBestUnicornBuilding(),this._buildNonUnicornBuildings(s);else{const e=Object.fromEntries(Object.entries(this.settings.buildings).filter(([,n])=>n.variant!==H.UnicornPasture)),t=Y(this.settings.buildings.unicornPasture.max),i=this._host.game.bld.getBuildingExt("unicornPasture").meta;this.settings.buildings.unicornPasture.enabled&&i.val<t&&this._bonfireManager.autoBuild(s,{unicornPasture:new Jt("unicornPasture",this.settings.buildings.unicornPasture.enabled,this.settings.buildings.unicornPasture.trigger,this.settings.buildings.unicornPasture.max)}),this._buildReligionBuildings(s,e)}}_buildBestUnicornBuilding(){var t,i;const s=this.getBestUnicornBuilding();if(this.settings.bestUnicornBuildingCurrent!==s&&(this.settings.bestUnicornBuildingCurrent=s,this._host.refreshEntireUserInterface()),this.settings.bestUnicornBuildingCurrent===null)return;const e=this.settings.trigger;if(this.settings.bestUnicornBuildingCurrent==="unicornPasture")this._bonfireManager.build(this.settings.bestUnicornBuildingCurrent,0,1);else{const n=this._getBuildButton(this.settings.bestUnicornBuildingCurrent,H.Ziggurat);if(m(n==null?void 0:n.model))return;let a=0;const r=p(n.model.prices).find(d=>d.name==="tears");m(r)||(a=r.val);const o=this._workshopManager.getValue("tears")-this._workshopManager.getStock("tears");if(!m(this._host.game.religionTab.sacrificeBtn)&&o<a){const d=Math.floor((this._workshopManager.getValue("unicorns")-this._workshopManager.getStock("unicorns"))/2500),g=Math.ceil((a-o)/this._host.game.bld.getBuildingExt("ziggurat").meta.on);if(g<d&&!m(this._host.game.religionTab.sacrificeBtn.model))(i=(t=this._host.game.religionTab.sacrificeBtn)==null?void 0:t.controller)==null||i._transform(this._host.game.religionTab.sacrificeBtn.model,g);else return}const l={[this.settings.bestUnicornBuildingCurrent]:this.settings.buildings[this.settings.bestUnicornBuildingCurrent]},h=this._bulkManager.bulk(l,this.getBuildMetaData(l),e,"Religion");0<h.length&&0<h[0].count&&this.build(this.settings.bestUnicornBuildingCurrent,H.Ziggurat,1)}}_buildNonUnicornBuildings(s){const e=[...kt],t=Object.fromEntries(Object.entries(this.settings.buildings).filter(([,i])=>!e.includes(i.building)));this._buildReligionBuildings(s,t)}_buildReligionBuildings(s,e){this.manager.render();const t=this.getBuildMetaData(e),i=this.settings.trigger,n=this._bulkManager.bulk(e,t,i,"Religion");for(const a of n)0<a.count&&(this.build(a.id,p(a.variant),a.count),s.requestGameUiRefresh=!0)}getBestUnicornBuilding(){var ce,pe;const s=this._bonfireManager.getBuildButton("unicornPasture");if(s===null)return null;const e=[...kt].filter(ee=>ee!=="unicornPasture"),t=this._host.game.getEffect("unicornsPerTickBase")*this._host.game.getTicksPerSecondUI(),i=this._host.game.getEffect("unicornsGlobalRatio")+1,n=this._host.game.getEffect("unicornsRatioReligion")+1,a=this._host.game.prestige.getParagonProductionRatio()+1,r=this._host.game.religion.getSolarRevolutionRatio()+1,o=this._host.game.calendar.cycle,l=this._host.game.calendar.cycles[o];let h=1;l.festivalEffects.unicorns!==void 0&&this._host.game.prestige.getPerk("numeromancy").researched&&this._host.game.calendar.festivalDays&&(h=l.festivalEffects.unicorns);const d=t*i*n*a*r*h,g=Math.max(this._host.game.bld.getBuildingExt("ziggurat").meta.on,1),f=500*(1+this._host.game.getEffect("unicornsRatioReligion")*.1);let w=1;this._host.game.prestige.getPerk("unicornmancy").researched&&(w*=1.1);const b=this._host.game.getEffect("riftChance")*w/(1e4*2)*f;let k=Number.POSITIVE_INFINITY,y=null;const V=p((ce=this._host.game.bld.getBuildingExt("unicornPasture").meta.effects)==null?void 0:ce.unicornsPerTickBase)*this._host.game.getTicksPerSecondUI()*i*n*a*r*h,Q=p((pe=s.model)==null?void 0:pe.prices)[0].val/V;Q<k&&(k=Q,y="unicornPasture");for(const ee of this.manager.tab.zgUpgradeButtons)if(e.includes(ee.id)&&ee.model.visible){let ve=0;for(const Se of p(ee.model.prices))Se.name==="unicorns"&&(ve+=Se.val),Se.name==="tears"&&(ve+=Se.val*2500/g);const mt=p(this._host.game.religion.getZU(ee.id));let Me=n,Ps=this._host.game.getEffect("riftChance");for(const Se in mt.effects)Se==="unicornsRatioReligion"&&(Me+=p(mt.effects.unicornsRatioReligion)),Se==="riftChance"&&(Ps+=p(mt.effects.riftChance));const Vo=500*((Me-1)*.1+1);let Bi=Ps*w/(1e4*2)*Vo;Bi-=b;let Ai=t*i*Me*a*r*h;Ai-=d,Ai+=Bi;const Is=ve/Ai;Is<k&&(0<Bi||n<Me&&0<ve)&&(k=Is,y=ee.id)}return y}build(s,e,t){let i=t;const n=i;let a;if(e===H.Cryptotheology){const r=game.getUnlockByName(s,"transcendenceUpgrades"),o=new classes.ui.TranscendenceBtnController(this._host.game),l=o.fetchModel({controller:o,id:r.name});i=this._bulkManager.construct(l,o,i),a=r.label}else if(e===H.OrderOfTheSun){const r=game.getUnlockByName(s,"religion"),o=new com.nuclearunicorn.game.ui.ReligionBtnController(this._host.game),l=o.fetchModel({controller:o,id:r.name});i=this._bulkManager.construct(l,o,i),a=r.label}else if(e===H.Ziggurat){const r=game.getUnlockByName(s,"zigguratUpgrades"),o=new com.nuclearunicorn.game.ui.ZigguratBtnController(this._host.game),l=o.fetchModel({controller:o,id:r.name});i=this._bulkManager.construct(l,o,i),a=r.label}else throw new bt("unsupported");i!==n&&(console.warn(...v(`${a} Amount ordered: ${n} Amount Constructed: ${i}`)),i===0)||(e===H.OrderOfTheSun?(this._host.engine.storeForSummary(a,i,"faith"),i===1?this._host.engine.iactivity("act.sun.discover",[a],"ks-faith"):this._host.engine.iactivity("act.sun.discovers",[a,this._host.renderAbsolute(i)],"ks-faith")):(this._host.engine.storeForSummary(a,i,"build"),i===1?this._host.engine.iactivity("act.build",[a],"ks-build"):this._host.engine.iactivity("act.builds",[a,this._host.renderAbsolute(i)],"ks-build")))}getBuildMetaData(s){const e={};for(const t of Object.values(s)){const i=this.getBuild(t.building,t.variant);if(i===null)continue;e[t.building]=i;const n=p(e[t.building]);if(!this._getBuildButton(t.building,t.variant))n.rHidden=!0;else{const a=p(this._getBuildButton(t.building,t.variant)).model,r=t.variant===H.Cryptotheology?this._host.game.science.get("cryptotheology").researched:!0;n.rHidden=!(a!=null&&a.visible&&a.enabled&&r)}}return e}getBuild(s,e){switch(e){case H.Ziggurat:return this._host.game.religion.getZU(s)??null;case H.OrderOfTheSun:return this._host.game.religion.getRU(s)??null;case H.Cryptotheology:return this._host.game.religion.getTU(s)??null}throw new Error(`Unknown build: ${s} (${e})`)}_getBuildButton(s,e){let t;switch(e){case H.Ziggurat:t=this.manager.tab.zgUpgradeButtons;break;case H.OrderOfTheSun:t=this.manager.tab.rUpgradeButtons;break;case H.Cryptotheology:t=this.manager.tab.children[0].children[0].children;break;default:throw new Error(`Invalid variant \'${e}\'`)}if(t.length===0)return null;const i=t.find(n=>n.id===s)??null;return i===null&&console.debug(...v(`Couldn\'t find button for ${s}! This will likely create problems.`)),i}_transformBtnSacrificeHelper(s,e,t,i){const a=1/(s/e),o=new classes.ui.religion.TransformBtnController(game,t.controllerOpts)._newLink(i,a);return new Promise(l=>{o.handler(new Event("decoy"),l)})}async _autoSacrificeUnicorns(){const s=this._workshopManager.getResource("unicorns"),e=this._workshopManager.getValueAvailable("unicorns");if(!m(this._host.game.religionTab.sacrificeBtn)&&Y(this.settings.sacrificeUnicorns.trigger)<=e&&Y(this.settings.sacrificeUnicorns.trigger)<=s.value){const t=this._host.game.religionTab.sacrificeBtn.controller,i=this._host.game.religionTab.sacrificeBtn.model;if(m(i))return;await this._transformBtnSacrificeHelper(e,s.value,t,i);const n=this._workshopManager.getValueAvailable("unicorns"),a=e-n;this._host.engine.iactivity("act.sacrificeUnicorns",[this._host.game.getDisplayValueExt(a)],"ks-faith"),this._host.engine.storeForSummary(this._host.engine.i18n("$resources.unicorns.title"),a,"refine")}}async _autoSacrificeAlicorns(s){const e=this._workshopManager.getResource("alicorn"),t=this._workshopManager.getValueAvailable("alicorn");if(!m(this._host.game.religionTab.sacrificeAlicornsBtn)&&Y(this.settings.sacrificeAlicorns.trigger)<=t&&Y(this.settings.sacrificeAlicorns.trigger)<=e.value){this._host.game.religionTab.sacrificeAlicornsBtn.render();const i=this._host.game.religionTab.sacrificeAlicornsBtn.controller,n=this._host.game.religionTab.sacrificeAlicornsBtn.model;if(m(n)){s.requestGameUiRefresh=!0;return}await this._transformBtnSacrificeHelper(t,e.value,i,n);const a=this._workshopManager.getValueAvailable("alicorn"),r=t-a;this._host.engine.iactivity("act.sacrificeAlicorns",[this._host.game.getDisplayValueExt(r)],"ks-faith"),this._host.engine.storeForSummary(this._host.engine.i18n("$resources.alicorn.title"),r,"refine")}}_autoTears(s){const e=this._workshopManager.getResource("tears"),t=this._workshopManager.getValueAvailable("tears"),i=this._workshopManager.getResource("sorrow");if(!m(this._host.game.religionTab.refineBtn)&&Y(this.settings.refineTears.trigger)<=t&&Y(this.settings.refineTears.trigger)<=e.value&&i.value<i.maxValue){const n=t-this.settings.refineTears.trigger;if(n<1e4)return;const a=this._host.game.religionTab.refineBtn.controller,r=this._host.game.religionTab.refineBtn.model;if(m(r)){s.requestGameUiRefresh=!0;return}a.buyItem(r,new Event("decoy"),n);const o=this._workshopManager.getValueAvailable("tears"),l=t-o;this._host.engine.iactivity("act.refineTears",[this._host.game.getDisplayValueExt(l)],"ks-faith"),this._host.engine.storeForSummary(this._host.engine.i18n("$resources.tears.title"),l,"refine")}}async _autoTCs(s){const e=this._workshopManager.getResource("timeCrystal"),t=this._workshopManager.getValueAvailable("timeCrystal");if(!m(this._host.game.religionTab.refineTCBtn)&&Y(this.settings.refineTimeCrystals.trigger)<=t&&Y(this.settings.refineTimeCrystals.trigger)<=e.value){const i=this._host.game.religionTab.refineTCBtn.controller,n=this._host.game.religionTab.refineTCBtn.model;if(m(n)){s.requestGameUiRefresh=!0;return}await this._transformBtnSacrificeHelper(t,e.value,i,n);const a=this._workshopManager.getValueAvailable("timeCrystal"),r=t-a;this._host.engine.iactivity("act.refineTCs",[this._host.game.getDisplayValueExt(r)],"ks-faith"),this._host.engine.storeForSummary(this._host.engine.i18n("$resources.timeCrystal.title"),r,"refine")}}_autoTAP(){const s=this._workshopManager.getResource("faith"),e=s.value/s.maxValue;this.settings.transcend.enabled&&this.settings.autoPraise.trigger-.02<=e&&this._autoTranscend(),this.settings.autoPraise.trigger<=e&&(this.settings.adore.enabled&&p(this._host.game.religion.getRU("apocripha")).on&&this._autoAdore(this.settings.adore.trigger),this.settings.autoPraise.enabled&&this._autoPraise())}_autoAdore(s){const e=this._workshopManager.getResource("faith"),t=this._host.game.religion.faith,i=this._host.game.religion.faithRatio,a=p(this._host.game.religion.getRU("transcendence")).on?this._host.game.religion.transcendenceTier:0,r=10+this._host.game.getEffect("solarRevolutionLimit"),o=r*s,l=t/1e6*a*a*1.01,h=i+l,d=.01+e.value*(1+this._host.game.getUnlimitedDR(h,.1)*.1),g=this._host.game.getLimitedDR(this._host.game.getUnlimitedDR(d,1e3)/100,r);o<=g&&(this._host.game.religion._resetFaithInternal(1.01),this._host.engine.iactivity("act.adore",[this._host.game.getDisplayValueExt(t),this._host.game.getDisplayValueExt(l)],"ks-adore"),this._host.engine.storeForSummary("adore",l))}_autoTranscend(){var i,n;let s=this._host.game.religion.faithRatio;const e=p(this._host.game.religion.getRU("transcendence")).on;let t=e?this._host.game.religion.transcendenceTier:0;if(e){const a=((t+2)/(t+1))**2,r=this._host.game.religion._getTranscendTotalPrice(t+1)-this._host.game.religion._getTranscendTotalPrice(t),o=r,l=a;if((1-l+Math.sqrt(80*(l*l-1)*o+(l-1)*(l-1)))*l/(40*(l+1)*(l+1)*(l-1))+o+o/(l*l-1)<=s){this._host.game.religion.faithRatio-=r,this._host.game.religion.tcratio+=r,this._host.game.religion.transcendenceTier+=1;const d=p(this._host.game.challenges.getChallenge("atheism"));(i=d.calculateEffects)==null||i.call(d,d,this._host.game);const g=p(this._host.game.religion.getTU("blackObelisk"));(n=g.calculateEffects)==null||n.call(g,g,this._host.game),this._host.game.msg(this._host.engine.i18n("$religion.transcend.msg.success",[this._host.game.religion.transcendenceTier])),s=this._host.game.religion.faithRatio,t=this._host.game.religion.transcendenceTier,this._host.engine.iactivity("act.transcend",[this._host.game.getDisplayValueExt(r),t],"ks-transcend"),this._host.engine.storeForSummary("transcend",1)}}}_autoPraise(){const s=this._workshopManager.getResource("faith"),e=this._host.game.religion.getApocryphaBonus(),t=s.value*(1+e);this._host.engine.storeForSummary("praise",t),this._host.engine.iactivity("act.praise",[this._host.game.getDisplayValueExt(s.value),this._host.game.getDisplayValueExt(t)],"ks-praise"),this._host.game.religion.praise()}}class dn extends _{constructor(e,t=!1){super(t);I(this,We);L(this,We,e)}get policy(){return P(this,We)}}We=new WeakMap;class ss extends _{constructor(e=!1){super(e);u(this,"policies");this.policies=this.initPolicies()}initPolicies(){const e={};for(const t of Ks)e[t]=new dn(t);return e}static validateGame(e,t){const i=Object.keys(t.policies),n=e.science.policies.map(o=>o.name),a=ae(n,i),r=ae(i,n);for(const o of a)console.warn(...v(`The policy \'${o}\' is not tracked in Kitten Scientists!`));for(const o of r)console.warn(...v(`The policy \'${o}\' is not a policy in Kittens Game!`))}load(e){m(e)||(super.load(e),z(this.policies,e.policies,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled}))}}class gn extends K{constructor(e,t=!1){super(t,-1);I(this,Ge);L(this,Ge,e)}get tech(){return P(this,Ge)}}Ge=new WeakMap;class ns extends K{constructor(e=!1){super(e,-1);u(this,"techs");this.techs=this.initTechs()}initTechs(){const e={};for(const t of Vs)e[t]=new gn(t);return e}static validateGame(e,t){const i=Object.keys(t.techs),n=e.science.techs.map(o=>o.name),a=ae(n,i),r=ae(i,n);for(const o of a)Ji.includes(o)||console.warn(...v(`The technology \'${o}\' is not tracked in Kitten Scientists!`));for(const o of r){if(Ji.includes(o)){console.info(...v(`The technology \'${o}\' is a technology in Kittens Game, but it\'s no longer used.`));continue}console.warn(...v(`The technology \'${o}\' is not a technology in Kittens Game!`))}}load(e){m(e)||(super.load(e),z(this.techs,e.techs,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.trigger=(i==null?void 0:i.trigger)??t.trigger}))}}class Qt extends _{constructor(e=!1,t=new ss,i=new ns,n=new _){super(e);u(this,"policies");u(this,"techs");u(this,"observe");this.policies=t,this.techs=i,this.observe=n}static validateGame(e,t){ss.validateGame(e,t.policies),ns.validateGame(e,t.techs)}load(e){var t;m(e)||(super.load(e),this.policies.load(e.policies),this.techs.load(e.techs),this.observe.enabled=((t=e.observe)==null?void 0:t.enabled)??this.observe.enabled)}}class xe{constructor(s){u(this,"_host");this._host=s}upgrade(s,e){let t=!1;if(e==="policy"){const n=game.getUnlockByName(s.name,"policies"),a=new classes.ui.PolicyBtnController(this._host.game),r=a.fetchModel({controller:a,id:n.name});t=xe.skipConfirm(()=>a.buyItem(r)).itemBought}else if(e==="science"){const n=game.getUnlockByName(s.name,"tech"),a=new com.nuclearunicorn.game.ui.TechButtonController(this._host.game),r=a.fetchModel({controller:a,id:n.name});t=xe.skipConfirm(()=>a.buyItem(r)).itemBought}else{const n=game.getUnlockByName(s.name,"upgrades"),a=new com.nuclearunicorn.game.ui.UpgradeButtonController(this._host.game),r=a.fetchModel({controller:a,id:n.name});t=xe.skipConfirm(()=>a.buyItem(r)).itemBought}if(!t)return!1;const i=s.label;return e==="workshop"?(this._host.engine.storeForSummary(i,1,"upgrade"),this._host.engine.iactivity("upgrade.upgrade",[i],"ks-upgrade")):e==="policy"?this._host.engine.iactivity("upgrade.policy",[i]):e==="science"&&(this._host.engine.storeForSummary(i,1,"research"),this._host.engine.iactivity("upgrade.tech",[i],"ks-research")),!0}static async skipConfirmAsync(s){const e=game.ui.confirm;try{return game.ui.confirm=()=>!0,await s()}finally{game.ui.confirm=e}}static skipConfirm(s){const e=game.ui.confirm;try{return game.ui.confirm=()=>!0,s()}finally{game.ui.confirm=e}}}const mn=c=>new Promise(s=>setTimeout(s,c)),Te="en-US",fn=2*60*1e3,bn="localStorage"in globalThis&&!m(localStorage["ks.timeout"])?Number(localStorage["ks.timeout"]):void 0;class T{constructor(){u(this,"_gameStartSignal");u(this,"_gameStartSignalResolver");u(this,"_possibleEngineState")}static tryEngineStateFromSaveData(s,e){const t=e;if(!(s in t)){console.debug(...v(`Failed: \\`${s}\\` not found in save data.`));return}const i=t.ks;if(!("state"in i)){console.debug(...v(`Failed: \\`${s}.state\\` not found in save data.`));return}const n=i.state;if(!Array.isArray(n)){console.debug(...v(`Failed: \\`${s}.state\\` not \\`Array\\`.`));return}return n[0]}async waitForGame(s,e,t=bn??fn){if(T._isGameLoaded()){const n=p(T.window.game),a=p(T.window.$I),r=localStorage["com.nuclearunicorn.kittengame.language"];return new s(n,a,r,this._possibleEngineState)}const i=[mn(2e3)];if(m(this._gameStartSignal)&&typeof T.window.dojo<"u"){this._gameStartSignal=new Promise(a=>{this._gameStartSignalResolver=a});const n=T.window.dojo.subscribe("game/start",()=>{console.debug(...v(`\'game/start\' signal caught. Fast-tracking script load for \'${e}\'...`)),p(this._gameStartSignalResolver)(!0),T.window.dojo.unsubscribe(n)});if(e!==void 0){const a=T.window.dojo.subscribe("server/load",r=>{console.info(...v(`\'server/load\' signal caught. Looking for script state with key \'${e}\' in save data...`));const o=T.tryEngineStateFromSaveData(e,r);if(!o){console.info(...v(`The Kittens Game save data did not contain a script state for \'${e}\'.`));return}console.info(...v(`Found key \'${e}\'! Provided save data will be used as seed for next script instance.`)),this._possibleEngineState=o,T.window.dojo.unsubscribe(a)})}}if(m(this._gameStartSignal)||i.push(this._gameStartSignal),t<0)throw new Error("Unable to find game. Giving up. Maybe the game is not exported at `window.game`?");return console.debug(...v(`Waiting for game... (timeout: ${Math.round(t/1e3)}s)`)),await Promise.race(i),this.waitForGame(s,e,t-2e3)}static _isGameLoaded(){var s;return!m(T.window.game)&&(((s=T.window.document.getElementById("game"))==null?void 0:s.checkVisibility())??!1)&&!m(T.window.$I)}static get window(){try{return p(unsafeWindow)}catch{return window}}}class pn extends xe{constructor(e,t,i=new Qt){super(e);u(this,"manager");u(this,"settings");u(this,"_workshopManager");this.settings=i,this.manager=new me(this._host,"Science"),this._workshopManager=t}async tick(e){this.settings.enabled&&(this.manager.render(),this.settings.techs.enabled&&this._host.game.tabs[2].visible&&await this.autoUnlock(),this.settings.policies.enabled&&this._host.game.tabs[2].visible&&await this.autoPolicy(),this.settings.observe.enabled&&this.observeStars())}async autoUnlock(){const e=this._host.game.science.techs,t=new Array;e:for(const i of Object.values(this.settings.techs.techs)){if(!i.enabled)continue;const n=e.find(r=>r.name===i.tech);if(m(n)){console.error(...v(`Tech \'${i.tech}\' not found in game!`));continue}if(n.researched||!n.unlocked)continue;let a=T.window.dojo.clone(n.prices);a=this._host.game.village.getEffectLeader("scientist",a);for(const r of a){const o=this._workshopManager.getValueAvailable(r.name),l=this._workshopManager.getResource(r.name),h=oe.evaluateSubSectionTrigger(this.settings.techs.trigger,i.trigger);if(h<0||o<l.maxValue*h||o<r.val)continue e}t.push(n)}for(const i of t)await this.upgrade(i,"science")}async autoPolicy(){const e=this._host.game.science.policies,t=new Array;for(const i of Object.values(this.settings.policies.policies)){if(!i.enabled)continue;const n=e.find(a=>a.name===i.policy);if(m(n)){console.error(...v(`Policy \'${i.policy}\' not found in game!`));continue}!n.researched&&!n.blocked&&n.unlocked&&(n.requiredLeaderJob===void 0||this._host.game.village.leader!==null&&this._host.game.village.leader.job===n.requiredLeaderJob)&&t.push(n)}for(const i of t)await this.upgrade(i,"policy")}observeStars(){this._host.game.calendar.observeBtn!==null&&(this._host.game.calendar.observeHandler(),this._host.engine.iactivity("act.observe",[],"ks-star"),this._host.engine.storeForSummary("stars",1))}}class vn extends _{constructor(e,t=!1){super(t);I(this,Ze);L(this,Ze,e)}get mission(){return P(this,Ze)}}Ze=new WeakMap;class as extends _{constructor(e=!1){super(e);u(this,"missions");this.missions=this.initMissions()}initMissions(){const e={};for(const t of js)e[t]=new vn(t);return e}static validateGame(e,t){const i=Object.keys(t.missions),n=e.space.programs.map(o=>o.name),a=ae(n,i),r=ae(i,n);for(const o of a)console.warn(...v(`The space mission \'${o}\' is not tracked in Kitten Scientists!`));for(const o of r)console.warn(...v(`The space mission \'${o}\' is not a space mission in Kittens Game!`))}load(e){m(e)||(super.load(e),z(this.missions,e.missions,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled}))}}class yn extends _t{constructor(e){super(!1,-1,0);I(this,Ke);L(this,Ke,e)}get building(){return P(this,Ke)}}Ke=new WeakMap;class St extends K{constructor(e=!1,t=-1,i=new as){super(e,t);u(this,"buildings");u(this,"unlockMissions");this.buildings=this.initBuildings(),this.unlockMissions=i}initBuildings(){const e={};for(const t of Xi)e[t]=new yn(t);return e}static validateGame(e,t){as.validateGame(e,t.unlockMissions)}load(e){m(e)||(super.load(e),z(this.buildings,e.buildings,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.max=(i==null?void 0:i.max)??t.max,t.trigger=(i==null?void 0:i.trigger)??t.trigger}),this.unlockMissions.load(e.unlockMissions))}}class wn{constructor(s,e,t=new St){u(this,"_host");u(this,"settings");u(this,"manager");u(this,"_bulkManager");u(this,"_workshopManager");this._host=s,this.settings=t,this.manager=new me(this._host,"Space"),this._workshopManager=e,this._bulkManager=new wt(this._host,this._workshopManager)}tick(s){this.settings.enabled&&(this.manager.render(),this.autoBuild(s),this.settings.unlockMissions.enabled&&this.autoUnlock(s))}autoBuild(s,e=this.settings.buildings){const t=this._bulkManager,i=this.settings.trigger,n={};for(const r of Object.values(e))n[r.building]=this.getBuild(r.building);const a=t.bulk(e,n,i,"Space");for(const r of a)r.count<=0||this.build(r.id,r.count)!==0&&(s.requestGameUiRefresh=!0)}autoUnlock(s){var t,i;if(!this._host.game.tabs[6].visible)return;const e=this._host.game.space.meta[0].meta;e:for(let n=0;n<e.length;n++){if(0<e[n].val||!e[n].unlocked||!this.settings.unlockMissions.missions[e[n].name].enabled)continue;const a=(t=this.manager.tab.GCPanel)==null?void 0:t.children[n];if(m(a))return;const r=p((i=a.model)==null?void 0:i.prices);for(const o of r)if(this._workshopManager.getValueAvailable(o.name)<o.val)continue e;a.domNode.click(),s.requestGameUiRefresh=!0,n===7||n===12?this._host.engine.iactivity("upgrade.space.mission",[e[n].label],"ks-upgrade"):this._host.engine.iactivity("upgrade.space",[e[n].label],"ks-upgrade")}}build(s,e){let t=e;const i=t;let n;const a=game.getUnlockByName(s,"spaceBuilding"),r=new classes.ui.space.PlanetBuildingBtnController(this._host.game),o=r.fetchModel({controller:r,id:a.name});return t=this._bulkManager.construct(o,r,t),n=a.label,t!==i&&(console.warn(...v(`${n} Amount ordered: ${i} Amount Constructed: ${t}`)),t===0)?0:(this._host.engine.storeForSummary(n,t,"build"),t===1?this._host.engine.iactivity("act.build",[n],"ks-build"):this._host.engine.iactivity("act.builds",[n,this._host.renderAbsolute(t)],"ks-build"),t)}getBuild(s){return this._host.game.space.getBuilding(s)}_getBuildButton(s){const e=this.manager.tab.planetPanels;if(m(e))return null;let t=null;for(const i of e)if(t=i.children.find(n=>n.id===s)??null,!m(t))return t;if(t===null)throw new Error(`Couldn\'t find button for ${s}!`)}}var rs=(c=>(c.build="ks-activity type_ks-build",c.craft="ks-activity type_ks-craft",c.upgrade="ks-activity type_ks-upgrade",c.research="ks-activity type_ks-research",c.trade="ks-activity type_ks-trade",c.hunt="ks-activity type_ks-hunt",c.praise="ks-activity type_ks-praise",c.adore="ks-activity type_ks-adore",c.transcend="ks-activity type_ks-transcend",c.faith="ks-activity type_ks-faith",c.accelerate="ks-activity type_ks-accelerate",c.timeSkip="ks-activity type_ks-timeSkip",c.festival="ks-activity type_ks-festival",c.star="ks-activity type_ks-star",c.distribute="ks-activity type_ks-distribute",c.promote="ks-activity type_ks-promote",c.misc="ks-activity",c))(rs||{});const os=["accelerate","adore","build","craft","distribute","faith","festival","hunt","misc","praise","promote","research","star","timeSkip","trade","transcend","upgrade"];class kn extends _{constructor(e){super(!0);I(this,Ve);L(this,Ve,e)}get variant(){return P(this,Ve)}}Ve=new WeakMap;class _n extends _{constructor(e=!1,t=new _(!0)){super(e);u(this,"filters");u(this,"disableKGLog");this.filters=this.initFilters(),this.disableKGLog=t}initFilters(){const e={};for(const t of os)e[t]=new kn(rs[t]);return e}load(e){var t;m(e)||(super.load(e),z(this.filters,e.filters,(i,n)=>{i.enabled=(n==null?void 0:n.enabled)??i.enabled}),this.disableKGLog.enabled=((t=e.disableKGLog)==null?void 0:t.enabled)??this.disableKGLog.enabled)}}class Cn extends K{constructor(e,t=!1){super(t,-1);I(this,je);L(this,je,e)}get upgrade(){return P(this,je)}}je=new WeakMap;class ls extends K{constructor(e=!1){super(e,-1);u(this,"upgrades");this.upgrades=this.initUpgrades()}initUpgrades(){const e={};for(const t of es)e[t]=new Cn(t);return e}static validateGame(e,t){const i=Object.keys(t.upgrades),n=e.workshop.upgrades.map(o=>o.name),a=ae(n,i),r=ae(i,n);for(const o of a)console.warn(...v(`The workshop upgrade \'${o}\' is not tracked in Kitten Scientists!`));for(const o of r)console.warn(...v(`The workshop upgrade \'${o}\' is not an upgrade in Kittens Game!`))}load(e){m(e)||(super.load(e),z(this.upgrades,e.upgrades,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.trigger=(i==null?void 0:i.trigger)??t.trigger}))}}class Sn extends Ys{constructor(e,t=!1,i=!0){super(t,i);I(this,Je);L(this,Je,e)}get resource(){return P(this,Je)}}Je=new WeakMap;class xt extends K{constructor(e=!1,t=-1,i=new ls,n=new _){super(e,t);u(this,"resources");u(this,"shipOverride");u(this,"unlockUpgrades");this.resources=this.initResources(),this.shipOverride=n,this.unlockUpgrades=i}initResources(){const e={};for(const t of Hi)e[t]=new Sn(t);return e}static validateGame(e,t){const i=Object.keys(t.resources),n=e.workshop.crafts.map(o=>o.name),a=ae(n,i),r=ae(i,n);for(const o of a)console.warn(...v(`The workshop craft \'${o}\' is not tracked in Kitten Scientists!`));for(const o of r)console.warn(...v(`The workshop craft \'${o}\' is not an upgrade in Kittens Game!`));ls.validateGame(e,t.unlockUpgrades)}load(e){var t;m(e)||(super.load(e),z(this.resources,e.resources,(i,n)=>{i.enabled=(n==null?void 0:n.enabled)??i.enabled,i.limited=(n==null?void 0:n.limited)??i.limited,i.max=(n==null?void 0:n.max)??i.max,i.trigger=(n==null?void 0:n.trigger)??i.trigger}),this.unlockUpgrades.load(e.unlockUpgrades),this.shipOverride.enabled=((t=e.shipOverride)==null?void 0:t.enabled)??this.shipOverride.enabled)}}class ei extends xe{constructor(e,t=new xt){super(e);u(this,"settings");u(this,"manager");this.settings=t,this.manager=new me(this._host,"Workshop")}tick(e){return this.settings.enabled?(this.autoCraft(),this.refreshStock(),this.settings.unlockUpgrades.enabled?(this.manager.render(),this.autoUnlock()):Promise.resolve()):Promise.resolve()}async autoUnlock(){if(!this._host.game.workshopTab.visible)return;const e=this._host.game.workshop.upgrades,t=new Array;e:for(const i of Object.values(this.settings.unlockUpgrades.upgrades)){if(!i.enabled)continue;const n=e.find(r=>r.name===i.upgrade);if(m(n)){console.error(...v(`Upgrade \'${i.upgrade}\' not found in game!`));continue}if(n.researched||!n.unlocked)continue;let a=T.window.dojo.clone(n.prices);a=this._host.game.village.getEffectLeader("scientist",a);for(const r of a){const o=this.getValueAvailable(r.name),l=this.getResource(r.name),h=oe.evaluateSubSectionTrigger(this.settings.unlockUpgrades.trigger,i.trigger);if(h<0||0<h&&o<l.maxValue*h||o<r.val)continue e}t.push(n)}for(const i of t)await this.upgrade(i,"workshop")}autoCraft(e=this.settings.resources){const t=new Map,i=this.settings.trigger;for(const a of Object.values(e)){const r=oe.evaluateSubSectionTrigger(i,a.trigger);if(r<0||!a.enabled)continue;const o=a.max?this.getResource(a.resource):!1,l=Y(a.max);if(o&&l<o.value||!this.singleCraftPossible(a.resource))continue;const h=Object.keys(this.getMaterials(a.resource));h.map(f=>this.getResource(f)).filter(f=>0<f.maxValue).filter(f=>f.value/f.maxValue<r).length===0&&t.set(a,{countRequested:1,materials:h.map(f=>({consume:0,resource:f}))})}if(t.size<1)return;const n=new Map;for(const[a,r]of t)for(const o of r.materials)n.has(o.resource)||n.set(o.resource,new Array),p(n.get(o.resource)).push(a.resource);for(const[,a]of t)for(const r of a.materials){const o=this.getValueAvailable(r.resource);r.consume=o/p(n.get(r.resource)).length}for(const[a,r]of t){const o=this.getMaterials(a.resource);let l=Number.MAX_VALUE;for(const f of r.materials){const w=p(o[f.resource]),b=this.getResource(f.resource);if(!a.limited||a.resource==="ship"&&this.settings.shipOverride.enabled&&this.getResource("ship").value<243){l=Math.min(l,f.consume/w);continue}const k=this._host.game.getResCraftRatio(a.resource),y=this.getValueAvailable(f.resource)/p(n.get(f.resource)).length,A=this.getValueAvailable(a.resource),V=w,Q=1+k,ce=y/V,pe=A/Q,ee=Math.max(0,Math.floor(Math.log(pe)/Math.LN10+1e-9));l=Math.min(l,Math.min(ce-(0<b.maxValue&&b.maxValue<=b.value?0:pe),10**(ee+1)),f.consume/w)}const h=this.getValueAvailable(a.resource),d=1+this._host.game.getResCraftRatio(a.resource),g=Number.MAX_VALUE/d-h/d;l=Math.min(l,g),r.countRequested=Math.max(0,a.max===-1?l:Math.min(l,(a.max-h)/d))}for(const[a,r]of t)r.countRequested<1||this.craft(a.resource,r.countRequested)}craft(e,t){let i=Math.floor(t);if(i<1||!this._canCraft(e,i))return;const n=this.getCraft(e),a=this._host.game.getResCraftRatio(n.name);this._host.game.craft(n.name,i);const r=p(this._host.game.resPool.get(e)).title;i=Number.parseFloat((i*(1+a)).toFixed(2)),this._host.engine.storeForSummary(r,i,"craft"),this._host.engine.iactivity("act.craft",[this._host.game.getDisplayValueExt(i),r],"ks-craft")}_canCraft(e,t){if(!this._host.game.workshopTab.visible&&e!=="wood")return!1;const i=this.getCraft(e),n=p(this.settings.resources[e]).enabled;let a=!1;if(i.unlocked&&n){a=!0;const r=this._host.game.workshop.getCraftPrice(i);for(const o of r)this.getValueAvailable(o.name)<o.val*t&&(a=!1)}return a}getCraft(e){const t=this._host.game.workshop.getCraft(e);if(!t)throw new Error(`Unable to find craft \'${e}\'`);return t}singleCraftPossible(e){if(!this._host.game.workshopTab.visible&&e!=="wood")return!1;const t=this.getMaterials(e);for(const[i,n]of q(t))if(this.getValueAvailable(i)<n)return!1;return!0}getMaterials(e){const t={},i=this.getCraft(e),n=this._host.game.workshop.getCraftPrice(i);for(const a of n)t[a.name]=a.val;return t}getTickVal(e,t,i=void 0){let n=this._host.game.getResourcePerTick(e.name,!0);if(e.craftable){let a=Number.MAX_VALUE;const r=this.getMaterials(e.name);for(const[o,l]of q(r)){const h=(1+this._host.game.getResCraftRatio(e.name))/l,d=this.getTickVal(this.getResource(o));d!=="ignore"&&(a=Math.min(d*h,a))}n+=a!==Number.MAX_VALUE?a:0}return n<=0&&(e.name==="spice"||e.name==="blueprint")?"ignore":(!i&&!m(t)&&(n+=t.getResValue(e.name)),n)}getAverageHunt(){const e={},t=this._host.game.getEffect("hunterRatio")+this._host.game.village.getEffectLeader("manager",0);return e.furs=40+32.5*t,e.ivory=50*Math.min(.225+.01*t,.5)+40*t*Math.min(.225+.01*t,.5),e.unicorns=.05,this.getValue("zebras")>=10&&(e.bloodstone=this.getValue("bloodstone")===0?.05:5e-4),this._host.game.ironWill&&this._host.game.workshop.get("goldOre").researched&&(e.gold=.625+.625*t),e}getResource(e){const t=this._host.game.resPool.get(e);if(m(t))throw new Error(`Unable to find resource ${e}`);return t}getValue(e){return this.getResource(e).value??0}getStock(e){const t=this._host.engine.settings.resources.resources[e];return t.enabled?t.stock:0}getConsume(e){const t=this._host.engine.settings.resources.resources[e];return t.enabled?t.consume:1}getValueAvailable(e){let t=this.getStock(e);if(e==="catnip"){const a=this._host.game.bld.getBuildingExt("pasture").meta,r=this._host.game.bld.getBuildingExt("aqueduct").meta,o=a.stage===0?a.val:0,l=r.stage===0?r.val:0,h=this.getPotentialCatnip(!0,o,l);h<0&&(t-=h*202*5)}let i=this.getValue(e);i=Math.max(i-t,0);const n=this.getConsume(e);return i*n}getPotentialCatnip(e,t,i){let n=this._host.game.getEffect("catnipPerTickBase");e?(n*=.1,n*=1+this._host.game.getLimitedDR(this._host.game.getEffect("coldHarshness"),1)):n*=this._host.game.calendar.getWeatherMod({name:"catnip"})+this._host.game.calendar.getCurSeason().modifiers.catnip,this._host.game.science.getPolicy("communism").researched&&(n=0);const a=this._host.game.village.getResProduction(),r=a.catnip?a.catnip*(1+this._host.game.getEffect("catnipJobRatio")):0;let o=n+r,l=this._host.game.space.getBuilding("hydroponics").val;this._host.game.prestige.meta[0].meta[21].researched&&(this._host.game.calendar.cycle===2&&(l*=2),this._host.game.calendar.cycle===7&&(l*=.5)),o*=1+.03*i+.025*l;const d=this._host.game.challenges.currentChallenge==="winterIsComing"?0:this._host.game.prestige.getParagonProductionRatio();o*=1+d,o*=1+this._host.game.religion.getSolarRevolutionRatio(),this._host.game.opts.disableCMBR||(o*=1+this._host.game.getCMBRBonus()),o=p(this._host.game.calendar.cycleEffectsFestival({catnip:o}).catnip);let g=this._host.game.village.getResConsumption().catnip;const f=this._host.game.bld.getBuildingExt("unicornPasture").meta.val;if(g*=1+this._host.game.getLimitedDR(t*-.005+f*-.0015,1),this._host.game.village.sim.kittens.length>0&&this._host.game.village.happiness>1){const w=this._host.game.village.happiness-1,b=this._host.game.getEffect("catnipDemandWorkerRatioGlobal");this._host.game.challenges.currentChallenge==="anarchy"?g*=1+w*(1+b):g*=1+w*(1+b)*(1-this._host.game.village.getFreeKittens()/this._host.game.village.sim.kittens.length)}return o+=g,o+=this._host.game.getResourcePerTickConvertion("catnip"),o}refreshStock(){for(const[e,t]of q(this._host.engine.settings.resources.resources)){const i=[...$(`#game .res-row.resource_${e} .res-cell.resAmount`),...$(`#game .res-row.resource_${e} .res-cell.resource-value`)];if(!t.enabled||t.stock===0){for(const a of i)a.classList.remove("ks-stock-above","ks-stock-below");continue}const n=this._host.game.resPool.get(e).value<t.stock;for(const a of i)a.classList.add(n?"ks-stock-below":"ks-stock-above"),a.classList.remove(n?"ks-stock-above":"ks-stock-below")}}}u(ei,"DEFAULT_CONSUME_RATE",1);class xn extends _{constructor(e,t=!1,i=ei.DEFAULT_CONSUME_RATE,n=0){super(t);I(this,Xe);u(this,"consume");u(this,"stock",0);L(this,Xe,e),this.consume=i,this.stock=n}get resource(){return P(this,Xe)}}Xe=new WeakMap;class Tn extends _{constructor(e=!1){super(e);u(this,"resources");this.resources=this.initResources()}initResources(){const e={};for(const t of Wi)e[t]=new xn(t);return e}load(e){m(e)||(super.load(e),z(this.resources,e.resources,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.consume=(i==null?void 0:i.consume)??t.consume,t.stock=(i==null?void 0:i.stock)??t.stock}))}}class En extends _{constructor(e=new _,t=new _(!0)){super(!0);u(this,"noConfirm");u(this,"compress");this.noConfirm=e,this.compress=t}load(e){m(e)||(super.load(e),this.noConfirm.load(e.noConfirm),this.compress.load(e.compress))}}class cs extends _{constructor(e=!1,t=new _n,i=new Tn,n=new En,a=Te,r=new _){super(e);u(this,"interval",2e3);u(this,"locale");u(this,"ksColumn");u(this,"filters");u(this,"resources");u(this,"states");this.filters=t,this.resources=i,this.states=n,this.locale=new jt(a,[{label:"Deutsch",value:"de-DE"},{label:"English",value:"en-US"},{label:"עִברִית",value:"he-IL"},{label:"中文",value:"zh-CN"}]),this.ksColumn=r}load(e,t=!1){m(e)||(super.load(e),t||(this.interval=e.interval??this.interval,this.states.load(e.states),this.locale.load(e.locale),this.ksColumn.load(e.ksColumn)),this.filters.load(e.filters),this.resources.load(e.resources))}}class hs extends re{constructor(e,t=!1,i=-1,n){super(t,i);I(this,Ye);I(this,Qe);I(this,et,0);L(this,Qe,e),n&&(L(this,et,1),L(this,Ye,n))}get baseBuilding(){return P(this,Ye)}get building(){return P(this,Qe)}get stage(){return P(this,et)}}Ye=new WeakMap,Qe=new WeakMap,et=new WeakMap;class Rn extends _{constructor(e=!1){super(e);u(this,"buildings");this.buildings=this.initBuildings()}initBuildings(){const e={broadcasttower:"amphitheatre",dataCenter:"library",hydroplant:"aqueduct",solarfarm:"pasture",spaceport:"warehouse"},t={};for(const i of Fi)i!=="unicornPasture"&&(t[i]=new hs(i));for(const i of Vt)t[i]=new hs(i,!1,-1,e[i]);return t}load(e){m(e)||(super.load(e),z(this.buildings,e.buildings,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.trigger=(i==null?void 0:i.trigger)??t.trigger}))}}class Tt extends re{constructor(e,t,i=!1,n=-1){super(i,n);I(this,tt);I(this,it);L(this,tt,e),L(this,it,t)}get building(){return P(this,tt)}get variant(){return P(this,it)}}tt=new WeakMap,it=new WeakMap;class Mn extends _{constructor(e=!1){super(e);u(this,"buildings");this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of Zi)e[t]=new Tt(t,H.OrderOfTheSun);for(const t of Ki)e[t]=new Tt(t,H.Cryptotheology);for(const t of Vi)e[t]=new Tt(t,H.Ziggurat);return e.unicornPasture=new Tt("unicornPasture",H.UnicornPasture),e}load(e){m(e)||(super.load(e),z(this.buildings,e.buildings,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.trigger=(i==null?void 0:i.trigger)??t.trigger}))}}class Bn extends re{constructor(e,t=!1,i=-1){super(t,i);I(this,st);L(this,st,e)}get resource(){return P(this,st)}}st=new WeakMap;class An extends _{constructor(e=!1){super(e);u(this,"resources");this.resources=this.initResources()}initResources(){const e={};for(const t of Wi)e[t]=new Bn(t);return e}load(e){m(e)||(super.load(e),z(this.resources,e.resources,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.trigger=(i==null?void 0:i.trigger)??t.trigger}))}}class Pn extends re{constructor(e,t=!1,i=-1){super(t,i);I(this,nt);L(this,nt,e)}get building(){return P(this,nt)}}nt=new WeakMap;class In extends _{constructor(e=!1){super(e);u(this,"buildings");this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of Xi)e[t]=new Pn(t);return e}load(e){m(e)||(super.load(e),z(this.buildings,e.buildings,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.trigger=(i==null?void 0:i.trigger)??t.trigger}))}}class us extends re{constructor(e,t,i=!1,n=-1){super(i,n);I(this,at);I(this,rt);L(this,at,e),L(this,rt,t)}get building(){return P(this,at)}get variant(){return P(this,rt)}}at=new WeakMap,rt=new WeakMap;class $n extends _{constructor(e=!1){super(e);u(this,"buildings");this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of Yi)e[t]=new us(t,he.Chronoforge);for(const t of Qi)t!=="usedCryochambers"&&(e[t]=new us(t,he.VoidSpace));return e}load(e){m(e)||(super.load(e),z(this.buildings,e.buildings,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.trigger=(i==null?void 0:i.trigger)??t.trigger}))}}class Ln extends _{constructor(e,t=!1){super(t);I(this,ot);L(this,ot,e)}get upgrade(){return P(this,ot)}}ot=new WeakMap;class On extends _{constructor(e=!1){super(e);u(this,"upgrades");this.upgrades=this.initUpgrades()}initUpgrades(){const e={};for(const t of es)e[t]=new Ln(t);return e}load(e){m(e)||(super.load(e),z(this.upgrades,e.upgrades,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled}))}}class Un extends _{constructor(e=!1,t=new Rn,i=new Mn,n=new An,a=new In,r=new $n,o=new On){super(e);u(this,"bonfire");u(this,"religion");u(this,"resources");u(this,"space");u(this,"time");u(this,"upgrades");this.bonfire=t,this.religion=i,this.resources=n,this.space=a,this.time=r,this.upgrades=o}load(e){m(e)||(super.load(e),this.bonfire.load(e.bonfire),this.religion.load(e.religion),this.resources.load(e.resources),this.space.load(e.space),this.time.load(e.time),this.upgrades.load(e.upgrades))}}class Dn extends K{constructor(e=new _){super(!1,1);u(this,"cycles");u(this,"activeHeatTransferStatus");this.cycles=this.initCycles(),this.activeHeatTransferStatus=e}initCycles(){const e={};for(const t of we)e[t]=new _;return e}load(e){m(e)||(super.load(e),z(this.cycles,e.cycles,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled}),this.activeHeatTransferStatus.load(e.activeHeatTransferStatus))}}class Nn extends en{constructor(e=new _,t=new Dn){super(!1,5);u(this,"cycles");u(this,"seasons");u(this,"activeHeatTransfer");u(this,"ignoreOverheat");this.cycles=this.initCycles(),this.seasons=this.initSeason(),this.activeHeatTransfer=t,this.ignoreOverheat=e}initCycles(){const e={};for(const t of we)e[t]=new _;return e}initSeason(){const e={};for(const t of Gs)e[t]=new _;return e}load(e){m(e)||(super.load(e),z(this.cycles,e.cycles,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled}),z(this.seasons,e.seasons,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled}),this.ignoreOverheat.load(e.ignoreOverheat),this.activeHeatTransfer.load(e.activeHeatTransfer))}}class ds extends _{constructor(e=!1,t=new K(!1,1),i=new Un,n=new Nn){super(e);u(this,"accelerateTime");u(this,"timeSkip");u(this,"reset");this.accelerateTime=t,this.reset=i,this.timeSkip=n}load(e){m(e)||(super.load(e),this.accelerateTime.load(e.accelerateTime),this.reset.load(e.reset),this.timeSkip.load(e.timeSkip))}}class gs extends _t{constructor(e,t,i=!1){super(i,-1,0);I(this,lt);I(this,ct);L(this,lt,e),L(this,ct,t)}get building(){return P(this,lt)}get variant(){return P(this,ct)}}lt=new WeakMap,ct=new WeakMap;class ms extends K{constructor(e=!1,t=-1,i=new _){super(e,t);u(this,"buildings");u(this,"fixCryochambers");this.buildings=this.initBuildings(),this.fixCryochambers=i}initBuildings(){const e={};for(const t of Yi)e[t]=new gs(t,he.Chronoforge);for(const t of Qi)t!=="usedCryochambers"&&(e[t]=new gs(t,he.VoidSpace));return e}load(e){m(e)||(super.load(e),z(this.buildings,e.buildings,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.max=(i==null?void 0:i.max)??t.max,t.trigger=(i==null?void 0:i.trigger)??t.trigger}),this.fixCryochambers.load(e.fixCryochambers))}}class qn extends is{constructor(e,t=!1){super(t);I(this,ht);L(this,ht,e)}get race(){return P(this,ht)}}ht=new WeakMap;class zn extends K{constructor(e=!1){super(e);u(this,"races");this.races=this.initRaces()}initRaces(){const e={};for(const t of ji)t!=="leviathans"&&(e[t]=new qn(t));return e}load(e){m(e)||(super.load(e),z(this.races,e.races,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.max=(i==null?void 0:i.max)??t.max}))}}class Fn extends Qs{constructor(e,t,i,n,a,r,o,l=!1){super(t,i);I(this,ut);u(this,"seasons");I(this,dt);L(this,ut,e),this.seasons={autumn:new _(a),spring:new _(o),summer:new _(n),winter:new _(r)},L(this,dt,l)}get race(){return P(this,ut)}get require(){return P(this,dt)}}ut=new WeakMap,dt=new WeakMap;class fs extends K{constructor(e=!1,t=-1,i=new zn,n=new _,a=new tn(!1,1090,1095,1e4),r=new _){super(e,t);u(this,"races");u(this,"feedLeviathans");u(this,"buildEmbassies");u(this,"tradeBlackcoin");u(this,"unlockRaces");this.races=this.initRaces(),this.buildEmbassies=i,this.feedLeviathans=n,this.tradeBlackcoin=a,this.unlockRaces=r}initRaces(){const e={dragons:"titanium",griffins:"wood",leviathans:"unobtainium",lizards:"minerals",sharks:"iron"},t={};for(const i of ji){const n=e[i]??!1;t[i]=new Fn(i,!1,!1,!1,!1,!1,!1,n)}return t}load(e){m(e)||(super.load(e),z(this.races,e.races,(t,i)=>{t.enabled=(i==null?void 0:i.enabled)??t.enabled,t.limited=(i==null?void 0:i.limited)??t.limited,t.trigger=(i==null?void 0:i.trigger)??t.trigger,t.seasons.autumn.enabled=(i==null?void 0:i.seasons.autumn.enabled)??t.seasons.autumn.enabled,t.seasons.spring.enabled=(i==null?void 0:i.seasons.spring.enabled)??t.seasons.spring.enabled,t.seasons.summer.enabled=(i==null?void 0:i.seasons.summer.enabled)??t.seasons.summer.enabled,t.seasons.winter.enabled=(i==null?void 0:i.seasons.winter.enabled)??t.seasons.winter.enabled}),this.buildEmbassies.load(e.buildEmbassies),this.feedLeviathans.load(e.feedLeviathans),this.tradeBlackcoin.load(e.tradeBlackcoin),this.unlockRaces.load(e.unlockRaces))}}class Hn extends _{constructor(e=!1,t=new jt("any",Gi.map(n=>({label:"",value:n}))),i=new jt("none",Zs.map(n=>({label:"",value:n})))){super(e);u(this,"job");u(this,"trait");this.job=t,this.trait=i}load(e){m(e)||(super.load(e),this.job.load(e.job),this.trait.load(e.trait))}}class bs extends _{constructor(e=!1,t=new _,i=new K(!1,.98),n=new K(!1,1),a=new _,r=new Hn){super(e);u(this,"jobs");u(this,"holdFestivals");u(this,"hunt");u(this,"promoteKittens");u(this,"promoteLeader");u(this,"electLeader");this.jobs=this.initJobs(),this.holdFestivals=t,this.hunt=i,this.promoteKittens=n,this.promoteLeader=a,this.electLeader=r}initJobs(){const e={};for(const t of Gi)e[t]=new is(!1,0);return e}load(e){var t,i,n;m(e)||(super.load(e),z(this.jobs,e.jobs,(a,r)=>{a.enabled=(r==null?void 0:r.enabled)??a.enabled,a.max=(r==null?void 0:r.max)??a.max}),this.holdFestivals.enabled=((t=e.holdFestivals)==null?void 0:t.enabled)??this.holdFestivals.enabled,this.hunt.load(e.hunt),this.promoteKittens.enabled=((i=e.promoteKittens)==null?void 0:i.enabled)??this.promoteKittens.enabled,this.promoteLeader.enabled=((n=e.promoteLeader)==null?void 0:n.enabled)??this.promoteLeader.enabled,this.electLeader.load(e.electLeader))}}class Wn{constructor(s,e,t,i,n,a=new ds){u(this,"_host");u(this,"settings");u(this,"manager");u(this,"_bonfireManager");u(this,"_religionManager");u(this,"_spaceManager");u(this,"_workshopManager");this._host=s,this.settings=a,this.manager=new me(this._host,"Time"),this._bonfireManager=e,this._religionManager=t,this._spaceManager=i,this._workshopManager=n}async tick(s){this.settings.enabled&&(this.settings.accelerateTime.enabled&&this.accelerateTime(),this.settings.timeSkip.enabled&&this.timeSkip(),this.settings.reset.enabled&&await this.autoReset(this._host.engine))}async autoReset(s){if(this._host.game.challenges.currentChallenge)return;const e=[],t=[],i=r=>{if(t.length!==0)for(const o of r){if(m(o.model))continue;const l=o.model,h=l.metadata.name,d=t.indexOf(h);if(d!==-1&&(t.splice(d,1),this._host.game.resPool.hasRes(p(l.prices))))return!0}return!1};for(const[r,o]of q(this.settings.reset.bonfire.buildings)){if(!o.enabled)continue;if(o.trigger<0)return;let l;try{l=this._host.game.bld.getBuildingExt(r)}catch{l=null}if(!m(l))if(e.push({name:l.meta.label??p(l.meta.stages)[p(l.meta.stage)].label,trigger:o.trigger,val:l.meta.val}),0<o.trigger){if(l.meta.val<o.trigger)return}else t.push(r)}const n=this.settings.reset.religion.buildings.unicornPasture;if(n.enabled){if(n.trigger<0)return;const r=this._host.game.bld.getBuildingExt("unicornPasture");if(e.push({name:p(r.meta.label),trigger:n.trigger,val:r.meta.val}),0<n.trigger){if(r.meta.val<n.trigger)return}else t.push("unicornPasture")}if(i(this._bonfireManager.manager.tab.children)||t.length)return;for(const[r,o]of q(this.settings.reset.space.buildings)){if(!o.enabled)continue;if(o.trigger<0)return;const l=this._host.game.space.getBuilding(r);if(e.push({name:l.label,trigger:o.trigger,val:l.val}),0<o.trigger){if(l.val<o.trigger)return}else t.push(r)}if(t.length===0){const r=p(this._spaceManager.manager.tab.planetPanels);for(const o of r)for(const l of o.children){const h=p(l.model),d=h.metadata.name,g=t.indexOf(d);if(g!==-1&&(t.splice(g,1),this._host.game.resPool.hasRes(p(h.prices))))break}}if(t.length)return;for(const[r,o]of q(this.settings.reset.religion.buildings)){if(!o.enabled)continue;if(o.trigger<0)return;const l=p(this._religionManager.getBuild(r,o.variant));if(e.push({name:l.label,trigger:o.trigger,val:l.val}),0<o.trigger){if(l.val<o.trigger)return}else t.push(r)}if(i(this._religionManager.manager.tab.zgUpgradeButtons)||i(this._religionManager.manager.tab.rUpgradeButtons)||i(this._religionManager.manager.tab.ctPanel.children[0].children)||t.length)return;for(const[r,o]of q(this.settings.reset.time.buildings)){if(!o.enabled)continue;if(o.trigger<0)return;const l=p(this.getBuild(r,o.variant));if(e.push({name:l.label,trigger:o.trigger,val:l.val}),0<o.trigger){if(l.val<o.trigger)return}else t.push(r)}if(i(this.manager.tab.cfPanel.children[0].children)||i(this.manager.tab.vsPanel.children[0].children)||t.length)return;for(const[r,o]of q(this.settings.reset.resources.resources)){if(!o.enabled)continue;if(o.trigger<0)return;const l=p(this._host.game.resPool.get(r));if(e.push({name:this._host.engine.i18n(`$resources.${o.resource}.title`),trigger:o.trigger,val:l.value}),l.value<o.trigger)return}for(const[,r]of q(this.settings.reset.upgrades.upgrades))if(r.enabled){const o=p(this._host.game.workshop.upgrades.find(l=>l.name===r.upgrade));if(e.push({name:o.label,trigger:1,val:o.researched?1:0}),!o.researched)return}s.stop(!1);const a=async(r=1500)=>new Promise((o,l)=>{if(!this._host.engine.settings.enabled){l(new Error("canceled by player"));return}setTimeout(o,r)});try{for(const r of e)await a(500),this._host.engine.imessage("reset.check",[r.name,this._host.game.getDisplayValueExt(r.trigger),this._host.game.getDisplayValueExt(r.val)]);await a(0),this._host.engine.imessage("reset.checked"),await a(),this._host.engine.iactivity("reset.tip"),await a(),this._host.engine.imessage("reset.countdown.10"),await a(2e3),this._host.engine.imessage("reset.countdown.9"),await a(),this._host.engine.imessage("reset.countdown.8"),await a(),this._host.engine.imessage("reset.countdown.7"),await a(),this._host.engine.imessage("reset.countdown.6"),await a(),this._host.engine.imessage("reset.countdown.5"),await a(),this._host.engine.imessage("reset.countdown.4"),await a(),this._host.engine.imessage("reset.countdown.3"),await a(),this._host.engine.imessage("reset.countdown.2"),await a(),this._host.engine.imessage("reset.countdown.1"),await a(),this._host.engine.imessage("reset.countdown.0"),await a(),this._host.engine.iactivity("reset.last.message"),await a()}catch{this._host.engine.imessage("reset.cancel.message"),this._host.engine.iactivity("reset.cancel.activity");return}for(let r=0;r<this._host.game.challenges.challenges.length;r++)this._host.game.challenges.challenges[r].pending=!1;this._host.game.resetAutomatic()}accelerateTime(){if(this._workshopManager.getValueAvailable("temporalFlux")<=0){this._host.game.time.isAccelerated&&(this._host.game.time.isAccelerated=!1);return}if(this._host.game.time.isAccelerated)return;const e=this._host.game.resPool.get("temporalFlux");e.maxValue*this.settings.accelerateTime.trigger<=e.value&&(this._host.game.time.isAccelerated=!0,this._host.engine.iactivity("act.accelerate",[],"ks-accelerate"),this._host.engine.storeForSummary("accelerate",1))}timeSkip(){if(!this._host.game.workshop.get("chronoforge").researched||this._host.game.calendar.day<0)return;const s=this._host.game.getEffect("shatterCostIncreaseChallenge"),e=this._workshopManager.getValueAvailable("timeCrystal");if(e<this.settings.timeSkip.trigger||e<1+s)return;const t=this._host.game.getEffect("shatterVoidCost"),i=this._workshopManager.getValueAvailable("void");if(i<t)return;const n=this._host.game.calendar.season;if(!this.settings.timeSkip.seasons[this._host.game.calendar.seasons[n].name].enabled)return;const a=this._host.game.calendar.cycle;if(!this.settings.timeSkip.cycles[we[a]].enabled)return;const r=this._host.game.getEffect("heatMax"),o=this._host.game.time.heat;if(!this.settings.timeSkip.ignoreOverheat.enabled&&r<=o)return;const l=this._host.game.challenges.getChallenge("1000Years").researched?5:10;let h=Number.POSITIVE_INFINITY;if(!this.settings.timeSkip.ignoreOverheat.enabled&&this.settings.timeSkip.activeHeatTransfer.enabled){const y=this._host.game.getEffect("heatPerTick"),A=this._host.game.ticksPerSecond;if(this.settings.timeSkip.activeHeatTransfer.activeHeatTransferStatus.enabled){o<=r*this.settings.timeSkip.activeHeatTransfer.trigger&&(this.settings.timeSkip.activeHeatTransfer.activeHeatTransferStatus.enabled=!1,this._host.refreshEntireUserInterface(),this._host.engine.iactivity("act.time.activeHeatTransferEnd",[],"ks-timeSkip"));const V=this._host.game.getEffect("temporalFluxProduction"),Q=(this._host.game.calendar.daysPerSeason+10+this._host.game.getEffect("temporalParadoxDay"))*this._host.game.calendar.seasonsPerYear,ce=this._host.game.calendar.ticksPerDay,pe=(1+this._host.game.timeAccelerationRatio())/ce,ee=Q/pe,ve=this._host.game.resPool.get("temporalFlux"),mt=ve.maxValue>ee,Me=ve.value<ee;if(!n&&this._host.game.calendar.day<10&&V>l/y&&this.settings.accelerateTime.enabled&&mt&&Me)h=Math.ceil((ee+ce*10-ve.value)/V),this._host.engine.iactivity("act.time.getTemporalFlux",[],"ks-timeSkip"),this._host.engine.storeForSummary("time.getTemporalFlux",1);else{if(this.settings.timeSkip.activeHeatTransfer.cycles[we[a]].enabled)return;h=this._host.game.calendar.yearsPerCycle-this._host.game.calendar.cycleYear}}else o>=r-y*A*10&&(this.settings.timeSkip.activeHeatTransfer.activeHeatTransferStatus.enabled=!0,this._host.refreshEntireUserInterface(),this._host.engine.iactivity("act.time.activeHeatTransferStart",[],"ks-timeSkip"),this._host.engine.storeForSummary("time.activeHeatTransferStart",1))}const d=Y(this.settings.timeSkip.max);let g=Math.floor(Math.min(this.settings.timeSkip.ignoreOverheat.enabled?Number.POSITIVE_INFINITY:(r-o)/l,d,h,e/(1+s),0<t?i/t:Number.POSITIVE_INFINITY)),f=0;const w=this._host.game.calendar.yearsPerCycle,b=w-this._host.game.calendar.cycleYear,k=this._host.game.calendar.cyclesPerEra;if(g<b)f=g;else{f+=b,g-=b;let y=1;for(;w<g&&this.settings.timeSkip.cycles[we[(a+y)%k]].enabled;)f+=w,g-=w,y+=1;this.settings.timeSkip.cycles[we[(a+y)%k]].enabled&&0<g&&(f+=g)}if(0<f){const y=this._host.game.timeTab.cfPanel.children[0].children[0];if(m(y.model))return;this._host.engine.iactivity("act.time.skip",[f],"ks-timeSkip"),y.controller.doShatterAmt(y.model,f),this._host.engine.storeForSummary("time.skip",f)}}getBuild(s,e){return e===he.Chronoforge?this._host.game.time.getCFU(s):this._host.game.time.getVSU(s)}}class Gn{constructor(s,e,t=new ms){u(this,"_host");u(this,"settings");u(this,"manager");u(this,"_bulkManager");u(this,"_workshopManager");this._host=s,this.settings=t,this.manager=new me(this._host,"Time"),this._bulkManager=new wt(this._host,e),this._workshopManager=e}tick(s){this.settings.enabled&&(this.manager.render(),this.autoBuild(s),this.settings.fixCryochambers.enabled&&this.fixCryochambers())}autoBuild(s,e=this.settings.buildings){const t=this._bulkManager,i=this.settings.trigger,n={};for(const r of Object.values(e)){const o=this.getBuild(r.building,r.variant);n[r.building]=p(o);const l=r.variant===he.Chronoforge?this._getBuildButtonCF(r.building):this._getBuildButtonVS(r.building);if(m(l))continue;const h=l.model,d=r.variant===he.Chronoforge?this.manager.tab.cfPanel:this.manager.tab.vsPanel,g=p(n[r.building]);g.tHidden=!(h!=null&&h.visible)||!h.enabled||!d.visible}const a=t.bulk(e,n,i,"Time");for(const r of a)r.count>0&&(this.build(r.id,r.variant,r.count),s.requestGameUiRefresh=!0)}build(s,e,t){let i=t,n;const a=i;if(e===he.Chronoforge){const r=game.getUnlockByName(s,"chronoforge"),o=new classes.ui.time.ChronoforgeBtnController(this._host.game),l=o.fetchModel({controller:o,id:r.name});i=this._bulkManager.construct(l,o,i),n=r.label}else{const r=game.getUnlockByName(s,"voidSpace"),o=new classes.ui.time.VoidSpaceBtnController(this._host.game),l=o.fetchModel({controller:o,id:r.name});i=this._bulkManager.construct(l,o,i),n=r.label}i!==a&&(console.warn(...v(`${n} Amount ordered: ${a} Amount Constructed: ${i}`)),i===0)||(this._host.engine.storeForSummary(n,i,"build"),i===1?this._host.engine.iactivity("act.build",[n],"ks-build"):this._host.engine.iactivity("act.builds",[n,this._host.renderAbsolute(i)],"ks-build"))}getBuild(s,e){return e===he.Chronoforge?this._host.game.time.getCFU(s):this._host.game.time.getVSU(s)}_getBuildButtonCF(s){return this.manager.tab.children[2].children[0].children.find(e=>e.id===s)??null}_getBuildButtonVS(s){return this.manager.tab.children[3].children[0].children.find(e=>e.id===s)??null}fixCryochambers(){if(this._host.game.time.getVSU("usedCryochambers").val<1)return;const s=p(this._host.game.time.getVSU("usedCryochambers").fixPrices);for(const n of s)if(this._workshopManager.getValueAvailable(n.name)<n.val)return;const e=this.manager.tab.vsPanel.children[0].children[0];let t=0,i;do i=!1,i=e.controller.buyItem(p(e.model),new MouseEvent("click")).itemBought,t+=i?1:0;while(i);0<t&&(this._host.engine.iactivity("act.fix.cry",[this._host.renderAbsolute(t)],"ks-fixCry"),this._host.engine.storeForSummary("fix.cry",t))}}class Zn{constructor(s,e,t=new fs){u(this,"_host");u(this,"settings");u(this,"manager");u(this,"_workshopManager");this._host=s,this.settings=t,this.manager=new me(this._host,"Trade"),this._workshopManager=e}tick(s){this.settings.enabled&&(this.manager.render(),this.autoTrade(),this.settings.unlockRaces.enabled&&this.autoUnlock(s),this.settings.buildEmbassies.enabled&&this.autoBuildEmbassies(s),this.settings.feedLeviathans.enabled&&this.autoFeedElders(),this.settings.tradeBlackcoin.enabled&&this.autoTradeBlackcoin())}autoTrade(s){var d;const e=this._workshopManager.getResource("manpower"),t=this._workshopManager.getResource("gold"),i=this.settings.trigger,n=[],a=this._host.game.calendar.getCurSeason().name;for(const g of Object.values(this.settings.races)){const f=this.getRace(g.race),w=oe.evaluateSubSectionTrigger(i,g.trigger);if(w<0||!g.enabled||!g.seasons[a].enabled||!f.unlocked||!this.singleTradePossible(i,e,t,g))continue;const b=this.getTradeButton(f.name);if(!((d=b==null?void 0:b.model)!=null&&d.enabled))continue;const k=g.require?this._workshopManager.getResource(g.require):!1,y=this.getProfitability(g.race);(g.limited&&y||!k||w<=k.value/k.maxValue)&&n.push(g.race)}if(n.length===0)return;let r=this.getLowestTradeAmount(null,!0,!1);if(r<1)return;const o=[];for(let g=0;g<n.length;g++){const f=n[g],w=this.settings.races[f],b=w.require?this._workshopManager.getResource(w.require):!1,k=oe.evaluateSubSectionTrigger(i,w.trigger),y=(!b||k<=b.value/b.maxValue)&&k<=t.value/t.maxValue,A=this.getLowestTradeAmount(f,w.limited,y);if(A<1){n.splice(g,1),g--;continue}o.push(A)}if(n.length===0)return;const l={};for(;0<n.length&&1<=r;){if(r<n.length){const b=Math.floor(Math.random()*n.length),k=n[b];m(l[k])&&(l[k]=0),l[k]+=1,r-=1,n.splice(b,1),o.splice(b,1);continue}let g=Math.floor(r/n.length),f=0;const w=n[f];for(let b=0;b<n.length;++b)o[b]<g&&(g=o[b],f=b);m(l[w])&&(l[w]=0),l[w]+=g,r-=g,n.splice(f,1),o.splice(f,1)}if(Object.values(l).length===0)return;const h={};for(const[g,f]of q(l)){const w=this.getRace(g),b=this.getMaterials(g);for(const[y,A]of q(b))h[y]||(h[y]=0),h[y]-=A*f;const k=this.getAverageTrade(w);for(const[y,A]of q(k)){const V=this._workshopManager.getResource(y);h[y]||(h[y]=0),h[y]+=V.maxValue>0?Math.min(p(k[y])*p(l[g]),Math.max(V.maxValue-V.value,0)):A*p(l[g])}}m(s)||s.pushToCache({materials:h,timeStamp:this._host.game.timer.ticksTotal});for(const[g,f]of q(l))0<f&&this.trade(g,f)}autoBuildEmbassies(s){var o;if(!this._host.game.diplomacy.races[0].embassyPrices)return;const e=this._workshopManager.getResource("culture");let t=0;const i=this.settings.buildEmbassies.trigger;if(e.value/e.maxValue<Y(i))return;const n=this._host.game.diplomacyTab.racePanels;t=this._workshopManager.getValueAvailable("culture");const a={},r=[];for(let l=0;l<n.length;l++){if(!n[l].embassyButton)continue;const h=n[l].race.name,d=this._host.game.diplomacy.get(h),g=Y(this.settings.buildEmbassies.races[h].max);!this.settings.buildEmbassies.races[h].enabled||g<=d.embassyLevel||!d.unlocked||(a[h]={basePrice:p((o=d.embassyPrices)==null?void 0:o[0]).val,currentEm:d.embassyLevel,max:g,priceSum:0,race:d,val:0},r.push(h))}if(r.length!==0){for(;r.length>0;)for(let l=0;l<r.length;l++){const h=r[l],d=p(a[h]);if(d.max<=d.currentEm+d.val){r.splice(l,1),--l;continue}const g=d.basePrice*1.15**(d.currentEm+d.val);g<=t?(t-=g,d.priceSum+=g,d.val+=1,s.requestGameUiRefresh=!0):(r.splice(l,1),--l)}for(const[,l]of q(a))l.val!==0&&(t=this._workshopManager.getValueAvailable("culture"),t<l.priceSum&&console.warn(...v("Something has gone horribly wrong.",l.priceSum,t)),this._workshopManager.getResource("culture").value-=l.priceSum,l.race.embassyLevel+=l.val,this._host.engine.storeForSummary("embassy",l.val),l.val!==1?this._host.engine.iactivity("build.embassies",[l.val,l.race.title],"ks-build"):this._host.engine.iactivity("build.embassy",[l.val,l.race.title],"ks-build"))}}autoFeedElders(){const s=this._host.game.diplomacy.get("leviathans"),e=this._host.game.resPool.get("necrocorn");!s.unlocked||e.value===0||(1<=e.value?s.energy<this._host.game.diplomacy.getMarkerCap()&&(this._host.game.diplomacy.feedElders(),this._host.engine.iactivity("act.feed"),this._host.engine.storeForSummary("feed",1)):.25*(1+this._host.game.getEffect("corruptionBoostRatio"))<1&&(this._host.engine.storeForSummary("feed",e.value),this._host.game.diplomacy.feedElders(),this._host.engine.iactivity("dispose.necrocorn")))}autoUnlock(s){if(!this._host.game.tabs[4].visible)return;const e=this._host.game.diplomacy.get("leviathans").unlocked?8:7;if(this._host.game.diplomacyTab.racePanels.length<e){let t=this._workshopManager.getValueAvailable("manpower");if(!this._host.game.diplomacy.get("lizards").unlocked&&t>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const i=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[i.title],"ks-upgrade"),t-=1e3,s.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("sharks").unlocked&&t>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const i=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[i.title],"ks-upgrade"),t-=1e3,s.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("griffins").unlocked&&t>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const i=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[i.title],"ks-upgrade"),t-=1e3,s.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("nagas").unlocked&&this._host.game.resPool.get("culture").value>=1500&&t>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const i=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[i.title],"ks-upgrade"),t-=1e3,s.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("zebras").unlocked&&this._host.game.resPool.get("ship").value>=1&&t>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const i=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[i.title],"ks-upgrade"),t-=1e3,s.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("spiders").unlocked&&p(this._host.game.resPool.get("ship")).value>=100&&p(this._host.game.resPool.get("science")).maxValue>125e3&&t>=1e3){p(this._host.game.resPool.get("manpower")).value-=1e3;const i=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[i.title],"ks-upgrade"),t-=1e3,s.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("dragons").unlocked&&this._host.game.science.get("nuclearFission").researched&&t>=1e3){p(this._host.game.resPool.get("manpower")).value-=1e3;const i=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[i.title],"ks-upgrade"),t-=1e3,s.requestGameUiRefresh=!0}}}autoTradeBlackcoin(){const s=this._host.game.calendar.cryptoPrice,e=this._host.game.resPool.get("relic").value,t=this._host.game.resPool.get("blackcoin").value;let i=0,n=0;if(s<this.settings.tradeBlackcoin.buy&&this.settings.tradeBlackcoin.trigger<e){this._host.game.diplomacy.buyBcoin();const a=this._host.game.resPool.get("blackcoin").value;i=Math.round(a-t),this._host.engine.iactivity("act.blackcoin.buy",[this._host.renderAbsolute(i)])}else if(s>this.settings.tradeBlackcoin.sell&&0<this._host.game.resPool.get("blackcoin").value){this._host.game.diplomacy.sellBcoin();const a=p(this._host.game.resPool.get("relic")).value;n=Math.round(a-e),this._host.engine.iactivity("act.blackcoin.sell",[this._host.renderAbsolute(n)])}}trade(s,e){var n;const t=this.getRace(s),i=this.getTradeButton(t.name);(!((n=i==null?void 0:i.model)!=null&&n.enabled)||!this.settings.races[s].enabled)&&console.warn(...v("KS trade checks are not functioning properly, please create an issue on the github page.")),this._host.game.diplomacy.tradeMultiple(t,e),this._host.engine.storeForSummary(t.title,e,"trade"),this._host.engine.iactivity("act.trade",[this._host.renderAbsolute(e),X(t.title)],"ks-trade")}getProfitability(s){const e=this.getRace(s);let t=0;const i=this.getMaterials(s);for(const[r,o]of q(i)){const l=this._workshopManager.getTickVal(this._workshopManager.getResource(r));if(l!=="ignore"){if(l<=0)return!1;t+=o/l}}let n=0;const a=this.getAverageTrade(e);for(const[r,o]of q(a)){const l=this._workshopManager.getResource(r),h=this._workshopManager.getTickVal(l);if(h!=="ignore"){if(h<=0)return!0;n+=0<l.maxValue?Math.min(o,Math.max(l.maxValue-l.value,0))/h:o/h}}return t<=n}getAverageTrade(s){const e=this._host.game.getEffect("standingRatio")+this._host.game.diplomacy.calculateStandingFromPolicies(s.name,this._host.game),t=1+s.energy*.02,i=1+this._host.game.diplomacy.getTradeRatio()+this._host.game.diplomacy.calculateTradeBonusFromPolicies(s.name,this._host.game),n=s.standing<0?s.standing+e:0,a=0<n?1+n:1,r=0<s.standing?Math.min(s.standing+e/2,1):0,o={};for(const d of s.sells){if(!this._isValidTrade(d,s)){o[d.name]=0;continue}let g=0;const f=s.embassyPrices?d.chance*(1+this._host.game.getLimitedDR(.01*s.embassyLevel,.75)):d.chance;if(s.name==="zebras"&&d.name==="titanium"){const w=this._host.game.resPool.get("ship").value,b=Math.min(.15+w*.0035,1);g=1.5*(1+w/50)*(a*b)}else{const w=d.seasons?1+d.seasons[this._host.game.calendar.getCurSeason().name]:1,b=(a-r)*Math.min(f/100,1),k=r*Math.min(f/100,1);g=(b+1.25*k)*d.value*t*w*i}o[d.name]=g}const l=s.embassyPrices?.35*(1+.01*s.embassyLevel):.35,h=a*Math.min(l,1);return o.spice=25*h+50*h*i/2,o.blueprint=.1*a,o}_isValidTrade(s,e){return!(s.minLevel&&e.embassyLevel<s.minLevel)&&(this._host.game.resPool.get(s.name).unlocked||s.name==="titanium"||s.name==="uranium"||e.name==="leviathans")}getLowestTradeAmount(s,e,t){let i;const n=this.getMaterials(s);let a;for(const[h,d]of q(n)){if(h==="manpower"){let g=d;this._host.game.challenges.isActive("postApocalypse")&&(g=d*(1+this._host.game.bld.getPollutionLevel())),a=this._workshopManager.getValueAvailable(h)/g}else if(h==="gold"){let g=d;this._host.game.challenges.isActive("postApocalypse")&&(g=d*(1+this._host.game.bld.getPollutionLevel())),a=this._workshopManager.getValueAvailable(h)/g}else a=this._workshopManager.getValueAvailable(h)/d;i=i===void 0||a<i?a:i}if(i=Math.floor(i??0),i===0)return 0;if(s===null||s==="leviathans")return i;const r=this.getRace(s);let o=0;const l=this.getAverageTrade(r);for(const h of r.sells){const d=this._workshopManager.getResource(h.name);let g=0;if(!d.maxValue)continue;g=p(l[h.name]);const f=Math.max((d.maxValue-d.value)/g,0);o=f<o?o:f}return o=Math.ceil(o),o===0?0:(i=o<i?Math.max(o-1,1):i,Math.floor(i))}getMaterials(s=null){const e={gold:15-this._host.game.getEffect("tradeGoldDiscount"),manpower:50-this._host.game.getEffect("tradeCatpowerDiscount")};if(m(s))return e;const t=this.getRace(s).buys;for(const i of t)e[i.name]=i.val;return e}getRace(s){const e=this._host.game.diplomacy.get(s);if(m(e))throw new Error(`Unable to retrieve race \'${s}\'`);return e}getTradeButton(s){const e=this.manager.tab.racePanels.find(t=>t.race.name===s);return(e==null?void 0:e.tradeBtn)??null}singleTradePossible(s,e,t,i){const n=i?oe.evaluateSubSectionTrigger(s,i.trigger):s;if(n<0&&i===void 0)return!0;if(n<0&&i!==void 0||e.value/e.maxValue<n||t.value/t.maxValue<n)return!1;const a=this.getMaterials(i==null?void 0:i.race);for(const[r,o]of q(a))if(this._workshopManager.getValueAvailable(r)<o)return!1;return!0}}class Kn{constructor(s){u(this,"_host");u(this,"_cache",new Array);u(this,"_cacheSum",{});this._host=s}pushToCache(s){this._cache.push(s);for(const[e,t]of q(s.materials))this._cacheSum[e]||(this._cacheSum[e]=0),this._cacheSum[e]+=t;for(let e=0;e<this._cache.length;++e){const t=this._cache[e];if(this._cache.length>1e4){const i=t.materials;for(const[n,a]of q(i))this._cacheSum[n]||(this._cacheSum[n]=0),this._cacheSum[n]-=a;this._cache.shift(),e--}else return}}getResValue(s){if(this._cache.length===0||!this._cacheSum[s])return 0;const e=this._host.game.timer.ticksTotal,t=this._cache[0].timeStamp;return this._cacheSum[s]/(e-t)}}class Vn{constructor(s,e,t=new bs){u(this,"_host");u(this,"settings");u(this,"manager");u(this,"_cacheManager");u(this,"_workshopManager");this._host=s,this.settings=t,this.manager=new me(this._host,"Village"),this._cacheManager=new Kn(this._host),this._workshopManager=e}tick(s){this.settings.enabled&&(this.autoDistributeKittens(),this.settings.hunt.enabled&&this.autoHunt(this._cacheManager),this.settings.holdFestivals.enabled&&this.autoFestival(this._cacheManager),this.settings.electLeader.enabled&&this.autoElect(),this.settings.promoteLeader.enabled&&this.autoPromoteLeader(),this.settings.promoteKittens.enabled&&this.autoPromoteKittens())}autoDistributeKittens(){const s=this._host.game.village.getFreeKittens();if(s){for(let e=0;e<s;++e){const t=new Array;for(const a of this._host.game.village.jobs){const r=this.settings.jobs[a.name].enabled,o=a.unlocked;if(!r||!o)continue;const l=this._host.game.village.getJobLimit(a.name),h=Y(this.settings.jobs[a.name].max),d=a.value;d<l&&d<h&&t.push({count:d,job:a,toCap:l-d})}if(!t.length)return;const i=!m(t.find(a=>a.job.name==="farmer"&&a.count===0));t.sort((a,r)=>a.count-r.count);const n=i?"farmer":t[0].job.name;this._host.game.village.assignJob(this._host.game.village.getJob(n),1),this.manager.render(),this._host.engine.iactivity("act.distribute",[this._host.engine.i18n(`$village.job.${n}`)],"ks-distribute")}this._host.engine.storeForSummary("distribute",s)}}autoElect(){if(this._host.game.challenges.isActive("anarchy"))return;const s=this._host.game.village.sim.kittens,e=this._host.game.village.leader,t=this.settings.electLeader.job.selected,i=this.settings.electLeader.trait.selected,n=s.filter(r=>(r.job===t||t==="any")&&r.trait.name===i);if(n.length===0)return;n.sort((r,o)=>o.rank-r.rank);const a=n[0];!m(e)&&e.trait.name===i&&(e.job===t||t==="any")&&a.rank<=e.rank||(this._host.game.village.makeLeader(a),this._host.engine.iactivity("act.elect"))}autoPromoteKittens(){const s=this._workshopManager.getResource("gold");if(!(this.settings.promoteKittens.trigger<s.value/s.maxValue))for(let e=0;e<this._host.game.village.sim.kittens.length;e++){let t=-1;const i=this._host.game.village.sim.kittens[e].engineerSpeciality;if(!m(i)&&(t=p(this._host.game.workshop.getCraft(i)).tier,!(t<=this._host.game.village.sim.kittens[e].rank))){this._host.game.village.promoteKittens();return}}}autoPromoteLeader(){var s,e;if(this._host.game.science.get("civil").researched&&this._host.game.village.leader!==null){const t=this._host.game.village.leader,i=t.rank,n=this._workshopManager.getResource("gold"),a=this._workshopManager.getStock("gold");this._host.game.village.sim.goldToPromote(i,i+1,n.value-a)[0]&&this._host.game.village.sim.promote(t,i+1)===1&&(this._host.engine.iactivity("act.promote",[i+1],"ks-promote"),(s=this._host.game.villageTab.censusPanel)==null||s.census.renderGovernment(this._host.game.villageTab.censusPanel.census.container),(e=this._host.game.villageTab.censusPanel)==null||e.census.update(),this._host.engine.storeForSummary("promote",1))}}autoHunt(s){const e=this._workshopManager.getResource("manpower"),t=this.settings.hunt.trigger;if(!(e.value<100||this._host.game.challenges.isActive("pacifism"))&&t<=e.value/e.maxValue&&100<=e.value){const i=Math.floor(e.value/100);this._host.engine.storeForSummary("hunt",i),this._host.engine.iactivity("act.hunt",[this._host.renderAbsolute(i)],"ks-hunt");const n=this._workshopManager.getAverageHunt(),a={};for(const[r,o]of q(n)){const l=this._workshopManager.getResource(r);a[r]=0<l.maxValue?Math.min(o*i,Math.max(l.maxValue-l.value,0)):o*i}m(s)||s.pushToCache({materials:a,timeStamp:this._host.game.timer.ticksTotal}),this._host.game.village.huntAll()}}autoFestival(s){if(!this._host.game.science.get("drama").researched||400<this._host.game.calendar.festivalDays||!this._host.game.prestige.getPerk("carnivals").researched&&0<this._host.game.calendar.festivalDays)return;const e=this._workshopManager;if(e.getValueAvailable("manpower")<1500||e.getValueAvailable("culture")<5e3||e.getValueAvailable("parchment")<2500)return;const t=4e3*e.getTickVal(e.getResource("manpower"),s,!0)>1500,i=4e3*e.getTickVal(e.getResource("culture"),s,!0)>5e3,n=4e3*e.getTickVal(e.getResource("parchment"),s,!0)>2500;if(!(!t&&!i&&!n)&&(this.manager.render(),this._host.game.villageTab.festivalBtn.model.enabled)){const a=this._host.game.calendar.festivalDays;this._host.game.villageTab.festivalBtn.onClick(),this._host.engine.storeForSummary("festival"),a>0?this._host.engine.iactivity("festival.extend",[],"ks-festival"):this._host.engine.iactivity("festival.hold",[],"ks-festival")}}}const ps={"de-DE":ln,"en-US":on,"he-IL":cn,"zh-CN":hn};class oe{constructor(s,e){u(this,"_i18nData");u(this,"_isLoaded",!1);u(this,"_host");u(this,"settings");u(this,"bonfireManager");u(this,"religionManager");u(this,"scienceManager");u(this,"spaceManager");u(this,"timeControlManager");u(this,"timeManager");u(this,"tradeManager");u(this,"villageManager");u(this,"workshopManager");u(this,"_activitySummary");u(this,"_timeoutMainLoop");this.settings=new cs,this._i18nData=ps,this.setLanguage(e,!1),this._host=s,this._activitySummary=new rn(this._host),this.workshopManager=new ei(this._host),this.bonfireManager=new an(this._host,this.workshopManager),this.religionManager=new un(this._host,this.bonfireManager,this.workshopManager),this.scienceManager=new pn(this._host,this.workshopManager),this.spaceManager=new wn(this._host,this.workshopManager),this.timeControlManager=new Wn(this._host,this.bonfireManager,this.religionManager,this.spaceManager,this.workshopManager),this.timeManager=new Gn(this._host,this.workshopManager),this.tradeManager=new Zn(this._host,this.workshopManager),this.villageManager=new Vn(this._host,this.workshopManager)}get isLoaded(){return this._isLoaded}isLanguageSupported(s){return Object.keys(this._i18nData).some(e=>e.startsWith(`${s}-`))}isLocaleSupported(s){return s in this._i18nData}localeSupportsFirstLetterSplits(s=this.settings.locale.selected){return s!=="zh-CN"}localeForLanguage(s){return Object.keys(this._i18nData).find(e=>e.startsWith(`${s}-`))}setLanguage(s,e=!0){const t=this.settings.locale.selected;if(!this.isLanguageSupported(s))console.warn(...v(`Requested language \'${s}\' is not available. Falling back to \'${Te}\'.`)),this.settings.locale.selected=Te;else{const i=p(this.localeForLanguage(s));console.info(...v(`Selecting language \'${i}\'.`)),this.settings.locale.selected=i}t!==this.settings.locale.selected&&e&&this._host.rebuildUi()}setLocale(s,e=!0){const t=this.settings.locale.selected;this.isLocaleSupported(s)?(console.info(...v(`Selecting language \'${s}\'.`)),this.settings.locale.selected=s):(console.warn(...v(`Requested language \'${s}\' is not available. Falling back to \'${Te}\'.`)),this.settings.locale.selected=Te),t!==this.settings.locale.selected&&e&&this._host.rebuildUi()}stateLoad(s,e=!1){this._isLoaded=!0,this.stop(!1);const t=Oe();s.v!==t&&console.warn(...v(`Attempting to load engine state with version tag \'${s.v}\' when engine is at version \'${t}\'!`));const i=(n,a)=>{try{n()}catch(r){console.error(...v(`Failed load of ${a} settings.`,r))}};i(()=>{this.settings.load(s.engine,e)},"engine"),i(()=>{this.bonfireManager.settings.load(s.bonfire)},"bonfire"),i(()=>{this.religionManager.settings.load(s.religion)},"religion"),i(()=>{this.scienceManager.settings.load(s.science)},"science"),i(()=>{this.spaceManager.settings.load(s.space)},"space"),i(()=>{this.timeControlManager.settings.load(s.timeControl)},"time control"),i(()=>{this.timeManager.settings.load(s.time)},"time"),i(()=>{this.tradeManager.settings.load(s.trade)},"trade"),i(()=>{this.villageManager.settings.load(s.village)},"village"),i(()=>{this.workshopManager.settings.load(s.workshop)},"workshop"),this.setLocale(this.settings.locale.selected),this.settings.enabled?this.start(!1):this.stop(!1)}static get DEFAULT_STATE(){return{bonfire:new Xt,engine:new cs,religion:new Yt,science:new Qt,space:new St,time:new ms,timeControl:new ds,trade:new fs,v:Oe(),village:new bs,workshop:new xt}}stateReset(){this.stateLoad(oe.DEFAULT_STATE)}stateSerialize(){return{bonfire:this.bonfireManager.settings,engine:this.settings,religion:this.religionManager.settings,science:this.scienceManager.settings,space:this.spaceManager.settings,time:this.timeManager.settings,timeControl:this.timeControlManager.settings,trade:this.tradeManager.settings,v:Oe(),village:this.villageManager.settings,workshop:this.workshopManager.settings}}start(s=!0){if(this._timeoutMainLoop)return;const e=()=>{const t={entry:Date.now(),exit:0,measurements:{},requestGameUiRefresh:!1};this._iterate(t).then(()=>{t.exit=Date.now();const i=t.exit-t.entry;document.dispatchEvent(new CustomEvent("ks.reportFrame",{detail:t})),this._timeoutMainLoop!==void 0&&(this._timeoutMainLoop=T.window.setTimeout(e,Math.max(10,this._host.engine.settings.interval-i)))}).catch(i=>{console.warn(...v(Hs(i)))})};this._timeoutMainLoop=T.window.setTimeout(e,this._host.engine.settings.interval),s&&this._host.engine.imessage("status.ks.enable")}stop(s=!0){this._timeoutMainLoop&&(clearTimeout(this._timeoutMainLoop),this._timeoutMainLoop=void 0,s&&this._host.engine.imessage("status.ks.disable"))}async _iterate(s){this.settings.filters.disableKGLog.enabled||this._maintainKGLogFilters();let[,e]=await vt(()=>this.scienceManager.tick(s));s.measurements.scienceManager=e,[,e]=ye(()=>{this.bonfireManager.tick(s)}),s.measurements.bonfireManager=e,[,e]=ye(()=>{this.spaceManager.tick(s)}),s.measurements.spaceManager=e,[,e]=await vt(()=>this.workshopManager.tick(s)),s.measurements.workshopManager=e,[,e]=ye(()=>{this.tradeManager.tick(s)}),s.measurements.tradeManager=e,[,e]=await vt(()=>this.religionManager.tick(s)),s.measurements.religionManager=e,[,e]=ye(()=>{this.timeManager.tick(s)}),s.measurements.timeManager=e,[,e]=ye(()=>{this.villageManager.tick(s)}),s.measurements.villageManager=e,[,e]=await vt(()=>this.timeControlManager.tick(s)),s.measurements.timeControlManager=e,[,e]=ye(()=>{s.requestGameUiRefresh&&this._host.game.ui.render()}),s.measurements.gameUiRefresh=e}_maintainKGLogFilters(){for(const e of Object.values(this._host.game.console.filters))e.enabled=!1;const s=T.window.document.querySelectorAll("[id^=filter-]");for(const e of s)e.checked=!1}symbolForCycle(s){var e;return((e=this._host.game.calendar.cycles.find(t=>t.name===s))==null?void 0:e.uglyph)??""}labelForCycle(s){const e=this.symbolForCycle(s),t=this._host.engine.i18n(`$space.planet.${s==="redmoon"?"moon":s}.label`);return`${e} ${t}`}labelForPlanet(s){const e=s==="moon"?"redmoon":s,t=we.includes(e)?e:void 0,i=this._host.engine.i18n(`$space.planet.${s}.label`);return t===void 0?i:`${this.symbolForCycle(t)} ${i}`}i18n(s,e=[]){let t;if(s.startsWith("$")&&(t=this._host.i18nEngine(s.slice(1))),t=t??this._i18nData[this.settings.locale.selected][s],m(t)){if(t=ps[Te][s],!t)return console.warn(...v(`i18n key \'${s}\' not found in default language.`)),`$${s}`;console.warn(...v(`i18n key \'${s}\' not found in selected language.`))}for(let n=0;n<e.length;++n)t=t.replace(`{${n}}`,`${e[n]}`);return t}iactivity(s,e=[],t){const i=this.i18n(s,e);if(t){const n=`type_${t}`;this._printOutput(`ks-activity ${n}`,"#e65C00",i)}else this._printOutput("ks-activity","#e65C00",i)}imessage(s,e=[]){this._printOutput("ks-default","#aa50fe",this.i18n(s,e))}storeForSummary(s,e=1,t="other"){this._activitySummary.storeActivity(s,e,t)}getSummary(){return this._activitySummary.renderSummary()}displayActivitySummary(){const s=this.getSummary();for(const e of s)this._printOutput("ks-summary","#009933",e);this.resetActivitySummary()}resetActivitySummary(){this._activitySummary.resetActivity()}_printOutput(s,e,t){if(this.settings.filters.enabled){for(const n of Object.values(this.settings.filters.filters))if(n.variant===s&&!n.enabled)return}const i=this._host.game.msg(t,s);$(i.span).css("color",e),console.debug(...v(t))}static evaluateSubSectionTrigger(s,e){return s<0?e:e<0?s:e}}const vs=c=>Number.isFinite(c)?c:0,jn=c=>({days:Math.trunc(c/864e5),hours:Math.trunc(c/36e5%24),minutes:Math.trunc(c/6e4%60),seconds:Math.trunc(c/1e3%60),milliseconds:Math.trunc(c%1e3),microseconds:Math.trunc(vs(c*1e3)%1e3),nanoseconds:Math.trunc(vs(c*1e6)%1e3)}),Jn=c=>({days:c/86400000n,hours:c/3600000n%24n,minutes:c/60000n%60n,seconds:c/1000n%60n,milliseconds:c%1000n,microseconds:0n,nanoseconds:0n}),Xn=c=>{switch(typeof c){case"number":{if(Number.isFinite(c))return jn(c);break}case"bigint":return Jn(c)}throw new TypeError("Expected a finite number or bigint")},Yn=c=>c===0||c===0n,Qn=(c,s)=>s===1||s===1n?c:`${c}s`,ea=1e-7,ta=24n*60n*60n*1000n,ia=(c,s={colonNotation:!1,compact:!1,formatSubMilliseconds:!1,keepDecimalsOnWholeSeconds:!1,millisecondsDecimalDigits:0,secondsDecimalDigits:1,separateMilliseconds:!1,unitCount:1/0,verbose:!1})=>{const e=typeof c=="bigint";if(!e&&!Number.isFinite(c))throw new TypeError("Expected a finite number or bigint");const t={...s};t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let i=[];const n=(h,d)=>{const g=Math.floor(h*10**d+ea);return(Math.round(g)/10**d).toFixed(d)},a=(h,d,g,f)=>{if(!((i.length===0||!t.colonNotation)&&Yn(h)&&!(t.colonNotation&&g==="m"))){if(f??(f=String(h)),t.colonNotation){const w=f.includes(".")?f.split(".")[0].length:f.length,b=i.length>0?2:1;f="0".repeat(Math.max(0,b-w))+f}else f+=t.verbose?" "+Qn(d,h):g;i.push(f)}},r=Xn(c),o=BigInt(r.days);if(a(o/365n,"year","y"),a(o%365n,"day","d"),a(Number(r.hours),"hour","h"),a(Number(r.minutes),"minute","m"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&c<1e3){const h=Number(r.seconds),d=Number(r.milliseconds),g=Number(r.microseconds),f=Number(r.nanoseconds);if(a(h,"second","s"),t.formatSubMilliseconds)a(d,"millisecond","ms"),a(g,"microsecond","µs"),a(f,"nanosecond","ns");else{const w=d+g/1e3+f/1e6,b=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,k=w>=1?Math.round(w):Math.ceil(w),y=b?w.toFixed(b):k.toString();a(Number.parseFloat(y),"millisecond","ms",y)}}else{const h=(e?Number(c%ta):c)/1e3%60,d=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,g=n(h,d),f=t.keepDecimalsOnWholeSeconds?g:g.replace(/\\.0+$/,"");a(Number.parseFloat(f),"second","s",f)}if(i.length===0)return"0"+(t.verbose?" milliseconds":"ms");const l=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(i=i.slice(0,Math.max(t.unitCount,1))),i.join(l)},B={Bonfire:"M80-80v-183l363-491-67-90 49-35 55 75 56-75 48 35-66 90 362 491v183H80Zm400-623L140-243v103h145l195-273 195 273h145v-103L480-703ZM359-140h242L480-310 359-140Zm121-273 195 273-195-273-195 273 195-273Z",CheckboxCheck:"m419-321 289-289-43-43-246 246-119-119-43 43 162 162ZM120-120v-720h720v720H120Zm60-60h600v-600H180v600Zm0 0v-600 600Z",CheckboxUnCheck:"M120-120v-720h720v720H120Zm60-60h600v-600H180v600Z",Copy:"M240-200v-680h560v680H240Zm60-60h440v-560H300v560ZM120-80v-680h60v620h500v60H120Zm180-180v-560 560Z",Cycles:"M120-80v-740h125v-60h65v60h340v-60h65v60h125v360h-60v-110H180v430h324v60H120ZM760 0q-73 0-127.5-45.5T564-160h62q13 44 49.5 72T760-60q58 0 99-41t41-99q0-58-41-99t-99-41q-29 0-54 10.5T662-300h58v60H560v-160h60v57q27-26 63-41.5t77-15.5q83 0 141.5 58.5T960-200q0 83-58.5 141.5T760 0ZM180-630h600v-130H180v130Zm0 0v-130 130Z",DataUsage:"M480-80q-82 0-155-31.5T197.5-197q-54.5-54-86-127T80-479q0-158 106.5-272T451-877v102q-115 11-192 95.5T182-479q0 124 87 210.5T480-182q72 0 136-32.5T725-306l88 51q-58 83-145.5 129T480-80Zm362-229-88-49q12-31 18-61.5t6-60.5q0-116-76.5-201T511-776v-102q157 11 263 124.5T880-484q0 45-9.5 88.5T842-309Z",Delete:"M201-120v-630h-41v-60h188v-30h264v30h188v60h-41v630H201Zm60-60h438v-570H261v570Zm106-86h60v-399h-60v399Zm166 0h60v-399h-60v399ZM261-750v570-570Z",Draft:"M160-80v-800h421l219 219v581H160Zm391-554v-186H220v680h520v-494H551ZM220-820v186-186 680-680Z",Eco:"M213-175q-43.59-45-68.3-104Q120-338 120-400q0-73 25.5-133.5T222-645q35-35 87-59t122.5-37.5Q502-755 591-758.5t198 3.5q8 108 5.5 197.5t-16 160.75q-13.5 71.25-38 124.56Q716-218.87 680-183q-51 51-110 77T444-80q-69 0-126.5-23.5T213-175Zm103 0q25 17 58 26t69.92 9Q497-140 547-162t91-64q27-27 46-70.5t31-103Q727-459 731-534t0-165q-94-2-168.5 2.5T431-680q-57 12-98 30.5T266-604q-42 43-64 91t-22 98q0 48 20.5 100.5T251-230q53-98 127-176t157-123q-87 75-141 162.5T316-175Zm0 0Zm0 0Z",Edit:"M180-180h44l472-471-44-44-472 471v44Zm-60 60v-128l617-616 128 128-617 616H120Zm659-617-41-41 41 41Zm-105 64-22-22 44 44-22-22Z",ExpandCircleDown:"m480-351 173-173-43-42-130 130-130-130-43 42 173 173Zm0 271q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-156t86-127Q252-817 325-848.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82-31.5 155T763-197.5q-54 54.5-127 86T480-80Zm0-60q142 0 241-99.5T820-480q0-142-99-241t-241-99q-141 0-240.5 99T140-480q0 141 99.5 240.5T480-140Zm0-340Z",ExpandCircleUp:"m350-394 130-130 130 130 43-42-173-173-173 173 43 42ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-155.5t85.5-127q54-54.5 127-86T480-880q83 0 155.5 31.5t127 86q54.5 54.5 86 127T880-480q0 83-31.5 156t-86 127q-54.5 54-127 85.5T480-80Zm0-60q141 0 240.5-99T820-480q0-141-99.5-240.5T480-820q-142 0-241 99.5T140-480q0 142 99 241t241 99Zm0-340Z",Import:"M450-160v-371L330-411l-43-43 193-193 193 193-43 43-120-120v371h-60ZM160-597v-203h640v203h-60v-143H220v143h-60Z",Religion:"M40-120v-560q0-45.83 32.12-77.92 32.12-32.08 78-32.08T228-757.92q32 32.09 32 77.92v31l220-191 220 191v-31q0-45.83 32.12-77.92 32.12-32.08 78-32.08T888-757.92q32 32.09 32 77.92v560H530v-250H430v250H40Zm720-510h100v-49.82q0-21.18-14.32-35.68-14.33-14.5-35.5-14.5-21.18 0-35.68 14.37Q760-701.25 760-680v50Zm-660 0h100v-49.82q0-21.18-14.32-35.68-14.33-14.5-35.5-14.5-21.18 0-35.68 14.37Q100-701.25 100-680v50Zm0 450h100v-390H100v390Zm160 0h110v-250h220v250h110v-390L480-761 260-570v390Zm500 0h100v-390H760v390ZM479.94-505Q457-505 441-521.06q-16-16.06-16-39T441.06-599q16.06-16 39-16T519-598.94q16 16.06 16 39T518.94-521q-16.06 16-39 16Z",Reset:"M480-160q-133 0-226.5-93.5T160-480q0-133 93.5-226.5T480-800q85 0 149 34.5T740-671v-129h60v254H546v-60h168q-38-60-97-97t-137-37q-109 0-184.5 75.5T220-480q0 109 75.5 184.5T480-220q83 0 152-47.5T728-393h62q-29 105-115 169t-195 64Z",Resources:"M120-40v-880h60v80h600v-80h60v880h-60v-80H180v80h-60Zm60-469h110v-160h220v160h270v-271H180v271Zm0 329h270v-160h220v160h110v-269H180v269Zm170-329h100v-100H350v100Zm160 329h100v-100H510v100ZM350-509h100-100Zm160 329h100-100Z",Save:"M840-683v563H120v-720h563l157 157Zm-60 27L656-780H180v600h600v-476ZM479.76-245q43.24 0 73.74-30.26 30.5-30.27 30.5-73.5 0-43.24-30.26-73.74-30.27-30.5-73.5-30.5-43.24 0-73.74 30.26-30.5 30.27-30.5 73.5 0 43.24 30.26 73.74 30.27 30.5 73.5 30.5ZM233-584h358v-143H233v143Zm-53-72v476-600 124Z",SaveAs:"M120-120v-720h563l157 157v117l-60 60v-150L656-780H180v600h280v60H120Zm60-660v600-600ZM520-40v-123l263-262 122 122L643-40H520Zm300-263-37-37 37 37ZM580-100h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19ZM233-584h358v-143H233v143Zm247 339q14 0 27-3t24-10l39-40q7-11 10.5-24t3.5-27q0-43.33-30.26-73.67Q523.47-453 480.24-453q-43.24 0-73.74 30.26-30.5 30.27-30.5 73.5 0 43.24 30.33 73.74Q436.67-245 480-245Z",Seasons:"M306-394q-17 0-28.5-11.5T266-434q0-17 11.5-28.5T306-474q17 0 28.5 11.5T346-434q0 17-11.5 28.5T306-394Zm177 0q-17 0-28.5-11.5T443-434q0-17 11.5-28.5T483-474q17 0 28.5 11.5T523-434q0 17-11.5 28.5T483-394Zm170 0q-17 0-28.5-11.5T613-434q0-17 11.5-28.5T653-474q17 0 28.5 11.5T693-434q0 17-11.5 28.5T653-394ZM120-80v-740h125v-60h65v60h340v-60h65v60h125v740H120Zm60-60h600v-430H180v430Zm0-490h600v-130H180v130Zm0 0v-130 130Z",Settings:"m388-80-20-126q-19-7-40-19t-37-25l-118 54-93-164 108-79q-2-9-2.5-20.5T185-480q0-9 .5-20.5T188-521L80-600l93-164 118 54q16-13 37-25t40-18l20-127h184l20 126q19 7 40.5 18.5T669-710l118-54 93 164-108 77q2 10 2.5 21.5t.5 21.5q0 10-.5 21t-2.5 21l108 78-93 164-118-54q-16 13-36.5 25.5T592-206L572-80H388Zm48-60h88l14-112q33-8 62.5-25t53.5-41l106 46 40-72-94-69q4-17 6.5-33.5T715-480q0-17-2-33.5t-7-33.5l94-69-40-72-106 46q-23-26-52-43.5T538-708l-14-112h-88l-14 112q-34 7-63.5 24T306-642l-106-46-40 72 94 69q-4 17-6.5 33.5T245-480q0 17 2.5 33.5T254-413l-94 69 40 72 106-46q24 24 53.5 41t62.5 25l14 112Zm44-210q54 0 92-38t38-92q0-54-38-92t-92-38q-54 0-92 38t-38 92q0 54 38 92t92 38Zm0-130Z",Space:"m187-551 106 45q18-36 38.5-71t43.5-67l-79-16-109 109Zm154 81 133 133q57-26 107-59t81-64q81-81 119-166t41-192q-107 3-192 41T464-658q-31 31-64 81t-59 107Zm229-96q-20-20-20-49.5t20-49.5q20-20 49.5-20t49.5 20q20 20 20 49.5T669-566q-20 20-49.5 20T570-566Zm-15 383 109-109-16-79q-32 23-67 43.5T510-289l45 106Zm326-694q9 136-34 248T705-418l-2 2-2 2 22 110q3 15-1.5 29T706-250L535-78l-85-198-170-170-198-85 172-171q11-11 25-15.5t29-1.5l110 22q1-1 2-1.5t2-1.5q99-99 211-142.5T881-877ZM149-325q35-35 85.5-35.5T320-326q35 35 34.5 85.5T319-155q-26 26-80.5 43T75-80q15-109 31.5-164t42.5-81Zm42 43q-14 15-25 47t-19 82q50-8 82-19t47-25q19-17 19.5-42.5T278-284q-19-18-44.5-17.5T191-282Z",State:"M820-240v-480h60v480h-60Zm-340 1-43-42 169-169H80v-60h526L438-679l42-42 241 241-241 241Z",Summary:"M279-621h60v-60h-60v60Zm0 171h60v-60h-60v60Zm0 171h60v-60h-60v60ZM120-120v-720h522l198 198v522H120Zm60-60h600v-429H609v-171H180v600Zm0-600v171.43V-780v600-600Z",Sync:"M167-160v-60h130l-15-12q-64-51-93-111t-29-134q0-106 62.5-190.5T387-784v62q-75 29-121 96.5T220-477q0 63 23.5 109.5T307-287l30 21v-124h60v230H167Zm407-15v-63q76-29 121-96.5T740-483q0-48-23.5-97.5T655-668l-29-26v124h-60v-230h230v60H665l15 14q60 56 90 120t30 123q0 106-62 191T574-175Z",Time:"m627-287 45-45-159-160v-201h-60v225l174 181ZM480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-82 31.5-155t86-127.5Q252-817 325-848.5T480-880q82 0 155 31.5t127.5 86Q817-708 848.5-635T880-480q0 82-31.5 155t-86 127.5Q708-143 635-111.5T480-80Zm0-400Zm0 340q140 0 240-100t100-240q0-140-100-240T480-820q-140 0-240 100T140-480q0 140 100 240t240 100Z",Trigger:"m393-165 279-335H492l36-286-253 366h154l-36 255Zm-73 85 40-280H160l360-520h80l-40 320h240L400-80h-80Zm154-396Z",Workshop:"M768-120 517-371l57-57 251 251-57 57Zm-581 0-57-57 290-290-107-107-23 23-44-44v85l-24 24-122-122 24-24h86l-48-48 131-131q17-17 37-23t44-6q24 0 44 8.5t37 25.5L348-699l48 48-24 24 104 104 122-122q-8-13-12.5-30t-4.5-36q0-53 38.5-91.5T711-841q15 0 25.5 3t17.5 8l-85 85 75 75 85-85q5 8 8.5 19.5T841-709q0 53-38.5 91.5T711-579q-18 0-31-2.5t-24-7.5L187-120Z"},gt=class gt{constructor(s,e){u(this,"componentId");u(this,"host");u(this,"parent");u(this,"options");u(this,"_element");u(this,"children",new Set);u(this,"_needsRefresh");this.componentId=gt.nextComponentId++,this.host=s.host,this.options=e,this.parent=s instanceof gt?s:null,this._needsRefresh=!1}set element(s){this._element=s,this._element[0].id=`KS${Object.getPrototypeOf(this).constructor.name}#${this.componentId}`}get element(){return p(this._element)}requestRefresh(s=!1,e=0,t=!1){var i,n,a;if(t&&console.debug(...v(e<0?"⤒".repeat(e*-1):" ".repeat(e),this.toString(),"requestRefresh()")),(n=(i=this.options)==null?void 0:i.onRefreshRequest)==null||n.call(this),this.parent!==this&&!s&&((a=this.parent)==null||a.requestRefresh(!1,e-1,t)),this._needsRefresh&&t&&console.debug(...v(e<0?"⤒".repeat(e*-1):" ".repeat(e),this.toString(),"requestRefresh() <already pending>")),this._needsRefresh=!0,s){t&&console.debug(...v(e<0?"⤒".repeat(e*-1):" ".repeat(e),this.toString(),"requestRefresh()",`+ ${this.children.size} children`));for(const r of this.children)r.requestRefresh(!0,e+1,t)}else t&&console.debug(...v(e<0?"⤒".repeat(e*-1):" ".repeat(e),this.toString(),"requestRefresh()","<queued>"))}refresh(s=!1,e=0){var t,i;if(!s&&!this._needsRefresh){e===0&&console.debug(...v(this.toString(),"refresh() received and ignored."));return}(i=(t=this.options)==null?void 0:t.onRefresh)==null||i.call(this);for(const n of this.children)n.refresh(s,e+1);this._needsRefresh=!1}addChild(s){return s.parent=this,this.children.add(s),this.element.append(s.element),this}addChildren(s){for(const e of s??[])this.addChild(e);return this}removeChild(s){this.children.has(s)&&(s.element.remove(),this.children.delete(s))}removeChildren(s){for(const e of s)this.removeChild(e)}};u(gt,"nextComponentId",0);let W=gt;class R extends W{constructor(s,e){super(s,{...e}),this.element=$("<div/>");for(const t of(e==null?void 0:e.classes)??[])this.element.addClass(t)}toString(){return`[${R.name}#${this.componentId}]`}}const M={label:"_label_1nlev_1",splitter:"_splitter_1nlev_16",iconLabel:"_iconLabel_1nlev_20",fillSpace:"_fillSpace_1nlev_26"},ke={delimiter:"_delimiter_16hnh_1"};class ue extends W{constructor(s,e){super(s,{...e}),this.element=$("<li/>");for(const t of(e==null?void 0:e.classes)??[])this.element.addClass(t);(e==null?void 0:e.delimiter)===!0&&this.element.addClass(ke.delimiter)}toString(){return`[${ue.name}#${this.componentId}]`}}const Et={head:"_head_wr1pj_1"};class de extends ue{constructor(e,t,i){super(e,i);u(this,"head");u(this,"elementLabel");if(this.head=new R(e),this.head.element.addClass(Et.head),this.addChild(this.head),this.elementLabel=$("<label/>",{text:`${(i==null?void 0:i.upgradeIndicator)===!0?"⮤ ":""}${t}`}).addClass(M.label).addClass(Et.label),this.head.element.append(this.elementLabel),i!=null&&i.icon){const n=$("<div/>",{html:`<svg style="width: 15px; height: 15px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${i.icon}"/></svg>`}).addClass(M.iconLabel);this.elementLabel.prepend(n)}}toString(){return`[${de.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}addChildHead(e){return this.head.addChild(e),this}addChildrenHead(e){for(const t of e??[])this.head.addChild(t);return this}}const O={setting:"_setting_1ndg5_1",checkbox:"_checkbox_1ndg5_6",panelContent:"_panelContent_1ndg5_10",hidden:"_hidden_1ndg5_17",checked:"_checked_1ndg5_22",expanded:"_expanded_1ndg5_26",readonly:"_readonly_1ndg5_34"};class S extends de{constructor(e,t,i,n){super(e,i,{...n,onRefresh:()=>{var o;this.setting.enabled?this.element.addClass(O.checked):this.element.removeClass(O.checked),this.readOnly?this.element.addClass(O.readonly):this.element.removeClass(O.readonly),m(this.checkbox)||(this.checkbox.prop("checked",this.setting.enabled),this.checkbox.prop("disabled",this.readOnly)),(o=n==null?void 0:n.onRefresh)==null||o.call(n)}});u(this,"setting");u(this,"checkbox");u(this,"readOnly");this.element.addClass(O.setting);const a=`ks-setting${this.componentId}`,r=$("<input/>",{id:a,type:"checkbox"}).addClass(O.checkbox);this.readOnly=(n==null?void 0:n.readOnly)??!1,r.prop("disabled",this.readOnly),r.on("change",o=>{r.is(":checked")&&!t.enabled?this.check().catch(se(console)):!r.is(":checked")&&t.enabled&&this.uncheck().catch(se(console))}),this.elementLabel.before(r),this.elementLabel.prop("for",a),this.checkbox=r,this.setting=t}toString(){return`[${S.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}async check(e=!1){var t,i;this.setting.enabled=!0,await((i=(t=this.options)==null?void 0:t.onCheck)==null?void 0:i.call(e)),this.requestRefresh()}async uncheck(e=!1){var t;this.setting.enabled=!1,await((t=this.options.onUnCheck)==null?void 0:t.call(e)),this.requestRefresh()}}const C={iconButton:"_iconButton_q7zpt_17",inactive:"_inactive_q7zpt_29",ineffective:"_ineffective_q7zpt_37",button:"_button_q7zpt_43",readonly:"_readonly_q7zpt_67",buttonIcon:"_buttonIcon_q7zpt_72",alignRight:"_alignRight_q7zpt_77",large:"_large_q7zpt_81",bordered:"_bordered_q7zpt_85",headAction:"_headAction_q7zpt_97",lastHeadAction:"_lastHeadAction_q7zpt_100",consumeButton:"_consumeButton_q7zpt_104",stockButton:"_stockButton_q7zpt_107"};class ie extends W{constructor(e,t,i,n){super(e,{...n,onRefresh:()=>{var a;this.readOnly?this.element.addClass(C.readonly):this.element.removeClass(C.readonly),this.inactive?this.element.addClass(C.inactive):this.element.removeClass(C.inactive),(a=n==null?void 0:n.onRefresh)==null||a.call(n)}});u(this,"readOnly");u(this,"inactive");this.element=$("<div/>",{html:`<svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${t}"/></svg>`,title:i}).addClass(C.iconButton),this.readOnly=(n==null?void 0:n.readOnly)??!1,this.inactive=(n==null?void 0:n.inactive)??!1,this.element.on("click",()=>{this.readOnly||this.click().catch(se(console))})}toString(){return`[${ie.name}#${this.componentId}]`}async click(){var e,t;this.readOnly||(await((t=(e=this.options)==null?void 0:e.onClick)==null?void 0:t.call(this)),this.requestRefresh())}}const Rt={listContainer:"_listContainer_1kxbq_1",itemsList:"_itemsList_1kxbq_5",list:"_list_1kxbq_1",listTools:"_listTools_1kxbq_9"};class x extends W{constructor(e,t){super(e,{...t});u(this,"list");u(this,"disableAllButton");u(this,"enableAllButton");u(this,"resetButton");const i={hasDisableAll:!0,hasEnableAll:!0,...t},n=i.hasDisableAll||i.hasEnableAll||!m(i.onReset);if(this.element=$("<div/>").addClass(Rt.listContainer),this.list=$("<ul/>").addClass(Rt.list).addClass(Rt.itemsList),this.element.append(this.list),n){const a=new R(this,{classes:[Rt.listTools]});i.hasEnableAll&&(this.enableAllButton=new ie(e,B.CheckboxCheck,e.host.engine.i18n("ui.enable.all"),{onClick:async()=>{var l;const o=new Event("enableAll",{cancelable:!0});if(this.element[0].dispatchEvent(o),!o.defaultPrevented){for(const h of this.children)N(h,S)&&await h.check(!0);(l=t==null?void 0:t.onEnableAll)==null||l.call(this)}}}),a.addChild(this.enableAllButton)),i.hasDisableAll&&(this.disableAllButton=new ie(e,B.CheckboxUnCheck,e.host.engine.i18n("ui.disable.all"),{onClick:async()=>{var l;const o=new Event("disableAll",{cancelable:!0});if(this.element[0].dispatchEvent(o),!o.defaultPrevented){for(const h of this.children)N(h,S)&&await h.uncheck(!0);(l=t==null?void 0:t.onDisableAll)==null||l.call(this)}}}),a.addChild(this.disableAllButton));const r=i.onReset;m(r)||(this.resetButton=new ie(e,B.Reset,e.host.engine.i18n("ui.reset"),{onClick:()=>{r()}}),a.addChild(this.resetButton)),super.addChild(a)}}toString(){return`[${x.name}#${this.componentId}]`}addChild(e){return e.parent=this,this.children.add(e),this.list.append(e.element),this}}const Ae={expandoButton:"_expandoButton_l1ukp_1",expanded:"_expanded_l1ukp_1",up:"_up_l1ukp_1",down:"_down_l1ukp_4"};class Mt extends W{constructor(e,t){super(e,{...t,onRefresh:()=>{var i;this.ineffective?this.element.addClass(C.ineffective):this.element.removeClass(C.ineffective),(i=t==null?void 0:t.onRefresh)==null||i.call(t)}});u(this,"readOnly");u(this,"inactive");u(this,"ineffective");this.element=$("<div/>",{html:`\n <svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor" class="${Ae.down}"><path d="${B.ExpandCircleDown}"/></svg>\n <svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor" class="${Ae.up}"><path d="${B.ExpandCircleUp}"/></svg>\n `,title:e.host.engine.i18n("ui.itemsShow")}).addClass(C.iconButton).addClass(Ae.expandoButton),this.element.on("click",()=>{this.readOnly||this.click().catch(se(console))}),this.readOnly=(t==null?void 0:t.readOnly)??!1,this.inactive=(t==null?void 0:t.inactive)??!1,this.ineffective=!1}toString(){return`[${Mt.name}#${this.componentId}]`}setCollapsed(){this.element.removeClass(Ae.expanded),this.element.prop("title",this.host.engine.i18n("ui.itemsShow"))}setExpanded(){this.element.addClass(Ae.expanded),this.element.prop("title",this.host.engine.i18n("ui.itemsHide"))}async click(){var e,t;this.readOnly||(await((t=(e=this.options)==null?void 0:e.onClick)==null?void 0:t.call(this)),this.requestRefresh())}}class _e extends W{constructor(e,t,i){super(e,i);u(this,"container");u(this,"expando");u(this,"head");u(this,"_mainChildVisible");this.head=t,this.container=new R(this),this.container.element.addClass(O.panelContent);const n=new Mt(e,{onClick:()=>this.toggle()});t.head.addChild(n),t.element.append(this.container.element),i!=null&&i.initiallyExpanded?(this.container.element.removeClass(O.hidden),n.setExpanded()):this.container.element.addClass(O.hidden),this._mainChildVisible=(i==null?void 0:i.initiallyExpanded)??!1,this.element=t.element,this.expando=n,this.addChildren([this.head,this.container])}get isExpanded(){return this._mainChildVisible}toString(){return`[${_e.name}#${this.componentId}]`}addChildHead(e){return this.head.addChild(e),this}addChildrenHead(e){for(const t of e??[])this.head.addChild(t);return this}addChildContent(e){return this.container.addChild(e),this}addChildrenContent(e){for(const t of e??[])this.container.addChild(t);return this}toggle(e=void 0,t=!1){const i=e!==void 0?e:!this._mainChildVisible;if(i!==this._mainChildVisible&&(this._mainChildVisible=i,this._mainChildVisible?(this.container.requestRefresh(!0),this.container.element.removeClass(O.hidden),this.expando.setExpanded(),this.head.element.addClass(O.expanded),this.element[0].dispatchEvent(new CustomEvent("panelShown"))):(this.container.element.addClass(O.hidden),this.expando.setCollapsed(),this.head.element.removeClass(O.expanded),this.element[0].dispatchEvent(new CustomEvent("panelHidden")))),t){const n=a=>{for(const r of a)N(r,_e)?r.toggle(e,t):n(r.children)};n(this.children)}}}class U extends _e{constructor(e,t,i,n){super(e,i,n);u(this,"setting");u(this,"settingItem");this.element=i.element,this.settingItem=i,this.setting=t}get isExpanded(){return this._mainChildVisible}get elementLabel(){return this.head.element}get readOnly(){return!0}set readOnly(e){}async check(){this.setting.enabled=!0,this.requestRefresh()}async uncheck(){this.setting.enabled=!1,this.requestRefresh()}toString(){return`[${U.name}#${this.componentId}]: \'${this.settingItem.elementLabel.text()}\'`}}class sa extends U{constructor(s,e,t,i){const n=s.host.engine.i18n("ui.upgrade.buildings");super(s,e,new S(s,e,n,{onCheck:o=>{s.host.engine.imessage("status.auto.enable",[n])},onUnCheck:o=>{s.host.engine.imessage("status.auto.disable",[n])}}).addChildrenHead([new R(s,{classes:[M.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=i.enabled&&e.enabled&&!Object.values(e.buildings).some(o=>o.enabled)}});const a=[];for(const o of Object.values(this.setting.buildings)){const l=this.host.engine.i18n(`$buildings.${o.upgrade}.label`),h=new S(this,o,l,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[l])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[l])}});a.push({button:h,label:l})}a.sort((o,l)=>o.label.localeCompare(l.label));const r=new x(this);for(const o of a)r.addChild(o.button);this.addChildContent(r)}}class J extends W{constructor(e,t,i=null,n){super(e,{...n,onRefresh:()=>{var a;this.readOnly?this.element.addClass(C.readonly):this.element.removeClass(C.readonly),this.inactive?this.element.addClass(C.inactive):this.element.removeClass(C.inactive),this.ineffective?this.element.addClass(C.ineffective):this.element.removeClass(C.ineffective),(a=n==null?void 0:n.onRefresh)==null||a.call(n)}});u(this,"_iconElement");u(this,"readOnly");u(this,"inactive");u(this,"ineffective");this.element=$("<div/>",{title:n==null?void 0:n.title}).addClass(C.button).text(t),(n==null?void 0:n.border)!==!1&&this.element.addClass(C.bordered),(n==null?void 0:n.alignment)==="right"&&this.element.addClass(C.alignRight),i!==null&&(this._iconElement=$(`<svg class="${C.buttonIcon}" style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${i}"/></svg>`),(n==null?void 0:n.alignment)==="right"?this.element.append(this._iconElement):this.element.prepend(this._iconElement));for(const a of(n==null?void 0:n.classes)??[])this.element.addClass(a);this.element.on("click",()=>{this.readOnly||this.click().catch(se(console))}),this.readOnly=(n==null?void 0:n.readOnly)??!1,this.inactive=(n==null?void 0:n.inactive)??!1,this.ineffective=!1}toString(){return`[${J.name}#${this.componentId}]`}updateLabel(e){this.element.text(e),this._iconElement!==void 0&&(this.options.alignment==="right"?this.element.append(this._iconElement):this.element.prepend(this._iconElement))}updateTitle(e){this.element.prop("title",e)}async click(){var e,t;this.readOnly||(await((t=(e=this.options)==null?void 0:e.onClick)==null?void 0:t.call(this)),this.requestRefresh())}}class te extends W{constructor(s){super(s,{}),this.element=$("<div/>").addClass(ke.delimiter)}toString(){return`[${te.name}#${this.componentId}]`}}const ys={dialog:"_dialog_1276o_1",close:"_close_1276o_7"},ws={explainer:"_explainer_1idu3_1"},na={header:"_header_19ql8_1"};class D extends W{get elementLabel(){return this.element}constructor(s,e,t){super(s,{...t}),this.element=$("<li/>",{text:e}).addClass(na.header)}toString(){return`[${D.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class ti extends W{constructor(s,e){super(s,{...e}),this.element=$(\'<input type="text"/>\').addClass("ks-input");for(const t of(e==null?void 0:e.classes)??[])this.element.addClass(t);e!=null&&e.onChange&&this.element.on("change",()=>{var t;return(t=e.onChange)==null?void 0:t.call(e,this.element[0].value)}),e!=null&&e.value&&(this.element[0].value=e.value),e!=null&&e.selected&&(this.element[0].selectionStart=0,this.element[0].selectionEnd=-1),this.element.on("keyup",t=>{var i,n;switch(t.key){case"Enter":(i=e==null?void 0:e.onEnter)==null||i.call(e,this.element[0].value);break;case"Escape":(n=e==null?void 0:e.onEscape)==null||n.call(e,this.element[0].value);break}})}toString(){return`[${ti.name}#${this.componentId}]`}}class Bt extends W{constructor(s,e,t){super(s,{...t}),this.element=$("<p/>").text(e);for(const i of(t==null?void 0:t.classes)??[])this.element.addClass(i)}toString(){return`[${Bt.name}#${this.componentId}]`}}const ks={toolbar:"_toolbar_1654f_1"};class E extends W{constructor(e,t){super(e,{...t});u(this,"container");u(this,"head");u(this,"returnValue");this.element=$("<dialog/>").addClass("dialog").addClass("help").addClass(ys.dialog),(t==null?void 0:t.hasClose)!==!1&&this.addChild(new J(e,"close",null,{classes:[ys.close],onClick:()=>{var i;this.close(),(i=t==null?void 0:t.onCancel)==null||i.call(t)}})),this.returnValue=(t==null?void 0:t.promptValue)??"",this.head=new R(e),this.container=new R(e),this.addChildren(ft([this.head,t!=null&&t.prompt?new ti(e,{onChange:i=>{this.returnValue=i},onEnter:i=>{var n;this.returnValue=i,this.close(),(n=t.onConfirm)==null||n.call(t,this.returnValue)},onEscape:i=>{var n;this.close(),(n=t.onCancel)==null||n.call(t)},selected:!0,value:t.promptValue}):void 0,this.container,new te(e),new R(e,{classes:[ks.toolbar]}).addChildren(ft([new J(e,"OK",null,{classes:[C.large],onClick:()=>{var i;this.close(),(i=t==null?void 0:t.onConfirm)==null||i.call(t,this.returnValue)}}),t!=null&&t.hasCancel?new J(e,"Cancel",null,{classes:[C.large],onClick:()=>{var i;this.close(),(i=t.onCancel)==null||i.call(t)}}):void 0]))]))}toString(){return`[${E.name}#${this.componentId}]`}addChildHead(e){return this.head.addChild(e),this}addChildrenHead(e){for(const t of e??[])this.head.addChild(t);return this}addChildContent(e){return this.container.addChild(e),this}addChildrenContent(e){for(const t of e??[])this.container.addChild(t);return this}show(){$("#gamePageContainer").append(this.element),this.element[0].show()}showModal(){$("#gamePageContainer").append(this.element),this.element[0].showModal()}close(){this.element[0].close(),this.element.remove()}static async prompt(e,t,i,n,a){return new Promise(r=>{new E(e,{hasCancel:!0,hasClose:!1,onCancel:()=>{r(void 0)},onConfirm:o=>{r(o)},prompt:!0,promptValue:n}).addChildrenHead(ft([i?new D(e,i):void 0,new Bt(e,t)])).addChildrenContent(a?[new R(e,{classes:[ws.explainer]}).addChildren([new Bt(e,a)])]:[]).showModal()})}}const aa={maxButton:"_maxButton_133h2_1"};class Pe extends J{constructor(e,t,i){super(e,"",null,{...i,classes:[aa.maxButton,...(i==null?void 0:i.classes)??[]]});u(this,"setting");this.setting=t}toString(){return`[${Pe.name}#${this.componentId}]`}}class Ee extends J{constructor(e,t,i,n){super(e,"",B.Trigger,{...n,onRefresh:()=>{var r,o;const a=this.behavior==="integer"?this.host.renderAbsolute(this.setting.trigger,"invariant"):this.host.renderPercentage(this.setting.trigger,"invariant",!0);this.updateTitle(this.host.engine.i18n("ui.trigger",[a])),(((r=this.options)==null?void 0:r.renderLabel)??!0)&&this.updateLabel(a),this.inactive?this.element.addClass(C.inactive):this.element.removeClass(C.inactive),(o=n==null?void 0:n.onRefresh)==null||o.call(this)}});u(this,"behavior");u(this,"setting");this.behavior=t instanceof K?"percentage":"integer",this.setting=t}toString(){return`[${Ee.name}#${this.componentId}]`}}class At extends S{constructor(e,t,i,n,a){super(e,t,n,a);u(this,"maxButton");u(this,"triggerButton");this.maxButton=new Pe(e,t,{alignment:"right",border:!1,classes:[C.headAction],onClick:async()=>{await a.onSetMax.call(this)},onRefresh:a!=null&&a.onRefreshMax?()=>{var r;return(r=a.onRefreshMax)==null?void 0:r.call(this)}:void 0}),this.triggerButton=new Ee(e,t,i,{border:!1,classes:[C.lastHeadAction],onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a!=null&&a.onRefreshTrigger?()=>{var r;return(r=a.onRefreshTrigger)==null?void 0:r.call(this)}:void 0,renderLabel:(a==null?void 0:a.renderLabelTrigger)??!0}),this.addChildrenHead([new R(e,{classes:[M.fillSpace]}),this.maxButton,this.triggerButton])}toString(){return`[${At.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}const le={getBuildOption:(c,s,e,t,i,n,a)=>{const r=async()=>{const l=await E.prompt(c,c.host.engine.i18n("ui.max.prompt.absolute"),c.host.engine.i18n("ui.max.build.prompt",[i,c.host.renderAbsolute(s.max,e.selected)]),c.host.renderAbsolute(s.max),c.host.engine.i18n("ui.max.build.promptExplainer"));if(l!==void 0){if(l===""||l.startsWith("-")){s.max=-1;return}l==="0"&&(s.enabled=!1),s.max=c.host.parseAbsolute(l)??s.max}},o=new At(c,s,e,i,{delimiter:a==null?void 0:a.delimiter,onCheck:async l=>{var h;c.host.engine.imessage("status.sub.enable",[i]),s.max===0&&!l&&await r(),await((h=a==null?void 0:a.onCheck)==null?void 0:h.call(a,l))},onRefreshMax:()=>{o.maxButton.updateLabel(c.host.renderAbsolute(s.max)),o.maxButton.element[0].title=s.max<0?c.host.engine.i18n("ui.max.build.titleInfinite",[i]):s.max===0?c.host.engine.i18n("ui.max.build.titleZero",[i]):c.host.engine.i18n("ui.max.build.title",[c.host.renderAbsolute(s.max),i])},onRefreshRequest:()=>{o.maxButton.inactive=!s.enabled||s.max===-1,o.maxButton.ineffective=t.enabled&&s.enabled&&s.max===0,o.triggerButton.inactive=!s.enabled||s.trigger===-1,o.triggerButton.ineffective=t.enabled&&s.enabled&&t.trigger===-1&&s.trigger===-1},onRefreshTrigger:()=>{o.triggerButton.element[0].title=c.host.engine.i18n("ui.trigger",[s.trigger<0?t.trigger<0?c.host.engine.i18n("ui.trigger.build.blocked",[n]):`${c.host.renderPercentage(t.trigger,e.selected,!0)} (${c.host.engine.i18n("ui.trigger.build.inherited")})`:c.host.renderPercentage(s.trigger,e.selected,!0)])},onSetMax:r,onSetTrigger:async()=>{var h;const l=await E.prompt(c,c.host.engine.i18n("ui.trigger.prompt.percentage"),c.host.engine.i18n("ui.trigger.build.prompt",[i,s.trigger!==-1?c.host.renderPercentage(s.trigger,e.selected,!0):c.host.engine.i18n("ui.trigger.build.inherited")]),s.trigger!==-1?c.host.renderPercentage(s.trigger):"",c.host.engine.i18n("ui.trigger.build.promptExplainer"));if(l!==void 0){if(l===""||l.startsWith("-")){s.trigger=-1;return}s.trigger=c.host.parsePercentage(l),await((h=a==null?void 0:a.onSetTrigger)==null?void 0:h.call(void 0))}},onUnCheck:l=>{var h;c.host.engine.imessage("status.sub.disable",[i]),(h=a==null?void 0:a.onUnCheck)==null||h.call(a,l)},renderLabelTrigger:a==null?void 0:a.renderLabelTrigger,upgradeIndicator:a==null?void 0:a.upgradeIndicator});return o}};class F extends S{constructor(e,t,i,n,a){super(e,t,n,a);u(this,"triggerButton");this.triggerButton=new Ee(e,t,i,{alignment:"right",border:!1,onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a!=null&&a.onRefreshTrigger?()=>{var r;return(r=a.onRefreshTrigger)==null?void 0:r.call(this)}:void 0,renderLabel:(a==null?void 0:a.renderLabelTrigger)??!0}),this.addChildrenHead([new R(e,{classes:[M.fillSpace]}),this.triggerButton])}toString(){return`[${F.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class ii extends U{constructor(s,e,t){console.debug(...v(`Constructing ${ii.name}`));const i=s.host.engine.i18n("ui.build");super(s,e,new F(s,e,t,i,{onCheck:n=>{s.host.engine.imessage("status.auto.enable",[i])},onRefreshTrigger:()=>{this.settingItem.triggerButton.element[0].title=s.host.engine.i18n("ui.trigger.section",[e.trigger<0?s.host.engine.i18n("ui.trigger.section.inactive"):s.host.renderPercentage(e.trigger,t.selected,!0)])},onSetTrigger:async()=>{const n=await E.prompt(s,s.host.engine.i18n("ui.trigger.prompt.percentage"),s.host.engine.i18n("ui.trigger.section.prompt",[i,e.trigger!==-1?s.host.renderPercentage(e.trigger,t.selected,!0):s.host.engine.i18n("ui.infinity")]),e.trigger!==-1?s.host.renderPercentage(e.trigger):"",s.host.engine.i18n("ui.trigger.section.promptExplainer"));if(n!==void 0){if(n===""||n.startsWith("-")){e.trigger=-1;return}e.trigger=s.host.parsePercentage(n)}},onUnCheck:n=>{s.host.engine.imessage("status.auto.disable",[i])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!e.enabled||e.trigger<0,this.settingItem.triggerButton.ineffective=e.enabled&&e.trigger<0&&Object.values(e.buildings).some(n=>n.enabled&&0<n.max&&n.trigger<0),this.expando.ineffective=e.enabled&&Object.values(e.buildings).some(n=>n.enabled&&(n.max===0||n.trigger<0&&e.trigger<0))}}),this.addChildrenContent([new x(this,{onReset:()=>{this.setting.load({buildings:new Xt().buildings})}}).addChildren(ft(this.host.game.bld.buildingGroups.flatMap(n=>[new D(this,n.title),...n.buildings.flatMap(a=>this._getBuildOptions(this,e,t,i,a)),n!==this.host.game.bld.buildingGroups[this.host.game.bld.buildingGroups.length-1]?new te(this):void 0]))),new x(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new D(this,this.host.engine.i18n("ui.additional")),new S(this,e.gatherCatnip,this.host.engine.i18n("option.catnip"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.catnip")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.catnip")])}}),new S(this,e.turnOnSteamworks,this.host.engine.i18n("option.steamworks"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.steamworks")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.steamworks")])}}),new S(this,e.turnOnMagnetos,this.host.engine.i18n("option.magnetos"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.magnetos")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.magnetos")])}}),new S(this,e.turnOnReactors,this.host.engine.i18n("option.reactors"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.reactors")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.reactors")])}}),new sa(this,e.upgradeBuildings,t,e)])])}_getBuildOptions(s,e,t,i,n){var r;if(n==="unicornPasture"||m(e.buildings[n]))return[];const a=s.host.game.bld.getBuildingExt(n).meta;if(!m(a.stages)){const o=(r=Object.values(e.buildings).find(l=>l.baseBuilding===n))==null?void 0:r.building;return[le.getBuildOption(s,e.buildings[n],t,e,a.stages[0].label,i,{renderLabelTrigger:!1}),le.getBuildOption(s,e.buildings[o],t,e,a.stages[1].label,i,{renderLabelTrigger:!1,upgradeIndicator:!0})]}return m(a.label)?[]:[le.getBuildOption(s,e.buildings[n],t,e,a.label,i,{renderLabelTrigger:!1})]}}class ra extends S{constructor(e,t){const i=X(e.host.engine.i18n("ui.engine"));super(e,t,i,{onCheck:()=>{e.host.engine.start(!0)},onUnCheck:()=>{e.host.engine.stop(!0)}});u(this,"expando");this.expando=new Mt(this),this.addChildrenHead([new R(e,{classes:[M.fillSpace]}),this.expando])}}class si extends ue{constructor(e,t,i){super(e,{...i});u(this,"button");this.button=t,this.element.addClass(Et.head),this.element.append(t.element)}}const oa={fieldset:"_fieldset_tfwil_1"};class ni extends W{constructor(s,e,t){super(s,{...t}),this.element=$("<fieldset/>").addClass(oa.fieldset),t!=null&&t.delimiter&&this.element.addClass(ke.delimiter);const i=$("<legend/>").text(e).addClass(M.label);this.element.append(i)}toString(){return`[${ni.name}#${this.componentId}]`}}class ai extends W{constructor(e,t,i,n,a){super(e,{...a,onRefresh:()=>{this.input.prop("disabled",this.readOnly)}});u(this,"setting");u(this,"option");u(this,"elementLabel");u(this,"input");u(this,"readOnly");this.element=$("<div/>"),this.element.addClass(O.setting),(a==null?void 0:a.delimiter)===!0&&this.element.addClass(ke.delimiter),this.elementLabel=$("<label/>",{text:`${a!=null&&a.upgradeIndicator?"⮤ ":""}${i.label}`}).addClass(M.label);const r=$("<input/>",{name:n,type:"radio"}).addClass("ks-radio");this.readOnly=(a==null?void 0:a.readOnly)??!1,r.on("change",()=>{this.setting.selected=i.value,m(a==null?void 0:a.onCheck)||a.onCheck()}),this.elementLabel.prepend(r),this.element.append(this.elementLabel),this.input=r,this.setting=t,this.option=i}toString(){return`[${ai.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class Ie extends W{constructor(e,t,i,n){super(e,{...n,onRefresh:()=>{var a;for(const r of this._items)if(r.option.value===this.setting.selected){r.input.prop("checked",!0);break}(a=n==null?void 0:n.onRefresh)==null||a.call(n)}});u(this,"fieldset");u(this,"setting");u(this,"_items");this.element=$("<li/>"),this.fieldset=new ni(e,t),this.addChild(this.fieldset),this._items=new Array;for(const a of i.options)this._items.push(new ai(e,i,a,t,{onCheck:n==null?void 0:n.onCheck,readOnly:n==null?void 0:n.readOnly}));this.fieldset.addChildren(this._items),this.setting=i}toString(){return`[${Ie.name}#${this.componentId}]`}}const la={textButton:"_textButton_1mv97_1"};class Ce extends W{constructor(e,t,i){super(e,{...i,onRefresh:()=>{var a;this.readOnly?this.element.addClass(C.readonly):this.element.removeClass(C.readonly),(a=i==null?void 0:i.onRefresh)==null||a.call(this)}});u(this,"readOnly");this.element=$("<div/>").addClass(la.textButton),t!==void 0&&this.element.text(t);const n=i==null?void 0:i.title;m(n)||this.element.prop("title",n),this.readOnly=!1,this.element.on("click",()=>{this.readOnly||this.click().catch(se(console))})}toString(){return`[${Ce.name}#${this.componentId}]`}async click(){var e,t;this.readOnly||(await((t=(e=this.options)==null?void 0:e.onClick)==null?void 0:t.call(this)),this.requestRefresh())}}class ri extends U{constructor(s,e,t){console.debug(...v(`Constructing ${ri.name}`)),super(s,e,new de(s,s.host.engine.i18n("ui.internals"),{classes:[O.checked,O.setting],icon:B.Settings}).addChildrenHead([new R(s,{classes:[M.fillSpace]})])),this.addChildrenContent([new x(s,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new si(s,new Ce(s,s.host.engine.i18n("ui.internals.interval",[e.interval]),{onClick:async()=>{const i=await E.prompt(s,s.host.engine.i18n("ui.internals.interval.prompt"),s.host.engine.i18n("ui.internals.interval.promptTitle",[s.host.renderAbsolute(e.interval,t.selected)]),s.host.renderAbsolute(e.interval),s.host.engine.i18n("ui.internals.interval.promptExplainer"));i===void 0||i===""||i.startsWith("-")||(i==="0"&&(e.enabled=!1),e.interval=s.host.parseAbsolute(i)??e.interval)},onRefresh(){this.element.text(s.host.engine.i18n("ui.internals.interval",[e.interval]))}})),new te(s),new S(s,e.ksColumn,s.host.engine.i18n("ui.ksColumn"),{onCheck:()=>{s.host.rebuildUi()},onUnCheck:()=>{s.host.rebuildUi()}}),new te(s),new Ie(s,s.host.engine.i18n("ui.language"),e.locale,{onCheck:()=>{s.host.rebuildUi()}}),new te(s),new de(s,`Kitten Scientists ${Oe("v")}`)])])}}class oi extends W{constructor(s,e,t){super(s,{...t}),this.element=$("<li/>",{text:s.host.engine.i18n(e)}).addClass(ws.explainer)}toString(){return`[${oi.name}#${this.componentId}]`}}class li extends U{constructor(s,e){console.debug(...v(`Constructing ${li.name}`));const t=s.host.engine.i18n("ui.filter");super(s,e,new S(s,e,t,{onCheck:n=>{s.host.engine.imessage("status.auto.enable",[t])},onUnCheck:n=>{s.host.engine.imessage("status.auto.disable",[t])}}).addChildrenHead([new R(s,{classes:[M.fillSpace]})])),this.addChildContent(new x(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new S(this,e.disableKGLog,this.host.engine.i18n("filter.allKG"))]));const i=new x(this).addChildren(os.map(n=>({label:this.host.engine.i18n(`filter.${n}`),name:n})).sort((n,a)=>n.label.localeCompare(a.label)).map(n=>new S(this,this.setting.filters[n.name],n.label,{onCheck:()=>{this.host.engine.imessage("filter.enable",[n.label])},onUnCheck:()=>{this.host.engine.imessage("filter.disable",[n.label])}})));this.addChildContent(i),this.addChildContent(new oi(this,"filter.explainer"))}}const Pt={active:"_active_6c09s_16"};class ci extends U{constructor(e,t,i){console.debug(...v(`Constructing ${ci.name}`));const n=e.host.engine.i18n("ui.faith");super(e,t,new F(e,t,i,n,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[n])},onRefreshTrigger(){this.triggerButton.element[0].title=e.host.engine.i18n("ui.trigger.section",[t.trigger<0?e.host.engine.i18n("ui.trigger.section.inactive"):e.host.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const r=await E.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[n,t.trigger!==-1?e.host.renderPercentage(t.trigger,i.selected,!0):e.host.engine.i18n("ui.infinity")]),t.trigger!==-1?e.host.renderPercentage(t.trigger):"",e.host.engine.i18n("ui.trigger.section.promptExplainer"));if(r!==void 0){if(r===""||r.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(r)}},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[n])},renderLabelTrigger:!1}),{onRefresh:()=>{for(const[r,o]of this._unicornBuildings.entries())o.elementLabel.attr("data-ks-active-from","❊"),o.elementLabel.attr("data-ks-active-to","✮"),this.setting.bestUnicornBuilding.enabled&&this.setting.bestUnicornBuildingCurrent===r?o.elementLabel.addClass(Pt.active):o.elementLabel.removeClass(Pt.active)},onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger<0&&Object.values(t.buildings).some(r=>r.enabled&&0<r.max&&r.trigger<0),this.expando.ineffective=t.enabled&&Object.values(t.buildings).some(r=>r.enabled&&(r.max===0||r.trigger<0&&t.trigger<0));for(const[r,o]of this._unicornBuildings.entries())o.readOnly=this._bestUnicornBuilding.setting.enabled,o.maxButton.readOnly=this._bestUnicornBuilding.setting.enabled,o.triggerButton.readOnly=this._bestUnicornBuilding.setting.enabled}});u(this,"_unicornBuildings");u(this,"_bestUnicornBuilding");const a=[...kt];this._unicornBuildings=new Map([["unicornPasture",le.getBuildOption(this,this.setting.buildings.unicornPasture,i,this.setting,this.host.engine.i18n("$buildings.unicornPasture.label"),n,{renderLabelTrigger:!1})],...this.host.game.religion.zigguratUpgrades.filter(r=>a.includes(r.name)&&!m(this.setting.buildings[r.name])).map(r=>[r.name,le.getBuildOption(this,this.setting.buildings[r.name],i,this.setting,r.label,n,{renderLabelTrigger:!1})])]),this._bestUnicornBuilding=new S(this,this.setting.bestUnicornBuilding,this.host.engine.i18n("option.faith.best.unicorn"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.faith.best.unicorn")]);for(const r of this._unicornBuildings.values())r.setting.enabled=!0,r.setting.max=-1,r.setting.trigger=-1},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.faith.best.unicorn")])},upgradeIndicator:!0}),this.addChildrenContent([new x(this,{onReset:()=>{const r=new Yt;this.setting.load({bestUnicornBuilding:r.bestUnicornBuilding,buildings:r.buildings})}}).addChildren([new D(this,this.host.engine.i18n("$religion.panel.ziggurat.label")),...this._unicornBuildings.values(),this._bestUnicornBuilding,new te(this),...this.host.game.religion.zigguratUpgrades.filter(r=>!a.includes(r.name)&&!m(this.setting.buildings[r.name])).map(r=>le.getBuildOption(this,this.setting.buildings[r.name],i,this.setting,r.label,n,{renderLabelTrigger:!1})),new te(this),new D(this,this.host.engine.i18n("$religion.panel.orderOfTheSun.label")),...this.host.game.religion.religionUpgrades.filter(r=>!m(this.setting.buildings[r.name])).map(r=>{var o;return le.getBuildOption(this,this.setting.buildings[r.name],i,this.setting,r.label,n,{delimiter:r.name===((o=this.host.game.religion.religionUpgrades.at(-1))==null?void 0:o.name),renderLabelTrigger:!1})}),new D(this,this.host.engine.i18n("$religion.panel.cryptotheology.label")),...this.host.game.religion.transcendenceUpgrades.filter(r=>!m(this.setting.buildings[r.name])).map(r=>le.getBuildOption(this,this.setting.buildings[r.name],i,this.setting,r.label,n,{renderLabelTrigger:!1}))]),new x(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new D(this,this.host.engine.i18n("ui.additional")),...Js.map(r=>{const o=this.host.engine.i18n(`option.faith.${r}`);if(r==="transcend")return new S(this,this.setting[r],o,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o])}});const l=new F(this,this.setting[r],i,o,{classes:[C.lastHeadAction],onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o])},onRefresh:()=>{l.triggerButton.inactive=!this.setting[r].enabled||this.setting[r].trigger===-1},onSetTrigger:async()=>{const h=await E.prompt(this,this.host.engine.i18n(l.triggerButton.behavior==="integer"?"ui.trigger.setinteger":"ui.trigger.setpercentage",[o]),this.host.engine.i18n("ui.trigger.build.prompt",[o,l.triggerButton.behavior==="integer"?this.host.renderAbsolute(this.setting[r].trigger,i.selected):this.host.renderPercentage(this.setting[r].trigger,i.selected,!0)]),l.triggerButton.behavior==="integer"?this.host.renderAbsolute(this.setting[r].trigger):this.host.renderPercentage(this.setting[r].trigger),this.host.engine.i18n(l.triggerButton.behavior==="integer"?"ui.trigger.setinteger.promptExplainer":"ui.trigger.setpercentage.promptExplainer"));h===void 0||h===""||h.startsWith("-")||(this.setting[r].trigger=(l.triggerButton.behavior==="integer"?this.host.parseAbsolute(h):this.host.parsePercentage(h))??this.setting[r].trigger)},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o])}});return l.triggerButton.element.addClass(C.lastHeadAction),l})])])}}class hi extends J{constructor(e,t,i,n,a){super(e,"",B.DataUsage,{...a,onClick:async()=>{const r=await E.prompt(e,e.host.engine.i18n("resources.consume.prompt"),e.host.engine.i18n("resources.consume.promptTitle",[n,e.host.renderPercentage(t.consume,i.selected,!0)]),e.host.renderPercentage(t.consume),e.host.engine.i18n("resources.consume.promptExplainer"));r!==void 0&&(r===""||r.startsWith("-")||(t.consume=e.host.parsePercentage(r)))},onRefresh:()=>{var l;const r=this.host.renderPercentage(this.setting.consume,this.host.engine.settings.locale.selected,!0),o=this.setting.consume===0?this.host.engine.i18n("resources.consume.titleZero",[this.resourceName]):this.host.engine.i18n("resources.consume.title",[r,this.resourceName]);this.updateTitle(o),(l=a==null?void 0:a.onRefresh)==null||l.call(a)}});u(this,"setting");u(this,"resourceName");this.element.addClass(C.consumeButton),this.resourceName=n,this.setting=t}toString(){return`[${hi.name}#${this.componentId}]`}}class ui extends J{constructor(e,t,i,n,a){super(e,"",null,{...a,onClick:async()=>{const r=await E.prompt(e,e.host.engine.i18n("resources.stock.prompt"),e.host.engine.i18n("resources.stock.promptTitle",[n,e.host.renderAbsolute(t.stock,i.selected)]),e.host.renderAbsolute(t.stock),e.host.engine.i18n("resources.stock.promptExplainer"));if(r!==void 0){if(r===""||r.startsWith("-")){t.stock=-1;return}r==="0"&&(t.enabled=!1),t.stock=e.host.parseAbsolute(r)??t.stock}},onRefresh:()=>{const r=this.host.renderAbsolute(this.setting.stock),o=this.setting.stock<0?this.host.engine.i18n("resources.stock.titleInfinite",[this.resourceName]):this.setting.stock===0?this.host.engine.i18n("resources.stock.titleZero",[this.resourceName]):this.host.engine.i18n("resources.stock.title",[this.host.renderAbsolute(this.setting.stock),this.resourceName]);this.updateTitle(o),this.updateLabel(r)}});u(this,"setting");u(this,"resourceName");this.element.addClass(C.stockButton),this.resourceName=n,this.setting=t}toString(){return`[${ui.name}#${this.componentId}]`}}class di extends U{constructor(s,e,t){console.debug(...v(`Constructing ${di.name}`));const i=s.host.engine.i18n("ui.resources");super(s,e,new de(s,i,{classes:[O.checked,O.setting],icon:B.Resources}).addChildrenHead([new R(s,{classes:[M.fillSpace]})]));const n=["blackcoin","burnedParagon","elderBox","gflops","hashrates","kittens","paragon","temporalFlux","wrappingPaper","zebras"];this.addChildContent(new x(this).addChildren(this.host.game.resPool.resources.filter(a=>!n.includes(a.name)&&!m(this.setting.resources[a.name])).sort((a,r)=>a.title.localeCompare(r.title,t.selected)).map(a=>[this.setting.resources[a.name],X(a.title)]).map(([a,r])=>this._makeResourceSetting(this,a,t,r))))}_makeResourceSetting(s,e,t,i){const n=new S(s,e,i,{onCheck:()=>{s.host.engine.imessage("status.resource.enable",[i])},onUnCheck:()=>{s.host.engine.imessage("status.resource.disable",[i])}}).addChildrenHead([new R(s,{classes:[M.fillSpace]})]),a=new ui(s,e,t,i,{alignment:"right",border:!1,classes:[C.headAction],onRefreshRequest:()=>{a.inactive=!e.enabled||e.stock===0}});n.head.addChild(a);const r=new hi(s,e,t,i,{border:!1,classes:[C.lastHeadAction],onRefreshRequest:()=>{r.inactive=!e.enabled||e.consume!==100,r.ineffective=e.enabled&&e.consume===0}});return n.head.addChild(r),n}}class ca extends U{constructor(s,e,t,i){const n=s.host.engine.i18n("ui.upgrade.policies");super(s,e,new S(s,e,n,{onCheck:l=>{s.host.engine.imessage("status.auto.enable",[n])},onUnCheck:l=>{s.host.engine.imessage("status.auto.disable",[n])}}).addChildrenHead([new R(s,{classes:[M.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=i.enabled&&e.enabled&&!Object.values(e.policies).some(l=>l.enabled)}});const a=this.host.game.science.policies.filter(l=>!m(this.setting.policies[l.name])),r=[];let o=a[0].label;for(const l of a.sort((h,d)=>h.label.localeCompare(d.label,t.selected))){const h=this.setting.policies[l.name],d=new S(this,h,l.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[l.label])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[l.label])}});this.host.engine.localeSupportsFirstLetterSplits(t.selected)&&o[0]!==l.label[0]&&d.element.addClass(M.splitter),r.push(d),o=l.label}this.addChildContent(new x(this).addChildren(r))}}class ha extends U{constructor(s,e,t,i){const n=s.host.engine.i18n("ui.upgrade.techs");super(s,e,new F(s,e,t,n,{onCheck:l=>{s.host.engine.imessage("status.auto.enable",[n])},onRefreshTrigger(){this.triggerButton.element[0].title=s.host.engine.i18n("ui.trigger",[e.trigger<0?s.host.engine.i18n("ui.trigger.section.inactive"):s.host.renderPercentage(e.trigger,t.selected,!0)])},onSetTrigger:async()=>{const l=await E.prompt(s,s.host.engine.i18n("ui.trigger.prompt.percentage"),s.host.engine.i18n("ui.trigger.section.prompt",[n,e.trigger!==-1?s.host.renderPercentage(e.trigger,t.selected,!0):s.host.engine.i18n("ui.infinity")]),e.trigger!==-1?s.host.renderPercentage(e.trigger):"",s.host.engine.i18n("ui.trigger.section.promptExplainer"));if(l!==void 0){if(l===""||l.startsWith("-")){e.trigger=-1;return}e.trigger=s.host.parsePercentage(l)}},onUnCheck:l=>{s.host.engine.imessage("status.auto.disable",[n])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!e.enabled||e.trigger===-1,this.settingItem.triggerButton.ineffective=i.enabled&&e.enabled&&e.trigger===-1&&!Object.values(e.techs).some(l=>l.enabled&&0<=l.trigger),this.expando.ineffective=i.enabled&&e.enabled&&!Object.values(e.techs).some(l=>l.enabled)}});const a=this.host.game.science.techs.filter(l=>!m(this.setting.techs[l.name])),r=[];let o=a[0].label;for(const l of a.sort((h,d)=>h.label.localeCompare(d.label,t.selected))){const h=this.setting.techs[l.name],d=new F(this,h,t,l.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[l.label])},onRefresh:()=>{d.triggerButton.inactive=!h.enabled||h.trigger===-1,d.triggerButton.ineffective=i.enabled&&e.enabled&&h.enabled&&e.trigger===-1&&h.trigger===-1},onRefreshTrigger:()=>{d.triggerButton.element[0].title=this.host.engine.i18n("ui.trigger",[h.trigger<0?e.trigger<0?this.host.engine.i18n("ui.trigger.section.blocked",[n]):`${this.host.renderPercentage(e.trigger,t.selected,!0)} (${this.host.engine.i18n("ui.trigger.section.inherited")})`:this.host.renderPercentage(h.trigger,t.selected,!0)])},onSetTrigger:async()=>{const g=await E.prompt(this,this.host.engine.i18n("ui.trigger.prompt.percentage"),this.host.engine.i18n("ui.trigger.section.prompt",[n,h.trigger!==-1?this.host.renderPercentage(h.trigger,t.selected,!0):this.host.engine.i18n("ui.trigger.section.inherited")]),h.trigger!==-1?this.host.renderPercentage(h.trigger):"",this.host.engine.i18n("ui.trigger.section.promptExplainer"));if(g!==void 0){if(g===""||g.startsWith("-")){h.trigger=-1;return}h.trigger=this.host.parsePercentage(g)}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[l.label])},renderLabelTrigger:!1});d.triggerButton.element.addClass(C.lastHeadAction),this.host.engine.localeSupportsFirstLetterSplits(t.selected)&&o[0]!==l.label[0]&&d.element.addClass(M.splitter),r.push(d),o=l.label}this.addChildContent(new x(this).addChildren(r))}}class gi extends U{constructor(e,t,i){console.debug(...v(`Constructing ${gi.name}`));const n=e.host.engine.i18n("ui.upgrade");super(e,t,new S(e,t,n,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[n])},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[n])}}).addChildrenHead([new R(e,{classes:[M.fillSpace]})]),{onRefresh:()=>{this.setting.observe.enabled?$("#observeButton").hide():$("#observeButton").show()},onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&(this.setting.policies.enabled&&this._policiesUi.expando.ineffective||this.setting.techs.enabled&&(this._techsUi.expando.ineffective||this._techsUi.settingItem.triggerButton.ineffective))}});u(this,"_policiesUi");u(this,"_techsUi");u(this,"_observeStars");this._policiesUi=new ca(this,t.policies,i,t),this._techsUi=new ha(this,t.techs,i,t),this._observeStars=new S(this,this.setting.observe,this.host.engine.i18n("option.observe"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.observe")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.observe")])}});const a=new x(this,{hasDisableAll:!1,hasEnableAll:!1});a.addChildren([this._techsUi,this._policiesUi,this._observeStars]),this.addChildContent(a)}}class ua extends U{constructor(e,t,i,n){const a=e.host.engine.i18n("ui.upgrade.missions");super(e,t,new S(e,t,a,{onCheck:o=>{e.host.engine.imessage("status.auto.enable",[a])},onRefresh:()=>{this.expando.ineffective=n.enabled&&t.enabled&&!Object.values(t.missions).some(o=>o.enabled)},onUnCheck:o=>{e.host.engine.imessage("status.auto.disable",[a])}}).addChildrenHead([new R(e,{classes:[M.fillSpace]})]));u(this,"_missions");this._missions=this.host.game.space.programs.filter(o=>!m(this.setting.missions[o.name])).map(o=>new S(this,this.setting.missions[o.name],o.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o.label])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o.label])}}));const r=new x(this).addChildren(this._missions);this.addChildContent(r)}}class mi extends U{constructor(e,t,i){console.debug(...v(`Constructing ${mi.name}`));const n=e.host.engine.i18n("ui.space");super(e,t,new F(e,t,i,n,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[n])},onRefreshTrigger(){this.triggerButton.element[0].title=e.host.engine.i18n("ui.trigger.section",[t.trigger<0?e.host.engine.i18n("ui.trigger.section.inactive"):e.host.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const r=await E.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[n,t.trigger!==-1?e.host.renderPercentage(t.trigger,i.selected,!0):e.host.engine.i18n("ui.infinity")]),t.trigger!==-1?e.host.renderPercentage(t.trigger):"",e.host.engine.i18n("ui.trigger.section.promptExplainer"));if(r!==void 0){if(r===""||r.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(r)}},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[n])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger<0&&Object.values(t.buildings).some(r=>r.enabled&&0<r.max&&r.trigger<0),this.expando.ineffective=t.enabled&&(Object.values(t.buildings).some(r=>r.enabled&&(r.max===0||r.trigger<0&&t.trigger<0))||!Object.values(t.buildings).some(r=>r.enabled)&&!t.unlockMissions.enabled||this._missionsUi.expando.ineffective)}});u(this,"_missionsUi");this.addChildContent(new x(this,{onReset:()=>{this.setting.load({buildings:new St().buildings})}}).addChildren(this.host.game.space.planets.filter(r=>0<r.buildings.length).flatMap((r,o,l)=>[new D(this,this.host.engine.labelForPlanet(r.name)),...r.buildings.filter(h=>!m(this.setting.buildings[h.name])).map((h,d,g)=>le.getBuildOption(this,this.setting.buildings[h.name],i,this.setting,h.label,n,{delimiter:o<l.length-1&&d===g.length-1,renderLabelTrigger:!1}))])));const a=new x(this,{hasDisableAll:!1,hasEnableAll:!1});a.addChild(new D(this,this.host.engine.i18n("ui.additional"))),this._missionsUi=new ua(this,this.setting.unlockMissions,i,this.setting),a.addChild(this._missionsUi),this.addChildContent(a)}}class fi extends be{constructor(s,e=400){super("ERR_OS_INVALID_ARGUMENT",s,e),this.name="InvalidArgumentError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,fi)}}const It=43200,_s=1440,Cs=Symbol.for("constructDateFrom");function bi(c,s){return typeof c=="function"?c(s):c&&typeof c=="object"&&Cs in c?c[Cs](s):c instanceof Date?new c.constructor(s):new Date(s)}function da(c){return bi(c,Date.now())}const ga={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ma=(c,s,e)=>{let t;const i=ga[c];return typeof i=="string"?t=i:s===1?t=i.one:t=i.other.replace("{{count}}",s.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+t:t+" ago":t};function ne(c){return(s={})=>{const e=s.width?String(s.width):c.defaultWidth;return c.formats[e]||c.formats[c.defaultWidth]}}const fa={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ba={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},pa={full:"{{date}} \'at\' {{time}}",long:"{{date}} \'at\' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},va={date:ne({formats:fa,defaultWidth:"full"}),time:ne({formats:ba,defaultWidth:"full"}),dateTime:ne({formats:pa,defaultWidth:"full"})},ya={lastWeek:"\'last\' eeee \'at\' p",yesterday:"\'yesterday at\' p",today:"\'today at\' p",tomorrow:"\'tomorrow at\' p",nextWeek:"eeee \'at\' p",other:"P"},wa=(c,s,e,t)=>ya[c];function G(c){return(s,e)=>{const t=e!=null&&e.context?String(e.context):"standalone";let i;if(t==="formatting"&&c.formattingValues){const a=c.defaultFormattingWidth||c.defaultWidth,r=e!=null&&e.width?String(e.width):a;i=c.formattingValues[r]||c.formattingValues[a]}else{const a=c.defaultWidth,r=e!=null&&e.width?String(e.width):c.defaultWidth;i=c.values[r]||c.values[a]}const n=c.argumentCallback?c.argumentCallback(s):s;return i[n]}}const ka={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},_a={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Ca={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Sa={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},xa={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Ta={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Ea={ordinalNumber:(c,s)=>{const e=Number(c),t=e%100;if(t>20||t<10)switch(t%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},era:G({values:ka,defaultWidth:"wide"}),quarter:G({values:_a,defaultWidth:"wide",argumentCallback:c=>c-1}),month:G({values:Ca,defaultWidth:"wide"}),day:G({values:Sa,defaultWidth:"wide"}),dayPeriod:G({values:xa,defaultWidth:"wide",formattingValues:Ta,defaultFormattingWidth:"wide"})};function Z(c){return(s,e={})=>{const t=e.width,i=t&&c.matchPatterns[t]||c.matchPatterns[c.defaultMatchWidth],n=s.match(i);if(!n)return null;const a=n[0],r=t&&c.parsePatterns[t]||c.parsePatterns[c.defaultParseWidth],o=Array.isArray(r)?Ma(r,d=>d.test(a)):Ra(r,d=>d.test(a));let l;l=c.valueCallback?c.valueCallback(o):o,l=e.valueCallback?e.valueCallback(l):l;const h=s.slice(a.length);return{value:l,rest:h}}}function Ra(c,s){for(const e in c)if(Object.prototype.hasOwnProperty.call(c,e)&&s(c[e]))return e}function Ma(c,s){for(let e=0;e<c.length;e++)if(s(c[e]))return e}function $t(c){return(s,e={})=>{const t=s.match(c.matchPattern);if(!t)return null;const i=t[0],n=s.match(c.parsePattern);if(!n)return null;let a=c.valueCallback?c.valueCallback(n[0]):n[0];a=e.valueCallback?e.valueCallback(a):a;const r=s.slice(i.length);return{value:a,rest:r}}}const Ba=/^(\\d+)(th|st|nd|rd)?/i,Aa=/\\d+/i,Pa={narrow:/^(b|a)/i,abbreviated:/^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ia={any:[/^b/i,/^(a|c)/i]},$a={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},La={any:[/1/i,/2/i,/3/i,/4/i]},Oa={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Ua={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Da={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Na={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},qa={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},za={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Fa={ordinalNumber:$t({matchPattern:Ba,parsePattern:Aa,valueCallback:c=>parseInt(c,10)}),era:Z({matchPatterns:Pa,defaultMatchWidth:"wide",parsePatterns:Ia,defaultParseWidth:"any"}),quarter:Z({matchPatterns:$a,defaultMatchWidth:"wide",parsePatterns:La,defaultParseWidth:"any",valueCallback:c=>c+1}),month:Z({matchPatterns:Oa,defaultMatchWidth:"wide",parsePatterns:Ua,defaultParseWidth:"any"}),day:Z({matchPatterns:Da,defaultMatchWidth:"wide",parsePatterns:Na,defaultParseWidth:"any"}),dayPeriod:Z({matchPatterns:qa,defaultMatchWidth:"any",parsePatterns:za,defaultParseWidth:"any"})},Ss={code:"en-US",formatDistance:ma,formatLong:va,formatRelative:wa,localize:Ea,match:Fa,options:{weekStartsOn:0,firstWeekContainsDate:1}};let Ha={};function xs(){return Ha}function fe(c,s){return bi(s||c,c)}function Ts(c){const s=fe(c),e=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()));return e.setUTCFullYear(s.getFullYear()),+c-+e}function Lt(c,...s){const e=bi.bind(null,c||s.find(t=>typeof t=="object"));return s.map(e)}function Ot(c,s){const e=+fe(c)-+fe(s);return e<0?-1:e>0?1:e}function Wa(c,s,e){const[t,i]=Lt(e==null?void 0:e.in,c,s),n=t.getFullYear()-i.getFullYear(),a=t.getMonth()-i.getMonth();return n*12+a}function Ga(c,s){const e=fe(c,s==null?void 0:s.in);return e.setHours(23,59,59,999),e}function Za(c,s){const e=fe(c,s==null?void 0:s.in),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function Ka(c,s){const e=fe(c,s==null?void 0:s.in);return+Ga(e,s)==+Za(e,s)}function Va(c,s,e){const[t,i,n]=Lt(e==null?void 0:e.in,c,c,s),a=Ot(i,n),r=Math.abs(Wa(i,n));if(r<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-a*r);let o=Ot(i,n)===-a;Ka(t)&&r===1&&Ot(t,n)===1&&(o=!1);const l=a*(r-+o);return l===0?0:l}function ja(c){return s=>{const t=(c?Math[c]:Math.trunc)(s);return t===0?0:t}}function Ja(c,s){return+fe(c)-+fe(s)}function Xa(c,s,e){const t=Ja(c,s)/1e3;return ja(e==null?void 0:e.roundingMethod)(t)}function Ya(c,s,e){const t=xs(),i=(e==null?void 0:e.locale)??t.locale??Ss,n=2520,a=Ot(c,s);if(isNaN(a))throw new RangeError("Invalid time value");const r=Object.assign({},e,{addSuffix:e==null?void 0:e.addSuffix,comparison:a}),[o,l]=Lt(e==null?void 0:e.in,...a>0?[s,c]:[c,s]),h=Xa(l,o),d=(Ts(l)-Ts(o))/1e3,g=Math.round((h-d)/60);let f;if(g<2)return e!=null&&e.includeSeconds?h<5?i.formatDistance("lessThanXSeconds",5,r):h<10?i.formatDistance("lessThanXSeconds",10,r):h<20?i.formatDistance("lessThanXSeconds",20,r):h<40?i.formatDistance("halfAMinute",0,r):h<60?i.formatDistance("lessThanXMinutes",1,r):i.formatDistance("xMinutes",1,r):g===0?i.formatDistance("lessThanXMinutes",1,r):i.formatDistance("xMinutes",g,r);if(g<45)return i.formatDistance("xMinutes",g,r);if(g<90)return i.formatDistance("aboutXHours",1,r);if(g<_s){const w=Math.round(g/60);return i.formatDistance("aboutXHours",w,r)}else{if(g<n)return i.formatDistance("xDays",1,r);if(g<It){const w=Math.round(g/_s);return i.formatDistance("xDays",w,r)}else if(g<It*2)return f=Math.round(g/It),i.formatDistance("aboutXMonths",f,r)}if(f=Va(l,o),f<12){const w=Math.round(g/It);return i.formatDistance("xMonths",w,r)}else{const w=f%12,b=Math.trunc(f/12);return w<3?i.formatDistance("aboutXYears",b,r):w<9?i.formatDistance("overXYears",b,r):i.formatDistance("almostXYears",b+1,r)}}function Es(c,s){return Ya(c,da(c),s)}function Rs(c,s){var r,o,l,h;const e=xs(),t=(s==null?void 0:s.weekStartsOn)??((o=(r=s==null?void 0:s.locale)==null?void 0:r.options)==null?void 0:o.weekStartsOn)??e.weekStartsOn??((h=(l=e.locale)==null?void 0:l.options)==null?void 0:h.weekStartsOn)??0,i=fe(c,s==null?void 0:s.in),n=i.getDay(),a=(n<t?7:0)+n-t;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function Qa(c,s,e){const[t,i]=Lt(e==null?void 0:e.in,c,s);return+Rs(t,e)==+Rs(i,e)}const Ms={lessThanXSeconds:{standalone:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"},withPreposition:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"}},xSeconds:{standalone:{one:"1 Sekunde",other:"{{count}} Sekunden"},withPreposition:{one:"1 Sekunde",other:"{{count}} Sekunden"}},halfAMinute:{standalone:"eine halbe Minute",withPreposition:"einer halben Minute"},lessThanXMinutes:{standalone:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"},withPreposition:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"}},xMinutes:{standalone:{one:"1 Minute",other:"{{count}} Minuten"},withPreposition:{one:"1 Minute",other:"{{count}} Minuten"}},aboutXHours:{standalone:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"},withPreposition:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"}},xHours:{standalone:{one:"1 Stunde",other:"{{count}} Stunden"},withPreposition:{one:"1 Stunde",other:"{{count}} Stunden"}},xDays:{standalone:{one:"1 Tag",other:"{{count}} Tage"},withPreposition:{one:"1 Tag",other:"{{count}} Tagen"}},aboutXWeeks:{standalone:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"},withPreposition:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"}},xWeeks:{standalone:{one:"1 Woche",other:"{{count}} Wochen"},withPreposition:{one:"1 Woche",other:"{{count}} Wochen"}},aboutXMonths:{standalone:{one:"etwa 1 Monat",other:"etwa {{count}} Monate"},withPreposition:{one:"etwa 1 Monat",other:"etwa {{count}} Monaten"}},xMonths:{standalone:{one:"1 Monat",other:"{{count}} Monate"},withPreposition:{one:"1 Monat",other:"{{count}} Monaten"}},aboutXYears:{standalone:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahre"},withPreposition:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahren"}},xYears:{standalone:{one:"1 Jahr",other:"{{count}} Jahre"},withPreposition:{one:"1 Jahr",other:"{{count}} Jahren"}},overXYears:{standalone:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahre"},withPreposition:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahren"}},almostXYears:{standalone:{one:"fast 1 Jahr",other:"fast {{count}} Jahre"},withPreposition:{one:"fast 1 Jahr",other:"fast {{count}} Jahren"}}},er=(c,s,e)=>{let t;const i=e!=null&&e.addSuffix?Ms[c].withPreposition:Ms[c].standalone;return typeof i=="string"?t=i:s===1?t=i.one:t=i.other.replace("{{count}}",String(s)),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+t:"vor "+t:t},tr={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},ir={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},sr={full:"{{date}} \'um\' {{time}}",long:"{{date}} \'um\' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},nr={date:ne({formats:tr,defaultWidth:"full"}),time:ne({formats:ir,defaultWidth:"full"}),dateTime:ne({formats:sr,defaultWidth:"full"})},ar={lastWeek:"\'letzten\' eeee \'um\' p",yesterday:"\'gestern um\' p",today:"\'heute um\' p",tomorrow:"\'morgen um\' p",nextWeek:"eeee \'um\' p",other:"P"},rr=(c,s,e,t)=>ar[c],or={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},lr={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},pi={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],wide:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},cr={narrow:pi.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:pi.wide},hr={narrow:["S","M","D","M","D","F","S"],short:["So","Mo","Di","Mi","Do","Fr","Sa"],abbreviated:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],wide:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},ur={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachm.",evening:"Abend",night:"Nacht"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"}},dr={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachm.",evening:"abends",night:"nachts"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"}},gr={ordinalNumber:c=>Number(c)+".",era:G({values:or,defaultWidth:"wide"}),quarter:G({values:lr,defaultWidth:"wide",argumentCallback:c=>c-1}),month:G({values:pi,formattingValues:cr,defaultWidth:"wide"}),day:G({values:hr,defaultWidth:"wide"}),dayPeriod:G({values:ur,defaultWidth:"wide",formattingValues:dr,defaultFormattingWidth:"wide"})},mr=/^(\\d+)(\\.)?/i,fr=/\\d+/i,br={narrow:/^(v\\.? ?Chr\\.?|n\\.? ?Chr\\.?)/i,abbreviated:/^(v\\.? ?Chr\\.?|n\\.? ?Chr\\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},pr={any:[/^v/i,/^n/i]},vr={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\\.)? Quartal/i},yr={any:[/1/i,/2/i,/3/i,/4/i]},wr={narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},kr={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},_r={narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},Cr={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},Sr={narrow:/^(vm\\.?|nm\\.?|Mitternacht|Mittag|morgens|nachm\\.?|abends|nachts)/i,abbreviated:/^(vorm\\.?|nachm\\.?|Mitternacht|Mittag|morgens|nachm\\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},xr={any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},Tr={ordinalNumber:$t({matchPattern:mr,parsePattern:fr,valueCallback:c=>parseInt(c)}),era:Z({matchPatterns:br,defaultMatchWidth:"wide",parsePatterns:pr,defaultParseWidth:"any"}),quarter:Z({matchPatterns:vr,defaultMatchWidth:"wide",parsePatterns:yr,defaultParseWidth:"any",valueCallback:c=>c+1}),month:Z({matchPatterns:wr,defaultMatchWidth:"wide",parsePatterns:kr,defaultParseWidth:"any"}),day:Z({matchPatterns:_r,defaultMatchWidth:"wide",parsePatterns:Cr,defaultParseWidth:"any"}),dayPeriod:Z({matchPatterns:Sr,defaultMatchWidth:"wide",parsePatterns:xr,defaultParseWidth:"any"})},Er={code:"de",formatDistance:er,formatLong:nr,formatRelative:rr,localize:gr,match:Tr,options:{weekStartsOn:1,firstWeekContainsDate:4}},Rr={lessThanXSeconds:{one:"פחות משנייה",two:"פחות משתי שניות",other:"פחות מ־{{count}} שניות"},xSeconds:{one:"שנייה",two:"שתי שניות",other:"{{count}} שניות"},halfAMinute:"חצי דקה",lessThanXMinutes:{one:"פחות מדקה",two:"פחות משתי דקות",other:"פחות מ־{{count}} דקות"},xMinutes:{one:"דקה",two:"שתי דקות",other:"{{count}} דקות"},aboutXHours:{one:"כשעה",two:"כשעתיים",other:"כ־{{count}} שעות"},xHours:{one:"שעה",two:"שעתיים",other:"{{count}} שעות"},xDays:{one:"יום",two:"יומיים",other:"{{count}} ימים"},aboutXWeeks:{one:"כשבוע",two:"כשבועיים",other:"כ־{{count}} שבועות"},xWeeks:{one:"שבוע",two:"שבועיים",other:"{{count}} שבועות"},aboutXMonths:{one:"כחודש",two:"כחודשיים",other:"כ־{{count}} חודשים"},xMonths:{one:"חודש",two:"חודשיים",other:"{{count}} חודשים"},aboutXYears:{one:"כשנה",two:"כשנתיים",other:"כ־{{count}} שנים"},xYears:{one:"שנה",two:"שנתיים",other:"{{count}} שנים"},overXYears:{one:"יותר משנה",two:"יותר משנתיים",other:"יותר מ־{{count}} שנים"},almostXYears:{one:"כמעט שנה",two:"כמעט שנתיים",other:"כמעט {{count}} שנים"}},Mr=(c,s,e)=>{if(c==="xDays"&&(e!=null&&e.addSuffix)&&s<=2)return e.comparison&&e.comparison>0?s===1?"מחר":"מחרתיים":s===1?"אתמול":"שלשום";let t;const i=Rr[c];return typeof i=="string"?t=i:s===1?t=i.one:s===2?t=i.two:t=i.other.replace("{{count}}",String(s)),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"בעוד "+t:"לפני "+t:t},Br={full:"EEEE, d בMMMM y",long:"d בMMMM y",medium:"d בMMM y",short:"d.M.y"},Ar={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},Pr={full:"{{date}} \'בשעה\' {{time}}",long:"{{date}} \'בשעה\' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ir={date:ne({formats:Br,defaultWidth:"full"}),time:ne({formats:Ar,defaultWidth:"full"}),dateTime:ne({formats:Pr,defaultWidth:"full"})},$r={lastWeek:"eeee \'שעבר בשעה\' p",yesterday:"\'אתמול בשעה\' p",today:"\'היום בשעה\' p",tomorrow:"\'מחר בשעה\' p",nextWeek:"eeee \'בשעה\' p",other:"P"},Lr=(c,s,e,t)=>$r[c],Or={narrow:["לפנה״ס","לספירה"],abbreviated:["לפנה״ס","לספירה"],wide:["לפני הספירה","לספירה"]},Ur={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["רבעון 1","רבעון 2","רבעון 3","רבעון 4"]},Dr={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"],wide:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"]},Nr={narrow:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],short:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],abbreviated:["יום א׳","יום ב׳","יום ג׳","יום ד׳","יום ה׳","יום ו׳","שבת"],wide:["יום ראשון","יום שני","יום שלישי","יום רביעי","יום חמישי","יום שישי","יום שבת"]},qr={narrow:{am:"לפנה״צ",pm:"אחה״צ",midnight:"חצות",noon:"צהריים",morning:"בוקר",afternoon:"אחר הצהריים",evening:"ערב",night:"לילה"},abbreviated:{am:"לפנה״צ",pm:"אחה״צ",midnight:"חצות",noon:"צהריים",morning:"בוקר",afternoon:"אחר הצהריים",evening:"ערב",night:"לילה"},wide:{am:"לפנה״צ",pm:"אחה״צ",midnight:"חצות",noon:"צהריים",morning:"בוקר",afternoon:"אחר הצהריים",evening:"ערב",night:"לילה"}},zr={narrow:{am:"לפנה״צ",pm:"אחה״צ",midnight:"חצות",noon:"צהריים",morning:"בבוקר",afternoon:"בצהריים",evening:"בערב",night:"בלילה"},abbreviated:{am:"לפנה״צ",pm:"אחה״צ",midnight:"חצות",noon:"צהריים",morning:"בבוקר",afternoon:"אחר הצהריים",evening:"בערב",night:"בלילה"},wide:{am:"לפנה״צ",pm:"אחה״צ",midnight:"חצות",noon:"צהריים",morning:"בבוקר",afternoon:"אחר הצהריים",evening:"בערב",night:"בלילה"}},Fr={ordinalNumber:(c,s)=>{const e=Number(c);if(e<=0||e>10)return String(e);const t=String(s==null?void 0:s.unit),i=["year","hour","minute","second"].indexOf(t)>=0,n=["ראשון","שני","שלישי","רביעי","חמישי","שישי","שביעי","שמיני","תשיעי","עשירי"],a=["ראשונה","שנייה","שלישית","רביעית","חמישית","שישית","שביעית","שמינית","תשיעית","עשירית"],r=e-1;return i?a[r]:n[r]},era:G({values:Or,defaultWidth:"wide"}),quarter:G({values:Ur,defaultWidth:"wide",argumentCallback:c=>c-1}),month:G({values:Dr,defaultWidth:"wide"}),day:G({values:Nr,defaultWidth:"wide"}),dayPeriod:G({values:qr,defaultWidth:"wide",formattingValues:zr,defaultFormattingWidth:"wide"})},Hr=/^(\\d+|(ראשון|שני|שלישי|רביעי|חמישי|שישי|שביעי|שמיני|תשיעי|עשירי|ראשונה|שנייה|שלישית|רביעית|חמישית|שישית|שביעית|שמינית|תשיעית|עשירית))/i,Wr=/^(\\d+|רא|שנ|של|רב|ח|שי|שב|שמ|ת|ע)/i,Gr={narrow:/^ל(ספירה|פנה״ס)/i,abbreviated:/^ל(ספירה|פנה״ס)/i,wide:/^ל(פני ה)?ספירה/i},Zr={any:[/^לפ/i,/^לס/i]},Kr={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^רבעון [1234]/i},Vr={any:[/1/i,/2/i,/3/i,/4/i]},jr={narrow:/^\\d+/i,abbreviated:/^(ינו|פבר|מרץ|אפר|מאי|יוני|יולי|אוג|ספט|אוק|נוב|דצמ)׳?/i,wide:/^(ינואר|פברואר|מרץ|אפריל|מאי|יוני|יולי|אוגוסט|ספטמבר|אוקטובר|נובמבר|דצמבר)/i},Jr={narrow:[/^1$/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^7/i,/^8/i,/^9/i,/^10/i,/^11/i,/^12/i],any:[/^ינ/i,/^פ/i,/^מר/i,/^אפ/i,/^מא/i,/^יונ/i,/^יול/i,/^אוג/i,/^ס/i,/^אוק/i,/^נ/i,/^ד/i]},Xr={narrow:/^[אבגדהוש]׳/i,short:/^[אבגדהוש]׳/i,abbreviated:/^(שבת|יום (א|ב|ג|ד|ה|ו)׳)/i,wide:/^יום (ראשון|שני|שלישי|רביעי|חמישי|שישי|שבת)/i},Yr={abbreviated:[/א׳$/i,/ב׳$/i,/ג׳$/i,/ד׳$/i,/ה׳$/i,/ו׳$/i,/^ש/i],wide:[/ן$/i,/ני$/i,/לישי$/i,/עי$/i,/מישי$/i,/שישי$/i,/ת$/i],any:[/^א/i,/^ב/i,/^ג/i,/^ד/i,/^ה/i,/^ו/i,/^ש/i]},Qr={any:/^(אחר ה|ב)?(חצות|צהריים|בוקר|ערב|לילה|אחה״צ|לפנה״צ)/i},eo={any:{am:/^לפ/i,pm:/^אחה/i,midnight:/^ח/i,noon:/^צ/i,morning:/בוקר/i,afternoon:/בצ|אחר/i,evening:/ערב/i,night:/לילה/i}},to=["רא","שנ","של","רב","ח","שי","שב","שמ","ת","ע"],io={ordinalNumber:$t({matchPattern:Hr,parsePattern:Wr,valueCallback:c=>{const s=parseInt(c,10);return isNaN(s)?to.indexOf(c)+1:s}}),era:Z({matchPatterns:Gr,defaultMatchWidth:"wide",parsePatterns:Zr,defaultParseWidth:"any"}),quarter:Z({matchPatterns:Kr,defaultMatchWidth:"wide",parsePatterns:Vr,defaultParseWidth:"any",valueCallback:c=>c+1}),month:Z({matchPatterns:jr,defaultMatchWidth:"wide",parsePatterns:Jr,defaultParseWidth:"any"}),day:Z({matchPatterns:Xr,defaultMatchWidth:"wide",parsePatterns:Yr,defaultParseWidth:"any"}),dayPeriod:Z({matchPatterns:Qr,defaultMatchWidth:"any",parsePatterns:eo,defaultParseWidth:"any"})},so={code:"he",formatDistance:Mr,formatLong:Ir,formatRelative:Lr,localize:Fr,match:io,options:{weekStartsOn:0,firstWeekContainsDate:1}},no={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},ao=(c,s,e)=>{let t;const i=no[c];return typeof i=="string"?t=i:s===1?t=i.one:t=i.other.replace("{{count}}",String(s)),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?t+"内":t+"前":t},ro={full:"y\'年\'M\'月\'d\'日\' EEEE",long:"y\'年\'M\'月\'d\'日\'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},oo={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},lo={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},co={date:ne({formats:ro,defaultWidth:"full"}),time:ne({formats:oo,defaultWidth:"full"}),dateTime:ne({formats:lo,defaultWidth:"full"})};function Bs(c,s,e){const t="eeee p";return Qa(c,s,e)?t:c.getTime()>s.getTime()?"\'下个\'"+t:"\'上个\'"+t}const ho={lastWeek:Bs,yesterday:"\'昨天\' p",today:"\'今天\' p",tomorrow:"\'明天\' p",nextWeek:Bs,other:"PP p"},uo=(c,s,e,t)=>{const i=ho[c];return typeof i=="function"?i(s,e,t):i},go={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},mo={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},fo={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},bo={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},po={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},vo={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},yo={ordinalNumber:(c,s)=>{const e=Number(c);switch(s==null?void 0:s.unit){case"date":return e.toString()+"日";case"hour":return e.toString()+"时";case"minute":return e.toString()+"分";case"second":return e.toString()+"秒";default:return"第 "+e.toString()}},era:G({values:go,defaultWidth:"wide"}),quarter:G({values:mo,defaultWidth:"wide",argumentCallback:c=>c-1}),month:G({values:fo,defaultWidth:"wide"}),day:G({values:bo,defaultWidth:"wide"}),dayPeriod:G({values:po,defaultWidth:"wide",formattingValues:vo,defaultFormattingWidth:"wide"})},wo=/^(第\\s*)?\\d+(日|时|分|秒)?/i,ko=/\\d+/i,_o={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},Co={any:[/^(前)/i,/^(公元)/i]},So={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},xo={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},To={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},Eo={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},Ro={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},Mo={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},Bo={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},Ao={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},Po={ordinalNumber:$t({matchPattern:wo,parsePattern:ko,valueCallback:c=>parseInt(c,10)}),era:Z({matchPatterns:_o,defaultMatchWidth:"wide",parsePatterns:Co,defaultParseWidth:"any"}),quarter:Z({matchPatterns:So,defaultMatchWidth:"wide",parsePatterns:xo,defaultParseWidth:"any",valueCallback:c=>c+1}),month:Z({matchPatterns:To,defaultMatchWidth:"wide",parsePatterns:Eo,defaultParseWidth:"any"}),day:Z({matchPatterns:Ro,defaultMatchWidth:"wide",parsePatterns:Mo,defaultParseWidth:"any"}),dayPeriod:Z({matchPatterns:Bo,defaultMatchWidth:"any",parsePatterns:Ao,defaultParseWidth:"any"})},Io={code:"zh-CN",formatDistance:ao,formatLong:co,formatRelative:uo,localize:yo,match:Po,options:{weekStartsOn:1,firstWeekContainsDate:4}};class $o{constructor(s){u(this,"_game");this._game=s}load(s){return new Promise((e,t)=>{if(s===null){e();return}this._game.saveImportDropboxText(s,i=>{if(i){t(i);return}e()})})}loadRaw(s){const e=this._game.compressLZData(JSON.stringify(s));return this.load(e)}}class $e extends ue{constructor(s,e){super(s,e),this.element.addClass(ks.toolbar)}toString(){return`[${$e.name}#${this.componentId}]`}addChild(s){return super.addChild(s)}}class vi extends U{constructor(e,t,i){console.debug(...v(`Constructing ${vi.name}`));const n=e.host.engine.i18n("state.title");super(e,t,new de(e,n,{classes:[O.checked,O.setting],icon:B.State}).addChildrenHead([new R(e,{classes:[M.fillSpace]})]),{onRefresh:()=>{this._refreshGameList(),this._refreshStateList()}});u(this,"games",new Array);u(this,"states",new Array);u(this,"gameList");u(this,"stateList");u(this,"locale");this.gameList=new x(this,{hasDisableAll:!1,hasEnableAll:!1}),this.stateList=new x(this,{hasDisableAll:!1,hasEnableAll:!1}),this.locale=i.selected==="zh-CN"?Io:i.selected==="he-IL"?so:i.selected==="de-DE"?Er:Ss,this.addChildContent(new x(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new S(this,this.setting.noConfirm,this.host.engine.i18n("state.noConfirm")),new ue(this).addChild(new te(this)),new D(this,this.host.engine.i18n("state.local")),new $e(this).addChildren([new J(this,this.host.engine.i18n("state.import"),B.Import,{onClick:()=>{this.import()},title:this.host.engine.i18n("state.importTitle")})]),new ue(this).addChild(new te(this)),new D(this,this.host.engine.i18n("state.localStates")),new $e(this).addChildren([new J(this,this.host.engine.i18n("state.store"),B.SaveAs,{onClick:()=>{this.storeState()},title:this.host.engine.i18n("state.storeState")}),new J(this,this.host.engine.i18n("copy"),B.Copy,{onClick:()=>{this.copyState().catch(se(console)),this.host.engine.imessage("state.copied.stateCurrent")},title:this.host.engine.i18n("state.copy.stateCurrent")}),new J(this,this.host.engine.i18n("state.new"),B.Draft,{onClick:()=>{this.storeStateFactoryDefaults(),this.host.engine.imessage("state.stored.state")},title:this.host.engine.i18n("state.storeFactory")}),new J(this,this.host.engine.i18n("state.exportAll"),B.Sync,{onClick:()=>{this.exportStateAll()},title:this.host.engine.i18n("state.exportAllTitle")})]),new ue(this).addChild(this.stateList),new ue(this).addChild(new te(this)),new D(this,this.host.engine.i18n("state.localGames")),new $e(this).addChildren([new J(this,this.host.engine.i18n("state.store"),B.SaveAs,{onClick:()=>{this.storeGame(),this.host.engine.imessage("state.stored.game")},title:this.host.engine.i18n("state.storeGame")}),new J(this,this.host.engine.i18n("copy"),B.Copy,{onClick:()=>{this.copyGame().catch(se(console)),this.host.engine.imessage("state.copied.gameCurrent")},title:this.host.engine.i18n("state.copy.gameCurrent")})]),new ue(this).addChild(this.gameList),new S(this,this.setting.compress,this.host.engine.i18n("state.compress"))])),this._loadGames(),this._loadStates()}_loadGames(){let e=0,t=localStorage.getItem(`ks.game.${e}`);this.games.splice(0);try{for(;!m(t);){const i=JSON.parse(t);this.games.push(new yt(i)),t=localStorage.getItem(`ks.game.${++e}`)}}catch(i){console.error(...v(i))}}_storeGames(){let e=0,t=localStorage.getItem(`ks.game.${e}`);for(;!m(t);)localStorage.removeItem(`ks.game.${e}`),t=localStorage.getItem(`ks.game.${++e}`);e=0;for(const i of this.games)localStorage.setItem(`ks.game.${e++}`,JSON.stringify(i))}_loadStates(){let e=0,t=localStorage.getItem(`ks.state.${e}`);this.states.splice(0);try{for(;!m(t);){const i=JSON.parse(t);ge.unknownAsEngineStateOrThrow(i.state),this.states.push(new yt(i)),t=localStorage.getItem(`ks.state.${++e}`)}}catch(i){console.error(...v(i))}}_storeStates(){let e=0,t=localStorage.getItem(`ks.state.${e}`);for(;!m(t);)localStorage.removeItem(`ks.state.${e}`),t=localStorage.getItem(`ks.state.${++e}`);e=0;for(const i of this.states)localStorage.setItem(`ks.state.${e++}`,JSON.stringify(i))}_refreshGameList(){this.gameList.removeChildren(this.gameList.children),this.gameList.addChildren(this.games.sort((e,t)=>new Date(e.unwrap().timestamp).getTime()-new Date(t.unwrap().timestamp).getTime()).map(e=>[e.unwrap(),e]).map(([e,t])=>new si(this,new Ce(this,`${e.label} (${Es(new Date(e.timestamp),{addSuffix:!0,locale:this.locale})})`,{onClick:()=>{this.loadGame(e.game).catch(se(console)),this.host.engine.imessage("state.loaded.game",[e.label])},title:new Date(e.timestamp).toLocaleString()})).addChildren([new R(this,{classes:[M.fillSpace]}),new ie(this,B.Save,this.host.engine.i18n("state.update.game"),{onClick:()=>{this.updateGame(t,this.host.game.save()),this.host.engine.imessage("state.updated.game",[e.label])}}),new ie(this,B.Edit,this.host.engine.i18n("state.edit.game"),{onClick:()=>{this.storeGame(e.game),this.deleteGame(t,!0),this.host.engine.imessage("state.updated.game",[e.label])}}),new ie(this,B.Copy,this.host.engine.i18n("state.copy.game"),{onClick:()=>{this.copyGame(e.game).catch(se(console)),this.host.engine.imessage("state.copied.game",[e.label])}}),new ie(this,B.Delete,this.host.engine.i18n("state.delete.game"),{onClick:()=>{this.deleteGame(t),this.host.engine.imessage("state.deleted.game",[e.label])}})])))}_refreshStateList(){this.stateList.removeChildren(this.stateList.children),this.stateList.addChildren(this.states.sort((e,t)=>new Date(e.unwrap().timestamp).getTime()-new Date(t.unwrap().timestamp).getTime()).map(e=>[e.unwrap(),e]).map(([e,t])=>new si(this,new Ce(this,`${e.label} (${Es(new Date(e.timestamp),{addSuffix:!0,locale:this.locale})})`,{onClick:()=>{this.loadState(e.state),this.host.engine.imessage("state.loaded.state",[e.label])},title:new Date(e.timestamp).toLocaleString()})).addChildren([new R(this,{classes:[M.fillSpace]}),new ie(this,B.Save,this.host.engine.i18n("state.update.state"),{onClick:()=>{this.updateState(t,this.host.engine.stateSerialize()),this.host.engine.imessage("state.updated.state",[e.label])}}),new ie(this,B.Edit,this.host.engine.i18n("state.edit.state"),{onClick:()=>{this.storeState(e.state),this.deleteState(t,!0),this.host.engine.imessage("state.updated.state",[e.label])}}),new ie(this,B.Copy,this.host.engine.i18n("state.copy.state"),{onClick:()=>{this.copyState(e.state).catch(se(console)),this.host.engine.imessage("state.copied.state",[e.label])}}),new ie(this,B.Delete,this.host.engine.i18n("state.delete.state"),{onClick:()=>{this.deleteState(t),this.host.engine.imessage("state.deleted.state",[e.label])}})])))}async copyState(e){await this.host.copySettings(e,!1)}async copyGame(e){const t=e??this.host.game.save(),i=JSON.stringify(t),n=this.setting.compress.enabled?this.host.game.compressLZData(i):i;await T.window.navigator.clipboard.writeText(n)}import(){const e=T.window.prompt(this.host.engine.i18n("state.loadPrompt"));if(m(e))return;const t=new Date().toDateString();let i=1;const n=()=>this.host.engine.i18n("state.importedState",[`${t} #${i++}`]),a=r=>{try{const h=ge.decodeSettings(r);this.storeState(h,n()),this.host.engine.imessage("state.imported.state");return}catch{}try{const h=JSON.parse(r),d=ge.decodeSettings(h.state);this.storeState(d,h.label),this.host.engine.imessage("state.imported.state");return}catch{}let o;try{o=JSON.parse(r)}catch{const d=this.host.game.decompressLZData(r);try{o=JSON.parse(d)}catch{if(r.match(/\\r?\\n/))return r.split(/\\r?\\n/).map(f=>void a(f));throw new fi("The provided input can not be parsed as anything we understand.")}}let l;if(!m(o)&&"ks"in o&&!m(o.ks)){const h=o.ks.state[0];l=this.storeState(h,n())??void 0,this.host.engine.imessage("state.imported.state"),o.ks=void 0}this.storeGame(o,l),this.host.engine.imessage("state.imported.game")};a(e)}storeGame(e,t){let i=t;return m(i)&&(i=T.window.prompt(this.host.engine.i18n("state.storeGame.prompt"))??void 0),m(i)?null:(i=(i===""?void 0:i)??this.host.engine.i18n("state.unlabeledGame"),i=i.substring(0,127),this.games.push(new yt({game:e??this.host.game.save(),label:i,timestamp:new Date().toISOString()})),this._storeGames(),this.requestRefresh(),i)}storeState(e,t){let i=t;return m(i)&&(i=T.window.prompt(this.host.engine.i18n("state.storeState.prompt"))??void 0),m(i)?null:(i=(i===""?void 0:i)??this.host.engine.i18n("state.unlabeledState"),i=i.substring(0,127),this.states.push(new yt({label:i,state:e??this.host.engine.stateSerialize(),timestamp:new Date().toISOString()})),this._storeStates(),this.requestRefresh(),i)}storeStateFactoryDefaults(){this.storeState(oe.DEFAULT_STATE)}storeAutoSave(e){const t=this.states.find(i=>i.unwrap().label==="Auto-Save");if(!m(t)){console.info(...v("Updating existing Auto-Save...")),t.replace({...t.unwrap(),state:e,timestamp:new Date().toISOString()}),this._storeStates(),this.requestRefresh();return}console.info(...v("Storing new Auto-Save...")),this.storeState(e,"Auto-Save")}exportStateAll(){const e=this.states.map(a=>a.unwrap()).map(a=>JSON.stringify({label:a.label,state:ge.encodeSettings(a.state,!1),timestamp:a.timestamp})).join(`\n`),t=document.createElement("a"),i=new Blob([e],{type:"application/x-ndjson"}),n=URL.createObjectURL(i);t.setAttribute("href",n),t.setAttribute("download",`ks-local-states-${Date.now()}.ndjson`),t.click()}async loadGame(e){this._destructiveActionPrevented()||await new $o(this.host.game).loadRaw(e)}loadState(e){this._destructiveActionPrevented()||(this.host.engine.stateLoad(e,!0),this.host.refreshEntireUserInterface())}loadAutoSave(){if(this.host.engine.isLoaded){console.info(...v("Not attempting to load Auto-Save, because a state is already loaded."));return}const e=this.states.find(t=>t.unwrap().label==="Auto-Save");if(m(e)){console.info(...v("No Auto-Save settings found."));return}console.info(...v("Loading Auto-Save...")),this.host.engine.stateLoad(e.unwrap().state,!1)}updateGame(e,t){if(this._destructiveActionPrevented())return;const i=e.unwrap().label;e.replace({game:t,label:i,timestamp:new Date().toISOString()}),this._storeGames(),this.requestRefresh()}updateState(e,t){if(this._destructiveActionPrevented())return;const i=e.unwrap().label;e.replace({label:i,state:t,timestamp:new Date().toISOString()}),this._storeStates(),this.requestRefresh()}deleteGame(e,t=!1){if(!t&&this._destructiveActionPrevented())return;const i=this.games.indexOf(e);i<0||(this.games.splice(i,1),this._storeGames(),this.requestRefresh())}deleteState(e,t=!1){if(!t&&this._destructiveActionPrevented())return;const i=this.states.indexOf(e);i<0||(this.states.splice(i,1),this._storeStates(),this.requestRefresh())}_destructiveActionPrevented(){return!this.setting.noConfirm.enabled&&!T.window.confirm(this.host.engine.i18n("state.confirmDestruction"))}}class Re extends _e{constructor(e,t,i,n){super(e,new de(e,t,{classes:[O.checked,O.setting],icon:n==null?void 0:n.icon}).addChildrenHead([new R(e,{classes:[M.fillSpace]})]),n);u(this,"setting");this.setting=i}}class Lo extends Re{constructor(e,t,i){var r,o;const n=e.host.engine.i18n("ui.build");super(e,n,t,{icon:B.Bonfire,onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&Object.values(t.buildings).some(l=>l.enabled&&l.trigger<=0)}});u(this,"_buildings");this._buildings=[];for(const l of this.host.game.bld.buildingGroups){this._buildings.push(new D(this,l.title));for(const h of l.buildings){if(h==="unicornPasture"||m(this.setting.buildings[h]))continue;const d=this.host.game.bld.getBuildingExt(h).meta;if(m(d.stages))m(d.label)||this._buildings.push(this._getResetOption(this,this.setting.buildings[h],i,t,d.label));else{const g=(r=Object.values(this.setting.buildings).find(f=>f.baseBuilding===h))==null?void 0:r.building;this._buildings.push(this._getResetOption(this,this.setting.buildings[h],i,t,d.stages[0].label),this._getResetOption(this,this.setting.buildings[g],i,t,d.stages[1].label,!1,!0))}}l!==this.host.game.bld.buildingGroups[this.host.game.bld.buildingGroups.length-1]&&((o=this._buildings.at(-1))==null||o.element.addClass(ke.delimiter))}const a=new x(this);a.addChildren(this._buildings),this.addChildContent(a)}_getResetOption(e,t,i,n,a,r=!1,o=!1){const l=new F(e,t,i,a,{delimiter:r,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[a])},onRefreshRequest:()=>{l.triggerButton.inactive=!t.enabled||t.trigger===-1,l.triggerButton.ineffective=n.enabled&&t.enabled&&t.trigger===-1},onSetTrigger:async()=>{const h=await E.prompt(e,e.host.engine.i18n("ui.trigger.prompt.absolute"),e.host.engine.i18n("ui.trigger.build.prompt",[a,t.trigger!==-1?e.host.renderAbsolute(t.trigger,i.selected):e.host.engine.i18n("ui.trigger.inactive")]),t.trigger!==-1?e.host.renderAbsolute(t.trigger):"",e.host.engine.i18n("ui.trigger.reset.promptExplainer"));if(h!==void 0){if(h===""||h.startsWith("-")){t.trigger=-1,t.enabled=!1;return}t.trigger=Number(h)}},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[a])},upgradeIndicator:o});return l.triggerButton.element.addClass(C.lastHeadAction),l}}class Oo extends Re{constructor(s,e,t){const i=s.host.engine.i18n("ui.faith");super(s,i,e,{icon:B.Religion,onRefreshRequest:()=>{this.expando.ineffective=e.enabled&&Object.values(e.buildings).some(a=>a.enabled&&a.trigger<=0)}}),this.addChildrenHead([new R(s,{classes:[M.fillSpace]})]);const n=[...kt];this.addChildContent(new x(this).addChildren([new D(this,this.host.engine.i18n("$religion.panel.ziggurat.label")),this._getResetOption(this,this.setting.buildings.unicornPasture,t,e,this.host.engine.i18n("$buildings.unicornPasture.label")),...this.host.game.religion.zigguratUpgrades.filter(a=>n.includes(a.name)&&!m(this.setting.buildings[a.name])).map(a=>this._getResetOption(this,this.setting.buildings[a.name],t,e,a.label)),new te(this),...this.host.game.religion.zigguratUpgrades.filter(a=>!n.includes(a.name)&&!m(this.setting.buildings[a.name])).map(a=>this._getResetOption(this,this.setting.buildings[a.name],t,e,a.label)),new te(this),new D(this,this.host.engine.i18n("$religion.panel.orderOfTheSun.label")),...this.host.game.religion.religionUpgrades.filter(a=>!m(this.setting.buildings[a.name])).map(a=>{var r;return this._getResetOption(this,this.setting.buildings[a.name],t,e,a.label,a.name===((r=this.host.game.religion.religionUpgrades.at(-1))==null?void 0:r.name))}),new D(this,this.host.engine.i18n("$religion.panel.cryptotheology.label")),...this.host.game.religion.transcendenceUpgrades.filter(a=>!m(this.setting.buildings[a.name])).map(a=>this._getResetOption(this,this.setting.buildings[a.name],t,e,a.label))]))}_getResetOption(s,e,t,i,n,a=!1,r=!1){const o=new F(s,e,t,n,{delimiter:a,onCheck:()=>{s.host.engine.imessage("status.reset.check.enable",[n])},onRefreshRequest:()=>{o.triggerButton.inactive=!e.enabled||e.trigger===-1,o.triggerButton.ineffective=i.enabled&&e.enabled&&e.trigger===-1},onSetTrigger:async()=>{const l=await E.prompt(s,s.host.engine.i18n("ui.trigger.prompt.absolute"),s.host.engine.i18n("ui.trigger.build.prompt",[n,e.trigger!==-1?s.host.renderAbsolute(e.trigger,t.selected):s.host.engine.i18n("ui.trigger.inactive")]),e.trigger!==-1?s.host.renderAbsolute(e.trigger):"",s.host.engine.i18n("ui.trigger.reset.promptExplainer"));if(l!==void 0){if(l===""||l.startsWith("-")){e.trigger=-1,e.enabled=!1;return}e.trigger=Number(l)}},onUnCheck:()=>{s.host.engine.imessage("status.reset.check.disable",[n])},upgradeIndicator:r});return o.triggerButton.element.addClass(C.lastHeadAction),o}}class Uo extends Re{constructor(s,e,t){const i=s.host.engine.i18n("ui.resources");super(s,i,e,{icon:B.Resources,onRefreshRequest:()=>{this.expando.ineffective=e.enabled&&Object.values(e.resources).some(o=>o.enabled&&o.trigger<0)}}),this.addChildrenHead([new R(s,{classes:[M.fillSpace]})]);const n=this.host.game.resPool.resources,a=[];let r=n[0].title;for(const o of[...n].sort((l,h)=>l.title.localeCompare(h.title,t.selected))){const l=this.setting.resources[o.name],h=new F(this,l,t,X(o.title),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o.title])},onRefreshRequest:()=>{h.triggerButton.inactive=!l.enabled||l.trigger===-1,h.triggerButton.ineffective=e.enabled&&l.enabled&&l.trigger===-1},onSetTrigger:async()=>{const d=await E.prompt(this,this.host.engine.i18n("ui.trigger.prompt.float"),this.host.engine.i18n("ui.trigger.build.prompt",[o.title,l.trigger!==-1?this.host.renderAbsolute(l.trigger,t.selected):this.host.engine.i18n("ui.trigger.inactive")]),l.trigger!==-1?this.host.renderAbsolute(l.trigger):"",this.host.engine.i18n("ui.trigger.reset.promptExplainer"));if(d!==void 0){if(d===""||d.startsWith("-")){l.trigger=-1,l.enabled=!1;return}l.trigger=s.host.parseAbsolute(d)??l.trigger}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o.title])}});h.triggerButton.element.addClass(C.lastHeadAction),this.host.engine.localeSupportsFirstLetterSplits(t.selected)&&r[0]!==o.title[0]&&h.element.addClass(M.splitter),a.push(h),r=o.title}this.addChildContent(new x(this).addChildren(a))}}class Do extends Re{constructor(s,e,t){const i=s.host.engine.i18n("ui.space");super(s,i,e,{icon:B.Space,onRefreshRequest:()=>{this.expando.ineffective=e.enabled&&Object.values(e.buildings).some(n=>n.enabled&&n.trigger<=0)}}),this.addChildrenHead([new R(s,{classes:[M.fillSpace]})]),this.addChildContent(new x(this).addChildren(this.host.game.space.planets.filter(n=>0<n.buildings.length).flatMap((n,a,r)=>[new D(this,this.host.engine.labelForPlanet(n.name)),...n.buildings.filter(o=>!m(this.setting.buildings[o.name])).map((o,l,h)=>this._getResetOption(this,this.setting.buildings[o.name],t,e,o.label,a<r.length-1&&l===h.length-1))])))}_getResetOption(s,e,t,i,n,a=!1,r=!1){const o=new F(s,e,t,n,{delimiter:a,onCheck:()=>{s.host.engine.imessage("status.reset.check.enable",[n])},onRefreshRequest:()=>{o.triggerButton.inactive=!e.enabled||e.trigger===-1,o.triggerButton.ineffective=i.enabled&&e.enabled&&e.trigger===-1},onSetTrigger:async()=>{const l=await E.prompt(s,s.host.engine.i18n("ui.trigger.prompt.absolute"),s.host.engine.i18n("ui.trigger.build.prompt",[n,e.trigger!==-1?s.host.renderAbsolute(e.trigger,t.selected):s.host.engine.i18n("ui.trigger.inactive")]),e.trigger!==-1?s.host.renderAbsolute(e.trigger):"",s.host.engine.i18n("ui.trigger.reset.promptExplainer"));if(l!==void 0){if(l===""||l.startsWith("-")){e.trigger=-1,e.enabled=!1;return}e.trigger=Number(l)}},onUnCheck:()=>{s.host.engine.imessage("status.reset.check.disable",[n])},upgradeIndicator:r});return o.triggerButton.element.addClass(C.lastHeadAction),o}}class No extends Re{constructor(s,e,t){const i=s.host.engine.i18n("ui.time");super(s,i,e,{icon:B.Time,onRefreshRequest:()=>{this.expando.ineffective=e.enabled&&Object.values(e.buildings).some(n=>n.enabled&&n.trigger<=0)}}),this.addChildrenHead([new R(s,{classes:[M.fillSpace]})]),this.addChildContent(new x(this).addChildren([new D(this,this.host.engine.i18n("$workshop.chronoforge.label")),...this.host.game.time.chronoforgeUpgrades.filter(n=>!m(this.setting.buildings[n.name])).map(n=>{var a;return this._getResetOption(this,this.setting.buildings[n.name],t,e,n.label,n.name===((a=this.host.game.time.chronoforgeUpgrades.at(-1))==null?void 0:a.name))}),new D(this,this.host.engine.i18n("$science.voidSpace.label")),...this.host.game.time.voidspaceUpgrades.filter(n=>n.name in this.setting.buildings).map(n=>this._getResetOption(this,this.setting.buildings[n.name],t,e,n.label))]))}_getResetOption(s,e,t,i,n,a=!1,r=!1){const o=new F(s,e,t,n,{delimiter:a,onCheck:()=>{s.host.engine.imessage("status.reset.check.enable",[n])},onRefreshRequest:()=>{o.triggerButton.inactive=!e.enabled||e.trigger===-1,o.triggerButton.ineffective=i.enabled&&e.enabled&&e.trigger===-1},onSetTrigger:async()=>{const l=await E.prompt(s,s.host.engine.i18n("ui.trigger.prompt.absolute"),s.host.engine.i18n("ui.trigger.build.prompt",[n,e.trigger!==-1?s.host.renderAbsolute(e.trigger,t.selected):s.host.engine.i18n("ui.trigger.inactive")]),e.trigger!==-1?s.host.renderAbsolute(e.trigger):"",s.host.engine.i18n("ui.trigger.reset.promptExplainer"));if(l!==void 0){if(l===""||l.startsWith("-")){e.trigger=-1,e.enabled=!1;return}e.trigger=Number(l)}},onUnCheck:()=>{s.host.engine.imessage("status.reset.check.disable",[n])},upgradeIndicator:r});return o.triggerButton.element.addClass(C.lastHeadAction),o}}class qo extends Re{constructor(s,e,t){const i=s.host.engine.i18n("ui.upgrades");super(s,i,e,{icon:B.Workshop}),this.addChildrenHead([new R(s,{classes:[M.fillSpace]})]);const n=this.host.game.workshop.upgrades.filter(l=>!m(this.setting.upgrades[l.name])),a=[];let r=n[0].label,o;for(const l of n.sort((h,d)=>h.label.localeCompare(d.label,t.selected))){const h=this.setting.upgrades[l.name],d=this._getResetOption(this,h,l.label);this.host.engine.localeSupportsFirstLetterSplits(t.selected)&&r[0]!==l.label[0]&&(m(o)||o.element.addClass(ke.delimiter),d.element.addClass(M.splitter)),o=d,a.push(d),r=l.label}this.addChildContent(new x(this).addChildren(a))}_getResetOption(s,e,t,i=!1,n=!1){return new S(s,e,t,{delimiter:i,onCheck:()=>{s.host.engine.imessage("status.reset.check.enable",[t])},onUnCheck:()=>{s.host.engine.imessage("status.reset.check.disable",[t])},upgradeIndicator:n})}}class zo extends U{constructor(e,t,i){const n=e.host.engine.i18n("option.time.reset");super(e,t,new S(e,t,n,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[n])},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[n])}}).addChildrenHead([new R(e,{classes:[M.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&[this._bonfireUi,this._religionUi,this._resourcesUi,this._spaceUi,this._timeUi,this._upgradesUi].some(r=>r.expando.ineffective)}});u(this,"_bonfireUi");u(this,"_religionUi");u(this,"_resourcesUi");u(this,"_spaceUi");u(this,"_timeUi");u(this,"_upgradesUi");const a=new x(this,{hasDisableAll:!1,hasEnableAll:!1});this._bonfireUi=new Lo(this,this.setting.bonfire,i),this._religionUi=new Oo(this,this.setting.religion,i),this._resourcesUi=new Uo(this,this.setting.resources,i),this._spaceUi=new Do(this,this.setting.space,i),this._timeUi=new No(this,this.setting.time,i),this._upgradesUi=new qo(this,this.setting.upgrades,i),a.addChildren([this._bonfireUi,this._religionUi,this._resourcesUi,this._spaceUi,this._timeUi,this._upgradesUi]),this.addChildContent(a)}}class As extends x{constructor(e,t,i){super(e,i);u(this,"setting");this.setting=t;const n=(r,o)=>{const l=e.host.engine.labelForCycle(r);return new S(e,o,l,{onCheck:h=>{var d;(d=i==null?void 0:i.onCheckCycle)==null||d.call(i,l,o,h)},onUnCheck:h=>{var d;(d=i==null?void 0:i.onUnCheckCycle)==null||d.call(i,l,o,h)}})},a=[n("charon",this.setting.charon),n("umbra",this.setting.umbra),n("yarn",this.setting.yarn),n("helios",this.setting.helios),n("cath",this.setting.cath),n("redmoon",this.setting.redmoon),n("dune",this.setting.dune),n("piscine",this.setting.piscine),n("terminus",this.setting.terminus),n("kairo",this.setting.kairo)];this.addChildren(a),this.element[0].addEventListener("enableAll",()=>{for(const r of a)r.check(!0)}),this.element[0].addEventListener("disableAll",()=>{for(const r of a)r.uncheck(!0)})}}class Ut extends x{constructor(e,t,i){super(e,i);u(this,"setting");u(this,"spring");u(this,"summer");u(this,"autumn");u(this,"winter");this.setting=t;const n=(a,r)=>new S(this,r,a,{onCheck:o=>{var l;(l=i==null?void 0:i.onCheckSeason)==null||l.call(i,a,r,o)},onUnCheck:o=>{var l;(l=i==null?void 0:i.onUnCheckSeason)==null||l.call(i,a,r,o)}});this.spring=n(this.host.engine.i18n("$calendar.season.spring"),this.setting.spring),this.summer=n(this.host.engine.i18n("$calendar.season.summer"),this.setting.summer),this.autumn=n(this.host.engine.i18n("$calendar.season.autumn"),this.setting.autumn),this.winter=n(this.host.engine.i18n("$calendar.season.winter"),this.setting.winter),this.addChildren([this.spring,this.summer,this.autumn,this.winter])}toString(){return`[${Ut.name}#${this.componentId}]`}}class Fo extends U{constructor(s,e,t,i,n){const a=s.host.engine.i18n("option.time.activeHeatTransfer");super(s,e,new F(s,e,t,a,{onCheck:r=>{s.host.engine.imessage("status.auto.enable",[a])},onSetTrigger:async()=>{const r=await E.prompt(s,s.host.engine.i18n("ui.trigger.activeHeatTransfer.prompt"),s.host.engine.i18n("ui.trigger.activeHeatTransfer.promptTitle",[s.host.renderPercentage(e.trigger,t.selected,!0)]),s.host.renderPercentage(e.trigger),s.host.engine.i18n("ui.trigger.activeHeatTransfer.promptExplainer"));r===void 0||r===""||r.startsWith("-")||(e.trigger=s.host.parsePercentage(r))},onUnCheck:r=>{s.host.engine.imessage("status.auto.disable",[a]),e.activeHeatTransferStatus.enabled=!1}}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!e.enabled,this.settingItem.triggerButton.ineffective=n.enabled&&i.enabled&&e.enabled&&e.trigger===-1,this.expando.ineffective=n.enabled&&i.enabled&&e.enabled&&!Object.values(e.cycles).some(r=>r.enabled),e.activeHeatTransferStatus.enabled?(this.head.elementLabel.attr("data-ks-active-from","◎"),this.head.elementLabel.attr("data-ks-active-to","◎"),this.head.elementLabel.addClass(Pt.active)):this.head.elementLabel.removeClass(Pt.active)}}),this.addChildContent(new x(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new As(this,this.setting.cycles,{onCheckCycle:r=>{this.host.engine.imessage("time.heatTransfer.cycle.enable",[r])},onUnCheckCycle:r=>{this.host.engine.imessage("time.heatTransfer.cycle.disable",[r])}})]))}}class Ho extends U{constructor(e,t,i,n){const a=e.host.engine.i18n("option.time.skip");super(e,t,new At(e,t,i,a,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[a])},onRefreshMax(){this.maxButton.updateLabel(e.host.renderAbsolute(t.max)),this.maxButton.element[0].title=t.max<0?e.host.engine.i18n("ui.max.timeSkip.titleInfinite",[a]):t.max===0?e.host.engine.i18n("ui.max.timeSkip.titleZero",[a]):e.host.engine.i18n("ui.max.timeSkip.title",[e.host.renderAbsolute(t.max),a])},onRefreshTrigger(){this.triggerButton.element[0].title=e.host.engine.i18n("ui.trigger",[t.trigger<0?e.host.engine.i18n("ui.trigger.section.inactive"):`${e.host.renderFloat(t.trigger,i.selected)} TC`])},onSetMax:async()=>{const r=await E.prompt(e,e.host.engine.i18n("ui.max.timeSkip.prompt"),e.host.engine.i18n("ui.max.timeSkip.promptTitle",[e.host.renderAbsolute(t.max,i.selected)]),e.host.renderAbsolute(t.max),e.host.engine.i18n("ui.max.timeSkip.promptExplainer"));if(r!==void 0){if(r===""||r.startsWith("-")){t.max=-1;return}r==="0"&&(t.enabled=!1),t.max=e.host.parseAbsolute(r)??t.max}},onSetTrigger:async()=>{const r=await E.prompt(e,e.host.engine.i18n("ui.trigger.timeSkip.prompt"),e.host.engine.i18n("ui.trigger.timeSkip.promptTitle",[e.host.renderAbsolute(t.trigger,i.selected)]),e.host.renderAbsolute(t.trigger),e.host.engine.i18n("ui.trigger.timeSkip.promptExplainer"));r===void 0||r===""||r.startsWith("-")||(t.trigger=e.host.parseAbsolute(r)??t.trigger)},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[a])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.maxButton.inactive=!t.enabled||t.max===-1,this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1,this.settingItem.maxButton.ineffective=n.enabled&&t.enabled&&t.max===0,this._cycles.expando.ineffective=n.enabled&&t.enabled&&!Object.values(t.cycles).some(r=>r.enabled),this._seasons.expando.ineffective=n.enabled&&t.enabled&&!Object.values(t.seasons).some(r=>r.enabled)}});u(this,"_cycles");u(this,"_seasons");u(this,"_activeHeatTransferUI");this.settingItem.triggerButton.element.removeClass(C.lastHeadAction),this._cycles=new _e(this,new de(this,X(this.host.engine.i18n("ui.cycles")),{classes:[O.checked,O.setting],icon:B.Cycles}).addChildrenHead([new R(this,{classes:[M.fillSpace]})])).addChildrenContent([new As(this,this.setting.cycles,{onCheckCycle:r=>{this.host.engine.imessage("time.skip.cycle.enable",[r])},onUnCheckCycle:r=>{this.host.engine.imessage("time.skip.cycle.disable",[r])}})]),this._seasons=new _e(this,new de(this,X(this.host.engine.i18n("trade.seasons")),{classes:[O.checked,O.setting],icon:B.Seasons}).addChildrenHead([new R(this,{classes:[M.fillSpace]})])).addChildrenContent([new Ut(this,this.setting.seasons,{onCheckSeason:r=>{this.host.engine.imessage("time.skip.season.enable",[r])},onUnCheckSeason:r=>{this.host.engine.imessage("time.skip.season.disable",[r])}})]),this._activeHeatTransferUI=new Fo(this,this.setting.activeHeatTransfer,i,t,n),this.addChildContent(new x(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([this._cycles,this._seasons,new S(this,this.setting.ignoreOverheat,this.host.engine.i18n("option.time.skip.ignoreOverheat")),this._activeHeatTransferUI]))}}class yi extends U{constructor(e,t,i){console.debug(...v(`Constructing ${yi.name}`));const n=e.host.engine.i18n("ui.timeCtrl");super(e,t,new S(e,t,n,{onCheck:o=>{e.host.engine.imessage("status.auto.enable",[n])},onUnCheck:o=>{e.host.engine.imessage("status.auto.disable",[n])}}).addChildrenHead([new R(e,{classes:[M.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&[this._timeSkipUi,this._resetUi].some(o=>o.expando.ineffective)}});u(this,"_items");u(this,"_accelerateTime");u(this,"_timeSkipUi");u(this,"_resetUi");const a=new x(this,{hasDisableAll:!1,hasEnableAll:!1}),r=this.host.engine.i18n("option.accelerate");this._accelerateTime=new F(this,this.setting.accelerateTime,i,r,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[r])},onRefresh:()=>{this._accelerateTime.triggerButton.inactive=!this.setting.accelerateTime.enabled,this._accelerateTime.triggerButton.ineffective=this.setting.enabled&&this.setting.accelerateTime.enabled&&this.setting.accelerateTime.trigger===-1},onSetTrigger:async()=>{const o=await E.prompt(this,this.host.engine.i18n("ui.trigger.accelerateTime.prompt"),this.host.engine.i18n("ui.trigger.accelerateTime.promptTitle",[this.host.renderPercentage(this.setting.accelerateTime.trigger,i.selected,!0)]),this.host.renderPercentage(this.setting.accelerateTime.trigger),this.host.engine.i18n("ui.trigger.accelerateTime.promptExplainer"));o===void 0||o===""||o.startsWith("-")||(this.setting.accelerateTime.trigger=this.host.parsePercentage(o))},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[r])}}),this._accelerateTime.triggerButton.element.addClass(C.lastHeadAction),this._timeSkipUi=new Ho(this,this.setting.timeSkip,i,t),this._resetUi=new zo(this,this.setting.reset,i),this._items=[this._accelerateTime,this._timeSkipUi,this._resetUi],a.addChildren(this._items),this.addChildContent(a)}}class wi extends U{constructor(s,e,t){console.debug(...v(`Constructing ${wi.name}`));const i=s.host.engine.i18n("ui.time");super(s,e,new F(s,e,t,i,{onCheck:n=>{s.host.engine.imessage("status.auto.enable",[i])},onRefresh:()=>{this.settingItem.triggerButton.inactive=!e.enabled||e.trigger===-1},onRefreshTrigger(){this.triggerButton.element[0].title=s.host.engine.i18n("ui.trigger.section",[e.trigger<0?s.host.engine.i18n("ui.trigger.section.inactive"):s.host.renderPercentage(e.trigger,t.selected,!0)])},onSetTrigger:async()=>{const n=await E.prompt(s,s.host.engine.i18n("ui.trigger.prompt.percentage"),s.host.engine.i18n("ui.trigger.section.prompt",[i,e.trigger!==-1?s.host.renderPercentage(e.trigger,t.selected,!0):s.host.engine.i18n("ui.infinity")]),e.trigger!==-1?s.host.renderPercentage(e.trigger):"",s.host.engine.i18n("ui.trigger.section.promptExplainer"));if(n!==void 0){if(n===""||n.startsWith("-")){e.trigger=-1;return}e.trigger=s.host.parsePercentage(n)}},onUnCheck:n=>{s.host.engine.imessage("status.auto.disable",[i])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!e.enabled||e.trigger<0,this.settingItem.triggerButton.ineffective=e.enabled&&e.trigger<0&&Object.values(e.buildings).some(n=>n.enabled&&0<n.max&&n.trigger<0),this.expando.ineffective=e.enabled&&Object.values(e.buildings).some(n=>n.enabled&&(n.max===0||n.trigger<0&&e.trigger<0))}}),this.addChildrenContent([new x(this).addChildren([new D(this,this.host.engine.i18n("$workshop.chronoforge.label")),...this.host.game.time.chronoforgeUpgrades.filter(n=>!m(this.setting.buildings[n.name])).map(n=>{var a;return le.getBuildOption(this,this.setting.buildings[n.name],t,this.setting,n.label,i,{delimiter:n.name===((a=this.host.game.time.chronoforgeUpgrades.at(-1))==null?void 0:a.name),renderLabelTrigger:!1})}),new D(this,this.host.engine.i18n("$science.voidSpace.label")),...this.host.game.time.voidspaceUpgrades.filter(n=>n.name in this.setting.buildings).map(n=>le.getBuildOption(this,this.setting.buildings[n.name],t,this.setting,n.label,i,{renderLabelTrigger:!1}))]),new x(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new D(this,this.host.engine.i18n("ui.additional")),new S(this,this.setting.fixCryochambers,this.host.engine.i18n("option.fix.cry"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.fix.cry")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.fix.cry")])}})])])}}const Wo={buyButton:"_buyButton_10eul_1"};class ki extends Ce{constructor(e,t,i,n){super(e,void 0,{onClick:async()=>{const a=await E.prompt(e,e.host.engine.i18n("blackcoin.buy.prompt"),e.host.engine.i18n("blackcoin.buy.promptTitle",[e.host.renderAbsolute(t.buy,i.selected)]),e.host.renderAbsolute(t.buy),e.host.engine.i18n("blackcoin.buy.promptExplainer"));if(a!==void 0){if(a===""||a.startsWith("-")){t.buy=-1;return}t.buy=e.host.parseAbsolute(a)??t.buy}},onRefresh:()=>{var a;this.element.prop("title",this.host.engine.i18n("blackcoin.buy.title",[this.host.renderAbsolute(this.setting.buy)])),this.element.text(this.host.engine.i18n("blackcoin.buy",[this.host.renderAbsolute(this.setting.buy)])),(a=n==null?void 0:n.onRefresh)==null||a.call(this)}});u(this,"setting");this.element.addClass(Wo.buyButton),this.setting=t}toString(){return`[${ki.name}#${this.componentId}]`}}const Go={sellButton:"_sellButton_1tmvd_1"};class _i extends Ce{constructor(e,t,i,n){super(e,void 0,{onClick:async()=>{const a=await E.prompt(e,e.host.engine.i18n("blackcoin.sell.prompt"),e.host.engine.i18n("blackcoin.sell.promptTitle",[e.host.renderAbsolute(t.sell,i.selected)]),e.host.renderAbsolute(t.sell),e.host.engine.i18n("blackcoin.sell.promptExplainer"));if(a!==void 0){if(a===""||a.startsWith("-")){t.sell=-1;return}t.sell=e.host.parseAbsolute(a)??t.sell}},onRefresh:()=>{var a;this.element.prop("title",this.host.engine.i18n("blackcoin.sell.title",[this.host.renderAbsolute(this.setting.sell)])),this.element.text(this.host.engine.i18n("blackcoin.sell",[this.host.renderAbsolute(this.setting.sell)])),(a=n==null?void 0:n.onRefresh)==null||a.call(n)}});u(this,"setting");this.element.addClass(Go.sellButton),this.setting=t}toString(){return`[${_i.name}#${this.componentId}]`}}class Dt extends J{constructor(e,t,i){super(e,"",B.Eco,{border:!1,classes:[],onClick:()=>{var n,a;this.setting.limited=!this.setting.limited,this.setting.limited?(n=i==null?void 0:i.onLimitedCheck)==null||n.call(this):(a=i==null?void 0:i.onLimitedUnCheck)==null||a.call(this)},onRefresh:()=>{var n;this.updateTitle(this.host.engine.i18n(this.setting.limited?"ui.limited.on":"ui.limited.off")),this.setting.limited&&!this.inactive?this.element.removeClass(C.inactive):this.element.addClass(C.inactive),(n=i==null?void 0:i.onRefresh)==null||n.call(this)}});u(this,"setting");this.setting=t;for(const n of(i==null?void 0:i.classes)??[])this.element.addClass(n)}toString(){return`[${Dt.name}#${this.componentId}]`}}class Ci extends S{constructor(e,t,i,n){super(e,t,i,n);u(this,"limitedButton");this.limitedButton=new Dt(e,t,{border:!1,onLimitedCheck:n!=null&&n.onLimitedCheck?()=>{var a;return(a=n.onLimitedCheck)==null?void 0:a.call(this)}:void 0,onLimitedUnCheck:n!=null&&n.onLimitedUnCheck?()=>{var a;return(a=n.onLimitedUnCheck)==null?void 0:a.call(this)}:void 0}),this.addChildrenHead([new R(e,{classes:[M.fillSpace]}),this.limitedButton])}toString(){return`[${Ci.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class Si extends Ci{constructor(e,t,i,n,a){super(e,t,n,a);u(this,"triggerButton");this.triggerButton=new Ee(e,t,i,{border:!1,onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a!=null&&a.onRefreshTrigger?()=>{var r;return(r=a.onRefreshTrigger)==null?void 0:r.call(this)}:void 0,renderLabel:(a==null?void 0:a.renderLabelTrigger)??!0}),this.addChildHead(this.triggerButton)}toString(){return`[${Si.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class Nt extends S{constructor(e,t,i,n){super(e,t,i,n);u(this,"maxButton");this.maxButton=new Pe(e,t,{border:!1,onClick:async()=>{await n.onSetMax.call(this)},onRefresh:n!=null&&n.onRefreshMax?()=>{var a;return(a=n.onRefreshMax)==null?void 0:a.call(this)}:void 0}),this.addChildrenHead([new R(e,{classes:[M.fillSpace]}),this.maxButton])}toString(){return`[${Nt.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class Zo extends U{constructor(s,e,t,i){const n=s.host.engine.i18n("option.embassies");super(s,e,new F(s,e,t,n,{onCheck:r=>{s.host.engine.imessage("status.auto.enable",[n])},onSetTrigger:async()=>{const r=await E.prompt(s,s.host.engine.i18n("ui.trigger.embassies.prompt"),s.host.engine.i18n("ui.trigger.embassies.promptTitle",[s.host.renderPercentage(e.trigger,t.selected,!0)]),s.host.renderPercentage(e.trigger),s.host.engine.i18n("ui.trigger.embassies.promptExplainer"));r===void 0||r===""||r.startsWith("-")||(e.trigger=s.host.parsePercentage(r))},onUnCheck:r=>{s.host.engine.imessage("status.auto.disable",[n])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!e.enabled,this.settingItem.triggerButton.ineffective=e.enabled&&e.trigger===-1,this.expando.ineffective=i.enabled&&e.enabled&&!Object.values(e.races).some(r=>r.enabled)}});const a=new x(this).addChildren(this.host.game.diplomacy.races.filter(r=>r.name!=="leviathans"&&!m(this.setting.races[r.name])).map(r=>this._makeEmbassySetting(this,this.setting.races[r.name],t.selected,e,r.title)));this.addChildContent(a)}_makeEmbassySetting(s,e,t,i,n){const a=async()=>{const o=await E.prompt(s,s.host.engine.i18n("ui.max.prompt.absolute"),s.host.engine.i18n("ui.max.build.prompt",[n,s.host.renderAbsolute(e.max,t)]),s.host.renderAbsolute(e.max),s.host.engine.i18n("ui.max.build.promptExplainer"));if(o!==void 0){if(o===""||o.startsWith("-")){e.max=-1;return}o==="0"&&(e.enabled=!1),e.max=s.host.parseAbsolute(o)??e.max}},r=new Nt(s,e,n,{onCheck:o=>{if(s.host.engine.imessage("status.sub.enable",[n]),e.max===0&&!o)return a()},onRefresh:()=>{r.maxButton.inactive=!e.enabled||e.max===-1,r.maxButton.ineffective=i.enabled&&e.enabled&&e.max===0},onRefreshMax:()=>{r.maxButton.updateLabel(s.host.renderAbsolute(e.max)),r.maxButton.element[0].title=e.max<0?s.host.engine.i18n("ui.max.embassy.titleInfinite",[n]):e.max===0?s.host.engine.i18n("ui.max.embassy.titleZero",[n]):s.host.engine.i18n("ui.max.embassy.title",[s.host.renderAbsolute(e.max),n])},onSetMax:a,onUnCheck:()=>{s.host.engine.imessage("status.sub.disable",[n])}});return r.maxButton.element.addClass(C.lastHeadAction),r}}class xi extends U{constructor(e,t,i){console.debug(...v(`Constructing ${xi.name}`));const n=e.host.engine.i18n("ui.trade");super(e,t,new F(e,t,i,n,{onCheck:o=>{e.host.engine.imessage("status.auto.enable",[n])},onRefreshTrigger(){this.triggerButton.element[0].title=e.host.engine.i18n("ui.trigger.section",[t.trigger<0?e.host.engine.i18n("ui.trigger.section.inactive"):e.host.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const o=await E.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[n,t.trigger!==-1?e.host.renderPercentage(t.trigger,i.selected,!0):e.host.engine.i18n("ui.infinity")]),t.trigger!==-1?e.host.renderPercentage(t.trigger):"",e.host.engine.i18n("ui.trigger.section.promptExplainer"));if(o!==void 0){if(o===""||o.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(o)}},onUnCheck:o=>{e.host.engine.imessage("status.auto.disable",[n])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger<0&&Object.values(t.races).some(o=>o.enabled&&o.trigger<0),this.expando.ineffective=t.enabled&&Object.values(this._racePanels).some(o=>o.expando.ineffective||o.settingItem.triggerButton.ineffective)}});u(this,"_racePanels");this._racePanels=this.host.game.diplomacy.races.filter(o=>!m(this.setting.races[o.name])).map(o=>{var l;return this._getTradeOption(this,this.setting.races[o.name],i,t,o.title,n,o.name===((l=this.host.game.diplomacy.races.at(-2))==null?void 0:l.name))});const a=new x(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren(this._racePanels);a.addChild(new S(this,this.setting.feedLeviathans,this.host.engine.i18n("option.autofeed"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.autofeed")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.autofeed")])}})),a.addChild(new U(this,this.setting.tradeBlackcoin,new F(this,this.setting.tradeBlackcoin,i,this.host.engine.i18n("option.crypto"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.crypto")])},onRefreshRequest(){this.triggerButton.inactive=!this.setting.enabled||this.setting.trigger===-1},onSetTrigger:async()=>{const o=await E.prompt(this,this.host.engine.i18n("ui.trigger.crypto.promptTitle"),this.host.engine.i18n("ui.trigger.crypto.prompt",[this.host.renderAbsolute(this.setting.tradeBlackcoin.trigger,i.selected)]),this.host.renderAbsolute(this.setting.tradeBlackcoin.trigger),this.host.engine.i18n("ui.trigger.crypto.promptExplainer"));o===void 0||o===""||o.startsWith("-")||(this.setting.tradeBlackcoin.trigger=this.host.parseAbsolute(o)??this.setting.tradeBlackcoin.trigger)},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.crypto")])}})).addChildrenContent([new ki(this,this.setting.tradeBlackcoin,i),new _i(this,this.setting.tradeBlackcoin,i)])),this.addChildContent(a);const r=new x(this,{hasDisableAll:!1,hasEnableAll:!1});r.addChild(new D(this,this.host.engine.i18n("ui.additional"))),r.addChild(new Zo(this,this.setting.buildEmbassies,i,t)),r.addChild(new S(this,this.setting.unlockRaces,this.host.engine.i18n("ui.upgrade.races"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("ui.upgrade.races")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("ui.upgrade.races")])}})),this.addChildContent(r)}_getTradeOption(e,t,i,n,a,r,o=!1,l=!1){const h=new Si(e,t,i,a,{delimiter:o,onCheck:()=>{e.host.engine.imessage("status.sub.enable",[a])},onLimitedCheck:()=>{e.host.engine.imessage("trade.limited",[a])},onLimitedUnCheck:()=>{e.host.engine.imessage("trade.unlimited",[a])},onRefreshTrigger:()=>{h.triggerButton.element[0].title=e.host.engine.i18n("ui.trigger",[t.trigger<0?n.trigger<0?e.host.engine.i18n("ui.trigger.section.blocked",[r]):`${e.host.renderPercentage(n.trigger,i.selected,!0)} (${e.host.engine.i18n("ui.trigger.section.inherited")})`:e.host.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const g=await E.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[a,t.trigger!==-1?e.host.renderPercentage(t.trigger,i.selected,!0):e.host.engine.i18n("ui.trigger.section.inherited")]),t.trigger!==-1?e.host.renderPercentage(t.trigger):"",e.host.engine.i18n("ui.trigger.section.promptExplainer"));if(g!==void 0){if(g===""||g.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(g)}},onUnCheck:()=>{e.host.engine.imessage("status.sub.disable",[a])},renderLabelTrigger:!1,upgradeIndicator:l}),d=new U(e,t,h,{onRefreshRequest:()=>{h.limitedButton.inactive=!t.enabled||!t.limited,h.triggerButton.inactive=!t.enabled||t.trigger===-1,h.triggerButton.ineffective=n.enabled&&t.enabled&&n.trigger===-1&&t.trigger===-1,d.expando.ineffective=n.enabled&&t.enabled&&!t.seasons.autumn.enabled&&!t.seasons.spring.enabled&&!t.seasons.summer.enabled&&!t.seasons.winter.enabled}}).addChildContent(new Ut(e,t.seasons,{onCheckSeason:g=>{e.host.engine.imessage("trade.season.enable",[X(a),g])},onUnCheckSeason:g=>{e.host.engine.imessage("trade.season.disable",[X(a),g])}}));return d}}const Ti={spacer:"_spacer_auis8_44",ui:"_ui_auis8_49",showActivity:"_showActivity_auis8_66"};class Ei extends U{constructor(e,t,i){console.debug(...v(`Constructing ${Ei.name}`));const n=e.host.engine.i18n("ui.distribute");super(e,t,new S(e,t,n,{onCheck:o=>{e.host.engine.imessage("status.auto.enable",[n])},onUnCheck:o=>{e.host.engine.imessage("status.auto.disable",[n])}}).addChildrenHead([new R(e,{classes:[M.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&Object.values(t.jobs).some(o=>o.enabled&&o.max===0)}});u(this,"_hunt");u(this,"_festivals");u(this,"_promoteKittens");u(this,"_promoteLeader");u(this,"_electLeader");const a=new x(this).addChildren(this.host.game.village.jobs.filter(o=>!m(this.setting.jobs[o.name])).map(o=>this._getDistributeOption(this.setting.jobs[o.name],i.selected,t,o.title)));this.addChildContent(a);const r=new x(this,{hasDisableAll:!1,hasEnableAll:!1});r.addChild(new D(this,this.host.engine.i18n("ui.additional"))),this._hunt=new F(this,this.setting.hunt,i,this.host.engine.i18n("option.hunt"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.hunt")])},onRefreshRequest:()=>{this._hunt.triggerButton.inactive=!this.setting.hunt.enabled,this._hunt.triggerButton.ineffective=this.setting.enabled&&this.setting.hunt.enabled&&this.setting.hunt.trigger===-1},onSetTrigger:async()=>{const o=await E.prompt(this,this.host.engine.i18n("ui.trigger.prompt.percentage"),this.host.engine.i18n("ui.trigger.hunt.prompt",[this.host.renderPercentage(this.setting.hunt.trigger,i.selected,!0)]),this.host.renderPercentage(this.setting.hunt.trigger),this.host.engine.i18n("ui.trigger.hunt.promptExplainer"));o===void 0||o===""||o.startsWith("-")||(this.setting.hunt.trigger=this.host.parsePercentage(o))},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.hunt")])}}),this._hunt.triggerButton.element.addClass(C.lastHeadAction),r.addChild(this._hunt),this._festivals=new S(this,this.setting.holdFestivals,this.host.engine.i18n("option.festival"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.festival")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.festival")])}}),r.addChild(this._festivals),this._promoteKittens=new F(this,this.setting.promoteKittens,i,this.host.engine.i18n("option.promotekittens"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.promotekittens")])},onRefresh:()=>{this._promoteKittens.triggerButton.inactive=!this.setting.promoteKittens.enabled,this._promoteKittens.triggerButton.ineffective=this.setting.enabled&&this.setting.promoteKittens.enabled&&this.setting.promoteKittens.trigger===-1},onSetTrigger:async()=>{const o=await E.prompt(this,this.host.engine.i18n("ui.trigger.promoteKittens.promptTitle"),this.host.engine.i18n("ui.trigger.promoteKittens.prompt",[this.host.renderPercentage(this.setting.promoteKittens.trigger,i.selected,!0)]),this.host.renderPercentage(this.setting.promoteKittens.trigger),this.host.engine.i18n("ui.trigger.promoteKittens.promptExplainer"));o===void 0||o===""||o.startsWith("-")||(this.setting.promoteKittens.trigger=this.host.parsePercentage(o))},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.promotekittens")])}}),this._promoteKittens.triggerButton.element.addClass(C.lastHeadAction),r.addChild(this._promoteKittens),this._promoteLeader=new S(this,this.setting.promoteLeader,this.host.engine.i18n("option.promote"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.promote")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.promote")])}}),r.addChild(this._promoteLeader);for(const o of this.setting.electLeader.job.options)o.value==="any"?o.label=this.host.engine.i18n("option.elect.job.any"):o.label=this.host.engine.i18n(`$village.job.${o.value}`);for(const o of this.setting.electLeader.trait.options)o.label=this.host.engine.i18n(`$village.trait.${o.value}`);this._electLeader=new S(this,this.setting.electLeader,this.host.engine.i18n("option.elect"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.elect")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.elect")])}}).addChildren([new Ie(this,this.host.engine.i18n("option.elect.job"),this.setting.electLeader.job),new Ie(this,this.host.engine.i18n("option.elect.trait"),this.setting.electLeader.trait)]),r.addChild(this._electLeader),this.addChildContent(r)}_getDistributeOption(e,t,i,n,a=!1){const r=async()=>{const l=await E.prompt(this,this.host.engine.i18n("ui.max.distribute.prompt",[n]),this.host.engine.i18n("ui.max.distribute.promptTitle",[n,this.host.renderAbsolute(e.max,t)]),this.host.renderAbsolute(e.max),this.host.engine.i18n("ui.max.distribute.promptExplainer"));if(l!==void 0){if(l===""||l.startsWith("-")){e.max=-1;return}l==="0"&&(e.enabled=!1),e.max=this.host.parseAbsolute(l)??e.max}},o=new Nt(this,e,n,{delimiter:a,onCheck:l=>{if(this.host.engine.imessage("status.sub.enable",[n]),e.max===0&&!l)return r()},onRefresh:()=>{o.maxButton.inactive=!e.enabled||e.max===-1,o.maxButton.ineffective=i.enabled&&e.enabled&&e.max===0},onRefreshMax:()=>{o.maxButton.updateLabel(this.host.renderAbsolute(e.max)),o.maxButton.element[0].title=e.max<0?this.host.engine.i18n("ui.max.distribute.titleInfinite",[n]):e.max===0?this.host.engine.i18n("ui.max.distribute.titleZero",[n]):this.host.engine.i18n("ui.max.distribute.title",[this.host.renderAbsolute(e.max),n])},onSetMax:r,onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[n])}});return o.maxButton.element.addClass(C.lastHeadAction),o}}class Ri extends S{constructor(e,t,i,n,a){super(e,t,n,a);u(this,"limitedButton");u(this,"maxButton");u(this,"triggerButton");this.limitedButton=new Dt(e,t,{...a,classes:[Et.headAction]}),this.maxButton=new Pe(e,t,{alignment:"right",border:!1,classes:[C.headAction],onClick:()=>a.onSetMax.call(this),onRefresh:a!=null&&a.onRefreshMax?()=>{var r;return(r=a.onRefreshMax)==null?void 0:r.call(this)}:void 0}),this.triggerButton=new Ee(e,t,i,{border:!1,classes:[C.lastHeadAction],onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a!=null&&a.onRefreshTrigger?()=>{var r;return(r=a.onRefreshTrigger)==null?void 0:r.call(this)}:void 0,renderLabel:(a==null?void 0:a.renderLabelTrigger)??!0}),this.addChildrenHead([new R(e,{classes:[M.fillSpace]}),this.limitedButton,this.maxButton,this.triggerButton])}toString(){return`[${Ri.name}#${this.componentId}]`}}class Ko extends U{constructor(s,e,t){const i=s.host.engine.i18n("ui.upgrade.upgrades");super(s,e,new F(s,e,t,i,{onCheck:l=>{s.host.engine.imessage("status.auto.enable",[i])},onRefreshTrigger(){this.triggerButton.element[0].title=s.host.engine.i18n("ui.trigger",[e.trigger===-1?s.host.engine.i18n("ui.trigger.section.inactive"):s.host.renderPercentage(e.trigger,t.selected,!0)])},onSetTrigger:async()=>{const l=await E.prompt(s,s.host.engine.i18n("ui.trigger.prompt.percentage"),s.host.engine.i18n("ui.trigger.section.prompt",[i,e.trigger!==-1?s.host.renderPercentage(e.trigger,t.selected,!0):s.host.engine.i18n("ui.infinity")]),e.trigger!==-1?s.host.renderPercentage(e.trigger):"",s.host.engine.i18n("ui.trigger.section.promptExplainer"));if(l!==void 0){if(l===""||l.startsWith("-")){e.trigger=-1;return}e.trigger=s.host.parsePercentage(l)}},onUnCheck:l=>{s.host.engine.imessage("status.auto.disable",[i])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!e.enabled||e.trigger===-1,this.settingItem.triggerButton.ineffective=e.enabled&&e.trigger<0&&Object.values(e.upgrades).some(l=>l.enabled&&l.trigger<0),this.expando.ineffective=e.enabled&&!Object.values(e.upgrades).some(l=>l.enabled)}});const n=this.host.game.workshop.upgrades.filter(l=>!m(this.setting.upgrades[l.name])),a=[];let r=n[0].label,o;for(const l of n.sort((h,d)=>h.label.localeCompare(d.label,t.selected))){const h=this.setting.upgrades[l.name],d=new F(this,h,t,l.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[l.label])},onRefreshRequest:()=>{d.triggerButton.inactive=!h.enabled||h.trigger===-1,d.triggerButton.ineffective=e.enabled&&h.enabled&&e.trigger===-1&&h.trigger===-1},onRefreshTrigger:()=>{d.triggerButton.element[0].title=this.host.engine.i18n("ui.trigger",[h.trigger<0?e.trigger<0?this.host.engine.i18n("ui.trigger.build.blocked",[i]):`${this.host.renderPercentage(e.trigger,t.selected,!0)} (${this.host.engine.i18n("ui.trigger.section.inherited")})`:this.host.renderPercentage(h.trigger,t.selected,!0)])},onSetTrigger:async()=>{const g=await E.prompt(this,this.host.engine.i18n("ui.trigger.prompt.percentage"),this.host.engine.i18n("ui.trigger.section.prompt",[i,h.trigger!==-1?this.host.renderPercentage(h.trigger,t.selected,!0):this.host.engine.i18n("ui.trigger.section.inherited")]),h.trigger!==-1?this.host.renderPercentage(h.trigger):"",this.host.engine.i18n("ui.trigger.section.promptExplainer"));if(g!==void 0){if(g===""||g.startsWith("-")){h.trigger=-1;return}h.trigger=this.host.parsePercentage(g)}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[l.label])},renderLabelTrigger:!1});d.triggerButton.element.addClass(C.lastHeadAction),this.host.engine.localeSupportsFirstLetterSplits(t.selected)&&r[0]!==l.label[0]&&(m(o)||o.element.addClass(ke.delimiter),d.element.addClass(M.splitter)),o=d,a.push(d),r=l.label}this.addChildContent(new x(this).addChildren(a))}}class Mi extends U{constructor(e,t,i){console.debug(...v(`Constructing ${Mi.name}`));const n=e.host.engine.i18n("ui.craft");super(e,t,new F(e,t,i,n,{onCheck:l=>{e.host.engine.imessage("status.auto.enable",[n])},onRefreshTrigger(){this.triggerButton.element[0].title=e.host.engine.i18n("ui.trigger.section",[t.trigger<0?e.host.engine.i18n("ui.trigger.section.inactive"):e.host.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const l=await E.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[n,t.trigger!==-1?e.host.renderPercentage(t.trigger,i.selected,!0):e.host.engine.i18n("ui.infinity")]),t.trigger!==-1?e.host.renderPercentage(t.trigger):"",e.host.engine.i18n("ui.trigger.section.promptExplainer"));if(l!==void 0){if(l===""||l.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(l)}},onUnCheck:l=>{e.host.engine.imessage("status.auto.disable",[n])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger<0&&Object.values(t.resources).some(l=>l.enabled&&l.max!==0&&l.trigger<0)}});u(this,"_crafts");let a=[];game.challenges.getChallenge("ironWill").active||(this.setting.resources.bloodstone.enabled=!1,this.setting.resources.tMythril.enabled=!1,a=["bloodstone","tMythril"]);const r=this.host.game.workshop.crafts.filter(l=>!a.includes(l.name)&&!m(this.setting.resources[l.name])).map(l=>[this.setting.resources[l.name],X(l.label)]);this._crafts=[];for(const[l,h]of r){const d=async()=>{const f=await E.prompt(this,this.host.engine.i18n("ui.max.craft.prompt",[h]),this.host.engine.i18n("ui.max.craft.promptTitle",[h,this.host.renderAbsolute(l.max,i.selected)]),this.host.renderAbsolute(l.max),this.host.engine.i18n("ui.max.craft.promptExplainer"));if(f!==void 0){if(f===""||f.startsWith("-")){l.max=-1;return}f==="0"&&(l.enabled=!1),l.max=this.host.parseAbsolute(f)??l.max}},g=new Ri(this,l,i,h,{delimiter:l.resource==="kerosene"||l.resource==="blueprint",onCheck:f=>{if(this.host.engine.imessage("status.sub.enable",[h]),l.max===0&&!f)return d()},onLimitedCheck:()=>{this.host.engine.imessage("craft.limited",[h])},onLimitedUnCheck:()=>{this.host.engine.imessage("craft.unlimited",[h])},onRefreshMax:()=>{g.maxButton.updateLabel(this.host.renderAbsolute(l.max)),g.maxButton.element[0].title=l.max<0?this.host.engine.i18n("ui.max.craft.titleInfinite",[h]):l.max===0?this.host.engine.i18n("ui.max.craft.titleZero",[h]):this.host.engine.i18n("ui.max.craft.title",[this.host.renderAbsolute(l.max),h])},onRefreshRequest:()=>{g.limitedButton.inactive=!l.enabled||!l.limited,g.maxButton.inactive=!l.enabled||l.max===-1,g.maxButton.ineffective=t.enabled&&l.enabled&&l.max===0,g.triggerButton.inactive=!l.enabled||l.trigger===-1,g.triggerButton.ineffective=t.enabled&&l.enabled&&t.trigger===-1&&l.trigger===-1},onRefreshTrigger:()=>{g.triggerButton.element[0].title=this.host.engine.i18n("ui.trigger",[l.trigger<0?t.trigger<0?this.host.engine.i18n("ui.trigger.build.blocked",[h]):`${this.host.renderPercentage(t.trigger,i.selected,!0)} (${this.host.engine.i18n("ui.trigger.build.inherited")})`:this.host.renderPercentage(l.trigger,i.selected,!0)])},onSetMax:d,onSetTrigger:async()=>{const f=await E.prompt(this,this.host.engine.i18n("ui.trigger.prompt.percentage"),this.host.engine.i18n("ui.trigger.section.prompt",[h,l.trigger!==-1?this.host.renderPercentage(l.trigger,i.selected,!0):this.host.engine.i18n("ui.trigger.build.inherited")]),l.trigger!==-1?this.host.renderPercentage(l.trigger):"",this.host.engine.i18n("ui.trigger.build.promptExplainer"));if(f!==void 0){if(f===""||f.startsWith("-")){l.trigger=-1;return}l.trigger=this.host.parsePercentage(f)}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[h])},renderLabelTrigger:!1});this._crafts.push(g),l.resource==="ship"&&this._crafts.push(new S(this,this.setting.shipOverride,this.host.engine.i18n("option.shipOverride"),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[this.host.engine.i18n("option.shipOverride")])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.shipOverride")])},upgradeIndicator:!0}))}const o=new x(this,{onReset:()=>{this.setting.load({resources:new xt().resources})}}).addChildren(this._crafts);this.addChildContent(o),this.addChildContent(new x(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new Ko(this,this.setting.unlockUpgrades,i)]))}}class Le extends W{constructor(e){console.debug(...v(`Constructing ${Le.name}`));super({host:e},{});u(this,"showActivity");u(this,"_engineUi");u(this,"_sections");u(this,"stateManagementUi");u(this,"_refreshTimeout");const t=e.engine;this._engineUi=new ra(this,t.settings),this.stateManagementUi=new vi(this,t.settings.states,t.settings.locale),this._sections=[new ii(this,t.bonfireManager.settings,t.settings.locale),new Ei(this,t.villageManager.settings,t.settings.locale),new gi(this,t.scienceManager.settings,t.settings.locale),new Mi(this,t.workshopManager.settings,t.settings.locale),new di(this,t.settings.resources,t.settings.locale),new xi(this,t.tradeManager.settings,t.settings.locale),new ci(this,t.religionManager.settings,t.settings.locale),new mi(this,t.spaceManager.settings,t.settings.locale),new wi(this,t.timeManager.settings,t.settings.locale),new yi(this,t.timeControlManager.settings,t.settings.locale),new li(this,t.settings.filters),this.stateManagementUi,new ri(this,t.settings,t.settings.locale)],this.parent=this,this.element=$("<div/>").addClass("kitten-scientists").addClass(Ti.ui);for(const h of[this._engineUi,...this._sections])this.addChild(h);const i=$("<ul/>");i.append(this._engineUi.element);for(const h of this._sections)i.append(h.element);this.element.append(i);const n=this._engineUi.expando;let a=!1;n.element.on("click",()=>{a=!a;for(const h of this._sections)h.toggle(a,!0)});let r=0;for(const h of this._sections)h.element[0].addEventListener("panelHidden",()=>{--r,r===0&&(a=!1),a||n.setCollapsed()}),h.element[0].addEventListener("panelShown",()=>{++r,a=!0,n.setExpanded()});this.showActivity=$("<span/>",{html:`<svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${B.Summary}"/></svg>`,title:e.engine.i18n("summary.show")}).addClass(Ti.showActivity),this.showActivity.on("click",()=>{e.engine.displayActivitySummary()}),$("#clearLog").prepend(this.showActivity);const o=t.settings.ksColumn.enabled&&game.colorScheme!=="sleek";o?$("#rightColumn").after(`<div id="ksColumn" class="column"><span class="${Ti.spacer}"></span></div>`):$("#ksColumn").remove();const l=$(o?"#ksColumn":"#rightColumn");if(l.length===0){const h=$("#optionsPage .full-screen-position .page .page-content");h.length===0?console.warn(...v("Unable to find right column to inject UI into. Running headless.")):(h.append(this.element),this.element.attr("style","border-top:1px solid grey; padding:15px"))}else l.prepend(this.element);this.element=this.element,this._needsRefresh=!1}toString(){return`[${Le.name}#${this.componentId}]`}destroy(){this._refreshTimeout!==void 0&&(T.window.clearTimeout(this._refreshTimeout),this._refreshTimeout=void 0),this.showActivity.remove(),this.element.remove()}requestRefresh(e=!0,t=0,i=!1){if(this._needsRefresh){this._refreshTimeout===void 0&&console.error(...v("User interface claims to have a refresh pending, but there isn\'t."));return}this._refreshTimeout=T.window.setTimeout(()=>{const[n,a]=ye(()=>this.refresh());console.info(...v(`UI refresh took ${ia(a)}.`)),this._refreshTimeout=void 0},0),super.requestRefresh(!0,t,!1)}forceFullRefresh(){console.warn(...v("Forcing refresh on all user interface components...")),this.requestRefresh(),console.warn(...v("Refresh on all user interface components enforced."))}}const Oe=(c="")=>{if(m("2.0.0-beta.11-live"))throw Error("Build error: RELEASE_VERSION is not defined.");return`${c}2.0.0-beta.11-live`};class ge{constructor(s,e,t="en",i){u(this,"game");u(this,"i18nEngine");u(this,"_userInterface");u(this,"engine");u(this,"_gameBeforeSaveHandle");u(this,"_serverLoadHandle");u(this,"_saveManager",{load:s=>{console.info(...v("Looking for Kitten Scientists engine state in save data..."));const e=T.tryEngineStateFromSaveData("ks",s);if(!e){console.info(...v("The Kittens Game save data did not contain a script state."));return}console.info(...v("Found Kitten Scientists engine state in save data.")),this.engine.stateLoad(e),this.refreshEntireUserInterface()},resetState:()=>null,save:s=>{}});var n;console.info(...v(`Kitten Scientists ${Oe("v")} constructed. Checking for previous instances...`)),"kittenScientists"in T.window&&(console.warn(...v("Detected existing KS instance. Trying to unload it...")),(n=T.window.kittenScientists)==null||n.unload()),console.info(...v("You are on the \'fixed\' release channel.")),this.game=s,this.i18nEngine=e;try{this.engine=new oe(this,t),this._userInterface=new Le(this)}catch(a){throw console.error(...v("Failed to construct core components.",a)),typeof GM<"u"&&console.warn(...v("Detected running in Greasemonkey.")),a}m(i)?this._userInterface.stateManagementUi.loadAutoSave():this.setSettings(i)}rebuildUi(){this._userInterface.destroy(),this._userInterface=new Le(this),this._userInterface.forceFullRefresh()}validateGame(){Qt.validateGame(this.game,this.engine.scienceManager.settings),St.validateGame(this.game,this.engine.spaceManager.settings),xt.validateGame(this.game,this.engine.workshopManager.settings)}unload(){console.warn(...v("Unloading Kitten Scientists...")),this.engine.stop(),this._userInterface.destroy(),$("#ks-styles").remove(),this._gameBeforeSaveHandle!==void 0&&(T.window.dojo.unsubscribe(this._gameBeforeSaveHandle),this._gameBeforeSaveHandle=void 0),this._serverLoadHandle!==void 0&&(T.window.dojo.unsubscribe(this._serverLoadHandle),this._gameBeforeSaveHandle=void 0);const s=this.game.managers.indexOf(this._saveManager);-1<s&&this.game.managers.splice(s,1),T.window.kittenScientists=void 0,console.warn(...v("Kitten Scientists have been unloaded!"))}run(){this.game.console.maxMessages=1e3,this.refreshEntireUserInterface(),this.engine.settings.enabled&&this.engine.start(!0),this.engine.imessage("status.ks.init"),this.runUpdateCheck().catch(se(console)),this._gameBeforeSaveHandle!==void 0&&(T.window.dojo.unsubscribe(this._gameBeforeSaveHandle),this._gameBeforeSaveHandle=void 0),this._gameBeforeSaveHandle=T.window.dojo.subscribe("game/beforesave",s=>{console.info(...v("Injecting Kitten Scientists engine state into save data..."));const e=this.getSettings();s.ks={state:[e]},this._userInterface.stateManagementUi.storeAutoSave(e),document.dispatchEvent(new CustomEvent("ks.reportSavegame",{detail:s}))}),this._serverLoadHandle!==void 0&&(T.window.dojo.unsubscribe(this._serverLoadHandle),this._gameBeforeSaveHandle=void 0),this._serverLoadHandle=T.window.dojo.subscribe("server/load",s=>{const e=T.tryEngineStateFromSaveData("ks",s);if(!e){console.info(...v("The Kittens Game save data did not contain a script state. Trying to load Auto-Save settings..."));return}console.info(...v("Found! Loading settings...")),this.engine.stateLoad(e)})}async runUpdateCheck(){{console.debug(...v("No update check on \'fixed\' release channel."));return}}refreshEntireUserInterface(){console.info(...v("Requesting entire user interface to be refreshed.")),this._userInterface.forceFullRefresh()}parseFloat(s){if(s===null||s==="")return null;const e=/[KMGTP]$/i.test(s),t=s.substring(0,s.length-(e?1:0));let i=s.includes("e")||e?Number.parseFloat(t):Number.parseInt(t);if(e){const n=s.substring(s.length-1).toUpperCase();i=i*1e3**["","K","M","G","T","P"].indexOf(n)}return(i===Number.POSITIVE_INFINITY||i<0)&&(i=-1),i}parseAbsolute(s){const e=this.parseFloat(s);return e!==null?Math.round(e):null}parsePercentage(s){const e=s.trim().replace(/%$/,"");return Math.max(0,Math.min(1,Number.parseFloat(e)/100))}renderAbsolute(s,e="invariant"){return s<0||s===Number.POSITIVE_INFINITY?"∞":e!=="invariant"&&Math.floor(Math.log10(s))<9?new Intl.NumberFormat(e,{maximumFractionDigits:0,style:"decimal"}).format(s):this.game.getDisplayValueExt(s,!1,!1)}renderPercentage(s,e="invariant",t){return s<0||s===Number.POSITIVE_INFINITY?"∞":e!=="invariant"?new Intl.NumberFormat(e,{style:"percent"}).format(s):`${this.game.getDisplayValueExt(s*100,!1,!1)}${t?"%":""}`}renderFloat(s,e="invariant"){return s<0||s===Number.POSITIVE_INFINITY?"∞":e!=="invariant"?new Intl.NumberFormat(e,{style:"decimal"}).format(s):this.game.getDisplayValueExt(s,!1,!1)}static encodeSettings(s,e=!0){const t=JSON.stringify(s);return e?T.window.LZString.compressToBase64(t):t}static decodeSettings(s){try{const i=JSON.parse(s);return ge.unknownAsEngineStateOrThrow(i)}catch{}if(s.match(/\\r?\\n/))throw new bt("Multi-line non-JSON input can\'t be decoded.");const e=T.window.LZString.decompressFromBase64(s),t=JSON.parse(e);return ge.unknownAsEngineStateOrThrow(t)}getSettings(){return this.engine.stateSerialize()}getSettingsAsJson(){return JSON.stringify(this.getSettings())}setSettings(s){console.info(...v("Loading engine state..."));const e=this.engine.settings.ksColumn.enabled!==s.engine.ksColumn.enabled;this.engine.stateLoad(s),e&&this.rebuildUi(),this._userInterface.refresh(!0)}importSettingsFromString(s){const e=ge.decodeSettings(s);this.setSettings(e)}async copySettings(s=this.getSettings(),e=!0){const t=ge.encodeSettings(s,e);await T.window.navigator.clipboard.writeText(t)}static unknownAsEngineStateOrThrow(s){const e=s.v;if(!m(e)&&typeof e=="string"&&e.startsWith("2"))return s;throw new Error("Not a valid engine state.")}installSaveManager(){console.info(...v("Installing save game manager...")),this.game.managers.push(this._saveManager)}}(async()=>{const c=await new T().waitForGame(ge,"ks");T.window.kittenScientists=c,c.validateGame(),c.run()})().catch(console.error)});\n\n(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.id="ks-styles",t.appendChild(document.createTextNode(\'._label_1nlev_1{align-content:center;display:inline-block;flex:0 1 fit-content;opacity:.8;white-space:nowrap;transition:.3s}._label_1nlev_1:hover{opacity:1}._splitter_1nlev_16 ._label_1nlev_1:first-letter{font-weight:700}._iconLabel_1nlev_20{display:inline-block;margin-right:4px;margin-left:2px;vertical-align:middle}._fillSpace_1nlev_26{flex:1}._delimiter_16hnh_1{margin-bottom:10px}._head_wr1pj_1{display:flex;align-items:stretch;flex-direction:row;justify-content:flex-start;width:100%;transition:.3s}._head_wr1pj_1>._headFlexItem_wr1pj_10{flex:1;margin-right:8px}._setting_1ndg5_1{border-bottom:1px solid transparent;transition:border-bottom .3s}._setting_1ndg5_1 ._checkbox_1ndg5_6{margin:1px 5px 2px 2px}._setting_1ndg5_1 ._panelContent_1ndg5_10{border-left:1px dashed grey;padding-left:16px;margin-left:8px;margin-top:1px;opacity:.5}._setting_1ndg5_1 ._panelContent_1ndg5_10._hidden_1ndg5_17{display:none}._setting_1ndg5_1._checked_1ndg5_22>._panelContent_1ndg5_10{opacity:1}._setting_1ndg5_1._expanded_1ndg5_26{margin-bottom:10px}._setting_1ndg5_1:not(._expanded_1ndg5_26):hover{border-bottom:1px dashed rgba(160,160,160,.2)}._setting_1ndg5_1._readonly_1ndg5_34{cursor:default;pointer-events:none}@keyframes _hail-rainbow_q7zpt_1{0%,to{color:red;text-shadow:0 0 10px red}33%{color:#888;text-shadow:0 0 10px yellow}66%{color:#fff;text-shadow:0 0 10px black}}._iconButton_q7zpt_17{cursor:pointer;display:block;padding-right:3px;line-height:0;opacity:.8;transition:.3s}._iconButton_q7zpt_17:hover{opacity:1}._iconButton_q7zpt_17._inactive_q7zpt_29{opacity:.4}._iconButton_q7zpt_17._inactive_q7zpt_29:hover{opacity:.6}._iconButton_q7zpt_17._ineffective_q7zpt_37{color:red;animation:_hail-rainbow_q7zpt_1 5s linear infinite}._button_q7zpt_43{align-items:end;cursor:pointer;display:flex;opacity:.8;transition:.3s}._button_q7zpt_43:hover{opacity:1}._button_q7zpt_43._inactive_q7zpt_29{opacity:.4}._button_q7zpt_43._inactive_q7zpt_29:hover{opacity:.6}._button_q7zpt_43._ineffective_q7zpt_37{color:red;animation:_hail-rainbow_q7zpt_1 5s linear infinite}._button_q7zpt_43._readonly_q7zpt_67{cursor:default;pointer-events:none}._button_q7zpt_43 ._buttonIcon_q7zpt_72{margin:0 2px 0 0;vertical-align:sub}._button_q7zpt_43._alignRight_q7zpt_77{justify-content:end}._button_q7zpt_43._large_q7zpt_81{padding:5px 10px}._button_q7zpt_43._bordered_q7zpt_85{border:1px solid rgba(180,180,180,.2)}._button_q7zpt_43._bordered_q7zpt_85:not(._large_q7zpt_81){padding:0 2px}._button_q7zpt_43._bordered_q7zpt_85:hover{border:1px solid rgba(180,180,180,1)}._button_q7zpt_43._headAction_q7zpt_97{min-width:50px}._button_q7zpt_43._lastHeadAction_q7zpt_100{padding-right:20px}._button_q7zpt_43._consumeButton_q7zpt_104,._button_q7zpt_43._stockButton_q7zpt_107{border:1px solid transparent}._button_q7zpt_43:not(._bordered_q7zpt_85)+._button_q7zpt_43:not(._bordered_q7zpt_85):before{content:"";display:inline-block;height:1em;border-left:1px solid transparent}._button_q7zpt_43:not(._bordered_q7zpt_85):not(._inactive_q7zpt_29)._alignRight_q7zpt_77+._button_q7zpt_43:not(._bordered_q7zpt_85):not(._inactive_q7zpt_29):before{content:"";display:inline-block;height:1em;border-left:1px solid rgba(180,180,180,.4)}._listContainer_1kxbq_1{margin-bottom:4px}._itemsList_1kxbq_5{-webkit-user-select:none;user-select:none}._list_1kxbq_1~._listTools_1kxbq_9{border-top:1px dotted rgba(128,128,128,.3);margin-left:0;padding-top:2px}._list_1kxbq_1~._listTools_1kxbq_9 *{display:inline-block}._expandoButton_l1ukp_1:not(._expanded_l1ukp_1) ._up_l1ukp_1{display:none}._expandoButton_l1ukp_1:not(._expanded_l1ukp_1) ._down_l1ukp_4{opacity:.6}._expandoButton_l1ukp_1:not(._expanded_l1ukp_1) ._down_l1ukp_4:hover{opacity:1}._expandoButton_l1ukp_1._expanded_l1ukp_1 ._down_l1ukp_4{display:none}#gamePageContainer .dialog.help ._dialog_1276o_1{display:flex;flex-direction:column;height:fit-content!important;box-shadow:none!important}#gamePageContainer .dialog.help ._dialog_1276o_1 ._close_1276o_7{position:absolute;top:10px;right:15px}._explainer_1idu3_1{color:#888;display:inline-block;min-width:100px;-webkit-user-select:none;user-select:none;padding:4px;white-space:break-spaces}._explainer_1idu3_1 p{margin:0}._header_19ql8_1{display:block;margin-bottom:3px;min-width:100px;border-bottom:1px dashed rgba(255,255,255,.1);font-weight:700;-webkit-user-select:none;user-select:none}._toolbar_1654f_1{display:flex;flex-direction:row;padding:0 0 2px;margin:0 0 3px}._toolbar_1654f_1>*{margin:0 3px 0 0}._maxButton_133h2_1{padding-right:5px;padding-top:2px}._fieldset_tfwil_1{border-bottom:none;border-right:none;border-top:none}._textButton_1mv97_1{display:inline-block;white-space:nowrap;opacity:.8;cursor:pointer;-webkit-user-select:none;user-select:none}._textButton_1mv97_1:hover{opacity:1}@keyframes _scale_6c09s_1{0%{scale:.5;opacity:0}50%{scale:1;opacity:1}to{scale:2;opacity:0}}._active_6c09s_16{text-shadow:rgba(128,128,128,.8) 0 0 15px;position:relative}._active_6c09s_16:after,._active_6c09s_16:before{display:inline-block;width:1em;height:100%;position:absolute;right:-1.5em;scale:0;text-align:center;transform-origin:center}._active_6c09s_16:after{content:attr(data-ks-active-from);animation:_scale_6c09s_1 8s linear infinite}._active_6c09s_16:before{content:attr(data-ks-active-to);animation:_scale_6c09s_1 8s linear infinite;animation-delay:4s}._buyButton_10eul_1,._sellButton_1tmvd_1{display:inline-block;padding-right:10px;min-width:86px}#ksColumn{min-width:250px;max-width:440px;vertical-align:top;padding-left:8px;top:20px;position:relative;overflow-y:auto}#footerLinks{display:flex;flex-direction:column;position:fixed;text-align:right;line-height:0;right:-5px!important;margin-bottom:1em}#footerLinks a{line-height:1;padding-right:10px;opacity:.5;transition:.3s;text-decoration:none;text-transform:lowercase}#footerLinks a:hover{opacity:1}#crowdjet-expand-container{position:fixed!important;bottom:10px!important;right:-10px!important;opacity:.5}#crowdjet-expand-container:hover{opacity:1}._spacer_auis8_44{display:block;margin-bottom:100px}._ui_auis8_49{margin:5px 0 10px;padding-right:10px}._ui_auis8_49 ul{list-style:none;margin:0;padding:0}._ui_auis8_49 #_toggle-list-resources_auis8_1 ._stockWarn_auis8_60 *,._ui_auis8_49 #_toggle-reset-list-resources_auis8_1 ._stockWarn_auis8_60 *{color:#dd1e00}._showActivity_auis8_66{cursor:pointer;display:inline-block;vertical-align:middle}#game #rightColumn{overflow-y:auto}#game #rightColumn #rightTabLog{overflow-y:visible}#game #rightColumn #rightTabLog #gameLog{height:auto;min-height:auto;overflow-y:visible}#game .res-row .res-cell.ks-stock-above{color:green}#game .res-row .res-cell.ks-stock-below{color:red}\')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();\n',n.type="application/javascript",document.body.appendChild(n)}})().catch(i(console))});