From 74c6b43ce0fe61fab9d35631c665913e12b6c22a Mon Sep 17 00:00:00 2001 From: amcolash Date: Thu, 2 Jan 2025 08:11:43 +0000 Subject: [PATCH] deploy: d97701968a0d2cad2edc395e4ef5f8833659ba26 --- assets/index-CY4Qc25t.js | 1 + assets/index-DlKJ9cz_.js | 1 - build.json | 2 +- index.html | 2 +- sw.js | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 assets/index-CY4Qc25t.js delete mode 100644 assets/index-DlKJ9cz_.js diff --git a/assets/index-CY4Qc25t.js b/assets/index-CY4Qc25t.js new file mode 100644 index 0000000..f8a270b --- /dev/null +++ b/assets/index-CY4Qc25t.js @@ -0,0 +1 @@ +var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s)(t,"symbol"!=typeof i?i+"":i,s);import{r as i,g as s,c as n,a as r}from"./phaser-BZMViRUx.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const i of e)if("childList"===i.type)for(const e of i.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const o={};var a=i();const l={width:1280,height:720},h={width:960,height:540};let c=!1,d=!1,u=!1;u=!0;let p=!0;const y=localStorage.getItem("chrono-sleuth-prod");let g;null!==y&&(p="true"===y);let f=p;f=!0;let m=!1;p&&(m=!1);const{width:b,height:v}=h;p&&(c=!1,u=!1,p=!0,g=void 0,d=!1);const w={debug:c,phaserInspector:d,prod:p,bootDialog:g,useShader:!0,width:b,height:v,cameraOffset:v/3,zoomed:!0,dayMinutes:.25,rewindEnabled:!1,fastMode:u,perfTest:m};var x=(e=>(e[e.Backgrounds=-1]="Backgrounds",e[e.Warpers=0]="Warpers",e[e.Npcs=1]="Npcs",e[e.Items=2]="Items",e[e.Player=3]="Player",e[e.Shader=4]="Shader",e[e.Ui=5]="Ui",e[e.Ui2=6]="Ui2",e[e.Debug=7]="Debug",e[e.Overlay=8]="Overlay",e))(x||{}),S=(e=>(e[e.None=0]="None",e[e.Teleported=1]="Teleported",e[e.Talked=2]="Talked",e[e.Item=3]="Item",e[e.Prop=4]="Prop",e))(S||{}),k=(e=>(e[e.Underground=0]="Underground",e[e.Town=1]="Town",e[e.TownEast=2]="TownEast",e[e.Forest=3]="Forest",e[e.ForestEast=4]="ForestEast",e[e.Lake=5]="Lake",e[e.TownNorth=6]="TownNorth",e[e.ClockSquare=7]="ClockSquare",e[e.ClockSquareNorth=8]="ClockSquareNorth",e[e.ClockEntrance=9]="ClockEntrance",e[e.ClockStairs=10]="ClockStairs",e[e.ClockTop=11]="ClockTop",e[e.TownWest=12]="TownWest",e[e.MansionGrounds=13]="MansionGrounds",e[e.MansionEntrance=14]="MansionEntrance",e[e.Mansion=15]="Mansion",e[e.LabHatch=16]="LabHatch",e[e.Lab=17]="Lab",e[e.LibraryEntrance=18]="LibraryEntrance",e[e.Library=19]="Library",e))(k||{}),P=(e=>(e[e.Wrench=0]="Wrench",e[e.Gear1=1]="Gear1",e[e.Key=2]="Key",e[e.HerbRed=3]="HerbRed",e[e.HerbGreen=4]="HerbGreen",e[e.HerbBlue=5]="HerbBlue",e[e.Potion=6]="Potion",e[e.Gear2=7]="Gear2",e))(P||{}),I=(e=>(e[e.ForestGear=0]="ForestGear",e[e.SphinxRiddle=1]="SphinxRiddle",e[e.InvestigateTownWest=2]="InvestigateTownWest",e[e.ExploreLab=3]="ExploreLab",e[e.FindPotionIngredients=4]="FindPotionIngredients",e))(I||{}),T=(e=>(e[e.Inventor=0]="Inventor",e[e.Stranger=1]="Stranger",e[e.Sphinx=2]="Sphinx",e[e.Mayor=3]="Mayor",e[e.ClockTower=4]="ClockTower",e))(T||{}),C=(e=>(e[e.Sphinx=0]="Sphinx",e))(C||{}),j=(e=>(e[e.FixTheClock=0]="FixTheClock",e[e.MetTheMayor=1]="MetTheMayor",e[e.ClockFirstGear=2]="ClockFirstGear",e[e.AlchemyLabFound=3]="AlchemyLabFound",e[e.AlchemySetFixed=4]="AlchemySetFixed",e[e.ExtraPotionInformation=5]="ExtraPotionInformation",e[e.SafeDiscovered=6]="SafeDiscovered",e[e.ClockSecondGear=7]="ClockSecondGear",e))(j||{}),O=(e=>(e[e.Chest=0]="Chest",e[e.LabHatch=1]="LabHatch",e[e.LabBook=2]="LabBook",e[e.AlchemySet=3]="AlchemySet",e[e.LabBookshelf1=4]="LabBookshelf1",e[e.LabBookshelf2=5]="LabBookshelf2",e[e.LabBookshelf3=6]="LabBookshelf3",e[e.LabPotionShelf1=7]="LabPotionShelf1",e[e.MansionPicture=8]="MansionPicture",e[e.MansionHole=9]="MansionHole",e))(O||{}),A=(e=>(e[e.LabStairs=0]="LabStairs",e))(A||{});const E={[T.Inventor]:{x:550,y:635,scale:.75,image:"inventor",portrait:"inventor_portrait",name:"Johan the Inventor"},[T.Stranger]:{x:750,y:865,scale:1.35,image:"stranger",portrait:"stranger_portrait",name:"Mysterious Stranger"},[T.Sphinx]:{x:3520,y:790,scale:1,image:"sphinx",portrait:"sphinx_portrait",name:"Mystical Sphinx",onCreate:e=>zr(e.scene,e.scene.player.gameState.data.sphinxMoved,!0),light:1.85,initializeOnStart:!0},[T.Mayor]:{x:1065,y:-340,scale:.9,image:"mayor",portrait:"mayor_portrait",name:"Mayor of Town"},[T.ClockTower]:{x:880,y:-2090,scale:.5,image:"warp",portrait:"clock_portrait",name:"Clock Tower",particles:{texture:"warp",scale:{start:0,end:1.1},alpha:{start:1,end:0},lifespan:2e3,delay:1e3,maxAliveParticles:1,tint:[13067088]},onCreate:e=>{e.setOffset(150,-40)}}},M="fcfee9",z="e6c99d",D="303646",F="1c1831",L="993333",B="339933",G="ffccaa",R="335588",W="111111",N="ddaaee";function _(e){return a.Display.Color.HexStringToColor(e).color}function H(e){return _(a.Display.Color.RGBToString(255*e.r,255*e.g,255*e.b))}function U(e){const t=a.Display.Color.ColorToRGBA(e);return new a.Display.Color(t.r,t.g,t.b,t.a)}function $(e,t,i,s,n){const r=.3*(n.duration||100);return e.tweens.addCounter({from:0,to:r,onUpdate:e=>{const n=a.Display.Color.Interpolate.ColorWithColor(t,i,r,e.getValue());var o;s((o=n,_(a.Display.Color.RGBToString(o.r,o.g,o.b))))},...n})}const V=1200;let q=!1;function X(e){return H(e.lights.ambientColor)===_(M)}function K(e,t=!0){q||(Y(e,M,t),t?e.time.delayedCall(V,(()=>Q(e,.5))):Q(e,.5),e.lights.lights.forEach((i=>{const s=i.intensity;t?e.tweens.add({targets:i,duration:V,intensity:0,onComplete:()=>{i.setVisible(!1),i.setIntensity(s)}}):i.setVisible(!1)})))}function Y(e,t,i){if(!i)return void e.lights.setAmbientColor(_(t));q=!0;const s=H(e.lights.ambientColor),n=a.Display.Color.ValueToColor(s),r=a.Display.Color.ValueToColor(t);$(e,n,r,(t=>e.lights.setAmbientColor(t)),{duration:V,onComplete:()=>{q=!1}})}function Q(e,t){e.children.getAll("name","DebugLightGraphics").forEach((e=>e.setAlpha(t)))}const J=U(_(W));function Z(e,t,i){e.cameras.main.fadeIn(t,J.red,J.green,J.blue,((e,t)=>{t>=1&&i&&i()}))}function ee(e,t,i){e.cameras.main.fadeOut(t,J.red,J.green,J.blue,((e,t)=>{t>=1&&i&&i()}))}function te(e,t,i){return!!(t.inventory.initialized&&t.quests.initialized&&t.journal.initialized)&&a.Math.Distance.BetweenPointsSquared(e,t)<(i||1e3)**2}function ie(e,t,i){var s,n;null==(s=e.gamepad)||s.setAlpha(0),null==(n=e.gamepad)||n.resetButtons(),e.scene.pause(),e.scene.launch(t,{player:e.player,...i})}function se(e,t,i){return t&&Object.values(t).includes(e)?`${i}.${Object.keys(t).find((i=>t[i]===e))}`:e}function ne(e){return e.replace(/([A-Z]+|[0-9]+)/g," $1").trim()}let re;const oe=document.documentElement;class ae extends a.GameObjects.GameObject{constructor(e,i,s,n,r,o){super(e,"DebugLight"),t(this,"x"),t(this,"y"),t(this,"light"),t(this,"debug"),e.add.existing(this),this.light=e.lights.addLight(i,s,n,r,o),this.debug=e.add.graphics({x:i,y:s}).setDepth(x.Debug),this.debug.lineStyle(3,65280),this.debug.name="DebugLightGraphics",this.x=i,this.y=s,w.debug&&this.debug.strokeCircle(0,0,n)}setPosition(e,t){this.light.setPosition(e,t),this.debug.setPosition(e,t),this.x=e,this.y=t}destroy(e){var t,i;super.destroy(e),this.debug.destroy(),null==(i=null==(t=this.scene)?void 0:t.lights)||i.removeLight(this.light)}}const le=2*Math.PI;class he extends a.GameObjects.Graphics{constructor(e,i){super(e),t(this,"player"),t(this,"angle1",0),t(this,"angle2",1),t(this,"angle3",4),t(this,"update1",!1),t(this,"update2",!1),t(this,"update3",!1),this.name="ClockHands",e.add.existing(this),this.player=i,this.setPosition(842,-2107),this.setDepth(x.Npcs),this.updateHands()}update(e){if(this.scene.cameras.main.worldView.contains(this.x,this.y))this.setVisible(!1);else{this.setVisible(!0),this.update1&&(this.angle1=le*(e/6e4)*35),this.update2&&(this.angle2=le*(e/36e5)*35),this.update3&&(this.angle3=le*(e/432e5)*35),this.clear(),this.fillStyle(_("#224477")),this.fillCircle(0,0,6),[8,6].forEach((e=>{this.lineStyle(e,_(6===e?"#224477":F)),this.lineBetween(0,0,50*Math.cos(this.angle1),50*Math.sin(this.angle1)),this.lineBetween(0,0,40*Math.cos(this.angle2),40*Math.sin(this.angle2)),this.lineBetween(0,0,25*Math.cos(this.angle3),25*Math.sin(this.angle3))})),this.lineStyle(5,_(F));for(let e=0;e<12;e++){const t=le*(e/12),i=50*Math.cos(t),s=50*Math.sin(t);this.lineBetween(i,s,1.5*i,1.5*s)}}}updateHands(){Ce(this.player,j.ClockFirstGear)&&(this.update1=!0),Ce(this.player,j.ClockSecondGear)&&(this.update2=!0)}}var ce=(e=>(e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.Left=2]="Left",e[e.Right=3]="Right",e[e.Continue=4]="Continue",e[e.Back=5]="Back",e[e.Shift=6]="Shift",e))(ce||{});class de{constructor(e){t(this,"scene"),t(this,"keys",Object.keys(ce).map(Number).reduce(((e,t)=>({...e,[t]:!1})),{})),this.scene=e,this.listener(2,"LEFT"),this.listener(3,"RIGHT"),this.listener(0,"UP"),this.listener(1,"DOWN"),this.listener(0,"W"),this.listener(2,"A"),this.listener(1,"S"),this.listener(3,"D"),this.listener(4,"SPACE"),this.listener(4,"ENTER"),this.listener(5,"BACKSPACE"),this.listener(6,"SHIFT")}listener(e,t){var i,s;null==(i=this.scene.input.keyboard)||i.on(`keydown-${t}`,(()=>this.keys[e]=!0)),null==(s=this.scene.input.keyboard)||s.on(`keyup-${t}`,(()=>this.keys[e]=!1))}resetKeys(){Object.entries(this.keys).forEach((([e,t])=>this.keys[Number(e)]=!1))}}class ue extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:r,image:o}=E[i];super(e,n,r,o),t(this,"npcType"),t(this,"player"),t(this,"light"),t(this,"particles"),t(this,"lastPos",new a.Math.Vector2),t(this,"clock"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`NPC-${i}`,this.npcType=i,this.player=s,this.setDepth(x.Npcs),"warp"===o&&this.setAlpha(0),ze(this,E[i])}lazyInit(e){if(!e&&(this.initialized||!te(this,this.player)))return;this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0});const{x:t,y:i,light:s,particles:n,onCreate:r}=E[this.npcType],o=s||1,a=!X(this.scene);w.debug?(this.light=new ae(this.scene,this.x,this.y,this.displayHeight/150*150,16764074,o),this.light.light.setVisible(a)):(this.light=this.scene.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,o),this.light.setVisible(a)),n&&(this.particles=this.scene.add.particles(t,i,"",n).setName(`NPC-${this.npcType}-Particles`)),this.npcType===T.ClockTower&&(this.clock=new he(this.scene,this.player)),r&&r(this),this.initialized=!0}update(e,t){this.lazyInit(),!this.light||this.x===this.lastPos.x&&this.y===this.lastPos.y||this.light.setPosition(this.x,this.y),this.lastPos.set(this.x,this.y),this.clock&&this.clock.update(e)}onInteract(e){if(this.player.message.visible||Date.now()0){const t=E[this.npcType].portrait.length>0;return this.player.message.setDialog(e,t?this:void 0),S.Talked}}return S.None}getButtonPrompt(){return this.npcType===T.ClockTower?["Inspect Clock Tower","Press [CONTINUE]"]:[`Talk to ${E[this.npcType].name}`,"Press [CONTINUE]"]}}const pe={[O.Chest]:{x:5110,y:915,image:"chest",scale:{x:4.5,y:3}},[O.LabHatch]:{x:-1910,y:640},[O.LabBook]:{x:-700,y:1630,image:"book"},[O.AlchemySet]:{x:-2650,y:1600,image:"alchemy_empty",initializeOnStart:!0,skipLighting:!0,particles:{scale:{min:.05,max:.15},speed:{min:30,max:120},alpha:{values:[0,.5,0]},gravityY:100,lifespan:{min:250,max:500},emitting:!1,stopAfter:60}},[O.LabBookshelf1]:{x:-2025,y:1700},[O.LabBookshelf2]:{x:-1290,y:1700},[O.LabBookshelf3]:{x:-1115,y:1700},[O.LabPotionShelf1]:{x:-1790,y:1700},[O.MansionPicture]:{x:-1233,y:-580,scale:1.2,angle:5,image:"picture",origin:{x:0,y:0},initializeOnStart:!0,skipLighting:!0},[O.MansionHole]:{x:-1870,y:-490}};class ye extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:r,image:o}=pe[i];super(e,n,r,o||""),t(this,"propType"),t(this,"player"),t(this,"particles"),t(this,"initialized",!1),t(this,"disabled",!1),this.name=`Prop-${i}`,this.propType=i,this.player=s,this.setScale(o?.35:2).setDepth(x.Items),o||w.debug||this.setAlpha(0),ze(this,pe[i]),i===O.MansionPicture&&this.resetPostPipeline()}lazyInit(e){if(!e&&(this.initialized||!te(this,this.player)))return;if(this.checkDestroyed())return;this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0});const t=pe[this.propType].particles;t&&(this.particles=this.scene.add.particles(this.x,this.y,"warp",t).setDepth(x.Items).setName(`Prop-${this.propType}-Particles`)),this.propType===O.MansionPicture&&this.scene.add.image(this.x,this.y,"safe").setOrigin(0,0).setScale(.9).setName("Prop-Safe"),this.initialized=!0}onInteract(e){if(this.player.message.visible||Date.now()0)return this.player.message.setDialog(e,this,pe[this.propType].portrait||"player_portrait"),S.Prop}return S.None}checkDestroyed(){let e=!1;return this.propType===O.LabHatch&&Ce(this.player,j.AlchemyLabFound)&&(e=!0),this.propType===O.Chest&&Se(this.player,P.Gear1)&&(e=!0),e&&this.destroy(),e}getButtonPrompt(){const e=Er(Ar[this.propType]||[],this.player,this);let t=O[this.propType];return t=ne(t),this.propType===O.MansionPicture&&Ce(this.player,j.SafeDiscovered)&&(t="Safe"),e&&(null==e?void 0:e.messages.length)>0?[`Inspect ${t}`,"Press [CONTINUE]"]:""}update(){this.lazyInit()}}const ge={[j.FixTheClock]:{description:"The inventor gave me a wrench to help fix the clock tower. I will also need three gears to repair it."},[j.MetTheMayor]:{description:"I have met the mayor of the town. She told me about the old clock tower. I should see if I can use the gear I found to try and fix it.",warpAdd:k.ClockSquareNorth},[j.ClockFirstGear]:{description:"I found the first gear for the clock tower and placed it into the clock face. I still need two more gears to fix it."},[j.AlchemyLabFound]:{description:"I found a secret alchemy lab. I wonder what the previous alchemist was brewing up.",warpAdd:k.LabHatch},[j.AlchemySetFixed]:{description:"With the alchemy set fixed, I can now attempt to create the brew mentioned in the old journal."},[j.ExtraPotionInformation]:{description:'I found an extra journal entry with more information on the potion. It stated the name of the potion was the "Exlixir of Sight". This potion must be the key to finding a gear.'},[j.SafeDiscovered]:{description:"I discovered a safe in the abandonded mansion. I wonder what secrets it holds."},[j.ClockSecondGear]:{description:"I found the second gear for the clock tower inside a safe, which was located within the abandoned mansion. I still need one more gear to fix it."}},fe={[I.ForestGear]:{description:"Find the gear in the forest",warpAdd:k.TownEast,warpComplete:k.TownNorth},[I.SphinxRiddle]:{description:"Solve the Sphinx riddle"},[I.InvestigateTownWest]:{description:"Investigate the west side of town",warpAdd:k.TownWest},[I.ExploreLab]:{description:"Explore the hidden alchemy lab"},[I.FindPotionIngredients]:{description:"Find the 3 potion ingredients"}};var me=(e=>(e[e.Ladder=0]="Ladder",e[e.Warp=1]="Warp",e[e.Invisible=2]="Invisible",e[e.WarpLocked=3]="WarpLocked",e[e.InvisibleLocked=4]="InvisibleLocked",e))(me||{});const be={[k.Town]:{x:300,y:650,key:ce.Down,warpTo:k.Underground,visual:0},[k.Underground]:{x:301,y:875,key:ce.Up,warpTo:k.Town,visual:0},[k.TownEast]:{x:1720,y:650,key:ce.Right,warpTo:k.Forest,visual:3},[k.Forest]:{x:2650,y:815,key:ce.Left,warpTo:k.TownEast,visual:1},[k.TownNorth]:{x:775,y:650,key:ce.Up,warpTo:k.ClockSquare,visual:3},[k.ClockSquare]:{x:610,y:-330,key:ce.Left,warpTo:k.TownNorth,visual:1},[k.ClockSquareNorth]:{x:915,y:-330,key:ce.Up,warpTo:k.ClockEntrance,visual:3},[k.ClockEntrance]:{x:690,y:-1320,range:15,key:ce.Left,warpTo:k.ClockSquareNorth,visual:1,skipLighting:!0},[k.ClockStairs]:{x:910,y:-1400,range:20,key:ce.Right,warpTo:k.ClockTop,visual:2,sound:"ladder"},[k.ClockTop]:{x:780,y:-1970,range:10,key:ce.Left,warpTo:k.ClockStairs,visual:2,sound:"ladder"},[k.ForestEast]:{x:3590,y:815,key:ce.Right,warpTo:k.Lake,visual:3,initializeOnStart:!0},[k.Lake]:{x:4625,y:915,key:ce.Left,warpTo:k.ForestEast,visual:1},[k.TownWest]:{x:90,y:650,key:ce.Left,warpTo:k.MansionGrounds,visual:3},[k.MansionGrounds]:{x:-620,y:640,key:ce.Right,warpTo:k.TownWest,visual:1},[k.MansionEntrance]:{x:-1290,y:640,key:ce.Up,warpTo:k.Mansion,visual:1,sound:"door"},[k.Mansion]:{x:-1405,y:-420,key:ce.Down,warpTo:k.MansionEntrance,visual:2},[k.LabHatch]:{x:-1920,y:640,key:ce.Down,warpTo:k.Lab,visual:4},[k.Lab]:{x:-1380,y:1545,key:ce.Right,warpTo:k.LabHatch,visual:2,range:15,skipLighting:!0},[k.LibraryEntrance]:{x:1420,y:650,key:ce.Up,warpTo:k.Library,visual:3},[k.Library]:{x:1730,y:-120,key:ce.Left,warpTo:k.LibraryEntrance,visual:1}},ve=[];Object.values(fe).forEach((e=>{e.warpAdd&&ve.push(e.warpAdd),e.warpComplete&&ve.push(e.warpComplete)})),Object.values(ge).forEach((e=>{e.warpAdd&&ve.push(e.warpAdd)}));class we extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:r,visual:o,range:a}=be[i];super(e,n,r,o===me.Ladder?"ladder":"warp"),t(this,"warpType"),t(this,"player"),t(this,"locked"),t(this,"graphics"),t(this,"portal1"),t(this,"portal2"),t(this,"range"),t(this,"initialized",!1),this.name=`Warp-${i}`,this.warpType=i,this.player=s,this.range=a||30,this.setScale(.6).setDepth(x.Warpers),o!==me.Warp&&o!==me.WarpLocked||(this.setScale(.6,1),this.setPosition(n,r-12)),w.debug||(this.updateLocked(o===me.WarpLocked||o===me.InvisibleLocked),o!==me.Invisible&&o!==me.InvisibleLocked||this.setAlpha(0)),ze(this,be[i]),ve.includes(i)&&e.add.existing(this)}lazyInit(e){(e||!this.initialized&&te(this,this.player))&&(ve.includes(this.warpType)||this.scene.add.existing(this),this.scene.physics.add.existing(this),this.createParticles(),this.createDebug(),this.warpType===k.Underground&&this.createLadder(),this.hasExtendedBounds()&&this.body&&this.setBodySize(this.body.width*(this.range/30*4),this.body.height),this.updateLocked(),this.initialized=!0)}createParticles(){const{visual:e,skipLighting:t}=be[this.warpType];e!==me.Warp&&e!==me.WarpLocked||(this.setAlpha(.1),this.scene.anims.exists("portal")||this.scene.anims.create({key:"portal",frames:this.scene.anims.generateFrameNumbers("portal",{start:0,end:63}),frameRate:10,repeat:-1}),this.portal1=this.scene.add.sprite(this.x,this.y,"portal_0").setScale(.45,1).setAlpha(.9).play("portal").setName(`${this.name}-1`),this.portal1.postFX.addPixelate(1),this.portal1.postFX.addShadow(0,0,.1,1,3355562,6,.5),this.portal2=this.scene.add.sprite(this.x,this.y,"portal_0").setScale(.35,1).setAlpha(.65).setFlipX(!0).setName(`${this.name}-2`),this.portal2.postFX.addPixelate(1),this.portal2.play("portal"),this.portal2.setFrame(Math.floor(30*Math.random())),t||(this.portal1.setPipeline("Light2D"),this.portal2.setPipeline("Light2D")),this.portal1.setPostPipeline("XRayPipeline"),this.portal2.setPostPipeline("XRayPipeline"))}createDebug(){if(w.debug&&(this.setInteractive({draggable:!0}),this.graphics=this.scene.add.graphics(),this.hasExtendedBounds())){this.graphics.lineStyle(2,16711935).setPosition(this.x,this.y);const e=this.body;this.graphics.lineBetween(-this.range,-e.halfHeight,-this.range,e.halfHeight),this.graphics.lineBetween(this.range,-e.halfHeight,this.range,e.halfHeight),this.graphics.strokeCircle(0,0,5)}}createLadder(){this.scene.add.image(this.x,this.y-60,"ladder").setScale(.6).setDepth(x.Warpers).setPipeline("Light2D").setPostPipeline("XRayPipeline").setName("Ladder1"),this.scene.add.image(this.x,this.y-105,"ladder").setScale(.6).setDepth(x.Warpers).setPipeline("Light2D").setPostPipeline("XRayPipeline").setName("Ladder2")}hasExtendedBounds(){const{visual:e,key:t}=be[this.warpType];return!(e!==me.Warp&&e!==me.WarpLocked&&e!==me.Invisible||t!==ce.Left&&t!==ce.Right)}onInteract(e){const t=!this.hasExtendedBounds()||Math.abs(this.player.x-this.x){t>=1&&l.time.delayedCall(300,(()=>l.cameras.main.fadeIn(1e3,0,0,0)))})),l.cameras.main.stopFollow(),l.tweens.add({targets:l.cameras.main,scrollX:h,scrollY:c-w.cameraOffset,duration:600,delay:100,ease:"Power1",onComplete:()=>{l.cameras.main.startFollow(t,!0),l.cameras.main.setFollowOffset(0,w.cameraOffset)}}),t.setActive(!1),t.buttonPrompt.setVisible(!1),l.tweens.add({targets:t,alpha:0,duration:500,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{t.setPosition(n,r),t.previousPosition.set(n,r)},onComplete:()=>{t.alpha=1,t.setActive(!0)}}),l.tweens.add({targets:t.light,intensity:0,duration:50,hold:600,yoyo:!0,repeat:0});const u=t.light instanceof a.GameObjects.Light?t.light:t.light.light;l.tweens.add({targets:u,x:n,y:r,duration:400,ease:"Power1"})}function Se(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t))}function ke(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t&&!e.used))}function Pe(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t&&e.used))}function Ie(e,t){return e.quests.quests.some((e=>e.id===t&&!e.completed))}function Te(e,t){return e.quests.quests.some((e=>e.id===t&&e.completed))}function Ce(e,t){return e.journal.journal.includes(t)}function je(e,t){return e.children.getAll().filter((e=>e instanceof t))}function Oe(e,t,i){const s=function(e,t){return je(e,we).find((e=>e.warpType===t))}(e,t);s&&s.updateLocked(i)}function Ae(e,t){return je(e,ue).find((e=>e.npcType===t))}function Ee(e,t){return je(e,Mr).find((e=>e.itemType===t))}function Me(e,t){return je(e,ye).find((e=>e.propType===t))}function ze(e,t){const{scale:i,alpha:s,angle:n,depth:r,skipLighting:o,origin:a,initializeOnStart:l}=t;i&&("object"==typeof i?e.setScale(i.x,i.y):e.setScale(i)),s&&e.setAlpha(s),n&&e.setAngle(n),r&&e.setDepth(r),a&&e.setOrigin(a.x,a.y),o||e.setPipeline("Light2D"),e.setPostPipeline("XRayPipeline"),l&&e.lazyInit(!0)}var De,Fe,Le,Be,Ge,Re,We,Ne,_e,He,Ue,$e,Ve,qe,Xe,Ke,Ye,Qe,Je,Ze,et,tt,it,st,nt,rt,ot,at,lt,ht,ct,dt,ut,pt,yt,gt,ft,mt,bt,vt,wt,xt,St,kt;function Pt(){if(Fe)return De;Fe=1;var e=Object.prototype.toString;return De=function(t){var i=e.call(t),s="[object Arguments]"===i;return s||(s="[object Array]"!==i&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),s}}function It(){if(Re)return Ge;Re=1;var e=Array.prototype.slice,t=Pt(),i=Object.keys,s=i?function(e){return i(e)}:function(){if(Be)return Le;var e;if(Be=1,!Object.keys){var t=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=Pt(),n=Object.prototype.propertyIsEnumerable,r=!n.call({toString:null},"toString"),o=n.call((function(){}),"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(e){var t=e.constructor;return t&&t.prototype===e},h={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!h["$"+e]&&t.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{l(window[e])}catch(i){return!0}}catch(i){return!0}return!1}();e=function(e){var n=null!==e&&"object"==typeof e,h="[object Function]"===i.call(e),d=s(e),u=n&&"[object String]"===i.call(e),p=[];if(!n&&!h&&!d)throw new TypeError("Object.keys called on a non-object");var y=o&&h;if(u&&e.length>0&&!t.call(e,0))for(var g=0;g0)for(var f=0;f1&&"boolean"!=typeof t)throw new o('"allowMissing" argument must be a boolean');if(null===j(/^%?[^%]*%?$/,e))throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=function(e){var t=C(e,0,1),i=C(e,-1);if("%"===t&&"%"!==i)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==t)throw new r("invalid intrinsic syntax, expected opening `%`");var s=[];return T(e,O,(function(e,t,i,n){s[s.length]=i?T(n,A,"$1"):t||e})),s}(e),s=i.length>0?i[0]:"",n=E("%"+s+"%",t),a=n.name,l=n.value,h=!1,d=n.alias;d&&(s=d[0],I(i,P([0,1],d)));for(var u=1,p=!0;u=i.length){var m=c(l,y);l=(p=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:l[y]}else p=k(l,y),l=l[y];p&&!h&&(b[a]=l)}}return l},ut}function Rt(){if(gt)return yt;gt=1;var e=Gt()("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return yt=e}function Wt(){if(mt)return ft;mt=1;var e=Gt()("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch(t){e=null}return ft=e}function Nt(){if(vt)return bt;vt=1;var e=Rt(),t=At(),i=Et(),s=Wt();return bt=function(n,r,o){if(!n||"object"!=typeof n&&"function"!=typeof n)throw new i("`obj` must be an object or a function`");if("string"!=typeof r&&"symbol"!=typeof r)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],d=!!s&&s(n,r);if(e)e(n,r,{configurable:null===h&&d?d.configurable:!h,enumerable:null===a&&d?d.enumerable:!a,value:o,writable:null===l&&d?d.writable:!l});else{if(!c&&(a||l||h))throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");n[r]=o}},bt}function _t(){if(xt)return wt;xt=1;var e=Rt(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return 1!==e([],"length",{value:1}).length}catch(t){return!0}},wt=t}function Ht(){if(kt)return St;kt=1;var e=It(),t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,s=Array.prototype.concat,n=Nt(),r=_t()(),o=function(e,t,s,o){if(t in e)if(!0===o){if(e[t]===s)return}else if("function"!=typeof(a=o)||"[object Function]"!==i.call(a)||!o())return;var a;r?n(e,t,s,!0):n(e,t,s)},a=function(i,n){var r=arguments.length>2?arguments[2]:{},a=e(n);t&&(a=s.call(a,Object.getOwnPropertySymbols(n)));for(var l=0;l4294967295||r(o)!==o)throw new n("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],l=!0,h=!0;if("length"in e&&s){var c=s(e,"length");c&&!c.configurable&&(l=!1),c&&!c.writable&&(h=!1)}return(l||h||!a)&&(i?t(e,"length",o,!0,!0):t(e,"length",o)),e},Ut}function mi(){return Vt||(Vt=1,function(e){var t=Lt(),i=Gt(),s=fi(),n=Et(),r=i("%Function.prototype.apply%"),o=i("%Function.prototype.call%"),a=i("%Reflect.apply%",!0)||t.call(o,r),l=Rt(),h=i("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new n("a function is required");var i=a(t,o,arguments);return s(i,1+h(0,e.length-(arguments.length-1)),!0)};var c=function(){return a(t,r,arguments)};l?l(e.exports,"apply",{value:c}):e.exports.apply=c}(gi)),gi.exports}function bi(){if(Xt)return qt;Xt=1;var e=Gt(),t=mi(),i=t(e("String.prototype.indexOf"));return qt=function(s,n){var r=e(s,!!n);return"function"==typeof r&&i(s,".prototype.")>-1?t(r):r}}function vi(){if(Yt)return Kt;Yt=1;var e=It(),t=zt()(),i=bi(),s=Object,n=i("Array.prototype.push"),r=i("Object.prototype.propertyIsEnumerable"),o=t?Object.getOwnPropertySymbols:null;return Kt=function(i,a){if(null==i)throw new TypeError("target must be an object");var l=s(i);if(1===arguments.length)return l;for(var h=1;h2&&!!arguments[2]&&!i||(t?e(n,"name",r,!0,!0):e(n,"name",r)),n},ri}(),t=Et(),i=Object;return ai=e((function(){if(null==this||this!==i(this))throw new t("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e}),"get flags",!0)}function Si(){if(ci)return hi;ci=1;var e=xi(),t=Ht().supportsDescriptors,i=Object.getOwnPropertyDescriptor;return hi=function(){if(t&&"gim"===/a/gim.flags){var s=i(RegExp.prototype,"flags");if(s&&"function"==typeof s.get&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),s.get.call(r),"dy"===n)return s.get}}return e}}var ki,Pi,Ii,Ti,Ci={exports:{}};function ji(){if(Pi)return ki;Pi=1;var e=zt();return ki=function(){return e()&&!!Symbol.toStringTag}}function Oi(){if(Ti)return Ii;Ti=1;var e=ji()(),t=bi()("Object.prototype.toString"),i=function(i){return!(e&&i&&"object"==typeof i&&Symbol.toStringTag in i)&&"[object Arguments]"===t(i)},s=function(e){return!!i(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==t(e)&&"[object Function]"===t(e.callee)},n=function(){return i(arguments)}();return i.isLegacyArguments=s,Ii=n?i:s}const Ai=s(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ei,Mi,zi,Di,Fi,Li,Bi,Gi,Ri,Wi,Ni,_i,Hi,Ui,$i,Vi,qi,Xi,Ki,Yi,Qi,Ji,Zi,es,ts,is,ss,ns,rs,os,as,ls,hs,cs,ds,us,ps;function ys(){if(Mi)return Ei;Mi=1;var e="function"==typeof Map&&Map.prototype,t=Object.getOwnPropertyDescriptor&&e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=e&&t&&"function"==typeof t.get?t.get:null,s=e&&Map.prototype.forEach,r="function"==typeof Set&&Set.prototype,o=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=r&&o&&"function"==typeof o.get?o.get:null,l=r&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,c="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,u=Boolean.prototype.valueOf,p=Object.prototype.toString,y=Function.prototype.toString,g=String.prototype.match,f=String.prototype.slice,m=String.prototype.replace,b=String.prototype.toUpperCase,v=String.prototype.toLowerCase,w=RegExp.prototype.test,x=Array.prototype.concat,S=Array.prototype.join,k=Array.prototype.slice,P=Math.floor,I="function"==typeof BigInt?BigInt.prototype.valueOf:null,T=Object.getOwnPropertySymbols,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,j="function"==typeof Symbol&&"object"==typeof Symbol.iterator,O="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,A=Object.prototype.propertyIsEnumerable,E=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function M(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||w.call(/e/,t))return t;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var s=e<0?-P(-e):P(e);if(s!==e){var n=String(s),r=f.call(t,n.length+1);return m.call(n,i,"$&_")+"."+m.call(m.call(r,/([0-9]{3})/g,"$&_"),/_$/,"")}}return m.call(t,i,"$&_")}var z=Ai,D=z.custom,F=_(D)?D:null,L={__proto__:null,double:'"',single:"'"},B={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function G(e,t,i){var s=i.quoteStyle||t,n=L[s];return n+e+n}function R(e){return m.call(String(e),/"/g,""")}function W(e){return!("[object Array]"!==$(e)||O&&"object"==typeof e&&O in e)}function N(e){return!("[object RegExp]"!==$(e)||O&&"object"==typeof e&&O in e)}function _(e){if(j)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!C)return!1;try{return C.call(e),!0}catch(t){}return!1}Ei=function e(t,r,o,p){var b=r||{};if(U(b,"quoteStyle")&&!U(L,b.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(U(b,"maxStringLength")&&("number"==typeof b.maxStringLength?b.maxStringLength<0&&b.maxStringLength!==1/0:null!==b.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var w=!U(b,"customInspect")||b.customInspect;if("boolean"!=typeof w&&"symbol"!==w)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(U(b,"indent")&&null!==b.indent&&"\t"!==b.indent&&!(parseInt(b.indent,10)===b.indent&&b.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(U(b,"numericSeparator")&&"boolean"!=typeof b.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var P=b.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return q(t,b);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var T=String(t);return P?M(t,T):T}if("bigint"==typeof t){var D=String(t)+"n";return P?M(t,D):D}var B=void 0===b.depth?5:b.depth;if(void 0===o&&(o=0),o>=B&&B>0&&"object"==typeof t)return W(t)?"[Array]":"[Object]";var H,X=function(e,t){var i;if("\t"===e.indent)i="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;i=S.call(Array(e.indent+1)," ")}return{base:i,prev:S.call(Array(t+1),i)}}(b,o);if(void 0===p)p=[];else if(V(p,t)>=0)return"[Circular]";function ee(t,i,s){if(i&&(p=k.call(p)).push(i),s){var n={depth:b.depth};return U(b,"quoteStyle")&&(n.quoteStyle=b.quoteStyle),e(t,n,o+1,p)}return e(t,b,o+1,p)}if("function"==typeof t&&!N(t)){var te=function(e){if(e.name)return e.name;var t=g.call(y.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),ie=Z(t,ee);return"[Function"+(te?": "+te:" (anonymous)")+"]"+(ie.length>0?" { "+S.call(ie,", ")+" }":"")}if(_(t)){var se=j?m.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):C.call(t);return"object"!=typeof t||j?se:K(se)}if((H=t)&&"object"==typeof H&&("undefined"!=typeof HTMLElement&&H instanceof HTMLElement||"string"==typeof H.nodeName&&"function"==typeof H.getAttribute)){for(var ne="<"+v.call(String(t.nodeName)),re=t.attributes||[],oe=0;oe"}if(W(t)){if(0===t.length)return"[]";var ae=Z(t,ee);return X&&!function(e){for(var t=0;t=0)return!1;return!0}(ae)?"["+J(ae,X)+"]":"[ "+S.call(ae,", ")+" ]"}if(function(e){return!("[object Error]"!==$(e)||O&&"object"==typeof e&&O in e)}(t)){var le=Z(t,ee);return"cause"in Error.prototype||!("cause"in t)||A.call(t,"cause")?0===le.length?"["+String(t)+"]":"{ ["+String(t)+"] "+S.call(le,", ")+" }":"{ ["+String(t)+"] "+S.call(x.call("[cause]: "+ee(t.cause),le),", ")+" }"}if("object"==typeof t&&w){if(F&&"function"==typeof t[F]&&z)return z(t,{depth:B-o});if("symbol"!==w&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{a.call(e)}catch(ne){return!0}return e instanceof Map}catch(t){}return!1}(t)){var he=[];return s&&s.call(t,(function(e,i){he.push(ee(i,t,!0)+" => "+ee(e,t))})),Q("Map",i.call(t),he,X)}if(function(e){if(!a||!e||"object"!=typeof e)return!1;try{a.call(e);try{i.call(e)}catch(t){return!0}return e instanceof Set}catch(s){}return!1}(t)){var ce=[];return l&&l.call(t,(function(e){ce.push(ee(e,t))})),Q("Set",a.call(t),ce,X)}if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{h.call(e,h);try{c.call(e,c)}catch(ne){return!0}return e instanceof WeakMap}catch(t){}return!1}(t))return Y("WeakMap");if(function(e){if(!c||!e||"object"!=typeof e)return!1;try{c.call(e,c);try{h.call(e,h)}catch(ne){return!0}return e instanceof WeakSet}catch(t){}return!1}(t))return Y("WeakSet");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{return d.call(e),!0}catch(t){}return!1}(t))return Y("WeakRef");if(function(e){return!("[object Number]"!==$(e)||O&&"object"==typeof e&&O in e)}(t))return K(ee(Number(t)));if(function(e){if(!e||"object"!=typeof e||!I)return!1;try{return I.call(e),!0}catch(t){}return!1}(t))return K(ee(I.call(t)));if(function(e){return!("[object Boolean]"!==$(e)||O&&"object"==typeof e&&O in e)}(t))return K(u.call(t));if(function(e){return!("[object String]"!==$(e)||O&&"object"==typeof e&&O in e)}(t))return K(ee(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||void 0!==n&&t===n)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==$(e)||O&&"object"==typeof e&&O in e)}(t)&&!N(t)){var de=Z(t,ee),ue=E?E(t)===Object.prototype:t instanceof Object||t.constructor===Object,pe=t instanceof Object?"":"null prototype",ye=!ue&&O&&Object(t)===t&&O in t?f.call($(t),8,-1):pe?"Object":"",ge=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(ye||pe?"["+S.call(x.call([],ye||[],pe||[]),": ")+"] ":"");return 0===de.length?ge+"{}":X?ge+"{"+J(de,X)+"}":ge+"{ "+S.call(de,", ")+" }"}return String(t)};var H=Object.prototype.hasOwnProperty||function(e){return e in this};function U(e,t){return H.call(e,t)}function $(e){return p.call(e)}function V(e,t){if(e.indexOf)return e.indexOf(t);for(var i=0,s=e.length;it.maxStringLength){var i=e.length-t.maxStringLength,s="... "+i+" more character"+(i>1?"s":"");return q(f.call(e,0,t.maxStringLength),t)+s}var n=B[t.quoteStyle||"single"];return n.lastIndex=0,G(m.call(m.call(e,n,"\\$1"),/[\x00-\x1f]/g,X),"single",t)}function X(e){var t=e.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return i?"\\"+i:"\\x"+(t<16?"0":"")+b.call(t.toString(16))}function K(e){return"Object("+e+")"}function Y(e){return e+" { ? }"}function Q(e,t,i,s){return e+" ("+t+") {"+(s?J(i,s):S.call(i,", "))+"}"}function J(e,t){if(0===e.length)return"";var i="\n"+t.prev+t.base;return i+S.call(e,","+i)+"\n"+t.prev}function Z(e,t){var i=W(e),s=[];if(i){s.length=e.length;for(var n=0;n=e.length;return s||(i=e[t],t+=1),{done:s,value:i}}}},p=function(t,i){if(s(t)||e(t))return u(t);if(n(t)){var r=0;return{next:function(){var e=function(e,t){if(t+1>=e.length)return t+1;var i=c(e,t);if(i<55296||i>56319)return t+1;var s=c(e,t+1);return s<56320||s>57343?t+1:t+2}(t,r),i=d(t,r,e);return r=e,{done:e>t.length,value:i}}}}return i&&void 0!==t["_es6-shim iterator_"]?t["_es6-shim iterator_"]():void 0};if(o||a){var y=bs(),g=vs(),f=l("Map.prototype.forEach",!0),m=l("Set.prototype.forEach",!0);if("undefined"==typeof process||!process.versions||!process.versions.node)var b=l("Map.prototype.iterator",!0),v=l("Set.prototype.iterator",!0);var w=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),x=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0);Ci.exports=function(e){return function(e){if(y(e)){if(b)return t(b(e));if(w)return w(e);if(f){var i=[];return f(e,(function(e,t){h(i,[t,e])})),u(i)}}if(g(e)){if(v)return t(v(e));if(x)return x(e);if(m){var s=[];return m(e,(function(e){h(s,e)})),u(s)}}}(e)||p(e)}}else Ci.exports=function(e){if(null!=e)return p(e,!0)}}return Ci.exports}function xs(){if(Ki)return Xi;Ki=1;var e=function(e){return e!=e};return Xi=function(t,i){return 0===t&&0===i?1/t==1/i:t===i||!(!e(t)||!e(i))}}function Ss(){if(Qi)return Yi;Qi=1;var e=xs();return Yi=function(){return"function"==typeof Object.is?Object.is:e}}function ks(){if(ss)return is;ss=1;var e=mi(),t=bi(),i=Gt()("%ArrayBuffer%",!0),s=t("ArrayBuffer.prototype.byteLength",!0),n=t("Object.prototype.toString"),r=!!i&&!s&&new i(0).slice,o=!!r&&e(r);return is=s||o?function(e){if(!e||"object"!=typeof e)return!1;try{return s?s(e):o(e,0),!0}catch(t){return!1}}:i?function(e){return"[object ArrayBuffer]"===n(e)}:function(e){return!1}}function Ps(){if(hs)return ls;hs=1;var e=bi()("SharedArrayBuffer.prototype.byteLength",!0);return ls=e?function(t){if(!t||"object"!=typeof t)return!1;try{return e(t),!0}catch(i){return!1}}:function(e){return!1}}var Is,Ts={exports:{}};var Cs,js,Os,As,Es,Ms,zs,Ds={exports:{}};var Fs,Ls,Bs,Gs,Rs,Ws,Ns,_s,Hs,Us,$s,Vs,qs,Xs,Ks,Ys,Qs,Js={exports:{}};function Zs(){if(Fs)return Js.exports;Fs=1;var e=Gt(),t=bi(),i=e("%WeakSet%",!0),s=t("WeakSet.prototype.has",!0);if(s){var n=t("WeakMap.prototype.has",!0);Js.exports=function(e){if(!e||"object"!=typeof e)return!1;try{if(s(e,s),n)try{n(e,n)}catch(t){return!0}return e instanceof i}catch(t){}return!1}}else Js.exports=function(e){return!1};return Js.exports}function en(){if(Bs)return Ls;Bs=1;var e=bs(),t=vs(),i=function(){if(zs)return Ms;zs=1;var e,t="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,i="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;t||(e=function(e){return!1});var s=t?t.prototype.has:null,n=i?i.prototype.has:null;return e||s||(e=function(e){return!1}),Ms=e||function(e){if(!e||"object"!=typeof e)return!1;try{if(s.call(e,s),n)try{n.call(e,n)}catch(i){return!0}return e instanceof t}catch(i){}return!1}}(),s=Zs();return Ls=function(n){if(n&&"object"==typeof n){if(e(n))return"Map";if(t(n))return"Set";if(i(n))return"WeakMap";if(s(n))return"WeakSet"}return!1}}function tn(){return Hs?_s:(Hs=1,_s=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"])}function sn(){if($s)return Us;$s=1;var e=tn(),t="undefined"==typeof globalThis?n:globalThis;return Us=function(){for(var i=[],s=0;s=3&&(o=r),"[object Array]"===t.call(s)?function(e,t,s){for(var n=0,r=e.length;n-1?i:"Object"===i&&function(t){var i=!1;return e(p,(function(e,s){if(!i)try{e(t),i=c(s,1)}catch(n){}})),i}(t)}return r?function(t){var i=!1;return e(p,(function(e,s){if(!i)try{"$"+e(t)===s&&(i=c(s,1))}catch(n){}})),i}(t):null}}function rn(){if(Ks)return Xs;Ks=1;var e=bi()("ArrayBuffer.prototype.byteLength",!0),t=ks();return Xs=function(i){return t(i)?e?e(i):i.byteLength:NaN}}const on=r(function(){if(Qs)return Ys;Qs=1;var e=function(){if(ii)return ti;ii=1;var e=Ht(),t=mi(),i=vi(),s=wi(),n=function(){if(ei)return Zt;ei=1;var e=Ht(),t=wi();return Zt=function(){var i=t();return e(Object,{assign:i},{assign:function(){return Object.assign!==i}}),i}}(),r=t.apply(s()),o=function(e,t){return r(Object,arguments)};return e(o,{getPolyfill:s,implementation:i,shim:n}),ti=o}(),t=bi(),i=function(){if(yi)return pi;yi=1;var e=Ht(),t=mi(),i=xi(),s=Si(),n=function(){if(ui)return di;ui=1;var e=Ht().supportsDescriptors,t=Si(),i=Object.getOwnPropertyDescriptor,s=Object.defineProperty,n=TypeError,r=Object.getPrototypeOf,o=/a/;return di=function(){if(!e||!r)throw new n("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var a=t(),l=r(o),h=i(l,"flags");return h&&h.get===a||s(l,"flags",{configurable:!0,enumerable:!1,get:a}),a}}(),r=t(s());return e(r,{getPolyfill:s,implementation:i,shim:n}),pi=r}(),s=Gt(),n=ws(),r=gs(),o=function(){if(ts)return es;ts=1;var e=Ht(),t=mi(),i=xs(),s=Ss(),n=function(){if(Zi)return Ji;Zi=1;var e=Ss(),t=Ht();return Ji=function(){var i=e();return t(Object,{is:i},{is:function(){return Object.is!==i}}),i}}(),r=t(s(),Object);return e(r,{getPolyfill:s,implementation:i,shim:n}),es=r}(),a=Oi(),l=fs(),h=ks(),c=function(){if(rs)return ns;rs=1;var e=Date.prototype.getDay,t=Object.prototype.toString,i=ji()();return ns=function(s){return"object"==typeof s&&null!==s&&(i?function(t){try{return e.call(t),!0}catch(i){return!1}}(s):"[object Date]"===t.call(s))}}(),d=function(){if(as)return os;as=1;var e,t,i,s,n=bi(),r=ji()();if(r){e=n("Object.prototype.hasOwnProperty"),t=n("RegExp.prototype.exec"),i={};var o=function(){throw i};s={toString:o,valueOf:o},"symbol"==typeof Symbol.toPrimitive&&(s[Symbol.toPrimitive]=o)}var a=n("Object.prototype.toString"),l=Object.getOwnPropertyDescriptor;return os=r?function(n){if(!n||"object"!=typeof n)return!1;var r=l(n,"lastIndex");if(!r||!e(r,"value"))return!1;try{t(n,s)}catch(o){return o===i}}:function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===a(e)}}(),u=Ps(),p=It(),y=function(){if(Es)return As;Es=1;var e=ms(),t=function(){if(ds)return cs;ds=1;var e=Number.prototype.toString,t=Object.prototype.toString,i=ji()();return cs=function(s){return"number"==typeof s||"object"==typeof s&&(i?function(t){try{return e.call(t),!0}catch(i){return!1}}(s):"[object Number]"===t.call(s))}}(),i=function(){if(ps)return us;ps=1;var e=bi(),t=e("Boolean.prototype.toString"),i=e("Object.prototype.toString"),s=ji()();return us=function(e){return"boolean"==typeof e||null!==e&&"object"==typeof e&&(s&&Symbol.toStringTag in e?function(e){try{return t(e),!0}catch(i){return!1}}(e):"[object Boolean]"===i(e))}}(),s=function(){if(Is)return Ts.exports;Is=1;var e=Object.prototype.toString;if(Dt()()){var t=Symbol.prototype.toString,i=/^Symbol\(.*\)$/;Ts.exports=function(s){if("symbol"==typeof s)return!0;if("[object Symbol]"!==e.call(s))return!1;try{return function(e){return"symbol"==typeof e.valueOf()&&i.test(t.call(e))}(s)}catch(n){return!1}}}else Ts.exports=function(e){return!1};return Ts.exports}(),n=function(){if(Os)return Ds.exports;if(Os=1,function(){if(js)return Cs;js=1;var e="undefined"!=typeof BigInt&&BigInt;return Cs=function(){return"function"==typeof e&&"function"==typeof BigInt&&"bigint"==typeof e(42)&&"bigint"==typeof BigInt(42)}}()()){var e=BigInt.prototype.valueOf;Ds.exports=function(t){return null!=t&&"boolean"!=typeof t&&"string"!=typeof t&&"number"!=typeof t&&"symbol"!=typeof t&&"function"!=typeof t&&("bigint"==typeof t||function(t){try{return e.call(t),!0}catch(i){}return!1}(t))}}else Ds.exports=function(e){return!1};return Ds.exports}();return As=function(r){return null==r||"object"!=typeof r&&"function"!=typeof r?null:e(r)?"String":t(r)?"Number":i(r)?"Boolean":s(r)?"Symbol":n(r)?"BigInt":void 0}}(),g=en(),f=nn(),m=rn(),b=t("SharedArrayBuffer.prototype.byteLength",!0),v=t("Date.prototype.getTime"),w=Object.getPrototypeOf,x=t("Object.prototype.toString"),S=s("%Set%",!0),k=t("Map.prototype.has",!0),P=t("Map.prototype.get",!0),I=t("Map.prototype.size",!0),T=t("Set.prototype.add",!0),C=t("Set.prototype.delete",!0),j=t("Set.prototype.has",!0),O=t("Set.prototype.size",!0);function A(e,t,i,s){for(var r,o=n(e);(r=o.next())&&!r.done;)if(F(t,r.value,i,s))return C(e,r.value),!0;return!1}function E(e){return void 0===e?null:"object"!=typeof e?"symbol"!=typeof e&&("string"!=typeof e&&"number"!=typeof e||+e==+e):void 0}function M(t,i,s,n,r,o){var a=E(s);if(null!=a)return a;var l=P(i,a),h=e({},r,{strict:!1});return!(void 0===l&&!k(i,a)||!F(n,l,h,o))&&!k(t,a)&&F(n,l,h,o)}function z(e,t,i){var s=E(i);return null!=s?s:j(t,s)&&!j(e,s)}function D(e,t,i,s,r,o){for(var a,l,h=n(e);(a=h.next())&&!a.done;)if(F(i,l=a.value,r,o)&&F(s,P(t,l),r,o))return C(e,l),!0;return!1}function F(t,s,r,C){var E=r||{};if(E.strict?o(t,s):t===s)return!0;if(y(t)!==y(s))return!1;if(!t||!s||"object"!=typeof t&&"object"!=typeof s)return E.strict?o(t,s):t==s;var B,G=C.has(t),R=C.has(s);if(G&&R){if(C.get(t)===C.get(s))return!0}else B={};return G||C.set(t,B),R||C.set(s,B),function(t,s,r,o){var y,C;if(typeof t!=typeof s)return!1;if(null==t||null==s)return!1;if(x(t)!==x(s))return!1;if(a(t)!==a(s))return!1;if(l(t)!==l(s))return!1;var E=t instanceof Error,B=s instanceof Error;if(E!==B)return!1;if((E||B)&&(t.name!==s.name||t.message!==s.message))return!1;var G=d(t),R=d(s);if(G!==R)return!1;if((G||R)&&(t.source!==s.source||i(t)!==i(s)))return!1;var W=c(t),N=c(s);if(W!==N)return!1;if((W||N)&&v(t)!==v(s))return!1;if(r.strict&&w&&w(t)!==w(s))return!1;var _=f(t),H=f(s);if(_!==H)return!1;if(_||H){if(t.length!==s.length)return!1;for(y=0;y=0;y--)if(Y[y]!=Q[y])return!1;for(y=Y.length-1;y>=0;y--)if(!F(t[C=Y[y]],s[C],r,o))return!1;var J=g(t),Z=g(s);return J===Z&&("Set"===J||"Set"===Z?function(e,t,i,s){if(O(e)!==O(t))return!1;for(var r,o,a,l=n(e),h=n(t);(r=l.next())&&!r.done;)if(r.value&&"object"==typeof r.value)a||(a=new S),T(a,r.value);else if(!j(t,r.value)){if(i.strict)return!1;if(!z(e,t,r.value))return!1;a||(a=new S),T(a,r.value)}if(a){for(;(o=h.next())&&!o.done;)if(o.value&&"object"==typeof o.value){if(!A(a,o.value,i.strict,s))return!1}else if(!i.strict&&!j(e,o.value)&&!A(a,o.value,i.strict,s))return!1;return 0===O(a)}return!0}(t,s,r,o):"Map"!==J||function(t,i,s,r){if(I(t)!==I(i))return!1;for(var o,a,l,h,c,d,u=n(t),p=n(i);(o=u.next())&&!o.done;)if(h=o.value[0],c=o.value[1],h&&"object"==typeof h)l||(l=new S),T(l,h);else if(void 0===(d=P(i,h))&&!k(i,h)||!F(c,d,s,r)){if(s.strict)return!1;if(!M(t,i,h,c,s,r))return!1;l||(l=new S),T(l,h)}if(l){for(;(a=p.next())&&!a.done;)if(h=a.value[0],d=a.value[1],h&&"object"==typeof h){if(!D(l,t,h,d,s,r))return!1}else if(!(s.strict||t.has(h)&&F(P(t,h),d,s,r)||D(l,t,h,d,e({},s,{strict:!1}),r)))return!1;return 0===O(l)}return!0}(t,s,r,o))}(t,s,E,C)}function L(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length||"function"!=typeof e.copy||"function"!=typeof e.slice||e.length>0&&"number"!=typeof e[0]||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))}return Ys=function(e,t,i){return F(e,t,i,r())}}()),an={fontFamily:"m6x11, sans-serif",fontSize:24,color:`#${M}`};class ln extends a.GameObjects.Text{constructor(e,t,i=3500,s=D){const n=je(e,ln).reduce(((e,t)=>Math.max(e,t.y-20)),0)+65;super(e,20,n,t,{...an,backgroundColor:"#"+s,padding:{x:10,y:5}}),this.setAlpha(0).setDepth(x.Overlay).setScrollFactor(0),e.add.existing(this),e.add.tween({targets:this,alpha:1,scale:1.05,y:n+10,duration:350,hold:i,yoyo:!0,repeat:0,onComplete:()=>this.destroy()})}}let hn=1;class cn extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(e){super({game:e,renderTarget:!0,fragShader:"\nprecision mediump float;\n\nuniform float uAlpha;\nuniform sampler2D uMainSampler;\n\nvarying vec2 outTexCoord;\n\n// slight modifications made to original shader\n// use alpha channel for fragColor + changed uniform names\n\n// original shader from: https://www.shadertoy.com/view/WsVSzV\n// tips for chromatic aberration: https://lettier.github.io/3d-game-shaders-for-beginners/chromatic-aberration.html\n\nfloat warp = 0.35; // simulate curvature of CRT monitor (larger number = more curvature)\nfloat scan = 0.75; // simulate darkness between scanlines\nfloat scanSize = 0.75; // size of scanlines [0.0 - 2.0] (smaller number = taller scanlines)\n\nfloat chromaticAberration = 0.25 * uAlpha;\nfloat redOffset = 0.006 * chromaticAberration;\nfloat greenOffset = 0.003 * chromaticAberration;\nfloat blueOffset = -0.003 * chromaticAberration;\n\nvoid mainImage(out vec4 fragColor,in vec2 fragCoord)\n{\n if (uAlpha <= 0.0) {\n fragColor = texture2D(uMainSampler, outTexCoord);\n return;\n }\n\n // squared distance from center\n vec2 uv = outTexCoord;\n vec2 dc = abs(0.5-uv);\n dc *= dc;\n\n // warp the fragment coordinates\n uv.x -= 0.5; uv.x *= 1.0+(dc.y*(0.3*warp)); uv.x += 0.5;\n uv.y -= 0.5; uv.y *= 1.0+(dc.x*(0.4*warp)); uv.y += 0.5;\n\n vec2 chromaticOffset = vec2((abs(0.5-uv) + 0.5) * 2.);\n\n vec4 color;\n color.r = texture2D(uMainSampler,uv + vec2(redOffset * chromaticOffset)).r;\n color.g = texture2D(uMainSampler,uv + vec2(greenOffset * chromaticOffset)).g;\n color.b = texture2D(uMainSampler,uv + vec2(blueOffset * chromaticOffset)).b;\n color.a = texture2D(uMainSampler,uv).a;\n\n // sample inside boundaries, otherwise set to black\n if (uv.y > 1.0 || uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0) {\n fragColor = vec4(0.0);\n } else {\n // determine if we are drawing in a scanline\n float apply = abs(sin(fragCoord.y * scanSize)*0.5*scan);\n\n apply = uAlpha * apply;\n\n // sample the texture\n fragColor = vec4(mix(color.rgb,vec3(0.0), apply), color.a);\n }\n}\n\nvoid main(void)\n{\n mainImage(gl_FragColor, gl_FragCoord.xy);\n}\n"})}onPreRender(){this.set1f("uAlpha",hn)}}class dn extends Phaser.Plugins.ScenePlugin{boot(){var e;null==(e=this.systems)||e.events.on("start",this.applyPipeline,this);const{save:t}=mn();un(t.settings.useShader)}applyPipeline(){var e,t;null==(e=this.scene)||e.cameras.main.setPostPipeline("CRTPipeline"),(null==(t=this.scene)?void 0:t.cameras.main.getPostPipeline(cn)).bootFX()}}function un(e){w.useShader=void 0!==e?e:!w.useShader,hn=w.useShader?1:0}let pn=0;class yn extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(e){super({game:e,fragShader:"\nprecision mediump float;\n\nuniform float uAlpha;\nuniform sampler2D uMainSampler;\n\nvarying vec2 outTexCoord;\n\nvoid main(void)\n{\n vec4 baseColor = vec4(texture2D(uMainSampler, outTexCoord).rgba);\n vec4 newColor = baseColor;\n newColor.g *= 1.25;\n newColor.r *= 2.5;\n newColor.b *= 3.;\n\n gl_FragColor = mix(baseColor, newColor, uAlpha);\n}\n"})}onPreRender(){this.set1f("uAlpha",pn)}}function gn(e,t){pn!==(t?.85:0)&&e.tweens.addCounter({from:pn,to:t?.85:0,onUpdate:e=>{pn=e.getValue()},duration:2500,ease:"Bounce"})}function fn(e){return{player:{x:e.player.x,y:e.player.y,flip:e.player.flipX},journal:e.player.journal.journal.sort(),inventory:e.player.inventory.inventory.sort(((e,t)=>e.type-t.type)),quests:e.player.quests.quests.sort(((e,t)=>e.id-t.id)),gameState:e.player.gameState.data,settings:{gamepad:e.gamepad.visible,debug:w.debug,zoomed:w.zoomed,useShader:w.useShader,time:Date.now(),muted:e.sound.mute}}}function mn(){const e=localStorage.getItem(Rr);let t,i;try{e&&(t=JSON.parse(e))}catch(s){console.error(s),i=s}return{save:t||Hr[Wr.New],error:i,newGame:!t}}const bn={journal:{enumObj:j,enumName:"JournalEntry"},inventory:{enumObj:P,enumName:"ItemType"},type:{enumObj:P,enumName:"ItemType"},quests:{enumObj:I,enumName:"QuestType"},id:{enumObj:I,enumName:"QuestType"}};function vn(e,t){const i={...w};return w.debug=e.settings.debug,w.zoomed=e.settings.zoomed,w.useShader=e.settings.useShader,un(w.useShader),gn(t,!1),w.zoomed!==i.zoomed?(function(e,t){const i=t?h:l;w.zoomed=t,w.width=i.width,w.height=i.height,w.cameraOffset=i.height/3,e.scale.setGameSize(i.width,i.height),e.scene.restart()}(t,w.zoomed),!0):w.debug!==i.debug&&(t.scene.restart(),!0)}function wn(e){const{save:t,error:i,newGame:s}=mn();i&&new ln(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4);try{vn(t,e),e.sound.mute=t.settings.muted,e.player.setX(t.player.x),e.player.setY(t.player.y),e.player.previousPosition.set(t.player.x+(t.player.flip?1:-1),t.player.y),e.time.delayedCall(50,(()=>{try{e.player.inventory.createUI(),e.player.quests.createUI(),e.player.journal.createUI(),s&&function(e){e.player.message.setDialog({messages:["Now that I have arrived in town, I should talk to the townsfolk about the strange occurrences.","Maybe someone has seen something that could help me start my investigation."]},void 0,"player_portrait")}(e),t.inventory.sort(((e,t)=>e.type-t.type)).forEach((t=>e.player.inventory.addItem(t,!0))),t.journal.sort().reverse().forEach((t=>e.player.journal.addEntry(t,!0))),t.quests.sort(((e,t)=>e.id-t.id)).forEach((t=>e.player.quests.addQuest(t,!0))),e.player.gameState.updateData(t.gameState,!0)}catch(i){console.error(i),new ln(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4,L),xn(e,Hr[Wr.New]),wn(e)}})),e.gamepad.setVisible(t.settings.gamepad);const i=on(t,Hr[Wr.New])?"[New]":"[Storage]";w.prod||e.time.delayedCall(200,(()=>{new ln(e,`Game Loaded ${w.prod?"":i}`)})),on(t,Hr[Wr.New])&&xn(e,void 0,!0)}catch(n){console.error(n),new ln(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4,L),xn(e,Hr[Wr.New]),wn(e)}}function xn(e,t,i){const s=fn(e);localStorage.setItem(Rr,JSON.stringify(t||s)),i||e.tweens.add({targets:e.saveIcon,alpha:.7,scale:.6,duration:500,hold:250,yoyo:!0})}function Sn(e){w.prod&&xn(e)}class kn extends a.GameObjects.Container{constructor(e,i){var s;super(e,0,0),t(this,"text"),t(this,"rect"),t(this,"player"),t(this,"activeElement"),t(this,"outline"),t(this,"scene"),t(this,"dayNight",!1),this.scene=e,this.player=i,e.physics.world.drawDebug=w.debug,w.debug?e.physics.world.createDebugGraphic():null==(s=e.physics.world.debugGraphic)||s.clear(),this.createEventListeners(),w.debug&&(this.setScrollFactor(0).setDepth(x.Debug).setAlpha(.8),this.scene.add.existing(this),this.rect=e.add.rectangle(0,0,0,0,_(F)).setOrigin(0).setDepth(x.Debug),this.add(this.rect),this.text=e.add.bitmapText(20,90,"m6x11-24",""),this.add(this.text),this.outline=e.add.rectangle(0,0,0,0).setStrokeStyle(2,65280).setScale(1.1).setDepth(x.Debug))}createEventListeners(){var e,t,i,s,n,r,o,a,l;null==(e=this.scene.input.keyboard)||e.on("keydown-K",(()=>{xn(this.scene)})),null==(t=this.scene.input.keyboard)||t.on("keydown-L",(()=>{this.scene.scene.restart()})),null==(i=this.scene.input.keyboard)||i.on("keydown-M",(()=>{xn(this.scene,Hr[Wr.Act2]),this.scene.scene.restart()})),null==(s=this.scene.input.keyboard)||s.on("keydown-N",(()=>{localStorage.removeItem(Rr),this.scene.scene.start("Preloader")})),null==(n=this.scene.input.keyboard)||n.on("keydown-Z",(()=>{w.debug=!w.debug,xn(this.scene),this.scene.scene.restart()})),null==(r=this.scene.input.keyboard)||r.on("keydown-FORWARD_SLASH",(()=>{var e;X(e=this.scene)?function(e,t=!0){q||(Y(e,R,t),Q(e,1),e.lights.lights.forEach((i=>{const s=i.intensity;i.setVisible(!0),t&&(i.setIntensity(0),e.tweens.add({targets:i,duration:V,intensity:s}))})))}(e):K(e)})),null==(o=this.scene.input.keyboard)||o.on("keydown-CLOSED_BRACKET",(()=>{ie(this.scene,"DebugTool")})),w.debug&&(null==(a=this.scene.input.keyboard)||a.on("keydown-COMMA",(()=>{const e=this.scene.lights.lights;console.table(e,["x","y"])})),null==(l=this.scene.input.keyboard)||l.on("keydown-PERIOD",(()=>{const e=this.scene.input.activePointer;new ae(this.scene,e.worldX,e.worldY,100,_(G),1)})),this.scene.input.on("gameobjectdown",((e,t)=>{1===e.buttons&&(t!==this.activeElement?this.activeElement=t:this.activeElement=void 0)})),this.scene.input.on("drag",((e,t)=>{this.activeElement===t&&t.setPosition(e.worldX,e.worldY)})),this.scene.input.on("wheel",((e,t,i,s,n)=>{this.scene.cameras.main.zoom=Math.max(.01,this.scene.cameras.main.zoom+5e-4*s)})),this.scene.input.on("pointerup",(e=>{1===e.button&&(this.scene.cameras.main.zoom=1)})))}update(){if(!w.debug)return;const e=this.scene.input.activePointer,t=[`FPS (now): ${(1e3/this.scene.game.loop.delta).toFixed(1)}`,`FPS (avg): ${this.scene.game.loop.actualFps.toFixed(1)}`,`Frame Time: ${this.scene.game.loop.delta.toFixed(2)}`,`Zoom: ${this.scene.cameras.main.zoom.toFixed(2)}`,"",`Player x: ${this.player.x.toFixed(1)}`,`Player y: ${this.player.y.toFixed(1)}`,"",`Mouse x: ${e.worldX.toFixed(1)}`,`Mouse y: ${e.worldY.toFixed(1)}`];if(this.activeElement&&(t.push(""),t.push(`Active x: ${this.activeElement.x.toFixed(1)}`),t.push(`Active y: ${this.activeElement.y.toFixed(1)}`)),this.text.setText(t),this.rect.setPosition(this.text.x-10,this.text.y-10).setSize(this.text.displayWidth+20,this.text.displayHeight+20),this.activeElement){this.outline.setPosition(this.activeElement.x,this.activeElement.y),this.outline.setSize(this.activeElement.displayWidth,this.activeElement.displayHeight),this.outline.setOrigin(this.activeElement.originX,this.activeElement.originY);const e=this.activeElement.body;(e&&e instanceof a.Physics.Arcade.Body||e instanceof a.Physics.Arcade.StaticBody)&&e.updateFromGameObject()}else this.outline.setSize(0,0)}}class Pn extends a.Physics.Arcade.Image{constructor(e,i,s){var n;const{x:r,y:o,image:l,scale:h}=i;super(e,r,o,l),t(this,"player"),t(this,"initialized",!1),t(this,"info"),t(this,"center"),this.name=`Background-${i.image}`,this.info=i,this.player=s,this.setOrigin(0).setDepth(x.Backgrounds),ze(this,i);const c=null==(n=e.textures.get(l))?void 0:n.getSourceImage();this.center=new a.Math.Vector2(r+c.width*(h||1)/2,o+c.height*((h||1)/2)),w.debug&&e.add.rectangle(this.center.x,this.center.y,c.width,c.height).setStrokeStyle(10,26214).setOrigin(.5)}lazyInit(e){(e||!this.initialized&&te(this.center,this.player,2e3))&&(this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0}),this.initialized=!0)}update(){this.lazyInit()}}function In(){return Math.random()-.5}w.dayMinutes,a.GameObjects.Container;const Tn=[3200,600],Cn=[5350,690],jn=[500,200,100,50,10];class On extends a.GameObjects.GameObject{constructor(e,i,s,n=40,r=[1400,600]){super(e,"fireflies"),t(this,"scene"),t(this,"center",new a.Math.Vector2(0,0)),t(this,"lights",[]),t(this,"count"),t(this,"centers",[]),t(this,"bounds",[1e3,400]),t(this,"biases",[]),t(this,"initialized",!1),t(this,"debug"),e.add.existing(this),this.scene=e,this.count=n,this.bounds=r,this.setPosition(i,s)}setPosition(e,t){this.center.set(e,t),this.centers=[];for(let i=0;ie.visible=!1));const i=e/1e3*.025,s=Math.cos(i),n=Math.sin(i);this.lights.forEach(((e,t)=>{const r=this.biases[t],o=Math.cos(70*i+r[10]);e.visible=!0,e.intensity=Math.min(.05+Math.abs(r[4]*o+r[3]*s+r[4]*s)/50,.4),e.x=s*r[0]+n*r[1]+s*r[2]+n*r[3]+s*r[4]+this.centers[t].x,e.y=n*r[5]+s*r[6]+n*r[7]+s*r[8]+n*r[9]+this.centers[t].y}))}}const An={[A.LabStairs]:{x:-1670,y:1730,size:{x:80,y:80},text:"Press [UP] to go upstairs"}};class En extends a.GameObjects.Image{constructor(e,i,s){const{x:n,y:r}=An[i];super(e,n,r,""),t(this,"player"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`HelperText-${i}`,this.player=s}lazyInit(e){if(!e&&(this.initialized||!te(this,this.player)))return;const{size:t}=An[A.LabStairs];this.setDepth(x.Items),this.setDisplaySize(t.x,t.y),w.debug||this.setAlpha(0),this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0}),this.initialized=!0}getButtonPrompt(){return An[A.LabStairs].text}onInteract(e){return S.None}update(){this.lazyInit()}}class Mn extends a.GameObjects.Container{constructor(e,i){const{position:s,size:n}=i;super(e,s.x,s.y),t(this,"initialized",!1),t(this,"center"),t(this,"player"),t(this,"layers",[]),t(this,"info"),this.name=`ParallaxBackground-${s.x}-${s.y}`,this.info=i,this.player=e.player,this.setDepth(x.Backgrounds),this.center=new a.Math.Vector2(s.x+.5*n.x,s.y+.5*n.y),w.debug&&this.add(e.add.rectangle(this.center.x,this.center.y,n.x,n.y).setStrokeStyle(10,26214).setOrigin(.5))}lazyInit(e){if(!e&&(this.initialized||!te(this.center,this.player,this.info.size.x)))return;this.scene.add.existing(this),this.scene.physics.add.existing(this);const{position:t,size:i,scale:s,images:n,skipLighting:r}=this.info;n.forEach((({texture:e,scale:n,speed:o})=>{const a=this.scene.add.tileSprite(t.x,t.y,i.x,i.y,e);a.setOrigin(0).setTileScale((s||1)*(n||1)).setData("speed",o),r||a.setPipeline("Light2D"),a.setPostPipeline("XRayPipeline"),this.add(a),this.layers.push(a)})),w.debug&&this.setInteractive({draggable:!0,hitArea:new a.Geom.Rectangle(t.x,t.y,i.x,i.y),hitAreaCallback:a.Geom.Rectangle.Contains}),this.initialized=!0}update(){if(this.lazyInit(),!this.initialized||!this.getBounds().contains(this.player.x,this.player.y))return;const{size:e}=this.info,t=a.Math.Clamp(this.player.x-this.center.x,-.5*e.x,.5*e.x)/e.x;this.layers.forEach((i=>{i.tilePositionX=t*i.getData("speed")*e.x}))}}class zn extends a.GameObjects.Text{constructor(e){super(e,w.width/2,w.height-50,"",an),this.setOrigin(.5).setBackgroundColor("#"+F).setPadding(10,5).setAlign("center").setAlpha(.8).setScrollFactor(0).setDepth(x.Overlay).setVisible(!1),e.add.existing(this)}}const Dn={octave:3.5,speed:1,volume:1,type:"sine"},Fn={[T.Inventor]:{octave:3.3,speed:1,volume:1.8},[T.Stranger]:{octave:2.8,speed:1.1,volume:2.6},[T.Sphinx]:{octave:2.5,speed:2,volume:2,type:"triangle"},[T.Mayor]:{octave:3.9,speed:.8,volume:.8},[T.ClockTower]:{octave:2.1,speed:1.5,volume:1.5,type:"sawtooth"},player:{octave:3.7,speed:.75,volume:.9}};class Ln extends a.GameObjects.Text{constructor(e,i,s,n,r,o){super(e,i,s,n,{...an,fontSize:48,backgroundColor:`#${D}`,padding:{x:15,y:10},...o}),t(this,"onClick"),t(this,"disabled"),t(this,"selected"),this.setOrigin(.5),e.add.existing(this),this.onClick=r,this.disabled=!1,this.selected=!1,this.setInteractive({useHandCursor:!0}).setScrollFactor(0),this.on("pointerdown",(()=>{this.disabled||(this.setSelected(!1),r(this))})),this.on("pointerover",(()=>{this.disabled||this.selected||this.setTint(12303291)})),this.on("pointerout",(()=>{this.disabled||this.selected||this.setTint(16777215)}))}disable(){this.disabled=!0,this.selected=!1,this.disableInteractive(),this.setTint(6710886)}enable(){this.disabled=!1,this.selected=!1,this.setInteractive(),this.setTint(16777215)}setSelected(e){this.selected=e,this.setTint(e?_(N):16777215)}}class Bn extends Ln{constructor(e,t,i,s,n,r,o,a){super(e,t,i,s,n,{fontSize:32,align:"center",...r}),this.setOrigin((null==a?void 0:a.x)||0,(null==a?void 0:a.y)||0),null!==o&&this.setFixedSize((null==o?void 0:o.x)||250,(null==o?void 0:o.y)||50)}}class Gn extends a.GameObjects.Container{constructor(e,i,s){var n,r,o;super(e,i,s),t(this,"buttons",[]),t(this,"activeIndex",-1),e.add.existing(this).setScrollFactor(0),null==(n=e.input.keyboard)||n.on("keydown-UP",(()=>{this.setActiveButton(Math.max(0,this.activeIndex-1))})),null==(r=e.input.keyboard)||r.on("keydown-DOWN",(()=>{this.setActiveButton(Math.min(this.activeIndex+1,this.buttons.length-1))})),null==(o=e.input.keyboard)||o.on("keydown-ENTER",(()=>{var e;null==(e=this.buttons[this.activeIndex])||e.onClick(this.buttons[this.activeIndex])}))}addButton(e){this.add(e),this.buttons.push(e),1===this.buttons.length&&this.setActiveButton(0),e.on("pointerover",(()=>{this.setActiveButton(-1)}))}setActiveButton(e){var t,i;null==(t=this.buttons[this.activeIndex])||t.setSelected(!1),this.activeIndex=e,null==(i=this.buttons[this.activeIndex])||i.setSelected(!0)}clearButtons(){this.buttons=[],this.activeIndex=-1,this.removeAll(!0)}}const Rn=20;class Wn extends a.GameObjects.Container{constructor(e,i){var s,n;super(e),t(this,"textWidth"),t(this,"textHeight"),t(this,"player"),t(this,"target"),t(this,"npcName"),t(this,"text"),t(this,"portrait"),t(this,"options"),t(this,"optionsContainer"),t(this,"dialog"),t(this,"messageIndex"),t(this,"interactionTimeout"),t(this,"gamepadVisible",!1),t(this,"initialized",!1),t(this,"animating",!1),t(this,"stopAnimation"),t(this,"stopAudio");const{width:r,height:o}=w;this.textWidth=r-135-80,this.textHeight=130,this.setScrollFactor(0),this.setPosition(Rn,o-Rn-170),this.setDepth(x.Overlay),this.setAlpha(0),this.setVisible(!1),i&&(this.player=i),null==(s=this.scene.input.keyboard)||s.on("keydown-ENTER",(()=>{this.options||this.updateDialog()})),null==(n=this.scene.input.keyboard)||n.on("keydown-BACKSPACE",(()=>{this.options||this.updateDialog()}))}createUI(){this.scene.add.existing(this),this.npcName=new a.GameObjects.Text(this.scene,170,15,"",{...an,color:"#"+z}),this.text=this.scene.add.text(170,60,"",an),this.text.width=this.textWidth,this.text.height=this.textHeight,this.text.setOrigin(0).setMaxLines(5),this.portrait=this.scene.add.image(Rn,Rn,"").setOrigin(0).setScale(1.5);const e=this.scene.add.rectangle(0,0,w.width-40,170,_(F),.8).setStrokeStyle(2,_(z),1).setOrigin(0,0).setScrollFactor(0).setInteractive({useHandCursor:!0}).on("pointerdown",(()=>{this.options||this.updateDialog()}));this.optionsContainer=new Gn(this.scene).setDepth(x.Overlay);const t=this.scene.add.image(w.width-40-20,154,"chevron-down").setScale(.5);this.scene.tweens.add({targets:t,y:148,scale:.4,duration:1e3,ease:"Sine.easeInOut",yoyo:!0,repeat:-1}),this.add([e,this.npcName,this.text,this.portrait,t])}setDialog(e,t,i){var s,n;if(this.npcName||this.createUI(),this.gamepadVisible=(null==(s=this.scene.gamepad)?void 0:s.visible)||!1,this.setVisible(!0),this.scene.tweens.add({targets:this,alpha:void 0!==e?1:0,duration:125,onComplete:()=>this.setVisible(void 0!==e)}),this.target=t,this.messageIndex=0,this.dialog=e,this.interactionTimeout=Date.now()+350,null==(n=this.scene.gamepad)||n.setVisible(void 0===this.dialog&&this.gamepadVisible),!e)return;const r=i||(t instanceof ue?E[t.npcType].portrait:void 0);this.npcName.setVisible(!1),r?(this.portrait.setVisible(!0),this.portrait.setTexture(r),this.text.setPosition(170,Rn+(t instanceof ue?40:0)).setWordWrapWidth(this.textWidth,!0).setFixedSize(this.textWidth,this.textHeight),t instanceof ue&&(this.npcName.setVisible(!0),this.npcName.setText(E[t.npcType].name))):(this.portrait.setVisible(!1),this.text.setPosition(Rn,Rn).setWordWrapWidth(170+this.textWidth,!0).setFixedSize(170+this.textWidth,this.textHeight)),this.showMessage()}showMessage(){var e;const t=this.getMessages(),i=t&&t[this.messageIndex];if(i){this.text.setText(i);const t=this.target instanceof ue?this.target.npcType:void 0;let s="player_portrait"===(null==(e=this.portrait)?void 0:e.texture.key)?Fn.player:t?Fn[t]:Dn;const{promise:n,stop:r}=function(e,t,i,s){return 0===i?{promise:Promise.resolve()}:(s.sound.unlock(),((e,i)=>{let s=!1;const n=e=>new Promise((s=>{const n=i.sound.add(e);n.on("complete",(()=>{n.destroy(),s()})),n.play({rate:3,detune:300*(t.octave-4)})}));return{promise:new Promise((async t=>{const i=e.toLowerCase().split(" ");for(let e=0;e=97&&t.charCodeAt(0)<=122&&await n(t)}t()})),stop:()=>{s=!0}}})(e,s))}(i,s,this.scene.sound.mute?0:this.scene.sound.volume,this.scene),{promise:o,stop:a}=function(e,t=15){const i=e.text,s=i.replace(/[^ ]/g," ");e.text="";let n="";const r=e.scene.time.addEvent({delay:t,loop:!0});return{promise:new Promise((t=>{r.callback=()=>{if(e.text===i)return r.destroy(),t();n+=i[n.length];const o=s.substring(n.length);e.text=n+o}})),stop:()=>{r.destroy(),e.text=i}}}(this.text);this.animating=!0,this.stopAudio=r,this.stopAnimation=a,Promise.all([n,o]).then((()=>{this.animating=!1,this.stopAudio=void 0,this.stopAnimation=void 0})),this.text.getWrappedText().length>5&&console.error("Message too long!",i)}this.updateOptions()}updateOptions(){if(this.optionsContainer.clearButtons(),this.options=this.getOptions(),!this.options)return;const e=!w.zoomed;this.options.forEach(((t,i)=>{const s=new Ln(this.scene,w.width/2,w.height/(e?9:14)+i*(30+w.height/(e?16:22)),t,(()=>this.onSelectOption(t)),{fontSize:24,backgroundColor:"#"+F,padding:{y:10},align:"center",fixedWidth:350}).setOrigin(.5).setDepth(x.Overlay);this.optionsContainer.addButton(s)}))}onSelectOption(e){var t;(null==(t=this.dialog)?void 0:t.onSelected)&&(this.dialog.onSelected(e,this.player,this.target),this.optionsContainer.removeAll(!0))}updateDialog(){var e,t,i,s;if(Date.now()=n.length?(this.dialog.onCompleted&&this.dialog.onCompleted(this.player,this.target),this.dialog=void 0,this.text.setText(""),this.scene.tweens.add({targets:this,alpha:0,duration:125,onComplete:()=>this.setVisible(!1)}),null==(i=this.scene.gamepad)||i.resetButtons()):this.showMessage(),null==(s=this.scene.gamepad)||s.setVisible(void 0===this.dialog&&this.gamepadVisible),this.interactionTimeout=Date.now()+350}}getMessages(){var e;let t=null==(e=this.dialog)?void 0:e.messages;return"function"==typeof t&&(t=t(this.player)),t}getOptions(){var e;let t=null==(e=this.dialog)?void 0:e.options;return"function"==typeof t&&(t=t(this.player)),t}}const Nn={[P.Wrench]:{x:0,y:0,image:"wrench",name:"Old Wrench"},[P.Gear1]:{x:0,y:0,image:"gear",name:"Shiny Gear"},[P.Key]:{x:0,y:0,image:"key",name:"Rusty Key",skipLighting:!0},[P.HerbRed]:{x:-200,y:1730,image:"herb_red",name:"Crimson Starbloom"},[P.HerbGreen]:{x:5295,y:985,image:"herb_green",name:"Green Writhewood"},[P.HerbBlue]:{x:1535,y:875,image:"herb_blue",name:"Blue Plumed Frond"},[P.Potion]:{x:0,y:0,image:"potion",name:"Strange Potion"},[P.Gear2]:{x:0,y:0,image:"gear2",name:"Old Gear"}};class _n extends a.GameObjects.Container{constructor(e){super(e,0,0),t(this,"inventory",[]),t(this,"text"),t(this,"rect"),t(this,"initialized",!1),this.setScrollFactor(0).setDepth(x.Ui).setVisible(!1)}createUI(){this.initialized||(this.scene.add.existing(this),this.rect=this.scene.add.rectangle(0,0,0,0,_(D)).setStrokeStyle(2,_(M)).setAlpha(.75).setOrigin(0),this.add(this.rect),this.text=this.scene.add.text(10,4,"Inventory",{...an,fontSize:32}),this.add(this.text),this.initialized=!0)}addItem(e,t){if(this.initialized||this.createUI(),this.inventory.push(e),!e.used){const t=this.scene.add.image(0,0,Nn[e.type].image).setScale(.35);e.type===P.Key&&t.setAngle(45),this.add(t)}this.updateItems();const i=Ee(this.scene,e.type);null==i||i.destroy(),t||(new ln(this.scene,`New item added: ${Nn[e.type].name}`),Sn(this.scene))}removeItem(e){var t;this.initialized||this.createUI();const i=this.inventory.find((t=>t.type===e));i&&(i.used=!0,null==(t=this.getAll().find((t=>{var i;return(null==(i=t.texture)?void 0:i.key)===Nn[e].image})))||t.destroy()),this.updateItems()}updateItems(){var e;this.initialized||this.createUI();let t=0;this.getAll().forEach((e=>{if(e instanceof a.GameObjects.Image){const i=32+50*t;e.setPosition(i,68),t++}})),this.setVisible(this.inventory.length>0);const i=Math.max((null==(e=this.text)?void 0:e.displayWidth)+18,50*t+12);this.setPosition(w.width-i-20,20),this.rect.setSize(i,102)}}class Hn extends a.GameObjects.Image{constructor(e,i){super(e,w.width-50,w.height-55,"journal"),t(this,"player"),t(this,"journal",[]),t(this,"unread"),t(this,"initialized",!1),this.player=i}createUI(){var e;this.initialized||(this.setScrollFactor(0).setDepth(x.Ui).setScale(.5).setAlpha(0).setInteractive({useHandCursor:!0}).setActive(!1),this.on("pointerdown",this.openJournal),this.scene.add.existing(this),this.unread=this.scene.add.ellipse(w.width-21,w.height-89,20,20,11141120).setStrokeStyle(2,_(F)).setScrollFactor(0).setDepth(x.Ui2).setVisible(!1),null==(e=this.scene.input.keyboard)||e.on("keydown-J",(()=>{this.openJournal()})),this.initialized=!0)}addEntry(e,t){this.initialized||this.createUI(),this.journal.includes(e)||(0===this.journal.length&&(this.scene.tweens.add({targets:this,alpha:1,duration:300}),this.setActive(!0)),this.journal.push(e),t||(this.unread.setVisible(!0),new ln(this.scene,"New journal entry added!")),this.handleSideEffects(e,t||!1))}openJournal(){this.initialized||this.createUI(),0!==this.journal.length&&ie(this.scene,"JournalDialog")}handleSideEffects(e,t){const{warpAdd:i}=ge[e];if(i&&Oe(this.scene,i,!1),e===j.ClockFirstGear||e===j.ClockSecondGear){const e=Ae(this.scene,T.ClockTower);(null==e?void 0:e.clock)&&e.clock.updateHands()}e!==j.ExtraPotionInformation||this.journal.includes(j.SafeDiscovered)||gn(this.scene,!0),e===j.SafeDiscovered&&function(e,t){const i=Me(e.scene,O.MansionPicture);t||e.setActive(!1),null==i||i.scene.tweens.add({targets:i,angle:97,duration:t?0:1500,onComplete:()=>{t||(e.setActive(!0),e.message.setDialog({messages:["A sturdy looking safe was hidden behind the picture.","It looks like it requires a special key to open."]},void 0,"player_portrait"))}})}(this.player,t),t||Sn(this.scene)}}class Un extends a.GameObjects.Container{constructor(e,i){super(e,w.width-330-20,120),t(this,"player"),t(this,"quests",[]),t(this,"questRectangle"),t(this,"initialized",!1),this.player=i}createUI(){if(this.initialized)return;this.scene.add.existing(this),this.setScrollFactor(0).setDepth(x.Ui).setVisible(!1),this.questRectangle=this.scene.add.rectangle(0,0,330,60,_(D)).setStrokeStyle(2,_(M)).setAlpha(.75).setOrigin(0),this.add(this.questRectangle);const e=this.scene.add.text(10,4,"Quests",{...an,fontSize:32});this.add(e),this.initialized=!0}addQuest(e,t){this.initialized||this.createUI(),this.quests.find((t=>t.id===e.id))||(this.quests.push(e),this.add(this.scene.add.text(0,0,fe[e.id].description,{...an,fontSize:20})),this.updateQuests(),t||new ln(this.scene,`New quest added: ${fe[e.id].description}`),this.handleSideEffects(e.id,e.completed,t))}updateExistingQuest(e,t){this.initialized||this.createUI();const i=this.quests.find((t=>t.id===e));i?(!i.completed&&t&&new ln(this.scene,`Quest completed: ${fe[i.id].description}`),i.completed=t,this.updateQuests(),this.handleSideEffects(e,t)):console.error(`Quest ${e} not found in player quests`)}updateQuests(){this.initialized||this.createUI();const e=this.quests.filter((e=>!e.completed));let t=1,i=0;this.getAll().forEach((s=>{if(s instanceof a.GameObjects.Text)if(e.find((e=>s.text===fe[e.id].description))||"Quests"===s.text){if("Quests"!==s.text){const e=14+30*t;s.setPosition(10,e),t++,i=Math.max(i,s.width)}}else s.destroy()}));const s=i+20;this.setX(w.width-20-s),this.setY(this.scene.player.inventory.inventory.length>0?140:20),this.setVisible(e.length>0),this.questRectangle.setSize(s,50+30*e.length)}handleSideEffects(e,t,i){const{warpAdd:s,warpComplete:n}=fe[e];if(s&&Oe(this.scene,s,!1),t&&n&&Oe(this.scene,n,!1),e===I.FindPotionIngredients&&!t){const e=this.player.scene;e.interactiveObjects.add(new Mr(e,P.HerbGreen,this.player)),e.interactiveObjects.add(new Mr(e,P.HerbBlue,this.player))}e!==I.ExploreLab||t||Lr(this.player),i||Sn(this.scene)}reset(){this.quests=[],this.updateQuests()}}const $n=1.35*(w.fastMode?350:175),Vn=new a.Math.Vector2(400,650);class qn extends a.Physics.Arcade.Sprite{constructor(e){var i;super(e,Vn.x,Vn.y,"character",0),t(this,"scene"),t(this,"keys"),t(this,"light"),t(this,"debug"),t(this,"buttonPrompt"),t(this,"interactive"),t(this,"interactionTimeout",0),t(this,"message"),t(this,"inventory"),t(this,"quests"),t(this,"journal"),t(this,"gameState"),t(this,"previousPosition",new a.Math.Vector2),t(this,"counter",0),t(this,"history",[]),t(this,"rewinding",!1),this.name="Player",this.scene=e,e.add.existing(this),e.physics.add.existing(this),w.debug&&this.setInteractive(),this.setBodySize(48,70).setOffset(40,10).setOrigin(.5,.65).setDepth(x.Player).setScale(1.35).setPipeline("Light2D").setPostPipeline("XRayPipeline"),w.debug?(this.light=new ae(e,this.x,this.y,200,16768443,1),this.debug=e.add.circle(this.x,this.y,3,16711935).setDepth(x.Debug)):this.light=e.lights.addLight(this.x,this.y,200,16768443,1),(i=this).anims.create({key:"walk",frames:i.anims.generateFrameNumbers("character",{start:0,end:5}),frameRate:w.prod?6:9,repeat:-1}),i.anims.play("walk"),this.keys=new de(e),this.message=new Wn(e,this),this.inventory=new _n(e),this.quests=new Un(e,this),this.journal=new Hn(e,this),this.gameState=new Gr(e,this),w.perfTest&&e.time.delayedCall(1e3,(()=>{this.setVelocityX($n),e.time.addEvent({delay:1e3,callback:()=>this.setVelocityX(this.body?-this.body.velocity.x:0),loop:!0})}))}update(e,t){var i,s,n;w.debug&&(this.setTint(this.interactive?16755370:16777215),this.debug.setPosition(this.x,this.y));const r=this.interactive&&!this.message.visible&&(null==(s=null==(i=this.buttonPrompt)?void 0:i.text)?void 0:s.length)>0||!1;r&&!this.buttonPrompt&&(this.buttonPrompt=new zn(this.scene)),null==(n=this.buttonPrompt)||n.setVisible(r),w.perfTest||(this.setVelocity(0),this.rewinding?this.counter+t>31.25?(this.rewind(),this.counter=0):this.counter+=t:this.checkInteraction()||this.message.visible||this.updateVelocity()),this.light.setPosition(this.x,this.y-20),function(e){const t=e.x-e.previousPosition.x,i=e.y-e.previousPosition.y,s=t<0;Math.abs(t)>.01||Math.abs(i)>.01?e.anims.resume():e.anims.pause(),Math.abs(t)>0&&(e.flipX=e.rewinding?!s:s),e.setAngle(e.flipX?-5:5)}(this),this.previousPosition.set(this.x,this.y)}checkInteraction(){var e;let t;return this.interactive&&Date.now()>this.interactionTimeout&&(t=this.interactive.onInteract(this.keys.keys),t!==S.None&&(this.interactionTimeout=Date.now()+((null==(e=this.interactive)?void 0:e.interactionTimeout)||500),this.keys.resetKeys(),t===S.Teleported&&(this.interactive=void 0))),t}updateVelocity(){const e=this.keys.keys;let t=1;!w.prod&&e[ce.Shift]&&(t=2),this.anims.timeScale=t;const i=$n*t;e[ce.Left]&&this.setVelocityX(-i),e[ce.Right]&&this.setVelocityX(i),w.debug&&!this.interactive&&(e[ce.Up]&&this.setVelocityY(-i),e[ce.Down]&&this.setVelocityY(i)),e[ce.Left]&&e[ce.Right]&&this.setVelocityX(0)}record(){var e;this.history.length<1e3?this.history.push(new a.Math.Vector3(this.x,this.y,(null==(e=this.body)?void 0:e.velocity.x)||0)):console.warn("Max history reached")}rewind(){const e=this.history.pop();e&&(this.x=e.x,this.y=e.y,this.setVelocityX(-e.z))}setRewind(e){this.rewinding=e,this.counter=0}reset(){this.quests.reset(),this.setPosition(Vn.x,Vn.y),this.flipX=!1,this.setVelocity(0)}setInteractiveObject(e){var t,i;this.interactive=e,(null==e?void 0:e.onCollided)&&e.onCollided();const s=null==(t=null==e?void 0:e.getButtonPrompt)?void 0:t.call(e);s&&!this.buttonPrompt&&(this.buttonPrompt=new zn(this.scene)),null==(i=this.buttonPrompt)||i.setText(s)}}class Xn extends a.Physics.Arcade.Image{constructor(e,i,s,n=100,r=100,o=!1,a=!1){super(e,i,s,""),t(this,"scene"),t(this,"width"),t(this,"height"),t(this,"flipped"),t(this,"upwards"),t(this,"graphics"),t(this,"initialized",!1),this.name=`Slope-${i}-${s}`,this.scene=e,this.width=n,this.height=r,this.flipped=o,this.upwards=a}lazyInit(e){if(e||!this.initialized&&te(this,this.scene.player)){if(this.scene.add.existing(this),this.scene.physics.add.existing(this),this.setOrigin(0).setDepth(x.Debug).setVisible(w.debug).setSize(this.width,1.5*this.height),w.debug){this.setInteractive({draggable:!0});const e=this.scene.add.graphics().setDepth(x.Debug);this.graphics=e,e.lineStyle(2,65280,1);const t=this.width/2,i=new a.Math.Vector2(0,this.flipped?0:0+this.height),s=new a.Math.Vector2(0+this.width,this.flipped?0+this.height:0);e.lineBetween(i.x,i.y,s.x,s.y),e.lineBetween(i.x-t,i.y,i.x,i.y),e.lineBetween(s.x,s.y,s.x+t,s.y),e.strokeCircle(i.x,i.y,2),e.strokeCircle(s.x,s.y,2)}this.initialized=!0}}update(e,t){if(this.lazyInit(),!this.initialized)return;w.debug&&this.graphics&&this.graphics.setPosition(this.x,this.y);const i=this.scene.player,s=i.keys.keys;if(this.body&&this.scene.physics.world.intersects(this.body,i.body)){let e=a.Math.Clamp(1-(this.x+this.width-i.x)/this.width,0,1);this.flipped&&(e=1-e);const t=this.y+this.height,n=(1-i.originY)*i.displayHeight,r=t-this.height*e-n;if(this.upwards&&s[ce.Up]&&Math.abs(i.y-r)<70)return i.setVelocityX(this.flipped?-$n:$n),void i.setY(r);if(this.upwards&&(s[ce.Right]||s[ce.Left]&&this.flipped)&&i.y{void 0!==e.id&&this.createWall(e,t)}))}createWall(e,t){const i=this.scene.add.rectangle(e.x,e.y,6,100).setOrigin(0).setVisible(w.debug);i.name=`Wall-${e.id||t}-${e.x}-${e.y}`,void 0!==e.id&&i.setData("WallType",e.id),w.debug&&i.setInteractive({draggable:!0}),this.add(i),this.initialized.push(t)}update(){for(let e=0;eJn){if("RIGHT"===this.lastXAxisKey)return;"LEFT"===this.lastXAxisKey&&(null==(n=this.scene.input.keyboard)||n.emit("keyup-LEFT")),null==(r=this.scene.input.keyboard)||r.emit("keydown-RIGHT"),this.lastXAxisKey="RIGHT"}if(y<-.1){if("LEFT"===this.lastXAxisKey)return;"RIGHT"===this.lastXAxisKey&&(null==(o=this.scene.input.keyboard)||o.emit("keyup-RIGHT")),null==(a=this.scene.input.keyboard)||a.emit("keydown-LEFT"),this.lastXAxisKey="LEFT"}if(Math.abs(g)<=Jn&&this.lastYAxisKey)return null==(l=this.scene.input.keyboard)||l.emit("keyup-"+this.lastYAxisKey),void(this.lastYAxisKey=void 0);if(g>Jn){if("DOWN"===this.lastYAxisKey)return;"UP"===this.lastYAxisKey&&(null==(h=this.scene.input.keyboard)||h.emit("keyup-UP")),null==(c=this.scene.input.keyboard)||c.emit("keydown-DOWN"),this.lastYAxisKey="DOWN"}if(g<-.1){if("UP"===this.lastYAxisKey)return;"DOWN"===this.lastYAxisKey&&(null==(d=this.scene.input.keyboard)||d.emit("keyup-DOWN")),null==(u=this.scene.input.keyboard)||u.emit("keydown-UP"),this.lastYAxisKey="UP"}}createDPad(){console.log("createDPad");const e=this.scene.add.container(10,-10);this.add(e);const t=this.scene.add.circle(0,0,60,_(D),.45).setStrokeStyle(3,_(F));e.add(t),this.button(-57,0,"LEFT",e),this.button(57,0,"RIGHT",e),this.button(0,-57,"UP",e),this.button(0,57,"DOWN",e)}createButtons(){const e=this.scene.add.container(w.width-300,0);this.add(e);const t=this.scene.add.circle(40,0,65,_(D),.45).setStrokeStyle(3,_(F)).setScale(1,.6).setAngle(-30);e.add(t),this.button(80,-20,"ENTER",e),this.button(0,20,"BACKSPACE",e)}createControllerListeners(){var e,t,i,s;null==(e=this.scene.input.gamepad)||e.on("connected",(e=>{new ln(this.scene,"Gamepad connected")})),null==(t=this.scene.input.gamepad)||t.on("disconnected",(e=>{new ln(this.scene,"Gamepad disconnected")})),null==(i=this.scene.input.gamepad)||i.on("down",((e,t)=>{var i;const s=this.getKeyFromButton(t);s&&(null==(i=this.scene.input.keyboard)||i.emit(`keydown-${s}`))})),null==(s=this.scene.input.gamepad)||s.on("up",((e,t)=>{var i;const s=this.getKeyFromButton(t);s&&(null==(i=this.scene.input.keyboard)||i.emit(`keyup-${s}`))}))}getKeyFromButton(e){const t=e.pad.id.toLowerCase().includes("nintendo");let i;switch(e.index){case 0:i=t?"BACKSPACE":"ENTER";break;case 1:i=t?"ENTER":"BACKSPACE";break;case 2:i=t?"SHIFT":"BACK_SLASH";break;case 3:i=t?"BACK_SLASH":"SHIFT";break;case 8:i="J";break;case 9:i="ESC";break;case 12:i="UP";break;case 13:i="DOWN";break;case 14:i="LEFT";break;case 15:i="RIGHT"}return i}button(e,t,i,s){const n="ENTER"===i||"ESCAPE"===i?35:38,r=this.scene.add.circle(e,t,n,_(M),Qn).setStrokeStyle(3,_(F));r.setInteractive({useHandCursor:!0}).setScrollFactor(0),s.add(r),r.on("pointerdown",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keydown-${i}`),r.setFillStyle(_(D),Math.min(1,1.05))})),r.on("pointerup",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keyup-${i}`),r.setFillStyle(_(M),Qn)})),r.on("pointerout",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keyup-${i}`),r.setFillStyle(_(M),Qn)})),this.buttons.push(r)}resetButtons(){this.buttons.forEach((e=>e.setFillStyle(_(M),Qn)))}}class er extends a.GameObjects.Container{constructor(e,i,s,n,r){super(e,i,s),t(this,"onClick"),t(this,"img"),t(this,"rect"),t(this,"selected"),e.add.existing(this),this.setScrollFactor(0).setDepth(x.Ui),this.rect=e.add.rectangle(0,0,42,42,_(D)).setScrollFactor(0).setStrokeStyle(2,_(F)),this.img=e.add.image(-1,1,n).setDisplaySize(32,32),this.add(this.rect),this.add(this.img),this.rect.setInteractive({useHandCursor:!0}).on("pointerdown",(()=>r(this))),this.onClick=r,this.selected=!1,this.rect.on("pointerover",(()=>{this.rect.setScale(1.1),this.img.setDisplaySize(36,36)})),this.rect.on("pointerout",(()=>{this.rect.setScale(1),this.img.setDisplaySize(32,32)}))}setTint(e){this.img.setTint(e)}setSelected(e){this.selected=e,this.setTint(e?_(N):16777215)}setIcon(e){this.img.setTexture(e).setDisplaySize(32,32)}}var tr=(e=>(e.Horizontal="H",e.Vertical="V",e.Corner="C",e.T="T",e.Cross="X",e.Empty=" ",e))(tr||{});const ir={H:[[0,0,0],[1,1,1],[0,0,0]],V:[[0,1,0],[0,1,0],[0,1,0]],C:[[0,0,0],[1,1,0],[0,1,0]],T:[[0,0,0],[1,1,1],[0,1,0]],X:[[0,1,0],[1,1,1],[0,1,0]]," ":[[0,0,0],[0,0,0],[0,0,0]]},sr=[[" "," "," ","V"," "," ","V"," "," ","V"," "," "," ","V"," "," "],[" "," ","C","C"," "," ","V"," "," ","V"," "," ","C","T","H","H"],["H","H","X","T","T","T","T","T","T","C"," "," ","V"," "," "," "],[" "," ","V","C","X","C"," ","C","X","H","T","H","X","H","C"," "],[" "," ","C","T","X","H","C"," ","V"," ","V"," ","V"," ","T","H"],["H","T","H","T","V"," ","T","H","X","H","T","H","T"," ","V"," "],[" ","V"," ","C","X","H","C"," ","T","C"," "," ","C","C","C","H"],[" ","V"," "," ","V"," "," "," ","V","V"," "," "," ","V"," "," "]].map((e=>e.map((e=>e))));function nr(e,t){if(!e||!t)return!1;const i=rr(e),s=rr(t),n=t.x-e.x,r=t.y-e.y;return 1===n&&0===r?i.right&&s.left:-1===n&&0===r?i.left&&s.right:0===n&&1===r?i.bottom&&s.top:0===n&&-1===r&&i.top&&s.bottom}function rr(e){const t=function(e){let t=ir[e.type];const i=Math.floor(e.rotation/90);for(let s=0;s1===e[0])),right:t.some((e=>1===e[e.length-1])),top:t[0].some((e=>1===e)),bottom:t[t.length-1].some((e=>1===e))}}function or(e){return e[0].map(((t,i)=>e.map((e=>e[i])).reverse()))}const ar=Object.keys(P).map((e=>P[e])).filter((e=>"number"==typeof e)),lr=Object.keys(j).map((e=>j[e])).filter((e=>"number"==typeof e)),hr=Object.keys(T).map((e=>T[e])).filter((e=>"number"==typeof e)),cr=Object.keys(O).map((e=>O[e])).filter((e=>"number"==typeof e)),dr=Object.keys(I).map((e=>I[e])).filter((e=>"number"==typeof e)),ur=Object.keys(k).map((e=>k[e])).filter((e=>"number"==typeof e)),pr=Object.keys(A).map((e=>A[e])).filter((e=>"number"==typeof e)),yr=Object.values(tr).filter((e=>"number"!=typeof e)),gr=["MainMenu","MazeDialog","PipesDialog","TumblerDialog","MemoryDialog","SliderDialog"],fr=[{x:0,y:0,image:"town"},{x:500,y:-1100,image:"clock_outside"},{x:500,y:-2400,image:"clock_inner",skipLighting:!0},{x:2300,y:0,image:"forest"},{x:4400,y:100,image:"lake"},{x:-2200,y:-170,image:"mansion_outside"},{x:-2e3,y:-1320,image:"mansion_inside",skipLighting:!0},{x:-3200,y:1300,image:"alchemy_lab",scale:.9,skipLighting:!0},{x:1600,y:-700,image:"library",skipLighting:!0}],mr=[{x:135,y:462,radius:150,color:_(z),intensity:2.5},{x:697,y:441},{x:1018,y:435},{x:887,y:200,radius:150},{x:1561,y:460},{x:791,y:472,intensity:.5},{x:962,y:469,intensity:.5},{x:162,y:814,intensity:2},{x:635,y:772},{x:1638,y:788,intensity:2},{x:5300,y:530,intensity:2},{x:5315,y:730,intensity:.75,radius:75}],br=[],vr=[{x:740,y:-1370,width:170,height:95},{x:815,y:-2010,width:90,height:70},{x:5150,y:953,width:100,height:60,flip:!0},{x:-1300,y:-415,width:90,height:35},{x:-1710,y:1577,width:280,height:190,upwards:!0},{x:-1020,y:1697,width:200,height:70},{x:-2570,y:1728,width:200,height:40,flip:!0}],wr=(e,t,i)=>{var s=1/0,n=0,r=Math.round;const o=r(window.devicePixelRatio||1),a=100*o,l=65*o,h=3*o,c=2*o,d=3*o,u=23*o,p=a-2*d,y=l-u-2*o,g=document.createElement("canvas");g.width=a,g.height=l,g.style.cssText=`width:${a/o}}px;height:${l/o}px`;const f=g.getContext("2d");f.font="bold "+9*o+"px Helvetica,Arial,sans-serif",f.textBaseline="top",f.fillStyle=i,f.fillRect(0,0,a,l),f.fillStyle=t,f.fillText(e,h,c),f.fillRect(d,u,p,y),f.fillStyle=i,f.globalAlpha=.9,f.fillRect(d,u,p,y);let m=0,b=0,v=[];return{dom:g,update:function(l){if(!(performance.now()-m<100)){v[b]=l,b=(b+1)%p,s=Math.min(...v),n=Math.max(...v),f.fillStyle=i,f.globalAlpha=1,f.fillRect(0,0,a,u),f.fillStyle=t,f.fillText(`${e}: ${l.toFixed(1)}`,h,c),f.fillText(`[${s.toFixed(1)} - ${n.toFixed(1)}]`,h,c+10),f.fillRect(d,u,p,y),f.fillStyle=i,f.globalAlpha=.8;for(let e=0;e300||!w.debug&&t>150?new ln(this,i,void 0,L):new ln(this,i)}}update(){this.player&&(this.physics.overlap(this.interactiveObjects,this.player,this.player.setInteractiveObject,((e,t)=>{const i=e;let s=!0;return i.disabled&&(s=!1),void 0!==i.visible&&(s=s&&i.visible),s}),this.player)||this.player.setInteractiveObject(void 0)),this.frustumCull()}frustumCull(){var e,t,i;const s=performance.now();this.cameraBounds.x=this.cameras.main.scrollX-150,this.cameraBounds.y=this.cameras.main.scrollY-150;const n=this.children.getAll();for(let r of n)if(r instanceof a.GameObjects.Image||r instanceof a.GameObjects.Sprite||r instanceof a.GameObjects.Particles.ParticleEmitter||r instanceof a.GameObjects.Graphics){if(r.depth!==x.Debug&&(r instanceof Xn||!(r instanceof we)&&(null==(e=r.name)?void 0:e.startsWith("Warp"))||r.depth>=x.Ui||0===(null==(t=r.name)?void 0:t.length)))continue;this.objectBounds.setTo(r.x,r.y,r.width||1,r.height||1),a.Geom.Intersects.RectangleToRectangle(this.cameraBounds,this.objectBounds)?r instanceof we?r.updateLocked():r.setVisible(!0):r.setVisible(!1)}xr&&!this.cullingStats&&(this.cullingStats=xr.addPanel(wr("Culling","#9ad8e4","#064b62"))),null==(i=this.cullingStats)||i.update(performance.now()-s)}createBackgrounds(){return fr.map((e=>new Pn(this,e,this.player)))}createParallaxBackgrounds(){return br.map((e=>new Mn(this,e)))}createWarpers(){return ur.map((e=>new we(this,e,this.player)))}createNpcs(){return hr.map((e=>new ue(this,e,this.player)))}createItems(){return[].map((e=>new Mr(this,e,this.player)))}createSlopes(){return vr.map((e=>new Xn(this,e.x,e.y,e.width,e.height,e.flip,e.upwards)))}createProps(){return cr.map((e=>new ye(this,e,this.player)))}createHelperText(){return pr.map((e=>new En(this,e,this.player)))}createUI(){this.time.delayedCall(50,(()=>{let e=30;new er(this,e,30,"settings",(()=>{this.scene.pause(),this.scene.launch("Paused",{game:this})})),w.prod||new er(this,e+=50,30,"terminal",(()=>{ie(this,"DebugTool")})),this.saveIcon=this.add.image(30,w.height-30,"save").setScale(.4).setDepth(x.Ui).setScrollFactor(0).setAlpha(0),this.saveIcon.postFX.addGlow(0,2)})),this.gamepad=new Zn(this),w.prod||(this.time.delayedCall(500,(()=>{const e=new kn(this,this.player);this.add.group(e,{runChildUpdate:!0})})),w.bootDialog&&this.time.delayedCall(150,(()=>ie(this,w.bootDialog))))}createLights(){this.lights.enable().setAmbientColor(_(M)),mr.forEach((e=>{w.debug?new ae(this,e.x,e.y,e.radius||100,e.color||_(G),e.intensity||1):this.lights.addLight(e.x,e.y,e.radius||100,e.color||_(G),e.intensity||1)})),K(this,!1)}createEventListeners(){var e;null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>{this.scene.pause(),this.scene.launch("Paused",{game:this})})),this.events.on("resume",(()=>{this.player.keys.resetKeys()}))}}const kr=[{question:"I speak without a mouth and hear without ears. I have no body, but I come alive with the wind.",answer:"echo",options:["echo","whisper","ghost","silence","shadow"],hints:{[T.Inventor]:["The sphinx is known for asking about things we take for granted.","Think about what we hear in canyons."],[T.Stranger]:["The sphinx’s riddles are always a bit tricky.","I think this one is about something that bounces off walls."]}},{question:"I have cities, but no houses. I have mountains, but no trees. I have water, but no fish. What am I?",answer:"map",options:["map","globe","dream","photograph","landscape"],hints:{[T.Inventor]:["Think of something that represents the world, showing cities and mountains but not in a literal way."],[T.Stranger]:["Imagine something that can fit in your hand or hang on a wall, showing vast landscapes and bodies of water, but not in their true form."]}},{question:"I fly without wings. I cry without eyes. Whenever I go, darkness flies. What am I?",answer:"cloud",options:["cloud","bat","wind","shadow","storm"],hints:{[T.Inventor]:["The sphinx’s riddles can be twisted. Think about things that move or change without the usual parts, like wings or eyes."],[T.Stranger]:["Look at your surroundings. Shadows often behave in strange ways, don’t they?","They move, disappear, and seem to fly without wings."]}}];function Pr(e){return e instanceof Sr&&Ie(e.player,I.FindPotionIngredients)?1:0}function Ir(e,t){const i=Pr(e);return kr[i].hints[t]}const Tr={messages:e=>function(e){const t=Pr(e);return[kr[t].question]}(e.scene),options:e=>function(e){const t=Pr(e),i=[...kr[t].options].sort((()=>Math.random()-.5));return i.push("I don’t know"),i}(e.scene),onSelected:function(e,t,i){e===function(e){const t=Pr(e);return kr[t].answer}(t.scene)?t.message.setDialog({messages:["That is correct. Well done, you may pass."],onCompleted:e=>{e.quests.updateExistingQuest(I.SphinxRiddle,!0),e.gameState.updateData({sphinxMoved:!0,sphinxFail:!1})}},i):"I don’t know"===e?t.message.setDialog({messages:["Come back when you have an answer for me."]},i):t.message.setDialog({messages:["That is not correct. You will not remember how to get back to me."],onCompleted:e=>{e.gameState.updateData({mazeSolved:!1,mazeSeed:e.gameState.data.mazeSeed+1,sphinxFail:!0}),xe(k.TownEast,e,{x:-100,y:0})}},i)}},Cr={messages:["There. It looks like the alchemy set has been properly fit back together."],onCompleted:e=>{e.journal.addEntry(j.AlchemySetFixed)}},jr={[T.Inventor]:[{messages:["There is still one more gear missing.","Something tells me there is a great evil near the lake."],conditions:{journalEntry:j.ClockSecondGear}},{messages:["Ah, the second gear. You should take it to the clock tower."],conditions:{hasItem:P.Gear2}},{messages:["You found a secret safe in the mansion?","Very interesting. There may be a hint about opening it nearby."],conditions:{journalEntry:j.SafeDiscovered}},{messages:["Blue Plumed Frond? I have not heard of such a plant.","The stranger may know. Many secrets lie under this town."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["There are rumors of an abandoned mansion west of the town.","Some say it is haunted and dark magic lurks within."],conditions:{activeQuest:I.InvestigateTownWest}},{messages:["I see you found the first gear. You should talk to the mayor to learn more about the old clock."],conditions:{hasItem:P.Gear1},onCompleted:e=>{e.quests.updateExistingQuest(I.ForestGear,!0)}},{messages:e=>Ir(e.scene,T.Inventor),conditions:{activeQuest:I.SphinxRiddle}},{messages:["Now that you have the wrench, you can fix the clock tower. You’ll need three gears to do it."],conditions:{hasItem:P.Wrench}},{messages:["The clock tower is the heart of our town, but it’s been broken for ages. I’ve got a wrench, but you’ll need three special gears to fix it.","You might find the others by helping the townsfolk."],onCompleted:e=>{e.journal.addEntry(j.FixTheClock),e.inventory.addItem({type:P.Wrench,used:!1})}}],[T.Stranger]:[{messages:["I am worried about the secrets hidden near the lake.","Long ago I saw a great evil lurking there."],conditions:{journalEntry:j.ClockSecondGear}},{messages:["Another gear? The mayor probably wants that put back in the clock tower."],conditions:{hasItem:P.Gear2}},{messages:["The lock on that safe is no ordinary lock. It requires something special to open it."],conditions:{journalEntry:j.SafeDiscovered,hasUnusedItem:P.Potion}},{messages:["Hmm a potion, I wonder what it does.","The alchemist was no ordinary person and built magical safeguards against intruders."],conditions:{hasUnusedItem:P.Potion}},{messages:["Green Writhewood? Hm, there might be some near the forest or lake."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["You heard of the mansion to the west? It was abandoned many years ago.","There is a rumor of an alchemy lab hidden somewhere nearby, but I have been searching for years and have found not even a single potion."],conditions:{activeQuest:I.InvestigateTownWest}},{messages:["Now that you have the first gear, I would talk to the inventor."],conditions:{hasItem:P.Gear1}},{messages:e=>Ir(e.scene,T.Stranger),conditions:{activeQuest:I.SphinxRiddle}},{messages:["I’ve heard rumors of a gear hidden deep in the Enchanted Forest. Beware of the forest’s creatures and traps.","One time I thought I saw an ancient being, but it ran away."],conditions:{hasItem:P.Wrench},onCompleted:e=>{e.quests.addQuest({id:I.ForestGear,completed:!1})}},{messages:["Who am I?","Eventually, you will learn."]}],[T.Sphinx]:[{messages:e=>e.gameState.data.sphinxFail?["You have returned. I am surprised you were able to find your way back.","Try again."]:Ie(e,I.FindPotionIngredients)?["I see you are back again. You may find what you are looking for ahead, but must first answer my riddle."]:["Ponder this riddle. Answer wisely."],conditions:{activeQuest:I.SphinxRiddle,completedQuest:I.SphinxRiddle,or:!0},onCompleted:(e,t)=>{e.scene.time.delayedCall(50,(()=>{e.message.setDialog({...Tr},t)}))}},{messages:["Welcome, brave soul. To pass, you must answer my riddle. You may only answer once. If you are unsure, you may speak to the townsfolk. Choose wisely."],onCompleted:e=>{e.quests.addQuest({id:I.SphinxRiddle,completed:!1})}}],[T.Mayor]:[{messages:["I’ve been hearing strange reports from the townsfolk. It’s as if time is slipping. Have you felt it?","The clock is still missing a gear. It must be somewhere nearby."],conditions:{journalEntry:j.ClockSecondGear}},{messages:["The second gear has been found? That’s incredible news!"],conditions:{completedQuest:I.InvestigateTownWest}},{messages:["Herbs? I haven’t the faintest idea where to being looking. Start at the source - there are bound to be a few ingredients in the lab you found."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["The minute hand on the clock is spinning again.","It looks like it’s missing two more gears.","The abandoned mansion west of the town might be a good place to look."],conditions:{journalEntry:j.ClockFirstGear},onCompleted:e=>{e.quests.addQuest({id:I.InvestigateTownWest,completed:!1})}},{messages:["Did you go into the clock tower yet?"],conditions:{journalEntry:j.MetTheMayor}},{messages:["Hello, traveler. I am the mayor of this town. The clock tower has been broken for years.","Ah, I see you have found an old gear. Maybe it could be used to help fix the clock tower."],onCompleted:e=>{e.journal.addEntry(j.MetTheMayor)}}],[T.ClockTower]:[{messages:["With two of the gears in place, the clocks hands are moving again."],conditions:{journalEntry:j.ClockSecondGear}},{messages:["Slowly, you align and tighten the second gear into place.","[CREAKING NOISE]","Now two of the hands of the clock are moving again."],conditions:{hasItem:P.Gear2},onCompleted:e=>{e.inventory.removeItem(P.Gear2),e.journal.addEntry(j.ClockSecondGear)}},{messages:["The clock is partially moving again, but it is still missing two gears."],conditions:{journalEntry:j.ClockFirstGear}},{messages:["This dusty clock tower hasn't told the correct time in many years. It appears to be missing some gears.","Let’s see what happens when we add the first gear. You tighten the gear into place.","[CREAKING NOISE]","The clock tower is starting to partially move again. It looks like it’s missing two more gears."],conditions:{hasItem:P.Gear1},onCompleted:e=>{e.inventory.removeItem(P.Gear1),e.journal.addEntry(j.ClockFirstGear)}}]},Or={[P.Gear1]:[{messages:["Hmm, this gear looks like it belongs in the clock tower. I should ask the inventor about it."]}],[P.Gear2]:[{messages:["Finally! I found the second gear to the clock tower.","I should take this and put it back."],onCompleted:e=>{e.quests.updateExistingQuest(I.InvestigateTownWest,!0)}}]},Ar={[O.Chest]:[{messages:["The chest seems to be locked.","It appears to have many symbols above the latch"],conditions:{custom:e=>!Se(e,P.Gear1)&&void 0===Ee(e.scene,P.Gear1)},onCompleted:e=>{ie(e.scene,"MemoryDialog")}}],[O.LabHatch]:[{messages:["Let me see if I can open this hatch.","Wow, the rusty key fits!","[CREAKING NOISE]","Alright, let’s see what is down there!"],conditions:{hasItem:P.Key},onCompleted:(e,t)=>{null==t||t.destroy(),e.inventory.removeItem(P.Key),e.journal.addEntry(j.AlchemyLabFound)}},{messages:["The hatch is locked. I wonder if there is a key somewhere."]}],[O.LabBook]:[{messages:[],conditions:{journalEntry:j.ClockSecondGear}},{messages:['How could I have missed this? The potion is called the "Elixir of Sight".',"This must be related to one of the gears in the clock tower.","Well, bottoms up, I suppose!"],conditions:{hasItem:P.Potion},onCompleted:e=>{e.journal.addEntry(j.ExtraPotionInformation),e.inventory.removeItem(P.Potion),e.scene.time.delayedCall(3500,(()=>{e.message.setDialog({messages:["I feel... different.","I should retrace my steps to see if there is anything new in the area."]})}))}},{messages:["With the alchemy set fixed, I should be able to recreate the experiment.","I will need to find three ingredients according to this - Crimson Starbloom, Green Writhewood, and a Blue Plumed Frond.","Maybe I can find them in the lab or the forest. The villagers should know more."],conditions:{journalEntry:j.AlchemySetFixed},onCompleted:e=>{e.quests.addQuest({id:I.FindPotionIngredients,completed:!1}),e.gameState.updateData({mazeSolved:!1,mazeSeed:e.gameState.data.mazeSeed+1,sphinxMoved:!1})}},{messages:["Maybe I can find more information in the lab."],conditions:{activeQuest:I.ExploreLab}},{messages:["This lab journal contains notes about an ancient alchemy experiement.","According to the notes, the experiment was a failure, and the alchemist disappeared.","It does say that there might have been a problem with one of the ingredients.","Maybe I can find more information in the lab."],onCompleted:e=>{e.quests.addQuest({id:I.ExploreLab,completed:!1})}}],[O.AlchemySet]:[{messages:["There’s nothing more that I can do here."],conditions:{hasItem:P.Potion}},{messages:["Now we have all of the ingredients.","Now I should be able to recreate the experiment.","According to the book..."],conditions:{hasUsedItem:P.HerbBlue},onCompleted:(e,t)=>{!function(e,t){const i=e.scene;e.inventory.removeItem(P.HerbBlue),e.setActive(!1),ee(i,500,(()=>{i.time.delayedCall(700,(()=>{var s;null==t||t.setTexture("alchemy_full"),null==(s=null==t?void 0:t.particles)||s.setConfig({...pe[O.AlchemySet].particles,tint:[6684791],x:30,delay:200,stopAfter:120}).start(),Z(i,1500,(()=>{e.message.setDialog({messages:["I have created the potion mentioned in the old journal.","I should bring it to the mysterious stranger to see if they know how to use it."],onCompleted:(e,t)=>{e.inventory.addItem({type:P.Potion,used:!1}),e.quests.updateExistingQuest(I.ExploreLab,!0),null==t||t.setTexture("alchemy_empty"),e.setActive(!0)}},t,"player_portrait")}))}))}))}(e,t)}},{messages:["The Blue Plumed Frond is last."],conditions:{hasItem:P.HerbBlue,hasUsedItem:P.HerbRed},onCompleted:(e,t)=>{Fr(e,t,P.HerbBlue),e.quests.updateExistingQuest(I.FindPotionIngredients,!0)}},{messages:["The Crimson Starbloom comes next."],conditions:{hasItem:P.HerbRed,hasUsedItem:P.HerbGreen},onCompleted:(e,t)=>Fr(e,t,P.HerbRed)},{messages:["The Green Writhewood goes in first."],conditions:{hasItem:P.HerbGreen},onCompleted:(e,t)=>Fr(e,t,P.HerbGreen)},{messages:["Maybe the journal has more information about using this alchemy set."],conditions:{journalEntry:j.AlchemySetFixed}},{messages:["This alchemy set looks like the one in the journal.","If I can figure out how the set connects together, I might be able to recreate the experiment."],conditions:{activeQuest:I.ExploreLab},onCompleted:e=>{ie(e.scene,"PipesDialog")}},{messages:["A series of pipes and tubes. I shouldn’t touch this without knowing what it does."]}],[O.LabBookshelf1]:[{messages:['[Secrets of the Silver Transmutation]\n"Silver, the mirror of the soul, can be yielded from common materials. Begin with a lead base, cleanse it with the tears of a willow, and chant thrice under a new moon. Such processes, though fraught with danger, promise immense reward. Meticulous preparation of the material is crucial."','"Among these pages lie safeguards against volatile spirits and the precise lunar phases essential for success. Here are protective circles and counter-spells to be used should spirits prove malevolent. This knowledge has been passed down and refined for safety."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabBookshelf2]:[{messages:['[Whispering Woods: A Compendium]\n"The sentient trees of Eldergrove are not myths; their trunks groan with ancient wisdom. To engage them, perform the Ritual of Leaves, using moonlit water and rare herbs, along with whispered incantations passed down by forest guardians."','"Notes on the rare Blue Moonflower, whose petals glow ghostly and unlock forest languages, are also included. Its bloom is brief, and harvesting must be timed at midnight to retain its properties. The chapter concludes with a discussion on plant symbiosis with Eldertrees."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabBookshelf3]:[{messages:['[The Essence of Fire: Ignite and Control]\n"Mastering fire requires strength of will and profound respect for its power. Here, summoning circles and incantations to call forth fire spirits are detailed. Each summoning demands a tribute of phoenix ash. The endeavor is perilous, as spirits may lash out if provoked."','"The tome also discusses methods to quell flames should they rise against the summoner. Included are the chant of suppression and a dousing mixture from elemental waters and frost-bitten herbs. These countermeasures are vital for maintaining control over summoned entities."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabPotionShelf1]:[{messages:["Nightshade, wolfsbane, starvine, frost ferns... No, those are not the right ingedients.","Oh, a Crimson Starbloom! Yes, this should work!"],conditions:{activeQuest:I.FindPotionIngredients,custom:e=>!Se(e,P.HerbRed)},onCompleted(e){e.inventory.addItem({type:P.HerbRed,used:!1})}},{messages:['Hm, this is an interesting collection. What’s this "Elixir of Luminescence"? Could light up some dark corners. And "Brew of Bravery"... might make me bold enough to face a dragon, or foolish enough to try. What about "Draught of the Depths"—sounds like it could show me treasures or drown me in visions. Better not risk it; these might just burn me to a crisp!'],conditions:{activeQuest:I.ExploreLab}}],[O.MansionPicture]:[{messages:[],conditions:{hasItem:P.Gear2}},{messages:["A sturdy looking safe was hidden behind the picture.","There are large rusty rings to the side, as if it they were meant to be moved."],conditions:{journalEntry:j.SafeDiscovered},onCompleted:e=>{ie(e.scene,"TumblerDialog")}},{messages:["An abstract picture of blocks.","Wait a moment, something is behind this picture","[CREAK]"],onCompleted:e=>{e.journal.addEntry(j.SafeDiscovered)},conditions:{hasUsedItem:P.Potion}},{messages:["An abstract picture of blocks."]}],[O.MansionHole]:[{messages:["Literally a hole in the wall.","Huh, there is something here. It's a key!"],conditions:{hasItem:P.Key,invert:!0},onCompleted:e=>{e.inventory.addItem({type:P.Key,used:!1})}},{messages:["Literally a hole in the wall."]}]};function Er(e,t,i){for(const s of e){const{conditions:e}=s,n=[];if(void 0!==(null==e?void 0:e.hasItem)&&n.push(Se(t,e.hasItem)),void 0!==(null==e?void 0:e.hasUnusedItem)&&n.push(ke(t,e.hasUnusedItem)),void 0!==(null==e?void 0:e.hasUsedItem)&&n.push(Pe(t,e.hasUsedItem)),void 0!==(null==e?void 0:e.completedQuest)&&n.push(Te(t,e.completedQuest)),void 0!==(null==e?void 0:e.activeQuest)&&n.push(Ie(t,e.activeQuest)),void 0!==(null==e?void 0:e.journalEntry)&&n.push(Ce(t,e.journalEntry)),(null==e?void 0:e.custom)&&n.push(e.custom(t,i)),null==e?void 0:e.invert){if(null==e?void 0:e.or){if(n.some((e=>!e)))return s}else if(n.every((e=>!e)))return s;return}if(null==e?void 0:e.or){if(n.some((e=>e)))return s}else if(n.every((e=>e)))return s}}class Mr extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:r,image:o}=Nn[i];super(e,n,r,o),t(this,"itemType"),t(this,"player"),t(this,"particles"),t(this,"light"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`Item-${i}`,this.itemType=i,this.player=s,this.setScale(.35).setDepth(x.Items),ze(this,Nn[i])}lazyInit(e){(e||!this.initialized&&te(this,this.player))&&(Se(this.player,this.itemType)?this.destroy():(this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0}),this.particles=this.scene.add.particles(this.x,this.y,"warp",{scale:{start:0,end:.9},alpha:{start:.7,end:0},delay:500,lifespan:1500,maxAliveParticles:1}).setDepth(x.Items).setName(`Item-${this.itemType}-Particles`),w.debug?this.light=new ae(this.scene,this.x,this.y,this.displayHeight/150*150,16764074,2):this.light=this.scene.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,2),this.initialized=!0))}onInteract(e){return e[ce.Continue]?(this.scene.time.delayedCall(0,(()=>{this.player.inventory.addItem({type:this.itemType,used:!1});const e=Er(Or[this.itemType]||[],this.player,this);e&&(null==e?void 0:e.messages.length)>0&&this.player.message.setDialog(e,this,"player_portrait")})),this.destroy(),S.Item):S.None}destroy(e){var t,i,s;null==(t=this.particles)||t.destroy(),this.light instanceof ae?this.light.destroy():null==(s=null==(i=this.scene)?void 0:i.lights)||s.removeLight(this.light),super.destroy(e)}getButtonPrompt(){return[`Pick Up ${Nn[this.itemType].name}`,"Press [CONTINUE]"]}update(){var e,t;this.lazyInit(),null==(e=this.particles)||e.setPosition(this.x,this.y),null==(t=this.light)||t.setPosition(this.x,this.y)}}function zr(e,t,i){var s,n;const r=Ae(e,T.Sphinx);if(!r)return void console.error("Sphinx not found");const o=function(e,t){return je(e,a.GameObjects.Rectangle).find((e=>e.getData("WallType")===t))}(e,C.Sphinx);if(o){const e=(null==(s=Kn.find((e=>e.id===C.Sphinx)))?void 0:s.x)||0;t?o.setX(e||0):o.setX(e-150),null==(n=o.body)||n.updateFromGameObject()}Oe(e,k.ForestEast,!t);const{x:l,y:h}=E[T.Sphinx],c=t?l+200:l,d=t?h-90:h;e.tweens.add({targets:r,alpha:0,duration:!t||i?0:300,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{r.setPosition(c,d)},onComplete:()=>{r.alpha=1,r.disabled=t||!1}}),e.tweens.add({targets:r.light,x:c,y:d,duration:!t||i?0:450,ease:"Power1"})}const Dr={[P.HerbRed]:{texture:"alchemy_red",tint:11141120,x:-20},[P.HerbGreen]:{texture:"alchemy_green",tint:43520,x:-35},[P.HerbBlue]:{texture:"alchemy_blue",tint:170,x:-5}};function Fr(e,t,i){e.inventory.removeItem(i),e.setActive(!1),t&&t.particles&&(Lr(e),t.disabled=!0,t.particles.setConfig({...pe[O.AlchemySet].particles,tint:Dr[i].tint,x:Dr[i].x}).start().on("complete",(()=>{t.disabled=!1,e.setActive(!0)})))}function Lr(e){const t=Me(e.scene,O.AlchemySet);t&&(t.setTexture("alchemy_empty"),Pe(e,P.HerbBlue)?t.setTexture(Dr[P.HerbBlue].texture):Pe(e,P.HerbRed)?t.setTexture(Dr[P.HerbRed].texture):Pe(e,P.HerbGreen)&&t.setTexture(Dr[P.HerbGreen].texture))}const Br={mazeSolved:!1,mazeSeed:0,sphinxFail:!1,sphinxMoved:!1};class Gr{constructor(e,i){t(this,"scene"),t(this,"player"),t(this,"data"),this.scene=e,this.player=i,this.data={...Br}}updateData(e,t){this.data={...this.data,...e},Object.entries(e).forEach((([e,i])=>{this.handleSideEffects(e,i,t)}))}handleSideEffects(e,t,i){"sphinxMoved"===e&&zr(this.scene,t,i)}}const Rr="chrono-sleuth-save";var Wr=(e=>(e[e.New=0]="New",e[e.Act1=1]="Act1",e[e.Act2=2]="Act2",e[e.LabItems=3]="LabItems",e[e.Act3=4]="Act3",e))(Wr||{});const Nr={player:{x:Vn.x,y:Vn.y,flip:!1},journal:[],inventory:[],quests:[],gameState:{...Br},settings:{gamepad:[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some((e=>navigator.userAgent.match(e))),debug:!1,zoomed:!0,useShader:!0,time:Date.now(),muted:!0}},_r={...Nr.settings,gamepad:!1},Hr={0:Nr,1:{player:{x:Vn.x,y:Vn.y,flip:!1},journal:[j.FixTheClock],inventory:[{type:P.Wrench,used:!1},{type:P.Gear1,used:!1}],quests:[{id:I.ForestGear,completed:!1},{id:I.SphinxRiddle,completed:!0}],gameState:{...Br,mazeSolved:!0,sphinxMoved:!0},settings:{..._r}},2:{player:{x:-770,y:Vn.y,flip:!0},journal:[j.FixTheClock,j.MetTheMayor,j.ClockFirstGear],inventory:[{type:P.Wrench,used:!1},{type:P.Gear1,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!1}],gameState:{...Br,mazeSolved:!0,sphinxMoved:!0},settings:{..._r}},3:{player:{x:-1500,y:1729,flip:!0},journal:[j.FixTheClock,j.MetTheMayor,j.ClockFirstGear,j.AlchemyLabFound,j.AlchemySetFixed],inventory:[{type:P.Wrench,used:!1},{type:P.Gear1,used:!0},{type:P.Key,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!1},{id:I.ExploreLab,completed:!1},{id:I.FindPotionIngredients,completed:!1}],gameState:{...Br},settings:{..._r}},4:{player:{x:5073.875,y:915,flip:!1},journal:[j.FixTheClock,j.MetTheMayor,j.ClockFirstGear,j.AlchemyLabFound,j.AlchemySetFixed,j.SafeDiscovered,j.ExtraPotionInformation,j.ClockSecondGear],inventory:[{type:P.Wrench,used:!1},{type:P.Gear1,used:!0},{type:P.Key,used:!0},{type:P.HerbRed,used:!0},{type:P.HerbGreen,used:!0},{type:P.HerbBlue,used:!0},{type:P.Potion,used:!0},{type:P.Gear2,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!0},{id:I.ExploreLab,completed:!0},{id:I.FindPotionIngredients,completed:!0}],gameState:{...Br,mazeSolved:!0,sphinxMoved:!0},settings:{..._r}}};class Ur extends a.Scene{constructor(){super({key:"Boot",pack:{files:[{type:"image",key:"splash",url:"assets/splash.jpg"}]}})}init(){this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height)}preload(){this.load.setPath("assets"),this.load.image("logo","logo.jpg"),this.load.font("m6x11","../m6x11.ttf","truetype"),this.load.bitmapFont("m6x11-24","fonts/m6x11-24.png","fonts/m6x11-24.xml"),this.load.svg("maximize","icons/maximize.svg",{width:64,height:64}),this.load.svg("minimize","icons/minimize.svg",{width:64,height:64}),this.load.svg("settings","icons/settings.svg",{width:64,height:64}),this.load.json("build",`../build.json?cacheBust=${Date.now()}`),w.phaserInspector&&(this.load.scripts("inspector",["https://cdn.jsdelivr.net/npm/tweakpane@3.1.10/dist/tweakpane.js","https://cdn.jsdelivr.net/npm/phaser-plugin-inspector@2.5.0/dist/phaser-plugin-inspector.umd.js"]),this.load.once("complete",(()=>{PhaserPluginInspector.Install(this.plugins)})))}create(){var e;try{const t=null==(e=this.cache.json.get("build"))?void 0:e.buildTime;if(t&&"2025-01-02T08:11:09.570Z"!==t)return this.add.text(w.width/2,w.height/2,"New version available!\nUpdating Game...",{...an,align:"center",fontSize:48}).setOrigin(.5).postFX.addGlow(0,10),void setTimeout((()=>window.location.reload()),15e3)}catch(t){console.error(t)}w.prod&&localStorage.getItem(Rr)?this.scene.start("MainMenu"):this.scene.start("Preloader")}}function $r(e){e.load.setPath("assets"),e.load.image("train","maps/intro/train.png"),e.load.image("layer2","maps/intro/layer2.png"),e.load.image("layer3","maps/intro/layer3.png"),e.load.image("layer4","maps/intro/layer4.png"),e.load.image("layer5","maps/intro/layer5.png"),e.load.spritesheet("character","characters/player.png",{frameWidth:128,frameHeight:80}),e.load.image("player_portrait","characters/player_portrait.png"),e.load.svg("chevron-down","icons/chevron-down.svg",{width:64,height:64})}class Vr extends a.Scene{constructor(){super("Intro"),t(this,"player"),t(this,"playerProgess",0),t(this,"direction",1),t(this,"pauseDuration",0)}preload(){$r(this)}init(){var e,t;this.sound.mute=Hr[Wr.New].settings.muted,w.prod||(null==(e=this.input.keyboard)||e.on("keydown-BACK_SLASH",(()=>{ee(this,500,(()=>{this.textures.exists("warp")?this.scene.start("Game"):this.scene.start("Preloader")}))})),null==(t=this.input.keyboard)||t.on("keydown-R",(()=>{this.scene.restart()})))}create(){var e;const t=w.zoomed?.75:1;Z(this,350),this.add.image(w.width,w.height,"layer5").setScale(5*t);const i=this.add.image(0,w.height,"layer4").setScale(5*t),s=this.add.image(0,w.height,"layer4").setScale(5*t),n=this.add.image(0,350*t,"layer3").setScale(2*t),r=this.add.image(0,.7*w.height,"layer2").setScale(5*t),o=w.width;this.tweens.add({targets:[i],x:{from:2.5*-o,to:0},duration:12e4,repeat:-1}),this.tweens.add({targets:[s],x:{from:0,to:2.5*o},duration:12e4,repeat:-1}),this.tweens.add({targets:n,x:{from:2*-o,to:2.75*o},duration:6e4,hold:9e4,repeat:-1}),this.tweens.add({targets:[r],x:{from:-o,to:1.5*o},duration:15e3,hold:45e3,repeat:-1});const a=this.add.container(0,w.zoomed?-35:0);this.player=this.add.sprite(560*t,w.height-250*t,"character",0).setScale(2.5*t),this.player.anims.create({key:"walk",frames:this.player.anims.generateFrameNumbers("character",{start:0,end:5}),frameRate:5,repeat:-1}),this.player.anims.play("walk"),this.player.anims.pause(),a.add(this.player),this.cameras.main.startFollow(this.player,!0,.1,.1,0,120);const l=this.add.image(w.width/2,w.height/2,"train").setScale(2*t);a.add(l),this.tweens.add({targets:a,x:a.x+1,y:a.y+5,duration:300,hold:300,ease:"Bounce",repeat:-1}),null==(e=this.add.rectangle(-w.width/2,w.height-(w.zoomed?60:35),2*w.width,35,4472896).setOrigin(0).postFX)||e.addShadow(0,0,.5,1),function(e,t){const i=w.zoomed?.75:1,s=new Wn(e);t.setAngle(5);const n=e.add.timeline([{at:1500,tween:{targets:t,x:850*i,duration:2500,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume()},{at:6e3,run:()=>{ee(e,500,(()=>{e.textures.exists("warp")?e.scene.start("Game"):e.scene.start("Preloader")}))}}]),r=e.add.timeline([{at:1500,tween:{targets:t,x:1200*i,duration:2500,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume()},{at:5500,run:()=>{t.setFlipX(!0),t.setAngle(-5)}},{at:6500,run:()=>{s.setDialog({messages:["No doubt about it, this will be a strange journey.","Whatever awaits me in this town, it’s certain that nothing will ever be the same again."],onCompleted:()=>n.play()},void 0,"player_portrait")}}]);e.add.timeline([{at:2500,tween:{targets:t,x:850*i,duration:3e3,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume()},{at:7e3,run:()=>{t.setFlipX(!0),t.setAngle(-5)}},{at:8e3,run:()=>{t.setFlipX(!1),t.setAngle(5)}},{at:9e3,run:()=>{s.setDialog({messages:["What a beautiful mountain-scape. I almost forgot where I am headed.","It’s been three days since the letter arrived... It has been many years since I last visited that sleepy old town.","Rumors swirl of strange occurrences. People disappearing, clocks that never strike the hour, and a darkness that lingers beneath the surface."],onCompleted:()=>r.play()},void 0,"player_portrait")}}]).play()}(this,this.player)}}class qr extends er{constructor(e,t,i){super(e,t,i,e.scale.isFullscreen?"minimize":"maximize",(()=>{e.scale.isFullscreen?e.scale.stopFullscreen():e.scale.startFullscreen()})),e.scale.on(Phaser.Scale.Events.ENTER_FULLSCREEN,(()=>{this.img.scene=e,this.img.setTexture("minimize")})),e.scale.on(Phaser.Scale.Events.LEAVE_FULLSCREEN,(()=>{this.img.scene=e,this.img.setTexture("maximize")}))}}class Xr extends a.Scene{constructor(){super("MainMenu")}create(){this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height);const e=this.add.container(0,0);e.setAlpha(0),this.tweens.add({targets:e,alpha:1,duration:150}),e.add(this.add.image(35,w.height-30,"logo").setOrigin(0,1).setScale(.4)),new Zn(this,!0).setVisible(!1);const t=new Gn(this);e.add(t);const i=new qr(this,w.width-30,30);t.addButton(i),localStorage.getItem(Rr)&&t.addButton(new Ln(this,w.width-120,w.height-145,"Continue",(()=>this.scene.start("Preloader")),{align:"center"}).setFixedSize(200,70)),t.addButton(new Ln(this,w.width-120,w.height-60,"New Game",(()=>{localStorage.removeItem(Rr),this.scene.start("Preloader")}),{align:"center"}).setFixedSize(200,70)),t.setActiveButton(1)}}class Kr extends a.Scene{constructor(){super("Preloader"),t(this,"container")}init(){this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height),this.add.image(35,w.height-30,"logo").setOrigin(0,1).setScale(.4);const e=.66*w.width,t=.05*w.height,i=this.add.container(.24*w.width,.86*w.height);this.container=i;const s=this.add.rectangle(0,0,e,t).setStrokeStyle(1,16777215,.85).setOrigin(0);i.add(s);const n=this.add.rectangle(3,3,0,t-6,16777215,.85).setOrigin(0);i.add(n),this.load.on("progress",(t=>{const i=w.prod?.6*t:t;n.width=(e-6)*i})),w.prod&&this.load.on("complete",(()=>{this.tweens.add({targets:n,width:e-6,duration:2e3})}));const r=this.add.image(w.width-50,w.height-60,"settings").setScale(.75);this.tweens.add({targets:r,angle:360,duration:2e3,delay:100,repeat:-1})}preload(){this.load.setPath("assets"),this.load.svg("sun","icons/sun.svg",{width:64,height:64}),this.load.svg("moon","icons/moon.svg",{width:64,height:64}),this.load.svg("zoom-in","icons/zoom-in.svg",{width:64,height:64}),this.load.svg("zoom-out","icons/zoom-out.svg",{width:64,height:64}),this.load.svg("terminal","icons/terminal.svg",{width:64,height:64}),this.load.svg("award","icons/award.svg",{width:64,height:64}),this.load.svg("tv","icons/tv.svg",{width:64,height:64}),this.load.svg("save","icons/save.svg",{width:64,height:64}),this.load.svg("chevron-down","icons/chevron-down.svg",{width:64,height:64}),this.load.svg("volume","icons/volume-2.svg",{width:64,height:64}),this.load.svg("volume-mute","icons/volume-x.svg",{width:64,height:64}),this.load.svg("gamepad","icons/gamepad-solid.svg",{width:64,height:64}),this.load.image("town","maps/town.jpg"),this.load.image("clock_outside","maps/clock_outside.jpg"),this.load.image("clock_inner","maps/clock_inner.jpg"),this.load.image("forest","maps/forest.jpg"),this.load.image("lake","maps/lake.jpg"),this.load.image("mansion_outside","maps/mansion_outside_hatch.jpg"),this.load.image("mansion_inside","maps/mansion_inside.jpg"),this.load.image("alchemy_lab","maps/alchemy_lab.jpg"),this.load.image("library","maps/library.jpg"),this.load.image("watch","items/watch.png"),this.load.image("ladder","props/ladder.png"),this.load.image("warp","props/warp.png"),this.load.spritesheet("portal","props/portal.png",{frameWidth:140,frameHeight:120}),this.load.image("gear","items/gear.png"),this.load.image("gear2","items/gear2.png"),this.load.image("journal","items/journal.png"),this.load.image("wrench","items/wrench.png"),this.load.image("key","items/key.png"),this.load.image("herb_red","items/herb_red.png"),this.load.image("herb_green","items/herb_green.png"),this.load.image("herb_blue","items/herb_blue.png"),this.load.image("potion","items/potion.png"),this.load.spritesheet("character","characters/player.png",{frameWidth:128,frameHeight:80}),this.load.image("player_portrait","characters/player_portrait.png"),this.load.image("inventor","characters/inventor.png"),this.load.image("inventor_portrait","characters/inventor_portrait.png"),this.load.image("stranger","characters/stranger.png"),this.load.image("stranger_portrait","characters/stranger_portrait.png"),this.load.image("sphinx","characters/sphinx.png"),this.load.image("sphinx_portrait","characters/sphinx_portrait.png"),this.load.image("mayor","characters/mayor.png"),this.load.image("mayor_portrait","characters/mayor_portrait.png"),this.load.image("clock_portrait","characters/clock_portrait.png"),this.load.image("chest","props/chest.png"),this.load.image("chest_open","props/chest_open.png"),this.load.image("book","props/book.png"),this.load.image("picture","props/picture.png"),this.load.image("safe","props/safe.png"),this.load.image("alchemy_empty","props/alchemy/alchemy_empty.png"),this.load.image("alchemy_green","props/alchemy/alchemy_green.png"),this.load.image("alchemy_red","props/alchemy/alchemy_red.png"),this.load.image("alchemy_blue","props/alchemy/alchemy_blue.png"),this.load.image("alchemy_full","props/alchemy/alchemy_full.png"),this.load.image("arrow","puzzles/arrow.png"),Array.from({length:26},((e,t)=>String.fromCharCode(97+t))).forEach((e=>this.load.audio(e,`sounds/words/${e}.mp3`))),this.load.audio("warp","sounds/warp.mp3"),this.load.audio("ladder","sounds/ladder.mp3"),this.load.audio("door","sounds/door.mp3"),localStorage.getItem(Rr)||$r(this)}create(){this.time.delayedCall(w.prod?2500:0,(()=>{ee(this,300,(()=>{localStorage.getItem(Rr)?this.scene.start("Game"):this.scene.start("Intro")}))}))}}class Yr extends a.GameObjects.Container{constructor(e,i,s){var n,r,o,l,h;super(e,i,s),t(this,"buttons",[]),t(this,"activeIndex",new a.Math.Vector2),t(this,"cursor"),e.add.existing(this).setScrollFactor(0),this.activeIndex.set(-1,-1),null==(n=e.input.keyboard)||n.on("keydown-UP",(()=>{this.setActiveButton({x:0,y:-1})})),null==(r=e.input.keyboard)||r.on("keydown-DOWN",(()=>{this.setActiveButton({x:0,y:1})})),null==(o=e.input.keyboard)||o.on("keydown-LEFT",(()=>{this.setActiveButton({x:-1,y:0})})),null==(l=e.input.keyboard)||l.on("keydown-RIGHT",(()=>{this.setActiveButton({x:1,y:0})})),null==(h=e.input.keyboard)||h.on("keydown-ENTER",(()=>{const e=this.getActiveButton();e&&e.onClick(e)})),e.input.on("pointermove",(()=>{this.cursor.setVisible(!1)}))}setButtons(e){this.buttons=e,this.activeIndex.set(-1,-1),this.removeAll(!0),this.cursor=this.scene.add.rectangle(0,0,60,80).setStrokeStyle(2,_(z),.75).setVisible(!1).setDepth(1),this.add(this.cursor);for(const t of e)for(const e of t)void 0!==e&&this.add(e)}getActiveButton(){var e;return null==(e=this.buttons[this.activeIndex.y])?void 0:e[this.activeIndex.x]}setActiveButton(e){var t,i,s,n,r,o,l;let{x:h,y:c}=this.activeIndex;if(!1===this.cursor.visible){const e=null==(t=this.buttons[c])?void 0:t[h];return void(e&&(this.updateButtonSize(e),this.cursor.setPosition(e.x,e.y).setVisible(!0),this.cursor.setVisible(!0)))}const d=this.buttons.length;if(c=a.Math.Clamp(c,0,d-1),h=a.Math.Clamp(h,0,((null==(i=this.buttons[c])?void 0:i.length)||0)-1),0===e.x){let t;if(-1!==this.activeIndex.y){for(;c>=0&&c=0&&h<(null==(r=this.buttons[c])?void 0:r.length)&&void 0===t;)h+=e.x,t=null==(o=this.buttons[c])?void 0:o[h];if(!t)return}const u=null==(l=this.buttons[c])?void 0:l[h];u&&(this.updateButtonSize(u),this.cursor.setPosition(u.x,u.y).setVisible(!0),this.activeIndex.set(h,c))}updateButtonSize(e){const t=1.2;e instanceof Ln&&this.cursor.setSize(e.displayWidth*t,e.displayHeight*t),e instanceof er&&this.cursor.setSize(e.rect.displayWidth*t,e.rect.displayHeight*t)}}const Qr=[[1,1,1,0,1],[1,0,1,0,1],[1,1,1,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1]],Jr=[["0","1","2"],["3"," ","4"],["5","6","7"]];class Zr extends a.Scene{constructor(){super("UITest"),t(this,"selected"),t(this,"cursor"),t(this,"grid"),this.selected=void 0}create(){var e;const t=[];for(let i=0;i{t[0][0].text="0",t[0][1].text="1",t[0][2].text="2",t[1][0].text="3",t[1][2].text="4",t[2][0].text="5",t[2][1].text="6",t[0][4].text=" ",t[1][4].text=" ",t[2][4].text=" ",t[3][4].text=" ",t[4][4].text=" ",t[5][4].text=" ",t[6][4].text=" "}))}btn(e,t){return new Ln(this,50+60*e,50+85*t,e<3?" ":t.toString(),(e=>this.selectButton(e)))}selectButton(e){if(void 0===this.selected)this.selected=e,e.setSelected(!0);else{const t=this.selected.text;this.selected.setSelected(!1),this.selected.text=e.text,e.text=t,this.selected=void 0,this.checkValid()&&console.log("You Won!")}}checkValid(){var e;let t=!0;for(let i=0;i{const s=this.textObject.getWrappedText().length,n=i/this.textObject.height,r=Math.floor(n*s);o&&o(r)})),null==(l=e.input.keyboard)||l.on("keydown-UP",(()=>{this.scrollY-=30,this.updateTextPosition()})),null==(h=e.input.keyboard)||h.on("keydown-DOWN",(()=>{this.scrollY+=30,this.updateTextPosition()})),this.maskGraphics=e.add.graphics().setPosition(i,s).setScrollFactor(0).setVisible(!1),this.add(this.maskGraphics),this.scrollbar=e.add.rectangle(0,0,4,0,5592405).setScrollFactor(0),this.add(this.scrollbar)}setBoxSize(e,t){this.boxHeight=t,this.maskGraphics.clear(),this.maskGraphics.fillStyle(16777215),this.maskGraphics.fillRect(0,0,e,t);const i=this.maskGraphics.createGeometryMask();return this.textObject.setMask(i),this.textObject.setWordWrapWidth(e-8),this.textObject.setFixedSize(e-8,0),this.updateTextPosition(),this}setText(e){return this.textObject.setText(e),this.updateTextPosition(),this}handleDrag(e){e.isDown&&(this.scrollY-=e.velocity.y,this.updateTextPosition())}handleScroll(e,t,i,s,n){this.scrollY+=.5*s,this.updateTextPosition()}updateTextPosition(){const e=Math.max(0,this.textObject.height-this.boxHeight);this.scrollY=a.Math.Clamp(this.scrollY,0,e),this.textObject.y=-this.scrollY;const t=this.scrollY/e,i=this.boxHeight/this.textObject.height;this.scrollbar.height=i*this.boxHeight,this.scrollbar.setPosition(this.textObject.width+4,t*(this.boxHeight-i*this.boxHeight))}}class to extends a.Scene{constructor(e){super(e.key),t(this,"dialogData"),t(this,"container"),t(this,"keys"),t(this,"title"),t(this,"additionalUI"),t(this,"closing"),this.dialogData=e}create(){var e,t,i;this.additionalUI=[],this.closing=!1,this.container=this.add.container(w.width/2,w.height/2),this.container.add(this.add.rectangle(0,0,.95*w.width,.95*w.height,0,.75).setStrokeStyle(4,_(z))),this.container.add(new Ln(this,.44*w.width,-.4*w.height,"X",(()=>this.close(!1)),{backgroundColor:`#${L}`})),w.prod||this.dialogData.hideCloseSuccess||this.container.add(new er(this,.38*w.width,-.4*w.height,"award",(()=>this.startClose(!0)))),this.title=this.add.text(0,-.4*w.height,this.dialogData.title,{...an,fontSize:48}).setOrigin(.5),this.container.add(this.title),null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>{this.startClose(!1)})),null==(t=this.input.keyboard)||t.on("keydown-BACKSPACE",(()=>{this.startClose(!1)})),w.prod||null==(i=this.input.keyboard)||i.on("keydown-BACK_SLASH",(()=>{this.startClose(!0)})),this.keys=new de(this),new Zn(this,!0).setVisible(this.dialogData.gamepadVisible),this.container.setAlpha(0),this.dialogData.childScene?(this.scene.launch(this.dialogData.childScene,{parent:this}),this.scene.get(this.dialogData.childScene).events.on("create",(()=>this.fadeIn()))):this.fadeIn()}fadeIn(){this.tweens.add({targets:this.getTargets(),alpha:{start:0,to:1},delay:100,duration:500})}fadeOut(e){this.tweens.add({targets:this.getTargets(),alpha:{start:1,to:0},duration:250,hold:250,onComplete:e})}addTarget(e){e.setAlpha(0),this.additionalUI.push(e)}getTargets(){return[this.container,...this.additionalUI]}startClose(e){this.closing||(this.closing=!0,this.close(e))}close(e){this.fadeOut((()=>{var t,i,s,n;this.scene.stop(),this.dialogData.childScene&&this.scene.stop(this.dialogData.childScene),this.scene.resume("Game"),null==(i=null==(t=this.scene.get("Game"))?void 0:t.gamepad)||i.setAlpha(1),null==(n=null==(s=this.scene.get("Game"))?void 0:s.gamepad)||n.resetButtons(),this.handleSuccess(e)}))}}const io="chrono-sleuth-debug-tab";function so(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function no(e){for(var t=1;tt+e)):Array.from(Array(e).keys())}function lo(e){return[...new Set(e)]}function ho(e,t){const i=lo(e.map((e=>e.set))).filter(Boolean),s=(n=ao(1,e.length+1),r=i,[n,r].reduce(((e,t)=>e.filter((e=>!t.includes(e)))))).sort((()=>.5-t()));var n,r;e.filter((e=>!e.set)).forEach(((e,t)=>e.set=s[t]))}function co(e,t,i=.5){oo(e).forEach(((s,n)=>{const r=e[n+1],o=s.set!==r.set,a=t()<=i;var l,h,c;o&&a&&(l=e,h=r.set,c=s.set,l.forEach((e=>{e.set===h&&(e.set=c)})),s.right=!1,r.left=!1)}))}const uo=48;class po extends a.Scene{constructor(){super("Maze"),t(this,"parent"),t(this,"graphics"),t(this,"keys"),t(this,"maze"),t(this,"mazePlayer"),t(this,"nextUpdate")}init(e){this.parent=e.parent}create(){this.createMaze(),this.mazePlayer=this.add.ellipse(0,0,.8*uo,.8*uo,5601177).setSmoothness(32).setOrigin(-.13),this.cameras.main.startFollow(this.mazePlayer),this.keys=this.parent.keys,this.parent.addTarget(this.graphics),this.parent.addTarget(this.mazePlayer)}getMazeSeed(){return this.parent.player.gameState.data.mazeSeed||0}createMaze(){const e=this.getMazeSeed();this.maze=function(e=8,t=e,i=!0,s=1){const n=function(e){return function(){let t=e+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}(s),r=[],o=ao(e);for(let h=0;h({x:s,y:h,top:i||h>0,left:i||s>0,bottom:i||h{ho(e,n),co(e,n),function(e,t,i){const s=Object.values(function(e){let t=lo(e.map((e=>e.set))).reduce(((e,t)=>no(no({},e),{},{[t]:[]})),{});return e.forEach((e=>t[e.set].push(e))),t}(e)),{ceil:n}=Math;s.forEach((e=>{(function(e,t,i){t=null==t?1:t;const s=null==e?0:e.length;if(!s||t<1)return[];t=t>s?s:t;let n=-1;const r=s-1,o=[...e];for(;++n{if(e){const i=t[e.x];e.bottom=!1,i.top=!1,i.set=e.set}}))}))}(e,r[t+1],n)}));const a=(l=r)[l.length-1];var l;return ho(a,n),co(a,n,1),r}(24,24,!0,e),this.graphics=this.add.graphics(),this.graphics.fillStyle(10040098,.5),this.graphics.fillRect(1104,1104,uo,uo),this.graphics.lineStyle(3,3385907),this.maze.forEach((e=>{e.forEach((e=>{if(e.top){const t=new a.Geom.Line(e.x*uo,e.y*uo,e.x*uo+uo,e.y*uo);this.graphics.strokeLineShape(t)}if(e.bottom){const t=new a.Geom.Line(e.x*uo,e.y*uo+uo,e.x*uo+uo,e.y*uo+uo);this.graphics.strokeLineShape(t)}if(e.left){const t=new a.Geom.Line(e.x*uo,e.y*uo,e.x*uo,e.y*uo+uo);this.graphics.strokeLineShape(t)}if(e.right){const t=new a.Geom.Line(e.x*uo+uo,e.y*uo,e.x*uo+uo,e.y*uo+uo);this.graphics.strokeLineShape(t)}}))})),this.cameras.main.setViewport(50,130,w.width-100,w.height-170)}update(e,t){if(e=24||n>=24)return!1;const r=a.Math.FloorTo(this.mazePlayer.x/uo),o=a.Math.FloorTo(this.mazePlayer.y/uo),l=this.maze[o][r];return!(l.top&&ithis.mazePlayer.y||l.left&&tthis.mazePlayer.x)}}class yo extends a.GameObjects.Rectangle{constructor(e,i,s){super(e,0,0,i.size,i.size),t(this,"keys"),t(this,"cursorData"),t(this,"nextUpdate",0),t(this,"position",new a.Math.Vector2(-1,-1)),e.add.group(this,{runChildUpdate:!0}),this.setStrokeStyle(2,_(z),.75),this.setVisible(!1),this.cursorData=i,this.keys=s,e.input.on("pointerdown",(e=>{this.setVisible(!1)}))}update(e,t){var i;if(ethis.resume()))),this.container.add(this.add.text(t/2,w.height/2-100,"Game Paused",{...an,fontSize:72}).setOrigin(.5)),this.debugCount=0,this.container.add(this.add.text(t-20,i-20,`Build Time: ${new Date("2025-01-02T08:11:09.570Z").toLocaleString()}\n${w.prod?"":"Debug Mode"}`,{...an,fontSize:16,align:"right",padding:{x:20,y:20}}).setOrigin(1,1).setInteractive({useHandCursor:!1}).on("pointerdown",(()=>{this.debugCount++,this.debugCount>10&&(localStorage.setItem("chrono-sleuth-prod",w.prod?"false":"true"),window.location.reload())})));const s=w.zoomed?36:48,n=new Yr(this);this.container.add(n);const r=new er(this,w.width-210,30,"tv",(()=>{un()})),o=new er(this,w.width-150,30,"gamepad",(()=>{this.parent.gamepad.setVisible(!this.parent.gamepad.visible)})),a=new er(this,w.width-90,30,this.parent.sound.mute?"volume-mute":"volume",(()=>{const e=this.parent.sound.mute;this.parent.sound.mute=!e,a.setIcon(e?"volume":"volume-mute")})),l=new qr(this,w.width-30,30),h=new Ln(this,t/2,w.height/2,"Resume",(()=>this.resume()),{fontSize:s});let c;w.prod||(c=new er(this,30,30,"terminal",(()=>{this.resume(),this.parent.time.delayedCall(200,(()=>{ie(this.parent,"DebugTool")}))}))),n.setButtons([[c,r,o,a,l],[void 0,h,void 0,void 0,void 0],[void 0,void 0,void 0,void 0,void 0]]),n.activeIndex.set(1,1),null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>this.resume())),new Zn(this).setVisible(!1),this.tweens.add({targets:this.container,alpha:{start:0,to:1},duration:250})}resume(){this.tweens.add({targets:this.container,alpha:{start:1,to:0},duration:250,onComplete:()=>{this.scene.stop(),this.scene.resume("Game")}})}}class fo extends a.Scene{constructor(){super("Pipes"),t(this,"parent"),t(this,"keys"),t(this,"pipes",[]),t(this,"totalPipes",0),t(this,"images",[]),t(this,"container"),t(this,"blockSize"),t(this,"pipeSize"),t(this,"initialized",!1)}init(e){this.parent=e.parent,this.blockSize=w.zoomed?13:17,this.pipeSize=3.75*this.blockSize}preload(){this.prerenderPipes()}prerenderPipes(){for(const e of yr){const t=ir[e],i=`pipe_${e}`;this.textures.exists(i)&&this.textures.remove(i);const s=this.textures.createCanvas(i,3*this.blockSize,3*this.blockSize);if(s){const e=s.context;e.fillStyle="#ffffff";for(let i=0;i{const t=this.pipes[e.y+1][e.x+1];t.interactive&&(t.rotation=(t.rotation+90)%360,this.updatePipes())}},this.keys);this.container.add(t)}createPipes(){this.pipes=[],this.container=this.add.container().setPosition(w.width/2-16*this.pipeSize/2+this.pipeSize/2,w.height/4),this.totalPipes=0;for(let e=0;e<8;e++){this.pipes[e]||(this.pipes[e]=[]);for(let t=0;t<16;t++){let i=sr[e][t];const s=0===t||0===e||15===t||7===e,n=15===t&&7===e,r=!s;this.pipes[e][t]={x:t,y:e,type:i,rotation:s?0:90*a.Math.Between(0,3),interactive:r},i!==tr.Empty&&this.totalPipes++;const o=t+e*sr[0].length;this.time.delayedCall(50+5*o,(()=>{const s=`pipe_${i}`,o=this.add.image(t*this.pipeSize,e*this.pipeSize,s).on("pointerdown",(()=>{this.initialized&&(this.pipes[e][t].rotation=(this.pipes[e][t].rotation+90)%360,this.updatePipes())}));o.setAlpha(0).setScale(.5).setAngle(this.pipes[e][t].rotation),this.tweens.add({targets:o,alpha:1,scale:1,duration:300,onComplete:n?()=>{this.initialized=!0,this.updatePipes()}:void 0}),r?o.setInteractive():o.setTint(6710886),this.container.add(o),this.images.push(o)}))}}this.parent.addTarget(this.container)}updatePipes(){const e=function(e){const t=[],i=new Set,s=e.length,n=e[0].length;return function r(o,a){const l=`${o},${a}`;i.add(l),t.push(e[a][o]),o+1=0&&!i.has(`${o-1},${a}`)&&nr(e[a][o],e[a][o-1])&&r(o-1,a),a+1=0&&!i.has(`${o},${a-1}`)&&nr(e[a][o],e[a-1][o])&&r(o,a-1)}(0,2),t}(this.pipes);this.pipes.forEach((e=>{e.forEach((e=>{this.images[e.x+e.y*sr[0].length].setAngle(e.rotation)}))})),e.length===this.totalPipes&&this.parent.close(!0)}completed(e){const t=this.images.length,i=new a.Display.Color(255,255,255),s=U(_(D));for(let n=0;nr.setTint(e)),{duration:500,delay:10*n,hold:1e3,onComplete:n===t-1?e:void 0})}}}const mo=w.height/(w.zoomed?4:5.5),bo=[[1,0,1,1,0],[0,1,0,0,0],[0,0,1,0,1],[0,0,1,1,0],[1,1,0,0,1]],vo=2*Math.PI/16;!function(e={}){const{immediate:t=!1,onNeedRefresh:i,onOfflineReady:s,onRegistered:n,onRegisteredSW:r,onRegisterError:a}=e;let l,h;h=async function(){if("serviceWorker"in navigator){if(l=await function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){const e=document.getElementsByTagName("link"),n=document.querySelector("meta[property=csp-nonce]"),r=(null==n?void 0:n.nonce)||(null==n?void 0:n.getAttribute("nonce"));s=Promise.allSettled(t.map((t=>{if(t=function(e,t){return new URL(e,t).href}(t,i),t in o)return;o[t]=!0;const s=t.endsWith(".css"),n=s?'[rel="stylesheet"]':"";if(i)for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.href===t&&(!s||"stylesheet"===n.rel))return}else if(document.querySelector(`link[href="${t}"]${n}`))return;const a=document.createElement("link");return a.rel=s?"stylesheet":"modulepreload",s||(a.as="script"),a.crossOrigin="",a.href=t,r&&a.setAttribute("nonce",r),document.head.appendChild(a),s?new Promise(((e,i)=>{a.addEventListener("load",e),a.addEventListener("error",(()=>i(new Error(`Unable to preload CSS for ${t}`))))})):void 0})))}function n(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then((t=>{for(const e of t||[])"rejected"===e.status&&n(e.reason);return e().catch(n)}))}((async()=>{const{Workbox:e}=await import("./workbox-window.prod.es5-BXNXHyjv.js");return{Workbox:e}}),[],import.meta.url).then((({Workbox:e})=>new e("./sw.js",{scope:"./",type:"classic"}))).catch((e=>{null==a||a(e)})),!l)return;l.addEventListener("activated",(e=>{(e.isUpdate||e.isExternal)&&window.location.reload()})),l.addEventListener("installed",(e=>{e.isUpdate||null==s||s()})),l.register({immediate:t}).then((e=>{r?r("./sw.js",e):null==n||n(e)})).catch((e=>{null==a||a(e)}))}}()}({immediate:!0});const wo={type:Phaser.WEBGL,width:w.width,height:w.height,parent:"game-container",backgroundColor:_(W),scale:{mode:Phaser.Scale.FIT,autoCenter:w.prod?Phaser.Scale.CENTER_BOTH:Phaser.Scale.CENTER_HORIZONTALLY},loader:{imageLoadType:"HTMLImageElement"},scene:[Ur,Xr,Kr,Vr,Sr,go,class extends to{constructor(){super({key:"JournalDialog",title:"Journal",gamepadVisible:!1,hideCloseSuccess:!0}),t(this,"player")}init(e){this.player=e.player}create(){var e;super.create(),this.player.journal.unread.setVisible(!1);const t=this.player.journal.journal.map((e=>`- ${ge[e].description}\n`)).reverse(),i=new eo(this,.08*w.width,.25*w.height,t,{fontSize:32});i.setBoxSize(.84*w.width,.62*w.height),this.addTarget(i),this.fadeIn(),null==(e=this.input.keyboard)||e.on("keydown-J",(()=>{this.close()}))}handleSuccess(){}},class extends to{constructor(){super({key:"DebugTool",title:"Debug Tool",gamepadVisible:!1,hideCloseSuccess:!0}),t(this,"player"),t(this,"tabs",[]),t(this,"tab",0),t(this,"mainContainer"),t(this,"textBox"),t(this,"helperText"),t(this,"stateContainer"),t(this,"saveContainer"),t(this,"miscContainer"),t(this,"preSave"),t(this,"testVoice",{octave:3.5,speed:1,volume:1,type:"sine"});const e=localStorage.getItem(io);e&&(this.tab=Number(e))}init(e){this.player=e.player;const t=fn(this.player.scene);t.settings.time=0,this.preSave=JSON.stringify(t)}create(){var e;super.create(),this.mainContainer=this.add.container(-w.width/2,-w.height/2),this.container.add(this.mainContainer),this.mainContainer.add(this.add.rectangle(300,100,.65*w.width,.75*w.height,_("#112233")).setOrigin(0));const t=this.makeTab("Items",0),i=this.makeTab("Journal",1),s=this.makeTab("Quests",2),n=this.makeTab("State",3),r=this.makeTab("Warp",4),o=this.makeTab("Saves",5),a=this.makeTab("Misc",6);this.textBox=new eo(this,300,100,"",{fontSize:32},(e=>this.handleLineClick(e))).setBoxSize(.38*w.width,.75*w.height),this.mainContainer.add(this.textBox),this.helperText=this.add.text(w.zoomed?.94*w.width:.87*w.width,110,"",{...an,fontSize:24}).setOrigin(1,0).setDepth(1),this.mainContainer.add(this.helperText),this.tabs=[t,i,s,n,r,o,a],this.container.add(this.tabs),this.createStateContainer(),this.createSaveContainer(),this.createMiscContainer(),this.updateTabs(),null==(e=this.input.keyboard)||e.on("keydown-CLOSED_BRACKET",(()=>{this.close()}))}createStateContainer(){this.stateContainer=this.add.container(310,100),this.mainContainer.add(this.stateContainer);const e=this.player.gameState.data;Object.entries(e).forEach(((t,i)=>{const[s,n]=t,r=this.add.text(0,20+40*i,`${s}: ${n}`,{...an,fontSize:32}).setOrigin(0);switch(this.stateContainer.add(r),typeof n){case"boolean":r.setText(`${n?"[x]":"[ ]"} ${s}`),r.setInteractive().on("pointerdown",(()=>{e[s]=!e[s],r.setText(`${e[s]?"[x]":"[ ]"} ${s}`)}));break;case"number":const t=this.smallButton(r.width+20,22+40*i,"-",(()=>{e[s]--,r.setText(`${s}: ${e[s]}`)})),o=this.smallButton(r.width+55,22+40*i,"+",(()=>{e[s]++,r.setText(`${s}: ${e[s]}`)}));this.stateContainer.add([t,o])}}))}smallButton(e,t,i,s){return new Bn(this,e,t,i,s,{fontSize:36,backgroundColor:"#111",padding:{x:6,y:-4}},null)}createSaveContainer(){this.saveContainer=this.add.container(310,100),this.mainContainer.add(this.saveContainer),Object.entries(Hr).forEach(((e,t)=>{const[i,s]=e,n=new Bn(this,0,10+60*t,Wr[Number(i)],(()=>{Number(i)===Wr.New?(localStorage.removeItem(Rr),window.location.reload()):(xn(this.player.scene,s),this.player.x+=.1,this.close(!0))}),{backgroundColor:"#111"});this.saveContainer.add(n)}));const e=new Bn(this,350,10,"Dump Save",(()=>{const e=(t=fn(this.player.scene),JSON.stringify(t,((e,t)=>{const i=bn[e];return Array.isArray(t)&&i?t.map((e=>se(e,i.enumObj,i.enumName))):i?se(t,i.enumObj,i.enumName):t}),2).replace(/"(\w+\.\w+)"/g,"$1"));var t;navigator.clipboard.writeText(e).catch((e=>console.error(e))),console.warn("save copied to clipboard!"),console.log(e)}),{backgroundColor:"#111"});this.saveContainer.add(e)}createMiscContainer(){this.miscContainer=this.add.container(310,100),this.mainContainer.add(this.miscContainer);const e=new Bn(this,350,10,"Debug Mode",(()=>{w.debug=!w.debug,this.close()}),{backgroundColor:"#111"});this.miscContainer.add(e)}makeTab(e,t){return new Bn(this,40-this.container.x,100-this.container.y+60*t,e,(()=>{this.tab=t,localStorage.setItem(io,String(t)),this.updateTabs()}))}rangeInput(e,t,i,s,n){const r=this.add.text(e,t,`${n}: ${i().toFixed(1)}`,{...an}),o=this.smallButton(e+130,t,"-",(()=>{s(i()-.1),r.text=`${n}: ${i().toFixed(1)}`})),a=this.smallButton(e+170,t,"+",(()=>{s(i()+.1),r.text=`${n}: ${i().toFixed(1)}`}));return[r,o,a]}handleLineClick(e){var t,i;switch(this.tab){case 0:const s=ar[e],n=this.player.inventory.inventory,r=n.find((e=>e.type===s));r?r.used?n.splice(n.indexOf(r),1):r.used=!r.used:this.player.inventory.addItem({type:s,used:!1},!0);break;case 1:const o=lr[e],a=this.player.journal.journal;Ce(this.player,o)?a.splice(a.indexOf(o),1):this.player.journal.addEntry(o,!0);break;case 2:const l=dr[e],h=this.player.quests.quests,c=h.find((e=>e.id===l));c?c.completed?h.splice(h.indexOf(c),1):c.completed=!c.completed:this.player.quests.addQuest({id:l,completed:!1},!0);break;case 4:const d=ur[e],u=be[d];this.player.setPosition(u.x,u.y),this.close();break;case 6:if(e>1){const s=gr[e-2];"MainMenu"===s?(this.scene.sendToBack("Game"),this.scene.start(s)):(this.scene.stop(this),this.scene.resume("Game"),null==(i=null==(t=this.scene.get("Game"))?void 0:t.gamepad)||i.setAlpha(1),ie(this.player.scene,s))}}this.updateTabs()}updateTabs(){var e,t,i;this.tabs.forEach(((e,t)=>{e.setBackgroundColor(t===this.tab?"#123":"#151515")}));const s=0===this.tab||1===this.tab||2===this.tab||4===this.tab||6===this.tab,n=0===this.tab||2===this.tab;null==(e=this.stateContainer)||e.setVisible(3===this.tab),null==(t=this.saveContainer)||t.setVisible(5===this.tab),null==(i=this.miscContainer)||i.setVisible(6===this.tab),this.textBox.setVisible(s),this.helperText.setVisible(n);let r="";switch(this.tab){case 0:r=ar.map((e=>`[${ke(this.player,e)?"-":Pe(this.player,e)?"x":" "}] ${P[e]}`)).join("\n"),this.helperText.setText("[-] item held\n[x] item used");break;case 1:r=lr.map((e=>`[${Ce(this.player,e)?"x":" "}] ${j[e]}`)).join("\n");break;case 2:r=dr.map((e=>`[${Ie(this.player,e)?"-":Te(this.player,e)?"x":" "}] ${I[e]}`)).join("\n"),this.helperText.setText("[-] quest active\n[x] quest complete");break;case 4:r=ur.map((e=>k[e])).join("\n");break;case 6:r=["Scenes","-----------------",...gr].join("\n")}this.textBox.setText(r)}handleSuccess(e){const t=fn(this.player.scene);t.settings.time=0,this.preSave!==JSON.stringify(t)&&(e||xn(this.player.scene),this.player.scene.scene.restart())}},class extends to{constructor(){super({key:"MazeDialog",title:"Find your way through the forest",childScene:"Maze",gamepadVisible:!0}),t(this,"player"),t(this,"arrow")}init(e){var t,i;this.player=e.player,this.dialogData.gamepadVisible=null==(i=null==(t=e.player.scene)?void 0:t.gamepad)?void 0:i.visible}create(){super.create(),this.arrow=this.add.image(.4*-w.width,.4*-w.height,"arrow").setScale(.5).setRotation(.75*Math.PI),this.container.add(this.arrow)}setAngle(e){this.arrow.setRotation(e+Math.PI/2)}handleSuccess(e){e?(xe(k.Forest,this.player),this.player.gameState.updateData({mazeSolved:!0,mazeSeed:this.player.gameState.data.mazeSeed+1},!1)):this.player.setPosition(be[k.TownEast].x-100,be[k.TownEast].y)}},po,class extends to{constructor(){super({key:"PipesDialog",title:"Attach all of the pipes to fix the alchemy set.\n[CONTINUE/CLICK] to rotate",gamepadVisible:!1,childScene:"Pipes"}),t(this,"player")}init(e){this.player=e.player}create(){super.create(),this.title.setFontSize(36).setAlign("center").setY(this.title.y+10)}close(e){const t=this.scene.get("Pipes");e&&t?t.completed((()=>super.close(e))):super.close(e)}handleSuccess(e){e&&this.player.message.setDialog(Cr,Me(this.player.scene,O.AlchemySet),"player_portrait")}},fo,class extends to{constructor(){super({key:"TumblerDialog",title:"Open the lock by aligning all rings",gamepadVisible:!1}),t(this,"player"),t(this,"angles"),t(this,"rings"),t(this,"line"),t(this,"fx"),t(this,"active"),t(this,"nextUpdate"),t(this,"disabled")}init(e){this.player=e.player}preload(){this.load.setPath("assets");for(let e=1;e<=5;e++)this.load.image(`ring_${e}`,`puzzles/tumbler/ring${e}.png`)}create(){super.create(),this.angles=[],this.rings=[],this.fx=[],this.active=-1,this.nextUpdate=0,this.disabled=!1,this.line=this.add.line(0,30,27,0,216,0,_(R)).setOrigin(0,0).setLineWidth(5),this.container.add(this.line),this.container.add(this.add.text(.45*-w.width,.2*w.height,"Use [Left]/[Right]\nto select a ring\n\nUse [Up]/[Down]\nto rotate a ring",{...an}));for(let e=0;e{if(this.active=-1,i.isDown){this.active=e;const s=a.Math.Angle.Between(t.x,t.y,i.x,i.y);this.handleMove(e,s)}})).on("dragstart",(i=>{if(this.active=-1,i.isDown){this.active=e;const s=a.Math.Angle.Between(t.x,t.y,i.x,i.y);this.handleMove(e,s)}})).on("dragend",(()=>{this.active=-1,this.updateMarkers(!0)}));this.fx.push(i.postFX.addGlow(_(R),2,0)),this.input.enableDebug(i),this.container.add(i),this.rings.push(i)}handleMove(e,t,i){var s;if(this.disabled)return;const n=this.angles[e]-t;this.angles[e]=t%(2*Math.PI),null==(s=bo[e])||s.forEach(((t,i)=>{i!==e&&(this.angles[i]=(this.angles[i]+t*n)%(2*Math.PI))})),this.updateMarkers(i)}updateMarkers(e){let t=!0;this.angles.forEach(((e,i)=>{var s;const n=a.Math.Snap.To(e,vo);Math.abs(n-0)<.6*vo||Math.abs(n-2*Math.PI)<.6*vo||(t=!1),null==(s=this.rings[i])||s.setAngle(a.Math.RadToDeg(n))})),t&&e&&this.close(!0)}completed(e){this.tweens.add({targets:this.rings,rotation:0,duration:500,onComplete:()=>{this.angles=[0,0,0,0,0],this.updateMarkers(),this.disabled=!0,this.active=-1,this.tweens.add({targets:[...this.rings,this.line],rotation:2*Math.PI,delay:500,duration:1500,hold:1e3,onComplete:e})}})}update(e,t){var i;if(!(esuper.close(e))):super.close(e)}handleSuccess(e){e&&function(e){e.inventory.removeItem(P.Potion);const t=e.scene,i=new Mr(e.scene,P.Gear2,e);t.interactiveObjects.add(i);const s=Me(t,O.MansionPicture);s&&(i.disabled=!0,i.setPosition(s.x,s.y+20),t.tweens.add({targets:i,x:s.x-10,y:s.y+120,duration:1e3,onComplete:()=>{e.message.setDialog({messages:["Wow, that was a trip","I should be more careful next time","At least I found the gear!"],onCompleted:()=>{gn(t,!1),t.time.delayedCall(1e3,(()=>i.disabled=!1))}},s,"player_portrait")},ease:"Bounce.easeOut"}))}(this.player)}},class extends to{constructor(){super({key:"MemoryDialog",title:"Figure out the secret code",gamepadVisible:!1}),t(this,"sequence"),t(this,"pressed"),t(this,"buttons"),t(this,"player")}init(e){this.player=e.player}preload(){this.load.setPath("assets");for(let e=1;e<=12;e++)this.load.image(`rune_${e}`,`puzzles/runes/Stone${e}.png`)}create(){for(super.create(),this.sequence=[],this.pressed=[];this.sequence.length<6;){const e=a.Math.RND.between(0,11);this.sequence.includes(e)||this.sequence.push(e)}w.prod||this.container.add(this.add.text(0,.43*w.height,`[ ${this.sequence.map((e=>e+1)).join(", ")} ]`,{fontSize:18,align:"center"}).setOrigin(.5)),this.buttons=new Gn(this),this.container.add(this.buttons);const e=w.width/13*1.2,t=[];for(let s=0;s<12;s++){const i=s%3*e-e,n=1.2*-e+Math.floor(s/3)*e,r=Math.floor(s/3);void 0===t[r]&&t.push([]),t[r].push({x:i,y:n});const o=this.add.image(i,n,`rune_${s+1}`).setInteractive({useHandCursor:!0});o.on("pointerdown",(()=>this.onButtonPress(o,s))),this.buttons.add(o)}const i=new yo(this,{regions:t,size:e,keyHandler:e=>{const t=3*e.y+e.x,i=this.buttons.getAt(t);this.onButtonPress(i,t)}},this.keys);this.container.add(i)}onButtonPress(e,t){const i=this.pressed.length;this.sequence[i]===t?(this.pressed.push(t),e.disableInteractive(),$(this,new a.Display.Color(255,255,255),U(_(B)),(t=>e.setTint(t)),{duration:250,onComplete:()=>{$(this,U(_(B)),U(3355443),(t=>e.setTint(t)),{duration:250,onComplete:()=>{this.sequence.length===this.pressed.length&&this.close(!0)}})}})):(e.disableInteractive(),$(this,new a.Display.Color(255,255,255),U(_(L)),(t=>e.setTint(t)),{duration:250,yoyo:!0,onComplete:()=>{this.buttons.each((e=>{e.setInteractive(),e.setTint(16777215)}))}}),this.pressed=[])}close(e){e?this.completed((()=>super.close(e))):super.close()}completed(e){this.time.delayedCall(300,(()=>{this.buttons.getAll().forEach(((t,i)=>{const s=11===i,n=t.tint,r=U(n),o=U(_(B));t.disableInteractive(),t.setTint(n),$(this,r,o,(e=>t.setTint(e)),{duration:200,delay:70*i,hold:500,onComplete:s?e:void 0})}))}))}handleSuccess(e){e&&function(e){const t=e.scene,i=new Mr(t,P.Gear1,e);t.interactiveObjects.add(i);const s=Me(t,O.Chest);s&&(e.setX(s.x-100),s.setTexture("chest_open"),s.disabled=!0,i.disabled=!0,i.setPosition(s.x,s.y-20),i.setScale(.15),t.tweens.add({targets:i,scale:.35,y:s.y+20,duration:700,onComplete:()=>{s.disabled=!1,i.disabled=!1},ease:"Bounce.easeOut"}))}(this.player)}},class extends to{constructor(){super({key:"SliderDialog",title:"Arrange the tiles to be in order.",gamepadVisible:!1}),t(this,"solution",[]),t(this,"layout",[]),t(this,"tiles",[])}preload(){this.load.setPath("assets");const e=Math.floor(1024/3);this.load.spritesheet("puzzle","puzzles/puzzle.png",{frameWidth:e,frameHeight:e})}create(){super.create();const e=[];this.solution=Array.from({length:9},((e,t)=>t)),this.layout=[...this.solution],this.tiles=[];for(let i=this.layout.length-1;i>0;i--){const e=Math.floor(Math.random()*(i+1));[this.layout[i],this.layout[e]]=[this.layout[e],this.layout[i]]}this.layout.forEach(((t,i)=>{const s=i%3,n=Math.floor(i/3),r=(s-1)*mo,o=(n-1)*mo+30;void 0===e[n]&&(e[n]=[]),e[n].push({x:r,y:o});const a=this.add.image(r,o,"puzzle",i).setOrigin(.5).setDisplaySize(.95*mo,.95*mo);this.container.add(a),a.setInteractive({useHandCursor:!0}),a.on("pointerdown",(()=>{this.moveTile(i)})),this.tiles.push(a)}));const t=new yo(this,{regions:e,size:1.1*mo,keyHandler:e=>{const t=3*e.y+e.x;this.moveTile(t)}},this.keys);this.container.add(t),this.updateLayout()}moveTile(e){const t=this.layout.indexOf(8),i=t%3,s=Math.floor(t/3),n=e%3,r=Math.floor(e/3);Math.abs(i-n)+Math.abs(s-r)===1&&(this.layout[t]=this.layout[e],this.layout[e]=8,this.updateLayout()),this.layout.join("")===this.solution.join("")&&this.handleSuccess(!0)}updateLayout(){this.layout.forEach(((e,t)=>{this.tiles[t].setFrame(e),this.tiles[t].setVisible(8!=e)}))}completed(e){for(let t=0;t{t0&&this.tiles[t-1].setTint(6710886)}));this.time.delayedCall(2e3,e)}close(e){e?this.completed((()=>super.close(e))):super.close(e)}handleSuccess(e){e&&this.time.delayedCall(750,(()=>{this.close(!0)}))}},Zr],pipeline:{CRTPipeline:cn,XRayPipeline:yn},input:{gamepad:!0},disableContextMenu:w.prod,physics:{default:"arcade"},fps:{panicMax:165,smoothStep:!0},render:{pixelArt:!0,antialias:!1},dom:{createContainer:!0},plugins:{scene:[{key:"PipelinePlugin",plugin:dn,mapping:"pipelinePlugin"}]}};oe.style.cursor="none",oe.addEventListener("mousemove",(function(){oe.style.cursor="default",clearTimeout(re),re=setTimeout((()=>{oe.style.cursor="none"}),2500)}));const xo=document.querySelector("#initial-loader");null==xo||xo.remove();const So=new a.Game(wo);w.prod||function(e){xr=(()=>{const e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";const t=[];return{REVISION:17,dom:e,panels:t,addPanel:function(i){return e.appendChild(i.dom),t.push(i),i}}})(),document.body.appendChild(xr.dom);const t=xr.dom.style;t.display="flex",t.justifyContent="center",t.flexWrap="wrap",t.gap="6px",t.cursor="",t.right="0",t.top="",t.bottom="10px",t.opacity="0.7";const i=xr.addPanel(wr("FPS","#9ad8e4","#064b62")),s=xr.addPanel(wr("Frame Time","#f3b0c3","#6b1e3d")),n=xr.addPanel(wr("Memory (mb)","#ffd59a","#6b3e06")),r=xr.addPanel(wr("Render","#e9f3a3","#4c6b1a")),o=xr.addPanel(wr("Step","#c3c3f3","#1d1d6b"));let a=0,l=0;e.events.on(Phaser.Core.Events.PRE_STEP,(()=>a=performance.now())),e.events.on(Phaser.Core.Events.POST_STEP,(()=>o.update(performance.now()-a))),e.events.on(Phaser.Core.Events.PRE_RENDER,(()=>l=performance.now())),e.events.on(Phaser.Core.Events.POST_RENDER,(()=>{const t=e.loop.deltaHistory.slice(0,10).reduce(((e,t)=>e+t),0)/10;r.update(performance.now()-l),i.update(1e3/t),s.update(performance.now()-a),performance.memory&&n.update(performance.memory.usedJSHeapSize/1048576)}))}(So); diff --git a/assets/index-DlKJ9cz_.js b/assets/index-DlKJ9cz_.js deleted file mode 100644 index 5f54b52..0000000 --- a/assets/index-DlKJ9cz_.js +++ /dev/null @@ -1 +0,0 @@ -var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s)(t,"symbol"!=typeof i?i+"":i,s);import{r as i,g as s,c as n,a as r}from"./phaser-BZMViRUx.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const i of e)if("childList"===i.type)for(const e of i.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const o={};var a=i();const l={width:1280,height:720},h={width:960,height:540};let c=!1,d=!1,u=!1;u=!0;let p=!0;const y=localStorage.getItem("chrono-sleuth-prod");let g;null!==y&&(p="true"===y);let f=p;f=!0;let m=!1;p&&(m=!1);const{width:b,height:v}=h;p&&(c=!1,u=!1,p=!0,g=void 0,d=!1);const w={debug:c,phaserInspector:d,prod:p,bootDialog:g,useShader:!0,width:b,height:v,cameraOffset:v/3,zoomed:!0,dayMinutes:.25,rewindEnabled:!1,fastMode:u,perfTest:m};var x=(e=>(e[e.Backgrounds=-1]="Backgrounds",e[e.Warpers=0]="Warpers",e[e.Npcs=1]="Npcs",e[e.Items=2]="Items",e[e.Player=3]="Player",e[e.Shader=4]="Shader",e[e.Ui=5]="Ui",e[e.Ui2=6]="Ui2",e[e.Debug=7]="Debug",e[e.Overlay=8]="Overlay",e))(x||{}),S=(e=>(e[e.None=0]="None",e[e.Teleported=1]="Teleported",e[e.Talked=2]="Talked",e[e.Item=3]="Item",e[e.Prop=4]="Prop",e))(S||{}),k=(e=>(e[e.Underground=0]="Underground",e[e.Town=1]="Town",e[e.TownEast=2]="TownEast",e[e.Forest=3]="Forest",e[e.ForestEast=4]="ForestEast",e[e.Lake=5]="Lake",e[e.TownNorth=6]="TownNorth",e[e.ClockSquare=7]="ClockSquare",e[e.ClockSquareNorth=8]="ClockSquareNorth",e[e.ClockEntrance=9]="ClockEntrance",e[e.ClockStairs=10]="ClockStairs",e[e.ClockTop=11]="ClockTop",e[e.TownWest=12]="TownWest",e[e.MansionGrounds=13]="MansionGrounds",e[e.MansionEntrance=14]="MansionEntrance",e[e.Mansion=15]="Mansion",e[e.LabHatch=16]="LabHatch",e[e.Lab=17]="Lab",e[e.LibraryEntrance=18]="LibraryEntrance",e[e.Library=19]="Library",e))(k||{}),P=(e=>(e[e.Wrench=0]="Wrench",e[e.Gear1=1]="Gear1",e[e.Key=2]="Key",e[e.HerbRed=3]="HerbRed",e[e.HerbGreen=4]="HerbGreen",e[e.HerbBlue=5]="HerbBlue",e[e.Potion=6]="Potion",e[e.Gear2=7]="Gear2",e))(P||{}),I=(e=>(e[e.ForestGear=0]="ForestGear",e[e.SphinxRiddle=1]="SphinxRiddle",e[e.InvestigateTownWest=2]="InvestigateTownWest",e[e.ExploreLab=3]="ExploreLab",e[e.FindPotionIngredients=4]="FindPotionIngredients",e))(I||{}),T=(e=>(e[e.Inventor=0]="Inventor",e[e.Stranger=1]="Stranger",e[e.Sphinx=2]="Sphinx",e[e.Mayor=3]="Mayor",e[e.ClockTower=4]="ClockTower",e))(T||{}),C=(e=>(e[e.Sphinx=0]="Sphinx",e))(C||{}),j=(e=>(e[e.FixTheClock=0]="FixTheClock",e[e.MetTheMayor=1]="MetTheMayor",e[e.ClockFirstGear=2]="ClockFirstGear",e[e.AlchemyLabFound=3]="AlchemyLabFound",e[e.AlchemySetFixed=4]="AlchemySetFixed",e[e.ExtraPotionInformation=5]="ExtraPotionInformation",e[e.SafeDiscovered=6]="SafeDiscovered",e[e.ClockSecondGear=7]="ClockSecondGear",e))(j||{}),O=(e=>(e[e.Chest=0]="Chest",e[e.LabHatch=1]="LabHatch",e[e.LabBook=2]="LabBook",e[e.AlchemySet=3]="AlchemySet",e[e.LabBookshelf1=4]="LabBookshelf1",e[e.LabBookshelf2=5]="LabBookshelf2",e[e.LabBookshelf3=6]="LabBookshelf3",e[e.LabPotionShelf1=7]="LabPotionShelf1",e[e.MansionPicture=8]="MansionPicture",e[e.MansionHole=9]="MansionHole",e))(O||{}),A=(e=>(e[e.LabStairs=0]="LabStairs",e))(A||{});const E={[T.Inventor]:{x:550,y:635,scale:.75,image:"inventor",portrait:"inventor_portrait",name:"Johan the Inventor"},[T.Stranger]:{x:750,y:865,scale:1.35,image:"stranger",portrait:"stranger_portrait",name:"Mysterious Stranger"},[T.Sphinx]:{x:3520,y:790,scale:1,image:"sphinx",portrait:"sphinx_portrait",name:"Mystical Sphinx",onCreate:e=>zr(e.scene,e.scene.player.gameState.data.sphinxMoved,!0),light:1.85,initializeOnStart:!0},[T.Mayor]:{x:1065,y:-340,scale:.9,image:"mayor",portrait:"mayor_portrait",name:"Mayor of Town"},[T.ClockTower]:{x:880,y:-2090,scale:.5,image:"warp",portrait:"clock_portrait",name:"Clock Tower",particles:{texture:"warp",scale:{start:0,end:1.1},alpha:{start:1,end:0},lifespan:2e3,delay:1e3,maxAliveParticles:1,tint:[13067088]},onCreate:e=>{e.setOffset(150,-40)}}},M="fcfee9",z="e6c99d",D="303646",F="1c1831",L="993333",B="339933",G="ffccaa",R="335588",W="111111",N="ddaaee";function _(e){return a.Display.Color.HexStringToColor(e).color}function H(e){return _(a.Display.Color.RGBToString(255*e.r,255*e.g,255*e.b))}function U(e){const t=a.Display.Color.ColorToRGBA(e);return new a.Display.Color(t.r,t.g,t.b,t.a)}function $(e,t,i,s,n){const r=.3*(n.duration||100);return e.tweens.addCounter({from:0,to:r,onUpdate:e=>{const n=a.Display.Color.Interpolate.ColorWithColor(t,i,r,e.getValue());var o;s((o=n,_(a.Display.Color.RGBToString(o.r,o.g,o.b))))},...n})}const V=1200;let q=!1;function X(e){return H(e.lights.ambientColor)===_(M)}function K(e,t=!0){q||(Y(e,M,t),t?e.time.delayedCall(V,(()=>Q(e,.5))):Q(e,.5),e.lights.lights.forEach((i=>{const s=i.intensity;t?e.tweens.add({targets:i,duration:V,intensity:0,onComplete:()=>{i.setVisible(!1),i.setIntensity(s)}}):i.setVisible(!1)})))}function Y(e,t,i){if(!i)return void e.lights.setAmbientColor(_(t));q=!0;const s=H(e.lights.ambientColor),n=a.Display.Color.ValueToColor(s),r=a.Display.Color.ValueToColor(t);$(e,n,r,(t=>e.lights.setAmbientColor(t)),{duration:V,onComplete:()=>{q=!1}})}function Q(e,t){e.children.getAll("name","DebugLightGraphics").forEach((e=>e.setAlpha(t)))}const J=U(_(W));function Z(e,t,i){e.cameras.main.fadeIn(t,J.red,J.green,J.blue,((e,t)=>{t>=1&&i&&i()}))}function ee(e,t,i){e.cameras.main.fadeOut(t,J.red,J.green,J.blue,((e,t)=>{t>=1&&i&&i()}))}function te(e,t,i){return!!(t.inventory.initialized&&t.quests.initialized&&t.journal.initialized)&&a.Math.Distance.BetweenPointsSquared(e,t)<(i||1e3)**2}function ie(e,t,i){var s,n;null==(s=e.gamepad)||s.setAlpha(0),null==(n=e.gamepad)||n.resetButtons(),e.scene.pause(),e.scene.launch(t,{player:e.player,...i})}function se(e,t,i){return t&&Object.values(t).includes(e)?`${i}.${Object.keys(t).find((i=>t[i]===e))}`:e}function ne(e){return e.replace(/([A-Z]+|[0-9]+)/g," $1").trim()}let re;const oe=document.documentElement;class ae extends a.GameObjects.GameObject{constructor(e,i,s,n,r,o){super(e,"DebugLight"),t(this,"x"),t(this,"y"),t(this,"light"),t(this,"debug"),e.add.existing(this),this.light=e.lights.addLight(i,s,n,r,o),this.debug=e.add.graphics({x:i,y:s}).setDepth(x.Debug),this.debug.lineStyle(3,65280),this.debug.name="DebugLightGraphics",this.x=i,this.y=s,w.debug&&this.debug.strokeCircle(0,0,n)}setPosition(e,t){this.light.setPosition(e,t),this.debug.setPosition(e,t),this.x=e,this.y=t}destroy(e){var t,i;super.destroy(e),this.debug.destroy(),null==(i=null==(t=this.scene)?void 0:t.lights)||i.removeLight(this.light)}}const le=2*Math.PI;class he extends a.GameObjects.Graphics{constructor(e,i){super(e),t(this,"player"),t(this,"angle1",0),t(this,"angle2",1),t(this,"angle3",4),t(this,"update1",!1),t(this,"update2",!1),t(this,"update3",!1),this.name="ClockHands",e.add.existing(this),this.player=i,this.setPosition(842,-2107),this.setDepth(x.Npcs),this.updateHands()}update(e){if(this.scene.cameras.main.worldView.contains(this.x,this.y))this.setVisible(!1);else{this.setVisible(!0),this.update1&&(this.angle1=le*(e/6e4)*35),this.update2&&(this.angle2=le*(e/36e5)*35),this.update3&&(this.angle3=le*(e/432e5)*35),this.clear(),this.fillStyle(_("#224477")),this.fillCircle(0,0,6),[8,6].forEach((e=>{this.lineStyle(e,_(6===e?"#224477":F)),this.lineBetween(0,0,50*Math.cos(this.angle1),50*Math.sin(this.angle1)),this.lineBetween(0,0,40*Math.cos(this.angle2),40*Math.sin(this.angle2)),this.lineBetween(0,0,25*Math.cos(this.angle3),25*Math.sin(this.angle3))})),this.lineStyle(5,_(F));for(let e=0;e<12;e++){const t=le*(e/12),i=50*Math.cos(t),s=50*Math.sin(t);this.lineBetween(i,s,1.5*i,1.5*s)}}}updateHands(){Ce(this.player,j.ClockFirstGear)&&(this.update1=!0),Ce(this.player,j.ClockSecondGear)&&(this.update2=!0)}}var ce=(e=>(e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.Left=2]="Left",e[e.Right=3]="Right",e[e.Continue=4]="Continue",e[e.Back=5]="Back",e[e.Shift=6]="Shift",e))(ce||{});class de{constructor(e){t(this,"scene"),t(this,"keys",Object.keys(ce).map(Number).reduce(((e,t)=>({...e,[t]:!1})),{})),this.scene=e,this.listener(2,"LEFT"),this.listener(3,"RIGHT"),this.listener(0,"UP"),this.listener(1,"DOWN"),this.listener(0,"W"),this.listener(2,"A"),this.listener(1,"S"),this.listener(3,"D"),this.listener(4,"SPACE"),this.listener(4,"ENTER"),this.listener(5,"BACKSPACE"),this.listener(6,"SHIFT")}listener(e,t){var i,s;null==(i=this.scene.input.keyboard)||i.on(`keydown-${t}`,(()=>this.keys[e]=!0)),null==(s=this.scene.input.keyboard)||s.on(`keyup-${t}`,(()=>this.keys[e]=!1))}resetKeys(){Object.entries(this.keys).forEach((([e,t])=>this.keys[Number(e)]=!1))}}class ue extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:r,image:o}=E[i];super(e,n,r,o),t(this,"npcType"),t(this,"player"),t(this,"light"),t(this,"particles"),t(this,"lastPos",new a.Math.Vector2),t(this,"clock"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`NPC-${i}`,this.npcType=i,this.player=s,this.setDepth(x.Npcs),"warp"===o&&this.setAlpha(0),ze(this,E[i])}lazyInit(e){if(!e&&(this.initialized||!te(this,this.player)))return;this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0});const{x:t,y:i,light:s,particles:n,onCreate:r}=E[this.npcType],o=s||1,a=!X(this.scene);w.debug?(this.light=new ae(this.scene,this.x,this.y,this.displayHeight/150*150,16764074,o),this.light.light.setVisible(a)):(this.light=this.scene.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,o),this.light.setVisible(a)),n&&(this.particles=this.scene.add.particles(t,i,"",n).setName(`NPC-${this.npcType}-Particles`)),this.npcType===T.ClockTower&&(this.clock=new he(this.scene,this.player)),r&&r(this),this.initialized=!0}update(e,t){this.lazyInit(),!this.light||this.x===this.lastPos.x&&this.y===this.lastPos.y||this.light.setPosition(this.x,this.y),this.lastPos.set(this.x,this.y),this.clock&&this.clock.update(e)}onInteract(e){if(this.player.message.visible||Date.now()0){const t=E[this.npcType].portrait.length>0;return this.player.message.setDialog(e,t?this:void 0),S.Talked}}return S.None}getButtonPrompt(){return this.npcType===T.ClockTower?["Inspect Clock Tower","Press [CONTINUE]"]:[`Talk to ${E[this.npcType].name}`,"Press [CONTINUE]"]}}const pe={[O.Chest]:{x:5110,y:915,image:"chest",scale:{x:4.5,y:3}},[O.LabHatch]:{x:-1910,y:640},[O.LabBook]:{x:-700,y:1630,image:"book"},[O.AlchemySet]:{x:-2650,y:1600,image:"alchemy_empty",initializeOnStart:!0,skipLighting:!0,particles:{scale:{min:.05,max:.15},speed:{min:30,max:120},alpha:{values:[0,.5,0]},gravityY:100,lifespan:{min:250,max:500},emitting:!1,stopAfter:60}},[O.LabBookshelf1]:{x:-2025,y:1700},[O.LabBookshelf2]:{x:-1290,y:1700},[O.LabBookshelf3]:{x:-1115,y:1700},[O.LabPotionShelf1]:{x:-1790,y:1700},[O.MansionPicture]:{x:-1233,y:-580,scale:1.2,angle:5,image:"picture",origin:{x:0,y:0},initializeOnStart:!0,skipLighting:!0},[O.MansionHole]:{x:-1870,y:-490}};class ye extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:r,image:o}=pe[i];super(e,n,r,o||""),t(this,"propType"),t(this,"player"),t(this,"particles"),t(this,"initialized",!1),t(this,"disabled",!1),this.name=`Prop-${i}`,this.propType=i,this.player=s,this.setScale(o?.35:2).setDepth(x.Items),o||w.debug||this.setAlpha(0),ze(this,pe[i]),i===O.MansionPicture&&this.resetPostPipeline()}lazyInit(e){if(!e&&(this.initialized||!te(this,this.player)))return;if(this.checkDestroyed())return;this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0});const t=pe[this.propType].particles;t&&(this.particles=this.scene.add.particles(this.x,this.y,"warp",t).setDepth(x.Items).setName(`Prop-${this.propType}-Particles`)),this.propType===O.MansionPicture&&this.scene.add.image(this.x,this.y,"safe").setOrigin(0,0).setScale(.9).setName("Prop-Safe"),this.initialized=!0}onInteract(e){if(this.player.message.visible||Date.now()0)return this.player.message.setDialog(e,this,pe[this.propType].portrait||"player_portrait"),S.Prop}return S.None}checkDestroyed(){let e=!1;return this.propType===O.LabHatch&&Ce(this.player,j.AlchemyLabFound)&&(e=!0),this.propType===O.Chest&&Se(this.player,P.Gear1)&&(e=!0),e&&this.destroy(),e}getButtonPrompt(){const e=Er(Ar[this.propType]||[],this.player,this);let t=O[this.propType];return t=ne(t),this.propType===O.MansionPicture&&Ce(this.player,j.SafeDiscovered)&&(t="Safe"),e&&(null==e?void 0:e.messages.length)>0?[`Inspect ${t}`,"Press [CONTINUE]"]:""}update(){this.lazyInit()}}const ge={[j.FixTheClock]:{description:"The inventor gave me a wrench to help fix the clock tower. I will also need three gears to repair it."},[j.MetTheMayor]:{description:"I have met the mayor of the town. She told me about the old clock tower. I should see if I can use the gear I found to try and fix it.",warpAdd:k.ClockSquareNorth},[j.ClockFirstGear]:{description:"I found the first gear for the clock tower and placed it into the clock face. I still need two more gears to fix it."},[j.AlchemyLabFound]:{description:"I found a secret alchemy lab. I wonder what the previous alchemist was brewing up.",warpAdd:k.LabHatch},[j.AlchemySetFixed]:{description:"With the alchemy set fixed, I can now attempt to create the brew mentioned in the old journal."},[j.ExtraPotionInformation]:{description:'I found an extra journal entry with more information on the potion. It stated the name of the potion was the "Exlixir of Sight". This potion must be the key to finding a gear.'},[j.SafeDiscovered]:{description:"I discovered a safe in the abandonded mansion. I wonder what secrets it holds."},[j.ClockSecondGear]:{description:"I found the second gear for the clock tower inside a safe, which was located within the abandoned mansion. I still need one more gear to fix it."}},fe={[I.ForestGear]:{description:"Find the gear in the forest",warpAdd:k.TownEast,warpComplete:k.TownNorth},[I.SphinxRiddle]:{description:"Solve the Sphinx riddle"},[I.InvestigateTownWest]:{description:"Investigate the west side of town",warpAdd:k.TownWest},[I.ExploreLab]:{description:"Explore the hidden alchemy lab"},[I.FindPotionIngredients]:{description:"Find the 3 potion ingredients"}};var me=(e=>(e[e.Ladder=0]="Ladder",e[e.Warp=1]="Warp",e[e.Invisible=2]="Invisible",e[e.WarpLocked=3]="WarpLocked",e[e.InvisibleLocked=4]="InvisibleLocked",e))(me||{});const be={[k.Town]:{x:300,y:650,key:ce.Down,warpTo:k.Underground,visual:0},[k.Underground]:{x:301,y:875,key:ce.Up,warpTo:k.Town,visual:0},[k.TownEast]:{x:1720,y:650,key:ce.Right,warpTo:k.Forest,visual:3},[k.Forest]:{x:2650,y:815,key:ce.Left,warpTo:k.TownEast,visual:1},[k.TownNorth]:{x:775,y:650,key:ce.Up,warpTo:k.ClockSquare,visual:3},[k.ClockSquare]:{x:610,y:-330,key:ce.Left,warpTo:k.TownNorth,visual:1},[k.ClockSquareNorth]:{x:915,y:-330,key:ce.Up,warpTo:k.ClockEntrance,visual:3},[k.ClockEntrance]:{x:690,y:-1320,range:15,key:ce.Left,warpTo:k.ClockSquareNorth,visual:1,skipLighting:!0},[k.ClockStairs]:{x:910,y:-1400,range:20,key:ce.Right,warpTo:k.ClockTop,visual:2,sound:"ladder"},[k.ClockTop]:{x:780,y:-1970,range:10,key:ce.Left,warpTo:k.ClockStairs,visual:2,sound:"ladder"},[k.ForestEast]:{x:3590,y:815,key:ce.Right,warpTo:k.Lake,visual:3,initializeOnStart:!0},[k.Lake]:{x:4625,y:915,key:ce.Left,warpTo:k.ForestEast,visual:1},[k.TownWest]:{x:90,y:650,key:ce.Left,warpTo:k.MansionGrounds,visual:3},[k.MansionGrounds]:{x:-620,y:640,key:ce.Right,warpTo:k.TownWest,visual:1},[k.MansionEntrance]:{x:-1290,y:640,key:ce.Up,warpTo:k.Mansion,visual:1,sound:"door"},[k.Mansion]:{x:-1405,y:-420,key:ce.Down,warpTo:k.MansionEntrance,visual:2},[k.LabHatch]:{x:-1920,y:640,key:ce.Down,warpTo:k.Lab,visual:4},[k.Lab]:{x:-1380,y:1545,key:ce.Right,warpTo:k.LabHatch,visual:2,range:15,skipLighting:!0},[k.LibraryEntrance]:{x:1420,y:650,key:ce.Up,warpTo:k.Library,visual:3},[k.Library]:{x:1730,y:-120,key:ce.Left,warpTo:k.LibraryEntrance,visual:1}},ve=[];Object.values(fe).forEach((e=>{e.warpAdd&&ve.push(e.warpAdd),e.warpComplete&&ve.push(e.warpComplete)})),Object.values(ge).forEach((e=>{e.warpAdd&&ve.push(e.warpAdd)}));class we extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:r,visual:o,range:a}=be[i];super(e,n,r,o===me.Ladder?"ladder":"warp"),t(this,"warpType"),t(this,"player"),t(this,"locked"),t(this,"graphics"),t(this,"portal1"),t(this,"portal2"),t(this,"range"),t(this,"initialized",!1),this.name=`Warp-${i}`,this.warpType=i,this.player=s,this.range=a||30,this.setScale(.6).setDepth(x.Warpers),o!==me.Warp&&o!==me.WarpLocked||(this.setScale(.6,1),this.setPosition(n,r-12)),w.debug||(this.updateLocked(o===me.WarpLocked||o===me.InvisibleLocked),o!==me.Invisible&&o!==me.InvisibleLocked||this.setAlpha(0)),ze(this,be[i]),ve.includes(i)&&e.add.existing(this)}lazyInit(e){(e||!this.initialized&&te(this,this.player))&&(ve.includes(this.warpType)||this.scene.add.existing(this),this.scene.physics.add.existing(this),this.createParticles(),this.createDebug(),this.warpType===k.Underground&&this.createLadder(),this.hasExtendedBounds()&&this.body&&this.setBodySize(this.body.width*(this.range/30*4),this.body.height),this.updateLocked(),this.initialized=!0)}createParticles(){const{visual:e,skipLighting:t}=be[this.warpType];e!==me.Warp&&e!==me.WarpLocked||(this.setAlpha(.1),this.scene.anims.exists("portal")||this.scene.anims.create({key:"portal",frames:this.scene.anims.generateFrameNumbers("portal",{start:0,end:63}),frameRate:10,repeat:-1}),this.portal1=this.scene.add.sprite(this.x,this.y,"portal_0").setScale(.45,1).setAlpha(.9).play("portal").setName(`${this.name}-1`),this.portal1.postFX.addPixelate(1),this.portal1.postFX.addShadow(0,0,.1,1,3355562,6,.5),this.portal2=this.scene.add.sprite(this.x,this.y,"portal_0").setScale(.35,1).setAlpha(.65).setFlipX(!0).setName(`${this.name}-2`),this.portal2.postFX.addPixelate(1),this.portal2.play("portal"),this.portal2.setFrame(Math.floor(30*Math.random())),t||(this.portal1.setPipeline("Light2D"),this.portal2.setPipeline("Light2D")),this.portal1.setPostPipeline("XRayPipeline"),this.portal2.setPostPipeline("XRayPipeline"))}createDebug(){if(w.debug&&(this.setInteractive({draggable:!0}),this.graphics=this.scene.add.graphics(),this.hasExtendedBounds())){this.graphics.lineStyle(2,16711935).setPosition(this.x,this.y);const e=this.body;this.graphics.lineBetween(-this.range,-e.halfHeight,-this.range,e.halfHeight),this.graphics.lineBetween(this.range,-e.halfHeight,this.range,e.halfHeight),this.graphics.strokeCircle(0,0,5)}}createLadder(){this.scene.add.image(this.x,this.y-60,"ladder").setScale(.6).setDepth(x.Warpers).setPipeline("Light2D").setPostPipeline("XRayPipeline").setName("Ladder1"),this.scene.add.image(this.x,this.y-105,"ladder").setScale(.6).setDepth(x.Warpers).setPipeline("Light2D").setPostPipeline("XRayPipeline").setName("Ladder2")}hasExtendedBounds(){const{visual:e,key:t}=be[this.warpType];return!(e!==me.Warp&&e!==me.WarpLocked&&e!==me.Invisible||t!==ce.Left&&t!==ce.Right)}onInteract(e){const t=!this.hasExtendedBounds()||Math.abs(this.player.x-this.x){t>=1&&l.cameras.main.fadeIn(1e3,0,0,0)})),l.cameras.main.stopFollow(),l.tweens.add({targets:l.cameras.main,scrollX:h,scrollY:c-w.cameraOffset,duration:600,delay:100,ease:"Power1",onComplete:()=>{l.cameras.main.startFollow(t,!0),l.cameras.main.setFollowOffset(0,w.cameraOffset)}}),t.setActive(!1),t.buttonPrompt.setVisible(!1),l.tweens.add({targets:t,alpha:0,duration:500,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{t.setPosition(n,r),t.previousPosition.set(n,r)},onComplete:()=>{t.alpha=1,t.setActive(!0)}}),l.tweens.add({targets:t.light,intensity:0,duration:50,hold:600,yoyo:!0,repeat:0});const u=t.light instanceof a.GameObjects.Light?t.light:t.light.light;l.tweens.add({targets:u,x:n,y:r,duration:400,ease:"Power1"})}function Se(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t))}function ke(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t&&!e.used))}function Pe(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t&&e.used))}function Ie(e,t){return e.quests.quests.some((e=>e.id===t&&!e.completed))}function Te(e,t){return e.quests.quests.some((e=>e.id===t&&e.completed))}function Ce(e,t){return e.journal.journal.includes(t)}function je(e,t){return e.children.getAll().filter((e=>e instanceof t))}function Oe(e,t,i){const s=function(e,t){return je(e,we).find((e=>e.warpType===t))}(e,t);s&&s.updateLocked(i)}function Ae(e,t){return je(e,ue).find((e=>e.npcType===t))}function Ee(e,t){return je(e,Mr).find((e=>e.itemType===t))}function Me(e,t){return je(e,ye).find((e=>e.propType===t))}function ze(e,t){const{scale:i,alpha:s,angle:n,depth:r,skipLighting:o,origin:a,initializeOnStart:l}=t;i&&("object"==typeof i?e.setScale(i.x,i.y):e.setScale(i)),s&&e.setAlpha(s),n&&e.setAngle(n),r&&e.setDepth(r),a&&e.setOrigin(a.x,a.y),o||e.setPipeline("Light2D"),e.setPostPipeline("XRayPipeline"),l&&e.lazyInit(!0)}var De,Fe,Le,Be,Ge,Re,We,Ne,_e,He,Ue,$e,Ve,qe,Xe,Ke,Ye,Qe,Je,Ze,et,tt,it,st,nt,rt,ot,at,lt,ht,ct,dt,ut,pt,yt,gt,ft,mt,bt,vt,wt,xt,St,kt;function Pt(){if(Fe)return De;Fe=1;var e=Object.prototype.toString;return De=function(t){var i=e.call(t),s="[object Arguments]"===i;return s||(s="[object Array]"!==i&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),s}}function It(){if(Re)return Ge;Re=1;var e=Array.prototype.slice,t=Pt(),i=Object.keys,s=i?function(e){return i(e)}:function(){if(Be)return Le;var e;if(Be=1,!Object.keys){var t=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=Pt(),n=Object.prototype.propertyIsEnumerable,r=!n.call({toString:null},"toString"),o=n.call((function(){}),"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(e){var t=e.constructor;return t&&t.prototype===e},h={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!h["$"+e]&&t.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{l(window[e])}catch(i){return!0}}catch(i){return!0}return!1}();e=function(e){var n=null!==e&&"object"==typeof e,h="[object Function]"===i.call(e),d=s(e),u=n&&"[object String]"===i.call(e),p=[];if(!n&&!h&&!d)throw new TypeError("Object.keys called on a non-object");var y=o&&h;if(u&&e.length>0&&!t.call(e,0))for(var g=0;g0)for(var f=0;f1&&"boolean"!=typeof t)throw new o('"allowMissing" argument must be a boolean');if(null===j(/^%?[^%]*%?$/,e))throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=function(e){var t=C(e,0,1),i=C(e,-1);if("%"===t&&"%"!==i)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==t)throw new r("invalid intrinsic syntax, expected opening `%`");var s=[];return T(e,O,(function(e,t,i,n){s[s.length]=i?T(n,A,"$1"):t||e})),s}(e),s=i.length>0?i[0]:"",n=E("%"+s+"%",t),a=n.name,l=n.value,h=!1,d=n.alias;d&&(s=d[0],I(i,P([0,1],d)));for(var u=1,p=!0;u=i.length){var m=c(l,y);l=(p=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:l[y]}else p=k(l,y),l=l[y];p&&!h&&(b[a]=l)}}return l},ut}function Rt(){if(gt)return yt;gt=1;var e=Gt()("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return yt=e}function Wt(){if(mt)return ft;mt=1;var e=Gt()("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch(t){e=null}return ft=e}function Nt(){if(vt)return bt;vt=1;var e=Rt(),t=At(),i=Et(),s=Wt();return bt=function(n,r,o){if(!n||"object"!=typeof n&&"function"!=typeof n)throw new i("`obj` must be an object or a function`");if("string"!=typeof r&&"symbol"!=typeof r)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],d=!!s&&s(n,r);if(e)e(n,r,{configurable:null===h&&d?d.configurable:!h,enumerable:null===a&&d?d.enumerable:!a,value:o,writable:null===l&&d?d.writable:!l});else{if(!c&&(a||l||h))throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");n[r]=o}},bt}function _t(){if(xt)return wt;xt=1;var e=Rt(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return 1!==e([],"length",{value:1}).length}catch(t){return!0}},wt=t}function Ht(){if(kt)return St;kt=1;var e=It(),t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,s=Array.prototype.concat,n=Nt(),r=_t()(),o=function(e,t,s,o){if(t in e)if(!0===o){if(e[t]===s)return}else if("function"!=typeof(a=o)||"[object Function]"!==i.call(a)||!o())return;var a;r?n(e,t,s,!0):n(e,t,s)},a=function(i,n){var r=arguments.length>2?arguments[2]:{},a=e(n);t&&(a=s.call(a,Object.getOwnPropertySymbols(n)));for(var l=0;l4294967295||r(o)!==o)throw new n("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],l=!0,h=!0;if("length"in e&&s){var c=s(e,"length");c&&!c.configurable&&(l=!1),c&&!c.writable&&(h=!1)}return(l||h||!a)&&(i?t(e,"length",o,!0,!0):t(e,"length",o)),e},Ut}function mi(){return Vt||(Vt=1,function(e){var t=Lt(),i=Gt(),s=fi(),n=Et(),r=i("%Function.prototype.apply%"),o=i("%Function.prototype.call%"),a=i("%Reflect.apply%",!0)||t.call(o,r),l=Rt(),h=i("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new n("a function is required");var i=a(t,o,arguments);return s(i,1+h(0,e.length-(arguments.length-1)),!0)};var c=function(){return a(t,r,arguments)};l?l(e.exports,"apply",{value:c}):e.exports.apply=c}(gi)),gi.exports}function bi(){if(Xt)return qt;Xt=1;var e=Gt(),t=mi(),i=t(e("String.prototype.indexOf"));return qt=function(s,n){var r=e(s,!!n);return"function"==typeof r&&i(s,".prototype.")>-1?t(r):r}}function vi(){if(Yt)return Kt;Yt=1;var e=It(),t=zt()(),i=bi(),s=Object,n=i("Array.prototype.push"),r=i("Object.prototype.propertyIsEnumerable"),o=t?Object.getOwnPropertySymbols:null;return Kt=function(i,a){if(null==i)throw new TypeError("target must be an object");var l=s(i);if(1===arguments.length)return l;for(var h=1;h2&&!!arguments[2]&&!i||(t?e(n,"name",r,!0,!0):e(n,"name",r)),n},ri}(),t=Et(),i=Object;return ai=e((function(){if(null==this||this!==i(this))throw new t("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e}),"get flags",!0)}function Si(){if(ci)return hi;ci=1;var e=xi(),t=Ht().supportsDescriptors,i=Object.getOwnPropertyDescriptor;return hi=function(){if(t&&"gim"===/a/gim.flags){var s=i(RegExp.prototype,"flags");if(s&&"function"==typeof s.get&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),s.get.call(r),"dy"===n)return s.get}}return e}}var ki,Pi,Ii,Ti,Ci={exports:{}};function ji(){if(Pi)return ki;Pi=1;var e=zt();return ki=function(){return e()&&!!Symbol.toStringTag}}function Oi(){if(Ti)return Ii;Ti=1;var e=ji()(),t=bi()("Object.prototype.toString"),i=function(i){return!(e&&i&&"object"==typeof i&&Symbol.toStringTag in i)&&"[object Arguments]"===t(i)},s=function(e){return!!i(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==t(e)&&"[object Function]"===t(e.callee)},n=function(){return i(arguments)}();return i.isLegacyArguments=s,Ii=n?i:s}const Ai=s(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ei,Mi,zi,Di,Fi,Li,Bi,Gi,Ri,Wi,Ni,_i,Hi,Ui,$i,Vi,qi,Xi,Ki,Yi,Qi,Ji,Zi,es,ts,is,ss,ns,rs,os,as,ls,hs,cs,ds,us,ps;function ys(){if(Mi)return Ei;Mi=1;var e="function"==typeof Map&&Map.prototype,t=Object.getOwnPropertyDescriptor&&e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=e&&t&&"function"==typeof t.get?t.get:null,s=e&&Map.prototype.forEach,r="function"==typeof Set&&Set.prototype,o=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=r&&o&&"function"==typeof o.get?o.get:null,l=r&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,c="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,u=Boolean.prototype.valueOf,p=Object.prototype.toString,y=Function.prototype.toString,g=String.prototype.match,f=String.prototype.slice,m=String.prototype.replace,b=String.prototype.toUpperCase,v=String.prototype.toLowerCase,w=RegExp.prototype.test,x=Array.prototype.concat,S=Array.prototype.join,k=Array.prototype.slice,P=Math.floor,I="function"==typeof BigInt?BigInt.prototype.valueOf:null,T=Object.getOwnPropertySymbols,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,j="function"==typeof Symbol&&"object"==typeof Symbol.iterator,O="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,A=Object.prototype.propertyIsEnumerable,E=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function M(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||w.call(/e/,t))return t;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var s=e<0?-P(-e):P(e);if(s!==e){var n=String(s),r=f.call(t,n.length+1);return m.call(n,i,"$&_")+"."+m.call(m.call(r,/([0-9]{3})/g,"$&_"),/_$/,"")}}return m.call(t,i,"$&_")}var z=Ai,D=z.custom,F=_(D)?D:null,L={__proto__:null,double:'"',single:"'"},B={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function G(e,t,i){var s=i.quoteStyle||t,n=L[s];return n+e+n}function R(e){return m.call(String(e),/"/g,""")}function W(e){return!("[object Array]"!==$(e)||O&&"object"==typeof e&&O in e)}function N(e){return!("[object RegExp]"!==$(e)||O&&"object"==typeof e&&O in e)}function _(e){if(j)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!C)return!1;try{return C.call(e),!0}catch(t){}return!1}Ei=function e(t,r,o,p){var b=r||{};if(U(b,"quoteStyle")&&!U(L,b.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(U(b,"maxStringLength")&&("number"==typeof b.maxStringLength?b.maxStringLength<0&&b.maxStringLength!==1/0:null!==b.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var w=!U(b,"customInspect")||b.customInspect;if("boolean"!=typeof w&&"symbol"!==w)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(U(b,"indent")&&null!==b.indent&&"\t"!==b.indent&&!(parseInt(b.indent,10)===b.indent&&b.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(U(b,"numericSeparator")&&"boolean"!=typeof b.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var P=b.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return q(t,b);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var T=String(t);return P?M(t,T):T}if("bigint"==typeof t){var D=String(t)+"n";return P?M(t,D):D}var B=void 0===b.depth?5:b.depth;if(void 0===o&&(o=0),o>=B&&B>0&&"object"==typeof t)return W(t)?"[Array]":"[Object]";var H,X=function(e,t){var i;if("\t"===e.indent)i="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;i=S.call(Array(e.indent+1)," ")}return{base:i,prev:S.call(Array(t+1),i)}}(b,o);if(void 0===p)p=[];else if(V(p,t)>=0)return"[Circular]";function ee(t,i,s){if(i&&(p=k.call(p)).push(i),s){var n={depth:b.depth};return U(b,"quoteStyle")&&(n.quoteStyle=b.quoteStyle),e(t,n,o+1,p)}return e(t,b,o+1,p)}if("function"==typeof t&&!N(t)){var te=function(e){if(e.name)return e.name;var t=g.call(y.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),ie=Z(t,ee);return"[Function"+(te?": "+te:" (anonymous)")+"]"+(ie.length>0?" { "+S.call(ie,", ")+" }":"")}if(_(t)){var se=j?m.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):C.call(t);return"object"!=typeof t||j?se:K(se)}if((H=t)&&"object"==typeof H&&("undefined"!=typeof HTMLElement&&H instanceof HTMLElement||"string"==typeof H.nodeName&&"function"==typeof H.getAttribute)){for(var ne="<"+v.call(String(t.nodeName)),re=t.attributes||[],oe=0;oe"}if(W(t)){if(0===t.length)return"[]";var ae=Z(t,ee);return X&&!function(e){for(var t=0;t=0)return!1;return!0}(ae)?"["+J(ae,X)+"]":"[ "+S.call(ae,", ")+" ]"}if(function(e){return!("[object Error]"!==$(e)||O&&"object"==typeof e&&O in e)}(t)){var le=Z(t,ee);return"cause"in Error.prototype||!("cause"in t)||A.call(t,"cause")?0===le.length?"["+String(t)+"]":"{ ["+String(t)+"] "+S.call(le,", ")+" }":"{ ["+String(t)+"] "+S.call(x.call("[cause]: "+ee(t.cause),le),", ")+" }"}if("object"==typeof t&&w){if(F&&"function"==typeof t[F]&&z)return z(t,{depth:B-o});if("symbol"!==w&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{a.call(e)}catch(ne){return!0}return e instanceof Map}catch(t){}return!1}(t)){var he=[];return s&&s.call(t,(function(e,i){he.push(ee(i,t,!0)+" => "+ee(e,t))})),Q("Map",i.call(t),he,X)}if(function(e){if(!a||!e||"object"!=typeof e)return!1;try{a.call(e);try{i.call(e)}catch(t){return!0}return e instanceof Set}catch(s){}return!1}(t)){var ce=[];return l&&l.call(t,(function(e){ce.push(ee(e,t))})),Q("Set",a.call(t),ce,X)}if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{h.call(e,h);try{c.call(e,c)}catch(ne){return!0}return e instanceof WeakMap}catch(t){}return!1}(t))return Y("WeakMap");if(function(e){if(!c||!e||"object"!=typeof e)return!1;try{c.call(e,c);try{h.call(e,h)}catch(ne){return!0}return e instanceof WeakSet}catch(t){}return!1}(t))return Y("WeakSet");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{return d.call(e),!0}catch(t){}return!1}(t))return Y("WeakRef");if(function(e){return!("[object Number]"!==$(e)||O&&"object"==typeof e&&O in e)}(t))return K(ee(Number(t)));if(function(e){if(!e||"object"!=typeof e||!I)return!1;try{return I.call(e),!0}catch(t){}return!1}(t))return K(ee(I.call(t)));if(function(e){return!("[object Boolean]"!==$(e)||O&&"object"==typeof e&&O in e)}(t))return K(u.call(t));if(function(e){return!("[object String]"!==$(e)||O&&"object"==typeof e&&O in e)}(t))return K(ee(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||void 0!==n&&t===n)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==$(e)||O&&"object"==typeof e&&O in e)}(t)&&!N(t)){var de=Z(t,ee),ue=E?E(t)===Object.prototype:t instanceof Object||t.constructor===Object,pe=t instanceof Object?"":"null prototype",ye=!ue&&O&&Object(t)===t&&O in t?f.call($(t),8,-1):pe?"Object":"",ge=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(ye||pe?"["+S.call(x.call([],ye||[],pe||[]),": ")+"] ":"");return 0===de.length?ge+"{}":X?ge+"{"+J(de,X)+"}":ge+"{ "+S.call(de,", ")+" }"}return String(t)};var H=Object.prototype.hasOwnProperty||function(e){return e in this};function U(e,t){return H.call(e,t)}function $(e){return p.call(e)}function V(e,t){if(e.indexOf)return e.indexOf(t);for(var i=0,s=e.length;it.maxStringLength){var i=e.length-t.maxStringLength,s="... "+i+" more character"+(i>1?"s":"");return q(f.call(e,0,t.maxStringLength),t)+s}var n=B[t.quoteStyle||"single"];return n.lastIndex=0,G(m.call(m.call(e,n,"\\$1"),/[\x00-\x1f]/g,X),"single",t)}function X(e){var t=e.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return i?"\\"+i:"\\x"+(t<16?"0":"")+b.call(t.toString(16))}function K(e){return"Object("+e+")"}function Y(e){return e+" { ? }"}function Q(e,t,i,s){return e+" ("+t+") {"+(s?J(i,s):S.call(i,", "))+"}"}function J(e,t){if(0===e.length)return"";var i="\n"+t.prev+t.base;return i+S.call(e,","+i)+"\n"+t.prev}function Z(e,t){var i=W(e),s=[];if(i){s.length=e.length;for(var n=0;n=e.length;return s||(i=e[t],t+=1),{done:s,value:i}}}},p=function(t,i){if(s(t)||e(t))return u(t);if(n(t)){var r=0;return{next:function(){var e=function(e,t){if(t+1>=e.length)return t+1;var i=c(e,t);if(i<55296||i>56319)return t+1;var s=c(e,t+1);return s<56320||s>57343?t+1:t+2}(t,r),i=d(t,r,e);return r=e,{done:e>t.length,value:i}}}}return i&&void 0!==t["_es6-shim iterator_"]?t["_es6-shim iterator_"]():void 0};if(o||a){var y=bs(),g=vs(),f=l("Map.prototype.forEach",!0),m=l("Set.prototype.forEach",!0);if("undefined"==typeof process||!process.versions||!process.versions.node)var b=l("Map.prototype.iterator",!0),v=l("Set.prototype.iterator",!0);var w=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),x=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0);Ci.exports=function(e){return function(e){if(y(e)){if(b)return t(b(e));if(w)return w(e);if(f){var i=[];return f(e,(function(e,t){h(i,[t,e])})),u(i)}}if(g(e)){if(v)return t(v(e));if(x)return x(e);if(m){var s=[];return m(e,(function(e){h(s,e)})),u(s)}}}(e)||p(e)}}else Ci.exports=function(e){if(null!=e)return p(e,!0)}}return Ci.exports}function xs(){if(Ki)return Xi;Ki=1;var e=function(e){return e!=e};return Xi=function(t,i){return 0===t&&0===i?1/t==1/i:t===i||!(!e(t)||!e(i))}}function Ss(){if(Qi)return Yi;Qi=1;var e=xs();return Yi=function(){return"function"==typeof Object.is?Object.is:e}}function ks(){if(ss)return is;ss=1;var e=mi(),t=bi(),i=Gt()("%ArrayBuffer%",!0),s=t("ArrayBuffer.prototype.byteLength",!0),n=t("Object.prototype.toString"),r=!!i&&!s&&new i(0).slice,o=!!r&&e(r);return is=s||o?function(e){if(!e||"object"!=typeof e)return!1;try{return s?s(e):o(e,0),!0}catch(t){return!1}}:i?function(e){return"[object ArrayBuffer]"===n(e)}:function(e){return!1}}function Ps(){if(hs)return ls;hs=1;var e=bi()("SharedArrayBuffer.prototype.byteLength",!0);return ls=e?function(t){if(!t||"object"!=typeof t)return!1;try{return e(t),!0}catch(i){return!1}}:function(e){return!1}}var Is,Ts={exports:{}};var Cs,js,Os,As,Es,Ms,zs,Ds={exports:{}};var Fs,Ls,Bs,Gs,Rs,Ws,Ns,_s,Hs,Us,$s,Vs,qs,Xs,Ks,Ys,Qs,Js={exports:{}};function Zs(){if(Fs)return Js.exports;Fs=1;var e=Gt(),t=bi(),i=e("%WeakSet%",!0),s=t("WeakSet.prototype.has",!0);if(s){var n=t("WeakMap.prototype.has",!0);Js.exports=function(e){if(!e||"object"!=typeof e)return!1;try{if(s(e,s),n)try{n(e,n)}catch(t){return!0}return e instanceof i}catch(t){}return!1}}else Js.exports=function(e){return!1};return Js.exports}function en(){if(Bs)return Ls;Bs=1;var e=bs(),t=vs(),i=function(){if(zs)return Ms;zs=1;var e,t="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,i="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;t||(e=function(e){return!1});var s=t?t.prototype.has:null,n=i?i.prototype.has:null;return e||s||(e=function(e){return!1}),Ms=e||function(e){if(!e||"object"!=typeof e)return!1;try{if(s.call(e,s),n)try{n.call(e,n)}catch(i){return!0}return e instanceof t}catch(i){}return!1}}(),s=Zs();return Ls=function(n){if(n&&"object"==typeof n){if(e(n))return"Map";if(t(n))return"Set";if(i(n))return"WeakMap";if(s(n))return"WeakSet"}return!1}}function tn(){return Hs?_s:(Hs=1,_s=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"])}function sn(){if($s)return Us;$s=1;var e=tn(),t="undefined"==typeof globalThis?n:globalThis;return Us=function(){for(var i=[],s=0;s=3&&(o=r),"[object Array]"===t.call(s)?function(e,t,s){for(var n=0,r=e.length;n-1?i:"Object"===i&&function(t){var i=!1;return e(p,(function(e,s){if(!i)try{e(t),i=c(s,1)}catch(n){}})),i}(t)}return r?function(t){var i=!1;return e(p,(function(e,s){if(!i)try{"$"+e(t)===s&&(i=c(s,1))}catch(n){}})),i}(t):null}}function rn(){if(Ks)return Xs;Ks=1;var e=bi()("ArrayBuffer.prototype.byteLength",!0),t=ks();return Xs=function(i){return t(i)?e?e(i):i.byteLength:NaN}}const on=r(function(){if(Qs)return Ys;Qs=1;var e=function(){if(ii)return ti;ii=1;var e=Ht(),t=mi(),i=vi(),s=wi(),n=function(){if(ei)return Zt;ei=1;var e=Ht(),t=wi();return Zt=function(){var i=t();return e(Object,{assign:i},{assign:function(){return Object.assign!==i}}),i}}(),r=t.apply(s()),o=function(e,t){return r(Object,arguments)};return e(o,{getPolyfill:s,implementation:i,shim:n}),ti=o}(),t=bi(),i=function(){if(yi)return pi;yi=1;var e=Ht(),t=mi(),i=xi(),s=Si(),n=function(){if(ui)return di;ui=1;var e=Ht().supportsDescriptors,t=Si(),i=Object.getOwnPropertyDescriptor,s=Object.defineProperty,n=TypeError,r=Object.getPrototypeOf,o=/a/;return di=function(){if(!e||!r)throw new n("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var a=t(),l=r(o),h=i(l,"flags");return h&&h.get===a||s(l,"flags",{configurable:!0,enumerable:!1,get:a}),a}}(),r=t(s());return e(r,{getPolyfill:s,implementation:i,shim:n}),pi=r}(),s=Gt(),n=ws(),r=gs(),o=function(){if(ts)return es;ts=1;var e=Ht(),t=mi(),i=xs(),s=Ss(),n=function(){if(Zi)return Ji;Zi=1;var e=Ss(),t=Ht();return Ji=function(){var i=e();return t(Object,{is:i},{is:function(){return Object.is!==i}}),i}}(),r=t(s(),Object);return e(r,{getPolyfill:s,implementation:i,shim:n}),es=r}(),a=Oi(),l=fs(),h=ks(),c=function(){if(rs)return ns;rs=1;var e=Date.prototype.getDay,t=Object.prototype.toString,i=ji()();return ns=function(s){return"object"==typeof s&&null!==s&&(i?function(t){try{return e.call(t),!0}catch(i){return!1}}(s):"[object Date]"===t.call(s))}}(),d=function(){if(as)return os;as=1;var e,t,i,s,n=bi(),r=ji()();if(r){e=n("Object.prototype.hasOwnProperty"),t=n("RegExp.prototype.exec"),i={};var o=function(){throw i};s={toString:o,valueOf:o},"symbol"==typeof Symbol.toPrimitive&&(s[Symbol.toPrimitive]=o)}var a=n("Object.prototype.toString"),l=Object.getOwnPropertyDescriptor;return os=r?function(n){if(!n||"object"!=typeof n)return!1;var r=l(n,"lastIndex");if(!r||!e(r,"value"))return!1;try{t(n,s)}catch(o){return o===i}}:function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===a(e)}}(),u=Ps(),p=It(),y=function(){if(Es)return As;Es=1;var e=ms(),t=function(){if(ds)return cs;ds=1;var e=Number.prototype.toString,t=Object.prototype.toString,i=ji()();return cs=function(s){return"number"==typeof s||"object"==typeof s&&(i?function(t){try{return e.call(t),!0}catch(i){return!1}}(s):"[object Number]"===t.call(s))}}(),i=function(){if(ps)return us;ps=1;var e=bi(),t=e("Boolean.prototype.toString"),i=e("Object.prototype.toString"),s=ji()();return us=function(e){return"boolean"==typeof e||null!==e&&"object"==typeof e&&(s&&Symbol.toStringTag in e?function(e){try{return t(e),!0}catch(i){return!1}}(e):"[object Boolean]"===i(e))}}(),s=function(){if(Is)return Ts.exports;Is=1;var e=Object.prototype.toString;if(Dt()()){var t=Symbol.prototype.toString,i=/^Symbol\(.*\)$/;Ts.exports=function(s){if("symbol"==typeof s)return!0;if("[object Symbol]"!==e.call(s))return!1;try{return function(e){return"symbol"==typeof e.valueOf()&&i.test(t.call(e))}(s)}catch(n){return!1}}}else Ts.exports=function(e){return!1};return Ts.exports}(),n=function(){if(Os)return Ds.exports;if(Os=1,function(){if(js)return Cs;js=1;var e="undefined"!=typeof BigInt&&BigInt;return Cs=function(){return"function"==typeof e&&"function"==typeof BigInt&&"bigint"==typeof e(42)&&"bigint"==typeof BigInt(42)}}()()){var e=BigInt.prototype.valueOf;Ds.exports=function(t){return null!=t&&"boolean"!=typeof t&&"string"!=typeof t&&"number"!=typeof t&&"symbol"!=typeof t&&"function"!=typeof t&&("bigint"==typeof t||function(t){try{return e.call(t),!0}catch(i){}return!1}(t))}}else Ds.exports=function(e){return!1};return Ds.exports}();return As=function(r){return null==r||"object"!=typeof r&&"function"!=typeof r?null:e(r)?"String":t(r)?"Number":i(r)?"Boolean":s(r)?"Symbol":n(r)?"BigInt":void 0}}(),g=en(),f=nn(),m=rn(),b=t("SharedArrayBuffer.prototype.byteLength",!0),v=t("Date.prototype.getTime"),w=Object.getPrototypeOf,x=t("Object.prototype.toString"),S=s("%Set%",!0),k=t("Map.prototype.has",!0),P=t("Map.prototype.get",!0),I=t("Map.prototype.size",!0),T=t("Set.prototype.add",!0),C=t("Set.prototype.delete",!0),j=t("Set.prototype.has",!0),O=t("Set.prototype.size",!0);function A(e,t,i,s){for(var r,o=n(e);(r=o.next())&&!r.done;)if(F(t,r.value,i,s))return C(e,r.value),!0;return!1}function E(e){return void 0===e?null:"object"!=typeof e?"symbol"!=typeof e&&("string"!=typeof e&&"number"!=typeof e||+e==+e):void 0}function M(t,i,s,n,r,o){var a=E(s);if(null!=a)return a;var l=P(i,a),h=e({},r,{strict:!1});return!(void 0===l&&!k(i,a)||!F(n,l,h,o))&&!k(t,a)&&F(n,l,h,o)}function z(e,t,i){var s=E(i);return null!=s?s:j(t,s)&&!j(e,s)}function D(e,t,i,s,r,o){for(var a,l,h=n(e);(a=h.next())&&!a.done;)if(F(i,l=a.value,r,o)&&F(s,P(t,l),r,o))return C(e,l),!0;return!1}function F(t,s,r,C){var E=r||{};if(E.strict?o(t,s):t===s)return!0;if(y(t)!==y(s))return!1;if(!t||!s||"object"!=typeof t&&"object"!=typeof s)return E.strict?o(t,s):t==s;var B,G=C.has(t),R=C.has(s);if(G&&R){if(C.get(t)===C.get(s))return!0}else B={};return G||C.set(t,B),R||C.set(s,B),function(t,s,r,o){var y,C;if(typeof t!=typeof s)return!1;if(null==t||null==s)return!1;if(x(t)!==x(s))return!1;if(a(t)!==a(s))return!1;if(l(t)!==l(s))return!1;var E=t instanceof Error,B=s instanceof Error;if(E!==B)return!1;if((E||B)&&(t.name!==s.name||t.message!==s.message))return!1;var G=d(t),R=d(s);if(G!==R)return!1;if((G||R)&&(t.source!==s.source||i(t)!==i(s)))return!1;var W=c(t),N=c(s);if(W!==N)return!1;if((W||N)&&v(t)!==v(s))return!1;if(r.strict&&w&&w(t)!==w(s))return!1;var _=f(t),H=f(s);if(_!==H)return!1;if(_||H){if(t.length!==s.length)return!1;for(y=0;y=0;y--)if(Y[y]!=Q[y])return!1;for(y=Y.length-1;y>=0;y--)if(!F(t[C=Y[y]],s[C],r,o))return!1;var J=g(t),Z=g(s);return J===Z&&("Set"===J||"Set"===Z?function(e,t,i,s){if(O(e)!==O(t))return!1;for(var r,o,a,l=n(e),h=n(t);(r=l.next())&&!r.done;)if(r.value&&"object"==typeof r.value)a||(a=new S),T(a,r.value);else if(!j(t,r.value)){if(i.strict)return!1;if(!z(e,t,r.value))return!1;a||(a=new S),T(a,r.value)}if(a){for(;(o=h.next())&&!o.done;)if(o.value&&"object"==typeof o.value){if(!A(a,o.value,i.strict,s))return!1}else if(!i.strict&&!j(e,o.value)&&!A(a,o.value,i.strict,s))return!1;return 0===O(a)}return!0}(t,s,r,o):"Map"!==J||function(t,i,s,r){if(I(t)!==I(i))return!1;for(var o,a,l,h,c,d,u=n(t),p=n(i);(o=u.next())&&!o.done;)if(h=o.value[0],c=o.value[1],h&&"object"==typeof h)l||(l=new S),T(l,h);else if(void 0===(d=P(i,h))&&!k(i,h)||!F(c,d,s,r)){if(s.strict)return!1;if(!M(t,i,h,c,s,r))return!1;l||(l=new S),T(l,h)}if(l){for(;(a=p.next())&&!a.done;)if(h=a.value[0],d=a.value[1],h&&"object"==typeof h){if(!D(l,t,h,d,s,r))return!1}else if(!(s.strict||t.has(h)&&F(P(t,h),d,s,r)||D(l,t,h,d,e({},s,{strict:!1}),r)))return!1;return 0===O(l)}return!0}(t,s,r,o))}(t,s,E,C)}function L(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length||"function"!=typeof e.copy||"function"!=typeof e.slice||e.length>0&&"number"!=typeof e[0]||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))}return Ys=function(e,t,i){return F(e,t,i,r())}}()),an={fontFamily:"m6x11, sans-serif",fontSize:24,color:`#${M}`};class ln extends a.GameObjects.Text{constructor(e,t,i=3500,s=D){const n=je(e,ln).reduce(((e,t)=>Math.max(e,t.y-20)),0)+65;super(e,20,n,t,{...an,backgroundColor:"#"+s,padding:{x:10,y:5}}),this.setAlpha(0).setDepth(x.Overlay).setScrollFactor(0),e.add.existing(this),e.add.tween({targets:this,alpha:1,scale:1.05,y:n+10,duration:350,hold:i,yoyo:!0,repeat:0,onComplete:()=>this.destroy()})}}let hn=1;class cn extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(e){super({game:e,renderTarget:!0,fragShader:"\nprecision mediump float;\n\nuniform float uAlpha;\nuniform sampler2D uMainSampler;\n\nvarying vec2 outTexCoord;\n\n// slight modifications made to original shader\n// use alpha channel for fragColor + changed uniform names\n\n// original shader from: https://www.shadertoy.com/view/WsVSzV\n// tips for chromatic aberration: https://lettier.github.io/3d-game-shaders-for-beginners/chromatic-aberration.html\n\nfloat warp = 0.35; // simulate curvature of CRT monitor (larger number = more curvature)\nfloat scan = 0.75; // simulate darkness between scanlines\nfloat scanSize = 0.75; // size of scanlines [0.0 - 2.0] (smaller number = taller scanlines)\n\nfloat chromaticAberration = 0.25 * uAlpha;\nfloat redOffset = 0.006 * chromaticAberration;\nfloat greenOffset = 0.003 * chromaticAberration;\nfloat blueOffset = -0.003 * chromaticAberration;\n\nvoid mainImage(out vec4 fragColor,in vec2 fragCoord)\n{\n if (uAlpha <= 0.0) {\n fragColor = texture2D(uMainSampler, outTexCoord);\n return;\n }\n\n // squared distance from center\n vec2 uv = outTexCoord;\n vec2 dc = abs(0.5-uv);\n dc *= dc;\n\n // warp the fragment coordinates\n uv.x -= 0.5; uv.x *= 1.0+(dc.y*(0.3*warp)); uv.x += 0.5;\n uv.y -= 0.5; uv.y *= 1.0+(dc.x*(0.4*warp)); uv.y += 0.5;\n\n vec2 chromaticOffset = vec2((abs(0.5-uv) + 0.5) * 2.);\n\n vec4 color;\n color.r = texture2D(uMainSampler,uv + vec2(redOffset * chromaticOffset)).r;\n color.g = texture2D(uMainSampler,uv + vec2(greenOffset * chromaticOffset)).g;\n color.b = texture2D(uMainSampler,uv + vec2(blueOffset * chromaticOffset)).b;\n color.a = texture2D(uMainSampler,uv).a;\n\n // sample inside boundaries, otherwise set to black\n if (uv.y > 1.0 || uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0) {\n fragColor = vec4(0.0);\n } else {\n // determine if we are drawing in a scanline\n float apply = abs(sin(fragCoord.y * scanSize)*0.5*scan);\n\n apply = uAlpha * apply;\n\n // sample the texture\n fragColor = vec4(mix(color.rgb,vec3(0.0), apply), color.a);\n }\n}\n\nvoid main(void)\n{\n mainImage(gl_FragColor, gl_FragCoord.xy);\n}\n"})}onPreRender(){this.set1f("uAlpha",hn)}}class dn extends Phaser.Plugins.ScenePlugin{boot(){var e;null==(e=this.systems)||e.events.on("start",this.applyPipeline,this);const{save:t}=mn();un(t.settings.useShader)}applyPipeline(){var e,t;null==(e=this.scene)||e.cameras.main.setPostPipeline("CRTPipeline"),(null==(t=this.scene)?void 0:t.cameras.main.getPostPipeline(cn)).bootFX()}}function un(e){w.useShader=void 0!==e?e:!w.useShader,hn=w.useShader?1:0}let pn=0;class yn extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(e){super({game:e,fragShader:"\nprecision mediump float;\n\nuniform float uAlpha;\nuniform sampler2D uMainSampler;\n\nvarying vec2 outTexCoord;\n\nvoid main(void)\n{\n vec4 baseColor = vec4(texture2D(uMainSampler, outTexCoord).rgba);\n vec4 newColor = baseColor;\n newColor.g *= 1.25;\n newColor.r *= 2.5;\n newColor.b *= 3.;\n\n gl_FragColor = mix(baseColor, newColor, uAlpha);\n}\n"})}onPreRender(){this.set1f("uAlpha",pn)}}function gn(e,t){pn!==(t?.85:0)&&e.tweens.addCounter({from:pn,to:t?.85:0,onUpdate:e=>{pn=e.getValue()},duration:2500,ease:"Bounce"})}function fn(e){return{player:{x:e.player.x,y:e.player.y,flip:e.player.flipX},journal:e.player.journal.journal.sort(),inventory:e.player.inventory.inventory.sort(((e,t)=>e.type-t.type)),quests:e.player.quests.quests.sort(((e,t)=>e.id-t.id)),gameState:e.player.gameState.data,settings:{gamepad:e.gamepad.visible,debug:w.debug,zoomed:w.zoomed,useShader:w.useShader,time:Date.now(),muted:e.sound.mute}}}function mn(){const e=localStorage.getItem(Rr);let t,i;try{e&&(t=JSON.parse(e))}catch(s){console.error(s),i=s}return{save:t||Hr[Wr.New],error:i,newGame:!t}}const bn={journal:{enumObj:j,enumName:"JournalEntry"},inventory:{enumObj:P,enumName:"ItemType"},type:{enumObj:P,enumName:"ItemType"},quests:{enumObj:I,enumName:"QuestType"},id:{enumObj:I,enumName:"QuestType"}};function vn(e,t){const i={...w};return w.debug=e.settings.debug,w.zoomed=e.settings.zoomed,w.useShader=e.settings.useShader,un(w.useShader),gn(t,!1),w.zoomed!==i.zoomed?(function(e,t){const i=t?h:l;w.zoomed=t,w.width=i.width,w.height=i.height,w.cameraOffset=i.height/3,e.scale.setGameSize(i.width,i.height),e.scene.restart()}(t,w.zoomed),!0):w.debug!==i.debug&&(t.scene.restart(),!0)}function wn(e){const{save:t,error:i,newGame:s}=mn();i&&new ln(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4);try{vn(t,e),e.sound.mute=t.settings.muted,e.player.setX(t.player.x),e.player.setY(t.player.y),e.player.previousPosition.set(t.player.x+(t.player.flip?1:-1),t.player.y),e.time.delayedCall(50,(()=>{try{e.player.inventory.createUI(),e.player.quests.createUI(),e.player.journal.createUI(),s&&function(e){e.player.message.setDialog({messages:["Now that I have arrived in town, I should talk to the townsfolk about the strange occurrences.","Maybe someone has seen something that could help me start my investigation."]},void 0,"player_portrait")}(e),t.inventory.sort(((e,t)=>e.type-t.type)).forEach((t=>e.player.inventory.addItem(t,!0))),t.journal.sort().reverse().forEach((t=>e.player.journal.addEntry(t,!0))),t.quests.sort(((e,t)=>e.id-t.id)).forEach((t=>e.player.quests.addQuest(t,!0))),e.player.gameState.updateData(t.gameState,!0)}catch(i){console.error(i),new ln(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4,L),xn(e,Hr[Wr.New]),wn(e)}})),e.gamepad.setVisible(t.settings.gamepad);const i=on(t,Hr[Wr.New])?"[New]":"[Storage]";w.prod||e.time.delayedCall(200,(()=>{new ln(e,`Game Loaded ${w.prod?"":i}`)})),on(t,Hr[Wr.New])&&xn(e,void 0,!0)}catch(n){console.error(n),new ln(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4,L),xn(e,Hr[Wr.New]),wn(e)}}function xn(e,t,i){const s=fn(e);localStorage.setItem(Rr,JSON.stringify(t||s)),i||e.tweens.add({targets:e.saveIcon,alpha:.7,scale:.6,duration:500,hold:250,yoyo:!0})}function Sn(e){w.prod&&xn(e)}class kn extends a.GameObjects.Container{constructor(e,i){var s;super(e,0,0),t(this,"text"),t(this,"rect"),t(this,"player"),t(this,"activeElement"),t(this,"outline"),t(this,"scene"),t(this,"dayNight",!1),this.scene=e,this.player=i,e.physics.world.drawDebug=w.debug,w.debug?e.physics.world.createDebugGraphic():null==(s=e.physics.world.debugGraphic)||s.clear(),this.createEventListeners(),w.debug&&(this.setScrollFactor(0).setDepth(x.Debug).setAlpha(.8),this.scene.add.existing(this),this.rect=e.add.rectangle(0,0,0,0,_(F)).setOrigin(0).setDepth(x.Debug),this.add(this.rect),this.text=e.add.bitmapText(20,90,"m6x11-24",""),this.add(this.text),this.outline=e.add.rectangle(0,0,0,0).setStrokeStyle(2,65280).setScale(1.1).setDepth(x.Debug))}createEventListeners(){var e,t,i,s,n,r,o,a,l;null==(e=this.scene.input.keyboard)||e.on("keydown-K",(()=>{xn(this.scene)})),null==(t=this.scene.input.keyboard)||t.on("keydown-L",(()=>{this.scene.scene.restart()})),null==(i=this.scene.input.keyboard)||i.on("keydown-M",(()=>{xn(this.scene,Hr[Wr.Act2]),this.scene.scene.restart()})),null==(s=this.scene.input.keyboard)||s.on("keydown-N",(()=>{localStorage.removeItem(Rr),this.scene.scene.start("Preloader")})),null==(n=this.scene.input.keyboard)||n.on("keydown-Z",(()=>{w.debug=!w.debug,xn(this.scene),this.scene.scene.restart()})),null==(r=this.scene.input.keyboard)||r.on("keydown-FORWARD_SLASH",(()=>{var e;X(e=this.scene)?function(e,t=!0){q||(Y(e,R,t),Q(e,1),e.lights.lights.forEach((i=>{const s=i.intensity;i.setVisible(!0),t&&(i.setIntensity(0),e.tweens.add({targets:i,duration:V,intensity:s}))})))}(e):K(e)})),null==(o=this.scene.input.keyboard)||o.on("keydown-CLOSED_BRACKET",(()=>{ie(this.scene,"DebugTool")})),w.debug&&(null==(a=this.scene.input.keyboard)||a.on("keydown-COMMA",(()=>{const e=this.scene.lights.lights;console.table(e,["x","y"])})),null==(l=this.scene.input.keyboard)||l.on("keydown-PERIOD",(()=>{const e=this.scene.input.activePointer;new ae(this.scene,e.worldX,e.worldY,100,_(G),1)})),this.scene.input.on("gameobjectdown",((e,t)=>{1===e.buttons&&(t!==this.activeElement?this.activeElement=t:this.activeElement=void 0)})),this.scene.input.on("drag",((e,t)=>{this.activeElement===t&&t.setPosition(e.worldX,e.worldY)})),this.scene.input.on("wheel",((e,t,i,s,n)=>{this.scene.cameras.main.zoom=Math.max(.01,this.scene.cameras.main.zoom+5e-4*s)})),this.scene.input.on("pointerup",(e=>{1===e.button&&(this.scene.cameras.main.zoom=1)})))}update(){if(!w.debug)return;const e=this.scene.input.activePointer,t=[`FPS (now): ${(1e3/this.scene.game.loop.delta).toFixed(1)}`,`FPS (avg): ${this.scene.game.loop.actualFps.toFixed(1)}`,`Frame Time: ${this.scene.game.loop.delta.toFixed(2)}`,`Zoom: ${this.scene.cameras.main.zoom.toFixed(2)}`,"",`Player x: ${this.player.x.toFixed(1)}`,`Player y: ${this.player.y.toFixed(1)}`,"",`Mouse x: ${e.worldX.toFixed(1)}`,`Mouse y: ${e.worldY.toFixed(1)}`];if(this.activeElement&&(t.push(""),t.push(`Active x: ${this.activeElement.x.toFixed(1)}`),t.push(`Active y: ${this.activeElement.y.toFixed(1)}`)),this.text.setText(t),this.rect.setPosition(this.text.x-10,this.text.y-10).setSize(this.text.displayWidth+20,this.text.displayHeight+20),this.activeElement){this.outline.setPosition(this.activeElement.x,this.activeElement.y),this.outline.setSize(this.activeElement.displayWidth,this.activeElement.displayHeight),this.outline.setOrigin(this.activeElement.originX,this.activeElement.originY);const e=this.activeElement.body;(e&&e instanceof a.Physics.Arcade.Body||e instanceof a.Physics.Arcade.StaticBody)&&e.updateFromGameObject()}else this.outline.setSize(0,0)}}class Pn extends a.Physics.Arcade.Image{constructor(e,i,s){var n;const{x:r,y:o,image:l,scale:h}=i;super(e,r,o,l),t(this,"player"),t(this,"initialized",!1),t(this,"info"),t(this,"center"),this.name=`Background-${i.image}`,this.info=i,this.player=s,this.setOrigin(0).setDepth(x.Backgrounds),ze(this,i);const c=null==(n=e.textures.get(l))?void 0:n.getSourceImage();this.center=new a.Math.Vector2(r+c.width*(h||1)/2,o+c.height*((h||1)/2)),w.debug&&e.add.rectangle(this.center.x,this.center.y,c.width,c.height).setStrokeStyle(10,26214).setOrigin(.5)}lazyInit(e){(e||!this.initialized&&te(this.center,this.player,2e3))&&(this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0}),this.initialized=!0)}update(){this.lazyInit()}}function In(){return Math.random()-.5}w.dayMinutes,a.GameObjects.Container;const Tn=[3200,600],Cn=[5350,690],jn=[500,200,100,50,10];class On extends a.GameObjects.GameObject{constructor(e,i,s,n=40,r=[1400,600]){super(e,"fireflies"),t(this,"scene"),t(this,"center",new a.Math.Vector2(0,0)),t(this,"lights",[]),t(this,"count"),t(this,"centers",[]),t(this,"bounds",[1e3,400]),t(this,"biases",[]),t(this,"initialized",!1),t(this,"debug"),e.add.existing(this),this.scene=e,this.count=n,this.bounds=r,this.setPosition(i,s)}setPosition(e,t){this.center.set(e,t),this.centers=[];for(let i=0;ie.visible=!1));const i=e/1e3*.025,s=Math.cos(i),n=Math.sin(i);this.lights.forEach(((e,t)=>{const r=this.biases[t],o=Math.cos(70*i+r[10]);e.visible=!0,e.intensity=Math.min(.05+Math.abs(r[4]*o+r[3]*s+r[4]*s)/50,.4),e.x=s*r[0]+n*r[1]+s*r[2]+n*r[3]+s*r[4]+this.centers[t].x,e.y=n*r[5]+s*r[6]+n*r[7]+s*r[8]+n*r[9]+this.centers[t].y}))}}const An={[A.LabStairs]:{x:-1670,y:1730,size:{x:80,y:80},text:"Press [UP] to go upstairs"}};class En extends a.GameObjects.Image{constructor(e,i,s){const{x:n,y:r}=An[i];super(e,n,r,""),t(this,"player"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`HelperText-${i}`,this.player=s}lazyInit(e){if(!e&&(this.initialized||!te(this,this.player)))return;const{size:t}=An[A.LabStairs];this.setDepth(x.Items),this.setDisplaySize(t.x,t.y),w.debug||this.setAlpha(0),this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0}),this.initialized=!0}getButtonPrompt(){return An[A.LabStairs].text}onInteract(e){return S.None}update(){this.lazyInit()}}class Mn extends a.GameObjects.Container{constructor(e,i){const{position:s,size:n}=i;super(e,s.x,s.y),t(this,"initialized",!1),t(this,"center"),t(this,"player"),t(this,"layers",[]),t(this,"info"),this.name=`ParallaxBackground-${s.x}-${s.y}`,this.info=i,this.player=e.player,this.setDepth(x.Backgrounds),this.center=new a.Math.Vector2(s.x+.5*n.x,s.y+.5*n.y),w.debug&&this.add(e.add.rectangle(this.center.x,this.center.y,n.x,n.y).setStrokeStyle(10,26214).setOrigin(.5))}lazyInit(e){if(!e&&(this.initialized||!te(this.center,this.player,this.info.size.x)))return;this.scene.add.existing(this),this.scene.physics.add.existing(this);const{position:t,size:i,scale:s,images:n,skipLighting:r}=this.info;n.forEach((({texture:e,scale:n,speed:o})=>{const a=this.scene.add.tileSprite(t.x,t.y,i.x,i.y,e);a.setOrigin(0).setTileScale((s||1)*(n||1)).setData("speed",o),r||a.setPipeline("Light2D"),a.setPostPipeline("XRayPipeline"),this.add(a),this.layers.push(a)})),w.debug&&this.setInteractive({draggable:!0,hitArea:new a.Geom.Rectangle(t.x,t.y,i.x,i.y),hitAreaCallback:a.Geom.Rectangle.Contains}),this.initialized=!0}update(){if(this.lazyInit(),!this.initialized||!this.getBounds().contains(this.player.x,this.player.y))return;const{size:e}=this.info,t=a.Math.Clamp(this.player.x-this.center.x,-.5*e.x,.5*e.x)/e.x;this.layers.forEach((i=>{i.tilePositionX=t*i.getData("speed")*e.x}))}}class zn extends a.GameObjects.Text{constructor(e){super(e,w.width/2,w.height-50,"",an),this.setOrigin(.5).setBackgroundColor("#"+F).setPadding(10,5).setAlign("center").setAlpha(.8).setScrollFactor(0).setDepth(x.Overlay).setVisible(!1),e.add.existing(this)}}const Dn={octave:3.5,speed:1,volume:1,type:"sine"},Fn={[T.Inventor]:{octave:3.3,speed:1,volume:1.8},[T.Stranger]:{octave:2.8,speed:1.1,volume:2.6},[T.Sphinx]:{octave:2.5,speed:2,volume:2,type:"triangle"},[T.Mayor]:{octave:3.9,speed:.8,volume:.8},[T.ClockTower]:{octave:2.1,speed:1.5,volume:1.5,type:"sawtooth"},player:{octave:3.7,speed:.75,volume:.9}};class Ln extends a.GameObjects.Text{constructor(e,i,s,n,r,o){super(e,i,s,n,{...an,fontSize:48,backgroundColor:`#${D}`,padding:{x:15,y:10},...o}),t(this,"onClick"),t(this,"disabled"),t(this,"selected"),this.setOrigin(.5),e.add.existing(this),this.onClick=r,this.disabled=!1,this.selected=!1,this.setInteractive({useHandCursor:!0}).setScrollFactor(0),this.on("pointerdown",(()=>{this.disabled||(this.setSelected(!1),r(this))})),this.on("pointerover",(()=>{this.disabled||this.selected||this.setTint(12303291)})),this.on("pointerout",(()=>{this.disabled||this.selected||this.setTint(16777215)}))}disable(){this.disabled=!0,this.selected=!1,this.disableInteractive(),this.setTint(6710886)}enable(){this.disabled=!1,this.selected=!1,this.setInteractive(),this.setTint(16777215)}setSelected(e){this.selected=e,this.setTint(e?_(N):16777215)}}class Bn extends Ln{constructor(e,t,i,s,n,r,o,a){super(e,t,i,s,n,{fontSize:32,align:"center",...r}),this.setOrigin((null==a?void 0:a.x)||0,(null==a?void 0:a.y)||0),null!==o&&this.setFixedSize((null==o?void 0:o.x)||250,(null==o?void 0:o.y)||50)}}class Gn extends a.GameObjects.Container{constructor(e,i,s){var n,r,o;super(e,i,s),t(this,"buttons",[]),t(this,"activeIndex",-1),e.add.existing(this).setScrollFactor(0),null==(n=e.input.keyboard)||n.on("keydown-UP",(()=>{this.setActiveButton(Math.max(0,this.activeIndex-1))})),null==(r=e.input.keyboard)||r.on("keydown-DOWN",(()=>{this.setActiveButton(Math.min(this.activeIndex+1,this.buttons.length-1))})),null==(o=e.input.keyboard)||o.on("keydown-ENTER",(()=>{var e;null==(e=this.buttons[this.activeIndex])||e.onClick(this.buttons[this.activeIndex])}))}addButton(e){this.add(e),this.buttons.push(e),1===this.buttons.length&&this.setActiveButton(0),e.on("pointerover",(()=>{this.setActiveButton(-1)}))}setActiveButton(e){var t,i;null==(t=this.buttons[this.activeIndex])||t.setSelected(!1),this.activeIndex=e,null==(i=this.buttons[this.activeIndex])||i.setSelected(!0)}clearButtons(){this.buttons=[],this.activeIndex=-1,this.removeAll(!0)}}const Rn=20;class Wn extends a.GameObjects.Container{constructor(e,i){var s,n;super(e),t(this,"textWidth"),t(this,"textHeight"),t(this,"player"),t(this,"target"),t(this,"npcName"),t(this,"text"),t(this,"portrait"),t(this,"options"),t(this,"optionsContainer"),t(this,"dialog"),t(this,"messageIndex"),t(this,"interactionTimeout"),t(this,"gamepadVisible",!1),t(this,"initialized",!1),t(this,"animating",!1),t(this,"stopAnimation"),t(this,"stopAudio");const{width:r,height:o}=w;this.textWidth=r-135-80,this.textHeight=130,this.setScrollFactor(0),this.setPosition(Rn,o-Rn-170),this.setDepth(x.Overlay),this.setAlpha(0),this.setVisible(!1),i&&(this.player=i),null==(s=this.scene.input.keyboard)||s.on("keydown-ENTER",(()=>{this.options||this.updateDialog()})),null==(n=this.scene.input.keyboard)||n.on("keydown-BACKSPACE",(()=>{this.options||this.updateDialog()}))}createUI(){this.scene.add.existing(this),this.npcName=new a.GameObjects.Text(this.scene,170,15,"",{...an,color:"#"+z}),this.text=this.scene.add.text(170,60,"",an),this.text.width=this.textWidth,this.text.height=this.textHeight,this.text.setOrigin(0).setMaxLines(5),this.portrait=this.scene.add.image(Rn,Rn,"").setOrigin(0).setScale(1.5);const e=this.scene.add.rectangle(0,0,w.width-40,170,_(F),.8).setStrokeStyle(2,_(z),1).setOrigin(0,0).setScrollFactor(0).setInteractive({useHandCursor:!0}).on("pointerdown",(()=>{this.options||this.updateDialog()}));this.optionsContainer=new Gn(this.scene).setDepth(x.Overlay);const t=this.scene.add.image(w.width-40-20,154,"chevron-down").setScale(.5);this.scene.tweens.add({targets:t,y:148,scale:.4,duration:1e3,ease:"Sine.easeInOut",yoyo:!0,repeat:-1}),this.add([e,this.npcName,this.text,this.portrait,t])}setDialog(e,t,i){var s,n;if(this.npcName||this.createUI(),this.gamepadVisible=(null==(s=this.scene.gamepad)?void 0:s.visible)||!1,this.setVisible(!0),this.scene.tweens.add({targets:this,alpha:void 0!==e?1:0,duration:125,onComplete:()=>this.setVisible(void 0!==e)}),this.target=t,this.messageIndex=0,this.dialog=e,this.interactionTimeout=Date.now()+350,null==(n=this.scene.gamepad)||n.setVisible(void 0===this.dialog&&this.gamepadVisible),!e)return;const r=i||(t instanceof ue?E[t.npcType].portrait:void 0);this.npcName.setVisible(!1),r?(this.portrait.setVisible(!0),this.portrait.setTexture(r),this.text.setPosition(170,Rn+(t instanceof ue?40:0)).setWordWrapWidth(this.textWidth,!0).setFixedSize(this.textWidth,this.textHeight),t instanceof ue&&(this.npcName.setVisible(!0),this.npcName.setText(E[t.npcType].name))):(this.portrait.setVisible(!1),this.text.setPosition(Rn,Rn).setWordWrapWidth(170+this.textWidth,!0).setFixedSize(170+this.textWidth,this.textHeight)),this.showMessage()}showMessage(){var e;const t=this.getMessages(),i=t&&t[this.messageIndex];if(i){this.text.setText(i);const t=this.target instanceof ue?this.target.npcType:void 0;let s="player_portrait"===(null==(e=this.portrait)?void 0:e.texture.key)?Fn.player:t?Fn[t]:Dn;const{promise:n,stop:r}=function(e,t,i,s){return 0===i?{promise:Promise.resolve()}:(s.sound.unlock(),((e,i)=>{let s=!1;const n=e=>new Promise((s=>{const n=i.sound.add(e);n.on("complete",(()=>{n.destroy(),s()})),n.play({rate:3,detune:300*(t.octave-4)})}));return{promise:new Promise((async t=>{const i=e.toLowerCase().split(" ");for(let e=0;e=97&&t.charCodeAt(0)<=122&&await n(t)}t()})),stop:()=>{s=!0}}})(e,s))}(i,s,this.scene.sound.mute?0:this.scene.sound.volume,this.scene),{promise:o,stop:a}=function(e,t=15){const i=e.text,s=i.replace(/[^ ]/g," ");e.text="";let n="";const r=e.scene.time.addEvent({delay:t,loop:!0});return{promise:new Promise((t=>{r.callback=()=>{if(e.text===i)return r.destroy(),t();n+=i[n.length];const o=s.substring(n.length);e.text=n+o}})),stop:()=>{r.destroy(),e.text=i}}}(this.text);this.animating=!0,this.stopAudio=r,this.stopAnimation=a,Promise.all([n,o]).then((()=>{this.animating=!1,this.stopAudio=void 0,this.stopAnimation=void 0})),this.text.getWrappedText().length>5&&console.error("Message too long!",i)}this.updateOptions()}updateOptions(){if(this.optionsContainer.clearButtons(),this.options=this.getOptions(),!this.options)return;const e=!w.zoomed;this.options.forEach(((t,i)=>{const s=new Ln(this.scene,w.width/2,w.height/(e?9:14)+i*(30+w.height/(e?16:22)),t,(()=>this.onSelectOption(t)),{fontSize:24,backgroundColor:"#"+F,padding:{y:10},align:"center",fixedWidth:350}).setOrigin(.5).setDepth(x.Overlay);this.optionsContainer.addButton(s)}))}onSelectOption(e){var t;(null==(t=this.dialog)?void 0:t.onSelected)&&(this.dialog.onSelected(e,this.player,this.target),this.optionsContainer.removeAll(!0))}updateDialog(){var e,t,i,s;if(Date.now()=n.length?(this.dialog.onCompleted&&this.dialog.onCompleted(this.player,this.target),this.dialog=void 0,this.text.setText(""),this.scene.tweens.add({targets:this,alpha:0,duration:125,onComplete:()=>this.setVisible(!1)}),null==(i=this.scene.gamepad)||i.resetButtons()):this.showMessage(),null==(s=this.scene.gamepad)||s.setVisible(void 0===this.dialog&&this.gamepadVisible),this.interactionTimeout=Date.now()+350}}getMessages(){var e;let t=null==(e=this.dialog)?void 0:e.messages;return"function"==typeof t&&(t=t(this.player)),t}getOptions(){var e;let t=null==(e=this.dialog)?void 0:e.options;return"function"==typeof t&&(t=t(this.player)),t}}const Nn={[P.Wrench]:{x:0,y:0,image:"wrench",name:"Old Wrench"},[P.Gear1]:{x:0,y:0,image:"gear",name:"Shiny Gear"},[P.Key]:{x:0,y:0,image:"key",name:"Rusty Key",skipLighting:!0},[P.HerbRed]:{x:-200,y:1730,image:"herb_red",name:"Crimson Starbloom"},[P.HerbGreen]:{x:5295,y:985,image:"herb_green",name:"Green Writhewood"},[P.HerbBlue]:{x:1535,y:875,image:"herb_blue",name:"Blue Plumed Frond"},[P.Potion]:{x:0,y:0,image:"potion",name:"Strange Potion"},[P.Gear2]:{x:0,y:0,image:"gear2",name:"Old Gear"}};class _n extends a.GameObjects.Container{constructor(e){super(e,0,0),t(this,"inventory",[]),t(this,"text"),t(this,"rect"),t(this,"initialized",!1),this.setScrollFactor(0).setDepth(x.Ui).setVisible(!1)}createUI(){this.initialized||(this.scene.add.existing(this),this.rect=this.scene.add.rectangle(0,0,0,0,_(D)).setStrokeStyle(2,_(M)).setAlpha(.75).setOrigin(0),this.add(this.rect),this.text=this.scene.add.text(10,4,"Inventory",{...an,fontSize:32}),this.add(this.text),this.initialized=!0)}addItem(e,t){if(this.initialized||this.createUI(),this.inventory.push(e),!e.used){const t=this.scene.add.image(0,0,Nn[e.type].image).setScale(.35);e.type===P.Key&&t.setAngle(45),this.add(t)}this.updateItems();const i=Ee(this.scene,e.type);null==i||i.destroy(),t||(new ln(this.scene,`New item added: ${Nn[e.type].name}`),Sn(this.scene))}removeItem(e){var t;this.initialized||this.createUI();const i=this.inventory.find((t=>t.type===e));i&&(i.used=!0,null==(t=this.getAll().find((t=>{var i;return(null==(i=t.texture)?void 0:i.key)===Nn[e].image})))||t.destroy()),this.updateItems()}updateItems(){var e;this.initialized||this.createUI();let t=0;this.getAll().forEach((e=>{if(e instanceof a.GameObjects.Image){const i=32+50*t;e.setPosition(i,68),t++}})),this.setVisible(this.inventory.length>0);const i=Math.max((null==(e=this.text)?void 0:e.displayWidth)+18,50*t+12);this.setPosition(w.width-i-20,20),this.rect.setSize(i,102)}}class Hn extends a.GameObjects.Image{constructor(e,i){super(e,w.width-50,w.height-55,"journal"),t(this,"player"),t(this,"journal",[]),t(this,"unread"),t(this,"initialized",!1),this.player=i}createUI(){var e;this.initialized||(this.setScrollFactor(0).setDepth(x.Ui).setScale(.5).setAlpha(0).setInteractive({useHandCursor:!0}).setActive(!1),this.on("pointerdown",this.openJournal),this.scene.add.existing(this),this.unread=this.scene.add.ellipse(w.width-21,w.height-89,20,20,11141120).setStrokeStyle(2,_(F)).setScrollFactor(0).setDepth(x.Ui2).setVisible(!1),null==(e=this.scene.input.keyboard)||e.on("keydown-J",(()=>{this.openJournal()})),this.initialized=!0)}addEntry(e,t){this.initialized||this.createUI(),this.journal.includes(e)||(0===this.journal.length&&(this.scene.tweens.add({targets:this,alpha:1,duration:300}),this.setActive(!0)),this.journal.push(e),t||(this.unread.setVisible(!0),new ln(this.scene,"New journal entry added!")),this.handleSideEffects(e,t||!1))}openJournal(){this.initialized||this.createUI(),0!==this.journal.length&&ie(this.scene,"JournalDialog")}handleSideEffects(e,t){const{warpAdd:i}=ge[e];if(i&&Oe(this.scene,i,!0),e===j.ClockFirstGear||e===j.ClockSecondGear){const e=Ae(this.scene,T.ClockTower);(null==e?void 0:e.clock)&&e.clock.updateHands()}e!==j.ExtraPotionInformation||this.journal.includes(j.SafeDiscovered)||gn(this.scene,!0),e===j.SafeDiscovered&&function(e,t){const i=Me(e.scene,O.MansionPicture);t||e.setActive(!1),null==i||i.scene.tweens.add({targets:i,angle:97,duration:t?0:1500,onComplete:()=>{t||(e.setActive(!0),e.message.setDialog({messages:["A sturdy looking safe was hidden behind the picture.","It looks like it requires a special key to open."]},void 0,"player_portrait"))}})}(this.player,t),t||Sn(this.scene)}}class Un extends a.GameObjects.Container{constructor(e,i){super(e,w.width-330-20,120),t(this,"player"),t(this,"quests",[]),t(this,"questRectangle"),t(this,"initialized",!1),this.player=i}createUI(){if(this.initialized)return;this.scene.add.existing(this),this.setScrollFactor(0).setDepth(x.Ui).setVisible(!1),this.questRectangle=this.scene.add.rectangle(0,0,330,60,_(D)).setStrokeStyle(2,_(M)).setAlpha(.75).setOrigin(0),this.add(this.questRectangle);const e=this.scene.add.text(10,4,"Quests",{...an,fontSize:32});this.add(e),this.initialized=!0}addQuest(e,t){this.initialized||this.createUI(),this.quests.find((t=>t.id===e.id))||(this.quests.push(e),this.add(this.scene.add.text(0,0,fe[e.id].description,{...an,fontSize:20})),this.updateQuests(),t||new ln(this.scene,`New quest added: ${fe[e.id].description}`),this.handleSideEffects(e.id,e.completed,t))}updateExistingQuest(e,t){this.initialized||this.createUI();const i=this.quests.find((t=>t.id===e));i?(!i.completed&&t&&new ln(this.scene,`Quest completed: ${fe[i.id].description}`),i.completed=t,this.updateQuests(),this.handleSideEffects(e,t)):console.error(`Quest ${e} not found in player quests`)}updateQuests(){this.initialized||this.createUI();const e=this.quests.filter((e=>!e.completed));let t=1,i=0;this.getAll().forEach((s=>{if(s instanceof a.GameObjects.Text)if(e.find((e=>s.text===fe[e.id].description))||"Quests"===s.text){if("Quests"!==s.text){const e=14+30*t;s.setPosition(10,e),t++,i=Math.max(i,s.width)}}else s.destroy()}));const s=i+20;this.setX(w.width-20-s),this.setY(this.scene.player.inventory.inventory.length>0?140:20),this.setVisible(e.length>0),this.questRectangle.setSize(s,50+30*e.length)}handleSideEffects(e,t,i){const{warpAdd:s,warpComplete:n}=fe[e];if(s&&Oe(this.scene,s,!0),t&&n&&Oe(this.scene,n,!0),e===I.FindPotionIngredients&&!t){const e=this.player.scene;e.interactiveObjects.add(new Mr(e,P.HerbGreen,this.player)),e.interactiveObjects.add(new Mr(e,P.HerbBlue,this.player))}e!==I.ExploreLab||t||Lr(this.player),i||Sn(this.scene)}reset(){this.quests=[],this.updateQuests()}}const $n=1.35*(w.fastMode?350:175),Vn=new a.Math.Vector2(400,650);class qn extends a.Physics.Arcade.Sprite{constructor(e){var i;super(e,Vn.x,Vn.y,"character",0),t(this,"scene"),t(this,"keys"),t(this,"light"),t(this,"debug"),t(this,"buttonPrompt"),t(this,"interactive"),t(this,"interactionTimeout",0),t(this,"message"),t(this,"inventory"),t(this,"quests"),t(this,"journal"),t(this,"gameState"),t(this,"previousPosition",new a.Math.Vector2),t(this,"counter",0),t(this,"history",[]),t(this,"rewinding",!1),this.name="Player",this.scene=e,e.add.existing(this),e.physics.add.existing(this),w.debug&&this.setInteractive(),this.setBodySize(48,70).setOffset(40,10).setOrigin(.5,.65).setDepth(x.Player).setScale(1.35).setPipeline("Light2D").setPostPipeline("XRayPipeline"),w.debug?(this.light=new ae(e,this.x,this.y,200,16768443,1),this.debug=e.add.circle(this.x,this.y,3,16711935).setDepth(x.Debug)):this.light=e.lights.addLight(this.x,this.y,200,16768443,1),(i=this).anims.create({key:"walk",frames:i.anims.generateFrameNumbers("character",{start:0,end:5}),frameRate:w.prod?6:9,repeat:-1}),i.anims.play("walk"),this.keys=new de(e),this.message=new Wn(e,this),this.inventory=new _n(e),this.quests=new Un(e,this),this.journal=new Hn(e,this),this.gameState=new Gr(e,this),w.perfTest&&e.time.delayedCall(1e3,(()=>{this.setVelocityX($n),e.time.addEvent({delay:1e3,callback:()=>this.setVelocityX(this.body?-this.body.velocity.x:0),loop:!0})}))}update(e,t){var i,s,n;w.debug&&(this.setTint(this.interactive?16755370:16777215),this.debug.setPosition(this.x,this.y));const r=this.interactive&&!this.message.visible&&(null==(s=null==(i=this.buttonPrompt)?void 0:i.text)?void 0:s.length)>0||!1;r&&!this.buttonPrompt&&(this.buttonPrompt=new zn(this.scene)),null==(n=this.buttonPrompt)||n.setVisible(r),w.perfTest||(this.setVelocity(0),this.rewinding?this.counter+t>31.25?(this.rewind(),this.counter=0):this.counter+=t:this.checkInteraction()||this.message.visible||this.updateVelocity()),this.light.setPosition(this.x,this.y-20),function(e){const t=e.x-e.previousPosition.x,i=e.y-e.previousPosition.y,s=t<0;Math.abs(t)>.01||Math.abs(i)>.01?e.anims.resume():e.anims.pause(),Math.abs(t)>0&&(e.flipX=e.rewinding?!s:s),e.setAngle(e.flipX?-5:5)}(this),this.previousPosition.set(this.x,this.y)}checkInteraction(){var e;let t;return this.interactive&&Date.now()>this.interactionTimeout&&(t=this.interactive.onInteract(this.keys.keys),t!==S.None&&(this.interactionTimeout=Date.now()+((null==(e=this.interactive)?void 0:e.interactionTimeout)||500),this.keys.resetKeys(),t===S.Teleported&&(this.interactive=void 0))),t}updateVelocity(){const e=this.keys.keys;let t=1;!w.prod&&e[ce.Shift]&&(t=2),this.anims.timeScale=t;const i=$n*t;e[ce.Left]&&this.setVelocityX(-i),e[ce.Right]&&this.setVelocityX(i),w.debug&&!this.interactive&&(e[ce.Up]&&this.setVelocityY(-i),e[ce.Down]&&this.setVelocityY(i)),e[ce.Left]&&e[ce.Right]&&this.setVelocityX(0)}record(){var e;this.history.length<1e3?this.history.push(new a.Math.Vector3(this.x,this.y,(null==(e=this.body)?void 0:e.velocity.x)||0)):console.warn("Max history reached")}rewind(){const e=this.history.pop();e&&(this.x=e.x,this.y=e.y,this.setVelocityX(-e.z))}setRewind(e){this.rewinding=e,this.counter=0}reset(){this.quests.reset(),this.setPosition(Vn.x,Vn.y),this.flipX=!1,this.setVelocity(0)}setInteractiveObject(e){var t,i;this.interactive=e,(null==e?void 0:e.onCollided)&&e.onCollided();const s=null==(t=null==e?void 0:e.getButtonPrompt)?void 0:t.call(e);s&&!this.buttonPrompt&&(this.buttonPrompt=new zn(this.scene)),null==(i=this.buttonPrompt)||i.setText(s)}}class Xn extends a.Physics.Arcade.Image{constructor(e,i,s,n=100,r=100,o=!1,a=!1){super(e,i,s,""),t(this,"scene"),t(this,"width"),t(this,"height"),t(this,"flipped"),t(this,"upwards"),t(this,"graphics"),t(this,"initialized",!1),this.name=`Slope-${i}-${s}`,this.scene=e,this.width=n,this.height=r,this.flipped=o,this.upwards=a}lazyInit(e){if(e||!this.initialized&&te(this,this.scene.player)){if(this.scene.add.existing(this),this.scene.physics.add.existing(this),this.setOrigin(0).setDepth(x.Debug).setVisible(w.debug).setSize(this.width,1.5*this.height),w.debug){this.setInteractive({draggable:!0});const e=this.scene.add.graphics().setDepth(x.Debug);this.graphics=e,e.lineStyle(2,65280,1);const t=this.width/2,i=new a.Math.Vector2(0,this.flipped?0:0+this.height),s=new a.Math.Vector2(0+this.width,this.flipped?0+this.height:0);e.lineBetween(i.x,i.y,s.x,s.y),e.lineBetween(i.x-t,i.y,i.x,i.y),e.lineBetween(s.x,s.y,s.x+t,s.y),e.strokeCircle(i.x,i.y,2),e.strokeCircle(s.x,s.y,2)}this.initialized=!0}}update(e,t){if(this.lazyInit(),!this.initialized)return;w.debug&&this.graphics&&this.graphics.setPosition(this.x,this.y);const i=this.scene.player,s=i.keys.keys;if(this.body&&this.scene.physics.world.intersects(this.body,i.body)){let e=a.Math.Clamp(1-(this.x+this.width-i.x)/this.width,0,1);this.flipped&&(e=1-e);const t=this.y+this.height,n=(1-i.originY)*i.displayHeight,r=t-this.height*e-n;if(this.upwards&&s[ce.Up]&&Math.abs(i.y-r)<70)return i.setVelocityX(this.flipped?-$n:$n),void i.setY(r);if(this.upwards&&(s[ce.Right]||s[ce.Left]&&this.flipped)&&i.y{void 0!==e.id&&this.createWall(e,t)}))}createWall(e,t){const i=this.scene.add.rectangle(e.x,e.y,6,100).setOrigin(0).setVisible(w.debug);i.name=`Wall-${e.id||t}-${e.x}-${e.y}`,void 0!==e.id&&i.setData("WallType",e.id),w.debug&&i.setInteractive({draggable:!0}),this.add(i),this.initialized.push(t)}update(){for(let e=0;eJn){if("RIGHT"===this.lastXAxisKey)return;"LEFT"===this.lastXAxisKey&&(null==(n=this.scene.input.keyboard)||n.emit("keyup-LEFT")),null==(r=this.scene.input.keyboard)||r.emit("keydown-RIGHT"),this.lastXAxisKey="RIGHT"}if(y<-.1){if("LEFT"===this.lastXAxisKey)return;"RIGHT"===this.lastXAxisKey&&(null==(o=this.scene.input.keyboard)||o.emit("keyup-RIGHT")),null==(a=this.scene.input.keyboard)||a.emit("keydown-LEFT"),this.lastXAxisKey="LEFT"}if(Math.abs(g)<=Jn&&this.lastYAxisKey)return null==(l=this.scene.input.keyboard)||l.emit("keyup-"+this.lastYAxisKey),void(this.lastYAxisKey=void 0);if(g>Jn){if("DOWN"===this.lastYAxisKey)return;"UP"===this.lastYAxisKey&&(null==(h=this.scene.input.keyboard)||h.emit("keyup-UP")),null==(c=this.scene.input.keyboard)||c.emit("keydown-DOWN"),this.lastYAxisKey="DOWN"}if(g<-.1){if("UP"===this.lastYAxisKey)return;"DOWN"===this.lastYAxisKey&&(null==(d=this.scene.input.keyboard)||d.emit("keyup-DOWN")),null==(u=this.scene.input.keyboard)||u.emit("keydown-UP"),this.lastYAxisKey="UP"}}createDPad(){console.log("createDPad");const e=this.scene.add.container(10,-10);this.add(e);const t=this.scene.add.circle(0,0,60,_(D),.45).setStrokeStyle(3,_(F));e.add(t),this.button(-57,0,"LEFT",e),this.button(57,0,"RIGHT",e),this.button(0,-57,"UP",e),this.button(0,57,"DOWN",e)}createButtons(){const e=this.scene.add.container(w.width-300,0);this.add(e);const t=this.scene.add.circle(40,0,65,_(D),.45).setStrokeStyle(3,_(F)).setScale(1,.6).setAngle(-30);e.add(t),this.button(80,-20,"ENTER",e),this.button(0,20,"BACKSPACE",e)}createControllerListeners(){var e,t,i,s;null==(e=this.scene.input.gamepad)||e.on("connected",(e=>{new ln(this.scene,"Gamepad connected")})),null==(t=this.scene.input.gamepad)||t.on("disconnected",(e=>{new ln(this.scene,"Gamepad disconnected")})),null==(i=this.scene.input.gamepad)||i.on("down",((e,t)=>{var i;const s=this.getKeyFromButton(t);s&&(null==(i=this.scene.input.keyboard)||i.emit(`keydown-${s}`))})),null==(s=this.scene.input.gamepad)||s.on("up",((e,t)=>{var i;const s=this.getKeyFromButton(t);s&&(null==(i=this.scene.input.keyboard)||i.emit(`keyup-${s}`))}))}getKeyFromButton(e){const t=e.pad.id.toLowerCase().includes("nintendo");let i;switch(e.index){case 0:i=t?"BACKSPACE":"ENTER";break;case 1:i=t?"ENTER":"BACKSPACE";break;case 2:i=t?"SHIFT":"BACK_SLASH";break;case 3:i=t?"BACK_SLASH":"SHIFT";break;case 8:i="J";break;case 9:i="ESC";break;case 12:i="UP";break;case 13:i="DOWN";break;case 14:i="LEFT";break;case 15:i="RIGHT"}return i}button(e,t,i,s){const n="ENTER"===i||"ESCAPE"===i?35:38,r=this.scene.add.circle(e,t,n,_(M),Qn).setStrokeStyle(3,_(F));r.setInteractive({useHandCursor:!0}).setScrollFactor(0),s.add(r),r.on("pointerdown",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keydown-${i}`),r.setFillStyle(_(D),Math.min(1,1.05))})),r.on("pointerup",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keyup-${i}`),r.setFillStyle(_(M),Qn)})),r.on("pointerout",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keyup-${i}`),r.setFillStyle(_(M),Qn)})),this.buttons.push(r)}resetButtons(){this.buttons.forEach((e=>e.setFillStyle(_(M),Qn)))}}class er extends a.GameObjects.Container{constructor(e,i,s,n,r){super(e,i,s),t(this,"onClick"),t(this,"img"),t(this,"rect"),t(this,"selected"),e.add.existing(this),this.setScrollFactor(0).setDepth(x.Ui),this.rect=e.add.rectangle(0,0,42,42,_(D)).setScrollFactor(0).setStrokeStyle(2,_(F)),this.img=e.add.image(-1,1,n).setDisplaySize(32,32),this.add(this.rect),this.add(this.img),this.rect.setInteractive({useHandCursor:!0}).on("pointerdown",(()=>r(this))),this.onClick=r,this.selected=!1,this.rect.on("pointerover",(()=>{this.rect.setScale(1.1),this.img.setDisplaySize(36,36)})),this.rect.on("pointerout",(()=>{this.rect.setScale(1),this.img.setDisplaySize(32,32)}))}setTint(e){this.img.setTint(e)}setSelected(e){this.selected=e,this.setTint(e?_(N):16777215)}setIcon(e){this.img.setTexture(e).setDisplaySize(32,32)}}var tr=(e=>(e.Horizontal="H",e.Vertical="V",e.Corner="C",e.T="T",e.Cross="X",e.Empty=" ",e))(tr||{});const ir={H:[[0,0,0],[1,1,1],[0,0,0]],V:[[0,1,0],[0,1,0],[0,1,0]],C:[[0,0,0],[1,1,0],[0,1,0]],T:[[0,0,0],[1,1,1],[0,1,0]],X:[[0,1,0],[1,1,1],[0,1,0]]," ":[[0,0,0],[0,0,0],[0,0,0]]},sr=[[" "," "," ","V"," "," ","V"," "," ","V"," "," "," ","V"," "," "],[" "," ","C","C"," "," ","V"," "," ","V"," "," ","C","T","H","H"],["H","H","X","T","T","T","T","T","T","C"," "," ","V"," "," "," "],[" "," ","V","C","X","C"," ","C","X","H","T","H","X","H","C"," "],[" "," ","C","T","X","H","C"," ","V"," ","V"," ","V"," ","T","H"],["H","T","H","T","V"," ","T","H","X","H","T","H","T"," ","V"," "],[" ","V"," ","C","X","H","C"," ","T","C"," "," ","C","C","C","H"],[" ","V"," "," ","V"," "," "," ","V","V"," "," "," ","V"," "," "]].map((e=>e.map((e=>e))));function nr(e,t){if(!e||!t)return!1;const i=rr(e),s=rr(t),n=t.x-e.x,r=t.y-e.y;return 1===n&&0===r?i.right&&s.left:-1===n&&0===r?i.left&&s.right:0===n&&1===r?i.bottom&&s.top:0===n&&-1===r&&i.top&&s.bottom}function rr(e){const t=function(e){let t=ir[e.type];const i=Math.floor(e.rotation/90);for(let s=0;s1===e[0])),right:t.some((e=>1===e[e.length-1])),top:t[0].some((e=>1===e)),bottom:t[t.length-1].some((e=>1===e))}}function or(e){return e[0].map(((t,i)=>e.map((e=>e[i])).reverse()))}const ar=Object.keys(P).map((e=>P[e])).filter((e=>"number"==typeof e)),lr=Object.keys(j).map((e=>j[e])).filter((e=>"number"==typeof e)),hr=Object.keys(T).map((e=>T[e])).filter((e=>"number"==typeof e)),cr=Object.keys(O).map((e=>O[e])).filter((e=>"number"==typeof e)),dr=Object.keys(I).map((e=>I[e])).filter((e=>"number"==typeof e)),ur=Object.keys(k).map((e=>k[e])).filter((e=>"number"==typeof e)),pr=Object.keys(A).map((e=>A[e])).filter((e=>"number"==typeof e)),yr=Object.values(tr).filter((e=>"number"!=typeof e)),gr=["MainMenu","MazeDialog","PipesDialog","TumblerDialog","MemoryDialog","SliderDialog"],fr=[{x:0,y:0,image:"town"},{x:500,y:-1100,image:"clock_outside"},{x:500,y:-2400,image:"clock_inner",skipLighting:!0},{x:2300,y:0,image:"forest"},{x:4400,y:100,image:"lake"},{x:-2200,y:-170,image:"mansion_outside"},{x:-2e3,y:-1320,image:"mansion_inside",skipLighting:!0},{x:-3200,y:1300,image:"alchemy_lab",scale:.9,skipLighting:!0},{x:1600,y:-700,image:"library",skipLighting:!0}],mr=[{x:135,y:462,radius:150,color:_(z),intensity:2.5},{x:697,y:441},{x:1018,y:435},{x:887,y:200,radius:150},{x:1561,y:460},{x:791,y:472,intensity:.5},{x:962,y:469,intensity:.5},{x:162,y:814,intensity:2},{x:635,y:772},{x:1638,y:788,intensity:2},{x:5300,y:530,intensity:2},{x:5315,y:730,intensity:.75,radius:75}],br=[],vr=[{x:740,y:-1370,width:170,height:95},{x:815,y:-2010,width:90,height:70},{x:5150,y:953,width:100,height:60,flip:!0},{x:-1300,y:-415,width:90,height:35},{x:-1710,y:1577,width:280,height:190,upwards:!0},{x:-1020,y:1697,width:200,height:70},{x:-2570,y:1728,width:200,height:40,flip:!0}],wr=(e,t,i)=>{var s=1/0,n=0,r=Math.round;const o=r(window.devicePixelRatio||1),a=100*o,l=65*o,h=3*o,c=2*o,d=3*o,u=23*o,p=a-2*d,y=l-u-2*o,g=document.createElement("canvas");g.width=a,g.height=l,g.style.cssText=`width:${a/o}}px;height:${l/o}px`;const f=g.getContext("2d");f.font="bold "+9*o+"px Helvetica,Arial,sans-serif",f.textBaseline="top",f.fillStyle=i,f.fillRect(0,0,a,l),f.fillStyle=t,f.fillText(e,h,c),f.fillRect(d,u,p,y),f.fillStyle=i,f.globalAlpha=.9,f.fillRect(d,u,p,y);let m=0,b=0,v=[];return{dom:g,update:function(l){if(!(performance.now()-m<100)){v[b]=l,b=(b+1)%p,s=Math.min(...v),n=Math.max(...v),f.fillStyle=i,f.globalAlpha=1,f.fillRect(0,0,a,u),f.fillStyle=t,f.fillText(`${e}: ${l.toFixed(1)}`,h,c),f.fillText(`[${s.toFixed(1)} - ${n.toFixed(1)}]`,h,c+10),f.fillRect(d,u,p,y),f.fillStyle=i,f.globalAlpha=.8;for(let e=0;e300||!w.debug&&t>150?new ln(this,i,void 0,L):new ln(this,i)}}update(){this.player&&(this.physics.overlap(this.interactiveObjects,this.player,this.player.setInteractiveObject,((e,t)=>{const i=e;let s=!0;return i.disabled&&(s=!1),void 0!==i.visible&&(s=s&&i.visible),s}),this.player)||this.player.setInteractiveObject(void 0)),this.frustumCull()}frustumCull(){var e;const t=performance.now(),i=this.children.getAll().filter((e=>{var t,i;return(e instanceof a.GameObjects.Image||e instanceof a.GameObjects.Sprite||e instanceof a.GameObjects.Particles.ParticleEmitter||e instanceof a.GameObjects.Graphics)&&!(e instanceof Xn||!(e instanceof we)&&(null==(t=e.name)?void 0:t.startsWith("Warp"))||e.depth>=x.Ui||0===(null==(i=e.name)?void 0:i.length))}));for(let n of i)n.setVisible(!1);const s=this.cameras.main.cull(i);for(let n of s)n instanceof we?n.updateLocked():n.visible=!0;xr&&!this.cullingStats&&(this.cullingStats=xr.addPanel(wr("Culling","#9ad8e4","#064b62"))),null==(e=this.cullingStats)||e.update(performance.now()-t)}createBackgrounds(){return fr.map((e=>new Pn(this,e,this.player)))}createParallaxBackgrounds(){return br.map((e=>new Mn(this,e)))}createWarpers(){return ur.map((e=>new we(this,e,this.player)))}createNpcs(){return hr.map((e=>new ue(this,e,this.player)))}createItems(){return[].map((e=>new Mr(this,e,this.player)))}createSlopes(){return vr.map((e=>new Xn(this,e.x,e.y,e.width,e.height,e.flip,e.upwards)))}createProps(){return cr.map((e=>new ye(this,e,this.player)))}createHelperText(){return pr.map((e=>new En(this,e,this.player)))}createUI(){this.time.delayedCall(50,(()=>{let e=30;new er(this,e,30,"settings",(()=>{this.scene.pause(),this.scene.launch("Paused",{game:this})})),w.prod||new er(this,e+=50,30,"terminal",(()=>{ie(this,"DebugTool")})),this.saveIcon=this.add.image(30,w.height-30,"save").setScale(.4).setDepth(x.Ui).setScrollFactor(0).setAlpha(0),this.saveIcon.postFX.addGlow(0,2)})),this.gamepad=new Zn(this),w.prod||(this.time.delayedCall(500,(()=>{const e=new kn(this,this.player);this.add.group(e,{runChildUpdate:!0})})),w.bootDialog&&this.time.delayedCall(150,(()=>ie(this,w.bootDialog))))}createLights(){this.lights.enable().setAmbientColor(_(M)),mr.forEach((e=>{w.debug?new ae(this,e.x,e.y,e.radius||100,e.color||_(G),e.intensity||1):this.lights.addLight(e.x,e.y,e.radius||100,e.color||_(G),e.intensity||1)})),K(this,!1)}createEventListeners(){var e;null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>{this.scene.pause(),this.scene.launch("Paused",{game:this})})),this.events.on("resume",(()=>{this.player.keys.resetKeys()}))}}const kr=[{question:"I speak without a mouth and hear without ears. I have no body, but I come alive with the wind.",answer:"echo",options:["echo","whisper","ghost","silence","shadow"],hints:{[T.Inventor]:["The sphinx is known for asking about things we take for granted.","Think about what we hear in canyons."],[T.Stranger]:["The sphinx’s riddles are always a bit tricky.","I think this one is about something that bounces off walls."]}},{question:"I have cities, but no houses. I have mountains, but no trees. I have water, but no fish. What am I?",answer:"map",options:["map","globe","dream","photograph","landscape"],hints:{[T.Inventor]:["Think of something that represents the world, showing cities and mountains but not in a literal way."],[T.Stranger]:["Imagine something that can fit in your hand or hang on a wall, showing vast landscapes and bodies of water, but not in their true form."]}},{question:"I fly without wings. I cry without eyes. Whenever I go, darkness flies. What am I?",answer:"cloud",options:["cloud","bat","wind","shadow","storm"],hints:{[T.Inventor]:["The sphinx’s riddles can be twisted. Think about things that move or change without the usual parts, like wings or eyes."],[T.Stranger]:["Look at your surroundings. Shadows often behave in strange ways, don’t they?","They move, disappear, and seem to fly without wings."]}}];function Pr(e){return e instanceof Sr&&Ie(e.player,I.FindPotionIngredients)?1:0}function Ir(e,t){const i=Pr(e);return kr[i].hints[t]}const Tr={messages:e=>function(e){const t=Pr(e);return[kr[t].question]}(e.scene),options:e=>function(e){const t=Pr(e),i=[...kr[t].options].sort((()=>Math.random()-.5));return i.push("I don’t know"),i}(e.scene),onSelected:function(e,t,i){e===function(e){const t=Pr(e);return kr[t].answer}(t.scene)?t.message.setDialog({messages:["That is correct. Well done, you may pass."],onCompleted:e=>{e.quests.updateExistingQuest(I.SphinxRiddle,!0),e.gameState.updateData({sphinxMoved:!0,sphinxFail:!1})}},i):"I don’t know"===e?t.message.setDialog({messages:["Come back when you have an answer for me."]},i):t.message.setDialog({messages:["That is not correct. You will not remember how to get back to me."],onCompleted:e=>{e.gameState.updateData({mazeSolved:!1,mazeSeed:e.gameState.data.mazeSeed+1,sphinxFail:!0}),xe(k.TownEast,e,{x:-100,y:0})}},i)}},Cr={messages:["There. It looks like the alchemy set has been properly fit back together."],onCompleted:e=>{e.journal.addEntry(j.AlchemySetFixed)}},jr={[T.Inventor]:[{messages:["There is still one more gear missing.","Something tells me there is a great evil near the lake."],conditions:{journalEntry:j.ClockSecondGear}},{messages:["Ah, the second gear. You should take it to the clock tower."],conditions:{hasItem:P.Gear2}},{messages:["You found a secret safe in the mansion?","Very interesting. There may be a hint about opening it nearby."],conditions:{journalEntry:j.SafeDiscovered}},{messages:["Blue Plumed Frond? I have not heard of such a plant.","The stranger may know. Many secrets lie under this town."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["There are rumors of an abandoned mansion west of the town.","Some say it is haunted and dark magic lurks within."],conditions:{activeQuest:I.InvestigateTownWest}},{messages:["I see you found the first gear. You should talk to the mayor to learn more about the old clock."],conditions:{hasItem:P.Gear1},onCompleted:e=>{e.quests.updateExistingQuest(I.ForestGear,!0)}},{messages:e=>Ir(e.scene,T.Inventor),conditions:{activeQuest:I.SphinxRiddle}},{messages:["Now that you have the wrench, you can fix the clock tower. You’ll need three gears to do it."],conditions:{hasItem:P.Wrench}},{messages:["The clock tower is the heart of our town, but it’s been broken for ages. I’ve got a wrench, but you’ll need three special gears to fix it.","You might find the others by helping the townsfolk."],onCompleted:e=>{e.journal.addEntry(j.FixTheClock),e.inventory.addItem({type:P.Wrench,used:!1})}}],[T.Stranger]:[{messages:["I am worried about the secrets hidden near the lake.","Long ago I saw a great evil lurking there."],conditions:{journalEntry:j.ClockSecondGear}},{messages:["Another gear? The mayor probably wants that put back in the clock tower."],conditions:{hasItem:P.Gear2}},{messages:["The lock on that safe is no ordinary lock. It requires something special to open it."],conditions:{journalEntry:j.SafeDiscovered,hasUnusedItem:P.Potion}},{messages:["Hmm a potion, I wonder what it does.","The alchemist was no ordinary person and built magical safeguards against intruders."],conditions:{hasUnusedItem:P.Potion}},{messages:["Green Writhewood? Hm, there might be some near the forest or lake."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["You heard of the mansion to the west? It was abandoned many years ago.","There is a rumor of an alchemy lab hidden somewhere nearby, but I have been searching for years and have found not even a single potion."],conditions:{activeQuest:I.InvestigateTownWest}},{messages:["Now that you have the first gear, I would talk to the inventor."],conditions:{hasItem:P.Gear1}},{messages:e=>Ir(e.scene,T.Stranger),conditions:{activeQuest:I.SphinxRiddle}},{messages:["I’ve heard rumors of a gear hidden deep in the Enchanted Forest. Beware of the forest’s creatures and traps.","One time I thought I saw an ancient being, but it ran away."],conditions:{hasItem:P.Wrench},onCompleted:e=>{e.quests.addQuest({id:I.ForestGear,completed:!1})}},{messages:["Who am I?","Eventually, you will learn."]}],[T.Sphinx]:[{messages:e=>e.gameState.data.sphinxFail?["You have returned. I am surprised you were able to find your way back.","Try again."]:Ie(e,I.FindPotionIngredients)?["I see you are back again. You may find what you are looking for ahead, but must first answer my riddle."]:["Ponder this riddle. Answer wisely."],conditions:{activeQuest:I.SphinxRiddle,completedQuest:I.SphinxRiddle,or:!0},onCompleted:(e,t)=>{e.scene.time.delayedCall(50,(()=>{e.message.setDialog({...Tr},t)}))}},{messages:["Welcome, brave soul. To pass, you must answer my riddle. You may only answer once. If you are unsure, you may speak to the townsfolk. Choose wisely."],onCompleted:e=>{e.quests.addQuest({id:I.SphinxRiddle,completed:!1})}}],[T.Mayor]:[{messages:["I’ve been hearing strange reports from the townsfolk. It’s as if time is slipping. Have you felt it?","The clock is still missing a gear. It must be somewhere nearby."],conditions:{journalEntry:j.ClockSecondGear}},{messages:["The second gear has been found? That’s incredible news!"],conditions:{completedQuest:I.InvestigateTownWest}},{messages:["Herbs? I haven’t the faintest idea where to being looking. Start at the source - there are bound to be a few ingredients in the lab you found."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["The minute hand on the clock is spinning again.","It looks like it’s missing two more gears.","The abandoned mansion west of the town might be a good place to look."],conditions:{journalEntry:j.ClockFirstGear},onCompleted:e=>{e.quests.addQuest({id:I.InvestigateTownWest,completed:!1})}},{messages:["Did you go into the clock tower yet?"],conditions:{journalEntry:j.MetTheMayor}},{messages:["Hello, traveler. I am the mayor of this town. The clock tower has been broken for years.","Ah, I see you have found an old gear. Maybe it could be used to help fix the clock tower."],onCompleted:e=>{e.journal.addEntry(j.MetTheMayor)}}],[T.ClockTower]:[{messages:["With two of the gears in place, the clocks hands are moving again."],conditions:{journalEntry:j.ClockSecondGear}},{messages:["Slowly, you align and tighten the second gear into place.","[CREAKING NOISE]","Now two of the hands of the clock are moving again."],conditions:{hasItem:P.Gear2},onCompleted:e=>{e.inventory.removeItem(P.Gear2),e.journal.addEntry(j.ClockSecondGear)}},{messages:["The clock is partially moving again, but it is still missing two gears."],conditions:{journalEntry:j.ClockFirstGear}},{messages:["This dusty clock tower hasn't told the correct time in many years. It appears to be missing some gears.","Let’s see what happens when we add the first gear. You tighten the gear into place.","[CREAKING NOISE]","The clock tower is starting to partially move again. It looks like it’s missing two more gears."],conditions:{hasItem:P.Gear1},onCompleted:e=>{e.inventory.removeItem(P.Gear1),e.journal.addEntry(j.ClockFirstGear)}}]},Or={[P.Gear1]:[{messages:["Hmm, this gear looks like it belongs in the clock tower. I should ask the inventor about it."]}],[P.Gear2]:[{messages:["Finally! I found the second gear to the clock tower.","I should take this and put it back."],onCompleted:e=>{e.quests.updateExistingQuest(I.InvestigateTownWest,!0)}}]},Ar={[O.Chest]:[{messages:["The chest seems to be locked.","It appears to have many symbols above the latch"],conditions:{custom:e=>!Se(e,P.Gear1)&&void 0===Ee(e.scene,P.Gear1)},onCompleted:e=>{ie(e.scene,"MemoryDialog")}}],[O.LabHatch]:[{messages:["Let me see if I can open this hatch.","Wow, the rusty key fits!","[CREAKING NOISE]","Alright, let’s see what is down there!"],conditions:{hasItem:P.Key},onCompleted:(e,t)=>{null==t||t.destroy(),e.inventory.removeItem(P.Key),e.journal.addEntry(j.AlchemyLabFound)}},{messages:["The hatch is locked. I wonder if there is a key somewhere."]}],[O.LabBook]:[{messages:[],conditions:{journalEntry:j.ClockSecondGear}},{messages:['How could I have missed this? The potion is called the "Elixir of Sight".',"This must be related to one of the gears in the clock tower.","Well, bottoms up, I suppose!"],conditions:{hasItem:P.Potion},onCompleted:e=>{e.journal.addEntry(j.ExtraPotionInformation),e.inventory.removeItem(P.Potion),e.scene.time.delayedCall(3500,(()=>{e.message.setDialog({messages:["I feel... different.","I should retrace my steps to see if there is anything new in the area."]})}))}},{messages:["With the alchemy set fixed, I should be able to recreate the experiment.","I will need to find three ingredients according to this - Crimson Starbloom, Green Writhewood, and a Blue Plumed Frond.","Maybe I can find them in the lab or the forest. The villagers should know more."],conditions:{journalEntry:j.AlchemySetFixed},onCompleted:e=>{e.quests.addQuest({id:I.FindPotionIngredients,completed:!1}),e.gameState.updateData({mazeSolved:!1,mazeSeed:e.gameState.data.mazeSeed+1,sphinxMoved:!1})}},{messages:["Maybe I can find more information in the lab."],conditions:{activeQuest:I.ExploreLab}},{messages:["This lab journal contains notes about an ancient alchemy experiement.","According to the notes, the experiment was a failure, and the alchemist disappeared.","It does say that there might have been a problem with one of the ingredients.","Maybe I can find more information in the lab."],onCompleted:e=>{e.quests.addQuest({id:I.ExploreLab,completed:!1})}}],[O.AlchemySet]:[{messages:["There’s nothing more that I can do here."],conditions:{hasItem:P.Potion}},{messages:["Now we have all of the ingredients.","Now I should be able to recreate the experiment.","According to the book..."],conditions:{hasUsedItem:P.HerbBlue},onCompleted:(e,t)=>{!function(e,t){const i=e.scene;e.inventory.removeItem(P.HerbBlue),e.setActive(!1),ee(i,500,(()=>{i.time.delayedCall(700,(()=>{var s;null==t||t.setTexture("alchemy_full"),null==(s=null==t?void 0:t.particles)||s.setConfig({...pe[O.AlchemySet].particles,tint:[6684791],x:30,delay:200,stopAfter:120}).start(),Z(i,1500,(()=>{e.message.setDialog({messages:["I have created the potion mentioned in the old journal.","I should bring it to the mysterious stranger to see if they know how to use it."],onCompleted:(e,t)=>{e.inventory.addItem({type:P.Potion,used:!1}),e.quests.updateExistingQuest(I.ExploreLab,!0),null==t||t.setTexture("alchemy_empty"),e.setActive(!0)}},t,"player_portrait")}))}))}))}(e,t)}},{messages:["The Blue Plumed Frond is last."],conditions:{hasItem:P.HerbBlue,hasUsedItem:P.HerbRed},onCompleted:(e,t)=>{Fr(e,t,P.HerbBlue),e.quests.updateExistingQuest(I.FindPotionIngredients,!0)}},{messages:["The Crimson Starbloom comes next."],conditions:{hasItem:P.HerbRed,hasUsedItem:P.HerbGreen},onCompleted:(e,t)=>Fr(e,t,P.HerbRed)},{messages:["The Green Writhewood goes in first."],conditions:{hasItem:P.HerbGreen},onCompleted:(e,t)=>Fr(e,t,P.HerbGreen)},{messages:["Maybe the journal has more information about using this alchemy set."],conditions:{journalEntry:j.AlchemySetFixed}},{messages:["This alchemy set looks like the one in the journal.","If I can figure out how the set connects together, I might be able to recreate the experiment."],conditions:{activeQuest:I.ExploreLab},onCompleted:e=>{ie(e.scene,"PipesDialog")}},{messages:["A series of pipes and tubes. I shouldn’t touch this without knowing what it does."]}],[O.LabBookshelf1]:[{messages:['[Secrets of the Silver Transmutation]\n"Silver, the mirror of the soul, can be yielded from common materials. Begin with a lead base, cleanse it with the tears of a willow, and chant thrice under a new moon. Such processes, though fraught with danger, promise immense reward. Meticulous preparation of the material is crucial."','"Among these pages lie safeguards against volatile spirits and the precise lunar phases essential for success. Here are protective circles and counter-spells to be used should spirits prove malevolent. This knowledge has been passed down and refined for safety."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabBookshelf2]:[{messages:['[Whispering Woods: A Compendium]\n"The sentient trees of Eldergrove are not myths; their trunks groan with ancient wisdom. To engage them, perform the Ritual of Leaves, using moonlit water and rare herbs, along with whispered incantations passed down by forest guardians."','"Notes on the rare Blue Moonflower, whose petals glow ghostly and unlock forest languages, are also included. Its bloom is brief, and harvesting must be timed at midnight to retain its properties. The chapter concludes with a discussion on plant symbiosis with Eldertrees."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabBookshelf3]:[{messages:['[The Essence of Fire: Ignite and Control]\n"Mastering fire requires strength of will and profound respect for its power. Here, summoning circles and incantations to call forth fire spirits are detailed. Each summoning demands a tribute of phoenix ash. The endeavor is perilous, as spirits may lash out if provoked."','"The tome also discusses methods to quell flames should they rise against the summoner. Included are the chant of suppression and a dousing mixture from elemental waters and frost-bitten herbs. These countermeasures are vital for maintaining control over summoned entities."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabPotionShelf1]:[{messages:["Nightshade, wolfsbane, starvine, frost ferns... No, those are not the right ingedients.","Oh, a Crimson Starbloom! Yes, this should work!"],conditions:{activeQuest:I.FindPotionIngredients,custom:e=>!Se(e,P.HerbRed)},onCompleted(e){e.inventory.addItem({type:P.HerbRed,used:!1})}},{messages:['Hm, this is an interesting collection. What’s this "Elixir of Luminescence"? Could light up some dark corners. And "Brew of Bravery"... might make me bold enough to face a dragon, or foolish enough to try. What about "Draught of the Depths"—sounds like it could show me treasures or drown me in visions. Better not risk it; these might just burn me to a crisp!'],conditions:{activeQuest:I.ExploreLab}}],[O.MansionPicture]:[{messages:[],conditions:{hasItem:P.Gear2}},{messages:["A sturdy looking safe was hidden behind the picture.","There are large rusty rings to the side, as if it they were meant to be moved."],conditions:{journalEntry:j.SafeDiscovered},onCompleted:e=>{ie(e.scene,"TumblerDialog")}},{messages:["An abstract picture of blocks.","Wait a moment, something is behind this picture","[CREAK]"],onCompleted:e=>{e.journal.addEntry(j.SafeDiscovered)},conditions:{hasUsedItem:P.Potion}},{messages:["An abstract picture of blocks."]}],[O.MansionHole]:[{messages:["Literally a hole in the wall.","Huh, there is something here. It's a key!"],conditions:{hasItem:P.Key,invert:!0},onCompleted:e=>{e.inventory.addItem({type:P.Key,used:!1})}},{messages:["Literally a hole in the wall."]}]};function Er(e,t,i){for(const s of e){const{conditions:e}=s,n=[];if(void 0!==(null==e?void 0:e.hasItem)&&n.push(Se(t,e.hasItem)),void 0!==(null==e?void 0:e.hasUnusedItem)&&n.push(ke(t,e.hasUnusedItem)),void 0!==(null==e?void 0:e.hasUsedItem)&&n.push(Pe(t,e.hasUsedItem)),void 0!==(null==e?void 0:e.completedQuest)&&n.push(Te(t,e.completedQuest)),void 0!==(null==e?void 0:e.activeQuest)&&n.push(Ie(t,e.activeQuest)),void 0!==(null==e?void 0:e.journalEntry)&&n.push(Ce(t,e.journalEntry)),(null==e?void 0:e.custom)&&n.push(e.custom(t,i)),null==e?void 0:e.invert){if(null==e?void 0:e.or){if(n.some((e=>!e)))return s}else if(n.every((e=>!e)))return s;return}if(null==e?void 0:e.or){if(n.some((e=>e)))return s}else if(n.every((e=>e)))return s}}class Mr extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:r,image:o}=Nn[i];super(e,n,r,o),t(this,"itemType"),t(this,"player"),t(this,"particles"),t(this,"light"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`Item-${i}`,this.itemType=i,this.player=s,this.setScale(.35).setDepth(x.Items),ze(this,Nn[i])}lazyInit(e){(e||!this.initialized&&te(this,this.player))&&(Se(this.player,this.itemType)?this.destroy():(this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0}),this.particles=this.scene.add.particles(this.x,this.y,"warp",{scale:{start:0,end:.9},alpha:{start:.7,end:0},delay:500,lifespan:1500,maxAliveParticles:1}).setDepth(x.Items).setName(`Item-${this.itemType}-Particles`),w.debug?this.light=new ae(this.scene,this.x,this.y,this.displayHeight/150*150,16764074,2):this.light=this.scene.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,2),this.initialized=!0))}onInteract(e){return e[ce.Continue]?(this.scene.time.delayedCall(0,(()=>{this.player.inventory.addItem({type:this.itemType,used:!1});const e=Er(Or[this.itemType]||[],this.player,this);e&&(null==e?void 0:e.messages.length)>0&&this.player.message.setDialog(e,this,"player_portrait")})),this.destroy(),S.Item):S.None}destroy(e){var t,i,s;null==(t=this.particles)||t.destroy(),this.light instanceof ae?this.light.destroy():null==(s=null==(i=this.scene)?void 0:i.lights)||s.removeLight(this.light),super.destroy(e)}getButtonPrompt(){return[`Pick Up ${Nn[this.itemType].name}`,"Press [CONTINUE]"]}update(){var e,t;this.lazyInit(),null==(e=this.particles)||e.setPosition(this.x,this.y),null==(t=this.light)||t.setPosition(this.x,this.y)}}function zr(e,t,i){var s,n;const r=Ae(e,T.Sphinx);if(!r)return void console.error("Sphinx not found");const o=function(e,t){return je(e,a.GameObjects.Rectangle).find((e=>e.getData("WallType")===t))}(e,C.Sphinx);if(o){const e=(null==(s=Kn.find((e=>e.id===C.Sphinx)))?void 0:s.x)||0;t?o.setX(e||0):o.setX(e-150),null==(n=o.body)||n.updateFromGameObject()}Oe(e,k.ForestEast,t||!1);const{x:l,y:h}=E[T.Sphinx],c=t?l+200:l,d=t?h-90:h;e.tweens.add({targets:r,alpha:0,duration:!t||i?0:300,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{r.setPosition(c,d)},onComplete:()=>{r.alpha=1,r.disabled=t||!1}}),e.tweens.add({targets:r.light,x:c,y:d,duration:!t||i?0:450,ease:"Power1"})}const Dr={[P.HerbRed]:{texture:"alchemy_red",tint:11141120,x:-20},[P.HerbGreen]:{texture:"alchemy_green",tint:43520,x:-35},[P.HerbBlue]:{texture:"alchemy_blue",tint:170,x:-5}};function Fr(e,t,i){e.inventory.removeItem(i),e.setActive(!1),t&&t.particles&&(Lr(e),t.disabled=!0,t.particles.setConfig({...pe[O.AlchemySet].particles,tint:Dr[i].tint,x:Dr[i].x}).start().on("complete",(()=>{t.disabled=!1,e.setActive(!0)})))}function Lr(e){const t=Me(e.scene,O.AlchemySet);t&&(t.setTexture("alchemy_empty"),Pe(e,P.HerbBlue)?t.setTexture(Dr[P.HerbBlue].texture):Pe(e,P.HerbRed)?t.setTexture(Dr[P.HerbRed].texture):Pe(e,P.HerbGreen)&&t.setTexture(Dr[P.HerbGreen].texture))}const Br={mazeSolved:!1,mazeSeed:0,sphinxFail:!1,sphinxMoved:!1};class Gr{constructor(e,i){t(this,"scene"),t(this,"player"),t(this,"data"),this.scene=e,this.player=i,this.data={...Br}}updateData(e,t){this.data={...this.data,...e},Object.entries(e).forEach((([e,i])=>{this.handleSideEffects(e,i,t)}))}handleSideEffects(e,t,i){"sphinxMoved"===e&&zr(this.scene,t,i)}}const Rr="chrono-sleuth-save";var Wr=(e=>(e[e.New=0]="New",e[e.Act1=1]="Act1",e[e.Act2=2]="Act2",e[e.LabItems=3]="LabItems",e[e.Act3=4]="Act3",e))(Wr||{});const Nr={player:{x:Vn.x,y:Vn.y,flip:!1},journal:[],inventory:[],quests:[],gameState:{...Br},settings:{gamepad:[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some((e=>navigator.userAgent.match(e))),debug:!1,zoomed:!0,useShader:!0,time:Date.now(),muted:!0}},_r={...Nr.settings,gamepad:!1},Hr={0:Nr,1:{player:{x:Vn.x,y:Vn.y,flip:!1},journal:[j.FixTheClock],inventory:[{type:P.Wrench,used:!1},{type:P.Gear1,used:!1}],quests:[{id:I.ForestGear,completed:!1},{id:I.SphinxRiddle,completed:!0}],gameState:{...Br,mazeSolved:!0,sphinxMoved:!0},settings:{..._r}},2:{player:{x:-770,y:Vn.y,flip:!0},journal:[j.FixTheClock,j.MetTheMayor,j.ClockFirstGear],inventory:[{type:P.Wrench,used:!1},{type:P.Gear1,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!1}],gameState:{...Br,mazeSolved:!0,sphinxMoved:!0},settings:{..._r}},3:{player:{x:-1500,y:1729,flip:!0},journal:[j.FixTheClock,j.MetTheMayor,j.ClockFirstGear,j.AlchemyLabFound,j.AlchemySetFixed],inventory:[{type:P.Wrench,used:!1},{type:P.Gear1,used:!0},{type:P.Key,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!1},{id:I.ExploreLab,completed:!1},{id:I.FindPotionIngredients,completed:!1}],gameState:{...Br},settings:{..._r}},4:{player:{x:5073.875,y:915,flip:!1},journal:[j.FixTheClock,j.MetTheMayor,j.ClockFirstGear,j.AlchemyLabFound,j.AlchemySetFixed,j.SafeDiscovered,j.ExtraPotionInformation,j.ClockSecondGear],inventory:[{type:P.Wrench,used:!1},{type:P.Gear1,used:!0},{type:P.Key,used:!0},{type:P.HerbRed,used:!0},{type:P.HerbGreen,used:!0},{type:P.HerbBlue,used:!0},{type:P.Potion,used:!0},{type:P.Gear2,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!0},{id:I.ExploreLab,completed:!0},{id:I.FindPotionIngredients,completed:!0}],gameState:{...Br,mazeSolved:!0,sphinxMoved:!0},settings:{..._r}}};class Ur extends a.Scene{constructor(){super({key:"Boot",pack:{files:[{type:"image",key:"splash",url:"assets/splash.jpg"}]}})}init(){this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height)}preload(){this.load.setPath("assets"),this.load.image("logo","logo.jpg"),this.load.font("m6x11","../m6x11.ttf","truetype"),this.load.bitmapFont("m6x11-24","fonts/m6x11-24.png","fonts/m6x11-24.xml"),this.load.svg("maximize","icons/maximize.svg",{width:64,height:64}),this.load.svg("minimize","icons/minimize.svg",{width:64,height:64}),this.load.svg("settings","icons/settings.svg",{width:64,height:64}),this.load.json("build",`../build.json?cacheBust=${Date.now()}`),w.phaserInspector&&(this.load.scripts("inspector",["https://cdn.jsdelivr.net/npm/tweakpane@3.1.10/dist/tweakpane.js","https://cdn.jsdelivr.net/npm/phaser-plugin-inspector@2.5.0/dist/phaser-plugin-inspector.umd.js"]),this.load.once("complete",(()=>{PhaserPluginInspector.Install(this.plugins)})))}create(){var e;try{const t=null==(e=this.cache.json.get("build"))?void 0:e.buildTime;if(t&&"2025-01-02T07:08:10.085Z"!==t)return this.add.text(w.width/2,w.height/2,"New version available!\nUpdating Game...",{...an,align:"center",fontSize:48}).setOrigin(.5).postFX.addGlow(0,10),void setTimeout((()=>window.location.reload()),15e3)}catch(t){console.error(t)}w.prod&&localStorage.getItem(Rr)?this.scene.start("MainMenu"):this.scene.start("Preloader")}}function $r(e){e.load.setPath("assets"),e.load.image("train","maps/intro/train.png"),e.load.image("layer2","maps/intro/layer2.png"),e.load.image("layer3","maps/intro/layer3.png"),e.load.image("layer4","maps/intro/layer4.png"),e.load.image("layer5","maps/intro/layer5.png"),e.load.spritesheet("character","characters/player.png",{frameWidth:128,frameHeight:80}),e.load.image("player_portrait","characters/player_portrait.png"),e.load.svg("chevron-down","icons/chevron-down.svg",{width:64,height:64})}class Vr extends a.Scene{constructor(){super("Intro"),t(this,"player"),t(this,"playerProgess",0),t(this,"direction",1),t(this,"pauseDuration",0)}preload(){$r(this)}init(){var e,t;this.sound.mute=Hr[Wr.New].settings.muted,w.prod||(null==(e=this.input.keyboard)||e.on("keydown-BACK_SLASH",(()=>{ee(this,500,(()=>{this.textures.exists("warp")?this.scene.start("Game"):this.scene.start("Preloader")}))})),null==(t=this.input.keyboard)||t.on("keydown-R",(()=>{this.scene.restart()})))}create(){var e;const t=w.zoomed?.75:1;Z(this,350),this.add.image(w.width,w.height,"layer5").setScale(5*t);const i=this.add.image(0,w.height,"layer4").setScale(5*t),s=this.add.image(0,w.height,"layer4").setScale(5*t),n=this.add.image(0,350*t,"layer3").setScale(2*t),r=this.add.image(0,.7*w.height,"layer2").setScale(5*t),o=w.width;this.tweens.add({targets:[i],x:{from:2.5*-o,to:0},duration:12e4,repeat:-1}),this.tweens.add({targets:[s],x:{from:0,to:2.5*o},duration:12e4,repeat:-1}),this.tweens.add({targets:n,x:{from:2*-o,to:2.75*o},duration:6e4,hold:9e4,repeat:-1}),this.tweens.add({targets:[r],x:{from:-o,to:1.5*o},duration:15e3,hold:45e3,repeat:-1});const a=this.add.container(0,w.zoomed?-35:0);this.player=this.add.sprite(560*t,w.height-250*t,"character",0).setScale(2.5*t),this.player.anims.create({key:"walk",frames:this.player.anims.generateFrameNumbers("character",{start:0,end:5}),frameRate:5,repeat:-1}),this.player.anims.play("walk"),this.player.anims.pause(),a.add(this.player),this.cameras.main.startFollow(this.player,!0,.1,.1,0,120);const l=this.add.image(w.width/2,w.height/2,"train").setScale(2*t);a.add(l),this.tweens.add({targets:a,x:a.x+1,y:a.y+5,duration:300,hold:300,ease:"Bounce",repeat:-1}),null==(e=this.add.rectangle(-w.width/2,w.height-(w.zoomed?60:35),2*w.width,35,4472896).setOrigin(0).postFX)||e.addShadow(0,0,.5,1),function(e,t){const i=w.zoomed?.75:1,s=new Wn(e);t.setAngle(5);const n=e.add.timeline([{at:1500,tween:{targets:t,x:850*i,duration:2500,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume()},{at:6e3,run:()=>{ee(e,500,(()=>{e.textures.exists("warp")?e.scene.start("Game"):e.scene.start("Preloader")}))}}]),r=e.add.timeline([{at:1500,tween:{targets:t,x:1200*i,duration:2500,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume()},{at:5500,run:()=>{t.setFlipX(!0),t.setAngle(-5)}},{at:6500,run:()=>{s.setDialog({messages:["No doubt about it, this will be a strange journey.","Whatever awaits me in this town, it’s certain that nothing will ever be the same again."],onCompleted:()=>n.play()},void 0,"player_portrait")}}]);e.add.timeline([{at:2500,tween:{targets:t,x:850*i,duration:3e3,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume()},{at:7e3,run:()=>{t.setFlipX(!0),t.setAngle(-5)}},{at:8e3,run:()=>{t.setFlipX(!1),t.setAngle(5)}},{at:9e3,run:()=>{s.setDialog({messages:["What a beautiful mountain-scape. I almost forgot where I am headed.","It’s been three days since the letter arrived... It has been many years since I last visited that sleepy old town.","Rumors swirl of strange occurrences. People disappearing, clocks that never strike the hour, and a darkness that lingers beneath the surface."],onCompleted:()=>r.play()},void 0,"player_portrait")}}]).play()}(this,this.player)}}class qr extends er{constructor(e,t,i){super(e,t,i,e.scale.isFullscreen?"minimize":"maximize",(()=>{e.scale.isFullscreen?e.scale.stopFullscreen():e.scale.startFullscreen()})),e.scale.on(Phaser.Scale.Events.ENTER_FULLSCREEN,(()=>{this.img.scene=e,this.img.setTexture("minimize")})),e.scale.on(Phaser.Scale.Events.LEAVE_FULLSCREEN,(()=>{this.img.scene=e,this.img.setTexture("maximize")}))}}class Xr extends a.Scene{constructor(){super("MainMenu")}create(){this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height);const e=this.add.container(0,0);e.setAlpha(0),this.tweens.add({targets:e,alpha:1,duration:150}),e.add(this.add.image(35,w.height-30,"logo").setOrigin(0,1).setScale(.4)),new Zn(this,!0).setVisible(!1);const t=new Gn(this);e.add(t);const i=new qr(this,w.width-30,30);t.addButton(i),localStorage.getItem(Rr)&&t.addButton(new Ln(this,w.width-120,w.height-145,"Continue",(()=>this.scene.start("Preloader")),{align:"center"}).setFixedSize(200,70)),t.addButton(new Ln(this,w.width-120,w.height-60,"New Game",(()=>{localStorage.removeItem(Rr),this.scene.start("Preloader")}),{align:"center"}).setFixedSize(200,70)),t.setActiveButton(1)}}class Kr extends a.Scene{constructor(){super("Preloader"),t(this,"container")}init(){this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height),this.add.image(35,w.height-30,"logo").setOrigin(0,1).setScale(.4);const e=.66*w.width,t=.05*w.height,i=this.add.container(.24*w.width,.86*w.height);this.container=i;const s=this.add.rectangle(0,0,e,t).setStrokeStyle(1,16777215,.85).setOrigin(0);i.add(s);const n=this.add.rectangle(3,3,0,t-6,16777215,.85).setOrigin(0);i.add(n),this.load.on("progress",(t=>{const i=w.prod?.6*t:t;n.width=(e-6)*i})),w.prod&&this.load.on("complete",(()=>{this.tweens.add({targets:n,width:e-6,duration:2e3})}));const r=this.add.image(w.width-50,w.height-60,"settings").setScale(.75);this.tweens.add({targets:r,angle:360,duration:2e3,delay:100,repeat:-1})}preload(){this.load.setPath("assets"),this.load.svg("sun","icons/sun.svg",{width:64,height:64}),this.load.svg("moon","icons/moon.svg",{width:64,height:64}),this.load.svg("zoom-in","icons/zoom-in.svg",{width:64,height:64}),this.load.svg("zoom-out","icons/zoom-out.svg",{width:64,height:64}),this.load.svg("terminal","icons/terminal.svg",{width:64,height:64}),this.load.svg("award","icons/award.svg",{width:64,height:64}),this.load.svg("tv","icons/tv.svg",{width:64,height:64}),this.load.svg("save","icons/save.svg",{width:64,height:64}),this.load.svg("chevron-down","icons/chevron-down.svg",{width:64,height:64}),this.load.svg("volume","icons/volume-2.svg",{width:64,height:64}),this.load.svg("volume-mute","icons/volume-x.svg",{width:64,height:64}),this.load.svg("gamepad","icons/gamepad-solid.svg",{width:64,height:64}),this.load.image("town","maps/town.jpg"),this.load.image("clock_outside","maps/clock_outside.jpg"),this.load.image("clock_inner","maps/clock_inner.jpg"),this.load.image("forest","maps/forest.jpg"),this.load.image("lake","maps/lake.jpg"),this.load.image("mansion_outside","maps/mansion_outside_hatch.jpg"),this.load.image("mansion_inside","maps/mansion_inside.jpg"),this.load.image("alchemy_lab","maps/alchemy_lab.jpg"),this.load.image("library","maps/library.jpg"),this.load.image("watch","items/watch.png"),this.load.image("ladder","props/ladder.png"),this.load.image("warp","props/warp.png"),this.load.spritesheet("portal","props/portal.png",{frameWidth:140,frameHeight:120}),this.load.image("gear","items/gear.png"),this.load.image("gear2","items/gear2.png"),this.load.image("journal","items/journal.png"),this.load.image("wrench","items/wrench.png"),this.load.image("key","items/key.png"),this.load.image("herb_red","items/herb_red.png"),this.load.image("herb_green","items/herb_green.png"),this.load.image("herb_blue","items/herb_blue.png"),this.load.image("potion","items/potion.png"),this.load.spritesheet("character","characters/player.png",{frameWidth:128,frameHeight:80}),this.load.image("player_portrait","characters/player_portrait.png"),this.load.image("inventor","characters/inventor.png"),this.load.image("inventor_portrait","characters/inventor_portrait.png"),this.load.image("stranger","characters/stranger.png"),this.load.image("stranger_portrait","characters/stranger_portrait.png"),this.load.image("sphinx","characters/sphinx.png"),this.load.image("sphinx_portrait","characters/sphinx_portrait.png"),this.load.image("mayor","characters/mayor.png"),this.load.image("mayor_portrait","characters/mayor_portrait.png"),this.load.image("clock_portrait","characters/clock_portrait.png"),this.load.image("chest","props/chest.png"),this.load.image("chest_open","props/chest_open.png"),this.load.image("book","props/book.png"),this.load.image("picture","props/picture.png"),this.load.image("safe","props/safe.png"),this.load.image("alchemy_empty","props/alchemy/alchemy_empty.png"),this.load.image("alchemy_green","props/alchemy/alchemy_green.png"),this.load.image("alchemy_red","props/alchemy/alchemy_red.png"),this.load.image("alchemy_blue","props/alchemy/alchemy_blue.png"),this.load.image("alchemy_full","props/alchemy/alchemy_full.png"),this.load.image("arrow","puzzles/arrow.png"),Array.from({length:26},((e,t)=>String.fromCharCode(97+t))).forEach((e=>this.load.audio(e,`sounds/words/${e}.mp3`))),this.load.audio("warp","sounds/warp.mp3"),this.load.audio("ladder","sounds/ladder.mp3"),this.load.audio("door","sounds/door.mp3"),localStorage.getItem(Rr)||$r(this)}create(){this.time.delayedCall(w.prod?2500:0,(()=>{ee(this,300,(()=>{localStorage.getItem(Rr)?this.scene.start("Game"):this.scene.start("Intro")}))}))}}class Yr extends a.GameObjects.Container{constructor(e,i,s){var n,r,o,l,h;super(e,i,s),t(this,"buttons",[]),t(this,"activeIndex",new a.Math.Vector2),t(this,"cursor"),e.add.existing(this).setScrollFactor(0),this.activeIndex.set(-1,-1),null==(n=e.input.keyboard)||n.on("keydown-UP",(()=>{this.setActiveButton({x:0,y:-1})})),null==(r=e.input.keyboard)||r.on("keydown-DOWN",(()=>{this.setActiveButton({x:0,y:1})})),null==(o=e.input.keyboard)||o.on("keydown-LEFT",(()=>{this.setActiveButton({x:-1,y:0})})),null==(l=e.input.keyboard)||l.on("keydown-RIGHT",(()=>{this.setActiveButton({x:1,y:0})})),null==(h=e.input.keyboard)||h.on("keydown-ENTER",(()=>{const e=this.getActiveButton();e&&e.onClick(e)})),e.input.on("pointermove",(()=>{this.cursor.setVisible(!1)}))}setButtons(e){this.buttons=e,this.activeIndex.set(-1,-1),this.removeAll(!0),this.cursor=this.scene.add.rectangle(0,0,60,80).setStrokeStyle(2,_(z),.75).setVisible(!1).setDepth(1),this.add(this.cursor);for(const t of e)for(const e of t)void 0!==e&&this.add(e)}getActiveButton(){var e;return null==(e=this.buttons[this.activeIndex.y])?void 0:e[this.activeIndex.x]}setActiveButton(e){var t,i,s,n,r,o,l;let{x:h,y:c}=this.activeIndex;if(!1===this.cursor.visible){const e=null==(t=this.buttons[c])?void 0:t[h];return void(e&&(this.updateButtonSize(e),this.cursor.setPosition(e.x,e.y).setVisible(!0),this.cursor.setVisible(!0)))}const d=this.buttons.length;if(c=a.Math.Clamp(c,0,d-1),h=a.Math.Clamp(h,0,((null==(i=this.buttons[c])?void 0:i.length)||0)-1),0===e.x){let t;if(-1!==this.activeIndex.y){for(;c>=0&&c=0&&h<(null==(r=this.buttons[c])?void 0:r.length)&&void 0===t;)h+=e.x,t=null==(o=this.buttons[c])?void 0:o[h];if(!t)return}const u=null==(l=this.buttons[c])?void 0:l[h];u&&(this.updateButtonSize(u),this.cursor.setPosition(u.x,u.y).setVisible(!0),this.activeIndex.set(h,c))}updateButtonSize(e){const t=1.2;e instanceof Ln&&this.cursor.setSize(e.displayWidth*t,e.displayHeight*t),e instanceof er&&this.cursor.setSize(e.rect.displayWidth*t,e.rect.displayHeight*t)}}const Qr=[[1,1,1,0,1],[1,0,1,0,1],[1,1,1,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1]],Jr=[["0","1","2"],["3"," ","4"],["5","6","7"]];class Zr extends a.Scene{constructor(){super("UITest"),t(this,"selected"),t(this,"cursor"),t(this,"grid"),this.selected=void 0}create(){var e;const t=[];for(let i=0;i{t[0][0].text="0",t[0][1].text="1",t[0][2].text="2",t[1][0].text="3",t[1][2].text="4",t[2][0].text="5",t[2][1].text="6",t[0][4].text=" ",t[1][4].text=" ",t[2][4].text=" ",t[3][4].text=" ",t[4][4].text=" ",t[5][4].text=" ",t[6][4].text=" "}))}btn(e,t){return new Ln(this,50+60*e,50+85*t,e<3?" ":t.toString(),(e=>this.selectButton(e)))}selectButton(e){if(void 0===this.selected)this.selected=e,e.setSelected(!0);else{const t=this.selected.text;this.selected.setSelected(!1),this.selected.text=e.text,e.text=t,this.selected=void 0,this.checkValid()&&console.log("You Won!")}}checkValid(){var e;let t=!0;for(let i=0;i{const s=this.textObject.getWrappedText().length,n=i/this.textObject.height,r=Math.floor(n*s);o&&o(r)})),null==(l=e.input.keyboard)||l.on("keydown-UP",(()=>{this.scrollY-=30,this.updateTextPosition()})),null==(h=e.input.keyboard)||h.on("keydown-DOWN",(()=>{this.scrollY+=30,this.updateTextPosition()})),this.maskGraphics=e.add.graphics().setPosition(i,s).setScrollFactor(0).setVisible(!1),this.add(this.maskGraphics),this.scrollbar=e.add.rectangle(0,0,4,0,5592405).setScrollFactor(0),this.add(this.scrollbar)}setBoxSize(e,t){this.boxHeight=t,this.maskGraphics.clear(),this.maskGraphics.fillStyle(16777215),this.maskGraphics.fillRect(0,0,e,t);const i=this.maskGraphics.createGeometryMask();return this.textObject.setMask(i),this.textObject.setWordWrapWidth(e-8),this.textObject.setFixedSize(e-8,0),this.updateTextPosition(),this}setText(e){return this.textObject.setText(e),this.updateTextPosition(),this}handleDrag(e){e.isDown&&(this.scrollY-=e.velocity.y,this.updateTextPosition())}handleScroll(e,t,i,s,n){this.scrollY+=.5*s,this.updateTextPosition()}updateTextPosition(){const e=Math.max(0,this.textObject.height-this.boxHeight);this.scrollY=a.Math.Clamp(this.scrollY,0,e),this.textObject.y=-this.scrollY;const t=this.scrollY/e,i=this.boxHeight/this.textObject.height;this.scrollbar.height=i*this.boxHeight,this.scrollbar.setPosition(this.textObject.width+4,t*(this.boxHeight-i*this.boxHeight))}}class to extends a.Scene{constructor(e){super(e.key),t(this,"dialogData"),t(this,"container"),t(this,"keys"),t(this,"title"),t(this,"additionalUI"),t(this,"closing"),this.dialogData=e}create(){var e,t,i;this.additionalUI=[],this.closing=!1,this.container=this.add.container(w.width/2,w.height/2),this.container.add(this.add.rectangle(0,0,.95*w.width,.95*w.height,0,.75).setStrokeStyle(4,_(z))),this.container.add(new Ln(this,.44*w.width,-.4*w.height,"X",(()=>this.close(!1)),{backgroundColor:`#${L}`})),w.prod||this.dialogData.hideCloseSuccess||this.container.add(new er(this,.38*w.width,-.4*w.height,"award",(()=>this.startClose(!0)))),this.title=this.add.text(0,-.4*w.height,this.dialogData.title,{...an,fontSize:48}).setOrigin(.5),this.container.add(this.title),null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>{this.startClose(!1)})),null==(t=this.input.keyboard)||t.on("keydown-BACKSPACE",(()=>{this.startClose(!1)})),w.prod||null==(i=this.input.keyboard)||i.on("keydown-BACK_SLASH",(()=>{this.startClose(!0)})),this.keys=new de(this),new Zn(this,!0).setVisible(this.dialogData.gamepadVisible),this.container.setAlpha(0),this.dialogData.childScene?(this.scene.launch(this.dialogData.childScene,{parent:this}),this.scene.get(this.dialogData.childScene).events.on("create",(()=>this.fadeIn()))):this.fadeIn()}fadeIn(){this.tweens.add({targets:this.getTargets(),alpha:{start:0,to:1},delay:100,duration:500})}fadeOut(e){this.tweens.add({targets:this.getTargets(),alpha:{start:1,to:0},duration:250,hold:250,onComplete:e})}addTarget(e){e.setAlpha(0),this.additionalUI.push(e)}getTargets(){return[this.container,...this.additionalUI]}startClose(e){this.closing||(this.closing=!0,this.close(e))}close(e){this.fadeOut((()=>{var t,i,s,n;this.scene.stop(),this.dialogData.childScene&&this.scene.stop(this.dialogData.childScene),this.scene.resume("Game"),null==(i=null==(t=this.scene.get("Game"))?void 0:t.gamepad)||i.setAlpha(1),null==(n=null==(s=this.scene.get("Game"))?void 0:s.gamepad)||n.resetButtons(),this.handleSuccess(e)}))}}const io="chrono-sleuth-debug-tab";function so(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function no(e){for(var t=1;tt+e)):Array.from(Array(e).keys())}function lo(e){return[...new Set(e)]}function ho(e,t){const i=lo(e.map((e=>e.set))).filter(Boolean),s=(n=ao(1,e.length+1),r=i,[n,r].reduce(((e,t)=>e.filter((e=>!t.includes(e)))))).sort((()=>.5-t()));var n,r;e.filter((e=>!e.set)).forEach(((e,t)=>e.set=s[t]))}function co(e,t,i=.5){oo(e).forEach(((s,n)=>{const r=e[n+1],o=s.set!==r.set,a=t()<=i;var l,h,c;o&&a&&(l=e,h=r.set,c=s.set,l.forEach((e=>{e.set===h&&(e.set=c)})),s.right=!1,r.left=!1)}))}const uo=48;class po extends a.Scene{constructor(){super("Maze"),t(this,"parent"),t(this,"graphics"),t(this,"keys"),t(this,"maze"),t(this,"mazePlayer"),t(this,"nextUpdate")}init(e){this.parent=e.parent}create(){this.createMaze(),this.mazePlayer=this.add.ellipse(0,0,.8*uo,.8*uo,5601177).setSmoothness(32).setOrigin(-.13),this.cameras.main.startFollow(this.mazePlayer),this.keys=this.parent.keys,this.parent.addTarget(this.graphics),this.parent.addTarget(this.mazePlayer)}getMazeSeed(){return this.parent.player.gameState.data.mazeSeed||0}createMaze(){const e=this.getMazeSeed();this.maze=function(e=8,t=e,i=!0,s=1){const n=function(e){return function(){let t=e+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}(s),r=[],o=ao(e);for(let h=0;h({x:s,y:h,top:i||h>0,left:i||s>0,bottom:i||h{ho(e,n),co(e,n),function(e,t,i){const s=Object.values(function(e){let t=lo(e.map((e=>e.set))).reduce(((e,t)=>no(no({},e),{},{[t]:[]})),{});return e.forEach((e=>t[e.set].push(e))),t}(e)),{ceil:n}=Math;s.forEach((e=>{(function(e,t,i){t=null==t?1:t;const s=null==e?0:e.length;if(!s||t<1)return[];t=t>s?s:t;let n=-1;const r=s-1,o=[...e];for(;++n{if(e){const i=t[e.x];e.bottom=!1,i.top=!1,i.set=e.set}}))}))}(e,r[t+1],n)}));const a=(l=r)[l.length-1];var l;return ho(a,n),co(a,n,1),r}(24,24,!0,e),this.graphics=this.add.graphics(),this.graphics.fillStyle(10040098,.5),this.graphics.fillRect(1104,1104,uo,uo),this.graphics.lineStyle(3,3385907),this.maze.forEach((e=>{e.forEach((e=>{if(e.top){const t=new a.Geom.Line(e.x*uo,e.y*uo,e.x*uo+uo,e.y*uo);this.graphics.strokeLineShape(t)}if(e.bottom){const t=new a.Geom.Line(e.x*uo,e.y*uo+uo,e.x*uo+uo,e.y*uo+uo);this.graphics.strokeLineShape(t)}if(e.left){const t=new a.Geom.Line(e.x*uo,e.y*uo,e.x*uo,e.y*uo+uo);this.graphics.strokeLineShape(t)}if(e.right){const t=new a.Geom.Line(e.x*uo+uo,e.y*uo,e.x*uo+uo,e.y*uo+uo);this.graphics.strokeLineShape(t)}}))})),this.cameras.main.setViewport(50,130,w.width-100,w.height-170)}update(e,t){if(e=24||n>=24)return!1;const r=a.Math.FloorTo(this.mazePlayer.x/uo),o=a.Math.FloorTo(this.mazePlayer.y/uo),l=this.maze[o][r];return!(l.top&&ithis.mazePlayer.y||l.left&&tthis.mazePlayer.x)}}class yo extends a.GameObjects.Rectangle{constructor(e,i,s){super(e,0,0,i.size,i.size),t(this,"keys"),t(this,"cursorData"),t(this,"nextUpdate",0),t(this,"position",new a.Math.Vector2(-1,-1)),e.add.group(this,{runChildUpdate:!0}),this.setStrokeStyle(2,_(z),.75),this.setVisible(!1),this.cursorData=i,this.keys=s,e.input.on("pointerdown",(e=>{this.setVisible(!1)}))}update(e,t){var i;if(ethis.resume()))),this.container.add(this.add.text(t/2,w.height/2-100,"Game Paused",{...an,fontSize:72}).setOrigin(.5)),this.debugCount=0,this.container.add(this.add.text(t-20,i-20,`Build Time: ${new Date("2025-01-02T07:08:10.085Z").toLocaleString()}\n${w.prod?"":"Debug Mode"}`,{...an,fontSize:16,align:"right",padding:{x:20,y:20}}).setOrigin(1,1).setInteractive({useHandCursor:!1}).on("pointerdown",(()=>{this.debugCount++,this.debugCount>10&&(localStorage.setItem("chrono-sleuth-prod",w.prod?"false":"true"),window.location.reload())})));const s=w.zoomed?36:48,n=new Yr(this);this.container.add(n);const r=new er(this,w.width-210,30,"tv",(()=>{un()})),o=new er(this,w.width-150,30,"gamepad",(()=>{this.parent.gamepad.setVisible(!this.parent.gamepad.visible)})),a=new er(this,w.width-90,30,this.parent.sound.mute?"volume-mute":"volume",(()=>{const e=this.parent.sound.mute;this.parent.sound.mute=!e,a.setIcon(e?"volume":"volume-mute")})),l=new qr(this,w.width-30,30),h=new Ln(this,t/2,w.height/2,"Resume",(()=>this.resume()),{fontSize:s});let c;w.prod||(c=new er(this,30,30,"terminal",(()=>{this.resume(),this.parent.time.delayedCall(200,(()=>{ie(this.parent,"DebugTool")}))}))),n.setButtons([[c,r,o,a,l],[void 0,h,void 0,void 0,void 0],[void 0,void 0,void 0,void 0,void 0]]),n.activeIndex.set(1,1),null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>this.resume())),new Zn(this).setVisible(!1),this.tweens.add({targets:this.container,alpha:{start:0,to:1},duration:250})}resume(){this.tweens.add({targets:this.container,alpha:{start:1,to:0},duration:250,onComplete:()=>{this.scene.stop(),this.scene.resume("Game")}})}}class fo extends a.Scene{constructor(){super("Pipes"),t(this,"parent"),t(this,"keys"),t(this,"pipes",[]),t(this,"totalPipes",0),t(this,"images",[]),t(this,"container"),t(this,"blockSize"),t(this,"pipeSize"),t(this,"initialized",!1)}init(e){this.parent=e.parent,this.blockSize=w.zoomed?13:17,this.pipeSize=3.75*this.blockSize}preload(){this.prerenderPipes()}prerenderPipes(){for(const e of yr){const t=ir[e],i=`pipe_${e}`;this.textures.exists(i)&&this.textures.remove(i);const s=this.textures.createCanvas(i,3*this.blockSize,3*this.blockSize);if(s){const e=s.context;e.fillStyle="#ffffff";for(let i=0;i{const t=this.pipes[e.y+1][e.x+1];t.interactive&&(t.rotation=(t.rotation+90)%360,this.updatePipes())}},this.keys);this.container.add(t)}createPipes(){this.pipes=[],this.container=this.add.container().setPosition(w.width/2-16*this.pipeSize/2+this.pipeSize/2,w.height/4),this.totalPipes=0;for(let e=0;e<8;e++){this.pipes[e]||(this.pipes[e]=[]);for(let t=0;t<16;t++){let i=sr[e][t];const s=0===t||0===e||15===t||7===e,n=15===t&&7===e,r=!s;this.pipes[e][t]={x:t,y:e,type:i,rotation:s?0:90*a.Math.Between(0,3),interactive:r},i!==tr.Empty&&this.totalPipes++;const o=t+e*sr[0].length;this.time.delayedCall(50+5*o,(()=>{const s=`pipe_${i}`,o=this.add.image(t*this.pipeSize,e*this.pipeSize,s).on("pointerdown",(()=>{this.initialized&&(this.pipes[e][t].rotation=(this.pipes[e][t].rotation+90)%360,this.updatePipes())}));o.setAlpha(0).setScale(.5).setAngle(this.pipes[e][t].rotation),this.tweens.add({targets:o,alpha:1,scale:1,duration:300,onComplete:n?()=>{this.initialized=!0,this.updatePipes()}:void 0}),r?o.setInteractive():o.setTint(6710886),this.container.add(o),this.images.push(o)}))}}this.parent.addTarget(this.container)}updatePipes(){const e=function(e){const t=[],i=new Set,s=e.length,n=e[0].length;return function r(o,a){const l=`${o},${a}`;i.add(l),t.push(e[a][o]),o+1=0&&!i.has(`${o-1},${a}`)&&nr(e[a][o],e[a][o-1])&&r(o-1,a),a+1=0&&!i.has(`${o},${a-1}`)&&nr(e[a][o],e[a-1][o])&&r(o,a-1)}(0,2),t}(this.pipes);this.pipes.forEach((e=>{e.forEach((e=>{this.images[e.x+e.y*sr[0].length].setAngle(e.rotation)}))})),e.length===this.totalPipes&&this.parent.close(!0)}completed(e){const t=this.images.length,i=new a.Display.Color(255,255,255),s=U(_(D));for(let n=0;nr.setTint(e)),{duration:500,delay:10*n,hold:1e3,onComplete:n===t-1?e:void 0})}}}const mo=w.height/(w.zoomed?4:5.5),bo=[[1,0,1,1,0],[0,1,0,0,0],[0,0,1,0,1],[0,0,1,1,0],[1,1,0,0,1]],vo=2*Math.PI/16;!function(e={}){const{immediate:t=!1,onNeedRefresh:i,onOfflineReady:s,onRegistered:n,onRegisteredSW:r,onRegisterError:a}=e;let l,h;h=async function(){if("serviceWorker"in navigator){if(l=await function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){const e=document.getElementsByTagName("link"),n=document.querySelector("meta[property=csp-nonce]"),r=(null==n?void 0:n.nonce)||(null==n?void 0:n.getAttribute("nonce"));s=Promise.allSettled(t.map((t=>{if(t=function(e,t){return new URL(e,t).href}(t,i),t in o)return;o[t]=!0;const s=t.endsWith(".css"),n=s?'[rel="stylesheet"]':"";if(i)for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.href===t&&(!s||"stylesheet"===n.rel))return}else if(document.querySelector(`link[href="${t}"]${n}`))return;const a=document.createElement("link");return a.rel=s?"stylesheet":"modulepreload",s||(a.as="script"),a.crossOrigin="",a.href=t,r&&a.setAttribute("nonce",r),document.head.appendChild(a),s?new Promise(((e,i)=>{a.addEventListener("load",e),a.addEventListener("error",(()=>i(new Error(`Unable to preload CSS for ${t}`))))})):void 0})))}function n(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then((t=>{for(const e of t||[])"rejected"===e.status&&n(e.reason);return e().catch(n)}))}((async()=>{const{Workbox:e}=await import("./workbox-window.prod.es5-BXNXHyjv.js");return{Workbox:e}}),[],import.meta.url).then((({Workbox:e})=>new e("./sw.js",{scope:"./",type:"classic"}))).catch((e=>{null==a||a(e)})),!l)return;l.addEventListener("activated",(e=>{(e.isUpdate||e.isExternal)&&window.location.reload()})),l.addEventListener("installed",(e=>{e.isUpdate||null==s||s()})),l.register({immediate:t}).then((e=>{r?r("./sw.js",e):null==n||n(e)})).catch((e=>{null==a||a(e)}))}}()}({immediate:!0});const wo={type:Phaser.WEBGL,width:w.width,height:w.height,parent:"game-container",backgroundColor:_(W),scale:{mode:Phaser.Scale.FIT,autoCenter:w.prod?Phaser.Scale.CENTER_BOTH:Phaser.Scale.CENTER_HORIZONTALLY},loader:{imageLoadType:"HTMLImageElement"},scene:[Ur,Xr,Kr,Vr,Sr,go,class extends to{constructor(){super({key:"JournalDialog",title:"Journal",gamepadVisible:!1,hideCloseSuccess:!0}),t(this,"player")}init(e){this.player=e.player}create(){var e;super.create(),this.player.journal.unread.setVisible(!1);const t=this.player.journal.journal.map((e=>`- ${ge[e].description}\n`)).reverse(),i=new eo(this,.08*w.width,.25*w.height,t,{fontSize:32});i.setBoxSize(.84*w.width,.62*w.height),this.addTarget(i),this.fadeIn(),null==(e=this.input.keyboard)||e.on("keydown-J",(()=>{this.close()}))}handleSuccess(){}},class extends to{constructor(){super({key:"DebugTool",title:"Debug Tool",gamepadVisible:!1,hideCloseSuccess:!0}),t(this,"player"),t(this,"tabs",[]),t(this,"tab",0),t(this,"mainContainer"),t(this,"textBox"),t(this,"helperText"),t(this,"stateContainer"),t(this,"saveContainer"),t(this,"miscContainer"),t(this,"preSave"),t(this,"testVoice",{octave:3.5,speed:1,volume:1,type:"sine"});const e=localStorage.getItem(io);e&&(this.tab=Number(e))}init(e){this.player=e.player;const t=fn(this.player.scene);t.settings.time=0,this.preSave=JSON.stringify(t)}create(){var e;super.create(),this.mainContainer=this.add.container(-w.width/2,-w.height/2),this.container.add(this.mainContainer),this.mainContainer.add(this.add.rectangle(300,100,.65*w.width,.75*w.height,_("#112233")).setOrigin(0));const t=this.makeTab("Items",0),i=this.makeTab("Journal",1),s=this.makeTab("Quests",2),n=this.makeTab("State",3),r=this.makeTab("Warp",4),o=this.makeTab("Saves",5),a=this.makeTab("Misc",6);this.textBox=new eo(this,300,100,"",{fontSize:32},(e=>this.handleLineClick(e))).setBoxSize(.38*w.width,.75*w.height),this.mainContainer.add(this.textBox),this.helperText=this.add.text(w.zoomed?.94*w.width:.87*w.width,110,"",{...an,fontSize:24}).setOrigin(1,0).setDepth(1),this.mainContainer.add(this.helperText),this.tabs=[t,i,s,n,r,o,a],this.container.add(this.tabs),this.createStateContainer(),this.createSaveContainer(),this.createMiscContainer(),this.updateTabs(),null==(e=this.input.keyboard)||e.on("keydown-CLOSED_BRACKET",(()=>{this.close()}))}createStateContainer(){this.stateContainer=this.add.container(310,100),this.mainContainer.add(this.stateContainer);const e=this.player.gameState.data;Object.entries(e).forEach(((t,i)=>{const[s,n]=t,r=this.add.text(0,20+40*i,`${s}: ${n}`,{...an,fontSize:32}).setOrigin(0);switch(this.stateContainer.add(r),typeof n){case"boolean":r.setText(`${n?"[x]":"[ ]"} ${s}`),r.setInteractive().on("pointerdown",(()=>{e[s]=!e[s],r.setText(`${e[s]?"[x]":"[ ]"} ${s}`)}));break;case"number":const t=this.smallButton(r.width+20,22+40*i,"-",(()=>{e[s]--,r.setText(`${s}: ${e[s]}`)})),o=this.smallButton(r.width+55,22+40*i,"+",(()=>{e[s]++,r.setText(`${s}: ${e[s]}`)}));this.stateContainer.add([t,o])}}))}smallButton(e,t,i,s){return new Bn(this,e,t,i,s,{fontSize:36,backgroundColor:"#111",padding:{x:6,y:-4}},null)}createSaveContainer(){this.saveContainer=this.add.container(310,100),this.mainContainer.add(this.saveContainer),Object.entries(Hr).forEach(((e,t)=>{const[i,s]=e,n=new Bn(this,0,10+60*t,Wr[Number(i)],(()=>{Number(i)===Wr.New?(localStorage.removeItem(Rr),window.location.reload()):(xn(this.player.scene,s),this.close(!0))}),{backgroundColor:"#111"});this.saveContainer.add(n)}));const e=new Bn(this,350,10,"Dump Save",(()=>{const e=(t=fn(this.player.scene),JSON.stringify(t,((e,t)=>{const i=bn[e];return Array.isArray(t)&&i?t.map((e=>se(e,i.enumObj,i.enumName))):i?se(t,i.enumObj,i.enumName):t}),2).replace(/"(\w+\.\w+)"/g,"$1"));var t;navigator.clipboard.writeText(e).catch((e=>console.error(e))),console.warn("save copied to clipboard!"),console.log(e)}),{backgroundColor:"#111"});this.saveContainer.add(e)}createMiscContainer(){this.miscContainer=this.add.container(310,100),this.mainContainer.add(this.miscContainer);const e=new Bn(this,350,10,"Debug Mode",(()=>{w.debug=!w.debug,this.close()}),{backgroundColor:"#111"});this.miscContainer.add(e)}makeTab(e,t){return new Bn(this,40-this.container.x,100-this.container.y+60*t,e,(()=>{this.tab=t,localStorage.setItem(io,String(t)),this.updateTabs()}))}rangeInput(e,t,i,s,n){const r=this.add.text(e,t,`${n}: ${i().toFixed(1)}`,{...an}),o=this.smallButton(e+130,t,"-",(()=>{s(i()-.1),r.text=`${n}: ${i().toFixed(1)}`})),a=this.smallButton(e+170,t,"+",(()=>{s(i()+.1),r.text=`${n}: ${i().toFixed(1)}`}));return[r,o,a]}handleLineClick(e){var t,i;switch(this.tab){case 0:const s=ar[e],n=this.player.inventory.inventory,r=n.find((e=>e.type===s));r?r.used?n.splice(n.indexOf(r),1):r.used=!r.used:this.player.inventory.addItem({type:s,used:!1},!0);break;case 1:const o=lr[e],a=this.player.journal.journal;Ce(this.player,o)?a.splice(a.indexOf(o),1):this.player.journal.addEntry(o,!0);break;case 2:const l=dr[e],h=this.player.quests.quests,c=h.find((e=>e.id===l));c?c.completed?h.splice(h.indexOf(c),1):c.completed=!c.completed:this.player.quests.addQuest({id:l,completed:!1},!0);break;case 4:const d=ur[e],u=be[d];this.player.setPosition(u.x,u.y),this.close();break;case 6:if(e>1){const s=gr[e-2];"MainMenu"===s?(this.scene.sendToBack("Game"),this.scene.start(s)):(this.scene.stop(this),this.scene.resume("Game"),null==(i=null==(t=this.scene.get("Game"))?void 0:t.gamepad)||i.setAlpha(1),ie(this.player.scene,s))}}this.updateTabs()}updateTabs(){var e,t,i;this.tabs.forEach(((e,t)=>{e.setBackgroundColor(t===this.tab?"#123":"#151515")}));const s=0===this.tab||1===this.tab||2===this.tab||4===this.tab||6===this.tab,n=0===this.tab||2===this.tab;null==(e=this.stateContainer)||e.setVisible(3===this.tab),null==(t=this.saveContainer)||t.setVisible(5===this.tab),null==(i=this.miscContainer)||i.setVisible(6===this.tab),this.textBox.setVisible(s),this.helperText.setVisible(n);let r="";switch(this.tab){case 0:r=ar.map((e=>`[${ke(this.player,e)?"-":Pe(this.player,e)?"x":" "}] ${P[e]}`)).join("\n"),this.helperText.setText("[-] item held\n[x] item used");break;case 1:r=lr.map((e=>`[${Ce(this.player,e)?"x":" "}] ${j[e]}`)).join("\n");break;case 2:r=dr.map((e=>`[${Ie(this.player,e)?"-":Te(this.player,e)?"x":" "}] ${I[e]}`)).join("\n"),this.helperText.setText("[-] quest active\n[x] quest complete");break;case 4:r=ur.map((e=>k[e])).join("\n");break;case 6:r=["Scenes","-----------------",...gr].join("\n")}this.textBox.setText(r)}handleSuccess(e){const t=fn(this.player.scene);t.settings.time=0,this.preSave!==JSON.stringify(t)&&(e||xn(this.player.scene),this.player.scene.scene.restart())}},class extends to{constructor(){super({key:"MazeDialog",title:"Find your way through the forest",childScene:"Maze",gamepadVisible:!0}),t(this,"player"),t(this,"arrow")}init(e){var t,i;this.player=e.player,this.dialogData.gamepadVisible=null==(i=null==(t=e.player.scene)?void 0:t.gamepad)?void 0:i.visible}create(){super.create(),this.arrow=this.add.image(.4*-w.width,.4*-w.height,"arrow").setScale(.5).setRotation(.75*Math.PI),this.container.add(this.arrow)}setAngle(e){this.arrow.setRotation(e+Math.PI/2)}handleSuccess(e){e?(xe(k.Forest,this.player),this.player.gameState.updateData({mazeSolved:!0,mazeSeed:this.player.gameState.data.mazeSeed+1},!1)):this.player.setPosition(be[k.TownEast].x-100,be[k.TownEast].y)}},po,class extends to{constructor(){super({key:"PipesDialog",title:"Attach all of the pipes to fix the alchemy set.\n[CONTINUE/CLICK] to rotate",gamepadVisible:!1,childScene:"Pipes"}),t(this,"player")}init(e){this.player=e.player}create(){super.create(),this.title.setFontSize(36).setAlign("center").setY(this.title.y+10)}close(e){const t=this.scene.get("Pipes");e&&t?t.completed((()=>super.close(e))):super.close(e)}handleSuccess(e){e&&this.player.message.setDialog(Cr,Me(this.player.scene,O.AlchemySet),"player_portrait")}},fo,class extends to{constructor(){super({key:"TumblerDialog",title:"Open the lock by aligning all rings",gamepadVisible:!1}),t(this,"player"),t(this,"angles"),t(this,"rings"),t(this,"line"),t(this,"fx"),t(this,"active"),t(this,"nextUpdate"),t(this,"disabled")}init(e){this.player=e.player}preload(){this.load.setPath("assets");for(let e=1;e<=5;e++)this.load.image(`ring_${e}`,`puzzles/tumbler/ring${e}.png`)}create(){super.create(),this.angles=[],this.rings=[],this.fx=[],this.active=-1,this.nextUpdate=0,this.disabled=!1,this.line=this.add.line(0,30,27,0,216,0,_(R)).setOrigin(0,0).setLineWidth(5),this.container.add(this.line),this.container.add(this.add.text(.45*-w.width,.2*w.height,"Use [Left]/[Right]\nto select a ring\n\nUse [Up]/[Down]\nto rotate a ring",{...an}));for(let e=0;e{if(this.active=-1,i.isDown){this.active=e;const s=a.Math.Angle.Between(t.x,t.y,i.x,i.y);this.handleMove(e,s)}})).on("dragstart",(i=>{if(this.active=-1,i.isDown){this.active=e;const s=a.Math.Angle.Between(t.x,t.y,i.x,i.y);this.handleMove(e,s)}})).on("dragend",(()=>{this.active=-1,this.updateMarkers(!0)}));this.fx.push(i.postFX.addGlow(_(R),2,0)),this.input.enableDebug(i),this.container.add(i),this.rings.push(i)}handleMove(e,t,i){var s;if(this.disabled)return;const n=this.angles[e]-t;this.angles[e]=t%(2*Math.PI),null==(s=bo[e])||s.forEach(((t,i)=>{i!==e&&(this.angles[i]=(this.angles[i]+t*n)%(2*Math.PI))})),this.updateMarkers(i)}updateMarkers(e){let t=!0;this.angles.forEach(((e,i)=>{var s;const n=a.Math.Snap.To(e,vo);Math.abs(n-0)<.6*vo||Math.abs(n-2*Math.PI)<.6*vo||(t=!1),null==(s=this.rings[i])||s.setAngle(a.Math.RadToDeg(n))})),t&&e&&this.close(!0)}completed(e){this.tweens.add({targets:this.rings,rotation:0,duration:500,onComplete:()=>{this.angles=[0,0,0,0,0],this.updateMarkers(),this.disabled=!0,this.active=-1,this.tweens.add({targets:[...this.rings,this.line],rotation:2*Math.PI,delay:500,duration:1500,hold:1e3,onComplete:e})}})}update(e,t){var i;if(!(esuper.close(e))):super.close(e)}handleSuccess(e){e&&function(e){e.inventory.removeItem(P.Potion);const t=e.scene,i=new Mr(e.scene,P.Gear2,e);t.interactiveObjects.add(i);const s=Me(t,O.MansionPicture);s&&(i.disabled=!0,i.setPosition(s.x,s.y+20),t.tweens.add({targets:i,x:s.x-10,y:s.y+120,duration:1e3,onComplete:()=>{e.message.setDialog({messages:["Wow, that was a trip","I should be more careful next time","At least I found the gear!"],onCompleted:()=>{gn(t,!1),t.time.delayedCall(1e3,(()=>i.disabled=!1))}},s,"player_portrait")},ease:"Bounce.easeOut"}))}(this.player)}},class extends to{constructor(){super({key:"MemoryDialog",title:"Figure out the secret code",gamepadVisible:!1}),t(this,"sequence"),t(this,"pressed"),t(this,"buttons"),t(this,"player")}init(e){this.player=e.player}preload(){this.load.setPath("assets");for(let e=1;e<=12;e++)this.load.image(`rune_${e}`,`puzzles/runes/Stone${e}.png`)}create(){for(super.create(),this.sequence=[],this.pressed=[];this.sequence.length<6;){const e=a.Math.RND.between(0,11);this.sequence.includes(e)||this.sequence.push(e)}w.prod||this.container.add(this.add.text(0,.43*w.height,`[ ${this.sequence.map((e=>e+1)).join(", ")} ]`,{fontSize:18,align:"center"}).setOrigin(.5)),this.buttons=new Gn(this),this.container.add(this.buttons);const e=w.width/13*1.2,t=[];for(let s=0;s<12;s++){const i=s%3*e-e,n=1.2*-e+Math.floor(s/3)*e,r=Math.floor(s/3);void 0===t[r]&&t.push([]),t[r].push({x:i,y:n});const o=this.add.image(i,n,`rune_${s+1}`).setInteractive({useHandCursor:!0});o.on("pointerdown",(()=>this.onButtonPress(o,s))),this.buttons.add(o)}const i=new yo(this,{regions:t,size:e,keyHandler:e=>{const t=3*e.y+e.x,i=this.buttons.getAt(t);this.onButtonPress(i,t)}},this.keys);this.container.add(i)}onButtonPress(e,t){const i=this.pressed.length;this.sequence[i]===t?(this.pressed.push(t),e.disableInteractive(),$(this,new a.Display.Color(255,255,255),U(_(B)),(t=>e.setTint(t)),{duration:250,onComplete:()=>{$(this,U(_(B)),U(3355443),(t=>e.setTint(t)),{duration:250,onComplete:()=>{this.sequence.length===this.pressed.length&&this.close(!0)}})}})):(e.disableInteractive(),$(this,new a.Display.Color(255,255,255),U(_(L)),(t=>e.setTint(t)),{duration:250,yoyo:!0,onComplete:()=>{this.buttons.each((e=>{e.setInteractive(),e.setTint(16777215)}))}}),this.pressed=[])}close(e){e?this.completed((()=>super.close(e))):super.close()}completed(e){this.time.delayedCall(300,(()=>{this.buttons.getAll().forEach(((t,i)=>{const s=11===i,n=t.tint,r=U(n),o=U(_(B));t.disableInteractive(),t.setTint(n),$(this,r,o,(e=>t.setTint(e)),{duration:200,delay:70*i,hold:500,onComplete:s?e:void 0})}))}))}handleSuccess(e){e&&function(e){const t=e.scene,i=new Mr(t,P.Gear1,e);t.interactiveObjects.add(i);const s=Me(t,O.Chest);s&&(e.setX(s.x-100),s.setTexture("chest_open"),s.disabled=!0,i.disabled=!0,i.setPosition(s.x,s.y-20),i.setScale(.15),t.tweens.add({targets:i,scale:.35,y:s.y+20,duration:700,onComplete:()=>{s.disabled=!1,i.disabled=!1},ease:"Bounce.easeOut"}))}(this.player)}},class extends to{constructor(){super({key:"SliderDialog",title:"Arrange the tiles to be in order.",gamepadVisible:!1}),t(this,"solution",[]),t(this,"layout",[]),t(this,"tiles",[])}preload(){this.load.setPath("assets");const e=Math.floor(1024/3);this.load.spritesheet("puzzle","puzzles/puzzle.png",{frameWidth:e,frameHeight:e})}create(){super.create();const e=[];this.solution=Array.from({length:9},((e,t)=>t)),this.layout=[...this.solution],this.tiles=[];for(let i=this.layout.length-1;i>0;i--){const e=Math.floor(Math.random()*(i+1));[this.layout[i],this.layout[e]]=[this.layout[e],this.layout[i]]}this.layout.forEach(((t,i)=>{const s=i%3,n=Math.floor(i/3),r=(s-1)*mo,o=(n-1)*mo+30;void 0===e[n]&&(e[n]=[]),e[n].push({x:r,y:o});const a=this.add.image(r,o,"puzzle",i).setOrigin(.5).setDisplaySize(.95*mo,.95*mo);this.container.add(a),a.setInteractive({useHandCursor:!0}),a.on("pointerdown",(()=>{this.moveTile(i)})),this.tiles.push(a)}));const t=new yo(this,{regions:e,size:1.1*mo,keyHandler:e=>{const t=3*e.y+e.x;this.moveTile(t)}},this.keys);this.container.add(t),this.updateLayout()}moveTile(e){const t=this.layout.indexOf(8),i=t%3,s=Math.floor(t/3),n=e%3,r=Math.floor(e/3);Math.abs(i-n)+Math.abs(s-r)===1&&(this.layout[t]=this.layout[e],this.layout[e]=8,this.updateLayout()),this.layout.join("")===this.solution.join("")&&this.handleSuccess(!0)}updateLayout(){this.layout.forEach(((e,t)=>{this.tiles[t].setFrame(e),this.tiles[t].setVisible(8!=e)}))}completed(e){for(let t=0;t{t0&&this.tiles[t-1].setTint(6710886)}));this.time.delayedCall(2e3,e)}close(e){e?this.completed((()=>super.close(e))):super.close(e)}handleSuccess(e){e&&this.time.delayedCall(750,(()=>{this.close(!0)}))}},Zr],pipeline:{CRTPipeline:cn,XRayPipeline:yn},input:{gamepad:!0},disableContextMenu:w.prod,physics:{default:"arcade"},fps:{panicMax:165,smoothStep:!0},render:{pixelArt:!0,antialias:!1},dom:{createContainer:!0},plugins:{scene:[{key:"PipelinePlugin",plugin:dn,mapping:"pipelinePlugin"}]}};oe.style.cursor="none",oe.addEventListener("mousemove",(function(){oe.style.cursor="default",clearTimeout(re),re=setTimeout((()=>{oe.style.cursor="none"}),2500)}));const xo=document.querySelector("#initial-loader");null==xo||xo.remove();const So=new a.Game(wo);w.prod||function(e){xr=(()=>{const e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";const t=[];return{REVISION:17,dom:e,panels:t,addPanel:function(i){return e.appendChild(i.dom),t.push(i),i}}})(),document.body.appendChild(xr.dom);const t=xr.dom.style;t.display="flex",t.justifyContent="center",t.flexWrap="wrap",t.gap="6px",t.cursor="",t.right="0",t.top="",t.bottom="10px",t.opacity="0.7";const i=xr.addPanel(wr("FPS","#9ad8e4","#064b62")),s=xr.addPanel(wr("Frame Time","#f3b0c3","#6b1e3d")),n=xr.addPanel(wr("Memory (mb)","#ffd59a","#6b3e06")),r=xr.addPanel(wr("Render","#e9f3a3","#4c6b1a")),o=xr.addPanel(wr("Step","#c3c3f3","#1d1d6b"));let a=0,l=0;e.events.on(Phaser.Core.Events.PRE_STEP,(()=>a=performance.now())),e.events.on(Phaser.Core.Events.POST_STEP,(()=>o.update(performance.now()-a))),e.events.on(Phaser.Core.Events.PRE_RENDER,(()=>l=performance.now())),e.events.on(Phaser.Core.Events.POST_RENDER,(()=>{const t=e.loop.deltaHistory.slice(0,10).reduce(((e,t)=>e+t),0)/10;r.update(performance.now()-l),i.update(1e3/t),s.update(performance.now()-a),performance.memory&&n.update(performance.memory.usedJSHeapSize/1048576)}))}(So); diff --git a/build.json b/build.json index 09384f9..4fa10b8 100644 --- a/build.json +++ b/build.json @@ -1 +1 @@ -{"buildTime":"2025-01-02T07:08:10.085Z"} \ No newline at end of file +{"buildTime":"2025-01-02T08:11:09.570Z"} \ No newline at end of file diff --git a/index.html b/index.html index ee1eaa5..482ffba 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ Chrono Sleuth - + diff --git a/sw.js b/sw.js index 026a2c4..adc383e 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let s,e={};const n=(n,l)=>(n=new URL(n+".js",l).href,e[n]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=n,s.onload=e,document.head.appendChild(s)}else s=n,importScripts(n),e()})).then((()=>{let s=e[n];if(!s)throw new Error(`Module ${n} didn’t register its module`);return s})));self.define=(l,r)=>{const i=s||("document"in self?document.currentScript.src:"")||location.href;if(e[i])return;let u={};const o=s=>n(s,i),t={module:{uri:i},exports:u,require:o};e[i]=Promise.all(l.map((s=>t[s]||o(s)))).then((s=>(r(...s),u)))}}define(["./workbox-5ffe50d4"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/characters/clock_portrait.png",revision:null},{url:"assets/characters/inventor_portrait.png",revision:null},{url:"assets/characters/inventor.png",revision:null},{url:"assets/characters/mayor_portrait.png",revision:null},{url:"assets/characters/mayor.png",revision:null},{url:"assets/characters/player_portrait.png",revision:null},{url:"assets/characters/player.png",revision:null},{url:"assets/characters/sphinx_portrait.png",revision:null},{url:"assets/characters/sphinx.png",revision:null},{url:"assets/characters/stranger_portrait.png",revision:null},{url:"assets/characters/stranger.png",revision:null},{url:"assets/fonts/m6x11-24.png",revision:null},{url:"assets/fonts/m6x11-32.png",revision:null},{url:"assets/icons/award.svg",revision:null},{url:"assets/icons/chevron-down.svg",revision:null},{url:"assets/icons/gamepad-solid.svg",revision:null},{url:"assets/icons/maximize.svg",revision:null},{url:"assets/icons/minimize.svg",revision:null},{url:"assets/icons/moon.svg",revision:null},{url:"assets/icons/save.svg",revision:null},{url:"assets/icons/settings.svg",revision:null},{url:"assets/icons/sun.svg",revision:null},{url:"assets/icons/terminal.svg",revision:null},{url:"assets/icons/tv.svg",revision:null},{url:"assets/icons/volume-2.svg",revision:null},{url:"assets/icons/volume-x.svg",revision:null},{url:"assets/icons/zoom-in.svg",revision:null},{url:"assets/icons/zoom-out.svg",revision:null},{url:"assets/index-DlKJ9cz_.js",revision:null},{url:"assets/items/book.png",revision:null},{url:"assets/items/candle.png",revision:null},{url:"assets/items/dagger.png",revision:null},{url:"assets/items/gear.png",revision:null},{url:"assets/items/gear2.png",revision:null},{url:"assets/items/herb_blue.png",revision:null},{url:"assets/items/herb_green.png",revision:null},{url:"assets/items/herb_red.png",revision:null},{url:"assets/items/journal.png",revision:null},{url:"assets/items/key.png",revision:null},{url:"assets/items/lantern.png",revision:null},{url:"assets/items/letter.png",revision:null},{url:"assets/items/lockpick.png",revision:null},{url:"assets/items/map.png",revision:null},{url:"assets/items/potion.png",revision:null},{url:"assets/items/watch.png",revision:null},{url:"assets/items/wrench.png",revision:null},{url:"assets/logo.jpg",revision:null},{url:"assets/maps/alchemy_lab.jpg",revision:null},{url:"assets/maps/clock_inner.jpg",revision:null},{url:"assets/maps/clock_outside.jpg",revision:null},{url:"assets/maps/forest.jpg",revision:null},{url:"assets/maps/intro/layer2.png",revision:null},{url:"assets/maps/intro/layer3.png",revision:null},{url:"assets/maps/intro/layer4.png",revision:null},{url:"assets/maps/intro/layer5.png",revision:null},{url:"assets/maps/intro/train.png",revision:null},{url:"assets/maps/lake.jpg",revision:null},{url:"assets/maps/library.jpg",revision:null},{url:"assets/maps/mansion_inside.jpg",revision:null},{url:"assets/maps/mansion_outside_hatch.jpg",revision:null},{url:"assets/maps/mansion_outside.jpg",revision:null},{url:"assets/maps/town.jpg",revision:null},{url:"assets/phaser-BZMViRUx.js",revision:null},{url:"assets/props/alchemy/alchemy_blue.png",revision:null},{url:"assets/props/alchemy/alchemy_empty.png",revision:null},{url:"assets/props/alchemy/alchemy_full.png",revision:null},{url:"assets/props/alchemy/alchemy_green.png",revision:null},{url:"assets/props/alchemy/alchemy_red.png",revision:null},{url:"assets/props/book.png",revision:null},{url:"assets/props/chest_open.png",revision:null},{url:"assets/props/chest.png",revision:null},{url:"assets/props/ladder.png",revision:null},{url:"assets/props/picture.png",revision:null},{url:"assets/props/portal.png",revision:null},{url:"assets/props/safe.png",revision:null},{url:"assets/props/warp.png",revision:null},{url:"assets/puzzles/arrow.png",revision:null},{url:"assets/puzzles/puzzle.png",revision:null},{url:"assets/puzzles/runes/Stone1.png",revision:null},{url:"assets/puzzles/runes/Stone10.png",revision:null},{url:"assets/puzzles/runes/Stone11.png",revision:null},{url:"assets/puzzles/runes/Stone12.png",revision:null},{url:"assets/puzzles/runes/Stone2.png",revision:null},{url:"assets/puzzles/runes/Stone3.png",revision:null},{url:"assets/puzzles/runes/Stone4.png",revision:null},{url:"assets/puzzles/runes/Stone5.png",revision:null},{url:"assets/puzzles/runes/Stone6.png",revision:null},{url:"assets/puzzles/runes/Stone7.png",revision:null},{url:"assets/puzzles/runes/Stone8.png",revision:null},{url:"assets/puzzles/runes/Stone9.png",revision:null},{url:"assets/puzzles/tumbler/ring1.png",revision:null},{url:"assets/puzzles/tumbler/ring2.png",revision:null},{url:"assets/puzzles/tumbler/ring3.png",revision:null},{url:"assets/puzzles/tumbler/ring4.png",revision:null},{url:"assets/puzzles/tumbler/ring5.png",revision:null},{url:"assets/splash.jpg",revision:null},{url:"assets/workbox-window.prod.es5-BXNXHyjv.js",revision:null},{url:"favicon.webp",revision:"e2869a765701e32ca13599614043b043"},{url:"index.html",revision:"383b9991ea02a874ce1eb3a8e930df1d"},{url:"m6x11.ttf",revision:"cc8dfaa3938829493e45c4a13b6629c3"},{url:"style.css",revision:"2a4a8ff6606a74d24d9036f9e8155f91"},{url:"favicon.webp",revision:"e2869a765701e32ca13599614043b043"},{url:"manifest.webmanifest",revision:"29d9fc647502ad672be1b166ce96d45a"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))})); +if(!self.define){let s,e={};const n=(n,l)=>(n=new URL(n+".js",l).href,e[n]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=n,s.onload=e,document.head.appendChild(s)}else s=n,importScripts(n),e()})).then((()=>{let s=e[n];if(!s)throw new Error(`Module ${n} didn’t register its module`);return s})));self.define=(l,r)=>{const i=s||("document"in self?document.currentScript.src:"")||location.href;if(e[i])return;let u={};const o=s=>n(s,i),t={module:{uri:i},exports:u,require:o};e[i]=Promise.all(l.map((s=>t[s]||o(s)))).then((s=>(r(...s),u)))}}define(["./workbox-5ffe50d4"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/characters/clock_portrait.png",revision:null},{url:"assets/characters/inventor_portrait.png",revision:null},{url:"assets/characters/inventor.png",revision:null},{url:"assets/characters/mayor_portrait.png",revision:null},{url:"assets/characters/mayor.png",revision:null},{url:"assets/characters/player_portrait.png",revision:null},{url:"assets/characters/player.png",revision:null},{url:"assets/characters/sphinx_portrait.png",revision:null},{url:"assets/characters/sphinx.png",revision:null},{url:"assets/characters/stranger_portrait.png",revision:null},{url:"assets/characters/stranger.png",revision:null},{url:"assets/fonts/m6x11-24.png",revision:null},{url:"assets/fonts/m6x11-32.png",revision:null},{url:"assets/icons/award.svg",revision:null},{url:"assets/icons/chevron-down.svg",revision:null},{url:"assets/icons/gamepad-solid.svg",revision:null},{url:"assets/icons/maximize.svg",revision:null},{url:"assets/icons/minimize.svg",revision:null},{url:"assets/icons/moon.svg",revision:null},{url:"assets/icons/save.svg",revision:null},{url:"assets/icons/settings.svg",revision:null},{url:"assets/icons/sun.svg",revision:null},{url:"assets/icons/terminal.svg",revision:null},{url:"assets/icons/tv.svg",revision:null},{url:"assets/icons/volume-2.svg",revision:null},{url:"assets/icons/volume-x.svg",revision:null},{url:"assets/icons/zoom-in.svg",revision:null},{url:"assets/icons/zoom-out.svg",revision:null},{url:"assets/index-CY4Qc25t.js",revision:null},{url:"assets/items/book.png",revision:null},{url:"assets/items/candle.png",revision:null},{url:"assets/items/dagger.png",revision:null},{url:"assets/items/gear.png",revision:null},{url:"assets/items/gear2.png",revision:null},{url:"assets/items/herb_blue.png",revision:null},{url:"assets/items/herb_green.png",revision:null},{url:"assets/items/herb_red.png",revision:null},{url:"assets/items/journal.png",revision:null},{url:"assets/items/key.png",revision:null},{url:"assets/items/lantern.png",revision:null},{url:"assets/items/letter.png",revision:null},{url:"assets/items/lockpick.png",revision:null},{url:"assets/items/map.png",revision:null},{url:"assets/items/potion.png",revision:null},{url:"assets/items/watch.png",revision:null},{url:"assets/items/wrench.png",revision:null},{url:"assets/logo.jpg",revision:null},{url:"assets/maps/alchemy_lab.jpg",revision:null},{url:"assets/maps/clock_inner.jpg",revision:null},{url:"assets/maps/clock_outside.jpg",revision:null},{url:"assets/maps/forest.jpg",revision:null},{url:"assets/maps/intro/layer2.png",revision:null},{url:"assets/maps/intro/layer3.png",revision:null},{url:"assets/maps/intro/layer4.png",revision:null},{url:"assets/maps/intro/layer5.png",revision:null},{url:"assets/maps/intro/train.png",revision:null},{url:"assets/maps/lake.jpg",revision:null},{url:"assets/maps/library.jpg",revision:null},{url:"assets/maps/mansion_inside.jpg",revision:null},{url:"assets/maps/mansion_outside_hatch.jpg",revision:null},{url:"assets/maps/mansion_outside.jpg",revision:null},{url:"assets/maps/town.jpg",revision:null},{url:"assets/phaser-BZMViRUx.js",revision:null},{url:"assets/props/alchemy/alchemy_blue.png",revision:null},{url:"assets/props/alchemy/alchemy_empty.png",revision:null},{url:"assets/props/alchemy/alchemy_full.png",revision:null},{url:"assets/props/alchemy/alchemy_green.png",revision:null},{url:"assets/props/alchemy/alchemy_red.png",revision:null},{url:"assets/props/book.png",revision:null},{url:"assets/props/chest_open.png",revision:null},{url:"assets/props/chest.png",revision:null},{url:"assets/props/ladder.png",revision:null},{url:"assets/props/picture.png",revision:null},{url:"assets/props/portal.png",revision:null},{url:"assets/props/safe.png",revision:null},{url:"assets/props/warp.png",revision:null},{url:"assets/puzzles/arrow.png",revision:null},{url:"assets/puzzles/puzzle.png",revision:null},{url:"assets/puzzles/runes/Stone1.png",revision:null},{url:"assets/puzzles/runes/Stone10.png",revision:null},{url:"assets/puzzles/runes/Stone11.png",revision:null},{url:"assets/puzzles/runes/Stone12.png",revision:null},{url:"assets/puzzles/runes/Stone2.png",revision:null},{url:"assets/puzzles/runes/Stone3.png",revision:null},{url:"assets/puzzles/runes/Stone4.png",revision:null},{url:"assets/puzzles/runes/Stone5.png",revision:null},{url:"assets/puzzles/runes/Stone6.png",revision:null},{url:"assets/puzzles/runes/Stone7.png",revision:null},{url:"assets/puzzles/runes/Stone8.png",revision:null},{url:"assets/puzzles/runes/Stone9.png",revision:null},{url:"assets/puzzles/tumbler/ring1.png",revision:null},{url:"assets/puzzles/tumbler/ring2.png",revision:null},{url:"assets/puzzles/tumbler/ring3.png",revision:null},{url:"assets/puzzles/tumbler/ring4.png",revision:null},{url:"assets/puzzles/tumbler/ring5.png",revision:null},{url:"assets/splash.jpg",revision:null},{url:"assets/workbox-window.prod.es5-BXNXHyjv.js",revision:null},{url:"favicon.webp",revision:"e2869a765701e32ca13599614043b043"},{url:"index.html",revision:"053aef84c32dc9eb78603a99178be4f4"},{url:"m6x11.ttf",revision:"cc8dfaa3938829493e45c4a13b6629c3"},{url:"style.css",revision:"2a4a8ff6606a74d24d9036f9e8155f91"},{url:"favicon.webp",revision:"e2869a765701e32ca13599614043b043"},{url:"manifest.webmanifest",revision:"29d9fc647502ad672be1b166ce96d45a"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))}));