@kitten-science/kitten-scientists 2.0.0-beta.11-dev.20251225181308 → 2.0.0-beta.12-dev.20251225210304

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.
@@ -102,7 +102,7 @@
102
102
  if (typeof GM !== "undefined") {
103
103
  const nodeScript = document.createElement("script");
104
104
  nodeScript.id = "ks-loader-singleton";
105
- nodeScript.textContent = '(function(ue,H){typeof exports=="object"&&typeof module<"u"?H(exports,require("dojo")):typeof define=="function"&&define.amd?define(["exports","dojo"],H):(ue=typeof globalThis<"u"?globalThis:ue||self,H(ue["kitten-scientists"]=ue["kitten-scientists"]||{}))})(this,(function(ue){"use strict";const H=l=>t=>{l.error(t)};function g(l){return l==null}function Be(l,e){return!g(l)&&l instanceof e}class es extends Error{constructor(e="unexpected nil value"){super(e)}}function p(l,e){if(g(l))throw new es(e);return l}function Ie(l,e){const t=new Array;for(const i of l)g(i)?g(e)||t.push(e):t.push(i);return t}class he extends Error{status;code;constructor(e,t,i){super(t),this.code=e,this.name="AbstractError",this.status=i,typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,he)}static isAbstractError(e,t=!0){if(e instanceof he)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 $e extends he{constructor(e,t=400){super("ERR_OS_INVALID_OPERATION",e,t),this.name="InvalidOperationError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,$e)}}var at,ii;function si(){return ii||(ii=1,at=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\\bsemver\\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}),at}var rt,ni;function ai(){if(ni)return rt;ni=1;const l="2.0.0",e=256,t=Number.MAX_SAFE_INTEGER||9007199254740991,i=16,s=e-6;return rt={MAX_LENGTH:e,MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:s,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:l,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},rt}var Le={exports:{}},ri;function ts(){return ri||(ri=1,(function(l,e){const{MAX_SAFE_COMPONENT_LENGTH:t,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:s}=ai(),a=si();e=l.exports={};const n=e.re=[],r=e.safeRe=[],c=e.src=[],o=e.safeSrc=[],h=e.t={};let u=0;const d="[a-zA-Z0-9-]",m=[["\\\\s",1],["\\\\d",s],[d,i]],v=S=>{for(const[R,Z]of m)S=S.split(`${R}*`).join(`${R}{0,${Z}}`).split(`${R}+`).join(`${R}{1,${Z}}`);return S},b=(S,R,Z)=>{const ce=v(R),j=u++;a(S,j,R),h[S]=j,c[j]=R,o[j]=ce,n[j]=new RegExp(R,Z?"g":void 0),r[j]=new RegExp(ce,Z?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\\\d*"),b("NUMERICIDENTIFIERLOOSE","\\\\d+"),b("NONNUMERICIDENTIFIER",`\\\\d*[a-zA-Z-]${d}*`),b("MAINVERSION",`(${c[h.NUMERICIDENTIFIER]})\\\\.(${c[h.NUMERICIDENTIFIER]})\\\\.(${c[h.NUMERICIDENTIFIER]})`),b("MAINVERSIONLOOSE",`(${c[h.NUMERICIDENTIFIERLOOSE]})\\\\.(${c[h.NUMERICIDENTIFIERLOOSE]})\\\\.(${c[h.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASEIDENTIFIER",`(?:${c[h.NONNUMERICIDENTIFIER]}|${c[h.NUMERICIDENTIFIER]})`),b("PRERELEASEIDENTIFIERLOOSE",`(?:${c[h.NONNUMERICIDENTIFIER]}|${c[h.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASE",`(?:-(${c[h.PRERELEASEIDENTIFIER]}(?:\\\\.${c[h.PRERELEASEIDENTIFIER]})*))`),b("PRERELEASELOOSE",`(?:-?(${c[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\\\.${c[h.PRERELEASEIDENTIFIERLOOSE]})*))`),b("BUILDIDENTIFIER",`${d}+`),b("BUILD",`(?:\\\\+(${c[h.BUILDIDENTIFIER]}(?:\\\\.${c[h.BUILDIDENTIFIER]})*))`),b("FULLPLAIN",`v?${c[h.MAINVERSION]}${c[h.PRERELEASE]}?${c[h.BUILD]}?`),b("FULL",`^${c[h.FULLPLAIN]}$`),b("LOOSEPLAIN",`[v=\\\\s]*${c[h.MAINVERSIONLOOSE]}${c[h.PRERELEASELOOSE]}?${c[h.BUILD]}?`),b("LOOSE",`^${c[h.LOOSEPLAIN]}$`),b("GTLT","((?:<|>)?=?)"),b("XRANGEIDENTIFIERLOOSE",`${c[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`),b("XRANGEIDENTIFIER",`${c[h.NUMERICIDENTIFIER]}|x|X|\\\\*`),b("XRANGEPLAIN",`[v=\\\\s]*(${c[h.XRANGEIDENTIFIER]})(?:\\\\.(${c[h.XRANGEIDENTIFIER]})(?:\\\\.(${c[h.XRANGEIDENTIFIER]})(?:${c[h.PRERELEASE]})?${c[h.BUILD]}?)?)?`),b("XRANGEPLAINLOOSE",`[v=\\\\s]*(${c[h.XRANGEIDENTIFIERLOOSE]})(?:\\\\.(${c[h.XRANGEIDENTIFIERLOOSE]})(?:\\\\.(${c[h.XRANGEIDENTIFIERLOOSE]})(?:${c[h.PRERELEASELOOSE]})?${c[h.BUILD]}?)?)?`),b("XRANGE",`^${c[h.GTLT]}\\\\s*${c[h.XRANGEPLAIN]}$`),b("XRANGELOOSE",`^${c[h.GTLT]}\\\\s*${c[h.XRANGEPLAINLOOSE]}$`),b("COERCEPLAIN",`(^|[^\\\\d])(\\\\d{1,${t}})(?:\\\\.(\\\\d{1,${t}}))?(?:\\\\.(\\\\d{1,${t}}))?`),b("COERCE",`${c[h.COERCEPLAIN]}(?:$|[^\\\\d])`),b("COERCEFULL",c[h.COERCEPLAIN]+`(?:${c[h.PRERELEASE]})?(?:${c[h.BUILD]})?(?:$|[^\\\\d])`),b("COERCERTL",c[h.COERCE],!0),b("COERCERTLFULL",c[h.COERCEFULL],!0),b("LONETILDE","(?:~>?)"),b("TILDETRIM",`(\\\\s*)${c[h.LONETILDE]}\\\\s+`,!0),e.tildeTrimReplace="$1~",b("TILDE",`^${c[h.LONETILDE]}${c[h.XRANGEPLAIN]}$`),b("TILDELOOSE",`^${c[h.LONETILDE]}${c[h.XRANGEPLAINLOOSE]}$`),b("LONECARET","(?:\\\\^)"),b("CARETTRIM",`(\\\\s*)${c[h.LONECARET]}\\\\s+`,!0),e.caretTrimReplace="$1^",b("CARET",`^${c[h.LONECARET]}${c[h.XRANGEPLAIN]}$`),b("CARETLOOSE",`^${c[h.LONECARET]}${c[h.XRANGEPLAINLOOSE]}$`),b("COMPARATORLOOSE",`^${c[h.GTLT]}\\\\s*(${c[h.LOOSEPLAIN]})$|^$`),b("COMPARATOR",`^${c[h.GTLT]}\\\\s*(${c[h.FULLPLAIN]})$|^$`),b("COMPARATORTRIM",`(\\\\s*)${c[h.GTLT]}\\\\s*(${c[h.LOOSEPLAIN]}|${c[h.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",b("HYPHENRANGE",`^\\\\s*(${c[h.XRANGEPLAIN]})\\\\s+-\\\\s+(${c[h.XRANGEPLAIN]})\\\\s*$`),b("HYPHENRANGELOOSE",`^\\\\s*(${c[h.XRANGEPLAINLOOSE]})\\\\s+-\\\\s+(${c[h.XRANGEPLAINLOOSE]})\\\\s*$`),b("STAR","(<|>)?=?\\\\s*\\\\*"),b("GTE0","^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$"),b("GTE0PRE","^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$")})(Le,Le.exports)),Le.exports}var ot,oi;function is(){if(oi)return ot;oi=1;const l=Object.freeze({loose:!0}),e=Object.freeze({});return ot=i=>i?typeof i!="object"?l:i:e,ot}var lt,li;function ss(){if(li)return lt;li=1;const l=/^[0-9]+$/,e=(i,s)=>{if(typeof i=="number"&&typeof s=="number")return i===s?0:i<s?-1:1;const a=l.test(i),n=l.test(s);return a&&n&&(i=+i,s=+s),i===s?0:a&&!n?-1:n&&!a?1:i<s?-1:1};return lt={compareIdentifiers:e,rcompareIdentifiers:(i,s)=>e(s,i)},lt}var ct,ci;function ns(){if(ci)return ct;ci=1;const l=si(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:t}=ai(),{safeRe:i,t:s}=ts(),a=is(),{compareIdentifiers:n}=ss();class r{constructor(o,h){if(h=a(h),o instanceof r){if(o.loose===!!h.loose&&o.includePrerelease===!!h.includePrerelease)return o;o=o.version}else if(typeof o!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof o}".`);if(o.length>e)throw new TypeError(`version is longer than ${e} characters`);l("SemVer",o,h),this.options=h,this.loose=!!h.loose,this.includePrerelease=!!h.includePrerelease;const u=o.trim().match(h.loose?i[s.LOOSE]:i[s.FULL]);if(!u)throw new TypeError(`Invalid Version: ${o}`);if(this.raw=o,this.major=+u[1],this.minor=+u[2],this.patch=+u[3],this.major>t||this.major<0)throw new TypeError("Invalid major version");if(this.minor>t||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>t||this.patch<0)throw new TypeError("Invalid patch version");u[4]?this.prerelease=u[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const m=+d;if(m>=0&&m<t)return m}return d}):this.prerelease=[],this.build=u[5]?u[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(o){if(l("SemVer.compare",this.version,this.options,o),!(o instanceof r)){if(typeof o=="string"&&o===this.version)return 0;o=new r(o,this.options)}return o.version===this.version?0:this.compareMain(o)||this.comparePre(o)}compareMain(o){return o instanceof r||(o=new r(o,this.options)),this.major<o.major?-1:this.major>o.major?1:this.minor<o.minor?-1:this.minor>o.minor?1:this.patch<o.patch?-1:this.patch>o.patch?1:0}comparePre(o){if(o instanceof r||(o=new r(o,this.options)),this.prerelease.length&&!o.prerelease.length)return-1;if(!this.prerelease.length&&o.prerelease.length)return 1;if(!this.prerelease.length&&!o.prerelease.length)return 0;let h=0;do{const u=this.prerelease[h],d=o.prerelease[h];if(l("prerelease compare",h,u,d),u===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(u===void 0)return-1;if(u===d)continue;return n(u,d)}while(++h)}compareBuild(o){o instanceof r||(o=new r(o,this.options));let h=0;do{const u=this.build[h],d=o.build[h];if(l("build compare",h,u,d),u===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(u===void 0)return-1;if(u===d)continue;return n(u,d)}while(++h)}inc(o,h,u){if(o.startsWith("pre")){if(!h&&u===!1)throw new Error("invalid increment argument: identifier is empty");if(h){const d=`-${h}`.match(this.options.loose?i[s.PRERELEASELOOSE]:i[s.PRERELEASE]);if(!d||d[1]!==h)throw new Error(`invalid identifier: ${h}`)}}switch(o){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",h,u);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",h,u);break;case"prepatch":this.prerelease.length=0,this.inc("patch",h,u),this.inc("pre",h,u);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",h,u),this.inc("pre",h,u);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 d=Number(u)?1:0;if(this.prerelease.length===0)this.prerelease=[d];else{let m=this.prerelease.length;for(;--m>=0;)typeof this.prerelease[m]=="number"&&(this.prerelease[m]++,m=-2);if(m===-1){if(h===this.prerelease.join(".")&&u===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(h){let m=[h,d];u===!1&&(m=[h]),n(this.prerelease[0],h)===0?isNaN(this.prerelease[1])&&(this.prerelease=m):this.prerelease=m}break}default:throw new Error(`invalid increment argument: ${o}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return ct=r,ct}var ht,hi;function as(){if(hi)return ht;hi=1;const l=ns();return ht=(t,i,s)=>new l(t,s).compare(new l(i,s)),ht}var ut,ui;function rs(){if(ui)return ut;ui=1;const l=as();return ut=(t,i,s)=>l(t,i,s)>0,ut}rs();class Se extends he{constructor(e,t=500){super("ERR_OS_INTERNAL",e,t),this.name="InternalError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,Se)}static fromError(e){const t=new Se(e.message);return Object.assign(t,e,new Se(e.message)),t.stack=e.stack,t}}class dt extends he{constructor(e,t=500){super("ERR_OS_UNKNOWN",e,t),this.name="UnknownError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,dt)}}const os=l=>l instanceof Error||Object.prototype.toString.call(l)==="[object Error]",ls=l=>he.isAbstractError(l)?l:os(l)?Se.fromError(l):new dt(String(l)),X=l=>{const e=performance.now();return[l(),performance.now()-e]},Oe=async l=>{const e=performance.now();return[await l(),performance.now()-e]},f=(...l)=>["👩‍🔬",...l.filter(e=>e!=="").flatMap(e=>{if(Be(e,Error)){const t=e;return[t.name,t.message,t.stack]}return e})];function P(l){return Object.entries(l)}function L(l,e,t){if(g(e))return console.warn(...f("No source data was provided.")),l;for(const[i,s]of P(l))i in e||console.info(...f(`Entry \'${i}\' is missing in source. Using default value.`)),t(s,e[i]);for(const[i]of P(e))i in l||console.warn(...f(`Entry \'${i}\' was found in source, but it is not expected by the subject schema. This entry will be ignored.`));return l}class Ue{_elem;constructor(e){this._elem=structuredClone(e)}unwrap(){return structuredClone(this._elem)}replace(e){this._elem=structuredClone(e)}toJSON(){return this.unwrap()}}function W(l){return l.charAt(0).toUpperCase()+l.slice(1)}function cs(l){return Math.round(l*100)/100}function G(l){return l===-1?Number.POSITIVE_INFINITY:l}const gt=["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"],De=["broadcasttower","dataCenter","hydroplant","solarfarm","spaceport"],hs=["autumn","spring","summer","winter"],de=["charon","umbra","yarn","helios","cath","redmoon","dune","piscine","terminus","kairo"],di=["alloy","beam","bloodstone","blueprint","compedium","concrate","eludium","gear","kerosene","manuscript","megalith","parchment","plate","scaffold","ship","slab","steel","tanker","tMythril","thorium","wood"],gi=[...di,"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"],mi=["any","engineer","farmer","geologist","hunter","miner","priest","scholar","woodcutter"],us=["chemist","engineer","manager","metallurgist","merchant","none","scientist","wise"];var O=(l=>(l.Cryptotheology="c",l.OrderOfTheSun="s",l.Ziggurat="z",l.UnicornPasture="zp",l))(O||{});const mt=["apocripha","basilica","goldenSpire","scholasticism","solarRevolution","solarchant","stainedGlass","sunAltar","templars","transcendence"],ft=["blackCore","blackLibrary","blackNexus","blackObelisk","blackRadiance","blazar","darkNova","holyGenocide","mausoleum","singularity"],pt=["blackPyramid","ivoryCitadel","ivoryTower","marker","skyPalace","sunspire","unicornGraveyard","unicornNecropolis","unicornTomb","unicornUtopia"],fi=["dragons","griffins","nagas","leviathans","lizards","sharks","spiders","zebras"],ds=["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"],pi=["brewery"],gs=["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"],ms=["centaurusSystemMission","charonMission","duneMission","furthestRingMission","heliosMission","kairoMission","moonMission","orbitalLaunch","piscineMission","rorschachMission","terminusMission","umbraMission","yarnMission"],bt=["containmentChamber","cryostation","entangler","heatsink","hrHarvester","hydrofracturer","hydroponics","moltenCore","moonBase","moonOutpost","orbitalArray","planetCracker","researchVessel","sattelite","spaceBeacon","spaceElevator","spaceStation","spiceRefinery","sunforge","sunlifter","tectonic","terraformingStation"],vt=["blastFurnace","ressourceRetrieval","temporalAccelerator","temporalBattery","temporalImpedance","temporalPress","timeBoiler"],yt=["cryochambers","usedCryochambers","voidHoover","voidRift","chronocontrol","voidResonator"],bi=["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","tachyonModerator","thinFilm","thoriumEngine","thoriumReactors","titaniumAxe","titaniumBarns","titaniumMirrors","titaniumSaw","titaniumWarehouses","turnSmoothly","unicornSelection","unobtainiumAxe","unobtainiumDrill","unobtainiumHuts","unobtainiumReflectors","unobtainiumSaw","uplink","voidAspiration","voidEnergy","voidReactors"];var Y=(l=>(l.Chronoforge="chrono",l.VoidSpace="void",l))(Y||{});const Ne=["ivoryCitadel","ivoryTower","skyPalace","sunspire","unicornPasture","unicornTomb","unicornUtopia"],fs=["sacrificeUnicorns","sacrificeAlicorns","refineTears","refineTimeCrystals","transcend","adore","autoPraise"];class xe{_host;_workshopManager;_priceCache;cacheHits=0;cacheMisses=0;constructor(e,t){this._host=e,this._workshopManager=t,this._priceCache=new Map}resetPriceCache(){this._priceCache=new Map,this.cacheHits=0,this.cacheMisses=0}_getPriceForBuild(e,t=0){const i=this._priceCache.get(e)??[],s=i[t];if(s!==void 0)return++this.cacheHits,s;if(++this.cacheMisses,De.includes(e)){const a={broadcasttower:"amphitheatre",dataCenter:"library",hydroplant:"aqueduct",solarfarm:"pasture",spaceport:"warehouse"},n=this._getPriceForBuild(p(a[e]),t);return i[t]=n,this._priceCache.set(e,i),n}if(gt.includes(e)){const a=this._host.game.bld.getBuildingExt(e),n=a.get;a.get=(c=>c==="val"?t:n.apply(a,[c]));const r=this._host.game.bld.getPricesWithAccessor(a);return a.get=n,i[t]=r,this._priceCache.set(e,i),r}if(vt.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"chronoforge"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}if(mt.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"religion"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}if(bt.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"spaceBuilding"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}if(ft.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"transcendenceUpgrades"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}if(yt.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"voidSpace"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}if(pt.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"zigguratUpgrades"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}throw Error(`unable to get meta for \'${e}\'`)}bulk(e,t){const i=[],s=P(e).sort((o,h)=>{const u=p(t[o[0]]),d=p(t[h[0]]);return u.val!==d.val?u.val-d.val:o[0].localeCompare(h[0],"en")});for(const[o,h]of s){const u=ee.evaluateSubSectionTrigger(h.sectionTrigger,h.trigger),d=p(t[o]);if(!h.enabled||u<0||"tHidden"in d&&d.tHidden===!0||"rHidden"in d&&d.rHidden===!0||d.unlocked===!1||!g(h.max)&&-1<h.max&&h.max<=d.val||o==="cryochambers"&&(p(this._host.game.time.getVSU("usedCryochambers")).val>0||this._host.game.bld.getBuildingExt("chronosphere").meta.val<=d.val)||o==="ressourceRetrieval"&&d.val>=100||this._isStagedBuild(d)&&typeof h.stage<"u"&&h.stage!==d.stage)continue;this._getPriceForBuild(o).map(S=>this._workshopManager.getResource(S.name)).filter(S=>0<S.maxValue).filter(S=>S.value/S.maxValue<u).length===0&&i.push({builder:h.builder,count:1,id:o,limit:h.max,name:h.baseBuilding??h.building,stage:h.stage??null,val:d.val,variant:h.variant??null})}if(i.length===0)return[];const a={};for(const o of this._host.game.resPool.resources)a[o.name]=this._workshopManager.getValueAvailable(o.name);let n=0;const r=new Array;for(;n<1e6&&0<i.length;){let o=0;const h=[];let u={...a};for(const d of i){const m=this._precalculateBuilds({...d,limit:Math.min(G(d.limit),d.val+d.count)},t,u);if(m.count!==0){if(m.count!==d.count){u=m.remainingResources,h.push({...d,count:m.count});continue}u=m.remainingResources,h.push({...d}),++d.count,++o}}if(o===0)break;r.push(h),++n}if(r.length===0)return[];let c;for(const o of r){const h={...a};let u=!0;for(const d of o)if(this._precalculateBuilds({...d,limit:Math.min(G(d.limit),d.val+d.count)},t,h).count<d.count){u=!1;break}if(u)c=o;else break}return c!==void 0?c:(console.warn(...f(`Took \'${n}\' iterations to evaluate bulk build request without result.`)),[])}_precalculateBuilds(e,t,i={}){let s=0;const a={...i},n=p(t[e.id]);let r=!1;for(;!r&&s<1e5&&!(e.limit<=n.val+s);){const c=this._getPriceForBuild(e.id,n.val+s);for(let o=0;o<c.length;o++)if(a[c[o].name]<c[o].val){r=!0;break}if(!r){++s;for(let o=0;o<c.length;o++)a[c[o].name]-=c[o].val}}return{count:s,remainingResources:a}}construct(e,t,i){if(!("name"in e)||!("controller"in e.options)||!("getMetadata"in e.options.controller))return 0;const s=e.metadata;let a=0,n=i;const r=s;if(!g(r.limitBuild)&&r.limitBuild-r.val<n&&(n=r.limitBuild-r.val),e.enabled&&t.hasResources(e)||this._host.game.devMode){for(;t.hasResources(e)&&n>0;)e.prices=t.getPrices(e),t.payPrice(e),t.incrementValue(e),a++,n--;r.breakIronWill&&(this._host.game.ironWill=!1),g(s)||("unlocks"in s&&!g(s.unlocks)&&this._host.game.unlock(s.unlocks),"upgrades"in s&&!g(s.upgrades)&&this._host.game.upgrade(s.upgrades))}return a}_isStagedBuild(e){return"stage"in e&&"stages"in e&&!g(e.stage)&&!g(e.stages)}getPriceRatio(e,t){const i=this._isStagedBuild(e)?e.priceRatio||e.stages[e.stage].priceRatio:e.priceRatio??0;let s=0;return t&&t==="Bonfire"&&(s=this._host.game.getEffect(`${e.name}PriceRatio`)+this._host.game.getEffect("priceRatio")+this._host.game.getEffect("mapPriceReduction"),s=this._host.game.getLimitedDR(s,i-1)),i+s}singleBuildPossible(e){const t=this._getPriceForBuild(e);for(const i of t)if(this._workshopManager.getValueAvailable(i.name)<i.val)return!1;return!0}}class y{enabled;constructor(e=!1){this.enabled=e}load(e){g(e)||(this.enabled=e.enabled??this.enabled)}serialize(){return this}}class vi extends y{limited;constructor(e=!1,t=!1){super(e),this.limited=t}load(e){g(e)||(super.load(e),this.limited=e.limited??this.limited)}}class z extends y{trigger;constructor(e=!1,t=-1){super(e),this.trigger=t}load(e){g(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class Q extends y{trigger;constructor(e=!1,t=1){super(e),this.trigger=t}load(e){g(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class yi extends y{max;constructor(e=!1,t=0){super(e),this.max=t}load(e){g(e)||(super.load(e),this.max=e.max??this.max)}}class ps extends vi{max;constructor(e=!1,t=!1,i=0){super(e,t),this.max=i}load(e){g(e)||(super.load(e),this.max=e.max??this.max)}}class bs extends ps{trigger;constructor(e=!1,t=!1,i=0,s=-1){super(e,t,i),this.trigger=s}load(e){g(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class vs extends vi{trigger;constructor(e=!1,t=!1,i=-1){super(e,t),this.trigger=i}load(e){g(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class qe extends z{max;constructor(e=!1,t=-1,i=0){super(e,t),this.max=i}load(e){g(e)||(super.load(e),this.max=e.max??this.max)}}class ys extends Q{max;constructor(e=!1,t=1,i=0){super(e,t),this.max=i}load(e){g(e)||(super.load(e),this.max=e.max??this.max)}}class wt{#e;selected;get options(){return this.#e}constructor(e,t=new Array){if(g(t.find(i=>i.value===e)))throw new Error("Provided selected value is not in provided options.");this.selected=e,this.#e=t}load(e){g(e)||(this.selected=e.selected??this.selected)}}class ws extends Q{buy;sell;constructor(e=!1,t=950,i=1e3,s=1){super(e,s),this.buy=t,this.sell=i}load(e){g(e)||(super.load(e),this.buy=e.buy??this.buy,this.sell=e.sell??this.sell)}}class ks extends y{#e;get upgrade(){return this.#e}constructor(e,t=!1){super(t),this.#e=e}}class _s extends y{buildings;constructor(e=!1){super(e),this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of De)e[t]=new ks(t);return e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled}))}}class kt extends qe{#e=void 0;get baseBuilding(){return this.#e}#t;get building(){return this.#t}#i=0;get stage(){return this.#i}constructor(e,t=!1,i=-1,s=0,a){super(t,i,s),this.#t=e,a&&(this.#i=1,this.#e=a)}}class _t extends z{buildings;gatherCatnip;turnOnMagnetos;turnOnSteamworks;turnOnReactors;upgradeBuildings;constructor(e=!1,t=-1,i=new y,s=new y,a=new y,n=new y,r=new _s){super(e,t),this.buildings=this.initBuildings(),this.gatherCatnip=i,this.turnOnSteamworks=s,this.turnOnMagnetos=a,this.turnOnReactors=n,this.upgradeBuildings=r}initBuildings(){const e={broadcasttower:"amphitheatre",dataCenter:"library",hydroplant:"aqueduct",solarfarm:"pasture",spaceport:"warehouse"},t={};for(const i of gt)i!=="unicornPasture"&&(t[i]=new kt(i));for(const i of De)t[i]=new kt(i,!1,-1,0,e[i]);return t}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max,t.trigger=i?.trigger??t.trigger}),this.gatherCatnip.enabled=e.gatherCatnip?.enabled??this.gatherCatnip.enabled,this.turnOnSteamworks.enabled=e.turnOnSteamworks?.enabled??this.turnOnSteamworks.enabled,this.turnOnMagnetos.enabled=e.turnOnMagnetos?.enabled??this.turnOnMagnetos.enabled,this.turnOnReactors.enabled=e.turnOnReactors?.enabled??this.turnOnReactors.enabled,this.upgradeBuildings.load(e.upgradeBuildings))}}class Cs{_host;settings;_bulkManager;_workshopManager;constructor(e,t,i=new _t){this._host=e,this.settings=i,this._workshopManager=t,this._bulkManager=new xe(this._host,this._workshopManager)}tick(e){this.settings.enabled&&(this._bulkManager.resetPriceCache(),this.autoBuild(e),this.autoMisc(e))}autoBuild(e,t=this.settings.buildings){const i={};for(const n of Object.values(t))i[n.building]=this._host.game.bld.getBuildingExt(n.baseBuilding??n.building).meta;const s=this.settings.trigger,a=n=>{this.build(n.name||n.id,n.stage??void 0,n.count)};e.purchaseOrders.push({builder:a,builds:t,metaData:i,sectionTrigger:s})}autoUpgrade(e){const t=this._host.game.bld.getBuildingExt("pasture").meta.stage===0?this._host.game.bld.getBuildingExt("pasture").meta.val:0,i=this._host.game.bld.getBuildingExt("aqueduct").meta.stage===0?this._host.game.bld.getBuildingExt("aqueduct").meta.val:0,s=this._host.game.bld.getBuildingExt("pasture").meta;if(this.settings.upgradeBuildings.buildings.solarfarm.enabled&&s.unlocked&&s.stage===0&&p(s.stages)[1].stageUnlocked&&this._workshopManager.getPotentialCatnip(!0,0,i)>0&&this._bulkManager.singleBuildPossible("pasture")){const o=this.getBuild("pasture",0);g(o?.model)||(o.controller.sellInternal(o.model,0,!1),s.on=0,s.val=0,s.stage=1,this._host.engine.iactivity("upgrade.building.pasture",[],"ks-upgrade"),this._host.game.ui?.render(),this.build("pasture",1,1),e.requestGameUiRefresh=!0)}const a=this._host.game.bld.getBuildingExt("aqueduct").meta;if(this.settings.upgradeBuildings.buildings.hydroplant.enabled&&a.unlocked&&a.stage===0&&p(a.stages)[1].stageUnlocked&&this._workshopManager.getPotentialCatnip(!0,t,0)>0&&this._bulkManager.singleBuildPossible("aqueduct")){const o=this.getBuild("aqueduct",0);g(o?.model)||(o.controller.sellInternal(o.model,0,!1),a.on=0,a.val=0,a.stage=1,a.calculateEffects?.(a,this._host.game),this._host.engine.iactivity("upgrade.building.aqueduct",[],"ks-upgrade"),this._host.game.ui?.render(),this.build("aqueduct",1,1),e.requestGameUiRefresh=!0)}const n=this._host.game.bld.getBuildingExt("library").meta;if(this.settings.upgradeBuildings.buildings.dataCenter.enabled&&n.unlocked&&n.stage===0&&p(n.stages)[1].stageUnlocked){let o=this._host.game.workshop.get("cryocomputing").researched?1:2;this._host.game.challenges.currentChallenge==="energy"&&(o*=2);let h=3;if(this._host.game.workshop.get("uplink").researched&&(h*=1+this._host.game.bld.getBuildingExt("biolab").meta.val*this._host.game.getEffect("uplinkDCRatio")),this._host.game.workshop.get("machineLearning").researched&&(h*=1+this._host.game.bld.getBuildingExt("aiCore").meta.on*this._host.game.getEffect("dataCenterAIRatio")),this._host.game.resPool.energyProd>=this._host.game.resPool.energyCons+o*n.val/h&&this._bulkManager.singleBuildPossible("library")){const u=p(this.getBuild("library",0));if(g(u.model))return;u.controller.sellInternal(u.model,0,!1),n.on=0,n.val=0,n.stage=1,n.calculateEffects?.(n,this._host.game),this._host.engine.iactivity("upgrade.building.library",[],"ks-upgrade"),this._host.game.ui?.render(),this.build("library",1,1),e.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&&this._bulkManager.singleBuildPossible("warehouse")){const o=this.getBuild("warehouse",0);if(!g(o?.model)){o.controller.sellInternal(o.model,0,!1),r.on=0,r.val=0,r.stage=1,this._host.engine.iactivity("upgrade.building.warehouse",[],"ks-upgrade"),this._host.game.ui?.render(),this.build("warehouse",1,1),e.requestGameUiRefresh=!0;return}}const c=this._host.game.bld.getBuildingExt("amphitheatre").meta;if(this.settings.upgradeBuildings.buildings.broadcasttower.enabled&&c.unlocked&&c.stage===0&&p(c.stages)[1].stageUnlocked&&this._bulkManager.singleBuildPossible("amphitheatre")){const o=this.getBuild("amphitheatre",0);g(o?.model)||(o.controller.sellInternal(o.model,0,!1),c.on=0,c.val=0,c.stage=1,this._host.engine.iactivity("upgrade.building.amphitheatre",[],"ks-upgrade"),this._host.game.ui?.render(),this.build("amphitheatre",1,1),e.requestGameUiRefresh=!0)}}autoMisc(e){if(this.settings.turnOnSteamworks.enabled){const t=this._host.game.bld.getBuildingExt("steamworks");if(t.meta.val&&t.meta.on===0){const i=this.getBuild("steamworks");i.controller.onAll(i.model)}}if(this.settings.turnOnMagnetos.enabled){const t=this._host.game.bld.getBuildingExt("magneto");if(t.meta.val&&t.meta.on<t.meta.val){const i=this.getBuild("magneto");i.controller.onAll(i.model)}}if(this.settings.turnOnReactors.enabled){const t=this._host.game.bld.getBuildingExt("reactor");if(t.meta.val&&t.meta.on<t.meta.val){const i=this.getBuild("reactor");i.controller.onAll(i.model)}}this.settings.upgradeBuildings.enabled&&this.autoUpgrade(e),this.settings.gatherCatnip.enabled&&this.autoGather()}autoGather(){for(let e=0;e<Math.floor(this._host.engine.settings.interval/20);++e)this._host.game.bld.gatherCatnip()}build(e,t,i){let s=0,a;const n=game.getUnlockByName(e,"buildings"),r=new classes.BuildingMeta(n).getMeta();if("stages"in r){const c=new classes.ui.btn.StagingBldBtnController(this._host.game),o=c.fetchModel({building:e,controller:c,description:p(r.description),name:p(r.label),twoRow:!1});s=this._bulkManager.construct(o,c,i),a=r.label??""}else{const c=new classes.ui.btn.BuildingBtnModernController(this._host.game),o=c.fetchModel({building:e,controller:c,description:p(r.description),name:p(r.label),twoRow:!1});s=this._bulkManager.construct(o,c,i),a=r.label??""}i!==s&&(console.warn(...f(`${a} Amount ordered: ${i} Amount Constructed: ${s}`)),s===0)||(this._host.engine.storeForSummary(a,s,"build"),s===1?this._host.engine.iactivity("act.build",[a],"ks-build"):this._host.engine.iactivity("act.builds",[a,this._host.renderAbsolute(s)],"ks-build"))}getBuild(e,t=0){const i=game.bld.get(e),s=new classes.BuildingMeta(i).getMeta(),a=g(s.stages)?i:s.stages[t],n="stages"in a?new classes.ui.btn.StagingBldBtnController(this._host.game):new classes.ui.btn.BuildingBtnModernController(this._host.game),r=n.fetchModel({building:e,description:a.description,key:e,name:a.label});return{controller:n,model:r}}}class Ss{_host;_lastday;_lastyear;_sections=new Map;constructor(e){this._host=e,this.resetActivity()}resetActivity(){this._sections=new Map,this._lastday=this._host.game.calendar.day,this._lastyear=this._host.game.calendar.year}storeActivity(e,t=1,i="other"){this._sections.has(i)||this._sections.set(i,new Map);const s=p(this._sections.get(i));s.has(e)||s.set(e,0),s.set(e,p(s.get(e))+t)}renderSummary(){const e=new Array;if(this._sections.has("other")){const t=p(this._sections.get("other"));for(const[i,s]of t)e.push(this._host.engine.i18n(`summary.${i}`,[this._host.game.getDisplayValueExt(s)]))}if(this._sections.has("research")&&p(this._sections.get("research")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.tech",[W(s)]))}),this._sections.has("upgrade")&&p(this._sections.get("upgrade")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.upgrade",[W(s)]))}),this._sections.has("build")&&p(this._sections.get("build")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.building",[this._host.game.getDisplayValueExt(i),W(s)]))}),this._sections.has("refine")&&p(this._sections.get("refine")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.refine",[this._host.game.getDisplayValueExt(i),W(s)]))}),this._sections.has("faith")&&p(this._sections.get("faith")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.sun",[this._host.game.getDisplayValueExt(i),W(s)]))}),this._sections.has("craft")&&p(this._sections.get("craft")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.craft",[this._host.game.getDisplayValueExt(i),W(s)]))}),this._sections.has("trade")&&p(this._sections.get("trade")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.trade",[this._host.game.getDisplayValueExt(i),W(s)]))}),this._lastday&&this._lastyear){let t=this._host.game.calendar.year-this._lastyear,i=this._host.game.calendar.day-this._lastday;i<0&&(t-=1,i+=400);let s="";t>0&&(s+=`${t} `,s+=t===1?this._host.engine.i18n("summary.year"):this._host.engine.i18n("summary.years")),i>=0&&(t>0&&(s+=this._host.engine.i18n("summary.separator")),s+=`${cs(i)} `,s+=i===1?this._host.engine.i18n("summary.day"):this._host.engine.i18n("summary.days")),e.push(this._host.engine.i18n("summary.head",[s]))}return e}}const xs={"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.highlightStock":"Highlight resource stock","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}"},Ts={"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.highlightStock":"Highlight resource stock","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"},Es={"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.highlightStock":"Highlight resource stock","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}"},Ms={"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.highlightStock":"Highlight resource stock","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 ze extends qe{#e;#t;get building(){return this.#e}get variant(){return this.#t}constructor(e,t,i=!1){super(i),this.#e=e,this.#t=t}}class Ct extends z{buildings;bestUnicornBuilding;bestUnicornBuildingCurrent;sacrificeAlicorns;sacrificeUnicorns;refineTears;refineTimeCrystals;autoPraise;adore;transcend;constructor(e=!1,t=-1,i=new y,s=new Q(!1,-1),a=new Q(!1,-1),n=new Q(!1,-1),r=new Q(!1,-1),c=new z(!1,1),o=new z(!1,1),h=new y){super(e,t),this.buildings=this.initBuildings(),this.bestUnicornBuilding=i,this.sacrificeAlicorns=s,this.sacrificeUnicorns=a,this.refineTears=n,this.refineTimeCrystals=r,this.autoPraise=c,this.adore=o,this.transcend=h,this.bestUnicornBuildingCurrent=null}initBuildings(){const e={};for(const t of mt)e[t]=new ze(t,O.OrderOfTheSun);for(const t of ft)e[t]=new ze(t,O.Cryptotheology);for(const t of pt)e[t]=new ze(t,O.Ziggurat);return e.unicornPasture=new ze("unicornPasture",O.UnicornPasture),e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max,t.trigger=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 Rs{_host;settings;_bulkManager;_bonfireManager;_workshopManager;constructor(e,t,i,s=new Ct){this._host=e,this.settings=s,this._workshopManager=i,this._bulkManager=new xe(this._host,this._workshopManager),this._bonfireManager=t}async tick(e){this.settings.enabled&&(this._bulkManager.resetPriceCache(),this._autoBuild(e),this.settings.sacrificeUnicorns.enabled&&await this._autoSacrificeUnicorns(),this.settings.sacrificeAlicorns.enabled&&await this._autoSacrificeAlicorns(e),this.settings.refineTears.enabled&&this._autoTears(e),this.settings.refineTimeCrystals.enabled&&await this._autoTCs(e),this._autoTAP())}_autoBuild(e){if(this.settings.bestUnicornBuilding.enabled)this._buildBestUnicornBuilding(e),this._buildNonUnicornBuildings(e);else{const t=Object.fromEntries(Object.entries(this.settings.buildings).filter(([,a])=>a.variant!==O.UnicornPasture)),i=G(this.settings.buildings.unicornPasture.max),s=this._host.game.bld.getBuildingExt("unicornPasture").meta;this.settings.buildings.unicornPasture.enabled&&s.val<i&&this._bonfireManager.autoBuild(e,{unicornPasture:new kt("unicornPasture",this.settings.buildings.unicornPasture.enabled,this.settings.buildings.unicornPasture.trigger,this.settings.buildings.unicornPasture.max)}),this._buildReligionBuildings(e,t)}}_buildBestUnicornBuilding(e){const t=this.getBestUnicornBuilding();if(this.settings.bestUnicornBuildingCurrent!==t&&(this.settings.bestUnicornBuildingCurrent=t,this._host.refreshEntireUserInterface()),this.settings.bestUnicornBuildingCurrent===null)return;const i=this.settings.trigger;if(this.settings.bestUnicornBuildingCurrent==="unicornPasture"){const h={[this.settings.bestUnicornBuildingCurrent]:this.settings.buildings[this.settings.bestUnicornBuildingCurrent]},u={[this.settings.bestUnicornBuildingCurrent]:this._host.game.bld.getBuildingExt("unicornPasture").meta},d=m=>{this._bonfireManager.build("unicornPasture",0,1)};e.purchaseOrders.push({builder:d,builds:h,metaData:u,sectionTrigger:i});return}const s=this._getBuild(this.settings.bestUnicornBuildingCurrent,O.Ziggurat);let a=0;const n=p(s.model.prices).find(h=>h.name==="tears");g(n)||(a=n.val);const r=this._workshopManager.getValue("tears")-this._workshopManager.getStock("tears");if(r<a){const h=Math.floor((this._workshopManager.getValue("unicorns")-this._workshopManager.getStock("unicorns"))/2500),u=Math.ceil((a-r)/this._host.game.bld.getBuildingExt("ziggurat").meta.on),d=this._host.game.bld.get("ziggurat").on;if(u<h&&0<d){const m=new classes.ui.religion.TransformBtnController(this._host.game,{applyAtGain:b=>{this._host.game.stats.getStat("unicornsSacrificed").val+=b},gainedResource:"tears",gainMultiplier:()=>this._host.game.bld.get("ziggurat").on,logfilterID:"unicornSacrifice",logTextID:"religion.sacrificeBtn.sacrifice.msg",overcapMsgID:"religion.sacrificeBtn.sacrifice.msg.overcap"}),v=m.fetchModel({controller:m,description:"",name:"",prices:[{name:"unicorns",val:2500}]});m._transform(v,u)}else return}const c={[this.settings.bestUnicornBuildingCurrent]:this.settings.buildings[this.settings.bestUnicornBuildingCurrent]},o=h=>{this.build(h.id,O.Ziggurat,1)};e.purchaseOrders.push({builder:o,builds:c,metaData:this.getBuildMetaData(c),sectionTrigger:i})}_buildNonUnicornBuildings(e){const t=[...Ne],i=Object.fromEntries(Object.entries(this.settings.buildings).filter(([,s])=>!t.includes(s.building)));this._buildReligionBuildings(e,i)}_buildReligionBuildings(e,t){const i=this.getBuildMetaData(t),s=this.settings.trigger,a=n=>{this.build(n.id,p(n.variant),n.count)};e.purchaseOrders.push({builder:a,builds:t,metaData:i,sectionTrigger:s})}getBestUnicornBuilding(){const e=this._bonfireManager.getBuild("unicornPasture"),t=[...Ne].filter(re=>re!=="unicornPasture"),i=this._host.game.getEffect("unicornsPerTickBase")*this._host.game.getTicksPerSecondUI(),s=this._host.game.getEffect("unicornsGlobalRatio")+1,a=this._host.game.getEffect("unicornsRatioReligion")+1,n=this._host.game.prestige.getParagonProductionRatio()+1,r=this._host.game.religion.getSolarRevolutionRatio()+1,c=this._host.game.calendar.cycle,o=this._host.game.calendar.cycles[c];let h=1;o.festivalEffects.unicorns!==void 0&&this._host.game.prestige.getPerk("numeromancy").researched&&this._host.game.calendar.festivalDays&&(h=o.festivalEffects.unicorns);const u=i*s*a*n*r*h,d=Math.max(this._host.game.bld.getBuildingExt("ziggurat").meta.on,1),m=500*(1+this._host.game.getEffect("unicornsRatioReligion")*.1);let v=1;this._host.game.prestige.getPerk("unicornmancy").researched&&(v*=1.1);const b=this._host.game.getEffect("riftChance")*v/(1e4*2)*m;let S=Number.POSITIVE_INFINITY,R=null;const ce=p(this._host.game.bld.getBuildingExt("unicornPasture").meta.effects?.unicornsPerTickBase)*this._host.game.getTicksPerSecondUI()*s*a*n*r*h,j=p(e.model?.prices)[0].val/ce;j<S&&(S=j,R="unicornPasture");for(const re of t){const pe=this._getBuild(re,O.Ziggurat);if(!pe.model.metadata.unlocked)continue;let oe=0;for(const ve of p(pe.model.prices))ve.name==="unicorns"&&(oe+=ve.val),ve.name==="tears"&&(oe+=ve.val*2500/d);const be=p(this._host.game.religion.getZU(re));let Ce=a,nt=this._host.game.getEffect("riftChance");for(const ve in be.effects)ve==="unicornsRatioReligion"&&(Ce+=p(be.effects.unicornsRatioReligion)),ve==="riftChance"&&(nt+=p(be.effects.riftChance));const uo=500*((Ce-1)*.1+1);let ei=nt*v/(1e4*2)*uo;ei-=b;let ti=i*s*Ce*n*r*h;ti-=u,ti+=ei;const Qi=oe/ti;Qi<S&&(0<ei||a<Ce&&0<oe)&&(S=Qi,R=re)}return R}build(e,t,i){let s=0,a;if(t===O.Cryptotheology){const n=game.getUnlockByName(e,"transcendenceUpgrades"),r=new classes.ui.TranscendenceBtnController(this._host.game),c=r.fetchModel({controller:r,id:n.name});s=this._bulkManager.construct(c,r,i),a=n.label}else if(t===O.OrderOfTheSun){const n=game.getUnlockByName(e,"religion"),r=new com.nuclearunicorn.game.ui.ReligionBtnController(this._host.game),c=r.fetchModel({controller:r,id:n.name});s=this._bulkManager.construct(c,r,i),a=n.label}else if(t===O.Ziggurat){const n=game.getUnlockByName(e,"zigguratUpgrades"),r=new com.nuclearunicorn.game.ui.ZigguratBtnController(this._host.game),c=r.fetchModel({controller:r,id:n.name});s=this._bulkManager.construct(c,r,i),a=n.label}else throw new $e("unsupported");i!==s&&(console.warn(...f(`${a} Amount ordered: ${i} Amount Constructed: ${s}`)),s===0)||(t===O.OrderOfTheSun?(this._host.engine.storeForSummary(a,s,"faith"),s===1?this._host.engine.iactivity("act.sun.discover",[a],"ks-faith"):this._host.engine.iactivity("act.sun.discovers",[a,this._host.renderAbsolute(s)],"ks-faith")):(this._host.engine.storeForSummary(a,s,"build"),s===1?this._host.engine.iactivity("act.build",[a],"ks-build"):this._host.engine.iactivity("act.builds",[a,this._host.renderAbsolute(s)],"ks-build")))}getBuildMetaData(e){const t={};for(const i of Object.values(e)){const s=this.getUpgradeMeta(i.building,i.variant);if(s===null)continue;t[i.building]=s;const a=p(t[i.building]);if(!this._getBuild(i.building,i.variant))a.rHidden=!0;else{const n=p(this._getBuild(i.building,i.variant)).model,r=i.variant===O.Cryptotheology?this._host.game.science.get("cryptotheology").researched:!0;a.rHidden=!(n?.visible&&n.enabled&&r)}}return t}getUpgradeMeta(e,t){switch(t){case O.Ziggurat:return this._host.game.religion.getZU(e)??null;case O.OrderOfTheSun:return this._host.game.religion.getRU(e)??null;case O.Cryptotheology:return this._host.game.religion.getTU(e)??null}throw new Error(`Unknown build: ${e} (${t})`)}_getBuild(e,t){switch(t){case O.Ziggurat:return this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"zigguratUpgrades"});case O.OrderOfTheSun:return this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"religion"});case O.Cryptotheology:return this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"transcendenceUpgrades"});default:throw new Error(`Invalid variant \'${t}\'`)}}_transformBtnSacrificeHelper(e,t,i,s){const n=1/(e/t),c=new classes.ui.religion.TransformBtnController(game,i.controllerOpts)._newLink(s,n);return new Promise(o=>{c.handler(new Event("decoy"),o)})}async _autoSacrificeUnicorns(){const e=this._workshopManager.getResource("unicorns"),t=this._workshopManager.getValueAvailable("unicorns");if(!g(this._host.game.religionTab.sacrificeBtn)&&G(this.settings.sacrificeUnicorns.trigger)<=t&&G(this.settings.sacrificeUnicorns.trigger)<=e.value){const i=this._host.game.religionTab.sacrificeBtn.controller,s=this._host.game.religionTab.sacrificeBtn.model;if(g(s))return;await this._transformBtnSacrificeHelper(t,e.value,i,s);const a=this._workshopManager.getValueAvailable("unicorns"),n=t-a;this._host.engine.iactivity("act.sacrificeUnicorns",[this._host.game.getDisplayValueExt(n)],"ks-faith"),this._host.engine.storeForSummary(this._host.engine.i18n("$resources.unicorns.title"),n,"refine")}}async _autoSacrificeAlicorns(e){const t=this._workshopManager.getResource("alicorn"),i=this._workshopManager.getValueAvailable("alicorn");if(!g(this._host.game.religionTab.sacrificeAlicornsBtn)&&G(this.settings.sacrificeAlicorns.trigger)<=i&&G(this.settings.sacrificeAlicorns.trigger)<=t.value){this._host.game.religionTab.sacrificeAlicornsBtn.render();const s=this._host.game.religionTab.sacrificeAlicornsBtn.controller,a=this._host.game.religionTab.sacrificeAlicornsBtn.model;if(g(a)){e.requestGameUiRefresh=!0;return}await this._transformBtnSacrificeHelper(i,t.value,s,a);const n=this._workshopManager.getValueAvailable("alicorn"),r=i-n;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(e){const t=this._workshopManager.getResource("tears"),i=this._workshopManager.getValueAvailable("tears"),s=this._workshopManager.getResource("sorrow");if(!g(this._host.game.religionTab.refineBtn)&&G(this.settings.refineTears.trigger)<=i&&G(this.settings.refineTears.trigger)<=t.value&&s.value<s.maxValue){const a=i-this.settings.refineTears.trigger;if(a<1e4)return;const n=this._host.game.religionTab.refineBtn.controller,r=this._host.game.religionTab.refineBtn.model;if(g(r)){e.requestGameUiRefresh=!0;return}n.buyItem(r,new Event("decoy"),a);const c=this._workshopManager.getValueAvailable("tears"),o=i-c;this._host.engine.iactivity("act.refineTears",[this._host.game.getDisplayValueExt(o)],"ks-faith"),this._host.engine.storeForSummary(this._host.engine.i18n("$resources.tears.title"),o,"refine")}}async _autoTCs(e){const t=this._workshopManager.getResource("timeCrystal"),i=this._workshopManager.getValueAvailable("timeCrystal");if(!g(this._host.game.religionTab.refineTCBtn)&&G(this.settings.refineTimeCrystals.trigger)<=i&&G(this.settings.refineTimeCrystals.trigger)<=t.value){const s=this._host.game.religionTab.refineTCBtn.controller,a=this._host.game.religionTab.refineTCBtn.model;if(g(a)){e.requestGameUiRefresh=!0;return}await this._transformBtnSacrificeHelper(i,t.value,s,a);const n=this._workshopManager.getValueAvailable("timeCrystal"),r=i-n;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 e=this._workshopManager.getResource("faith"),t=e.value/e.maxValue;this.settings.transcend.enabled&&this.settings.autoPraise.trigger-.02<=t&&this._autoTranscend(),this.settings.autoPraise.trigger<=t&&(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(e){const t=this._workshopManager.getResource("faith"),i=this._host.game.religion.faith,s=this._host.game.religion.faithRatio,n=p(this._host.game.religion.getRU("transcendence")).on?this._host.game.religion.transcendenceTier:0,r=10+this._host.game.getEffect("solarRevolutionLimit"),c=r*e,o=i/1e6*n*n*1.01,h=s+o,u=.01+t.value*(1+this._host.game.getUnlimitedDR(h,.1)*.1),d=this._host.game.getLimitedDR(this._host.game.getUnlimitedDR(u,1e3)/100,r);c<=d&&(this._host.game.religion._resetFaithInternal(1.01),this._host.engine.iactivity("act.adore",[this._host.game.getDisplayValueExt(i),this._host.game.getDisplayValueExt(o)],"ks-adore"),this._host.engine.storeForSummary("adore",o))}_autoTranscend(){let e=this._host.game.religion.faithRatio;const t=p(this._host.game.religion.getRU("transcendence")).on;let i=t?this._host.game.religion.transcendenceTier:0;if(t){const s=((i+2)/(i+1))**2,a=this._host.game.religion._getTranscendTotalPrice(i+1)-this._host.game.religion._getTranscendTotalPrice(i),n=a,r=s;if((1-r+Math.sqrt(80*(r*r-1)*n+(r-1)*(r-1)))*r/(40*(r+1)*(r+1)*(r-1))+n+n/(r*r-1)<=e){this._host.game.religion.faithRatio-=a,this._host.game.religion.tcratio+=a,this._host.game.religion.transcendenceTier+=1;const o=p(this._host.game.challenges.getChallenge("atheism"));o.calculateEffects?.(o,this._host.game);const h=p(this._host.game.religion.getTU("blackObelisk"));h.calculateEffects?.(h,this._host.game),this._host.game.msg(this._host.engine.i18n("$religion.transcend.msg.success",[this._host.game.religion.transcendenceTier])),e=this._host.game.religion.faithRatio,i=this._host.game.religion.transcendenceTier,this._host.engine.iactivity("act.transcend",[this._host.game.getDisplayValueExt(a),i],"ks-transcend"),this._host.engine.storeForSummary("transcend",1)}}}_autoPraise(){const e=this._workshopManager.getResource("faith"),t=this._host.game.religion.getApocryphaBonus(),i=e.value*(1+t);this._host.engine.storeForSummary("praise",i),this._host.engine.iactivity("act.praise",[this._host.game.getDisplayValueExt(e.value),this._host.game.getDisplayValueExt(i)],"ks-praise"),this._host.game.religion.praise()}}const ie=(l,e)=>l.filter(t=>!e.includes(t));class As extends y{#e;get policy(){return this.#e}constructor(e,t=!1){super(t),this.#e=e}}class wi extends y{policies;constructor(e=!1){super(e),this.policies=this.initPolicies()}initPolicies(){const e={};for(const t of ds)e[t]=new As(t);return e}static validateGame(e,t){const i=Object.keys(t.policies),s=e.science.policies.map(r=>r.name),a=ie(s,i),n=ie(i,s);for(const r of a)console.warn(...f(`The policy \'${r}\' is not tracked in Kitten Scientists!`));for(const r of n)console.warn(...f(`The policy \'${r}\' is not a policy in Kittens Game!`))}load(e){g(e)||(super.load(e),L(this.policies,e.policies,(t,i)=>{t.enabled=i?.enabled??t.enabled}))}}class Ps extends z{#e;get tech(){return this.#e}constructor(e,t=!1){super(t,-1),this.#e=e}}class ki extends z{techs;constructor(e=!1){super(e,-1),this.techs=this.initTechs()}initTechs(){const e={};for(const t of gs)e[t]=new Ps(t);return e}static validateGame(e,t){const i=Object.keys(t.techs),s=e.science.techs.map(r=>r.name),a=ie(s,i),n=ie(i,s);for(const r of a)pi.includes(r)||console.warn(...f(`The technology \'${r}\' is not tracked in Kitten Scientists!`));for(const r of n){if(pi.includes(r)){console.info(...f(`The technology \'${r}\' is a technology in Kittens Game, but it\'s no longer used.`));continue}console.warn(...f(`The technology \'${r}\' is not a technology in Kittens Game!`))}}load(e){g(e)||(super.load(e),L(this.techs,e.techs,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class St extends y{policies;techs;observe;constructor(e=!1,t=new wi,i=new ki,s=new y){super(e),this.policies=t,this.techs=i,this.observe=s}static validateGame(e,t){wi.validateGame(e,t.policies),ki.validateGame(e,t.techs)}load(e){g(e)||(super.load(e),this.policies.load(e.policies),this.techs.load(e.techs),this.observe.enabled=e.observe?.enabled??this.observe.enabled)}}class ye{_host;constructor(e){this._host=e}upgrade(e,t){let i=!1;if(t==="policy"){const a=game.getUnlockByName(e.name,"policies"),n=new classes.ui.PolicyBtnController(this._host.game),r=n.fetchModel({controller:n,id:a.name});i=ye.skipConfirm(()=>n.buyItem(r)).itemBought}else if(t==="science"){const a=game.getUnlockByName(e.name,"tech"),n=new com.nuclearunicorn.game.ui.TechButtonController(this._host.game),r=n.fetchModel({controller:n,id:a.name});i=ye.skipConfirm(()=>n.buyItem(r)).itemBought}else{const a=game.getUnlockByName(e.name,"upgrades"),n=new com.nuclearunicorn.game.ui.UpgradeButtonController(this._host.game),r=n.fetchModel({controller:n,id:a.name});i=ye.skipConfirm(()=>n.buyItem(r)).itemBought}if(!i)return!1;const s=e.label;return t==="workshop"?(this._host.engine.storeForSummary(s,1,"upgrade"),this._host.engine.iactivity("upgrade.upgrade",[s],"ks-upgrade")):t==="policy"?this._host.engine.iactivity("upgrade.policy",[s]):t==="science"&&(this._host.engine.storeForSummary(s,1,"research"),this._host.engine.iactivity("upgrade.tech",[s],"ks-research")),!0}static async skipConfirmAsync(e){const t=game.ui.confirm;try{return game.ui.confirm=()=>!0,await e()}finally{game.ui.confirm=t}}static skipConfirm(e){const t=game.ui.confirm;try{return game.ui.confirm=()=>!0,e()}finally{game.ui.confirm=t}}}const Bs=l=>new Promise(e=>setTimeout(e,l)),we="en-US",Is=120*1e3,$s="localStorage"in globalThis&&!g(localStorage["ks.timeout"])?Number(localStorage["ks.timeout"]):void 0;class C{_gameStartSignal;_gameStartSignalResolver;_possibleEngineState;static tryEngineStateFromSaveData(e,t){const i=t;if(!(e in i)){console.debug(...f(`Failed: \\`${e}\\` not found in save data.`));return}const s=i.ks;if(!("state"in s)){console.debug(...f(`Failed: \\`${e}.state\\` not found in save data.`));return}const a=s.state;if(!Array.isArray(a)){console.debug(...f(`Failed: \\`${e}.state\\` not \\`Array\\`.`));return}return a[0]}async waitForGame(e,t,i=$s??Is){if(C._isGameLoaded()){const a=p(C.window.game),n=p(C.window.$I),r=localStorage["com.nuclearunicorn.kittengame.language"];return new e(a,n,r,this._possibleEngineState)}const s=[Bs(2e3)];if(g(this._gameStartSignal)&&typeof C.window.dojo<"u"){this._gameStartSignal=new Promise(n=>{this._gameStartSignalResolver=n});const a=C.window.dojo.subscribe("game/start",()=>{console.debug(...f(`\'game/start\' signal caught. Fast-tracking script load for \'${t}\'...`)),p(this._gameStartSignalResolver)(!0),C.window.dojo.unsubscribe(a)});if(t!==void 0){const n=C.window.dojo.subscribe("server/load",r=>{console.info(...f(`\'server/load\' signal caught. Looking for script state with key \'${t}\' in save data...`));const c=C.tryEngineStateFromSaveData(t,r);if(!c){console.info(...f(`The Kittens Game save data did not contain a script state for \'${t}\'.`));return}console.info(...f(`Found key \'${t}\'! Provided save data will be used as seed for next script instance.`)),this._possibleEngineState=c,C.window.dojo.unsubscribe(n)})}}if(g(this._gameStartSignal)||s.push(this._gameStartSignal),i<0)throw new Error("Unable to find game. Giving up. Maybe the game is not exported at `window.game`?");return console.debug(...f(`Waiting for game... (timeout: ${Math.round(i/1e3)}s)`)),await Promise.race(s),this.waitForGame(e,t,i-2e3)}static _isGameLoaded(){return!g(C.window.game)&&(C.window.document.getElementById("game")?.checkVisibility()??!1)&&!g(C.window.$I)}static get window(){try{return p(unsafeWindow)}catch{return window}}}class Ls extends ye{settings;_workshopManager;constructor(e,t,i=new St){super(e),this.settings=i,this._workshopManager=t}async tick(e){this.settings.enabled&&(this.settings.techs.enabled&&this._host.game.libraryTab.visible&&await this.autoUnlock(),this.settings.policies.enabled&&this._host.game.libraryTab.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 s=e.find(n=>n.name===i.tech);if(g(s)){console.error(...f(`Tech \'${i.tech}\' not found in game!`));continue}if(s.researched||!s.unlocked)continue;let a=C.window.dojo.clone(s.prices);a=this._host.game.village.getEffectLeader("scientist",a);for(const n of a){const r=this._workshopManager.getValueAvailable(n.name),c=this._workshopManager.getResource(n.name),o=ee.evaluateSubSectionTrigger(this.settings.techs.trigger,i.trigger);if(o<0||r<c.maxValue*o||r<n.val)continue e}t.push(s)}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 s=e.find(a=>a.name===i.policy);if(g(s)){console.error(...f(`Policy \'${i.policy}\' not found in game!`));continue}!s.researched&&!s.blocked&&s.unlocked&&(s.requiredLeaderJob===void 0||this._host.game.village.leader!==null&&this._host.game.village.leader.job===s.requiredLeaderJob)&&t.push(s)}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 Os extends y{#e;get mission(){return this.#e}constructor(e,t=!1){super(t),this.#e=e}}class _i extends y{missions;constructor(e=!1){super(e),this.missions=this.initMissions()}initMissions(){const e={};for(const t of ms)e[t]=new Os(t);return e}static validateGame(e,t){const i=Object.keys(t.missions),s=e.space.programs.map(r=>r.name),a=ie(s,i),n=ie(i,s);for(const r of a)console.warn(...f(`The space mission \'${r}\' is not tracked in Kitten Scientists!`));for(const r of n)console.warn(...f(`The space mission \'${r}\' is not a space mission in Kittens Game!`))}load(e){g(e)||(super.load(e),L(this.missions,e.missions,(t,i)=>{t.enabled=i?.enabled??t.enabled}))}}class Us extends qe{#e;get building(){return this.#e}constructor(e){super(!1,-1,0),this.#e=e}}class He extends z{buildings;unlockMissions;constructor(e=!1,t=-1,i=new _i){super(e,t),this.buildings=this.initBuildings(),this.unlockMissions=i}initBuildings(){const e={};for(const t of bt)e[t]=new Us(t);return e}static validateGame(e,t){_i.validateGame(e,t.unlockMissions)}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max,t.trigger=i?.trigger??t.trigger}),this.unlockMissions.load(e.unlockMissions))}}class Ds{_host;settings;_bulkManager;_workshopManager;constructor(e,t,i=new He){this._host=e,this.settings=i,this._workshopManager=t,this._bulkManager=new xe(this._host,this._workshopManager)}tick(e){this.settings.enabled&&(this._bulkManager.resetPriceCache(),this.autoBuild(e),this.settings.unlockMissions.enabled&&this.autoUnlock(e))}autoBuild(e,t=this.settings.buildings){const i=this.settings.trigger,s={};for(const n of Object.values(t))s[n.building]=this._host.game.space.getBuilding(n.building);const a=n=>{this.build(n.id,n.count)};e.purchaseOrders.push({builder:a,builds:t,metaData:s,sectionTrigger:i})}autoUnlock(e){if(!this._host.game.tabs[6].visible)return;const t=this._host.game.space.meta[0].meta;e:for(let i=0;i<t.length;i++){if(0<t[i].val||!t[i].unlocked||!this.settings.unlockMissions.missions[t[i].name].enabled)continue;const s=this._host.game.time.queue.getQueueElementControllerAndModel({name:t[i].name,type:"spaceMission"}),a=p(s.model.prices);for(const n of a)if(this._workshopManager.getValueAvailable(n.name)<n.val)continue e;s.controller.buyItem(s.model),i===7||i===12?this._host.engine.iactivity("upgrade.space.mission",[t[i].label],"ks-upgrade"):this._host.engine.iactivity("upgrade.space",[t[i].label],"ks-upgrade")}}build(e,t){let i=0,s;const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"spaceBuilding"});s=game.getUnlockByName(e,"spaceBuilding").label;const r=a.controller,c=a.model;return i=this._bulkManager.construct(c,r,t),t!==i&&(console.warn(...f(`${s} Amount ordered: ${t} Amount Constructed: ${i}`)),i===0)?0:(this._host.engine.storeForSummary(s,i,"build"),i===1?this._host.engine.iactivity("act.build",[s],"ks-build"):this._host.engine.iactivity("act.builds",[s,this._host.renderAbsolute(i)],"ks-build"),i)}}var Ci=(l=>(l.accelerate="ks-activity type_ks-accelerate",l.adore="ks-activity type_ks-adore",l.build="ks-activity type_ks-build",l.craft="ks-activity type_ks-craft",l.distribute="ks-activity type_ks-distribute",l.faith="ks-activity type_ks-faith",l.festival="ks-activity type_ks-festival",l.hunt="ks-activity type_ks-hunt",l.misc="ks-activity",l.praise="ks-activity type_ks-praise",l.promote="ks-activity type_ks-promote",l.research="ks-activity type_ks-research",l.star="ks-activity type_ks-star",l.timeSkip="ks-activity type_ks-timeSkip",l.trade="ks-activity type_ks-trade",l.transcend="ks-activity type_ks-transcend",l.upgrade="ks-activity type_ks-upgrade",l))(Ci||{});const Si=["accelerate","adore","build","craft","distribute","faith","festival","hunt","misc","praise","promote","research","star","timeSkip","trade","transcend","upgrade"],xi=["alicornCorruption","alicornRift","alicornSacrifice","astronomicalEvent","blackcoin","craft","elders","faith","festival","hunt","ivoryMeteor","meteor","tcRefine","tcShatter","trade","unicornRift","unicornSacrifice","workshopAutomation"];class Ti extends y{#e;get variant(){return this.#e}constructor(e){super(!0),this.#e=e}}class Ns extends y{filters;filtersGame;constructor(e=!1){super(e),this.filters={};for(const t of Si)this.filters[t]=new Ti(Ci[t]);this.filtersGame={};for(const t of xi)this.filtersGame[t]=new Ti(null)}load(e){g(e)||(super.load(e),L(this.filters,e.filters,(t,i)=>{t.enabled=i?.enabled??t.enabled}),L(this.filtersGame,e.filtersGame,(t,i)=>{t.enabled=i?.enabled??t.enabled}))}}class qs extends z{#e;#t;get upgrade(){return this.#e}get $upgrade(){return this.#t}set $upgrade(e){this.#t=e}constructor(e,t=!1){super(t,-1),this.#e=e}}class Ei extends z{upgrades;constructor(e=!1){super(e,-1),this.upgrades=this.initUpgrades()}initUpgrades(){const e={};for(const t of bi)e[t]=new qs(t);return e}static validateGame(e,t){const i=Object.keys(t.upgrades),s=e.workshop.upgrades.map(r=>r.name),a=ie(s,i),n=ie(i,s);for(const r of a)console.warn(...f(`The workshop upgrade \'${r}\' is not tracked in Kitten Scientists!`));for(const r of n)console.warn(...f(`The workshop upgrade \'${r}\' is not an upgrade in Kittens Game!`))}load(e){g(e)||(super.load(e),L(this.upgrades,e.upgrades,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class zs extends bs{#e;get resource(){return this.#e}constructor(e,t=!1,i=!0){super(t,i),this.#e=e}}class Fe extends z{resources;shipOverride;unlockUpgrades;constructor(e=!1,t=-1,i=new Ei,s=new y){super(e,t),this.resources=this.initResources(),this.shipOverride=s,this.unlockUpgrades=i}initResources(){const e={};for(const t of di)e[t]=new zs(t);return e}static validateGame(e,t){const i=Object.keys(t.resources),s=e.workshop.crafts.map(r=>r.name),a=ie(s,i),n=ie(i,s);for(const r of a)console.warn(...f(`The workshop craft \'${r}\' is not tracked in Kitten Scientists!`));for(const r of n)console.warn(...f(`The workshop craft \'${r}\' is not an upgrade in Kittens Game!`));Ei.validateGame(e,t.unlockUpgrades)}load(e){g(e)||(super.load(e),L(this.resources,e.resources,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.limited=i?.limited??t.limited,t.max=i?.max??t.max,t.trigger=i?.trigger??t.trigger}),this.unlockUpgrades.load(e.unlockUpgrades),this.shipOverride.enabled=e.shipOverride?.enabled??this.shipOverride.enabled)}}class Mi extends ye{settings;static DEFAULT_CONSUME_RATE=1;constructor(e,t=new Fe){super(e),this.settings=t}tick(e){return this.settings.enabled?(this.autoCraft(),this._host.engine.settings.highlighStock.enabled&&this.refreshStock(),this.settings.unlockUpgrades.enabled?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 s=i.$upgrade??e.find(n=>n.name===i.upgrade);if(g(s)){console.error(...f(`Upgrade \'${i.upgrade}\' not found in game!`));continue}if(i.$upgrade===void 0&&(i.$upgrade=s),s.researched||!s.unlocked)continue;let a=C.window.dojo.clone(s.prices);a=this._host.game.village.getEffectLeader("scientist",a);for(const n of a){const r=this.getValueAvailable(n.name),c=this.getResource(n.name),o=ee.evaluateSubSectionTrigger(this.settings.unlockUpgrades.trigger,i.trigger);if(o<0||0<o&&r<c.maxValue*o||r<n.val)continue e}t.push(s)}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 n of Object.values(e)){const r=ee.evaluateSubSectionTrigger(i,n.trigger);if(r<0||!n.enabled)continue;const c=n.max?this.getResource(n.resource):!1,o=G(n.max);if(c&&o<c.value||!this.singleCraftPossible(n.resource))continue;const h=Object.keys(this.getMaterials(n.resource));h.map(m=>this.getResource(m)).filter(m=>0<m.maxValue).filter(m=>m.value/m.maxValue<r).length===0&&t.set(n,{countRequested:1,materials:h.map(m=>({consume:0,resource:m}))})}if(t.size<1)return;const s=new Map;for(const[n,r]of t)for(const c of r.materials)s.has(c.resource)||s.set(c.resource,new Array),p(s.get(c.resource)).push(n.resource);for(const[,n]of t)for(const r of n.materials){const c=this.getValueAvailable(r.resource);r.consume=c/p(s.get(r.resource)).length}for(const[n,r]of t){const c=this.getMaterials(n.resource);let o=Number.MAX_VALUE;for(const m of r.materials){const v=p(c[m.resource]),b=this.getResource(m.resource);if(!n.limited||n.resource==="ship"&&this.settings.shipOverride.enabled&&this.getResource("ship").value<243){o=Math.min(o,m.consume/v);continue}const S=this._host.game.getResCraftRatio(n.resource),R=this.getValueAvailable(m.resource)/p(s.get(m.resource)).length,Z=this.getValueAvailable(n.resource),ce=v,j=1+S,re=R/ce,pe=Z/j,oe=Math.max(0,Math.floor(Math.log(pe)/Math.LN10+1e-9));o=Math.min(o,Math.min(re-(0<b.maxValue&&b.maxValue<=b.value?0:pe),10**(oe+1)),m.consume/v)}const h=this.getValueAvailable(n.resource),u=1+this._host.game.getResCraftRatio(n.resource),d=Number.MAX_VALUE/u-h/u;o=Math.min(o,d),r.countRequested=Math.max(0,n.max===-1?o:Math.min(o,(n.max-h)/u))}const a=new Array;for(const[n,r]of t)r.countRequested<1||a.push({amount:Math.floor(r.countRequested),name:n.resource});0<a.length&&this.craftMultiple(a)}craftMultiple(e){const t=new Array;for(const i of e){const s=this.getCraft(i.name),a=this._host.game.getResCraftRatio(s.name);if(!this._host.game.workshop.craft(s.name,i.amount,!0,!1,!1)){console.error(...f(`Failed trying to craft ${i.amount}x ${i.name}! This is a problem and should be reported.`));continue}const r=p(this._host.game.resPool.get(i.name)).title,c=Number.parseFloat((i.amount*(1+a)).toFixed(2));this._host.engine.storeForSummary(r,c,"craft"),t.push(this._host.engine.i18n("act.craft",[this._host.game.getDisplayValueExt(c),r]))}this._host.game.updateResources();for(const i of t)this._host.engine.printOutput("ks-activity type_ks-craft",i)}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,s]of P(t))if(this.getValueAvailable(i)<s)return!1;return!0}getMaterials(e){const t={},i=this.getCraft(e),s=this._host.game.workshop.getCraftPrice(i);for(const a of s)t[a.name]=a.val;return t}getTickVal(e,t,i=void 0){let s=this._host.game.getResourcePerTick(e.name,!0);if(e.craftable){let a=Number.MAX_VALUE;const n=this.getMaterials(e.name);for(const[r,c]of P(n)){const o=(1+this._host.game.getResCraftRatio(e.name))/c,h=this.getTickVal(this.getResource(r));h!=="ignore"&&(a=Math.min(h*o,a))}s+=a!==Number.MAX_VALUE?a:0}return s<=0&&(e.name==="spice"||e.name==="blueprint")?"ignore":(!i&&!g(t)&&(s+=t.getResValue(e.name)),s)}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(g(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,n=this._host.game.bld.getBuildingExt("aqueduct").meta,r=a.stage===0?a.val:0,c=n.stage===0?n.val:0,o=this.getPotentialCatnip(!0,r,c);o<0&&(t-=o*202*5)}let i=this.getValue(e);i=Math.max(i-t,0);const s=this.getConsume(e);return i*s}getPotentialCatnip(e,t,i){let s=this._host.game.getEffect("catnipPerTickBase");e?(s*=.1,s*=1+this._host.game.getLimitedDR(this._host.game.getEffect("coldHarshness"),1)):s*=this._host.game.calendar.getWeatherMod({name:"catnip"})+this._host.game.calendar.getCurSeason().modifiers.catnip,this._host.game.science.getPolicy("communism").researched&&(s=0);const a=this._host.game.village.getResProduction(),n=a.catnip?a.catnip*(1+this._host.game.getEffect("catnipJobRatio")):0;let r=s+n,c=this._host.game.space.getBuilding("hydroponics").val;this._host.game.prestige.meta[0].meta[21].researched&&(this._host.game.calendar.cycle===2&&(c*=2),this._host.game.calendar.cycle===7&&(c*=.5)),r*=1+.03*i+.025*c;const h=this._host.game.challenges.currentChallenge==="winterIsComing"?0:this._host.game.prestige.getParagonProductionRatio();r*=1+h,r*=1+this._host.game.religion.getSolarRevolutionRatio(),this._host.game.opts.disableCMBR||(r*=1+this._host.game.getCMBRBonus()),r=p(this._host.game.calendar.cycleEffectsFestival({catnip:r}).catnip);let u=this._host.game.village.getResConsumption().catnip;const d=this._host.game.bld.getBuildingExt("unicornPasture").meta.val;if(u*=1+this._host.game.getLimitedDR(t*-.005+d*-.0015,1),this._host.game.village.sim.kittens.length>0&&this._host.game.village.happiness>1){const m=this._host.game.village.happiness-1,v=this._host.game.getEffect("catnipDemandWorkerRatioGlobal");this._host.game.challenges.currentChallenge==="anarchy"?u*=1+m*(1+v):u*=1+m*(1+v)*(1-this._host.game.village.getFreeKittens()/this._host.game.village.sim.kittens.length)}return r+=u,r+=this._host.game.getResourcePerTickConvertion("catnip"),r}refreshStock(){const e=[...document.querySelectorAll("#game .res-row .res-cell.resAmount, #game .res-row .res-cell.resource-value")],t=new Map(e.map(i=>[p([...i.parentNode.classList.entries()].find(([s,a])=>a.startsWith("resource_")))[1].substring(9),i]));for(const[i,s]of P(this._host.engine.settings.resources.resources)){const a=t.get(i);if(!a)continue;if(!s.enabled||s.stock===0){(a.classList.contains("ks-stock-above")||a.classList.contains("ks-stock-below"))&&a.classList.remove("ks-stock-above","ks-stock-below");continue}const n=this._host.game.resPool.get(i).value<s.stock;a.classList.add(n?"ks-stock-below":"ks-stock-above"),a.classList.remove(n?"ks-stock-above":"ks-stock-below")}}}class Hs extends y{#e;consume;stock=0;get resource(){return this.#e}constructor(e,t=!1,i=Mi.DEFAULT_CONSUME_RATE,s=0){super(t),this.#e=e,this.consume=i,this.stock=s}}class Fs extends y{resources;constructor(e=!1){super(e),this.resources=this.initResources()}initResources(){const e={};for(const t of gi)e[t]=new Hs(t);return e}load(e){g(e)||(super.load(e),L(this.resources,e.resources,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.consume=i?.consume??t.consume,t.stock=i?.stock??t.stock}))}}class Ws extends y{noConfirm;compress;constructor(e=new y,t=new y(!0)){super(!0),this.noConfirm=e,this.compress=t}load(e){g(e)||(super.load(e),this.noConfirm.load(e.noConfirm),this.compress.load(e.compress))}}class Ri extends y{interval=2e3;locale;ksColumn;highlighStock;filters;resources;states;constructor(e=!1,t=new Ns,i=new Fs,s=new Ws,a=we,n=new y,r=new y){super(e),this.filters=t,this.resources=i,this.states=s,this.locale=new wt(a,[{label:"Deutsch",value:"de-DE"},{label:"English",value:"en-US"},{label:"עִברִית",value:"he-IL"},{label:"中文",value:"zh-CN"}]),this.ksColumn=n,this.highlighStock=r}load(e,t=!1){g(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.highlighStock.load(e.highlighStock)),this.filters.load(e.filters),this.resources.load(e.resources))}}class Ai extends Q{#e=void 0;get baseBuilding(){return this.#e}#t;get building(){return this.#t}#i=0;get stage(){return this.#i}constructor(e,t=!1,i=-1,s){super(t,i),this.#t=e,s&&(this.#i=1,this.#e=s)}}class Gs extends y{buildings;constructor(e=!0){super(e),this.buildings=this.initBuildings()}initBuildings(){const e={broadcasttower:"amphitheatre",dataCenter:"library",hydroplant:"aqueduct",solarfarm:"pasture",spaceport:"warehouse"},t={};for(const i of gt)i!=="unicornPasture"&&(t[i]=new Ai(i));for(const i of De)t[i]=new Ai(i,!1,-1,e[i]);return t}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class We extends Q{#e;#t;get building(){return this.#e}get variant(){return this.#t}constructor(e,t,i=!1,s=-1){super(i,s),this.#e=e,this.#t=t}}class Zs extends y{buildings;constructor(e=!0){super(e),this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of mt)e[t]=new We(t,O.OrderOfTheSun);for(const t of ft)e[t]=new We(t,O.Cryptotheology);for(const t of pt)e[t]=new We(t,O.Ziggurat);return e.unicornPasture=new We("unicornPasture",O.UnicornPasture),e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class Ks extends Q{#e;get resource(){return this.#e}constructor(e,t=!1,i=-1){super(t,i),this.#e=e}}class Vs extends y{resources;constructor(e=!0){super(e),this.resources=this.initResources()}initResources(){const e={};for(const t of gi)e[t]=new Ks(t);return e}load(e){g(e)||(super.load(e),L(this.resources,e.resources,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class js extends Q{#e;get building(){return this.#e}constructor(e,t=!1,i=-1){super(t,i),this.#e=e}}class Js extends y{buildings;constructor(e=!0){super(e),this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of bt)e[t]=new js(t);return e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class Pi extends Q{#e;#t;get building(){return this.#e}get variant(){return this.#t}constructor(e,t,i=!1,s=-1){super(i,s),this.#e=e,this.#t=t}}class Xs extends y{buildings;constructor(e=!0){super(e),this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of vt)e[t]=new Pi(t,Y.Chronoforge);for(const t of yt)t!=="usedCryochambers"&&(e[t]=new Pi(t,Y.VoidSpace));return e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class Ys extends y{#e;get upgrade(){return this.#e}constructor(e,t=!1){super(t),this.#e=e}}class Qs extends y{upgrades;constructor(e=!1){super(e),this.upgrades=this.initUpgrades()}initUpgrades(){const e={};for(const t of bi)e[t]=new Ys(t);return e}load(e){g(e)||(super.load(e),L(this.upgrades,e.upgrades,(t,i)=>{t.enabled=i?.enabled??t.enabled}))}}class en extends y{bonfire;religion;resources;space;time;upgrades;constructor(e=!0,t=new Gs,i=new Zs,s=new Vs,a=new Js,n=new Xs,r=new Qs){super(e),this.bonfire=t,this.religion=i,this.resources=s,this.space=a,this.time=n,this.upgrades=r}load(e){g(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 tn extends z{cycles;activeHeatTransferStatus;constructor(e=new y){super(!1,1),this.cycles=this.initCycles(),this.activeHeatTransferStatus=e}initCycles(){const e={};for(const t of de)e[t]=new y;return e}load(e){g(e)||(super.load(e),L(this.cycles,e.cycles,(t,i)=>{t.enabled=i?.enabled??t.enabled}),this.activeHeatTransferStatus.load(e.activeHeatTransferStatus))}}class sn extends ys{cycles;seasons;activeHeatTransfer;ignoreOverheat;constructor(e=new y,t=new tn){super(!1,5),this.cycles=this.initCycles(),this.seasons=this.initSeason(),this.activeHeatTransfer=t,this.ignoreOverheat=e}initCycles(){const e={};for(const t of de)e[t]=new y;return e}initSeason(){const e={};for(const t of hs)e[t]=new y;return e}load(e){g(e)||(super.load(e),L(this.cycles,e.cycles,(t,i)=>{t.enabled=i?.enabled??t.enabled}),L(this.seasons,e.seasons,(t,i)=>{t.enabled=i?.enabled??t.enabled}),this.ignoreOverheat.load(e.ignoreOverheat),this.activeHeatTransfer.load(e.activeHeatTransfer))}}class Bi extends y{accelerateTime;timeSkip;reset;constructor(e=!1,t=new z(!1,1),i=new en,s=new sn){super(e),this.accelerateTime=t,this.reset=i,this.timeSkip=s}load(e){g(e)||(super.load(e),this.accelerateTime.load(e.accelerateTime),this.reset.load(e.reset),this.timeSkip.load(e.timeSkip))}}class Ii extends qe{#e;#t;get building(){return this.#e}get variant(){return this.#t}constructor(e,t,i=!1){super(i,-1,0),this.#e=e,this.#t=t}}class $i extends z{buildings;fixCryochambers;constructor(e=!1,t=-1,i=new y){super(e,t),this.buildings=this.initBuildings(),this.fixCryochambers=i}initBuildings(){const e={};for(const t of vt)e[t]=new Ii(t,Y.Chronoforge);for(const t of yt)t!=="usedCryochambers"&&(e[t]=new Ii(t,Y.VoidSpace));return e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max,t.trigger=i?.trigger??t.trigger}),this.fixCryochambers.load(e.fixCryochambers))}}class nn extends yi{#e;get race(){return this.#e}constructor(e,t=!1){super(t),this.#e=e}}class an extends z{races;constructor(e=!1){super(e),this.races=this.initRaces()}initRaces(){const e={};for(const t of fi)t!=="leviathans"&&(e[t]=new nn(t));return e}load(e){g(e)||(super.load(e),L(this.races,e.races,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max}))}}class rn extends vs{#e;seasons;#t;get race(){return this.#e}get require(){return this.#t}constructor(e,t,i,s,a,n,r,c=!1){super(t,i),this.#e=e,this.seasons={autumn:new y(a),spring:new y(r),summer:new y(s),winter:new y(n)},this.#t=c}}class Li extends z{races;feedLeviathans;buildEmbassies;tradeBlackcoin;unlockRaces;constructor(e=!1,t=-1,i=new an,s=new y,a=new ws(!1,1090,1095,1e4),n=new y){super(e,t),this.races=this.initRaces(),this.buildEmbassies=i,this.feedLeviathans=s,this.tradeBlackcoin=a,this.unlockRaces=n}initRaces(){const e={dragons:"titanium",griffins:"wood",leviathans:"unobtainium",lizards:"minerals",sharks:"iron"},t={};for(const i of fi){const s=e[i]??!1;t[i]=new rn(i,!1,!1,!1,!1,!1,!1,s)}return t}load(e){g(e)||(super.load(e),L(this.races,e.races,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.limited=i?.limited??t.limited,t.trigger=i?.trigger??t.trigger,t.seasons.autumn.enabled=i?.seasons.autumn.enabled??t.seasons.autumn.enabled,t.seasons.spring.enabled=i?.seasons.spring.enabled??t.seasons.spring.enabled,t.seasons.summer.enabled=i?.seasons.summer.enabled??t.seasons.summer.enabled,t.seasons.winter.enabled=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 on extends y{job;trait;constructor(e=!1,t=new wt("any",mi.map(s=>({label:"",value:s}))),i=new wt("none",us.map(s=>({label:"",value:s})))){super(e),this.job=t,this.trait=i}load(e){g(e)||(super.load(e),this.job.load(e.job),this.trait.load(e.trait))}}class Oi extends y{jobs;holdFestivals;hunt;promoteKittens;promoteLeader;electLeader;constructor(e=!1,t=new y,i=new z(!1,.98),s=new z(!1,1),a=new y,n=new on){super(e),this.jobs=this.initJobs(),this.holdFestivals=t,this.hunt=i,this.promoteKittens=s,this.promoteLeader=a,this.electLeader=n}initJobs(){const e={};for(const t of mi)e[t]=new yi(!1,0);return e}load(e){g(e)||(super.load(e),L(this.jobs,e.jobs,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max}),this.holdFestivals.enabled=e.holdFestivals?.enabled??this.holdFestivals.enabled,this.hunt.load(e.hunt),this.promoteKittens.enabled=e.promoteKittens?.enabled??this.promoteKittens.enabled,this.promoteLeader.enabled=e.promoteLeader?.enabled??this.promoteLeader.enabled,this.electLeader.load(e.electLeader))}}class ln{_host;settings;_religionManager;_workshopManager;constructor(e,t,i,s,a=new Bi){this._host=e,this.settings=a,this._religionManager=i,this._workshopManager=s}async tick(e){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(e){if(this._host.game.challenges.currentChallenge)return;const t=[];for(const[a,n]of P(this.settings.reset.bonfire.buildings)){if(!n.enabled)continue;if(n.trigger<0)return;let r;try{r=this._host.game.bld.getBuildingExt(a)}catch{r=null}if(!g(r)&&(t.push({name:r.meta.label??p(r.meta.stages)[p(r.meta.stage)].label,trigger:n.trigger,val:r.meta.val}),r.meta.val<n.trigger))return}const i=this.settings.reset.religion.buildings.unicornPasture;if(i.enabled){if(i.trigger<0)return;const a=this._host.game.bld.getBuildingExt("unicornPasture");if(t.push({name:p(a.meta.label),trigger:i.trigger,val:a.meta.val}),a.meta.val<i.trigger)return}for(const[a,n]of P(this.settings.reset.space.buildings)){if(!n.enabled)continue;if(n.trigger<0)return;const r=this._host.game.space.getBuilding(a);if(t.push({name:r.label,trigger:n.trigger,val:r.val}),r.val<n.trigger)return}for(const[a,n]of P(this.settings.reset.religion.buildings)){if(!n.enabled)continue;if(n.trigger<0)return;const r=p(this._religionManager.getUpgradeMeta(a,n.variant));if(t.push({name:r.label,trigger:n.trigger,val:r.val}),r.val<n.trigger)return}for(const[a,n]of P(this.settings.reset.time.buildings)){if(!n.enabled)continue;if(n.trigger<0)return;const r=p(this.getBuild(a,n.variant));if(t.push({name:r.label,trigger:n.trigger,val:r.val}),r.val<n.trigger)return}for(const[a,n]of P(this.settings.reset.resources.resources)){if(!n.enabled)continue;if(n.trigger<0)return;const r=p(this._host.game.resPool.get(a));if(t.push({name:this._host.engine.i18n(`$resources.${n.resource}.title`),trigger:n.trigger,val:r.value}),r.value<n.trigger)return}for(const[,a]of P(this.settings.reset.upgrades.upgrades))if(a.enabled){const n=p(this._host.game.workshop.upgrades.find(r=>r.name===a.upgrade));if(t.push({name:n.label,trigger:1,val:n.researched?1:0}),!n.researched)return}if(t.length===0)return;e.stop(!1);const s=async(a=1500)=>new Promise((n,r)=>{if(!this._host.engine.settings.enabled){r(new Error("canceled by player"));return}setTimeout(n,a)});try{for(const a of t)await s(500),this._host.engine.imessage("reset.check",[a.name,this._host.game.getDisplayValueExt(a.trigger),this._host.game.getDisplayValueExt(a.val)]);await s(0),this._host.engine.imessage("reset.checked"),await s(),this._host.engine.iactivity("reset.tip"),await s(),this._host.engine.imessage("reset.countdown.10"),await s(2e3),this._host.engine.imessage("reset.countdown.9"),await s(),this._host.engine.imessage("reset.countdown.8"),await s(),this._host.engine.imessage("reset.countdown.7"),await s(),this._host.engine.imessage("reset.countdown.6"),await s(),this._host.engine.imessage("reset.countdown.5"),await s(),this._host.engine.imessage("reset.countdown.4"),await s(),this._host.engine.imessage("reset.countdown.3"),await s(),this._host.engine.imessage("reset.countdown.2"),await s(),this._host.engine.imessage("reset.countdown.1"),await s(),this._host.engine.imessage("reset.countdown.0"),await s(),this._host.engine.iactivity("reset.last.message"),await s()}catch{this._host.engine.imessage("reset.cancel.message"),this._host.engine.iactivity("reset.cancel.activity");return}for(let a=0;a<this._host.game.challenges.challenges.length;a++)this._host.game.challenges.challenges[a].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 t=this._host.game.resPool.get("temporalFlux");t.maxValue*this.settings.accelerateTime.trigger<=t.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 e=this._host.game.getEffect("shatterCostIncreaseChallenge"),t=this._workshopManager.getValueAvailable("timeCrystal");if(t<this.settings.timeSkip.trigger||t<1+e)return;const i=this._host.game.getEffect("shatterVoidCost"),s=this._workshopManager.getValueAvailable("void");if(s<i)return;const a=this._host.game.calendar.season;if(!this.settings.timeSkip.seasons[this._host.game.calendar.seasons[a].name].enabled)return;const n=this._host.game.calendar.cycle;if(!this.settings.timeSkip.cycles[de[n]].enabled)return;const r=this._host.game.getEffect("heatMax"),c=this._host.game.time.heat;if(!this.settings.timeSkip.ignoreOverheat.enabled&&r<=c)return;const o=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 R=this._host.game.getEffect("heatPerTick"),Z=this._host.game.ticksPerSecond;if(this.settings.timeSkip.activeHeatTransfer.activeHeatTransferStatus.enabled){c<=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 ce=this._host.game.getEffect("temporalFluxProduction"),j=(this._host.game.calendar.daysPerSeason+10+this._host.game.getEffect("temporalParadoxDay"))*this._host.game.calendar.seasonsPerYear,re=this._host.game.calendar.ticksPerDay,pe=(1+this._host.game.timeAccelerationRatio())/re,oe=j/pe,be=this._host.game.resPool.get("temporalFlux"),Ce=be.maxValue>oe,nt=be.value<oe;if(!a&&this._host.game.calendar.day<10&&ce>o/R&&this.settings.accelerateTime.enabled&&Ce&&nt)h=Math.ceil((oe+re*10-be.value)/ce),this._host.engine.iactivity("act.time.getTemporalFlux",[],"ks-timeSkip"),this._host.engine.storeForSummary("time.getTemporalFlux",1);else{if(this.settings.timeSkip.activeHeatTransfer.cycles[de[n]].enabled)return;h=this._host.game.calendar.yearsPerCycle-this._host.game.calendar.cycleYear}}else c>=r-R*Z*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 u=G(this.settings.timeSkip.max);let d=Math.floor(Math.min(this.settings.timeSkip.ignoreOverheat.enabled?Number.POSITIVE_INFINITY:(r-c)/o,u,h,t/(1+e),0<i?s/i:Number.POSITIVE_INFINITY)),m=0;const v=this._host.game.calendar.yearsPerCycle,b=v-this._host.game.calendar.cycleYear,S=this._host.game.calendar.cyclesPerEra;if(d<b)m=d;else{m+=b,d-=b;let R=1;for(;v<d&&this.settings.timeSkip.cycles[de[(n+R)%S]].enabled;)m+=v,d-=v,R+=1;this.settings.timeSkip.cycles[de[(n+R)%S]].enabled&&0<d&&(m+=d)}if(0<m){const R=new classes.ui.time.ShatterTCBtnController(this._host.game),Z=R.fetchModel({});R.doShatterAmt(Z,m),this._host.engine.iactivity("act.time.skip",[m],"ks-timeSkip"),this._host.engine.storeForSummary("time.skip",m)}}getBuild(e,t){return t===Y.Chronoforge?this._host.game.time.getCFU(e):this._host.game.time.getVSU(e)}}class cn{_host;settings;_bulkManager;_workshopManager;constructor(e,t,i=new $i){this._host=e,this.settings=i,this._bulkManager=new xe(this._host,t),this._workshopManager=t}tick(e){this.settings.enabled&&(this._bulkManager.resetPriceCache(),this.autoBuild(e),this.settings.fixCryochambers.enabled&&this.fixCryochambers())}autoBuild(e,t=this.settings.buildings){const i=this.settings.trigger,s={};for(const n of Object.values(t)){const r=n.variant===Y.Chronoforge?this._host.game.time.getCFU(n.building):this._host.game.time.getVSU(n.building);s[n.building]=p(r);const c=n.variant===Y.Chronoforge?this._host.game.time.queue.getQueueElementControllerAndModel({name:n.building,type:"chronoforge"}):this._host.game.time.queue.getQueueElementControllerAndModel({name:n.building,type:"voidSpace"}),o=n.variant===Y.Chronoforge?this._host.game.workshop.get("chronoforge").researched:this._host.game.science.get("voidSpace").researched||this._host.game.time.getVSU("usedCryochambers").val>0,h=c.model,u=p(s[n.building]);u.tHidden=!h.metadata.unlocked||!o}const a=n=>{this.build(n.id,n.variant,n.count)};e.purchaseOrders.push({builder:a,builds:t,metaData:s,sectionTrigger:i})}build(e,t,i){let s=0,a;if(t===Y.Chronoforge){const n=game.getUnlockByName(e,"chronoforge"),r=new classes.ui.time.ChronoforgeBtnController(this._host.game),c=r.fetchModel({controller:r,id:n.name});s=this._bulkManager.construct(c,r,i),a=n.label}else{const n=game.getUnlockByName(e,"voidSpace"),r=new classes.ui.time.VoidSpaceBtnController(this._host.game),c=r.fetchModel({controller:r,id:n.name});s=this._bulkManager.construct(c,r,i),a=n.label}i!==s&&(console.warn(...f(`${a} Amount ordered: ${i} Amount Constructed: ${s}`)),s===0)||(this._host.engine.storeForSummary(a,s,"build"),s===1?this._host.engine.iactivity("act.build",[a],"ks-build"):this._host.engine.iactivity("act.builds",[a,this._host.renderAbsolute(s)],"ks-build"))}getBuild(e,t){return t===Y.Chronoforge?this._host.game.time.getCFU(e):this._host.game.time.getVSU(e)}fixCryochambers(){if(this._host.game.time.getVSU("usedCryochambers").val<1)return;const e=p(this._host.game.time.getVSU("usedCryochambers").fixPrices);for(const n of e)if(this._workshopManager.getValueAvailable(n.name)<n.val)return;const t=new classes.ui.time.FixCryochamberBtnController(this._host.game),i=t.fetchModel({});let s=0,a;do a=!1,a=t.buyItem(i).itemBought,s+=a?1:0;while(a);0<s&&(this._host.engine.iactivity("act.fix.cry",[this._host.renderAbsolute(s)],"ks-fixCry"),this._host.engine.storeForSummary("fix.cry",s))}}class hn{_host;settings;_workshopManager;constructor(e,t,i=new Li){this._host=e,this.settings=i,this._workshopManager=t}tick(e){this.settings.enabled&&(this.autoTrade(),this.settings.unlockRaces.enabled&&this.autoUnlock(e),this.settings.buildEmbassies.enabled&&this.autoBuildEmbassies(e),this.settings.feedLeviathans.enabled&&this.autoFeedElders(),this.settings.tradeBlackcoin.enabled&&this.autoTradeBlackcoin())}autoTrade(e){const t=this._workshopManager.getResource("manpower"),i=this._workshopManager.getResource("gold"),s=this.settings.trigger,a=[],n=this._host.game.calendar.getCurSeason().name;for(const u of Object.values(this.settings.races)){const d=this.getRace(u.race),m=ee.evaluateSubSectionTrigger(s,u.trigger);if(m<0||!u.enabled||!u.seasons[n].enabled||!d.unlocked||!this.singleTradePossible(s,t,i,u))continue;const v=u.require?this._workshopManager.getResource(u.require):!1,b=this.getProfitability(u.race);(u.limited&&b||!v||m<=v.value/v.maxValue)&&a.push(u.race)}if(a.length===0)return;let r=this.getLowestTradeAmount(null,!0,!1);if(r<1)return;const c=[];for(let u=0;u<a.length;u++){const d=a[u],m=this.settings.races[d],v=m.require?this._workshopManager.getResource(m.require):!1,b=ee.evaluateSubSectionTrigger(s,m.trigger),S=(!v||b<=v.value/v.maxValue)&&b<=i.value/i.maxValue,R=this.getLowestTradeAmount(d,m.limited,S);if(R<1){a.splice(u,1),u--;continue}c.push(R)}if(a.length===0)return;const o={};for(;0<a.length&&1<=r;){if(r<a.length){const v=Math.floor(Math.random()*a.length),b=a[v];g(o[b])&&(o[b]=0),o[b]+=1,r-=1,a.splice(v,1),c.splice(v,1);continue}let u=Math.floor(r/a.length),d=0;const m=a[d];for(let v=0;v<a.length;++v)c[v]<u&&(u=c[v],d=v);g(o[m])&&(o[m]=0),o[m]+=u,r-=u,a.splice(d,1),c.splice(d,1)}if(Object.values(o).length===0)return;const h={};for(const[u,d]of P(o)){const m=this.getRace(u),v=this.getMaterials(u);for(const[S,R]of P(v))h[S]||(h[S]=0),h[S]-=R*d;const b=this.getAverageTrade(m);for(const[S,R]of P(b)){const Z=this._workshopManager.getResource(S);h[S]||(h[S]=0),h[S]+=Z.maxValue>0?Math.min(p(b[S])*p(o[u]),Math.max(Z.maxValue-Z.value,0)):R*p(o[u])}}g(e)||e.pushToCache({materials:h,timeStamp:this._host.game.timer.ticksTotal});for(const[u,d]of P(o))0<d&&this.trade(u,d)}autoBuildEmbassies(e){if(!this._host.game.diplomacy.races[0].embassyPrices)return;const t=this._workshopManager.getResource("culture");let i=0;const s=this.settings.buildEmbassies.trigger;if(t.value/t.maxValue<G(s))return;i=this._workshopManager.getValueAvailable("culture");const a={},n=[];for(const r of this._host.game.diplomacy.races){const c=r.name;if(!(c in this.settings.buildEmbassies.races))continue;const o=G(this.settings.buildEmbassies.races[c].max);!this.settings.buildEmbassies.races[c].enabled||o<=r.embassyLevel||!r.unlocked||(a[c]={basePrice:p(r.embassyPrices?.[0]).val,currentEm:r.embassyLevel,max:o,priceSum:0,race:r,val:0},n.push(c))}if(n.length!==0){for(;n.length>0;)for(let r=0;r<n.length;r++){const c=n[r],o=p(a[c]);if(o.max<=o.currentEm+o.val){n.splice(r,1),--r;continue}const h=o.basePrice*1.15**(o.currentEm+o.val);h<=i?(i-=h,o.priceSum+=h,o.val+=1,e.requestGameUiRefresh=!0):(n.splice(r,1),--r)}for(const[,r]of P(a))r.val!==0&&(i=this._workshopManager.getValueAvailable("culture"),i<r.priceSum&&console.warn(...f("Something has gone horribly wrong.",r.priceSum,i)),this._workshopManager.getResource("culture").value-=r.priceSum,r.race.embassyLevel+=r.val,this._host.engine.storeForSummary("embassy",r.val),r.val!==1?this._host.engine.iactivity("build.embassies",[r.val,r.race.title],"ks-build"):this._host.engine.iactivity("build.embassy",[r.val,r.race.title],"ks-build"))}}autoFeedElders(){const e=this._host.game.diplomacy.get("leviathans"),t=this._host.game.resPool.get("necrocorn");!e.unlocked||t.value===0||(1<=t.value?e.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",t.value),this._host.game.diplomacy.feedElders(),this._host.engine.iactivity("dispose.necrocorn")))}autoUnlock(e){if(!this._host.game.tabs[4].visible)return;const t=this._host.game.diplomacy.get("leviathans").unlocked?8:7;if(this._host.game.diplomacyTab.racePanels.length<t){let i=this._workshopManager.getValueAvailable("manpower");if(!this._host.game.diplomacy.get("lizards").unlocked&&i>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("sharks").unlocked&&i>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("griffins").unlocked&&i>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("nagas").unlocked&&this._host.game.resPool.get("culture").value>=1500&&i>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("zebras").unlocked&&this._host.game.resPool.get("ship").value>=1&&i>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.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&&i>=1e3){p(this._host.game.resPool.get("manpower")).value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("dragons").unlocked&&this._host.game.science.get("nuclearFission").researched&&i>=1e3){p(this._host.game.resPool.get("manpower")).value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}}}autoTradeBlackcoin(){const e=this._host.game.calendar.cryptoPrice,t=this._host.game.resPool.get("relic").value,i=this._host.game.resPool.get("blackcoin").value;let s=0,a=0;if(e<this.settings.tradeBlackcoin.buy&&this.settings.tradeBlackcoin.trigger<t){this._host.game.diplomacy.buyBcoin();const n=this._host.game.resPool.get("blackcoin").value;s=Math.round(n-i),this._host.engine.iactivity("act.blackcoin.buy",[this._host.renderAbsolute(s)])}else if(e>this.settings.tradeBlackcoin.sell&&0<this._host.game.resPool.get("blackcoin").value){this._host.game.diplomacy.sellBcoin();const n=p(this._host.game.resPool.get("relic")).value;a=Math.round(n-t),this._host.engine.iactivity("act.blackcoin.sell",[this._host.renderAbsolute(a)])}}trade(e,t){const i=this.getRace(e);this._host.game.diplomacy.tradeMultiple(i,t),this._host.engine.storeForSummary(i.title,t,"trade"),this._host.engine.iactivity("act.trade",[this._host.renderAbsolute(t),W(i.title)],"ks-trade")}getProfitability(e){const t=this.getRace(e);let i=0;const s=this.getMaterials(e);for(const[r,c]of P(s)){const o=this._workshopManager.getTickVal(this._workshopManager.getResource(r));if(o!=="ignore"){if(o<=0)return!1;i+=c/o}}let a=0;const n=this.getAverageTrade(t);for(const[r,c]of P(n)){const o=this._workshopManager.getResource(r),h=this._workshopManager.getTickVal(o);if(h!=="ignore"){if(h<=0)return!0;a+=0<o.maxValue?Math.min(c,Math.max(o.maxValue-o.value,0))/h:c/h}}return i<=a}getAverageTrade(e){const t=this._host.game.getEffect("standingRatio")+this._host.game.diplomacy.calculateStandingFromPolicies(e.name,this._host.game),i=1+e.energy*.02,s=1+this._host.game.diplomacy.getTradeRatio()+this._host.game.diplomacy.calculateTradeBonusFromPolicies(e.name,this._host.game),a=e.standing<0?e.standing+t:0,n=0<a?1+a:1,r=0<e.standing?Math.min(e.standing+t/2,1):0,c={};for(const u of e.sells){if(!this._isValidTrade(u,e)){c[u.name]=0;continue}let d=0;const m=e.embassyPrices?u.chance*(1+this._host.game.getLimitedDR(.01*e.embassyLevel,.75)):u.chance;if(e.name==="zebras"&&u.name==="titanium"){const v=this._host.game.resPool.get("ship").value,b=Math.min(.15+v*.0035,1);d=1.5*(1+v/50)*(n*b)}else{const v=u.seasons?1+u.seasons[this._host.game.calendar.getCurSeason().name]:1,b=(n-r)*Math.min(m/100,1),S=r*Math.min(m/100,1);d=(b+1.25*S)*u.value*i*v*s}c[u.name]=d}const o=e.embassyPrices?.35*(1+.01*e.embassyLevel):.35,h=n*Math.min(o,1);return c.spice=25*h+50*h*s/2,c.blueprint=.1*n,c}_isValidTrade(e,t){return!(e.minLevel&&t.embassyLevel<e.minLevel)&&(this._host.game.resPool.get(e.name).unlocked||e.name==="titanium"||e.name==="uranium"||t.name==="leviathans")}getLowestTradeAmount(e,t,i){let s;const a=this.getMaterials(e);let n;for(const[h,u]of P(a)){if(h==="manpower"){let d=u;this._host.game.challenges.isActive("postApocalypse")&&(d=u*(1+this._host.game.bld.getPollutionLevel())),n=this._workshopManager.getValueAvailable(h)/d}else if(h==="gold"){let d=u;this._host.game.challenges.isActive("postApocalypse")&&(d=u*(1+this._host.game.bld.getPollutionLevel())),n=this._workshopManager.getValueAvailable(h)/d}else n=this._workshopManager.getValueAvailable(h)/u;s=s===void 0||n<s?n:s}if(s=Math.floor(s??0),s===0)return 0;if(e===null||e==="leviathans")return s;const r=this.getRace(e);let c=0;const o=this.getAverageTrade(r);for(const h of r.sells){const u=this._workshopManager.getResource(h.name);let d=0;if(!u.maxValue)continue;d=p(o[h.name]);const m=Math.max((u.maxValue-u.value)/d,0);c=m<c?c:m}return c=Math.ceil(c),c===0?0:(s=c<s?Math.max(c-1,1):s,Math.floor(s))}getMaterials(e=null){const t={gold:15-this._host.game.getEffect("tradeGoldDiscount"),manpower:50-this._host.game.getEffect("tradeCatpowerDiscount")};if(g(e))return t;const i=this.getRace(e).buys;for(const s of i)t[s.name]=s.val;return t}getRace(e){const t=this._host.game.diplomacy.get(e);if(g(t))throw new Error(`Unable to retrieve race \'${e}\'`);return t}singleTradePossible(e,t,i,s){const a=s?ee.evaluateSubSectionTrigger(e,s.trigger):e;if(a<0&&s===void 0)return!0;if(a<0&&s!==void 0||t.value/t.maxValue<a||i.value/i.maxValue<a)return!1;const n=this.getMaterials(s?.race);for(const[r,c]of P(n))if(this._workshopManager.getValueAvailable(r)<c)return!1;return!0}}class un{_host;_cache=new Array;_cacheSum={};constructor(e){this._host=e}pushToCache(e){this._cache.push(e);for(const[t,i]of P(e.materials))this._cacheSum[t]||(this._cacheSum[t]=0),this._cacheSum[t]+=i;for(let t=0;t<this._cache.length;++t){const i=this._cache[t];if(this._cache.length>1e4){const s=i.materials;for(const[a,n]of P(s))this._cacheSum[a]||(this._cacheSum[a]=0),this._cacheSum[a]-=n;this._cache.shift(),t--}else return}}getResValue(e){if(this._cache.length===0||!this._cacheSum[e])return 0;const t=this._host.game.timer.ticksTotal,i=this._cache[0].timeStamp;return this._cacheSum[e]/(t-i)}}class dn{_host;settings;_cacheManager;_workshopManager;constructor(e,t,i=new Oi){this._host=e,this.settings=i,this._cacheManager=new un(this._host),this._workshopManager=t}tick(e){this.settings.enabled&&(this.autoDistributeKittens(e),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(e){const t=this._host.game.village.getFreeKittens();if(t){for(let i=0;i<t;++i){const s=new Array;for(const r of this._host.game.village.jobs){const c=this.settings.jobs[r.name].enabled,o=r.unlocked;if(!c||!o)continue;const h=this._host.game.village.getJobLimit(r.name),u=G(this.settings.jobs[r.name].max),d=r.value;d<h&&d<u&&s.push({count:d,job:r,toCap:h-d})}if(!s.length)return;const a=!g(s.find(r=>r.job.name==="farmer"&&r.count===0));s.sort((r,c)=>r.count-c.count);const n=a?"farmer":s[0].job.name;this._host.game.village.assignJob(this._host.game.village.getJob(n),1),e.requestGameUiRefresh=!0,this._host.engine.iactivity("act.distribute",[this._host.engine.i18n(`$village.job.${n}`)],"ks-distribute")}this._host.engine.storeForSummary("distribute",t)}}autoElect(){if(this._host.game.challenges.isActive("anarchy"))return;const e=this._host.game.village.sim.kittens,t=this._host.game.village.leader,i=this.settings.electLeader.job.selected,s=this.settings.electLeader.trait.selected,a=e.filter(r=>(r.job===i||i==="any")&&r.trait.name===s);if(a.length===0)return;a.sort((r,c)=>c.rank-r.rank);const n=a[0];!g(t)&&t.trait.name===s&&(t.job===i||i==="any")&&n.rank<=t.rank||(this._host.game.village.makeLeader(n),this._host.engine.iactivity("act.elect"))}autoPromoteKittens(){const e=this._workshopManager.getResource("gold");if(!(this.settings.promoteKittens.trigger<e.value/e.maxValue))for(let t=0;t<this._host.game.village.sim.kittens.length;t++){let i=-1;const s=this._host.game.village.sim.kittens[t].engineerSpeciality;if(!g(s)&&(i=p(this._host.game.workshop.getCraft(s)).tier,!(i<=this._host.game.village.sim.kittens[t].rank))){this._host.game.village.promoteKittens();return}}}autoPromoteLeader(){if(this._host.game.science.get("civil").researched&&this._host.game.village.leader!==null){const e=this._host.game.village.leader,t=e.rank,i=this._workshopManager.getResource("gold"),s=this._workshopManager.getStock("gold");this._host.game.village.sim.goldToPromote(t,t+1,i.value-s)[0]&&this._host.game.village.sim.promote(e,t+1)===1&&(this._host.engine.iactivity("act.promote",[t+1],"ks-promote"),this._host.game.villageTab.censusPanel?.census.renderGovernment(this._host.game.villageTab.censusPanel.census.container),this._host.game.villageTab.censusPanel?.census.update(),this._host.engine.storeForSummary("promote",1))}}autoHunt(e){const t=this._workshopManager.getResource("manpower"),i=this.settings.hunt.trigger;if(t.value<100||i>t.value/t.maxValue||this._host.game.challenges.isActive("pacifism"))return;const s=Math.floor(t.value/100);this._host.engine.storeForSummary("hunt",s);const a=this._workshopManager.getAverageHunt(),n={};for(const[r,c]of P(a)){const o=this._workshopManager.getResource(r);n[r]=0<o.maxValue?Math.min(c*s,Math.max(o.maxValue-o.value,0)):c*s}g(e)||e.pushToCache({materials:n,timeStamp:this._host.game.timer.ticksTotal}),this._host.game.village.huntAll(),this._host.engine.iactivity("act.hunt",[this._host.renderAbsolute(s)],"ks-hunt")}autoFestival(e){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 t=this._workshopManager;if(t.getValueAvailable("manpower")<1500||t.getValueAvailable("culture")<5e3||t.getValueAvailable("parchment")<2500)return;const i=4e3*t.getTickVal(t.getResource("manpower"),e,!0)>1500,s=4e3*t.getTickVal(t.getResource("culture"),e,!0)>5e3,a=4e3*t.getTickVal(t.getResource("parchment"),e,!0)>2500;if(!i&&!s&&!a)return;const n=this._host.game.calendar.festivalDays,r=new classes.village.ui.FestivalButtonController(this._host.game),c=r.fetchModel({controller:r,description:"",handler:()=>{this._host.game.village.holdFestival(1)},name:"",prices:[{name:"manpower",val:1500},{name:"culture",val:5e3},{name:"parchment",val:2500}]});r.buyItem(c),this._host.engine.storeForSummary("festival"),n>0?this._host.engine.iactivity("festival.extend",[],"ks-festival"):this._host.engine.iactivity("festival.hold",[],"ks-festival")}}const Ui={"de-DE":Ts,"en-US":xs,"he-IL":Es,"zh-CN":Ms};class ee{_i18nData;_isLoaded=!1;get isLoaded(){return this._isLoaded}_host;settings;bonfireManager;religionManager;scienceManager;spaceManager;timeControlManager;timeManager;tradeManager;villageManager;workshopManager;_activitySummary;_bulkManager;_timeoutMainLoop=void 0;constructor(e,t){this.settings=new Ri,this._i18nData=Ui,this.setLanguage(t,!1),this._host=e,this._activitySummary=new Ss(this._host),this.workshopManager=new Mi(this._host),this._bulkManager=new xe(this._host,this.workshopManager),this.bonfireManager=new Cs(this._host,this.workshopManager),this.religionManager=new Rs(this._host,this.bonfireManager,this.workshopManager),this.scienceManager=new Ls(this._host,this.workshopManager),this.spaceManager=new Ds(this._host,this.workshopManager),this.timeControlManager=new ln(this._host,this.bonfireManager,this.religionManager,this.workshopManager),this.timeManager=new cn(this._host,this.workshopManager),this.tradeManager=new hn(this._host,this.workshopManager),this.villageManager=new dn(this._host,this.workshopManager)}isLanguageSupported(e){return Object.keys(this._i18nData).some(t=>t.startsWith(`${e}-`))}isLocaleSupported(e){return e in this._i18nData}localeSupportsFirstLetterSplits(e=this.settings.locale.selected){return e!=="zh-CN"}localeForLanguage(e){return Object.keys(this._i18nData).find(t=>t.startsWith(`${e}-`))}setLanguage(e,t=!0){const i=this.settings.locale.selected;if(!this.isLanguageSupported(e))console.warn(...f(`Requested language \'${e}\' is not available. Falling back to \'${we}\'.`)),this.settings.locale.selected=we;else{const s=p(this.localeForLanguage(e));console.info(...f(`Selecting language \'${s}\'.`)),this.settings.locale.selected=s}i!==this.settings.locale.selected&&t&&this._host.rebuildUi()}setLocale(e,t=!0){const i=this.settings.locale.selected;this.isLocaleSupported(e)?(console.info(...f(`Selecting language \'${e}\'.`)),this.settings.locale.selected=e):(console.warn(...f(`Requested language \'${e}\' is not available. Falling back to \'${we}\'.`)),this.settings.locale.selected=we),i!==this.settings.locale.selected&&t&&this._host.rebuildUi()}stateLoad(e,t=!1){this._isLoaded=!0,this.stop(!1);const i=Pe();e.v!==i&&console.warn(...f(`Attempting to load engine state with version tag \'${e.v}\' when engine is at version \'${i}\'!`));const s=(a,n)=>{try{a()}catch(r){console.error(...f(`Failed load of ${n} settings.`,r))}};s(()=>{this.settings.load(e.engine,t)},"engine"),s(()=>{this.bonfireManager.settings.load(e.bonfire)},"bonfire"),s(()=>{this.religionManager.settings.load(e.religion)},"religion"),s(()=>{this.scienceManager.settings.load(e.science)},"science"),s(()=>{this.spaceManager.settings.load(e.space)},"space"),s(()=>{this.timeControlManager.settings.load(e.timeControl)},"time control"),s(()=>{this.timeManager.settings.load(e.time)},"time"),s(()=>{this.tradeManager.settings.load(e.trade)},"trade"),s(()=>{this.villageManager.settings.load(e.village)},"village"),s(()=>{this.workshopManager.settings.load(e.workshop)},"workshop"),this.setLocale(this.settings.locale.selected),this.settings.enabled?this.start(!1):this.stop(!1)}static get DEFAULT_STATE(){return{bonfire:new _t,engine:new Ri,religion:new Ct,science:new St,space:new He,time:new $i,timeControl:new Bi,trade:new Li,v:Pe(),village:new Oi,workshop:new Fe}}stateReset(){this.stateLoad(ee.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:Pe(),village:this.villageManager.settings,workshop:this.workshopManager.settings}}start(e=!0){if(this._timeoutMainLoop)return;const t=()=>{const i={entry:Date.now(),exit:0,measurements:{},priceCacheHits:0,priceCacheMisses:0,purchaseOrders:[],requestGameUiRefresh:!1};this._iterate(i).then(()=>{i.exit=Date.now();const s=i.exit-i.entry;document.dispatchEvent(new CustomEvent("ks.reportFrame",{detail:i})),this._timeoutMainLoop!==void 0&&(this._timeoutMainLoop=C.window.setTimeout(t,Math.max(10,this._host.engine.settings.interval-s)))}).catch(s=>{console.warn(...f(ls(s)))})};this._timeoutMainLoop=C.window.setTimeout(t,this._host.engine.settings.interval),e&&this._host.engine.imessage("status.ks.enable")}stop(e=!0){this._timeoutMainLoop&&(clearTimeout(this._timeoutMainLoop),this._timeoutMainLoop=void 0,e&&this._host.engine.imessage("status.ks.disable"))}async _iterate(e){this.settings.filters.enabled&&this._maintainKGLogFilters();let[,t]=await Oe(()=>this.scienceManager.tick(e));e.measurements.scienceManager=t,[,t]=X(()=>{this.bonfireManager.tick(e)}),e.measurements.bonfireManager=t,[,t]=X(()=>{this.spaceManager.tick(e)}),e.measurements.spaceManager=t,[,t]=await Oe(()=>this.workshopManager.tick(e)),e.measurements.workshopManager=t,[,t]=X(()=>{this.tradeManager.tick(e)}),e.measurements.tradeManager=t,[,t]=await Oe(()=>this.religionManager.tick(e)),e.measurements.religionManager=t,[,t]=X(()=>{this.timeManager.tick(e)}),e.measurements.timeManager=t,[,t]=X(()=>{this.villageManager.tick(e)}),e.measurements.villageManager=t,[,t]=await Oe(()=>this.timeControlManager.tick(e)),e.measurements.timeControlManager=t,[,t]=X(()=>{if(0<e.purchaseOrders.length){const[{builds:i,metaData:s},a]=X(()=>{const o={...e.purchaseOrders[0].builds};let h={...e.purchaseOrders[0].metaData};for(const u of e.purchaseOrders){for(const[d,m]of P(u.builds))o[d]={...m,baseBuilding:m.baseBuilding,builder:u.builder,building:m.building,sectionTrigger:u.sectionTrigger,stage:m.stage,variant:m.variant};h={...h,...u.metaData}}return this._bulkManager.resetPriceCache(),{builds:o,metaData:h}}),[n,r]=X(()=>this._bulkManager.bulk(i,s)),[,c]=X(()=>{for(const o of n.filter(h=>0<h.count))o.builder(o),e.requestGameUiRefresh=!0});e.priceCacheHits=this._bulkManager.cacheHits,e.priceCacheMisses=this._bulkManager.cacheMisses,e.measurements.bulkPurchaseInit=a,e.measurements.bulkPurchaseCalc=r,e.measurements.bulkPurchaseExec=c}}),e.measurements.bulkPurchaseTotal=t,[,t]=X(()=>{e.requestGameUiRefresh&&!document.hidden&&this._host.game.ui.render()}),e.measurements.gameUiRefresh=t}_maintainKGLogFilters(){for(const[e,t]of P(this.settings.filters.filtersGame))if(this._host.game.console.filters[e].enabled!==t.enabled){this._host.game.console.filters[e].unlocked=!0,this._host.game.console.filters[e].enabled=t.enabled;const i=C.window.document.querySelector(`#filter-${e}`);if(i===null)continue;i.checked=t.enabled}}symbolForCycle(e){return this._host.game.calendar.cycles.find(t=>t.name===e)?.uglyph??""}labelForCycle(e){const t=this.symbolForCycle(e),i=this._host.engine.i18n(`$space.planet.${e==="redmoon"?"moon":e}.label`);return`${t} ${i}`}labelForPlanet(e){const t=e==="moon"?"redmoon":e,i=de.includes(t)?t:void 0,s=this._host.engine.i18n(`$space.planet.${e}.label`);return i===void 0?s:`${this.symbolForCycle(i)} ${s}`}i18n(e,t=[]){let i;if(e.startsWith("$")&&(i=this._host.i18nEngine(e.slice(1))),i=i??this._i18nData[this.settings.locale.selected][e],g(i)){if(i=Ui[we][e],!i)return console.warn(...f(`i18n key \'${e}\' not found in default language.`)),`$${e}`;console.warn(...f(`i18n key \'${e}\' not found in selected language.`))}for(let a=0;a<t.length;++a)i=i.replace(`{${a}}`,`${t[a]}`);return i}iactivity(e,t=[],i){const s=this.i18n(e,t);if(i){const a=`type_${i}`;this.printOutput(`ks-activity ${a}`,s)}else this.printOutput("ks-activity",s)}imessage(e,t=[]){this.printOutput("ks-default",this.i18n(e,t))}storeForSummary(e,t=1,i="other"){this._activitySummary.storeActivity(e,t,i)}getSummary(){return this._activitySummary.renderSummary()}displayActivitySummary(){const e=this.getSummary();for(const t of e)this.printOutput("ks-summary",t);this.resetActivitySummary()}resetActivitySummary(){this._activitySummary.resetActivity()}printOutput(e,t){if(this.settings.filters.enabled){for(const i of Object.values(this.settings.filters.filters))if(i.variant===e&&!i.enabled)return}this._host.game.msg(t,e)}static evaluateSubSectionTrigger(e,t){return e<0?t:t<0?e:t}}const Di=l=>Number.isFinite(l)?l:0,gn=l=>({days:Math.trunc(l/864e5),hours:Math.trunc(l/36e5%24),microseconds:Math.trunc(Di(l*1e3)%1e3),milliseconds:Math.trunc(l%1e3),minutes:Math.trunc(l/6e4%60),nanoseconds:Math.trunc(Di(l*1e6)%1e3),seconds:Math.trunc(l/1e3%60)}),mn=l=>({days:l/86400000n,hours:l/3600000n%24n,microseconds:0n,milliseconds:l%1000n,minutes:l/60000n%60n,nanoseconds:0n,seconds:l/1000n%60n}),fn=l=>{switch(typeof l){case"number":{if(Number.isFinite(l))return gn(l);break}case"bigint":return mn(l)}throw new TypeError("Expected a finite number or bigint")},pn=l=>l===0||l===0n,bn=(l,e)=>e===1||e===1n?l:`${l}s`,vn=1e-7,yn=24n*60n*60n*1000n,wn=(l,e={colonNotation:!1,compact:!1,formatSubMilliseconds:!1,keepDecimalsOnWholeSeconds:!1,millisecondsDecimalDigits:0,secondsDecimalDigits:1,separateMilliseconds:!1,unitCount:1/0,verbose:!1})=>{const t=typeof l=="bigint";if(!t&&!Number.isFinite(l))throw new TypeError("Expected a finite number or bigint");const i={...e};i.colonNotation&&(i.compact=!1,i.formatSubMilliseconds=!1,i.separateMilliseconds=!1,i.verbose=!1),i.compact&&(i.unitCount=1,i.secondsDecimalDigits=0,i.millisecondsDecimalDigits=0);let s=[];const a=(h,u)=>{const d=Math.floor(h*10**u+vn);return(Math.round(d)/10**u).toFixed(u)},n=(h,u,d,m)=>{if(!((s.length===0||!i.colonNotation)&&pn(h)&&!(i.colonNotation&&d==="m"))){if(m??=String(h),i.colonNotation){const v=m.includes(".")?m.split(".")[0].length:m.length,b=s.length>0?2:1;m="0".repeat(Math.max(0,b-v))+m}else m+=i.verbose?" "+bn(u,h):d;s.push(m)}},r=fn(l),c=BigInt(r.days);if(n(c/365n,"year","y"),n(c%365n,"day","d"),n(Number(r.hours),"hour","h"),n(Number(r.minutes),"minute","m"),i.separateMilliseconds||i.formatSubMilliseconds||!i.colonNotation&&l<1e3){const h=Number(r.seconds),u=Number(r.milliseconds),d=Number(r.microseconds),m=Number(r.nanoseconds);if(n(h,"second","s"),i.formatSubMilliseconds)n(u,"millisecond","ms"),n(d,"microsecond","µs"),n(m,"nanosecond","ns");else{const v=u+d/1e3+m/1e6,b=typeof i.millisecondsDecimalDigits=="number"?i.millisecondsDecimalDigits:0,S=v>=1?Math.round(v):Math.ceil(v),R=b?v.toFixed(b):S.toString();n(Number.parseFloat(R),"millisecond","ms",R)}}else{const h=(t?Number(l%yn):l)/1e3%60,u=typeof i.secondsDecimalDigits=="number"?i.secondsDecimalDigits:1,d=a(h,u),m=i.keepDecimalsOnWholeSeconds?d:d.replace(/\\.0+$/,"");n(Number.parseFloat(m),"second","s",m)}if(s.length===0)return"0"+(i.verbose?" milliseconds":"ms");const o=i.colonNotation?":":" ";return typeof i.unitCount=="number"&&(s=s.slice(0,Math.max(i.unitCount,1))),s.join(o)},M={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"};class D{static nextComponentId=0;componentId;host;parent;options;_element;set element(e){this._element=e,this._element[0].id=`KS${Object.getPrototypeOf(this).constructor.name}#${this.componentId}`}get element(){return p(this._element)}children=new Set;constructor(e,t){this.componentId=D.nextComponentId++,this.host=e.host,this.options=t,this.parent=e instanceof D?e:null,this._needsRefresh=!1}_needsRefresh;requestRefresh(e=!1,t=0,i=!1){if(i&&console.debug(...f(t<0?"⤒".repeat(t*-1):" ".repeat(t),this.toString(),"requestRefresh()")),this.options?.onRefreshRequest?.call(this),this.parent!==this&&!e&&this.parent?.requestRefresh(!1,t-1,i),this._needsRefresh&&i&&console.debug(...f(t<0?"⤒".repeat(t*-1):" ".repeat(t),this.toString(),"requestRefresh() <already pending>")),this._needsRefresh=!0,e){i&&console.debug(...f(t<0?"⤒".repeat(t*-1):" ".repeat(t),this.toString(),"requestRefresh()",`+ ${this.children.size} children`));for(const s of this.children)s.requestRefresh(!0,t+1,i)}else i&&console.debug(...f(t<0?"⤒".repeat(t*-1):" ".repeat(t),this.toString(),"requestRefresh()","<queued>"))}refresh(e=!1,t=0){if(!e&&!this._needsRefresh){t===0&&console.debug(...f(this.toString(),"refresh() received and ignored."));return}this.options?.onRefresh?.call(this);for(const i of this.children)i.refresh(e,t+1);this._needsRefresh=!1}addChild(e){return e.parent=this,this.children.add(e),this.element.append(e.element),this}addChildren(e){for(const t of e??[])this.addChild(t);return this}removeChild(e){this.children.has(e)&&(e.element.remove(),this.children.delete(e))}removeChildren(e){for(const t of e)this.removeChild(t)}}class T extends D{constructor(e,t){super(e,{...t}),this.element=$("<div/>");for(const i of t?.classes??[])this.element.addClass(i)}toString(){return`[${T.name}#${this.componentId}]`}}const E={label:"_label_1nlev_1",splitter:"_splitter_1nlev_16",iconLabel:"_iconLabel_1nlev_20",fillSpace:"_fillSpace_1nlev_26"},ge={delimiter:"_delimiter_16hnh_1"};class se extends D{constructor(e,t){super(e,{...t}),this.element=$("<li/>");for(const i of t?.classes??[])this.element.addClass(i);t?.delimiter===!0&&this.element.addClass(ge.delimiter)}toString(){return`[${se.name}#${this.componentId}]`}}const Ge={head:"_head_wr1pj_1"};class ne extends se{head;elementLabel;constructor(e,t,i){if(super(e,i),this.head=new T(e),this.head.element.addClass(Ge.head),this.addChild(this.head),this.elementLabel=$("<label/>",{text:`${i?.upgradeIndicator===!0?"⮤ ":""}${t}`}).addClass(E.label).addClass(Ge.label),this.head.element.append(this.elementLabel),i?.icon){const s=$("<div/>",{html:`<svg style="width: 15px; height: 15px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${i.icon}"/></svg>`}).addClass(E.iconLabel);this.elementLabel.prepend(s)}}toString(){return`[${ne.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 B={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 k extends ne{setting;checkbox;readOnly;constructor(e,t,i,s){super(e,i,{...s,onRefresh:()=>{this.setting.enabled?this.element.addClass(B.checked):this.element.removeClass(B.checked),this.readOnly?this.element.addClass(B.readonly):this.element.removeClass(B.readonly),g(this.checkbox)||(this.checkbox.prop("checked",this.setting.enabled),this.checkbox.prop("disabled",this.readOnly)),s?.onRefresh?.()}}),this.element.addClass(B.setting);const a=`ks-setting${this.componentId}`,n=$("<input/>",{id:a,type:"checkbox"}).addClass(B.checkbox);this.readOnly=s?.readOnly??!1,n.prop("disabled",this.readOnly),n.on("change",r=>{n.is(":checked")&&!t.enabled?this.check().catch(H(console)):!n.is(":checked")&&t.enabled&&this.uncheck().catch(H(console))}),this.elementLabel.before(n),this.elementLabel.prop("for",a),this.checkbox=n,this.setting=t}toString(){return`[${k.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}async check(e=!1){this.setting.enabled=!0,await this.options?.onCheck?.call(e),this.requestRefresh()}async uncheck(e=!1){this.setting.enabled=!1,await this.options.onUnCheck?.call(e),this.requestRefresh()}}const w={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 V extends D{readOnly;inactive;constructor(e,t,i,s){super(e,{...s,onRefresh:()=>{this.readOnly?this.element.addClass(w.readonly):this.element.removeClass(w.readonly),this.inactive?this.element.addClass(w.inactive):this.element.removeClass(w.inactive),s?.onRefresh?.()}}),this.element=$("<div/>",{html:`<svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${t}"/></svg>`,title:i}).addClass(w.iconButton),this.readOnly=s?.readOnly??!1,this.inactive=s?.inactive??!1,this.element.on("click",()=>{this.readOnly||this.click().catch(H(console))})}toString(){return`[${V.name}#${this.componentId}]`}async click(){this.readOnly||(await this.options?.onClick?.call(this),this.requestRefresh())}}const Ze={listContainer:"_listContainer_1kxbq_1",itemsList:"_itemsList_1kxbq_5",list:"_list_1kxbq_1",listTools:"_listTools_1kxbq_9"};class _ extends D{list;disableAllButton;enableAllButton;resetButton;constructor(e,t){super(e,{...t});const i={hasDisableAll:!0,hasEnableAll:!0,...t},s=i.hasDisableAll||i.hasEnableAll||!g(i.onReset);if(this.element=$("<div/>").addClass(Ze.listContainer),this.list=$("<ul/>").addClass(Ze.list).addClass(Ze.itemsList),this.element.append(this.list),s){const a=new T(this,{classes:[Ze.listTools]});i.hasEnableAll&&(this.enableAllButton=new V(e,M.CheckboxCheck,e.host.engine.i18n("ui.enable.all"),{onClick:async()=>{const r=new Event("enableAll",{cancelable:!0});if(this.element[0].dispatchEvent(r),!r.defaultPrevented){for(const c of this.children)Be(c,k)&&await c.check(!0);t?.onEnableAll?.call(this)}}}),a.addChild(this.enableAllButton)),i.hasDisableAll&&(this.disableAllButton=new V(e,M.CheckboxUnCheck,e.host.engine.i18n("ui.disable.all"),{onClick:async()=>{const r=new Event("disableAll",{cancelable:!0});if(this.element[0].dispatchEvent(r),!r.defaultPrevented){for(const c of this.children)Be(c,k)&&await c.uncheck(!0);t?.onDisableAll?.call(this)}}}),a.addChild(this.disableAllButton));const n=i.onReset;g(n)||(this.resetButton=new V(e,M.Reset,e.host.engine.i18n("ui.reset"),{onClick:()=>{n()}}),a.addChild(this.resetButton)),super.addChild(a)}}toString(){return`[${_.name}#${this.componentId}]`}addChild(e){return e.parent=this,this.children.add(e),this.list.append(e.element),this}}const Te={expandoButton:"_expandoButton_l1ukp_1",expanded:"_expanded_l1ukp_1",up:"_up_l1ukp_1",down:"_down_l1ukp_4"};class Ke extends D{readOnly;inactive;ineffective;constructor(e,t){super(e,{...t,onRefresh:()=>{this.ineffective?this.element.addClass(w.ineffective):this.element.removeClass(w.ineffective),t?.onRefresh?.()}}),this.element=$("<div/>",{html:`\n <svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor" class="${Te.down}"><path d="${M.ExpandCircleDown}"/></svg>\n <svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor" class="${Te.up}"><path d="${M.ExpandCircleUp}"/></svg>\n `,title:e.host.engine.i18n("ui.itemsShow")}).addClass(w.iconButton).addClass(Te.expandoButton),this.element.on("click",()=>{this.readOnly||this.click().catch(H(console))}),this.readOnly=t?.readOnly??!1,this.inactive=t?.inactive??!1,this.ineffective=!1}toString(){return`[${Ke.name}#${this.componentId}]`}setCollapsed(){this.element.removeClass(Te.expanded),this.element.prop("title",this.host.engine.i18n("ui.itemsShow"))}setExpanded(){this.element.addClass(Te.expanded),this.element.prop("title",this.host.engine.i18n("ui.itemsHide"))}async click(){this.readOnly||(await this.options?.onClick?.call(this),this.requestRefresh())}}class me extends D{container;expando;head;_mainChildVisible;get isExpanded(){return this._mainChildVisible}constructor(e,t,i){super(e,i),this.head=t,this.container=new T(this),this.container.element.addClass(B.panelContent);const s=new Ke(e,{onClick:()=>this.toggle()});t.head.addChild(s),t.element.append(this.container.element),i?.initiallyExpanded?(this.container.element.removeClass(B.hidden),s.setExpanded()):this.container.element.addClass(B.hidden),this._mainChildVisible=i?.initiallyExpanded??!1,this.element=t.element,this.expando=s,this.addChildren([this.head,this.container])}toString(){return`[${me.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(B.hidden),this.expando.setExpanded(),this.head.element.addClass(B.expanded),this.element[0].dispatchEvent(new CustomEvent("panelShown"))):(this.container.element.addClass(B.hidden),this.expando.setCollapsed(),this.head.element.removeClass(B.expanded),this.element[0].dispatchEvent(new CustomEvent("panelHidden")))),t){const s=a=>{for(const n of a)Be(n,me)?n.toggle(e,t):s(n.children)};s(this.children)}}}class I extends me{setting;settingItem;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()}constructor(e,t,i,s){super(e,i,s),this.element=i.element,this.settingItem=i,this.setting=t}toString(){return`[${I.name}#${this.componentId}]: \'${this.settingItem.elementLabel.text()}\'`}}class kn extends I{constructor(e,t,i,s){const a=e.host.engine.i18n("ui.upgrade.buildings");super(e,t,new k(e,t,a,{onCheck:c=>{e.host.engine.imessage("status.auto.enable",[a])},onUnCheck:c=>{e.host.engine.imessage("status.auto.disable",[a])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.buildings).some(c=>c.enabled)}});const n=[];for(const c of Object.values(this.setting.buildings)){const o=this.host.engine.i18n(`$buildings.${c.upgrade}.label`),h=new k(this,c,o,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o])}});n.push({button:h,label:o})}n.sort((c,o)=>c.label.localeCompare(o.label));const r=new _(this);for(const c of n)r.addChild(c.button);this.addChildContent(r)}}class F extends D{_iconElement;readOnly;inactive;ineffective;constructor(e,t,i=null,s){super(e,{...s,onRefresh:()=>{this.readOnly?this.element.addClass(w.readonly):this.element.removeClass(w.readonly),this.inactive?this.element.addClass(w.inactive):this.element.removeClass(w.inactive),this.ineffective?this.element.addClass(w.ineffective):this.element.removeClass(w.ineffective),s?.onRefresh?.()}}),this.element=$("<div/>",{title:s?.title}).addClass(w.button).text(t),s?.border!==!1&&this.element.addClass(w.bordered),s?.alignment==="right"&&this.element.addClass(w.alignRight),i!==null&&(this._iconElement=$(`<svg class="${w.buttonIcon}" style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${i}"/></svg>`),s?.alignment==="right"?this.element.append(this._iconElement):this.element.prepend(this._iconElement));for(const a of s?.classes??[])this.element.addClass(a);this.element.on("click",()=>{this.readOnly||this.click().catch(H(console))}),this.readOnly=s?.readOnly??!1,this.inactive=s?.inactive??!1,this.ineffective=!1}toString(){return`[${F.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(){this.readOnly||(await this.options?.onClick?.call(this),this.requestRefresh())}}class K extends D{constructor(e){super(e,{}),this.element=$("<div/>").addClass(ge.delimiter)}toString(){return`[${K.name}#${this.componentId}]`}}const Ni={dialog:"_dialog_b4vj0_1",close:"_close_b4vj0_7"},qi={explainer:"_explainer_1idu3_1"},_n={header:"_header_19ql8_1"};class A extends D{get elementLabel(){return this.element}constructor(e,t,i){super(e,{...i}),this.element=$("<li/>",{text:t}).addClass(_n.header)}toString(){return`[${A.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class xt extends D{constructor(e,t){super(e,{...t}),this.element=$(\'<input type="text"/>\').addClass("ks-input");for(const i of t?.classes??[])this.element.addClass(i);t?.onChange&&this.element.on("change",()=>t.onChange?.(this.element[0].value)),t?.value&&(this.element[0].value=t.value),t?.selected&&(this.element[0].selectionStart=0,this.element[0].selectionEnd=-1),this.element.on("keyup",i=>{switch(i.key){case"Enter":t?.onEnter?.(this.element[0].value);break;case"Escape":t?.onEscape?.(this.element[0].value);break}})}toString(){return`[${xt.name}#${this.componentId}]`}}class Ve extends D{constructor(e,t,i){super(e,{...i}),this.element=$("<p/>").text(t);for(const s of i?.classes??[])this.element.addClass(s)}toString(){return`[${Ve.name}#${this.componentId}]`}}const zi={toolbar:"_toolbar_1654f_1"};class x extends D{container;head;returnValue;constructor(e,t){super(e,{...t}),this.element=$("<dialog/>").addClass("dialog").addClass("help").addClass(Ni.dialog),t?.hasClose!==!1&&this.addChild(new F(e,"close",null,{classes:[Ni.close],onClick:()=>{this.close(),t?.onCancel?.()}})),this.returnValue=t?.promptValue??"",this.head=new T(e),this.container=new T(e),this.addChildren(Ie([this.head,t?.prompt?new xt(e,{onChange:i=>{this.returnValue=i},onEnter:i=>{this.returnValue=i,this.close(),t.onConfirm?.(this.returnValue)},onEscape:i=>{this.close(),t.onCancel?.()},selected:!0,value:t.promptValue}):void 0,this.container,new K(e),new T(e,{classes:[zi.toolbar]}).addChildren(Ie([new F(e,"OK",null,{classes:[w.large],onClick:()=>{this.close(),t?.onConfirm?.(this.returnValue)}}),t?.hasCancel?new F(e,"Cancel",null,{classes:[w.large],onClick:()=>{this.close(),t.onCancel?.()}}):void 0]))]))}toString(){return`[${x.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,s,a){return new Promise(n=>{new x(e,{hasCancel:!0,hasClose:!1,onCancel:()=>{n(void 0)},onConfirm:r=>{n(r)},prompt:!0,promptValue:s}).addChildrenHead(Ie([i?new A(e,i):void 0,new Ve(e,t)])).addChildrenContent(a?[new T(e,{classes:[qi.explainer]}).addChildren([new Ve(e,a)])]:[]).showModal()})}}const Cn={maxButton:"_maxButton_133h2_1"};class Ee extends F{setting;constructor(e,t,i){super(e,"",null,{...i,classes:[Cn.maxButton,...i?.classes??[]]}),this.setting=t}toString(){return`[${Ee.name}#${this.componentId}]`}}class ke extends F{behavior;setting;constructor(e,t,i,s){super(e,"",M.Trigger,{...s,onRefresh:()=>{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])),(this.options?.renderLabel??!0)&&this.updateLabel(a),this.inactive?this.element.addClass(w.inactive):this.element.removeClass(w.inactive),s?.onRefresh?.call(this)}}),this.behavior=t instanceof z?"percentage":"integer",this.setting=t}toString(){return`[${ke.name}#${this.componentId}]`}}class je extends k{maxButton;triggerButton;constructor(e,t,i,s,a){super(e,t,s,a),this.maxButton=new Ee(e,t,{alignment:"right",border:!1,classes:[w.headAction],onClick:async()=>{await a.onSetMax.call(this)},onRefresh:a?.onRefreshMax?()=>a.onRefreshMax?.call(this):void 0}),this.triggerButton=new ke(e,t,i,{border:!1,classes:[w.lastHeadAction],onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a?.onRefreshTrigger?()=>a.onRefreshTrigger?.call(this):void 0,renderLabel:a?.renderLabelTrigger??!0}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.maxButton,this.triggerButton])}toString(){return`[${je.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}const te={getBuildOption:(l,e,t,i,s,a,n)=>{const r=async()=>{const o=await x.prompt(l,l.host.engine.i18n("ui.max.prompt.absolute"),l.host.engine.i18n("ui.max.build.prompt",[s,l.host.renderAbsolute(e.max,t.selected)]),l.host.renderAbsolute(e.max),l.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=l.host.parseAbsolute(o)??e.max}},c=new je(l,e,t,s,{delimiter:n?.delimiter,onCheck:async o=>{l.host.engine.imessage("status.sub.enable",[s]),e.max===0&&!o&&await r(),await n?.onCheck?.(o)},onRefreshMax:()=>{c.maxButton.updateLabel(l.host.renderAbsolute(e.max)),c.maxButton.element[0].title=e.max<0?l.host.engine.i18n("ui.max.build.titleInfinite",[s]):e.max===0?l.host.engine.i18n("ui.max.build.titleZero",[s]):l.host.engine.i18n("ui.max.build.title",[l.host.renderAbsolute(e.max),s])},onRefreshRequest:()=>{c.maxButton.inactive=!e.enabled||e.max===-1,c.maxButton.ineffective=i.enabled&&e.enabled&&e.max===0,c.triggerButton.inactive=!e.enabled||e.trigger===-1,c.triggerButton.ineffective=i.enabled&&e.enabled&&i.trigger===-1&&e.trigger===-1},onRefreshTrigger:()=>{c.triggerButton.element[0].title=l.host.engine.i18n("ui.trigger",[e.trigger<0?i.trigger<0?l.host.engine.i18n("ui.trigger.build.blocked",[a]):`${l.host.renderPercentage(i.trigger,t.selected,!0)} (${l.host.engine.i18n("ui.trigger.build.inherited")})`:l.host.renderPercentage(e.trigger,t.selected,!0)])},onSetMax:r,onSetTrigger:async()=>{const o=await x.prompt(l,l.host.engine.i18n("ui.trigger.prompt.percentage"),l.host.engine.i18n("ui.trigger.build.prompt",[s,e.trigger!==-1?l.host.renderPercentage(e.trigger,t.selected,!0):l.host.engine.i18n("ui.trigger.build.inherited")]),e.trigger!==-1?l.host.renderPercentage(e.trigger):"",l.host.engine.i18n("ui.trigger.build.promptExplainer"));if(o!==void 0){if(o===""||o.startsWith("-")){e.trigger=-1;return}e.trigger=l.host.parsePercentage(o),await n?.onSetTrigger?.call(void 0)}},onUnCheck:o=>{l.host.engine.imessage("status.sub.disable",[s]),n?.onUnCheck?.(o)},renderLabelTrigger:n?.renderLabelTrigger,upgradeIndicator:n?.upgradeIndicator});return c}};class U extends k{triggerButton;constructor(e,t,i,s,a){super(e,t,s,a),this.triggerButton=new ke(e,t,i,{alignment:"right",border:!1,onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a?.onRefreshTrigger?()=>a.onRefreshTrigger?.call(this):void 0,renderLabel:a?.renderLabelTrigger??!0}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.triggerButton])}toString(){return`[${U.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class Tt extends I{constructor(e,t,i){console.debug(...f(`Constructing ${Tt.name}`));const s=e.host.engine.i18n("ui.build");super(e,t,new U(e,t,i,s,{onCheck:a=>{e.host.engine.imessage("status.auto.enable",[s])},onRefreshTrigger:()=>{this.settingItem.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 a=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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(a!==void 0){if(a===""||a.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(a)}},onUnCheck:a=>{e.host.engine.imessage("status.auto.disable",[s])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger<0,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger<0&&Object.values(t.buildings).some(a=>a.enabled&&0<a.max&&a.trigger<0),this.expando.ineffective=t.enabled&&Object.values(t.buildings).some(a=>a.enabled&&(a.max===0||a.trigger<0&&t.trigger<0))}}),this.addChildrenContent([new _(this,{onReset:()=>{this.setting.load({buildings:new _t().buildings})}}).addChildren(Ie(this.host.game.bld.buildingGroups.flatMap(a=>[new A(this,a.title),...a.buildings.flatMap(n=>this._getBuildOptions(this,t,i,s,n)),a!==this.host.game.bld.buildingGroups[this.host.game.bld.buildingGroups.length-1]?new K(this):void 0]))),new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new A(this,this.host.engine.i18n("ui.additional")),new k(this,t.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 k(this,t.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 k(this,t.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 k(this,t.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 kn(this,t.upgradeBuildings,i,t)])])}_getBuildOptions(e,t,i,s,a){if(a==="unicornPasture"||g(t.buildings[a]))return[];const n=e.host.game.bld.getBuildingExt(a).meta;if(!g(n.stages)){const r=Object.values(t.buildings).find(c=>c.baseBuilding===a)?.building;return[te.getBuildOption(e,t.buildings[a],i,t,n.stages[0].label,s,{renderLabelTrigger:!1}),te.getBuildOption(e,t.buildings[r],i,t,n.stages[1].label,s,{renderLabelTrigger:!1,upgradeIndicator:!0})]}return g(n.label)?[]:[te.getBuildOption(e,t.buildings[a],i,t,n.label,s,{renderLabelTrigger:!1})]}}class Sn extends k{expando;constructor(e,t){const i=W(e.host.engine.i18n("ui.engine"));super(e,t,i,{onCheck:()=>{e.host.engine.start(!0)},onUnCheck:()=>{e.host.engine.stop(!0)}}),this.expando=new Ke(this),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.expando])}}class Et extends se{button;constructor(e,t,i){super(e,{...i}),this.button=t,this.element.addClass(Ge.head),this.element.append(t.element)}}const xn={fieldset:"_fieldset_tfwil_1"};class Mt extends D{constructor(e,t,i){super(e,{...i}),this.element=$("<fieldset/>").addClass(xn.fieldset),i?.delimiter&&this.element.addClass(ge.delimiter);const s=$("<legend/>").text(t).addClass(E.label);this.element.append(s)}toString(){return`[${Mt.name}#${this.componentId}]`}}class Rt extends D{setting;option;elementLabel;input;readOnly;constructor(e,t,i,s,a){super(e,{...a,onRefresh:()=>{this.input.prop("disabled",this.readOnly)}}),this.element=$("<div/>"),this.element.addClass(B.setting),a?.delimiter===!0&&this.element.addClass(ge.delimiter),this.elementLabel=$("<label/>",{text:`${a?.upgradeIndicator?"⮤ ":""}${i.label}`}).addClass(E.label);const n=$("<input/>",{name:s,type:"radio"}).addClass("ks-radio");this.readOnly=a?.readOnly??!1,n.on("change",()=>{this.setting.selected=i.value,g(a?.onCheck)||a.onCheck()}),this.elementLabel.prepend(n),this.element.append(this.elementLabel),this.input=n,this.setting=t,this.option=i}toString(){return`[${Rt.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class Me extends D{fieldset;setting;_items;constructor(e,t,i,s){super(e,{...s,onRefresh:()=>{for(const a of this._items)if(a.option.value===this.setting.selected){a.input.prop("checked",!0);break}s?.onRefresh?.()}}),this.element=$("<li/>"),this.fieldset=new Mt(e,t),this.addChild(this.fieldset),this._items=new Array;for(const a of i.options)this._items.push(new Rt(e,i,a,t,{onCheck:s?.onCheck,readOnly:s?.readOnly}));this.fieldset.addChildren(this._items),this.setting=i}toString(){return`[${Me.name}#${this.componentId}]`}}const Tn={textButton:"_textButton_1mv97_1"};class fe extends D{readOnly;constructor(e,t,i){super(e,{...i,onRefresh:()=>{this.readOnly?this.element.addClass(w.readonly):this.element.removeClass(w.readonly),i?.onRefresh?.call(this)}}),this.element=$("<div/>").addClass(Tn.textButton),t!==void 0&&this.element.text(t);const s=i?.title;g(s)||this.element.prop("title",s),this.readOnly=!1,this.element.on("click",()=>{this.readOnly||this.click().catch(H(console))})}toString(){return`[${fe.name}#${this.componentId}]`}async click(){this.readOnly||(await this.options?.onClick?.call(this),this.requestRefresh())}}class At extends I{constructor(e,t,i){console.debug(...f(`Constructing ${At.name}`)),super(e,t,new ne(e,e.host.engine.i18n("ui.internals"),{classes:[B.checked,B.setting],icon:M.Settings}).addChildrenHead([new T(e,{classes:[E.fillSpace]})])),this.addChildrenContent([new _(e,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new Et(e,new fe(e,e.host.engine.i18n("ui.internals.interval",[t.interval]),{onClick:async()=>{const s=await x.prompt(e,e.host.engine.i18n("ui.internals.interval.prompt"),e.host.engine.i18n("ui.internals.interval.promptTitle",[e.host.renderAbsolute(t.interval,i.selected)]),e.host.renderAbsolute(t.interval),e.host.engine.i18n("ui.internals.interval.promptExplainer"));s===void 0||s===""||s.startsWith("-")||(s==="0"&&(t.enabled=!1),t.interval=e.host.parseAbsolute(s)??t.interval)},onRefresh(){this.element.text(e.host.engine.i18n("ui.internals.interval",[t.interval]))}})),new K(e),new k(e,t.ksColumn,e.host.engine.i18n("ui.ksColumn"),{onCheck:()=>{e.host.rebuildUi()},onUnCheck:()=>{e.host.rebuildUi()}}),new k(e,t.highlighStock,e.host.engine.i18n("ui.highlightStock")),new K(e),new Me(e,e.host.engine.i18n("ui.language"),t.locale,{onCheck:()=>{e.host.rebuildUi()}}),new K(e),new ne(e,`Kitten Scientists ${Pe("v")}`)])])}}class Pt extends D{constructor(e,t,i){super(e,{...i}),this.element=$("<li/>",{text:e.host.engine.i18n(t)}).addClass(qi.explainer)}toString(){return`[${Pt.name}#${this.componentId}]`}}class Bt extends I{constructor(e,t){console.debug(...f(`Constructing ${Bt.name}`));const i=e.host.engine.i18n("ui.filter");super(e,t,new k(e,t,i,{onCheck:s=>{e.host.engine.imessage("status.auto.enable",[i])},onUnCheck:s=>{e.host.engine.imessage("status.auto.disable",[i])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})])),this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new A(this,"Kitten Scientists"),new _(this).addChildren(Si.map(s=>({label:this.host.engine.i18n(`filter.${s}`),name:s})).sort((s,a)=>s.label.localeCompare(a.label)).map(s=>new k(this,this.setting.filters[s.name],s.label,{onCheck:()=>{this.host.engine.imessage("filter.enable",[s.label])},onUnCheck:()=>{this.host.engine.imessage("filter.disable",[s.label])}})))])),this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new A(this,"Kittens Game"),new _(this).addChildren(xi.map(s=>({label:this.host.engine.i18n(`$console.filter.${s}`),name:s})).sort((s,a)=>s.label.localeCompare(a.label)).map(s=>new k(this,this.setting.filtersGame[s.name],s.label,{onCheck:()=>{this.host.engine.imessage("filter.enable",[s.label])},onUnCheck:()=>{this.host.engine.imessage("filter.disable",[s.label])}})))])),this.addChildContent(new Pt(this,"filter.explainer"))}}const Je={active:"_active_6c09s_16"};class It extends I{_unicornBuildings;_bestUnicornBuilding;constructor(e,t,i){console.debug(...f(`Constructing ${It.name}`));const s=e.host.engine.i18n("ui.faith");super(e,t,new U(e,t,i,s,{onCheck:n=>{e.host.engine.imessage("status.auto.enable",[s])},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 n=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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(n!==void 0){if(n===""||n.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(n)}},onUnCheck:n=>{e.host.engine.imessage("status.auto.disable",[s])},renderLabelTrigger:!1}),{onRefresh:()=>{for(const[n,r]of this._unicornBuildings.entries())r.elementLabel.attr("data-ks-active-from","❊"),r.elementLabel.attr("data-ks-active-to","✮"),this.setting.bestUnicornBuilding.enabled&&this.setting.bestUnicornBuildingCurrent===n?r.elementLabel.addClass(Je.active):r.elementLabel.removeClass(Je.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(n=>n.enabled&&0<n.max&&n.trigger<0),this.expando.ineffective=t.enabled&&Object.values(t.buildings).some(n=>n.enabled&&(n.max===0||n.trigger<0&&t.trigger<0));for(const[n,r]of this._unicornBuildings.entries())r.readOnly=this._bestUnicornBuilding.setting.enabled,r.maxButton.readOnly=this._bestUnicornBuilding.setting.enabled,r.triggerButton.readOnly=this._bestUnicornBuilding.setting.enabled}});const a=[...Ne];this._unicornBuildings=new Map([["unicornPasture",te.getBuildOption(this,this.setting.buildings.unicornPasture,i,this.setting,this.host.engine.i18n("$buildings.unicornPasture.label"),s,{renderLabelTrigger:!1})],...this.host.game.religion.zigguratUpgrades.filter(n=>a.includes(n.name)&&!g(this.setting.buildings[n.name])).map(n=>[n.name,te.getBuildOption(this,this.setting.buildings[n.name],i,this.setting,n.label,s,{renderLabelTrigger:!1})])]),this._bestUnicornBuilding=new k(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 n of this._unicornBuildings.values())n.setting.enabled=!0,n.setting.max=-1,n.setting.trigger=-1},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.faith.best.unicorn")])},upgradeIndicator:!0}),this.addChildrenContent([new _(this,{onReset:()=>{const n=new Ct;this.setting.load({bestUnicornBuilding:n.bestUnicornBuilding,buildings:n.buildings})}}).addChildren([new A(this,this.host.engine.i18n("$religion.panel.ziggurat.label")),...this._unicornBuildings.values(),this._bestUnicornBuilding,new K(this),...this.host.game.religion.zigguratUpgrades.filter(n=>!a.includes(n.name)&&!g(this.setting.buildings[n.name])).map(n=>te.getBuildOption(this,this.setting.buildings[n.name],i,this.setting,n.label,s,{renderLabelTrigger:!1})),new K(this),new A(this,this.host.engine.i18n("$religion.panel.orderOfTheSun.label")),...this.host.game.religion.religionUpgrades.filter(n=>!g(this.setting.buildings[n.name])).map(n=>te.getBuildOption(this,this.setting.buildings[n.name],i,this.setting,n.label,s,{delimiter:n.name===this.host.game.religion.religionUpgrades.at(-1)?.name,renderLabelTrigger:!1})),new A(this,this.host.engine.i18n("$religion.panel.cryptotheology.label")),...this.host.game.religion.transcendenceUpgrades.filter(n=>!g(this.setting.buildings[n.name])).map(n=>te.getBuildOption(this,this.setting.buildings[n.name],i,this.setting,n.label,s,{renderLabelTrigger:!1}))]),new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new A(this,this.host.engine.i18n("ui.additional")),...fs.map(n=>{const r=this.host.engine.i18n(`option.faith.${n}`);if(n==="transcend")return new k(this,this.setting[n],r,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[r])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[r])}});const c=new U(this,this.setting[n],i,r,{classes:[w.lastHeadAction],onCheck:()=>{this.host.engine.imessage("status.sub.enable",[r])},onRefresh:()=>{c.triggerButton.inactive=!this.setting[n].enabled||this.setting[n].trigger===-1},onSetTrigger:async()=>{const o=await x.prompt(this,this.host.engine.i18n(c.triggerButton.behavior==="integer"?"ui.trigger.setinteger":"ui.trigger.setpercentage",[r]),this.host.engine.i18n("ui.trigger.build.prompt",[r,c.triggerButton.behavior==="integer"?this.host.renderAbsolute(this.setting[n].trigger,i.selected):this.host.renderPercentage(this.setting[n].trigger,i.selected,!0)]),c.triggerButton.behavior==="integer"?this.host.renderAbsolute(this.setting[n].trigger):this.host.renderPercentage(this.setting[n].trigger),this.host.engine.i18n(c.triggerButton.behavior==="integer"?"ui.trigger.setinteger.promptExplainer":"ui.trigger.setpercentage.promptExplainer"));o===void 0||o===""||o.startsWith("-")||(this.setting[n].trigger=(c.triggerButton.behavior==="integer"?this.host.parseAbsolute(o):this.host.parsePercentage(o))??this.setting[n].trigger)},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[r])}});return c.triggerButton.element.addClass(w.lastHeadAction),c})])])}}class $t extends F{setting;resourceName;constructor(e,t,i,s,a){super(e,"",M.DataUsage,{...a,onClick:async()=>{const n=await x.prompt(e,e.host.engine.i18n("resources.consume.prompt"),e.host.engine.i18n("resources.consume.promptTitle",[s,e.host.renderPercentage(t.consume,i.selected,!0)]),e.host.renderPercentage(t.consume),e.host.engine.i18n("resources.consume.promptExplainer"));n!==void 0&&(n===""||n.startsWith("-")||(t.consume=e.host.parsePercentage(n)))},onRefresh:()=>{const n=this.host.renderPercentage(this.setting.consume,this.host.engine.settings.locale.selected,!0),r=this.setting.consume===0?this.host.engine.i18n("resources.consume.titleZero",[this.resourceName]):this.host.engine.i18n("resources.consume.title",[n,this.resourceName]);this.updateTitle(r),a?.onRefresh?.()}}),this.element.addClass(w.consumeButton),this.resourceName=s,this.setting=t}toString(){return`[${$t.name}#${this.componentId}]`}}class Lt extends F{setting;resourceName;constructor(e,t,i,s,a){super(e,"",null,{...a,onClick:async()=>{const n=await x.prompt(e,e.host.engine.i18n("resources.stock.prompt"),e.host.engine.i18n("resources.stock.promptTitle",[s,e.host.renderAbsolute(t.stock,i.selected)]),e.host.renderAbsolute(t.stock),e.host.engine.i18n("resources.stock.promptExplainer"));if(n!==void 0){if(n===""||n.startsWith("-")){t.stock=-1;return}n==="0"&&(t.enabled=!1),t.stock=e.host.parseAbsolute(n)??t.stock}},onRefresh:()=>{const n=this.host.renderAbsolute(this.setting.stock),r=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(r),this.updateLabel(n)}}),this.element.addClass(w.stockButton),this.resourceName=s,this.setting=t}toString(){return`[${Lt.name}#${this.componentId}]`}}class Ot extends I{constructor(e,t,i){console.debug(...f(`Constructing ${Ot.name}`));const s=e.host.engine.i18n("ui.resources");super(e,t,new ne(e,s,{classes:[B.checked,B.setting],icon:M.Resources}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]));const a=["blackcoin","burnedParagon","elderBox","gflops","hashrates","kittens","paragon","temporalFlux","wrappingPaper","zebras"];this.addChildContent(new _(this).addChildren(this.host.game.resPool.resources.filter(n=>!a.includes(n.name)&&!g(this.setting.resources[n.name])).sort((n,r)=>n.title.localeCompare(r.title,i.selected)).map(n=>[this.setting.resources[n.name],W(n.title)]).map(([n,r])=>this._makeResourceSetting(this,n,i,r))))}_makeResourceSetting(e,t,i,s){const a=new k(e,t,s,{onCheck:()=>{e.host.engine.imessage("status.resource.enable",[s])},onUnCheck:()=>{e.host.engine.imessage("status.resource.disable",[s])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),n=new Lt(e,t,i,s,{alignment:"right",border:!1,classes:[w.headAction],onRefreshRequest:()=>{n.inactive=!t.enabled||t.stock===0}});a.head.addChild(n);const r=new $t(e,t,i,s,{border:!1,classes:[w.lastHeadAction],onRefreshRequest:()=>{r.inactive=!t.enabled||t.consume!==100,r.ineffective=t.enabled&&t.consume===0}});return a.head.addChild(r),a}}class En extends I{constructor(e,t,i,s){const a=e.host.engine.i18n("ui.upgrade.policies");super(e,t,new k(e,t,a,{onCheck:o=>{e.host.engine.imessage("status.auto.enable",[a])},onUnCheck:o=>{e.host.engine.imessage("status.auto.disable",[a])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.policies).some(o=>o.enabled)}});const n=this.host.game.science.policies.filter(o=>!g(this.setting.policies[o.name])),r=[];let c=n[0].label;for(const o of n.sort((h,u)=>h.label.localeCompare(u.label,i.selected))){const h=this.setting.policies[o.name],u=new k(this,h,o.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o.label])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o.label])}});this.host.engine.localeSupportsFirstLetterSplits(i.selected)&&c[0]!==o.label[0]&&u.element.addClass(E.splitter),r.push(u),c=o.label}this.addChildContent(new _(this).addChildren(r))}}class Mn extends I{constructor(e,t,i,s){const a=e.host.engine.i18n("ui.upgrade.techs");super(e,t,new U(e,t,i,a,{onCheck:o=>{e.host.engine.imessage("status.auto.enable",[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.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const o=await x.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.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",[a])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1,this.settingItem.triggerButton.ineffective=s.enabled&&t.enabled&&t.trigger===-1&&!Object.values(t.techs).some(o=>o.enabled&&0<=o.trigger),this.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.techs).some(o=>o.enabled)}});const n=this.host.game.science.techs.filter(o=>!g(this.setting.techs[o.name])),r=[];let c=n[0].label;for(const o of n.sort((h,u)=>h.label.localeCompare(u.label,i.selected))){const h=this.setting.techs[o.name],u=new U(this,h,i,o.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o.label])},onRefresh:()=>{u.triggerButton.inactive=!h.enabled||h.trigger===-1,u.triggerButton.ineffective=s.enabled&&t.enabled&&h.enabled&&t.trigger===-1&&h.trigger===-1},onRefreshTrigger:()=>{u.triggerButton.element[0].title=this.host.engine.i18n("ui.trigger",[h.trigger<0?t.trigger<0?this.host.engine.i18n("ui.trigger.section.blocked",[a]):`${this.host.renderPercentage(t.trigger,i.selected,!0)} (${this.host.engine.i18n("ui.trigger.section.inherited")})`:this.host.renderPercentage(h.trigger,i.selected,!0)])},onSetTrigger:async()=>{const d=await x.prompt(this,this.host.engine.i18n("ui.trigger.prompt.percentage"),this.host.engine.i18n("ui.trigger.section.prompt",[a,h.trigger!==-1?this.host.renderPercentage(h.trigger,i.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(d!==void 0){if(d===""||d.startsWith("-")){h.trigger=-1;return}h.trigger=this.host.parsePercentage(d)}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o.label])},renderLabelTrigger:!1});u.triggerButton.element.addClass(w.lastHeadAction),this.host.engine.localeSupportsFirstLetterSplits(i.selected)&&c[0]!==o.label[0]&&u.element.addClass(E.splitter),r.push(u),c=o.label}this.addChildContent(new _(this).addChildren(r))}}class Ut extends I{_policiesUi;_techsUi;_observeStars;constructor(e,t,i){console.debug(...f(`Constructing ${Ut.name}`));const s=e.host.engine.i18n("ui.upgrade");super(e,t,new k(e,t,s,{onCheck:n=>{e.host.engine.imessage("status.auto.enable",[s])},onUnCheck:n=>{e.host.engine.imessage("status.auto.disable",[s])}}).addChildrenHead([new T(e,{classes:[E.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))}}),this._policiesUi=new En(this,t.policies,i,t),this._techsUi=new Mn(this,t.techs,i,t),this._observeStars=new k(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 _(this,{hasDisableAll:!1,hasEnableAll:!1});a.addChildren([this._techsUi,this._policiesUi,this._observeStars]),this.addChildContent(a)}}class Rn extends I{_missions;constructor(e,t,i,s){const a=e.host.engine.i18n("ui.upgrade.missions");super(e,t,new k(e,t,a,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[a])},onRefresh:()=>{this.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.missions).some(r=>r.enabled)},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[a])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})])),this._missions=this.host.game.space.programs.filter(r=>!g(this.setting.missions[r.name])).map(r=>new k(this,this.setting.missions[r.name],r.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[r.label])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[r.label])}}));const n=new _(this).addChildren(this._missions);this.addChildContent(n)}}class Dt extends I{_missionsUi;constructor(e,t,i){console.debug(...f(`Constructing ${Dt.name}`));const s=e.host.engine.i18n("ui.space");super(e,t,new U(e,t,i,s,{onCheck:n=>{e.host.engine.imessage("status.auto.enable",[s])},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 n=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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(n!==void 0){if(n===""||n.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(n)}},onUnCheck:n=>{e.host.engine.imessage("status.auto.disable",[s])},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(n=>n.enabled&&0<n.max&&n.trigger<0),this.expando.ineffective=t.enabled&&(Object.values(t.buildings).some(n=>n.enabled&&(n.max===0||n.trigger<0&&t.trigger<0))||!Object.values(t.buildings).some(n=>n.enabled)&&!t.unlockMissions.enabled||this._missionsUi.expando.ineffective)}}),this.addChildContent(new _(this,{onReset:()=>{this.setting.load({buildings:new He().buildings})}}).addChildren(this.host.game.space.planets.filter(n=>0<n.buildings.length).flatMap((n,r,c)=>[new A(this,this.host.engine.labelForPlanet(n.name)),...n.buildings.filter(o=>!g(this.setting.buildings[o.name])).map((o,h,u)=>te.getBuildOption(this,this.setting.buildings[o.name],i,this.setting,o.label,s,{delimiter:r<c.length-1&&h===u.length-1,renderLabelTrigger:!1}))])));const a=new _(this,{hasDisableAll:!1,hasEnableAll:!1});a.addChild(new A(this,this.host.engine.i18n("ui.additional"))),this._missionsUi=new Rn(this,this.setting.unlockMissions,i,this.setting),a.addChild(this._missionsUi),this.addChildContent(a)}}class Nt extends he{constructor(e,t=400){super("ERR_OS_INVALID_ARGUMENT",e,t),this.name="InvalidArgumentError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,Nt)}}const Xe=43200,Hi=1440,Fi=Symbol.for("constructDateFrom");function qt(l,e){return typeof l=="function"?l(e):l&&typeof l=="object"&&Fi in l?l[Fi](e):l instanceof Date?new l.constructor(e):new Date(e)}function An(l){return qt(l,Date.now())}const Pn={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"}},Bn=(l,e,t)=>{let i;const s=Pn[l];return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function J(l){return(e={})=>{const t=e.width?String(e.width):l.defaultWidth;return l.formats[t]||l.formats[l.defaultWidth]}}const In={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},$n={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ln={full:"{{date}} \'at\' {{time}}",long:"{{date}} \'at\' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},On={date:J({formats:In,defaultWidth:"full"}),time:J({formats:$n,defaultWidth:"full"}),dateTime:J({formats:Ln,defaultWidth:"full"})},Un={lastWeek:"\'last\' eeee \'at\' p",yesterday:"\'yesterday at\' p",today:"\'today at\' p",tomorrow:"\'tomorrow at\' p",nextWeek:"eeee \'at\' p",other:"P"},Dn=(l,e,t,i)=>Un[l];function N(l){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let s;if(i==="formatting"&&l.formattingValues){const n=l.defaultFormattingWidth||l.defaultWidth,r=t?.width?String(t.width):n;s=l.formattingValues[r]||l.formattingValues[n]}else{const n=l.defaultWidth,r=t?.width?String(t.width):l.defaultWidth;s=l.values[r]||l.values[n]}const a=l.argumentCallback?l.argumentCallback(e):e;return s[a]}}const Nn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},qn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},zn={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"]},Hn={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"]},Fn={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"}},Wn={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"}},Gn={ordinalNumber:(l,e)=>{const t=Number(l),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:N({values:Nn,defaultWidth:"wide"}),quarter:N({values:qn,defaultWidth:"wide",argumentCallback:l=>l-1}),month:N({values:zn,defaultWidth:"wide"}),day:N({values:Hn,defaultWidth:"wide"}),dayPeriod:N({values:Fn,defaultWidth:"wide",formattingValues:Wn,defaultFormattingWidth:"wide"})};function q(l){return(e,t={})=>{const i=t.width,s=i&&l.matchPatterns[i]||l.matchPatterns[l.defaultMatchWidth],a=e.match(s);if(!a)return null;const n=a[0],r=i&&l.parsePatterns[i]||l.parsePatterns[l.defaultParseWidth],c=Array.isArray(r)?Kn(r,u=>u.test(n)):Zn(r,u=>u.test(n));let o;o=l.valueCallback?l.valueCallback(c):c,o=t.valueCallback?t.valueCallback(o):o;const h=e.slice(n.length);return{value:o,rest:h}}}function Zn(l,e){for(const t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&e(l[t]))return t}function Kn(l,e){for(let t=0;t<l.length;t++)if(e(l[t]))return t}function Ye(l){return(e,t={})=>{const i=e.match(l.matchPattern);if(!i)return null;const s=i[0],a=e.match(l.parsePattern);if(!a)return null;let n=l.valueCallback?l.valueCallback(a[0]):a[0];n=t.valueCallback?t.valueCallback(n):n;const r=e.slice(s.length);return{value:n,rest:r}}}const Vn=/^(\\d+)(th|st|nd|rd)?/i,jn=/\\d+/i,Jn={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},Xn={any:[/^b/i,/^(a|c)/i]},Yn={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Qn={any:[/1/i,/2/i,/3/i,/4/i]},ea={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},ta={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]},ia={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},sa={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]},na={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},aa={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}},ra={ordinalNumber:Ye({matchPattern:Vn,parsePattern:jn,valueCallback:l=>parseInt(l,10)}),era:q({matchPatterns:Jn,defaultMatchWidth:"wide",parsePatterns:Xn,defaultParseWidth:"any"}),quarter:q({matchPatterns:Yn,defaultMatchWidth:"wide",parsePatterns:Qn,defaultParseWidth:"any",valueCallback:l=>l+1}),month:q({matchPatterns:ea,defaultMatchWidth:"wide",parsePatterns:ta,defaultParseWidth:"any"}),day:q({matchPatterns:ia,defaultMatchWidth:"wide",parsePatterns:sa,defaultParseWidth:"any"}),dayPeriod:q({matchPatterns:na,defaultMatchWidth:"any",parsePatterns:aa,defaultParseWidth:"any"})},Wi={code:"en-US",formatDistance:Bn,formatLong:On,formatRelative:Dn,localize:Gn,match:ra,options:{weekStartsOn:0,firstWeekContainsDate:1}};let oa={};function Gi(){return oa}function le(l,e){return qt(e||l,l)}function Zi(l){const e=le(l),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+l-+t}function Qe(l,...e){const t=qt.bind(null,l||e.find(i=>typeof i=="object"));return e.map(t)}function et(l,e){const t=+le(l)-+le(e);return t<0?-1:t>0?1:t}function la(l,e,t){const[i,s]=Qe(t?.in,l,e),a=i.getFullYear()-s.getFullYear(),n=i.getMonth()-s.getMonth();return a*12+n}function ca(l,e){const t=le(l,e?.in);return t.setHours(23,59,59,999),t}function ha(l,e){const t=le(l,e?.in),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t}function ua(l,e){const t=le(l,e?.in);return+ca(t,e)==+ha(t,e)}function da(l,e,t){const[i,s,a]=Qe(t?.in,l,l,e),n=et(s,a),r=Math.abs(la(s,a));if(r<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-n*r);let c=et(s,a)===-n;ua(i)&&r===1&&et(i,a)===1&&(c=!1);const o=n*(r-+c);return o===0?0:o}function ga(l){return e=>{const i=(l?Math[l]:Math.trunc)(e);return i===0?0:i}}function ma(l,e){return+le(l)-+le(e)}function fa(l,e,t){const i=ma(l,e)/1e3;return ga(t?.roundingMethod)(i)}function pa(l,e,t){const i=Gi(),s=t?.locale??i.locale??Wi,a=2520,n=et(l,e);if(isNaN(n))throw new RangeError("Invalid time value");const r=Object.assign({},t,{addSuffix:t?.addSuffix,comparison:n}),[c,o]=Qe(t?.in,...n>0?[e,l]:[l,e]),h=fa(o,c),u=(Zi(o)-Zi(c))/1e3,d=Math.round((h-u)/60);let m;if(d<2)return t?.includeSeconds?h<5?s.formatDistance("lessThanXSeconds",5,r):h<10?s.formatDistance("lessThanXSeconds",10,r):h<20?s.formatDistance("lessThanXSeconds",20,r):h<40?s.formatDistance("halfAMinute",0,r):h<60?s.formatDistance("lessThanXMinutes",1,r):s.formatDistance("xMinutes",1,r):d===0?s.formatDistance("lessThanXMinutes",1,r):s.formatDistance("xMinutes",d,r);if(d<45)return s.formatDistance("xMinutes",d,r);if(d<90)return s.formatDistance("aboutXHours",1,r);if(d<Hi){const v=Math.round(d/60);return s.formatDistance("aboutXHours",v,r)}else{if(d<a)return s.formatDistance("xDays",1,r);if(d<Xe){const v=Math.round(d/Hi);return s.formatDistance("xDays",v,r)}else if(d<Xe*2)return m=Math.round(d/Xe),s.formatDistance("aboutXMonths",m,r)}if(m=da(o,c),m<12){const v=Math.round(d/Xe);return s.formatDistance("xMonths",v,r)}else{const v=m%12,b=Math.trunc(m/12);return v<3?s.formatDistance("aboutXYears",b,r):v<9?s.formatDistance("overXYears",b,r):s.formatDistance("almostXYears",b+1,r)}}function Ki(l,e){return pa(l,An(l),e)}function Vi(l,e){const t=Gi(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=le(l,e?.in),a=s.getDay(),n=(a<i?7:0)+a-i;return s.setDate(s.getDate()-n),s.setHours(0,0,0,0),s}function ba(l,e,t){const[i,s]=Qe(t?.in,l,e);return+Vi(i,t)==+Vi(s,t)}const ji={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"}}},va=(l,e,t)=>{let i;const s=t?.addSuffix?ji[l].withPreposition:ji[l].standalone;return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",String(e)),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:"vor "+i:i},ya={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},wa={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},ka={full:"{{date}} \'um\' {{time}}",long:"{{date}} \'um\' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},_a={date:J({formats:ya,defaultWidth:"full"}),time:J({formats:wa,defaultWidth:"full"}),dateTime:J({formats:ka,defaultWidth:"full"})},Ca={lastWeek:"\'letzten\' eeee \'um\' p",yesterday:"\'gestern um\' p",today:"\'heute um\' p",tomorrow:"\'morgen um\' p",nextWeek:"eeee \'um\' p",other:"P"},Sa=(l,e,t,i)=>Ca[l],xa={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},Ta={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},zt={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"]},Ea={narrow:zt.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:zt.wide},Ma={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"]},Ra={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"}},Aa={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"}},Pa={ordinalNumber:l=>Number(l)+".",era:N({values:xa,defaultWidth:"wide"}),quarter:N({values:Ta,defaultWidth:"wide",argumentCallback:l=>l-1}),month:N({values:zt,formattingValues:Ea,defaultWidth:"wide"}),day:N({values:Ma,defaultWidth:"wide"}),dayPeriod:N({values:Ra,defaultWidth:"wide",formattingValues:Aa,defaultFormattingWidth:"wide"})},Ba=/^(\\d+)(\\.)?/i,Ia=/\\d+/i,$a={narrow:/^(v\\.? ?Chr\\.?|n\\.? ?Chr\\.?)/i,abbreviated:/^(v\\.? ?Chr\\.?|n\\.? ?Chr\\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},La={any:[/^v/i,/^n/i]},Oa={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\\.)? Quartal/i},Ua={any:[/1/i,/2/i,/3/i,/4/i]},Da={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},Na={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]},qa={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},za={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},Ha={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},Fa={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}},Wa={ordinalNumber:Ye({matchPattern:Ba,parsePattern:Ia,valueCallback:l=>parseInt(l)}),era:q({matchPatterns:$a,defaultMatchWidth:"wide",parsePatterns:La,defaultParseWidth:"any"}),quarter:q({matchPatterns:Oa,defaultMatchWidth:"wide",parsePatterns:Ua,defaultParseWidth:"any",valueCallback:l=>l+1}),month:q({matchPatterns:Da,defaultMatchWidth:"wide",parsePatterns:Na,defaultParseWidth:"any"}),day:q({matchPatterns:qa,defaultMatchWidth:"wide",parsePatterns:za,defaultParseWidth:"any"}),dayPeriod:q({matchPatterns:Ha,defaultMatchWidth:"wide",parsePatterns:Fa,defaultParseWidth:"any"})},Ga={code:"de",formatDistance:va,formatLong:_a,formatRelative:Sa,localize:Pa,match:Wa,options:{weekStartsOn:1,firstWeekContainsDate:4}},Za={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}} שנים"}},Ka=(l,e,t)=>{if(l==="xDays"&&t?.addSuffix&&e<=2)return t.comparison&&t.comparison>0?e===1?"מחר":"מחרתיים":e===1?"אתמול":"שלשום";let i;const s=Za[l];return typeof s=="string"?i=s:e===1?i=s.one:e===2?i=s.two:i=s.other.replace("{{count}}",String(e)),t?.addSuffix?t.comparison&&t.comparison>0?"בעוד "+i:"לפני "+i:i},Va={full:"EEEE, d בMMMM y",long:"d בMMMM y",medium:"d בMMM y",short:"d.M.y"},ja={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},Ja={full:"{{date}} \'בשעה\' {{time}}",long:"{{date}} \'בשעה\' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Xa={date:J({formats:Va,defaultWidth:"full"}),time:J({formats:ja,defaultWidth:"full"}),dateTime:J({formats:Ja,defaultWidth:"full"})},Ya={lastWeek:"eeee \'שעבר בשעה\' p",yesterday:"\'אתמול בשעה\' p",today:"\'היום בשעה\' p",tomorrow:"\'מחר בשעה\' p",nextWeek:"eeee \'בשעה\' p",other:"P"},Qa=(l,e,t,i)=>Ya[l],er={narrow:["לפנה״ס","לספירה"],abbreviated:["לפנה״ס","לספירה"],wide:["לפני הספירה","לספירה"]},tr={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["רבעון 1","רבעון 2","רבעון 3","רבעון 4"]},ir={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"],wide:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"]},sr={narrow:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],short:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],abbreviated:["יום א׳","יום ב׳","יום ג׳","יום ד׳","יום ה׳","יום ו׳","שבת"],wide:["יום ראשון","יום שני","יום שלישי","יום רביעי","יום חמישי","יום שישי","יום שבת"]},nr={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:"לילה"}},ar={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:"בלילה"}},rr={ordinalNumber:(l,e)=>{const t=Number(l);if(t<=0||t>10)return String(t);const i=String(e?.unit),s=["year","hour","minute","second"].indexOf(i)>=0,a=["ראשון","שני","שלישי","רביעי","חמישי","שישי","שביעי","שמיני","תשיעי","עשירי"],n=["ראשונה","שנייה","שלישית","רביעית","חמישית","שישית","שביעית","שמינית","תשיעית","עשירית"],r=t-1;return s?n[r]:a[r]},era:N({values:er,defaultWidth:"wide"}),quarter:N({values:tr,defaultWidth:"wide",argumentCallback:l=>l-1}),month:N({values:ir,defaultWidth:"wide"}),day:N({values:sr,defaultWidth:"wide"}),dayPeriod:N({values:nr,defaultWidth:"wide",formattingValues:ar,defaultFormattingWidth:"wide"})},or=/^(\\d+|(ראשון|שני|שלישי|רביעי|חמישי|שישי|שביעי|שמיני|תשיעי|עשירי|ראשונה|שנייה|שלישית|רביעית|חמישית|שישית|שביעית|שמינית|תשיעית|עשירית))/i,lr=/^(\\d+|רא|שנ|של|רב|ח|שי|שב|שמ|ת|ע)/i,cr={narrow:/^ל(ספירה|פנה״ס)/i,abbreviated:/^ל(ספירה|פנה״ס)/i,wide:/^ל(פני ה)?ספירה/i},hr={any:[/^לפ/i,/^לס/i]},ur={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^רבעון [1234]/i},dr={any:[/1/i,/2/i,/3/i,/4/i]},gr={narrow:/^\\d+/i,abbreviated:/^(ינו|פבר|מרץ|אפר|מאי|יוני|יולי|אוג|ספט|אוק|נוב|דצמ)׳?/i,wide:/^(ינואר|פברואר|מרץ|אפריל|מאי|יוני|יולי|אוגוסט|ספטמבר|אוקטובר|נובמבר|דצמבר)/i},mr={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]},fr={narrow:/^[אבגדהוש]׳/i,short:/^[אבגדהוש]׳/i,abbreviated:/^(שבת|יום (א|ב|ג|ד|ה|ו)׳)/i,wide:/^יום (ראשון|שני|שלישי|רביעי|חמישי|שישי|שבת)/i},pr={abbreviated:[/א׳$/i,/ב׳$/i,/ג׳$/i,/ד׳$/i,/ה׳$/i,/ו׳$/i,/^ש/i],wide:[/ן$/i,/ני$/i,/לישי$/i,/עי$/i,/מישי$/i,/שישי$/i,/ת$/i],any:[/^א/i,/^ב/i,/^ג/i,/^ד/i,/^ה/i,/^ו/i,/^ש/i]},br={any:/^(אחר ה|ב)?(חצות|צהריים|בוקר|ערב|לילה|אחה״צ|לפנה״צ)/i},vr={any:{am:/^לפ/i,pm:/^אחה/i,midnight:/^ח/i,noon:/^צ/i,morning:/בוקר/i,afternoon:/בצ|אחר/i,evening:/ערב/i,night:/לילה/i}},yr=["רא","שנ","של","רב","ח","שי","שב","שמ","ת","ע"],wr={ordinalNumber:Ye({matchPattern:or,parsePattern:lr,valueCallback:l=>{const e=parseInt(l,10);return isNaN(e)?yr.indexOf(l)+1:e}}),era:q({matchPatterns:cr,defaultMatchWidth:"wide",parsePatterns:hr,defaultParseWidth:"any"}),quarter:q({matchPatterns:ur,defaultMatchWidth:"wide",parsePatterns:dr,defaultParseWidth:"any",valueCallback:l=>l+1}),month:q({matchPatterns:gr,defaultMatchWidth:"wide",parsePatterns:mr,defaultParseWidth:"any"}),day:q({matchPatterns:fr,defaultMatchWidth:"wide",parsePatterns:pr,defaultParseWidth:"any"}),dayPeriod:q({matchPatterns:br,defaultMatchWidth:"any",parsePatterns:vr,defaultParseWidth:"any"})},kr={code:"he",formatDistance:Ka,formatLong:Xa,formatRelative:Qa,localize:rr,match:wr,options:{weekStartsOn:0,firstWeekContainsDate:1}},_r={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}} 年"}},Cr=(l,e,t)=>{let i;const s=_r[l];return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",String(e)),t?.addSuffix?t.comparison&&t.comparison>0?i+"内":i+"前":i},Sr={full:"y\'年\'M\'月\'d\'日\' EEEE",long:"y\'年\'M\'月\'d\'日\'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},xr={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},Tr={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Er={date:J({formats:Sr,defaultWidth:"full"}),time:J({formats:xr,defaultWidth:"full"}),dateTime:J({formats:Tr,defaultWidth:"full"})};function Ji(l,e,t){const i="eeee p";return ba(l,e,t)?i:l.getTime()>e.getTime()?"\'下个\'"+i:"\'上个\'"+i}const Mr={lastWeek:Ji,yesterday:"\'昨天\' p",today:"\'今天\' p",tomorrow:"\'明天\' p",nextWeek:Ji,other:"PP p"},Rr=(l,e,t,i)=>{const s=Mr[l];return typeof s=="function"?s(e,t,i):s},Ar={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},Pr={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},Br={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},Ir={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},$r={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:"夜间"}},Lr={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:"夜间"}},Or={ordinalNumber:(l,e)=>{const t=Number(l);switch(e?.unit){case"date":return t.toString()+"日";case"hour":return t.toString()+"时";case"minute":return t.toString()+"分";case"second":return t.toString()+"秒";default:return"第 "+t.toString()}},era:N({values:Ar,defaultWidth:"wide"}),quarter:N({values:Pr,defaultWidth:"wide",argumentCallback:l=>l-1}),month:N({values:Br,defaultWidth:"wide"}),day:N({values:Ir,defaultWidth:"wide"}),dayPeriod:N({values:$r,defaultWidth:"wide",formattingValues:Lr,defaultFormattingWidth:"wide"})},Ur=/^(第\\s*)?\\d+(日|时|分|秒)?/i,Dr=/\\d+/i,Nr={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},qr={any:[/^(前)/i,/^(公元)/i]},zr={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},Hr={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},Fr={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},Wr={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]},Gr={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},Zr={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},Kr={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},Vr={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},jr={ordinalNumber:Ye({matchPattern:Ur,parsePattern:Dr,valueCallback:l=>parseInt(l,10)}),era:q({matchPatterns:Nr,defaultMatchWidth:"wide",parsePatterns:qr,defaultParseWidth:"any"}),quarter:q({matchPatterns:zr,defaultMatchWidth:"wide",parsePatterns:Hr,defaultParseWidth:"any",valueCallback:l=>l+1}),month:q({matchPatterns:Fr,defaultMatchWidth:"wide",parsePatterns:Wr,defaultParseWidth:"any"}),day:q({matchPatterns:Gr,defaultMatchWidth:"wide",parsePatterns:Zr,defaultParseWidth:"any"}),dayPeriod:q({matchPatterns:Kr,defaultMatchWidth:"any",parsePatterns:Vr,defaultParseWidth:"any"})},Jr={code:"zh-CN",formatDistance:Cr,formatLong:Er,formatRelative:Rr,localize:Or,match:jr,options:{weekStartsOn:1,firstWeekContainsDate:4}};class Xr{_game;constructor(e){this._game=e}load(e){return new Promise((t,i)=>{if(e===null){t();return}this._game.saveImportDropboxText(e,s=>{if(s){i(s);return}t()})})}loadRaw(e){const t=this._game.compressLZData(JSON.stringify(e));return this.load(t)}}class Re extends se{constructor(e,t){super(e,t),this.element.addClass(zi.toolbar)}toString(){return`[${Re.name}#${this.componentId}]`}addChild(e){return super.addChild(e)}}class Ht extends I{games=new Array;states=new Array;gameList;stateList;locale;constructor(e,t,i){console.debug(...f(`Constructing ${Ht.name}`));const s=e.host.engine.i18n("state.title");super(e,t,new ne(e,s,{classes:[B.checked,B.setting],icon:M.State}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefresh:()=>{this._refreshGameList(),this._refreshStateList()}}),this.gameList=new _(this,{hasDisableAll:!1,hasEnableAll:!1}),this.stateList=new _(this,{hasDisableAll:!1,hasEnableAll:!1}),this.locale=i.selected==="zh-CN"?Jr:i.selected==="he-IL"?kr:i.selected==="de-DE"?Ga:Wi,this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new k(this,this.setting.noConfirm,this.host.engine.i18n("state.noConfirm")),new se(this).addChild(new K(this)),new A(this,this.host.engine.i18n("state.local")),new Re(this).addChildren([new F(this,this.host.engine.i18n("state.import"),M.Import,{onClick:()=>{this.import()},title:this.host.engine.i18n("state.importTitle")})]),new se(this).addChild(new K(this)),new A(this,this.host.engine.i18n("state.localStates")),new Re(this).addChildren([new F(this,this.host.engine.i18n("state.store"),M.SaveAs,{onClick:()=>{this.storeState()},title:this.host.engine.i18n("state.storeState")}),new F(this,this.host.engine.i18n("copy"),M.Copy,{onClick:()=>{this.copyState().catch(H(console)),this.host.engine.imessage("state.copied.stateCurrent")},title:this.host.engine.i18n("state.copy.stateCurrent")}),new F(this,this.host.engine.i18n("state.new"),M.Draft,{onClick:()=>{this.storeStateFactoryDefaults(),this.host.engine.imessage("state.stored.state")},title:this.host.engine.i18n("state.storeFactory")}),new F(this,this.host.engine.i18n("state.exportAll"),M.Sync,{onClick:()=>{this.exportStateAll()},title:this.host.engine.i18n("state.exportAllTitle")})]),new se(this).addChild(this.stateList),new se(this).addChild(new K(this)),new A(this,this.host.engine.i18n("state.localGames")),new Re(this).addChildren([new F(this,this.host.engine.i18n("state.store"),M.SaveAs,{onClick:()=>{this.storeGame(),this.host.engine.imessage("state.stored.game")},title:this.host.engine.i18n("state.storeGame")}),new F(this,this.host.engine.i18n("copy"),M.Copy,{onClick:()=>{this.copyGame().catch(H(console)),this.host.engine.imessage("state.copied.gameCurrent")},title:this.host.engine.i18n("state.copy.gameCurrent")})]),new se(this).addChild(this.gameList),new k(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(;!g(t);){const i=JSON.parse(t);this.games.push(new Ue(i)),t=localStorage.getItem(`ks.game.${++e}`)}}catch(i){console.error(...f(i))}}_storeGames(){let e=0,t=localStorage.getItem(`ks.game.${e}`);for(;!g(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(;!g(t);){const i=JSON.parse(t);ae.unknownAsEngineStateOrThrow(i.state),this.states.push(new Ue(i)),t=localStorage.getItem(`ks.state.${++e}`)}}catch(i){console.error(...f(i))}}_storeStates(){let e=0,t=localStorage.getItem(`ks.state.${e}`);for(;!g(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 Et(this,new fe(this,`${e.label} (${Ki(new Date(e.timestamp),{addSuffix:!0,locale:this.locale})})`,{onClick:()=>{this.loadGame(e.game).catch(H(console)),this.host.engine.imessage("state.loaded.game",[e.label])},title:new Date(e.timestamp).toLocaleString()})).addChildren([new T(this,{classes:[E.fillSpace]}),new V(this,M.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 V(this,M.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 V(this,M.Copy,this.host.engine.i18n("state.copy.game"),{onClick:()=>{this.copyGame(e.game).catch(H(console)),this.host.engine.imessage("state.copied.game",[e.label])}}),new V(this,M.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 Et(this,new fe(this,`${e.label} (${Ki(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 T(this,{classes:[E.fillSpace]}),new V(this,M.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 V(this,M.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 V(this,M.Copy,this.host.engine.i18n("state.copy.state"),{onClick:()=>{this.copyState(e.state).catch(H(console)),this.host.engine.imessage("state.copied.state",[e.label])}}),new V(this,M.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),s=this.setting.compress.enabled?this.host.game.compressLZData(i):i;await C.window.navigator.clipboard.writeText(s)}import(){const e=C.window.prompt(this.host.engine.i18n("state.loadPrompt"));if(g(e))return;const t=new Date().toDateString();let i=1;const s=()=>this.host.engine.i18n("state.importedState",[`${t} #${i++}`]),a=n=>{try{const o=ae.decodeSettings(n);this.storeState(o,s()),this.host.engine.imessage("state.imported.state");return}catch{}try{const o=JSON.parse(n),h=ae.decodeSettings(o.state);this.storeState(h,o.label),this.host.engine.imessage("state.imported.state");return}catch{}let r;try{r=JSON.parse(n)}catch{const h=this.host.game.decompressLZData(n);try{r=JSON.parse(h)}catch{if(n.match(/\\r?\\n/))return n.split(/\\r?\\n/).forEach(d=>{a(d)});throw new Nt("The provided input can not be parsed as anything we understand.")}}let c;if(!g(r)&&"ks"in r&&!g(r.ks)){const o=r.ks.state[0];c=this.storeState(o,s())??void 0,this.host.engine.imessage("state.imported.state"),r.ks=void 0}this.storeGame(r,c),this.host.engine.imessage("state.imported.game")};a(e)}storeGame(e,t){let i=t;return g(i)&&(i=C.window.prompt(this.host.engine.i18n("state.storeGame.prompt"))??void 0),g(i)?null:(i=(i===""?void 0:i)??this.host.engine.i18n("state.unlabeledGame"),i=i.substring(0,127),this.games.push(new Ue({game:e??this.host.game.save(),label:i,timestamp:new Date().toISOString()})),this._storeGames(),this.requestRefresh(),i)}storeState(e,t){let i=t;return g(i)&&(i=C.window.prompt(this.host.engine.i18n("state.storeState.prompt"))??void 0),g(i)?null:(i=(i===""?void 0:i)??this.host.engine.i18n("state.unlabeledState"),i=i.substring(0,127),this.states.push(new Ue({label:i,state:e??this.host.engine.stateSerialize(),timestamp:new Date().toISOString()})),this._storeStates(),this.requestRefresh(),i)}storeStateFactoryDefaults(){this.storeState(ee.DEFAULT_STATE)}storeAutoSave(e){const t=this.states.find(i=>i.unwrap().label==="Auto-Save");if(!g(t)){console.info(...f("Updating existing Auto-Save...")),t.replace({...t.unwrap(),state:e,timestamp:new Date().toISOString()}),this._storeStates(),this.requestRefresh();return}console.info(...f("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:ae.encodeSettings(a.state,!1),timestamp:a.timestamp})).join(`\n`),t=document.createElement("a"),i=new Blob([e],{type:"application/x-ndjson"}),s=URL.createObjectURL(i);t.setAttribute("href",s),t.setAttribute("download",`ks-local-states-${Date.now()}.ndjson`),t.click()}async loadGame(e){this._destructiveActionPrevented()||await new Xr(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(...f("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(g(e)){console.info(...f("No Auto-Save settings found."));return}console.info(...f("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&&!C.window.confirm(this.host.engine.i18n("state.confirmDestruction"))}}class _e extends me{setting;constructor(e,t,i,s){super(e,new ne(e,t,{classes:[B.checked,B.setting],icon:s?.icon}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),s),this.setting=i}}class Yr extends _e{_buildings;constructor(e,t,i){const s=e.host.engine.i18n("ui.build");super(e,s,t,{icon:M.Bonfire,onRefreshRequest:()=>{this.expando.ineffective=Object.values(t.buildings).some(n=>n.enabled&&n.trigger===-1)}}),this._buildings=[];for(const n of this.host.game.bld.buildingGroups){this._buildings.push(new A(this,n.title));for(const r of n.buildings){if(r==="unicornPasture"||g(this.setting.buildings[r]))continue;const c=this.host.game.bld.getBuildingExt(r).meta;if(g(c.stages))g(c.label)||this._buildings.push(this._getResetOption(this,this.setting.buildings[r],i,t,c.label));else{const o=Object.values(this.setting.buildings).find(h=>h.baseBuilding===r)?.building;this._buildings.push(this._getResetOption(this,this.setting.buildings[r],i,t,c.stages[0].label),this._getResetOption(this,this.setting.buildings[o],i,t,c.stages[1].label,!1,!0))}}n!==this.host.game.bld.buildingGroups[this.host.game.bld.buildingGroups.length-1]&&this._buildings.at(-1)?.element.addClass(ge.delimiter)}const a=new _(this);a.addChildren(this._buildings),this.addChildContent(a)}_getResetOption(e,t,i,s,a,n=!1,r=!1){const c=new U(e,t,i,a,{delimiter:n,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[a])},onRefreshRequest:()=>{c.triggerButton.inactive=!t.enabled||t.trigger===0,c.triggerButton.ineffective=t.enabled&&t.trigger===-1},onSetTrigger:async()=>{const o=await x.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(o!==void 0){if(o===""||o.startsWith("-")){t.trigger=-1,t.enabled=!1;return}o==="0"&&(t.enabled=!1),t.trigger=Number(o)}},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[a])},upgradeIndicator:r});return c.triggerButton.element.addClass(w.lastHeadAction),c}}class Qr extends _e{constructor(e,t,i){const s=e.host.engine.i18n("ui.faith");super(e,s,t,{icon:M.Religion,onRefreshRequest:()=>{this.expando.ineffective=Object.values(t.buildings).some(n=>n.enabled&&n.trigger===-1)}}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]})]);const a=[...Ne];this.addChildContent(new _(this).addChildren([new A(this,this.host.engine.i18n("$religion.panel.ziggurat.label")),this._getResetOption(this,this.setting.buildings.unicornPasture,i,t,this.host.engine.i18n("$buildings.unicornPasture.label")),...this.host.game.religion.zigguratUpgrades.filter(n=>a.includes(n.name)&&!g(this.setting.buildings[n.name])).map(n=>this._getResetOption(this,this.setting.buildings[n.name],i,t,n.label)),new K(this),...this.host.game.religion.zigguratUpgrades.filter(n=>!a.includes(n.name)&&!g(this.setting.buildings[n.name])).map(n=>this._getResetOption(this,this.setting.buildings[n.name],i,t,n.label)),new K(this),new A(this,this.host.engine.i18n("$religion.panel.orderOfTheSun.label")),...this.host.game.religion.religionUpgrades.filter(n=>!g(this.setting.buildings[n.name])).map(n=>this._getResetOption(this,this.setting.buildings[n.name],i,t,n.label,n.name===this.host.game.religion.religionUpgrades.at(-1)?.name)),new A(this,this.host.engine.i18n("$religion.panel.cryptotheology.label")),...this.host.game.religion.transcendenceUpgrades.filter(n=>!g(this.setting.buildings[n.name])).map(n=>this._getResetOption(this,this.setting.buildings[n.name],i,t,n.label))]))}_getResetOption(e,t,i,s,a,n=!1,r=!1){const c=new U(e,t,i,a,{delimiter:n,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[a])},onRefreshRequest:()=>{c.triggerButton.inactive=!t.enabled||t.trigger===0,c.triggerButton.ineffective=t.enabled&&t.trigger===-1},onSetTrigger:async()=>{const o=await x.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(o!==void 0){if(o===""||o.startsWith("-")){t.trigger=-1,t.enabled=!1;return}o==="0"&&(t.enabled=!1),t.trigger=Number(o)}},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[a])},upgradeIndicator:r});return c.triggerButton.element.addClass(w.lastHeadAction),c}}class eo extends _e{constructor(e,t,i){const s=e.host.engine.i18n("ui.resources");super(e,s,t,{icon:M.Resources,onRefreshRequest:()=>{this.expando.ineffective=Object.values(t.resources).some(c=>c.enabled&&c.trigger===-1)}}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]})]);const a=this.host.game.resPool.resources,n=[];let r=a[0].title;for(const c of[...a].sort((o,h)=>o.title.localeCompare(h.title,i.selected))){const o=this.setting.resources[c.name],h=new U(this,o,i,W(c.title),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[c.title])},onRefreshRequest:()=>{h.triggerButton.inactive=!o.enabled||o.trigger===0,h.triggerButton.ineffective=o.enabled&&o.trigger===-1},onSetTrigger:async()=>{const u=await x.prompt(this,this.host.engine.i18n("ui.trigger.prompt.float"),this.host.engine.i18n("ui.trigger.build.prompt",[c.title,o.trigger!==-1?this.host.renderAbsolute(o.trigger,i.selected):this.host.engine.i18n("ui.trigger.inactive")]),o.trigger!==-1?this.host.renderAbsolute(o.trigger):"",this.host.engine.i18n("ui.trigger.reset.promptExplainer"));if(u!==void 0){if(u===""||u.startsWith("-")){o.trigger=-1,o.enabled=!1;return}u==="0"&&(o.enabled=!1),o.trigger=e.host.parseAbsolute(u)??o.trigger}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[c.title])}});h.triggerButton.element.addClass(w.lastHeadAction),this.host.engine.localeSupportsFirstLetterSplits(i.selected)&&r[0]!==c.title[0]&&h.element.addClass(E.splitter),n.push(h),r=c.title}this.addChildContent(new _(this).addChildren(n))}}class to extends _e{constructor(e,t,i){const s=e.host.engine.i18n("ui.space");super(e,s,t,{icon:M.Space,onRefreshRequest:()=>{this.expando.ineffective=Object.values(t.buildings).some(a=>a.enabled&&a.trigger===-1)}}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]})]),this.addChildContent(new _(this).addChildren(this.host.game.space.planets.filter(a=>0<a.buildings.length).flatMap((a,n,r)=>[new A(this,this.host.engine.labelForPlanet(a.name)),...a.buildings.filter(c=>!g(this.setting.buildings[c.name])).map((c,o,h)=>this._getResetOption(this,this.setting.buildings[c.name],i,t,c.label,n<r.length-1&&o===h.length-1))])))}_getResetOption(e,t,i,s,a,n=!1,r=!1){const c=new U(e,t,i,a,{delimiter:n,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[a])},onRefreshRequest:()=>{c.triggerButton.inactive=!t.enabled||t.trigger===0,c.triggerButton.ineffective=t.enabled&&t.trigger===-1},onSetTrigger:async()=>{const o=await x.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(o!==void 0){if(o===""||o.startsWith("-")){t.trigger=-1,t.enabled=!1;return}o==="0"&&(t.enabled=!1),t.trigger=Number(o)}},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[a])},upgradeIndicator:r});return c.triggerButton.element.addClass(w.lastHeadAction),c}}class io extends _e{constructor(e,t,i){const s=e.host.engine.i18n("ui.time");super(e,s,t,{icon:M.Time,onRefreshRequest:()=>{this.expando.ineffective=Object.values(t.buildings).some(a=>a.enabled&&a.trigger===-1)}}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]})]),this.addChildContent(new _(this).addChildren([new A(this,this.host.engine.i18n("$workshop.chronoforge.label")),...this.host.game.time.chronoforgeUpgrades.filter(a=>!g(this.setting.buildings[a.name])).map(a=>this._getResetOption(this,this.setting.buildings[a.name],i,t,a.label,a.name===this.host.game.time.chronoforgeUpgrades.at(-1)?.name)),new A(this,this.host.engine.i18n("$science.voidSpace.label")),...this.host.game.time.voidspaceUpgrades.filter(a=>a.name in this.setting.buildings).map(a=>this._getResetOption(this,this.setting.buildings[a.name],i,t,a.label))]))}_getResetOption(e,t,i,s,a,n=!1,r=!1){const c=new U(e,t,i,a,{delimiter:n,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[a])},onRefreshRequest:()=>{c.triggerButton.inactive=!t.enabled||t.trigger===0,c.triggerButton.ineffective=t.enabled&&t.trigger===-1},onSetTrigger:async()=>{const o=await x.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(o!==void 0){if(o===""||o.startsWith("-")){t.trigger=-1,t.enabled=!1;return}o==="0"&&(t.enabled=!1),t.trigger=Number(o)}},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[a])},upgradeIndicator:r});return c.triggerButton.element.addClass(w.lastHeadAction),c}}class so extends _e{constructor(e,t,i){const s=e.host.engine.i18n("ui.upgrades");super(e,s,t,{icon:M.Workshop}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]})]);const a=this.host.game.workshop.upgrades.filter(o=>!g(this.setting.upgrades[o.name])),n=[];let r=a[0].label,c;for(const o of a.sort((h,u)=>h.label.localeCompare(u.label,i.selected))){const h=this.setting.upgrades[o.name],u=this._getResetOption(this,h,o.label);this.host.engine.localeSupportsFirstLetterSplits(i.selected)&&r[0]!==o.label[0]&&(g(c)||c.element.addClass(ge.delimiter),u.element.addClass(E.splitter)),c=u,n.push(u),r=o.label}this.addChildContent(new _(this).addChildren(n))}_getResetOption(e,t,i,s=!1,a=!1){return new k(e,t,i,{delimiter:s,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[i])},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[i])},upgradeIndicator:a})}}class no extends I{_bonfireUi;_religionUi;_resourcesUi;_spaceUi;_timeUi;_upgradesUi;constructor(e,t,i){const s=e.host.engine.i18n("option.time.reset");super(e,t,new k(e,t,s,{onCheck:n=>{e.host.engine.imessage("status.auto.enable",[s])},onUnCheck:n=>{e.host.engine.imessage("status.auto.disable",[s])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&([this._bonfireUi,this._religionUi,this._resourcesUi,this._spaceUi,this._timeUi,this._upgradesUi].some(n=>n.expando.ineffective)||!Object.values(this.setting.bonfire.buildings).some(n=>n.enabled)&&!Object.values(this.setting.religion.buildings).some(n=>n.enabled)&&!Object.values(this.setting.resources.resources).some(n=>n.enabled)&&!Object.values(this.setting.space.buildings).some(n=>n.enabled)&&!Object.values(this.setting.time.buildings).some(n=>n.enabled)&&!Object.values(this.setting.upgrades.upgrades).some(n=>n.enabled))}});const a=new _(this,{hasDisableAll:!1,hasEnableAll:!1});this._bonfireUi=new Yr(this,this.setting.bonfire,i),this._religionUi=new Qr(this,this.setting.religion,i),this._resourcesUi=new eo(this,this.setting.resources,i),this._spaceUi=new to(this,this.setting.space,i),this._timeUi=new io(this,this.setting.time,i),this._upgradesUi=new so(this,this.setting.upgrades,i),a.addChildren([this._bonfireUi,this._religionUi,this._resourcesUi,this._spaceUi,this._timeUi,this._upgradesUi]),this.addChildContent(a)}}class Xi extends _{setting;constructor(e,t,i){super(e,i),this.setting=t;const s=(n,r)=>{const c=e.host.engine.labelForCycle(n);return new k(e,r,c,{onCheck:o=>{i?.onCheckCycle?.(c,r,o)},onUnCheck:o=>{i?.onUnCheckCycle?.(c,r,o)}})},a=[s("charon",this.setting.charon),s("umbra",this.setting.umbra),s("yarn",this.setting.yarn),s("helios",this.setting.helios),s("cath",this.setting.cath),s("redmoon",this.setting.redmoon),s("dune",this.setting.dune),s("piscine",this.setting.piscine),s("terminus",this.setting.terminus),s("kairo",this.setting.kairo)];this.addChildren(a),this.element[0].addEventListener("enableAll",()=>{for(const n of a)n.check(!0)}),this.element[0].addEventListener("disableAll",()=>{for(const n of a)n.uncheck(!0)})}}class tt extends _{setting;spring;summer;autumn;winter;constructor(e,t,i){super(e,i),this.setting=t;const s=(a,n)=>new k(this,n,a,{onCheck:r=>{i?.onCheckSeason?.(a,n,r)},onUnCheck:r=>{i?.onUnCheckSeason?.(a,n,r)}});this.spring=s(this.host.engine.i18n("$calendar.season.spring"),this.setting.spring),this.summer=s(this.host.engine.i18n("$calendar.season.summer"),this.setting.summer),this.autumn=s(this.host.engine.i18n("$calendar.season.autumn"),this.setting.autumn),this.winter=s(this.host.engine.i18n("$calendar.season.winter"),this.setting.winter),this.addChildren([this.spring,this.summer,this.autumn,this.winter])}toString(){return`[${tt.name}#${this.componentId}]`}}class ao extends I{constructor(e,t,i,s,a){const n=e.host.engine.i18n("option.time.activeHeatTransfer");super(e,t,new U(e,t,i,n,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[n])},onSetTrigger:async()=>{const r=await x.prompt(e,e.host.engine.i18n("ui.trigger.activeHeatTransfer.prompt"),e.host.engine.i18n("ui.trigger.activeHeatTransfer.promptTitle",[e.host.renderPercentage(t.trigger,i.selected,!0)]),e.host.renderPercentage(t.trigger),e.host.engine.i18n("ui.trigger.activeHeatTransfer.promptExplainer"));r===void 0||r===""||r.startsWith("-")||(t.trigger=e.host.parsePercentage(r))},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[n]),t.activeHeatTransferStatus.enabled=!1}}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled,this.settingItem.triggerButton.ineffective=a.enabled&&s.enabled&&t.enabled&&t.trigger===-1,this.expando.ineffective=a.enabled&&s.enabled&&t.enabled&&!Object.values(t.cycles).some(r=>r.enabled),t.activeHeatTransferStatus.enabled?(this.head.elementLabel.attr("data-ks-active-from","◎"),this.head.elementLabel.attr("data-ks-active-to","◎"),this.head.elementLabel.addClass(Je.active)):this.head.elementLabel.removeClass(Je.active)}}),this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new Xi(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 ro extends I{_cycles;_seasons;_activeHeatTransferUI;constructor(e,t,i,s){const a=e.host.engine.i18n("option.time.skip");super(e,t,new je(e,t,i,a,{onCheck:n=>{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 n=await x.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(n!==void 0){if(n===""||n.startsWith("-")){t.max=-1;return}n==="0"&&(t.enabled=!1),t.max=e.host.parseAbsolute(n)??t.max}},onSetTrigger:async()=>{const n=await x.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"));n===void 0||n===""||n.startsWith("-")||(t.trigger=e.host.parseAbsolute(n)??t.trigger)},onUnCheck:n=>{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=s.enabled&&t.enabled&&t.max===0,this._cycles.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.cycles).some(n=>n.enabled),this._seasons.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.seasons).some(n=>n.enabled)}}),this.settingItem.triggerButton.element.removeClass(w.lastHeadAction),this._cycles=new me(this,new ne(this,W(this.host.engine.i18n("ui.cycles")),{classes:[B.checked,B.setting],icon:M.Cycles}).addChildrenHead([new T(this,{classes:[E.fillSpace]})])).addChildrenContent([new Xi(this,this.setting.cycles,{onCheckCycle:n=>{this.host.engine.imessage("time.skip.cycle.enable",[n])},onUnCheckCycle:n=>{this.host.engine.imessage("time.skip.cycle.disable",[n])}})]),this._seasons=new me(this,new ne(this,W(this.host.engine.i18n("trade.seasons")),{classes:[B.checked,B.setting],icon:M.Seasons}).addChildrenHead([new T(this,{classes:[E.fillSpace]})])).addChildrenContent([new tt(this,this.setting.seasons,{onCheckSeason:n=>{this.host.engine.imessage("time.skip.season.enable",[n])},onUnCheckSeason:n=>{this.host.engine.imessage("time.skip.season.disable",[n])}})]),this._activeHeatTransferUI=new ao(this,this.setting.activeHeatTransfer,i,t,s),this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([this._cycles,this._seasons,new k(this,this.setting.ignoreOverheat,this.host.engine.i18n("option.time.skip.ignoreOverheat")),this._activeHeatTransferUI]))}}class Ft extends I{_items;_accelerateTime;_timeSkipUi;_resetUi;constructor(e,t,i){console.debug(...f(`Constructing ${Ft.name}`));const s=e.host.engine.i18n("ui.timeCtrl");super(e,t,new k(e,t,s,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[s])},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[s])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&[this._timeSkipUi,this._resetUi].some(r=>r.expando.ineffective)}});const a=new _(this,{hasDisableAll:!1,hasEnableAll:!1}),n=this.host.engine.i18n("option.accelerate");this._accelerateTime=new U(this,this.setting.accelerateTime,i,n,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[n])},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 r=await x.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"));r===void 0||r===""||r.startsWith("-")||(this.setting.accelerateTime.trigger=this.host.parsePercentage(r))},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[n])}}),this._accelerateTime.triggerButton.element.addClass(w.lastHeadAction),this._timeSkipUi=new ro(this,this.setting.timeSkip,i,t),this._resetUi=new no(this,this.setting.reset,i),this._items=[this._accelerateTime,this._timeSkipUi,this._resetUi],a.addChildren(this._items),this.addChildContent(a)}}class Wt extends I{constructor(e,t,i){console.debug(...f(`Constructing ${Wt.name}`));const s=e.host.engine.i18n("ui.time");super(e,t,new U(e,t,i,s,{onCheck:a=>{e.host.engine.imessage("status.auto.enable",[s])},onRefresh:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1},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 a=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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(a!==void 0){if(a===""||a.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(a)}},onUnCheck:a=>{e.host.engine.imessage("status.auto.disable",[s])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger<0,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger<0&&Object.values(t.buildings).some(a=>a.enabled&&0<a.max&&a.trigger<0),this.expando.ineffective=t.enabled&&Object.values(t.buildings).some(a=>a.enabled&&(a.max===0||a.trigger<0&&t.trigger<0))}}),this.addChildrenContent([new _(this).addChildren([new A(this,this.host.engine.i18n("$workshop.chronoforge.label")),...this.host.game.time.chronoforgeUpgrades.filter(a=>!g(this.setting.buildings[a.name])).map(a=>te.getBuildOption(this,this.setting.buildings[a.name],i,this.setting,a.label,s,{delimiter:a.name===this.host.game.time.chronoforgeUpgrades.at(-1)?.name,renderLabelTrigger:!1})),new A(this,this.host.engine.i18n("$science.voidSpace.label")),...this.host.game.time.voidspaceUpgrades.filter(a=>a.name in this.setting.buildings).map(a=>te.getBuildOption(this,this.setting.buildings[a.name],i,this.setting,a.label,s,{renderLabelTrigger:!1}))]),new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new A(this,this.host.engine.i18n("ui.additional")),new k(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 oo={buyButton:"_buyButton_10eul_1"};class Gt extends fe{setting;constructor(e,t,i,s){super(e,void 0,{onClick:async()=>{const a=await x.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:()=>{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)])),s?.onRefresh?.call(this)}}),this.element.addClass(oo.buyButton),this.setting=t}toString(){return`[${Gt.name}#${this.componentId}]`}}const lo={sellButton:"_sellButton_1tmvd_1"};class Zt extends fe{setting;constructor(e,t,i,s){super(e,void 0,{onClick:async()=>{const a=await x.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:()=>{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)])),s?.onRefresh?.()}}),this.element.addClass(lo.sellButton),this.setting=t}toString(){return`[${Zt.name}#${this.componentId}]`}}class it extends F{setting;constructor(e,t,i){super(e,"",M.Eco,{border:!1,classes:[],onClick:()=>{this.setting.limited=!this.setting.limited,this.setting.limited?i?.onLimitedCheck?.call(this):i?.onLimitedUnCheck?.call(this)},onRefresh:()=>{this.updateTitle(this.host.engine.i18n(this.setting.limited?"ui.limited.on":"ui.limited.off")),this.setting.limited&&!this.inactive?this.element.removeClass(w.inactive):this.element.addClass(w.inactive),i?.onRefresh?.call(this)}}),this.setting=t;for(const s of i?.classes??[])this.element.addClass(s)}toString(){return`[${it.name}#${this.componentId}]`}}class Kt extends k{limitedButton;constructor(e,t,i,s){super(e,t,i,s),this.limitedButton=new it(e,t,{border:!1,onLimitedCheck:s?.onLimitedCheck?()=>s.onLimitedCheck?.call(this):void 0,onLimitedUnCheck:s?.onLimitedUnCheck?()=>s.onLimitedUnCheck?.call(this):void 0}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.limitedButton])}toString(){return`[${Kt.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class Vt extends Kt{triggerButton;constructor(e,t,i,s,a){super(e,t,s,a),this.triggerButton=new ke(e,t,i,{border:!1,onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a?.onRefreshTrigger?()=>a.onRefreshTrigger?.call(this):void 0,renderLabel:a?.renderLabelTrigger??!0}),this.addChildHead(this.triggerButton)}toString(){return`[${Vt.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class st extends k{maxButton;constructor(e,t,i,s){super(e,t,i,s),this.maxButton=new Ee(e,t,{border:!1,onClick:async()=>{await s.onSetMax.call(this)},onRefresh:s?.onRefreshMax?()=>s.onRefreshMax?.call(this):void 0}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.maxButton])}toString(){return`[${st.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class co extends I{constructor(e,t,i,s){const a=e.host.engine.i18n("option.embassies");super(e,t,new U(e,t,i,a,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[a])},onSetTrigger:async()=>{const r=await x.prompt(e,e.host.engine.i18n("ui.trigger.embassies.prompt"),e.host.engine.i18n("ui.trigger.embassies.promptTitle",[e.host.renderPercentage(t.trigger,i.selected,!0)]),e.host.renderPercentage(t.trigger),e.host.engine.i18n("ui.trigger.embassies.promptExplainer"));r===void 0||r===""||r.startsWith("-")||(t.trigger=e.host.parsePercentage(r))},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[a])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger===-1,this.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.races).some(r=>r.enabled)}});const n=new _(this).addChildren(this.host.game.diplomacy.races.filter(r=>r.name!=="leviathans"&&!g(this.setting.races[r.name])).map(r=>this._makeEmbassySetting(this,this.setting.races[r.name],i.selected,t,r.title)));this.addChildContent(n)}_makeEmbassySetting(e,t,i,s,a){const n=async()=>{const c=await x.prompt(e,e.host.engine.i18n("ui.max.prompt.absolute"),e.host.engine.i18n("ui.max.build.prompt",[a,e.host.renderAbsolute(t.max,i)]),e.host.renderAbsolute(t.max),e.host.engine.i18n("ui.max.build.promptExplainer"));if(c!==void 0){if(c===""||c.startsWith("-")){t.max=-1;return}c==="0"&&(t.enabled=!1),t.max=e.host.parseAbsolute(c)??t.max}},r=new st(e,t,a,{onCheck:c=>{if(e.host.engine.imessage("status.sub.enable",[a]),t.max===0&&!c)return n()},onRefresh:()=>{r.maxButton.inactive=!t.enabled||t.max===-1,r.maxButton.ineffective=s.enabled&&t.enabled&&t.max===0},onRefreshMax:()=>{r.maxButton.updateLabel(e.host.renderAbsolute(t.max)),r.maxButton.element[0].title=t.max<0?e.host.engine.i18n("ui.max.embassy.titleInfinite",[a]):t.max===0?e.host.engine.i18n("ui.max.embassy.titleZero",[a]):e.host.engine.i18n("ui.max.embassy.title",[e.host.renderAbsolute(t.max),a])},onSetMax:n,onUnCheck:()=>{e.host.engine.imessage("status.sub.disable",[a])}});return r.maxButton.element.addClass(w.lastHeadAction),r}}class jt extends I{_racePanels;constructor(e,t,i){console.debug(...f(`Constructing ${jt.name}`));const s=e.host.engine.i18n("ui.trade");super(e,t,new U(e,t,i,s,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[s])},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 x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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",[s])},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(r=>r.enabled&&r.trigger<0),this.expando.ineffective=t.enabled&&Object.values(this._racePanels).some(r=>r.expando.ineffective||r.settingItem.triggerButton.ineffective)}}),this._racePanels=this.host.game.diplomacy.races.filter(r=>!g(this.setting.races[r.name])).map(r=>this._getTradeOption(this,this.setting.races[r.name],i,t,r.title,s,r.name===this.host.game.diplomacy.races.at(-2)?.name));const a=new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren(this._racePanels);a.addChild(new k(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 I(this,this.setting.tradeBlackcoin,new U(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 r=await x.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"));r===void 0||r===""||r.startsWith("-")||(this.setting.tradeBlackcoin.trigger=this.host.parseAbsolute(r)??this.setting.tradeBlackcoin.trigger)},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.crypto")])}})).addChildrenContent([new Gt(this,this.setting.tradeBlackcoin,i),new Zt(this,this.setting.tradeBlackcoin,i)])),this.addChildContent(a);const n=new _(this,{hasDisableAll:!1,hasEnableAll:!1});n.addChild(new A(this,this.host.engine.i18n("ui.additional"))),n.addChild(new co(this,this.setting.buildEmbassies,i,t)),n.addChild(new k(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(n)}_getTradeOption(e,t,i,s,a,n,r=!1,c=!1){const o=new Vt(e,t,i,a,{delimiter:r,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:()=>{o.triggerButton.element[0].title=e.host.engine.i18n("ui.trigger",[t.trigger<0?s.trigger<0?e.host.engine.i18n("ui.trigger.section.blocked",[n]):`${e.host.renderPercentage(s.trigger,i.selected,!0)} (${e.host.engine.i18n("ui.trigger.section.inherited")})`:e.host.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const u=await x.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(u!==void 0){if(u===""||u.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(u)}},onUnCheck:()=>{e.host.engine.imessage("status.sub.disable",[a])},renderLabelTrigger:!1,upgradeIndicator:c}),h=new I(e,t,o,{onRefreshRequest:()=>{o.limitedButton.inactive=!t.enabled||!t.limited,o.triggerButton.inactive=!t.enabled||t.trigger===-1,o.triggerButton.ineffective=s.enabled&&t.enabled&&s.trigger===-1&&t.trigger===-1,h.expando.ineffective=s.enabled&&t.enabled&&!t.seasons.autumn.enabled&&!t.seasons.spring.enabled&&!t.seasons.summer.enabled&&!t.seasons.winter.enabled}}).addChildContent(new tt(e,t.seasons,{onCheckSeason:u=>{e.host.engine.imessage("trade.season.enable",[W(a),u])},onUnCheckSeason:u=>{e.host.engine.imessage("trade.season.disable",[W(a),u])}}));return h}}const Jt={spacer:"_spacer_90nk2_45",ui:"_ui_90nk2_50",showActivity:"_showActivity_90nk2_67"};class Xt extends I{_hunt;_festivals;_promoteKittens;_promoteLeader;_electLeader;constructor(e,t,i){console.debug(...f(`Constructing ${Xt.name}`));const s=e.host.engine.i18n("ui.distribute");super(e,t,new k(e,t,s,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[s])},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[s])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&Object.values(t.jobs).some(r=>r.enabled&&r.max===0)}});const a=new _(this).addChildren(this.host.game.village.jobs.filter(r=>!g(this.setting.jobs[r.name])).map(r=>this._getDistributeOption(this.setting.jobs[r.name],i.selected,t,r.title)));this.addChildContent(a);const n=new _(this,{hasDisableAll:!1,hasEnableAll:!1});n.addChild(new A(this,this.host.engine.i18n("ui.additional"))),this._hunt=new U(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 r=await x.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"));r===void 0||r===""||r.startsWith("-")||(this.setting.hunt.trigger=this.host.parsePercentage(r))},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.hunt")])}}),this._hunt.triggerButton.element.addClass(w.lastHeadAction),n.addChild(this._hunt),this._festivals=new k(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")])}}),n.addChild(this._festivals),this._promoteKittens=new U(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 r=await x.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"));r===void 0||r===""||r.startsWith("-")||(this.setting.promoteKittens.trigger=this.host.parsePercentage(r))},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.promotekittens")])}}),this._promoteKittens.triggerButton.element.addClass(w.lastHeadAction),n.addChild(this._promoteKittens),this._promoteLeader=new k(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")])}}),n.addChild(this._promoteLeader);for(const r of this.setting.electLeader.job.options)r.value==="any"?r.label=this.host.engine.i18n("option.elect.job.any"):r.label=this.host.engine.i18n(`$village.job.${r.value}`);for(const r of this.setting.electLeader.trait.options)r.label=this.host.engine.i18n(`$village.trait.${r.value}`);this._electLeader=new k(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 Me(this,this.host.engine.i18n("option.elect.job"),this.setting.electLeader.job),new Me(this,this.host.engine.i18n("option.elect.trait"),this.setting.electLeader.trait)]),n.addChild(this._electLeader),this.addChildContent(n)}_getDistributeOption(e,t,i,s,a=!1){const n=async()=>{const c=await x.prompt(this,this.host.engine.i18n("ui.max.distribute.prompt",[s]),this.host.engine.i18n("ui.max.distribute.promptTitle",[s,this.host.renderAbsolute(e.max,t)]),this.host.renderAbsolute(e.max),this.host.engine.i18n("ui.max.distribute.promptExplainer"));if(c!==void 0){if(c===""||c.startsWith("-")){e.max=-1;return}c==="0"&&(e.enabled=!1),e.max=this.host.parseAbsolute(c)??e.max}},r=new st(this,e,s,{delimiter:a,onCheck:c=>{if(this.host.engine.imessage("status.sub.enable",[s]),e.max===0&&!c)return n()},onRefresh:()=>{r.maxButton.inactive=!e.enabled||e.max===-1,r.maxButton.ineffective=i.enabled&&e.enabled&&e.max===0},onRefreshMax:()=>{r.maxButton.updateLabel(this.host.renderAbsolute(e.max)),r.maxButton.element[0].title=e.max<0?this.host.engine.i18n("ui.max.distribute.titleInfinite",[s]):e.max===0?this.host.engine.i18n("ui.max.distribute.titleZero",[s]):this.host.engine.i18n("ui.max.distribute.title",[this.host.renderAbsolute(e.max),s])},onSetMax:n,onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[s])}});return r.maxButton.element.addClass(w.lastHeadAction),r}}class Yt extends k{limitedButton;maxButton;triggerButton;constructor(e,t,i,s,a){super(e,t,s,a),this.limitedButton=new it(e,t,{...a,classes:[Ge.headAction]}),this.maxButton=new Ee(e,t,{alignment:"right",border:!1,classes:[w.headAction],onClick:()=>a.onSetMax.call(this),onRefresh:a?.onRefreshMax?()=>a.onRefreshMax?.call(this):void 0}),this.triggerButton=new ke(e,t,i,{border:!1,classes:[w.lastHeadAction],onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a?.onRefreshTrigger?()=>a.onRefreshTrigger?.call(this):void 0,renderLabel:a?.renderLabelTrigger??!0}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.limitedButton,this.maxButton,this.triggerButton])}toString(){return`[${Yt.name}#${this.componentId}]`}}class ho extends I{constructor(e,t,i){const s=e.host.engine.i18n("ui.upgrade.upgrades");super(e,t,new U(e,t,i,s,{onCheck:o=>{e.host.engine.imessage("status.auto.enable",[s])},onRefreshTrigger(){this.triggerButton.element[0].title=e.host.engine.i18n("ui.trigger",[t.trigger===-1?e.host.engine.i18n("ui.trigger.section.inactive"):e.host.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const o=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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",[s])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger<0&&Object.values(t.upgrades).some(o=>o.enabled&&o.trigger<0),this.expando.ineffective=t.enabled&&!Object.values(t.upgrades).some(o=>o.enabled)}});const a=this.host.game.workshop.upgrades.filter(o=>!g(this.setting.upgrades[o.name])),n=[];let r=a[0].label,c;for(const o of a.sort((h,u)=>h.label.localeCompare(u.label,i.selected))){const h=this.setting.upgrades[o.name],u=new U(this,h,i,o.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o.label])},onRefreshRequest:()=>{u.triggerButton.inactive=!h.enabled||h.trigger===-1,u.triggerButton.ineffective=t.enabled&&h.enabled&&t.trigger===-1&&h.trigger===-1},onRefreshTrigger:()=>{u.triggerButton.element[0].title=this.host.engine.i18n("ui.trigger",[h.trigger<0?t.trigger<0?this.host.engine.i18n("ui.trigger.build.blocked",[s]):`${this.host.renderPercentage(t.trigger,i.selected,!0)} (${this.host.engine.i18n("ui.trigger.section.inherited")})`:this.host.renderPercentage(h.trigger,i.selected,!0)])},onSetTrigger:async()=>{const d=await x.prompt(this,this.host.engine.i18n("ui.trigger.prompt.percentage"),this.host.engine.i18n("ui.trigger.section.prompt",[s,h.trigger!==-1?this.host.renderPercentage(h.trigger,i.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(d!==void 0){if(d===""||d.startsWith("-")){h.trigger=-1;return}h.trigger=this.host.parsePercentage(d)}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o.label])},renderLabelTrigger:!1});u.triggerButton.element.addClass(w.lastHeadAction),this.host.engine.localeSupportsFirstLetterSplits(i.selected)&&r[0]!==o.label[0]&&(g(c)||c.element.addClass(ge.delimiter),u.element.addClass(E.splitter)),c=u,n.push(u),r=o.label}this.addChildContent(new _(this).addChildren(n))}}class Qt extends I{_crafts;constructor(e,t,i){console.debug(...f(`Constructing ${Qt.name}`));const s=e.host.engine.i18n("ui.craft");super(e,t,new U(e,t,i,s,{onCheck:c=>{e.host.engine.imessage("status.auto.enable",[s])},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 c=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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(c!==void 0){if(c===""||c.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(c)}},onUnCheck:c=>{e.host.engine.imessage("status.auto.disable",[s])},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(c=>c.enabled&&c.max!==0&&c.trigger<0)}});let a=[];game.challenges.getChallenge("ironWill").active||(this.setting.resources.bloodstone.enabled=!1,this.setting.resources.tMythril.enabled=!1,a=["bloodstone","tMythril"]);const n=this.host.game.workshop.crafts.filter(c=>!a.includes(c.name)&&!g(this.setting.resources[c.name])).map(c=>[this.setting.resources[c.name],W(c.label)]);this._crafts=[];for(const[c,o]of n){const h=async()=>{const d=await x.prompt(this,this.host.engine.i18n("ui.max.craft.prompt",[o]),this.host.engine.i18n("ui.max.craft.promptTitle",[o,this.host.renderAbsolute(c.max,i.selected)]),this.host.renderAbsolute(c.max),this.host.engine.i18n("ui.max.craft.promptExplainer"));if(d!==void 0){if(d===""||d.startsWith("-")){c.max=-1;return}d==="0"&&(c.enabled=!1),c.max=this.host.parseAbsolute(d)??c.max}},u=new Yt(this,c,i,o,{delimiter:c.resource==="kerosene"||c.resource==="blueprint",onCheck:d=>{if(this.host.engine.imessage("status.sub.enable",[o]),c.max===0&&!d)return h()},onLimitedCheck:()=>{this.host.engine.imessage("craft.limited",[o])},onLimitedUnCheck:()=>{this.host.engine.imessage("craft.unlimited",[o])},onRefreshMax:()=>{u.maxButton.updateLabel(this.host.renderAbsolute(c.max)),u.maxButton.element[0].title=c.max<0?this.host.engine.i18n("ui.max.craft.titleInfinite",[o]):c.max===0?this.host.engine.i18n("ui.max.craft.titleZero",[o]):this.host.engine.i18n("ui.max.craft.title",[this.host.renderAbsolute(c.max),o])},onRefreshRequest:()=>{u.limitedButton.inactive=!c.enabled||!c.limited,u.maxButton.inactive=!c.enabled||c.max===-1,u.maxButton.ineffective=t.enabled&&c.enabled&&c.max===0,u.triggerButton.inactive=!c.enabled||c.trigger===-1,u.triggerButton.ineffective=t.enabled&&c.enabled&&t.trigger===-1&&c.trigger===-1},onRefreshTrigger:()=>{u.triggerButton.element[0].title=this.host.engine.i18n("ui.trigger",[c.trigger<0?t.trigger<0?this.host.engine.i18n("ui.trigger.build.blocked",[o]):`${this.host.renderPercentage(t.trigger,i.selected,!0)} (${this.host.engine.i18n("ui.trigger.build.inherited")})`:this.host.renderPercentage(c.trigger,i.selected,!0)])},onSetMax:h,onSetTrigger:async()=>{const d=await x.prompt(this,this.host.engine.i18n("ui.trigger.prompt.percentage"),this.host.engine.i18n("ui.trigger.section.prompt",[o,c.trigger!==-1?this.host.renderPercentage(c.trigger,i.selected,!0):this.host.engine.i18n("ui.trigger.build.inherited")]),c.trigger!==-1?this.host.renderPercentage(c.trigger):"",this.host.engine.i18n("ui.trigger.build.promptExplainer"));if(d!==void 0){if(d===""||d.startsWith("-")){c.trigger=-1;return}c.trigger=this.host.parsePercentage(d)}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o])},renderLabelTrigger:!1});this._crafts.push(u),c.resource==="ship"&&this._crafts.push(new k(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 r=new _(this,{onReset:()=>{this.setting.load({resources:new Fe().resources})}}).addChildren(this._crafts);this.addChildContent(r),this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new ho(this,this.setting.unlockUpgrades,i)]))}}class Ae extends D{showActivity;_engineUi;_sections;stateManagementUi;_refreshTimeout;constructor(e){console.debug(...f(`Constructing ${Ae.name}`)),super({host:e},{});const t=e.engine;this._engineUi=new Sn(this,t.settings),this.stateManagementUi=new Ht(this,t.settings.states,t.settings.locale),this._sections=[new Tt(this,t.bonfireManager.settings,t.settings.locale),new Xt(this,t.villageManager.settings,t.settings.locale),new Ut(this,t.scienceManager.settings,t.settings.locale),new Qt(this,t.workshopManager.settings,t.settings.locale),new Ot(this,t.settings.resources,t.settings.locale),new jt(this,t.tradeManager.settings,t.settings.locale),new It(this,t.religionManager.settings,t.settings.locale),new Dt(this,t.spaceManager.settings,t.settings.locale),new Wt(this,t.timeManager.settings,t.settings.locale),new Ft(this,t.timeControlManager.settings,t.settings.locale),new Bt(this,t.settings.filters),this.stateManagementUi,new At(this,t.settings,t.settings.locale)],this.parent=this,this.element=$("<div/>").addClass("kitten-scientists").addClass(Jt.ui);for(const o of[this._engineUi,...this._sections])this.addChild(o);const i=$("<ul/>");i.append(this._engineUi.element);for(const o of this._sections)i.append(o.element);this.element.append(i);const s=this._engineUi.expando;let a=!1;s.element.on("click",()=>{a=!a;for(const o of this._sections)o.toggle(a,!0)});let n=0;for(const o of this._sections)o.element[0].addEventListener("panelHidden",()=>{--n,n===0&&(a=!1),a||s.setCollapsed()}),o.element[0].addEventListener("panelShown",()=>{++n,a=!0,s.setExpanded()});this.showActivity=$("<span/>",{html:`<svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${M.Summary}"/></svg>`,title:e.engine.i18n("summary.show")}).addClass(Jt.showActivity),this.showActivity.on("click",()=>{e.engine.displayActivitySummary()}),$("#clearLog").prepend(this.showActivity);const r=t.settings.ksColumn.enabled&&game.colorScheme!=="sleek";r?$("#rightColumn").after(`<div id="ksColumn" class="column"><span class="${Jt.spacer}"></span></div>`):$("#ksColumn").remove();const c=$(r?"#ksColumn":"#rightColumn");if(c.length===0){const o=$("#optionsPage .full-screen-position .page .page-content");o.length===0?console.warn(...f("Unable to find right column to inject UI into. Running headless.")):(o.append(this.element),this.element.attr("style","border-top:1px solid grey; padding:15px"))}else c.prepend(this.element);this.element=this.element,this._needsRefresh=!1}toString(){return`[${Ae.name}#${this.componentId}]`}destroy(){this._refreshTimeout!==void 0&&(C.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(...f("User interface claims to have a refresh pending, but there isn\'t."));return}this._refreshTimeout=C.window.setTimeout(()=>{const[s,a]=X(()=>this.refresh());console.info(...f(`UI refresh took ${wn(a)}.`)),this._refreshTimeout=void 0},0),super.requestRefresh(!0,t,!1)}forceFullRefresh(){console.debug(...f("Forcing refresh on all user interface components...")),this.requestRefresh(),console.debug(...f("Refresh on all user interface components enforced."))}}const Pe=(l="")=>{if(g("2.0.0-beta.11-live"))throw Error("Build error: RELEASE_VERSION is not defined.");return`${l}2.0.0-beta.11-live`};class ae{game;i18nEngine;_userInterface;engine;_gameBeforeSaveHandle;_serverLoadHandle;constructor(e,t,i="en",s){console.info(...f(`Kitten Scientists ${Pe("v")} constructed. Checking for previous instances...`)),"kittenScientists"in C.window&&(console.warn(...f("Detected existing KS instance. Trying to unload it...")),C.window.kittenScientists?.unload()),console.info(...f("You are on the \'fixed\' release channel.")),this.game=e,this.i18nEngine=t;try{this.engine=new ee(this,i),this._userInterface=new Ae(this)}catch(a){throw console.error(...f("Failed to construct core components.",a)),a}g(s)?this._userInterface.stateManagementUi.loadAutoSave():this.setSettings(s)}rebuildUi(){this._userInterface.destroy(),this._userInterface=new Ae(this),this._userInterface.forceFullRefresh()}validateGame(){St.validateGame(this.game,this.engine.scienceManager.settings),He.validateGame(this.game,this.engine.spaceManager.settings),Fe.validateGame(this.game,this.engine.workshopManager.settings)}unload(){console.warn(...f("Unloading Kitten Scientists...")),this.engine.stop(),this._userInterface.destroy(),$("#ks-styles").remove(),this._gameBeforeSaveHandle!==void 0&&(C.window.dojo.unsubscribe(this._gameBeforeSaveHandle),this._gameBeforeSaveHandle=void 0),this._serverLoadHandle!==void 0&&(C.window.dojo.unsubscribe(this._serverLoadHandle),this._gameBeforeSaveHandle=void 0);const e=this.game.managers.indexOf(this._saveManager);-1<e&&this.game.managers.splice(e,1),C.window.kittenScientists=void 0,console.warn(...f("Kitten Scientists have been unloaded!"))}run(){this.refreshEntireUserInterface(),this.engine.settings.enabled&&this.engine.start(!0),this.engine.imessage("status.ks.init"),this.runUpdateCheck().catch(H(console)),this._gameBeforeSaveHandle!==void 0&&(C.window.dojo.unsubscribe(this._gameBeforeSaveHandle),this._gameBeforeSaveHandle=void 0),this._gameBeforeSaveHandle=C.window.dojo.subscribe("game/beforesave",e=>{console.info(...f("Injecting Kitten Scientists engine state into save data..."));const t=this.getSettings();e.ks={state:[t]},this._userInterface.stateManagementUi.storeAutoSave(t),document.dispatchEvent(new CustomEvent("ks.reportSavegame",{detail:e}))}),this._serverLoadHandle!==void 0&&(C.window.dojo.unsubscribe(this._serverLoadHandle),this._gameBeforeSaveHandle=void 0),this._serverLoadHandle=C.window.dojo.subscribe("server/load",e=>{const t=C.tryEngineStateFromSaveData("ks",e);if(!t){console.info(...f("The Kittens Game save data did not contain a script state. Trying to load Auto-Save settings..."));return}console.info(...f("Found! Loading settings...")),this.engine.stateLoad(t),this._userInterface.forceFullRefresh()})}async runUpdateCheck(){{console.debug(...f("No update check on \'fixed\' release channel."));return}}refreshEntireUserInterface(){console.info(...f("Requesting entire user interface to be refreshed.")),this._userInterface.forceFullRefresh()}parseFloat(e){if(e===null||e==="")return null;const t=/[KMGTP]$/i.test(e),i=e.substring(0,e.length-(t?1:0));let s=e.includes("e")||t?Number.parseFloat(i):Number.parseInt(i,10);if(t){const a=e.substring(e.length-1).toUpperCase();s=s*1e3**["","K","M","G","T","P"].indexOf(a)}return(s===Number.POSITIVE_INFINITY||s<0)&&(s=-1),s}parseAbsolute(e){const t=this.parseFloat(e);return t!==null?Math.round(t):null}parsePercentage(e){const t=e.trim().replace(/%$/,"");return Math.max(0,Math.min(1,Number.parseFloat(t)/100))}renderAbsolute(e,t="invariant"){return e<0||e===Number.POSITIVE_INFINITY?"∞":t!=="invariant"&&Math.floor(Math.log10(e))<9?new Intl.NumberFormat(t,{maximumFractionDigits:0,style:"decimal"}).format(e):this.game.getDisplayValueExt(e,!1,!1)}renderPercentage(e,t="invariant",i){return e<0||e===Number.POSITIVE_INFINITY?"∞":t!=="invariant"?new Intl.NumberFormat(t,{style:"percent"}).format(e):`${this.game.getDisplayValueExt(e*100,!1,!1)}${i?"%":""}`}renderFloat(e,t="invariant"){return e<0||e===Number.POSITIVE_INFINITY?"∞":t!=="invariant"?new Intl.NumberFormat(t,{style:"decimal"}).format(e):this.game.getDisplayValueExt(e,!1,!1)}static encodeSettings(e,t=!0){const i=JSON.stringify(e);return t?C.window.LZString.compressToBase64(i):i}static decodeSettings(e){try{const s=JSON.parse(e);return ae.unknownAsEngineStateOrThrow(s)}catch{}if(e.match(/\\r?\\n/))throw new $e("Multi-line non-JSON input can\'t be decoded.");const t=C.window.LZString.decompressFromBase64(e),i=JSON.parse(t);return ae.unknownAsEngineStateOrThrow(i)}getSettings(){return this.engine.stateSerialize()}getSettingsAsJson(){return JSON.stringify(this.getSettings())}setSettings(e){console.info(...f("Loading engine state..."));const t=this.engine.settings.ksColumn.enabled!==e.engine.ksColumn.enabled;this.engine.stateLoad(e),t&&this.rebuildUi(),this._userInterface.refresh(!0)}importSettingsFromString(e){const t=ae.decodeSettings(e);this.setSettings(t)}async copySettings(e=this.getSettings(),t=!0){const i=ae.encodeSettings(e,t);await C.window.navigator.clipboard.writeText(i)}static unknownAsEngineStateOrThrow(e){const t=e.v;if(!g(t)&&typeof t=="string"&&t.startsWith("2"))return e;throw new Error("Not a valid engine state.")}installSaveManager(){console.info(...f("Installing save game manager...")),this.game.managers.push(this._saveManager)}_saveManager={load:e=>{console.info(...f("Looking for Kitten Scientists engine state in save data..."));const t=C.tryEngineStateFromSaveData("ks",e);if(!t){console.info(...f("The Kittens Game save data did not contain a script state."));return}console.info(...f("Found Kitten Scientists engine state in save data.")),this.engine.stateLoad(t),this.refreshEntireUserInterface()},resetState:()=>null,save:e=>{}}}const Yi=async()=>{const l=await new C().waitForGame(ae,"ks");C.window.kittenScientists=l,l.validateGame(),l.run()};(typeof GM>"u"||GM?.info?.scriptHandler==="Tampermonkey")&&Yi().catch(H(console)),ue.main=Yi,Object.defineProperty(ue,Symbol.toStringTag,{value:"Module"})}));\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;&: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;>._headFlexItem_wr1pj_10{flex:1;margin-right:8px}}._setting_1ndg5_1{border-bottom:1px solid transparent;transition:border-bottom .3s;._checkbox_1ndg5_6{margin:1px 5px 2px 2px}._panelContent_1ndg5_10{border-left:1px dashed grey;padding-left:16px;margin-left:8px;margin-top:1px;opacity:.5;&._hidden_1ndg5_17{display:none}}&._checked_1ndg5_22>._panelContent_1ndg5_10{opacity:1}&._expanded_1ndg5_26{margin-bottom:10px}&:not(._expanded_1ndg5_26):hover{border-bottom:1px dashed rgba(160,160,160,.2)}&._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;&:hover{opacity:1}&._inactive_q7zpt_29{opacity:.4;&:hover{opacity:.6}}&._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;&:hover{opacity:1}&._inactive_q7zpt_29{opacity:.4;&:hover{opacity:.6}}&._ineffective_q7zpt_37{color:red;animation:_hail-rainbow_q7zpt_1 5s linear infinite}&._readonly_q7zpt_67{cursor:default;pointer-events:none}._buttonIcon_q7zpt_72{margin:0 2px 0 0;vertical-align:sub}&._alignRight_q7zpt_77{justify-content:end}&._large_q7zpt_81{padding:5px 10px}&._bordered_q7zpt_85{border:1px solid rgba(180,180,180,.2);&:not(._large_q7zpt_81){padding:0 2px}&:hover{border:1px solid rgba(180,180,180,1)}}&._headAction_q7zpt_97{min-width:50px}&._lastHeadAction_q7zpt_100{padding-right:20px}&._consumeButton_q7zpt_104{border:1px solid transparent}&._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{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;&:hover{opacity:1}}._expandoButton_l1ukp_1._expanded_l1ukp_1 ._down_l1ukp_4{display:none}#gamePageContainer .dialog.help._dialog_b4vj0_1{display:flex;flex-direction:column;height:fit-content!important;box-shadow:none!important;._close_b4vj0_7{position:absolute;top:10px;right:15px}}._explainer_1idu3_1{color:#888;display:inline-block;min-width:100px;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;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;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;&:after,&:before{display:inline-block;width:1em;height:100%;position:absolute;right:-1.5em;scale:0;text-align:center;transform-origin:center}&:after{content:attr(data-ks-active-from);animation:_scale_6c09s_1 8s linear infinite}&: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}#crowdjet-expand-container{position:fixed!important;bottom:10px!important;right:-10px!important;opacity:.5;&:hover{opacity:1}}#footerLinks{display:flex;flex-direction:column;position:fixed;text-align:right;line-height:0;right:-5px!important;margin-bottom:1em;a{line-height:1;padding-right:10px;opacity:.5;transition:.3s;text-decoration:none;text-transform:lowercase;&:hover{opacity:1}}}._spacer_90nk2_45{display:block;margin-bottom:100px}._ui_90nk2_50{margin:5px 0 10px;padding-right:10px;ul{list-style:none;margin:0;padding:0}#_toggle-list-resources_90nk2_1 ._stockWarn_90nk2_61 *,#_toggle-reset-list-resources_90nk2_1 ._stockWarn_90nk2_61 *{color:#dd1e00}}._showActivity_90nk2_67{cursor:pointer;display:inline-block;vertical-align:middle}#game #rightColumn{overflow-y:auto;#rightTabLog{overflow-y:visible;#logFiltersBlock{display:none!important}#gameLog{height:auto;min-height:auto;overflow-y:visible;.type_ks-default{color:#9748e0}.type_ks-activity{color:#ffac74bf}.type_ks-summary{color:#093}}}}#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';
105
+ nodeScript.textContent = '(function(ue,H){typeof exports=="object"&&typeof module<"u"?H(exports,require("dojo")):typeof define=="function"&&define.amd?define(["exports","dojo"],H):(ue=typeof globalThis<"u"?globalThis:ue||self,H(ue["kitten-scientists"]=ue["kitten-scientists"]||{}))})(this,(function(ue){"use strict";const H=l=>t=>{l.error(t)};function g(l){return l==null}function Be(l,e){return!g(l)&&l instanceof e}class es extends Error{constructor(e="unexpected nil value"){super(e)}}function p(l,e){if(g(l))throw new es(e);return l}function Ie(l,e){const t=new Array;for(const i of l)g(i)?g(e)||t.push(e):t.push(i);return t}class he extends Error{status;code;constructor(e,t,i){super(t),this.code=e,this.name="AbstractError",this.status=i,typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,he)}static isAbstractError(e,t=!0){if(e instanceof he)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 $e extends he{constructor(e,t=400){super("ERR_OS_INVALID_OPERATION",e,t),this.name="InvalidOperationError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,$e)}}var at,ii;function si(){return ii||(ii=1,at=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\\bsemver\\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}),at}var rt,ni;function ai(){if(ni)return rt;ni=1;const l="2.0.0",e=256,t=Number.MAX_SAFE_INTEGER||9007199254740991,i=16,s=e-6;return rt={MAX_LENGTH:e,MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:s,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:l,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},rt}var Le={exports:{}},ri;function ts(){return ri||(ri=1,(function(l,e){const{MAX_SAFE_COMPONENT_LENGTH:t,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:s}=ai(),a=si();e=l.exports={};const n=e.re=[],r=e.safeRe=[],c=e.src=[],o=e.safeSrc=[],h=e.t={};let u=0;const d="[a-zA-Z0-9-]",m=[["\\\\s",1],["\\\\d",s],[d,i]],v=S=>{for(const[R,Z]of m)S=S.split(`${R}*`).join(`${R}{0,${Z}}`).split(`${R}+`).join(`${R}{1,${Z}}`);return S},b=(S,R,Z)=>{const ce=v(R),j=u++;a(S,j,R),h[S]=j,c[j]=R,o[j]=ce,n[j]=new RegExp(R,Z?"g":void 0),r[j]=new RegExp(ce,Z?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\\\d*"),b("NUMERICIDENTIFIERLOOSE","\\\\d+"),b("NONNUMERICIDENTIFIER",`\\\\d*[a-zA-Z-]${d}*`),b("MAINVERSION",`(${c[h.NUMERICIDENTIFIER]})\\\\.(${c[h.NUMERICIDENTIFIER]})\\\\.(${c[h.NUMERICIDENTIFIER]})`),b("MAINVERSIONLOOSE",`(${c[h.NUMERICIDENTIFIERLOOSE]})\\\\.(${c[h.NUMERICIDENTIFIERLOOSE]})\\\\.(${c[h.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASEIDENTIFIER",`(?:${c[h.NONNUMERICIDENTIFIER]}|${c[h.NUMERICIDENTIFIER]})`),b("PRERELEASEIDENTIFIERLOOSE",`(?:${c[h.NONNUMERICIDENTIFIER]}|${c[h.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASE",`(?:-(${c[h.PRERELEASEIDENTIFIER]}(?:\\\\.${c[h.PRERELEASEIDENTIFIER]})*))`),b("PRERELEASELOOSE",`(?:-?(${c[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\\\.${c[h.PRERELEASEIDENTIFIERLOOSE]})*))`),b("BUILDIDENTIFIER",`${d}+`),b("BUILD",`(?:\\\\+(${c[h.BUILDIDENTIFIER]}(?:\\\\.${c[h.BUILDIDENTIFIER]})*))`),b("FULLPLAIN",`v?${c[h.MAINVERSION]}${c[h.PRERELEASE]}?${c[h.BUILD]}?`),b("FULL",`^${c[h.FULLPLAIN]}$`),b("LOOSEPLAIN",`[v=\\\\s]*${c[h.MAINVERSIONLOOSE]}${c[h.PRERELEASELOOSE]}?${c[h.BUILD]}?`),b("LOOSE",`^${c[h.LOOSEPLAIN]}$`),b("GTLT","((?:<|>)?=?)"),b("XRANGEIDENTIFIERLOOSE",`${c[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`),b("XRANGEIDENTIFIER",`${c[h.NUMERICIDENTIFIER]}|x|X|\\\\*`),b("XRANGEPLAIN",`[v=\\\\s]*(${c[h.XRANGEIDENTIFIER]})(?:\\\\.(${c[h.XRANGEIDENTIFIER]})(?:\\\\.(${c[h.XRANGEIDENTIFIER]})(?:${c[h.PRERELEASE]})?${c[h.BUILD]}?)?)?`),b("XRANGEPLAINLOOSE",`[v=\\\\s]*(${c[h.XRANGEIDENTIFIERLOOSE]})(?:\\\\.(${c[h.XRANGEIDENTIFIERLOOSE]})(?:\\\\.(${c[h.XRANGEIDENTIFIERLOOSE]})(?:${c[h.PRERELEASELOOSE]})?${c[h.BUILD]}?)?)?`),b("XRANGE",`^${c[h.GTLT]}\\\\s*${c[h.XRANGEPLAIN]}$`),b("XRANGELOOSE",`^${c[h.GTLT]}\\\\s*${c[h.XRANGEPLAINLOOSE]}$`),b("COERCEPLAIN",`(^|[^\\\\d])(\\\\d{1,${t}})(?:\\\\.(\\\\d{1,${t}}))?(?:\\\\.(\\\\d{1,${t}}))?`),b("COERCE",`${c[h.COERCEPLAIN]}(?:$|[^\\\\d])`),b("COERCEFULL",c[h.COERCEPLAIN]+`(?:${c[h.PRERELEASE]})?(?:${c[h.BUILD]})?(?:$|[^\\\\d])`),b("COERCERTL",c[h.COERCE],!0),b("COERCERTLFULL",c[h.COERCEFULL],!0),b("LONETILDE","(?:~>?)"),b("TILDETRIM",`(\\\\s*)${c[h.LONETILDE]}\\\\s+`,!0),e.tildeTrimReplace="$1~",b("TILDE",`^${c[h.LONETILDE]}${c[h.XRANGEPLAIN]}$`),b("TILDELOOSE",`^${c[h.LONETILDE]}${c[h.XRANGEPLAINLOOSE]}$`),b("LONECARET","(?:\\\\^)"),b("CARETTRIM",`(\\\\s*)${c[h.LONECARET]}\\\\s+`,!0),e.caretTrimReplace="$1^",b("CARET",`^${c[h.LONECARET]}${c[h.XRANGEPLAIN]}$`),b("CARETLOOSE",`^${c[h.LONECARET]}${c[h.XRANGEPLAINLOOSE]}$`),b("COMPARATORLOOSE",`^${c[h.GTLT]}\\\\s*(${c[h.LOOSEPLAIN]})$|^$`),b("COMPARATOR",`^${c[h.GTLT]}\\\\s*(${c[h.FULLPLAIN]})$|^$`),b("COMPARATORTRIM",`(\\\\s*)${c[h.GTLT]}\\\\s*(${c[h.LOOSEPLAIN]}|${c[h.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",b("HYPHENRANGE",`^\\\\s*(${c[h.XRANGEPLAIN]})\\\\s+-\\\\s+(${c[h.XRANGEPLAIN]})\\\\s*$`),b("HYPHENRANGELOOSE",`^\\\\s*(${c[h.XRANGEPLAINLOOSE]})\\\\s+-\\\\s+(${c[h.XRANGEPLAINLOOSE]})\\\\s*$`),b("STAR","(<|>)?=?\\\\s*\\\\*"),b("GTE0","^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$"),b("GTE0PRE","^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$")})(Le,Le.exports)),Le.exports}var ot,oi;function is(){if(oi)return ot;oi=1;const l=Object.freeze({loose:!0}),e=Object.freeze({});return ot=i=>i?typeof i!="object"?l:i:e,ot}var lt,li;function ss(){if(li)return lt;li=1;const l=/^[0-9]+$/,e=(i,s)=>{if(typeof i=="number"&&typeof s=="number")return i===s?0:i<s?-1:1;const a=l.test(i),n=l.test(s);return a&&n&&(i=+i,s=+s),i===s?0:a&&!n?-1:n&&!a?1:i<s?-1:1};return lt={compareIdentifiers:e,rcompareIdentifiers:(i,s)=>e(s,i)},lt}var ct,ci;function ns(){if(ci)return ct;ci=1;const l=si(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:t}=ai(),{safeRe:i,t:s}=ts(),a=is(),{compareIdentifiers:n}=ss();class r{constructor(o,h){if(h=a(h),o instanceof r){if(o.loose===!!h.loose&&o.includePrerelease===!!h.includePrerelease)return o;o=o.version}else if(typeof o!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof o}".`);if(o.length>e)throw new TypeError(`version is longer than ${e} characters`);l("SemVer",o,h),this.options=h,this.loose=!!h.loose,this.includePrerelease=!!h.includePrerelease;const u=o.trim().match(h.loose?i[s.LOOSE]:i[s.FULL]);if(!u)throw new TypeError(`Invalid Version: ${o}`);if(this.raw=o,this.major=+u[1],this.minor=+u[2],this.patch=+u[3],this.major>t||this.major<0)throw new TypeError("Invalid major version");if(this.minor>t||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>t||this.patch<0)throw new TypeError("Invalid patch version");u[4]?this.prerelease=u[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const m=+d;if(m>=0&&m<t)return m}return d}):this.prerelease=[],this.build=u[5]?u[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(o){if(l("SemVer.compare",this.version,this.options,o),!(o instanceof r)){if(typeof o=="string"&&o===this.version)return 0;o=new r(o,this.options)}return o.version===this.version?0:this.compareMain(o)||this.comparePre(o)}compareMain(o){return o instanceof r||(o=new r(o,this.options)),this.major<o.major?-1:this.major>o.major?1:this.minor<o.minor?-1:this.minor>o.minor?1:this.patch<o.patch?-1:this.patch>o.patch?1:0}comparePre(o){if(o instanceof r||(o=new r(o,this.options)),this.prerelease.length&&!o.prerelease.length)return-1;if(!this.prerelease.length&&o.prerelease.length)return 1;if(!this.prerelease.length&&!o.prerelease.length)return 0;let h=0;do{const u=this.prerelease[h],d=o.prerelease[h];if(l("prerelease compare",h,u,d),u===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(u===void 0)return-1;if(u===d)continue;return n(u,d)}while(++h)}compareBuild(o){o instanceof r||(o=new r(o,this.options));let h=0;do{const u=this.build[h],d=o.build[h];if(l("build compare",h,u,d),u===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(u===void 0)return-1;if(u===d)continue;return n(u,d)}while(++h)}inc(o,h,u){if(o.startsWith("pre")){if(!h&&u===!1)throw new Error("invalid increment argument: identifier is empty");if(h){const d=`-${h}`.match(this.options.loose?i[s.PRERELEASELOOSE]:i[s.PRERELEASE]);if(!d||d[1]!==h)throw new Error(`invalid identifier: ${h}`)}}switch(o){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",h,u);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",h,u);break;case"prepatch":this.prerelease.length=0,this.inc("patch",h,u),this.inc("pre",h,u);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",h,u),this.inc("pre",h,u);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 d=Number(u)?1:0;if(this.prerelease.length===0)this.prerelease=[d];else{let m=this.prerelease.length;for(;--m>=0;)typeof this.prerelease[m]=="number"&&(this.prerelease[m]++,m=-2);if(m===-1){if(h===this.prerelease.join(".")&&u===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(h){let m=[h,d];u===!1&&(m=[h]),n(this.prerelease[0],h)===0?isNaN(this.prerelease[1])&&(this.prerelease=m):this.prerelease=m}break}default:throw new Error(`invalid increment argument: ${o}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return ct=r,ct}var ht,hi;function as(){if(hi)return ht;hi=1;const l=ns();return ht=(t,i,s)=>new l(t,s).compare(new l(i,s)),ht}var ut,ui;function rs(){if(ui)return ut;ui=1;const l=as();return ut=(t,i,s)=>l(t,i,s)>0,ut}rs();class Se extends he{constructor(e,t=500){super("ERR_OS_INTERNAL",e,t),this.name="InternalError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,Se)}static fromError(e){const t=new Se(e.message);return Object.assign(t,e,new Se(e.message)),t.stack=e.stack,t}}class dt extends he{constructor(e,t=500){super("ERR_OS_UNKNOWN",e,t),this.name="UnknownError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,dt)}}const os=l=>l instanceof Error||Object.prototype.toString.call(l)==="[object Error]",ls=l=>he.isAbstractError(l)?l:os(l)?Se.fromError(l):new dt(String(l)),X=l=>{const e=performance.now();return[l(),performance.now()-e]},Oe=async l=>{const e=performance.now();return[await l(),performance.now()-e]},f=(...l)=>["👩‍🔬",...l.filter(e=>e!=="").flatMap(e=>{if(Be(e,Error)){const t=e;return[t.name,t.message,t.stack]}return e})];function P(l){return Object.entries(l)}function L(l,e,t){if(g(e))return console.warn(...f("No source data was provided.")),l;for(const[i,s]of P(l))i in e||console.info(...f(`Entry \'${i}\' is missing in source. Using default value.`)),t(s,e[i]);for(const[i]of P(e))i in l||console.warn(...f(`Entry \'${i}\' was found in source, but it is not expected by the subject schema. This entry will be ignored.`));return l}class Ue{_elem;constructor(e){this._elem=structuredClone(e)}unwrap(){return structuredClone(this._elem)}replace(e){this._elem=structuredClone(e)}toJSON(){return this.unwrap()}}function W(l){return l.charAt(0).toUpperCase()+l.slice(1)}function cs(l){return Math.round(l*100)/100}function G(l){return l===-1?Number.POSITIVE_INFINITY:l}const gt=["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"],De=["broadcasttower","dataCenter","hydroplant","solarfarm","spaceport"],hs=["autumn","spring","summer","winter"],de=["charon","umbra","yarn","helios","cath","redmoon","dune","piscine","terminus","kairo"],di=["alloy","beam","bloodstone","blueprint","compedium","concrate","eludium","gear","kerosene","manuscript","megalith","parchment","plate","scaffold","ship","slab","steel","tanker","tMythril","thorium","wood"],gi=[...di,"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"],mi=["any","engineer","farmer","geologist","hunter","miner","priest","scholar","woodcutter"],us=["chemist","engineer","manager","metallurgist","merchant","none","scientist","wise"];var O=(l=>(l.Cryptotheology="c",l.OrderOfTheSun="s",l.Ziggurat="z",l.UnicornPasture="zp",l))(O||{});const mt=["apocripha","basilica","goldenSpire","scholasticism","solarRevolution","solarchant","stainedGlass","sunAltar","templars","transcendence"],ft=["blackCore","blackLibrary","blackNexus","blackObelisk","blackRadiance","blazar","darkNova","holyGenocide","mausoleum","singularity"],pt=["blackPyramid","ivoryCitadel","ivoryTower","marker","skyPalace","sunspire","unicornGraveyard","unicornNecropolis","unicornTomb","unicornUtopia"],fi=["dragons","griffins","nagas","leviathans","lizards","sharks","spiders","zebras"],ds=["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"],pi=["brewery"],gs=["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"],ms=["centaurusSystemMission","charonMission","duneMission","furthestRingMission","heliosMission","kairoMission","moonMission","orbitalLaunch","piscineMission","rorschachMission","terminusMission","umbraMission","yarnMission"],bt=["containmentChamber","cryostation","entangler","heatsink","hrHarvester","hydrofracturer","hydroponics","moltenCore","moonBase","moonOutpost","orbitalArray","planetCracker","researchVessel","sattelite","spaceBeacon","spaceElevator","spaceStation","spiceRefinery","sunforge","sunlifter","tectonic","terraformingStation"],vt=["blastFurnace","ressourceRetrieval","temporalAccelerator","temporalBattery","temporalImpedance","temporalPress","timeBoiler"],yt=["cryochambers","usedCryochambers","voidHoover","voidRift","chronocontrol","voidResonator"],bi=["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","tachyonModerator","thinFilm","thoriumEngine","thoriumReactors","titaniumAxe","titaniumBarns","titaniumMirrors","titaniumSaw","titaniumWarehouses","turnSmoothly","unicornSelection","unobtainiumAxe","unobtainiumDrill","unobtainiumHuts","unobtainiumReflectors","unobtainiumSaw","uplink","voidAspiration","voidEnergy","voidReactors"];var Y=(l=>(l.Chronoforge="chrono",l.VoidSpace="void",l))(Y||{});const Ne=["ivoryCitadel","ivoryTower","skyPalace","sunspire","unicornPasture","unicornTomb","unicornUtopia"],fs=["sacrificeUnicorns","sacrificeAlicorns","refineTears","refineTimeCrystals","transcend","adore","autoPraise"];class xe{_host;_workshopManager;_priceCache;cacheHits=0;cacheMisses=0;constructor(e,t){this._host=e,this._workshopManager=t,this._priceCache=new Map}resetPriceCache(){this._priceCache=new Map,this.cacheHits=0,this.cacheMisses=0}_getPriceForBuild(e,t=0){const i=this._priceCache.get(e)??[],s=i[t];if(s!==void 0)return++this.cacheHits,s;if(++this.cacheMisses,De.includes(e)){const a={broadcasttower:"amphitheatre",dataCenter:"library",hydroplant:"aqueduct",solarfarm:"pasture",spaceport:"warehouse"},n=this._getPriceForBuild(p(a[e]),t);return i[t]=n,this._priceCache.set(e,i),n}if(gt.includes(e)){const a=this._host.game.bld.getBuildingExt(e),n=a.get;a.get=(c=>c==="val"?t:n.apply(a,[c]));const r=this._host.game.bld.getPricesWithAccessor(a);return a.get=n,i[t]=r,this._priceCache.set(e,i),r}if(vt.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"chronoforge"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}if(mt.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"religion"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}if(bt.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"spaceBuilding"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}if(ft.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"transcendenceUpgrades"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}if(yt.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"voidSpace"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}if(pt.includes(e)){const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"zigguratUpgrades"}),n=a.controller.getPrices({...a.model,metadata:{...a.model.metadata,val:t}});return i[t]=n,this._priceCache.set(e,i),n}throw Error(`unable to get meta for \'${e}\'`)}bulk(e,t){const i=[],s=P(e).sort((o,h)=>{const u=p(t[o[0]]),d=p(t[h[0]]);return u.val!==d.val?u.val-d.val:o[0].localeCompare(h[0],"en")});for(const[o,h]of s){const u=ee.evaluateSubSectionTrigger(h.sectionTrigger,h.trigger),d=p(t[o]);if(!h.enabled||u<0||"tHidden"in d&&d.tHidden===!0||"rHidden"in d&&d.rHidden===!0||d.unlocked===!1||!g(h.max)&&-1<h.max&&h.max<=d.val||o==="cryochambers"&&(p(this._host.game.time.getVSU("usedCryochambers")).val>0||this._host.game.bld.getBuildingExt("chronosphere").meta.val<=d.val)||o==="ressourceRetrieval"&&d.val>=100||this._isStagedBuild(d)&&typeof h.stage<"u"&&h.stage!==d.stage)continue;this._getPriceForBuild(o).map(S=>this._workshopManager.getResource(S.name)).filter(S=>0<S.maxValue).filter(S=>S.value/S.maxValue<u).length===0&&i.push({builder:h.builder,count:1,id:o,limit:h.max,name:h.baseBuilding??h.building,stage:h.stage??null,val:d.val,variant:h.variant??null})}if(i.length===0)return[];const a={};for(const o of this._host.game.resPool.resources)a[o.name]=this._workshopManager.getValueAvailable(o.name);let n=0;const r=new Array;for(;n<1e6&&0<i.length;){let o=0;const h=[];let u={...a};for(const d of i){const m=this._precalculateBuilds({...d,limit:Math.min(G(d.limit),d.val+d.count)},t,u);if(m.count!==0){if(m.count!==d.count){u=m.remainingResources,h.push({...d,count:m.count});continue}u=m.remainingResources,h.push({...d}),++d.count,++o}}if(o===0)break;r.push(h),++n}if(r.length===0)return[];let c;for(const o of r){const h={...a};let u=!0;for(const d of o)if(this._precalculateBuilds({...d,limit:Math.min(G(d.limit),d.val+d.count)},t,h).count<d.count){u=!1;break}if(u)c=o;else break}return c!==void 0?c:(console.warn(...f(`Took \'${n}\' iterations to evaluate bulk build request without result.`)),[])}_precalculateBuilds(e,t,i={}){let s=0;const a={...i},n=p(t[e.id]);let r=!1;for(;!r&&s<1e5&&!(e.limit<=n.val+s);){const c=this._getPriceForBuild(e.id,n.val+s);for(let o=0;o<c.length;o++)if(a[c[o].name]<c[o].val){r=!0;break}if(!r){++s;for(let o=0;o<c.length;o++)a[c[o].name]-=c[o].val}}return{count:s,remainingResources:a}}construct(e,t,i){if(!("name"in e)||!("controller"in e.options)||!("getMetadata"in e.options.controller))return 0;const s=e.metadata;let a=0,n=i;const r=s;if(!g(r.limitBuild)&&r.limitBuild-r.val<n&&(n=r.limitBuild-r.val),e.enabled&&t.hasResources(e)||this._host.game.devMode){for(;t.hasResources(e)&&n>0;)e.prices=t.getPrices(e),t.payPrice(e),t.incrementValue(e),a++,n--;r.breakIronWill&&(this._host.game.ironWill=!1),g(s)||("unlocks"in s&&!g(s.unlocks)&&this._host.game.unlock(s.unlocks),"upgrades"in s&&!g(s.upgrades)&&this._host.game.upgrade(s.upgrades))}return a}_isStagedBuild(e){return"stage"in e&&"stages"in e&&!g(e.stage)&&!g(e.stages)}getPriceRatio(e,t){const i=this._isStagedBuild(e)?e.priceRatio||e.stages[e.stage].priceRatio:e.priceRatio??0;let s=0;return t&&t==="Bonfire"&&(s=this._host.game.getEffect(`${e.name}PriceRatio`)+this._host.game.getEffect("priceRatio")+this._host.game.getEffect("mapPriceReduction"),s=this._host.game.getLimitedDR(s,i-1)),i+s}singleBuildPossible(e){const t=this._getPriceForBuild(e);for(const i of t)if(this._workshopManager.getValueAvailable(i.name)<i.val)return!1;return!0}}class y{enabled;constructor(e=!1){this.enabled=e}load(e){g(e)||(this.enabled=e.enabled??this.enabled)}serialize(){return this}}class vi extends y{limited;constructor(e=!1,t=!1){super(e),this.limited=t}load(e){g(e)||(super.load(e),this.limited=e.limited??this.limited)}}class z extends y{trigger;constructor(e=!1,t=-1){super(e),this.trigger=t}load(e){g(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class Q extends y{trigger;constructor(e=!1,t=1){super(e),this.trigger=t}load(e){g(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class yi extends y{max;constructor(e=!1,t=0){super(e),this.max=t}load(e){g(e)||(super.load(e),this.max=e.max??this.max)}}class ps extends vi{max;constructor(e=!1,t=!1,i=0){super(e,t),this.max=i}load(e){g(e)||(super.load(e),this.max=e.max??this.max)}}class bs extends ps{trigger;constructor(e=!1,t=!1,i=0,s=-1){super(e,t,i),this.trigger=s}load(e){g(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class vs extends vi{trigger;constructor(e=!1,t=!1,i=-1){super(e,t),this.trigger=i}load(e){g(e)||(super.load(e),this.trigger=e.trigger??this.trigger)}}class qe extends z{max;constructor(e=!1,t=-1,i=0){super(e,t),this.max=i}load(e){g(e)||(super.load(e),this.max=e.max??this.max)}}class ys extends Q{max;constructor(e=!1,t=1,i=0){super(e,t),this.max=i}load(e){g(e)||(super.load(e),this.max=e.max??this.max)}}class wt{#e;selected;get options(){return this.#e}constructor(e,t=new Array){if(g(t.find(i=>i.value===e)))throw new Error("Provided selected value is not in provided options.");this.selected=e,this.#e=t}load(e){g(e)||(this.selected=e.selected??this.selected)}}class ws extends Q{buy;sell;constructor(e=!1,t=950,i=1e3,s=1){super(e,s),this.buy=t,this.sell=i}load(e){g(e)||(super.load(e),this.buy=e.buy??this.buy,this.sell=e.sell??this.sell)}}class ks extends y{#e;get upgrade(){return this.#e}constructor(e,t=!1){super(t),this.#e=e}}class _s extends y{buildings;constructor(e=!1){super(e),this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of De)e[t]=new ks(t);return e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled}))}}class kt extends qe{#e=void 0;get baseBuilding(){return this.#e}#t;get building(){return this.#t}#i=0;get stage(){return this.#i}constructor(e,t=!1,i=-1,s=0,a){super(t,i,s),this.#t=e,a&&(this.#i=1,this.#e=a)}}class _t extends z{buildings;gatherCatnip;turnOnMagnetos;turnOnSteamworks;turnOnReactors;upgradeBuildings;constructor(e=!1,t=-1,i=new y,s=new y,a=new y,n=new y,r=new _s){super(e,t),this.buildings=this.initBuildings(),this.gatherCatnip=i,this.turnOnSteamworks=s,this.turnOnMagnetos=a,this.turnOnReactors=n,this.upgradeBuildings=r}initBuildings(){const e={broadcasttower:"amphitheatre",dataCenter:"library",hydroplant:"aqueduct",solarfarm:"pasture",spaceport:"warehouse"},t={};for(const i of gt)i!=="unicornPasture"&&(t[i]=new kt(i));for(const i of De)t[i]=new kt(i,!1,-1,0,e[i]);return t}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max,t.trigger=i?.trigger??t.trigger}),this.gatherCatnip.enabled=e.gatherCatnip?.enabled??this.gatherCatnip.enabled,this.turnOnSteamworks.enabled=e.turnOnSteamworks?.enabled??this.turnOnSteamworks.enabled,this.turnOnMagnetos.enabled=e.turnOnMagnetos?.enabled??this.turnOnMagnetos.enabled,this.turnOnReactors.enabled=e.turnOnReactors?.enabled??this.turnOnReactors.enabled,this.upgradeBuildings.load(e.upgradeBuildings))}}class Cs{_host;settings;_bulkManager;_workshopManager;constructor(e,t,i=new _t){this._host=e,this.settings=i,this._workshopManager=t,this._bulkManager=new xe(this._host,this._workshopManager)}tick(e){this.settings.enabled&&(this._bulkManager.resetPriceCache(),this.autoBuild(e),this.autoMisc(e))}autoBuild(e,t=this.settings.buildings){const i={};for(const n of Object.values(t))i[n.building]=this._host.game.bld.getBuildingExt(n.baseBuilding??n.building).meta;const s=this.settings.trigger,a=n=>{this.build(n.name||n.id,n.stage??void 0,n.count)};e.purchaseOrders.push({builder:a,builds:t,metaData:i,sectionTrigger:s})}autoUpgrade(e){const t=this._host.game.bld.getBuildingExt("pasture").meta.stage===0?this._host.game.bld.getBuildingExt("pasture").meta.val:0,i=this._host.game.bld.getBuildingExt("aqueduct").meta.stage===0?this._host.game.bld.getBuildingExt("aqueduct").meta.val:0,s=this._host.game.bld.getBuildingExt("pasture").meta;if(this.settings.upgradeBuildings.buildings.solarfarm.enabled&&s.unlocked&&s.stage===0&&p(s.stages)[1].stageUnlocked&&this._workshopManager.getPotentialCatnip(!0,0,i)>0&&this._bulkManager.singleBuildPossible("pasture")){const o=this.getBuild("pasture",0);g(o?.model)||(o.controller.sellInternal(o.model,0,!1),s.on=0,s.val=0,s.stage=1,this._host.engine.iactivity("upgrade.building.pasture",[],"ks-upgrade"),this._host.game.ui?.render(),this.build("pasture",1,1),e.requestGameUiRefresh=!0)}const a=this._host.game.bld.getBuildingExt("aqueduct").meta;if(this.settings.upgradeBuildings.buildings.hydroplant.enabled&&a.unlocked&&a.stage===0&&p(a.stages)[1].stageUnlocked&&this._workshopManager.getPotentialCatnip(!0,t,0)>0&&this._bulkManager.singleBuildPossible("aqueduct")){const o=this.getBuild("aqueduct",0);g(o?.model)||(o.controller.sellInternal(o.model,0,!1),a.on=0,a.val=0,a.stage=1,a.calculateEffects?.(a,this._host.game),this._host.engine.iactivity("upgrade.building.aqueduct",[],"ks-upgrade"),this._host.game.ui?.render(),this.build("aqueduct",1,1),e.requestGameUiRefresh=!0)}const n=this._host.game.bld.getBuildingExt("library").meta;if(this.settings.upgradeBuildings.buildings.dataCenter.enabled&&n.unlocked&&n.stage===0&&p(n.stages)[1].stageUnlocked){let o=this._host.game.workshop.get("cryocomputing").researched?1:2;this._host.game.challenges.currentChallenge==="energy"&&(o*=2);let h=3;if(this._host.game.workshop.get("uplink").researched&&(h*=1+this._host.game.bld.getBuildingExt("biolab").meta.val*this._host.game.getEffect("uplinkDCRatio")),this._host.game.workshop.get("machineLearning").researched&&(h*=1+this._host.game.bld.getBuildingExt("aiCore").meta.on*this._host.game.getEffect("dataCenterAIRatio")),this._host.game.resPool.energyProd>=this._host.game.resPool.energyCons+o*n.val/h&&this._bulkManager.singleBuildPossible("library")){const u=p(this.getBuild("library",0));if(g(u.model))return;u.controller.sellInternal(u.model,0,!1),n.on=0,n.val=0,n.stage=1,n.calculateEffects?.(n,this._host.game),this._host.engine.iactivity("upgrade.building.library",[],"ks-upgrade"),this._host.game.ui?.render(),this.build("library",1,1),e.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&&this._bulkManager.singleBuildPossible("warehouse")){const o=this.getBuild("warehouse",0);if(!g(o?.model)){o.controller.sellInternal(o.model,0,!1),r.on=0,r.val=0,r.stage=1,this._host.engine.iactivity("upgrade.building.warehouse",[],"ks-upgrade"),this._host.game.ui?.render(),this.build("warehouse",1,1),e.requestGameUiRefresh=!0;return}}const c=this._host.game.bld.getBuildingExt("amphitheatre").meta;if(this.settings.upgradeBuildings.buildings.broadcasttower.enabled&&c.unlocked&&c.stage===0&&p(c.stages)[1].stageUnlocked&&this._bulkManager.singleBuildPossible("amphitheatre")){const o=this.getBuild("amphitheatre",0);g(o?.model)||(o.controller.sellInternal(o.model,0,!1),c.on=0,c.val=0,c.stage=1,this._host.engine.iactivity("upgrade.building.amphitheatre",[],"ks-upgrade"),this._host.game.ui?.render(),this.build("amphitheatre",1,1),e.requestGameUiRefresh=!0)}}autoMisc(e){if(this.settings.turnOnSteamworks.enabled){const t=this._host.game.bld.getBuildingExt("steamworks");if(t.meta.val&&t.meta.on===0){const i=this.getBuild("steamworks");i.controller.onAll(i.model)}}if(this.settings.turnOnMagnetos.enabled){const t=this._host.game.bld.getBuildingExt("magneto");if(t.meta.val&&t.meta.on<t.meta.val){const i=this.getBuild("magneto");i.controller.onAll(i.model)}}if(this.settings.turnOnReactors.enabled){const t=this._host.game.bld.getBuildingExt("reactor");if(t.meta.val&&t.meta.on<t.meta.val){const i=this.getBuild("reactor");i.controller.onAll(i.model)}}this.settings.upgradeBuildings.enabled&&this.autoUpgrade(e),this.settings.gatherCatnip.enabled&&this.autoGather()}autoGather(){for(let e=0;e<Math.floor(this._host.engine.settings.interval/20);++e)this._host.game.bld.gatherCatnip()}build(e,t,i){let s=0,a;const n=game.getUnlockByName(e,"buildings"),r=new classes.BuildingMeta(n).getMeta();if("stages"in r){const c=new classes.ui.btn.StagingBldBtnController(this._host.game),o=c.fetchModel({building:e,controller:c,description:p(r.description),name:p(r.label),twoRow:!1});s=this._bulkManager.construct(o,c,i),a=r.label??""}else{const c=new classes.ui.btn.BuildingBtnModernController(this._host.game),o=c.fetchModel({building:e,controller:c,description:p(r.description),name:p(r.label),twoRow:!1});s=this._bulkManager.construct(o,c,i),a=r.label??""}i!==s&&(console.warn(...f(`${a} Amount ordered: ${i} Amount Constructed: ${s}`)),s===0)||(this._host.engine.storeForSummary(a,s,"build"),s===1?this._host.engine.iactivity("act.build",[a],"ks-build"):this._host.engine.iactivity("act.builds",[a,this._host.renderAbsolute(s)],"ks-build"))}getBuild(e,t=0){const i=game.bld.get(e),s=new classes.BuildingMeta(i).getMeta(),a=g(s.stages)?i:s.stages[t],n="stages"in a?new classes.ui.btn.StagingBldBtnController(this._host.game):new classes.ui.btn.BuildingBtnModernController(this._host.game),r=n.fetchModel({building:e,description:a.description,key:e,name:a.label});return{controller:n,model:r}}}class Ss{_host;_lastday;_lastyear;_sections=new Map;constructor(e){this._host=e,this.resetActivity()}resetActivity(){this._sections=new Map,this._lastday=this._host.game.calendar.day,this._lastyear=this._host.game.calendar.year}storeActivity(e,t=1,i="other"){this._sections.has(i)||this._sections.set(i,new Map);const s=p(this._sections.get(i));s.has(e)||s.set(e,0),s.set(e,p(s.get(e))+t)}renderSummary(){const e=new Array;if(this._sections.has("other")){const t=p(this._sections.get("other"));for(const[i,s]of t)e.push(this._host.engine.i18n(`summary.${i}`,[this._host.game.getDisplayValueExt(s)]))}if(this._sections.has("research")&&p(this._sections.get("research")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.tech",[W(s)]))}),this._sections.has("upgrade")&&p(this._sections.get("upgrade")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.upgrade",[W(s)]))}),this._sections.has("build")&&p(this._sections.get("build")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.building",[this._host.game.getDisplayValueExt(i),W(s)]))}),this._sections.has("refine")&&p(this._sections.get("refine")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.refine",[this._host.game.getDisplayValueExt(i),W(s)]))}),this._sections.has("faith")&&p(this._sections.get("faith")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.sun",[this._host.game.getDisplayValueExt(i),W(s)]))}),this._sections.has("craft")&&p(this._sections.get("craft")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.craft",[this._host.game.getDisplayValueExt(i),W(s)]))}),this._sections.has("trade")&&p(this._sections.get("trade")).forEach((i,s)=>{e.push(this._host.engine.i18n("summary.trade",[this._host.game.getDisplayValueExt(i),W(s)]))}),this._lastday&&this._lastyear){let t=this._host.game.calendar.year-this._lastyear,i=this._host.game.calendar.day-this._lastday;i<0&&(t-=1,i+=400);let s="";t>0&&(s+=`${t} `,s+=t===1?this._host.engine.i18n("summary.year"):this._host.engine.i18n("summary.years")),i>=0&&(t>0&&(s+=this._host.engine.i18n("summary.separator")),s+=`${cs(i)} `,s+=i===1?this._host.engine.i18n("summary.day"):this._host.engine.i18n("summary.days")),e.push(this._host.engine.i18n("summary.head",[s]))}return e}}const xs={"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.highlightStock":"Highlight resource stock","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}"},Ts={"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.highlightStock":"Highlight resource stock","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"},Es={"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.highlightStock":"Highlight resource stock","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}"},Ms={"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.highlightStock":"Highlight resource stock","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 ze extends qe{#e;#t;get building(){return this.#e}get variant(){return this.#t}constructor(e,t,i=!1){super(i),this.#e=e,this.#t=t}}class Ct extends z{buildings;bestUnicornBuilding;bestUnicornBuildingCurrent;sacrificeAlicorns;sacrificeUnicorns;refineTears;refineTimeCrystals;autoPraise;adore;transcend;constructor(e=!1,t=-1,i=new y,s=new Q(!1,-1),a=new Q(!1,-1),n=new Q(!1,-1),r=new Q(!1,-1),c=new z(!1,1),o=new z(!1,1),h=new y){super(e,t),this.buildings=this.initBuildings(),this.bestUnicornBuilding=i,this.sacrificeAlicorns=s,this.sacrificeUnicorns=a,this.refineTears=n,this.refineTimeCrystals=r,this.autoPraise=c,this.adore=o,this.transcend=h,this.bestUnicornBuildingCurrent=null}initBuildings(){const e={};for(const t of mt)e[t]=new ze(t,O.OrderOfTheSun);for(const t of ft)e[t]=new ze(t,O.Cryptotheology);for(const t of pt)e[t]=new ze(t,O.Ziggurat);return e.unicornPasture=new ze("unicornPasture",O.UnicornPasture),e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max,t.trigger=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 Rs{_host;settings;_bulkManager;_bonfireManager;_workshopManager;constructor(e,t,i,s=new Ct){this._host=e,this.settings=s,this._workshopManager=i,this._bulkManager=new xe(this._host,this._workshopManager),this._bonfireManager=t}async tick(e){this.settings.enabled&&(this._bulkManager.resetPriceCache(),this._autoBuild(e),this.settings.sacrificeUnicorns.enabled&&await this._autoSacrificeUnicorns(),this.settings.sacrificeAlicorns.enabled&&await this._autoSacrificeAlicorns(e),this.settings.refineTears.enabled&&this._autoTears(e),this.settings.refineTimeCrystals.enabled&&await this._autoTCs(e),this._autoTAP())}_autoBuild(e){if(this.settings.bestUnicornBuilding.enabled)this._buildBestUnicornBuilding(e),this._buildNonUnicornBuildings(e);else{const t=Object.fromEntries(Object.entries(this.settings.buildings).filter(([,a])=>a.variant!==O.UnicornPasture)),i=G(this.settings.buildings.unicornPasture.max),s=this._host.game.bld.getBuildingExt("unicornPasture").meta;this.settings.buildings.unicornPasture.enabled&&s.val<i&&this._bonfireManager.autoBuild(e,{unicornPasture:new kt("unicornPasture",this.settings.buildings.unicornPasture.enabled,this.settings.buildings.unicornPasture.trigger,this.settings.buildings.unicornPasture.max)}),this._buildReligionBuildings(e,t)}}_buildBestUnicornBuilding(e){const t=this.getBestUnicornBuilding();if(this.settings.bestUnicornBuildingCurrent!==t&&(this.settings.bestUnicornBuildingCurrent=t,this._host.refreshEntireUserInterface()),this.settings.bestUnicornBuildingCurrent===null)return;const i=this.settings.trigger;if(this.settings.bestUnicornBuildingCurrent==="unicornPasture"){const h={[this.settings.bestUnicornBuildingCurrent]:this.settings.buildings[this.settings.bestUnicornBuildingCurrent]},u={[this.settings.bestUnicornBuildingCurrent]:this._host.game.bld.getBuildingExt("unicornPasture").meta},d=m=>{this._bonfireManager.build("unicornPasture",0,1)};e.purchaseOrders.push({builder:d,builds:h,metaData:u,sectionTrigger:i});return}const s=this._getBuild(this.settings.bestUnicornBuildingCurrent,O.Ziggurat);let a=0;const n=p(s.model.prices).find(h=>h.name==="tears");g(n)||(a=n.val);const r=this._workshopManager.getValue("tears")-this._workshopManager.getStock("tears");if(r<a){const h=Math.floor((this._workshopManager.getValue("unicorns")-this._workshopManager.getStock("unicorns"))/2500),u=Math.ceil((a-r)/this._host.game.bld.getBuildingExt("ziggurat").meta.on),d=this._host.game.bld.get("ziggurat").on;if(u<h&&0<d){const m=new classes.ui.religion.TransformBtnController(this._host.game,{applyAtGain:b=>{this._host.game.stats.getStat("unicornsSacrificed").val+=b},gainedResource:"tears",gainMultiplier:()=>this._host.game.bld.get("ziggurat").on,logfilterID:"unicornSacrifice",logTextID:"religion.sacrificeBtn.sacrifice.msg",overcapMsgID:"religion.sacrificeBtn.sacrifice.msg.overcap"}),v=m.fetchModel({controller:m,description:"",name:"",prices:[{name:"unicorns",val:2500}]});m._transform(v,u)}else return}const c={[this.settings.bestUnicornBuildingCurrent]:this.settings.buildings[this.settings.bestUnicornBuildingCurrent]},o=h=>{this.build(h.id,O.Ziggurat,1)};e.purchaseOrders.push({builder:o,builds:c,metaData:this.getBuildMetaData(c),sectionTrigger:i})}_buildNonUnicornBuildings(e){const t=[...Ne],i=Object.fromEntries(Object.entries(this.settings.buildings).filter(([,s])=>!t.includes(s.building)));this._buildReligionBuildings(e,i)}_buildReligionBuildings(e,t){const i=this.getBuildMetaData(t),s=this.settings.trigger,a=n=>{this.build(n.id,p(n.variant),n.count)};e.purchaseOrders.push({builder:a,builds:t,metaData:i,sectionTrigger:s})}getBestUnicornBuilding(){const e=this._bonfireManager.getBuild("unicornPasture"),t=[...Ne].filter(re=>re!=="unicornPasture"),i=this._host.game.getEffect("unicornsPerTickBase")*this._host.game.getTicksPerSecondUI(),s=this._host.game.getEffect("unicornsGlobalRatio")+1,a=this._host.game.getEffect("unicornsRatioReligion")+1,n=this._host.game.prestige.getParagonProductionRatio()+1,r=this._host.game.religion.getSolarRevolutionRatio()+1,c=this._host.game.calendar.cycle,o=this._host.game.calendar.cycles[c];let h=1;o.festivalEffects.unicorns!==void 0&&this._host.game.prestige.getPerk("numeromancy").researched&&this._host.game.calendar.festivalDays&&(h=o.festivalEffects.unicorns);const u=i*s*a*n*r*h,d=Math.max(this._host.game.bld.getBuildingExt("ziggurat").meta.on,1),m=500*(1+this._host.game.getEffect("unicornsRatioReligion")*.1);let v=1;this._host.game.prestige.getPerk("unicornmancy").researched&&(v*=1.1);const b=this._host.game.getEffect("riftChance")*v/(1e4*2)*m;let S=Number.POSITIVE_INFINITY,R=null;const ce=p(this._host.game.bld.getBuildingExt("unicornPasture").meta.effects?.unicornsPerTickBase)*this._host.game.getTicksPerSecondUI()*s*a*n*r*h,j=p(e.model?.prices)[0].val/ce;j<S&&(S=j,R="unicornPasture");for(const re of t){const pe=this._getBuild(re,O.Ziggurat);if(!pe.model.metadata.unlocked)continue;let oe=0;for(const ve of p(pe.model.prices))ve.name==="unicorns"&&(oe+=ve.val),ve.name==="tears"&&(oe+=ve.val*2500/d);const be=p(this._host.game.religion.getZU(re));let Ce=a,nt=this._host.game.getEffect("riftChance");for(const ve in be.effects)ve==="unicornsRatioReligion"&&(Ce+=p(be.effects.unicornsRatioReligion)),ve==="riftChance"&&(nt+=p(be.effects.riftChance));const uo=500*((Ce-1)*.1+1);let ei=nt*v/(1e4*2)*uo;ei-=b;let ti=i*s*Ce*n*r*h;ti-=u,ti+=ei;const Qi=oe/ti;Qi<S&&(0<ei||a<Ce&&0<oe)&&(S=Qi,R=re)}return R}build(e,t,i){let s=0,a;if(t===O.Cryptotheology){const n=game.getUnlockByName(e,"transcendenceUpgrades"),r=new classes.ui.TranscendenceBtnController(this._host.game),c=r.fetchModel({controller:r,id:n.name});s=this._bulkManager.construct(c,r,i),a=n.label}else if(t===O.OrderOfTheSun){const n=game.getUnlockByName(e,"religion"),r=new com.nuclearunicorn.game.ui.ReligionBtnController(this._host.game),c=r.fetchModel({controller:r,id:n.name});s=this._bulkManager.construct(c,r,i),a=n.label}else if(t===O.Ziggurat){const n=game.getUnlockByName(e,"zigguratUpgrades"),r=new com.nuclearunicorn.game.ui.ZigguratBtnController(this._host.game),c=r.fetchModel({controller:r,id:n.name});s=this._bulkManager.construct(c,r,i),a=n.label}else throw new $e("unsupported");i!==s&&(console.warn(...f(`${a} Amount ordered: ${i} Amount Constructed: ${s}`)),s===0)||(t===O.OrderOfTheSun?(this._host.engine.storeForSummary(a,s,"faith"),s===1?this._host.engine.iactivity("act.sun.discover",[a],"ks-faith"):this._host.engine.iactivity("act.sun.discovers",[a,this._host.renderAbsolute(s)],"ks-faith")):(this._host.engine.storeForSummary(a,s,"build"),s===1?this._host.engine.iactivity("act.build",[a],"ks-build"):this._host.engine.iactivity("act.builds",[a,this._host.renderAbsolute(s)],"ks-build")))}getBuildMetaData(e){const t={};for(const i of Object.values(e)){const s=this.getUpgradeMeta(i.building,i.variant);if(s===null)continue;t[i.building]=s;const a=p(t[i.building]);if(!this._getBuild(i.building,i.variant))a.rHidden=!0;else{const n=p(this._getBuild(i.building,i.variant)).model,r=i.variant===O.Cryptotheology?this._host.game.science.get("cryptotheology").researched:!0;a.rHidden=!(n?.visible&&n.enabled&&r)}}return t}getUpgradeMeta(e,t){switch(t){case O.Ziggurat:return this._host.game.religion.getZU(e)??null;case O.OrderOfTheSun:return this._host.game.religion.getRU(e)??null;case O.Cryptotheology:return this._host.game.religion.getTU(e)??null}throw new Error(`Unknown build: ${e} (${t})`)}_getBuild(e,t){switch(t){case O.Ziggurat:return this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"zigguratUpgrades"});case O.OrderOfTheSun:return this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"religion"});case O.Cryptotheology:return this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"transcendenceUpgrades"});default:throw new Error(`Invalid variant \'${t}\'`)}}_transformBtnSacrificeHelper(e,t,i,s){const n=1/(e/t),c=new classes.ui.religion.TransformBtnController(game,i.controllerOpts)._newLink(s,n);return new Promise(o=>{c.handler(new Event("decoy"),o)})}async _autoSacrificeUnicorns(){const e=this._workshopManager.getResource("unicorns"),t=this._workshopManager.getValueAvailable("unicorns");if(!g(this._host.game.religionTab.sacrificeBtn)&&G(this.settings.sacrificeUnicorns.trigger)<=t&&G(this.settings.sacrificeUnicorns.trigger)<=e.value){const i=this._host.game.religionTab.sacrificeBtn.controller,s=this._host.game.religionTab.sacrificeBtn.model;if(g(s))return;await this._transformBtnSacrificeHelper(t,e.value,i,s);const a=this._workshopManager.getValueAvailable("unicorns"),n=t-a;this._host.engine.iactivity("act.sacrificeUnicorns",[this._host.game.getDisplayValueExt(n)],"ks-faith"),this._host.engine.storeForSummary(this._host.engine.i18n("$resources.unicorns.title"),n,"refine")}}async _autoSacrificeAlicorns(e){const t=this._workshopManager.getResource("alicorn"),i=this._workshopManager.getValueAvailable("alicorn");if(!g(this._host.game.religionTab.sacrificeAlicornsBtn)&&G(this.settings.sacrificeAlicorns.trigger)<=i&&G(this.settings.sacrificeAlicorns.trigger)<=t.value){this._host.game.religionTab.sacrificeAlicornsBtn.render();const s=this._host.game.religionTab.sacrificeAlicornsBtn.controller,a=this._host.game.religionTab.sacrificeAlicornsBtn.model;if(g(a)){e.requestGameUiRefresh=!0;return}await this._transformBtnSacrificeHelper(i,t.value,s,a);const n=this._workshopManager.getValueAvailable("alicorn"),r=i-n;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(e){const t=this._workshopManager.getResource("tears"),i=this._workshopManager.getValueAvailable("tears"),s=this._workshopManager.getResource("sorrow");if(!g(this._host.game.religionTab.refineBtn)&&G(this.settings.refineTears.trigger)<=i&&G(this.settings.refineTears.trigger)<=t.value&&s.value<s.maxValue){const a=i-this.settings.refineTears.trigger;if(a<1e4)return;const n=this._host.game.religionTab.refineBtn.controller,r=this._host.game.religionTab.refineBtn.model;if(g(r)){e.requestGameUiRefresh=!0;return}n.buyItem(r,new Event("decoy"),a);const c=this._workshopManager.getValueAvailable("tears"),o=i-c;this._host.engine.iactivity("act.refineTears",[this._host.game.getDisplayValueExt(o)],"ks-faith"),this._host.engine.storeForSummary(this._host.engine.i18n("$resources.tears.title"),o,"refine")}}async _autoTCs(e){const t=this._workshopManager.getResource("timeCrystal"),i=this._workshopManager.getValueAvailable("timeCrystal");if(!g(this._host.game.religionTab.refineTCBtn)&&G(this.settings.refineTimeCrystals.trigger)<=i&&G(this.settings.refineTimeCrystals.trigger)<=t.value){const s=this._host.game.religionTab.refineTCBtn.controller,a=this._host.game.religionTab.refineTCBtn.model;if(g(a)){e.requestGameUiRefresh=!0;return}await this._transformBtnSacrificeHelper(i,t.value,s,a);const n=this._workshopManager.getValueAvailable("timeCrystal"),r=i-n;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 e=this._workshopManager.getResource("faith"),t=e.value/e.maxValue;this.settings.transcend.enabled&&this.settings.autoPraise.trigger-.02<=t&&this._autoTranscend(),this.settings.autoPraise.trigger<=t&&(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(e){const t=this._workshopManager.getResource("faith"),i=this._host.game.religion.faith,s=this._host.game.religion.faithRatio,n=p(this._host.game.religion.getRU("transcendence")).on?this._host.game.religion.transcendenceTier:0,r=10+this._host.game.getEffect("solarRevolutionLimit"),c=r*e,o=i/1e6*n*n*1.01,h=s+o,u=.01+t.value*(1+this._host.game.getUnlimitedDR(h,.1)*.1),d=this._host.game.getLimitedDR(this._host.game.getUnlimitedDR(u,1e3)/100,r);c<=d&&(this._host.game.religion._resetFaithInternal(1.01),this._host.engine.iactivity("act.adore",[this._host.game.getDisplayValueExt(i),this._host.game.getDisplayValueExt(o)],"ks-adore"),this._host.engine.storeForSummary("adore",o))}_autoTranscend(){let e=this._host.game.religion.faithRatio;const t=p(this._host.game.religion.getRU("transcendence")).on;let i=t?this._host.game.religion.transcendenceTier:0;if(t){const s=((i+2)/(i+1))**2,a=this._host.game.religion._getTranscendTotalPrice(i+1)-this._host.game.religion._getTranscendTotalPrice(i),n=a,r=s;if((1-r+Math.sqrt(80*(r*r-1)*n+(r-1)*(r-1)))*r/(40*(r+1)*(r+1)*(r-1))+n+n/(r*r-1)<=e){this._host.game.religion.faithRatio-=a,this._host.game.religion.tcratio+=a,this._host.game.religion.transcendenceTier+=1;const o=p(this._host.game.challenges.getChallenge("atheism"));o.calculateEffects?.(o,this._host.game);const h=p(this._host.game.religion.getTU("blackObelisk"));h.calculateEffects?.(h,this._host.game),this._host.game.msg(this._host.engine.i18n("$religion.transcend.msg.success",[this._host.game.religion.transcendenceTier])),e=this._host.game.religion.faithRatio,i=this._host.game.religion.transcendenceTier,this._host.engine.iactivity("act.transcend",[this._host.game.getDisplayValueExt(a),i],"ks-transcend"),this._host.engine.storeForSummary("transcend",1)}}}_autoPraise(){const e=this._workshopManager.getResource("faith"),t=this._host.game.religion.getApocryphaBonus(),i=e.value*(1+t);this._host.engine.storeForSummary("praise",i),this._host.engine.iactivity("act.praise",[this._host.game.getDisplayValueExt(e.value),this._host.game.getDisplayValueExt(i)],"ks-praise"),this._host.game.religion.praise()}}const ie=(l,e)=>l.filter(t=>!e.includes(t));class As extends y{#e;get policy(){return this.#e}constructor(e,t=!1){super(t),this.#e=e}}class wi extends y{policies;constructor(e=!1){super(e),this.policies=this.initPolicies()}initPolicies(){const e={};for(const t of ds)e[t]=new As(t);return e}static validateGame(e,t){const i=Object.keys(t.policies),s=e.science.policies.map(r=>r.name),a=ie(s,i),n=ie(i,s);for(const r of a)console.warn(...f(`The policy \'${r}\' is not tracked in Kitten Scientists!`));for(const r of n)console.warn(...f(`The policy \'${r}\' is not a policy in Kittens Game!`))}load(e){g(e)||(super.load(e),L(this.policies,e.policies,(t,i)=>{t.enabled=i?.enabled??t.enabled}))}}class Ps extends z{#e;get tech(){return this.#e}constructor(e,t=!1){super(t,-1),this.#e=e}}class ki extends z{techs;constructor(e=!1){super(e,-1),this.techs=this.initTechs()}initTechs(){const e={};for(const t of gs)e[t]=new Ps(t);return e}static validateGame(e,t){const i=Object.keys(t.techs),s=e.science.techs.map(r=>r.name),a=ie(s,i),n=ie(i,s);for(const r of a)pi.includes(r)||console.warn(...f(`The technology \'${r}\' is not tracked in Kitten Scientists!`));for(const r of n){if(pi.includes(r)){console.info(...f(`The technology \'${r}\' is a technology in Kittens Game, but it\'s no longer used.`));continue}console.warn(...f(`The technology \'${r}\' is not a technology in Kittens Game!`))}}load(e){g(e)||(super.load(e),L(this.techs,e.techs,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class St extends y{policies;techs;observe;constructor(e=!1,t=new wi,i=new ki,s=new y){super(e),this.policies=t,this.techs=i,this.observe=s}static validateGame(e,t){wi.validateGame(e,t.policies),ki.validateGame(e,t.techs)}load(e){g(e)||(super.load(e),this.policies.load(e.policies),this.techs.load(e.techs),this.observe.enabled=e.observe?.enabled??this.observe.enabled)}}class ye{_host;constructor(e){this._host=e}upgrade(e,t){let i=!1;if(t==="policy"){const a=game.getUnlockByName(e.name,"policies"),n=new classes.ui.PolicyBtnController(this._host.game),r=n.fetchModel({controller:n,id:a.name});i=ye.skipConfirm(()=>n.buyItem(r)).itemBought}else if(t==="science"){const a=game.getUnlockByName(e.name,"tech"),n=new com.nuclearunicorn.game.ui.TechButtonController(this._host.game),r=n.fetchModel({controller:n,id:a.name});i=ye.skipConfirm(()=>n.buyItem(r)).itemBought}else{const a=game.getUnlockByName(e.name,"upgrades"),n=new com.nuclearunicorn.game.ui.UpgradeButtonController(this._host.game),r=n.fetchModel({controller:n,id:a.name});i=ye.skipConfirm(()=>n.buyItem(r)).itemBought}if(!i)return!1;const s=e.label;return t==="workshop"?(this._host.engine.storeForSummary(s,1,"upgrade"),this._host.engine.iactivity("upgrade.upgrade",[s],"ks-upgrade")):t==="policy"?this._host.engine.iactivity("upgrade.policy",[s]):t==="science"&&(this._host.engine.storeForSummary(s,1,"research"),this._host.engine.iactivity("upgrade.tech",[s],"ks-research")),!0}static async skipConfirmAsync(e){const t=game.ui.confirm;try{return game.ui.confirm=()=>!0,await e()}finally{game.ui.confirm=t}}static skipConfirm(e){const t=game.ui.confirm;try{return game.ui.confirm=()=>!0,e()}finally{game.ui.confirm=t}}}const Bs=l=>new Promise(e=>setTimeout(e,l)),we="en-US",Is=120*1e3,$s="localStorage"in globalThis&&!g(localStorage["ks.timeout"])?Number(localStorage["ks.timeout"]):void 0;class C{_gameStartSignal;_gameStartSignalResolver;_possibleEngineState;static tryEngineStateFromSaveData(e,t){const i=t;if(!(e in i)){console.debug(...f(`Failed: \\`${e}\\` not found in save data.`));return}const s=i.ks;if(!("state"in s)){console.debug(...f(`Failed: \\`${e}.state\\` not found in save data.`));return}const a=s.state;if(!Array.isArray(a)){console.debug(...f(`Failed: \\`${e}.state\\` not \\`Array\\`.`));return}return a[0]}async waitForGame(e,t,i=$s??Is){if(C._isGameLoaded()){const a=p(C.window.game),n=p(C.window.$I),r=localStorage["com.nuclearunicorn.kittengame.language"];return new e(a,n,r,this._possibleEngineState)}const s=[Bs(2e3)];if(g(this._gameStartSignal)&&typeof C.window.dojo<"u"){this._gameStartSignal=new Promise(n=>{this._gameStartSignalResolver=n});const a=C.window.dojo.subscribe("game/start",()=>{console.debug(...f(`\'game/start\' signal caught. Fast-tracking script load for \'${t}\'...`)),p(this._gameStartSignalResolver)(!0),C.window.dojo.unsubscribe(a)});if(t!==void 0){const n=C.window.dojo.subscribe("server/load",r=>{console.info(...f(`\'server/load\' signal caught. Looking for script state with key \'${t}\' in save data...`));const c=C.tryEngineStateFromSaveData(t,r);if(!c){console.info(...f(`The Kittens Game save data did not contain a script state for \'${t}\'.`));return}console.info(...f(`Found key \'${t}\'! Provided save data will be used as seed for next script instance.`)),this._possibleEngineState=c,C.window.dojo.unsubscribe(n)})}}if(g(this._gameStartSignal)||s.push(this._gameStartSignal),i<0)throw new Error("Unable to find game. Giving up. Maybe the game is not exported at `window.game`?");return console.debug(...f(`Waiting for game... (timeout: ${Math.round(i/1e3)}s)`)),await Promise.race(s),this.waitForGame(e,t,i-2e3)}static _isGameLoaded(){return!g(C.window.game)&&(C.window.document.getElementById("game")?.checkVisibility()??!1)&&!g(C.window.$I)}static get window(){try{return p(unsafeWindow)}catch{return window}}}class Ls extends ye{settings;_workshopManager;constructor(e,t,i=new St){super(e),this.settings=i,this._workshopManager=t}async tick(e){this.settings.enabled&&(this.settings.techs.enabled&&this._host.game.libraryTab.visible&&await this.autoUnlock(),this.settings.policies.enabled&&this._host.game.libraryTab.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 s=e.find(n=>n.name===i.tech);if(g(s)){console.error(...f(`Tech \'${i.tech}\' not found in game!`));continue}if(s.researched||!s.unlocked)continue;let a=C.window.dojo.clone(s.prices);a=this._host.game.village.getEffectLeader("scientist",a);for(const n of a){const r=this._workshopManager.getValueAvailable(n.name),c=this._workshopManager.getResource(n.name),o=ee.evaluateSubSectionTrigger(this.settings.techs.trigger,i.trigger);if(o<0||r<c.maxValue*o||r<n.val)continue e}t.push(s)}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 s=e.find(a=>a.name===i.policy);if(g(s)){console.error(...f(`Policy \'${i.policy}\' not found in game!`));continue}!s.researched&&!s.blocked&&s.unlocked&&(s.requiredLeaderJob===void 0||this._host.game.village.leader!==null&&this._host.game.village.leader.job===s.requiredLeaderJob)&&t.push(s)}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 Os extends y{#e;get mission(){return this.#e}constructor(e,t=!1){super(t),this.#e=e}}class _i extends y{missions;constructor(e=!1){super(e),this.missions=this.initMissions()}initMissions(){const e={};for(const t of ms)e[t]=new Os(t);return e}static validateGame(e,t){const i=Object.keys(t.missions),s=e.space.programs.map(r=>r.name),a=ie(s,i),n=ie(i,s);for(const r of a)console.warn(...f(`The space mission \'${r}\' is not tracked in Kitten Scientists!`));for(const r of n)console.warn(...f(`The space mission \'${r}\' is not a space mission in Kittens Game!`))}load(e){g(e)||(super.load(e),L(this.missions,e.missions,(t,i)=>{t.enabled=i?.enabled??t.enabled}))}}class Us extends qe{#e;get building(){return this.#e}constructor(e){super(!1,-1,0),this.#e=e}}class He extends z{buildings;unlockMissions;constructor(e=!1,t=-1,i=new _i){super(e,t),this.buildings=this.initBuildings(),this.unlockMissions=i}initBuildings(){const e={};for(const t of bt)e[t]=new Us(t);return e}static validateGame(e,t){_i.validateGame(e,t.unlockMissions)}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max,t.trigger=i?.trigger??t.trigger}),this.unlockMissions.load(e.unlockMissions))}}class Ds{_host;settings;_bulkManager;_workshopManager;constructor(e,t,i=new He){this._host=e,this.settings=i,this._workshopManager=t,this._bulkManager=new xe(this._host,this._workshopManager)}tick(e){this.settings.enabled&&(this._bulkManager.resetPriceCache(),this.autoBuild(e),this.settings.unlockMissions.enabled&&this.autoUnlock(e))}autoBuild(e,t=this.settings.buildings){const i=this.settings.trigger,s={};for(const n of Object.values(t))s[n.building]=this._host.game.space.getBuilding(n.building);const a=n=>{this.build(n.id,n.count)};e.purchaseOrders.push({builder:a,builds:t,metaData:s,sectionTrigger:i})}autoUnlock(e){if(!this._host.game.tabs[6].visible)return;const t=this._host.game.space.meta[0].meta;e:for(let i=0;i<t.length;i++){if(0<t[i].val||!t[i].unlocked||!this.settings.unlockMissions.missions[t[i].name].enabled)continue;const s=this._host.game.time.queue.getQueueElementControllerAndModel({name:t[i].name,type:"spaceMission"}),a=p(s.model.prices);for(const n of a)if(this._workshopManager.getValueAvailable(n.name)<n.val)continue e;s.controller.buyItem(s.model),i===7||i===12?this._host.engine.iactivity("upgrade.space.mission",[t[i].label],"ks-upgrade"):this._host.engine.iactivity("upgrade.space",[t[i].label],"ks-upgrade")}}build(e,t){let i=0,s;const a=this._host.game.time.queue.getQueueElementControllerAndModel({name:e,type:"spaceBuilding"});s=game.getUnlockByName(e,"spaceBuilding").label;const r=a.controller,c=a.model;return i=this._bulkManager.construct(c,r,t),t!==i&&(console.warn(...f(`${s} Amount ordered: ${t} Amount Constructed: ${i}`)),i===0)?0:(this._host.engine.storeForSummary(s,i,"build"),i===1?this._host.engine.iactivity("act.build",[s],"ks-build"):this._host.engine.iactivity("act.builds",[s,this._host.renderAbsolute(i)],"ks-build"),i)}}var Ci=(l=>(l.accelerate="ks-activity type_ks-accelerate",l.adore="ks-activity type_ks-adore",l.build="ks-activity type_ks-build",l.craft="ks-activity type_ks-craft",l.distribute="ks-activity type_ks-distribute",l.faith="ks-activity type_ks-faith",l.festival="ks-activity type_ks-festival",l.hunt="ks-activity type_ks-hunt",l.misc="ks-activity",l.praise="ks-activity type_ks-praise",l.promote="ks-activity type_ks-promote",l.research="ks-activity type_ks-research",l.star="ks-activity type_ks-star",l.timeSkip="ks-activity type_ks-timeSkip",l.trade="ks-activity type_ks-trade",l.transcend="ks-activity type_ks-transcend",l.upgrade="ks-activity type_ks-upgrade",l))(Ci||{});const Si=["accelerate","adore","build","craft","distribute","faith","festival","hunt","misc","praise","promote","research","star","timeSkip","trade","transcend","upgrade"],xi=["alicornCorruption","alicornRift","alicornSacrifice","astronomicalEvent","blackcoin","craft","elders","faith","festival","hunt","ivoryMeteor","meteor","tcRefine","tcShatter","trade","unicornRift","unicornSacrifice","workshopAutomation"];class Ti extends y{#e;get variant(){return this.#e}constructor(e){super(!0),this.#e=e}}class Ns extends y{filters;filtersGame;constructor(e=!1){super(e),this.filters={};for(const t of Si)this.filters[t]=new Ti(Ci[t]);this.filtersGame={};for(const t of xi)this.filtersGame[t]=new Ti(null)}load(e){g(e)||(super.load(e),L(this.filters,e.filters,(t,i)=>{t.enabled=i?.enabled??t.enabled}),L(this.filtersGame,e.filtersGame,(t,i)=>{t.enabled=i?.enabled??t.enabled}))}}class qs extends z{#e;#t;get upgrade(){return this.#e}get $upgrade(){return this.#t}set $upgrade(e){this.#t=e}constructor(e,t=!1){super(t,-1),this.#e=e}}class Ei extends z{upgrades;constructor(e=!1){super(e,-1),this.upgrades=this.initUpgrades()}initUpgrades(){const e={};for(const t of bi)e[t]=new qs(t);return e}static validateGame(e,t){const i=Object.keys(t.upgrades),s=e.workshop.upgrades.map(r=>r.name),a=ie(s,i),n=ie(i,s);for(const r of a)console.warn(...f(`The workshop upgrade \'${r}\' is not tracked in Kitten Scientists!`));for(const r of n)console.warn(...f(`The workshop upgrade \'${r}\' is not an upgrade in Kittens Game!`))}load(e){g(e)||(super.load(e),L(this.upgrades,e.upgrades,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class zs extends bs{#e;get resource(){return this.#e}constructor(e,t=!1,i=!0){super(t,i),this.#e=e}}class Fe extends z{resources;shipOverride;unlockUpgrades;constructor(e=!1,t=-1,i=new Ei,s=new y){super(e,t),this.resources=this.initResources(),this.shipOverride=s,this.unlockUpgrades=i}initResources(){const e={};for(const t of di)e[t]=new zs(t);return e}static validateGame(e,t){const i=Object.keys(t.resources),s=e.workshop.crafts.map(r=>r.name),a=ie(s,i),n=ie(i,s);for(const r of a)console.warn(...f(`The workshop craft \'${r}\' is not tracked in Kitten Scientists!`));for(const r of n)console.warn(...f(`The workshop craft \'${r}\' is not an upgrade in Kittens Game!`));Ei.validateGame(e,t.unlockUpgrades)}load(e){g(e)||(super.load(e),L(this.resources,e.resources,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.limited=i?.limited??t.limited,t.max=i?.max??t.max,t.trigger=i?.trigger??t.trigger}),this.unlockUpgrades.load(e.unlockUpgrades),this.shipOverride.enabled=e.shipOverride?.enabled??this.shipOverride.enabled)}}class Mi extends ye{settings;static DEFAULT_CONSUME_RATE=1;constructor(e,t=new Fe){super(e),this.settings=t}tick(e){return this.settings.enabled?(this.autoCraft(),this._host.engine.settings.highlighStock.enabled&&this.refreshStock(),this.settings.unlockUpgrades.enabled?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 s=i.$upgrade??e.find(n=>n.name===i.upgrade);if(g(s)){console.error(...f(`Upgrade \'${i.upgrade}\' not found in game!`));continue}if(i.$upgrade===void 0&&(i.$upgrade=s),s.researched||!s.unlocked)continue;let a=C.window.dojo.clone(s.prices);a=this._host.game.village.getEffectLeader("scientist",a);for(const n of a){const r=this.getValueAvailable(n.name),c=this.getResource(n.name),o=ee.evaluateSubSectionTrigger(this.settings.unlockUpgrades.trigger,i.trigger);if(o<0||0<o&&r<c.maxValue*o||r<n.val)continue e}t.push(s)}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 n of Object.values(e)){const r=ee.evaluateSubSectionTrigger(i,n.trigger);if(r<0||!n.enabled)continue;const c=n.max?this.getResource(n.resource):!1,o=G(n.max);if(c&&o<c.value||!this.singleCraftPossible(n.resource))continue;const h=Object.keys(this.getMaterials(n.resource));h.map(m=>this.getResource(m)).filter(m=>0<m.maxValue).filter(m=>m.value/m.maxValue<r).length===0&&t.set(n,{countRequested:1,materials:h.map(m=>({consume:0,resource:m}))})}if(t.size<1)return;const s=new Map;for(const[n,r]of t)for(const c of r.materials)s.has(c.resource)||s.set(c.resource,new Array),p(s.get(c.resource)).push(n.resource);for(const[,n]of t)for(const r of n.materials){const c=this.getValueAvailable(r.resource);r.consume=c/p(s.get(r.resource)).length}for(const[n,r]of t){const c=this.getMaterials(n.resource);let o=Number.MAX_VALUE;for(const m of r.materials){const v=p(c[m.resource]),b=this.getResource(m.resource);if(!n.limited||n.resource==="ship"&&this.settings.shipOverride.enabled&&this.getResource("ship").value<243){o=Math.min(o,m.consume/v);continue}const S=this._host.game.getResCraftRatio(n.resource),R=this.getValueAvailable(m.resource)/p(s.get(m.resource)).length,Z=this.getValueAvailable(n.resource),ce=v,j=1+S,re=R/ce,pe=Z/j,oe=Math.max(0,Math.floor(Math.log(pe)/Math.LN10+1e-9));o=Math.min(o,Math.min(re-(0<b.maxValue&&b.maxValue<=b.value?0:pe),10**(oe+1)),m.consume/v)}const h=this.getValueAvailable(n.resource),u=1+this._host.game.getResCraftRatio(n.resource),d=Number.MAX_VALUE/u-h/u;o=Math.min(o,d),r.countRequested=Math.max(0,n.max===-1?o:Math.min(o,(n.max-h)/u))}const a=new Array;for(const[n,r]of t)r.countRequested<1||a.push({amount:Math.floor(r.countRequested),name:n.resource});0<a.length&&this.craftMultiple(a)}craftMultiple(e){const t=new Array;for(const i of e){const s=this.getCraft(i.name),a=this._host.game.getResCraftRatio(s.name);if(!this._host.game.workshop.craft(s.name,i.amount,!0,!1,!1)){console.error(...f(`Failed trying to craft ${i.amount}x ${i.name}! This is a problem and should be reported.`));continue}const r=p(this._host.game.resPool.get(i.name)).title,c=Number.parseFloat((i.amount*(1+a)).toFixed(2));this._host.engine.storeForSummary(r,c,"craft"),t.push(this._host.engine.i18n("act.craft",[this._host.game.getDisplayValueExt(c),r]))}this._host.game.updateResources();for(const i of t)this._host.engine.printOutput("ks-activity type_ks-craft",i)}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,s]of P(t))if(this.getValueAvailable(i)<s)return!1;return!0}getMaterials(e){const t={},i=this.getCraft(e),s=this._host.game.workshop.getCraftPrice(i);for(const a of s)t[a.name]=a.val;return t}getTickVal(e,t,i=void 0){let s=this._host.game.getResourcePerTick(e.name,!0);if(e.craftable){let a=Number.MAX_VALUE;const n=this.getMaterials(e.name);for(const[r,c]of P(n)){const o=(1+this._host.game.getResCraftRatio(e.name))/c,h=this.getTickVal(this.getResource(r));h!=="ignore"&&(a=Math.min(h*o,a))}s+=a!==Number.MAX_VALUE?a:0}return s<=0&&(e.name==="spice"||e.name==="blueprint")?"ignore":(!i&&!g(t)&&(s+=t.getResValue(e.name)),s)}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(g(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,n=this._host.game.bld.getBuildingExt("aqueduct").meta,r=a.stage===0?a.val:0,c=n.stage===0?n.val:0,o=this.getPotentialCatnip(!0,r,c);o<0&&(t-=o*202*5)}let i=this.getValue(e);i=Math.max(i-t,0);const s=this.getConsume(e);return i*s}getPotentialCatnip(e,t,i){let s=this._host.game.getEffect("catnipPerTickBase");e?(s*=.1,s*=1+this._host.game.getLimitedDR(this._host.game.getEffect("coldHarshness"),1)):s*=this._host.game.calendar.getWeatherMod({name:"catnip"})+this._host.game.calendar.getCurSeason().modifiers.catnip,this._host.game.science.getPolicy("communism").researched&&(s=0);const a=this._host.game.village.getResProduction(),n=a.catnip?a.catnip*(1+this._host.game.getEffect("catnipJobRatio")):0;let r=s+n,c=this._host.game.space.getBuilding("hydroponics").val;this._host.game.prestige.meta[0].meta[21].researched&&(this._host.game.calendar.cycle===2&&(c*=2),this._host.game.calendar.cycle===7&&(c*=.5)),r*=1+.03*i+.025*c;const h=this._host.game.challenges.currentChallenge==="winterIsComing"?0:this._host.game.prestige.getParagonProductionRatio();r*=1+h,r*=1+this._host.game.religion.getSolarRevolutionRatio(),this._host.game.opts.disableCMBR||(r*=1+this._host.game.getCMBRBonus()),r=p(this._host.game.calendar.cycleEffectsFestival({catnip:r}).catnip);let u=this._host.game.village.getResConsumption().catnip;const d=this._host.game.bld.getBuildingExt("unicornPasture").meta.val;if(u*=1+this._host.game.getLimitedDR(t*-.005+d*-.0015,1),this._host.game.village.sim.kittens.length>0&&this._host.game.village.happiness>1){const m=this._host.game.village.happiness-1,v=this._host.game.getEffect("catnipDemandWorkerRatioGlobal");this._host.game.challenges.currentChallenge==="anarchy"?u*=1+m*(1+v):u*=1+m*(1+v)*(1-this._host.game.village.getFreeKittens()/this._host.game.village.sim.kittens.length)}return r+=u,r+=this._host.game.getResourcePerTickConvertion("catnip"),r}refreshStock(){const e=[...document.querySelectorAll("#game .res-row .res-cell.resAmount, #game .res-row .res-cell.resource-value")],t=new Map(e.map(i=>[p([...i.parentNode.classList.entries()].find(([s,a])=>a.startsWith("resource_")))[1].substring(9),i]));for(const[i,s]of P(this._host.engine.settings.resources.resources)){const a=t.get(i);if(!a)continue;if(!s.enabled||s.stock===0){(a.classList.contains("ks-stock-above")||a.classList.contains("ks-stock-below"))&&a.classList.remove("ks-stock-above","ks-stock-below");continue}const n=this._host.game.resPool.get(i).value<s.stock;a.classList.add(n?"ks-stock-below":"ks-stock-above"),a.classList.remove(n?"ks-stock-above":"ks-stock-below")}}}class Hs extends y{#e;consume;stock=0;get resource(){return this.#e}constructor(e,t=!1,i=Mi.DEFAULT_CONSUME_RATE,s=0){super(t),this.#e=e,this.consume=i,this.stock=s}}class Fs extends y{resources;constructor(e=!1){super(e),this.resources=this.initResources()}initResources(){const e={};for(const t of gi)e[t]=new Hs(t);return e}load(e){g(e)||(super.load(e),L(this.resources,e.resources,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.consume=i?.consume??t.consume,t.stock=i?.stock??t.stock}))}}class Ws extends y{noConfirm;compress;constructor(e=new y,t=new y(!0)){super(!0),this.noConfirm=e,this.compress=t}load(e){g(e)||(super.load(e),this.noConfirm.load(e.noConfirm),this.compress.load(e.compress))}}class Ri extends y{interval=2e3;locale;ksColumn;highlighStock;filters;resources;states;constructor(e=!1,t=new Ns,i=new Fs,s=new Ws,a=we,n=new y,r=new y){super(e),this.filters=t,this.resources=i,this.states=s,this.locale=new wt(a,[{label:"Deutsch",value:"de-DE"},{label:"English",value:"en-US"},{label:"עִברִית",value:"he-IL"},{label:"中文",value:"zh-CN"}]),this.ksColumn=n,this.highlighStock=r}load(e,t=!1){g(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.highlighStock.load(e.highlighStock)),this.filters.load(e.filters),this.resources.load(e.resources))}}class Ai extends Q{#e=void 0;get baseBuilding(){return this.#e}#t;get building(){return this.#t}#i=0;get stage(){return this.#i}constructor(e,t=!1,i=-1,s){super(t,i),this.#t=e,s&&(this.#i=1,this.#e=s)}}class Gs extends y{buildings;constructor(e=!0){super(e),this.buildings=this.initBuildings()}initBuildings(){const e={broadcasttower:"amphitheatre",dataCenter:"library",hydroplant:"aqueduct",solarfarm:"pasture",spaceport:"warehouse"},t={};for(const i of gt)i!=="unicornPasture"&&(t[i]=new Ai(i));for(const i of De)t[i]=new Ai(i,!1,-1,e[i]);return t}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class We extends Q{#e;#t;get building(){return this.#e}get variant(){return this.#t}constructor(e,t,i=!1,s=-1){super(i,s),this.#e=e,this.#t=t}}class Zs extends y{buildings;constructor(e=!0){super(e),this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of mt)e[t]=new We(t,O.OrderOfTheSun);for(const t of ft)e[t]=new We(t,O.Cryptotheology);for(const t of pt)e[t]=new We(t,O.Ziggurat);return e.unicornPasture=new We("unicornPasture",O.UnicornPasture),e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class Ks extends Q{#e;get resource(){return this.#e}constructor(e,t=!1,i=-1){super(t,i),this.#e=e}}class Vs extends y{resources;constructor(e=!0){super(e),this.resources=this.initResources()}initResources(){const e={};for(const t of gi)e[t]=new Ks(t);return e}load(e){g(e)||(super.load(e),L(this.resources,e.resources,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class js extends Q{#e;get building(){return this.#e}constructor(e,t=!1,i=-1){super(t,i),this.#e=e}}class Js extends y{buildings;constructor(e=!0){super(e),this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of bt)e[t]=new js(t);return e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class Pi extends Q{#e;#t;get building(){return this.#e}get variant(){return this.#t}constructor(e,t,i=!1,s=-1){super(i,s),this.#e=e,this.#t=t}}class Xs extends y{buildings;constructor(e=!0){super(e),this.buildings=this.initBuildings()}initBuildings(){const e={};for(const t of vt)e[t]=new Pi(t,Y.Chronoforge);for(const t of yt)t!=="usedCryochambers"&&(e[t]=new Pi(t,Y.VoidSpace));return e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.trigger=i?.trigger??t.trigger}))}}class Ys extends y{#e;get upgrade(){return this.#e}constructor(e,t=!1){super(t),this.#e=e}}class Qs extends y{upgrades;constructor(e=!1){super(e),this.upgrades=this.initUpgrades()}initUpgrades(){const e={};for(const t of bi)e[t]=new Ys(t);return e}load(e){g(e)||(super.load(e),L(this.upgrades,e.upgrades,(t,i)=>{t.enabled=i?.enabled??t.enabled}))}}class en extends y{bonfire;religion;resources;space;time;upgrades;constructor(e=!0,t=new Gs,i=new Zs,s=new Vs,a=new Js,n=new Xs,r=new Qs){super(e),this.bonfire=t,this.religion=i,this.resources=s,this.space=a,this.time=n,this.upgrades=r}load(e){g(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 tn extends z{cycles;activeHeatTransferStatus;constructor(e=new y){super(!1,1),this.cycles=this.initCycles(),this.activeHeatTransferStatus=e}initCycles(){const e={};for(const t of de)e[t]=new y;return e}load(e){g(e)||(super.load(e),L(this.cycles,e.cycles,(t,i)=>{t.enabled=i?.enabled??t.enabled}),this.activeHeatTransferStatus.load(e.activeHeatTransferStatus))}}class sn extends ys{cycles;seasons;activeHeatTransfer;ignoreOverheat;constructor(e=new y,t=new tn){super(!1,5),this.cycles=this.initCycles(),this.seasons=this.initSeason(),this.activeHeatTransfer=t,this.ignoreOverheat=e}initCycles(){const e={};for(const t of de)e[t]=new y;return e}initSeason(){const e={};for(const t of hs)e[t]=new y;return e}load(e){g(e)||(super.load(e),L(this.cycles,e.cycles,(t,i)=>{t.enabled=i?.enabled??t.enabled}),L(this.seasons,e.seasons,(t,i)=>{t.enabled=i?.enabled??t.enabled}),this.ignoreOverheat.load(e.ignoreOverheat),this.activeHeatTransfer.load(e.activeHeatTransfer))}}class Bi extends y{accelerateTime;timeSkip;reset;constructor(e=!1,t=new z(!1,1),i=new en,s=new sn){super(e),this.accelerateTime=t,this.reset=i,this.timeSkip=s}load(e){g(e)||(super.load(e),this.accelerateTime.load(e.accelerateTime),this.reset.load(e.reset),this.timeSkip.load(e.timeSkip))}}class Ii extends qe{#e;#t;get building(){return this.#e}get variant(){return this.#t}constructor(e,t,i=!1){super(i,-1,0),this.#e=e,this.#t=t}}class $i extends z{buildings;fixCryochambers;constructor(e=!1,t=-1,i=new y){super(e,t),this.buildings=this.initBuildings(),this.fixCryochambers=i}initBuildings(){const e={};for(const t of vt)e[t]=new Ii(t,Y.Chronoforge);for(const t of yt)t!=="usedCryochambers"&&(e[t]=new Ii(t,Y.VoidSpace));return e}load(e){g(e)||(super.load(e),L(this.buildings,e.buildings,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max,t.trigger=i?.trigger??t.trigger}),this.fixCryochambers.load(e.fixCryochambers))}}class nn extends yi{#e;get race(){return this.#e}constructor(e,t=!1){super(t),this.#e=e}}class an extends z{races;constructor(e=!1){super(e),this.races=this.initRaces()}initRaces(){const e={};for(const t of fi)t!=="leviathans"&&(e[t]=new nn(t));return e}load(e){g(e)||(super.load(e),L(this.races,e.races,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max}))}}class rn extends vs{#e;seasons;#t;get race(){return this.#e}get require(){return this.#t}constructor(e,t,i,s,a,n,r,c=!1){super(t,i),this.#e=e,this.seasons={autumn:new y(a),spring:new y(r),summer:new y(s),winter:new y(n)},this.#t=c}}class Li extends z{races;feedLeviathans;buildEmbassies;tradeBlackcoin;unlockRaces;constructor(e=!1,t=-1,i=new an,s=new y,a=new ws(!1,1090,1095,1e4),n=new y){super(e,t),this.races=this.initRaces(),this.buildEmbassies=i,this.feedLeviathans=s,this.tradeBlackcoin=a,this.unlockRaces=n}initRaces(){const e={dragons:"titanium",griffins:"wood",leviathans:"unobtainium",lizards:"minerals",sharks:"iron"},t={};for(const i of fi){const s=e[i]??!1;t[i]=new rn(i,!1,!1,!1,!1,!1,!1,s)}return t}load(e){g(e)||(super.load(e),L(this.races,e.races,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.limited=i?.limited??t.limited,t.trigger=i?.trigger??t.trigger,t.seasons.autumn.enabled=i?.seasons.autumn.enabled??t.seasons.autumn.enabled,t.seasons.spring.enabled=i?.seasons.spring.enabled??t.seasons.spring.enabled,t.seasons.summer.enabled=i?.seasons.summer.enabled??t.seasons.summer.enabled,t.seasons.winter.enabled=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 on extends y{job;trait;constructor(e=!1,t=new wt("any",mi.map(s=>({label:"",value:s}))),i=new wt("none",us.map(s=>({label:"",value:s})))){super(e),this.job=t,this.trait=i}load(e){g(e)||(super.load(e),this.job.load(e.job),this.trait.load(e.trait))}}class Oi extends y{jobs;holdFestivals;hunt;promoteKittens;promoteLeader;electLeader;constructor(e=!1,t=new y,i=new z(!1,.98),s=new z(!1,1),a=new y,n=new on){super(e),this.jobs=this.initJobs(),this.holdFestivals=t,this.hunt=i,this.promoteKittens=s,this.promoteLeader=a,this.electLeader=n}initJobs(){const e={};for(const t of mi)e[t]=new yi(!1,0);return e}load(e){g(e)||(super.load(e),L(this.jobs,e.jobs,(t,i)=>{t.enabled=i?.enabled??t.enabled,t.max=i?.max??t.max}),this.holdFestivals.enabled=e.holdFestivals?.enabled??this.holdFestivals.enabled,this.hunt.load(e.hunt),this.promoteKittens.enabled=e.promoteKittens?.enabled??this.promoteKittens.enabled,this.promoteLeader.enabled=e.promoteLeader?.enabled??this.promoteLeader.enabled,this.electLeader.load(e.electLeader))}}class ln{_host;settings;_religionManager;_workshopManager;constructor(e,t,i,s,a=new Bi){this._host=e,this.settings=a,this._religionManager=i,this._workshopManager=s}async tick(e){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(e){if(this._host.game.challenges.currentChallenge)return;const t=[];for(const[a,n]of P(this.settings.reset.bonfire.buildings)){if(!n.enabled)continue;if(n.trigger<0)return;let r;try{r=this._host.game.bld.getBuildingExt(a)}catch{r=null}if(!g(r)&&(t.push({name:r.meta.label??p(r.meta.stages)[p(r.meta.stage)].label,trigger:n.trigger,val:r.meta.val}),r.meta.val<n.trigger))return}const i=this.settings.reset.religion.buildings.unicornPasture;if(i.enabled){if(i.trigger<0)return;const a=this._host.game.bld.getBuildingExt("unicornPasture");if(t.push({name:p(a.meta.label),trigger:i.trigger,val:a.meta.val}),a.meta.val<i.trigger)return}for(const[a,n]of P(this.settings.reset.space.buildings)){if(!n.enabled)continue;if(n.trigger<0)return;const r=this._host.game.space.getBuilding(a);if(t.push({name:r.label,trigger:n.trigger,val:r.val}),r.val<n.trigger)return}for(const[a,n]of P(this.settings.reset.religion.buildings)){if(!n.enabled)continue;if(n.trigger<0)return;const r=p(this._religionManager.getUpgradeMeta(a,n.variant));if(t.push({name:r.label,trigger:n.trigger,val:r.val}),r.val<n.trigger)return}for(const[a,n]of P(this.settings.reset.time.buildings)){if(!n.enabled)continue;if(n.trigger<0)return;const r=p(this.getBuild(a,n.variant));if(t.push({name:r.label,trigger:n.trigger,val:r.val}),r.val<n.trigger)return}for(const[a,n]of P(this.settings.reset.resources.resources)){if(!n.enabled)continue;if(n.trigger<0)return;const r=p(this._host.game.resPool.get(a));if(t.push({name:this._host.engine.i18n(`$resources.${n.resource}.title`),trigger:n.trigger,val:r.value}),r.value<n.trigger)return}for(const[,a]of P(this.settings.reset.upgrades.upgrades))if(a.enabled){const n=p(this._host.game.workshop.upgrades.find(r=>r.name===a.upgrade));if(t.push({name:n.label,trigger:1,val:n.researched?1:0}),!n.researched)return}if(t.length===0)return;e.stop(!1);const s=async(a=1500)=>new Promise((n,r)=>{if(!this._host.engine.settings.enabled){r(new Error("canceled by player"));return}setTimeout(n,a)});try{for(const a of t)await s(500),this._host.engine.imessage("reset.check",[a.name,this._host.game.getDisplayValueExt(a.trigger),this._host.game.getDisplayValueExt(a.val)]);await s(0),this._host.engine.imessage("reset.checked"),await s(),this._host.engine.iactivity("reset.tip"),await s(),this._host.engine.imessage("reset.countdown.10"),await s(2e3),this._host.engine.imessage("reset.countdown.9"),await s(),this._host.engine.imessage("reset.countdown.8"),await s(),this._host.engine.imessage("reset.countdown.7"),await s(),this._host.engine.imessage("reset.countdown.6"),await s(),this._host.engine.imessage("reset.countdown.5"),await s(),this._host.engine.imessage("reset.countdown.4"),await s(),this._host.engine.imessage("reset.countdown.3"),await s(),this._host.engine.imessage("reset.countdown.2"),await s(),this._host.engine.imessage("reset.countdown.1"),await s(),this._host.engine.imessage("reset.countdown.0"),await s(),this._host.engine.iactivity("reset.last.message"),await s()}catch{this._host.engine.imessage("reset.cancel.message"),this._host.engine.iactivity("reset.cancel.activity");return}for(let a=0;a<this._host.game.challenges.challenges.length;a++)this._host.game.challenges.challenges[a].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 t=this._host.game.resPool.get("temporalFlux");t.maxValue*this.settings.accelerateTime.trigger<=t.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 e=this._host.game.getEffect("shatterCostIncreaseChallenge"),t=this._workshopManager.getValueAvailable("timeCrystal");if(t<this.settings.timeSkip.trigger||t<1+e)return;const i=this._host.game.getEffect("shatterVoidCost"),s=this._workshopManager.getValueAvailable("void");if(s<i)return;const a=this._host.game.calendar.season;if(!this.settings.timeSkip.seasons[this._host.game.calendar.seasons[a].name].enabled)return;const n=this._host.game.calendar.cycle;if(!this.settings.timeSkip.cycles[de[n]].enabled)return;const r=this._host.game.getEffect("heatMax"),c=this._host.game.time.heat;if(!this.settings.timeSkip.ignoreOverheat.enabled&&r<=c)return;const o=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 R=this._host.game.getEffect("heatPerTick"),Z=this._host.game.ticksPerSecond;if(this.settings.timeSkip.activeHeatTransfer.activeHeatTransferStatus.enabled){c<=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 ce=this._host.game.getEffect("temporalFluxProduction"),j=(this._host.game.calendar.daysPerSeason+10+this._host.game.getEffect("temporalParadoxDay"))*this._host.game.calendar.seasonsPerYear,re=this._host.game.calendar.ticksPerDay,pe=(1+this._host.game.timeAccelerationRatio())/re,oe=j/pe,be=this._host.game.resPool.get("temporalFlux"),Ce=be.maxValue>oe,nt=be.value<oe;if(!a&&this._host.game.calendar.day<10&&ce>o/R&&this.settings.accelerateTime.enabled&&Ce&&nt)h=Math.ceil((oe+re*10-be.value)/ce),this._host.engine.iactivity("act.time.getTemporalFlux",[],"ks-timeSkip"),this._host.engine.storeForSummary("time.getTemporalFlux",1);else{if(this.settings.timeSkip.activeHeatTransfer.cycles[de[n]].enabled)return;h=this._host.game.calendar.yearsPerCycle-this._host.game.calendar.cycleYear}}else c>=r-R*Z*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 u=G(this.settings.timeSkip.max);let d=Math.floor(Math.min(this.settings.timeSkip.ignoreOverheat.enabled?Number.POSITIVE_INFINITY:(r-c)/o,u,h,t/(1+e),0<i?s/i:Number.POSITIVE_INFINITY)),m=0;const v=this._host.game.calendar.yearsPerCycle,b=v-this._host.game.calendar.cycleYear,S=this._host.game.calendar.cyclesPerEra;if(d<b)m=d;else{m+=b,d-=b;let R=1;for(;v<d&&this.settings.timeSkip.cycles[de[(n+R)%S]].enabled;)m+=v,d-=v,R+=1;this.settings.timeSkip.cycles[de[(n+R)%S]].enabled&&0<d&&(m+=d)}if(0<m){const R=new classes.ui.time.ShatterTCBtnController(this._host.game),Z=R.fetchModel({});R.doShatterAmt(Z,m),this._host.engine.iactivity("act.time.skip",[m],"ks-timeSkip"),this._host.engine.storeForSummary("time.skip",m)}}getBuild(e,t){return t===Y.Chronoforge?this._host.game.time.getCFU(e):this._host.game.time.getVSU(e)}}class cn{_host;settings;_bulkManager;_workshopManager;constructor(e,t,i=new $i){this._host=e,this.settings=i,this._bulkManager=new xe(this._host,t),this._workshopManager=t}tick(e){this.settings.enabled&&(this._bulkManager.resetPriceCache(),this.autoBuild(e),this.settings.fixCryochambers.enabled&&this.fixCryochambers())}autoBuild(e,t=this.settings.buildings){const i=this.settings.trigger,s={};for(const n of Object.values(t)){const r=n.variant===Y.Chronoforge?this._host.game.time.getCFU(n.building):this._host.game.time.getVSU(n.building);s[n.building]=p(r);const c=n.variant===Y.Chronoforge?this._host.game.time.queue.getQueueElementControllerAndModel({name:n.building,type:"chronoforge"}):this._host.game.time.queue.getQueueElementControllerAndModel({name:n.building,type:"voidSpace"}),o=n.variant===Y.Chronoforge?this._host.game.workshop.get("chronoforge").researched:this._host.game.science.get("voidSpace").researched||this._host.game.time.getVSU("usedCryochambers").val>0,h=c.model,u=p(s[n.building]);u.tHidden=!h.metadata.unlocked||!o}const a=n=>{this.build(n.id,n.variant,n.count)};e.purchaseOrders.push({builder:a,builds:t,metaData:s,sectionTrigger:i})}build(e,t,i){let s=0,a;if(t===Y.Chronoforge){const n=game.getUnlockByName(e,"chronoforge"),r=new classes.ui.time.ChronoforgeBtnController(this._host.game),c=r.fetchModel({controller:r,id:n.name});s=this._bulkManager.construct(c,r,i),a=n.label}else{const n=game.getUnlockByName(e,"voidSpace"),r=new classes.ui.time.VoidSpaceBtnController(this._host.game),c=r.fetchModel({controller:r,id:n.name});s=this._bulkManager.construct(c,r,i),a=n.label}i!==s&&(console.warn(...f(`${a} Amount ordered: ${i} Amount Constructed: ${s}`)),s===0)||(this._host.engine.storeForSummary(a,s,"build"),s===1?this._host.engine.iactivity("act.build",[a],"ks-build"):this._host.engine.iactivity("act.builds",[a,this._host.renderAbsolute(s)],"ks-build"))}getBuild(e,t){return t===Y.Chronoforge?this._host.game.time.getCFU(e):this._host.game.time.getVSU(e)}fixCryochambers(){if(this._host.game.time.getVSU("usedCryochambers").val<1)return;const e=p(this._host.game.time.getVSU("usedCryochambers").fixPrices);for(const n of e)if(this._workshopManager.getValueAvailable(n.name)<n.val)return;const t=new classes.ui.time.FixCryochamberBtnController(this._host.game),i=t.fetchModel({});let s=0,a;do a=!1,a=t.buyItem(i).itemBought,s+=a?1:0;while(a);0<s&&(this._host.engine.iactivity("act.fix.cry",[this._host.renderAbsolute(s)],"ks-fixCry"),this._host.engine.storeForSummary("fix.cry",s))}}class hn{_host;settings;_workshopManager;constructor(e,t,i=new Li){this._host=e,this.settings=i,this._workshopManager=t}tick(e){this.settings.enabled&&(this.autoTrade(),this.settings.unlockRaces.enabled&&this.autoUnlock(e),this.settings.buildEmbassies.enabled&&this.autoBuildEmbassies(e),this.settings.feedLeviathans.enabled&&this.autoFeedElders(),this.settings.tradeBlackcoin.enabled&&this.autoTradeBlackcoin())}autoTrade(e){const t=this._workshopManager.getResource("manpower"),i=this._workshopManager.getResource("gold"),s=this.settings.trigger,a=[],n=this._host.game.calendar.getCurSeason().name;for(const u of Object.values(this.settings.races)){const d=this.getRace(u.race),m=ee.evaluateSubSectionTrigger(s,u.trigger);if(m<0||!u.enabled||!u.seasons[n].enabled||!d.unlocked||!this.singleTradePossible(s,t,i,u))continue;const v=u.require?this._workshopManager.getResource(u.require):!1,b=this.getProfitability(u.race);(u.limited&&b||!v||m<=v.value/v.maxValue)&&a.push(u.race)}if(a.length===0)return;let r=this.getLowestTradeAmount(null,!0,!1);if(r<1)return;const c=[];for(let u=0;u<a.length;u++){const d=a[u],m=this.settings.races[d],v=m.require?this._workshopManager.getResource(m.require):!1,b=ee.evaluateSubSectionTrigger(s,m.trigger),S=(!v||b<=v.value/v.maxValue)&&b<=i.value/i.maxValue,R=this.getLowestTradeAmount(d,m.limited,S);if(R<1){a.splice(u,1),u--;continue}c.push(R)}if(a.length===0)return;const o={};for(;0<a.length&&1<=r;){if(r<a.length){const v=Math.floor(Math.random()*a.length),b=a[v];g(o[b])&&(o[b]=0),o[b]+=1,r-=1,a.splice(v,1),c.splice(v,1);continue}let u=Math.floor(r/a.length),d=0;const m=a[d];for(let v=0;v<a.length;++v)c[v]<u&&(u=c[v],d=v);g(o[m])&&(o[m]=0),o[m]+=u,r-=u,a.splice(d,1),c.splice(d,1)}if(Object.values(o).length===0)return;const h={};for(const[u,d]of P(o)){const m=this.getRace(u),v=this.getMaterials(u);for(const[S,R]of P(v))h[S]||(h[S]=0),h[S]-=R*d;const b=this.getAverageTrade(m);for(const[S,R]of P(b)){const Z=this._workshopManager.getResource(S);h[S]||(h[S]=0),h[S]+=Z.maxValue>0?Math.min(p(b[S])*p(o[u]),Math.max(Z.maxValue-Z.value,0)):R*p(o[u])}}g(e)||e.pushToCache({materials:h,timeStamp:this._host.game.timer.ticksTotal});for(const[u,d]of P(o))0<d&&this.trade(u,d)}autoBuildEmbassies(e){if(!this._host.game.diplomacy.races[0].embassyPrices)return;const t=this._workshopManager.getResource("culture");let i=0;const s=this.settings.buildEmbassies.trigger;if(t.value/t.maxValue<G(s))return;i=this._workshopManager.getValueAvailable("culture");const a={},n=[];for(const r of this._host.game.diplomacy.races){const c=r.name;if(!(c in this.settings.buildEmbassies.races))continue;const o=G(this.settings.buildEmbassies.races[c].max);!this.settings.buildEmbassies.races[c].enabled||o<=r.embassyLevel||!r.unlocked||(a[c]={basePrice:p(r.embassyPrices?.[0]).val,currentEm:r.embassyLevel,max:o,priceSum:0,race:r,val:0},n.push(c))}if(n.length!==0){for(;n.length>0;)for(let r=0;r<n.length;r++){const c=n[r],o=p(a[c]);if(o.max<=o.currentEm+o.val){n.splice(r,1),--r;continue}const h=o.basePrice*1.15**(o.currentEm+o.val);h<=i?(i-=h,o.priceSum+=h,o.val+=1,e.requestGameUiRefresh=!0):(n.splice(r,1),--r)}for(const[,r]of P(a))r.val!==0&&(i=this._workshopManager.getValueAvailable("culture"),i<r.priceSum&&console.warn(...f("Something has gone horribly wrong.",r.priceSum,i)),this._workshopManager.getResource("culture").value-=r.priceSum,r.race.embassyLevel+=r.val,this._host.engine.storeForSummary("embassy",r.val),r.val!==1?this._host.engine.iactivity("build.embassies",[r.val,r.race.title],"ks-build"):this._host.engine.iactivity("build.embassy",[r.val,r.race.title],"ks-build"))}}autoFeedElders(){const e=this._host.game.diplomacy.get("leviathans"),t=this._host.game.resPool.get("necrocorn");!e.unlocked||t.value===0||(1<=t.value?e.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",t.value),this._host.game.diplomacy.feedElders(),this._host.engine.iactivity("dispose.necrocorn")))}autoUnlock(e){if(!this._host.game.tabs[4].visible)return;const t=this._host.game.diplomacy.get("leviathans").unlocked?8:7;if(this._host.game.diplomacyTab.racePanels.length<t){let i=this._workshopManager.getValueAvailable("manpower");if(!this._host.game.diplomacy.get("lizards").unlocked&&i>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("sharks").unlocked&&i>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("griffins").unlocked&&i>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("nagas").unlocked&&this._host.game.resPool.get("culture").value>=1500&&i>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("zebras").unlocked&&this._host.game.resPool.get("ship").value>=1&&i>=1e3){this._host.game.resPool.get("manpower").value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.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&&i>=1e3){p(this._host.game.resPool.get("manpower")).value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}if(!this._host.game.diplomacy.get("dragons").unlocked&&this._host.game.science.get("nuclearFission").researched&&i>=1e3){p(this._host.game.resPool.get("manpower")).value-=1e3;const s=p(this._host.game.diplomacy.unlockRandomRace());this._host.engine.iactivity("upgrade.race",[s.title],"ks-upgrade"),i-=1e3,e.requestGameUiRefresh=!0}}}autoTradeBlackcoin(){const e=this._host.game.calendar.cryptoPrice,t=this._host.game.resPool.get("relic").value,i=this._host.game.resPool.get("blackcoin").value;let s=0,a=0;if(e<this.settings.tradeBlackcoin.buy&&this.settings.tradeBlackcoin.trigger<t){this._host.game.diplomacy.buyBcoin();const n=this._host.game.resPool.get("blackcoin").value;s=Math.round(n-i),this._host.engine.iactivity("act.blackcoin.buy",[this._host.renderAbsolute(s)])}else if(e>this.settings.tradeBlackcoin.sell&&0<this._host.game.resPool.get("blackcoin").value){this._host.game.diplomacy.sellBcoin();const n=p(this._host.game.resPool.get("relic")).value;a=Math.round(n-t),this._host.engine.iactivity("act.blackcoin.sell",[this._host.renderAbsolute(a)])}}trade(e,t){const i=this.getRace(e);this._host.game.diplomacy.tradeMultiple(i,t),this._host.engine.storeForSummary(i.title,t,"trade"),this._host.engine.iactivity("act.trade",[this._host.renderAbsolute(t),W(i.title)],"ks-trade")}getProfitability(e){const t=this.getRace(e);let i=0;const s=this.getMaterials(e);for(const[r,c]of P(s)){const o=this._workshopManager.getTickVal(this._workshopManager.getResource(r));if(o!=="ignore"){if(o<=0)return!1;i+=c/o}}let a=0;const n=this.getAverageTrade(t);for(const[r,c]of P(n)){const o=this._workshopManager.getResource(r),h=this._workshopManager.getTickVal(o);if(h!=="ignore"){if(h<=0)return!0;a+=0<o.maxValue?Math.min(c,Math.max(o.maxValue-o.value,0))/h:c/h}}return i<=a}getAverageTrade(e){const t=this._host.game.getEffect("standingRatio")+this._host.game.diplomacy.calculateStandingFromPolicies(e.name,this._host.game),i=1+e.energy*.02,s=1+this._host.game.diplomacy.getTradeRatio()+this._host.game.diplomacy.calculateTradeBonusFromPolicies(e.name,this._host.game),a=e.standing<0?e.standing+t:0,n=0<a?1+a:1,r=0<e.standing?Math.min(e.standing+t/2,1):0,c={};for(const u of e.sells){if(!this._isValidTrade(u,e)){c[u.name]=0;continue}let d=0;const m=e.embassyPrices?u.chance*(1+this._host.game.getLimitedDR(.01*e.embassyLevel,.75)):u.chance;if(e.name==="zebras"&&u.name==="titanium"){const v=this._host.game.resPool.get("ship").value,b=Math.min(.15+v*.0035,1);d=1.5*(1+v/50)*(n*b)}else{const v=u.seasons?1+u.seasons[this._host.game.calendar.getCurSeason().name]:1,b=(n-r)*Math.min(m/100,1),S=r*Math.min(m/100,1);d=(b+1.25*S)*u.value*i*v*s}c[u.name]=d}const o=e.embassyPrices?.35*(1+.01*e.embassyLevel):.35,h=n*Math.min(o,1);return c.spice=25*h+50*h*s/2,c.blueprint=.1*n,c}_isValidTrade(e,t){return!(e.minLevel&&t.embassyLevel<e.minLevel)&&(this._host.game.resPool.get(e.name).unlocked||e.name==="titanium"||e.name==="uranium"||t.name==="leviathans")}getLowestTradeAmount(e,t,i){let s;const a=this.getMaterials(e);let n;for(const[h,u]of P(a)){if(h==="manpower"){let d=u;this._host.game.challenges.isActive("postApocalypse")&&(d=u*(1+this._host.game.bld.getPollutionLevel())),n=this._workshopManager.getValueAvailable(h)/d}else if(h==="gold"){let d=u;this._host.game.challenges.isActive("postApocalypse")&&(d=u*(1+this._host.game.bld.getPollutionLevel())),n=this._workshopManager.getValueAvailable(h)/d}else n=this._workshopManager.getValueAvailable(h)/u;s=s===void 0||n<s?n:s}if(s=Math.floor(s??0),s===0)return 0;if(e===null||e==="leviathans")return s;const r=this.getRace(e);let c=0;const o=this.getAverageTrade(r);for(const h of r.sells){const u=this._workshopManager.getResource(h.name);let d=0;if(!u.maxValue)continue;d=p(o[h.name]);const m=Math.max((u.maxValue-u.value)/d,0);c=m<c?c:m}return c=Math.ceil(c),c===0?0:(s=c<s?Math.max(c-1,1):s,Math.floor(s))}getMaterials(e=null){const t={gold:15-this._host.game.getEffect("tradeGoldDiscount"),manpower:50-this._host.game.getEffect("tradeCatpowerDiscount")};if(g(e))return t;const i=this.getRace(e).buys;for(const s of i)t[s.name]=s.val;return t}getRace(e){const t=this._host.game.diplomacy.get(e);if(g(t))throw new Error(`Unable to retrieve race \'${e}\'`);return t}singleTradePossible(e,t,i,s){const a=s?ee.evaluateSubSectionTrigger(e,s.trigger):e;if(a<0&&s===void 0)return!0;if(a<0&&s!==void 0||t.value/t.maxValue<a||i.value/i.maxValue<a)return!1;const n=this.getMaterials(s?.race);for(const[r,c]of P(n))if(this._workshopManager.getValueAvailable(r)<c)return!1;return!0}}class un{_host;_cache=new Array;_cacheSum={};constructor(e){this._host=e}pushToCache(e){this._cache.push(e);for(const[t,i]of P(e.materials))this._cacheSum[t]||(this._cacheSum[t]=0),this._cacheSum[t]+=i;for(let t=0;t<this._cache.length;++t){const i=this._cache[t];if(this._cache.length>1e4){const s=i.materials;for(const[a,n]of P(s))this._cacheSum[a]||(this._cacheSum[a]=0),this._cacheSum[a]-=n;this._cache.shift(),t--}else return}}getResValue(e){if(this._cache.length===0||!this._cacheSum[e])return 0;const t=this._host.game.timer.ticksTotal,i=this._cache[0].timeStamp;return this._cacheSum[e]/(t-i)}}class dn{_host;settings;_cacheManager;_workshopManager;constructor(e,t,i=new Oi){this._host=e,this.settings=i,this._cacheManager=new un(this._host),this._workshopManager=t}tick(e){this.settings.enabled&&(this.autoDistributeKittens(e),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(e){const t=this._host.game.village.getFreeKittens();if(t){for(let i=0;i<t;++i){const s=new Array;for(const r of this._host.game.village.jobs){const c=this.settings.jobs[r.name].enabled,o=r.unlocked;if(!c||!o)continue;const h=this._host.game.village.getJobLimit(r.name),u=G(this.settings.jobs[r.name].max),d=r.value;d<h&&d<u&&s.push({count:d,job:r,toCap:h-d})}if(!s.length)return;const a=!g(s.find(r=>r.job.name==="farmer"&&r.count===0));s.sort((r,c)=>r.count-c.count);const n=a?"farmer":s[0].job.name;this._host.game.village.assignJob(this._host.game.village.getJob(n),1),e.requestGameUiRefresh=!0,this._host.engine.iactivity("act.distribute",[this._host.engine.i18n(`$village.job.${n}`)],"ks-distribute")}this._host.engine.storeForSummary("distribute",t)}}autoElect(){if(this._host.game.challenges.isActive("anarchy"))return;const e=this._host.game.village.sim.kittens,t=this._host.game.village.leader,i=this.settings.electLeader.job.selected,s=this.settings.electLeader.trait.selected,a=e.filter(r=>(r.job===i||i==="any")&&r.trait.name===s);if(a.length===0)return;a.sort((r,c)=>c.rank-r.rank);const n=a[0];!g(t)&&t.trait.name===s&&(t.job===i||i==="any")&&n.rank<=t.rank||(this._host.game.village.makeLeader(n),this._host.engine.iactivity("act.elect"))}autoPromoteKittens(){const e=this._workshopManager.getResource("gold");if(!(this.settings.promoteKittens.trigger<e.value/e.maxValue))for(let t=0;t<this._host.game.village.sim.kittens.length;t++){let i=-1;const s=this._host.game.village.sim.kittens[t].engineerSpeciality;if(!g(s)&&(i=p(this._host.game.workshop.getCraft(s)).tier,!(i<=this._host.game.village.sim.kittens[t].rank))){this._host.game.village.promoteKittens();return}}}autoPromoteLeader(){if(this._host.game.science.get("civil").researched&&this._host.game.village.leader!==null){const e=this._host.game.village.leader,t=e.rank,i=this._workshopManager.getResource("gold"),s=this._workshopManager.getStock("gold");this._host.game.village.sim.goldToPromote(t,t+1,i.value-s)[0]&&this._host.game.village.sim.promote(e,t+1)===1&&(this._host.engine.iactivity("act.promote",[t+1],"ks-promote"),this._host.game.villageTab.censusPanel?.census.renderGovernment(this._host.game.villageTab.censusPanel.census.container),this._host.game.villageTab.censusPanel?.census.update(),this._host.engine.storeForSummary("promote",1))}}autoHunt(e){const t=this._workshopManager.getResource("manpower"),i=this.settings.hunt.trigger;if(t.value<100||i>t.value/t.maxValue||this._host.game.challenges.isActive("pacifism"))return;const s=Math.floor(t.value/100);this._host.engine.storeForSummary("hunt",s);const a=this._workshopManager.getAverageHunt(),n={};for(const[r,c]of P(a)){const o=this._workshopManager.getResource(r);n[r]=0<o.maxValue?Math.min(c*s,Math.max(o.maxValue-o.value,0)):c*s}g(e)||e.pushToCache({materials:n,timeStamp:this._host.game.timer.ticksTotal}),this._host.game.village.huntAll(),this._host.engine.iactivity("act.hunt",[this._host.renderAbsolute(s)],"ks-hunt")}autoFestival(e){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 t=this._workshopManager;if(t.getValueAvailable("manpower")<1500||t.getValueAvailable("culture")<5e3||t.getValueAvailable("parchment")<2500)return;const i=4e3*t.getTickVal(t.getResource("manpower"),e,!0)>1500,s=4e3*t.getTickVal(t.getResource("culture"),e,!0)>5e3,a=4e3*t.getTickVal(t.getResource("parchment"),e,!0)>2500;if(!i&&!s&&!a)return;const n=this._host.game.calendar.festivalDays,r=new classes.village.ui.FestivalButtonController(this._host.game),c=r.fetchModel({controller:r,description:"",handler:()=>{this._host.game.village.holdFestival(1)},name:"",prices:[{name:"manpower",val:1500},{name:"culture",val:5e3},{name:"parchment",val:2500}]});r.buyItem(c),this._host.engine.storeForSummary("festival"),n>0?this._host.engine.iactivity("festival.extend",[],"ks-festival"):this._host.engine.iactivity("festival.hold",[],"ks-festival")}}const Ui={"de-DE":Ts,"en-US":xs,"he-IL":Es,"zh-CN":Ms};class ee{_i18nData;_isLoaded=!1;get isLoaded(){return this._isLoaded}_host;settings;bonfireManager;religionManager;scienceManager;spaceManager;timeControlManager;timeManager;tradeManager;villageManager;workshopManager;_activitySummary;_bulkManager;_timeoutMainLoop=void 0;constructor(e,t){this.settings=new Ri,this._i18nData=Ui,this.setLanguage(t,!1),this._host=e,this._activitySummary=new Ss(this._host),this.workshopManager=new Mi(this._host),this._bulkManager=new xe(this._host,this.workshopManager),this.bonfireManager=new Cs(this._host,this.workshopManager),this.religionManager=new Rs(this._host,this.bonfireManager,this.workshopManager),this.scienceManager=new Ls(this._host,this.workshopManager),this.spaceManager=new Ds(this._host,this.workshopManager),this.timeControlManager=new ln(this._host,this.bonfireManager,this.religionManager,this.workshopManager),this.timeManager=new cn(this._host,this.workshopManager),this.tradeManager=new hn(this._host,this.workshopManager),this.villageManager=new dn(this._host,this.workshopManager)}isLanguageSupported(e){return Object.keys(this._i18nData).some(t=>t.startsWith(`${e}-`))}isLocaleSupported(e){return e in this._i18nData}localeSupportsFirstLetterSplits(e=this.settings.locale.selected){return e!=="zh-CN"}localeForLanguage(e){return Object.keys(this._i18nData).find(t=>t.startsWith(`${e}-`))}setLanguage(e,t=!0){const i=this.settings.locale.selected;if(!this.isLanguageSupported(e))console.warn(...f(`Requested language \'${e}\' is not available. Falling back to \'${we}\'.`)),this.settings.locale.selected=we;else{const s=p(this.localeForLanguage(e));console.info(...f(`Selecting language \'${s}\'.`)),this.settings.locale.selected=s}i!==this.settings.locale.selected&&t&&this._host.rebuildUi()}setLocale(e,t=!0){const i=this.settings.locale.selected;this.isLocaleSupported(e)?(console.info(...f(`Selecting language \'${e}\'.`)),this.settings.locale.selected=e):(console.warn(...f(`Requested language \'${e}\' is not available. Falling back to \'${we}\'.`)),this.settings.locale.selected=we),i!==this.settings.locale.selected&&t&&this._host.rebuildUi()}stateLoad(e,t=!1){this._isLoaded=!0,this.stop(!1);const i=Pe();e.v!==i&&console.warn(...f(`Attempting to load engine state with version tag \'${e.v}\' when engine is at version \'${i}\'!`));const s=(a,n)=>{try{a()}catch(r){console.error(...f(`Failed load of ${n} settings.`,r))}};s(()=>{this.settings.load(e.engine,t)},"engine"),s(()=>{this.bonfireManager.settings.load(e.bonfire)},"bonfire"),s(()=>{this.religionManager.settings.load(e.religion)},"religion"),s(()=>{this.scienceManager.settings.load(e.science)},"science"),s(()=>{this.spaceManager.settings.load(e.space)},"space"),s(()=>{this.timeControlManager.settings.load(e.timeControl)},"time control"),s(()=>{this.timeManager.settings.load(e.time)},"time"),s(()=>{this.tradeManager.settings.load(e.trade)},"trade"),s(()=>{this.villageManager.settings.load(e.village)},"village"),s(()=>{this.workshopManager.settings.load(e.workshop)},"workshop"),this.setLocale(this.settings.locale.selected),this.settings.enabled?this.start(!1):this.stop(!1)}static get DEFAULT_STATE(){return{bonfire:new _t,engine:new Ri,religion:new Ct,science:new St,space:new He,time:new $i,timeControl:new Bi,trade:new Li,v:Pe(),village:new Oi,workshop:new Fe}}stateReset(){this.stateLoad(ee.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:Pe(),village:this.villageManager.settings,workshop:this.workshopManager.settings}}start(e=!0){if(this._timeoutMainLoop)return;const t=()=>{const i={entry:Date.now(),exit:0,measurements:{},priceCacheHits:0,priceCacheMisses:0,purchaseOrders:[],requestGameUiRefresh:!1};this._iterate(i).then(()=>{i.exit=Date.now();const s=i.exit-i.entry;document.dispatchEvent(new CustomEvent("ks.reportFrame",{detail:i})),this._timeoutMainLoop!==void 0&&(this._timeoutMainLoop=C.window.setTimeout(t,Math.max(10,this._host.engine.settings.interval-s)))}).catch(s=>{console.warn(...f(ls(s)))})};this._timeoutMainLoop=C.window.setTimeout(t,this._host.engine.settings.interval),e&&this._host.engine.imessage("status.ks.enable")}stop(e=!0){this._timeoutMainLoop&&(clearTimeout(this._timeoutMainLoop),this._timeoutMainLoop=void 0,e&&this._host.engine.imessage("status.ks.disable"))}async _iterate(e){this.settings.filters.enabled&&this._maintainKGLogFilters();let[,t]=await Oe(()=>this.scienceManager.tick(e));e.measurements.scienceManager=t,[,t]=X(()=>{this.bonfireManager.tick(e)}),e.measurements.bonfireManager=t,[,t]=X(()=>{this.spaceManager.tick(e)}),e.measurements.spaceManager=t,[,t]=await Oe(()=>this.workshopManager.tick(e)),e.measurements.workshopManager=t,[,t]=X(()=>{this.tradeManager.tick(e)}),e.measurements.tradeManager=t,[,t]=await Oe(()=>this.religionManager.tick(e)),e.measurements.religionManager=t,[,t]=X(()=>{this.timeManager.tick(e)}),e.measurements.timeManager=t,[,t]=X(()=>{this.villageManager.tick(e)}),e.measurements.villageManager=t,[,t]=await Oe(()=>this.timeControlManager.tick(e)),e.measurements.timeControlManager=t,[,t]=X(()=>{if(0<e.purchaseOrders.length){const[{builds:i,metaData:s},a]=X(()=>{const o={...e.purchaseOrders[0].builds};let h={...e.purchaseOrders[0].metaData};for(const u of e.purchaseOrders){for(const[d,m]of P(u.builds))o[d]={...m,baseBuilding:m.baseBuilding,builder:u.builder,building:m.building,sectionTrigger:u.sectionTrigger,stage:m.stage,variant:m.variant};h={...h,...u.metaData}}return this._bulkManager.resetPriceCache(),{builds:o,metaData:h}}),[n,r]=X(()=>this._bulkManager.bulk(i,s)),[,c]=X(()=>{for(const o of n.filter(h=>0<h.count))o.builder(o),e.requestGameUiRefresh=!0});e.priceCacheHits=this._bulkManager.cacheHits,e.priceCacheMisses=this._bulkManager.cacheMisses,e.measurements.bulkPurchaseInit=a,e.measurements.bulkPurchaseCalc=r,e.measurements.bulkPurchaseExec=c}}),e.measurements.bulkPurchaseTotal=t,[,t]=X(()=>{e.requestGameUiRefresh&&!document.hidden&&this._host.game.ui.render()}),e.measurements.gameUiRefresh=t}_maintainKGLogFilters(){for(const[e,t]of P(this.settings.filters.filtersGame))if(this._host.game.console.filters[e].enabled!==t.enabled){this._host.game.console.filters[e].unlocked=!0,this._host.game.console.filters[e].enabled=t.enabled;const i=C.window.document.querySelector(`#filter-${e}`);if(i===null)continue;i.checked=t.enabled}}symbolForCycle(e){return this._host.game.calendar.cycles.find(t=>t.name===e)?.uglyph??""}labelForCycle(e){const t=this.symbolForCycle(e),i=this._host.engine.i18n(`$space.planet.${e==="redmoon"?"moon":e}.label`);return`${t} ${i}`}labelForPlanet(e){const t=e==="moon"?"redmoon":e,i=de.includes(t)?t:void 0,s=this._host.engine.i18n(`$space.planet.${e}.label`);return i===void 0?s:`${this.symbolForCycle(i)} ${s}`}i18n(e,t=[]){let i;if(e.startsWith("$")&&(i=this._host.i18nEngine(e.slice(1))),i=i??this._i18nData[this.settings.locale.selected][e],g(i)){if(i=Ui[we][e],!i)return console.warn(...f(`i18n key \'${e}\' not found in default language.`)),`$${e}`;console.warn(...f(`i18n key \'${e}\' not found in selected language.`))}for(let a=0;a<t.length;++a)i=i.replace(`{${a}}`,`${t[a]}`);return i}iactivity(e,t=[],i){const s=this.i18n(e,t);if(i){const a=`type_${i}`;this.printOutput(`ks-activity ${a}`,s)}else this.printOutput("ks-activity",s)}imessage(e,t=[]){this.printOutput("ks-default",this.i18n(e,t))}storeForSummary(e,t=1,i="other"){this._activitySummary.storeActivity(e,t,i)}getSummary(){return this._activitySummary.renderSummary()}displayActivitySummary(){const e=this.getSummary();for(const t of e)this.printOutput("ks-summary",t);this.resetActivitySummary()}resetActivitySummary(){this._activitySummary.resetActivity()}printOutput(e,t){if(this.settings.filters.enabled){for(const i of Object.values(this.settings.filters.filters))if(i.variant===e&&!i.enabled)return}this._host.game.msg(t,e)}static evaluateSubSectionTrigger(e,t){return e<0?t:t<0?e:t}}const Di=l=>Number.isFinite(l)?l:0,gn=l=>({days:Math.trunc(l/864e5),hours:Math.trunc(l/36e5%24),microseconds:Math.trunc(Di(l*1e3)%1e3),milliseconds:Math.trunc(l%1e3),minutes:Math.trunc(l/6e4%60),nanoseconds:Math.trunc(Di(l*1e6)%1e3),seconds:Math.trunc(l/1e3%60)}),mn=l=>({days:l/86400000n,hours:l/3600000n%24n,microseconds:0n,milliseconds:l%1000n,minutes:l/60000n%60n,nanoseconds:0n,seconds:l/1000n%60n}),fn=l=>{switch(typeof l){case"number":{if(Number.isFinite(l))return gn(l);break}case"bigint":return mn(l)}throw new TypeError("Expected a finite number or bigint")},pn=l=>l===0||l===0n,bn=(l,e)=>e===1||e===1n?l:`${l}s`,vn=1e-7,yn=24n*60n*60n*1000n,wn=(l,e={colonNotation:!1,compact:!1,formatSubMilliseconds:!1,keepDecimalsOnWholeSeconds:!1,millisecondsDecimalDigits:0,secondsDecimalDigits:1,separateMilliseconds:!1,unitCount:1/0,verbose:!1})=>{const t=typeof l=="bigint";if(!t&&!Number.isFinite(l))throw new TypeError("Expected a finite number or bigint");const i={...e};i.colonNotation&&(i.compact=!1,i.formatSubMilliseconds=!1,i.separateMilliseconds=!1,i.verbose=!1),i.compact&&(i.unitCount=1,i.secondsDecimalDigits=0,i.millisecondsDecimalDigits=0);let s=[];const a=(h,u)=>{const d=Math.floor(h*10**u+vn);return(Math.round(d)/10**u).toFixed(u)},n=(h,u,d,m)=>{if(!((s.length===0||!i.colonNotation)&&pn(h)&&!(i.colonNotation&&d==="m"))){if(m??=String(h),i.colonNotation){const v=m.includes(".")?m.split(".")[0].length:m.length,b=s.length>0?2:1;m="0".repeat(Math.max(0,b-v))+m}else m+=i.verbose?" "+bn(u,h):d;s.push(m)}},r=fn(l),c=BigInt(r.days);if(n(c/365n,"year","y"),n(c%365n,"day","d"),n(Number(r.hours),"hour","h"),n(Number(r.minutes),"minute","m"),i.separateMilliseconds||i.formatSubMilliseconds||!i.colonNotation&&l<1e3){const h=Number(r.seconds),u=Number(r.milliseconds),d=Number(r.microseconds),m=Number(r.nanoseconds);if(n(h,"second","s"),i.formatSubMilliseconds)n(u,"millisecond","ms"),n(d,"microsecond","µs"),n(m,"nanosecond","ns");else{const v=u+d/1e3+m/1e6,b=typeof i.millisecondsDecimalDigits=="number"?i.millisecondsDecimalDigits:0,S=v>=1?Math.round(v):Math.ceil(v),R=b?v.toFixed(b):S.toString();n(Number.parseFloat(R),"millisecond","ms",R)}}else{const h=(t?Number(l%yn):l)/1e3%60,u=typeof i.secondsDecimalDigits=="number"?i.secondsDecimalDigits:1,d=a(h,u),m=i.keepDecimalsOnWholeSeconds?d:d.replace(/\\.0+$/,"");n(Number.parseFloat(m),"second","s",m)}if(s.length===0)return"0"+(i.verbose?" milliseconds":"ms");const o=i.colonNotation?":":" ";return typeof i.unitCount=="number"&&(s=s.slice(0,Math.max(i.unitCount,1))),s.join(o)},M={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"};class D{static nextComponentId=0;componentId;host;parent;options;_element;set element(e){this._element=e,this._element[0].id=`KS${Object.getPrototypeOf(this).constructor.name}#${this.componentId}`}get element(){return p(this._element)}children=new Set;constructor(e,t){this.componentId=D.nextComponentId++,this.host=e.host,this.options=t,this.parent=e instanceof D?e:null,this._needsRefresh=!1}_needsRefresh;requestRefresh(e=!1,t=0,i=!1){if(i&&console.debug(...f(t<0?"⤒".repeat(t*-1):" ".repeat(t),this.toString(),"requestRefresh()")),this.options?.onRefreshRequest?.call(this),this.parent!==this&&!e&&this.parent?.requestRefresh(!1,t-1,i),this._needsRefresh&&i&&console.debug(...f(t<0?"⤒".repeat(t*-1):" ".repeat(t),this.toString(),"requestRefresh() <already pending>")),this._needsRefresh=!0,e){i&&console.debug(...f(t<0?"⤒".repeat(t*-1):" ".repeat(t),this.toString(),"requestRefresh()",`+ ${this.children.size} children`));for(const s of this.children)s.requestRefresh(!0,t+1,i)}else i&&console.debug(...f(t<0?"⤒".repeat(t*-1):" ".repeat(t),this.toString(),"requestRefresh()","<queued>"))}refresh(e=!1,t=0){if(!e&&!this._needsRefresh){t===0&&console.debug(...f(this.toString(),"refresh() received and ignored."));return}this.options?.onRefresh?.call(this);for(const i of this.children)i.refresh(e,t+1);this._needsRefresh=!1}addChild(e){return e.parent=this,this.children.add(e),this.element.append(e.element),this}addChildren(e){for(const t of e??[])this.addChild(t);return this}removeChild(e){this.children.has(e)&&(e.element.remove(),this.children.delete(e))}removeChildren(e){for(const t of e)this.removeChild(t)}}class T extends D{constructor(e,t){super(e,{...t}),this.element=$("<div/>");for(const i of t?.classes??[])this.element.addClass(i)}toString(){return`[${T.name}#${this.componentId}]`}}const E={label:"_label_1nlev_1",splitter:"_splitter_1nlev_16",iconLabel:"_iconLabel_1nlev_20",fillSpace:"_fillSpace_1nlev_26"},ge={delimiter:"_delimiter_16hnh_1"};class se extends D{constructor(e,t){super(e,{...t}),this.element=$("<li/>");for(const i of t?.classes??[])this.element.addClass(i);t?.delimiter===!0&&this.element.addClass(ge.delimiter)}toString(){return`[${se.name}#${this.componentId}]`}}const Ge={head:"_head_wr1pj_1"};class ne extends se{head;elementLabel;constructor(e,t,i){if(super(e,i),this.head=new T(e),this.head.element.addClass(Ge.head),this.addChild(this.head),this.elementLabel=$("<label/>",{text:`${i?.upgradeIndicator===!0?"⮤ ":""}${t}`}).addClass(E.label).addClass(Ge.label),this.head.element.append(this.elementLabel),i?.icon){const s=$("<div/>",{html:`<svg style="width: 15px; height: 15px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${i.icon}"/></svg>`}).addClass(E.iconLabel);this.elementLabel.prepend(s)}}toString(){return`[${ne.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 B={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 k extends ne{setting;checkbox;readOnly;constructor(e,t,i,s){super(e,i,{...s,onRefresh:()=>{this.setting.enabled?this.element.addClass(B.checked):this.element.removeClass(B.checked),this.readOnly?this.element.addClass(B.readonly):this.element.removeClass(B.readonly),g(this.checkbox)||(this.checkbox.prop("checked",this.setting.enabled),this.checkbox.prop("disabled",this.readOnly)),s?.onRefresh?.()}}),this.element.addClass(B.setting);const a=`ks-setting${this.componentId}`,n=$("<input/>",{id:a,type:"checkbox"}).addClass(B.checkbox);this.readOnly=s?.readOnly??!1,n.prop("disabled",this.readOnly),n.on("change",r=>{n.is(":checked")&&!t.enabled?this.check().catch(H(console)):!n.is(":checked")&&t.enabled&&this.uncheck().catch(H(console))}),this.elementLabel.before(n),this.elementLabel.prop("for",a),this.checkbox=n,this.setting=t}toString(){return`[${k.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}async check(e=!1){this.setting.enabled=!0,await this.options?.onCheck?.call(e),this.requestRefresh()}async uncheck(e=!1){this.setting.enabled=!1,await this.options.onUnCheck?.call(e),this.requestRefresh()}}const w={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 V extends D{readOnly;inactive;constructor(e,t,i,s){super(e,{...s,onRefresh:()=>{this.readOnly?this.element.addClass(w.readonly):this.element.removeClass(w.readonly),this.inactive?this.element.addClass(w.inactive):this.element.removeClass(w.inactive),s?.onRefresh?.()}}),this.element=$("<div/>",{html:`<svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${t}"/></svg>`,title:i}).addClass(w.iconButton),this.readOnly=s?.readOnly??!1,this.inactive=s?.inactive??!1,this.element.on("click",()=>{this.readOnly||this.click().catch(H(console))})}toString(){return`[${V.name}#${this.componentId}]`}async click(){this.readOnly||(await this.options?.onClick?.call(this),this.requestRefresh())}}const Ze={listContainer:"_listContainer_1kxbq_1",itemsList:"_itemsList_1kxbq_5",list:"_list_1kxbq_1",listTools:"_listTools_1kxbq_9"};class _ extends D{list;disableAllButton;enableAllButton;resetButton;constructor(e,t){super(e,{...t});const i={hasDisableAll:!0,hasEnableAll:!0,...t},s=i.hasDisableAll||i.hasEnableAll||!g(i.onReset);if(this.element=$("<div/>").addClass(Ze.listContainer),this.list=$("<ul/>").addClass(Ze.list).addClass(Ze.itemsList),this.element.append(this.list),s){const a=new T(this,{classes:[Ze.listTools]});i.hasEnableAll&&(this.enableAllButton=new V(e,M.CheckboxCheck,e.host.engine.i18n("ui.enable.all"),{onClick:async()=>{const r=new Event("enableAll",{cancelable:!0});if(this.element[0].dispatchEvent(r),!r.defaultPrevented){for(const c of this.children)Be(c,k)&&await c.check(!0);t?.onEnableAll?.call(this)}}}),a.addChild(this.enableAllButton)),i.hasDisableAll&&(this.disableAllButton=new V(e,M.CheckboxUnCheck,e.host.engine.i18n("ui.disable.all"),{onClick:async()=>{const r=new Event("disableAll",{cancelable:!0});if(this.element[0].dispatchEvent(r),!r.defaultPrevented){for(const c of this.children)Be(c,k)&&await c.uncheck(!0);t?.onDisableAll?.call(this)}}}),a.addChild(this.disableAllButton));const n=i.onReset;g(n)||(this.resetButton=new V(e,M.Reset,e.host.engine.i18n("ui.reset"),{onClick:()=>{n()}}),a.addChild(this.resetButton)),super.addChild(a)}}toString(){return`[${_.name}#${this.componentId}]`}addChild(e){return e.parent=this,this.children.add(e),this.list.append(e.element),this}}const Te={expandoButton:"_expandoButton_l1ukp_1",expanded:"_expanded_l1ukp_1",up:"_up_l1ukp_1",down:"_down_l1ukp_4"};class Ke extends D{readOnly;inactive;ineffective;constructor(e,t){super(e,{...t,onRefresh:()=>{this.ineffective?this.element.addClass(w.ineffective):this.element.removeClass(w.ineffective),t?.onRefresh?.()}}),this.element=$("<div/>",{html:`\n <svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor" class="${Te.down}"><path d="${M.ExpandCircleDown}"/></svg>\n <svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor" class="${Te.up}"><path d="${M.ExpandCircleUp}"/></svg>\n `,title:e.host.engine.i18n("ui.itemsShow")}).addClass(w.iconButton).addClass(Te.expandoButton),this.element.on("click",()=>{this.readOnly||this.click().catch(H(console))}),this.readOnly=t?.readOnly??!1,this.inactive=t?.inactive??!1,this.ineffective=!1}toString(){return`[${Ke.name}#${this.componentId}]`}setCollapsed(){this.element.removeClass(Te.expanded),this.element.prop("title",this.host.engine.i18n("ui.itemsShow"))}setExpanded(){this.element.addClass(Te.expanded),this.element.prop("title",this.host.engine.i18n("ui.itemsHide"))}async click(){this.readOnly||(await this.options?.onClick?.call(this),this.requestRefresh())}}class me extends D{container;expando;head;_mainChildVisible;get isExpanded(){return this._mainChildVisible}constructor(e,t,i){super(e,i),this.head=t,this.container=new T(this),this.container.element.addClass(B.panelContent);const s=new Ke(e,{onClick:()=>this.toggle()});t.head.addChild(s),t.element.append(this.container.element),i?.initiallyExpanded?(this.container.element.removeClass(B.hidden),s.setExpanded()):this.container.element.addClass(B.hidden),this._mainChildVisible=i?.initiallyExpanded??!1,this.element=t.element,this.expando=s,this.addChildren([this.head,this.container])}toString(){return`[${me.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(B.hidden),this.expando.setExpanded(),this.head.element.addClass(B.expanded),this.element[0].dispatchEvent(new CustomEvent("panelShown"))):(this.container.element.addClass(B.hidden),this.expando.setCollapsed(),this.head.element.removeClass(B.expanded),this.element[0].dispatchEvent(new CustomEvent("panelHidden")))),t){const s=a=>{for(const n of a)Be(n,me)?n.toggle(e,t):s(n.children)};s(this.children)}}}class I extends me{setting;settingItem;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()}constructor(e,t,i,s){super(e,i,s),this.element=i.element,this.settingItem=i,this.setting=t}toString(){return`[${I.name}#${this.componentId}]: \'${this.settingItem.elementLabel.text()}\'`}}class kn extends I{constructor(e,t,i,s){const a=e.host.engine.i18n("ui.upgrade.buildings");super(e,t,new k(e,t,a,{onCheck:c=>{e.host.engine.imessage("status.auto.enable",[a])},onUnCheck:c=>{e.host.engine.imessage("status.auto.disable",[a])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.buildings).some(c=>c.enabled)}});const n=[];for(const c of Object.values(this.setting.buildings)){const o=this.host.engine.i18n(`$buildings.${c.upgrade}.label`),h=new k(this,c,o,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o])}});n.push({button:h,label:o})}n.sort((c,o)=>c.label.localeCompare(o.label));const r=new _(this);for(const c of n)r.addChild(c.button);this.addChildContent(r)}}class F extends D{_iconElement;readOnly;inactive;ineffective;constructor(e,t,i=null,s){super(e,{...s,onRefresh:()=>{this.readOnly?this.element.addClass(w.readonly):this.element.removeClass(w.readonly),this.inactive?this.element.addClass(w.inactive):this.element.removeClass(w.inactive),this.ineffective?this.element.addClass(w.ineffective):this.element.removeClass(w.ineffective),s?.onRefresh?.()}}),this.element=$("<div/>",{title:s?.title}).addClass(w.button).text(t),s?.border!==!1&&this.element.addClass(w.bordered),s?.alignment==="right"&&this.element.addClass(w.alignRight),i!==null&&(this._iconElement=$(`<svg class="${w.buttonIcon}" style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${i}"/></svg>`),s?.alignment==="right"?this.element.append(this._iconElement):this.element.prepend(this._iconElement));for(const a of s?.classes??[])this.element.addClass(a);this.element.on("click",()=>{this.readOnly||this.click().catch(H(console))}),this.readOnly=s?.readOnly??!1,this.inactive=s?.inactive??!1,this.ineffective=!1}toString(){return`[${F.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(){this.readOnly||(await this.options?.onClick?.call(this),this.requestRefresh())}}class K extends D{constructor(e){super(e,{}),this.element=$("<div/>").addClass(ge.delimiter)}toString(){return`[${K.name}#${this.componentId}]`}}const Ni={dialog:"_dialog_b4vj0_1",close:"_close_b4vj0_7"},qi={explainer:"_explainer_1idu3_1"},_n={header:"_header_19ql8_1"};class A extends D{get elementLabel(){return this.element}constructor(e,t,i){super(e,{...i}),this.element=$("<li/>",{text:t}).addClass(_n.header)}toString(){return`[${A.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class xt extends D{constructor(e,t){super(e,{...t}),this.element=$(\'<input type="text"/>\').addClass("ks-input");for(const i of t?.classes??[])this.element.addClass(i);t?.onChange&&this.element.on("change",()=>t.onChange?.(this.element[0].value)),t?.value&&(this.element[0].value=t.value),t?.selected&&(this.element[0].selectionStart=0,this.element[0].selectionEnd=-1),this.element.on("keyup",i=>{switch(i.key){case"Enter":t?.onEnter?.(this.element[0].value);break;case"Escape":t?.onEscape?.(this.element[0].value);break}})}toString(){return`[${xt.name}#${this.componentId}]`}}class Ve extends D{constructor(e,t,i){super(e,{...i}),this.element=$("<p/>").text(t);for(const s of i?.classes??[])this.element.addClass(s)}toString(){return`[${Ve.name}#${this.componentId}]`}}const zi={toolbar:"_toolbar_1654f_1"};class x extends D{container;head;returnValue;constructor(e,t){super(e,{...t}),this.element=$("<dialog/>").addClass("dialog").addClass("help").addClass(Ni.dialog),t?.hasClose!==!1&&this.addChild(new F(e,"close",null,{classes:[Ni.close],onClick:()=>{this.close(),t?.onCancel?.()}})),this.returnValue=t?.promptValue??"",this.head=new T(e),this.container=new T(e),this.addChildren(Ie([this.head,t?.prompt?new xt(e,{onChange:i=>{this.returnValue=i},onEnter:i=>{this.returnValue=i,this.close(),t.onConfirm?.(this.returnValue)},onEscape:i=>{this.close(),t.onCancel?.()},selected:!0,value:t.promptValue}):void 0,this.container,new K(e),new T(e,{classes:[zi.toolbar]}).addChildren(Ie([new F(e,"OK",null,{classes:[w.large],onClick:()=>{this.close(),t?.onConfirm?.(this.returnValue)}}),t?.hasCancel?new F(e,"Cancel",null,{classes:[w.large],onClick:()=>{this.close(),t.onCancel?.()}}):void 0]))]))}toString(){return`[${x.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,s,a){return new Promise(n=>{new x(e,{hasCancel:!0,hasClose:!1,onCancel:()=>{n(void 0)},onConfirm:r=>{n(r)},prompt:!0,promptValue:s}).addChildrenHead(Ie([i?new A(e,i):void 0,new Ve(e,t)])).addChildrenContent(a?[new T(e,{classes:[qi.explainer]}).addChildren([new Ve(e,a)])]:[]).showModal()})}}const Cn={maxButton:"_maxButton_133h2_1"};class Ee extends F{setting;constructor(e,t,i){super(e,"",null,{...i,classes:[Cn.maxButton,...i?.classes??[]]}),this.setting=t}toString(){return`[${Ee.name}#${this.componentId}]`}}class ke extends F{behavior;setting;constructor(e,t,i,s){super(e,"",M.Trigger,{...s,onRefresh:()=>{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])),(this.options?.renderLabel??!0)&&this.updateLabel(a),this.inactive?this.element.addClass(w.inactive):this.element.removeClass(w.inactive),s?.onRefresh?.call(this)}}),this.behavior=t instanceof z?"percentage":"integer",this.setting=t}toString(){return`[${ke.name}#${this.componentId}]`}}class je extends k{maxButton;triggerButton;constructor(e,t,i,s,a){super(e,t,s,a),this.maxButton=new Ee(e,t,{alignment:"right",border:!1,classes:[w.headAction],onClick:async()=>{await a.onSetMax.call(this)},onRefresh:a?.onRefreshMax?()=>a.onRefreshMax?.call(this):void 0}),this.triggerButton=new ke(e,t,i,{border:!1,classes:[w.lastHeadAction],onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a?.onRefreshTrigger?()=>a.onRefreshTrigger?.call(this):void 0,renderLabel:a?.renderLabelTrigger??!0}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.maxButton,this.triggerButton])}toString(){return`[${je.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}const te={getBuildOption:(l,e,t,i,s,a,n)=>{const r=async()=>{const o=await x.prompt(l,l.host.engine.i18n("ui.max.prompt.absolute"),l.host.engine.i18n("ui.max.build.prompt",[s,l.host.renderAbsolute(e.max,t.selected)]),l.host.renderAbsolute(e.max),l.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=l.host.parseAbsolute(o)??e.max}},c=new je(l,e,t,s,{delimiter:n?.delimiter,onCheck:async o=>{l.host.engine.imessage("status.sub.enable",[s]),e.max===0&&!o&&await r(),await n?.onCheck?.(o)},onRefreshMax:()=>{c.maxButton.updateLabel(l.host.renderAbsolute(e.max)),c.maxButton.element[0].title=e.max<0?l.host.engine.i18n("ui.max.build.titleInfinite",[s]):e.max===0?l.host.engine.i18n("ui.max.build.titleZero",[s]):l.host.engine.i18n("ui.max.build.title",[l.host.renderAbsolute(e.max),s])},onRefreshRequest:()=>{c.maxButton.inactive=!e.enabled||e.max===-1,c.maxButton.ineffective=i.enabled&&e.enabled&&e.max===0,c.triggerButton.inactive=!e.enabled||e.trigger===-1,c.triggerButton.ineffective=i.enabled&&e.enabled&&i.trigger===-1&&e.trigger===-1},onRefreshTrigger:()=>{c.triggerButton.element[0].title=l.host.engine.i18n("ui.trigger",[e.trigger<0?i.trigger<0?l.host.engine.i18n("ui.trigger.build.blocked",[a]):`${l.host.renderPercentage(i.trigger,t.selected,!0)} (${l.host.engine.i18n("ui.trigger.build.inherited")})`:l.host.renderPercentage(e.trigger,t.selected,!0)])},onSetMax:r,onSetTrigger:async()=>{const o=await x.prompt(l,l.host.engine.i18n("ui.trigger.prompt.percentage"),l.host.engine.i18n("ui.trigger.build.prompt",[s,e.trigger!==-1?l.host.renderPercentage(e.trigger,t.selected,!0):l.host.engine.i18n("ui.trigger.build.inherited")]),e.trigger!==-1?l.host.renderPercentage(e.trigger):"",l.host.engine.i18n("ui.trigger.build.promptExplainer"));if(o!==void 0){if(o===""||o.startsWith("-")){e.trigger=-1;return}e.trigger=l.host.parsePercentage(o),await n?.onSetTrigger?.call(void 0)}},onUnCheck:o=>{l.host.engine.imessage("status.sub.disable",[s]),n?.onUnCheck?.(o)},renderLabelTrigger:n?.renderLabelTrigger,upgradeIndicator:n?.upgradeIndicator});return c}};class U extends k{triggerButton;constructor(e,t,i,s,a){super(e,t,s,a),this.triggerButton=new ke(e,t,i,{alignment:"right",border:!1,onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a?.onRefreshTrigger?()=>a.onRefreshTrigger?.call(this):void 0,renderLabel:a?.renderLabelTrigger??!0}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.triggerButton])}toString(){return`[${U.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class Tt extends I{constructor(e,t,i){console.debug(...f(`Constructing ${Tt.name}`));const s=e.host.engine.i18n("ui.build");super(e,t,new U(e,t,i,s,{onCheck:a=>{e.host.engine.imessage("status.auto.enable",[s])},onRefreshTrigger:()=>{this.settingItem.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 a=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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(a!==void 0){if(a===""||a.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(a)}},onUnCheck:a=>{e.host.engine.imessage("status.auto.disable",[s])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger<0,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger<0&&Object.values(t.buildings).some(a=>a.enabled&&0<a.max&&a.trigger<0),this.expando.ineffective=t.enabled&&Object.values(t.buildings).some(a=>a.enabled&&(a.max===0||a.trigger<0&&t.trigger<0))}}),this.addChildrenContent([new _(this,{onReset:()=>{this.setting.load({buildings:new _t().buildings})}}).addChildren(Ie(this.host.game.bld.buildingGroups.flatMap(a=>[new A(this,a.title),...a.buildings.flatMap(n=>this._getBuildOptions(this,t,i,s,n)),a!==this.host.game.bld.buildingGroups[this.host.game.bld.buildingGroups.length-1]?new K(this):void 0]))),new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new A(this,this.host.engine.i18n("ui.additional")),new k(this,t.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 k(this,t.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 k(this,t.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 k(this,t.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 kn(this,t.upgradeBuildings,i,t)])])}_getBuildOptions(e,t,i,s,a){if(a==="unicornPasture"||g(t.buildings[a]))return[];const n=e.host.game.bld.getBuildingExt(a).meta;if(!g(n.stages)){const r=Object.values(t.buildings).find(c=>c.baseBuilding===a)?.building;return[te.getBuildOption(e,t.buildings[a],i,t,n.stages[0].label,s,{renderLabelTrigger:!1}),te.getBuildOption(e,t.buildings[r],i,t,n.stages[1].label,s,{renderLabelTrigger:!1,upgradeIndicator:!0})]}return g(n.label)?[]:[te.getBuildOption(e,t.buildings[a],i,t,n.label,s,{renderLabelTrigger:!1})]}}class Sn extends k{expando;constructor(e,t){const i=W(e.host.engine.i18n("ui.engine"));super(e,t,i,{onCheck:()=>{e.host.engine.start(!0)},onUnCheck:()=>{e.host.engine.stop(!0)}}),this.expando=new Ke(this),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.expando])}}class Et extends se{button;constructor(e,t,i){super(e,{...i}),this.button=t,this.element.addClass(Ge.head),this.element.append(t.element)}}const xn={fieldset:"_fieldset_tfwil_1"};class Mt extends D{constructor(e,t,i){super(e,{...i}),this.element=$("<fieldset/>").addClass(xn.fieldset),i?.delimiter&&this.element.addClass(ge.delimiter);const s=$("<legend/>").text(t).addClass(E.label);this.element.append(s)}toString(){return`[${Mt.name}#${this.componentId}]`}}class Rt extends D{setting;option;elementLabel;input;readOnly;constructor(e,t,i,s,a){super(e,{...a,onRefresh:()=>{this.input.prop("disabled",this.readOnly)}}),this.element=$("<div/>"),this.element.addClass(B.setting),a?.delimiter===!0&&this.element.addClass(ge.delimiter),this.elementLabel=$("<label/>",{text:`${a?.upgradeIndicator?"⮤ ":""}${i.label}`}).addClass(E.label);const n=$("<input/>",{name:s,type:"radio"}).addClass("ks-radio");this.readOnly=a?.readOnly??!1,n.on("change",()=>{this.setting.selected=i.value,g(a?.onCheck)||a.onCheck()}),this.elementLabel.prepend(n),this.element.append(this.elementLabel),this.input=n,this.setting=t,this.option=i}toString(){return`[${Rt.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class Me extends D{fieldset;setting;_items;constructor(e,t,i,s){super(e,{...s,onRefresh:()=>{for(const a of this._items)if(a.option.value===this.setting.selected){a.input.prop("checked",!0);break}s?.onRefresh?.()}}),this.element=$("<li/>"),this.fieldset=new Mt(e,t),this.addChild(this.fieldset),this._items=new Array;for(const a of i.options)this._items.push(new Rt(e,i,a,t,{onCheck:s?.onCheck,readOnly:s?.readOnly}));this.fieldset.addChildren(this._items),this.setting=i}toString(){return`[${Me.name}#${this.componentId}]`}}const Tn={textButton:"_textButton_1mv97_1"};class fe extends D{readOnly;constructor(e,t,i){super(e,{...i,onRefresh:()=>{this.readOnly?this.element.addClass(w.readonly):this.element.removeClass(w.readonly),i?.onRefresh?.call(this)}}),this.element=$("<div/>").addClass(Tn.textButton),t!==void 0&&this.element.text(t);const s=i?.title;g(s)||this.element.prop("title",s),this.readOnly=!1,this.element.on("click",()=>{this.readOnly||this.click().catch(H(console))})}toString(){return`[${fe.name}#${this.componentId}]`}async click(){this.readOnly||(await this.options?.onClick?.call(this),this.requestRefresh())}}class At extends I{constructor(e,t,i){console.debug(...f(`Constructing ${At.name}`)),super(e,t,new ne(e,e.host.engine.i18n("ui.internals"),{classes:[B.checked,B.setting],icon:M.Settings}).addChildrenHead([new T(e,{classes:[E.fillSpace]})])),this.addChildrenContent([new _(e,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new Et(e,new fe(e,e.host.engine.i18n("ui.internals.interval",[t.interval]),{onClick:async()=>{const s=await x.prompt(e,e.host.engine.i18n("ui.internals.interval.prompt"),e.host.engine.i18n("ui.internals.interval.promptTitle",[e.host.renderAbsolute(t.interval,i.selected)]),e.host.renderAbsolute(t.interval),e.host.engine.i18n("ui.internals.interval.promptExplainer"));s===void 0||s===""||s.startsWith("-")||(s==="0"&&(t.enabled=!1),t.interval=e.host.parseAbsolute(s)??t.interval)},onRefresh(){this.element.text(e.host.engine.i18n("ui.internals.interval",[t.interval]))}})),new K(e),new k(e,t.ksColumn,e.host.engine.i18n("ui.ksColumn"),{onCheck:()=>{e.host.rebuildUi()},onUnCheck:()=>{e.host.rebuildUi()}}),new k(e,t.highlighStock,e.host.engine.i18n("ui.highlightStock")),new K(e),new Me(e,e.host.engine.i18n("ui.language"),t.locale,{onCheck:()=>{e.host.rebuildUi()}}),new K(e),new ne(e,`Kitten Scientists ${Pe("v")}`)])])}}class Pt extends D{constructor(e,t,i){super(e,{...i}),this.element=$("<li/>",{text:e.host.engine.i18n(t)}).addClass(qi.explainer)}toString(){return`[${Pt.name}#${this.componentId}]`}}class Bt extends I{constructor(e,t){console.debug(...f(`Constructing ${Bt.name}`));const i=e.host.engine.i18n("ui.filter");super(e,t,new k(e,t,i,{onCheck:s=>{e.host.engine.imessage("status.auto.enable",[i])},onUnCheck:s=>{e.host.engine.imessage("status.auto.disable",[i])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})])),this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new A(this,"Kitten Scientists"),new _(this).addChildren(Si.map(s=>({label:this.host.engine.i18n(`filter.${s}`),name:s})).sort((s,a)=>s.label.localeCompare(a.label)).map(s=>new k(this,this.setting.filters[s.name],s.label,{onCheck:()=>{this.host.engine.imessage("filter.enable",[s.label])},onUnCheck:()=>{this.host.engine.imessage("filter.disable",[s.label])}})))])),this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new A(this,"Kittens Game"),new _(this).addChildren(xi.map(s=>({label:this.host.engine.i18n(`$console.filter.${s}`),name:s})).sort((s,a)=>s.label.localeCompare(a.label)).map(s=>new k(this,this.setting.filtersGame[s.name],s.label,{onCheck:()=>{this.host.engine.imessage("filter.enable",[s.label])},onUnCheck:()=>{this.host.engine.imessage("filter.disable",[s.label])}})))])),this.addChildContent(new Pt(this,"filter.explainer"))}}const Je={active:"_active_6c09s_16"};class It extends I{_unicornBuildings;_bestUnicornBuilding;constructor(e,t,i){console.debug(...f(`Constructing ${It.name}`));const s=e.host.engine.i18n("ui.faith");super(e,t,new U(e,t,i,s,{onCheck:n=>{e.host.engine.imessage("status.auto.enable",[s])},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 n=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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(n!==void 0){if(n===""||n.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(n)}},onUnCheck:n=>{e.host.engine.imessage("status.auto.disable",[s])},renderLabelTrigger:!1}),{onRefresh:()=>{for(const[n,r]of this._unicornBuildings.entries())r.elementLabel.attr("data-ks-active-from","❊"),r.elementLabel.attr("data-ks-active-to","✮"),this.setting.bestUnicornBuilding.enabled&&this.setting.bestUnicornBuildingCurrent===n?r.elementLabel.addClass(Je.active):r.elementLabel.removeClass(Je.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(n=>n.enabled&&0<n.max&&n.trigger<0),this.expando.ineffective=t.enabled&&Object.values(t.buildings).some(n=>n.enabled&&(n.max===0||n.trigger<0&&t.trigger<0));for(const[n,r]of this._unicornBuildings.entries())r.readOnly=this._bestUnicornBuilding.setting.enabled,r.maxButton.readOnly=this._bestUnicornBuilding.setting.enabled,r.triggerButton.readOnly=this._bestUnicornBuilding.setting.enabled}});const a=[...Ne];this._unicornBuildings=new Map([["unicornPasture",te.getBuildOption(this,this.setting.buildings.unicornPasture,i,this.setting,this.host.engine.i18n("$buildings.unicornPasture.label"),s,{renderLabelTrigger:!1})],...this.host.game.religion.zigguratUpgrades.filter(n=>a.includes(n.name)&&!g(this.setting.buildings[n.name])).map(n=>[n.name,te.getBuildOption(this,this.setting.buildings[n.name],i,this.setting,n.label,s,{renderLabelTrigger:!1})])]),this._bestUnicornBuilding=new k(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 n of this._unicornBuildings.values())n.setting.enabled=!0,n.setting.max=-1,n.setting.trigger=-1},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.faith.best.unicorn")])},upgradeIndicator:!0}),this.addChildrenContent([new _(this,{onReset:()=>{const n=new Ct;this.setting.load({bestUnicornBuilding:n.bestUnicornBuilding,buildings:n.buildings})}}).addChildren([new A(this,this.host.engine.i18n("$religion.panel.ziggurat.label")),...this._unicornBuildings.values(),this._bestUnicornBuilding,new K(this),...this.host.game.religion.zigguratUpgrades.filter(n=>!a.includes(n.name)&&!g(this.setting.buildings[n.name])).map(n=>te.getBuildOption(this,this.setting.buildings[n.name],i,this.setting,n.label,s,{renderLabelTrigger:!1})),new K(this),new A(this,this.host.engine.i18n("$religion.panel.orderOfTheSun.label")),...this.host.game.religion.religionUpgrades.filter(n=>!g(this.setting.buildings[n.name])).map(n=>te.getBuildOption(this,this.setting.buildings[n.name],i,this.setting,n.label,s,{delimiter:n.name===this.host.game.religion.religionUpgrades.at(-1)?.name,renderLabelTrigger:!1})),new A(this,this.host.engine.i18n("$religion.panel.cryptotheology.label")),...this.host.game.religion.transcendenceUpgrades.filter(n=>!g(this.setting.buildings[n.name])).map(n=>te.getBuildOption(this,this.setting.buildings[n.name],i,this.setting,n.label,s,{renderLabelTrigger:!1}))]),new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new A(this,this.host.engine.i18n("ui.additional")),...fs.map(n=>{const r=this.host.engine.i18n(`option.faith.${n}`);if(n==="transcend")return new k(this,this.setting[n],r,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[r])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[r])}});const c=new U(this,this.setting[n],i,r,{classes:[w.lastHeadAction],onCheck:()=>{this.host.engine.imessage("status.sub.enable",[r])},onRefresh:()=>{c.triggerButton.inactive=!this.setting[n].enabled||this.setting[n].trigger===-1},onSetTrigger:async()=>{const o=await x.prompt(this,this.host.engine.i18n(c.triggerButton.behavior==="integer"?"ui.trigger.setinteger":"ui.trigger.setpercentage",[r]),this.host.engine.i18n("ui.trigger.build.prompt",[r,c.triggerButton.behavior==="integer"?this.host.renderAbsolute(this.setting[n].trigger,i.selected):this.host.renderPercentage(this.setting[n].trigger,i.selected,!0)]),c.triggerButton.behavior==="integer"?this.host.renderAbsolute(this.setting[n].trigger):this.host.renderPercentage(this.setting[n].trigger),this.host.engine.i18n(c.triggerButton.behavior==="integer"?"ui.trigger.setinteger.promptExplainer":"ui.trigger.setpercentage.promptExplainer"));o===void 0||o===""||o.startsWith("-")||(this.setting[n].trigger=(c.triggerButton.behavior==="integer"?this.host.parseAbsolute(o):this.host.parsePercentage(o))??this.setting[n].trigger)},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[r])}});return c.triggerButton.element.addClass(w.lastHeadAction),c})])])}}class $t extends F{setting;resourceName;constructor(e,t,i,s,a){super(e,"",M.DataUsage,{...a,onClick:async()=>{const n=await x.prompt(e,e.host.engine.i18n("resources.consume.prompt"),e.host.engine.i18n("resources.consume.promptTitle",[s,e.host.renderPercentage(t.consume,i.selected,!0)]),e.host.renderPercentage(t.consume),e.host.engine.i18n("resources.consume.promptExplainer"));n!==void 0&&(n===""||n.startsWith("-")||(t.consume=e.host.parsePercentage(n)))},onRefresh:()=>{const n=this.host.renderPercentage(this.setting.consume,this.host.engine.settings.locale.selected,!0),r=this.setting.consume===0?this.host.engine.i18n("resources.consume.titleZero",[this.resourceName]):this.host.engine.i18n("resources.consume.title",[n,this.resourceName]);this.updateTitle(r),a?.onRefresh?.()}}),this.element.addClass(w.consumeButton),this.resourceName=s,this.setting=t}toString(){return`[${$t.name}#${this.componentId}]`}}class Lt extends F{setting;resourceName;constructor(e,t,i,s,a){super(e,"",null,{...a,onClick:async()=>{const n=await x.prompt(e,e.host.engine.i18n("resources.stock.prompt"),e.host.engine.i18n("resources.stock.promptTitle",[s,e.host.renderAbsolute(t.stock,i.selected)]),e.host.renderAbsolute(t.stock),e.host.engine.i18n("resources.stock.promptExplainer"));if(n!==void 0){if(n===""||n.startsWith("-")){t.stock=-1;return}n==="0"&&(t.enabled=!1),t.stock=e.host.parseAbsolute(n)??t.stock}},onRefresh:()=>{const n=this.host.renderAbsolute(this.setting.stock),r=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(r),this.updateLabel(n)}}),this.element.addClass(w.stockButton),this.resourceName=s,this.setting=t}toString(){return`[${Lt.name}#${this.componentId}]`}}class Ot extends I{constructor(e,t,i){console.debug(...f(`Constructing ${Ot.name}`));const s=e.host.engine.i18n("ui.resources");super(e,t,new ne(e,s,{classes:[B.checked,B.setting],icon:M.Resources}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]));const a=["blackcoin","burnedParagon","elderBox","gflops","hashrates","kittens","paragon","temporalFlux","wrappingPaper","zebras"];this.addChildContent(new _(this).addChildren(this.host.game.resPool.resources.filter(n=>!a.includes(n.name)&&!g(this.setting.resources[n.name])).sort((n,r)=>n.title.localeCompare(r.title,i.selected)).map(n=>[this.setting.resources[n.name],W(n.title)]).map(([n,r])=>this._makeResourceSetting(this,n,i,r))))}_makeResourceSetting(e,t,i,s){const a=new k(e,t,s,{onCheck:()=>{e.host.engine.imessage("status.resource.enable",[s])},onUnCheck:()=>{e.host.engine.imessage("status.resource.disable",[s])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),n=new Lt(e,t,i,s,{alignment:"right",border:!1,classes:[w.headAction],onRefreshRequest:()=>{n.inactive=!t.enabled||t.stock===0}});a.head.addChild(n);const r=new $t(e,t,i,s,{border:!1,classes:[w.lastHeadAction],onRefreshRequest:()=>{r.inactive=!t.enabled||t.consume!==100,r.ineffective=t.enabled&&t.consume===0}});return a.head.addChild(r),a}}class En extends I{constructor(e,t,i,s){const a=e.host.engine.i18n("ui.upgrade.policies");super(e,t,new k(e,t,a,{onCheck:o=>{e.host.engine.imessage("status.auto.enable",[a])},onUnCheck:o=>{e.host.engine.imessage("status.auto.disable",[a])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.policies).some(o=>o.enabled)}});const n=this.host.game.science.policies.filter(o=>!g(this.setting.policies[o.name])),r=[];let c=n[0].label;for(const o of n.sort((h,u)=>h.label.localeCompare(u.label,i.selected))){const h=this.setting.policies[o.name],u=new k(this,h,o.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o.label])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o.label])}});this.host.engine.localeSupportsFirstLetterSplits(i.selected)&&c[0]!==o.label[0]&&u.element.addClass(E.splitter),r.push(u),c=o.label}this.addChildContent(new _(this).addChildren(r))}}class Mn extends I{constructor(e,t,i,s){const a=e.host.engine.i18n("ui.upgrade.techs");super(e,t,new U(e,t,i,a,{onCheck:o=>{e.host.engine.imessage("status.auto.enable",[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.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const o=await x.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.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",[a])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1,this.settingItem.triggerButton.ineffective=s.enabled&&t.enabled&&t.trigger===-1&&!Object.values(t.techs).some(o=>o.enabled&&0<=o.trigger),this.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.techs).some(o=>o.enabled)}});const n=this.host.game.science.techs.filter(o=>!g(this.setting.techs[o.name])),r=[];let c=n[0].label;for(const o of n.sort((h,u)=>h.label.localeCompare(u.label,i.selected))){const h=this.setting.techs[o.name],u=new U(this,h,i,o.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o.label])},onRefresh:()=>{u.triggerButton.inactive=!h.enabled||h.trigger===-1,u.triggerButton.ineffective=s.enabled&&t.enabled&&h.enabled&&t.trigger===-1&&h.trigger===-1},onRefreshTrigger:()=>{u.triggerButton.element[0].title=this.host.engine.i18n("ui.trigger",[h.trigger<0?t.trigger<0?this.host.engine.i18n("ui.trigger.section.blocked",[a]):`${this.host.renderPercentage(t.trigger,i.selected,!0)} (${this.host.engine.i18n("ui.trigger.section.inherited")})`:this.host.renderPercentage(h.trigger,i.selected,!0)])},onSetTrigger:async()=>{const d=await x.prompt(this,this.host.engine.i18n("ui.trigger.prompt.percentage"),this.host.engine.i18n("ui.trigger.section.prompt",[a,h.trigger!==-1?this.host.renderPercentage(h.trigger,i.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(d!==void 0){if(d===""||d.startsWith("-")){h.trigger=-1;return}h.trigger=this.host.parsePercentage(d)}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o.label])},renderLabelTrigger:!1});u.triggerButton.element.addClass(w.lastHeadAction),this.host.engine.localeSupportsFirstLetterSplits(i.selected)&&c[0]!==o.label[0]&&u.element.addClass(E.splitter),r.push(u),c=o.label}this.addChildContent(new _(this).addChildren(r))}}class Ut extends I{_policiesUi;_techsUi;_observeStars;constructor(e,t,i){console.debug(...f(`Constructing ${Ut.name}`));const s=e.host.engine.i18n("ui.upgrade");super(e,t,new k(e,t,s,{onCheck:n=>{e.host.engine.imessage("status.auto.enable",[s])},onUnCheck:n=>{e.host.engine.imessage("status.auto.disable",[s])}}).addChildrenHead([new T(e,{classes:[E.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))}}),this._policiesUi=new En(this,t.policies,i,t),this._techsUi=new Mn(this,t.techs,i,t),this._observeStars=new k(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 _(this,{hasDisableAll:!1,hasEnableAll:!1});a.addChildren([this._techsUi,this._policiesUi,this._observeStars]),this.addChildContent(a)}}class Rn extends I{_missions;constructor(e,t,i,s){const a=e.host.engine.i18n("ui.upgrade.missions");super(e,t,new k(e,t,a,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[a])},onRefresh:()=>{this.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.missions).some(r=>r.enabled)},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[a])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})])),this._missions=this.host.game.space.programs.filter(r=>!g(this.setting.missions[r.name])).map(r=>new k(this,this.setting.missions[r.name],r.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[r.label])},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[r.label])}}));const n=new _(this).addChildren(this._missions);this.addChildContent(n)}}class Dt extends I{_missionsUi;constructor(e,t,i){console.debug(...f(`Constructing ${Dt.name}`));const s=e.host.engine.i18n("ui.space");super(e,t,new U(e,t,i,s,{onCheck:n=>{e.host.engine.imessage("status.auto.enable",[s])},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 n=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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(n!==void 0){if(n===""||n.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(n)}},onUnCheck:n=>{e.host.engine.imessage("status.auto.disable",[s])},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(n=>n.enabled&&0<n.max&&n.trigger<0),this.expando.ineffective=t.enabled&&(Object.values(t.buildings).some(n=>n.enabled&&(n.max===0||n.trigger<0&&t.trigger<0))||!Object.values(t.buildings).some(n=>n.enabled)&&!t.unlockMissions.enabled||this._missionsUi.expando.ineffective)}}),this.addChildContent(new _(this,{onReset:()=>{this.setting.load({buildings:new He().buildings})}}).addChildren(this.host.game.space.planets.filter(n=>0<n.buildings.length).flatMap((n,r,c)=>[new A(this,this.host.engine.labelForPlanet(n.name)),...n.buildings.filter(o=>!g(this.setting.buildings[o.name])).map((o,h,u)=>te.getBuildOption(this,this.setting.buildings[o.name],i,this.setting,o.label,s,{delimiter:r<c.length-1&&h===u.length-1,renderLabelTrigger:!1}))])));const a=new _(this,{hasDisableAll:!1,hasEnableAll:!1});a.addChild(new A(this,this.host.engine.i18n("ui.additional"))),this._missionsUi=new Rn(this,this.setting.unlockMissions,i,this.setting),a.addChild(this._missionsUi),this.addChildContent(a)}}class Nt extends he{constructor(e,t=400){super("ERR_OS_INVALID_ARGUMENT",e,t),this.name="InvalidArgumentError",typeof Error.captureStackTrace<"u"&&Error.captureStackTrace(this,Nt)}}const Xe=43200,Hi=1440,Fi=Symbol.for("constructDateFrom");function qt(l,e){return typeof l=="function"?l(e):l&&typeof l=="object"&&Fi in l?l[Fi](e):l instanceof Date?new l.constructor(e):new Date(e)}function An(l){return qt(l,Date.now())}const Pn={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"}},Bn=(l,e,t)=>{let i;const s=Pn[l];return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function J(l){return(e={})=>{const t=e.width?String(e.width):l.defaultWidth;return l.formats[t]||l.formats[l.defaultWidth]}}const In={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},$n={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ln={full:"{{date}} \'at\' {{time}}",long:"{{date}} \'at\' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},On={date:J({formats:In,defaultWidth:"full"}),time:J({formats:$n,defaultWidth:"full"}),dateTime:J({formats:Ln,defaultWidth:"full"})},Un={lastWeek:"\'last\' eeee \'at\' p",yesterday:"\'yesterday at\' p",today:"\'today at\' p",tomorrow:"\'tomorrow at\' p",nextWeek:"eeee \'at\' p",other:"P"},Dn=(l,e,t,i)=>Un[l];function N(l){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let s;if(i==="formatting"&&l.formattingValues){const n=l.defaultFormattingWidth||l.defaultWidth,r=t?.width?String(t.width):n;s=l.formattingValues[r]||l.formattingValues[n]}else{const n=l.defaultWidth,r=t?.width?String(t.width):l.defaultWidth;s=l.values[r]||l.values[n]}const a=l.argumentCallback?l.argumentCallback(e):e;return s[a]}}const Nn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},qn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},zn={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"]},Hn={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"]},Fn={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"}},Wn={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"}},Gn={ordinalNumber:(l,e)=>{const t=Number(l),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:N({values:Nn,defaultWidth:"wide"}),quarter:N({values:qn,defaultWidth:"wide",argumentCallback:l=>l-1}),month:N({values:zn,defaultWidth:"wide"}),day:N({values:Hn,defaultWidth:"wide"}),dayPeriod:N({values:Fn,defaultWidth:"wide",formattingValues:Wn,defaultFormattingWidth:"wide"})};function q(l){return(e,t={})=>{const i=t.width,s=i&&l.matchPatterns[i]||l.matchPatterns[l.defaultMatchWidth],a=e.match(s);if(!a)return null;const n=a[0],r=i&&l.parsePatterns[i]||l.parsePatterns[l.defaultParseWidth],c=Array.isArray(r)?Kn(r,u=>u.test(n)):Zn(r,u=>u.test(n));let o;o=l.valueCallback?l.valueCallback(c):c,o=t.valueCallback?t.valueCallback(o):o;const h=e.slice(n.length);return{value:o,rest:h}}}function Zn(l,e){for(const t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&e(l[t]))return t}function Kn(l,e){for(let t=0;t<l.length;t++)if(e(l[t]))return t}function Ye(l){return(e,t={})=>{const i=e.match(l.matchPattern);if(!i)return null;const s=i[0],a=e.match(l.parsePattern);if(!a)return null;let n=l.valueCallback?l.valueCallback(a[0]):a[0];n=t.valueCallback?t.valueCallback(n):n;const r=e.slice(s.length);return{value:n,rest:r}}}const Vn=/^(\\d+)(th|st|nd|rd)?/i,jn=/\\d+/i,Jn={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},Xn={any:[/^b/i,/^(a|c)/i]},Yn={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Qn={any:[/1/i,/2/i,/3/i,/4/i]},ea={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},ta={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]},ia={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},sa={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]},na={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},aa={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}},ra={ordinalNumber:Ye({matchPattern:Vn,parsePattern:jn,valueCallback:l=>parseInt(l,10)}),era:q({matchPatterns:Jn,defaultMatchWidth:"wide",parsePatterns:Xn,defaultParseWidth:"any"}),quarter:q({matchPatterns:Yn,defaultMatchWidth:"wide",parsePatterns:Qn,defaultParseWidth:"any",valueCallback:l=>l+1}),month:q({matchPatterns:ea,defaultMatchWidth:"wide",parsePatterns:ta,defaultParseWidth:"any"}),day:q({matchPatterns:ia,defaultMatchWidth:"wide",parsePatterns:sa,defaultParseWidth:"any"}),dayPeriod:q({matchPatterns:na,defaultMatchWidth:"any",parsePatterns:aa,defaultParseWidth:"any"})},Wi={code:"en-US",formatDistance:Bn,formatLong:On,formatRelative:Dn,localize:Gn,match:ra,options:{weekStartsOn:0,firstWeekContainsDate:1}};let oa={};function Gi(){return oa}function le(l,e){return qt(e||l,l)}function Zi(l){const e=le(l),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+l-+t}function Qe(l,...e){const t=qt.bind(null,l||e.find(i=>typeof i=="object"));return e.map(t)}function et(l,e){const t=+le(l)-+le(e);return t<0?-1:t>0?1:t}function la(l,e,t){const[i,s]=Qe(t?.in,l,e),a=i.getFullYear()-s.getFullYear(),n=i.getMonth()-s.getMonth();return a*12+n}function ca(l,e){const t=le(l,e?.in);return t.setHours(23,59,59,999),t}function ha(l,e){const t=le(l,e?.in),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t}function ua(l,e){const t=le(l,e?.in);return+ca(t,e)==+ha(t,e)}function da(l,e,t){const[i,s,a]=Qe(t?.in,l,l,e),n=et(s,a),r=Math.abs(la(s,a));if(r<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-n*r);let c=et(s,a)===-n;ua(i)&&r===1&&et(i,a)===1&&(c=!1);const o=n*(r-+c);return o===0?0:o}function ga(l){return e=>{const i=(l?Math[l]:Math.trunc)(e);return i===0?0:i}}function ma(l,e){return+le(l)-+le(e)}function fa(l,e,t){const i=ma(l,e)/1e3;return ga(t?.roundingMethod)(i)}function pa(l,e,t){const i=Gi(),s=t?.locale??i.locale??Wi,a=2520,n=et(l,e);if(isNaN(n))throw new RangeError("Invalid time value");const r=Object.assign({},t,{addSuffix:t?.addSuffix,comparison:n}),[c,o]=Qe(t?.in,...n>0?[e,l]:[l,e]),h=fa(o,c),u=(Zi(o)-Zi(c))/1e3,d=Math.round((h-u)/60);let m;if(d<2)return t?.includeSeconds?h<5?s.formatDistance("lessThanXSeconds",5,r):h<10?s.formatDistance("lessThanXSeconds",10,r):h<20?s.formatDistance("lessThanXSeconds",20,r):h<40?s.formatDistance("halfAMinute",0,r):h<60?s.formatDistance("lessThanXMinutes",1,r):s.formatDistance("xMinutes",1,r):d===0?s.formatDistance("lessThanXMinutes",1,r):s.formatDistance("xMinutes",d,r);if(d<45)return s.formatDistance("xMinutes",d,r);if(d<90)return s.formatDistance("aboutXHours",1,r);if(d<Hi){const v=Math.round(d/60);return s.formatDistance("aboutXHours",v,r)}else{if(d<a)return s.formatDistance("xDays",1,r);if(d<Xe){const v=Math.round(d/Hi);return s.formatDistance("xDays",v,r)}else if(d<Xe*2)return m=Math.round(d/Xe),s.formatDistance("aboutXMonths",m,r)}if(m=da(o,c),m<12){const v=Math.round(d/Xe);return s.formatDistance("xMonths",v,r)}else{const v=m%12,b=Math.trunc(m/12);return v<3?s.formatDistance("aboutXYears",b,r):v<9?s.formatDistance("overXYears",b,r):s.formatDistance("almostXYears",b+1,r)}}function Ki(l,e){return pa(l,An(l),e)}function Vi(l,e){const t=Gi(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=le(l,e?.in),a=s.getDay(),n=(a<i?7:0)+a-i;return s.setDate(s.getDate()-n),s.setHours(0,0,0,0),s}function ba(l,e,t){const[i,s]=Qe(t?.in,l,e);return+Vi(i,t)==+Vi(s,t)}const ji={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"}}},va=(l,e,t)=>{let i;const s=t?.addSuffix?ji[l].withPreposition:ji[l].standalone;return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",String(e)),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:"vor "+i:i},ya={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},wa={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},ka={full:"{{date}} \'um\' {{time}}",long:"{{date}} \'um\' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},_a={date:J({formats:ya,defaultWidth:"full"}),time:J({formats:wa,defaultWidth:"full"}),dateTime:J({formats:ka,defaultWidth:"full"})},Ca={lastWeek:"\'letzten\' eeee \'um\' p",yesterday:"\'gestern um\' p",today:"\'heute um\' p",tomorrow:"\'morgen um\' p",nextWeek:"eeee \'um\' p",other:"P"},Sa=(l,e,t,i)=>Ca[l],xa={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},Ta={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},zt={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"]},Ea={narrow:zt.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:zt.wide},Ma={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"]},Ra={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"}},Aa={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"}},Pa={ordinalNumber:l=>Number(l)+".",era:N({values:xa,defaultWidth:"wide"}),quarter:N({values:Ta,defaultWidth:"wide",argumentCallback:l=>l-1}),month:N({values:zt,formattingValues:Ea,defaultWidth:"wide"}),day:N({values:Ma,defaultWidth:"wide"}),dayPeriod:N({values:Ra,defaultWidth:"wide",formattingValues:Aa,defaultFormattingWidth:"wide"})},Ba=/^(\\d+)(\\.)?/i,Ia=/\\d+/i,$a={narrow:/^(v\\.? ?Chr\\.?|n\\.? ?Chr\\.?)/i,abbreviated:/^(v\\.? ?Chr\\.?|n\\.? ?Chr\\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},La={any:[/^v/i,/^n/i]},Oa={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\\.)? Quartal/i},Ua={any:[/1/i,/2/i,/3/i,/4/i]},Da={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},Na={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]},qa={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},za={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},Ha={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},Fa={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}},Wa={ordinalNumber:Ye({matchPattern:Ba,parsePattern:Ia,valueCallback:l=>parseInt(l)}),era:q({matchPatterns:$a,defaultMatchWidth:"wide",parsePatterns:La,defaultParseWidth:"any"}),quarter:q({matchPatterns:Oa,defaultMatchWidth:"wide",parsePatterns:Ua,defaultParseWidth:"any",valueCallback:l=>l+1}),month:q({matchPatterns:Da,defaultMatchWidth:"wide",parsePatterns:Na,defaultParseWidth:"any"}),day:q({matchPatterns:qa,defaultMatchWidth:"wide",parsePatterns:za,defaultParseWidth:"any"}),dayPeriod:q({matchPatterns:Ha,defaultMatchWidth:"wide",parsePatterns:Fa,defaultParseWidth:"any"})},Ga={code:"de",formatDistance:va,formatLong:_a,formatRelative:Sa,localize:Pa,match:Wa,options:{weekStartsOn:1,firstWeekContainsDate:4}},Za={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}} שנים"}},Ka=(l,e,t)=>{if(l==="xDays"&&t?.addSuffix&&e<=2)return t.comparison&&t.comparison>0?e===1?"מחר":"מחרתיים":e===1?"אתמול":"שלשום";let i;const s=Za[l];return typeof s=="string"?i=s:e===1?i=s.one:e===2?i=s.two:i=s.other.replace("{{count}}",String(e)),t?.addSuffix?t.comparison&&t.comparison>0?"בעוד "+i:"לפני "+i:i},Va={full:"EEEE, d בMMMM y",long:"d בMMMM y",medium:"d בMMM y",short:"d.M.y"},ja={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},Ja={full:"{{date}} \'בשעה\' {{time}}",long:"{{date}} \'בשעה\' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Xa={date:J({formats:Va,defaultWidth:"full"}),time:J({formats:ja,defaultWidth:"full"}),dateTime:J({formats:Ja,defaultWidth:"full"})},Ya={lastWeek:"eeee \'שעבר בשעה\' p",yesterday:"\'אתמול בשעה\' p",today:"\'היום בשעה\' p",tomorrow:"\'מחר בשעה\' p",nextWeek:"eeee \'בשעה\' p",other:"P"},Qa=(l,e,t,i)=>Ya[l],er={narrow:["לפנה״ס","לספירה"],abbreviated:["לפנה״ס","לספירה"],wide:["לפני הספירה","לספירה"]},tr={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["רבעון 1","רבעון 2","רבעון 3","רבעון 4"]},ir={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"],wide:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"]},sr={narrow:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],short:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],abbreviated:["יום א׳","יום ב׳","יום ג׳","יום ד׳","יום ה׳","יום ו׳","שבת"],wide:["יום ראשון","יום שני","יום שלישי","יום רביעי","יום חמישי","יום שישי","יום שבת"]},nr={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:"לילה"}},ar={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:"בלילה"}},rr={ordinalNumber:(l,e)=>{const t=Number(l);if(t<=0||t>10)return String(t);const i=String(e?.unit),s=["year","hour","minute","second"].indexOf(i)>=0,a=["ראשון","שני","שלישי","רביעי","חמישי","שישי","שביעי","שמיני","תשיעי","עשירי"],n=["ראשונה","שנייה","שלישית","רביעית","חמישית","שישית","שביעית","שמינית","תשיעית","עשירית"],r=t-1;return s?n[r]:a[r]},era:N({values:er,defaultWidth:"wide"}),quarter:N({values:tr,defaultWidth:"wide",argumentCallback:l=>l-1}),month:N({values:ir,defaultWidth:"wide"}),day:N({values:sr,defaultWidth:"wide"}),dayPeriod:N({values:nr,defaultWidth:"wide",formattingValues:ar,defaultFormattingWidth:"wide"})},or=/^(\\d+|(ראשון|שני|שלישי|רביעי|חמישי|שישי|שביעי|שמיני|תשיעי|עשירי|ראשונה|שנייה|שלישית|רביעית|חמישית|שישית|שביעית|שמינית|תשיעית|עשירית))/i,lr=/^(\\d+|רא|שנ|של|רב|ח|שי|שב|שמ|ת|ע)/i,cr={narrow:/^ל(ספירה|פנה״ס)/i,abbreviated:/^ל(ספירה|פנה״ס)/i,wide:/^ל(פני ה)?ספירה/i},hr={any:[/^לפ/i,/^לס/i]},ur={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^רבעון [1234]/i},dr={any:[/1/i,/2/i,/3/i,/4/i]},gr={narrow:/^\\d+/i,abbreviated:/^(ינו|פבר|מרץ|אפר|מאי|יוני|יולי|אוג|ספט|אוק|נוב|דצמ)׳?/i,wide:/^(ינואר|פברואר|מרץ|אפריל|מאי|יוני|יולי|אוגוסט|ספטמבר|אוקטובר|נובמבר|דצמבר)/i},mr={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]},fr={narrow:/^[אבגדהוש]׳/i,short:/^[אבגדהוש]׳/i,abbreviated:/^(שבת|יום (א|ב|ג|ד|ה|ו)׳)/i,wide:/^יום (ראשון|שני|שלישי|רביעי|חמישי|שישי|שבת)/i},pr={abbreviated:[/א׳$/i,/ב׳$/i,/ג׳$/i,/ד׳$/i,/ה׳$/i,/ו׳$/i,/^ש/i],wide:[/ן$/i,/ני$/i,/לישי$/i,/עי$/i,/מישי$/i,/שישי$/i,/ת$/i],any:[/^א/i,/^ב/i,/^ג/i,/^ד/i,/^ה/i,/^ו/i,/^ש/i]},br={any:/^(אחר ה|ב)?(חצות|צהריים|בוקר|ערב|לילה|אחה״צ|לפנה״צ)/i},vr={any:{am:/^לפ/i,pm:/^אחה/i,midnight:/^ח/i,noon:/^צ/i,morning:/בוקר/i,afternoon:/בצ|אחר/i,evening:/ערב/i,night:/לילה/i}},yr=["רא","שנ","של","רב","ח","שי","שב","שמ","ת","ע"],wr={ordinalNumber:Ye({matchPattern:or,parsePattern:lr,valueCallback:l=>{const e=parseInt(l,10);return isNaN(e)?yr.indexOf(l)+1:e}}),era:q({matchPatterns:cr,defaultMatchWidth:"wide",parsePatterns:hr,defaultParseWidth:"any"}),quarter:q({matchPatterns:ur,defaultMatchWidth:"wide",parsePatterns:dr,defaultParseWidth:"any",valueCallback:l=>l+1}),month:q({matchPatterns:gr,defaultMatchWidth:"wide",parsePatterns:mr,defaultParseWidth:"any"}),day:q({matchPatterns:fr,defaultMatchWidth:"wide",parsePatterns:pr,defaultParseWidth:"any"}),dayPeriod:q({matchPatterns:br,defaultMatchWidth:"any",parsePatterns:vr,defaultParseWidth:"any"})},kr={code:"he",formatDistance:Ka,formatLong:Xa,formatRelative:Qa,localize:rr,match:wr,options:{weekStartsOn:0,firstWeekContainsDate:1}},_r={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}} 年"}},Cr=(l,e,t)=>{let i;const s=_r[l];return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",String(e)),t?.addSuffix?t.comparison&&t.comparison>0?i+"内":i+"前":i},Sr={full:"y\'年\'M\'月\'d\'日\' EEEE",long:"y\'年\'M\'月\'d\'日\'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},xr={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},Tr={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Er={date:J({formats:Sr,defaultWidth:"full"}),time:J({formats:xr,defaultWidth:"full"}),dateTime:J({formats:Tr,defaultWidth:"full"})};function Ji(l,e,t){const i="eeee p";return ba(l,e,t)?i:l.getTime()>e.getTime()?"\'下个\'"+i:"\'上个\'"+i}const Mr={lastWeek:Ji,yesterday:"\'昨天\' p",today:"\'今天\' p",tomorrow:"\'明天\' p",nextWeek:Ji,other:"PP p"},Rr=(l,e,t,i)=>{const s=Mr[l];return typeof s=="function"?s(e,t,i):s},Ar={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},Pr={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},Br={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},Ir={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},$r={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:"夜间"}},Lr={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:"夜间"}},Or={ordinalNumber:(l,e)=>{const t=Number(l);switch(e?.unit){case"date":return t.toString()+"日";case"hour":return t.toString()+"时";case"minute":return t.toString()+"分";case"second":return t.toString()+"秒";default:return"第 "+t.toString()}},era:N({values:Ar,defaultWidth:"wide"}),quarter:N({values:Pr,defaultWidth:"wide",argumentCallback:l=>l-1}),month:N({values:Br,defaultWidth:"wide"}),day:N({values:Ir,defaultWidth:"wide"}),dayPeriod:N({values:$r,defaultWidth:"wide",formattingValues:Lr,defaultFormattingWidth:"wide"})},Ur=/^(第\\s*)?\\d+(日|时|分|秒)?/i,Dr=/\\d+/i,Nr={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},qr={any:[/^(前)/i,/^(公元)/i]},zr={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},Hr={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},Fr={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},Wr={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]},Gr={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},Zr={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},Kr={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},Vr={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},jr={ordinalNumber:Ye({matchPattern:Ur,parsePattern:Dr,valueCallback:l=>parseInt(l,10)}),era:q({matchPatterns:Nr,defaultMatchWidth:"wide",parsePatterns:qr,defaultParseWidth:"any"}),quarter:q({matchPatterns:zr,defaultMatchWidth:"wide",parsePatterns:Hr,defaultParseWidth:"any",valueCallback:l=>l+1}),month:q({matchPatterns:Fr,defaultMatchWidth:"wide",parsePatterns:Wr,defaultParseWidth:"any"}),day:q({matchPatterns:Gr,defaultMatchWidth:"wide",parsePatterns:Zr,defaultParseWidth:"any"}),dayPeriod:q({matchPatterns:Kr,defaultMatchWidth:"any",parsePatterns:Vr,defaultParseWidth:"any"})},Jr={code:"zh-CN",formatDistance:Cr,formatLong:Er,formatRelative:Rr,localize:Or,match:jr,options:{weekStartsOn:1,firstWeekContainsDate:4}};class Xr{_game;constructor(e){this._game=e}load(e){return new Promise((t,i)=>{if(e===null){t();return}this._game.saveImportDropboxText(e,s=>{if(s){i(s);return}t()})})}loadRaw(e){const t=this._game.compressLZData(JSON.stringify(e));return this.load(t)}}class Re extends se{constructor(e,t){super(e,t),this.element.addClass(zi.toolbar)}toString(){return`[${Re.name}#${this.componentId}]`}addChild(e){return super.addChild(e)}}class Ht extends I{games=new Array;states=new Array;gameList;stateList;locale;constructor(e,t,i){console.debug(...f(`Constructing ${Ht.name}`));const s=e.host.engine.i18n("state.title");super(e,t,new ne(e,s,{classes:[B.checked,B.setting],icon:M.State}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefresh:()=>{this._refreshGameList(),this._refreshStateList()}}),this.gameList=new _(this,{hasDisableAll:!1,hasEnableAll:!1}),this.stateList=new _(this,{hasDisableAll:!1,hasEnableAll:!1}),this.locale=i.selected==="zh-CN"?Jr:i.selected==="he-IL"?kr:i.selected==="de-DE"?Ga:Wi,this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new k(this,this.setting.noConfirm,this.host.engine.i18n("state.noConfirm")),new se(this).addChild(new K(this)),new A(this,this.host.engine.i18n("state.local")),new Re(this).addChildren([new F(this,this.host.engine.i18n("state.import"),M.Import,{onClick:()=>{this.import()},title:this.host.engine.i18n("state.importTitle")})]),new se(this).addChild(new K(this)),new A(this,this.host.engine.i18n("state.localStates")),new Re(this).addChildren([new F(this,this.host.engine.i18n("state.store"),M.SaveAs,{onClick:()=>{this.storeState()},title:this.host.engine.i18n("state.storeState")}),new F(this,this.host.engine.i18n("copy"),M.Copy,{onClick:()=>{this.copyState().catch(H(console)),this.host.engine.imessage("state.copied.stateCurrent")},title:this.host.engine.i18n("state.copy.stateCurrent")}),new F(this,this.host.engine.i18n("state.new"),M.Draft,{onClick:()=>{this.storeStateFactoryDefaults(),this.host.engine.imessage("state.stored.state")},title:this.host.engine.i18n("state.storeFactory")}),new F(this,this.host.engine.i18n("state.exportAll"),M.Sync,{onClick:()=>{this.exportStateAll()},title:this.host.engine.i18n("state.exportAllTitle")})]),new se(this).addChild(this.stateList),new se(this).addChild(new K(this)),new A(this,this.host.engine.i18n("state.localGames")),new Re(this).addChildren([new F(this,this.host.engine.i18n("state.store"),M.SaveAs,{onClick:()=>{this.storeGame(),this.host.engine.imessage("state.stored.game")},title:this.host.engine.i18n("state.storeGame")}),new F(this,this.host.engine.i18n("copy"),M.Copy,{onClick:()=>{this.copyGame().catch(H(console)),this.host.engine.imessage("state.copied.gameCurrent")},title:this.host.engine.i18n("state.copy.gameCurrent")})]),new se(this).addChild(this.gameList),new k(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(;!g(t);){const i=JSON.parse(t);this.games.push(new Ue(i)),t=localStorage.getItem(`ks.game.${++e}`)}}catch(i){console.error(...f(i))}}_storeGames(){let e=0,t=localStorage.getItem(`ks.game.${e}`);for(;!g(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(;!g(t);){const i=JSON.parse(t);ae.unknownAsEngineStateOrThrow(i.state),this.states.push(new Ue(i)),t=localStorage.getItem(`ks.state.${++e}`)}}catch(i){console.error(...f(i))}}_storeStates(){let e=0,t=localStorage.getItem(`ks.state.${e}`);for(;!g(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 Et(this,new fe(this,`${e.label} (${Ki(new Date(e.timestamp),{addSuffix:!0,locale:this.locale})})`,{onClick:()=>{this.loadGame(e.game).catch(H(console)),this.host.engine.imessage("state.loaded.game",[e.label])},title:new Date(e.timestamp).toLocaleString()})).addChildren([new T(this,{classes:[E.fillSpace]}),new V(this,M.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 V(this,M.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 V(this,M.Copy,this.host.engine.i18n("state.copy.game"),{onClick:()=>{this.copyGame(e.game).catch(H(console)),this.host.engine.imessage("state.copied.game",[e.label])}}),new V(this,M.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 Et(this,new fe(this,`${e.label} (${Ki(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 T(this,{classes:[E.fillSpace]}),new V(this,M.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 V(this,M.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 V(this,M.Copy,this.host.engine.i18n("state.copy.state"),{onClick:()=>{this.copyState(e.state).catch(H(console)),this.host.engine.imessage("state.copied.state",[e.label])}}),new V(this,M.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),s=this.setting.compress.enabled?this.host.game.compressLZData(i):i;await C.window.navigator.clipboard.writeText(s)}import(){const e=C.window.prompt(this.host.engine.i18n("state.loadPrompt"));if(g(e))return;const t=new Date().toDateString();let i=1;const s=()=>this.host.engine.i18n("state.importedState",[`${t} #${i++}`]),a=n=>{try{const o=ae.decodeSettings(n);this.storeState(o,s()),this.host.engine.imessage("state.imported.state");return}catch{}try{const o=JSON.parse(n),h=ae.decodeSettings(o.state);this.storeState(h,o.label),this.host.engine.imessage("state.imported.state");return}catch{}let r;try{r=JSON.parse(n)}catch{const h=this.host.game.decompressLZData(n);try{r=JSON.parse(h)}catch{if(n.match(/\\r?\\n/))return n.split(/\\r?\\n/).forEach(d=>{a(d)});throw new Nt("The provided input can not be parsed as anything we understand.")}}let c;if(!g(r)&&"ks"in r&&!g(r.ks)){const o=r.ks.state[0];c=this.storeState(o,s())??void 0,this.host.engine.imessage("state.imported.state"),r.ks=void 0}this.storeGame(r,c),this.host.engine.imessage("state.imported.game")};a(e)}storeGame(e,t){let i=t;return g(i)&&(i=C.window.prompt(this.host.engine.i18n("state.storeGame.prompt"))??void 0),g(i)?null:(i=(i===""?void 0:i)??this.host.engine.i18n("state.unlabeledGame"),i=i.substring(0,127),this.games.push(new Ue({game:e??this.host.game.save(),label:i,timestamp:new Date().toISOString()})),this._storeGames(),this.requestRefresh(),i)}storeState(e,t){let i=t;return g(i)&&(i=C.window.prompt(this.host.engine.i18n("state.storeState.prompt"))??void 0),g(i)?null:(i=(i===""?void 0:i)??this.host.engine.i18n("state.unlabeledState"),i=i.substring(0,127),this.states.push(new Ue({label:i,state:e??this.host.engine.stateSerialize(),timestamp:new Date().toISOString()})),this._storeStates(),this.requestRefresh(),i)}storeStateFactoryDefaults(){this.storeState(ee.DEFAULT_STATE)}storeAutoSave(e){const t=this.states.find(i=>i.unwrap().label==="Auto-Save");if(!g(t)){console.info(...f("Updating existing Auto-Save...")),t.replace({...t.unwrap(),state:e,timestamp:new Date().toISOString()}),this._storeStates(),this.requestRefresh();return}console.info(...f("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:ae.encodeSettings(a.state,!1),timestamp:a.timestamp})).join(`\n`),t=document.createElement("a"),i=new Blob([e],{type:"application/x-ndjson"}),s=URL.createObjectURL(i);t.setAttribute("href",s),t.setAttribute("download",`ks-local-states-${Date.now()}.ndjson`),t.click()}async loadGame(e){this._destructiveActionPrevented()||await new Xr(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(...f("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(g(e)){console.info(...f("No Auto-Save settings found."));return}console.info(...f("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&&!C.window.confirm(this.host.engine.i18n("state.confirmDestruction"))}}class _e extends me{setting;constructor(e,t,i,s){super(e,new ne(e,t,{classes:[B.checked,B.setting],icon:s?.icon}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),s),this.setting=i}}class Yr extends _e{_buildings;constructor(e,t,i){const s=e.host.engine.i18n("ui.build");super(e,s,t,{icon:M.Bonfire,onRefreshRequest:()=>{this.expando.ineffective=Object.values(t.buildings).some(n=>n.enabled&&n.trigger===-1)}}),this._buildings=[];for(const n of this.host.game.bld.buildingGroups){this._buildings.push(new A(this,n.title));for(const r of n.buildings){if(r==="unicornPasture"||g(this.setting.buildings[r]))continue;const c=this.host.game.bld.getBuildingExt(r).meta;if(g(c.stages))g(c.label)||this._buildings.push(this._getResetOption(this,this.setting.buildings[r],i,t,c.label));else{const o=Object.values(this.setting.buildings).find(h=>h.baseBuilding===r)?.building;this._buildings.push(this._getResetOption(this,this.setting.buildings[r],i,t,c.stages[0].label),this._getResetOption(this,this.setting.buildings[o],i,t,c.stages[1].label,!1,!0))}}n!==this.host.game.bld.buildingGroups[this.host.game.bld.buildingGroups.length-1]&&this._buildings.at(-1)?.element.addClass(ge.delimiter)}const a=new _(this);a.addChildren(this._buildings),this.addChildContent(a)}_getResetOption(e,t,i,s,a,n=!1,r=!1){const c=new U(e,t,i,a,{delimiter:n,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[a])},onRefreshRequest:()=>{c.triggerButton.inactive=!t.enabled||t.trigger===0,c.triggerButton.ineffective=t.enabled&&t.trigger===-1},onSetTrigger:async()=>{const o=await x.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(o!==void 0){if(o===""||o.startsWith("-")){t.trigger=-1,t.enabled=!1;return}o==="0"&&(t.enabled=!1),t.trigger=Number(o)}},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[a])},upgradeIndicator:r});return c.triggerButton.element.addClass(w.lastHeadAction),c}}class Qr extends _e{constructor(e,t,i){const s=e.host.engine.i18n("ui.faith");super(e,s,t,{icon:M.Religion,onRefreshRequest:()=>{this.expando.ineffective=Object.values(t.buildings).some(n=>n.enabled&&n.trigger===-1)}}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]})]);const a=[...Ne];this.addChildContent(new _(this).addChildren([new A(this,this.host.engine.i18n("$religion.panel.ziggurat.label")),this._getResetOption(this,this.setting.buildings.unicornPasture,i,t,this.host.engine.i18n("$buildings.unicornPasture.label")),...this.host.game.religion.zigguratUpgrades.filter(n=>a.includes(n.name)&&!g(this.setting.buildings[n.name])).map(n=>this._getResetOption(this,this.setting.buildings[n.name],i,t,n.label)),new K(this),...this.host.game.religion.zigguratUpgrades.filter(n=>!a.includes(n.name)&&!g(this.setting.buildings[n.name])).map(n=>this._getResetOption(this,this.setting.buildings[n.name],i,t,n.label)),new K(this),new A(this,this.host.engine.i18n("$religion.panel.orderOfTheSun.label")),...this.host.game.religion.religionUpgrades.filter(n=>!g(this.setting.buildings[n.name])).map(n=>this._getResetOption(this,this.setting.buildings[n.name],i,t,n.label,n.name===this.host.game.religion.religionUpgrades.at(-1)?.name)),new A(this,this.host.engine.i18n("$religion.panel.cryptotheology.label")),...this.host.game.religion.transcendenceUpgrades.filter(n=>!g(this.setting.buildings[n.name])).map(n=>this._getResetOption(this,this.setting.buildings[n.name],i,t,n.label))]))}_getResetOption(e,t,i,s,a,n=!1,r=!1){const c=new U(e,t,i,a,{delimiter:n,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[a])},onRefreshRequest:()=>{c.triggerButton.inactive=!t.enabled||t.trigger===0,c.triggerButton.ineffective=t.enabled&&t.trigger===-1},onSetTrigger:async()=>{const o=await x.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(o!==void 0){if(o===""||o.startsWith("-")){t.trigger=-1,t.enabled=!1;return}o==="0"&&(t.enabled=!1),t.trigger=Number(o)}},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[a])},upgradeIndicator:r});return c.triggerButton.element.addClass(w.lastHeadAction),c}}class eo extends _e{constructor(e,t,i){const s=e.host.engine.i18n("ui.resources");super(e,s,t,{icon:M.Resources,onRefreshRequest:()=>{this.expando.ineffective=Object.values(t.resources).some(c=>c.enabled&&c.trigger===-1)}}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]})]);const a=this.host.game.resPool.resources,n=[];let r=a[0].title;for(const c of[...a].sort((o,h)=>o.title.localeCompare(h.title,i.selected))){const o=this.setting.resources[c.name],h=new U(this,o,i,W(c.title),{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[c.title])},onRefreshRequest:()=>{h.triggerButton.inactive=!o.enabled||o.trigger===0,h.triggerButton.ineffective=o.enabled&&o.trigger===-1},onSetTrigger:async()=>{const u=await x.prompt(this,this.host.engine.i18n("ui.trigger.prompt.float"),this.host.engine.i18n("ui.trigger.build.prompt",[c.title,o.trigger!==-1?this.host.renderAbsolute(o.trigger,i.selected):this.host.engine.i18n("ui.trigger.inactive")]),o.trigger!==-1?this.host.renderAbsolute(o.trigger):"",this.host.engine.i18n("ui.trigger.reset.promptExplainer"));if(u!==void 0){if(u===""||u.startsWith("-")){o.trigger=-1,o.enabled=!1;return}u==="0"&&(o.enabled=!1),o.trigger=e.host.parseAbsolute(u)??o.trigger}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[c.title])}});h.triggerButton.element.addClass(w.lastHeadAction),this.host.engine.localeSupportsFirstLetterSplits(i.selected)&&r[0]!==c.title[0]&&h.element.addClass(E.splitter),n.push(h),r=c.title}this.addChildContent(new _(this).addChildren(n))}}class to extends _e{constructor(e,t,i){const s=e.host.engine.i18n("ui.space");super(e,s,t,{icon:M.Space,onRefreshRequest:()=>{this.expando.ineffective=Object.values(t.buildings).some(a=>a.enabled&&a.trigger===-1)}}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]})]),this.addChildContent(new _(this).addChildren(this.host.game.space.planets.filter(a=>0<a.buildings.length).flatMap((a,n,r)=>[new A(this,this.host.engine.labelForPlanet(a.name)),...a.buildings.filter(c=>!g(this.setting.buildings[c.name])).map((c,o,h)=>this._getResetOption(this,this.setting.buildings[c.name],i,t,c.label,n<r.length-1&&o===h.length-1))])))}_getResetOption(e,t,i,s,a,n=!1,r=!1){const c=new U(e,t,i,a,{delimiter:n,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[a])},onRefreshRequest:()=>{c.triggerButton.inactive=!t.enabled||t.trigger===0,c.triggerButton.ineffective=t.enabled&&t.trigger===-1},onSetTrigger:async()=>{const o=await x.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(o!==void 0){if(o===""||o.startsWith("-")){t.trigger=-1,t.enabled=!1;return}o==="0"&&(t.enabled=!1),t.trigger=Number(o)}},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[a])},upgradeIndicator:r});return c.triggerButton.element.addClass(w.lastHeadAction),c}}class io extends _e{constructor(e,t,i){const s=e.host.engine.i18n("ui.time");super(e,s,t,{icon:M.Time,onRefreshRequest:()=>{this.expando.ineffective=Object.values(t.buildings).some(a=>a.enabled&&a.trigger===-1)}}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]})]),this.addChildContent(new _(this).addChildren([new A(this,this.host.engine.i18n("$workshop.chronoforge.label")),...this.host.game.time.chronoforgeUpgrades.filter(a=>!g(this.setting.buildings[a.name])).map(a=>this._getResetOption(this,this.setting.buildings[a.name],i,t,a.label,a.name===this.host.game.time.chronoforgeUpgrades.at(-1)?.name)),new A(this,this.host.engine.i18n("$science.voidSpace.label")),...this.host.game.time.voidspaceUpgrades.filter(a=>a.name in this.setting.buildings).map(a=>this._getResetOption(this,this.setting.buildings[a.name],i,t,a.label))]))}_getResetOption(e,t,i,s,a,n=!1,r=!1){const c=new U(e,t,i,a,{delimiter:n,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[a])},onRefreshRequest:()=>{c.triggerButton.inactive=!t.enabled||t.trigger===0,c.triggerButton.ineffective=t.enabled&&t.trigger===-1},onSetTrigger:async()=>{const o=await x.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(o!==void 0){if(o===""||o.startsWith("-")){t.trigger=-1,t.enabled=!1;return}o==="0"&&(t.enabled=!1),t.trigger=Number(o)}},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[a])},upgradeIndicator:r});return c.triggerButton.element.addClass(w.lastHeadAction),c}}class so extends _e{constructor(e,t,i){const s=e.host.engine.i18n("ui.upgrades");super(e,s,t,{icon:M.Workshop}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]})]);const a=this.host.game.workshop.upgrades.filter(o=>!g(this.setting.upgrades[o.name])),n=[];let r=a[0].label,c;for(const o of a.sort((h,u)=>h.label.localeCompare(u.label,i.selected))){const h=this.setting.upgrades[o.name],u=this._getResetOption(this,h,o.label);this.host.engine.localeSupportsFirstLetterSplits(i.selected)&&r[0]!==o.label[0]&&(g(c)||c.element.addClass(ge.delimiter),u.element.addClass(E.splitter)),c=u,n.push(u),r=o.label}this.addChildContent(new _(this).addChildren(n))}_getResetOption(e,t,i,s=!1,a=!1){return new k(e,t,i,{delimiter:s,onCheck:()=>{e.host.engine.imessage("status.reset.check.enable",[i])},onUnCheck:()=>{e.host.engine.imessage("status.reset.check.disable",[i])},upgradeIndicator:a})}}class no extends I{_bonfireUi;_religionUi;_resourcesUi;_spaceUi;_timeUi;_upgradesUi;constructor(e,t,i){const s=e.host.engine.i18n("option.time.reset");super(e,t,new k(e,t,s,{onCheck:n=>{e.host.engine.imessage("status.auto.enable",[s])},onUnCheck:n=>{e.host.engine.imessage("status.auto.disable",[s])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&([this._bonfireUi,this._religionUi,this._resourcesUi,this._spaceUi,this._timeUi,this._upgradesUi].some(n=>n.expando.ineffective)||!Object.values(this.setting.bonfire.buildings).some(n=>n.enabled)&&!Object.values(this.setting.religion.buildings).some(n=>n.enabled)&&!Object.values(this.setting.resources.resources).some(n=>n.enabled)&&!Object.values(this.setting.space.buildings).some(n=>n.enabled)&&!Object.values(this.setting.time.buildings).some(n=>n.enabled)&&!Object.values(this.setting.upgrades.upgrades).some(n=>n.enabled))}});const a=new _(this,{hasDisableAll:!1,hasEnableAll:!1});this._bonfireUi=new Yr(this,this.setting.bonfire,i),this._religionUi=new Qr(this,this.setting.religion,i),this._resourcesUi=new eo(this,this.setting.resources,i),this._spaceUi=new to(this,this.setting.space,i),this._timeUi=new io(this,this.setting.time,i),this._upgradesUi=new so(this,this.setting.upgrades,i),a.addChildren([this._bonfireUi,this._religionUi,this._resourcesUi,this._spaceUi,this._timeUi,this._upgradesUi]),this.addChildContent(a)}}class Xi extends _{setting;constructor(e,t,i){super(e,i),this.setting=t;const s=(n,r)=>{const c=e.host.engine.labelForCycle(n);return new k(e,r,c,{onCheck:o=>{i?.onCheckCycle?.(c,r,o)},onUnCheck:o=>{i?.onUnCheckCycle?.(c,r,o)}})},a=[s("charon",this.setting.charon),s("umbra",this.setting.umbra),s("yarn",this.setting.yarn),s("helios",this.setting.helios),s("cath",this.setting.cath),s("redmoon",this.setting.redmoon),s("dune",this.setting.dune),s("piscine",this.setting.piscine),s("terminus",this.setting.terminus),s("kairo",this.setting.kairo)];this.addChildren(a),this.element[0].addEventListener("enableAll",()=>{for(const n of a)n.check(!0)}),this.element[0].addEventListener("disableAll",()=>{for(const n of a)n.uncheck(!0)})}}class tt extends _{setting;spring;summer;autumn;winter;constructor(e,t,i){super(e,i),this.setting=t;const s=(a,n)=>new k(this,n,a,{onCheck:r=>{i?.onCheckSeason?.(a,n,r)},onUnCheck:r=>{i?.onUnCheckSeason?.(a,n,r)}});this.spring=s(this.host.engine.i18n("$calendar.season.spring"),this.setting.spring),this.summer=s(this.host.engine.i18n("$calendar.season.summer"),this.setting.summer),this.autumn=s(this.host.engine.i18n("$calendar.season.autumn"),this.setting.autumn),this.winter=s(this.host.engine.i18n("$calendar.season.winter"),this.setting.winter),this.addChildren([this.spring,this.summer,this.autumn,this.winter])}toString(){return`[${tt.name}#${this.componentId}]`}}class ao extends I{constructor(e,t,i,s,a){const n=e.host.engine.i18n("option.time.activeHeatTransfer");super(e,t,new U(e,t,i,n,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[n])},onSetTrigger:async()=>{const r=await x.prompt(e,e.host.engine.i18n("ui.trigger.activeHeatTransfer.prompt"),e.host.engine.i18n("ui.trigger.activeHeatTransfer.promptTitle",[e.host.renderPercentage(t.trigger,i.selected,!0)]),e.host.renderPercentage(t.trigger),e.host.engine.i18n("ui.trigger.activeHeatTransfer.promptExplainer"));r===void 0||r===""||r.startsWith("-")||(t.trigger=e.host.parsePercentage(r))},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[n]),t.activeHeatTransferStatus.enabled=!1}}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled,this.settingItem.triggerButton.ineffective=a.enabled&&s.enabled&&t.enabled&&t.trigger===-1,this.expando.ineffective=a.enabled&&s.enabled&&t.enabled&&!Object.values(t.cycles).some(r=>r.enabled),t.activeHeatTransferStatus.enabled?(this.head.elementLabel.attr("data-ks-active-from","◎"),this.head.elementLabel.attr("data-ks-active-to","◎"),this.head.elementLabel.addClass(Je.active)):this.head.elementLabel.removeClass(Je.active)}}),this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new Xi(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 ro extends I{_cycles;_seasons;_activeHeatTransferUI;constructor(e,t,i,s){const a=e.host.engine.i18n("option.time.skip");super(e,t,new je(e,t,i,a,{onCheck:n=>{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 n=await x.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(n!==void 0){if(n===""||n.startsWith("-")){t.max=-1;return}n==="0"&&(t.enabled=!1),t.max=e.host.parseAbsolute(n)??t.max}},onSetTrigger:async()=>{const n=await x.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"));n===void 0||n===""||n.startsWith("-")||(t.trigger=e.host.parseAbsolute(n)??t.trigger)},onUnCheck:n=>{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=s.enabled&&t.enabled&&t.max===0,this._cycles.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.cycles).some(n=>n.enabled),this._seasons.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.seasons).some(n=>n.enabled)}}),this.settingItem.triggerButton.element.removeClass(w.lastHeadAction),this._cycles=new me(this,new ne(this,W(this.host.engine.i18n("ui.cycles")),{classes:[B.checked,B.setting],icon:M.Cycles}).addChildrenHead([new T(this,{classes:[E.fillSpace]})])).addChildrenContent([new Xi(this,this.setting.cycles,{onCheckCycle:n=>{this.host.engine.imessage("time.skip.cycle.enable",[n])},onUnCheckCycle:n=>{this.host.engine.imessage("time.skip.cycle.disable",[n])}})]),this._seasons=new me(this,new ne(this,W(this.host.engine.i18n("trade.seasons")),{classes:[B.checked,B.setting],icon:M.Seasons}).addChildrenHead([new T(this,{classes:[E.fillSpace]})])).addChildrenContent([new tt(this,this.setting.seasons,{onCheckSeason:n=>{this.host.engine.imessage("time.skip.season.enable",[n])},onUnCheckSeason:n=>{this.host.engine.imessage("time.skip.season.disable",[n])}})]),this._activeHeatTransferUI=new ao(this,this.setting.activeHeatTransfer,i,t,s),this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([this._cycles,this._seasons,new k(this,this.setting.ignoreOverheat,this.host.engine.i18n("option.time.skip.ignoreOverheat")),this._activeHeatTransferUI]))}}class Ft extends I{_items;_accelerateTime;_timeSkipUi;_resetUi;constructor(e,t,i){console.debug(...f(`Constructing ${Ft.name}`));const s=e.host.engine.i18n("ui.timeCtrl");super(e,t,new k(e,t,s,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[s])},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[s])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&[this._timeSkipUi,this._resetUi].some(r=>r.expando.ineffective)}});const a=new _(this,{hasDisableAll:!1,hasEnableAll:!1}),n=this.host.engine.i18n("option.accelerate");this._accelerateTime=new U(this,this.setting.accelerateTime,i,n,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[n])},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 r=await x.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"));r===void 0||r===""||r.startsWith("-")||(this.setting.accelerateTime.trigger=this.host.parsePercentage(r))},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[n])}}),this._accelerateTime.triggerButton.element.addClass(w.lastHeadAction),this._timeSkipUi=new ro(this,this.setting.timeSkip,i,t),this._resetUi=new no(this,this.setting.reset,i),this._items=[this._accelerateTime,this._timeSkipUi,this._resetUi],a.addChildren(this._items),this.addChildContent(a)}}class Wt extends I{constructor(e,t,i){console.debug(...f(`Constructing ${Wt.name}`));const s=e.host.engine.i18n("ui.time");super(e,t,new U(e,t,i,s,{onCheck:a=>{e.host.engine.imessage("status.auto.enable",[s])},onRefresh:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1},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 a=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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(a!==void 0){if(a===""||a.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(a)}},onUnCheck:a=>{e.host.engine.imessage("status.auto.disable",[s])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger<0,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger<0&&Object.values(t.buildings).some(a=>a.enabled&&0<a.max&&a.trigger<0),this.expando.ineffective=t.enabled&&Object.values(t.buildings).some(a=>a.enabled&&(a.max===0||a.trigger<0&&t.trigger<0))}}),this.addChildrenContent([new _(this).addChildren([new A(this,this.host.engine.i18n("$workshop.chronoforge.label")),...this.host.game.time.chronoforgeUpgrades.filter(a=>!g(this.setting.buildings[a.name])).map(a=>te.getBuildOption(this,this.setting.buildings[a.name],i,this.setting,a.label,s,{delimiter:a.name===this.host.game.time.chronoforgeUpgrades.at(-1)?.name,renderLabelTrigger:!1})),new A(this,this.host.engine.i18n("$science.voidSpace.label")),...this.host.game.time.voidspaceUpgrades.filter(a=>a.name in this.setting.buildings).map(a=>te.getBuildOption(this,this.setting.buildings[a.name],i,this.setting,a.label,s,{renderLabelTrigger:!1}))]),new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new A(this,this.host.engine.i18n("ui.additional")),new k(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 oo={buyButton:"_buyButton_10eul_1"};class Gt extends fe{setting;constructor(e,t,i,s){super(e,void 0,{onClick:async()=>{const a=await x.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:()=>{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)])),s?.onRefresh?.call(this)}}),this.element.addClass(oo.buyButton),this.setting=t}toString(){return`[${Gt.name}#${this.componentId}]`}}const lo={sellButton:"_sellButton_1tmvd_1"};class Zt extends fe{setting;constructor(e,t,i,s){super(e,void 0,{onClick:async()=>{const a=await x.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:()=>{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)])),s?.onRefresh?.()}}),this.element.addClass(lo.sellButton),this.setting=t}toString(){return`[${Zt.name}#${this.componentId}]`}}class it extends F{setting;constructor(e,t,i){super(e,"",M.Eco,{border:!1,classes:[],onClick:()=>{this.setting.limited=!this.setting.limited,this.setting.limited?i?.onLimitedCheck?.call(this):i?.onLimitedUnCheck?.call(this)},onRefresh:()=>{this.updateTitle(this.host.engine.i18n(this.setting.limited?"ui.limited.on":"ui.limited.off")),this.setting.limited&&!this.inactive?this.element.removeClass(w.inactive):this.element.addClass(w.inactive),i?.onRefresh?.call(this)}}),this.setting=t;for(const s of i?.classes??[])this.element.addClass(s)}toString(){return`[${it.name}#${this.componentId}]`}}class Kt extends k{limitedButton;constructor(e,t,i,s){super(e,t,i,s),this.limitedButton=new it(e,t,{border:!1,onLimitedCheck:s?.onLimitedCheck?()=>s.onLimitedCheck?.call(this):void 0,onLimitedUnCheck:s?.onLimitedUnCheck?()=>s.onLimitedUnCheck?.call(this):void 0}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.limitedButton])}toString(){return`[${Kt.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class Vt extends Kt{triggerButton;constructor(e,t,i,s,a){super(e,t,s,a),this.triggerButton=new ke(e,t,i,{border:!1,onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a?.onRefreshTrigger?()=>a.onRefreshTrigger?.call(this):void 0,renderLabel:a?.renderLabelTrigger??!0}),this.addChildHead(this.triggerButton)}toString(){return`[${Vt.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class st extends k{maxButton;constructor(e,t,i,s){super(e,t,i,s),this.maxButton=new Ee(e,t,{border:!1,onClick:async()=>{await s.onSetMax.call(this)},onRefresh:s?.onRefreshMax?()=>s.onRefreshMax?.call(this):void 0}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.maxButton])}toString(){return`[${st.name}#${this.componentId}]: \'${this.elementLabel.text()}\'`}}class co extends I{constructor(e,t,i,s){const a=e.host.engine.i18n("option.embassies");super(e,t,new U(e,t,i,a,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[a])},onSetTrigger:async()=>{const r=await x.prompt(e,e.host.engine.i18n("ui.trigger.embassies.prompt"),e.host.engine.i18n("ui.trigger.embassies.promptTitle",[e.host.renderPercentage(t.trigger,i.selected,!0)]),e.host.renderPercentage(t.trigger),e.host.engine.i18n("ui.trigger.embassies.promptExplainer"));r===void 0||r===""||r.startsWith("-")||(t.trigger=e.host.parsePercentage(r))},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[a])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger===-1,this.expando.ineffective=s.enabled&&t.enabled&&!Object.values(t.races).some(r=>r.enabled)}});const n=new _(this).addChildren(this.host.game.diplomacy.races.filter(r=>r.name!=="leviathans"&&!g(this.setting.races[r.name])).map(r=>this._makeEmbassySetting(this,this.setting.races[r.name],i.selected,t,r.title)));this.addChildContent(n)}_makeEmbassySetting(e,t,i,s,a){const n=async()=>{const c=await x.prompt(e,e.host.engine.i18n("ui.max.prompt.absolute"),e.host.engine.i18n("ui.max.build.prompt",[a,e.host.renderAbsolute(t.max,i)]),e.host.renderAbsolute(t.max),e.host.engine.i18n("ui.max.build.promptExplainer"));if(c!==void 0){if(c===""||c.startsWith("-")){t.max=-1;return}c==="0"&&(t.enabled=!1),t.max=e.host.parseAbsolute(c)??t.max}},r=new st(e,t,a,{onCheck:c=>{if(e.host.engine.imessage("status.sub.enable",[a]),t.max===0&&!c)return n()},onRefresh:()=>{r.maxButton.inactive=!t.enabled||t.max===-1,r.maxButton.ineffective=s.enabled&&t.enabled&&t.max===0},onRefreshMax:()=>{r.maxButton.updateLabel(e.host.renderAbsolute(t.max)),r.maxButton.element[0].title=t.max<0?e.host.engine.i18n("ui.max.embassy.titleInfinite",[a]):t.max===0?e.host.engine.i18n("ui.max.embassy.titleZero",[a]):e.host.engine.i18n("ui.max.embassy.title",[e.host.renderAbsolute(t.max),a])},onSetMax:n,onUnCheck:()=>{e.host.engine.imessage("status.sub.disable",[a])}});return r.maxButton.element.addClass(w.lastHeadAction),r}}class jt extends I{_racePanels;constructor(e,t,i){console.debug(...f(`Constructing ${jt.name}`));const s=e.host.engine.i18n("ui.trade");super(e,t,new U(e,t,i,s,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[s])},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 x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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",[s])},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(r=>r.enabled&&r.trigger<0),this.expando.ineffective=t.enabled&&Object.values(this._racePanels).some(r=>r.expando.ineffective||r.settingItem.triggerButton.ineffective)}}),this._racePanels=this.host.game.diplomacy.races.filter(r=>!g(this.setting.races[r.name])).map(r=>this._getTradeOption(this,this.setting.races[r.name],i,t,r.title,s,r.name===this.host.game.diplomacy.races.at(-2)?.name));const a=new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren(this._racePanels);a.addChild(new k(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 I(this,this.setting.tradeBlackcoin,new U(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 r=await x.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"));r===void 0||r===""||r.startsWith("-")||(this.setting.tradeBlackcoin.trigger=this.host.parseAbsolute(r)??this.setting.tradeBlackcoin.trigger)},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.crypto")])}})).addChildrenContent([new Gt(this,this.setting.tradeBlackcoin,i),new Zt(this,this.setting.tradeBlackcoin,i)])),this.addChildContent(a);const n=new _(this,{hasDisableAll:!1,hasEnableAll:!1});n.addChild(new A(this,this.host.engine.i18n("ui.additional"))),n.addChild(new co(this,this.setting.buildEmbassies,i,t)),n.addChild(new k(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(n)}_getTradeOption(e,t,i,s,a,n,r=!1,c=!1){const o=new Vt(e,t,i,a,{delimiter:r,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:()=>{o.triggerButton.element[0].title=e.host.engine.i18n("ui.trigger",[t.trigger<0?s.trigger<0?e.host.engine.i18n("ui.trigger.section.blocked",[n]):`${e.host.renderPercentage(s.trigger,i.selected,!0)} (${e.host.engine.i18n("ui.trigger.section.inherited")})`:e.host.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const u=await x.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(u!==void 0){if(u===""||u.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(u)}},onUnCheck:()=>{e.host.engine.imessage("status.sub.disable",[a])},renderLabelTrigger:!1,upgradeIndicator:c}),h=new I(e,t,o,{onRefreshRequest:()=>{o.limitedButton.inactive=!t.enabled||!t.limited,o.triggerButton.inactive=!t.enabled||t.trigger===-1,o.triggerButton.ineffective=s.enabled&&t.enabled&&s.trigger===-1&&t.trigger===-1,h.expando.ineffective=s.enabled&&t.enabled&&!t.seasons.autumn.enabled&&!t.seasons.spring.enabled&&!t.seasons.summer.enabled&&!t.seasons.winter.enabled}}).addChildContent(new tt(e,t.seasons,{onCheckSeason:u=>{e.host.engine.imessage("trade.season.enable",[W(a),u])},onUnCheckSeason:u=>{e.host.engine.imessage("trade.season.disable",[W(a),u])}}));return h}}const Jt={spacer:"_spacer_90nk2_45",ui:"_ui_90nk2_50",showActivity:"_showActivity_90nk2_67"};class Xt extends I{_hunt;_festivals;_promoteKittens;_promoteLeader;_electLeader;constructor(e,t,i){console.debug(...f(`Constructing ${Xt.name}`));const s=e.host.engine.i18n("ui.distribute");super(e,t,new k(e,t,s,{onCheck:r=>{e.host.engine.imessage("status.auto.enable",[s])},onUnCheck:r=>{e.host.engine.imessage("status.auto.disable",[s])}}).addChildrenHead([new T(e,{classes:[E.fillSpace]})]),{onRefreshRequest:()=>{this.expando.ineffective=t.enabled&&Object.values(t.jobs).some(r=>r.enabled&&r.max===0)}});const a=new _(this).addChildren(this.host.game.village.jobs.filter(r=>!g(this.setting.jobs[r.name])).map(r=>this._getDistributeOption(this.setting.jobs[r.name],i.selected,t,r.title)));this.addChildContent(a);const n=new _(this,{hasDisableAll:!1,hasEnableAll:!1});n.addChild(new A(this,this.host.engine.i18n("ui.additional"))),this._hunt=new U(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 r=await x.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"));r===void 0||r===""||r.startsWith("-")||(this.setting.hunt.trigger=this.host.parsePercentage(r))},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.hunt")])}}),this._hunt.triggerButton.element.addClass(w.lastHeadAction),n.addChild(this._hunt),this._festivals=new k(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")])}}),n.addChild(this._festivals),this._promoteKittens=new U(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 r=await x.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"));r===void 0||r===""||r.startsWith("-")||(this.setting.promoteKittens.trigger=this.host.parsePercentage(r))},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[this.host.engine.i18n("option.promotekittens")])}}),this._promoteKittens.triggerButton.element.addClass(w.lastHeadAction),n.addChild(this._promoteKittens),this._promoteLeader=new k(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")])}}),n.addChild(this._promoteLeader);for(const r of this.setting.electLeader.job.options)r.value==="any"?r.label=this.host.engine.i18n("option.elect.job.any"):r.label=this.host.engine.i18n(`$village.job.${r.value}`);for(const r of this.setting.electLeader.trait.options)r.label=this.host.engine.i18n(`$village.trait.${r.value}`);this._electLeader=new k(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 Me(this,this.host.engine.i18n("option.elect.job"),this.setting.electLeader.job),new Me(this,this.host.engine.i18n("option.elect.trait"),this.setting.electLeader.trait)]),n.addChild(this._electLeader),this.addChildContent(n)}_getDistributeOption(e,t,i,s,a=!1){const n=async()=>{const c=await x.prompt(this,this.host.engine.i18n("ui.max.distribute.prompt",[s]),this.host.engine.i18n("ui.max.distribute.promptTitle",[s,this.host.renderAbsolute(e.max,t)]),this.host.renderAbsolute(e.max),this.host.engine.i18n("ui.max.distribute.promptExplainer"));if(c!==void 0){if(c===""||c.startsWith("-")){e.max=-1;return}c==="0"&&(e.enabled=!1),e.max=this.host.parseAbsolute(c)??e.max}},r=new st(this,e,s,{delimiter:a,onCheck:c=>{if(this.host.engine.imessage("status.sub.enable",[s]),e.max===0&&!c)return n()},onRefresh:()=>{r.maxButton.inactive=!e.enabled||e.max===-1,r.maxButton.ineffective=i.enabled&&e.enabled&&e.max===0},onRefreshMax:()=>{r.maxButton.updateLabel(this.host.renderAbsolute(e.max)),r.maxButton.element[0].title=e.max<0?this.host.engine.i18n("ui.max.distribute.titleInfinite",[s]):e.max===0?this.host.engine.i18n("ui.max.distribute.titleZero",[s]):this.host.engine.i18n("ui.max.distribute.title",[this.host.renderAbsolute(e.max),s])},onSetMax:n,onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[s])}});return r.maxButton.element.addClass(w.lastHeadAction),r}}class Yt extends k{limitedButton;maxButton;triggerButton;constructor(e,t,i,s,a){super(e,t,s,a),this.limitedButton=new it(e,t,{...a,classes:[Ge.headAction]}),this.maxButton=new Ee(e,t,{alignment:"right",border:!1,classes:[w.headAction],onClick:()=>a.onSetMax.call(this),onRefresh:a?.onRefreshMax?()=>a.onRefreshMax?.call(this):void 0}),this.triggerButton=new ke(e,t,i,{border:!1,classes:[w.lastHeadAction],onClick:async()=>{await a.onSetTrigger.call(this)},onRefresh:a?.onRefreshTrigger?()=>a.onRefreshTrigger?.call(this):void 0,renderLabel:a?.renderLabelTrigger??!0}),this.addChildrenHead([new T(e,{classes:[E.fillSpace]}),this.limitedButton,this.maxButton,this.triggerButton])}toString(){return`[${Yt.name}#${this.componentId}]`}}class ho extends I{constructor(e,t,i){const s=e.host.engine.i18n("ui.upgrade.upgrades");super(e,t,new U(e,t,i,s,{onCheck:o=>{e.host.engine.imessage("status.auto.enable",[s])},onRefreshTrigger(){this.triggerButton.element[0].title=e.host.engine.i18n("ui.trigger",[t.trigger===-1?e.host.engine.i18n("ui.trigger.section.inactive"):e.host.renderPercentage(t.trigger,i.selected,!0)])},onSetTrigger:async()=>{const o=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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",[s])},renderLabelTrigger:!1}),{onRefreshRequest:()=>{this.settingItem.triggerButton.inactive=!t.enabled||t.trigger===-1,this.settingItem.triggerButton.ineffective=t.enabled&&t.trigger<0&&Object.values(t.upgrades).some(o=>o.enabled&&o.trigger<0),this.expando.ineffective=t.enabled&&!Object.values(t.upgrades).some(o=>o.enabled)}});const a=this.host.game.workshop.upgrades.filter(o=>!g(this.setting.upgrades[o.name])),n=[];let r=a[0].label,c;for(const o of a.sort((h,u)=>h.label.localeCompare(u.label,i.selected))){const h=this.setting.upgrades[o.name],u=new U(this,h,i,o.label,{onCheck:()=>{this.host.engine.imessage("status.sub.enable",[o.label])},onRefreshRequest:()=>{u.triggerButton.inactive=!h.enabled||h.trigger===-1,u.triggerButton.ineffective=t.enabled&&h.enabled&&t.trigger===-1&&h.trigger===-1},onRefreshTrigger:()=>{u.triggerButton.element[0].title=this.host.engine.i18n("ui.trigger",[h.trigger<0?t.trigger<0?this.host.engine.i18n("ui.trigger.build.blocked",[s]):`${this.host.renderPercentage(t.trigger,i.selected,!0)} (${this.host.engine.i18n("ui.trigger.section.inherited")})`:this.host.renderPercentage(h.trigger,i.selected,!0)])},onSetTrigger:async()=>{const d=await x.prompt(this,this.host.engine.i18n("ui.trigger.prompt.percentage"),this.host.engine.i18n("ui.trigger.section.prompt",[s,h.trigger!==-1?this.host.renderPercentage(h.trigger,i.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(d!==void 0){if(d===""||d.startsWith("-")){h.trigger=-1;return}h.trigger=this.host.parsePercentage(d)}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o.label])},renderLabelTrigger:!1});u.triggerButton.element.addClass(w.lastHeadAction),this.host.engine.localeSupportsFirstLetterSplits(i.selected)&&r[0]!==o.label[0]&&(g(c)||c.element.addClass(ge.delimiter),u.element.addClass(E.splitter)),c=u,n.push(u),r=o.label}this.addChildContent(new _(this).addChildren(n))}}class Qt extends I{_crafts;constructor(e,t,i){console.debug(...f(`Constructing ${Qt.name}`));const s=e.host.engine.i18n("ui.craft");super(e,t,new U(e,t,i,s,{onCheck:c=>{e.host.engine.imessage("status.auto.enable",[s])},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 c=await x.prompt(e,e.host.engine.i18n("ui.trigger.prompt.percentage"),e.host.engine.i18n("ui.trigger.section.prompt",[s,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(c!==void 0){if(c===""||c.startsWith("-")){t.trigger=-1;return}t.trigger=e.host.parsePercentage(c)}},onUnCheck:c=>{e.host.engine.imessage("status.auto.disable",[s])},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(c=>c.enabled&&c.max!==0&&c.trigger<0)}});let a=[];game.challenges.getChallenge("ironWill").active||(this.setting.resources.bloodstone.enabled=!1,this.setting.resources.tMythril.enabled=!1,a=["bloodstone","tMythril"]);const n=this.host.game.workshop.crafts.filter(c=>!a.includes(c.name)&&!g(this.setting.resources[c.name])).map(c=>[this.setting.resources[c.name],W(c.label)]);this._crafts=[];for(const[c,o]of n){const h=async()=>{const d=await x.prompt(this,this.host.engine.i18n("ui.max.craft.prompt",[o]),this.host.engine.i18n("ui.max.craft.promptTitle",[o,this.host.renderAbsolute(c.max,i.selected)]),this.host.renderAbsolute(c.max),this.host.engine.i18n("ui.max.craft.promptExplainer"));if(d!==void 0){if(d===""||d.startsWith("-")){c.max=-1;return}d==="0"&&(c.enabled=!1),c.max=this.host.parseAbsolute(d)??c.max}},u=new Yt(this,c,i,o,{delimiter:c.resource==="kerosene"||c.resource==="blueprint",onCheck:d=>{if(this.host.engine.imessage("status.sub.enable",[o]),c.max===0&&!d)return h()},onLimitedCheck:()=>{this.host.engine.imessage("craft.limited",[o])},onLimitedUnCheck:()=>{this.host.engine.imessage("craft.unlimited",[o])},onRefreshMax:()=>{u.maxButton.updateLabel(this.host.renderAbsolute(c.max)),u.maxButton.element[0].title=c.max<0?this.host.engine.i18n("ui.max.craft.titleInfinite",[o]):c.max===0?this.host.engine.i18n("ui.max.craft.titleZero",[o]):this.host.engine.i18n("ui.max.craft.title",[this.host.renderAbsolute(c.max),o])},onRefreshRequest:()=>{u.limitedButton.inactive=!c.enabled||!c.limited,u.maxButton.inactive=!c.enabled||c.max===-1,u.maxButton.ineffective=t.enabled&&c.enabled&&c.max===0,u.triggerButton.inactive=!c.enabled||c.trigger===-1,u.triggerButton.ineffective=t.enabled&&c.enabled&&t.trigger===-1&&c.trigger===-1},onRefreshTrigger:()=>{u.triggerButton.element[0].title=this.host.engine.i18n("ui.trigger",[c.trigger<0?t.trigger<0?this.host.engine.i18n("ui.trigger.build.blocked",[o]):`${this.host.renderPercentage(t.trigger,i.selected,!0)} (${this.host.engine.i18n("ui.trigger.build.inherited")})`:this.host.renderPercentage(c.trigger,i.selected,!0)])},onSetMax:h,onSetTrigger:async()=>{const d=await x.prompt(this,this.host.engine.i18n("ui.trigger.prompt.percentage"),this.host.engine.i18n("ui.trigger.section.prompt",[o,c.trigger!==-1?this.host.renderPercentage(c.trigger,i.selected,!0):this.host.engine.i18n("ui.trigger.build.inherited")]),c.trigger!==-1?this.host.renderPercentage(c.trigger):"",this.host.engine.i18n("ui.trigger.build.promptExplainer"));if(d!==void 0){if(d===""||d.startsWith("-")){c.trigger=-1;return}c.trigger=this.host.parsePercentage(d)}},onUnCheck:()=>{this.host.engine.imessage("status.sub.disable",[o])},renderLabelTrigger:!1});this._crafts.push(u),c.resource==="ship"&&this._crafts.push(new k(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 r=new _(this,{onReset:()=>{this.setting.load({resources:new Fe().resources})}}).addChildren(this._crafts);this.addChildContent(r),this.addChildContent(new _(this,{hasDisableAll:!1,hasEnableAll:!1}).addChildren([new ho(this,this.setting.unlockUpgrades,i)]))}}class Ae extends D{showActivity;_engineUi;_sections;stateManagementUi;_refreshTimeout;constructor(e){console.debug(...f(`Constructing ${Ae.name}`)),super({host:e},{});const t=e.engine;this._engineUi=new Sn(this,t.settings),this.stateManagementUi=new Ht(this,t.settings.states,t.settings.locale),this._sections=[new Tt(this,t.bonfireManager.settings,t.settings.locale),new Xt(this,t.villageManager.settings,t.settings.locale),new Ut(this,t.scienceManager.settings,t.settings.locale),new Qt(this,t.workshopManager.settings,t.settings.locale),new Ot(this,t.settings.resources,t.settings.locale),new jt(this,t.tradeManager.settings,t.settings.locale),new It(this,t.religionManager.settings,t.settings.locale),new Dt(this,t.spaceManager.settings,t.settings.locale),new Wt(this,t.timeManager.settings,t.settings.locale),new Ft(this,t.timeControlManager.settings,t.settings.locale),new Bt(this,t.settings.filters),this.stateManagementUi,new At(this,t.settings,t.settings.locale)],this.parent=this,this.element=$("<div/>").addClass("kitten-scientists").addClass(Jt.ui);for(const o of[this._engineUi,...this._sections])this.addChild(o);const i=$("<ul/>");i.append(this._engineUi.element);for(const o of this._sections)i.append(o.element);this.element.append(i);const s=this._engineUi.expando;let a=!1;s.element.on("click",()=>{a=!a;for(const o of this._sections)o.toggle(a,!0)});let n=0;for(const o of this._sections)o.element[0].addEventListener("panelHidden",()=>{--n,n===0&&(a=!1),a||s.setCollapsed()}),o.element[0].addEventListener("panelShown",()=>{++n,a=!0,s.setExpanded()});this.showActivity=$("<span/>",{html:`<svg style="width: 18px; height: 18px;" viewBox="0 -960 960 960" fill="currentColor"><path d="${M.Summary}"/></svg>`,title:e.engine.i18n("summary.show")}).addClass(Jt.showActivity),this.showActivity.on("click",()=>{e.engine.displayActivitySummary()}),$("#clearLog").prepend(this.showActivity);const r=t.settings.ksColumn.enabled&&game.colorScheme!=="sleek";r?$("#rightColumn").after(`<div id="ksColumn" class="column"><span class="${Jt.spacer}"></span></div>`):$("#ksColumn").remove();const c=$(r?"#ksColumn":"#rightColumn");if(c.length===0){const o=$("#optionsPage .full-screen-position .page .page-content");o.length===0?console.warn(...f("Unable to find right column to inject UI into. Running headless.")):(o.append(this.element),this.element.attr("style","border-top:1px solid grey; padding:15px"))}else c.prepend(this.element);this.element=this.element,this._needsRefresh=!1}toString(){return`[${Ae.name}#${this.componentId}]`}destroy(){this._refreshTimeout!==void 0&&(C.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(...f("User interface claims to have a refresh pending, but there isn\'t."));return}this._refreshTimeout=C.window.setTimeout(()=>{const[s,a]=X(()=>this.refresh());console.info(...f(`UI refresh took ${wn(a)}.`)),this._refreshTimeout=void 0},0),super.requestRefresh(!0,t,!1)}forceFullRefresh(){console.debug(...f("Forcing refresh on all user interface components...")),this.requestRefresh(),console.debug(...f("Refresh on all user interface components enforced."))}}const Pe=(l="")=>{if(g("2.0.0-beta.12-live"))throw Error("Build error: RELEASE_VERSION is not defined.");return`${l}2.0.0-beta.12-live`};class ae{game;i18nEngine;_userInterface;engine;_gameBeforeSaveHandle;_serverLoadHandle;constructor(e,t,i="en",s){console.info(...f(`Kitten Scientists ${Pe("v")} constructed. Checking for previous instances...`)),"kittenScientists"in C.window&&(console.warn(...f("Detected existing KS instance. Trying to unload it...")),C.window.kittenScientists?.unload()),console.info(...f("You are on the \'fixed\' release channel.")),this.game=e,this.i18nEngine=t;try{this.engine=new ee(this,i),this._userInterface=new Ae(this)}catch(a){throw console.error(...f("Failed to construct core components.",a)),a}g(s)?this._userInterface.stateManagementUi.loadAutoSave():this.setSettings(s)}rebuildUi(){this._userInterface.destroy(),this._userInterface=new Ae(this),this._userInterface.forceFullRefresh()}validateGame(){St.validateGame(this.game,this.engine.scienceManager.settings),He.validateGame(this.game,this.engine.spaceManager.settings),Fe.validateGame(this.game,this.engine.workshopManager.settings)}unload(){console.warn(...f("Unloading Kitten Scientists...")),this.engine.stop(),this._userInterface.destroy(),$("#ks-styles").remove(),this._gameBeforeSaveHandle!==void 0&&(C.window.dojo.unsubscribe(this._gameBeforeSaveHandle),this._gameBeforeSaveHandle=void 0),this._serverLoadHandle!==void 0&&(C.window.dojo.unsubscribe(this._serverLoadHandle),this._gameBeforeSaveHandle=void 0);const e=this.game.managers.indexOf(this._saveManager);-1<e&&this.game.managers.splice(e,1),C.window.kittenScientists=void 0,console.warn(...f("Kitten Scientists have been unloaded!"))}run(){this.refreshEntireUserInterface(),this.engine.settings.enabled&&this.engine.start(!0),this.engine.imessage("status.ks.init"),this.runUpdateCheck().catch(H(console)),this._gameBeforeSaveHandle!==void 0&&(C.window.dojo.unsubscribe(this._gameBeforeSaveHandle),this._gameBeforeSaveHandle=void 0),this._gameBeforeSaveHandle=C.window.dojo.subscribe("game/beforesave",e=>{console.info(...f("Injecting Kitten Scientists engine state into save data..."));const t=this.getSettings();e.ks={state:[t]},this._userInterface.stateManagementUi.storeAutoSave(t),document.dispatchEvent(new CustomEvent("ks.reportSavegame",{detail:e}))}),this._serverLoadHandle!==void 0&&(C.window.dojo.unsubscribe(this._serverLoadHandle),this._gameBeforeSaveHandle=void 0),this._serverLoadHandle=C.window.dojo.subscribe("server/load",e=>{const t=C.tryEngineStateFromSaveData("ks",e);if(!t){console.info(...f("The Kittens Game save data did not contain a script state. Trying to load Auto-Save settings..."));return}console.info(...f("Found! Loading settings...")),this.engine.stateLoad(t),this._userInterface.forceFullRefresh()})}async runUpdateCheck(){{console.debug(...f("No update check on \'fixed\' release channel."));return}}refreshEntireUserInterface(){console.info(...f("Requesting entire user interface to be refreshed.")),this._userInterface.forceFullRefresh()}parseFloat(e){if(e===null||e==="")return null;const t=/[KMGTP]$/i.test(e),i=e.substring(0,e.length-(t?1:0));let s=e.includes("e")||t?Number.parseFloat(i):Number.parseInt(i,10);if(t){const a=e.substring(e.length-1).toUpperCase();s=s*1e3**["","K","M","G","T","P"].indexOf(a)}return(s===Number.POSITIVE_INFINITY||s<0)&&(s=-1),s}parseAbsolute(e){const t=this.parseFloat(e);return t!==null?Math.round(t):null}parsePercentage(e){const t=e.trim().replace(/%$/,"");return Math.max(0,Math.min(1,Number.parseFloat(t)/100))}renderAbsolute(e,t="invariant"){return e<0||e===Number.POSITIVE_INFINITY?"∞":t!=="invariant"&&Math.floor(Math.log10(e))<9?new Intl.NumberFormat(t,{maximumFractionDigits:0,style:"decimal"}).format(e):this.game.getDisplayValueExt(e,!1,!1)}renderPercentage(e,t="invariant",i){return e<0||e===Number.POSITIVE_INFINITY?"∞":t!=="invariant"?new Intl.NumberFormat(t,{style:"percent"}).format(e):`${this.game.getDisplayValueExt(e*100,!1,!1)}${i?"%":""}`}renderFloat(e,t="invariant"){return e<0||e===Number.POSITIVE_INFINITY?"∞":t!=="invariant"?new Intl.NumberFormat(t,{style:"decimal"}).format(e):this.game.getDisplayValueExt(e,!1,!1)}static encodeSettings(e,t=!0){const i=JSON.stringify(e);return t?C.window.LZString.compressToBase64(i):i}static decodeSettings(e){try{const s=JSON.parse(e);return ae.unknownAsEngineStateOrThrow(s)}catch{}if(e.match(/\\r?\\n/))throw new $e("Multi-line non-JSON input can\'t be decoded.");const t=C.window.LZString.decompressFromBase64(e),i=JSON.parse(t);return ae.unknownAsEngineStateOrThrow(i)}getSettings(){return this.engine.stateSerialize()}getSettingsAsJson(){return JSON.stringify(this.getSettings())}setSettings(e){console.info(...f("Loading engine state..."));const t=this.engine.settings.ksColumn.enabled!==e.engine.ksColumn.enabled;this.engine.stateLoad(e),t&&this.rebuildUi(),this._userInterface.refresh(!0)}importSettingsFromString(e){const t=ae.decodeSettings(e);this.setSettings(t)}async copySettings(e=this.getSettings(),t=!0){const i=ae.encodeSettings(e,t);await C.window.navigator.clipboard.writeText(i)}static unknownAsEngineStateOrThrow(e){const t=e.v;if(!g(t)&&typeof t=="string"&&t.startsWith("2"))return e;throw new Error("Not a valid engine state.")}installSaveManager(){console.info(...f("Installing save game manager...")),this.game.managers.push(this._saveManager)}_saveManager={load:e=>{console.info(...f("Looking for Kitten Scientists engine state in save data..."));const t=C.tryEngineStateFromSaveData("ks",e);if(!t){console.info(...f("The Kittens Game save data did not contain a script state."));return}console.info(...f("Found Kitten Scientists engine state in save data.")),this.engine.stateLoad(t),this.refreshEntireUserInterface()},resetState:()=>null,save:e=>{}}}const Yi=async()=>{const l=await new C().waitForGame(ae,"ks");C.window.kittenScientists=l,l.validateGame(),l.run()};(typeof GM>"u"||GM?.info?.scriptHandler==="Tampermonkey")&&Yi().catch(H(console)),ue.main=Yi,Object.defineProperty(ue,Symbol.toStringTag,{value:"Module"})}));\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;&: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;>._headFlexItem_wr1pj_10{flex:1;margin-right:8px}}._setting_1ndg5_1{border-bottom:1px solid transparent;transition:border-bottom .3s;._checkbox_1ndg5_6{margin:1px 5px 2px 2px}._panelContent_1ndg5_10{border-left:1px dashed grey;padding-left:16px;margin-left:8px;margin-top:1px;opacity:.5;&._hidden_1ndg5_17{display:none}}&._checked_1ndg5_22>._panelContent_1ndg5_10{opacity:1}&._expanded_1ndg5_26{margin-bottom:10px}&:not(._expanded_1ndg5_26):hover{border-bottom:1px dashed rgba(160,160,160,.2)}&._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;&:hover{opacity:1}&._inactive_q7zpt_29{opacity:.4;&:hover{opacity:.6}}&._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;&:hover{opacity:1}&._inactive_q7zpt_29{opacity:.4;&:hover{opacity:.6}}&._ineffective_q7zpt_37{color:red;animation:_hail-rainbow_q7zpt_1 5s linear infinite}&._readonly_q7zpt_67{cursor:default;pointer-events:none}._buttonIcon_q7zpt_72{margin:0 2px 0 0;vertical-align:sub}&._alignRight_q7zpt_77{justify-content:end}&._large_q7zpt_81{padding:5px 10px}&._bordered_q7zpt_85{border:1px solid rgba(180,180,180,.2);&:not(._large_q7zpt_81){padding:0 2px}&:hover{border:1px solid rgba(180,180,180,1)}}&._headAction_q7zpt_97{min-width:50px}&._lastHeadAction_q7zpt_100{padding-right:20px}&._consumeButton_q7zpt_104{border:1px solid transparent}&._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{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;&:hover{opacity:1}}._expandoButton_l1ukp_1._expanded_l1ukp_1 ._down_l1ukp_4{display:none}#gamePageContainer .dialog.help._dialog_b4vj0_1{display:flex;flex-direction:column;height:fit-content!important;box-shadow:none!important;._close_b4vj0_7{position:absolute;top:10px;right:15px}}._explainer_1idu3_1{color:#888;display:inline-block;min-width:100px;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;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;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;&:after,&:before{display:inline-block;width:1em;height:100%;position:absolute;right:-1.5em;scale:0;text-align:center;transform-origin:center}&:after{content:attr(data-ks-active-from);animation:_scale_6c09s_1 8s linear infinite}&: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}#crowdjet-expand-container{position:fixed!important;bottom:10px!important;right:-10px!important;opacity:.5;&:hover{opacity:1}}#footerLinks{display:flex;flex-direction:column;position:fixed;text-align:right;line-height:0;right:-5px!important;margin-bottom:1em;a{line-height:1;padding-right:10px;opacity:.5;transition:.3s;text-decoration:none;text-transform:lowercase;&:hover{opacity:1}}}._spacer_90nk2_45{display:block;margin-bottom:100px}._ui_90nk2_50{margin:5px 0 10px;padding-right:10px;ul{list-style:none;margin:0;padding:0}#_toggle-list-resources_90nk2_1 ._stockWarn_90nk2_61 *,#_toggle-reset-list-resources_90nk2_1 ._stockWarn_90nk2_61 *{color:#dd1e00}}._showActivity_90nk2_67{cursor:pointer;display:inline-block;vertical-align:middle}#game #rightColumn{overflow-y:auto;#rightTabLog{overflow-y:visible;#logFiltersBlock{display:none!important}#gameLog{height:auto;min-height:auto;overflow-y:visible;.type_ks-default{color:#9748e0}.type_ks-activity{color:#ffac74bf}.type_ks-summary{color:#093}}}}#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';
106
106
  nodeScript.type = "application/javascript";
107
107
  document.body.appendChild(nodeScript);
108
108
  }