From 46b2f1b3b93c009425236750062bdd36652b2c91 Mon Sep 17 00:00:00 2001 From: Bart Duisters Date: Tue, 11 Jun 2024 20:04:09 +0200 Subject: [PATCH 1/2] fix: contenedor -> game-container --- dungeon/dist/assets/index-CQq0-1Ik.js | 2984 +++++++++++++++++++++- dungeon/src/main.js | 8 +- mars/dist/assets/index-CP-uPpKM.js | 1952 +++++++++++++- mars/src/main.js | 4 +- pushpull/dist/assets/index-D29MUjmQ.js | 783 +++++- pushpull/src/main.js | 4 +- starshake/dist/assets/index-DEhXC0VF.js | 1448 ++++++++++- starshake/src/main.js | 4 +- wallhammer/dist/assets/index-Du4WbNGK.js | 1420 +++++++++- wallhammer/src/main.js | 4 +- zenbaki/dist/assets/index-BA24paxW.js | 2555 +++++++++++++++++- zenbaki/src/main.js | 2 +- 12 files changed, 11149 insertions(+), 19 deletions(-) diff --git a/dungeon/dist/assets/index-CQq0-1Ik.js b/dungeon/dist/assets/index-CQq0-1Ik.js index 1e355a66..42500717 100644 --- a/dungeon/dist/assets/index-CQq0-1Ik.js +++ b/dungeon/dist/assets/index-CQq0-1Ik.js @@ -1 +1,2983 @@ -import{r as requirePhaser,g as getDefaultExportFromCjs,c as commonjsGlobal}from"./phaser-zcydYi9M.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const s of t)if("childList"===s.type)for(const t of s.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();var phaserExports=requirePhaser();const Phaser$1=getDefaultExportFromCjs(phaserExports);class Bootloader extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.setLoadEvents(),this.loadFonts(),this.loadImages(),this.loadMaps(),this.loadAudios(),this.loadSpritesheets()}setLoadEvents(){this.load.on("progress",(function(t){this.progressBar.clear(),this.progressBar.fillStyle(34986,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*t,16)}),this),this.load.on("complete",(()=>{this.scene.start("splash")}),this)}loadFonts(){this.load.bitmapFont("default","assets/fonts/pico.png","assets/fonts/pico.xml")}loadImages(){this.load.image("pello","assets/images/pello_ok.png"),this.load.image("fireball","assets/images/fireball.png"),this.load.image("tiles","assets/maps/pixel-poem-tiles.png"),this.load.image("block","assets/images/block.png"),this.load.image("seesaw","assets/images/seesaw.png"),this.load.image("bubble","assets/images/bubble.png"),this.load.image("platform","assets/images/platform.png")}loadMaps(){this.load.tilemapTiledJSON("scene0","assets/maps/level.json")}loadAudios(){Array(5).fill(0).forEach(((t,e)=>{this.load.audio(`climb${e}`,`assets/sounds/climb${e}.mp3`)})),this.load.audio("splash","assets/sounds/splash.mp3"),this.load.audio("music","assets/sounds/music.mp3"),this.load.audio("jump","assets/sounds/jump.mp3"),this.load.audio("bubble","assets/sounds/bubble.mp3"),this.load.audio("trap","assets/sounds/trap.mp3"),this.load.audio("crash","assets/sounds/crash.mp3"),this.load.audio("fireball","assets/sounds/fireball.mp3"),this.load.audio("win","assets/sounds/win.mp3"),this.load.audio("start","assets/sounds/start.mp3"),this.load.audio("death","assets/sounds/death.mp3")}loadSpritesheets(){this.load.spritesheet("player","assets/images/player.png",{frameWidth:48,frameHeight:48}),this.load.spritesheet("dust","assets/images/dust.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("coin","assets/images/coin.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("keys","assets/images/keys.png",{frameWidth:48,frameHeight:48}),this.load.spritesheet("bat","assets/images/bat.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("wizard","assets/images/wizard.png",{frameWidth:48,frameHeight:48})}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(43771,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class Outro extends Phaser.Scene{constructor(){super({key:"outro"})}init(t){this.name=t.name,this.number=t.number,this.next=t.next}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.showPlayer(),this.sound.add("win").play(),this.scoreCoins=this.add.bitmapText(this.center_width,50,"default","Coins: "+this.registry.get("coins"),25).setOrigin(.5).setScrollFactor(0),this.scoreSeconds=this.add.bitmapText(this.center_width,100,"default","Time: "+this.registry.get("seconds"),25).setOrigin(.5).setScrollFactor(0),this.add.bitmapText(this.center_width,this.center_height-20,"default","YOU DID IT!!",40).setOrigin(.5),this.add.bitmapText(this.center_width,this.center_height+40,"default","Press space to restart",25).setOrigin(.5),this.input.keyboard.on("keydown-ENTER",(()=>this.loadNext()),this),this.input.keyboard.on("keydown-SPACE",(()=>this.loadNext()),this)}loadNext(){this.scene.start("splash")}showPlayer(){this.player=this.add.sprite(this.center_width,this.center_height-120,"player").setOrigin(.5).setScale(3),this.anims.create({key:"playeridle",frames:this.anims.generateFrameNumbers("player",{start:0,end:1}),frameRate:5,repeat:-1}),this.player.anims.play("playeridle")}}class Splash extends Phaser.Scene{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.backLayer=this.add.layer(),this.cameras.main.setBackgroundColor(0),this.showTitle(),this.addPlayerAndFoe(),this.addAnimationTweens(),this.time.delayedCall(1e3,(()=>this.showInstructions()),null,this),this.input.keyboard.on("keydown-SPACE",(()=>this.startGame()),this),this.input.keyboard.on("keydown-ENTER",(()=>this.startGame()),this),this.playMusic()}startGame(){this.theme&&this.theme.stop(),this.scene.start("transition")}showTitle(){this.textShadow1=this.add.bitmapText(this.center_width,100,"default","DUNGEON",85).setTint(16742522).setOrigin(.5),this.textShadow2=this.add.bitmapText(this.center_width,250,"default","BOBBLE",85).setTint(16742522).setOrigin(.5),this.text1=this.add.bitmapText(this.center_width,100,"default","DUNGEON",85).setTint(3153968).setOrigin(.5),this.text2=this.add.bitmapText(this.center_width,250,"default","BOBBLE",85).setTint(3153968).setOrigin(.5),this.text11=this.add.bitmapText(this.center_width,100,"default","DUNGEON",88).setTint(43771).setOrigin(.5),this.text22=this.add.bitmapText(this.center_width,250,"default","BOBBLE",88).setTint(43771).setOrigin(.5),this.tweens.add({targets:[this.textShadow1,this.textShadow2],duration:1e3,x:"+=10",y:"+=10",yoyo:!0,repeat:-1})}playMusic(t="splash"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.3,rate:1,detune:0,seek:0,loop:!0,delay:0})}showInstructions(){this.add.bitmapText(this.center_width,430,"default","WASD/Arrows: move",30).setDropShadow(1,1,16742522,.7).setOrigin(.5),this.add.sprite(this.center_width-60,490,"pello").setOrigin(.5).setScale(.3),this.add.bitmapText(this.center_width+40,490,"default","By PELLO",15).setDropShadow(1,1,16742522,.7).setOrigin(.5),this.space=this.add.bitmapText(this.center_width,550,"default","Press SPACE to start",25).setDropShadow(1,1,4007227,.7).setOrigin(.5),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}addPlayerAndFoe(){this.player=this.add.sprite(this.width-100,350,"player").setScale(2),this.anims.create({key:"playeridle",frames:this.anims.generateFrameNumbers("player",{start:0,end:3}),frameRate:5,repeat:-1}),this.player.anims.play("playeridle"),this.foe=this.add.sprite(this.width,350,"wizard").setScale(2),this.anims.create({key:"foe",frames:this.anims.generateFrameNumbers("wizard",{start:0,end:4}),frameRate:5,repeat:-1}),this.foe.anims.play("foe")}addAnimationTweens(){this.tweens.add({targets:[this.player],x:{from:this.player.x,to:0},duration:2500,yoyo:!0,repeat:-1,onYoyo:()=>{this.player.flipX=!this.player.flipX},onRepeat:()=>{this.player.flipX=!this.player.flipX}}),this.tweens.add({targets:[this.foe],x:{from:this.foe.x,to:100},duration:2500,yoyo:!0,repeat:-1,onYoyo:()=>{this.foe.flipX=!this.foe.flipX},onRepeat:()=>{this.foe.flipX=!this.foe.flipX}})}}class Transition extends Phaser.Scene{constructor(){super({key:"transition"})}create(){this.sound.stopAll(),this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.sound.add("start").play(),this.playMusic(),this.key=this.add.sprite(this.center_width,this.center_height-120,"keys",0).setOrigin(.5).setScale(2),this.add.bitmapText(this.center_width,this.center_height-20,"default","GET ALL KEYS",30).setOrigin(.5),this.add.bitmapText(this.center_width,this.center_height+40,"default","from all rooms!",25).setOrigin(.5),this.input.keyboard.on("keydown-ENTER",(()=>this.loadNext()),this),this.input.keyboard.on("keydown-SPACE",(()=>this.loadNext()),this),this.time.delayedCall(1e3,(()=>this.loadNext()),null,this)}loadNext(){this.scene.start("game")}playMusic(t="music"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.2,rate:1,detune:0,seek:0,loop:!0,delay:0})}}class Bat extends Phaser.Physics.Matter.Sprite{constructor(t,e,s,i="bat",n){super(t.matter.world,e,s,i,0),this.label="bat",this.scene=t,this.scene.add.existing(this),this.startX=e,this.direction=Phaser.Math.RND.pick([-1,1]),this.setFixedRotation(),this.setIgnoreGravity(!0),this.addCollisions(),this.init()}init(){this.scene.anims.create({key:this.label,frames:this.scene.anims.generateFrameNumbers(this.label,{start:0,end:1}),frameRate:5,repeat:-1}),this.scene.anims.create({key:this.label+"death",frames:this.scene.anims.generateFrameNumbers(this.label,{start:2,end:5}),frameRate:5}),this.anims.play(this.label,!0),this.on("animationcomplete",this.animationComplete,this),this.setVelocityX(5*this.direction),this.scene.events.on("update",this.update,this)}addCollisions(){this.unsubscribeBatCollide=this.scene.matterCollision.addOnCollideStart({objectA:this,callback:this.onBatCollide,context:this})}onBatCollide({gameObjectA:t,gameObjectB:e}){e instanceof Bubble&&(e.load("bat"),this.destroy())}update(){this.active&&Math.abs(this.body.velocity.x)<=.5&&this.turn()}turn(){this.direction=-this.direction,this.flipX=this.direction>0,this.setFlipX(this.direction>0),this.setVelocityX(5*this.direction)}death(){this.dead=!0,this.anims.play(this.label+"death")}animationComplete(t,e){t.key===this.label+"death"&&this.destroy()}}class Fireball extends Phaser.Physics.Matter.Sprite{constructor(t,e,s,i){super(t.matter.world,e,s,"fireball",0),this.label="fireball",this.scene=t,this.direction=i,t.add.existing(this),this.setIgnoreGravity(!0),this.setVelocityX(5*this.direction),this.setVelocityY(Phaser.Math.Between(0,-8)),this.setBounce(1),this.init()}init(){this.scene.events.on("update",this.update,this),this.tween=this.scene.tweens.add({targets:this,duration:200,scale:{from:.9,to:1},repeat:-1}),this.scene.time.delayedCall(3e3,(()=>{this.destroy()}),null,this)}update(){var t;null==(t=this.scene)||t.gameOver}destroy(){this.tween.destroy(),super.destroy()}}class Wizard extends Phaser.Physics.Matter.Sprite{constructor(t,e,s,i="wizard",n){super(t.matter.world,e,s,i,0),this.label="wizard",this.scene.add.existing(this),this.startX=e,this.direction=Phaser.Math.RND.pick([-1,1]),this.setFixedRotation(),this.addCollisions(),this.init()}init(){this.scene.anims.create({key:this.label,frames:this.scene.anims.generateFrameNumbers(this.label,{start:0,end:5}),frameRate:5,repeat:-1}),this.anims.play(this.label,!0),this.scene.events.on("update",this.update,this),this.timer=this.scene.time.addEvent({delay:3e3,callback:this.directShot,callbackScope:this,loop:!0})}addCollisions(){this.unsubscribeBatCollide=this.scene.matterCollision.addOnCollideStart({objectA:this,callback:this.onWizardCollide,context:this})}onWizardCollide({gameObjectA:t,gameObjectB:e}){e instanceof Bubble&&(e.load("wizard"),this.destroy())}directShot(){this.scene.playAudio("fireball"),Phaser.Math.Distance.BetweenPoints(this.scene.player,this),this.anims.play("wizardshot",!0),new Fireball(this.scene,this.x,this.y,this.direction),this.delayedTurn=this.scene.time.delayedCall(1e3,(()=>{this.turn()}),null,this)}turn(){this.direction=-this.direction,this.flipX=this.direction>0,this.setFlipX(this.direction>0),this.setVelocityX(5*this.direction)}destroy(){this.timer&&this.timer.destroy(),this.delayedTurn&&this.delayedTurn.destroy(),this.fireball&&this.fireball.destroy(),super.destroy()}}class Bubble extends Phaser.Physics.Matter.Sprite{constructor(t,e,s,i,n={isStatic:!0}){super(t.matter.world,e+i,s,"bubble",0,n),this.offset=i,this.setFriction(1,0,1/0),this.startX=e,this.startY=s,this.scene=t,t.add.existing(this),this.moveVertically(),this.scene.events.on("update",this.update,this)}load(t){this.scene.playAudio("trap"),this.loaded=this.scene.add.sprite(this.x,this.y,t).setOrigin(.5).setScale(.6),this.loaded.name=t,this.loadedTween=this.scene.tweens.add({targets:this.loaded,rotation:"+=5",yoyo:!0,repeat:-1})}moveHorizontally(){this.scene.tweens.add({targets:this,scaleX:{from:1,to:.9},yoyo:!0,repeat:-1,duration:200}),this.scene.tweens.addCounter({from:0,to:Phaser.Math.Between(-400,400),duration:3500,ease:Phaser.Math.Easing.Sine.InOut,onUpdate:(t,e)=>{const s=this.startX+e.value,i=s-this.x;this.x=s,this.setVelocityX(i)},onComplete:()=>{this.scene.time.delayedCall(1e3,(()=>{this.destroy()}),null,this)}})}moveVertically(){this.blob=this.scene.tweens.add({targets:this,scaleX:{from:1,to:.9},yoyo:!0,repeat:-1,duration:200}),this.scene.tweens.addCounter({from:0,to:-300,duration:4500,ease:Phaser.Math.Easing.Sine.InOut,onUpdate:(t,e)=>{const s=this.startY+e.value,i=s-this.y;this.y=s,this.setVelocityY(i)},onComplete:()=>{this.blob.destroy(),this.scene.time.delayedCall(1e3,(()=>{this.destroy()}),null,this)}})}respawn(){this.loadedTween.destroy(),"wizard"===this.loaded.name?new Wizard(this.scene,this.x,this.y):"bat"===this.loaded.name&&new Bat(this.scene,this.x,this.y),this.loaded.destroy(),this.loaded=null}update(){this.active&&this.loaded&&(this.loaded.x=this.x,this.loaded.y=this.y)}destroy(){this.scene&&(this.scene.playAudio("crash"),this.loaded&&this.respawn(),super.destroy())}}class Dust extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="dust",n=!1){super(t,e,s,i),this.scene=t,this.name=i,this.setScale(.5),this.scene.add.existing(this),this.init(n)}init(t){t&&this.scene.tweens.add({targets:this,duration:Phaser.Math.Between(500,1e3),alpha:{from:1,to:0},onComplete:()=>{this.destroy()}}),this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:10}),frameRate:10}),this.on("animationcomplete",this.animationComplete,this),this.anims.play(this.name,!0)}animationComplete(){this.destroy()}}class Player{constructor(t,e,s){this.scene=t,this.label="player",this.moveForce=.01,this.invincible=!0,this.isTouching={left:!1,right:!1,ground:!1},this.canJump=!0,this.jumpCooldownTimer=null,this.canShoot=!0,this.shootCooldownTimer=null,this.onWall=!1,this.init(e,s),this.addControls()}init(t,e){this.scene.matter.world.on("beforeupdate",this.resetTouching,this),this.sprite=this.scene.matter.add.sprite(0,0,"player",0);const{Body:s,Bodies:i}=Phaser.Physics.Matter.Matter,{width:n,height:o}=this.sprite,a=i.rectangle(0,5,n-14,o-10,{chamfer:{radius:10}});this.sensors={bottom:i.rectangle(0,.5*o,.25*n,2,{isSensor:!0}),left:i.rectangle(.35*-n,0,2,.5*o,{isSensor:!0}),right:i.rectangle(.35*n,0,2,.5*o,{isSensor:!0})};const r=s.create({parts:[a,this.sensors.bottom,this.sensors.left,this.sensors.right],frictionStatic:0,frictionAir:.02,friction:.1,render:{sprite:{xOffset:.5,yOffset:.5}}});this.sprite.setExistingBody(r).setFixedRotation().setPosition(t,e),this.addEvents(),this.addColliders(),this.addAnimations(),this.initInvincible()}addEvents(){this.scene.events.on("update",this.update,this),this.scene.events.once("shutdown",this.destroy,this),this.scene.events.once("destroy",this.destroy,this)}addColliders(){this.scene.matterCollision.addOnCollideStart({objectA:[this.sensors.bottom,this.sensors.left,this.sensors.right],callback:this.onSensorCollide,context:this}),this.scene.matterCollision.addOnCollideActive({objectA:[this.sensors.bottom,this.sensors.left,this.sensors.right],callback:this.onSensorCollide,context:this})}addAnimations(){this.scene.anims.create({key:"playeridle",frames:this.scene.anims.generateFrameNumbers(this.label,{start:0,end:1}),frameRate:5,repeat:-1}),this.scene.anims.create({key:"playerwalk",frames:this.scene.anims.generateFrameNumbers(this.label,{start:0,end:3}),frameRate:6}),this.scene.anims.create({key:"playershot",frames:this.scene.anims.generateFrameNumbers(this.label,{start:4,end:5}),frameRate:4}),this.sprite.anims.play("playeridle",!0),this.sprite.on("animationcomplete",this.animationComplete,this)}initInvincible(){this.scene.tweens.add({targets:this.sprite,alpha:{from:.5,to:1},duration:200,repeat:10,onComplete:()=>{this.invincible=!1}})}onSensorCollide({bodyA:t,bodyB:e,pair:s}){e.isSensor||(t===this.sensors.left?(this.friction(),this.onWall=!0,this.isTouching.left=!0,s.separation>.5&&(this.sprite.x+=s.separation-.5)):t===this.sensors.right?(this.friction(),this.onWall=!0,this.isTouching.right=!0,s.separation>.5&&(this.sprite.x-=s.separation-.5)):t===this.sensors.bottom&&(this.land(),this.isTouching.ground=!0))}resetTouching(){this.isTouching.left=!1,this.isTouching.right=!1,this.isTouching.ground=!1}addControls(){this.cursor=this.scene.input.keyboard.createCursorKeys(),this.W=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W),this.A=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.A),this.S=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S),this.D=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.D)}update(){this.isOnGround=this.isTouching.ground,this.isInAir=!this.isOnGround,this.moveForce=this.isOnGround?.01:.005,this.D.isDown||this.cursor.right.isDown?(this.sprite.setFlipX(!0),this.isInAir&&this.isTouching.right||(this.step(),this.sprite.anims.play("playerwalk",!0),this.sprite.setVelocityX(5))):this.A.isDown||this.cursor.left.isDown?(this.sprite.setFlipX(!1),this.isInAir&&this.isTouching.left||(this.step(),this.sprite.anims.play("playerwalk",!0),this.sprite.setVelocityX(-5))):"playershot"!==this.sprite.anims.currentAnim.key&&this.sprite.anims.play("playeridle",!0),this.sprite.body.velocity.x>7?this.sprite.setVelocityX(7):this.sprite.body.velocity.x<-7&&this.sprite.setVelocityX(-7),this.checkJump(),this.checkShoot()}checkJump(){(this.canJump&&this.isOnGround||this.onWall)&&(this.W.isDown||this.cursor.up.isDown)&&(this.sprite.setVelocityY(-8),this.scene.playAudio("jump"),this.canJump=!1,this.onWall=!1,this.jumpCooldownTimer=this.scene.time.addEvent({delay:250,callback:()=>this.canJump=!0}))}checkShoot(){if(this.canShoot&&(Phaser.Input.Keyboard.JustDown(this.cursor.down)||Phaser.Input.Keyboard.JustDown(this.W))){const t=this.sprite.flipX?128:-128;this.sprite.anims.play("playershot",!0),this.scene.playAudio("bubble"),this.canShoot=!1,new Bubble(this.scene,this.sprite.x,this.sprite.y,t),this.shootCooldownTimer=this.scene.time.addEvent({delay:500,callback:()=>this.canShoot=!0})}}destroy(){this.scene.playAudio("death"),this.destroyed=!0,this.scene.events.off("update",this.update,this),this.scene.events.off("shutdown",this.destroy,this),this.scene.events.off("destroy",this.destroy,this),this.scene.matter.world&&this.scene.matter.world.off("beforeupdate",this.resetTouching,this);const t=[this.sensors.bottom,this.sensors.left,this.sensors.right];this.scene.matterCollision.removeOnCollideStart({objectA:t}),this.scene.matterCollision.removeOnCollideActive({objectA:t}),this.jumpCooldownTimer&&this.jumpCooldownTimer.destroy(),this.sprite.destroy()}step(){Phaser.Math.Between(0,5)>4&&this.scene.trailLayer.add(new Dust(this.scene,this.sprite.x,this.sprite.y+Phaser.Math.Between(10,16)))}friction(){Array(Phaser.Math.Between(2,4)).fill(0).forEach((t=>{new Dust(this.scene,this.sprite.x+Phaser.Math.Between(-8,8),this.sprite.y+Phaser.Math.Between(-32,32))}))}land(){this.sprite.body.velocity.y<1||Array(Phaser.Math.Between(3,6)).fill(0).forEach((t=>{new Dust(this.scene,this.sprite.x+Phaser.Math.Between(-32,32),this.sprite.y+Phaser.Math.Between(10,16))}))}explosion(){Array(Phaser.Math.Between(10,15)).fill(0).forEach((t=>{new Dust(this.scene,this.sprite.x+Phaser.Math.Between(-32,32),this.sprite.y+Phaser.Math.Between(20,36))}))}animationComplete(t,e){"playershot"===t.key&&this.sprite.anims.play("playeridle",!0)}}var dungeon_min={exports:{}};"undefined"!=typeof self&&self,dungeon_min.exports=function(){return s={},t.m=e=[function(t,e){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,s){var i=s(4),n=s(5),o=s(6),a=s(7),r=s(8),l=s(9),h=s(10);h.alea=i,h.xor128=n,h.xorwow=o,h.xorshift7=a,h.xor4096=r,h.tychei=l,t.exports=h},function(t,e,s){(function(t){var i;!function(t){function n(t){var e,s=this,i=(e=4022871197,function(t){t=String(t);for(var s=0;s>>0,e=(i*=e)>>>0,e+=4294967296*(i-=e)}return 2.3283064365386963e-10*(e>>>0)});s.next=function(){var t=2091639*s.s0+2.3283064365386963e-10*s.c;return s.s0=s.s1,s.s1=s.s2,s.s2=t-(s.c=0|t)},s.c=1,s.s0=i(" "),s.s1=i(" "),s.s2=i(" "),s.s0-=i(t),s.s0<0&&(s.s0+=1),s.s1-=i(t),s.s1<0&&(s.s1+=1),s.s2-=i(t),s.s2<0&&(s.s2+=1),i=null}function o(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function a(t,e){var s=new n(t),i=e&&e.state,a=s.next;return a.int32=function(){return 4294967296*s.next()|0},a.double=function(){return a()+11102230246251565e-32*(2097152*a()|0)},a.quick=a,i&&("object"==typeof i&&o(i,s),a.state=function(){return o(s,{})}),a}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.alea=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){(function(t){var i;!function(t){function n(t){var e=this,s="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:s+=t;for(var i=0;i>>0)/4294967296}var i=new n(t),a=e&&e.state;return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,a&&("object"==typeof a&&o(a,i),s.state=function(){return o(i,{})}),s}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.xor128=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){(function(t){var i;!function(t){function n(t){var e=this,s="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,t===((e.v=0)|t)?e.x=t:s+=t;for(var i=0;i>>4),e.next()}function o(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function a(t,e){function s(){return(i.next()>>>0)/4294967296}var i=new n(t),a=e&&e.state;return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,a&&("object"==typeof a&&o(a,i),s.state=function(){return o(i,{})}),s}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.xorwow=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){(function(t){var i;!function(t){function n(t){var e=this;e.next=function(){var t,s,i=e.x,n=e.i;return t=i[n],s=(t^=t>>>7)^t<<24,s^=(t=i[n+1&7])^t>>>10,s^=(t=i[n+3&7])^t>>>3,s^=(t=i[n+4&7])^t<<7,t=i[n+7&7],s^=(t^=t<<13)^t<<9,i[n]=s,e.i=n+1&7,s},function(t,e){var s,i=[];if(e===(0|e))i[0]=e;else for(e=""+e,s=0;s>>0)/4294967296}null==t&&(t=+new Date);var i=new n(t),a=e&&e.state;return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,a&&(a.x&&o(a,i),s.state=function(){return o(i,{})}),s}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.xorshift7=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){(function(t){var i;!function(t){function n(t){var e=this;e.next=function(){var t,s,i=e.w,n=e.X,o=e.i;return e.w=i=i+1640531527|0,s=n[o+34&127],t=n[o=o+1&127],s^=s<<13,t^=t<<17,s^=s>>>15,t^=t>>>12,s=n[o]=s^t,e.i=o,s+(i^i>>>16)|0},function(t,e){var s,i,n,o,a,r=[],l=128;for(e===(0|e)?(i=e,e=null):(e+="\0",i=0,l=Math.max(l,e.length)),n=0,o=-32;o>>15,i^=i<<4,i^=i>>>13,0<=o&&(a=a+1640531527|0,n=0==(s=r[127&o]^=i+a)?n+1:0);for(128<=n&&(r[127&(e&&e.length||0)]=-1),n=127,o=512;0>>15,s^=s>>>12,r[n]=i^s;t.w=a,t.X=r,t.i=n}(e,t)}function o(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function a(t,e){function s(){return(i.next()>>>0)/4294967296}null==t&&(t=+new Date);var i=new n(t),a=e&&e.state;return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,a&&(a.X&&o(a,i),s.state=function(){return o(i,{})}),s}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.xor4096=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){(function(t){var i;!function(t){function n(t){var e=this,s="";e.next=function(){var t=e.b,s=e.c,i=e.d,n=e.a;return t=t<<25^t>>>7^s,s=s-i|0,i=i<<24^i>>>8^n,n=n-t|0,e.b=t=t<<20^t>>>12^s,e.c=s=s-i|0,e.d=i<<16^s>>>16^n,e.a=n-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):s+=t;for(var i=0;i>>0)/4294967296}var i=new n(t),a=e&&e.state;return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,a&&("object"==typeof a&&o(a,i),s.state=function(){return o(i,{})}),s}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.tychei=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){var i;!function(n,o,a){var r,l=256,h=a.pow(l,6),d=a.pow(2,52),c=2*d,Q=l-1;function B(t,e,s){function i(){for(var t=u.g(6),e=h,s=0;t>>=1;return(t+s)/e}var Q=[],B=b(function t(e,s){var i,n=[],o=typeof e;if(s&&"object"==o)for(i in e)try{n.push(t(e[i],s-1))}catch(a){}return n.length?n:"string"==o?e:e+"\0"}((e=1==e?{entropy:!0}:e||{}).entropy?[t,g(o)]:null==t?function(){try{var t;return r&&(t=r.randomBytes)?t=t(l):(t=new Uint8Array(l),(n.crypto||n.msCrypto).getRandomValues(t)),g(t)}catch(i){var e=n.navigator,s=e&&e.plugins;return[+new Date,n,s,n.screen,g(o)]}}():t,3),Q),u=new F(Q);return i.int32=function(){return 0|u.g(4)},i.quick=function(){return u.g(4)/4294967296},i.double=i,b(g(u.S),o),(e.pass||s||function(t,e,s,i){return i&&(i.S&&U(i,u),t.state=function(){return U(u,{})}),s?(a.random=t,e):t})(i,B,"global"in e?e.global:this==a,e.state)}function F(t){var e,s=t.length,i=this,n=0,o=i.i=i.j=0,a=i.S=[];for(s||(t=[s++]);nt.right||this.bottomt.bottom)},c.prototype.isInBounds=function(t,e){return 0<=t&&tthis.width)throw new Error("Room max width cannot exceed dungeon width.");if(this.roomHeightConfig.max>this.height)throw new Error("Room max height cannot exceed dungeon height.");if(this.maxRoomArea= min.");if(s<3)throw new Error("Room width and height must be >= 3.")},b.prototype.getConfig=function(){return{width:this.width,height:this.height,doorPadding:this.doorPadding,randomSeed:this.randomSeed,rooms:{width:this.roomWidthConfig,height:this.roomHeightConfig,maxArea:this.maxRoomArea,maxRooms:this.maxRooms}}},b.prototype.drawToConsole=function(t){!function(t,e){void 0===e&&(e={});var s=Object.assign({},{empty:" ",emptyColor:"rgb(0, 0, 0)",wall:"#",wallColor:"rgb(255, 0, 0)",floor:"_",floorColor:"rgb(210, 210, 210)",door:".",doorColor:"rgb(0, 0, 255)",fontSize:"15px"},e),i="",n=[];i+="Dungeon: the console window should be big enough to see all of the guide on the next line:\n",i+="%c|"+"=".repeat(2*t.width-2)+"|\n\n",n.push("font-size: "+s.fontSize);for(var o=0;o"+s.empty+"",floor:""+s.floor+"",door:""+s.door+"",wall:""+s.wall+""}).map((function(t){return""+t.join("")+""})).join("");return"
"+i+"
"}(t,e);return document.createRange().createContextualFragment(s)}(this,t)},b.prototype.getMappedTiles=function(t){return void 0===t&&(t={}),t=Object.assign({},{empty:0,wall:1,floor:2,door:3},t),this.tiles.map((function(e){return e.map((function(e){return e===l.EMPTY?t.empty:e===l.WALL?t.wall:e===l.FLOOR?t.floor:e===l.DOOR?t.door:void 0}))}))},b.prototype.getCenter=function(){return{x:Math.floor(this.width/2),y:Math.floor(this.height/2)}},b.prototype.generate=function(){this.rooms=[],this.roomGrid=[];for(var t=0;t=this.width||e>=this.height||0this.width-1)return!1;if(t.y<0||t.bottom>this.height-1)return!1;for(var e=0;ethis.maxRoomArea;);return new Q(t,e)},b.prototype.generateRoom=function(){for(var t=this.createRandomRoom(),e=150;0{const{x:e,y:s,width:i,height:n}=t;this.groundLayer.weightedRandomize([{index:17,weight:9},{index:[7,8,9,17,18,19],weight:1}],e+1,s+1,i-2,n-2),this.placeCorners(t),this.placeWalls(t);const o=t.getDoorLocations();this.addDoors(t,o,e,s),this.addKey(t),this.addFoes(t),this.addCoins(t),this.addSeeSaw(t)}))}generateDungeon(){this.dungeon=new Dungeon({width:50,height:50,doorPadding:2,rooms:{width:{min:7,max:15},height:{min:7,max:15},maxRooms:12}})}generateMap(){this.map=this.scene.make.tilemap({tileWidth:48,tileHeight:48,width:this.dungeon.width,height:this.dungeon.height});const t=this.map.addTilesetImage("tiles",null,48,48,0,0);this.groundLayer=this.map.createBlankLayer("Layer 1",t),this.stuffLayer=this.map.createBlankLayer("Stuff",t);const e=this.dungeon.getMappedTiles({empty:-1,floor:-1,door:3,wall:0});this.groundLayer.putTilesAt(e,0,0),this.groundLayer.setCollision(0),this.groundLayer.setCollisionByProperty({collides:!0}),this.scene.matter.world.convertTilemapLayer(this.groundLayer)}placeCorners(t){const{left:e,right:s,top:i,bottom:n}=t;this.groundLayer.putTileAt(0,e,i),this.groundLayer.putTileAt(5,s,i),this.groundLayer.putTileAt(45,s,n),this.groundLayer.putTileAt(40,e,n)}placeWalls(t){const{width:e,height:s,left:i,right:n,top:o,bottom:a}=t;this.groundLayer.weightedRandomize([{index:2,weight:4},{index:[1,2,3,4],weight:1}],i+1,o,e-2,1),this.groundLayer.weightedRandomize([{index:42,weight:4},{index:[41,42,43,44],weight:1}],i+1,a,e-2,1),this.groundLayer.weightedRandomize([{index:10,weight:4},{index:[10,20,30],weight:1}],i,o+1,1,s-2),this.groundLayer.weightedRandomize([{index:15,weight:4},{index:[15,25,35],weight:1}],n,o+1,1,s-2)}addDoors(t,e,s,i){for(let n=0;n{Array(s).fill().forEach(((t,s)=>{const o=this.groundLayer.tileToWorldXY(n+e,i+s);new Coin(this.scene,o.x+20,o.y+20)}))}))}addCoinsdBottom(t,e,s){const i=t.bottom-Phaser.Math.Between(1,2),n=t.left+Phaser.Math.Between(1,2);Array(e).fill().forEach(((t,e)=>{Array(s).fill().forEach(((t,s)=>{const o=this.groundLayer.tileToWorldXY(n+e,i-s);new Coin(this.scene,o.x+20,o.y+20)}))}))}addCoinsdLeft(t,e,s){const i=t.top+Phaser.Math.Between(3,4),n=t.left+Phaser.Math.Between(1,2);Array(e).fill().forEach(((t,e)=>{Array(s).fill().forEach(((t,s)=>{const o=this.groundLayer.tileToWorldXY(n+e,i-s);new Coin(this.scene,o.x+20,o.y+20)}))}))}addCoinsdRight(t,e,s){const i=t.top+Phaser.Math.Between(1,2),n=t.right-Phaser.Math.Between(3,4);Array(e).fill().forEach(((t,e)=>{Array(s).fill().forEach(((t,s)=>{const o=this.groundLayer.tileToWorldXY(n-e,i+s);new Coin(this.scene,o.x+20,o.y+20)}))}))}addFoes(t){const e=Phaser.Math.Between(t.left+2,t.right-2),s=Phaser.Math.Between(t.top+2,t.bottom-2),i=this.groundLayer.tileToWorldXY(e,s);Phaser.Math.Between(0,5)>4?new Wizard(this.scene,i.x+22,i.y+22,this.groundLayer):new Bat(this.scene,i.x+22,i.y+22,this.groundLayer)}addTopTraps(t){const{x:e,y:s,width:i,height:n,left:o,right:a,top:r,bottom:l,tiles:h}=t;h[0].forEach(((t,e)=>{1===t&&e>0&&ethis.finishScene()),this)}addScores(){this.add.sprite(62,26,"coin",0).setOrigin(.5).setScrollFactor(0).setScale(.8),this.scoreCoins=this.add.bitmapText(100,24,"default","x0",15).setOrigin(.5).setScrollFactor(0),this.scoreSeconds=this.add.bitmapText(this.center_width,24,"default","0",15).setOrigin(.5).setScrollFactor(0),this.add.sprite(this.width-90,24,"keys",0).setOrigin(.5).setScrollFactor(0).setScale(.8),this.scoreKeys=this.add.bitmapText(this.width-48,24,"default","x0",15).setOrigin(.5).setScrollFactor(0),this.timer=this.time.addEvent({delay:1e3,callback:()=>{this.updateSeconds()},callbackScope:this,loop:!0})}addPlayer(){this.trailLayer=this.add.layer(),this.player=new Player(this,this.dungeon.map.widthInPixels/2,this.dungeon.map.heightInPixels/2,100)}addCollisions(){this.unsubscribePlayerCollide=this.matterCollision.addOnCollideStart({objectA:this.player.sprite,callback:this.onPlayerCollide,context:this}),this.matter.world.on("collisionstart",(t=>{t.pairs.forEach((t=>{t.bodyA,t.bodyB}))}))}onPlayerCollide({gameObjectA:t,gameObjectB:e}){e&&("coin"===e.label&&this.playerPicksCoin(e),"keys"===e.label&&this.playerPicksKey(e),"bat"===e.label&&this.playerHitsFoe(e),"wizard"===e.label&&this.playerHitsFoe(e),"fireball"===e.label&&this.playerHitsFoe(e),e instanceof Phaser.Tilemaps.Tile&&e.properties.isLethal&&(this.unsubscribePlayerCollide(),this.restartScene()))}playerPicksCoin(t){this.showPoints(t.x,t.y,1,this.scoreCoins),t.destroy(),this.updateCoins(),this.playAudio("coin")}playerPicksKey(t){this.updateKeys(),this.showPoints(t.x,t.y,this.registry.get("keys")+"/"+this.dungeon.dungeon.rooms.length,this.scoreKeys),t.destroy()}playerHitsFoe(t){this.player.invincible||(this.player.explosion(),t.destroy(),this.restartScene())}showPoints(t,e,s,i,n=16777215){let o=this.add.bitmapText(t+20,e-80,"default","+"+s,10).setDropShadow(2,3,n,.7).setOrigin(.5);this.tweens.add({targets:o,duration:1e3,alpha:{from:1,to:0},x:{from:o.x+Phaser.Math.Between(-10,10),to:o.x+Phaser.Math.Between(-40,40)},y:{from:o.y-10,to:o.y-60},onComplete:()=>{o.destroy()}}),this.textUpdateEffect(i,n)}addCamera(){this.cameras.main.setBounds(0,0,this.dungeon.map.widthInPixels,this.dungeon.map.heightInPixels),this.cameras.main.startFollow(this.player.sprite,!1,.5,.5),this.cameras.main.setBackgroundColor(2429722)}loadAudios(){this.audios={jump:this.sound.add("jump"),bubble:this.sound.add("bubble"),trap:this.sound.add("trap"),crash:this.sound.add("crash"),fireball:this.sound.add("fireball"),death:this.sound.add("death"),coin:this.sound.add("start")}}playAudio(t){this.audios[t].play()}restartScene(){this.player.sprite.visible=!1,this.cameras.main.shake(100),this.cameras.main.fade(250,0,0,0),this.cameras.main.once("camerafadeoutcomplete",(()=>this.scene.restart()))}finishScene(){this.cameras.main.fade(250,0,0,0),this.cameras.main.once("camerafadeoutcomplete",(()=>{this.scene.start("outro",{next:"underwater",name:"STAGE",number:this.number+1})}))}updateSeconds(t=1){const e=+this.registry.get("seconds")+t;this.registry.set("seconds",e),this.scoreSeconds.setText(e)}updateCoins(t=1){const e=+this.registry.get("coins")+t;this.registry.set("coins",e),this.scoreCoins.setText("x"+e)}updateKeys(t=1){const e=+this.registry.get("keys")+t;this.registry.set("keys",e),this.scoreKeys.setText("x"+e),e===this.dungeon.dungeon.rooms.length&&this.finishScene()}textUpdateEffect(t,e){t.setTint(e);const s=t.y;this.tweens.add({targets:t,duration:100,alpha:{from:1,to:.8},scale:{from:1.2,to:1},repeat:5,onComplete:()=>{t.setTint(16777215),t.y=s}})}}var phaserMatterCollision={exports:{}};(function(module,exports){var factory;"undefined"!=typeof self&&self,factory=function(__WEBPACK_EXTERNAL_MODULE_phaser__){return(()=>{var __webpack_modules__={"./index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "PhaserMatterCollisionPlugin": () => (/* reexport safe */ _phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__.default),\n/* harmony export */ "getRootBody": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody),\n/* harmony export */ "isCollidingObject": () => (/* reexport safe */ _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__.isCollidingObject),\n/* harmony export */ "isMatterBody": () => (/* reexport safe */ _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__.isMatterBody),\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./phaser-matter-collision-plugin */ "./phaser-matter-collision-plugin.ts");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./utils.ts");\n/* harmony import */ var _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./valid-collision-object */ "./valid-collision-object.ts");\n\r\n\r\n\r\n\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__.default);\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9pbmRleC50cz9hOTU5Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBQTJFO0FBQ3JDO0FBTUo7QUEyQmhDO0FBRUYsaUVBQWUsb0VBQTJCLEVBQUMiLCJmaWxlIjoiLi9pbmRleC50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBQaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4gZnJvbSBcIi4vcGhhc2VyLW1hdHRlci1jb2xsaXNpb24tcGx1Z2luXCI7XG5pbXBvcnQgeyBnZXRSb290Qm9keSB9IGZyb20gXCIuL3V0aWxzXCI7XG5pbXBvcnQge1xuICBpc0NvbGxpZGluZ09iamVjdCxcbiAgaXNNYXR0ZXJCb2R5LFxuICBPYmplY3RXaXRoQm9keSxcbiAgQ29sbGlkaW5nT2JqZWN0LFxufSBmcm9tIFwiLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0XCI7XG5pbXBvcnQge1xuICBFeHRlbmRlZE1hdHRlckNvbGxpc2lvbkRhdGEsXG4gIENvbGxpc2lvbkV2ZW50LFxuICBFdmVudERhdGEsXG4gIENvbGxpZGVDYWxsYmFjayxcbiAgQ29sbGlkZUFDb25maWcsXG4gIENvbGxpZGVBQkNvbmZpZyxcbiAgQ29sbGlkZUNvbnRleHQsXG4gIFVuc3Vic2NyaWJlLFxufSBmcm9tIFwiLi9jb2xsaXNpb24tdHlwZXNcIjtcblxuZXhwb3J0IHtcbiAgUGhhc2VyTWF0dGVyQ29sbGlzaW9uUGx1Z2luLFxuICBnZXRSb290Qm9keSxcbiAgaXNDb2xsaWRpbmdPYmplY3QsXG4gIGlzTWF0dGVyQm9keSxcbiAgT2JqZWN0V2l0aEJvZHksXG4gIENvbGxpZGluZ09iamVjdCxcbiAgRXh0ZW5kZWRNYXR0ZXJDb2xsaXNpb25EYXRhLFxuICBDb2xsaXNpb25FdmVudCxcbiAgRXZlbnREYXRhLFxuICBDb2xsaWRlQ2FsbGJhY2ssXG4gIENvbGxpZGVBQ29uZmlnLFxuICBDb2xsaWRlQUJDb25maWcsXG4gIENvbGxpZGVDb250ZXh0LFxuICBVbnN1YnNjcmliZSxcbn07XG5cbmV4cG9ydCBkZWZhdWx0IFBoYXNlck1hdHRlckNvbGxpc2lvblBsdWdpbjtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./index.ts\n')},"./logger.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\r\n log: console.log,\r\n warn: console.warn,\r\n error: console.error,\r\n});\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9sb2dnZXIudHM/Zjk0OSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsaUVBQWU7SUFDYixHQUFHLEVBQUUsT0FBTyxDQUFDLEdBQUc7SUFDaEIsSUFBSSxFQUFFLE9BQU8sQ0FBQyxJQUFJO0lBQ2xCLEtBQUssRUFBRSxPQUFPLENBQUMsS0FBSztDQUNyQixFQUFDIiwiZmlsZSI6Ii4vbG9nZ2VyLnRzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQge1xuICBsb2c6IGNvbnNvbGUubG9nLFxuICB3YXJuOiBjb25zb2xlLndhcm4sXG4gIGVycm9yOiBjb25zb2xlLmVycm9yLFxufTtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./logger.ts\n')},"./phaser-matter-collision-plugin.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ MatterCollisionPlugin)\n/* harmony export */ });\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! phaser */ "phaser");\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(phaser__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./utils.ts");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ "./logger.ts");\n/* harmony import */ var _valid_collision_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./valid-collision-object */ "./valid-collision-object.ts");\n\r\n\r\n\r\n\r\nvar Matter = phaser__WEBPACK_IMPORTED_MODULE_0__.Physics.Matter;\r\nconst { START, DESTROY, SHUTDOWN } = phaser__WEBPACK_IMPORTED_MODULE_0__.Scenes.Events;\r\nconst { COLLISION_START, COLLISION_ACTIVE, COLLISION_END } = Matter.Events;\r\n/**\r\n * @export\r\n */\r\nclass MatterCollisionPlugin extends phaser__WEBPACK_IMPORTED_MODULE_0__.Plugins.ScenePlugin {\r\n constructor(scene, pluginManager, pluginKey) {\r\n super(scene, pluginManager, pluginKey);\r\n this.scene = scene;\r\n this.pluginManager = pluginManager;\r\n this.events = new phaser__WEBPACK_IMPORTED_MODULE_0__.Events.EventEmitter();\r\n this.collisionStartListeners = new Map();\r\n this.collisionEndListeners = new Map();\r\n this.collisionActiveListeners = new Map();\r\n this.scene = scene;\r\n this.scene.events.once(START, this.start, this);\r\n this.scene.events.once(DESTROY, this.destroy, this);\r\n }\r\n addOnCollideStart(config) {\r\n // Note: the order of overloads is important! TS matches the first one it can, so this needs\r\n // the most specific/constrained signature first.\r\n this.addOnCollide(this.collisionStartListeners, config);\r\n return () => this.removeOnCollide(this.collisionStartListeners, config);\r\n }\r\n addOnCollideEnd(config) {\r\n this.addOnCollide(this.collisionEndListeners, config);\r\n return () => this.removeOnCollide(this.collisionEndListeners, config);\r\n }\r\n addOnCollideActive(config) {\r\n this.addOnCollide(this.collisionActiveListeners, config);\r\n return () => this.removeOnCollide(this.collisionActiveListeners, config);\r\n }\r\n removeOnCollideStart(config) {\r\n this.removeOnCollide(this.collisionStartListeners, config);\r\n }\r\n removeOnCollideEnd(config) {\r\n this.removeOnCollide(this.collisionEndListeners, config);\r\n }\r\n removeOnCollideActive(config) {\r\n this.removeOnCollide(this.collisionActiveListeners, config);\r\n }\r\n /** Remove any listeners that were added with addOnCollideStart. */\r\n removeAllCollideStartListeners() {\r\n this.collisionStartListeners.clear();\r\n }\r\n /** Remove any listeners that were added with addOnCollideActive. */\r\n removeAllCollideActiveListeners() {\r\n this.collisionActiveListeners.clear();\r\n }\r\n /** Remove any listeners that were added with addOnCollideEnd. */\r\n removeAllCollideEndListeners() {\r\n this.collisionEndListeners.clear();\r\n }\r\n /**\r\n * Remove any listeners that were added with addOnCollideStart, addOnCollideActive or\r\n * addOnCollideEnd.\r\n */\r\n removeAllCollideListeners() {\r\n this.removeAllCollideStartListeners();\r\n this.removeAllCollideActiveListeners();\r\n this.removeAllCollideEndListeners();\r\n }\r\n addOnCollide(map, config) {\r\n const { context, callback, objectA, objectB } = config;\r\n if (!callback || typeof callback !== "function") {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__.default.warn(`No valid callback specified. Received: ${callback}`);\r\n return;\r\n }\r\n const objectsA = Array.isArray(objectA) ? objectA : [objectA];\r\n const objectsB = Array.isArray(objectB) ? objectB : [objectB];\r\n objectsA.forEach((a) => {\r\n objectsB.forEach((b) => {\r\n this.addOnCollideObjectVsObject(map, a, b, callback, context);\r\n });\r\n });\r\n }\r\n removeOnCollide(map, config) {\r\n const { context, callback, objectA, objectB } = config;\r\n const objectsA = Array.isArray(objectA) ? objectA : [objectA];\r\n const objectsB = Array.isArray(objectB) ? objectB : [objectB];\r\n objectsA.forEach((a) => {\r\n const callbacks = map.get(a) || [];\r\n const remainingCallbacks = callbacks.filter((cb) => {\r\n // If anything doesn\'t match a provided config value (i.e. anything other than undefined),\r\n // we can bail and keep listener.\r\n if (context !== undefined && cb.context !== context)\r\n return true;\r\n if (callback !== undefined && cb.callback !== callback)\r\n return true;\r\n if (objectB !== undefined && !objectsB.includes(cb.target))\r\n return true;\r\n return false;\r\n });\r\n if (remainingCallbacks.length > 0)\r\n map.set(a, remainingCallbacks);\r\n else\r\n map.delete(a);\r\n });\r\n }\r\n addOnCollideObjectVsObject(map, objectA, objectB, callback, context) {\r\n // Can\'t do anything if the first object is not defined or invalid.\r\n if (!objectA || !(0,_valid_collision_object__WEBPACK_IMPORTED_MODULE_3__.isCollidingObject)(objectA)) {\r\n (0,_utils__WEBPACK_IMPORTED_MODULE_1__.warnInvalidObject)(objectA);\r\n return;\r\n }\r\n // The second object can be undefined or a valid body.\r\n if (objectB && !(0,_valid_collision_object__WEBPACK_IMPORTED_MODULE_3__.isCollidingObject)(objectB)) {\r\n (0,_utils__WEBPACK_IMPORTED_MODULE_1__.warnInvalidObject)(objectA);\r\n return;\r\n }\r\n const callbacks = map.get(objectA) || [];\r\n callbacks.push({ target: objectB, callback, context });\r\n map.set(objectA, callbacks);\r\n }\r\n onCollisionStart(event) {\r\n this.onCollisionEvent(this.collisionStartListeners, COLLISION_START, event);\r\n }\r\n onCollisionEnd(event) {\r\n this.onCollisionEvent(this.collisionEndListeners, COLLISION_END, event);\r\n }\r\n onCollisionActive(event) {\r\n this.onCollisionEvent(this.collisionActiveListeners, COLLISION_ACTIVE, event);\r\n }\r\n /**\r\n * Reusable handler for collisionstart, collisionend, collisionactive.\r\n * */\r\n onCollisionEvent(listenerMap, eventName, event) {\r\n const pairs = event.pairs;\r\n const pairEventName = "pair" + eventName;\r\n const eventData = { isReversed: false };\r\n const eventDataReversed = { isReversed: true };\r\n pairs.map((pair, i) => {\r\n var _a, _b;\r\n const { bodyA, bodyB } = pair;\r\n const rootBodyA = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody)(bodyA);\r\n const rootBodyB = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody)(bodyB);\r\n let gameObjectA = (_a = rootBodyA.gameObject) !== null && _a !== void 0 ? _a : undefined;\r\n let gameObjectB = (_b = rootBodyB.gameObject) !== null && _b !== void 0 ? _b : undefined;\r\n // Special case for tiles, where it\'s more useful to have a reference to the Tile object not\r\n // the TileBody. This is hot code, so use a property check instead of instanceof.\r\n if (gameObjectA && gameObjectA instanceof Matter.TileBody) {\r\n gameObjectA = gameObjectA.tile;\r\n }\r\n if (gameObjectB && gameObjectB instanceof Matter.TileBody) {\r\n gameObjectB = gameObjectB.tile;\r\n }\r\n pairs[i].gameObjectA = gameObjectA !== null && gameObjectA !== void 0 ? gameObjectA : undefined;\r\n pairs[i].gameObjectB = gameObjectB !== null && gameObjectB !== void 0 ? gameObjectB : undefined;\r\n eventData.bodyA = bodyA;\r\n eventData.bodyB = bodyB;\r\n eventData.gameObjectA = gameObjectA !== null && gameObjectA !== void 0 ? gameObjectA : undefined;\r\n eventData.gameObjectB = gameObjectB !== null && gameObjectB !== void 0 ? gameObjectB : undefined;\r\n eventData.pair = pair;\r\n this.events.emit(pairEventName, eventData);\r\n if (listenerMap.size > 0) {\r\n eventDataReversed.bodyB = bodyA;\r\n eventDataReversed.bodyA = bodyB;\r\n eventDataReversed.gameObjectB = gameObjectA;\r\n eventDataReversed.gameObjectA = gameObjectB;\r\n eventDataReversed.pair = pair;\r\n const data = eventData;\r\n const dataReversed = eventDataReversed;\r\n this.checkPairAndEmit(listenerMap, bodyA, bodyB, gameObjectB, data);\r\n this.checkPairAndEmit(listenerMap, bodyB, bodyA, gameObjectA, dataReversed);\r\n if (gameObjectA) {\r\n this.checkPairAndEmit(listenerMap, gameObjectA, bodyB, gameObjectB, data);\r\n }\r\n if (gameObjectB) {\r\n this.checkPairAndEmit(listenerMap, gameObjectB, bodyA, gameObjectA, dataReversed);\r\n }\r\n }\r\n });\r\n this.events.emit(eventName, event);\r\n }\r\n checkPairAndEmit(map, objectA, bodyB, gameObjectB, eventData) {\r\n const callbacks = map.get(objectA);\r\n if (callbacks) {\r\n callbacks.forEach(({ target, callback, context }) => {\r\n if (!target || target === bodyB || target === gameObjectB) {\r\n callback.call(context, eventData);\r\n }\r\n });\r\n }\r\n }\r\n subscribeMatterEvents() {\r\n const matter = this.scene.matter;\r\n if (!matter || !matter.world) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__.default.warn("Plugin requires matter!");\r\n return;\r\n }\r\n matter.world.on(COLLISION_START, this.onCollisionStart, this);\r\n matter.world.on(COLLISION_ACTIVE, this.onCollisionActive, this);\r\n matter.world.on(COLLISION_END, this.onCollisionEnd, this);\r\n }\r\n unsubscribeMatterEvents() {\r\n // Don\'t unsub if matter next existing or if the game is destroyed (since the matter world will\r\n // be already gone)\r\n const matter = this.scene.matter;\r\n if (!matter || !matter.world)\r\n return;\r\n matter.world.off(COLLISION_START, this.onCollisionStart, this);\r\n matter.world.off(COLLISION_ACTIVE, this.onCollisionActive, this);\r\n matter.world.off(COLLISION_END, this.onCollisionEnd, this);\r\n }\r\n start() {\r\n // If restarting, unsubscribe before resubscribing to ensure only one listener is added\r\n this.scene.events.off(SHUTDOWN, this.shutdown, this);\r\n this.scene.events.on(SHUTDOWN, this.shutdown, this);\r\n this.subscribeMatterEvents();\r\n }\r\n shutdown() {\r\n this.removeAllCollideListeners();\r\n this.unsubscribeMatterEvents();\r\n // Resubscribe to start so that the plugin is started again after Matter\r\n this.scene.events.once(START, this.start, this);\r\n }\r\n destroy() {\r\n this.scene.events.off(DESTROY, this.destroy, this);\r\n this.scene.events.off(START, this.start, this);\r\n this.scene.events.off(SHUTDOWN, this.shutdown, this);\r\n this.removeAllCollideListeners();\r\n this.unsubscribeMatterEvents();\r\n }\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9waGFzZXItbWF0dGVyLWNvbGxpc2lvbi1wbHVnaW4udHM/OGI5OCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBMkU7QUFDbEI7QUFDM0I7QUFDc0Q7QUFnQnBGLElBQU8sTUFBTSxHQUFHLGtEQUFjLENBQUM7QUFFL0IsTUFBTSxFQUFFLEtBQUssRUFBRSxPQUFPLEVBQUUsUUFBUSxFQUFFLEdBQUcsaURBQWEsQ0FBQztBQUNuRCxNQUFNLEVBQUUsZUFBZSxFQUFFLGdCQUFnQixFQUFFLGFBQWEsRUFBRSxHQUFHLE1BQU0sQ0FBQyxNQUFNLENBQUM7QUFPM0U7O0dBRUc7QUFDWSxNQUFNLHFCQUFzQixTQUFRLHVEQUFtQjtJQU9wRSxZQUNZLEtBQVksRUFDWixhQUFvQyxFQUM5QyxTQUFpQjtRQUVqQixLQUFLLENBQUMsS0FBSyxFQUFFLGFBQWEsRUFBRSxTQUFTLENBQUMsQ0FBQztRQUo3QixVQUFLLEdBQUwsS0FBSyxDQUFPO1FBQ1osa0JBQWEsR0FBYixhQUFhLENBQXVCO1FBUnpDLFdBQU0sR0FBRyxJQUFJLHVEQUFtQixFQUFFLENBQUM7UUFFbEMsNEJBQXVCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFDakQsMEJBQXFCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFDL0MsNkJBQXdCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFReEQsSUFBSSxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7UUFDbkIsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ2hELElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQztJQUN0RCxDQUFDO0lBVU0saUJBQWlCLENBQUMsTUFBNkI7UUFDcEQsNEZBQTRGO1FBQzVGLGlEQUFpRDtRQUNqRCxJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyx1QkFBdUIsRUFBRSxNQUFNLENBQUMsQ0FBQztRQUN4RCxPQUFPLEdBQUcsRUFBRSxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQzFFLENBQUM7SUFLTSxlQUFlLENBQUMsTUFBNkI7UUFDbEQsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMscUJBQXFCLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDdEQsT0FBTyxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxxQkFBcUIsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUN4RSxDQUFDO0lBS00sa0JBQWtCLENBQUMsTUFBNkI7UUFDckQsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsd0JBQXdCLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDekQsT0FBTyxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUMzRSxDQUFDO0lBVU0sb0JBQW9CLENBQUMsTUFBbUM7UUFDN0QsSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsdUJBQXVCLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFDN0QsQ0FBQztJQUtNLGtCQUFrQixDQUFDLE1BQW1DO1FBQzNELElBQUksQ0FBQyxlQUFlLENBQUMsSUFBSSxDQUFDLHFCQUFxQixFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQzNELENBQUM7SUFLTSxxQkFBcUIsQ0FBQyxNQUFtQztRQUM5RCxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUM5RCxDQUFDO0lBRUQsbUVBQW1FO0lBQzVELDhCQUE4QjtRQUNuQyxJQUFJLENBQUMsdUJBQXVCLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDdkMsQ0FBQztJQUVELG9FQUFvRTtJQUM3RCwrQkFBK0I7UUFDcEMsSUFBSSxDQUFDLHdCQUF3QixDQUFDLEtBQUssRUFBRSxDQUFDO0lBQ3hDLENBQUM7SUFFRCxpRUFBaUU7SUFDMUQsNEJBQTRCO1FBQ2pDLElBQUksQ0FBQyxxQkFBcUIsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUNyQyxDQUFDO0lBRUQ7OztPQUdHO0lBQ0kseUJBQXlCO1FBQzlCLElBQUksQ0FBQyw4QkFBOEIsRUFBRSxDQUFDO1FBQ3RDLElBQUksQ0FBQywrQkFBK0IsRUFBRSxDQUFDO1FBQ3ZDLElBQUksQ0FBQyw0QkFBNEIsRUFBRSxDQUFDO0lBQ3RDLENBQUM7SUFFTyxZQUFZLENBQUMsR0FBZ0IsRUFBRSxNQUE2QjtRQUNsRSxNQUFNLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFLEdBQUcsTUFBTSxDQUFDO1FBQ3ZELElBQUksQ0FBQyxRQUFRLElBQUksT0FBTyxRQUFRLEtBQUssVUFBVSxFQUFFO1lBQy9DLGlEQUFXLENBQUMsMENBQTBDLFFBQVEsRUFBRSxDQUFDLENBQUM7WUFDbEUsT0FBTztTQUNSO1FBQ0QsTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQzlELE1BQU0sUUFBUSxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUM5RCxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUU7WUFDckIsUUFBUSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFO2dCQUNyQixJQUFJLENBQUMsMEJBQTBCLENBQUMsR0FBRyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1lBQ2hFLENBQUMsQ0FBQyxDQUFDO1FBQ0wsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDO0lBRU8sZUFBZSxDQUFDLEdBQWdCLEVBQUUsTUFBbUM7UUFDM0UsTUFBTSxFQUFFLE9BQU8sRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLE1BQU0sQ0FBQztRQUN2RCxNQUFNLFFBQVEsR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDOUQsTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQzlELFFBQVEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRTtZQUNyQixNQUFNLFNBQVMsR0FBRyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxJQUFJLEVBQUUsQ0FBQztZQUNuQyxNQUFNLGtCQUFrQixHQUFHLFNBQVMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxFQUFFLEVBQUUsRUFBRTtnQkFDakQsMEZBQTBGO2dCQUMxRixpQ0FBaUM7Z0JBQ2pDLElBQUksT0FBTyxLQUFLLFNBQVMsSUFBSSxFQUFFLENBQUMsT0FBTyxLQUFLLE9BQU87b0JBQUUsT0FBTyxJQUFJLENBQUM7Z0JBQ2pFLElBQUksUUFBUSxLQUFLLFNBQVMsSUFBSSxFQUFFLENBQUMsUUFBUSxLQUFLLFFBQVE7b0JBQUUsT0FBTyxJQUFJLENBQUM7Z0JBQ3BFLElBQUksT0FBTyxLQUFLLFNBQVMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsRUFBRSxDQUFDLE1BQU0sQ0FBQztvQkFBRSxPQUFPLElBQUksQ0FBQztnQkFDeEUsT0FBTyxLQUFLLENBQUM7WUFDZixDQUFDLENBQUMsQ0FBQztZQUNILElBQUksa0JBQWtCLENBQUMsTUFBTSxHQUFHLENBQUM7Z0JBQUUsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQUUsa0JBQWtCLENBQUMsQ0FBQzs7Z0JBQzdELEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDckIsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDO0lBRU8sMEJBQTBCLENBQ2hDLEdBQWdCLEVBQ2hCLE9BQVcsRUFDWCxPQUF1QixFQUN2QixRQUFpQyxFQUNqQyxPQUFtQztRQUVuQyxtRUFBbUU7UUFDbkUsSUFBSSxDQUFDLE9BQU8sSUFBSSxDQUFDLDBFQUFpQixDQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQzNDLHlEQUFpQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQzNCLE9BQU87U0FDUjtRQUVELHNEQUFzRDtRQUN0RCxJQUFJLE9BQU8sSUFBSSxDQUFDLDBFQUFpQixDQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQzFDLHlEQUFpQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQzNCLE9BQU87U0FDUjtRQUVELE1BQU0sU0FBUyxHQUFHLEdBQUcsQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLElBQUksRUFBRSxDQUFDO1FBQ3pDLFNBQVMsQ0FBQyxJQUFJLENBQUMsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxPQUFPLEVBQUUsQ0FBQyxDQUFDO1FBQ3ZELEdBQUcsQ0FBQyxHQUFHLENBQUMsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0lBQzlCLENBQUM7SUFFTyxnQkFBZ0IsQ0FBQyxLQUF3QztRQUMvRCxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLGVBQWUsRUFBRSxLQUFLLENBQUMsQ0FBQztJQUM5RSxDQUFDO0lBRU8sY0FBYyxDQUFDLEtBQXFDO1FBQzFELElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLENBQUMscUJBQXFCLEVBQUUsYUFBYSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQzFFLENBQUM7SUFFTyxpQkFBaUIsQ0FBQyxLQUF3QztRQUNoRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLHdCQUF3QixFQUFFLGdCQUFnQixFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQ2hGLENBQUM7SUFFRDs7U0FFSztJQUNHLGdCQUFnQixDQUN0QixXQUF3QixFQUN4QixTQUFpQixFQUNqQixLQUEyQjtRQUUzQixNQUFNLEtBQUssR0FBRyxLQUFLLENBQUMsS0FBc0MsQ0FBQztRQUMzRCxNQUFNLGFBQWEsR0FBRyxNQUFNLEdBQUcsU0FBUyxDQUFDO1FBQ3pDLE1BQU0sU0FBUyxHQUErQixFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQUUsQ0FBQztRQUNwRSxNQUFNLGlCQUFpQixHQUErQixFQUFFLFVBQVUsRUFBRSxJQUFJLEVBQUUsQ0FBQztRQUUzRSxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUMsSUFBSSxFQUFFLENBQUMsRUFBRSxFQUFFOztZQUNwQixNQUFNLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxHQUFHLElBQUksQ0FBQztZQUM5QixNQUFNLFNBQVMsR0FBRyxtREFBVyxDQUFDLEtBQUssQ0FBQyxDQUFDO1lBQ3JDLE1BQU0sU0FBUyxHQUFHLG1EQUFXLENBQUMsS0FBSyxDQUFDLENBQUM7WUFDckMsSUFBSSxXQUFXLEdBQW1CLGVBQVMsQ0FBQyxVQUFVLG1DQUFJLFNBQVMsQ0FBQztZQUNwRSxJQUFJLFdBQVcsR0FBbUIsZUFBUyxDQUFDLFVBQVUsbUNBQUksU0FBUyxDQUFDO1lBRXBFLDRGQUE0RjtZQUM1RixpRkFBaUY7WUFDakYsSUFBSSxXQUFXLElBQUksV0FBVyxZQUFZLE1BQU0sQ0FBQyxRQUFRLEVBQUU7Z0JBQ3pELFdBQVcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDO2FBQ2hDO1lBQ0QsSUFBSSxXQUFXLElBQUksV0FBVyxZQUFZLE1BQU0sQ0FBQyxRQUFRLEVBQUU7Z0JBQ3pELFdBQVcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDO2FBQ2hDO1lBRUQsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDaEQsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFFaEQsU0FBUyxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7WUFDeEIsU0FBUyxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7WUFDeEIsU0FBUyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDakQsU0FBUyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDakQsU0FBUyxDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7WUFFdEIsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsYUFBYSxFQUFFLFNBQVMsQ0FBQyxDQUFDO1lBRTNDLElBQUksV0FBVyxDQUFDLElBQUksR0FBRyxDQUFDLEVBQUU7Z0JBQ3hCLGlCQUFpQixDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7Z0JBQ2hDLGlCQUFpQixDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7Z0JBQ2hDLGlCQUFpQixDQUFDLFdBQVcsR0FBRyxXQUFXLENBQUM7Z0JBQzVDLGlCQUFpQixDQUFDLFdBQVcsR0FBRyxXQUFXLENBQUM7Z0JBQzVDLGlCQUFpQixDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7Z0JBRTlCLE1BQU0sSUFBSSxHQUFHLFNBQThCLENBQUM7Z0JBQzVDLE1BQU0sWUFBWSxHQUFHLGlCQUFzQyxDQUFDO2dCQUU1RCxJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLElBQUksQ0FBQyxDQUFDO2dCQUNwRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLFlBQVksQ0FBQyxDQUFDO2dCQUU1RSxJQUFJLFdBQVcsRUFBRTtvQkFDZixJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLElBQUksQ0FBQyxDQUFDO2lCQUMzRTtnQkFFRCxJQUFJLFdBQVcsRUFBRTtvQkFDZixJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLFlBQVksQ0FBQyxDQUFDO2lCQUNuRjthQUNGO1FBQ0gsQ0FBQyxDQUFDLENBQUM7UUFFSCxJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsS0FBSyxDQUFDLENBQUM7SUFDckMsQ0FBQztJQUVPLGdCQUFnQixDQUN0QixHQUFnQixFQUNoQixPQUFXLEVBQ1gsS0FBb0IsRUFDcEIsV0FBMkIsRUFDM0IsU0FBNEI7UUFFNUIsTUFBTSxTQUFTLEdBQUcsR0FBRyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUNuQyxJQUFJLFNBQVMsRUFBRTtZQUNiLFNBQVMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLEVBQUUsRUFBRTtnQkFDbEQsSUFBSSxDQUFDLE1BQU0sSUFBSSxNQUFNLEtBQUssS0FBSyxJQUFJLE1BQU0sS0FBSyxXQUFXLEVBQUU7b0JBQ3pELFFBQVEsQ0FBQyxJQUFJLENBQUMsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO2lCQUNuQztZQUNILENBQUMsQ0FBQyxDQUFDO1NBQ0o7SUFDSCxDQUFDO0lBRUQscUJBQXFCO1FBQ25CLE1BQU0sTUFBTSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDO1FBQ2pDLElBQUksQ0FBQyxNQUFNLElBQUksQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFO1lBQzVCLGlEQUFXLENBQUMseUJBQXlCLENBQUMsQ0FBQztZQUN2QyxPQUFPO1NBQ1I7UUFDRCxNQUFNLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxlQUFlLEVBQUUsSUFBSSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxDQUFDO1FBQzlELE1BQU0sQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNoRSxNQUFNLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxhQUFhLEVBQUUsSUFBSSxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUM1RCxDQUFDO0lBRUQsdUJBQXVCO1FBQ3JCLCtGQUErRjtRQUMvRixtQkFBbUI7UUFDbkIsTUFBTSxNQUFNLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUM7UUFDakMsSUFBSSxDQUFDLE1BQU0sSUFBSSxDQUFDLE1BQU0sQ0FBQyxLQUFLO1lBQUUsT0FBTztRQUNyQyxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxlQUFlLEVBQUUsSUFBSSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxDQUFDO1FBQy9ELE1BQU0sQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNqRSxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxhQUFhLEVBQUUsSUFBSSxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUM3RCxDQUFDO0lBRUQsS0FBSztRQUNILHVGQUF1RjtRQUN2RixJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsSUFBSSxDQUFDLENBQUM7UUFDckQsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ3BELElBQUksQ0FBQyxxQkFBcUIsRUFBRSxDQUFDO0lBQy9CLENBQUM7SUFFRCxRQUFRO1FBQ04sSUFBSSxDQUFDLHlCQUF5QixFQUFFLENBQUM7UUFDakMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLENBQUM7UUFDL0Isd0VBQXdFO1FBQ3hFLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNsRCxDQUFDO0lBRUQsT0FBTztRQUNMLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNuRCxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLENBQUM7UUFDL0MsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ3JELElBQUksQ0FBQyx5QkFBeUIsRUFBRSxDQUFDO1FBQ2pDLElBQUksQ0FBQyx1QkFBdUIsRUFBRSxDQUFDO0lBQ2pDLENBQUM7Q0FDRiIsImZpbGUiOiIuL3BoYXNlci1tYXR0ZXItY29sbGlzaW9uLXBsdWdpbi50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFBoeXNpY3MsIFBsdWdpbnMsIFNjZW5lLCBFdmVudHMsIFNjZW5lcywgVGlsZW1hcHMgfSBmcm9tIFwicGhhc2VyXCI7XG5pbXBvcnQgeyBnZXRSb290Qm9keSwgd2FybkludmFsaWRPYmplY3QgfSBmcm9tIFwiLi91dGlsc1wiO1xuaW1wb3J0IGxvZ2dlciBmcm9tIFwiLi9sb2dnZXJcIjtcbmltcG9ydCB7IENvbGxpZGluZ09iamVjdCBhcyBDTywgaXNDb2xsaWRpbmdPYmplY3QgfSBmcm9tIFwiLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0XCI7XG5pbXBvcnQge1xuICBMaXN0ZW5lck1hcCxcbiAgQ29sbGlkZUFCQ29uZmlnIGFzIEFCQ29uZmlnLFxuICBVbnN1YnNjcmliZSxcbiAgQ29sbGlkZUNhbGxiYWNrLFxuICBDb2xsaWRlQ29udGV4dCxcbiAgRXh0ZW5kZWRNYXR0ZXJDb2xsaXNpb25EYXRhLFxuICBFdmVudERhdGEsXG4gIENvbGxpZGVBQ29uZmlnIGFzIEFDb25maWcsXG4gIEludGVybmFsQ29sbGlkZUNvbmZpZyxcbiAgUmVtb3ZlQ29sbGlkZUNvbmZpZ0EgYXMgUmVtb3ZlQUNvbmZpZyxcbiAgUmVtb3ZlQ29sbGlkZUNvbmZpZ0FCIGFzIFJlbW92ZUFCQ29uZmlnLFxuICBJbnRlcm5hbENvbGxpZGVSZW1vdmVDb25maWcsXG59IGZyb20gXCIuL2NvbGxpc2lvbi10eXBlc1wiO1xuXG5pbXBvcnQgTWF0dGVyID0gUGh5c2ljcy5NYXR0ZXI7XG5pbXBvcnQgTWF0dGVyRXZlbnRzID0gTWF0dGVyLkV2ZW50cztcbmNvbnN0IHsgU1RBUlQsIERFU1RST1ksIFNIVVRET1dOIH0gPSBTY2VuZXMuRXZlbnRzO1xuY29uc3QgeyBDT0xMSVNJT05fU1RBUlQsIENPTExJU0lPTl9BQ1RJVkUsIENPTExJU0lPTl9FTkQgfSA9IE1hdHRlci5FdmVudHM7XG5cbnR5cGUgTWF0dGVyQ29sbGlzaW9uRXZlbnQgPVxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudFxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25FbmRFdmVudFxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudDtcblxuLyoqXG4gKiBAZXhwb3J0XG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIE1hdHRlckNvbGxpc2lvblBsdWdpbiBleHRlbmRzIFBsdWdpbnMuU2NlbmVQbHVnaW4ge1xuICBwdWJsaWMgZXZlbnRzID0gbmV3IEV2ZW50cy5FdmVudEVtaXR0ZXIoKTtcblxuICBwcml2YXRlIGNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzOiBMaXN0ZW5lck1hcCA9IG5ldyBNYXAoKTtcbiAgcHJpdmF0ZSBjb2xsaXNpb25FbmRMaXN0ZW5lcnM6IExpc3RlbmVyTWFwID0gbmV3IE1hcCgpO1xuICBwcml2YXRlIGNvbGxpc2lvbkFjdGl2ZUxpc3RlbmVyczogTGlzdGVuZXJNYXAgPSBuZXcgTWFwKCk7XG5cbiAgY29uc3RydWN0b3IoXG4gICAgcHJvdGVjdGVkIHNjZW5lOiBTY2VuZSxcbiAgICBwcm90ZWN0ZWQgcGx1Z2luTWFuYWdlcjogUGx1Z2lucy5QbHVnaW5NYW5hZ2VyLFxuICAgIHBsdWdpbktleTogc3RyaW5nXG4gICkge1xuICAgIHN1cGVyKHNjZW5lLCBwbHVnaW5NYW5hZ2VyLCBwbHVnaW5LZXkpO1xuICAgIHRoaXMuc2NlbmUgPSBzY2VuZTtcbiAgICB0aGlzLnNjZW5lLmV2ZW50cy5vbmNlKFNUQVJULCB0aGlzLnN0YXJ0LCB0aGlzKTtcbiAgICB0aGlzLnNjZW5lLmV2ZW50cy5vbmNlKERFU1RST1ksIHRoaXMuZGVzdHJveSwgdGhpcyk7XG4gIH1cblxuICAvKipcbiAgICogQWRkIGEgbGlzdGVuZXIgZm9yIGNvbGxpZGVzdGFydCBldmVudHMgYmV0d2VlbiBvYmplY3RBIGFuZCBvYmplY3RCLiBUaGUgY29sbGlkZXN0YXJ0IGV2ZW50IGlzXG4gICAqIGZpcmVkIGJ5IE1hdHRlciB3aGVuIHR3byBib2RpZXMgc3RhcnQgY29sbGlkaW5nIHdpdGhpbiBhIHRpY2sgb2YgdGhlIGVuZ2luZS4gSWYgb2JqZWN0QiBpc1xuICAgKiBvbWl0dGVkLCBhbnkgY29sbGlzaW9ucyB3aXRoIG9iamVjdEEgd2lsbCBiZSBwYXNzZWQgYWxvbmcgdG8gdGhlIGxpc3RlbmVyLiBTZWVcbiAgICoge0BsaW5rIHBhaXJjb2xsaXNpb25zdGFydH0gZm9yIGluZm9ybWF0aW9uIG9uIGNhbGxiYWNrIHBhcmFtZXRlcnMuXG4gICAqL1xuICBwdWJsaWMgYWRkT25Db2xsaWRlU3RhcnQ8VCBleHRlbmRzIENPLCBLIGV4dGVuZHMgQ08+KGNvbmZpZzogQUJDb25maWc8VCwgSz4pOiBVbnN1YnNjcmliZTtcbiAgcHVibGljIGFkZE9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVTdGFydChjb25maWc6IEludGVybmFsQ29sbGlkZUNvbmZpZyk6IFVuc3Vic2NyaWJlIHtcbiAgICAvLyBOb3RlOiB0aGUgb3JkZXIgb2Ygb3ZlcmxvYWRzIGlzIGltcG9ydGFudCEgVFMgbWF0Y2hlcyB0aGUgZmlyc3Qgb25lIGl0IGNhbiwgc28gdGhpcyBuZWVkc1xuICAgIC8vIHRoZSBtb3N0IHNwZWNpZmljL2NvbnN0cmFpbmVkIHNpZ25hdHVyZSBmaXJzdC5cbiAgICB0aGlzLmFkZE9uQ29sbGlkZSh0aGlzLmNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzLCBjb25maWcpO1xuICAgIHJldHVybiAoKSA9PiB0aGlzLnJlbW92ZU9uQ29sbGlkZSh0aGlzLmNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNhZGRPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIGFkZE9uQ29sbGlkZUVuZDxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQkNvbmZpZzxULCBLPik6IFVuc3Vic2NyaWJlO1xuICBwdWJsaWMgYWRkT25Db2xsaWRlRW5kPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVFbmQoY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiBVbnN1YnNjcmliZSB7XG4gICAgdGhpcy5hZGRPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25FbmRMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gICAgcmV0dXJuICgpID0+IHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNhZGRPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIGFkZE9uQ29sbGlkZUFjdGl2ZTxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQkNvbmZpZzxULCBLPik6IFVuc3Vic2NyaWJlO1xuICBwdWJsaWMgYWRkT25Db2xsaWRlQWN0aXZlPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVBY3RpdmUoY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiBVbnN1YnNjcmliZSB7XG4gICAgdGhpcy5hZGRPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gICAgcmV0dXJuICgpID0+IHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uQWN0aXZlTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqXG4gICAqIFJlbW92ZSBhbnkgbGlzdGVuZXJzIHRoYXQgd2VyZSBhZGRlZCB3aXRoIGFkZE9uQ29sbGlkZVN0YXJ0LiBJZiBvYmplY3RCLCBjYWxsYmFjayBvciBjb250ZXh0XG4gICAqIHBhcmFtZXRlcnMgYXJlIG9taXR0ZWQsIGFueSBsaXN0ZW5lciBtYXRjaGluZyB0aGUgcmVtYWluaW5nIHBhcmFtZXRlcnMgd2lsbCBiZSByZW1vdmVkLiBFLmcuIGlmXG4gICAqIHlvdSBvbmx5IHNwZWNpZnkgb2JqZWN0QSBhbmQgb2JqZWN0QiwgYWxsIGxpc3RlbmVycyB3aXRoIG9iamVjdEEgJiBvYmplY3RCIHdpbGwgYmUgcmVtb3ZlZFxuICAgKiByZWdhcmRsZXNzIG9mIHRoZSBjYWxsYmFjayBvciBjb250ZXh0LlxuICAgKi9cbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTywgSyBleHRlbmRzIENPPihjb25maWc6IFJlbW92ZUFCQ29uZmlnPFQsIEs+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQ29uZmlnPFQ+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0KGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgdGhpcy5yZW1vdmVPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycywgY29uZmlnKTtcbiAgfVxuXG4gIC8qKiBUaGlzIG1ldGhvZCBtaXJyb3JzIHtAbGluayBNYXR0ZXJDb2xsaXNpb25QbHVnaW4jcmVtb3ZlT25Db2xsaWRlU3RhcnR9ICovXG4gIHB1YmxpYyByZW1vdmVPbkNvbGxpZGVFbmQ8VCBleHRlbmRzIENPLCBLIGV4dGVuZHMgQ08+KGNvbmZpZzogUmVtb3ZlQUJDb25maWc8VCwgSz4pOiB2b2lkO1xuICBwdWJsaWMgcmVtb3ZlT25Db2xsaWRlRW5kPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQ29uZmlnPFQ+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZUVuZChjb25maWc6IEludGVybmFsQ29sbGlkZVJlbW92ZUNvbmZpZykge1xuICAgIHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNyZW1vdmVPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZUFjdGl2ZTxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQkNvbmZpZzxULCBLPik6IHZvaWQ7XG4gIHB1YmxpYyByZW1vdmVPbkNvbGxpZGVBY3RpdmU8VCBleHRlbmRzIENPPihjb25maWc6IFJlbW92ZUFDb25maWc8VD4pOiB2b2lkO1xuICBwdWJsaWMgcmVtb3ZlT25Db2xsaWRlQWN0aXZlKGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgdGhpcy5yZW1vdmVPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gIH1cblxuICAvKiogUmVtb3ZlIGFueSBsaXN0ZW5lcnMgdGhhdCB3ZXJlIGFkZGVkIHdpdGggYWRkT25Db2xsaWRlU3RhcnQuICovXG4gIHB1YmxpYyByZW1vdmVBbGxDb2xsaWRlU3RhcnRMaXN0ZW5lcnMoKSB7XG4gICAgdGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycy5jbGVhcigpO1xuICB9XG5cbiAgLyoqIFJlbW92ZSBhbnkgbGlzdGVuZXJzIHRoYXQgd2VyZSBhZGRlZCB3aXRoIGFkZE9uQ29sbGlkZUFjdGl2ZS4gKi9cbiAgcHVibGljIHJlbW92ZUFsbENvbGxpZGVBY3RpdmVMaXN0ZW5lcnMoKSB7XG4gICAgdGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMuY2xlYXIoKTtcbiAgfVxuXG4gIC8qKiBSZW1vdmUgYW55IGxpc3RlbmVycyB0aGF0IHdlcmUgYWRkZWQgd2l0aCBhZGRPbkNvbGxpZGVFbmQuICovXG4gIHB1YmxpYyByZW1vdmVBbGxDb2xsaWRlRW5kTGlzdGVuZXJzKCkge1xuICAgIHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLmNsZWFyKCk7XG4gIH1cblxuICAvKipcbiAgICogUmVtb3ZlIGFueSBsaXN0ZW5lcnMgdGhhdCB3ZXJlIGFkZGVkIHdpdGggYWRkT25Db2xsaWRlU3RhcnQsIGFkZE9uQ29sbGlkZUFjdGl2ZSBvclxuICAgKiBhZGRPbkNvbGxpZGVFbmQuXG4gICAqL1xuICBwdWJsaWMgcmVtb3ZlQWxsQ29sbGlkZUxpc3RlbmVycygpIHtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVTdGFydExpc3RlbmVycygpO1xuICAgIHRoaXMucmVtb3ZlQWxsQ29sbGlkZUFjdGl2ZUxpc3RlbmVycygpO1xuICAgIHRoaXMucmVtb3ZlQWxsQ29sbGlkZUVuZExpc3RlbmVycygpO1xuICB9XG5cbiAgcHJpdmF0ZSBhZGRPbkNvbGxpZGUobWFwOiBMaXN0ZW5lck1hcCwgY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiB2b2lkIHtcbiAgICBjb25zdCB7IGNvbnRleHQsIGNhbGxiYWNrLCBvYmplY3RBLCBvYmplY3RCIH0gPSBjb25maWc7XG4gICAgaWYgKCFjYWxsYmFjayB8fCB0eXBlb2YgY2FsbGJhY2sgIT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgbG9nZ2VyLndhcm4oYE5vIHZhbGlkIGNhbGxiYWNrIHNwZWNpZmllZC4gUmVjZWl2ZWQ6ICR7Y2FsbGJhY2t9YCk7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGNvbnN0IG9iamVjdHNBID0gQXJyYXkuaXNBcnJheShvYmplY3RBKSA/IG9iamVjdEEgOiBbb2JqZWN0QV07XG4gICAgY29uc3Qgb2JqZWN0c0IgPSBBcnJheS5pc0FycmF5KG9iamVjdEIpID8gb2JqZWN0QiA6IFtvYmplY3RCXTtcbiAgICBvYmplY3RzQS5mb3JFYWNoKChhKSA9PiB7XG4gICAgICBvYmplY3RzQi5mb3JFYWNoKChiKSA9PiB7XG4gICAgICAgIHRoaXMuYWRkT25Db2xsaWRlT2JqZWN0VnNPYmplY3QobWFwLCBhLCBiLCBjYWxsYmFjaywgY29udGV4dCk7XG4gICAgICB9KTtcbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgcmVtb3ZlT25Db2xsaWRlKG1hcDogTGlzdGVuZXJNYXAsIGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgY29uc3QgeyBjb250ZXh0LCBjYWxsYmFjaywgb2JqZWN0QSwgb2JqZWN0QiB9ID0gY29uZmlnO1xuICAgIGNvbnN0IG9iamVjdHNBID0gQXJyYXkuaXNBcnJheShvYmplY3RBKSA/IG9iamVjdEEgOiBbb2JqZWN0QV07XG4gICAgY29uc3Qgb2JqZWN0c0IgPSBBcnJheS5pc0FycmF5KG9iamVjdEIpID8gb2JqZWN0QiA6IFtvYmplY3RCXTtcbiAgICBvYmplY3RzQS5mb3JFYWNoKChhKSA9PiB7XG4gICAgICBjb25zdCBjYWxsYmFja3MgPSBtYXAuZ2V0KGEpIHx8IFtdO1xuICAgICAgY29uc3QgcmVtYWluaW5nQ2FsbGJhY2tzID0gY2FsbGJhY2tzLmZpbHRlcigoY2IpID0+IHtcbiAgICAgICAgLy8gSWYgYW55dGhpbmcgZG9lc24ndCBtYXRjaCBhIHByb3ZpZGVkIGNvbmZpZyB2YWx1ZSAoaS5lLiBhbnl0aGluZyBvdGhlciB0aGFuIHVuZGVmaW5lZCksXG4gICAgICAgIC8vIHdlIGNhbiBiYWlsIGFuZCBrZWVwIGxpc3RlbmVyLlxuICAgICAgICBpZiAoY29udGV4dCAhPT0gdW5kZWZpbmVkICYmIGNiLmNvbnRleHQgIT09IGNvbnRleHQpIHJldHVybiB0cnVlO1xuICAgICAgICBpZiAoY2FsbGJhY2sgIT09IHVuZGVmaW5lZCAmJiBjYi5jYWxsYmFjayAhPT0gY2FsbGJhY2spIHJldHVybiB0cnVlO1xuICAgICAgICBpZiAob2JqZWN0QiAhPT0gdW5kZWZpbmVkICYmICFvYmplY3RzQi5pbmNsdWRlcyhjYi50YXJnZXQpKSByZXR1cm4gdHJ1ZTtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfSk7XG4gICAgICBpZiAocmVtYWluaW5nQ2FsbGJhY2tzLmxlbmd0aCA+IDApIG1hcC5zZXQoYSwgcmVtYWluaW5nQ2FsbGJhY2tzKTtcbiAgICAgIGVsc2UgbWFwLmRlbGV0ZShhKTtcbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgYWRkT25Db2xsaWRlT2JqZWN0VnNPYmplY3QoXG4gICAgbWFwOiBMaXN0ZW5lck1hcCxcbiAgICBvYmplY3RBOiBDTyxcbiAgICBvYmplY3RCOiBDTyB8IHVuZGVmaW5lZCxcbiAgICBjYWxsYmFjazogQ29sbGlkZUNhbGxiYWNrPENPLCBDTz4sXG4gICAgY29udGV4dDogQ29sbGlkZUNvbnRleHQgfCB1bmRlZmluZWRcbiAgKSB7XG4gICAgLy8gQ2FuJ3QgZG8gYW55dGhpbmcgaWYgdGhlIGZpcnN0IG9iamVjdCBpcyBub3QgZGVmaW5lZCBvciBpbnZhbGlkLlxuICAgIGlmICghb2JqZWN0QSB8fCAhaXNDb2xsaWRpbmdPYmplY3Qob2JqZWN0QSkpIHtcbiAgICAgIHdhcm5JbnZhbGlkT2JqZWN0KG9iamVjdEEpO1xuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIC8vIFRoZSBzZWNvbmQgb2JqZWN0IGNhbiBiZSB1bmRlZmluZWQgb3IgYSB2YWxpZCBib2R5LlxuICAgIGlmIChvYmplY3RCICYmICFpc0NvbGxpZGluZ09iamVjdChvYmplY3RCKSkge1xuICAgICAgd2FybkludmFsaWRPYmplY3Qob2JqZWN0QSk7XG4gICAgICByZXR1cm47XG4gICAgfVxuXG4gICAgY29uc3QgY2FsbGJhY2tzID0gbWFwLmdldChvYmplY3RBKSB8fCBbXTtcbiAgICBjYWxsYmFja3MucHVzaCh7IHRhcmdldDogb2JqZWN0QiwgY2FsbGJhY2ssIGNvbnRleHQgfSk7XG4gICAgbWFwLnNldChvYmplY3RBLCBjYWxsYmFja3MpO1xuICB9XG5cbiAgcHJpdmF0ZSBvbkNvbGxpc2lvblN0YXJ0KGV2ZW50OiBNYXR0ZXJFdmVudHMuQ29sbGlzaW9uQWN0aXZlRXZlbnQpIHtcbiAgICB0aGlzLm9uQ29sbGlzaW9uRXZlbnQodGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycywgQ09MTElTSU9OX1NUQVJULCBldmVudCk7XG4gIH1cblxuICBwcml2YXRlIG9uQ29sbGlzaW9uRW5kKGV2ZW50OiBNYXR0ZXJFdmVudHMuQ29sbGlzaW9uRW5kRXZlbnQpIHtcbiAgICB0aGlzLm9uQ29sbGlzaW9uRXZlbnQodGhpcy5jb2xsaXNpb25FbmRMaXN0ZW5lcnMsIENPTExJU0lPTl9FTkQsIGV2ZW50KTtcbiAgfVxuXG4gIHByaXZhdGUgb25Db2xsaXNpb25BY3RpdmUoZXZlbnQ6IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudCkge1xuICAgIHRoaXMub25Db2xsaXNpb25FdmVudCh0aGlzLmNvbGxpc2lvbkFjdGl2ZUxpc3RlbmVycywgQ09MTElTSU9OX0FDVElWRSwgZXZlbnQpO1xuICB9XG5cbiAgLyoqXG4gICAqIFJldXNhYmxlIGhhbmRsZXIgZm9yIGNvbGxpc2lvbnN0YXJ0LCBjb2xsaXNpb25lbmQsIGNvbGxpc2lvbmFjdGl2ZS5cbiAgICogKi9cbiAgcHJpdmF0ZSBvbkNvbGxpc2lvbkV2ZW50KFxuICAgIGxpc3RlbmVyTWFwOiBMaXN0ZW5lck1hcCxcbiAgICBldmVudE5hbWU6IHN0cmluZyxcbiAgICBldmVudDogTWF0dGVyQ29sbGlzaW9uRXZlbnRcbiAgKSB7XG4gICAgY29uc3QgcGFpcnMgPSBldmVudC5wYWlycyBhcyBFeHRlbmRlZE1hdHRlckNvbGxpc2lvbkRhdGFbXTtcbiAgICBjb25zdCBwYWlyRXZlbnROYW1lID0gXCJwYWlyXCIgKyBldmVudE5hbWU7XG4gICAgY29uc3QgZXZlbnREYXRhOiBQYXJ0aWFsPEV2ZW50RGF0YTxDTywgQ08+PiA9IHsgaXNSZXZlcnNlZDogZmFsc2UgfTtcbiAgICBjb25zdCBldmVudERhdGFSZXZlcnNlZDogUGFydGlhbDxFdmVudERhdGE8Q08sIENPPj4gPSB7IGlzUmV2ZXJzZWQ6IHRydWUgfTtcblxuICAgIHBhaXJzLm1hcCgocGFpciwgaSkgPT4ge1xuICAgICAgY29uc3QgeyBib2R5QSwgYm9keUIgfSA9IHBhaXI7XG4gICAgICBjb25zdCByb290Qm9keUEgPSBnZXRSb290Qm9keShib2R5QSk7XG4gICAgICBjb25zdCByb290Qm9keUIgPSBnZXRSb290Qm9keShib2R5Qik7XG4gICAgICBsZXQgZ2FtZU9iamVjdEE6IENPIHwgdW5kZWZpbmVkID0gcm9vdEJvZHlBLmdhbWVPYmplY3QgPz8gdW5kZWZpbmVkO1xuICAgICAgbGV0IGdhbWVPYmplY3RCOiBDTyB8IHVuZGVmaW5lZCA9IHJvb3RCb2R5Qi5nYW1lT2JqZWN0ID8/IHVuZGVmaW5lZDtcblxuICAgICAgLy8gU3BlY2lhbCBjYXNlIGZvciB0aWxlcywgd2hlcmUgaXQncyBtb3JlIHVzZWZ1bCB0byBoYXZlIGEgcmVmZXJlbmNlIHRvIHRoZSBUaWxlIG9iamVjdCBub3RcbiAgICAgIC8vIHRoZSBUaWxlQm9keS4gVGhpcyBpcyBob3QgY29kZSwgc28gdXNlIGEgcHJvcGVydHkgY2hlY2sgaW5zdGVhZCBvZiBpbnN0YW5jZW9mLlxuICAgICAgaWYgKGdhbWVPYmplY3RBICYmIGdhbWVPYmplY3RBIGluc3RhbmNlb2YgTWF0dGVyLlRpbGVCb2R5KSB7XG4gICAgICAgIGdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEEudGlsZTtcbiAgICAgIH1cbiAgICAgIGlmIChnYW1lT2JqZWN0QiAmJiBnYW1lT2JqZWN0QiBpbnN0YW5jZW9mIE1hdHRlci5UaWxlQm9keSkge1xuICAgICAgICBnYW1lT2JqZWN0QiA9IGdhbWVPYmplY3RCLnRpbGU7XG4gICAgICB9XG5cbiAgICAgIHBhaXJzW2ldLmdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEEgPz8gdW5kZWZpbmVkO1xuICAgICAgcGFpcnNbaV0uZ2FtZU9iamVjdEIgPSBnYW1lT2JqZWN0QiA/PyB1bmRlZmluZWQ7XG5cbiAgICAgIGV2ZW50RGF0YS5ib2R5QSA9IGJvZHlBO1xuICAgICAgZXZlbnREYXRhLmJvZHlCID0gYm9keUI7XG4gICAgICBldmVudERhdGEuZ2FtZU9iamVjdEEgPSBnYW1lT2JqZWN0QSA/PyB1bmRlZmluZWQ7XG4gICAgICBldmVudERhdGEuZ2FtZU9iamVjdEIgPSBnYW1lT2JqZWN0QiA/PyB1bmRlZmluZWQ7XG4gICAgICBldmVudERhdGEucGFpciA9IHBhaXI7XG5cbiAgICAgIHRoaXMuZXZlbnRzLmVtaXQocGFpckV2ZW50TmFtZSwgZXZlbnREYXRhKTtcblxuICAgICAgaWYgKGxpc3RlbmVyTWFwLnNpemUgPiAwKSB7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmJvZHlCID0gYm9keUE7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmJvZHlBID0gYm9keUI7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmdhbWVPYmplY3RCID0gZ2FtZU9iamVjdEE7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEI7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLnBhaXIgPSBwYWlyO1xuXG4gICAgICAgIGNvbnN0IGRhdGEgPSBldmVudERhdGEgYXMgRXZlbnREYXRhPENPLCBDTz47XG4gICAgICAgIGNvbnN0IGRhdGFSZXZlcnNlZCA9IGV2ZW50RGF0YVJldmVyc2VkIGFzIEV2ZW50RGF0YTxDTywgQ08+O1xuXG4gICAgICAgIHRoaXMuY2hlY2tQYWlyQW5kRW1pdChsaXN0ZW5lck1hcCwgYm9keUEsIGJvZHlCLCBnYW1lT2JqZWN0QiwgZGF0YSk7XG4gICAgICAgIHRoaXMuY2hlY2tQYWlyQW5kRW1pdChsaXN0ZW5lck1hcCwgYm9keUIsIGJvZHlBLCBnYW1lT2JqZWN0QSwgZGF0YVJldmVyc2VkKTtcblxuICAgICAgICBpZiAoZ2FtZU9iamVjdEEpIHtcbiAgICAgICAgICB0aGlzLmNoZWNrUGFpckFuZEVtaXQobGlzdGVuZXJNYXAsIGdhbWVPYmplY3RBLCBib2R5QiwgZ2FtZU9iamVjdEIsIGRhdGEpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGdhbWVPYmplY3RCKSB7XG4gICAgICAgICAgdGhpcy5jaGVja1BhaXJBbmRFbWl0KGxpc3RlbmVyTWFwLCBnYW1lT2JqZWN0QiwgYm9keUEsIGdhbWVPYmplY3RBLCBkYXRhUmV2ZXJzZWQpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICB0aGlzLmV2ZW50cy5lbWl0KGV2ZW50TmFtZSwgZXZlbnQpO1xuICB9XG5cbiAgcHJpdmF0ZSBjaGVja1BhaXJBbmRFbWl0KFxuICAgIG1hcDogTGlzdGVuZXJNYXAsXG4gICAgb2JqZWN0QTogQ08sXG4gICAgYm9keUI6IE1hdHRlckpTLkJvZHksXG4gICAgZ2FtZU9iamVjdEI6IENPIHwgdW5kZWZpbmVkLFxuICAgIGV2ZW50RGF0YTogRXZlbnREYXRhPENPLCBDTz5cbiAgKSB7XG4gICAgY29uc3QgY2FsbGJhY2tzID0gbWFwLmdldChvYmplY3RBKTtcbiAgICBpZiAoY2FsbGJhY2tzKSB7XG4gICAgICBjYWxsYmFja3MuZm9yRWFjaCgoeyB0YXJnZXQsIGNhbGxiYWNrLCBjb250ZXh0IH0pID0+IHtcbiAgICAgICAgaWYgKCF0YXJnZXQgfHwgdGFyZ2V0ID09PSBib2R5QiB8fCB0YXJnZXQgPT09IGdhbWVPYmplY3RCKSB7XG4gICAgICAgICAgY2FsbGJhY2suY2FsbChjb250ZXh0LCBldmVudERhdGEpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9XG4gIH1cblxuICBzdWJzY3JpYmVNYXR0ZXJFdmVudHMoKSB7XG4gICAgY29uc3QgbWF0dGVyID0gdGhpcy5zY2VuZS5tYXR0ZXI7XG4gICAgaWYgKCFtYXR0ZXIgfHwgIW1hdHRlci53b3JsZCkge1xuICAgICAgbG9nZ2VyLndhcm4oXCJQbHVnaW4gcmVxdWlyZXMgbWF0dGVyIVwiKTtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgbWF0dGVyLndvcmxkLm9uKENPTExJU0lPTl9TVEFSVCwgdGhpcy5vbkNvbGxpc2lvblN0YXJ0LCB0aGlzKTtcbiAgICBtYXR0ZXIud29ybGQub24oQ09MTElTSU9OX0FDVElWRSwgdGhpcy5vbkNvbGxpc2lvbkFjdGl2ZSwgdGhpcyk7XG4gICAgbWF0dGVyLndvcmxkLm9uKENPTExJU0lPTl9FTkQsIHRoaXMub25Db2xsaXNpb25FbmQsIHRoaXMpO1xuICB9XG5cbiAgdW5zdWJzY3JpYmVNYXR0ZXJFdmVudHMoKSB7XG4gICAgLy8gRG9uJ3QgdW5zdWIgaWYgbWF0dGVyIG5leHQgZXhpc3Rpbmcgb3IgaWYgdGhlIGdhbWUgaXMgZGVzdHJveWVkIChzaW5jZSB0aGUgbWF0dGVyIHdvcmxkIHdpbGxcbiAgICAvLyBiZSBhbHJlYWR5IGdvbmUpXG4gICAgY29uc3QgbWF0dGVyID0gdGhpcy5zY2VuZS5tYXR0ZXI7XG4gICAgaWYgKCFtYXR0ZXIgfHwgIW1hdHRlci53b3JsZCkgcmV0dXJuO1xuICAgIG1hdHRlci53b3JsZC5vZmYoQ09MTElTSU9OX1NUQVJULCB0aGlzLm9uQ29sbGlzaW9uU3RhcnQsIHRoaXMpO1xuICAgIG1hdHRlci53b3JsZC5vZmYoQ09MTElTSU9OX0FDVElWRSwgdGhpcy5vbkNvbGxpc2lvbkFjdGl2ZSwgdGhpcyk7XG4gICAgbWF0dGVyLndvcmxkLm9mZihDT0xMSVNJT05fRU5ELCB0aGlzLm9uQ29sbGlzaW9uRW5kLCB0aGlzKTtcbiAgfVxuXG4gIHN0YXJ0KCkge1xuICAgIC8vIElmIHJlc3RhcnRpbmcsIHVuc3Vic2NyaWJlIGJlZm9yZSByZXN1YnNjcmliaW5nIHRvIGVuc3VyZSBvbmx5IG9uZSBsaXN0ZW5lciBpcyBhZGRlZFxuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihTSFVURE9XTiwgdGhpcy5zaHV0ZG93biwgdGhpcyk7XG4gICAgdGhpcy5zY2VuZS5ldmVudHMub24oU0hVVERPV04sIHRoaXMuc2h1dGRvd24sIHRoaXMpO1xuICAgIHRoaXMuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gIH1cblxuICBzaHV0ZG93bigpIHtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVMaXN0ZW5lcnMoKTtcbiAgICB0aGlzLnVuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gICAgLy8gUmVzdWJzY3JpYmUgdG8gc3RhcnQgc28gdGhhdCB0aGUgcGx1Z2luIGlzIHN0YXJ0ZWQgYWdhaW4gYWZ0ZXIgTWF0dGVyXG4gICAgdGhpcy5zY2VuZS5ldmVudHMub25jZShTVEFSVCwgdGhpcy5zdGFydCwgdGhpcyk7XG4gIH1cblxuICBkZXN0cm95KCkge1xuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihERVNUUk9ZLCB0aGlzLmRlc3Ryb3ksIHRoaXMpO1xuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihTVEFSVCwgdGhpcy5zdGFydCwgdGhpcyk7XG4gICAgdGhpcy5zY2VuZS5ldmVudHMub2ZmKFNIVVRET1dOLCB0aGlzLnNodXRkb3duLCB0aGlzKTtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVMaXN0ZW5lcnMoKTtcbiAgICB0aGlzLnVuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gIH1cbn1cbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./phaser-matter-collision-plugin.ts\n')},"./utils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "getRootBody": () => (/* binding */ getRootBody),\n/* harmony export */ "warnInvalidObject": () => (/* binding */ warnInvalidObject)\n/* harmony export */ });\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./logger */ "./logger.ts");\n\r\n/**\r\n * Get the root body of a compound Matter body.\r\n */\r\nfunction getRootBody(body) {\r\n while (body.parent !== body)\r\n body = body.parent;\r\n return body;\r\n}\r\n/**\r\n * @param obj\r\n */\r\nfunction warnInvalidObject(obj) {\r\n _logger__WEBPACK_IMPORTED_MODULE_0__.default.warn(`Expected a Matter body, a Tile, a GameObject, a Sprite, an Image, a TileBody, or an object with a body property, but instead, received: ${obj}`);\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi91dGlscy50cz84ODEzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUE4QjtBQUU5Qjs7R0FFRztBQUNJLFNBQVMsV0FBVyxDQUFDLElBQXVCO0lBQ2pELE9BQU8sSUFBSSxDQUFDLE1BQU0sS0FBSyxJQUFJO1FBQUUsSUFBSSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7SUFDaEQsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDO0FBRUQ7O0dBRUc7QUFDSSxTQUFTLGlCQUFpQixDQUFDLEdBQVE7SUFDeEMsaURBQVcsQ0FDVCwySUFBMkksR0FBRyxFQUFFLENBQ2pKLENBQUM7QUFDSixDQUFDIiwiZmlsZSI6Ii4vdXRpbHMudHMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgbG9nZ2VyIGZyb20gXCIuL2xvZ2dlclwiO1xuXG4vKipcbiAqIEdldCB0aGUgcm9vdCBib2R5IG9mIGEgY29tcG91bmQgTWF0dGVyIGJvZHkuXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBnZXRSb290Qm9keShib2R5OiBNYXR0ZXJKUy5Cb2R5VHlwZSkge1xuICB3aGlsZSAoYm9keS5wYXJlbnQgIT09IGJvZHkpIGJvZHkgPSBib2R5LnBhcmVudDtcbiAgcmV0dXJuIGJvZHk7XG59XG5cbi8qKlxuICogQHBhcmFtIG9ialxuICovXG5leHBvcnQgZnVuY3Rpb24gd2FybkludmFsaWRPYmplY3Qob2JqOiBhbnkpIHtcbiAgbG9nZ2VyLndhcm4oXG4gICAgYEV4cGVjdGVkIGEgTWF0dGVyIGJvZHksIGEgVGlsZSwgYSBHYW1lT2JqZWN0LCBhIFNwcml0ZSwgYW4gSW1hZ2UsIGEgVGlsZUJvZHksIG9yIGFuIG9iamVjdCB3aXRoIGEgYm9keSBwcm9wZXJ0eSwgYnV0IGluc3RlYWQsIHJlY2VpdmVkOiAke29ian1gXG4gICk7XG59XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./utils.ts\n')},"./valid-collision-object.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "isMatterBody": () => (/* binding */ isMatterBody),\n/* harmony export */ "isCollidingObject": () => (/* binding */ isCollidingObject)\n/* harmony export */ });\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! phaser */ "phaser");\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(phaser__WEBPACK_IMPORTED_MODULE_0__);\n\r\nvar Tile = phaser__WEBPACK_IMPORTED_MODULE_0__.Tilemaps.Tile;\r\n/** Duck type to check if the given object is a Matter body (because there isn\'t a prototype). */\r\nfunction isMatterBody(obj) {\r\n return (obj.hasOwnProperty("parts") && obj.hasOwnProperty("slop") && obj.hasOwnProperty("gameObject"));\r\n}\r\n/**\r\n * Check if object is an acceptable physical object for this plugin - a Matter Body, a tile, or an\r\n * object with a body property.\r\n */\r\nfunction isCollidingObject(obj) {\r\n // GameObjects, images, sprites and tile bodies should all have a body property.\r\n return isMatterBody(obj) || obj.body || obj instanceof Tile;\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0LnRzP2QxM2YiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUF5QztBQUV6QyxJQUFPLElBQUksR0FBRyxpREFBYSxDQUFDO0FBYzVCLGlHQUFpRztBQUMxRixTQUFTLFlBQVksQ0FBQyxHQUFRO0lBQ25DLE9BQU8sQ0FDTCxHQUFHLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxJQUFJLEdBQUcsQ0FBQyxjQUFjLENBQUMsTUFBTSxDQUFDLElBQUksR0FBRyxDQUFDLGNBQWMsQ0FBQyxZQUFZLENBQUMsQ0FDOUYsQ0FBQztBQUNKLENBQUM7QUFFRDs7O0dBR0c7QUFDSSxTQUFTLGlCQUFpQixDQUFDLEdBQVE7SUFDeEMsZ0ZBQWdGO0lBQ2hGLE9BQU8sWUFBWSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEdBQUcsQ0FBQyxJQUFJLElBQUksR0FBRyxZQUFZLElBQUksQ0FBQztBQUM5RCxDQUFDIiwiZmlsZSI6Ii4vdmFsaWQtY29sbGlzaW9uLW9iamVjdC50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFRpbGVtYXBzLCBUeXBlcyB9IGZyb20gXCJwaGFzZXJcIjtcblxuaW1wb3J0IFRpbGUgPSBUaWxlbWFwcy5UaWxlO1xuaW1wb3J0IE1hdHRlckJvZHkgPSBUeXBlcy5QaHlzaWNzLk1hdHRlci5NYXR0ZXJCb2R5O1xuXG4vKiogQSB2YWxpZCBwaHlzaWNzLWVuYWJsZWQgZ2FtZSBvYmplY3QsIG9yIGp1c3QgYW4gb2JqZWN0IHRoYXQgaGFzIFwiYm9keVwiIHByb3BlcnR5ICovXG5leHBvcnQgdHlwZSBPYmplY3RXaXRoQm9keSA9IHtcbiAgYm9keTogTWF0dGVySlMuQm9keVR5cGU7XG59O1xuXG4vKipcbiAqIEEgdW5pb24gb2YgYWxsIHRoZSB0eXBlcyBvZiBwaHlzaWNzIG9iamVjdHMgd2UgY291bGQgaGF2ZSBpbiB0aGUgc2ltdWxhdGlvbiAtIGZyb20gcmF3IE1hdHRlci5qc1xuICogYm9kaWVzIHRvIHRpbGVzIGFuZCBwaHlzaWNzLWVuYWJsZWQgUGhhc2VyIEdhbWVPYmplY3RzLlxuICovXG5leHBvcnQgdHlwZSBDb2xsaWRpbmdPYmplY3QgPSBNYXR0ZXJCb2R5IHwgTWF0dGVySlMuQm9keVR5cGUgfCBUaWxlIHwgT2JqZWN0V2l0aEJvZHk7XG5cbi8qKiBEdWNrIHR5cGUgdG8gY2hlY2sgaWYgdGhlIGdpdmVuIG9iamVjdCBpcyBhIE1hdHRlciBib2R5IChiZWNhdXNlIHRoZXJlIGlzbid0IGEgcHJvdG90eXBlKS4gKi9cbmV4cG9ydCBmdW5jdGlvbiBpc01hdHRlckJvZHkob2JqOiBhbnkpOiBvYmogaXMgTWF0dGVyQm9keSB7XG4gIHJldHVybiAoXG4gICAgb2JqLmhhc093blByb3BlcnR5KFwicGFydHNcIikgJiYgb2JqLmhhc093blByb3BlcnR5KFwic2xvcFwiKSAmJiBvYmouaGFzT3duUHJvcGVydHkoXCJnYW1lT2JqZWN0XCIpXG4gICk7XG59XG5cbi8qKlxuICogQ2hlY2sgaWYgb2JqZWN0IGlzIGFuIGFjY2VwdGFibGUgcGh5c2ljYWwgb2JqZWN0IGZvciB0aGlzIHBsdWdpbiAtIGEgTWF0dGVyIEJvZHksIGEgdGlsZSwgb3IgYW5cbiAqIG9iamVjdCB3aXRoIGEgYm9keSBwcm9wZXJ0eS5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGlzQ29sbGlkaW5nT2JqZWN0KG9iajogYW55KTogb2JqIGlzIENvbGxpZGluZ09iamVjdCB7XG4gIC8vIEdhbWVPYmplY3RzLCBpbWFnZXMsIHNwcml0ZXMgYW5kIHRpbGUgYm9kaWVzIHNob3VsZCBhbGwgaGF2ZSBhIGJvZHkgcHJvcGVydHkuXG4gIHJldHVybiBpc01hdHRlckJvZHkob2JqKSB8fCBvYmouYm9keSB8fCBvYmogaW5zdGFuY2VvZiBUaWxlO1xufVxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./valid-collision-object.ts\n')},phaser:t=>{t.exports=__WEBPACK_EXTERNAL_MODULE_phaser__}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var s=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](s,s.exports,__webpack_require__),s.exports}__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var s in e)__webpack_require__.o(e,s)&&!__webpack_require__.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__("./index.ts");return __webpack_exports__})()},module.exports=factory(requirePhaser())})(phaserMatterCollision);var phaserMatterCollisionExports=phaserMatterCollision.exports;const PhaserMatterCollisionPlugin=getDefaultExportFromCjs(phaserMatterCollisionExports);class MatterGravityFixPlugin extends Phaser.Plugins.ScenePlugin{constructor(t,e){super(t,e)}boot(){const t=Phaser.Physics.Matter.Matter;this.applyGravityFix(t)}applyGravityFix(t){t.Engine._bodiesApplyGravity=function(t,e){var s=void 0!==e.scale?e.scale:.001,i=t.length;if((0!==e.x||0!==e.y)&&0!==s)for(var n=0;n { + for (const s of t) + if ("childList" === s.type) + for (const t of s.addedNodes) + "LINK" === t.tagName && "modulepreload" === t.rel && e(t); + }).observe(document, { childList: !0, subtree: !0 }); + } + function e(t) { + if (t.ep) return; + t.ep = !0; + const e = (function (t) { + const e = {}; + return ( + t.integrity && (e.integrity = t.integrity), + t.referrerPolicy && (e.referrerPolicy = t.referrerPolicy), + "use-credentials" === t.crossOrigin + ? (e.credentials = "include") + : "anonymous" === t.crossOrigin + ? (e.credentials = "omit") + : (e.credentials = "same-origin"), + e + ); + })(t); + fetch(t.href, e); + } +})(); +var phaserExports = requirePhaser(); +const Phaser$1 = getDefaultExportFromCjs(phaserExports); +class Bootloader extends Phaser.Scene { + constructor() { + super({ key: "bootloader" }); + } + preload() { + this.createBars(), + this.setLoadEvents(), + this.loadFonts(), + this.loadImages(), + this.loadMaps(), + this.loadAudios(), + this.loadSpritesheets(); + } + setLoadEvents() { + this.load.on( + "progress", + function (t) { + this.progressBar.clear(), + this.progressBar.fillStyle(34986, 1), + this.progressBar.fillRect( + this.cameras.main.width / 4, + this.cameras.main.height / 2 - 16, + (this.cameras.main.width / 2) * t, + 16 + ); + }, + this + ), + this.load.on( + "complete", + () => { + this.scene.start("splash"); + }, + this + ); + } + loadFonts() { + this.load.bitmapFont( + "default", + "assets/fonts/pico.png", + "assets/fonts/pico.xml" + ); + } + loadImages() { + this.load.image("pello", "assets/images/pello_ok.png"), + this.load.image("fireball", "assets/images/fireball.png"), + this.load.image("tiles", "assets/maps/pixel-poem-tiles.png"), + this.load.image("block", "assets/images/block.png"), + this.load.image("seesaw", "assets/images/seesaw.png"), + this.load.image("bubble", "assets/images/bubble.png"), + this.load.image("platform", "assets/images/platform.png"); + } + loadMaps() { + this.load.tilemapTiledJSON("scene0", "assets/maps/level.json"); + } + loadAudios() { + Array(5) + .fill(0) + .forEach((t, e) => { + this.load.audio(`climb${e}`, `assets/sounds/climb${e}.mp3`); + }), + this.load.audio("splash", "assets/sounds/splash.mp3"), + this.load.audio("music", "assets/sounds/music.mp3"), + this.load.audio("jump", "assets/sounds/jump.mp3"), + this.load.audio("bubble", "assets/sounds/bubble.mp3"), + this.load.audio("trap", "assets/sounds/trap.mp3"), + this.load.audio("crash", "assets/sounds/crash.mp3"), + this.load.audio("fireball", "assets/sounds/fireball.mp3"), + this.load.audio("win", "assets/sounds/win.mp3"), + this.load.audio("start", "assets/sounds/start.mp3"), + this.load.audio("death", "assets/sounds/death.mp3"); + } + loadSpritesheets() { + this.load.spritesheet("player", "assets/images/player.png", { + frameWidth: 48, + frameHeight: 48, + }), + this.load.spritesheet("dust", "assets/images/dust.png", { + frameWidth: 32, + frameHeight: 32, + }), + this.load.spritesheet("coin", "assets/images/coin.png", { + frameWidth: 32, + frameHeight: 32, + }), + this.load.spritesheet("keys", "assets/images/keys.png", { + frameWidth: 48, + frameHeight: 48, + }), + this.load.spritesheet("bat", "assets/images/bat.png", { + frameWidth: 32, + frameHeight: 32, + }), + this.load.spritesheet("wizard", "assets/images/wizard.png", { + frameWidth: 48, + frameHeight: 48, + }); + } + createBars() { + (this.loadBar = this.add.graphics()), + this.loadBar.fillStyle(43771, 1), + this.loadBar.fillRect( + this.cameras.main.width / 4 - 2, + this.cameras.main.height / 2 - 18, + this.cameras.main.width / 2 + 4, + 20 + ), + (this.progressBar = this.add.graphics()); + } +} +class Outro extends Phaser.Scene { + constructor() { + super({ key: "outro" }); + } + init(t) { + (this.name = t.name), (this.number = t.number), (this.next = t.next); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.showPlayer(), + this.sound.add("win").play(), + (this.scoreCoins = this.add + .bitmapText( + this.center_width, + 50, + "default", + "Coins: " + this.registry.get("coins"), + 25 + ) + .setOrigin(0.5) + .setScrollFactor(0)), + (this.scoreSeconds = this.add + .bitmapText( + this.center_width, + 100, + "default", + "Time: " + this.registry.get("seconds"), + 25 + ) + .setOrigin(0.5) + .setScrollFactor(0)), + this.add + .bitmapText( + this.center_width, + this.center_height - 20, + "default", + "YOU DID IT!!", + 40 + ) + .setOrigin(0.5), + this.add + .bitmapText( + this.center_width, + this.center_height + 40, + "default", + "Press space to restart", + 25 + ) + .setOrigin(0.5), + this.input.keyboard.on("keydown-ENTER", () => this.loadNext(), this), + this.input.keyboard.on("keydown-SPACE", () => this.loadNext(), this); + } + loadNext() { + this.scene.start("splash"); + } + showPlayer() { + (this.player = this.add + .sprite(this.center_width, this.center_height - 120, "player") + .setOrigin(0.5) + .setScale(3)), + this.anims.create({ + key: "playeridle", + frames: this.anims.generateFrameNumbers("player", { start: 0, end: 1 }), + frameRate: 5, + repeat: -1, + }), + this.player.anims.play("playeridle"); + } +} +class Splash extends Phaser.Scene { + constructor() { + super({ key: "splash" }); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + (this.backLayer = this.add.layer()), + this.cameras.main.setBackgroundColor(0), + this.showTitle(), + this.addPlayerAndFoe(), + this.addAnimationTweens(), + this.time.delayedCall(1e3, () => this.showInstructions(), null, this), + this.input.keyboard.on("keydown-SPACE", () => this.startGame(), this), + this.input.keyboard.on("keydown-ENTER", () => this.startGame(), this), + this.playMusic(); + } + startGame() { + this.theme && this.theme.stop(), this.scene.start("transition"); + } + showTitle() { + (this.textShadow1 = this.add + .bitmapText(this.center_width, 100, "default", "DUNGEON", 85) + .setTint(16742522) + .setOrigin(0.5)), + (this.textShadow2 = this.add + .bitmapText(this.center_width, 250, "default", "BOBBLE", 85) + .setTint(16742522) + .setOrigin(0.5)), + (this.text1 = this.add + .bitmapText(this.center_width, 100, "default", "DUNGEON", 85) + .setTint(3153968) + .setOrigin(0.5)), + (this.text2 = this.add + .bitmapText(this.center_width, 250, "default", "BOBBLE", 85) + .setTint(3153968) + .setOrigin(0.5)), + (this.text11 = this.add + .bitmapText(this.center_width, 100, "default", "DUNGEON", 88) + .setTint(43771) + .setOrigin(0.5)), + (this.text22 = this.add + .bitmapText(this.center_width, 250, "default", "BOBBLE", 88) + .setTint(43771) + .setOrigin(0.5)), + this.tweens.add({ + targets: [this.textShadow1, this.textShadow2], + duration: 1e3, + x: "+=10", + y: "+=10", + yoyo: !0, + repeat: -1, + }); + } + playMusic(t = "splash") { + (this.theme = this.sound.add(t)), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 0.3, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } + showInstructions() { + this.add + .bitmapText(this.center_width, 430, "default", "WASD/Arrows: move", 30) + .setDropShadow(1, 1, 16742522, 0.7) + .setOrigin(0.5), + this.add + .sprite(this.center_width - 60, 490, "pello") + .setOrigin(0.5) + .setScale(0.3), + this.add + .bitmapText(this.center_width + 40, 490, "default", "By PELLO", 15) + .setDropShadow(1, 1, 16742522, 0.7) + .setOrigin(0.5), + (this.space = this.add + .bitmapText( + this.center_width, + 550, + "default", + "Press SPACE to start", + 25 + ) + .setDropShadow(1, 1, 4007227, 0.7) + .setOrigin(0.5)), + this.tweens.add({ + targets: this.space, + duration: 300, + alpha: { from: 0, to: 1 }, + repeat: -1, + yoyo: !0, + }); + } + addPlayerAndFoe() { + (this.player = this.add + .sprite(this.width - 100, 350, "player") + .setScale(2)), + this.anims.create({ + key: "playeridle", + frames: this.anims.generateFrameNumbers("player", { start: 0, end: 3 }), + frameRate: 5, + repeat: -1, + }), + this.player.anims.play("playeridle"), + (this.foe = this.add.sprite(this.width, 350, "wizard").setScale(2)), + this.anims.create({ + key: "foe", + frames: this.anims.generateFrameNumbers("wizard", { start: 0, end: 4 }), + frameRate: 5, + repeat: -1, + }), + this.foe.anims.play("foe"); + } + addAnimationTweens() { + this.tweens.add({ + targets: [this.player], + x: { from: this.player.x, to: 0 }, + duration: 2500, + yoyo: !0, + repeat: -1, + onYoyo: () => { + this.player.flipX = !this.player.flipX; + }, + onRepeat: () => { + this.player.flipX = !this.player.flipX; + }, + }), + this.tweens.add({ + targets: [this.foe], + x: { from: this.foe.x, to: 100 }, + duration: 2500, + yoyo: !0, + repeat: -1, + onYoyo: () => { + this.foe.flipX = !this.foe.flipX; + }, + onRepeat: () => { + this.foe.flipX = !this.foe.flipX; + }, + }); + } +} +class Transition extends Phaser.Scene { + constructor() { + super({ key: "transition" }); + } + create() { + this.sound.stopAll(), + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.sound.add("start").play(), + this.playMusic(), + (this.key = this.add + .sprite(this.center_width, this.center_height - 120, "keys", 0) + .setOrigin(0.5) + .setScale(2)), + this.add + .bitmapText( + this.center_width, + this.center_height - 20, + "default", + "GET ALL KEYS", + 30 + ) + .setOrigin(0.5), + this.add + .bitmapText( + this.center_width, + this.center_height + 40, + "default", + "from all rooms!", + 25 + ) + .setOrigin(0.5), + this.input.keyboard.on("keydown-ENTER", () => this.loadNext(), this), + this.input.keyboard.on("keydown-SPACE", () => this.loadNext(), this), + this.time.delayedCall(1e3, () => this.loadNext(), null, this); + } + loadNext() { + this.scene.start("game"); + } + playMusic(t = "music") { + (this.theme = this.sound.add(t)), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 0.2, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } +} +class Bat extends Phaser.Physics.Matter.Sprite { + constructor(t, e, s, i = "bat", n) { + super(t.matter.world, e, s, i, 0), + (this.label = "bat"), + (this.scene = t), + this.scene.add.existing(this), + (this.startX = e), + (this.direction = Phaser.Math.RND.pick([-1, 1])), + this.setFixedRotation(), + this.setIgnoreGravity(!0), + this.addCollisions(), + this.init(); + } + init() { + this.scene.anims.create({ + key: this.label, + frames: this.scene.anims.generateFrameNumbers(this.label, { + start: 0, + end: 1, + }), + frameRate: 5, + repeat: -1, + }), + this.scene.anims.create({ + key: this.label + "death", + frames: this.scene.anims.generateFrameNumbers(this.label, { + start: 2, + end: 5, + }), + frameRate: 5, + }), + this.anims.play(this.label, !0), + this.on("animationcomplete", this.animationComplete, this), + this.setVelocityX(5 * this.direction), + this.scene.events.on("update", this.update, this); + } + addCollisions() { + this.unsubscribeBatCollide = this.scene.matterCollision.addOnCollideStart({ + objectA: this, + callback: this.onBatCollide, + context: this, + }); + } + onBatCollide({ gameObjectA: t, gameObjectB: e }) { + e instanceof Bubble && (e.load("bat"), this.destroy()); + } + update() { + this.active && Math.abs(this.body.velocity.x) <= 0.5 && this.turn(); + } + turn() { + (this.direction = -this.direction), + (this.flipX = this.direction > 0), + this.setFlipX(this.direction > 0), + this.setVelocityX(5 * this.direction); + } + death() { + (this.dead = !0), this.anims.play(this.label + "death"); + } + animationComplete(t, e) { + t.key === this.label + "death" && this.destroy(); + } +} +class Fireball extends Phaser.Physics.Matter.Sprite { + constructor(t, e, s, i) { + super(t.matter.world, e, s, "fireball", 0), + (this.label = "fireball"), + (this.scene = t), + (this.direction = i), + t.add.existing(this), + this.setIgnoreGravity(!0), + this.setVelocityX(5 * this.direction), + this.setVelocityY(Phaser.Math.Between(0, -8)), + this.setBounce(1), + this.init(); + } + init() { + this.scene.events.on("update", this.update, this), + (this.tween = this.scene.tweens.add({ + targets: this, + duration: 200, + scale: { from: 0.9, to: 1 }, + repeat: -1, + })), + this.scene.time.delayedCall( + 3e3, + () => { + this.destroy(); + }, + null, + this + ); + } + update() { + var t; + null == (t = this.scene) || t.gameOver; + } + destroy() { + this.tween.destroy(), super.destroy(); + } +} +class Wizard extends Phaser.Physics.Matter.Sprite { + constructor(t, e, s, i = "wizard", n) { + super(t.matter.world, e, s, i, 0), + (this.label = "wizard"), + this.scene.add.existing(this), + (this.startX = e), + (this.direction = Phaser.Math.RND.pick([-1, 1])), + this.setFixedRotation(), + this.addCollisions(), + this.init(); + } + init() { + this.scene.anims.create({ + key: this.label, + frames: this.scene.anims.generateFrameNumbers(this.label, { + start: 0, + end: 5, + }), + frameRate: 5, + repeat: -1, + }), + this.anims.play(this.label, !0), + this.scene.events.on("update", this.update, this), + (this.timer = this.scene.time.addEvent({ + delay: 3e3, + callback: this.directShot, + callbackScope: this, + loop: !0, + })); + } + addCollisions() { + this.unsubscribeBatCollide = this.scene.matterCollision.addOnCollideStart({ + objectA: this, + callback: this.onWizardCollide, + context: this, + }); + } + onWizardCollide({ gameObjectA: t, gameObjectB: e }) { + e instanceof Bubble && (e.load("wizard"), this.destroy()); + } + directShot() { + this.scene.playAudio("fireball"), + Phaser.Math.Distance.BetweenPoints(this.scene.player, this), + this.anims.play("wizardshot", !0), + new Fireball(this.scene, this.x, this.y, this.direction), + (this.delayedTurn = this.scene.time.delayedCall( + 1e3, + () => { + this.turn(); + }, + null, + this + )); + } + turn() { + (this.direction = -this.direction), + (this.flipX = this.direction > 0), + this.setFlipX(this.direction > 0), + this.setVelocityX(5 * this.direction); + } + destroy() { + this.timer && this.timer.destroy(), + this.delayedTurn && this.delayedTurn.destroy(), + this.fireball && this.fireball.destroy(), + super.destroy(); + } +} +class Bubble extends Phaser.Physics.Matter.Sprite { + constructor(t, e, s, i, n = { isStatic: !0 }) { + super(t.matter.world, e + i, s, "bubble", 0, n), + (this.offset = i), + this.setFriction(1, 0, 1 / 0), + (this.startX = e), + (this.startY = s), + (this.scene = t), + t.add.existing(this), + this.moveVertically(), + this.scene.events.on("update", this.update, this); + } + load(t) { + this.scene.playAudio("trap"), + (this.loaded = this.scene.add + .sprite(this.x, this.y, t) + .setOrigin(0.5) + .setScale(0.6)), + (this.loaded.name = t), + (this.loadedTween = this.scene.tweens.add({ + targets: this.loaded, + rotation: "+=5", + yoyo: !0, + repeat: -1, + })); + } + moveHorizontally() { + this.scene.tweens.add({ + targets: this, + scaleX: { from: 1, to: 0.9 }, + yoyo: !0, + repeat: -1, + duration: 200, + }), + this.scene.tweens.addCounter({ + from: 0, + to: Phaser.Math.Between(-400, 400), + duration: 3500, + ease: Phaser.Math.Easing.Sine.InOut, + onUpdate: (t, e) => { + const s = this.startX + e.value, + i = s - this.x; + (this.x = s), this.setVelocityX(i); + }, + onComplete: () => { + this.scene.time.delayedCall( + 1e3, + () => { + this.destroy(); + }, + null, + this + ); + }, + }); + } + moveVertically() { + (this.blob = this.scene.tweens.add({ + targets: this, + scaleX: { from: 1, to: 0.9 }, + yoyo: !0, + repeat: -1, + duration: 200, + })), + this.scene.tweens.addCounter({ + from: 0, + to: -300, + duration: 4500, + ease: Phaser.Math.Easing.Sine.InOut, + onUpdate: (t, e) => { + const s = this.startY + e.value, + i = s - this.y; + (this.y = s), this.setVelocityY(i); + }, + onComplete: () => { + this.blob.destroy(), + this.scene.time.delayedCall( + 1e3, + () => { + this.destroy(); + }, + null, + this + ); + }, + }); + } + respawn() { + this.loadedTween.destroy(), + "wizard" === this.loaded.name + ? new Wizard(this.scene, this.x, this.y) + : "bat" === this.loaded.name && new Bat(this.scene, this.x, this.y), + this.loaded.destroy(), + (this.loaded = null); + } + update() { + this.active && + this.loaded && + ((this.loaded.x = this.x), (this.loaded.y = this.y)); + } + destroy() { + this.scene && + (this.scene.playAudio("crash"), + this.loaded && this.respawn(), + super.destroy()); + } +} +class Dust extends Phaser.GameObjects.Sprite { + constructor(t, e, s, i = "dust", n = !1) { + super(t, e, s, i), + (this.scene = t), + (this.name = i), + this.setScale(0.5), + this.scene.add.existing(this), + this.init(n); + } + init(t) { + t && + this.scene.tweens.add({ + targets: this, + duration: Phaser.Math.Between(500, 1e3), + alpha: { from: 1, to: 0 }, + onComplete: () => { + this.destroy(); + }, + }), + this.scene.anims.create({ + key: this.name, + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 0, + end: 10, + }), + frameRate: 10, + }), + this.on("animationcomplete", this.animationComplete, this), + this.anims.play(this.name, !0); + } + animationComplete() { + this.destroy(); + } +} +class Player { + constructor(t, e, s) { + (this.scene = t), + (this.label = "player"), + (this.moveForce = 0.01), + (this.invincible = !0), + (this.isTouching = { left: !1, right: !1, ground: !1 }), + (this.canJump = !0), + (this.jumpCooldownTimer = null), + (this.canShoot = !0), + (this.shootCooldownTimer = null), + (this.onWall = !1), + this.init(e, s), + this.addControls(); + } + init(t, e) { + this.scene.matter.world.on("beforeupdate", this.resetTouching, this), + (this.sprite = this.scene.matter.add.sprite(0, 0, "player", 0)); + const { Body: s, Bodies: i } = Phaser.Physics.Matter.Matter, + { width: n, height: o } = this.sprite, + a = i.rectangle(0, 5, n - 14, o - 10, { chamfer: { radius: 10 } }); + this.sensors = { + bottom: i.rectangle(0, 0.5 * o, 0.25 * n, 2, { isSensor: !0 }), + left: i.rectangle(0.35 * -n, 0, 2, 0.5 * o, { isSensor: !0 }), + right: i.rectangle(0.35 * n, 0, 2, 0.5 * o, { isSensor: !0 }), + }; + const r = s.create({ + parts: [a, this.sensors.bottom, this.sensors.left, this.sensors.right], + frictionStatic: 0, + frictionAir: 0.02, + friction: 0.1, + render: { sprite: { xOffset: 0.5, yOffset: 0.5 } }, + }); + this.sprite.setExistingBody(r).setFixedRotation().setPosition(t, e), + this.addEvents(), + this.addColliders(), + this.addAnimations(), + this.initInvincible(); + } + addEvents() { + this.scene.events.on("update", this.update, this), + this.scene.events.once("shutdown", this.destroy, this), + this.scene.events.once("destroy", this.destroy, this); + } + addColliders() { + this.scene.matterCollision.addOnCollideStart({ + objectA: [this.sensors.bottom, this.sensors.left, this.sensors.right], + callback: this.onSensorCollide, + context: this, + }), + this.scene.matterCollision.addOnCollideActive({ + objectA: [this.sensors.bottom, this.sensors.left, this.sensors.right], + callback: this.onSensorCollide, + context: this, + }); + } + addAnimations() { + this.scene.anims.create({ + key: "playeridle", + frames: this.scene.anims.generateFrameNumbers(this.label, { + start: 0, + end: 1, + }), + frameRate: 5, + repeat: -1, + }), + this.scene.anims.create({ + key: "playerwalk", + frames: this.scene.anims.generateFrameNumbers(this.label, { + start: 0, + end: 3, + }), + frameRate: 6, + }), + this.scene.anims.create({ + key: "playershot", + frames: this.scene.anims.generateFrameNumbers(this.label, { + start: 4, + end: 5, + }), + frameRate: 4, + }), + this.sprite.anims.play("playeridle", !0), + this.sprite.on("animationcomplete", this.animationComplete, this); + } + initInvincible() { + this.scene.tweens.add({ + targets: this.sprite, + alpha: { from: 0.5, to: 1 }, + duration: 200, + repeat: 10, + onComplete: () => { + this.invincible = !1; + }, + }); + } + onSensorCollide({ bodyA: t, bodyB: e, pair: s }) { + e.isSensor || + (t === this.sensors.left + ? (this.friction(), + (this.onWall = !0), + (this.isTouching.left = !0), + s.separation > 0.5 && (this.sprite.x += s.separation - 0.5)) + : t === this.sensors.right + ? (this.friction(), + (this.onWall = !0), + (this.isTouching.right = !0), + s.separation > 0.5 && (this.sprite.x -= s.separation - 0.5)) + : t === this.sensors.bottom && + (this.land(), (this.isTouching.ground = !0))); + } + resetTouching() { + (this.isTouching.left = !1), + (this.isTouching.right = !1), + (this.isTouching.ground = !1); + } + addControls() { + (this.cursor = this.scene.input.keyboard.createCursorKeys()), + (this.W = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.W + )), + (this.A = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.A + )), + (this.S = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.S + )), + (this.D = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.D + )); + } + update() { + (this.isOnGround = this.isTouching.ground), + (this.isInAir = !this.isOnGround), + (this.moveForce = this.isOnGround ? 0.01 : 0.005), + this.D.isDown || this.cursor.right.isDown + ? (this.sprite.setFlipX(!0), + (this.isInAir && this.isTouching.right) || + (this.step(), + this.sprite.anims.play("playerwalk", !0), + this.sprite.setVelocityX(5))) + : this.A.isDown || this.cursor.left.isDown + ? (this.sprite.setFlipX(!1), + (this.isInAir && this.isTouching.left) || + (this.step(), + this.sprite.anims.play("playerwalk", !0), + this.sprite.setVelocityX(-5))) + : "playershot" !== this.sprite.anims.currentAnim.key && + this.sprite.anims.play("playeridle", !0), + this.sprite.body.velocity.x > 7 + ? this.sprite.setVelocityX(7) + : this.sprite.body.velocity.x < -7 && this.sprite.setVelocityX(-7), + this.checkJump(), + this.checkShoot(); + } + checkJump() { + ((this.canJump && this.isOnGround) || this.onWall) && + (this.W.isDown || this.cursor.up.isDown) && + (this.sprite.setVelocityY(-8), + this.scene.playAudio("jump"), + (this.canJump = !1), + (this.onWall = !1), + (this.jumpCooldownTimer = this.scene.time.addEvent({ + delay: 250, + callback: () => (this.canJump = !0), + }))); + } + checkShoot() { + if ( + this.canShoot && + (Phaser.Input.Keyboard.JustDown(this.cursor.down) || + Phaser.Input.Keyboard.JustDown(this.W)) + ) { + const t = this.sprite.flipX ? 128 : -128; + this.sprite.anims.play("playershot", !0), + this.scene.playAudio("bubble"), + (this.canShoot = !1), + new Bubble(this.scene, this.sprite.x, this.sprite.y, t), + (this.shootCooldownTimer = this.scene.time.addEvent({ + delay: 500, + callback: () => (this.canShoot = !0), + })); + } + } + destroy() { + this.scene.playAudio("death"), + (this.destroyed = !0), + this.scene.events.off("update", this.update, this), + this.scene.events.off("shutdown", this.destroy, this), + this.scene.events.off("destroy", this.destroy, this), + this.scene.matter.world && + this.scene.matter.world.off("beforeupdate", this.resetTouching, this); + const t = [this.sensors.bottom, this.sensors.left, this.sensors.right]; + this.scene.matterCollision.removeOnCollideStart({ objectA: t }), + this.scene.matterCollision.removeOnCollideActive({ objectA: t }), + this.jumpCooldownTimer && this.jumpCooldownTimer.destroy(), + this.sprite.destroy(); + } + step() { + Phaser.Math.Between(0, 5) > 4 && + this.scene.trailLayer.add( + new Dust( + this.scene, + this.sprite.x, + this.sprite.y + Phaser.Math.Between(10, 16) + ) + ); + } + friction() { + Array(Phaser.Math.Between(2, 4)) + .fill(0) + .forEach((t) => { + new Dust( + this.scene, + this.sprite.x + Phaser.Math.Between(-8, 8), + this.sprite.y + Phaser.Math.Between(-32, 32) + ); + }); + } + land() { + this.sprite.body.velocity.y < 1 || + Array(Phaser.Math.Between(3, 6)) + .fill(0) + .forEach((t) => { + new Dust( + this.scene, + this.sprite.x + Phaser.Math.Between(-32, 32), + this.sprite.y + Phaser.Math.Between(10, 16) + ); + }); + } + explosion() { + Array(Phaser.Math.Between(10, 15)) + .fill(0) + .forEach((t) => { + new Dust( + this.scene, + this.sprite.x + Phaser.Math.Between(-32, 32), + this.sprite.y + Phaser.Math.Between(20, 36) + ); + }); + } + animationComplete(t, e) { + "playershot" === t.key && this.sprite.anims.play("playeridle", !0); + } +} +var dungeon_min = { exports: {} }; +"undefined" != typeof self && self, + (dungeon_min.exports = (function () { + return ( + (s = {}), + (t.m = e = + [ + function (t, e) { + t.exports = function () { + throw new Error("define cannot be used indirect"); + }; + }, + function (t, e) { + t.exports = function (t) { + return ( + t.webpackPolyfill || + ((t.deprecate = function () {}), + (t.paths = []), + t.children || (t.children = []), + Object.defineProperty(t, "loaded", { + enumerable: !0, + get: function () { + return t.l; + }, + }), + Object.defineProperty(t, "id", { + enumerable: !0, + get: function () { + return t.i; + }, + }), + (t.webpackPolyfill = 1)), + t + ); + }; + }, + function (t, e) { + (function (e) { + t.exports = e; + }).call(this, {}); + }, + function (t, e, s) { + var i = s(4), + n = s(5), + o = s(6), + a = s(7), + r = s(8), + l = s(9), + h = s(10); + (h.alea = i), + (h.xor128 = n), + (h.xorwow = o), + (h.xorshift7 = a), + (h.xor4096 = r), + (h.tychei = l), + (t.exports = h); + }, + function (t, e, s) { + (function (t) { + var i; + !(function (t) { + function n(t) { + var e, + s = this, + i = + ((e = 4022871197), + function (t) { + t = String(t); + for (var s = 0; s < t.length; s++) { + var i = 0.02519603282416938 * (e += t.charCodeAt(s)); + (i -= e = i >>> 0), + (e = (i *= e) >>> 0), + (e += 4294967296 * (i -= e)); + } + return 2.3283064365386963e-10 * (e >>> 0); + }); + (s.next = function () { + var t = 2091639 * s.s0 + 2.3283064365386963e-10 * s.c; + return ( + (s.s0 = s.s1), (s.s1 = s.s2), (s.s2 = t - (s.c = 0 | t)) + ); + }), + (s.c = 1), + (s.s0 = i(" ")), + (s.s1 = i(" ")), + (s.s2 = i(" ")), + (s.s0 -= i(t)), + s.s0 < 0 && (s.s0 += 1), + (s.s1 -= i(t)), + s.s1 < 0 && (s.s1 += 1), + (s.s2 -= i(t)), + s.s2 < 0 && (s.s2 += 1), + (i = null); + } + function o(t, e) { + return ( + (e.c = t.c), (e.s0 = t.s0), (e.s1 = t.s1), (e.s2 = t.s2), e + ); + } + function a(t, e) { + var s = new n(t), + i = e && e.state, + a = s.next; + return ( + (a.int32 = function () { + return (4294967296 * s.next()) | 0; + }), + (a.double = function () { + return ( + a() + 11102230246251565e-32 * ((2097152 * a()) | 0) + ); + }), + (a.quick = a), + i && + ("object" == typeof i && o(i, s), + (a.state = function () { + return o(s, {}); + })), + a + ); + } + t && t.exports + ? (t.exports = a) + : s(0) && s(2) + ? void 0 === + (i = function () { + return a; + }.call(e, s, e, t)) || (t.exports = i) + : (this.alea = a); + })(t, s(0)); + }).call(this, s(1)(t)); + }, + function (t, e, s) { + (function (t) { + var i; + !(function (t) { + function n(t) { + var e = this, + s = ""; + (e.x = 0), + (e.y = 0), + (e.z = 0), + (e.w = 0), + (e.next = function () { + var t = e.x ^ (e.x << 11); + return ( + (e.x = e.y), + (e.y = e.z), + (e.z = e.w), + (e.w ^= (e.w >>> 19) ^ t ^ (t >>> 8)) + ); + }), + t === (0 | t) ? (e.x = t) : (s += t); + for (var i = 0; i < s.length + 64; i++) + (e.x ^= 0 | s.charCodeAt(i)), e.next(); + } + function o(t, e) { + return (e.x = t.x), (e.y = t.y), (e.z = t.z), (e.w = t.w), e; + } + function a(t, e) { + function s() { + return (i.next() >>> 0) / 4294967296; + } + var i = new n(t), + a = e && e.state; + return ( + (s.double = function () { + do { + var t = + ((i.next() >>> 11) + (i.next() >>> 0) / 4294967296) / + (1 << 21); + } while (0 === t); + return t; + }), + (s.int32 = i.next), + (s.quick = s), + a && + ("object" == typeof a && o(a, i), + (s.state = function () { + return o(i, {}); + })), + s + ); + } + t && t.exports + ? (t.exports = a) + : s(0) && s(2) + ? void 0 === + (i = function () { + return a; + }.call(e, s, e, t)) || (t.exports = i) + : (this.xor128 = a); + })(t, s(0)); + }).call(this, s(1)(t)); + }, + function (t, e, s) { + (function (t) { + var i; + !(function (t) { + function n(t) { + var e = this, + s = ""; + (e.next = function () { + var t = e.x ^ (e.x >>> 2); + return ( + (e.x = e.y), + (e.y = e.z), + (e.z = e.w), + (e.w = e.v), + ((e.d = (e.d + 362437) | 0) + + (e.v = e.v ^ (e.v << 4) ^ t ^ (t << 1))) | + 0 + ); + }), + (e.x = 0), + (e.y = 0), + (e.z = 0), + (e.w = 0), + t === ((e.v = 0) | t) ? (e.x = t) : (s += t); + for (var i = 0; i < s.length + 64; i++) + (e.x ^= 0 | s.charCodeAt(i)), + i == s.length && (e.d = (e.x << 10) ^ (e.x >>> 4)), + e.next(); + } + function o(t, e) { + return ( + (e.x = t.x), + (e.y = t.y), + (e.z = t.z), + (e.w = t.w), + (e.v = t.v), + (e.d = t.d), + e + ); + } + function a(t, e) { + function s() { + return (i.next() >>> 0) / 4294967296; + } + var i = new n(t), + a = e && e.state; + return ( + (s.double = function () { + do { + var t = + ((i.next() >>> 11) + (i.next() >>> 0) / 4294967296) / + (1 << 21); + } while (0 === t); + return t; + }), + (s.int32 = i.next), + (s.quick = s), + a && + ("object" == typeof a && o(a, i), + (s.state = function () { + return o(i, {}); + })), + s + ); + } + t && t.exports + ? (t.exports = a) + : s(0) && s(2) + ? void 0 === + (i = function () { + return a; + }.call(e, s, e, t)) || (t.exports = i) + : (this.xorwow = a); + })(t, s(0)); + }).call(this, s(1)(t)); + }, + function (t, e, s) { + (function (t) { + var i; + !(function (t) { + function n(t) { + var e = this; + (e.next = function () { + var t, + s, + i = e.x, + n = e.i; + return ( + (t = i[n]), + (s = (t ^= t >>> 7) ^ (t << 24)), + (s ^= (t = i[(n + 1) & 7]) ^ (t >>> 10)), + (s ^= (t = i[(n + 3) & 7]) ^ (t >>> 3)), + (s ^= (t = i[(n + 4) & 7]) ^ (t << 7)), + (t = i[(n + 7) & 7]), + (s ^= (t ^= t << 13) ^ (t << 9)), + (i[n] = s), + (e.i = (n + 1) & 7), + s + ); + }), + (function (t, e) { + var s, + i = []; + if (e === (0 | e)) i[0] = e; + else + for (e = "" + e, s = 0; s < e.length; ++s) + i[7 & s] = + (i[7 & s] << 15) ^ + ((e.charCodeAt(s) + i[(s + 1) & 7]) << 13); + for (; i.length < 8; ) i.push(0); + for (s = 0; s < 8 && 0 === i[s]; ++s); + for ( + 8 == s ? (i[7] = -1) : i[s], t.x = i, t.i = 0, s = 256; + 0 < s; + --s + ) + t.next(); + })(e, t); + } + function o(t, e) { + return (e.x = t.x.slice()), (e.i = t.i), e; + } + function a(t, e) { + function s() { + return (i.next() >>> 0) / 4294967296; + } + null == t && (t = +new Date()); + var i = new n(t), + a = e && e.state; + return ( + (s.double = function () { + do { + var t = + ((i.next() >>> 11) + (i.next() >>> 0) / 4294967296) / + (1 << 21); + } while (0 === t); + return t; + }), + (s.int32 = i.next), + (s.quick = s), + a && + (a.x && o(a, i), + (s.state = function () { + return o(i, {}); + })), + s + ); + } + t && t.exports + ? (t.exports = a) + : s(0) && s(2) + ? void 0 === + (i = function () { + return a; + }.call(e, s, e, t)) || (t.exports = i) + : (this.xorshift7 = a); + })(t, s(0)); + }).call(this, s(1)(t)); + }, + function (t, e, s) { + (function (t) { + var i; + !(function (t) { + function n(t) { + var e = this; + (e.next = function () { + var t, + s, + i = e.w, + n = e.X, + o = e.i; + return ( + (e.w = i = (i + 1640531527) | 0), + (s = n[(o + 34) & 127]), + (t = n[(o = (o + 1) & 127)]), + (s ^= s << 13), + (t ^= t << 17), + (s ^= s >>> 15), + (t ^= t >>> 12), + (s = n[o] = s ^ t), + (e.i = o), + (s + (i ^ (i >>> 16))) | 0 + ); + }), + (function (t, e) { + var s, + i, + n, + o, + a, + r = [], + l = 128; + for ( + e === (0 | e) + ? ((i = e), (e = null)) + : ((e += "\0"), (i = 0), (l = Math.max(l, e.length))), + n = 0, + o = -32; + o < l; + ++o + ) + e && (i ^= e.charCodeAt((o + 32) % e.length)), + 0 === o && (a = i), + (i ^= i << 10), + (i ^= i >>> 15), + (i ^= i << 4), + (i ^= i >>> 13), + 0 <= o && + ((a = (a + 1640531527) | 0), + (n = 0 == (s = r[127 & o] ^= i + a) ? n + 1 : 0)); + for ( + 128 <= n && (r[127 & ((e && e.length) || 0)] = -1), + n = 127, + o = 512; + 0 < o; + --o + ) + (i = r[(n + 34) & 127]), + (s = r[(n = (n + 1) & 127)]), + (i ^= i << 13), + (s ^= s << 17), + (i ^= i >>> 15), + (s ^= s >>> 12), + (r[n] = i ^ s); + (t.w = a), (t.X = r), (t.i = n); + })(e, t); + } + function o(t, e) { + return (e.i = t.i), (e.w = t.w), (e.X = t.X.slice()), e; + } + function a(t, e) { + function s() { + return (i.next() >>> 0) / 4294967296; + } + null == t && (t = +new Date()); + var i = new n(t), + a = e && e.state; + return ( + (s.double = function () { + do { + var t = + ((i.next() >>> 11) + (i.next() >>> 0) / 4294967296) / + (1 << 21); + } while (0 === t); + return t; + }), + (s.int32 = i.next), + (s.quick = s), + a && + (a.X && o(a, i), + (s.state = function () { + return o(i, {}); + })), + s + ); + } + t && t.exports + ? (t.exports = a) + : s(0) && s(2) + ? void 0 === + (i = function () { + return a; + }.call(e, s, e, t)) || (t.exports = i) + : (this.xor4096 = a); + })(t, s(0)); + }).call(this, s(1)(t)); + }, + function (t, e, s) { + (function (t) { + var i; + !(function (t) { + function n(t) { + var e = this, + s = ""; + (e.next = function () { + var t = e.b, + s = e.c, + i = e.d, + n = e.a; + return ( + (t = (t << 25) ^ (t >>> 7) ^ s), + (s = (s - i) | 0), + (i = (i << 24) ^ (i >>> 8) ^ n), + (n = (n - t) | 0), + (e.b = t = (t << 20) ^ (t >>> 12) ^ s), + (e.c = s = (s - i) | 0), + (e.d = (i << 16) ^ (s >>> 16) ^ n), + (e.a = (n - t) | 0) + ); + }), + (e.a = 0), + (e.b = 0), + (e.c = -1640531527), + (e.d = 1367130551), + t === Math.floor(t) + ? ((e.a = (t / 4294967296) | 0), (e.b = 0 | t)) + : (s += t); + for (var i = 0; i < s.length + 20; i++) + (e.b ^= 0 | s.charCodeAt(i)), e.next(); + } + function o(t, e) { + return (e.a = t.a), (e.b = t.b), (e.c = t.c), (e.d = t.d), e; + } + function a(t, e) { + function s() { + return (i.next() >>> 0) / 4294967296; + } + var i = new n(t), + a = e && e.state; + return ( + (s.double = function () { + do { + var t = + ((i.next() >>> 11) + (i.next() >>> 0) / 4294967296) / + (1 << 21); + } while (0 === t); + return t; + }), + (s.int32 = i.next), + (s.quick = s), + a && + ("object" == typeof a && o(a, i), + (s.state = function () { + return o(i, {}); + })), + s + ); + } + t && t.exports + ? (t.exports = a) + : s(0) && s(2) + ? void 0 === + (i = function () { + return a; + }.call(e, s, e, t)) || (t.exports = i) + : (this.tychei = a); + })(t, s(0)); + }).call(this, s(1)(t)); + }, + function (t, e, s) { + var i; + !(function (n, o, a) { + var r, + l = 256, + h = a.pow(l, 6), + d = a.pow(2, 52), + c = 2 * d, + Q = l - 1; + function B(t, e, s) { + function i() { + for (var t = u.g(6), e = h, s = 0; t < d; ) + (t = (t + s) * l), (e *= l), (s = u.g(1)); + for (; c <= t; ) (t /= 2), (e /= 2), (s >>>= 1); + return (t + s) / e; + } + var Q = [], + B = b( + (function t(e, s) { + var i, + n = [], + o = typeof e; + if (s && "object" == o) + for (i in e) + try { + n.push(t(e[i], s - 1)); + } catch (a) {} + return n.length ? n : "string" == o ? e : e + "\0"; + })( + (e = 1 == e ? { entropy: !0 } : e || {}).entropy + ? [t, g(o)] + : null == t + ? (function () { + try { + var t; + return ( + r && (t = r.randomBytes) + ? (t = t(l)) + : ((t = new Uint8Array(l)), + (n.crypto || n.msCrypto).getRandomValues( + t + )), + g(t) + ); + } catch (i) { + var e = n.navigator, + s = e && e.plugins; + return [+new Date(), n, s, n.screen, g(o)]; + } + })() + : t, + 3 + ), + Q + ), + u = new F(Q); + return ( + (i.int32 = function () { + return 0 | u.g(4); + }), + (i.quick = function () { + return u.g(4) / 4294967296; + }), + (i.double = i), + b(g(u.S), o), + ( + e.pass || + s || + function (t, e, s, i) { + return ( + i && + (i.S && U(i, u), + (t.state = function () { + return U(u, {}); + })), + s ? ((a.random = t), e) : t + ); + } + )(i, B, "global" in e ? e.global : this == a, e.state) + ); + } + function F(t) { + var e, + s = t.length, + i = this, + n = 0, + o = (i.i = i.j = 0), + a = (i.S = []); + for (s || (t = [s++]); n < l; ) a[n] = n++; + for (n = 0; n < l; n++) + (a[n] = a[(o = Q & (o + t[n % s] + (e = a[n])))]), (a[o] = e); + (i.g = function (t) { + for (var e, s = 0, n = i.i, o = i.j, a = i.S; t--; ) + (e = a[(n = Q & (n + 1))]), + (s = + s * l + + a[Q & ((a[n] = a[(o = Q & (o + e))]) + (a[o] = e))]); + return (i.i = n), (i.j = o), s; + })(l); + } + function U(t, e) { + return (e.i = t.i), (e.j = t.j), (e.S = t.S.slice()), e; + } + function b(t, e) { + for (var s, i = t + "", n = 0; n < i.length; ) + e[Q & n] = Q & ((s ^= 19 * e[Q & n]) + i.charCodeAt(n++)); + return g(e); + } + function g(t) { + return String.fromCharCode.apply(0, t); + } + if ((b(a.random(), o), t.exports)) { + t.exports = B; + try { + r = s(11); + } catch (u) {} + } else + void 0 === + (i = function () { + return B; + }.call(e, s, e, t)) || (t.exports = i); + })("undefined" != typeof self ? self : this, [], Math); + }, + function (t, e) {}, + function (t, e, s) { + s.r(e); + var i = s(3); + function n(t) { + this.rng = i(t); + } + var o, + a, + r = + ((n.prototype.randomInteger = function (t, e, s) { + var i = void 0 === s ? {} : s, + n = i.onlyOdd, + o = void 0 !== n && n, + a = i.onlyEven, + r = void 0 !== a && a; + return o + ? this.randomOddInteger(t, e) + : r + ? this.randomEvenInteger(t, e) + : Math.floor(this.rng() * (e - t + 1) + t); + }), + (n.prototype.randomEvenInteger = function (t, e) { + t % 2 != 0 && t < e && t++, e % 2 != 0 && t < e && e--; + var s = (e - t) / 2; + return 2 * Math.floor(this.rng() * (1 + s)) + t; + }), + (n.prototype.randomOddInteger = function (t, e) { + t % 2 == 0 && t++, e % 2 == 0 && e--; + var s = (e - t) / 2; + return 2 * Math.floor(this.rng() * (1 + s)) + t; + }), + (n.prototype.randomPick = function (t) { + return t[this.randomInteger(0, t.length - 1)]; + }), + n); + ((a = o = o || {})[(a.EMPTY = 0)] = "EMPTY"), + (a[(a.WALL = 1)] = "WALL"), + (a[(a.FLOOR = 2)] = "FLOOR"), + (a[(a.DOOR = 3)] = "DOOR"); + var l = o, + h = function () { + for (var t = 0, e = 0, s = arguments.length; e < s; e++) + t += arguments[e].length; + var i = Array(t), + n = 0; + for (e = 0; e < s; e++) + for ( + var o = arguments[e], a = 0, r = o.length; + a < r; + a++, n++ + ) + i[n] = o[a]; + return i; + }; + function d(t, e, s) { + return h(Array(e)).map(function () { + return Array(t).fill(s); + }); + } + function c(t, e) { + (this.width = t), + (this.height = e), + (this.x = 0), + (this.y = 0), + (this.left = 0), + (this.right = 0), + (this.top = 0), + (this.bottom = 0), + (this.centerX = 0), + (this.centerY = 0), + (this.width = t), + (this.height = e), + this.setPosition(0, 0), + (this.tiles = d(t, e, l.FLOOR)); + for (var s = 0; s < this.height; s++) + this.setTileAt(0, s, l.WALL), this.setTileAt(t - 1, s, l.WALL); + for (var i = 0; i < this.width; i++) + this.setTileAt(i, 0, l.WALL), this.setTileAt(i, e - 1, l.WALL); + } + var Q = + ((c.prototype.forEachTile = function (t) { + for (var e = 0; e < this.height; e++) + for (var s = 0; s < this.width; s++) + t({ x: s, y: e }, this.getTileAt(s, e)); + }), + (c.prototype.setPosition = function (t, e) { + (this.x = t), + (this.y = e), + (this.left = t), + (this.right = t + (this.width - 1)), + (this.top = e), + (this.bottom = e + (this.height - 1)), + (this.centerX = t + Math.floor(this.width / 2)), + (this.centerY = e + Math.floor(this.height / 2)); + }), + (c.prototype.getDoorLocations = function () { + for (var t = [], e = 0; e < this.height; e++) + for (var s = 0; s < this.width; s++) + this.getTileAt(s, e) == l.DOOR && t.push({ x: s, y: e }); + return t; + }), + (c.prototype.overlaps = function (t) { + return !( + this.right < t.left || + this.left > t.right || + this.bottom < t.top || + this.top > t.bottom + ); + }), + (c.prototype.isInBounds = function (t, e) { + return ( + 0 <= t && + t < this.width - 1 && + 0 <= e && + e < this.height - 1 + ); + }), + (c.prototype.getTileAt = function (t, e) { + return this.tiles[e][t]; + }), + (c.prototype.setTileAt = function (t, e, s) { + this.tiles[e][t] = s; + }), + (c.prototype.isConnectedTo = function (t) { + for ( + var e = 0, s = this.getDoorLocations(); + e < s.length; + e++ + ) { + var i = s[e], + n = this.x + i.x - t.x, + o = this.y + i.y - t.y; + if (t.isInBounds(n, o) && t.getTileAt(n, o) === l.DOOR) + return !0; + } + return !1; + }), + c), + B = function (t) { + return Object.entries(t) + .map(function (t) { + return t[0] + '="' + t[1] + '"'; + }) + .join(" "); + }; + function F(t) { + return Number.isInteger(t) && t % 2 == 0; + } + function U(t) { + return Number.isInteger(t) && t % 2 != 0; + } + function b(t) { + var e, s, i, n, o, a, l; + (this.rooms = []), + (this.roomGrid = []), + (this.width = t.width), + (this.height = t.height), + (this.doorPadding = + null !== (e = t.doorPadding) && void 0 !== e ? e : 1), + (this.rooms = []), + (this.randomSeed = t.randomSeed), + (this.r = new r(this.randomSeed)); + var h = t.rooms, + d = h.width, + c = h.height, + Q = d.max * c.max, + B = d.min * c.min, + F = Math.floor((this.width * this.height) / B); + if ( + ((this.roomWidthConfig = { + min: d.min, + max: d.max, + onlyOdd: null !== (s = d.onlyOdd) && void 0 !== s && s, + onlyEven: null !== (i = d.onlyEven) && void 0 !== i && i, + }), + (this.roomHeightConfig = { + min: c.min, + max: c.max, + onlyOdd: null !== (n = c.onlyOdd) && void 0 !== n && n, + onlyEven: null !== (o = c.onlyEven) && void 0 !== o && o, + }), + (this.maxRooms = + null !== (a = h.maxRooms) && void 0 !== a ? a : F), + (this.maxRoomArea = + null !== (l = h.maxArea) && void 0 !== l ? l : Q), + this.adjustDimensionConfigForParity(this.roomWidthConfig), + this.adjustDimensionConfigForParity(this.roomHeightConfig), + this.checkDimensionConfig(this.roomWidthConfig), + this.checkDimensionConfig(this.roomHeightConfig), + this.roomWidthConfig.max > this.width) + ) + throw new Error("Room max width cannot exceed dungeon width."); + if (this.roomHeightConfig.max > this.height) + throw new Error( + "Room max height cannot exceed dungeon height." + ); + if (this.maxRoomArea < B) + throw new Error( + "The minimum dimensions specified exceeds the given maxArea." + ); + this.generate(), (this.tiles = this.getTiles()); + } + var g = + ((b.prototype.adjustDimensionConfigForParity = function (t) { + t.onlyOdd + ? (F(t.min) && + (t.min++, + console.log( + "Dungeon: warning, min dimension adjusted to match onlyOdd setting." + )), + F(t.max) && + (t.max--, + console.log( + "Dungeon: warning, max dimension adjusted to match onlyOdd setting." + ))) + : t.onlyEven && + (U(t.min) && + (t.min++, + console.log( + "Dungeon: warning, min dimension adjusted to match onlyEven setting." + )), + U(t.max) && + (t.max--, + console.log( + "Dungeon: warning, max dimension adjusted to match onlyEven setting." + ))); + }), + (b.prototype.checkDimensionConfig = function (t) { + var e = t.max, + s = t.min, + i = t.onlyEven, + n = t.onlyOdd; + if (i && n) + throw new Error( + "Cannot use both onlyEven and onlyOdd in room's width/height config." + ); + if (e < s) + throw new Error("Room width and height max must be >= min."); + if (s < 3) + throw new Error("Room width and height must be >= 3."); + }), + (b.prototype.getConfig = function () { + return { + width: this.width, + height: this.height, + doorPadding: this.doorPadding, + randomSeed: this.randomSeed, + rooms: { + width: this.roomWidthConfig, + height: this.roomHeightConfig, + maxArea: this.maxRoomArea, + maxRooms: this.maxRooms, + }, + }; + }), + (b.prototype.drawToConsole = function (t) { + !(function (t, e) { + void 0 === e && (e = {}); + var s = Object.assign( + {}, + { + empty: " ", + emptyColor: "rgb(0, 0, 0)", + wall: "#", + wallColor: "rgb(255, 0, 0)", + floor: "_", + floorColor: "rgb(210, 210, 210)", + door: ".", + doorColor: "rgb(0, 0, 255)", + fontSize: "15px", + }, + e + ), + i = "", + n = []; + (i += + "Dungeon: the console window should be big enough to see all of the guide on the next line:\n"), + (i += "%c|" + "=".repeat(2 * t.width - 2) + "|\n\n"), + n.push("font-size: " + s.fontSize); + for (var o = 0; o < t.height; o += 1) { + for (var a = 0; a < t.width; a += 1) { + var r = t.tiles[o][a]; + r === l.EMPTY + ? ((i += "%c" + s.empty), + n.push( + "color: " + + s.emptyColor + + "; font-size: " + + s.fontSize + )) + : r === l.WALL + ? ((i += "%c" + s.wall), + n.push( + "color: " + + s.wallColor + + "; font-size: " + + s.fontSize + )) + : r === l.FLOOR + ? ((i += "%c" + s.floor), + n.push( + "color: " + + s.floorColor + + "; font-size: " + + s.fontSize + )) + : r === l.DOOR && + ((i += "%c" + s.door), + n.push( + "color: " + + s.doorColor + + "; font-size: " + + s.fontSize + )), + (i += " "); + } + i += "\n"; + } + console.log.apply( + console, + (function () { + for (var t = 0, e = 0, s = arguments.length; e < s; e++) + t += arguments[e].length; + var i = Array(t), + n = 0; + for (e = 0; e < s; e++) + for ( + var o = arguments[e], a = 0, r = o.length; + a < r; + a++, n++ + ) + i[n] = o[a]; + return i; + })([i], n) + ); + })(this, t); + }), + (b.prototype.drawToHtml = function (t) { + return (function (t, e) { + void 0 === e && (e = {}); + var s = (function (t, e) { + void 0 === e && (e = {}); + var s = Object.assign( + {}, + { + empty: " ", + emptyAttributes: { class: "dungeon__empty" }, + wall: "#", + wallAttributes: { class: "dungeon__wall" }, + floor: "_", + floorAttributes: { class: "dungeon__wall" }, + door: ".", + doorAttributes: { class: "dungeon__door" }, + containerAttributes: { class: "dungeon" }, + }, + e + ), + i = t + .getMappedTiles({ + empty: + "" + + s.empty + + "", + floor: + "" + + s.floor + + "", + door: + "" + + s.door + + "", + wall: + "" + + s.wall + + "", + }) + .map(function (t) { + return "" + t.join("") + ""; + }) + .join(""); + return ( + "
" +
+                      i +
+                      "
" + ); + })(t, e); + return document.createRange().createContextualFragment(s); + })(this, t); + }), + (b.prototype.getMappedTiles = function (t) { + return ( + void 0 === t && (t = {}), + (t = Object.assign( + {}, + { empty: 0, wall: 1, floor: 2, door: 3 }, + t + )), + this.tiles.map(function (e) { + return e.map(function (e) { + return e === l.EMPTY + ? t.empty + : e === l.WALL + ? t.wall + : e === l.FLOOR + ? t.floor + : e === l.DOOR + ? t.door + : void 0; + }); + }) + ); + }), + (b.prototype.getCenter = function () { + return { + x: Math.floor(this.width / 2), + y: Math.floor(this.height / 2), + }; + }), + (b.prototype.generate = function () { + (this.rooms = []), (this.roomGrid = []); + for (var t = 0; t < this.height; t++) { + this.roomGrid.push([]); + for (var e = 0; e < this.width; e++) + this.roomGrid[t].push([]); + } + var s = this.getCenter(), + i = this.createRandomRoom(); + i.setPosition( + s.x - Math.floor(i.width / 2), + s.y - Math.floor(i.height / 2) + ), + this.addRoom(i); + for ( + var n = 0, o = 5 * this.maxRooms; + this.rooms.length < this.maxRooms && n < o; + + ) + this.generateRoom(), n++; + }), + (b.prototype.hasRoomAt = function (t, e) { + return ( + t < 0 || + e < 0 || + t >= this.width || + e >= this.height || + 0 < this.roomGrid[e][t].length + ); + }), + (b.prototype.getRoomAt = function (t, e) { + return this.hasRoomAt(t, e) ? this.roomGrid[e][t][0] : null; + }), + (b.prototype.addRoom = function (t) { + if (!this.canFitRoom(t)) return !1; + this.rooms.push(t); + for (var e = t.top; e <= t.bottom; e++) + for (var s = t.left; s <= t.right; s++) + this.roomGrid[e][s].push(t); + return !0; + }), + (b.prototype.canFitRoom = function (t) { + if (t.x < 0 || t.right > this.width - 1) return !1; + if (t.y < 0 || t.bottom > this.height - 1) return !1; + for (var e = 0; e < this.rooms.length; e++) + if (t.overlaps(this.rooms[e])) return !1; + return !0; + }), + (b.prototype.createRandomRoom = function () { + for ( + var t = 0, + e = 0, + s = this.roomWidthConfig, + i = this.roomHeightConfig; + (t = this.r.randomInteger(s.min, s.max, { + onlyEven: s.onlyEven, + onlyOdd: s.onlyOdd, + })) * + (e = this.r.randomInteger(i.min, i.max, { + onlyEven: i.onlyEven, + onlyOdd: i.onlyOdd, + })) > + this.maxRoomArea; + + ); + return new Q(t, e); + }), + (b.prototype.generateRoom = function () { + for (var t = this.createRandomRoom(), e = 150; 0 < e; ) { + var s = this.findRoomAttachment(t); + if ((t.setPosition(s.x, s.y), this.addRoom(t))) { + var i = this.findNewDoorLocation(t, s.target), + n = i[0], + o = i[1]; + this.addDoor(n), this.addDoor(o); + break; + } + --e; + } + }), + (b.prototype.getTiles = function () { + var t = d(this.width, this.height, l.EMPTY); + return ( + this.rooms.forEach(function (e) { + e.forEachTile(function (s, i) { + t[e.y + s.y][e.x + s.x] = i; + }); + }), + t + ); + }), + (b.prototype.getPotentiallyTouchingRooms = function (t) { + for ( + var e = this, + s = [], + i = function (i, n) { + for (var o = e.roomGrid[n][i], a = 0; a < o.length; a++) + if (o[a] != t && -1 === s.indexOf(o[a])) { + var r = i - o[a].x, + l = n - o[a].y; + ((0 < r && r < o[a].width - 1) || + (0 < l && l < o[a].height - 1)) && + s.push(o[a]); + } + }, + n = t.x + 1; + n < t.x + t.width - 1; + n++ + ) + i(n, t.y), i(n, t.y + t.height - 1); + for (var o = t.y + 1; o < t.y + t.height - 1; o++) + i(t.x, o), i(t.x + t.width - 1, o); + return s; + }), + (b.prototype.findNewDoorLocation = function (t, e) { + var s = { x: -1, y: -1 }, + i = { x: -1, y: -1 }; + return ( + t.y === e.y - t.height + ? ((s.x = i.x = + this.r.randomInteger( + Math.floor( + Math.max(e.left, t.left) + this.doorPadding + ), + Math.floor( + Math.min(e.right, t.right) - this.doorPadding + ) + )), + (s.y = t.y + t.height - 1), + (i.y = e.y)) + : t.x == e.x - t.width + ? ((s.x = t.x + t.width - 1), + (i.x = e.x), + (s.y = i.y = + this.r.randomInteger( + Math.floor( + Math.max(e.top, t.top) + this.doorPadding + ), + Math.floor( + Math.min(e.bottom, t.bottom) - this.doorPadding + ) + ))) + : t.x == e.x + e.width + ? ((s.x = t.x), + (i.x = e.x + e.width - 1), + (s.y = i.y = + this.r.randomInteger( + Math.floor( + Math.max(e.top, t.top) + this.doorPadding + ), + Math.floor( + Math.min(e.bottom, t.bottom) - this.doorPadding + ) + ))) + : t.y == e.y + e.height && + ((s.x = i.x = + this.r.randomInteger( + Math.floor( + Math.max(e.left, t.left) + this.doorPadding + ), + Math.floor( + Math.min(e.right, t.right) - this.doorPadding + ) + )), + (s.y = t.y), + (i.y = e.y + e.height - 1)), + [s, i] + ); + }), + (b.prototype.findRoomAttachment = function (t) { + var e = this.r.randomPick(this.rooms), + s = 0, + i = 0, + n = 2 * this.doorPadding; + switch (this.r.randomInteger(0, 3)) { + case 0: + (s = this.r.randomInteger( + e.left - (t.width - 1) + n, + e.right - n + )), + (i = e.top - t.height); + break; + case 1: + (s = e.left - t.width), + (i = this.r.randomInteger( + e.top - (t.height - 1) + n, + e.bottom - n + )); + break; + case 2: + (s = e.right + 1), + (i = this.r.randomInteger( + e.top - (t.height - 1) + n, + e.bottom - n + )); + break; + case 3: + (s = this.r.randomInteger( + e.left - (t.width - 1) + n, + e.right - n + )), + (i = e.bottom + 1); + } + return { x: s, y: i, target: e }; + }), + (b.prototype.addDoor = function (t) { + this.roomGrid[t.y][t.x].forEach(function (e) { + e.setTileAt(t.x - e.x, t.y - e.y, l.DOOR); + }); + }), + b); + s.d(e, "Room", function () { + return Q; + }), + s.d(e, "TILES", function () { + return l; + }), + (e.default = g); + }, + ]), + (t.c = s), + (t.d = function (e, s, i) { + t.o(e, s) || Object.defineProperty(e, s, { enumerable: !0, get: i }); + }), + (t.r = function (t) { + "undefined" != typeof Symbol && + Symbol.toStringTag && + Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), + Object.defineProperty(t, "__esModule", { value: !0 }); + }), + (t.t = function (e, s) { + if ((1 & s && (e = t(e)), 8 & s)) return e; + if (4 & s && "object" == typeof e && e && e.__esModule) return e; + var i = Object.create(null); + if ( + (t.r(i), + Object.defineProperty(i, "default", { enumerable: !0, value: e }), + 2 & s && "string" != typeof e) + ) + for (var n in e) + t.d( + i, + n, + function (t) { + return e[t]; + }.bind(null, n) + ); + return i; + }), + (t.n = function (e) { + var s = + e && e.__esModule + ? function () { + return e.default; + } + : function () { + return e; + }; + return t.d(s, "a", s), s; + }), + (t.o = function (t, e) { + return Object.prototype.hasOwnProperty.call(t, e); + }), + (t.p = ""), + t((t.s = 12)).default + ); + function t(i) { + if (s[i]) return s[i].exports; + var n = (s[i] = { i: i, l: !1, exports: {} }); + return e[i].call(n.exports, n, n.exports, t), (n.l = !0), n.exports; + } + var e, s; + })()); +var dungeon_minExports = dungeon_min.exports; +const Dungeon = getDefaultExportFromCjs(dungeon_minExports); +class Coin extends Phaser.Physics.Matter.Sprite { + constructor(t, e, s, i = "coin", n = { isStatic: !0 }) { + super(t.matter.world, e, s, i, 0, n), + (this.scene = t), + (this.label = "coin"), + t.add.existing(this), + this.init(); + } + init() { + this.scene.anims.create({ + key: this.label, + frames: this.scene.anims.generateFrameNumbers(this.label, { + start: 0, + end: 3, + }), + frameRate: 10, + repeat: -1, + }), + this.anims.play(this.label, !0), + (this.tween = this.scene.tweens.add({ + targets: this, + duration: 300, + y: "-=5", + repeat: -1, + yoyo: !0, + })); + } + destroy() { + this.tween.stop(), super.destroy(); + } +} +class key extends Phaser.Physics.Matter.Sprite { + constructor(t, e, s, i = "keys", n = { isStatic: !0 }) { + super(t.matter.world, e, s, i, Phaser.Math.RND.pick([0, 1]), n), + (this.scene = t), + (this.label = "keys"), + t.add.existing(this), + this.init(); + } + init() { + this.tween = this.scene.tweens.add({ + targets: this, + duration: 300, + y: "-=5", + repeat: -1, + yoyo: !0, + }); + } + destroy() { + this.tween.stop(), super.destroy(); + } +} +class SeeSaw { + constructor(t, e, s, i = 5) { + const n = t.add.tileSprite(e, s, (32 * i) / 2, 18, "seesaw"); + t.matter.add.gameObject(n, { + restitution: 0, + frictionAir: 0.2, + friction: 0.2, + density: 5e-4, + }); + const { Constraint: o } = Phaser.Physics.Matter.Matter, + a = o.create({ pointA: { x: n.x, y: n.y }, bodyB: n.body, length: 0 }); + t.matter.world.add(a); + } +} +class DungeonGenerator { + constructor(t) { + (this.scene = t), this.generate(); + } + generate() { + this.generateDungeon(), + this.generateMap(), + this.dungeon.rooms.forEach((t) => { + const { x: e, y: s, width: i, height: n } = t; + this.groundLayer.weightedRandomize( + [ + { index: 17, weight: 9 }, + { index: [7, 8, 9, 17, 18, 19], weight: 1 }, + ], + e + 1, + s + 1, + i - 2, + n - 2 + ), + this.placeCorners(t), + this.placeWalls(t); + const o = t.getDoorLocations(); + this.addDoors(t, o, e, s), + this.addKey(t), + this.addFoes(t), + this.addCoins(t), + this.addSeeSaw(t); + }); + } + generateDungeon() { + this.dungeon = new Dungeon({ + width: 50, + height: 50, + doorPadding: 2, + rooms: { + width: { min: 7, max: 15 }, + height: { min: 7, max: 15 }, + maxRooms: 12, + }, + }); + } + generateMap() { + this.map = this.scene.make.tilemap({ + tileWidth: 48, + tileHeight: 48, + width: this.dungeon.width, + height: this.dungeon.height, + }); + const t = this.map.addTilesetImage("tiles", null, 48, 48, 0, 0); + (this.groundLayer = this.map.createBlankLayer("Layer 1", t)), + (this.stuffLayer = this.map.createBlankLayer("Stuff", t)); + const e = this.dungeon.getMappedTiles({ + empty: -1, + floor: -1, + door: 3, + wall: 0, + }); + this.groundLayer.putTilesAt(e, 0, 0), + this.groundLayer.setCollision(0), + this.groundLayer.setCollisionByProperty({ collides: !0 }), + this.scene.matter.world.convertTilemapLayer(this.groundLayer); + } + placeCorners(t) { + const { left: e, right: s, top: i, bottom: n } = t; + this.groundLayer.putTileAt(0, e, i), + this.groundLayer.putTileAt(5, s, i), + this.groundLayer.putTileAt(45, s, n), + this.groundLayer.putTileAt(40, e, n); + } + placeWalls(t) { + const { width: e, height: s, left: i, right: n, top: o, bottom: a } = t; + this.groundLayer.weightedRandomize( + [ + { index: 2, weight: 4 }, + { index: [1, 2, 3, 4], weight: 1 }, + ], + i + 1, + o, + e - 2, + 1 + ), + this.groundLayer.weightedRandomize( + [ + { index: 42, weight: 4 }, + { index: [41, 42, 43, 44], weight: 1 }, + ], + i + 1, + a, + e - 2, + 1 + ), + this.groundLayer.weightedRandomize( + [ + { index: 10, weight: 4 }, + { index: [10, 20, 30], weight: 1 }, + ], + i, + o + 1, + 1, + s - 2 + ), + this.groundLayer.weightedRandomize( + [ + { index: 15, weight: 4 }, + { index: [15, 25, 35], weight: 1 }, + ], + n, + o + 1, + 1, + s - 2 + ); + } + addDoors(t, e, s, i) { + for (let n = 0; n < e.length; n++) { + const o = this.groundLayer.tileToWorldXY(s + e[n].x, i + e[n].y); + new Coin(this.scene, o.x + 20, o.y + 20), + 0 === e[n].y || e[n].y === t.height - 1 + ? this.groundLayer.putTilesAt([[7], [7]], s + e[n].x, i + e[n].y) + : (0 === e[n].x || e[n].x === t.width - 1) && + this.groundLayer.putTilesAt([[7]], s + e[n].x, i + e[n].y); + } + } + addKey(t) { + const e = Phaser.Math.Between(t.left + 2, t.right - 2), + s = Phaser.Math.Between(t.top + 2, t.bottom - 2), + i = this.groundLayer.tileToWorldXY(e, s); + new key(this.scene, i.x + 22, i.y + 22); + } + addSeeSaw(t) { + if (Phaser.Math.Between(0, 10) < 7) return; + const e = this.groundLayer.tileToWorldXY(t.centerX, t.centerY); + new SeeSaw(this.scene, e.x + 22, e.y + 22, t.width); + } + addCoins(t) { + const e = Phaser.Math.RND.pick(["top", "bottom", "left", "right", "none"]), + s = parseInt(t.width / 3) - Phaser.Math.Between(1, 2), + i = parseInt(t.height / 3) - Phaser.Math.Between(1, 2); + switch (e) { + case "top": + this.addCoinsTop(t, s, i); + break; + case "bottom": + this.addCoinsdBottom(t, s, i); + break; + case "left": + this.addCoinsdLeft(t, s, i); + break; + case "right": + this.addCoinsdRight(t, s, i); + } + } + addCoinsTop(t, e, s) { + const i = t.top + Phaser.Math.Between(1, 2), + n = t.left + Phaser.Math.Between(1, 2); + Array(e) + .fill() + .forEach((t, e) => { + Array(s) + .fill() + .forEach((t, s) => { + const o = this.groundLayer.tileToWorldXY(n + e, i + s); + new Coin(this.scene, o.x + 20, o.y + 20); + }); + }); + } + addCoinsdBottom(t, e, s) { + const i = t.bottom - Phaser.Math.Between(1, 2), + n = t.left + Phaser.Math.Between(1, 2); + Array(e) + .fill() + .forEach((t, e) => { + Array(s) + .fill() + .forEach((t, s) => { + const o = this.groundLayer.tileToWorldXY(n + e, i - s); + new Coin(this.scene, o.x + 20, o.y + 20); + }); + }); + } + addCoinsdLeft(t, e, s) { + const i = t.top + Phaser.Math.Between(3, 4), + n = t.left + Phaser.Math.Between(1, 2); + Array(e) + .fill() + .forEach((t, e) => { + Array(s) + .fill() + .forEach((t, s) => { + const o = this.groundLayer.tileToWorldXY(n + e, i - s); + new Coin(this.scene, o.x + 20, o.y + 20); + }); + }); + } + addCoinsdRight(t, e, s) { + const i = t.top + Phaser.Math.Between(1, 2), + n = t.right - Phaser.Math.Between(3, 4); + Array(e) + .fill() + .forEach((t, e) => { + Array(s) + .fill() + .forEach((t, s) => { + const o = this.groundLayer.tileToWorldXY(n - e, i + s); + new Coin(this.scene, o.x + 20, o.y + 20); + }); + }); + } + addFoes(t) { + const e = Phaser.Math.Between(t.left + 2, t.right - 2), + s = Phaser.Math.Between(t.top + 2, t.bottom - 2), + i = this.groundLayer.tileToWorldXY(e, s); + Phaser.Math.Between(0, 5) > 4 + ? new Wizard(this.scene, i.x + 22, i.y + 22, this.groundLayer) + : new Bat(this.scene, i.x + 22, i.y + 22, this.groundLayer); + } + addTopTraps(t) { + const { + x: e, + y: s, + width: i, + height: n, + left: o, + right: a, + top: r, + bottom: l, + tiles: h, + } = t; + h[0].forEach((t, e) => { + 1 === t && e > 0 && e < a && this.groundLayer.putTileAt(5, e + o, r + 1); + }); + } +} +class Game extends Phaser.Scene { + constructor() { + super({ key: "game" }), + (this.player = null), + (this.score = 0), + (this.scoreText = null); + } + init(t) { + (this.name = t.name), (this.number = t.number); + } + preload() { + this.registry.set("seconds", 0), + this.registry.set("coins", 0), + this.registry.set("keys", 0); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.addMap(), + this.addPlayer(), + this.addCollisions(), + this.addCamera(), + this.addScores(), + this.loadAudios(); + } + addMap() { + (this.dungeon = new DungeonGenerator(this)), + this.input.keyboard.on("keydown-ENTER", () => this.finishScene(), this); + } + addScores() { + this.add + .sprite(62, 26, "coin", 0) + .setOrigin(0.5) + .setScrollFactor(0) + .setScale(0.8), + (this.scoreCoins = this.add + .bitmapText(100, 24, "default", "x0", 15) + .setOrigin(0.5) + .setScrollFactor(0)), + (this.scoreSeconds = this.add + .bitmapText(this.center_width, 24, "default", "0", 15) + .setOrigin(0.5) + .setScrollFactor(0)), + this.add + .sprite(this.width - 90, 24, "keys", 0) + .setOrigin(0.5) + .setScrollFactor(0) + .setScale(0.8), + (this.scoreKeys = this.add + .bitmapText(this.width - 48, 24, "default", "x0", 15) + .setOrigin(0.5) + .setScrollFactor(0)), + (this.timer = this.time.addEvent({ + delay: 1e3, + callback: () => { + this.updateSeconds(); + }, + callbackScope: this, + loop: !0, + })); + } + addPlayer() { + (this.trailLayer = this.add.layer()), + (this.player = new Player( + this, + this.dungeon.map.widthInPixels / 2, + this.dungeon.map.heightInPixels / 2, + 100 + )); + } + addCollisions() { + (this.unsubscribePlayerCollide = this.matterCollision.addOnCollideStart({ + objectA: this.player.sprite, + callback: this.onPlayerCollide, + context: this, + })), + this.matter.world.on("collisionstart", (t) => { + t.pairs.forEach((t) => { + t.bodyA, t.bodyB; + }); + }); + } + onPlayerCollide({ gameObjectA: t, gameObjectB: e }) { + e && + ("coin" === e.label && this.playerPicksCoin(e), + "keys" === e.label && this.playerPicksKey(e), + "bat" === e.label && this.playerHitsFoe(e), + "wizard" === e.label && this.playerHitsFoe(e), + "fireball" === e.label && this.playerHitsFoe(e), + e instanceof Phaser.Tilemaps.Tile && + e.properties.isLethal && + (this.unsubscribePlayerCollide(), this.restartScene())); + } + playerPicksCoin(t) { + this.showPoints(t.x, t.y, 1, this.scoreCoins), + t.destroy(), + this.updateCoins(), + this.playAudio("coin"); + } + playerPicksKey(t) { + this.updateKeys(), + this.showPoints( + t.x, + t.y, + this.registry.get("keys") + "/" + this.dungeon.dungeon.rooms.length, + this.scoreKeys + ), + t.destroy(); + } + playerHitsFoe(t) { + this.player.invincible || + (this.player.explosion(), t.destroy(), this.restartScene()); + } + showPoints(t, e, s, i, n = 16777215) { + let o = this.add + .bitmapText(t + 20, e - 80, "default", "+" + s, 10) + .setDropShadow(2, 3, n, 0.7) + .setOrigin(0.5); + this.tweens.add({ + targets: o, + duration: 1e3, + alpha: { from: 1, to: 0 }, + x: { + from: o.x + Phaser.Math.Between(-10, 10), + to: o.x + Phaser.Math.Between(-40, 40), + }, + y: { from: o.y - 10, to: o.y - 60 }, + onComplete: () => { + o.destroy(); + }, + }), + this.textUpdateEffect(i, n); + } + addCamera() { + this.cameras.main.setBounds( + 0, + 0, + this.dungeon.map.widthInPixels, + this.dungeon.map.heightInPixels + ), + this.cameras.main.startFollow(this.player.sprite, !1, 0.5, 0.5), + this.cameras.main.setBackgroundColor(2429722); + } + loadAudios() { + this.audios = { + jump: this.sound.add("jump"), + bubble: this.sound.add("bubble"), + trap: this.sound.add("trap"), + crash: this.sound.add("crash"), + fireball: this.sound.add("fireball"), + death: this.sound.add("death"), + coin: this.sound.add("start"), + }; + } + playAudio(t) { + this.audios[t].play(); + } + restartScene() { + (this.player.sprite.visible = !1), + this.cameras.main.shake(100), + this.cameras.main.fade(250, 0, 0, 0), + this.cameras.main.once("camerafadeoutcomplete", () => + this.scene.restart() + ); + } + finishScene() { + this.cameras.main.fade(250, 0, 0, 0), + this.cameras.main.once("camerafadeoutcomplete", () => { + this.scene.start("outro", { + next: "underwater", + name: "STAGE", + number: this.number + 1, + }); + }); + } + updateSeconds(t = 1) { + const e = +this.registry.get("seconds") + t; + this.registry.set("seconds", e), this.scoreSeconds.setText(e); + } + updateCoins(t = 1) { + const e = +this.registry.get("coins") + t; + this.registry.set("coins", e), this.scoreCoins.setText("x" + e); + } + updateKeys(t = 1) { + const e = +this.registry.get("keys") + t; + this.registry.set("keys", e), + this.scoreKeys.setText("x" + e), + e === this.dungeon.dungeon.rooms.length && this.finishScene(); + } + textUpdateEffect(t, e) { + t.setTint(e); + const s = t.y; + this.tweens.add({ + targets: t, + duration: 100, + alpha: { from: 1, to: 0.8 }, + scale: { from: 1.2, to: 1 }, + repeat: 5, + onComplete: () => { + t.setTint(16777215), (t.y = s); + }, + }); + } +} +var phaserMatterCollision = { exports: {} }; +(function (module, exports) { + var factory; + "undefined" != typeof self && self, + (factory = function (__WEBPACK_EXTERNAL_MODULE_phaser__) { + return (() => { + var __webpack_modules__ = { + "./index.ts": ( + __unused_webpack_module, + __webpack_exports__, + __webpack_require__ + ) => { + eval( + '__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "PhaserMatterCollisionPlugin": () => (/* reexport safe */ _phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__.default),\n/* harmony export */ "getRootBody": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody),\n/* harmony export */ "isCollidingObject": () => (/* reexport safe */ _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__.isCollidingObject),\n/* harmony export */ "isMatterBody": () => (/* reexport safe */ _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__.isMatterBody),\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./phaser-matter-collision-plugin */ "./phaser-matter-collision-plugin.ts");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./utils.ts");\n/* harmony import */ var _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./valid-collision-object */ "./valid-collision-object.ts");\n\r\n\r\n\r\n\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__.default);\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9pbmRleC50cz9hOTU5Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBQTJFO0FBQ3JDO0FBTUo7QUEyQmhDO0FBRUYsaUVBQWUsb0VBQTJCLEVBQUMiLCJmaWxlIjoiLi9pbmRleC50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBQaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4gZnJvbSBcIi4vcGhhc2VyLW1hdHRlci1jb2xsaXNpb24tcGx1Z2luXCI7XG5pbXBvcnQgeyBnZXRSb290Qm9keSB9IGZyb20gXCIuL3V0aWxzXCI7XG5pbXBvcnQge1xuICBpc0NvbGxpZGluZ09iamVjdCxcbiAgaXNNYXR0ZXJCb2R5LFxuICBPYmplY3RXaXRoQm9keSxcbiAgQ29sbGlkaW5nT2JqZWN0LFxufSBmcm9tIFwiLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0XCI7XG5pbXBvcnQge1xuICBFeHRlbmRlZE1hdHRlckNvbGxpc2lvbkRhdGEsXG4gIENvbGxpc2lvbkV2ZW50LFxuICBFdmVudERhdGEsXG4gIENvbGxpZGVDYWxsYmFjayxcbiAgQ29sbGlkZUFDb25maWcsXG4gIENvbGxpZGVBQkNvbmZpZyxcbiAgQ29sbGlkZUNvbnRleHQsXG4gIFVuc3Vic2NyaWJlLFxufSBmcm9tIFwiLi9jb2xsaXNpb24tdHlwZXNcIjtcblxuZXhwb3J0IHtcbiAgUGhhc2VyTWF0dGVyQ29sbGlzaW9uUGx1Z2luLFxuICBnZXRSb290Qm9keSxcbiAgaXNDb2xsaWRpbmdPYmplY3QsXG4gIGlzTWF0dGVyQm9keSxcbiAgT2JqZWN0V2l0aEJvZHksXG4gIENvbGxpZGluZ09iamVjdCxcbiAgRXh0ZW5kZWRNYXR0ZXJDb2xsaXNpb25EYXRhLFxuICBDb2xsaXNpb25FdmVudCxcbiAgRXZlbnREYXRhLFxuICBDb2xsaWRlQ2FsbGJhY2ssXG4gIENvbGxpZGVBQ29uZmlnLFxuICBDb2xsaWRlQUJDb25maWcsXG4gIENvbGxpZGVDb250ZXh0LFxuICBVbnN1YnNjcmliZSxcbn07XG5cbmV4cG9ydCBkZWZhdWx0IFBoYXNlck1hdHRlckNvbGxpc2lvblBsdWdpbjtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./index.ts\n' + ); + }, + "./logger.ts": ( + __unused_webpack_module, + __webpack_exports__, + __webpack_require__ + ) => { + eval( + '__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\r\n log: console.log,\r\n warn: console.warn,\r\n error: console.error,\r\n});\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9sb2dnZXIudHM/Zjk0OSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsaUVBQWU7SUFDYixHQUFHLEVBQUUsT0FBTyxDQUFDLEdBQUc7SUFDaEIsSUFBSSxFQUFFLE9BQU8sQ0FBQyxJQUFJO0lBQ2xCLEtBQUssRUFBRSxPQUFPLENBQUMsS0FBSztDQUNyQixFQUFDIiwiZmlsZSI6Ii4vbG9nZ2VyLnRzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQge1xuICBsb2c6IGNvbnNvbGUubG9nLFxuICB3YXJuOiBjb25zb2xlLndhcm4sXG4gIGVycm9yOiBjb25zb2xlLmVycm9yLFxufTtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./logger.ts\n' + ); + }, + "./phaser-matter-collision-plugin.ts": ( + __unused_webpack_module, + __webpack_exports__, + __webpack_require__ + ) => { + eval( + '__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ MatterCollisionPlugin)\n/* harmony export */ });\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! phaser */ "phaser");\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(phaser__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./utils.ts");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ "./logger.ts");\n/* harmony import */ var _valid_collision_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./valid-collision-object */ "./valid-collision-object.ts");\n\r\n\r\n\r\n\r\nvar Matter = phaser__WEBPACK_IMPORTED_MODULE_0__.Physics.Matter;\r\nconst { START, DESTROY, SHUTDOWN } = phaser__WEBPACK_IMPORTED_MODULE_0__.Scenes.Events;\r\nconst { COLLISION_START, COLLISION_ACTIVE, COLLISION_END } = Matter.Events;\r\n/**\r\n * @export\r\n */\r\nclass MatterCollisionPlugin extends phaser__WEBPACK_IMPORTED_MODULE_0__.Plugins.ScenePlugin {\r\n constructor(scene, pluginManager, pluginKey) {\r\n super(scene, pluginManager, pluginKey);\r\n this.scene = scene;\r\n this.pluginManager = pluginManager;\r\n this.events = new phaser__WEBPACK_IMPORTED_MODULE_0__.Events.EventEmitter();\r\n this.collisionStartListeners = new Map();\r\n this.collisionEndListeners = new Map();\r\n this.collisionActiveListeners = new Map();\r\n this.scene = scene;\r\n this.scene.events.once(START, this.start, this);\r\n this.scene.events.once(DESTROY, this.destroy, this);\r\n }\r\n addOnCollideStart(config) {\r\n // Note: the order of overloads is important! TS matches the first one it can, so this needs\r\n // the most specific/constrained signature first.\r\n this.addOnCollide(this.collisionStartListeners, config);\r\n return () => this.removeOnCollide(this.collisionStartListeners, config);\r\n }\r\n addOnCollideEnd(config) {\r\n this.addOnCollide(this.collisionEndListeners, config);\r\n return () => this.removeOnCollide(this.collisionEndListeners, config);\r\n }\r\n addOnCollideActive(config) {\r\n this.addOnCollide(this.collisionActiveListeners, config);\r\n return () => this.removeOnCollide(this.collisionActiveListeners, config);\r\n }\r\n removeOnCollideStart(config) {\r\n this.removeOnCollide(this.collisionStartListeners, config);\r\n }\r\n removeOnCollideEnd(config) {\r\n this.removeOnCollide(this.collisionEndListeners, config);\r\n }\r\n removeOnCollideActive(config) {\r\n this.removeOnCollide(this.collisionActiveListeners, config);\r\n }\r\n /** Remove any listeners that were added with addOnCollideStart. */\r\n removeAllCollideStartListeners() {\r\n this.collisionStartListeners.clear();\r\n }\r\n /** Remove any listeners that were added with addOnCollideActive. */\r\n removeAllCollideActiveListeners() {\r\n this.collisionActiveListeners.clear();\r\n }\r\n /** Remove any listeners that were added with addOnCollideEnd. */\r\n removeAllCollideEndListeners() {\r\n this.collisionEndListeners.clear();\r\n }\r\n /**\r\n * Remove any listeners that were added with addOnCollideStart, addOnCollideActive or\r\n * addOnCollideEnd.\r\n */\r\n removeAllCollideListeners() {\r\n this.removeAllCollideStartListeners();\r\n this.removeAllCollideActiveListeners();\r\n this.removeAllCollideEndListeners();\r\n }\r\n addOnCollide(map, config) {\r\n const { context, callback, objectA, objectB } = config;\r\n if (!callback || typeof callback !== "function") {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__.default.warn(`No valid callback specified. Received: ${callback}`);\r\n return;\r\n }\r\n const objectsA = Array.isArray(objectA) ? objectA : [objectA];\r\n const objectsB = Array.isArray(objectB) ? objectB : [objectB];\r\n objectsA.forEach((a) => {\r\n objectsB.forEach((b) => {\r\n this.addOnCollideObjectVsObject(map, a, b, callback, context);\r\n });\r\n });\r\n }\r\n removeOnCollide(map, config) {\r\n const { context, callback, objectA, objectB } = config;\r\n const objectsA = Array.isArray(objectA) ? objectA : [objectA];\r\n const objectsB = Array.isArray(objectB) ? objectB : [objectB];\r\n objectsA.forEach((a) => {\r\n const callbacks = map.get(a) || [];\r\n const remainingCallbacks = callbacks.filter((cb) => {\r\n // If anything doesn\'t match a provided config value (i.e. anything other than undefined),\r\n // we can bail and keep listener.\r\n if (context !== undefined && cb.context !== context)\r\n return true;\r\n if (callback !== undefined && cb.callback !== callback)\r\n return true;\r\n if (objectB !== undefined && !objectsB.includes(cb.target))\r\n return true;\r\n return false;\r\n });\r\n if (remainingCallbacks.length > 0)\r\n map.set(a, remainingCallbacks);\r\n else\r\n map.delete(a);\r\n });\r\n }\r\n addOnCollideObjectVsObject(map, objectA, objectB, callback, context) {\r\n // Can\'t do anything if the first object is not defined or invalid.\r\n if (!objectA || !(0,_valid_collision_object__WEBPACK_IMPORTED_MODULE_3__.isCollidingObject)(objectA)) {\r\n (0,_utils__WEBPACK_IMPORTED_MODULE_1__.warnInvalidObject)(objectA);\r\n return;\r\n }\r\n // The second object can be undefined or a valid body.\r\n if (objectB && !(0,_valid_collision_object__WEBPACK_IMPORTED_MODULE_3__.isCollidingObject)(objectB)) {\r\n (0,_utils__WEBPACK_IMPORTED_MODULE_1__.warnInvalidObject)(objectA);\r\n return;\r\n }\r\n const callbacks = map.get(objectA) || [];\r\n callbacks.push({ target: objectB, callback, context });\r\n map.set(objectA, callbacks);\r\n }\r\n onCollisionStart(event) {\r\n this.onCollisionEvent(this.collisionStartListeners, COLLISION_START, event);\r\n }\r\n onCollisionEnd(event) {\r\n this.onCollisionEvent(this.collisionEndListeners, COLLISION_END, event);\r\n }\r\n onCollisionActive(event) {\r\n this.onCollisionEvent(this.collisionActiveListeners, COLLISION_ACTIVE, event);\r\n }\r\n /**\r\n * Reusable handler for collisionstart, collisionend, collisionactive.\r\n * */\r\n onCollisionEvent(listenerMap, eventName, event) {\r\n const pairs = event.pairs;\r\n const pairEventName = "pair" + eventName;\r\n const eventData = { isReversed: false };\r\n const eventDataReversed = { isReversed: true };\r\n pairs.map((pair, i) => {\r\n var _a, _b;\r\n const { bodyA, bodyB } = pair;\r\n const rootBodyA = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody)(bodyA);\r\n const rootBodyB = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody)(bodyB);\r\n let gameObjectA = (_a = rootBodyA.gameObject) !== null && _a !== void 0 ? _a : undefined;\r\n let gameObjectB = (_b = rootBodyB.gameObject) !== null && _b !== void 0 ? _b : undefined;\r\n // Special case for tiles, where it\'s more useful to have a reference to the Tile object not\r\n // the TileBody. This is hot code, so use a property check instead of instanceof.\r\n if (gameObjectA && gameObjectA instanceof Matter.TileBody) {\r\n gameObjectA = gameObjectA.tile;\r\n }\r\n if (gameObjectB && gameObjectB instanceof Matter.TileBody) {\r\n gameObjectB = gameObjectB.tile;\r\n }\r\n pairs[i].gameObjectA = gameObjectA !== null && gameObjectA !== void 0 ? gameObjectA : undefined;\r\n pairs[i].gameObjectB = gameObjectB !== null && gameObjectB !== void 0 ? gameObjectB : undefined;\r\n eventData.bodyA = bodyA;\r\n eventData.bodyB = bodyB;\r\n eventData.gameObjectA = gameObjectA !== null && gameObjectA !== void 0 ? gameObjectA : undefined;\r\n eventData.gameObjectB = gameObjectB !== null && gameObjectB !== void 0 ? gameObjectB : undefined;\r\n eventData.pair = pair;\r\n this.events.emit(pairEventName, eventData);\r\n if (listenerMap.size > 0) {\r\n eventDataReversed.bodyB = bodyA;\r\n eventDataReversed.bodyA = bodyB;\r\n eventDataReversed.gameObjectB = gameObjectA;\r\n eventDataReversed.gameObjectA = gameObjectB;\r\n eventDataReversed.pair = pair;\r\n const data = eventData;\r\n const dataReversed = eventDataReversed;\r\n this.checkPairAndEmit(listenerMap, bodyA, bodyB, gameObjectB, data);\r\n this.checkPairAndEmit(listenerMap, bodyB, bodyA, gameObjectA, dataReversed);\r\n if (gameObjectA) {\r\n this.checkPairAndEmit(listenerMap, gameObjectA, bodyB, gameObjectB, data);\r\n }\r\n if (gameObjectB) {\r\n this.checkPairAndEmit(listenerMap, gameObjectB, bodyA, gameObjectA, dataReversed);\r\n }\r\n }\r\n });\r\n this.events.emit(eventName, event);\r\n }\r\n checkPairAndEmit(map, objectA, bodyB, gameObjectB, eventData) {\r\n const callbacks = map.get(objectA);\r\n if (callbacks) {\r\n callbacks.forEach(({ target, callback, context }) => {\r\n if (!target || target === bodyB || target === gameObjectB) {\r\n callback.call(context, eventData);\r\n }\r\n });\r\n }\r\n }\r\n subscribeMatterEvents() {\r\n const matter = this.scene.matter;\r\n if (!matter || !matter.world) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__.default.warn("Plugin requires matter!");\r\n return;\r\n }\r\n matter.world.on(COLLISION_START, this.onCollisionStart, this);\r\n matter.world.on(COLLISION_ACTIVE, this.onCollisionActive, this);\r\n matter.world.on(COLLISION_END, this.onCollisionEnd, this);\r\n }\r\n unsubscribeMatterEvents() {\r\n // Don\'t unsub if matter next existing or if the game is destroyed (since the matter world will\r\n // be already gone)\r\n const matter = this.scene.matter;\r\n if (!matter || !matter.world)\r\n return;\r\n matter.world.off(COLLISION_START, this.onCollisionStart, this);\r\n matter.world.off(COLLISION_ACTIVE, this.onCollisionActive, this);\r\n matter.world.off(COLLISION_END, this.onCollisionEnd, this);\r\n }\r\n start() {\r\n // If restarting, unsubscribe before resubscribing to ensure only one listener is added\r\n this.scene.events.off(SHUTDOWN, this.shutdown, this);\r\n this.scene.events.on(SHUTDOWN, this.shutdown, this);\r\n this.subscribeMatterEvents();\r\n }\r\n shutdown() {\r\n this.removeAllCollideListeners();\r\n this.unsubscribeMatterEvents();\r\n // Resubscribe to start so that the plugin is started again after Matter\r\n this.scene.events.once(START, this.start, this);\r\n }\r\n destroy() {\r\n this.scene.events.off(DESTROY, this.destroy, this);\r\n this.scene.events.off(START, this.start, this);\r\n this.scene.events.off(SHUTDOWN, this.shutdown, this);\r\n this.removeAllCollideListeners();\r\n this.unsubscribeMatterEvents();\r\n }\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9waGFzZXItbWF0dGVyLWNvbGxpc2lvbi1wbHVnaW4udHM/OGI5OCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBMkU7QUFDbEI7QUFDM0I7QUFDc0Q7QUFnQnBGLElBQU8sTUFBTSxHQUFHLGtEQUFjLENBQUM7QUFFL0IsTUFBTSxFQUFFLEtBQUssRUFBRSxPQUFPLEVBQUUsUUFBUSxFQUFFLEdBQUcsaURBQWEsQ0FBQztBQUNuRCxNQUFNLEVBQUUsZUFBZSxFQUFFLGdCQUFnQixFQUFFLGFBQWEsRUFBRSxHQUFHLE1BQU0sQ0FBQyxNQUFNLENBQUM7QUFPM0U7O0dBRUc7QUFDWSxNQUFNLHFCQUFzQixTQUFRLHVEQUFtQjtJQU9wRSxZQUNZLEtBQVksRUFDWixhQUFvQyxFQUM5QyxTQUFpQjtRQUVqQixLQUFLLENBQUMsS0FBSyxFQUFFLGFBQWEsRUFBRSxTQUFTLENBQUMsQ0FBQztRQUo3QixVQUFLLEdBQUwsS0FBSyxDQUFPO1FBQ1osa0JBQWEsR0FBYixhQUFhLENBQXVCO1FBUnpDLFdBQU0sR0FBRyxJQUFJLHVEQUFtQixFQUFFLENBQUM7UUFFbEMsNEJBQXVCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFDakQsMEJBQXFCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFDL0MsNkJBQXdCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFReEQsSUFBSSxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7UUFDbkIsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ2hELElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQztJQUN0RCxDQUFDO0lBVU0saUJBQWlCLENBQUMsTUFBNkI7UUFDcEQsNEZBQTRGO1FBQzVGLGlEQUFpRDtRQUNqRCxJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyx1QkFBdUIsRUFBRSxNQUFNLENBQUMsQ0FBQztRQUN4RCxPQUFPLEdBQUcsRUFBRSxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQzFFLENBQUM7SUFLTSxlQUFlLENBQUMsTUFBNkI7UUFDbEQsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMscUJBQXFCLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDdEQsT0FBTyxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxxQkFBcUIsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUN4RSxDQUFDO0lBS00sa0JBQWtCLENBQUMsTUFBNkI7UUFDckQsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsd0JBQXdCLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDekQsT0FBTyxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUMzRSxDQUFDO0lBVU0sb0JBQW9CLENBQUMsTUFBbUM7UUFDN0QsSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsdUJBQXVCLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFDN0QsQ0FBQztJQUtNLGtCQUFrQixDQUFDLE1BQW1DO1FBQzNELElBQUksQ0FBQyxlQUFlLENBQUMsSUFBSSxDQUFDLHFCQUFxQixFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQzNELENBQUM7SUFLTSxxQkFBcUIsQ0FBQyxNQUFtQztRQUM5RCxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUM5RCxDQUFDO0lBRUQsbUVBQW1FO0lBQzVELDhCQUE4QjtRQUNuQyxJQUFJLENBQUMsdUJBQXVCLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDdkMsQ0FBQztJQUVELG9FQUFvRTtJQUM3RCwrQkFBK0I7UUFDcEMsSUFBSSxDQUFDLHdCQUF3QixDQUFDLEtBQUssRUFBRSxDQUFDO0lBQ3hDLENBQUM7SUFFRCxpRUFBaUU7SUFDMUQsNEJBQTRCO1FBQ2pDLElBQUksQ0FBQyxxQkFBcUIsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUNyQyxDQUFDO0lBRUQ7OztPQUdHO0lBQ0kseUJBQXlCO1FBQzlCLElBQUksQ0FBQyw4QkFBOEIsRUFBRSxDQUFDO1FBQ3RDLElBQUksQ0FBQywrQkFBK0IsRUFBRSxDQUFDO1FBQ3ZDLElBQUksQ0FBQyw0QkFBNEIsRUFBRSxDQUFDO0lBQ3RDLENBQUM7SUFFTyxZQUFZLENBQUMsR0FBZ0IsRUFBRSxNQUE2QjtRQUNsRSxNQUFNLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFLEdBQUcsTUFBTSxDQUFDO1FBQ3ZELElBQUksQ0FBQyxRQUFRLElBQUksT0FBTyxRQUFRLEtBQUssVUFBVSxFQUFFO1lBQy9DLGlEQUFXLENBQUMsMENBQTBDLFFBQVEsRUFBRSxDQUFDLENBQUM7WUFDbEUsT0FBTztTQUNSO1FBQ0QsTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQzlELE1BQU0sUUFBUSxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUM5RCxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUU7WUFDckIsUUFBUSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFO2dCQUNyQixJQUFJLENBQUMsMEJBQTBCLENBQUMsR0FBRyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1lBQ2hFLENBQUMsQ0FBQyxDQUFDO1FBQ0wsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDO0lBRU8sZUFBZSxDQUFDLEdBQWdCLEVBQUUsTUFBbUM7UUFDM0UsTUFBTSxFQUFFLE9BQU8sRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLE1BQU0sQ0FBQztRQUN2RCxNQUFNLFFBQVEsR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDOUQsTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQzlELFFBQVEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRTtZQUNyQixNQUFNLFNBQVMsR0FBRyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxJQUFJLEVBQUUsQ0FBQztZQUNuQyxNQUFNLGtCQUFrQixHQUFHLFNBQVMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxFQUFFLEVBQUUsRUFBRTtnQkFDakQsMEZBQTBGO2dCQUMxRixpQ0FBaUM7Z0JBQ2pDLElBQUksT0FBTyxLQUFLLFNBQVMsSUFBSSxFQUFFLENBQUMsT0FBTyxLQUFLLE9BQU87b0JBQUUsT0FBTyxJQUFJLENBQUM7Z0JBQ2pFLElBQUksUUFBUSxLQUFLLFNBQVMsSUFBSSxFQUFFLENBQUMsUUFBUSxLQUFLLFFBQVE7b0JBQUUsT0FBTyxJQUFJLENBQUM7Z0JBQ3BFLElBQUksT0FBTyxLQUFLLFNBQVMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsRUFBRSxDQUFDLE1BQU0sQ0FBQztvQkFBRSxPQUFPLElBQUksQ0FBQztnQkFDeEUsT0FBTyxLQUFLLENBQUM7WUFDZixDQUFDLENBQUMsQ0FBQztZQUNILElBQUksa0JBQWtCLENBQUMsTUFBTSxHQUFHLENBQUM7Z0JBQUUsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQUUsa0JBQWtCLENBQUMsQ0FBQzs7Z0JBQzdELEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDckIsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDO0lBRU8sMEJBQTBCLENBQ2hDLEdBQWdCLEVBQ2hCLE9BQVcsRUFDWCxPQUF1QixFQUN2QixRQUFpQyxFQUNqQyxPQUFtQztRQUVuQyxtRUFBbUU7UUFDbkUsSUFBSSxDQUFDLE9BQU8sSUFBSSxDQUFDLDBFQUFpQixDQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQzNDLHlEQUFpQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQzNCLE9BQU87U0FDUjtRQUVELHNEQUFzRDtRQUN0RCxJQUFJLE9BQU8sSUFBSSxDQUFDLDBFQUFpQixDQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQzFDLHlEQUFpQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQzNCLE9BQU87U0FDUjtRQUVELE1BQU0sU0FBUyxHQUFHLEdBQUcsQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLElBQUksRUFBRSxDQUFDO1FBQ3pDLFNBQVMsQ0FBQyxJQUFJLENBQUMsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxPQUFPLEVBQUUsQ0FBQyxDQUFDO1FBQ3ZELEdBQUcsQ0FBQyxHQUFHLENBQUMsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0lBQzlCLENBQUM7SUFFTyxnQkFBZ0IsQ0FBQyxLQUF3QztRQUMvRCxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLGVBQWUsRUFBRSxLQUFLLENBQUMsQ0FBQztJQUM5RSxDQUFDO0lBRU8sY0FBYyxDQUFDLEtBQXFDO1FBQzFELElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLENBQUMscUJBQXFCLEVBQUUsYUFBYSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQzFFLENBQUM7SUFFTyxpQkFBaUIsQ0FBQyxLQUF3QztRQUNoRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLHdCQUF3QixFQUFFLGdCQUFnQixFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQ2hGLENBQUM7SUFFRDs7U0FFSztJQUNHLGdCQUFnQixDQUN0QixXQUF3QixFQUN4QixTQUFpQixFQUNqQixLQUEyQjtRQUUzQixNQUFNLEtBQUssR0FBRyxLQUFLLENBQUMsS0FBc0MsQ0FBQztRQUMzRCxNQUFNLGFBQWEsR0FBRyxNQUFNLEdBQUcsU0FBUyxDQUFDO1FBQ3pDLE1BQU0sU0FBUyxHQUErQixFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQUUsQ0FBQztRQUNwRSxNQUFNLGlCQUFpQixHQUErQixFQUFFLFVBQVUsRUFBRSxJQUFJLEVBQUUsQ0FBQztRQUUzRSxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUMsSUFBSSxFQUFFLENBQUMsRUFBRSxFQUFFOztZQUNwQixNQUFNLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxHQUFHLElBQUksQ0FBQztZQUM5QixNQUFNLFNBQVMsR0FBRyxtREFBVyxDQUFDLEtBQUssQ0FBQyxDQUFDO1lBQ3JDLE1BQU0sU0FBUyxHQUFHLG1EQUFXLENBQUMsS0FBSyxDQUFDLENBQUM7WUFDckMsSUFBSSxXQUFXLEdBQW1CLGVBQVMsQ0FBQyxVQUFVLG1DQUFJLFNBQVMsQ0FBQztZQUNwRSxJQUFJLFdBQVcsR0FBbUIsZUFBUyxDQUFDLFVBQVUsbUNBQUksU0FBUyxDQUFDO1lBRXBFLDRGQUE0RjtZQUM1RixpRkFBaUY7WUFDakYsSUFBSSxXQUFXLElBQUksV0FBVyxZQUFZLE1BQU0sQ0FBQyxRQUFRLEVBQUU7Z0JBQ3pELFdBQVcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDO2FBQ2hDO1lBQ0QsSUFBSSxXQUFXLElBQUksV0FBVyxZQUFZLE1BQU0sQ0FBQyxRQUFRLEVBQUU7Z0JBQ3pELFdBQVcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDO2FBQ2hDO1lBRUQsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDaEQsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFFaEQsU0FBUyxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7WUFDeEIsU0FBUyxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7WUFDeEIsU0FBUyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDakQsU0FBUyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDakQsU0FBUyxDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7WUFFdEIsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsYUFBYSxFQUFFLFNBQVMsQ0FBQyxDQUFDO1lBRTNDLElBQUksV0FBVyxDQUFDLElBQUksR0FBRyxDQUFDLEVBQUU7Z0JBQ3hCLGlCQUFpQixDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7Z0JBQ2hDLGlCQUFpQixDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7Z0JBQ2hDLGlCQUFpQixDQUFDLFdBQVcsR0FBRyxXQUFXLENBQUM7Z0JBQzVDLGlCQUFpQixDQUFDLFdBQVcsR0FBRyxXQUFXLENBQUM7Z0JBQzVDLGlCQUFpQixDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7Z0JBRTlCLE1BQU0sSUFBSSxHQUFHLFNBQThCLENBQUM7Z0JBQzVDLE1BQU0sWUFBWSxHQUFHLGlCQUFzQyxDQUFDO2dCQUU1RCxJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLElBQUksQ0FBQyxDQUFDO2dCQUNwRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLFlBQVksQ0FBQyxDQUFDO2dCQUU1RSxJQUFJLFdBQVcsRUFBRTtvQkFDZixJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLElBQUksQ0FBQyxDQUFDO2lCQUMzRTtnQkFFRCxJQUFJLFdBQVcsRUFBRTtvQkFDZixJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLFlBQVksQ0FBQyxDQUFDO2lCQUNuRjthQUNGO1FBQ0gsQ0FBQyxDQUFDLENBQUM7UUFFSCxJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsS0FBSyxDQUFDLENBQUM7SUFDckMsQ0FBQztJQUVPLGdCQUFnQixDQUN0QixHQUFnQixFQUNoQixPQUFXLEVBQ1gsS0FBb0IsRUFDcEIsV0FBMkIsRUFDM0IsU0FBNEI7UUFFNUIsTUFBTSxTQUFTLEdBQUcsR0FBRyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUNuQyxJQUFJLFNBQVMsRUFBRTtZQUNiLFNBQVMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLEVBQUUsRUFBRTtnQkFDbEQsSUFBSSxDQUFDLE1BQU0sSUFBSSxNQUFNLEtBQUssS0FBSyxJQUFJLE1BQU0sS0FBSyxXQUFXLEVBQUU7b0JBQ3pELFFBQVEsQ0FBQyxJQUFJLENBQUMsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO2lCQUNuQztZQUNILENBQUMsQ0FBQyxDQUFDO1NBQ0o7SUFDSCxDQUFDO0lBRUQscUJBQXFCO1FBQ25CLE1BQU0sTUFBTSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDO1FBQ2pDLElBQUksQ0FBQyxNQUFNLElBQUksQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFO1lBQzVCLGlEQUFXLENBQUMseUJBQXlCLENBQUMsQ0FBQztZQUN2QyxPQUFPO1NBQ1I7UUFDRCxNQUFNLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxlQUFlLEVBQUUsSUFBSSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxDQUFDO1FBQzlELE1BQU0sQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNoRSxNQUFNLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxhQUFhLEVBQUUsSUFBSSxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUM1RCxDQUFDO0lBRUQsdUJBQXVCO1FBQ3JCLCtGQUErRjtRQUMvRixtQkFBbUI7UUFDbkIsTUFBTSxNQUFNLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUM7UUFDakMsSUFBSSxDQUFDLE1BQU0sSUFBSSxDQUFDLE1BQU0sQ0FBQyxLQUFLO1lBQUUsT0FBTztRQUNyQyxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxlQUFlLEVBQUUsSUFBSSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxDQUFDO1FBQy9ELE1BQU0sQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNqRSxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxhQUFhLEVBQUUsSUFBSSxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUM3RCxDQUFDO0lBRUQsS0FBSztRQUNILHVGQUF1RjtRQUN2RixJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsSUFBSSxDQUFDLENBQUM7UUFDckQsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ3BELElBQUksQ0FBQyxxQkFBcUIsRUFBRSxDQUFDO0lBQy9CLENBQUM7SUFFRCxRQUFRO1FBQ04sSUFBSSxDQUFDLHlCQUF5QixFQUFFLENBQUM7UUFDakMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLENBQUM7UUFDL0Isd0VBQXdFO1FBQ3hFLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNsRCxDQUFDO0lBRUQsT0FBTztRQUNMLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNuRCxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLENBQUM7UUFDL0MsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ3JELElBQUksQ0FBQyx5QkFBeUIsRUFBRSxDQUFDO1FBQ2pDLElBQUksQ0FBQyx1QkFBdUIsRUFBRSxDQUFDO0lBQ2pDLENBQUM7Q0FDRiIsImZpbGUiOiIuL3BoYXNlci1tYXR0ZXItY29sbGlzaW9uLXBsdWdpbi50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFBoeXNpY3MsIFBsdWdpbnMsIFNjZW5lLCBFdmVudHMsIFNjZW5lcywgVGlsZW1hcHMgfSBmcm9tIFwicGhhc2VyXCI7XG5pbXBvcnQgeyBnZXRSb290Qm9keSwgd2FybkludmFsaWRPYmplY3QgfSBmcm9tIFwiLi91dGlsc1wiO1xuaW1wb3J0IGxvZ2dlciBmcm9tIFwiLi9sb2dnZXJcIjtcbmltcG9ydCB7IENvbGxpZGluZ09iamVjdCBhcyBDTywgaXNDb2xsaWRpbmdPYmplY3QgfSBmcm9tIFwiLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0XCI7XG5pbXBvcnQge1xuICBMaXN0ZW5lck1hcCxcbiAgQ29sbGlkZUFCQ29uZmlnIGFzIEFCQ29uZmlnLFxuICBVbnN1YnNjcmliZSxcbiAgQ29sbGlkZUNhbGxiYWNrLFxuICBDb2xsaWRlQ29udGV4dCxcbiAgRXh0ZW5kZWRNYXR0ZXJDb2xsaXNpb25EYXRhLFxuICBFdmVudERhdGEsXG4gIENvbGxpZGVBQ29uZmlnIGFzIEFDb25maWcsXG4gIEludGVybmFsQ29sbGlkZUNvbmZpZyxcbiAgUmVtb3ZlQ29sbGlkZUNvbmZpZ0EgYXMgUmVtb3ZlQUNvbmZpZyxcbiAgUmVtb3ZlQ29sbGlkZUNvbmZpZ0FCIGFzIFJlbW92ZUFCQ29uZmlnLFxuICBJbnRlcm5hbENvbGxpZGVSZW1vdmVDb25maWcsXG59IGZyb20gXCIuL2NvbGxpc2lvbi10eXBlc1wiO1xuXG5pbXBvcnQgTWF0dGVyID0gUGh5c2ljcy5NYXR0ZXI7XG5pbXBvcnQgTWF0dGVyRXZlbnRzID0gTWF0dGVyLkV2ZW50cztcbmNvbnN0IHsgU1RBUlQsIERFU1RST1ksIFNIVVRET1dOIH0gPSBTY2VuZXMuRXZlbnRzO1xuY29uc3QgeyBDT0xMSVNJT05fU1RBUlQsIENPTExJU0lPTl9BQ1RJVkUsIENPTExJU0lPTl9FTkQgfSA9IE1hdHRlci5FdmVudHM7XG5cbnR5cGUgTWF0dGVyQ29sbGlzaW9uRXZlbnQgPVxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudFxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25FbmRFdmVudFxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudDtcblxuLyoqXG4gKiBAZXhwb3J0XG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIE1hdHRlckNvbGxpc2lvblBsdWdpbiBleHRlbmRzIFBsdWdpbnMuU2NlbmVQbHVnaW4ge1xuICBwdWJsaWMgZXZlbnRzID0gbmV3IEV2ZW50cy5FdmVudEVtaXR0ZXIoKTtcblxuICBwcml2YXRlIGNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzOiBMaXN0ZW5lck1hcCA9IG5ldyBNYXAoKTtcbiAgcHJpdmF0ZSBjb2xsaXNpb25FbmRMaXN0ZW5lcnM6IExpc3RlbmVyTWFwID0gbmV3IE1hcCgpO1xuICBwcml2YXRlIGNvbGxpc2lvbkFjdGl2ZUxpc3RlbmVyczogTGlzdGVuZXJNYXAgPSBuZXcgTWFwKCk7XG5cbiAgY29uc3RydWN0b3IoXG4gICAgcHJvdGVjdGVkIHNjZW5lOiBTY2VuZSxcbiAgICBwcm90ZWN0ZWQgcGx1Z2luTWFuYWdlcjogUGx1Z2lucy5QbHVnaW5NYW5hZ2VyLFxuICAgIHBsdWdpbktleTogc3RyaW5nXG4gICkge1xuICAgIHN1cGVyKHNjZW5lLCBwbHVnaW5NYW5hZ2VyLCBwbHVnaW5LZXkpO1xuICAgIHRoaXMuc2NlbmUgPSBzY2VuZTtcbiAgICB0aGlzLnNjZW5lLmV2ZW50cy5vbmNlKFNUQVJULCB0aGlzLnN0YXJ0LCB0aGlzKTtcbiAgICB0aGlzLnNjZW5lLmV2ZW50cy5vbmNlKERFU1RST1ksIHRoaXMuZGVzdHJveSwgdGhpcyk7XG4gIH1cblxuICAvKipcbiAgICogQWRkIGEgbGlzdGVuZXIgZm9yIGNvbGxpZGVzdGFydCBldmVudHMgYmV0d2VlbiBvYmplY3RBIGFuZCBvYmplY3RCLiBUaGUgY29sbGlkZXN0YXJ0IGV2ZW50IGlzXG4gICAqIGZpcmVkIGJ5IE1hdHRlciB3aGVuIHR3byBib2RpZXMgc3RhcnQgY29sbGlkaW5nIHdpdGhpbiBhIHRpY2sgb2YgdGhlIGVuZ2luZS4gSWYgb2JqZWN0QiBpc1xuICAgKiBvbWl0dGVkLCBhbnkgY29sbGlzaW9ucyB3aXRoIG9iamVjdEEgd2lsbCBiZSBwYXNzZWQgYWxvbmcgdG8gdGhlIGxpc3RlbmVyLiBTZWVcbiAgICoge0BsaW5rIHBhaXJjb2xsaXNpb25zdGFydH0gZm9yIGluZm9ybWF0aW9uIG9uIGNhbGxiYWNrIHBhcmFtZXRlcnMuXG4gICAqL1xuICBwdWJsaWMgYWRkT25Db2xsaWRlU3RhcnQ8VCBleHRlbmRzIENPLCBLIGV4dGVuZHMgQ08+KGNvbmZpZzogQUJDb25maWc8VCwgSz4pOiBVbnN1YnNjcmliZTtcbiAgcHVibGljIGFkZE9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVTdGFydChjb25maWc6IEludGVybmFsQ29sbGlkZUNvbmZpZyk6IFVuc3Vic2NyaWJlIHtcbiAgICAvLyBOb3RlOiB0aGUgb3JkZXIgb2Ygb3ZlcmxvYWRzIGlzIGltcG9ydGFudCEgVFMgbWF0Y2hlcyB0aGUgZmlyc3Qgb25lIGl0IGNhbiwgc28gdGhpcyBuZWVkc1xuICAgIC8vIHRoZSBtb3N0IHNwZWNpZmljL2NvbnN0cmFpbmVkIHNpZ25hdHVyZSBmaXJzdC5cbiAgICB0aGlzLmFkZE9uQ29sbGlkZSh0aGlzLmNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzLCBjb25maWcpO1xuICAgIHJldHVybiAoKSA9PiB0aGlzLnJlbW92ZU9uQ29sbGlkZSh0aGlzLmNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNhZGRPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIGFkZE9uQ29sbGlkZUVuZDxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQkNvbmZpZzxULCBLPik6IFVuc3Vic2NyaWJlO1xuICBwdWJsaWMgYWRkT25Db2xsaWRlRW5kPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVFbmQoY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiBVbnN1YnNjcmliZSB7XG4gICAgdGhpcy5hZGRPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25FbmRMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gICAgcmV0dXJuICgpID0+IHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNhZGRPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIGFkZE9uQ29sbGlkZUFjdGl2ZTxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQkNvbmZpZzxULCBLPik6IFVuc3Vic2NyaWJlO1xuICBwdWJsaWMgYWRkT25Db2xsaWRlQWN0aXZlPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVBY3RpdmUoY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiBVbnN1YnNjcmliZSB7XG4gICAgdGhpcy5hZGRPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gICAgcmV0dXJuICgpID0+IHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uQWN0aXZlTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqXG4gICAqIFJlbW92ZSBhbnkgbGlzdGVuZXJzIHRoYXQgd2VyZSBhZGRlZCB3aXRoIGFkZE9uQ29sbGlkZVN0YXJ0LiBJZiBvYmplY3RCLCBjYWxsYmFjayBvciBjb250ZXh0XG4gICAqIHBhcmFtZXRlcnMgYXJlIG9taXR0ZWQsIGFueSBsaXN0ZW5lciBtYXRjaGluZyB0aGUgcmVtYWluaW5nIHBhcmFtZXRlcnMgd2lsbCBiZSByZW1vdmVkLiBFLmcuIGlmXG4gICAqIHlvdSBvbmx5IHNwZWNpZnkgb2JqZWN0QSBhbmQgb2JqZWN0QiwgYWxsIGxpc3RlbmVycyB3aXRoIG9iamVjdEEgJiBvYmplY3RCIHdpbGwgYmUgcmVtb3ZlZFxuICAgKiByZWdhcmRsZXNzIG9mIHRoZSBjYWxsYmFjayBvciBjb250ZXh0LlxuICAgKi9cbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTywgSyBleHRlbmRzIENPPihjb25maWc6IFJlbW92ZUFCQ29uZmlnPFQsIEs+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQ29uZmlnPFQ+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0KGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgdGhpcy5yZW1vdmVPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycywgY29uZmlnKTtcbiAgfVxuXG4gIC8qKiBUaGlzIG1ldGhvZCBtaXJyb3JzIHtAbGluayBNYXR0ZXJDb2xsaXNpb25QbHVnaW4jcmVtb3ZlT25Db2xsaWRlU3RhcnR9ICovXG4gIHB1YmxpYyByZW1vdmVPbkNvbGxpZGVFbmQ8VCBleHRlbmRzIENPLCBLIGV4dGVuZHMgQ08+KGNvbmZpZzogUmVtb3ZlQUJDb25maWc8VCwgSz4pOiB2b2lkO1xuICBwdWJsaWMgcmVtb3ZlT25Db2xsaWRlRW5kPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQ29uZmlnPFQ+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZUVuZChjb25maWc6IEludGVybmFsQ29sbGlkZVJlbW92ZUNvbmZpZykge1xuICAgIHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNyZW1vdmVPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZUFjdGl2ZTxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQkNvbmZpZzxULCBLPik6IHZvaWQ7XG4gIHB1YmxpYyByZW1vdmVPbkNvbGxpZGVBY3RpdmU8VCBleHRlbmRzIENPPihjb25maWc6IFJlbW92ZUFDb25maWc8VD4pOiB2b2lkO1xuICBwdWJsaWMgcmVtb3ZlT25Db2xsaWRlQWN0aXZlKGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgdGhpcy5yZW1vdmVPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gIH1cblxuICAvKiogUmVtb3ZlIGFueSBsaXN0ZW5lcnMgdGhhdCB3ZXJlIGFkZGVkIHdpdGggYWRkT25Db2xsaWRlU3RhcnQuICovXG4gIHB1YmxpYyByZW1vdmVBbGxDb2xsaWRlU3RhcnRMaXN0ZW5lcnMoKSB7XG4gICAgdGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycy5jbGVhcigpO1xuICB9XG5cbiAgLyoqIFJlbW92ZSBhbnkgbGlzdGVuZXJzIHRoYXQgd2VyZSBhZGRlZCB3aXRoIGFkZE9uQ29sbGlkZUFjdGl2ZS4gKi9cbiAgcHVibGljIHJlbW92ZUFsbENvbGxpZGVBY3RpdmVMaXN0ZW5lcnMoKSB7XG4gICAgdGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMuY2xlYXIoKTtcbiAgfVxuXG4gIC8qKiBSZW1vdmUgYW55IGxpc3RlbmVycyB0aGF0IHdlcmUgYWRkZWQgd2l0aCBhZGRPbkNvbGxpZGVFbmQuICovXG4gIHB1YmxpYyByZW1vdmVBbGxDb2xsaWRlRW5kTGlzdGVuZXJzKCkge1xuICAgIHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLmNsZWFyKCk7XG4gIH1cblxuICAvKipcbiAgICogUmVtb3ZlIGFueSBsaXN0ZW5lcnMgdGhhdCB3ZXJlIGFkZGVkIHdpdGggYWRkT25Db2xsaWRlU3RhcnQsIGFkZE9uQ29sbGlkZUFjdGl2ZSBvclxuICAgKiBhZGRPbkNvbGxpZGVFbmQuXG4gICAqL1xuICBwdWJsaWMgcmVtb3ZlQWxsQ29sbGlkZUxpc3RlbmVycygpIHtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVTdGFydExpc3RlbmVycygpO1xuICAgIHRoaXMucmVtb3ZlQWxsQ29sbGlkZUFjdGl2ZUxpc3RlbmVycygpO1xuICAgIHRoaXMucmVtb3ZlQWxsQ29sbGlkZUVuZExpc3RlbmVycygpO1xuICB9XG5cbiAgcHJpdmF0ZSBhZGRPbkNvbGxpZGUobWFwOiBMaXN0ZW5lck1hcCwgY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiB2b2lkIHtcbiAgICBjb25zdCB7IGNvbnRleHQsIGNhbGxiYWNrLCBvYmplY3RBLCBvYmplY3RCIH0gPSBjb25maWc7XG4gICAgaWYgKCFjYWxsYmFjayB8fCB0eXBlb2YgY2FsbGJhY2sgIT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgbG9nZ2VyLndhcm4oYE5vIHZhbGlkIGNhbGxiYWNrIHNwZWNpZmllZC4gUmVjZWl2ZWQ6ICR7Y2FsbGJhY2t9YCk7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGNvbnN0IG9iamVjdHNBID0gQXJyYXkuaXNBcnJheShvYmplY3RBKSA/IG9iamVjdEEgOiBbb2JqZWN0QV07XG4gICAgY29uc3Qgb2JqZWN0c0IgPSBBcnJheS5pc0FycmF5KG9iamVjdEIpID8gb2JqZWN0QiA6IFtvYmplY3RCXTtcbiAgICBvYmplY3RzQS5mb3JFYWNoKChhKSA9PiB7XG4gICAgICBvYmplY3RzQi5mb3JFYWNoKChiKSA9PiB7XG4gICAgICAgIHRoaXMuYWRkT25Db2xsaWRlT2JqZWN0VnNPYmplY3QobWFwLCBhLCBiLCBjYWxsYmFjaywgY29udGV4dCk7XG4gICAgICB9KTtcbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgcmVtb3ZlT25Db2xsaWRlKG1hcDogTGlzdGVuZXJNYXAsIGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgY29uc3QgeyBjb250ZXh0LCBjYWxsYmFjaywgb2JqZWN0QSwgb2JqZWN0QiB9ID0gY29uZmlnO1xuICAgIGNvbnN0IG9iamVjdHNBID0gQXJyYXkuaXNBcnJheShvYmplY3RBKSA/IG9iamVjdEEgOiBbb2JqZWN0QV07XG4gICAgY29uc3Qgb2JqZWN0c0IgPSBBcnJheS5pc0FycmF5KG9iamVjdEIpID8gb2JqZWN0QiA6IFtvYmplY3RCXTtcbiAgICBvYmplY3RzQS5mb3JFYWNoKChhKSA9PiB7XG4gICAgICBjb25zdCBjYWxsYmFja3MgPSBtYXAuZ2V0KGEpIHx8IFtdO1xuICAgICAgY29uc3QgcmVtYWluaW5nQ2FsbGJhY2tzID0gY2FsbGJhY2tzLmZpbHRlcigoY2IpID0+IHtcbiAgICAgICAgLy8gSWYgYW55dGhpbmcgZG9lc24ndCBtYXRjaCBhIHByb3ZpZGVkIGNvbmZpZyB2YWx1ZSAoaS5lLiBhbnl0aGluZyBvdGhlciB0aGFuIHVuZGVmaW5lZCksXG4gICAgICAgIC8vIHdlIGNhbiBiYWlsIGFuZCBrZWVwIGxpc3RlbmVyLlxuICAgICAgICBpZiAoY29udGV4dCAhPT0gdW5kZWZpbmVkICYmIGNiLmNvbnRleHQgIT09IGNvbnRleHQpIHJldHVybiB0cnVlO1xuICAgICAgICBpZiAoY2FsbGJhY2sgIT09IHVuZGVmaW5lZCAmJiBjYi5jYWxsYmFjayAhPT0gY2FsbGJhY2spIHJldHVybiB0cnVlO1xuICAgICAgICBpZiAob2JqZWN0QiAhPT0gdW5kZWZpbmVkICYmICFvYmplY3RzQi5pbmNsdWRlcyhjYi50YXJnZXQpKSByZXR1cm4gdHJ1ZTtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfSk7XG4gICAgICBpZiAocmVtYWluaW5nQ2FsbGJhY2tzLmxlbmd0aCA+IDApIG1hcC5zZXQoYSwgcmVtYWluaW5nQ2FsbGJhY2tzKTtcbiAgICAgIGVsc2UgbWFwLmRlbGV0ZShhKTtcbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgYWRkT25Db2xsaWRlT2JqZWN0VnNPYmplY3QoXG4gICAgbWFwOiBMaXN0ZW5lck1hcCxcbiAgICBvYmplY3RBOiBDTyxcbiAgICBvYmplY3RCOiBDTyB8IHVuZGVmaW5lZCxcbiAgICBjYWxsYmFjazogQ29sbGlkZUNhbGxiYWNrPENPLCBDTz4sXG4gICAgY29udGV4dDogQ29sbGlkZUNvbnRleHQgfCB1bmRlZmluZWRcbiAgKSB7XG4gICAgLy8gQ2FuJ3QgZG8gYW55dGhpbmcgaWYgdGhlIGZpcnN0IG9iamVjdCBpcyBub3QgZGVmaW5lZCBvciBpbnZhbGlkLlxuICAgIGlmICghb2JqZWN0QSB8fCAhaXNDb2xsaWRpbmdPYmplY3Qob2JqZWN0QSkpIHtcbiAgICAgIHdhcm5JbnZhbGlkT2JqZWN0KG9iamVjdEEpO1xuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIC8vIFRoZSBzZWNvbmQgb2JqZWN0IGNhbiBiZSB1bmRlZmluZWQgb3IgYSB2YWxpZCBib2R5LlxuICAgIGlmIChvYmplY3RCICYmICFpc0NvbGxpZGluZ09iamVjdChvYmplY3RCKSkge1xuICAgICAgd2FybkludmFsaWRPYmplY3Qob2JqZWN0QSk7XG4gICAgICByZXR1cm47XG4gICAgfVxuXG4gICAgY29uc3QgY2FsbGJhY2tzID0gbWFwLmdldChvYmplY3RBKSB8fCBbXTtcbiAgICBjYWxsYmFja3MucHVzaCh7IHRhcmdldDogb2JqZWN0QiwgY2FsbGJhY2ssIGNvbnRleHQgfSk7XG4gICAgbWFwLnNldChvYmplY3RBLCBjYWxsYmFja3MpO1xuICB9XG5cbiAgcHJpdmF0ZSBvbkNvbGxpc2lvblN0YXJ0KGV2ZW50OiBNYXR0ZXJFdmVudHMuQ29sbGlzaW9uQWN0aXZlRXZlbnQpIHtcbiAgICB0aGlzLm9uQ29sbGlzaW9uRXZlbnQodGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycywgQ09MTElTSU9OX1NUQVJULCBldmVudCk7XG4gIH1cblxuICBwcml2YXRlIG9uQ29sbGlzaW9uRW5kKGV2ZW50OiBNYXR0ZXJFdmVudHMuQ29sbGlzaW9uRW5kRXZlbnQpIHtcbiAgICB0aGlzLm9uQ29sbGlzaW9uRXZlbnQodGhpcy5jb2xsaXNpb25FbmRMaXN0ZW5lcnMsIENPTExJU0lPTl9FTkQsIGV2ZW50KTtcbiAgfVxuXG4gIHByaXZhdGUgb25Db2xsaXNpb25BY3RpdmUoZXZlbnQ6IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudCkge1xuICAgIHRoaXMub25Db2xsaXNpb25FdmVudCh0aGlzLmNvbGxpc2lvbkFjdGl2ZUxpc3RlbmVycywgQ09MTElTSU9OX0FDVElWRSwgZXZlbnQpO1xuICB9XG5cbiAgLyoqXG4gICAqIFJldXNhYmxlIGhhbmRsZXIgZm9yIGNvbGxpc2lvbnN0YXJ0LCBjb2xsaXNpb25lbmQsIGNvbGxpc2lvbmFjdGl2ZS5cbiAgICogKi9cbiAgcHJpdmF0ZSBvbkNvbGxpc2lvbkV2ZW50KFxuICAgIGxpc3RlbmVyTWFwOiBMaXN0ZW5lck1hcCxcbiAgICBldmVudE5hbWU6IHN0cmluZyxcbiAgICBldmVudDogTWF0dGVyQ29sbGlzaW9uRXZlbnRcbiAgKSB7XG4gICAgY29uc3QgcGFpcnMgPSBldmVudC5wYWlycyBhcyBFeHRlbmRlZE1hdHRlckNvbGxpc2lvbkRhdGFbXTtcbiAgICBjb25zdCBwYWlyRXZlbnROYW1lID0gXCJwYWlyXCIgKyBldmVudE5hbWU7XG4gICAgY29uc3QgZXZlbnREYXRhOiBQYXJ0aWFsPEV2ZW50RGF0YTxDTywgQ08+PiA9IHsgaXNSZXZlcnNlZDogZmFsc2UgfTtcbiAgICBjb25zdCBldmVudERhdGFSZXZlcnNlZDogUGFydGlhbDxFdmVudERhdGE8Q08sIENPPj4gPSB7IGlzUmV2ZXJzZWQ6IHRydWUgfTtcblxuICAgIHBhaXJzLm1hcCgocGFpciwgaSkgPT4ge1xuICAgICAgY29uc3QgeyBib2R5QSwgYm9keUIgfSA9IHBhaXI7XG4gICAgICBjb25zdCByb290Qm9keUEgPSBnZXRSb290Qm9keShib2R5QSk7XG4gICAgICBjb25zdCByb290Qm9keUIgPSBnZXRSb290Qm9keShib2R5Qik7XG4gICAgICBsZXQgZ2FtZU9iamVjdEE6IENPIHwgdW5kZWZpbmVkID0gcm9vdEJvZHlBLmdhbWVPYmplY3QgPz8gdW5kZWZpbmVkO1xuICAgICAgbGV0IGdhbWVPYmplY3RCOiBDTyB8IHVuZGVmaW5lZCA9IHJvb3RCb2R5Qi5nYW1lT2JqZWN0ID8/IHVuZGVmaW5lZDtcblxuICAgICAgLy8gU3BlY2lhbCBjYXNlIGZvciB0aWxlcywgd2hlcmUgaXQncyBtb3JlIHVzZWZ1bCB0byBoYXZlIGEgcmVmZXJlbmNlIHRvIHRoZSBUaWxlIG9iamVjdCBub3RcbiAgICAgIC8vIHRoZSBUaWxlQm9keS4gVGhpcyBpcyBob3QgY29kZSwgc28gdXNlIGEgcHJvcGVydHkgY2hlY2sgaW5zdGVhZCBvZiBpbnN0YW5jZW9mLlxuICAgICAgaWYgKGdhbWVPYmplY3RBICYmIGdhbWVPYmplY3RBIGluc3RhbmNlb2YgTWF0dGVyLlRpbGVCb2R5KSB7XG4gICAgICAgIGdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEEudGlsZTtcbiAgICAgIH1cbiAgICAgIGlmIChnYW1lT2JqZWN0QiAmJiBnYW1lT2JqZWN0QiBpbnN0YW5jZW9mIE1hdHRlci5UaWxlQm9keSkge1xuICAgICAgICBnYW1lT2JqZWN0QiA9IGdhbWVPYmplY3RCLnRpbGU7XG4gICAgICB9XG5cbiAgICAgIHBhaXJzW2ldLmdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEEgPz8gdW5kZWZpbmVkO1xuICAgICAgcGFpcnNbaV0uZ2FtZU9iamVjdEIgPSBnYW1lT2JqZWN0QiA/PyB1bmRlZmluZWQ7XG5cbiAgICAgIGV2ZW50RGF0YS5ib2R5QSA9IGJvZHlBO1xuICAgICAgZXZlbnREYXRhLmJvZHlCID0gYm9keUI7XG4gICAgICBldmVudERhdGEuZ2FtZU9iamVjdEEgPSBnYW1lT2JqZWN0QSA/PyB1bmRlZmluZWQ7XG4gICAgICBldmVudERhdGEuZ2FtZU9iamVjdEIgPSBnYW1lT2JqZWN0QiA/PyB1bmRlZmluZWQ7XG4gICAgICBldmVudERhdGEucGFpciA9IHBhaXI7XG5cbiAgICAgIHRoaXMuZXZlbnRzLmVtaXQocGFpckV2ZW50TmFtZSwgZXZlbnREYXRhKTtcblxuICAgICAgaWYgKGxpc3RlbmVyTWFwLnNpemUgPiAwKSB7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmJvZHlCID0gYm9keUE7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmJvZHlBID0gYm9keUI7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmdhbWVPYmplY3RCID0gZ2FtZU9iamVjdEE7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEI7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLnBhaXIgPSBwYWlyO1xuXG4gICAgICAgIGNvbnN0IGRhdGEgPSBldmVudERhdGEgYXMgRXZlbnREYXRhPENPLCBDTz47XG4gICAgICAgIGNvbnN0IGRhdGFSZXZlcnNlZCA9IGV2ZW50RGF0YVJldmVyc2VkIGFzIEV2ZW50RGF0YTxDTywgQ08+O1xuXG4gICAgICAgIHRoaXMuY2hlY2tQYWlyQW5kRW1pdChsaXN0ZW5lck1hcCwgYm9keUEsIGJvZHlCLCBnYW1lT2JqZWN0QiwgZGF0YSk7XG4gICAgICAgIHRoaXMuY2hlY2tQYWlyQW5kRW1pdChsaXN0ZW5lck1hcCwgYm9keUIsIGJvZHlBLCBnYW1lT2JqZWN0QSwgZGF0YVJldmVyc2VkKTtcblxuICAgICAgICBpZiAoZ2FtZU9iamVjdEEpIHtcbiAgICAgICAgICB0aGlzLmNoZWNrUGFpckFuZEVtaXQobGlzdGVuZXJNYXAsIGdhbWVPYmplY3RBLCBib2R5QiwgZ2FtZU9iamVjdEIsIGRhdGEpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGdhbWVPYmplY3RCKSB7XG4gICAgICAgICAgdGhpcy5jaGVja1BhaXJBbmRFbWl0KGxpc3RlbmVyTWFwLCBnYW1lT2JqZWN0QiwgYm9keUEsIGdhbWVPYmplY3RBLCBkYXRhUmV2ZXJzZWQpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICB0aGlzLmV2ZW50cy5lbWl0KGV2ZW50TmFtZSwgZXZlbnQpO1xuICB9XG5cbiAgcHJpdmF0ZSBjaGVja1BhaXJBbmRFbWl0KFxuICAgIG1hcDogTGlzdGVuZXJNYXAsXG4gICAgb2JqZWN0QTogQ08sXG4gICAgYm9keUI6IE1hdHRlckpTLkJvZHksXG4gICAgZ2FtZU9iamVjdEI6IENPIHwgdW5kZWZpbmVkLFxuICAgIGV2ZW50RGF0YTogRXZlbnREYXRhPENPLCBDTz5cbiAgKSB7XG4gICAgY29uc3QgY2FsbGJhY2tzID0gbWFwLmdldChvYmplY3RBKTtcbiAgICBpZiAoY2FsbGJhY2tzKSB7XG4gICAgICBjYWxsYmFja3MuZm9yRWFjaCgoeyB0YXJnZXQsIGNhbGxiYWNrLCBjb250ZXh0IH0pID0+IHtcbiAgICAgICAgaWYgKCF0YXJnZXQgfHwgdGFyZ2V0ID09PSBib2R5QiB8fCB0YXJnZXQgPT09IGdhbWVPYmplY3RCKSB7XG4gICAgICAgICAgY2FsbGJhY2suY2FsbChjb250ZXh0LCBldmVudERhdGEpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9XG4gIH1cblxuICBzdWJzY3JpYmVNYXR0ZXJFdmVudHMoKSB7XG4gICAgY29uc3QgbWF0dGVyID0gdGhpcy5zY2VuZS5tYXR0ZXI7XG4gICAgaWYgKCFtYXR0ZXIgfHwgIW1hdHRlci53b3JsZCkge1xuICAgICAgbG9nZ2VyLndhcm4oXCJQbHVnaW4gcmVxdWlyZXMgbWF0dGVyIVwiKTtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgbWF0dGVyLndvcmxkLm9uKENPTExJU0lPTl9TVEFSVCwgdGhpcy5vbkNvbGxpc2lvblN0YXJ0LCB0aGlzKTtcbiAgICBtYXR0ZXIud29ybGQub24oQ09MTElTSU9OX0FDVElWRSwgdGhpcy5vbkNvbGxpc2lvbkFjdGl2ZSwgdGhpcyk7XG4gICAgbWF0dGVyLndvcmxkLm9uKENPTExJU0lPTl9FTkQsIHRoaXMub25Db2xsaXNpb25FbmQsIHRoaXMpO1xuICB9XG5cbiAgdW5zdWJzY3JpYmVNYXR0ZXJFdmVudHMoKSB7XG4gICAgLy8gRG9uJ3QgdW5zdWIgaWYgbWF0dGVyIG5leHQgZXhpc3Rpbmcgb3IgaWYgdGhlIGdhbWUgaXMgZGVzdHJveWVkIChzaW5jZSB0aGUgbWF0dGVyIHdvcmxkIHdpbGxcbiAgICAvLyBiZSBhbHJlYWR5IGdvbmUpXG4gICAgY29uc3QgbWF0dGVyID0gdGhpcy5zY2VuZS5tYXR0ZXI7XG4gICAgaWYgKCFtYXR0ZXIgfHwgIW1hdHRlci53b3JsZCkgcmV0dXJuO1xuICAgIG1hdHRlci53b3JsZC5vZmYoQ09MTElTSU9OX1NUQVJULCB0aGlzLm9uQ29sbGlzaW9uU3RhcnQsIHRoaXMpO1xuICAgIG1hdHRlci53b3JsZC5vZmYoQ09MTElTSU9OX0FDVElWRSwgdGhpcy5vbkNvbGxpc2lvbkFjdGl2ZSwgdGhpcyk7XG4gICAgbWF0dGVyLndvcmxkLm9mZihDT0xMSVNJT05fRU5ELCB0aGlzLm9uQ29sbGlzaW9uRW5kLCB0aGlzKTtcbiAgfVxuXG4gIHN0YXJ0KCkge1xuICAgIC8vIElmIHJlc3RhcnRpbmcsIHVuc3Vic2NyaWJlIGJlZm9yZSByZXN1YnNjcmliaW5nIHRvIGVuc3VyZSBvbmx5IG9uZSBsaXN0ZW5lciBpcyBhZGRlZFxuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihTSFVURE9XTiwgdGhpcy5zaHV0ZG93biwgdGhpcyk7XG4gICAgdGhpcy5zY2VuZS5ldmVudHMub24oU0hVVERPV04sIHRoaXMuc2h1dGRvd24sIHRoaXMpO1xuICAgIHRoaXMuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gIH1cblxuICBzaHV0ZG93bigpIHtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVMaXN0ZW5lcnMoKTtcbiAgICB0aGlzLnVuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gICAgLy8gUmVzdWJzY3JpYmUgdG8gc3RhcnQgc28gdGhhdCB0aGUgcGx1Z2luIGlzIHN0YXJ0ZWQgYWdhaW4gYWZ0ZXIgTWF0dGVyXG4gICAgdGhpcy5zY2VuZS5ldmVudHMub25jZShTVEFSVCwgdGhpcy5zdGFydCwgdGhpcyk7XG4gIH1cblxuICBkZXN0cm95KCkge1xuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihERVNUUk9ZLCB0aGlzLmRlc3Ryb3ksIHRoaXMpO1xuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihTVEFSVCwgdGhpcy5zdGFydCwgdGhpcyk7XG4gICAgdGhpcy5zY2VuZS5ldmVudHMub2ZmKFNIVVRET1dOLCB0aGlzLnNodXRkb3duLCB0aGlzKTtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVMaXN0ZW5lcnMoKTtcbiAgICB0aGlzLnVuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gIH1cbn1cbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./phaser-matter-collision-plugin.ts\n' + ); + }, + "./utils.ts": ( + __unused_webpack_module, + __webpack_exports__, + __webpack_require__ + ) => { + eval( + '__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "getRootBody": () => (/* binding */ getRootBody),\n/* harmony export */ "warnInvalidObject": () => (/* binding */ warnInvalidObject)\n/* harmony export */ });\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./logger */ "./logger.ts");\n\r\n/**\r\n * Get the root body of a compound Matter body.\r\n */\r\nfunction getRootBody(body) {\r\n while (body.parent !== body)\r\n body = body.parent;\r\n return body;\r\n}\r\n/**\r\n * @param obj\r\n */\r\nfunction warnInvalidObject(obj) {\r\n _logger__WEBPACK_IMPORTED_MODULE_0__.default.warn(`Expected a Matter body, a Tile, a GameObject, a Sprite, an Image, a TileBody, or an object with a body property, but instead, received: ${obj}`);\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi91dGlscy50cz84ODEzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUE4QjtBQUU5Qjs7R0FFRztBQUNJLFNBQVMsV0FBVyxDQUFDLElBQXVCO0lBQ2pELE9BQU8sSUFBSSxDQUFDLE1BQU0sS0FBSyxJQUFJO1FBQUUsSUFBSSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7SUFDaEQsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDO0FBRUQ7O0dBRUc7QUFDSSxTQUFTLGlCQUFpQixDQUFDLEdBQVE7SUFDeEMsaURBQVcsQ0FDVCwySUFBMkksR0FBRyxFQUFFLENBQ2pKLENBQUM7QUFDSixDQUFDIiwiZmlsZSI6Ii4vdXRpbHMudHMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgbG9nZ2VyIGZyb20gXCIuL2xvZ2dlclwiO1xuXG4vKipcbiAqIEdldCB0aGUgcm9vdCBib2R5IG9mIGEgY29tcG91bmQgTWF0dGVyIGJvZHkuXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBnZXRSb290Qm9keShib2R5OiBNYXR0ZXJKUy5Cb2R5VHlwZSkge1xuICB3aGlsZSAoYm9keS5wYXJlbnQgIT09IGJvZHkpIGJvZHkgPSBib2R5LnBhcmVudDtcbiAgcmV0dXJuIGJvZHk7XG59XG5cbi8qKlxuICogQHBhcmFtIG9ialxuICovXG5leHBvcnQgZnVuY3Rpb24gd2FybkludmFsaWRPYmplY3Qob2JqOiBhbnkpIHtcbiAgbG9nZ2VyLndhcm4oXG4gICAgYEV4cGVjdGVkIGEgTWF0dGVyIGJvZHksIGEgVGlsZSwgYSBHYW1lT2JqZWN0LCBhIFNwcml0ZSwgYW4gSW1hZ2UsIGEgVGlsZUJvZHksIG9yIGFuIG9iamVjdCB3aXRoIGEgYm9keSBwcm9wZXJ0eSwgYnV0IGluc3RlYWQsIHJlY2VpdmVkOiAke29ian1gXG4gICk7XG59XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./utils.ts\n' + ); + }, + "./valid-collision-object.ts": ( + __unused_webpack_module, + __webpack_exports__, + __webpack_require__ + ) => { + eval( + '__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "isMatterBody": () => (/* binding */ isMatterBody),\n/* harmony export */ "isCollidingObject": () => (/* binding */ isCollidingObject)\n/* harmony export */ });\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! phaser */ "phaser");\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(phaser__WEBPACK_IMPORTED_MODULE_0__);\n\r\nvar Tile = phaser__WEBPACK_IMPORTED_MODULE_0__.Tilemaps.Tile;\r\n/** Duck type to check if the given object is a Matter body (because there isn\'t a prototype). */\r\nfunction isMatterBody(obj) {\r\n return (obj.hasOwnProperty("parts") && obj.hasOwnProperty("slop") && obj.hasOwnProperty("gameObject"));\r\n}\r\n/**\r\n * Check if object is an acceptable physical object for this plugin - a Matter Body, a tile, or an\r\n * object with a body property.\r\n */\r\nfunction isCollidingObject(obj) {\r\n // GameObjects, images, sprites and tile bodies should all have a body property.\r\n return isMatterBody(obj) || obj.body || obj instanceof Tile;\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0LnRzP2QxM2YiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUF5QztBQUV6QyxJQUFPLElBQUksR0FBRyxpREFBYSxDQUFDO0FBYzVCLGlHQUFpRztBQUMxRixTQUFTLFlBQVksQ0FBQyxHQUFRO0lBQ25DLE9BQU8sQ0FDTCxHQUFHLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxJQUFJLEdBQUcsQ0FBQyxjQUFjLENBQUMsTUFBTSxDQUFDLElBQUksR0FBRyxDQUFDLGNBQWMsQ0FBQyxZQUFZLENBQUMsQ0FDOUYsQ0FBQztBQUNKLENBQUM7QUFFRDs7O0dBR0c7QUFDSSxTQUFTLGlCQUFpQixDQUFDLEdBQVE7SUFDeEMsZ0ZBQWdGO0lBQ2hGLE9BQU8sWUFBWSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEdBQUcsQ0FBQyxJQUFJLElBQUksR0FBRyxZQUFZLElBQUksQ0FBQztBQUM5RCxDQUFDIiwiZmlsZSI6Ii4vdmFsaWQtY29sbGlzaW9uLW9iamVjdC50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFRpbGVtYXBzLCBUeXBlcyB9IGZyb20gXCJwaGFzZXJcIjtcblxuaW1wb3J0IFRpbGUgPSBUaWxlbWFwcy5UaWxlO1xuaW1wb3J0IE1hdHRlckJvZHkgPSBUeXBlcy5QaHlzaWNzLk1hdHRlci5NYXR0ZXJCb2R5O1xuXG4vKiogQSB2YWxpZCBwaHlzaWNzLWVuYWJsZWQgZ2FtZSBvYmplY3QsIG9yIGp1c3QgYW4gb2JqZWN0IHRoYXQgaGFzIFwiYm9keVwiIHByb3BlcnR5ICovXG5leHBvcnQgdHlwZSBPYmplY3RXaXRoQm9keSA9IHtcbiAgYm9keTogTWF0dGVySlMuQm9keVR5cGU7XG59O1xuXG4vKipcbiAqIEEgdW5pb24gb2YgYWxsIHRoZSB0eXBlcyBvZiBwaHlzaWNzIG9iamVjdHMgd2UgY291bGQgaGF2ZSBpbiB0aGUgc2ltdWxhdGlvbiAtIGZyb20gcmF3IE1hdHRlci5qc1xuICogYm9kaWVzIHRvIHRpbGVzIGFuZCBwaHlzaWNzLWVuYWJsZWQgUGhhc2VyIEdhbWVPYmplY3RzLlxuICovXG5leHBvcnQgdHlwZSBDb2xsaWRpbmdPYmplY3QgPSBNYXR0ZXJCb2R5IHwgTWF0dGVySlMuQm9keVR5cGUgfCBUaWxlIHwgT2JqZWN0V2l0aEJvZHk7XG5cbi8qKiBEdWNrIHR5cGUgdG8gY2hlY2sgaWYgdGhlIGdpdmVuIG9iamVjdCBpcyBhIE1hdHRlciBib2R5IChiZWNhdXNlIHRoZXJlIGlzbid0IGEgcHJvdG90eXBlKS4gKi9cbmV4cG9ydCBmdW5jdGlvbiBpc01hdHRlckJvZHkob2JqOiBhbnkpOiBvYmogaXMgTWF0dGVyQm9keSB7XG4gIHJldHVybiAoXG4gICAgb2JqLmhhc093blByb3BlcnR5KFwicGFydHNcIikgJiYgb2JqLmhhc093blByb3BlcnR5KFwic2xvcFwiKSAmJiBvYmouaGFzT3duUHJvcGVydHkoXCJnYW1lT2JqZWN0XCIpXG4gICk7XG59XG5cbi8qKlxuICogQ2hlY2sgaWYgb2JqZWN0IGlzIGFuIGFjY2VwdGFibGUgcGh5c2ljYWwgb2JqZWN0IGZvciB0aGlzIHBsdWdpbiAtIGEgTWF0dGVyIEJvZHksIGEgdGlsZSwgb3IgYW5cbiAqIG9iamVjdCB3aXRoIGEgYm9keSBwcm9wZXJ0eS5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGlzQ29sbGlkaW5nT2JqZWN0KG9iajogYW55KTogb2JqIGlzIENvbGxpZGluZ09iamVjdCB7XG4gIC8vIEdhbWVPYmplY3RzLCBpbWFnZXMsIHNwcml0ZXMgYW5kIHRpbGUgYm9kaWVzIHNob3VsZCBhbGwgaGF2ZSBhIGJvZHkgcHJvcGVydHkuXG4gIHJldHVybiBpc01hdHRlckJvZHkob2JqKSB8fCBvYmouYm9keSB8fCBvYmogaW5zdGFuY2VvZiBUaWxlO1xufVxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./valid-collision-object.ts\n' + ); + }, + phaser: (t) => { + t.exports = __WEBPACK_EXTERNAL_MODULE_phaser__; + }, + }, + __webpack_module_cache__ = {}; + function __webpack_require__(t) { + var e = __webpack_module_cache__[t]; + if (void 0 !== e) return e.exports; + var s = (__webpack_module_cache__[t] = { exports: {} }); + return ( + __webpack_modules__[t](s, s.exports, __webpack_require__), s.exports + ); + } + (__webpack_require__.n = (t) => { + var e = t && t.__esModule ? () => t.default : () => t; + return __webpack_require__.d(e, { a: e }), e; + }), + (__webpack_require__.d = (t, e) => { + for (var s in e) + __webpack_require__.o(e, s) && + !__webpack_require__.o(t, s) && + Object.defineProperty(t, s, { enumerable: !0, get: e[s] }); + }), + (__webpack_require__.o = (t, e) => + Object.prototype.hasOwnProperty.call(t, e)), + (__webpack_require__.r = (t) => { + "undefined" != typeof Symbol && + Symbol.toStringTag && + Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), + Object.defineProperty(t, "__esModule", { value: !0 }); + }); + var __webpack_exports__ = __webpack_require__("./index.ts"); + return __webpack_exports__; + })(); + }), + (module.exports = factory(requirePhaser())); +})(phaserMatterCollision); +var phaserMatterCollisionExports = phaserMatterCollision.exports; +const PhaserMatterCollisionPlugin = getDefaultExportFromCjs( + phaserMatterCollisionExports +); +class MatterGravityFixPlugin extends Phaser.Plugins.ScenePlugin { + constructor(t, e) { + super(t, e); + } + boot() { + const t = Phaser.Physics.Matter.Matter; + this.applyGravityFix(t); + } + applyGravityFix(t) { + t.Engine._bodiesApplyGravity = function (t, e) { + var s = void 0 !== e.scale ? e.scale : 0.001, + i = t.length; + if ((0 !== e.x || 0 !== e.y) && 0 !== s) + for (var n = 0; n < i; n++) { + var o = t[n]; + o.ignoreGravity || + o.isStatic || + o.isSleeping || + ((o.force.y += o.mass * e.y * s), (o.force.x += o.mass * e.x * s)); + } + }; + } +} +const config = { + width: 600, + height: 600, + scale: { mode: Phaser$1.Scale.FIT, autoCenter: Phaser$1.Scale.CENTER_BOTH }, + autoRound: !1, + parent: "game-container", + physics: { default: "matter", matter: { debug: !1 } }, + plugins: { + scene: [ + { + plugin: PhaserMatterCollisionPlugin, + key: "matterCollision", + mapping: "matterCollision", + }, + { + key: "MatterGravityFixPlugin", + plugin: MatterGravityFixPlugin, + mapping: "matterGravityFix", + start: !0, + }, + ], + }, + scene: [Bootloader, Splash, Transition, Game, Outro], +}; +new Phaser$1.Game(config); diff --git a/dungeon/src/main.js b/dungeon/src/main.js index 775537b2..9600eefe 100644 --- a/dungeon/src/main.js +++ b/dungeon/src/main.js @@ -1,11 +1,11 @@ import Phaser from "phaser"; +import PhaserMatterCollisionPlugin from "phaser-matter-collision-plugin"; +import { MatterGravityFixPlugin } from "./plugins/matter_gravity_fix"; import Bootloader from "./scenes/bootloader"; +import Game from "./scenes/game"; import Outro from "./scenes/outro"; import Splash from "./scenes/splash"; import Transition from "./scenes/transition"; -import Game from "./scenes/game"; -import PhaserMatterCollisionPlugin from "phaser-matter-collision-plugin"; -import { MatterGravityFixPlugin } from "./plugins/matter_gravity_fix"; const config = { width: 600, @@ -15,7 +15,7 @@ const config = { autoCenter: Phaser.Scale.CENTER_BOTH, }, autoRound: false, - parent: "contenedor", + parent: "game-container", physics: { default: "matter", matter: { diff --git a/mars/dist/assets/index-CP-uPpKM.js b/mars/dist/assets/index-CP-uPpKM.js index a2aebcb9..05a50961 100644 --- a/mars/dist/assets/index-CP-uPpKM.js +++ b/mars/dist/assets/index-CP-uPpKM.js @@ -1 +1,1951 @@ -import{c as t,g as e,P as s}from"./phaser-X8YdoW2c.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const s of t)if("childList"===s.type)for(const t of s.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();class i extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.setLoadEvents(),this.loadFonts(),this.loadImages(),this.loadMaps(),this.loadAudios(),this.loadSpritesheets(),this.setRegistry()}setLoadEvents(){this.load.on("progress",(function(t){this.progressBar.clear(),this.progressBar.fillStyle(11411474,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*t,16)}),this),this.load.on("complete",(()=>{this.scene.start("splash")}),this)}loadFonts(){this.load.bitmapFont("pico","assets/fonts/pico.png","assets/fonts/pico.xml")}loadImages(){this.load.image("body","assets/images/body.png"),this.load.image("landscape","assets/images/landscape.png"),this.load.image("record","assets/images/record.png"),this.load.image("hole","assets/images/hole.png"),this.load.image("pello","assets/images/pello_ok.png"),this.load.image("mars","assets/maps/mars64.png"),this.load.image("background","assets/maps/mars.png")}loadMaps(){Array(7).fill(0).forEach(((t,e)=>{this.load.tilemapTiledJSON(`scene${e}`,`assets/maps/scene${e}.json`)}))}loadAudios(){this.load.audio("mars_background","assets/sounds/mars_background.mp3"),this.load.audio("step","assets/sounds/step.mp3"),this.load.audio("creepy","assets/sounds/creepy.mp3"),this.load.audio("heartbeat","assets/sounds/heartbeat.mp3"),this.load.audio("breath","assets/sounds/breath.mp3"),this.load.audio("blip","assets/sounds/blip.mp3"),this.load.audio("ohmygod","assets/sounds/ohmygod.mp3"),this.load.audio("kill","assets/sounds/kill.mp3"),this.load.audio("tracker","assets/sounds/tracker.mp3"),this.load.audio("holeshout","assets/sounds/holeshout.mp3"),this.load.audio("oxygen","assets/sounds/oxygen.mp3"),this.load.audio("monster","assets/sounds/monster.mp3"),this.load.audio("killed","assets/sounds/killed.mp3"),this.load.audio("creepy_static","assets/sounds/creepy_static.mp3"),this.load.audio("shock","assets/sounds/shock.mp3"),this.load.audio("cave","assets/sounds/cave.mp3"),this.load.audio("type","assets/sounds/type.mp3"),Array(4).fill(0).forEach(((t,e)=>{this.load.audio(`static${e}`,`assets/sounds/static${e}.mp3`)})),Array(6).fill(0).forEach(((t,e)=>{this.load.audio(`diary${e+1}`,`assets/sounds/diary/diary${e+1}.mp3`)})),Array(6).fill(0).forEach(((t,e)=>{this.load.audio(`officer${e+1}`,`assets/sounds/officer/officer${e+1}.mp3`)}))}loadSpritesheets(){this.load.spritesheet("player","assets/images/player.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("debris","assets/images/debris.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("step","assets/images/step.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("wave","assets/images/wave.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("drone","assets/images/drone.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("monster","assets/images/monster.png",{frameWidth:128,frameHeight:64})}setRegistry(){this.registry.set("score",0)}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(7017483,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class n{constructor(t){this.scene=t}typeText(t,e,s,i=150,n=450954,a=40){let h=[],o=0,r=0;t.split("").forEach(((t,l)=>{"\n"===t&&(o+=2,r=0),h.push(this.scene.add.bitmapText(s-350+25*r++,i+o*a,e,t,a).setTint(n).setAlpha(0))}));const l=this.scene.add.rectangle(s-335+25*r,i+25+o*a,25,5,n).setOrigin(.5).setAlpha(0),d=this.scene.tweens.timeline();return this.typeAudio=this.scene.sound.add("type"),h.forEach(((t,e)=>{d.add({targets:t,alpha:{from:0,to:.5},duration:100})})),d.add({targets:l,alpha:{from:0,to:.8},duration:100,repeat:5,yoyo:!0,onStart:()=>{this.typeAudio.stop()}}),this.typeAudio.play({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!0,delay:0}),d.play(),h.push(l),h}removeTyped(t){t.flat().forEach((t=>t.destroy()))}}class a extends Phaser.Scene{constructor(){super({key:"outro"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.introLayer=this.add.layer(),this.splashLayer=this.add.layer(),this.add.tileSprite(0,0,800,600,"landscape").setOrigin(0),this.utils=new n(this),this.title=this.add.bitmapText(this.center_width,this.center_height+100,"pico","MARSTRANDED",60).setTint(7017483).setAlpha(0).setDropShadow(0,4,7024682,.9).setOrigin(.5),this.tweens.add({targets:this.title,alpha:{from:0,to:1},duration:4e3}),this.input.keyboard.on("keydown-SPACE",this.startSplash,this),this.input.keyboard.on("keydown-ENTER",this.startSplash,this)}playMusic(t="mars_background"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:1.5,rate:1,detune:0,seek:0,loop:!0,delay:0})}startSplash(){this.sound.stopAll(),this.scene.start("splash")}}class h extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i,n,a=16771755){super(t,e+=Phaser.Math.Between(-30,30),s+=Phaser.Math.Between(-30,30),Phaser.Math.Between(30,55),Phaser.Math.Between(30,55),a),t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setVelocityX(100*i),this.body.setVelocityY(100*n),this.init()}init(){this.scene.tweens.add({targets:this,duration:800,scale:{from:1,to:0},onComplete:()=>{this.destroy()}})}}class o extends Phaser.Scene{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(0),this.smokeLayer=this.add.layer(),this.showTitle(),this.time.delayedCall(1e3,(()=>this.showInstructions()),null,this),this.input.keyboard.on("keydown-SPACE",(()=>this.startGame()),this),this.playMusic()}showTitle(){this.step=this.sound.add("step"),"MARSTRANDED".split("").forEach(((t,e)=>{this.time.delayedCall(600*(e+1),(()=>{this.add.bitmapText(70*e+50,200,"pico",t,70).setTint(7017483).setOrigin(.5).setDropShadow(0,4,7024682,.9),Array(Phaser.Math.Between(2,4)).fill(0).forEach((t=>{this.smokeLayer.add(new h(this,70*e+80+Phaser.Math.Between(-30,30),200+Phaser.Math.Between(-30,30),0,-1,7024682))})),this.step.play({rate:.8}),this.step.resume()}),null,this)}))}startGame(){this.theme&&this.theme.stop(),this.sound.add("blip").play(),this.scene.start("transition",{next:"game",name:"STAGE",number:0,time:30})}playMusic(t="mars_background"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:2,rate:1,detune:0,seek:0,loop:!0,delay:0})}showInstructions(){this.add.bitmapText(this.center_width,450,"pico","WASD/Arrows",40).setTint(7017483).setOrigin(.5).setDropShadow(0,3,7024682,.9),this.add.sprite(this.center_width-140,355,"pello").setOrigin(.5).setScale(.5),this.add.bitmapText(this.center_width+60,350,"pico","By PELLO",35).setTint(7017483).setOrigin(.5).setDropShadow(0,3,7024682,.9),this.space=this.add.bitmapText(this.center_width,520,"pico","SPACE start",30).setTint(7017483).setOrigin(.5).setDropShadow(0,2,7024682,.9),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}}class r extends Phaser.Scene{constructor(){super({key:"transition"})}init(t){this.number=t.number}create(){this.missions=["","Go north, locate containers.","Find landing zone. North East.","Locate landing, South East.","Go East, locate containers.","Other landings: North East","Find out ship origin..."],this.utils=new n(this),this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.add.tileSprite(0,0,800,600,"landscape").setOrigin(0),7===this.number?this.scene.start("outro",{number:this.number}):this.sound.stopAll(),this.showInstructions(),this.input.keyboard.on("keydown-ENTER",(()=>this.loadNext()),this),this.input.keyboard.on("keydown-SPACE",(()=>this.loadNext()),this)}showInstructions(){const t=Array(8).fill(0).map(((t,e)=>`DAY ${e}`));this.text1=this.add.bitmapText(this.center_width,20,"pico",t[this.number],30).setOrigin(.5).setAlpha(0),this.text2=this.add.bitmapText(this.center_width,70,"pico","AUDIO RECORD OF CAPTAIN BRAUN",20).setOrigin(.5).setAlpha(0),this.number>0?this.showSceneInstructions():this.showFirstInstructions()}showSceneInstructions(){this.tweens.add({targets:[this.text1,this.text2,this.play],duration:1e3,alpha:{from:0,to:1},onComplete:()=>{this.playDiary()}})}showFirstInstructions(){this.playBackground(),this.text2=this.add.bitmapText(this.center_width,70,"pico","THE CRASH",20).setOrigin(.5).setAlpha(0),this.playCreepy(),this.tweens.add({targets:[this.text1],duration:2e3,alpha:{from:0,to:1},onComplete:()=>{this.playIntro()}})}playIntro(){this.utils.typeText("YOU JUST CRASHED ON MARS\nYOU ARE ALIVE BUT YOUR\nSHIP IS COMPLETELY LOST\nIF YOU WANT TO LIVE YOU\nMUST FIND LANDING REMAINS\nTRY GOING EAST...","pico",this.center_width,150,16777215,20)}playBackground(){this.theme=this.sound.add("mars_background"),this.theme.stop(),this.theme.play({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!0,delay:0})}playDiary(){this.wave=this.add.sprite(this.center_width,200,"wave").setOrigin(.5),this.anims.create({key:"wave",frames:this.anims.generateFrameNumbers("wave",{start:0,end:4}),frameRate:20,repeat:-1}),this.wave.anims.play("wave",!0),this.recording=this.sound.add(`diary${this.number}`),this.recording.on("complete",function(){this.wave.destroy(),this.showMission(),this.playCreepy()}.bind(this)),this.recording.play()}playCreepy(){this.creepy=this.sound.add("creepy"),this.creepy.play({mute:!1,volume:.9,rate:.9,detune:0,seek:0,loop:!0,delay:0})}showMission(){this.text3=this.add.bitmapText(this.center_width,300,"pico","MISSION OBJECTIVE:",30).setOrigin(.5),this.utils.typeText(this.missions[this.number],"pico",this.center_width,400,16777215,20)}loadNext(){this.sound.add("blip").play(),this.sound.stopAll(),this.scene.start("game",{number:this.number})}}class l extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="step"){super(t,e,s,"step",Phaser.Math.Between(0,3)),t.add.existing(this),this.setOrigin(0),t.tweens.add({targets:[this],duration:2e3,alpha:{from:1,to:.1}})}}class d extends Phaser.GameObjects.Sprite{constructor(t,e,s,i=100){super(t,e,s,"player"),this.setOrigin(0),this.setScale(1),this.scene.add.existing(this),this.scene.physics.add.existing(this),this.body.setAllowGravity(!1),this.dead=!1,this.init(),this.shells=0,this.lastDirection=0,this.steps=0,this.stepDelta=0,this.moveDelta=0,this.rate=.2,this.previousRate=.2,this.oxygen=i,this.locked=!1}init(){this.addControls(),this.scene.events.on("update",this.update,this)}addControls(){this.cursor=this.scene.input.keyboard.createCursorKeys(),this.W=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W),this.A=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.A),this.S=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S),this.D=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.D)}update(t,e){if(!this.dead&&!this.locked){if(this.stepDelta+=e,this.moveDelta+=e,(Phaser.Input.Keyboard.JustDown(this.W)||Phaser.Input.Keyboard.JustDown(this.cursor.up))&&this.canMoveUp()){this.moveDelta=0;const{x:t,y:e}=this;this.locked=!0,this.scene.tweens.add({targets:this,y:"-=64",duration:200,onComplete:()=>{this.locked=!1}}),this.step(t,e)}else if((Phaser.Input.Keyboard.JustDown(this.D)||Phaser.Input.Keyboard.JustDown(this.cursor.right))&&this.canMoveRight()){this.moveDelta=0;const{x:t,y:e}=this;this.locked=!0,this.scene.tweens.add({targets:this,x:"+=64",duration:200,onComplete:()=>{this.locked=!1}}),this.step(t,e)}else if((Phaser.Input.Keyboard.JustDown(this.A)||Phaser.Input.Keyboard.JustDown(this.cursor.left))&&this.canMoveLeft()){this.moveDelta=0;const{x:t,y:e}=this;this.locked=!0,this.scene.tweens.add({targets:this,x:"-=64",duration:200,onComplete:()=>{this.locked=!1}}),this.step(t,e)}else if((Phaser.Input.Keyboard.JustDown(this.S)||Phaser.Input.Keyboard.JustDown(this.cursor.down))&&this.canMoveDown()){this.moveDelta=0;const{x:t,y:e}=this;this.locked=!0,this.scene.tweens.add({targets:this,y:"+=64",duration:200,onComplete:()=>{this.locked=!1}}),this.step(t,e)}this.adaptBreath()}}canMoveUp(){return!this.scene.platform.getTileAtWorldXY(this.x,this.y-1)&&this.moveDelta>200}canMoveRight(){return!this.scene.platform.getTileAtWorldXY(this.x+64,this.y)&&this.moveDelta>200}canMoveDown(){return!this.scene.platform.getTileAtWorldXY(this.x,this.y+64)&&this.moveDelta>200}canMoveLeft(){return!this.scene.platform.getTileAtWorldXY(this.x-1,this.y)&&this.moveDelta>200}step(t,e){this.steps++,this.scene.smokeLayer.add(new l(this.scene,t,e)),this.scene.playRandom("step",1)}adaptBreath(){this.stepDelta>2e3&&(this.steps>2?(this.previousRate=this.rate,this.rate=this.steps<11?this.steps/10:1,this.scene.breath(this.rate),this.updateOxygen(this.steps+Math.round(this.steps/2))):this.rate!==this.previousRate?(this.previousRate=this.rate,this.rate=this.rate>.2?this.rate-.1:.2,this.scene.breath(this.rate),this.scene.updateOxygen(this.steps)):this.scene.updateOxygen(this.steps),this.steps=this.stepDelta=0)}updateOxygen(t){t>=this.oxygen?(this.oxygen=0,this.death()):this.oxygen-=t,this.scene.updateOxygen()}death(){this.dead=!0,this.body.stop(),this.body.enable=!1,this.scene.restartScene()}}class c extends Phaser.GameObjects.Sprite{constructor(t,e,s){super(t,e,s,"hole"),this.name="hole",this.setOrigin(0),this.setAlpha(0),t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1)}}class u extends Phaser.GameObjects.Sprite{constructor(t,e,s){super(t,e,s,"body"),this.name="body",this.setOrigin(0),this.rotation=1.6,t.add.existing(this)}}let p=class extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i,n,a=""){super(t,e,s,192,192),this.setOrigin(0),this.type=i,this.description=n,this.extra=a,t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1),this.activated=!1}touch(){switch(this.type){case"note":this.showNote(this.description);break;case"radio":this.useRadio();break;case"exit":this.exitScene();break;case"hole":this.activateHole();break;case"oxygen":this.useOxygen();break;case"braun":this.activateBraun();break;case"ending":this.revealEnding()}}showNote(t){const e=this.scene.add.bitmapText(this.x,this.y,"pico",t,15);this.scene.tweens.add({targets:e,alpha:{from:1,to:0},duration:6e3,ease:"Sine",onComplete:()=>{e.destroy()}})}showExit(t){const e=this.scene.add.bitmapText(this.x-128,this.y-64,"pico",t,25);this.scene.tweens.add({targets:e,alpha:{from:.8,to:1},duration:100,repeat:5})}useRadio(){this.officerAudio=this.scene.sound.add(this.description),this.officerAudio.play(),this.officerAudio.on("complete",function(){this.scene.playRandomStatic(),this.extra&&this.scene.sound.add(this.extra).play()}.bind(this))}exitScene(){this.showExit(this.description),this.showNote(this.extra),this.scene.finishScene()}useOxygen(){this.showNote("Oxygen supplies!"),this.scene.player.oxygen=100,this.scene.updateOxygen(),this.scene.playAudio("oxygen")}revealEnding(){const t=this.scene.sound.add("ohmygod");t.play(),this.scene.cameras.main.shake(1e4),this.showExit(this.description),this.scene.sound.add("monster").play({volume:1.5,rate:.8});const e=this.scene.add.sprite(this.x+128,this.y+128,"monster").setOrigin(.5);this.scene.anims.create({key:"monster",frames:this.scene.anims.generateFrameNumbers("monster",{start:0,end:5}),frameRate:3}),e.anims.play("monster",!0),t.on("complete",function(){this.scene.breathing.pause(),this.scene.playAudio("holeshout"),this.scene.finishScene(!1)}.bind(this))}activateHole(){this.scene.holes.add(new c(this.scene,this.x+64,this.y+64))}activateBraun(){this.showExit(this.description),this.scene.playAudio("shock"),new u(this.scene,this.x+128,this.y+64)}};var m,y={exports:{}};m=y,function(){var t,e,s,i,n,a,h,o,r,l,d,c,u,p,y;s=Math.floor,l=Math.min,e=function(t,e){return te?1:0},r=function(t,i,n,a,h){var o;if(null==n&&(n=0),null==h&&(h=e),n<0)throw new Error("lo must be non-negative");for(null==a&&(a=t.length);ni;0<=i?e++:e--)l.push(e);return l}.apply(this).reverse()).length;ay;0<=y?++u:--u)g.push(n(t,a));return g},p=function(t,s,i,n){var a,h,o;for(null==n&&(n=e),a=t[i];i>s&&n(a,h=t[o=i-1>>1])<0;)t[i]=h,i=o;return t[i]=a},y=function(t,s,i){var n,a,h,o,r;for(null==i&&(i=e),a=t.length,r=s,h=t[s],n=2*s+1;nt[0].length-1||i>t.length-1||a>t[0].length-1||h>t.length-1)throw new Error("Your start or end point is outside the scope of your grid.");if(e!==a||i!==h){for(var l=t[h][a],u=!1,p=0;p0&&m(h,o,0,-1,1*w(o.x,o.y-1)),o.x0&&m(h,o,-1,0,1*w(o.x-1,o.y)),p&&(o.x>0&&o.y>0&&(l||y(t,s,o.x,o.y-1,o)&&y(t,s,o.x-1,o.y,o))&&m(h,o,-1,-1,i*w(o.x-1,o.y-1)),o.x0&&(l||y(t,s,o.x,o.y-1,o)&&y(t,s,o.x+1,o.y,o))&&m(h,o,1,-1,i*w(o.x+1,o.y-1)),o.x>0&&o.y{this.scene.playAudio("kill"),this.launchMove()}),null,this)}launchMove(){this.scene&&(this.delayedMove=this.scene.time.addEvent({delay:2e3,callback:this.move.bind(this),startAt:0,callbackScope:this,loop:!0}))}move(){try{if(!this.scene.player)return;this.moveTimeline&&this.moveTimeline.destroy(),this.easystar.findPath(Math.floor(this.x/64),Math.floor(this.y/64),Math.floor(this.scene.player.x/64),Math.floor(this.scene.player.y/64),this.moveIt.bind(this)),this.easystar.setIterationsPerCalculation(1e4),this.easystar.enableSync(),this.easystar.calculate()}catch(t){console.log("Cant move yet: ",t)}}moveIt(t){if(null===t)console.log("hello sneaky pete");else{let e=[];this.i=0,this.path=t;for(let s=0;s{this.delayedMove.remove(),this.alpha>0&&!this.scene.player.dead&&this.launchMove()}})}}}const T={setBloomEnable(t){return void 0===t&&(t=!0),this.bloomEnable=t,this},setBloomRadius(t){return this.bloomRadius=t,this},setBloomIntensity(t){return this.bloomIntensity=t,this},setBloomThreshold(t){return this.bloomThreshold=t,this},setBloomTexelSize(t,e){return void 0===e&&(e=t),this.bloomTexelWidth=t,this.bloomTexelHeight=e,this}},k={setChromaticEnable(t){return void 0===t&&(t=!0),this.chromaticEnable=t,this},setChabIntensity(t){return this.chabIntensity=t,this}},A={setVignetteEnable(t){return void 0===t&&(t=!0),this.vignetteEnable=t,this},setVignetteStrength(t){return this.vignetteStrength=t,this},setVignetteIntensity(t){return this.vignetteIntensity=t,this}},O={setNoiseEnable(t){return void 0===t&&(t=!0),this.noiseEnable=t,this},setNoiseStrength(t){return this.noiseStrength=t,this},setNoiseSeed(t){return this.noiseSeed=t,this}},M={setVHSEnable(t){return void 0===t&&(t=!0),this.vhsEnable=t,this},setVhsStrength(t){return this.vhsStrength=t,this}},P={setScanlinesEnable(t){return void 0===t&&(t=!0),this.scanlinesEnable=t,this},setScanStrength(t){return this.scanStrength=t,this}},I={setCRTEnable(t){return void 0===t&&(t=!0),this.crtEnable=t,this},setCrtSize(t,e){return void 0===e&&(e=t),this.crtWidth=t,this.crtHeight=e,this}};var C={setEnable:function(t){return void 0===t&&(t=!0),this.bloomEnable=t,this.chromaticEnable=t,this.vignetteEnable=t,this.noiseEnable=t,this.vhsEnable=t,this.scanlinesEnable=t,this.crtEnable=t,this}};Object.assign(C,T,k,A,O,M,P,I);const B=Phaser.Game;var D=function(t){return t instanceof B};const R=Phaser.Scene;var L=function(t){return t instanceof R};const H=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,_=Phaser.Utils.Objects.GetValue;class N extends H{constructor(t){super({name:"rexHorrifiPostFx",game:t,renderTarget:!0,fragShader:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n\nuniform float time;\n\n// Scene buffer\nuniform sampler2D uMainSampler; \nvarying vec2 outTexCoord;\n\n// Effect parameters\n#define SAMPLES 32.\n\n// Bloom\nuniform float bloomEnable;\nuniform vec3 bloom;\nuniform vec2 bloomTexel;\n\n// Chromatic abberation\nuniform float chromaticEnable;\nuniform float chabIntensity;\n\n// Vignette\nuniform float vignetteEnable;\nuniform vec2 vignette;\n\n// Noise\nuniform float noiseEnable;\nuniform float noiseStrength;\nuniform float noiseSeed;\n\n// VHS\nuniform float vhsEnable;\nuniform float vhsStrength;\n\n// Scanlines\nuniform float scanlinesEnable;\nuniform float scanStrength;\n\n// CRT\nuniform float crtEnable;\nuniform vec2 crtSize;\n\n\n// Noise\nfloat noise(vec2 uv) {\n return fract(sin(uv.x*12.9898+uv.y*78.233)*437.585453*noiseSeed);\n}\n\n// VHS\nvec4 vhs(vec2 uv) {\n vec2 tcoord = uv;\n tcoord.x += sin(time*noise(uv));\n return texture2D( uMainSampler, tcoord)*vhsStrength;\t\n}\n\n// Vignette\nfloat vig(vec2 uv) {\n uv *= 1. - uv;\n return ( pow(uv.x*uv.y*vignette.x*10.,vignette.y) );\n}\n\n// Chromatic abberation\nvec3 chromatic(vec2 uv, float offset) {\n float r = texture2D( uMainSampler, vec2(uv.x+offset, uv.y)).r;\n float g = texture2D( uMainSampler, uv).g;\n float b = texture2D( uMainSampler, vec2(uv.x-offset, uv.y)).b;\n return vec3(r,g,b);\n}\n\n// Bloom\nvec4 blur(vec2 uv) {\n float total = 0.;\n float rad = 1.;\n mat2 ang = mat2(.73736882209777832,-.67549037933349609,.67549037933349609,.73736882209777832);\n vec2 point = normalize(fract(cos(uv*mat2(195,174,286,183))*742.)-.5)*(bloom.x/sqrt(SAMPLES));\n vec4 amount = vec4(0);\n\t\n for ( float i=0.; i .5 ) {\n mainUv = crtCurve(outTexCoord);\n }\n\t\n // Base coloring\n vec4 color = texture2D( uMainSampler, mainUv);\n\t\n // Chromatic abberation\n if ( chromaticEnable > .5 ) {\n color.rgb *= chromatic(mainUv, chabIntensity * 0.01);\n }\n\t\n // Scanlines\n if ( scanlinesEnable > .5 ) {\n color.rgb *= (1.-scanStrength)+(sin(mainUv.y*1024.)*scanStrength);\n }\n\n // Bloom\n if ( bloomEnable > .5 ) {\n color.rgb += blur(mainUv).rgb;\n }\n\t\n // Noise\n if ( noiseEnable > .5 ) {\n color.rgb += noise(mainUv)*noiseStrength;\n }\n\t\n // VHS\n if ( vhsEnable > .5 ) {\n color += vhs(mainUv);\n }\n\t\n // Vignette\n if ( vignetteEnable > .5) {\n color.rgb *= vig(mainUv);\n }\n\t\n // Cutoff edges\n if ( crtEnable > .5) {\n if ( (mainUv.x < 0.)|| (mainUv.y < 0.) || (mainUv.x > 1.)|| (mainUv.y > 1.) ) {\n color.rgb *= 0.;\n }\n }\n\t\n gl_FragColor = color;\n}\n"}),this.now=0,this.bloomEnable=!1,this.bloomRadius=0,this.bloomIntensity=0,this.bloomThreshold=0,this.bloomTexelWidth=0,this.bloomTexelHeight=0,this.chromaticEnable=!1,this.chabIntensity=0,this.vignetteEnable=!1,this.vignetteStrength=0,this.vignetteIntensity=0,this.noiseEnable=!1,this.noiseStrength=0,this.noiseSeed=Math.random(),this.vhsEnable=!1,this.vhsStrength=0,this.scanlinesEnable=!1,this.scanStrength=0,this.crtEnable=!1,this.crtWidth=0,this.crtHeight=0}resetFromJSON(t){var e=_(t,"enable",!1);return this.setBloomEnable(_(t,"bloomEnable",e)),this.setBloomRadius(_(t,"bloomRadius",0)),this.setBloomIntensity(_(t,"bloomIntensity",0)),this.setBloomThreshold(_(t,"bloomThreshold",0)),this.setBloomTexelSize(_(t,"bloomTexelWidth",0),_(t,"bloomTexelHeight")),this.setChromaticEnable(_(t,"chromaticEnable",e)),this.setChabIntensity(_(t,"chabIntensity",0)),this.setVignetteEnable(_(t,"vignetteEnable",e)),this.setVignetteStrength(_(t,"vignetteStrength",0)),this.setVignetteIntensity(_(t,"vignetteIntensity",0)),this.setNoiseEnable(_(t,"noiseEnable",e)),this.setNoiseStrength(_(t,"noiseStrength",0)),this.setNoiseSeed(_(0,"noiseSeed",Math.random())),this.setVHSEnable(_(t,"vhsEnable",e)),this.setVhsStrength(_(t,"vhsStrength",0)),this.setScanlinesEnable(_(t,"scanlinesEnable",e)),this.setScanStrength(_(t,"scanStrength",0)),this.setCRTEnable(_(t,"crtEnable",e)),this.setCrtSize(_(t,"crtWidth",0),_(t,"crtHeight",void 0)),this}onPreRender(){var t,e;this.set1f("noiseSeed",this.noiseSeed),this.set1f("bloomEnable",this.bloomEnable?1:0),this.set3f("bloom",this.bloomRadius,this.bloomIntensity,this.bloomThreshold),this.set2f("bloomTexel",this.bloomTexelWidth,this.bloomTexelHeight),this.set1f("chromaticEnable",this.chromaticEnable?1:0),this.set1f("chabIntensity",this.chabIntensity),this.set1f("vignetteEnable",this.vignetteEnable?1:0),this.set2f("vignette",this.vignetteStrength,this.vignetteIntensity),this.set1f("noiseEnable",this.noiseEnable?1:0),this.set1f("noiseStrength",this.noiseStrength),this.set1f("vhsEnable",this.vhsEnable?1:0),this.set1f("vhsStrength",this.vhsStrength),this.set1f("scanlinesEnable",this.scanlinesEnable?1:0),this.set1f("scanStrength",this.scanStrength),this.set1f("crtEnable",this.crtEnable?1:0),this.set2f("crtSize",this.crtWidth,this.crtHeight),this.vhsEnable&&(this.now+=(t=this.game,(e=t,null==e||"object"!=typeof e?null:D(e)?e:D(e.game)?e.game:L(e)?e.sys.game:L(e.scene)?e.scene.sys.game:void 0).loop.delta)),this.set1f("time",this.now)}}Object.assign(N.prototype,C);class F extends Phaser.Scene{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null}init(t){this.name=t.name,this.number=t.number}create(){this.backgroundColors=[11411474,9837584,5247498,4198922,3150346,3084810,0],this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(this.backgroundColors[this.number]),this.addLight(),this.createMap(),this.smokeLayer=this.add.layer(),this.addPlayer(),this.addOxygen(),this.cameras.main.startFollow(this.player,!0,.05,.05,0,0),this.loadAudios(),this.addEffects(),this.playMusic()}addOxygen(){this.oxygenBar=this.add.rectangle(this.center_width,40,1.8*this.player.oxygen,20,7017483).setOrigin(.5).setScrollFactor(0)}addEffects(){this.cameras.main.setPostPipeline(N)}addDay(){this.dayText=this.add.bitmapText(20,10,"pico","Day "+(this.number+1),20).setTint(7017483).setOrigin(0).setScrollFactor(0).setDropShadow(0,2,7024682,.9)}addLight(){this.lights.disable(),this.lights.setAmbientColor(11411474),this.playerLight=this.lights.addLight(0,100,100).setColor(16777215).setIntensity(3)}createMap(){this.tileMap=this.make.tilemap({key:"scene"+this.number,tileWidth:64,tileHeight:64}),this.tileSetBg=this.tileMap.addTilesetImage("mars"),this.tileSet=this.tileMap.addTilesetImage("mars"),this.platform=this.tileMap.createLayer("scene"+this.number,this.tileSet),this.border=this.tileMap.createLayer("border",this.tileSet),this.objectsLayer=this.tileMap.getObjectLayer("objects"),this.border.setCollisionByExclusion([-1]),this.platform.setCollisionByExclusion([-1]),this.holes=this.add.group(),this.foes=this.add.group(),this.objects=this.add.group(),this.createGrid(),this.addObjects()}addObjects(){this.objectsLayer.objects.forEach((t=>{if(t.name.startsWith("object")){const[e,s,i,n]=t.name.split(":");this.objects.add(new p(this,t.x,t.y,s,i,n))}t.name.startsWith("drone")&&this.foes.add(new E(this,t.x,t.y,this.grid))}))}createGrid(){this.grid=[],Array(40).fill(0).forEach(((t,e)=>{this.grid[e]=[],Array(40).fill(0).forEach(((t,s)=>{let i=this.platform.getTileAt(Math.floor(s),Math.floor(e)),n=this.border.getTileAt(Math.floor(s),Math.floor(e));this.grid[e][s]=i||n?1:0}))}))}addPlayer(){this.trailLayer=this.add.layer();const t=this.objectsLayer.objects.find((t=>"player"===t.name));this.player=new d(this,t.x,t.y),this.physics.add.collider(this.player,this.platform,this.hitFloor,(()=>!0),this),this.physics.add.overlap(this.player,this.objects,this.touchObject,(()=>!0),this),this.physics.add.overlap(this.player,this.foes,this.playerHitByFoe,(()=>!0),this),this.physics.add.overlap(this.player,this.holes,this.playerHitHole,(()=>!0),this)}hitFloor(t,e){}touchObject(t,e){"hole"===e.type&&this.playTracker(),e.activated||(e.activated=!0,e.touch())}playerHitByFoe(t,e){this.cameras.main.shake(100),this.playAudio("killed"),t.death(),this.restartScene()}playerHitHole(t,e){t.dead||(this.playAudio("holeshout"),e.setAlpha(1),t.setAlpha(0),this.cameras.main.shake(50),t.death(),this.restartScene())}loadAudios(){this.audios={mars_background:this.sound.add("mars_background"),step:this.sound.add("step"),kill:this.sound.add("kill"),blip:this.sound.add("blip"),ohmygod:this.sound.add("ohmygod"),holeshout:this.sound.add("holeshout"),oxygen:this.sound.add("oxygen"),shock:this.sound.add("shock"),killed:this.sound.add("killed")},this.tracker=this.sound.add("tracker")}playTracker(){this.tracker.isPlaying||this.tracker.play()}playRandomStatic(){const t=this.number<6?"static"+Phaser.Math.Between(0,3):"creepy_static";this.sound.add(t).play({rate:Phaser.Math.Between(9,11)/10,delay:0,volume:Phaser.Math.Between(5,10)/10})}playAudio(t){this.audios[t].play()}playRandom(t,e=1){this.audios[t].play({rate:Phaser.Math.Between(.9,1),detune:Phaser.Math.Between(-500,500),delay:0,volume:e})}playOfficer(){this.sound.add(`officer${this.number}`).play()}playMusic(){const t=this.number<6?"mars_background":"cave";this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:1.5,rate:1,detune:0,seek:0,loop:!0,delay:0}),this.sound.add("creepy").play({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!0,delay:0}),this.breathing=this.sound.add("breath"),this.breath(.2)}breath(t=.2,e=.4){const s=Phaser.Math.Between(500,1e3);this.tweens.add({targets:this.breathing,volume:0,duration:s,onComplete:()=>{this.breathing.play({rate:t,volume:e})}})}restartScene(){const t=this.cameras.main.worldView.centerX,e=this.cameras.main.worldView.centerY;this.fadeBlack=this.add.rectangle(t-100,e-50,1e4,11e3,0).setOrigin(.5),this.failure=this.add.bitmapText(t,e,"pico","FAILURE",40).setTint(7017483).setOrigin(.5).setDropShadow(0,2,7024682,.9),this.tweens.add({targets:[this.failure,this.fadeBlack],alpha:{from:0,to:1},duration:2e3}),this.time.delayedCall(3e3,(()=>{this.sound.stopAll(),this.scene.start("transition",{number:this.number})}),null,this)}finishScene(t=!0){const e=this.cameras.main.worldView.centerX,s=this.cameras.main.worldView.centerY;this.fadeBlack=this.add.rectangle(e-100,s-50,2e3,2e3,0).setOrigin(.5),this.tweens.add({targets:[this.fadeBlack],alpha:{from:0,to:1},duration:3e3}),this.player.dead=!0,this.player.body.stop(),this.mute&&this.sound.add("blip").play(),this.time.delayedCall(3e3,(()=>{this.mute&&this.sound.stopAll(),this.scene.start("transition",{next:"underwater",name:"STAGE",number:this.number+1})}),null,this)}updateOxygen(){this.oxygenBar.width=1.8*this.player.oxygen}skipThis(){this.player.dead=!0,this.player.body.stop(),this.theme.stop(),this.scene.start("transition",{number:this.number+1})}}const G={width:800,height:800,scale:{mode:s.Scale.FIT,autoCenter:s.Scale.CENTER_BOTH},autoRound:!1,parent:"contenedor",physics:{default:"arcade",arcade:{gravity:{y:300},debug:!1}},scene:[i,o,r,F,a]};new s.Game(G); +import { g as e, P as s, c as t } from "./phaser-X8YdoW2c.js"; +!(function () { + const t = document.createElement("link").relList; + if (!(t && t.supports && t.supports("modulepreload"))) { + for (const t of document.querySelectorAll('link[rel="modulepreload"]')) + e(t); + new MutationObserver((t) => { + for (const s of t) + if ("childList" === s.type) + for (const t of s.addedNodes) + "LINK" === t.tagName && "modulepreload" === t.rel && e(t); + }).observe(document, { childList: !0, subtree: !0 }); + } + function e(t) { + if (t.ep) return; + t.ep = !0; + const e = (function (t) { + const e = {}; + return ( + t.integrity && (e.integrity = t.integrity), + t.referrerPolicy && (e.referrerPolicy = t.referrerPolicy), + "use-credentials" === t.crossOrigin + ? (e.credentials = "include") + : "anonymous" === t.crossOrigin + ? (e.credentials = "omit") + : (e.credentials = "same-origin"), + e + ); + })(t); + fetch(t.href, e); + } +})(); +class i extends Phaser.Scene { + constructor() { + super({ key: "bootloader" }); + } + preload() { + this.createBars(), + this.setLoadEvents(), + this.loadFonts(), + this.loadImages(), + this.loadMaps(), + this.loadAudios(), + this.loadSpritesheets(), + this.setRegistry(); + } + setLoadEvents() { + this.load.on( + "progress", + function (t) { + this.progressBar.clear(), + this.progressBar.fillStyle(11411474, 1), + this.progressBar.fillRect( + this.cameras.main.width / 4, + this.cameras.main.height / 2 - 16, + (this.cameras.main.width / 2) * t, + 16 + ); + }, + this + ), + this.load.on( + "complete", + () => { + this.scene.start("splash"); + }, + this + ); + } + loadFonts() { + this.load.bitmapFont( + "pico", + "assets/fonts/pico.png", + "assets/fonts/pico.xml" + ); + } + loadImages() { + this.load.image("body", "assets/images/body.png"), + this.load.image("landscape", "assets/images/landscape.png"), + this.load.image("record", "assets/images/record.png"), + this.load.image("hole", "assets/images/hole.png"), + this.load.image("pello", "assets/images/pello_ok.png"), + this.load.image("mars", "assets/maps/mars64.png"), + this.load.image("background", "assets/maps/mars.png"); + } + loadMaps() { + Array(7) + .fill(0) + .forEach((t, e) => { + this.load.tilemapTiledJSON(`scene${e}`, `assets/maps/scene${e}.json`); + }); + } + loadAudios() { + this.load.audio("mars_background", "assets/sounds/mars_background.mp3"), + this.load.audio("step", "assets/sounds/step.mp3"), + this.load.audio("creepy", "assets/sounds/creepy.mp3"), + this.load.audio("heartbeat", "assets/sounds/heartbeat.mp3"), + this.load.audio("breath", "assets/sounds/breath.mp3"), + this.load.audio("blip", "assets/sounds/blip.mp3"), + this.load.audio("ohmygod", "assets/sounds/ohmygod.mp3"), + this.load.audio("kill", "assets/sounds/kill.mp3"), + this.load.audio("tracker", "assets/sounds/tracker.mp3"), + this.load.audio("holeshout", "assets/sounds/holeshout.mp3"), + this.load.audio("oxygen", "assets/sounds/oxygen.mp3"), + this.load.audio("monster", "assets/sounds/monster.mp3"), + this.load.audio("killed", "assets/sounds/killed.mp3"), + this.load.audio("creepy_static", "assets/sounds/creepy_static.mp3"), + this.load.audio("shock", "assets/sounds/shock.mp3"), + this.load.audio("cave", "assets/sounds/cave.mp3"), + this.load.audio("type", "assets/sounds/type.mp3"), + Array(4) + .fill(0) + .forEach((t, e) => { + this.load.audio(`static${e}`, `assets/sounds/static${e}.mp3`); + }), + Array(6) + .fill(0) + .forEach((t, e) => { + this.load.audio( + `diary${e + 1}`, + `assets/sounds/diary/diary${e + 1}.mp3` + ); + }), + Array(6) + .fill(0) + .forEach((t, e) => { + this.load.audio( + `officer${e + 1}`, + `assets/sounds/officer/officer${e + 1}.mp3` + ); + }); + } + loadSpritesheets() { + this.load.spritesheet("player", "assets/images/player.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("debris", "assets/images/debris.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("step", "assets/images/step.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("wave", "assets/images/wave.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("drone", "assets/images/drone.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("monster", "assets/images/monster.png", { + frameWidth: 128, + frameHeight: 64, + }); + } + setRegistry() { + this.registry.set("score", 0); + } + createBars() { + (this.loadBar = this.add.graphics()), + this.loadBar.fillStyle(7017483, 1), + this.loadBar.fillRect( + this.cameras.main.width / 4 - 2, + this.cameras.main.height / 2 - 18, + this.cameras.main.width / 2 + 4, + 20 + ), + (this.progressBar = this.add.graphics()); + } +} +class n { + constructor(t) { + this.scene = t; + } + typeText(t, e, s, i = 150, n = 450954, a = 40) { + let h = [], + o = 0, + r = 0; + t.split("").forEach((t, l) => { + "\n" === t && ((o += 2), (r = 0)), + h.push( + this.scene.add + .bitmapText(s - 350 + 25 * r++, i + o * a, e, t, a) + .setTint(n) + .setAlpha(0) + ); + }); + const l = this.scene.add + .rectangle(s - 335 + 25 * r, i + 25 + o * a, 25, 5, n) + .setOrigin(0.5) + .setAlpha(0), + d = this.scene.tweens.timeline(); + return ( + (this.typeAudio = this.scene.sound.add("type")), + h.forEach((t, e) => { + d.add({ targets: t, alpha: { from: 0, to: 0.5 }, duration: 100 }); + }), + d.add({ + targets: l, + alpha: { from: 0, to: 0.8 }, + duration: 100, + repeat: 5, + yoyo: !0, + onStart: () => { + this.typeAudio.stop(); + }, + }), + this.typeAudio.play({ + mute: !1, + volume: 1, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }), + d.play(), + h.push(l), + h + ); + } + removeTyped(t) { + t.flat().forEach((t) => t.destroy()); + } +} +class a extends Phaser.Scene { + constructor() { + super({ key: "outro" }); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + (this.introLayer = this.add.layer()), + (this.splashLayer = this.add.layer()), + this.add.tileSprite(0, 0, 800, 600, "landscape").setOrigin(0), + (this.utils = new n(this)), + (this.title = this.add + .bitmapText( + this.center_width, + this.center_height + 100, + "pico", + "MARSTRANDED", + 60 + ) + .setTint(7017483) + .setAlpha(0) + .setDropShadow(0, 4, 7024682, 0.9) + .setOrigin(0.5)), + this.tweens.add({ + targets: this.title, + alpha: { from: 0, to: 1 }, + duration: 4e3, + }), + this.input.keyboard.on("keydown-SPACE", this.startSplash, this), + this.input.keyboard.on("keydown-ENTER", this.startSplash, this); + } + playMusic(t = "mars_background") { + (this.theme = this.sound.add(t)), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 1.5, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } + startSplash() { + this.sound.stopAll(), this.scene.start("splash"); + } +} +class h extends Phaser.GameObjects.Rectangle { + constructor(t, e, s, i, n, a = 16771755) { + super( + t, + (e += Phaser.Math.Between(-30, 30)), + (s += Phaser.Math.Between(-30, 30)), + Phaser.Math.Between(30, 55), + Phaser.Math.Between(30, 55), + a + ), + t.add.existing(this), + t.physics.add.existing(this), + this.body.setAllowGravity(!1), + this.body.setVelocityX(100 * i), + this.body.setVelocityY(100 * n), + this.init(); + } + init() { + this.scene.tweens.add({ + targets: this, + duration: 800, + scale: { from: 1, to: 0 }, + onComplete: () => { + this.destroy(); + }, + }); + } +} +class o extends Phaser.Scene { + constructor() { + super({ key: "splash" }); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.cameras.main.setBackgroundColor(0), + (this.smokeLayer = this.add.layer()), + this.showTitle(), + this.time.delayedCall(1e3, () => this.showInstructions(), null, this), + this.input.keyboard.on("keydown-SPACE", () => this.startGame(), this), + this.playMusic(); + } + showTitle() { + (this.step = this.sound.add("step")), + "MARSTRANDED".split("").forEach((t, e) => { + this.time.delayedCall( + 600 * (e + 1), + () => { + this.add + .bitmapText(70 * e + 50, 200, "pico", t, 70) + .setTint(7017483) + .setOrigin(0.5) + .setDropShadow(0, 4, 7024682, 0.9), + Array(Phaser.Math.Between(2, 4)) + .fill(0) + .forEach((t) => { + this.smokeLayer.add( + new h( + this, + 70 * e + 80 + Phaser.Math.Between(-30, 30), + 200 + Phaser.Math.Between(-30, 30), + 0, + -1, + 7024682 + ) + ); + }), + this.step.play({ rate: 0.8 }), + this.step.resume(); + }, + null, + this + ); + }); + } + startGame() { + this.theme && this.theme.stop(), + this.sound.add("blip").play(), + this.scene.start("transition", { + next: "game", + name: "STAGE", + number: 0, + time: 30, + }); + } + playMusic(t = "mars_background") { + (this.theme = this.sound.add(t)), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 2, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } + showInstructions() { + this.add + .bitmapText(this.center_width, 450, "pico", "WASD/Arrows", 40) + .setTint(7017483) + .setOrigin(0.5) + .setDropShadow(0, 3, 7024682, 0.9), + this.add + .sprite(this.center_width - 140, 355, "pello") + .setOrigin(0.5) + .setScale(0.5), + this.add + .bitmapText(this.center_width + 60, 350, "pico", "By PELLO", 35) + .setTint(7017483) + .setOrigin(0.5) + .setDropShadow(0, 3, 7024682, 0.9), + (this.space = this.add + .bitmapText(this.center_width, 520, "pico", "SPACE start", 30) + .setTint(7017483) + .setOrigin(0.5) + .setDropShadow(0, 2, 7024682, 0.9)), + this.tweens.add({ + targets: this.space, + duration: 300, + alpha: { from: 0, to: 1 }, + repeat: -1, + yoyo: !0, + }); + } +} +class r extends Phaser.Scene { + constructor() { + super({ key: "transition" }); + } + init(t) { + this.number = t.number; + } + create() { + (this.missions = [ + "", + "Go north, locate containers.", + "Find landing zone. North East.", + "Locate landing, South East.", + "Go East, locate containers.", + "Other landings: North East", + "Find out ship origin...", + ]), + (this.utils = new n(this)), + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.add.tileSprite(0, 0, 800, 600, "landscape").setOrigin(0), + 7 === this.number + ? this.scene.start("outro", { number: this.number }) + : this.sound.stopAll(), + this.showInstructions(), + this.input.keyboard.on("keydown-ENTER", () => this.loadNext(), this), + this.input.keyboard.on("keydown-SPACE", () => this.loadNext(), this); + } + showInstructions() { + const t = Array(8) + .fill(0) + .map((t, e) => `DAY ${e}`); + (this.text1 = this.add + .bitmapText(this.center_width, 20, "pico", t[this.number], 30) + .setOrigin(0.5) + .setAlpha(0)), + (this.text2 = this.add + .bitmapText( + this.center_width, + 70, + "pico", + "AUDIO RECORD OF CAPTAIN BRAUN", + 20 + ) + .setOrigin(0.5) + .setAlpha(0)), + this.number > 0 + ? this.showSceneInstructions() + : this.showFirstInstructions(); + } + showSceneInstructions() { + this.tweens.add({ + targets: [this.text1, this.text2, this.play], + duration: 1e3, + alpha: { from: 0, to: 1 }, + onComplete: () => { + this.playDiary(); + }, + }); + } + showFirstInstructions() { + this.playBackground(), + (this.text2 = this.add + .bitmapText(this.center_width, 70, "pico", "THE CRASH", 20) + .setOrigin(0.5) + .setAlpha(0)), + this.playCreepy(), + this.tweens.add({ + targets: [this.text1], + duration: 2e3, + alpha: { from: 0, to: 1 }, + onComplete: () => { + this.playIntro(); + }, + }); + } + playIntro() { + this.utils.typeText( + "YOU JUST CRASHED ON MARS\nYOU ARE ALIVE BUT YOUR\nSHIP IS COMPLETELY LOST\nIF YOU WANT TO LIVE YOU\nMUST FIND LANDING REMAINS\nTRY GOING EAST...", + "pico", + this.center_width, + 150, + 16777215, + 20 + ); + } + playBackground() { + (this.theme = this.sound.add("mars_background")), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 1, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } + playDiary() { + (this.wave = this.add + .sprite(this.center_width, 200, "wave") + .setOrigin(0.5)), + this.anims.create({ + key: "wave", + frames: this.anims.generateFrameNumbers("wave", { start: 0, end: 4 }), + frameRate: 20, + repeat: -1, + }), + this.wave.anims.play("wave", !0), + (this.recording = this.sound.add(`diary${this.number}`)), + this.recording.on( + "complete", + function () { + this.wave.destroy(), this.showMission(), this.playCreepy(); + }.bind(this) + ), + this.recording.play(); + } + playCreepy() { + (this.creepy = this.sound.add("creepy")), + this.creepy.play({ + mute: !1, + volume: 0.9, + rate: 0.9, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } + showMission() { + (this.text3 = this.add + .bitmapText(this.center_width, 300, "pico", "MISSION OBJECTIVE:", 30) + .setOrigin(0.5)), + this.utils.typeText( + this.missions[this.number], + "pico", + this.center_width, + 400, + 16777215, + 20 + ); + } + loadNext() { + this.sound.add("blip").play(), + this.sound.stopAll(), + this.scene.start("game", { number: this.number }); + } +} +class l extends Phaser.GameObjects.Sprite { + constructor(t, e, s, i = "step") { + super(t, e, s, "step", Phaser.Math.Between(0, 3)), + t.add.existing(this), + this.setOrigin(0), + t.tweens.add({ + targets: [this], + duration: 2e3, + alpha: { from: 1, to: 0.1 }, + }); + } +} +class d extends Phaser.GameObjects.Sprite { + constructor(t, e, s, i = 100) { + super(t, e, s, "player"), + this.setOrigin(0), + this.setScale(1), + this.scene.add.existing(this), + this.scene.physics.add.existing(this), + this.body.setAllowGravity(!1), + (this.dead = !1), + this.init(), + (this.shells = 0), + (this.lastDirection = 0), + (this.steps = 0), + (this.stepDelta = 0), + (this.moveDelta = 0), + (this.rate = 0.2), + (this.previousRate = 0.2), + (this.oxygen = i), + (this.locked = !1); + } + init() { + this.addControls(), this.scene.events.on("update", this.update, this); + } + addControls() { + (this.cursor = this.scene.input.keyboard.createCursorKeys()), + (this.W = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.W + )), + (this.A = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.A + )), + (this.S = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.S + )), + (this.D = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.D + )); + } + update(t, e) { + if (!this.dead && !this.locked) { + if ( + ((this.stepDelta += e), + (this.moveDelta += e), + (Phaser.Input.Keyboard.JustDown(this.W) || + Phaser.Input.Keyboard.JustDown(this.cursor.up)) && + this.canMoveUp()) + ) { + this.moveDelta = 0; + const { x: t, y: e } = this; + (this.locked = !0), + this.scene.tweens.add({ + targets: this, + y: "-=64", + duration: 200, + onComplete: () => { + this.locked = !1; + }, + }), + this.step(t, e); + } else if ( + (Phaser.Input.Keyboard.JustDown(this.D) || + Phaser.Input.Keyboard.JustDown(this.cursor.right)) && + this.canMoveRight() + ) { + this.moveDelta = 0; + const { x: t, y: e } = this; + (this.locked = !0), + this.scene.tweens.add({ + targets: this, + x: "+=64", + duration: 200, + onComplete: () => { + this.locked = !1; + }, + }), + this.step(t, e); + } else if ( + (Phaser.Input.Keyboard.JustDown(this.A) || + Phaser.Input.Keyboard.JustDown(this.cursor.left)) && + this.canMoveLeft() + ) { + this.moveDelta = 0; + const { x: t, y: e } = this; + (this.locked = !0), + this.scene.tweens.add({ + targets: this, + x: "-=64", + duration: 200, + onComplete: () => { + this.locked = !1; + }, + }), + this.step(t, e); + } else if ( + (Phaser.Input.Keyboard.JustDown(this.S) || + Phaser.Input.Keyboard.JustDown(this.cursor.down)) && + this.canMoveDown() + ) { + this.moveDelta = 0; + const { x: t, y: e } = this; + (this.locked = !0), + this.scene.tweens.add({ + targets: this, + y: "+=64", + duration: 200, + onComplete: () => { + this.locked = !1; + }, + }), + this.step(t, e); + } + this.adaptBreath(); + } + } + canMoveUp() { + return ( + !this.scene.platform.getTileAtWorldXY(this.x, this.y - 1) && + this.moveDelta > 200 + ); + } + canMoveRight() { + return ( + !this.scene.platform.getTileAtWorldXY(this.x + 64, this.y) && + this.moveDelta > 200 + ); + } + canMoveDown() { + return ( + !this.scene.platform.getTileAtWorldXY(this.x, this.y + 64) && + this.moveDelta > 200 + ); + } + canMoveLeft() { + return ( + !this.scene.platform.getTileAtWorldXY(this.x - 1, this.y) && + this.moveDelta > 200 + ); + } + step(t, e) { + this.steps++, + this.scene.smokeLayer.add(new l(this.scene, t, e)), + this.scene.playRandom("step", 1); + } + adaptBreath() { + this.stepDelta > 2e3 && + (this.steps > 2 + ? ((this.previousRate = this.rate), + (this.rate = this.steps < 11 ? this.steps / 10 : 1), + this.scene.breath(this.rate), + this.updateOxygen(this.steps + Math.round(this.steps / 2))) + : this.rate !== this.previousRate + ? ((this.previousRate = this.rate), + (this.rate = this.rate > 0.2 ? this.rate - 0.1 : 0.2), + this.scene.breath(this.rate), + this.scene.updateOxygen(this.steps)) + : this.scene.updateOxygen(this.steps), + (this.steps = this.stepDelta = 0)); + } + updateOxygen(t) { + t >= this.oxygen ? ((this.oxygen = 0), this.death()) : (this.oxygen -= t), + this.scene.updateOxygen(); + } + death() { + (this.dead = !0), + this.body.stop(), + (this.body.enable = !1), + this.scene.restartScene(); + } +} +class c extends Phaser.GameObjects.Sprite { + constructor(t, e, s) { + super(t, e, s, "hole"), + (this.name = "hole"), + this.setOrigin(0), + this.setAlpha(0), + t.add.existing(this), + t.physics.add.existing(this), + this.body.setAllowGravity(!1); + } +} +class u extends Phaser.GameObjects.Sprite { + constructor(t, e, s) { + super(t, e, s, "body"), + (this.name = "body"), + this.setOrigin(0), + (this.rotation = 1.6), + t.add.existing(this); + } +} +let p = class extends Phaser.GameObjects.Rectangle { + constructor(t, e, s, i, n, a = "") { + super(t, e, s, 192, 192), + this.setOrigin(0), + (this.type = i), + (this.description = n), + (this.extra = a), + t.add.existing(this), + t.physics.add.existing(this), + this.body.setAllowGravity(!1), + (this.activated = !1); + } + touch() { + switch (this.type) { + case "note": + this.showNote(this.description); + break; + case "radio": + this.useRadio(); + break; + case "exit": + this.exitScene(); + break; + case "hole": + this.activateHole(); + break; + case "oxygen": + this.useOxygen(); + break; + case "braun": + this.activateBraun(); + break; + case "ending": + this.revealEnding(); + } + } + showNote(t) { + const e = this.scene.add.bitmapText(this.x, this.y, "pico", t, 15); + this.scene.tweens.add({ + targets: e, + alpha: { from: 1, to: 0 }, + duration: 6e3, + ease: "Sine", + onComplete: () => { + e.destroy(); + }, + }); + } + showExit(t) { + const e = this.scene.add.bitmapText( + this.x - 128, + this.y - 64, + "pico", + t, + 25 + ); + this.scene.tweens.add({ + targets: e, + alpha: { from: 0.8, to: 1 }, + duration: 100, + repeat: 5, + }); + } + useRadio() { + (this.officerAudio = this.scene.sound.add(this.description)), + this.officerAudio.play(), + this.officerAudio.on( + "complete", + function () { + this.scene.playRandomStatic(), + this.extra && this.scene.sound.add(this.extra).play(); + }.bind(this) + ); + } + exitScene() { + this.showExit(this.description), + this.showNote(this.extra), + this.scene.finishScene(); + } + useOxygen() { + this.showNote("Oxygen supplies!"), + (this.scene.player.oxygen = 100), + this.scene.updateOxygen(), + this.scene.playAudio("oxygen"); + } + revealEnding() { + const t = this.scene.sound.add("ohmygod"); + t.play(), + this.scene.cameras.main.shake(1e4), + this.showExit(this.description), + this.scene.sound.add("monster").play({ volume: 1.5, rate: 0.8 }); + const e = this.scene.add + .sprite(this.x + 128, this.y + 128, "monster") + .setOrigin(0.5); + this.scene.anims.create({ + key: "monster", + frames: this.scene.anims.generateFrameNumbers("monster", { + start: 0, + end: 5, + }), + frameRate: 3, + }), + e.anims.play("monster", !0), + t.on( + "complete", + function () { + this.scene.breathing.pause(), + this.scene.playAudio("holeshout"), + this.scene.finishScene(!1); + }.bind(this) + ); + } + activateHole() { + this.scene.holes.add(new c(this.scene, this.x + 64, this.y + 64)); + } + activateBraun() { + this.showExit(this.description), + this.scene.playAudio("shock"), + new u(this.scene, this.x + 128, this.y + 64); + } +}; +var m, + y = { exports: {} }; +(m = y), + function () { + var t, e, s, i, n, a, h, o, r, l, d, c, u, p, y; + (s = Math.floor), + (l = Math.min), + (e = function (t, e) { + return t < e ? -1 : t > e ? 1 : 0; + }), + (r = function (t, i, n, a, h) { + var o; + if ((null == n && (n = 0), null == h && (h = e), n < 0)) + throw new Error("lo must be non-negative"); + for (null == a && (a = t.length); n < a; ) + h(i, t[(o = s((n + a) / 2))]) < 0 ? (a = o) : (n = o + 1); + return [].splice.apply(t, [n, n - n].concat(i)), i; + }), + (a = function (t, s, i) { + return null == i && (i = e), t.push(s), p(t, 0, t.length - 1, i); + }), + (n = function (t, s) { + var i, n; + return ( + null == s && (s = e), + (i = t.pop()), + t.length ? ((n = t[0]), (t[0] = i), y(t, 0, s)) : (n = i), + n + ); + }), + (o = function (t, s, i) { + var n; + return null == i && (i = e), (n = t[0]), (t[0] = s), y(t, 0, i), n; + }), + (h = function (t, s, i) { + var n; + return ( + null == i && (i = e), + t.length && + i(t[0], s) < 0 && + ((s = (n = [t[0], s])[0]), (t[0] = n[1]), y(t, 0, i)), + s + ); + }), + (i = function (t, i) { + var n, a, h, o, r, l; + for ( + null == i && (i = e), + r = [], + a = 0, + h = (o = function () { + l = []; + for ( + var e = 0, i = s(t.length / 2); + 0 <= i ? e < i : e > i; + 0 <= i ? e++ : e-- + ) + l.push(e); + return l; + } + .apply(this) + .reverse()).length; + a < h; + a++ + ) + (n = o[a]), r.push(y(t, n, i)); + return r; + }), + (u = function (t, s, i) { + var n; + if ((null == i && (i = e), -1 !== (n = t.indexOf(s)))) + return p(t, 0, n, i), y(t, n, i); + }), + (d = function (t, s, n) { + var a, o, r, l, d; + if ((null == n && (n = e), !(o = t.slice(0, s)).length)) return o; + for (i(o, n), r = 0, l = (d = t.slice(s)).length; r < l; r++) + (a = d[r]), h(o, a, n); + return o.sort(n).reverse(); + }), + (c = function (t, s, a) { + var h, o, d, c, u, p, m, y, g; + if ((null == a && (a = e), 10 * s <= t.length)) { + if (!(d = t.slice(0, s).sort(a)).length) return d; + for ( + o = d[d.length - 1], c = 0, p = (m = t.slice(s)).length; + c < p; + c++ + ) + a((h = m[c]), o) < 0 && + (r(d, h, 0, null, a), d.pop(), (o = d[d.length - 1])); + return d; + } + for ( + i(t, a), g = [], u = 0, y = l(s, t.length); + 0 <= y ? u < y : u > y; + 0 <= y ? ++u : --u + ) + g.push(n(t, a)); + return g; + }), + (p = function (t, s, i, n) { + var a, h, o; + for ( + null == n && (n = e), a = t[i]; + i > s && n(a, (h = t[(o = (i - 1) >> 1)])) < 0; + + ) + (t[i] = h), (i = o); + return (t[i] = a); + }), + (y = function (t, s, i) { + var n, a, h, o, r; + for ( + null == i && (i = e), a = t.length, r = s, h = t[s], n = 2 * s + 1; + n < a; + + ) + (o = n + 1) < a && !(i(t[n], t[o]) < 0) && (n = o), + (t[s] = t[n]), + (n = 2 * (s = n) + 1); + return (t[s] = h), p(t, r, s, i); + }), + (t = (function () { + function t(t) { + (this.cmp = null != t ? t : e), (this.nodes = []); + } + return ( + (t.push = a), + (t.pop = n), + (t.replace = o), + (t.pushpop = h), + (t.heapify = i), + (t.updateItem = u), + (t.nlargest = d), + (t.nsmallest = c), + (t.prototype.push = function (t) { + return a(this.nodes, t, this.cmp); + }), + (t.prototype.pop = function () { + return n(this.nodes, this.cmp); + }), + (t.prototype.peek = function () { + return this.nodes[0]; + }), + (t.prototype.contains = function (t) { + return -1 !== this.nodes.indexOf(t); + }), + (t.prototype.replace = function (t) { + return o(this.nodes, t, this.cmp); + }), + (t.prototype.pushpop = function (t) { + return h(this.nodes, t, this.cmp); + }), + (t.prototype.heapify = function () { + return i(this.nodes, this.cmp); + }), + (t.prototype.updateItem = function (t) { + return u(this.nodes, t, this.cmp); + }), + (t.prototype.clear = function () { + return (this.nodes = []); + }), + (t.prototype.empty = function () { + return 0 === this.nodes.length; + }), + (t.prototype.size = function () { + return this.nodes.length; + }), + (t.prototype.clone = function () { + var e; + return ((e = new t()).nodes = this.nodes.slice(0)), e; + }), + (t.prototype.toArray = function () { + return this.nodes.slice(0); + }), + (t.prototype.insert = t.prototype.push), + (t.prototype.top = t.prototype.peek), + (t.prototype.front = t.prototype.peek), + (t.prototype.has = t.prototype.contains), + (t.prototype.copy = t.prototype.clone), + t + ); + })()), + (m.exports = t); + }.call(t); +var g = {}, + f = function () { + (this.pointsToAvoid = {}), + this.startX, + this.callback, + this.startY, + this.endX, + this.endY, + (this.nodeHash = {}), + this.openList; + }, + b = function (t, e, s, i, n) { + (this.parent = t), + (this.x = e), + (this.y = s), + (this.costSoFar = i), + (this.simpleDistanceToTarget = n), + (this.bestGuessDistance = function () { + return this.costSoFar + this.simpleDistanceToTarget; + }); + }, + v = y.exports, + x = g, + S = 1; +(g.js = function () { + var t, + e, + s, + i = 1.4, + n = !1, + a = {}, + h = {}, + o = {}, + r = {}, + l = !0, + d = {}, + c = [], + u = Number.MAX_VALUE, + p = !1; + (this.setAcceptableTiles = function (t) { + t instanceof Array + ? (s = t) + : !isNaN(parseFloat(t)) && isFinite(t) && (s = [t]); + }), + (this.enableSync = function () { + n = !0; + }), + (this.disableSync = function () { + n = !1; + }), + (this.enableDiagonals = function () { + p = !0; + }), + (this.disableDiagonals = function () { + p = !1; + }), + (this.setGrid = function (e) { + t = e; + for (var s = 0; s < t.length; s++) + for (var i = 0; i < t[0].length; i++) h[t[s][i]] || (h[t[s][i]] = 1); + }), + (this.setTileCost = function (t, e) { + h[t] = e; + }), + (this.setAdditionalPointCost = function (t, e, s) { + void 0 === o[e] && (o[e] = {}), (o[e][t] = s); + }), + (this.removeAdditionalPointCost = function (t, e) { + void 0 !== o[e] && delete o[e][t]; + }), + (this.removeAllAdditionalPointCosts = function () { + o = {}; + }), + (this.setDirectionalCondition = function (t, e, s) { + void 0 === r[e] && (r[e] = {}), (r[e][t] = s); + }), + (this.removeAllDirectionalConditions = function () { + r = {}; + }), + (this.setIterationsPerCalculation = function (t) { + u = t; + }), + (this.avoidAdditionalPoint = function (t, e) { + void 0 === a[e] && (a[e] = {}), (a[e][t] = 1); + }), + (this.stopAvoidingAdditionalPoint = function (t, e) { + void 0 !== a[e] && delete a[e][t]; + }), + (this.enableCornerCutting = function () { + l = !0; + }), + (this.disableCornerCutting = function () { + l = !1; + }), + (this.stopAvoidingAllAdditionalPoints = function () { + a = {}; + }), + (this.findPath = function (e, i, a, h, o) { + var r = function (t) { + n + ? o(t) + : setTimeout(function () { + o(t); + }); + }; + if (void 0 === s) + throw new Error( + "You can't set a path without first calling setAcceptableTiles() on EasyStar." + ); + if (void 0 === t) + throw new Error( + "You can't set a path without first calling setGrid() on EasyStar." + ); + if ( + e < 0 || + i < 0 || + a < 0 || + h < 0 || + e > t[0].length - 1 || + i > t.length - 1 || + a > t[0].length - 1 || + h > t.length - 1 + ) + throw new Error( + "Your start or end point is outside the scope of your grid." + ); + if (e !== a || i !== h) { + for (var l = t[h][a], u = !1, p = 0; p < s.length; p++) + if (l === s[p]) { + u = !0; + break; + } + if (!1 !== u) { + var m = new f(); + (m.openList = new v(function (t, e) { + return t.bestGuessDistance() - e.bestGuessDistance(); + })), + (m.isDoneCalculating = !1), + (m.nodeHash = {}), + (m.startX = e), + (m.startY = i), + (m.endX = a), + (m.endY = h), + (m.callback = r), + m.openList.push(E(m, m.startX, m.startY, null, 1)); + var y = S++; + return (d[y] = m), c.push(y), y; + } + r(null); + } else r([]); + }), + (this.cancelPath = function (t) { + return t in d && (delete d[t], !0); + }), + (this.calculate = function () { + if (0 !== c.length && void 0 !== t && void 0 !== s) + for (e = 0; e < u; e++) { + if (0 === c.length) return; + n && (e = 0); + var a = c[0], + h = d[a]; + if (void 0 !== h) + if (0 !== h.openList.size()) { + var o = h.openList.pop(); + if (h.endX !== o.x || h.endY !== o.y) + (o.list = 0), + o.y > 0 && m(h, o, 0, -1, 1 * w(o.x, o.y - 1)), + o.x < t[0].length - 1 && m(h, o, 1, 0, 1 * w(o.x + 1, o.y)), + o.y < t.length - 1 && m(h, o, 0, 1, 1 * w(o.x, o.y + 1)), + o.x > 0 && m(h, o, -1, 0, 1 * w(o.x - 1, o.y)), + p && + (o.x > 0 && + o.y > 0 && + (l || + (y(t, s, o.x, o.y - 1, o) && + y(t, s, o.x - 1, o.y, o))) && + m(h, o, -1, -1, i * w(o.x - 1, o.y - 1)), + o.x < t[0].length - 1 && + o.y < t.length - 1 && + (l || + (y(t, s, o.x, o.y + 1, o) && + y(t, s, o.x + 1, o.y, o))) && + m(h, o, 1, 1, i * w(o.x + 1, o.y + 1)), + o.x < t[0].length - 1 && + o.y > 0 && + (l || + (y(t, s, o.x, o.y - 1, o) && + y(t, s, o.x + 1, o.y, o))) && + m(h, o, 1, -1, i * w(o.x + 1, o.y - 1)), + o.x > 0 && + o.y < t.length - 1 && + (l || + (y(t, s, o.x, o.y + 1, o) && + y(t, s, o.x - 1, o.y, o))) && + m(h, o, -1, 1, i * w(o.x - 1, o.y + 1))); + else { + var r = []; + r.push({ x: o.x, y: o.y }); + for (var g = o.parent; null != g; ) + r.push({ x: g.x, y: g.y }), (g = g.parent); + r.reverse(); + var f = r; + h.callback(f), delete d[a], c.shift(); + } + } else h.callback(null), delete d[a], c.shift(); + else c.shift(); + } + }); + var m = function (e, i, n, h, o) { + var r = i.x + n, + l = i.y + h; + if ((void 0 === a[l] || void 0 === a[l][r]) && y(t, s, r, l, i)) { + var d = E(e, r, l, i, o); + void 0 === d.list + ? ((d.list = 1), e.openList.push(d)) + : i.costSoFar + o < d.costSoFar && + ((d.costSoFar = i.costSoFar + o), + (d.parent = i), + e.openList.updateItem(d)); + } + }, + y = function (t, e, s, i, n) { + var a = r[i] && r[i][s]; + if (a) { + var h = x(n.x - s, n.y - i); + if ( + !(function () { + for (var t = 0; t < a.length; t++) if (a[t] === h) return !0; + return !1; + })() + ) + return !1; + } + for (var o = 0; o < e.length; o++) if (t[i][s] === e[o]) return !0; + return !1; + }, + x = function (t, e) { + if (0 === t && -1 === e) return g.TOP; + if (1 === t && -1 === e) return g.TOP_RIGHT; + if (1 === t && 0 === e) return g.RIGHT; + if (1 === t && 1 === e) return g.BOTTOM_RIGHT; + if (0 === t && 1 === e) return g.BOTTOM; + if (-1 === t && 1 === e) return g.BOTTOM_LEFT; + if (-1 === t && 0 === e) return g.LEFT; + if (-1 === t && -1 === e) return g.TOP_LEFT; + throw new Error("These differences are not valid: " + t + ", " + e); + }, + w = function (e, s) { + return (o[s] && o[s][e]) || h[t[s][e]]; + }, + E = function (t, e, s, i, n) { + if (void 0 !== t.nodeHash[s]) { + if (void 0 !== t.nodeHash[s][e]) return t.nodeHash[s][e]; + } else t.nodeHash[s] = {}; + var a = T(e, s, t.endX, t.endY); + if (null !== i) var h = i.costSoFar + n; + else h = 0; + var o = new b(i, e, s, h, a); + return (t.nodeHash[s][e] = o), o; + }, + T = function (t, e, s, n) { + var a, h; + return p + ? (a = Math.abs(t - s)) < (h = Math.abs(e - n)) + ? i * a + h + : i * h + a + : (a = Math.abs(t - s)) + (h = Math.abs(e - n)); + }; +}), + (g.TOP = "TOP"), + (g.TOP_RIGHT = "TOP_RIGHT"), + (g.RIGHT = "RIGHT"), + (g.BOTTOM_RIGHT = "BOTTOM_RIGHT"), + (g.BOTTOM = "BOTTOM"), + (g.BOTTOM_LEFT = "BOTTOM_LEFT"), + (g.LEFT = "LEFT"), + (g.TOP_LEFT = "TOP_LEFT"); +const w = e(x); +class E extends Phaser.GameObjects.Sprite { + constructor(t, e, s, i) { + super(t, e, s, "drone"), + (this.name = "drone"), + this.setScale(1), + (this.grid = i), + t.add.existing(this), + t.physics.add.existing(this), + this.body.setAllowGravity(!1), + (this.easystar = new w.js()), + this.init(); + } + init() { + this.easystar.setGrid(this.grid), + this.easystar.setAcceptableTiles([0]), + this.scene.events.on("update", this.update, this), + this.scene.tweens.add({ + targets: this, + duration: 500, + repeat: -1, + scale: { from: 0.95, to: 1 }, + yoyo: !0, + }), + this.scene.anims.create({ + key: this.name, + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 0, + end: 3, + }), + frameRate: 5, + repeat: -1, + }), + this.anims.play(this.name, !0), + (this.flipX = this.direction < 0), + this.scene.time.delayedCall( + Phaser.Math.Between(3e3, 5e3), + () => { + this.scene.playAudio("kill"), this.launchMove(); + }, + null, + this + ); + } + launchMove() { + this.scene && + (this.delayedMove = this.scene.time.addEvent({ + delay: 2e3, + callback: this.move.bind(this), + startAt: 0, + callbackScope: this, + loop: !0, + })); + } + move() { + try { + if (!this.scene.player) return; + this.moveTimeline && this.moveTimeline.destroy(), + this.easystar.findPath( + Math.floor(this.x / 64), + Math.floor(this.y / 64), + Math.floor(this.scene.player.x / 64), + Math.floor(this.scene.player.y / 64), + this.moveIt.bind(this) + ), + this.easystar.setIterationsPerCalculation(1e4), + this.easystar.enableSync(), + this.easystar.calculate(); + } catch (t) { + console.log("Cant move yet: ", t); + } + } + moveIt(t) { + if (null === t) console.log("hello sneaky pete"); + else { + let e = []; + (this.i = 0), (this.path = t); + for (let s = 0; s < t.length - 1; s++) { + if (this.scene.player.dead) return; + let i = 64 * t[s + 1].x, + n = 64 * t[s + 1].y; + e.push({ targets: this, duration: 400, x: i, y: n }); + } + this.moveTimeline = this.scene.tweens.timeline({ + tweens: e, + onComplete: () => { + this.delayedMove.remove(), + this.alpha > 0 && !this.scene.player.dead && this.launchMove(); + }, + }); + } + } +} +const T = { + setBloomEnable(t) { + return void 0 === t && (t = !0), (this.bloomEnable = t), this; + }, + setBloomRadius(t) { + return (this.bloomRadius = t), this; + }, + setBloomIntensity(t) { + return (this.bloomIntensity = t), this; + }, + setBloomThreshold(t) { + return (this.bloomThreshold = t), this; + }, + setBloomTexelSize(t, e) { + return ( + void 0 === e && (e = t), + (this.bloomTexelWidth = t), + (this.bloomTexelHeight = e), + this + ); + }, + }, + k = { + setChromaticEnable(t) { + return void 0 === t && (t = !0), (this.chromaticEnable = t), this; + }, + setChabIntensity(t) { + return (this.chabIntensity = t), this; + }, + }, + A = { + setVignetteEnable(t) { + return void 0 === t && (t = !0), (this.vignetteEnable = t), this; + }, + setVignetteStrength(t) { + return (this.vignetteStrength = t), this; + }, + setVignetteIntensity(t) { + return (this.vignetteIntensity = t), this; + }, + }, + O = { + setNoiseEnable(t) { + return void 0 === t && (t = !0), (this.noiseEnable = t), this; + }, + setNoiseStrength(t) { + return (this.noiseStrength = t), this; + }, + setNoiseSeed(t) { + return (this.noiseSeed = t), this; + }, + }, + M = { + setVHSEnable(t) { + return void 0 === t && (t = !0), (this.vhsEnable = t), this; + }, + setVhsStrength(t) { + return (this.vhsStrength = t), this; + }, + }, + P = { + setScanlinesEnable(t) { + return void 0 === t && (t = !0), (this.scanlinesEnable = t), this; + }, + setScanStrength(t) { + return (this.scanStrength = t), this; + }, + }, + I = { + setCRTEnable(t) { + return void 0 === t && (t = !0), (this.crtEnable = t), this; + }, + setCrtSize(t, e) { + return ( + void 0 === e && (e = t), (this.crtWidth = t), (this.crtHeight = e), this + ); + }, + }; +var C = { + setEnable: function (t) { + return ( + void 0 === t && (t = !0), + (this.bloomEnable = t), + (this.chromaticEnable = t), + (this.vignetteEnable = t), + (this.noiseEnable = t), + (this.vhsEnable = t), + (this.scanlinesEnable = t), + (this.crtEnable = t), + this + ); + }, +}; +Object.assign(C, T, k, A, O, M, P, I); +const B = Phaser.Game; +var D = function (t) { + return t instanceof B; +}; +const R = Phaser.Scene; +var L = function (t) { + return t instanceof R; +}; +const H = Phaser.Renderer.WebGL.Pipelines.PostFXPipeline, + _ = Phaser.Utils.Objects.GetValue; +class N extends H { + constructor(t) { + super({ + name: "rexHorrifiPostFx", + game: t, + renderTarget: !0, + fragShader: + "#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n\nuniform float time;\n\n// Scene buffer\nuniform sampler2D uMainSampler; \nvarying vec2 outTexCoord;\n\n// Effect parameters\n#define SAMPLES 32.\n\n// Bloom\nuniform float bloomEnable;\nuniform vec3 bloom;\nuniform vec2 bloomTexel;\n\n// Chromatic abberation\nuniform float chromaticEnable;\nuniform float chabIntensity;\n\n// Vignette\nuniform float vignetteEnable;\nuniform vec2 vignette;\n\n// Noise\nuniform float noiseEnable;\nuniform float noiseStrength;\nuniform float noiseSeed;\n\n// VHS\nuniform float vhsEnable;\nuniform float vhsStrength;\n\n// Scanlines\nuniform float scanlinesEnable;\nuniform float scanStrength;\n\n// CRT\nuniform float crtEnable;\nuniform vec2 crtSize;\n\n\n// Noise\nfloat noise(vec2 uv) {\n return fract(sin(uv.x*12.9898+uv.y*78.233)*437.585453*noiseSeed);\n}\n\n// VHS\nvec4 vhs(vec2 uv) {\n vec2 tcoord = uv;\n tcoord.x += sin(time*noise(uv));\n return texture2D( uMainSampler, tcoord)*vhsStrength;\t\n}\n\n// Vignette\nfloat vig(vec2 uv) {\n uv *= 1. - uv;\n return ( pow(uv.x*uv.y*vignette.x*10.,vignette.y) );\n}\n\n// Chromatic abberation\nvec3 chromatic(vec2 uv, float offset) {\n float r = texture2D( uMainSampler, vec2(uv.x+offset, uv.y)).r;\n float g = texture2D( uMainSampler, uv).g;\n float b = texture2D( uMainSampler, vec2(uv.x-offset, uv.y)).b;\n return vec3(r,g,b);\n}\n\n// Bloom\nvec4 blur(vec2 uv) {\n float total = 0.;\n float rad = 1.;\n mat2 ang = mat2(.73736882209777832,-.67549037933349609,.67549037933349609,.73736882209777832);\n vec2 point = normalize(fract(cos(uv*mat2(195,174,286,183))*742.)-.5)*(bloom.x/sqrt(SAMPLES));\n vec4 amount = vec4(0);\n\t\n for ( float i=0.; i .5 ) {\n mainUv = crtCurve(outTexCoord);\n }\n\t\n // Base coloring\n vec4 color = texture2D( uMainSampler, mainUv);\n\t\n // Chromatic abberation\n if ( chromaticEnable > .5 ) {\n color.rgb *= chromatic(mainUv, chabIntensity * 0.01);\n }\n\t\n // Scanlines\n if ( scanlinesEnable > .5 ) {\n color.rgb *= (1.-scanStrength)+(sin(mainUv.y*1024.)*scanStrength);\n }\n\n // Bloom\n if ( bloomEnable > .5 ) {\n color.rgb += blur(mainUv).rgb;\n }\n\t\n // Noise\n if ( noiseEnable > .5 ) {\n color.rgb += noise(mainUv)*noiseStrength;\n }\n\t\n // VHS\n if ( vhsEnable > .5 ) {\n color += vhs(mainUv);\n }\n\t\n // Vignette\n if ( vignetteEnable > .5) {\n color.rgb *= vig(mainUv);\n }\n\t\n // Cutoff edges\n if ( crtEnable > .5) {\n if ( (mainUv.x < 0.)|| (mainUv.y < 0.) || (mainUv.x > 1.)|| (mainUv.y > 1.) ) {\n color.rgb *= 0.;\n }\n }\n\t\n gl_FragColor = color;\n}\n", + }), + (this.now = 0), + (this.bloomEnable = !1), + (this.bloomRadius = 0), + (this.bloomIntensity = 0), + (this.bloomThreshold = 0), + (this.bloomTexelWidth = 0), + (this.bloomTexelHeight = 0), + (this.chromaticEnable = !1), + (this.chabIntensity = 0), + (this.vignetteEnable = !1), + (this.vignetteStrength = 0), + (this.vignetteIntensity = 0), + (this.noiseEnable = !1), + (this.noiseStrength = 0), + (this.noiseSeed = Math.random()), + (this.vhsEnable = !1), + (this.vhsStrength = 0), + (this.scanlinesEnable = !1), + (this.scanStrength = 0), + (this.crtEnable = !1), + (this.crtWidth = 0), + (this.crtHeight = 0); + } + resetFromJSON(t) { + var e = _(t, "enable", !1); + return ( + this.setBloomEnable(_(t, "bloomEnable", e)), + this.setBloomRadius(_(t, "bloomRadius", 0)), + this.setBloomIntensity(_(t, "bloomIntensity", 0)), + this.setBloomThreshold(_(t, "bloomThreshold", 0)), + this.setBloomTexelSize( + _(t, "bloomTexelWidth", 0), + _(t, "bloomTexelHeight") + ), + this.setChromaticEnable(_(t, "chromaticEnable", e)), + this.setChabIntensity(_(t, "chabIntensity", 0)), + this.setVignetteEnable(_(t, "vignetteEnable", e)), + this.setVignetteStrength(_(t, "vignetteStrength", 0)), + this.setVignetteIntensity(_(t, "vignetteIntensity", 0)), + this.setNoiseEnable(_(t, "noiseEnable", e)), + this.setNoiseStrength(_(t, "noiseStrength", 0)), + this.setNoiseSeed(_(0, "noiseSeed", Math.random())), + this.setVHSEnable(_(t, "vhsEnable", e)), + this.setVhsStrength(_(t, "vhsStrength", 0)), + this.setScanlinesEnable(_(t, "scanlinesEnable", e)), + this.setScanStrength(_(t, "scanStrength", 0)), + this.setCRTEnable(_(t, "crtEnable", e)), + this.setCrtSize(_(t, "crtWidth", 0), _(t, "crtHeight", void 0)), + this + ); + } + onPreRender() { + var t, e; + this.set1f("noiseSeed", this.noiseSeed), + this.set1f("bloomEnable", this.bloomEnable ? 1 : 0), + this.set3f( + "bloom", + this.bloomRadius, + this.bloomIntensity, + this.bloomThreshold + ), + this.set2f("bloomTexel", this.bloomTexelWidth, this.bloomTexelHeight), + this.set1f("chromaticEnable", this.chromaticEnable ? 1 : 0), + this.set1f("chabIntensity", this.chabIntensity), + this.set1f("vignetteEnable", this.vignetteEnable ? 1 : 0), + this.set2f("vignette", this.vignetteStrength, this.vignetteIntensity), + this.set1f("noiseEnable", this.noiseEnable ? 1 : 0), + this.set1f("noiseStrength", this.noiseStrength), + this.set1f("vhsEnable", this.vhsEnable ? 1 : 0), + this.set1f("vhsStrength", this.vhsStrength), + this.set1f("scanlinesEnable", this.scanlinesEnable ? 1 : 0), + this.set1f("scanStrength", this.scanStrength), + this.set1f("crtEnable", this.crtEnable ? 1 : 0), + this.set2f("crtSize", this.crtWidth, this.crtHeight), + this.vhsEnable && + (this.now += + ((t = this.game), + ((e = t), + null == e || "object" != typeof e + ? null + : D(e) + ? e + : D(e.game) + ? e.game + : L(e) + ? e.sys.game + : L(e.scene) + ? e.scene.sys.game + : void 0).loop.delta)), + this.set1f("time", this.now); + } +} +Object.assign(N.prototype, C); +class F extends Phaser.Scene { + constructor() { + super({ key: "game" }), + (this.player = null), + (this.score = 0), + (this.scoreText = null); + } + init(t) { + (this.name = t.name), (this.number = t.number); + } + create() { + (this.backgroundColors = [ + 11411474, 9837584, 5247498, 4198922, 3150346, 3084810, 0, + ]), + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.cameras.main.setBackgroundColor(this.backgroundColors[this.number]), + this.addLight(), + this.createMap(), + (this.smokeLayer = this.add.layer()), + this.addPlayer(), + this.addOxygen(), + this.cameras.main.startFollow(this.player, !0, 0.05, 0.05, 0, 0), + this.loadAudios(), + this.addEffects(), + this.playMusic(); + } + addOxygen() { + this.oxygenBar = this.add + .rectangle(this.center_width, 40, 1.8 * this.player.oxygen, 20, 7017483) + .setOrigin(0.5) + .setScrollFactor(0); + } + addEffects() { + this.cameras.main.setPostPipeline(N); + } + addDay() { + this.dayText = this.add + .bitmapText(20, 10, "pico", "Day " + (this.number + 1), 20) + .setTint(7017483) + .setOrigin(0) + .setScrollFactor(0) + .setDropShadow(0, 2, 7024682, 0.9); + } + addLight() { + this.lights.disable(), + this.lights.setAmbientColor(11411474), + (this.playerLight = this.lights + .addLight(0, 100, 100) + .setColor(16777215) + .setIntensity(3)); + } + createMap() { + (this.tileMap = this.make.tilemap({ + key: "scene" + this.number, + tileWidth: 64, + tileHeight: 64, + })), + (this.tileSetBg = this.tileMap.addTilesetImage("mars")), + (this.tileSet = this.tileMap.addTilesetImage("mars")), + (this.platform = this.tileMap.createLayer( + "scene" + this.number, + this.tileSet + )), + (this.border = this.tileMap.createLayer("border", this.tileSet)), + (this.objectsLayer = this.tileMap.getObjectLayer("objects")), + this.border.setCollisionByExclusion([-1]), + this.platform.setCollisionByExclusion([-1]), + (this.holes = this.add.group()), + (this.foes = this.add.group()), + (this.objects = this.add.group()), + this.createGrid(), + this.addObjects(); + } + addObjects() { + this.objectsLayer.objects.forEach((t) => { + if (t.name.startsWith("object")) { + const [e, s, i, n] = t.name.split(":"); + this.objects.add(new p(this, t.x, t.y, s, i, n)); + } + t.name.startsWith("drone") && + this.foes.add(new E(this, t.x, t.y, this.grid)); + }); + } + createGrid() { + (this.grid = []), + Array(40) + .fill(0) + .forEach((t, e) => { + (this.grid[e] = []), + Array(40) + .fill(0) + .forEach((t, s) => { + let i = this.platform.getTileAt(Math.floor(s), Math.floor(e)), + n = this.border.getTileAt(Math.floor(s), Math.floor(e)); + this.grid[e][s] = i || n ? 1 : 0; + }); + }); + } + addPlayer() { + this.trailLayer = this.add.layer(); + const t = this.objectsLayer.objects.find((t) => "player" === t.name); + (this.player = new d(this, t.x, t.y)), + this.physics.add.collider( + this.player, + this.platform, + this.hitFloor, + () => !0, + this + ), + this.physics.add.overlap( + this.player, + this.objects, + this.touchObject, + () => !0, + this + ), + this.physics.add.overlap( + this.player, + this.foes, + this.playerHitByFoe, + () => !0, + this + ), + this.physics.add.overlap( + this.player, + this.holes, + this.playerHitHole, + () => !0, + this + ); + } + hitFloor(t, e) {} + touchObject(t, e) { + "hole" === e.type && this.playTracker(), + e.activated || ((e.activated = !0), e.touch()); + } + playerHitByFoe(t, e) { + this.cameras.main.shake(100), + this.playAudio("killed"), + t.death(), + this.restartScene(); + } + playerHitHole(t, e) { + t.dead || + (this.playAudio("holeshout"), + e.setAlpha(1), + t.setAlpha(0), + this.cameras.main.shake(50), + t.death(), + this.restartScene()); + } + loadAudios() { + (this.audios = { + mars_background: this.sound.add("mars_background"), + step: this.sound.add("step"), + kill: this.sound.add("kill"), + blip: this.sound.add("blip"), + ohmygod: this.sound.add("ohmygod"), + holeshout: this.sound.add("holeshout"), + oxygen: this.sound.add("oxygen"), + shock: this.sound.add("shock"), + killed: this.sound.add("killed"), + }), + (this.tracker = this.sound.add("tracker")); + } + playTracker() { + this.tracker.isPlaying || this.tracker.play(); + } + playRandomStatic() { + const t = + this.number < 6 ? "static" + Phaser.Math.Between(0, 3) : "creepy_static"; + this.sound + .add(t) + .play({ + rate: Phaser.Math.Between(9, 11) / 10, + delay: 0, + volume: Phaser.Math.Between(5, 10) / 10, + }); + } + playAudio(t) { + this.audios[t].play(); + } + playRandom(t, e = 1) { + this.audios[t].play({ + rate: Phaser.Math.Between(0.9, 1), + detune: Phaser.Math.Between(-500, 500), + delay: 0, + volume: e, + }); + } + playOfficer() { + this.sound.add(`officer${this.number}`).play(); + } + playMusic() { + const t = this.number < 6 ? "mars_background" : "cave"; + (this.theme = this.sound.add(t)), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 1.5, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }), + this.sound + .add("creepy") + .play({ + mute: !1, + volume: 1, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }), + (this.breathing = this.sound.add("breath")), + this.breath(0.2); + } + breath(t = 0.2, e = 0.4) { + const s = Phaser.Math.Between(500, 1e3); + this.tweens.add({ + targets: this.breathing, + volume: 0, + duration: s, + onComplete: () => { + this.breathing.play({ rate: t, volume: e }); + }, + }); + } + restartScene() { + const t = this.cameras.main.worldView.centerX, + e = this.cameras.main.worldView.centerY; + (this.fadeBlack = this.add + .rectangle(t - 100, e - 50, 1e4, 11e3, 0) + .setOrigin(0.5)), + (this.failure = this.add + .bitmapText(t, e, "pico", "FAILURE", 40) + .setTint(7017483) + .setOrigin(0.5) + .setDropShadow(0, 2, 7024682, 0.9)), + this.tweens.add({ + targets: [this.failure, this.fadeBlack], + alpha: { from: 0, to: 1 }, + duration: 2e3, + }), + this.time.delayedCall( + 3e3, + () => { + this.sound.stopAll(), + this.scene.start("transition", { number: this.number }); + }, + null, + this + ); + } + finishScene(t = !0) { + const e = this.cameras.main.worldView.centerX, + s = this.cameras.main.worldView.centerY; + (this.fadeBlack = this.add + .rectangle(e - 100, s - 50, 2e3, 2e3, 0) + .setOrigin(0.5)), + this.tweens.add({ + targets: [this.fadeBlack], + alpha: { from: 0, to: 1 }, + duration: 3e3, + }), + (this.player.dead = !0), + this.player.body.stop(), + this.mute && this.sound.add("blip").play(), + this.time.delayedCall( + 3e3, + () => { + this.mute && this.sound.stopAll(), + this.scene.start("transition", { + next: "underwater", + name: "STAGE", + number: this.number + 1, + }); + }, + null, + this + ); + } + updateOxygen() { + this.oxygenBar.width = 1.8 * this.player.oxygen; + } + skipThis() { + (this.player.dead = !0), + this.player.body.stop(), + this.theme.stop(), + this.scene.start("transition", { number: this.number + 1 }); + } +} +const G = { + width: 800, + height: 800, + scale: { mode: s.Scale.FIT, autoCenter: s.Scale.CENTER_BOTH }, + autoRound: !1, + parent: "game-container", + physics: { default: "arcade", arcade: { gravity: { y: 300 }, debug: !1 } }, + scene: [i, o, r, F, a], +}; +new s.Game(G); diff --git a/mars/src/main.js b/mars/src/main.js index 7e124160..dde801f7 100644 --- a/mars/src/main.js +++ b/mars/src/main.js @@ -1,9 +1,9 @@ import Phaser from "phaser"; import Bootloader from "./scenes/bootloader"; +import Game from "./scenes/game"; import Outro from "./scenes/outro"; import Splash from "./scenes/splash"; import Transition from "./scenes/transition"; -import Game from "./scenes/game"; const config = { width: 800, @@ -13,7 +13,7 @@ const config = { autoCenter: Phaser.Scale.CENTER_BOTH, }, autoRound: false, - parent: "contenedor", + parent: "game-container", physics: { default: "arcade", arcade: { diff --git a/pushpull/dist/assets/index-D29MUjmQ.js b/pushpull/dist/assets/index-D29MUjmQ.js index 417ca204..66c041a0 100644 --- a/pushpull/dist/assets/index-D29MUjmQ.js +++ b/pushpull/dist/assets/index-D29MUjmQ.js @@ -1 +1,782 @@ -import{P as t}from"./phaser-CmFXOKba.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const s of t)if("childList"===s.type)for(const t of s.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();class e extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.setLoadEvents(),this.loadFonts(),this.loadAudios(),this.loadImages(),this.loadSpritesheets(),this.loadMaps(),this.setRegistry()}setLoadEvents(){this.load.on("progress",(function(t){this.progressBar.clear(),this.progressBar.fillStyle(10941206,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*t,16)}),this),this.load.on("complete",(()=>{this.scene.start("splash")}),this)}loadFonts(){this.load.bitmapFont("mario","assets/fonts/mario.png","assets/fonts/mario.xml")}loadImages(){this.load.image("pello","assets/images/pello.png"),this.load.image("background","assets/images/background.png"),this.load.image("tileset_fg","assets/maps/tileset_fg.png"),this.load.image("block_red","assets/images/block_red.png"),this.load.image("block_green","assets/images/block_green.png"),this.load.image("block_blue","assets/images/block_blue.png"),this.load.image("block_yellow","assets/images/block_yellow.png"),this.load.image("star","assets/images/star.png")}loadMaps(){Array(9).fill(0).forEach(((t,e)=>{this.load.tilemapTiledJSON(`scene${e}`,`assets/maps/scene${e}.json`)}))}loadAudios(){this.load.audio("music","assets/sounds/music.mp3"),this.load.audio("splash","assets/sounds/splash.mp3"),this.load.audio("win","assets/sounds/win.mp3"),this.load.audio("hover","assets/sounds/hover.mp3"),this.load.audio("select","assets/sounds/select.mp3"),this.load.audio("bump","assets/sounds/bump.mp3"),this.load.audio("move","assets/sounds/move.mp3")}loadSpritesheets(){this.load.spritesheet("spider","assets/images/spider.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("heart","assets/images/heart.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("frog","assets/images/frog.png",{frameWidth:32,frameHeight:48}),this.load.spritesheet("frog2","assets/images/frog2.png",{frameWidth:48,frameHeight:32}),this.load.spritesheet("trail","assets/images/trail.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("block","assets/images/block.png",{frameWidth:48,frameHeight:48})}setRegistry(){this.registry.set("score",0),this.registry.set("moves",0)}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(16769126,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class s extends Phaser.Scene{constructor(){super({key:"outro"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.introLayer=this.add.layer(),this.cameras.main.setBackgroundColor(3970982),this.splashLayer=this.add.layer(),this.showCount(),this.addStartButton(),this.input.keyboard.on("keydown-SPACE",this.startSplash,this),this.input.keyboard.on("keydown-ENTER",this.startSplash,this)}showCount(){this.winText=this.add.bitmapText(this.center_width,-100,"mario","TOTAL MOVES: "+this.registry.get("moves"),30).setOrigin(.5).setTint(16769126).setDropShadow(2,3,7715143,.7),this.tweens.add({targets:this.winText,duration:500,y:{from:this.winText.y,to:this.center_height}}),this.tweens.add({targets:this.winText,duration:100,scale:{from:1,to:1.1},repeat:-1,yoyo:!0})}addStartButton(){this.startButton=this.add.bitmapText(this.center_width,500,"mario","Click to start",30).setOrigin(.5).setTint(10113024).setDropShadow(2,3,6895104,.7),this.startButton.setInteractive(),this.startButton.on("pointerdown",(()=>{this.startSplash()})),this.startButton.on("pointerover",(()=>{this.startButton.setTint(4089973)})),this.startButton.on("pointerout",(()=>{this.startButton.setTint(16777215)})),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}startSplash(){this.sound.stopAll(),this.scene.start("splash")}}class i extends Phaser.Scene{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.background=this.add.tileSprite(0,0,1024,1024,"background").setOrigin(0),this.cameras.main.setBackgroundColor(3970982),this.time.delayedCall(1e3,(()=>this.showInstructions()),null,this),this.addStartButton(),this.input.keyboard.on("keydown-SPACE",(()=>this.startGame()),this),this.playMusic(),this.showTitle(),this.addStartButton()}update(){this.background.tilePositionX+=1,this.background.tilePositionY+=1}startGame(){this.theme&&this.theme.stop(),this.playGameMusic(),this.scene.start("transition",{name:"STAGE",number:0})}playGameMusic(t="music"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.2,rate:1,detune:0,seek:0,loop:!0,delay:0})}showTitle(){this.gameLogo1=this.add.bitmapText(this.center_width-1e3,100,"mario","Push",120).setOrigin(.5).setTint(16777215).setDropShadow(3,4,7715143,.7),this.gameLogo2=this.add.bitmapText(this.center_width+1e3,220,"mario","Pull",120).setOrigin(.5).setTint(16769126).setDropShadow(2,3,6895104,.7),this.titleTweens()}titleTweens(){this.tweens.add({targets:[this.gameLogo2],duration:1e3,x:{from:this.gameLogo2.x,to:this.center_width},onComplete:()=>{this.tweens.add({targets:[this.gameLogo2],duration:1e3,x:"-=20",repeat:-1,ease:"Linear"})}}),this.tweens.add({targets:[this.gameLogo1],duration:1e3,x:{from:this.gameLogo1.x,to:this.center_width},onComplete:()=>{this.tweens.add({targets:[this.gameLogo1],duration:1e3,x:"+=20",repeat:-1,ease:"Linear"})}})}playMusic(t="splash"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.5,rate:1,detune:0,seek:0,loop:!0,delay:0})}addStartButton(){this.startButton=this.add.bitmapText(this.center_width,500,"mario","start",30).setOrigin(.5).setTint(16769126).setDropShadow(2,3,6895104,.7),this.startButton.setInteractive(),this.startButton.on("pointerdown",(()=>{this.sound.add("move").play(),this.startGame()})),this.startButton.on("pointerover",(()=>{this.startButton.setTint(4089973)})),this.startButton.on("pointerout",(()=>{this.startButton.setTint(16769126)})),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}showInstructions(){this.add.sprite(this.center_width-80,400,"pello").setOrigin(.5).setScale(.5),this.add.bitmapText(this.center_width+40,400,"mario","By PELLO",15).setOrigin(.5),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}}class a extends Phaser.Scene{constructor(){super({key:"transition"})}init(t){this.name=t.name,this.number=t.number}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(3970982),9===this.number&&this.scene.start("outro",{name:this.name,number:this.number}),this.add.bitmapText(this.center_width,this.center_height-20,"mario",["Tutorial","Stage0","Stage1","Stage2","Stage3","Stage4","Stage5","Stage6","Stage7","Outro"][this.number],40).setOrigin(.5).setTint(10941206).setDropShadow(2,3,7715143,.7),this.add.bitmapText(this.center_width,this.center_height+20,"mario","Ready?",30).setOrigin(.5).setTint(10941206).setDropShadow(2,3,7715143,.7),this.time.delayedCall(1e3,(()=>this.loadNext()),null,this)}loadNext(){this.scene.start("game",{name:this.name,number:this.number,limitedTime:10+3*this.number})}}class h extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="block_blue",a=100){super(t,e,s,i),this.setOrigin(0,0),this.scene=t,this.name=i}}class r extends Phaser.GameObjects.Container{constructor(t,e,s,i=2,a=3,h="blue",r=100){super(t,e,s),this.w=+i,this.h=+a,this.id=Math.random(),this.name="block_"+h,this.scene.add.existing(this),this.scene.physics.add.existing(this),this.body.immovable=!0,this.active=!1,this.setKeys(),this.defaultVelocity=r,this.createBlock(),this.allowChangeDirection=!0,this.scene.events.on("update",this.update,this),this.setListeners()}createBlock(){this.body.setSize(32*this.w,32*this.h);for(let t=0;t{this.scene.playAudio("select"),this.iterate((t=>t.setTint(3170416))),this.activate()})),this.on("pointerover",(()=>{this.scene.playAudio("hover"),this.iterate((t=>t.setTint(3170416)))})),this.on("pointerout",(()=>{this.iterate((t=>t.clearTint()))}))}activate(){this.scene.activeBlock&&this.scene.activeBlock.deactivate(),this.active=!0,this.scene.activeBlock=this}deactivate(){this.active=!1}update(){this.active&&((Phaser.Input.Keyboard.JustUp(this.S)||Phaser.Input.Keyboard.JustUp(this.cursor.down))&&this.canMoveDown()?(this.leaveTrail(32*this.w,32),this.y+=32,this.scene.updateMoves()):(Phaser.Input.Keyboard.JustUp(this.W)||Phaser.Input.Keyboard.JustUp(this.cursor.up))&&this.canMoveUp()?(this.leaveTrail(32*this.w,32,0,32*(this.h-1)),this.y-=32,this.scene.updateMoves()):(Phaser.Input.Keyboard.JustUp(this.D)||Phaser.Input.Keyboard.JustUp(this.cursor.right))&&this.canMoveRight()?(this.leaveTrail(32,32*this.h),this.x+=32,this.scene.updateMoves()):(Phaser.Input.Keyboard.JustUp(this.A)||Phaser.Input.Keyboard.JustUp(this.cursor.left))&&this.canMoveLeft()&&(this.leaveTrail(32,32*this.h,32*(this.w-1)),this.x-=32,this.scene.updateMoves()))}leaveTrail(t,e,s=0,i=0){this.scene.playAudio("move");const a=this.scene.add.rectangle(this.x+s,this.y+i,t,e,13421772).setOrigin(0);this.scene.tweens.add({targets:[a],duration:300,alpha:{from:1,to:0},onComplete:()=>{a.destroy()}})}isOverlap(t=0,e=0){return!this.scene.blocks.children.entries.map((s=>{if(s.id===this.id)return!1;let i=this.getBounds(),a=s.getBounds();return i.x+=1,i.y+=1,i.width=32*this.w-2,i.height=32*this.h-2,i.x+=t,i.y+=e,Phaser.Geom.Intersects.RectangleToRectangle(i,a)})).every((t=>!t))}canMoveDown(t=32){if(this.isOverlap(0,1))return this.scene.playAudio("bump"),!1;t=32*this.h;const e=Array(this.w).fill(0).map(((e,s)=>this.scene.platform.getTileAtWorldXY(this.x+32*s,this.y+t))).every((t=>!t));return e||this.scene.playAudio("bump"),e}canMoveUp(t=32){if(this.isOverlap(0,-1))return this.scene.playAudio("bump"),!1;const e=Array(this.w).fill(0).map(((t,e)=>this.scene.platform.getTileAtWorldXY(this.x+32*e,this.y-1))).every((t=>!t));return e||this.scene.playAudio("bump"),e}canMoveLeft(t=32){if(this.isOverlap(-1,0))return this.scene.playAudio("bump"),!1;const e=Array(this.h).fill(0).map(((e,s)=>this.scene.platform.getTileAtWorldXY(this.x-t,this.y+32*s))).every((t=>!t));return e||this.scene.playAudio("bump"),e}canMoveRight(t=32){if(this.isOverlap(1,0))return this.scene.playAudio("bump"),!1;t=32*this.w;const e=Array(this.h).fill(0).map(((e,s)=>this.scene.platform.getTileAtWorldXY(this.x+t,this.y+32*s))).every((t=>!t));return e||this.scene.playAudio("bump"),e}}class o extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="star"){super(t,e,s,"star"),this.name=i,this.setOrigin(.5),this.setAlpha(0),t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1)}}class n extends Phaser.Scene{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null}init(t){this.name=t.name,this.number=t.number||0,this.limitedTime=t.limitedTime||10}preload(){}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(0),this.input.mouse.disableContextMenu(),this.addPointer(),this.addMap(),this.addMoves(),this.addRetry(),this.loadAudios(),this.showTexts(),this.solved=!1}addRetry(){this.R=this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.R)}addMoves(){this.movesText=this.add.bitmapText(this.center_width,32,"mario","0",30).setOrigin(.5).setTint(16769126).setDropShadow(3,4,7715143,.7),this.totalMoves=0}addMap(){this.tileMap=this.make.tilemap({key:`scene${this.number}`,tileWidth:32,tileHeight:32}),this.tileSetBg=this.tileMap.addTilesetImage("tileset_fg"),this.tileMap.createLayer("background",this.tileSetBg),this.tileSet=this.tileMap.addTilesetImage("tileset_fg"),this.platform=this.tileMap.createLayer(`scene${this.number}`,this.tileSet),this.objectsLayer=this.tileMap.getObjectLayer("objects"),this.platform.setCollisionByExclusion([-1]),this.physics.world.setBounds(0,0,this.width,this.height),this.exits=this.add.group(),this.blocks=this.add.group(),this.texts=[],this.addObjects()}addObjects(){this.objectsLayer.objects.forEach((t=>{if(t.name.startsWith("block")){const[e,s,i,a]=t.name.split("_");this.activeBlock=new r(this,t.x,t.y,s,i,a),this.blocks.add(this.activeBlock),t.name.startsWith("block_1_1")&&this.addPlayer(this.activeBlock)}t.name.startsWith("exit")&&this.exits.add(new o(this,t.x-16,t.y))}))}showTexts(){this.number>0||["Select cubes","Pull/push them with WASD/Arrows","MOVE the red to exit"].forEach(((t,e)=>{this.add.bitmapText(this.center_width,425+35*e,"mario",t,15).setOrigin(.5).setTint(16769126).setDropShadow(1,2,12526882,.7)}))}addPlayer(t){this.player=t,this.physics.add.overlap(this.player,this.exits,this.hitExit,(()=>!0),this)}hitBlockBlock(t,e){}hitExit(t,e){this.player.active=!1,e.destroy(),this.finishScene()}addPointer(){this.pointer=this.input.activePointer,this.input.mouse.disableContextMenu()}loadAudios(){this.audios={bump:this.sound.add("bump"),hover:this.sound.add("hover"),select:this.sound.add("select"),move:this.sound.add("move"),win:this.sound.add("win")}}playAudio(t){this.audios[t].play()}playRandom(t,e=1){this.audios[t].play({rate:Phaser.Math.Between(1,1.5),detune:Phaser.Math.Between(-1e3,1e3),delay:0,volume:e})}update(){Phaser.Input.Keyboard.JustDown(this.R)&&this.restartScene()}finishScene(){if(this.solved)return;this.playAudio("win"),this.solved=!0;const t=+this.registry.get("moves")+this.totalMoves;this.registry.set("moves",t),this.winText=this.add.bitmapText(this.center_width,-100,"mario","STAGE CLEARED!",30).setOrigin(.5).setTint(16769126).setDropShadow(2,3,7715143,.7),this.tweens.add({targets:this.winText,duration:500,y:{from:this.winText.y,to:this.center_height}}),this.tweens.add({targets:[this.winText,this.movesText],duration:100,scale:{from:1,to:1.1},repeat:-1,yoyo:!0}),this.time.delayedCall(2e3,(()=>{this.scene.start("transition",{next:"underwater",name:"STAGE",number:this.number+1})}),null,this)}restartScene(){this.scene.start("game",{next:"underwater",name:"STAGE",number:this.number})}updateMoves(){this.totalMoves++,this.movesText.setText(this.totalMoves),this.tweens.add({targets:[this.timerText],duration:200,alpha:{from:.6,to:1},repeat:-1})}}const d={width:608,height:608,scale:{mode:t.Scale.FIT,autoCenter:t.Scale.CENTER_BOTH},autoRound:!1,parent:"contenedor",physics:{default:"arcade",arcade:{gravity:{y:0},debug:!1}},plugins:{},scene:[e,i,a,n,s]};new t.Game(d); +import { P as t } from "./phaser-CmFXOKba.js"; +!(function () { + const t = document.createElement("link").relList; + if (!(t && t.supports && t.supports("modulepreload"))) { + for (const t of document.querySelectorAll('link[rel="modulepreload"]')) + e(t); + new MutationObserver((t) => { + for (const s of t) + if ("childList" === s.type) + for (const t of s.addedNodes) + "LINK" === t.tagName && "modulepreload" === t.rel && e(t); + }).observe(document, { childList: !0, subtree: !0 }); + } + function e(t) { + if (t.ep) return; + t.ep = !0; + const e = (function (t) { + const e = {}; + return ( + t.integrity && (e.integrity = t.integrity), + t.referrerPolicy && (e.referrerPolicy = t.referrerPolicy), + "use-credentials" === t.crossOrigin + ? (e.credentials = "include") + : "anonymous" === t.crossOrigin + ? (e.credentials = "omit") + : (e.credentials = "same-origin"), + e + ); + })(t); + fetch(t.href, e); + } +})(); +class e extends Phaser.Scene { + constructor() { + super({ key: "bootloader" }); + } + preload() { + this.createBars(), + this.setLoadEvents(), + this.loadFonts(), + this.loadAudios(), + this.loadImages(), + this.loadSpritesheets(), + this.loadMaps(), + this.setRegistry(); + } + setLoadEvents() { + this.load.on( + "progress", + function (t) { + this.progressBar.clear(), + this.progressBar.fillStyle(10941206, 1), + this.progressBar.fillRect( + this.cameras.main.width / 4, + this.cameras.main.height / 2 - 16, + (this.cameras.main.width / 2) * t, + 16 + ); + }, + this + ), + this.load.on( + "complete", + () => { + this.scene.start("splash"); + }, + this + ); + } + loadFonts() { + this.load.bitmapFont( + "mario", + "assets/fonts/mario.png", + "assets/fonts/mario.xml" + ); + } + loadImages() { + this.load.image("pello", "assets/images/pello.png"), + this.load.image("background", "assets/images/background.png"), + this.load.image("tileset_fg", "assets/maps/tileset_fg.png"), + this.load.image("block_red", "assets/images/block_red.png"), + this.load.image("block_green", "assets/images/block_green.png"), + this.load.image("block_blue", "assets/images/block_blue.png"), + this.load.image("block_yellow", "assets/images/block_yellow.png"), + this.load.image("star", "assets/images/star.png"); + } + loadMaps() { + Array(9) + .fill(0) + .forEach((t, e) => { + this.load.tilemapTiledJSON(`scene${e}`, `assets/maps/scene${e}.json`); + }); + } + loadAudios() { + this.load.audio("music", "assets/sounds/music.mp3"), + this.load.audio("splash", "assets/sounds/splash.mp3"), + this.load.audio("win", "assets/sounds/win.mp3"), + this.load.audio("hover", "assets/sounds/hover.mp3"), + this.load.audio("select", "assets/sounds/select.mp3"), + this.load.audio("bump", "assets/sounds/bump.mp3"), + this.load.audio("move", "assets/sounds/move.mp3"); + } + loadSpritesheets() { + this.load.spritesheet("spider", "assets/images/spider.png", { + frameWidth: 32, + frameHeight: 32, + }), + this.load.spritesheet("heart", "assets/images/heart.png", { + frameWidth: 32, + frameHeight: 32, + }), + this.load.spritesheet("frog", "assets/images/frog.png", { + frameWidth: 32, + frameHeight: 48, + }), + this.load.spritesheet("frog2", "assets/images/frog2.png", { + frameWidth: 48, + frameHeight: 32, + }), + this.load.spritesheet("trail", "assets/images/trail.png", { + frameWidth: 32, + frameHeight: 32, + }), + this.load.spritesheet("block", "assets/images/block.png", { + frameWidth: 48, + frameHeight: 48, + }); + } + setRegistry() { + this.registry.set("score", 0), this.registry.set("moves", 0); + } + createBars() { + (this.loadBar = this.add.graphics()), + this.loadBar.fillStyle(16769126, 1), + this.loadBar.fillRect( + this.cameras.main.width / 4 - 2, + this.cameras.main.height / 2 - 18, + this.cameras.main.width / 2 + 4, + 20 + ), + (this.progressBar = this.add.graphics()); + } +} +class s extends Phaser.Scene { + constructor() { + super({ key: "outro" }); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + (this.introLayer = this.add.layer()), + this.cameras.main.setBackgroundColor(3970982), + (this.splashLayer = this.add.layer()), + this.showCount(), + this.addStartButton(), + this.input.keyboard.on("keydown-SPACE", this.startSplash, this), + this.input.keyboard.on("keydown-ENTER", this.startSplash, this); + } + showCount() { + (this.winText = this.add + .bitmapText( + this.center_width, + -100, + "mario", + "TOTAL MOVES: " + this.registry.get("moves"), + 30 + ) + .setOrigin(0.5) + .setTint(16769126) + .setDropShadow(2, 3, 7715143, 0.7)), + this.tweens.add({ + targets: this.winText, + duration: 500, + y: { from: this.winText.y, to: this.center_height }, + }), + this.tweens.add({ + targets: this.winText, + duration: 100, + scale: { from: 1, to: 1.1 }, + repeat: -1, + yoyo: !0, + }); + } + addStartButton() { + (this.startButton = this.add + .bitmapText(this.center_width, 500, "mario", "Click to start", 30) + .setOrigin(0.5) + .setTint(10113024) + .setDropShadow(2, 3, 6895104, 0.7)), + this.startButton.setInteractive(), + this.startButton.on("pointerdown", () => { + this.startSplash(); + }), + this.startButton.on("pointerover", () => { + this.startButton.setTint(4089973); + }), + this.startButton.on("pointerout", () => { + this.startButton.setTint(16777215); + }), + this.tweens.add({ + targets: this.space, + duration: 300, + alpha: { from: 0, to: 1 }, + repeat: -1, + yoyo: !0, + }); + } + startSplash() { + this.sound.stopAll(), this.scene.start("splash"); + } +} +class i extends Phaser.Scene { + constructor() { + super({ key: "splash" }); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + (this.background = this.add + .tileSprite(0, 0, 1024, 1024, "background") + .setOrigin(0)), + this.cameras.main.setBackgroundColor(3970982), + this.time.delayedCall(1e3, () => this.showInstructions(), null, this), + this.addStartButton(), + this.input.keyboard.on("keydown-SPACE", () => this.startGame(), this), + this.playMusic(), + this.showTitle(), + this.addStartButton(); + } + update() { + (this.background.tilePositionX += 1), (this.background.tilePositionY += 1); + } + startGame() { + this.theme && this.theme.stop(), + this.playGameMusic(), + this.scene.start("transition", { name: "STAGE", number: 0 }); + } + playGameMusic(t = "music") { + (this.theme = this.sound.add(t)), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 0.2, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } + showTitle() { + (this.gameLogo1 = this.add + .bitmapText(this.center_width - 1e3, 100, "mario", "Push", 120) + .setOrigin(0.5) + .setTint(16777215) + .setDropShadow(3, 4, 7715143, 0.7)), + (this.gameLogo2 = this.add + .bitmapText(this.center_width + 1e3, 220, "mario", "Pull", 120) + .setOrigin(0.5) + .setTint(16769126) + .setDropShadow(2, 3, 6895104, 0.7)), + this.titleTweens(); + } + titleTweens() { + this.tweens.add({ + targets: [this.gameLogo2], + duration: 1e3, + x: { from: this.gameLogo2.x, to: this.center_width }, + onComplete: () => { + this.tweens.add({ + targets: [this.gameLogo2], + duration: 1e3, + x: "-=20", + repeat: -1, + ease: "Linear", + }); + }, + }), + this.tweens.add({ + targets: [this.gameLogo1], + duration: 1e3, + x: { from: this.gameLogo1.x, to: this.center_width }, + onComplete: () => { + this.tweens.add({ + targets: [this.gameLogo1], + duration: 1e3, + x: "+=20", + repeat: -1, + ease: "Linear", + }); + }, + }); + } + playMusic(t = "splash") { + (this.theme = this.sound.add(t)), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 0.5, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } + addStartButton() { + (this.startButton = this.add + .bitmapText(this.center_width, 500, "mario", "start", 30) + .setOrigin(0.5) + .setTint(16769126) + .setDropShadow(2, 3, 6895104, 0.7)), + this.startButton.setInteractive(), + this.startButton.on("pointerdown", () => { + this.sound.add("move").play(), this.startGame(); + }), + this.startButton.on("pointerover", () => { + this.startButton.setTint(4089973); + }), + this.startButton.on("pointerout", () => { + this.startButton.setTint(16769126); + }), + this.tweens.add({ + targets: this.space, + duration: 300, + alpha: { from: 0, to: 1 }, + repeat: -1, + yoyo: !0, + }); + } + showInstructions() { + this.add + .sprite(this.center_width - 80, 400, "pello") + .setOrigin(0.5) + .setScale(0.5), + this.add + .bitmapText(this.center_width + 40, 400, "mario", "By PELLO", 15) + .setOrigin(0.5), + this.tweens.add({ + targets: this.space, + duration: 300, + alpha: { from: 0, to: 1 }, + repeat: -1, + yoyo: !0, + }); + } +} +class a extends Phaser.Scene { + constructor() { + super({ key: "transition" }); + } + init(t) { + (this.name = t.name), (this.number = t.number); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.cameras.main.setBackgroundColor(3970982), + 9 === this.number && + this.scene.start("outro", { name: this.name, number: this.number }), + this.add + .bitmapText( + this.center_width, + this.center_height - 20, + "mario", + [ + "Tutorial", + "Stage0", + "Stage1", + "Stage2", + "Stage3", + "Stage4", + "Stage5", + "Stage6", + "Stage7", + "Outro", + ][this.number], + 40 + ) + .setOrigin(0.5) + .setTint(10941206) + .setDropShadow(2, 3, 7715143, 0.7), + this.add + .bitmapText( + this.center_width, + this.center_height + 20, + "mario", + "Ready?", + 30 + ) + .setOrigin(0.5) + .setTint(10941206) + .setDropShadow(2, 3, 7715143, 0.7), + this.time.delayedCall(1e3, () => this.loadNext(), null, this); + } + loadNext() { + this.scene.start("game", { + name: this.name, + number: this.number, + limitedTime: 10 + 3 * this.number, + }); + } +} +class h extends Phaser.GameObjects.Sprite { + constructor(t, e, s, i = "block_blue", a = 100) { + super(t, e, s, i), this.setOrigin(0, 0), (this.scene = t), (this.name = i); + } +} +class r extends Phaser.GameObjects.Container { + constructor(t, e, s, i = 2, a = 3, h = "blue", r = 100) { + super(t, e, s), + (this.w = +i), + (this.h = +a), + (this.id = Math.random()), + (this.name = "block_" + h), + this.scene.add.existing(this), + this.scene.physics.add.existing(this), + (this.body.immovable = !0), + (this.active = !1), + this.setKeys(), + (this.defaultVelocity = r), + this.createBlock(), + (this.allowChangeDirection = !0), + this.scene.events.on("update", this.update, this), + this.setListeners(); + } + createBlock() { + this.body.setSize(32 * this.w, 32 * this.h); + for (let t = 0; t < this.w; t++) + for (let e = 0; e < this.h; e++) + this.add(new h(this.scene, 32 * t, 32 * e, this.name)); + } + setKeys() { + (this.cursor = this.scene.input.keyboard.createCursorKeys()), + (this.W = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.W + )), + (this.A = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.A + )), + (this.S = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.S + )), + (this.D = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.D + )), + this.scene.events.on("update", this.update, this); + } + setListeners() { + this.setInteractive( + new Phaser.Geom.Rectangle(0, 0, 64, 96), + Phaser.Geom.Rectangle.Contains + ), + this.on("pointerdown", (t) => { + this.scene.playAudio("select"), + this.iterate((t) => t.setTint(3170416)), + this.activate(); + }), + this.on("pointerover", () => { + this.scene.playAudio("hover"), this.iterate((t) => t.setTint(3170416)); + }), + this.on("pointerout", () => { + this.iterate((t) => t.clearTint()); + }); + } + activate() { + this.scene.activeBlock && this.scene.activeBlock.deactivate(), + (this.active = !0), + (this.scene.activeBlock = this); + } + deactivate() { + this.active = !1; + } + update() { + this.active && + ((Phaser.Input.Keyboard.JustUp(this.S) || + Phaser.Input.Keyboard.JustUp(this.cursor.down)) && + this.canMoveDown() + ? (this.leaveTrail(32 * this.w, 32), + (this.y += 32), + this.scene.updateMoves()) + : (Phaser.Input.Keyboard.JustUp(this.W) || + Phaser.Input.Keyboard.JustUp(this.cursor.up)) && + this.canMoveUp() + ? (this.leaveTrail(32 * this.w, 32, 0, 32 * (this.h - 1)), + (this.y -= 32), + this.scene.updateMoves()) + : (Phaser.Input.Keyboard.JustUp(this.D) || + Phaser.Input.Keyboard.JustUp(this.cursor.right)) && + this.canMoveRight() + ? (this.leaveTrail(32, 32 * this.h), + (this.x += 32), + this.scene.updateMoves()) + : (Phaser.Input.Keyboard.JustUp(this.A) || + Phaser.Input.Keyboard.JustUp(this.cursor.left)) && + this.canMoveLeft() && + (this.leaveTrail(32, 32 * this.h, 32 * (this.w - 1)), + (this.x -= 32), + this.scene.updateMoves())); + } + leaveTrail(t, e, s = 0, i = 0) { + this.scene.playAudio("move"); + const a = this.scene.add + .rectangle(this.x + s, this.y + i, t, e, 13421772) + .setOrigin(0); + this.scene.tweens.add({ + targets: [a], + duration: 300, + alpha: { from: 1, to: 0 }, + onComplete: () => { + a.destroy(); + }, + }); + } + isOverlap(t = 0, e = 0) { + return !this.scene.blocks.children.entries + .map((s) => { + if (s.id === this.id) return !1; + let i = this.getBounds(), + a = s.getBounds(); + return ( + (i.x += 1), + (i.y += 1), + (i.width = 32 * this.w - 2), + (i.height = 32 * this.h - 2), + (i.x += t), + (i.y += e), + Phaser.Geom.Intersects.RectangleToRectangle(i, a) + ); + }) + .every((t) => !t); + } + canMoveDown(t = 32) { + if (this.isOverlap(0, 1)) return this.scene.playAudio("bump"), !1; + t = 32 * this.h; + const e = Array(this.w) + .fill(0) + .map((e, s) => + this.scene.platform.getTileAtWorldXY(this.x + 32 * s, this.y + t) + ) + .every((t) => !t); + return e || this.scene.playAudio("bump"), e; + } + canMoveUp(t = 32) { + if (this.isOverlap(0, -1)) return this.scene.playAudio("bump"), !1; + const e = Array(this.w) + .fill(0) + .map((t, e) => + this.scene.platform.getTileAtWorldXY(this.x + 32 * e, this.y - 1) + ) + .every((t) => !t); + return e || this.scene.playAudio("bump"), e; + } + canMoveLeft(t = 32) { + if (this.isOverlap(-1, 0)) return this.scene.playAudio("bump"), !1; + const e = Array(this.h) + .fill(0) + .map((e, s) => + this.scene.platform.getTileAtWorldXY(this.x - t, this.y + 32 * s) + ) + .every((t) => !t); + return e || this.scene.playAudio("bump"), e; + } + canMoveRight(t = 32) { + if (this.isOverlap(1, 0)) return this.scene.playAudio("bump"), !1; + t = 32 * this.w; + const e = Array(this.h) + .fill(0) + .map((e, s) => + this.scene.platform.getTileAtWorldXY(this.x + t, this.y + 32 * s) + ) + .every((t) => !t); + return e || this.scene.playAudio("bump"), e; + } +} +class o extends Phaser.GameObjects.Sprite { + constructor(t, e, s, i = "star") { + super(t, e, s, "star"), + (this.name = i), + this.setOrigin(0.5), + this.setAlpha(0), + t.add.existing(this), + t.physics.add.existing(this), + this.body.setAllowGravity(!1); + } +} +class n extends Phaser.Scene { + constructor() { + super({ key: "game" }), + (this.player = null), + (this.score = 0), + (this.scoreText = null); + } + init(t) { + (this.name = t.name), + (this.number = t.number || 0), + (this.limitedTime = t.limitedTime || 10); + } + preload() {} + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.cameras.main.setBackgroundColor(0), + this.input.mouse.disableContextMenu(), + this.addPointer(), + this.addMap(), + this.addMoves(), + this.addRetry(), + this.loadAudios(), + this.showTexts(), + (this.solved = !1); + } + addRetry() { + this.R = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.R); + } + addMoves() { + (this.movesText = this.add + .bitmapText(this.center_width, 32, "mario", "0", 30) + .setOrigin(0.5) + .setTint(16769126) + .setDropShadow(3, 4, 7715143, 0.7)), + (this.totalMoves = 0); + } + addMap() { + (this.tileMap = this.make.tilemap({ + key: `scene${this.number}`, + tileWidth: 32, + tileHeight: 32, + })), + (this.tileSetBg = this.tileMap.addTilesetImage("tileset_fg")), + this.tileMap.createLayer("background", this.tileSetBg), + (this.tileSet = this.tileMap.addTilesetImage("tileset_fg")), + (this.platform = this.tileMap.createLayer( + `scene${this.number}`, + this.tileSet + )), + (this.objectsLayer = this.tileMap.getObjectLayer("objects")), + this.platform.setCollisionByExclusion([-1]), + this.physics.world.setBounds(0, 0, this.width, this.height), + (this.exits = this.add.group()), + (this.blocks = this.add.group()), + (this.texts = []), + this.addObjects(); + } + addObjects() { + this.objectsLayer.objects.forEach((t) => { + if (t.name.startsWith("block")) { + const [e, s, i, a] = t.name.split("_"); + (this.activeBlock = new r(this, t.x, t.y, s, i, a)), + this.blocks.add(this.activeBlock), + t.name.startsWith("block_1_1") && this.addPlayer(this.activeBlock); + } + t.name.startsWith("exit") && this.exits.add(new o(this, t.x - 16, t.y)); + }); + } + showTexts() { + this.number > 0 || + [ + "Select cubes", + "Pull/push them with WASD/Arrows", + "MOVE the red to exit", + ].forEach((t, e) => { + this.add + .bitmapText(this.center_width, 425 + 35 * e, "mario", t, 15) + .setOrigin(0.5) + .setTint(16769126) + .setDropShadow(1, 2, 12526882, 0.7); + }); + } + addPlayer(t) { + (this.player = t), + this.physics.add.overlap( + this.player, + this.exits, + this.hitExit, + () => !0, + this + ); + } + hitBlockBlock(t, e) {} + hitExit(t, e) { + (this.player.active = !1), e.destroy(), this.finishScene(); + } + addPointer() { + (this.pointer = this.input.activePointer), + this.input.mouse.disableContextMenu(); + } + loadAudios() { + this.audios = { + bump: this.sound.add("bump"), + hover: this.sound.add("hover"), + select: this.sound.add("select"), + move: this.sound.add("move"), + win: this.sound.add("win"), + }; + } + playAudio(t) { + this.audios[t].play(); + } + playRandom(t, e = 1) { + this.audios[t].play({ + rate: Phaser.Math.Between(1, 1.5), + detune: Phaser.Math.Between(-1e3, 1e3), + delay: 0, + volume: e, + }); + } + update() { + Phaser.Input.Keyboard.JustDown(this.R) && this.restartScene(); + } + finishScene() { + if (this.solved) return; + this.playAudio("win"), (this.solved = !0); + const t = +this.registry.get("moves") + this.totalMoves; + this.registry.set("moves", t), + (this.winText = this.add + .bitmapText(this.center_width, -100, "mario", "STAGE CLEARED!", 30) + .setOrigin(0.5) + .setTint(16769126) + .setDropShadow(2, 3, 7715143, 0.7)), + this.tweens.add({ + targets: this.winText, + duration: 500, + y: { from: this.winText.y, to: this.center_height }, + }), + this.tweens.add({ + targets: [this.winText, this.movesText], + duration: 100, + scale: { from: 1, to: 1.1 }, + repeat: -1, + yoyo: !0, + }), + this.time.delayedCall( + 2e3, + () => { + this.scene.start("transition", { + next: "underwater", + name: "STAGE", + number: this.number + 1, + }); + }, + null, + this + ); + } + restartScene() { + this.scene.start("game", { + next: "underwater", + name: "STAGE", + number: this.number, + }); + } + updateMoves() { + this.totalMoves++, + this.movesText.setText(this.totalMoves), + this.tweens.add({ + targets: [this.timerText], + duration: 200, + alpha: { from: 0.6, to: 1 }, + repeat: -1, + }); + } +} +const d = { + width: 608, + height: 608, + scale: { mode: t.Scale.FIT, autoCenter: t.Scale.CENTER_BOTH }, + autoRound: !1, + parent: "game-container", + physics: { default: "arcade", arcade: { gravity: { y: 0 }, debug: !1 } }, + plugins: {}, + scene: [e, i, a, n, s], +}; +new t.Game(d); diff --git a/pushpull/src/main.js b/pushpull/src/main.js index 7ebe5ec7..98fed64d 100644 --- a/pushpull/src/main.js +++ b/pushpull/src/main.js @@ -1,9 +1,9 @@ import Phaser from "phaser"; import Bootloader from "./scenes/bootloader"; +import Game from "./scenes/game"; import Outro from "./scenes/outro"; import Splash from "./scenes/splash"; import Transition from "./scenes/transition"; -import Game from "./scenes/game"; const config = { width: 608, @@ -13,7 +13,7 @@ const config = { autoCenter: Phaser.Scale.CENTER_BOTH, }, autoRound: false, - parent: "contenedor", + parent: "game-container", physics: { default: "arcade", arcade: { diff --git a/starshake/dist/assets/index-DEhXC0VF.js b/starshake/dist/assets/index-DEhXC0VF.js index 40ffce1c..6c9a6186 100644 --- a/starshake/dist/assets/index-DEhXC0VF.js +++ b/starshake/dist/assets/index-DEhXC0VF.js @@ -1 +1,1447 @@ -import{P as e}from"./phaser-CmFXOKba.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 s of e)if("childList"===s.type)for(const e of s.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)}}();class t extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.setLoadEvents(),this.loadFonts(),this.loadImages(),this.loadAudios(),this.loadSpritesheets(),this.setRegistry()}setLoadEvents(){this.load.on("progress",(function(e){this.progressBar.clear(),this.progressBar.fillStyle(34986,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*e,16)}),this),this.load.on("complete",(()=>{this.scene.start("splash")}),this)}loadFonts(){this.load.bitmapFont("wendy","assets/fonts/wendy.png","assets/fonts/wendy.xml")}loadImages(){this.load.image("logo","assets/images/logo.png"),this.load.image("pello_logo","assets/images/pello_logo.png"),this.load.image("background","assets/images/background.png"),Array(4).fill(0).forEach(((e,t)=>{this.load.image(`stage${t+1}`,`assets/images/stage${t+1}.png`)}))}loadAudios(){this.load.audio("shot","assets/sounds/shot.mp3"),this.load.audio("foeshot","assets/sounds/foeshot.mp3"),this.load.audio("foedestroy","assets/sounds/foedestroy.mp3"),this.load.audio("foexplosion","assets/sounds/foexplosion.mp3"),this.load.audio("explosion","assets/sounds/explosion.mp3"),this.load.audio("stageclear1","assets/sounds/stageclear1.mp3"),this.load.audio("stageclear2","assets/sounds/stageclear2.mp3"),this.load.audio("boss","assets/sounds/boss.mp3"),this.load.audio("splash","assets/sounds/splash.mp3"),Array(3).fill(0).forEach(((e,t)=>{this.load.audio(`music${t+1}`,`assets/sounds/music${t+1}.mp3`)}))}loadSpritesheets(){this.load.spritesheet("player1","assets/images/player1.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("foe0","assets/images/foe0.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("foe1","assets/images/foe1.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("foe2","assets/images/foe2.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("guinxu","assets/images/guinxu.png",{frameWidth:128,frameHeight:144}),this.load.spritesheet("plenny0","assets/images/plenny0.png",{frameWidth:64,frameHeight:64})}setRegistry(){this.registry.set("score_player1",0),this.registry.set("power_player1","water"),this.registry.set("lives_player1",0),this.registry.set("score_player2",0),this.registry.set("power_player2","water"),this.registry.set("lives_player2",0)}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(13893632,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class s extends Phaser.Scene{constructor(){super({key:"outro"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.introLayer=this.add.layer(),this.splashLayer=this.add.layer(),this.text=["Score: "+this.registry.get("score_player1"),"The evil forces among with","their tyrannical leader GUINXU","were finally wiped out.","Thanks to commander Alva","And the powah of the Plenny Shakes"," - press enter - "],this.showHistory(),this.showPlayer(),this.input.keyboard.on("keydown-ENTER",this.startSplash,this)}showHistory(){this.text.forEach(((e,t)=>{this.time.delayedCall(2e3*(t+1),(()=>this.showLine(e,60*(t+1))),null,this)})),this.time.delayedCall(4e3,(()=>this.showPlayer()),null,this)}showLine(e,t){let s=this.introLayer.add(this.add.bitmapText(this.center_width,t,"wendy",e,50).setOrigin(.5).setAlpha(0));this.tweens.add({targets:s,duration:2e3,alpha:1})}showPlayer(){this.player1=this.add.sprite(this.center_width,this.height-200,"player1").setOrigin(.5)}startSplash(){this.scene.start("splash")}}class i{constructor(e){this.scene=e}simpleClose(e){const t=this.scene.width/2,s=this.scene.add.rectangle(0-t,0,this.scene.width,this.scene.height,0).setOrigin(.5,0);this.scene.tweens.add({targets:s,duration:500,x:{from:-t/2,to:t},onComplete:()=>{e()}})}simpleOpen(e){const t=this.scene.width/2,s=this.scene.add.rectangle(t,0,this.scene.width,this.scene.height,0).setOrigin(.5,0);this.scene.tweens.add({targets:s,duration:500,x:{from:t,to:-t},onComplete:()=>{e()}})}close(e){const t=this.scene.width/2,s=this.scene.add.rectangle(0-t,0,this.scene.width/2,this.scene.height,0).setOrigin(.5,0),i=this.scene.add.rectangle(this.scene.width,0,this.scene.width/2,this.scene.height,0).setOrigin(0,0);this.scene.tweens.add({targets:s,duration:1e3,x:{from:-t/2,to:t/2}},{targets:i,duration:1e3,x:{from:this.scene.width,to:t},onComplete:()=>{e()}})}}class h extends Phaser.Scene{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.addBackground(),this.showLogo(),this.registry.set("currentPowerUp",0),this.time.delayedCall(1e3,(()=>this.showInstructions()),null,this),this.input.keyboard.on("keydown-SPACE",(()=>this.transitionToChange()),this),this.playMusic()}addBackground(){this.background=this.add.tileSprite(0,0,this.width,this.height,"background").setOrigin(0).setScrollFactor(0,1)}update(){this.background.tilePositionY-=2,this.background.tilePositionX+=2}transitionToChange(){new i(this).simpleClose(this.startGame.bind(this))}startGame(){this.theme&&this.theme.stop(),this.scene.start("transition",{next:"game",name:"STAGE",number:1,time:30})}showLogo(){this.gameLogoShadow=this.add.image(this.center_width,250,"logo").setScale(.7).setOrigin(.5),this.gameLogoShadow.setOrigin(.48),this.gameLogoShadow.tint=4083267,this.gameLogoShadow.alpha=.6,this.gameLogo=this.add.image(this.center_width,250,"logo").setScale(.7).setOrigin(.5),this.tweens.add({targets:[this.gameLogo,this.gameLogoShadow],duration:500,y:{from:-200,to:250}}),this.tweens.add({targets:[this.gameLogo,this.gameLogoShadow],duration:1500,y:{from:250,to:200},repeat:-1,yoyo:!0})}playMusic(e="splash"){this.theme=this.sound.add(e),this.theme.stop(),this.theme.play({mute:!1,volume:.5,rate:1,detune:0,seek:0,loop:!0,delay:0})}showInstructions(){this.add.bitmapText(this.center_width,450,"wendy","Arrows to move",60).setOrigin(.5).setDropShadow(3,4,2236962,.7),this.add.bitmapText(this.center_width,500,"wendy","SPACE to shoot",60).setOrigin(.5).setDropShadow(3,4,2236962,.7),this.add.sprite(this.center_width-95,598,"pello_logo").setOrigin(.5).setScale(.3).setTint(0).setAlpha(.7),this.add.sprite(this.center_width-100,590,"pello_logo").setOrigin(.5).setScale(.3),this.add.bitmapText(this.center_width+30,590,"wendy","PELLO",50).setOrigin(.5).setDropShadow(3,4,2236962,.7),this.space=this.add.bitmapText(this.center_width,680,"wendy","Press SPACE to start",60).setOrigin(.5).setDropShadow(3,4,2236962,.7),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}}class a extends Phaser.Scene{constructor(){super({key:"transition"})}init(e){this.name=e.name,this.number=e.number,this.next=e.next}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.sound.add("stageclear2").play(),this.add.bitmapText(this.center_width,this.center_height-50,"wendy",["Fire at will","Beware the tanks","Shoot down the UFOs","FINAL BOSS"][this.number-1],100).setOrigin(.5),this.add.bitmapText(this.center_width,this.center_height+50,"wendy","Ready player 1",80).setOrigin(.5),this.playMusic("music"+(4!==this.number?this.number:1)),this.time.delayedCall(2e3,(()=>this.loadNext()),null,this)}loadNext(){this.scene.start(this.next,{name:this.name,number:this.number,time:this.time})}playMusic(e="music1"){this.theme=this.sound.add(e),this.theme.play({mute:!1,volume:.4,rate:1,detune:0,seek:0,loop:!0,delay:0})}}const o={chocolate:{color:11501655,radius:16,intensity:.4},vanila:{color:16774869,radius:16,intensity:.4},fruit:{color:65280,radius:16,intensity:.4},water:{color:204,radius:16,intensity:.4},foe:{color:16773151,radius:16,intensity:.4}};class n extends Phaser.GameObjects.PointLight{constructor(e,t,s,i="water",h,a=0,n=-300){const{color:r,radius:d,intensity:c}=o[i];super(e,t,s,r,d,c),this.name="foeshot",this.scene=e,this.playerName=h,this.spawnShadow(t,s,a,n),e.add.existing(this),e.physics.add.existing(this),"guinxu"===h&&this.body.setVelocity(a,n),this.body.setAllowGravity(!1),this.body.setCollideWorldBounds(!0),this.body.onWorldBounds=!0,this.body.setCircle(10),this.body.setOffset(6,9),this.init()}spawnShadow(e,t,s,i){this.shadow=this.scene.add.circle(e+20,t+20,10,0).setAlpha(.4),this.scene.add.existing(this.shadow),this.scene.physics.add.existing(this.shadow),"guinxu"===this.playerName&&this.shadow.body.setVelocity(s,i)}init(){this.scene.tweens.add({targets:this,duration:200,intensity:{from:.3,to:.7},repeat:-1})}shot(){const e=this.scene.add.circle(this.x,this.y,5).setStrokeStyle(10,16777215);this.showPoints(50),this.scene.tweens.add({targets:e,radius:{from:5,to:20},alpha:{from:1,to:0},duration:250,onComplete:()=>{e.destroy()}}),this.destroy()}showPoints(e,t=16711680){let s=this.scene.add.bitmapText(this.x+20,this.y-30,"wendy","+"+e,40,t).setOrigin(.5);this.scene.tweens.add({targets:s,duration:800,alpha:{from:1,to:0},y:{from:this.y-20,to:this.y-80},onComplete:()=>{s.destroy()}})}}class r{constructor(e,t,s,i=5,h=5,a=7){this.scene=e,this.radius=i,this.x=t,this.y=s,this.lights=Array(Phaser.Math.Between(h,a)).fill(0).map(((t,s)=>{const i=this.x+Phaser.Math.Between(-this.radius/2,this.radius/2),h=this.y+Phaser.Math.Between(-this.radius/2,-this.radius/2),a=Phaser.Math.Between(16711680,16777164),o=Phaser.Math.Between(this.radius/2,this.radius),n=Phaser.Math.Between(.3,.8);return e.lights.addPointLight(i,h,a,o,n)})),this.init()}init(){this.scene.tweens.add({targets:this.lights,duration:Phaser.Math.Between(600,1e3),scale:{from:1,to:0}})}}const d={foe0:{points:400,lives:1},foe1:{points:500,lives:3},foe2:{points:800,lives:2},guinxu:{points:1e4,lives:20}};class c extends Phaser.GameObjects.Sprite{constructor(e,t,s,i="foe0",h=0,a=0){super(e,t,s,i),this.name=i,this.points=d[i].points,this.lives=d[i].lives,this.id=Math.random(),"foe2"!==this.name&&this.spawnShadow(t,s),e.add.existing(this),e.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setCircle(19),this.body.setOffset(12,12),this.body.setVelocityX(h),this.body.setVelocityY(a),this.setData("vector",new Phaser.Math.Vector2),"guinxu"===this.name&&this.setGuinxuShot(),this.init()}setGuinxuShot(){this.patternIndex=0,this.pattern=Phaser.Utils.Array.NumberArrayStep(-300,300,50),this.pattern=this.pattern.concat(Phaser.Utils.Array.NumberArrayStep(300,-300,-50)),this.scene.tweens.add({targets:this,duration:2e3,y:{from:this.y,to:this.y+Phaser.Math.Between(100,-100)},x:{from:this.x,to:this.x+Phaser.Math.Between(100,-100)},yoyo:!0,repeat:-1})}spawnShadow(e,t){this.shadow=this.scene.add.image(e+20,t+20,this.name).setScale(.7).setTint(0).setAlpha(.4)}updateShadow(){this.shadow.x=this.x+20,this.shadow.y=this.y+20}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name),frameRate:10,repeat:-1}),this.anims.play(this.name,!0),this.direction=-1}update(){if(this.y>this.scene.height+64&&("foe2"!==this.name&&this.shadow.destroy(),this.destroy()),"guinxu"===this.name&&Phaser.Math.Between(1,6)>5)this.guinxuShot();else if(Phaser.Math.Between(1,101)>100){if(!this.scene||!this.scene.player)return;this.scene.playAudio("foeshot");let e=new n(this.scene,this.x,this.y,"foe",this.name);this.scene.foeShots.add(e),this.scene.physics.moveTo(e,this.scene.player.x,this.scene.player.y,300),this.scene.physics.moveTo(e.shadow,this.scene.player.x,this.scene.player.y,300)}"foe2"!==this.name&&this.updateShadow()}guinxuShot(){if(!this.scene||!this.scene.player)return;this.scene.playAudio("foeshot");let e=new n(this.scene,this.x,this.y,"foe",this.name,this.pattern[this.patternIndex],300);this.scene.foeShots.add(e),this.patternIndex=this.patternIndex+1===this.pattern.length?0:++this.patternIndex}dead(){let e=60,t=20;"guinxu"===this.name&&(e=220,t=220,this.scene.cameras.main.shake(500));const s=this.scene.add.circle(this.x,this.y,5).setStrokeStyle(20,16777215);this.showPoints(this.points),this.scene.tweens.add({targets:s,radius:{from:10,to:e},alpha:{from:1,to:.3},duration:250,onComplete:()=>{s.destroy()}}),new r(this.scene,this.x,this.y,t),"foe2"!==this.name&&this.scene&&this.scene.scene.isActive()&&this.shadow&&this.shadow.active&&this.shadow.destroy(),"guinxu"===this.name&&(this.scene.number=5,this.scene.playAudio("explosion"),this.scene.endScene()),this.destroy()}showPoints(e,t=16711680){let s=this.scene.add.bitmapText(this.x+20,this.y-30,"wendy","+"+e,40,t).setOrigin(.5);this.scene.tweens.add({targets:s,duration:800,alpha:{from:1,to:0},y:{from:this.y-20,to:this.y-80},onComplete:()=>{s.destroy()}})}}class l{constructor(e){this.scene=e,this.waveFoes=[],this.generate(),this.activeWave=!1,this.waves=0}generate(){4===this.scene.number?this.scene.time.delayedCall(2e3,(()=>this.releaseGuinxu()),null,this):(this.generateEvent1=this.scene.time.addEvent({delay:7e3,callback:()=>this.orderedWave(),callbackScope:this,loop:!0}),this.generateEvent2=this.scene.time.addEvent({delay:15e3,callback:()=>this.wave(),callbackScope:this,loop:!0}),this.scene.number>1&&(this.generateEvent3=this.scene.time.addEvent({delay:3e3,callback:()=>this.tank(),callbackScope:this,loop:!0})),this.scene.number>2&&(this.generateEvent4=this.scene.time.addEvent({delay:5e3,callback:()=>this.slider(),callbackScope:this,loop:!0})))}releaseGuinxu(){const e=new c(this.scene,Phaser.Math.Between(200,600),200,"guinxu",0,20);this.scene.playAudio("boss"),this.laughterEvent=this.scene.time.addEvent({delay:1e4,callback:()=>{this.scene.playAudio("boss")},callbackScope:this,loop:!0}),this.scene.tweens.add({targets:e,alpha:{from:.3,to:1},duration:200,repeat:10}),this.scene.foeGroup.add(e)}stop(){clearInterval(this.generationIntervalId),this.scene.foeGroup.children.entries.forEach((e=>{null!==e&&e.active&&e.destroy()}))}finishScene(){this.generateEvent1.destroy(),this.generateEvent2.destroy(),this.scene.number>1&&this.generateEvent3.destroy(),this.scene.number>2&&this.generateEvent4.destroy(),this.scene.endScene()}createPath(){this.waves++,3===this.waves&&this.finishScene();const e=Phaser.Math.Between(100,600);this.path=new Phaser.Curves.Path(e,0),this.path.lineTo(e,Phaser.Math.Between(20,50));for(let t=0;t<8;t++)t%2==0?this.path.lineTo(e,50+62.5*(t+1)):this.path.lineTo(e+300,50+62.5*(t+1));this.path.lineTo(e,this.scene.height+50),this.graphics=this.scene.add.graphics(),this.graphics.lineStyle(0,16777215,0)}orderedWave(e=5){const t=Phaser.Math.Between(64,this.scene.width-200),s=Phaser.Math.Between(-100,0),i=Phaser.Math.Between(-1,1)>0?1:-1;Array(e).fill().forEach(((e,h)=>this.addOrder(h,t,s,i)))}wave(e=5){this.createPath(),Phaser.Math.Between(64,this.scene.width-200),Phaser.Math.Between(-100,0),Phaser.Math.Between(-1,1),Array(e).fill().forEach(((e,t)=>this.addToWave(t))),this.activeWave=!0}tank(){this.scene.foeGroup.add(new c(this.scene,Phaser.Math.Between(100,600),-100,"foe2",0,620))}slider(){let e=-200,t=0;Phaser.Math.Between(-1,1)>0?(e=200,t=-100):t=this.scene.width+100;const s=new c(this.scene,t,Phaser.Math.Between(100,600),"foe1",e,0);this.scene.tweens.add({targets:[s,s.shadow],duration:500,rotation:"+=5",repeat:-1}),this.scene.foeGroup.add(s)}add(){const e=new c(this.scene,Phaser.Math.Between(32,this.scene.width-32),0);this.scene.foeGroup.add(e)}addOrder(e,t,s,i){const h=70*i;this.scene.foeGroup.add(new c(this.scene,t+70*e,e*s+h,"foe0",0,300))}addToWave(e){const t=new c(this.scene,Phaser.Math.Between(32,this.scene.width-32),0,"foe0");this.scene.tweens.add({targets:t,z:1,ease:"Linear",duration:12e3,repeat:-1,delay:100*e}),this.scene.foeWaveGroup.add(t)}update(){this.path&&(this.path.draw(this.graphics),this.scene.foeWaveGroup.children.entries.forEach((e=>{if(null===e||!e.active)return;let t=e.z,s=e.getData("vector");this.path.getPoint(t,s),e.setPosition(s.x,s.y),e.shadow.setPosition(s.x+20,s.y+20),e.setDepth(e.y)})),this.activeWave&&this.checkIfWaveDestroyed()&&(this.activeWave=!1,this.scene.spawnShake(),this.path.destroy())),this.scene.foeGroup.children.entries.forEach((e=>{(null===e||!e.active||e.y>this.scene.height+100)&&e.destroy(),e.update()}))}checkIfWaveDestroyed(){const e=this.scene.foeWaveGroup.children.entries;return e.length===e.filter((e=>!e.active)).length}}class p extends Phaser.GameObjects.PointLight{constructor(e,t,s,i=16777215,h=5,a=.5){super(e,t,s,i,h,a),this.name="celtic",this.scene=e,e.add.existing(this),e.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setVelocityY(300),this.init()}init(){this.scene.tweens.add({targets:this,duration:Phaser.Math.Between(600,1e3),scale:{from:1,to:3},alpha:{from:this.alpha,to:0},onComplete:()=>{this.destroy()}})}}const y={chocolate:{color:11501655,radius:16,intensity:.4},vanila:{color:16774869,radius:16,intensity:.4},fruit:{color:16777215,radius:16,intensity:.4},water:{color:16777215,radius:16,intensity:.4},foe:{color:65280,radius:16,intensity:.4}};class u extends Phaser.GameObjects.PointLight{constructor(e,t,s,i="water",h,a=0,o=-500){const{color:n,radius:r,intensity:d}=y[i];super(e,t,s,n,r,d),this.name="shot",this.playerName=h,e.add.existing(this),e.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setVelocityX(a),this.body.setVelocityY(o),this.body.setCircle(10),this.body.setOffset(6,9),this.body.setCollideWorldBounds(!0),this.body.onWorldBounds=!0,this.spawnShadow(t,s,a,o),this.init()}spawnShadow(e,t,s,i){this.shadow=this.scene.add.circle(e+20,t+20,10,0).setAlpha(.4),this.scene.add.existing(this.shadow),this.scene.physics.add.existing(this.shadow),this.shadow.body.setVelocityX(s),this.shadow.body.setVelocityY(i)}init(){this.scene.tweens.add({targets:this,duration:200,intensity:{from:.3,to:.7},repeat:-1})}}class m{constructor(e,t){this.scene=e,this.name=t,this.shootingMethods={water:this.single.bind(this),fruit:this.tri.bind(this),vanila:this.quintus.bind(this),chocolate:this.massacre.bind(this)}}shoot(e,t,s){this.shootingMethods[s](e,t,s)}single(e,t,s){this.scene.shots.add(new u(this.scene,e,t,s,this.name))}tri(e,t,s){this.scene.shots.add(new u(this.scene,e,t,s,this.name,-60)),this.scene.shots.add(new u(this.scene,e,t,s,this.name)),this.scene.shots.add(new u(this.scene,e,t,s,this.name,60))}quintus(e,t,s){this.scene.shots.add(new u(this.scene,e,t,s,this.name,-300)),this.scene.shots.add(new u(this.scene,e,t,s,this.name,300)),this.scene.shots.add(new u(this.scene,e,t,s,this.name,-300,500)),this.scene.shots.add(new u(this.scene,e,t,s,this.name,300,500))}massacre(e,t,s){this.scene.shots.add(new u(this.scene,e,t,s,this.name,300,0)),this.scene.shots.add(new u(this.scene,e,t,s,this.name,-300,0)),this.scene.shots.add(new u(this.scene,e,t,s,this.name,0,500)),this.scene.shots.add(new u(this.scene,e,t,s,this.name,30)),this.scene.shots.add(new u(this.scene,e,t,s,this.name,60))}}class g extends Phaser.GameObjects.Sprite{constructor(e,t,s,i="player1",h="water"){super(e,t,s,i),this.name=i,this.spawnShadow(t,s),this.powerUp=h,this.id=Math.random(),e.add.existing(this),e.physics.add.existing(this),this.body.setCollideWorldBounds(!0),this.body.setAllowGravity(!1),this.body.setCircle(26),this.body.setOffset(6,9),this.power=0,this.blinking=!1,this.shootingPatterns=new m(this.scene,this.name),this.init(),this.setControls()}spawnShadow(e,t){this.shadow=this.scene.add.image(e+20,t+20,"player1").setTint(0).setAlpha(.4)}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:0}),frameRate:10,repeat:-1}),this.scene.anims.create({key:this.name+"right",frames:this.scene.anims.generateFrameNumbers(this.name,{start:1,end:1}),frameRate:10,repeat:-1}),this.scene.anims.create({key:this.name+"left",frames:this.scene.anims.generateFrameNumbers(this.name,{start:2,end:2}),frameRate:10,repeat:-1}),this.anims.play(this.name,!0),this.upDelta=0}setControls(){this.SPACE=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE),this.cursor=this.scene.input.keyboard.createCursorKeys(),this.W=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W),this.A=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.A),this.S=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S),this.D=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.D)}shoot(){this.scene.playAudio("shot"),this.shootingPatterns.shoot(this.x,this.y,this.powerUp)}update(e,t){this.death||(this.cursor.left.isDown?(this.x-=5,this.anims.play(this.name+"left",!0),this.shadow.setScale(.5,1)):this.cursor.right.isDown?(this.x+=5,this.anims.play(this.name+"right",!0),this.shadow.setScale(.5,1)):(this.anims.play(this.name,!0),this.shadow.setScale(1,1)),this.cursor.up.isDown?this.y-=5:this.cursor.down.isDown&&(this.y+=5),Phaser.Input.Keyboard.JustDown(this.SPACE)&&this.shoot(),this.scene.trailLayer.add(new p(this.scene,this.x,this.y,16777215,10)),this.updateShadow())}updateShadow(){this.shadow.x=this.x+20,this.shadow.y=this.y+20}showPoints(e,t=16711680){let s=this.scene.add.bitmapText(this.x+20,this.y-30,"starshipped",e,20,16776503).setOrigin(.5);this.scene.tweens.add({targets:s,duration:2e3,alpha:{from:1,to:0},y:{from:s.y-10,to:s.y-100}})}dead(){const e=this.scene.add.circle(this.x,this.y,10).setStrokeStyle(40,16777215);this.scene.tweens.add({targets:e,radius:{from:10,to:512},alpha:{from:1,to:.3},duration:300,onComplete:()=>{e.destroy()}}),this.scene.cameras.main.shake(500),this.death=!0,this.shadow.destroy(),new r(this.scene,this.x,this.y,40),super.destroy()}}class w extends Phaser.GameObjects.Sprite{constructor(e,t,s,i="plenny0",h="fruit"){super(e,t,s,i),this.name=i,this.power=h,this.scene=e,this.id=Math.random(),this.spawnShadow(t,s),e.add.existing(this),e.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setCircle(19),this.body.setOffset(12,12),this.body.setVelocityX(-100),this.init()}spawnShadow(e,t){this.shadow=this.scene.add.image(e+20,t+20,"plenny0").setTint(0).setAlpha(.4),this.scene.physics.add.existing(this.shadow),this.shadow.body.setVelocityX(-100)}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name),frameRate:10,repeat:-1}),this.scene.tweens.add({targets:[this],duration:5e3,x:{from:this.x,to:0},y:{from:this.y-10,to:this.y+10},scale:{from:.8,to:1},repeat:-1,yoyo:!0}),this.scene.tweens.add({targets:this.shadow,duration:5e3,x:{from:this.shadow.x,to:0},y:{from:this.shadow.y-10,to:this.y+10},scale:{from:.8,to:1},repeat:-1,yoyo:!0}),this.anims.play(this.name,!0),this.body.setVelocityX(-100),this.shadow.body.setVelocityX(-100),this.direction=-1}destroy(){this.shadow.destroy(),super.destroy()}}class f extends Phaser.Scene{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null}init(e){this.name=e.name,this.number=e.number,this.next=e.next,this.currentPowerUp=+this.registry.get("currentPowerUp")}create(){this.duration=1e3*this.time,this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,new i(this).simpleOpen((()=>0)),this.addBackground(),this.cameras.main.setBackgroundColor(3355443),this.lights.enable(),this.lights.setAmbientColor(6710886),this.addScores(),this.addFoes(),this.addPlayers(),this.addPowerUps(),this.addShots(),this.loadAudios(),this.addColliders()}addBackground(){this.background=this.add.tileSprite(0,0,this.width,this.height,"stage"+this.number).setOrigin(0).setScrollFactor(0,1)}spawnShake(){const{x:e,y:t}=this.lastDestroyedWaveFoe;this.shake=new w(this,e,t),this.powerUps.add(this.shake)}addScores(){this.scores={player1:{},player2:{}},this.scores.player1.scoreText=this.add.bitmapText(150,16,"wendy",String(this.registry.get("score_player1")).padStart(6,"0"),50).setOrigin(.5).setScrollFactor(0),this.scores.player2.scoreText=this.add.bitmapText(this.width-150,16,"wendy","0".padStart(6,"0"),50).setOrigin(.5).setScrollFactor(0)}addPlayers(){this.trailLayer=this.add.layer(),this.players=this.add.group(),this.player=new g(this,this.center_width,this.center_height),this.players.add(this.player)}addShots(){this.shotsLayer=this.add.layer(),this.shots=this.add.group()}addFoes(){this.foeGroup=this.add.group(),this.foeWaveGroup=this.add.group(),this.foeShots=this.add.group(),this.foes=new l(this)}addPowerUps(){this.available=["fruit","vanila","chocolate"],this.powerUps=this.add.group()}addColliders(){this.physics.add.collider(this.players,this.foeGroup,this.crashFoe,(()=>!0),this),this.physics.add.collider(this.players,this.foeWaveGroup,this.crashFoe,(()=>!0),this),this.physics.add.overlap(this.shots,this.foeGroup,this.destroyFoe,(()=>!0),this),this.physics.add.overlap(this.shots,this.foeWaveGroup,this.destroyWaveFoe,(()=>!0),this),this.physics.add.collider(this.players,this.powerUps,this.pickPowerUp,(()=>!0),this),this.physics.add.overlap(this.players,this.foeShots,this.hitPlayer,(()=>!0),this),this.physics.add.collider(this.shots,this.foeShots,this.destroyShot,(()=>!0),this),this.physics.world.on("worldbounds",this.onWorldBounds)}onWorldBounds(e,t){const s=e.gameObject.name.toString();["foeshot","shot"].includes(s)&&(e.gameObject.shadow.destroy(),e.gameObject.destroy())}destroyShot(e,t){const s=this.lights.addPointLight(e.x,e.y,16777215,10,.7);this.tweens.add({targets:s,duration:400,scale:{from:1,to:0}}),this.playAudio("foexplosion"),e.shadow.destroy(),e.destroy(),t.shadow.destroy(),t.shot(),this.updateScore(e.playerName,50)}destroyWaveFoe(e,t){this.lastDestroyedWaveFoe={x:t.x,y:t.y},this.destroyFoe(e,t)}destroyFoe(e,t){t.lives--,this.playAudio("foexplosion");const s=this.lights.addPointLight(e.x,e.y,16777215,10,.7);if(this.tweens.add({targets:s,duration:400,scale:{from:1,to:0}}),this.tweens.add({targets:t,duration:400,tint:{from:16777215,to:16711680}}),this.updateScore(e.playerName,50),this.tweens.add({targets:t,y:"-=10",yoyo:!0,duration:100}),e.destroy(),0===t.lives){this.playAudio("foedestroy");const s=this.lights.addPointLight(e.x,e.y,16777215,10,.7);this.tweens.add({targets:s,duration:400,scale:{from:1,to:0}}),this.updateScore(e.playerName,t.points),t.dead()}}hitPlayer(e,t){e.blinking||(this.players.remove(this.player),e.dead(),this.playAudio("explosion"),t.shadow.destroy(),t.destroy(),this.time.delayedCall(1e3,(()=>this.respawnPlayer()),null,this))}crashFoe(e,t){e.blinking||(e.dead(),this.playAudio("explosion"),t.dead(),this.time.delayedCall(1e3,(()=>this.respawnPlayer()),null,this))}pickPowerUp(e,t){this.playAudio("stageclear1"),this.updatePowerUp(e,t),this.tweens.add({targets:e,duration:200,alpha:{from:.5,to:1},scale:{from:1.4,to:1},repeat:3}),t.destroy()}respawnPlayer(){this.player=new g(this,this.center_width,this.center_height),this.player.blinking=!0,this.players.add(this.player),this.tweens.add({targets:this.player,duration:100,alpha:{from:0,to:1},repeat:10,onComplete:()=>{this.player.blinking=!1}})}loadAudios(){this.audios={shot:this.sound.add("shot"),foeshot:this.sound.add("foeshot"),explosion:this.sound.add("explosion"),foexplosion:this.sound.add("foexplosion"),foedestroy:this.sound.add("foedestroy"),stageclear1:this.sound.add("stageclear1"),stageclear2:this.sound.add("stageclear2"),boss:this.sound.add("boss")}}playAudio(e){this.audios[e].play()}update(){this.player&&this.player.update(),this.foes.update(),this.background.tilePositionY-=10}endScene(){this.foeWaveGroup.children.entries.forEach((e=>e.shadow.destroy())),this.foeGroup.children.entries.forEach((e=>e.shadow.destroy())),this.shots.children.entries.forEach((e=>e.shadow.destroy())),this.foeShots.children.entries.forEach((e=>e.shadow.destroy())),this.time.delayedCall(2e3,(()=>{this.finishScene()}),null,this)}finishScene(){this.game.sound.stopAll(),this.scene.stop("game");const e=this.number<5?"transition":"outro";this.scene.start(e,{next:"game",name:"STAGE",number:this.number+1})}updatePowerUp(e,t){e.powerUp=this.available[this.currentPowerUp],this.currentPowerUp=this.currentPowerUp+1===this.available.length?this.currentPowerUp:this.currentPowerUp+1,this.registry.set("currentPowerUp",this.currentPowerUp)}updateScore(e,t=0){const s=+this.registry.get("score_"+e)+t;this.registry.set("score_"+e,s),this.scores[e].scoreText.setText(String(s).padStart(6,"0")),this.tweens.add({targets:this.scores[e].scoreText,duration:200,tint:{from:255,to:16777215},scale:{from:1.2,to:1},repeat:2})}}const b={width:1e3,height:800,scale:{mode:e.Scale.FIT,autoCenter:e.Scale.CENTER_BOTH},autoRound:!1,parent:"contenedor",physics:{default:"arcade",arcade:{gravity:{y:0},debug:!1}},scene:[t,h,a,f,s]};new e.Game(b); +import { P as e } from "./phaser-CmFXOKba.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 s of e) + if ("childList" === s.type) + for (const e of s.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); + } +})(); +class t extends Phaser.Scene { + constructor() { + super({ key: "bootloader" }); + } + preload() { + this.createBars(), + this.setLoadEvents(), + this.loadFonts(), + this.loadImages(), + this.loadAudios(), + this.loadSpritesheets(), + this.setRegistry(); + } + setLoadEvents() { + this.load.on( + "progress", + function (e) { + this.progressBar.clear(), + this.progressBar.fillStyle(34986, 1), + this.progressBar.fillRect( + this.cameras.main.width / 4, + this.cameras.main.height / 2 - 16, + (this.cameras.main.width / 2) * e, + 16 + ); + }, + this + ), + this.load.on( + "complete", + () => { + this.scene.start("splash"); + }, + this + ); + } + loadFonts() { + this.load.bitmapFont( + "wendy", + "assets/fonts/wendy.png", + "assets/fonts/wendy.xml" + ); + } + loadImages() { + this.load.image("logo", "assets/images/logo.png"), + this.load.image("pello_logo", "assets/images/pello_logo.png"), + this.load.image("background", "assets/images/background.png"), + Array(4) + .fill(0) + .forEach((e, t) => { + this.load.image(`stage${t + 1}`, `assets/images/stage${t + 1}.png`); + }); + } + loadAudios() { + this.load.audio("shot", "assets/sounds/shot.mp3"), + this.load.audio("foeshot", "assets/sounds/foeshot.mp3"), + this.load.audio("foedestroy", "assets/sounds/foedestroy.mp3"), + this.load.audio("foexplosion", "assets/sounds/foexplosion.mp3"), + this.load.audio("explosion", "assets/sounds/explosion.mp3"), + this.load.audio("stageclear1", "assets/sounds/stageclear1.mp3"), + this.load.audio("stageclear2", "assets/sounds/stageclear2.mp3"), + this.load.audio("boss", "assets/sounds/boss.mp3"), + this.load.audio("splash", "assets/sounds/splash.mp3"), + Array(3) + .fill(0) + .forEach((e, t) => { + this.load.audio(`music${t + 1}`, `assets/sounds/music${t + 1}.mp3`); + }); + } + loadSpritesheets() { + this.load.spritesheet("player1", "assets/images/player1.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("foe0", "assets/images/foe0.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("foe1", "assets/images/foe1.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("foe2", "assets/images/foe2.png", { + frameWidth: 32, + frameHeight: 32, + }), + this.load.spritesheet("guinxu", "assets/images/guinxu.png", { + frameWidth: 128, + frameHeight: 144, + }), + this.load.spritesheet("plenny0", "assets/images/plenny0.png", { + frameWidth: 64, + frameHeight: 64, + }); + } + setRegistry() { + this.registry.set("score_player1", 0), + this.registry.set("power_player1", "water"), + this.registry.set("lives_player1", 0), + this.registry.set("score_player2", 0), + this.registry.set("power_player2", "water"), + this.registry.set("lives_player2", 0); + } + createBars() { + (this.loadBar = this.add.graphics()), + this.loadBar.fillStyle(13893632, 1), + this.loadBar.fillRect( + this.cameras.main.width / 4 - 2, + this.cameras.main.height / 2 - 18, + this.cameras.main.width / 2 + 4, + 20 + ), + (this.progressBar = this.add.graphics()); + } +} +class s extends Phaser.Scene { + constructor() { + super({ key: "outro" }); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + (this.introLayer = this.add.layer()), + (this.splashLayer = this.add.layer()), + (this.text = [ + "Score: " + this.registry.get("score_player1"), + "The evil forces among with", + "their tyrannical leader GUINXU", + "were finally wiped out.", + "Thanks to commander Alva", + "And the powah of the Plenny Shakes", + " - press enter - ", + ]), + this.showHistory(), + this.showPlayer(), + this.input.keyboard.on("keydown-ENTER", this.startSplash, this); + } + showHistory() { + this.text.forEach((e, t) => { + this.time.delayedCall( + 2e3 * (t + 1), + () => this.showLine(e, 60 * (t + 1)), + null, + this + ); + }), + this.time.delayedCall(4e3, () => this.showPlayer(), null, this); + } + showLine(e, t) { + let s = this.introLayer.add( + this.add + .bitmapText(this.center_width, t, "wendy", e, 50) + .setOrigin(0.5) + .setAlpha(0) + ); + this.tweens.add({ targets: s, duration: 2e3, alpha: 1 }); + } + showPlayer() { + this.player1 = this.add + .sprite(this.center_width, this.height - 200, "player1") + .setOrigin(0.5); + } + startSplash() { + this.scene.start("splash"); + } +} +class i { + constructor(e) { + this.scene = e; + } + simpleClose(e) { + const t = this.scene.width / 2, + s = this.scene.add + .rectangle(0 - t, 0, this.scene.width, this.scene.height, 0) + .setOrigin(0.5, 0); + this.scene.tweens.add({ + targets: s, + duration: 500, + x: { from: -t / 2, to: t }, + onComplete: () => { + e(); + }, + }); + } + simpleOpen(e) { + const t = this.scene.width / 2, + s = this.scene.add + .rectangle(t, 0, this.scene.width, this.scene.height, 0) + .setOrigin(0.5, 0); + this.scene.tweens.add({ + targets: s, + duration: 500, + x: { from: t, to: -t }, + onComplete: () => { + e(); + }, + }); + } + close(e) { + const t = this.scene.width / 2, + s = this.scene.add + .rectangle(0 - t, 0, this.scene.width / 2, this.scene.height, 0) + .setOrigin(0.5, 0), + i = this.scene.add + .rectangle( + this.scene.width, + 0, + this.scene.width / 2, + this.scene.height, + 0 + ) + .setOrigin(0, 0); + this.scene.tweens.add( + { targets: s, duration: 1e3, x: { from: -t / 2, to: t / 2 } }, + { + targets: i, + duration: 1e3, + x: { from: this.scene.width, to: t }, + onComplete: () => { + e(); + }, + } + ); + } +} +class h extends Phaser.Scene { + constructor() { + super({ key: "splash" }); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.addBackground(), + this.showLogo(), + this.registry.set("currentPowerUp", 0), + this.time.delayedCall(1e3, () => this.showInstructions(), null, this), + this.input.keyboard.on( + "keydown-SPACE", + () => this.transitionToChange(), + this + ), + this.playMusic(); + } + addBackground() { + this.background = this.add + .tileSprite(0, 0, this.width, this.height, "background") + .setOrigin(0) + .setScrollFactor(0, 1); + } + update() { + (this.background.tilePositionY -= 2), (this.background.tilePositionX += 2); + } + transitionToChange() { + new i(this).simpleClose(this.startGame.bind(this)); + } + startGame() { + this.theme && this.theme.stop(), + this.scene.start("transition", { + next: "game", + name: "STAGE", + number: 1, + time: 30, + }); + } + showLogo() { + (this.gameLogoShadow = this.add + .image(this.center_width, 250, "logo") + .setScale(0.7) + .setOrigin(0.5)), + this.gameLogoShadow.setOrigin(0.48), + (this.gameLogoShadow.tint = 4083267), + (this.gameLogoShadow.alpha = 0.6), + (this.gameLogo = this.add + .image(this.center_width, 250, "logo") + .setScale(0.7) + .setOrigin(0.5)), + this.tweens.add({ + targets: [this.gameLogo, this.gameLogoShadow], + duration: 500, + y: { from: -200, to: 250 }, + }), + this.tweens.add({ + targets: [this.gameLogo, this.gameLogoShadow], + duration: 1500, + y: { from: 250, to: 200 }, + repeat: -1, + yoyo: !0, + }); + } + playMusic(e = "splash") { + (this.theme = this.sound.add(e)), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 0.5, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } + showInstructions() { + this.add + .bitmapText(this.center_width, 450, "wendy", "Arrows to move", 60) + .setOrigin(0.5) + .setDropShadow(3, 4, 2236962, 0.7), + this.add + .bitmapText(this.center_width, 500, "wendy", "SPACE to shoot", 60) + .setOrigin(0.5) + .setDropShadow(3, 4, 2236962, 0.7), + this.add + .sprite(this.center_width - 95, 598, "pello_logo") + .setOrigin(0.5) + .setScale(0.3) + .setTint(0) + .setAlpha(0.7), + this.add + .sprite(this.center_width - 100, 590, "pello_logo") + .setOrigin(0.5) + .setScale(0.3), + this.add + .bitmapText(this.center_width + 30, 590, "wendy", "PELLO", 50) + .setOrigin(0.5) + .setDropShadow(3, 4, 2236962, 0.7), + (this.space = this.add + .bitmapText(this.center_width, 680, "wendy", "Press SPACE to start", 60) + .setOrigin(0.5) + .setDropShadow(3, 4, 2236962, 0.7)), + this.tweens.add({ + targets: this.space, + duration: 300, + alpha: { from: 0, to: 1 }, + repeat: -1, + yoyo: !0, + }); + } +} +class a extends Phaser.Scene { + constructor() { + super({ key: "transition" }); + } + init(e) { + (this.name = e.name), (this.number = e.number), (this.next = e.next); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.sound.add("stageclear2").play(), + this.add + .bitmapText( + this.center_width, + this.center_height - 50, + "wendy", + [ + "Fire at will", + "Beware the tanks", + "Shoot down the UFOs", + "FINAL BOSS", + ][this.number - 1], + 100 + ) + .setOrigin(0.5), + this.add + .bitmapText( + this.center_width, + this.center_height + 50, + "wendy", + "Ready player 1", + 80 + ) + .setOrigin(0.5), + this.playMusic("music" + (4 !== this.number ? this.number : 1)), + this.time.delayedCall(2e3, () => this.loadNext(), null, this); + } + loadNext() { + this.scene.start(this.next, { + name: this.name, + number: this.number, + time: this.time, + }); + } + playMusic(e = "music1") { + (this.theme = this.sound.add(e)), + this.theme.play({ + mute: !1, + volume: 0.4, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } +} +const o = { + chocolate: { color: 11501655, radius: 16, intensity: 0.4 }, + vanila: { color: 16774869, radius: 16, intensity: 0.4 }, + fruit: { color: 65280, radius: 16, intensity: 0.4 }, + water: { color: 204, radius: 16, intensity: 0.4 }, + foe: { color: 16773151, radius: 16, intensity: 0.4 }, +}; +class n extends Phaser.GameObjects.PointLight { + constructor(e, t, s, i = "water", h, a = 0, n = -300) { + const { color: r, radius: d, intensity: c } = o[i]; + super(e, t, s, r, d, c), + (this.name = "foeshot"), + (this.scene = e), + (this.playerName = h), + this.spawnShadow(t, s, a, n), + e.add.existing(this), + e.physics.add.existing(this), + "guinxu" === h && this.body.setVelocity(a, n), + this.body.setAllowGravity(!1), + this.body.setCollideWorldBounds(!0), + (this.body.onWorldBounds = !0), + this.body.setCircle(10), + this.body.setOffset(6, 9), + this.init(); + } + spawnShadow(e, t, s, i) { + (this.shadow = this.scene.add.circle(e + 20, t + 20, 10, 0).setAlpha(0.4)), + this.scene.add.existing(this.shadow), + this.scene.physics.add.existing(this.shadow), + "guinxu" === this.playerName && this.shadow.body.setVelocity(s, i); + } + init() { + this.scene.tweens.add({ + targets: this, + duration: 200, + intensity: { from: 0.3, to: 0.7 }, + repeat: -1, + }); + } + shot() { + const e = this.scene.add + .circle(this.x, this.y, 5) + .setStrokeStyle(10, 16777215); + this.showPoints(50), + this.scene.tweens.add({ + targets: e, + radius: { from: 5, to: 20 }, + alpha: { from: 1, to: 0 }, + duration: 250, + onComplete: () => { + e.destroy(); + }, + }), + this.destroy(); + } + showPoints(e, t = 16711680) { + let s = this.scene.add + .bitmapText(this.x + 20, this.y - 30, "wendy", "+" + e, 40, t) + .setOrigin(0.5); + this.scene.tweens.add({ + targets: s, + duration: 800, + alpha: { from: 1, to: 0 }, + y: { from: this.y - 20, to: this.y - 80 }, + onComplete: () => { + s.destroy(); + }, + }); + } +} +class r { + constructor(e, t, s, i = 5, h = 5, a = 7) { + (this.scene = e), + (this.radius = i), + (this.x = t), + (this.y = s), + (this.lights = Array(Phaser.Math.Between(h, a)) + .fill(0) + .map((t, s) => { + const i = + this.x + Phaser.Math.Between(-this.radius / 2, this.radius / 2), + h = + this.y + Phaser.Math.Between(-this.radius / 2, -this.radius / 2), + a = Phaser.Math.Between(16711680, 16777164), + o = Phaser.Math.Between(this.radius / 2, this.radius), + n = Phaser.Math.Between(0.3, 0.8); + return e.lights.addPointLight(i, h, a, o, n); + })), + this.init(); + } + init() { + this.scene.tweens.add({ + targets: this.lights, + duration: Phaser.Math.Between(600, 1e3), + scale: { from: 1, to: 0 }, + }); + } +} +const d = { + foe0: { points: 400, lives: 1 }, + foe1: { points: 500, lives: 3 }, + foe2: { points: 800, lives: 2 }, + guinxu: { points: 1e4, lives: 20 }, +}; +class c extends Phaser.GameObjects.Sprite { + constructor(e, t, s, i = "foe0", h = 0, a = 0) { + super(e, t, s, i), + (this.name = i), + (this.points = d[i].points), + (this.lives = d[i].lives), + (this.id = Math.random()), + "foe2" !== this.name && this.spawnShadow(t, s), + e.add.existing(this), + e.physics.add.existing(this), + this.body.setAllowGravity(!1), + this.body.setCircle(19), + this.body.setOffset(12, 12), + this.body.setVelocityX(h), + this.body.setVelocityY(a), + this.setData("vector", new Phaser.Math.Vector2()), + "guinxu" === this.name && this.setGuinxuShot(), + this.init(); + } + setGuinxuShot() { + (this.patternIndex = 0), + (this.pattern = Phaser.Utils.Array.NumberArrayStep(-300, 300, 50)), + (this.pattern = this.pattern.concat( + Phaser.Utils.Array.NumberArrayStep(300, -300, -50) + )), + this.scene.tweens.add({ + targets: this, + duration: 2e3, + y: { from: this.y, to: this.y + Phaser.Math.Between(100, -100) }, + x: { from: this.x, to: this.x + Phaser.Math.Between(100, -100) }, + yoyo: !0, + repeat: -1, + }); + } + spawnShadow(e, t) { + this.shadow = this.scene.add + .image(e + 20, t + 20, this.name) + .setScale(0.7) + .setTint(0) + .setAlpha(0.4); + } + updateShadow() { + (this.shadow.x = this.x + 20), (this.shadow.y = this.y + 20); + } + init() { + this.scene.anims.create({ + key: this.name, + frames: this.scene.anims.generateFrameNumbers(this.name), + frameRate: 10, + repeat: -1, + }), + this.anims.play(this.name, !0), + (this.direction = -1); + } + update() { + if ( + (this.y > this.scene.height + 64 && + ("foe2" !== this.name && this.shadow.destroy(), this.destroy()), + "guinxu" === this.name && Phaser.Math.Between(1, 6) > 5) + ) + this.guinxuShot(); + else if (Phaser.Math.Between(1, 101) > 100) { + if (!this.scene || !this.scene.player) return; + this.scene.playAudio("foeshot"); + let e = new n(this.scene, this.x, this.y, "foe", this.name); + this.scene.foeShots.add(e), + this.scene.physics.moveTo( + e, + this.scene.player.x, + this.scene.player.y, + 300 + ), + this.scene.physics.moveTo( + e.shadow, + this.scene.player.x, + this.scene.player.y, + 300 + ); + } + "foe2" !== this.name && this.updateShadow(); + } + guinxuShot() { + if (!this.scene || !this.scene.player) return; + this.scene.playAudio("foeshot"); + let e = new n( + this.scene, + this.x, + this.y, + "foe", + this.name, + this.pattern[this.patternIndex], + 300 + ); + this.scene.foeShots.add(e), + (this.patternIndex = + this.patternIndex + 1 === this.pattern.length + ? 0 + : ++this.patternIndex); + } + dead() { + let e = 60, + t = 20; + "guinxu" === this.name && + ((e = 220), (t = 220), this.scene.cameras.main.shake(500)); + const s = this.scene.add + .circle(this.x, this.y, 5) + .setStrokeStyle(20, 16777215); + this.showPoints(this.points), + this.scene.tweens.add({ + targets: s, + radius: { from: 10, to: e }, + alpha: { from: 1, to: 0.3 }, + duration: 250, + onComplete: () => { + s.destroy(); + }, + }), + new r(this.scene, this.x, this.y, t), + "foe2" !== this.name && + this.scene && + this.scene.scene.isActive() && + this.shadow && + this.shadow.active && + this.shadow.destroy(), + "guinxu" === this.name && + ((this.scene.number = 5), + this.scene.playAudio("explosion"), + this.scene.endScene()), + this.destroy(); + } + showPoints(e, t = 16711680) { + let s = this.scene.add + .bitmapText(this.x + 20, this.y - 30, "wendy", "+" + e, 40, t) + .setOrigin(0.5); + this.scene.tweens.add({ + targets: s, + duration: 800, + alpha: { from: 1, to: 0 }, + y: { from: this.y - 20, to: this.y - 80 }, + onComplete: () => { + s.destroy(); + }, + }); + } +} +class l { + constructor(e) { + (this.scene = e), + (this.waveFoes = []), + this.generate(), + (this.activeWave = !1), + (this.waves = 0); + } + generate() { + 4 === this.scene.number + ? this.scene.time.delayedCall(2e3, () => this.releaseGuinxu(), null, this) + : ((this.generateEvent1 = this.scene.time.addEvent({ + delay: 7e3, + callback: () => this.orderedWave(), + callbackScope: this, + loop: !0, + })), + (this.generateEvent2 = this.scene.time.addEvent({ + delay: 15e3, + callback: () => this.wave(), + callbackScope: this, + loop: !0, + })), + this.scene.number > 1 && + (this.generateEvent3 = this.scene.time.addEvent({ + delay: 3e3, + callback: () => this.tank(), + callbackScope: this, + loop: !0, + })), + this.scene.number > 2 && + (this.generateEvent4 = this.scene.time.addEvent({ + delay: 5e3, + callback: () => this.slider(), + callbackScope: this, + loop: !0, + }))); + } + releaseGuinxu() { + const e = new c( + this.scene, + Phaser.Math.Between(200, 600), + 200, + "guinxu", + 0, + 20 + ); + this.scene.playAudio("boss"), + (this.laughterEvent = this.scene.time.addEvent({ + delay: 1e4, + callback: () => { + this.scene.playAudio("boss"); + }, + callbackScope: this, + loop: !0, + })), + this.scene.tweens.add({ + targets: e, + alpha: { from: 0.3, to: 1 }, + duration: 200, + repeat: 10, + }), + this.scene.foeGroup.add(e); + } + stop() { + clearInterval(this.generationIntervalId), + this.scene.foeGroup.children.entries.forEach((e) => { + null !== e && e.active && e.destroy(); + }); + } + finishScene() { + this.generateEvent1.destroy(), + this.generateEvent2.destroy(), + this.scene.number > 1 && this.generateEvent3.destroy(), + this.scene.number > 2 && this.generateEvent4.destroy(), + this.scene.endScene(); + } + createPath() { + this.waves++, 3 === this.waves && this.finishScene(); + const e = Phaser.Math.Between(100, 600); + (this.path = new Phaser.Curves.Path(e, 0)), + this.path.lineTo(e, Phaser.Math.Between(20, 50)); + for (let t = 0; t < 8; t++) + t % 2 == 0 + ? this.path.lineTo(e, 50 + 62.5 * (t + 1)) + : this.path.lineTo(e + 300, 50 + 62.5 * (t + 1)); + this.path.lineTo(e, this.scene.height + 50), + (this.graphics = this.scene.add.graphics()), + this.graphics.lineStyle(0, 16777215, 0); + } + orderedWave(e = 5) { + const t = Phaser.Math.Between(64, this.scene.width - 200), + s = Phaser.Math.Between(-100, 0), + i = Phaser.Math.Between(-1, 1) > 0 ? 1 : -1; + Array(e) + .fill() + .forEach((e, h) => this.addOrder(h, t, s, i)); + } + wave(e = 5) { + this.createPath(), + Phaser.Math.Between(64, this.scene.width - 200), + Phaser.Math.Between(-100, 0), + Phaser.Math.Between(-1, 1), + Array(e) + .fill() + .forEach((e, t) => this.addToWave(t)), + (this.activeWave = !0); + } + tank() { + this.scene.foeGroup.add( + new c(this.scene, Phaser.Math.Between(100, 600), -100, "foe2", 0, 620) + ); + } + slider() { + let e = -200, + t = 0; + Phaser.Math.Between(-1, 1) > 0 + ? ((e = 200), (t = -100)) + : (t = this.scene.width + 100); + const s = new c(this.scene, t, Phaser.Math.Between(100, 600), "foe1", e, 0); + this.scene.tweens.add({ + targets: [s, s.shadow], + duration: 500, + rotation: "+=5", + repeat: -1, + }), + this.scene.foeGroup.add(s); + } + add() { + const e = new c( + this.scene, + Phaser.Math.Between(32, this.scene.width - 32), + 0 + ); + this.scene.foeGroup.add(e); + } + addOrder(e, t, s, i) { + const h = 70 * i; + this.scene.foeGroup.add( + new c(this.scene, t + 70 * e, e * s + h, "foe0", 0, 300) + ); + } + addToWave(e) { + const t = new c( + this.scene, + Phaser.Math.Between(32, this.scene.width - 32), + 0, + "foe0" + ); + this.scene.tweens.add({ + targets: t, + z: 1, + ease: "Linear", + duration: 12e3, + repeat: -1, + delay: 100 * e, + }), + this.scene.foeWaveGroup.add(t); + } + update() { + this.path && + (this.path.draw(this.graphics), + this.scene.foeWaveGroup.children.entries.forEach((e) => { + if (null === e || !e.active) return; + let t = e.z, + s = e.getData("vector"); + this.path.getPoint(t, s), + e.setPosition(s.x, s.y), + e.shadow.setPosition(s.x + 20, s.y + 20), + e.setDepth(e.y); + }), + this.activeWave && + this.checkIfWaveDestroyed() && + ((this.activeWave = !1), this.scene.spawnShake(), this.path.destroy())), + this.scene.foeGroup.children.entries.forEach((e) => { + (null === e || !e.active || e.y > this.scene.height + 100) && + e.destroy(), + e.update(); + }); + } + checkIfWaveDestroyed() { + const e = this.scene.foeWaveGroup.children.entries; + return e.length === e.filter((e) => !e.active).length; + } +} +class p extends Phaser.GameObjects.PointLight { + constructor(e, t, s, i = 16777215, h = 5, a = 0.5) { + super(e, t, s, i, h, a), + (this.name = "celtic"), + (this.scene = e), + e.add.existing(this), + e.physics.add.existing(this), + this.body.setAllowGravity(!1), + this.body.setVelocityY(300), + this.init(); + } + init() { + this.scene.tweens.add({ + targets: this, + duration: Phaser.Math.Between(600, 1e3), + scale: { from: 1, to: 3 }, + alpha: { from: this.alpha, to: 0 }, + onComplete: () => { + this.destroy(); + }, + }); + } +} +const y = { + chocolate: { color: 11501655, radius: 16, intensity: 0.4 }, + vanila: { color: 16774869, radius: 16, intensity: 0.4 }, + fruit: { color: 16777215, radius: 16, intensity: 0.4 }, + water: { color: 16777215, radius: 16, intensity: 0.4 }, + foe: { color: 65280, radius: 16, intensity: 0.4 }, +}; +class u extends Phaser.GameObjects.PointLight { + constructor(e, t, s, i = "water", h, a = 0, o = -500) { + const { color: n, radius: r, intensity: d } = y[i]; + super(e, t, s, n, r, d), + (this.name = "shot"), + (this.playerName = h), + e.add.existing(this), + e.physics.add.existing(this), + this.body.setAllowGravity(!1), + this.body.setVelocityX(a), + this.body.setVelocityY(o), + this.body.setCircle(10), + this.body.setOffset(6, 9), + this.body.setCollideWorldBounds(!0), + (this.body.onWorldBounds = !0), + this.spawnShadow(t, s, a, o), + this.init(); + } + spawnShadow(e, t, s, i) { + (this.shadow = this.scene.add.circle(e + 20, t + 20, 10, 0).setAlpha(0.4)), + this.scene.add.existing(this.shadow), + this.scene.physics.add.existing(this.shadow), + this.shadow.body.setVelocityX(s), + this.shadow.body.setVelocityY(i); + } + init() { + this.scene.tweens.add({ + targets: this, + duration: 200, + intensity: { from: 0.3, to: 0.7 }, + repeat: -1, + }); + } +} +class m { + constructor(e, t) { + (this.scene = e), + (this.name = t), + (this.shootingMethods = { + water: this.single.bind(this), + fruit: this.tri.bind(this), + vanila: this.quintus.bind(this), + chocolate: this.massacre.bind(this), + }); + } + shoot(e, t, s) { + this.shootingMethods[s](e, t, s); + } + single(e, t, s) { + this.scene.shots.add(new u(this.scene, e, t, s, this.name)); + } + tri(e, t, s) { + this.scene.shots.add(new u(this.scene, e, t, s, this.name, -60)), + this.scene.shots.add(new u(this.scene, e, t, s, this.name)), + this.scene.shots.add(new u(this.scene, e, t, s, this.name, 60)); + } + quintus(e, t, s) { + this.scene.shots.add(new u(this.scene, e, t, s, this.name, -300)), + this.scene.shots.add(new u(this.scene, e, t, s, this.name, 300)), + this.scene.shots.add(new u(this.scene, e, t, s, this.name, -300, 500)), + this.scene.shots.add(new u(this.scene, e, t, s, this.name, 300, 500)); + } + massacre(e, t, s) { + this.scene.shots.add(new u(this.scene, e, t, s, this.name, 300, 0)), + this.scene.shots.add(new u(this.scene, e, t, s, this.name, -300, 0)), + this.scene.shots.add(new u(this.scene, e, t, s, this.name, 0, 500)), + this.scene.shots.add(new u(this.scene, e, t, s, this.name, 30)), + this.scene.shots.add(new u(this.scene, e, t, s, this.name, 60)); + } +} +class g extends Phaser.GameObjects.Sprite { + constructor(e, t, s, i = "player1", h = "water") { + super(e, t, s, i), + (this.name = i), + this.spawnShadow(t, s), + (this.powerUp = h), + (this.id = Math.random()), + e.add.existing(this), + e.physics.add.existing(this), + this.body.setCollideWorldBounds(!0), + this.body.setAllowGravity(!1), + this.body.setCircle(26), + this.body.setOffset(6, 9), + (this.power = 0), + (this.blinking = !1), + (this.shootingPatterns = new m(this.scene, this.name)), + this.init(), + this.setControls(); + } + spawnShadow(e, t) { + this.shadow = this.scene.add + .image(e + 20, t + 20, "player1") + .setTint(0) + .setAlpha(0.4); + } + init() { + this.scene.anims.create({ + key: this.name, + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 0, + end: 0, + }), + frameRate: 10, + repeat: -1, + }), + this.scene.anims.create({ + key: this.name + "right", + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 1, + end: 1, + }), + frameRate: 10, + repeat: -1, + }), + this.scene.anims.create({ + key: this.name + "left", + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 2, + end: 2, + }), + frameRate: 10, + repeat: -1, + }), + this.anims.play(this.name, !0), + (this.upDelta = 0); + } + setControls() { + (this.SPACE = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.SPACE + )), + (this.cursor = this.scene.input.keyboard.createCursorKeys()), + (this.W = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.W + )), + (this.A = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.A + )), + (this.S = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.S + )), + (this.D = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.D + )); + } + shoot() { + this.scene.playAudio("shot"), + this.shootingPatterns.shoot(this.x, this.y, this.powerUp); + } + update(e, t) { + this.death || + (this.cursor.left.isDown + ? ((this.x -= 5), + this.anims.play(this.name + "left", !0), + this.shadow.setScale(0.5, 1)) + : this.cursor.right.isDown + ? ((this.x += 5), + this.anims.play(this.name + "right", !0), + this.shadow.setScale(0.5, 1)) + : (this.anims.play(this.name, !0), this.shadow.setScale(1, 1)), + this.cursor.up.isDown + ? (this.y -= 5) + : this.cursor.down.isDown && (this.y += 5), + Phaser.Input.Keyboard.JustDown(this.SPACE) && this.shoot(), + this.scene.trailLayer.add( + new p(this.scene, this.x, this.y, 16777215, 10) + ), + this.updateShadow()); + } + updateShadow() { + (this.shadow.x = this.x + 20), (this.shadow.y = this.y + 20); + } + showPoints(e, t = 16711680) { + let s = this.scene.add + .bitmapText(this.x + 20, this.y - 30, "starshipped", e, 20, 16776503) + .setOrigin(0.5); + this.scene.tweens.add({ + targets: s, + duration: 2e3, + alpha: { from: 1, to: 0 }, + y: { from: s.y - 10, to: s.y - 100 }, + }); + } + dead() { + const e = this.scene.add + .circle(this.x, this.y, 10) + .setStrokeStyle(40, 16777215); + this.scene.tweens.add({ + targets: e, + radius: { from: 10, to: 512 }, + alpha: { from: 1, to: 0.3 }, + duration: 300, + onComplete: () => { + e.destroy(); + }, + }), + this.scene.cameras.main.shake(500), + (this.death = !0), + this.shadow.destroy(), + new r(this.scene, this.x, this.y, 40), + super.destroy(); + } +} +class w extends Phaser.GameObjects.Sprite { + constructor(e, t, s, i = "plenny0", h = "fruit") { + super(e, t, s, i), + (this.name = i), + (this.power = h), + (this.scene = e), + (this.id = Math.random()), + this.spawnShadow(t, s), + e.add.existing(this), + e.physics.add.existing(this), + this.body.setAllowGravity(!1), + this.body.setCircle(19), + this.body.setOffset(12, 12), + this.body.setVelocityX(-100), + this.init(); + } + spawnShadow(e, t) { + (this.shadow = this.scene.add + .image(e + 20, t + 20, "plenny0") + .setTint(0) + .setAlpha(0.4)), + this.scene.physics.add.existing(this.shadow), + this.shadow.body.setVelocityX(-100); + } + init() { + this.scene.anims.create({ + key: this.name, + frames: this.scene.anims.generateFrameNumbers(this.name), + frameRate: 10, + repeat: -1, + }), + this.scene.tweens.add({ + targets: [this], + duration: 5e3, + x: { from: this.x, to: 0 }, + y: { from: this.y - 10, to: this.y + 10 }, + scale: { from: 0.8, to: 1 }, + repeat: -1, + yoyo: !0, + }), + this.scene.tweens.add({ + targets: this.shadow, + duration: 5e3, + x: { from: this.shadow.x, to: 0 }, + y: { from: this.shadow.y - 10, to: this.y + 10 }, + scale: { from: 0.8, to: 1 }, + repeat: -1, + yoyo: !0, + }), + this.anims.play(this.name, !0), + this.body.setVelocityX(-100), + this.shadow.body.setVelocityX(-100), + (this.direction = -1); + } + destroy() { + this.shadow.destroy(), super.destroy(); + } +} +class f extends Phaser.Scene { + constructor() { + super({ key: "game" }), + (this.player = null), + (this.score = 0), + (this.scoreText = null); + } + init(e) { + (this.name = e.name), + (this.number = e.number), + (this.next = e.next), + (this.currentPowerUp = +this.registry.get("currentPowerUp")); + } + create() { + (this.duration = 1e3 * this.time), + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + new i(this).simpleOpen(() => 0), + this.addBackground(), + this.cameras.main.setBackgroundColor(3355443), + this.lights.enable(), + this.lights.setAmbientColor(6710886), + this.addScores(), + this.addFoes(), + this.addPlayers(), + this.addPowerUps(), + this.addShots(), + this.loadAudios(), + this.addColliders(); + } + addBackground() { + this.background = this.add + .tileSprite(0, 0, this.width, this.height, "stage" + this.number) + .setOrigin(0) + .setScrollFactor(0, 1); + } + spawnShake() { + const { x: e, y: t } = this.lastDestroyedWaveFoe; + (this.shake = new w(this, e, t)), this.powerUps.add(this.shake); + } + addScores() { + (this.scores = { player1: {}, player2: {} }), + (this.scores.player1.scoreText = this.add + .bitmapText( + 150, + 16, + "wendy", + String(this.registry.get("score_player1")).padStart(6, "0"), + 50 + ) + .setOrigin(0.5) + .setScrollFactor(0)), + (this.scores.player2.scoreText = this.add + .bitmapText(this.width - 150, 16, "wendy", "0".padStart(6, "0"), 50) + .setOrigin(0.5) + .setScrollFactor(0)); + } + addPlayers() { + (this.trailLayer = this.add.layer()), + (this.players = this.add.group()), + (this.player = new g(this, this.center_width, this.center_height)), + this.players.add(this.player); + } + addShots() { + (this.shotsLayer = this.add.layer()), (this.shots = this.add.group()); + } + addFoes() { + (this.foeGroup = this.add.group()), + (this.foeWaveGroup = this.add.group()), + (this.foeShots = this.add.group()), + (this.foes = new l(this)); + } + addPowerUps() { + (this.available = ["fruit", "vanila", "chocolate"]), + (this.powerUps = this.add.group()); + } + addColliders() { + this.physics.add.collider( + this.players, + this.foeGroup, + this.crashFoe, + () => !0, + this + ), + this.physics.add.collider( + this.players, + this.foeWaveGroup, + this.crashFoe, + () => !0, + this + ), + this.physics.add.overlap( + this.shots, + this.foeGroup, + this.destroyFoe, + () => !0, + this + ), + this.physics.add.overlap( + this.shots, + this.foeWaveGroup, + this.destroyWaveFoe, + () => !0, + this + ), + this.physics.add.collider( + this.players, + this.powerUps, + this.pickPowerUp, + () => !0, + this + ), + this.physics.add.overlap( + this.players, + this.foeShots, + this.hitPlayer, + () => !0, + this + ), + this.physics.add.collider( + this.shots, + this.foeShots, + this.destroyShot, + () => !0, + this + ), + this.physics.world.on("worldbounds", this.onWorldBounds); + } + onWorldBounds(e, t) { + const s = e.gameObject.name.toString(); + ["foeshot", "shot"].includes(s) && + (e.gameObject.shadow.destroy(), e.gameObject.destroy()); + } + destroyShot(e, t) { + const s = this.lights.addPointLight(e.x, e.y, 16777215, 10, 0.7); + this.tweens.add({ targets: s, duration: 400, scale: { from: 1, to: 0 } }), + this.playAudio("foexplosion"), + e.shadow.destroy(), + e.destroy(), + t.shadow.destroy(), + t.shot(), + this.updateScore(e.playerName, 50); + } + destroyWaveFoe(e, t) { + (this.lastDestroyedWaveFoe = { x: t.x, y: t.y }), this.destroyFoe(e, t); + } + destroyFoe(e, t) { + t.lives--, this.playAudio("foexplosion"); + const s = this.lights.addPointLight(e.x, e.y, 16777215, 10, 0.7); + if ( + (this.tweens.add({ + targets: s, + duration: 400, + scale: { from: 1, to: 0 }, + }), + this.tweens.add({ + targets: t, + duration: 400, + tint: { from: 16777215, to: 16711680 }, + }), + this.updateScore(e.playerName, 50), + this.tweens.add({ targets: t, y: "-=10", yoyo: !0, duration: 100 }), + e.destroy(), + 0 === t.lives) + ) { + this.playAudio("foedestroy"); + const s = this.lights.addPointLight(e.x, e.y, 16777215, 10, 0.7); + this.tweens.add({ targets: s, duration: 400, scale: { from: 1, to: 0 } }), + this.updateScore(e.playerName, t.points), + t.dead(); + } + } + hitPlayer(e, t) { + e.blinking || + (this.players.remove(this.player), + e.dead(), + this.playAudio("explosion"), + t.shadow.destroy(), + t.destroy(), + this.time.delayedCall(1e3, () => this.respawnPlayer(), null, this)); + } + crashFoe(e, t) { + e.blinking || + (e.dead(), + this.playAudio("explosion"), + t.dead(), + this.time.delayedCall(1e3, () => this.respawnPlayer(), null, this)); + } + pickPowerUp(e, t) { + this.playAudio("stageclear1"), + this.updatePowerUp(e, t), + this.tweens.add({ + targets: e, + duration: 200, + alpha: { from: 0.5, to: 1 }, + scale: { from: 1.4, to: 1 }, + repeat: 3, + }), + t.destroy(); + } + respawnPlayer() { + (this.player = new g(this, this.center_width, this.center_height)), + (this.player.blinking = !0), + this.players.add(this.player), + this.tweens.add({ + targets: this.player, + duration: 100, + alpha: { from: 0, to: 1 }, + repeat: 10, + onComplete: () => { + this.player.blinking = !1; + }, + }); + } + loadAudios() { + this.audios = { + shot: this.sound.add("shot"), + foeshot: this.sound.add("foeshot"), + explosion: this.sound.add("explosion"), + foexplosion: this.sound.add("foexplosion"), + foedestroy: this.sound.add("foedestroy"), + stageclear1: this.sound.add("stageclear1"), + stageclear2: this.sound.add("stageclear2"), + boss: this.sound.add("boss"), + }; + } + playAudio(e) { + this.audios[e].play(); + } + update() { + this.player && this.player.update(), + this.foes.update(), + (this.background.tilePositionY -= 10); + } + endScene() { + this.foeWaveGroup.children.entries.forEach((e) => e.shadow.destroy()), + this.foeGroup.children.entries.forEach((e) => e.shadow.destroy()), + this.shots.children.entries.forEach((e) => e.shadow.destroy()), + this.foeShots.children.entries.forEach((e) => e.shadow.destroy()), + this.time.delayedCall( + 2e3, + () => { + this.finishScene(); + }, + null, + this + ); + } + finishScene() { + this.game.sound.stopAll(), this.scene.stop("game"); + const e = this.number < 5 ? "transition" : "outro"; + this.scene.start(e, { + next: "game", + name: "STAGE", + number: this.number + 1, + }); + } + updatePowerUp(e, t) { + (e.powerUp = this.available[this.currentPowerUp]), + (this.currentPowerUp = + this.currentPowerUp + 1 === this.available.length + ? this.currentPowerUp + : this.currentPowerUp + 1), + this.registry.set("currentPowerUp", this.currentPowerUp); + } + updateScore(e, t = 0) { + const s = +this.registry.get("score_" + e) + t; + this.registry.set("score_" + e, s), + this.scores[e].scoreText.setText(String(s).padStart(6, "0")), + this.tweens.add({ + targets: this.scores[e].scoreText, + duration: 200, + tint: { from: 255, to: 16777215 }, + scale: { from: 1.2, to: 1 }, + repeat: 2, + }); + } +} +const b = { + width: 1e3, + height: 800, + scale: { mode: e.Scale.FIT, autoCenter: e.Scale.CENTER_BOTH }, + autoRound: !1, + parent: "game-container", + physics: { default: "arcade", arcade: { gravity: { y: 0 }, debug: !1 } }, + scene: [t, h, a, f, s], +}; +new e.Game(b); diff --git a/starshake/src/main.js b/starshake/src/main.js index 6b28f60b..e2383163 100644 --- a/starshake/src/main.js +++ b/starshake/src/main.js @@ -1,9 +1,9 @@ import Phaser from "phaser"; import Bootloader from "./scenes/bootloader"; +import Game from "./scenes/game"; import Outro from "./scenes/outro"; import Splash from "./scenes/splash"; import Transition from "./scenes/transition"; -import Game from "./scenes/game"; const config = { width: 1000, @@ -13,7 +13,7 @@ const config = { autoCenter: Phaser.Scale.CENTER_BOTH, }, autoRound: false, - parent: "contenedor", + parent: "game-container", physics: { default: "arcade", arcade: { diff --git a/wallhammer/dist/assets/index-Du4WbNGK.js b/wallhammer/dist/assets/index-Du4WbNGK.js index 176918fa..0349925a 100644 --- a/wallhammer/dist/assets/index-Du4WbNGK.js +++ b/wallhammer/dist/assets/index-Du4WbNGK.js @@ -1 +1,1419 @@ -import{P as t}from"./phaser-CmFXOKba.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const s of t)if("childList"===s.type)for(const t of s.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();class e extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.load.on("progress",(function(t){this.progressBar.clear(),this.progressBar.fillStyle(15767863,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*t,16)}),this),this.load.on("complete",(()=>{this.scene.start("splash")}),this),Array(5).fill(0).forEach(((t,e)=>{this.load.audio(`music${e}`,`assets/sounds/music${e}.mp3`)})),this.load.image("pello","assets/images/pello.png"),this.load.image("landscape","assets/images/landscape.png"),this.load.audio("build","assets/sounds/build.mp3"),this.load.audio("coin","assets/sounds/coin.mp3"),this.load.audio("death","assets/sounds/death.mp3"),this.load.audio("jump","assets/sounds/jump.mp3"),this.load.audio("kill","assets/sounds/kill.mp3"),this.load.audio("land","assets/sounds/land.mp3"),this.load.audio("lunchbox","assets/sounds/lunchbox.mp3"),this.load.audio("prize","assets/sounds/prize.mp3"),this.load.audio("stone_fail","assets/sounds/stone_fail.mp3"),this.load.audio("stone","assets/sounds/stone.mp3"),this.load.audio("foedeath","assets/sounds/foedeath.mp3"),this.load.audio("stage","assets/sounds/stage.mp3"),this.load.audio("splash","assets/sounds/splash.mp3"),Array(2).fill(0).forEach(((t,e)=>{this.load.image(`brick${e}`,`assets/images/brick${e}.png`)})),Array(5).fill(0).forEach(((t,e)=>{this.load.image(`platform${e+2}`,`assets/images/platform${e+2}.png`)})),this.load.bitmapFont("pixelFont","assets/fonts/mario.png","assets/fonts/mario.xml"),this.load.spritesheet("walt","assets/images/walt.png",{frameWidth:64,frameHeight:64}),Array(5).fill(0).forEach(((t,e)=>{this.load.tilemapTiledJSON(`scene${e}`,`assets/maps/scene${e}.json`)})),this.load.image("softbricks","assets/maps/softbricks.png"),this.load.image("bricks","assets/maps/bricks.png"),this.load.image("background","assets/maps/background.png"),this.load.image("chain","assets/images/chain.png"),this.load.spritesheet("bat","assets/images/bat.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("zombie","assets/images/zombie.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("coin","assets/images/coin.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("lunchbox","assets/images/lunchbox.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("hammer","assets/images/hammer.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("speed","assets/images/speed.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("boots","assets/images/boots.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("star","assets/images/star.png",{frameWidth:64,frameHeight:64}),this.load.bitmapFont("hammerfont","assets/fonts/hammer.png","assets/fonts/hammer.xml"),this.registry.set("score",0),this.registry.set("coins",0)}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(13264642,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class s extends Phaser.Scene{constructor(){super({key:"outro"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.introLayer=this.add.layer(),this.splashLayer=this.add.layer(),this.text=["You did it!!","Thanks to your building skills","and your mighty hammer,","you saved the earth.","Made in 3 days for Minijam","by Pello","","Press SPACE"],this.showHistory(),this.input.keyboard.on("keydown-SPACE",this.startSplash,this),this.input.keyboard.on("keydown-ENTER",this.startSplash,this)}startSplash(){this.scene.start("splash")}showHistory(){this.text.forEach(((t,e)=>{this.time.delayedCall(2e3*(e+1),(()=>this.showLine(t,70*(e+1))),null,this)}))}showLine(t,e){let s=this.introLayer.add(this.add.bitmapText(this.center_width,e,"pixelFont",t,25).setOrigin(.5).setAlpha(0));this.tweens.add({targets:s,duration:2e3,alpha:1})}}Phaser.GameObjects.Rectangle,Phaser.GameObjects.Rectangle;class i extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i,a,h=16771755,r=!1){super(t,e,s,i=i||Phaser.Math.Between(10,25),a=a||Phaser.Math.Between(10,25),h),t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setVelocityX(Phaser.Math.Between(-20,20)),this.init()}init(){this.scene.tweens.add({targets:this,duration:800,scale:{from:1,to:0},onComplete:()=>{this.destroy()}})}}class a extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i=11550208,a,h,r=!1){super(t,e,s+5,a=a||Phaser.Math.Between(15,30),h=h||Phaser.Math.Between(15,30),i),t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!0),this.body.setVelocityX(Phaser.Math.Between(-50,50)),this.body.setVelocityY(a*h)}}class h extends Phaser.Scene{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(0),this.time.delayedCall(1e3,(()=>this.showInstructions()),null,this),this.input.keyboard.on("keydown-SPACE",(()=>this.startGame()),this),this.input.keyboard.on("keydown-ENTER",(()=>this.startGame()),this),this.playMusic(),this.showTitle(),this.playAudioRandomly("stone")}startGame(){this.theme&&this.theme.stop(),this.scene.start("transition",{next:"game",name:"STAGE",number:0,time:30})}showTitle(){"WALL".split("").forEach(((t,e)=>{this.time.delayedCall(200*(e+1),(()=>{this.playAudioRandomly("stone_fail"),Phaser.Math.Between(0,5)>2&&this.playAudioRandomly("stone");let s=this.add.bitmapText(130*(e+1)+140,200,"hammerfont",t,170).setTint(13264642).setOrigin(.5).setDropShadow(4,6,15767863,.9);Array(Phaser.Math.Between(4,6)).fill(0).forEach((t=>new a(this,s.x,s.y,13264642)))}),null,this)})),"HAMMER".split("").forEach(((t,e)=>{this.time.delayedCall(200*(e+1)+800,(()=>{this.playAudioRandomly("stone_fail"),Phaser.Math.Between(0,5)>2&&this.playAudioRandomly("stone");let s=this.add.bitmapText(130*(e+1),350,"hammerfont",t,170).setTint(13264642).setOrigin(.5).setDropShadow(4,6,15767863,.9);Array(Phaser.Math.Between(4,6)).fill(0).forEach((t=>new a(this,s.x,s.y,13264642)))}),null,this)}))}playAudioRandomly(t){const e=Phaser.Math.Between(.8,1);this.sound.add(t).play({volume:e,rate:1})}playMusic(t="splash"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!0,delay:0})}showInstructions(){this.add.bitmapText(this.center_width,450,"pixelFont","WASD/Arrows: move",30).setOrigin(.5),this.add.bitmapText(this.center_width,500,"pixelFont","S/DOWN: BUILD WALL",30).setOrigin(.5),this.add.bitmapText(this.center_width,550,"pixelFont","SPACE: HAMMER",30).setOrigin(.5),this.add.sprite(this.center_width-120,620,"pello").setOrigin(.5).setScale(.3),this.add.bitmapText(this.center_width+40,620,"pixelFont","By PELLO",15).setOrigin(.5),this.space=this.add.bitmapText(this.center_width,670,"pixelFont","Press SPACE to start",30).setOrigin(.5),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}}class r extends Phaser.Scene{constructor(){super({key:"transition"})}init(t){this.name=t.name,this.number=t.number,this.next=t.next}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,5===this.number&&this.loadOutro(),this.addScore(),this.add.sprite(this.center_width,this.center_height-170,"walt"),this.add.bitmapText(this.center_width,this.center_height-20,"pixelFont",["TUTORIAL","STAGE 1","STAGE 2","STAGE 3","STAGE 4"][this.number],40).setOrigin(.5),this.add.bitmapText(this.center_width,this.center_height+20,"pixelFont","Ready?",30).setOrigin(.5),this.input.keyboard.on("keydown-ENTER",(()=>this.loadNext()),this),this.input.keyboard.on("keydown-SPACE",(()=>this.loadNext()),this),this.time.delayedCall(3e3,(()=>{this.loadNext()}),null,this)}loadNext(){this.scene.start("game",{name:this.name,number:this.number})}loadOutro(){this.scene.start("outro",{name:this.name,number:this.number})}addScore(){this.scoreCoins=this.add.bitmapText(this.center_width+32,this.center_height-100,"pixelFont","x"+this.registry.get("coins"),30).setDropShadow(0,4,2236962,.9).setOrigin(.5).setScrollFactor(0),this.scoreCoinsLogo=this.add.sprite(this.center_width-32,this.center_height-100,"coin").setScale(.7).setOrigin(.5).setScrollFactor(0),this.anims.create({key:"coinscore",frames:this.anims.generateFrameNumbers("coin",{start:0,end:7}),frameRate:8}),this.scoreCoinsLogo.play({key:"coinscore",repeat:-1})}}class o extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i=32,a=32,h=""){super(t,e,s,i,a,16777215),this.type=h,this.y=s,t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1),this.scene.tweens.add({targets:this,duration:300,scale:{from:1,to:0},onComplete:()=>{this.destroy()}})}}class n extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="brick0"){super(t,e,s,i),this.name=i,this.scene.add.existing(this),this.scene.physics.add.existing(this),this.body.immovable=!0,this.body.moves=!1,this.scene.tweens.add({targets:this,duration:50,x:{from:this.x,to:this.x+Phaser.Math.Between(-7,7)},y:{from:this.y,to:this.y+Phaser.Math.Between(-7,7)},repeat:5})}}class d extends Phaser.GameObjects.Sprite{constructor(t,e,s,i=10){super(t,e,s,"walt"),this.setOrigin(.5),this.scene.add.existing(this),this.scene.physics.add.existing(this),this.cursor=this.scene.input.keyboard.createCursorKeys(),this.spaceBar=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE),this.down=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.DOWN),this.right=!0,this.body.setGravityY(100),this.body.setSize(48,60),this.init(),this.jumping=!1,this.building=!1,this.falling=!1,this.mjolnir=!1,this.walkVelocity=200,this.jumpVelocity=-400,this.invincible=!1,this.health=i,this.dead=!1,this.W=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W),this.A=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.A),this.S=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S),this.D=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.D)}init(){this.scene.anims.create({key:"startidle",frames:this.scene.anims.generateFrameNumbers("walt",{start:0,end:1}),frameRate:3,repeat:-1}),this.scene.anims.create({key:"playeridle",frames:this.scene.anims.generateFrameNumbers("walt",{start:2,end:3}),frameRate:3,repeat:-1}),this.scene.anims.create({key:"playerwalk",frames:this.scene.anims.generateFrameNumbers("walt",{start:4,end:6}),frameRate:10,repeat:-1}),this.scene.anims.create({key:"playerjump",frames:this.scene.anims.generateFrameNumbers("walt",{start:4,end:4}),frameRate:1}),this.scene.anims.create({key:"playerhammer",frames:this.scene.anims.generateFrameNumbers("walt",{start:7,end:8}),frameRate:10}),this.scene.anims.create({key:"playerbuild",frames:this.scene.anims.generateFrameNumbers("walt",{start:9,end:10}),frameRate:10,repeat:2}),this.scene.anims.create({key:"playerdead",frames:this.scene.anims.generateFrameNumbers("walt",{start:11,end:16}),frameRate:5}),this.anims.play("startidle",!0),this.on("animationcomplete",this.animationComplete,this)}update(){this.dead||(this.jumping&&this.body.velocity.y>=0&&(this.body.setGravityY(700),this.falling=!0),(Phaser.Input.Keyboard.JustDown(this.cursor.up)||Phaser.Input.Keyboard.JustDown(this.W))&&this.body.blocked.down?(this.building=!1,this.body.setVelocityY(this.jumpVelocity),this.body.setGravityY(400),this.anims.play("playerjump",!0),this.scene.playAudio("jump"),this.jumping=!0,this.jumpSmoke()):this.cursor.right.isDown||this.D.isDown?(this.building=!1,this.body.blocked.down&&this.anims.play("playerwalk",!0),this.right=!0,this.flipX=this.body.velocity.x<0,this.body.setVelocityX(this.walkVelocity)):this.cursor.left.isDown||this.A.isDown?(this.building=!1,this.body.blocked.down&&this.anims.play("playerwalk",!0),this.right=!1,this.flipX=!0,this.body.setVelocityX(-this.walkVelocity)):(this.body.blocked.down&&(this.jumping&&(this.scene.playAudio("land"),this.landSmoke()),this.jumping=!1,this.falling=!1,this.building||this.anims.play("playeridle",!0)),this.body.setVelocityX(0)),Phaser.Input.Keyboard.JustDown(this.spaceBar)&&this.hammerBlow(),(Phaser.Input.Keyboard.JustDown(this.cursor.down)||Phaser.Input.Keyboard.JustDown(this.S))&&this.buildBlock())}landSmoke(){this.jumpSmoke(20)}jumpSmoke(t=10,e){Array(Phaser.Math.Between(3,6)).fill(0).forEach((s=>{const a=e||Phaser.Math.Between(-1,1)>0?1:-1;e=e||Phaser.Math.Between(0,20),new i(this.scene,this.x+a*e,this.y+t)}))}buildBlock(){this.building=!0,this.anims.play("playerbuild",!0),this.scene.playAudio("build");const t=this.right?64:-64,e=-400===this.jumpVelocity?0:-128;this.buildSmoke(32,t),this.scene.bricks.add(new n(this.scene,this.x+t,this.y+e))}buildSmoke(t=10,e){Array(Phaser.Math.Between(8,14)).fill(0).forEach((s=>{const a=Phaser.Math.Between(-20,20);new i(this.scene,this.x+(e+a),this.y+t)}))}hammerBlow(){this.building=!0,this.anims.play("playerhammer",!0);const t=this.right?32:-32,e=this.mjolnir?128:32;this.scene.blows.add(new o(this.scene,this.x+t,this.y,e,e))}turn(){this.right=!this.right}animationComplete(t,e){"playerground"===t.key&&this.anims.play("playeridle",!0),"playerhammer"!==t.key&&"playerbuild"!==t.key||(this.building=!1,this.anims.play(this.jumping?"playerjump":"playeridle",!0))}hit(){this.health--,this.anims.play("playerdead",!0),this.body.enable=!1,0===this.health&&this.die()}die(){this.dead=!0,this.anims.play("playerdead",!0),this.body.immovable=!0,this.body.moves=!1,this.scene.restartScene()}applyPrize(t){switch(t){case"speed":this.walkVelocity=330,this.flashPlayer();break;case"hammer":this.mjolnir=!0,this.flashPlayer();break;case"boots":this.jumpVelocity=-600,this.flashPlayer();break;case"coin":this.scene.updateCoins();break;case"star":this.invincible=!0,this.scene.tweens.add({targets:this,duration:300,alpha:{from:.7,to:1},repeat:-1})}}flashPlayer(){this.scene.tweens.add({targets:this,duration:50,scale:{from:1.2,to:1},repeat:10})}}class l extends Phaser.Physics.Arcade.Sprite{constructor(t,e,s,i="right"){super(t,e,s,"bat"),this.name="bat",this.scene.physics.add.existing(this),this.scene.physics.world.enable(this),this.body.setAllowGravity(!1),this.scene.add.existing(this),this.direction="right"===i?1:-1,this.init()}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:1}),frameRate:5,repeat:-1}),this.scene.anims.create({key:this.name+"death",frames:this.scene.anims.generateFrameNumbers(this.name,{start:2,end:5}),frameRate:5}),this.anims.play(this.name,!0),this.body.setVelocityX(150*this.direction),this.flipX=this.direction>0,this.on("animationcomplete",this.animationComplete,this)}update(){}turn(){this.direction=-this.direction,this.flipX=this.direction>0,this.body.setVelocityX(150*this.direction)}death(){this.dead=!0,this.body.enable=!1,this.body.rotation=0,this.anims.play(this.name+"death")}animationComplete(t,e){t.key===this.name+"death"&&this.destroy()}}class c extends Phaser.Physics.Arcade.Sprite{constructor(t,e,s,i="right"){super(t,e,s,"zombie"),this.name="zombie",this.scene=t,this.scene.physics.add.existing(this),this.scene.physics.world.enable(this),this.body.setAllowGravity(!0),this.scene.add.existing(this),this.direction="right"===i?-1:1,this.init()}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:2}),frameRate:5,repeat:-1}),this.scene.anims.create({key:this.name+"death",frames:this.scene.anims.generateFrameNumbers(this.name,{start:3,end:5}),frameRate:5}),this.anims.play(this.name,!0),this.body.setVelocityX(100*this.direction),this.flipX=this.direction<0,this.on("animationcomplete",this.animationComplete,this)}turn(){this.direction=-this.direction,this.flipX=this.direction<0,this.body.setVelocityX(100*this.direction)}death(){this.dead=!0,this.body.enable=!1,this.body.rotation=0,this.anims.play(this.name+"death")}animationComplete(t,e){t.key===this.name+"death"&&this.destroy()}}class m extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i=32,a=32,h=""){super(t,e,s,i,a,16777215),this.type=h,this.setAlpha(0),this.x=e,this.y=s,t.add.existing(this),t.physics.add.existing(this),this.body.immovable=!0,this.body.moves=!1}disable(){this.visible=!1,this.destroy()}destroy(){super.destroy()}}class p extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="coin"){super(t,e,s,i),this.name=i,this.setScale(.7),this.setOrigin(.5),t.add.existing(this),t.physics.add.existing(this),this.body.immovable=!0,this.body.moves=!1,this.disabled=!1,this.init()}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:7}),frameRate:10,repeat:-1}),this.anims.play(this.name,!0),this.scene.tweens.add({targets:this,duration:500,y:this.y-20,repeat:-1,yoyo:!0})}pick(){const{x:t,y:e}=this.scene.cameras.main.getWorldPoint(this.scene.scoreCoinsLogo.x,this.scene.scoreCoinsLogo.y);this.disabled=!0,this.scene.tweens.add({targets:this,duration:500,x:{from:this.x,to:t},y:{from:this.y,to:e},scale:{from:.7,to:.5},onComplete:()=>{this.destroy()}})}}class y extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="lunchbox"){super(t,e,s,i),this.scene=t,this.name=i,this.setScale(1),this.setOrigin(.5),t.add.existing(this),t.physics.add.existing(this),this.body.immovable=!0,this.body.moves=!1,this.disabled=!1,this.init()}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:0}),frameRate:1}),this.scene.anims.create({key:this.name+"opened",frames:this.scene.anims.generateFrameNumbers(this.name,{start:1,end:1}),frameRate:1}),this.anims.play(this.name,!0),this.scene.tweens.add({targets:this,duration:500,y:this.y-20,repeat:-1,yoyo:!0})}pick(){this.anims.play(this.name+"opened",!0),this.showPrize(),this.disabled=!0,this.scene.time.delayedCall(1e3,(()=>{this.destroy(),this.prizeSprite.destroy()}),null,this)}showPrize(){const t=Phaser.Math.RND.pick(["boots","hammer","coin","star","speed"]);this.scene.player.applyPrize(t),this.prizeSprite=this.scene.add.sprite(this.x,this.y,t).setOrigin(.5).setScale(.8),this.scene.tweens.add({targets:this.prizeSprite,duration:500,y:{from:this.y,to:this.y-64},onComplete:()=>{this.scene.playAudio("prize")}})}}class u extends Phaser.GameObjects.Container{constructor(t,e,s,i=4,a=!1){super(t,e,s),this.x=e,this.y=s,this.scene.add.existing(this),this.scene.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setBounce(1),this.body.setSize(64*i,64),this.body.setOffset(-2,-2),this.body.immovable=!0,this.body.moves=!1,this.chain=new Phaser.GameObjects.Sprite(this.scene,32*i-32,-2048,"chain").setOrigin(0),this.add(this.chain),this.platform=new Phaser.GameObjects.Sprite(this.scene,0,0,"platform"+i).setOrigin(0),this.add(this.platform),this.init()}init(){const t=Phaser.Math.Between(0,7);let e=this.x,s=this.y;switch(t){case 0:e=Phaser.Math.Between(-50,50);break;case 1:s=Phaser.Math.Between(-50,50);break;case 2:e=Phaser.Math.Between(-100,100),s=Phaser.Math.Between(-100,100)}this.scene.tweens.add({targets:this,duration:Phaser.Math.Between(4e3,6e3),x:{from:this.x,to:e},y:{from:this.y,to:s},repeat:-1,yoyo:!0})}}class b extends t.Scene{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null}init(t){this.name=t.name,this.number=t.number}preload(){}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(6464191),this.add.tileSprite(0,1e3,10240,512,"landscape").setOrigin(.5),this.createMap(),this.cameras.main.setBounds(0,0,41840,40160),this.physics.world.setBounds(0,0,41840,40160),this.addPlayer(),this.cameras.main.startFollow(this.player,!0,.05,.05,0,240),this.physics.world.enable([this.player]),this.addScore(),this.loadAudios(),this.playMusic()}addScore(){this.scoreCoins=this.add.bitmapText(75,10,"pixelFont","x0",30).setDropShadow(0,4,2236962,.9).setOrigin(0).setScrollFactor(0),this.scoreCoinsLogo=this.add.sprite(50,25,"coin").setScale(1).setOrigin(.5).setScrollFactor(0),this.anims.create({key:"coinscore",frames:this.anims.generateFrameNumbers("coin",{start:0,end:7}),frameRate:8}),this.scoreCoinsLogo.play({key:"coinscore",repeat:-1})}createMap(){this.tileMap=this.make.tilemap({key:"scene"+this.number,tileWidth:64,tileHeight:64}),this.tileSetBg=this.tileMap.addTilesetImage("background"),console.log(this.tileMap),this.tileMap.createLayer("background",this.tileSetBg),this.tileSet=this.tileMap.addTilesetImage("softbricks"),this.platform=this.tileMap.createLayer("scene"+this.number,this.tileSet),this.objectsLayer=this.tileMap.getObjectLayer("objects"),this.platform.setCollisionByExclusion([-1]),this.batGroup=this.add.group(),this.zombieGroup=this.add.group(),this.foesGroup=this.add.group(),this.turnGroup=this.add.group(),this.exitGroup=this.add.group(),this.platformGroup=this.add.group(),this.lunchBoxGroup=this.add.group(),this.bricks=this.add.group(),this.addsObjects(),this.addColliders()}addsObjects(){this.objectsLayer.objects.forEach((t=>{if("bat"===t.name){let e=new l(this,t.x,t.y,t.type);this.batGroup.add(e),this.foesGroup.add(e)}if("zombie"===t.name){let e=new c(this,t.x,t.y,t.type);this.zombieGroup.add(e),this.foesGroup.add(e)}"platform"===t.name&&this.platformGroup.add(new u(this,t.x,t.y,t.type)),"turn"===t.name&&this.turnGroup.add(new m(this,t.x,t.y)),"lunchbox"===t.name&&this.lunchBoxGroup.add(new y(this,t.x,t.y)),"text"===t.name&&this.add.bitmapText(t.x,t.y,"pixelFont",t.text.text,30).setDropShadow(2,4,2236962,.9).setOrigin(0),"exit"===t.name&&this.exitGroup.add(new m(this,t.x,t.y,t.width,t.height,t.type).setOrigin(.5))}))}addColliders(){this.physics.add.collider(this.batGroup,this.platform,this.turnFoe,(()=>!0),this),this.physics.add.collider(this.zombieGroup,this.bricks,this.turnFoe,(()=>!0),this),this.physics.add.collider(this.batGroup,this.bricks,this.turnFoe,(()=>!0),this),this.physics.add.collider(this.zombieGroup,this.turnGroup,this.turnFoe,(()=>!0),this),this.physics.add.collider(this.zombieGroup,this.platform,this.hitFloor,(()=>!0),this)}turnFoe(t,e){t.turn()}hitFloor(){}addPlayer(){this.elements=this.add.group(),this.coins=this.add.group();const t=this.objectsLayer.objects.find((t=>"player"===t.name));this.player=new d(this,t.x,t.y,0),this.physics.add.collider(this.player,this.platform,this.hitFloor,(()=>!0),this),this.physics.add.collider(this.player,this.platformGroup,this.hitFloor,(()=>!0),this),this.physics.add.collider(this.player,this.bricks,this.hitFloor,(()=>!0),this),this.physics.add.overlap(this.player,this.coins,this.pickCoin,(()=>!0),this),this.physics.add.overlap(this.player,this.lunchBoxGroup,this.pickLunchBox,(()=>!0),this),this.physics.add.overlap(this.player,this.exitGroup,(()=>{this.playAudio("stage"),this.time.delayedCall(1e3,(()=>this.finishScene()),null,this)}),(()=>!0),this),this.blows=this.add.group(),this.physics.add.overlap(this.blows,this.platform,this.blowPlatform,(()=>!0),this),this.physics.add.overlap(this.blows,this.bricks,this.blowBrick,(()=>!0),this),this.physics.add.overlap(this.blows,this.foesGroup,this.blowFoe,(()=>!0),this),this.physics.add.overlap(this.bricks,this.foesGroup,this.foeBlowBrick,(()=>!0),this),this.physics.add.collider(this.player,this.batGroup,this.hitPlayer,(()=>!0),this),this.physics.add.collider(this.player,this.zombieGroup,this.hitPlayer,(()=>!0),this)}pickCoin(t,e){e.disabled||(e.pick(),this.playAudio("coin"),this.updateCoins())}pickLunchBox(t,e){e.disabled||(this.playAudio("lunchbox"),e.pick())}hitPlayer(t,e){t.invincible?(e.death(),this.playAudio("foedeath")):!t.dead&&this.number>0&&(t.die(),this.playAudio("death"))}blowFoe(t,e){this.playAudio("kill"),this.playAudio("foedeath"),e.death()}foeBlowBrick(e,s){s.turn(),Array(t.Math.Between(4,6)).fill(0).forEach((t=>new a(this,e.x,e.y))),e.destroy()}blowPlatform(e,s){const i=this.getTile(s);this.isBreakable(i)&&(this.playAudioRandomly("stone_fail"),this.playAudioRandomly("stone"),this.player.mjolnir&&this.cameras.main.shake(30),e.destroy(),Array(t.Math.Between(4,6)).fill(0).forEach((t=>new a(this,i.pixelX,i.pixelY))),this.platform.removeTileAt(i.x,i.y),this.spawnCoin(i))}getTile(t){const{x:e,y:s}=t;return this.platform.getTileAt(e,s)}isBreakable(t){return"break"===(null==t?void 0:t.properties.element)}spawnCoin(e){t.Math.Between(0,11)>5&&this.time.delayedCall(500,(()=>{this.coins.add(new p(this,e.pixelX,e.pixelY))}),null,this)}blowBrick(e,s){this.player.mjolnir&&this.cameras.main.shake(30),this.playAudio("stone_fail"),this.playAudioRandomly("stone"),e.destroy(),Array(t.Math.Between(4,6)).fill(0).forEach((t=>new a(this,s.x,s.y))),s.destroy()}hitFloor(e,s){if(this.player.jumping&&!this.player.falling&&0===this.player.body.velocity.y){const e=this.getTile(s);this.isBreakable(e)?(this.playAudioRandomly("stone"),Array(t.Math.Between(4,6)).fill(0).forEach((t=>new a(this,e.pixelX,e.pixelY))),this.platform.removeTileAt(e.x,e.y)):"brick0"===(null==s?void 0:s.name)&&(this.playAudioRandomly("stone"),Array(t.Math.Between(4,6)).fill(0).forEach((t=>new a(this,s.x,s.y))),s.destroy())}}loadAudios(){this.audios={build:this.sound.add("build"),coin:this.sound.add("coin"),death:this.sound.add("death"),jump:this.sound.add("jump"),kill:this.sound.add("kill"),land:this.sound.add("land"),lunchbox:this.sound.add("lunchbox"),prize:this.sound.add("prize"),stone_fail:this.sound.add("stone_fail"),stone:this.sound.add("stone"),foedeath:this.sound.add("foedeath"),stage:this.sound.add("stage")}}playAudio(t){this.audios[t].play()}playAudioRandomly(e){const s=t.Math.Between(.8,1),i=t.Math.Between(.8,1);this.audios[e].play({volume:s,rate:i})}playMusic(t="game"){this.theme=this.sound.add("music"+this.number),this.theme.stop(),this.theme.play({mute:!1,volume:.7,rate:1,detune:0,seek:0,loop:!0,delay:0})}update(){this.player.update(),3===this.number&&this.player.y>1500&&this.restartScene()}finishScene(){this.theme&&this.theme.stop(),this.scene.start("transition",{name:"STAGE",number:this.number+1})}restartScene(){this.time.delayedCall(1e3,(()=>{this.theme&&this.theme.stop(),this.scene.start("transition",{name:"STAGE",number:this.number})}),null,this)}updateCoins(){const t=+this.registry.get("coins")+1;this.registry.set("coins",t),this.scoreCoins.setText("x"+t),this.tweens.add({targets:[this.scoreCoins,this.scoreCoinsLogo],scale:{from:1.4,to:1},duration:50,repeat:10})}}const g={width:1e3,height:800,scale:{mode:t.Scale.FIT,autoCenter:t.Scale.CENTER_BOTH},autoRound:!1,parent:"contenedor",physics:{default:"arcade",arcade:{gravity:{y:300},debug:!0}},scene:[e,h,r,b,s]};new t.Game(g); +import { P as t } from "./phaser-CmFXOKba.js"; +!(function () { + const t = document.createElement("link").relList; + if (!(t && t.supports && t.supports("modulepreload"))) { + for (const t of document.querySelectorAll('link[rel="modulepreload"]')) + e(t); + new MutationObserver((t) => { + for (const s of t) + if ("childList" === s.type) + for (const t of s.addedNodes) + "LINK" === t.tagName && "modulepreload" === t.rel && e(t); + }).observe(document, { childList: !0, subtree: !0 }); + } + function e(t) { + if (t.ep) return; + t.ep = !0; + const e = (function (t) { + const e = {}; + return ( + t.integrity && (e.integrity = t.integrity), + t.referrerPolicy && (e.referrerPolicy = t.referrerPolicy), + "use-credentials" === t.crossOrigin + ? (e.credentials = "include") + : "anonymous" === t.crossOrigin + ? (e.credentials = "omit") + : (e.credentials = "same-origin"), + e + ); + })(t); + fetch(t.href, e); + } +})(); +class e extends Phaser.Scene { + constructor() { + super({ key: "bootloader" }); + } + preload() { + this.createBars(), + this.load.on( + "progress", + function (t) { + this.progressBar.clear(), + this.progressBar.fillStyle(15767863, 1), + this.progressBar.fillRect( + this.cameras.main.width / 4, + this.cameras.main.height / 2 - 16, + (this.cameras.main.width / 2) * t, + 16 + ); + }, + this + ), + this.load.on( + "complete", + () => { + this.scene.start("splash"); + }, + this + ), + Array(5) + .fill(0) + .forEach((t, e) => { + this.load.audio(`music${e}`, `assets/sounds/music${e}.mp3`); + }), + this.load.image("pello", "assets/images/pello.png"), + this.load.image("landscape", "assets/images/landscape.png"), + this.load.audio("build", "assets/sounds/build.mp3"), + this.load.audio("coin", "assets/sounds/coin.mp3"), + this.load.audio("death", "assets/sounds/death.mp3"), + this.load.audio("jump", "assets/sounds/jump.mp3"), + this.load.audio("kill", "assets/sounds/kill.mp3"), + this.load.audio("land", "assets/sounds/land.mp3"), + this.load.audio("lunchbox", "assets/sounds/lunchbox.mp3"), + this.load.audio("prize", "assets/sounds/prize.mp3"), + this.load.audio("stone_fail", "assets/sounds/stone_fail.mp3"), + this.load.audio("stone", "assets/sounds/stone.mp3"), + this.load.audio("foedeath", "assets/sounds/foedeath.mp3"), + this.load.audio("stage", "assets/sounds/stage.mp3"), + this.load.audio("splash", "assets/sounds/splash.mp3"), + Array(2) + .fill(0) + .forEach((t, e) => { + this.load.image(`brick${e}`, `assets/images/brick${e}.png`); + }), + Array(5) + .fill(0) + .forEach((t, e) => { + this.load.image( + `platform${e + 2}`, + `assets/images/platform${e + 2}.png` + ); + }), + this.load.bitmapFont( + "pixelFont", + "assets/fonts/mario.png", + "assets/fonts/mario.xml" + ), + this.load.spritesheet("walt", "assets/images/walt.png", { + frameWidth: 64, + frameHeight: 64, + }), + Array(5) + .fill(0) + .forEach((t, e) => { + this.load.tilemapTiledJSON(`scene${e}`, `assets/maps/scene${e}.json`); + }), + this.load.image("softbricks", "assets/maps/softbricks.png"), + this.load.image("bricks", "assets/maps/bricks.png"), + this.load.image("background", "assets/maps/background.png"), + this.load.image("chain", "assets/images/chain.png"), + this.load.spritesheet("bat", "assets/images/bat.png", { + frameWidth: 32, + frameHeight: 32, + }), + this.load.spritesheet("zombie", "assets/images/zombie.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("coin", "assets/images/coin.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("lunchbox", "assets/images/lunchbox.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("hammer", "assets/images/hammer.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("speed", "assets/images/speed.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("boots", "assets/images/boots.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.spritesheet("star", "assets/images/star.png", { + frameWidth: 64, + frameHeight: 64, + }), + this.load.bitmapFont( + "hammerfont", + "assets/fonts/hammer.png", + "assets/fonts/hammer.xml" + ), + this.registry.set("score", 0), + this.registry.set("coins", 0); + } + createBars() { + (this.loadBar = this.add.graphics()), + this.loadBar.fillStyle(13264642, 1), + this.loadBar.fillRect( + this.cameras.main.width / 4 - 2, + this.cameras.main.height / 2 - 18, + this.cameras.main.width / 2 + 4, + 20 + ), + (this.progressBar = this.add.graphics()); + } +} +class s extends Phaser.Scene { + constructor() { + super({ key: "outro" }); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + (this.introLayer = this.add.layer()), + (this.splashLayer = this.add.layer()), + (this.text = [ + "You did it!!", + "Thanks to your building skills", + "and your mighty hammer,", + "you saved the earth.", + "Made in 3 days for Minijam", + "by Pello", + "", + "Press SPACE", + ]), + this.showHistory(), + this.input.keyboard.on("keydown-SPACE", this.startSplash, this), + this.input.keyboard.on("keydown-ENTER", this.startSplash, this); + } + startSplash() { + this.scene.start("splash"); + } + showHistory() { + this.text.forEach((t, e) => { + this.time.delayedCall( + 2e3 * (e + 1), + () => this.showLine(t, 70 * (e + 1)), + null, + this + ); + }); + } + showLine(t, e) { + let s = this.introLayer.add( + this.add + .bitmapText(this.center_width, e, "pixelFont", t, 25) + .setOrigin(0.5) + .setAlpha(0) + ); + this.tweens.add({ targets: s, duration: 2e3, alpha: 1 }); + } +} +Phaser.GameObjects.Rectangle, Phaser.GameObjects.Rectangle; +class i extends Phaser.GameObjects.Rectangle { + constructor(t, e, s, i, a, h = 16771755, r = !1) { + super( + t, + e, + s, + (i = i || Phaser.Math.Between(10, 25)), + (a = a || Phaser.Math.Between(10, 25)), + h + ), + t.add.existing(this), + t.physics.add.existing(this), + this.body.setAllowGravity(!1), + this.body.setVelocityX(Phaser.Math.Between(-20, 20)), + this.init(); + } + init() { + this.scene.tweens.add({ + targets: this, + duration: 800, + scale: { from: 1, to: 0 }, + onComplete: () => { + this.destroy(); + }, + }); + } +} +class a extends Phaser.GameObjects.Rectangle { + constructor(t, e, s, i = 11550208, a, h, r = !1) { + super( + t, + e, + s + 5, + (a = a || Phaser.Math.Between(15, 30)), + (h = h || Phaser.Math.Between(15, 30)), + i + ), + t.add.existing(this), + t.physics.add.existing(this), + this.body.setAllowGravity(!0), + this.body.setVelocityX(Phaser.Math.Between(-50, 50)), + this.body.setVelocityY(a * h); + } +} +class h extends Phaser.Scene { + constructor() { + super({ key: "splash" }); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.cameras.main.setBackgroundColor(0), + this.time.delayedCall(1e3, () => this.showInstructions(), null, this), + this.input.keyboard.on("keydown-SPACE", () => this.startGame(), this), + this.input.keyboard.on("keydown-ENTER", () => this.startGame(), this), + this.playMusic(), + this.showTitle(), + this.playAudioRandomly("stone"); + } + startGame() { + this.theme && this.theme.stop(), + this.scene.start("transition", { + next: "game", + name: "STAGE", + number: 0, + time: 30, + }); + } + showTitle() { + "WALL".split("").forEach((t, e) => { + this.time.delayedCall( + 200 * (e + 1), + () => { + this.playAudioRandomly("stone_fail"), + Phaser.Math.Between(0, 5) > 2 && this.playAudioRandomly("stone"); + let s = this.add + .bitmapText(130 * (e + 1) + 140, 200, "hammerfont", t, 170) + .setTint(13264642) + .setOrigin(0.5) + .setDropShadow(4, 6, 15767863, 0.9); + Array(Phaser.Math.Between(4, 6)) + .fill(0) + .forEach((t) => new a(this, s.x, s.y, 13264642)); + }, + null, + this + ); + }), + "HAMMER".split("").forEach((t, e) => { + this.time.delayedCall( + 200 * (e + 1) + 800, + () => { + this.playAudioRandomly("stone_fail"), + Phaser.Math.Between(0, 5) > 2 && this.playAudioRandomly("stone"); + let s = this.add + .bitmapText(130 * (e + 1), 350, "hammerfont", t, 170) + .setTint(13264642) + .setOrigin(0.5) + .setDropShadow(4, 6, 15767863, 0.9); + Array(Phaser.Math.Between(4, 6)) + .fill(0) + .forEach((t) => new a(this, s.x, s.y, 13264642)); + }, + null, + this + ); + }); + } + playAudioRandomly(t) { + const e = Phaser.Math.Between(0.8, 1); + this.sound.add(t).play({ volume: e, rate: 1 }); + } + playMusic(t = "splash") { + (this.theme = this.sound.add(t)), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 1, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } + showInstructions() { + this.add + .bitmapText(this.center_width, 450, "pixelFont", "WASD/Arrows: move", 30) + .setOrigin(0.5), + this.add + .bitmapText( + this.center_width, + 500, + "pixelFont", + "S/DOWN: BUILD WALL", + 30 + ) + .setOrigin(0.5), + this.add + .bitmapText(this.center_width, 550, "pixelFont", "SPACE: HAMMER", 30) + .setOrigin(0.5), + this.add + .sprite(this.center_width - 120, 620, "pello") + .setOrigin(0.5) + .setScale(0.3), + this.add + .bitmapText(this.center_width + 40, 620, "pixelFont", "By PELLO", 15) + .setOrigin(0.5), + (this.space = this.add + .bitmapText( + this.center_width, + 670, + "pixelFont", + "Press SPACE to start", + 30 + ) + .setOrigin(0.5)), + this.tweens.add({ + targets: this.space, + duration: 300, + alpha: { from: 0, to: 1 }, + repeat: -1, + yoyo: !0, + }); + } +} +class r extends Phaser.Scene { + constructor() { + super({ key: "transition" }); + } + init(t) { + (this.name = t.name), (this.number = t.number), (this.next = t.next); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + 5 === this.number && this.loadOutro(), + this.addScore(), + this.add.sprite(this.center_width, this.center_height - 170, "walt"), + this.add + .bitmapText( + this.center_width, + this.center_height - 20, + "pixelFont", + ["TUTORIAL", "STAGE 1", "STAGE 2", "STAGE 3", "STAGE 4"][this.number], + 40 + ) + .setOrigin(0.5), + this.add + .bitmapText( + this.center_width, + this.center_height + 20, + "pixelFont", + "Ready?", + 30 + ) + .setOrigin(0.5), + this.input.keyboard.on("keydown-ENTER", () => this.loadNext(), this), + this.input.keyboard.on("keydown-SPACE", () => this.loadNext(), this), + this.time.delayedCall( + 3e3, + () => { + this.loadNext(); + }, + null, + this + ); + } + loadNext() { + this.scene.start("game", { name: this.name, number: this.number }); + } + loadOutro() { + this.scene.start("outro", { name: this.name, number: this.number }); + } + addScore() { + (this.scoreCoins = this.add + .bitmapText( + this.center_width + 32, + this.center_height - 100, + "pixelFont", + "x" + this.registry.get("coins"), + 30 + ) + .setDropShadow(0, 4, 2236962, 0.9) + .setOrigin(0.5) + .setScrollFactor(0)), + (this.scoreCoinsLogo = this.add + .sprite(this.center_width - 32, this.center_height - 100, "coin") + .setScale(0.7) + .setOrigin(0.5) + .setScrollFactor(0)), + this.anims.create({ + key: "coinscore", + frames: this.anims.generateFrameNumbers("coin", { start: 0, end: 7 }), + frameRate: 8, + }), + this.scoreCoinsLogo.play({ key: "coinscore", repeat: -1 }); + } +} +class o extends Phaser.GameObjects.Rectangle { + constructor(t, e, s, i = 32, a = 32, h = "") { + super(t, e, s, i, a, 16777215), + (this.type = h), + (this.y = s), + t.add.existing(this), + t.physics.add.existing(this), + this.body.setAllowGravity(!1), + this.scene.tweens.add({ + targets: this, + duration: 300, + scale: { from: 1, to: 0 }, + onComplete: () => { + this.destroy(); + }, + }); + } +} +class n extends Phaser.GameObjects.Sprite { + constructor(t, e, s, i = "brick0") { + super(t, e, s, i), + (this.name = i), + this.scene.add.existing(this), + this.scene.physics.add.existing(this), + (this.body.immovable = !0), + (this.body.moves = !1), + this.scene.tweens.add({ + targets: this, + duration: 50, + x: { from: this.x, to: this.x + Phaser.Math.Between(-7, 7) }, + y: { from: this.y, to: this.y + Phaser.Math.Between(-7, 7) }, + repeat: 5, + }); + } +} +class d extends Phaser.GameObjects.Sprite { + constructor(t, e, s, i = 10) { + super(t, e, s, "walt"), + this.setOrigin(0.5), + this.scene.add.existing(this), + this.scene.physics.add.existing(this), + (this.cursor = this.scene.input.keyboard.createCursorKeys()), + (this.spaceBar = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.SPACE + )), + (this.down = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.DOWN + )), + (this.right = !0), + this.body.setGravityY(100), + this.body.setSize(48, 60), + this.init(), + (this.jumping = !1), + (this.building = !1), + (this.falling = !1), + (this.mjolnir = !1), + (this.walkVelocity = 200), + (this.jumpVelocity = -400), + (this.invincible = !1), + (this.health = i), + (this.dead = !1), + (this.W = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.W + )), + (this.A = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.A + )), + (this.S = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.S + )), + (this.D = this.scene.input.keyboard.addKey( + Phaser.Input.Keyboard.KeyCodes.D + )); + } + init() { + this.scene.anims.create({ + key: "startidle", + frames: this.scene.anims.generateFrameNumbers("walt", { + start: 0, + end: 1, + }), + frameRate: 3, + repeat: -1, + }), + this.scene.anims.create({ + key: "playeridle", + frames: this.scene.anims.generateFrameNumbers("walt", { + start: 2, + end: 3, + }), + frameRate: 3, + repeat: -1, + }), + this.scene.anims.create({ + key: "playerwalk", + frames: this.scene.anims.generateFrameNumbers("walt", { + start: 4, + end: 6, + }), + frameRate: 10, + repeat: -1, + }), + this.scene.anims.create({ + key: "playerjump", + frames: this.scene.anims.generateFrameNumbers("walt", { + start: 4, + end: 4, + }), + frameRate: 1, + }), + this.scene.anims.create({ + key: "playerhammer", + frames: this.scene.anims.generateFrameNumbers("walt", { + start: 7, + end: 8, + }), + frameRate: 10, + }), + this.scene.anims.create({ + key: "playerbuild", + frames: this.scene.anims.generateFrameNumbers("walt", { + start: 9, + end: 10, + }), + frameRate: 10, + repeat: 2, + }), + this.scene.anims.create({ + key: "playerdead", + frames: this.scene.anims.generateFrameNumbers("walt", { + start: 11, + end: 16, + }), + frameRate: 5, + }), + this.anims.play("startidle", !0), + this.on("animationcomplete", this.animationComplete, this); + } + update() { + this.dead || + (this.jumping && + this.body.velocity.y >= 0 && + (this.body.setGravityY(700), (this.falling = !0)), + (Phaser.Input.Keyboard.JustDown(this.cursor.up) || + Phaser.Input.Keyboard.JustDown(this.W)) && + this.body.blocked.down + ? ((this.building = !1), + this.body.setVelocityY(this.jumpVelocity), + this.body.setGravityY(400), + this.anims.play("playerjump", !0), + this.scene.playAudio("jump"), + (this.jumping = !0), + this.jumpSmoke()) + : this.cursor.right.isDown || this.D.isDown + ? ((this.building = !1), + this.body.blocked.down && this.anims.play("playerwalk", !0), + (this.right = !0), + (this.flipX = this.body.velocity.x < 0), + this.body.setVelocityX(this.walkVelocity)) + : this.cursor.left.isDown || this.A.isDown + ? ((this.building = !1), + this.body.blocked.down && this.anims.play("playerwalk", !0), + (this.right = !1), + (this.flipX = !0), + this.body.setVelocityX(-this.walkVelocity)) + : (this.body.blocked.down && + (this.jumping && + (this.scene.playAudio("land"), this.landSmoke()), + (this.jumping = !1), + (this.falling = !1), + this.building || this.anims.play("playeridle", !0)), + this.body.setVelocityX(0)), + Phaser.Input.Keyboard.JustDown(this.spaceBar) && this.hammerBlow(), + (Phaser.Input.Keyboard.JustDown(this.cursor.down) || + Phaser.Input.Keyboard.JustDown(this.S)) && + this.buildBlock()); + } + landSmoke() { + this.jumpSmoke(20); + } + jumpSmoke(t = 10, e) { + Array(Phaser.Math.Between(3, 6)) + .fill(0) + .forEach((s) => { + const a = e || Phaser.Math.Between(-1, 1) > 0 ? 1 : -1; + (e = e || Phaser.Math.Between(0, 20)), + new i(this.scene, this.x + a * e, this.y + t); + }); + } + buildBlock() { + (this.building = !0), + this.anims.play("playerbuild", !0), + this.scene.playAudio("build"); + const t = this.right ? 64 : -64, + e = -400 === this.jumpVelocity ? 0 : -128; + this.buildSmoke(32, t), + this.scene.bricks.add(new n(this.scene, this.x + t, this.y + e)); + } + buildSmoke(t = 10, e) { + Array(Phaser.Math.Between(8, 14)) + .fill(0) + .forEach((s) => { + const a = Phaser.Math.Between(-20, 20); + new i(this.scene, this.x + (e + a), this.y + t); + }); + } + hammerBlow() { + (this.building = !0), this.anims.play("playerhammer", !0); + const t = this.right ? 32 : -32, + e = this.mjolnir ? 128 : 32; + this.scene.blows.add(new o(this.scene, this.x + t, this.y, e, e)); + } + turn() { + this.right = !this.right; + } + animationComplete(t, e) { + "playerground" === t.key && this.anims.play("playeridle", !0), + ("playerhammer" !== t.key && "playerbuild" !== t.key) || + ((this.building = !1), + this.anims.play(this.jumping ? "playerjump" : "playeridle", !0)); + } + hit() { + this.health--, + this.anims.play("playerdead", !0), + (this.body.enable = !1), + 0 === this.health && this.die(); + } + die() { + (this.dead = !0), + this.anims.play("playerdead", !0), + (this.body.immovable = !0), + (this.body.moves = !1), + this.scene.restartScene(); + } + applyPrize(t) { + switch (t) { + case "speed": + (this.walkVelocity = 330), this.flashPlayer(); + break; + case "hammer": + (this.mjolnir = !0), this.flashPlayer(); + break; + case "boots": + (this.jumpVelocity = -600), this.flashPlayer(); + break; + case "coin": + this.scene.updateCoins(); + break; + case "star": + (this.invincible = !0), + this.scene.tweens.add({ + targets: this, + duration: 300, + alpha: { from: 0.7, to: 1 }, + repeat: -1, + }); + } + } + flashPlayer() { + this.scene.tweens.add({ + targets: this, + duration: 50, + scale: { from: 1.2, to: 1 }, + repeat: 10, + }); + } +} +class l extends Phaser.Physics.Arcade.Sprite { + constructor(t, e, s, i = "right") { + super(t, e, s, "bat"), + (this.name = "bat"), + this.scene.physics.add.existing(this), + this.scene.physics.world.enable(this), + this.body.setAllowGravity(!1), + this.scene.add.existing(this), + (this.direction = "right" === i ? 1 : -1), + this.init(); + } + init() { + this.scene.anims.create({ + key: this.name, + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 0, + end: 1, + }), + frameRate: 5, + repeat: -1, + }), + this.scene.anims.create({ + key: this.name + "death", + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 2, + end: 5, + }), + frameRate: 5, + }), + this.anims.play(this.name, !0), + this.body.setVelocityX(150 * this.direction), + (this.flipX = this.direction > 0), + this.on("animationcomplete", this.animationComplete, this); + } + update() {} + turn() { + (this.direction = -this.direction), + (this.flipX = this.direction > 0), + this.body.setVelocityX(150 * this.direction); + } + death() { + (this.dead = !0), + (this.body.enable = !1), + (this.body.rotation = 0), + this.anims.play(this.name + "death"); + } + animationComplete(t, e) { + t.key === this.name + "death" && this.destroy(); + } +} +class c extends Phaser.Physics.Arcade.Sprite { + constructor(t, e, s, i = "right") { + super(t, e, s, "zombie"), + (this.name = "zombie"), + (this.scene = t), + this.scene.physics.add.existing(this), + this.scene.physics.world.enable(this), + this.body.setAllowGravity(!0), + this.scene.add.existing(this), + (this.direction = "right" === i ? -1 : 1), + this.init(); + } + init() { + this.scene.anims.create({ + key: this.name, + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 0, + end: 2, + }), + frameRate: 5, + repeat: -1, + }), + this.scene.anims.create({ + key: this.name + "death", + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 3, + end: 5, + }), + frameRate: 5, + }), + this.anims.play(this.name, !0), + this.body.setVelocityX(100 * this.direction), + (this.flipX = this.direction < 0), + this.on("animationcomplete", this.animationComplete, this); + } + turn() { + (this.direction = -this.direction), + (this.flipX = this.direction < 0), + this.body.setVelocityX(100 * this.direction); + } + death() { + (this.dead = !0), + (this.body.enable = !1), + (this.body.rotation = 0), + this.anims.play(this.name + "death"); + } + animationComplete(t, e) { + t.key === this.name + "death" && this.destroy(); + } +} +class m extends Phaser.GameObjects.Rectangle { + constructor(t, e, s, i = 32, a = 32, h = "") { + super(t, e, s, i, a, 16777215), + (this.type = h), + this.setAlpha(0), + (this.x = e), + (this.y = s), + t.add.existing(this), + t.physics.add.existing(this), + (this.body.immovable = !0), + (this.body.moves = !1); + } + disable() { + (this.visible = !1), this.destroy(); + } + destroy() { + super.destroy(); + } +} +class p extends Phaser.GameObjects.Sprite { + constructor(t, e, s, i = "coin") { + super(t, e, s, i), + (this.name = i), + this.setScale(0.7), + this.setOrigin(0.5), + t.add.existing(this), + t.physics.add.existing(this), + (this.body.immovable = !0), + (this.body.moves = !1), + (this.disabled = !1), + this.init(); + } + init() { + this.scene.anims.create({ + key: this.name, + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 0, + end: 7, + }), + frameRate: 10, + repeat: -1, + }), + this.anims.play(this.name, !0), + this.scene.tweens.add({ + targets: this, + duration: 500, + y: this.y - 20, + repeat: -1, + yoyo: !0, + }); + } + pick() { + const { x: t, y: e } = this.scene.cameras.main.getWorldPoint( + this.scene.scoreCoinsLogo.x, + this.scene.scoreCoinsLogo.y + ); + (this.disabled = !0), + this.scene.tweens.add({ + targets: this, + duration: 500, + x: { from: this.x, to: t }, + y: { from: this.y, to: e }, + scale: { from: 0.7, to: 0.5 }, + onComplete: () => { + this.destroy(); + }, + }); + } +} +class y extends Phaser.GameObjects.Sprite { + constructor(t, e, s, i = "lunchbox") { + super(t, e, s, i), + (this.scene = t), + (this.name = i), + this.setScale(1), + this.setOrigin(0.5), + t.add.existing(this), + t.physics.add.existing(this), + (this.body.immovable = !0), + (this.body.moves = !1), + (this.disabled = !1), + this.init(); + } + init() { + this.scene.anims.create({ + key: this.name, + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 0, + end: 0, + }), + frameRate: 1, + }), + this.scene.anims.create({ + key: this.name + "opened", + frames: this.scene.anims.generateFrameNumbers(this.name, { + start: 1, + end: 1, + }), + frameRate: 1, + }), + this.anims.play(this.name, !0), + this.scene.tweens.add({ + targets: this, + duration: 500, + y: this.y - 20, + repeat: -1, + yoyo: !0, + }); + } + pick() { + this.anims.play(this.name + "opened", !0), + this.showPrize(), + (this.disabled = !0), + this.scene.time.delayedCall( + 1e3, + () => { + this.destroy(), this.prizeSprite.destroy(); + }, + null, + this + ); + } + showPrize() { + const t = Phaser.Math.RND.pick([ + "boots", + "hammer", + "coin", + "star", + "speed", + ]); + this.scene.player.applyPrize(t), + (this.prizeSprite = this.scene.add + .sprite(this.x, this.y, t) + .setOrigin(0.5) + .setScale(0.8)), + this.scene.tweens.add({ + targets: this.prizeSprite, + duration: 500, + y: { from: this.y, to: this.y - 64 }, + onComplete: () => { + this.scene.playAudio("prize"); + }, + }); + } +} +class u extends Phaser.GameObjects.Container { + constructor(t, e, s, i = 4, a = !1) { + super(t, e, s), + (this.x = e), + (this.y = s), + this.scene.add.existing(this), + this.scene.physics.add.existing(this), + this.body.setAllowGravity(!1), + this.body.setBounce(1), + this.body.setSize(64 * i, 64), + this.body.setOffset(-2, -2), + (this.body.immovable = !0), + (this.body.moves = !1), + (this.chain = new Phaser.GameObjects.Sprite( + this.scene, + 32 * i - 32, + -2048, + "chain" + ).setOrigin(0)), + this.add(this.chain), + (this.platform = new Phaser.GameObjects.Sprite( + this.scene, + 0, + 0, + "platform" + i + ).setOrigin(0)), + this.add(this.platform), + this.init(); + } + init() { + const t = Phaser.Math.Between(0, 7); + let e = this.x, + s = this.y; + switch (t) { + case 0: + e = Phaser.Math.Between(-50, 50); + break; + case 1: + s = Phaser.Math.Between(-50, 50); + break; + case 2: + (e = Phaser.Math.Between(-100, 100)), + (s = Phaser.Math.Between(-100, 100)); + } + this.scene.tweens.add({ + targets: this, + duration: Phaser.Math.Between(4e3, 6e3), + x: { from: this.x, to: e }, + y: { from: this.y, to: s }, + repeat: -1, + yoyo: !0, + }); + } +} +class b extends t.Scene { + constructor() { + super({ key: "game" }), + (this.player = null), + (this.score = 0), + (this.scoreText = null); + } + init(t) { + (this.name = t.name), (this.number = t.number); + } + preload() {} + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.cameras.main.setBackgroundColor(6464191), + this.add.tileSprite(0, 1e3, 10240, 512, "landscape").setOrigin(0.5), + this.createMap(), + this.cameras.main.setBounds(0, 0, 41840, 40160), + this.physics.world.setBounds(0, 0, 41840, 40160), + this.addPlayer(), + this.cameras.main.startFollow(this.player, !0, 0.05, 0.05, 0, 240), + this.physics.world.enable([this.player]), + this.addScore(), + this.loadAudios(), + this.playMusic(); + } + addScore() { + (this.scoreCoins = this.add + .bitmapText(75, 10, "pixelFont", "x0", 30) + .setDropShadow(0, 4, 2236962, 0.9) + .setOrigin(0) + .setScrollFactor(0)), + (this.scoreCoinsLogo = this.add + .sprite(50, 25, "coin") + .setScale(1) + .setOrigin(0.5) + .setScrollFactor(0)), + this.anims.create({ + key: "coinscore", + frames: this.anims.generateFrameNumbers("coin", { start: 0, end: 7 }), + frameRate: 8, + }), + this.scoreCoinsLogo.play({ key: "coinscore", repeat: -1 }); + } + createMap() { + (this.tileMap = this.make.tilemap({ + key: "scene" + this.number, + tileWidth: 64, + tileHeight: 64, + })), + (this.tileSetBg = this.tileMap.addTilesetImage("background")), + console.log(this.tileMap), + this.tileMap.createLayer("background", this.tileSetBg), + (this.tileSet = this.tileMap.addTilesetImage("softbricks")), + (this.platform = this.tileMap.createLayer( + "scene" + this.number, + this.tileSet + )), + (this.objectsLayer = this.tileMap.getObjectLayer("objects")), + this.platform.setCollisionByExclusion([-1]), + (this.batGroup = this.add.group()), + (this.zombieGroup = this.add.group()), + (this.foesGroup = this.add.group()), + (this.turnGroup = this.add.group()), + (this.exitGroup = this.add.group()), + (this.platformGroup = this.add.group()), + (this.lunchBoxGroup = this.add.group()), + (this.bricks = this.add.group()), + this.addsObjects(), + this.addColliders(); + } + addsObjects() { + this.objectsLayer.objects.forEach((t) => { + if ("bat" === t.name) { + let e = new l(this, t.x, t.y, t.type); + this.batGroup.add(e), this.foesGroup.add(e); + } + if ("zombie" === t.name) { + let e = new c(this, t.x, t.y, t.type); + this.zombieGroup.add(e), this.foesGroup.add(e); + } + "platform" === t.name && + this.platformGroup.add(new u(this, t.x, t.y, t.type)), + "turn" === t.name && this.turnGroup.add(new m(this, t.x, t.y)), + "lunchbox" === t.name && this.lunchBoxGroup.add(new y(this, t.x, t.y)), + "text" === t.name && + this.add + .bitmapText(t.x, t.y, "pixelFont", t.text.text, 30) + .setDropShadow(2, 4, 2236962, 0.9) + .setOrigin(0), + "exit" === t.name && + this.exitGroup.add( + new m(this, t.x, t.y, t.width, t.height, t.type).setOrigin(0.5) + ); + }); + } + addColliders() { + this.physics.add.collider( + this.batGroup, + this.platform, + this.turnFoe, + () => !0, + this + ), + this.physics.add.collider( + this.zombieGroup, + this.bricks, + this.turnFoe, + () => !0, + this + ), + this.physics.add.collider( + this.batGroup, + this.bricks, + this.turnFoe, + () => !0, + this + ), + this.physics.add.collider( + this.zombieGroup, + this.turnGroup, + this.turnFoe, + () => !0, + this + ), + this.physics.add.collider( + this.zombieGroup, + this.platform, + this.hitFloor, + () => !0, + this + ); + } + turnFoe(t, e) { + t.turn(); + } + hitFloor() {} + addPlayer() { + (this.elements = this.add.group()), (this.coins = this.add.group()); + const t = this.objectsLayer.objects.find((t) => "player" === t.name); + (this.player = new d(this, t.x, t.y, 0)), + this.physics.add.collider( + this.player, + this.platform, + this.hitFloor, + () => !0, + this + ), + this.physics.add.collider( + this.player, + this.platformGroup, + this.hitFloor, + () => !0, + this + ), + this.physics.add.collider( + this.player, + this.bricks, + this.hitFloor, + () => !0, + this + ), + this.physics.add.overlap( + this.player, + this.coins, + this.pickCoin, + () => !0, + this + ), + this.physics.add.overlap( + this.player, + this.lunchBoxGroup, + this.pickLunchBox, + () => !0, + this + ), + this.physics.add.overlap( + this.player, + this.exitGroup, + () => { + this.playAudio("stage"), + this.time.delayedCall(1e3, () => this.finishScene(), null, this); + }, + () => !0, + this + ), + (this.blows = this.add.group()), + this.physics.add.overlap( + this.blows, + this.platform, + this.blowPlatform, + () => !0, + this + ), + this.physics.add.overlap( + this.blows, + this.bricks, + this.blowBrick, + () => !0, + this + ), + this.physics.add.overlap( + this.blows, + this.foesGroup, + this.blowFoe, + () => !0, + this + ), + this.physics.add.overlap( + this.bricks, + this.foesGroup, + this.foeBlowBrick, + () => !0, + this + ), + this.physics.add.collider( + this.player, + this.batGroup, + this.hitPlayer, + () => !0, + this + ), + this.physics.add.collider( + this.player, + this.zombieGroup, + this.hitPlayer, + () => !0, + this + ); + } + pickCoin(t, e) { + e.disabled || (e.pick(), this.playAudio("coin"), this.updateCoins()); + } + pickLunchBox(t, e) { + e.disabled || (this.playAudio("lunchbox"), e.pick()); + } + hitPlayer(t, e) { + t.invincible + ? (e.death(), this.playAudio("foedeath")) + : !t.dead && this.number > 0 && (t.die(), this.playAudio("death")); + } + blowFoe(t, e) { + this.playAudio("kill"), this.playAudio("foedeath"), e.death(); + } + foeBlowBrick(e, s) { + s.turn(), + Array(t.Math.Between(4, 6)) + .fill(0) + .forEach((t) => new a(this, e.x, e.y)), + e.destroy(); + } + blowPlatform(e, s) { + const i = this.getTile(s); + this.isBreakable(i) && + (this.playAudioRandomly("stone_fail"), + this.playAudioRandomly("stone"), + this.player.mjolnir && this.cameras.main.shake(30), + e.destroy(), + Array(t.Math.Between(4, 6)) + .fill(0) + .forEach((t) => new a(this, i.pixelX, i.pixelY)), + this.platform.removeTileAt(i.x, i.y), + this.spawnCoin(i)); + } + getTile(t) { + const { x: e, y: s } = t; + return this.platform.getTileAt(e, s); + } + isBreakable(t) { + return "break" === (null == t ? void 0 : t.properties.element); + } + spawnCoin(e) { + t.Math.Between(0, 11) > 5 && + this.time.delayedCall( + 500, + () => { + this.coins.add(new p(this, e.pixelX, e.pixelY)); + }, + null, + this + ); + } + blowBrick(e, s) { + this.player.mjolnir && this.cameras.main.shake(30), + this.playAudio("stone_fail"), + this.playAudioRandomly("stone"), + e.destroy(), + Array(t.Math.Between(4, 6)) + .fill(0) + .forEach((t) => new a(this, s.x, s.y)), + s.destroy(); + } + hitFloor(e, s) { + if ( + this.player.jumping && + !this.player.falling && + 0 === this.player.body.velocity.y + ) { + const e = this.getTile(s); + this.isBreakable(e) + ? (this.playAudioRandomly("stone"), + Array(t.Math.Between(4, 6)) + .fill(0) + .forEach((t) => new a(this, e.pixelX, e.pixelY)), + this.platform.removeTileAt(e.x, e.y)) + : "brick0" === (null == s ? void 0 : s.name) && + (this.playAudioRandomly("stone"), + Array(t.Math.Between(4, 6)) + .fill(0) + .forEach((t) => new a(this, s.x, s.y)), + s.destroy()); + } + } + loadAudios() { + this.audios = { + build: this.sound.add("build"), + coin: this.sound.add("coin"), + death: this.sound.add("death"), + jump: this.sound.add("jump"), + kill: this.sound.add("kill"), + land: this.sound.add("land"), + lunchbox: this.sound.add("lunchbox"), + prize: this.sound.add("prize"), + stone_fail: this.sound.add("stone_fail"), + stone: this.sound.add("stone"), + foedeath: this.sound.add("foedeath"), + stage: this.sound.add("stage"), + }; + } + playAudio(t) { + this.audios[t].play(); + } + playAudioRandomly(e) { + const s = t.Math.Between(0.8, 1), + i = t.Math.Between(0.8, 1); + this.audios[e].play({ volume: s, rate: i }); + } + playMusic(t = "game") { + (this.theme = this.sound.add("music" + this.number)), + this.theme.stop(), + this.theme.play({ + mute: !1, + volume: 0.7, + rate: 1, + detune: 0, + seek: 0, + loop: !0, + delay: 0, + }); + } + update() { + this.player.update(), + 3 === this.number && this.player.y > 1500 && this.restartScene(); + } + finishScene() { + this.theme && this.theme.stop(), + this.scene.start("transition", { + name: "STAGE", + number: this.number + 1, + }); + } + restartScene() { + this.time.delayedCall( + 1e3, + () => { + this.theme && this.theme.stop(), + this.scene.start("transition", { + name: "STAGE", + number: this.number, + }); + }, + null, + this + ); + } + updateCoins() { + const t = +this.registry.get("coins") + 1; + this.registry.set("coins", t), + this.scoreCoins.setText("x" + t), + this.tweens.add({ + targets: [this.scoreCoins, this.scoreCoinsLogo], + scale: { from: 1.4, to: 1 }, + duration: 50, + repeat: 10, + }); + } +} +const g = { + width: 1e3, + height: 800, + scale: { mode: t.Scale.FIT, autoCenter: t.Scale.CENTER_BOTH }, + autoRound: !1, + parent: "game-container", + physics: { default: "arcade", arcade: { gravity: { y: 300 }, debug: !0 } }, + scene: [e, h, r, b, s], +}; +new t.Game(g); diff --git a/wallhammer/src/main.js b/wallhammer/src/main.js index bcf5ae6d..0d57a971 100644 --- a/wallhammer/src/main.js +++ b/wallhammer/src/main.js @@ -1,9 +1,9 @@ import Phaser from "phaser"; import Bootloader from "./scenes/bootloader"; +import Game from "./scenes/game"; import Outro from "./scenes/outro"; import Splash from "./scenes/splash"; import Transition from "./scenes/transition"; -import Game from "./scenes/game"; const config = { width: 1000, @@ -13,7 +13,7 @@ const config = { autoCenter: Phaser.Scale.CENTER_BOTH, }, autoRound: false, - parent: "contenedor", + parent: "game-container", physics: { default: "arcade", arcade: { diff --git a/zenbaki/dist/assets/index-BA24paxW.js b/zenbaki/dist/assets/index-BA24paxW.js index e8b127c3..e94c4828 100644 --- a/zenbaki/dist/assets/index-BA24paxW.js +++ b/zenbaki/dist/assets/index-BA24paxW.js @@ -1 +1,2554 @@ -import{g as getAugmentedNamespace,c as commonjsGlobal,a as getDefaultExportFromCjs,P as Phaser$1}from"./phaser-CYd07urT.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 s of e)if("childList"===s.type)for(const e of s.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)}}();class Bootloader extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.setLoadEvents(),Array(15).fill(0).forEach(((e,t)=>{this.load.image(`cloud${t}`,`assets/images/cloud${t}.png`)})),this.load.image("pello","assets/images/pello.png"),this.load.image("sensei","assets/images/sensei.png"),this.load.audio("win","assets/sounds/win.mp3"),this.load.audio("drip","assets/sounds/drip.mp3"),this.load.audio("fail","assets/sounds/fail.mp3"),this.load.bitmapFont("mainFont","assets/fonts/hiro.png","assets/fonts/hiro.xml"),this.registry.set("score",0)}setLoadEvents(){this.load.on("progress",(function(e){this.progressBar.clear(),this.progressBar.fillStyle(8966732,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*e,16)}),this),this.load.on("complete",(()=>{this.scene.start("game")}),this)}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(33923,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class Player{constructor(e,t){this.scene=e,this.name=t,this.score=0,this.lastMessage=null,this.dead=!1,this.penalties=0}hasSpammed(){return!!this.lastMessage&&(new Date-this.lastMessage)/1e3{this.dead=!1}),null,this)}}var client$1={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$1=getAugmentedNamespace(__viteBrowserExternal$1);var utils={exports:{}};const actionMessageRegex=/^\u0001ACTION ([^\u0001]+)\u0001$/,justinFanRegex=/^(justinfan)(\d+$)/,unescapeIRCRegex=/\\([sn:r\\])/g,escapeIRCRegex=/([ \n;\r\\])/g,ircEscapedChars={s:" ",n:"",":":";",r:""},ircUnescapedChars={" ":"s","\n":"n",";":":","\r":"r"},urlRegex=new RegExp("^(?:(?:https?|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))\\.?)(?::\\d{2,5})?(?:[/?#]\\S*)?$","i"),regexEmoteRegex=/[|\\^$*+?:#]/,_$4=utils.exports={get:(e,t)=>void 0===e?t:e,hasOwn:(e,t)=>({}.hasOwnProperty.call(e,t)),promiseDelay:e=>new Promise((t=>setTimeout(t,e))),isFinite:e=>isFinite(e)&&!isNaN(parseFloat(e)),toNumber(e,t){if(null===e)return 0;const s=Math.pow(10,_$4.isFinite(t)?t:0);return Math.round(e*s)/s},isInteger:e=>!isNaN(_$4.toNumber(e,0)),isRegex:e=>regexEmoteRegex.test(e),isURL:e=>urlRegex.test(e),justinfan:()=>`justinfan${Math.floor(8e4*Math.random()+1e3)}`,isJustinfan:e=>justinFanRegex.test(e),channel(e){const t=(e||"").toLowerCase();return"#"===t[0]?t:"#"+t},username(e){const t=(e||"").toLowerCase();return"#"===t[0]?t.slice(1):t},token:e=>e?e.toLowerCase().replace("oauth:",""):"",password(e){const t=_$4.token(e);return t?`oauth:${t}`:""},actionMessage:e=>e.match(actionMessageRegex),replaceAll(e,t){if(null==e)return null;for(const s in t)e=e.replace(new RegExp(s,"g"),t[s]);return e},unescapeHtml:e=>e.replace(/\\&\\;/g,"&").replace(/\\<\\;/g,"<").replace(/\\>\\;/g,">").replace(/\\"\\;/g,'"').replace(/\\'\\;/g,"'"),unescapeIRC:e=>e&&"string"==typeof e&&e.includes("\\")?e.replace(unescapeIRCRegex,((e,t)=>t in ircEscapedChars?ircEscapedChars[t]:t)):e,escapeIRC:e=>e&&"string"==typeof e?e.replace(escapeIRCRegex,((e,t)=>t in ircUnescapedChars?`\\${ircUnescapedChars[t]}`:t)):e,addWord:(e,t)=>e.length?e+" "+t:e+t,splitLine(e,t){let s=e.substring(0,t).lastIndexOf(" ");return-1===s&&(s=t-1),[e.substring(0,s),e.substring(s+1)]},extractNumber(e){const t=e.split(" ");for(let s=0;s(r={statusCode:e.status,headers:e.headers},i.json?e.json():e.text()))).then((e=>t(null,r,e)),(e=>t(e,r,null)))}else{const i=Object.assign({method:"GET",headers:{}},e,{url:s}),n=new XMLHttpRequest;n.open(i.method,i.url,!0);for(const e in i.headers)n.setRequestHeader(e,i.headers[e]);n.responseType="json",n.addEventListener("load",(e=>{4===n.readyState&&(200!==n.status?t(n.status,null,null):t(null,null,n.response))})),n.send()}};const _$2=utilsExports;function followersonly(e,t){return e=_$2.channel(e),t=_$2.get(t,30),this._sendCommand(null,e,`/followers ${t}`,((s,i)=>{this.once("_promiseFollowers",(n=>{n?i(n):s([e,~~t])}))}))}function followersonlyoff(e){return e=_$2.channel(e),this._sendCommand(null,e,"/followersoff",((t,s)=>{this.once("_promiseFollowersoff",(i=>{i?s(i):t([e])}))}))}function part(e){return e=_$2.channel(e),this._sendCommand(null,null,`PART ${e}`,((t,s)=>{this.once("_promisePart",(i=>{i?s(i):t([e])}))}))}function r9kbeta(e){return e=_$2.channel(e),this._sendCommand(null,e,"/r9kbeta",((t,s)=>{this.once("_promiseR9kbeta",(i=>{i?s(i):t([e])}))}))}function r9kbetaoff(e){return e=_$2.channel(e),this._sendCommand(null,e,"/r9kbetaoff",((t,s)=>{this.once("_promiseR9kbetaoff",(i=>{i?s(i):t([e])}))}))}function slow(e,t){return e=_$2.channel(e),t=_$2.get(t,300),this._sendCommand(null,e,`/slow ${t}`,((s,i)=>{this.once("_promiseSlow",(n=>{n?i(n):s([e,~~t])}))}))}function slowoff(e){return e=_$2.channel(e),this._sendCommand(null,e,"/slowoff",((t,s)=>{this.once("_promiseSlowoff",(i=>{i?s(i):t([e])}))}))}var commands={action(e,t){return e=_$2.channel(e),t=`ACTION ${t}`,this._sendMessage(this._getPromiseDelay(),e,t,((s,i)=>{s([e,t])}))},ban(e,t,s){return e=_$2.channel(e),t=_$2.username(t),s=_$2.get(s,""),this._sendCommand(null,e,`/ban ${t} ${s}`,((i,n)=>{this.once("_promiseBan",(o=>{o?n(o):i([e,t,s])}))}))},clear(e){return e=_$2.channel(e),this._sendCommand(null,e,"/clear",((t,s)=>{this.once("_promiseClear",(i=>{i?s(i):t([e])}))}))},color(e,t){return t=_$2.get(t,e),this._sendCommand(null,"#tmijs",`/color ${t}`,((e,s)=>{this.once("_promiseColor",(i=>{i?s(i):e([t])}))}))},commercial(e,t){return e=_$2.channel(e),t=_$2.get(t,30),this._sendCommand(null,e,`/commercial ${t}`,((s,i)=>{this.once("_promiseCommercial",(n=>{n?i(n):s([e,~~t])}))}))},deletemessage(e,t){return e=_$2.channel(e),this._sendCommand(null,e,`/delete ${t}`,((t,s)=>{this.once("_promiseDeletemessage",(i=>{i?s(i):t([e])}))}))},emoteonly(e){return e=_$2.channel(e),this._sendCommand(null,e,"/emoteonly",((t,s)=>{this.once("_promiseEmoteonly",(i=>{i?s(i):t([e])}))}))},emoteonlyoff(e){return e=_$2.channel(e),this._sendCommand(null,e,"/emoteonlyoff",((t,s)=>{this.once("_promiseEmoteonlyoff",(i=>{i?s(i):t([e])}))}))},followersonly:followersonly,followersmode:followersonly,followersonlyoff:followersonlyoff,followersmodeoff:followersonlyoff,host(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(2e3,e,`/host ${t}`,((s,i)=>{this.once("_promiseHost",((n,o)=>{n?i(n):s([e,t,~~o])}))}))},join(e){return e=_$2.channel(e),this._sendCommand(void 0,null,`JOIN ${e}`,((t,s)=>{const i="_promiseJoin";let n=!1;const o=(r,a)=>{e===_$2.channel(a)&&(this.removeListener(i,o),n=!0,r?s(r):t([e]))};this.on(i,o);const r=this._getPromiseDelay();_$2.promiseDelay(r).then((()=>{n||this.emit(i,"No response from Twitch.",e)}))}))},mod(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(null,e,`/mod ${t}`,((s,i)=>{this.once("_promiseMod",(n=>{n?i(n):s([e,t])}))}))},mods(e){return e=_$2.channel(e),this._sendCommand(null,e,"/mods",((t,s)=>{this.once("_promiseMods",((i,n)=>{i?s(i):(n.forEach((t=>{this.moderators[e]||(this.moderators[e]=[]),this.moderators[e].includes(t)||this.moderators[e].push(t)})),t(n))}))}))},part:part,leave:part,ping(){return this._sendCommand(null,null,"PING",((e,t)=>{this.latency=new Date,this.pingTimeout=setTimeout((()=>{null!==this.ws&&(this.wasCloseCalled=!1,this.log.error("Ping timeout."),this.ws.close(),clearInterval(this.pingLoop),clearTimeout(this.pingTimeout))}),_$2.get(this.opts.connection.timeout,9999)),this.once("_promisePing",(t=>e([parseFloat(t)])))}))},r9kbeta:r9kbeta,r9kmode:r9kbeta,r9kbetaoff:r9kbetaoff,r9kmodeoff:r9kbetaoff,raw(e){return this._sendCommand(null,null,e,((t,s)=>{t([e])}))},say(e,t){return e=_$2.channel(e),t.startsWith(".")&&!t.startsWith("..")||t.startsWith("/")||t.startsWith("\\")?"me "===t.substr(1,3)?this.action(e,t.substr(4)):this._sendCommand(null,e,t,((s,i)=>{s([e,t])})):this._sendMessage(this._getPromiseDelay(),e,t,((s,i)=>{s([e,t])}))},slow:slow,slowmode:slow,slowoff:slowoff,slowmodeoff:slowoff,subscribers(e){return e=_$2.channel(e),this._sendCommand(null,e,"/subscribers",((t,s)=>{this.once("_promiseSubscribers",(i=>{i?s(i):t([e])}))}))},subscribersoff(e){return e=_$2.channel(e),this._sendCommand(null,e,"/subscribersoff",((t,s)=>{this.once("_promiseSubscribersoff",(i=>{i?s(i):t([e])}))}))},timeout(e,t,s,i){return e=_$2.channel(e),t=_$2.username(t),null===s||_$2.isInteger(s)||(i=s,s=300),s=_$2.get(s,300),i=_$2.get(i,""),this._sendCommand(null,e,`/timeout ${t} ${s} ${i}`,((n,o)=>{this.once("_promiseTimeout",(r=>{r?o(r):n([e,t,~~s,i])}))}))},unban(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(null,e,`/unban ${t}`,((s,i)=>{this.once("_promiseUnban",(n=>{n?i(n):s([e,t])}))}))},unhost(e){return e=_$2.channel(e),this._sendCommand(2e3,e,"/unhost",((t,s)=>{this.once("_promiseUnhost",(i=>{i?s(i):t([e])}))}))},unmod(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(null,e,`/unmod ${t}`,((s,i)=>{this.once("_promiseUnmod",(n=>{n?i(n):s([e,t])}))}))},unvip(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(null,e,`/unvip ${t}`,((s,i)=>{this.once("_promiseUnvip",(n=>{n?i(n):s([e,t])}))}))},vip(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(null,e,`/vip ${t}`,((s,i)=>{this.once("_promiseVip",(n=>{n?i(n):s([e,t])}))}))},vips(e){return e=_$2.channel(e),this._sendCommand(null,e,"/vips",((e,t)=>{this.once("_promiseVips",((s,i)=>{s?t(s):e(i)}))}))},whisper(e,t){return(e=_$2.username(e))===this.getUsername()?Promise.reject("Cannot send a whisper to the same account."):this._sendCommand(null,"#tmijs",`/w ${e} ${t}`,((e,t)=>{this.once("_promiseWhisper",(e=>{e&&t(e)}))})).catch((s=>{if(s&&"string"==typeof s&&0!==s.indexOf("No response from Twitch."))throw s;const i=_$2.channel(e),n=Object.assign({"message-type":"whisper","message-id":null,"thread-id":null,username:this.getUsername()},this.globaluserstate);return this.emits(["whisper","message"],[[i,n,t,!0],[i,n,t,!0]]),[e,t]}))}};function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var events=EventEmitter;function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(e){if(!isNumber(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},EventEmitter.prototype.emit=function(e){var t,s,i,n,o,r;if(this._events||(this._events={}),"error"===e&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(isUndefined(s=this._events[e]))return!1;if(isFunction(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),s.apply(this,n)}else if(isObject(s))for(n=Array.prototype.slice.call(arguments,1),i=(r=s.slice()).length,o=0;o0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(e,t){if(!isFunction(t))throw TypeError("listener must be a function");var s=!1;if(this._events.hasOwnProperty(e)&&"_"===e.charAt(0)){var i=1,n=e;for(var o in this._events)this._events.hasOwnProperty(o)&&o.startsWith(n)&&i++;e+=i}function r(){"_"!==e.charAt(0)||isNaN(e.substr(e.length-1))||(e=e.substring(0,e.length-1)),this.removeListener(e,r),s||(s=!0,t.apply(this,arguments))}return r.listener=t,this.on(e,r),this},EventEmitter.prototype.removeListener=function(e,t){var s,i,n,o;if(!isFunction(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=(s=this._events[e]).length,i=-1,s===t||isFunction(s.listener)&&s.listener===t){if(delete this._events[e],this._events.hasOwnProperty(e+"2")&&"_"===e.charAt(0)){var r=e;for(var a in this._events)this._events.hasOwnProperty(a)&&a.startsWith(r)&&(isNaN(parseInt(a.substr(a.length-1)))||(this._events[e+parseInt(a.substr(a.length-1)-1)]=this._events[a],delete this._events[a]));this._events[e]=this._events[e+"1"],delete this._events[e+"1"]}this._events.removeListener&&this.emit("removeListener",e,t)}else if(isObject(s)){for(o=n;o-- >0;)if(s[o]===t||s[o].listener&&s[o].listener===t){i=o;break}if(i<0)return this;1===s.length?(s.length=0,delete this._events[e]):s.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},EventEmitter.prototype.removeAllListeners=function(e){var t,s;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(isFunction(s=this._events[e]))this.removeListener(e,s);else if(s)for(;s.length;)this.removeListener(e,s[s.length-1]);return delete this._events[e],this},EventEmitter.prototype.listeners=function(e){return this._events&&this._events[e]?isFunction(this._events[e])?[this._events[e]]:this._events[e].slice():[]},EventEmitter.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(isFunction(t))return 1;if(t)return t.length}return 0},EventEmitter.listenerCount=function(e,t){return e.listenerCount(t)};const _$1=utilsExports;let currentLevel="info";const levels={trace:0,debug:1,info:2,warn:3,error:4,fatal:5};function log(e){return function(t){levels[e]>=levels[currentLevel]&&console.log(`[${_$1.formatDate(new Date)}] ${e}: ${t}`)}}var logger={setLevel(e){currentLevel=e},trace:log("trace"),debug:log("debug"),info:log("info"),warn:log("warn"),error:log("error"),fatal:log("fatal")};const _=utilsExports,nonspaceRegex=/\S+/g;function parseComplexTag(e,t,s=",",i="/",n){const o=e[t];if(void 0===o)return e;const r="string"==typeof o;if(e[t+"-raw"]=r?o:null,!0===o)return e[t]=null,e;if(e[t]={},r){const r=o.split(s);for(let s=0;sparseComplexTag(e,"badges"),badgeInfo:e=>parseComplexTag(e,"badge-info"),emotes:e=>parseComplexTag(e,"emotes","/",":",","),emoteRegex(e,t,s,i){nonspaceRegex.lastIndex=0;const n=new RegExp("(\\b|^|\\s)"+_.unescapeHtml(t)+"(\\b|$|\\s)");let o;for(;null!==(o=nonspaceRegex.exec(e));)n.test(o[0])&&(i[s]=i[s]||[],i[s].push([o.index,nonspaceRegex.lastIndex-1]))},emoteString(e,t,s,i){let n;for(nonspaceRegex.lastIndex=0;null!==(n=nonspaceRegex.exec(e));)n[0]===_.unescapeHtml(t)&&(i[s]=i[s]||[],i[s].push([n.index,nonspaceRegex.lastIndex-1]))},transformEmotes(e){let t="";return Object.keys(e).forEach((s=>{t=`${t+s}:`,e[s].forEach((e=>t=`${t+e.join("-")},`)),t=`${t.slice(0,-1)}/`})),t.slice(0,-1)},formTags(e){const t=[];for(const s in e){const i=_.escapeIRC(e[s]);t.push(`${s}=${i}`)}return`@${t.join(";")}`},msg(e){const t={raw:e,tags:{},prefix:null,command:null,params:[]};let s=0,i=0;if(64===e.charCodeAt(0)){if(i=e.indexOf(" "),-1===i)return null;const n=e.slice(1,i).split(";");for(let e=0;es?(t.command=e.slice(s),t):null;for(t.command=e.slice(s,i),s=i+1;32===e.charCodeAt(s);)s++;for(;sthis.next()),e)}}}var timer=Queue;!function(e){const t=void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:{},s=t.WebSocket||require$$1,i=t.fetch||require$$1,n=api,o=commands,r=events.EventEmitter,a=logger,h=parser,c=timer,l=utilsExports;let m=!1;const d=function e(t){if(this instanceof e==0)return new e(t);this.opts=l.get(t,{}),this.opts.channels=this.opts.channels||[],this.opts.connection=this.opts.connection||{},this.opts.identity=this.opts.identity||{},this.opts.options=this.opts.options||{},this.clientId=l.get(this.opts.options.clientId,null),this._globalDefaultChannel=l.channel(l.get(this.opts.options.globalDefaultChannel,"#tmijs")),this._skipMembership=l.get(this.opts.options.skipMembership,!1),this._skipUpdatingEmotesets=l.get(this.opts.options.skipUpdatingEmotesets,!1),this._updateEmotesetsTimer=null,this._updateEmotesetsTimerDelay=l.get(this.opts.options.updateEmotesetsTimer,6e4),this.maxReconnectAttempts=l.get(this.opts.connection.maxReconnectAttempts,1/0),this.maxReconnectInterval=l.get(this.opts.connection.maxReconnectInterval,3e4),this.reconnect=l.get(this.opts.connection.reconnect,!0),this.reconnectDecay=l.get(this.opts.connection.reconnectDecay,1.5),this.reconnectInterval=l.get(this.opts.connection.reconnectInterval,1e3),this.reconnecting=!1,this.reconnections=0,this.reconnectTimer=this.reconnectInterval,this.secure=l.get(this.opts.connection.secure,!this.opts.connection.server&&!this.opts.connection.port),this.emotes="",this.emotesets={},this.channels=[],this.currentLatency=0,this.globaluserstate={},this.lastJoined="",this.latency=new Date,this.moderators={},this.pingLoop=null,this.pingTimeout=null,this.reason="",this.username="",this.userstate={},this.wasCloseCalled=!1,this.ws=null;let s="error";this.opts.options.debug&&(s="info"),this.log=this.opts.logger||a;try{a.setLevel(s)}catch(i){}this.opts.channels.forEach(((e,t,s)=>s[t]=l.channel(e))),r.call(this),this.setMaxListeners(0)};l.inherits(d,r);for(const u in o)d.prototype[u]=o[u];d.prototype.emits=function(e,t){for(let s=0;s{this._isConnected()&&this.ws.send("PING"),this.latency=new Date,this.pingTimeout=setTimeout((()=>{null!==this.ws&&(this.wasCloseCalled=!1,this.log.error("Ping timeout."),this.ws.close(),clearInterval(this.pingLoop),clearTimeout(this.pingTimeout),clearTimeout(this._updateEmotesetsTimer))}),l.get(this.opts.connection.timeout,9999))}),6e4);let e=l.get(this.opts.options.joinInterval,2e3);e<300&&(e=300);const t=new c(e),s=[...new Set([...this.opts.channels,...this.channels])];this.channels=[];for(let i=0;i{this._isConnected()&&this.join(e).catch((e=>this.log.error(e)))}))}t.next();break}case"NOTICE":{const n=[null],o=[t,i,s],r=[t,!0],a=[t,!1],h=[o,n],c=[o,[i]],l=`[${t}] ${s}`;switch(i){case"subs_on":this.log.info(`[${t}] This room is now in subscribers-only mode.`),this.emits(["subscriber","subscribers","_promiseSubscribers"],[r,r,n]);break;case"subs_off":this.log.info(`[${t}] This room is no longer in subscribers-only mode.`),this.emits(["subscriber","subscribers","_promiseSubscribersoff"],[a,a,n]);break;case"emote_only_on":this.log.info(`[${t}] This room is now in emote-only mode.`),this.emits(["emoteonly","_promiseEmoteonly"],[r,n]);break;case"emote_only_off":this.log.info(`[${t}] This room is no longer in emote-only mode.`),this.emits(["emoteonly","_promiseEmoteonlyoff"],[a,n]);break;case"slow_on":case"slow_off":case"followers_on_zero":case"followers_on":case"followers_off":case"host_on":case"host_off":break;case"r9k_on":this.log.info(`[${t}] This room is now in r9k mode.`),this.emits(["r9kmode","r9kbeta","_promiseR9kbeta"],[r,r,n]);break;case"r9k_off":this.log.info(`[${t}] This room is no longer in r9k mode.`),this.emits(["r9kmode","r9kbeta","_promiseR9kbetaoff"],[a,a,n]);break;case"room_mods":{const e=s.split(": "),i=(e.length>1?e[1]:"").toLowerCase().split(", ").filter((e=>e));this.emits(["_promiseMods","mods"],[[null,i],[t,i]]);break}case"no_mods":this.emits(["_promiseMods","mods"],[[null,[]],[t,[]]]);break;case"vips_success":{s.endsWith(".")&&(s=s.slice(0,-1));const e=s.split(": "),i=(e.length>1?e[1]:"").toLowerCase().split(", ").filter((e=>e));this.emits(["_promiseVips","vips"],[[null,i],[t,i]]);break}case"no_vips":this.emits(["_promiseVips","vips"],[[null,[]],[t,[]]]);break;case"already_banned":case"bad_ban_admin":case"bad_ban_anon":case"bad_ban_broadcaster":case"bad_ban_global_mod":case"bad_ban_mod":case"bad_ban_self":case"bad_ban_staff":case"usage_ban":this.log.info(l),this.emits(["notice","_promiseBan"],c);break;case"ban_success":this.log.info(l),this.emits(["notice","_promiseBan"],h);break;case"usage_clear":this.log.info(l),this.emits(["notice","_promiseClear"],c);break;case"usage_mods":this.log.info(l),this.emits(["notice","_promiseMods"],[o,[i,[]]]);break;case"mod_success":this.log.info(l),this.emits(["notice","_promiseMod"],h);break;case"usage_vips":this.log.info(l),this.emits(["notice","_promiseVips"],[o,[i,[]]]);break;case"usage_vip":case"bad_vip_grantee_banned":case"bad_vip_grantee_already_vip":case"bad_vip_max_vips_reached":case"bad_vip_achievement_incomplete":this.log.info(l),this.emits(["notice","_promiseVip"],[o,[i,[]]]);break;case"vip_success":this.log.info(l),this.emits(["notice","_promiseVip"],h);break;case"usage_mod":case"bad_mod_banned":case"bad_mod_mod":this.log.info(l),this.emits(["notice","_promiseMod"],c);break;case"unmod_success":this.log.info(l),this.emits(["notice","_promiseUnmod"],h);break;case"unvip_success":this.log.info(l),this.emits(["notice","_promiseUnvip"],h);break;case"usage_unmod":case"bad_unmod_mod":this.log.info(l),this.emits(["notice","_promiseUnmod"],c);break;case"usage_unvip":case"bad_unvip_grantee_not_vip":this.log.info(l),this.emits(["notice","_promiseUnvip"],c);break;case"color_changed":this.log.info(l),this.emits(["notice","_promiseColor"],h);break;case"usage_color":case"turbo_only_color":this.log.info(l),this.emits(["notice","_promiseColor"],c);break;case"commercial_success":this.log.info(l),this.emits(["notice","_promiseCommercial"],h);break;case"usage_commercial":case"bad_commercial_error":this.log.info(l),this.emits(["notice","_promiseCommercial"],c);break;case"hosts_remaining":{this.log.info(l);const e=isNaN(s[0])?0:parseInt(s[0]);this.emits(["notice","_promiseHost"],[o,[null,~~e]]);break}case"bad_host_hosting":case"bad_host_rate_exceeded":case"bad_host_error":case"usage_host":this.log.info(l),this.emits(["notice","_promiseHost"],[o,[i,null]]);break;case"already_r9k_on":case"usage_r9k_on":this.log.info(l),this.emits(["notice","_promiseR9kbeta"],c);break;case"already_r9k_off":case"usage_r9k_off":this.log.info(l),this.emits(["notice","_promiseR9kbetaoff"],c);break;case"timeout_success":this.log.info(l),this.emits(["notice","_promiseTimeout"],h);break;case"delete_message_success":this.log.info(`[${t} ${s}]`),this.emits(["notice","_promiseDeletemessage"],h);break;case"already_subs_off":case"usage_subs_off":this.log.info(l),this.emits(["notice","_promiseSubscribersoff"],c);break;case"already_subs_on":case"usage_subs_on":this.log.info(l),this.emits(["notice","_promiseSubscribers"],c);break;case"already_emote_only_off":case"usage_emote_only_off":this.log.info(l),this.emits(["notice","_promiseEmoteonlyoff"],c);break;case"already_emote_only_on":case"usage_emote_only_on":this.log.info(l),this.emits(["notice","_promiseEmoteonly"],c);break;case"usage_slow_on":this.log.info(l),this.emits(["notice","_promiseSlow"],c);break;case"usage_slow_off":this.log.info(l),this.emits(["notice","_promiseSlowoff"],c);break;case"usage_timeout":case"bad_timeout_admin":case"bad_timeout_anon":case"bad_timeout_broadcaster":case"bad_timeout_duration":case"bad_timeout_global_mod":case"bad_timeout_mod":case"bad_timeout_self":case"bad_timeout_staff":this.log.info(l),this.emits(["notice","_promiseTimeout"],c);break;case"untimeout_success":case"unban_success":this.log.info(l),this.emits(["notice","_promiseUnban"],h);break;case"usage_unban":case"bad_unban_no_ban":this.log.info(l),this.emits(["notice","_promiseUnban"],c);break;case"usage_delete":case"bad_delete_message_error":case"bad_delete_message_broadcaster":case"bad_delete_message_mod":this.log.info(l),this.emits(["notice","_promiseDeletemessage"],c);break;case"usage_unhost":case"not_hosting":this.log.info(l),this.emits(["notice","_promiseUnhost"],c);break;case"whisper_invalid_login":case"whisper_invalid_self":case"whisper_limit_per_min":case"whisper_limit_per_sec":case"whisper_restricted":case"whisper_restricted_recipient":this.log.info(l),this.emits(["notice","_promiseWhisper"],c);break;case"no_permission":case"msg_banned":case"msg_room_not_found":case"msg_channel_suspended":case"tos_ban":case"invalid_user":this.log.info(l),this.emits(["notice","_promiseBan","_promiseClear","_promiseUnban","_promiseTimeout","_promiseDeletemessage","_promiseMods","_promiseMod","_promiseUnmod","_promiseVips","_promiseVip","_promiseUnvip","_promiseCommercial","_promiseHost","_promiseUnhost","_promiseJoin","_promisePart","_promiseR9kbeta","_promiseR9kbetaoff","_promiseSlow","_promiseSlowoff","_promiseFollowers","_promiseFollowersoff","_promiseSubscribers","_promiseSubscribersoff","_promiseEmoteonly","_promiseEmoteonlyoff","_promiseWhisper"],[o,[i,t]]);break;case"msg_rejected":case"msg_rejected_mandatory":this.log.info(l),this.emit("automod",t,i,s);break;case"unrecognized_cmd":case"cmds_available":case"host_target_went_offline":case"msg_censored_broadcaster":case"msg_duplicate":case"msg_emoteonly":case"msg_verified_email":case"msg_ratelimit":case"msg_subsonly":case"msg_timedout":case"msg_bad_characters":case"msg_channel_blocked":case"msg_facebook":case"msg_followersonly":case"msg_followersonly_followed":case"msg_followersonly_zero":case"msg_slowmode":case"msg_suspended":case"no_help":case"usage_disconnect":case"usage_help":case"usage_me":case"unavailable_command":this.log.info(l),this.emit("notice",t,i,s);break;default:s.includes("Login unsuccessful")||s.includes("Login authentication failed")||s.includes("Error logging in")||s.includes("Improperly formatted auth")?(this.wasCloseCalled=!1,this.reconnect=!1,this.reason=s,this.log.error(this.reason),this.ws.close()):s.includes("Invalid NICK")?(this.wasCloseCalled=!1,this.reconnect=!1,this.reason="Invalid NICK.",this.log.error(this.reason),this.ws.close()):(this.log.warn(`Could not parse NOTICE from tmi.twitch.tv:\n${JSON.stringify(e,null,4)}`),this.emit("notice",t,i,s))}break}case"USERNOTICE":{const e=n["display-name"]||n.login,o=n["msg-param-sub-plan"]||"",r=l.unescapeIRC(l.get(n["msg-param-sub-plan-name"],""))||null,a={prime:o.includes("Prime"),plan:o,planName:r},h=~~(n["msg-param-streak-months"]||0),c=n["msg-param-recipient-display-name"]||n["msg-param-recipient-user-name"],m=~~n["msg-param-mass-gift-count"];switch(n["message-type"]=i,i){case"resub":this.emits(["resub","subanniversary"],[[t,e,h,s,n,a]]);break;case"sub":this.emits(["subscription","sub"],[[t,e,a,s,n]]);break;case"subgift":this.emit("subgift",t,e,h,c,a,n);break;case"anonsubgift":this.emit("anonsubgift",t,h,c,a,n);break;case"submysterygift":this.emit("submysterygift",t,e,m,a,n);break;case"anonsubmysterygift":this.emit("anonsubmysterygift",t,m,a,n);break;case"primepaidupgrade":this.emit("primepaidupgrade",t,e,a,n);break;case"giftpaidupgrade":{const s=n["msg-param-sender-name"]||n["msg-param-sender-login"];this.emit("giftpaidupgrade",t,e,s,n);break}case"anongiftpaidupgrade":this.emit("anongiftpaidupgrade",t,e,n);break;case"raid":{const e=n["msg-param-displayName"]||n["msg-param-login"],s=+n["msg-param-viewerCount"];this.emit("raided",t,e,s,n);break}case"ritual":{const i=n["msg-param-ritual-name"];"new_chatter"===i?this.emit("newchatter",t,e,n,s):this.emit("ritual",i,t,e,n,s);break}default:this.emit("usernotice",i,t,n,s)}break}case"HOSTTARGET":{const e=s.split(" "),i=~~e[1]||0;"-"===e[0]?(this.log.info(`[${t}] Exited host mode.`),this.emits(["unhost","_promiseUnhost"],[[t,i],[null]])):(this.log.info(`[${t}] Now hosting ${e[0]} for ${i} viewer(s).`),this.emit("hosting",t,e[0],i));break}case"CLEARCHAT":if(e.params.length>1){const i=l.get(e.tags["ban-duration"],null);null===i?(this.log.info(`[${t}] ${s} has been banned.`),this.emit("ban",t,s,null,e.tags)):(this.log.info(`[${t}] ${s} has been timed out for ${i} seconds.`),this.emit("timeout",t,s,null,~~i,e.tags))}else this.log.info(`[${t}] Chat was cleared by a moderator.`),this.emits(["clearchat","_promiseClear"],[[t],[null]]);break;case"CLEARMSG":if(e.params.length>1){const e=s,i=n.login;n["message-type"]="messagedeleted",this.log.info(`[${t}] ${i}'s message has been deleted.`),this.emit("messagedeleted",t,i,e,n)}break;case"RECONNECT":this.log.info("Received RECONNECT request from Twitch.."),this.log.info(`Disconnecting and reconnecting in ${Math.round(this.reconnectTimer/1e3)} seconds..`),this.disconnect().catch((e=>this.log.error(e))),setTimeout((()=>this.connect().catch((e=>this.log.error(e)))),this.reconnectTimer);break;case"USERSTATE":e.tags.username=this.username,"mod"===e.tags["user-type"]&&(this.moderators[t]||(this.moderators[t]=[]),this.moderators[t].includes(this.username)||this.moderators[t].push(this.username)),l.isJustinfan(this.getUsername())||this.userstate[t]||(this.userstate[t]=n,this.lastJoined=t,this.channels.push(t),this.log.info(`Joined ${t}`),this.emit("join",t,l.username(this.getUsername()),!0)),e.tags["emote-sets"]!==this.emotes&&this._updateEmoteset(e.tags["emote-sets"]),this.userstate[t]=n;break;case"GLOBALUSERSTATE":this.globaluserstate=n,this.emit("globaluserstate",n),void 0!==e.tags["emote-sets"]&&this._updateEmoteset(e.tags["emote-sets"]);break;case"ROOMSTATE":if(l.channel(this.lastJoined)===t&&this.emit("_promiseJoin",null,t),e.tags.channel=t,this.emit("roomstate",t,e.tags),!l.hasOwn(e.tags,"subs-only")){if(l.hasOwn(e.tags,"slow"))if("boolean"!=typeof e.tags.slow||e.tags.slow){const s=[t,!0,~~e.tags.slow];this.log.info(`[${t}] This room is now in slow mode.`),this.emits(["slow","slowmode","_promiseSlow"],[s,s,[null]])}else{const e=[t,!1,0];this.log.info(`[${t}] This room is no longer in slow mode.`),this.emits(["slow","slowmode","_promiseSlowoff"],[e,e,[null]])}if(l.hasOwn(e.tags,"followers-only"))if("-1"===e.tags["followers-only"]){const e=[t,!1,0];this.log.info(`[${t}] This room is no longer in followers-only mode.`),this.emits(["followersonly","followersmode","_promiseFollowersoff"],[e,e,[null]])}else{const s=[t,!0,~~e.tags["followers-only"]];this.log.info(`[${t}] This room is now in follower-only mode.`),this.emits(["followersonly","followersmode","_promiseFollowers"],[s,s,[null]])}}break;default:this.log.warn(`Could not parse message from tmi.twitch.tv:\n${JSON.stringify(e,null,4)}`)}else if("jtv"===e.prefix)"MODE"===e.command?"+o"===s?(this.moderators[t]||(this.moderators[t]=[]),this.moderators[t].includes(e.params[2])||this.moderators[t].push(e.params[2]),this.emit("mod",t,e.params[2])):"-o"===s&&(this.moderators[t]||(this.moderators[t]=[]),this.moderators[t].filter((t=>t!==e.params[2])),this.emit("unmod",t,e.params[2])):this.log.warn(`Could not parse message from jtv:\n${JSON.stringify(e,null,4)}`);else switch(e.command){case"353":this.emit("names",e.params[2],e.params[3].split(" "));break;case"366":break;case"JOIN":{const s=e.prefix.split("!")[0];l.isJustinfan(this.getUsername())&&this.username===s&&(this.lastJoined=t,this.channels.push(t),this.log.info(`Joined ${t}`),this.emit("join",t,s,!0)),this.username!==s&&this.emit("join",t,s,!1);break}case"PART":{let s=!1;const i=e.prefix.split("!")[0];if(this.username===i){s=!0,this.userstate[t]&&delete this.userstate[t];let e=this.channels.indexOf(t);-1!==e&&this.channels.splice(e,1),e=this.opts.channels.indexOf(t),-1!==e&&this.opts.channels.splice(e,1),this.log.info(`Left ${t}`),this.emit("_promisePart",null)}this.emit("part",t,i,s);break}case"WHISPER":{const t=e.prefix.split("!")[0];this.log.info(`[WHISPER] <${t}>: ${s}`),l.hasOwn(e.tags,"username")||(e.tags.username=t),e.tags["message-type"]="whisper";const i=l.channel(e.tags.username);this.emits(["whisper","message"],[[i,e.tags,s,!1]]);break}case"PRIVMSG":if(e.tags.username=e.prefix.split("!")[0],"jtv"===e.tags.username){const e=l.username(s.split(" ")[0]),i=s.includes("auto");if(s.includes("hosting you for")){const n=l.extractNumber(s);this.emit("hosted",t,e,n,i)}else s.includes("hosting you")&&this.emit("hosted",t,e,0,i)}else{const i=l.get(this.opts.options.messagesLogLevel,"info"),n=l.actionMessage(s);if(e.tags["message-type"]=n?"action":"chat",s=n?n[1]:s,l.hasOwn(e.tags,"bits"))this.emit("cheer",t,e.tags,s);else{if(l.hasOwn(e.tags,"msg-id")){if("highlighted-message"===e.tags["msg-id"]){const i=e.tags["msg-id"];this.emit("redeem",t,e.tags.username,i,e.tags,s)}else if("skip-subs-mode-message"===e.tags["msg-id"]){const i=e.tags["msg-id"];this.emit("redeem",t,e.tags.username,i,e.tags,s)}}else if(l.hasOwn(e.tags,"custom-reward-id")){const i=e.tags["custom-reward-id"];this.emit("redeem",t,e.tags.username,i,e.tags,s)}n?(this.log[i](`[${t}] *<${e.tags.username}>: ${s}`),this.emits(["action","message"],[[t,e.tags,s,!1]])):(this.log[i](`[${t}] <${e.tags.username}>: ${s}`),this.emits(["chat","message"],[[t,e.tags,s,!1]]))}}break;default:this.log.warn(`Could not parse message:\n${JSON.stringify(e,null,4)}`)}},d.prototype.connect=function(){return new Promise(((e,t)=>{this.server=l.get(this.opts.connection.server,"irc-ws.chat.twitch.tv"),this.port=l.get(this.opts.connection.port,80),this.secure&&(this.port=443),443===this.port&&(this.secure=!0),this.reconnectTimer=this.reconnectTimer*this.reconnectDecay,this.reconnectTimer>=this.maxReconnectInterval&&(this.reconnectTimer=this.maxReconnectInterval),this._openConnection(),this.once("_promiseConnect",(s=>{s?t(s):e([this.server,~~this.port])}))}))},d.prototype._openConnection=function(){const e=`${this.secure?"wss":"ws"}://${this.server}:${this.port}/`,t={};"agent"in this.opts.connection&&(t.agent=this.opts.connection.agent),this.ws=new s(e,"irc",t),this.ws.onmessage=this._onMessage.bind(this),this.ws.onerror=this._onError.bind(this),this.ws.onclose=this._onClose.bind(this),this.ws.onopen=this._onOpen.bind(this)},d.prototype._onOpen=function(){this._isConnected()&&(this.log.info(`Connecting to ${this.server} on port ${this.port}..`),this.emit("connecting",this.server,~~this.port),this.username=l.get(this.opts.identity.username,l.justinfan()),this._getToken().then((e=>{const t=l.password(e);this.log.info("Sending authentication to server.."),this.emit("logon");let s="twitch.tv/tags twitch.tv/commands";this._skipMembership||(s+=" twitch.tv/membership"),this.ws.send("CAP REQ :"+s),t?this.ws.send(`PASS ${t}`):l.isJustinfan(this.username)&&this.ws.send("PASS SCHMOOPIIE"),this.ws.send(`NICK ${this.username}`)})).catch((e=>{this.emits(["_promiseConnect","disconnected"],[[e],["Could not get a token."]])})))},d.prototype._getToken=function(){const e=this.opts.identity.password;let t;return"function"==typeof e?(t=e(),t instanceof Promise?t:Promise.resolve(t)):Promise.resolve(e)},d.prototype._onMessage=function(e){e.data.trim().split("\r\n").forEach((e=>{const t=h.msg(e);t&&this.handleMessage(t)}))},d.prototype._onError=function(){this.moderators={},this.userstate={},this.globaluserstate={},clearInterval(this.pingLoop),clearTimeout(this.pingTimeout),clearTimeout(this._updateEmotesetsTimer),this.reason=null===this.ws?"Connection closed.":"Unable to connect.",this.emits(["_promiseConnect","disconnected"],[[this.reason]]),this.reconnect&&this.reconnections===this.maxReconnectAttempts&&(this.emit("maxreconnect"),this.log.error("Maximum reconnection attempts reached.")),this.reconnect&&!this.reconnecting&&this.reconnections<=this.maxReconnectAttempts-1&&(this.reconnecting=!0,this.reconnections=this.reconnections+1,this.log.error(`Reconnecting in ${Math.round(this.reconnectTimer/1e3)} seconds..`),this.emit("reconnect"),setTimeout((()=>{this.reconnecting=!1,this.connect().catch((e=>this.log.error(e)))}),this.reconnectTimer)),this.ws=null},d.prototype._onClose=function(){this.moderators={},this.userstate={},this.globaluserstate={},clearInterval(this.pingLoop),clearTimeout(this.pingTimeout),clearTimeout(this._updateEmotesetsTimer),this.wasCloseCalled?(this.wasCloseCalled=!1,this.reason="Connection closed.",this.log.info(this.reason),this.emits(["_promiseConnect","_promiseDisconnect","disconnected"],[[this.reason],[null],[this.reason]])):(this.emits(["_promiseConnect","disconnected"],[[this.reason]]),this.reconnect&&this.reconnections===this.maxReconnectAttempts&&(this.emit("maxreconnect"),this.log.error("Maximum reconnection attempts reached.")),this.reconnect&&!this.reconnecting&&this.reconnections<=this.maxReconnectAttempts-1&&(this.reconnecting=!0,this.reconnections=this.reconnections+1,this.log.error(`Could not connect to server. Reconnecting in ${Math.round(this.reconnectTimer/1e3)} seconds..`),this.emit("reconnect"),setTimeout((()=>{this.reconnecting=!1,this.connect().catch((e=>this.log.error(e)))}),this.reconnectTimer))),this.ws=null},d.prototype._getPromiseDelay=function(){return this.currentLatency<=600?600:this.currentLatency+100},d.prototype._sendCommand=function(e,t,s,i){return new Promise(((n,o)=>{if(!this._isConnected())return o("Not connected to server.");if(null!==e&&"number"!=typeof e||(null===e&&(e=this._getPromiseDelay()),l.promiseDelay(e).then((()=>o("No response from Twitch.")))),null!==t){const e=l.channel(t);this.log.info(`[${e}] Executing command: ${s}`),this.ws.send(`PRIVMSG ${e} :${s}`)}else this.log.info(`Executing command: ${s}`),this.ws.send(s);"function"==typeof i?i(n,o):n()}))},d.prototype._sendMessage=function(e,t,s,i){return new Promise(((n,o)=>{if(!this._isConnected())return o("Not connected to server.");if(l.isJustinfan(this.getUsername()))return o("Cannot send anonymous messages.");const r=l.channel(t);if(this.userstate[r]||(this.userstate[r]={}),s.length>=500){const i=l.splitLine(s,500);s=i[0],setTimeout((()=>{this._sendMessage(e,t,i[1],(()=>{}))}),350)}this.ws.send(`PRIVMSG ${r} :${s}`);const a={};Object.keys(this.emotesets).forEach((e=>this.emotesets[e].forEach((e=>(l.isRegex(e.code)?h.emoteRegex:h.emoteString)(s,e.code,e.id,a)))));const c=Object.assign(this.userstate[r],h.emotes({emotes:h.transformEmotes(a)||null})),m=l.get(this.opts.options.messagesLogLevel,"info"),d=l.actionMessage(s);d?(c["message-type"]="action",this.log[m](`[${r}] *<${this.getUsername()}>: ${d[1]}`),this.emits(["action","message"],[[r,c,d[1],!0]])):(c["message-type"]="chat",this.log[m](`[${r}] <${this.getUsername()}>: ${s}`),this.emits(["chat","message"],[[r,c,s,!0]])),"function"==typeof i?i(n,o):n()}))},d.prototype._updateEmoteset=function(e){let t=void 0!==e;if(t&&(e===this.emotes?t=!1:this.emotes=e),this._skipUpdatingEmotesets)return void(t&&this.emit("emotesets",e,{}));const s=()=>{this._updateEmotesetsTimerDelay>0&&(clearTimeout(this._updateEmotesetsTimer),this._updateEmotesetsTimer=setTimeout((()=>this._updateEmoteset(e)),this._updateEmotesetsTimerDelay))};this._getToken().then((t=>{const s=`https://api.twitch.tv/kraken/chat/emoticon_images?emotesets=${e}`,n={};return"fetchAgent"in this.opts.connection&&(n.agent=this.opts.connection.fetchAgent),i(s,{...n,headers:{Accept:"application/vnd.twitchtv.v5+json",Authorization:`OAuth ${l.token(t)}`,"Client-ID":this.clientId}})})).then((e=>e.json())).then((t=>{this.emotesets=t.emoticon_sets||{},this.emit("emotesets",e,this.emotesets),s()})).catch((()=>s()))},d.prototype.getUsername=function(){return this.username},d.prototype.getOptions=function(){return this.opts},d.prototype.getChannels=function(){return this.channels},d.prototype.isMod=function(e,t){const s=l.channel(e);return this.moderators[s]||(this.moderators[s]=[]),this.moderators[s].includes(l.username(t))},d.prototype.readyState=function(){return null===this.ws?"CLOSED":["CONNECTING","OPEN","CLOSING","CLOSED"][this.ws.readyState]},d.prototype._isConnected=function(){return null!==this.ws&&1===this.ws.readyState},d.prototype.disconnect=function(){return new Promise(((e,t)=>{null!==this.ws&&3!==this.ws.readyState?(this.wasCloseCalled=!0,this.log.info("Disconnecting from server.."),this.ws.close(),this.once("_promiseDisconnect",(()=>e([this.server,~~this.port])))):(this.log.error("Cannot disconnect from server. Socket is not opened or connection is already closing."),t("Cannot disconnect from server. Socket is not opened or connection is already closing."))}))},d.prototype.off=d.prototype.removeListener,e.exports&&(e.exports=d),"undefined"!=typeof window&&(window.tmi={client:d,Client:d})}(client$1);var clientExports=client$1.exports;const client=clientExports;var tmi_js={client:client,Client:client};const tmi=getDefaultExportFromCjs(tmi_js);class Chat{constructor(e,t,s,i){this.scene=e,this._username=t,this._password=s;const n=new URLSearchParams(window.location.search);this.channel=n.get("channel")||"devdiaries",this.feedback="1"==n.get("feedback"),this.maxPlayers=this.isValidNumberWithMax(n.get("maxplayers"))?+n.get("maxplayers"):500,this.init()}init(){console.log("Chat channel: ",this.channel,"feedback: ",this.feedback,"maxPlayers: ",this.maxPlayers),this.client=new tmi.Client({options:{debug:!1},channels:[this.channel]}),this.client.connect().then((e=>{console.log("Connected!, loading game"),this.scene.loadGame()})).catch(console.error),this.setOnJoinListener(),this.setOnMessageListener(),this.setOnChatListener}setOnJoinListener(){this.client.on("join",((e,t,s)=>{console.log("Somebody joined the chat: ",e,t),s&&this.scene.addPlayer(t)}))}setOnMessageListener(){this.client.on("message",((e,t,s,i)=>{console.log(`Message: ${t.username} just ${s}`),this.processMessage(t.username,s)}))}setOnChatListener(){this.client.on("chat",(async(e,t,s,i)=>{t.mod;const n=s.toLowerCase().split(" ");console.log("Received chat: ",e,t,n),this.processMessage(t["display-name"],s)}))}processMessage(e,t){this.isValidNumber(t)&&this.scene.guess(e,+t)}sendAction(e,t){console.log("Sending action: ",this.feedback,e,t),this.feedback&&this.client.action(e,t)}say(e){this.feedback&&this.client.say(this.channel,e)}isValidNumberWithMax(e,t=100){return this.isValidNumber(e)&&+e>0&&+e<=t}isValidNumber(e){return!isNaN(e)}}class Game extends Phaser.Scene{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null,this.nextOperator="",this.lastMessage=null,this.number="",this.counter=0,this.failed=!1}preload(){const e=new URLSearchParams(window.location.search);let t=e.get("background")||"#00b140";t=parseInt(t.substring(1),16),this.backgroundColor="0x"+t.toString(16);let s=e.get("foreground")||"#F0EAD6";s=parseInt(s.substring(1),16),this.foregroundColor="0x"+s.toString(16),this.spamTimeWait=2,this.result=Phaser.Math.Between(1,9)}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(+this.foregroundColor),this.allPlayers={},this.addChat(),this.loadAudios(),this.addUI()}addChat(){this.chat=new Chat(this)}loadGame(){this.generateNextOperation()}addUI(){this.circle=this.add.circle(this.center_width,this.center_height-50,100,15871022),this.numberText=this.add.bitmapText(this.center_width,this.center_height-50,"mainFont",this.number,120).setOrigin(.5).setTint(0),this.operatorText=this.add.bitmapText(this.center_width,this.center_height+80,"mainFont",`${this.nextOperator}${this.number}`,50).setOrigin(.5).setTint(0),this.addClouds(),this.addScore(),this.byText=this.add.bitmapText(this.center_width,this.height-10,"mainFont","by Pello",10).setOrigin(.5).setTint(0)}addClouds(){this.cloudLeft=this.add.image(this.center_width-100,this.center_height-120+Phaser.Math.Between(-15,15),"cloud"+Phaser.Math.Between(1,14)).setScale(.1*Phaser.Math.Between(5,9)),this.cloudRight=this.add.image(this.center_width+100,this.center_height+30+Phaser.Math.Between(-15,15),"cloud"+Phaser.Math.Between(1,14)).setScale(.1*Phaser.Math.Between(4,6)),this.tweens.add({targets:[this.cloudLeft],x:{from:-156,to:this.width+156},duration:3e4,onComplete:()=>{this.cloudLeft.destroy()}}),this.tweens.add({targets:this.cloudRight,x:{from:this.width+156,to:-156},duration:3e4,onComplete:()=>{this.cloudLeft.destroy(),this.addClouds()}})}addScore(){const e=this.createScoreBoard();this.add.bitmapText(this.center_width,25,"mainFont","zenbaki",25).setOrigin(.5).setTint(0),e.slice(0,3).forEach(((e,t)=>{const s=`${t+1}. ${e.name}: ${e.score}`;this.add.bitmapText(this.center_width,100+50*t,"mainFont",s,30).setOrigin(.5).setTint(this.foregroundColor).setDropShadow(1,2,12526882,.7)})),this.scoreText1=this.add.bitmapText(this.center_width,this.center_height+130,"mainFont","",20).setOrigin(.5).setTint(0),this.scoreText2=this.add.bitmapText(this.center_width,this.center_height+160,"mainFont","",25).setOrigin(.5).setTint(0)}addPlayer(e){if(this.allPlayers[e])return this.allPlayers[e];const t=new Player(this,e);return this.allPlayers[e]=t,this.chat.say(`Player ${e} joins game!`),t}guess(e,t){if(this.failed)return;console.log("Game> guess: ",e,t);const s=this.addPlayer(e);if(!s.dead&&!s.hasSpammed())if(s.lastMessage=new Date,console.log("Game> guess go on: ",e,t),this.result===parseInt(t)){const i=this.calculateScore();s.score+=i,this.showScore(e,i),this.generateNextOperation(),console.log("Player",e,"guess",t)}else this.number===parseInt(t)?console.log("Player, ",e," is too slow"):(this.cameras.main.shake(100,.01),this.playAudio("fail"),this.failed=!0,s.setPenalty(),this.showShame(e),this.chat.say(`Player ${e} failed! Shame on you!`))}calculateScore(){return this.counter+{"+":1,"-":2,"*":4,"/":5}[this.nextOperator]}loadAudios(){this.audios={win:this.sound.add("win"),drip:this.sound.add("drip"),fail:this.sound.add("fail")}}playAudio(e){this.audios[e].play({volume:.5})}showResult(){const e=this.createScoreBoard();this.scoreRectangle=this.add.rectangle(0,0,this.width,this.height,this.foregroundColor,.9).setOrigin(0,0),this.scores=this.add.group(),this.sensei=this.add.image(this.center_width,this.height-60,"sensei").setOrigin(.5).setScale(.4),this.scores.add(this.sensei),this.scores.add(this.add.bitmapText(this.center_width,60,"mainFont","Senseis:",30).setOrigin(.5).setTint(0)),e.slice(0,5).forEach(((e,t)=>{const s=`${t+1}. ${e.name}, ${e.score}`;this.scores.add(this.add.bitmapText(this.center_width,100+20*t,"mainFont",s,15).setOrigin(.5).setTint(0))})),this.removeResult()}removeResult(){this.time.delayedCall(5e3,(()=>{this.tweens.add({targets:[this.scoreRectangle,this.scores,this.sensei],duration:1e3,alpha:{from:1,to:0},onComplete:()=>{this.scoreRectangle.destroy(),this.scores.getChildren().forEach((function(e){e.destroy()}),this),this.scores.clear(!0,!0)}}),this.resetScore(),this.generateNextOperation()}),null,this)}createScoreBoard(){return[...Object.values(this.allPlayers)].sort(((e,t)=>t.score-e.score))}resetScore(){this.number=0,this.counter=0,this.failed=!1}generateNextOperation(){this.counter++,this.number=this.result,this.nextOperand=Phaser.Math.Between(1,9),this.nextOperator=this.selectOperator(),this.result=parseInt(eval(this.number+this.nextOperator+this.nextOperand)),console.log("Current: ",this.number," operator: ",this.nextOperator," nextNumber: ",this.nextOperand,", Result: ",this.result),this.showNextOperation(this.nextOperator,this.nextOperand),this.playAudio("drip")}selectOperator(){return this.number%this.nextOperand==0&&1!==this.nextOperand?Phaser.Math.RND.pick(["+","-","+","-","/"]):this.number+this.nextOperand>=100?Phaser.Math.RND.pick(["-"]):this.number-this.nextOperand<=-100?Phaser.Math.RND.pick(["+"]):Math.abs(this.number*this.nextOperand)<100?Phaser.Math.RND.pick(["+","-","+","-","*"]):Phaser.Math.RND.pick(["+","-","+","-"])}showScore(e,t){this.scoreText1.setText("Great!").setAlpha(1),this.scoreText2.setText(`${e} +${t}`).setAlpha(1),this.tweens.add({targets:[this.scoreText1],alpha:{from:1,to:0},ease:"Linear",duration:3e3})}showShame(e){this.scoreText1.setText(Phaser.Math.RND.pick(["You're a disgrace","Shame on you","You dishonor us all","You're a disappointment","You're a failure","You dishonor this dojo"])).setAlpha(1),this.scoreText2.setText(`${e}`).setAlpha(1),this.tweens.add({targets:[this.scoreText1,this.scoreText2],alpha:{from:1,to:0},ease:"Linear",duration:3e3,onComplete:()=>{this.showResult()}})}showNextOperation(e,t){this.numberText.setText(this.number),this.operatorText.setText(`${e}${t}`)}}const config={width:260,height:380,scale:{autoCenter:Phaser$1.Scale.CENTER_BOTH},autoRound:!1,parent:"contenedor",physics:{default:"arcade",arcade:{gravity:{y:300},debug:!1}},scene:[Bootloader,Game]};new Phaser$1.Game(config); +import { + P as Phaser$1, + c as commonjsGlobal, + g as getAugmentedNamespace, + a as getDefaultExportFromCjs, +} from "./phaser-CYd07urT.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 s of e) + if ("childList" === s.type) + for (const e of s.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); + } +})(); +class Bootloader extends Phaser.Scene { + constructor() { + super({ key: "bootloader" }); + } + preload() { + this.createBars(), + this.setLoadEvents(), + Array(15) + .fill(0) + .forEach((e, t) => { + this.load.image(`cloud${t}`, `assets/images/cloud${t}.png`); + }), + this.load.image("pello", "assets/images/pello.png"), + this.load.image("sensei", "assets/images/sensei.png"), + this.load.audio("win", "assets/sounds/win.mp3"), + this.load.audio("drip", "assets/sounds/drip.mp3"), + this.load.audio("fail", "assets/sounds/fail.mp3"), + this.load.bitmapFont( + "mainFont", + "assets/fonts/hiro.png", + "assets/fonts/hiro.xml" + ), + this.registry.set("score", 0); + } + setLoadEvents() { + this.load.on( + "progress", + function (e) { + this.progressBar.clear(), + this.progressBar.fillStyle(8966732, 1), + this.progressBar.fillRect( + this.cameras.main.width / 4, + this.cameras.main.height / 2 - 16, + (this.cameras.main.width / 2) * e, + 16 + ); + }, + this + ), + this.load.on( + "complete", + () => { + this.scene.start("game"); + }, + this + ); + } + createBars() { + (this.loadBar = this.add.graphics()), + this.loadBar.fillStyle(33923, 1), + this.loadBar.fillRect( + this.cameras.main.width / 4 - 2, + this.cameras.main.height / 2 - 18, + this.cameras.main.width / 2 + 4, + 20 + ), + (this.progressBar = this.add.graphics()); + } +} +class Player { + constructor(e, t) { + (this.scene = e), + (this.name = t), + (this.score = 0), + (this.lastMessage = null), + (this.dead = !1), + (this.penalties = 0); + } + hasSpammed() { + return ( + !!this.lastMessage && + (new Date() - this.lastMessage) / 1e3 < this.scene.spamTimeWait + ); + } + setPenalty() { + this.penalties++, + (this.score = 0), + (this.dead = !0), + this.scene.time.delayedCall( + 1e4 * this.penalties, + () => { + this.dead = !1; + }, + null, + this + ); + } +} +var client$1 = { exports: {} }; +const __viteBrowserExternal = {}, + __viteBrowserExternal$1 = Object.freeze( + Object.defineProperty( + { __proto__: null, default: __viteBrowserExternal }, + Symbol.toStringTag, + { value: "Module" } + ) + ), + require$$1 = getAugmentedNamespace(__viteBrowserExternal$1); +var utils = { exports: {} }; +const actionMessageRegex = /^\u0001ACTION ([^\u0001]+)\u0001$/, + justinFanRegex = /^(justinfan)(\d+$)/, + unescapeIRCRegex = /\\([sn:r\\])/g, + escapeIRCRegex = /([ \n;\r\\])/g, + ircEscapedChars = { s: " ", n: "", ":": ";", r: "" }, + ircUnescapedChars = { " ": "s", "\n": "n", ";": ":", "\r": "r" }, + urlRegex = new RegExp( + "^(?:(?:https?|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))\\.?)(?::\\d{2,5})?(?:[/?#]\\S*)?$", + "i" + ), + regexEmoteRegex = /[|\\^$*+?:#]/, + _$4 = (utils.exports = { + get: (e, t) => (void 0 === e ? t : e), + hasOwn: (e, t) => ({}).hasOwnProperty.call(e, t), + promiseDelay: (e) => new Promise((t) => setTimeout(t, e)), + isFinite: (e) => isFinite(e) && !isNaN(parseFloat(e)), + toNumber(e, t) { + if (null === e) return 0; + const s = Math.pow(10, _$4.isFinite(t) ? t : 0); + return Math.round(e * s) / s; + }, + isInteger: (e) => !isNaN(_$4.toNumber(e, 0)), + isRegex: (e) => regexEmoteRegex.test(e), + isURL: (e) => urlRegex.test(e), + justinfan: () => `justinfan${Math.floor(8e4 * Math.random() + 1e3)}`, + isJustinfan: (e) => justinFanRegex.test(e), + channel(e) { + const t = (e || "").toLowerCase(); + return "#" === t[0] ? t : "#" + t; + }, + username(e) { + const t = (e || "").toLowerCase(); + return "#" === t[0] ? t.slice(1) : t; + }, + token: (e) => (e ? e.toLowerCase().replace("oauth:", "") : ""), + password(e) { + const t = _$4.token(e); + return t ? `oauth:${t}` : ""; + }, + actionMessage: (e) => e.match(actionMessageRegex), + replaceAll(e, t) { + if (null == e) return null; + for (const s in t) e = e.replace(new RegExp(s, "g"), t[s]); + return e; + }, + unescapeHtml: (e) => + e + .replace(/\\&\\;/g, "&") + .replace(/\\<\\;/g, "<") + .replace(/\\>\\;/g, ">") + .replace(/\\"\\;/g, '"') + .replace(/\\'\\;/g, "'"), + unescapeIRC: (e) => + e && "string" == typeof e && e.includes("\\") + ? e.replace(unescapeIRCRegex, (e, t) => + t in ircEscapedChars ? ircEscapedChars[t] : t + ) + : e, + escapeIRC: (e) => + e && "string" == typeof e + ? e.replace(escapeIRCRegex, (e, t) => + t in ircUnescapedChars ? `\\${ircUnescapedChars[t]}` : t + ) + : e, + addWord: (e, t) => (e.length ? e + " " + t : e + t), + splitLine(e, t) { + let s = e.substring(0, t).lastIndexOf(" "); + return -1 === s && (s = t - 1), [e.substring(0, s), e.substring(s + 1)]; + }, + extractNumber(e) { + const t = e.split(" "); + for (let s = 0; s < t.length; s++) if (_$4.isInteger(t[s])) return ~~t[s]; + return 0; + }, + formatDate(e) { + let t = e.getHours(), + s = e.getMinutes(); + return ( + (t = (t < 10 ? "0" : "") + t), + (s = (s < 10 ? "0" : "") + s), + `${t}:${s}` + ); + }, + inherits(e, t) { + e.super_ = t; + const s = function () {}; + (s.prototype = t.prototype), + (e.prototype = new s()), + (e.prototype.constructor = e); + }, + isNode() { + try { + return ( + "object" == typeof process && + "[object process]" === Object.prototype.toString.call(process) + ); + } catch (e) {} + return !1; + }, + }); +var utilsExports = utils.exports; +const fetch$1 = require$$1, + _$3 = utilsExports; +var api = function (e, t) { + let s = void 0 !== e.url ? e.url : e.uri; + if ( + (_$3.isURL(s) || + (s = `https://api.twitch.tv/kraken${"/" === s[0] ? s : `/${s}`}`), + _$3.isNode()) + ) { + const i = Object.assign({ method: "GET", json: !0 }, e); + i.qs && (s += `?${new URLSearchParams(i.qs)}`); + const n = {}; + "fetchAgent" in this.opts.connection && + (n.agent = this.opts.connection.fetchAgent); + const o = fetch$1(s, { + ...n, + method: i.method, + headers: i.headers, + body: i.body, + }); + let r = {}; + o.then( + (e) => ( + (r = { statusCode: e.status, headers: e.headers }), + i.json ? e.json() : e.text() + ) + ).then( + (e) => t(null, r, e), + (e) => t(e, r, null) + ); + } else { + const i = Object.assign({ method: "GET", headers: {} }, e, { url: s }), + n = new XMLHttpRequest(); + n.open(i.method, i.url, !0); + for (const e in i.headers) n.setRequestHeader(e, i.headers[e]); + (n.responseType = "json"), + n.addEventListener("load", (e) => { + 4 === n.readyState && + (200 !== n.status + ? t(n.status, null, null) + : t(null, null, n.response)); + }), + n.send(); + } +}; +const _$2 = utilsExports; +function followersonly(e, t) { + return ( + (e = _$2.channel(e)), + (t = _$2.get(t, 30)), + this._sendCommand(null, e, `/followers ${t}`, (s, i) => { + this.once("_promiseFollowers", (n) => { + n ? i(n) : s([e, ~~t]); + }); + }) + ); +} +function followersonlyoff(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/followersoff", (t, s) => { + this.once("_promiseFollowersoff", (i) => { + i ? s(i) : t([e]); + }); + }) + ); +} +function part(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, null, `PART ${e}`, (t, s) => { + this.once("_promisePart", (i) => { + i ? s(i) : t([e]); + }); + }) + ); +} +function r9kbeta(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/r9kbeta", (t, s) => { + this.once("_promiseR9kbeta", (i) => { + i ? s(i) : t([e]); + }); + }) + ); +} +function r9kbetaoff(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/r9kbetaoff", (t, s) => { + this.once("_promiseR9kbetaoff", (i) => { + i ? s(i) : t([e]); + }); + }) + ); +} +function slow(e, t) { + return ( + (e = _$2.channel(e)), + (t = _$2.get(t, 300)), + this._sendCommand(null, e, `/slow ${t}`, (s, i) => { + this.once("_promiseSlow", (n) => { + n ? i(n) : s([e, ~~t]); + }); + }) + ); +} +function slowoff(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/slowoff", (t, s) => { + this.once("_promiseSlowoff", (i) => { + i ? s(i) : t([e]); + }); + }) + ); +} +var commands = { + action(e, t) { + return ( + (e = _$2.channel(e)), + (t = `ACTION ${t}`), + this._sendMessage(this._getPromiseDelay(), e, t, (s, i) => { + s([e, t]); + }) + ); + }, + ban(e, t, s) { + return ( + (e = _$2.channel(e)), + (t = _$2.username(t)), + (s = _$2.get(s, "")), + this._sendCommand(null, e, `/ban ${t} ${s}`, (i, n) => { + this.once("_promiseBan", (o) => { + o ? n(o) : i([e, t, s]); + }); + }) + ); + }, + clear(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/clear", (t, s) => { + this.once("_promiseClear", (i) => { + i ? s(i) : t([e]); + }); + }) + ); + }, + color(e, t) { + return ( + (t = _$2.get(t, e)), + this._sendCommand(null, "#tmijs", `/color ${t}`, (e, s) => { + this.once("_promiseColor", (i) => { + i ? s(i) : e([t]); + }); + }) + ); + }, + commercial(e, t) { + return ( + (e = _$2.channel(e)), + (t = _$2.get(t, 30)), + this._sendCommand(null, e, `/commercial ${t}`, (s, i) => { + this.once("_promiseCommercial", (n) => { + n ? i(n) : s([e, ~~t]); + }); + }) + ); + }, + deletemessage(e, t) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, `/delete ${t}`, (t, s) => { + this.once("_promiseDeletemessage", (i) => { + i ? s(i) : t([e]); + }); + }) + ); + }, + emoteonly(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/emoteonly", (t, s) => { + this.once("_promiseEmoteonly", (i) => { + i ? s(i) : t([e]); + }); + }) + ); + }, + emoteonlyoff(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/emoteonlyoff", (t, s) => { + this.once("_promiseEmoteonlyoff", (i) => { + i ? s(i) : t([e]); + }); + }) + ); + }, + followersonly: followersonly, + followersmode: followersonly, + followersonlyoff: followersonlyoff, + followersmodeoff: followersonlyoff, + host(e, t) { + return ( + (e = _$2.channel(e)), + (t = _$2.username(t)), + this._sendCommand(2e3, e, `/host ${t}`, (s, i) => { + this.once("_promiseHost", (n, o) => { + n ? i(n) : s([e, t, ~~o]); + }); + }) + ); + }, + join(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(void 0, null, `JOIN ${e}`, (t, s) => { + const i = "_promiseJoin"; + let n = !1; + const o = (r, a) => { + e === _$2.channel(a) && + (this.removeListener(i, o), (n = !0), r ? s(r) : t([e])); + }; + this.on(i, o); + const r = this._getPromiseDelay(); + _$2.promiseDelay(r).then(() => { + n || this.emit(i, "No response from Twitch.", e); + }); + }) + ); + }, + mod(e, t) { + return ( + (e = _$2.channel(e)), + (t = _$2.username(t)), + this._sendCommand(null, e, `/mod ${t}`, (s, i) => { + this.once("_promiseMod", (n) => { + n ? i(n) : s([e, t]); + }); + }) + ); + }, + mods(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/mods", (t, s) => { + this.once("_promiseMods", (i, n) => { + i + ? s(i) + : (n.forEach((t) => { + this.moderators[e] || (this.moderators[e] = []), + this.moderators[e].includes(t) || this.moderators[e].push(t); + }), + t(n)); + }); + }) + ); + }, + part: part, + leave: part, + ping() { + return this._sendCommand(null, null, "PING", (e, t) => { + (this.latency = new Date()), + (this.pingTimeout = setTimeout( + () => { + null !== this.ws && + ((this.wasCloseCalled = !1), + this.log.error("Ping timeout."), + this.ws.close(), + clearInterval(this.pingLoop), + clearTimeout(this.pingTimeout)); + }, + _$2.get(this.opts.connection.timeout, 9999) + )), + this.once("_promisePing", (t) => e([parseFloat(t)])); + }); + }, + r9kbeta: r9kbeta, + r9kmode: r9kbeta, + r9kbetaoff: r9kbetaoff, + r9kmodeoff: r9kbetaoff, + raw(e) { + return this._sendCommand(null, null, e, (t, s) => { + t([e]); + }); + }, + say(e, t) { + return ( + (e = _$2.channel(e)), + (t.startsWith(".") && !t.startsWith("..")) || + t.startsWith("/") || + t.startsWith("\\") + ? "me " === t.substr(1, 3) + ? this.action(e, t.substr(4)) + : this._sendCommand(null, e, t, (s, i) => { + s([e, t]); + }) + : this._sendMessage(this._getPromiseDelay(), e, t, (s, i) => { + s([e, t]); + }) + ); + }, + slow: slow, + slowmode: slow, + slowoff: slowoff, + slowmodeoff: slowoff, + subscribers(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/subscribers", (t, s) => { + this.once("_promiseSubscribers", (i) => { + i ? s(i) : t([e]); + }); + }) + ); + }, + subscribersoff(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/subscribersoff", (t, s) => { + this.once("_promiseSubscribersoff", (i) => { + i ? s(i) : t([e]); + }); + }) + ); + }, + timeout(e, t, s, i) { + return ( + (e = _$2.channel(e)), + (t = _$2.username(t)), + null === s || _$2.isInteger(s) || ((i = s), (s = 300)), + (s = _$2.get(s, 300)), + (i = _$2.get(i, "")), + this._sendCommand(null, e, `/timeout ${t} ${s} ${i}`, (n, o) => { + this.once("_promiseTimeout", (r) => { + r ? o(r) : n([e, t, ~~s, i]); + }); + }) + ); + }, + unban(e, t) { + return ( + (e = _$2.channel(e)), + (t = _$2.username(t)), + this._sendCommand(null, e, `/unban ${t}`, (s, i) => { + this.once("_promiseUnban", (n) => { + n ? i(n) : s([e, t]); + }); + }) + ); + }, + unhost(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(2e3, e, "/unhost", (t, s) => { + this.once("_promiseUnhost", (i) => { + i ? s(i) : t([e]); + }); + }) + ); + }, + unmod(e, t) { + return ( + (e = _$2.channel(e)), + (t = _$2.username(t)), + this._sendCommand(null, e, `/unmod ${t}`, (s, i) => { + this.once("_promiseUnmod", (n) => { + n ? i(n) : s([e, t]); + }); + }) + ); + }, + unvip(e, t) { + return ( + (e = _$2.channel(e)), + (t = _$2.username(t)), + this._sendCommand(null, e, `/unvip ${t}`, (s, i) => { + this.once("_promiseUnvip", (n) => { + n ? i(n) : s([e, t]); + }); + }) + ); + }, + vip(e, t) { + return ( + (e = _$2.channel(e)), + (t = _$2.username(t)), + this._sendCommand(null, e, `/vip ${t}`, (s, i) => { + this.once("_promiseVip", (n) => { + n ? i(n) : s([e, t]); + }); + }) + ); + }, + vips(e) { + return ( + (e = _$2.channel(e)), + this._sendCommand(null, e, "/vips", (e, t) => { + this.once("_promiseVips", (s, i) => { + s ? t(s) : e(i); + }); + }) + ); + }, + whisper(e, t) { + return (e = _$2.username(e)) === this.getUsername() + ? Promise.reject("Cannot send a whisper to the same account.") + : this._sendCommand(null, "#tmijs", `/w ${e} ${t}`, (e, t) => { + this.once("_promiseWhisper", (e) => { + e && t(e); + }); + }).catch((s) => { + if ( + s && + "string" == typeof s && + 0 !== s.indexOf("No response from Twitch.") + ) + throw s; + const i = _$2.channel(e), + n = Object.assign( + { + "message-type": "whisper", + "message-id": null, + "thread-id": null, + username: this.getUsername(), + }, + this.globaluserstate + ); + return ( + this.emits( + ["whisper", "message"], + [ + [i, n, t, !0], + [i, n, t, !0], + ] + ), + [e, t] + ); + }); + }, +}; +function EventEmitter() { + (this._events = this._events || {}), + (this._maxListeners = this._maxListeners || void 0); +} +var events = EventEmitter; +function isFunction(e) { + return "function" == typeof e; +} +function isNumber(e) { + return "number" == typeof e; +} +function isObject(e) { + return "object" == typeof e && null !== e; +} +function isUndefined(e) { + return void 0 === e; +} +(EventEmitter.EventEmitter = EventEmitter), + (EventEmitter.prototype._events = void 0), + (EventEmitter.prototype._maxListeners = void 0), + (EventEmitter.defaultMaxListeners = 10), + (EventEmitter.prototype.setMaxListeners = function (e) { + if (!isNumber(e) || e < 0 || isNaN(e)) + throw TypeError("n must be a positive number"); + return (this._maxListeners = e), this; + }), + (EventEmitter.prototype.emit = function (e) { + var t, s, i, n, o, r; + if ( + (this._events || (this._events = {}), + "error" === e && + (!this._events.error || + (isObject(this._events.error) && !this._events.error.length))) + ) { + if ((t = arguments[1]) instanceof Error) throw t; + throw TypeError('Uncaught, unspecified "error" event.'); + } + if (isUndefined((s = this._events[e]))) return !1; + if (isFunction(s)) + switch (arguments.length) { + case 1: + s.call(this); + break; + case 2: + s.call(this, arguments[1]); + break; + case 3: + s.call(this, arguments[1], arguments[2]); + break; + default: + (n = Array.prototype.slice.call(arguments, 1)), s.apply(this, n); + } + else if (isObject(s)) + for ( + n = Array.prototype.slice.call(arguments, 1), + i = (r = s.slice()).length, + o = 0; + o < i; + o++ + ) + r[o].apply(this, n); + return !0; + }), + (EventEmitter.prototype.addListener = function (e, t) { + var s; + if (!isFunction(t)) throw TypeError("listener must be a function"); + return ( + this._events || (this._events = {}), + this._events.newListener && + this.emit("newListener", e, isFunction(t.listener) ? t.listener : t), + this._events[e] + ? isObject(this._events[e]) + ? this._events[e].push(t) + : (this._events[e] = [this._events[e], t]) + : (this._events[e] = t), + isObject(this._events[e]) && + !this._events[e].warned && + (s = isUndefined(this._maxListeners) + ? EventEmitter.defaultMaxListeners + : this._maxListeners) && + s > 0 && + this._events[e].length > s && + ((this._events[e].warned = !0), + console.error( + "(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", + this._events[e].length + ), + "function" == typeof console.trace && console.trace()), + this + ); + }), + (EventEmitter.prototype.on = EventEmitter.prototype.addListener), + (EventEmitter.prototype.once = function (e, t) { + if (!isFunction(t)) throw TypeError("listener must be a function"); + var s = !1; + if (this._events.hasOwnProperty(e) && "_" === e.charAt(0)) { + var i = 1, + n = e; + for (var o in this._events) + this._events.hasOwnProperty(o) && o.startsWith(n) && i++; + e += i; + } + function r() { + "_" !== e.charAt(0) || + isNaN(e.substr(e.length - 1)) || + (e = e.substring(0, e.length - 1)), + this.removeListener(e, r), + s || ((s = !0), t.apply(this, arguments)); + } + return (r.listener = t), this.on(e, r), this; + }), + (EventEmitter.prototype.removeListener = function (e, t) { + var s, i, n, o; + if (!isFunction(t)) throw TypeError("listener must be a function"); + if (!this._events || !this._events[e]) return this; + if ( + ((n = (s = this._events[e]).length), + (i = -1), + s === t || (isFunction(s.listener) && s.listener === t)) + ) { + if ( + (delete this._events[e], + this._events.hasOwnProperty(e + "2") && "_" === e.charAt(0)) + ) { + var r = e; + for (var a in this._events) + this._events.hasOwnProperty(a) && + a.startsWith(r) && + (isNaN(parseInt(a.substr(a.length - 1))) || + ((this._events[e + parseInt(a.substr(a.length - 1) - 1)] = + this._events[a]), + delete this._events[a])); + (this._events[e] = this._events[e + "1"]), delete this._events[e + "1"]; + } + this._events.removeListener && this.emit("removeListener", e, t); + } else if (isObject(s)) { + for (o = n; o-- > 0; ) + if (s[o] === t || (s[o].listener && s[o].listener === t)) { + i = o; + break; + } + if (i < 0) return this; + 1 === s.length + ? ((s.length = 0), delete this._events[e]) + : s.splice(i, 1), + this._events.removeListener && this.emit("removeListener", e, t); + } + return this; + }), + (EventEmitter.prototype.removeAllListeners = function (e) { + var t, s; + if (!this._events) return this; + if (!this._events.removeListener) + return ( + 0 === arguments.length + ? (this._events = {}) + : this._events[e] && delete this._events[e], + this + ); + if (0 === arguments.length) { + for (t in this._events) + "removeListener" !== t && this.removeAllListeners(t); + return ( + this.removeAllListeners("removeListener"), (this._events = {}), this + ); + } + if (isFunction((s = this._events[e]))) this.removeListener(e, s); + else if (s) for (; s.length; ) this.removeListener(e, s[s.length - 1]); + return delete this._events[e], this; + }), + (EventEmitter.prototype.listeners = function (e) { + return this._events && this._events[e] + ? isFunction(this._events[e]) + ? [this._events[e]] + : this._events[e].slice() + : []; + }), + (EventEmitter.prototype.listenerCount = function (e) { + if (this._events) { + var t = this._events[e]; + if (isFunction(t)) return 1; + if (t) return t.length; + } + return 0; + }), + (EventEmitter.listenerCount = function (e, t) { + return e.listenerCount(t); + }); +const _$1 = utilsExports; +let currentLevel = "info"; +const levels = { trace: 0, debug: 1, info: 2, warn: 3, error: 4, fatal: 5 }; +function log(e) { + return function (t) { + levels[e] >= levels[currentLevel] && + console.log(`[${_$1.formatDate(new Date())}] ${e}: ${t}`); + }; +} +var logger = { + setLevel(e) { + currentLevel = e; + }, + trace: log("trace"), + debug: log("debug"), + info: log("info"), + warn: log("warn"), + error: log("error"), + fatal: log("fatal"), +}; +const _ = utilsExports, + nonspaceRegex = /\S+/g; +function parseComplexTag(e, t, s = ",", i = "/", n) { + const o = e[t]; + if (void 0 === o) return e; + const r = "string" == typeof o; + if (((e[t + "-raw"] = r ? o : null), !0 === o)) return (e[t] = null), e; + if (((e[t] = {}), r)) { + const r = o.split(s); + for (let s = 0; s < r.length; s++) { + const o = r[s].split(i); + let a = o[1]; + void 0 !== n && a && (a = a.split(n)), (e[t][o[0]] = a || null); + } + } + return e; +} +var parser = { + badges: (e) => parseComplexTag(e, "badges"), + badgeInfo: (e) => parseComplexTag(e, "badge-info"), + emotes: (e) => parseComplexTag(e, "emotes", "/", ":", ","), + emoteRegex(e, t, s, i) { + nonspaceRegex.lastIndex = 0; + const n = new RegExp("(\\b|^|\\s)" + _.unescapeHtml(t) + "(\\b|$|\\s)"); + let o; + for (; null !== (o = nonspaceRegex.exec(e)); ) + n.test(o[0]) && + ((i[s] = i[s] || []), + i[s].push([o.index, nonspaceRegex.lastIndex - 1])); + }, + emoteString(e, t, s, i) { + let n; + for (nonspaceRegex.lastIndex = 0; null !== (n = nonspaceRegex.exec(e)); ) + n[0] === _.unescapeHtml(t) && + ((i[s] = i[s] || []), + i[s].push([n.index, nonspaceRegex.lastIndex - 1])); + }, + transformEmotes(e) { + let t = ""; + return ( + Object.keys(e).forEach((s) => { + (t = `${t + s}:`), + e[s].forEach((e) => (t = `${t + e.join("-")},`)), + (t = `${t.slice(0, -1)}/`); + }), + t.slice(0, -1) + ); + }, + formTags(e) { + const t = []; + for (const s in e) { + const i = _.escapeIRC(e[s]); + t.push(`${s}=${i}`); + } + return `@${t.join(";")}`; + }, + msg(e) { + const t = { raw: e, tags: {}, prefix: null, command: null, params: [] }; + let s = 0, + i = 0; + if (64 === e.charCodeAt(0)) { + if (((i = e.indexOf(" ")), -1 === i)) return null; + const n = e.slice(1, i).split(";"); + for (let e = 0; e < n.length; e++) { + const s = n[e], + i = s.split("="); + t.tags[i[0]] = s.substring(s.indexOf("=") + 1) || !0; + } + s = i + 1; + } + for (; 32 === e.charCodeAt(s); ) s++; + if (58 === e.charCodeAt(s)) { + if (((i = e.indexOf(" ", s)), -1 === i)) return null; + for (t.prefix = e.slice(s + 1, i), s = i + 1; 32 === e.charCodeAt(s); ) + s++; + } + if (((i = e.indexOf(" ", s)), -1 === i)) + return e.length > s ? ((t.command = e.slice(s)), t) : null; + for (t.command = e.slice(s, i), s = i + 1; 32 === e.charCodeAt(s); ) s++; + for (; s < e.length; ) { + if (((i = e.indexOf(" ", s)), 58 === e.charCodeAt(s))) { + t.params.push(e.slice(s + 1)); + break; + } + if (-1 === i) { + if (-1 === i) { + t.params.push(e.slice(s)); + break; + } + } else + for (t.params.push(e.slice(s, i)), s = i + 1; 32 === e.charCodeAt(s); ) + s++; + } + return t; + }, +}; +class Queue { + constructor(e) { + (this.queue = []), + (this.index = 0), + (this.defaultDelay = void 0 === e ? 3e3 : e); + } + add(e, t) { + this.queue.push({ fn: e, delay: t }); + } + next() { + const e = this.index++, + t = this.queue[e]; + if (!t) return; + const s = this.queue[this.index]; + if ((t.fn(), s)) { + const e = void 0 === s.delay ? this.defaultDelay : s.delay; + setTimeout(() => this.next(), e); + } + } +} +var timer = Queue; +!(function (e) { + const t = + void 0 !== commonjsGlobal + ? commonjsGlobal + : "undefined" != typeof window + ? window + : {}, + s = t.WebSocket || require$$1, + i = t.fetch || require$$1, + n = api, + o = commands, + r = events.EventEmitter, + a = logger, + h = parser, + c = timer, + l = utilsExports; + let m = !1; + const d = function e(t) { + if (this instanceof e == 0) return new e(t); + (this.opts = l.get(t, {})), + (this.opts.channels = this.opts.channels || []), + (this.opts.connection = this.opts.connection || {}), + (this.opts.identity = this.opts.identity || {}), + (this.opts.options = this.opts.options || {}), + (this.clientId = l.get(this.opts.options.clientId, null)), + (this._globalDefaultChannel = l.channel( + l.get(this.opts.options.globalDefaultChannel, "#tmijs") + )), + (this._skipMembership = l.get(this.opts.options.skipMembership, !1)), + (this._skipUpdatingEmotesets = l.get( + this.opts.options.skipUpdatingEmotesets, + !1 + )), + (this._updateEmotesetsTimer = null), + (this._updateEmotesetsTimerDelay = l.get( + this.opts.options.updateEmotesetsTimer, + 6e4 + )), + (this.maxReconnectAttempts = l.get( + this.opts.connection.maxReconnectAttempts, + 1 / 0 + )), + (this.maxReconnectInterval = l.get( + this.opts.connection.maxReconnectInterval, + 3e4 + )), + (this.reconnect = l.get(this.opts.connection.reconnect, !0)), + (this.reconnectDecay = l.get(this.opts.connection.reconnectDecay, 1.5)), + (this.reconnectInterval = l.get( + this.opts.connection.reconnectInterval, + 1e3 + )), + (this.reconnecting = !1), + (this.reconnections = 0), + (this.reconnectTimer = this.reconnectInterval), + (this.secure = l.get( + this.opts.connection.secure, + !this.opts.connection.server && !this.opts.connection.port + )), + (this.emotes = ""), + (this.emotesets = {}), + (this.channels = []), + (this.currentLatency = 0), + (this.globaluserstate = {}), + (this.lastJoined = ""), + (this.latency = new Date()), + (this.moderators = {}), + (this.pingLoop = null), + (this.pingTimeout = null), + (this.reason = ""), + (this.username = ""), + (this.userstate = {}), + (this.wasCloseCalled = !1), + (this.ws = null); + let s = "error"; + this.opts.options.debug && (s = "info"), (this.log = this.opts.logger || a); + try { + a.setLevel(s); + } catch (i) {} + this.opts.channels.forEach((e, t, s) => (s[t] = l.channel(e))), + r.call(this), + this.setMaxListeners(0); + }; + l.inherits(d, r); + for (const u in o) d.prototype[u] = o[u]; + (d.prototype.emits = function (e, t) { + for (let s = 0; s < e.length; s++) { + const i = s < t.length ? t[s] : t[t.length - 1]; + this.emit.apply(this, [e[s]].concat(i)); + } + }), + (d.prototype.api = function (...e) { + m || + (this.log.warn( + "Client.prototype.api is deprecated and will be removed for version 2.0.0" + ), + (m = !0)), + n(...e); + }), + (d.prototype.handleMessage = function (e) { + if (!e) return; + this.listenerCount("raw_message") && + this.emit("raw_message", JSON.parse(JSON.stringify(e)), e); + const t = l.channel(l.get(e.params[0], null)); + let s = l.get(e.params[1], null); + const i = l.get(e.tags["msg-id"], null), + n = (e.tags = h.badges(h.badgeInfo(h.emotes(e.tags)))); + for (const o in n) { + if ("emote-sets" === o || "ban-duration" === o || "bits" === o) + continue; + let e = n[o]; + "boolean" == typeof e + ? (e = null) + : "1" === e + ? (e = !0) + : "0" === e + ? (e = !1) + : "string" == typeof e && (e = l.unescapeIRC(e)), + (n[o] = e); + } + if (null === e.prefix) + switch (e.command) { + case "PING": + this.emit("ping"), this._isConnected() && this.ws.send("PONG"); + break; + case "PONG": { + const e = new Date(); + (this.currentLatency = + (e.getTime() - this.latency.getTime()) / 1e3), + this.emits(["pong", "_promisePing"], [[this.currentLatency]]), + clearTimeout(this.pingTimeout); + break; + } + default: + this.log.warn( + `Could not parse message with no prefix:\n${JSON.stringify( + e, + null, + 4 + )}` + ); + } + else if ("tmi.twitch.tv" === e.prefix) + switch (e.command) { + case "002": + case "003": + case "004": + case "372": + case "375": + case "CAP": + case "SERVERCHANGE": + break; + case "001": + this.username = e.params[0]; + break; + case "376": { + this.log.info("Connected to server."), + (this.userstate[this._globalDefaultChannel] = {}), + this.emits( + ["connected", "_promiseConnect"], + [[this.server, this.port], [null]] + ), + (this.reconnections = 0), + (this.reconnectTimer = this.reconnectInterval), + (this.pingLoop = setInterval(() => { + this._isConnected() && this.ws.send("PING"), + (this.latency = new Date()), + (this.pingTimeout = setTimeout( + () => { + null !== this.ws && + ((this.wasCloseCalled = !1), + this.log.error("Ping timeout."), + this.ws.close(), + clearInterval(this.pingLoop), + clearTimeout(this.pingTimeout), + clearTimeout(this._updateEmotesetsTimer)); + }, + l.get(this.opts.connection.timeout, 9999) + )); + }, 6e4)); + let e = l.get(this.opts.options.joinInterval, 2e3); + e < 300 && (e = 300); + const t = new c(e), + s = [...new Set([...this.opts.channels, ...this.channels])]; + this.channels = []; + for (let i = 0; i < s.length; i++) { + const e = s[i]; + t.add(() => { + this._isConnected() && + this.join(e).catch((e) => this.log.error(e)); + }); + } + t.next(); + break; + } + case "NOTICE": { + const n = [null], + o = [t, i, s], + r = [t, !0], + a = [t, !1], + h = [o, n], + c = [o, [i]], + l = `[${t}] ${s}`; + switch (i) { + case "subs_on": + this.log.info( + `[${t}] This room is now in subscribers-only mode.` + ), + this.emits( + ["subscriber", "subscribers", "_promiseSubscribers"], + [r, r, n] + ); + break; + case "subs_off": + this.log.info( + `[${t}] This room is no longer in subscribers-only mode.` + ), + this.emits( + ["subscriber", "subscribers", "_promiseSubscribersoff"], + [a, a, n] + ); + break; + case "emote_only_on": + this.log.info(`[${t}] This room is now in emote-only mode.`), + this.emits(["emoteonly", "_promiseEmoteonly"], [r, n]); + break; + case "emote_only_off": + this.log.info( + `[${t}] This room is no longer in emote-only mode.` + ), + this.emits(["emoteonly", "_promiseEmoteonlyoff"], [a, n]); + break; + case "slow_on": + case "slow_off": + case "followers_on_zero": + case "followers_on": + case "followers_off": + case "host_on": + case "host_off": + break; + case "r9k_on": + this.log.info(`[${t}] This room is now in r9k mode.`), + this.emits( + ["r9kmode", "r9kbeta", "_promiseR9kbeta"], + [r, r, n] + ); + break; + case "r9k_off": + this.log.info(`[${t}] This room is no longer in r9k mode.`), + this.emits( + ["r9kmode", "r9kbeta", "_promiseR9kbetaoff"], + [a, a, n] + ); + break; + case "room_mods": { + const e = s.split(": "), + i = (e.length > 1 ? e[1] : "") + .toLowerCase() + .split(", ") + .filter((e) => e); + this.emits( + ["_promiseMods", "mods"], + [ + [null, i], + [t, i], + ] + ); + break; + } + case "no_mods": + this.emits( + ["_promiseMods", "mods"], + [ + [null, []], + [t, []], + ] + ); + break; + case "vips_success": { + s.endsWith(".") && (s = s.slice(0, -1)); + const e = s.split(": "), + i = (e.length > 1 ? e[1] : "") + .toLowerCase() + .split(", ") + .filter((e) => e); + this.emits( + ["_promiseVips", "vips"], + [ + [null, i], + [t, i], + ] + ); + break; + } + case "no_vips": + this.emits( + ["_promiseVips", "vips"], + [ + [null, []], + [t, []], + ] + ); + break; + case "already_banned": + case "bad_ban_admin": + case "bad_ban_anon": + case "bad_ban_broadcaster": + case "bad_ban_global_mod": + case "bad_ban_mod": + case "bad_ban_self": + case "bad_ban_staff": + case "usage_ban": + this.log.info(l), this.emits(["notice", "_promiseBan"], c); + break; + case "ban_success": + this.log.info(l), this.emits(["notice", "_promiseBan"], h); + break; + case "usage_clear": + this.log.info(l), this.emits(["notice", "_promiseClear"], c); + break; + case "usage_mods": + this.log.info(l), + this.emits(["notice", "_promiseMods"], [o, [i, []]]); + break; + case "mod_success": + this.log.info(l), this.emits(["notice", "_promiseMod"], h); + break; + case "usage_vips": + this.log.info(l), + this.emits(["notice", "_promiseVips"], [o, [i, []]]); + break; + case "usage_vip": + case "bad_vip_grantee_banned": + case "bad_vip_grantee_already_vip": + case "bad_vip_max_vips_reached": + case "bad_vip_achievement_incomplete": + this.log.info(l), + this.emits(["notice", "_promiseVip"], [o, [i, []]]); + break; + case "vip_success": + this.log.info(l), this.emits(["notice", "_promiseVip"], h); + break; + case "usage_mod": + case "bad_mod_banned": + case "bad_mod_mod": + this.log.info(l), this.emits(["notice", "_promiseMod"], c); + break; + case "unmod_success": + this.log.info(l), this.emits(["notice", "_promiseUnmod"], h); + break; + case "unvip_success": + this.log.info(l), this.emits(["notice", "_promiseUnvip"], h); + break; + case "usage_unmod": + case "bad_unmod_mod": + this.log.info(l), this.emits(["notice", "_promiseUnmod"], c); + break; + case "usage_unvip": + case "bad_unvip_grantee_not_vip": + this.log.info(l), this.emits(["notice", "_promiseUnvip"], c); + break; + case "color_changed": + this.log.info(l), this.emits(["notice", "_promiseColor"], h); + break; + case "usage_color": + case "turbo_only_color": + this.log.info(l), this.emits(["notice", "_promiseColor"], c); + break; + case "commercial_success": + this.log.info(l), + this.emits(["notice", "_promiseCommercial"], h); + break; + case "usage_commercial": + case "bad_commercial_error": + this.log.info(l), + this.emits(["notice", "_promiseCommercial"], c); + break; + case "hosts_remaining": { + this.log.info(l); + const e = isNaN(s[0]) ? 0 : parseInt(s[0]); + this.emits(["notice", "_promiseHost"], [o, [null, ~~e]]); + break; + } + case "bad_host_hosting": + case "bad_host_rate_exceeded": + case "bad_host_error": + case "usage_host": + this.log.info(l), + this.emits(["notice", "_promiseHost"], [o, [i, null]]); + break; + case "already_r9k_on": + case "usage_r9k_on": + this.log.info(l), this.emits(["notice", "_promiseR9kbeta"], c); + break; + case "already_r9k_off": + case "usage_r9k_off": + this.log.info(l), + this.emits(["notice", "_promiseR9kbetaoff"], c); + break; + case "timeout_success": + this.log.info(l), this.emits(["notice", "_promiseTimeout"], h); + break; + case "delete_message_success": + this.log.info(`[${t} ${s}]`), + this.emits(["notice", "_promiseDeletemessage"], h); + break; + case "already_subs_off": + case "usage_subs_off": + this.log.info(l), + this.emits(["notice", "_promiseSubscribersoff"], c); + break; + case "already_subs_on": + case "usage_subs_on": + this.log.info(l), + this.emits(["notice", "_promiseSubscribers"], c); + break; + case "already_emote_only_off": + case "usage_emote_only_off": + this.log.info(l), + this.emits(["notice", "_promiseEmoteonlyoff"], c); + break; + case "already_emote_only_on": + case "usage_emote_only_on": + this.log.info(l), + this.emits(["notice", "_promiseEmoteonly"], c); + break; + case "usage_slow_on": + this.log.info(l), this.emits(["notice", "_promiseSlow"], c); + break; + case "usage_slow_off": + this.log.info(l), this.emits(["notice", "_promiseSlowoff"], c); + break; + case "usage_timeout": + case "bad_timeout_admin": + case "bad_timeout_anon": + case "bad_timeout_broadcaster": + case "bad_timeout_duration": + case "bad_timeout_global_mod": + case "bad_timeout_mod": + case "bad_timeout_self": + case "bad_timeout_staff": + this.log.info(l), this.emits(["notice", "_promiseTimeout"], c); + break; + case "untimeout_success": + case "unban_success": + this.log.info(l), this.emits(["notice", "_promiseUnban"], h); + break; + case "usage_unban": + case "bad_unban_no_ban": + this.log.info(l), this.emits(["notice", "_promiseUnban"], c); + break; + case "usage_delete": + case "bad_delete_message_error": + case "bad_delete_message_broadcaster": + case "bad_delete_message_mod": + this.log.info(l), + this.emits(["notice", "_promiseDeletemessage"], c); + break; + case "usage_unhost": + case "not_hosting": + this.log.info(l), this.emits(["notice", "_promiseUnhost"], c); + break; + case "whisper_invalid_login": + case "whisper_invalid_self": + case "whisper_limit_per_min": + case "whisper_limit_per_sec": + case "whisper_restricted": + case "whisper_restricted_recipient": + this.log.info(l), this.emits(["notice", "_promiseWhisper"], c); + break; + case "no_permission": + case "msg_banned": + case "msg_room_not_found": + case "msg_channel_suspended": + case "tos_ban": + case "invalid_user": + this.log.info(l), + this.emits( + [ + "notice", + "_promiseBan", + "_promiseClear", + "_promiseUnban", + "_promiseTimeout", + "_promiseDeletemessage", + "_promiseMods", + "_promiseMod", + "_promiseUnmod", + "_promiseVips", + "_promiseVip", + "_promiseUnvip", + "_promiseCommercial", + "_promiseHost", + "_promiseUnhost", + "_promiseJoin", + "_promisePart", + "_promiseR9kbeta", + "_promiseR9kbetaoff", + "_promiseSlow", + "_promiseSlowoff", + "_promiseFollowers", + "_promiseFollowersoff", + "_promiseSubscribers", + "_promiseSubscribersoff", + "_promiseEmoteonly", + "_promiseEmoteonlyoff", + "_promiseWhisper", + ], + [o, [i, t]] + ); + break; + case "msg_rejected": + case "msg_rejected_mandatory": + this.log.info(l), this.emit("automod", t, i, s); + break; + case "unrecognized_cmd": + case "cmds_available": + case "host_target_went_offline": + case "msg_censored_broadcaster": + case "msg_duplicate": + case "msg_emoteonly": + case "msg_verified_email": + case "msg_ratelimit": + case "msg_subsonly": + case "msg_timedout": + case "msg_bad_characters": + case "msg_channel_blocked": + case "msg_facebook": + case "msg_followersonly": + case "msg_followersonly_followed": + case "msg_followersonly_zero": + case "msg_slowmode": + case "msg_suspended": + case "no_help": + case "usage_disconnect": + case "usage_help": + case "usage_me": + case "unavailable_command": + this.log.info(l), this.emit("notice", t, i, s); + break; + default: + s.includes("Login unsuccessful") || + s.includes("Login authentication failed") || + s.includes("Error logging in") || + s.includes("Improperly formatted auth") + ? ((this.wasCloseCalled = !1), + (this.reconnect = !1), + (this.reason = s), + this.log.error(this.reason), + this.ws.close()) + : s.includes("Invalid NICK") + ? ((this.wasCloseCalled = !1), + (this.reconnect = !1), + (this.reason = "Invalid NICK."), + this.log.error(this.reason), + this.ws.close()) + : (this.log.warn( + `Could not parse NOTICE from tmi.twitch.tv:\n${JSON.stringify( + e, + null, + 4 + )}` + ), + this.emit("notice", t, i, s)); + } + break; + } + case "USERNOTICE": { + const e = n["display-name"] || n.login, + o = n["msg-param-sub-plan"] || "", + r = + l.unescapeIRC(l.get(n["msg-param-sub-plan-name"], "")) || null, + a = { prime: o.includes("Prime"), plan: o, planName: r }, + h = ~~(n["msg-param-streak-months"] || 0), + c = + n["msg-param-recipient-display-name"] || + n["msg-param-recipient-user-name"], + m = ~~n["msg-param-mass-gift-count"]; + switch (((n["message-type"] = i), i)) { + case "resub": + this.emits(["resub", "subanniversary"], [[t, e, h, s, n, a]]); + break; + case "sub": + this.emits(["subscription", "sub"], [[t, e, a, s, n]]); + break; + case "subgift": + this.emit("subgift", t, e, h, c, a, n); + break; + case "anonsubgift": + this.emit("anonsubgift", t, h, c, a, n); + break; + case "submysterygift": + this.emit("submysterygift", t, e, m, a, n); + break; + case "anonsubmysterygift": + this.emit("anonsubmysterygift", t, m, a, n); + break; + case "primepaidupgrade": + this.emit("primepaidupgrade", t, e, a, n); + break; + case "giftpaidupgrade": { + const s = + n["msg-param-sender-name"] || n["msg-param-sender-login"]; + this.emit("giftpaidupgrade", t, e, s, n); + break; + } + case "anongiftpaidupgrade": + this.emit("anongiftpaidupgrade", t, e, n); + break; + case "raid": { + const e = n["msg-param-displayName"] || n["msg-param-login"], + s = +n["msg-param-viewerCount"]; + this.emit("raided", t, e, s, n); + break; + } + case "ritual": { + const i = n["msg-param-ritual-name"]; + "new_chatter" === i + ? this.emit("newchatter", t, e, n, s) + : this.emit("ritual", i, t, e, n, s); + break; + } + default: + this.emit("usernotice", i, t, n, s); + } + break; + } + case "HOSTTARGET": { + const e = s.split(" "), + i = ~~e[1] || 0; + "-" === e[0] + ? (this.log.info(`[${t}] Exited host mode.`), + this.emits(["unhost", "_promiseUnhost"], [[t, i], [null]])) + : (this.log.info( + `[${t}] Now hosting ${e[0]} for ${i} viewer(s).` + ), + this.emit("hosting", t, e[0], i)); + break; + } + case "CLEARCHAT": + if (e.params.length > 1) { + const i = l.get(e.tags["ban-duration"], null); + null === i + ? (this.log.info(`[${t}] ${s} has been banned.`), + this.emit("ban", t, s, null, e.tags)) + : (this.log.info( + `[${t}] ${s} has been timed out for ${i} seconds.` + ), + this.emit("timeout", t, s, null, ~~i, e.tags)); + } else + this.log.info(`[${t}] Chat was cleared by a moderator.`), + this.emits(["clearchat", "_promiseClear"], [[t], [null]]); + break; + case "CLEARMSG": + if (e.params.length > 1) { + const e = s, + i = n.login; + (n["message-type"] = "messagedeleted"), + this.log.info(`[${t}] ${i}'s message has been deleted.`), + this.emit("messagedeleted", t, i, e, n); + } + break; + case "RECONNECT": + this.log.info("Received RECONNECT request from Twitch.."), + this.log.info( + `Disconnecting and reconnecting in ${Math.round( + this.reconnectTimer / 1e3 + )} seconds..` + ), + this.disconnect().catch((e) => this.log.error(e)), + setTimeout( + () => this.connect().catch((e) => this.log.error(e)), + this.reconnectTimer + ); + break; + case "USERSTATE": + (e.tags.username = this.username), + "mod" === e.tags["user-type"] && + (this.moderators[t] || (this.moderators[t] = []), + this.moderators[t].includes(this.username) || + this.moderators[t].push(this.username)), + l.isJustinfan(this.getUsername()) || + this.userstate[t] || + ((this.userstate[t] = n), + (this.lastJoined = t), + this.channels.push(t), + this.log.info(`Joined ${t}`), + this.emit("join", t, l.username(this.getUsername()), !0)), + e.tags["emote-sets"] !== this.emotes && + this._updateEmoteset(e.tags["emote-sets"]), + (this.userstate[t] = n); + break; + case "GLOBALUSERSTATE": + (this.globaluserstate = n), + this.emit("globaluserstate", n), + void 0 !== e.tags["emote-sets"] && + this._updateEmoteset(e.tags["emote-sets"]); + break; + case "ROOMSTATE": + if ( + (l.channel(this.lastJoined) === t && + this.emit("_promiseJoin", null, t), + (e.tags.channel = t), + this.emit("roomstate", t, e.tags), + !l.hasOwn(e.tags, "subs-only")) + ) { + if (l.hasOwn(e.tags, "slow")) + if ("boolean" != typeof e.tags.slow || e.tags.slow) { + const s = [t, !0, ~~e.tags.slow]; + this.log.info(`[${t}] This room is now in slow mode.`), + this.emits( + ["slow", "slowmode", "_promiseSlow"], + [s, s, [null]] + ); + } else { + const e = [t, !1, 0]; + this.log.info(`[${t}] This room is no longer in slow mode.`), + this.emits( + ["slow", "slowmode", "_promiseSlowoff"], + [e, e, [null]] + ); + } + if (l.hasOwn(e.tags, "followers-only")) + if ("-1" === e.tags["followers-only"]) { + const e = [t, !1, 0]; + this.log.info( + `[${t}] This room is no longer in followers-only mode.` + ), + this.emits( + [ + "followersonly", + "followersmode", + "_promiseFollowersoff", + ], + [e, e, [null]] + ); + } else { + const s = [t, !0, ~~e.tags["followers-only"]]; + this.log.info( + `[${t}] This room is now in follower-only mode.` + ), + this.emits( + ["followersonly", "followersmode", "_promiseFollowers"], + [s, s, [null]] + ); + } + } + break; + default: + this.log.warn( + `Could not parse message from tmi.twitch.tv:\n${JSON.stringify( + e, + null, + 4 + )}` + ); + } + else if ("jtv" === e.prefix) + "MODE" === e.command + ? "+o" === s + ? (this.moderators[t] || (this.moderators[t] = []), + this.moderators[t].includes(e.params[2]) || + this.moderators[t].push(e.params[2]), + this.emit("mod", t, e.params[2])) + : "-o" === s && + (this.moderators[t] || (this.moderators[t] = []), + this.moderators[t].filter((t) => t !== e.params[2]), + this.emit("unmod", t, e.params[2])) + : this.log.warn( + `Could not parse message from jtv:\n${JSON.stringify(e, null, 4)}` + ); + else + switch (e.command) { + case "353": + this.emit("names", e.params[2], e.params[3].split(" ")); + break; + case "366": + break; + case "JOIN": { + const s = e.prefix.split("!")[0]; + l.isJustinfan(this.getUsername()) && + this.username === s && + ((this.lastJoined = t), + this.channels.push(t), + this.log.info(`Joined ${t}`), + this.emit("join", t, s, !0)), + this.username !== s && this.emit("join", t, s, !1); + break; + } + case "PART": { + let s = !1; + const i = e.prefix.split("!")[0]; + if (this.username === i) { + (s = !0), this.userstate[t] && delete this.userstate[t]; + let e = this.channels.indexOf(t); + -1 !== e && this.channels.splice(e, 1), + (e = this.opts.channels.indexOf(t)), + -1 !== e && this.opts.channels.splice(e, 1), + this.log.info(`Left ${t}`), + this.emit("_promisePart", null); + } + this.emit("part", t, i, s); + break; + } + case "WHISPER": { + const t = e.prefix.split("!")[0]; + this.log.info(`[WHISPER] <${t}>: ${s}`), + l.hasOwn(e.tags, "username") || (e.tags.username = t), + (e.tags["message-type"] = "whisper"); + const i = l.channel(e.tags.username); + this.emits(["whisper", "message"], [[i, e.tags, s, !1]]); + break; + } + case "PRIVMSG": + if ( + ((e.tags.username = e.prefix.split("!")[0]), + "jtv" === e.tags.username) + ) { + const e = l.username(s.split(" ")[0]), + i = s.includes("auto"); + if (s.includes("hosting you for")) { + const n = l.extractNumber(s); + this.emit("hosted", t, e, n, i); + } else + s.includes("hosting you") && this.emit("hosted", t, e, 0, i); + } else { + const i = l.get(this.opts.options.messagesLogLevel, "info"), + n = l.actionMessage(s); + if ( + ((e.tags["message-type"] = n ? "action" : "chat"), + (s = n ? n[1] : s), + l.hasOwn(e.tags, "bits")) + ) + this.emit("cheer", t, e.tags, s); + else { + if (l.hasOwn(e.tags, "msg-id")) { + if ("highlighted-message" === e.tags["msg-id"]) { + const i = e.tags["msg-id"]; + this.emit("redeem", t, e.tags.username, i, e.tags, s); + } else if ("skip-subs-mode-message" === e.tags["msg-id"]) { + const i = e.tags["msg-id"]; + this.emit("redeem", t, e.tags.username, i, e.tags, s); + } + } else if (l.hasOwn(e.tags, "custom-reward-id")) { + const i = e.tags["custom-reward-id"]; + this.emit("redeem", t, e.tags.username, i, e.tags, s); + } + n + ? (this.log[i](`[${t}] *<${e.tags.username}>: ${s}`), + this.emits(["action", "message"], [[t, e.tags, s, !1]])) + : (this.log[i](`[${t}] <${e.tags.username}>: ${s}`), + this.emits(["chat", "message"], [[t, e.tags, s, !1]])); + } + } + break; + default: + this.log.warn( + `Could not parse message:\n${JSON.stringify(e, null, 4)}` + ); + } + }), + (d.prototype.connect = function () { + return new Promise((e, t) => { + (this.server = l.get( + this.opts.connection.server, + "irc-ws.chat.twitch.tv" + )), + (this.port = l.get(this.opts.connection.port, 80)), + this.secure && (this.port = 443), + 443 === this.port && (this.secure = !0), + (this.reconnectTimer = this.reconnectTimer * this.reconnectDecay), + this.reconnectTimer >= this.maxReconnectInterval && + (this.reconnectTimer = this.maxReconnectInterval), + this._openConnection(), + this.once("_promiseConnect", (s) => { + s ? t(s) : e([this.server, ~~this.port]); + }); + }); + }), + (d.prototype._openConnection = function () { + const e = `${this.secure ? "wss" : "ws"}://${this.server}:${this.port}/`, + t = {}; + "agent" in this.opts.connection && (t.agent = this.opts.connection.agent), + (this.ws = new s(e, "irc", t)), + (this.ws.onmessage = this._onMessage.bind(this)), + (this.ws.onerror = this._onError.bind(this)), + (this.ws.onclose = this._onClose.bind(this)), + (this.ws.onopen = this._onOpen.bind(this)); + }), + (d.prototype._onOpen = function () { + this._isConnected() && + (this.log.info(`Connecting to ${this.server} on port ${this.port}..`), + this.emit("connecting", this.server, ~~this.port), + (this.username = l.get(this.opts.identity.username, l.justinfan())), + this._getToken() + .then((e) => { + const t = l.password(e); + this.log.info("Sending authentication to server.."), + this.emit("logon"); + let s = "twitch.tv/tags twitch.tv/commands"; + this._skipMembership || (s += " twitch.tv/membership"), + this.ws.send("CAP REQ :" + s), + t + ? this.ws.send(`PASS ${t}`) + : l.isJustinfan(this.username) && + this.ws.send("PASS SCHMOOPIIE"), + this.ws.send(`NICK ${this.username}`); + }) + .catch((e) => { + this.emits( + ["_promiseConnect", "disconnected"], + [[e], ["Could not get a token."]] + ); + })); + }), + (d.prototype._getToken = function () { + const e = this.opts.identity.password; + let t; + return "function" == typeof e + ? ((t = e()), t instanceof Promise ? t : Promise.resolve(t)) + : Promise.resolve(e); + }), + (d.prototype._onMessage = function (e) { + e.data + .trim() + .split("\r\n") + .forEach((e) => { + const t = h.msg(e); + t && this.handleMessage(t); + }); + }), + (d.prototype._onError = function () { + (this.moderators = {}), + (this.userstate = {}), + (this.globaluserstate = {}), + clearInterval(this.pingLoop), + clearTimeout(this.pingTimeout), + clearTimeout(this._updateEmotesetsTimer), + (this.reason = + null === this.ws ? "Connection closed." : "Unable to connect."), + this.emits(["_promiseConnect", "disconnected"], [[this.reason]]), + this.reconnect && + this.reconnections === this.maxReconnectAttempts && + (this.emit("maxreconnect"), + this.log.error("Maximum reconnection attempts reached.")), + this.reconnect && + !this.reconnecting && + this.reconnections <= this.maxReconnectAttempts - 1 && + ((this.reconnecting = !0), + (this.reconnections = this.reconnections + 1), + this.log.error( + `Reconnecting in ${Math.round(this.reconnectTimer / 1e3)} seconds..` + ), + this.emit("reconnect"), + setTimeout(() => { + (this.reconnecting = !1), + this.connect().catch((e) => this.log.error(e)); + }, this.reconnectTimer)), + (this.ws = null); + }), + (d.prototype._onClose = function () { + (this.moderators = {}), + (this.userstate = {}), + (this.globaluserstate = {}), + clearInterval(this.pingLoop), + clearTimeout(this.pingTimeout), + clearTimeout(this._updateEmotesetsTimer), + this.wasCloseCalled + ? ((this.wasCloseCalled = !1), + (this.reason = "Connection closed."), + this.log.info(this.reason), + this.emits( + ["_promiseConnect", "_promiseDisconnect", "disconnected"], + [[this.reason], [null], [this.reason]] + )) + : (this.emits(["_promiseConnect", "disconnected"], [[this.reason]]), + this.reconnect && + this.reconnections === this.maxReconnectAttempts && + (this.emit("maxreconnect"), + this.log.error("Maximum reconnection attempts reached.")), + this.reconnect && + !this.reconnecting && + this.reconnections <= this.maxReconnectAttempts - 1 && + ((this.reconnecting = !0), + (this.reconnections = this.reconnections + 1), + this.log.error( + `Could not connect to server. Reconnecting in ${Math.round( + this.reconnectTimer / 1e3 + )} seconds..` + ), + this.emit("reconnect"), + setTimeout(() => { + (this.reconnecting = !1), + this.connect().catch((e) => this.log.error(e)); + }, this.reconnectTimer))), + (this.ws = null); + }), + (d.prototype._getPromiseDelay = function () { + return this.currentLatency <= 600 ? 600 : this.currentLatency + 100; + }), + (d.prototype._sendCommand = function (e, t, s, i) { + return new Promise((n, o) => { + if (!this._isConnected()) return o("Not connected to server."); + if ( + ((null !== e && "number" != typeof e) || + (null === e && (e = this._getPromiseDelay()), + l.promiseDelay(e).then(() => o("No response from Twitch."))), + null !== t) + ) { + const e = l.channel(t); + this.log.info(`[${e}] Executing command: ${s}`), + this.ws.send(`PRIVMSG ${e} :${s}`); + } else this.log.info(`Executing command: ${s}`), this.ws.send(s); + "function" == typeof i ? i(n, o) : n(); + }); + }), + (d.prototype._sendMessage = function (e, t, s, i) { + return new Promise((n, o) => { + if (!this._isConnected()) return o("Not connected to server."); + if (l.isJustinfan(this.getUsername())) + return o("Cannot send anonymous messages."); + const r = l.channel(t); + if ((this.userstate[r] || (this.userstate[r] = {}), s.length >= 500)) { + const i = l.splitLine(s, 500); + (s = i[0]), + setTimeout(() => { + this._sendMessage(e, t, i[1], () => {}); + }, 350); + } + this.ws.send(`PRIVMSG ${r} :${s}`); + const a = {}; + Object.keys(this.emotesets).forEach((e) => + this.emotesets[e].forEach((e) => + (l.isRegex(e.code) ? h.emoteRegex : h.emoteString)( + s, + e.code, + e.id, + a + ) + ) + ); + const c = Object.assign( + this.userstate[r], + h.emotes({ emotes: h.transformEmotes(a) || null }) + ), + m = l.get(this.opts.options.messagesLogLevel, "info"), + d = l.actionMessage(s); + d + ? ((c["message-type"] = "action"), + this.log[m](`[${r}] *<${this.getUsername()}>: ${d[1]}`), + this.emits(["action", "message"], [[r, c, d[1], !0]])) + : ((c["message-type"] = "chat"), + this.log[m](`[${r}] <${this.getUsername()}>: ${s}`), + this.emits(["chat", "message"], [[r, c, s, !0]])), + "function" == typeof i ? i(n, o) : n(); + }); + }), + (d.prototype._updateEmoteset = function (e) { + let t = void 0 !== e; + if ( + (t && (e === this.emotes ? (t = !1) : (this.emotes = e)), + this._skipUpdatingEmotesets) + ) + return void (t && this.emit("emotesets", e, {})); + const s = () => { + this._updateEmotesetsTimerDelay > 0 && + (clearTimeout(this._updateEmotesetsTimer), + (this._updateEmotesetsTimer = setTimeout( + () => this._updateEmoteset(e), + this._updateEmotesetsTimerDelay + ))); + }; + this._getToken() + .then((t) => { + const s = `https://api.twitch.tv/kraken/chat/emoticon_images?emotesets=${e}`, + n = {}; + return ( + "fetchAgent" in this.opts.connection && + (n.agent = this.opts.connection.fetchAgent), + i(s, { + ...n, + headers: { + Accept: "application/vnd.twitchtv.v5+json", + Authorization: `OAuth ${l.token(t)}`, + "Client-ID": this.clientId, + }, + }) + ); + }) + .then((e) => e.json()) + .then((t) => { + (this.emotesets = t.emoticon_sets || {}), + this.emit("emotesets", e, this.emotesets), + s(); + }) + .catch(() => s()); + }), + (d.prototype.getUsername = function () { + return this.username; + }), + (d.prototype.getOptions = function () { + return this.opts; + }), + (d.prototype.getChannels = function () { + return this.channels; + }), + (d.prototype.isMod = function (e, t) { + const s = l.channel(e); + return ( + this.moderators[s] || (this.moderators[s] = []), + this.moderators[s].includes(l.username(t)) + ); + }), + (d.prototype.readyState = function () { + return null === this.ws + ? "CLOSED" + : ["CONNECTING", "OPEN", "CLOSING", "CLOSED"][this.ws.readyState]; + }), + (d.prototype._isConnected = function () { + return null !== this.ws && 1 === this.ws.readyState; + }), + (d.prototype.disconnect = function () { + return new Promise((e, t) => { + null !== this.ws && 3 !== this.ws.readyState + ? ((this.wasCloseCalled = !0), + this.log.info("Disconnecting from server.."), + this.ws.close(), + this.once("_promiseDisconnect", () => + e([this.server, ~~this.port]) + )) + : (this.log.error( + "Cannot disconnect from server. Socket is not opened or connection is already closing." + ), + t( + "Cannot disconnect from server. Socket is not opened or connection is already closing." + )); + }); + }), + (d.prototype.off = d.prototype.removeListener), + e.exports && (e.exports = d), + "undefined" != typeof window && (window.tmi = { client: d, Client: d }); +})(client$1); +var clientExports = client$1.exports; +const client = clientExports; +var tmi_js = { client: client, Client: client }; +const tmi = getDefaultExportFromCjs(tmi_js); +class Chat { + constructor(e, t, s, i) { + (this.scene = e), (this._username = t), (this._password = s); + const n = new URLSearchParams(window.location.search); + (this.channel = n.get("channel") || "devdiaries"), + (this.feedback = "1" == n.get("feedback")), + (this.maxPlayers = this.isValidNumberWithMax(n.get("maxplayers")) + ? +n.get("maxplayers") + : 500), + this.init(); + } + init() { + console.log( + "Chat channel: ", + this.channel, + "feedback: ", + this.feedback, + "maxPlayers: ", + this.maxPlayers + ), + (this.client = new tmi.Client({ + options: { debug: !1 }, + channels: [this.channel], + })), + this.client + .connect() + .then((e) => { + console.log("Connected!, loading game"), this.scene.loadGame(); + }) + .catch(console.error), + this.setOnJoinListener(), + this.setOnMessageListener(), + this.setOnChatListener; + } + setOnJoinListener() { + this.client.on("join", (e, t, s) => { + console.log("Somebody joined the chat: ", e, t), + s && this.scene.addPlayer(t); + }); + } + setOnMessageListener() { + this.client.on("message", (e, t, s, i) => { + console.log(`Message: ${t.username} just ${s}`), + this.processMessage(t.username, s); + }); + } + setOnChatListener() { + this.client.on("chat", async (e, t, s, i) => { + t.mod; + const n = s.toLowerCase().split(" "); + console.log("Received chat: ", e, t, n), + this.processMessage(t["display-name"], s); + }); + } + processMessage(e, t) { + this.isValidNumber(t) && this.scene.guess(e, +t); + } + sendAction(e, t) { + console.log("Sending action: ", this.feedback, e, t), + this.feedback && this.client.action(e, t); + } + say(e) { + this.feedback && this.client.say(this.channel, e); + } + isValidNumberWithMax(e, t = 100) { + return this.isValidNumber(e) && +e > 0 && +e <= t; + } + isValidNumber(e) { + return !isNaN(e); + } +} +class Game extends Phaser.Scene { + constructor() { + super({ key: "game" }), + (this.player = null), + (this.score = 0), + (this.scoreText = null), + (this.nextOperator = ""), + (this.lastMessage = null), + (this.number = ""), + (this.counter = 0), + (this.failed = !1); + } + preload() { + const e = new URLSearchParams(window.location.search); + let t = e.get("background") || "#00b140"; + (t = parseInt(t.substring(1), 16)), + (this.backgroundColor = "0x" + t.toString(16)); + let s = e.get("foreground") || "#F0EAD6"; + (s = parseInt(s.substring(1), 16)), + (this.foregroundColor = "0x" + s.toString(16)), + (this.spamTimeWait = 2), + (this.result = Phaser.Math.Between(1, 9)); + } + create() { + (this.width = this.sys.game.config.width), + (this.height = this.sys.game.config.height), + (this.center_width = this.width / 2), + (this.center_height = this.height / 2), + this.cameras.main.setBackgroundColor(+this.foregroundColor), + (this.allPlayers = {}), + this.addChat(), + this.loadAudios(), + this.addUI(); + } + addChat() { + this.chat = new Chat(this); + } + loadGame() { + this.generateNextOperation(); + } + addUI() { + (this.circle = this.add.circle( + this.center_width, + this.center_height - 50, + 100, + 15871022 + )), + (this.numberText = this.add + .bitmapText( + this.center_width, + this.center_height - 50, + "mainFont", + this.number, + 120 + ) + .setOrigin(0.5) + .setTint(0)), + (this.operatorText = this.add + .bitmapText( + this.center_width, + this.center_height + 80, + "mainFont", + `${this.nextOperator}${this.number}`, + 50 + ) + .setOrigin(0.5) + .setTint(0)), + this.addClouds(), + this.addScore(), + (this.byText = this.add + .bitmapText( + this.center_width, + this.height - 10, + "mainFont", + "by Pello", + 10 + ) + .setOrigin(0.5) + .setTint(0)); + } + addClouds() { + (this.cloudLeft = this.add + .image( + this.center_width - 100, + this.center_height - 120 + Phaser.Math.Between(-15, 15), + "cloud" + Phaser.Math.Between(1, 14) + ) + .setScale(0.1 * Phaser.Math.Between(5, 9))), + (this.cloudRight = this.add + .image( + this.center_width + 100, + this.center_height + 30 + Phaser.Math.Between(-15, 15), + "cloud" + Phaser.Math.Between(1, 14) + ) + .setScale(0.1 * Phaser.Math.Between(4, 6))), + this.tweens.add({ + targets: [this.cloudLeft], + x: { from: -156, to: this.width + 156 }, + duration: 3e4, + onComplete: () => { + this.cloudLeft.destroy(); + }, + }), + this.tweens.add({ + targets: this.cloudRight, + x: { from: this.width + 156, to: -156 }, + duration: 3e4, + onComplete: () => { + this.cloudLeft.destroy(), this.addClouds(); + }, + }); + } + addScore() { + const e = this.createScoreBoard(); + this.add + .bitmapText(this.center_width, 25, "mainFont", "zenbaki", 25) + .setOrigin(0.5) + .setTint(0), + e.slice(0, 3).forEach((e, t) => { + const s = `${t + 1}. ${e.name}: ${e.score}`; + this.add + .bitmapText(this.center_width, 100 + 50 * t, "mainFont", s, 30) + .setOrigin(0.5) + .setTint(this.foregroundColor) + .setDropShadow(1, 2, 12526882, 0.7); + }), + (this.scoreText1 = this.add + .bitmapText( + this.center_width, + this.center_height + 130, + "mainFont", + "", + 20 + ) + .setOrigin(0.5) + .setTint(0)), + (this.scoreText2 = this.add + .bitmapText( + this.center_width, + this.center_height + 160, + "mainFont", + "", + 25 + ) + .setOrigin(0.5) + .setTint(0)); + } + addPlayer(e) { + if (this.allPlayers[e]) return this.allPlayers[e]; + const t = new Player(this, e); + return ( + (this.allPlayers[e] = t), this.chat.say(`Player ${e} joins game!`), t + ); + } + guess(e, t) { + if (this.failed) return; + console.log("Game> guess: ", e, t); + const s = this.addPlayer(e); + if (!s.dead && !s.hasSpammed()) + if ( + ((s.lastMessage = new Date()), + console.log("Game> guess go on: ", e, t), + this.result === parseInt(t)) + ) { + const i = this.calculateScore(); + (s.score += i), + this.showScore(e, i), + this.generateNextOperation(), + console.log("Player", e, "guess", t); + } else + this.number === parseInt(t) + ? console.log("Player, ", e, " is too slow") + : (this.cameras.main.shake(100, 0.01), + this.playAudio("fail"), + (this.failed = !0), + s.setPenalty(), + this.showShame(e), + this.chat.say(`Player ${e} failed! Shame on you!`)); + } + calculateScore() { + return this.counter + { "+": 1, "-": 2, "*": 4, "/": 5 }[this.nextOperator]; + } + loadAudios() { + this.audios = { + win: this.sound.add("win"), + drip: this.sound.add("drip"), + fail: this.sound.add("fail"), + }; + } + playAudio(e) { + this.audios[e].play({ volume: 0.5 }); + } + showResult() { + const e = this.createScoreBoard(); + (this.scoreRectangle = this.add + .rectangle(0, 0, this.width, this.height, this.foregroundColor, 0.9) + .setOrigin(0, 0)), + (this.scores = this.add.group()), + (this.sensei = this.add + .image(this.center_width, this.height - 60, "sensei") + .setOrigin(0.5) + .setScale(0.4)), + this.scores.add(this.sensei), + this.scores.add( + this.add + .bitmapText(this.center_width, 60, "mainFont", "Senseis:", 30) + .setOrigin(0.5) + .setTint(0) + ), + e.slice(0, 5).forEach((e, t) => { + const s = `${t + 1}. ${e.name}, ${e.score}`; + this.scores.add( + this.add + .bitmapText(this.center_width, 100 + 20 * t, "mainFont", s, 15) + .setOrigin(0.5) + .setTint(0) + ); + }), + this.removeResult(); + } + removeResult() { + this.time.delayedCall( + 5e3, + () => { + this.tweens.add({ + targets: [this.scoreRectangle, this.scores, this.sensei], + duration: 1e3, + alpha: { from: 1, to: 0 }, + onComplete: () => { + this.scoreRectangle.destroy(), + this.scores.getChildren().forEach(function (e) { + e.destroy(); + }, this), + this.scores.clear(!0, !0); + }, + }), + this.resetScore(), + this.generateNextOperation(); + }, + null, + this + ); + } + createScoreBoard() { + return [...Object.values(this.allPlayers)].sort( + (e, t) => t.score - e.score + ); + } + resetScore() { + (this.number = 0), (this.counter = 0), (this.failed = !1); + } + generateNextOperation() { + this.counter++, + (this.number = this.result), + (this.nextOperand = Phaser.Math.Between(1, 9)), + (this.nextOperator = this.selectOperator()), + (this.result = parseInt( + eval(this.number + this.nextOperator + this.nextOperand) + )), + console.log( + "Current: ", + this.number, + " operator: ", + this.nextOperator, + " nextNumber: ", + this.nextOperand, + ", Result: ", + this.result + ), + this.showNextOperation(this.nextOperator, this.nextOperand), + this.playAudio("drip"); + } + selectOperator() { + return this.number % this.nextOperand == 0 && 1 !== this.nextOperand + ? Phaser.Math.RND.pick(["+", "-", "+", "-", "/"]) + : this.number + this.nextOperand >= 100 + ? Phaser.Math.RND.pick(["-"]) + : this.number - this.nextOperand <= -100 + ? Phaser.Math.RND.pick(["+"]) + : Math.abs(this.number * this.nextOperand) < 100 + ? Phaser.Math.RND.pick(["+", "-", "+", "-", "*"]) + : Phaser.Math.RND.pick(["+", "-", "+", "-"]); + } + showScore(e, t) { + this.scoreText1.setText("Great!").setAlpha(1), + this.scoreText2.setText(`${e} +${t}`).setAlpha(1), + this.tweens.add({ + targets: [this.scoreText1], + alpha: { from: 1, to: 0 }, + ease: "Linear", + duration: 3e3, + }); + } + showShame(e) { + this.scoreText1 + .setText( + Phaser.Math.RND.pick([ + "You're a disgrace", + "Shame on you", + "You dishonor us all", + "You're a disappointment", + "You're a failure", + "You dishonor this dojo", + ]) + ) + .setAlpha(1), + this.scoreText2.setText(`${e}`).setAlpha(1), + this.tweens.add({ + targets: [this.scoreText1, this.scoreText2], + alpha: { from: 1, to: 0 }, + ease: "Linear", + duration: 3e3, + onComplete: () => { + this.showResult(); + }, + }); + } + showNextOperation(e, t) { + this.numberText.setText(this.number), this.operatorText.setText(`${e}${t}`); + } +} +const config = { + width: 260, + height: 380, + scale: { autoCenter: Phaser$1.Scale.CENTER_BOTH }, + autoRound: !1, + parent: "game-container", + physics: { default: "arcade", arcade: { gravity: { y: 300 }, debug: !1 } }, + scene: [Bootloader, Game], +}; +new Phaser$1.Game(config); diff --git a/zenbaki/src/main.js b/zenbaki/src/main.js index a520a333..519c74f6 100644 --- a/zenbaki/src/main.js +++ b/zenbaki/src/main.js @@ -9,7 +9,7 @@ const config = { autoCenter: Phaser.Scale.CENTER_BOTH, }, autoRound: false, - parent: "contenedor", + parent: "game-container", physics: { default: "arcade", arcade: { From 845c73a8f8ad55b70afc4e586a6d142dbede1ed2 Mon Sep 17 00:00:00 2001 From: Bart Duisters Date: Wed, 12 Jun 2024 14:44:12 +0200 Subject: [PATCH 2/2] fix: fate javascript error + consistent game-container parent + ran build for each project --- .../{index-d9ZvbO5r.js => index-B7k3BU8O.js} | 2 +- blastemup/dist/index.html | 4 +- blastemup/src/main.js | 1 + dungeon/dist/assets/index-CQq0-1Ik.js | 2983 ----------------- dungeon/dist/assets/index-Cjdkyr6b.js | 1 + dungeon/dist/assets/phaser-D-IeUSbb.js | 1 + dungeon/dist/assets/phaser-zcydYi9M.js | 1 - dungeon/dist/index.html | 6 +- .../{index-DBbMvyNZ.js => index-D7tYnf-8.js} | 2 +- fate/dist/index.html | 4 +- fate/src/main.js | 1 + fate/src/scenes/story.js | 12 +- mars/dist/assets/index-CP-uPpKM.js | 1951 ----------- mars/dist/assets/index-DXyQYrwv.js | 1 + mars/dist/index.html | 4 +- pushpull/dist/assets/index-D29MUjmQ.js | 782 ----- pushpull/dist/assets/index-DV1PhKTq.js | 1 + pushpull/dist/index.html | 4 +- runner/dist/index.html | 2 +- starshake/dist/assets/index-BJazpsUR.js | 1 + starshake/dist/assets/index-DEhXC0VF.js | 1447 -------- starshake/dist/index.html | 4 +- wallhammer/dist/assets/index-Du4WbNGK.js | 1419 -------- wallhammer/dist/assets/index-SLRyrvV8.js | 1 + wallhammer/dist/index.html | 4 +- zenbaki/dist/assets/html/index.html | 4 +- zenbaki/dist/assets/index-BA24paxW.js | 2554 -------------- zenbaki/dist/assets/index-BRcjDLKl.js | 1 + zenbaki/dist/index.html | 4 +- 29 files changed, 36 insertions(+), 11166 deletions(-) rename blastemup/dist/assets/{index-d9ZvbO5r.js => index-B7k3BU8O.js} (98%) delete mode 100644 dungeon/dist/assets/index-CQq0-1Ik.js create mode 100644 dungeon/dist/assets/index-Cjdkyr6b.js create mode 100644 dungeon/dist/assets/phaser-D-IeUSbb.js delete mode 100644 dungeon/dist/assets/phaser-zcydYi9M.js rename fate/dist/assets/{index-DBbMvyNZ.js => index-D7tYnf-8.js} (67%) delete mode 100644 mars/dist/assets/index-CP-uPpKM.js create mode 100644 mars/dist/assets/index-DXyQYrwv.js delete mode 100644 pushpull/dist/assets/index-D29MUjmQ.js create mode 100644 pushpull/dist/assets/index-DV1PhKTq.js create mode 100644 starshake/dist/assets/index-BJazpsUR.js delete mode 100644 starshake/dist/assets/index-DEhXC0VF.js delete mode 100644 wallhammer/dist/assets/index-Du4WbNGK.js create mode 100644 wallhammer/dist/assets/index-SLRyrvV8.js delete mode 100644 zenbaki/dist/assets/index-BA24paxW.js create mode 100644 zenbaki/dist/assets/index-BRcjDLKl.js diff --git a/blastemup/dist/assets/index-d9ZvbO5r.js b/blastemup/dist/assets/index-B7k3BU8O.js similarity index 98% rename from blastemup/dist/assets/index-d9ZvbO5r.js rename to blastemup/dist/assets/index-B7k3BU8O.js index ff00a7e8..4759c122 100644 --- a/blastemup/dist/assets/index-d9ZvbO5r.js +++ b/blastemup/dist/assets/index-B7k3BU8O.js @@ -1 +1 @@ -import{P as s}from"./phaser-CmFXOKba.js";!function(){const s=document.createElement("link").relList;if(!(s&&s.supports&&s.supports("modulepreload"))){for(const s of document.querySelectorAll('link[rel="modulepreload"]'))t(s);new MutationObserver((s=>{for(const e of s)if("childList"===e.type)for(const s of e.addedNodes)"LINK"===s.tagName&&"modulepreload"===s.rel&&t(s)})).observe(document,{childList:!0,subtree:!0})}function t(s){if(s.ep)return;s.ep=!0;const t=function(s){const t={};return s.integrity&&(t.integrity=s.integrity),s.referrerPolicy&&(t.referrerPolicy=s.referrerPolicy),"use-credentials"===s.crossOrigin?t.credentials="include":"anonymous"===s.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(s);fetch(s.href,t)}}();class t extends Phaser.GameObjects.Rectangle{constructor(s,t,e,i=16777215,a=4,o=1){super(s,t,e,a,a,i,o),this.name="bubble",this.scene=s,this.alpha=o,this.setOrigin(.5),s.add.existing(this),s.physics.add.existing(this),this.body.setAllowGravity(!1),this.init()}init(){this.scene.tweens.add({targets:this,duration:Phaser.Math.Between(600,1e3),scale:{from:1,to:3},alpha:{from:this.alpha,to:0},onComplete:()=>{this.destroy()}})}}class e extends Phaser.GameObjects.Sprite{constructor(s,t,e,i){super(s,t,e,"ship1_1"),this.scene=s,this.name=i,this.tint=16777215*Math.random(),s.add.existing(this),s.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setCircle(26),this.body.setOffset(6,9),this.body.setBounce(.8),this.angle=0,this.speed=0,this.friction=.95,this.death=!1,this.init()}init(){this.cursor=this.scene.input.keyboard.createCursorKeys(),this.scene.events.on("update",this.update,this),this.body.setDrag(300),this.body.setAngularDrag(400),this.body.setMaxVelocity(600),this.upDelta=0}get key(){return this.name.split(":")[1]}update(s,e){this.death||(this.cursor.left.isDown?this.body.setAngularVelocity(-150):this.cursor.right.isDown?this.body.setAngularVelocity(150):this.body.setAngularVelocity(0),this.cursor.up.isDown?(this.upDelta+=e,this.upDelta>200&&(this.upDelta=0),this.body.setVelocity(300*Math.cos(this.rotation),300*Math.sin(this.rotation))):this.body.setAcceleration(0),Phaser.Math.Between(1,4)>1&&this.scene.thrust.add(new t(this.scene,this.x,this.y,16777215,10)))}destroy(){this.death=!0,super.destroy()}}const i="newPlayer",a="playerDisconnected";class o extends s.Scene{constructor(){super({key:"game"})}create(){this.id=null,this.startSockets(),this.loadAudios(),this.addColliders()}startSockets(){this.socket=io(),this.addPlayer(),this.enemies={},this.enemyPlayers=this.physics.add.group(),this.socket.on(i,function(s){this.addEnemyPlayers(s)}.bind(this)),this.socket.on("currentPlayers",function(s){Object.keys(s).forEach((t=>{this.enemies[t]||t===this.player.key||this.addEnemyPlayers(s[t])}))}.bind(this)),this.socket.on("playerMoved",function(s){const[t,e]=s.name.split(":");this.enemies[e]&&(this.enemies[e].setRotation(s.rotation),this.enemies[e].setPosition(s.x,s.y))}.bind(this)),this.socket.on(a,function(s){this.enemyPlayers.getChildren().forEach((function(t){s===t.key&&t.destroy()}))}.bind(this))}addEnemyPlayers(s){const[t,i]=s.name.split(":");console.log("Adding enemy player! ",s.name," Against ",i);const a=new e(this,s.x,s.y,s.name);this.enemies[a.key]=a,this.enemyPlayers.add(a)}addPlayer(){this.thrust=this.add.layer();const t=600+s.Math.Between(-100,100),a=500+s.Math.Between(-100,100);this.player=new e(this,t,a,"MyName:"+crypto.randomUUID()),console.log("Creating player! ",this.player.key),this.socket.emit(i,this.player),this.setCamera()}setCamera(){this.cameras.main.setBackgroundColor(13421772),this.cameras.main.startFollow(this.player,!0,.05,.05,0,100)}addColliders(){this.physics.add.overlap(this.player,this.enemyPlayers,this.playerCollision.bind(this))}playerCollision(s,t){console.log("Collision! "),this.socket.emit(a,s.key),s.destroy(),t.destroy()}update(){if(this.player){const s={x:this.player.x,y:this.player.y,rotation:this.player.rotation};!this.player.oldPosition||s.x===this.player.oldPosition.x&&s.y===this.player.oldPosition.y&&s.rotation===this.player.oldPosition.rotation||this.socket.emit("playerIsMoving",{key:this.player.key,...s}),this.player.oldPosition=s}}loadAudios(){this.audios={pick:this.sound.add("pick"),shot:this.sound.add("shot"),foeshot:this.sound.add("foeshot"),explosion:this.sound.add("explosion"),asteroid:this.sound.add("asteroid")}}playAudio(s){this.audios[s].play({volume:.2})}startGame(){this.theme&&this.theme.stop(),this.scene.start("game")}destroy(){this.player&&this.socket.emit(a,this.player.key),super.destroy()}}class r extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.load.on("progress",(function(s){this.progressBar.clear(),this.progressBar.fillStyle(8966732,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*s,16)}),this),this.load.on("complete",(()=>{this.scene.start("game")}),this),Array(6).fill(0).forEach(((s,t)=>{this.load.audio(`muzik${t}`,`assets/sounds/muzik${t}.mp3`)})),this.load.image("ship1_1","assets/images/starship.png"),this.load.image("foeship","assets/images/foeship.png"),this.load.image("pello","assets/images/pello.png"),this.load.image("hex","assets/images/hex64.png"),this.load.image("asteroid","assets/images/asteroid.png"),this.load.audio("splash","assets/sounds/splash.mp3"),this.load.audio("game-over","assets/sounds/game-over.mp3"),this.load.audio("explosion","assets/sounds/explosion.mp3"),this.load.audio("shot","assets/sounds/shot.mp3"),this.load.audio("foeshot","assets/sounds/foeshot.mp3"),this.load.audio("pick","assets/sounds/pick.mp3"),this.load.audio("asteroid","assets/sounds/asteroid.mp3"),this.load.bitmapFont("arcade","assets/fonts/arcade.png","assets/fonts/arcade.xml"),this.load.bitmapFont("wendy","assets/fonts/arcade.png","assets/fonts/wendy.xml"),this.load.bitmapFont("starshipped","assets/fonts/starshipped.png","assets/fonts/starshipped.xml"),this.load.spritesheet("shot","assets/images/shot.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("shotfoe","assets/images/shotfoe.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("energy","assets/images/energy.png",{frameWidth:32,frameHeight:32})}create(){}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(33923,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}const h={type:s.AUTO,useTicker:!0,scale:{mode:s.Scale.FIT,parent:"phaser-example",autoCenter:s.Scale.CENTER_BOTH,width:868,height:800},physics:{default:"arcade",arcade:{gravity:{y:0},debug:!1}},scene:[r,o]};new s.Game(h); +import{P as s}from"./phaser-CmFXOKba.js";!function(){const s=document.createElement("link").relList;if(!(s&&s.supports&&s.supports("modulepreload"))){for(const s of document.querySelectorAll('link[rel="modulepreload"]'))t(s);new MutationObserver((s=>{for(const e of s)if("childList"===e.type)for(const s of e.addedNodes)"LINK"===s.tagName&&"modulepreload"===s.rel&&t(s)})).observe(document,{childList:!0,subtree:!0})}function t(s){if(s.ep)return;s.ep=!0;const t=function(s){const t={};return s.integrity&&(t.integrity=s.integrity),s.referrerPolicy&&(t.referrerPolicy=s.referrerPolicy),"use-credentials"===s.crossOrigin?t.credentials="include":"anonymous"===s.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(s);fetch(s.href,t)}}();class t extends Phaser.GameObjects.Rectangle{constructor(s,t,e,i=16777215,a=4,o=1){super(s,t,e,a,a,i,o),this.name="bubble",this.scene=s,this.alpha=o,this.setOrigin(.5),s.add.existing(this),s.physics.add.existing(this),this.body.setAllowGravity(!1),this.init()}init(){this.scene.tweens.add({targets:this,duration:Phaser.Math.Between(600,1e3),scale:{from:1,to:3},alpha:{from:this.alpha,to:0},onComplete:()=>{this.destroy()}})}}class e extends Phaser.GameObjects.Sprite{constructor(s,t,e,i){super(s,t,e,"ship1_1"),this.scene=s,this.name=i,this.tint=16777215*Math.random(),s.add.existing(this),s.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setCircle(26),this.body.setOffset(6,9),this.body.setBounce(.8),this.angle=0,this.speed=0,this.friction=.95,this.death=!1,this.init()}init(){this.cursor=this.scene.input.keyboard.createCursorKeys(),this.scene.events.on("update",this.update,this),this.body.setDrag(300),this.body.setAngularDrag(400),this.body.setMaxVelocity(600),this.upDelta=0}get key(){return this.name.split(":")[1]}update(s,e){this.death||(this.cursor.left.isDown?this.body.setAngularVelocity(-150):this.cursor.right.isDown?this.body.setAngularVelocity(150):this.body.setAngularVelocity(0),this.cursor.up.isDown?(this.upDelta+=e,this.upDelta>200&&(this.upDelta=0),this.body.setVelocity(300*Math.cos(this.rotation),300*Math.sin(this.rotation))):this.body.setAcceleration(0),Phaser.Math.Between(1,4)>1&&this.scene.thrust.add(new t(this.scene,this.x,this.y,16777215,10)))}destroy(){this.death=!0,super.destroy()}}const i="newPlayer",a="playerDisconnected";class o extends s.Scene{constructor(){super({key:"game"})}create(){this.id=null,this.startSockets(),this.loadAudios(),this.addColliders()}startSockets(){this.socket=io(),this.addPlayer(),this.enemies={},this.enemyPlayers=this.physics.add.group(),this.socket.on(i,function(s){this.addEnemyPlayers(s)}.bind(this)),this.socket.on("currentPlayers",function(s){Object.keys(s).forEach((t=>{this.enemies[t]||t===this.player.key||this.addEnemyPlayers(s[t])}))}.bind(this)),this.socket.on("playerMoved",function(s){const[t,e]=s.name.split(":");this.enemies[e]&&(this.enemies[e].setRotation(s.rotation),this.enemies[e].setPosition(s.x,s.y))}.bind(this)),this.socket.on(a,function(s){this.enemyPlayers.getChildren().forEach((function(t){s===t.key&&t.destroy()}))}.bind(this))}addEnemyPlayers(s){const[t,i]=s.name.split(":");console.log("Adding enemy player! ",s.name," Against ",i);const a=new e(this,s.x,s.y,s.name);this.enemies[a.key]=a,this.enemyPlayers.add(a)}addPlayer(){this.thrust=this.add.layer();const t=600+s.Math.Between(-100,100),a=500+s.Math.Between(-100,100);this.player=new e(this,t,a,"MyName:"+crypto.randomUUID()),console.log("Creating player! ",this.player.key),this.socket.emit(i,this.player),this.setCamera()}setCamera(){this.cameras.main.setBackgroundColor(13421772),this.cameras.main.startFollow(this.player,!0,.05,.05,0,100)}addColliders(){this.physics.add.overlap(this.player,this.enemyPlayers,this.playerCollision.bind(this))}playerCollision(s,t){console.log("Collision! "),this.socket.emit(a,s.key),s.destroy(),t.destroy()}update(){if(this.player){const s={x:this.player.x,y:this.player.y,rotation:this.player.rotation};!this.player.oldPosition||s.x===this.player.oldPosition.x&&s.y===this.player.oldPosition.y&&s.rotation===this.player.oldPosition.rotation||this.socket.emit("playerIsMoving",{key:this.player.key,...s}),this.player.oldPosition=s}}loadAudios(){this.audios={pick:this.sound.add("pick"),shot:this.sound.add("shot"),foeshot:this.sound.add("foeshot"),explosion:this.sound.add("explosion"),asteroid:this.sound.add("asteroid")}}playAudio(s){this.audios[s].play({volume:.2})}startGame(){this.theme&&this.theme.stop(),this.scene.start("game")}destroy(){this.player&&this.socket.emit(a,this.player.key),super.destroy()}}class r extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.load.on("progress",(function(s){this.progressBar.clear(),this.progressBar.fillStyle(8966732,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*s,16)}),this),this.load.on("complete",(()=>{this.scene.start("game")}),this),Array(6).fill(0).forEach(((s,t)=>{this.load.audio(`muzik${t}`,`assets/sounds/muzik${t}.mp3`)})),this.load.image("ship1_1","assets/images/starship.png"),this.load.image("foeship","assets/images/foeship.png"),this.load.image("pello","assets/images/pello.png"),this.load.image("hex","assets/images/hex64.png"),this.load.image("asteroid","assets/images/asteroid.png"),this.load.audio("splash","assets/sounds/splash.mp3"),this.load.audio("game-over","assets/sounds/game-over.mp3"),this.load.audio("explosion","assets/sounds/explosion.mp3"),this.load.audio("shot","assets/sounds/shot.mp3"),this.load.audio("foeshot","assets/sounds/foeshot.mp3"),this.load.audio("pick","assets/sounds/pick.mp3"),this.load.audio("asteroid","assets/sounds/asteroid.mp3"),this.load.bitmapFont("arcade","assets/fonts/arcade.png","assets/fonts/arcade.xml"),this.load.bitmapFont("wendy","assets/fonts/arcade.png","assets/fonts/wendy.xml"),this.load.bitmapFont("starshipped","assets/fonts/starshipped.png","assets/fonts/starshipped.xml"),this.load.spritesheet("shot","assets/images/shot.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("shotfoe","assets/images/shotfoe.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("energy","assets/images/energy.png",{frameWidth:32,frameHeight:32})}create(){}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(33923,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}const h={type:s.AUTO,useTicker:!0,scale:{mode:s.Scale.FIT,parent:"phaser-example",autoCenter:s.Scale.CENTER_BOTH,width:868,height:800},parent:"game-container",physics:{default:"arcade",arcade:{gravity:{y:0},debug:!1}},scene:[r,o]};new s.Game(h); diff --git a/blastemup/dist/index.html b/blastemup/dist/index.html index 5013c10f..37efeb15 100644 --- a/blastemup/dist/index.html +++ b/blastemup/dist/index.html @@ -4,7 +4,7 @@ - Phaser - Template + Phaser - Blastemup - + diff --git a/blastemup/src/main.js b/blastemup/src/main.js index fd8d1620..3012be70 100644 --- a/blastemup/src/main.js +++ b/blastemup/src/main.js @@ -12,6 +12,7 @@ const config = { width: 868, height: 800, }, + parent: "game-container", physics: { default: "arcade", arcade: { diff --git a/dungeon/dist/assets/index-CQq0-1Ik.js b/dungeon/dist/assets/index-CQq0-1Ik.js deleted file mode 100644 index 42500717..00000000 --- a/dungeon/dist/assets/index-CQq0-1Ik.js +++ /dev/null @@ -1,2983 +0,0 @@ -import { - g as getDefaultExportFromCjs, - r as requirePhaser, -} from "./phaser-zcydYi9M.js"; -!(function () { - const t = document.createElement("link").relList; - if (!(t && t.supports && t.supports("modulepreload"))) { - for (const t of document.querySelectorAll('link[rel="modulepreload"]')) - e(t); - new MutationObserver((t) => { - for (const s of t) - if ("childList" === s.type) - for (const t of s.addedNodes) - "LINK" === t.tagName && "modulepreload" === t.rel && e(t); - }).observe(document, { childList: !0, subtree: !0 }); - } - function e(t) { - if (t.ep) return; - t.ep = !0; - const e = (function (t) { - const e = {}; - return ( - t.integrity && (e.integrity = t.integrity), - t.referrerPolicy && (e.referrerPolicy = t.referrerPolicy), - "use-credentials" === t.crossOrigin - ? (e.credentials = "include") - : "anonymous" === t.crossOrigin - ? (e.credentials = "omit") - : (e.credentials = "same-origin"), - e - ); - })(t); - fetch(t.href, e); - } -})(); -var phaserExports = requirePhaser(); -const Phaser$1 = getDefaultExportFromCjs(phaserExports); -class Bootloader extends Phaser.Scene { - constructor() { - super({ key: "bootloader" }); - } - preload() { - this.createBars(), - this.setLoadEvents(), - this.loadFonts(), - this.loadImages(), - this.loadMaps(), - this.loadAudios(), - this.loadSpritesheets(); - } - setLoadEvents() { - this.load.on( - "progress", - function (t) { - this.progressBar.clear(), - this.progressBar.fillStyle(34986, 1), - this.progressBar.fillRect( - this.cameras.main.width / 4, - this.cameras.main.height / 2 - 16, - (this.cameras.main.width / 2) * t, - 16 - ); - }, - this - ), - this.load.on( - "complete", - () => { - this.scene.start("splash"); - }, - this - ); - } - loadFonts() { - this.load.bitmapFont( - "default", - "assets/fonts/pico.png", - "assets/fonts/pico.xml" - ); - } - loadImages() { - this.load.image("pello", "assets/images/pello_ok.png"), - this.load.image("fireball", "assets/images/fireball.png"), - this.load.image("tiles", "assets/maps/pixel-poem-tiles.png"), - this.load.image("block", "assets/images/block.png"), - this.load.image("seesaw", "assets/images/seesaw.png"), - this.load.image("bubble", "assets/images/bubble.png"), - this.load.image("platform", "assets/images/platform.png"); - } - loadMaps() { - this.load.tilemapTiledJSON("scene0", "assets/maps/level.json"); - } - loadAudios() { - Array(5) - .fill(0) - .forEach((t, e) => { - this.load.audio(`climb${e}`, `assets/sounds/climb${e}.mp3`); - }), - this.load.audio("splash", "assets/sounds/splash.mp3"), - this.load.audio("music", "assets/sounds/music.mp3"), - this.load.audio("jump", "assets/sounds/jump.mp3"), - this.load.audio("bubble", "assets/sounds/bubble.mp3"), - this.load.audio("trap", "assets/sounds/trap.mp3"), - this.load.audio("crash", "assets/sounds/crash.mp3"), - this.load.audio("fireball", "assets/sounds/fireball.mp3"), - this.load.audio("win", "assets/sounds/win.mp3"), - this.load.audio("start", "assets/sounds/start.mp3"), - this.load.audio("death", "assets/sounds/death.mp3"); - } - loadSpritesheets() { - this.load.spritesheet("player", "assets/images/player.png", { - frameWidth: 48, - frameHeight: 48, - }), - this.load.spritesheet("dust", "assets/images/dust.png", { - frameWidth: 32, - frameHeight: 32, - }), - this.load.spritesheet("coin", "assets/images/coin.png", { - frameWidth: 32, - frameHeight: 32, - }), - this.load.spritesheet("keys", "assets/images/keys.png", { - frameWidth: 48, - frameHeight: 48, - }), - this.load.spritesheet("bat", "assets/images/bat.png", { - frameWidth: 32, - frameHeight: 32, - }), - this.load.spritesheet("wizard", "assets/images/wizard.png", { - frameWidth: 48, - frameHeight: 48, - }); - } - createBars() { - (this.loadBar = this.add.graphics()), - this.loadBar.fillStyle(43771, 1), - this.loadBar.fillRect( - this.cameras.main.width / 4 - 2, - this.cameras.main.height / 2 - 18, - this.cameras.main.width / 2 + 4, - 20 - ), - (this.progressBar = this.add.graphics()); - } -} -class Outro extends Phaser.Scene { - constructor() { - super({ key: "outro" }); - } - init(t) { - (this.name = t.name), (this.number = t.number), (this.next = t.next); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.showPlayer(), - this.sound.add("win").play(), - (this.scoreCoins = this.add - .bitmapText( - this.center_width, - 50, - "default", - "Coins: " + this.registry.get("coins"), - 25 - ) - .setOrigin(0.5) - .setScrollFactor(0)), - (this.scoreSeconds = this.add - .bitmapText( - this.center_width, - 100, - "default", - "Time: " + this.registry.get("seconds"), - 25 - ) - .setOrigin(0.5) - .setScrollFactor(0)), - this.add - .bitmapText( - this.center_width, - this.center_height - 20, - "default", - "YOU DID IT!!", - 40 - ) - .setOrigin(0.5), - this.add - .bitmapText( - this.center_width, - this.center_height + 40, - "default", - "Press space to restart", - 25 - ) - .setOrigin(0.5), - this.input.keyboard.on("keydown-ENTER", () => this.loadNext(), this), - this.input.keyboard.on("keydown-SPACE", () => this.loadNext(), this); - } - loadNext() { - this.scene.start("splash"); - } - showPlayer() { - (this.player = this.add - .sprite(this.center_width, this.center_height - 120, "player") - .setOrigin(0.5) - .setScale(3)), - this.anims.create({ - key: "playeridle", - frames: this.anims.generateFrameNumbers("player", { start: 0, end: 1 }), - frameRate: 5, - repeat: -1, - }), - this.player.anims.play("playeridle"); - } -} -class Splash extends Phaser.Scene { - constructor() { - super({ key: "splash" }); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - (this.backLayer = this.add.layer()), - this.cameras.main.setBackgroundColor(0), - this.showTitle(), - this.addPlayerAndFoe(), - this.addAnimationTweens(), - this.time.delayedCall(1e3, () => this.showInstructions(), null, this), - this.input.keyboard.on("keydown-SPACE", () => this.startGame(), this), - this.input.keyboard.on("keydown-ENTER", () => this.startGame(), this), - this.playMusic(); - } - startGame() { - this.theme && this.theme.stop(), this.scene.start("transition"); - } - showTitle() { - (this.textShadow1 = this.add - .bitmapText(this.center_width, 100, "default", "DUNGEON", 85) - .setTint(16742522) - .setOrigin(0.5)), - (this.textShadow2 = this.add - .bitmapText(this.center_width, 250, "default", "BOBBLE", 85) - .setTint(16742522) - .setOrigin(0.5)), - (this.text1 = this.add - .bitmapText(this.center_width, 100, "default", "DUNGEON", 85) - .setTint(3153968) - .setOrigin(0.5)), - (this.text2 = this.add - .bitmapText(this.center_width, 250, "default", "BOBBLE", 85) - .setTint(3153968) - .setOrigin(0.5)), - (this.text11 = this.add - .bitmapText(this.center_width, 100, "default", "DUNGEON", 88) - .setTint(43771) - .setOrigin(0.5)), - (this.text22 = this.add - .bitmapText(this.center_width, 250, "default", "BOBBLE", 88) - .setTint(43771) - .setOrigin(0.5)), - this.tweens.add({ - targets: [this.textShadow1, this.textShadow2], - duration: 1e3, - x: "+=10", - y: "+=10", - yoyo: !0, - repeat: -1, - }); - } - playMusic(t = "splash") { - (this.theme = this.sound.add(t)), - this.theme.stop(), - this.theme.play({ - mute: !1, - volume: 0.3, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }); - } - showInstructions() { - this.add - .bitmapText(this.center_width, 430, "default", "WASD/Arrows: move", 30) - .setDropShadow(1, 1, 16742522, 0.7) - .setOrigin(0.5), - this.add - .sprite(this.center_width - 60, 490, "pello") - .setOrigin(0.5) - .setScale(0.3), - this.add - .bitmapText(this.center_width + 40, 490, "default", "By PELLO", 15) - .setDropShadow(1, 1, 16742522, 0.7) - .setOrigin(0.5), - (this.space = this.add - .bitmapText( - this.center_width, - 550, - "default", - "Press SPACE to start", - 25 - ) - .setDropShadow(1, 1, 4007227, 0.7) - .setOrigin(0.5)), - this.tweens.add({ - targets: this.space, - duration: 300, - alpha: { from: 0, to: 1 }, - repeat: -1, - yoyo: !0, - }); - } - addPlayerAndFoe() { - (this.player = this.add - .sprite(this.width - 100, 350, "player") - .setScale(2)), - this.anims.create({ - key: "playeridle", - frames: this.anims.generateFrameNumbers("player", { start: 0, end: 3 }), - frameRate: 5, - repeat: -1, - }), - this.player.anims.play("playeridle"), - (this.foe = this.add.sprite(this.width, 350, "wizard").setScale(2)), - this.anims.create({ - key: "foe", - frames: this.anims.generateFrameNumbers("wizard", { start: 0, end: 4 }), - frameRate: 5, - repeat: -1, - }), - this.foe.anims.play("foe"); - } - addAnimationTweens() { - this.tweens.add({ - targets: [this.player], - x: { from: this.player.x, to: 0 }, - duration: 2500, - yoyo: !0, - repeat: -1, - onYoyo: () => { - this.player.flipX = !this.player.flipX; - }, - onRepeat: () => { - this.player.flipX = !this.player.flipX; - }, - }), - this.tweens.add({ - targets: [this.foe], - x: { from: this.foe.x, to: 100 }, - duration: 2500, - yoyo: !0, - repeat: -1, - onYoyo: () => { - this.foe.flipX = !this.foe.flipX; - }, - onRepeat: () => { - this.foe.flipX = !this.foe.flipX; - }, - }); - } -} -class Transition extends Phaser.Scene { - constructor() { - super({ key: "transition" }); - } - create() { - this.sound.stopAll(), - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.sound.add("start").play(), - this.playMusic(), - (this.key = this.add - .sprite(this.center_width, this.center_height - 120, "keys", 0) - .setOrigin(0.5) - .setScale(2)), - this.add - .bitmapText( - this.center_width, - this.center_height - 20, - "default", - "GET ALL KEYS", - 30 - ) - .setOrigin(0.5), - this.add - .bitmapText( - this.center_width, - this.center_height + 40, - "default", - "from all rooms!", - 25 - ) - .setOrigin(0.5), - this.input.keyboard.on("keydown-ENTER", () => this.loadNext(), this), - this.input.keyboard.on("keydown-SPACE", () => this.loadNext(), this), - this.time.delayedCall(1e3, () => this.loadNext(), null, this); - } - loadNext() { - this.scene.start("game"); - } - playMusic(t = "music") { - (this.theme = this.sound.add(t)), - this.theme.stop(), - this.theme.play({ - mute: !1, - volume: 0.2, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }); - } -} -class Bat extends Phaser.Physics.Matter.Sprite { - constructor(t, e, s, i = "bat", n) { - super(t.matter.world, e, s, i, 0), - (this.label = "bat"), - (this.scene = t), - this.scene.add.existing(this), - (this.startX = e), - (this.direction = Phaser.Math.RND.pick([-1, 1])), - this.setFixedRotation(), - this.setIgnoreGravity(!0), - this.addCollisions(), - this.init(); - } - init() { - this.scene.anims.create({ - key: this.label, - frames: this.scene.anims.generateFrameNumbers(this.label, { - start: 0, - end: 1, - }), - frameRate: 5, - repeat: -1, - }), - this.scene.anims.create({ - key: this.label + "death", - frames: this.scene.anims.generateFrameNumbers(this.label, { - start: 2, - end: 5, - }), - frameRate: 5, - }), - this.anims.play(this.label, !0), - this.on("animationcomplete", this.animationComplete, this), - this.setVelocityX(5 * this.direction), - this.scene.events.on("update", this.update, this); - } - addCollisions() { - this.unsubscribeBatCollide = this.scene.matterCollision.addOnCollideStart({ - objectA: this, - callback: this.onBatCollide, - context: this, - }); - } - onBatCollide({ gameObjectA: t, gameObjectB: e }) { - e instanceof Bubble && (e.load("bat"), this.destroy()); - } - update() { - this.active && Math.abs(this.body.velocity.x) <= 0.5 && this.turn(); - } - turn() { - (this.direction = -this.direction), - (this.flipX = this.direction > 0), - this.setFlipX(this.direction > 0), - this.setVelocityX(5 * this.direction); - } - death() { - (this.dead = !0), this.anims.play(this.label + "death"); - } - animationComplete(t, e) { - t.key === this.label + "death" && this.destroy(); - } -} -class Fireball extends Phaser.Physics.Matter.Sprite { - constructor(t, e, s, i) { - super(t.matter.world, e, s, "fireball", 0), - (this.label = "fireball"), - (this.scene = t), - (this.direction = i), - t.add.existing(this), - this.setIgnoreGravity(!0), - this.setVelocityX(5 * this.direction), - this.setVelocityY(Phaser.Math.Between(0, -8)), - this.setBounce(1), - this.init(); - } - init() { - this.scene.events.on("update", this.update, this), - (this.tween = this.scene.tweens.add({ - targets: this, - duration: 200, - scale: { from: 0.9, to: 1 }, - repeat: -1, - })), - this.scene.time.delayedCall( - 3e3, - () => { - this.destroy(); - }, - null, - this - ); - } - update() { - var t; - null == (t = this.scene) || t.gameOver; - } - destroy() { - this.tween.destroy(), super.destroy(); - } -} -class Wizard extends Phaser.Physics.Matter.Sprite { - constructor(t, e, s, i = "wizard", n) { - super(t.matter.world, e, s, i, 0), - (this.label = "wizard"), - this.scene.add.existing(this), - (this.startX = e), - (this.direction = Phaser.Math.RND.pick([-1, 1])), - this.setFixedRotation(), - this.addCollisions(), - this.init(); - } - init() { - this.scene.anims.create({ - key: this.label, - frames: this.scene.anims.generateFrameNumbers(this.label, { - start: 0, - end: 5, - }), - frameRate: 5, - repeat: -1, - }), - this.anims.play(this.label, !0), - this.scene.events.on("update", this.update, this), - (this.timer = this.scene.time.addEvent({ - delay: 3e3, - callback: this.directShot, - callbackScope: this, - loop: !0, - })); - } - addCollisions() { - this.unsubscribeBatCollide = this.scene.matterCollision.addOnCollideStart({ - objectA: this, - callback: this.onWizardCollide, - context: this, - }); - } - onWizardCollide({ gameObjectA: t, gameObjectB: e }) { - e instanceof Bubble && (e.load("wizard"), this.destroy()); - } - directShot() { - this.scene.playAudio("fireball"), - Phaser.Math.Distance.BetweenPoints(this.scene.player, this), - this.anims.play("wizardshot", !0), - new Fireball(this.scene, this.x, this.y, this.direction), - (this.delayedTurn = this.scene.time.delayedCall( - 1e3, - () => { - this.turn(); - }, - null, - this - )); - } - turn() { - (this.direction = -this.direction), - (this.flipX = this.direction > 0), - this.setFlipX(this.direction > 0), - this.setVelocityX(5 * this.direction); - } - destroy() { - this.timer && this.timer.destroy(), - this.delayedTurn && this.delayedTurn.destroy(), - this.fireball && this.fireball.destroy(), - super.destroy(); - } -} -class Bubble extends Phaser.Physics.Matter.Sprite { - constructor(t, e, s, i, n = { isStatic: !0 }) { - super(t.matter.world, e + i, s, "bubble", 0, n), - (this.offset = i), - this.setFriction(1, 0, 1 / 0), - (this.startX = e), - (this.startY = s), - (this.scene = t), - t.add.existing(this), - this.moveVertically(), - this.scene.events.on("update", this.update, this); - } - load(t) { - this.scene.playAudio("trap"), - (this.loaded = this.scene.add - .sprite(this.x, this.y, t) - .setOrigin(0.5) - .setScale(0.6)), - (this.loaded.name = t), - (this.loadedTween = this.scene.tweens.add({ - targets: this.loaded, - rotation: "+=5", - yoyo: !0, - repeat: -1, - })); - } - moveHorizontally() { - this.scene.tweens.add({ - targets: this, - scaleX: { from: 1, to: 0.9 }, - yoyo: !0, - repeat: -1, - duration: 200, - }), - this.scene.tweens.addCounter({ - from: 0, - to: Phaser.Math.Between(-400, 400), - duration: 3500, - ease: Phaser.Math.Easing.Sine.InOut, - onUpdate: (t, e) => { - const s = this.startX + e.value, - i = s - this.x; - (this.x = s), this.setVelocityX(i); - }, - onComplete: () => { - this.scene.time.delayedCall( - 1e3, - () => { - this.destroy(); - }, - null, - this - ); - }, - }); - } - moveVertically() { - (this.blob = this.scene.tweens.add({ - targets: this, - scaleX: { from: 1, to: 0.9 }, - yoyo: !0, - repeat: -1, - duration: 200, - })), - this.scene.tweens.addCounter({ - from: 0, - to: -300, - duration: 4500, - ease: Phaser.Math.Easing.Sine.InOut, - onUpdate: (t, e) => { - const s = this.startY + e.value, - i = s - this.y; - (this.y = s), this.setVelocityY(i); - }, - onComplete: () => { - this.blob.destroy(), - this.scene.time.delayedCall( - 1e3, - () => { - this.destroy(); - }, - null, - this - ); - }, - }); - } - respawn() { - this.loadedTween.destroy(), - "wizard" === this.loaded.name - ? new Wizard(this.scene, this.x, this.y) - : "bat" === this.loaded.name && new Bat(this.scene, this.x, this.y), - this.loaded.destroy(), - (this.loaded = null); - } - update() { - this.active && - this.loaded && - ((this.loaded.x = this.x), (this.loaded.y = this.y)); - } - destroy() { - this.scene && - (this.scene.playAudio("crash"), - this.loaded && this.respawn(), - super.destroy()); - } -} -class Dust extends Phaser.GameObjects.Sprite { - constructor(t, e, s, i = "dust", n = !1) { - super(t, e, s, i), - (this.scene = t), - (this.name = i), - this.setScale(0.5), - this.scene.add.existing(this), - this.init(n); - } - init(t) { - t && - this.scene.tweens.add({ - targets: this, - duration: Phaser.Math.Between(500, 1e3), - alpha: { from: 1, to: 0 }, - onComplete: () => { - this.destroy(); - }, - }), - this.scene.anims.create({ - key: this.name, - frames: this.scene.anims.generateFrameNumbers(this.name, { - start: 0, - end: 10, - }), - frameRate: 10, - }), - this.on("animationcomplete", this.animationComplete, this), - this.anims.play(this.name, !0); - } - animationComplete() { - this.destroy(); - } -} -class Player { - constructor(t, e, s) { - (this.scene = t), - (this.label = "player"), - (this.moveForce = 0.01), - (this.invincible = !0), - (this.isTouching = { left: !1, right: !1, ground: !1 }), - (this.canJump = !0), - (this.jumpCooldownTimer = null), - (this.canShoot = !0), - (this.shootCooldownTimer = null), - (this.onWall = !1), - this.init(e, s), - this.addControls(); - } - init(t, e) { - this.scene.matter.world.on("beforeupdate", this.resetTouching, this), - (this.sprite = this.scene.matter.add.sprite(0, 0, "player", 0)); - const { Body: s, Bodies: i } = Phaser.Physics.Matter.Matter, - { width: n, height: o } = this.sprite, - a = i.rectangle(0, 5, n - 14, o - 10, { chamfer: { radius: 10 } }); - this.sensors = { - bottom: i.rectangle(0, 0.5 * o, 0.25 * n, 2, { isSensor: !0 }), - left: i.rectangle(0.35 * -n, 0, 2, 0.5 * o, { isSensor: !0 }), - right: i.rectangle(0.35 * n, 0, 2, 0.5 * o, { isSensor: !0 }), - }; - const r = s.create({ - parts: [a, this.sensors.bottom, this.sensors.left, this.sensors.right], - frictionStatic: 0, - frictionAir: 0.02, - friction: 0.1, - render: { sprite: { xOffset: 0.5, yOffset: 0.5 } }, - }); - this.sprite.setExistingBody(r).setFixedRotation().setPosition(t, e), - this.addEvents(), - this.addColliders(), - this.addAnimations(), - this.initInvincible(); - } - addEvents() { - this.scene.events.on("update", this.update, this), - this.scene.events.once("shutdown", this.destroy, this), - this.scene.events.once("destroy", this.destroy, this); - } - addColliders() { - this.scene.matterCollision.addOnCollideStart({ - objectA: [this.sensors.bottom, this.sensors.left, this.sensors.right], - callback: this.onSensorCollide, - context: this, - }), - this.scene.matterCollision.addOnCollideActive({ - objectA: [this.sensors.bottom, this.sensors.left, this.sensors.right], - callback: this.onSensorCollide, - context: this, - }); - } - addAnimations() { - this.scene.anims.create({ - key: "playeridle", - frames: this.scene.anims.generateFrameNumbers(this.label, { - start: 0, - end: 1, - }), - frameRate: 5, - repeat: -1, - }), - this.scene.anims.create({ - key: "playerwalk", - frames: this.scene.anims.generateFrameNumbers(this.label, { - start: 0, - end: 3, - }), - frameRate: 6, - }), - this.scene.anims.create({ - key: "playershot", - frames: this.scene.anims.generateFrameNumbers(this.label, { - start: 4, - end: 5, - }), - frameRate: 4, - }), - this.sprite.anims.play("playeridle", !0), - this.sprite.on("animationcomplete", this.animationComplete, this); - } - initInvincible() { - this.scene.tweens.add({ - targets: this.sprite, - alpha: { from: 0.5, to: 1 }, - duration: 200, - repeat: 10, - onComplete: () => { - this.invincible = !1; - }, - }); - } - onSensorCollide({ bodyA: t, bodyB: e, pair: s }) { - e.isSensor || - (t === this.sensors.left - ? (this.friction(), - (this.onWall = !0), - (this.isTouching.left = !0), - s.separation > 0.5 && (this.sprite.x += s.separation - 0.5)) - : t === this.sensors.right - ? (this.friction(), - (this.onWall = !0), - (this.isTouching.right = !0), - s.separation > 0.5 && (this.sprite.x -= s.separation - 0.5)) - : t === this.sensors.bottom && - (this.land(), (this.isTouching.ground = !0))); - } - resetTouching() { - (this.isTouching.left = !1), - (this.isTouching.right = !1), - (this.isTouching.ground = !1); - } - addControls() { - (this.cursor = this.scene.input.keyboard.createCursorKeys()), - (this.W = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.W - )), - (this.A = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.A - )), - (this.S = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.S - )), - (this.D = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.D - )); - } - update() { - (this.isOnGround = this.isTouching.ground), - (this.isInAir = !this.isOnGround), - (this.moveForce = this.isOnGround ? 0.01 : 0.005), - this.D.isDown || this.cursor.right.isDown - ? (this.sprite.setFlipX(!0), - (this.isInAir && this.isTouching.right) || - (this.step(), - this.sprite.anims.play("playerwalk", !0), - this.sprite.setVelocityX(5))) - : this.A.isDown || this.cursor.left.isDown - ? (this.sprite.setFlipX(!1), - (this.isInAir && this.isTouching.left) || - (this.step(), - this.sprite.anims.play("playerwalk", !0), - this.sprite.setVelocityX(-5))) - : "playershot" !== this.sprite.anims.currentAnim.key && - this.sprite.anims.play("playeridle", !0), - this.sprite.body.velocity.x > 7 - ? this.sprite.setVelocityX(7) - : this.sprite.body.velocity.x < -7 && this.sprite.setVelocityX(-7), - this.checkJump(), - this.checkShoot(); - } - checkJump() { - ((this.canJump && this.isOnGround) || this.onWall) && - (this.W.isDown || this.cursor.up.isDown) && - (this.sprite.setVelocityY(-8), - this.scene.playAudio("jump"), - (this.canJump = !1), - (this.onWall = !1), - (this.jumpCooldownTimer = this.scene.time.addEvent({ - delay: 250, - callback: () => (this.canJump = !0), - }))); - } - checkShoot() { - if ( - this.canShoot && - (Phaser.Input.Keyboard.JustDown(this.cursor.down) || - Phaser.Input.Keyboard.JustDown(this.W)) - ) { - const t = this.sprite.flipX ? 128 : -128; - this.sprite.anims.play("playershot", !0), - this.scene.playAudio("bubble"), - (this.canShoot = !1), - new Bubble(this.scene, this.sprite.x, this.sprite.y, t), - (this.shootCooldownTimer = this.scene.time.addEvent({ - delay: 500, - callback: () => (this.canShoot = !0), - })); - } - } - destroy() { - this.scene.playAudio("death"), - (this.destroyed = !0), - this.scene.events.off("update", this.update, this), - this.scene.events.off("shutdown", this.destroy, this), - this.scene.events.off("destroy", this.destroy, this), - this.scene.matter.world && - this.scene.matter.world.off("beforeupdate", this.resetTouching, this); - const t = [this.sensors.bottom, this.sensors.left, this.sensors.right]; - this.scene.matterCollision.removeOnCollideStart({ objectA: t }), - this.scene.matterCollision.removeOnCollideActive({ objectA: t }), - this.jumpCooldownTimer && this.jumpCooldownTimer.destroy(), - this.sprite.destroy(); - } - step() { - Phaser.Math.Between(0, 5) > 4 && - this.scene.trailLayer.add( - new Dust( - this.scene, - this.sprite.x, - this.sprite.y + Phaser.Math.Between(10, 16) - ) - ); - } - friction() { - Array(Phaser.Math.Between(2, 4)) - .fill(0) - .forEach((t) => { - new Dust( - this.scene, - this.sprite.x + Phaser.Math.Between(-8, 8), - this.sprite.y + Phaser.Math.Between(-32, 32) - ); - }); - } - land() { - this.sprite.body.velocity.y < 1 || - Array(Phaser.Math.Between(3, 6)) - .fill(0) - .forEach((t) => { - new Dust( - this.scene, - this.sprite.x + Phaser.Math.Between(-32, 32), - this.sprite.y + Phaser.Math.Between(10, 16) - ); - }); - } - explosion() { - Array(Phaser.Math.Between(10, 15)) - .fill(0) - .forEach((t) => { - new Dust( - this.scene, - this.sprite.x + Phaser.Math.Between(-32, 32), - this.sprite.y + Phaser.Math.Between(20, 36) - ); - }); - } - animationComplete(t, e) { - "playershot" === t.key && this.sprite.anims.play("playeridle", !0); - } -} -var dungeon_min = { exports: {} }; -"undefined" != typeof self && self, - (dungeon_min.exports = (function () { - return ( - (s = {}), - (t.m = e = - [ - function (t, e) { - t.exports = function () { - throw new Error("define cannot be used indirect"); - }; - }, - function (t, e) { - t.exports = function (t) { - return ( - t.webpackPolyfill || - ((t.deprecate = function () {}), - (t.paths = []), - t.children || (t.children = []), - Object.defineProperty(t, "loaded", { - enumerable: !0, - get: function () { - return t.l; - }, - }), - Object.defineProperty(t, "id", { - enumerable: !0, - get: function () { - return t.i; - }, - }), - (t.webpackPolyfill = 1)), - t - ); - }; - }, - function (t, e) { - (function (e) { - t.exports = e; - }).call(this, {}); - }, - function (t, e, s) { - var i = s(4), - n = s(5), - o = s(6), - a = s(7), - r = s(8), - l = s(9), - h = s(10); - (h.alea = i), - (h.xor128 = n), - (h.xorwow = o), - (h.xorshift7 = a), - (h.xor4096 = r), - (h.tychei = l), - (t.exports = h); - }, - function (t, e, s) { - (function (t) { - var i; - !(function (t) { - function n(t) { - var e, - s = this, - i = - ((e = 4022871197), - function (t) { - t = String(t); - for (var s = 0; s < t.length; s++) { - var i = 0.02519603282416938 * (e += t.charCodeAt(s)); - (i -= e = i >>> 0), - (e = (i *= e) >>> 0), - (e += 4294967296 * (i -= e)); - } - return 2.3283064365386963e-10 * (e >>> 0); - }); - (s.next = function () { - var t = 2091639 * s.s0 + 2.3283064365386963e-10 * s.c; - return ( - (s.s0 = s.s1), (s.s1 = s.s2), (s.s2 = t - (s.c = 0 | t)) - ); - }), - (s.c = 1), - (s.s0 = i(" ")), - (s.s1 = i(" ")), - (s.s2 = i(" ")), - (s.s0 -= i(t)), - s.s0 < 0 && (s.s0 += 1), - (s.s1 -= i(t)), - s.s1 < 0 && (s.s1 += 1), - (s.s2 -= i(t)), - s.s2 < 0 && (s.s2 += 1), - (i = null); - } - function o(t, e) { - return ( - (e.c = t.c), (e.s0 = t.s0), (e.s1 = t.s1), (e.s2 = t.s2), e - ); - } - function a(t, e) { - var s = new n(t), - i = e && e.state, - a = s.next; - return ( - (a.int32 = function () { - return (4294967296 * s.next()) | 0; - }), - (a.double = function () { - return ( - a() + 11102230246251565e-32 * ((2097152 * a()) | 0) - ); - }), - (a.quick = a), - i && - ("object" == typeof i && o(i, s), - (a.state = function () { - return o(s, {}); - })), - a - ); - } - t && t.exports - ? (t.exports = a) - : s(0) && s(2) - ? void 0 === - (i = function () { - return a; - }.call(e, s, e, t)) || (t.exports = i) - : (this.alea = a); - })(t, s(0)); - }).call(this, s(1)(t)); - }, - function (t, e, s) { - (function (t) { - var i; - !(function (t) { - function n(t) { - var e = this, - s = ""; - (e.x = 0), - (e.y = 0), - (e.z = 0), - (e.w = 0), - (e.next = function () { - var t = e.x ^ (e.x << 11); - return ( - (e.x = e.y), - (e.y = e.z), - (e.z = e.w), - (e.w ^= (e.w >>> 19) ^ t ^ (t >>> 8)) - ); - }), - t === (0 | t) ? (e.x = t) : (s += t); - for (var i = 0; i < s.length + 64; i++) - (e.x ^= 0 | s.charCodeAt(i)), e.next(); - } - function o(t, e) { - return (e.x = t.x), (e.y = t.y), (e.z = t.z), (e.w = t.w), e; - } - function a(t, e) { - function s() { - return (i.next() >>> 0) / 4294967296; - } - var i = new n(t), - a = e && e.state; - return ( - (s.double = function () { - do { - var t = - ((i.next() >>> 11) + (i.next() >>> 0) / 4294967296) / - (1 << 21); - } while (0 === t); - return t; - }), - (s.int32 = i.next), - (s.quick = s), - a && - ("object" == typeof a && o(a, i), - (s.state = function () { - return o(i, {}); - })), - s - ); - } - t && t.exports - ? (t.exports = a) - : s(0) && s(2) - ? void 0 === - (i = function () { - return a; - }.call(e, s, e, t)) || (t.exports = i) - : (this.xor128 = a); - })(t, s(0)); - }).call(this, s(1)(t)); - }, - function (t, e, s) { - (function (t) { - var i; - !(function (t) { - function n(t) { - var e = this, - s = ""; - (e.next = function () { - var t = e.x ^ (e.x >>> 2); - return ( - (e.x = e.y), - (e.y = e.z), - (e.z = e.w), - (e.w = e.v), - ((e.d = (e.d + 362437) | 0) + - (e.v = e.v ^ (e.v << 4) ^ t ^ (t << 1))) | - 0 - ); - }), - (e.x = 0), - (e.y = 0), - (e.z = 0), - (e.w = 0), - t === ((e.v = 0) | t) ? (e.x = t) : (s += t); - for (var i = 0; i < s.length + 64; i++) - (e.x ^= 0 | s.charCodeAt(i)), - i == s.length && (e.d = (e.x << 10) ^ (e.x >>> 4)), - e.next(); - } - function o(t, e) { - return ( - (e.x = t.x), - (e.y = t.y), - (e.z = t.z), - (e.w = t.w), - (e.v = t.v), - (e.d = t.d), - e - ); - } - function a(t, e) { - function s() { - return (i.next() >>> 0) / 4294967296; - } - var i = new n(t), - a = e && e.state; - return ( - (s.double = function () { - do { - var t = - ((i.next() >>> 11) + (i.next() >>> 0) / 4294967296) / - (1 << 21); - } while (0 === t); - return t; - }), - (s.int32 = i.next), - (s.quick = s), - a && - ("object" == typeof a && o(a, i), - (s.state = function () { - return o(i, {}); - })), - s - ); - } - t && t.exports - ? (t.exports = a) - : s(0) && s(2) - ? void 0 === - (i = function () { - return a; - }.call(e, s, e, t)) || (t.exports = i) - : (this.xorwow = a); - })(t, s(0)); - }).call(this, s(1)(t)); - }, - function (t, e, s) { - (function (t) { - var i; - !(function (t) { - function n(t) { - var e = this; - (e.next = function () { - var t, - s, - i = e.x, - n = e.i; - return ( - (t = i[n]), - (s = (t ^= t >>> 7) ^ (t << 24)), - (s ^= (t = i[(n + 1) & 7]) ^ (t >>> 10)), - (s ^= (t = i[(n + 3) & 7]) ^ (t >>> 3)), - (s ^= (t = i[(n + 4) & 7]) ^ (t << 7)), - (t = i[(n + 7) & 7]), - (s ^= (t ^= t << 13) ^ (t << 9)), - (i[n] = s), - (e.i = (n + 1) & 7), - s - ); - }), - (function (t, e) { - var s, - i = []; - if (e === (0 | e)) i[0] = e; - else - for (e = "" + e, s = 0; s < e.length; ++s) - i[7 & s] = - (i[7 & s] << 15) ^ - ((e.charCodeAt(s) + i[(s + 1) & 7]) << 13); - for (; i.length < 8; ) i.push(0); - for (s = 0; s < 8 && 0 === i[s]; ++s); - for ( - 8 == s ? (i[7] = -1) : i[s], t.x = i, t.i = 0, s = 256; - 0 < s; - --s - ) - t.next(); - })(e, t); - } - function o(t, e) { - return (e.x = t.x.slice()), (e.i = t.i), e; - } - function a(t, e) { - function s() { - return (i.next() >>> 0) / 4294967296; - } - null == t && (t = +new Date()); - var i = new n(t), - a = e && e.state; - return ( - (s.double = function () { - do { - var t = - ((i.next() >>> 11) + (i.next() >>> 0) / 4294967296) / - (1 << 21); - } while (0 === t); - return t; - }), - (s.int32 = i.next), - (s.quick = s), - a && - (a.x && o(a, i), - (s.state = function () { - return o(i, {}); - })), - s - ); - } - t && t.exports - ? (t.exports = a) - : s(0) && s(2) - ? void 0 === - (i = function () { - return a; - }.call(e, s, e, t)) || (t.exports = i) - : (this.xorshift7 = a); - })(t, s(0)); - }).call(this, s(1)(t)); - }, - function (t, e, s) { - (function (t) { - var i; - !(function (t) { - function n(t) { - var e = this; - (e.next = function () { - var t, - s, - i = e.w, - n = e.X, - o = e.i; - return ( - (e.w = i = (i + 1640531527) | 0), - (s = n[(o + 34) & 127]), - (t = n[(o = (o + 1) & 127)]), - (s ^= s << 13), - (t ^= t << 17), - (s ^= s >>> 15), - (t ^= t >>> 12), - (s = n[o] = s ^ t), - (e.i = o), - (s + (i ^ (i >>> 16))) | 0 - ); - }), - (function (t, e) { - var s, - i, - n, - o, - a, - r = [], - l = 128; - for ( - e === (0 | e) - ? ((i = e), (e = null)) - : ((e += "\0"), (i = 0), (l = Math.max(l, e.length))), - n = 0, - o = -32; - o < l; - ++o - ) - e && (i ^= e.charCodeAt((o + 32) % e.length)), - 0 === o && (a = i), - (i ^= i << 10), - (i ^= i >>> 15), - (i ^= i << 4), - (i ^= i >>> 13), - 0 <= o && - ((a = (a + 1640531527) | 0), - (n = 0 == (s = r[127 & o] ^= i + a) ? n + 1 : 0)); - for ( - 128 <= n && (r[127 & ((e && e.length) || 0)] = -1), - n = 127, - o = 512; - 0 < o; - --o - ) - (i = r[(n + 34) & 127]), - (s = r[(n = (n + 1) & 127)]), - (i ^= i << 13), - (s ^= s << 17), - (i ^= i >>> 15), - (s ^= s >>> 12), - (r[n] = i ^ s); - (t.w = a), (t.X = r), (t.i = n); - })(e, t); - } - function o(t, e) { - return (e.i = t.i), (e.w = t.w), (e.X = t.X.slice()), e; - } - function a(t, e) { - function s() { - return (i.next() >>> 0) / 4294967296; - } - null == t && (t = +new Date()); - var i = new n(t), - a = e && e.state; - return ( - (s.double = function () { - do { - var t = - ((i.next() >>> 11) + (i.next() >>> 0) / 4294967296) / - (1 << 21); - } while (0 === t); - return t; - }), - (s.int32 = i.next), - (s.quick = s), - a && - (a.X && o(a, i), - (s.state = function () { - return o(i, {}); - })), - s - ); - } - t && t.exports - ? (t.exports = a) - : s(0) && s(2) - ? void 0 === - (i = function () { - return a; - }.call(e, s, e, t)) || (t.exports = i) - : (this.xor4096 = a); - })(t, s(0)); - }).call(this, s(1)(t)); - }, - function (t, e, s) { - (function (t) { - var i; - !(function (t) { - function n(t) { - var e = this, - s = ""; - (e.next = function () { - var t = e.b, - s = e.c, - i = e.d, - n = e.a; - return ( - (t = (t << 25) ^ (t >>> 7) ^ s), - (s = (s - i) | 0), - (i = (i << 24) ^ (i >>> 8) ^ n), - (n = (n - t) | 0), - (e.b = t = (t << 20) ^ (t >>> 12) ^ s), - (e.c = s = (s - i) | 0), - (e.d = (i << 16) ^ (s >>> 16) ^ n), - (e.a = (n - t) | 0) - ); - }), - (e.a = 0), - (e.b = 0), - (e.c = -1640531527), - (e.d = 1367130551), - t === Math.floor(t) - ? ((e.a = (t / 4294967296) | 0), (e.b = 0 | t)) - : (s += t); - for (var i = 0; i < s.length + 20; i++) - (e.b ^= 0 | s.charCodeAt(i)), e.next(); - } - function o(t, e) { - return (e.a = t.a), (e.b = t.b), (e.c = t.c), (e.d = t.d), e; - } - function a(t, e) { - function s() { - return (i.next() >>> 0) / 4294967296; - } - var i = new n(t), - a = e && e.state; - return ( - (s.double = function () { - do { - var t = - ((i.next() >>> 11) + (i.next() >>> 0) / 4294967296) / - (1 << 21); - } while (0 === t); - return t; - }), - (s.int32 = i.next), - (s.quick = s), - a && - ("object" == typeof a && o(a, i), - (s.state = function () { - return o(i, {}); - })), - s - ); - } - t && t.exports - ? (t.exports = a) - : s(0) && s(2) - ? void 0 === - (i = function () { - return a; - }.call(e, s, e, t)) || (t.exports = i) - : (this.tychei = a); - })(t, s(0)); - }).call(this, s(1)(t)); - }, - function (t, e, s) { - var i; - !(function (n, o, a) { - var r, - l = 256, - h = a.pow(l, 6), - d = a.pow(2, 52), - c = 2 * d, - Q = l - 1; - function B(t, e, s) { - function i() { - for (var t = u.g(6), e = h, s = 0; t < d; ) - (t = (t + s) * l), (e *= l), (s = u.g(1)); - for (; c <= t; ) (t /= 2), (e /= 2), (s >>>= 1); - return (t + s) / e; - } - var Q = [], - B = b( - (function t(e, s) { - var i, - n = [], - o = typeof e; - if (s && "object" == o) - for (i in e) - try { - n.push(t(e[i], s - 1)); - } catch (a) {} - return n.length ? n : "string" == o ? e : e + "\0"; - })( - (e = 1 == e ? { entropy: !0 } : e || {}).entropy - ? [t, g(o)] - : null == t - ? (function () { - try { - var t; - return ( - r && (t = r.randomBytes) - ? (t = t(l)) - : ((t = new Uint8Array(l)), - (n.crypto || n.msCrypto).getRandomValues( - t - )), - g(t) - ); - } catch (i) { - var e = n.navigator, - s = e && e.plugins; - return [+new Date(), n, s, n.screen, g(o)]; - } - })() - : t, - 3 - ), - Q - ), - u = new F(Q); - return ( - (i.int32 = function () { - return 0 | u.g(4); - }), - (i.quick = function () { - return u.g(4) / 4294967296; - }), - (i.double = i), - b(g(u.S), o), - ( - e.pass || - s || - function (t, e, s, i) { - return ( - i && - (i.S && U(i, u), - (t.state = function () { - return U(u, {}); - })), - s ? ((a.random = t), e) : t - ); - } - )(i, B, "global" in e ? e.global : this == a, e.state) - ); - } - function F(t) { - var e, - s = t.length, - i = this, - n = 0, - o = (i.i = i.j = 0), - a = (i.S = []); - for (s || (t = [s++]); n < l; ) a[n] = n++; - for (n = 0; n < l; n++) - (a[n] = a[(o = Q & (o + t[n % s] + (e = a[n])))]), (a[o] = e); - (i.g = function (t) { - for (var e, s = 0, n = i.i, o = i.j, a = i.S; t--; ) - (e = a[(n = Q & (n + 1))]), - (s = - s * l + - a[Q & ((a[n] = a[(o = Q & (o + e))]) + (a[o] = e))]); - return (i.i = n), (i.j = o), s; - })(l); - } - function U(t, e) { - return (e.i = t.i), (e.j = t.j), (e.S = t.S.slice()), e; - } - function b(t, e) { - for (var s, i = t + "", n = 0; n < i.length; ) - e[Q & n] = Q & ((s ^= 19 * e[Q & n]) + i.charCodeAt(n++)); - return g(e); - } - function g(t) { - return String.fromCharCode.apply(0, t); - } - if ((b(a.random(), o), t.exports)) { - t.exports = B; - try { - r = s(11); - } catch (u) {} - } else - void 0 === - (i = function () { - return B; - }.call(e, s, e, t)) || (t.exports = i); - })("undefined" != typeof self ? self : this, [], Math); - }, - function (t, e) {}, - function (t, e, s) { - s.r(e); - var i = s(3); - function n(t) { - this.rng = i(t); - } - var o, - a, - r = - ((n.prototype.randomInteger = function (t, e, s) { - var i = void 0 === s ? {} : s, - n = i.onlyOdd, - o = void 0 !== n && n, - a = i.onlyEven, - r = void 0 !== a && a; - return o - ? this.randomOddInteger(t, e) - : r - ? this.randomEvenInteger(t, e) - : Math.floor(this.rng() * (e - t + 1) + t); - }), - (n.prototype.randomEvenInteger = function (t, e) { - t % 2 != 0 && t < e && t++, e % 2 != 0 && t < e && e--; - var s = (e - t) / 2; - return 2 * Math.floor(this.rng() * (1 + s)) + t; - }), - (n.prototype.randomOddInteger = function (t, e) { - t % 2 == 0 && t++, e % 2 == 0 && e--; - var s = (e - t) / 2; - return 2 * Math.floor(this.rng() * (1 + s)) + t; - }), - (n.prototype.randomPick = function (t) { - return t[this.randomInteger(0, t.length - 1)]; - }), - n); - ((a = o = o || {})[(a.EMPTY = 0)] = "EMPTY"), - (a[(a.WALL = 1)] = "WALL"), - (a[(a.FLOOR = 2)] = "FLOOR"), - (a[(a.DOOR = 3)] = "DOOR"); - var l = o, - h = function () { - for (var t = 0, e = 0, s = arguments.length; e < s; e++) - t += arguments[e].length; - var i = Array(t), - n = 0; - for (e = 0; e < s; e++) - for ( - var o = arguments[e], a = 0, r = o.length; - a < r; - a++, n++ - ) - i[n] = o[a]; - return i; - }; - function d(t, e, s) { - return h(Array(e)).map(function () { - return Array(t).fill(s); - }); - } - function c(t, e) { - (this.width = t), - (this.height = e), - (this.x = 0), - (this.y = 0), - (this.left = 0), - (this.right = 0), - (this.top = 0), - (this.bottom = 0), - (this.centerX = 0), - (this.centerY = 0), - (this.width = t), - (this.height = e), - this.setPosition(0, 0), - (this.tiles = d(t, e, l.FLOOR)); - for (var s = 0; s < this.height; s++) - this.setTileAt(0, s, l.WALL), this.setTileAt(t - 1, s, l.WALL); - for (var i = 0; i < this.width; i++) - this.setTileAt(i, 0, l.WALL), this.setTileAt(i, e - 1, l.WALL); - } - var Q = - ((c.prototype.forEachTile = function (t) { - for (var e = 0; e < this.height; e++) - for (var s = 0; s < this.width; s++) - t({ x: s, y: e }, this.getTileAt(s, e)); - }), - (c.prototype.setPosition = function (t, e) { - (this.x = t), - (this.y = e), - (this.left = t), - (this.right = t + (this.width - 1)), - (this.top = e), - (this.bottom = e + (this.height - 1)), - (this.centerX = t + Math.floor(this.width / 2)), - (this.centerY = e + Math.floor(this.height / 2)); - }), - (c.prototype.getDoorLocations = function () { - for (var t = [], e = 0; e < this.height; e++) - for (var s = 0; s < this.width; s++) - this.getTileAt(s, e) == l.DOOR && t.push({ x: s, y: e }); - return t; - }), - (c.prototype.overlaps = function (t) { - return !( - this.right < t.left || - this.left > t.right || - this.bottom < t.top || - this.top > t.bottom - ); - }), - (c.prototype.isInBounds = function (t, e) { - return ( - 0 <= t && - t < this.width - 1 && - 0 <= e && - e < this.height - 1 - ); - }), - (c.prototype.getTileAt = function (t, e) { - return this.tiles[e][t]; - }), - (c.prototype.setTileAt = function (t, e, s) { - this.tiles[e][t] = s; - }), - (c.prototype.isConnectedTo = function (t) { - for ( - var e = 0, s = this.getDoorLocations(); - e < s.length; - e++ - ) { - var i = s[e], - n = this.x + i.x - t.x, - o = this.y + i.y - t.y; - if (t.isInBounds(n, o) && t.getTileAt(n, o) === l.DOOR) - return !0; - } - return !1; - }), - c), - B = function (t) { - return Object.entries(t) - .map(function (t) { - return t[0] + '="' + t[1] + '"'; - }) - .join(" "); - }; - function F(t) { - return Number.isInteger(t) && t % 2 == 0; - } - function U(t) { - return Number.isInteger(t) && t % 2 != 0; - } - function b(t) { - var e, s, i, n, o, a, l; - (this.rooms = []), - (this.roomGrid = []), - (this.width = t.width), - (this.height = t.height), - (this.doorPadding = - null !== (e = t.doorPadding) && void 0 !== e ? e : 1), - (this.rooms = []), - (this.randomSeed = t.randomSeed), - (this.r = new r(this.randomSeed)); - var h = t.rooms, - d = h.width, - c = h.height, - Q = d.max * c.max, - B = d.min * c.min, - F = Math.floor((this.width * this.height) / B); - if ( - ((this.roomWidthConfig = { - min: d.min, - max: d.max, - onlyOdd: null !== (s = d.onlyOdd) && void 0 !== s && s, - onlyEven: null !== (i = d.onlyEven) && void 0 !== i && i, - }), - (this.roomHeightConfig = { - min: c.min, - max: c.max, - onlyOdd: null !== (n = c.onlyOdd) && void 0 !== n && n, - onlyEven: null !== (o = c.onlyEven) && void 0 !== o && o, - }), - (this.maxRooms = - null !== (a = h.maxRooms) && void 0 !== a ? a : F), - (this.maxRoomArea = - null !== (l = h.maxArea) && void 0 !== l ? l : Q), - this.adjustDimensionConfigForParity(this.roomWidthConfig), - this.adjustDimensionConfigForParity(this.roomHeightConfig), - this.checkDimensionConfig(this.roomWidthConfig), - this.checkDimensionConfig(this.roomHeightConfig), - this.roomWidthConfig.max > this.width) - ) - throw new Error("Room max width cannot exceed dungeon width."); - if (this.roomHeightConfig.max > this.height) - throw new Error( - "Room max height cannot exceed dungeon height." - ); - if (this.maxRoomArea < B) - throw new Error( - "The minimum dimensions specified exceeds the given maxArea." - ); - this.generate(), (this.tiles = this.getTiles()); - } - var g = - ((b.prototype.adjustDimensionConfigForParity = function (t) { - t.onlyOdd - ? (F(t.min) && - (t.min++, - console.log( - "Dungeon: warning, min dimension adjusted to match onlyOdd setting." - )), - F(t.max) && - (t.max--, - console.log( - "Dungeon: warning, max dimension adjusted to match onlyOdd setting." - ))) - : t.onlyEven && - (U(t.min) && - (t.min++, - console.log( - "Dungeon: warning, min dimension adjusted to match onlyEven setting." - )), - U(t.max) && - (t.max--, - console.log( - "Dungeon: warning, max dimension adjusted to match onlyEven setting." - ))); - }), - (b.prototype.checkDimensionConfig = function (t) { - var e = t.max, - s = t.min, - i = t.onlyEven, - n = t.onlyOdd; - if (i && n) - throw new Error( - "Cannot use both onlyEven and onlyOdd in room's width/height config." - ); - if (e < s) - throw new Error("Room width and height max must be >= min."); - if (s < 3) - throw new Error("Room width and height must be >= 3."); - }), - (b.prototype.getConfig = function () { - return { - width: this.width, - height: this.height, - doorPadding: this.doorPadding, - randomSeed: this.randomSeed, - rooms: { - width: this.roomWidthConfig, - height: this.roomHeightConfig, - maxArea: this.maxRoomArea, - maxRooms: this.maxRooms, - }, - }; - }), - (b.prototype.drawToConsole = function (t) { - !(function (t, e) { - void 0 === e && (e = {}); - var s = Object.assign( - {}, - { - empty: " ", - emptyColor: "rgb(0, 0, 0)", - wall: "#", - wallColor: "rgb(255, 0, 0)", - floor: "_", - floorColor: "rgb(210, 210, 210)", - door: ".", - doorColor: "rgb(0, 0, 255)", - fontSize: "15px", - }, - e - ), - i = "", - n = []; - (i += - "Dungeon: the console window should be big enough to see all of the guide on the next line:\n"), - (i += "%c|" + "=".repeat(2 * t.width - 2) + "|\n\n"), - n.push("font-size: " + s.fontSize); - for (var o = 0; o < t.height; o += 1) { - for (var a = 0; a < t.width; a += 1) { - var r = t.tiles[o][a]; - r === l.EMPTY - ? ((i += "%c" + s.empty), - n.push( - "color: " + - s.emptyColor + - "; font-size: " + - s.fontSize - )) - : r === l.WALL - ? ((i += "%c" + s.wall), - n.push( - "color: " + - s.wallColor + - "; font-size: " + - s.fontSize - )) - : r === l.FLOOR - ? ((i += "%c" + s.floor), - n.push( - "color: " + - s.floorColor + - "; font-size: " + - s.fontSize - )) - : r === l.DOOR && - ((i += "%c" + s.door), - n.push( - "color: " + - s.doorColor + - "; font-size: " + - s.fontSize - )), - (i += " "); - } - i += "\n"; - } - console.log.apply( - console, - (function () { - for (var t = 0, e = 0, s = arguments.length; e < s; e++) - t += arguments[e].length; - var i = Array(t), - n = 0; - for (e = 0; e < s; e++) - for ( - var o = arguments[e], a = 0, r = o.length; - a < r; - a++, n++ - ) - i[n] = o[a]; - return i; - })([i], n) - ); - })(this, t); - }), - (b.prototype.drawToHtml = function (t) { - return (function (t, e) { - void 0 === e && (e = {}); - var s = (function (t, e) { - void 0 === e && (e = {}); - var s = Object.assign( - {}, - { - empty: " ", - emptyAttributes: { class: "dungeon__empty" }, - wall: "#", - wallAttributes: { class: "dungeon__wall" }, - floor: "_", - floorAttributes: { class: "dungeon__wall" }, - door: ".", - doorAttributes: { class: "dungeon__door" }, - containerAttributes: { class: "dungeon" }, - }, - e - ), - i = t - .getMappedTiles({ - empty: - "" + - s.empty + - "", - floor: - "" + - s.floor + - "", - door: - "" + - s.door + - "", - wall: - "" + - s.wall + - "", - }) - .map(function (t) { - return "" + t.join("") + ""; - }) - .join(""); - return ( - "
" +
-                      i +
-                      "
" - ); - })(t, e); - return document.createRange().createContextualFragment(s); - })(this, t); - }), - (b.prototype.getMappedTiles = function (t) { - return ( - void 0 === t && (t = {}), - (t = Object.assign( - {}, - { empty: 0, wall: 1, floor: 2, door: 3 }, - t - )), - this.tiles.map(function (e) { - return e.map(function (e) { - return e === l.EMPTY - ? t.empty - : e === l.WALL - ? t.wall - : e === l.FLOOR - ? t.floor - : e === l.DOOR - ? t.door - : void 0; - }); - }) - ); - }), - (b.prototype.getCenter = function () { - return { - x: Math.floor(this.width / 2), - y: Math.floor(this.height / 2), - }; - }), - (b.prototype.generate = function () { - (this.rooms = []), (this.roomGrid = []); - for (var t = 0; t < this.height; t++) { - this.roomGrid.push([]); - for (var e = 0; e < this.width; e++) - this.roomGrid[t].push([]); - } - var s = this.getCenter(), - i = this.createRandomRoom(); - i.setPosition( - s.x - Math.floor(i.width / 2), - s.y - Math.floor(i.height / 2) - ), - this.addRoom(i); - for ( - var n = 0, o = 5 * this.maxRooms; - this.rooms.length < this.maxRooms && n < o; - - ) - this.generateRoom(), n++; - }), - (b.prototype.hasRoomAt = function (t, e) { - return ( - t < 0 || - e < 0 || - t >= this.width || - e >= this.height || - 0 < this.roomGrid[e][t].length - ); - }), - (b.prototype.getRoomAt = function (t, e) { - return this.hasRoomAt(t, e) ? this.roomGrid[e][t][0] : null; - }), - (b.prototype.addRoom = function (t) { - if (!this.canFitRoom(t)) return !1; - this.rooms.push(t); - for (var e = t.top; e <= t.bottom; e++) - for (var s = t.left; s <= t.right; s++) - this.roomGrid[e][s].push(t); - return !0; - }), - (b.prototype.canFitRoom = function (t) { - if (t.x < 0 || t.right > this.width - 1) return !1; - if (t.y < 0 || t.bottom > this.height - 1) return !1; - for (var e = 0; e < this.rooms.length; e++) - if (t.overlaps(this.rooms[e])) return !1; - return !0; - }), - (b.prototype.createRandomRoom = function () { - for ( - var t = 0, - e = 0, - s = this.roomWidthConfig, - i = this.roomHeightConfig; - (t = this.r.randomInteger(s.min, s.max, { - onlyEven: s.onlyEven, - onlyOdd: s.onlyOdd, - })) * - (e = this.r.randomInteger(i.min, i.max, { - onlyEven: i.onlyEven, - onlyOdd: i.onlyOdd, - })) > - this.maxRoomArea; - - ); - return new Q(t, e); - }), - (b.prototype.generateRoom = function () { - for (var t = this.createRandomRoom(), e = 150; 0 < e; ) { - var s = this.findRoomAttachment(t); - if ((t.setPosition(s.x, s.y), this.addRoom(t))) { - var i = this.findNewDoorLocation(t, s.target), - n = i[0], - o = i[1]; - this.addDoor(n), this.addDoor(o); - break; - } - --e; - } - }), - (b.prototype.getTiles = function () { - var t = d(this.width, this.height, l.EMPTY); - return ( - this.rooms.forEach(function (e) { - e.forEachTile(function (s, i) { - t[e.y + s.y][e.x + s.x] = i; - }); - }), - t - ); - }), - (b.prototype.getPotentiallyTouchingRooms = function (t) { - for ( - var e = this, - s = [], - i = function (i, n) { - for (var o = e.roomGrid[n][i], a = 0; a < o.length; a++) - if (o[a] != t && -1 === s.indexOf(o[a])) { - var r = i - o[a].x, - l = n - o[a].y; - ((0 < r && r < o[a].width - 1) || - (0 < l && l < o[a].height - 1)) && - s.push(o[a]); - } - }, - n = t.x + 1; - n < t.x + t.width - 1; - n++ - ) - i(n, t.y), i(n, t.y + t.height - 1); - for (var o = t.y + 1; o < t.y + t.height - 1; o++) - i(t.x, o), i(t.x + t.width - 1, o); - return s; - }), - (b.prototype.findNewDoorLocation = function (t, e) { - var s = { x: -1, y: -1 }, - i = { x: -1, y: -1 }; - return ( - t.y === e.y - t.height - ? ((s.x = i.x = - this.r.randomInteger( - Math.floor( - Math.max(e.left, t.left) + this.doorPadding - ), - Math.floor( - Math.min(e.right, t.right) - this.doorPadding - ) - )), - (s.y = t.y + t.height - 1), - (i.y = e.y)) - : t.x == e.x - t.width - ? ((s.x = t.x + t.width - 1), - (i.x = e.x), - (s.y = i.y = - this.r.randomInteger( - Math.floor( - Math.max(e.top, t.top) + this.doorPadding - ), - Math.floor( - Math.min(e.bottom, t.bottom) - this.doorPadding - ) - ))) - : t.x == e.x + e.width - ? ((s.x = t.x), - (i.x = e.x + e.width - 1), - (s.y = i.y = - this.r.randomInteger( - Math.floor( - Math.max(e.top, t.top) + this.doorPadding - ), - Math.floor( - Math.min(e.bottom, t.bottom) - this.doorPadding - ) - ))) - : t.y == e.y + e.height && - ((s.x = i.x = - this.r.randomInteger( - Math.floor( - Math.max(e.left, t.left) + this.doorPadding - ), - Math.floor( - Math.min(e.right, t.right) - this.doorPadding - ) - )), - (s.y = t.y), - (i.y = e.y + e.height - 1)), - [s, i] - ); - }), - (b.prototype.findRoomAttachment = function (t) { - var e = this.r.randomPick(this.rooms), - s = 0, - i = 0, - n = 2 * this.doorPadding; - switch (this.r.randomInteger(0, 3)) { - case 0: - (s = this.r.randomInteger( - e.left - (t.width - 1) + n, - e.right - n - )), - (i = e.top - t.height); - break; - case 1: - (s = e.left - t.width), - (i = this.r.randomInteger( - e.top - (t.height - 1) + n, - e.bottom - n - )); - break; - case 2: - (s = e.right + 1), - (i = this.r.randomInteger( - e.top - (t.height - 1) + n, - e.bottom - n - )); - break; - case 3: - (s = this.r.randomInteger( - e.left - (t.width - 1) + n, - e.right - n - )), - (i = e.bottom + 1); - } - return { x: s, y: i, target: e }; - }), - (b.prototype.addDoor = function (t) { - this.roomGrid[t.y][t.x].forEach(function (e) { - e.setTileAt(t.x - e.x, t.y - e.y, l.DOOR); - }); - }), - b); - s.d(e, "Room", function () { - return Q; - }), - s.d(e, "TILES", function () { - return l; - }), - (e.default = g); - }, - ]), - (t.c = s), - (t.d = function (e, s, i) { - t.o(e, s) || Object.defineProperty(e, s, { enumerable: !0, get: i }); - }), - (t.r = function (t) { - "undefined" != typeof Symbol && - Symbol.toStringTag && - Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), - Object.defineProperty(t, "__esModule", { value: !0 }); - }), - (t.t = function (e, s) { - if ((1 & s && (e = t(e)), 8 & s)) return e; - if (4 & s && "object" == typeof e && e && e.__esModule) return e; - var i = Object.create(null); - if ( - (t.r(i), - Object.defineProperty(i, "default", { enumerable: !0, value: e }), - 2 & s && "string" != typeof e) - ) - for (var n in e) - t.d( - i, - n, - function (t) { - return e[t]; - }.bind(null, n) - ); - return i; - }), - (t.n = function (e) { - var s = - e && e.__esModule - ? function () { - return e.default; - } - : function () { - return e; - }; - return t.d(s, "a", s), s; - }), - (t.o = function (t, e) { - return Object.prototype.hasOwnProperty.call(t, e); - }), - (t.p = ""), - t((t.s = 12)).default - ); - function t(i) { - if (s[i]) return s[i].exports; - var n = (s[i] = { i: i, l: !1, exports: {} }); - return e[i].call(n.exports, n, n.exports, t), (n.l = !0), n.exports; - } - var e, s; - })()); -var dungeon_minExports = dungeon_min.exports; -const Dungeon = getDefaultExportFromCjs(dungeon_minExports); -class Coin extends Phaser.Physics.Matter.Sprite { - constructor(t, e, s, i = "coin", n = { isStatic: !0 }) { - super(t.matter.world, e, s, i, 0, n), - (this.scene = t), - (this.label = "coin"), - t.add.existing(this), - this.init(); - } - init() { - this.scene.anims.create({ - key: this.label, - frames: this.scene.anims.generateFrameNumbers(this.label, { - start: 0, - end: 3, - }), - frameRate: 10, - repeat: -1, - }), - this.anims.play(this.label, !0), - (this.tween = this.scene.tweens.add({ - targets: this, - duration: 300, - y: "-=5", - repeat: -1, - yoyo: !0, - })); - } - destroy() { - this.tween.stop(), super.destroy(); - } -} -class key extends Phaser.Physics.Matter.Sprite { - constructor(t, e, s, i = "keys", n = { isStatic: !0 }) { - super(t.matter.world, e, s, i, Phaser.Math.RND.pick([0, 1]), n), - (this.scene = t), - (this.label = "keys"), - t.add.existing(this), - this.init(); - } - init() { - this.tween = this.scene.tweens.add({ - targets: this, - duration: 300, - y: "-=5", - repeat: -1, - yoyo: !0, - }); - } - destroy() { - this.tween.stop(), super.destroy(); - } -} -class SeeSaw { - constructor(t, e, s, i = 5) { - const n = t.add.tileSprite(e, s, (32 * i) / 2, 18, "seesaw"); - t.matter.add.gameObject(n, { - restitution: 0, - frictionAir: 0.2, - friction: 0.2, - density: 5e-4, - }); - const { Constraint: o } = Phaser.Physics.Matter.Matter, - a = o.create({ pointA: { x: n.x, y: n.y }, bodyB: n.body, length: 0 }); - t.matter.world.add(a); - } -} -class DungeonGenerator { - constructor(t) { - (this.scene = t), this.generate(); - } - generate() { - this.generateDungeon(), - this.generateMap(), - this.dungeon.rooms.forEach((t) => { - const { x: e, y: s, width: i, height: n } = t; - this.groundLayer.weightedRandomize( - [ - { index: 17, weight: 9 }, - { index: [7, 8, 9, 17, 18, 19], weight: 1 }, - ], - e + 1, - s + 1, - i - 2, - n - 2 - ), - this.placeCorners(t), - this.placeWalls(t); - const o = t.getDoorLocations(); - this.addDoors(t, o, e, s), - this.addKey(t), - this.addFoes(t), - this.addCoins(t), - this.addSeeSaw(t); - }); - } - generateDungeon() { - this.dungeon = new Dungeon({ - width: 50, - height: 50, - doorPadding: 2, - rooms: { - width: { min: 7, max: 15 }, - height: { min: 7, max: 15 }, - maxRooms: 12, - }, - }); - } - generateMap() { - this.map = this.scene.make.tilemap({ - tileWidth: 48, - tileHeight: 48, - width: this.dungeon.width, - height: this.dungeon.height, - }); - const t = this.map.addTilesetImage("tiles", null, 48, 48, 0, 0); - (this.groundLayer = this.map.createBlankLayer("Layer 1", t)), - (this.stuffLayer = this.map.createBlankLayer("Stuff", t)); - const e = this.dungeon.getMappedTiles({ - empty: -1, - floor: -1, - door: 3, - wall: 0, - }); - this.groundLayer.putTilesAt(e, 0, 0), - this.groundLayer.setCollision(0), - this.groundLayer.setCollisionByProperty({ collides: !0 }), - this.scene.matter.world.convertTilemapLayer(this.groundLayer); - } - placeCorners(t) { - const { left: e, right: s, top: i, bottom: n } = t; - this.groundLayer.putTileAt(0, e, i), - this.groundLayer.putTileAt(5, s, i), - this.groundLayer.putTileAt(45, s, n), - this.groundLayer.putTileAt(40, e, n); - } - placeWalls(t) { - const { width: e, height: s, left: i, right: n, top: o, bottom: a } = t; - this.groundLayer.weightedRandomize( - [ - { index: 2, weight: 4 }, - { index: [1, 2, 3, 4], weight: 1 }, - ], - i + 1, - o, - e - 2, - 1 - ), - this.groundLayer.weightedRandomize( - [ - { index: 42, weight: 4 }, - { index: [41, 42, 43, 44], weight: 1 }, - ], - i + 1, - a, - e - 2, - 1 - ), - this.groundLayer.weightedRandomize( - [ - { index: 10, weight: 4 }, - { index: [10, 20, 30], weight: 1 }, - ], - i, - o + 1, - 1, - s - 2 - ), - this.groundLayer.weightedRandomize( - [ - { index: 15, weight: 4 }, - { index: [15, 25, 35], weight: 1 }, - ], - n, - o + 1, - 1, - s - 2 - ); - } - addDoors(t, e, s, i) { - for (let n = 0; n < e.length; n++) { - const o = this.groundLayer.tileToWorldXY(s + e[n].x, i + e[n].y); - new Coin(this.scene, o.x + 20, o.y + 20), - 0 === e[n].y || e[n].y === t.height - 1 - ? this.groundLayer.putTilesAt([[7], [7]], s + e[n].x, i + e[n].y) - : (0 === e[n].x || e[n].x === t.width - 1) && - this.groundLayer.putTilesAt([[7]], s + e[n].x, i + e[n].y); - } - } - addKey(t) { - const e = Phaser.Math.Between(t.left + 2, t.right - 2), - s = Phaser.Math.Between(t.top + 2, t.bottom - 2), - i = this.groundLayer.tileToWorldXY(e, s); - new key(this.scene, i.x + 22, i.y + 22); - } - addSeeSaw(t) { - if (Phaser.Math.Between(0, 10) < 7) return; - const e = this.groundLayer.tileToWorldXY(t.centerX, t.centerY); - new SeeSaw(this.scene, e.x + 22, e.y + 22, t.width); - } - addCoins(t) { - const e = Phaser.Math.RND.pick(["top", "bottom", "left", "right", "none"]), - s = parseInt(t.width / 3) - Phaser.Math.Between(1, 2), - i = parseInt(t.height / 3) - Phaser.Math.Between(1, 2); - switch (e) { - case "top": - this.addCoinsTop(t, s, i); - break; - case "bottom": - this.addCoinsdBottom(t, s, i); - break; - case "left": - this.addCoinsdLeft(t, s, i); - break; - case "right": - this.addCoinsdRight(t, s, i); - } - } - addCoinsTop(t, e, s) { - const i = t.top + Phaser.Math.Between(1, 2), - n = t.left + Phaser.Math.Between(1, 2); - Array(e) - .fill() - .forEach((t, e) => { - Array(s) - .fill() - .forEach((t, s) => { - const o = this.groundLayer.tileToWorldXY(n + e, i + s); - new Coin(this.scene, o.x + 20, o.y + 20); - }); - }); - } - addCoinsdBottom(t, e, s) { - const i = t.bottom - Phaser.Math.Between(1, 2), - n = t.left + Phaser.Math.Between(1, 2); - Array(e) - .fill() - .forEach((t, e) => { - Array(s) - .fill() - .forEach((t, s) => { - const o = this.groundLayer.tileToWorldXY(n + e, i - s); - new Coin(this.scene, o.x + 20, o.y + 20); - }); - }); - } - addCoinsdLeft(t, e, s) { - const i = t.top + Phaser.Math.Between(3, 4), - n = t.left + Phaser.Math.Between(1, 2); - Array(e) - .fill() - .forEach((t, e) => { - Array(s) - .fill() - .forEach((t, s) => { - const o = this.groundLayer.tileToWorldXY(n + e, i - s); - new Coin(this.scene, o.x + 20, o.y + 20); - }); - }); - } - addCoinsdRight(t, e, s) { - const i = t.top + Phaser.Math.Between(1, 2), - n = t.right - Phaser.Math.Between(3, 4); - Array(e) - .fill() - .forEach((t, e) => { - Array(s) - .fill() - .forEach((t, s) => { - const o = this.groundLayer.tileToWorldXY(n - e, i + s); - new Coin(this.scene, o.x + 20, o.y + 20); - }); - }); - } - addFoes(t) { - const e = Phaser.Math.Between(t.left + 2, t.right - 2), - s = Phaser.Math.Between(t.top + 2, t.bottom - 2), - i = this.groundLayer.tileToWorldXY(e, s); - Phaser.Math.Between(0, 5) > 4 - ? new Wizard(this.scene, i.x + 22, i.y + 22, this.groundLayer) - : new Bat(this.scene, i.x + 22, i.y + 22, this.groundLayer); - } - addTopTraps(t) { - const { - x: e, - y: s, - width: i, - height: n, - left: o, - right: a, - top: r, - bottom: l, - tiles: h, - } = t; - h[0].forEach((t, e) => { - 1 === t && e > 0 && e < a && this.groundLayer.putTileAt(5, e + o, r + 1); - }); - } -} -class Game extends Phaser.Scene { - constructor() { - super({ key: "game" }), - (this.player = null), - (this.score = 0), - (this.scoreText = null); - } - init(t) { - (this.name = t.name), (this.number = t.number); - } - preload() { - this.registry.set("seconds", 0), - this.registry.set("coins", 0), - this.registry.set("keys", 0); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.addMap(), - this.addPlayer(), - this.addCollisions(), - this.addCamera(), - this.addScores(), - this.loadAudios(); - } - addMap() { - (this.dungeon = new DungeonGenerator(this)), - this.input.keyboard.on("keydown-ENTER", () => this.finishScene(), this); - } - addScores() { - this.add - .sprite(62, 26, "coin", 0) - .setOrigin(0.5) - .setScrollFactor(0) - .setScale(0.8), - (this.scoreCoins = this.add - .bitmapText(100, 24, "default", "x0", 15) - .setOrigin(0.5) - .setScrollFactor(0)), - (this.scoreSeconds = this.add - .bitmapText(this.center_width, 24, "default", "0", 15) - .setOrigin(0.5) - .setScrollFactor(0)), - this.add - .sprite(this.width - 90, 24, "keys", 0) - .setOrigin(0.5) - .setScrollFactor(0) - .setScale(0.8), - (this.scoreKeys = this.add - .bitmapText(this.width - 48, 24, "default", "x0", 15) - .setOrigin(0.5) - .setScrollFactor(0)), - (this.timer = this.time.addEvent({ - delay: 1e3, - callback: () => { - this.updateSeconds(); - }, - callbackScope: this, - loop: !0, - })); - } - addPlayer() { - (this.trailLayer = this.add.layer()), - (this.player = new Player( - this, - this.dungeon.map.widthInPixels / 2, - this.dungeon.map.heightInPixels / 2, - 100 - )); - } - addCollisions() { - (this.unsubscribePlayerCollide = this.matterCollision.addOnCollideStart({ - objectA: this.player.sprite, - callback: this.onPlayerCollide, - context: this, - })), - this.matter.world.on("collisionstart", (t) => { - t.pairs.forEach((t) => { - t.bodyA, t.bodyB; - }); - }); - } - onPlayerCollide({ gameObjectA: t, gameObjectB: e }) { - e && - ("coin" === e.label && this.playerPicksCoin(e), - "keys" === e.label && this.playerPicksKey(e), - "bat" === e.label && this.playerHitsFoe(e), - "wizard" === e.label && this.playerHitsFoe(e), - "fireball" === e.label && this.playerHitsFoe(e), - e instanceof Phaser.Tilemaps.Tile && - e.properties.isLethal && - (this.unsubscribePlayerCollide(), this.restartScene())); - } - playerPicksCoin(t) { - this.showPoints(t.x, t.y, 1, this.scoreCoins), - t.destroy(), - this.updateCoins(), - this.playAudio("coin"); - } - playerPicksKey(t) { - this.updateKeys(), - this.showPoints( - t.x, - t.y, - this.registry.get("keys") + "/" + this.dungeon.dungeon.rooms.length, - this.scoreKeys - ), - t.destroy(); - } - playerHitsFoe(t) { - this.player.invincible || - (this.player.explosion(), t.destroy(), this.restartScene()); - } - showPoints(t, e, s, i, n = 16777215) { - let o = this.add - .bitmapText(t + 20, e - 80, "default", "+" + s, 10) - .setDropShadow(2, 3, n, 0.7) - .setOrigin(0.5); - this.tweens.add({ - targets: o, - duration: 1e3, - alpha: { from: 1, to: 0 }, - x: { - from: o.x + Phaser.Math.Between(-10, 10), - to: o.x + Phaser.Math.Between(-40, 40), - }, - y: { from: o.y - 10, to: o.y - 60 }, - onComplete: () => { - o.destroy(); - }, - }), - this.textUpdateEffect(i, n); - } - addCamera() { - this.cameras.main.setBounds( - 0, - 0, - this.dungeon.map.widthInPixels, - this.dungeon.map.heightInPixels - ), - this.cameras.main.startFollow(this.player.sprite, !1, 0.5, 0.5), - this.cameras.main.setBackgroundColor(2429722); - } - loadAudios() { - this.audios = { - jump: this.sound.add("jump"), - bubble: this.sound.add("bubble"), - trap: this.sound.add("trap"), - crash: this.sound.add("crash"), - fireball: this.sound.add("fireball"), - death: this.sound.add("death"), - coin: this.sound.add("start"), - }; - } - playAudio(t) { - this.audios[t].play(); - } - restartScene() { - (this.player.sprite.visible = !1), - this.cameras.main.shake(100), - this.cameras.main.fade(250, 0, 0, 0), - this.cameras.main.once("camerafadeoutcomplete", () => - this.scene.restart() - ); - } - finishScene() { - this.cameras.main.fade(250, 0, 0, 0), - this.cameras.main.once("camerafadeoutcomplete", () => { - this.scene.start("outro", { - next: "underwater", - name: "STAGE", - number: this.number + 1, - }); - }); - } - updateSeconds(t = 1) { - const e = +this.registry.get("seconds") + t; - this.registry.set("seconds", e), this.scoreSeconds.setText(e); - } - updateCoins(t = 1) { - const e = +this.registry.get("coins") + t; - this.registry.set("coins", e), this.scoreCoins.setText("x" + e); - } - updateKeys(t = 1) { - const e = +this.registry.get("keys") + t; - this.registry.set("keys", e), - this.scoreKeys.setText("x" + e), - e === this.dungeon.dungeon.rooms.length && this.finishScene(); - } - textUpdateEffect(t, e) { - t.setTint(e); - const s = t.y; - this.tweens.add({ - targets: t, - duration: 100, - alpha: { from: 1, to: 0.8 }, - scale: { from: 1.2, to: 1 }, - repeat: 5, - onComplete: () => { - t.setTint(16777215), (t.y = s); - }, - }); - } -} -var phaserMatterCollision = { exports: {} }; -(function (module, exports) { - var factory; - "undefined" != typeof self && self, - (factory = function (__WEBPACK_EXTERNAL_MODULE_phaser__) { - return (() => { - var __webpack_modules__ = { - "./index.ts": ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) => { - eval( - '__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "PhaserMatterCollisionPlugin": () => (/* reexport safe */ _phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__.default),\n/* harmony export */ "getRootBody": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody),\n/* harmony export */ "isCollidingObject": () => (/* reexport safe */ _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__.isCollidingObject),\n/* harmony export */ "isMatterBody": () => (/* reexport safe */ _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__.isMatterBody),\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./phaser-matter-collision-plugin */ "./phaser-matter-collision-plugin.ts");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./utils.ts");\n/* harmony import */ var _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./valid-collision-object */ "./valid-collision-object.ts");\n\r\n\r\n\r\n\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__.default);\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9pbmRleC50cz9hOTU5Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBQTJFO0FBQ3JDO0FBTUo7QUEyQmhDO0FBRUYsaUVBQWUsb0VBQTJCLEVBQUMiLCJmaWxlIjoiLi9pbmRleC50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBQaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4gZnJvbSBcIi4vcGhhc2VyLW1hdHRlci1jb2xsaXNpb24tcGx1Z2luXCI7XG5pbXBvcnQgeyBnZXRSb290Qm9keSB9IGZyb20gXCIuL3V0aWxzXCI7XG5pbXBvcnQge1xuICBpc0NvbGxpZGluZ09iamVjdCxcbiAgaXNNYXR0ZXJCb2R5LFxuICBPYmplY3RXaXRoQm9keSxcbiAgQ29sbGlkaW5nT2JqZWN0LFxufSBmcm9tIFwiLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0XCI7XG5pbXBvcnQge1xuICBFeHRlbmRlZE1hdHRlckNvbGxpc2lvbkRhdGEsXG4gIENvbGxpc2lvbkV2ZW50LFxuICBFdmVudERhdGEsXG4gIENvbGxpZGVDYWxsYmFjayxcbiAgQ29sbGlkZUFDb25maWcsXG4gIENvbGxpZGVBQkNvbmZpZyxcbiAgQ29sbGlkZUNvbnRleHQsXG4gIFVuc3Vic2NyaWJlLFxufSBmcm9tIFwiLi9jb2xsaXNpb24tdHlwZXNcIjtcblxuZXhwb3J0IHtcbiAgUGhhc2VyTWF0dGVyQ29sbGlzaW9uUGx1Z2luLFxuICBnZXRSb290Qm9keSxcbiAgaXNDb2xsaWRpbmdPYmplY3QsXG4gIGlzTWF0dGVyQm9keSxcbiAgT2JqZWN0V2l0aEJvZHksXG4gIENvbGxpZGluZ09iamVjdCxcbiAgRXh0ZW5kZWRNYXR0ZXJDb2xsaXNpb25EYXRhLFxuICBDb2xsaXNpb25FdmVudCxcbiAgRXZlbnREYXRhLFxuICBDb2xsaWRlQ2FsbGJhY2ssXG4gIENvbGxpZGVBQ29uZmlnLFxuICBDb2xsaWRlQUJDb25maWcsXG4gIENvbGxpZGVDb250ZXh0LFxuICBVbnN1YnNjcmliZSxcbn07XG5cbmV4cG9ydCBkZWZhdWx0IFBoYXNlck1hdHRlckNvbGxpc2lvblBsdWdpbjtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./index.ts\n' - ); - }, - "./logger.ts": ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) => { - eval( - '__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\r\n log: console.log,\r\n warn: console.warn,\r\n error: console.error,\r\n});\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9sb2dnZXIudHM/Zjk0OSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsaUVBQWU7SUFDYixHQUFHLEVBQUUsT0FBTyxDQUFDLEdBQUc7SUFDaEIsSUFBSSxFQUFFLE9BQU8sQ0FBQyxJQUFJO0lBQ2xCLEtBQUssRUFBRSxPQUFPLENBQUMsS0FBSztDQUNyQixFQUFDIiwiZmlsZSI6Ii4vbG9nZ2VyLnRzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQge1xuICBsb2c6IGNvbnNvbGUubG9nLFxuICB3YXJuOiBjb25zb2xlLndhcm4sXG4gIGVycm9yOiBjb25zb2xlLmVycm9yLFxufTtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./logger.ts\n' - ); - }, - "./phaser-matter-collision-plugin.ts": ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) => { - eval( - '__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ MatterCollisionPlugin)\n/* harmony export */ });\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! phaser */ "phaser");\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(phaser__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./utils.ts");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ "./logger.ts");\n/* harmony import */ var _valid_collision_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./valid-collision-object */ "./valid-collision-object.ts");\n\r\n\r\n\r\n\r\nvar Matter = phaser__WEBPACK_IMPORTED_MODULE_0__.Physics.Matter;\r\nconst { START, DESTROY, SHUTDOWN } = phaser__WEBPACK_IMPORTED_MODULE_0__.Scenes.Events;\r\nconst { COLLISION_START, COLLISION_ACTIVE, COLLISION_END } = Matter.Events;\r\n/**\r\n * @export\r\n */\r\nclass MatterCollisionPlugin extends phaser__WEBPACK_IMPORTED_MODULE_0__.Plugins.ScenePlugin {\r\n constructor(scene, pluginManager, pluginKey) {\r\n super(scene, pluginManager, pluginKey);\r\n this.scene = scene;\r\n this.pluginManager = pluginManager;\r\n this.events = new phaser__WEBPACK_IMPORTED_MODULE_0__.Events.EventEmitter();\r\n this.collisionStartListeners = new Map();\r\n this.collisionEndListeners = new Map();\r\n this.collisionActiveListeners = new Map();\r\n this.scene = scene;\r\n this.scene.events.once(START, this.start, this);\r\n this.scene.events.once(DESTROY, this.destroy, this);\r\n }\r\n addOnCollideStart(config) {\r\n // Note: the order of overloads is important! TS matches the first one it can, so this needs\r\n // the most specific/constrained signature first.\r\n this.addOnCollide(this.collisionStartListeners, config);\r\n return () => this.removeOnCollide(this.collisionStartListeners, config);\r\n }\r\n addOnCollideEnd(config) {\r\n this.addOnCollide(this.collisionEndListeners, config);\r\n return () => this.removeOnCollide(this.collisionEndListeners, config);\r\n }\r\n addOnCollideActive(config) {\r\n this.addOnCollide(this.collisionActiveListeners, config);\r\n return () => this.removeOnCollide(this.collisionActiveListeners, config);\r\n }\r\n removeOnCollideStart(config) {\r\n this.removeOnCollide(this.collisionStartListeners, config);\r\n }\r\n removeOnCollideEnd(config) {\r\n this.removeOnCollide(this.collisionEndListeners, config);\r\n }\r\n removeOnCollideActive(config) {\r\n this.removeOnCollide(this.collisionActiveListeners, config);\r\n }\r\n /** Remove any listeners that were added with addOnCollideStart. */\r\n removeAllCollideStartListeners() {\r\n this.collisionStartListeners.clear();\r\n }\r\n /** Remove any listeners that were added with addOnCollideActive. */\r\n removeAllCollideActiveListeners() {\r\n this.collisionActiveListeners.clear();\r\n }\r\n /** Remove any listeners that were added with addOnCollideEnd. */\r\n removeAllCollideEndListeners() {\r\n this.collisionEndListeners.clear();\r\n }\r\n /**\r\n * Remove any listeners that were added with addOnCollideStart, addOnCollideActive or\r\n * addOnCollideEnd.\r\n */\r\n removeAllCollideListeners() {\r\n this.removeAllCollideStartListeners();\r\n this.removeAllCollideActiveListeners();\r\n this.removeAllCollideEndListeners();\r\n }\r\n addOnCollide(map, config) {\r\n const { context, callback, objectA, objectB } = config;\r\n if (!callback || typeof callback !== "function") {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__.default.warn(`No valid callback specified. Received: ${callback}`);\r\n return;\r\n }\r\n const objectsA = Array.isArray(objectA) ? objectA : [objectA];\r\n const objectsB = Array.isArray(objectB) ? objectB : [objectB];\r\n objectsA.forEach((a) => {\r\n objectsB.forEach((b) => {\r\n this.addOnCollideObjectVsObject(map, a, b, callback, context);\r\n });\r\n });\r\n }\r\n removeOnCollide(map, config) {\r\n const { context, callback, objectA, objectB } = config;\r\n const objectsA = Array.isArray(objectA) ? objectA : [objectA];\r\n const objectsB = Array.isArray(objectB) ? objectB : [objectB];\r\n objectsA.forEach((a) => {\r\n const callbacks = map.get(a) || [];\r\n const remainingCallbacks = callbacks.filter((cb) => {\r\n // If anything doesn\'t match a provided config value (i.e. anything other than undefined),\r\n // we can bail and keep listener.\r\n if (context !== undefined && cb.context !== context)\r\n return true;\r\n if (callback !== undefined && cb.callback !== callback)\r\n return true;\r\n if (objectB !== undefined && !objectsB.includes(cb.target))\r\n return true;\r\n return false;\r\n });\r\n if (remainingCallbacks.length > 0)\r\n map.set(a, remainingCallbacks);\r\n else\r\n map.delete(a);\r\n });\r\n }\r\n addOnCollideObjectVsObject(map, objectA, objectB, callback, context) {\r\n // Can\'t do anything if the first object is not defined or invalid.\r\n if (!objectA || !(0,_valid_collision_object__WEBPACK_IMPORTED_MODULE_3__.isCollidingObject)(objectA)) {\r\n (0,_utils__WEBPACK_IMPORTED_MODULE_1__.warnInvalidObject)(objectA);\r\n return;\r\n }\r\n // The second object can be undefined or a valid body.\r\n if (objectB && !(0,_valid_collision_object__WEBPACK_IMPORTED_MODULE_3__.isCollidingObject)(objectB)) {\r\n (0,_utils__WEBPACK_IMPORTED_MODULE_1__.warnInvalidObject)(objectA);\r\n return;\r\n }\r\n const callbacks = map.get(objectA) || [];\r\n callbacks.push({ target: objectB, callback, context });\r\n map.set(objectA, callbacks);\r\n }\r\n onCollisionStart(event) {\r\n this.onCollisionEvent(this.collisionStartListeners, COLLISION_START, event);\r\n }\r\n onCollisionEnd(event) {\r\n this.onCollisionEvent(this.collisionEndListeners, COLLISION_END, event);\r\n }\r\n onCollisionActive(event) {\r\n this.onCollisionEvent(this.collisionActiveListeners, COLLISION_ACTIVE, event);\r\n }\r\n /**\r\n * Reusable handler for collisionstart, collisionend, collisionactive.\r\n * */\r\n onCollisionEvent(listenerMap, eventName, event) {\r\n const pairs = event.pairs;\r\n const pairEventName = "pair" + eventName;\r\n const eventData = { isReversed: false };\r\n const eventDataReversed = { isReversed: true };\r\n pairs.map((pair, i) => {\r\n var _a, _b;\r\n const { bodyA, bodyB } = pair;\r\n const rootBodyA = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody)(bodyA);\r\n const rootBodyB = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody)(bodyB);\r\n let gameObjectA = (_a = rootBodyA.gameObject) !== null && _a !== void 0 ? _a : undefined;\r\n let gameObjectB = (_b = rootBodyB.gameObject) !== null && _b !== void 0 ? _b : undefined;\r\n // Special case for tiles, where it\'s more useful to have a reference to the Tile object not\r\n // the TileBody. This is hot code, so use a property check instead of instanceof.\r\n if (gameObjectA && gameObjectA instanceof Matter.TileBody) {\r\n gameObjectA = gameObjectA.tile;\r\n }\r\n if (gameObjectB && gameObjectB instanceof Matter.TileBody) {\r\n gameObjectB = gameObjectB.tile;\r\n }\r\n pairs[i].gameObjectA = gameObjectA !== null && gameObjectA !== void 0 ? gameObjectA : undefined;\r\n pairs[i].gameObjectB = gameObjectB !== null && gameObjectB !== void 0 ? gameObjectB : undefined;\r\n eventData.bodyA = bodyA;\r\n eventData.bodyB = bodyB;\r\n eventData.gameObjectA = gameObjectA !== null && gameObjectA !== void 0 ? gameObjectA : undefined;\r\n eventData.gameObjectB = gameObjectB !== null && gameObjectB !== void 0 ? gameObjectB : undefined;\r\n eventData.pair = pair;\r\n this.events.emit(pairEventName, eventData);\r\n if (listenerMap.size > 0) {\r\n eventDataReversed.bodyB = bodyA;\r\n eventDataReversed.bodyA = bodyB;\r\n eventDataReversed.gameObjectB = gameObjectA;\r\n eventDataReversed.gameObjectA = gameObjectB;\r\n eventDataReversed.pair = pair;\r\n const data = eventData;\r\n const dataReversed = eventDataReversed;\r\n this.checkPairAndEmit(listenerMap, bodyA, bodyB, gameObjectB, data);\r\n this.checkPairAndEmit(listenerMap, bodyB, bodyA, gameObjectA, dataReversed);\r\n if (gameObjectA) {\r\n this.checkPairAndEmit(listenerMap, gameObjectA, bodyB, gameObjectB, data);\r\n }\r\n if (gameObjectB) {\r\n this.checkPairAndEmit(listenerMap, gameObjectB, bodyA, gameObjectA, dataReversed);\r\n }\r\n }\r\n });\r\n this.events.emit(eventName, event);\r\n }\r\n checkPairAndEmit(map, objectA, bodyB, gameObjectB, eventData) {\r\n const callbacks = map.get(objectA);\r\n if (callbacks) {\r\n callbacks.forEach(({ target, callback, context }) => {\r\n if (!target || target === bodyB || target === gameObjectB) {\r\n callback.call(context, eventData);\r\n }\r\n });\r\n }\r\n }\r\n subscribeMatterEvents() {\r\n const matter = this.scene.matter;\r\n if (!matter || !matter.world) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__.default.warn("Plugin requires matter!");\r\n return;\r\n }\r\n matter.world.on(COLLISION_START, this.onCollisionStart, this);\r\n matter.world.on(COLLISION_ACTIVE, this.onCollisionActive, this);\r\n matter.world.on(COLLISION_END, this.onCollisionEnd, this);\r\n }\r\n unsubscribeMatterEvents() {\r\n // Don\'t unsub if matter next existing or if the game is destroyed (since the matter world will\r\n // be already gone)\r\n const matter = this.scene.matter;\r\n if (!matter || !matter.world)\r\n return;\r\n matter.world.off(COLLISION_START, this.onCollisionStart, this);\r\n matter.world.off(COLLISION_ACTIVE, this.onCollisionActive, this);\r\n matter.world.off(COLLISION_END, this.onCollisionEnd, this);\r\n }\r\n start() {\r\n // If restarting, unsubscribe before resubscribing to ensure only one listener is added\r\n this.scene.events.off(SHUTDOWN, this.shutdown, this);\r\n this.scene.events.on(SHUTDOWN, this.shutdown, this);\r\n this.subscribeMatterEvents();\r\n }\r\n shutdown() {\r\n this.removeAllCollideListeners();\r\n this.unsubscribeMatterEvents();\r\n // Resubscribe to start so that the plugin is started again after Matter\r\n this.scene.events.once(START, this.start, this);\r\n }\r\n destroy() {\r\n this.scene.events.off(DESTROY, this.destroy, this);\r\n this.scene.events.off(START, this.start, this);\r\n this.scene.events.off(SHUTDOWN, this.shutdown, this);\r\n this.removeAllCollideListeners();\r\n this.unsubscribeMatterEvents();\r\n }\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9waGFzZXItbWF0dGVyLWNvbGxpc2lvbi1wbHVnaW4udHM/OGI5OCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBMkU7QUFDbEI7QUFDM0I7QUFDc0Q7QUFnQnBGLElBQU8sTUFBTSxHQUFHLGtEQUFjLENBQUM7QUFFL0IsTUFBTSxFQUFFLEtBQUssRUFBRSxPQUFPLEVBQUUsUUFBUSxFQUFFLEdBQUcsaURBQWEsQ0FBQztBQUNuRCxNQUFNLEVBQUUsZUFBZSxFQUFFLGdCQUFnQixFQUFFLGFBQWEsRUFBRSxHQUFHLE1BQU0sQ0FBQyxNQUFNLENBQUM7QUFPM0U7O0dBRUc7QUFDWSxNQUFNLHFCQUFzQixTQUFRLHVEQUFtQjtJQU9wRSxZQUNZLEtBQVksRUFDWixhQUFvQyxFQUM5QyxTQUFpQjtRQUVqQixLQUFLLENBQUMsS0FBSyxFQUFFLGFBQWEsRUFBRSxTQUFTLENBQUMsQ0FBQztRQUo3QixVQUFLLEdBQUwsS0FBSyxDQUFPO1FBQ1osa0JBQWEsR0FBYixhQUFhLENBQXVCO1FBUnpDLFdBQU0sR0FBRyxJQUFJLHVEQUFtQixFQUFFLENBQUM7UUFFbEMsNEJBQXVCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFDakQsMEJBQXFCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFDL0MsNkJBQXdCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFReEQsSUFBSSxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7UUFDbkIsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ2hELElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQztJQUN0RCxDQUFDO0lBVU0saUJBQWlCLENBQUMsTUFBNkI7UUFDcEQsNEZBQTRGO1FBQzVGLGlEQUFpRDtRQUNqRCxJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyx1QkFBdUIsRUFBRSxNQUFNLENBQUMsQ0FBQztRQUN4RCxPQUFPLEdBQUcsRUFBRSxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQzFFLENBQUM7SUFLTSxlQUFlLENBQUMsTUFBNkI7UUFDbEQsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMscUJBQXFCLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDdEQsT0FBTyxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxxQkFBcUIsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUN4RSxDQUFDO0lBS00sa0JBQWtCLENBQUMsTUFBNkI7UUFDckQsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsd0JBQXdCLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDekQsT0FBTyxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUMzRSxDQUFDO0lBVU0sb0JBQW9CLENBQUMsTUFBbUM7UUFDN0QsSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsdUJBQXVCLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFDN0QsQ0FBQztJQUtNLGtCQUFrQixDQUFDLE1BQW1DO1FBQzNELElBQUksQ0FBQyxlQUFlLENBQUMsSUFBSSxDQUFDLHFCQUFxQixFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQzNELENBQUM7SUFLTSxxQkFBcUIsQ0FBQyxNQUFtQztRQUM5RCxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUM5RCxDQUFDO0lBRUQsbUVBQW1FO0lBQzVELDhCQUE4QjtRQUNuQyxJQUFJLENBQUMsdUJBQXVCLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDdkMsQ0FBQztJQUVELG9FQUFvRTtJQUM3RCwrQkFBK0I7UUFDcEMsSUFBSSxDQUFDLHdCQUF3QixDQUFDLEtBQUssRUFBRSxDQUFDO0lBQ3hDLENBQUM7SUFFRCxpRUFBaUU7SUFDMUQsNEJBQTRCO1FBQ2pDLElBQUksQ0FBQyxxQkFBcUIsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUNyQyxDQUFDO0lBRUQ7OztPQUdHO0lBQ0kseUJBQXlCO1FBQzlCLElBQUksQ0FBQyw4QkFBOEIsRUFBRSxDQUFDO1FBQ3RDLElBQUksQ0FBQywrQkFBK0IsRUFBRSxDQUFDO1FBQ3ZDLElBQUksQ0FBQyw0QkFBNEIsRUFBRSxDQUFDO0lBQ3RDLENBQUM7SUFFTyxZQUFZLENBQUMsR0FBZ0IsRUFBRSxNQUE2QjtRQUNsRSxNQUFNLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFLEdBQUcsTUFBTSxDQUFDO1FBQ3ZELElBQUksQ0FBQyxRQUFRLElBQUksT0FBTyxRQUFRLEtBQUssVUFBVSxFQUFFO1lBQy9DLGlEQUFXLENBQUMsMENBQTBDLFFBQVEsRUFBRSxDQUFDLENBQUM7WUFDbEUsT0FBTztTQUNSO1FBQ0QsTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQzlELE1BQU0sUUFBUSxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUM5RCxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUU7WUFDckIsUUFBUSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFO2dCQUNyQixJQUFJLENBQUMsMEJBQTBCLENBQUMsR0FBRyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1lBQ2hFLENBQUMsQ0FBQyxDQUFDO1FBQ0wsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDO0lBRU8sZUFBZSxDQUFDLEdBQWdCLEVBQUUsTUFBbUM7UUFDM0UsTUFBTSxFQUFFLE9BQU8sRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLE1BQU0sQ0FBQztRQUN2RCxNQUFNLFFBQVEsR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDOUQsTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQzlELFFBQVEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRTtZQUNyQixNQUFNLFNBQVMsR0FBRyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxJQUFJLEVBQUUsQ0FBQztZQUNuQyxNQUFNLGtCQUFrQixHQUFHLFNBQVMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxFQUFFLEVBQUUsRUFBRTtnQkFDakQsMEZBQTBGO2dCQUMxRixpQ0FBaUM7Z0JBQ2pDLElBQUksT0FBTyxLQUFLLFNBQVMsSUFBSSxFQUFFLENBQUMsT0FBTyxLQUFLLE9BQU87b0JBQUUsT0FBTyxJQUFJLENBQUM7Z0JBQ2pFLElBQUksUUFBUSxLQUFLLFNBQVMsSUFBSSxFQUFFLENBQUMsUUFBUSxLQUFLLFFBQVE7b0JBQUUsT0FBTyxJQUFJLENBQUM7Z0JBQ3BFLElBQUksT0FBTyxLQUFLLFNBQVMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsRUFBRSxDQUFDLE1BQU0sQ0FBQztvQkFBRSxPQUFPLElBQUksQ0FBQztnQkFDeEUsT0FBTyxLQUFLLENBQUM7WUFDZixDQUFDLENBQUMsQ0FBQztZQUNILElBQUksa0JBQWtCLENBQUMsTUFBTSxHQUFHLENBQUM7Z0JBQUUsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQUUsa0JBQWtCLENBQUMsQ0FBQzs7Z0JBQzdELEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDckIsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDO0lBRU8sMEJBQTBCLENBQ2hDLEdBQWdCLEVBQ2hCLE9BQVcsRUFDWCxPQUF1QixFQUN2QixRQUFpQyxFQUNqQyxPQUFtQztRQUVuQyxtRUFBbUU7UUFDbkUsSUFBSSxDQUFDLE9BQU8sSUFBSSxDQUFDLDBFQUFpQixDQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQzNDLHlEQUFpQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQzNCLE9BQU87U0FDUjtRQUVELHNEQUFzRDtRQUN0RCxJQUFJLE9BQU8sSUFBSSxDQUFDLDBFQUFpQixDQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQzFDLHlEQUFpQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQzNCLE9BQU87U0FDUjtRQUVELE1BQU0sU0FBUyxHQUFHLEdBQUcsQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLElBQUksRUFBRSxDQUFDO1FBQ3pDLFNBQVMsQ0FBQyxJQUFJLENBQUMsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxPQUFPLEVBQUUsQ0FBQyxDQUFDO1FBQ3ZELEdBQUcsQ0FBQyxHQUFHLENBQUMsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0lBQzlCLENBQUM7SUFFTyxnQkFBZ0IsQ0FBQyxLQUF3QztRQUMvRCxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLGVBQWUsRUFBRSxLQUFLLENBQUMsQ0FBQztJQUM5RSxDQUFDO0lBRU8sY0FBYyxDQUFDLEtBQXFDO1FBQzFELElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLENBQUMscUJBQXFCLEVBQUUsYUFBYSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQzFFLENBQUM7SUFFTyxpQkFBaUIsQ0FBQyxLQUF3QztRQUNoRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLHdCQUF3QixFQUFFLGdCQUFnQixFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQ2hGLENBQUM7SUFFRDs7U0FFSztJQUNHLGdCQUFnQixDQUN0QixXQUF3QixFQUN4QixTQUFpQixFQUNqQixLQUEyQjtRQUUzQixNQUFNLEtBQUssR0FBRyxLQUFLLENBQUMsS0FBc0MsQ0FBQztRQUMzRCxNQUFNLGFBQWEsR0FBRyxNQUFNLEdBQUcsU0FBUyxDQUFDO1FBQ3pDLE1BQU0sU0FBUyxHQUErQixFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQUUsQ0FBQztRQUNwRSxNQUFNLGlCQUFpQixHQUErQixFQUFFLFVBQVUsRUFBRSxJQUFJLEVBQUUsQ0FBQztRQUUzRSxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUMsSUFBSSxFQUFFLENBQUMsRUFBRSxFQUFFOztZQUNwQixNQUFNLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxHQUFHLElBQUksQ0FBQztZQUM5QixNQUFNLFNBQVMsR0FBRyxtREFBVyxDQUFDLEtBQUssQ0FBQyxDQUFDO1lBQ3JDLE1BQU0sU0FBUyxHQUFHLG1EQUFXLENBQUMsS0FBSyxDQUFDLENBQUM7WUFDckMsSUFBSSxXQUFXLEdBQW1CLGVBQVMsQ0FBQyxVQUFVLG1DQUFJLFNBQVMsQ0FBQztZQUNwRSxJQUFJLFdBQVcsR0FBbUIsZUFBUyxDQUFDLFVBQVUsbUNBQUksU0FBUyxDQUFDO1lBRXBFLDRGQUE0RjtZQUM1RixpRkFBaUY7WUFDakYsSUFBSSxXQUFXLElBQUksV0FBVyxZQUFZLE1BQU0sQ0FBQyxRQUFRLEVBQUU7Z0JBQ3pELFdBQVcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDO2FBQ2hDO1lBQ0QsSUFBSSxXQUFXLElBQUksV0FBVyxZQUFZLE1BQU0sQ0FBQyxRQUFRLEVBQUU7Z0JBQ3pELFdBQVcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDO2FBQ2hDO1lBRUQsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDaEQsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFFaEQsU0FBUyxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7WUFDeEIsU0FBUyxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7WUFDeEIsU0FBUyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDakQsU0FBUyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDakQsU0FBUyxDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7WUFFdEIsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsYUFBYSxFQUFFLFNBQVMsQ0FBQyxDQUFDO1lBRTNDLElBQUksV0FBVyxDQUFDLElBQUksR0FBRyxDQUFDLEVBQUU7Z0JBQ3hCLGlCQUFpQixDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7Z0JBQ2hDLGlCQUFpQixDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7Z0JBQ2hDLGlCQUFpQixDQUFDLFdBQVcsR0FBRyxXQUFXLENBQUM7Z0JBQzVDLGlCQUFpQixDQUFDLFdBQVcsR0FBRyxXQUFXLENBQUM7Z0JBQzVDLGlCQUFpQixDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7Z0JBRTlCLE1BQU0sSUFBSSxHQUFHLFNBQThCLENBQUM7Z0JBQzVDLE1BQU0sWUFBWSxHQUFHLGlCQUFzQyxDQUFDO2dCQUU1RCxJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLElBQUksQ0FBQyxDQUFDO2dCQUNwRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLFlBQVksQ0FBQyxDQUFDO2dCQUU1RSxJQUFJLFdBQVcsRUFBRTtvQkFDZixJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLElBQUksQ0FBQyxDQUFDO2lCQUMzRTtnQkFFRCxJQUFJLFdBQVcsRUFBRTtvQkFDZixJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLFlBQVksQ0FBQyxDQUFDO2lCQUNuRjthQUNGO1FBQ0gsQ0FBQyxDQUFDLENBQUM7UUFFSCxJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsS0FBSyxDQUFDLENBQUM7SUFDckMsQ0FBQztJQUVPLGdCQUFnQixDQUN0QixHQUFnQixFQUNoQixPQUFXLEVBQ1gsS0FBb0IsRUFDcEIsV0FBMkIsRUFDM0IsU0FBNEI7UUFFNUIsTUFBTSxTQUFTLEdBQUcsR0FBRyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUNuQyxJQUFJLFNBQVMsRUFBRTtZQUNiLFNBQVMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLEVBQUUsRUFBRTtnQkFDbEQsSUFBSSxDQUFDLE1BQU0sSUFBSSxNQUFNLEtBQUssS0FBSyxJQUFJLE1BQU0sS0FBSyxXQUFXLEVBQUU7b0JBQ3pELFFBQVEsQ0FBQyxJQUFJLENBQUMsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO2lCQUNuQztZQUNILENBQUMsQ0FBQyxDQUFDO1NBQ0o7SUFDSCxDQUFDO0lBRUQscUJBQXFCO1FBQ25CLE1BQU0sTUFBTSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDO1FBQ2pDLElBQUksQ0FBQyxNQUFNLElBQUksQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFO1lBQzVCLGlEQUFXLENBQUMseUJBQXlCLENBQUMsQ0FBQztZQUN2QyxPQUFPO1NBQ1I7UUFDRCxNQUFNLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxlQUFlLEVBQUUsSUFBSSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxDQUFDO1FBQzlELE1BQU0sQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNoRSxNQUFNLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxhQUFhLEVBQUUsSUFBSSxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUM1RCxDQUFDO0lBRUQsdUJBQXVCO1FBQ3JCLCtGQUErRjtRQUMvRixtQkFBbUI7UUFDbkIsTUFBTSxNQUFNLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUM7UUFDakMsSUFBSSxDQUFDLE1BQU0sSUFBSSxDQUFDLE1BQU0sQ0FBQyxLQUFLO1lBQUUsT0FBTztRQUNyQyxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxlQUFlLEVBQUUsSUFBSSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxDQUFDO1FBQy9ELE1BQU0sQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNqRSxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxhQUFhLEVBQUUsSUFBSSxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUM3RCxDQUFDO0lBRUQsS0FBSztRQUNILHVGQUF1RjtRQUN2RixJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsSUFBSSxDQUFDLENBQUM7UUFDckQsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ3BELElBQUksQ0FBQyxxQkFBcUIsRUFBRSxDQUFDO0lBQy9CLENBQUM7SUFFRCxRQUFRO1FBQ04sSUFBSSxDQUFDLHlCQUF5QixFQUFFLENBQUM7UUFDakMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLENBQUM7UUFDL0Isd0VBQXdFO1FBQ3hFLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNsRCxDQUFDO0lBRUQsT0FBTztRQUNMLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNuRCxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLENBQUM7UUFDL0MsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ3JELElBQUksQ0FBQyx5QkFBeUIsRUFBRSxDQUFDO1FBQ2pDLElBQUksQ0FBQyx1QkFBdUIsRUFBRSxDQUFDO0lBQ2pDLENBQUM7Q0FDRiIsImZpbGUiOiIuL3BoYXNlci1tYXR0ZXItY29sbGlzaW9uLXBsdWdpbi50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFBoeXNpY3MsIFBsdWdpbnMsIFNjZW5lLCBFdmVudHMsIFNjZW5lcywgVGlsZW1hcHMgfSBmcm9tIFwicGhhc2VyXCI7XG5pbXBvcnQgeyBnZXRSb290Qm9keSwgd2FybkludmFsaWRPYmplY3QgfSBmcm9tIFwiLi91dGlsc1wiO1xuaW1wb3J0IGxvZ2dlciBmcm9tIFwiLi9sb2dnZXJcIjtcbmltcG9ydCB7IENvbGxpZGluZ09iamVjdCBhcyBDTywgaXNDb2xsaWRpbmdPYmplY3QgfSBmcm9tIFwiLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0XCI7XG5pbXBvcnQge1xuICBMaXN0ZW5lck1hcCxcbiAgQ29sbGlkZUFCQ29uZmlnIGFzIEFCQ29uZmlnLFxuICBVbnN1YnNjcmliZSxcbiAgQ29sbGlkZUNhbGxiYWNrLFxuICBDb2xsaWRlQ29udGV4dCxcbiAgRXh0ZW5kZWRNYXR0ZXJDb2xsaXNpb25EYXRhLFxuICBFdmVudERhdGEsXG4gIENvbGxpZGVBQ29uZmlnIGFzIEFDb25maWcsXG4gIEludGVybmFsQ29sbGlkZUNvbmZpZyxcbiAgUmVtb3ZlQ29sbGlkZUNvbmZpZ0EgYXMgUmVtb3ZlQUNvbmZpZyxcbiAgUmVtb3ZlQ29sbGlkZUNvbmZpZ0FCIGFzIFJlbW92ZUFCQ29uZmlnLFxuICBJbnRlcm5hbENvbGxpZGVSZW1vdmVDb25maWcsXG59IGZyb20gXCIuL2NvbGxpc2lvbi10eXBlc1wiO1xuXG5pbXBvcnQgTWF0dGVyID0gUGh5c2ljcy5NYXR0ZXI7XG5pbXBvcnQgTWF0dGVyRXZlbnRzID0gTWF0dGVyLkV2ZW50cztcbmNvbnN0IHsgU1RBUlQsIERFU1RST1ksIFNIVVRET1dOIH0gPSBTY2VuZXMuRXZlbnRzO1xuY29uc3QgeyBDT0xMSVNJT05fU1RBUlQsIENPTExJU0lPTl9BQ1RJVkUsIENPTExJU0lPTl9FTkQgfSA9IE1hdHRlci5FdmVudHM7XG5cbnR5cGUgTWF0dGVyQ29sbGlzaW9uRXZlbnQgPVxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudFxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25FbmRFdmVudFxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudDtcblxuLyoqXG4gKiBAZXhwb3J0XG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIE1hdHRlckNvbGxpc2lvblBsdWdpbiBleHRlbmRzIFBsdWdpbnMuU2NlbmVQbHVnaW4ge1xuICBwdWJsaWMgZXZlbnRzID0gbmV3IEV2ZW50cy5FdmVudEVtaXR0ZXIoKTtcblxuICBwcml2YXRlIGNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzOiBMaXN0ZW5lck1hcCA9IG5ldyBNYXAoKTtcbiAgcHJpdmF0ZSBjb2xsaXNpb25FbmRMaXN0ZW5lcnM6IExpc3RlbmVyTWFwID0gbmV3IE1hcCgpO1xuICBwcml2YXRlIGNvbGxpc2lvbkFjdGl2ZUxpc3RlbmVyczogTGlzdGVuZXJNYXAgPSBuZXcgTWFwKCk7XG5cbiAgY29uc3RydWN0b3IoXG4gICAgcHJvdGVjdGVkIHNjZW5lOiBTY2VuZSxcbiAgICBwcm90ZWN0ZWQgcGx1Z2luTWFuYWdlcjogUGx1Z2lucy5QbHVnaW5NYW5hZ2VyLFxuICAgIHBsdWdpbktleTogc3RyaW5nXG4gICkge1xuICAgIHN1cGVyKHNjZW5lLCBwbHVnaW5NYW5hZ2VyLCBwbHVnaW5LZXkpO1xuICAgIHRoaXMuc2NlbmUgPSBzY2VuZTtcbiAgICB0aGlzLnNjZW5lLmV2ZW50cy5vbmNlKFNUQVJULCB0aGlzLnN0YXJ0LCB0aGlzKTtcbiAgICB0aGlzLnNjZW5lLmV2ZW50cy5vbmNlKERFU1RST1ksIHRoaXMuZGVzdHJveSwgdGhpcyk7XG4gIH1cblxuICAvKipcbiAgICogQWRkIGEgbGlzdGVuZXIgZm9yIGNvbGxpZGVzdGFydCBldmVudHMgYmV0d2VlbiBvYmplY3RBIGFuZCBvYmplY3RCLiBUaGUgY29sbGlkZXN0YXJ0IGV2ZW50IGlzXG4gICAqIGZpcmVkIGJ5IE1hdHRlciB3aGVuIHR3byBib2RpZXMgc3RhcnQgY29sbGlkaW5nIHdpdGhpbiBhIHRpY2sgb2YgdGhlIGVuZ2luZS4gSWYgb2JqZWN0QiBpc1xuICAgKiBvbWl0dGVkLCBhbnkgY29sbGlzaW9ucyB3aXRoIG9iamVjdEEgd2lsbCBiZSBwYXNzZWQgYWxvbmcgdG8gdGhlIGxpc3RlbmVyLiBTZWVcbiAgICoge0BsaW5rIHBhaXJjb2xsaXNpb25zdGFydH0gZm9yIGluZm9ybWF0aW9uIG9uIGNhbGxiYWNrIHBhcmFtZXRlcnMuXG4gICAqL1xuICBwdWJsaWMgYWRkT25Db2xsaWRlU3RhcnQ8VCBleHRlbmRzIENPLCBLIGV4dGVuZHMgQ08+KGNvbmZpZzogQUJDb25maWc8VCwgSz4pOiBVbnN1YnNjcmliZTtcbiAgcHVibGljIGFkZE9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVTdGFydChjb25maWc6IEludGVybmFsQ29sbGlkZUNvbmZpZyk6IFVuc3Vic2NyaWJlIHtcbiAgICAvLyBOb3RlOiB0aGUgb3JkZXIgb2Ygb3ZlcmxvYWRzIGlzIGltcG9ydGFudCEgVFMgbWF0Y2hlcyB0aGUgZmlyc3Qgb25lIGl0IGNhbiwgc28gdGhpcyBuZWVkc1xuICAgIC8vIHRoZSBtb3N0IHNwZWNpZmljL2NvbnN0cmFpbmVkIHNpZ25hdHVyZSBmaXJzdC5cbiAgICB0aGlzLmFkZE9uQ29sbGlkZSh0aGlzLmNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzLCBjb25maWcpO1xuICAgIHJldHVybiAoKSA9PiB0aGlzLnJlbW92ZU9uQ29sbGlkZSh0aGlzLmNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNhZGRPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIGFkZE9uQ29sbGlkZUVuZDxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQkNvbmZpZzxULCBLPik6IFVuc3Vic2NyaWJlO1xuICBwdWJsaWMgYWRkT25Db2xsaWRlRW5kPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVFbmQoY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiBVbnN1YnNjcmliZSB7XG4gICAgdGhpcy5hZGRPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25FbmRMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gICAgcmV0dXJuICgpID0+IHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNhZGRPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIGFkZE9uQ29sbGlkZUFjdGl2ZTxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQkNvbmZpZzxULCBLPik6IFVuc3Vic2NyaWJlO1xuICBwdWJsaWMgYWRkT25Db2xsaWRlQWN0aXZlPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVBY3RpdmUoY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiBVbnN1YnNjcmliZSB7XG4gICAgdGhpcy5hZGRPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gICAgcmV0dXJuICgpID0+IHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uQWN0aXZlTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqXG4gICAqIFJlbW92ZSBhbnkgbGlzdGVuZXJzIHRoYXQgd2VyZSBhZGRlZCB3aXRoIGFkZE9uQ29sbGlkZVN0YXJ0LiBJZiBvYmplY3RCLCBjYWxsYmFjayBvciBjb250ZXh0XG4gICAqIHBhcmFtZXRlcnMgYXJlIG9taXR0ZWQsIGFueSBsaXN0ZW5lciBtYXRjaGluZyB0aGUgcmVtYWluaW5nIHBhcmFtZXRlcnMgd2lsbCBiZSByZW1vdmVkLiBFLmcuIGlmXG4gICAqIHlvdSBvbmx5IHNwZWNpZnkgb2JqZWN0QSBhbmQgb2JqZWN0QiwgYWxsIGxpc3RlbmVycyB3aXRoIG9iamVjdEEgJiBvYmplY3RCIHdpbGwgYmUgcmVtb3ZlZFxuICAgKiByZWdhcmRsZXNzIG9mIHRoZSBjYWxsYmFjayBvciBjb250ZXh0LlxuICAgKi9cbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTywgSyBleHRlbmRzIENPPihjb25maWc6IFJlbW92ZUFCQ29uZmlnPFQsIEs+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQ29uZmlnPFQ+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0KGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgdGhpcy5yZW1vdmVPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycywgY29uZmlnKTtcbiAgfVxuXG4gIC8qKiBUaGlzIG1ldGhvZCBtaXJyb3JzIHtAbGluayBNYXR0ZXJDb2xsaXNpb25QbHVnaW4jcmVtb3ZlT25Db2xsaWRlU3RhcnR9ICovXG4gIHB1YmxpYyByZW1vdmVPbkNvbGxpZGVFbmQ8VCBleHRlbmRzIENPLCBLIGV4dGVuZHMgQ08+KGNvbmZpZzogUmVtb3ZlQUJDb25maWc8VCwgSz4pOiB2b2lkO1xuICBwdWJsaWMgcmVtb3ZlT25Db2xsaWRlRW5kPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQ29uZmlnPFQ+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZUVuZChjb25maWc6IEludGVybmFsQ29sbGlkZVJlbW92ZUNvbmZpZykge1xuICAgIHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNyZW1vdmVPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZUFjdGl2ZTxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQkNvbmZpZzxULCBLPik6IHZvaWQ7XG4gIHB1YmxpYyByZW1vdmVPbkNvbGxpZGVBY3RpdmU8VCBleHRlbmRzIENPPihjb25maWc6IFJlbW92ZUFDb25maWc8VD4pOiB2b2lkO1xuICBwdWJsaWMgcmVtb3ZlT25Db2xsaWRlQWN0aXZlKGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgdGhpcy5yZW1vdmVPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gIH1cblxuICAvKiogUmVtb3ZlIGFueSBsaXN0ZW5lcnMgdGhhdCB3ZXJlIGFkZGVkIHdpdGggYWRkT25Db2xsaWRlU3RhcnQuICovXG4gIHB1YmxpYyByZW1vdmVBbGxDb2xsaWRlU3RhcnRMaXN0ZW5lcnMoKSB7XG4gICAgdGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycy5jbGVhcigpO1xuICB9XG5cbiAgLyoqIFJlbW92ZSBhbnkgbGlzdGVuZXJzIHRoYXQgd2VyZSBhZGRlZCB3aXRoIGFkZE9uQ29sbGlkZUFjdGl2ZS4gKi9cbiAgcHVibGljIHJlbW92ZUFsbENvbGxpZGVBY3RpdmVMaXN0ZW5lcnMoKSB7XG4gICAgdGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMuY2xlYXIoKTtcbiAgfVxuXG4gIC8qKiBSZW1vdmUgYW55IGxpc3RlbmVycyB0aGF0IHdlcmUgYWRkZWQgd2l0aCBhZGRPbkNvbGxpZGVFbmQuICovXG4gIHB1YmxpYyByZW1vdmVBbGxDb2xsaWRlRW5kTGlzdGVuZXJzKCkge1xuICAgIHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLmNsZWFyKCk7XG4gIH1cblxuICAvKipcbiAgICogUmVtb3ZlIGFueSBsaXN0ZW5lcnMgdGhhdCB3ZXJlIGFkZGVkIHdpdGggYWRkT25Db2xsaWRlU3RhcnQsIGFkZE9uQ29sbGlkZUFjdGl2ZSBvclxuICAgKiBhZGRPbkNvbGxpZGVFbmQuXG4gICAqL1xuICBwdWJsaWMgcmVtb3ZlQWxsQ29sbGlkZUxpc3RlbmVycygpIHtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVTdGFydExpc3RlbmVycygpO1xuICAgIHRoaXMucmVtb3ZlQWxsQ29sbGlkZUFjdGl2ZUxpc3RlbmVycygpO1xuICAgIHRoaXMucmVtb3ZlQWxsQ29sbGlkZUVuZExpc3RlbmVycygpO1xuICB9XG5cbiAgcHJpdmF0ZSBhZGRPbkNvbGxpZGUobWFwOiBMaXN0ZW5lck1hcCwgY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiB2b2lkIHtcbiAgICBjb25zdCB7IGNvbnRleHQsIGNhbGxiYWNrLCBvYmplY3RBLCBvYmplY3RCIH0gPSBjb25maWc7XG4gICAgaWYgKCFjYWxsYmFjayB8fCB0eXBlb2YgY2FsbGJhY2sgIT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgbG9nZ2VyLndhcm4oYE5vIHZhbGlkIGNhbGxiYWNrIHNwZWNpZmllZC4gUmVjZWl2ZWQ6ICR7Y2FsbGJhY2t9YCk7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGNvbnN0IG9iamVjdHNBID0gQXJyYXkuaXNBcnJheShvYmplY3RBKSA/IG9iamVjdEEgOiBbb2JqZWN0QV07XG4gICAgY29uc3Qgb2JqZWN0c0IgPSBBcnJheS5pc0FycmF5KG9iamVjdEIpID8gb2JqZWN0QiA6IFtvYmplY3RCXTtcbiAgICBvYmplY3RzQS5mb3JFYWNoKChhKSA9PiB7XG4gICAgICBvYmplY3RzQi5mb3JFYWNoKChiKSA9PiB7XG4gICAgICAgIHRoaXMuYWRkT25Db2xsaWRlT2JqZWN0VnNPYmplY3QobWFwLCBhLCBiLCBjYWxsYmFjaywgY29udGV4dCk7XG4gICAgICB9KTtcbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgcmVtb3ZlT25Db2xsaWRlKG1hcDogTGlzdGVuZXJNYXAsIGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgY29uc3QgeyBjb250ZXh0LCBjYWxsYmFjaywgb2JqZWN0QSwgb2JqZWN0QiB9ID0gY29uZmlnO1xuICAgIGNvbnN0IG9iamVjdHNBID0gQXJyYXkuaXNBcnJheShvYmplY3RBKSA/IG9iamVjdEEgOiBbb2JqZWN0QV07XG4gICAgY29uc3Qgb2JqZWN0c0IgPSBBcnJheS5pc0FycmF5KG9iamVjdEIpID8gb2JqZWN0QiA6IFtvYmplY3RCXTtcbiAgICBvYmplY3RzQS5mb3JFYWNoKChhKSA9PiB7XG4gICAgICBjb25zdCBjYWxsYmFja3MgPSBtYXAuZ2V0KGEpIHx8IFtdO1xuICAgICAgY29uc3QgcmVtYWluaW5nQ2FsbGJhY2tzID0gY2FsbGJhY2tzLmZpbHRlcigoY2IpID0+IHtcbiAgICAgICAgLy8gSWYgYW55dGhpbmcgZG9lc24ndCBtYXRjaCBhIHByb3ZpZGVkIGNvbmZpZyB2YWx1ZSAoaS5lLiBhbnl0aGluZyBvdGhlciB0aGFuIHVuZGVmaW5lZCksXG4gICAgICAgIC8vIHdlIGNhbiBiYWlsIGFuZCBrZWVwIGxpc3RlbmVyLlxuICAgICAgICBpZiAoY29udGV4dCAhPT0gdW5kZWZpbmVkICYmIGNiLmNvbnRleHQgIT09IGNvbnRleHQpIHJldHVybiB0cnVlO1xuICAgICAgICBpZiAoY2FsbGJhY2sgIT09IHVuZGVmaW5lZCAmJiBjYi5jYWxsYmFjayAhPT0gY2FsbGJhY2spIHJldHVybiB0cnVlO1xuICAgICAgICBpZiAob2JqZWN0QiAhPT0gdW5kZWZpbmVkICYmICFvYmplY3RzQi5pbmNsdWRlcyhjYi50YXJnZXQpKSByZXR1cm4gdHJ1ZTtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfSk7XG4gICAgICBpZiAocmVtYWluaW5nQ2FsbGJhY2tzLmxlbmd0aCA+IDApIG1hcC5zZXQoYSwgcmVtYWluaW5nQ2FsbGJhY2tzKTtcbiAgICAgIGVsc2UgbWFwLmRlbGV0ZShhKTtcbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgYWRkT25Db2xsaWRlT2JqZWN0VnNPYmplY3QoXG4gICAgbWFwOiBMaXN0ZW5lck1hcCxcbiAgICBvYmplY3RBOiBDTyxcbiAgICBvYmplY3RCOiBDTyB8IHVuZGVmaW5lZCxcbiAgICBjYWxsYmFjazogQ29sbGlkZUNhbGxiYWNrPENPLCBDTz4sXG4gICAgY29udGV4dDogQ29sbGlkZUNvbnRleHQgfCB1bmRlZmluZWRcbiAgKSB7XG4gICAgLy8gQ2FuJ3QgZG8gYW55dGhpbmcgaWYgdGhlIGZpcnN0IG9iamVjdCBpcyBub3QgZGVmaW5lZCBvciBpbnZhbGlkLlxuICAgIGlmICghb2JqZWN0QSB8fCAhaXNDb2xsaWRpbmdPYmplY3Qob2JqZWN0QSkpIHtcbiAgICAgIHdhcm5JbnZhbGlkT2JqZWN0KG9iamVjdEEpO1xuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIC8vIFRoZSBzZWNvbmQgb2JqZWN0IGNhbiBiZSB1bmRlZmluZWQgb3IgYSB2YWxpZCBib2R5LlxuICAgIGlmIChvYmplY3RCICYmICFpc0NvbGxpZGluZ09iamVjdChvYmplY3RCKSkge1xuICAgICAgd2FybkludmFsaWRPYmplY3Qob2JqZWN0QSk7XG4gICAgICByZXR1cm47XG4gICAgfVxuXG4gICAgY29uc3QgY2FsbGJhY2tzID0gbWFwLmdldChvYmplY3RBKSB8fCBbXTtcbiAgICBjYWxsYmFja3MucHVzaCh7IHRhcmdldDogb2JqZWN0QiwgY2FsbGJhY2ssIGNvbnRleHQgfSk7XG4gICAgbWFwLnNldChvYmplY3RBLCBjYWxsYmFja3MpO1xuICB9XG5cbiAgcHJpdmF0ZSBvbkNvbGxpc2lvblN0YXJ0KGV2ZW50OiBNYXR0ZXJFdmVudHMuQ29sbGlzaW9uQWN0aXZlRXZlbnQpIHtcbiAgICB0aGlzLm9uQ29sbGlzaW9uRXZlbnQodGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycywgQ09MTElTSU9OX1NUQVJULCBldmVudCk7XG4gIH1cblxuICBwcml2YXRlIG9uQ29sbGlzaW9uRW5kKGV2ZW50OiBNYXR0ZXJFdmVudHMuQ29sbGlzaW9uRW5kRXZlbnQpIHtcbiAgICB0aGlzLm9uQ29sbGlzaW9uRXZlbnQodGhpcy5jb2xsaXNpb25FbmRMaXN0ZW5lcnMsIENPTExJU0lPTl9FTkQsIGV2ZW50KTtcbiAgfVxuXG4gIHByaXZhdGUgb25Db2xsaXNpb25BY3RpdmUoZXZlbnQ6IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudCkge1xuICAgIHRoaXMub25Db2xsaXNpb25FdmVudCh0aGlzLmNvbGxpc2lvbkFjdGl2ZUxpc3RlbmVycywgQ09MTElTSU9OX0FDVElWRSwgZXZlbnQpO1xuICB9XG5cbiAgLyoqXG4gICAqIFJldXNhYmxlIGhhbmRsZXIgZm9yIGNvbGxpc2lvbnN0YXJ0LCBjb2xsaXNpb25lbmQsIGNvbGxpc2lvbmFjdGl2ZS5cbiAgICogKi9cbiAgcHJpdmF0ZSBvbkNvbGxpc2lvbkV2ZW50KFxuICAgIGxpc3RlbmVyTWFwOiBMaXN0ZW5lck1hcCxcbiAgICBldmVudE5hbWU6IHN0cmluZyxcbiAgICBldmVudDogTWF0dGVyQ29sbGlzaW9uRXZlbnRcbiAgKSB7XG4gICAgY29uc3QgcGFpcnMgPSBldmVudC5wYWlycyBhcyBFeHRlbmRlZE1hdHRlckNvbGxpc2lvbkRhdGFbXTtcbiAgICBjb25zdCBwYWlyRXZlbnROYW1lID0gXCJwYWlyXCIgKyBldmVudE5hbWU7XG4gICAgY29uc3QgZXZlbnREYXRhOiBQYXJ0aWFsPEV2ZW50RGF0YTxDTywgQ08+PiA9IHsgaXNSZXZlcnNlZDogZmFsc2UgfTtcbiAgICBjb25zdCBldmVudERhdGFSZXZlcnNlZDogUGFydGlhbDxFdmVudERhdGE8Q08sIENPPj4gPSB7IGlzUmV2ZXJzZWQ6IHRydWUgfTtcblxuICAgIHBhaXJzLm1hcCgocGFpciwgaSkgPT4ge1xuICAgICAgY29uc3QgeyBib2R5QSwgYm9keUIgfSA9IHBhaXI7XG4gICAgICBjb25zdCByb290Qm9keUEgPSBnZXRSb290Qm9keShib2R5QSk7XG4gICAgICBjb25zdCByb290Qm9keUIgPSBnZXRSb290Qm9keShib2R5Qik7XG4gICAgICBsZXQgZ2FtZU9iamVjdEE6IENPIHwgdW5kZWZpbmVkID0gcm9vdEJvZHlBLmdhbWVPYmplY3QgPz8gdW5kZWZpbmVkO1xuICAgICAgbGV0IGdhbWVPYmplY3RCOiBDTyB8IHVuZGVmaW5lZCA9IHJvb3RCb2R5Qi5nYW1lT2JqZWN0ID8/IHVuZGVmaW5lZDtcblxuICAgICAgLy8gU3BlY2lhbCBjYXNlIGZvciB0aWxlcywgd2hlcmUgaXQncyBtb3JlIHVzZWZ1bCB0byBoYXZlIGEgcmVmZXJlbmNlIHRvIHRoZSBUaWxlIG9iamVjdCBub3RcbiAgICAgIC8vIHRoZSBUaWxlQm9keS4gVGhpcyBpcyBob3QgY29kZSwgc28gdXNlIGEgcHJvcGVydHkgY2hlY2sgaW5zdGVhZCBvZiBpbnN0YW5jZW9mLlxuICAgICAgaWYgKGdhbWVPYmplY3RBICYmIGdhbWVPYmplY3RBIGluc3RhbmNlb2YgTWF0dGVyLlRpbGVCb2R5KSB7XG4gICAgICAgIGdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEEudGlsZTtcbiAgICAgIH1cbiAgICAgIGlmIChnYW1lT2JqZWN0QiAmJiBnYW1lT2JqZWN0QiBpbnN0YW5jZW9mIE1hdHRlci5UaWxlQm9keSkge1xuICAgICAgICBnYW1lT2JqZWN0QiA9IGdhbWVPYmplY3RCLnRpbGU7XG4gICAgICB9XG5cbiAgICAgIHBhaXJzW2ldLmdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEEgPz8gdW5kZWZpbmVkO1xuICAgICAgcGFpcnNbaV0uZ2FtZU9iamVjdEIgPSBnYW1lT2JqZWN0QiA/PyB1bmRlZmluZWQ7XG5cbiAgICAgIGV2ZW50RGF0YS5ib2R5QSA9IGJvZHlBO1xuICAgICAgZXZlbnREYXRhLmJvZHlCID0gYm9keUI7XG4gICAgICBldmVudERhdGEuZ2FtZU9iamVjdEEgPSBnYW1lT2JqZWN0QSA/PyB1bmRlZmluZWQ7XG4gICAgICBldmVudERhdGEuZ2FtZU9iamVjdEIgPSBnYW1lT2JqZWN0QiA/PyB1bmRlZmluZWQ7XG4gICAgICBldmVudERhdGEucGFpciA9IHBhaXI7XG5cbiAgICAgIHRoaXMuZXZlbnRzLmVtaXQocGFpckV2ZW50TmFtZSwgZXZlbnREYXRhKTtcblxuICAgICAgaWYgKGxpc3RlbmVyTWFwLnNpemUgPiAwKSB7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmJvZHlCID0gYm9keUE7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmJvZHlBID0gYm9keUI7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmdhbWVPYmplY3RCID0gZ2FtZU9iamVjdEE7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEI7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLnBhaXIgPSBwYWlyO1xuXG4gICAgICAgIGNvbnN0IGRhdGEgPSBldmVudERhdGEgYXMgRXZlbnREYXRhPENPLCBDTz47XG4gICAgICAgIGNvbnN0IGRhdGFSZXZlcnNlZCA9IGV2ZW50RGF0YVJldmVyc2VkIGFzIEV2ZW50RGF0YTxDTywgQ08+O1xuXG4gICAgICAgIHRoaXMuY2hlY2tQYWlyQW5kRW1pdChsaXN0ZW5lck1hcCwgYm9keUEsIGJvZHlCLCBnYW1lT2JqZWN0QiwgZGF0YSk7XG4gICAgICAgIHRoaXMuY2hlY2tQYWlyQW5kRW1pdChsaXN0ZW5lck1hcCwgYm9keUIsIGJvZHlBLCBnYW1lT2JqZWN0QSwgZGF0YVJldmVyc2VkKTtcblxuICAgICAgICBpZiAoZ2FtZU9iamVjdEEpIHtcbiAgICAgICAgICB0aGlzLmNoZWNrUGFpckFuZEVtaXQobGlzdGVuZXJNYXAsIGdhbWVPYmplY3RBLCBib2R5QiwgZ2FtZU9iamVjdEIsIGRhdGEpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGdhbWVPYmplY3RCKSB7XG4gICAgICAgICAgdGhpcy5jaGVja1BhaXJBbmRFbWl0KGxpc3RlbmVyTWFwLCBnYW1lT2JqZWN0QiwgYm9keUEsIGdhbWVPYmplY3RBLCBkYXRhUmV2ZXJzZWQpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICB0aGlzLmV2ZW50cy5lbWl0KGV2ZW50TmFtZSwgZXZlbnQpO1xuICB9XG5cbiAgcHJpdmF0ZSBjaGVja1BhaXJBbmRFbWl0KFxuICAgIG1hcDogTGlzdGVuZXJNYXAsXG4gICAgb2JqZWN0QTogQ08sXG4gICAgYm9keUI6IE1hdHRlckpTLkJvZHksXG4gICAgZ2FtZU9iamVjdEI6IENPIHwgdW5kZWZpbmVkLFxuICAgIGV2ZW50RGF0YTogRXZlbnREYXRhPENPLCBDTz5cbiAgKSB7XG4gICAgY29uc3QgY2FsbGJhY2tzID0gbWFwLmdldChvYmplY3RBKTtcbiAgICBpZiAoY2FsbGJhY2tzKSB7XG4gICAgICBjYWxsYmFja3MuZm9yRWFjaCgoeyB0YXJnZXQsIGNhbGxiYWNrLCBjb250ZXh0IH0pID0+IHtcbiAgICAgICAgaWYgKCF0YXJnZXQgfHwgdGFyZ2V0ID09PSBib2R5QiB8fCB0YXJnZXQgPT09IGdhbWVPYmplY3RCKSB7XG4gICAgICAgICAgY2FsbGJhY2suY2FsbChjb250ZXh0LCBldmVudERhdGEpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9XG4gIH1cblxuICBzdWJzY3JpYmVNYXR0ZXJFdmVudHMoKSB7XG4gICAgY29uc3QgbWF0dGVyID0gdGhpcy5zY2VuZS5tYXR0ZXI7XG4gICAgaWYgKCFtYXR0ZXIgfHwgIW1hdHRlci53b3JsZCkge1xuICAgICAgbG9nZ2VyLndhcm4oXCJQbHVnaW4gcmVxdWlyZXMgbWF0dGVyIVwiKTtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgbWF0dGVyLndvcmxkLm9uKENPTExJU0lPTl9TVEFSVCwgdGhpcy5vbkNvbGxpc2lvblN0YXJ0LCB0aGlzKTtcbiAgICBtYXR0ZXIud29ybGQub24oQ09MTElTSU9OX0FDVElWRSwgdGhpcy5vbkNvbGxpc2lvbkFjdGl2ZSwgdGhpcyk7XG4gICAgbWF0dGVyLndvcmxkLm9uKENPTExJU0lPTl9FTkQsIHRoaXMub25Db2xsaXNpb25FbmQsIHRoaXMpO1xuICB9XG5cbiAgdW5zdWJzY3JpYmVNYXR0ZXJFdmVudHMoKSB7XG4gICAgLy8gRG9uJ3QgdW5zdWIgaWYgbWF0dGVyIG5leHQgZXhpc3Rpbmcgb3IgaWYgdGhlIGdhbWUgaXMgZGVzdHJveWVkIChzaW5jZSB0aGUgbWF0dGVyIHdvcmxkIHdpbGxcbiAgICAvLyBiZSBhbHJlYWR5IGdvbmUpXG4gICAgY29uc3QgbWF0dGVyID0gdGhpcy5zY2VuZS5tYXR0ZXI7XG4gICAgaWYgKCFtYXR0ZXIgfHwgIW1hdHRlci53b3JsZCkgcmV0dXJuO1xuICAgIG1hdHRlci53b3JsZC5vZmYoQ09MTElTSU9OX1NUQVJULCB0aGlzLm9uQ29sbGlzaW9uU3RhcnQsIHRoaXMpO1xuICAgIG1hdHRlci53b3JsZC5vZmYoQ09MTElTSU9OX0FDVElWRSwgdGhpcy5vbkNvbGxpc2lvbkFjdGl2ZSwgdGhpcyk7XG4gICAgbWF0dGVyLndvcmxkLm9mZihDT0xMSVNJT05fRU5ELCB0aGlzLm9uQ29sbGlzaW9uRW5kLCB0aGlzKTtcbiAgfVxuXG4gIHN0YXJ0KCkge1xuICAgIC8vIElmIHJlc3RhcnRpbmcsIHVuc3Vic2NyaWJlIGJlZm9yZSByZXN1YnNjcmliaW5nIHRvIGVuc3VyZSBvbmx5IG9uZSBsaXN0ZW5lciBpcyBhZGRlZFxuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihTSFVURE9XTiwgdGhpcy5zaHV0ZG93biwgdGhpcyk7XG4gICAgdGhpcy5zY2VuZS5ldmVudHMub24oU0hVVERPV04sIHRoaXMuc2h1dGRvd24sIHRoaXMpO1xuICAgIHRoaXMuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gIH1cblxuICBzaHV0ZG93bigpIHtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVMaXN0ZW5lcnMoKTtcbiAgICB0aGlzLnVuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gICAgLy8gUmVzdWJzY3JpYmUgdG8gc3RhcnQgc28gdGhhdCB0aGUgcGx1Z2luIGlzIHN0YXJ0ZWQgYWdhaW4gYWZ0ZXIgTWF0dGVyXG4gICAgdGhpcy5zY2VuZS5ldmVudHMub25jZShTVEFSVCwgdGhpcy5zdGFydCwgdGhpcyk7XG4gIH1cblxuICBkZXN0cm95KCkge1xuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihERVNUUk9ZLCB0aGlzLmRlc3Ryb3ksIHRoaXMpO1xuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihTVEFSVCwgdGhpcy5zdGFydCwgdGhpcyk7XG4gICAgdGhpcy5zY2VuZS5ldmVudHMub2ZmKFNIVVRET1dOLCB0aGlzLnNodXRkb3duLCB0aGlzKTtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVMaXN0ZW5lcnMoKTtcbiAgICB0aGlzLnVuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gIH1cbn1cbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./phaser-matter-collision-plugin.ts\n' - ); - }, - "./utils.ts": ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) => { - eval( - '__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "getRootBody": () => (/* binding */ getRootBody),\n/* harmony export */ "warnInvalidObject": () => (/* binding */ warnInvalidObject)\n/* harmony export */ });\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./logger */ "./logger.ts");\n\r\n/**\r\n * Get the root body of a compound Matter body.\r\n */\r\nfunction getRootBody(body) {\r\n while (body.parent !== body)\r\n body = body.parent;\r\n return body;\r\n}\r\n/**\r\n * @param obj\r\n */\r\nfunction warnInvalidObject(obj) {\r\n _logger__WEBPACK_IMPORTED_MODULE_0__.default.warn(`Expected a Matter body, a Tile, a GameObject, a Sprite, an Image, a TileBody, or an object with a body property, but instead, received: ${obj}`);\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi91dGlscy50cz84ODEzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUE4QjtBQUU5Qjs7R0FFRztBQUNJLFNBQVMsV0FBVyxDQUFDLElBQXVCO0lBQ2pELE9BQU8sSUFBSSxDQUFDLE1BQU0sS0FBSyxJQUFJO1FBQUUsSUFBSSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7SUFDaEQsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDO0FBRUQ7O0dBRUc7QUFDSSxTQUFTLGlCQUFpQixDQUFDLEdBQVE7SUFDeEMsaURBQVcsQ0FDVCwySUFBMkksR0FBRyxFQUFFLENBQ2pKLENBQUM7QUFDSixDQUFDIiwiZmlsZSI6Ii4vdXRpbHMudHMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgbG9nZ2VyIGZyb20gXCIuL2xvZ2dlclwiO1xuXG4vKipcbiAqIEdldCB0aGUgcm9vdCBib2R5IG9mIGEgY29tcG91bmQgTWF0dGVyIGJvZHkuXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBnZXRSb290Qm9keShib2R5OiBNYXR0ZXJKUy5Cb2R5VHlwZSkge1xuICB3aGlsZSAoYm9keS5wYXJlbnQgIT09IGJvZHkpIGJvZHkgPSBib2R5LnBhcmVudDtcbiAgcmV0dXJuIGJvZHk7XG59XG5cbi8qKlxuICogQHBhcmFtIG9ialxuICovXG5leHBvcnQgZnVuY3Rpb24gd2FybkludmFsaWRPYmplY3Qob2JqOiBhbnkpIHtcbiAgbG9nZ2VyLndhcm4oXG4gICAgYEV4cGVjdGVkIGEgTWF0dGVyIGJvZHksIGEgVGlsZSwgYSBHYW1lT2JqZWN0LCBhIFNwcml0ZSwgYW4gSW1hZ2UsIGEgVGlsZUJvZHksIG9yIGFuIG9iamVjdCB3aXRoIGEgYm9keSBwcm9wZXJ0eSwgYnV0IGluc3RlYWQsIHJlY2VpdmVkOiAke29ian1gXG4gICk7XG59XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./utils.ts\n' - ); - }, - "./valid-collision-object.ts": ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) => { - eval( - '__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "isMatterBody": () => (/* binding */ isMatterBody),\n/* harmony export */ "isCollidingObject": () => (/* binding */ isCollidingObject)\n/* harmony export */ });\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! phaser */ "phaser");\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(phaser__WEBPACK_IMPORTED_MODULE_0__);\n\r\nvar Tile = phaser__WEBPACK_IMPORTED_MODULE_0__.Tilemaps.Tile;\r\n/** Duck type to check if the given object is a Matter body (because there isn\'t a prototype). */\r\nfunction isMatterBody(obj) {\r\n return (obj.hasOwnProperty("parts") && obj.hasOwnProperty("slop") && obj.hasOwnProperty("gameObject"));\r\n}\r\n/**\r\n * Check if object is an acceptable physical object for this plugin - a Matter Body, a tile, or an\r\n * object with a body property.\r\n */\r\nfunction isCollidingObject(obj) {\r\n // GameObjects, images, sprites and tile bodies should all have a body property.\r\n return isMatterBody(obj) || obj.body || obj instanceof Tile;\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0LnRzP2QxM2YiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUF5QztBQUV6QyxJQUFPLElBQUksR0FBRyxpREFBYSxDQUFDO0FBYzVCLGlHQUFpRztBQUMxRixTQUFTLFlBQVksQ0FBQyxHQUFRO0lBQ25DLE9BQU8sQ0FDTCxHQUFHLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxJQUFJLEdBQUcsQ0FBQyxjQUFjLENBQUMsTUFBTSxDQUFDLElBQUksR0FBRyxDQUFDLGNBQWMsQ0FBQyxZQUFZLENBQUMsQ0FDOUYsQ0FBQztBQUNKLENBQUM7QUFFRDs7O0dBR0c7QUFDSSxTQUFTLGlCQUFpQixDQUFDLEdBQVE7SUFDeEMsZ0ZBQWdGO0lBQ2hGLE9BQU8sWUFBWSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEdBQUcsQ0FBQyxJQUFJLElBQUksR0FBRyxZQUFZLElBQUksQ0FBQztBQUM5RCxDQUFDIiwiZmlsZSI6Ii4vdmFsaWQtY29sbGlzaW9uLW9iamVjdC50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFRpbGVtYXBzLCBUeXBlcyB9IGZyb20gXCJwaGFzZXJcIjtcblxuaW1wb3J0IFRpbGUgPSBUaWxlbWFwcy5UaWxlO1xuaW1wb3J0IE1hdHRlckJvZHkgPSBUeXBlcy5QaHlzaWNzLk1hdHRlci5NYXR0ZXJCb2R5O1xuXG4vKiogQSB2YWxpZCBwaHlzaWNzLWVuYWJsZWQgZ2FtZSBvYmplY3QsIG9yIGp1c3QgYW4gb2JqZWN0IHRoYXQgaGFzIFwiYm9keVwiIHByb3BlcnR5ICovXG5leHBvcnQgdHlwZSBPYmplY3RXaXRoQm9keSA9IHtcbiAgYm9keTogTWF0dGVySlMuQm9keVR5cGU7XG59O1xuXG4vKipcbiAqIEEgdW5pb24gb2YgYWxsIHRoZSB0eXBlcyBvZiBwaHlzaWNzIG9iamVjdHMgd2UgY291bGQgaGF2ZSBpbiB0aGUgc2ltdWxhdGlvbiAtIGZyb20gcmF3IE1hdHRlci5qc1xuICogYm9kaWVzIHRvIHRpbGVzIGFuZCBwaHlzaWNzLWVuYWJsZWQgUGhhc2VyIEdhbWVPYmplY3RzLlxuICovXG5leHBvcnQgdHlwZSBDb2xsaWRpbmdPYmplY3QgPSBNYXR0ZXJCb2R5IHwgTWF0dGVySlMuQm9keVR5cGUgfCBUaWxlIHwgT2JqZWN0V2l0aEJvZHk7XG5cbi8qKiBEdWNrIHR5cGUgdG8gY2hlY2sgaWYgdGhlIGdpdmVuIG9iamVjdCBpcyBhIE1hdHRlciBib2R5IChiZWNhdXNlIHRoZXJlIGlzbid0IGEgcHJvdG90eXBlKS4gKi9cbmV4cG9ydCBmdW5jdGlvbiBpc01hdHRlckJvZHkob2JqOiBhbnkpOiBvYmogaXMgTWF0dGVyQm9keSB7XG4gIHJldHVybiAoXG4gICAgb2JqLmhhc093blByb3BlcnR5KFwicGFydHNcIikgJiYgb2JqLmhhc093blByb3BlcnR5KFwic2xvcFwiKSAmJiBvYmouaGFzT3duUHJvcGVydHkoXCJnYW1lT2JqZWN0XCIpXG4gICk7XG59XG5cbi8qKlxuICogQ2hlY2sgaWYgb2JqZWN0IGlzIGFuIGFjY2VwdGFibGUgcGh5c2ljYWwgb2JqZWN0IGZvciB0aGlzIHBsdWdpbiAtIGEgTWF0dGVyIEJvZHksIGEgdGlsZSwgb3IgYW5cbiAqIG9iamVjdCB3aXRoIGEgYm9keSBwcm9wZXJ0eS5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGlzQ29sbGlkaW5nT2JqZWN0KG9iajogYW55KTogb2JqIGlzIENvbGxpZGluZ09iamVjdCB7XG4gIC8vIEdhbWVPYmplY3RzLCBpbWFnZXMsIHNwcml0ZXMgYW5kIHRpbGUgYm9kaWVzIHNob3VsZCBhbGwgaGF2ZSBhIGJvZHkgcHJvcGVydHkuXG4gIHJldHVybiBpc01hdHRlckJvZHkob2JqKSB8fCBvYmouYm9keSB8fCBvYmogaW5zdGFuY2VvZiBUaWxlO1xufVxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./valid-collision-object.ts\n' - ); - }, - phaser: (t) => { - t.exports = __WEBPACK_EXTERNAL_MODULE_phaser__; - }, - }, - __webpack_module_cache__ = {}; - function __webpack_require__(t) { - var e = __webpack_module_cache__[t]; - if (void 0 !== e) return e.exports; - var s = (__webpack_module_cache__[t] = { exports: {} }); - return ( - __webpack_modules__[t](s, s.exports, __webpack_require__), s.exports - ); - } - (__webpack_require__.n = (t) => { - var e = t && t.__esModule ? () => t.default : () => t; - return __webpack_require__.d(e, { a: e }), e; - }), - (__webpack_require__.d = (t, e) => { - for (var s in e) - __webpack_require__.o(e, s) && - !__webpack_require__.o(t, s) && - Object.defineProperty(t, s, { enumerable: !0, get: e[s] }); - }), - (__webpack_require__.o = (t, e) => - Object.prototype.hasOwnProperty.call(t, e)), - (__webpack_require__.r = (t) => { - "undefined" != typeof Symbol && - Symbol.toStringTag && - Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), - Object.defineProperty(t, "__esModule", { value: !0 }); - }); - var __webpack_exports__ = __webpack_require__("./index.ts"); - return __webpack_exports__; - })(); - }), - (module.exports = factory(requirePhaser())); -})(phaserMatterCollision); -var phaserMatterCollisionExports = phaserMatterCollision.exports; -const PhaserMatterCollisionPlugin = getDefaultExportFromCjs( - phaserMatterCollisionExports -); -class MatterGravityFixPlugin extends Phaser.Plugins.ScenePlugin { - constructor(t, e) { - super(t, e); - } - boot() { - const t = Phaser.Physics.Matter.Matter; - this.applyGravityFix(t); - } - applyGravityFix(t) { - t.Engine._bodiesApplyGravity = function (t, e) { - var s = void 0 !== e.scale ? e.scale : 0.001, - i = t.length; - if ((0 !== e.x || 0 !== e.y) && 0 !== s) - for (var n = 0; n < i; n++) { - var o = t[n]; - o.ignoreGravity || - o.isStatic || - o.isSleeping || - ((o.force.y += o.mass * e.y * s), (o.force.x += o.mass * e.x * s)); - } - }; - } -} -const config = { - width: 600, - height: 600, - scale: { mode: Phaser$1.Scale.FIT, autoCenter: Phaser$1.Scale.CENTER_BOTH }, - autoRound: !1, - parent: "game-container", - physics: { default: "matter", matter: { debug: !1 } }, - plugins: { - scene: [ - { - plugin: PhaserMatterCollisionPlugin, - key: "matterCollision", - mapping: "matterCollision", - }, - { - key: "MatterGravityFixPlugin", - plugin: MatterGravityFixPlugin, - mapping: "matterGravityFix", - start: !0, - }, - ], - }, - scene: [Bootloader, Splash, Transition, Game, Outro], -}; -new Phaser$1.Game(config); diff --git a/dungeon/dist/assets/index-Cjdkyr6b.js b/dungeon/dist/assets/index-Cjdkyr6b.js new file mode 100644 index 00000000..477694e5 --- /dev/null +++ b/dungeon/dist/assets/index-Cjdkyr6b.js @@ -0,0 +1 @@ +import{r as requirePhaser,g as getDefaultExportFromCjs,c as commonjsGlobal}from"./phaser-D-IeUSbb.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const s of t)if("childList"===s.type)for(const t of s.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();var phaserExports=requirePhaser();const Phaser$1=getDefaultExportFromCjs(phaserExports);var phaserMatterCollision={exports:{}};(function(module,exports){var factory;"undefined"!=typeof self&&self,factory=function(__WEBPACK_EXTERNAL_MODULE_phaser__){return(()=>{var __webpack_modules__={"./index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "PhaserMatterCollisionPlugin": () => (/* reexport safe */ _phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__.default),\n/* harmony export */ "getRootBody": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody),\n/* harmony export */ "isCollidingObject": () => (/* reexport safe */ _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__.isCollidingObject),\n/* harmony export */ "isMatterBody": () => (/* reexport safe */ _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__.isMatterBody),\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./phaser-matter-collision-plugin */ "./phaser-matter-collision-plugin.ts");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./utils.ts");\n/* harmony import */ var _valid_collision_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./valid-collision-object */ "./valid-collision-object.ts");\n\r\n\r\n\r\n\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_phaser_matter_collision_plugin__WEBPACK_IMPORTED_MODULE_0__.default);\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9pbmRleC50cz9hOTU5Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBQTJFO0FBQ3JDO0FBTUo7QUEyQmhDO0FBRUYsaUVBQWUsb0VBQTJCLEVBQUMiLCJmaWxlIjoiLi9pbmRleC50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBQaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4gZnJvbSBcIi4vcGhhc2VyLW1hdHRlci1jb2xsaXNpb24tcGx1Z2luXCI7XG5pbXBvcnQgeyBnZXRSb290Qm9keSB9IGZyb20gXCIuL3V0aWxzXCI7XG5pbXBvcnQge1xuICBpc0NvbGxpZGluZ09iamVjdCxcbiAgaXNNYXR0ZXJCb2R5LFxuICBPYmplY3RXaXRoQm9keSxcbiAgQ29sbGlkaW5nT2JqZWN0LFxufSBmcm9tIFwiLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0XCI7XG5pbXBvcnQge1xuICBFeHRlbmRlZE1hdHRlckNvbGxpc2lvbkRhdGEsXG4gIENvbGxpc2lvbkV2ZW50LFxuICBFdmVudERhdGEsXG4gIENvbGxpZGVDYWxsYmFjayxcbiAgQ29sbGlkZUFDb25maWcsXG4gIENvbGxpZGVBQkNvbmZpZyxcbiAgQ29sbGlkZUNvbnRleHQsXG4gIFVuc3Vic2NyaWJlLFxufSBmcm9tIFwiLi9jb2xsaXNpb24tdHlwZXNcIjtcblxuZXhwb3J0IHtcbiAgUGhhc2VyTWF0dGVyQ29sbGlzaW9uUGx1Z2luLFxuICBnZXRSb290Qm9keSxcbiAgaXNDb2xsaWRpbmdPYmplY3QsXG4gIGlzTWF0dGVyQm9keSxcbiAgT2JqZWN0V2l0aEJvZHksXG4gIENvbGxpZGluZ09iamVjdCxcbiAgRXh0ZW5kZWRNYXR0ZXJDb2xsaXNpb25EYXRhLFxuICBDb2xsaXNpb25FdmVudCxcbiAgRXZlbnREYXRhLFxuICBDb2xsaWRlQ2FsbGJhY2ssXG4gIENvbGxpZGVBQ29uZmlnLFxuICBDb2xsaWRlQUJDb25maWcsXG4gIENvbGxpZGVDb250ZXh0LFxuICBVbnN1YnNjcmliZSxcbn07XG5cbmV4cG9ydCBkZWZhdWx0IFBoYXNlck1hdHRlckNvbGxpc2lvblBsdWdpbjtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./index.ts\n')},"./logger.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\r\n log: console.log,\r\n warn: console.warn,\r\n error: console.error,\r\n});\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9sb2dnZXIudHM/Zjk0OSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsaUVBQWU7SUFDYixHQUFHLEVBQUUsT0FBTyxDQUFDLEdBQUc7SUFDaEIsSUFBSSxFQUFFLE9BQU8sQ0FBQyxJQUFJO0lBQ2xCLEtBQUssRUFBRSxPQUFPLENBQUMsS0FBSztDQUNyQixFQUFDIiwiZmlsZSI6Ii4vbG9nZ2VyLnRzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQge1xuICBsb2c6IGNvbnNvbGUubG9nLFxuICB3YXJuOiBjb25zb2xlLndhcm4sXG4gIGVycm9yOiBjb25zb2xlLmVycm9yLFxufTtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./logger.ts\n')},"./phaser-matter-collision-plugin.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ MatterCollisionPlugin)\n/* harmony export */ });\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! phaser */ "phaser");\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(phaser__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./utils.ts");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ "./logger.ts");\n/* harmony import */ var _valid_collision_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./valid-collision-object */ "./valid-collision-object.ts");\n\r\n\r\n\r\n\r\nvar Matter = phaser__WEBPACK_IMPORTED_MODULE_0__.Physics.Matter;\r\nconst { START, DESTROY, SHUTDOWN } = phaser__WEBPACK_IMPORTED_MODULE_0__.Scenes.Events;\r\nconst { COLLISION_START, COLLISION_ACTIVE, COLLISION_END } = Matter.Events;\r\n/**\r\n * @export\r\n */\r\nclass MatterCollisionPlugin extends phaser__WEBPACK_IMPORTED_MODULE_0__.Plugins.ScenePlugin {\r\n constructor(scene, pluginManager, pluginKey) {\r\n super(scene, pluginManager, pluginKey);\r\n this.scene = scene;\r\n this.pluginManager = pluginManager;\r\n this.events = new phaser__WEBPACK_IMPORTED_MODULE_0__.Events.EventEmitter();\r\n this.collisionStartListeners = new Map();\r\n this.collisionEndListeners = new Map();\r\n this.collisionActiveListeners = new Map();\r\n this.scene = scene;\r\n this.scene.events.once(START, this.start, this);\r\n this.scene.events.once(DESTROY, this.destroy, this);\r\n }\r\n addOnCollideStart(config) {\r\n // Note: the order of overloads is important! TS matches the first one it can, so this needs\r\n // the most specific/constrained signature first.\r\n this.addOnCollide(this.collisionStartListeners, config);\r\n return () => this.removeOnCollide(this.collisionStartListeners, config);\r\n }\r\n addOnCollideEnd(config) {\r\n this.addOnCollide(this.collisionEndListeners, config);\r\n return () => this.removeOnCollide(this.collisionEndListeners, config);\r\n }\r\n addOnCollideActive(config) {\r\n this.addOnCollide(this.collisionActiveListeners, config);\r\n return () => this.removeOnCollide(this.collisionActiveListeners, config);\r\n }\r\n removeOnCollideStart(config) {\r\n this.removeOnCollide(this.collisionStartListeners, config);\r\n }\r\n removeOnCollideEnd(config) {\r\n this.removeOnCollide(this.collisionEndListeners, config);\r\n }\r\n removeOnCollideActive(config) {\r\n this.removeOnCollide(this.collisionActiveListeners, config);\r\n }\r\n /** Remove any listeners that were added with addOnCollideStart. */\r\n removeAllCollideStartListeners() {\r\n this.collisionStartListeners.clear();\r\n }\r\n /** Remove any listeners that were added with addOnCollideActive. */\r\n removeAllCollideActiveListeners() {\r\n this.collisionActiveListeners.clear();\r\n }\r\n /** Remove any listeners that were added with addOnCollideEnd. */\r\n removeAllCollideEndListeners() {\r\n this.collisionEndListeners.clear();\r\n }\r\n /**\r\n * Remove any listeners that were added with addOnCollideStart, addOnCollideActive or\r\n * addOnCollideEnd.\r\n */\r\n removeAllCollideListeners() {\r\n this.removeAllCollideStartListeners();\r\n this.removeAllCollideActiveListeners();\r\n this.removeAllCollideEndListeners();\r\n }\r\n addOnCollide(map, config) {\r\n const { context, callback, objectA, objectB } = config;\r\n if (!callback || typeof callback !== "function") {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__.default.warn(`No valid callback specified. Received: ${callback}`);\r\n return;\r\n }\r\n const objectsA = Array.isArray(objectA) ? objectA : [objectA];\r\n const objectsB = Array.isArray(objectB) ? objectB : [objectB];\r\n objectsA.forEach((a) => {\r\n objectsB.forEach((b) => {\r\n this.addOnCollideObjectVsObject(map, a, b, callback, context);\r\n });\r\n });\r\n }\r\n removeOnCollide(map, config) {\r\n const { context, callback, objectA, objectB } = config;\r\n const objectsA = Array.isArray(objectA) ? objectA : [objectA];\r\n const objectsB = Array.isArray(objectB) ? objectB : [objectB];\r\n objectsA.forEach((a) => {\r\n const callbacks = map.get(a) || [];\r\n const remainingCallbacks = callbacks.filter((cb) => {\r\n // If anything doesn\'t match a provided config value (i.e. anything other than undefined),\r\n // we can bail and keep listener.\r\n if (context !== undefined && cb.context !== context)\r\n return true;\r\n if (callback !== undefined && cb.callback !== callback)\r\n return true;\r\n if (objectB !== undefined && !objectsB.includes(cb.target))\r\n return true;\r\n return false;\r\n });\r\n if (remainingCallbacks.length > 0)\r\n map.set(a, remainingCallbacks);\r\n else\r\n map.delete(a);\r\n });\r\n }\r\n addOnCollideObjectVsObject(map, objectA, objectB, callback, context) {\r\n // Can\'t do anything if the first object is not defined or invalid.\r\n if (!objectA || !(0,_valid_collision_object__WEBPACK_IMPORTED_MODULE_3__.isCollidingObject)(objectA)) {\r\n (0,_utils__WEBPACK_IMPORTED_MODULE_1__.warnInvalidObject)(objectA);\r\n return;\r\n }\r\n // The second object can be undefined or a valid body.\r\n if (objectB && !(0,_valid_collision_object__WEBPACK_IMPORTED_MODULE_3__.isCollidingObject)(objectB)) {\r\n (0,_utils__WEBPACK_IMPORTED_MODULE_1__.warnInvalidObject)(objectA);\r\n return;\r\n }\r\n const callbacks = map.get(objectA) || [];\r\n callbacks.push({ target: objectB, callback, context });\r\n map.set(objectA, callbacks);\r\n }\r\n onCollisionStart(event) {\r\n this.onCollisionEvent(this.collisionStartListeners, COLLISION_START, event);\r\n }\r\n onCollisionEnd(event) {\r\n this.onCollisionEvent(this.collisionEndListeners, COLLISION_END, event);\r\n }\r\n onCollisionActive(event) {\r\n this.onCollisionEvent(this.collisionActiveListeners, COLLISION_ACTIVE, event);\r\n }\r\n /**\r\n * Reusable handler for collisionstart, collisionend, collisionactive.\r\n * */\r\n onCollisionEvent(listenerMap, eventName, event) {\r\n const pairs = event.pairs;\r\n const pairEventName = "pair" + eventName;\r\n const eventData = { isReversed: false };\r\n const eventDataReversed = { isReversed: true };\r\n pairs.map((pair, i) => {\r\n var _a, _b;\r\n const { bodyA, bodyB } = pair;\r\n const rootBodyA = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody)(bodyA);\r\n const rootBodyB = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getRootBody)(bodyB);\r\n let gameObjectA = (_a = rootBodyA.gameObject) !== null && _a !== void 0 ? _a : undefined;\r\n let gameObjectB = (_b = rootBodyB.gameObject) !== null && _b !== void 0 ? _b : undefined;\r\n // Special case for tiles, where it\'s more useful to have a reference to the Tile object not\r\n // the TileBody. This is hot code, so use a property check instead of instanceof.\r\n if (gameObjectA && gameObjectA instanceof Matter.TileBody) {\r\n gameObjectA = gameObjectA.tile;\r\n }\r\n if (gameObjectB && gameObjectB instanceof Matter.TileBody) {\r\n gameObjectB = gameObjectB.tile;\r\n }\r\n pairs[i].gameObjectA = gameObjectA !== null && gameObjectA !== void 0 ? gameObjectA : undefined;\r\n pairs[i].gameObjectB = gameObjectB !== null && gameObjectB !== void 0 ? gameObjectB : undefined;\r\n eventData.bodyA = bodyA;\r\n eventData.bodyB = bodyB;\r\n eventData.gameObjectA = gameObjectA !== null && gameObjectA !== void 0 ? gameObjectA : undefined;\r\n eventData.gameObjectB = gameObjectB !== null && gameObjectB !== void 0 ? gameObjectB : undefined;\r\n eventData.pair = pair;\r\n this.events.emit(pairEventName, eventData);\r\n if (listenerMap.size > 0) {\r\n eventDataReversed.bodyB = bodyA;\r\n eventDataReversed.bodyA = bodyB;\r\n eventDataReversed.gameObjectB = gameObjectA;\r\n eventDataReversed.gameObjectA = gameObjectB;\r\n eventDataReversed.pair = pair;\r\n const data = eventData;\r\n const dataReversed = eventDataReversed;\r\n this.checkPairAndEmit(listenerMap, bodyA, bodyB, gameObjectB, data);\r\n this.checkPairAndEmit(listenerMap, bodyB, bodyA, gameObjectA, dataReversed);\r\n if (gameObjectA) {\r\n this.checkPairAndEmit(listenerMap, gameObjectA, bodyB, gameObjectB, data);\r\n }\r\n if (gameObjectB) {\r\n this.checkPairAndEmit(listenerMap, gameObjectB, bodyA, gameObjectA, dataReversed);\r\n }\r\n }\r\n });\r\n this.events.emit(eventName, event);\r\n }\r\n checkPairAndEmit(map, objectA, bodyB, gameObjectB, eventData) {\r\n const callbacks = map.get(objectA);\r\n if (callbacks) {\r\n callbacks.forEach(({ target, callback, context }) => {\r\n if (!target || target === bodyB || target === gameObjectB) {\r\n callback.call(context, eventData);\r\n }\r\n });\r\n }\r\n }\r\n subscribeMatterEvents() {\r\n const matter = this.scene.matter;\r\n if (!matter || !matter.world) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__.default.warn("Plugin requires matter!");\r\n return;\r\n }\r\n matter.world.on(COLLISION_START, this.onCollisionStart, this);\r\n matter.world.on(COLLISION_ACTIVE, this.onCollisionActive, this);\r\n matter.world.on(COLLISION_END, this.onCollisionEnd, this);\r\n }\r\n unsubscribeMatterEvents() {\r\n // Don\'t unsub if matter next existing or if the game is destroyed (since the matter world will\r\n // be already gone)\r\n const matter = this.scene.matter;\r\n if (!matter || !matter.world)\r\n return;\r\n matter.world.off(COLLISION_START, this.onCollisionStart, this);\r\n matter.world.off(COLLISION_ACTIVE, this.onCollisionActive, this);\r\n matter.world.off(COLLISION_END, this.onCollisionEnd, this);\r\n }\r\n start() {\r\n // If restarting, unsubscribe before resubscribing to ensure only one listener is added\r\n this.scene.events.off(SHUTDOWN, this.shutdown, this);\r\n this.scene.events.on(SHUTDOWN, this.shutdown, this);\r\n this.subscribeMatterEvents();\r\n }\r\n shutdown() {\r\n this.removeAllCollideListeners();\r\n this.unsubscribeMatterEvents();\r\n // Resubscribe to start so that the plugin is started again after Matter\r\n this.scene.events.once(START, this.start, this);\r\n }\r\n destroy() {\r\n this.scene.events.off(DESTROY, this.destroy, this);\r\n this.scene.events.off(START, this.start, this);\r\n this.scene.events.off(SHUTDOWN, this.shutdown, this);\r\n this.removeAllCollideListeners();\r\n this.unsubscribeMatterEvents();\r\n }\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi9waGFzZXItbWF0dGVyLWNvbGxpc2lvbi1wbHVnaW4udHM/OGI5OCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBMkU7QUFDbEI7QUFDM0I7QUFDc0Q7QUFnQnBGLElBQU8sTUFBTSxHQUFHLGtEQUFjLENBQUM7QUFFL0IsTUFBTSxFQUFFLEtBQUssRUFBRSxPQUFPLEVBQUUsUUFBUSxFQUFFLEdBQUcsaURBQWEsQ0FBQztBQUNuRCxNQUFNLEVBQUUsZUFBZSxFQUFFLGdCQUFnQixFQUFFLGFBQWEsRUFBRSxHQUFHLE1BQU0sQ0FBQyxNQUFNLENBQUM7QUFPM0U7O0dBRUc7QUFDWSxNQUFNLHFCQUFzQixTQUFRLHVEQUFtQjtJQU9wRSxZQUNZLEtBQVksRUFDWixhQUFvQyxFQUM5QyxTQUFpQjtRQUVqQixLQUFLLENBQUMsS0FBSyxFQUFFLGFBQWEsRUFBRSxTQUFTLENBQUMsQ0FBQztRQUo3QixVQUFLLEdBQUwsS0FBSyxDQUFPO1FBQ1osa0JBQWEsR0FBYixhQUFhLENBQXVCO1FBUnpDLFdBQU0sR0FBRyxJQUFJLHVEQUFtQixFQUFFLENBQUM7UUFFbEMsNEJBQXVCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFDakQsMEJBQXFCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFDL0MsNkJBQXdCLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7UUFReEQsSUFBSSxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7UUFDbkIsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ2hELElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQztJQUN0RCxDQUFDO0lBVU0saUJBQWlCLENBQUMsTUFBNkI7UUFDcEQsNEZBQTRGO1FBQzVGLGlEQUFpRDtRQUNqRCxJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyx1QkFBdUIsRUFBRSxNQUFNLENBQUMsQ0FBQztRQUN4RCxPQUFPLEdBQUcsRUFBRSxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQzFFLENBQUM7SUFLTSxlQUFlLENBQUMsTUFBNkI7UUFDbEQsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMscUJBQXFCLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDdEQsT0FBTyxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxxQkFBcUIsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUN4RSxDQUFDO0lBS00sa0JBQWtCLENBQUMsTUFBNkI7UUFDckQsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsd0JBQXdCLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFDekQsT0FBTyxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUMzRSxDQUFDO0lBVU0sb0JBQW9CLENBQUMsTUFBbUM7UUFDN0QsSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsdUJBQXVCLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFDN0QsQ0FBQztJQUtNLGtCQUFrQixDQUFDLE1BQW1DO1FBQzNELElBQUksQ0FBQyxlQUFlLENBQUMsSUFBSSxDQUFDLHFCQUFxQixFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQzNELENBQUM7SUFLTSxxQkFBcUIsQ0FBQyxNQUFtQztRQUM5RCxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsRUFBRSxNQUFNLENBQUMsQ0FBQztJQUM5RCxDQUFDO0lBRUQsbUVBQW1FO0lBQzVELDhCQUE4QjtRQUNuQyxJQUFJLENBQUMsdUJBQXVCLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDdkMsQ0FBQztJQUVELG9FQUFvRTtJQUM3RCwrQkFBK0I7UUFDcEMsSUFBSSxDQUFDLHdCQUF3QixDQUFDLEtBQUssRUFBRSxDQUFDO0lBQ3hDLENBQUM7SUFFRCxpRUFBaUU7SUFDMUQsNEJBQTRCO1FBQ2pDLElBQUksQ0FBQyxxQkFBcUIsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUNyQyxDQUFDO0lBRUQ7OztPQUdHO0lBQ0kseUJBQXlCO1FBQzlCLElBQUksQ0FBQyw4QkFBOEIsRUFBRSxDQUFDO1FBQ3RDLElBQUksQ0FBQywrQkFBK0IsRUFBRSxDQUFDO1FBQ3ZDLElBQUksQ0FBQyw0QkFBNEIsRUFBRSxDQUFDO0lBQ3RDLENBQUM7SUFFTyxZQUFZLENBQUMsR0FBZ0IsRUFBRSxNQUE2QjtRQUNsRSxNQUFNLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFLEdBQUcsTUFBTSxDQUFDO1FBQ3ZELElBQUksQ0FBQyxRQUFRLElBQUksT0FBTyxRQUFRLEtBQUssVUFBVSxFQUFFO1lBQy9DLGlEQUFXLENBQUMsMENBQTBDLFFBQVEsRUFBRSxDQUFDLENBQUM7WUFDbEUsT0FBTztTQUNSO1FBQ0QsTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQzlELE1BQU0sUUFBUSxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUM5RCxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUU7WUFDckIsUUFBUSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFO2dCQUNyQixJQUFJLENBQUMsMEJBQTBCLENBQUMsR0FBRyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1lBQ2hFLENBQUMsQ0FBQyxDQUFDO1FBQ0wsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDO0lBRU8sZUFBZSxDQUFDLEdBQWdCLEVBQUUsTUFBbUM7UUFDM0UsTUFBTSxFQUFFLE9BQU8sRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLE1BQU0sQ0FBQztRQUN2RCxNQUFNLFFBQVEsR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDOUQsTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQzlELFFBQVEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRTtZQUNyQixNQUFNLFNBQVMsR0FBRyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxJQUFJLEVBQUUsQ0FBQztZQUNuQyxNQUFNLGtCQUFrQixHQUFHLFNBQVMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxFQUFFLEVBQUUsRUFBRTtnQkFDakQsMEZBQTBGO2dCQUMxRixpQ0FBaUM7Z0JBQ2pDLElBQUksT0FBTyxLQUFLLFNBQVMsSUFBSSxFQUFFLENBQUMsT0FBTyxLQUFLLE9BQU87b0JBQUUsT0FBTyxJQUFJLENBQUM7Z0JBQ2pFLElBQUksUUFBUSxLQUFLLFNBQVMsSUFBSSxFQUFFLENBQUMsUUFBUSxLQUFLLFFBQVE7b0JBQUUsT0FBTyxJQUFJLENBQUM7Z0JBQ3BFLElBQUksT0FBTyxLQUFLLFNBQVMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsRUFBRSxDQUFDLE1BQU0sQ0FBQztvQkFBRSxPQUFPLElBQUksQ0FBQztnQkFDeEUsT0FBTyxLQUFLLENBQUM7WUFDZixDQUFDLENBQUMsQ0FBQztZQUNILElBQUksa0JBQWtCLENBQUMsTUFBTSxHQUFHLENBQUM7Z0JBQUUsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQUUsa0JBQWtCLENBQUMsQ0FBQzs7Z0JBQzdELEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDckIsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDO0lBRU8sMEJBQTBCLENBQ2hDLEdBQWdCLEVBQ2hCLE9BQVcsRUFDWCxPQUF1QixFQUN2QixRQUFpQyxFQUNqQyxPQUFtQztRQUVuQyxtRUFBbUU7UUFDbkUsSUFBSSxDQUFDLE9BQU8sSUFBSSxDQUFDLDBFQUFpQixDQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQzNDLHlEQUFpQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQzNCLE9BQU87U0FDUjtRQUVELHNEQUFzRDtRQUN0RCxJQUFJLE9BQU8sSUFBSSxDQUFDLDBFQUFpQixDQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQzFDLHlEQUFpQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQzNCLE9BQU87U0FDUjtRQUVELE1BQU0sU0FBUyxHQUFHLEdBQUcsQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLElBQUksRUFBRSxDQUFDO1FBQ3pDLFNBQVMsQ0FBQyxJQUFJLENBQUMsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxPQUFPLEVBQUUsQ0FBQyxDQUFDO1FBQ3ZELEdBQUcsQ0FBQyxHQUFHLENBQUMsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0lBQzlCLENBQUM7SUFFTyxnQkFBZ0IsQ0FBQyxLQUF3QztRQUMvRCxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLGVBQWUsRUFBRSxLQUFLLENBQUMsQ0FBQztJQUM5RSxDQUFDO0lBRU8sY0FBYyxDQUFDLEtBQXFDO1FBQzFELElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLENBQUMscUJBQXFCLEVBQUUsYUFBYSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQzFFLENBQUM7SUFFTyxpQkFBaUIsQ0FBQyxLQUF3QztRQUNoRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLHdCQUF3QixFQUFFLGdCQUFnQixFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQ2hGLENBQUM7SUFFRDs7U0FFSztJQUNHLGdCQUFnQixDQUN0QixXQUF3QixFQUN4QixTQUFpQixFQUNqQixLQUEyQjtRQUUzQixNQUFNLEtBQUssR0FBRyxLQUFLLENBQUMsS0FBc0MsQ0FBQztRQUMzRCxNQUFNLGFBQWEsR0FBRyxNQUFNLEdBQUcsU0FBUyxDQUFDO1FBQ3pDLE1BQU0sU0FBUyxHQUErQixFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQUUsQ0FBQztRQUNwRSxNQUFNLGlCQUFpQixHQUErQixFQUFFLFVBQVUsRUFBRSxJQUFJLEVBQUUsQ0FBQztRQUUzRSxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUMsSUFBSSxFQUFFLENBQUMsRUFBRSxFQUFFOztZQUNwQixNQUFNLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxHQUFHLElBQUksQ0FBQztZQUM5QixNQUFNLFNBQVMsR0FBRyxtREFBVyxDQUFDLEtBQUssQ0FBQyxDQUFDO1lBQ3JDLE1BQU0sU0FBUyxHQUFHLG1EQUFXLENBQUMsS0FBSyxDQUFDLENBQUM7WUFDckMsSUFBSSxXQUFXLEdBQW1CLGVBQVMsQ0FBQyxVQUFVLG1DQUFJLFNBQVMsQ0FBQztZQUNwRSxJQUFJLFdBQVcsR0FBbUIsZUFBUyxDQUFDLFVBQVUsbUNBQUksU0FBUyxDQUFDO1lBRXBFLDRGQUE0RjtZQUM1RixpRkFBaUY7WUFDakYsSUFBSSxXQUFXLElBQUksV0FBVyxZQUFZLE1BQU0sQ0FBQyxRQUFRLEVBQUU7Z0JBQ3pELFdBQVcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDO2FBQ2hDO1lBQ0QsSUFBSSxXQUFXLElBQUksV0FBVyxZQUFZLE1BQU0sQ0FBQyxRQUFRLEVBQUU7Z0JBQ3pELFdBQVcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDO2FBQ2hDO1lBRUQsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDaEQsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFFaEQsU0FBUyxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7WUFDeEIsU0FBUyxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7WUFDeEIsU0FBUyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDakQsU0FBUyxDQUFDLFdBQVcsR0FBRyxXQUFXLGFBQVgsV0FBVyxjQUFYLFdBQVcsR0FBSSxTQUFTLENBQUM7WUFDakQsU0FBUyxDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7WUFFdEIsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsYUFBYSxFQUFFLFNBQVMsQ0FBQyxDQUFDO1lBRTNDLElBQUksV0FBVyxDQUFDLElBQUksR0FBRyxDQUFDLEVBQUU7Z0JBQ3hCLGlCQUFpQixDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7Z0JBQ2hDLGlCQUFpQixDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7Z0JBQ2hDLGlCQUFpQixDQUFDLFdBQVcsR0FBRyxXQUFXLENBQUM7Z0JBQzVDLGlCQUFpQixDQUFDLFdBQVcsR0FBRyxXQUFXLENBQUM7Z0JBQzVDLGlCQUFpQixDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7Z0JBRTlCLE1BQU0sSUFBSSxHQUFHLFNBQThCLENBQUM7Z0JBQzVDLE1BQU0sWUFBWSxHQUFHLGlCQUFzQyxDQUFDO2dCQUU1RCxJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLElBQUksQ0FBQyxDQUFDO2dCQUNwRSxJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLFlBQVksQ0FBQyxDQUFDO2dCQUU1RSxJQUFJLFdBQVcsRUFBRTtvQkFDZixJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLElBQUksQ0FBQyxDQUFDO2lCQUMzRTtnQkFFRCxJQUFJLFdBQVcsRUFBRTtvQkFDZixJQUFJLENBQUMsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsV0FBVyxFQUFFLFlBQVksQ0FBQyxDQUFDO2lCQUNuRjthQUNGO1FBQ0gsQ0FBQyxDQUFDLENBQUM7UUFFSCxJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsS0FBSyxDQUFDLENBQUM7SUFDckMsQ0FBQztJQUVPLGdCQUFnQixDQUN0QixHQUFnQixFQUNoQixPQUFXLEVBQ1gsS0FBb0IsRUFDcEIsV0FBMkIsRUFDM0IsU0FBNEI7UUFFNUIsTUFBTSxTQUFTLEdBQUcsR0FBRyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUNuQyxJQUFJLFNBQVMsRUFBRTtZQUNiLFNBQVMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLEVBQUUsRUFBRTtnQkFDbEQsSUFBSSxDQUFDLE1BQU0sSUFBSSxNQUFNLEtBQUssS0FBSyxJQUFJLE1BQU0sS0FBSyxXQUFXLEVBQUU7b0JBQ3pELFFBQVEsQ0FBQyxJQUFJLENBQUMsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO2lCQUNuQztZQUNILENBQUMsQ0FBQyxDQUFDO1NBQ0o7SUFDSCxDQUFDO0lBRUQscUJBQXFCO1FBQ25CLE1BQU0sTUFBTSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDO1FBQ2pDLElBQUksQ0FBQyxNQUFNLElBQUksQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFO1lBQzVCLGlEQUFXLENBQUMseUJBQXlCLENBQUMsQ0FBQztZQUN2QyxPQUFPO1NBQ1I7UUFDRCxNQUFNLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxlQUFlLEVBQUUsSUFBSSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxDQUFDO1FBQzlELE1BQU0sQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNoRSxNQUFNLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxhQUFhLEVBQUUsSUFBSSxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUM1RCxDQUFDO0lBRUQsdUJBQXVCO1FBQ3JCLCtGQUErRjtRQUMvRixtQkFBbUI7UUFDbkIsTUFBTSxNQUFNLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUM7UUFDakMsSUFBSSxDQUFDLE1BQU0sSUFBSSxDQUFDLE1BQU0sQ0FBQyxLQUFLO1lBQUUsT0FBTztRQUNyQyxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxlQUFlLEVBQUUsSUFBSSxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxDQUFDO1FBQy9ELE1BQU0sQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNqRSxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxhQUFhLEVBQUUsSUFBSSxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUM3RCxDQUFDO0lBRUQsS0FBSztRQUNILHVGQUF1RjtRQUN2RixJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsSUFBSSxDQUFDLENBQUM7UUFDckQsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ3BELElBQUksQ0FBQyxxQkFBcUIsRUFBRSxDQUFDO0lBQy9CLENBQUM7SUFFRCxRQUFRO1FBQ04sSUFBSSxDQUFDLHlCQUF5QixFQUFFLENBQUM7UUFDakMsSUFBSSxDQUFDLHVCQUF1QixFQUFFLENBQUM7UUFDL0Isd0VBQXdFO1FBQ3hFLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNsRCxDQUFDO0lBRUQsT0FBTztRQUNMLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNuRCxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLENBQUM7UUFDL0MsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ3JELElBQUksQ0FBQyx5QkFBeUIsRUFBRSxDQUFDO1FBQ2pDLElBQUksQ0FBQyx1QkFBdUIsRUFBRSxDQUFDO0lBQ2pDLENBQUM7Q0FDRiIsImZpbGUiOiIuL3BoYXNlci1tYXR0ZXItY29sbGlzaW9uLXBsdWdpbi50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFBoeXNpY3MsIFBsdWdpbnMsIFNjZW5lLCBFdmVudHMsIFNjZW5lcywgVGlsZW1hcHMgfSBmcm9tIFwicGhhc2VyXCI7XG5pbXBvcnQgeyBnZXRSb290Qm9keSwgd2FybkludmFsaWRPYmplY3QgfSBmcm9tIFwiLi91dGlsc1wiO1xuaW1wb3J0IGxvZ2dlciBmcm9tIFwiLi9sb2dnZXJcIjtcbmltcG9ydCB7IENvbGxpZGluZ09iamVjdCBhcyBDTywgaXNDb2xsaWRpbmdPYmplY3QgfSBmcm9tIFwiLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0XCI7XG5pbXBvcnQge1xuICBMaXN0ZW5lck1hcCxcbiAgQ29sbGlkZUFCQ29uZmlnIGFzIEFCQ29uZmlnLFxuICBVbnN1YnNjcmliZSxcbiAgQ29sbGlkZUNhbGxiYWNrLFxuICBDb2xsaWRlQ29udGV4dCxcbiAgRXh0ZW5kZWRNYXR0ZXJDb2xsaXNpb25EYXRhLFxuICBFdmVudERhdGEsXG4gIENvbGxpZGVBQ29uZmlnIGFzIEFDb25maWcsXG4gIEludGVybmFsQ29sbGlkZUNvbmZpZyxcbiAgUmVtb3ZlQ29sbGlkZUNvbmZpZ0EgYXMgUmVtb3ZlQUNvbmZpZyxcbiAgUmVtb3ZlQ29sbGlkZUNvbmZpZ0FCIGFzIFJlbW92ZUFCQ29uZmlnLFxuICBJbnRlcm5hbENvbGxpZGVSZW1vdmVDb25maWcsXG59IGZyb20gXCIuL2NvbGxpc2lvbi10eXBlc1wiO1xuXG5pbXBvcnQgTWF0dGVyID0gUGh5c2ljcy5NYXR0ZXI7XG5pbXBvcnQgTWF0dGVyRXZlbnRzID0gTWF0dGVyLkV2ZW50cztcbmNvbnN0IHsgU1RBUlQsIERFU1RST1ksIFNIVVRET1dOIH0gPSBTY2VuZXMuRXZlbnRzO1xuY29uc3QgeyBDT0xMSVNJT05fU1RBUlQsIENPTExJU0lPTl9BQ1RJVkUsIENPTExJU0lPTl9FTkQgfSA9IE1hdHRlci5FdmVudHM7XG5cbnR5cGUgTWF0dGVyQ29sbGlzaW9uRXZlbnQgPVxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudFxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25FbmRFdmVudFxuICB8IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudDtcblxuLyoqXG4gKiBAZXhwb3J0XG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIE1hdHRlckNvbGxpc2lvblBsdWdpbiBleHRlbmRzIFBsdWdpbnMuU2NlbmVQbHVnaW4ge1xuICBwdWJsaWMgZXZlbnRzID0gbmV3IEV2ZW50cy5FdmVudEVtaXR0ZXIoKTtcblxuICBwcml2YXRlIGNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzOiBMaXN0ZW5lck1hcCA9IG5ldyBNYXAoKTtcbiAgcHJpdmF0ZSBjb2xsaXNpb25FbmRMaXN0ZW5lcnM6IExpc3RlbmVyTWFwID0gbmV3IE1hcCgpO1xuICBwcml2YXRlIGNvbGxpc2lvbkFjdGl2ZUxpc3RlbmVyczogTGlzdGVuZXJNYXAgPSBuZXcgTWFwKCk7XG5cbiAgY29uc3RydWN0b3IoXG4gICAgcHJvdGVjdGVkIHNjZW5lOiBTY2VuZSxcbiAgICBwcm90ZWN0ZWQgcGx1Z2luTWFuYWdlcjogUGx1Z2lucy5QbHVnaW5NYW5hZ2VyLFxuICAgIHBsdWdpbktleTogc3RyaW5nXG4gICkge1xuICAgIHN1cGVyKHNjZW5lLCBwbHVnaW5NYW5hZ2VyLCBwbHVnaW5LZXkpO1xuICAgIHRoaXMuc2NlbmUgPSBzY2VuZTtcbiAgICB0aGlzLnNjZW5lLmV2ZW50cy5vbmNlKFNUQVJULCB0aGlzLnN0YXJ0LCB0aGlzKTtcbiAgICB0aGlzLnNjZW5lLmV2ZW50cy5vbmNlKERFU1RST1ksIHRoaXMuZGVzdHJveSwgdGhpcyk7XG4gIH1cblxuICAvKipcbiAgICogQWRkIGEgbGlzdGVuZXIgZm9yIGNvbGxpZGVzdGFydCBldmVudHMgYmV0d2VlbiBvYmplY3RBIGFuZCBvYmplY3RCLiBUaGUgY29sbGlkZXN0YXJ0IGV2ZW50IGlzXG4gICAqIGZpcmVkIGJ5IE1hdHRlciB3aGVuIHR3byBib2RpZXMgc3RhcnQgY29sbGlkaW5nIHdpdGhpbiBhIHRpY2sgb2YgdGhlIGVuZ2luZS4gSWYgb2JqZWN0QiBpc1xuICAgKiBvbWl0dGVkLCBhbnkgY29sbGlzaW9ucyB3aXRoIG9iamVjdEEgd2lsbCBiZSBwYXNzZWQgYWxvbmcgdG8gdGhlIGxpc3RlbmVyLiBTZWVcbiAgICoge0BsaW5rIHBhaXJjb2xsaXNpb25zdGFydH0gZm9yIGluZm9ybWF0aW9uIG9uIGNhbGxiYWNrIHBhcmFtZXRlcnMuXG4gICAqL1xuICBwdWJsaWMgYWRkT25Db2xsaWRlU3RhcnQ8VCBleHRlbmRzIENPLCBLIGV4dGVuZHMgQ08+KGNvbmZpZzogQUJDb25maWc8VCwgSz4pOiBVbnN1YnNjcmliZTtcbiAgcHVibGljIGFkZE9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVTdGFydChjb25maWc6IEludGVybmFsQ29sbGlkZUNvbmZpZyk6IFVuc3Vic2NyaWJlIHtcbiAgICAvLyBOb3RlOiB0aGUgb3JkZXIgb2Ygb3ZlcmxvYWRzIGlzIGltcG9ydGFudCEgVFMgbWF0Y2hlcyB0aGUgZmlyc3Qgb25lIGl0IGNhbiwgc28gdGhpcyBuZWVkc1xuICAgIC8vIHRoZSBtb3N0IHNwZWNpZmljL2NvbnN0cmFpbmVkIHNpZ25hdHVyZSBmaXJzdC5cbiAgICB0aGlzLmFkZE9uQ29sbGlkZSh0aGlzLmNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzLCBjb25maWcpO1xuICAgIHJldHVybiAoKSA9PiB0aGlzLnJlbW92ZU9uQ29sbGlkZSh0aGlzLmNvbGxpc2lvblN0YXJ0TGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNhZGRPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIGFkZE9uQ29sbGlkZUVuZDxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQkNvbmZpZzxULCBLPik6IFVuc3Vic2NyaWJlO1xuICBwdWJsaWMgYWRkT25Db2xsaWRlRW5kPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVFbmQoY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiBVbnN1YnNjcmliZSB7XG4gICAgdGhpcy5hZGRPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25FbmRMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gICAgcmV0dXJuICgpID0+IHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNhZGRPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIGFkZE9uQ29sbGlkZUFjdGl2ZTxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQkNvbmZpZzxULCBLPik6IFVuc3Vic2NyaWJlO1xuICBwdWJsaWMgYWRkT25Db2xsaWRlQWN0aXZlPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBBQ29uZmlnPFQ+KTogVW5zdWJzY3JpYmU7XG4gIHB1YmxpYyBhZGRPbkNvbGxpZGVBY3RpdmUoY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiBVbnN1YnNjcmliZSB7XG4gICAgdGhpcy5hZGRPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gICAgcmV0dXJuICgpID0+IHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uQWN0aXZlTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqXG4gICAqIFJlbW92ZSBhbnkgbGlzdGVuZXJzIHRoYXQgd2VyZSBhZGRlZCB3aXRoIGFkZE9uQ29sbGlkZVN0YXJ0LiBJZiBvYmplY3RCLCBjYWxsYmFjayBvciBjb250ZXh0XG4gICAqIHBhcmFtZXRlcnMgYXJlIG9taXR0ZWQsIGFueSBsaXN0ZW5lciBtYXRjaGluZyB0aGUgcmVtYWluaW5nIHBhcmFtZXRlcnMgd2lsbCBiZSByZW1vdmVkLiBFLmcuIGlmXG4gICAqIHlvdSBvbmx5IHNwZWNpZnkgb2JqZWN0QSBhbmQgb2JqZWN0QiwgYWxsIGxpc3RlbmVycyB3aXRoIG9iamVjdEEgJiBvYmplY3RCIHdpbGwgYmUgcmVtb3ZlZFxuICAgKiByZWdhcmRsZXNzIG9mIHRoZSBjYWxsYmFjayBvciBjb250ZXh0LlxuICAgKi9cbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTywgSyBleHRlbmRzIENPPihjb25maWc6IFJlbW92ZUFCQ29uZmlnPFQsIEs+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0PFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQ29uZmlnPFQ+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZVN0YXJ0KGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgdGhpcy5yZW1vdmVPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycywgY29uZmlnKTtcbiAgfVxuXG4gIC8qKiBUaGlzIG1ldGhvZCBtaXJyb3JzIHtAbGluayBNYXR0ZXJDb2xsaXNpb25QbHVnaW4jcmVtb3ZlT25Db2xsaWRlU3RhcnR9ICovXG4gIHB1YmxpYyByZW1vdmVPbkNvbGxpZGVFbmQ8VCBleHRlbmRzIENPLCBLIGV4dGVuZHMgQ08+KGNvbmZpZzogUmVtb3ZlQUJDb25maWc8VCwgSz4pOiB2b2lkO1xuICBwdWJsaWMgcmVtb3ZlT25Db2xsaWRlRW5kPFQgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQ29uZmlnPFQ+KTogdm9pZDtcbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZUVuZChjb25maWc6IEludGVybmFsQ29sbGlkZVJlbW92ZUNvbmZpZykge1xuICAgIHRoaXMucmVtb3ZlT25Db2xsaWRlKHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLCBjb25maWcpO1xuICB9XG5cbiAgLyoqIFRoaXMgbWV0aG9kIG1pcnJvcnMge0BsaW5rIE1hdHRlckNvbGxpc2lvblBsdWdpbiNyZW1vdmVPbkNvbGxpZGVTdGFydH0gKi9cbiAgcHVibGljIHJlbW92ZU9uQ29sbGlkZUFjdGl2ZTxUIGV4dGVuZHMgQ08sIEsgZXh0ZW5kcyBDTz4oY29uZmlnOiBSZW1vdmVBQkNvbmZpZzxULCBLPik6IHZvaWQ7XG4gIHB1YmxpYyByZW1vdmVPbkNvbGxpZGVBY3RpdmU8VCBleHRlbmRzIENPPihjb25maWc6IFJlbW92ZUFDb25maWc8VD4pOiB2b2lkO1xuICBwdWJsaWMgcmVtb3ZlT25Db2xsaWRlQWN0aXZlKGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgdGhpcy5yZW1vdmVPbkNvbGxpZGUodGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMsIGNvbmZpZyk7XG4gIH1cblxuICAvKiogUmVtb3ZlIGFueSBsaXN0ZW5lcnMgdGhhdCB3ZXJlIGFkZGVkIHdpdGggYWRkT25Db2xsaWRlU3RhcnQuICovXG4gIHB1YmxpYyByZW1vdmVBbGxDb2xsaWRlU3RhcnRMaXN0ZW5lcnMoKSB7XG4gICAgdGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycy5jbGVhcigpO1xuICB9XG5cbiAgLyoqIFJlbW92ZSBhbnkgbGlzdGVuZXJzIHRoYXQgd2VyZSBhZGRlZCB3aXRoIGFkZE9uQ29sbGlkZUFjdGl2ZS4gKi9cbiAgcHVibGljIHJlbW92ZUFsbENvbGxpZGVBY3RpdmVMaXN0ZW5lcnMoKSB7XG4gICAgdGhpcy5jb2xsaXNpb25BY3RpdmVMaXN0ZW5lcnMuY2xlYXIoKTtcbiAgfVxuXG4gIC8qKiBSZW1vdmUgYW55IGxpc3RlbmVycyB0aGF0IHdlcmUgYWRkZWQgd2l0aCBhZGRPbkNvbGxpZGVFbmQuICovXG4gIHB1YmxpYyByZW1vdmVBbGxDb2xsaWRlRW5kTGlzdGVuZXJzKCkge1xuICAgIHRoaXMuY29sbGlzaW9uRW5kTGlzdGVuZXJzLmNsZWFyKCk7XG4gIH1cblxuICAvKipcbiAgICogUmVtb3ZlIGFueSBsaXN0ZW5lcnMgdGhhdCB3ZXJlIGFkZGVkIHdpdGggYWRkT25Db2xsaWRlU3RhcnQsIGFkZE9uQ29sbGlkZUFjdGl2ZSBvclxuICAgKiBhZGRPbkNvbGxpZGVFbmQuXG4gICAqL1xuICBwdWJsaWMgcmVtb3ZlQWxsQ29sbGlkZUxpc3RlbmVycygpIHtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVTdGFydExpc3RlbmVycygpO1xuICAgIHRoaXMucmVtb3ZlQWxsQ29sbGlkZUFjdGl2ZUxpc3RlbmVycygpO1xuICAgIHRoaXMucmVtb3ZlQWxsQ29sbGlkZUVuZExpc3RlbmVycygpO1xuICB9XG5cbiAgcHJpdmF0ZSBhZGRPbkNvbGxpZGUobWFwOiBMaXN0ZW5lck1hcCwgY29uZmlnOiBJbnRlcm5hbENvbGxpZGVDb25maWcpOiB2b2lkIHtcbiAgICBjb25zdCB7IGNvbnRleHQsIGNhbGxiYWNrLCBvYmplY3RBLCBvYmplY3RCIH0gPSBjb25maWc7XG4gICAgaWYgKCFjYWxsYmFjayB8fCB0eXBlb2YgY2FsbGJhY2sgIT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgbG9nZ2VyLndhcm4oYE5vIHZhbGlkIGNhbGxiYWNrIHNwZWNpZmllZC4gUmVjZWl2ZWQ6ICR7Y2FsbGJhY2t9YCk7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGNvbnN0IG9iamVjdHNBID0gQXJyYXkuaXNBcnJheShvYmplY3RBKSA/IG9iamVjdEEgOiBbb2JqZWN0QV07XG4gICAgY29uc3Qgb2JqZWN0c0IgPSBBcnJheS5pc0FycmF5KG9iamVjdEIpID8gb2JqZWN0QiA6IFtvYmplY3RCXTtcbiAgICBvYmplY3RzQS5mb3JFYWNoKChhKSA9PiB7XG4gICAgICBvYmplY3RzQi5mb3JFYWNoKChiKSA9PiB7XG4gICAgICAgIHRoaXMuYWRkT25Db2xsaWRlT2JqZWN0VnNPYmplY3QobWFwLCBhLCBiLCBjYWxsYmFjaywgY29udGV4dCk7XG4gICAgICB9KTtcbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgcmVtb3ZlT25Db2xsaWRlKG1hcDogTGlzdGVuZXJNYXAsIGNvbmZpZzogSW50ZXJuYWxDb2xsaWRlUmVtb3ZlQ29uZmlnKSB7XG4gICAgY29uc3QgeyBjb250ZXh0LCBjYWxsYmFjaywgb2JqZWN0QSwgb2JqZWN0QiB9ID0gY29uZmlnO1xuICAgIGNvbnN0IG9iamVjdHNBID0gQXJyYXkuaXNBcnJheShvYmplY3RBKSA/IG9iamVjdEEgOiBbb2JqZWN0QV07XG4gICAgY29uc3Qgb2JqZWN0c0IgPSBBcnJheS5pc0FycmF5KG9iamVjdEIpID8gb2JqZWN0QiA6IFtvYmplY3RCXTtcbiAgICBvYmplY3RzQS5mb3JFYWNoKChhKSA9PiB7XG4gICAgICBjb25zdCBjYWxsYmFja3MgPSBtYXAuZ2V0KGEpIHx8IFtdO1xuICAgICAgY29uc3QgcmVtYWluaW5nQ2FsbGJhY2tzID0gY2FsbGJhY2tzLmZpbHRlcigoY2IpID0+IHtcbiAgICAgICAgLy8gSWYgYW55dGhpbmcgZG9lc24ndCBtYXRjaCBhIHByb3ZpZGVkIGNvbmZpZyB2YWx1ZSAoaS5lLiBhbnl0aGluZyBvdGhlciB0aGFuIHVuZGVmaW5lZCksXG4gICAgICAgIC8vIHdlIGNhbiBiYWlsIGFuZCBrZWVwIGxpc3RlbmVyLlxuICAgICAgICBpZiAoY29udGV4dCAhPT0gdW5kZWZpbmVkICYmIGNiLmNvbnRleHQgIT09IGNvbnRleHQpIHJldHVybiB0cnVlO1xuICAgICAgICBpZiAoY2FsbGJhY2sgIT09IHVuZGVmaW5lZCAmJiBjYi5jYWxsYmFjayAhPT0gY2FsbGJhY2spIHJldHVybiB0cnVlO1xuICAgICAgICBpZiAob2JqZWN0QiAhPT0gdW5kZWZpbmVkICYmICFvYmplY3RzQi5pbmNsdWRlcyhjYi50YXJnZXQpKSByZXR1cm4gdHJ1ZTtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfSk7XG4gICAgICBpZiAocmVtYWluaW5nQ2FsbGJhY2tzLmxlbmd0aCA+IDApIG1hcC5zZXQoYSwgcmVtYWluaW5nQ2FsbGJhY2tzKTtcbiAgICAgIGVsc2UgbWFwLmRlbGV0ZShhKTtcbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgYWRkT25Db2xsaWRlT2JqZWN0VnNPYmplY3QoXG4gICAgbWFwOiBMaXN0ZW5lck1hcCxcbiAgICBvYmplY3RBOiBDTyxcbiAgICBvYmplY3RCOiBDTyB8IHVuZGVmaW5lZCxcbiAgICBjYWxsYmFjazogQ29sbGlkZUNhbGxiYWNrPENPLCBDTz4sXG4gICAgY29udGV4dDogQ29sbGlkZUNvbnRleHQgfCB1bmRlZmluZWRcbiAgKSB7XG4gICAgLy8gQ2FuJ3QgZG8gYW55dGhpbmcgaWYgdGhlIGZpcnN0IG9iamVjdCBpcyBub3QgZGVmaW5lZCBvciBpbnZhbGlkLlxuICAgIGlmICghb2JqZWN0QSB8fCAhaXNDb2xsaWRpbmdPYmplY3Qob2JqZWN0QSkpIHtcbiAgICAgIHdhcm5JbnZhbGlkT2JqZWN0KG9iamVjdEEpO1xuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIC8vIFRoZSBzZWNvbmQgb2JqZWN0IGNhbiBiZSB1bmRlZmluZWQgb3IgYSB2YWxpZCBib2R5LlxuICAgIGlmIChvYmplY3RCICYmICFpc0NvbGxpZGluZ09iamVjdChvYmplY3RCKSkge1xuICAgICAgd2FybkludmFsaWRPYmplY3Qob2JqZWN0QSk7XG4gICAgICByZXR1cm47XG4gICAgfVxuXG4gICAgY29uc3QgY2FsbGJhY2tzID0gbWFwLmdldChvYmplY3RBKSB8fCBbXTtcbiAgICBjYWxsYmFja3MucHVzaCh7IHRhcmdldDogb2JqZWN0QiwgY2FsbGJhY2ssIGNvbnRleHQgfSk7XG4gICAgbWFwLnNldChvYmplY3RBLCBjYWxsYmFja3MpO1xuICB9XG5cbiAgcHJpdmF0ZSBvbkNvbGxpc2lvblN0YXJ0KGV2ZW50OiBNYXR0ZXJFdmVudHMuQ29sbGlzaW9uQWN0aXZlRXZlbnQpIHtcbiAgICB0aGlzLm9uQ29sbGlzaW9uRXZlbnQodGhpcy5jb2xsaXNpb25TdGFydExpc3RlbmVycywgQ09MTElTSU9OX1NUQVJULCBldmVudCk7XG4gIH1cblxuICBwcml2YXRlIG9uQ29sbGlzaW9uRW5kKGV2ZW50OiBNYXR0ZXJFdmVudHMuQ29sbGlzaW9uRW5kRXZlbnQpIHtcbiAgICB0aGlzLm9uQ29sbGlzaW9uRXZlbnQodGhpcy5jb2xsaXNpb25FbmRMaXN0ZW5lcnMsIENPTExJU0lPTl9FTkQsIGV2ZW50KTtcbiAgfVxuXG4gIHByaXZhdGUgb25Db2xsaXNpb25BY3RpdmUoZXZlbnQ6IE1hdHRlckV2ZW50cy5Db2xsaXNpb25BY3RpdmVFdmVudCkge1xuICAgIHRoaXMub25Db2xsaXNpb25FdmVudCh0aGlzLmNvbGxpc2lvbkFjdGl2ZUxpc3RlbmVycywgQ09MTElTSU9OX0FDVElWRSwgZXZlbnQpO1xuICB9XG5cbiAgLyoqXG4gICAqIFJldXNhYmxlIGhhbmRsZXIgZm9yIGNvbGxpc2lvbnN0YXJ0LCBjb2xsaXNpb25lbmQsIGNvbGxpc2lvbmFjdGl2ZS5cbiAgICogKi9cbiAgcHJpdmF0ZSBvbkNvbGxpc2lvbkV2ZW50KFxuICAgIGxpc3RlbmVyTWFwOiBMaXN0ZW5lck1hcCxcbiAgICBldmVudE5hbWU6IHN0cmluZyxcbiAgICBldmVudDogTWF0dGVyQ29sbGlzaW9uRXZlbnRcbiAgKSB7XG4gICAgY29uc3QgcGFpcnMgPSBldmVudC5wYWlycyBhcyBFeHRlbmRlZE1hdHRlckNvbGxpc2lvbkRhdGFbXTtcbiAgICBjb25zdCBwYWlyRXZlbnROYW1lID0gXCJwYWlyXCIgKyBldmVudE5hbWU7XG4gICAgY29uc3QgZXZlbnREYXRhOiBQYXJ0aWFsPEV2ZW50RGF0YTxDTywgQ08+PiA9IHsgaXNSZXZlcnNlZDogZmFsc2UgfTtcbiAgICBjb25zdCBldmVudERhdGFSZXZlcnNlZDogUGFydGlhbDxFdmVudERhdGE8Q08sIENPPj4gPSB7IGlzUmV2ZXJzZWQ6IHRydWUgfTtcblxuICAgIHBhaXJzLm1hcCgocGFpciwgaSkgPT4ge1xuICAgICAgY29uc3QgeyBib2R5QSwgYm9keUIgfSA9IHBhaXI7XG4gICAgICBjb25zdCByb290Qm9keUEgPSBnZXRSb290Qm9keShib2R5QSk7XG4gICAgICBjb25zdCByb290Qm9keUIgPSBnZXRSb290Qm9keShib2R5Qik7XG4gICAgICBsZXQgZ2FtZU9iamVjdEE6IENPIHwgdW5kZWZpbmVkID0gcm9vdEJvZHlBLmdhbWVPYmplY3QgPz8gdW5kZWZpbmVkO1xuICAgICAgbGV0IGdhbWVPYmplY3RCOiBDTyB8IHVuZGVmaW5lZCA9IHJvb3RCb2R5Qi5nYW1lT2JqZWN0ID8/IHVuZGVmaW5lZDtcblxuICAgICAgLy8gU3BlY2lhbCBjYXNlIGZvciB0aWxlcywgd2hlcmUgaXQncyBtb3JlIHVzZWZ1bCB0byBoYXZlIGEgcmVmZXJlbmNlIHRvIHRoZSBUaWxlIG9iamVjdCBub3RcbiAgICAgIC8vIHRoZSBUaWxlQm9keS4gVGhpcyBpcyBob3QgY29kZSwgc28gdXNlIGEgcHJvcGVydHkgY2hlY2sgaW5zdGVhZCBvZiBpbnN0YW5jZW9mLlxuICAgICAgaWYgKGdhbWVPYmplY3RBICYmIGdhbWVPYmplY3RBIGluc3RhbmNlb2YgTWF0dGVyLlRpbGVCb2R5KSB7XG4gICAgICAgIGdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEEudGlsZTtcbiAgICAgIH1cbiAgICAgIGlmIChnYW1lT2JqZWN0QiAmJiBnYW1lT2JqZWN0QiBpbnN0YW5jZW9mIE1hdHRlci5UaWxlQm9keSkge1xuICAgICAgICBnYW1lT2JqZWN0QiA9IGdhbWVPYmplY3RCLnRpbGU7XG4gICAgICB9XG5cbiAgICAgIHBhaXJzW2ldLmdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEEgPz8gdW5kZWZpbmVkO1xuICAgICAgcGFpcnNbaV0uZ2FtZU9iamVjdEIgPSBnYW1lT2JqZWN0QiA/PyB1bmRlZmluZWQ7XG5cbiAgICAgIGV2ZW50RGF0YS5ib2R5QSA9IGJvZHlBO1xuICAgICAgZXZlbnREYXRhLmJvZHlCID0gYm9keUI7XG4gICAgICBldmVudERhdGEuZ2FtZU9iamVjdEEgPSBnYW1lT2JqZWN0QSA/PyB1bmRlZmluZWQ7XG4gICAgICBldmVudERhdGEuZ2FtZU9iamVjdEIgPSBnYW1lT2JqZWN0QiA/PyB1bmRlZmluZWQ7XG4gICAgICBldmVudERhdGEucGFpciA9IHBhaXI7XG5cbiAgICAgIHRoaXMuZXZlbnRzLmVtaXQocGFpckV2ZW50TmFtZSwgZXZlbnREYXRhKTtcblxuICAgICAgaWYgKGxpc3RlbmVyTWFwLnNpemUgPiAwKSB7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmJvZHlCID0gYm9keUE7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmJvZHlBID0gYm9keUI7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmdhbWVPYmplY3RCID0gZ2FtZU9iamVjdEE7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLmdhbWVPYmplY3RBID0gZ2FtZU9iamVjdEI7XG4gICAgICAgIGV2ZW50RGF0YVJldmVyc2VkLnBhaXIgPSBwYWlyO1xuXG4gICAgICAgIGNvbnN0IGRhdGEgPSBldmVudERhdGEgYXMgRXZlbnREYXRhPENPLCBDTz47XG4gICAgICAgIGNvbnN0IGRhdGFSZXZlcnNlZCA9IGV2ZW50RGF0YVJldmVyc2VkIGFzIEV2ZW50RGF0YTxDTywgQ08+O1xuXG4gICAgICAgIHRoaXMuY2hlY2tQYWlyQW5kRW1pdChsaXN0ZW5lck1hcCwgYm9keUEsIGJvZHlCLCBnYW1lT2JqZWN0QiwgZGF0YSk7XG4gICAgICAgIHRoaXMuY2hlY2tQYWlyQW5kRW1pdChsaXN0ZW5lck1hcCwgYm9keUIsIGJvZHlBLCBnYW1lT2JqZWN0QSwgZGF0YVJldmVyc2VkKTtcblxuICAgICAgICBpZiAoZ2FtZU9iamVjdEEpIHtcbiAgICAgICAgICB0aGlzLmNoZWNrUGFpckFuZEVtaXQobGlzdGVuZXJNYXAsIGdhbWVPYmplY3RBLCBib2R5QiwgZ2FtZU9iamVjdEIsIGRhdGEpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGdhbWVPYmplY3RCKSB7XG4gICAgICAgICAgdGhpcy5jaGVja1BhaXJBbmRFbWl0KGxpc3RlbmVyTWFwLCBnYW1lT2JqZWN0QiwgYm9keUEsIGdhbWVPYmplY3RBLCBkYXRhUmV2ZXJzZWQpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICB0aGlzLmV2ZW50cy5lbWl0KGV2ZW50TmFtZSwgZXZlbnQpO1xuICB9XG5cbiAgcHJpdmF0ZSBjaGVja1BhaXJBbmRFbWl0KFxuICAgIG1hcDogTGlzdGVuZXJNYXAsXG4gICAgb2JqZWN0QTogQ08sXG4gICAgYm9keUI6IE1hdHRlckpTLkJvZHksXG4gICAgZ2FtZU9iamVjdEI6IENPIHwgdW5kZWZpbmVkLFxuICAgIGV2ZW50RGF0YTogRXZlbnREYXRhPENPLCBDTz5cbiAgKSB7XG4gICAgY29uc3QgY2FsbGJhY2tzID0gbWFwLmdldChvYmplY3RBKTtcbiAgICBpZiAoY2FsbGJhY2tzKSB7XG4gICAgICBjYWxsYmFja3MuZm9yRWFjaCgoeyB0YXJnZXQsIGNhbGxiYWNrLCBjb250ZXh0IH0pID0+IHtcbiAgICAgICAgaWYgKCF0YXJnZXQgfHwgdGFyZ2V0ID09PSBib2R5QiB8fCB0YXJnZXQgPT09IGdhbWVPYmplY3RCKSB7XG4gICAgICAgICAgY2FsbGJhY2suY2FsbChjb250ZXh0LCBldmVudERhdGEpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9XG4gIH1cblxuICBzdWJzY3JpYmVNYXR0ZXJFdmVudHMoKSB7XG4gICAgY29uc3QgbWF0dGVyID0gdGhpcy5zY2VuZS5tYXR0ZXI7XG4gICAgaWYgKCFtYXR0ZXIgfHwgIW1hdHRlci53b3JsZCkge1xuICAgICAgbG9nZ2VyLndhcm4oXCJQbHVnaW4gcmVxdWlyZXMgbWF0dGVyIVwiKTtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgbWF0dGVyLndvcmxkLm9uKENPTExJU0lPTl9TVEFSVCwgdGhpcy5vbkNvbGxpc2lvblN0YXJ0LCB0aGlzKTtcbiAgICBtYXR0ZXIud29ybGQub24oQ09MTElTSU9OX0FDVElWRSwgdGhpcy5vbkNvbGxpc2lvbkFjdGl2ZSwgdGhpcyk7XG4gICAgbWF0dGVyLndvcmxkLm9uKENPTExJU0lPTl9FTkQsIHRoaXMub25Db2xsaXNpb25FbmQsIHRoaXMpO1xuICB9XG5cbiAgdW5zdWJzY3JpYmVNYXR0ZXJFdmVudHMoKSB7XG4gICAgLy8gRG9uJ3QgdW5zdWIgaWYgbWF0dGVyIG5leHQgZXhpc3Rpbmcgb3IgaWYgdGhlIGdhbWUgaXMgZGVzdHJveWVkIChzaW5jZSB0aGUgbWF0dGVyIHdvcmxkIHdpbGxcbiAgICAvLyBiZSBhbHJlYWR5IGdvbmUpXG4gICAgY29uc3QgbWF0dGVyID0gdGhpcy5zY2VuZS5tYXR0ZXI7XG4gICAgaWYgKCFtYXR0ZXIgfHwgIW1hdHRlci53b3JsZCkgcmV0dXJuO1xuICAgIG1hdHRlci53b3JsZC5vZmYoQ09MTElTSU9OX1NUQVJULCB0aGlzLm9uQ29sbGlzaW9uU3RhcnQsIHRoaXMpO1xuICAgIG1hdHRlci53b3JsZC5vZmYoQ09MTElTSU9OX0FDVElWRSwgdGhpcy5vbkNvbGxpc2lvbkFjdGl2ZSwgdGhpcyk7XG4gICAgbWF0dGVyLndvcmxkLm9mZihDT0xMSVNJT05fRU5ELCB0aGlzLm9uQ29sbGlzaW9uRW5kLCB0aGlzKTtcbiAgfVxuXG4gIHN0YXJ0KCkge1xuICAgIC8vIElmIHJlc3RhcnRpbmcsIHVuc3Vic2NyaWJlIGJlZm9yZSByZXN1YnNjcmliaW5nIHRvIGVuc3VyZSBvbmx5IG9uZSBsaXN0ZW5lciBpcyBhZGRlZFxuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihTSFVURE9XTiwgdGhpcy5zaHV0ZG93biwgdGhpcyk7XG4gICAgdGhpcy5zY2VuZS5ldmVudHMub24oU0hVVERPV04sIHRoaXMuc2h1dGRvd24sIHRoaXMpO1xuICAgIHRoaXMuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gIH1cblxuICBzaHV0ZG93bigpIHtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVMaXN0ZW5lcnMoKTtcbiAgICB0aGlzLnVuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gICAgLy8gUmVzdWJzY3JpYmUgdG8gc3RhcnQgc28gdGhhdCB0aGUgcGx1Z2luIGlzIHN0YXJ0ZWQgYWdhaW4gYWZ0ZXIgTWF0dGVyXG4gICAgdGhpcy5zY2VuZS5ldmVudHMub25jZShTVEFSVCwgdGhpcy5zdGFydCwgdGhpcyk7XG4gIH1cblxuICBkZXN0cm95KCkge1xuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihERVNUUk9ZLCB0aGlzLmRlc3Ryb3ksIHRoaXMpO1xuICAgIHRoaXMuc2NlbmUuZXZlbnRzLm9mZihTVEFSVCwgdGhpcy5zdGFydCwgdGhpcyk7XG4gICAgdGhpcy5zY2VuZS5ldmVudHMub2ZmKFNIVVRET1dOLCB0aGlzLnNodXRkb3duLCB0aGlzKTtcbiAgICB0aGlzLnJlbW92ZUFsbENvbGxpZGVMaXN0ZW5lcnMoKTtcbiAgICB0aGlzLnVuc3Vic2NyaWJlTWF0dGVyRXZlbnRzKCk7XG4gIH1cbn1cbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./phaser-matter-collision-plugin.ts\n')},"./utils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "getRootBody": () => (/* binding */ getRootBody),\n/* harmony export */ "warnInvalidObject": () => (/* binding */ warnInvalidObject)\n/* harmony export */ });\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./logger */ "./logger.ts");\n\r\n/**\r\n * Get the root body of a compound Matter body.\r\n */\r\nfunction getRootBody(body) {\r\n while (body.parent !== body)\r\n body = body.parent;\r\n return body;\r\n}\r\n/**\r\n * @param obj\r\n */\r\nfunction warnInvalidObject(obj) {\r\n _logger__WEBPACK_IMPORTED_MODULE_0__.default.warn(`Expected a Matter body, a Tile, a GameObject, a Sprite, an Image, a TileBody, or an object with a body property, but instead, received: ${obj}`);\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi91dGlscy50cz84ODEzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUE4QjtBQUU5Qjs7R0FFRztBQUNJLFNBQVMsV0FBVyxDQUFDLElBQXVCO0lBQ2pELE9BQU8sSUFBSSxDQUFDLE1BQU0sS0FBSyxJQUFJO1FBQUUsSUFBSSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7SUFDaEQsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDO0FBRUQ7O0dBRUc7QUFDSSxTQUFTLGlCQUFpQixDQUFDLEdBQVE7SUFDeEMsaURBQVcsQ0FDVCwySUFBMkksR0FBRyxFQUFFLENBQ2pKLENBQUM7QUFDSixDQUFDIiwiZmlsZSI6Ii4vdXRpbHMudHMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgbG9nZ2VyIGZyb20gXCIuL2xvZ2dlclwiO1xuXG4vKipcbiAqIEdldCB0aGUgcm9vdCBib2R5IG9mIGEgY29tcG91bmQgTWF0dGVyIGJvZHkuXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBnZXRSb290Qm9keShib2R5OiBNYXR0ZXJKUy5Cb2R5VHlwZSkge1xuICB3aGlsZSAoYm9keS5wYXJlbnQgIT09IGJvZHkpIGJvZHkgPSBib2R5LnBhcmVudDtcbiAgcmV0dXJuIGJvZHk7XG59XG5cbi8qKlxuICogQHBhcmFtIG9ialxuICovXG5leHBvcnQgZnVuY3Rpb24gd2FybkludmFsaWRPYmplY3Qob2JqOiBhbnkpIHtcbiAgbG9nZ2VyLndhcm4oXG4gICAgYEV4cGVjdGVkIGEgTWF0dGVyIGJvZHksIGEgVGlsZSwgYSBHYW1lT2JqZWN0LCBhIFNwcml0ZSwgYW4gSW1hZ2UsIGEgVGlsZUJvZHksIG9yIGFuIG9iamVjdCB3aXRoIGEgYm9keSBwcm9wZXJ0eSwgYnV0IGluc3RlYWQsIHJlY2VpdmVkOiAke29ian1gXG4gICk7XG59XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./utils.ts\n')},"./valid-collision-object.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "isMatterBody": () => (/* binding */ isMatterBody),\n/* harmony export */ "isCollidingObject": () => (/* binding */ isCollidingObject)\n/* harmony export */ });\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! phaser */ "phaser");\n/* harmony import */ var phaser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(phaser__WEBPACK_IMPORTED_MODULE_0__);\n\r\nvar Tile = phaser__WEBPACK_IMPORTED_MODULE_0__.Tilemaps.Tile;\r\n/** Duck type to check if the given object is a Matter body (because there isn\'t a prototype). */\r\nfunction isMatterBody(obj) {\r\n return (obj.hasOwnProperty("parts") && obj.hasOwnProperty("slop") && obj.hasOwnProperty("gameObject"));\r\n}\r\n/**\r\n * Check if object is an acceptable physical object for this plugin - a Matter Body, a tile, or an\r\n * object with a body property.\r\n */\r\nfunction isCollidingObject(obj) {\r\n // GameObjects, images, sprites and tile bodies should all have a body property.\r\n return isMatterBody(obj) || obj.body || obj instanceof Tile;\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9QaGFzZXJNYXR0ZXJDb2xsaXNpb25QbHVnaW4vLi92YWxpZC1jb2xsaXNpb24tb2JqZWN0LnRzP2QxM2YiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUF5QztBQUV6QyxJQUFPLElBQUksR0FBRyxpREFBYSxDQUFDO0FBYzVCLGlHQUFpRztBQUMxRixTQUFTLFlBQVksQ0FBQyxHQUFRO0lBQ25DLE9BQU8sQ0FDTCxHQUFHLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxJQUFJLEdBQUcsQ0FBQyxjQUFjLENBQUMsTUFBTSxDQUFDLElBQUksR0FBRyxDQUFDLGNBQWMsQ0FBQyxZQUFZLENBQUMsQ0FDOUYsQ0FBQztBQUNKLENBQUM7QUFFRDs7O0dBR0c7QUFDSSxTQUFTLGlCQUFpQixDQUFDLEdBQVE7SUFDeEMsZ0ZBQWdGO0lBQ2hGLE9BQU8sWUFBWSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEdBQUcsQ0FBQyxJQUFJLElBQUksR0FBRyxZQUFZLElBQUksQ0FBQztBQUM5RCxDQUFDIiwiZmlsZSI6Ii4vdmFsaWQtY29sbGlzaW9uLW9iamVjdC50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFRpbGVtYXBzLCBUeXBlcyB9IGZyb20gXCJwaGFzZXJcIjtcblxuaW1wb3J0IFRpbGUgPSBUaWxlbWFwcy5UaWxlO1xuaW1wb3J0IE1hdHRlckJvZHkgPSBUeXBlcy5QaHlzaWNzLk1hdHRlci5NYXR0ZXJCb2R5O1xuXG4vKiogQSB2YWxpZCBwaHlzaWNzLWVuYWJsZWQgZ2FtZSBvYmplY3QsIG9yIGp1c3QgYW4gb2JqZWN0IHRoYXQgaGFzIFwiYm9keVwiIHByb3BlcnR5ICovXG5leHBvcnQgdHlwZSBPYmplY3RXaXRoQm9keSA9IHtcbiAgYm9keTogTWF0dGVySlMuQm9keVR5cGU7XG59O1xuXG4vKipcbiAqIEEgdW5pb24gb2YgYWxsIHRoZSB0eXBlcyBvZiBwaHlzaWNzIG9iamVjdHMgd2UgY291bGQgaGF2ZSBpbiB0aGUgc2ltdWxhdGlvbiAtIGZyb20gcmF3IE1hdHRlci5qc1xuICogYm9kaWVzIHRvIHRpbGVzIGFuZCBwaHlzaWNzLWVuYWJsZWQgUGhhc2VyIEdhbWVPYmplY3RzLlxuICovXG5leHBvcnQgdHlwZSBDb2xsaWRpbmdPYmplY3QgPSBNYXR0ZXJCb2R5IHwgTWF0dGVySlMuQm9keVR5cGUgfCBUaWxlIHwgT2JqZWN0V2l0aEJvZHk7XG5cbi8qKiBEdWNrIHR5cGUgdG8gY2hlY2sgaWYgdGhlIGdpdmVuIG9iamVjdCBpcyBhIE1hdHRlciBib2R5IChiZWNhdXNlIHRoZXJlIGlzbid0IGEgcHJvdG90eXBlKS4gKi9cbmV4cG9ydCBmdW5jdGlvbiBpc01hdHRlckJvZHkob2JqOiBhbnkpOiBvYmogaXMgTWF0dGVyQm9keSB7XG4gIHJldHVybiAoXG4gICAgb2JqLmhhc093blByb3BlcnR5KFwicGFydHNcIikgJiYgb2JqLmhhc093blByb3BlcnR5KFwic2xvcFwiKSAmJiBvYmouaGFzT3duUHJvcGVydHkoXCJnYW1lT2JqZWN0XCIpXG4gICk7XG59XG5cbi8qKlxuICogQ2hlY2sgaWYgb2JqZWN0IGlzIGFuIGFjY2VwdGFibGUgcGh5c2ljYWwgb2JqZWN0IGZvciB0aGlzIHBsdWdpbiAtIGEgTWF0dGVyIEJvZHksIGEgdGlsZSwgb3IgYW5cbiAqIG9iamVjdCB3aXRoIGEgYm9keSBwcm9wZXJ0eS5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGlzQ29sbGlkaW5nT2JqZWN0KG9iajogYW55KTogb2JqIGlzIENvbGxpZGluZ09iamVjdCB7XG4gIC8vIEdhbWVPYmplY3RzLCBpbWFnZXMsIHNwcml0ZXMgYW5kIHRpbGUgYm9kaWVzIHNob3VsZCBhbGwgaGF2ZSBhIGJvZHkgcHJvcGVydHkuXG4gIHJldHVybiBpc01hdHRlckJvZHkob2JqKSB8fCBvYmouYm9keSB8fCBvYmogaW5zdGFuY2VvZiBUaWxlO1xufVxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./valid-collision-object.ts\n')},phaser:t=>{t.exports=__WEBPACK_EXTERNAL_MODULE_phaser__}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var s=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](s,s.exports,__webpack_require__),s.exports}__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var s in e)__webpack_require__.o(e,s)&&!__webpack_require__.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__("./index.ts");return __webpack_exports__})()},module.exports=factory(requirePhaser())})(phaserMatterCollision);var phaserMatterCollisionExports=phaserMatterCollision.exports;const PhaserMatterCollisionPlugin=getDefaultExportFromCjs(phaserMatterCollisionExports);class MatterGravityFixPlugin extends Phaser.Plugins.ScenePlugin{constructor(t,e){super(t,e)}boot(){const t=Phaser.Physics.Matter.Matter;this.applyGravityFix(t)}applyGravityFix(t){t.Engine._bodiesApplyGravity=function(t,e){var s=void 0!==e.scale?e.scale:.001,i=t.length;if((0!==e.x||0!==e.y)&&0!==s)for(var n=0;n{this.scene.start("splash")}),this)}loadFonts(){this.load.bitmapFont("default","assets/fonts/pico.png","assets/fonts/pico.xml")}loadImages(){this.load.image("pello","assets/images/pello_ok.png"),this.load.image("fireball","assets/images/fireball.png"),this.load.image("tiles","assets/maps/pixel-poem-tiles.png"),this.load.image("block","assets/images/block.png"),this.load.image("seesaw","assets/images/seesaw.png"),this.load.image("bubble","assets/images/bubble.png"),this.load.image("platform","assets/images/platform.png")}loadMaps(){this.load.tilemapTiledJSON("scene0","assets/maps/level.json")}loadAudios(){Array(5).fill(0).forEach(((t,e)=>{this.load.audio(`climb${e}`,`assets/sounds/climb${e}.mp3`)})),this.load.audio("splash","assets/sounds/splash.mp3"),this.load.audio("music","assets/sounds/music.mp3"),this.load.audio("jump","assets/sounds/jump.mp3"),this.load.audio("bubble","assets/sounds/bubble.mp3"),this.load.audio("trap","assets/sounds/trap.mp3"),this.load.audio("crash","assets/sounds/crash.mp3"),this.load.audio("fireball","assets/sounds/fireball.mp3"),this.load.audio("win","assets/sounds/win.mp3"),this.load.audio("start","assets/sounds/start.mp3"),this.load.audio("death","assets/sounds/death.mp3")}loadSpritesheets(){this.load.spritesheet("player","assets/images/player.png",{frameWidth:48,frameHeight:48}),this.load.spritesheet("dust","assets/images/dust.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("coin","assets/images/coin.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("keys","assets/images/keys.png",{frameWidth:48,frameHeight:48}),this.load.spritesheet("bat","assets/images/bat.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("wizard","assets/images/wizard.png",{frameWidth:48,frameHeight:48})}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(43771,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class Bat extends Phaser.Physics.Matter.Sprite{constructor(t,e,s,i="bat",n){super(t.matter.world,e,s,i,0),this.label="bat",this.scene=t,this.scene.add.existing(this),this.startX=e,this.direction=Phaser.Math.RND.pick([-1,1]),this.setFixedRotation(),this.setIgnoreGravity(!0),this.addCollisions(),this.init()}init(){this.scene.anims.create({key:this.label,frames:this.scene.anims.generateFrameNumbers(this.label,{start:0,end:1}),frameRate:5,repeat:-1}),this.scene.anims.create({key:this.label+"death",frames:this.scene.anims.generateFrameNumbers(this.label,{start:2,end:5}),frameRate:5}),this.anims.play(this.label,!0),this.on("animationcomplete",this.animationComplete,this),this.setVelocityX(5*this.direction),this.scene.events.on("update",this.update,this)}addCollisions(){this.unsubscribeBatCollide=this.scene.matterCollision.addOnCollideStart({objectA:this,callback:this.onBatCollide,context:this})}onBatCollide({gameObjectA:t,gameObjectB:e}){e instanceof Bubble&&(e.load("bat"),this.destroy())}update(){this.active&&Math.abs(this.body.velocity.x)<=.5&&this.turn()}turn(){this.direction=-this.direction,this.flipX=this.direction>0,this.setFlipX(this.direction>0),this.setVelocityX(5*this.direction)}death(){this.dead=!0,this.anims.play(this.label+"death")}animationComplete(t,e){t.key===this.label+"death"&&this.destroy()}}class Fireball extends Phaser.Physics.Matter.Sprite{constructor(t,e,s,i){super(t.matter.world,e,s,"fireball",0),this.label="fireball",this.scene=t,this.direction=i,t.add.existing(this),this.setIgnoreGravity(!0),this.setVelocityX(5*this.direction),this.setVelocityY(Phaser.Math.Between(0,-8)),this.setBounce(1),this.init()}init(){this.scene.events.on("update",this.update,this),this.tween=this.scene.tweens.add({targets:this,duration:200,scale:{from:.9,to:1},repeat:-1}),this.scene.time.delayedCall(3e3,(()=>{this.destroy()}),null,this)}update(){var t;null==(t=this.scene)||t.gameOver}destroy(){this.tween.destroy(),super.destroy()}}class Wizard extends Phaser.Physics.Matter.Sprite{constructor(t,e,s,i="wizard",n){super(t.matter.world,e,s,i,0),this.label="wizard",this.scene.add.existing(this),this.startX=e,this.direction=Phaser.Math.RND.pick([-1,1]),this.setFixedRotation(),this.addCollisions(),this.init()}init(){this.scene.anims.create({key:this.label,frames:this.scene.anims.generateFrameNumbers(this.label,{start:0,end:5}),frameRate:5,repeat:-1}),this.anims.play(this.label,!0),this.scene.events.on("update",this.update,this),this.timer=this.scene.time.addEvent({delay:3e3,callback:this.directShot,callbackScope:this,loop:!0})}addCollisions(){this.unsubscribeBatCollide=this.scene.matterCollision.addOnCollideStart({objectA:this,callback:this.onWizardCollide,context:this})}onWizardCollide({gameObjectA:t,gameObjectB:e}){e instanceof Bubble&&(e.load("wizard"),this.destroy())}directShot(){this.scene.playAudio("fireball"),Phaser.Math.Distance.BetweenPoints(this.scene.player,this),this.anims.play("wizardshot",!0),new Fireball(this.scene,this.x,this.y,this.direction),this.delayedTurn=this.scene.time.delayedCall(1e3,(()=>{this.turn()}),null,this)}turn(){this.direction=-this.direction,this.flipX=this.direction>0,this.setFlipX(this.direction>0),this.setVelocityX(5*this.direction)}destroy(){this.timer&&this.timer.destroy(),this.delayedTurn&&this.delayedTurn.destroy(),this.fireball&&this.fireball.destroy(),super.destroy()}}class Bubble extends Phaser.Physics.Matter.Sprite{constructor(t,e,s,i,n={isStatic:!0}){super(t.matter.world,e+i,s,"bubble",0,n),this.offset=i,this.setFriction(1,0,1/0),this.startX=e,this.startY=s,this.scene=t,t.add.existing(this),this.moveVertically(),this.scene.events.on("update",this.update,this)}load(t){this.scene.playAudio("trap"),this.loaded=this.scene.add.sprite(this.x,this.y,t).setOrigin(.5).setScale(.6),this.loaded.name=t,this.loadedTween=this.scene.tweens.add({targets:this.loaded,rotation:"+=5",yoyo:!0,repeat:-1})}moveHorizontally(){this.scene.tweens.add({targets:this,scaleX:{from:1,to:.9},yoyo:!0,repeat:-1,duration:200}),this.scene.tweens.addCounter({from:0,to:Phaser.Math.Between(-400,400),duration:3500,ease:Phaser.Math.Easing.Sine.InOut,onUpdate:(t,e)=>{const s=this.startX+e.value,i=s-this.x;this.x=s,this.setVelocityX(i)},onComplete:()=>{this.scene.time.delayedCall(1e3,(()=>{this.destroy()}),null,this)}})}moveVertically(){this.blob=this.scene.tweens.add({targets:this,scaleX:{from:1,to:.9},yoyo:!0,repeat:-1,duration:200}),this.scene.tweens.addCounter({from:0,to:-300,duration:4500,ease:Phaser.Math.Easing.Sine.InOut,onUpdate:(t,e)=>{const s=this.startY+e.value,i=s-this.y;this.y=s,this.setVelocityY(i)},onComplete:()=>{this.blob.destroy(),this.scene.time.delayedCall(1e3,(()=>{this.destroy()}),null,this)}})}respawn(){this.loadedTween.destroy(),"wizard"===this.loaded.name?new Wizard(this.scene,this.x,this.y):"bat"===this.loaded.name&&new Bat(this.scene,this.x,this.y),this.loaded.destroy(),this.loaded=null}update(){this.active&&this.loaded&&(this.loaded.x=this.x,this.loaded.y=this.y)}destroy(){this.scene&&(this.scene.playAudio("crash"),this.loaded&&this.respawn(),super.destroy())}}class Dust extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="dust",n=!1){super(t,e,s,i),this.scene=t,this.name=i,this.setScale(.5),this.scene.add.existing(this),this.init(n)}init(t){t&&this.scene.tweens.add({targets:this,duration:Phaser.Math.Between(500,1e3),alpha:{from:1,to:0},onComplete:()=>{this.destroy()}}),this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:10}),frameRate:10}),this.on("animationcomplete",this.animationComplete,this),this.anims.play(this.name,!0)}animationComplete(){this.destroy()}}class Player{constructor(t,e,s){this.scene=t,this.label="player",this.moveForce=.01,this.invincible=!0,this.isTouching={left:!1,right:!1,ground:!1},this.canJump=!0,this.jumpCooldownTimer=null,this.canShoot=!0,this.shootCooldownTimer=null,this.onWall=!1,this.init(e,s),this.addControls()}init(t,e){this.scene.matter.world.on("beforeupdate",this.resetTouching,this),this.sprite=this.scene.matter.add.sprite(0,0,"player",0);const{Body:s,Bodies:i}=Phaser.Physics.Matter.Matter,{width:n,height:o}=this.sprite,a=i.rectangle(0,5,n-14,o-10,{chamfer:{radius:10}});this.sensors={bottom:i.rectangle(0,.5*o,.25*n,2,{isSensor:!0}),left:i.rectangle(.35*-n,0,2,.5*o,{isSensor:!0}),right:i.rectangle(.35*n,0,2,.5*o,{isSensor:!0})};const r=s.create({parts:[a,this.sensors.bottom,this.sensors.left,this.sensors.right],frictionStatic:0,frictionAir:.02,friction:.1,render:{sprite:{xOffset:.5,yOffset:.5}}});this.sprite.setExistingBody(r).setFixedRotation().setPosition(t,e),this.addEvents(),this.addColliders(),this.addAnimations(),this.initInvincible()}addEvents(){this.scene.events.on("update",this.update,this),this.scene.events.once("shutdown",this.destroy,this),this.scene.events.once("destroy",this.destroy,this)}addColliders(){this.scene.matterCollision.addOnCollideStart({objectA:[this.sensors.bottom,this.sensors.left,this.sensors.right],callback:this.onSensorCollide,context:this}),this.scene.matterCollision.addOnCollideActive({objectA:[this.sensors.bottom,this.sensors.left,this.sensors.right],callback:this.onSensorCollide,context:this})}addAnimations(){this.scene.anims.create({key:"playeridle",frames:this.scene.anims.generateFrameNumbers(this.label,{start:0,end:1}),frameRate:5,repeat:-1}),this.scene.anims.create({key:"playerwalk",frames:this.scene.anims.generateFrameNumbers(this.label,{start:0,end:3}),frameRate:6}),this.scene.anims.create({key:"playershot",frames:this.scene.anims.generateFrameNumbers(this.label,{start:4,end:5}),frameRate:4}),this.sprite.anims.play("playeridle",!0),this.sprite.on("animationcomplete",this.animationComplete,this)}initInvincible(){this.scene.tweens.add({targets:this.sprite,alpha:{from:.5,to:1},duration:200,repeat:10,onComplete:()=>{this.invincible=!1}})}onSensorCollide({bodyA:t,bodyB:e,pair:s}){e.isSensor||(t===this.sensors.left?(this.friction(),this.onWall=!0,this.isTouching.left=!0,s.separation>.5&&(this.sprite.x+=s.separation-.5)):t===this.sensors.right?(this.friction(),this.onWall=!0,this.isTouching.right=!0,s.separation>.5&&(this.sprite.x-=s.separation-.5)):t===this.sensors.bottom&&(this.land(),this.isTouching.ground=!0))}resetTouching(){this.isTouching.left=!1,this.isTouching.right=!1,this.isTouching.ground=!1}addControls(){this.cursor=this.scene.input.keyboard.createCursorKeys(),this.W=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W),this.A=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.A),this.S=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S),this.D=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.D)}update(){this.isOnGround=this.isTouching.ground,this.isInAir=!this.isOnGround,this.moveForce=this.isOnGround?.01:.005,this.D.isDown||this.cursor.right.isDown?(this.sprite.setFlipX(!0),this.isInAir&&this.isTouching.right||(this.step(),this.sprite.anims.play("playerwalk",!0),this.sprite.setVelocityX(5))):this.A.isDown||this.cursor.left.isDown?(this.sprite.setFlipX(!1),this.isInAir&&this.isTouching.left||(this.step(),this.sprite.anims.play("playerwalk",!0),this.sprite.setVelocityX(-5))):"playershot"!==this.sprite.anims.currentAnim.key&&this.sprite.anims.play("playeridle",!0),this.sprite.body.velocity.x>7?this.sprite.setVelocityX(7):this.sprite.body.velocity.x<-7&&this.sprite.setVelocityX(-7),this.checkJump(),this.checkShoot()}checkJump(){(this.canJump&&this.isOnGround||this.onWall)&&(this.W.isDown||this.cursor.up.isDown)&&(this.sprite.setVelocityY(-8),this.scene.playAudio("jump"),this.canJump=!1,this.onWall=!1,this.jumpCooldownTimer=this.scene.time.addEvent({delay:250,callback:()=>this.canJump=!0}))}checkShoot(){if(this.canShoot&&(Phaser.Input.Keyboard.JustDown(this.cursor.down)||Phaser.Input.Keyboard.JustDown(this.W))){const t=this.sprite.flipX?128:-128;this.sprite.anims.play("playershot",!0),this.scene.playAudio("bubble"),this.canShoot=!1,new Bubble(this.scene,this.sprite.x,this.sprite.y,t),this.shootCooldownTimer=this.scene.time.addEvent({delay:500,callback:()=>this.canShoot=!0})}}destroy(){this.scene.playAudio("death"),this.destroyed=!0,this.scene.events.off("update",this.update,this),this.scene.events.off("shutdown",this.destroy,this),this.scene.events.off("destroy",this.destroy,this),this.scene.matter.world&&this.scene.matter.world.off("beforeupdate",this.resetTouching,this);const t=[this.sensors.bottom,this.sensors.left,this.sensors.right];this.scene.matterCollision.removeOnCollideStart({objectA:t}),this.scene.matterCollision.removeOnCollideActive({objectA:t}),this.jumpCooldownTimer&&this.jumpCooldownTimer.destroy(),this.sprite.destroy()}step(){Phaser.Math.Between(0,5)>4&&this.scene.trailLayer.add(new Dust(this.scene,this.sprite.x,this.sprite.y+Phaser.Math.Between(10,16)))}friction(){Array(Phaser.Math.Between(2,4)).fill(0).forEach((t=>{new Dust(this.scene,this.sprite.x+Phaser.Math.Between(-8,8),this.sprite.y+Phaser.Math.Between(-32,32))}))}land(){this.sprite.body.velocity.y<1||Array(Phaser.Math.Between(3,6)).fill(0).forEach((t=>{new Dust(this.scene,this.sprite.x+Phaser.Math.Between(-32,32),this.sprite.y+Phaser.Math.Between(10,16))}))}explosion(){Array(Phaser.Math.Between(10,15)).fill(0).forEach((t=>{new Dust(this.scene,this.sprite.x+Phaser.Math.Between(-32,32),this.sprite.y+Phaser.Math.Between(20,36))}))}animationComplete(t,e){"playershot"===t.key&&this.sprite.anims.play("playeridle",!0)}}var dungeon_min={exports:{}};"undefined"!=typeof self&&self,dungeon_min.exports=function(){return s={},t.m=e=[function(t,e){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,s){var i=s(4),n=s(5),o=s(6),a=s(7),r=s(8),l=s(9),h=s(10);h.alea=i,h.xor128=n,h.xorwow=o,h.xorshift7=a,h.xor4096=r,h.tychei=l,t.exports=h},function(t,e,s){(function(t){var i;!function(t){function n(t){var e,s=this,i=(e=4022871197,function(t){t=String(t);for(var s=0;s>>0,e=(i*=e)>>>0,e+=4294967296*(i-=e)}return 2.3283064365386963e-10*(e>>>0)});s.next=function(){var t=2091639*s.s0+2.3283064365386963e-10*s.c;return s.s0=s.s1,s.s1=s.s2,s.s2=t-(s.c=0|t)},s.c=1,s.s0=i(" "),s.s1=i(" "),s.s2=i(" "),s.s0-=i(t),s.s0<0&&(s.s0+=1),s.s1-=i(t),s.s1<0&&(s.s1+=1),s.s2-=i(t),s.s2<0&&(s.s2+=1),i=null}function o(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function a(t,e){var s=new n(t),i=e&&e.state,a=s.next;return a.int32=function(){return 4294967296*s.next()|0},a.double=function(){return a()+11102230246251565e-32*(2097152*a()|0)},a.quick=a,i&&("object"==typeof i&&o(i,s),a.state=function(){return o(s,{})}),a}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.alea=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){(function(t){var i;!function(t){function n(t){var e=this,s="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:s+=t;for(var i=0;i>>0)/4294967296}var i=new n(t),a=e&&e.state;return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,a&&("object"==typeof a&&o(a,i),s.state=function(){return o(i,{})}),s}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.xor128=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){(function(t){var i;!function(t){function n(t){var e=this,s="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,t===((e.v=0)|t)?e.x=t:s+=t;for(var i=0;i>>4),e.next()}function o(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function a(t,e){function s(){return(i.next()>>>0)/4294967296}var i=new n(t),a=e&&e.state;return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,a&&("object"==typeof a&&o(a,i),s.state=function(){return o(i,{})}),s}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.xorwow=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){(function(t){var i;!function(t){function n(t){var e=this;e.next=function(){var t,s,i=e.x,n=e.i;return t=i[n],s=(t^=t>>>7)^t<<24,s^=(t=i[n+1&7])^t>>>10,s^=(t=i[n+3&7])^t>>>3,s^=(t=i[n+4&7])^t<<7,t=i[n+7&7],s^=(t^=t<<13)^t<<9,i[n]=s,e.i=n+1&7,s},function(t,e){var s,i=[];if(e===(0|e))i[0]=e;else for(e=""+e,s=0;s>>0)/4294967296}null==t&&(t=+new Date);var i=new n(t),a=e&&e.state;return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,a&&(a.x&&o(a,i),s.state=function(){return o(i,{})}),s}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.xorshift7=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){(function(t){var i;!function(t){function n(t){var e=this;e.next=function(){var t,s,i=e.w,n=e.X,o=e.i;return e.w=i=i+1640531527|0,s=n[o+34&127],t=n[o=o+1&127],s^=s<<13,t^=t<<17,s^=s>>>15,t^=t>>>12,s=n[o]=s^t,e.i=o,s+(i^i>>>16)|0},function(t,e){var s,i,n,o,a,r=[],l=128;for(e===(0|e)?(i=e,e=null):(e+="\0",i=0,l=Math.max(l,e.length)),n=0,o=-32;o>>15,i^=i<<4,i^=i>>>13,0<=o&&(a=a+1640531527|0,n=0==(s=r[127&o]^=i+a)?n+1:0);for(128<=n&&(r[127&(e&&e.length||0)]=-1),n=127,o=512;0>>15,s^=s>>>12,r[n]=i^s;t.w=a,t.X=r,t.i=n}(e,t)}function o(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function a(t,e){function s(){return(i.next()>>>0)/4294967296}null==t&&(t=+new Date);var i=new n(t),a=e&&e.state;return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,a&&(a.X&&o(a,i),s.state=function(){return o(i,{})}),s}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.xor4096=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){(function(t){var i;!function(t){function n(t){var e=this,s="";e.next=function(){var t=e.b,s=e.c,i=e.d,n=e.a;return t=t<<25^t>>>7^s,s=s-i|0,i=i<<24^i>>>8^n,n=n-t|0,e.b=t=t<<20^t>>>12^s,e.c=s=s-i|0,e.d=i<<16^s>>>16^n,e.a=n-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):s+=t;for(var i=0;i>>0)/4294967296}var i=new n(t),a=e&&e.state;return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,a&&("object"==typeof a&&o(a,i),s.state=function(){return o(i,{})}),s}t&&t.exports?t.exports=a:s(0)&&s(2)?void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i):this.tychei=a}(t,s(0))}).call(this,s(1)(t))},function(t,e,s){var i;!function(n,o,a){var r,l=256,h=a.pow(l,6),d=a.pow(2,52),c=2*d,Q=l-1;function B(t,e,s){function i(){for(var t=u.g(6),e=h,s=0;t>>=1;return(t+s)/e}var Q=[],B=b(function t(e,s){var i,n=[],o=typeof e;if(s&&"object"==o)for(i in e)try{n.push(t(e[i],s-1))}catch(a){}return n.length?n:"string"==o?e:e+"\0"}((e=1==e?{entropy:!0}:e||{}).entropy?[t,g(o)]:null==t?function(){try{var t;return r&&(t=r.randomBytes)?t=t(l):(t=new Uint8Array(l),(n.crypto||n.msCrypto).getRandomValues(t)),g(t)}catch(i){var e=n.navigator,s=e&&e.plugins;return[+new Date,n,s,n.screen,g(o)]}}():t,3),Q),u=new F(Q);return i.int32=function(){return 0|u.g(4)},i.quick=function(){return u.g(4)/4294967296},i.double=i,b(g(u.S),o),(e.pass||s||function(t,e,s,i){return i&&(i.S&&U(i,u),t.state=function(){return U(u,{})}),s?(a.random=t,e):t})(i,B,"global"in e?e.global:this==a,e.state)}function F(t){var e,s=t.length,i=this,n=0,o=i.i=i.j=0,a=i.S=[];for(s||(t=[s++]);nt.right||this.bottomt.bottom)},c.prototype.isInBounds=function(t,e){return 0<=t&&tthis.width)throw new Error("Room max width cannot exceed dungeon width.");if(this.roomHeightConfig.max>this.height)throw new Error("Room max height cannot exceed dungeon height.");if(this.maxRoomArea= min.");if(s<3)throw new Error("Room width and height must be >= 3.")},b.prototype.getConfig=function(){return{width:this.width,height:this.height,doorPadding:this.doorPadding,randomSeed:this.randomSeed,rooms:{width:this.roomWidthConfig,height:this.roomHeightConfig,maxArea:this.maxRoomArea,maxRooms:this.maxRooms}}},b.prototype.drawToConsole=function(t){!function(t,e){void 0===e&&(e={});var s=Object.assign({},{empty:" ",emptyColor:"rgb(0, 0, 0)",wall:"#",wallColor:"rgb(255, 0, 0)",floor:"_",floorColor:"rgb(210, 210, 210)",door:".",doorColor:"rgb(0, 0, 255)",fontSize:"15px"},e),i="",n=[];i+="Dungeon: the console window should be big enough to see all of the guide on the next line:\n",i+="%c|"+"=".repeat(2*t.width-2)+"|\n\n",n.push("font-size: "+s.fontSize);for(var o=0;o"+s.empty+"",floor:""+s.floor+"",door:""+s.door+"",wall:""+s.wall+""}).map((function(t){return""+t.join("")+""})).join("");return"
"+i+"
"}(t,e);return document.createRange().createContextualFragment(s)}(this,t)},b.prototype.getMappedTiles=function(t){return void 0===t&&(t={}),t=Object.assign({},{empty:0,wall:1,floor:2,door:3},t),this.tiles.map((function(e){return e.map((function(e){return e===l.EMPTY?t.empty:e===l.WALL?t.wall:e===l.FLOOR?t.floor:e===l.DOOR?t.door:void 0}))}))},b.prototype.getCenter=function(){return{x:Math.floor(this.width/2),y:Math.floor(this.height/2)}},b.prototype.generate=function(){this.rooms=[],this.roomGrid=[];for(var t=0;t=this.width||e>=this.height||0this.width-1)return!1;if(t.y<0||t.bottom>this.height-1)return!1;for(var e=0;ethis.maxRoomArea;);return new Q(t,e)},b.prototype.generateRoom=function(){for(var t=this.createRandomRoom(),e=150;0{const{x:e,y:s,width:i,height:n}=t;this.groundLayer.weightedRandomize([{index:17,weight:9},{index:[7,8,9,17,18,19],weight:1}],e+1,s+1,i-2,n-2),this.placeCorners(t),this.placeWalls(t);const o=t.getDoorLocations();this.addDoors(t,o,e,s),this.addKey(t),this.addFoes(t),this.addCoins(t),this.addSeeSaw(t)}))}generateDungeon(){this.dungeon=new Dungeon({width:50,height:50,doorPadding:2,rooms:{width:{min:7,max:15},height:{min:7,max:15},maxRooms:12}})}generateMap(){this.map=this.scene.make.tilemap({tileWidth:48,tileHeight:48,width:this.dungeon.width,height:this.dungeon.height});const t=this.map.addTilesetImage("tiles",null,48,48,0,0);this.groundLayer=this.map.createBlankLayer("Layer 1",t),this.stuffLayer=this.map.createBlankLayer("Stuff",t);const e=this.dungeon.getMappedTiles({empty:-1,floor:-1,door:3,wall:0});this.groundLayer.putTilesAt(e,0,0),this.groundLayer.setCollision(0),this.groundLayer.setCollisionByProperty({collides:!0}),this.scene.matter.world.convertTilemapLayer(this.groundLayer)}placeCorners(t){const{left:e,right:s,top:i,bottom:n}=t;this.groundLayer.putTileAt(0,e,i),this.groundLayer.putTileAt(5,s,i),this.groundLayer.putTileAt(45,s,n),this.groundLayer.putTileAt(40,e,n)}placeWalls(t){const{width:e,height:s,left:i,right:n,top:o,bottom:a}=t;this.groundLayer.weightedRandomize([{index:2,weight:4},{index:[1,2,3,4],weight:1}],i+1,o,e-2,1),this.groundLayer.weightedRandomize([{index:42,weight:4},{index:[41,42,43,44],weight:1}],i+1,a,e-2,1),this.groundLayer.weightedRandomize([{index:10,weight:4},{index:[10,20,30],weight:1}],i,o+1,1,s-2),this.groundLayer.weightedRandomize([{index:15,weight:4},{index:[15,25,35],weight:1}],n,o+1,1,s-2)}addDoors(t,e,s,i){for(let n=0;n{Array(s).fill().forEach(((t,s)=>{const o=this.groundLayer.tileToWorldXY(n+e,i+s);new Coin(this.scene,o.x+20,o.y+20)}))}))}addCoinsdBottom(t,e,s){const i=t.bottom-Phaser.Math.Between(1,2),n=t.left+Phaser.Math.Between(1,2);Array(e).fill().forEach(((t,e)=>{Array(s).fill().forEach(((t,s)=>{const o=this.groundLayer.tileToWorldXY(n+e,i-s);new Coin(this.scene,o.x+20,o.y+20)}))}))}addCoinsdLeft(t,e,s){const i=t.top+Phaser.Math.Between(3,4),n=t.left+Phaser.Math.Between(1,2);Array(e).fill().forEach(((t,e)=>{Array(s).fill().forEach(((t,s)=>{const o=this.groundLayer.tileToWorldXY(n+e,i-s);new Coin(this.scene,o.x+20,o.y+20)}))}))}addCoinsdRight(t,e,s){const i=t.top+Phaser.Math.Between(1,2),n=t.right-Phaser.Math.Between(3,4);Array(e).fill().forEach(((t,e)=>{Array(s).fill().forEach(((t,s)=>{const o=this.groundLayer.tileToWorldXY(n-e,i+s);new Coin(this.scene,o.x+20,o.y+20)}))}))}addFoes(t){const e=Phaser.Math.Between(t.left+2,t.right-2),s=Phaser.Math.Between(t.top+2,t.bottom-2),i=this.groundLayer.tileToWorldXY(e,s);Phaser.Math.Between(0,5)>4?new Wizard(this.scene,i.x+22,i.y+22,this.groundLayer):new Bat(this.scene,i.x+22,i.y+22,this.groundLayer)}addTopTraps(t){const{x:e,y:s,width:i,height:n,left:o,right:a,top:r,bottom:l,tiles:h}=t;h[0].forEach(((t,e)=>{1===t&&e>0&&ethis.finishScene()),this)}addScores(){this.add.sprite(62,26,"coin",0).setOrigin(.5).setScrollFactor(0).setScale(.8),this.scoreCoins=this.add.bitmapText(100,24,"default","x0",15).setOrigin(.5).setScrollFactor(0),this.scoreSeconds=this.add.bitmapText(this.center_width,24,"default","0",15).setOrigin(.5).setScrollFactor(0),this.add.sprite(this.width-90,24,"keys",0).setOrigin(.5).setScrollFactor(0).setScale(.8),this.scoreKeys=this.add.bitmapText(this.width-48,24,"default","x0",15).setOrigin(.5).setScrollFactor(0),this.timer=this.time.addEvent({delay:1e3,callback:()=>{this.updateSeconds()},callbackScope:this,loop:!0})}addPlayer(){this.trailLayer=this.add.layer(),this.player=new Player(this,this.dungeon.map.widthInPixels/2,this.dungeon.map.heightInPixels/2,100)}addCollisions(){this.unsubscribePlayerCollide=this.matterCollision.addOnCollideStart({objectA:this.player.sprite,callback:this.onPlayerCollide,context:this}),this.matter.world.on("collisionstart",(t=>{t.pairs.forEach((t=>{t.bodyA,t.bodyB}))}))}onPlayerCollide({gameObjectA:t,gameObjectB:e}){e&&("coin"===e.label&&this.playerPicksCoin(e),"keys"===e.label&&this.playerPicksKey(e),"bat"===e.label&&this.playerHitsFoe(e),"wizard"===e.label&&this.playerHitsFoe(e),"fireball"===e.label&&this.playerHitsFoe(e),e instanceof Phaser.Tilemaps.Tile&&e.properties.isLethal&&(this.unsubscribePlayerCollide(),this.restartScene()))}playerPicksCoin(t){this.showPoints(t.x,t.y,1,this.scoreCoins),t.destroy(),this.updateCoins(),this.playAudio("coin")}playerPicksKey(t){this.updateKeys(),this.showPoints(t.x,t.y,this.registry.get("keys")+"/"+this.dungeon.dungeon.rooms.length,this.scoreKeys),t.destroy()}playerHitsFoe(t){this.player.invincible||(this.player.explosion(),t.destroy(),this.restartScene())}showPoints(t,e,s,i,n=16777215){let o=this.add.bitmapText(t+20,e-80,"default","+"+s,10).setDropShadow(2,3,n,.7).setOrigin(.5);this.tweens.add({targets:o,duration:1e3,alpha:{from:1,to:0},x:{from:o.x+Phaser.Math.Between(-10,10),to:o.x+Phaser.Math.Between(-40,40)},y:{from:o.y-10,to:o.y-60},onComplete:()=>{o.destroy()}}),this.textUpdateEffect(i,n)}addCamera(){this.cameras.main.setBounds(0,0,this.dungeon.map.widthInPixels,this.dungeon.map.heightInPixels),this.cameras.main.startFollow(this.player.sprite,!1,.5,.5),this.cameras.main.setBackgroundColor(2429722)}loadAudios(){this.audios={jump:this.sound.add("jump"),bubble:this.sound.add("bubble"),trap:this.sound.add("trap"),crash:this.sound.add("crash"),fireball:this.sound.add("fireball"),death:this.sound.add("death"),coin:this.sound.add("start")}}playAudio(t){this.audios[t].play()}restartScene(){this.player.sprite.visible=!1,this.cameras.main.shake(100),this.cameras.main.fade(250,0,0,0),this.cameras.main.once("camerafadeoutcomplete",(()=>this.scene.restart()))}finishScene(){this.cameras.main.fade(250,0,0,0),this.cameras.main.once("camerafadeoutcomplete",(()=>{this.scene.start("outro",{next:"underwater",name:"STAGE",number:this.number+1})}))}updateSeconds(t=1){const e=+this.registry.get("seconds")+t;this.registry.set("seconds",e),this.scoreSeconds.setText(e)}updateCoins(t=1){const e=+this.registry.get("coins")+t;this.registry.set("coins",e),this.scoreCoins.setText("x"+e)}updateKeys(t=1){const e=+this.registry.get("keys")+t;this.registry.set("keys",e),this.scoreKeys.setText("x"+e),e===this.dungeon.dungeon.rooms.length&&this.finishScene()}textUpdateEffect(t,e){t.setTint(e);const s=t.y;this.tweens.add({targets:t,duration:100,alpha:{from:1,to:.8},scale:{from:1.2,to:1},repeat:5,onComplete:()=>{t.setTint(16777215),t.y=s}})}}class Outro extends Phaser.Scene{constructor(){super({key:"outro"})}init(t){this.name=t.name,this.number=t.number,this.next=t.next}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.showPlayer(),this.sound.add("win").play(),this.scoreCoins=this.add.bitmapText(this.center_width,50,"default","Coins: "+this.registry.get("coins"),25).setOrigin(.5).setScrollFactor(0),this.scoreSeconds=this.add.bitmapText(this.center_width,100,"default","Time: "+this.registry.get("seconds"),25).setOrigin(.5).setScrollFactor(0),this.add.bitmapText(this.center_width,this.center_height-20,"default","YOU DID IT!!",40).setOrigin(.5),this.add.bitmapText(this.center_width,this.center_height+40,"default","Press space to restart",25).setOrigin(.5),this.input.keyboard.on("keydown-ENTER",(()=>this.loadNext()),this),this.input.keyboard.on("keydown-SPACE",(()=>this.loadNext()),this)}loadNext(){this.scene.start("splash")}showPlayer(){this.player=this.add.sprite(this.center_width,this.center_height-120,"player").setOrigin(.5).setScale(3),this.anims.create({key:"playeridle",frames:this.anims.generateFrameNumbers("player",{start:0,end:1}),frameRate:5,repeat:-1}),this.player.anims.play("playeridle")}}class Splash extends Phaser.Scene{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.backLayer=this.add.layer(),this.cameras.main.setBackgroundColor(0),this.showTitle(),this.addPlayerAndFoe(),this.addAnimationTweens(),this.time.delayedCall(1e3,(()=>this.showInstructions()),null,this),this.input.keyboard.on("keydown-SPACE",(()=>this.startGame()),this),this.input.keyboard.on("keydown-ENTER",(()=>this.startGame()),this),this.playMusic()}startGame(){this.theme&&this.theme.stop(),this.scene.start("transition")}showTitle(){this.textShadow1=this.add.bitmapText(this.center_width,100,"default","DUNGEON",85).setTint(16742522).setOrigin(.5),this.textShadow2=this.add.bitmapText(this.center_width,250,"default","BOBBLE",85).setTint(16742522).setOrigin(.5),this.text1=this.add.bitmapText(this.center_width,100,"default","DUNGEON",85).setTint(3153968).setOrigin(.5),this.text2=this.add.bitmapText(this.center_width,250,"default","BOBBLE",85).setTint(3153968).setOrigin(.5),this.text11=this.add.bitmapText(this.center_width,100,"default","DUNGEON",88).setTint(43771).setOrigin(.5),this.text22=this.add.bitmapText(this.center_width,250,"default","BOBBLE",88).setTint(43771).setOrigin(.5),this.tweens.add({targets:[this.textShadow1,this.textShadow2],duration:1e3,x:"+=10",y:"+=10",yoyo:!0,repeat:-1})}playMusic(t="splash"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.3,rate:1,detune:0,seek:0,loop:!0,delay:0})}showInstructions(){this.add.bitmapText(this.center_width,430,"default","WASD/Arrows: move",30).setDropShadow(1,1,16742522,.7).setOrigin(.5),this.add.sprite(this.center_width-60,490,"pello").setOrigin(.5).setScale(.3),this.add.bitmapText(this.center_width+40,490,"default","By PELLO",15).setDropShadow(1,1,16742522,.7).setOrigin(.5),this.space=this.add.bitmapText(this.center_width,550,"default","Press SPACE to start",25).setDropShadow(1,1,4007227,.7).setOrigin(.5),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}addPlayerAndFoe(){this.player=this.add.sprite(this.width-100,350,"player").setScale(2),this.anims.create({key:"playeridle",frames:this.anims.generateFrameNumbers("player",{start:0,end:3}),frameRate:5,repeat:-1}),this.player.anims.play("playeridle"),this.foe=this.add.sprite(this.width,350,"wizard").setScale(2),this.anims.create({key:"foe",frames:this.anims.generateFrameNumbers("wizard",{start:0,end:4}),frameRate:5,repeat:-1}),this.foe.anims.play("foe")}addAnimationTweens(){this.tweens.add({targets:[this.player],x:{from:this.player.x,to:0},duration:2500,yoyo:!0,repeat:-1,onYoyo:()=>{this.player.flipX=!this.player.flipX},onRepeat:()=>{this.player.flipX=!this.player.flipX}}),this.tweens.add({targets:[this.foe],x:{from:this.foe.x,to:100},duration:2500,yoyo:!0,repeat:-1,onYoyo:()=>{this.foe.flipX=!this.foe.flipX},onRepeat:()=>{this.foe.flipX=!this.foe.flipX}})}}class Transition extends Phaser.Scene{constructor(){super({key:"transition"})}create(){this.sound.stopAll(),this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.sound.add("start").play(),this.playMusic(),this.key=this.add.sprite(this.center_width,this.center_height-120,"keys",0).setOrigin(.5).setScale(2),this.add.bitmapText(this.center_width,this.center_height-20,"default","GET ALL KEYS",30).setOrigin(.5),this.add.bitmapText(this.center_width,this.center_height+40,"default","from all rooms!",25).setOrigin(.5),this.input.keyboard.on("keydown-ENTER",(()=>this.loadNext()),this),this.input.keyboard.on("keydown-SPACE",(()=>this.loadNext()),this),this.time.delayedCall(1e3,(()=>this.loadNext()),null,this)}loadNext(){this.scene.start("game")}playMusic(t="music"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.2,rate:1,detune:0,seek:0,loop:!0,delay:0})}}const config={width:600,height:600,scale:{mode:Phaser$1.Scale.FIT,autoCenter:Phaser$1.Scale.CENTER_BOTH},autoRound:!1,parent:"game-container",physics:{default:"matter",matter:{debug:!1}},plugins:{scene:[{plugin:PhaserMatterCollisionPlugin,key:"matterCollision",mapping:"matterCollision"},{key:"MatterGravityFixPlugin",plugin:MatterGravityFixPlugin,mapping:"matterGravityFix",start:!0}]},scene:[Bootloader,Splash,Transition,Game,Outro]};new Phaser$1.Game(config); diff --git a/dungeon/dist/assets/phaser-D-IeUSbb.js b/dungeon/dist/assets/phaser-D-IeUSbb.js new file mode 100644 index 00000000..d1e60dd0 --- /dev/null +++ b/dungeon/dist/assets/phaser-D-IeUSbb.js @@ -0,0 +1 @@ +var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i,s={exports:{}};function n(){return i?s.exports:(i=1,t=()=>(()=>{var t={50792:t=>{var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,o){if("function"!=typeof s)throw new TypeError("The listener must be a function");var a=new n(s,r||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function a(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,o=new Array(r);n{var s=i(38829);t.exports=function(t,e,i,n){for(var r=t[0],o=1;o{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"angle",e,i,n,r)}},60757:t=>{t.exports=function(t,e,i){for(var s=0;s{t.exports=function(t,e,i){void 0===i&&(i=0);for(var s=i;s{t.exports=function(t,e,i){void 0===i&&(i=0);for(var s=t.length-1;s>=i;s--){var n=t[s],r=!0;for(var o in e)n[o]!==e[o]&&(r=!1);if(r)return n}return null}},94420:(t,e,i)=>{var s=i(11879),n=i(60461),r=i(95540),o=i(29747),a=new(i(41481))({sys:{queueDepthSort:o,events:{once:o}}},0,0,1,1).setOrigin(0,0);t.exports=function(t,e){void 0===e&&(e={});var i=e.hasOwnProperty("width"),o=e.hasOwnProperty("height"),h=r(e,"width",-1),l=r(e,"height",-1),u=r(e,"cellWidth",1),c=r(e,"cellHeight",u),d=r(e,"position",n.TOP_LEFT),f=r(e,"x",0),p=r(e,"y",0),v=0,g=0,m=h*u,y=l*c;a.setPosition(f,p),a.setSize(u,c);for(var x=0;x{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"alpha",e,i,n,r)}},67285:(t,e,i)=>{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"x",e,i,n,r)}},9074:(t,e,i)=>{var s=i(66979);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"x",e,n,o,a),s(t,"y",i,r,o,a)}},75222:(t,e,i)=>{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"y",e,i,n,r)}},22983:t=>{t.exports=function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=6.28);for(var n=i,r=(s-i)/t.length,o=e.x,a=e.y,h=e.radius,l=0;l{t.exports=function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=6.28);for(var n=i,r=(s-i)/t.length,o=e.width/2,a=e.height/2,h=0;h{var s=i(15258),n=i(26708);t.exports=function(t,e,i){var r;r=i?n(e,i,t.length):s(e,t.length);for(var o=0;o{var s=i(14649),n=i(86003),r=i(49498);t.exports=function(t,e,i){void 0===i&&(i=0);var o=s(e,!1,t.length);i>0?n(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a{var s=i(84993);t.exports=function(t,e,i){var n=s({x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},i),r=s({x1:e.x2,y1:e.y2,x2:e.x3,y2:e.y3},i),o=s({x1:e.x3,y1:e.y3,x2:e.x1,y2:e.y1},i);n.pop(),r.pop(),o.pop();for(var a=(n=n.concat(r,o)).length/t.length,h=0,l=0;l{t.exports=function(t,e,i){for(var s=0;s{t.exports=function(t,e,i,s,n,r){var o;void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=1);var a=0,h=t.length;if(1===r)for(o=n;o=0;o--)t[o][e]+=i+a*s,a++;return t}},43967:t=>{t.exports=function(t,e,i,s,n,r){var o;void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=1);var a=0,h=t.length;if(1===r)for(o=n;o=0;o--)t[o][e]=i+a*s,a++;return t}},88926:(t,e,i)=>{var s=i(28176);t.exports=function(t,e){for(var i=0;i{var s=i(24820);t.exports=function(t,e){for(var i=0;i{var s=i(65822);t.exports=function(t,e){for(var i=0;i{var s=i(26597);t.exports=function(t,e){for(var i=0;i{var s=i(90260);t.exports=function(t,e){for(var i=0;i{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"rotation",e,i,n,r)}},91051:(t,e,i)=>{var s=i(1163),n=i(20339);t.exports=function(t,e,i){for(var r=e.x,o=e.y,a=0;a{var s=i(1163);t.exports=function(t,e,i,n){var r=e.x,o=e.y;if(0===n)return t;for(var a=0;a{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"scaleX",e,i,n,r)}},94868:(t,e,i)=>{var s=i(66979);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"scaleX",e,n,o,a),s(t,"scaleY",i,r,o,a)}},95532:(t,e,i)=>{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"scaleY",e,i,n,r)}},8689:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"alpha",e,i,n,r)}},2645:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n){return s(t,"blendMode",e,0,i,n)}},32372:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"depth",e,i,n,r)}},85373:t=>{t.exports=function(t,e,i){for(var s=0;s{var s=i(43967);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"originX",e,n,o,a),s(t,"originY",i,r,o,a),t.forEach((function(t){t.updateDisplayOrigin()})),t}},79939:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"rotation",e,i,n,r)}},2699:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"scaleX",e,n,o,a),s(t,"scaleY",i,r,o,a)}},98739:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"scaleX",e,i,n,r)}},98476:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"scaleY",e,i,n,r)}},6207:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"scrollFactorX",e,n,o,a),s(t,"scrollFactorY",i,r,o,a)}},6607:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"scrollFactorX",e,i,n,r)}},72248:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"scrollFactorY",e,i,n,r)}},14036:t=>{t.exports=function(t,e,i,s,n){for(var r=0;r{var s=i(43967);t.exports=function(t,e,i,n){return s(t,"visible",e,0,i,n)}},77597:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"x",e,i,n,r)}},83194:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"x",e,n,o,a),s(t,"y",i,r,o,a)}},67678:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"y",e,i,n,r)}},35850:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r){var o,a;void 0===n&&(n=0),void 0===r&&(r=new s);var h=t.length;if(1===h)o=t[0].x,a=t[0].y,t[0].x=e,t[0].y=i;else{var l=1,u=0;0===n&&(u=h-1,l=h-2),o=t[u].x,a=t[u].y,t[u].x=e,t[u].y=i;for(var c=0;c=h||-1===l)){var d=t[l],f=d.x,p=d.y;d.x=o,d.y=a,o=f,a=p,0===n?l--:l++}}return r.x=o,r.y=a,r}},8628:(t,e,i)=>{var s=i(33680);t.exports=function(t){return s(t)}},21837:(t,e,i)=>{var s=i(7602);t.exports=function(t,e,i,n,r){void 0===r&&(r=!1);var o,a=Math.abs(n-i)/t.length;if(r)for(o=0;o{var s=i(54261);t.exports=function(t,e,i,n,r){void 0===r&&(r=!1);var o,a=Math.abs(n-i)/t.length;if(r)for(o=0;o{t.exports=function(t,e,i,s,n){if(void 0===n&&(n=!1),0===t.length)return t;if(1===t.length)return n?t[0][e]+=(s+i)/2:t[0][e]=(s+i)/2,t;var r,o=Math.abs(s-i)/(t.length-1);if(n)for(r=0;r{t.exports=function(t){for(var e=0;e{var s=i(15994);t.exports=function(t,e,i){void 0===i&&(i=0);for(var n=0;n{t.exports={AlignTo:i(11517),Angle:i(80318),Call:i(60757),GetFirst:i(69927),GetLast:i(32265),GridAlign:i(94420),IncAlpha:i(41721),IncX:i(67285),IncXY:i(9074),IncY:i(75222),PlaceOnCircle:i(22983),PlaceOnEllipse:i(95253),PlaceOnLine:i(88505),PlaceOnRectangle:i(41346),PlaceOnTriangle:i(11575),PlayAnimation:i(29953),PropertyValueInc:i(66979),PropertyValueSet:i(43967),RandomCircle:i(88926),RandomEllipse:i(33286),RandomLine:i(96e3),RandomRectangle:i(28789),RandomTriangle:i(97154),Rotate:i(20510),RotateAround:i(91051),RotateAroundDistance:i(76332),ScaleX:i(61619),ScaleXY:i(94868),ScaleY:i(95532),SetAlpha:i(8689),SetBlendMode:i(2645),SetDepth:i(32372),SetHitArea:i(85373),SetOrigin:i(81583),SetRotation:i(79939),SetScale:i(2699),SetScaleX:i(98739),SetScaleY:i(98476),SetScrollFactor:i(6207),SetScrollFactorX:i(6607),SetScrollFactorY:i(72248),SetTint:i(14036),SetVisible:i(50159),SetX:i(77597),SetXY:i(83194),SetY:i(67678),ShiftPosition:i(35850),Shuffle:i(8628),SmootherStep:i(21910),SmoothStep:i(21837),Spread:i(62054),ToggleVisible:i(79815),WrapInRectangle:i(39665)}},42099:(t,e,i)=>{var s=i(45319),n=i(83419),r=i(74943),o=i(81957),a=i(41138),h=i(35154),l=i(90126),u=new n({initialize:function(t,e,i){this.manager=t,this.key=e,this.type="frame",this.frames=this.getFrames(t.textureManager,h(i,"frames",[]),h(i,"defaultTextureKey",null),h(i,"sortFrames",!0)),this.frameRate=h(i,"frameRate",null),this.duration=h(i,"duration",null),this.msPerFrame,this.skipMissedFrames=h(i,"skipMissedFrames",!0),this.delay=h(i,"delay",0),this.repeat=h(i,"repeat",0),this.repeatDelay=h(i,"repeatDelay",0),this.yoyo=h(i,"yoyo",!1),this.showBeforeDelay=h(i,"showBeforeDelay",!1),this.showOnStart=h(i,"showOnStart",!1),this.hideOnComplete=h(i,"hideOnComplete",!1),this.randomFrame=h(i,"randomFrame",!1),this.paused=!1,this.calculateDuration(this,this.getTotalFrames(),this.duration,this.frameRate),this.manager.on&&(this.manager.on(r.PAUSE_ALL,this.pause,this),this.manager.on(r.RESUME_ALL,this.resume,this))},getTotalFrames:function(){return this.frames.length},calculateDuration:function(t,e,i,s){null===i&&null===s?(t.frameRate=24,t.duration=24/e*1e3):i&&null===s?(t.duration=i,t.frameRate=e/(i/1e3)):(t.frameRate=s,t.duration=e/s*1e3),t.msPerFrame=1e3/t.frameRate},addFrame:function(t){return this.addFrameAt(this.frames.length,t)},addFrameAt:function(t,e){var i=this.getFrames(this.manager.textureManager,e);if(i.length>0){if(0===t)this.frames=i.concat(this.frames);else if(t===this.frames.length)this.frames=this.frames.concat(i);else{var s=this.frames.slice(0,t),n=this.frames.slice(t);this.frames=s.concat(i,n)}this.updateFrameSequence()}return this},checkFrame:function(t){return t>=0&&t0){r.isLast=!0,r.nextFrame=c[0],c[0].prevFrame=r;var y=1/(c.length-1);for(o=0;o0?t.inReverse&&t.forward?t.forward=!1:this.repeatAnimation(t):t.complete():this.updateAndGetNextTick(t,e.nextFrame)},handleYoyoFrame:function(t,e){if(e||(e=!1),t.inReverse===!e&&t.repeatCounter>0)return(0===t.repeatDelay||t.pendingRepeat)&&(t.forward=e),void this.repeatAnimation(t);if(t.inReverse===e||0!==t.repeatCounter){t.forward=e;var i=e?t.currentFrame.nextFrame:t.currentFrame.prevFrame;this.updateAndGetNextTick(t,i)}else t.complete()},getLastFrame:function(){return this.frames[this.frames.length-1]},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t.yoyo?this.handleYoyoFrame(t,!0):t.repeatCounter>0?(t.inReverse&&!t.forward||(t.forward=!0),this.repeatAnimation(t)):t.complete():this.updateAndGetNextTick(t,e.prevFrame)},updateAndGetNextTick:function(t,e){t.setCurrentFrame(e),this.getNextTick(t)},removeFrame:function(t){var e=this.frames.indexOf(t);return-1!==e&&this.removeFrameAt(e),this},removeFrameAt:function(t){return this.frames.splice(t,1),this.updateFrameSequence(),this},repeatAnimation:function(t){if(2===t._pendingStop){if(0===t._pendingStopValue)return t.stop();t._pendingStopValue--}t.repeatDelay>0&&!t.pendingRepeat?(t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=t.repeatDelay):(t.repeatCounter--,t.forward?t.setCurrentFrame(t.currentFrame.nextFrame):t.setCurrentFrame(t.currentFrame.prevFrame),t.isPlaying&&(this.getNextTick(t),t.handleRepeat()))},toJSON:function(){var t={key:this.key,type:this.type,frames:[],frameRate:this.frameRate,duration:this.duration,skipMissedFrames:this.skipMissedFrames,delay:this.delay,repeat:this.repeat,repeatDelay:this.repeatDelay,yoyo:this.yoyo,showBeforeDelay:this.showBeforeDelay,showOnStart:this.showOnStart,randomFrame:this.randomFrame,hideOnComplete:this.hideOnComplete};return this.frames.forEach((function(e){t.frames.push(e.toJSON())})),t},updateFrameSequence:function(){for(var t,e=this.frames.length,i=1/(e-1),s=0;s1?(t.isLast=!0,t.prevFrame=this.frames[e-2],t.nextFrame=this.frames[0]):e>1&&(t.prevFrame=this.frames[s-1],t.nextFrame=this.frames[s+1]);return this},pause:function(){return this.paused=!0,this},resume:function(){return this.paused=!1,this},destroy:function(){this.manager.off&&(this.manager.off(r.PAUSE_ALL,this.pause,this),this.manager.off(r.RESUME_ALL,this.resume,this)),this.manager.remove(this.key);for(var t=0;t{var s=new(i(83419))({initialize:function(t,e,i,s,n){void 0===n&&(n=!1),this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=s,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0,this.isKeyFrame=n},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration,keyframe:this.isKeyFrame}},destroy:function(){this.frame=void 0}});t.exports=s},60848:(t,e,i)=>{var s=i(42099),n=i(83419),r=i(90330),o=i(50792),a=i(74943),h=i(8443),l=i(95540),u=i(35154),c=i(36383),d=i(20283),f=i(41836),p=new n({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new r,this.mixes=new r,this.paused=!1,this.name="AnimationManager",t.events.once(h.BOOT,this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once(h.DESTROY,this.destroy,this)},addMix:function(t,e,i){var s=this.anims,n=this.mixes,r="string"==typeof t?t:t.key,o="string"==typeof e?e:e.key;if(s.has(r)&&s.has(o)){var a=n.get(r);a||(a={}),a[o]=i,n.set(r,a)}return this},removeMix:function(t,e){var i=this.mixes,s="string"==typeof t?t:t.key,n=i.get(s);if(n)if(e){var r="string"==typeof e?e:e.key;n.hasOwnProperty(r)&&delete n[r]}else e||i.delete(s);return this},getMix:function(t,e){var i=this.mixes,s="string"==typeof t?t:t.key,n="string"==typeof e?e:e.key,r=i.get(s);return r&&r.hasOwnProperty(n)?r[n]:0},add:function(t,e){return this.anims.has(t)?(console.warn("Animation key exists: "+t),this):(e.key=t,this.anims.set(t,e),this.emit(a.ADD_ANIMATION,t,e),this)},exists:function(t){return this.anims.has(t)},createFromAseprite:function(t,e,i){var s=[],n=this.game.cache.json.get(t);if(!n)return console.warn("No Aseprite data found for: "+t),s;var r=this,o=u(n,"meta",null),a=u(n,"frames",null);return o&&a&&u(o,"frameTags",[]).forEach((function(n){var o=[],h=l(n,"name",null),u=l(n,"from",0),d=l(n,"to",0),f=l(n,"direction","forward");if(h&&(!e||e&&e.indexOf(h)>-1)){for(var p=0,v=u;v<=d;v++){var g=v.toString(),m=a[g];if(m){var y=l(m,"duration",c.MAX_SAFE_INTEGER);o.push({key:t,frame:g,duration:y}),p+=y}}"reverse"===f&&(o=o.reverse());var x,T={key:h,frames:o,duration:p,yoyo:"pingpong"===f};i?i.anims&&(x=i.anims.create(T)):x=r.create(T),x&&s.push(x)}})),s},create:function(t){var e=t.key,i=!1;return e&&((i=this.get(e))?console.warn("AnimationManager key already exists: "+e):(i=new s(this,e,t),this.anims.set(e,i),this.emit(a.ADD_ANIMATION,e,i))),i},fromJSON:function(t,e){void 0===e&&(e=!1),e&&this.anims.clear(),"string"==typeof t&&(t=JSON.parse(t));var i=[];if(t.hasOwnProperty("anims")&&Array.isArray(t.anims)){for(var s=0;s{var s=i(42099),n=i(30976),r=i(83419),o=i(90330),a=i(74943),h=i(95540),l=new r({initialize:function(t){this.parent=t,this.animationManager=t.scene.sys.anims,this.animationManager.on(a.REMOVE_ANIMATION,this.globalRemove,this),this.textureManager=this.animationManager.textureManager,this.anims=null,this.isPlaying=!1,this.hasStarted=!1,this.currentAnim=null,this.currentFrame=null,this.nextAnim=null,this.nextAnimsQueue=[],this.timeScale=1,this.frameRate=0,this.duration=0,this.msPerFrame=0,this.skipMissedFrames=!0,this.randomFrame=!1,this.delay=0,this.repeat=0,this.repeatDelay=0,this.yoyo=!1,this.showBeforeDelay=!1,this.showOnStart=!1,this.hideOnComplete=!1,this.forward=!0,this.inReverse=!1,this.accumulator=0,this.nextTick=0,this.delayCounter=0,this.repeatCounter=0,this.pendingRepeat=!1,this._paused=!1,this._wasPlaying=!1,this._pendingStop=0,this._pendingStopValue},chain:function(t){var e=this.parent;if(void 0===t)return this.nextAnimsQueue.length=0,this.nextAnim=null,e;Array.isArray(t)||(t=[t]);for(var i=0;ir&&(l=0),this.randomFrame&&(l=n(0,r-1));var u=s.frames[l];0!==l||this.forward||(u=s.getLastFrame()),this.currentFrame=u}else console.warn("Missing animation: "+i);return this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.setCurrentFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.setCurrentFrame(t),this.parent},playAfterDelay:function(t,e){if(this.isPlaying){var i=this.nextAnim,s=this.nextAnimsQueue;i&&s.unshift(i),this.nextAnim=t,this._pendingStop=1,this._pendingStopValue=e}else this.delayCounter=e,this.play(t,!0);return this.parent},playAfterRepeat:function(t,e){if(void 0===e&&(e=1),this.isPlaying){var i=this.nextAnim,s=this.nextAnimsQueue;i&&s.unshift(i),-1!==this.repeatCounter&&e>this.repeatCounter&&(e=this.repeatCounter),this.nextAnim=t,this._pendingStop=2,this._pendingStopValue=e}else this.play(t);return this.parent},play:function(t,e){void 0===e&&(e=!1);var i=this.currentAnim,s=this.parent,n="string"==typeof t?t:t.key;if(e&&this.isPlaying&&i.key===n)return s;if(i&&this.isPlaying){var r=this.animationManager.getMix(i.key,t);if(r>0)return this.playAfterDelay(t,r)}return this.forward=!0,this.inReverse=!1,this._paused=!1,this._wasPlaying=!0,this.startAnimation(t)},playReverse:function(t,e){void 0===e&&(e=!1);var i="string"==typeof t?t:t.key;return e&&this.isPlaying&&this.currentAnim.key===i?this.parent:(this.forward=!1,this.inReverse=!0,this._paused=!1,this._wasPlaying=!0,this.startAnimation(t))},startAnimation:function(t){this.load(t);var e=this.currentAnim,i=this.parent;return e?(this.repeatCounter=-1===this.repeat?Number.MAX_VALUE:this.repeat,e.getFirstTick(this),this.isPlaying=!0,this.pendingRepeat=!1,this.hasStarted=!1,this._pendingStop=0,this._pendingStopValue=0,this._paused=!1,this.delayCounter+=this.delay,0===this.delayCounter?this.handleStart():this.showBeforeDelay&&this.setCurrentFrame(this.currentFrame),i):i},handleStart:function(){this.showOnStart&&this.parent.setVisible(!0),this.setCurrentFrame(this.currentFrame),this.hasStarted=!0,this.emitEvents(a.ANIMATION_START)},handleRepeat:function(){this.pendingRepeat=!1,this.emitEvents(a.ANIMATION_REPEAT)},handleStop:function(){this._pendingStop=0,this.isPlaying=!1,this.emitEvents(a.ANIMATION_STOP)},handleComplete:function(){this._pendingStop=0,this.isPlaying=!1,this.hideOnComplete&&this.parent.setVisible(!1),this.emitEvents(a.ANIMATION_COMPLETE,a.ANIMATION_COMPLETE_KEY)},emitEvents:function(t,e){var i=this.currentAnim;if(i){var s=this.currentFrame,n=this.parent,r=s.textureFrame;n.emit(t,i,s,n,r),e&&n.emit(e+i.key,i,s,n,r)}},reverse:function(){return this.isPlaying&&(this.inReverse=!this.inReverse,this.forward=!this.forward),this.parent},getProgress:function(){var t=this.currentFrame;if(!t)return 0;var e=t.progress;return this.inReverse&&(e*=-1),e},setProgress:function(t){return this.forward||(t=1-t),this.setCurrentFrame(this.currentAnim.getFrameByProgress(t)),this.parent},setRepeat:function(t){return this.repeatCounter=-1===t?Number.MAX_VALUE:t,this.parent},globalRemove:function(t,e){void 0===e&&(e=this.currentAnim),this.isPlaying&&e.key===this.currentAnim.key&&(this.stop(),this.setCurrentFrame(this.currentAnim.frames[0]))},restart:function(t,e){void 0===t&&(t=!1),void 0===e&&(e=!1);var i=this.currentAnim,s=this.parent;return i?(e&&(this.repeatCounter=-1===this.repeat?Number.MAX_VALUE:this.repeat),i.getFirstTick(this),this.emitEvents(a.ANIMATION_RESTART),this.isPlaying=!0,this.pendingRepeat=!1,this.hasStarted=!t,this._pendingStop=0,this._pendingStopValue=0,this._paused=!1,this.setCurrentFrame(i.frames[0]),this.parent):s},complete:function(){if(this._pendingStop=0,this.isPlaying=!1,this.currentAnim&&this.handleComplete(),this.nextAnim){var t=this.nextAnim;this.nextAnim=this.nextAnimsQueue.length>0?this.nextAnimsQueue.shift():null,this.play(t)}return this.parent},stop:function(){if(this._pendingStop=0,this.isPlaying=!1,this.delayCounter=0,this.currentAnim&&this.handleStop(),this.nextAnim){var t=this.nextAnim;this.nextAnim=this.nextAnimsQueue.shift(),this.play(t)}return this.parent},stopAfterDelay:function(t){return this._pendingStop=1,this._pendingStopValue=t,this.parent},stopAfterRepeat:function(t){return void 0===t&&(t=1),-1!==this.repeatCounter&&t>this.repeatCounter&&(t=this.repeatCounter),this._pendingStop=2,this._pendingStopValue=t,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},getTotalFrames:function(){return this.currentAnim?this.currentAnim.getTotalFrames():0},update:function(t,e){var i=this.currentAnim;if(this.isPlaying&&i&&!i.paused){if(this.accumulator+=e*this.timeScale*this.animationManager.globalTimeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.stop();if(this.hasStarted){if(this.accumulator>=this.nextTick&&(this.forward?i.nextFrame(this):i.previousFrame(this),this.isPlaying&&0===this._pendingStop&&this.skipMissedFrames&&this.accumulator>this.nextTick)){var s=0;do{this.forward?i.nextFrame(this):i.previousFrame(this),s++}while(this.isPlaying&&this.accumulator>this.nextTick&&s<60)}}else this.accumulator>=this.delayCounter&&(this.accumulator-=this.delayCounter,this.handleStart())}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),t.setAlpha&&(e.alpha=t.alpha),e.setSizeToFrame(),e._originComponent&&(t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin()),this.isPlaying&&this.hasStarted&&(this.emitEvents(a.ANIMATION_UPDATE),3===this._pendingStop&&this._pendingStopValue===t&&this.stop()),e},nextFrame:function(){return this.currentAnim&&this.currentAnim.nextFrame(this),this.parent},previousFrame:function(){return this.currentAnim&&this.currentAnim.previousFrame(this),this.parent},get:function(t){return this.anims?this.anims.get(t):null},exists:function(t){return!!this.anims&&this.anims.has(t)},create:function(t){var e=t.key,i=!1;return e&&((i=this.get(e))?console.warn("Animation key already exists: "+e):(i=new s(this,e,t),this.anims||(this.anims=new o),this.anims.set(e,i))),i},createFromAseprite:function(t,e){return this.animationManager.createFromAseprite(t,e,this.parent)},generateFrameNames:function(t,e){return this.animationManager.generateFrameNames(t,e)},generateFrameNumbers:function(t,e){return this.animationManager.generateFrameNumbers(t,e)},remove:function(t){var e=this.get(t);return e&&(this.currentAnim===e&&this.stop(),this.anims.delete(t)),e},destroy:function(){this.animationManager.off(a.REMOVE_ANIMATION,this.globalRemove,this),this.anims&&this.anims.clear(),this.animationManager=null,this.parent=null,this.nextAnim=null,this.nextAnimsQueue.length=0,this.currentAnim=null,this.currentFrame=null},isPaused:{get:function(){return this._paused}}});t.exports=l},57090:t=>{t.exports="add"},25312:t=>{t.exports="animationcomplete"},89580:t=>{t.exports="animationcomplete-"},52860:t=>{t.exports="animationrepeat"},63850:t=>{t.exports="animationrestart"},99085:t=>{t.exports="animationstart"},28087:t=>{t.exports="animationstop"},1794:t=>{t.exports="animationupdate"},52562:t=>{t.exports="pauseall"},57953:t=>{t.exports="remove"},68339:t=>{t.exports="resumeall"},74943:(t,e,i)=>{t.exports={ADD_ANIMATION:i(57090),ANIMATION_COMPLETE:i(25312),ANIMATION_COMPLETE_KEY:i(89580),ANIMATION_REPEAT:i(52860),ANIMATION_RESTART:i(63850),ANIMATION_START:i(99085),ANIMATION_STOP:i(28087),ANIMATION_UPDATE:i(1794),PAUSE_ALL:i(52562),REMOVE_ANIMATION:i(57953),RESUME_ALL:i(68339)}},60421:(t,e,i)=>{t.exports={Animation:i(42099),AnimationFrame:i(41138),AnimationManager:i(60848),AnimationState:i(9674),Events:i(74943)}},2161:(t,e,i)=>{var s=i(83419),n=i(90330),r=i(50792),o=i(24736),a=new s({initialize:function(){this.entries=new n,this.events=new r},add:function(t,e){return this.entries.set(t,e),this.events.emit(o.ADD,this,t,e),this},has:function(t){return this.entries.has(t)},exists:function(t){return this.entries.has(t)},get:function(t){return this.entries.get(t)},remove:function(t){var e=this.get(t);return e&&(this.entries.delete(t),this.events.emit(o.REMOVE,this,t,e.data)),this},getKeys:function(){return this.entries.keys()},destroy:function(){this.entries.clear(),this.events.removeAllListeners(),this.entries=null,this.events=null}});t.exports=a},24047:(t,e,i)=>{var s=i(2161),n=i(83419),r=i(8443),o=new n({initialize:function(t){this.game=t,this.binary=new s,this.bitmapFont=new s,this.json=new s,this.physics=new s,this.shader=new s,this.audio=new s,this.video=new s,this.text=new s,this.html=new s,this.obj=new s,this.tilemap=new s,this.xml=new s,this.custom={},this.game.events.once(r.DESTROY,this.destroy,this)},addCustom:function(t){return this.custom.hasOwnProperty(t)||(this.custom[t]=new s),this.custom[t]},destroy:function(){for(var t=["binary","bitmapFont","json","physics","shader","audio","video","text","html","obj","tilemap","xml"],e=0;e{t.exports="add"},59261:t=>{t.exports="remove"},24736:(t,e,i)=>{t.exports={ADD:i(51464),REMOVE:i(59261)}},83388:(t,e,i)=>{t.exports={BaseCache:i(2161),CacheManager:i(24047),Events:i(24736)}},71911:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(39506),o=i(50792),a=i(19715),h=i(87841),l=i(61340),u=i(80333),c=i(26099),d=new s({Extends:o,Mixins:[n.AlphaSingle,n.Visible],initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),o.call(this),this.scene,this.sceneManager,this.scaleManager,this.cameraManager,this.id=0,this.name="",this.roundPixels=!1,this.useBounds=!1,this.worldView=new h,this.dirty=!0,this._x=t,this._y=e,this._width=i,this._height=s,this._bounds=new h,this._scrollX=0,this._scrollY=0,this._zoomX=1,this._zoomY=1,this._rotation=0,this.matrix=new l,this.transparent=!0,this.backgroundColor=u("rgba(0,0,0,0)"),this.disableCull=!1,this.culledObjects=[],this.midPoint=new c(i/2,s/2),this.originX=.5,this.originY=.5,this._customViewport=!1,this.mask=null,this._maskCamera=null,this.renderList=[],this.isSceneCamera=!0},addToRenderList:function(t){this.renderList.push(t)},setOrigin:function(t,e){return void 0===t&&(t=.5),void 0===e&&(e=t),this.originX=t,this.originY=e,this},getScroll:function(t,e,i){void 0===i&&(i=new c);var s=.5*this.width,n=.5*this.height;return i.x=t-s,i.y=e-n,this.useBounds&&(i.x=this.clampX(i.x),i.y=this.clampY(i.y)),i},centerOnX:function(t){var e=.5*this.width;return this.midPoint.x=t,this.scrollX=t-e,this.useBounds&&(this.scrollX=this.clampX(this.scrollX)),this},centerOnY:function(t){var e=.5*this.height;return this.midPoint.y=t,this.scrollY=t-e,this.useBounds&&(this.scrollY=this.clampY(this.scrollY)),this},centerOn:function(t,e){return this.centerOnX(t),this.centerOnY(e),this},centerToBounds:function(){if(this.useBounds){var t=this._bounds,e=.5*this.width,i=.5*this.height;this.midPoint.set(t.centerX,t.centerY),this.scrollX=t.centerX-e,this.scrollY=t.centerY-i}return this},centerToSize:function(){return this.scrollX=.5*this.width,this.scrollY=.5*this.height,this},cull:function(t){if(this.disableCull)return t;var e=this.matrix.matrix,i=e[0],s=e[1],n=e[2],r=e[3],o=i*r-s*n;if(!o)return t;var a=e[4],h=e[5],l=this.scrollX,u=this.scrollY,c=this.width,d=this.height,f=this.y,p=f+d,v=this.x,g=v+c,m=this.culledObjects,y=t.length;o=1/o,m.length=0;for(var x=0;xv&&S*i+E*n+af&&S*s+E*r+hn&&(t=n),t},clampY:function(t){var e=this._bounds,i=this.displayHeight,s=e.y+(i-this.height)/2,n=Math.max(s,s+e.height-i);return tn&&(t=n),t},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=r(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=u(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,s,n){return void 0===n&&(n=!1),this._bounds.setTo(t,e,i,s),this.dirty=!0,this.useBounds=!0,n?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},getBounds:function(t){void 0===t&&(t=new h);var e=this._bounds;return t.setTo(e.x,e.y,e.width,e.height),t},setName:function(t){return void 0===t&&(t=""),this.name=t,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setRoundPixels:function(t){return this.roundPixels=t,this},setScene:function(t,e){void 0===e&&(e=!0),this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=t,this.isSceneCamera=e;var i=t.sys;return this.sceneManager=i.game.scene,this.scaleManager=i.scale,this.cameraManager=i.cameras,this.updateSystem(),this},setScroll:function(t,e){return void 0===e&&(e=t),this.scrollX=t,this.scrollY=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},setViewport:function(t,e,i,s){return this.x=t,this.y=e,this.width=i,this.height=s,this},setZoom:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),0===t&&(t=.001),0===e&&(e=.001),this.zoomX=t,this.zoomY=e,this},setMask:function(t,e){return void 0===e&&(e=!0),this.mask=t,this._maskCamera=e?this.cameraManager.default:this,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},toJSON:function(){var t={name:this.name,x:this.x,y:this.y,width:this.width,height:this.height,zoom:this.zoom,rotation:this.rotation,roundPixels:this.roundPixels,scrollX:this.scrollX,scrollY:this.scrollY,backgroundColor:this.backgroundColor.rgba};return this.useBounds&&(t.bounds={x:this._bounds.x,y:this._bounds.y,width:this._bounds.width,height:this._bounds.height}),t},update:function(){},setIsSceneCamera:function(t){return this.isSceneCamera=t,this},updateSystem:function(){if(this.scaleManager&&this.isSceneCamera){var t=0!==this._x||0!==this._y||this.scaleManager.width!==this._width||this.scaleManager.height!==this._height,e=this.sceneManager;t&&!this._customViewport?e.customViewports++:!t&&this._customViewport&&e.customViewports--,this.dirty=!0,this._customViewport=t}},destroy:function(){this.emit(a.DESTROY,this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this.renderList=[],this._bounds=null,this.scene=null,this.scaleManager=null,this.sceneManager=null,this.cameraManager=null},x:{get:function(){return this._x},set:function(t){this._x=t,this.updateSystem()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.updateSystem()}},width:{get:function(){return this._width},set:function(t){this._width=t,this.updateSystem()}},height:{get:function(){return this._height},set:function(t){this._height=t,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(t){t!==this._scrollX&&(this._scrollX=t,this.dirty=!0)}},scrollY:{get:function(){return this._scrollY},set:function(t){t!==this._scrollY&&(this._scrollY=t,this.dirty=!0)}},zoom:{get:function(){return(this._zoomX+this._zoomY)/2},set:function(t){this._zoomX=t,this._zoomY=t,this.dirty=!0}},zoomX:{get:function(){return this._zoomX},set:function(t){this._zoomX=t,this.dirty=!0}},zoomY:{get:function(){return this._zoomY},set:function(t){this._zoomY=t,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=t,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoomX}},displayHeight:{get:function(){return this.height/this.zoomY}}});t.exports=d},38058:(t,e,i)=>{var s=i(71911),n=i(67502),r=i(45319),o=i(83419),a=i(31401),h=i(20052),l=i(19715),u=i(28915),c=i(87841),d=i(26099),f=new o({Extends:s,Mixins:[a.PostPipeline],initialize:function(t,e,i,n){s.call(this,t,e,i,n),this.initPostPipeline(),this.inputEnabled=!0,this.fadeEffect=new h.Fade(this),this.flashEffect=new h.Flash(this),this.shakeEffect=new h.Shake(this),this.panEffect=new h.Pan(this),this.rotateToEffect=new h.RotateTo(this),this.zoomEffect=new h.Zoom(this),this.lerp=new d(1,1),this.followOffset=new d,this.deadzone=null,this._follow=null},setDeadzone:function(t,e){if(void 0===t)this.deadzone=null;else{if(this.deadzone?(this.deadzone.width=t,this.deadzone.height=e):this.deadzone=new c(0,0,t,e),this._follow){var i=this.width/2,s=this.height/2,r=this._follow.x-this.followOffset.x,o=this._follow.y-this.followOffset.y;this.midPoint.set(r,o),this.scrollX=r-i,this.scrollY=o-s}n(this.deadzone,this.midPoint.x,this.midPoint.y)}return this},fadeIn:function(t,e,i,s,n,r){return this.fadeEffect.start(!1,t,e,i,s,!0,n,r)},fadeOut:function(t,e,i,s,n,r){return this.fadeEffect.start(!0,t,e,i,s,!0,n,r)},fadeFrom:function(t,e,i,s,n,r,o){return this.fadeEffect.start(!1,t,e,i,s,n,r,o)},fade:function(t,e,i,s,n,r,o){return this.fadeEffect.start(!0,t,e,i,s,n,r,o)},flash:function(t,e,i,s,n,r,o){return this.flashEffect.start(t,e,i,s,n,r,o)},shake:function(t,e,i,s,n){return this.shakeEffect.start(t,e,i,s,n)},pan:function(t,e,i,s,n,r,o){return this.panEffect.start(t,e,i,s,n,r,o)},rotateTo:function(t,e,i,s,n,r,o){return this.rotateToEffect.start(t,e,i,s,n,r,o)},zoomTo:function(t,e,i,s,n,r){return this.zoomEffect.start(t,e,i,s,n,r)},preRender:function(){this.renderList.length=0;var t=this.width,e=this.height,i=.5*t,s=.5*e,r=this.zoom,o=this.matrix,a=t*this.originX,h=e*this.originY,c=this._follow,d=this.deadzone,f=this.scrollX,p=this.scrollY;d&&n(d,this.midPoint.x,this.midPoint.y);var v=!1;if(c&&!this.panEffect.isRunning){var g=this.lerp,m=c.x-this.followOffset.x,y=c.y-this.followOffset.y;d?(md.right&&(f=u(f,f+(m-d.right),g.x)),yd.bottom&&(p=u(p,p+(y-d.bottom),g.y))):(f=u(f,m-a,g.x),p=u(p,y-h,g.y)),v=!0}this.useBounds&&(f=this.clampX(f),p=this.clampY(p)),this.scrollX=f,this.scrollY=p;var x=f+i,T=p+s;this.midPoint.set(x,T);var w=t/r,b=e/r,S=Math.floor(x-w/2),E=Math.floor(T-b/2);this.worldView.setTo(S,E,w,b),o.applyITRS(Math.floor(this.x+a),Math.floor(this.y+h),this.rotation,r,r),o.translate(-a,-h),this.shakeEffect.preRender(),v&&this.emit(l.FOLLOW_UPDATE,this,c)},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,s,n,o){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===s&&(s=i),void 0===n&&(n=0),void 0===o&&(o=n),this._follow=t,this.roundPixels=e,i=r(i,0,1),s=r(s,0,1),this.lerp.set(i,s),this.followOffset.set(n,o);var a=this.width/2,h=this.height/2,l=t.x-n,u=t.y-o;return this.midPoint.set(l,u),this.scrollX=l-a,this.scrollY=u-h,this.useBounds&&(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.rotateToEffect.reset(),this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.rotateToEffect.update(t,e),this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.resetFX(),s.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=f},32743:(t,e,i)=>{var s=i(38058),n=i(83419),r=i(95540),o=i(37277),a=i(37303),h=i(97480),l=i(44594),u=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this.roundPixels=t.sys.game.config.roundPixels,this.cameras=[],this.main,this.default,t.sys.events.once(l.BOOT,this.boot,this),t.sys.events.on(l.START,this.start,this)},boot:function(){var t=this.systems;t.settings.cameras?this.fromJSON(t.settings.cameras):this.add(),this.main=this.cameras[0],this.default=new s(0,0,t.scale.width,t.scale.height).setScene(this.scene),t.game.scale.on(h.RESIZE,this.onResize,this),this.systems.events.once(l.DESTROY,this.destroy,this)},start:function(){if(!this.main){var t=this.systems;t.settings.cameras?this.fromJSON(t.settings.cameras):this.add(),this.main=this.cameras[0]}var e=this.systems.events;e.on(l.UPDATE,this.update,this),e.once(l.SHUTDOWN,this.shutdown,this)},add:function(t,e,i,n,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.scale.width),void 0===n&&(n=this.scene.sys.scale.height),void 0===r&&(r=!1),void 0===o&&(o="");var a=new s(t,e,i,n);return a.setName(o),a.setScene(this.scene),a.setRoundPixels(this.roundPixels),a.id=this.getNextID(),this.cameras.push(a),r&&(this.main=a),a},addExisting:function(t,e){return void 0===e&&(e=!1),-1===this.cameras.indexOf(t)?(t.id=this.getNextID(),t.setRoundPixels(this.roundPixels),this.cameras.push(t),e&&(this.main=t),t):null},getNextID:function(){for(var t=this.cameras,e=1,i=0;i<32;i++){for(var s=!1,n=0;n0){r.preRender();var o=this.getVisibleChildren(e.getChildren(),r);t.render(i,o,r)}}},getVisibleChildren:function(t,e){return t.filter((function(t){return t.willRender(e)}))},resetAll:function(){for(var t=0;t{var s=i(45319),n=i(83419),r=i(19715),o=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.isComplete=!1,this.direction=!0,this.duration=0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,s,n,o,a,h){if(void 0===t&&(t=!0),void 0===e&&(e=1e3),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=0),void 0===o&&(o=!1),void 0===a&&(a=null),void 0===h&&(h=this.camera.scene),!o&&this.isRunning)return this.camera;this.isRunning=!0,this.isComplete=!1,this.duration=e,this.direction=t,this.progress=0,this.red=i,this.green=s,this.blue=n,this.alpha=t?Number.MIN_VALUE:1,this._elapsed=0,this._onUpdate=a,this._onUpdateScope=h;var l=t?r.FADE_OUT_START:r.FADE_IN_START;return this.camera.emit(l,this.camera,this,e,i,s,n),this.camera},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=s(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsed{var s=i(45319),n=i(83419),r=i(19715),o=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.red=0,this.green=0,this.blue=0,this.alpha=1,this.progress=0,this._elapsed=0,this._alpha,this._onUpdate,this._onUpdateScope},start:function(t,e,i,s,n,o,a){return void 0===t&&(t=250),void 0===e&&(e=255),void 0===i&&(i=255),void 0===s&&(s=255),void 0===n&&(n=!1),void 0===o&&(o=null),void 0===a&&(a=this.camera.scene),!n&&this.isRunning||(this.isRunning=!0,this.duration=t,this.progress=0,this.red=e,this.green=i,this.blue=s,this._alpha=this.alpha,this._elapsed=0,this._onUpdate=o,this._onUpdateScope=a,this.camera.emit(r.FLASH_START,this.camera,this,t,e,i,s)),this.camera},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=s(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsed{var s=i(45319),n=i(83419),r=i(62640),o=i(19715),a=i(26099),h=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=new a,this.current=new a,this.destination=new a,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,s,n,a,h){void 0===i&&(i=1e3),void 0===s&&(s=r.Linear),void 0===n&&(n=!1),void 0===a&&(a=null),void 0===h&&(h=this.camera.scene);var l=this.camera;return!n&&this.isRunning||(this.isRunning=!0,this.duration=i,this.progress=0,this.source.set(l.scrollX,l.scrollY),this.destination.set(t,e),l.getScroll(t,e,this.current),"string"==typeof s&&r.hasOwnProperty(s)?this.ease=r[s]:"function"==typeof s&&(this.ease=s),this._elapsed=0,this._onUpdate=a,this._onUpdateScope=h,this.camera.emit(o.PAN_START,this.camera,this,i,t,e)),l},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=s(this._elapsed/this.duration,0,1);this.progress=i;var n=this.camera;if(this._elapsed{var s=i(45319),n=i(83419),r=i(19715),o=i(62640),a=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=0,this.current=0,this.destination=0,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope,this.clockwise=!0,this.shortestPath=!1},start:function(t,e,i,s,n,a,h){void 0===i&&(i=1e3),void 0===s&&(s=o.Linear),void 0===n&&(n=!1),void 0===a&&(a=null),void 0===h&&(h=this.camera.scene),void 0===e&&(e=!1),this.shortestPath=e;var l=t;t<0?(l=-1*t,this.clockwise=!1):this.clockwise=!0;var u=360*Math.PI/180;l-=Math.floor(l/u)*u;var c=this.camera;if(!n&&this.isRunning)return c;if(this.isRunning=!0,this.duration=i,this.progress=0,this.source=c.rotation,this.destination=l,"string"==typeof s&&o.hasOwnProperty(s)?this.ease=o[s]:"function"==typeof s&&(this.ease=s),this._elapsed=0,this._onUpdate=a,this._onUpdateScope=h,this.shortestPath){var d,f;(d=this.destination>this.source?Math.abs(this.destination-this.source):Math.abs(this.destination+u)-this.source)<(f=this.source>this.destination?Math.abs(this.source-this.destination):Math.abs(this.source+u)-this.destination)?this.clockwise=!0:d>f&&(this.clockwise=!1)}return this.camera.emit(r.ROTATE_START,this.camera,this,i,l),c},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=s(this._elapsed/this.duration,0,1);this.progress=i;var n=this.camera;if(this._elapsed=l?Math.abs(h-l):Math.abs(h+a)-l;var u;u=this.clockwise?n.rotation+o*r:n.rotation-o*r,n.rotation=u,this._onUpdate&&this._onUpdate.call(this._onUpdateScope,n,i,u)}else n.rotation=this.destination,this._onUpdate&&this._onUpdate.call(this._onUpdateScope,n,i,this.destination),this.effectComplete()}},effectComplete:function(){this._onUpdate=null,this._onUpdateScope=null,this.isRunning=!1,this.camera.emit(r.ROTATE_COMPLETE,this.camera,this)},reset:function(){this.isRunning=!1,this._onUpdate=null,this._onUpdateScope=null},destroy:function(){this.reset(),this.camera=null,this.source=null,this.destination=null}});t.exports=a},30330:(t,e,i)=>{var s=i(45319),n=i(83419),r=i(19715),o=i(26099),a=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.intensity=new o,this.progress=0,this._elapsed=0,this._offsetX=0,this._offsetY=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,s,n){return void 0===t&&(t=100),void 0===e&&(e=.05),void 0===i&&(i=!1),void 0===s&&(s=null),void 0===n&&(n=this.camera.scene),!i&&this.isRunning||(this.isRunning=!0,this.duration=t,this.progress=0,"number"==typeof e?this.intensity.set(e):this.intensity.set(e.x,e.y),this._elapsed=0,this._offsetX=0,this._offsetY=0,this._onUpdate=s,this._onUpdateScope=n,this.camera.emit(r.SHAKE_START,this.camera,this,t,e)),this.camera},preRender:function(){this.isRunning&&this.camera.matrix.translate(this._offsetX,this._offsetY)},update:function(t,e){if(this.isRunning)if(this._elapsed+=e,this.progress=s(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsed{var s=i(45319),n=i(83419),r=i(62640),o=i(19715),a=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=1,this.destination=1,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,s,n,a){void 0===e&&(e=1e3),void 0===i&&(i=r.Linear),void 0===s&&(s=!1),void 0===n&&(n=null),void 0===a&&(a=this.camera.scene);var h=this.camera;return!s&&this.isRunning||(this.isRunning=!0,this.duration=e,this.progress=0,this.source=h.zoom,this.destination=t,"string"==typeof i&&r.hasOwnProperty(i)?this.ease=r[i]:"function"==typeof i&&(this.ease=i),this._elapsed=0,this._onUpdate=n,this._onUpdateScope=a,this.camera.emit(o.ZOOM_START,this.camera,this,e,t)),h},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=s(this._elapsed/this.duration,0,1),this._elapsed{t.exports={Fade:i(5020),Flash:i(10662),Pan:i(20359),Shake:i(30330),RotateTo:i(34208),Zoom:i(45641)}},16438:t=>{t.exports="cameradestroy"},32726:t=>{t.exports="camerafadeincomplete"},87807:t=>{t.exports="camerafadeinstart"},45917:t=>{t.exports="camerafadeoutcomplete"},95666:t=>{t.exports="camerafadeoutstart"},47056:t=>{t.exports="cameraflashcomplete"},91261:t=>{t.exports="cameraflashstart"},45047:t=>{t.exports="followupdate"},81927:t=>{t.exports="camerapancomplete"},74264:t=>{t.exports="camerapanstart"},54419:t=>{t.exports="postrender"},79330:t=>{t.exports="prerender"},93183:t=>{t.exports="camerarotatecomplete"},80112:t=>{t.exports="camerarotatestart"},62252:t=>{t.exports="camerashakecomplete"},86017:t=>{t.exports="camerashakestart"},539:t=>{t.exports="camerazoomcomplete"},51892:t=>{t.exports="camerazoomstart"},19715:(t,e,i)=>{t.exports={DESTROY:i(16438),FADE_IN_COMPLETE:i(32726),FADE_IN_START:i(87807),FADE_OUT_COMPLETE:i(45917),FADE_OUT_START:i(95666),FLASH_COMPLETE:i(47056),FLASH_START:i(91261),FOLLOW_UPDATE:i(45047),PAN_COMPLETE:i(81927),PAN_START:i(74264),POST_RENDER:i(54419),PRE_RENDER:i(79330),ROTATE_COMPLETE:i(93183),ROTATE_START:i(80112),SHAKE_COMPLETE:i(62252),SHAKE_START:i(86017),ZOOM_COMPLETE:i(539),ZOOM_START:i(51892)}},87969:(t,e,i)=>{t.exports={Camera:i(38058),BaseCamera:i(71911),CameraManager:i(32743),Effects:i(20052),Events:i(19715)}},63091:(t,e,i)=>{var s=i(83419),n=i(35154),r=new s({initialize:function(t){this.camera=n(t,"camera",null),this.left=n(t,"left",null),this.right=n(t,"right",null),this.up=n(t,"up",null),this.down=n(t,"down",null),this.zoomIn=n(t,"zoomIn",null),this.zoomOut=n(t,"zoomOut",null),this.zoomSpeed=n(t,"zoomSpeed",.01),this.minZoom=n(t,"minZoom",.001),this.maxZoom=n(t,"maxZoom",1e3),this.speedX=0,this.speedY=0;var e=n(t,"speed",null);"number"==typeof e?(this.speedX=e,this.speedY=e):(this.speedX=n(t,"speed.x",0),this.speedY=n(t,"speed.y",0)),this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this.up&&this.up.isDown?e.scrollY-=this.speedY*t|0:this.down&&this.down.isDown&&(e.scrollY+=this.speedY*t|0),this.left&&this.left.isDown?e.scrollX-=this.speedX*t|0:this.right&&this.right.isDown&&(e.scrollX+=this.speedX*t|0),this.zoomIn&&this.zoomIn.isDown?(e.zoom-=this.zoomSpeed,e.zoomthis.maxZoom&&(e.zoom=this.maxZoom))}},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},58818:(t,e,i)=>{var s=i(83419),n=i(35154),r=new s({initialize:function(t){this.camera=n(t,"camera",null),this.left=n(t,"left",null),this.right=n(t,"right",null),this.up=n(t,"up",null),this.down=n(t,"down",null),this.zoomIn=n(t,"zoomIn",null),this.zoomOut=n(t,"zoomOut",null),this.zoomSpeed=n(t,"zoomSpeed",.01),this.minZoom=n(t,"minZoom",.001),this.maxZoom=n(t,"maxZoom",1e3),this.accelX=0,this.accelY=0;var e=n(t,"acceleration",null);"number"==typeof e?(this.accelX=e,this.accelY=e):(this.accelX=n(t,"acceleration.x",0),this.accelY=n(t,"acceleration.y",0)),this.dragX=0,this.dragY=0;var i=n(t,"drag",null);"number"==typeof i?(this.dragX=i,this.dragY=i):(this.dragX=n(t,"drag.x",0),this.dragY=n(t,"drag.y",0)),this.maxSpeedX=0,this.maxSpeedY=0;var s=n(t,"maxSpeed",null);"number"==typeof s?(this.maxSpeedX=s,this.maxSpeedY=s):(this.maxSpeedX=n(t,"maxSpeed.x",0),this.maxSpeedY=n(t,"maxSpeed.y",0)),this._speedX=0,this._speedY=0,this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this._speedX>0?(this._speedX-=this.dragX*t,this._speedX<0&&(this._speedX=0)):this._speedX<0&&(this._speedX+=this.dragX*t,this._speedX>0&&(this._speedX=0)),this._speedY>0?(this._speedY-=this.dragY*t,this._speedY<0&&(this._speedY=0)):this._speedY<0&&(this._speedY+=this.dragY*t,this._speedY>0&&(this._speedY=0)),this.up&&this.up.isDown?(this._speedY+=this.accelY,this._speedY>this.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoomthis.maxZoom&&(e.zoom=this.maxZoom))}},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},38865:(t,e,i)=>{t.exports={FixedKeyControl:i(63091),SmoothedKeyControl:i(58818)}},26638:(t,e,i)=>{t.exports={Controls:i(38865),Scene2D:i(87969)}},8054:(t,e,i)=>{var s={VERSION:"3.80.1",BlendModes:i(10312),ScaleModes:i(29795),AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,FOREVER:-1,NONE:4,UP:5,DOWN:6,LEFT:7,RIGHT:8};t.exports=s},69547:(t,e,i)=>{var s=i(83419),n=i(8054),r=i(42363),o=i(82264),a=i(95540),h=i(35154),l=i(41212),u=i(29747),c=i(75508),d=i(36060),f=i(80333),p=new s({initialize:function(t){void 0===t&&(t={});var e=h(t,"scale",null);this.width=h(e,"width",1024,t),this.height=h(e,"height",768,t),this.zoom=h(e,"zoom",1,t),this.parent=h(e,"parent",void 0,t),this.scaleMode=h(e,e?"mode":"scaleMode",0,t),this.expandParent=h(e,"expandParent",!0,t),this.autoRound=h(e,"autoRound",!1,t),this.autoCenter=h(e,"autoCenter",0,t),this.resizeInterval=h(e,"resizeInterval",500,t),this.fullscreenTarget=h(e,"fullscreenTarget",null,t),this.minWidth=h(e,"min.width",0,t),this.maxWidth=h(e,"max.width",0,t),this.minHeight=h(e,"min.height",0,t),this.maxHeight=h(e,"max.height",0,t),this.snapWidth=h(e,"snap.width",0,t),this.snapHeight=h(e,"snap.height",0,t),this.renderType=h(t,"type",n.AUTO),this.canvas=h(t,"canvas",null),this.context=h(t,"context",null),this.canvasStyle=h(t,"canvasStyle",null),this.customEnvironment=h(t,"customEnvironment",!1),this.sceneConfig=h(t,"scene",null),this.seed=h(t,"seed",[(Date.now()*Math.random()).toString()]),c.RND=new c.RandomDataGenerator(this.seed),this.gameTitle=h(t,"title",""),this.gameURL=h(t,"url","https://phaser.io"),this.gameVersion=h(t,"version",""),this.autoFocus=h(t,"autoFocus",!0),this.stableSort=h(t,"stableSort",-1),-1===this.stableSort&&(this.stableSort=o.browser.es2019?1:0),o.features.stableSort=this.stableSort,this.domCreateContainer=h(t,"dom.createContainer",!1),this.domPointerEvents=h(t,"dom.pointerEvents","none"),this.inputKeyboard=h(t,"input.keyboard",!0),this.inputKeyboardEventTarget=h(t,"input.keyboard.target",window),this.inputKeyboardCapture=h(t,"input.keyboard.capture",[]),this.inputMouse=h(t,"input.mouse",!0),this.inputMouseEventTarget=h(t,"input.mouse.target",null),this.inputMousePreventDefaultDown=h(t,"input.mouse.preventDefaultDown",!0),this.inputMousePreventDefaultUp=h(t,"input.mouse.preventDefaultUp",!0),this.inputMousePreventDefaultMove=h(t,"input.mouse.preventDefaultMove",!0),this.inputMousePreventDefaultWheel=h(t,"input.mouse.preventDefaultWheel",!0),this.inputTouch=h(t,"input.touch",o.input.touch),this.inputTouchEventTarget=h(t,"input.touch.target",null),this.inputTouchCapture=h(t,"input.touch.capture",!0),this.inputActivePointers=h(t,"input.activePointers",1),this.inputSmoothFactor=h(t,"input.smoothFactor",0),this.inputWindowEvents=h(t,"input.windowEvents",!0),this.inputGamepad=h(t,"input.gamepad",!1),this.inputGamepadEventTarget=h(t,"input.gamepad.target",window),this.disableContextMenu=h(t,"disableContextMenu",!1),this.audio=h(t,"audio",{}),this.hideBanner=!1===h(t,"banner",null),this.hidePhaser=h(t,"banner.hidePhaser",!1),this.bannerTextColor=h(t,"banner.text","#ffffff"),this.bannerBackgroundColor=h(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=h(t,"fps",null),this.disablePreFX=h(t,"disablePreFX",!1),this.disablePostFX=h(t,"disablePostFX",!1);var i=h(t,"render",null);this.pipeline=h(i,"pipeline",null,t),this.autoMobilePipeline=h(i,"autoMobilePipeline",!0,t),this.defaultPipeline=h(i,"defaultPipeline",d.MULTI_PIPELINE,t),this.antialias=h(i,"antialias",!0,t),this.antialiasGL=h(i,"antialiasGL",!0,t),this.mipmapFilter=h(i,"mipmapFilter","",t),this.desynchronized=h(i,"desynchronized",!1,t),this.roundPixels=h(i,"roundPixels",!0,t),this.pixelArt=h(i,"pixelArt",1!==this.zoom,t),this.pixelArt&&(this.antialias=!1,this.antialiasGL=!1,this.roundPixels=!0),this.transparent=h(i,"transparent",!1,t),this.clearBeforeRender=h(i,"clearBeforeRender",!0,t),this.preserveDrawingBuffer=h(i,"preserveDrawingBuffer",!1,t),this.premultipliedAlpha=h(i,"premultipliedAlpha",!0,t),this.failIfMajorPerformanceCaveat=h(i,"failIfMajorPerformanceCaveat",!1,t),this.powerPreference=h(i,"powerPreference","default",t),this.batchSize=h(i,"batchSize",4096,t),this.maxTextures=h(i,"maxTextures",-1,t),this.maxLights=h(i,"maxLights",10,t);var s=h(t,"backgroundColor",0);this.backgroundColor=f(s),this.transparent&&(this.backgroundColor=f(0),this.backgroundColor.alpha=0),this.preBoot=h(t,"callbacks.preBoot",u),this.postBoot=h(t,"callbacks.postBoot",u),this.physics=h(t,"physics",{}),this.defaultPhysicsSystem=h(this.physics,"default",!1),this.loaderBaseURL=h(t,"loader.baseURL",""),this.loaderPath=h(t,"loader.path",""),this.loaderMaxParallelDownloads=h(t,"loader.maxParallelDownloads",o.os.android?6:32),this.loaderCrossOrigin=h(t,"loader.crossOrigin",void 0),this.loaderResponseType=h(t,"loader.responseType",""),this.loaderAsync=h(t,"loader.async",!0),this.loaderUser=h(t,"loader.user",""),this.loaderPassword=h(t,"loader.password",""),this.loaderTimeout=h(t,"loader.timeout",0),this.loaderWithCredentials=h(t,"loader.withCredentials",!1),this.loaderImageLoadType=h(t,"loader.imageLoadType","XHR"),this.loaderLocalScheme=h(t,"loader.localScheme",["file://","capacitor://"]),this.glowFXQuality=h(t,"fx.glow.quality",.1),this.glowFXDistance=h(t,"fx.glow.distance",10),this.installGlobalPlugins=[],this.installScenePlugins=[];var p=h(t,"plugins",null),v=r.DefaultScene;p&&(Array.isArray(p)?this.defaultPlugins=p:l(p)&&(this.installGlobalPlugins=a(p,"global",[]),this.installScenePlugins=a(p,"scene",[]),Array.isArray(p.default)?v=p.default:Array.isArray(p.defaultMerge)&&(v=v.concat(p.defaultMerge)))),this.defaultPlugins=v;var g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=h(t,"images.default",g+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=h(t,"images.missing",g+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),this.whiteImage=h(t,"images.white","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABdJREFUeNpi/P//PwMMMDEgAdwcgAADAJZuAwXJYZOzAAAAAElFTkSuQmCC"),window&&(window.FORCE_WEBGL?this.renderType=n.WEBGL:window.FORCE_CANVAS&&(this.renderType=n.CANVAS))}});t.exports=p},86054:(t,e,i)=>{var s=i(20623),n=i(27919),r=i(8054),o=i(89357);t.exports=function(t){var e=t.config;if((e.customEnvironment||e.canvas)&&e.renderType===r.AUTO)throw new Error("Must set explicit renderType in custom environment");if(!e.customEnvironment&&!e.canvas&&e.renderType!==r.HEADLESS)if(e.renderType===r.AUTO&&(e.renderType=o.webGL?r.WEBGL:r.CANVAS),e.renderType===r.WEBGL){if(!o.webGL)throw new Error("Cannot create WebGL context, aborting.")}else{if(e.renderType!==r.CANVAS)throw new Error("Unknown value for renderer type: "+e.renderType);if(!o.canvas)throw new Error("Cannot create Canvas context, aborting.")}e.antialias||n.disableSmoothing();var a,h,l=t.scale.baseSize,u=l.width,c=l.height;e.canvas?(t.canvas=e.canvas,t.canvas.width=u,t.canvas.height=c):t.canvas=n.create(t,u,c,e.renderType),e.canvasStyle&&(t.canvas.style=e.canvasStyle),e.antialias||s.setCrisp(t.canvas),e.renderType!==r.HEADLESS&&(a=i(68627),h=i(74797),e.renderType===r.WEBGL?t.renderer=new h(t):(t.renderer=new a(t),t.context=t.renderer.gameContext))}},96391:(t,e,i)=>{var s=i(8054);t.exports=function(t){var e=t.config;if(!e.hideBanner){var i="WebGL";e.renderType===s.CANVAS?i="Canvas":e.renderType===s.HEADLESS&&(i="Headless");var n,r=e.audio,o=t.device.audio;if(n=o.webAudio&&!r.disableWebAudio?"Web Audio":r.noAudio||!o.webAudio&&!o.audioData?"No Audio":"HTML5 Audio",t.device.browser.ie)window.console&&console.log("Phaser v"+s.VERSION+" / https://phaser.io");else{var a,h="",l=[h];Array.isArray(e.bannerBackgroundColor)?(e.bannerBackgroundColor.forEach((function(t){h=h.concat("%c "),l.push("background: "+t),a=t})),l[l.length-1]="color: "+e.bannerTextColor+"; background: "+a):(h=h.concat("%c "),l.push("color: "+e.bannerTextColor+"; background: "+e.bannerBackgroundColor)),l.push("background: transparent"),e.gameTitle&&(h=h.concat(e.gameTitle),e.gameVersion&&(h=h.concat(" v"+e.gameVersion)),e.hidePhaser||(h=h.concat(" / "))),e.hidePhaser||(h=h.concat("Phaser v"+s.VERSION+" ("+i+" | "+n+")")),h=h.concat(" %c "+e.gameURL),l[0]=h,console.log.apply(console,l)}}}},50127:(t,e,i)=>{var s=i(40366),n=i(60848),r=i(24047),o=i(27919),a=i(83419),h=i(69547),l=i(83719),u=i(86054),c=i(45893),d=i(96391),f=i(82264),p=i(57264),v=i(50792),g=i(8443),m=i(7003),y=i(37277),x=i(77332),T=i(76531),w=i(60903),b=i(69442),S=i(17130),E=i(65898),A=i(51085),C=i(14747),_=new a({initialize:function(t){this.config=new h(t),this.renderer=null,this.domContainer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new v,this.anims=new n(this),this.textures=new S(this),this.cache=new r(this),this.registry=new c(this,new v),this.input=new m(this,this.config),this.scene=new w(this,this.config.sceneConfig),this.device=f,this.scale=new T(this,this.config),this.sound=null,this.sound=C.create(this),this.loop=new E(this,this.config.fps),this.plugins=new x(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,this.isPaused=!1,p(this.boot.bind(this))},boot:function(){y.hasCore("EventEmitter")?(this.isBooted=!0,this.config.preBoot(this),this.scale.preBoot(),u(this),l(this),d(this),s(this.canvas,this.config.parent),this.textures.once(b.READY,this.texturesReady,this),this.events.emit(g.BOOT)):console.warn("Aborting. Core Plugins missing.")},texturesReady:function(){this.events.emit(g.READY),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),A(this);var t=this.events;t.on(g.HIDDEN,this.onHidden,this),t.on(g.VISIBLE,this.onVisible,this),t.on(g.BLUR,this.onBlur,this),t.on(g.FOCUS,this.onFocus,this)},step:function(t,e){if(this.pendingDestroy)return this.runDestroy();if(!this.isPaused){var i=this.events;i.emit(g.PRE_STEP,t,e),i.emit(g.STEP,t,e),this.scene.update(t,e),i.emit(g.POST_STEP,t,e);var s=this.renderer;s.preRender(),i.emit(g.PRE_RENDER,s,t,e),this.scene.render(s),s.postRender(),i.emit(g.POST_RENDER,s,t,e)}},headlessStep:function(t,e){if(this.pendingDestroy)return this.runDestroy();if(!this.isPaused){var i=this.events;i.emit(g.PRE_STEP,t,e),i.emit(g.STEP,t,e),this.scene.update(t,e),i.emit(g.POST_STEP,t,e),this.scene.isProcessing=!1,i.emit(g.PRE_RENDER,null,t,e),i.emit(g.POST_RENDER,null,t,e)}},onHidden:function(){this.loop.pause(),this.events.emit(g.PAUSE)},pause:function(){var t=this.isPaused;this.isPaused=!0,t||this.events.emit(g.PAUSE)},onVisible:function(){this.loop.resume(),this.events.emit(g.RESUME)},resume:function(){var t=this.isPaused;this.isPaused=!1,t&&this.events.emit(g.RESUME)},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},getFrame:function(){return this.loop.frame},getTime:function(){return this.loop.now},destroy:function(t,e){void 0===e&&(e=!1),this.pendingDestroy=!0,this.removeCanvas=t,this.noReturn=e},runDestroy:function(){this.scene.destroy(),this.events.emit(g.DESTROY),this.events.removeAllListeners(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(o.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.domContainer&&this.domContainer.parentNode&&this.domContainer.parentNode.removeChild(this.domContainer),this.loop.destroy(),this.pendingDestroy=!1}});t.exports=_},65898:(t,e,i)=>{var s=i(83419),n=i(35154),r=i(29747),o=i(43092),a=new s({initialize:function(t,e){this.game=t,this.raf=new o,this.started=!1,this.running=!1,this.minFps=n(e,"min",5),this.targetFps=n(e,"target",60),this.fpsLimit=n(e,"limit",0),this.hasFpsLimit=this.fpsLimit>0,this._limitRate=this.hasFpsLimit?1e3/this.fpsLimit:0,this._min=1e3/this.minFps,this._target=1e3/this.targetFps,this.actualFps=this.targetFps,this.nextFpsUpdate=0,this.framesThisSecond=0,this.callback=r,this.forceSetTimeOut=n(e,"forceSetTimeOut",!1),this.time=0,this.startTime=0,this.lastTime=0,this.frame=0,this.inFocus=!0,this._pauseTime=0,this._coolDown=0,this.delta=0,this.deltaIndex=0,this.deltaHistory=[],this.deltaSmoothingMax=n(e,"deltaHistory",10),this.panicMax=n(e,"panicMax",120),this.rawDelta=0,this.now=0,this.smoothStep=n(e,"smoothStep",!0)},blur:function(){this.inFocus=!1},focus:function(){this.inFocus=!0,this.resetDelta()},pause:function(){this._pauseTime=window.performance.now()},resume:function(){this.resetDelta(),this.startTime+=this.time-this._pauseTime},resetDelta:function(){var t=window.performance.now();this.time=t,this.lastTime=t,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0;for(var e=0;e0||!this.inFocus)&&(this._coolDown--,t=Math.min(t,this._target)),t>this._min&&(t=i[e],t=Math.min(t,this._min)),i[e]=t,this.deltaIndex++,this.deltaIndex>=s&&(this.deltaIndex=0);for(var n=0,r=0;r=this.nextFpsUpdate&&this.updateFPS(t),this.framesThisSecond++,this.delta>=this._limitRate&&(this.callback(t,this.delta),this.delta=0),this.lastTime=t,this.frame++},step:function(t){this.now=t;var e=Math.max(0,t-this.lastTime);this.rawDelta=e,this.time+=this.rawDelta,this.smoothStep&&(e=this.smoothDelta(e)),this.delta=e,t>=this.nextFpsUpdate&&this.updateFPS(t),this.framesThisSecond++,this.callback(t,e),this.lastTime=t,this.frame++},tick:function(){var t=window.performance.now();this.hasFpsLimit?this.stepLimitFPS(t):this.step(t)},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){void 0===t&&(t=!1);var e=window.performance.now();if(!this.running){t&&(this.startTime+=-this.lastTime+(this.lastTime+e));var i=this.hasFpsLimit?this.stepLimitFPS.bind(this):this.step.bind(this);this.raf.start(i,this.forceSetTimeOut,this._target),this.running=!0,this.nextFpsUpdate=e+1e3,this.framesThisSecond=0,this.fpsLimitTriggered=!1,this.tick()}},getDuration:function(){return Math.round(this.lastTime-this.startTime)/1e3},getDurationMS:function(){return Math.round(this.lastTime-this.startTime)},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.raf.destroy(),this.raf=null,this.game=null,this.callback=null}});t.exports=a},51085:(t,e,i)=>{var s=i(8443);t.exports=function(t){var e,i=t.events;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach((function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")})),e&&document.addEventListener(e,(function(t){document.hidden||"pause"===t.type?i.emit(s.HIDDEN):i.emit(s.VISIBLE)}),!1),window.onblur=function(){i.emit(s.BLUR)},window.onfocus=function(){i.emit(s.FOCUS)},window.focus&&t.config.autoFocus&&window.focus()}},97217:t=>{t.exports="blur"},47548:t=>{t.exports="boot"},19814:t=>{t.exports="contextlost"},68446:t=>{t.exports="destroy"},41700:t=>{t.exports="focus"},25432:t=>{t.exports="hidden"},65942:t=>{t.exports="pause"},59211:t=>{t.exports="postrender"},47789:t=>{t.exports="poststep"},39066:t=>{t.exports="prerender"},460:t=>{t.exports="prestep"},16175:t=>{t.exports="ready"},42331:t=>{t.exports="resume"},11966:t=>{t.exports="step"},32969:t=>{t.exports="systemready"},94830:t=>{t.exports="visible"},8443:(t,e,i)=>{t.exports={BLUR:i(97217),BOOT:i(47548),CONTEXT_LOST:i(19814),DESTROY:i(68446),FOCUS:i(41700),HIDDEN:i(25432),PAUSE:i(65942),POST_RENDER:i(59211),POST_STEP:i(47789),PRE_RENDER:i(39066),PRE_STEP:i(460),READY:i(16175),RESUME:i(42331),STEP:i(11966),SYSTEM_READY:i(32969),VISIBLE:i(94830)}},42857:(t,e,i)=>{t.exports={Config:i(69547),CreateRenderer:i(86054),DebugHeader:i(96391),Events:i(8443),TimeStep:i(65898),VisibilityHandler:i(51085)}},99584:(t,e,i)=>{var s=i(5290),n=i(27919),r=i(35154);t.exports=function(t){var e=r(t,"data",[]),i=r(t,"canvas",null),o=r(t,"palette",s),a=r(t,"pixelWidth",1),h=r(t,"pixelHeight",a),l=r(t,"resizeCanvas",!0),u=r(t,"clearCanvas",!0),c=r(t,"preRender",null),d=r(t,"postRender",null),f=Math.floor(Math.abs(e[0].length*a)),p=Math.floor(Math.abs(e.length*h));i||(i=n.create2D(this,f,p),l=!1,u=!1),l&&(i.width=f,i.height=p);var v=i.getContext("2d",{willReadFrequently:!0});u&&v.clearRect(0,0,f,p),c&&c(i,v);for(var g=0;g{t.exports={GenerateTexture:i(99584),Palettes:i(57763)}},5290:t=>{t.exports={0:"#000",1:"#9D9D9D",2:"#FFF",3:"#BE2633",4:"#E06F8B",5:"#493C2B",6:"#A46422",7:"#EB8931",8:"#F7E26B",9:"#2F484E",A:"#44891A",B:"#A3CE27",C:"#1B2632",D:"#005784",E:"#31A2F2",F:"#B2DCEF"}},23816:t=>{t.exports={0:"#000",1:"#fff",2:"#8b4131",3:"#7bbdc5",4:"#8b41ac",5:"#6aac41",6:"#3931a4",7:"#d5de73",8:"#945a20",9:"#5a4100",A:"#bd736a",B:"#525252",C:"#838383",D:"#acee8b",E:"#7b73de",F:"#acacac"}},9866:t=>{t.exports={0:"#000",1:"#2234d1",2:"#0c7e45",3:"#44aacc",4:"#8a3622",5:"#5c2e78",6:"#aa5c3d",7:"#b5b5b5",8:"#5e606e",9:"#4c81fb",A:"#6cd947",B:"#7be2f9",C:"#eb8a60",D:"#e23d69",E:"#ffd93f",F:"#fff"}},77552:t=>{t.exports={0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#f5f4eb"}},92259:t=>{t.exports={0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#fff"}},57763:(t,e,i)=>{t.exports={ARNE16:i(5290),C64:i(23816),CGA:i(9866),JMP:i(77552),MSX:i(92259)}},46728:(t,e,i)=>{var s=i(83419),n=i(36316),r=i(80021),o=i(26099),a=new s({Extends:r,initialize:function(t,e,i,s){r.call(this,"CubicBezierCurve"),Array.isArray(t)&&(s=new o(t[6],t[7]),i=new o(t[4],t[5]),e=new o(t[2],t[3]),t=new o(t[0],t[1])),this.p0=t,this.p1=e,this.p2=i,this.p3=s},getStartPoint:function(t){return void 0===t&&(t=new o),t.copy(this.p0)},getResolution:function(t){return t},getPoint:function(t,e){void 0===e&&(e=new o);var i=this.p0,s=this.p1,r=this.p2,a=this.p3;return e.set(n(t,i.x,s.x,r.x,a.x),n(t,i.y,s.y,r.y,a.y))},draw:function(t,e){void 0===e&&(e=32);var i=this.getPoints(e);t.beginPath(),t.moveTo(this.p0.x,this.p0.y);for(var s=1;s{var s=i(83419),n=i(19217),r=i(87841),o=i(26099),a=new s({initialize:function(t){this.type=t,this.defaultDivisions=5,this.arcLengthDivisions=100,this.cacheArcLengths=[],this.needsUpdate=!0,this.active=!0,this._tmpVec2A=new o,this._tmpVec2B=new o},draw:function(t,e){return void 0===e&&(e=32),t.strokePoints(this.getPoints(e))},getBounds:function(t,e){t||(t=new r),void 0===e&&(e=16);var i=this.getLength();e>i&&(e=i/2);var s=Math.max(1,Math.round(i/e));return n(this.getSpacedPoints(s),t)},getDistancePoints:function(t){var e=this.getLength(),i=Math.max(1,e/t);return this.getSpacedPoints(i)},getEndPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(1,t)},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i=[],s=this.getPoint(0,this._tmpVec2A),n=0;i.push(0);for(var r=1;r<=t;r++)n+=(e=this.getPoint(r/t,this._tmpVec2B)).distance(s),i.push(n),s.copy(e);return this.cacheArcLengths=i,i},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t,e,i){void 0===i&&(i=[]),t||(t=e?this.getLength()/e:this.defaultDivisions);for(var s=0;s<=t;s++)i.push(this.getPoint(s/t));return i},getRandomPoint:function(t){return void 0===t&&(t=new o),this.getPoint(Math.random(),t)},getSpacedPoints:function(t,e,i){void 0===i&&(i=[]),t||(t=e?this.getLength()/e:this.defaultDivisions);for(var s=0;s<=t;s++){var n=this.getUtoTmapping(s/t,null,t);i.push(this.getPoint(n))}return i},getStartPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(0,t)},getTangent:function(t,e){void 0===e&&(e=new o);var i=1e-4,s=t-i,n=t+i;return s<0&&(s=0),n>1&&(n=1),this.getPoint(s,this._tmpVec2A),this.getPoint(n,e),e.subtract(this._tmpVec2A).normalize()},getTangentAt:function(t,e){var i=this.getUtoTmapping(t);return this.getTangent(i,e)},getTFromDistance:function(t,e){return t<=0?0:this.getUtoTmapping(0,t,e)},getUtoTmapping:function(t,e,i){var s,n=this.getLengths(i),r=0,o=n.length;s=e?Math.min(e,n[o-1]):t*n[o-1];for(var a,h=0,l=o-1;h<=l;)if((a=n[r=Math.floor(h+(l-h)/2)]-s)<0)h=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(n[r=l]===s)return r/(o-1);var u=n[r];return(r+(s-u)/(n[r+1]-u))/(o-1)},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()}});t.exports=a},73825:(t,e,i)=>{var s=i(83419),n=i(80021),r=i(39506),o=i(35154),a=i(43396),h=i(26099),l=new s({Extends:n,initialize:function(t,e,i,s,a,l,u,c){if("object"==typeof t){var d=t;t=o(d,"x",0),e=o(d,"y",0),i=o(d,"xRadius",0),s=o(d,"yRadius",i),a=o(d,"startAngle",0),l=o(d,"endAngle",360),u=o(d,"clockwise",!1),c=o(d,"rotation",0)}else void 0===s&&(s=i),void 0===a&&(a=0),void 0===l&&(l=360),void 0===u&&(u=!1),void 0===c&&(c=0);n.call(this,"EllipseCurve"),this.p0=new h(t,e),this._xRadius=i,this._yRadius=s,this._startAngle=r(a),this._endAngle=r(l),this._clockwise=u,this._rotation=r(c)},getStartPoint:function(t){return void 0===t&&(t=new h),this.getPoint(0,t)},getResolution:function(t){return 2*t},getPoint:function(t,e){void 0===e&&(e=new h);for(var i=2*Math.PI,s=this._endAngle-this._startAngle,n=Math.abs(s)i;)s-=i;s{var s=i(83419),n=i(80021),r=i(19217),o=i(87841),a=i(26099),h=new s({Extends:n,initialize:function(t,e){n.call(this,"LineCurve"),Array.isArray(t)&&(e=new a(t[2],t[3]),t=new a(t[0],t[1])),this.p0=t,this.p1=e,this.arcLengthDivisions=1},getBounds:function(t){return void 0===t&&(t=new o),r([this.p0,this.p1],t)},getStartPoint:function(t){return void 0===t&&(t=new a),t.copy(this.p0)},getResolution:function(t){return void 0===t&&(t=1),t},getPoint:function(t,e){return void 0===e&&(e=new a),1===t?e.copy(this.p1):(e.copy(this.p1).subtract(this.p0).scale(t).add(this.p0),e)},getPointAt:function(t,e){return this.getPoint(t,e)},getTangent:function(t,e){return void 0===e&&(e=new a),e.copy(this.p1).subtract(this.p0).normalize(),e},getUtoTmapping:function(t,e,i){var s;if(e){var n=this.getLengths(i),r=n[n.length-1];s=Math.min(e,r)/r}else s=t;return s},draw:function(t){return t.lineBetween(this.p0.x,this.p0.y,this.p1.x,this.p1.y),t},toJSON:function(){return{type:this.type,points:[this.p0.x,this.p0.y,this.p1.x,this.p1.y]}}});h.fromJSON=function(t){var e=t.points,i=new a(e[0],e[1]),s=new a(e[2],e[3]);return new h(i,s)},t.exports=h},14744:(t,e,i)=>{var s=i(83419),n=i(80021),r=i(32112),o=i(26099),a=new s({Extends:n,initialize:function(t,e,i){n.call(this,"QuadraticBezierCurve"),Array.isArray(t)&&(i=new o(t[4],t[5]),e=new o(t[2],t[3]),t=new o(t[0],t[1])),this.p0=t,this.p1=e,this.p2=i},getStartPoint:function(t){return void 0===t&&(t=new o),t.copy(this.p0)},getResolution:function(t){return t},getPoint:function(t,e){void 0===e&&(e=new o);var i=this.p0,s=this.p1,n=this.p2;return e.set(r(t,i.x,s.x,n.x),r(t,i.y,s.y,n.y))},draw:function(t,e){void 0===e&&(e=32);var i=this.getPoints(e);t.beginPath(),t.moveTo(this.p0.x,this.p0.y);for(var s=1;s{var s=i(87842),n=i(83419),r=i(80021),o=i(26099),a=new n({Extends:r,initialize:function(t){void 0===t&&(t=[]),r.call(this,"SplineCurve"),this.points=[],this.addPoints(t)},addPoints:function(t){for(var e=0;ei.length-2?i.length-1:r+1],c=i[r>i.length-3?i.length-1:r+2];return e.set(s(a,h.x,l.x,u.x,c.x),s(a,h.y,l.y,u.y,c.y))},toJSON:function(){for(var t=[],e=0;e{t.exports={Path:i(46669),MoveTo:i(68618),CubicBezier:i(46728),Curve:i(80021),Ellipse:i(73825),Line:i(33951),QuadraticBezier:i(14744),Spline:i(42534)}},68618:(t,e,i)=>{var s=i(83419),n=i(26099),r=new s({initialize:function(t,e){this.active=!1,this.p0=new n(t,e)},getPoint:function(t,e){return void 0===e&&(e=new n),e.copy(this.p0)},getPointAt:function(t,e){return this.getPoint(t,e)},getResolution:function(){return 1},getLength:function(){return 0},toJSON:function(){return{type:"MoveTo",points:[this.p0.x,this.p0.y]}}});t.exports=r},46669:(t,e,i)=>{var s=i(83419),n=i(46728),r=i(73825),o=i(39429),a=i(33951),h=i(68618),l=i(14744),u=i(87841),c=i(42534),d=i(26099),f=i(36383),p=new s({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.defaultDivisions=12,this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new a(e,t)),this},cubicBezierTo:function(t,e,i,s,r,o){var a,h,l,u=this.getEndPoint();return t instanceof d?(a=t,h=e,l=i):(a=new d(i,s),h=new d(r,o),l=new d(t,e)),this.add(new n(u,a,h,l))},quadraticBezierTo:function(t,e,i,s){var n,r,o=this.getEndPoint();return t instanceof d?(n=t,r=e):(n=new d(i,s),r=new d(t,e)),this.add(new l(o,n,r))},draw:function(t,e){for(var i=0;i=e)return this.curves[s];s++}return null},getEndPoint:function(t){return void 0===t&&(t=new d),this.curves.length>0?this.curves[this.curves.length-1].getPoint(1,t):t.copy(this.startPoint),t},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},getPoint:function(t,e){void 0===e&&(e=new d);for(var i=t*this.getLength(),s=this.getCurveLengths(),n=0;n=i){var r=s[n]-i,o=this.curves[n],a=o.getLength(),h=0===a?0:1-r/a;return o.getPointAt(h,e)}n++}return null},getPoints:function(t,e){t||e||(t=this.defaultDivisions);for(var i,s=[],n=0;n1&&!s[s.length-1].equals(s[0])&&s.push(s[0]),s},getRandomPoint:function(t){return void 0===t&&(t=new d),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getStartPoint:function(t){return void 0===t&&(t=new d),t.copy(this.startPoint)},getTangent:function(t,e){void 0===e&&(e=new d);for(var i=t*this.getLength(),s=this.getCurveLengths(),n=0;n=i){var r=s[n]-i,o=this.curves[n],a=o.getLength(),h=0===a?0:1-r/a;return o.getTangentAt(h,e)}n++}return null},lineTo:function(t,e){t instanceof d?this._tmpVec2B.copy(t):"object"==typeof t?this._tmpVec2B.setFromObject(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new a([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new c(t))},moveTo:function(t,e){return t instanceof d?this.add(new h(t.x,t.y)):this.add(new h(t,e))},toJSON:function(){for(var t=[],e=0;e{var s=i(83419),n=i(24882),r=new s({initialize:function(t,e){this.parent=t,this.events=e,e||(this.events=t.events?t.events:t),this.list={},this.values={},this._frozen=!1,!t.hasOwnProperty("sys")&&this.events&&this.events.once(n.DESTROY,this.destroy,this)},get:function(t){var e=this.list;if(Array.isArray(t)){for(var i=[],s=0;s{var s=i(83419),n=i(45893),r=i(37277),o=i(44594),a=new s({Extends:n,initialize:function(t){n.call(this,t,t.sys.events),this.scene=t,this.systems=t.sys,t.sys.events.once(o.BOOT,this.boot,this),t.sys.events.on(o.START,this.start,this)},boot:function(){this.events=this.systems.events,this.events.once(o.DESTROY,this.destroy,this)},start:function(){this.events.once(o.SHUTDOWN,this.shutdown,this)},shutdown:function(){this.systems.events.off(o.SHUTDOWN,this.shutdown,this)},destroy:function(){n.prototype.destroy.call(this),this.events.off(o.START,this.start,this),this.scene=null,this.systems=null}});r.register("DataManagerPlugin",a,"data"),t.exports=a},10700:t=>{t.exports="changedata"},93608:t=>{t.exports="changedata-"},60883:t=>{t.exports="destroy"},69780:t=>{t.exports="removedata"},22166:t=>{t.exports="setdata"},24882:(t,e,i)=>{t.exports={CHANGE_DATA:i(10700),CHANGE_DATA_KEY:i(93608),DESTROY:i(60883),REMOVE_DATA:i(69780),SET_DATA:i(22166)}},44965:(t,e,i)=>{t.exports={DataManager:i(45893),DataManagerPlugin:i(63646),Events:i(24882)}},7098:(t,e,i)=>{var s=i(84148),n={flac:!1,aac:!1,audioData:!1,dolby:!1,m4a:!1,mp3:!1,ogg:!1,opus:!1,wav:!1,webAudio:!1,webm:!1};t.exports=function(){if("function"==typeof importScripts)return n;n.audioData=!!window.Audio,n.webAudio=!(!window.AudioContext&&!window.webkitAudioContext);var t=document.createElement("audio"),e=!!t.canPlayType;try{if(e){var i=function(e,i){var s=t.canPlayType("audio/"+e).replace(/^no$/,"");return i?Boolean(s||t.canPlayType("audio/"+i).replace(/^no$/,"")):Boolean(s)};if(n.ogg=i('ogg; codecs="vorbis"'),n.opus=i('ogg; codecs="opus"',"opus"),n.mp3=i("mpeg"),n.wav=i("wav"),n.m4a=i("x-m4a"),n.aac=i("aac"),n.flac=i("flac","x-flac"),n.webm=i('webm; codecs="vorbis"'),""!==t.canPlayType('audio/mp4; codecs="ec-3"'))if(s.edge)n.dolby=!0;else if(s.safari&&s.safariVersion>=9&&/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)){var r=parseInt(RegExp.$1,10),o=parseInt(RegExp.$2,10);(10===r&&o>=11||r>10)&&(n.dolby=!0)}}}catch(a){}return n}()},84148:(t,e,i)=>{var s,n=i(25892),r={chrome:!1,chromeVersion:0,edge:!1,firefox:!1,firefoxVersion:0,ie:!1,ieVersion:0,mobileSafari:!1,opera:!1,safari:!1,safariVersion:0,silk:!1,trident:!1,tridentVersion:0,es2019:!1};t.exports=(s=navigator.userAgent,/Edg\/\d+/.test(s)?(r.edge=!0,r.es2019=!0):/OPR/.test(s)?(r.opera=!0,r.es2019=!0):/Chrome\/(\d+)/.test(s)&&!n.windowsPhone?(r.chrome=!0,r.chromeVersion=parseInt(RegExp.$1,10),r.es2019=r.chromeVersion>69):/Firefox\D+(\d+)/.test(s)?(r.firefox=!0,r.firefoxVersion=parseInt(RegExp.$1,10),r.es2019=r.firefoxVersion>10):/AppleWebKit\/(?!.*CriOS)/.test(s)&&n.iOS?(r.mobileSafari=!0,r.es2019=!0):/MSIE (\d+\.\d+);/.test(s)?(r.ie=!0,r.ieVersion=parseInt(RegExp.$1,10)):/Version\/(\d+\.\d+(\.\d+)?) Safari/.test(s)&&!n.windowsPhone?(r.safari=!0,r.safariVersion=parseInt(RegExp.$1,10),r.es2019=r.safariVersion>10):/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(s)&&(r.ie=!0,r.trident=!0,r.tridentVersion=parseInt(RegExp.$1,10),r.ieVersion=parseInt(RegExp.$3,10)),/Silk/.test(s)&&(r.silk=!0),r)},89289:(t,e,i)=>{var s,n,r,o=i(27919),a={supportInverseAlpha:!1,supportNewBlendModes:!1};t.exports=("function"!=typeof importScripts&&void 0!==document&&(a.supportNewBlendModes=(s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",n="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",(r=new Image).onload=function(){var t=new Image;t.onload=function(){var e=o.create2D(t,6).getContext("2d",{willReadFrequently:!0});if(e.globalCompositeOperation="multiply",e.drawImage(r,0,0),e.drawImage(t,2,0),!e.getImageData(2,0,1,1))return!1;var i=e.getImageData(2,0,1,1).data;o.remove(t),a.supportNewBlendModes=255===i[0]&&0===i[1]&&0===i[2]},t.src=s+"/wCKxvRF"+n},r.src=s+"AP804Oa6"+n,!1),a.supportInverseAlpha=function(){var t=o.create2D(this,2).getContext("2d",{willReadFrequently:!0});t.fillStyle="rgba(10, 20, 30, 0.5)",t.fillRect(0,0,1,1);var e=t.getImageData(0,0,1,1);if(null===e)return!1;t.putImageData(e,1,0);var i=t.getImageData(1,0,1,1),s=i.data[0]===e.data[0]&&i.data[1]===e.data[1]&&i.data[2]===e.data[2]&&i.data[3]===e.data[3];return o.remove(this),s}()),a)},89357:(t,e,i)=>{var s=i(25892),n=i(84148),r=i(27919),o={canvas:!1,canvasBitBltShift:null,file:!1,fileSystem:!1,getUserMedia:!0,littleEndian:!1,localStorage:!1,pointerLock:!1,stableSort:!1,support32bit:!1,vibration:!1,webGL:!1,worker:!1};t.exports=function(){if("function"==typeof importScripts)return o;o.canvas=!!window.CanvasRenderingContext2D;try{o.localStorage=!!localStorage.getItem}catch(h){o.localStorage=!1}o.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),o.fileSystem=!!window.requestFileSystem;var t,e,i,a=!1;return o.webGL=function(){if(window.WebGLRenderingContext)try{var t=r.createWebGL(this),e=t.getContext("webgl")||t.getContext("experimental-webgl"),i=r.create2D(this),s=i.getContext("2d",{willReadFrequently:!0}).createImageData(1,1);return a=s.data instanceof Uint8ClampedArray,r.remove(t),r.remove(i),!!e}catch(n){return!1}return!1}(),o.worker=!!window.Worker,o.pointerLock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.oGetUserMedia,window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,o.getUserMedia=o.getUserMedia&&!!navigator.getUserMedia&&!!window.URL,n.firefox&&n.firefoxVersion<21&&(o.getUserMedia=!1),!s.iOS&&(n.ie||n.firefox||n.chrome)&&(o.canvasBitBltShift=!0),(n.safari||n.mobileSafari)&&(o.canvasBitBltShift=!1),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(o.vibration=!0),"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint32Array&&(o.littleEndian=(t=new ArrayBuffer(4),e=new Uint8Array(t),i=new Uint32Array(t),e[0]=161,e[1]=178,e[2]=195,e[3]=212,3569595041===i[0]||2712847316!==i[0]&&null)),o.support32bit="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof Int32Array&&null!==o.littleEndian&&a,o}()},91639:t=>{var e={available:!1,cancel:"",keyboard:!1,request:""};t.exports=function(){if("function"==typeof importScripts)return e;var t,i="Fullscreen",s="FullScreen",n=["request"+i,"request"+s,"webkitRequest"+i,"webkitRequest"+s,"msRequest"+i,"msRequest"+s,"mozRequest"+s,"mozRequest"+i];for(t=0;t{var s=i(84148),n={gamepads:!1,mspointer:!1,touch:!1,wheelEvent:null};t.exports=("function"==typeof importScripts||(("ontouchstart"in document.documentElement||navigator.maxTouchPoints&&navigator.maxTouchPoints>=1)&&(n.touch=!0),(navigator.msPointerEnabled||navigator.pointerEnabled)&&(n.mspointer=!0),navigator.getGamepads&&(n.gamepads=!0),"onwheel"in window||s.ie&&"WheelEvent"in window?n.wheelEvent="wheel":"onmousewheel"in window?n.wheelEvent="mousewheel":s.firefox&&"MouseScrollEvent"in window&&(n.wheelEvent="DOMMouseScroll")),n)},25892:t=>{var e={android:!1,chromeOS:!1,cordova:!1,crosswalk:!1,desktop:!1,ejecta:!1,electron:!1,iOS:!1,iOSVersion:0,iPad:!1,iPhone:!1,kindle:!1,linux:!1,macOS:!1,node:!1,nodeWebkit:!1,pixelRatio:1,webApp:!1,windows:!1,windowsPhone:!1};t.exports=function(){if("function"==typeof importScripts)return e;var t=navigator.userAgent;/Windows/.test(t)?e.windows=!0:/Mac OS/.test(t)&&!/like Mac OS/.test(t)?navigator.maxTouchPoints&&navigator.maxTouchPoints>2?(e.iOS=!0,e.iPad=!0,navigator.appVersion.match(/Version\/(\d+)/),e.iOSVersion=parseInt(RegExp.$1,10)):e.macOS=!0:/Android/.test(t)?e.android=!0:/Linux/.test(t)?e.linux=!0:/iP[ao]d|iPhone/i.test(t)?(e.iOS=!0,navigator.appVersion.match(/OS (\d+)/),e.iOSVersion=parseInt(RegExp.$1,10),e.iPhone=-1!==t.toLowerCase().indexOf("iphone"),e.iPad=-1!==t.toLowerCase().indexOf("ipad")):/Kindle/.test(t)||/\bKF[A-Z][A-Z]+/.test(t)||/Silk.*Mobile Safari/.test(t)?e.kindle=!0:/CrOS/.test(t)&&(e.chromeOS=!0),(/Windows Phone/i.test(t)||/IEMobile/i.test(t))&&(e.android=!1,e.iOS=!1,e.macOS=!1,e.windows=!0,e.windowsPhone=!0);var i=/Silk/.test(t);return(e.windows||e.macOS||e.linux&&!i||e.chromeOS)&&(e.desktop=!0),(e.windowsPhone||/Windows NT/i.test(t)&&/Touch/i.test(t))&&(e.desktop=!1),navigator.standalone&&(e.webApp=!0),"function"!=typeof importScripts&&(void 0!==window.cordova&&(e.cordova=!0),void 0!==window.ejecta&&(e.ejecta=!0)),"undefined"!=typeof process&&process.versions&&process.versions.node&&(e.node=!0),e.node&&"object"==typeof process.versions&&(e.nodeWebkit=!!process.versions["node-webkit"],e.electron=!!process.versions.electron),/Crosswalk/.test(t)&&(e.crosswalk=!0),e.pixelRatio=window.devicePixelRatio||1,e}()},43267:(t,e,i)=>{var s=i(95540),n={h264:!1,hls:!1,mp4:!1,m4v:!1,ogg:!1,vp9:!1,webm:!1,hasRequestVideoFrame:!1};t.exports=function(){if("function"==typeof importScripts)return n;var t=document.createElement("video"),e=!!t.canPlayType,i=/^no$/;try{e&&(t.canPlayType('video/ogg; codecs="theora"').replace(i,"")&&(n.ogg=!0),t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(i,"")&&(n.h264=!0,n.mp4=!0),t.canPlayType("video/x-m4v").replace(i,"")&&(n.m4v=!0),t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(i,"")&&(n.webm=!0),t.canPlayType('video/webm; codecs="vp9"').replace(i,"")&&(n.vp9=!0),t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(i,"")&&(n.hls=!0))}catch(r){}return t.parentNode&&t.parentNode.removeChild(t),n.getVideoURL=function(t){Array.isArray(t)||(t=[t]);for(var e=0;e{t.exports={os:i(25892),browser:i(84148),features:i(89357),input:i(31784),audio:i(7098),video:i(43267),fullscreen:i(91639),canvasFeatures:i(89289)}},89422:(t,e,i)=>{var s=i(83419),n=new Float32Array(20),r=new s({initialize:function(){this._matrix=new Float32Array(20),this.alpha=1,this._dirty=!0,this._data=new Float32Array(20),this.reset()},set:function(t){return this._matrix.set(t),this._dirty=!0,this},reset:function(){var t=this._matrix;return t.fill(0),t[0]=1,t[6]=1,t[12]=1,t[18]=1,this.alpha=1,this._dirty=!0,this},getData:function(){var t=this._data;return this._dirty&&(t.set(this._matrix),t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,this._dirty=!1),t},brightness:function(t,e){void 0===t&&(t=0),void 0===e&&(e=!1);var i=t;return this.multiply([i,0,0,0,0,0,i,0,0,0,0,0,i,0,0,0,0,0,1,0],e)},saturate:function(t,e){void 0===t&&(t=0),void 0===e&&(e=!1);var i=2*t/3+1,s=-.5*(i-1);return this.multiply([i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0],e)},desaturate:function(t){return void 0===t&&(t=!1),this.saturate(-1,t)},hue:function(t,e){void 0===t&&(t=0),void 0===e&&(e=!1),t=t/180*Math.PI;var i=Math.cos(t),s=Math.sin(t),n=.213,r=.715,o=.072;return this.multiply([n+.787*i+s*-n,r+i*-r+s*-r,o+i*-o+.928*s,0,0,n+i*-n+.143*s,r+i*(1-r)+.14*s,o+i*-o+-.283*s,0,0,n+i*-n+-.787*s,r+i*-r+s*r,o+.928*i+s*o,0,0,0,0,0,1,0],e)},grayscale:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=!1),this.saturate(-t,e)},blackWhite:function(t){return void 0===t&&(t=!1),this.multiply(r.BLACK_WHITE,t)},contrast:function(t,e){void 0===t&&(t=0),void 0===e&&(e=!1);var i=t+1,s=-.5*(i-1);return this.multiply([i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0],e)},negative:function(t){return void 0===t&&(t=!1),this.multiply(r.NEGATIVE,t)},desaturateLuminance:function(t){return void 0===t&&(t=!1),this.multiply(r.DESATURATE_LUMINANCE,t)},sepia:function(t){return void 0===t&&(t=!1),this.multiply(r.SEPIA,t)},night:function(t,e){return void 0===t&&(t=.1),void 0===e&&(e=!1),this.multiply([-2*t,-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0],e)},lsd:function(t){return void 0===t&&(t=!1),this.multiply(r.LSD,t)},brown:function(t){return void 0===t&&(t=!1),this.multiply(r.BROWN,t)},vintagePinhole:function(t){return void 0===t&&(t=!1),this.multiply(r.VINTAGE,t)},kodachrome:function(t){return void 0===t&&(t=!1),this.multiply(r.KODACHROME,t)},technicolor:function(t){return void 0===t&&(t=!1),this.multiply(r.TECHNICOLOR,t)},polaroid:function(t){return void 0===t&&(t=!1),this.multiply(r.POLAROID,t)},shiftToBGR:function(t){return void 0===t&&(t=!1),this.multiply(r.SHIFT_BGR,t)},multiply:function(t,e){void 0===e&&(e=!1),e||this.reset();var i=this._matrix,s=n;return s.set(i),i.set([s[0]*t[0]+s[1]*t[5]+s[2]*t[10]+s[3]*t[15],s[0]*t[1]+s[1]*t[6]+s[2]*t[11]+s[3]*t[16],s[0]*t[2]+s[1]*t[7]+s[2]*t[12]+s[3]*t[17],s[0]*t[3]+s[1]*t[8]+s[2]*t[13]+s[3]*t[18],s[0]*t[4]+s[1]*t[9]+s[2]*t[14]+s[3]*t[19]+s[4],s[5]*t[0]+s[6]*t[5]+s[7]*t[10]+s[8]*t[15],s[5]*t[1]+s[6]*t[6]+s[7]*t[11]+s[8]*t[16],s[5]*t[2]+s[6]*t[7]+s[7]*t[12]+s[8]*t[17],s[5]*t[3]+s[6]*t[8]+s[7]*t[13]+s[8]*t[18],s[5]*t[4]+s[6]*t[9]+s[7]*t[14]+s[8]*t[19]+s[9],s[10]*t[0]+s[11]*t[5]+s[12]*t[10]+s[13]*t[15],s[10]*t[1]+s[11]*t[6]+s[12]*t[11]+s[13]*t[16],s[10]*t[2]+s[11]*t[7]+s[12]*t[12]+s[13]*t[17],s[10]*t[3]+s[11]*t[8]+s[12]*t[13]+s[13]*t[18],s[10]*t[4]+s[11]*t[9]+s[12]*t[14]+s[13]*t[19]+s[14],s[15]*t[0]+s[16]*t[5]+s[17]*t[10]+s[18]*t[15],s[15]*t[1]+s[16]*t[6]+s[17]*t[11]+s[18]*t[16],s[15]*t[2]+s[16]*t[7]+s[17]*t[12]+s[18]*t[17],s[15]*t[3]+s[16]*t[8]+s[17]*t[13]+s[18]*t[18],s[15]*t[4]+s[16]*t[9]+s[17]*t[14]+s[18]*t[19]+s[19]]),this._dirty=!0,this}});r.BLACK_WHITE=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],r.NEGATIVE=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],r.DESATURATE_LUMINANCE=[.2764723,.929708,.0938197,0,-37.1,.2764723,.929708,.0938197,0,-37.1,.2764723,.929708,.0938197,0,-37.1,0,0,0,1,0],r.SEPIA=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],r.LSD=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],r.BROWN=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],r.VINTAGE=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],r.KODACHROME=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],r.TECHNICOLOR=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],r.POLAROID=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],r.SHIFT_BGR=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t.exports=r},51767:(t,e,i)=>{var s=i(83419),n=i(29747),r=new s({initialize:function(t,e,i){this._rgb=[0,0,0],this.onChangeCallback=n,this.dirty=!1,this.set(t,e,i)},set:function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this._rgb=[t,e,i],this.onChange(),this},equals:function(t,e,i){var s=this._rgb;return s[0]===t&&s[1]===e&&s[2]===i},onChange:function(){this.dirty=!0;var t=this._rgb;this.onChangeCallback.call(this,t[0],t[1],t[2])},r:{get:function(){return this._rgb[0]},set:function(t){this._rgb[0]=t,this.onChange()}},g:{get:function(){return this._rgb[1]},set:function(t){this._rgb[1]=t,this.onChange()}},b:{get:function(){return this._rgb[2]},set:function(t){this._rgb[2]=t,this.onChange()}},destroy:function(){this.onChangeCallback=null}});t.exports=r},60461:t=>{t.exports={TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12}},54312:(t,e,i)=>{var s=i(62235),n=i(35893),r=i(86327),o=i(88417);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)+a),t}},46768:(t,e,i)=>{var s=i(62235),n=i(26541),r=i(86327),o=i(385);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)+a),t}},35827:(t,e,i)=>{var s=i(62235),n=i(54380),r=i(86327),o=i(40136);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)+a),t}},46871:(t,e,i)=>{var s=i(66786),n=i(35893),r=i(7702);t.exports=function(t,e,i,o){return void 0===i&&(i=0),void 0===o&&(o=0),s(t,n(e)+i,r(e)+o),t}},5198:(t,e,i)=>{var s=i(7702),n=i(26541),r=i(20786),o=i(385);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)+a),t}},11879:(t,e,i)=>{var s=i(60461),n=[];n[s.BOTTOM_CENTER]=i(54312),n[s.BOTTOM_LEFT]=i(46768),n[s.BOTTOM_RIGHT]=i(35827),n[s.CENTER]=i(46871),n[s.LEFT_CENTER]=i(5198),n[s.RIGHT_CENTER]=i(80503),n[s.TOP_CENTER]=i(89698),n[s.TOP_LEFT]=i(922),n[s.TOP_RIGHT]=i(21373),n[s.LEFT_BOTTOM]=n[s.BOTTOM_LEFT],n[s.LEFT_TOP]=n[s.TOP_LEFT],n[s.RIGHT_BOTTOM]=n[s.BOTTOM_RIGHT],n[s.RIGHT_TOP]=n[s.TOP_RIGHT],t.exports=function(t,e,i,s,r){return n[i](t,e,s,r)}},80503:(t,e,i)=>{var s=i(7702),n=i(54380),r=i(20786),o=i(40136);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)+a),t}},89698:(t,e,i)=>{var s=i(35893),n=i(17717),r=i(88417),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)-a),t}},922:(t,e,i)=>{var s=i(26541),n=i(17717),r=i(385),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)-i),o(t,n(e)-a),t}},21373:(t,e,i)=>{var s=i(54380),n=i(17717),r=i(40136),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)-a),t}},91660:(t,e,i)=>{t.exports={BottomCenter:i(54312),BottomLeft:i(46768),BottomRight:i(35827),Center:i(46871),LeftCenter:i(5198),QuickSet:i(11879),RightCenter:i(80503),TopCenter:i(89698),TopLeft:i(922),TopRight:i(21373)}},71926:(t,e,i)=>{var s=i(60461),n=i(79291),r={In:i(91660),To:i(16694)};r=n(!1,r,s),t.exports=r},21578:(t,e,i)=>{var s=i(62235),n=i(35893),r=i(88417),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)+a),t}},10210:(t,e,i)=>{var s=i(62235),n=i(26541),r=i(385),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)-i),o(t,s(e)+a),t}},82341:(t,e,i)=>{var s=i(62235),n=i(54380),r=i(40136),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)+a),t}},87958:(t,e,i)=>{var s=i(62235),n=i(26541),r=i(86327),o=i(40136);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)+a),t}},40080:(t,e,i)=>{var s=i(7702),n=i(26541),r=i(20786),o=i(40136);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)+a),t}},88466:(t,e,i)=>{var s=i(26541),n=i(17717),r=i(40136),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)-i),o(t,n(e)-a),t}},38829:(t,e,i)=>{var s=i(60461),n=[];n[s.BOTTOM_CENTER]=i(21578),n[s.BOTTOM_LEFT]=i(10210),n[s.BOTTOM_RIGHT]=i(82341),n[s.LEFT_BOTTOM]=i(87958),n[s.LEFT_CENTER]=i(40080),n[s.LEFT_TOP]=i(88466),n[s.RIGHT_BOTTOM]=i(19211),n[s.RIGHT_CENTER]=i(34609),n[s.RIGHT_TOP]=i(48741),n[s.TOP_CENTER]=i(49440),n[s.TOP_LEFT]=i(81288),n[s.TOP_RIGHT]=i(61323),t.exports=function(t,e,i,s,r){return n[i](t,e,s,r)}},19211:(t,e,i)=>{var s=i(62235),n=i(54380),r=i(86327),o=i(385);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)+a),t}},34609:(t,e,i)=>{var s=i(7702),n=i(54380),r=i(20786),o=i(385);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)+a),t}},48741:(t,e,i)=>{var s=i(54380),n=i(17717),r=i(385),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)-a),t}},49440:(t,e,i)=>{var s=i(35893),n=i(17717),r=i(86327),o=i(88417);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)-a),t}},81288:(t,e,i)=>{var s=i(26541),n=i(17717),r=i(86327),o=i(385);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)-i),r(t,n(e)-a),t}},61323:(t,e,i)=>{var s=i(54380),n=i(17717),r=i(86327),o=i(40136);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)-a),t}},16694:(t,e,i)=>{t.exports={BottomCenter:i(21578),BottomLeft:i(10210),BottomRight:i(82341),LeftBottom:i(87958),LeftCenter:i(40080),LeftTop:i(88466),QuickSet:i(38829),RightBottom:i(19211),RightCenter:i(34609),RightTop:i(48741),TopCenter:i(49440),TopLeft:i(81288),TopRight:i(61323)}},66786:(t,e,i)=>{var s=i(88417),n=i(20786);t.exports=function(t,e,i){return s(t,e),n(t,i)}},62235:t=>{t.exports=function(t){return t.y+t.height-t.height*t.originY}},72873:(t,e,i)=>{var s=i(62235),n=i(26541),r=i(54380),o=i(17717),a=i(87841);t.exports=function(t,e){void 0===e&&(e=new a);var i=n(t),h=o(t);return e.x=i,e.y=h,e.width=r(t)-i,e.height=s(t)-h,e}},35893:t=>{t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},7702:t=>{t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},26541:t=>{t.exports=function(t){return t.x-t.width*t.originX}},87431:t=>{t.exports=function(t){return t.width*t.originX}},46928:t=>{t.exports=function(t){return t.height*t.originY}},54380:t=>{t.exports=function(t){return t.x+t.width-t.width*t.originX}},17717:t=>{t.exports=function(t){return t.y-t.height*t.originY}},86327:t=>{t.exports=function(t,e){return t.y=e-t.height+t.height*t.originY,t}},88417:t=>{t.exports=function(t,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},20786:t=>{t.exports=function(t,e){var i=t.height*t.originY;return t.y=e+i-.5*t.height,t}},385:t=>{t.exports=function(t,e){return t.x=e+t.width*t.originX,t}},40136:t=>{t.exports=function(t,e){return t.x=e-t.width+t.width*t.originX,t}},66737:t=>{t.exports=function(t,e){return t.y=e+t.height*t.originY,t}},58724:(t,e,i)=>{t.exports={CenterOn:i(66786),GetBottom:i(62235),GetBounds:i(72873),GetCenterX:i(35893),GetCenterY:i(7702),GetLeft:i(26541),GetOffsetX:i(87431),GetOffsetY:i(46928),GetRight:i(54380),GetTop:i(17717),SetBottom:i(86327),SetCenterX:i(88417),SetCenterY:i(20786),SetLeft:i(385),SetRight:i(40136),SetTop:i(66737)}},20623:t=>{t.exports={setCrisp:function(t){return["optimizeSpeed","-moz-crisp-edges","-o-crisp-edges","-webkit-optimize-contrast","optimize-contrast","crisp-edges","pixelated"].forEach((function(e){t.style["image-rendering"]=e})),t.style.msInterpolationMode="nearest-neighbor",t},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},27919:(t,e,i)=>{var s,n,r,o=i(8054),a=i(68703),h=[],l=!1;t.exports=(r=function(){var t=0;return h.forEach((function(e){e.parent&&t++})),t},{create2D:function(t,e,i){return s(t,e,i,o.CANVAS)},create:s=function(t,e,i,s,r){var u;void 0===e&&(e=1),void 0===i&&(i=1),void 0===s&&(s=o.CANVAS),void 0===r&&(r=!1);var c=n(s);return null===c?(c={parent:t,canvas:document.createElement("canvas"),type:s},s===o.CANVAS&&h.push(c),u=c.canvas):(c.parent=t,u=c.canvas),r&&(c.parent=u),u.width=e,u.height=i,l&&s===o.CANVAS&&a.disable(u.getContext("2d",{willReadFrequently:!1})),u},createWebGL:function(t,e,i){return s(t,e,i,o.WEBGL)},disableSmoothing:function(){l=!0},enableSmoothing:function(){l=!1},first:n=function(t){if(void 0===t&&(t=o.CANVAS),t===o.WEBGL)return null;for(var e=0;e{var e,i="";t.exports={disable:function(t){return""===i&&(i=e(t)),i&&(t[i]=!1),t},enable:function(t){return""===i&&(i=e(t)),i&&(t[i]=!0),t},getPrefix:e=function(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;i{t.exports=function(t,e){return void 0===e&&(e="none"),t.style.msTouchAction=e,t.style["ms-touch-action"]=e,t.style["touch-action"]=e,t}},91610:t=>{t.exports=function(t,e){return void 0===e&&(e="none"),["-webkit-","-khtml-","-moz-","-ms-",""].forEach((function(i){t.style[i+"user-select"]=e})),t.style["-webkit-touch-callout"]=e,t.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",t}},26253:(t,e,i)=>{t.exports={CanvasInterpolation:i(20623),CanvasPool:i(27919),Smoothing:i(68703),TouchAction:i(65208),UserSelect:i(91610)}},40987:(t,e,i)=>{var s=i(83419),n=i(37589),r=i(1e3),o=i(7537),a=i(87837),h=new s({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=255),this.r=0,this.g=0,this.b=0,this.a=255,this._h=0,this._s=0,this._v=0,this._locked=!1,this.gl=[0,0,0,1],this._color=0,this._color32=0,this._rgba="",this.setTo(t,e,i,s)},transparent:function(){return this._locked=!0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this._locked=!1,this.update(!0)},setTo:function(t,e,i,s,n){return void 0===s&&(s=255),void 0===n&&(n=!0),this._locked=!0,this.red=t,this.green=e,this.blue=i,this.alpha=s,this._locked=!1,this.update(n)},setGLTo:function(t,e,i,s){return void 0===s&&(s=1),this._locked=!0,this.redGL=t,this.greenGL=e,this.blueGL=i,this.alphaGL=s,this._locked=!1,this.update(!0)},setFromRGB:function(t){return this._locked=!0,this.red=t.r,this.green=t.g,this.blue=t.b,t.hasOwnProperty("a")&&(this.alpha=t.a),this._locked=!1,this.update(!0)},setFromHSV:function(t,e,i){return o(t,e,i,this)},update:function(t){if(void 0===t&&(t=!1),this._locked)return this;var e=this.r,i=this.g,s=this.b,o=this.a;return this._color=n(e,i,s),this._color32=r(e,i,s,o),this._rgba="rgba("+e+","+i+","+s+","+o/255+")",t&&a(e,i,s,this),this},updateHSV:function(){var t=this.r,e=this.g,i=this.b;return a(t,e,i,this),this},clone:function(){return new h(this.r,this.g,this.b,this.a)},gray:function(t){return this.setTo(t,t,t)},random:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t)),s=Math.floor(t+Math.random()*(e-t)),n=Math.floor(t+Math.random()*(e-t));return this.setTo(i,s,n)},randomGray:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t));return this.setTo(i,i,i)},saturate:function(t){return this.s+=t/100,this},desaturate:function(t){return this.s-=t/100,this},lighten:function(t){return this.v+=t/100,this},darken:function(t){return this.v-=t/100,this},brighten:function(t){var e=this.r,i=this.g,s=this.b;return e=Math.max(0,Math.min(255,e-Math.round(-t/100*255))),i=Math.max(0,Math.min(255,i-Math.round(-t/100*255))),s=Math.max(0,Math.min(255,s-Math.round(-t/100*255))),this.setTo(e,i,s)},color:{get:function(){return this._color}},color32:{get:function(){return this._color32}},rgba:{get:function(){return this._rgba}},redGL:{get:function(){return this.gl[0]},set:function(t){this.gl[0]=Math.min(Math.abs(t),1),this.r=Math.floor(255*this.gl[0]),this.update(!0)}},greenGL:{get:function(){return this.gl[1]},set:function(t){this.gl[1]=Math.min(Math.abs(t),1),this.g=Math.floor(255*this.gl[1]),this.update(!0)}},blueGL:{get:function(){return this.gl[2]},set:function(t){this.gl[2]=Math.min(Math.abs(t),1),this.b=Math.floor(255*this.gl[2]),this.update(!0)}},alphaGL:{get:function(){return this.gl[3]},set:function(t){this.gl[3]=Math.min(Math.abs(t),1),this.a=Math.floor(255*this.gl[3]),this.update()}},red:{get:function(){return this.r},set:function(t){t=Math.floor(Math.abs(t)),this.r=Math.min(t,255),this.gl[0]=t/255,this.update(!0)}},green:{get:function(){return this.g},set:function(t){t=Math.floor(Math.abs(t)),this.g=Math.min(t,255),this.gl[1]=t/255,this.update(!0)}},blue:{get:function(){return this.b},set:function(t){t=Math.floor(Math.abs(t)),this.b=Math.min(t,255),this.gl[2]=t/255,this.update(!0)}},alpha:{get:function(){return this.a},set:function(t){t=Math.floor(Math.abs(t)),this.a=Math.min(t,255),this.gl[3]=t/255,this.update()}},h:{get:function(){return this._h},set:function(t){this._h=t,o(t,this._s,this._v,this)}},s:{get:function(){return this._s},set:function(t){this._s=t,o(this._h,t,this._v,this)}},v:{get:function(){return this._v},set:function(t){this._v=t,o(this._h,this._s,t,this)}}});t.exports=h},92728:(t,e,i)=>{var s=i(37589);t.exports=function(t){void 0===t&&(t=1024);var e,i=[],n=255,r=255,o=0,a=0;for(e=0;e<=n;e++)i.push({r:r,g:e,b:a,color:s(r,e,a)});for(o=255,e=n;e>=0;e--)i.push({r:e,g:o,b:a,color:s(e,o,a)});for(r=0,e=0;e<=n;e++,o--)i.push({r:r,g:o,b:e,color:s(r,o,e)});for(o=0,a=255,e=0;e<=n;e++,a--,r++)i.push({r:r,g:o,b:a,color:s(r,o,a)});if(1024===t)return i;var h=[],l=0,u=1024/t;for(e=0;e{t.exports=function(t){var e={r:t>>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},62957:t=>{t.exports=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e}},37589:t=>{t.exports=function(t,e,i){return t<<16|e<<8|i}},1e3:t=>{t.exports=function(t,e,i,s){return s<<24|t<<16|e<<8|i}},62183:(t,e,i)=>{var s=i(40987),n=i(89528);t.exports=function(t,e,i){var r=i,o=i,a=i;if(0!==e){var h=i<.5?i*(1+e):i+e-i*e,l=2*i-h;r=n(l,h,t+1/3),o=n(l,h,t),a=n(l,h,t-1/3)}return(new s).setGLTo(r,o,a,1)}},27939:(t,e,i)=>{var s=i(7537);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],n=0;n<=359;n++)i.push(s(n/359,t,e));return i}},7537:(t,e,i)=>{var s=i(37589);function n(t,e,i,s){var n=(t+6*e)%6,r=Math.min(n,4-n,1);return Math.round(255*(s-s*i*Math.max(0,r)))}t.exports=function(t,e,i,r){void 0===e&&(e=1),void 0===i&&(i=1);var o=n(5,t,e,i),a=n(3,t,e,i),h=n(1,t,e,i);return r?r.setTo?r.setTo(o,a,h,r.alpha,!0):(r.r=o,r.g=a,r.b=h,r.color=s(o,a,h),r):{r:o,g:a,b:h,color:s(o,a,h)}}},70238:(t,e,i)=>{var s=i(40987);t.exports=function(t){var e=new s;t=t.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,s){return e+e+i+i+s+s}));var i=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);if(i){var n=parseInt(i[1],16),r=parseInt(i[2],16),o=parseInt(i[3],16);e.setTo(n,r,o)}return e}},89528:t=>{t.exports=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}},30100:(t,e,i)=>{var s=i(40987),n=i(90664);t.exports=function(t){var e=n(t);return new s(e.r,e.g,e.b,e.a)}},90664:t=>{t.exports=function(t){return t>16777215?{a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},13699:(t,e,i)=>{var s=i(28915),n=function(t,e,i,n,r,o,a,h){void 0===a&&(a=100),void 0===h&&(h=0);var l=h/a;return{r:s(t,n,l),g:s(e,r,l),b:s(i,o,l)}};t.exports={RGBWithRGB:n,ColorWithRGB:function(t,e,i,s,r,o){return void 0===r&&(r=100),void 0===o&&(o=0),n(t.r,t.g,t.b,e,i,s,r,o)},ColorWithColor:function(t,e,i,s){return void 0===i&&(i=100),void 0===s&&(s=0),n(t.r,t.g,t.b,e.r,e.g,e.b,i,s)}}},68957:(t,e,i)=>{var s=i(40987);t.exports=function(t){return new s(t.r,t.g,t.b,t.a)}},87388:(t,e,i)=>{var s=i(40987);t.exports=function(t){var e=new s,i=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t.toLowerCase());if(i){var n=parseInt(i[1],10),r=parseInt(i[2],10),o=parseInt(i[3],10),a=void 0!==i[4]?parseFloat(i[4]):1;e.setTo(n,r,o,255*a)}return e}},87837:t=>{t.exports=function(t,e,i,s){void 0===s&&(s={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var n=Math.min(t,e,i),r=Math.max(t,e,i),o=r-n,a=0,h=0===r?0:o/r,l=r;return r!==n&&(r===t?a=(e-i)/o+(e{var s=i(62957);t.exports=function(t,e,i,n,r){return void 0===n&&(n=255),void 0===r&&(r="#"),"#"===r?"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1,7):"0x"+s(n)+s(t)+s(e)+s(i)}},85386:(t,e,i)=>{var s=i(30976),n=i(40987);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new n(s(t,e),s(t,e),s(t,e))}},80333:(t,e,i)=>{var s=i(70238),n=i(30100),r=i(68957),o=i(87388);t.exports=function(t){switch(typeof t){case"string":return"rgb"===t.substr(0,3).toLowerCase()?o(t):s(t);case"number":return n(t);case"object":return r(t)}}},3956:(t,e,i)=>{var s=i(40987);s.ColorSpectrum=i(92728),s.ColorToRGBA=i(91588),s.ComponentToHex=i(62957),s.GetColor=i(37589),s.GetColor32=i(1e3),s.HexStringToColor=i(70238),s.HSLToColor=i(62183),s.HSVColorWheel=i(27939),s.HSVToRGB=i(7537),s.HueToComponent=i(89528),s.IntegerToColor=i(30100),s.IntegerToRGB=i(90664),s.Interpolate=i(13699),s.ObjectToColor=i(68957),s.RandomRGB=i(85386),s.RGBStringToColor=i(87388),s.RGBToHSV=i(87837),s.RGBToString=i(75723),s.ValueToColor=i(80333),t.exports=s},27460:(t,e,i)=>{t.exports={Align:i(71926),BaseShader:i(73894),Bounds:i(58724),Canvas:i(26253),Color:i(3956),ColorMatrix:i(89422),Masks:i(69781),RGB:i(51767)}},6858:(t,e,i)=>{var s=i(83419),n=i(39429),r=new s({initialize:function(t,e,i,s,n,r){e||(e=t.sys.make.image({x:i,y:s,key:n,frame:r,add:!1})),this.bitmapMask=e,this.invertAlpha=!1,this.isStencil=!1},setBitmap:function(t){this.bitmapMask=t},preRenderWebGL:function(t,e,i){t.pipelines.BITMAPMASK_PIPELINE.beginMask(this,e,i)},postRenderWebGL:function(t,e,i){t.pipelines.BITMAPMASK_PIPELINE.endMask(this,e,i)},preRenderCanvas:function(){},postRenderCanvas:function(){},destroy:function(){this.bitmapMask=null}});n.register("bitmapMask",(function(t,e,i,s,n){return new r(this.scene,t,e,i,s,n)})),t.exports=r},80661:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e){this.geometryMask=e,this.invertAlpha=!1,this.isStencil=!0,this.level=0},setShape:function(t){return this.geometryMask=t,this},setInvertAlpha:function(t){return void 0===t&&(t=!0),this.invertAlpha=t,this},preRenderWebGL:function(t,e,i){var s=t.gl;t.flush(),0===t.maskStack.length&&(s.enable(s.STENCIL_TEST),s.clear(s.STENCIL_BUFFER_BIT),t.maskCount=0),t.currentCameraMask.mask!==this&&(t.currentMask.mask=this),t.maskStack.push({mask:this,camera:i}),this.applyStencil(t,i,!0),t.maskCount++},applyStencil:function(t,e,i){var s=t.gl,n=this.geometryMask,r=t.maskCount,o=255;s.colorMask(!1,!1,!1,!1),i?(s.stencilFunc(s.EQUAL,r,o),s.stencilOp(s.KEEP,s.KEEP,s.INCR),r++):(s.stencilFunc(s.EQUAL,r+1,o),s.stencilOp(s.KEEP,s.KEEP,s.DECR)),this.level=r,n.renderWebGL(t,n,e),t.flush(),s.colorMask(!0,!0,!0,!0),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),this.invertAlpha?s.stencilFunc(s.NOTEQUAL,r,o):s.stencilFunc(s.EQUAL,r,o)},postRenderWebGL:function(t){var e=t.gl;t.maskStack.pop(),t.maskCount--,t.flush();var i=t.currentMask;if(0===t.maskStack.length)i.mask=null,e.disable(e.STENCIL_TEST);else{var s=t.maskStack[t.maskStack.length-1];s.mask.applyStencil(t,s.camera,!1),t.currentCameraMask.mask!==s.mask?(i.mask=s.mask,i.camera=s.camera):i.mask=null}},preRenderCanvas:function(t,e,i){var s=this.geometryMask;t.currentContext.save(),s.renderCanvas(t,s,i,null,null,!0),t.currentContext.clip()},postRenderCanvas:function(t){t.currentContext.restore()},destroy:function(){this.geometryMask=null}});t.exports=s},69781:(t,e,i)=>{t.exports={BitmapMask:i(6858),GeometryMask:i(80661)}},73894:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s){e&&""!==e||(e=["precision mediump float;","uniform vec2 resolution;","varying vec2 fragCoord;","void main () {"," vec2 uv = fragCoord / resolution.xy;"," gl_FragColor = vec4(uv.xyx, 1.0);","}"].join("\n")),i&&""!==i||(i=["precision mediump float;","uniform mat4 uProjectionMatrix;","uniform mat4 uViewMatrix;","uniform vec2 uResolution;","attribute vec2 inPosition;","varying vec2 fragCoord;","varying vec2 outTexCoord;","void main () {"," gl_Position = uProjectionMatrix * uViewMatrix * vec4(inPosition, 1.0, 1.0);"," fragCoord = vec2(inPosition.x, uResolution.y - inPosition.y);"," outTexCoord = vec2(inPosition.x / uResolution.x, fragCoord.y / uResolution.y);","}"].join("\n")),void 0===s&&(s=null),this.key=t,this.fragmentSrc=e,this.vertexSrc=i,this.uniforms=s}});t.exports=s},40366:t=>{t.exports=function(t,e){var i;if(e)"string"==typeof e?i=document.getElementById(e):"object"==typeof e&&1===e.nodeType&&(i=e);else if(t.parentElement||null===e)return t;return i||(i=document.body),i.appendChild(t),t}},83719:(t,e,i)=>{var s=i(40366);t.exports=function(t){var e=t.config;if(e.parent&&e.domCreateContainer){var i=document.createElement("div");i.style.cssText=["display: block;","width: "+t.scale.width+"px;","height: "+t.scale.height+"px;","padding: 0; margin: 0;","position: absolute;","overflow: hidden;","pointer-events: "+e.domPointerEvents+";","transform: scale(1);","transform-origin: left top;"].join(" "),t.domContainer=i,s(i,e.parent)}}},57264:(t,e,i)=>{var s=i(25892);t.exports=function(t){if("complete"!==document.readyState&&"interactive"!==document.readyState){var e=function(){document.removeEventListener("deviceready",e,!0),document.removeEventListener("DOMContentLoaded",e,!0),window.removeEventListener("load",e,!0),t()};document.body?s.cordova?document.addEventListener("deviceready",e,!1):(document.addEventListener("DOMContentLoaded",e,!0),window.addEventListener("load",e,!0)):window.setTimeout(e,20)}else t()}},57811:t=>{t.exports=function(t){if(!t)return window.innerHeight;var e=Math.abs(window.orientation),i={w:0,h:0},s=document.createElement("div");return s.setAttribute("style","position: fixed; height: 100vh; width: 0; top: 0"),document.documentElement.appendChild(s),i.w=90===e?s.offsetHeight:window.innerWidth,i.h=90===e?window.innerWidth:s.offsetHeight,document.documentElement.removeChild(s),s=null,90!==Math.abs(window.orientation)?i.h:i.w}},45818:(t,e,i)=>{var s=i(13560);t.exports=function(t,e){var i=window.screen,n=!!i&&(i.orientation||i.mozOrientation||i.msOrientation);return n&&"string"==typeof n.type?n.type:"string"==typeof n?n:"number"==typeof window.orientation?0===window.orientation||180===window.orientation?s.ORIENTATION.PORTRAIT:s.ORIENTATION.LANDSCAPE:window.matchMedia?window.matchMedia("(orientation: portrait)").matches?s.ORIENTATION.PORTRAIT:window.matchMedia("(orientation: landscape)").matches?s.ORIENTATION.LANDSCAPE:void 0:e>t?s.ORIENTATION.PORTRAIT:s.ORIENTATION.LANDSCAPE}},74403:t=>{t.exports=function(t){var e;return""!==t&&("string"==typeof t?e=document.getElementById(t):t&&1===t.nodeType&&(e=t)),e||(e=document.body),e}},56836:t=>{t.exports=function(t){var e="";try{window.DOMParser?e=(new DOMParser).parseFromString(t,"text/xml"):(e=new ActiveXObject("Microsoft.XMLDOM")).loadXML(t)}catch(i){e=null}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length?e:null}},35846:t=>{t.exports=function(t){t.parentNode&&t.parentNode.removeChild(t)}},43092:(t,e,i)=>{var s=i(83419),n=i(29747),r=new s({initialize:function(){this.isRunning=!1,this.callback=n,this.isSetTimeOut=!1,this.timeOutID=null,this.delay=0;var t=this;this.step=function e(i){t.callback(i),t.isRunning&&(t.timeOutID=window.requestAnimationFrame(e))},this.stepTimeout=function e(){t.isRunning&&(t.timeOutID=window.setTimeout(e,t.delay)),t.callback(window.performance.now())}},start:function(t,e,i){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.delay=i,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=n}});t.exports=r},84902:(t,e,i)=>{var s={AddToDOM:i(40366),DOMContentLoaded:i(57264),GetInnerHeight:i(57811),GetScreenOrientation:i(45818),GetTarget:i(74403),ParseXML:i(56836),RemoveFromDOM:i(35846),RequestAnimationFrame:i(43092)};t.exports=s},47565:(t,e,i)=>{var s=i(83419),n=i(50792),r=i(37277),o=new s({Extends:n,initialize:function(){n.call(this)},shutdown:function(){this.removeAllListeners()},destroy:function(){this.removeAllListeners()}});r.register("EventEmitter",o,"events"),t.exports=o},93055:(t,e,i)=>{t.exports={EventEmitter:i(47565)}},20122:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e){void 0===e&&(e=1),n.call(this,r.BARREL,t),this.amount=e}});t.exports=o},32251:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h){void 0===i&&(i=1),void 0===s&&(s=1),void 0===o&&(o=1),void 0===a&&(a=1),void 0===h&&(h=4),n.call(this,r.BLOOM,t),this.steps=h,this.offsetX=i,this.offsetY=s,this.blurStrength=o,this.strength=a,this.glcolor=[1,1,1],null!=e&&(this.color=e)},color:{get:function(){var t=this.glcolor;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}}});t.exports=o},9047:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h){void 0===e&&(e=0),void 0===i&&(i=2),void 0===s&&(s=2),void 0===o&&(o=1),void 0===h&&(h=4),n.call(this,r.BLUR,t),this.quality=e,this.x=i,this.y=s,this.steps=h,this.strength=o,this.glcolor=[1,1,1],null!=a&&(this.color=a)},color:{get:function(){var t=this.glcolor;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}}});t.exports=o},27885:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h,l){void 0===e&&(e=.5),void 0===i&&(i=1),void 0===s&&(s=.2),void 0===o&&(o=!1),void 0===a&&(a=1),void 0===h&&(h=1),void 0===l&&(l=1),n.call(this,r.BOKEH,t),this.radius=e,this.amount=i,this.contrast=s,this.isTiltShift=o,this.strength=l,this.blurX=a,this.blurY=h}});t.exports=o},12578:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a){void 0===e&&(e=8),void 0===o&&(o=1),void 0===a&&(a=.005),n.call(this,r.CIRCLE,t),this.scale=o,this.feather=a,this.thickness=e,this.glcolor=[1,.2,.7],this.glcolor2=[1,0,0,.4],null!=i&&(this.color=i),null!=s&&(this.backgroundColor=s)},color:{get:function(){var t=this.glcolor;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}},backgroundColor:{get:function(){var t=this.glcolor2;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor2;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}},backgroundAlpha:{get:function(){return this.glcolor2[3]},set:function(t){this.glcolor2[3]=t}}});t.exports=o},15802:(t,e,i)=>{var s=i(83419),n=i(89422),r=i(14811),o=new s({Extends:n,initialize:function(t){n.call(this),this.type=r.COLOR_MATRIX,this.gameObject=t,this.active=!0},destroy:function(){this.gameObject=null,this._matrix=null,this._data=null}});t.exports=o},72898:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e){this.type=t,this.gameObject=e,this.active=!0},setActive:function(t){return this.active=t,this},destroy:function(){this.gameObject=null,this.active=!1}});t.exports=s},44553:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s){void 0===e&&(e="__WHITE"),void 0===i&&(i=.005),void 0===s&&(s=.005),n.call(this,r.DISPLACEMENT,t),this.x=i,this.y=s,this.glTexture,this.setTexture(e)},setTexture:function(t){var e=this.gameObject.scene.sys.textures.getFrame(t);return e&&(this.glTexture=e.glTexture),this}});t.exports=o},68531:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o){void 0===i&&(i=4),void 0===s&&(s=0),void 0===o&&(o=!1),n.call(this,r.GLOW,t),this.outerStrength=i,this.innerStrength=s,this.knockout=o,this.glcolor=[1,1,1,1],void 0!==e&&(this.color=e)},color:{get:function(){var t=this.glcolor;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}}});t.exports=o},37102:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h,l,u){void 0===s&&(s=.2),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===u&&(u=0),n.call(this,r.GRADIENT,t),this.alpha=s,this.size=u,this.fromX=o,this.fromY=a,this.toX=h,this.toY=l,this.glcolor1=[255,0,0],this.glcolor2=[0,255,0],null!=e&&(this.color1=e),null!=i&&(this.color2=i)},color1:{get:function(){var t=this.glcolor1;return(t[0]<<16)+(t[1]<<8)+(0|t[2])},set:function(t){var e=this.glcolor1;e[0]=t>>16&255,e[1]=t>>8&255,e[2]=255&t}},color2:{get:function(){var t=this.glcolor2;return(t[0]<<16)+(t[1]<<8)+(0|t[2])},set:function(t){var e=this.glcolor2;e[0]=t>>16&255,e[1]=t>>8&255,e[2]=255&t}}});t.exports=o},86886:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e){void 0===e&&(e=1),n.call(this,r.PIXELATE,t),this.amount=e}});t.exports=o},92322:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h,l){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=.1),void 0===o&&(o=1),void 0===h&&(h=6),void 0===l&&(l=1),n.call(this,r.SHADOW,t),this.x=e,this.y=i,this.decay=s,this.power=o,this.glcolor=[0,0,0,1],this.samples=h,this.intensity=l,void 0!==a&&(this.color=a)},color:{get:function(){var t=this.glcolor;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}}});t.exports=o},39563:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o){void 0===e&&(e=.5),void 0===i&&(i=.5),void 0===s&&(s=3),void 0===o&&(o=!1),n.call(this,r.SHINE,t),this.speed=e,this.lineWidth=i,this.gradient=s,this.reveal=o}});t.exports=o},56448:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o){void 0===e&&(e=.5),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===o&&(o=.5),n.call(this,r.VIGNETTE,t),this.x=e,this.y=i,this.radius=s,this.strength=o}});t.exports=o},38433:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o){void 0===e&&(e=.1),void 0===i&&(i=0),void 0===s&&(s=0),void 0===o&&(o=!1),n.call(this,r.WIPE,t),this.progress=0,this.wipeWidth=e,this.direction=i,this.axis=s,this.reveal=o}});t.exports=o},14811:t=>{t.exports={GLOW:4,SHADOW:5,PIXELATE:6,VIGNETTE:7,SHINE:8,BLUR:9,GRADIENT:12,BLOOM:13,COLOR_MATRIX:14,CIRCLE:15,BARREL:16,DISPLACEMENT:17,WIPE:18,BOKEH:19}},66064:(t,e,i)=>{var s=i(79291),n=i(14811),r={Barrel:i(20122),Controller:i(72898),Bloom:i(32251),Blur:i(9047),Bokeh:i(27885),Circle:i(12578),ColorMatrix:i(15802),Displacement:i(44553),Glow:i(68531),Gradient:i(37102),Pixelate:i(86886),Shadow:i(92322),Shine:i(39563),Vignette:i(56448),Wipe:i(38433)};r=s(!1,r,n),t.exports=r},25305:(t,e,i)=>{var s=i(10312),n=i(23568);t.exports=function(t,e,i){e.x=n(i,"x",0),e.y=n(i,"y",0),e.depth=n(i,"depth",0),e.flipX=n(i,"flipX",!1),e.flipY=n(i,"flipY",!1);var r=n(i,"scale",null);"number"==typeof r?e.setScale(r):null!==r&&(e.scaleX=n(r,"x",1),e.scaleY=n(r,"y",1));var o=n(i,"scrollFactor",null);"number"==typeof o?e.setScrollFactor(o):null!==o&&(e.scrollFactorX=n(o,"x",1),e.scrollFactorY=n(o,"y",1)),e.rotation=n(i,"rotation",0);var a=n(i,"angle",null);null!==a&&(e.angle=a),e.alpha=n(i,"alpha",1);var h=n(i,"origin",null);if("number"==typeof h)e.setOrigin(h);else if(null!==h){var l=n(h,"x",.5),u=n(h,"y",.5);e.setOrigin(l,u)}return e.blendMode=n(i,"blendMode",s.NORMAL),e.visible=n(i,"visible",!0),n(i,"add",!0)&&t.sys.displayList.add(e),e.preUpdate&&t.sys.updateList.add(e),e}},13059:(t,e,i)=>{var s=i(23568);t.exports=function(t,e){var i=s(e,"anims",null);if(null===i)return t;if("string"==typeof i)t.anims.play(i);else if("object"==typeof i){var n=t.anims,r=s(i,"key",void 0);if(r){var o=s(i,"startFrame",void 0),a=s(i,"delay",0),h=s(i,"repeat",0),l=s(i,"repeatDelay",0),u=s(i,"yoyo",!1),c=s(i,"play",!1),d=s(i,"delayedPlay",0),f={key:r,delay:a,repeat:h,repeatDelay:l,yoyo:u,startFrame:o};c?n.play(f):d>0?n.playAfterDelay(f,d):n.load(f)}}return t}},8050:(t,e,i)=>{var s=i(83419),n=i(73162),r=i(37277),o=i(51708),a=i(44594),h=i(19186),l=new s({Extends:n,initialize:function(t){n.call(this,t),this.sortChildrenFlag=!1,this.scene=t,this.systems=t.sys,this.events=t.sys.events,this.addCallback=this.addChildCallback,this.removeCallback=this.removeChildCallback,this.events.once(a.BOOT,this.boot,this),this.events.on(a.START,this.start,this)},boot:function(){this.events.once(a.DESTROY,this.destroy,this)},addChildCallback:function(t){t.displayList&&t.displayList!==this&&t.removeFromDisplayList(),t.parentContainer&&t.parentContainer.remove(t),t.displayList||(this.queueDepthSort(),t.displayList=this,t.emit(o.ADDED_TO_SCENE,t,this.scene),this.events.emit(a.ADDED_TO_SCENE,t,this.scene))},removeChildCallback:function(t){this.queueDepthSort(),t.displayList=null,t.emit(o.REMOVED_FROM_SCENE,t,this.scene),this.events.emit(a.REMOVED_FROM_SCENE,t,this.scene)},start:function(){this.events.once(a.SHUTDOWN,this.shutdown,this)},queueDepthSort:function(){this.sortChildrenFlag=!0},depthSort:function(){this.sortChildrenFlag&&(h(this.list,this.sortByDepth),this.sortChildrenFlag=!1)},sortByDepth:function(t,e){return t._depth-e._depth},getChildren:function(){return this.list},shutdown:function(){for(var t=this.list;t.length;)t[0].destroy(!0);this.events.off(a.SHUTDOWN,this.shutdown,this)},destroy:function(){this.shutdown(),this.events.off(a.START,this.start,this),this.scene=null,this.systems=null,this.events=null}});r.register("DisplayList",l,"displayList"),t.exports=l},95643:(t,e,i)=>{var s=i(83419),n=i(53774),r=i(45893),o=i(50792),a=i(51708),h=i(44594),l=new s({Extends:o,initialize:function(t,e){o.call(this),this.scene=t,this.displayList=null,this.type=e,this.state=0,this.parentContainer=null,this.name="",this.active=!0,this.tabIndex=-1,this.data=null,this.renderFlags=15,this.cameraFilter=0,this.input=null,this.body=null,this.ignoreDestroy=!1,this.on(a.ADDED_TO_SCENE,this.addedToScene,this),this.on(a.REMOVED_FROM_SCENE,this.removedFromScene,this),t.sys.queueDepthSort()},setActive:function(t){return this.active=t,this},setName:function(t){return this.name=t,this},setState:function(t){return this.state=t,this},setDataEnabled:function(){return this.data||(this.data=new r(this)),this},setData:function(t,e){return this.data||(this.data=new r(this)),this.data.set(t,e),this},incData:function(t,e){return this.data||(this.data=new r(this)),this.data.inc(t,e),this},toggleData:function(t){return this.data||(this.data=new r(this)),this.data.toggle(t),this},getData:function(t){return this.data||(this.data=new r(this)),this.data.get(t)},setInteractive:function(t,e,i){return this.scene.sys.input.enable(this,t,e,i),this},disableInteractive:function(){return this.scene.sys.input.disable(this),this},removeInteractive:function(){return this.scene.sys.input.clear(this),this.input=void 0,this},addedToScene:function(){},removedFromScene:function(){},update:function(){},toJSON:function(){return n(this)},willRender:function(t){return!(this.displayList&&this.displayList.active&&!this.displayList.willRender(t)||l.RENDER_MASK!==this.renderFlags||0!==this.cameraFilter&&this.cameraFilter&t.id)},getIndexList:function(){for(var t=this,e=this.parentContainer,i=[];e&&(i.unshift(e.getIndex(t)),t=e,e.parentContainer);)e=e.parentContainer;return this.displayList?i.unshift(this.displayList.getIndex(t)):i.unshift(this.scene.sys.displayList.getIndex(t)),i},addToDisplayList:function(t){return void 0===t&&(t=this.scene.sys.displayList),this.displayList&&this.displayList!==t&&this.removeFromDisplayList(),t.exists(this)||(this.displayList=t,t.add(this,!0),t.queueDepthSort(),this.emit(a.ADDED_TO_SCENE,this,this.scene),t.events.emit(h.ADDED_TO_SCENE,this,this.scene)),this},addToUpdateList:function(){return this.scene&&this.preUpdate&&this.scene.sys.updateList.add(this),this},removeFromDisplayList:function(){var t=this.displayList||this.scene.sys.displayList;return t&&t.exists(this)&&(t.remove(this,!0),t.queueDepthSort(),this.displayList=null,this.emit(a.REMOVED_FROM_SCENE,this,this.scene),t.events.emit(h.REMOVED_FROM_SCENE,this,this.scene)),this},removeFromUpdateList:function(){return this.scene&&this.preUpdate&&this.scene.sys.updateList.remove(this),this},destroy:function(t){this.scene&&!this.ignoreDestroy&&(void 0===t&&(t=!1),this.preDestroy&&this.preDestroy.call(this),this.emit(a.DESTROY,this,t),this.removeAllListeners(),this.postPipelines&&this.resetPostPipeline(!0),this.removeFromDisplayList(),this.removeFromUpdateList(),this.input&&(this.scene.sys.input.clear(this),this.input=void 0),this.data&&(this.data.destroy(),this.data=void 0),this.body&&(this.body.destroy(),this.body=void 0),this.preFX&&(this.preFX.destroy(),this.preFX=void 0),this.postFX&&(this.postFX.destroy(),this.postFX=void 0),this.active=!1,this.visible=!1,this.scene=void 0,this.parentContainer=void 0)}});l.RENDER_MASK=15,t.exports=l},44603:(t,e,i)=>{var s=i(83419),n=i(37277),r=i(44594),o=new s({initialize:function(t){this.scene=t,this.systems=t.sys,this.events=t.sys.events,this.displayList,this.updateList,this.events.once(r.BOOT,this.boot,this),this.events.on(r.START,this.start,this)},boot:function(){this.displayList=this.systems.displayList,this.updateList=this.systems.updateList,this.events.once(r.DESTROY,this.destroy,this)},start:function(){this.events.once(r.SHUTDOWN,this.shutdown,this)},shutdown:function(){this.events.off(r.SHUTDOWN,this.shutdown,this)},destroy:function(){this.shutdown(),this.events.off(r.START,this.start,this),this.scene=null,this.systems=null,this.events=null,this.displayList=null,this.updateList=null}});o.register=function(t,e){o.prototype.hasOwnProperty(t)||(o.prototype[t]=e)},o.remove=function(t){o.prototype.hasOwnProperty(t)&&delete o.prototype[t]},n.register("GameObjectCreator",o,"make"),t.exports=o},39429:(t,e,i)=>{var s=i(83419),n=i(37277),r=i(44594),o=new s({initialize:function(t){this.scene=t,this.systems=t.sys,this.events=t.sys.events,this.displayList,this.updateList,this.events.once(r.BOOT,this.boot,this),this.events.on(r.START,this.start,this)},boot:function(){this.displayList=this.systems.displayList,this.updateList=this.systems.updateList,this.events.once(r.DESTROY,this.destroy,this)},start:function(){this.events.once(r.SHUTDOWN,this.shutdown,this)},existing:function(t){return(t.renderCanvas||t.renderWebGL)&&this.displayList.add(t),t.preUpdate&&this.updateList.add(t),t},shutdown:function(){this.events.off(r.SHUTDOWN,this.shutdown,this)},destroy:function(){this.shutdown(),this.events.off(r.START,this.start,this),this.scene=null,this.systems=null,this.events=null,this.displayList=null,this.updateList=null}});o.register=function(t,e){o.prototype.hasOwnProperty(t)||(o.prototype[t]=e)},o.remove=function(t){o.prototype.hasOwnProperty(t)&&delete o.prototype[t]},n.register("GameObjectFactory",o,"add"),t.exports=o},91296:(t,e,i)=>{var s=i(61340),n=new s,r=new s,o=new s,a={camera:n,sprite:r,calc:o};t.exports=function(t,e,i){var s=n,h=r,l=o;return h.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),s.copyFrom(e.matrix),i?(s.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),h.e=t.x,h.f=t.y):(h.e-=e.scrollX*t.scrollFactorX,h.f-=e.scrollY*t.scrollFactorY),s.multiply(h,l),a}},45027:(t,e,i)=>{var s=i(83419),n=i(25774),r=i(37277),o=i(44594),a=new s({Extends:n,initialize:function(t){n.call(this),this.checkQueue=!0,this.scene=t,this.systems=t.sys,t.sys.events.once(o.BOOT,this.boot,this),t.sys.events.on(o.START,this.start,this)},boot:function(){this.systems.events.once(o.DESTROY,this.destroy,this)},start:function(){var t=this.systems.events;t.on(o.PRE_UPDATE,this.update,this),t.on(o.UPDATE,this.sceneUpdate,this),t.once(o.SHUTDOWN,this.shutdown,this)},sceneUpdate:function(t,e){for(var i=this._active,s=i.length,n=0;n{t.exports=function(t,e,i,s,n,r,o,a,h,l,u,c,d,f,p){var v=i.x-e.displayOriginX+n,g=i.y-e.displayOriginY+r,m=v+i.w,y=g+i.h,x=o.getXRound(v,g,a),T=o.getYRound(v,g,a),w=o.getXRound(v,y,a),b=o.getYRound(v,y,a),S=o.getXRound(m,y,a),E=o.getYRound(m,y,a),A=o.getXRound(m,g,a),C=o.getYRound(m,g,a);t.batchQuad(e,x,T,w,b,S,E,A,C,s.u0,s.v0,s.u1,s.v1,h,l,u,c,d,f,p)}},53048:t=>{t.exports=function(t,e,i,s){if(void 0===i&&(i=!1),void 0===s)return{local:{x:0,y:0,width:0,height:0},global:{x:0,y:0,width:0,height:0},lines:{shortest:0,longest:0,lengths:null,height:0},wrappedText:"",words:[],characters:[],scaleX:0,scaleY:0};var n,r,o,a=t.text,h=a.length,l=t.maxWidth,u=t.wordWrapCharCode,c=Number.MAX_VALUE,d=Number.MAX_VALUE,f=0,p=0,v=t.fontData.chars,g=t.fontData.lineHeight,m=t.letterSpacing,y=t.lineSpacing,x=0,T=0,w=0,b=null,S=t._align,E=0,A=0,C=t.fontSize/t.fontData.size,_=C*t.scaleX,M=C*t.scaleY,P=null,R=0,L=[],O=Number.MAX_VALUE,F=0,D=0,k=0,I=[],B=[],N=null;if(l>0){for(n=0;nl||W-Y>l?(z.push(G.i-1),G.cr?(z.push(G.i+G.word.length),Y=0,X=null):X=G):G.cr&&(z.push(G.i+G.word.length),Y=0,X=null)}for(n=z.length-1;n>=0;n--)r=a,o=z[n],a=r.substr(0,o)+"\n"+r.substr(o+1);s.wrappedText=a,h=a.length,I=[],N=null}var H=0;for(n=0;nE&&(c=E),d>A&&(d=A);var q=E+b.xAdvance,K=A+g;fF&&(F=k),kF&&(F=k),k0)for(var J=0;J{var s=i(21859);t.exports=function(t,e,i,n,r,o,a){var h=t.sys.textures.get(i),l=h.get(n),u=t.sys.cache.xml.get(r);if(l&&u){var c=s(u,l,o,a,h);return t.sys.cache.bitmapFont.add(e,{data:c,texture:i,frame:n,fromAtlas:!0}),!0}return!1}},6925:(t,e,i)=>{var s=i(35154);t.exports=function(t,e){var i=e.width,n=e.height,r=Math.floor(i/2),o=Math.floor(n/2),a=s(e,"chars","");if(""!==a){var h=s(e,"image",""),l=t.sys.textures.getFrame(h),u=l.cutX,c=l.cutY,d=l.source.width,f=l.source.height,p=s(e,"offset.x",0),v=s(e,"offset.y",0),g=s(e,"spacing.x",0),m=s(e,"spacing.y",0),y=s(e,"lineSpacing",0),x=s(e,"charsPerRow",null);null===x&&(x=d/i)>a.length&&(x=a.length);for(var T=p,w=v,b={retroFont:!0,font:h,size:i,lineHeight:n+y,chars:{}},S=0,E=0;E{function e(t,e){return parseInt(t.getAttribute(e),10)}t.exports=function(t,i,s,n,r){void 0===s&&(s=0),void 0===n&&(n=0);var o=i.cutX,a=i.cutY,h=i.source.width,l=i.source.height,u=i.sourceIndex,c={},d=t.getElementsByTagName("info")[0],f=t.getElementsByTagName("common")[0];c.font=d.getAttribute("face"),c.size=e(d,"size"),c.lineHeight=e(f,"lineHeight")+n,c.chars={};var p=t.getElementsByTagName("char"),v=void 0!==i&&i.trimmed;if(v)var g=i.height,m=i.width;for(var y=0;y{var s=i(87662),n=i(79291),r={Parse:i(6925)};r=n(!1,r,s),t.exports=r},87662:t=>{t.exports={TEXT_SET1:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},2638:(t,e,i)=>{var s=i(22186),n=i(83419),r=i(12310),o=new n({Extends:s,Mixins:[r],initialize:function(t,e,i,n,r,o,a){s.call(this,t,e,i,n,r,o,a),this.type="DynamicBitmapText",this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback,this.callbackData={parent:this,color:0,tint:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},index:0,charCode:0,x:0,y:0,scale:0,rotation:0,data:0}},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this}});t.exports=o},86741:(t,e,i)=>{var s=i(20926);t.exports=function(t,e,i,n){var r=e._text,o=r.length,a=t.currentContext;if(0!==o&&s(t,a,e,i,n)){i.addToRenderList(e);var h=e.fromAtlas?e.frame:e.texture.frames.__BASE,l=e.displayCallback,u=e.callbackData,c=e.fontData.chars,d=e.fontData.lineHeight,f=e._letterSpacing,p=0,v=0,g=0,m=null,y=0,x=0,T=0,w=0,b=0,S=0,E=null,A=0,C=e.frame.source.image,_=h.cutX,M=h.cutY,P=0,R=0,L=e._fontSize/e.fontData.size,O=e._align,F=0,D=0;e.getTextBounds(!1);var k=e._bounds.lines;1===O?D=(k.longest-k.lengths[0])/2:2===O&&(D=k.longest-k.lengths[0]),a.translate(-e.displayOriginX,-e.displayOriginY);var I=i.roundPixels;e.cropWidth>0&&e.cropHeight>0&&(a.beginPath(),a.rect(0,0,e.cropWidth,e.cropHeight),a.clip());for(var B=0;B{var s=i(2638),n=i(25305),r=i(44603),o=i(23568);r.register("dynamicBitmapText",(function(t,e){void 0===t&&(t={});var i=o(t,"font",""),r=o(t,"text",""),a=o(t,"size",!1),h=new s(this.scene,0,0,i,r,a);return void 0!==e&&(t.add=e),n(this.scene,h,t),h}))},72566:(t,e,i)=>{var s=i(2638);i(39429).register("dynamicBitmapText",(function(t,e,i,n,r){return this.displayList.add(new s(this.scene,t,e,i,n,r))}))},12310:(t,e,i)=>{var s,n;i(29747),s=i(73482),n=i(86741),t.exports={renderWebGL:s,renderCanvas:n}},73482:(t,e,i)=>{var s=i(91296),n=i(61340),r=i(70554),o=new n;t.exports=function(t,e,i,n){var a=e.text,h=a.length;if(0!==h){i.addToRenderList(e);var l=t.pipelines.set(e.pipeline,e),u=s(e,i,n);t.pipelines.preBatch(e);var c=u.sprite,d=u.calc,f=o,p=e.cropWidth>0||e.cropHeight>0;p&&(l.flush(),t.pushScissor(d.tx,d.ty,e.cropWidth*d.scaleX,e.cropHeight*d.scaleY));var v,g,m=e.frame.glTexture,y=e.tintFill,x=r.getTintAppendFloatAlpha(e.tintTopLeft,i.alpha*e._alphaTL),T=r.getTintAppendFloatAlpha(e.tintTopRight,i.alpha*e._alphaTR),w=r.getTintAppendFloatAlpha(e.tintBottomLeft,i.alpha*e._alphaBL),b=r.getTintAppendFloatAlpha(e.tintBottomRight,i.alpha*e._alphaBR),S=l.setGameObject(e),E=0,A=0,C=0,_=0,M=e.letterSpacing,P=0,R=0,L=e.scrollX,O=e.scrollY,F=e.fontData,D=F.chars,k=F.lineHeight,I=e.fontSize/F.size,B=0,N=e._align,U=0,X=0,Y=e.getTextBounds(!1);e.maxWidth>0&&(h=(a=Y.wrappedText).length);var z=e._bounds.lines;1===N?X=(z.longest-z.lengths[0])/2:2===N&&(X=z.longest-z.lengths[0]);for(var G=i.roundPixels,V=e.displayCallback,W=e.callbackData,H=0;H{var s=i(83419),n=i(45319),r=i(31401),o=i(95643),a=i(53048),h=i(61327),l=i(21859),u=i(87841),c=i(18658),d=new s({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.Depth,r.GetBounds,r.Mask,r.Origin,r.Pipeline,r.PostPipeline,r.ScrollFactor,r.Texture,r.Tint,r.Transform,r.Visible,c],initialize:function(t,e,i,s,n,r,h){void 0===n&&(n=""),void 0===h&&(h=0),o.call(this,t,"BitmapText"),this.font=s;var l=this.scene.sys.cache.bitmapFont.get(s);l||console.warn("Invalid BitmapText key: "+s),this.fontData=l.data,this._text="",this._fontSize=r||this.fontData.size,this._letterSpacing=0,this._lineSpacing=0,this._align=h,this._bounds=a(),this._dirty=!0,this._maxWidth=0,this.wordWrapCharCode=32,this.charColors=[],this.dropShadowX=0,this.dropShadowY=0,this.dropShadowColor=0,this.dropShadowAlpha=.5,this.fromAtlas=l.fromAtlas,this.setTexture(l.texture,l.frame),this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline(),this.initPostPipeline(),this.setText(n)},setLeftAlign:function(){return this._align=d.ALIGN_LEFT,this._dirty=!0,this},setCenterAlign:function(){return this._align=d.ALIGN_CENTER,this._dirty=!0,this},setRightAlign:function(){return this._align=d.ALIGN_RIGHT,this._dirty=!0,this},setFontSize:function(t){return this._fontSize=t,this._dirty=!0,this},setLetterSpacing:function(t){return void 0===t&&(t=0),this._letterSpacing=t,this._dirty=!0,this},setLineSpacing:function(t){return void 0===t&&(t=0),this.lineSpacing=t,this},setText:function(t){return t||0===t||(t=""),Array.isArray(t)&&(t=t.join("\n")),t!==this.text&&(this._text=t.toString(),this._dirty=!0,this.updateDisplayOrigin()),this},setDropShadow:function(t,e,i,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=.5),this.dropShadowX=t,this.dropShadowY=e,this.dropShadowColor=i,this.dropShadowAlpha=s,this},setCharacterTint:function(t,e,i,s,r,o,a){void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=!1),void 0===s&&(s=-1),void 0===r&&(r=s,o=s,a=s);var h=this.text.length;-1===e&&(e=h),t<0&&(t=h+t),t=n(t,0,h-1);for(var l=n(t+e,t,h),u=this.charColors,c=t;c{var s=i(20926);t.exports=function(t,e,i,n){var r=e._text,o=r.length,a=t.currentContext;if(0!==o&&s(t,a,e,i,n)){i.addToRenderList(e);var h=e.fromAtlas?e.frame:e.texture.frames.__BASE,l=e.fontData.chars,u=e.fontData.lineHeight,c=e._letterSpacing,d=e._lineSpacing,f=0,p=0,v=0,g=null,m=0,y=0,x=0,T=0,w=0,b=0,S=null,E=0,A=h.source.image,C=h.cutX,_=h.cutY,M=e._fontSize/e.fontData.size,P=e._align,R=0,L=0,O=e.getTextBounds(!1);e.maxWidth>0&&(o=(r=O.wrappedText).length);var F=e._bounds.lines;1===P?L=(F.longest-F.lengths[0])/2:2===P&&(L=F.longest-F.lengths[0]),a.translate(-e.displayOriginX,-e.displayOriginY);for(var D=i.roundPixels,k=0;k{var s=i(22186),n=i(25305),r=i(44603),o=i(23568),a=i(35154);r.register("bitmapText",(function(t,e){void 0===t&&(t={});var i=a(t,"font",""),r=o(t,"text",""),h=o(t,"size",!1),l=a(t,"align",0),u=new s(this.scene,0,0,i,r,h,l);return void 0!==e&&(t.add=e),n(this.scene,u,t),u}))},34914:(t,e,i)=>{var s=i(22186);i(39429).register("bitmapText",(function(t,e,i,n,r,o){return this.displayList.add(new s(this.scene,t,e,i,n,r,o))}))},18658:(t,e,i)=>{var s,n;i(29747),s=i(33590),n=i(37289),t.exports={renderWebGL:s,renderCanvas:n}},33590:(t,e,i)=>{var s=i(3217),n=i(91296),r=i(70554);t.exports=function(t,e,i,o){if(0!==e._text.length){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline,e),h=n(e,i,o).calc;t.pipelines.preBatch(e);var l,u,c,d=i.roundPixels,f=i.alpha,p=e.charColors,v=e.tintFill,g=r.getTintAppendFloatAlpha,m=g(e.tintTopLeft,f*e._alphaTL),y=g(e.tintTopRight,f*e._alphaTR),x=g(e.tintBottomLeft,f*e._alphaBL),T=g(e.tintBottomRight,f*e._alphaBR),w=e.frame.glTexture,b=a.setGameObject(e),S=e.getTextBounds(!1).characters,E=e.dropShadowX,A=e.dropShadowY;if(0!==E||0!==A){var C=e.dropShadowColor,_=e.dropShadowAlpha,M=g(C,f*_*e._alphaTL),P=g(C,f*_*e._alphaTR),R=g(C,f*_*e._alphaBL),L=g(C,f*_*e._alphaBR);for(l=0;l{var s=i(48011),n=i(46590),r=i(83419),o=i(31401),a=i(4327),h=i(95643),l=i(73162),u=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Mask,o.Pipeline,o.PostPipeline,o.ScrollFactor,o.Size,o.Texture,o.Transform,o.Visible,s],initialize:function(t,e,i,s,n){h.call(this,t,"Blitter"),this.setTexture(s,n),this.setPosition(e,i),this.initPipeline(),this.initPostPipeline(),this.children=new l,this.renderList=[],this.dirty=!1},create:function(t,e,i,s,r){void 0===s&&(s=!0),void 0===r&&(r=this.children.length),void 0===i?i=this.frame:i instanceof a||(i=this.texture.get(i));var o=new n(this,t,e,i,s);return this.children.addAt(o,r,!1),this.dirty=!0,o},createFromCallback:function(t,e,i,s){for(var n=this.createMultiple(e,i,s),r=0;r0},getRenderList:function(){return this.dirty&&(this.renderList=this.children.list.filter(this.childCanRender,this),this.dirty=!1),this.renderList},clear:function(){this.children.removeAll(),this.dirty=!0},preDestroy:function(){this.children.destroy(),this.renderList=[]}});t.exports=u},72396:t=>{t.exports=function(t,e,i,s){var n=e.getRenderList();if(0!==n.length){var r=t.currentContext,o=i.alpha*e.alpha;if(0!==o){i.addToRenderList(e),r.globalCompositeOperation=t.blendModes[e.blendMode],r.imageSmoothingEnabled=!e.frame.source.scaleMode;var a=e.x-i.scrollX*e.scrollFactorX,h=e.y-i.scrollY*e.scrollFactorY;r.save(),s&&s.copyToContext(r);for(var l=i.roundPixels,u=0;u0&&p.height>0&&(r.save(),r.translate(c.x+a,c.y+h),r.scale(m,y),r.drawImage(f.source.image,p.x,p.y,p.width,p.height,v,g,p.width,p.height),r.restore())):(l&&(v=Math.round(v),g=Math.round(g)),p.width>0&&p.height>0&&r.drawImage(f.source.image,p.x,p.y,p.width,p.height,v+c.x+a,g+c.y+h,p.width,p.height)))}r.restore()}}}},9403:(t,e,i)=>{var s=i(6107),n=i(25305),r=i(44603),o=i(23568);r.register("blitter",(function(t,e){void 0===t&&(t={});var i=o(t,"key",null),r=o(t,"frame",null),a=new s(this.scene,0,0,i,r);return void 0!==e&&(t.add=e),n(this.scene,a,t),a}))},12709:(t,e,i)=>{var s=i(6107);i(39429).register("blitter",(function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))}))},48011:(t,e,i)=>{var s,n;i(29747),s=i(99485),n=i(72396),t.exports={renderWebGL:s,renderCanvas:n}},99485:(t,e,i)=>{var s=i(61340),n=i(70554),r=new s;t.exports=function(t,e,i,s){var o=e.getRenderList(),a=i.alpha*e.alpha;if(0!==o.length&&0!==a){i.addToRenderList(e);var h=t.pipelines.set(this.pipeline,e),l=i.scrollX*e.scrollFactorX,u=i.scrollY*e.scrollFactorY,c=r.copyFrom(i.matrix);s&&(c.multiplyWithOffset(s,-l,-u),l=0,u=0);var d=e.x-l,f=e.y-u,p=-1;t.pipelines.preBatch(e);for(var v=0;v{var s=i(83419),n=i(4327),r=new s({initialize:function(t,e,i,s,n){this.parent=t,this.x=e,this.y=i,this.frame=s,this.data={},this.tint=16777215,this._visible=n,this._alpha=1,this.flipX=!1,this.flipY=!1,this.hasTransformComponent=!0},setFrame:function(t){return void 0===t?this.frame=this.parent.frame:t instanceof n&&t.texture===this.parent.texture?this.frame=t:this.frame=this.parent.texture.get(t),this},resetFlip:function(){return this.flipX=!1,this.flipY=!1,this},reset:function(t,e,i){return this.x=t,this.y=e,this.flipX=!1,this.flipY=!1,this._alpha=1,this._visible=!0,this.parent.dirty=!0,i&&this.setFrame(i),this},setPosition:function(t,e){return this.x=t,this.y=e,this},setFlipX:function(t){return this.flipX=t,this},setFlipY:function(t){return this.flipY=t,this},setFlip:function(t,e){return this.flipX=t,this.flipY=e,this},setVisible:function(t){return this.visible=t,this},setAlpha:function(t){return this.alpha=t,this},setTint:function(t){return this.tint=t,this},destroy:function(){this.parent.dirty=!0,this.parent.children.remove(this),this.parent=void 0,this.frame=void 0,this.data=void 0},visible:{get:function(){return this._visible},set:function(t){this.parent.dirty|=this._visible!==t,this._visible=t}},alpha:{get:function(){return this._alpha},set:function(t){this.parent.dirty|=this._alpha>0!=t>0,this._alpha=t}}});t.exports=r},16005:(t,e,i)=>{var s=i(45319),n={_alpha:1,_alphaTL:1,_alphaTR:1,_alphaBL:1,_alphaBR:1,clearAlpha:function(){return this.setAlpha(1)},setAlpha:function(t,e,i,n){return void 0===t&&(t=1),void 0===e?this.alpha=t:(this._alphaTL=s(t,0,1),this._alphaTR=s(e,0,1),this._alphaBL=s(i,0,1),this._alphaBR=s(n,0,1)),this},alpha:{get:function(){return this._alpha},set:function(t){var e=s(t,0,1);this._alpha=e,this._alphaTL=e,this._alphaTR=e,this._alphaBL=e,this._alphaBR=e,0===e?this.renderFlags&=-3:this.renderFlags|=2}},alphaTopLeft:{get:function(){return this._alphaTL},set:function(t){var e=s(t,0,1);this._alphaTL=e,0!==e&&(this.renderFlags|=2)}},alphaTopRight:{get:function(){return this._alphaTR},set:function(t){var e=s(t,0,1);this._alphaTR=e,0!==e&&(this.renderFlags|=2)}},alphaBottomLeft:{get:function(){return this._alphaBL},set:function(t){var e=s(t,0,1);this._alphaBL=e,0!==e&&(this.renderFlags|=2)}},alphaBottomRight:{get:function(){return this._alphaBR},set:function(t){var e=s(t,0,1);this._alphaBR=e,0!==e&&(this.renderFlags|=2)}}};t.exports=n},88509:(t,e,i)=>{var s=i(45319),n={_alpha:1,clearAlpha:function(){return this.setAlpha(1)},setAlpha:function(t){return void 0===t&&(t=1),this.alpha=t,this},alpha:{get:function(){return this._alpha},set:function(t){var e=s(t,0,1);this._alpha=e,0===e?this.renderFlags&=-3:this.renderFlags|=2}}};t.exports=n},90065:(t,e,i)=>{var s=i(10312),n={_blendMode:s.NORMAL,blendMode:{get:function(){return this._blendMode},set:function(t){"string"==typeof t&&(t=s[t]),(t|=0)>=-1&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=n},94215:t=>{t.exports={width:0,height:0,displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}}},61683:t=>{t.exports={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,s){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,s,this.flipX,this.flipY);else{var n=t;this.frame.setCropUVs(this._crop,n.x,n.y,n.width,n.height,this.flipX,this.flipY)}this.isCropped=!0}return this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}}},89272:t=>{t.exports={_depth:0,depth:{get:function(){return this._depth},set:function(t){this.displayList&&this.displayList.queueDepthSort(),this._depth=t}},setDepth:function(t){return void 0===t&&(t=0),this.depth=t,this}}},47059:(t,e,i)=>{var s=i(83419),n=i(66064),r=i(19133),o=new s({initialize:function(t,e){this.gameObject=t,this.isPost=e,this.enabled=!1,this.list=[],this.padding=0},setPadding:function(t){return void 0===t&&(t=0),this.padding=t,this.gameObject},onFXCopy:function(){},onFX:function(){},enable:function(t){if(!this.isPost){var e=this.gameObject.scene.sys.renderer;e&&e.pipelines?(this.gameObject.pipeline=e.pipelines.FX_PIPELINE,void 0!==t&&(this.padding=t),this.enabled=!0):this.enabled=!1}},clear:function(){if(this.isPost)this.gameObject.resetPostPipeline(!0);else{for(var t=this.list,e=0;e{t.exports={flipX:!1,flipY:!1,toggleFlipX:function(){return this.flipX=!this.flipX,this},toggleFlipY:function(){return this.flipY=!this.flipY,this},setFlipX:function(t){return this.flipX=t,this},setFlipY:function(t){return this.flipY=t,this},setFlip:function(t,e){return this.flipX=t,this.flipY=e,this},resetFlip:function(){return this.flipX=!1,this.flipY=!1,this}}},8004:(t,e,i)=>{var s=i(87841),n=i(11520),r=i(26099),o={prepareBoundsOutput:function(t,e){return void 0===e&&(e=!1),0!==this.rotation&&n(t,this.x,this.y,this.rotation),e&&this.parentContainer&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t),t},getCenter:function(t,e){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth/2,t.y=this.y-this.displayHeight*this.originY+this.displayHeight/2,this.prepareBoundsOutput(t,e)},getTopLeft:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY,this.prepareBoundsOutput(t,e)},getTopCenter:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth/2,t.y=this.y-this.displayHeight*this.originY,this.prepareBoundsOutput(t,e)},getTopRight:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY,this.prepareBoundsOutput(t,e)},getLeftCenter:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY+this.displayHeight/2,this.prepareBoundsOutput(t,e)},getRightCenter:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY+this.displayHeight/2,this.prepareBoundsOutput(t,e)},getBottomLeft:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,this.prepareBoundsOutput(t,e)},getBottomCenter:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth/2,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,this.prepareBoundsOutput(t,e)},getBottomRight:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,this.prepareBoundsOutput(t,e)},getBounds:function(t){var e,i,n,r,o,a,h,l;if(void 0===t&&(t=new s),this.parentContainer){var u=this.parentContainer.getBoundsTransformMatrix();this.getTopLeft(t),u.transformPoint(t.x,t.y,t),e=t.x,i=t.y,this.getTopRight(t),u.transformPoint(t.x,t.y,t),n=t.x,r=t.y,this.getBottomLeft(t),u.transformPoint(t.x,t.y,t),o=t.x,a=t.y,this.getBottomRight(t),u.transformPoint(t.x,t.y,t),h=t.x,l=t.y}else this.getTopLeft(t),e=t.x,i=t.y,this.getTopRight(t),n=t.x,r=t.y,this.getBottomLeft(t),o=t.x,a=t.y,this.getBottomRight(t),h=t.x,l=t.y;return t.x=Math.min(e,n,o,h),t.y=Math.min(i,r,a,l),t.width=Math.max(e,n,o,h)-t.x,t.height=Math.max(i,r,a,l)-t.y,t}};t.exports=o},8573:(t,e,i)=>{var s=i(6858),n=i(80661),r={mask:null,setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},createBitmapMask:function(t,e,i,n,r){return void 0===t&&(this.texture||this.shader||this.geom)&&(t=this),new s(this.scene,t,e,i,n,r)},createGeometryMask:function(t){return void 0!==t||"Graphics"!==this.type&&!this.geom||(t=this),new n(this.scene,t)}};t.exports=r},27387:t=>{t.exports={_originComponent:!0,originX:.5,originY:.5,_displayOriginX:0,_displayOriginY:0,displayOriginX:{get:function(){return this._displayOriginX},set:function(t){this._displayOriginX=t,this.originX=t/this.width}},displayOriginY:{get:function(){return this._displayOriginY},set:function(t){this._displayOriginY=t,this.originY=t/this.height}},setOrigin:function(t,e){return void 0===t&&(t=.5),void 0===e&&(e=t),this.originX=t,this.originY=e,this.updateDisplayOrigin()},setOriginFromFrame:function(){return this.frame&&this.frame.customPivot?(this.originX=this.frame.pivotX,this.originY=this.frame.pivotY,this.updateDisplayOrigin()):this.setOrigin()},setDisplayOrigin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.displayOriginX=t,this.displayOriginY=e,this},updateDisplayOrigin:function(){return this._displayOriginX=this.originX*this.width,this._displayOriginY=this.originY*this.height,this}}},37640:(t,e,i)=>{var s=i(39506),n=i(57355),r=i(35154),o=i(86353),a=i(26099),h={path:null,rotateToPath:!1,pathRotationOffset:0,pathOffset:null,pathVector:null,pathDelta:null,pathTween:null,pathConfig:null,_prevDirection:o.PLAYING_FORWARD,setPath:function(t,e){void 0===e&&(e=this.pathConfig);var i=this.pathTween;return i&&i.isPlaying()&&i.stop(),this.path=t,e&&this.startFollow(e),this},setRotateToPath:function(t,e){return void 0===e&&(e=0),this.rotateToPath=t,this.pathRotationOffset=e,this},isFollowing:function(){var t=this.pathTween;return t&&t.isPlaying()},startFollow:function(t,e){void 0===t&&(t={}),void 0===e&&(e=0);var i=this.pathTween;i&&i.isPlaying()&&i.stop(),"number"==typeof t&&(t={duration:t}),t.from=r(t,"from",0),t.to=r(t,"to",1);var h=n(t,"positionOnPath",!1);this.rotateToPath=n(t,"rotateToPath",!1),this.pathRotationOffset=r(t,"rotationOffset",0);var l=r(t,"startAt",e);if(l&&(t.onStart=function(t){var e=t.data[0];e.progress=l,e.elapsed=e.duration*l;var i=e.ease(e.progress);e.current=e.start+(e.end-e.start)*i,e.setTargetValue()}),this.pathOffset||(this.pathOffset=new a(this.x,this.y)),this.pathVector||(this.pathVector=new a),this.pathDelta||(this.pathDelta=new a),this.pathDelta.reset(),t.persist=!0,this.pathTween=this.scene.sys.tweens.addCounter(t),this.path.getStartPoint(this.pathOffset),h&&(this.x=this.pathOffset.x,this.y=this.pathOffset.y),this.pathOffset.x=this.x-this.pathOffset.x,this.pathOffset.y=this.y-this.pathOffset.y,this._prevDirection=o.PLAYING_FORWARD,this.rotateToPath){var u=this.path.getPoint(.1);this.rotation=Math.atan2(u.y-this.y,u.x-this.x)+s(this.pathRotationOffset)}return this.pathConfig=t,this},pauseFollow:function(){var t=this.pathTween;return t&&t.isPlaying()&&t.pause(),this},resumeFollow:function(){var t=this.pathTween;return t&&t.isPaused()&&t.resume(),this},stopFollow:function(){var t=this.pathTween;return t&&t.isPlaying()&&t.stop(),this},pathUpdate:function(){var t=this.pathTween;if(t&&t.data){var e=t.data[0],i=this.pathDelta,n=this.pathVector;if(i.copy(n).negate(),e.state===o.COMPLETE)return this.path.getPoint(e.end,n),i.add(n),n.add(this.pathOffset),void this.setPosition(n.x,n.y);if(e.state!==o.PLAYING_FORWARD&&e.state!==o.PLAYING_BACKWARD)return;this.path.getPoint(t.getValue(),n),i.add(n),n.add(this.pathOffset);var r=this.x,a=this.y;this.setPosition(n.x,n.y);var h=this.x-r,l=this.y-a;if(0===h&&0===l)return;if(e.state!==this._prevDirection)return void(this._prevDirection=e.state);this.rotateToPath&&(this.rotation=Math.atan2(l,h)+s(this.pathRotationOffset))}}};t.exports=h},72699:(t,e,i)=>{var s=i(62644),n={defaultPipeline:null,pipeline:null,pipelineData:null,initPipeline:function(t){this.pipelineData={};var e=this.scene.sys.renderer;if(!e)return!1;var i=e.pipelines;if(i){void 0===t&&(t=i.default);var s=i.get(t);if(s)return this.defaultPipeline=s,this.pipeline=s,!0}return!1},setPipeline:function(t,e,i){var n=this.scene.sys.renderer;if(!n)return this;var r=n.pipelines;if(r){var o=r.get(t);o&&(this.pipeline=o),e&&(this.pipelineData=i?s(e):e)}return this},setPipelineData:function(t,e){var i=this.pipelineData;return void 0===e?delete i[t]:i[t]=e,this},resetPipeline:function(t){return void 0===t&&(t=!1),this.pipeline=this.defaultPipeline,t&&(this.pipelineData={}),null!==this.pipeline},getPipelineName:function(){return this.pipeline.name}};t.exports=n},17581:(t,e,i)=>{var s=i(62644),n=i(47059),r=i(19133),o={hasPostPipeline:!1,postPipelines:null,postPipelineData:null,preFX:null,postFX:null,initPostPipeline:function(t){this.postPipelines=[],this.postPipelineData={},this.postFX=new n(this,!0),t&&(this.preFX=new n(this,!1))},setPostPipeline:function(t,e,i){var n=this.scene.sys.renderer;if(!n)return this;var r=n.pipelines;if(r){Array.isArray(t)||(t=[t]);for(var o=0;o0,this},setPostPipelineData:function(t,e){var i=this.postPipelineData;return void 0===e?delete i[t]:i[t]=e,this},getPostPipeline:function(t){for(var e="string"==typeof t,i=this.postPipelines,s=[],n=0;n=0;s--){var n=i[s];(e&&n.name===t||!e&&n===t)&&(n.destroy(),r(i,s))}return this.hasPostPipeline=this.postPipelines.length>0,this},clearFX:function(){return this.preFX&&this.preFX.clear(),this.postFX&&this.postFX.clear(),this}};t.exports=o},80227:t=>{t.exports={scrollFactorX:1,scrollFactorY:1,setScrollFactor:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}}},16736:t=>{var e={_sizeComponent:!0,width:0,height:0,displayWidth:{get:function(){return Math.abs(this.scaleX*this.frame.realWidth)},set:function(t){this.scaleX=t/this.frame.realWidth}},displayHeight:{get:function(){return Math.abs(this.scaleY*this.frame.realHeight)},set:function(t){this.scaleY=t/this.frame.realHeight}},setSizeToFrame:function(t){t||(t=this.frame),this.width=t.realWidth,this.height=t.realHeight;var e=this.input;return e&&!e.customHitArea&&(e.hitArea.width=this.width,e.hitArea.height=this.height),this},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}};t.exports=e},37726:(t,e,i)=>{var s=i(4327),n={texture:null,frame:null,isCropped:!1,setTexture:function(t,e,i,s){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e,i,s)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),t instanceof s?(this.texture=this.scene.sys.textures.get(t.texture.key),this.frame=t):this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this}};t.exports=n},79812:(t,e,i)=>{var s=i(4327),n={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,s){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,s,this.flipX,this.flipY);else{var n=t;this.frame.setCropUVs(this._crop,n.x,n.y,n.width,n.height,this.flipX,this.flipY)}this.isCropped=!0}return this},setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),t instanceof s?(this.texture=this.scene.sys.textures.get(t.texture.key),this.frame=t):this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this.isCropped&&this.frame.updateCropUVs(this._crop,this.flipX,this.flipY),this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=n},27472:t=>{t.exports={tintTopLeft:16777215,tintTopRight:16777215,tintBottomLeft:16777215,tintBottomRight:16777215,tintFill:!1,clearTint:function(){return this.setTint(16777215),this},setTint:function(t,e,i,s){return void 0===t&&(t=16777215),void 0===e&&(e=t,i=t,s=t),this.tintTopLeft=t,this.tintTopRight=e,this.tintBottomLeft=i,this.tintBottomRight=s,this.tintFill=!1,this},setTintFill:function(t,e,i,s){return this.setTint(t,e,i,s),this.tintFill=!0,this},tint:{get:function(){return this.tintTopLeft},set:function(t){this.setTint(t,t,t,t)}},isTinted:{get:function(){var t=16777215;return this.tintFill||this.tintTopLeft!==t||this.tintTopRight!==t||this.tintBottomLeft!==t||this.tintBottomRight!==t}}}},53774:t=>{t.exports=function(t){var e={name:t.name,type:t.type,x:t.x,y:t.y,depth:t.depth,scale:{x:t.scaleX,y:t.scaleY},origin:{x:t.originX,y:t.originY},flipX:t.flipX,flipY:t.flipY,rotation:t.rotation,alpha:t.alpha,visible:t.visible,blendMode:t.blendMode,textureKey:"",frameKey:"",data:{}};return t.texture&&(e.textureKey=t.texture.key,e.frameKey=t.frame.name),e}},16901:(t,e,i)=>{var s=i(36383),n=i(61340),r=i(85955),o=i(86554),a=i(30954),h=i(26099),l={hasTransformComponent:!0,_scaleX:1,_scaleY:1,_rotation:0,x:0,y:0,z:0,w:0,scale:{get:function(){return(this._scaleX+this._scaleY)/2},set:function(t){this._scaleX=t,this._scaleY=t,0===t?this.renderFlags&=-5:this.renderFlags|=4}},scaleX:{get:function(){return this._scaleX},set:function(t){this._scaleX=t,0===t?this.renderFlags&=-5:0!==this._scaleY&&(this.renderFlags|=4)}},scaleY:{get:function(){return this._scaleY},set:function(t){this._scaleY=t,0===t?this.renderFlags&=-5:0!==this._scaleX&&(this.renderFlags|=4)}},angle:{get:function(){return a(this._rotation*s.RAD_TO_DEG)},set:function(t){this.rotation=a(t)*s.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=o(t)}},setPosition:function(t,e,i,s){return void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),this.x=t,this.y=e,this.z=i,this.w=s,this},copyPosition:function(t){return void 0!==t.x&&(this.x=t.x),void 0!==t.y&&(this.y=t.y),void 0!==t.z&&(this.z=t.z),void 0!==t.w&&(this.w=t.w),this},setRandomPosition:function(t,e,i,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.scale.width),void 0===s&&(s=this.scene.sys.scale.height),this.x=t+Math.random()*i,this.y=e+Math.random()*s,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setAngle:function(t){return void 0===t&&(t=0),this.angle=t,this},setScale:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this},setX:function(t){return void 0===t&&(t=0),this.x=t,this},setY:function(t){return void 0===t&&(t=0),this.y=t,this},setZ:function(t){return void 0===t&&(t=0),this.z=t,this},setW:function(t){return void 0===t&&(t=0),this.w=t,this},getLocalTransformMatrix:function(t){return void 0===t&&(t=new n),t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY)},getWorldTransformMatrix:function(t,e){void 0===t&&(t=new n);var i=this.parentContainer;if(!i)return this.getLocalTransformMatrix(t);for(e||(e=new n),t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY);i;)e.applyITRS(i.x,i.y,i._rotation,i._scaleX,i._scaleY),e.multiply(t,t),i=i.parentContainer;return t},getLocalPoint:function(t,e,i,s){i||(i=new h),s||(s=this.scene.sys.cameras.main);var n=s.scrollX,o=s.scrollY,a=t+n*this.scrollFactorX-n,l=e+o*this.scrollFactorY-o;return this.parentContainer?this.getWorldTransformMatrix().applyInverse(a,l,i):r(a,l,this.x,this.y,this.rotation,this.scaleX,this.scaleY,i),this._originComponent&&(i.x+=this._displayOriginX,i.y+=this._displayOriginY),i},getParentRotation:function(){for(var t=0,e=this.parentContainer;e;)t+=e.rotation,e=e.parentContainer;return t}};t.exports=l},61340:(t,e,i)=>{var s=i(83419),n=i(36383),r=i(26099),o=new s({initialize:function(t,e,i,s,n,r){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===n&&(n=0),void 0===r&&(r=0),this.matrix=new Float32Array([t,e,i,s,n,r,0,0,1]),this.decomposedMatrix={translateX:0,translateY:0,scaleX:1,scaleY:1,rotation:0},this.quad=new Float32Array(8)},a:{get:function(){return this.matrix[0]},set:function(t){this.matrix[0]=t}},b:{get:function(){return this.matrix[1]},set:function(t){this.matrix[1]=t}},c:{get:function(){return this.matrix[2]},set:function(t){this.matrix[2]=t}},d:{get:function(){return this.matrix[3]},set:function(t){this.matrix[3]=t}},e:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},f:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},tx:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},ty:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},rotation:{get:function(){return Math.acos(this.a/this.scaleX)*(Math.atan(-this.c/this.a)<0?-1:1)}},rotationNormalized:{get:function(){var t=this.matrix,e=t[0],i=t[1],s=t[2],r=t[3];return e||i?i>0?Math.acos(e/this.scaleX):-Math.acos(e/this.scaleX):s||r?n.TAU-(r>0?Math.acos(-s/this.scaleY):-Math.acos(s/this.scaleY)):0}},scaleX:{get:function(){return Math.sqrt(this.a*this.a+this.b*this.b)}},scaleY:{get:function(){return Math.sqrt(this.c*this.c+this.d*this.d)}},loadIdentity:function(){var t=this.matrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,this},translate:function(t,e){var i=this.matrix;return i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this},scale:function(t,e){var i=this.matrix;return i[0]*=t,i[1]*=t,i[2]*=e,i[3]*=e,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),s=this.matrix,n=s[0],r=s[1],o=s[2],a=s[3];return s[0]=n*i+o*e,s[1]=r*i+a*e,s[2]=n*-e+o*i,s[3]=r*-e+a*i,this},multiply:function(t,e){var i=this.matrix,s=t.matrix,n=i[0],r=i[1],o=i[2],a=i[3],h=i[4],l=i[5],u=s[0],c=s[1],d=s[2],f=s[3],p=s[4],v=s[5],g=void 0===e?i:e.matrix;return g[0]=u*n+c*o,g[1]=u*r+c*a,g[2]=d*n+f*o,g[3]=d*r+f*a,g[4]=p*n+v*o+h,g[5]=p*r+v*a+l,g},multiplyWithOffset:function(t,e,i){var s=this.matrix,n=t.matrix,r=s[0],o=s[1],a=s[2],h=s[3],l=e*r+i*a+s[4],u=e*o+i*h+s[5],c=n[0],d=n[1],f=n[2],p=n[3],v=n[4],g=n[5];return s[0]=c*r+d*a,s[1]=c*o+d*h,s[2]=f*r+p*a,s[3]=f*o+p*h,s[4]=v*r+g*a+l,s[5]=v*o+g*h+u,this},transform:function(t,e,i,s,n,r){var o=this.matrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return o[0]=t*a+e*l,o[1]=t*h+e*u,o[2]=i*a+s*l,o[3]=i*h+s*u,o[4]=n*a+r*l+c,o[5]=n*h+r*u+d,this},transformPoint:function(t,e,i){void 0===i&&(i={x:0,y:0});var s=this.matrix,n=s[0],r=s[1],o=s[2],a=s[3],h=s[4],l=s[5];return i.x=t*n+e*o+h,i.y=t*r+e*a+l,i},invert:function(){var t=this.matrix,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=e*n-i*s;return t[0]=n/a,t[1]=-i/a,t[2]=-s/a,t[3]=e/a,t[4]=(s*o-n*r)/a,t[5]=-(e*o-i*r)/a,this},copyFrom:function(t){var e=this.matrix;return e[0]=t.a,e[1]=t.b,e[2]=t.c,e[3]=t.d,e[4]=t.e,e[5]=t.f,this},copyFromArray:function(t){var e=this.matrix;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],this},copyToContext:function(t){var e=this.matrix;return t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t},setToContext:function(t){return t.setTransform(this),t},copyToArray:function(t){var e=this.matrix;return void 0===t?t=[e[0],e[1],e[2],e[3],e[4],e[5]]:(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5]),t},setTransform:function(t,e,i,s,n,r){var o=this.matrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=s,o[4]=n,o[5]=r,this},decomposeMatrix:function(){var t=this.decomposedMatrix,e=this.matrix,i=e[0],s=e[1],n=e[2],r=e[3],o=i*r-s*n;if(t.translateX=e[4],t.translateY=e[5],i||s){var a=Math.sqrt(i*i+s*s);t.rotation=s>0?Math.acos(i/a):-Math.acos(i/a),t.scaleX=a,t.scaleY=o/a}else if(n||r){var h=Math.sqrt(n*n+r*r);t.rotation=.5*Math.PI-(r>0?Math.acos(-n/h):-Math.acos(n/h)),t.scaleX=o/h,t.scaleY=h}else t.rotation=0,t.scaleX=0,t.scaleY=0;return t},applyITRS:function(t,e,i,s,n){var r=this.matrix,o=Math.sin(i),a=Math.cos(i);return r[4]=t,r[5]=e,r[0]=a*s,r[1]=o*s,r[2]=-o*n,r[3]=a*n,this},applyInverse:function(t,e,i){void 0===i&&(i=new r);var s=this.matrix,n=s[0],o=s[1],a=s[2],h=s[3],l=s[4],u=s[5],c=1/(n*h+a*-o);return i.x=h*c*t+-a*c*e+(u*a-l*h)*c,i.y=n*c*e+-o*c*t+(-u*n+l*o)*c,i},setQuad:function(t,e,i,s,n,r){void 0===n&&(n=!1),void 0===r&&(r=this.quad);var o=this.matrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return n?(r[0]=Math.round(t*a+e*l+c),r[1]=Math.round(t*h+e*u+d),r[2]=Math.round(t*a+s*l+c),r[3]=Math.round(t*h+s*u+d),r[4]=Math.round(i*a+s*l+c),r[5]=Math.round(i*h+s*u+d),r[6]=Math.round(i*a+e*l+c),r[7]=Math.round(i*h+e*u+d)):(r[0]=t*a+e*l+c,r[1]=t*h+e*u+d,r[2]=t*a+s*l+c,r[3]=t*h+s*u+d,r[4]=i*a+s*l+c,r[5]=i*h+s*u+d,r[6]=i*a+e*l+c,r[7]=i*h+e*u+d),r},getX:function(t,e){return t*this.a+e*this.c+this.e},getY:function(t,e){return t*this.b+e*this.d+this.f},getXRound:function(t,e,i){var s=this.getX(t,e);return i&&(s=Math.round(s)),s},getYRound:function(t,e,i){var s=this.getY(t,e);return i&&(s=Math.round(s)),s},getCSSMatrix:function(){var t=this.matrix;return"matrix("+t[0]+","+t[1]+","+t[2]+","+t[3]+","+t[4]+","+t[5]+")"},destroy:function(){this.matrix=null,this.quad=null,this.decomposedMatrix=null}});t.exports=o},59715:t=>{t.exports={_visible:!0,visible:{get:function(){return this._visible},set:function(t){t?(this._visible=!0,this.renderFlags|=1):(this._visible=!1,this.renderFlags&=-2)}},setVisible:function(t){return this.visible=t,this}}},31401:(t,e,i)=>{t.exports={Alpha:i(16005),AlphaSingle:i(88509),BlendMode:i(90065),ComputedSize:i(94215),Crop:i(61683),Depth:i(89272),Flip:i(54434),FX:i(47059),GetBounds:i(8004),Mask:i(8573),Origin:i(27387),PathFollower:i(37640),Pipeline:i(72699),PostPipeline:i(17581),ScrollFactor:i(80227),Size:i(16736),Texture:i(37726),TextureCrop:i(79812),Tint:i(27472),ToJSON:i(53774),Transform:i(16901),TransformMatrix:i(61340),Visible:i(59715)}},31559:(t,e,i)=>{var s=i(37105),n=i(10312),r=i(83419),o=i(31401),a=i(51708),h=i(95643),l=i(87841),u=i(29959),c=i(36899),d=i(26099),f=new r({Extends:h,Mixins:[o.AlphaSingle,o.BlendMode,o.ComputedSize,o.Depth,o.Mask,o.PostPipeline,o.Transform,o.Visible,u],initialize:function(t,e,i,s){h.call(this,t,"Container"),this.list=[],this.exclusive=!0,this.maxSize=-1,this.position=0,this.localTransform=new o.TransformMatrix,this.tempTransformMatrix=new o.TransformMatrix,this._sortKey="",this._sysEvents=t.sys.events,this.scrollFactorX=1,this.scrollFactorY=1,this.initPostPipeline(),this.setPosition(e,i),this.setBlendMode(n.SKIP_CHECK),s&&this.add(s)},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return.5*this.width}},displayOriginY:{get:function(){return.5*this.height}},setExclusive:function(t){return void 0===t&&(t=!0),this.exclusive=t,this},getBounds:function(t){if(void 0===t&&(t=new l),t.setTo(this.x,this.y,0,0),this.parentContainer){var e=this.parentContainer.getBoundsTransformMatrix().transformPoint(this.x,this.y);t.setTo(e.x,e.y,0,0)}if(this.list.length>0){var i=this.list,s=new l,n=!1;t.setEmpty();for(var r=0;r-1},setAll:function(t,e,i,n){return s.SetAll(this.list,t,e,i,n),this},each:function(t,e){var i,s=[null],n=this.list.slice(),r=n.length;for(i=2;i0?this.list[0]:null}},last:{get:function(){return this.list.length>0?(this.position=this.list.length-1,this.list[this.position]):null}},next:{get:function(){return this.position0?(this.position--,this.list[this.position]):null}},preDestroy:function(){this.removeAll(!!this.exclusive),this.localTransform.destroy(),this.tempTransformMatrix.destroy(),this.list=[]},onChildDestroyed:function(t){s.Remove(this.list,t),this.exclusive&&(t.parentContainer=null,t.removedFromScene())}});t.exports=f},53584:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e);var n=e.list;if(0!==n.length){var r=e.localTransform;s?(r.loadIdentity(),r.multiply(s),r.translate(e.x,e.y),r.rotate(e.rotation),r.scale(e.scaleX,e.scaleY)):r.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);var o=-1!==e.blendMode;o||t.setBlendMode(0);var a=e._alpha,h=e.scrollFactorX,l=e.scrollFactorY;e.mask&&e.mask.preRenderCanvas(t,null,i);for(var u=0;u{var s=i(25305),n=i(31559),r=i(44603),o=i(23568),a=i(95540);r.register("container",(function(t,e){void 0===t&&(t={});var i=o(t,"x",0),r=o(t,"y",0),h=a(t,"children",null),l=new n(this.scene,i,r,h);return void 0!==e&&(t.add=e),s(this.scene,l,t),l}))},24961:(t,e,i)=>{var s=i(31559);i(39429).register("container",(function(t,e,i){return this.displayList.add(new s(this.scene,t,e,i))}))},29959:(t,e,i)=>{var s,n;i(29747),s=i(72249),n=i(53584),t.exports={renderWebGL:s,renderCanvas:n}},72249:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e);var n=e.list,r=n.length;if(0!==r){var o=e.localTransform;s?(o.loadIdentity(),o.multiply(s),o.translate(e.x,e.y),o.rotate(e.rotation),o.scale(e.scaleX,e.scaleY)):o.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),t.pipelines.preBatch(e);var a=-1!==e.blendMode;a||t.setBlendMode(0);for(var h=e.alpha,l=e.scrollFactorX,u=e.scrollFactorY,c=0;c{t.exports=["normal","multiply","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]},3069:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(441),o=i(95643),a=i(41212),h=i(35846),l=i(44594),u=i(61369),c=new s({Extends:o,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.Origin,n.ScrollFactor,n.Transform,n.Visible,r],initialize:function(t,e,i,s,n,r){o.call(this,t,"DOMElement"),this.parent=t.sys.game.domContainer,this.cache=t.sys.cache.html,this.node,this.transformOnly=!1,this.skewX=0,this.skewY=0,this.rotate3d=new u,this.rotate3dAngle="deg",this.pointerEvents="auto",this.width=0,this.height=0,this.displayWidth=0,this.displayHeight=0,this.handler=this.dispatchNativeEvent.bind(this),this.setPosition(e,i),"string"==typeof s?"#"===s[0]?this.setElement(s.substr(1),n,r):this.createElement(s,n,r):s&&this.setElement(s,n,r),t.sys.events.on(l.SLEEP,this.handleSceneEvent,this),t.sys.events.on(l.WAKE,this.handleSceneEvent,this),t.sys.events.on(l.PRE_RENDER,this.preRender,this)},handleSceneEvent:function(t){var e=this.node,i=e.style;e&&(i.display=t.settings.visible?"block":"none")},setSkew:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.skewX=t,this.skewY=e,this},setPerspective:function(t){return this.parent.style.perspective=t+"px",this},perspective:{get:function(){return parseFloat(this.parent.style.perspective)},set:function(t){this.parent.style.perspective=t+"px"}},addListener:function(t){if(this.node){t=t.split(" ");for(var e=0;e{var s=i(47407),n=i(95643),r=i(61340),o=new r,a=new r,h=new r;t.exports=function(t,e,i,r){if(e.node){var l=e.node.style,u=e.scene.sys.settings;if(!l||!u.visible||n.RENDER_MASK!==e.renderFlags||0!==e.cameraFilter&&e.cameraFilter&i.id||e.parentContainer&&!e.parentContainer.willRender())l.display="none";else{var c=e.parentContainer,d=i.alpha*e.alpha;c&&(d*=c.alpha);var f=o,p=a,v=h,g=0,m=0,y="0%",x="0%";r?(g=e.width*e.scaleX*e.originX,m=e.height*e.scaleY*e.originY,p.applyITRS(e.x-g,e.y-m,e.rotation,e.scaleX,e.scaleY),f.copyFrom(i.matrix),f.multiplyWithOffset(r,-i.scrollX*e.scrollFactorX,-i.scrollY*e.scrollFactorY),p.e=e.x-g,p.f=e.y-m,f.multiply(p,v)):(g=e.width*e.originX,m=e.height*e.originY,p.applyITRS(e.x-g,e.y-m,e.rotation,e.scaleX,e.scaleY),f.copyFrom(i.matrix),y=100*e.originX+"%",x=100*e.originY+"%",p.e-=i.scrollX*e.scrollFactorX,p.f-=i.scrollY*e.scrollFactorY,f.multiply(p,v)),e.transformOnly||(l.display="block",l.opacity=d,l.zIndex=e._depth,l.pointerEvents=e.pointerEvents,l.mixBlendMode=s[e._blendMode]),l.transform=v.getCSSMatrix()+" skew("+e.skewX+"rad, "+e.skewY+"rad) rotate3d("+e.rotate3d.x+","+e.rotate3d.y+","+e.rotate3d.z+","+e.rotate3d.w+e.rotate3dAngle+")",l.transformOrigin=y+" "+x}}}},2611:(t,e,i)=>{var s=i(3069);i(39429).register("dom",(function(t,e,i,n,r){var o=new s(this.scene,t,e,i,n,r);return this.displayList.add(o),o}))},441:(t,e,i)=>{var s,n;i(29747),s=i(49381),n=i(49381),t.exports={renderWebGL:s,renderCanvas:n}},62980:t=>{t.exports="addedtoscene"},41337:t=>{t.exports="destroy"},44947:t=>{t.exports="removedfromscene"},49358:t=>{t.exports="complete"},35163:t=>{t.exports="created"},97249:t=>{t.exports="error"},19483:t=>{t.exports="locked"},56059:t=>{t.exports="loop"},26772:t=>{t.exports="metadata"},64437:t=>{t.exports="playing"},83411:t=>{t.exports="play"},75780:t=>{t.exports="seeked"},67799:t=>{t.exports="seeking"},63500:t=>{t.exports="stalled"},55541:t=>{t.exports="stop"},53208:t=>{t.exports="textureready"},4992:t=>{t.exports="unlocked"},12:t=>{t.exports="unsupported"},51708:(t,e,i)=>{t.exports={ADDED_TO_SCENE:i(62980),DESTROY:i(41337),REMOVED_FROM_SCENE:i(44947),VIDEO_COMPLETE:i(49358),VIDEO_CREATED:i(35163),VIDEO_ERROR:i(97249),VIDEO_LOCKED:i(19483),VIDEO_LOOP:i(56059),VIDEO_METADATA:i(26772),VIDEO_PLAY:i(83411),VIDEO_PLAYING:i(64437),VIDEO_SEEKED:i(75780),VIDEO_SEEKING:i(67799),VIDEO_STALLED:i(63500),VIDEO_STOP:i(55541),VIDEO_TEXTURE:i(53208),VIDEO_UNLOCKED:i(4992),VIDEO_UNSUPPORTED:i(12)}},42421:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(95643),o=i(64993),a=new s({Extends:r,Mixins:[n.Alpha,n.BlendMode,n.Depth,n.Flip,n.Origin,n.ScrollFactor,n.Size,n.Texture,n.Tint,n.Transform,n.Visible,o],initialize:function(t){r.call(this,t,"Extern")},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},preUpdate:function(){},render:function(){}});t.exports=a},70217:()=>{},56315:(t,e,i)=>{var s=i(42421);i(39429).register("extern",(function(){var t=new s(this.scene);return this.displayList.add(t),t}))},64993:(t,e,i)=>{var s,n;i(29747),s=i(80287),n=i(70217),t.exports={renderWebGL:s,renderCanvas:n}},80287:(t,e,i)=>{var s=i(91296);t.exports=function(t,e,i,n){t.pipelines.clear();var r=s(e,i,n).calc;e.render.call(e,t,i,r),t.pipelines.rebind()}},85592:t=>{t.exports={ARC:0,BEGIN_PATH:1,CLOSE_PATH:2,FILL_RECT:3,LINE_TO:4,MOVE_TO:5,LINE_STYLE:6,FILL_STYLE:7,FILL_PATH:8,STROKE_PATH:9,FILL_TRIANGLE:10,STROKE_TRIANGLE:11,SAVE:14,RESTORE:15,TRANSLATE:16,SCALE:17,ROTATE:18,GRADIENT_FILL_STYLE:21,GRADIENT_LINE_STYLE:22}},43831:(t,e,i)=>{var s=i(71911),n=i(83419),r=i(85592),o=i(31401),a=i(8497),h=i(95643),l=i(95540),u=i(35154),c=i(36383),d=i(84503),f=new n({Extends:h,Mixins:[o.AlphaSingle,o.BlendMode,o.Depth,o.Mask,o.Pipeline,o.PostPipeline,o.Transform,o.Visible,o.ScrollFactor,d],initialize:function(t,e){var i=u(e,"x",0),s=u(e,"y",0);h.call(this,t,"Graphics"),this.setPosition(i,s),this.initPipeline(),this.initPostPipeline(),this.displayOriginX=0,this.displayOriginY=0,this.commandBuffer=[],this.defaultFillColor=-1,this.defaultFillAlpha=1,this.defaultStrokeWidth=1,this.defaultStrokeColor=-1,this.defaultStrokeAlpha=1,this._lineWidth=1,this.lineStyle(1,0,0),this.fillStyle(0,0),this.setDefaultStyles(e)},setDefaultStyles:function(t){return u(t,"lineStyle",null)&&(this.defaultStrokeWidth=u(t,"lineStyle.width",1),this.defaultStrokeColor=u(t,"lineStyle.color",16777215),this.defaultStrokeAlpha=u(t,"lineStyle.alpha",1),this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha)),u(t,"fillStyle",null)&&(this.defaultFillColor=u(t,"fillStyle.color",16777215),this.defaultFillAlpha=u(t,"fillStyle.alpha",1),this.fillStyle(this.defaultFillColor,this.defaultFillAlpha)),this},lineStyle:function(t,e,i){return void 0===i&&(i=1),this.commandBuffer.push(r.LINE_STYLE,t,e,i),this._lineWidth=t,this},fillStyle:function(t,e){return void 0===e&&(e=1),this.commandBuffer.push(r.FILL_STYLE,t,e),this},fillGradientStyle:function(t,e,i,s,n,o,a,h){return void 0===n&&(n=1),void 0===o&&(o=n),void 0===a&&(a=n),void 0===h&&(h=n),this.commandBuffer.push(r.GRADIENT_FILL_STYLE,n,o,a,h,t,e,i,s),this},lineGradientStyle:function(t,e,i,s,n,o){return void 0===o&&(o=1),this.commandBuffer.push(r.GRADIENT_LINE_STYLE,t,o,e,i,s,n),this},beginPath:function(){return this.commandBuffer.push(r.BEGIN_PATH),this},closePath:function(){return this.commandBuffer.push(r.CLOSE_PATH),this},fillPath:function(){return this.commandBuffer.push(r.FILL_PATH),this},fill:function(){return this.commandBuffer.push(r.FILL_PATH),this},strokePath:function(){return this.commandBuffer.push(r.STROKE_PATH),this},stroke:function(){return this.commandBuffer.push(r.STROKE_PATH),this},fillCircleShape:function(t){return this.fillCircle(t.x,t.y,t.radius)},strokeCircleShape:function(t){return this.strokeCircle(t.x,t.y,t.radius)},fillCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,c.PI2),this.fillPath(),this},strokeCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,c.PI2),this.strokePath(),this},fillRectShape:function(t){return this.fillRect(t.x,t.y,t.width,t.height)},strokeRectShape:function(t){return this.strokeRect(t.x,t.y,t.width,t.height)},fillRect:function(t,e,i,s){return this.commandBuffer.push(r.FILL_RECT,t,e,i,s),this},strokeRect:function(t,e,i,s){var n=this._lineWidth/2,r=t-n,o=t+n;return this.beginPath(),this.moveTo(t,e),this.lineTo(t,e+s),this.strokePath(),this.beginPath(),this.moveTo(t+i,e),this.lineTo(t+i,e+s),this.strokePath(),this.beginPath(),this.moveTo(r,e),this.lineTo(o+i,e),this.strokePath(),this.beginPath(),this.moveTo(r,e+s),this.lineTo(o+i,e+s),this.strokePath(),this},fillRoundedRect:function(t,e,i,s,n){void 0===n&&(n=20);var r=n,o=n,a=n,h=n;"number"!=typeof n&&(r=l(n,"tl",20),o=l(n,"tr",20),a=l(n,"bl",20),h=l(n,"br",20));var u=r>=0,d=o>=0,f=a>=0,p=h>=0;return r=Math.abs(r),o=Math.abs(o),a=Math.abs(a),h=Math.abs(h),this.beginPath(),this.moveTo(t+r,e),this.lineTo(t+i-o,e),d?this.arc(t+i-o,e+o,o,-c.TAU,0):this.arc(t+i,e,o,Math.PI,c.TAU,!0),this.lineTo(t+i,e+s-h),p?this.arc(t+i-h,e+s-h,h,0,c.TAU):this.arc(t+i,e+s,h,-c.TAU,Math.PI,!0),this.lineTo(t+a,e+s),f?this.arc(t+a,e+s-a,a,c.TAU,Math.PI):this.arc(t,e+s,a,0,-c.TAU,!0),this.lineTo(t,e+r),u?this.arc(t+r,e+r,r,-Math.PI,-c.TAU):this.arc(t,e,r,c.TAU,0,!0),this.fillPath(),this},strokeRoundedRect:function(t,e,i,s,n){void 0===n&&(n=20);var r=n,o=n,a=n,h=n,u=Math.min(i,s)/2;"number"!=typeof n&&(r=l(n,"tl",20),o=l(n,"tr",20),a=l(n,"bl",20),h=l(n,"br",20));var d=r>=0,f=o>=0,p=a>=0,v=h>=0;return r=Math.min(Math.abs(r),u),o=Math.min(Math.abs(o),u),a=Math.min(Math.abs(a),u),h=Math.min(Math.abs(h),u),this.beginPath(),this.moveTo(t+r,e),this.lineTo(t+i-o,e),this.moveTo(t+i-o,e),f?this.arc(t+i-o,e+o,o,-c.TAU,0):this.arc(t+i,e,o,Math.PI,c.TAU,!0),this.lineTo(t+i,e+s-h),this.moveTo(t+i,e+s-h),v?this.arc(t+i-h,e+s-h,h,0,c.TAU):this.arc(t+i,e+s,h,-c.TAU,Math.PI,!0),this.lineTo(t+a,e+s),this.moveTo(t+a,e+s),p?this.arc(t+a,e+s-a,a,c.TAU,Math.PI):this.arc(t,e+s,a,0,-c.TAU,!0),this.lineTo(t,e+r),this.moveTo(t,e+r),d?this.arc(t+r,e+r,r,-Math.PI,-c.TAU):this.arc(t,e,r,c.TAU,0,!0),this.strokePath(),this},fillPointShape:function(t,e){return this.fillPoint(t.x,t.y,e)},fillPoint:function(t,e,i){return!i||i<1?i=1:(t-=i/2,e-=i/2),this.commandBuffer.push(r.FILL_RECT,t,e,i,i),this},fillTriangleShape:function(t){return this.fillTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},strokeTriangleShape:function(t){return this.strokeTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},fillTriangle:function(t,e,i,s,n,o){return this.commandBuffer.push(r.FILL_TRIANGLE,t,e,i,s,n,o),this},strokeTriangle:function(t,e,i,s,n,o){return this.commandBuffer.push(r.STROKE_TRIANGLE,t,e,i,s,n,o),this},strokeLineShape:function(t){return this.lineBetween(t.x1,t.y1,t.x2,t.y2)},lineBetween:function(t,e,i,s){return this.beginPath(),this.moveTo(t,e),this.lineTo(i,s),this.strokePath(),this},lineTo:function(t,e){return this.commandBuffer.push(r.LINE_TO,t,e),this},moveTo:function(t,e){return this.commandBuffer.push(r.MOVE_TO,t,e),this},strokePoints:function(t,e,i,s){void 0===e&&(e=!1),void 0===i&&(i=!1),void 0===s&&(s=t.length),this.beginPath(),this.moveTo(t[0].x,t[0].y);for(var n=1;n-1&&this.fillStyle(this.defaultFillColor,this.defaultFillAlpha),this.defaultStrokeColor>-1&&this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha),this},generateTexture:function(t,e,i){var s,n,r=this.scene.sys,o=r.game.renderer;void 0===e&&(e=r.scale.width),void 0===i&&(i=r.scale.height),f.TargetCamera.setScene(this.scene),f.TargetCamera.setViewport(0,0,e,i),f.TargetCamera.scrollX=this.x,f.TargetCamera.scrollY=this.y;var a={willReadFrequently:!0};if("string"==typeof t)if(r.textures.exists(t)){var h=(s=r.textures.get(t)).getSourceImage();h instanceof HTMLCanvasElement&&(n=h.getContext("2d",a))}else n=(s=r.textures.createCanvas(t,e,i)).getSourceImage().getContext("2d",a);else t instanceof HTMLCanvasElement&&(n=t.getContext("2d",a));return n&&(this.renderCanvas(o,this,f.TargetCamera,null,n,!1),s&&s.refresh()),this},preDestroy:function(){this.commandBuffer=[]}});f.TargetCamera=new s,t.exports=f},32768:(t,e,i)=>{var s=i(85592),n=i(20926);t.exports=function(t,e,i,r,o,a){var h=e.commandBuffer,l=h.length,u=o||t.currentContext;if(0!==l&&n(t,u,e,i,r)){i.addToRenderList(e);var c=1,d=1,f=0,p=0,v=1,g=0,m=0,y=0;u.beginPath();for(var x=0;x>>16,m=(65280&f)>>>8,y=255&f,u.strokeStyle="rgba("+g+","+m+","+y+","+c+")",u.lineWidth=v,x+=3;break;case s.FILL_STYLE:p=h[x+1],d=h[x+2],g=(16711680&p)>>>16,m=(65280&p)>>>8,y=255&p,u.fillStyle="rgba("+g+","+m+","+y+","+d+")",x+=2;break;case s.BEGIN_PATH:u.beginPath();break;case s.CLOSE_PATH:u.closePath();break;case s.FILL_PATH:a||u.fill();break;case s.STROKE_PATH:a||u.stroke();break;case s.FILL_RECT:a?u.rect(h[x+1],h[x+2],h[x+3],h[x+4]):u.fillRect(h[x+1],h[x+2],h[x+3],h[x+4]),x+=4;break;case s.FILL_TRIANGLE:u.beginPath(),u.moveTo(h[x+1],h[x+2]),u.lineTo(h[x+3],h[x+4]),u.lineTo(h[x+5],h[x+6]),u.closePath(),a||u.fill(),x+=6;break;case s.STROKE_TRIANGLE:u.beginPath(),u.moveTo(h[x+1],h[x+2]),u.lineTo(h[x+3],h[x+4]),u.lineTo(h[x+5],h[x+6]),u.closePath(),a||u.stroke(),x+=6;break;case s.LINE_TO:u.lineTo(h[x+1],h[x+2]),x+=2;break;case s.MOVE_TO:u.moveTo(h[x+1],h[x+2]),x+=2;break;case s.LINE_FX_TO:u.lineTo(h[x+1],h[x+2]),x+=5;break;case s.MOVE_FX_TO:u.moveTo(h[x+1],h[x+2]),x+=5;break;case s.SAVE:u.save();break;case s.RESTORE:u.restore();break;case s.TRANSLATE:u.translate(h[x+1],h[x+2]),x+=2;break;case s.SCALE:u.scale(h[x+1],h[x+2]),x+=2;break;case s.ROTATE:u.rotate(h[x+1]),x+=1;break;case s.GRADIENT_FILL_STYLE:x+=5;break;case s.GRADIENT_LINE_STYLE:x+=6}u.restore()}}},87079:(t,e,i)=>{var s=i(44603),n=i(43831);s.register("graphics",(function(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new n(this.scene,t);return t.add&&this.scene.sys.displayList.add(i),i}))},1201:(t,e,i)=>{var s=i(43831);i(39429).register("graphics",(function(t){return this.displayList.add(new s(this.scene,t))}))},84503:(t,e,i)=>{var s,n;i(29747),s=i(77545),i(32768),n=i(32768),t.exports={renderWebGL:s,renderCanvas:n}},77545:(t,e,i)=>{var s=i(85592),n=i(91296),r=i(61340),o=i(70554),a=function(t,e,i){this.x=t,this.y=e,this.width=i},h=function(t,e,i){this.points=[],this.pointsLength=1,this.points[0]=new a(t,e,i)},l=[],u=new r;t.exports=function(t,e,i,r){if(0!==e.commandBuffer.length){i.addToRenderList(e);var c=t.pipelines.set(e.pipeline,e);t.pipelines.preBatch(e);for(var d=n(e,i,r).calc,f=u.loadIdentity(),p=e.commandBuffer,v=i.alpha*e.alpha,g=1,m=c.fillTint,y=c.strokeTint,x=0,T=0,w=0,b=2*Math.PI,S=[],E=0,A=!0,C=null,_=o.getTintAppendFloatAlpha,M=0;M0&&(Y=Y%b-b):Y>b?Y=b:Y<0&&(Y=b+Y%b),null===C&&(C=new h(B+Math.cos(X)*U,N+Math.sin(X)*U,g),S.push(C),I+=.01);I<1+G;)w=Y*I+X,x=B+Math.cos(w)*U,T=N+Math.sin(w)*U,C.points.push(new a(x,T,g)),I+=.01;w=Y+X,x=B+Math.cos(w)*U,T=N+Math.sin(w)*U,C.points.push(new a(x,T,g));break;case s.FILL_RECT:c.batchFillRect(p[++M],p[++M],p[++M],p[++M],f,d);break;case s.FILL_TRIANGLE:c.batchFillTriangle(p[++M],p[++M],p[++M],p[++M],p[++M],p[++M],f,d);break;case s.STROKE_TRIANGLE:c.batchStrokeTriangle(p[++M],p[++M],p[++M],p[++M],p[++M],p[++M],g,f,d);break;case s.LINE_TO:null!==C?C.points.push(new a(p[++M],p[++M],g)):(C=new h(p[++M],p[++M],g),S.push(C));break;case s.MOVE_TO:C=new h(p[++M],p[++M],g),S.push(C);break;case s.SAVE:l.push(f.copyToArray());break;case s.RESTORE:f.copyFromArray(l.pop());break;case s.TRANSLATE:B=p[++M],N=p[++M],f.translate(B,N);break;case s.SCALE:B=p[++M],N=p[++M],f.scale(B,N);break;case s.ROTATE:f.rotate(p[++M])}t.pipelines.postBatch(e)}}},26479:(t,e,i)=>{var s=i(61061),n=i(83419),r=i(51708),o=i(50792),a=i(46710),h=i(95540),l=i(35154),u=i(97022),c=i(41212),d=i(88492),f=i(35072),p=i(68287),v=new n({Extends:o,initialize:function(t,e,i){o.call(this),i?e&&!Array.isArray(e)&&(e=[e]):Array.isArray(e)?c(e[0])&&(i=e,e=null):c(e)&&(i=e,e=null),this.scene=t,this.children=new f,this.isParent=!0,this.type="Group",this.classType=h(i,"classType",p),this.name=h(i,"name",""),this.active=h(i,"active",!0),this.maxSize=h(i,"maxSize",-1),this.defaultKey=h(i,"defaultKey",null),this.defaultFrame=h(i,"defaultFrame",null),this.runChildUpdate=h(i,"runChildUpdate",!1),this.createCallback=h(i,"createCallback",null),this.removeCallback=h(i,"removeCallback",null),this.createMultipleCallback=h(i,"createMultipleCallback",null),this.internalCreateCallback=h(i,"internalCreateCallback",null),this.internalRemoveCallback=h(i,"internalRemoveCallback",null),e&&this.addMultiple(e),i&&this.createMultiple(i),this.on(r.ADDED_TO_SCENE,this.addedToScene,this),this.on(r.REMOVED_FROM_SCENE,this.removedFromScene,this)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},create:function(t,e,i,s,n,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.defaultKey),void 0===s&&(s=this.defaultFrame),void 0===n&&(n=!0),void 0===r&&(r=!0),this.isFull())return null;var o=new this.classType(this.scene,t,e,i,s);return o.addToDisplayList(this.scene.sys.displayList),o.addToUpdateList(),o.visible=n,o.setActive(r),this.add(o),o},createMultiple:function(t){if(this.isFull())return[];Array.isArray(t)||(t=[t]);var e=[];if(t[0].key)for(var i=0;i=0;u--)if((l=d[u]).active===i){if(++c===e)break}else l=null;return l?("number"==typeof n&&(l.x=n),"number"==typeof r&&(l.y=r),l):s?this.create(n,r,o,a,h):null},get:function(t,e,i,s,n){return this.getFirst(!1,!0,t,e,i,s,n)},getFirstAlive:function(t,e,i,s,n,r){return this.getFirst(!0,t,e,i,s,n,r)},getFirstDead:function(t,e,i,s,n,r){return this.getFirst(!1,t,e,i,s,n,r)},playAnimation:function(t,e){return s.PlayAnimation(this.children.entries,t,e),this},isFull:function(){return-1!==this.maxSize&&this.children.size>=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;i{var s=i(44603),n=i(26479);s.register("group",(function(t){return new n(this.scene,null,t)}))},3385:(t,e,i)=>{var s=i(26479);i(39429).register("group",(function(t,e){return this.updateList.add(new s(this.scene,t,e))}))},88571:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(95643),o=i(59819),a=new s({Extends:r,Mixins:[n.Alpha,n.BlendMode,n.Depth,n.Flip,n.GetBounds,n.Mask,n.Origin,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Size,n.TextureCrop,n.Tint,n.Transform,n.Visible,o],initialize:function(t,e,i,s,n){r.call(this,t,"Image"),this._crop=this.resetCropObject(),this.setTexture(s,n),this.setPosition(e,i),this.setSizeToFrame(),this.setOriginFromFrame(),this.initPipeline(),this.initPostPipeline(!0)}});t.exports=a},40652:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e),t.batchSprite(e,e.frame,i,s)}},82459:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(88571);n.register("image",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=r(t,"frame",null),a=new o(this.scene,0,0,i,n);return void 0!==e&&(t.add=e),s(this.scene,a,t),a}))},2117:(t,e,i)=>{var s=i(88571);i(39429).register("image",(function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))}))},59819:(t,e,i)=>{var s,n;i(29747),s=i(99517),n=i(40652),t.exports={renderWebGL:s,renderCanvas:n}},99517:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e),this.pipeline.batchSprite(e,i,s)}},77856:(t,e,i)=>{var s={Events:i(51708),DisplayList:i(8050),GameObjectCreator:i(44603),GameObjectFactory:i(39429),UpdateList:i(45027),Components:i(31401),GetCalcMatrix:i(91296),BuildGameObject:i(25305),BuildGameObjectAnimation:i(13059),GameObject:i(95643),BitmapText:i(22186),Blitter:i(6107),Bob:i(46590),Container:i(31559),DOMElement:i(3069),DynamicBitmapText:i(2638),Extern:i(42421),Graphics:i(43831),Group:i(26479),Image:i(88571),Layer:i(93595),Particles:i(18404),PathFollower:i(1159),RenderTexture:i(591),RetroFont:i(196),Rope:i(77757),Sprite:i(68287),Text:i(50171),GetTextSize:i(14220),MeasureText:i(79557),TextStyle:i(35762),TileSprite:i(20839),Zone:i(41481),Video:i(18471),Shape:i(17803),Arc:i(23629),Curve:i(89),Ellipse:i(19921),Grid:i(30479),IsoBox:i(61475),IsoTriangle:i(16933),Line:i(57847),Polygon:i(24949),Rectangle:i(74561),Star:i(55911),Triangle:i(36931),Factories:{Blitter:i(12709),Container:i(24961),DOMElement:i(2611),DynamicBitmapText:i(72566),Extern:i(56315),Graphics:i(1201),Group:i(3385),Image:i(2117),Layer:i(20005),Particles:i(676),PathFollower:i(90145),RenderTexture:i(60505),Rope:i(96819),Sprite:i(46409),StaticBitmapText:i(34914),Text:i(68005),TileSprite:i(91681),Zone:i(84175),Video:i(89025),Arc:i(42563),Curve:i(40511),Ellipse:i(1543),Grid:i(34137),IsoBox:i(3933),IsoTriangle:i(49803),Line:i(2481),Polygon:i(64827),Rectangle:i(87959),Star:i(93697),Triangle:i(45245)},Creators:{Blitter:i(9403),Container:i(77143),DynamicBitmapText:i(11164),Graphics:i(87079),Group:i(94975),Image:i(82459),Layer:i(25179),Particles:i(92730),RenderTexture:i(34495),Rope:i(26209),Sprite:i(15567),StaticBitmapText:i(57336),Text:i(71259),TileSprite:i(14167),Zone:i(95261),Video:i(11511)}};s.Shader=i(20071),s.Mesh=i(4703),s.NineSlice=i(28103),s.PointLight=i(80321),s.Plane=i(33663),s.Factories.Shader=i(74177),s.Factories.Mesh=i(9225),s.Factories.NineSlice=i(47521),s.Factories.PointLight=i(71255),s.Factories.Plane=i(30985),s.Creators.Shader=i(54935),s.Creators.Mesh=i(20527),s.Creators.NineSlice=i(28279),s.Creators.PointLight=i(39829),s.Creators.Plane=i(56015),s.Light=i(41432),s.LightsManager=i(61356),s.LightsPlugin=i(88992),t.exports=s},93595:(t,e,i)=>{var s=i(10312),n=i(83419),r=i(31401),o=i(53774),a=i(45893),h=i(50792),l=i(51708),u=i(73162),c=i(33963),d=i(44594),f=i(19186),p=new n({Extends:u,Mixins:[r.AlphaSingle,r.BlendMode,r.Depth,r.Mask,r.PostPipeline,r.Visible,h,c],initialize:function(t,e){u.call(this,t),h.call(this),this.scene=t,this.displayList=null,this.type="Layer",this.state=0,this.parentContainer=null,this.name="",this.active=!0,this.tabIndex=-1,this.data=null,this.renderFlags=15,this.cameraFilter=0,this.input=null,this.body=null,this.ignoreDestroy=!1,this.systems=t.sys,this.events=t.sys.events,this.sortChildrenFlag=!1,this.addCallback=this.addChildCallback,this.removeCallback=this.removeChildCallback,this.initPostPipeline(),this.clearAlpha(),this.setBlendMode(s.SKIP_CHECK),e&&this.add(e),t.sys.queueDepthSort()},setActive:function(t){return this.active=t,this},setName:function(t){return this.name=t,this},setState:function(t){return this.state=t,this},setDataEnabled:function(){return this.data||(this.data=new a(this)),this},setData:function(t,e){return this.data||(this.data=new a(this)),this.data.set(t,e),this},incData:function(t,e){return this.data||(this.data=new a(this)),this.data.inc(t,e),this},toggleData:function(t){return this.data||(this.data=new a(this)),this.data.toggle(t),this},getData:function(t){return this.data||(this.data=new a(this)),this.data.get(t)},setInteractive:function(){return this},disableInteractive:function(){return this},removeInteractive:function(){return this},addedToScene:function(){},removedFromScene:function(){},update:function(){},toJSON:function(){return o(this)},willRender:function(t){return!(15!==this.renderFlags||0===this.list.length||0!==this.cameraFilter&&this.cameraFilter&t.id)},getIndexList:function(){for(var t=this,e=this.parentContainer,i=[];e&&(i.unshift(e.getIndex(t)),t=e,e.parentContainer);)e=e.parentContainer;return i.unshift(this.displayList.getIndex(t)),i},addChildCallback:function(t){var e=t.displayList;e&&e!==this&&t.removeFromDisplayList(),t.displayList||(this.queueDepthSort(),t.displayList=this,t.emit(l.ADDED_TO_SCENE,t,this.scene),this.events.emit(d.ADDED_TO_SCENE,t,this.scene))},removeChildCallback:function(t){this.queueDepthSort(),t.displayList=null,t.emit(l.REMOVED_FROM_SCENE,t,this.scene),this.events.emit(d.REMOVED_FROM_SCENE,t,this.scene)},queueDepthSort:function(){this.sortChildrenFlag=!0},depthSort:function(){this.sortChildrenFlag&&(f(this.list,this.sortByDepth),this.sortChildrenFlag=!1)},sortByDepth:function(t,e){return t._depth-e._depth},getChildren:function(){return this.list},addToDisplayList:function(t){return void 0===t&&(t=this.scene.sys.displayList),this.displayList&&this.displayList!==t&&this.removeFromDisplayList(),t.exists(this)||(this.displayList=t,t.add(this,!0),t.queueDepthSort(),this.emit(l.ADDED_TO_SCENE,this,this.scene),t.events.emit(d.ADDED_TO_SCENE,this,this.scene)),this},removeFromDisplayList:function(){var t=this.displayList||this.scene.sys.displayList;return t.exists(this)&&(t.remove(this,!0),t.queueDepthSort(),this.displayList=null,this.emit(l.REMOVED_FROM_SCENE,this,this.scene),t.events.emit(d.REMOVED_FROM_SCENE,this,this.scene)),this},destroy:function(t){if(this.scene&&!this.ignoreDestroy){this.emit(l.DESTROY,this);for(var e=this.list;e.length;)e[0].destroy(t);this.removeAllListeners(),this.resetPostPipeline(!0),this.displayList&&(this.displayList.remove(this,!0,!1),this.displayList.queueDepthSort()),this.data&&(this.data.destroy(),this.data=void 0),this.active=!1,this.visible=!1,this.list=void 0,this.scene=void 0,this.displayList=void 0,this.systems=void 0,this.events=void 0}}});t.exports=p},2956:t=>{t.exports=function(t,e,i){var s=e.list;if(0!==s.length){e.depthSort();var n=-1!==e.blendMode;n||t.setBlendMode(0);var r=e._alpha;e.mask&&e.mask.preRenderCanvas(t,null,i);for(var o=0;o{var s=i(25305),n=i(93595),r=i(44603),o=i(23568);r.register("layer",(function(t,e){void 0===t&&(t={});var i=o(t,"children",null),r=new n(this.scene,i);return void 0!==e&&(t.add=e),s(this.scene,r,t),r}))},20005:(t,e,i)=>{var s=i(93595);i(39429).register("layer",(function(t){return this.displayList.add(new s(this.scene,t))}))},33963:(t,e,i)=>{var s,n;i(29747),s=i(15869),n=i(2956),t.exports={renderWebGL:s,renderCanvas:n}},15869:t=>{t.exports=function(t,e,i){var s=e.list,n=s.length;if(0!==n){e.depthSort(),t.pipelines.preBatch(e);var r=-1!==e.blendMode;r||t.setBlendMode(0);for(var o=e.alpha,a=0;a{var s=i(96503),n=i(83419),r=i(31401),o=i(51767),a=i(70554),h=new n({Extends:s,Mixins:[r.Origin,r.ScrollFactor,r.Visible],initialize:function(t,e,i,n,r,a,h){s.call(this,t,e,i),this.color=new o(n,r,a),this.intensity=h,this.renderFlags=15,this.cameraFilter=0,this.setScrollFactor(1,1),this.setOrigin(),this.setDisplayOrigin(i)},displayWidth:{get:function(){return this.diameter},set:function(t){this.diameter=t}},displayHeight:{get:function(){return this.diameter},set:function(t){this.diameter=t}},width:{get:function(){return this.diameter},set:function(t){this.diameter=t}},height:{get:function(){return this.diameter},set:function(t){this.diameter=t}},willRender:function(t){return!(h.RENDER_MASK!==this.renderFlags||0!==this.cameraFilter&&this.cameraFilter&t.id)},setColor:function(t){var e=a.getFloatsFromUintRGB(t);return this.color.set(e[0],e[1],e[2]),this},setIntensity:function(t){return this.intensity=t,this},setRadius:function(t){return this.radius=t,this}});h.RENDER_MASK=15,t.exports=h},61356:(t,e,i)=>{var s=i(81491),n=i(83419),r=i(20339),o=i(41432),a=i(80321),h=i(51767),l=i(19133),u=i(19186),c=i(70554),d=new n({initialize:function(){this.lights=[],this.ambientColor=new h(.1,.1,.1),this.active=!1,this.maxLights=-1,this.visibleLights=0},addPointLight:function(t,e,i,s,n,r){return this.systems.displayList.add(new a(this.scene,t,e,i,s,n,r))},enable:function(){return-1===this.maxLights&&(this.maxLights=this.systems.renderer.config.maxLights),this.active=!0,this},disable:function(){return this.active=!1,this},getLights:function(t){for(var e=this.lights,i=t.worldView,n=[],o=0;othis.maxLights&&(u(n,this.sortByDistance),n=n.slice(0,this.maxLights)),this.visibleLights=n.length,n},sortByDistance:function(t,e){return t.distance>=e.distance},setAmbientColor:function(t){var e=c.getFloatsFromUintRGB(t);return this.ambientColor.set(e[0],e[1],e[2]),this},getMaxVisibleLights:function(){return this.maxLights},getLightCount:function(){return this.lights.length},addLight:function(t,e,i,s,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=128),void 0===s&&(s=16777215),void 0===n&&(n=1);var r=c.getFloatsFromUintRGB(s),a=new o(t,e,i,r[0],r[1],r[2],n);return this.lights.push(a),a},removeLight:function(t){var e=this.lights.indexOf(t);return e>=0&&l(this.lights,e),this},shutdown:function(){this.lights.length=0},destroy:function(){this.shutdown()}});t.exports=d},88992:(t,e,i)=>{var s=i(83419),n=i(61356),r=i(37277),o=i(44594),a=new s({Extends:n,initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once(o.BOOT,this.boot,this),n.call(this)},boot:function(){var t=this.systems.events;t.on(o.SHUTDOWN,this.shutdown,this),t.on(o.DESTROY,this.destroy,this)},destroy:function(){this.shutdown(),this.scene=void 0,this.systems=void 0}});r.register("LightsPlugin",a,"lights"),t.exports=a},4703:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(39506),o=i(83997),a=i(95643),h=i(34684),l=i(92515),u=i(91296),c=i(37867),d=i(29807),f=i(43396),p=i(19186),v=i(25836),g=i(39318),m=new s({Extends:a,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.Mask,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Size,n.Texture,n.Transform,n.Visible,d],initialize:function(t,e,i,s,n,r,o,h,l,u,d,f){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s="__WHITE"),a.call(this,t,"Mesh"),this.faces=[],this.vertices=[],this.tintFill=!1,this.debugCallback=null,this.debugGraphic=null,this.hideCCW=!0,this.modelPosition=new v,this.modelScale=new v(1,1,1),this.modelRotation=new v,this.dirtyCache=[0,0,0,0,0,0,0,0,0,0,0,0],this.transformMatrix=new c,this.viewPosition=new v,this.viewMatrix=new c,this.projectionMatrix=new c,this.totalRendered=0,this.totalFrame=0,this.ignoreDirtyCache=!1,this.fov,this.displayOriginX=0,this.displayOriginY=0;var p=t.sys.renderer;this.setPosition(e,i),this.setTexture(s,n),this.setSize(p.width,p.height),this.initPipeline(),this.initPostPipeline(),this.setPerspective(p.width,p.height),r&&this.addVertices(r,o,h,l,u,d,f)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},panX:function(t){return this.viewPosition.addScale(v.LEFT,t),this.dirtyCache[10]=1,this},panY:function(t){return this.viewPosition.y+=v.DOWN.y*t,this.dirtyCache[10]=1,this},panZ:function(t){return this.viewPosition.z+=t,this.dirtyCache[10]=1,this},setPerspective:function(t,e,i,s,n){return void 0===i&&(i=45),void 0===s&&(s=.01),void 0===n&&(n=1e3),this.fov=i,this.projectionMatrix.perspective(r(i),t/e,s,n),this.dirtyCache[10]=1,this.dirtyCache[11]=0,this},setOrtho:function(t,e,i,s){return void 0===t&&(t=this.scene.sys.renderer.getAspectRatio()),void 0===e&&(e=1),void 0===i&&(i=-1e3),void 0===s&&(s=1e3),this.fov=0,this.projectionMatrix.ortho(-t,t,-e,e,i,s),this.dirtyCache[10]=1,this.dirtyCache[11]=1,this},clear:function(){return this.faces.forEach((function(t){t.destroy()})),this.faces=[],this.vertices=[],this},addVerticesFromObj:function(t,e,i,s,n,r,o,a,l){var u,c=this.scene.sys.cache.obj.get(t);return c&&(u=h(c,this,e,i,s,n,r,o,a,l)),u&&0!==u.verts.length||console.warn("Mesh.addVerticesFromObj data empty:",t),this},sortByDepth:function(t,e){return t.depth-e.depth},depthSort:function(){return p(this.faces,this.sortByDepth),this},addVertex:function(t,e,i,s,n,r,o){var a=new g(t,e,i,s,n,r,o);return this.vertices.push(a),a},addFace:function(t,e,i){var s=new o(t,e,i);return this.faces.push(s),this.dirtyCache[9]=-1,s},addVertices:function(t,e,i,s,n,r,o){var a=l(t,e,i,s,n,r,o);return a?(this.faces=this.faces.concat(a.faces),this.vertices=this.vertices.concat(a.vertices)):console.warn("Mesh.addVertices data empty or invalid"),this.dirtyCache[9]=-1,this},getFaceCount:function(){return this.faces.length},getVertexCount:function(){return this.vertices.length},getFace:function(t){return this.faces[t]},hasFaceAt:function(t,e,i){void 0===i&&(i=this.scene.sys.cameras.main);for(var s=u(this,i).calc,n=this.faces,r=0;r{t.exports=function(){}},20527:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(35154),a=i(4703);n.register("mesh",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=r(t,"frame",null),h=o(t,"vertices",[]),l=o(t,"uvs",[]),u=o(t,"indicies",[]),c=o(t,"containsZ",!1),d=o(t,"normals",[]),f=o(t,"colors",16777215),p=o(t,"alphas",1),v=new a(this.scene,0,0,i,n,h,l,u,c,d,f,p);return void 0!==e&&(t.add=e),s(this.scene,v,t),v}))},9225:(t,e,i)=>{var s=i(4703);i(39429).register("mesh",(function(t,e,i,n,r,o,a,h,l,u,c){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a,h,l,u,c))}))},29807:(t,e,i)=>{var s,n;i(29747),s=i(48833),n=i(36488),t.exports={renderWebGL:s,renderCanvas:n}},48833:(t,e,i)=>{var s=i(91296);t.exports=function(t,e,i,n){var r=e.faces,o=r.length;if(0!==o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline,e),h=s(e,i,n).calc;t.pipelines.preBatch(e);for(var l=a.setGameObject(e),u=a.vertexViewF32,c=a.vertexViewU32,d=a.vertexCount*a.currentShader.vertexComponentCount-1,f=e.tintFill,p=[],v=e.debugCallback,g=h.a,m=h.b,y=h.c,x=h.d,T=h.e,w=h.f,b=e.viewPosition.z,S=e.hideCCW,E=i.roundPixels,A=i.alpha*e.alpha,C=0,_=0;_{var s=i(83419),n=i(31401),r=i(95643),o=i(78023),a=i(39318),h=new s({Extends:r,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.GetBounds,n.Mask,n.Origin,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Texture,n.Transform,n.Visible,o],initialize:function(t,e,i,s,n,o,h,l,u,c,d){r.call(this,t,"NineSlice"),this._width,this._height,this._originX=.5,this._originY=.5,this._sizeComponent=!0,this.vertices=[],this.leftWidth,this.rightWidth,this.topHeight,this.bottomHeight,this.tint=16777215,this.tintFill=!1;var f=t.textures.getFrame(s,n);this.is3Slice=!c&&!d,f.scale9&&(this.is3Slice=f.is3Slice);for(var p=this.is3Slice?18:54,v=0;v{var s=i(25305),n=i(44603),r=i(23568),o=i(35154),a=i(28103);n.register("nineslice",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=r(t,"frame",null),h=o(t,"width",256),l=o(t,"height",256),u=o(t,"leftWidth",10),c=o(t,"rightWidth",10),d=o(t,"topHeight",0),f=o(t,"bottomHeight",0),p=new a(this.scene,0,0,i,n,h,l,u,c,d,f);return void 0!==e&&(t.add=e),s(this.scene,p,t),p}))},47521:(t,e,i)=>{var s=i(28103);i(39429).register("nineslice",(function(t,e,i,n,r,o,a,h,l,u){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a,h,l,u))}))},78023:(t,e,i)=>{var s,n=i(29747);s=i(52230),t.exports={renderWebGL:s,renderCanvas:n}},52230:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){var o=e.vertices,a=o.length;if(0!==a){i.addToRenderList(e);var h=t.pipelines.set(e.pipeline,e),l=s(e,i,r,!1).calc;t.pipelines.preBatch(e);var u=h.setGameObject(e),c=h.vertexViewF32,d=h.vertexViewU32,f=h.vertexCount*h.currentShader.vertexComponentCount-1,p=i.roundPixels,v=e.tintFill,g=i.alpha*e.alpha,m=n.getTintAppendFloatAlpha(e.tint,g),y=h.vertexAvailable(),x=-1;y{var s=i(83419),n=i(44777),r=i(37589),o=i(6113),a=i(91389),h=i(90664),l=new s({Extends:n,initialize:function(t){n.call(this,t,null,!1),this.active=!1,this.easeName="Linear",this.r=[],this.g=[],this.b=[]},getMethod:function(){return null===this.propertyValue?0:9},setMethods:function(){var t=this.propertyValue,e=t,i=this.defaultEmit,s=this.defaultUpdate;if(9===this.method){this.start=t[0],this.ease=o("Linear"),this.interpolation=a("linear"),i=this.easedValueEmit,s=this.easeValueUpdate,e=t[0],this.active=!0;for(var n=0;n{var s=i(30976),n=i(45319),r=i(83419),o=i(99472),a=i(6113),h=i(95540),l=i(91389),u=i(77720),c=i(15994),d=new r({initialize:function(t,e,i){void 0===i&&(i=!1),this.propertyKey=t,this.propertyValue=e,this.defaultValue=e,this.steps=0,this.counter=0,this.yoyo=!1,this.direction=0,this.start=0,this.current=0,this.end=0,this.ease=null,this.interpolation=null,this.emitOnly=i,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.active=!0,this.method=0,this._onEmit,this._onUpdate},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=h(t,this.propertyKey,this.defaultValue),this.method=this.getMethod(),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return JSON.stringify(this.propertyValue)},onChange:function(t){var e;switch(this.method){case 1:case 3:case 8:e=t;break;case 2:this.propertyValue.indexOf(t)>=0&&(e=t);break;case 4:var i=(this.end-this.start)/this.steps;e=u(t,i),this.counter=e;break;case 5:case 6:case 7:e=n(t,this.start,this.end);break;case 9:e=this.start[0]}return this.current=e,this},getMethod:function(){var t=this.propertyValue;if(null===t)return 0;var e=typeof t;if("number"===e)return 1;if(Array.isArray(t))return 2;if("function"===e)return 3;if("object"===e){if(this.hasBoth(t,"start","end"))return this.has(t,"steps")?4:5;if(this.hasBoth(t,"min","max"))return 6;if(this.has(t,"random"))return 7;if(this.hasEither(t,"onEmit","onUpdate"))return 8;if(this.hasEither(t,"values","interpolation"))return 9}return 0},setMethods:function(){var t=this.propertyValue,e=t,i=this.defaultEmit,s=this.defaultUpdate;switch(this.method){case 1:i=this.staticValueEmit;break;case 2:i=this.randomStaticValueEmit,e=t[0];break;case 3:this._onEmit=t,i=this.proxyEmit;break;case 4:this.start=t.start,this.end=t.end,this.steps=t.steps,this.counter=this.start,this.yoyo=!!this.has(t,"yoyo")&&t.yoyo,this.direction=0,i=this.steppedEmit,e=this.start;break;case 5:this.start=t.start,this.end=t.end;var n=this.has(t,"ease")?t.ease:"Linear";this.ease=a(n,t.easeParams),i=this.has(t,"random")&&t.random?this.randomRangedValueEmit:this.easedValueEmit,s=this.easeValueUpdate,e=this.start;break;case 6:this.start=t.min,this.end=t.max,i=this.has(t,"int")&&t.int?this.randomRangedIntEmit:this.randomRangedValueEmit,e=this.start;break;case 7:var r=t.random;Array.isArray(r)&&(this.start=r[0],this.end=r[1]),i=this.randomRangedIntEmit,e=this.start;break;case 8:this._onEmit=this.has(t,"onEmit")?t.onEmit:this.defaultEmit,this._onUpdate=this.has(t,"onUpdate")?t.onUpdate:this.defaultUpdate,i=this.proxyEmit,s=this.proxyUpdate;break;case 9:this.start=t.values;var o=this.has(t,"ease")?t.ease:"Linear";this.ease=a(o,t.easeParams),this.interpolation=l(t.interpolation),i=this.easedValueEmit,s=this.easeValueUpdate,e=this.start[0]}return this.onEmit=i,this.onUpdate=s,this.current=e,this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,s){return s},proxyEmit:function(t,e,i){var s=this._onEmit(t,e,i);return this.current=s,s},proxyUpdate:function(t,e,i,s){var n=this._onUpdate(t,e,i,s);return this.current=n,n},staticValueEmit:function(){return this.current},staticValueUpdate:function(){return this.current},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.current=this.propertyValue[t],this.current},randomRangedValueEmit:function(t,e){var i=o(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i,t.data[e].max=this.end),this.current=i,i},randomRangedIntEmit:function(t,e){var i=s(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i,t.data[e].max=this.end),this.current=i,i},steppedEmit:function(){var t,e=this.counter,i=e,s=(this.end-this.start)/this.steps;return this.yoyo?(0===this.direction?(i+=s)>=this.end&&(t=i-this.end,i=this.end-t,this.direction=1):(i-=s)<=this.start&&(t=this.start-i,i=this.start+t,this.direction=0),this.counter=i):this.counter=c(i+s,this.start,this.end),this.current=e,e},easedValueEmit:function(t,e){if(t&&t.data[e]){var i=t.data[e];i.min=this.start,i.max=this.end}return this.current=this.start,this.start},easeValueUpdate:function(t,e,i){var s,n=t.data[e],r=this.ease(i);return s=this.interpolation?this.interpolation(this.start,r):(n.max-n.min)*r+n.min,this.current=s,s},destroy:function(){this.propertyValue=null,this.defaultValue=null,this.ease=null,this.interpolation=null,this._onEmit=null,this._onUpdate=null}});t.exports=d},24502:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(20286),o=new s({Extends:r,initialize:function(t,e,i,s,o){if("object"==typeof t){var a=t;t=n(a,"x",0),e=n(a,"y",0),i=n(a,"power",0),s=n(a,"epsilon",100),o=n(a,"gravity",50)}else void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=100),void 0===o&&(o=50);r.call(this,t,e,!0),this._gravity=o,this._power=i*o,this._epsilon=s*s},update:function(t,e){var i=this.x-t.x,s=this.y-t.y,n=i*i+s*s;if(0!==n){var r=Math.sqrt(n);n{var s=i(9674),n=i(45319),r=i(83419),o=i(39506),a=i(87841),h=i(11520),l=i(26099),u=new r({initialize:function(t){this.emitter=t,this.texture=null,this.frame=null,this.x=0,this.y=0,this.worldPosition=new l,this.velocityX=0,this.velocityY=0,this.accelerationX=0,this.accelerationY=0,this.maxVelocityX=1e4,this.maxVelocityY=1e4,this.bounce=0,this.scaleX=1,this.scaleY=1,this.alpha=1,this.angle=0,this.rotation=0,this.tint=16777215,this.life=1e3,this.lifeCurrent=1e3,this.delayCurrent=0,this.holdCurrent=0,this.lifeT=0,this.data={tint:{min:16777215,max:16777215},alpha:{min:1,max:1},rotate:{min:0,max:0},scaleX:{min:1,max:1},scaleY:{min:1,max:1},x:{min:0,max:0},y:{min:0,max:0},accelerationX:{min:0,max:0},accelerationY:{min:0,max:0},maxVelocityX:{min:0,max:0},maxVelocityY:{min:0,max:0},moveToX:{min:0,max:0},moveToY:{min:0,max:0},bounce:{min:0,max:0}},this.isCropped=!1,this.scene=t.scene,this.anims=new s(this),this.bounds=new a},emit:function(t,e,i,s,n,r){return this.emitter.emit(t,e,i,s,n,r)},isAlive:function(){return this.lifeCurrent>0},kill:function(){this.lifeCurrent=0},setPosition:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e},fire:function(t,e){var i=this.emitter,s=i.ops,n=i.getAnim();if(n?this.anims.play(n):(this.frame=i.getFrame(),this.texture=this.frame.texture),!this.frame)throw new Error("Particle has no texture frame");if(i.getEmitZone(this),void 0===t?this.x+=s.x.onEmit(this,"x"):s.x.steps>0?this.x+=t+s.x.onEmit(this,"x"):this.x+=t,void 0===e?this.y+=s.y.onEmit(this,"y"):s.y.steps>0?this.y+=e+s.y.onEmit(this,"y"):this.y+=e,this.life=s.lifespan.onEmit(this,"lifespan"),this.lifeCurrent=this.life,this.lifeT=0,this.delayCurrent=s.delay.onEmit(this,"delay"),this.holdCurrent=s.hold.onEmit(this,"hold"),this.scaleX=s.scaleX.onEmit(this,"scaleX"),this.scaleY=s.scaleY.active?s.scaleY.onEmit(this,"scaleY"):this.scaleX,this.angle=s.rotate.onEmit(this,"rotate"),this.rotation=o(this.angle),i.worldMatrix.transformPoint(this.x,this.y,this.worldPosition),0===this.delayCurrent&&i.getDeathZone(this))return this.lifeCurrent=0,!1;var r=s.speedX.onEmit(this,"speedX"),a=s.speedY.active?s.speedY.onEmit(this,"speedY"):r;if(i.radial){var h=o(s.angle.onEmit(this,"angle"));this.velocityX=Math.cos(h)*Math.abs(r),this.velocityY=Math.sin(h)*Math.abs(a)}else if(i.moveTo){var l=s.moveToX.onEmit(this,"moveToX"),u=s.moveToY.onEmit(this,"moveToY"),c=this.life/1e3;this.velocityX=(l-this.x)/c,this.velocityY=(u-this.y)/c}else this.velocityX=r,this.velocityY=a;return i.acceleration&&(this.accelerationX=s.accelerationX.onEmit(this,"accelerationX"),this.accelerationY=s.accelerationY.onEmit(this,"accelerationY")),this.maxVelocityX=s.maxVelocityX.onEmit(this,"maxVelocityX"),this.maxVelocityY=s.maxVelocityY.onEmit(this,"maxVelocityY"),this.bounce=s.bounce.onEmit(this,"bounce"),this.alpha=s.alpha.onEmit(this,"alpha"),s.color.active?this.tint=s.color.onEmit(this,"tint"):this.tint=s.tint.onEmit(this,"tint"),!0},update:function(t,e,i){if(this.lifeCurrent<=0)return!(this.holdCurrent>0)||(this.holdCurrent-=t,this.holdCurrent<=0);if(this.delayCurrent>0)return this.delayCurrent-=t,!1;this.anims.update(0,t);var s=this.emitter,r=s.ops,a=1-this.lifeCurrent/this.life;if(this.lifeT=a,this.x=r.x.onUpdate(this,"x",a,this.x),this.y=r.y.onUpdate(this,"y",a,this.y),s.moveTo){var h=r.moveToX.onUpdate(this,"moveToX",a,s.moveToX),l=r.moveToY.onUpdate(this,"moveToY",a,s.moveToY),u=this.lifeCurrent/1e3;this.velocityX=(h-this.x)/u,this.velocityY=(l-this.y)/u}return this.computeVelocity(s,t,e,i,a),this.scaleX=r.scaleX.onUpdate(this,"scaleX",a,this.scaleX),r.scaleY.active?this.scaleY=r.scaleY.onUpdate(this,"scaleY",a,this.scaleY):this.scaleY=this.scaleX,this.angle=r.rotate.onUpdate(this,"rotate",a,this.angle),this.rotation=o(this.angle),s.getDeathZone(this)?(this.lifeCurrent=0,!0):(this.alpha=n(r.alpha.onUpdate(this,"alpha",a,this.alpha),0,1),r.color.active?this.tint=r.color.onUpdate(this,"color",a,this.tint):this.tint=r.tint.onUpdate(this,"tint",a,this.tint),this.lifeCurrent-=t,this.lifeCurrent<=0&&this.holdCurrent<=0)},computeVelocity:function(t,e,i,s,r){var o=t.ops,a=this.velocityX,h=this.velocityY,l=o.accelerationX.onUpdate(this,"accelerationX",r,this.accelerationX),u=o.accelerationY.onUpdate(this,"accelerationY",r,this.accelerationY),c=o.maxVelocityX.onUpdate(this,"maxVelocityX",r,this.maxVelocityX),d=o.maxVelocityY.onUpdate(this,"maxVelocityY",r,this.maxVelocityY);this.bounce=o.bounce.onUpdate(this,"bounce",r,this.bounce),a+=t.gravityX*i+l*i,h+=t.gravityY*i+u*i,a=n(a,-c,c),h=n(h,-d,d),this.velocityX=a,this.velocityY=h,this.x+=a*i,this.y+=h*i,t.worldMatrix.transformPoint(this.x,this.y,this.worldPosition);for(var f=0;f{var s=i(83419),n=i(20286),r=i(87841),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h,l){void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===h&&(h=!0),void 0===l&&(l=!0),n.call(this,t,e,!0),this.bounds=new r(t,e,i,s),this.collideLeft=o,this.collideRight=a,this.collideTop=h,this.collideBottom=l},update:function(t){var e=this.bounds,i=-t.bounce,s=t.worldPosition;s.xe.right&&this.collideRight&&(t.x-=s.x-e.right,t.velocityX*=i),s.ye.bottom&&this.collideBottom&&(t.y-=s.y-e.bottom,t.velocityY*=i)}});t.exports=o},31600:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(53774),o=i(43459),a=i(26388),h=i(19909),l=i(76472),u=i(44777),c=i(20696),d=i(95643),f=i(95540),p=i(26546),v=i(24502),g=i(1985),m=i(97022),y=i(86091),x=i(73162),T=i(20074),w=i(56480),b=i(68875),S=i(87841),E=i(59996),A=i(72905),C=i(90668),_=i(19186),M=i(61340),P=i(26099),R=i(15994),L=i(69601),O=["active","advance","blendMode","colorEase","deathCallback","deathCallbackScope","duration","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxAliveParticles","maxParticles","name","emitting","particleBringToTop","particleClass","radial","sortCallback","sortOrderAsc","sortProperty","stopAfter","tintFill","timeScale","trackVisible","visible"],F=["accelerationX","accelerationY","alpha","angle","bounce","color","delay","hold","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],D=new s({Extends:d,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.Mask,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Texture,n.Transform,n.Visible,C],initialize:function(t,e,i,s,n){d.call(this,t,"ParticleEmitter"),this.particleClass=w,this.ops={accelerationX:new u("accelerationX",0),accelerationY:new u("accelerationY",0),alpha:new u("alpha",1),angle:new u("angle",{min:0,max:360},!0),bounce:new u("bounce",0),color:new l("color"),delay:new u("delay",0,!0),hold:new u("hold",0,!0),lifespan:new u("lifespan",1e3,!0),maxVelocityX:new u("maxVelocityX",1e4),maxVelocityY:new u("maxVelocityY",1e4),moveToX:new u("moveToX",0),moveToY:new u("moveToY",0),quantity:new u("quantity",1,!0),rotate:new u("rotate",0),scaleX:new u("scaleX",1),scaleY:new u("scaleY",1),speedX:new u("speedX",0,!0),speedY:new u("speedY",0,!0),tint:new u("tint",16777215),x:new u("x",0),y:new u("y",0)},this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.moveTo=!1,this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.maxAliveParticles=0,this.stopAfter=0,this.duration=0,this.frequency=0,this.emitting=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZones=[],this.deathZones=[],this.viewBounds=null,this.follow=null,this.followOffset=new P,this.trackVisible=!1,this.frames=[],this.randomFrame=!0,this.frameQuantity=1,this.anims=[],this.randomAnim=!0,this.animQuantity=1,this.dead=[],this.alive=[],this.counters=new Float32Array(10),this.skipping=!1,this.worldMatrix=new M,this.sortProperty="",this.sortOrderAsc=!0,this.sortCallback=this.depthSortCallback,this.processors=new x(this),this.tintFill=!1,this.initPipeline(),this.initPostPipeline(),this.setPosition(e,i),this.setTexture(s),n&&this.setConfig(n)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},setConfig:function(t){if(!t)return this;var e=0,i="",s=this.ops;for(e=0;e=this.animQuantity&&(this.animCounter=0,this.currentAnim=R(this.currentAnim+1,0,e)),i},setAnim:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=1),this.randomAnim=e,this.animQuantity=i,this.currentAnim=0;var s=typeof t;if(this.anims.length=0,Array.isArray(t))this.anims=this.anims.concat(t);else if("string"===s)this.anims.push(t);else if("object"===s){var n=t;(t=f(n,"anims",null))&&(this.anims=this.anims.concat(t));var r=f(n,"cycle",!1);this.randomAnim=!r,this.animQuantity=f(n,"quantity",i)}return 1===this.anims.length&&(this.animQuantity=1,this.randomAnim=!1),this},setRadial:function(t){return void 0===t&&(t=!0),this.radial=t,this},addParticleBounds:function(t,e,i,s,n,r,o,a){if("object"==typeof t){var h=t;t=h.x,e=h.y,i=m(h,"w")?h.w:h.width,s=m(h,"h")?h.h:h.height}return this.addParticleProcessor(new L(t,e,i,s,n,r,o,a))},setParticleSpeed:function(t,e){return void 0===e&&(e=t),this.ops.speedX.onChange(t),t===e?this.ops.speedY.active=!1:this.ops.speedY.onChange(e),this.radial=!0,this},setParticleScale:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.ops.scaleX.onChange(t),this.ops.scaleY.onChange(e),this},setParticleGravity:function(t,e){return this.gravityX=t,this.gravityY=e,this},setParticleAlpha:function(t){return this.ops.alpha.onChange(t),this},setParticleTint:function(t){return this.ops.tint.onChange(t),this},setEmitterAngle:function(t){return this.ops.angle.onChange(t),this},setParticleLifespan:function(t){return this.ops.lifespan.onChange(t),this},setQuantity:function(t){return this.quantity=t,this},setFrequency:function(t,e){return this.frequency=t,this.flowCounter=t>0?t:0,e&&(this.quantity=e),this},addDeathZone:function(t){var e;Array.isArray(t)||(t=[t]);for(var i=[],s=0;s-1&&(this.zoneTotal++,this.zoneTotal===s.total&&(this.zoneTotal=0,this.zoneIndex++,this.zoneIndex===i&&(this.zoneIndex=0)))}},getDeathZone:function(t){for(var e=this.deathZones,i=0;i=0&&(this.zoneIndex=e),this},addParticleProcessor:function(t){return this.processors.exists(t)||(t.emitter&&t.emitter.removeParticleProcessor(t),this.processors.add(t),t.emitter=this),t},removeParticleProcessor:function(t){return this.processors.exists(t)&&(this.processors.remove(t,!0),t.emitter=null),t},getProcessors:function(){return this.processors.getAll("active",!0)},createGravityWell:function(t){return this.addParticleProcessor(new v(t))},reserve:function(t){var e=this.dead;if(this.maxParticles>0){var i=this.getParticleCount();i+t>this.maxParticles&&(t=this.maxParticles-(i+t))}for(var s=0;s0&&this.getParticleCount()>=this.maxParticles||this.maxAliveParticles>0&&this.getAliveParticleCount()>=this.maxAliveParticles},onParticleEmit:function(t,e){return void 0===t?(this.emitCallback=null,this.emitCallbackScope=null):"function"==typeof t&&(this.emitCallback=t,e&&(this.emitCallbackScope=e)),this},onParticleDeath:function(t,e){return void 0===t?(this.deathCallback=null,this.deathCallbackScope=null):"function"==typeof t&&(this.deathCallback=t,e&&(this.deathCallbackScope=e)),this},killAll:function(){for(var t=this.dead,e=this.alive;e.length>0;)t.push(e.pop());return this},forEachAlive:function(t,e){for(var i=this.alive,s=i.length,n=0;n0&&this.fastForward(t),this.emitting=!0,this.resetCounters(this.frequency,!0),void 0!==e&&(this.duration=Math.abs(e)),this.emit(c.START,this)),this},stop:function(t){return void 0===t&&(t=!1),this.emitting&&(this.emitting=!1,t&&this.killAll(),this.emit(c.STOP,this)),this},pause:function(){return this.active=!1,this},resume:function(){return this.active=!0,this},setSortProperty:function(t,e){return void 0===t&&(t=""),void 0===e&&(e=this.true),this.sortProperty=t,this.sortOrderAsc=e,this.sortCallback=this.depthSortCallback,this},setSortCallback:function(t){return t=""!==this.sortProperty?this.depthSortCallback:null,this.sortCallback=t,this},depthSort:function(){return _(this.alive,this.sortCallback.bind(this)),this},depthSortCallback:function(t,e){var i=this.sortProperty;return this.sortOrderAsc?t[i]-e[i]:e[i]-t[i]},flow:function(t,e,i){return void 0===e&&(e=1),this.emitting=!1,this.frequency=t,this.quantity=e,void 0!==i&&(this.stopAfter=i),this.start()},explode:function(t,e,i){this.frequency=-1,this.resetCounters(-1,!0);var s=this.emitParticle(t,e,i);return this.emit(c.EXPLODE,this,s),s},emitParticleAt:function(t,e,i){return this.emitParticle(i,t,e)},emitParticle:function(t,e,i){if(!this.atLimit()){void 0===t&&(t=this.ops.quantity.onEmit());for(var s=this.dead,n=this.stopAfter,r=this.follow?this.follow.x+this.followOffset.x:e,o=this.follow?this.follow.y+this.followOffset.y:i,a=0;a0&&(this.stopCounter++,this.stopCounter>=n))break;if(this.atLimit())break}return h}},fastForward:function(t,e){void 0===e&&(e=1e3/60);var i=0;for(this.skipping=!0;i0){var u=this.deathCallback,d=this.deathCallbackScope;for(o=h-1;o>=0;o--){var f=a[o];n.splice(f.index,1),r.push(f.particle),u&&u.call(d,f.particle),f.particle.setPosition()}}if(this.emitting||this.skipping){if(0===this.frequency)this.emitParticle();else if(this.frequency>0)for(this.flowCounter-=e;this.flowCounter<=0;)this.emitParticle(),this.flowCounter+=this.frequency;this.skipping||(this.duration>0&&(this.elapsed+=e,this.elapsed>=this.duration&&this.stop()),this.stopAfter>0&&this.stopCounter>=this.stopAfter&&this.stop())}else 1===this.completeFlag&&0===n.length&&(this.completeFlag=0,this.emit(c.COMPLETE,this))},overlap:function(t){for(var e=this.getWorldTransformMatrix(),i=this.alive,s=i.length,n=[],r=0;r0){var u=0;for(this.skipping=!0;u0&&y(s,t,t),s},createEmitter:function(){throw new Error("createEmitter removed. See ParticleEmitter docs for info")},particleX:{get:function(){return this.ops.x.current},set:function(t){this.ops.x.onChange(t)}},particleY:{get:function(){return this.ops.y.current},set:function(t){this.ops.y.onChange(t)}},accelerationX:{get:function(){return this.ops.accelerationX.current},set:function(t){this.ops.accelerationX.onChange(t)}},accelerationY:{get:function(){return this.ops.accelerationY.current},set:function(t){this.ops.accelerationY.onChange(t)}},maxVelocityX:{get:function(){return this.ops.maxVelocityX.current},set:function(t){this.ops.maxVelocityX.onChange(t)}},maxVelocityY:{get:function(){return this.ops.maxVelocityY.current},set:function(t){this.ops.maxVelocityY.onChange(t)}},speed:{get:function(){return this.ops.speedX.current},set:function(t){this.ops.speedX.onChange(t),this.ops.speedY.onChange(t)}},speedX:{get:function(){return this.ops.speedX.current},set:function(t){this.ops.speedX.onChange(t)}},speedY:{get:function(){return this.ops.speedY.current},set:function(t){this.ops.speedY.onChange(t)}},moveToX:{get:function(){return this.ops.moveToX.current},set:function(t){this.ops.moveToX.onChange(t)}},moveToY:{get:function(){return this.ops.moveToY.current},set:function(t){this.ops.moveToY.onChange(t)}},bounce:{get:function(){return this.ops.bounce.current},set:function(t){this.ops.bounce.onChange(t)}},particleScaleX:{get:function(){return this.ops.scaleX.current},set:function(t){this.ops.scaleX.onChange(t)}},particleScaleY:{get:function(){return this.ops.scaleY.current},set:function(t){this.ops.scaleY.onChange(t)}},particleColor:{get:function(){return this.ops.color.current},set:function(t){this.ops.color.onChange(t)}},colorEase:{get:function(){return this.ops.color.easeName},set:function(t){this.ops.color.setEase(t)}},particleTint:{get:function(){return this.ops.tint.current},set:function(t){this.ops.tint.onChange(t)}},particleAlpha:{get:function(){return this.ops.alpha.current},set:function(t){this.ops.alpha.onChange(t)}},lifespan:{get:function(){return this.ops.lifespan.current},set:function(t){this.ops.lifespan.onChange(t)}},particleAngle:{get:function(){return this.ops.angle.current},set:function(t){this.ops.angle.onChange(t)}},particleRotate:{get:function(){return this.ops.rotate.current},set:function(t){this.ops.rotate.onChange(t)}},quantity:{get:function(){return this.ops.quantity.current},set:function(t){this.ops.quantity.onChange(t)}},delay:{get:function(){return this.ops.delay.current},set:function(t){this.ops.delay.onChange(t)}},hold:{get:function(){return this.ops.hold.current},set:function(t){this.ops.hold.onChange(t)}},flowCounter:{get:function(){return this.counters[0]},set:function(t){this.counters[0]=t}},frameCounter:{get:function(){return this.counters[1]},set:function(t){this.counters[1]=t}},animCounter:{get:function(){return this.counters[2]},set:function(t){this.counters[2]=t}},elapsed:{get:function(){return this.counters[3]},set:function(t){this.counters[3]=t}},stopCounter:{get:function(){return this.counters[4]},set:function(t){this.counters[4]=t}},completeFlag:{get:function(){return this.counters[5]},set:function(t){this.counters[5]=t}},zoneIndex:{get:function(){return this.counters[6]},set:function(t){this.counters[6]=t}},zoneTotal:{get:function(){return this.counters[7]},set:function(t){this.counters[7]=t}},currentFrame:{get:function(){return this.counters[8]},set:function(t){this.counters[8]=t}},currentAnim:{get:function(){return this.counters[9]},set:function(t){this.counters[9]=t}},preDestroy:function(){var t;this.texture=null,this.frames=null,this.anims=null,this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.emitZones=null,this.deathZones=null,this.bounds=null,this.follow=null,this.counters=null;var e=this.ops;for(t=0;t{var s=i(59996),n=i(61340),r=new n,o=new n,a=new n,h=new n;t.exports=function(t,e,i,n){var l=r,u=o,c=a,d=h;n?(d.loadIdentity(),d.multiply(n),d.translate(e.x,e.y),d.rotate(e.rotation),d.scale(e.scaleX,e.scaleY)):d.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);var f=t.currentContext,p=i.roundPixels,v=i.alpha,g=e.alpha,m=e.alive,y=m.length,x=e.viewBounds;if(e.visible&&0!==y&&(!x||s(x,i.worldView))){e.sortCallback&&e.depthSort(),i.addToRenderList(e);var T=e.scrollFactorX,w=e.scrollFactorY;f.save(),f.globalCompositeOperation=t.blendModes[e.blendMode];for(var b=0;b0&&C.height>0){var _=-A.halfWidth,M=-A.halfHeight;f.globalAlpha=E,f.save(),u.setToContext(f),p&&(_=Math.round(_),M=Math.round(M)),f.imageSmoothingEnabled=!A.source.scaleMode,f.drawImage(A.source.image,C.x,C.y,C.width,C.height,_,M,C.width,C.height),f.restore()}}}f.restore()}}},92730:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(95540),a=i(31600);n.register("particles",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=o(t,"config",null),h=new a(this.scene,0,0,i);return void 0!==e&&(t.add=e),s(this.scene,h,t),n&&h.setConfig(n),h}))},676:(t,e,i)=>{var s=i(39429),n=i(31600);s.register("particles",(function(t,e,i,s){return void 0!==t&&"string"==typeof t&&console.warn("ParticleEmitterManager was removed in Phaser 3.60. See documentation for details"),this.displayList.add(new n(this.scene,t,e,i,s))}))},90668:(t,e,i)=>{var s,n;i(29747),s=i(21188),n=i(9871),t.exports={renderWebGL:s,renderCanvas:n}},21188:(t,e,i)=>{var s=i(59996),n=i(61340),r=i(70554),o=new n,a=new n,h=new n,l=new n;t.exports=function(t,e,i,n){var u=t.pipelines.set(e.pipeline),c=o,d=a,f=h,p=l;n?(p.loadIdentity(),p.multiply(n),p.translate(e.x,e.y),p.rotate(e.rotation),p.scale(e.scaleX,e.scaleY)):p.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);var v=r.getTintAppendFloatAlpha,g=i.alpha,m=e.alpha;t.pipelines.preBatch(e);var y=e.alive,x=y.length,T=e.viewBounds;if(0!==x&&(!T||s(T,i.worldView))){e.sortCallback&&e.depthSort(),i.addToRenderList(e),c.copyFrom(i.matrix),c.multiplyWithOffset(p,-i.scrollX*e.scrollFactorX,-i.scrollY*e.scrollFactorY),t.setBlendMode(e.blendMode),e.mask&&(e.mask.preRenderWebGL(t,e,i),t.pipelines.set(e.pipeline));for(var w,b,S=e.tintFill,E=0;E{var s=new(i(83419))({initialize:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=!0),this.emitter,this.x=t,this.y=e,this.active=i},update:function(){},destroy:function(){this.emitter=null}});t.exports=s},9774:t=>{t.exports="complete"},812:t=>{t.exports="deathzone"},30522:t=>{t.exports="explode"},96695:t=>{t.exports="start"},18677:t=>{t.exports="stop"},20696:(t,e,i)=>{t.exports={COMPLETE:i(9774),DEATH_ZONE:i(812),EXPLODE:i(30522),START:i(96695),STOP:i(18677)}},18404:(t,e,i)=>{t.exports={EmitterColorOp:i(76472),EmitterOp:i(44777),Events:i(20696),GravityWell:i(24502),Particle:i(56480),ParticleBounds:i(69601),ParticleEmitter:i(31600),ParticleProcessor:i(20286),Zones:i(21024)}},26388:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e){this.source=t,this.killOnEnter=e},willKill:function(t){var e=t.worldPosition,i=this.source.contains(e.x,e.y);return i&&this.killOnEnter||!i&&!this.killOnEnter}});t.exports=s},19909:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s,n,r){void 0===s&&(s=!1),void 0===n&&(n=!0),void 0===r&&(r=-1),this.source=t,this.points=[],this.quantity=e,this.stepRate=i,this.yoyo=s,this.counter=-1,this.seamless=n,this._length=0,this._direction=0,this.total=r,this.updateSource()},updateSource:function(){if(this.points=this.source.getPoints(this.quantity,this.stepRate),this.seamless){var t=this.points[0],e=this.points[this.points.length-1];t.x===e.x&&t.y===e.y&&this.points.pop()}var i=this._length;return this._length=this.points.length,this._lengththis._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=s},68875:(t,e,i)=>{var s=i(83419),n=i(26099),r=new s({initialize:function(t){this.source=t,this._tempVec=new n,this.total=-1},getPoint:function(t){var e=this._tempVec;this.source.getRandomPoint(e),t.x=e.x,t.y=e.y}});t.exports=r},21024:(t,e,i)=>{t.exports={DeathZone:i(26388),EdgeZone:i(19909),RandomZone:i(68875)}},1159:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(68287),o=new s({Extends:r,Mixins:[n.PathFollower],initialize:function(t,e,i,s,n,o){r.call(this,t,i,s,n,o),this.path=e},preUpdate:function(t,e){this.anims.update(t,e),this.pathUpdate(t)}});t.exports=o},90145:(t,e,i)=>{var s=i(39429),n=i(1159);s.register("follower",(function(t,e,i,s,r){var o=new n(this.scene,t,e,i,s,r);return this.displayList.add(o),this.updateList.add(o),o}))},33663:(t,e,i)=>{var s=i(9674),n=i(83419),r=i(48803),o=i(90664),a=i(4703),h=i(45650),l=new n({Extends:a,initialize:function(t,e,i,n,r,o,h,l){n||(n="__DEFAULT"),a.call(this,t,e,i,n,r),this.type="Plane",this.anims=new s(this),this.gridWidth,this.gridHeight,this.isTiled,this._checkerboard=null,this.hideCCW=!1,this.setGridSize(o,h,l),this.setSizeToFrame(!1),this.setViewHeight()},originX:{get:function(){return.5}},originY:{get:function(){return.5}},setGridSize:function(t,e,i){void 0===t&&(t=8),void 0===e&&(e=8),void 0===i&&(i=!1);var s=!1;return i&&(s=!0),this.gridWidth=t,this.gridHeight=e,this.isTiled=i,this.clear(),r({mesh:this,widthSegments:t,heightSegments:e,isOrtho:!1,tile:i,flipY:s}),this},setSizeToFrame:function(t){void 0===t&&(t=!0);var e=this.frame;if(this.setPerspective(this.width/e.width,this.height/e.height),this._checkerboard&&this._checkerboard!==this.texture&&this.removeCheckerboard(),!t)return this;var i,s,n=this.gridWidth,r=this.gridHeight,o=this.vertices,a=e.u0,h=e.u1,l=e.v0,u=e.v1,c=0;if(this.isTiled)for(l=e.v1,u=e.v0,s=0;s7&&c>7?l.push(r.r,r.g,r.b,i):l.push(a.r,a.g,a.b,s);var d=this.scene.sys.textures.addUint8Array(h(),new Uint8Array(l),16,16);return this.removeCheckerboard(),this.setTexture(d),this.setSizeToFrame(),this.setViewHeight(n),this},removeCheckerboard:function(){this._checkerboard&&(this._checkerboard.destroy(),this._checkerboard=null)},play:function(t,e){return this.anims.play(t,e)},playReverse:function(t,e){return this.anims.playReverse(t,e)},playAfterDelay:function(t,e){return this.anims.playAfterDelay(t,e)},playAfterRepeat:function(t,e){return this.anims.playAfterRepeat(t,e)},stop:function(){return this.anims.stop()},stopAfterDelay:function(t){return this.anims.stopAfterDelay(t)},stopAfterRepeat:function(t){return this.anims.stopAfterRepeat(t)},stopOnFrame:function(t){return this.anims.stopOnFrame(t)},preUpdate:function(t,e){a.prototype.preUpdate.call(this,t,e),this.anims.update(t,e)},preDestroy:function(){this.clear(),this.removeCheckerboard(),this.anims.destroy(),this.anims=void 0,this.debugCallback=null,this.debugGraphic=null}});t.exports=l},56015:(t,e,i)=>{var s=i(25305),n=i(13059),r=i(44603),o=i(23568),a=i(35154),h=i(33663);r.register("plane",(function(t,e){void 0===t&&(t={});var i=o(t,"key",null),r=o(t,"frame",null),l=a(t,"width",8),u=a(t,"height",8),c=a(t,"tile",!1),d=new h(this.scene,0,0,i,r,l,u,c);void 0!==e&&(t.add=e);var f=a(t,"checkerboard",null);if(f){var p=a(f,"color1",16777215),v=a(f,"color2",255),g=a(f,"alpha1",255),m=a(f,"alpha2",255),y=a(f,"height",128);d.createCheckerboard(p,v,g,m,y)}return s(this.scene,d,t),n(d,t),d}))},30985:(t,e,i)=>{var s=i(33663);i(39429).register("plane",(function(t,e,i,n,r,o,a){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a))}))},80321:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(95643),o=i(30100),a=i(36060),h=i(67277),l=new s({Extends:r,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.Mask,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Transform,n.Visible,h],initialize:function(t,e,i,s,n,h,l){void 0===s&&(s=16777215),void 0===n&&(n=128),void 0===h&&(h=1),void 0===l&&(l=.1),r.call(this,t,"PointLight"),this.initPipeline(a.POINTLIGHT_PIPELINE),this.initPostPipeline(),this.setPosition(e,i),this.color=o(s),this.intensity=h,this.attenuation=l,this.width=2*n,this.height=2*n,this._radius=n},radius:{get:function(){return this._radius},set:function(t){this._radius=t,this.width=2*t,this.height=2*t}},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return this._radius}},displayOriginY:{get:function(){return this._radius}}});t.exports=l},39829:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(80321);n.register("pointlight",(function(t,e){void 0===t&&(t={});var i=r(t,"color",16777215),n=r(t,"radius",128),a=r(t,"intensity",1),h=r(t,"attenuation",.1),l=new o(this.scene,0,0,i,n,a,h);return void 0!==e&&(t.add=e),s(this.scene,l,t),l}))},71255:(t,e,i)=>{var s=i(39429),n=i(80321);s.register("pointlight",(function(t,e,i,s,r,o){return this.displayList.add(new n(this.scene,t,e,i,s,r,o))}))},67277:(t,e,i)=>{var s,n=i(29747);s=i(57787),t.exports={renderWebGL:s,renderCanvas:n}},57787:(t,e,i)=>{var s=i(91296);t.exports=function(t,e,i,n){i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),o=s(e,i,n).calc,a=e.width,h=e.height,l=-e._radius,u=-e._radius,c=l+a,d=u+h,f=o.getX(0,0),p=o.getY(0,0),v=o.getX(l,u),g=o.getY(l,u),m=o.getX(l,d),y=o.getY(l,d),x=o.getX(c,d),T=o.getY(c,d),w=o.getX(c,u),b=o.getY(c,u);t.pipelines.preBatch(e),r.batchPointLight(e,i,v,g,m,y,x,T,w,b,f,p),t.pipelines.postBatch(e)}},591:(t,e,i)=>{var s=i(83419),n=i(81320),r=i(88571),o=new s({Extends:r,initialize:function(t,e,i,s,o){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=32),void 0===o&&(o=32);var a=new n(t.sys.textures,"",s,o);r.call(this,t,e,i,a),this.type="RenderTexture",this.camera=this.texture.camera,this._saved=!1},setSize:function(t,e){this.width=t,this.height=e,this.texture.setSize(t,e),this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this},resize:function(t,e){return this.setSize(t,e),this},saveTexture:function(t){var e=this.texture;return e.key=t,e.manager.addDynamicTexture(e)&&(this._saved=!0),e},fill:function(t,e,i,s,n,r){return this.texture.fill(t,e,i,s,n,r),this},clear:function(){return this.texture.clear(),this},stamp:function(t,e,i,s,n){return this.texture.stamp(t,e,i,s,n),this},erase:function(t,e,i){return this.texture.erase(t,e,i),this},draw:function(t,e,i,s,n){return this.texture.draw(t,e,i,s,n),this},drawFrame:function(t,e,i,s,n,r){return this.texture.drawFrame(t,e,i,s,n,r),this},repeat:function(t,e,i,s,n,r,o,a,h){return this.texture.repeat(t,e,i,s,n,r,o,a,h),this},beginDraw:function(){return this.texture.beginDraw(),this},batchDraw:function(t,e,i,s,n){return this.texture.batchDraw(t,e,i,s,n),this},batchDrawFrame:function(t,e,i,s,n,r){return this.texture.batchDrawFrame(t,e,i,s,n,r),this},endDraw:function(t){return this.texture.endDraw(t),this},snapshotArea:function(t,e,i,s,n,r,o){return this.texture.snapshotArea(t,e,i,s,n,r,o),this},snapshot:function(t,e,i){return this.snapshotArea(0,0,this.width,this.height,t,e,i)},snapshotPixel:function(t,e,i){return this.snapshotArea(t,e,1,1,i,"pixel")},preDestroy:function(){this.camera=null,this._saved||this.texture.destroy()}});t.exports=o},34495:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(591);n.register("renderTexture",(function(t,e){void 0===t&&(t={});var i=r(t,"x",0),n=r(t,"y",0),a=r(t,"width",32),h=r(t,"height",32),l=new o(this.scene,i,n,a,h);return void 0!==e&&(t.add=e),s(this.scene,l,t),l}))},60505:(t,e,i)=>{var s=i(39429),n=i(591);s.register("renderTexture",(function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))}))},77757:(t,e,i)=>{var s=i(9674),n=i(83419),r=i(31401),o=i(95643),a=i(36060),h=i(38745),l=i(26099),u=new n({Extends:o,Mixins:[r.AlphaSingle,r.BlendMode,r.Depth,r.Flip,r.Mask,r.Pipeline,r.PostPipeline,r.Size,r.Texture,r.Transform,r.Visible,r.ScrollFactor,h],initialize:function(t,e,i,n,r,h,u,c,d){void 0===n&&(n="__DEFAULT"),void 0===h&&(h=2),void 0===u&&(u=!0),o.call(this,t,"Rope"),this.anims=new s(this),this.points=h,this.vertices,this.uv,this.colors,this.alphas,this.tintFill="__DEFAULT"===n,this.dirty=!1,this.horizontal=u,this._flipX=!1,this._flipY=!1,this._perp=new l,this.debugCallback=null,this.debugGraphic=null,this.setTexture(n,r),this.setPosition(e,i),this.setSizeToFrame(),this.initPipeline(a.ROPE_PIPELINE),this.initPostPipeline(),Array.isArray(h)&&this.resizeArrays(h.length),this.setPoints(h,c,d),this.updateVertices()},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},preUpdate:function(t,e){var i=this.anims.currentFrame;this.anims.update(t,e),this.anims.currentFrame!==i&&(this.updateUVs(),this.updateVertices())},play:function(t,e,i){return this.anims.play(t,e,i),this},setDirty:function(){return this.dirty=!0,this},setHorizontal:function(t,e,i){return void 0===t&&(t=this.points.length),this.horizontal?this:(this.horizontal=!0,this.setPoints(t,e,i))},setVertical:function(t,e,i){return void 0===t&&(t=this.points.length),this.horizontal?(this.horizontal=!1,this.setPoints(t,e,i)):this},setTintFill:function(t){return void 0===t&&(t=!1),this.tintFill=t,this},setAlphas:function(t,e){var i=this.points.length;if(i<1)return this;var s,n=this.alphas;void 0===t?t=[1]:Array.isArray(t)||void 0!==e||(t=[t]);var r=0;if(void 0!==e)for(s=0;sr&&(o=t[r]),n[r]=o,t.length>r+1&&(o=t[r+1]),n[r+1]=o}return this},setColors:function(t){var e=this.points.length;if(e<1)return this;var i,s=this.colors;void 0===t?t=[16777215]:Array.isArray(t)||(t=[t]);var n=0;if(t.length===e)for(i=0;in&&(r=t[n]),s[n]=r,t.length>n+1&&(r=t[n+1]),s[n+1]=r}return this},setPoints:function(t,e,i){if(void 0===t&&(t=2),"number"==typeof t){var s,n,r,o=t;if(o<2&&(o=2),t=[],this.horizontal)for(r=-this.frame.halfWidth,n=this.frame.width/(o-1),s=0;s{t.exports=function(){}},26209:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(35154),a=i(77757);n.register("rope",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=r(t,"frame",null),h=r(t,"horizontal",!0),l=o(t,"points",void 0),u=o(t,"colors",void 0),c=o(t,"alphas",void 0),d=new a(this.scene,0,0,i,n,l,h,u,c);return void 0!==e&&(t.add=e),s(this.scene,d,t),d}))},96819:(t,e,i)=>{var s=i(77757);i(39429).register("rope",(function(t,e,i,n,r,o,a,h){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a,h))}))},38745:(t,e,i)=>{var s,n;i(29747),s=i(20439),n=i(95262),t.exports={renderWebGL:s,renderCanvas:n}},20439:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.pipelines.set(e.pipeline,e),a=s(e,i,r).calc,h=e.vertices,l=e.uv,u=e.colors,c=e.alphas,d=e.alpha,f=n.getTintAppendFloatAlpha,p=i.roundPixels,v=h.length,g=Math.floor(.5*v);o.flush(),t.pipelines.preBatch(e);var m=o.setGameObject(e),y=o.vertexViewF32,x=o.vertexViewU32,T=o.vertexCount*o.currentShader.vertexComponentCount-1,w=0,b=e.tintFill;e.dirty&&e.updateVertices();for(var S=e.debugCallback,E=[],A=0;A{var s=i(83419),n=i(31401),r=i(95643),o=i(95540),a=i(79291),h=i(61622),l=i(25479),u=i(61340),c=i(95428),d=i(92503),f=new s({Extends:r,Mixins:[n.ComputedSize,n.Depth,n.GetBounds,n.Mask,n.Origin,n.ScrollFactor,n.Transform,n.Visible,l],initialize:function(t,e,i,s,n,o,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=128),void 0===o&&(o=128),r.call(this,t,"Shader"),this.blendMode=-1,this.shader;var l=t.sys.renderer;this.renderer=l,this.gl=l.gl,this.vertexData=new ArrayBuffer(2*Float32Array.BYTES_PER_ELEMENT*6),this.vertexBuffer=l.createVertexBuffer(this.vertexData.byteLength,this.gl.STREAM_DRAW),this._deferSetShader=null,this._deferProjOrtho=null,this.program=null,this.bytes=new Uint8Array(this.vertexData),this.vertexViewF32=new Float32Array(this.vertexData),this._tempMatrix1=new u,this._tempMatrix2=new u,this._tempMatrix3=new u,this.viewMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.projectionMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.uniforms={},this.pointer=null,this._rendererWidth=l.width,this._rendererHeight=l.height,this._textureCount=0,this.framebuffer=null,this.glTexture=null,this.renderToTexture=!1,this.texture=null,this.setPosition(i,s),this.setSize(n,o),this.setOrigin(.5,.5),this.setShader(e,a,h),this.renderer.on(d.RESTORE_WEBGL,this.onContextRestored,this)},willRender:function(t){return!!this.renderToTexture||!(r.RENDER_MASK!==this.renderFlags||0!==this.cameraFilter&&this.cameraFilter&t.id)},setRenderToTexture:function(t,e){if(!this.renderToTexture){var i=this.width,s=this.height,n=this.renderer;this.glTexture=n.createTextureFromSource(null,i,s,0),this.framebuffer=n.createFramebuffer(i,s,this.glTexture,!1),this._rendererWidth=i,this._rendererHeight=s,this.renderToTexture=!0,this.projOrtho(0,this.width,this.height,0),t&&(this.texture=this.scene.sys.textures.addGLTexture(t,this.glTexture))}return this.shader&&(n.pipelines.clear(),this.load(),this.flush(),n.pipelines.rebind()),this},setShader:function(t,e,i){if(this.renderer.contextLost)return this._deferSetShader={key:t,textures:e,textureData:i},this;if(void 0===e&&(e=[]),"string"==typeof t){var s=this.scene.sys.cache.shader;if(!s.has(t))return console.warn("Shader missing: "+t),this;this.shader=s.get(t)}else this.shader=t;var n=this.gl,r=this.renderer;this.program&&r.deleteProgram(this.program);var o=r.createProgram(this.shader.vertexSrc,this.shader.fragmentSrc);n.uniformMatrix4fv(n.getUniformLocation(o.webGLProgram,"uViewMatrix"),!1,this.viewMatrix),n.uniformMatrix4fv(n.getUniformLocation(o.webGLProgram,"uProjectionMatrix"),!1,this.projectionMatrix),n.uniform2f(n.getUniformLocation(o.webGLProgram,"uResolution"),this.width,this.height),this.program=o;var h=new Date,l={resolution:{type:"2f",value:{x:this.width,y:this.height}},time:{type:"1f",value:0},mouse:{type:"2f",value:{x:this.width/2,y:this.height/2}},date:{type:"4fv",value:[h.getFullYear(),h.getMonth(),h.getDate(),60*h.getHours()*60+60*h.getMinutes()+h.getSeconds()]},sampleRate:{type:"1f",value:44100},iChannel0:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel1:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel2:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel3:{type:"sampler2D",value:null,textureData:{repeat:!0}}};this.shader.uniforms?this.uniforms=a(!0,{},this.shader.uniforms,l):this.uniforms=l;for(var u=0;u<4;u++)e[u]&&this.setSampler2D("iChannel"+u,e[u],u,i);return this.initUniforms(),this.projOrtho(0,this._rendererWidth,this._rendererHeight,0),this},setPointer:function(t){return this.pointer=t,this},projOrtho:function(t,e,i,s){if(this.renderer.contextLost)this._deferProjOrtho={left:t,right:e,bottom:i,top:s};else{var n=1/(t-e),r=1/(i-s),o=this.projectionMatrix;o[0]=-2*n,o[5]=-2*r,o[10]=-.001,o[12]=(t+e)*n,o[13]=(s+i)*r,o[14]=-0;var a=this.program,h=this.gl;this.renderer.setProgram(a),h.uniformMatrix4fv(h.getUniformLocation(a.webGLProgram,"uProjectionMatrix"),!1,this.projectionMatrix),this._rendererWidth=e,this._rendererHeight=i}},initUniforms:function(){var t=this.renderer.glFuncMap,e=this.program;for(var i in this._textureCount=0,this.uniforms){var s=this.uniforms[i],n=s.type,r=t[n];s.uniformLocation=this.renderer.createUniformLocation(e,i),"sampler2D"!==n&&(s.glMatrix=r.matrix,s.glValueLength=r.length,s.glFunc=r.func)}},setSampler2DBuffer:function(t,e,i,s,n,r){void 0===n&&(n=0),void 0===r&&(r={});var o=this.uniforms[t];return o.value=e,r.width=i,r.height=s,o.textureData=r,this._textureCount=n,this.initSampler2D(o),this},setSampler2D:function(t,e,i,s){void 0===i&&(i=0);var n=this.scene.sys.textures;if(n.exists(e)){var r=n.getFrame(e);if(r.glTexture&&r.glTexture.isRenderTexture)return this.setSampler2DBuffer(t,r.glTexture,r.width,r.height,i,s);var o=this.uniforms[t],a=r.source;o.textureKey=e,o.source=a.image,o.value=r.glTexture,a.isGLTexture&&(s||(s={}),s.width=a.width,s.height=a.height),s&&(o.textureData=s),this._textureCount=i,this.initSampler2D(o)}return this},setUniform:function(t,e){return h(this.uniforms,t,e),this},getUniform:function(t){return o(this.uniforms,t,null)},setChannel0:function(t,e){return this.setSampler2D("iChannel0",t,0,e)},setChannel1:function(t,e){return this.setSampler2D("iChannel1",t,1,e)},setChannel2:function(t,e){return this.setSampler2D("iChannel2",t,2,e)},setChannel3:function(t,e){return this.setSampler2D("iChannel3",t,3,e)},initSampler2D:function(t){if(t.value){var e=t.textureData;if(e&&!t.value.isRenderTexture){var i=this.gl,s=t.value,n=i[o(e,"magFilter","linear").toUpperCase()],r=i[o(e,"minFilter","linear").toUpperCase()],a=i[o(e,"wrapS","repeat").toUpperCase()],h=i[o(e,"wrapT","repeat").toUpperCase()],l=i[o(e,"format","rgba").toUpperCase()],u=o(e,"flipY",!1),c=o(e,"width",s.width),d=o(e,"height",s.height),f=o(e,"source",s.pixels);e.repeat&&(a=i.REPEAT,h=i.REPEAT),e.width&&(f=null),s.update(f,c,d,u,a,h,r,n,l)}this.renderer.setProgram(this.program),this._textureCount++}},syncUniforms:function(){var t,e,i,s,n,r=this.gl,o=this.uniforms,a=0;for(var h in o)i=(t=o[h]).glFunc,e=t.glValueLength,s=t.uniformLocation,null!==(n=t.value)&&(1===e?t.glMatrix?i.call(r,s.webGLUniformLocation,t.transpose,n):i.call(r,s.webGLUniformLocation,n):2===e?i.call(r,s.webGLUniformLocation,n.x,n.y):3===e?i.call(r,s.webGLUniformLocation,n.x,n.y,n.z):4===e?i.call(r,s.webGLUniformLocation,n.x,n.y,n.z,n.w):"sampler2D"===t.type&&(r.activeTexture(r.TEXTURE0+a),r.bindTexture(r.TEXTURE_2D,n.webGLTexture),r.uniform1i(s.webGLUniformLocation,a),a++))},load:function(t){var e=this.gl,i=this.width,s=this.height,n=this.renderer,r=this.program,o=this.viewMatrix;if(!this.renderToTexture){var a=-this._displayOriginX,h=-this._displayOriginY;o[0]=t[0],o[1]=t[1],o[4]=t[2],o[5]=t[3],o[8]=t[4],o[9]=t[5],o[12]=o[0]*a+o[4]*h,o[13]=o[1]*a+o[5]*h}e.useProgram(r.webGLProgram),e.uniformMatrix4fv(e.getUniformLocation(r.webGLProgram,"uViewMatrix"),!1,o),e.uniformMatrix4fv(e.getUniformLocation(r.webGLProgram,"uProjectionMatrix"),!1,this.projectionMatrix),e.uniform2f(e.getUniformLocation(r.webGLProgram,"uResolution"),this.width,this.height);var l=this.uniforms,u=l.resolution;u.value.x=i,u.value.y=s,l.time.value=n.game.loop.getDuration();var c=this.pointer;if(c){var d=l.mouse,f=c.x/i,p=1-c.y/s;d.value.x=f.toFixed(2),d.value.y=p.toFixed(2)}this.syncUniforms()},flush:function(){var t=this.width,e=this.height,i=this.program,s=this.gl,n=this.vertexBuffer,r=this.renderer,o=2*Float32Array.BYTES_PER_ELEMENT;this.renderToTexture&&(r.setFramebuffer(this.framebuffer),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT)),s.bindBuffer(s.ARRAY_BUFFER,n.webGLBuffer);var a=s.getAttribLocation(i.webGLProgram,"inPosition");-1!==a&&(s.enableVertexAttribArray(a),s.vertexAttribPointer(a,2,s.FLOAT,!1,o,0));var h=this.vertexViewF32;h[3]=e,h[4]=t,h[5]=e,h[8]=t,h[9]=e,h[10]=t,s.bufferSubData(s.ARRAY_BUFFER,0,this.bytes.subarray(0,6*o)),s.drawArrays(s.TRIANGLES,0,6),this.renderToTexture&&r.setFramebuffer(null,!1)},setAlpha:function(){},setBlendMode:function(){},onContextRestored:function(){if(null!==this._deferSetShader){var t=this._deferSetShader.key,e=this._deferSetShader.textures,i=this._deferSetShader.textureData;this._deferSetShader=null,this.setShader(t,e,i)}if(null!==this._deferProjOrtho){var s=this._deferProjOrtho.left,n=this._deferProjOrtho.right,r=this._deferProjOrtho.bottom,o=this._deferProjOrtho.top;this._deferProjOrtho=null,this.projOrtho(s,n,r,o)}},preDestroy:function(){var t=this.renderer;t.off(d.RESTORE_WEBGL,this.onContextRestored,this),t.deleteProgram(this.program),t.deleteBuffer(this.vertexBuffer),this.renderToTexture&&(t.deleteFramebuffer(this.framebuffer),this.texture.destroy(),this.framebuffer=null,this.glTexture=null,this.texture=null),c(this.uniforms,(function(e){t.deleteUniformLocation(e.uniformLocation),e.uniformLocation=null}))}});t.exports=f},80464:t=>{t.exports=function(){}},54935:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(20071);n.register("shader",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=r(t,"x",0),a=r(t,"y",0),h=r(t,"width",128),l=r(t,"height",128),u=new o(this.scene,i,n,a,h,l);return void 0!==e&&(t.add=e),s(this.scene,u,t),u}))},74177:(t,e,i)=>{var s=i(20071);i(39429).register("shader",(function(t,e,i,n,r,o,a){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a))}))},25479:(t,e,i)=>{var s,n;i(29747),s=i(19257),n=i(80464),t.exports={renderWebGL:s,renderCanvas:n}},19257:(t,e,i)=>{var s=i(91296);t.exports=function(t,e,i,n){if(e.shader){if(i.addToRenderList(e),t.pipelines.clear(),e.renderToTexture)e.load(),e.flush();else{var r=s(e,i,n).calc;t.width===e._rendererWidth&&t.height===e._rendererHeight||e.projOrtho(0,t.width,t.height,0),e.load(r.matrix),e.flush()}t.pipelines.rebind()}}},10441:(t,e,i)=>{var s=i(70554);t.exports=function(t,e,i,n,r,o){for(var a=s.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*n),h=i.pathData,l=i.pathIndexes,u=0;u{t.exports=function(t,e,i,s){var n=i||e.fillColor,r=s||e.fillAlpha,o=(16711680&n)>>>16,a=(65280&n)>>>8,h=255&n;t.fillStyle="rgba("+o+","+a+","+h+","+r+")"}},75177:t=>{t.exports=function(t,e,i,s){var n=i||e.strokeColor,r=s||e.strokeAlpha,o=(16711680&n)>>>16,a=(65280&n)>>>8,h=255&n;t.strokeStyle="rgba("+o+","+a+","+h+","+r+")",t.lineWidth=e.lineWidth}},17803:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(95643),o=i(23031),a=new s({Extends:r,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.GetBounds,n.Mask,n.Origin,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Transform,n.Visible],initialize:function(t,e,i){void 0===e&&(e="Shape"),r.call(this,t,e),this.geom=i,this.pathData=[],this.pathIndexes=[],this.fillColor=16777215,this.fillAlpha=1,this.strokeColor=16777215,this.strokeAlpha=1,this.lineWidth=1,this.isFilled=!1,this.isStroked=!1,this.closePath=!0,this._tempLine=new o,this.width=0,this.height=0,this.initPipeline(),this.initPostPipeline()},setFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.isFilled=!1:(this.fillColor=t,this.fillAlpha=e,this.isFilled=!0),this},setStrokeStyle:function(t,e,i){return void 0===i&&(i=1),void 0===t?this.isStroked=!1:(this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this.isStroked=!0),this},setClosePath:function(t){return this.closePath=t,this},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this},preDestroy:function(){this.geom=null,this._tempLine=null,this.pathData=[],this.pathIndexes=[]},displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}}});t.exports=a},34682:(t,e,i)=>{var s=i(70554);t.exports=function(t,e,i,n,r){var o=t.strokeTint,a=s.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*i);o.TL=a,o.TR=a,o.BL=a,o.BR=a;var h=e.pathData,l=h.length-1,u=e.lineWidth,c=u/2,d=h[0]-n,f=h[1]-r;e.closePath||(l-=2);for(var p=2;p{var s=i(13609),n=i(83419),r=i(39506),o=i(94811),a=i(96503),h=i(36383),l=i(17803),u=new n({Extends:l,Mixins:[s],initialize:function(t,e,i,s,n,r,o,h,u){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=128),void 0===n&&(n=0),void 0===r&&(r=360),void 0===o&&(o=!1),l.call(this,t,"Arc",new a(0,0,s)),this._startAngle=n,this._endAngle=r,this._anticlockwise=o,this._iterations=.01,this.setPosition(e,i);var c=2*this.geom.radius;this.setSize(c,c),void 0!==h&&this.setFillStyle(h,u),this.updateDisplayOrigin(),this.updateData()},iterations:{get:function(){return this._iterations},set:function(t){this._iterations=t,this.updateData()}},radius:{get:function(){return this.geom.radius},set:function(t){this.geom.radius=t;var e=2*t;this.setSize(e,e),this.updateDisplayOrigin(),this.updateData()}},startAngle:{get:function(){return this._startAngle},set:function(t){this._startAngle=t,this.updateData()}},endAngle:{get:function(){return this._endAngle},set:function(t){this._endAngle=t,this.updateData()}},anticlockwise:{get:function(){return this._anticlockwise},set:function(t){this._anticlockwise=t,this.updateData()}},setRadius:function(t){return this.radius=t,this},setIterations:function(t){return void 0===t&&(t=.01),this.iterations=t,this},setStartAngle:function(t,e){return this._startAngle=t,void 0!==e&&(this._anticlockwise=e),this.updateData()},setEndAngle:function(t,e){return this._endAngle=t,void 0!==e&&(this._anticlockwise=e),this.updateData()},updateData:function(){var t=this._iterations,e=t,i=this.geom.radius,s=r(this._startAngle),n=r(this._endAngle),a=i,l=i;n-=s,this._anticlockwise?n<-h.PI2?n=-h.PI2:n>0&&(n=-h.PI2+n%h.PI2):n>h.PI2?n=h.PI2:n<0&&(n=h.PI2+n%h.PI2);for(var u,c=[a+Math.cos(s)*i,l+Math.sin(s)*i];e<1;)u=n*e+s,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),e+=t;return u=n+s,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),c.push(a+Math.cos(s)*i,l+Math.sin(s)*i),this.pathIndexes=o(c),this.pathData=c,this}});t.exports=u},42542:(t,e,i)=>{var s=i(39506),n=i(65960),r=i(75177),o=i(20926);t.exports=function(t,e,i,a){i.addToRenderList(e);var h=t.currentContext;if(o(t,h,e,i,a)){var l=e.radius;h.beginPath(),h.arc(l-e.originX*(2*l),l-e.originY*(2*l),l,s(e._startAngle),s(e._endAngle),e.anticlockwise),e.closePath&&h.closePath(),e.isFilled&&(n(h,e),h.fill()),e.isStroked&&(r(h,e),h.stroke()),h.restore()}}},42563:(t,e,i)=>{var s=i(23629),n=i(39429);n.register("arc",(function(t,e,i,n,r,o,a,h){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a,h))})),n.register("circle",(function(t,e,i,n,r){return this.displayList.add(new s(this.scene,t,e,i,0,360,!1,n,r))}))},13609:(t,e,i)=>{var s,n;i(29747),s=i(41447),n=i(42542),t.exports={renderWebGL:s,renderCanvas:n}},41447:(t,e,i)=>{var s=i(91296),n=i(10441),r=i(34682);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=s(e,i,o),l=a.calcMatrix.copyFrom(h.calc),u=e._displayOriginX,c=e._displayOriginY,d=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&n(a,l,e,d,u,c),e.isStroked&&r(a,e,d,u,c),t.pipelines.postBatch(e)}},89:(t,e,i)=>{var s=i(83419),n=i(33141),r=i(94811),o=i(87841),a=i(17803),h=new s({Extends:a,Mixins:[n],initialize:function(t,e,i,s,n,r){void 0===e&&(e=0),void 0===i&&(i=0),a.call(this,t,"Curve",s),this._smoothness=32,this._curveBounds=new o,this.closePath=!1,this.setPosition(e,i),void 0!==n&&this.setFillStyle(n,r),this.updateData()},smoothness:{get:function(){return this._smoothness},set:function(t){this._smoothness=t,this.updateData()}},setSmoothness:function(t){return this._smoothness=t,this.updateData()},updateData:function(){var t=this._curveBounds,e=this._smoothness;this.geom.getBounds(t,e),this.setSize(t.width,t.height),this.updateDisplayOrigin();for(var i=[],s=this.geom.getPoints(e),n=0;n{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX+e._curveBounds.x,l=e._displayOriginY+e._curveBounds.y,u=e.pathData,c=u.length-1,d=u[0]-h,f=u[1]-l;a.beginPath(),a.moveTo(d,f),e.closePath||(c-=2);for(var p=2;p{var s=i(39429),n=i(89);s.register("curve",(function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))}))},33141:(t,e,i)=>{var s,n;i(29747),s=i(53987),n=i(3170),t.exports={renderWebGL:s,renderCanvas:n}},53987:(t,e,i)=>{var s=i(10441),n=i(91296),r=i(34682);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=n(e,i,o),l=a.calcMatrix.copyFrom(h.calc),u=e._displayOriginX+e._curveBounds.x,c=e._displayOriginY+e._curveBounds.y,d=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&s(a,l,e,d,u,c),e.isStroked&&r(a,e,d,u,c),t.pipelines.postBatch(e)}},19921:(t,e,i)=>{var s=i(83419),n=i(94811),r=i(54205),o=i(8497),a=i(17803),h=new s({Extends:a,Mixins:[r],initialize:function(t,e,i,s,n,r,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=128),void 0===n&&(n=128),a.call(this,t,"Ellipse",new o(s/2,n/2,s,n)),this._smoothness=64,this.setPosition(e,i),this.width=s,this.height=n,void 0!==r&&this.setFillStyle(r,h),this.updateDisplayOrigin(),this.updateData()},smoothness:{get:function(){return this._smoothness},set:function(t){this._smoothness=t,this.updateData()}},setSize:function(t,e){return this.width=t,this.height=e,this.geom.setPosition(t/2,e/2),this.geom.setSize(t,e),this.updateData()},setSmoothness:function(t){return this._smoothness=t,this.updateData()},updateData:function(){for(var t=[],e=this.geom.getPoints(this._smoothness),i=0;i{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX,l=e._displayOriginY,u=e.pathData,c=u.length-1,d=u[0]-h,f=u[1]-l;a.beginPath(),a.moveTo(d,f),e.closePath||(c-=2);for(var p=2;p{var s=i(19921);i(39429).register("ellipse",(function(t,e,i,n,r,o){return this.displayList.add(new s(this.scene,t,e,i,n,r,o))}))},54205:(t,e,i)=>{var s,n;i(29747),s=i(19467),n=i(7930),t.exports={renderWebGL:s,renderCanvas:n}},19467:(t,e,i)=>{var s=i(10441),n=i(91296),r=i(34682);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=n(e,i,o),l=a.calcMatrix.copyFrom(h.calc),u=e._displayOriginX,c=e._displayOriginY,d=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&s(a,l,e,d,u,c),e.isStroked&&r(a,e,d,u,c),t.pipelines.postBatch(e)}},30479:(t,e,i)=>{var s=i(83419),n=i(17803),r=i(26015),o=new s({Extends:n,Mixins:[r],initialize:function(t,e,i,s,r,o,a,h,l,u,c){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=128),void 0===r&&(r=128),void 0===o&&(o=32),void 0===a&&(a=32),n.call(this,t,"Grid",null),this.cellWidth=o,this.cellHeight=a,this.showCells=!0,this.outlineFillColor=0,this.outlineFillAlpha=0,this.showOutline=!0,this.showAltCells=!1,this.altFillColor,this.altFillAlpha,this.setPosition(e,i),this.setSize(s,r),this.setFillStyle(h,l),void 0!==u&&this.setOutlineStyle(u,c),this.updateDisplayOrigin()},setFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.showCells=!1:(this.fillColor=t,this.fillAlpha=e,this.showCells=!0),this},setAltFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.showAltCells=!1:(this.altFillColor=t,this.altFillAlpha=e,this.showAltCells=!0),this},setOutlineStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.showOutline=!1:(this.outlineFillColor=t,this.outlineFillAlpha=e,this.showOutline=!0),this}});t.exports=o},49912:(t,e,i)=>{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=-e._displayOriginX,l=-e._displayOriginY,u=i.alpha*e.alpha,c=e.width,d=e.height,f=e.cellWidth,p=e.cellHeight,v=Math.ceil(c/f),g=Math.ceil(d/p),m=f,y=p,x=f-(v*f-c),T=p-(g*p-d),w=e.showCells,b=e.showAltCells,S=e.showOutline,E=0,A=0,C=0,_=0,M=0;if(S&&(m--,y--,x===f&&x--,T===p&&T--),w&&e.fillAlpha>0)for(s(a,e),A=0;A0)for(s(a,e,e.altFillColor,e.altFillAlpha*u),A=0;A0){for(n(a,e,e.outlineFillColor,e.outlineFillAlpha*u),E=1;E{var s=i(39429),n=i(30479);s.register("grid",(function(t,e,i,s,r,o,a,h,l,u){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h,l,u))}))},26015:(t,e,i)=>{var s,n;i(29747),s=i(46161),n=i(49912),t.exports={renderWebGL:s,renderCanvas:n}},46161:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.pipelines.set(e.pipeline),a=s(e,i,r);o.calcMatrix.copyFrom(a.calc).translate(-e._displayOriginX,-e._displayOriginY);var h,l,u=i.alpha*e.alpha,c=e.width,d=e.height,f=e.cellWidth,p=e.cellHeight,v=Math.ceil(c/f),g=Math.ceil(d/p),m=f,y=p,x=f-(v*f-c),T=p-(g*p-d),w=e.showCells,b=e.showAltCells,S=e.showOutline,E=0,A=0,C=0,_=0,M=0;if(S&&(m--,y--,x===f&&x--,T===p&&T--),t.pipelines.preBatch(e),w&&e.fillAlpha>0)for(h=o.fillTint,l=n.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*u),h.TL=l,h.TR=l,h.BL=l,h.BR=l,A=0;A0)for(h=o.fillTint,l=n.getTintAppendFloatAlpha(e.altFillColor,e.altFillAlpha*u),h.TL=l,h.TR=l,h.BL=l,h.BR=l,A=0;A0){var P=o.strokeTint,R=n.getTintAppendFloatAlpha(e.outlineFillColor,e.outlineFillAlpha*u);for(P.TL=R,P.TR=R,P.BL=R,P.BR=R,E=1;E{var s=i(99651),n=i(83419),r=i(17803),o=new n({Extends:r,Mixins:[s],initialize:function(t,e,i,s,n,o,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=48),void 0===n&&(n=32),void 0===o&&(o=15658734),void 0===a&&(a=10066329),void 0===h&&(h=13421772),r.call(this,t,"IsoBox",null),this.projection=4,this.fillTop=o,this.fillLeft=a,this.fillRight=h,this.showTop=!0,this.showLeft=!0,this.showRight=!0,this.isFilled=!0,this.setPosition(e,i),this.setSize(s,n),this.updateDisplayOrigin()},setProjection:function(t){return this.projection=t,this},setFaces:function(t,e,i){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!0),this.showTop=t,this.showLeft=e,this.showRight=i,this},setFillStyle:function(t,e,i){return this.fillTop=t,this.fillLeft=e,this.fillRight=i,this.isFilled=!0,this}});t.exports=o},11508:(t,e,i)=>{var s=i(65960),n=i(20926);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.currentContext;if(n(t,o,e,i,r)&&e.isFilled){var a=e.width,h=e.height,l=a/2,u=a/e.projection;e.showTop&&(s(o,e,e.fillTop),o.beginPath(),o.moveTo(-l,-h),o.lineTo(0,-u-h),o.lineTo(l,-h),o.lineTo(l,-1),o.lineTo(0,u-1),o.lineTo(-l,-1),o.lineTo(-l,-h),o.fill()),e.showLeft&&(s(o,e,e.fillLeft),o.beginPath(),o.moveTo(-l,0),o.lineTo(0,u),o.lineTo(0,u-h),o.lineTo(-l,-h),o.lineTo(-l,0),o.fill()),e.showRight&&(s(o,e,e.fillRight),o.beginPath(),o.moveTo(l,0),o.lineTo(0,u),o.lineTo(0,u-h),o.lineTo(l,-h),o.lineTo(l,0),o.fill()),o.restore()}}},3933:(t,e,i)=>{var s=i(39429),n=i(61475);s.register("isobox",(function(t,e,i,s,r,o,a){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a))}))},99651:(t,e,i)=>{var s,n;i(29747),s=i(68149),n=i(11508),t.exports={renderWebGL:s,renderCanvas:n}},68149:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){i.addToRenderList(e);var o,a,h,l,u,c,d,f,p,v=t.pipelines.set(e.pipeline),g=s(e,i,r),m=v.calcMatrix.copyFrom(g.calc),y=e.width,x=e.height,T=y/2,w=y/e.projection,b=i.alpha*e.alpha;e.isFilled&&(t.pipelines.preBatch(e),e.showTop&&(o=n.getTintAppendFloatAlpha(e.fillTop,b),a=m.getX(-T,-x),h=m.getY(-T,-x),l=m.getX(0,-w-x),u=m.getY(0,-w-x),c=m.getX(T,-x),d=m.getY(T,-x),f=m.getX(0,w-x),p=m.getY(0,w-x),v.batchQuad(e,a,h,l,u,c,d,f,p,0,0,1,1,o,o,o,o,2)),e.showLeft&&(o=n.getTintAppendFloatAlpha(e.fillLeft,b),a=m.getX(-T,0),h=m.getY(-T,0),l=m.getX(0,w),u=m.getY(0,w),c=m.getX(0,w-x),d=m.getY(0,w-x),f=m.getX(-T,-x),p=m.getY(-T,-x),v.batchQuad(e,a,h,l,u,c,d,f,p,0,0,1,1,o,o,o,o,2)),e.showRight&&(o=n.getTintAppendFloatAlpha(e.fillRight,b),a=m.getX(T,0),h=m.getY(T,0),l=m.getX(0,w),u=m.getY(0,w),c=m.getX(0,w-x),d=m.getY(0,w-x),f=m.getX(T,-x),p=m.getY(T,-x),v.batchQuad(e,a,h,l,u,c,d,f,p,0,0,1,1,o,o,o,o,2)),t.pipelines.postBatch(e))}},16933:(t,e,i)=>{var s=i(83419),n=i(60561),r=i(17803),o=new s({Extends:r,Mixins:[n],initialize:function(t,e,i,s,n,o,a,h,l){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=48),void 0===n&&(n=32),void 0===o&&(o=!1),void 0===a&&(a=15658734),void 0===h&&(h=10066329),void 0===l&&(l=13421772),r.call(this,t,"IsoTriangle",null),this.projection=4,this.fillTop=a,this.fillLeft=h,this.fillRight=l,this.showTop=!0,this.showLeft=!0,this.showRight=!0,this.isReversed=o,this.isFilled=!0,this.setPosition(e,i),this.setSize(s,n),this.updateDisplayOrigin()},setProjection:function(t){return this.projection=t,this},setReversed:function(t){return this.isReversed=t,this},setFaces:function(t,e,i){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!0),this.showTop=t,this.showLeft=e,this.showRight=i,this},setFillStyle:function(t,e,i){return this.fillTop=t,this.fillLeft=e,this.fillRight=i,this.isFilled=!0,this}});t.exports=o},79590:(t,e,i)=>{var s=i(65960),n=i(20926);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.currentContext;if(n(t,o,e,i,r)&&e.isFilled){var a=e.width,h=e.height,l=a/2,u=a/e.projection,c=e.isReversed;e.showTop&&c&&(s(o,e,e.fillTop),o.beginPath(),o.moveTo(-l,-h),o.lineTo(0,-u-h),o.lineTo(l,-h),o.lineTo(0,u-h),o.fill()),e.showLeft&&(s(o,e,e.fillLeft),o.beginPath(),c?(o.moveTo(-l,-h),o.lineTo(0,u),o.lineTo(0,u-h)):(o.moveTo(-l,0),o.lineTo(0,u),o.lineTo(0,u-h)),o.fill()),e.showRight&&(s(o,e,e.fillRight),o.beginPath(),c?(o.moveTo(l,-h),o.lineTo(0,u),o.lineTo(0,u-h)):(o.moveTo(l,0),o.lineTo(0,u),o.lineTo(0,u-h)),o.fill()),o.restore()}}},49803:(t,e,i)=>{var s=i(39429),n=i(16933);s.register("isotriangle",(function(t,e,i,s,r,o,a,h){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h))}))},60561:(t,e,i)=>{var s,n;i(29747),s=i(51503),n=i(79590),t.exports={renderWebGL:s,renderCanvas:n}},51503:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.pipelines.set(e.pipeline),a=s(e,i,r),h=o.calcMatrix.copyFrom(a.calc),l=e.width,u=e.height,c=l/2,d=l/e.projection,f=e.isReversed,p=i.alpha*e.alpha;if(e.isFilled){var v,g,m,y,x,T,w;if(t.pipelines.preBatch(e),e.showTop&&f){v=n.getTintAppendFloatAlpha(e.fillTop,p),g=h.getX(-c,-u),m=h.getY(-c,-u),y=h.getX(0,-d-u),x=h.getY(0,-d-u),T=h.getX(c,-u),w=h.getY(c,-u);var b=h.getX(0,d-u),S=h.getY(0,d-u);o.batchQuad(e,g,m,y,x,T,w,b,S,0,0,1,1,v,v,v,v,2)}e.showLeft&&(v=n.getTintAppendFloatAlpha(e.fillLeft,p),f?(g=h.getX(-c,-u),m=h.getY(-c,-u),y=h.getX(0,d),x=h.getY(0,d),T=h.getX(0,d-u),w=h.getY(0,d-u)):(g=h.getX(-c,0),m=h.getY(-c,0),y=h.getX(0,d),x=h.getY(0,d),T=h.getX(0,d-u),w=h.getY(0,d-u)),o.batchTri(e,g,m,y,x,T,w,0,0,1,1,v,v,v,2)),e.showRight&&(v=n.getTintAppendFloatAlpha(e.fillRight,p),f?(g=h.getX(c,-u),m=h.getY(c,-u),y=h.getX(0,d),x=h.getY(0,d),T=h.getX(0,d-u),w=h.getY(0,d-u)):(g=h.getX(c,0),m=h.getY(c,0),y=h.getX(0,d),x=h.getY(0,d),T=h.getX(0,d-u),w=h.getY(0,d-u)),o.batchTri(e,g,m,y,x,T,w,0,0,1,1,v,v,v,2)),t.pipelines.postBatch(e)}}},57847:(t,e,i)=>{var s=i(83419),n=i(17803),r=i(23031),o=i(36823),a=new s({Extends:n,Mixins:[o],initialize:function(t,e,i,s,o,a,h,l,u){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=128),void 0===h&&(h=0),n.call(this,t,"Line",new r(s,o,a,h));var c=Math.max(1,this.geom.right-this.geom.left),d=Math.max(1,this.geom.bottom-this.geom.top);this.lineWidth=1,this._startWidth=1,this._endWidth=1,this.setPosition(e,i),this.setSize(c,d),void 0!==l&&this.setStrokeStyle(1,l,u),this.updateDisplayOrigin()},setLineWidth:function(t,e){return void 0===e&&(e=t),this._startWidth=t,this._endWidth=e,this.lineWidth=t,this},setTo:function(t,e,i,s){return this.geom.setTo(t,e,i,s),this}});t.exports=a},17440:(t,e,i)=>{var s=i(75177),n=i(20926);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.currentContext;if(n(t,o,e,i,r)){var a=e._displayOriginX,h=e._displayOriginY;e.isStroked&&(s(o,e),o.beginPath(),o.moveTo(e.geom.x1-a,e.geom.y1-h),o.lineTo(e.geom.x2-a,e.geom.y2-h),o.stroke()),o.restore()}}},2481:(t,e,i)=>{var s=i(39429),n=i(57847);s.register("line",(function(t,e,i,s,r,o,a,h){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h))}))},36823:(t,e,i)=>{var s,n;i(29747),s=i(77385),n=i(17440),t.exports={renderWebGL:s,renderCanvas:n}},77385:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.pipelines.set(e.pipeline),a=s(e,i,r);o.calcMatrix.copyFrom(a.calc);var h=e._displayOriginX,l=e._displayOriginY,u=i.alpha*e.alpha;if(t.pipelines.preBatch(e),e.isStroked){var c=o.strokeTint,d=n.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*u);c.TL=d,c.TR=d,c.BL=d,c.BR=d,o.batchLine(e.geom.x1-h,e.geom.y1-l,e.geom.x2-h,e.geom.y2-l,e._startWidth/2,e._endWidth/2,1,0,!1,a.sprite,a.camera)}t.pipelines.postBatch(e)}},24949:(t,e,i)=>{var s=i(90273),n=i(83419),r=i(94811),o=i(13829),a=i(25717),h=i(17803),l=i(5469),u=new n({Extends:h,Mixins:[s],initialize:function(t,e,i,s,n,r){void 0===e&&(e=0),void 0===i&&(i=0),h.call(this,t,"Polygon",new a(s));var l=o(this.geom);this.setPosition(e,i),this.setSize(l.width,l.height),void 0!==n&&this.setFillStyle(n,r),this.updateDisplayOrigin(),this.updateData()},smooth:function(t){void 0===t&&(t=1);for(var e=0;e{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX,l=e._displayOriginY,u=e.pathData,c=u.length-1,d=u[0]-h,f=u[1]-l;a.beginPath(),a.moveTo(d,f),e.closePath||(c-=2);for(var p=2;p{var s=i(39429),n=i(24949);s.register("polygon",(function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))}))},90273:(t,e,i)=>{var s,n;i(29747),s=i(73695),n=i(38710),t.exports={renderWebGL:s,renderCanvas:n}},73695:(t,e,i)=>{var s=i(10441),n=i(91296),r=i(34682);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=n(e,i,o),l=a.calcMatrix.copyFrom(h.calc),u=e._displayOriginX,c=e._displayOriginY,d=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&s(a,l,e,d,u,c),e.isStroked&&r(a,e,d,u,c),t.pipelines.postBatch(e)}},74561:(t,e,i)=>{var s=i(83419),n=i(87841),r=i(17803),o=i(95597),a=new s({Extends:r,Mixins:[o],initialize:function(t,e,i,s,o,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=128),void 0===o&&(o=128),r.call(this,t,"Rectangle",new n(0,0,s,o)),this.setPosition(e,i),this.setSize(s,o),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setSize:function(t,e){this.width=t,this.height=e,this.geom.setSize(t,e),this.updateData(),this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),e.getLineD(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},48682:(t,e,i)=>{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX,l=e._displayOriginY;e.isFilled&&(s(a,e),a.fillRect(-h,-l,e.width,e.height)),e.isStroked&&(n(a,e),a.beginPath(),a.rect(-h,-l,e.width,e.height),a.stroke()),a.restore()}}},87959:(t,e,i)=>{var s=i(39429),n=i(74561);s.register("rectangle",(function(t,e,i,s,r,o){return this.displayList.add(new n(this.scene,t,e,i,s,r,o))}))},95597:(t,e,i)=>{var s,n;i(29747),s=i(52059),n=i(48682),t.exports={renderWebGL:s,renderCanvas:n}},52059:(t,e,i)=>{var s=i(91296),n=i(34682),r=i(70554);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=s(e,i,o);a.calcMatrix.copyFrom(h.calc);var l=e._displayOriginX,u=e._displayOriginY,c=i.alpha*e.alpha;if(t.pipelines.preBatch(e),e.isFilled){var d=a.fillTint,f=r.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*c);d.TL=f,d.TR=f,d.BL=f,d.BR=f,a.batchFillRect(-l,-u,e.width,e.height)}e.isStroked&&n(a,e,c,l,u),t.pipelines.postBatch(e)}},55911:(t,e,i)=>{var s=i(81991),n=i(83419),r=i(94811),o=i(17803),a=new n({Extends:o,Mixins:[s],initialize:function(t,e,i,s,n,r,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=5),void 0===n&&(n=32),void 0===r&&(r=64),o.call(this,t,"Star",null),this._points=s,this._innerRadius=n,this._outerRadius=r,this.setPosition(e,i),this.setSize(2*r,2*r),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setPoints:function(t){return this._points=t,this.updateData()},setInnerRadius:function(t){return this._innerRadius=t,this.updateData()},setOuterRadius:function(t){return this._outerRadius=t,this.updateData()},points:{get:function(){return this._points},set:function(t){this._points=t,this.updateData()}},innerRadius:{get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this.updateData()}},outerRadius:{get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this.updateData()}},updateData:function(){var t=[],e=this._points,i=this._innerRadius,s=this._outerRadius,n=Math.PI/2*3,o=Math.PI/e,a=s,h=s;t.push(a,h+-s);for(var l=0;l{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX,l=e._displayOriginY,u=e.pathData,c=u.length-1,d=u[0]-h,f=u[1]-l;a.beginPath(),a.moveTo(d,f),e.closePath||(c-=2);for(var p=2;p{var s=i(55911);i(39429).register("star",(function(t,e,i,n,r,o,a){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a))}))},81991:(t,e,i)=>{var s,n;i(29747),s=i(57017),n=i(64272),t.exports={renderWebGL:s,renderCanvas:n}},57017:(t,e,i)=>{var s=i(10441),n=i(91296),r=i(34682);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=n(e,i,o),l=a.calcMatrix.copyFrom(h.calc),u=e._displayOriginX,c=e._displayOriginY,d=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&s(a,l,e,d,u,c),e.isStroked&&r(a,e,d,u,c),t.pipelines.postBatch(e)}},36931:(t,e,i)=>{var s=i(83419),n=i(17803),r=i(16483),o=i(96195),a=new s({Extends:n,Mixins:[o],initialize:function(t,e,i,s,o,a,h,l,u,c,d){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===o&&(o=128),void 0===a&&(a=64),void 0===h&&(h=0),void 0===l&&(l=128),void 0===u&&(u=128),n.call(this,t,"Triangle",new r(s,o,a,h,l,u));var f=this.geom.right-this.geom.left,p=this.geom.bottom-this.geom.top;this.setPosition(e,i),this.setSize(f,p),void 0!==c&&this.setFillStyle(c,d),this.updateDisplayOrigin(),this.updateData()},setTo:function(t,e,i,s,n,r){return this.geom.setTo(t,e,i,s,n,r),this.updateData()},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},85172:(t,e,i)=>{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX,l=e._displayOriginY,u=e.geom.x1-h,c=e.geom.y1-l,d=e.geom.x2-h,f=e.geom.y2-l,p=e.geom.x3-h,v=e.geom.y3-l;a.beginPath(),a.moveTo(u,c),a.lineTo(d,f),a.lineTo(p,v),a.closePath(),e.isFilled&&(s(a,e),a.fill()),e.isStroked&&(n(a,e),a.stroke()),a.restore()}}},45245:(t,e,i)=>{var s=i(39429),n=i(36931);s.register("triangle",(function(t,e,i,s,r,o,a,h,l,u){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h,l,u))}))},96195:(t,e,i)=>{var s,n;i(29747),s=i(83253),n=i(85172),t.exports={renderWebGL:s,renderCanvas:n}},83253:(t,e,i)=>{var s=i(91296),n=i(34682),r=i(70554);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=s(e,i,o);a.calcMatrix.copyFrom(h.calc);var l=e._displayOriginX,u=e._displayOriginY,c=i.alpha*e.alpha;if(t.pipelines.preBatch(e),e.isFilled){var d=a.fillTint,f=r.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*c);d.TL=f,d.TR=f,d.BL=f,d.BR=f;var p=e.geom.x1-l,v=e.geom.y1-u,g=e.geom.x2-l,m=e.geom.y2-u,y=e.geom.x3-l,x=e.geom.y3-u;a.batchFillTriangle(p,v,g,m,y,x,h.sprite,h.camera)}e.isStroked&&n(a,e,c,l,u),t.pipelines.postBatch(e)}},68287:(t,e,i)=>{var s=i(9674),n=i(83419),r=i(31401),o=i(95643),a=i(92751),h=new n({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.Depth,r.Flip,r.GetBounds,r.Mask,r.Origin,r.Pipeline,r.PostPipeline,r.ScrollFactor,r.Size,r.TextureCrop,r.Tint,r.Transform,r.Visible,a],initialize:function(t,e,i,n,r){o.call(this,t,"Sprite"),this._crop=this.resetCropObject(),this.anims=new s(this),this.setTexture(n,r),this.setPosition(e,i),this.setSizeToFrame(),this.setOriginFromFrame(),this.initPipeline(),this.initPostPipeline(!0)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},preUpdate:function(t,e){this.anims.update(t,e)},play:function(t,e){return this.anims.play(t,e)},playReverse:function(t,e){return this.anims.playReverse(t,e)},playAfterDelay:function(t,e){return this.anims.playAfterDelay(t,e)},playAfterRepeat:function(t,e){return this.anims.playAfterRepeat(t,e)},chain:function(t){return this.anims.chain(t)},stop:function(){return this.anims.stop()},stopAfterDelay:function(t){return this.anims.stopAfterDelay(t)},stopAfterRepeat:function(t){return this.anims.stopAfterRepeat(t)},stopOnFrame:function(t){return this.anims.stopOnFrame(t)},toJSON:function(){return r.ToJSON(this)},preDestroy:function(){this.anims.destroy(),this.anims=void 0}});t.exports=h},76552:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e),t.batchSprite(e,e.frame,i,s)}},15567:(t,e,i)=>{var s=i(25305),n=i(13059),r=i(44603),o=i(23568),a=i(68287);r.register("sprite",(function(t,e){void 0===t&&(t={});var i=o(t,"key",null),r=o(t,"frame",null),h=new a(this.scene,0,0,i,r);return void 0!==e&&(t.add=e),s(this.scene,h,t),n(h,t),h}))},46409:(t,e,i)=>{var s=i(39429),n=i(68287);s.register("sprite",(function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))}))},92751:(t,e,i)=>{var s,n;i(29747),s=i(9409),n=i(76552),t.exports={renderWebGL:s,renderCanvas:n}},9409:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e),e.pipeline.batchSprite(e,i,s)}},14220:t=>{t.exports=function(t,e,i){var s=t.canvas,n=t.context,r=t.style,o=[],a=0,h=i.length;r.maxLines>0&&r.maxLines1&&(u+=t.letterSpacing*(i[l].length-1)),r.wordWrap&&(u-=n.measureText(" ").width),o[l]=Math.ceil(u),a=Math.max(a,o[l])}var c=e.fontSize+r.strokeThickness,d=c*h,f=t.lineSpacing;return h>1&&(d+=f*(h-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},79557:(t,e,i)=>{var s=i(27919);t.exports=function(t){var e=s.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var n=i.measureText(t.testString);if("actualBoundingBoxAscent"in n){var r=n.actualBoundingBoxAscent,o=n.actualBoundingBoxDescent;return s.remove(e),{ascent:r,descent:o,fontSize:r+o}}var a=Math.ceil(n.width*t.baselineX),h=a,l=2*h;h=h*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);var u={ascent:0,descent:0,fontSize:0},c=i.getImageData(0,0,a,l);if(!c)return u.ascent=h,u.descent=h+6,u.fontSize=u.ascent+u.descent,s.remove(e),u;var d,f,p=c.data,v=p.length,g=4*a,m=0,y=!1;for(d=0;dh;d--){for(f=0;f{var s=i(40366),n=i(27919),r=i(83419),o=i(31401),a=i(95643),h=i(14220),l=i(35154),u=i(35846),c=i(61771),d=i(35762),f=i(45650),p=new r({Extends:a,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Crop,o.Depth,o.Flip,o.GetBounds,o.Mask,o.Origin,o.Pipeline,o.PostPipeline,o.ScrollFactor,o.Tint,o.Transform,o.Visible,c],initialize:function(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),a.call(this,t,"Text"),this.renderer=t.sys.renderer,this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline(),this.initPostPipeline(!0),this.canvas=n.create(this),this.context,this.style=new d(this,r),this.autoRound=!0,this.splitRegExp=/(?:\r\n|\r|\n)/,this._text=void 0,this.padding={left:0,right:0,top:0,bottom:0},this.width=1,this.height=1,this.lineSpacing=0,this.letterSpacing=0,0===this.style.resolution&&(this.style.resolution=1),this._crop=this.resetCropObject(),this._textureKey=f(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.context=this.texture.context,this.frame=this.texture.get(),this.frame.source.resolution=this.style.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.initRTL(),this.setText(s),r&&r.padding&&this.setPadding(r.padding),r&&r.lineSpacing&&this.setLineSpacing(r.lineSpacing)},initRTL:function(){this.style.rtl&&(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",s(this.canvas,this.scene.sys.canvas),this.originX=1)},runWordWrap:function(t){var e=this.style;if(e.wordWrapCallback){var i=e.wordWrapCallback.call(e.wordWrapCallbackScope,t,this);return Array.isArray(i)&&(i=i.join("\n")),i}return e.wordWrapWidth?e.wordWrapUseAdvanced?this.advancedWordWrap(t,this.context,this.style.wordWrapWidth):this.basicWordWrap(t,this.context,this.style.wordWrapWidth):t},advancedWordWrap:function(t,e,i){for(var s="",n=t.replace(/ +/gi," ").split(this.splitRegExp),r=n.length,o=0;ol){if(0===c){for(var v=f;v.length&&(v=v.slice(0,-1),!((p=e.measureText(v).width)<=l)););if(!v.length)throw new Error("wordWrapWidth < a single character");var g=d.substr(v.length);u[c]=g,h+=v}var m=u[c].length?c:c+1,y=u.slice(m).join(" ").replace(/[ \n]*$/gi,"");n.splice(o+1,0,y),r=n.length;break}h+=f,l-=p}s+=h.replace(/[ \n]*$/gi,"")+"\n"}}return s.replace(/[\s|\n]*$/gi,"")},basicWordWrap:function(t,e,i){for(var s="",n=t.split(this.splitRegExp),r=n.length-1,o=e.measureText(" ").width,a=0;a<=r;a++){for(var h=i,l=n[a].split(" "),u=l.length-1,c=0;c<=u;c++){var d=l[c],f=e.measureText(d).width,p=f;ch&&c>0&&(s+="\n",h=i),s+=d,c0&&(d+=l.lineSpacing*v),i.rtl)c=f-c-u.left-u.right;else if("right"===i.align)c+=o-l.lineWidths[v];else if("center"===i.align)c+=(o-l.lineWidths[v])/2;else if("justify"===i.align&&l.lineWidths[v]/l.width>=.85){var g=l.width-l.lineWidths[v],m=e.measureText(" ").width,y=a[v].trim(),x=y.split(" ");g+=(a[v].length-y.length)*m;for(var T=Math.floor(g/m),w=0;T>0;)x[w]+=" ",w=(w+1)%(x.length-1||1),--T;a[v]=x.join(" ")}if(this.autoRound&&(c=Math.round(c),d=Math.round(d)),i.strokeThickness&&(i.syncShadow(e,i.shadowStroke),e.strokeText(a[v],c,d)),i.color){i.syncShadow(e,i.shadowFill);var b=this.letterSpacing;if(0!==b)for(var S=0,E=a[v].split(""),A=0;A{t.exports=function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}},71259:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(50171);n.register("text",(function(t,e){void 0===t&&(t={});var i=r(t,"text",""),n=r(t,"style",null),a=r(t,"padding",null);null!==a&&(n.padding=a);var h=new o(this.scene,0,0,i,n);return void 0!==e&&(t.add=e),s(this.scene,h,t),h.autoRound=r(t,"autoRound",!0),h.resolution=r(t,"resolution",1),h}))},68005:(t,e,i)=>{var s=i(50171);i(39429).register("text",(function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))}))},61771:(t,e,i)=>{var s,n;i(29747),s=i(34397),n=i(79724),t.exports={renderWebGL:s,renderCanvas:n}},35762:(t,e,i)=>{var s=i(83419),n=i(23568),r=i(35154),o=i(79557),a={fontFamily:["fontFamily","Courier"],fontSize:["fontSize","16px"],fontStyle:["fontStyle",""],backgroundColor:["backgroundColor",null],color:["color","#fff"],stroke:["stroke","#fff"],strokeThickness:["strokeThickness",0],shadowOffsetX:["shadow.offsetX",0],shadowOffsetY:["shadow.offsetY",0],shadowColor:["shadow.color","#000"],shadowBlur:["shadow.blur",0],shadowStroke:["shadow.stroke",!1],shadowFill:["shadow.fill",!1],align:["align","left"],maxLines:["maxLines",0],fixedWidth:["fixedWidth",0],fixedHeight:["fixedHeight",0],resolution:["resolution",0],rtl:["rtl",!1],testString:["testString","|MÉqgy"],baselineX:["baselineX",1.2],baselineY:["baselineY",1.4],wordWrapWidth:["wordWrap.width",null],wordWrapCallback:["wordWrap.callback",null],wordWrapCallbackScope:["wordWrap.callbackScope",null],wordWrapUseAdvanced:["wordWrap.useAdvancedWrap",!1]},h=new s({initialize:function(t,e){this.parent=t,this.fontFamily,this.fontSize,this.fontStyle,this.backgroundColor,this.color,this.stroke,this.strokeThickness,this.shadowOffsetX,this.shadowOffsetY,this.shadowColor,this.shadowBlur,this.shadowStroke,this.shadowFill,this.align,this.maxLines,this.fixedWidth,this.fixedHeight,this.resolution,this.rtl,this.testString,this.baselineX,this.baselineY,this.wordWrapWidth,this.wordWrapCallback,this.wordWrapCallbackScope,this.wordWrapUseAdvanced,this._font,this.setStyle(e,!1,!0)},setStyle:function(t,e,i){for(var s in void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px"),a){var h=i?a[s][1]:this[s];this[s]="wordWrapCallback"===s||"wordWrapCallbackScope"===s?r(t,a[s][0],h):n(t,a[s][0],h)}var l=r(t,"font",null);null!==l&&this.setFont(l,!1),this._font=[this.fontStyle,this.fontSize,this.fontFamily].join(" ").trim();var u=r(t,"fill",null);null!==u&&(this.color=u);var c=r(t,"metrics",!1);return c?this.metrics={ascent:r(c,"ascent",0),descent:r(c,"descent",0),fontSize:r(c,"fontSize",0)}:!e&&this.metrics||(this.metrics=o(this)),e?this.parent.updateText():this.parent},syncFont:function(t,e){e.font=this._font},syncStyle:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"},syncShadow:function(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)},update:function(t){return t&&(this._font=[this.fontStyle,this.fontSize,this.fontFamily].join(" ").trim(),this.metrics=o(this)),this.parent.updateText()},setFont:function(t,e){void 0===e&&(e=!0);var i=t,s="",n="";if("string"!=typeof t)i=r(t,"fontFamily","Courier"),s=r(t,"fontSize","16px"),n=r(t,"fontStyle","");else{var o=t.split(" "),a=0;n=o.length>2?o[a++]:"",s=o[a++]||"16px",i=o[a++]||"Courier"}return i===this.fontFamily&&s===this.fontSize&&n===this.fontStyle||(this.fontFamily=i,this.fontSize=s,this.fontStyle=n,e&&this.update(!0)),this.parent},setFontFamily:function(t){return this.fontFamily!==t&&(this.fontFamily=t,this.update(!0)),this.parent},setFontStyle:function(t){return this.fontStyle!==t&&(this.fontStyle=t,this.update(!0)),this.parent},setFontSize:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize!==t&&(this.fontSize=t,this.update(!0)),this.parent},setTestString:function(t){return this.testString=t,this.update(!0)},setFixedSize:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(!1)},setBackgroundColor:function(t){return this.backgroundColor=t,this.update(!1)},setFill:function(t){return this.color=t,this.update(!1)},setColor:function(t){return this.color=t,this.update(!1)},setResolution:function(t){return this.resolution=t,this.update(!1)},setStroke:function(t,e){return void 0===e&&(e=this.strokeThickness),void 0===t&&0!==this.strokeThickness?(this.strokeThickness=0,this.update(!0)):this.stroke===t&&this.strokeThickness===e||(this.stroke=t,this.strokeThickness=e,this.update(!0)),this.parent},setShadow:function(t,e,i,s,n,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===n&&(n=!1),void 0===r&&(r=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=i,this.shadowBlur=s,this.shadowStroke=n,this.shadowFill=r,this.update(!1)},setShadowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)},setShadowColor:function(t){return void 0===t&&(t="#000"),this.shadowColor=t,this.update(!1)},setShadowBlur:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)},setShadowStroke:function(t){return this.shadowStroke=t,this.update(!1)},setShadowFill:function(t){return this.shadowFill=t,this.update(!1)},setWordWrapWidth:function(t,e){return void 0===e&&(e=!1),this.wordWrapWidth=t,this.wordWrapUseAdvanced=e,this.update(!1)},setWordWrapCallback:function(t,e){return void 0===e&&(e=null),this.wordWrapCallback=t,this.wordWrapCallbackScope=e,this.update(!1)},setAlign:function(t){return void 0===t&&(t="left"),this.align=t,this.update(!1)},setMaxLines:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)},getTextMetrics:function(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}},toJSON:function(){var t={};for(var e in a)t[e]=this[e];return t.metrics=this.getTextMetrics(),t},destroy:function(){this.parent=void 0}});t.exports=h},34397:(t,e,i)=>{var s=i(70554);t.exports=function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,o=r.width,a=r.height,h=s.getTintAppendFloatAlpha,l=t.pipelines.set(e.pipeline,e),u=l.setTexture2D(r.glTexture,e);l.batchTexture(e,r.glTexture,o,a,e.x,e.y,o/e.style.resolution,a/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,o,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,n,!1,u)}}},20839:(t,e,i)=>{var s=i(27919),n=i(83419),r=i(31401),o=i(95643),a=i(98439),h=i(68703),l=i(56295),u=i(45650),c=i(26099),d=new n({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.ComputedSize,r.Crop,r.Depth,r.Flip,r.GetBounds,r.Mask,r.Origin,r.Pipeline,r.PostPipeline,r.ScrollFactor,r.Tint,r.Transform,r.Visible,l],initialize:function(t,e,i,n,r,h,l){var d=t.sys.renderer;o.call(this,t,"TileSprite");var f=t.sys.textures.get(h),p=f.get(l);p.source.compressionAlgorithm&&(console.warn("TileSprite cannot use compressed texture"),p=(f=t.sys.textures.get("__MISSING")).get()),"DynamicTexture"===f.type&&(console.warn("TileSprite cannot use Dynamic Texture"),p=(f=t.sys.textures.get("__MISSING")).get()),n&&r?(n=Math.floor(n),r=Math.floor(r)):(n=p.width,r=p.height),this._tilePosition=new c,this._tileScale=new c(1,1),this.dirty=!1,this.renderer=d,this.canvas=s.create(this,n,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!1}),this.displayTexture=f,this.displayFrame=p,this._crop=this.resetCropObject(),this._textureKey=u(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.potWidth=a(p.width),this.potHeight=a(p.height),this.fillCanvas=s.create2D(this,this.potWidth,this.potHeight),this.fillContext=this.fillCanvas.getContext("2d",{willReadFrequently:!1}),this.fillPattern=null,this.setPosition(e,i),this.setSize(n,r),this.setFrame(l),this.setOriginFromFrame(),this.initPipeline(),this.initPostPipeline(!0)},setTexture:function(t,e){return this.displayTexture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t){var e=this.displayTexture.get(t);return this.potWidth=a(e.width),this.potHeight=a(e.height),this.canvas.width=0,e.cutWidth&&e.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this.displayFrame=e,this.dirty=!0,this.updateTileTexture(),this},setTilePosition:function(t,e){return void 0!==t&&(this.tilePositionX=t),void 0!==e&&(this.tilePositionY=e),this},setTileScale:function(t,e){return void 0===t&&(t=this.tileScaleX),void 0===e&&(e=t),this.tileScaleX=t,this.tileScaleY=e,this},updateTileTexture:function(){if(this.dirty&&this.renderer){var t=this.displayFrame;if(t.source.isRenderTexture||t.source.isGLTexture)return console.warn("TileSprites can only use Image or Canvas based textures"),void(this.dirty=!1);var e=this.fillContext,i=this.fillCanvas,s=this.potWidth,n=this.potHeight;this.renderer&&this.renderer.gl||(s=t.cutWidth,n=t.cutHeight),e.clearRect(0,0,s,n),i.width=s,i.height=n,e.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,s,n),this.renderer&&this.renderer.gl?this.fillPattern=this.renderer.canvasToTexture(i,this.fillPattern):this.fillPattern=e.createPattern(i,"repeat"),this.updateCanvas(),this.dirty=!1}},updateCanvas:function(){var t=this.canvas;if(t.width===this.width&&t.height===this.height||(t.width=this.width,t.height=this.height,this.frame.setSize(this.width,this.height),this.updateDisplayOrigin(),this.dirty=!0),!this.dirty||this.renderer&&this.renderer.gl)this.dirty=!1;else{var e=this.context;this.scene.sys.game.config.antialias||h.disable(e);var i=this._tileScale.x,s=this._tileScale.y,n=this._tilePosition.x,r=this._tilePosition.y;e.clearRect(0,0,this.width,this.height),e.save(),e.scale(i,s),e.translate(-n,-r),e.fillStyle=this.fillPattern,e.fillRect(n,r,this.width/i,this.height/s),e.restore(),this.dirty=!1}},preDestroy:function(){this.renderer&&this.renderer.gl&&this.renderer.deleteTexture(this.fillPattern),s.remove(this.canvas),s.remove(this.fillCanvas),this.fillPattern=null,this.fillContext=null,this.fillCanvas=null,this.displayTexture=null,this.displayFrame=null;var t=this.texture;t&&t.destroy(),this.renderer=null},tilePositionX:{get:function(){return this._tilePosition.x},set:function(t){this._tilePosition.x=t,this.dirty=!0}},tilePositionY:{get:function(){return this._tilePosition.y},set:function(t){this._tilePosition.y=t,this.dirty=!0}},tileScaleX:{get:function(){return this._tileScale.x},set:function(t){this._tileScale.x=t,this.dirty=!0}},tileScaleY:{get:function(){return this._tileScale.y},set:function(t){this._tileScale.y=t,this.dirty=!0}}});t.exports=d},46992:t=>{t.exports=function(t,e,i,s){e.updateCanvas(),i.addToRenderList(e),t.batchSprite(e,e.frame,i,s)}},14167:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(20839);n.register("tileSprite",(function(t,e){void 0===t&&(t={});var i=r(t,"x",0),n=r(t,"y",0),a=r(t,"width",512),h=r(t,"height",512),l=r(t,"key",""),u=r(t,"frame",""),c=new o(this.scene,i,n,a,h,l,u);return void 0!==e&&(t.add=e),s(this.scene,c,t),c}))},91681:(t,e,i)=>{var s=i(20839);i(39429).register("tileSprite",(function(t,e,i,n,r,o){return this.displayList.add(new s(this.scene,t,e,i,n,r,o))}))},56295:(t,e,i)=>{var s,n;i(29747),s=i(18553),n=i(46992),t.exports={renderWebGL:s,renderCanvas:n}},18553:(t,e,i)=>{var s=i(70554);t.exports=function(t,e,i,n){e.updateCanvas();var r=e.width,o=e.height;if(0!==r&&0!==o){i.addToRenderList(e);var a=s.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(e.fillPattern,e);h.batchTexture(e,e.fillPattern,e.displayFrame.width*e.tileScaleX,e.displayFrame.height*e.tileScaleY,e.x,e.y,r,o,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.originX*r,e.originY*o,0,0,r,o,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,e.tilePositionX%e.displayFrame.width/e.displayFrame.width,e.tilePositionY%e.displayFrame.height/e.displayFrame.height,i,n,!1,l)}}},18471:(t,e,i)=>{var s=i(45319),n=i(83419),r=i(31401),o=i(51708),a=i(8443),h=i(95643),l=i(36383),u=i(14463),c=i(45650),d=i(10247),f=new n({Extends:h,Mixins:[r.Alpha,r.BlendMode,r.ComputedSize,r.Depth,r.Flip,r.GetBounds,r.Mask,r.Origin,r.Pipeline,r.PostPipeline,r.ScrollFactor,r.TextureCrop,r.Tint,r.Transform,r.Visible,d],initialize:function(t,e,i,s){h.call(this,t,"Video"),this.video,this.videoTexture,this.videoTextureSource,this.snapshotTexture,this.flipY=!1,this._key=c(),this.touchLocked=!1,this.playWhenUnlocked=!1,this.frameReady=!1,this.isStalled=!1,this.failedPlayAttempts=0,this.metadata,this.retry=0,this.retryInterval=500,this._systemMuted=!1,this._codeMuted=!1,this._systemPaused=!1,this._codePaused=!1,this._callbacks={ended:this.completeHandler.bind(this),legacy:this.legacyPlayHandler.bind(this),playing:this.playingHandler.bind(this),seeked:this.seekedHandler.bind(this),seeking:this.seekingHandler.bind(this),stalled:this.stalledHandler.bind(this),suspend:this.stalledHandler.bind(this),waiting:this.stalledHandler.bind(this)},this._loadCallbackHandler=this.loadErrorHandler.bind(this),this._metadataCallbackHandler=this.metadataHandler.bind(this),this._crop=this.resetCropObject(),this.markers={},this._markerIn=0,this._markerOut=0,this._playingMarker=!1,this._lastUpdate=0,this.cacheKey="",this.isSeeking=!1,this._playCalled=!1,this._rfvCallbackId=0;var n=t.sys.game;this._device=n.device.video,this.setPosition(e,i),this.setSize(256,256),this.initPipeline(),this.initPostPipeline(!0),n.events.on(a.PAUSE,this.globalPause,this),n.events.on(a.RESUME,this.globalResume,this);var r=t.sys.sound;r&&r.on(u.GLOBAL_MUTE,this.globalMute,this),s&&this.load(s)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},load:function(t){var e=this.scene.sys.cache.video.get(t);return e?(this.cacheKey=t,this.loadHandler(e.url,e.noAudio,e.crossOrigin)):console.warn("No video in cache for key: "+t),this},changeSource:function(t,e,i,s,n){void 0===e&&(e=!0),void 0===i&&(i=!1),this.cacheKey!==t&&(this.load(t),e&&this.play(i,s,n))},getVideoKey:function(){return this.cacheKey},loadURL:function(t,e,i){void 0===e&&(e=!1);var s=this._device.getVideoURL(t);return s?(this.cacheKey="",this.loadHandler(s.url,e,i)):console.warn("No supported video format found for "+t),this},loadMediaStream:function(t,e,i){return this.loadHandler(null,e,i,t)},loadHandler:function(t,e,i,s){e||(e=!1);var n=this.video;if(n?(this.removeLoadEventHandlers(),this.stop()):((n=document.createElement("video")).controls=!1,n.setAttribute("playsinline","playsinline"),n.setAttribute("preload","auto"),n.setAttribute("disablePictureInPicture","true")),e?(n.muted=!0,n.defaultMuted=!0,n.setAttribute("autoplay","autoplay")):(n.muted=!1,n.defaultMuted=!1,n.removeAttribute("autoplay")),i?n.setAttribute("crossorigin",i):n.removeAttribute("crossorigin"),s)if("srcObject"in n)try{n.srcObject=s}catch(o){if("TypeError"!==o.name)throw o;n.src=URL.createObjectURL(s)}else n.src=URL.createObjectURL(s);else n.src=t;this.retry=0,this.video=n,this._playCalled=!1,n.load(),this.addLoadEventHandlers();var r=this.scene.sys.textures.get(this._key);return this.setTexture(r),this},requestVideoFrame:function(t,e){var i=this.video;if(i){var s=e.width,n=e.height,r=this.videoTexture,a=this.videoTextureSource,h=!r||a.source!==i;h?(this._codePaused=i.paused,this._codeMuted=i.muted,r?(a.source=i,a.width=s,a.height=n,r.get().setSize(s,n)):((r=this.scene.sys.textures.create(this._key,i,s,n)).add("__BASE",0,0,0,s,n),this.setTexture(r),this.videoTexture=r,this.videoTextureSource=r.source[0],this.videoTextureSource.setFlipY(this.flipY),this.emit(o.VIDEO_TEXTURE,this,r)),this.setSizeToFrame(),this.updateDisplayOrigin()):a.update(),this.isStalled=!1,this.metadata=e;var l=e.mediaTime;h&&(this._lastUpdate=l,this.emit(o.VIDEO_CREATED,this,s,n),this.frameReady||(this.frameReady=!0,this.emit(o.VIDEO_PLAY,this))),this._playingMarker?l>=this._markerOut&&(i.loop?(i.currentTime=this._markerIn,this.emit(o.VIDEO_LOOP,this)):(this.stop(!1),this.emit(o.VIDEO_COMPLETE,this))):l-1&&i>e&&i=0&&!isNaN(i)&&i>e&&(this.markers[t]=[e,i]),this},playMarker:function(t,e){var i=this.markers[t];return i&&this.play(e,i[0],i[1]),this},removeMarker:function(t){return delete this.markers[t],this},snapshot:function(t,e){return void 0===t&&(t=this.width),void 0===e&&(e=this.height),this.snapshotArea(0,0,this.width,this.height,t,e)},snapshotArea:function(t,e,i,s,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.width),void 0===s&&(s=this.height),void 0===n&&(n=i),void 0===r&&(r=s);var o=this.video,a=this.snapshotTexture;return a?(a.setSize(n,r),o&&a.context.drawImage(o,t,e,i,s,0,0,n,r)):(a=this.scene.sys.textures.createCanvas(c(),n,r),this.snapshotTexture=a,o&&a.context.drawImage(o,t,e,i,s,0,0,n,r)),a.update()},saveSnapshotTexture:function(t){return this.snapshotTexture?this.scene.sys.textures.renameTexture(this.snapshotTexture.key,t):this.snapshotTexture=this.scene.sys.textures.createCanvas(t,this.width,this.height),this.snapshotTexture},playSuccess:function(){if(this._playCalled){this.addEventHandlers(),this._codePaused=!1,this.touchLocked&&(this.touchLocked=!1,this.emit(o.VIDEO_UNLOCKED,this));var t=this.scene.sys.sound;t&&t.mute&&this.setMute(!0),this._markerIn>-1&&(this.video.currentTime=this._markerIn)}},playError:function(t){var e=t.name;"NotAllowedError"===e?(this.touchLocked=!0,this.playWhenUnlocked=!0,this.failedPlayAttempts=1,this.emit(o.VIDEO_LOCKED,this)):"NotSupportedError"===e?(this.stop(!1),this.emit(o.VIDEO_UNSUPPORTED,this,t)):(this.stop(!1),this.emit(o.VIDEO_ERROR,this,t))},legacyPlayHandler:function(){var t=this.video;t&&(this.playSuccess(),t.removeEventListener("playing",this._callbacks.legacy))},playingHandler:function(){this.isStalled=!1,this.emit(o.VIDEO_PLAYING,this)},loadErrorHandler:function(t){this.stop(!1),this.emit(o.VIDEO_ERROR,this,t)},metadataHandler:function(t){this.emit(o.VIDEO_METADATA,this,t)},setSizeToFrame:function(t){t||(t=this.frame),this.width=t.realWidth,this.height=t.realHeight,1!==this.scaleX&&(this.scaleX=this.displayWidth/this.width),1!==this.scaleY&&(this.scaleY=this.displayHeight/this.height);var e=this.input;return e&&!e.customHitArea&&(e.hitArea.width=this.width,e.hitArea.height=this.height),this},stalledHandler:function(t){this.isStalled=!0,this.emit(o.VIDEO_STALLED,this,t)},completeHandler:function(){this._playCalled=!1,this.emit(o.VIDEO_COMPLETE,this)},preUpdate:function(t,e){this.video&&this._playCalled&&this.touchLocked&&this.playWhenUnlocked&&(this.retry+=e,this.retry>=this.retryInterval&&(this.createPlayPromise(!1),this.retry=0))},seekTo:function(t){var e=this.video;if(e){var i=e.duration;if(i!==1/0&&!isNaN(i)){var s=i*t;this.setCurrentTime(s)}}return this},getCurrentTime:function(){return this.video?this.video.currentTime:0},setCurrentTime:function(t){var e=this.video;if(e){if("string"==typeof t){var i=t[0],s=parseFloat(t.substr(1));"+"===i?t=e.currentTime+s:"-"===i&&(t=e.currentTime-s)}e.currentTime=t}return this},seekingHandler:function(){this.isSeeking=!0,this.emit(o.VIDEO_SEEKING,this)},seekedHandler:function(){this.isSeeking=!1,this.emit(o.VIDEO_SEEKED,this)},getProgress:function(){var t=this.video;if(t){var e=t.duration;if(e!==1/0&&!isNaN(e))return t.currentTime/e}return-1},getDuration:function(){return this.video?this.video.duration:0},setMute:function(t){void 0===t&&(t=!0),this._codeMuted=t;var e=this.video;return e&&(e.muted=!!this._systemMuted||t),this},isMuted:function(){return this._codeMuted},globalMute:function(t,e){this._systemMuted=e;var i=this.video;i&&(i.muted=!!this._codeMuted||e)},globalPause:function(){this._systemPaused=!0,this.video&&!this.video.ended&&(this.removeEventHandlers(),this.video.pause())},globalResume:function(){this._systemPaused=!1,!this.video||this._codePaused||this.video.ended||this.createPlayPromise()},setPaused:function(t){void 0===t&&(t=!0);var e=this.video;return this._codePaused=t,e&&!e.ended&&(t?e.paused||(this.removeEventHandlers(),e.pause()):t||(this._playCalled?e.paused&&!this._systemPaused&&this.createPlayPromise():this.play())),this},pause:function(){return this.setPaused(!0)},resume:function(){return this.setPaused(!1)},getVolume:function(){return this.video?this.video.volume:1},setVolume:function(t){return void 0===t&&(t=1),this.video&&(this.video.volume=s(t,0,1)),this},getPlaybackRate:function(){return this.video?this.video.playbackRate:1},setPlaybackRate:function(t){return this.video&&(this.video.playbackRate=t),this},getLoop:function(){return!!this.video&&this.video.loop},setLoop:function(t){return void 0===t&&(t=!0),this.video&&(this.video.loop=t),this},isPlaying:function(){return!!this.video&&!(this.video.paused||this.video.ended)},isPaused:function(){return this.video&&this._playCalled&&this.video.paused||this._codePaused||this._systemPaused},saveTexture:function(t,e){return void 0===e&&(e=!1),this.videoTexture&&(this.scene.sys.textures.renameTexture(this._key,t),this.videoTextureSource.setFlipY(e)),this._key=t,this.flipY=e,!!this.videoTexture},stop:function(t){void 0===t&&(t=!0);var e=this.video;return e&&(this.removeEventHandlers(),e.cancelVideoFrameCallback(this._rfvCallbackId),e.pause()),this.retry=0,this._playCalled=!1,t&&this.emit(o.VIDEO_STOP,this),this},removeVideoElement:function(){var t=this.video;if(t){for(t.parentNode&&t.parentNode.removeChild(t);t.hasChildNodes();)t.removeChild(t.firstChild);t.removeAttribute("autoplay"),t.removeAttribute("src"),this.video=null}},preDestroy:function(){this.stop(!1),this.removeLoadEventHandlers(),this.removeVideoElement();var t=this.scene.sys.game.events;t.off(a.PAUSE,this.globalPause,this),t.off(a.RESUME,this.globalResume,this);var e=this.scene.sys.sound;e&&e.off(u.GLOBAL_MUTE,this.globalMute,this)}});t.exports=f},58352:t=>{t.exports=function(t,e,i,s){e.videoTexture&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}},11511:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(18471);n.register("video",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=new o(this.scene,0,0,i);return void 0!==e&&(t.add=e),s(this.scene,n,t),n}))},89025:(t,e,i)=>{var s=i(18471);i(39429).register("video",(function(t,e,i){return this.displayList.add(new s(this.scene,t,e,i))}))},10247:(t,e,i)=>{var s,n;i(29747),s=i(29849),n=i(58352),t.exports={renderWebGL:s,renderCanvas:n}},29849:t=>{t.exports=function(t,e,i,s){e.videoTexture&&(i.addToRenderList(e),e.pipeline.batchSprite(e,i,s))}},41481:(t,e,i)=>{var s=i(10312),n=i(96503),r=i(87902),o=i(83419),a=i(31401),h=i(95643),l=i(87841),u=i(37303),c=new o({Extends:h,Mixins:[a.Depth,a.GetBounds,a.Origin,a.Transform,a.ScrollFactor,a.Visible],initialize:function(t,e,i,n,r){void 0===n&&(n=1),void 0===r&&(r=n),h.call(this,t,"Zone"),this.setPosition(e,i),this.width=n,this.height=r,this.blendMode=s.NORMAL,this.updateDisplayOrigin()},displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}},setSize:function(t,e,i){void 0===i&&(i=!0),this.width=t,this.height=e,this.updateDisplayOrigin();var s=this.input;return i&&s&&!s.customHitArea&&(s.hitArea.width=t,s.hitArea.height=e),this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this},setCircleDropZone:function(t){return this.setDropZone(new n(0,0,t),r)},setRectangleDropZone:function(t,e){return this.setDropZone(new l(0,0,t,e),u)},setDropZone:function(t,e){return this.input||this.setInteractive(t,e,!0),this},setAlpha:function(){},setBlendMode:function(){},renderCanvas:function(t,e,i){i.addToRenderList(e)},renderWebGL:function(t,e,i){i.addToRenderList(e)}});t.exports=c},95261:(t,e,i)=>{var s=i(44603),n=i(23568),r=i(41481);s.register("zone",(function(t){var e=n(t,"x",0),i=n(t,"y",0),s=n(t,"width",1),o=n(t,"height",s);return new r(this.scene,e,i,s,o)}))},84175:(t,e,i)=>{var s=i(41481);i(39429).register("zone",(function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))}))},95166:t=>{t.exports=function(t){return t.radius>0?Math.PI*t.radius*t.radius:0}},96503:(t,e,i)=>{var s=i(83419),n=i(87902),r=i(26241),o=i(79124),a=i(23777),h=i(28176),l=new s({initialize:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.type=a.CIRCLE,this.x=t,this.y=e,this._radius=i,this._diameter=2*i},contains:function(t,e){return n(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return h(this,t)},setTo:function(t,e,i){return this.x=t,this.y=e,this._radius=i,this._diameter=2*i,this},setEmpty:function(){return this._radius=0,this._diameter=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},isEmpty:function(){return this._radius<=0},radius:{get:function(){return this._radius},set:function(t){this._radius=t,this._diameter=2*t}},diameter:{get:function(){return this._diameter},set:function(t){this._diameter=t,this._radius=.5*t}},left:{get:function(){return this.x-this._radius},set:function(t){this.x=t+this._radius}},right:{get:function(){return this.x+this._radius},set:function(t){this.x=t-this._radius}},top:{get:function(){return this.y-this._radius},set:function(t){this.y=t+this._radius}},bottom:{get:function(){return this.y+this._radius},set:function(t){this.y=t-this._radius}}});t.exports=l},71562:t=>{t.exports=function(t){return Math.PI*t.radius*2}},92110:(t,e,i)=>{var s=i(2141);t.exports=function(t,e,i){return void 0===i&&(i=new s),i.x=t.x+t.radius*Math.cos(e),i.y=t.y+t.radius*Math.sin(e),i}},42250:(t,e,i)=>{var s=i(96503);t.exports=function(t){return new s(t.x,t.y,t.radius)}},87902:t=>{t.exports=function(t,e,i){return t.radius>0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},5698:(t,e,i)=>{var s=i(87902);t.exports=function(t,e){return s(t,e.x,e.y)}},70588:(t,e,i)=>{var s=i(87902);t.exports=function(t,e){return s(t,e.x,e.y)&&s(t,e.right,e.y)&&s(t,e.x,e.bottom)&&s(t,e.right,e.bottom)}},26394:t=>{t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},76278:t=>{t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},2074:(t,e,i)=>{var s=i(87841);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=t.left,e.y=t.top,e.width=t.diameter,e.height=t.diameter,e}},26241:(t,e,i)=>{var s=i(92110),n=i(62945),r=i(36383),o=i(2141);t.exports=function(t,e,i){void 0===i&&(i=new o);var a=n(e,0,r.PI2);return s(t,a,i)}},79124:(t,e,i)=>{var s=i(71562),n=i(92110),r=i(62945),o=i(36383);t.exports=function(t,e,i,a){void 0===a&&(a=[]),!e&&i>0&&(e=s(t)/i);for(var h=0;h{t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},39212:t=>{t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},28176:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){void 0===e&&(e=new s);var i=2*Math.PI*Math.random(),n=Math.random()+Math.random(),r=n>1?2-n:n,o=r*Math.cos(i),a=r*Math.sin(i);return e.x=t.x+o*t.radius,e.y=t.y+a*t.radius,e}},88911:(t,e,i)=>{var s=i(96503);s.Area=i(95166),s.Circumference=i(71562),s.CircumferencePoint=i(92110),s.Clone=i(42250),s.Contains=i(87902),s.ContainsPoint=i(5698),s.ContainsRect=i(70588),s.CopyFrom=i(26394),s.Equals=i(76278),s.GetBounds=i(2074),s.GetPoint=i(26241),s.GetPoints=i(79124),s.Offset=i(50884),s.OffsetPoint=i(39212),s.Random=i(28176),t.exports=s},23777:t=>{t.exports={CIRCLE:0,ELLIPSE:1,LINE:2,POINT:3,POLYGON:4,RECTANGLE:5,TRIANGLE:6}},78874:t=>{t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},92990:t=>{t.exports=function(t){var e=t.width/2,i=t.height/2,s=Math.pow(e-i,2)/Math.pow(e+i,2);return Math.PI*(e+i)*(1+3*s/(10+Math.sqrt(4-3*s)))}},79522:(t,e,i)=>{var s=i(2141);t.exports=function(t,e,i){void 0===i&&(i=new s);var n=t.width/2,r=t.height/2;return i.x=t.x+n*Math.cos(e),i.y=t.y+r*Math.sin(e),i}},58102:(t,e,i)=>{var s=i(8497);t.exports=function(t){return new s(t.x,t.y,t.width,t.height)}},81154:t=>{t.exports=function(t,e,i){if(t.width<=0||t.height<=0)return!1;var s=(e-t.x)/t.width,n=(i-t.y)/t.height;return(s*=s)+(n*=n)<.25}},46662:(t,e,i)=>{var s=i(81154);t.exports=function(t,e){return s(t,e.x,e.y)}},1632:(t,e,i)=>{var s=i(81154);t.exports=function(t,e){return s(t,e.x,e.y)&&s(t,e.right,e.y)&&s(t,e.x,e.bottom)&&s(t,e.right,e.bottom)}},65534:t=>{t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},8497:(t,e,i)=>{var s=i(83419),n=i(81154),r=i(90549),o=i(48320),a=i(23777),h=i(24820),l=new s({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.type=a.ELLIPSE,this.x=t,this.y=e,this.width=i,this.height=s},contains:function(t,e){return n(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return h(this,t)},setTo:function(t,e,i,s){return this.x=t,this.y=e,this.width=i,this.height=s,this},setEmpty:function(){return this.width=0,this.height=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getMinorRadius:function(){return Math.min(this.width,this.height)/2},getMajorRadius:function(){return Math.max(this.width,this.height)/2},left:{get:function(){return this.x-this.width/2},set:function(t){this.x=t+this.width/2}},right:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},top:{get:function(){return this.y-this.height/2},set:function(t){this.y=t+this.height/2}},bottom:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=l},36146:t=>{t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},23694:(t,e,i)=>{var s=i(87841);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=t.left,e.y=t.top,e.width=t.width,e.height=t.height,e}},90549:(t,e,i)=>{var s=i(79522),n=i(62945),r=i(36383),o=i(2141);t.exports=function(t,e,i){void 0===i&&(i=new o);var a=n(e,0,r.PI2);return s(t,a,i)}},48320:(t,e,i)=>{var s=i(92990),n=i(79522),r=i(62945),o=i(36383);t.exports=function(t,e,i,a){void 0===a&&(a=[]),!e&&i>0&&(e=s(t)/i);for(var h=0;h{t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},44808:t=>{t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},24820:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){void 0===e&&(e=new s);var i=Math.random()*Math.PI*2,n=Math.sqrt(Math.random());return e.x=t.x+n*Math.cos(i)*t.width/2,e.y=t.y+n*Math.sin(i)*t.height/2,e}},49203:(t,e,i)=>{var s=i(8497);s.Area=i(78874),s.Circumference=i(92990),s.CircumferencePoint=i(79522),s.Clone=i(58102),s.Contains=i(81154),s.ContainsPoint=i(46662),s.ContainsRect=i(1632),s.CopyFrom=i(65534),s.Equals=i(36146),s.GetBounds=i(23694),s.GetPoint=i(90549),s.GetPoints=i(48320),s.Offset=i(73424),s.OffsetPoint=i(44808),s.Random=i(24820),t.exports=s},55738:(t,e,i)=>{var s=i(23777),n=i(79291),r={Circle:i(88911),Ellipse:i(49203),Intersects:i(91865),Line:i(2529),Mesh:i(73090),Point:i(43711),Polygon:i(58423),Rectangle:i(93232),Triangle:i(84435)};r=n(!1,r,s),t.exports=r},2044:(t,e,i)=>{var s=i(20339);t.exports=function(t,e){return s(t.x,t.y,e.x,e.y)<=t.radius+e.radius}},81491:t=>{t.exports=function(t,e){var i=e.width/2,s=e.height/2,n=Math.abs(t.x-e.x-i),r=Math.abs(t.y-e.y-s),o=i+t.radius,a=s+t.radius;if(n>o||r>a)return!1;if(n<=i||r<=s)return!0;var h=n-i,l=r-s;return h*h+l*l<=t.radius*t.radius}},63376:(t,e,i)=>{var s=i(2141),n=i(2044);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e)){var r,o,a,h,l=t.x,u=t.y,c=t.radius,d=e.x,f=e.y,p=e.radius;if(u===f)0==(a=(o=-2*f)*o-4*(r=1)*(d*d+(h=(p*p-c*c-d*d+l*l)/(2*(l-d)))*h-2*d*h+f*f-p*p))?i.push(new s(h,-o/(2*r))):a>0&&(i.push(new s(h,(-o+Math.sqrt(a))/(2*r))),i.push(new s(h,(-o-Math.sqrt(a))/(2*r))));else{var v=(l-d)/(u-f),g=(p*p-c*c-d*d+l*l-f*f+u*u)/(2*(u-f));0==(a=(o=2*u*v-2*g*v-2*l)*o-4*(r=v*v+1)*(l*l+u*u+g*g-c*c-2*u*g))?(h=-o/(2*r),i.push(new s(h,g-h*v))):a>0&&(h=(-o+Math.sqrt(a))/(2*r),i.push(new s(h,g-h*v)),h=(-o-Math.sqrt(a))/(2*r),i.push(new s(h,g-h*v)))}}return i}},97439:(t,e,i)=>{var s=i(4042),n=i(81491);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e)){var r=e.getLineA(),o=e.getLineB(),a=e.getLineC(),h=e.getLineD();s(r,t,i),s(o,t,i),s(a,t,i),s(h,t,i)}return i}},4042:(t,e,i)=>{var s=i(2141),n=i(80462);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e)){var r,o,a=t.x1,h=t.y1,l=t.x2,u=t.y2,c=e.x,d=e.y,f=e.radius,p=l-a,v=u-h,g=a-c,m=h-d,y=p*p+v*v,x=2*(p*g+v*m),T=x*x-4*y*(g*g+m*m-f*f);if(0===T){var w=-x/(2*y);r=a+w*p,o=h+w*v,w>=0&&w<=1&&i.push(new s(r,o))}else if(T>0){var b=(-x-Math.sqrt(T))/(2*y);r=a+b*p,o=h+b*v,b>=0&&b<=1&&i.push(new s(r,o));var S=(-x+Math.sqrt(T))/(2*y);r=a+S*p,o=h+S*v,S>=0&&S<=1&&i.push(new s(r,o))}}return i}},36100:(t,e,i)=>{var s=i(25836);t.exports=function(t,e,i,n){void 0===i&&(i=!1);var r,o,a,h=t.x1,l=t.y1,u=t.x2,c=t.y2,d=e.x1,f=e.y1,p=u-h,v=c-l,g=e.x2-d,m=e.y2-f,y=p*m-v*g;if(0===y)return null;if(i){if((o=(d+g*(r=(p*(f-l)+v*(h-d))/(g*v-m*p))-h)/p)<0||r<0||r>1)return null;a=o}else{if(o=((l-f)*p-(h-d)*v)/y,(r=((d-h)*m-(f-l)*g)/y)<0||r>1||o<0||o>1)return null;a=r}return void 0===n&&(n=new s),n.set(h+p*a,l+v*a,a)}},3073:(t,e,i)=>{var s=i(36100),n=i(23031),r=i(25836),o=new n,a=new r;t.exports=function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=new r);var h=!1;n.set(),a.set();for(var l=e[e.length-1],u=0;u{var s=i(25836),n=i(61369),r=i(3073),o=new s;t.exports=function(t,e,i,s){void 0===s&&(s=new n),Array.isArray(e)||(e=[e]);var a=!1;s.set(),o.set();for(var h=0;h{var s=i(2141),n=i(76112),r=i(92773);t.exports=function(t,e,i){if(void 0===i&&(i=[]),r(t,e))for(var o=e.getLineA(),a=e.getLineB(),h=e.getLineC(),l=e.getLineD(),u=[new s,new s,new s,new s],c=[n(o,t,u[0]),n(a,t,u[1]),n(h,t,u[2]),n(l,t,u[3])],d=0;d<4;d++)c[d]&&i.push(u[d]);return i}},71147:(t,e,i)=>{var s=i(61369),n=i(56362),r=new(i(23031));function o(t,e,i,o,a){var h=Math.cos(t),l=Math.sin(t);r.setTo(e,i,e+h,i+l);var u=n(r,o,!0);u&&a.push(new s(u.x,u.y,t,u.w))}function a(t,e){return t.z-e.z}t.exports=function(t,e,i){Array.isArray(i)||(i=[i]);for(var s=[],n=[],r=0;r{var s=i(87841),n=i(59996);t.exports=function(t,e,i){return void 0===i&&(i=new s),n(t,e)&&(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y),i}},52784:(t,e,i)=>{var s=i(60646),n=i(59996);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e)){var r=t.getLineA(),o=t.getLineB(),a=t.getLineC(),h=t.getLineD();s(r,e,i),s(o,e,i),s(a,e,i),s(h,e,i)}return i}},26341:(t,e,i)=>{var s=i(89265),n=i(60646);t.exports=function(t,e,i){if(void 0===i&&(i=[]),s(t,e)){var r=e.getLineA(),o=e.getLineB(),a=e.getLineC();n(r,t,i),n(o,t,i),n(a,t,i)}return i}},38720:(t,e,i)=>{var s=i(4042),n=i(67636);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e)){var r=t.getLineA(),o=t.getLineB(),a=t.getLineC();s(r,e,i),s(o,e,i),s(a,e,i)}return i}},13882:(t,e,i)=>{var s=i(2141),n=i(2822),r=i(76112);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e))for(var o=t.getLineA(),a=t.getLineB(),h=t.getLineC(),l=[new s,new s,new s],u=[r(o,e,l[0]),r(a,e,l[1]),r(h,e,l[2])],c=0;c<3;c++)u[c]&&i.push(l[c]);return i}},75636:(t,e,i)=>{var s=i(82944),n=i(13882);t.exports=function(t,e,i){if(void 0===i&&(i=[]),s(t,e)){var r=e.getLineA(),o=e.getLineB(),a=e.getLineC();n(t,r,i),n(t,o,i),n(t,a,i)}return i}},80462:(t,e,i)=>{var s=i(87902),n=new(i(2141));t.exports=function(t,e,i){if(void 0===i&&(i=n),s(e,t.x1,t.y1))return i.x=t.x1,i.y=t.y1,!0;if(s(e,t.x2,t.y2))return i.x=t.x2,i.y=t.y2,!0;var r=t.x2-t.x1,o=t.y2-t.y1,a=e.x-t.x1,h=e.y-t.y1,l=r*r+o*o,u=r,c=o;if(l>0){var d=(a*r+h*o)/l;u*=d,c*=d}return i.x=t.x1+u,i.y=t.y1+c,u*u+c*c<=l&&u*r+c*o>=0&&s(e,i.x,i.y)}},76112:t=>{t.exports=function(t,e,i){var s=t.x1,n=t.y1,r=t.x2,o=t.y2,a=e.x1,h=e.y1,l=e.x2,u=e.y2;if(s===r&&n===o||a===l&&h===u)return!1;var c=(u-h)*(r-s)-(l-a)*(o-n);if(0===c)return!1;var d=((l-a)*(n-h)-(u-h)*(s-a))/c,f=((r-s)*(n-h)-(o-n)*(s-a))/c;return!(d<0||d>1||f<0||f>1||(i&&(i.x=s+d*(r-s),i.y=n+d*(o-n)),0))}},92773:t=>{t.exports=function(t,e){var i=t.x1,s=t.y1,n=t.x2,r=t.y2,o=e.x,a=e.y,h=e.right,l=e.bottom,u=0;if(i>=o&&i<=h&&s>=a&&s<=l||n>=o&&n<=h&&r>=a&&r<=l)return!0;if(i=o){if((u=s+(r-s)*(o-i)/(n-i))>a&&u<=l)return!0}else if(i>h&&n<=h&&(u=s+(r-s)*(h-i)/(n-i))>=a&&u<=l)return!0;if(s=a){if((u=i+(n-i)*(a-s)/(r-s))>=o&&u<=h)return!0}else if(s>l&&r<=l&&(u=i+(n-i)*(l-s)/(r-s))>=o&&u<=h)return!0;return!1}},16204:t=>{t.exports=function(t,e,i){void 0===i&&(i=1);var s=e.x1,n=e.y1,r=e.x2,o=e.y2,a=t.x,h=t.y,l=(r-s)*(r-s)+(o-n)*(o-n);if(0===l)return!1;var u=((a-s)*(r-s)+(h-n)*(o-n))/l;if(u<0)return Math.sqrt((s-a)*(s-a)+(n-h)*(n-h))<=i;if(u>=0&&u<=1){var c=((n-h)*(r-s)-(s-a)*(o-n))/l;return Math.abs(c)*Math.sqrt(l)<=i}return Math.sqrt((r-a)*(r-a)+(o-h)*(o-h))<=i}},14199:(t,e,i)=>{var s=i(16204);t.exports=function(t,e){if(!s(t,e))return!1;var i=Math.min(e.x1,e.x2),n=Math.max(e.x1,e.x2),r=Math.min(e.y1,e.y2),o=Math.max(e.y1,e.y2);return t.x>=i&&t.x<=n&&t.y>=r&&t.y<=o}},59996:t=>{t.exports=function(t,e){return!(t.width<=0||t.height<=0||e.width<=0||e.height<=0||t.righte.right||t.y>e.bottom)}},89265:(t,e,i)=>{var s=i(76112),n=i(37303),r=i(48653),o=i(77493);t.exports=function(t,e){if(e.left>t.right||e.rightt.bottom||e.bottom0}},84411:t=>{t.exports=function(t,e,i,s,n,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||n{var s=i(80462),n=i(10690);t.exports=function(t,e){return!(t.left>e.right||t.righte.bottom||t.bottom{var s=i(76112);t.exports=function(t,e){return!!(t.contains(e.x1,e.y1)||t.contains(e.x2,e.y2)||s(t.getLineA(),e)||s(t.getLineB(),e)||s(t.getLineC(),e))}},82944:(t,e,i)=>{var s=i(48653),n=i(71694),r=i(76112);t.exports=function(t,e){if(t.left>e.right||t.righte.bottom||t.bottom0||(c=n(e),(d=s(t,c,!0)).length>0)}},91865:(t,e,i)=>{t.exports={CircleToCircle:i(2044),CircleToRectangle:i(81491),GetCircleToCircle:i(63376),GetCircleToRectangle:i(97439),GetLineToCircle:i(4042),GetLineToLine:i(36100),GetLineToPoints:i(3073),GetLineToPolygon:i(56362),GetLineToRectangle:i(60646),GetRaysFromPointToPolygon:i(71147),GetRectangleIntersection:i(68389),GetRectangleToRectangle:i(52784),GetRectangleToTriangle:i(26341),GetTriangleToCircle:i(38720),GetTriangleToLine:i(13882),GetTriangleToTriangle:i(75636),LineToCircle:i(80462),LineToLine:i(76112),LineToRectangle:i(92773),PointToLine:i(16204),PointToLineSegment:i(14199),RectangleToRectangle:i(59996),RectangleToTriangle:i(89265),RectangleToValues:i(84411),TriangleToCircle:i(67636),TriangleToLine:i(2822),TriangleToTriangle:i(82944)}},91938:t=>{t.exports=function(t){return Math.atan2(t.y2-t.y1,t.x2-t.x1)}},84993:t=>{t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=[]);var s=Math.round(t.x1),n=Math.round(t.y1),r=Math.round(t.x2),o=Math.round(t.y2),a=Math.abs(r-s),h=Math.abs(o-n),l=s-h&&(c-=h,s+=l),f{t.exports=function(t,e,i){var s=e-(t.x1+t.x2)/2,n=i-(t.y1+t.y2)/2;return t.x1+=s,t.y1+=n,t.x2+=s,t.y2+=n,t}},31116:(t,e,i)=>{var s=i(23031);t.exports=function(t){return new s(t.x1,t.y1,t.x2,t.y2)}},59944:t=>{t.exports=function(t,e){return e.setTo(t.x1,t.y1,t.x2,t.y2)}},59220:t=>{t.exports=function(t,e){return t.x1===e.x1&&t.y1===e.y1&&t.x2===e.x2&&t.y2===e.y2}},78177:(t,e,i)=>{var s=i(35001);t.exports=function(t,e,i){void 0===i&&(i=e);var n=s(t),r=t.x2-t.x1,o=t.y2-t.y1;return e&&(t.x1=t.x1-r/n*e,t.y1=t.y1-o/n*e),i&&(t.x2=t.x2+r/n*i,t.y2=t.y2+o/n*i),t}},26708:(t,e,i)=>{var s=i(52816),n=i(6113),r=i(2141);t.exports=function(t,e,i,o,a){void 0===o&&(o=0),void 0===a&&(a=[]);var h,l,u=[],c=t.x1,d=t.y1,f=t.x2-c,p=t.y2-d,v=n(e,a),g=i-1;for(h=0;h0){var m=u[0],y=[m];for(h=1;h=o&&(y.push(x),m=x)}var T=u[u.length-1];return s(m,T){var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=(t.x1+t.x2)/2,e.y=(t.y1+t.y2)/2,e}},99569:(t,e,i)=>{var s=i(2141);t.exports=function(t,e,i){void 0===i&&(i=new s);var n=t.x1,r=t.y1,o=t.x2,a=t.y2,h=(o-n)*(o-n)+(a-r)*(a-r);if(0===h)return i;var l=((e.x-n)*(o-n)+(e.y-r)*(a-r))/h;return i.x=n+l*(o-n),i.y=r+l*(a-r),i}},34638:(t,e,i)=>{var s=i(36383),n=i(91938),r=i(2141);t.exports=function(t,e){void 0===e&&(e=new r);var i=n(t)-s.TAU;return e.x=Math.cos(i),e.y=Math.sin(i),e}},13151:(t,e,i)=>{var s=i(2141);t.exports=function(t,e,i){return void 0===i&&(i=new s),i.x=t.x1+(t.x2-t.x1)*e,i.y=t.y1+(t.y2-t.y1)*e,i}},15258:(t,e,i)=>{var s=i(35001),n=i(2141);t.exports=function(t,e,i,r){void 0===r&&(r=[]),!e&&i>0&&(e=s(t)/i);for(var o=t.x1,a=t.y1,h=t.x2,l=t.y2,u=0;u{t.exports=function(t,e){var i=t.x1,s=t.y1,n=t.x2,r=t.y2,o=(n-i)*(n-i)+(r-s)*(r-s);if(0===o)return!1;var a=((s-e.y)*(n-i)-(i-e.x)*(r-s))/o;return Math.abs(a)*Math.sqrt(o)}},98770:t=>{t.exports=function(t){return Math.abs(t.y1-t.y2)}},35001:t=>{t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},23031:(t,e,i)=>{var s=i(83419),n=i(13151),r=i(15258),o=i(23777),a=i(65822),h=i(26099),l=new s({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.type=o.LINE,this.x1=t,this.y1=e,this.x2=i,this.y2=s},getPoint:function(t,e){return n(this,t,e)},getPoints:function(t,e,i){return r(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.x1=t,this.y1=e,this.x2=i,this.y2=s,this},setFromObjects:function(t,e){return this.x1=t.x,this.y1=t.y,this.x2=e.x,this.y2=e.y,this},getPointA:function(t){return void 0===t&&(t=new h),t.set(this.x1,this.y1),t},getPointB:function(t){return void 0===t&&(t=new h),t.set(this.x2,this.y2),t},left:{get:function(){return Math.min(this.x1,this.x2)},set:function(t){this.x1<=this.x2?this.x1=t:this.x2=t}},right:{get:function(){return Math.max(this.x1,this.x2)},set:function(t){this.x1>this.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=l},64795:(t,e,i)=>{var s=i(36383),n=i(15994),r=i(91938);t.exports=function(t){var e=r(t)-s.TAU;return n(e,-Math.PI,Math.PI)}},52616:(t,e,i)=>{var s=i(36383),n=i(91938);t.exports=function(t){return Math.cos(n(t)-s.TAU)}},87231:(t,e,i)=>{var s=i(36383),n=i(91938);t.exports=function(t){return Math.sin(n(t)-s.TAU)}},89662:t=>{t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t}},71165:t=>{t.exports=function(t){return-(t.x2-t.x1)/(t.y2-t.y1)}},65822:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){void 0===e&&(e=new s);var i=Math.random();return e.x=t.x1+i*(t.x2-t.x1),e.y=t.y1+i*(t.y2-t.y1),e}},69777:(t,e,i)=>{var s=i(91938),n=i(64795);t.exports=function(t,e){return 2*n(e)-Math.PI-s(t)}},39706:(t,e,i)=>{var s=i(64400);t.exports=function(t,e){var i=(t.x1+t.x2)/2,n=(t.y1+t.y2)/2;return s(t,i,n,e)}},82585:(t,e,i)=>{var s=i(64400);t.exports=function(t,e,i){return s(t,e.x,e.y,i)}},64400:t=>{t.exports=function(t,e,i,s){var n=Math.cos(s),r=Math.sin(s),o=t.x1-e,a=t.y1-i;return t.x1=o*n-a*r+e,t.y1=o*r+a*n+i,o=t.x2-e,a=t.y2-i,t.x2=o*n-a*r+e,t.y2=o*r+a*n+i,t}},62377:t=>{t.exports=function(t,e,i,s,n){return t.x1=e,t.y1=i,t.x2=e+Math.cos(s)*n,t.y2=i+Math.sin(s)*n,t}},71366:t=>{t.exports=function(t){return(t.y2-t.y1)/(t.x2-t.x1)}},10809:t=>{t.exports=function(t){return Math.abs(t.x1-t.x2)}},2529:(t,e,i)=>{var s=i(23031);s.Angle=i(91938),s.BresenhamPoints=i(84993),s.CenterOn=i(36469),s.Clone=i(31116),s.CopyFrom=i(59944),s.Equals=i(59220),s.Extend=i(78177),s.GetEasedPoints=i(26708),s.GetMidPoint=i(32125),s.GetNearestPoint=i(99569),s.GetNormal=i(34638),s.GetPoint=i(13151),s.GetPoints=i(15258),s.GetShortestDistance=i(26408),s.Height=i(98770),s.Length=i(35001),s.NormalAngle=i(64795),s.NormalX=i(52616),s.NormalY=i(87231),s.Offset=i(89662),s.PerpSlope=i(71165),s.Random=i(65822),s.ReflectAngle=i(69777),s.Rotate=i(39706),s.RotateAroundPoint=i(82585),s.RotateAroundXY=i(64400),s.SetToAngle=i(62377),s.Slope=i(71366),s.Width=i(10809),t.exports=s},83997:(t,e,i)=>{var s=i(83419),n=i(87841),r=i(26099);function o(t,e,i,s){var n=t-i,r=e-s,o=n*n+r*r;return Math.sqrt(o)}var a=new s({initialize:function(t,e,i){this.vertex1=t,this.vertex2=e,this.vertex3=i,this.bounds=new n,this._inCenter=new r},getInCenter:function(t){void 0===t&&(t=!0);var e,i,s,n,r,a,h=this.vertex1,l=this.vertex2,u=this.vertex3;t?(e=h.x,i=h.y,s=l.x,n=l.y,r=u.x,a=u.y):(e=h.vx,i=h.vy,s=l.vx,n=l.vy,r=u.vx,a=u.vy);var c=o(r,a,s,n),d=o(e,i,r,a),f=o(s,n,e,i),p=c+d+f;return this._inCenter.set((e*c+s*d+r*f)/p,(i*c+n*d+a*f)/p)},contains:function(t,e,i){var s=this.vertex1,n=this.vertex2,r=this.vertex3,o=s.vx,a=s.vy,h=n.vx,l=n.vy,u=r.vx,c=r.vy;if(i){var d=i.a,f=i.b,p=i.c,v=i.d,g=i.e,m=i.f;o=s.vx*d+s.vy*p+g,a=s.vx*f+s.vy*v+m,h=n.vx*d+n.vy*p+g,l=n.vx*f+n.vy*v+m,u=r.vx*d+r.vy*p+g,c=r.vx*f+r.vy*v+m}var y=u-o,x=c-a,T=h-o,w=l-a,b=t-o,S=e-a,E=y*y+x*x,A=y*T+x*w,C=y*b+x*S,_=T*T+w*w,M=T*b+w*S,P=E*_-A*A,R=0===P?0:1/P,L=(_*C-A*M)*R,O=(E*M-A*C)*R;return L>=0&&O>=0&&L+O<1},isCounterClockwise:function(t){var e=this.vertex1,i=this.vertex2,s=this.vertex3,n=(i.vx-e.vx)*(s.vy-e.vy)-(i.vy-e.vy)*(s.vx-e.vx);return t<=0?n>=0:n<0},load:function(t,e,i,s,n){return i=this.vertex1.load(t,e,i,s,n),i=this.vertex2.load(t,e,i,s,n),this.vertex3.load(t,e,i,s,n)},transformCoordinatesLocal:function(t,e,i,s){return this.vertex1.transformCoordinatesLocal(t,e,i,s),this.vertex2.transformCoordinatesLocal(t,e,i,s),this.vertex3.transformCoordinatesLocal(t,e,i,s),this},updateBounds:function(){var t=this.vertex1,e=this.vertex2,i=this.vertex3,s=this.bounds;return s.x=Math.min(t.vx,e.vx,i.vx),s.y=Math.min(t.vy,e.vy,i.vy),s.width=Math.max(t.vx,e.vx,i.vx)-s.x,s.height=Math.max(t.vy,e.vy,i.vy)-s.y,this},isInView:function(t,e,i,s,n,r,o,a,h,l,u){this.update(s,n,r,o,a,h,l,u);var c=this.vertex1,d=this.vertex2,f=this.vertex3;if(c.ta<=0&&d.ta<=0&&f.ta<=0)return!1;if(e&&!this.isCounterClockwise(i))return!1;var p=this.bounds;p.x=Math.min(c.tx,d.tx,f.tx),p.y=Math.min(c.ty,d.ty,f.ty),p.width=Math.max(c.tx,d.tx,f.tx)-p.x,p.height=Math.max(c.ty,d.ty,f.ty)-p.y;var v=t.x+t.width,g=t.y+t.height;return!(p.width<=0||p.height<=0||t.width<=0||t.height<=0||p.rightv||p.y>g)},scrollUV:function(t,e){return this.vertex1.scrollUV(t,e),this.vertex2.scrollUV(t,e),this.vertex3.scrollUV(t,e),this},scaleUV:function(t,e){return this.vertex1.scaleUV(t,e),this.vertex2.scaleUV(t,e),this.vertex3.scaleUV(t,e),this},setColor:function(t){return this.vertex1.color=t,this.vertex2.color=t,this.vertex3.color=t,this},update:function(t,e,i,s,n,r,o,a){return this.vertex1.update(e,i,s,n,r,o,a,t),this.vertex2.update(e,i,s,n,r,o,a,t),this.vertex3.update(e,i,s,n,r,o,a,t),this},translate:function(t,e){void 0===e&&(e=0);var i=this.vertex1,s=this.vertex2,n=this.vertex3;return i.x+=t,i.y+=e,s.x+=t,s.y+=e,n.x+=t,n.y+=e,this},x:{get:function(){return this.getInCenter().x},set:function(t){var e=this.getInCenter();this.translate(t-e.x,0)}},y:{get:function(){return this.getInCenter().y},set:function(t){var e=this.getInCenter();this.translate(0,t-e.y)}},alpha:{get:function(){var t=this.vertex1,e=this.vertex2,i=this.vertex3;return(t.alpha+e.alpha+i.alpha)/3},set:function(t){this.vertex1.alpha=t,this.vertex2.alpha=t,this.vertex3.alpha=t}},depth:{get:function(){var t=this.vertex1,e=this.vertex2,i=this.vertex3;return(t.vz+e.vz+i.vz)/3}},destroy:function(){this.vertex1=null,this.vertex2=null,this.vertex3=null}});t.exports=a},48803:(t,e,i)=>{var s=i(83997),n=i(95540),r=i(37867),o=i(25836),a=i(39318),h=new o,l=new o,u=new r;t.exports=function(t){var e,i=n(t,"mesh"),r=n(t,"texture",null),o=n(t,"frame"),c=n(t,"width",1),d=n(t,"height",c),f=n(t,"widthSegments",1),p=n(t,"heightSegments",f),v=n(t,"x",0),g=n(t,"y",0),m=n(t,"z",0),y=n(t,"rotateX",0),x=n(t,"rotateY",0),T=n(t,"rotateZ",0),w=n(t,"zIsUp",!0),b=n(t,"isOrtho",!!i&&i.dirtyCache[11]),S=n(t,"colors",[16777215]),E=n(t,"alphas",[1]),A=n(t,"tile",!1),C=n(t,"flipY",!1),_=n(t,"width",null),M={faces:[],verts:[]};if(h.set(v,g,m),l.set(y,x,T),u.fromRotationXYTranslation(l,h,w),!r&&i)r=i.texture,o||(e=i.frame);else if(i&&"string"==typeof r)r=i.scene.sys.textures.get(r);else if(!r)return M;e||(e=r.get(o)),!_&&b&&r&&i&&(c=e.width/i.height,d=e.height/i.height);var P,R,L=c/2,O=d/2,F=Math.floor(f),D=Math.floor(p),k=F+1,I=D+1,B=c/F,N=d/D,U=[],X=[],Y=0,z=1,G=0,V=1;e&&(Y=e.u0,z=e.u1,C?(G=e.v1,V=e.v0):(G=e.v0,V=e.v1));var W=z-Y,H=V-G;for(R=0;R{var s=i(83997),n=i(37867),r=i(25836),o=i(39318),a=new r,h=new r,l=new n;t.exports=function(t,e,i,n,r,u,c,d,f,p){void 0===i&&(i=1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=!0);var v={faces:[],verts:[]},g=t.materials;a.set(n,r,u),h.set(c,d,f),l.fromRotationXYTranslation(h,a,p);for(var m=0;m{var s=i(83997),n=i(39318);t.exports=function(t,e,i,r,o,a,h,l){if(void 0===r&&(r=!1),void 0===a&&(a=16777215),void 0===h&&(h=1),void 0===l&&(l=!1),t.length===e.length||r){var u,c,d,f,p,v,g,m,y,x,T,w={faces:[],vertices:[]},b=r?3:2,S=Array.isArray(a),E=Array.isArray(h);if(Array.isArray(i)&&i.length>0)for(u=0;u{var e=!0,i="untitled",s="",n="";function r(t){return 0===t.models.length&&t.models.push({faces:[],name:i,textureCoords:[],vertexNormals:[],vertices:[]}),s="",t.models[t.models.length-1]}function o(t,e){var n=t.length>=2?t[1]:i;e.models.push({faces:[],name:n,textureCoords:[],vertexNormals:[],vertices:[]}),s=""}function a(t){2===t.length&&(s=t[1])}function h(t,e){var i=t.length,s=i>=2?parseFloat(t[1]):0,n=i>=3?parseFloat(t[2]):0,o=i>=4?parseFloat(t[3]):0;r(e).vertices.push({x:s,y:n,z:o})}function l(t,i){var s=t.length,n=s>=2?parseFloat(t[1]):0,o=s>=3?parseFloat(t[2]):0,a=s>=4?parseFloat(t[3]):0;isNaN(n)&&(n=0),isNaN(o)&&(o=0),isNaN(a)&&(a=0),e&&(o=1-o),r(i).textureCoords.push({u:n,v:o,w:a})}function u(t,e){var i=t.length,s=i>=2?parseFloat(t[1]):0,n=i>=3?parseFloat(t[2]):0,o=i>=4?parseFloat(t[3]):0;r(e).vertexNormals.push({x:s,y:n,z:o})}function c(t,e){var i=t.length-1;if(!(i<3)){for(var o={group:s,material:n,vertices:[]},a=0;a3)){var u=0,c=0,d=0;u=parseInt(h[0],10),l>1&&""!==h[1]&&(c=parseInt(h[1],10)),l>2&&(d=parseInt(h[2],10)),0!==u&&(u<0&&(u=r(e).vertices.length+1+u),c-=1,u-=1,d-=1,o.vertices.push({textureCoordsIndex:c,vertexIndex:u,vertexNormalIndex:d}))}}r(e).faces.push(o)}}function d(t,e){t.length>=2&&e.materialLibraries.push(t[1])}function f(t){t.length>=2&&(n=t[1])}t.exports=function(t,i){void 0===i&&(i=!0),e=i;var r,p,v={materials:{},materialLibraries:[],models:[]};s="",n="";for(var g=t.split("\n"),m=0;m-1?r.substring(0,p):r).replace(/\s\s+/g," ").trim().split(" ");switch(y[0].toLowerCase()){case"o":o(y,v);break;case"g":a(y);break;case"v":h(y,v);break;case"vt":l(y,v);break;case"vn":u(y,v);break;case"f":c(y,v);break;case"mtllib":d(y,v);break;case"usemtl":f(y)}}return v}},61485:(t,e,i)=>{var s=i(37589);t.exports=function(t){for(var e={},i=t.split("\n"),n="",r=0;r=2?Math.floor(255*a[2]):h,u=a.length>=3?Math.floor(255*a[3]):h;e[n]=s(h,l,u)}}}return e}},92570:t=>{t.exports=function(t,e,i,s){var n,r;if(void 0===i&&void 0===s){var o=t.getInCenter();n=o.x,r=o.y}var a=Math.cos(e),h=Math.sin(e),l=t.vertex1,u=t.vertex2,c=t.vertex3,d=l.x-n,f=l.y-r;l.set(d*a-f*h+n,d*h+f*a+r),d=u.x-n,f=u.y-r,u.set(d*a-f*h+n,d*h+f*a+r),d=c.x-n,f=c.y-r,c.set(d*a-f*h+n,d*h+f*a+r)}},39318:(t,e,i)=>{var s=i(83419),n=i(70554),r=i(25836),o=new s({Extends:r,initialize:function(t,e,i,s,n,o,a,h,l,u){void 0===o&&(o=16777215),void 0===a&&(a=1),void 0===h&&(h=0),void 0===l&&(l=0),void 0===u&&(u=0),r.call(this,t,e,i),this.vx=0,this.vy=0,this.vz=0,this.nx=h,this.ny=l,this.nz=u,this.u=s,this.v=n,this.color=o,this.alpha=a,this.tx=0,this.ty=0,this.ta=0,this.tu=s,this.tv=n},setUVs:function(t,e){return this.u=t,this.v=e,this.tu=t,this.tv=e,this},scrollUV:function(t,e){return this.tu+=t,this.tv+=e,this},scaleUV:function(t,e){return this.tu=this.u*t,this.tv=this.v*e,this},transformCoordinatesLocal:function(t,e,i,s){var n=this.x,r=this.y,o=this.z,a=t.val,h=n*a[0]+r*a[4]+o*a[8]+a[12],l=n*a[1]+r*a[5]+o*a[9]+a[13],u=n*a[2]+r*a[6]+o*a[10]+a[14],c=n*a[3]+r*a[7]+o*a[11]+a[15];this.vx=h/c*e,this.vy=-l/c*i,this.vz=s<=0?u/c:-u/c},resize:function(t,e,i,s,n,r){return this.x=t,this.y=e,this.vx=this.x*i,this.vy=-this.y*s,this.vz=0,n<.5?this.vx+=i*(.5-n):n>.5&&(this.vx-=i*(n-.5)),r<.5?this.vy+=s*(.5-r):r>.5&&(this.vy-=s*(r-.5)),this},update:function(t,e,i,s,n,r,o,a){var h=this.vx*t+this.vy*i+n,l=this.vx*e+this.vy*s+r;return o&&(h=Math.round(h),l=Math.round(l)),this.tx=h,this.ty=l,this.ta=this.alpha*a,this},load:function(t,e,i,s,r){return t[++i]=this.tx,t[++i]=this.ty,t[++i]=this.tu,t[++i]=this.tv,t[++i]=s,t[++i]=r,e[++i]=n.getTintAppendFloatAlpha(this.color,this.ta),i}});t.exports=o},73090:(t,e,i)=>{var s={Face:i(83997),GenerateGridVerts:i(48803),GenerateObjVerts:i(34684),GenerateVerts:i(92515),ParseObj:i(85048),ParseObjMaterial:i(61485),RotateFace:i(92570),Vertex:i(39318)};t.exports=s},96550:t=>{t.exports=function(t){return t.setTo(Math.ceil(t.x),Math.ceil(t.y))}},99706:(t,e,i)=>{var s=i(2141);t.exports=function(t){return new s(t.x,t.y)}},68010:t=>{t.exports=function(t,e){return e.setTo(t.x,t.y)}},27814:t=>{t.exports=function(t,e){return t.x===e.x&&t.y===e.y}},73565:t=>{t.exports=function(t){return t.setTo(Math.floor(t.x),Math.floor(t.y))}},87555:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){if(void 0===e&&(e=new s),!Array.isArray(t))throw new Error("GetCentroid points argument must be an array");var i=t.length;if(i<1)throw new Error("GetCentroid points array must not be empty");if(1===i)e.x=t[0].x,e.y=t[0].y;else{for(var n=0;n{t.exports=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)}},44405:t=>{t.exports=function(t){return t.x*t.x+t.y*t.y}},20873:(t,e,i)=>{var s=i(87841);t.exports=function(t,e){void 0===e&&(e=new s);for(var i=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=0;ai&&(i=h.x),h.xr&&(r=h.y),h.y{var s=i(2141);t.exports=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=new s),n.x=t.x+(e.x-t.x)*i,n.y=t.y+(e.y-t.y)*i,n}},55767:t=>{t.exports=function(t){return t.setTo(t.y,t.x)}},79432:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.setTo(-t.x,-t.y)}},2141:(t,e,i)=>{var s=i(83419),n=i(23777),r=new s({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.type=n.POINT,this.x=t,this.y=e},setTo:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this}});t.exports=r},72930:(t,e,i)=>{var s=i(2141),n=i(44405);t.exports=function(t,e,i){void 0===i&&(i=new s);var r=(t.x*e.x+t.y*e.y)/n(e);return 0!==r&&(i.x=r*e.x,i.y=r*e.y),i}},62880:(t,e,i)=>{var s=i(2141);t.exports=function(t,e,i){void 0===i&&(i=new s);var n=t.x*e.x+t.y*e.y;return 0!==n&&(i.x=n*e.x,i.y=n*e.y),i}},15093:(t,e,i)=>{var s=i(28793);t.exports=function(t,e){if(0!==t.x||0!==t.y){var i=s(t);t.x/=i,t.y/=i}return t.x*=e,t.y*=e,t}},43711:(t,e,i)=>{var s=i(2141);s.Ceil=i(96550),s.Clone=i(99706),s.CopyFrom=i(68010),s.Equals=i(27814),s.Floor=i(73565),s.GetCentroid=i(87555),s.GetMagnitude=i(28793),s.GetMagnitudeSq=i(44405),s.GetRectangleFromPoints=i(20873),s.Interpolate=i(26152),s.Invert=i(55767),s.Negative=i(79432),s.Project=i(72930),s.ProjectUnit=i(62880),s.SetMagnitude=i(15093),t.exports=s},12306:(t,e,i)=>{var s=i(25717);t.exports=function(t){return new s(t.points)}},63814:t=>{t.exports=function(t,e,i){for(var s=!1,n=-1,r=t.points.length-1;++n{var s=i(63814);t.exports=function(t,e){return s(t,e.x,e.y)}},94811:t=>{function e(t,e,s){s=s||2;var r,o,a,h,c,d,p,v=e&&e.length,g=v?e[0]*s:t.length,m=i(t,0,g,s,!0),y=[];if(!m||m.next===m.prev)return y;if(v&&(m=function(t,e,s,n){var r,o,a,h=[];for(r=0,o=e.length;r80*s){r=a=t[0],o=h=t[1];for(var x=s;xa&&(a=c),d>h&&(h=d);p=0!==(p=Math.max(a-r,h-o))?32767/p:0}return n(m,y,s,r,o,p,0),y}function i(t,e,i,s,n){var r,o;if(n===C(t,e,i,s)>0)for(r=e;r=e;r-=s)o=S(r,t[r],t[r+1],o);return o&&m(o,o.next)&&(E(o),o=o.next),o}function s(t,e){if(!t)return t;e||(e=t);var i,s=t;do{if(i=!1,s.steiner||!m(s,s.next)&&0!==g(s.prev,s,s.next))s=s.next;else{if(E(s),(s=e=s.prev)===s.next)break;i=!0}}while(i||s!==e);return e}function n(t,e,i,l,u,c,f){if(t){!f&&c&&function(t,e,i,s){var n=t;do{0===n.z&&(n.z=d(n.x,n.y,e,i,s)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,s,n,r,o,a,h,l=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,s=i,a=0,e=0;e0||h>0&&s;)0!==a&&(0===h||!s||i.z<=s.z)?(n=i,i=i.nextZ,a--):(n=s,s=s.nextZ,h--),r?r.nextZ=n:t=n,n.prevZ=r,r=n;i=s}r.nextZ=null,l*=2}while(o>1)}(n)}(t,l,u,c);for(var p,v,g=t;t.prev!==t.next;)if(p=t.prev,v=t.next,c?o(t,l,u,c):r(t))e.push(p.i/i|0),e.push(t.i/i|0),e.push(v.i/i|0),E(t),t=v.next,g=v.next;else if((t=v)===g){f?1===f?n(t=a(s(t),e,i),e,i,l,u,c,2):2===f&&h(t,e,i,l,u,c):n(s(t),e,i,l,u,c,1);break}}}function r(t){var e=t.prev,i=t,s=t.next;if(g(e,i,s)>=0)return!1;for(var n=e.x,r=i.x,o=s.x,a=e.y,h=i.y,l=s.y,u=nr?n>o?n:o:r>o?r:o,f=a>h?a>l?a:l:h>l?h:l,v=s.next;v!==e;){if(v.x>=u&&v.x<=d&&v.y>=c&&v.y<=f&&p(n,a,r,h,o,l,v.x,v.y)&&g(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function o(t,e,i,s){var n=t.prev,r=t,o=t.next;if(g(n,r,o)>=0)return!1;for(var a=n.x,h=r.x,l=o.x,u=n.y,c=r.y,f=o.y,v=ah?a>l?a:l:h>l?h:l,x=u>c?u>f?u:f:c>f?c:f,T=d(v,m,e,i,s),w=d(y,x,e,i,s),b=t.prevZ,S=t.nextZ;b&&b.z>=T&&S&&S.z<=w;){if(b.x>=v&&b.x<=y&&b.y>=m&&b.y<=x&&b!==n&&b!==o&&p(a,u,h,c,l,f,b.x,b.y)&&g(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,S.x>=v&&S.x<=y&&S.y>=m&&S.y<=x&&S!==n&&S!==o&&p(a,u,h,c,l,f,S.x,S.y)&&g(S.prev,S,S.next)>=0)return!1;S=S.nextZ}for(;b&&b.z>=T;){if(b.x>=v&&b.x<=y&&b.y>=m&&b.y<=x&&b!==n&&b!==o&&p(a,u,h,c,l,f,b.x,b.y)&&g(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;S&&S.z<=w;){if(S.x>=v&&S.x<=y&&S.y>=m&&S.y<=x&&S!==n&&S!==o&&p(a,u,h,c,l,f,S.x,S.y)&&g(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function a(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!m(r,o)&&y(r,n,n.next,o)&&w(r,o)&&w(o,r)&&(e.push(r.i/i|0),e.push(n.i/i|0),e.push(o.i/i|0),E(n),E(n.next),n=t=o),n=n.next}while(n!==t);return s(n)}function h(t,e,i,r,o,a){var h=t;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&v(h,l)){var u=b(h,l);return h=s(h,h.next),u=s(u,u.next),n(h,e,i,r,o,a,0),void n(u,e,i,r,o,a,0)}l=l.next}h=h.next}while(h!==t)}function l(t,e){return t.x-e.x}function u(t,e){var i=function(t,e){var i,s=e,n=t.x,r=t.y,o=-1/0;do{if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){var a=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=n&&a>o&&(o=a,i=s.x=s.x&&s.x>=u&&n!==s.x&&p(ri.x||s.x===i.x&&c(i,s)))&&(i=s,f=h)),s=s.next}while(s!==l);return i}(t,e);if(!i)return e;var n=b(i,t);return s(n,n.next),s(i,i.next)}function c(t,e){return g(t.prev,t,e.prev)<0&&g(e.next,t,t.next)<0}function d(t,e,i,s,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function f(t){var e=t,i=t;do{(e.x=(t-o)*(r-a)&&(t-o)*(s-a)>=(i-o)*(e-a)&&(i-o)*(r-a)>=(n-o)*(s-a)}function v(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&y(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(w(t,e)&&w(e,t)&&function(t,e){var i=t,s=!1,n=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&n<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==t);return s}(t,e)&&(g(t.prev,t,e.prev)||g(t,e.prev,e))||m(t,e)&&g(t.prev,t,t.next)>0&&g(e.prev,e,e.next)>0)}function g(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function m(t,e){return t.x===e.x&&t.y===e.y}function y(t,e,i,s){var n=T(g(t,e,i)),r=T(g(t,e,s)),o=T(g(i,s,t)),a=T(g(i,s,e));return n!==r&&o!==a||!(0!==n||!x(t,i,e))||!(0!==r||!x(t,s,e))||!(0!==o||!x(i,t,s))||!(0!==a||!x(i,e,s))}function x(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function T(t){return t>0?1:t<0?-1:0}function w(t,e){return g(t.prev,t,t.next)<0?g(t,e,t.next)>=0&&g(t,t.prev,e)>=0:g(t,e,t.prev)<0||g(t,t.next,e)<0}function b(t,e){var i=new A(t.i,t.x,t.y),s=new A(e.i,e.x,e.y),n=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,s.next=i,i.prev=s,r.next=s,s.prev=r,s}function S(t,e,i,s){var n=new A(t,e,i);return s?(n.next=s.next,n.prev=s,s.next.prev=n,s.next=n):(n.prev=n,n.next=n),n}function E(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function A(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function C(t,e,i,s){for(var n=0,r=e,o=i-s;r0&&(s+=t[n-1].length,i.holes.push(s))}return i},t.exports=e},13829:(t,e,i)=>{var s=i(87841);t.exports=function(t,e){void 0===e&&(e=new s);for(var i,n=1/0,r=1/0,o=-n,a=-r,h=0;h{t.exports=function(t,e){void 0===e&&(e=[]);for(var i=0;i{var s=i(35001),n=i(23031),r=i(30052);t.exports=function(t,e,i,o){void 0===o&&(o=[]);var a=t.points,h=r(t);!e&&i>0&&(e=h/i);for(var l=0;lc+g)){var m=v.getPoint((u-c)/g);o.push(m);break}c+=g}return o}},30052:(t,e,i)=>{var s=i(35001),n=i(23031);t.exports=function(t){for(var e=t.points,i=0,r=0;r{var s=i(83419),n=i(63814),r=i(9564),o=i(23777),a=new s({initialize:function(t){this.type=o.POLYGON,this.area=0,this.points=[],t&&this.setTo(t)},contains:function(t,e){return n(this,t,e)},setTo:function(t){if(this.area=0,this.points=[],"string"==typeof t&&(t=t.split(" ")),!Array.isArray(t))return this;for(var e,i=0;i{t.exports=function(t){return t.points.reverse(),t}},29524:t=>{function e(t,e,i){var s=e.x,n=e.y,r=i.x-s,o=i.y-n;if(0!==r||0!==o){var a=((t.x-s)*r+(t.y-n)*o)/(r*r+o*o);a>1?(s=i.x,n=i.y):a>0&&(s+=r*a,n+=o*a)}return(r=t.x-s)*r+(o=t.y-n)*o}function i(t,s,n,r,o){for(var a,h=r,l=s+1;lh&&(a=l,h=u)}h>r&&(a-s>1&&i(t,s,a,r,o),o.push(t[a]),n-a>1&&i(t,a,n,r,o))}function s(t,e){var s=t.length-1,n=[t[0]];return i(t,0,s,e,n),n.push(t[s]),n}t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=!1);var n=t.points;if(n.length>2){var r=e*e;i||(n=function(t,e){for(var i,s,n,r,o,a=t[0],h=[a],l=1,u=t.length;le&&(h.push(i),a=i);return a!==i&&h.push(i),h}(n,r)),t.setTo(s(n,r))}return t}},5469:t=>{var e=function(t,e){return t[0]=e[0],t[1]=e[1],t};t.exports=function(t){var i,s=[],n=t.points;for(i=0;i0&&r.push(e([0,0],s[0])),i=0;i1&&r.push(e([0,0],s[s.length-1])),t.setTo(r)}},24709:t=>{t.exports=function(t,e,i){for(var s=t.points,n=0;n{var s=i(25717);s.Clone=i(12306),s.Contains=i(63814),s.ContainsPoint=i(99338),s.Earcut=i(94811),s.GetAABB=i(13829),s.GetNumberArray=i(26173),s.GetPoints=i(9564),s.Perimeter=i(30052),s.Reverse=i(8133),s.Simplify=i(29524),s.Smooth=i(5469),s.Translate=i(24709),t.exports=s},62224:t=>{t.exports=function(t){return t.width*t.height}},98615:t=>{t.exports=function(t){return t.x=Math.ceil(t.x),t.y=Math.ceil(t.y),t}},31688:t=>{t.exports=function(t){return t.x=Math.ceil(t.x),t.y=Math.ceil(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),t}},67502:t=>{t.exports=function(t,e,i){return t.x=e-t.width/2,t.y=i-t.height/2,t}},65085:(t,e,i)=>{var s=i(87841);t.exports=function(t){return new s(t.x,t.y,t.width,t.height)}},37303:t=>{t.exports=function(t,e,i){return!(t.width<=0||t.height<=0)&&t.x<=e&&t.x+t.width>=e&&t.y<=i&&t.y+t.height>=i}},96553:(t,e,i)=>{var s=i(37303);t.exports=function(t,e){return s(t,e.x,e.y)}},70273:t=>{t.exports=function(t,e){return!(e.width*e.height>t.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom{t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},77493:t=>{t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x,y:t.y}),e.push({x:t.right,y:t.y}),e.push({x:t.right,y:t.bottom}),e.push({x:t.x,y:t.bottom}),e}},9219:t=>{t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},53751:(t,e,i)=>{var s=i(8249);t.exports=function(t,e){var i=s(t);return i{var s=i(8249);t.exports=function(t,e){var i=s(t);return i>s(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},80774:t=>{t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},83859:t=>{t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},19217:(t,e,i)=>{var s=i(87841),n=i(36383);t.exports=function(t,e){if(void 0===e&&(e=new s),0===t.length)return e;for(var i,r,o,a=Number.MAX_VALUE,h=Number.MAX_VALUE,l=n.MIN_SAFE_INTEGER,u=n.MIN_SAFE_INTEGER,c=0;c{var s=i(87841);t.exports=function(t,e,i,n,r){return void 0===r&&(r=new s),r.setTo(Math.min(t,i),Math.min(e,n),Math.abs(t-i),Math.abs(e-n))}},8249:t=>{t.exports=function(t){return 0===t.height?NaN:t.width/t.height}},27165:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=t.centerX,e.y=t.centerY,e}},20812:(t,e,i)=>{var s=i(13019),n=i(2141);t.exports=function(t,e,i){if(void 0===i&&(i=new n),e<=0||e>=1)return i.x=t.x,i.y=t.y,i;var r=s(t)*e;return e>.5?(r-=t.width+t.height)<=t.width?(i.x=t.right-r,i.y=t.bottom):(i.x=t.x,i.y=t.bottom-(r-t.width)):r<=t.width?(i.x=t.x+r,i.y=t.y):(i.x=t.right,i.y=t.y+(r-t.width)),i}},34819:(t,e,i)=>{var s=i(20812),n=i(13019);t.exports=function(t,e,i,r){void 0===r&&(r=[]),!e&&i>0&&(e=n(t)/i);for(var o=0;o{var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=t.width,e.y=t.height,e}},86091:(t,e,i)=>{var s=i(67502);t.exports=function(t,e,i){var n=t.centerX,r=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),s(t,n,r)}},53951:(t,e,i)=>{var s=i(87841),n=i(59996);t.exports=function(t,e,i){return void 0===i&&(i=new s),n(t,e)?(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y):i.setEmpty(),i}},14649:(t,e,i)=>{var s=i(13019),n=i(2141);t.exports=function(t,e,i,r){if(void 0===r&&(r=[]),!e&&!i)return r;e?i=Math.round(s(t)/e):e=s(t)/i;for(var o=t.x,a=t.y,h=0,l=0;l=t.right&&(h=1,a+=o-t.right,o=t.right);break;case 1:(a+=e)>=t.bottom&&(h=2,o-=a-t.bottom,a=t.bottom);break;case 2:(o-=e)<=t.left&&(h=3,a-=t.left-o,o=t.left);break;case 3:(a-=e)<=t.top&&(h=0,a=t.top)}return r}},33595:t=>{t.exports=function(t,e){for(var i=t.x,s=t.right,n=t.y,r=t.bottom,o=0;o{t.exports=function(t,e){var i=Math.min(t.x,e.x),s=Math.max(t.right,e.right);t.x=i,t.width=s-i;var n=Math.min(t.y,e.y),r=Math.max(t.bottom,e.bottom);return t.y=n,t.height=r-n,t}},92171:t=>{t.exports=function(t,e,i){var s=Math.min(t.x,e),n=Math.max(t.right,e);t.x=s,t.width=n-s;var r=Math.min(t.y,i),o=Math.max(t.bottom,i);return t.y=r,t.height=o-r,t}},42981:t=>{t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},46907:t=>{t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},60170:t=>{t.exports=function(t,e){return t.xe.x&&t.ye.y}},13019:t=>{t.exports=function(t){return 2*(t.width+t.height)}},85133:(t,e,i)=>{var s=i(2141),n=i(39506);t.exports=function(t,e,i){void 0===i&&(i=new s),e=n(e);var r=Math.sin(e),o=Math.cos(e),a=o>0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r){var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=t.x+Math.random()*t.width,e.y=t.y+Math.random()*t.height,e}},86470:(t,e,i)=>{var s=i(30976),n=i(70273),r=i(2141);t.exports=function(t,e,i){if(void 0===i&&(i=new r),n(t,e))switch(s(0,3)){case 0:i.x=t.x+Math.random()*(e.right-t.x),i.y=t.y+Math.random()*(e.top-t.y);break;case 1:i.x=e.x+Math.random()*(t.right-e.x),i.y=e.bottom+Math.random()*(t.bottom-e.bottom);break;case 2:i.x=t.x+Math.random()*(e.x-t.x),i.y=e.y+Math.random()*(t.bottom-e.y);break;case 3:i.x=e.right+Math.random()*(t.right-e.right),i.y=t.y+Math.random()*(e.bottom-t.y)}return i}},87841:(t,e,i)=>{var s=i(83419),n=i(37303),r=i(20812),o=i(34819),a=i(23777),h=i(23031),l=i(26597),u=new s({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.type=a.RECTANGLE,this.x=t,this.y=e,this.width=i,this.height=s},contains:function(t,e){return n(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return l(this,t)},setTo:function(t,e,i,s){return this.x=t,this.y=e,this.width=i,this.height=s,this},setEmpty:function(){return this.setTo(0,0,0,0)},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getLineA:function(t){return void 0===t&&(t=new h),t.setTo(this.x,this.y,this.right,this.y),t},getLineB:function(t){return void 0===t&&(t=new h),t.setTo(this.right,this.y,this.right,this.bottom),t},getLineC:function(t){return void 0===t&&(t=new h),t.setTo(this.right,this.bottom,this.x,this.bottom),t},getLineD:function(t){return void 0===t&&(t=new h),t.setTo(this.x,this.bottom,this.x,this.y),t},left:{get:function(){return this.x},set:function(t){t>=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?this.height=0:this.height=this.bottom-t,this.y=t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=u},94845:t=>{t.exports=function(t,e){return t.width===e.width&&t.height===e.height}},31730:t=>{t.exports=function(t,e,i){return void 0===i&&(i=e),t.width*=e,t.height*=i,t}},36899:(t,e,i)=>{var s=i(87841);t.exports=function(t,e,i){void 0===i&&(i=new s);var n=Math.min(t.x,e.x),r=Math.min(t.y,e.y),o=Math.max(t.right,e.right)-n,a=Math.max(t.bottom,e.bottom)-r;return i.setTo(n,r,o,a)}},93232:(t,e,i)=>{var s=i(87841);s.Area=i(62224),s.Ceil=i(98615),s.CeilAll=i(31688),s.CenterOn=i(67502),s.Clone=i(65085),s.Contains=i(37303),s.ContainsPoint=i(96553),s.ContainsRect=i(70273),s.CopyFrom=i(43459),s.Decompose=i(77493),s.Equals=i(9219),s.FitInside=i(53751),s.FitOutside=i(16088),s.Floor=i(80774),s.FloorAll=i(83859),s.FromPoints=i(19217),s.FromXY=i(9477),s.GetAspectRatio=i(8249),s.GetCenter=i(27165),s.GetPoint=i(20812),s.GetPoints=i(34819),s.GetSize=i(51313),s.Inflate=i(86091),s.Intersection=i(53951),s.MarchingAnts=i(14649),s.MergePoints=i(33595),s.MergeRect=i(20074),s.MergeXY=i(92171),s.Offset=i(42981),s.OffsetPoint=i(46907),s.Overlaps=i(60170),s.Perimeter=i(13019),s.PerimeterPoint=i(85133),s.Random=i(26597),s.RandomOutside=i(86470),s.SameDimensions=i(94845),s.Scale=i(31730),s.Union=i(36899),t.exports=s},41658:t=>{t.exports=function(t){var e=t.x1,i=t.y1,s=t.x2,n=t.y2,r=t.x3,o=t.y3;return Math.abs(((r-e)*(n-i)-(s-e)*(o-i))/2)}},39208:(t,e,i)=>{var s=i(16483);t.exports=function(t,e,i){var n=i*(Math.sqrt(3)/2);return new s(t,e,t+i/2,e+n,t-i/2,e+n)}},39545:(t,e,i)=>{var s=i(94811),n=i(16483);t.exports=function(t,e,i,r,o){void 0===e&&(e=null),void 0===i&&(i=1),void 0===r&&(r=1),void 0===o&&(o=[]);for(var a,h,l,u,c,d,f,p,v,g=s(t,e),m=0;m{var s=i(16483);t.exports=function(t,e,i,n){return void 0===n&&(n=i),new s(t,e,t,e-n,t+i,e)}},23707:(t,e,i)=>{var s=i(97523),n=i(13584);t.exports=function(t,e,i,r){void 0===r&&(r=s);var o=r(t),a=e-o.x,h=i-o.y;return n(t,a,h)}},97523:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=(t.x1+t.x2+t.x3)/3,e.y=(t.y1+t.y2+t.y3)/3,e}},24951:(t,e,i)=>{var s=i(26099);function n(t,e,i,s){return t*s-e*i}t.exports=function(t,e){void 0===e&&(e=new s);var i=t.x3,r=t.y3,o=t.x1-i,a=t.y1-r,h=t.x2-i,l=t.y2-r,u=2*n(o,a,h,l),c=n(a,o*o+a*a,l,h*h+l*l),d=n(o,o*o+a*a,h,h*h+l*l);return e.x=i-c/u,e.y=r+d/u,e}},85614:(t,e,i)=>{var s=i(96503);t.exports=function(t,e){void 0===e&&(e=new s);var i,n,r=t.x1,o=t.y1,a=t.x2,h=t.y2,l=t.x3,u=t.y3,c=a-r,d=h-o,f=l-r,p=u-o,v=c*(r+a)+d*(o+h),g=f*(r+l)+p*(o+u),m=2*(c*(u-h)-d*(l-a));if(Math.abs(m)<1e-6){var y=Math.min(r,a,l),x=Math.min(o,h,u);i=.5*(Math.max(r,a,l)-y),n=.5*(Math.max(o,h,u)-x),e.x=y+i,e.y=x+n,e.radius=Math.sqrt(i*i+n*n)}else e.x=(p*v-d*g)/m,e.y=(c*g-f*v)/m,i=e.x-r,n=e.y-o,e.radius=Math.sqrt(i*i+n*n);return e}},74422:(t,e,i)=>{var s=i(16483);t.exports=function(t){return new s(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}},10690:t=>{t.exports=function(t,e,i){var s=t.x3-t.x1,n=t.y3-t.y1,r=t.x2-t.x1,o=t.y2-t.y1,a=e-t.x1,h=i-t.y1,l=s*s+n*n,u=s*r+n*o,c=s*a+n*h,d=r*r+o*o,f=r*a+o*h,p=l*d-u*u,v=0===p?0:1/p,g=(d*c-u*f)*v,m=(l*f-u*c)*v;return g>=0&&m>=0&&g+m<1}},48653:t=>{t.exports=function(t,e,i,s){void 0===i&&(i=!1),void 0===s&&(s=[]);for(var n,r,o,a,h,l,u=t.x3-t.x1,c=t.y3-t.y1,d=t.x2-t.x1,f=t.y2-t.y1,p=u*u+c*c,v=u*d+c*f,g=d*d+f*f,m=p*g-v*v,y=0===m?0:1/m,x=t.x1,T=t.y1,w=0;w=0&&r>=0&&n+r<1&&(s.push({x:e[w].x,y:e[w].y}),i)));w++);return s}},96006:(t,e,i)=>{var s=i(10690);t.exports=function(t,e){return s(t,e.x,e.y)}},71326:t=>{t.exports=function(t,e){return e.setTo(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}},71694:t=>{t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x1,y:t.y1}),e.push({x:t.x2,y:t.y2}),e.push({x:t.x3,y:t.y3}),e}},33522:t=>{t.exports=function(t,e){return t.x1===e.x1&&t.y1===e.y1&&t.x2===e.x2&&t.y2===e.y2&&t.x3===e.x3&&t.y3===e.y3}},20437:(t,e,i)=>{var s=i(2141),n=i(35001);t.exports=function(t,e,i){void 0===i&&(i=new s);var r=t.getLineA(),o=t.getLineB(),a=t.getLineC();if(e<=0||e>=1)return i.x=r.x1,i.y=r.y1,i;var h=n(r),l=n(o),u=n(a),c=(h+l+u)*e,d=0;return ch+l?(d=(c-=h+l)/u,i.x=a.x1+(a.x2-a.x1)*d,i.y=a.y1+(a.y2-a.y1)*d):(d=(c-=h)/l,i.x=o.x1+(o.x2-o.x1)*d,i.y=o.y1+(o.y2-o.y1)*d),i}},80672:(t,e,i)=>{var s=i(35001),n=i(2141);t.exports=function(t,e,i,r){void 0===r&&(r=[]);var o=t.getLineA(),a=t.getLineB(),h=t.getLineC(),l=s(o),u=s(a),c=s(h),d=l+u+c;!e&&i>0&&(e=d/i);for(var f=0;fl+u?(v=(p-=l+u)/c,g.x=h.x1+(h.x2-h.x1)*v,g.y=h.y1+(h.y2-h.y1)*v):(v=(p-=l)/u,g.x=a.x1+(a.x2-a.x1)*v,g.y=a.y1+(a.y2-a.y1)*v),r.push(g)}return r}},39757:(t,e,i)=>{var s=i(2141);function n(t,e,i,s){var n=t-i,r=e-s,o=n*n+r*r;return Math.sqrt(o)}t.exports=function(t,e){void 0===e&&(e=new s);var i=t.x1,r=t.y1,o=t.x2,a=t.y2,h=t.x3,l=t.y3,u=n(h,l,o,a),c=n(i,r,h,l),d=n(o,a,i,r),f=u+c+d;return e.x=(i*u+o*c+h*d)/f,e.y=(r*u+a*c+l*d)/f,e}},13584:t=>{t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t.x3+=e,t.y3+=i,t}},1376:(t,e,i)=>{var s=i(35001);t.exports=function(t){var e=t.getLineA(),i=t.getLineB(),n=t.getLineC();return s(e)+s(i)+s(n)}},90260:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){void 0===e&&(e=new s);var i=t.x2-t.x1,n=t.y2-t.y1,r=t.x3-t.x1,o=t.y3-t.y1,a=Math.random(),h=Math.random();return a+h>=1&&(a=1-a,h=1-h),e.x=t.x1+(i*a+r*h),e.y=t.y1+(n*a+o*h),e}},52172:(t,e,i)=>{var s=i(99614),n=i(39757);t.exports=function(t,e){var i=n(t);return s(t,i.x,i.y,e)}},49907:(t,e,i)=>{var s=i(99614);t.exports=function(t,e,i){return s(t,e.x,e.y,i)}},99614:t=>{t.exports=function(t,e,i,s){var n=Math.cos(s),r=Math.sin(s),o=t.x1-e,a=t.y1-i;return t.x1=o*n-a*r+e,t.y1=o*r+a*n+i,o=t.x2-e,a=t.y2-i,t.x2=o*n-a*r+e,t.y2=o*r+a*n+i,o=t.x3-e,a=t.y3-i,t.x3=o*n-a*r+e,t.y3=o*r+a*n+i,t}},16483:(t,e,i)=>{var s=i(83419),n=i(10690),r=i(20437),o=i(80672),a=i(23777),h=i(23031),l=i(90260),u=new s({initialize:function(t,e,i,s,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=0),this.type=a.TRIANGLE,this.x1=t,this.y1=e,this.x2=i,this.y2=s,this.x3=n,this.y3=r},contains:function(t,e){return n(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return l(this,t)},setTo:function(t,e,i,s,n,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x1=t,this.y1=e,this.x2=i,this.y2=s,this.x3=n,this.y3=r,this},getLineA:function(t){return void 0===t&&(t=new h),t.setTo(this.x1,this.y1,this.x2,this.y2),t},getLineB:function(t){return void 0===t&&(t=new h),t.setTo(this.x2,this.y2,this.x3,this.y3),t},getLineC:function(t){return void 0===t&&(t=new h),t.setTo(this.x3,this.y3,this.x1,this.y1),t},left:{get:function(){return Math.min(this.x1,this.x2,this.x3)},set:function(t){var e;e=this.x1<=this.x2&&this.x1<=this.x3?this.x1-t:this.x2<=this.x1&&this.x2<=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},right:{get:function(){return Math.max(this.x1,this.x2,this.x3)},set:function(t){var e;e=this.x1>=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e;e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e;e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=u},84435:(t,e,i)=>{var s=i(16483);s.Area=i(41658),s.BuildEquilateral=i(39208),s.BuildFromPolygon=i(39545),s.BuildRight=i(90301),s.CenterOn=i(23707),s.Centroid=i(97523),s.CircumCenter=i(24951),s.CircumCircle=i(85614),s.Clone=i(74422),s.Contains=i(10690),s.ContainsArray=i(48653),s.ContainsPoint=i(96006),s.CopyFrom=i(71326),s.Decompose=i(71694),s.Equals=i(33522),s.GetPoint=i(20437),s.GetPoints=i(80672),s.InCenter=i(39757),s.Perimeter=i(1376),s.Offset=i(13584),s.Random=i(90260),s.Rotate=i(52172),s.RotateAroundPoint=i(49907),s.RotateAroundXY=i(99614),t.exports=s},74457:t=>{t.exports=function(t,e,i){return{gameObject:t,enabled:!0,draggable:!1,dropZone:!1,cursor:!1,target:null,camera:null,hitArea:e,hitAreaCallback:i,hitAreaDebug:null,customHitArea:!1,localX:0,localY:0,dragState:0,dragStartX:0,dragStartY:0,dragStartXGlobal:0,dragStartYGlobal:0,dragX:0,dragY:0}}},84409:t=>{t.exports=function(t,e){return function(i,s,n,r){var o=t.getPixelAlpha(s,n,r.texture.key,r.frame.name);return o&&o>=e}}},7003:(t,e,i)=>{var s=i(83419),n=i(93301),r=i(50792),o=i(8214),a=i(8443),h=i(78970),l=i(85098),u=i(42515),c=i(36210),d=i(61340),f=i(85955),p=new s({initialize:function(t,e){this.game=t,this.scaleManager,this.canvas,this.config=e,this.enabled=!0,this.events=new r,this.isOver=!0,this.defaultCursor="",this.keyboard=e.inputKeyboard?new h(this):null,this.mouse=e.inputMouse?new l(this):null,this.touch=e.inputTouch?new c(this):null,this.pointers=[],this.pointersTotal=e.inputActivePointers,e.inputTouch&&1===this.pointersTotal&&(this.pointersTotal=2);for(var i=0;i<=this.pointersTotal;i++){var s=new u(this,i);s.smoothFactor=e.inputSmoothFactor,this.pointers.push(s)}this.mousePointer=e.inputMouse?this.pointers[0]:null,this.activePointer=this.pointers[0],this.globalTopOnly=!0,this.time=0,this._tempPoint={x:0,y:0},this._tempHitTest=[],this._tempMatrix=new d,this._tempMatrix2=new d,this._tempSkip=!1,this.mousePointerContainer=[this.mousePointer],t.events.once(a.BOOT,this.boot,this)},boot:function(){var t=this.game,e=t.events;this.canvas=t.canvas,this.scaleManager=t.scale,this.events.emit(o.MANAGER_BOOT),e.on(a.PRE_RENDER,this.preRender,this),e.once(a.DESTROY,this.destroy,this)},setCanvasOver:function(t){this.isOver=!0,this.events.emit(o.GAME_OVER,t)},setCanvasOut:function(t){this.isOver=!1,this.events.emit(o.GAME_OUT,t)},preRender:function(){var t=this.game.loop.now,e=this.game.loop.delta,i=this.game.scene.getScenes(!0,!0);this.time=t,this.events.emit(o.MANAGER_UPDATE);for(var s=0;s10&&(t=10-this.pointersTotal);for(var i=0;i{var s=i(96503),n=i(87902),r=i(83419),o=i(93301),a=i(74457),h=i(84409),l=i(20339),u=i(8497),c=i(81154),d=i(8214),f=i(50792),p=i(95540),v=i(23777),g=i(89639),m=i(41212),y=i(37277),x=i(87841),T=i(37303),w=i(44594),b=i(16483),S=i(10690),E=new r({Extends:f,initialize:function(t){f.call(this),this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.manager=t.sys.game.input,this.pluginEvents=new f,this.enabled=!0,this.displayList,this.cameras,g.install(this),this.mouse=this.manager.mouse,this.topOnly=!0,this.pollRate=-1,this._pollTimer=0;var e={cancelled:!1};this._eventContainer={stopPropagation:function(){e.cancelled=!0}},this._eventData=e,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this._temp=[],this._tempZones=[],this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],this._draggable=[],this._drag={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._dragState=[],this._over={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._validTypes=["onDown","onUp","onOver","onOut","onMove","onDragStart","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop"],this._updatedThisFrame=!1,t.sys.events.once(w.BOOT,this.boot,this),t.sys.events.on(w.START,this.start,this)},boot:function(){this.cameras=this.systems.cameras,this.displayList=this.systems.displayList,this.systems.events.once(w.DESTROY,this.destroy,this),this.pluginEvents.emit(d.BOOT)},start:function(){var t=this.systems.events;t.on(w.TRANSITION_START,this.transitionIn,this),t.on(w.TRANSITION_OUT,this.transitionOut,this),t.on(w.TRANSITION_COMPLETE,this.transitionComplete,this),t.on(w.PRE_UPDATE,this.preUpdate,this),t.once(w.SHUTDOWN,this.shutdown,this),this.manager.events.on(d.GAME_OUT,this.onGameOut,this),this.manager.events.on(d.GAME_OVER,this.onGameOver,this),this.enabled=!0,this._dragState=[0,0,0,0,0,0,0,0,0,0],this.pluginEvents.emit(d.START)},onGameOver:function(t){this.isActive()&&this.emit(d.GAME_OVER,t.timeStamp,t)},onGameOut:function(t){this.isActive()&&this.emit(d.GAME_OUT,t.timeStamp,t)},preUpdate:function(){this.pluginEvents.emit(d.PRE_UPDATE);var t=this._pendingRemoval,e=this._pendingInsertion,i=t.length,s=e.length;if(0!==i||0!==s){for(var n=this._list,r=0;r-1&&(n.splice(a,1),this.clear(o,!0))}this._pendingRemoval.length=0,this._list=n.concat(e.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.canInput()},updatePoll:function(t,e){if(!this.isActive())return!1;if(this.pluginEvents.emit(d.UPDATE,t,e),this._updatedThisFrame)return this._updatedThisFrame=!1,!1;var i,s=this.manager,n=s.pointers,r=s.pointersTotal;for(i=0;i0){if(this._pollTimer-=e,!(this._pollTimer<0))return!1;this._pollTimer=this.pollRate}var a=!1;for(i=0;i0&&(a=!0)}return a},update:function(t,e){if(!this.isActive())return!1;for(var i=e.length,s=!1,n=0;n0&&(s=!0)}return this._updatedThisFrame=!0,s},clear:function(t,e){void 0===e&&(e=!1),this.disable(t);var i=t.input;i&&(this.removeDebug(t),this.manager.resetCursor(i),i.gameObject=void 0,i.target=void 0,i.hitArea=void 0,i.hitAreaCallback=void 0,i.callbackContext=void 0,t.input=null),e||this.queueForRemoval(t);var s=this._draggable.indexOf(t);return s>-1&&this._draggable.splice(s,1),t},disable:function(t){var e=t.input;e&&(e.enabled=!1,e.dragState=0);for(var i,s=this._drag,n=this._over,r=this.manager,o=0;o-1&&s[o].splice(i,1),(i=n[o].indexOf(t))>-1&&n[o].splice(i,1);return this},enable:function(t,e,i,s){return void 0===s&&(s=!1),t.input?t.input.enabled=!0:this.setHitArea(t,e,i),t.input&&s&&!t.input.dropZone&&(t.input.dropZone=s),this},hitTestPointer:function(t){for(var e=this.cameras.getCamerasBelowPointer(t),i=0;i0)return t.camera=s,n}return t.camera=e[0],[]},processDownEvents:function(t){var e=0,i=this._temp,s=this._eventData,n=this._eventContainer;s.cancelled=!1;for(var r=!1,o=0;o0&&l(t.x,t.y,t.downX,t.downY)>=n||s>0&&e>=t.downTime+s)&&(i=!0),i)return this.setDragState(t,3),this.processDragStartList(t)},processDragStartList:function(t){if(3!==this.getDragState(t))return 0;for(var e=this._drag[t.id],i=0;i1&&(this.sortGameObjects(i,t),this.topOnly&&i.splice(1)),this._drag[t.id]=i,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?(this.setDragState(t,3),this.processDragStartList(t)):(this.setDragState(t,2),0))},processDragMoveEvent:function(t){if(2===this.getDragState(t)&&this.processDragThresholdEvent(t,this.manager.game.loop.now),4!==this.getDragState(t))return 0;for(var e=this._tempZones,i=this._drag[t.id],s=0;s0?(o.emit(d.GAMEOBJECT_DRAG_LEAVE,t,h),this.emit(d.DRAG_LEAVE,t,o,h),a.target=e[0],h=a.target,o.emit(d.GAMEOBJECT_DRAG_ENTER,t,h),this.emit(d.DRAG_ENTER,t,o,h)):(o.emit(d.GAMEOBJECT_DRAG_LEAVE,t,h),this.emit(d.DRAG_LEAVE,t,o,h),e[0]?(a.target=e[0],h=a.target,o.emit(d.GAMEOBJECT_DRAG_ENTER,t,h),this.emit(d.DRAG_ENTER,t,o,h)):a.target=null)}else!h&&e[0]&&(a.target=e[0],h=a.target,o.emit(d.GAMEOBJECT_DRAG_ENTER,t,h),this.emit(d.DRAG_ENTER,t,o,h));if(o.parentContainer){var u=t.worldX-a.dragStartXGlobal,c=t.worldY-a.dragStartYGlobal,f=o.getParentRotation(),p=u*Math.cos(f)+c*Math.sin(f),v=c*Math.cos(f)-u*Math.sin(f);p*=1/o.parentContainer.scaleX,v*=1/o.parentContainer.scaleY,n=p+a.dragStartX,r=v+a.dragStartY}else n=t.worldX-a.dragX,r=t.worldY-a.dragY;o.emit(d.GAMEOBJECT_DRAG,t,n,r),this.emit(d.DRAG,t,o,n,r)}return i.length},processDragUpEvent:function(t){for(var e=this._drag[t.id],i=0;i0){var r=this.manager,o=this._eventData,a=this._eventContainer;o.cancelled=!1;for(var h=!1,l=0;l0){var n=this.manager,r=this._eventData,o=this._eventContainer;r.cancelled=!1;var a=!1;this.sortGameObjects(e,t);for(var h=0;h0){for(this.sortGameObjects(n,t),e=0;e0){for(this.sortGameObjects(r,t),e=0;e-1&&this._draggable.splice(n,1)}return this},makePixelPerfect:function(t){void 0===t&&(t=1);var e=this.systems.textures;return h(e,t)},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);var s=!1,n=!1,r=!1,o=!1,h=!1,l=!0;if(m(e)&&Object.keys(e).length){var u=e;if(!t.some((function(t){return t.hasOwnProperty("faces")}))){e=p(u,"hitArea",null),i=p(u,"hitAreaCallback",null),h=p(u,"pixelPerfect",!1);var c=p(u,"alphaTolerance",1);h&&(e={},i=this.makePixelPerfect(c))}s=p(u,"draggable",!1),n=p(u,"dropZone",!1),r=p(u,"cursor",!1),o=p(u,"useHandCursor",!1),e&&i||(this.setHitAreaFromTexture(t),l=!1)}else"function"!=typeof e||i||(i=e,e={});for(var d=0;d{var s=i(35154),n={},r={register:function(t,e,i,s,r){n[t]={plugin:e,mapping:i,settingsKey:s,configKey:r}},getPlugin:function(t){return n[t]},install:function(t){var e=t.scene.sys,i=e.settings.input,r=e.game.config;for(var o in n){var a=n[o].plugin,h=n[o].mapping,l=n[o].settingsKey,u=n[o].configKey;s(i,l,r[u])&&(t[h]=new a(t))}},remove:function(t){n.hasOwnProperty(t)&&delete n[t]}};t.exports=r},42515:(t,e,i)=>{var s=i(31040),n=i(83419),r=i(20339),o=i(43855),a=i(47235),h=i(26099),l=i(25892),u=new n({initialize:function(t,e){this.manager=t,this.id=e,this.event,this.downElement,this.upElement,this.camera=null,this.button=0,this.buttons=0,this.position=new h,this.prevPosition=new h,this.midPoint=new h(-1,-1),this.velocity=new h,this.angle=0,this.distance=0,this.smoothFactor=0,this.motionFactor=.2,this.worldX=0,this.worldY=0,this.moveTime=0,this.downX=0,this.downY=0,this.downTime=0,this.upX=0,this.upY=0,this.upTime=0,this.primaryDown=!1,this.isDown=!1,this.wasTouch=!1,this.wasCanceled=!1,this.movementX=0,this.movementY=0,this.identifier=0,this.pointerId=null,this.active=0===e,this.locked=!1,this.deltaX=0,this.deltaY=0,this.deltaZ=0},updateWorldPoint:function(t){var e=t.getWorldPoint(this.x,this.y);return this.worldX=e.x,this.worldY=e.y,this},positionToCamera:function(t,e){return t.getWorldPoint(this.x,this.y,e)},updateMotion:function(){var t=this.position.x,e=this.position.y,i=this.midPoint.x,n=this.midPoint.y;if(t!==i||e!==n){var r=a(this.motionFactor,i,t),h=a(this.motionFactor,n,e);o(r,t,.1)&&(r=t),o(h,e,.1)&&(h=e),this.midPoint.set(r,h);var l=t-r,u=e-h;this.velocity.set(l,u),this.angle=s(r,h,t,e),this.distance=Math.sqrt(l*l+u*u)}},up:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.button=t.button,this.upElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),0===t.button&&(this.primaryDown=!1,this.upX=this.x,this.upY=this.y),0===this.buttons&&(this.isDown=!1,this.upTime=t.timeStamp,this.wasTouch=!1)},down:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.button=t.button,this.downElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),0===t.button&&(this.primaryDown=!0,this.downX=this.x,this.downY=this.y),l.macOS&&t.ctrlKey&&(this.buttons=2,this.primaryDown=!1),this.isDown||(this.isDown=!0,this.downTime=t.timeStamp),this.wasTouch=!1},move:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.manager.transformPointer(this,t.pageX,t.pageY,!0),this.locked&&(this.movementX=t.movementX||t.mozMovementX||t.webkitMovementX||0,this.movementY=t.movementY||t.mozMovementY||t.webkitMovementY||0),this.moveTime=t.timeStamp,this.wasTouch=!1},wheel:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.deltaX=t.deltaX,this.deltaY=t.deltaY,this.deltaZ=t.deltaZ,this.wasTouch=!1},touchstart:function(t,e){t.pointerId&&(this.pointerId=t.pointerId),this.identifier=t.identifier,this.target=t.target,this.active=!0,this.buttons=1,this.event=e,this.downElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.primaryDown=!0,this.downX=this.x,this.downY=this.y,this.downTime=e.timeStamp,this.isDown=!0,this.wasTouch=!0,this.wasCanceled=!1,this.updateMotion()},touchmove:function(t,e){this.event=e,this.manager.transformPointer(this,t.pageX,t.pageY,!0),this.moveTime=e.timeStamp,this.wasTouch=!0,this.updateMotion()},touchend:function(t,e){this.buttons=0,this.event=e,this.upElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.primaryDown=!1,this.upX=this.x,this.upY=this.y,this.upTime=e.timeStamp,this.isDown=!1,this.wasTouch=!0,this.wasCanceled=!1,this.active=!1,this.updateMotion()},touchcancel:function(t,e){this.buttons=0,this.event=e,this.upElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.primaryDown=!1,this.upX=this.x,this.upY=this.y,this.upTime=e.timeStamp,this.isDown=!1,this.wasTouch=!0,this.wasCanceled=!0,this.active=!1},noButtonDown:function(){return 0===this.buttons},leftButtonDown:function(){return!!(1&this.buttons)},rightButtonDown:function(){return!!(2&this.buttons)},middleButtonDown:function(){return!!(4&this.buttons)},backButtonDown:function(){return!!(8&this.buttons)},forwardButtonDown:function(){return!!(16&this.buttons)},leftButtonReleased:function(){return 0===this.button&&!this.isDown},rightButtonReleased:function(){return 2===this.button&&!this.isDown},middleButtonReleased:function(){return 1===this.button&&!this.isDown},backButtonReleased:function(){return 3===this.button&&!this.isDown},forwardButtonReleased:function(){return 4===this.button&&!this.isDown},getDistance:function(){return this.isDown?r(this.downX,this.downY,this.x,this.y):r(this.downX,this.downY,this.upX,this.upY)},getDistanceX:function(){return this.isDown?Math.abs(this.downX-this.x):Math.abs(this.downX-this.upX)},getDistanceY:function(){return this.isDown?Math.abs(this.downY-this.y):Math.abs(this.downY-this.upY)},getDuration:function(){return this.isDown?this.manager.time-this.downTime:this.upTime-this.downTime},getAngle:function(){return this.isDown?s(this.downX,this.downY,this.x,this.y):s(this.downX,this.downY,this.upX,this.upY)},getInterpolatedPosition:function(t,e){void 0===t&&(t=10),void 0===e&&(e=[]);for(var i=this.prevPosition.x,s=this.prevPosition.y,n=this.position.x,r=this.position.y,o=0;o{t.exports={MOUSE_DOWN:0,MOUSE_MOVE:1,MOUSE_UP:2,TOUCH_START:3,TOUCH_MOVE:4,TOUCH_END:5,POINTER_LOCK_CHANGE:6,TOUCH_CANCEL:7,MOUSE_WHEEL:8}},7179:t=>{t.exports="boot"},85375:t=>{t.exports="destroy"},39843:t=>{t.exports="dragend"},23388:t=>{t.exports="dragenter"},16133:t=>{t.exports="drag"},27829:t=>{t.exports="dragleave"},53904:t=>{t.exports="dragover"},56058:t=>{t.exports="dragstart"},2642:t=>{t.exports="drop"},88171:t=>{t.exports="gameobjectdown"},36147:t=>{t.exports="dragend"},71692:t=>{t.exports="dragenter"},96149:t=>{t.exports="drag"},81285:t=>{t.exports="dragleave"},74048:t=>{t.exports="dragover"},21322:t=>{t.exports="dragstart"},49378:t=>{t.exports="drop"},86754:t=>{t.exports="gameobjectmove"},86433:t=>{t.exports="gameobjectout"},60709:t=>{t.exports="gameobjectover"},24081:t=>{t.exports="pointerdown"},11172:t=>{t.exports="pointermove"},18907:t=>{t.exports="pointerout"},95579:t=>{t.exports="pointerover"},35368:t=>{t.exports="pointerup"},26972:t=>{t.exports="wheel"},47078:t=>{t.exports="gameobjectup"},73802:t=>{t.exports="gameobjectwheel"},56718:t=>{t.exports="gameout"},25936:t=>{t.exports="gameover"},27503:t=>{t.exports="boot"},50852:t=>{t.exports="process"},96438:t=>{t.exports="update"},59152:t=>{t.exports="pointerlockchange"},47777:t=>{t.exports="pointerdown"},27957:t=>{t.exports="pointerdownoutside"},19444:t=>{t.exports="pointermove"},54251:t=>{t.exports="pointerout"},18667:t=>{t.exports="pointerover"},27192:t=>{t.exports="pointerup"},24652:t=>{t.exports="pointerupoutside"},45132:t=>{t.exports="wheel"},44512:t=>{t.exports="preupdate"},15757:t=>{t.exports="shutdown"},41637:t=>{t.exports="start"},93802:t=>{t.exports="update"},8214:(t,e,i)=>{t.exports={BOOT:i(7179),DESTROY:i(85375),DRAG_END:i(39843),DRAG_ENTER:i(23388),DRAG:i(16133),DRAG_LEAVE:i(27829),DRAG_OVER:i(53904),DRAG_START:i(56058),DROP:i(2642),GAME_OUT:i(56718),GAME_OVER:i(25936),GAMEOBJECT_DOWN:i(88171),GAMEOBJECT_DRAG_END:i(36147),GAMEOBJECT_DRAG_ENTER:i(71692),GAMEOBJECT_DRAG:i(96149),GAMEOBJECT_DRAG_LEAVE:i(81285),GAMEOBJECT_DRAG_OVER:i(74048),GAMEOBJECT_DRAG_START:i(21322),GAMEOBJECT_DROP:i(49378),GAMEOBJECT_MOVE:i(86754),GAMEOBJECT_OUT:i(86433),GAMEOBJECT_OVER:i(60709),GAMEOBJECT_POINTER_DOWN:i(24081),GAMEOBJECT_POINTER_MOVE:i(11172),GAMEOBJECT_POINTER_OUT:i(18907),GAMEOBJECT_POINTER_OVER:i(95579),GAMEOBJECT_POINTER_UP:i(35368),GAMEOBJECT_POINTER_WHEEL:i(26972),GAMEOBJECT_UP:i(47078),GAMEOBJECT_WHEEL:i(73802),MANAGER_BOOT:i(27503),MANAGER_PROCESS:i(50852),MANAGER_UPDATE:i(96438),POINTER_DOWN:i(47777),POINTER_DOWN_OUTSIDE:i(27957),POINTER_MOVE:i(19444),POINTER_OUT:i(54251),POINTER_OVER:i(18667),POINTER_UP:i(27192),POINTER_UP_OUTSIDE:i(24652),POINTER_WHEEL:i(45132),POINTERLOCK_CHANGE:i(59152),PRE_UPDATE:i(44512),SHUTDOWN:i(15757),START:i(41637),UPDATE:i(93802)}},97421:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e){this.pad=t,this.events=t.events,this.index=e,this.value=0,this.threshold=.1},update:function(t){this.value=t},getValue:function(){return Math.abs(this.value){var s=i(83419),n=i(92734),r=new s({initialize:function(t,e){this.pad=t,this.events=t.manager,this.index=e,this.value=0,this.threshold=1,this.pressed=!1},update:function(t){this.value=t;var e=this.pad,i=this.index;t>=this.threshold?this.pressed||(this.pressed=!0,this.events.emit(n.BUTTON_DOWN,e,this,t),this.pad.emit(n.GAMEPAD_BUTTON_DOWN,i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit(n.BUTTON_UP,e,this,t),this.pad.emit(n.GAMEPAD_BUTTON_UP,i,t,this))},destroy:function(){this.pad=null,this.events=null}});t.exports=r},99125:(t,e,i)=>{var s=i(97421),n=i(28884),r=i(83419),o=i(50792),a=i(26099),h=new r({Extends:o,initialize:function(t,e){o.call(this),this.manager=t,this.pad=e,this.id=e.id,this.index=e.index;for(var i=[],r=0;r=2&&(this.leftStick.set(r[0].getValue(),r[1].getValue()),n>=4&&this.rightStick.set(r[2].getValue(),r[3].getValue()))}},destroy:function(){var t;for(this.removeAllListeners(),this.manager=null,this.pad=null,t=0;t{var s=i(83419),n=i(50792),r=i(92734),o=i(99125),a=i(35154),h=i(89639),l=i(8214),u=new s({Extends:n,initialize:function(t){n.call(this),this.scene=t.scene,this.settings=this.scene.sys.settings,this.sceneInputPlugin=t,this.enabled=!0,this.target,this.gamepads=[],this.queue=[],this.onGamepadHandler,this._pad1,this._pad2,this._pad3,this._pad4,t.pluginEvents.once(l.BOOT,this.boot,this),t.pluginEvents.on(l.START,this.start,this)},boot:function(){var t=this.scene.sys.game,e=this.settings.input,i=t.config;this.enabled=a(e,"gamepad",i.inputGamepad)&&t.device.input.gamepads,this.target=a(e,"gamepad.target",i.inputGamepadEventTarget),this.sceneInputPlugin.pluginEvents.once(l.DESTROY,this.destroy,this)},start:function(){this.enabled&&(this.startListeners(),this.refreshPads()),this.sceneInputPlugin.pluginEvents.once(l.SHUTDOWN,this.shutdown,this)},isActive:function(){return this.enabled&&this.scene.sys.isActive()},startListeners:function(){var t=this,e=this.target,i=function(e){!e.defaultPrevented&&t.isActive()&&(t.refreshPads(),t.queue.push(e))};this.onGamepadHandler=i,e.addEventListener("gamepadconnected",i,!1),e.addEventListener("gamepaddisconnected",i,!1),this.sceneInputPlugin.pluginEvents.on(l.UPDATE,this.update,this)},stopListeners:function(){this.target.removeEventListener("gamepadconnected",this.onGamepadHandler),this.target.removeEventListener("gamepaddisconnected",this.onGamepadHandler),this.sceneInputPlugin.pluginEvents.off(l.UPDATE,this.update);for(var t=0;t{t.exports={UP:12,DOWN:13,LEFT:14,RIGHT:15,SELECT:8,START:9,B:0,A:1,Y:2,X:3,LEFT_SHOULDER:4,RIGHT_SHOULDER:5}},65294:t=>{t.exports={UP:12,DOWN:13,LEFT:14,RIGHT:15,SHARE:8,OPTIONS:9,PS:16,TOUCHBAR:17,X:0,CIRCLE:1,SQUARE:2,TRIANGLE:3,L1:4,R1:5,L2:6,R2:7,L3:10,R3:11,LEFT_STICK_H:0,LEFT_STICK_V:1,RIGHT_STICK_H:2,RIGHT_STICK_V:3}},90089:t=>{t.exports={UP:12,DOWN:13,LEFT:14,RIGHT:15,MENU:16,A:0,B:1,X:2,Y:3,LB:4,RB:5,LT:6,RT:7,BACK:8,START:9,LS:10,RS:11,LEFT_STICK_H:0,LEFT_STICK_V:1,RIGHT_STICK_H:2,RIGHT_STICK_V:3}},64894:(t,e,i)=>{t.exports={DUALSHOCK_4:i(65294),SNES_USB:i(89651),XBOX_360:i(90089)}},46008:t=>{t.exports="down"},7629:t=>{t.exports="up"},42206:t=>{t.exports="connected"},86544:t=>{t.exports="disconnected"},94784:t=>{t.exports="down"},14325:t=>{t.exports="up"},92734:(t,e,i)=>{t.exports={BUTTON_DOWN:i(46008),BUTTON_UP:i(7629),CONNECTED:i(42206),DISCONNECTED:i(86544),GAMEPAD_BUTTON_DOWN:i(94784),GAMEPAD_BUTTON_UP:i(14325)}},48646:(t,e,i)=>{t.exports={Axis:i(97421),Button:i(28884),Events:i(92734),Gamepad:i(99125),GamepadPlugin:i(56654),Configs:i(64894)}},14350:(t,e,i)=>{var s=i(93301),n=i(79291),r={CreatePixelPerfectHandler:i(84409),CreateInteractiveObject:i(74457),Events:i(8214),Gamepad:i(48646),InputManager:i(7003),InputPlugin:i(48205),InputPluginCache:i(89639),Keyboard:i(51442),Mouse:i(87078),Pointer:i(42515),Touch:i(95618)};r=n(!1,r,s),t.exports=r},78970:(t,e,i)=>{var s=i(72905),n=i(83419),r=i(8443),o=i(8214),a=i(46032),h=i(29747),l=new n({initialize:function(t){this.manager=t,this.queue=[],this.preventDefault=!0,this.captures=[],this.enabled=!1,this.target,this.onKeyDown=h,this.onKeyUp=h,t.events.once(o.MANAGER_BOOT,this.boot,this)},boot:function(){var t=this.manager.config;this.enabled=t.inputKeyboard,this.target=t.inputKeyboardEventTarget,this.addCapture(t.inputKeyboardCapture),!this.target&&window&&(this.target=window),this.enabled&&this.target&&this.startListeners(),this.manager.game.events.on(r.POST_STEP,this.postUpdate,this)},startListeners:function(){var t=this;this.onKeyDown=function(e){if(!e.defaultPrevented&&t.enabled&&t.manager){t.queue.push(e),t.manager.events.emit(o.MANAGER_PROCESS);var i=e.altKey||e.ctrlKey||e.shiftKey||e.metaKey;t.preventDefault&&!i&&t.captures.indexOf(e.keyCode)>-1&&e.preventDefault()}},this.onKeyUp=function(e){if(!e.defaultPrevented&&t.enabled&&t.manager){t.queue.push(e),t.manager.events.emit(o.MANAGER_PROCESS);var i=e.altKey||e.ctrlKey||e.shiftKey||e.metaKey;t.preventDefault&&!i&&t.captures.indexOf(e.keyCode)>-1&&e.preventDefault()}};var e=this.target;e&&(e.addEventListener("keydown",this.onKeyDown,!1),e.addEventListener("keyup",this.onKeyUp,!1),this.enabled=!0)},stopListeners:function(){var t=this.target;t.removeEventListener("keydown",this.onKeyDown,!1),t.removeEventListener("keyup",this.onKeyUp,!1),this.enabled=!1},postUpdate:function(){this.queue=[]},addCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},removeCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},clearCaptures:function(){this.captures=[],this.preventDefault=!1},destroy:function(){this.stopListeners(),this.clearCaptures(),this.queue=[],this.manager.game.events.off(r.POST_RENDER,this.postUpdate,this),this.target=null,this.enabled=!1,this.manager=null}});t.exports=l},28846:(t,e,i)=>{var s=i(83419),n=i(50792),r=i(95922),o=i(8443),a=i(35154),h=i(8214),l=i(89639),u=i(30472),c=i(46032),d=i(87960),f=i(74600),p=i(44594),v=i(56583),g=new s({Extends:n,initialize:function(t){n.call(this),this.game=t.systems.game,this.scene=t.scene,this.settings=this.scene.sys.settings,this.sceneInputPlugin=t,this.manager=t.manager.keyboard,this.enabled=!0,this.keys=[],this.combos=[],this.prevCode=null,this.prevTime=0,this.prevType=null,t.pluginEvents.once(h.BOOT,this.boot,this),t.pluginEvents.on(h.START,this.start,this)},boot:function(){var t=this.settings.input;this.enabled=a(t,"keyboard",!0);var e=a(t,"keyboard.capture",null);e&&this.addCaptures(e),this.sceneInputPlugin.pluginEvents.once(h.DESTROY,this.destroy,this)},start:function(){this.sceneInputPlugin.manager.events.on(h.MANAGER_PROCESS,this.update,this),this.sceneInputPlugin.pluginEvents.once(h.SHUTDOWN,this.shutdown,this),this.game.events.on(o.BLUR,this.resetKeys,this),this.scene.sys.events.on(p.PAUSE,this.resetKeys,this),this.scene.sys.events.on(p.SLEEP,this.resetKeys,this)},isActive:function(){return this.enabled&&this.scene.sys.canInput()},addCapture:function(t){return this.manager.addCapture(t),this},removeCapture:function(t){return this.manager.removeCapture(t),this},getCaptures:function(){return this.manager.captures},enableGlobalCapture:function(){return this.manager.preventDefault=!0,this},disableGlobalCapture:function(){return this.manager.preventDefault=!1,this},clearCaptures:function(){return this.manager.clearCaptures(),this},createCursorKeys:function(){return this.addKeys({up:c.UP,down:c.DOWN,left:c.LEFT,right:c.RIGHT,space:c.SPACE,shift:c.SHIFT})},addKeys:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1);var s={};if("string"==typeof t){t=t.split(",");for(var n=0;n-1?s[n]=t:s[t.keyCode]=t,e&&this.addCapture(t.keyCode),t.setEmitOnRepeat(i),t}return"string"==typeof t&&(t=c[t.toUpperCase()]),s[t]||(s[t]=new u(this,t),e&&this.addCapture(t),s[t].setEmitOnRepeat(i)),s[t]},removeKey:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var s,n=this.keys;if(t instanceof u){var r=n.indexOf(t);r>-1&&(s=this.keys[r],this.keys[r]=void 0)}else"string"==typeof t&&(t=c[t.toUpperCase()]);return n[t]&&(s=n[t],n[t]=void 0),s&&(s.plugin=null,i&&this.removeCapture(s.keyCode),e&&s.destroy()),this},removeAllKeys:function(t,e){void 0===t&&(t=!1),void 0===e&&(e=!1);for(var i=this.keys,s=0;st._tick)return t._tick=i,!0}return!1},update:function(){var t=this.manager.queue,e=t.length;if(this.isActive()&&0!==e)for(var i=this.keys,s=0;s{t.exports=function(t,e){return e.timeLastMatched=t.timeStamp,e.index++,e.index===e.size||(e.current=e.keyCodes[e.index],!1)}},87960:(t,e,i)=>{var s=i(83419),n=i(95922),r=i(95540),o=i(68769),a=i(92803),h=new s({initialize:function(t,e,i){if(void 0===i&&(i={}),e.length<2)return!1;this.manager=t,this.enabled=!0,this.keyCodes=[];for(var s=0;s{var s=i(66970);t.exports=function(t,e){if(e.matched)return!0;var i=!1,n=!1;if(t.keyCode===e.current)if(e.index>0&&e.maxKeyDelay>0){var r=e.timeLastMatched+e.maxKeyDelay;t.timeStamp<=r&&(n=!0,i=s(t,e))}else n=!0,i=s(t,e);return!n&&e.resetOnWrongKey&&(e.index=0,e.current=e.keyCodes[0]),i&&(e.timeLastMatched=t.timeStamp,e.matched=!0,e.timeMatched=t.timeStamp),i}},92803:t=>{t.exports=function(t){return t.current=t.keyCodes[0],t.index=0,t.timeLastMatched=0,t.matched=!1,t.timeMatched=0,t}},92612:t=>{t.exports="keydown"},23345:t=>{t.exports="keyup"},21957:t=>{t.exports="keycombomatch"},44743:t=>{t.exports="down"},3771:t=>{t.exports="keydown-"},46358:t=>{t.exports="keyup-"},75674:t=>{t.exports="up"},95922:(t,e,i)=>{t.exports={ANY_KEY_DOWN:i(92612),ANY_KEY_UP:i(23345),COMBO_MATCH:i(21957),DOWN:i(44743),KEY_DOWN:i(3771),KEY_UP:i(46358),UP:i(75674)}},51442:(t,e,i)=>{t.exports={Events:i(95922),KeyboardManager:i(78970),KeyboardPlugin:i(28846),Key:i(30472),KeyCodes:i(46032),KeyCombo:i(87960),AdvanceKeyCombo:i(66970),ProcessKeyCombo:i(68769),ResetKeyCombo:i(92803),JustDown:i(90229),JustUp:i(38796),DownDuration:i(37015),UpDuration:i(41170)}},37015:t=>{t.exports=function(t,e){void 0===e&&(e=50);var i=t.plugin.game.loop.time-t.timeDown;return t.isDown&&i{t.exports=function(t){return!!t._justDown&&(t._justDown=!1,!0)}},38796:t=>{t.exports=function(t){return!!t._justUp&&(t._justUp=!1,!0)}},30472:(t,e,i)=>{var s=i(83419),n=i(50792),r=i(95922),o=new s({Extends:n,initialize:function(t,e){n.call(this),this.plugin=t,this.keyCode=e,this.originalEvent=void 0,this.enabled=!0,this.isDown=!1,this.isUp=!0,this.altKey=!1,this.ctrlKey=!1,this.shiftKey=!1,this.metaKey=!1,this.location=0,this.timeDown=0,this.duration=0,this.timeUp=0,this.emitOnRepeat=!1,this.repeats=0,this._justDown=!1,this._justUp=!1,this._tick=-1},setEmitOnRepeat:function(t){return this.emitOnRepeat=t,this},onDown:function(t){this.originalEvent=t,this.enabled&&(this.altKey=t.altKey,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.location=t.location,this.repeats++,this.isDown?this.emitOnRepeat&&this.emit(r.DOWN,this,t):(this.isDown=!0,this.isUp=!1,this.timeDown=t.timeStamp,this.duration=0,this._justDown=!0,this._justUp=!1,this.emit(r.DOWN,this,t)))},onUp:function(t){this.originalEvent=t,this.enabled&&(this.isDown=!1,this.isUp=!0,this.timeUp=t.timeStamp,this.duration=this.timeUp-this.timeDown,this.repeats=0,this._justDown=!1,this._justUp=!0,this._tick=-1,this.emit(r.UP,this,t))},reset:function(){return this.isDown=!1,this.isUp=!0,this.altKey=!1,this.ctrlKey=!1,this.shiftKey=!1,this.metaKey=!1,this.timeDown=0,this.duration=0,this.timeUp=0,this.repeats=0,this._justDown=!1,this._justUp=!1,this._tick=-1,this},getDuration:function(){return this.isDown?this.plugin.game.loop.time-this.timeDown:0},destroy:function(){this.removeAllListeners(),this.originalEvent=null,this.plugin=null}});t.exports=o},46032:t=>{t.exports={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:42,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,NUMPAD_ZERO:96,NUMPAD_ONE:97,NUMPAD_TWO:98,NUMPAD_THREE:99,NUMPAD_FOUR:100,NUMPAD_FIVE:101,NUMPAD_SIX:102,NUMPAD_SEVEN:103,NUMPAD_EIGHT:104,NUMPAD_NINE:105,NUMPAD_ADD:107,NUMPAD_SUBTRACT:109,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,SEMICOLON:186,PLUS:187,COMMA:188,MINUS:189,PERIOD:190,FORWARD_SLASH:191,BACK_SLASH:220,QUOTES:222,BACKTICK:192,OPEN_BRACKET:219,CLOSED_BRACKET:221,SEMICOLON_FIREFOX:59,COLON:58,COMMA_FIREFOX_WINDOWS:60,COMMA_FIREFOX:62,BRACKET_RIGHT_FIREFOX:174,BRACKET_LEFT_FIREFOX:175}},74600:(t,e,i)=>{var s=i(46032),n={};for(var r in s)n[s[r]]=r;t.exports=n},41170:t=>{t.exports=function(t,e){void 0===e&&(e=50);var i=t.plugin.game.loop.time-t.timeUp;return t.isUp&&i{var s=i(83419),n=i(89357),r=i(8214),o=i(29747),a=new s({initialize:function(t){this.manager=t,this.preventDefaultDown=!0,this.preventDefaultUp=!0,this.preventDefaultMove=!0,this.preventDefaultWheel=!1,this.enabled=!1,this.target,this.locked=!1,this.onMouseMove=o,this.onMouseDown=o,this.onMouseUp=o,this.onMouseDownWindow=o,this.onMouseUpWindow=o,this.onMouseOver=o,this.onMouseOut=o,this.onMouseWheel=o,this.pointerLockChange=o,this.isTop=!0,t.events.once(r.MANAGER_BOOT,this.boot,this)},boot:function(){var t=this.manager.config;this.enabled=t.inputMouse,this.target=t.inputMouseEventTarget,this.passive=t.inputMousePassive,this.preventDefaultDown=t.inputMousePreventDefaultDown,this.preventDefaultUp=t.inputMousePreventDefaultUp,this.preventDefaultMove=t.inputMousePreventDefaultMove,this.preventDefaultWheel=t.inputMousePreventDefaultWheel,this.target?"string"==typeof this.target&&(this.target=document.getElementById(this.target)):this.target=this.manager.game.canvas,t.disableContextMenu&&this.disableContextMenu(),this.enabled&&this.target&&this.startListeners()},disableContextMenu:function(){return this.target.addEventListener("contextmenu",(function(t){return t.preventDefault(),!1})),this},requestPointerLock:function(){if(n.pointerLock){var t=this.target;t.requestPointerLock=t.requestPointerLock||t.mozRequestPointerLock||t.webkitRequestPointerLock,t.requestPointerLock()}},releasePointerLock:function(){n.pointerLock&&(document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.exitPointerLock())},startListeners:function(){var t=this.target;if(t){var e=this,i=this.manager,s=i.canvas,r=window&&window.focus&&i.game.config.autoFocus;this.onMouseMove=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onMouseMove(t),e.preventDefaultMove&&t.preventDefault())},this.onMouseDown=function(t){r&&window.focus(),!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onMouseDown(t),e.preventDefaultDown&&t.target===s&&t.preventDefault())},this.onMouseDownWindow=function(t){t.sourceCapabilities&&t.sourceCapabilities.firesTouchEvents||!t.defaultPrevented&&e.enabled&&i&&i.enabled&&t.target!==s&&i.onMouseDown(t)},this.onMouseUp=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onMouseUp(t),e.preventDefaultUp&&t.target===s&&t.preventDefault())},this.onMouseUpWindow=function(t){t.sourceCapabilities&&t.sourceCapabilities.firesTouchEvents||!t.defaultPrevented&&e.enabled&&i&&i.enabled&&t.target!==s&&i.onMouseUp(t)},this.onMouseOver=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.setCanvasOver(t)},this.onMouseOut=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.setCanvasOut(t)},this.onMouseWheel=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.onMouseWheel(t),e.preventDefaultWheel&&t.target===s&&t.preventDefault()};var o={passive:!0};if(t.addEventListener("mousemove",this.onMouseMove),t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mouseup",this.onMouseUp),t.addEventListener("mouseover",this.onMouseOver,o),t.addEventListener("mouseout",this.onMouseOut,o),this.preventDefaultWheel?t.addEventListener("wheel",this.onMouseWheel,{passive:!1}):t.addEventListener("wheel",this.onMouseWheel,o),window&&i.game.config.inputWindowEvents)try{window.top.addEventListener("mousedown",this.onMouseDownWindow,o),window.top.addEventListener("mouseup",this.onMouseUpWindow,o)}catch(a){window.addEventListener("mousedown",this.onMouseDownWindow,o),window.addEventListener("mouseup",this.onMouseUpWindow,o),this.isTop=!1}n.pointerLock&&(this.pointerLockChange=function(t){var s=e.target;e.locked=document.pointerLockElement===s||document.mozPointerLockElement===s||document.webkitPointerLockElement===s,i.onPointerLockChange(t)},document.addEventListener("pointerlockchange",this.pointerLockChange,!0),document.addEventListener("mozpointerlockchange",this.pointerLockChange,!0),document.addEventListener("webkitpointerlockchange",this.pointerLockChange,!0)),this.enabled=!0}},stopListeners:function(){var t=this.target;t.removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("mouseover",this.onMouseOver),t.removeEventListener("mouseout",this.onMouseOut),window&&((t=this.isTop?window.top:window).removeEventListener("mousedown",this.onMouseDownWindow),t.removeEventListener("mouseup",this.onMouseUpWindow)),n.pointerLock&&(document.removeEventListener("pointerlockchange",this.pointerLockChange,!0),document.removeEventListener("mozpointerlockchange",this.pointerLockChange,!0),document.removeEventListener("webkitpointerlockchange",this.pointerLockChange,!0))},destroy:function(){this.stopListeners(),this.target=null,this.enabled=!1,this.manager=null}});t.exports=a},87078:(t,e,i)=>{t.exports={MouseManager:i(85098)}},36210:(t,e,i)=>{var s=i(83419),n=i(8214),r=i(29747),o=new s({initialize:function(t){this.manager=t,this.capture=!0,this.enabled=!1,this.target,this.onTouchStart=r,this.onTouchStartWindow=r,this.onTouchMove=r,this.onTouchEnd=r,this.onTouchEndWindow=r,this.onTouchCancel=r,this.onTouchCancelWindow=r,this.isTop=!0,t.events.once(n.MANAGER_BOOT,this.boot,this)},boot:function(){var t=this.manager.config;this.enabled=t.inputTouch,this.target=t.inputTouchEventTarget,this.capture=t.inputTouchCapture,this.target?"string"==typeof this.target&&(this.target=document.getElementById(this.target)):this.target=this.manager.game.canvas,t.disableContextMenu&&this.disableContextMenu(),this.enabled&&this.target&&this.startListeners()},disableContextMenu:function(){return this.target.addEventListener("contextmenu",(function(t){return t.preventDefault(),!1})),this},startListeners:function(){var t=this.target;if(t){var e=this,i=this.manager,s=i.canvas,n=window&&window.focus&&i.game.config.autoFocus;this.onTouchMove=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onTouchMove(t),e.capture&&t.cancelable&&t.preventDefault())},this.onTouchStart=function(t){n&&window.focus(),!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onTouchStart(t),e.capture&&t.cancelable&&t.target===s&&t.preventDefault())},this.onTouchStartWindow=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&t.target!==s&&i.onTouchStart(t)},this.onTouchEnd=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onTouchEnd(t),e.capture&&t.cancelable&&t.target===s&&t.preventDefault())},this.onTouchEndWindow=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&t.target!==s&&i.onTouchEnd(t)},this.onTouchCancel=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onTouchCancel(t),e.capture&&t.preventDefault())},this.onTouchCancelWindow=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.onTouchCancel(t)};var r=this.capture,o={passive:!0},a={passive:!1};if(t.addEventListener("touchstart",this.onTouchStart,r?a:o),t.addEventListener("touchmove",this.onTouchMove,r?a:o),t.addEventListener("touchend",this.onTouchEnd,r?a:o),t.addEventListener("touchcancel",this.onTouchCancel,r?a:o),window&&i.game.config.inputWindowEvents)try{window.top.addEventListener("touchstart",this.onTouchStartWindow,a),window.top.addEventListener("touchend",this.onTouchEndWindow,a),window.top.addEventListener("touchcancel",this.onTouchCancelWindow,a)}catch(h){window.addEventListener("touchstart",this.onTouchStartWindow,a),window.addEventListener("touchend",this.onTouchEndWindow,a),window.addEventListener("touchcancel",this.onTouchCancelWindow,a),this.isTop=!1}this.enabled=!0}},stopListeners:function(){var t=this.target;t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("touchmove",this.onTouchMove),t.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("touchcancel",this.onTouchCancel),window&&((t=this.isTop?window.top:window).removeEventListener("touchstart",this.onTouchStartWindow),t.removeEventListener("touchend",this.onTouchEndWindow),t.removeEventListener("touchcancel",this.onTouchCancelWindow))},destroy:function(){this.stopListeners(),this.target=null,this.enabled=!1,this.manager=null}});t.exports=o},95618:(t,e,i)=>{t.exports={TouchManager:i(36210)}},41299:(t,e,i)=>{var s=i(83419),n=i(23906),r=i(54899),o=i(95540),a=i(98356),h=i(3374),l=i(84376),u=i(92638),c=new s({initialize:function(t,e){if(this.loader=t,this.cache=o(e,"cache",!1),this.type=o(e,"type",!1),!this.type)throw new Error("Invalid File type: "+this.type);this.key=o(e,"key",!1);var i=this.key;if(t.prefix&&""!==t.prefix&&(this.key=t.prefix+i),!this.key)throw new Error("Invalid File key: "+this.key);var s=o(e,"url");void 0===s?s=t.path+i+"."+o(e,"extension",""):"string"!=typeof s||s.match(/^(?:blob:|data:|capacitor:\/\/|http:\/\/|https:\/\/|\/\/)/)||(s=t.path+s),this.url=s,this.src="",this.xhrSettings=u(o(e,"responseType",void 0)),o(e,"xhrSettings",!1)&&(this.xhrSettings=h(this.xhrSettings,o(e,"xhrSettings",{}))),this.xhrLoader=null,this.state="function"==typeof this.url?n.FILE_POPULATED:n.FILE_PENDING,this.bytesTotal=0,this.bytesLoaded=-1,this.percentComplete=-1,this.crossOrigin=void 0,this.data=void 0,this.config=o(e,"config",{}),this.multiFile,this.linkFile,this.base64="string"==typeof s&&0===s.indexOf("data:")},setLink:function(t){this.linkFile=t,t.linkFile=this},resetXHR:function(){this.xhrLoader&&(this.xhrLoader.onload=void 0,this.xhrLoader.onerror=void 0,this.xhrLoader.onprogress=void 0)},load:function(){this.state===n.FILE_POPULATED?this.loader.nextFile(this,!0):(this.state=n.FILE_LOADING,this.src=a(this,this.loader.baseURL),0===this.src.indexOf("data:")&&(this.base64=!0),this.xhrLoader=l(this,this.loader.xhr))},onLoad:function(t,e){var i=t.responseURL&&this.loader.localSchemes.some((function(e){return 0===t.responseURL.indexOf(e)}))&&0===e.target.status,s=!(e.target&&200!==e.target.status)||i;4===t.readyState&&t.status>=400&&t.status<=599&&(s=!1),this.state=n.FILE_LOADED,this.resetXHR(),this.loader.nextFile(this,s)},onBase64Load:function(t){this.xhrLoader=t,this.state=n.FILE_LOADED,this.percentComplete=1,this.loader.emit(r.FILE_PROGRESS,this,this.percentComplete),this.loader.nextFile(this,!0)},onError:function(){this.resetXHR(),this.loader.nextFile(this,!1)},onProgress:function(t){t.lengthComputable&&(this.bytesLoaded=t.loaded,this.bytesTotal=t.total,this.percentComplete=Math.min(this.bytesLoaded/this.bytesTotal,1),this.loader.emit(r.FILE_PROGRESS,this,this.percentComplete))},onProcess:function(){this.state=n.FILE_PROCESSING,this.onProcessComplete()},onProcessComplete:function(){this.state=n.FILE_COMPLETE,this.multiFile&&this.multiFile.onFileComplete(this),this.loader.fileProcessComplete(this)},onProcessError:function(){console.error('Failed to process file: %s "%s"',this.type,this.key),this.state=n.FILE_ERRORED,this.multiFile&&this.multiFile.onFileFailed(this),this.loader.fileProcessComplete(this)},hasCacheConflict:function(){return this.cache&&this.cache.exists(this.key)},addToCache:function(){this.cache&&this.data&&this.cache.add(this.key,this.data)},pendingDestroy:function(t){if(this.state!==n.FILE_PENDING_DESTROY){void 0===t&&(t=this.data);var e=this.key,i=this.type;this.loader.emit(r.FILE_COMPLETE,e,i,t),this.loader.emit(r.FILE_KEY_COMPLETE+i+"-"+e,e,i,t),this.loader.flagForRemoval(this),this.state=n.FILE_PENDING_DESTROY}},destroy:function(){this.loader=null,this.cache=null,this.xhrSettings=null,this.multiFile=null,this.linkFile=null,this.data=null}});c.createObjectURL=function(t,e,i){if("function"==typeof URL)t.src=URL.createObjectURL(e);else{var s=new FileReader;s.onload=function(){t.removeAttribute("crossOrigin"),t.src="data:"+(e.type||i)+";base64,"+s.result.split(",")[1]},s.onerror=t.onerror,s.readAsDataURL(e)}},c.revokeObjectURL=function(t){"function"==typeof URL&&URL.revokeObjectURL(t.src)},t.exports=c},74099:t=>{var e={},i={install:function(t){for(var i in e)t[i]=e[i]},register:function(t,i){e[t]=i},destroy:function(){e={}}};t.exports=i},98356:t=>{t.exports=function(t,e){return!!t.url&&(t.url.match(/^(?:blob:|data:|capacitor:\/\/|http:\/\/|https:\/\/|\/\/)/)?t.url:e+t.url)}},74261:(t,e,i)=>{var s=i(83419),n=i(23906),r=i(35072),o=i(50792),a=i(54899),h=i(74099),l=i(95540),u=i(35154),c=i(37277),d=i(44594),f=i(92638),p=new s({Extends:o,initialize:function(t){o.call(this);var e=t.sys.game.config,i=t.sys.settings.loader;this.scene=t,this.systems=t.sys,this.cacheManager=t.sys.cache,this.textureManager=t.sys.textures,this.sceneManager=t.sys.game.scene,h.install(this),this.prefix="",this.path="",this.baseURL="",this.setBaseURL(l(i,"baseURL",e.loaderBaseURL)),this.setPath(l(i,"path",e.loaderPath)),this.setPrefix(l(i,"prefix",e.loaderPrefix)),this.maxParallelDownloads=l(i,"maxParallelDownloads",e.loaderMaxParallelDownloads),this.xhr=f(l(i,"responseType",e.loaderResponseType),l(i,"async",e.loaderAsync),l(i,"user",e.loaderUser),l(i,"password",e.loaderPassword),l(i,"timeout",e.loaderTimeout),l(i,"withCredentials",e.loaderWithCredentials)),this.crossOrigin=l(i,"crossOrigin",e.loaderCrossOrigin),this.imageLoadType=l(i,"imageLoadType",e.loaderImageLoadType),this.localSchemes=l(i,"localScheme",e.loaderLocalScheme),this.totalToLoad=0,this.progress=0,this.list=new r,this.inflight=new r,this.queue=new r,this._deleteQueue=new r,this.totalFailed=0,this.totalComplete=0,this.state=n.LOADER_IDLE,this.multiKeyIndex=0,t.sys.events.once(d.BOOT,this.boot,this),t.sys.events.on(d.START,this.pluginStart,this)},boot:function(){this.systems.events.once(d.DESTROY,this.destroy,this)},pluginStart:function(){this.systems.events.once(d.SHUTDOWN,this.shutdown,this)},setBaseURL:function(t){return void 0===t&&(t=""),""!==t&&"/"!==t.substr(-1)&&(t=t.concat("/")),this.baseURL=t,this},setPath:function(t){return void 0===t&&(t=""),""!==t&&"/"!==t.substr(-1)&&(t=t.concat("/")),this.path=t,this},setPrefix:function(t){return void 0===t&&(t=""),this.prefix=t,this},setCORS:function(t){return this.crossOrigin=t,this},addFile:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e0},isLoading:function(){return this.state===n.LOADER_LOADING||this.state===n.LOADER_PROCESSING},isReady:function(){return this.state===n.LOADER_IDLE||this.state===n.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit(a.START,this),0===this.list.size?this.loadComplete():(this.state=n.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on(d.UPDATE,this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit(a.PROGRESS,this.progress)},update:function(){this.state===n.LOADER_LOADING&&this.list.size>0&&this.inflight.size{var s=i(79291),n=i(92638);t.exports=function(t,e){var i=void 0===t?n():s({},t);if(e)for(var r in e)void 0!==e[r]&&(i[r]=e[r]);return i}},26430:(t,e,i)=>{var s=i(83419),n=i(23906),r=i(54899),o=new s({initialize:function(t,e,i,s){var r=[];s.forEach((function(t){t&&r.push(t)})),this.loader=t,this.type=e,this.key=i;var o=this.key;t.prefix&&""!==t.prefix&&(this.key=t.prefix+o),this.multiKeyIndex=t.multiKeyIndex++,this.files=r,this.state=n.FILE_PENDING,this.complete=!1,this.pending=r.length,this.failed=0,this.config={},this.baseURL=t.baseURL,this.path=t.path,this.prefix=t.prefix;for(var a=0;a{var s=i(3374);t.exports=function(t,e){var i=s(e,t.xhrSettings);if(!t.base64){var n=new XMLHttpRequest;if(n.open("GET",t.src,i.async,i.user,i.password),n.responseType=t.xhrSettings.responseType,n.timeout=i.timeout,i.headers)for(var r in i.headers)n.setRequestHeader(r,i.headers[r]);return i.header&&i.headerValue&&n.setRequestHeader(i.header,i.headerValue),i.requestedWith&&n.setRequestHeader("X-Requested-With",i.requestedWith),i.overrideMimeType&&n.overrideMimeType(i.overrideMimeType),i.withCredentials&&(n.withCredentials=!0),n.onload=t.onLoad.bind(t,n),n.onerror=t.onError.bind(t,n),n.onprogress=t.onProgress.bind(t),n.ontimeout=t.onError.bind(t,n),n.send(),n}var o=t.url.split(";base64,").pop()||t.url.split(",").pop(),a={responseText:atob(o)};t.onBase64Load(a)}},92638:t=>{t.exports=function(t,e,i,s,n,r){return void 0===t&&(t=""),void 0===e&&(e=!0),void 0===i&&(i=""),void 0===s&&(s=""),void 0===n&&(n=0),void 0===r&&(r=!1),{responseType:t,async:e,user:i,password:s,timeout:n,headers:void 0,header:void 0,headerValue:void 0,requestedWith:!1,overrideMimeType:void 0,withCredentials:r}}},23906:t=>{t.exports={LOADER_IDLE:0,LOADER_LOADING:1,LOADER_PROCESSING:2,LOADER_COMPLETE:3,LOADER_SHUTDOWN:4,LOADER_DESTROYED:5,FILE_PENDING:10,FILE_LOADING:11,FILE_LOADED:12,FILE_FAILED:13,FILE_PROCESSING:14,FILE_ERRORED:16,FILE_COMPLETE:17,FILE_DESTROYED:18,FILE_POPULATED:19,FILE_PENDING_DESTROY:20}},42155:t=>{t.exports="addfile"},38991:t=>{t.exports="complete"},27540:t=>{t.exports="filecomplete"},87464:t=>{t.exports="filecomplete-"},94486:t=>{t.exports="loaderror"},13035:t=>{t.exports="load"},38144:t=>{t.exports="fileprogress"},97520:t=>{t.exports="postprocess"},85595:t=>{t.exports="progress"},55680:t=>{t.exports="start"},54899:(t,e,i)=>{t.exports={ADD:i(42155),COMPLETE:i(38991),FILE_COMPLETE:i(27540),FILE_KEY_COMPLETE:i(87464),FILE_LOAD_ERROR:i(94486),FILE_LOAD:i(13035),FILE_PROGRESS:i(38144),POST_PROCESS:i(97520),PROGRESS:i(85595),START:i(55680)}},14135:(t,e,i)=>{var s=i(83419),n=i(74099),r=i(518),o=i(54899),a=new s({Extends:r,initialize:function(t,e,i,s,n){r.call(this,t,e,i,s,n),this.type="animationJSON"},onProcess:function(){this.loader.once(o.POST_PROCESS,this.onLoadComplete,this),r.prototype.onProcess.call(this)},onLoadComplete:function(){this.loader.systems.anims.fromJSON(this.data)}});n.register("animation",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(518),l=i(26430),u=new s({Extends:l,initialize:function(t,e,i,s,n,u){var c,d;if(a(e)){var f=e;e=r(f,"key"),c=new o(t,{key:e,url:r(f,"textureURL"),extension:r(f,"textureExtension","png"),normalMap:r(f,"normalMap"),xhrSettings:r(f,"textureXhrSettings")}),d=new h(t,{key:e,url:r(f,"atlasURL"),extension:r(f,"atlasExtension","json"),xhrSettings:r(f,"atlasXhrSettings")})}else c=new o(t,e,i,n),d=new h(t,e,s,u);c.linkFile?l.call(this,t,"atlasjson",e,[c,d,c.linkFile]):l.call(this,t,"atlasjson",e,[c,d])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1],i=this.files[2]?this.files[2].data:null;this.loader.textureManager.addAtlas(t.key,t.data,e.data,i),e.addToCache(),this.complete=!0}}});n.register("aseprite",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(518),l=i(26430),u=new s({Extends:l,initialize:function(t,e,i,s,n,u){var c,d;if(a(e)){var f=e;e=r(f,"key"),c=new o(t,{key:e,url:r(f,"textureURL"),extension:r(f,"textureExtension","png"),normalMap:r(f,"normalMap"),xhrSettings:r(f,"textureXhrSettings")}),d=new h(t,{key:e,url:r(f,"atlasURL"),extension:r(f,"atlasExtension","json"),xhrSettings:r(f,"atlasXhrSettings")})}else c=new o(t,e,i,n),d=new h(t,e,s,u);c.linkFile?l.call(this,t,"atlasjson",e,[c,d,c.linkFile]):l.call(this,t,"atlasjson",e,[c,d])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1],i=this.files[2]?this.files[2].data:null;this.loader.textureManager.addAtlas(t.key,t.data,e.data,i),this.complete=!0}}});n.register("atlas",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(26430),l=i(57318),u=new s({Extends:h,initialize:function(t,e,i,s,n,u){var c,d;if(a(e)){var f=e;e=r(f,"key"),c=new o(t,{key:e,url:r(f,"textureURL"),extension:r(f,"textureExtension","png"),normalMap:r(f,"normalMap"),xhrSettings:r(f,"textureXhrSettings")}),d=new l(t,{key:e,url:r(f,"atlasURL"),extension:r(f,"atlasExtension","xml"),xhrSettings:r(f,"atlasXhrSettings")})}else c=new o(t,e,i,n),d=new l(t,e,s,u);c.linkFile?h.call(this,t,"atlasxml",e,[c,d,c.linkFile]):h.call(this,t,"atlasxml",e,[c,d])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1],i=this.files[2]?this.files[2].data:null;this.loader.textureManager.addAtlasXML(t.key,t.data,e.data,i),this.complete=!0}}});n.register("atlasXML",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(89749),l=i(41212),u=new s({Extends:r,initialize:function(t,e,i,s,n){if(l(e)){var o=e;e=a(o,"key"),s=a(o,"xhrSettings"),n=a(o,"context",n)}var h={type:"audio",cache:t.cacheManager.audio,extension:i.type,responseType:"arraybuffer",key:e,url:i.url,xhrSettings:s,config:{context:n}};r.call(this,t,h)},onProcess:function(){this.state=n.FILE_PROCESSING;var t=this;this.config.context.decodeAudioData(this.xhrLoader.response,(function(e){t.data=e,t.onProcessComplete()}),(function(e){console.error("Error decoding audio: "+t.key+" - ",e?e.message:null),t.onProcessError()})),this.config.context=null}});u.create=function(t,e,i,s,n){var r=t.systems.game,o=r.config.audio,c=r.device.audio;l(e)&&(i=a(e,"url",[]),s=a(e,"config",{}));var d=u.getAudioURL(r,i);return d?c.webAudio&&!o.disableWebAudio?new u(t,e,d,n,r.sound.context):new h(t,e,d,s):(console.warn('No audio URLs for "%s" matched this device',e),null)},u.getAudioURL=function(t,e){Array.isArray(e)||(e=[e]);for(var i=0;i{var s=i(21097),n=i(83419),r=i(74099),o=i(95540),a=i(41212),h=i(518),l=i(26430),u=new n({Extends:l,initialize:function(t,e,i,n,r,u,c){if(a(e)){var d=e;e=o(d,"key"),i=o(d,"jsonURL"),n=o(d,"audioURL"),r=o(d,"audioConfig"),u=o(d,"audioXhrSettings"),c=o(d,"jsonXhrSettings")}var f;if(n){var p=s.create(t,e,n,r,u);p&&(f=new h(t,e,i,c),l.call(this,t,"audiosprite",e,[p,f]),this.config.resourceLoad=!1)}else f=new h(t,e,i,c),l.call(this,t,"audiosprite",e,[f]),this.config.resourceLoad=!0,this.config.audioConfig=r,this.config.audioXhrSettings=u},onFileComplete:function(t){if(-1!==this.files.indexOf(t)&&(this.pending--,this.config.resourceLoad&&"json"===t.type&&t.data.hasOwnProperty("resources"))){var e=t.data.resources,i=o(this.config,"audioConfig"),n=o(this.config,"audioXhrSettings"),r=s.create(this.loader,t.key,e,i,n);r&&(this.addToMultiFile(r),this.loader.addFile(r))}},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1];t.addToCache(),e.addToCache(),this.complete=!0}}});r.register("audioSprite",(function(t,e,i,s,n,r){var o,a=this.systems.game,h=a.config.audio,l=a.device.audio;if(h&&h.noAudio||!l.webAudio&&!l.audioData)return this;if(Array.isArray(t))for(var c=0;c{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,n){var o="bin";if(h(e)){var l=e;e=a(l,"key"),i=a(l,"url"),s=a(l,"xhrSettings"),o=a(l,"extension",o),n=a(l,"dataType",n)}var u={type:"binary",cache:t.cacheManager.binary,extension:o,responseType:"arraybuffer",key:e,url:i,xhrSettings:s,config:{dataType:n}};r.call(this,t,u)},onProcess:function(){this.state=n.FILE_PROCESSING;var t=this.config.dataType;this.data=t?new t(this.xhrLoader.response):this.xhrLoader.response,this.onProcessComplete()}});o.register("binary",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(26430),l=i(21859),u=i(57318),c=new s({Extends:h,initialize:function(t,e,i,s,n,l){var c,d;if(a(e)){var f=e;e=r(f,"key"),c=new o(t,{key:e,url:r(f,"textureURL"),extension:r(f,"textureExtension","png"),normalMap:r(f,"normalMap"),xhrSettings:r(f,"textureXhrSettings")}),d=new u(t,{key:e,url:r(f,"fontDataURL"),extension:r(f,"fontDataExtension","xml"),xhrSettings:r(f,"fontDataXhrSettings")})}else c=new o(t,e,i,n),d=new u(t,e,s,l);c.linkFile?h.call(this,t,"bitmapfont",e,[c,d,c.linkFile]):h.call(this,t,"bitmapfont",e,[c,d])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1];t.addToCache();var i=t.cache.get(t.key),s=l(e.data,t.cache.getFrame(t.key),0,0,i);this.loader.cacheManager.bitmapFont.add(t.key,{data:s,texture:t.key,frame:null}),this.complete=!0}}});n.register("bitmapFont",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s){var n="css";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),s=a(o,"xhrSettings"),n=a(o,"extension",n)}var l={type:"script",cache:!1,extension:n,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,l)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=document.createElement("style"),this.data.defer=!1,this.data.innerHTML=this.xhrLoader.responseText,document.head.appendChild(this.data),this.onProcessComplete()}});o.register("css",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(38734),n=i(85722),r=i(83419),o=i(74099),a=i(95540),h=i(19550),l=i(41212),u=i(518),c=i(31403),d=i(46975),f=i(59327),p=i(26430),v=i(82038),g=i(55222),m=new r({Extends:p,initialize:function(t,e,i,s){if(i.multiAtlasURL){var r=new u(t,{key:e,url:i.multiAtlasURL,xhrSettings:s,config:i});p.call(this,t,"texture",e,[r])}else{var o=i.textureURL.substr(i.textureURL.length-3);i.type||(i.type="ktx"===o.toLowerCase()?"KTX":"PVR");var a=new n(t,{key:e,url:i.textureURL,extension:o,xhrSettings:s,config:i});if(i.atlasURL){var h=new u(t,{key:e,url:i.atlasURL,xhrSettings:s,config:i});p.call(this,t,"texture",e,[a,h])}else p.call(this,t,"texture",e,[a])}this.config=i},onFileComplete:function(t){if(-1!==this.files.indexOf(t)){if(this.pending--,!this.config.multiAtlasURL)return;if("json"===t.type&&t.data.hasOwnProperty("textures")){var e=t.data.textures,i=this.config,s=this.loader,r=s.baseURL,o=s.path,h=s.prefix,l=a(i,"multiBaseURL",this.baseURL),u=a(i,"multiPath",this.path),c=a(i,"prefix",this.prefix),d=a(i,"textureXhrSettings");l&&s.setBaseURL(l),u&&s.setPath(u),c&&s.setPrefix(c);for(var f=0;f{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=i(73894),u=new s({Extends:r,initialize:function(t,e,i,s,n){var o="glsl";if(h(e)){var l=e;e=a(l,"key"),i=a(l,"url"),s=a(l,"shaderType","fragment"),n=a(l,"xhrSettings"),o=a(l,"extension",o)}else void 0===s&&(s="fragment");var u={type:"glsl",cache:t.cacheManager.shader,extension:o,responseType:"text",key:e,url:i,config:{shaderType:s},xhrSettings:n};r.call(this,t,u)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()},addToCache:function(){var t=this.data.split("\n"),e=this.extractBlock(t,0);if(e)for(;e;){var i=this.getShaderName(e.header),s=this.getShaderType(e.header),n=this.getShaderUniforms(e.header),r=e.shader;if(this.cache.has(i)){var o=this.cache.get(i);"fragment"===s?o.fragmentSrc=r:o.vertexSrc=r,o.uniforms||(o.uniforms=n)}else"fragment"===s?this.cache.add(i,new l(i,r,"",n)):this.cache.add(i,new l(i,"",r,n));e=this.extractBlock(t,e.offset)}else"fragment"===this.config.shaderType?this.cache.add(this.key,new l(this.key,this.data)):this.cache.add(this.key,new l(this.key,"",this.data))},getShaderName:function(t){for(var e=0;e{var s=i(83419),n=i(54899),r=i(41299),o=i(95540),a=i(98356),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s){if(h(e)){var n=e;e=o(n,"key"),s=o(n,"config",s)}var a={type:"audio",cache:t.cacheManager.audio,extension:i.type,key:e,url:i.url,config:s};r.call(this,t,a),this.locked="ontouchstart"in window,this.loaded=!1,this.filesLoaded=0,this.filesTotal=0},onLoad:function(){this.loaded||(this.loaded=!0,this.loader.nextFile(this,!0))},onError:function(){for(var t=0;t{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s){var n="html";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),s=a(o,"xhrSettings"),n=a(o,"extension",n)}var l={type:"text",cache:t.cacheManager.html,extension:n,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,l)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()}});o.register("html",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,n,o){void 0===s&&(s=512),void 0===n&&(n=512);var l="html";if(h(e)){var u=e;e=a(u,"key"),i=a(u,"url"),o=a(u,"xhrSettings"),l=a(u,"extension",l),s=a(u,"width",s),n=a(u,"height",n)}var c={type:"html",cache:t.textureManager,extension:l,responseType:"text",key:e,url:i,xhrSettings:o,config:{width:s,height:n}};r.call(this,t,c)},onProcess:function(){this.state=n.FILE_PROCESSING;var t=this.config.width,e=this.config.height,i=[];i.push(''),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var s=[i.join("\n")],o=this;try{var a=new window.Blob(s,{type:"image/svg+xml;charset=utf-8"})}catch(h){return o.state=n.FILE_ERRORED,void o.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(o.data),o.onProcessComplete()},this.data.onerror=function(){r.revokeObjectURL(o.data),o.onProcessError()},r.createObjectURL(this.data,a,"image/svg+xml")},addToCache:function(){this.cache.addImage(this.key,this.data)}});o.register("htmlTexture",(function(t,e,i,s,n){if(Array.isArray(t))for(var r=0;r{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=i(98356),u=new s({Extends:r,initialize:function t(e,i,s,n,o){var l,u="png";if(h(i)){var c=i;i=a(c,"key"),s=a(c,"url"),l=a(c,"normalMap"),n=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"frameConfig")}Array.isArray(s)&&(l=s[1],s=s[0]);var d={type:"image",cache:e.textureManager,extension:u,responseType:"blob",key:i,url:s,xhrSettings:n,config:o};if(r.call(this,e,d),l){var f=new t(e,this.key,l,n,o);f.type="normalMap",this.setLink(f),e.addFile(f)}this.useImageElementLoad="HTMLImageElement"===e.imageLoadType||this.base64,this.useImageElementLoad&&(this.load=this.loadImage,this.onProcess=this.onProcessImage)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=new Image,this.data.crossOrigin=this.crossOrigin;var t=this;this.data.onload=function(){r.revokeObjectURL(t.data),t.onProcessComplete()},this.data.onerror=function(){r.revokeObjectURL(t.data),t.onProcessError()},r.createObjectURL(this.data,this.xhrLoader.response,"image/png")},onProcessImage:function(){var t=this.state;this.state=n.FILE_PROCESSING,t===n.FILE_LOADED?this.onProcessComplete():this.onProcessError()},loadImage:function(){this.state=n.FILE_LOADING,this.src=l(this,this.loader.baseURL),this.data=new Image,this.data.crossOrigin=this.crossOrigin;var t=this;this.data.onload=function(){t.state=n.FILE_LOADED,t.loader.nextFile(t,!0)},this.data.onerror=function(){t.loader.nextFile(t,!1)},this.data.src=this.src},addToCache:function(){var t=this.linkFile;t?t.state>=n.FILE_COMPLETE&&("spritesheet"===t.type?t.addToCache():"normalMap"===this.type?this.cache.addImage(this.key,t.data,this.data):this.cache.addImage(this.key,this.data,t.data)):this.cache.addImage(this.key,this.data)}});o.register("image",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(35154),l=i(41212),u=new s({Extends:r,initialize:function(t,e,i,s,o){var u="json";if(l(e)){var c=e;e=a(c,"key"),i=a(c,"url"),s=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"dataKey",o)}var d={type:"json",cache:t.cacheManager.json,extension:u,responseType:"text",key:e,url:i,xhrSettings:s,config:o};r.call(this,t,d),l(i)&&(this.data=o?h(i,o):i,this.state=n.FILE_POPULATED)},onProcess:function(){if(this.state!==n.FILE_POPULATED){this.state=n.FILE_PROCESSING;try{var t=JSON.parse(this.xhrLoader.responseText)}catch(i){throw this.onProcessError(),i}var e=this.config;this.data="string"==typeof e?h(t,e,t):t}this.onProcessComplete()}});o.register("json",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(518),l=i(26430),u=new s({Extends:l,initialize:function(t,e,i,s,n,o,u){if(a(e)){var c=e;e=r(c,"key"),i=r(c,"url",!1)?r(c,"url"):r(c,"atlasURL"),o=r(c,"xhrSettings"),s=r(c,"path"),n=r(c,"baseURL"),u=r(c,"textureXhrSettings")}var d=new h(t,e,i,o);l.call(this,t,"multiatlas",e,[d]),this.config.path=s,this.config.baseURL=n,this.config.textureXhrSettings=u},onFileComplete:function(t){if(-1!==this.files.indexOf(t)&&(this.pending--,"json"===t.type&&t.data.hasOwnProperty("textures"))){var e=t.data.textures,i=this.config,s=this.loader,n=s.baseURL,a=s.path,h=s.prefix,l=r(i,"baseURL",this.baseURL),u=r(i,"path",this.path),c=r(i,"prefix",this.prefix),d=r(i,"textureXhrSettings");s.setBaseURL(l),s.setPath(u),s.setPrefix(c);for(var f=0;f{var s=i(83419),n=i(74099),r=i(95540),o=i(41212),a=i(26430),h=i(34328),l=new s({Extends:a,initialize:function(t,e,i,s){var n="js",l=[];if(o(e)){var u=e;e=r(u,"key"),i=r(u,"url"),s=r(u,"xhrSettings"),n=r(u,"extension",n)}Array.isArray(i)||(i=[i]);for(var c=0;c{var s=i(83419),n=i(74099),r=i(95540),o=i(41212),a=i(26430),h=i(85048),l=i(61485),u=i(78776),c=new s({Extends:a,initialize:function(t,e,i,s,n,h){var l,c,d=t.cacheManager.obj;if(o(e)){var f=e;e=r(f,"key"),l=new u(t,{key:e,type:"obj",cache:d,url:r(f,"url"),extension:r(f,"extension","obj"),xhrSettings:r(f,"xhrSettings"),config:{flipUV:r(f,"flipUV",n)}}),(s=r(f,"matURL"))&&(c=new u(t,{key:e,type:"mat",cache:d,url:s,extension:r(f,"matExtension","mat"),xhrSettings:r(f,"xhrSettings")}))}else l=new u(t,{key:e,url:i,type:"obj",cache:d,extension:"obj",xhrSettings:h,config:{flipUV:n}}),s&&(c=new u(t,{key:e,url:s,type:"mat",cache:d,extension:"mat",xhrSettings:h}));a.call(this,t,"obj",e,[l,c])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1],i=h(t.data,t.config.flipUV);e&&(i.materials=l(e.data)),t.cache.add(t.key,i),this.complete=!0}}});n.register("obj",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(23906),r=i(74099),o=i(518),a=new s({Extends:o,initialize:function(t,e,i,s,n){o.call(this,t,e,i,s,n),this.type="packfile"},onProcess:function(){if(this.state!==n.FILE_POPULATED&&(this.state=n.FILE_PROCESSING,this.data=JSON.parse(this.xhrLoader.responseText)),this.data.hasOwnProperty("files")&&this.config){var t={};t[this.config]=this.data,this.data=t}this.loader.addPack(this.data,this.config),this.onProcessComplete()}});r.register("pack",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,o,l){var u="js";if(h(e)){var c=e;e=a(c,"key"),i=a(c,"url"),l=a(c,"xhrSettings"),u=a(c,"extension",u),s=a(c,"start"),o=a(c,"mapping")}var d={type:"plugin",cache:!1,extension:u,responseType:"text",key:e,url:i,xhrSettings:l,config:{start:s,mapping:o}};r.call(this,t,d),"function"==typeof i&&(this.data=i,this.state=n.FILE_POPULATED)},onProcess:function(){var t=this.loader.systems.plugins,e=this.config,i=a(e,"start",!1),s=a(e,"mapping",null);if(this.state===n.FILE_POPULATED)t.install(this.key,this.data,i,s);else{this.state=n.FILE_PROCESSING,this.data=document.createElement("script"),this.data.language="javascript",this.data.type="text/javascript",this.data.defer=!1,this.data.text=this.xhrLoader.responseText,document.head.appendChild(this.data);var r=t.install(this.key,window[this.key],i,s);(i||s)&&(this.loader.systems[s]=r,this.loader.scene[s]=r)}this.onProcessComplete()}});o.register("plugin",(function(t,e,i,s,n){if(Array.isArray(t))for(var r=0;r{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,n){var o="svg";if(h(e)){var l=e;e=a(l,"key"),i=a(l,"url"),s=a(l,"svgConfig",{}),n=a(l,"xhrSettings"),o=a(l,"extension",o)}var u={type:"svg",cache:t.textureManager,extension:o,responseType:"text",key:e,url:i,xhrSettings:n,config:{width:a(s,"width"),height:a(s,"height"),scale:a(s,"scale")}};r.call(this,t,u)},onProcess:function(){this.state=n.FILE_PROCESSING;var t=this.xhrLoader.responseText,e=[t],i=this.config.width,s=this.config.height,o=this.config.scale;t:if(i&&s||o){var a=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("svg")[0],h=a.hasAttribute("viewBox"),l=parseFloat(a.getAttribute("width")),u=parseFloat(a.getAttribute("height"));if(!h&&l&&u)a.setAttribute("viewBox","0 0 "+l+" "+u);else if(h&&!l&&!u){var c=a.getAttribute("viewBox").split(/\s+|,/);l=c[2],u=c[3]}if(o){if(!l||!u)break t;i=l*o,s=u*o}a.setAttribute("width",i.toString()+"px"),a.setAttribute("height",s.toString()+"px"),e=[(new XMLSerializer).serializeToString(a)]}try{var d=new window.Blob(e,{type:"image/svg+xml;charset=utf-8"})}catch(v){return void this.onProcessError()}this.data=new Image,this.data.crossOrigin=this.crossOrigin;var f=this,p=!1;this.data.onload=function(){p||r.revokeObjectURL(f.data),f.onProcessComplete()},this.data.onerror=function(){p?f.onProcessError():(p=!0,r.revokeObjectURL(f.data),f.data.src="data:image/svg+xml,"+encodeURIComponent(e.join("")))},r.createObjectURL(this.data,d,"image/svg+xml")},addToCache:function(){this.cache.addImage(this.key,this.data)}});o.register("svg",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s){var n="js";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),s=a(o,"xhrSettings"),n=a(o,"extension",n)}var l={type:"text",extension:n,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,l)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()},addToCache:function(){var t=this.data.concat("(function(){\nreturn new "+this.key+"();\n}).call(this);"),e=eval;this.loader.sceneManager.add(this.key,e(t)),this.complete=!0}});o.register("sceneFile",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,o,l){var u="js";if(h(e)){var c=e;e=a(c,"key"),i=a(c,"url"),l=a(c,"xhrSettings"),u=a(c,"extension",u),s=a(c,"systemKey"),o=a(c,"sceneKey")}var d={type:"scenePlugin",cache:!1,extension:u,responseType:"text",key:e,url:i,xhrSettings:l,config:{systemKey:s,sceneKey:o}};r.call(this,t,d),"function"==typeof i&&(this.data=i,this.state=n.FILE_POPULATED)},onProcess:function(){var t=this.loader.systems.plugins,e=this.config,i=this.key,s=a(e,"systemKey",i),r=a(e,"sceneKey",i);this.state===n.FILE_POPULATED?t.installScenePlugin(s,this.data,r,this.loader.scene,!0):(this.state=n.FILE_PROCESSING,this.data=document.createElement("script"),this.data.language="javascript",this.data.type="text/javascript",this.data.defer=!1,this.data.text=this.xhrLoader.responseText,document.head.appendChild(this.data),t.installScenePlugin(s,window[this.key],r,this.loader.scene,!0)),this.onProcessComplete()}});o.register("scenePlugin",(function(t,e,i,s,n){if(Array.isArray(t))for(var r=0;r{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,n){var o="js";if(h(e)){var l=e;e=a(l,"key"),i=a(l,"url"),s=a(l,"type","script"),n=a(l,"xhrSettings"),o=a(l,"extension",o)}else void 0===s&&(s="script");var u={type:s,cache:!1,extension:o,responseType:"text",key:e,url:i,xhrSettings:n};r.call(this,t,u)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=document.createElement("script"),this.data.language="javascript",this.data.type="text/javascript",this.data.defer=!1,this.data.text=this.xhrLoader.responseText,document.head.appendChild(this.data),this.onProcessComplete()}});o.register("script",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(23906),r=i(74099),o=i(19550),a=new s({Extends:o,initialize:function(t,e,i,s,n){o.call(this,t,e,i,n,s),this.type="spritesheet"},addToCache:function(){var t=this.linkFile;t?t.state>=n.FILE_COMPLETE&&("normalMap"===this.type?this.cache.addSpriteSheet(this.key,t.data,this.config,this.data):this.cache.addSpriteSheet(this.key,this.data,this.config,t.data)):this.cache.addSpriteSheet(this.key,this.data,this.config)}});r.register("spritesheet",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s){var n="text",o="txt",l=t.cacheManager.text;if(h(e)){var u=e;e=a(u,"key"),i=a(u,"url"),s=a(u,"xhrSettings"),o=a(u,"extension",o),n=a(u,"type",n),l=a(u,"cache",l)}var c={type:n,cache:l,extension:o,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,c)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()}});o.register("text",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=i(80341),u=new s({Extends:r,initialize:function(t,e,i,s){var n="csv";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),s=a(o,"xhrSettings"),n=a(o,"extension",n)}var u={type:"tilemapCSV",cache:t.cacheManager.tilemap,extension:n,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,u),this.tilemapFormat=l.CSV},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()},addToCache:function(){var t={format:this.tilemapFormat,data:this.data};this.cache.add(this.key,t)}});o.register("tilemapCSV",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(74099),r=i(518),o=i(80341),a=new s({Extends:r,initialize:function(t,e,i,s){r.call(this,t,e,i,s),this.type="tilemapJSON",this.cache=t.cacheManager.tilemap},addToCache:function(){var t={format:o.WELTMEISTER,data:this.data};this.cache.add(this.key,t)}});n.register("tilemapImpact",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(74099),r=i(518),o=i(80341),a=new s({Extends:r,initialize:function(t,e,i,s){r.call(this,t,e,i,s),this.type="tilemapJSON",this.cache=t.cacheManager.tilemap},addToCache:function(){var t={format:o.TILED_JSON,data:this.data};this.cache.add(this.key,t)}});n.register("tilemapTiledJSON",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(26430),l=i(78776),u=new s({Extends:h,initialize:function(t,e,i,s,n,u){var c,d;if(a(e)){var f=e;e=r(f,"key"),c=new o(t,{key:e,url:r(f,"textureURL"),extension:r(f,"textureExtension","png"),normalMap:r(f,"normalMap"),xhrSettings:r(f,"textureXhrSettings")}),d=new l(t,{key:e,url:r(f,"atlasURL"),extension:r(f,"atlasExtension","txt"),xhrSettings:r(f,"atlasXhrSettings")})}else c=new o(t,e,i,n),d=new l(t,e,s,u);c.linkFile?h.call(this,t,"unityatlas",e,[c,d,c.linkFile]):h.call(this,t,"unityatlas",e,[c,d])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1],i=this.files[2]?this.files[2].data:null;this.loader.textureManager.addUnityAtlas(t.key,t.data,e.data,i),this.complete=!0}}});n.register("unityAtlas",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(98356),h=i(95540),l=i(41212),u=new s({Extends:r,initialize:function(t,e,i,s){if(void 0===s&&(s=!1),l(e)){var n=e;e=h(n,"key"),i=h(n,"url",[]),s=h(n,"noAudio",!1)}var o=t.systems.game.device.video.getVideoURL(i);o||console.warn("VideoFile: No supported format for "+e);var a={type:"video",cache:t.cacheManager.video,extension:o.type,key:e,url:o.url,config:{noAudio:s}};r.call(this,t,a)},onProcess:function(){this.data={url:this.src,noAudio:this.config.noAudio,crossOrigin:this.crossOrigin},this.onProcessComplete()},load:function(){this.src=a(this,this.loader.baseURL),this.state=n.FILE_LOADED,this.loader.nextFile(this,!0)}});o.register("video",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=i(56836),u=new s({Extends:r,initialize:function(t,e,i,s){var n="xml";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),s=a(o,"xhrSettings"),n=a(o,"extension",n)}var l={type:"xml",cache:t.cacheManager.xml,extension:n,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,l)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=l(this.xhrLoader.responseText),this.data?this.onProcessComplete():this.onProcessError()}});o.register("xml",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{t.exports={AnimationJSONFile:i(14135),AsepriteFile:i(76272),AtlasJSONFile:i(38734),AtlasXMLFile:i(74599),AudioFile:i(21097),AudioSpriteFile:i(89524),BinaryFile:i(85722),BitmapFontFile:i(97025),CompressedTextureFile:i(69559),CSSFile:i(16024),GLSLFile:i(47931),HTML5AudioFile:i(89749),HTMLFile:i(88470),HTMLTextureFile:i(14643),ImageFile:i(19550),JSONFile:i(518),MultiAtlasFile:i(59327),MultiScriptFile:i(99297),OBJFile:i(41846),PackFile:i(58610),PluginFile:i(48988),SceneFile:i(88423),ScenePluginFile:i(56812),ScriptFile:i(34328),SpriteSheetFile:i(85035),SVGFile:i(67397),TextFile:i(78776),TilemapCSVFile:i(49477),TilemapImpactFile:i(40807),TilemapJSONFile:i(56775),UnityAtlasFile:i(25771),VideoFile:i(33720),XMLFile:i(57318)}},57777:(t,e,i)=>{var s=i(23906),n=i(79291),r={Events:i(54899),FileTypes:i(64589),File:i(41299),FileTypesManager:i(74099),GetURL:i(98356),LoaderPlugin:i(74261),MergeXHRSettings:i(3374),MultiFile:i(26430),XHRLoader:i(84376),XHRSettings:i(92638)};r=n(!1,r,s),t.exports=r},53307:t=>{t.exports=function(t){for(var e=0,i=0;i{var s=i(6411);t.exports=function(t,e){return s(t)/s(e)/s(t-e)}},30976:t=>{t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},87842:t=>{t.exports=function(t,e,i,s,n){var r=.5*(s-e),o=.5*(n-i),a=t*t;return(2*i-2*s+r+o)*(t*a)+(-3*i+3*s-2*r-o)*a+r*t+i}},26302:t=>{t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var s=Math.pow(i,-e);return Math.ceil(t*s)/s}},45319:t=>{t.exports=function(t,e,i){return Math.max(e,Math.min(i,t))}},39506:(t,e,i)=>{var s=i(36383);t.exports=function(t){return t*s.DEG_TO_RAD}},61241:t=>{t.exports=function(t,e){return Math.abs(t-e)}},38857:(t,e,i)=>{var s=i(45319),n=i(83419),r=i(37867),o=i(29747),a=new r,h=new n({initialize:function t(e,i,s,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=t.DefaultOrder),this._x=e,this._y=i,this._z=s,this._order=n,this.onChangeCallback=o},x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback(this)}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback(this)}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback(this)}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback(this)}},set:function(t,e,i,s){return void 0===s&&(s=this._order),this._x=t,this._y=e,this._z=i,this._order=s,this.onChangeCallback(this),this},copy:function(t){return this.set(t.x,t.y,t.z,t.order)},setFromQuaternion:function(t,e,i){return void 0===e&&(e=this._order),void 0===i&&(i=!1),a.fromQuat(t),this.setFromRotationMatrix(a,e,i)},setFromRotationMatrix:function(t,e,i){void 0===e&&(e=this._order),void 0===i&&(i=!1);var n=t.val,r=n[0],o=n[4],a=n[8],h=n[1],l=n[5],u=n[9],c=n[2],d=n[6],f=n[10],p=0,v=0,g=0,m=.99999;switch(e){case"XYZ":v=Math.asin(s(a,-1,1)),Math.abs(a){t.exports=function(t){if(0===t)return 1;for(var e=t;--t;)e*=t;return e}},99472:t=>{t.exports=function(t,e){return Math.random()*(e-t)+t}},77623:t=>{t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var s=Math.pow(i,-e);return Math.floor(t*s)/s}},62945:(t,e,i)=>{var s=i(45319);t.exports=function(t,e,i){return(i-e)*(t=s(t,0,1))+e}},38265:t=>{t.exports=function(t,e){return t/e/1e3}},78702:t=>{t.exports=function(t){return t==parseFloat(t)?!(t%2):void 0}},94883:t=>{t.exports=function(t){return t===parseFloat(t)?!(t%2):void 0}},28915:t=>{t.exports=function(t,e,i){return(e-t)*i+t}},94908:t=>{t.exports=function(t,e,i){return void 0===i&&(i=0),t.clone().lerp(e,i)}},94434:(t,e,i)=>{var s=new(i(83419))({initialize:function(t){this.val=new Float32Array(9),t?this.copy(t):this.identity()},clone:function(){return new s(this)},set:function(t){return this.copy(t)},copy:function(t){var e=this.val,i=t.val;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},fromMat4:function(t){var e=t.val,i=this.val;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],this},fromArray:function(t){var e=this.val;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},identity:function(){var t=this.val;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this},transpose:function(){var t=this.val,e=t[1],i=t[2],s=t[5];return t[1]=t[3],t[2]=t[6],t[3]=e,t[5]=t[7],t[6]=i,t[7]=s,this},invert:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=l*r-o*h,c=-l*n+o*a,d=h*n-r*a,f=e*u+i*c+s*d;return f?(f=1/f,t[0]=u*f,t[1]=(-l*i+s*h)*f,t[2]=(o*i-s*r)*f,t[3]=c*f,t[4]=(l*e-s*a)*f,t[5]=(-o*e+s*n)*f,t[6]=d*f,t[7]=(-h*e+i*a)*f,t[8]=(r*e-i*n)*f,this):null},adjoint:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return t[0]=r*l-o*h,t[1]=s*h-i*l,t[2]=i*o-s*r,t[3]=o*a-n*l,t[4]=e*l-s*a,t[5]=s*n-e*o,t[6]=n*h-r*a,t[7]=i*a-e*h,t[8]=e*r-i*n,this},determinant:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return e*(l*r-o*h)+i*(-l*n+o*a)+s*(h*n-r*a)},multiply:function(t){var e=this.val,i=e[0],s=e[1],n=e[2],r=e[3],o=e[4],a=e[5],h=e[6],l=e[7],u=e[8],c=t.val,d=c[0],f=c[1],p=c[2],v=c[3],g=c[4],m=c[5],y=c[6],x=c[7],T=c[8];return e[0]=d*i+f*r+p*h,e[1]=d*s+f*o+p*l,e[2]=d*n+f*a+p*u,e[3]=v*i+g*r+m*h,e[4]=v*s+g*o+m*l,e[5]=v*n+g*a+m*u,e[6]=y*i+x*r+T*h,e[7]=y*s+x*o+T*l,e[8]=y*n+x*a+T*u,this},translate:function(t){var e=this.val,i=t.x,s=t.y;return e[6]=i*e[0]+s*e[3]+e[6],e[7]=i*e[1]+s*e[4]+e[7],e[8]=i*e[2]+s*e[5]+e[8],this},rotate:function(t){var e=this.val,i=e[0],s=e[1],n=e[2],r=e[3],o=e[4],a=e[5],h=Math.sin(t),l=Math.cos(t);return e[0]=l*i+h*r,e[1]=l*s+h*o,e[2]=l*n+h*a,e[3]=l*r-h*i,e[4]=l*o-h*s,e[5]=l*a-h*n,this},scale:function(t){var e=this.val,i=t.x,s=t.y;return e[0]=i*e[0],e[1]=i*e[1],e[2]=i*e[2],e[3]=s*e[3],e[4]=s*e[4],e[5]=s*e[5],this},fromQuat:function(t){var e=t.x,i=t.y,s=t.z,n=t.w,r=e+e,o=i+i,a=s+s,h=e*r,l=e*o,u=e*a,c=i*o,d=i*a,f=s*a,p=n*r,v=n*o,g=n*a,m=this.val;return m[0]=1-(c+f),m[3]=l+g,m[6]=u-v,m[1]=l-g,m[4]=1-(h+f),m[7]=d+p,m[2]=u+v,m[5]=d-p,m[8]=1-(h+c),this},normalFromMat4:function(t){var e=t.val,i=this.val,s=e[0],n=e[1],r=e[2],o=e[3],a=e[4],h=e[5],l=e[6],u=e[7],c=e[8],d=e[9],f=e[10],p=e[11],v=e[12],g=e[13],m=e[14],y=e[15],x=s*h-n*a,T=s*l-r*a,w=s*u-o*a,b=n*l-r*h,S=n*u-o*h,E=r*u-o*l,A=c*g-d*v,C=c*m-f*v,_=c*y-p*v,M=d*m-f*g,P=d*y-p*g,R=f*y-p*m,L=x*R-T*P+w*M+b*_-S*C+E*A;return L?(L=1/L,i[0]=(h*R-l*P+u*M)*L,i[1]=(l*_-a*R-u*C)*L,i[2]=(a*P-h*_+u*A)*L,i[3]=(r*P-n*R-o*M)*L,i[4]=(s*R-r*_+o*C)*L,i[5]=(n*_-s*P-o*A)*L,i[6]=(g*E-m*S+y*b)*L,i[7]=(m*w-v*E-y*T)*L,i[8]=(v*S-g*w+y*x)*L,this):null}});t.exports=s},37867:(t,e,i)=>{var s=i(83419),n=i(25836),r=1e-6,o=new s({initialize:function(t){this.val=new Float32Array(16),t?this.copy(t):this.identity()},clone:function(){return new o(this)},set:function(t){return this.copy(t)},setValues:function(t,e,i,s,n,r,o,a,h,l,u,c,d,f,p,v){var g=this.val;return g[0]=t,g[1]=e,g[2]=i,g[3]=s,g[4]=n,g[5]=r,g[6]=o,g[7]=a,g[8]=h,g[9]=l,g[10]=u,g[11]=c,g[12]=d,g[13]=f,g[14]=p,g[15]=v,this},copy:function(t){var e=t.val;return this.setValues(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},fromArray:function(t){return this.setValues(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},zero:function(){return this.setValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},transform:function(t,e,i){var s=a.fromQuat(i).val,n=e.x,r=e.y,o=e.z;return this.setValues(s[0]*n,s[1]*n,s[2]*n,0,s[4]*r,s[5]*r,s[6]*r,0,s[8]*o,s[9]*o,s[10]*o,0,t.x,t.y,t.z,1)},xyz:function(t,e,i){this.identity();var s=this.val;return s[12]=t,s[13]=e,s[14]=i,this},scaling:function(t,e,i){this.zero();var s=this.val;return s[0]=t,s[5]=e,s[10]=i,s[15]=1,this},identity:function(){return this.setValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},transpose:function(){var t=this.val,e=t[1],i=t[2],s=t[3],n=t[6],r=t[7],o=t[11];return t[1]=t[4],t[2]=t[8],t[3]=t[12],t[4]=e,t[6]=t[9],t[7]=t[13],t[8]=i,t[9]=n,t[11]=t[14],t[12]=s,t[13]=r,t[14]=o,this},getInverse:function(t){return this.copy(t),this.invert()},invert:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],v=t[14],g=t[15],m=e*o-i*r,y=e*a-s*r,x=e*h-n*r,T=i*a-s*o,w=i*h-n*o,b=s*h-n*a,S=l*p-u*f,E=l*v-c*f,A=l*g-d*f,C=u*v-c*p,_=u*g-d*p,M=c*g-d*v,P=m*M-y*_+x*C+T*A-w*E+b*S;return P?(P=1/P,this.setValues((o*M-a*_+h*C)*P,(s*_-i*M-n*C)*P,(p*b-v*w+g*T)*P,(c*w-u*b-d*T)*P,(a*A-r*M-h*E)*P,(e*M-s*A+n*E)*P,(v*x-f*b-g*y)*P,(l*b-c*x+d*y)*P,(r*_-o*A+h*S)*P,(i*A-e*_-n*S)*P,(f*w-p*x+g*m)*P,(u*x-l*w-d*m)*P,(o*E-r*C-a*S)*P,(e*C-i*E+s*S)*P,(p*y-f*T-v*m)*P,(l*T-u*y+c*m)*P)):this},adjoint:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],v=t[14],g=t[15];return this.setValues(o*(c*g-d*v)-u*(a*g-h*v)+p*(a*d-h*c),-(i*(c*g-d*v)-u*(s*g-n*v)+p*(s*d-n*c)),i*(a*g-h*v)-o*(s*g-n*v)+p*(s*h-n*a),-(i*(a*d-h*c)-o*(s*d-n*c)+u*(s*h-n*a)),-(r*(c*g-d*v)-l*(a*g-h*v)+f*(a*d-h*c)),e*(c*g-d*v)-l*(s*g-n*v)+f*(s*d-n*c),-(e*(a*g-h*v)-r*(s*g-n*v)+f*(s*h-n*a)),e*(a*d-h*c)-r*(s*d-n*c)+l*(s*h-n*a),r*(u*g-d*p)-l*(o*g-h*p)+f*(o*d-h*u),-(e*(u*g-d*p)-l*(i*g-n*p)+f*(i*d-n*u)),e*(o*g-h*p)-r*(i*g-n*p)+f*(i*h-n*o),-(e*(o*d-h*u)-r*(i*d-n*u)+l*(i*h-n*o)),-(r*(u*v-c*p)-l*(o*v-a*p)+f*(o*c-a*u)),e*(u*v-c*p)-l*(i*v-s*p)+f*(i*c-s*u),-(e*(o*v-a*p)-r*(i*v-s*p)+f*(i*a-s*o)),e*(o*c-a*u)-r*(i*c-s*u)+l*(i*a-s*o))},determinant:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],v=t[14],g=t[15];return(e*o-i*r)*(c*g-d*v)-(e*a-s*r)*(u*g-d*p)+(e*h-n*r)*(u*v-c*p)+(i*a-s*o)*(l*g-d*f)-(i*h-n*o)*(l*v-c*f)+(s*h-n*a)*(l*p-u*f)},multiply:function(t){var e=this.val,i=e[0],s=e[1],n=e[2],r=e[3],o=e[4],a=e[5],h=e[6],l=e[7],u=e[8],c=e[9],d=e[10],f=e[11],p=e[12],v=e[13],g=e[14],m=e[15],y=t.val,x=y[0],T=y[1],w=y[2],b=y[3];return e[0]=x*i+T*o+w*u+b*p,e[1]=x*s+T*a+w*c+b*v,e[2]=x*n+T*h+w*d+b*g,e[3]=x*r+T*l+w*f+b*m,x=y[4],T=y[5],w=y[6],b=y[7],e[4]=x*i+T*o+w*u+b*p,e[5]=x*s+T*a+w*c+b*v,e[6]=x*n+T*h+w*d+b*g,e[7]=x*r+T*l+w*f+b*m,x=y[8],T=y[9],w=y[10],b=y[11],e[8]=x*i+T*o+w*u+b*p,e[9]=x*s+T*a+w*c+b*v,e[10]=x*n+T*h+w*d+b*g,e[11]=x*r+T*l+w*f+b*m,x=y[12],T=y[13],w=y[14],b=y[15],e[12]=x*i+T*o+w*u+b*p,e[13]=x*s+T*a+w*c+b*v,e[14]=x*n+T*h+w*d+b*g,e[15]=x*r+T*l+w*f+b*m,this},multiplyLocal:function(t){var e=this.val,i=t.val;return this.setValues(e[0]*i[0]+e[1]*i[4]+e[2]*i[8]+e[3]*i[12],e[0]*i[1]+e[1]*i[5]+e[2]*i[9]+e[3]*i[13],e[0]*i[2]+e[1]*i[6]+e[2]*i[10]+e[3]*i[14],e[0]*i[3]+e[1]*i[7]+e[2]*i[11]+e[3]*i[15],e[4]*i[0]+e[5]*i[4]+e[6]*i[8]+e[7]*i[12],e[4]*i[1]+e[5]*i[5]+e[6]*i[9]+e[7]*i[13],e[4]*i[2]+e[5]*i[6]+e[6]*i[10]+e[7]*i[14],e[4]*i[3]+e[5]*i[7]+e[6]*i[11]+e[7]*i[15],e[8]*i[0]+e[9]*i[4]+e[10]*i[8]+e[11]*i[12],e[8]*i[1]+e[9]*i[5]+e[10]*i[9]+e[11]*i[13],e[8]*i[2]+e[9]*i[6]+e[10]*i[10]+e[11]*i[14],e[8]*i[3]+e[9]*i[7]+e[10]*i[11]+e[11]*i[15],e[12]*i[0]+e[13]*i[4]+e[14]*i[8]+e[15]*i[12],e[12]*i[1]+e[13]*i[5]+e[14]*i[9]+e[15]*i[13],e[12]*i[2]+e[13]*i[6]+e[14]*i[10]+e[15]*i[14],e[12]*i[3]+e[13]*i[7]+e[14]*i[11]+e[15]*i[15])},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.val,s=e.val,n=i[0],r=i[4],o=i[8],a=i[12],h=i[1],l=i[5],u=i[9],c=i[13],d=i[2],f=i[6],p=i[10],v=i[14],g=i[3],m=i[7],y=i[11],x=i[15],T=s[0],w=s[4],b=s[8],S=s[12],E=s[1],A=s[5],C=s[9],_=s[13],M=s[2],P=s[6],R=s[10],L=s[14],O=s[3],F=s[7],D=s[11],k=s[15];return this.setValues(n*T+r*E+o*M+a*O,h*T+l*E+u*M+c*O,d*T+f*E+p*M+v*O,g*T+m*E+y*M+x*O,n*w+r*A+o*P+a*F,h*w+l*A+u*P+c*F,d*w+f*A+p*P+v*F,g*w+m*A+y*P+x*F,n*b+r*C+o*R+a*D,h*b+l*C+u*R+c*D,d*b+f*C+p*R+v*D,g*b+m*C+y*R+x*D,n*S+r*_+o*L+a*k,h*S+l*_+u*L+c*k,d*S+f*_+p*L+v*k,g*S+m*_+y*L+x*k)},translate:function(t){return this.translateXYZ(t.x,t.y,t.z)},translateXYZ:function(t,e,i){var s=this.val;return s[12]=s[0]*t+s[4]*e+s[8]*i+s[12],s[13]=s[1]*t+s[5]*e+s[9]*i+s[13],s[14]=s[2]*t+s[6]*e+s[10]*i+s[14],s[15]=s[3]*t+s[7]*e+s[11]*i+s[15],this},scale:function(t){return this.scaleXYZ(t.x,t.y,t.z)},scaleXYZ:function(t,e,i){var s=this.val;return s[0]=s[0]*t,s[1]=s[1]*t,s[2]=s[2]*t,s[3]=s[3]*t,s[4]=s[4]*e,s[5]=s[5]*e,s[6]=s[6]*e,s[7]=s[7]*e,s[8]=s[8]*i,s[9]=s[9]*i,s[10]=s[10]*i,s[11]=s[11]*i,this},makeRotationAxis:function(t,e){var i=Math.cos(e),s=Math.sin(e),n=1-i,r=t.x,o=t.y,a=t.z,h=n*r,l=n*o;return this.setValues(h*r+i,h*o-s*a,h*a+s*o,0,h*o+s*a,l*o+i,l*a-s*r,0,h*a-s*o,l*a+s*r,n*a*a+i,0,0,0,0,1)},rotate:function(t,e){var i=this.val,s=e.x,n=e.y,o=e.z,a=Math.sqrt(s*s+n*n+o*o);if(Math.abs(a){t.exports=function(t,e,i){return Math.min(t+e,i)}},50040:t=>{t.exports=function(t){var e=t.length;if(0===e)return 0;t.sort((function(t,e){return t-e}));var i=Math.floor(e/2);return e%2==0?(t[i]+t[i-1])/2:t[i]}},37204:t=>{t.exports=function(t,e,i){return Math.max(t-e,i)}},65201:t=>{t.exports=function(t,e,i,s){void 0===i&&(i=e+1);var n=(t-e)/(i-e);return n>1?void 0!==s?(n=(s-t)/(s-i))<0&&(n=0):n=1:n<0&&(n=0),n}},15746:(t,e,i)=>{var s=i(83419),n=i(94434),r=i(29747),o=i(25836),a=1e-6,h=new Int8Array([1,2,0]),l=new Float32Array([0,0,0]),u=new o(1,0,0),c=new o(0,1,0),d=new o,f=new n,p=new s({initialize:function(t,e,i,s){this.onChangeCallback=r,this.set(t,e,i,s)},x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback(this)}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback(this)}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback(this)}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback(this)}},copy:function(t){return this.set(t)},set:function(t,e,i,s,n){return void 0===n&&(n=!0),"object"==typeof t?(this._x=t.x||0,this._y=t.y||0,this._z=t.z||0,this._w=t.w||0):(this._x=t||0,this._y=e||0,this._z=i||0,this._w=s||0),n&&this.onChangeCallback(this),this},add:function(t){return this._x+=t.x,this._y+=t.y,this._z+=t.z,this._w+=t.w,this.onChangeCallback(this),this},subtract:function(t){return this._x-=t.x,this._y-=t.y,this._z-=t.z,this._w-=t.w,this.onChangeCallback(this),this},scale:function(t){return this._x*=t,this._y*=t,this._z*=t,this._w*=t,this.onChangeCallback(this),this},length:function(){var t=this.x,e=this.y,i=this.z,s=this.w;return Math.sqrt(t*t+e*e+i*i+s*s)},lengthSq:function(){var t=this.x,e=this.y,i=this.z,s=this.w;return t*t+e*e+i*i+s*s},normalize:function(){var t=this.x,e=this.y,i=this.z,s=this.w,n=t*t+e*e+i*i+s*s;return n>0&&(n=1/Math.sqrt(n),this._x=t*n,this._y=e*n,this._z=i*n,this._w=s*n),this.onChangeCallback(this),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,s=this.y,n=this.z,r=this.w;return this.set(i+e*(t.x-i),s+e*(t.y-s),n+e*(t.z-n),r+e*(t.w-r))},rotationTo:function(t,e){var i=t.x*e.x+t.y*e.y+t.z*e.z;return i<-.999999?(d.copy(u).cross(t).length().999999?this.set(0,0,0,1):(d.copy(t).cross(e),this._x=d.x,this._y=d.y,this._z=d.z,this._w=1+i,this.normalize())},setAxes:function(t,e,i){var s=f.val;return s[0]=e.x,s[3]=e.y,s[6]=e.z,s[1]=i.x,s[4]=i.y,s[7]=i.z,s[2]=-t.x,s[5]=-t.y,s[8]=-t.z,this.fromMat3(f).normalize()},identity:function(){return this.set(0,0,0,1)},setAxisAngle:function(t,e){e*=.5;var i=Math.sin(e);return this.set(i*t.x,i*t.y,i*t.z,Math.cos(e))},multiply:function(t){var e=this.x,i=this.y,s=this.z,n=this.w,r=t.x,o=t.y,a=t.z,h=t.w;return this.set(e*h+n*r+i*a-s*o,i*h+n*o+s*r-e*a,s*h+n*a+e*o-i*r,n*h-e*r-i*o-s*a)},slerp:function(t,e){var i=this.x,s=this.y,n=this.z,r=this.w,o=t.x,h=t.y,l=t.z,u=t.w,c=i*o+s*h+n*l+r*u;c<0&&(c=-c,o=-o,h=-h,l=-l,u=-u);var d=1-e,f=e;if(1-c>a){var p=Math.acos(c),v=Math.sin(p);d=Math.sin((1-e)*p)/v,f=Math.sin(e*p)/v}return this.set(d*i+f*o,d*s+f*h,d*n+f*l,d*r+f*u)},invert:function(){var t=this.x,e=this.y,i=this.z,s=this.w,n=t*t+e*e+i*i+s*s,r=n?1/n:0;return this.set(-t*r,-e*r,-i*r,s*r)},conjugate:function(){return this._x=-this.x,this._y=-this.y,this._z=-this.z,this.onChangeCallback(this),this},rotateX:function(t){t*=.5;var e=this.x,i=this.y,s=this.z,n=this.w,r=Math.sin(t),o=Math.cos(t);return this.set(e*o+n*r,i*o+s*r,s*o-i*r,n*o-e*r)},rotateY:function(t){t*=.5;var e=this.x,i=this.y,s=this.z,n=this.w,r=Math.sin(t),o=Math.cos(t);return this.set(e*o-s*r,i*o+n*r,s*o+e*r,n*o-i*r)},rotateZ:function(t){t*=.5;var e=this.x,i=this.y,s=this.z,n=this.w,r=Math.sin(t),o=Math.cos(t);return this.set(e*o+i*r,i*o-e*r,s*o+n*r,n*o-s*r)},calculateW:function(){var t=this.x,e=this.y,i=this.z;return this.w=-Math.sqrt(1-t*t-e*e-i*i),this},setFromEuler:function(t,e){var i=t.x/2,s=t.y/2,n=t.z/2,r=Math.cos(i),o=Math.cos(s),a=Math.cos(n),h=Math.sin(i),l=Math.sin(s),u=Math.sin(n);switch(t.order){case"XYZ":this.set(h*o*a+r*l*u,r*l*a-h*o*u,r*o*u+h*l*a,r*o*a-h*l*u,e);break;case"YXZ":this.set(h*o*a+r*l*u,r*l*a-h*o*u,r*o*u-h*l*a,r*o*a+h*l*u,e);break;case"ZXY":this.set(h*o*a-r*l*u,r*l*a+h*o*u,r*o*u+h*l*a,r*o*a-h*l*u,e);break;case"ZYX":this.set(h*o*a-r*l*u,r*l*a+h*o*u,r*o*u-h*l*a,r*o*a+h*l*u,e);break;case"YZX":this.set(h*o*a+r*l*u,r*l*a+h*o*u,r*o*u-h*l*a,r*o*a-h*l*u,e);break;case"XZY":this.set(h*o*a-r*l*u,r*l*a-h*o*u,r*o*u+h*l*a,r*o*a+h*l*u,e)}return this},setFromRotationMatrix:function(t){var e,i=t.val,s=i[0],n=i[4],r=i[8],o=i[1],a=i[5],h=i[9],l=i[2],u=i[6],c=i[10],d=s+a+c;return d>0?(e=.5/Math.sqrt(d+1),this.set((u-h)*e,(r-l)*e,(o-n)*e,.25/e)):s>a&&s>c?(e=2*Math.sqrt(1+s-a-c),this.set(.25*e,(n+o)/e,(r+l)/e,(u-h)/e)):a>c?(e=2*Math.sqrt(1+a-s-c),this.set((n+o)/e,.25*e,(h+u)/e,(r-l)/e)):(e=2*Math.sqrt(1+c-s-a),this.set((r+l)/e,(h+u)/e,.25*e,(o-n)/e)),this},fromMat3:function(t){var e,i=t.val,s=i[0]+i[4]+i[8];if(s>0)e=Math.sqrt(s+1),this.w=.5*e,e=.5/e,this._x=(i[7]-i[5])*e,this._y=(i[2]-i[6])*e,this._z=(i[3]-i[1])*e;else{var n=0;i[4]>i[0]&&(n=1),i[8]>i[3*n+n]&&(n=2);var r=h[n],o=h[r];e=Math.sqrt(i[3*n+n]-i[3*r+r]-i[3*o+o]+1),l[n]=.5*e,e=.5/e,l[r]=(i[3*r+n]+i[3*n+r])*e,l[o]=(i[3*o+n]+i[3*n+o])*e,this._x=l[0],this._y=l[1],this._z=l[2],this._w=(i[3*o+r]-i[3*r+o])*e}return this.onChangeCallback(this),this}});t.exports=p},43396:(t,e,i)=>{var s=i(36383);t.exports=function(t){return t*s.RAD_TO_DEG}},74362:t=>{t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t}},60706:t=>{t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI,s=2*Math.random()-1,n=Math.sqrt(1-s*s)*e;return t.x=Math.cos(i)*n,t.y=Math.sin(i)*n,t.z=s*e,t}},67421:t=>{t.exports=function(t,e){return void 0===e&&(e=1),t.x=(2*Math.random()-1)*e,t.y=(2*Math.random()-1)*e,t.z=(2*Math.random()-1)*e,t.w=(2*Math.random()-1)*e,t}},36305:t=>{t.exports=function(t,e){var i=t.x,s=t.y;return t.x=i*Math.cos(e)-s*Math.sin(e),t.y=i*Math.sin(e)+s*Math.cos(e),t}},11520:t=>{t.exports=function(t,e,i,s){var n=Math.cos(s),r=Math.sin(s),o=t.x-e,a=t.y-i;return t.x=o*n-a*r+e,t.y=o*r+a*n+i,t}},1163:t=>{t.exports=function(t,e,i,s,n){var r=s+Math.atan2(t.y-i,t.x-e);return t.x=e+n*Math.cos(r),t.y=i+n*Math.sin(r),t}},70336:t=>{t.exports=function(t,e,i,s,n){return t.x=e+n*Math.cos(s),t.y=i+n*Math.sin(s),t}},72678:(t,e,i)=>{var s=i(25836),n=i(37867),r=i(15746),o=new n,a=new r,h=new s;t.exports=function(t,e,i){return a.setAxisAngle(e,i),o.fromRotationTranslation(a,h.set(0,0,0)),t.transformMat4(o)}},2284:t=>{t.exports=function(t){return t>0?Math.ceil(t):Math.floor(t)}},41013:t=>{t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var s=Math.pow(i,-e);return Math.round(t*s)/s}},16922:t=>{t.exports=function(t,e,i,s){void 0===e&&(e=1),void 0===i&&(i=1),void 0===s&&(s=1),s*=Math.PI/t;for(var n=[],r=[],o=0;o{t.exports=function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}},54261:t=>{t.exports=function(t,e,i){return(t=Math.max(0,Math.min(1,(t-e)/(i-e))))*t*t*(t*(6*t-15)+10)}},44408:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n){void 0===n&&(n=new s);var r=0,o=0;return t>0&&t<=e*i&&(r=t>e-1?t-(o=Math.floor(t/e))*e:t),n.set(r,o)}},85955:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r,o,a,h){void 0===h&&(h=new s);var l=Math.sin(r),u=Math.cos(r),c=u*o,d=l*o,f=-l*a,p=u*a,v=1/(c*p+f*-d);return h.x=p*v*t+-f*v*e+(n*f-i*p)*v,h.y=c*v*e+-d*v*t+(-n*c+i*d)*v,h}},26099:(t,e,i)=>{var s=i(83419),n=i(43855),r=new s({initialize:function(t,e){this.x=0,this.y=0,"object"==typeof t?(this.x=t.x||0,this.y=t.y||0):(void 0===e&&(e=t),this.x=t||0,this.y=e||0)},clone:function(){return new r(this.x,this.y)},copy:function(t){return this.x=t.x||0,this.y=t.y||0,this},setFromObject:function(t){return this.x=t.x||0,this.y=t.y||0,this},set:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setTo:function(t,e){return this.set(t,e)},setToPolar:function(t,e){return null==e&&(e=1),this.x=Math.cos(t)*e,this.y=Math.sin(t)*e,this},equals:function(t){return this.x===t.x&&this.y===t.y},fuzzyEquals:function(t,e){return n(this.x,t.x,e)&&n(this.y,t.y,e)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},setAngle:function(t){return this.setToPolar(t,this.length())},add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},scale:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},negate:function(){return this.x=-this.x,this.y=-this.y,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},length:function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},setLength:function(t){return this.normalize().scale(t)},lengthSq:function(){var t=this.x,e=this.y;return t*t+e*e},normalize:function(){var t=this.x,e=this.y,i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i),this.x=t*i,this.y=e*i),this},normalizeRightHand:function(){var t=this.x;return this.x=-1*this.y,this.y=t,this},normalizeLeftHand:function(){var t=this.x;return this.x=this.y,this.y=-1*t,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,s=this.y;return this.x=i+e*(t.x-i),this.y=s+e*(t.y-s),this},transformMat3:function(t){var e=this.x,i=this.y,s=t.val;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this},transformMat4:function(t){var e=this.x,i=this.y,s=t.val;return this.x=s[0]*e+s[4]*i+s[12],this.y=s[1]*e+s[5]*i+s[13],this},reset:function(){return this.x=0,this.y=0,this},limit:function(t){var e=this.length();return e&&e>t&&this.scale(t/e),this},reflect:function(t){return t=t.clone().normalize(),this.subtract(t.scale(2*this.dot(t)))},mirror:function(t){return this.reflect(t).negate()},rotate:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e*this.x-i*this.y,i*this.x+e*this.y)},project:function(t){var e=this.dot(t)/t.dot(t);return this.copy(t).scale(e)}});r.ZERO=new r,r.RIGHT=new r(1,0),r.LEFT=new r(-1,0),r.UP=new r(0,-1),r.DOWN=new r(0,1),r.ONE=new r(1,1),t.exports=r},25836:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i){this.x=0,this.y=0,this.z=0,"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0)},up:function(){return this.x=0,this.y=1,this.z=0,this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clone:function(){return new s(this.x,this.y,this.z)},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},crossVectors:function(t,e){var i=t.x,s=t.y,n=t.z,r=e.x,o=e.y,a=e.z;return this.x=s*a-n*o,this.y=n*r-i*a,this.z=i*o-s*r,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},set:function(t,e,i){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0),this},setFromMatrixPosition:function(t){return this.fromArray(t.val,12)},setFromMatrixColumn:function(t,e){return this.fromArray(t.val,4*e)},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addScale:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this},scale:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,s=t.z-this.z||0;return Math.sqrt(e*e+i*i+s*s)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,s=t.z-this.z||0;return e*e+i*i+s*s},length:function(){var t=this.x,e=this.y,i=this.z;return Math.sqrt(t*t+e*e+i*i)},lengthSq:function(){var t=this.x,e=this.y,i=this.z;return t*t+e*e+i*i},normalize:function(){var t=this.x,e=this.y,i=this.z,s=t*t+e*e+i*i;return s>0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},cross:function(t){var e=this.x,i=this.y,s=this.z,n=t.x,r=t.y,o=t.z;return this.x=i*o-s*r,this.y=s*n-e*o,this.z=e*r-i*n,this},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,s=this.y,n=this.z;return this.x=i+e*(t.x-i),this.y=s+e*(t.y-s),this.z=n+e*(t.z-n),this},applyMatrix3:function(t){var e=this.x,i=this.y,s=this.z,n=t.val;return this.x=n[0]*e+n[3]*i+n[6]*s,this.y=n[1]*e+n[4]*i+n[7]*s,this.z=n[2]*e+n[5]*i+n[8]*s,this},applyMatrix4:function(t){var e=this.x,i=this.y,s=this.z,n=t.val,r=1/(n[3]*e+n[7]*i+n[11]*s+n[15]);return this.x=(n[0]*e+n[4]*i+n[8]*s+n[12])*r,this.y=(n[1]*e+n[5]*i+n[9]*s+n[13])*r,this.z=(n[2]*e+n[6]*i+n[10]*s+n[14])*r,this},transformMat3:function(t){var e=this.x,i=this.y,s=this.z,n=t.val;return this.x=e*n[0]+i*n[3]+s*n[6],this.y=e*n[1]+i*n[4]+s*n[7],this.z=e*n[2]+i*n[5]+s*n[8],this},transformMat4:function(t){var e=this.x,i=this.y,s=this.z,n=t.val;return this.x=n[0]*e+n[4]*i+n[8]*s+n[12],this.y=n[1]*e+n[5]*i+n[9]*s+n[13],this.z=n[2]*e+n[6]*i+n[10]*s+n[14],this},transformCoordinates:function(t){var e=this.x,i=this.y,s=this.z,n=t.val,r=e*n[0]+i*n[4]+s*n[8]+n[12],o=e*n[1]+i*n[5]+s*n[9]+n[13],a=e*n[2]+i*n[6]+s*n[10]+n[14],h=e*n[3]+i*n[7]+s*n[11]+n[15];return this.x=r/h,this.y=o/h,this.z=a/h,this},transformQuat:function(t){var e=this.x,i=this.y,s=this.z,n=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*s-o*i,l=a*i+o*e-n*s,u=a*s+n*i-r*e,c=-n*e-r*i-o*s;return this.x=h*a+c*-n+l*-o-u*-r,this.y=l*a+c*-r+u*-n-h*-o,this.z=u*a+c*-o+h*-r-l*-n,this},project:function(t){var e=this.x,i=this.y,s=this.z,n=t.val,r=n[0],o=n[1],a=n[2],h=n[3],l=n[4],u=n[5],c=n[6],d=n[7],f=n[8],p=n[9],v=n[10],g=n[11],m=n[12],y=n[13],x=n[14],T=1/(e*h+i*d+s*g+n[15]);return this.x=(e*r+i*l+s*f+m)*T,this.y=(e*o+i*u+s*p+y)*T,this.z=(e*a+i*c+s*v+x)*T,this},projectViewMatrix:function(t,e){return this.applyMatrix4(t).applyMatrix4(e)},unprojectViewMatrix:function(t,e){return this.applyMatrix4(t).applyMatrix4(e)},unproject:function(t,e){var i=t.x,s=t.y,n=t.z,r=t.w,o=this.x-i,a=r-this.y-1-s,h=this.z;return this.x=2*o/n-1,this.y=2*a/r-1,this.z=2*h-1,this.project(e)},reset:function(){return this.x=0,this.y=0,this.z=0,this}});s.ZERO=new s,s.RIGHT=new s(1,0,0),s.LEFT=new s(-1,0,0),s.UP=new s(0,-1,0),s.DOWN=new s(0,1,0),s.FORWARD=new s(0,0,1),s.BACK=new s(0,0,-1),s.ONE=new s(1,1,1),t.exports=s},61369:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s){this.x=0,this.y=0,this.z=0,this.w=0,"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=s||0)},clone:function(){return new s(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this.w=t.w||0,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},set:function(t,e,i,s){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=s||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this.w+=t.w||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this.w-=t.w||0,this},scale:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},length:function(){var t=this.x,e=this.y,i=this.z,s=this.w;return Math.sqrt(t*t+e*e+i*i+s*s)},lengthSq:function(){var t=this.x,e=this.y,i=this.z,s=this.w;return t*t+e*e+i*i+s*s},normalize:function(){var t=this.x,e=this.y,i=this.z,s=this.w,n=t*t+e*e+i*i+s*s;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n,this.w=s*n),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,s=this.y,n=this.z,r=this.w;return this.x=i+e*(t.x-i),this.y=s+e*(t.y-s),this.z=n+e*(t.z-n),this.w=r+e*(t.w-r),this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this.w*=t.w||1,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this.w/=t.w||1,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,s=t.z-this.z||0,n=t.w-this.w||0;return Math.sqrt(e*e+i*i+s*s+n*n)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,s=t.z-this.z||0,n=t.w-this.w||0;return e*e+i*i+s*s+n*n},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},transformMat4:function(t){var e=this.x,i=this.y,s=this.z,n=this.w,r=t.val;return this.x=r[0]*e+r[4]*i+r[8]*s+r[12]*n,this.y=r[1]*e+r[5]*i+r[9]*s+r[13]*n,this.z=r[2]*e+r[6]*i+r[10]*s+r[14]*n,this.w=r[3]*e+r[7]*i+r[11]*s+r[15]*n,this},transformQuat:function(t){var e=this.x,i=this.y,s=this.z,n=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*s-o*i,l=a*i+o*e-n*s,u=a*s+n*i-r*e,c=-n*e-r*i-o*s;return this.x=h*a+c*-n+l*-o-u*-r,this.y=l*a+c*-r+u*-n-h*-o,this.z=u*a+c*-o+h*-r-l*-n,this},reset:function(){return this.x=0,this.y=0,this.z=0,this.w=0,this}});s.prototype.sub=s.prototype.subtract,s.prototype.mul=s.prototype.multiply,s.prototype.div=s.prototype.divide,s.prototype.dist=s.prototype.distance,s.prototype.distSq=s.prototype.distanceSq,s.prototype.len=s.prototype.length,s.prototype.lenSq=s.prototype.lengthSq,t.exports=s},60417:t=>{t.exports=function(t,e,i){return Math.abs(t-e)<=i}},15994:t=>{t.exports=function(t,e,i){var s=i-e;return e+((t-e)%s+s)%s}},31040:t=>{t.exports=function(t,e,i,s){return Math.atan2(s-e,i-t)}},55495:t=>{t.exports=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}},128:t=>{t.exports=function(t,e){return Math.atan2(e.x-t.x,e.y-t.y)}},41273:t=>{t.exports=function(t,e,i,s){return Math.atan2(i-t,s-e)}},1432:(t,e,i)=>{var s=i(36383);t.exports=function(t){return t>Math.PI&&(t-=s.PI2),Math.abs(((t+s.TAU)%s.PI2-s.PI2)%s.PI2)}},12407:t=>{t.exports=function(t){return(t%=2*Math.PI)>=0?t:t+2*Math.PI}},53993:(t,e,i)=>{var s=i(99472);t.exports=function(){return s(-Math.PI,Math.PI)}},86564:(t,e,i)=>{var s=i(99472);t.exports=function(){return s(-180,180)}},90154:(t,e,i)=>{var s=i(12407);t.exports=function(t){return s(t+Math.PI)}},48736:(t,e,i)=>{var s=i(36383);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e||(Math.abs(e-t)<=i||Math.abs(e-t)>=s.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e{t.exports=function(t,e){var i=e-t;return 0===i?0:i-360*Math.floor((i- -180)/360)}},86554:(t,e,i)=>{var s=i(15994);t.exports=function(t){return s(t,-Math.PI,Math.PI)}},30954:(t,e,i)=>{var s=i(15994);t.exports=function(t){return s(t,-180,180)}},25588:(t,e,i)=>{t.exports={Between:i(31040),BetweenPoints:i(55495),BetweenPointsY:i(128),BetweenY:i(41273),CounterClockwise:i(1432),Normalize:i(12407),Random:i(53993),RandomDegrees:i(86564),Reverse:i(90154),RotateTo:i(48736),ShortestBetween:i(61430),Wrap:i(86554),WrapDegrees:i(30954)}},36383:t=>{var e={PI2:2*Math.PI,TAU:.5*Math.PI,EPSILON:1e-6,DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,RND:null,MIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER||-9007199254740991,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991};t.exports=e},20339:t=>{t.exports=function(t,e,i,s){var n=t-i,r=e-s;return Math.sqrt(n*n+r*r)}},52816:t=>{t.exports=function(t,e){var i=t.x-e.x,s=t.y-e.y;return Math.sqrt(i*i+s*s)}},64559:t=>{t.exports=function(t,e){var i=t.x-e.x,s=t.y-e.y;return i*i+s*s}},82340:t=>{t.exports=function(t,e,i,s){return Math.max(Math.abs(t-i),Math.abs(e-s))}},14390:t=>{t.exports=function(t,e,i,s,n){return void 0===n&&(n=2),Math.sqrt(Math.pow(i-t,n)+Math.pow(s-e,n))}},2243:t=>{t.exports=function(t,e,i,s){return Math.abs(t-i)+Math.abs(e-s)}},89774:t=>{t.exports=function(t,e,i,s){var n=t-i,r=e-s;return n*n+r*r}},50994:(t,e,i)=>{t.exports={Between:i(20339),BetweenPoints:i(52816),BetweenPointsSquared:i(64559),Chebyshev:i(82340),Power:i(14390),Snake:i(2243),Squared:i(89774)}},62640:(t,e,i)=>{var s=i(54178),n=i(41521),r=i(79980),o=i(85433),a=i(99140),h=i(48857),l=i(81596),u=i(59133),c=i(98516),d=i(35248),f=i(82500),p=i(49752);t.exports={Power0:l,Power1:u.Out,Power2:o.Out,Power3:c.Out,Power4:d.Out,Linear:l,Quad:u.Out,Cubic:o.Out,Quart:c.Out,Quint:d.Out,Sine:f.Out,Expo:h.Out,Circ:r.Out,Elastic:a.Out,Back:s.Out,Bounce:n.Out,Stepped:p,"Quad.easeIn":u.In,"Cubic.easeIn":o.In,"Quart.easeIn":c.In,"Quint.easeIn":d.In,"Sine.easeIn":f.In,"Expo.easeIn":h.In,"Circ.easeIn":r.In,"Elastic.easeIn":a.In,"Back.easeIn":s.In,"Bounce.easeIn":n.In,"Quad.easeOut":u.Out,"Cubic.easeOut":o.Out,"Quart.easeOut":c.Out,"Quint.easeOut":d.Out,"Sine.easeOut":f.Out,"Expo.easeOut":h.Out,"Circ.easeOut":r.Out,"Elastic.easeOut":a.Out,"Back.easeOut":s.Out,"Bounce.easeOut":n.Out,"Quad.easeInOut":u.InOut,"Cubic.easeInOut":o.InOut,"Quart.easeInOut":c.InOut,"Quint.easeInOut":d.InOut,"Sine.easeInOut":f.InOut,"Expo.easeInOut":h.InOut,"Circ.easeInOut":r.InOut,"Elastic.easeInOut":a.InOut,"Back.easeInOut":s.InOut,"Bounce.easeInOut":n.InOut}},1639:t=>{t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},50099:t=>{t.exports=function(t,e){void 0===e&&(e=1.70158);var i=1.525*e;return(t*=2)<1?t*t*((i+1)*t-i)*.5:.5*((t-=2)*t*((i+1)*t+i)+2)}},41286:t=>{t.exports=function(t,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},54178:(t,e,i)=>{t.exports={In:i(1639),Out:i(41286),InOut:i(50099)}},59590:t=>{t.exports=function(t){return(t=1-t)<1/2.75?1-7.5625*t*t:t<2/2.75?1-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}},41788:t=>{t.exports=function(t){var e=!1;return t<.5?(t=1-2*t,e=!0):t=2*t-1,t<1/2.75?t*=7.5625*t:t=t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5}},69905:t=>{t.exports=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}},41521:(t,e,i)=>{t.exports={In:i(59590),Out:i(69905),InOut:i(41788)}},91861:t=>{t.exports=function(t){return 1-Math.sqrt(1-t*t)}},4177:t=>{t.exports=function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},57512:t=>{t.exports=function(t){return Math.sqrt(1- --t*t)}},79980:(t,e,i)=>{t.exports={In:i(91861),Out:i(57512),InOut:i(4177)}},51150:t=>{t.exports=function(t){return t*t*t}},82820:t=>{t.exports=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},35033:t=>{t.exports=function(t){return--t*t*t+1}},85433:(t,e,i)=>{t.exports={In:i(51150),Out:i(35033),InOut:i(82820)}},69965:t=>{t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var s=i/4;return e<1?e=1:s=i*Math.asin(1/e)/(2*Math.PI),-e*Math.pow(2,10*(t-=1))*Math.sin((t-s)*(2*Math.PI)/i)}},50665:t=>{t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var s=i/4;return e<1?e=1:s=i*Math.asin(1/e)/(2*Math.PI),(t*=2)<1?e*Math.pow(2,10*(t-=1))*Math.sin((t-s)*(2*Math.PI)/i)*-.5:e*Math.pow(2,-10*(t-=1))*Math.sin((t-s)*(2*Math.PI)/i)*.5+1}},7744:t=>{t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var s=i/4;return e<1?e=1:s=i*Math.asin(1/e)/(2*Math.PI),e*Math.pow(2,-10*t)*Math.sin((t-s)*(2*Math.PI)/i)+1}},99140:(t,e,i)=>{t.exports={In:i(69965),Out:i(7744),InOut:i(50665)}},24590:t=>{t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},87844:t=>{t.exports=function(t){return(t*=2)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))}},89433:t=>{t.exports=function(t){return 1-Math.pow(2,-10*t)}},48857:(t,e,i)=>{t.exports={In:i(24590),Out:i(89433),InOut:i(87844)}},48820:(t,e,i)=>{t.exports={Back:i(54178),Bounce:i(41521),Circular:i(79980),Cubic:i(85433),Elastic:i(99140),Expo:i(48857),Linear:i(81596),Quadratic:i(59133),Quartic:i(98516),Quintic:i(35248),Sine:i(82500),Stepped:i(49752)}},7147:t=>{t.exports=function(t){return t}},81596:(t,e,i)=>{t.exports=i(7147)},34826:t=>{t.exports=function(t){return t*t}},20544:t=>{t.exports=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},92029:t=>{t.exports=function(t){return t*(2-t)}},59133:(t,e,i)=>{t.exports={In:i(34826),Out:i(92029),InOut:i(20544)}},64413:t=>{t.exports=function(t){return t*t*t*t}},78137:t=>{t.exports=function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},45840:t=>{t.exports=function(t){return 1- --t*t*t*t}},98516:(t,e,i)=>{t.exports={In:i(64413),Out:i(45840),InOut:i(78137)}},87745:t=>{t.exports=function(t){return t*t*t*t*t}},16509:t=>{t.exports=function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},17868:t=>{t.exports=function(t){return--t*t*t*t*t+1}},35248:(t,e,i)=>{t.exports={In:i(87745),Out:i(17868),InOut:i(16509)}},80461:t=>{t.exports=function(t){return 0===t?0:1===t?1:1-Math.cos(t*Math.PI/2)}},34025:t=>{t.exports=function(t){return 0===t?0:1===t?1:.5*(1-Math.cos(Math.PI*t))}},52768:t=>{t.exports=function(t){return 0===t?0:1===t?1:Math.sin(t*Math.PI/2)}},82500:(t,e,i)=>{t.exports={In:i(80461),Out:i(52768),InOut:i(34025)}},72251:t=>{t.exports=function(t,e){return void 0===e&&(e=1),t<=0?0:t>=1?1:1/e*(1+(e*t|0))}},49752:(t,e,i)=>{t.exports=i(72251)},75698:t=>{t.exports=function(t,e){return void 0===e&&(e=1e-4),Math.ceil(t-e)}},43855:t=>{t.exports=function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e){t.exports=function(t,e){return void 0===e&&(e=1e-4),Math.floor(t+e)}},5470:t=>{t.exports=function(t,e,i){return void 0===i&&(i=1e-4),t>e-i}},94977:t=>{t.exports=function(t,e,i){return void 0===i&&(i=1e-4),t{t.exports={Ceil:i(75698),Equal:i(43855),Floor:i(25777),GreaterThan:i(5470),LessThan:i(94977)}},75508:(t,e,i)=>{var s=i(36383),n=i(79291),r={Angle:i(25588),Distance:i(50994),Easing:i(48820),Fuzzy:i(48379),Interpolation:i(38289),Pow2:i(49001),Snap:i(73697),RandomDataGenerator:i(28453),Average:i(53307),Bernstein:i(85710),Between:i(30976),CatmullRom:i(87842),CeilTo:i(26302),Clamp:i(45319),DegToRad:i(39506),Difference:i(61241),Euler:i(38857),Factorial:i(6411),FloatBetween:i(99472),FloorTo:i(77623),FromPercent:i(62945),GetSpeed:i(38265),IsEven:i(78702),IsEvenStrict:i(94883),Linear:i(28915),LinearXY:i(94908),MaxAdd:i(86883),Median:i(50040),MinSub:i(37204),Percent:i(65201),RadToDeg:i(43396),RandomXY:i(74362),RandomXYZ:i(60706),RandomXYZW:i(67421),Rotate:i(36305),RotateAround:i(11520),RotateAroundDistance:i(1163),RotateTo:i(70336),RoundAwayFromZero:i(2284),RoundTo:i(41013),SinCosTableGenerator:i(16922),SmootherStep:i(54261),SmoothStep:i(7602),ToXY:i(44408),TransformXY:i(85955),Within:i(60417),Wrap:i(15994),Vector2:i(26099),Vector3:i(25836),Vector4:i(61369),Matrix3:i(94434),Matrix4:i(37867),Quaternion:i(15746),RotateVec3:i(72678)};r=n(!1,r,s),t.exports=r},89318:(t,e,i)=>{var s=i(85710);t.exports=function(t,e){for(var i=0,n=t.length-1,r=0;r<=n;r++)i+=Math.pow(1-e,n-r)*Math.pow(e,r)*t[r]*s(n,r);return i}},77259:(t,e,i)=>{var s=i(87842);t.exports=function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n);return t[0]===t[i]?(e<0&&(r=Math.floor(n=i*(1+e))),s(n-r,t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i])):e<0?t[0]-(s(-n,t[0],t[0],t[1],t[1])-t[0]):e>1?t[i]-(s(n-i,t[i],t[i],t[i-1],t[i-1])-t[i]):s(n-r,t[r?r-1:0],t[r],t[i{t.exports=function(t,e,i,s,n){return function(t,e){var i=1-t;return i*i*i*e}(t,e)+function(t,e){var i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,s)+function(t,e){return t*t*t*e}(t,n)}},28392:(t,e,i)=>{var s=i(28915);t.exports=function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n);return e<0?s(t[0],t[1],n):e>1?s(t[i],t[i-1],i-n):s(t[r],t[r+1>i?i:r+1],n-r)}},32112:t=>{t.exports=function(t,e,i,s){return function(t,e){var i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,s)}},47235:(t,e,i)=>{var s=i(7602);t.exports=function(t,e,i){return e+(i-e)*s(t,0,1)}},50178:(t,e,i)=>{var s=i(54261);t.exports=function(t,e,i){return e+(i-e)*s(t,0,1)}},38289:(t,e,i)=>{t.exports={Bezier:i(89318),CatmullRom:i(77259),CubicBezier:i(36316),Linear:i(28392),QuadraticBezier:i(32112),SmoothStep:i(47235),SmootherStep:i(50178)}},98439:t=>{t.exports=function(t){var e=Math.log(t)/.6931471805599453;return 1<{t.exports=function(t,e){return t>0&&!(t&t-1)&&e>0&&!(e&e-1)}},81230:t=>{t.exports=function(t){return t>0&&!(t&t-1)}},49001:(t,e,i)=>{t.exports={GetNext:i(98439),IsSize:i(50030),IsValue:i(81230)}},28453:(t,e,i)=>{var s=new(i(83419))({initialize:function(t){void 0===t&&(t=[(Date.now()*Math.random()).toString()]),this.c=1,this.s0=0,this.s1=0,this.s2=0,this.n=0,this.signs=[-1,1],t&&this.init(t)},rnd:function(){var t=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|t,this.s0=this.s1,this.s1=this.s2,this.s2=t-this.c,this.s2},hash:function(t){var e,i=this.n;t=t.toString();for(var s=0;s>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return this.n=i,2.3283064365386963e-10*(i>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.n=4022871197,this.s0=this.hash(" "),this.s1=this.hash(" "),this.s2=this.hash(" "),this.c=1,t)for(var e=0;e0;e--){var i=Math.floor(this.frac()*(e+1)),s=t[i];t[i]=t[e],t[e]=s}return t}});t.exports=s},63448:t=>{t.exports=function(t,e,i,s){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.ceil(t/e),s?(i+t)/e:i+t)}},56583:t=>{t.exports=function(t,e,i,s){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.floor(t/e),s?(i+t)/e:i+t)}},77720:t=>{t.exports=function(t,e,i,s){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.round(t/e),s?(i+t)/e:i+t)}},73697:(t,e,i)=>{t.exports={Ceil:i(63448),Floor:i(56583),To:i(77720)}},85454:(t,e,i)=>{i(63595);var s=i(8054),n=i(79291),r={Actions:i(61061),Animations:i(60421),BlendModes:i(10312),Cache:i(83388),Cameras:i(26638),Core:i(42857),Class:i(83419),Create:i(15822),Curves:i(25410),Data:i(44965),Display:i(27460),DOM:i(84902),Events:i(93055),FX:i(66064),Game:i(50127),GameObjects:i(77856),Geom:i(55738),Input:i(14350),Loader:i(57777),Math:i(75508),Physics:i(44563),Plugins:i(18922),Renderer:i(36909),Scale:i(93364),ScaleModes:i(29795),Scene:i(97482),Scenes:i(62194),Structs:i(41392),Textures:i(27458),Tilemaps:i(62501),Time:i(90291),Tweens:i(43066),Utils:i(91799)};r.Sound=i(23717),r=n(!1,r,s),t.exports=r,i.g.Phaser=r},71289:(t,e,i)=>{var s=i(83419),n=i(92209),r=i(88571),o=new s({Extends:r,Mixins:[n.Acceleration,n.Angular,n.Bounce,n.Collision,n.Debug,n.Drag,n.Enable,n.Friction,n.Gravity,n.Immovable,n.Mass,n.Pushable,n.Size,n.Velocity],initialize:function(t,e,i,s,n){r.call(this,t,e,i,s,n),this.body=null}});t.exports=o},86689:(t,e,i)=>{var s=i(83419),n=i(39506),r=i(20339),o=i(89774),a=i(66022),h=i(95540),l=i(46975),u=i(72441),c=i(47956),d=i(37277),f=i(44594),p=i(26099),v=i(82248),g=new s({initialize:function(t){this.scene=t,this.systems=t.sys,this.config=this.getConfig(),this.world,this.add,this._category=1,t.sys.events.once(f.BOOT,this.boot,this),t.sys.events.on(f.START,this.start,this)},boot:function(){this.world=new v(this.scene,this.config),this.add=new a(this.world),this.systems.events.once(f.DESTROY,this.destroy,this)},start:function(){this.world||(this.world=new v(this.scene,this.config),this.add=new a(this.world));var t=this.systems.events;h(this.config,"customUpdate",!1)||t.on(f.UPDATE,this.world.update,this.world),t.on(f.POST_UPDATE,this.world.postUpdate,this.world),t.once(f.SHUTDOWN,this.shutdown,this)},enableUpdate:function(){this.systems.events.on(f.UPDATE,this.world.update,this.world)},disableUpdate:function(){this.systems.events.off(f.UPDATE,this.world.update,this.world)},getConfig:function(){var t=this.systems.game.config.physics,e=this.systems.settings.physics;return l(h(e,"arcade",{}),h(t,"arcade",{}))},nextCategory:function(){return this._category=this._category<<1,this._category},overlap:function(t,e,i,s,n){return void 0===i&&(i=null),void 0===s&&(s=null),void 0===n&&(n=i),this.world.collideObjects(t,e,i,s,n,!0)},collide:function(t,e,i,s,n){return void 0===i&&(i=null),void 0===s&&(s=null),void 0===n&&(n=i),this.world.collideObjects(t,e,i,s,n,!1)},collideTiles:function(t,e,i,s,n){return this.world.collideTiles(t,e,i,s,n)},overlapTiles:function(t,e,i,s,n){return this.world.overlapTiles(t,e,i,s,n)},pause:function(){return this.world.pause()},resume:function(){return this.world.resume()},accelerateTo:function(t,e,i,s,n,r){void 0===s&&(s=60);var o=Math.atan2(i-t.y,e-t.x);return t.body.acceleration.setToPolar(o,s),void 0!==n&&void 0!==r&&t.body.maxVelocity.set(n,r),o},accelerateToObject:function(t,e,i,s,n){return this.accelerateTo(t,e.x,e.y,i,s,n)},closest:function(t,e){e||(e=this.world.bodies.entries);for(var i=Number.MAX_VALUE,s=null,n=t.x,r=t.y,a=e.length,h=0;hi&&(s=l,i=c)}}return s},moveTo:function(t,e,i,s,n){void 0===s&&(s=60),void 0===n&&(n=0);var o=Math.atan2(i-t.y,e-t.x);return n>0&&(s=r(t.x,t.y,e,i)/(n/1e3)),t.body.velocity.setToPolar(o,s),o},moveToObject:function(t,e,i,s){return this.moveTo(t,e.x,e.y,i,s)},velocityFromAngle:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new p),i.setToPolar(n(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new p),i.setToPolar(t,e)},overlapRect:function(t,e,i,s,n,r){return c(this.world,t,e,i,s,n,r)},overlapCirc:function(t,e,i,s,n){return u(this.world,t,e,i,s,n)},shutdown:function(){if(this.world){var t=this.systems.events;t.off(f.UPDATE,this.world.update,this.world),t.off(f.POST_UPDATE,this.world.postUpdate,this.world),t.off(f.SHUTDOWN,this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null,this._category=1}},destroy:function(){this.shutdown(),this.scene.sys.events.off(f.START,this.start,this),this.scene=null,this.systems=null}});d.register("ArcadePhysics",g,"arcadePhysics"),t.exports=g},13759:(t,e,i)=>{var s=i(83419),n=i(92209),r=i(68287),o=new s({Extends:r,Mixins:[n.Acceleration,n.Angular,n.Bounce,n.Collision,n.Debug,n.Drag,n.Enable,n.Friction,n.Gravity,n.Immovable,n.Mass,n.Pushable,n.Size,n.Velocity],initialize:function(t,e,i,s,n){r.call(this,t,e,i,s,n),this.body=null}});t.exports=o},37742:(t,e,i)=>{var s=i(83419),n=i(78389),r=i(37747),o=i(63012),a=i(43396),h=i(87841),l=i(37303),u=i(95829),c=i(26099),d=new s({Mixins:[n],initialize:function(t,e){var i=64,s=64,n=void 0!==e;n&&e.displayWidth&&(i=e.displayWidth,s=e.displayHeight),n||(e={x:0,y:0,angle:0,rotation:0,scaleX:1,scaleY:1,displayOriginX:0,displayOriginY:0}),this.world=t,this.gameObject=n?e:void 0,this.isBody=!0,this.transform={x:e.x,y:e.y,rotation:e.angle,scaleX:e.scaleX,scaleY:e.scaleY,displayOriginX:e.displayOriginX,displayOriginY:e.displayOriginY},this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new c,this.position=new c(e.x-e.scaleX*e.displayOriginX,e.y-e.scaleY*e.displayOriginY),this.prev=this.position.clone(),this.prevFrame=this.position.clone(),this.allowRotation=!0,this.rotation=e.angle,this.preRotation=e.angle,this.width=i,this.height=s,this.sourceWidth=i,this.sourceHeight=s,e.frame&&(this.sourceWidth=e.frame.realWidth,this.sourceHeight=e.frame.realHeight),this.halfWidth=Math.abs(i/2),this.halfHeight=Math.abs(s/2),this.center=new c(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.velocity=new c,this.newVelocity=new c,this.deltaMax=new c,this.acceleration=new c,this.allowDrag=!0,this.drag=new c,this.allowGravity=!0,this.gravity=new c,this.bounce=new c,this.worldBounce=null,this.customBoundsRectangle=t.bounds,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.maxVelocity=new c(1e4,1e4),this.maxSpeed=-1,this.friction=new c(1,0),this.useDamping=!1,this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=r.FACING_NONE,this.immovable=!1,this.pushable=!0,this.slideFactor=new c(1,1),this.moves=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision=u(!1),this.touching=u(!0),this.wasTouching=u(!0),this.blocked=u(!0),this.syncBounds=!1,this.physicsType=r.DYNAMIC_BODY,this.collisionCategory=1,this.collisionMask=1,this._sx=e.scaleX,this._sy=e.scaleY,this._dx=0,this._dy=0,this._tx=0,this._ty=0,this._bounds=new h,this.directControl=!1,this.autoFrame=this.position.clone()},updateBounds:function(){var t=this.gameObject,e=this.transform;if(t.parentContainer){var i=t.getWorldTransformMatrix(this.world._tempMatrix,this.world._tempMatrix2);e.x=i.tx,e.y=i.ty,e.rotation=a(i.rotation),e.scaleX=i.scaleX,e.scaleY=i.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY}else e.x=t.x,e.y=t.y,e.rotation=t.angle,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY;var s=!1;if(this.syncBounds){var n=t.getBounds(this._bounds);this.width=n.width,this.height=n.height,s=!0}else{var r=Math.abs(e.scaleX),o=Math.abs(e.scaleY);this._sx===r&&this._sy===o||(this.width=this.sourceWidth*r,this.height=this.sourceHeight*o,this._sx=r,this._sy=o,s=!0)}s&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},updateFromGameObject:function(){this.updateBounds();var t=this.transform;this.position.x=t.x+t.scaleX*(this.offset.x-t.displayOriginX),this.position.y=t.y+t.scaleY*(this.offset.y-t.displayOriginY),this.updateCenter()},resetFlags:function(t){void 0===t&&(t=!1);var e=this.wasTouching,i=this.touching,s=this.blocked;t?u(!0,e):(e.none=i.none,e.up=i.up,e.down=i.down,e.left=i.left,e.right=i.right),u(!0,i),u(!0,s),this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1},preUpdate:function(t,e){if(t&&this.resetFlags(),this.gameObject&&this.updateFromGameObject(),this.rotation=this.transform.rotation,this.preRotation=this.rotation,this.moves){var i=this.position;this.prev.x=i.x,this.prev.y=i.y,this.prevFrame.x=i.x,this.prevFrame.y=i.y}t&&this.update(e)},update:function(t){var e=this.prev,i=this.position,s=this.velocity;if(e.set(i.x,i.y),!this.moves)return this._dx=i.x-e.x,void(this._dy=i.y-e.y);if(this.directControl){var n=this.autoFrame;s.set((i.x-n.x)/t,(i.y-n.y)/t),this.world.updateMotion(this,t),this._dx=i.x-n.x,this._dy=i.y-n.y}else this.world.updateMotion(this,t),this.newVelocity.set(s.x*t,s.y*t),i.add(this.newVelocity),this._dx=i.x-e.x,this._dy=i.y-e.y;var r=s.x,a=s.y;if(this.updateCenter(),this.angle=Math.atan2(a,r),this.speed=Math.sqrt(r*r+a*a),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds){var h=this.blocked;this.world.emit(o.WORLD_BOUNDS,this,h.up,h.down,h.left,h.right)}},postUpdate:function(){var t=this.position,e=t.x-this.prevFrame.x,i=t.y-this.prevFrame.y,s=this.gameObject;if(this.moves){var n=this.deltaMax.x,o=this.deltaMax.y;0!==n&&0!==e&&(e<0&&e<-n?e=-n:e>0&&e>n&&(e=n)),0!==o&&0!==i&&(i<0&&i<-o?i=-o:i>0&&i>o&&(i=o)),s&&(s.x+=e,s.y+=i)}e<0?this.facing=r.FACING_LEFT:e>0&&(this.facing=r.FACING_RIGHT),i<0?this.facing=r.FACING_UP:i>0&&(this.facing=r.FACING_DOWN),this.allowRotation&&s&&(s.angle+=this.deltaZ()),this._tx=e,this._ty=i,this.autoFrame.set(t.x,t.y)},setBoundsRectangle:function(t){return this.customBoundsRectangle=t||this.world.bounds,this},checkWorldBounds:function(){var t=this.position,e=this.velocity,i=this.blocked,s=this.customBoundsRectangle,n=this.world.checkCollision,r=this.worldBounce?-this.worldBounce.x:-this.bounce.x,o=this.worldBounce?-this.worldBounce.y:-this.bounce.y,a=!1;return t.xs.right&&n.right&&(t.x=s.right-this.width,e.x*=r,i.right=!0,a=!0),t.ys.bottom&&n.down&&(t.y=s.bottom-this.height,e.y*=o,i.down=!0,a=!0),a&&(this.blocked.none=!1,this.updateCenter()),a},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this},setGameObject:function(t,e){return void 0===e&&(e=!0),this.world.remove(this),this.gameObject&&this.gameObject.body&&(this.gameObject.body=null),this.gameObject=t,t.body&&(t.body=this),this.setSize(),this.world.add(this),this.enable=e,this},setSize:function(t,e,i){void 0===i&&(i=!0);var s=this.gameObject;if(s&&(!t&&s.frame&&(t=s.frame.realWidth),!e&&s.frame&&(e=s.frame.realHeight)),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&s&&s.getCenter){var n=(s.width-t)/2,r=(s.height-e)/2;this.offset.set(n,r)}return this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter()):this.isCircle=!1,this},reset:function(t,e){this.stop();var i=this.gameObject;i&&(i.setPosition(t,e),this.rotation=i.angle,this.preRotation=i.angle);var s=this.position;i&&i.getTopLeft?i.getTopLeft(s):s.set(t,e),this.prev.copy(s),this.prevFrame.copy(s),this.autoFrame.copy(s),i&&this.updateBounds(),this.updateCenter(),this.collideWorldBounds&&this.checkWorldBounds(),this.resetFlags(!0)},stop:function(){return this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0,this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?this.radius>0&&t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom&&(this.center.x-t)*(this.center.x-t)+(this.center.y-e)*(this.center.y-e)<=this.radius*this.radius:l(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},deltaXFinal:function(){return this._tx},deltaYFinal:function(){return this._ty},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world&&this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position,i=e.x+this.halfWidth,s=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(t.defaultStrokeWidth,this.debugBodyColor),this.isCircle?t.strokeCircle(i,s,this.width/2):(this.checkCollision.up&&t.lineBetween(e.x,e.y,e.x+this.width,e.y),this.checkCollision.right&&t.lineBetween(e.x+this.width,e.y,e.x+this.width,e.y+this.height),this.checkCollision.down&&t.lineBetween(e.x,e.y+this.height,e.x+this.width,e.y+this.height),this.checkCollision.left&&t.lineBetween(e.x,e.y,e.x,e.y+this.height))),this.debugShowVelocity&&(t.lineStyle(t.defaultStrokeWidth,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,s,i+this.velocity.x/2,s+this.velocity.y/2))},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},setDirectControl:function(t){return void 0===t&&(t=!0),this.directControl=t,this},setCollideWorldBounds:function(t,e,i,s){void 0===t&&(t=!0),this.collideWorldBounds=t;var n=void 0!==e,r=void 0!==i;return(n||r)&&(this.worldBounce||(this.worldBounce=new c),n&&(this.worldBounce.x=e),r&&(this.worldBounce.y=i)),void 0!==s&&(this.onWorldBounds=s),this},setVelocity:function(t,e){return this.velocity.set(t,e),t=this.velocity.x,e=this.velocity.y,this.speed=Math.sqrt(t*t+e*e),this},setVelocityX:function(t){return this.setVelocity(t,this.velocity.y)},setVelocityY:function(t){return this.setVelocity(this.velocity.x,t)},setMaxVelocity:function(t,e){return this.maxVelocity.set(t,e),this},setMaxVelocityX:function(t){return this.maxVelocity.x=t,this},setMaxVelocityY:function(t){return this.maxVelocity.y=t,this},setMaxSpeed:function(t){return this.maxSpeed=t,this},setSlideFactor:function(t,e){return this.slideFactor.set(t,e),this},setBounce:function(t,e){return this.bounce.set(t,e),this},setBounceX:function(t){return this.bounce.x=t,this},setBounceY:function(t){return this.bounce.y=t,this},setAcceleration:function(t,e){return this.acceleration.set(t,e),this},setAccelerationX:function(t){return this.acceleration.x=t,this},setAccelerationY:function(t){return this.acceleration.y=t,this},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=t,this},setDrag:function(t,e){return this.drag.set(t,e),this},setDamping:function(t){return this.useDamping=t,this},setDragX:function(t){return this.drag.x=t,this},setDragY:function(t){return this.drag.y=t,this},setGravity:function(t,e){return this.gravity.set(t,e),this},setGravityX:function(t){return this.gravity.x=t,this},setGravityY:function(t){return this.gravity.y=t,this},setFriction:function(t,e){return this.friction.set(t,e),this},setFrictionX:function(t){return this.friction.x=t,this},setFrictionY:function(t){return this.friction.y=t,this},setAngularVelocity:function(t){return this.angularVelocity=t,this},setAngularAcceleration:function(t){return this.angularAcceleration=t,this},setAngularDrag:function(t){return this.angularDrag=t,this},setMass:function(t){return this.mass=t,this},setImmovable:function(t){return void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=t,this},processX:function(t,e,i,s){this.x+=t,this.updateCenter(),null!==e&&(this.velocity.x=e*this.slideFactor.x);var n=this.blocked;i&&(n.left=!0,n.none=!1),s&&(n.right=!0,n.none=!1)},processY:function(t,e,i,s){this.y+=t,this.updateCenter(),null!==e&&(this.velocity.y=e*this.slideFactor.y);var n=this.blocked;i&&(n.up=!0,n.none=!1),s&&(n.down=!0,n.none=!1)},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=d},79342:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s,n,r,o){this.world=t,this.name="",this.active=!0,this.overlapOnly=e,this.object1=i,this.object2=s,this.collideCallback=n,this.processCallback=r,this.callbackContext=o},setName:function(t){return this.name=t,this},update:function(){this.world.collideObjects(this.object1,this.object2,this.collideCallback,this.processCallback,this.callbackContext,this.overlapOnly)},destroy:function(){this.world.removeCollider(this),this.active=!1,this.world=null,this.object1=null,this.object2=null,this.collideCallback=null,this.processCallback=null,this.callbackContext=null}});t.exports=s},66022:(t,e,i)=>{var s=i(71289),n=i(13759),r=i(37742),o=i(83419),a=i(37747),h=i(60758),l=i(72624),u=i(71464),c=new o({initialize:function(t){this.world=t,this.scene=t.scene,this.sys=t.scene.sys},collider:function(t,e,i,s,n){return this.world.addCollider(t,e,i,s,n)},overlap:function(t,e,i,s,n){return this.world.addOverlap(t,e,i,s,n)},existing:function(t,e){var i=e?a.STATIC_BODY:a.DYNAMIC_BODY;return this.world.enableBody(t,i),t},staticImage:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.world.enableBody(r,a.STATIC_BODY),r},image:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.world.enableBody(r,a.DYNAMIC_BODY),r},staticSprite:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,a.STATIC_BODY),r},sprite:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,a.DYNAMIC_BODY),r},staticGroup:function(t,e){return this.sys.updateList.add(new u(this.world,this.world.scene,t,e))},group:function(t,e){return this.sys.updateList.add(new h(this.world,this.world.scene,t,e))},body:function(t,e,i,s){var n=new r(this.world);return n.position.set(t,e),i&&s&&n.setSize(i,s),this.world.add(n,a.DYNAMIC_BODY),n},staticBody:function(t,e,i,s){var n=new l(this.world);return n.position.set(t,e),i&&s&&n.setSize(i,s),this.world.add(n,a.STATIC_BODY),n},destroy:function(){this.world=null,this.scene=null,this.sys=null}});t.exports=c},79599:t=>{t.exports=function(t){var e=0;if(Array.isArray(t))for(var i=0;i{var s=i(37747);t.exports=function(t,e,i,n){var r=0,o=t.deltaAbsX()+e.deltaAbsX()+n;return 0===t._dx&&0===e._dx?(t.embedded=!0,e.embedded=!0):t._dx>e._dx?(r=t.right-e.x)>o&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?r=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType!==s.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.right=!0),t.physicsType!==s.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.left=!0)):t._dxo&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?r=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0,e.physicsType!==s.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.left=!0),t.physicsType!==s.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.right=!0))),t.overlapX=r,e.overlapX=r,r}},45170:(t,e,i)=>{var s=i(37747);t.exports=function(t,e,i,n){var r=0,o=t.deltaAbsY()+e.deltaAbsY()+n;return 0===t._dy&&0===e._dy?(t.embedded=!0,e.embedded=!0):t._dy>e._dy?(r=t.bottom-e.y)>o&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?r=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType!==s.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.down=!0),t.physicsType!==s.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.up=!0)):t._dyo&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?r=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0,e.physicsType!==s.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.up=!0),t.physicsType!==s.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.down=!0))),t.overlapY=r,e.overlapY=r,r}},60758:(t,e,i)=>{var s=i(13759),n=i(83419),r=i(78389),o=i(37747),a=i(95540),h=i(26479),l=i(41212),u=new n({Extends:h,Mixins:[r],initialize:function(t,e,i,n){if(i||n)if(l(i))n=i,i=null,n.internalCreateCallback=this.createCallbackHandler,n.internalRemoveCallback=this.removeCallbackHandler;else if(Array.isArray(i)&&l(i[0])){var r=this;i.forEach((function(t){t.internalCreateCallback=r.createCallbackHandler,t.internalRemoveCallback=r.removeCallbackHandler,t.classType=a(t,"classType",s)})),n=null}else n={internalCreateCallback:this.createCallbackHandler,internalRemoveCallback:this.removeCallbackHandler};else n={internalCreateCallback:this.createCallbackHandler,internalRemoveCallback:this.removeCallbackHandler};this.world=t,n&&(n.classType=a(n,"classType",s)),this.physicsType=o.DYNAMIC_BODY,this.collisionCategory=1,this.collisionMask=1,this.defaults={setCollideWorldBounds:a(n,"collideWorldBounds",!1),setBoundsRectangle:a(n,"customBoundsRectangle",null),setAccelerationX:a(n,"accelerationX",0),setAccelerationY:a(n,"accelerationY",0),setAllowDrag:a(n,"allowDrag",!0),setAllowGravity:a(n,"allowGravity",!0),setAllowRotation:a(n,"allowRotation",!0),setDamping:a(n,"useDamping",!1),setBounceX:a(n,"bounceX",0),setBounceY:a(n,"bounceY",0),setDragX:a(n,"dragX",0),setDragY:a(n,"dragY",0),setEnable:a(n,"enable",!0),setGravityX:a(n,"gravityX",0),setGravityY:a(n,"gravityY",0),setFrictionX:a(n,"frictionX",0),setFrictionY:a(n,"frictionY",0),setMaxSpeed:a(n,"maxSpeed",-1),setMaxVelocityX:a(n,"maxVelocityX",1e4),setMaxVelocityY:a(n,"maxVelocityY",1e4),setVelocityX:a(n,"velocityX",0),setVelocityY:a(n,"velocityY",0),setAngularVelocity:a(n,"angularVelocity",0),setAngularAcceleration:a(n,"angularAcceleration",0),setAngularDrag:a(n,"angularDrag",0),setMass:a(n,"mass",1),setImmovable:a(n,"immovable",!1)},h.call(this,e,i,n),this.type="PhysicsGroup"},createCallbackHandler:function(t){t.body||this.world.enableBody(t,o.DYNAMIC_BODY);var e=t.body;for(var i in this.defaults)e[i](this.defaults[i])},removeCallbackHandler:function(t){t.body&&this.world.disableBody(t)},setVelocity:function(t,e,i){void 0===i&&(i=0);for(var s=this.getChildren(),n=0;n{var e,i,s,n,r,o,a,h,l,u,c,d,f,p,v,g,m,y=function(){return u&&v&&i.blocked.right?(e.processX(-m,a,!1,!0),1):l&&g&&i.blocked.left?(e.processX(m,a,!0),1):f&&g&&e.blocked.right?(i.processX(-m,h,!1,!0),2):d&&v&&e.blocked.left?(i.processX(m,h,!0),2):0},x=function(t){if(s&&n)m*=.5,0===t||3===t?(e.processX(m,r),i.processX(-m,o)):(e.processX(-m,r),i.processX(m,o));else if(s&&!n)0===t||3===t?e.processX(m,a,!0):e.processX(-m,a,!1,!0);else if(!s&&n)0===t||3===t?i.processX(-m,h,!1,!0):i.processX(m,h,!0);else{var v=.5*m;0===t?p?(e.processX(m,0,!0),i.processX(0,null,!1,!0)):f?(e.processX(v,0,!0),i.processX(-v,0,!1,!0)):(e.processX(v,i.velocity.x,!0),i.processX(-v,null,!1,!0)):1===t?c?(e.processX(0,null,!1,!0),i.processX(m,0,!0)):u?(e.processX(-v,0,!1,!0),i.processX(v,0,!0)):(e.processX(-v,null,!1,!0),i.processX(v,e.velocity.x,!0)):2===t?p?(e.processX(-m,0,!1,!0),i.processX(0,null,!0)):d?(e.processX(-v,0,!1,!0),i.processX(v,0,!0)):(e.processX(-v,i.velocity.x,!1,!0),i.processX(v,null,!0)):3===t&&(c?(e.processX(0,null,!0),i.processX(-m,0,!1,!0)):l?(e.processX(v,0,!0),i.processX(-v,0,!1,!0)):(e.processX(v,i.velocity.y,!0),i.processX(-v,null,!1,!0)))}return!0};t.exports={BlockCheck:y,Check:function(){var t=e.velocity.x,s=i.velocity.x,n=Math.sqrt(s*s*i.mass/e.mass)*(s>0?1:-1),a=Math.sqrt(t*t*e.mass/i.mass)*(t>0?1:-1),h=.5*(n+a);return a-=h,r=h+(n-=h)*e.bounce.x,o=h+a*i.bounce.x,l&&g?x(0):d&&v?x(1):u&&v?x(2):!(!f||!g)&&x(3)},Set:function(t,r,o){i=r;var x=(e=t).velocity.x,T=i.velocity.x;return s=e.pushable,l=e._dx<0,u=e._dx>0,c=0===e._dx,v=Math.abs(e.right-i.x)<=Math.abs(i.right-e.x),a=T-x*e.bounce.x,n=i.pushable,d=i._dx<0,f=i._dx>0,p=0===i._dx,g=!v,h=x-T*i.bounce.x,m=Math.abs(o),y()},Run:x,RunImmovableBody1:function(t){1===t?i.velocity.x=0:v?i.processX(m,h,!0):i.processX(-m,h,!1,!0),e.moves&&(i.y+=(e.y-e.prev.y)*e.friction.y,i._dy=i.y-i.prev.y)},RunImmovableBody2:function(t){2===t?e.velocity.x=0:g?e.processX(m,a,!0):e.processX(-m,a,!1,!0),i.moves&&(e.y+=(i.y-i.prev.y)*i.friction.y,e._dy=e.y-e.prev.y)}}},47962:t=>{var e,i,s,n,r,o,a,h,l,u,c,d,f,p,v,g,m,y=function(){return u&&v&&i.blocked.down?(e.processY(-m,a,!1,!0),1):l&&g&&i.blocked.up?(e.processY(m,a,!0),1):f&&g&&e.blocked.down?(i.processY(-m,h,!1,!0),2):d&&v&&e.blocked.up?(i.processY(m,h,!0),2):0},x=function(t){if(s&&n)m*=.5,0===t||3===t?(e.processY(m,r),i.processY(-m,o)):(e.processY(-m,r),i.processY(m,o));else if(s&&!n)0===t||3===t?e.processY(m,a,!0):e.processY(-m,a,!1,!0);else if(!s&&n)0===t||3===t?i.processY(-m,h,!1,!0):i.processY(m,h,!0);else{var v=.5*m;0===t?p?(e.processY(m,0,!0),i.processY(0,null,!1,!0)):f?(e.processY(v,0,!0),i.processY(-v,0,!1,!0)):(e.processY(v,i.velocity.y,!0),i.processY(-v,null,!1,!0)):1===t?c?(e.processY(0,null,!1,!0),i.processY(m,0,!0)):u?(e.processY(-v,0,!1,!0),i.processY(v,0,!0)):(e.processY(-v,null,!1,!0),i.processY(v,e.velocity.y,!0)):2===t?p?(e.processY(-m,0,!1,!0),i.processY(0,null,!0)):d?(e.processY(-v,0,!1,!0),i.processY(v,0,!0)):(e.processY(-v,i.velocity.y,!1,!0),i.processY(v,null,!0)):3===t&&(c?(e.processY(0,null,!0),i.processY(-m,0,!1,!0)):l?(e.processY(v,0,!0),i.processY(-v,0,!1,!0)):(e.processY(v,i.velocity.y,!0),i.processY(-v,null,!1,!0)))}return!0};t.exports={BlockCheck:y,Check:function(){var t=e.velocity.y,s=i.velocity.y,n=Math.sqrt(s*s*i.mass/e.mass)*(s>0?1:-1),a=Math.sqrt(t*t*e.mass/i.mass)*(t>0?1:-1),h=.5*(n+a);return a-=h,r=h+(n-=h)*e.bounce.y,o=h+a*i.bounce.y,l&&g?x(0):d&&v?x(1):u&&v?x(2):!(!f||!g)&&x(3)},Set:function(t,r,o){i=r;var x=(e=t).velocity.y,T=i.velocity.y;return s=e.pushable,l=e._dy<0,u=e._dy>0,c=0===e._dy,v=Math.abs(e.bottom-i.y)<=Math.abs(i.bottom-e.y),a=T-x*e.bounce.y,n=i.pushable,d=i._dy<0,f=i._dy>0,p=0===i._dy,g=!v,h=x-T*i.bounce.y,m=Math.abs(o),y()},Run:x,RunImmovableBody1:function(t){1===t?i.velocity.y=0:v?i.processY(m,h,!0):i.processY(-m,h,!1,!0),e.moves&&(i.x+=(e.x-e.prev.x)*e.friction.x,i._dx=i.x-i.prev.x)},RunImmovableBody2:function(t){2===t?e.velocity.y=0:g?e.processY(m,a,!0):e.processY(-m,a,!1,!0),i.moves&&(e.x+=(i.x-i.prev.x)*i.friction.x,e._dx=e.x-e.prev.x)}}},14087:(t,e,i)=>{var s=i(64897),n=i(3017);t.exports=function(t,e,i,r,o){void 0===o&&(o=s(t,e,i,r));var a=t.immovable,h=e.immovable;if(i||0===o||a&&h||t.customSeparateX||e.customSeparateX)return 0!==o||t.embedded&&e.embedded;var l=n.Set(t,e,o);return a||h?(a?n.RunImmovableBody1(l):h&&n.RunImmovableBody2(l),!0):l>0||n.Check()}},89936:(t,e,i)=>{var s=i(45170),n=i(47962);t.exports=function(t,e,i,r,o){void 0===o&&(o=s(t,e,i,r));var a=t.immovable,h=e.immovable;if(i||0===o||a&&h||t.customSeparateY||e.customSeparateY)return 0!==o||t.embedded&&e.embedded;var l=n.Set(t,e,o);return a||h?(a?n.RunImmovableBody1(l):h&&n.RunImmovableBody2(l),!0):l>0||n.Check()}},95829:t=>{t.exports=function(t,e){return void 0===e&&(e={}),e.none=t,e.up=!1,e.down=!1,e.left=!1,e.right=!1,t||(e.up=!0,e.down=!0,e.left=!0,e.right=!0),e}},72624:(t,e,i)=>{var s=i(87902),n=i(83419),r=i(78389),o=i(37747),a=i(37303),h=i(95829),l=i(26099),u=new n({Mixins:[r],initialize:function(t,e){var i=64,s=64,n=void 0!==e;n&&e.displayWidth&&(i=e.displayWidth,s=e.displayHeight),n||(e={x:0,y:0,angle:0,rotation:0,scaleX:1,scaleY:1,displayOriginX:0,displayOriginY:0}),this.world=t,this.gameObject=n?e:void 0,this.isBody=!0,this.debugShowBody=t.defaults.debugShowStaticBody,this.debugBodyColor=t.defaults.staticBodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new l,this.position=new l(e.x-i*e.originX,e.y-s*e.originY),this.width=i,this.height=s,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center=new l(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.velocity=l.ZERO,this.allowGravity=!1,this.gravity=l.ZERO,this.bounce=l.ZERO,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.mass=1,this.immovable=!0,this.pushable=!1,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision=h(!1),this.touching=h(!0),this.wasTouching=h(!0),this.blocked=h(!0),this.physicsType=o.STATIC_BODY,this.collisionCategory=1,this.collisionMask=1,this._dx=0,this._dy=0},setGameObject:function(t,e){return t&&t!==this.gameObject&&(this.gameObject.body=null,t.body=this,this.gameObject=t),e&&this.updateFromGameObject(),this},updateFromGameObject:function(){this.world.staticTree.remove(this);var t=this.gameObject;return t.getTopLeft(this.position),this.width=t.displayWidth,this.height=t.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.world.staticTree.insert(this),this},setOffset:function(t,e){return void 0===e&&(e=t),this.world.staticTree.remove(this),this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(t,e),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this),this},setSize:function(t,e,i){void 0===i&&(i=!0);var s=this.gameObject;if(s&&s.frame&&(t||(t=s.frame.realWidth),e||(e=s.frame.realHeight)),this.world.staticTree.remove(this),this.width=t,this.height=e,this.halfWidth=Math.floor(t/2),this.halfHeight=Math.floor(e/2),i&&s&&s.getCenter){var n=s.displayWidth/2,r=s.displayHeight/2;this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(n-this.halfWidth,r-this.halfHeight),this.position.x+=this.offset.x,this.position.y+=this.offset.y}return this.updateCenter(),this.isCircle=!1,this.radius=0,this.world.staticTree.insert(this),this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.world.staticTree.remove(this),this.isCircle=!0,this.radius=t,this.width=2*t,this.height=2*t,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter(),this.world.staticTree.insert(this)):this.isCircle=!1,this},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(t,e){var i=this.gameObject;void 0===t&&(t=i.x),void 0===e&&(e=i.y),this.world.staticTree.remove(this),i.setPosition(t,e),i.getTopLeft(this.position),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this)},stop:function(){return this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?s(this,t,e):a(this,t,e)},postUpdate:function(){},deltaAbsX:function(){return 0},deltaAbsY:function(){return 0},deltaX:function(){return 0},deltaY:function(){return 0},deltaZ:function(){return 0},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position,i=e.x+this.halfWidth,s=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(t.defaultStrokeWidth,this.debugBodyColor,1),this.isCircle?t.strokeCircle(i,s,this.width/2):t.strokeRect(e.x,e.y,this.width,this.height))},willDrawDebug:function(){return this.debugShowBody},setMass:function(t){return t<=0&&(t=.1),this.mass=t,this},x:{get:function(){return this.position.x},set:function(t){this.world.staticTree.remove(this),this.position.x=t,this.world.staticTree.insert(this)}},y:{get:function(){return this.position.y},set:function(t){this.world.staticTree.remove(this),this.position.y=t,this.world.staticTree.insert(this)}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=u},71464:(t,e,i)=>{var s=i(13759),n=i(83419),r=i(78389),o=i(37747),a=i(95540),h=i(26479),l=i(41212),u=new n({Extends:h,Mixins:[r],initialize:function(t,e,i,n){i||n?l(i)?(n=i,i=null,n.internalCreateCallback=this.createCallbackHandler,n.internalRemoveCallback=this.removeCallbackHandler,n.createMultipleCallback=this.createMultipleCallbackHandler,n.classType=a(n,"classType",s)):Array.isArray(i)&&l(i[0])?(n=i,i=null,n.forEach((function(t){t.internalCreateCallback=this.createCallbackHandler,t.internalRemoveCallback=this.removeCallbackHandler,t.createMultipleCallback=this.createMultipleCallbackHandler,t.classType=a(t,"classType",s)}))):n={internalCreateCallback:this.createCallbackHandler,internalRemoveCallback:this.removeCallbackHandler}:n={internalCreateCallback:this.createCallbackHandler,internalRemoveCallback:this.removeCallbackHandler,createMultipleCallback:this.createMultipleCallbackHandler,classType:s},this.world=t,this.physicsType=o.STATIC_BODY,this.collisionCategory=1,this.collisionMask=1,h.call(this,e,i,n),this.type="StaticPhysicsGroup"},createCallbackHandler:function(t){t.body||this.world.enableBody(t,o.STATIC_BODY)},removeCallbackHandler:function(t){t.body&&this.world.disableBody(t)},createMultipleCallbackHandler:function(){this.refresh()},refresh:function(){for(var t=this.children.entries,e=0;e{var s=i(55495),n=i(37742),r=i(45319),o=i(83419),a=i(79342),h=i(37747),l=i(20339),u=i(52816),c=i(50792),d=i(63012),f=i(43855),p=i(5470),v=i(94977),g=i(64897),m=i(45170),y=i(96523),x=i(35154),T=i(36383),w=i(25774),b=i(96602),S=i(87841),E=i(59542),A=i(40012),C=i(14087),_=i(89936),M=i(35072),P=i(72624),R=i(2483),L=i(61340),O=i(26099),F=i(15994),D=new o({Extends:c,initialize:function(t,e){c.call(this),this.scene=t,this.bodies=new M,this.staticBodies=new M,this.pendingDestroy=new M,this.colliders=new w,this.gravity=new O(x(e,"gravity.x",0),x(e,"gravity.y",0)),this.bounds=new S(x(e,"x",0),x(e,"y",0),x(e,"width",t.sys.scale.width),x(e,"height",t.sys.scale.height)),this.checkCollision={up:x(e,"checkCollision.up",!0),down:x(e,"checkCollision.down",!0),left:x(e,"checkCollision.left",!0),right:x(e,"checkCollision.right",!0)},this.fps=x(e,"fps",60),this.fixedStep=x(e,"fixedStep",!0),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=x(e,"timeScale",1),this.OVERLAP_BIAS=x(e,"overlapBias",4),this.TILE_BIAS=x(e,"tileBias",16),this.forceX=x(e,"forceX",!1),this.isPaused=x(e,"isPaused",!1),this._total=0,this.drawDebug=x(e,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:x(e,"debugShowBody",!0),debugShowStaticBody:x(e,"debugShowStaticBody",!0),debugShowVelocity:x(e,"debugShowVelocity",!0),bodyDebugColor:x(e,"debugBodyColor",16711935),staticBodyDebugColor:x(e,"debugStaticBodyColor",255),velocityDebugColor:x(e,"debugVelocityColor",65280)},this.maxEntries=x(e,"maxEntries",16),this.useTree=x(e,"useTree",!0),this.tree=new E(this.maxEntries),this.staticTree=new E(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new L,this._tempMatrix2=new L,this.tileFilterOptions={isColliding:!0,isNotEmpty:!0,hasInterestingFace:!0},this.drawDebug&&this.createDebugGraphic()},enable:function(t,e){void 0===e&&(e=h.DYNAMIC_BODY),Array.isArray(t)||(t=[t]);for(var i=0;i=r;for(this.fixedStep||(n=.001*e,a=!0,this._elapsed=0),i=0;i=r;)this._elapsed-=r,this.step(n)}},step:function(t){var e,i,s=this.bodies.entries,n=s.length;for(e=0;e0){var l=this.tree,u=this.staticTree;for(s=(i=a.entries).length,t=0;t-1&&t.velocity.length()>d&&(t.velocity.normalize().scale(d),c=d),t.speed=c},separate:function(t,e,i,s,n){var r,o,a=!1,h=!0;if(!t.enable||!e.enable||t.checkCollision.none||e.checkCollision.none||!this.intersects(t,e))return a;if(i&&!1===i.call(s,t.gameObject,e.gameObject))return a;if(t.isCircle||e.isCircle){var l=this.separateCircle(t,e,n);l.result?(a=!0,h=!1):(r=l.x,o=l.y,h=!0)}if(h){var u=!1,c=!1,f=this.OVERLAP_BIAS;n?(u=C(t,e,n,f,r),c=_(t,e,n,f,o)):this.forceX||Math.abs(this.gravity.y+t.gravity.y)E&&(p=l(y,x,E,S)-w):x>A&&(yE&&(p=l(y,x,E,A)-w)),p*=-1}else p=t.halfWidth+e.halfWidth-u(o,a);t.overlapR=p,e.overlapR=p;var C=s(o,a),_=(p+T.EPSILON)*Math.cos(C),M=(p+T.EPSILON)*Math.sin(C),P={overlap:p,result:!1,x:_,y:M};if(i&&(!v||v&&0!==p))return P.result=!0,P;if(!v&&0===p||h&&c||t.customSeparateX||e.customSeparateX)return P.x=void 0,P.y=void 0,P;var R=!t.pushable&&!e.pushable;if(v){var L=o.x-a.x,O=o.y-a.y,F=Math.sqrt(Math.pow(L,2)+Math.pow(O,2)),D=(a.x-o.x)/F||0,k=(a.y-o.y)/F||0,I=2*(d.x*D+d.y*k-f.x*D-f.y*k)/(t.mass+e.mass);(h||c)&&(I*=2),h||(d.x=d.x-I/t.mass*D,d.y=d.y-I/t.mass*k,d.multiply(t.bounce)),c||(f.x=f.x+I/e.mass*D,f.y=f.y+I/e.mass*k,f.multiply(e.bounce)),h||c||(_*=.5,M*=.5),h||(t.x-=_,t.y-=M,t.updateCenter()),c||(e.x+=_,e.y+=M,e.updateCenter()),P.result=!0}else!h||t.pushable||R?(t.x-=_,t.y-=M,t.updateCenter()):(!c||e.pushable||R)&&(e.x+=_,e.y+=M,e.updateCenter()),P.x=void 0,P.y=void 0;return P},intersects:function(t,e){return t!==e&&(t.isCircle||e.isCircle?t.isCircle?e.isCircle?u(t.center,e.center)<=t.halfWidth+e.halfWidth:this.circleBodyIntersects(t,e):this.circleBodyIntersects(e,t):!(t.right<=e.left||t.bottom<=e.top||t.left>=e.right||t.top>=e.bottom))},circleBodyIntersects:function(t,e){var i=r(t.center.x,e.left,e.right),s=r(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-s)*(t.center.y-s)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,s,n){return void 0===i&&(i=null),void 0===s&&(s=null),void 0===n&&(n=i),this.collideObjects(t,e,i,s,n,!0)},collide:function(t,e,i,s,n){return void 0===i&&(i=null),void 0===s&&(s=null),void 0===n&&(n=i),this.collideObjects(t,e,i,s,n,!1)},collideObjects:function(t,e,i,s,n,r){var o,a;!t.isParent||void 0!==t.physicsType&&void 0!==e&&t!==e||(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);var h=Array.isArray(t),l=Array.isArray(e);if(this._total=0,h||l)if(!h&&l)for(o=0;o0},collideHandler:function(t,e,i,s,n,r){if(void 0===e&&t.isParent)return this.collideGroupVsGroup(t,t,i,s,n,r);if(!t||!e)return!1;if(t.body||t.isBody){if(e.body||e.isBody)return this.collideSpriteVsSprite(t,e,i,s,n,r);if(e.isParent)return this.collideSpriteVsGroup(t,e,i,s,n,r);if(e.isTilemap)return this.collideSpriteVsTilemapLayer(t,e,i,s,n,r)}else if(t.isParent){if(e.body||e.isBody)return this.collideSpriteVsGroup(e,t,i,s,n,r);if(e.isParent)return this.collideGroupVsGroup(t,e,i,s,n,r);if(e.isTilemap)return this.collideGroupVsTilemapLayer(t,e,i,s,n,r)}else if(t.isTilemap){if(e.body||e.isBody)return this.collideSpriteVsTilemapLayer(e,t,i,s,n,r);if(e.isParent)return this.collideGroupVsTilemapLayer(e,t,i,s,n,r)}},canCollide:function(t,e){return t&&e&&!!(t.collisionMask&e.collisionCategory)&&!!(e.collisionMask&t.collisionCategory)},collideSpriteVsSprite:function(t,e,i,s,n,r){var o=t.isBody?t:t.body,a=e.isBody?e:e.body;return!!this.canCollide(o,a)&&(this.separate(o,a,s,n,r)&&(i&&i.call(n,t,e),this._total++),!0)},collideSpriteVsGroup:function(t,e,i,s,n,r){var o,a,l,u=t.isBody?t:t.body;if(0!==e.length&&u&&u.enable&&!u.checkCollision.none&&this.canCollide(u,e))if(this.useTree||e.physicsType===h.STATIC_BODY){var c=this.treeMinMax;c.minX=u.left,c.minY=u.top,c.maxX=u.right,c.maxY=u.bottom;var d=e.physicsType===h.DYNAMIC_BODY?this.tree.search(c):this.staticTree.search(c);for(a=d.length,o=0;o{t.exports={setAcceleration:function(t,e){return this.body.acceleration.set(t,e),this},setAccelerationX:function(t){return this.body.acceleration.x=t,this},setAccelerationY:function(t){return this.body.acceleration.y=t,this}}},59023:t=>{t.exports={setAngularVelocity:function(t){return this.body.angularVelocity=t,this},setAngularAcceleration:function(t){return this.body.angularAcceleration=t,this},setAngularDrag:function(t){return this.body.angularDrag=t,this}}},62069:t=>{t.exports={setBounce:function(t,e){return this.body.bounce.set(t,e),this},setBounceX:function(t){return this.body.bounce.x=t,this},setBounceY:function(t){return this.body.bounce.y=t,this},setCollideWorldBounds:function(t,e,i,s){return this.body.setCollideWorldBounds(t,e,i,s),this}}},78389:(t,e,i)=>{var s=i(79599),n={setCollisionCategory:function(t){return(this.body?this.body:this).collisionCategory=t,this},willCollideWith:function(t){return!!((this.body?this.body:this).collisionMask&t)},addCollidesWith:function(t){var e=this.body?this.body:this;return e.collisionMask=e.collisionMask|t,this},removeCollidesWith:function(t){var e=this.body?this.body:this;return e.collisionMask=e.collisionMask&~t,this},setCollidesWith:function(t){return(this.body?this.body:this).collisionMask=s(t),this},resetCollisionCategory:function(){var t=this.body?this.body:this;return t.collisionCategory=1,t.collisionMask=1,this}};t.exports=n},87118:t=>{t.exports={setDebug:function(t,e,i){return this.debugShowBody=t,this.debugShowVelocity=e,this.debugBodyColor=i,this},setDebugBodyColor:function(t){return this.body.debugBodyColor=t,this},debugShowBody:{get:function(){return this.body.debugShowBody},set:function(t){this.body.debugShowBody=t}},debugShowVelocity:{get:function(){return this.body.debugShowVelocity},set:function(t){this.body.debugShowVelocity=t}},debugBodyColor:{get:function(){return this.body.debugBodyColor},set:function(t){this.body.debugBodyColor=t}}}},52819:t=>{t.exports={setDrag:function(t,e){return this.body.drag.set(t,e),this},setDragX:function(t){return this.body.drag.x=t,this},setDragY:function(t){return this.body.drag.y=t,this},setDamping:function(t){return this.body.useDamping=t,this}}},4074:t=>{t.exports={setDirectControl:function(t){return this.body.setDirectControl(t),this},enableBody:function(t,e,i,s,n){return t&&this.body.reset(e,i),s&&(this.body.gameObject.active=!0),n&&(this.body.gameObject.visible=!0),this.body.enable=!0,this},disableBody:function(t,e){return void 0===t&&(t=!1),void 0===e&&(e=!1),this.body.stop(),this.body.enable=!1,t&&(this.body.gameObject.active=!1),e&&(this.body.gameObject.visible=!1),this},refreshBody:function(){return this.body.updateFromGameObject(),this}}},40831:t=>{t.exports={setFriction:function(t,e){return this.body.friction.set(t,e),this},setFrictionX:function(t){return this.body.friction.x=t,this},setFrictionY:function(t){return this.body.friction.y=t,this}}},26775:t=>{t.exports={setGravity:function(t,e){return this.body.gravity.set(t,e),this},setGravityX:function(t){return this.body.gravity.x=t,this},setGravityY:function(t){return this.body.gravity.y=t,this}}},9437:t=>{t.exports={setImmovable:function(t){return void 0===t&&(t=!0),this.body.immovable=t,this}}},30621:t=>{t.exports={setMass:function(t){return this.body.mass=t,this}}},72441:(t,e,i)=>{var s=i(47956),n=i(96503),r=i(2044),o=i(81491);t.exports=function(t,e,i,a,h,l){var u=s(t,e-a,i-a,2*a,2*a,h,l);if(0===u.length)return u;for(var c=new n(e,i,a),d=new n,f=[],p=0;p{t.exports=function(t,e,i,s,n,r,o){void 0===r&&(r=!0),void 0===o&&(o=!1);var a=[],h=[],l=t.treeMinMax;if(l.minX=e,l.minY=i,l.maxX=e+s,l.maxY=i+n,o&&(h=t.staticTree.search(l)),r&&t.useTree)a=t.tree.search(l);else if(r){var u=t.bodies,c={position:{x:e,y:i},left:e,top:i,right:e+s,bottom:i+n,isCircle:!1},d=t.intersects;u.iterate((function(t){d(t,c)&&a.push(t)}))}return h.concat(a)}},62121:t=>{t.exports={setPushable:function(t){return void 0===t&&(t=!0),this.body.pushable=t,this}}},29384:t=>{t.exports={setOffset:function(t,e){return this.body.setOffset(t,e),this},setSize:function(t,e,i){return this.body.setSize(t,e,i),this},setBodySize:function(t,e,i){return this.body.setSize(t,e,i),this},setCircle:function(t,e,i){return this.body.setCircle(t,e,i),this}}},15098:t=>{t.exports={setVelocity:function(t,e){return this.body.setVelocity(t,e),this},setVelocityX:function(t){return this.body.setVelocityX(t),this},setVelocityY:function(t){return this.body.setVelocityY(t),this},setMaxVelocity:function(t,e){return this.body.maxVelocity.set(t,e),this}}},92209:(t,e,i)=>{t.exports={Acceleration:i(1093),Angular:i(59023),Bounce:i(62069),Collision:i(78389),Debug:i(87118),Drag:i(52819),Enable:i(4074),Friction:i(40831),Gravity:i(26775),Immovable:i(9437),Mass:i(30621),OverlapCirc:i(72441),OverlapRect:i(47956),Pushable:i(62121),Size:i(29384),Velocity:i(15098)}},37747:t=>{t.exports={DYNAMIC_BODY:0,STATIC_BODY:1,GROUP:2,TILEMAPLAYER:3,FACING_NONE:10,FACING_UP:11,FACING_DOWN:12,FACING_LEFT:13,FACING_RIGHT:14}},20009:t=>{t.exports="collide"},36768:t=>{t.exports="overlap"},60473:t=>{t.exports="pause"},89954:t=>{t.exports="resume"},61804:t=>{t.exports="tilecollide"},7161:t=>{t.exports="tileoverlap"},34689:t=>{t.exports="worldbounds"},16006:t=>{t.exports="worldstep"},63012:(t,e,i)=>{t.exports={COLLIDE:i(20009),OVERLAP:i(36768),PAUSE:i(60473),RESUME:i(89954),TILE_COLLIDE:i(61804),TILE_OVERLAP:i(7161),WORLD_BOUNDS:i(34689),WORLD_STEP:i(16006)}},27064:(t,e,i)=>{var s=i(37747),n=i(79291),r={ArcadePhysics:i(86689),Body:i(37742),Collider:i(79342),Components:i(92209),Events:i(63012),Factory:i(66022),GetCollidesWith:i(79599),GetOverlapX:i(64897),GetOverlapY:i(45170),SeparateX:i(14087),SeparateY:i(89936),Group:i(60758),Image:i(71289),Sprite:i(13759),StaticBody:i(72624),StaticGroup:i(71464),Tilemap:i(55173),World:i(82248)};r=n(!1,r,s),t.exports=r},96602:t=>{t.exports=function(t,e){return t.collisionCallback?!t.collisionCallback.call(t.collisionCallbackContext,e,t):!t.layer.callbacks[t.index]||!t.layer.callbacks[t.index].callback.call(t.layer.callbacks[t.index].callbackContext,e,t)}},36294:t=>{t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.left=!0):e>0&&(t.blocked.none=!1,t.blocked.right=!0),t.position.x-=e,t.updateCenter(),0===t.bounce.x?t.velocity.x=0:t.velocity.x=-t.velocity.x*t.bounce.x}},67013:t=>{t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):e>0&&(t.blocked.none=!1,t.blocked.down=!0),t.position.y-=e,t.updateCenter(),0===t.bounce.y?t.velocity.y=0:t.velocity.y=-t.velocity.y*t.bounce.y}},40012:(t,e,i)=>{var s=i(21329),n=i(53442),r=i(2483);t.exports=function(t,e,i,o,a,h,l){var u=o.left,c=o.top,d=o.right,f=o.bottom,p=i.faceLeft||i.faceRight,v=i.faceTop||i.faceBottom;if(l||(p=!0,v=!0),!p&&!v)return!1;var g=0,m=0,y=0,x=1;if(e.deltaAbsX()>e.deltaAbsY()?y=-1:e.deltaAbsX(){var s=i(36294);t.exports=function(t,e,i,n,r,o){var a=0,h=e.faceLeft,l=e.faceRight,u=e.collideLeft,c=e.collideRight;return o||(h=!0,l=!0,u=!0,c=!0),t.deltaX()<0&&c&&t.checkCollision.left?l&&t.x0&&u&&t.checkCollision.right&&h&&t.right>i&&(a=t.right-i)>r&&(a=0),0!==a&&(t.customSeparateX?t.overlapX=a:s(t,a)),a}},53442:(t,e,i)=>{var s=i(67013);t.exports=function(t,e,i,n,r,o){var a=0,h=e.faceTop,l=e.faceBottom,u=e.collideUp,c=e.collideDown;return o||(h=!0,l=!0,u=!0,c=!0),t.deltaY()<0&&c&&t.checkCollision.up?l&&t.y0&&u&&t.checkCollision.down&&h&&t.bottom>i&&(a=t.bottom-i)>r&&(a=0),0!==a&&(t.customSeparateY?t.overlapY=a:s(t,a)),a}},2483:t=>{t.exports=function(t,e){return!(e.right<=t.left||e.bottom<=t.top||e.position.x>=t.right||e.position.y>=t.bottom)}},55173:(t,e,i)=>{var s={ProcessTileCallbacks:i(96602),ProcessTileSeparationX:i(36294),ProcessTileSeparationY:i(67013),SeparateTile:i(40012),TileCheckX:i(21329),TileCheckY:i(53442),TileIntersectsBody:i(2483)};t.exports=s},44563:(t,e,i)=>{t.exports={Arcade:i(27064),Matter:i(3875)}},68174:(t,e,i)=>{var s=i(83419),n=i(26099),r=new s({initialize:function(){this.boundsCenter=new n,this.centerDiff=new n},parseBody:function(t){if(!(t=t.hasOwnProperty("body")?t.body:t).hasOwnProperty("bounds")||!t.hasOwnProperty("centerOfMass"))return!1;var e=this.boundsCenter,i=this.centerDiff,s=t.bounds.max.x-t.bounds.min.x,n=t.bounds.max.y-t.bounds.min.y,r=s*t.centerOfMass.x,o=n*t.centerOfMass.y;return e.set(s/2,n/2),i.set(r-e.x,o-e.y),!0},getTopLeft:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e+s.x+r.x,i+s.y+r.y)}return!1},getTopCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e+r.x,i+s.y+r.y)}return!1},getTopRight:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e-(s.x-r.x),i+s.y+r.y)}return!1},getLeftCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e+s.x+r.x,i+r.y)}return!1},getCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.centerDiff;return new n(e+s.x,i+s.y)}return!1},getRightCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e-(s.x-r.x),i+r.y)}return!1},getBottomLeft:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e+s.x+r.x,i-(s.y-r.y))}return!1},getBottomCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e+r.x,i-(s.y-r.y))}return!1},getBottomRight:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e-(s.x-r.x),i-(s.y-r.y))}return!1}});t.exports=r},19933:(t,e,i)=>{var s=i(6790);s.Body=i(22562),s.Composite=i(69351),s.World=i(4372),s.Collision=i(52284),s.Detector=i(81388),s.Pairs=i(99561),s.Pair=i(4506),s.Query=i(73296),s.Resolver=i(66272),s.Constraint=i(48140),s.Common=i(53402),s.Engine=i(48413),s.Events=i(35810),s.Sleeping=i(53614),s.Plugin=i(73832),s.Bodies=i(66280),s.Composites=i(74116),s.Axes=i(66615),s.Bounds=i(15647),s.Svg=i(74058),s.Vector=i(31725),s.Vertices=i(41598),s.World.add=s.Composite.add,s.World.remove=s.Composite.remove,s.World.addComposite=s.Composite.addComposite,s.World.addBody=s.Composite.addBody,s.World.addConstraint=s.Composite.addConstraint,s.World.clear=s.Composite.clear,t.exports=s},28137:(t,e,i)=>{var s=i(66280),n=i(83419),r=i(74116),o=i(48140),a=i(74058),h=i(75803),l=i(23181),u=i(34803),c=i(73834),d=i(19496),f=i(85791),p=i(98713),v=i(41598),g=new n({initialize:function(t){this.world=t,this.scene=t.scene,this.sys=t.scene.sys},rectangle:function(t,e,i,n,r){var o=s.rectangle(t,e,i,n,r);return this.world.add(o),o},trapezoid:function(t,e,i,n,r,o){var a=s.trapezoid(t,e,i,n,r,o);return this.world.add(a),a},circle:function(t,e,i,n,r){var o=s.circle(t,e,i,n,r);return this.world.add(o),o},polygon:function(t,e,i,n,r){var o=s.polygon(t,e,i,n,r);return this.world.add(o),o},fromVertices:function(t,e,i,n,r,o,a){"string"==typeof i&&(i=v.fromPath(i));var h=s.fromVertices(t,e,i,n,r,o,a);return this.world.add(h),h},fromPhysicsEditor:function(t,e,i,s,n){void 0===n&&(n=!0);var r=d.parseBody(t,e,i,s);return n&&!this.world.has(r)&&this.world.add(r),r},fromSVG:function(t,e,i,n,r,o){void 0===n&&(n=1),void 0===r&&(r={}),void 0===o&&(o=!0);for(var h=i.getElementsByTagName("path"),l=[],u=0;u{var s=i(31884),n=i(95540),r=i(26099);t.exports=function(t,e,i,o){void 0===i&&(i={}),void 0===o&&(o=!0);var a=e.x,h=e.y;if(e.body={temp:!0,position:{x:a,y:h}},[s.Bounce,s.Collision,s.Force,s.Friction,s.Gravity,s.Mass,s.Sensor,s.SetBody,s.Sleep,s.Static,s.Transform,s.Velocity].forEach((function(t){for(var i in t)(s=t[i]).get&&"function"==typeof s.get||s.set&&"function"==typeof s.set?Object.defineProperty(e,i,{get:t[i].get,set:t[i].set}):Object.defineProperty(e,i,{value:t[i]});var s})),e.world=t,e._tempVec2=new r(a,h),i.hasOwnProperty("type")&&"body"===i.type)e.setExistingBody(i,o);else{var l=n(i,"shape",null);l||(l="rectangle"),i.addToWorld=o,e.setBody(l,i)}return e}},23181:(t,e,i)=>{var s=i(83419),n=i(31884),r=i(95643),o=i(95540),a=i(88571),h=i(72699),l=i(26099),u=new s({Extends:a,Mixins:[n.Bounce,n.Collision,n.Force,n.Friction,n.Gravity,n.Mass,n.Sensor,n.SetBody,n.Sleep,n.Static,n.Transform,n.Velocity,h],initialize:function(t,e,i,s,n,a){r.call(this,t.scene,"Image"),this._crop=this.resetCropObject(),this.setTexture(s,n),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new l(e,i);var h=o(a,"shape",null);h?this.setBody(h,a):this.setRectangle(this.width,this.height,a),this.setPosition(e,i),this.initPipeline(),this.initPostPipeline(!0)}});t.exports=u},42045:(t,e,i)=>{var s=i(60461),n=i(66615),r=i(66280),o=i(22562),a=i(68174),h=i(15647),l=i(83419),u=i(52284),c=i(53402),d=i(69351),f=i(74116),p=i(48140),v=i(81388),g=i(20339),m=i(28137),y=i(95540),x=i(35154),T=i(18210),w=i(40178),b=i(6790),S=i(74507),E=i(46975),A=i(4506),C=i(99561),_=i(73832),M=i(37277),P=i(73296),R=i(66272),L=i(44594),O=i(74058),F=i(31725),D=i(41598),k=i(68243);c.setDecomp(i(55973));var I=new l({initialize:function(t){this.scene=t,this.systems=t.sys,this.config=this.getConfig(),this.world,this.add,this.bodyBounds,this.body=o,this.composite=d,this.collision=u,this.detector=v,this.pair=A,this.pairs=C,this.query=P,this.resolver=R,this.constraint=p,this.bodies=r,this.composites=f,this.axes=n,this.bounds=h,this.svg=O,this.vector=F,this.vertices=D,this.verts=D,this._tempVec2=F.create(),x(this.config,"plugins.collisionevents",!0)&&this.enableCollisionEventsPlugin(),x(this.config,"plugins.attractors",!1)&&this.enableAttractorPlugin(),x(this.config,"plugins.wrap",!1)&&this.enableWrapPlugin(),R._restingThresh=x(this.config,"restingThresh",4),R._restingThreshTangent=x(this.config,"restingThreshTangent",6),R._positionDampen=x(this.config,"positionDampen",.9),R._positionWarming=x(this.config,"positionWarming",.8),R._frictionNormalMultiplier=x(this.config,"frictionNormalMultiplier",5),t.sys.events.once(L.BOOT,this.boot,this),t.sys.events.on(L.START,this.start,this)},boot:function(){this.world=new k(this.scene,this.config),this.add=new m(this.world),this.bodyBounds=new a,this.systems.events.once(L.DESTROY,this.destroy,this)},start:function(){this.world||(this.world=new k(this.scene,this.config),this.add=new m(this.world));var t=this.systems.events;t.on(L.UPDATE,this.world.update,this.world),t.on(L.POST_UPDATE,this.world.postUpdate,this.world),t.once(L.SHUTDOWN,this.shutdown,this)},getConfig:function(){var t=this.systems.game.config.physics,e=this.systems.settings.physics;return E(y(e,"matter",{}),y(t,"matter",{}))},enableAttractorPlugin:function(){return _.register(T),_.use(b,T),this},enableWrapPlugin:function(){return _.register(S),_.use(b,S),this},enableCollisionEventsPlugin:function(){return _.register(w),_.use(b,w),this},pause:function(){return this.world.pause()},resume:function(){return this.world.resume()},set60Hz:function(){return this.world.getDelta=this.world.update60Hz,this.world.autoUpdate=!0,this},set30Hz:function(){return this.world.getDelta=this.world.update30Hz,this.world.autoUpdate=!0,this},step:function(t,e){this.world.step(t,e)},containsPoint:function(t,e,i){t=this.getMatterBodies(t);var s=F.create(e,i);return P.point(t,s).length>0},intersectPoint:function(t,e,i){i=this.getMatterBodies(i);var s=F.create(t,e),n=[];return P.point(i,s).forEach((function(t){-1===n.indexOf(t)&&n.push(t)})),n},intersectRect:function(t,e,i,s,n,r){void 0===n&&(n=!1),r=this.getMatterBodies(r);var o={min:{x:t,y:e},max:{x:t+i,y:e+s}},a=[];return P.region(r,o,n).forEach((function(t){-1===a.indexOf(t)&&a.push(t)})),a},intersectRay:function(t,e,i,s,n,r){void 0===n&&(n=1),r=this.getMatterBodies(r);for(var o=[],a=P.ray(r,F.create(t,e),F.create(i,s),n),h=0;h{var s=i(9674),n=i(83419),r=i(31884),o=i(95643),a=i(95540),h=i(72699),l=i(68287),u=i(26099),c=new n({Extends:l,Mixins:[r.Bounce,r.Collision,r.Force,r.Friction,r.Gravity,r.Mass,r.Sensor,r.SetBody,r.Sleep,r.Static,r.Transform,r.Velocity,h],initialize:function(t,e,i,n,r,h){o.call(this,t.scene,"Sprite"),this._crop=this.resetCropObject(),this.anims=new s(this),this.setTexture(n,r),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new u(e,i);var l=a(h,"shape",null);l?this.setBody(l,h):this.setRectangle(this.width,this.height,h),this.setPosition(e,i),this.initPipeline(),this.initPostPipeline(!0)}});t.exports=c},73834:(t,e,i)=>{var s=i(66280),n=i(22562),r=i(83419),o=i(31884),a=i(62644),h=i(50792),l=i(95540),u=i(97022),c=i(41598),d=new r({Extends:h,Mixins:[o.Bounce,o.Collision,o.Friction,o.Gravity,o.Mass,o.Sensor,o.Sleep,o.Static],initialize:function(t,e,i){h.call(this),this.tile=e,this.world=t,e.physics.matterBody&&e.physics.matterBody.destroy(),e.physics.matterBody=this;var s=l(i,"body",null),r=l(i,"addToWorld",!0);if(s)this.setBody(s,r);else{var o=e.getCollisionGroup();l(o,"objects",[]).length>0?this.setFromTileCollision(i):this.setFromTileRectangle(i)}if(e.flipX||e.flipY){var a={x:e.getCenterX(),y:e.getCenterY()},u=e.flipX?-1:1,c=e.flipY?-1:1;n.scale(s,u,c,a)}},setFromTileRectangle:function(t){void 0===t&&(t={}),u(t,"isStatic")||(t.isStatic=!0),u(t,"addToWorld")||(t.addToWorld=!0);var e=this.tile.getBounds(),i=e.x+e.width/2,n=e.y+e.height/2,r=s.rectangle(i,n,e.width,e.height,t);return this.setBody(r,t.addToWorld),this},setFromTileCollision:function(t){void 0===t&&(t={}),u(t,"isStatic")||(t.isStatic=!0),u(t,"addToWorld")||(t.addToWorld=!0);for(var e=this.tile.tilemapLayer.scaleX,i=this.tile.tilemapLayer.scaleY,r=this.tile.getLeft(),o=this.tile.getTop(),h=this.tile.getCollisionGroup(),d=l(h,"objects",[]),f=[],p=0;p1){var E=a(t);E.parts=f,this.setBody(n.create(E),E.addToWorld)}return this},setBody:function(t,e){return void 0===e&&(e=!0),this.body&&this.removeBody(),this.body=t,this.body.gameObject=this,e&&this.world.add(this.body),this},removeBody:function(){return this.body&&(this.world.remove(this.body),this.body.gameObject=void 0,this.body=void 0),this},destroy:function(){this.removeBody(),this.tile.physics.matterBody=void 0,this.removeAllListeners()}});t.exports=d},19496:(t,e,i)=>{var s=i(66280),n=i(22562),r=i(53402),o=i(95540),a=i(41598),h={parseBody:function(t,e,i,s){void 0===s&&(s={});for(var a=o(i,"fixtures",[]),h=[],l=0;l{var s=i(66280),n=i(22562),r={parseBody:function(t,e,i,r){var o;void 0===r&&(r={});var a=i.vertices;if(1===a.length)r.vertices=a[0],o=n.create(r),s.flagCoincidentParts(o.parts);else{for(var h=[],l=0;l{var s=i(15647),n=i(83419),r=i(69351),o=i(48140),a=i(81388),h=i(1121),l=i(8214),u=i(46975),c=i(53614),d=i(26099),f=i(41598),p=new n({initialize:function(t,e,i){void 0===i&&(i={}),this.scene=t,this.world=e,this.camera=null,this.pointer=null,this.active=!0,this.position=new d,this.body=null,this.part=null,this.constraint=o.create(u(i,{label:"Pointer Constraint",pointA:{x:0,y:0},pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,collisionFilter:{category:1,mask:4294967295,group:0}})),this.world.on(h.BEFORE_UPDATE,this.update,this),t.sys.input.on(l.POINTER_DOWN,this.onDown,this),t.sys.input.on(l.POINTER_UP,this.onUp,this)},onDown:function(t){this.pointer||(this.pointer=t,this.camera=t.camera)},onUp:function(t){t===this.pointer&&(this.pointer=null)},getBody:function(t){var e=this.position,i=this.constraint;this.camera.getWorldPoint(t.x,t.y,e);for(var n=r.allBodies(this.world.localWorld),o=0;o1?1:0;n{var s=i(66280),n=i(22562),r=i(83419),o=i(53402),a=i(69351),h=i(48413),l=i(50792),u=i(1121),c=i(95540),d=i(35154),f=i(22562),p=i(35810),v=i(73834),g=i(4372),m=i(31725),y=new r({Extends:l,initialize:function(t,e){l.call(this),this.scene=t,this.engine=h.create(e),this.localWorld=this.engine.world;var i=d(e,"gravity",null);i?this.setGravity(i.x,i.y,i.scale):!1===i&&this.setGravity(0,0,0),this.walls={left:null,right:null,top:null,bottom:null},this.enabled=d(e,"enabled",!0),this.getDelta=d(e,"getDelta",this.update60Hz);var s=c(e,"runner",{}),n=c(s,"fps",!1),r=c(s,"fps",60),o=c(s,"delta",1e3/r),a=c(s,"deltaMin",1e3/r),u=c(s,"deltaMax",1e3/(.5*r));n||(r=1e3/o),this.runner={fps:r,deltaSampleSize:c(s,"deltaSampleSize",60),counterTimestamp:0,frameCounter:0,deltaHistory:[],timePrev:null,timeScalePrev:1,frameRequestId:null,isFixed:c(s,"isFixed",!1),delta:o,deltaMin:a,deltaMax:u},this.autoUpdate=d(e,"autoUpdate",!0);var f=d(e,"debug",!1);if(this.drawDebug="object"==typeof f||f,this.debugGraphic,this.debugConfig={showAxes:c(f,"showAxes",!1),showAngleIndicator:c(f,"showAngleIndicator",!1),angleColor:c(f,"angleColor",15208787),showBroadphase:c(f,"showBroadphase",!1),broadphaseColor:c(f,"broadphaseColor",16757760),showBounds:c(f,"showBounds",!1),boundsColor:c(f,"boundsColor",16777215),showVelocity:c(f,"showVelocity",!1),velocityColor:c(f,"velocityColor",44783),showCollisions:c(f,"showCollisions",!1),collisionColor:c(f,"collisionColor",16094476),showSeparations:c(f,"showSeparations",!1),separationColor:c(f,"separationColor",16753920),showBody:c(f,"showBody",!0),showStaticBody:c(f,"showStaticBody",!0),showInternalEdges:c(f,"showInternalEdges",!1),renderFill:c(f,"renderFill",!1),renderLine:c(f,"renderLine",!0),fillColor:c(f,"fillColor",1075465),fillOpacity:c(f,"fillOpacity",1),lineColor:c(f,"lineColor",2678297),lineOpacity:c(f,"lineOpacity",1),lineThickness:c(f,"lineThickness",1),staticFillColor:c(f,"staticFillColor",857979),staticLineColor:c(f,"staticLineColor",1255396),showSleeping:c(f,"showSleeping",!1),staticBodySleepOpacity:c(f,"staticBodySleepOpacity",.7),sleepFillColor:c(f,"sleepFillColor",4605510),sleepLineColor:c(f,"sleepLineColor",10066585),showSensors:c(f,"showSensors",!0),sensorFillColor:c(f,"sensorFillColor",857979),sensorLineColor:c(f,"sensorLineColor",1255396),showPositions:c(f,"showPositions",!0),positionSize:c(f,"positionSize",4),positionColor:c(f,"positionColor",14697178),showJoint:c(f,"showJoint",!0),jointColor:c(f,"jointColor",14737474),jointLineOpacity:c(f,"jointLineOpacity",1),jointLineThickness:c(f,"jointLineThickness",2),pinSize:c(f,"pinSize",4),pinColor:c(f,"pinColor",4382944),springColor:c(f,"springColor",14697184),anchorColor:c(f,"anchorColor",15724527),anchorSize:c(f,"anchorSize",4),showConvexHulls:c(f,"showConvexHulls",!1),hullColor:c(f,"hullColor",14091216)},this.drawDebug&&this.createDebugGraphic(),this.setEventsProxy(),c(e,"setBounds",!1)){var p=e.setBounds;if("boolean"==typeof p)this.setBounds();else{var v=c(p,"x",0),g=c(p,"y",0),m=c(p,"width",t.sys.scale.width),y=c(p,"height",t.sys.scale.height),x=c(p,"thickness",64),T=c(p,"left",!0),w=c(p,"right",!0),b=c(p,"top",!0),S=c(p,"bottom",!0);this.setBounds(v,g,m,y,x,T,w,b,S)}}},setCompositeRenderStyle:function(t){var e,i,s,n=t.bodies,r=t.constraints,o=t.composites;for(e=0;e0&&(i=n[0].bodyA,s=n[0].bodyB),t.emit(u.COLLISION_START,e,i,s)})),p.on(e,"collisionActive",(function(e){var i,s,n=e.pairs;n.length>0&&(i=n[0].bodyA,s=n[0].bodyB),t.emit(u.COLLISION_ACTIVE,e,i,s)})),p.on(e,"collisionEnd",(function(e){var i,s,n=e.pairs;n.length>0&&(i=n[0].bodyA,s=n[0].bodyB),t.emit(u.COLLISION_END,e,i,s)}))},setBounds:function(t,e,i,s,n,r,o,a,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.scale.width),void 0===s&&(s=this.scene.sys.scale.height),void 0===n&&(n=64),void 0===r&&(r=!0),void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===h&&(h=!0),this.updateWall(r,"left",t-n,e-n,n,s+2*n),this.updateWall(o,"right",t+i,e-n,n,s+2*n),this.updateWall(a,"top",t,e-n,i,n),this.updateWall(h,"bottom",t,e+s,i,n),this},updateWall:function(t,e,i,s,n,r){var o=this.walls[e];t?(o&&g.remove(this.localWorld,o),i+=n/2,s+=r/2,this.walls[e]=this.create(i,s,n,r,{isStatic:!0,friction:0,frictionStatic:0})):(o&&g.remove(this.localWorld,o),this.walls[e]=null)},createDebugGraphic:function(){var t=this.scene.sys.add.graphics({x:0,y:0});return t.setDepth(Number.MAX_VALUE),this.debugGraphic=t,this.drawDebug=!0,t},disableGravity:function(){return this.localWorld.gravity.x=0,this.localWorld.gravity.y=0,this.localWorld.gravity.scale=0,this},setGravity:function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=.001),this.localWorld.gravity.x=t,this.localWorld.gravity.y=e,this.localWorld.gravity.scale=i,this},create:function(t,e,i,n,r){var o=s.rectangle(t,e,i,n,r);return g.add(this.localWorld,o),o},add:function(t){return g.add(this.localWorld,t),this},remove:function(t,e){Array.isArray(t)||(t=[t]);for(var i=0;is.deltaMax?s.deltaMax:e,s.delta=e),s.timeScalePrev=n.timeScale,s.frameCounter+=1,t-s.counterTimestamp>=1e3&&(s.fps=s.frameCounter*((t-s.counterTimestamp)/1e3),s.counterTimestamp=t,s.frameCounter=0),h.update(i,e)}},step:function(t){h.update(this.engine,t)},update60Hz:function(){return 1e3/60},update30Hz:function(){return 1e3/30},has:function(t){var e=t.hasOwnProperty("body")?t.body:t;return null!==a.get(this.localWorld,e.id,e.type)},getAllBodies:function(){return a.allBodies(this.localWorld)},getAllConstraints:function(){return a.allConstraints(this.localWorld)},getAllComposites:function(){return a.allComposites(this.localWorld)},postUpdate:function(){if(this.drawDebug){var t=this.debugConfig,e=this.engine,i=this.debugGraphic,s=a.allBodies(this.localWorld);this.debugGraphic.clear(),t.showBroadphase&&e.broadphase.controller&&this.renderGrid(e.broadphase,i,t.broadphaseColor,.5),t.showBounds&&this.renderBodyBounds(s,i,t.boundsColor,.5),(t.showBody||t.showStaticBody)&&this.renderBodies(s),t.showJoint&&this.renderJoints(),(t.showAxes||t.showAngleIndicator)&&this.renderBodyAxes(s,i,t.showAxes,t.angleColor,.5),t.showVelocity&&this.renderBodyVelocity(s,i,t.velocityColor,1,2),t.showSeparations&&this.renderSeparations(e.pairs.list,i,t.separationColor),t.showCollisions&&this.renderCollisions(e.pairs.list,i,t.collisionColor)}},renderGrid:function(t,e,i,s){e.lineStyle(1,i,s);for(var n=o.keys(t.buckets),r=0;r0){var l=h[0].vertex.x,u=h[0].vertex.y;2===h.length&&(l=(h[0].vertex.x+h[1].vertex.x)/2,u=(h[0].vertex.y+h[1].vertex.y)/2),a.bodyB===a.supports[0].body||a.bodyA.isStatic?e.lineBetween(l-8*a.normal.x,u-8*a.normal.y,l,u):e.lineBetween(l+8*a.normal.x,u+8*a.normal.y,l,u)}}return this},renderBodyBounds:function(t,e,i,s){e.lineStyle(1,i,s);for(var n=0;n1?1:0;h1?1:0;a1?1:0;a1&&this.renderConvexHull(v,e,f,y)}}},renderBody:function(t,e,i,s,n,r,o,a){void 0===s&&(s=null),void 0===n&&(n=null),void 0===r&&(r=1),void 0===o&&(o=null),void 0===a&&(a=null);for(var h=this.debugConfig,l=h.sensorFillColor,u=h.sensorLineColor,c=t.parts,d=c.length,f=d>1?1:0;f1){var n=t.vertices;e.lineStyle(s,i),e.beginPath(),e.moveTo(n[0].x,n[0].y);for(var r=1;r0&&(e.fillStyle(a),e.fillCircle(u.x,u.y,h),e.fillCircle(c.x,c.y,h)),this},resetCollisionIDs:function(){return n._nextCollidingGroupId=1,n._nextNonCollidingGroupId=-1,n._nextCategory=1,this},shutdown:function(){p.off(this.engine),this.removeAllListeners(),g.clear(this.localWorld,!1),h.clear(this.engine),this.drawDebug&&this.debugGraphic.destroy()},destroy:function(){this.shutdown()}});t.exports=y},70410:t=>{t.exports={setBounce:function(t){return this.body.restitution=t,this}}},66968:t=>{var e={setCollisionCategory:function(t){return this.body.collisionFilter.category=t,this},setCollisionGroup:function(t){return this.body.collisionFilter.group=t,this},setCollidesWith:function(t){var e=0;if(Array.isArray(t))for(var i=0;i{var s=i(22562),n={applyForce:function(t){return this._tempVec2.set(this.body.position.x,this.body.position.y),s.applyForce(this.body,this._tempVec2,t),this},applyForceFrom:function(t,e){return s.applyForce(this.body,t,e),this},thrust:function(t){var e=this.body.angle;return this._tempVec2.set(t*Math.cos(e),t*Math.sin(e)),s.applyForce(this.body,{x:this.body.position.x,y:this.body.position.y},this._tempVec2),this},thrustLeft:function(t){var e=this.body.angle-Math.PI/2;return this._tempVec2.set(t*Math.cos(e),t*Math.sin(e)),s.applyForce(this.body,{x:this.body.position.x,y:this.body.position.y},this._tempVec2),this},thrustRight:function(t){var e=this.body.angle+Math.PI/2;return this._tempVec2.set(t*Math.cos(e),t*Math.sin(e)),s.applyForce(this.body,{x:this.body.position.x,y:this.body.position.y},this._tempVec2),this},thrustBack:function(t){var e=this.body.angle-Math.PI;return this._tempVec2.set(t*Math.cos(e),t*Math.sin(e)),s.applyForce(this.body,{x:this.body.position.x,y:this.body.position.y},this._tempVec2),this}};t.exports=n},5436:t=>{t.exports={setFriction:function(t,e,i){return this.body.friction=t,void 0!==e&&(this.body.frictionAir=e),void 0!==i&&(this.body.frictionStatic=i),this},setFrictionAir:function(t){return this.body.frictionAir=t,this},setFrictionStatic:function(t){return this.body.frictionStatic=t,this}}},39858:t=>{t.exports={setIgnoreGravity:function(t){return this.body.ignoreGravity=t,this}}},37302:(t,e,i)=>{var s=i(22562),n=i(26099),r={setMass:function(t){return s.setMass(this.body,t),this},setDensity:function(t){return s.setDensity(this.body,t),this},centerOfMass:{get:function(){return new n(this.body.centerOfMass.x,this.body.centerOfMass.y)}}};t.exports=r},39132:t=>{t.exports={setSensor:function(t){return this.body.isSensor=t,this},isSensor:function(){return this.body.isSensor}}},57772:(t,e,i)=>{var s=i(66280),n=i(22562),r=i(43855),o=i(95540),a=i(19496),h=i(85791),l=i(41598),u={setRectangle:function(t,e,i){return this.setBody({type:"rectangle",width:t,height:e},i)},setCircle:function(t,e){return this.setBody({type:"circle",radius:t},e)},setPolygon:function(t,e,i){return this.setBody({type:"polygon",sides:e,radius:t},i)},setTrapezoid:function(t,e,i,s){return this.setBody({type:"trapezoid",width:t,height:e,slope:i},s)},setExistingBody:function(t,e){void 0===e&&(e=!0),this.body&&this.world.remove(this.body,!0),this.body=t;for(var i=0;i{var s=i(1121),n=i(53614),r=i(35810),o={setToSleep:function(){return n.set(this.body,!0),this},setAwake:function(){return n.set(this.body,!1),this},setSleepThreshold:function(t){return void 0===t&&(t=60),this.body.sleepThreshold=t,this},setSleepEvents:function(t,e){return this.setSleepStartEvent(t),this.setSleepEndEvent(e),this},setSleepStartEvent:function(t){if(t){var e=this.world;r.on(this.body,"sleepStart",(function(t){e.emit(s.SLEEP_START,t,this)}))}else r.off(this.body,"sleepStart");return this},setSleepEndEvent:function(t){if(t){var e=this.world;r.on(this.body,"sleepEnd",(function(t){e.emit(s.SLEEP_END,t,this)}))}else r.off(this.body,"sleepEnd");return this}};t.exports=o},90556:(t,e,i)=>{var s=i(22562),n={setStatic:function(t){return s.setStatic(this.body,t),this},isStatic:function(){return this.body.isStatic}};t.exports=n},85436:(t,e,i)=>{var s=i(22562),n=i(36383),r=i(86554),o=i(30954),a={x:{get:function(){return this.body.position.x},set:function(t){this._tempVec2.set(t,this.y),s.setPosition(this.body,this._tempVec2)}},y:{get:function(){return this.body.position.y},set:function(t){this._tempVec2.set(this.x,t),s.setPosition(this.body,this._tempVec2)}},scaleX:{get:function(){return this._scaleX},set:function(t){var e=1/this._scaleX,i=1/this._scaleY;this._scaleX=t,0===this._scaleX?this.renderFlags&=-5:this.renderFlags|=4,s.scale(this.body,e,i),s.scale(this.body,t,this._scaleY)}},scaleY:{get:function(){return this._scaleY},set:function(t){var e=1/this._scaleX,i=1/this._scaleY;this._scaleY=t,0===this._scaleY?this.renderFlags&=-5:this.renderFlags|=4,s.scale(this.body,e,i),s.scale(this.body,this._scaleX,t)}},angle:{get:function(){return o(this.body.angle*n.RAD_TO_DEG)},set:function(t){this.rotation=o(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this.body.angle},set:function(t){this._rotation=r(t),s.setAngle(this.body,this._rotation)}},setPosition:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this._tempVec2.set(t,e),s.setPosition(this.body,this._tempVec2),this},setRotation:function(t){return void 0===t&&(t=0),this._rotation=r(t),s.setAngle(this.body,t),this},setFixedRotation:function(){return s.setInertia(this.body,1/0),this},setAngle:function(t){return void 0===t&&(t=0),this.angle=t,s.setAngle(this.body,this.rotation),this},setScale:function(t,e,i){void 0===t&&(t=1),void 0===e&&(e=t);var n=1/this._scaleX,r=1/this._scaleY;return this._scaleX=t,this._scaleY=e,s.scale(this.body,n,r,i),s.scale(this.body,t,e,i),this}};t.exports=a},42081:(t,e,i)=>{var s=i(22562),n={setVelocityX:function(t){return this._tempVec2.set(t,this.body.velocity.y),s.setVelocity(this.body,this._tempVec2),this},setVelocityY:function(t){return this._tempVec2.set(this.body.velocity.x,t),s.setVelocity(this.body,this._tempVec2),this},setVelocity:function(t,e){return this._tempVec2.set(t,e),s.setVelocity(this.body,this._tempVec2),this},getVelocity:function(){return s.getVelocity(this.body)},setAngularVelocity:function(t){return s.setAngularVelocity(this.body,t),this},getAngularVelocity:function(){return s.getAngularVelocity(this.body)},setAngularSpeed:function(t){return s.setAngularSpeed(this.body,t),this},getAngularSpeed:function(){return s.getAngularSpeed(this.body)}};t.exports=n},31884:(t,e,i)=>{t.exports={Bounce:i(70410),Collision:i(66968),Force:i(51607),Friction:i(5436),Gravity:i(39858),Mass:i(37302),Sensor:i(39132),SetBody:i(57772),Sleep:i(38083),Static:i(90556),Transform:i(85436),Velocity:i(42081)}},85608:t=>{t.exports="afteradd"},1213:t=>{t.exports="afterremove"},25968:t=>{t.exports="afterupdate"},67205:t=>{t.exports="beforeadd"},39438:t=>{t.exports="beforeremove"},44823:t=>{t.exports="beforeupdate"},92593:t=>{t.exports="collisionactive"},60128:t=>{t.exports="collisionend"},76861:t=>{t.exports="collisionstart"},92362:t=>{t.exports="dragend"},76408:t=>{t.exports="drag"},93971:t=>{t.exports="dragstart"},5656:t=>{t.exports="pause"},47861:t=>{t.exports="resume"},79099:t=>{t.exports="sleepend"},35906:t=>{t.exports="sleepstart"},1121:(t,e,i)=>{t.exports={AFTER_ADD:i(85608),AFTER_REMOVE:i(1213),AFTER_UPDATE:i(25968),BEFORE_ADD:i(67205),BEFORE_REMOVE:i(39438),BEFORE_UPDATE:i(44823),COLLISION_ACTIVE:i(92593),COLLISION_END:i(60128),COLLISION_START:i(76861),DRAG_END:i(92362),DRAG:i(76408),DRAG_START:i(93971),PAUSE:i(5656),RESUME:i(47861),SLEEP_END:i(79099),SLEEP_START:i(35906)}},3875:(t,e,i)=>{t.exports={BodyBounds:i(68174),Components:i(31884),Events:i(1121),Factory:i(28137),MatterGameObject:i(75803),Image:i(23181),Matter:i(19933),MatterPhysics:i(42045),PolyDecomp:i(55973),Sprite:i(34803),TileBody:i(73834),PhysicsEditorParser:i(19496),PhysicsJSONParser:i(85791),PointerConstraint:i(98713),World:i(68243)}},22562:(t,e,i)=>{var s={};t.exports=s;var n=i(41598),r=i(31725),o=i(53614),a=i(53402),h=i(15647),l=i(66615);!function(){s._timeCorrection=!0,s._inertiaScale=4,s._nextCollidingGroupId=1,s._nextNonCollidingGroupId=-1,s._nextCategory=1,s._baseDelta=1e3/60,s.create=function(e){var i={id:a.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:null,position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inverseMass:0,inertia:0,deltaTime:1e3/60,inverseInertia:0,_original:null,render:{visible:!0,opacity:1,sprite:{xOffset:0,yOffset:0},fillColor:null,fillOpacity:null,lineColor:null,lineOpacity:null,lineThickness:null},gameObject:null,scale:{x:1,y:1},centerOfMass:{x:0,y:0},centerOffset:{x:0,y:0},gravityScale:{x:1,y:1},ignoreGravity:!1,ignorePointer:!1,onCollideCallback:null,onCollideEndCallback:null,onCollideActiveCallback:null,onCollideWith:{}};!e.hasOwnProperty("position")&&e.hasOwnProperty("vertices")?e.position=n.centre(e.vertices):e.hasOwnProperty("vertices")||(i.vertices=n.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"));var s=a.extend(i,e);return t(s,e),s.setOnCollideWith=function(t,e){return e?this.onCollideWith[t.id]=e:delete this.onCollideWith[t.id],this},s},s.nextGroup=function(t){return t?s._nextNonCollidingGroupId--:s._nextCollidingGroupId++},s.nextCategory=function(){return s._nextCategory=s._nextCategory<<1,s._nextCategory};var t=function(t,e){if(e=e||{},s.set(t,{bounds:t.bounds||h.create(t.vertices),positionPrev:t.positionPrev||r.clone(t.position),anglePrev:t.anglePrev||t.angle,vertices:t.vertices,parts:t.parts||[t],isStatic:t.isStatic,isSleeping:t.isSleeping,parent:t.parent||t}),n.rotate(t.vertices,t.angle,t.position),l.rotate(t.axes,t.angle),h.update(t.bounds,t.vertices,t.velocity),s.set(t,{axes:e.axes||t.axes,area:e.area||t.area,mass:e.mass||t.mass,inertia:e.inertia||t.inertia}),1===t.parts.length){var i=t.bounds,o=t.centerOfMass,a=t.centerOffset,u=i.max.x-i.min.x,c=i.max.y-i.min.y;o.x=-(i.min.x-t.position.x)/u,o.y=-(i.min.y-t.position.y)/c,a.x=u*o.x,a.y=c*o.y}};s.set=function(t,e,i){var n;for(n in"string"==typeof e&&(n=e,(e={})[n]=i),e)if(Object.prototype.hasOwnProperty.call(e,n))switch(i=e[n],n){case"isStatic":s.setStatic(t,i);break;case"isSleeping":o.set(t,i);break;case"mass":s.setMass(t,i);break;case"density":s.setDensity(t,i);break;case"inertia":s.setInertia(t,i);break;case"vertices":s.setVertices(t,i);break;case"position":s.setPosition(t,i);break;case"angle":s.setAngle(t,i);break;case"velocity":s.setVelocity(t,i);break;case"angularVelocity":s.setAngularVelocity(t,i);break;case"speed":s.setSpeed(t,i);break;case"angularSpeed":s.setAngularSpeed(t,i);break;case"parts":s.setParts(t,i);break;case"centre":s.setCentre(t,i);break;default:t[n]=i}},s.setStatic=function(t,e){for(var i=0;i0&&r.rotateAbout(a.position,s,t.position,a.position)}},s.setVelocity=function(t,e){var i=t.deltaTime/s._baseDelta;t.positionPrev.x=t.position.x-e.x*i,t.positionPrev.y=t.position.y-e.y*i,t.velocity.x=(t.position.x-t.positionPrev.x)/i,t.velocity.y=(t.position.y-t.positionPrev.y)/i,t.speed=r.magnitude(t.velocity)},s.getVelocity=function(t){var e=s._baseDelta/t.deltaTime;return{x:(t.position.x-t.positionPrev.x)*e,y:(t.position.y-t.positionPrev.y)*e}},s.getSpeed=function(t){return r.magnitude(s.getVelocity(t))},s.setSpeed=function(t,e){s.setVelocity(t,r.mult(r.normalise(s.getVelocity(t)),e))},s.setAngularVelocity=function(t,e){var i=t.deltaTime/s._baseDelta;t.anglePrev=t.angle-e*i,t.angularVelocity=(t.angle-t.anglePrev)/i,t.angularSpeed=Math.abs(t.angularVelocity)},s.getAngularVelocity=function(t){return(t.angle-t.anglePrev)*s._baseDelta/t.deltaTime},s.getAngularSpeed=function(t){return Math.abs(s.getAngularVelocity(t))},s.setAngularSpeed=function(t,e){s.setAngularVelocity(t,a.sign(s.getAngularVelocity(t))*e)},s.translate=function(t,e,i){s.setPosition(t,r.add(t.position,e),i)},s.rotate=function(t,e,i,n){if(i){var r=Math.cos(e),o=Math.sin(e),a=t.position.x-i.x,h=t.position.y-i.y;s.setPosition(t,{x:i.x+(a*r-h*o),y:i.y+(a*o+h*r)},n),s.setAngle(t,t.angle+e,n)}else s.setAngle(t,t.angle+e,n)},s.scale=function(t,e,i,r){var o=0,a=0;r=r||t.position;for(var u=t.inertia===1/0,c=0;c0&&(o+=d.area,a+=d.inertia),d.position.x=r.x+(d.position.x-r.x)*e,d.position.y=r.y+(d.position.y-r.y)*i,h.update(d.bounds,d.vertices,t.velocity)}t.parts.length>1&&(t.area=o,t.isStatic||(s.setMass(t,t.density*o),s.setInertia(t,a))),t.circleRadius&&(e===i?t.circleRadius*=e:t.circleRadius=null),u&&s.setInertia(t,1/0)},s.update=function(t,e){var i=(e=(void 0!==e?e:1e3/60)*t.timeScale)*e,o=s._timeCorrection?e/(t.deltaTime||e):1,u=1-t.frictionAir*(e/a._baseDelta),c=(t.position.x-t.positionPrev.x)*o,d=(t.position.y-t.positionPrev.y)*o;t.velocity.x=c*u+t.force.x/t.mass*i,t.velocity.y=d*u+t.force.y/t.mass*i,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.position.x+=t.velocity.x,t.position.y+=t.velocity.y,t.deltaTime=e,t.angularVelocity=(t.angle-t.anglePrev)*u*o+t.torque/t.inertia*i,t.anglePrev=t.angle,t.angle+=t.angularVelocity,t.speed=r.magnitude(t.velocity),t.angularSpeed=Math.abs(t.angularVelocity);for(var f=0;f0&&(p.position.x+=t.velocity.x,p.position.y+=t.velocity.y),0!==t.angularVelocity&&(n.rotate(p.vertices,t.angularVelocity,t.position),l.rotate(p.axes,t.angularVelocity),f>0&&r.rotateAbout(p.position,t.angularVelocity,t.position,p.position)),h.update(p.bounds,p.vertices,t.velocity)}},s.updateVelocities=function(t){var e=s._baseDelta/t.deltaTime,i=t.velocity;i.x=(t.position.x-t.positionPrev.x)*e,i.y=(t.position.y-t.positionPrev.y)*e,t.speed=Math.sqrt(i.x*i.x+i.y*i.y),t.angularVelocity=(t.angle-t.anglePrev)*e,t.angularSpeed=Math.abs(t.angularVelocity)},s.applyForce=function(t,e,i){var s=e.x-t.position.x,n=e.y-t.position.y;t.force.x+=i.x,t.force.y+=i.y,t.torque+=s*i.y-n*i.x},s._totalProperties=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},i=1===t.parts.length?0:1;i{var s={};t.exports=s;var n=i(35810),r=i(53402),o=i(15647),a=i(22562);s.create=function(t){return r.extend({id:r.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{},cache:{allBodies:null,allConstraints:null,allComposites:null}},t)},s.setModified=function(t,e,i,r){if(n.trigger(t,"compositeModified",t),t.isModified=e,e&&t.cache&&(t.cache.allBodies=null,t.cache.allConstraints=null,t.cache.allComposites=null),i&&t.parent&&s.setModified(t.parent,e,i,r),r)for(var o=0;o{var s={};t.exports=s;var n=i(69351);s.create=n.create,s.add=n.add,s.remove=n.remove,s.clear=n.clear,s.addComposite=n.addComposite,s.addBody=n.addBody,s.addConstraint=n.addConstraint},52284:(t,e,i)=>{var s={};t.exports=s;var n,r,o,a=i(41598),h=i(4506);n=[],r={overlap:0,axis:null},o={overlap:0,axis:null},s.create=function(t,e){return{pair:null,collided:!1,bodyA:t,bodyB:e,parentA:t.parent,parentB:e.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[]}},s.collides=function(t,e,i){if(s._overlapAxes(r,t.vertices,e.vertices,t.axes),r.overlap<=0)return null;if(s._overlapAxes(o,e.vertices,t.vertices,e.axes),o.overlap<=0)return null;var n,l,u=i&&i.table[h.id(t,e)];u?n=u.collision:((n=s.create(t,e)).collided=!0,n.bodyA=t.idE?E=a:aA?A=a:an?n=o:o{var e={};t.exports=e,e.create=function(t){return{vertex:t,normalImpulse:0,tangentImpulse:0}}},81388:(t,e,i)=>{var s={};t.exports=s;var n=i(53402),r=i(52284);s.create=function(t){return n.extend({bodies:[],pairs:null},t)},s.setBodies=function(t,e){t.bodies=e.slice(0)},s.clear=function(t){t.bodies=[]},s.collisions=function(t){var e,i,n=[],o=t.pairs,a=t.bodies,h=a.length,l=s.canCollide,u=r.collides;for(a.sort(s._compareBoundsX),e=0;ef)break;if(!(p<_.min.y||v>_.max.y)&&(!g||!x.isStatic&&!x.isSleeping)&&l(c.collisionFilter,x.collisionFilter)){var T=x.parts.length;if(y&&1===T)(A=u(c,x,o))&&n.push(A);else for(var w=T>1?1:0,b=m>1?1:0;b_.max.x||d.max.x<_.min.x||d.max.y<_.min.y||d.min.y>_.max.y||(A=u(S,C,o))&&n.push(A)}}}}return n},s.canCollide=function(t,e){return t.group===e.group&&0!==t.group?t.group>0:!!(t.mask&e.category)&&!!(e.mask&t.category)},s._compareBoundsX=function(t,e){return t.bounds.min.x-e.bounds.min.x}},4506:(t,e,i)=>{var s={};t.exports=s;var n=i(43424);s.create=function(t,e){var i=t.bodyA,n=t.bodyB,r={id:s.id(i,n),bodyA:i,bodyB:n,collision:t,contacts:[],activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:i.isSensor||n.isSensor,timeCreated:e,timeUpdated:e,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return s.update(r,t,e),r},s.update=function(t,e,i){var s=t.contacts,r=e.supports,o=t.activeContacts,a=e.parentA,h=e.parentB,l=a.vertices.length;t.isActive=!0,t.timeUpdated=i,t.collision=e,t.separation=e.depth,t.inverseMass=a.inverseMass+h.inverseMass,t.friction=a.frictionh.frictionStatic?a.frictionStatic:h.frictionStatic,t.restitution=a.restitution>h.restitution?a.restitution:h.restitution,t.slop=a.slop>h.slop?a.slop:h.slop,e.pair=t,o.length=0;for(var u=0;u{var s={};t.exports=s;var n=i(4506),r=i(53402);s.create=function(t){return r.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},t)},s.update=function(t,e,i){var s,r,o,a,h=t.list,l=h.length,u=t.table,c=e.length,d=t.collisionStart,f=t.collisionEnd,p=t.collisionActive;for(d.length=0,f.length=0,p.length=0,a=0;a{var s={};t.exports=s;var n=i(31725),r=i(52284),o=i(15647),a=i(66280),h=i(41598);s.collides=function(t,e){for(var i=[],s=e.length,n=t.bounds,a=r.collides,h=o.overlaps,l=0;l{var s={};t.exports=s;var n=i(41598),r=i(53402),o=i(15647);s._restingThresh=2,s._restingThreshTangent=Math.sqrt(6),s._positionDampen=.9,s._positionWarming=.8,s._frictionNormalMultiplier=5,s._frictionMaxStatic=Number.MAX_VALUE,s.preSolvePosition=function(t){var e,i,s,n=t.length;for(e=0;eV?(n=Y>0?Y:-Y,(i=v.friction*(Y>0?1:-1)*l)<-n?i=-n:i>n&&(i=n)):(i=Y,n=f);var W=O*b-F*w,H=D*b-k*w,j=_/(M+m.inverseInertia*W*W+y.inverseInertia*H*H),q=(1+v.restitution)*X*j;if(i*=j,X0&&(R.normalImpulse=0),q=R.normalImpulse-K}if(Y<-c||Y>c)R.tangentImpulse=0;else{var Z=R.tangentImpulse;R.tangentImpulse+=i,R.tangentImpulse<-n&&(R.tangentImpulse=-n),R.tangentImpulse>n&&(R.tangentImpulse=n),i=R.tangentImpulse-Z}var J=w*q+S*i,Q=b*q+E*i;m.isStatic||m.isSleeping||(m.positionPrev.x+=J*m.inverseMass,m.positionPrev.y+=Q*m.inverseMass,m.anglePrev+=(O*Q-F*J)*m.inverseInertia),y.isStatic||y.isSleeping||(y.positionPrev.x-=J*y.inverseMass,y.positionPrev.y-=Q*y.inverseMass,y.anglePrev-=(D*Q-k*J)*y.inverseInertia)}}}}},48140:(t,e,i)=>{var s={};t.exports=s;var n=i(41598),r=i(31725),o=i(53614),a=i(15647),h=i(66615),l=i(53402);s._warming=.4,s._torqueDampen=1,s._minLength=1e-6,s.create=function(t){var e=t;e.bodyA&&!e.pointA&&(e.pointA={x:0,y:0}),e.bodyB&&!e.pointB&&(e.pointB={x:0,y:0});var i=e.bodyA?r.add(e.bodyA.position,e.pointA):e.pointA,s=e.bodyB?r.add(e.bodyB.position,e.pointB):e.pointB,n=r.magnitude(r.sub(i,s));e.length=void 0!==e.length?e.length:n,e.id=e.id||l.nextId(),e.label=e.label||"Constraint",e.type="constraint",e.stiffness=e.stiffness||(e.length>0?1:.7),e.damping=e.damping||0,e.angularStiffness=e.angularStiffness||0,e.angleA=e.bodyA?e.bodyA.angle:e.angleA,e.angleB=e.bodyB?e.bodyB.angle:e.angleB,e.plugin={};var o={visible:!0,type:"line",anchors:!0,lineColor:null,lineOpacity:null,lineThickness:null,pinSize:null,anchorColor:null,anchorSize:null};return 0===e.length&&e.stiffness>.1?(o.type="pin",o.anchors=!1):e.stiffness<.9&&(o.type="spring"),e.render=l.extend(o,e.render),e},s.preSolveAll=function(t){for(var e=0;e=1||0===t.length?t.stiffness*e:t.stiffness*e*e,x=t.damping*e,T=r.mult(u,m*y),w=(i?i.inverseMass:0)+(n?n.inverseMass:0),b=w+((i?i.inverseInertia:0)+(n?n.inverseInertia:0));if(x>0){var S=r.create();p=r.div(u,c),g=r.sub(n&&r.sub(n.position,n.positionPrev)||S,i&&r.sub(i.position,i.positionPrev)||S),v=r.dot(p,g)}i&&!i.isStatic&&(f=i.inverseMass/w,i.constraintImpulse.x-=T.x*f,i.constraintImpulse.y-=T.y*f,i.position.x-=T.x*f,i.position.y-=T.y*f,x>0&&(i.positionPrev.x-=x*p.x*v*f,i.positionPrev.y-=x*p.y*v*f),d=r.cross(o,T)/b*s._torqueDampen*i.inverseInertia*(1-t.angularStiffness),i.constraintImpulse.angle-=d,i.angle-=d),n&&!n.isStatic&&(f=n.inverseMass/w,n.constraintImpulse.x+=T.x*f,n.constraintImpulse.y+=T.y*f,n.position.x+=T.x*f,n.position.y+=T.y*f,x>0&&(n.positionPrev.x+=x*p.x*v*f,n.positionPrev.y+=x*p.y*v*f),d=r.cross(a,T)/b*s._torqueDampen*n.inverseInertia*(1-t.angularStiffness),n.constraintImpulse.angle+=d,n.angle+=d)}}},s.postSolveAll=function(t){for(var e=0;e0&&(c.position.x+=l.x,c.position.y+=l.y),0!==l.angle&&(n.rotate(c.vertices,l.angle,i.position),h.rotate(c.axes,l.angle),u>0&&r.rotateAbout(c.position,l.angle,i.position,c.position)),a.update(c.bounds,c.vertices,i.velocity)}l.angle*=s._warming,l.x*=s._warming,l.y*=s._warming}}},s.pointAWorld=function(t){return{x:(t.bodyA?t.bodyA.position.x:0)+(t.pointA?t.pointA.x:0),y:(t.bodyA?t.bodyA.position.y:0)+(t.pointA?t.pointA.y:0)}},s.pointBWorld=function(t){return{x:(t.bodyB?t.bodyB.position.x:0)+(t.pointB?t.pointB.x:0),y:(t.bodyB?t.bodyB.position.y:0)+(t.pointB?t.pointB.y:0)}},s.currentLength=function(t){var e=(t.bodyA?t.bodyA.position.x:0)+(t.pointA?t.pointA.x:0),i=(t.bodyA?t.bodyA.position.y:0)+(t.pointA?t.pointA.y:0),s=e-((t.bodyB?t.bodyB.position.x:0)+(t.pointB?t.pointB.x:0)),n=i-((t.bodyB?t.bodyB.position.y:0)+(t.pointB?t.pointB.y:0));return Math.sqrt(s*s+n*n)}},53402:(t,e,i)=>{var s={};t.exports=s,function(){s._baseDelta=1e3/60,s._nextId=0,s._seed=0,s._nowStartTime=+new Date,s._warnedOnce={},s._decomp=null,s.extend=function(t,e){var i,n;"boolean"==typeof e?(i=2,n=e):(i=1,n=!0);for(var r=i;r0;e--){var i=Math.floor(s.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t},s.choose=function(t){return t[Math.floor(s.random()*t.length)]},s.isElement=function(t){return"undefined"!=typeof HTMLElement?t instanceof HTMLElement:!!(t&&t.nodeType&&t.nodeName)},s.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},s.isFunction=function(t){return"function"==typeof t},s.isPlainObject=function(t){return"object"==typeof t&&t.constructor===Object},s.isString=function(t){return"[object String]"===toString.call(t)},s.clamp=function(t,e,i){return ti?i:t},s.sign=function(t){return t<0?-1:1},s.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-s._nowStartTime},s.random=function(e,i){return i=void 0!==i?i:1,(e=void 0!==e?e:0)+t()*(i-e)};var t=function(){return s._seed=(9301*s._seed+49297)%233280,s._seed/233280};s.colorToNumber=function(t){return 3==(t=t.replace("#","")).length&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),parseInt(t,16)},s.logLevel=1,s.log=function(){console&&s.logLevel>0&&s.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},s.info=function(){console&&s.logLevel>0&&s.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},s.warn=function(){console&&s.logLevel>0&&s.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},s.warnOnce=function(){var t=Array.prototype.slice.call(arguments).join(" ");s._warnedOnce[t]||(s.warn(t),s._warnedOnce[t]=!0)},s.deprecated=function(t,e,i){t[e]=s.chain((function(){s.warnOnce("🔅 deprecated 🔅",i)}),t[e])},s.nextId=function(){return s._nextId++},s.indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0;i{var s={};t.exports=s;var n=i(53614),r=i(66272),o=i(81388),a=i(99561),h=i(35810),l=i(69351),u=i(48140),c=i(53402),d=i(22562);s.create=function(t){t=t||{};var e=c.extend({positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},gravity:{x:0,y:1,scale:.001},timing:{timestamp:0,timeScale:1,lastDelta:0,lastElapsed:0}},t);return e.world=t.world||l.create({label:"World"}),e.pairs=t.pairs||a.create(),e.detector=t.detector||o.create(),e.grid={buckets:[]},e.world.gravity=e.gravity,e.broadphase=e.grid,e.metrics={},e},s.update=function(t,e){var i,d=c.now(),f=t.world,p=t.detector,v=t.pairs,g=t.timing,m=g.timestamp;e=void 0!==e?e:c._baseDelta,e*=g.timeScale,g.timestamp+=e,g.lastDelta=e;var y={timestamp:g.timestamp,delta:e};h.trigger(t,"beforeUpdate",y);var x=l.allBodies(f),T=l.allConstraints(f);for(f.isModified&&(o.setBodies(p,x),l.setModified(f,!1,!1,!0)),t.enableSleeping&&n.update(x,e),s._bodiesApplyGravity(x,t.gravity),e>0&&s._bodiesUpdate(x,e),h.trigger(t,"beforeSolve",y),u.preSolveAll(x),i=0;i0&&h.trigger(t,"collisionStart",{pairs:v.collisionStart,timestamp:g.timestamp,delta:e});var b=c.clamp(20/t.positionIterations,0,1);for(r.preSolvePosition(v.list),i=0;i0&&h.trigger(t,"collisionActive",{pairs:v.collisionActive,timestamp:g.timestamp,delta:e}),v.collisionEnd.length>0&&h.trigger(t,"collisionEnd",{pairs:v.collisionEnd,timestamp:g.timestamp,delta:e}),s._bodiesClearForces(x),h.trigger(t,"afterUpdate",y),t.timing.lastElapsed=c.now()-d,t},s.merge=function(t,e){if(c.extend(t,e),e.world){t.world=e.world,s.clear(t);for(var i=l.allBodies(t.world),r=0;r{var s={};t.exports=s;var n=i(53402);s.on=function(t,e,i){for(var s,n=e.split(" "),r=0;r0){i||(i={}),s=e.split(" ");for(var l=0;l{var s={};t.exports=s;var n=i(73832),r=i(53402);s.name="matter-js",s.version="0.19.0",s.uses=[],s.used=[],s.use=function(){n.use(s,Array.prototype.slice.call(arguments))},s.before=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathBefore(s,t,e)},s.after=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathAfter(s,t,e)}},73832:(t,e,i)=>{var s={};t.exports=s;var n=i(53402);s._registry={},s.register=function(t){if(s.isPlugin(t)||n.warn("Plugin.register:",s.toString(t),"does not implement all required fields."),t.name in s._registry){var e=s._registry[t.name],i=s.versionParse(t.version).number,r=s.versionParse(e.version).number;i>r?(n.warn("Plugin.register:",s.toString(e),"was upgraded to",s.toString(t)),s._registry[t.name]=t):i-1},s.isFor=function(t,e){var i=t.for&&s.dependencyParse(t.for);return!t.for||e.name===i.name&&s.versionSatisfies(e.version,i.range)},s.use=function(t,e){if(t.uses=(t.uses||[]).concat(e||[]),0!==t.uses.length){for(var i=s.dependencies(t),r=n.topologicalSort(i),o=[],a=0;a0&&!h.silent&&n.info(o.join(" "))}else n.warn("Plugin.use:",s.toString(t),"does not specify any dependencies to install.")},s.dependencies=function(t,e){var i=s.dependencyParse(t),r=i.name;if(!(r in(e=e||{}))){t=s.resolve(t)||t,e[r]=n.map(t.uses||[],(function(e){s.isPlugin(e)&&s.register(e);var r=s.dependencyParse(e),o=s.resolve(e);return o&&!s.versionSatisfies(o.version,r.range)?(n.warn("Plugin.dependencies:",s.toString(o),"does not satisfy",s.toString(r),"used by",s.toString(i)+"."),o._warned=!0,t._warned=!0):o||(n.warn("Plugin.dependencies:",s.toString(e),"used by",s.toString(i),"could not be resolved."),t._warned=!0),r.name}));for(var o=0;o=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;e.test(t)||n.warn("Plugin.versionParse:",t,"is not a valid version or range.");var i=e.exec(t),s=Number(i[4]),r=Number(i[5]),o=Number(i[6]);return{isRange:Boolean(i[1]||i[2]),version:i[3],range:t,operator:i[1]||i[2]||"",major:s,minor:r,patch:o,parts:[s,r,o],prerelease:i[7],number:1e8*s+1e4*r+o}},s.versionSatisfies=function(t,e){e=e||"*";var i=s.versionParse(e),n=s.versionParse(t);if(i.isRange){if("*"===i.operator||"*"===t)return!0;if(">"===i.operator)return n.number>i.number;if(">="===i.operator)return n.number>=i.number;if("~"===i.operator)return n.major===i.major&&n.minor===i.minor&&n.patch>=i.patch;if("^"===i.operator)return i.major>0?n.major===i.major&&n.number>=i.number:i.minor>0?n.minor===i.minor&&n.patch>=i.patch:n.patch===i.patch}return t===e||"*"===t}},53614:(t,e,i)=>{var s={};t.exports=s;var n=i(22562),r=i(35810),o=i(53402);s._motionWakeThreshold=.18,s._motionSleepThreshold=.08,s._minBias=.9,s.update=function(t,e){for(var i=e/o._baseDelta,r=s._motionSleepThreshold,a=0;a0&&h.motion=h.sleepThreshold/i&&s.set(h,!0)):h.sleepCounter>0&&(h.sleepCounter-=1)}else s.set(h,!1)}},s.afterCollisions=function(t){for(var e=s._motionSleepThreshold,i=0;ie&&s.set(h,!1)}}}},s.set=function(t,e){var i=t.isSleeping;e?(t.isSleeping=!0,t.sleepCounter=t.sleepThreshold,t.positionImpulse.x=0,t.positionImpulse.y=0,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.anglePrev=t.angle,t.speed=0,t.angularSpeed=0,t.motion=0,i||r.trigger(t,"sleepStart")):(t.isSleeping=!1,t.sleepCounter=0,i&&r.trigger(t,"sleepEnd"))}},66280:(t,e,i)=>{var s={};t.exports=s;var n=i(41598),r=i(53402),o=i(22562),a=i(15647),h=i(31725);s.rectangle=function(t,e,i,s,a){a=a||{};var h={label:"Rectangle Body",position:{x:t,y:e},vertices:n.fromPath("L 0 0 L "+i+" 0 L "+i+" "+s+" L 0 "+s)};if(a.chamfer){var l=a.chamfer;h.vertices=n.chamfer(h.vertices,l.radius,l.quality,l.qualityMin,l.qualityMax),delete a.chamfer}return o.create(r.extend({},h,a))},s.trapezoid=function(t,e,i,s,a,h){h=h||{};var l,u=i*(a*=.5),c=u+(1-2*a)*i,d=c+u;l=a<.5?"L 0 0 L "+u+" "+-s+" L "+c+" "+-s+" L "+d+" 0":"L 0 0 L "+c+" "+-s+" L "+d+" 0";var f={label:"Trapezoid Body",position:{x:t,y:e},vertices:n.fromPath(l)};if(h.chamfer){var p=h.chamfer;f.vertices=n.chamfer(f.vertices,p.radius,p.quality,p.qualityMin,p.qualityMax),delete h.chamfer}return o.create(r.extend({},f,h))},s.circle=function(t,e,i,n,o){n=n||{};var a={label:"Circle Body",circleRadius:i};o=o||25;var h=Math.ceil(Math.max(10,Math.min(o,i)));return h%2==1&&(h+=1),s.polygon(t,e,h,i,r.extend({},a,n))},s.polygon=function(t,e,i,a,h){if(h=h||{},i<3)return s.circle(t,e,a,h);for(var l=2*Math.PI/i,u="",c=.5*l,d=0;d0&&n.area(C)1?(p=o.create(r.extend({parts:v.slice(0)},s)),o.setPosition(p,{x:t,y:e}),p):v[0]},s.flagCoincidentParts=function(t,e){void 0===e&&(e=5);for(var i=0;i{var s={};t.exports=s;var n=i(69351),r=i(48140),o=i(53402),a=i(22562),h=i(66280);s.stack=function(t,e,i,s,r,o,h){for(var l,u=n.create({label:"Stack"}),c=t,d=e,f=0,p=0;pv&&(v=y),a.translate(m,{x:.5*x,y:.5*y}),c=m.bounds.max.x+r,n.addBody(u,m),l=m,f+=1}else c+=r}d+=v+o,c=t}return u},s.chain=function(t,e,i,s,a,h){for(var l=t.bodies,u=1;u0)for(l=0;l0&&(d=f[l-1+(h-1)*e],n.addConstraint(t,r.create(o.extend({bodyA:d,bodyB:c},a)))),s&&ld||o<(l=d-l)||o>i-1-l))return 1===c&&a.translate(u,{x:(o+(i%2==1?1:-1))*f,y:0}),h(t+(u?o*f:0)+o*r,s,o,l,u,c)}))},s.newtonsCradle=function(t,e,i,s,o){for(var a=n.create({label:"Newtons Cradle"}),l=0;l{var s={};t.exports=s;var n=i(31725),r=i(53402);s.fromVertices=function(t){for(var e={},i=0;i{var e={};t.exports=e,e.create=function(t){var i={min:{x:0,y:0},max:{x:0,y:0}};return t&&e.update(i,t),i},e.update=function(t,e,i){t.min.x=1/0,t.max.x=-1/0,t.min.y=1/0,t.max.y=-1/0;for(var s=0;st.max.x&&(t.max.x=n.x),n.xt.max.y&&(t.max.y=n.y),n.y0?t.max.x+=i.x:t.min.x+=i.x,i.y>0?t.max.y+=i.y:t.min.y+=i.y)},e.contains=function(t,e){return e.x>=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},e.overlaps=function(t,e){return t.min.x<=e.max.x&&t.max.x>=e.min.x&&t.max.y>=e.min.y&&t.min.y<=e.max.y},e.translate=function(t,e){t.min.x+=e.x,t.max.x+=e.x,t.min.y+=e.y,t.max.y+=e.y},e.shift=function(t,e){var i=t.max.x-t.min.x,s=t.max.y-t.min.y;t.min.x=e.x,t.max.x=e.x+i,t.min.y=e.y,t.max.y=e.y+s}},74058:(t,e,i)=>{var s={};t.exports=s,i(15647);var n=i(53402);s.pathToVertices=function(t,e){"undefined"==typeof window||"SVGPathSeg"in window||n.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var i,r,o,a,h,l,u,c,d,f,p,v=[],g=0,m=0,y=0;e=e||15;var x=function(t,e,i){var s=i%2==1&&i>1;if(!d||t!=d.x||e!=d.y){d&&s?(f=d.x,p=d.y):(f=0,p=0);var n={x:f+t,y:p+e};!s&&d||(d=n),v.push(n),m=f+t,y=p+e}},T=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":m=t.x,y=t.y;break;case"H":m=t.x;break;case"V":y=t.y}x(m,y,t.pathSegType)}};for(s._svgPathToAbsolute(t),o=t.getTotalLength(),l=[],i=0;i{var e={};t.exports=e,e.create=function(t,e){return{x:t||0,y:e||0}},e.clone=function(t){return{x:t.x,y:t.y}},e.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},e.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},e.rotate=function(t,e,i){var s=Math.cos(e),n=Math.sin(e);i||(i={});var r=t.x*s-t.y*n;return i.y=t.x*n+t.y*s,i.x=r,i},e.rotateAbout=function(t,e,i,s){var n=Math.cos(e),r=Math.sin(e);s||(s={});var o=i.x+((t.x-i.x)*n-(t.y-i.y)*r);return s.y=i.y+((t.x-i.x)*r+(t.y-i.y)*n),s.x=o,s},e.normalise=function(t){var i=e.magnitude(t);return 0===i?{x:0,y:0}:{x:t.x/i,y:t.y/i}},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.cross=function(t,e){return t.x*e.y-t.y*e.x},e.cross3=function(t,e,i){return(e.x-t.x)*(i.y-t.y)-(e.y-t.y)*(i.x-t.x)},e.add=function(t,e,i){return i||(i={}),i.x=t.x+e.x,i.y=t.y+e.y,i},e.sub=function(t,e,i){return i||(i={}),i.x=t.x-e.x,i.y=t.y-e.y,i},e.mult=function(t,e){return{x:t.x*e,y:t.y*e}},e.div=function(t,e){return{x:t.x/e,y:t.y/e}},e.perp=function(t,e){return{x:(e=!0===e?-1:1)*-t.y,y:e*t.x}},e.neg=function(t){return{x:-t.x,y:-t.y}},e.angle=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},e._temp=[e.create(),e.create(),e.create(),e.create(),e.create(),e.create()]},41598:(t,e,i)=>{var s={};t.exports=s;var n=i(31725),r=i(53402);s.create=function(t,e){for(var i=[],s=0;s0)return!1;o=i}return!0},s.scale=function(t,e,i,r){if(1===e&&1===i)return t;var o,a;r=r||s.centre(t);for(var h=0;h=0?h-1:t.length-1],u=t[h],c=t[(h+1)%t.length],d=e[h0&&(r|=2),3===r)return!1;return 0!==r||null},s.hull=function(t){var e,i,s=[],r=[];for((t=t.slice(0)).sort((function(t,e){var i=t.x-e.x;return 0!==i?i:t.y-e.y})),i=0;i=2&&n.cross3(r[r.length-2],r[r.length-1],e)<=0;)r.pop();r.push(e)}for(i=t.length-1;i>=0;i-=1){for(e=t[i];s.length>=2&&n.cross3(s[s.length-2],s[s.length-1],e)<=0;)s.pop();s.push(e)}return s.pop(),r.pop(),s.concat(r)}},18210:(t,e,i)=>{var s=i(19933),n={name:"matter-attractors",version:"0.1.7",for:"matter-js@^0.19.0",silent:!0,install:function(t){t.after("Body.create",(function(){n.Body.init(this)})),t.before("Engine.update",(function(t){n.Engine.update(t)}))},Body:{init:function(t){t.plugin.attractors=t.plugin.attractors||[]}},Engine:{update:function(t){for(var e=s.Composite.allBodies(t.world),i=0;i0)for(var o=0;o{t.exports={name:"matter-collision-events",version:"0.1.6",for:"matter-js@^0.19.0",silent:!0,install:function(t){t.after("Engine.create",(function(){t.Events.on(this,"collisionStart",(function(e){e.pairs.map((function(e){var i=e.bodyA,s=e.bodyB;i.gameObject&&i.gameObject.emit("collide",i,s,e),s.gameObject&&s.gameObject.emit("collide",s,i,e),t.Events.trigger(i,"onCollide",{pair:e}),t.Events.trigger(s,"onCollide",{pair:e}),i.onCollideCallback&&i.onCollideCallback(e),s.onCollideCallback&&s.onCollideCallback(e),i.onCollideWith[s.id]&&i.onCollideWith[s.id](s,e),s.onCollideWith[i.id]&&s.onCollideWith[i.id](i,e)}))})),t.Events.on(this,"collisionActive",(function(e){e.pairs.map((function(e){var i=e.bodyA,s=e.bodyB;i.gameObject&&i.gameObject.emit("collideActive",i,s,e),s.gameObject&&s.gameObject.emit("collideActive",s,i,e),t.Events.trigger(i,"onCollideActive",{pair:e}),t.Events.trigger(s,"onCollideActive",{pair:e}),i.onCollideActiveCallback&&i.onCollideActiveCallback(e),s.onCollideActiveCallback&&s.onCollideActiveCallback(e)}))})),t.Events.on(this,"collisionEnd",(function(e){e.pairs.map((function(e){var i=e.bodyA,s=e.bodyB;i.gameObject&&i.gameObject.emit("collideEnd",i,s,e),s.gameObject&&s.gameObject.emit("collideEnd",s,i,e),t.Events.trigger(i,"onCollideEnd",{pair:e}),t.Events.trigger(s,"onCollideEnd",{pair:e}),i.onCollideEndCallback&&i.onCollideEndCallback(e),s.onCollideEndCallback&&s.onCollideEndCallback(e)}))}))}))}}},74507:(t,e,i)=>{var s=i(19933),n={name:"matter-wrap",version:"0.1.4",for:"matter-js@^0.19.0",silent:!0,install:function(t){t.after("Engine.update",(function(){n.Engine.update(this)}))},Engine:{update:function(t){for(var e=t.world,i=s.Composite.allBodies(e),r=s.Composite.allComposites(e),o=0;oe.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?s=e.min.y-t.max.y:t.max.y{function e(t,e,i){i=i||0;var s,n,r,o,a,h,l,u=[0,0];return s=t[1][1]-t[0][1],n=t[0][0]-t[1][0],r=s*t[0][0]+n*t[0][1],o=e[1][1]-e[0][1],a=e[0][0]-e[1][0],h=o*e[0][0]+a*e[0][1],S(l=s*a-o*n,0,i)||(u[0]=(a*r-n*h)/l,u[1]=(s*h-o*r)/l),u}function i(t,e,i,s){var n=e[0]-t[0],r=e[1]-t[1],o=s[0]-i[0],a=s[1]-i[1];if(o*r-a*n==0)return!1;var h=(n*(i[1]-t[1])+r*(t[0]-i[0]))/(o*r-a*n),l=(o*(t[1]-i[1])+a*(i[0]-t[0]))/(a*n-o*r);return h>=0&&h<=1&&l>=0&&l<=1}function s(t,e,i){return(e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1])}function n(t,e,i){return s(t,e,i)>0}function r(t,e,i){return s(t,e,i)>=0}function o(t,e,i){return s(t,e,i)<0}function a(t,e,i){return s(t,e,i)<=0}t.exports={decomp:function(t){var e=T(t);return e.length>0?w(t,e):[t]},quickDecomp:function t(e,i,s,h,l,u,v){u=u||100,v=v||0,l=l||25,i=void 0!==i?i:[],s=s||[],h=h||[];var g=[0,0],m=[0,0],x=[0,0],T=0,w=0,S=0,E=0,A=0,C=0,_=0,M=[],P=[],R=e,L=e;if(L.length<3)return i;if(++v>u)return console.warn("quickDecomp: max level ("+u+") reached."),i;for(var O=0;OA&&(A+=e.length),E=Number.MAX_VALUE,A3&&s>=0;--s)u(d(t,s-1),d(t,s),d(t,s+1),e)&&(t.splice(s%t.length,1),i++);return i},removeDuplicatePoints:function(t,e){for(var i=t.length-1;i>=1;--i)for(var s=t[i],n=i-1;n>=0;--n)E(s,t[n],e)&&t.splice(i,1)},makeCCW:function(t){for(var e=0,i=t,s=1;si[e][0])&&(e=s);return!n(d(t,e-1),d(t,e),d(t,e+1))&&(function(t){for(var e=[],i=t.length,s=0;s!==i;s++)e.push(t.pop());for(s=0;s!==i;s++)t[s]=e[s]}(t),!0)}};var h=[],l=[];function u(t,e,i,n){if(n){var r=h,o=l;r[0]=e[0]-t[0],r[1]=e[1]-t[1],o[0]=i[0]-e[0],o[1]=i[1]-e[1];var a=r[0]*o[0]+r[1]*o[1],u=Math.sqrt(r[0]*r[0]+r[1]*r[1]),c=Math.sqrt(o[0]*o[0]+o[1]*o[1]);return Math.acos(a/(u*c)){var s=new(i(83419))({initialize:function(t){this.pluginManager=t,this.game=t.game},init:function(){},start:function(){},stop:function(){},destroy:function(){this.pluginManager=null,this.game=null,this.scene=null,this.systems=null}});t.exports=s},42363:t=>{t.exports={Global:["game","anims","cache","plugins","registry","scale","sound","textures","renderer"],CoreScene:["EventEmitter","CameraManager","GameObjectCreator","GameObjectFactory","ScenePlugin","DisplayList","UpdateList"],DefaultScene:["Clock","DataManagerPlugin","InputPlugin","Loader","TweenManager","LightsPlugin"]}},37277:t=>{var e={},i={},s={register:function(t,i,s,n){void 0===n&&(n=!1),e[t]={plugin:i,mapping:s,custom:n}},registerCustom:function(t,e,s,n){i[t]={plugin:e,mapping:s,data:n}},hasCore:function(t){return e.hasOwnProperty(t)},hasCustom:function(t){return i.hasOwnProperty(t)},getCore:function(t){return e[t]},getCustom:function(t){return i[t]},getCustomClass:function(t){return i.hasOwnProperty(t)?i[t].plugin:null},remove:function(t){e.hasOwnProperty(t)&&delete e[t]},removeCustom:function(t){i.hasOwnProperty(t)&&delete i[t]},destroyCorePlugins:function(){for(var t in e)e.hasOwnProperty(t)&&delete e[t]},destroyCustomPlugins:function(){for(var t in i)i.hasOwnProperty(t)&&delete i[t]}};t.exports=s},77332:(t,e,i)=>{var s=i(83419),n=i(8443),r=i(50792),o=i(74099),a=i(44603),h=i(39429),l=i(95540),u=i(37277),c=i(72905),d=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.plugins=[],this.scenePlugins=[],this._pendingGlobal=[],this._pendingScene=[],t.isBooted?this.boot():t.events.once(n.BOOT,this.boot,this)},boot:function(){var t,e,i,s,r,o,a,h=this.game.config,u=h.installGlobalPlugins;for(u=u.concat(this._pendingGlobal),t=0;t{var s=i(52018),n=i(83419),r=i(44594),o=new n({Extends:s,initialize:function(t,e,i){s.call(this,e),this.scene=t,this.systems=t.sys,this.pluginKey=i,t.sys.events.once(r.BOOT,this.boot,this)},boot:function(){},destroy:function(){this.pluginManager=null,this.game=null,this.scene=null,this.systems=null}});t.exports=o},18922:(t,e,i)=>{t.exports={BasePlugin:i(52018),DefaultPlugins:i(42363),PluginCache:i(37277),PluginManager:i(77332),ScenePlugin:i(45145)}},63595:()=>{HTMLVideoElement&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(t){const e=performance.now(),i=this.getVideoPlaybackQuality(),s=this.mozPresentedFrames||this.mozPaintedFrames||i.totalVideoFrames-i.droppedVideoFrames,n=(r,o)=>{const a=this.getVideoPlaybackQuality(),h=this.mozPresentedFrames||this.mozPaintedFrames||a.totalVideoFrames-a.droppedVideoFrames;if(h>s){const s=this.mozFrameDelay||a.totalFrameDelay-i.totalFrameDelay||0,n=o-r;t(o,{presentationTime:o+1e3*s,expectedDisplayTime:o+n,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+n/1e3,presentedFrames:h,processingDuration:s}),delete this._rvfcpolyfillmap[e]}else this._rvfcpolyfillmap[e]=requestAnimationFrame((t=>n(o,t)))};return this._rvfcpolyfillmap[e]=requestAnimationFrame((t=>n(e,t))),e},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(t){cancelAnimationFrame(this._rvfcpolyfillmap[t]),delete this._rvfcpolyfillmap[t]})},10312:t=>{t.exports={SKIP_CHECK:-1,NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16,ERASE:17,SOURCE_IN:18,SOURCE_OUT:19,SOURCE_ATOP:20,DESTINATION_OVER:21,DESTINATION_IN:22,DESTINATION_OUT:23,DESTINATION_ATOP:24,LIGHTER:25,COPY:26,XOR:27}},29795:t=>{t.exports={DEFAULT:0,LINEAR:0,NEAREST:1}},68627:(t,e,i)=>{var s=i(19715),n=i(32880),r=i(83419),o=i(8054),a=i(50792),h=i(92503),l=i(56373),u=i(97480),c=i(69442),d=i(61340),f=new r({Extends:a,initialize:function(t){a.call(this);var e=t.config;this.config={clearBeforeRender:e.clearBeforeRender,backgroundColor:e.backgroundColor,antialias:e.antialias,roundPixels:e.roundPixels},this.game=t,this.type=o.CANVAS,this.drawCount=0,this.width=0,this.height=0,this.gameCanvas=t.canvas;var i={alpha:t.config.transparent,desynchronized:t.config.desynchronized,willReadFrequently:!1};this.gameContext=e.context?e.context:this.gameCanvas.getContext("2d",i),this.currentContext=this.gameContext,this.antialias=t.config.antialias,this.blendModes=l(),this.snapshotState={x:0,y:0,width:1,height:1,getPixel:!1,callback:null,type:"image/png",encoder:.92},this._tempMatrix1=new d,this._tempMatrix2=new d,this._tempMatrix3=new d,this.isBooted=!1,this.init()},init:function(){this.game.textures.once(c.READY,this.boot,this)},boot:function(){var t=this.game,e=t.scale.baseSize;this.width=e.width,this.height=e.height,this.isBooted=!0,t.scale.on(u.RESIZE,this.onResize,this),this.resize(e.width,e.height)},onResize:function(t,e){e.width===this.width&&e.height===this.height||this.resize(e.width,e.height)},resize:function(t,e){this.width=t,this.height=e,this.emit(h.RESIZE,t,e)},resetTransform:function(){this.currentContext.setTransform(1,0,0,1,0,0)},setBlendMode:function(t){return this.currentContext.globalCompositeOperation=t,this},setContext:function(t){return this.currentContext=t||this.gameContext,this},setAlpha:function(t){return this.currentContext.globalAlpha=t,this},preRender:function(){var t=this.gameContext,e=this.config,i=this.width,s=this.height;t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),e.clearBeforeRender&&(t.clearRect(0,0,i,s),e.transparent||(t.fillStyle=e.backgroundColor.rgba,t.fillRect(0,0,i,s))),t.save(),this.drawCount=0,this.emit(h.PRE_RENDER)},render:function(t,e,i){var n=e.length;this.emit(h.RENDER,t,i);var r=i.x,o=i.y,a=i.width,l=i.height,u=i.renderToTexture?i.context:t.sys.context;u.save(),this.game.scene.customViewports&&(u.beginPath(),u.rect(r,o,a,l),u.clip()),i.emit(s.PRE_RENDER,i),this.currentContext=u;var c=i.mask;c&&c.preRenderCanvas(this,null,i._maskCamera),i.transparent||(u.fillStyle=i.backgroundColor.rgba,u.fillRect(r,o,a,l)),u.globalAlpha=i.alpha,u.globalCompositeOperation="source-over",this.drawCount+=n,i.renderToTexture&&i.emit(s.PRE_RENDER,i),i.matrix.copyToContext(u);for(var d=0;d=0?m=-(m+c):m<0&&(m=Math.abs(m)-c)),t.flipY&&(y>=0?y=-(y+d):y<0&&(y=Math.abs(y)-d))}var T=1,w=1;t.flipX&&(f||(m+=-e.realWidth+2*v),T=-1),t.flipY&&(f||(y+=-e.realHeight+2*g),w=-1);var b=t.x,S=t.y;a.applyITRS(b,S,t.rotation,t.scaleX*T,t.scaleY*w),o.copyFrom(i.matrix),s?(o.multiplyWithOffset(s,-i.scrollX*t.scrollFactorX,-i.scrollY*t.scrollFactorY),a.e=b,a.f=S):(a.e-=i.scrollX*t.scrollFactorX,a.f-=i.scrollY*t.scrollFactorY),o.multiply(a),i.roundPixels&&(o.e=Math.round(o.e),o.f=Math.round(o.f)),r.save(),o.setToContext(r),r.globalCompositeOperation=this.blendModes[t.blendMode],r.globalAlpha=n,r.imageSmoothingEnabled=!e.source.scaleMode,t.mask&&t.mask.preRenderCanvas(this,t,i),c>0&&d>0&&(i.roundPixels?r.drawImage(e.source.image,l,u,c,d,Math.round(m),Math.round(y),Math.round(c/p),Math.round(d/p)):r.drawImage(e.source.image,l,u,c,d,m,y,c/p,d/p)),t.mask&&t.mask.postRenderCanvas(this,t,i),r.restore()}},destroy:function(){this.removeAllListeners(),this.game=null,this.gameCanvas=null,this.gameContext=null}});t.exports=f},55830:(t,e,i)=>{t.exports={CanvasRenderer:i(68627),GetBlendModes:i(56373),SetTransform:i(20926)}},56373:(t,e,i)=>{var s=i(10312),n=i(89289);t.exports=function(){var t=[],e=n.supportNewBlendModes,i="source-over";return t[s.NORMAL]=i,t[s.ADD]="lighter",t[s.MULTIPLY]=e?"multiply":i,t[s.SCREEN]=e?"screen":i,t[s.OVERLAY]=e?"overlay":i,t[s.DARKEN]=e?"darken":i,t[s.LIGHTEN]=e?"lighten":i,t[s.COLOR_DODGE]=e?"color-dodge":i,t[s.COLOR_BURN]=e?"color-burn":i,t[s.HARD_LIGHT]=e?"hard-light":i,t[s.SOFT_LIGHT]=e?"soft-light":i,t[s.DIFFERENCE]=e?"difference":i,t[s.EXCLUSION]=e?"exclusion":i,t[s.HUE]=e?"hue":i,t[s.SATURATION]=e?"saturation":i,t[s.COLOR]=e?"color":i,t[s.LUMINOSITY]=e?"luminosity":i,t[s.ERASE]="destination-out",t[s.SOURCE_IN]="source-in",t[s.SOURCE_OUT]="source-out",t[s.SOURCE_ATOP]="source-atop",t[s.DESTINATION_OVER]="destination-over",t[s.DESTINATION_IN]="destination-in",t[s.DESTINATION_OUT]="destination-out",t[s.DESTINATION_ATOP]="destination-atop",t[s.LIGHTER]="lighter",t[s.COPY]="copy",t[s.XOR]="xor",t}},20926:(t,e,i)=>{var s=i(91296);t.exports=function(t,e,i,n,r){var o=n.alpha*i.alpha;if(o<=0)return!1;var a=s(i,n,r).calc;return e.globalCompositeOperation=t.blendModes[i.blendMode],e.globalAlpha=o,e.save(),a.setToContext(e),e.imageSmoothingEnabled=i.frame?!i.frame.source.scaleMode:t.antialias,!0}},63899:t=>{t.exports="losewebgl"},6119:t=>{t.exports="postrender"},48070:t=>{t.exports="prerender"},15640:t=>{t.exports="render"},8912:t=>{t.exports="resize"},87124:t=>{t.exports="restorewebgl"},92503:(t,e,i)=>{t.exports={LOSE_WEBGL:i(63899),POST_RENDER:i(6119),PRE_RENDER:i(48070),RENDER:i(15640),RESIZE:i(8912),RESTORE_WEBGL:i(87124)}},36909:(t,e,i)=>{t.exports={Events:i(92503),Snapshot:i(89966)},t.exports.Canvas=i(55830),t.exports.WebGL=i(4159)},32880:(t,e,i)=>{var s=i(27919),n=i(40987),r=i(95540);t.exports=function(t,e){var i=r(e,"callback"),o=r(e,"type","image/png"),a=r(e,"encoder",.92),h=Math.abs(Math.round(r(e,"x",0))),l=Math.abs(Math.round(r(e,"y",0))),u=Math.floor(r(e,"width",t.width)),c=Math.floor(r(e,"height",t.height));if(r(e,"getPixel",!1)){var d=t.getContext("2d",{willReadFrequently:!1}).getImageData(h,l,1,1).data;i.call(null,new n(d[0],d[1],d[2],d[3]))}else if(0!==h||0!==l||u!==t.width||c!==t.height){var f=s.createWebGL(this,u,c),p=f.getContext("2d",{willReadFrequently:!0});u>0&&c>0&&p.drawImage(t,h,l,u,c,0,0,u,c);var v=new Image;v.onerror=function(){i.call(null),s.remove(f)},v.onload=function(){i.call(null,v),s.remove(f)},v.src=f.toDataURL(o,a)}else{var g=new Image;g.onerror=function(){i.call(null)},g.onload=function(){i.call(null,g)},g.src=t.toDataURL(o,a)}}},88815:(t,e,i)=>{var s=i(27919),n=i(40987),r=i(95540);t.exports=function(t,e){var i=t,o=r(e,"callback"),a=r(e,"type","image/png"),h=r(e,"encoder",.92),l=Math.abs(Math.round(r(e,"x",0))),u=Math.abs(Math.round(r(e,"y",0))),c=r(e,"getPixel",!1),d=r(e,"isFramebuffer",!1),f=d?r(e,"bufferWidth",1):i.drawingBufferWidth,p=d?r(e,"bufferHeight",1):i.drawingBufferHeight;if(c){var v=new Uint8Array(4),g=d?u:p-u;i.readPixels(l,g,1,1,i.RGBA,i.UNSIGNED_BYTE,v),o.call(null,new n(v[0],v[1],v[2],v[3]))}else{var m=Math.floor(r(e,"width",f)),y=Math.floor(r(e,"height",p)),x=m*y*4,T=new Uint8Array(x);i.readPixels(l,p-u-y,m,y,i.RGBA,i.UNSIGNED_BYTE,T);for(var w=s.createWebGL(this,m,y),b=w.getContext("2d",{willReadFrequently:!0}),S=b.getImageData(0,0,m,y),E=S.data,A=0;A{t.exports={Canvas:i(32880),WebGL:i(88815)}},7530:(t,e,i)=>{var s=i(83419),n=i(36060),r=i(90330),o=i(82264),a=i(95540),h=i(32302),l=i(63448),u=i(31302),c=i(58918),d=i(14811),f=i(92651),p=i(96569),v=i(56527),g=i(57516),m=i(43439),y=i(81041),x=i(12385),T=i(7589),w=i(95428),b=i(72905),S=new s({initialize:function(t){this.game=t.game,this.renderer=t,this.classes=new r([[n.UTILITY_PIPELINE,T],[n.MULTI_PIPELINE,g],[n.BITMAPMASK_PIPELINE,u],[n.SINGLE_PIPELINE,x],[n.ROPE_PIPELINE,y],[n.LIGHT_PIPELINE,p],[n.POINTLIGHT_PIPELINE,m],[n.MOBILE_PIPELINE,v]]),this.postPipelineClasses=new r,this.pipelines=new r,this.postPipelineInstances=[],this.default=null,this.current=null,this.previous=null,this.MULTI_PIPELINE=null,this.BITMAPMASK_PIPELINE=null,this.UTILITY_PIPELINE=null,this.MOBILE_PIPELINE=null,this.FX_PIPELINE=null,this.fullFrame1,this.fullFrame2,this.halfFrame1,this.halfFrame2,this.renderTargets=[],this.maxDimension=0,this.frameInc=32,this.targetIndex=0},boot:function(t,e,i){var s=this.renderer,r=this.renderTargets;this.frameInc=Math.floor(a(t,"frameInc",32));var l,u,p=s.width,v=s.height,g=this.game.config.disablePreFX;if(this.game.config.disablePostFX||this.postPipelineClasses.setAll([[String(d.BARREL),c.Barrel],[String(d.BLOOM),c.Bloom],[String(d.BLUR),c.Blur],[String(d.BOKEH),c.Bokeh],[String(d.CIRCLE),c.Circle],[String(d.COLOR_MATRIX),c.ColorMatrix],[String(d.DISPLACEMENT),c.Displacement],[String(d.GLOW),c.Glow],[String(d.GRADIENT),c.Gradient],[String(d.PIXELATE),c.Pixelate],[String(d.SHADOW),c.Shadow],[String(d.SHINE),c.Shine],[String(d.VIGNETTE),c.Vignette],[String(d.WIPE),c.Wipe]]),!g){this.classes.set(n.FX_PIPELINE,f);for(var m=Math.min(p,v),y=Math.ceil(m/this.frameInc),x=1;x=0;i--){var s=e[i];s.active&&s.preBatch(t)}}},postBatch:function(t){if(t.hasPostPipeline){this.flush();for(var e=t.postPipelines,i=0;i=0;i--){var s=e[i];s.active&&s.preBatch(t)}}},postBatchCamera:function(t){if(t.hasPostPipeline){this.flush();for(var e=t.postPipelines,i=0;ithis.maxDimension)return this.targetIndex=e.length-3,e[this.targetIndex];var i=3*(l(t,this.frameInc,0,!0)-1);return this.targetIndex=i,e[i]},getSwapRenderTarget:function(){return this.renderTargets[this.targetIndex+1]},getAltSwapRenderTarget:function(){return this.renderTargets[this.targetIndex+2]},destroy:function(){this.flush(),this.classes.clear(),this.postPipelineClasses.clear(),this.pipelines.clear(),this.renderer=null,this.game=null,this.classes=null,this.postPipelineClasses=null,this.pipelines=null,this.default=null,this.current=null,this.previous=null}});t.exports=S},32302:(t,e,i)=>{var s=i(83419),n=i(92503),r=new s({initialize:function(t,e,i,s,n,r,o,a,h){void 0===s&&(s=1),void 0===n&&(n=0),void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=!0),void 0===h&&(h=!0),this.renderer=t,this.framebuffer=null,this.texture=null,this.width=0,this.height=0,this.scale=s,this.minFilter=n,this.autoClear=r,this.autoResize=!0,this.hasDepthBuffer=a,this.forceClamp=h,this.resize(e,i),o?this.setAutoResize(!0):this.autoResize=!1},setAutoResize:function(t){return t&&!this.autoResize?(this.renderer.on(n.RESIZE,this.resize,this),this.autoResize=!0):!t&&this.autoResize&&(this.renderer.off(n.RESIZE,this.resize,this),this.autoResize=!1),this},resize:function(t,e){if((t=Math.round(t*this.scale))<=0&&(t=1),(e=Math.round(e*this.scale))<=0&&(e=1),this.autoResize&&(t!==this.width||e!==this.height)){var i=this.renderer;i.deleteFramebuffer(this.framebuffer),i.deleteTexture(this.texture),this.texture=i.createTextureFromSource(null,t,e,this.minFilter,this.forceClamp),this.framebuffer=i.createFramebuffer(t,e,this.texture,this.hasDepthBuffer),this.width=t,this.height=e}return this},willResize:function(t,e){return(t=Math.round(t*this.scale))<=0&&(t=1),(e=Math.round(e*this.scale))<=0&&(e=1),t!==this.width||e!==this.height},bind:function(t,e,i){void 0===t&&(t=!1);var s=this.renderer;if(t&&s.flush(),e&&i&&this.resize(e,i),s.pushFramebuffer(this.framebuffer,!1,!1),t&&this.adjustViewport(),this.autoClear){var n=this.renderer.gl;n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT)}s.clearStencilMask()},adjustViewport:function(){var t=this.renderer.gl;t.viewport(0,0,this.width,this.height),t.disable(t.SCISSOR_TEST)},clear:function(){var t=this.renderer,e=t.gl;t.pushFramebuffer(this.framebuffer),e.disable(e.SCISSOR_TEST),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),t.popFramebuffer(),t.resetScissor()},unbind:function(t){void 0===t&&(t=!1);var e=this.renderer;return t&&e.flush(),e.popFramebuffer()},destroy:function(){var t=this.renderer;t.off(n.RESIZE,this.resize,this),t.deleteFramebuffer(this.framebuffer),t.deleteTexture(this.texture),this.renderer=null,this.framebuffer=null,this.texture=null}});t.exports=r},70554:t=>{t.exports={getTintFromFloats:function(t,e,i,s){return((255*s&255)<<24|(255*t&255)<<16|(255*e&255)<<8|255*i&255)>>>0},getTintAppendFloatAlpha:function(t,e){return((255*e&255)<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255*e&255)<<24|(255&t)<<16|(t>>8&255)<<8|t>>16&255)>>>0},getFloatsFromUintRGB:function(t){return[(t>>16&255)/255,(t>>8&255)/255,(255&t)/255]},checkShaderMax:function(t,e){var i=Math.min(16,t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS));return e&&-1!==e?Math.min(i,e):i},parseFragmentShaderMaxTextures:function(t,e){if(!t)return"";for(var i="",s=0;s0&&(i+="\n\telse "),s{var s=i(83419),n=i(62644),r=i(50792),o=i(77085),a=i(95540),h=i(37867),l=i(92503),u=i(32302),c=i(70554),d=i(38683),f=new s({Extends:r,initialize:function(t){r.call(this);var e=t.game,i=e.renderer,s=i.gl;this.name=a(t,"name","WebGLPipeline"),this.game=e,this.renderer=i,this.manager,this.gl=s,this.view=e.canvas,this.width=0,this.height=0,this.vertexCount=0,this.vertexCapacity=0,this.vertexData,this.vertexBuffer,this.activeBuffer,this.topology=a(t,"topology",s.TRIANGLES),this.bytes,this.vertexViewF32,this.vertexViewU32,this.active=!0,this.forceZero=a(t,"forceZero",!1),this.hasBooted=!1,this.isPostFX=!1,this.isPreFX=!1,this.renderTargets=[],this.currentRenderTarget,this.shaders=[],this.currentShader,this.projectionMatrix,this.projectionWidth=0,this.projectionHeight=0,this.config=t,this.glReset=!1,this.batch=[],this.currentBatch=null,this.currentTexture=null,this.currentUnit=0,this.activeTextures=[],this.resizeUniform=a(t,"resizeUniform","")},boot:function(){var t,e=this.gl,i=this.config,s=this.renderer;this.isPostFX||(this.projectionMatrix=(new h).identity());var n=this.renderTargets,r=a(i,"renderTarget",!1);"boolean"==typeof r&&r&&(r=1);var c=s.width,d=s.height;if("number"==typeof r)for(t=0;tT&&(T=x[t].vertexSize);var w=a(i,"batchSize",s.config.batchSize);this.vertexCapacity=6*w;var b=new ArrayBuffer(this.vertexCapacity*T);this.vertexData=b,this.bytes=new Uint8Array(b),this.vertexViewF32=new Float32Array(b),this.vertexViewU32=new Uint32Array(b);var S=a(i,"vertices",null);for(S?(this.vertexViewF32.set(S),this.vertexBuffer=s.createVertexBuffer(b,e.STATIC_DRAW)):this.vertexBuffer=s.createVertexBuffer(b.byteLength,e.DYNAMIC_DRAW),this.setVertexBuffer(),t=x.length-1;t>=0;t--)x[t].rebind();this.hasBooted=!0,s.on(l.RESIZE,this.resize,this),s.on(l.PRE_RENDER,this.onPreRender,this),s.on(l.RENDER,this.onRender,this),s.on(l.POST_RENDER,this.onPostRender,this),this.emit(o.BOOT,this),this.onBoot()},onBoot:function(){},onResize:function(){},setShader:function(t,e,i){var s=this.renderer;return t===this.currentShader&&s.currentProgram===this.currentShader.program||(this.flush(),this.setVertexBuffer(i)&&!e&&(e=!0),t.bind(e,!1),this.currentShader=t),this},getShaderByName:function(t){for(var e=this.shaders,i=0;i-1&&(m=b.substring(20))}y&&x&&g.push(new d(this,m,y,x,n(T)))}this.shaders=g}return 0===this.shaders.length?console.warn("Pipeline: "+this.name+" - Invalid shader config"):this.currentShader=this.shaders[0],this},createBatch:function(t){return this.currentBatch={start:this.vertexCount,count:0,texture:[t],unit:0,maxUnit:0},this.currentUnit=0,this.currentTexture=t,this.batch.push(this.currentBatch),0},addTextureToBatch:function(t){var e=this.currentBatch;e&&(e.texture.push(t),e.unit++,e.maxUnit++)},pushBatch:function(t){if(!this.currentBatch||this.forceZero&&t!==this.currentTexture)return this.createBatch(t);if(t===this.currentTexture)return this.currentUnit;var e=this.currentBatch,i=e.texture.indexOf(t);return-1===i?e.texture.length===this.renderer.maxTextures?this.createBatch(t):(e.unit++,e.maxUnit++,e.texture.push(t),this.currentUnit=e.unit,this.currentTexture=t,e.unit):(this.currentUnit=i,this.currentTexture=t,i)},setGameObject:function(t,e){return void 0===e&&(e=t.frame),this.pushBatch(e.source.glTexture)},shouldFlush:function(t){return void 0===t&&(t=0),this.vertexCount+t>this.vertexCapacity},vertexAvailable:function(){return this.vertexCapacity-this.vertexCount},resize:function(t,e){t===this.width&&e===this.height||this.flush(),this.width=t,this.height=e;for(var i=this.renderTargets,s=0;s=0;i--){var s=e[i].rebind();t&&s!==t||(this.currentShader=s)}return this.activeTextures.length=0,this.emit(o.REBIND,this.currentShader),this.onActive(this.currentShader),this.onRebind(),this.glReset=!1,this},restoreContext:function(){var t=this.shaders,e=!!this.vertexBuffer;this.activeBuffer=null,this.activeTextures.length=0,this.batch.length=0,this.currentBatch=null,this.currentTexture=null,this.currentUnit=0,e&&this.setVertexBuffer();for(var i=0;i0){this.emit(o.BEFORE_FLUSH,this,t),this.onBeforeFlush(t);var e=this.gl,i=this.vertexCount,s=this.currentShader.vertexSize,n=this.topology;if(this.active){var r,a,h;this.setVertexBuffer(),i===this.vertexCapacity?e.bufferData(e.ARRAY_BUFFER,this.vertexData,e.DYNAMIC_DRAW):e.bufferSubData(e.ARRAY_BUFFER,0,this.bytes.subarray(0,i*s));var l=this.batch,u=this.activeTextures;if(this.forceZero)for(u[0]||e.activeTexture(e.TEXTURE0),r=0;r{var s=i(95428),n=i(72905),r=i(19715),o=i(83419),a=i(8054),h=i(50792),l=i(92503),u=i(50030),c=i(37867),d=i(29747),f=i(7530),p=i(32302),v=i(97480),g=i(69442),m=i(70554),y=i(88815),x=i(26128),T=i(1482),w=i(82751),b=i(84387),S=i(93567),E=i(57183),A=new o({Extends:h,initialize:function(t){h.call(this);var e=t.config,i={alpha:e.transparent,desynchronized:e.desynchronized,depth:!0,antialias:e.antialiasGL,premultipliedAlpha:e.premultipliedAlpha,stencil:!0,failIfMajorPerformanceCaveat:e.failIfMajorPerformanceCaveat,powerPreference:e.powerPreference,preserveDrawingBuffer:e.preserveDrawingBuffer,willReadFrequently:!1};this.config={clearBeforeRender:e.clearBeforeRender,antialias:e.antialias,backgroundColor:e.backgroundColor,contextCreation:i,roundPixels:e.roundPixels,maxTextures:e.maxTextures,maxTextureSize:e.maxTextureSize,batchSize:e.batchSize,maxLights:e.maxLights,mipmapFilter:e.mipmapFilter},this.game=t,this.type=a.WEBGL,this.pipelines=null,this.width=0,this.height=0,this.canvas=t.canvas,this.blendModes=[],this.contextLost=!1,this.snapshotState={x:0,y:0,width:1,height:1,getPixel:!1,callback:null,type:"image/png",encoder:.92,isFramebuffer:!1,bufferWidth:0,bufferHeight:0},this.maxTextures=0,this.textureIndexes,this.glBufferWrappers=[],this.glProgramWrappers=[],this.glTextureWrappers=[],this.glFramebufferWrappers=[],this.glAttribLocationWrappers=[],this.glUniformLocationWrappers=[],this.currentFramebuffer=null,this.fboStack=[],this.currentProgram=null,this.currentBlendMode=1/0,this.currentScissorEnabled=!1,this.currentScissor=null,this.scissorStack=[],this.contextLostHandler=d,this.contextRestoredHandler=d,this.gl=null,this.supportedExtensions=null,this.instancedArraysExtension=null,this.vaoExtension=null,this.extensions={},this.glFormats,this.compression,this.drawingBufferHeight=0,this.blankTexture=null,this.normalTexture=null,this.whiteTexture=null,this.maskCount=0,this.maskStack=[],this.currentMask={mask:null,camera:null},this.currentCameraMask={mask:null,camera:null},this.glFuncMap=null,this.currentType="",this.newType=!1,this.nextTypeMatch=!1,this.finalType=!1,this.mipmapFilter=null,this.defaultScissor=[0,0,0,0],this.isBooted=!1,this.renderTarget=null,this.projectionMatrix,this.projectionWidth=0,this.projectionHeight=0,this.maskSource=null,this.maskTarget=null,this.spector=null,this._debugCapture=!1,this.init(this.config)},init:function(t){var e,i=this.game,n=this.canvas,r=t.backgroundColor;if(!(e=i.config.context?i.config.context:n.getContext("webgl",t.contextCreation)||n.getContext("experimental-webgl",t.contextCreation))||e.isContextLost())throw this.contextLost=!0,new Error("WebGL unsupported");this.gl=e;var o=this,h=function(){var t=e.getSupportedExtensions();o.supportedExtensions=t;var i="ANGLE_instanced_arrays";o.instancedArraysExtension=t.indexOf(i)>-1?e.getExtension(i):null;var s="OES_vertex_array_object";o.vaoExtension=t.indexOf(s)>-1?e.getExtension(s):null};h(),this.contextLostHandler=function(t){o.contextLost=!0,console&&console.warn("WebGL Context lost. Renderer disabled"),o.emit(l.LOSE_WEBGL,o),t.preventDefault()},n.addEventListener("webglcontextlost",this.contextLostHandler,!1),this.contextRestoredHandler=function(t){if(e.isContextLost())console&&console.log("WebGL Context restored, but context is still lost");else{o.currentProgram=null,o.currentFramebuffer=null,o.setBlendMode(a.BlendModes.NORMAL),e.disable(e.BLEND),e.disable(e.DEPTH_TEST),e.enable(e.CULL_FACE),o.compression=o.getCompressedTextures();var i=function(t){t.createResource()};s(o.glTextureWrappers,i),s(o.glBufferWrappers,i),s(o.glFramebufferWrappers,i),s(o.glProgramWrappers,i),s(o.glAttribLocationWrappers,i),s(o.glUniformLocationWrappers,i),o.createTemporaryTextures(),o.pipelines.restoreContext(),o.resize(o.game.scale.baseSize.width,o.game.scale.baseSize.height),h(),o.contextLost=!1,console&&console.warn("WebGL Context restored. Renderer running again."),o.emit(l.RESTORE_WEBGL,o),t.preventDefault()}},n.addEventListener("webglcontextrestored",this.contextRestoredHandler,!1),i.context=e;for(var u=0;u<=27;u++)this.blendModes.push({func:[e.ONE,e.ONE_MINUS_SRC_ALPHA],equation:e.FUNC_ADD});return this.blendModes[1].func=[e.ONE,e.DST_ALPHA],this.blendModes[2].func=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA],this.blendModes[3].func=[e.ONE,e.ONE_MINUS_SRC_COLOR],this.blendModes[17]={func:[e.ZERO,e.ONE_MINUS_SRC_ALPHA],equation:e.FUNC_REVERSE_SUBTRACT},this.glFormats=[e.BYTE,e.SHORT,e.UNSIGNED_BYTE,e.UNSIGNED_SHORT,e.FLOAT],this.glFuncMap={mat2:{func:e.uniformMatrix2fv,length:1,matrix:!0},mat3:{func:e.uniformMatrix3fv,length:1,matrix:!0},mat4:{func:e.uniformMatrix4fv,length:1,matrix:!0},"1f":{func:e.uniform1f,length:1},"1fv":{func:e.uniform1fv,length:1},"1i":{func:e.uniform1i,length:1},"1iv":{func:e.uniform1iv,length:1},"2f":{func:e.uniform2f,length:2},"2fv":{func:e.uniform2fv,length:1},"2i":{func:e.uniform2i,length:2},"2iv":{func:e.uniform2iv,length:1},"3f":{func:e.uniform3f,length:3},"3fv":{func:e.uniform3fv,length:1},"3i":{func:e.uniform3i,length:3},"3iv":{func:e.uniform3iv,length:1},"4f":{func:e.uniform4f,length:4},"4fv":{func:e.uniform4fv,length:1},"4i":{func:e.uniform4i,length:4},"4iv":{func:e.uniform4iv,length:1}},t.maxTextures&&-1!==t.maxTextures||(t.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)),t.maxTextureSize||(t.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)),this.compression=this.getCompressedTextures(),e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.enable(e.BLEND),e.clearColor(r.redGL,r.greenGL,r.blueGL,r.alphaGL),-1!==["NEAREST","LINEAR","NEAREST_MIPMAP_NEAREST","LINEAR_MIPMAP_NEAREST","NEAREST_MIPMAP_LINEAR","LINEAR_MIPMAP_LINEAR"].indexOf(t.mipmapFilter)&&(this.mipmapFilter=e[t.mipmapFilter]),this.maxTextures=m.checkShaderMax(e,t.maxTextures),this.textureIndexes=[],this.createTemporaryTextures(),this.pipelines=new f(this),this.setBlendMode(a.BlendModes.NORMAL),this.projectionMatrix=(new c).identity(),i.textures.once(g.READY,this.boot,this),this},boot:function(){var t=this.game,e=this.pipelines,i=t.scale.baseSize,s=i.width,n=i.height;this.width=s,this.height=n,this.isBooted=!0,this.renderTarget=new p(this,s,n,1,0,!0,!0),this.maskTarget=new p(this,s,n,1,0,!0,!0),this.maskSource=new p(this,s,n,1,0,!0,!0);var r=t.config;e.boot(r.pipeline,r.defaultPipeline,r.autoMobilePipeline),this.blankTexture=t.textures.getFrame("__DEFAULT").glTexture,this.normalTexture=t.textures.getFrame("__NORMAL").glTexture,this.whiteTexture=t.textures.getFrame("__WHITE").glTexture;var o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,null),o.enable(o.SCISSOR_TEST),t.scale.on(v.RESIZE,this.onResize,this),this.resize(s,n)},createTemporaryTextures:function(){for(var t=this.gl,e=0;e0&&s>0;if(o&&a){var h=o[0],l=o[1],u=o[2],c=o[3];a=h!==t||l!==e||u!==i||c!==s}a&&(this.flush(),r.scissor(t,n-e-s,i,s))},resetScissor:function(){var t=this.gl;t.enable(t.SCISSOR_TEST);var e=this.currentScissor;if(e){var i=e[0],s=e[1],n=e[2],r=e[3];n>0&&r>0&&t.scissor(i,this.drawingBufferHeight-s-r,n,r)}},popScissor:function(){var t=this.scissorStack;t.pop();var e=t[t.length-1];e&&this.setScissor(e[0],e[1],e[2],e[3]),this.currentScissor=e},hasActiveStencilMask:function(){var t=this.currentMask.mask,e=this.currentCameraMask.mask;return t&&t.isStencil||e&&e.isStencil},resetViewport:function(){var t=this.gl;t.viewport(0,0,this.width,this.height),this.drawingBufferHeight=t.drawingBufferHeight},setBlendMode:function(t,e){void 0===e&&(e=!1);var i=this.gl,s=this.blendModes[t];return!!(e||t!==a.BlendModes.SKIP_CHECK&&this.currentBlendMode!==t)&&(this.flush(),i.enable(i.BLEND),i.blendEquation(s.equation),s.func.length>2?i.blendFuncSeparate(s.func[0],s.func[1],s.func[2],s.func[3]):i.blendFunc(s.func[0],s.func[1]),this.currentBlendMode=t,!0)},addBlendMode:function(t,e){return this.blendModes.push({func:t,equation:e})-1},updateBlendMode:function(t,e,i){return this.blendModes[t]&&(this.blendModes[t].func=e,i&&(this.blendModes[t].equation=i)),this},removeBlendMode:function(t){return t>17&&this.blendModes[t]&&this.blendModes.splice(t,1),this},pushFramebuffer:function(t,e,i,s,n){return t===this.currentFramebuffer?this:(this.fboStack.push(t),this.setFramebuffer(t,e,i,s,n))},setFramebuffer:function(t,e,i,s,n){if(void 0===e&&(e=!1),void 0===i&&(i=!0),void 0===s&&(s=null),void 0===n&&(n=!1),t===this.currentFramebuffer)return this;var r=this.gl,o=this.width,a=this.height;return t&&t.renderTexture&&i?(o=t.renderTexture.width,a=t.renderTexture.height):this.flush(),t?r.bindFramebuffer(r.FRAMEBUFFER,t.webGLFramebuffer):r.bindFramebuffer(r.FRAMEBUFFER,null),i&&r.viewport(0,0,o,a),s&&r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,s.webGLTexture,0),n&&(r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT)),e&&(t?(this.drawingBufferHeight=a,this.pushScissor(0,0,o,a)):(this.drawingBufferHeight=this.height,this.popScissor())),this.currentFramebuffer=t,this},popFramebuffer:function(t,e){void 0===t&&(t=!1),void 0===e&&(e=!0);var i=this.fboStack;i.pop();var s=i[i.length-1];return s||(s=null),this.setFramebuffer(s,t,e),s},restoreFramebuffer:function(t,e){void 0===t&&(t=!1),void 0===e&&(e=!0);var i=this.fboStack,s=i[i.length-1];s||(s=null),this.currentFramebuffer=null,this.setFramebuffer(s,t,e)},setProgram:function(t){return t!==this.currentProgram&&(this.flush(),this.gl.useProgram(t.webGLProgram),this.currentProgram=t,!0)},resetProgram:function(){return this.gl.useProgram(this.currentProgram.webGLProgramWrapper),this},createTextureFromSource:function(t,e,i,s,n){void 0===n&&(n=!1);var r=this.gl,o=r.NEAREST,h=r.NEAREST,l=r.CLAMP_TO_EDGE;e=t?t.width:e,i=t?t.height:i;var c=u(e,i);if(c&&!n&&(l=r.REPEAT),s===a.ScaleModes.LINEAR&&this.config.antialias){var d=t&&t.compressed,f=!d&&c||d&&t.mipmaps.length>1;o=this.mipmapFilter&&f?this.mipmapFilter:r.LINEAR,h=r.LINEAR}return t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,o,h,l,l,r.RGBA,t):this.createTexture2D(0,o,h,l,l,r.RGBA,null,e,i)},createTexture2D:function(t,e,i,s,n,r,o,a,h,l,u,c){"number"!=typeof a&&(a=o?o.width:1),"number"!=typeof h&&(h=o?o.height:1);var d=new w(this.gl,t,e,i,s,n,r,o,a,h,l,u,c);return this.glTextureWrappers.push(d),d},createFramebuffer:function(t,e,i,s){this.currentFramebuffer=null;var n=new b(this.gl,t,e,i,s);return this.glFramebufferWrappers.push(n),n},beginBitmapMask:function(t,e){this.gl&&(this.flush(),this.maskTarget.bind(!0),this.currentCameraMask.mask!==t&&(this.currentMask.mask=t,this.currentMask.camera=e))},drawBitmapMask:function(t,e,i){this.flush(),this.maskSource.bind(),this.setBlendMode(0,!0),t.renderWebGL(this,t,e),this.maskSource.unbind(!0),this.maskTarget.unbind();var s=this.gl,n=this.getCurrentStencilMask();n?(s.enable(s.STENCIL_TEST),n.mask.applyStencil(this,n.camera,!0)):this.currentMask.mask=null,this.pipelines.set(i),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.maskTarget.texture.webGLTexture),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,this.maskSource.texture.webGLTexture)},createProgram:function(t,e){var i=new T(this.gl,t,e);return this.glProgramWrappers.push(i),i},createVertexBuffer:function(t,e){var i=this.gl,s=new x(i,t,i.ARRAY_BUFFER,e);return this.glBufferWrappers.push(s),s},createAttribLocation:function(t,e){var i=new S(this.gl,t,e);return this.glAttribLocationWrappers.push(i),i},createUniformLocation:function(t,e){var i=new E(this.gl,t,e);return this.glUniformLocationWrappers.push(i),i},createIndexBuffer:function(t,e){var i=this.gl,s=new x(i,t,i.ELEMENT_ARRAY_BUFFER,e);return this.glBufferWrappers.push(s),s},deleteTexture:function(t){if(t)return n(this.glTextureWrappers,t),t.destroy(),this},deleteFramebuffer:function(t){return t?(n(this.fboStack,t),n(this.glFramebufferWrappers,t),t.destroy(),this):this},deleteProgram:function(t){return t&&(n(this.glProgramWrappers,t),t.destroy()),this},deleteAttribLocation:function(t){return t&&(n(this.glAttribLocationWrappers,t),t.destroy()),this},deleteUniformLocation:function(t){return t&&(n(this.glUniformLocationWrappers,t),t.destroy()),this},deleteBuffer:function(t){return t?(n(this.glBufferWrappers,t),t.destroy(),this):this},preRenderCamera:function(t){var e=t.x,i=t.y,s=t.width,n=t.height,o=t.backgroundColor;t.emit(r.PRE_RENDER,t),this.pipelines.preBatchCamera(t),this.pushScissor(e,i,s,n),t.mask&&(this.currentCameraMask.mask=t.mask,this.currentCameraMask.camera=t._maskCamera,t.mask.preRenderWebGL(this,t,t._maskCamera)),o.alphaGL>0&&this.pipelines.setMulti().drawFillRect(e,i,s,n,m.getTintFromFloats(o.blueGL,o.greenGL,o.redGL,1),o.alphaGL)},getCurrentStencilMask:function(){var t=null,e=this.maskStack,i=this.currentCameraMask;return e.length>0?t=e[e.length-1]:i.mask&&i.mask.isStencil&&(t=i),t},postRenderCamera:function(t){var e=t.flashEffect,i=t.fadeEffect;if(e.isRunning||i.isRunning||i.isComplete){var s=this.pipelines.setMulti();e.postRenderWebGL(s,m.getTintFromFloats),i.postRenderWebGL(s,m.getTintFromFloats)}t.dirty=!1,this.popScissor(),t.mask&&(this.currentCameraMask.mask=null,t.mask.postRenderWebGL(this,t._maskCamera)),this.pipelines.postBatchCamera(t),t.emit(r.POST_RENDER,t)},preRender:function(){if(!this.contextLost){var t=this.gl;if(t.bindFramebuffer(t.FRAMEBUFFER,null),this.config.clearBeforeRender){var e=this.config.backgroundColor;t.clearColor(e.redGL,e.greenGL,e.blueGL,e.alphaGL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)}t.enable(t.SCISSOR_TEST),this.currentScissor=this.defaultScissor,this.scissorStack.length=0,this.scissorStack.push(this.currentScissor),this.game.scene.customViewports&&t.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.currentMask.mask=null,this.currentCameraMask.mask=null,this.maskStack.length=0,this.emit(l.PRE_RENDER)}},render:function(t,e,i){if(!this.contextLost){var s=e.length;if(this.emit(l.RENDER,t,i),this.preRenderCamera(i),0===s)return this.setBlendMode(a.BlendModes.NORMAL),void this.postRenderCamera(i);this.currentType="";for(var n=this.currentMask,r=0;r{var s=i(83419),n=i(95428),r=i(95540),o=i(14500),a=new s({initialize:function(t,e,i,s,n){this.pipeline=t,this.name=e,this.renderer=t.renderer,this.gl=this.renderer.gl,this.fragSrc=s,this.vertSrc=i,this.program=this.renderer.createProgram(i,s),this.attributes,this.vertexComponentCount=0,this.vertexSize=0,this.uniforms={},this.createAttributes(n),this.createUniforms()},createAttributes:function(t){var e=0,i=0,s=[];this.vertexComponentCount=0;for(var n=0;n=0?(e.enableVertexAttribArray(p.webGLAttribLocation),e.vertexAttribPointer(p.webGLAttribLocation,h,l,f,s,u),a.enabled=!0,a.location=p):-1!==p.webGLAttribLocation&&e.disableVertexAttribArray(p.webGLAttribLocation)}else c?e.vertexAttribPointer(d.webGLAttribLocation,h,l,f,s,u):!c&&-1!==d&&d.webGLAttribLocation>-1&&(e.disableVertexAttribArray(d.webGLAttribLocation),a.location=-1)}return this},createUniforms:function(){var t,e,i,s=this.gl,n=this.program,r=this.uniforms,o=s.getProgramParameter(n.webGLProgram,s.ACTIVE_UNIFORMS);for(t=0;t0&&(e=e.substr(0,h),r.hasOwnProperty(e)||null!==(i=this.renderer.createUniformLocation(n,e))&&(r[e]={name:e,location:i,setter:null,value1:null,value2:null,value3:null,value4:null}))}}return this},syncUniforms:function(){var t=this.gl;for(var e in this.renderer.setProgram(this.program),this.uniforms){var i=this.uniforms[e];i.setter&&i.setter.call(t,i.location.webGLUniformLocation,i.value1,i.value2,i.value3,i.value4)}},hasUniform:function(t){return this.uniforms.hasOwnProperty(t)},resetUniform:function(t){var e=this.uniforms[t];return e&&(e.value1=null,e.value2=null,e.value3=null,e.value4=null),this},setUniform1:function(t,e,i,s){var n=this.uniforms[e];return n?((s||n.value1!==i)&&(n.setter||(n.setter=t),n.value1=i,this.renderer.setProgram(this.program),t.call(this.gl,n.location.webGLUniformLocation,i),this.pipeline.currentShader=this),this):this},setUniform2:function(t,e,i,s,n){var r=this.uniforms[e];return r?((n||r.value1!==i||r.value2!==s)&&(r.setter||(r.setter=t),r.value1=i,r.value2=s,this.renderer.setProgram(this.program),t.call(this.gl,r.location.webGLUniformLocation,i,s),this.pipeline.currentShader=this),this):this},setUniform3:function(t,e,i,s,n,r){var o=this.uniforms[e];return o?((r||o.value1!==i||o.value2!==s||o.value3!==n)&&(o.setter||(o.setter=t),o.value1=i,o.value2=s,o.value3=n,this.renderer.setProgram(this.program),t.call(this.gl,o.location.webGLUniformLocation,i,s,n),this.pipeline.currentShader=this),this):this},setUniform4:function(t,e,i,s,n,r,o){var a=this.uniforms[e];return a?((o||a.value1!==i||a.value2!==s||a.value3!==n||a.value4!==r)&&(a.setter||(a.setter=t),a.value1=i,a.value2=s,a.value3=n,a.value4=r,this.renderer.setProgram(this.program),t.call(this.gl,a.location.webGLUniformLocation,i,s,n,r),this.pipeline.currentShader=this),this):this},setBoolean:function(t,e){return this.setUniform1(this.gl.uniform1i,t,Number(e))},set1f:function(t,e){return this.setUniform1(this.gl.uniform1f,t,e)},set2f:function(t,e,i){return this.setUniform2(this.gl.uniform2f,t,e,i)},set3f:function(t,e,i,s){return this.setUniform3(this.gl.uniform3f,t,e,i,s)},set4f:function(t,e,i,s,n){return this.setUniform4(this.gl.uniform4f,t,e,i,s,n)},set1fv:function(t,e){return this.setUniform1(this.gl.uniform1fv,t,e,!0)},set2fv:function(t,e){return this.setUniform1(this.gl.uniform2fv,t,e,!0)},set3fv:function(t,e){return this.setUniform1(this.gl.uniform3fv,t,e,!0)},set4fv:function(t,e){return this.setUniform1(this.gl.uniform4fv,t,e,!0)},set1iv:function(t,e){return this.setUniform1(this.gl.uniform1iv,t,e,!0)},set2iv:function(t,e){return this.setUniform1(this.gl.uniform2iv,t,e,!0)},set3iv:function(t,e){return this.setUniform1(this.gl.uniform3iv,t,e,!0)},set4iv:function(t,e){return this.setUniform1(this.gl.uniform4iv,t,e,!0)},set1i:function(t,e){return this.setUniform1(this.gl.uniform1i,t,e)},set2i:function(t,e,i){return this.setUniform2(this.gl.uniform2i,t,e,i)},set3i:function(t,e,i,s){return this.setUniform3(this.gl.uniform3i,t,e,i,s)},set4i:function(t,e,i,s,n){return this.setUniform4(this.gl.uniform4i,t,e,i,s,n)},setMatrix2fv:function(t,e,i){return this.setUniform2(this.gl.uniformMatrix2fv,t,e,i,!0)},setMatrix3fv:function(t,e,i){return this.setUniform2(this.gl.uniformMatrix3fv,t,e,i,!0)},setMatrix4fv:function(t,e,i){return this.setUniform2(this.gl.uniformMatrix4fv,t,e,i,!0)},createProgram:function(t,e){return void 0===t&&(t=this.vertSrc),void 0===e&&(e=this.fragSrc),this.program&&this.renderer.deleteProgram(this.program),this.vertSrc=t,this.fragSrc=e,this.program=this.renderer.createProgram(t,e),this.createUniforms(),this.rebind()},destroy:function(){var t=this.renderer;n(this.uniforms,(function(e){t.deleteUniformLocation(e.location)})),this.uniforms=null,n(this.attributes,(function(e){t.deleteAttribLocation(e.location)})),this.attributes=null,t.deleteProgram(this.program),this.pipeline=null,this.renderer=null,this.gl=null,this.program=null}});t.exports=a},14500:t=>{t.exports={BYTE:{enum:5120,size:1},UNSIGNED_BYTE:{enum:5121,size:1},SHORT:{enum:5122,size:2},UNSIGNED_SHORT:{enum:5123,size:2},INT:{enum:5124,size:4},UNSIGNED_INT:{enum:5125,size:4},FLOAT:{enum:5126,size:4}}},4159:(t,e,i)=>{var s=i(14500),n=i(79291),r={PipelineManager:i(7530),Pipelines:i(96615),RenderTarget:i(32302),Utils:i(70554),WebGLPipeline:i(29100),WebGLRenderer:i(74797),WebGLShader:i(38683),Wrappers:i(9503)};r=n(!1,r,s),t.exports=r},31302:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(78908),o=i(85191),a=i(14500),h=i(29100),l=new s({Extends:h,initialize:function(t){t.fragShader=n(t,"fragShader",r),t.vertShader=n(t,"vertShader",o),t.batchSize=n(t,"batchSize",1),t.vertices=n(t,"vertices",[-1,1,-1,-7,7,1]),t.attributes=n(t,"attributes",[{name:"inPosition",size:2,type:a.FLOAT}]),h.call(this,t)},boot:function(){h.prototype.boot.call(this),this.set1i("uMainSampler",0),this.set1i("uMaskSampler",1)},resize:function(t,e){h.prototype.resize.call(this,t,e),this.set2f("uResolution",t,e)},beginMask:function(t,e,i){this.renderer.beginBitmapMask(t,i)},endMask:function(t,e,i){var s=this.gl,n=this.renderer,r=t.bitmapMask;r&&s&&(n.drawBitmapMask(r,e,this),i&&this.set2f("uResolution",i.width,i.height),this.set1i("uInvertMaskAlpha",t.invertAlpha),s.drawArrays(this.topology,0,3),i&&this.set2f("uResolution",this.width,this.height),s.bindTexture(s.TEXTURE_2D,null))}});t.exports=l},92651:(t,e,i)=>{var s=i(83419),n=i(58918),r=i(14811),o=i(95540),a=i(43558),h=i(89350),l=i(70554),u=new s({Extends:a,initialize:function(t){t.shaders=[l.setGlowQuality(h.FXGlowFrag,t.game),h.FXShadowFrag,h.FXPixelateFrag,h.FXVignetteFrag,h.FXShineFrag,h.FXBlurLowFrag,h.FXBlurMedFrag,h.FXBlurHighFrag,h.FXGradientFrag,h.FXBloomFrag,h.ColorMatrixFrag,h.FXCircleFrag,h.FXBarrelFrag,h.FXDisplacementFrag,h.FXWipeFrag,h.FXBokehFrag],a.call(this,t);var e=this.game;this.glow=new n.Glow(e),this.shadow=new n.Shadow(e),this.pixelate=new n.Pixelate(e),this.vignette=new n.Vignette(e),this.shine=new n.Shine(e),this.gradient=new n.Gradient(e),this.circle=new n.Circle(e),this.barrel=new n.Barrel(e),this.wipe=new n.Wipe(e),this.bokeh=new n.Bokeh(e);var i=[];i[r.GLOW]=this.onGlow,i[r.SHADOW]=this.onShadow,i[r.PIXELATE]=this.onPixelate,i[r.VIGNETTE]=this.onVignette,i[r.SHINE]=this.onShine,i[r.BLUR]=this.onBlur,i[r.GRADIENT]=this.onGradient,i[r.BLOOM]=this.onBloom,i[r.COLOR_MATRIX]=this.onColorMatrix,i[r.CIRCLE]=this.onCircle,i[r.BARREL]=this.onBarrel,i[r.DISPLACEMENT]=this.onDisplacement,i[r.WIPE]=this.onWipe,i[r.BOKEH]=this.onBokeh,this.fxHandlers=i,this.source,this.target,this.swap},onDraw:function(t,e,i){this.source=t,this.target=e,this.swap=i;var s=t.width,n=t.height,r=this.tempSprite,o=this.fxHandlers;if(r&&r.preFX)for(var a=r.preFX.list,h=0;h{var s=i(83419),n=i(95540),r=i(31063),o=i(57516),a=i(61340),h=i(26099),l=i(29100),u=new s({Extends:o,initialize:function(t){var e=n(t,"fragShader",r);t.fragShader=e.replace("%LIGHT_COUNT%",t.game.renderer.config.maxLights),o.call(this,t),this.inverseRotationMatrix=new Float32Array([1,0,0,0,1,0,0,0,1]),this.currentNormalMap,this.lightsActive=!0,this.tempVec2=new h,this._tempMatrix=new a,this._tempMatrix2=new a},boot:function(){l.prototype.boot.call(this)},onRender:function(t,e){var i=t.sys.lights;if(this.lightsActive=!1,i&&i.active){var s,n=i.getLights(e),r=n.length;this.lightsActive=!0;var o=this.renderer.height,a=e.matrix,h=this.tempVec2;for(this.set1i("uMainSampler",0),this.set1i("uNormSampler",1),this.set2f("uResolution",this.width/2,this.height/2),this.set4f("uCamera",e.x,e.y,e.rotation,e.zoom),this.set3f("uAmbientLightColor",i.ambientColor.r,i.ambientColor.g,i.ambientColor.b),this.set1i("uLightCount",r),s=0;s0&&this.flush();var e=this.inverseRotationMatrix;if(t){var i=-t,s=Math.cos(i),n=Math.sin(i);e[1]=n,e[3]=-n,e[0]=e[4]=s}else e[0]=e[4]=1,e[1]=e[3]=0;this.setMatrix3fv("uInverseRotationMatrix",!1,e),this.currentNormalMapRotation=t}},setTexture2D:function(t,e){var i=this.renderer;void 0===t&&(t=i.whiteTexture);var s=this.getNormalMap(e);this.isNewNormalMap(t,s)&&(this.flush(),this.createBatch(t),this.addTextureToBatch(s),this.currentNormalMap=s);var n=0;return e&&e.parentContainer?n=e.getWorldTransformMatrix(this._tempMatrix,this._tempMatrix2).rotationNormalized:e&&(n=e.rotation),this.setNormalMapRotation(n),0},setGameObject:function(t,e){void 0===e&&(e=t.frame);var i=e.glTexture,s=this.getNormalMap(t);if(this.isNewNormalMap(i,s)&&(this.flush(),this.createBatch(i),this.addTextureToBatch(s),this.currentNormalMap=s),t.parentContainer){var n=t.getWorldTransformMatrix(this._tempMatrix,this._tempMatrix2);this.setNormalMapRotation(n.rotationNormalized)}else this.setNormalMapRotation(t.rotation);return 0},isNewNormalMap:function(t,e){return this.currentTexture!==t||this.currentNormalMap!==e},getNormalMap:function(t){var e;return t?(t.displayTexture?e=t.displayTexture.dataSource[t.displayFrame.sourceIndex]:t.texture?e=t.texture.dataSource[t.frame.sourceIndex]:t.tileset&&(e=Array.isArray(t.tileset)?t.tileset[0].image.dataSource[0]:t.tileset.image.dataSource[0]),e?e.glTexture:this.renderer.normalTexture):this.renderer.normalTexture},batchSprite:function(t,e,i){this.lightsActive&&o.prototype.batchSprite.call(this,t,e,i)},batchTexture:function(t,e,i,s,n,r,a,h,l,u,c,d,f,p,v,g,m,y,x,T,w,b,S,E,A,C,_,M,P,R,L,O){this.lightsActive&&o.prototype.batchTexture.call(this,t,e,i,s,n,r,a,h,l,u,c,d,f,p,v,g,m,y,x,T,w,b,S,E,A,C,_,M,P,R,L,O)},batchTextureFrame:function(t,e,i,s,n,r,a){this.lightsActive&&o.prototype.batchTextureFrame.call(this,t,e,i,s,n,r,a)}});t.exports=u},56527:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(57516),o=i(45561),a=i(60722),h=i(14500),l=i(29100),u=new s({Extends:r,initialize:function(t){t.fragShader=n(t,"fragShader",o),t.vertShader=n(t,"vertShader",a),t.attributes=n(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2},{name:"inTexId"},{name:"inTintEffect"},{name:"inTint",size:4,type:h.UNSIGNED_BYTE,normalized:!0}]),t.forceZero=!0,t.resizeUniform="uResolution",r.call(this,t)},boot:function(){l.prototype.boot.call(this);var t=this.renderer;this.set1i("uMainSampler",0),this.set2f("uResolution",t.width,t.height),this.set1i("uRoundPixels",t.config.roundPixels)}});t.exports=u},57516:(t,e,i)=>{var s=i(83419),n=i(94811),r=i(95540),o=i(98840),a=i(44667),h=i(61340),l=i(70554),u=i(14500),c=i(29100),d=new s({Extends:c,initialize:function(t){var e=t.game.renderer,i=r(t,"fragShader",o);t.fragShader=l.parseFragmentShaderMaxTextures(i,e.maxTextures),t.vertShader=r(t,"vertShader",a),t.attributes=r(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2},{name:"inTexId"},{name:"inTintEffect"},{name:"inTint",size:4,type:u.UNSIGNED_BYTE,normalized:!0}]),t.resizeUniform="uResolution",c.call(this,t),this._tempMatrix1=new h,this._tempMatrix2=new h,this._tempMatrix3=new h,this.calcMatrix=new h,this.tempTriangle=[{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0}],this.strokeTint={TL:0,TR:0,BL:0,BR:0},this.fillTint={TL:0,TR:0,BL:0,BR:0},this.currentFrame={u0:0,v0:0,u1:1,v1:1},this.firstQuad=[0,0,0,0,0],this.prevQuad=[0,0,0,0,0],this.polygonCache=[]},boot:function(){c.prototype.boot.call(this);var t=this.renderer;this.set1iv("uMainSampler",t.textureIndexes),this.set2f("uResolution",t.width,t.height),this.set1i("uRoundPixels",t.config.roundPixels)},batchSprite:function(t,e,i){this.manager.set(this,t);var s=this._tempMatrix1,n=this._tempMatrix2,r=this._tempMatrix3,o=t.frame,a=o.glTexture,h=o.u0,u=o.v0,c=o.u1,d=o.v1,f=o.x,p=o.y,v=o.cutWidth,g=o.cutHeight,m=o.customPivot,y=t.displayOriginX,x=t.displayOriginY,T=-y+f,w=-x+p;if(t.isCropped){var b=t._crop;b.flipX===t.flipX&&b.flipY===t.flipY||o.updateCropUVs(b,t.flipX,t.flipY),h=b.u0,u=b.v0,c=b.u1,d=b.v1,v=b.width,g=b.height,T=-y+(f=b.x),w=-x+(p=b.y)}var S=1,E=1;t.flipX&&(m||(T+=-o.realWidth+2*y),S=-1),t.flipY&&(m||(w+=-o.realHeight+2*x),E=-1);var A=t.x,C=t.y;n.applyITRS(A,C,t.rotation,t.scaleX*S,t.scaleY*E),s.copyFrom(e.matrix),i?(s.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),n.e=A,n.f=C):(n.e-=e.scrollX*t.scrollFactorX,n.f-=e.scrollY*t.scrollFactorY),s.multiply(n,r);var _=r.setQuad(T,w,T+v,w+g),M=l.getTintAppendFloatAlpha,P=e.alpha,R=M(t.tintTopLeft,P*t._alphaTL),L=M(t.tintTopRight,P*t._alphaTR),O=M(t.tintBottomLeft,P*t._alphaBL),F=M(t.tintBottomRight,P*t._alphaBR);this.shouldFlush(6)&&this.flush();var D=this.setGameObject(t,o);this.manager.preBatch(t),this.currentShader.set1i("uRoundPixels",e.roundPixels),this.batchQuad(t,_[0],_[1],_[2],_[3],_[4],_[5],_[6],_[7],h,u,c,d,R,L,O,F,t.tintFill,a,D),this.manager.postBatch(t)},batchTexture:function(t,e,i,s,n,r,o,a,h,l,u,c,d,f,p,v,g,m,y,x,T,w,b,S,E,A,C,_,M,P,R,L,O){void 0===O&&(O=!1),this.manager.set(this,t);var F=this._tempMatrix1,D=this._tempMatrix2,k=this._tempMatrix3,I=m/i+C,B=y/s+_,N=(m+x)/i+C,U=(y+T)/s+_,X=o,Y=a,z=-v,G=-g;if(t.isCropped){var V=t._crop,W=V.width,H=V.height;X=W,Y=H,o=W,a=H;var j=m=V.x,q=y=V.y;c&&(j=x-V.x-W),d&&(q=T-V.y-H),I=j/i+C,B=q/s+_,N=(j+W)/i+C,U=(q+H)/s+_,z=-v+m,G=-g+y}c&&(X*=-1,z+=o),(d^=!R&&e.isRenderTexture?1:0)&&(Y*=-1,G+=a),D.applyITRS(n,r,u,h,l),F.copyFrom(M.matrix),P?(F.multiplyWithOffset(P,-M.scrollX*f,-M.scrollY*p),D.e=n,D.f=r):(D.e-=M.scrollX*f,D.f-=M.scrollY*p),F.multiply(D,k);var K=k.setQuad(z,G,z+X,G+Y);null==L&&(L=this.setTexture2D(e)),t&&!O&&this.manager.preBatch(t),this.currentShader.set1i("uRoundPixels",M.roundPixels),this.batchQuad(t,K[0],K[1],K[2],K[3],K[4],K[5],K[6],K[7],I,B,N,U,w,b,S,E,A,e,L),t&&!O&&this.manager.postBatch(t)},batchTextureFrame:function(t,e,i,s,n,r,o){this.manager.set(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2;o?a.multiply(o,h):h=a;var u=h.setQuad(e,i,e+t.width,i+t.height),c=this.setTexture2D(t.source.glTexture);s=l.getTintAppendFloatAlpha(s,n),this.batchQuad(null,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],t.u0,t.v0,t.u1,t.v1,s,s,s,s,0,t.glTexture,c)},batchFillRect:function(t,e,i,s,n,r){this.renderer.pipelines.set(this);var o=this.calcMatrix;r&&r.multiply(n,o);var a=o.setQuad(t,e,t+i,e+s),h=this.fillTint;this.batchQuad(null,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],0,0,1,1,h.TL,h.TR,h.BL,h.BR,2)},batchFillTriangle:function(t,e,i,s,n,r,o,a){this.renderer.pipelines.set(this);var h=this.calcMatrix;a&&a.multiply(o,h);var l=h.getX(t,e),u=h.getY(t,e),c=h.getX(i,s),d=h.getY(i,s),f=h.getX(n,r),p=h.getY(n,r),v=this.fillTint;this.currentShader.set1i("uRoundPixels",!1),this.batchTri(null,l,u,c,d,f,p,0,0,1,1,v.TL,v.TR,v.BL,2)},batchStrokeTriangle:function(t,e,i,s,n,r,o,a,h){var l=this.tempTriangle;l[0].x=t,l[0].y=e,l[0].width=o,l[1].x=i,l[1].y=s,l[1].width=o,l[2].x=n,l[2].y=r,l[2].width=o,l[3].x=t,l[3].y=e,l[3].width=o,this.batchStrokePath(l,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.pipelines.set(this);var s=this.calcMatrix;i&&i.multiply(e,s);for(var r,o,a=t.length,h=this.polygonCache,l=this.fillTint.TL,u=this.fillTint.TR,c=this.fillTint.BL,d=0;d0&&X[4]?this.batchQuad(null,F,D,P,R,X[0],X[1],X[2],X[3],0,0,1,1,I,B,N,U,2):(Y[0]=F,Y[1]=D,Y[2]=P,Y[3]=R,Y[4]=1),h&&Y[4]?this.batchQuad(null,_,M,L,O,Y[0],Y[1],Y[2],Y[3],0,0,1,1,I,B,N,U,2):(X[0]=_,X[1]=M,X[2]=L,X[3]=O,X[4]=1)}}},destroy:function(){return this._tempMatrix1.destroy(),this._tempMatrix2.destroy(),this._tempMatrix3.destroy(),this._tempMatrix1=null,this._tempMatrix1=null,this._tempMatrix1=null,c.prototype.destroy.call(this),this}});t.exports=d},43439:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(4127),o=i(89924),a=i(29100),h=new s({Extends:a,initialize:function(t){t.vertShader=n(t,"vertShader",o),t.fragShader=n(t,"fragShader",r),t.attributes=n(t,"attributes",[{name:"inPosition",size:2},{name:"inLightPosition",size:2},{name:"inLightRadius"},{name:"inLightAttenuation"},{name:"inLightColor",size:4}]),a.call(this,t)},onRender:function(t,e){this.set2f("uResolution",this.width,this.height),this.set1f("uCameraZoom",e.zoom)},batchPointLight:function(t,e,i,s,n,r,o,a,h,l,u,c){var d=t.color,f=t.intensity,p=t.radius,v=t.attenuation,g=d.r*f,m=d.g*f,y=d.b*f,x=e.alpha*t.alpha;this.shouldFlush(6)&&this.flush(),this.currentBatch||this.setTexture2D(),this.batchLightVert(i,s,u,c,p,v,g,m,y,x),this.batchLightVert(n,r,u,c,p,v,g,m,y,x),this.batchLightVert(o,a,u,c,p,v,g,m,y,x),this.batchLightVert(i,s,u,c,p,v,g,m,y,x),this.batchLightVert(o,a,u,c,p,v,g,m,y,x),this.batchLightVert(h,l,u,c,p,v,g,m,y,x),this.currentBatch.count=this.vertexCount-this.currentBatch.start},batchLightVert:function(t,e,i,s,n,r,o,a,h,l){var u=this.vertexViewF32,c=this.vertexCount*this.currentShader.vertexComponentCount-1;u[++c]=t,u[++c]=e,u[++c]=i,u[++c]=s,u[++c]=n,u[++c]=r,u[++c]=o,u[++c]=a,u[++c]=h,u[++c]=l,this.vertexCount++}});t.exports=h},84057:(t,e,i)=>{var s=i(83419),n=i(89422),r=i(95540),o=i(27681),a=i(49627),h=i(29100),l=new s({Extends:h,initialize:function(t){t.renderTarget=r(t,"renderTarget",1),t.fragShader=r(t,"fragShader",o),t.vertShader=r(t,"vertShader",a),t.attributes=r(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2}]),t.batchSize=1,t.vertices=[-1,-1,0,0,-1,1,0,1,1,1,1,1,-1,-1,0,0,1,1,1,1,1,-1,1,0],h.call(this,t),this.isPostFX=!0,this.gameObject,this.controller,this.colorMatrix=new n,this.fullFrame1,this.fullFrame2,this.halfFrame1,this.halfFrame2,this.renderer.isBooted&&(this.manager=this.renderer.pipelines)},bootFX:function(){h.prototype.boot.call(this);var t=this.manager.UTILITY_PIPELINE;this.fullFrame1=t.fullFrame1,this.fullFrame2=t.fullFrame2,this.halfFrame1=t.halfFrame1,this.halfFrame2=t.halfFrame2;var e=this.renderer;this.set1i("uMainSampler",0),this.set2f("uResolution",e.width,e.height),this.set1i("uRoundPixels",e.config.roundPixels);for(var i=this.renderTargets,s=0;s{var s=i(10312),n=i(67502),r=i(83419),o=i(96293),a=i(95540),h=i(57516),l=i(27681),u=i(87841),c=i(32302),d=i(45561),f=i(60722),p=i(29100),v=new r({Extends:h,initialize:function(t){var e=a(t,"fragShader",l),i=a(t,"vertShader",f),s=a(t,"drawShader",l),n=[{name:"DrawSprite",fragShader:d,vertShader:f},{name:"CopySprite",fragShader:e,vertShader:i},{name:"DrawGame",fragShader:s,vertShader:f},{name:"ColorMatrix",fragShader:o}],r=a(t,"shaders",[]);t.shaders=n.concat(r),t.vertShader||(t.vertShader=i),t.batchSize=1,h.call(this,t),this.isPreFX=!0,this.customMainSampler=null,this.drawSpriteShader,this.copyShader,this.gameShader,this.colorMatrixShader,this.quadVertexData,this.quadVertexBuffer,this.quadVertexViewF32,this.spriteBounds=new u,this.targetBounds=new u,this.fsTarget,this.tempSprite,this.renderer.isBooted&&(this.manager=this.renderer.pipelines,this.boot())},boot:function(){p.prototype.boot.call(this);var t=this.shaders,e=this.renderer;this.drawSpriteShader=t[0],this.copyShader=t[1],this.gameShader=t[2],this.colorMatrixShader=t[3],this.fsTarget=new c(e,e.width,e.height,1,0,!0,!0),this.renderTargets=this.manager.renderTargets.concat(this.fsTarget);var i=new ArrayBuffer(168);this.quadVertexData=i,this.quadVertexViewF32=new Float32Array(i),this.quadVertexBuffer=e.createVertexBuffer(i,this.gl.STATIC_DRAW),this.onResize(e.width,e.height),this.currentShader=this.copyShader,this.set2f("uResolution",e.width,e.height),this.set1i("uRoundPixels",e.config.roundPixels)},onResize:function(t,e){var i=this.quadVertexViewF32;i[1]=e,i[22]=e,i[14]=t,i[28]=t,i[35]=t,i[36]=e},batchQuad:function(t,e,i,s,r,o,a,h,l,u,c,d,f,p,v,g,m,y,x){var T=Math.min(e,s,o,h),w=Math.min(i,r,a,l),b=Math.max(e,s,o,h)-T,S=Math.max(i,r,a,l)-w,E=this.spriteBounds.setTo(T,w,b,S),A=t?t.preFX.padding:0,C=b+2*A,_=S+2*A,M=Math.abs(Math.max(C,_)),P=this.manager.getRenderTarget(M),R=this.targetBounds.setTo(0,0,P.width,P.height);n(R,E.centerX,E.centerY),this.tempSprite=t;var L=this.gl,O=this.renderer;O.clearStencilMask(),this.setShader(this.drawSpriteShader),this.set1i("uMainSampler",0),this.set2f("uResolution",O.width,O.height),this.set1i("uRoundPixels",O.config.roundPixels),this.flipProjectionMatrix(!0),t&&(this.onDrawSprite(t,P),t.preFX.onFX(this));var F=this.fsTarget;return this.flush(),L.viewport(0,0,O.width,O.height),L.bindFramebuffer(L.FRAMEBUFFER,F.framebuffer.webGLFramebuffer),L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,F.texture.webGLTexture,0),L.clearColor(0,0,0,0),L.clear(L.COLOR_BUFFER_BIT),this.setTexture2D(x),this.batchVert(e,i,u,c,0,y,p),this.batchVert(s,r,u,f,0,y,g),this.batchVert(o,a,d,f,0,y,m),this.batchVert(e,i,u,c,0,y,p),this.batchVert(o,a,d,f,0,y,m),this.batchVert(h,l,d,c,0,y,v),this.flush(),this.flipProjectionMatrix(!1),L.activeTexture(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,P.texture.webGLTexture),L.copyTexSubImage2D(L.TEXTURE_2D,0,0,0,R.x,R.y,R.width,R.height),L.bindFramebuffer(L.FRAMEBUFFER,null),L.bindTexture(L.TEXTURE_2D,null),this.onBatch(t),this.currentShader=this.copyShader,this.onDraw(P,this.manager.getSwapRenderTarget(),this.manager.getAltSwapRenderTarget()),!0},onDrawSprite:function(){},onCopySprite:function(){},copySprite:function(t,e,i,n,r,o,a){void 0===i&&(i=!0),void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===a&&(a=this.copyShader);var h=this.gl,l=this.tempSprite;o&&(a=this.colorMatrixShader),this.currentShader=a;var u=this.setVertexBuffer(this.quadVertexBuffer);a.bind(u,!1);var c=this.renderer;if(this.set1i("uMainSampler",0),this.set2f("uResolution",c.width,c.height),this.set1i("uRoundPixels",c.config.roundPixels),l.preFX.onFXCopy(this),this.onCopySprite(t,e,l),o&&(this.set1fv("uColorMatrix",o.getData()),this.set1f("uAlpha",o.alpha)),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,t.texture.webGLTexture),t.height>e.height)h.viewport(0,0,t.width,t.height),this.setTargetUVs(t,e);else{var d=e.height-t.height;h.viewport(0,d,t.width,t.height),this.resetUVs()}if(h.bindFramebuffer(h.FRAMEBUFFER,e.framebuffer.webGLFramebuffer),h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,e.texture.webGLTexture,0),i&&(h.clearColor(0,0,0,Number(!n)),h.clear(h.COLOR_BUFFER_BIT)),r){var f=this.renderer.currentBlendMode;this.renderer.setBlendMode(s.ERASE)}h.bufferData(h.ARRAY_BUFFER,this.quadVertexData,h.STATIC_DRAW),h.drawArrays(h.TRIANGLES,0,6),r&&this.renderer.setBlendMode(f),h.bindFramebuffer(h.FRAMEBUFFER,null)},copy:function(t,e){var i=this.gl;this.set1i("uMainSampler",0),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,t.texture.webGLTexture),i.viewport(0,0,t.width,t.height),this.setUVs(0,0,0,1,1,1,1,0),i.bindFramebuffer(i.FRAMEBUFFER,e.framebuffer.webGLFramebuffer),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.texture.webGLTexture,0),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.bufferData(i.ARRAY_BUFFER,this.quadVertexData,i.STATIC_DRAW),i.drawArrays(i.TRIANGLES,0,6),i.bindFramebuffer(i.FRAMEBUFFER,null)},blendFrames:function(t,e,i,s,n){this.manager.blendFrames(t,e,i,s,n)},blendFramesAdditive:function(t,e,i,s,n){this.manager.blendFramesAdditive(t,e,i,s,n)},drawToGame:function(t){this.currentShader=null,this.setShader(this.copyShader),this.bindAndDraw(t)},copyToGame:function(t){this.currentShader=null,this.setShader(this.gameShader),this.bindAndDraw(t)},bindAndDraw:function(t){var e=this.gl,i=this.renderer;this.set1i("uMainSampler",0),this.customMainSampler?this.setTexture2D(this.customMainSampler):this.setTexture2D(t.texture);var s=this._tempMatrix1.loadIdentity(),n=this.targetBounds.x,r=this.targetBounds.y,o=n+t.width,a=r+t.height,h=s.getX(n,r),l=s.getX(n,a),u=s.getX(o,a),c=s.getX(o,r),d=s.getY(n,r),f=s.getY(n,a),p=s.getY(o,a),v=s.getY(o,r),g=16777215;this.batchVert(h,d,0,0,0,0,g),this.batchVert(l,f,0,1,0,0,g),this.batchVert(u,p,1,1,0,0,g),this.batchVert(h,d,0,0,0,0,g),this.batchVert(u,p,1,1,0,0,g),this.batchVert(c,v,1,0,0,0,g),i.restoreFramebuffer(!1,!0),i.currentFramebuffer||e.viewport(0,0,i.width,i.height),i.restoreStencilMask(),this.flush(),this.tempSprite=null},onDraw:function(t){this.drawToGame(t)},setUVs:function(t,e,i,s,n,r,o,a){var h=this.quadVertexViewF32;h[2]=t,h[3]=e,h[9]=i,h[10]=s,h[16]=n,h[17]=r,h[23]=t,h[24]=e,h[30]=n,h[31]=r,h[37]=o,h[38]=a},setTargetUVs:function(t,e){var i=e.height/t.height;i=i>.5?.5-(i-.5):.5-i+.5,this.setUVs(0,i,0,1+i,1,1+i,1,i)},resetUVs:function(){this.setUVs(0,0,0,1,1,1,1,0)},destroy:function(){return this.renderer.deleteBuffer(this.quadVertexBuffer),this.drawSpriteShader=null,this.copyShader=null,this.gameShader=null,this.colorMatrixShader=null,this.quadVertexData=null,this.quadVertexBuffer=null,this.quadVertexViewF32=null,this.fsTarget=null,this.tempSprite=null,h.prototype.destroy.call(this),this}});t.exports=v},81041:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(57516),o=new s({Extends:r,initialize:function(t){t.topology=5,t.batchSize=n(t,"batchSize",256),r.call(this,t)}});t.exports=o},12385:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(57516),o=i(45561),a=i(60722),h=i(29100),l=new s({Extends:r,initialize:function(t){t.fragShader=n(t,"fragShader",o),t.vertShader=n(t,"vertShader",a),t.forceZero=!0,r.call(this,t)},boot:function(){h.prototype.boot.call(this);var t=this.renderer;this.set1i("uMainSampler",0),this.set2f("uResolution",t.width,t.height),this.set1i("uRoundPixels",t.config.roundPixels)}});t.exports=l},7589:(t,e,i)=>{var s=i(35407),n=i(10312),r=i(83419),o=i(89422),a=i(96293),h=i(36682),l=i(95540),u=i(48247),c=i(49627),d=i(29100),f=new r({Extends:d,initialize:function(t){t.renderTarget=l(t,"renderTarget",[{scale:1,autoResize:!0},{scale:1,autoResize:!0},{scale:.5,autoResize:!0},{scale:.5,autoResize:!0}]),t.vertShader=l(t,"vertShader",c),t.shaders=l(t,"shaders",[{name:"Copy",fragShader:h},{name:"AddBlend",fragShader:s},{name:"LinearBlend",fragShader:u},{name:"ColorMatrix",fragShader:a}]),t.attributes=l(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2}]),t.vertices=[-1,-1,0,0,-1,1,0,1,1,1,1,1,-1,-1,0,0,1,1,1,1,1,-1,1,0],t.batchSize=1,d.call(this,t),this.colorMatrix=new o,this.copyShader,this.addShader,this.linearShader,this.colorMatrixShader,this.fullFrame1,this.fullFrame2,this.halfFrame1,this.halfFrame2},boot:function(){d.prototype.boot.call(this);var t=this.shaders,e=this.renderTargets;this.copyShader=t[0],this.addShader=t[1],this.linearShader=t[2],this.colorMatrixShader=t[3],this.fullFrame1=e[0],this.fullFrame2=e[1],this.halfFrame1=e[2],this.halfFrame2=e[3]},copyFrame:function(t,e,i,s,n){void 0===i&&(i=1),void 0===s&&(s=!0),void 0===n&&(n=!0);var r=this.gl;this.setShader(this.copyShader),this.set1i("uMainSampler",0),this.set1f("uBrightness",i),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,t.texture.webGLTexture),e?(r.viewport(0,0,e.width,e.height),r.bindFramebuffer(r.FRAMEBUFFER,e.framebuffer.webGLFramebuffer),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e.texture.webGLTexture,0)):r.viewport(0,0,t.width,t.height),s&&(n?r.clearColor(0,0,0,0):r.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT)),r.bufferData(r.ARRAY_BUFFER,this.vertexData,r.STATIC_DRAW),r.drawArrays(r.TRIANGLES,0,6),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindTexture(r.TEXTURE_2D,null)},blitFrame:function(t,e,i,s,r,o,a){void 0===i&&(i=1),void 0===s&&(s=!0),void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=!1);var h=this.gl;if(this.setShader(this.copyShader),this.set1i("uMainSampler",0),this.set1f("uBrightness",i),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,t.texture.webGLTexture),t.height>e.height)h.viewport(0,0,t.width,t.height),this.setTargetUVs(t,e);else{var l=e.height-t.height;h.viewport(0,l,t.width,t.height)}if(h.bindFramebuffer(h.FRAMEBUFFER,e.framebuffer.webGLFramebuffer),h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,e.texture.webGLTexture,0),s&&(r?h.clearColor(0,0,0,0):h.clearColor(0,0,0,1),h.clear(h.COLOR_BUFFER_BIT)),o){var u=this.renderer.currentBlendMode;this.renderer.setBlendMode(n.ERASE)}a&&this.flipY(),h.bufferData(h.ARRAY_BUFFER,this.vertexData,h.STATIC_DRAW),h.drawArrays(h.TRIANGLES,0,6),o&&this.renderer.setBlendMode(u),h.bindFramebuffer(h.FRAMEBUFFER,null),h.bindTexture(h.TEXTURE_2D,null),this.resetUVs()},copyFrameRect:function(t,e,i,s,n,r,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0);var h=this.gl;h.bindFramebuffer(h.FRAMEBUFFER,t.framebuffer.webGLFramebuffer),h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,t.texture.webGLTexture,0),o&&(a?h.clearColor(0,0,0,0):h.clearColor(0,0,0,1),h.clear(h.COLOR_BUFFER_BIT)),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,e.texture.webGLTexture),h.copyTexSubImage2D(h.TEXTURE_2D,0,0,0,i,s,n,r),h.bindFramebuffer(h.FRAMEBUFFER,null),h.bindTexture(h.TEXTURE_2D,null)},copyToGame:function(t){var e=this.gl;this.setShader(this.copyShader),this.set1i("uMainSampler",0),this.set1f("uBrightness",1),this.renderer.popFramebuffer(),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t.texture.webGLTexture),e.bufferData(e.ARRAY_BUFFER,this.vertexData,e.STATIC_DRAW),e.drawArrays(e.TRIANGLES,0,6)},drawFrame:function(t,e,i,s){void 0===i&&(i=!0),void 0===s&&(s=this.colorMatrix);var n=this.gl;this.setShader(this.colorMatrixShader),this.set1i("uMainSampler",0),this.set1fv("uColorMatrix",s.getData()),this.set1f("uAlpha",s.alpha),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,t.texture.webGLTexture),e?(n.viewport(0,0,e.width,e.height),n.bindFramebuffer(n.FRAMEBUFFER,e.framebuffer.webGLFramebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e.texture.webGLTexture,0)):n.viewport(0,0,t.width,t.height),i?n.clearColor(0,0,0,0):n.clearColor(0,0,0,1),n.clear(n.COLOR_BUFFER_BIT),n.bufferData(n.ARRAY_BUFFER,this.vertexData,n.STATIC_DRAW),n.drawArrays(n.TRIANGLES,0,6),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindTexture(n.TEXTURE_2D,null)},blendFrames:function(t,e,i,s,n,r){void 0===s&&(s=1),void 0===n&&(n=!0),void 0===r&&(r=this.linearShader);var o=this.gl;this.setShader(r),this.set1i("uMainSampler1",0),this.set1i("uMainSampler2",1),this.set1f("uStrength",s),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,t.texture.webGLTexture),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,e.texture.webGLTexture),i?(o.bindFramebuffer(o.FRAMEBUFFER,i.framebuffer.webGLFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,i.texture.webGLTexture,0),o.viewport(0,0,i.width,i.height)):o.viewport(0,0,t.width,t.height),n?o.clearColor(0,0,0,0):o.clearColor(0,0,0,1),o.clear(o.COLOR_BUFFER_BIT),o.bufferData(o.ARRAY_BUFFER,this.vertexData,o.STATIC_DRAW),o.drawArrays(o.TRIANGLES,0,6),o.bindFramebuffer(o.FRAMEBUFFER,null),o.bindTexture(o.TEXTURE_2D,null)},blendFramesAdditive:function(t,e,i,s,n){this.blendFrames(t,e,i,s,n,this.addShader)},clearFrame:function(t,e){void 0===e&&(e=!0);var i=this.gl;i.viewport(0,0,t.width,t.height),i.bindFramebuffer(i.FRAMEBUFFER,t.framebuffer.webGLFramebuffer),e?i.clearColor(0,0,0,0):i.clearColor(0,0,0,1),i.clear(i.COLOR_BUFFER_BIT);var s=this.renderer.currentFramebuffer;i.bindFramebuffer(i.FRAMEBUFFER,s.webGLFramebuffer)},setUVs:function(t,e,i,s,n,r,o,a){var h=this.vertexViewF32;h[2]=t,h[3]=e,h[6]=i,h[7]=s,h[10]=n,h[11]=r,h[14]=t,h[15]=e,h[18]=n,h[19]=r,h[22]=o,h[23]=a},setTargetUVs:function(t,e){var i=e.height/t.height;i=i>.5?.5-(i-.5):.5-i+.5,this.setUVs(0,i,0,1+i,1,1+i,1,i)},flipX:function(){this.setUVs(1,0,1,1,0,1,0,0)},flipY:function(){this.setUVs(0,1,0,0,1,0,1,1)},resetUVs:function(){this.setUVs(0,0,0,1,1,1,1,0)}});t.exports=f},36060:t=>{t.exports={BITMAPMASK_PIPELINE:"BitmapMaskPipeline",LIGHT_PIPELINE:"Light2D",POINTLIGHT_PIPELINE:"PointLightPipeline",SINGLE_PIPELINE:"SinglePipeline",MULTI_PIPELINE:"MultiPipeline",ROPE_PIPELINE:"RopePipeline",GRAPHICS_PIPELINE:"GraphicsPipeline",POSTFX_PIPELINE:"PostFXPipeline",UTILITY_PIPELINE:"UtilityPipeline",MOBILE_PIPELINE:"MobilePipeline",FX_PIPELINE:"FxPipeline"}},84817:t=>{t.exports="pipelineafterflush"},36712:t=>{t.exports="pipelinebeforeflush"},40285:t=>{t.exports="pipelinebind"},65918:t=>{t.exports="pipelineboot"},92852:t=>{t.exports="pipelinedestroy"},56072:t=>{t.exports="pipelinerebind"},57566:t=>{t.exports="pipelineresize"},77085:(t,e,i)=>{t.exports={AFTER_FLUSH:i(84817),BEFORE_FLUSH:i(36712),BIND:i(40285),BOOT:i(65918),DESTROY:i(92852),REBIND:i(56072),RESIZE:i(57566)}},54812:(t,e,i)=>{var s=i(83419),n=i(99155),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.amount=1},onPreRender:function(t,e){t=this.getController(t),this.set1f("amount",t.amount,e)}});t.exports=o},67329:(t,e,i)=>{var s=i(83419),n=i(24400),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.steps=4,this.offsetX=1,this.offsetY=1,this.blurStrength=1,this.strength=1,this.glcolor=[1,1,1]},onPreRender:function(t){t=this.getController(t),this.set1f("strength",t.blurStrength),this.set3fv("color",t.glcolor)},onDraw:function(t){var e=this.getController(),i=this.fullFrame1,s=this.fullFrame2;this.copyFrame(t,s);for(var n=2/t.width*e.offsetX,r=2/t.height*e.offsetY,o=0;o{var s=i(83419),n=i(41514),r=i(51078),o=i(94328),a=i(84057),h=new s({Extends:a,initialize:function(t){a.call(this,{game:t,shaders:[{name:"Gaussian5",fragShader:n},{name:"Gaussian9",fragShader:r},{name:"Gaussian13",fragShader:o}]}),this.activeShader=this.shaders[0],this.x=2,this.y=2,this.steps=4,this.strength=1,this.glcolor=[1,1,1]},setQualityLow:function(){return this.activeShader=this.shaders[0],this},setQualityMedium:function(){return this.activeShader=this.shaders[1],this},setQualityHigh:function(){return this.activeShader=this.shaders[2],this},onDraw:function(t){var e=this.getController(),i=this.gl,s=this.fullFrame1,n=i.getParameter(i.FRAMEBUFFER_BINDING);this.bind(this.shaders[e.quality]),i.activeTexture(i.TEXTURE0),i.viewport(0,0,t.width,t.height),this.set1i("uMainSampler",0),this.set2f("resolution",t.width,t.height),this.set1f("strength",e.strength),this.set3fv("color",e.glcolor);for(var r=0;r{var s=i(83419),n=i(90610),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.isTiltShift=!1,this.strength=1,this.blurX=1,this.blurY=1,this.radius=.5,this.amount=1,this.contrast=.2},onPreRender:function(t,e,i,s){t=this.getController(t),this.set1f("radius",t.radius,e),this.set1f("amount",t.amount,e),this.set1f("contrast",t.contrast,e),this.set1f("strength",t.strength,e),this.set2f("blur",t.blurX,t.blurY,e),this.setBoolean("isTiltShift",t.isTiltShift,e),i&&s&&this.set2f("resolution",i,s,e)},onDraw:function(t){this.set2f("resolution",t.width,t.height),this.bindAndDraw(t)}});t.exports=o},89428:(t,e,i)=>{var s=i(83419),n=i(91899),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.scale=1,this.feather=.005,this.thickness=8,this.glcolor=[1,.2,.7],this.glcolor2=[1,0,0,.4]},onPreRender:function(t,e,i,s){t=this.getController(t),this.set1f("scale",t.scale,e),this.set1f("feather",t.feather,e),this.set1f("thickness",t.thickness,e),this.set3fv("color",t.glcolor,e),this.set4fv("backgroundColor",t.glcolor2,e),i&&s&&this.set2f("resolution",i,s,e)},onDraw:function(t){this.set2f("resolution",t.width,t.height),this.bindAndDraw(t)}});t.exports=o},88904:(t,e,i)=>{var s=i(83419),n=i(84057),r=new s({Extends:n,initialize:function(t){n.call(this,{game:t})},onDraw:function(t){var e=this.fullFrame1;this.controller?this.manager.drawFrame(t,e,!0,this.controller):this.drawFrame(t,e),this.copyToGame(e)}});t.exports=r},63563:(t,e,i)=>{var s=i(83419),n=i(47838),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.x=.005,this.y=.005,this.glTexture},onBoot:function(){this.setTexture("__WHITE")},setTexture:function(t){var e=this.game.textures.getFrame(t);e&&(this.glTexture=e.glTexture)},onDraw:function(t){var e=this.getController(),i=this.fullFrame1;this.bind(),this.set1i("uMainSampler",0),this.set1i("uDisplacementSampler",1),this.set2f("amount",e.x,e.y),this.bindTexture(e.glTexture,1),this.copySprite(t,i),this.copyToGame(i)}});t.exports=o},94045:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(98656),o=i(84057),a=i(70554),h=new s({Extends:o,initialize:function(t,e){var i=n(e,"quality",.1),s=n(e,"distance",10);o.call(this,{game:t,fragShader:a.setGlowQuality(r,t,i,s)}),this.outerStrength=4,this.innerStrength=0,this.knockout=!1,this.glcolor=[1,1,1,1]},onPreRender:function(t,e,i,s){t=this.getController(t),this.set1f("outerStrength",t.outerStrength,e),this.set1f("innerStrength",t.innerStrength,e),this.set4fv("glowColor",t.glcolor,e),this.setBoolean("knockout",t.knockout,e),i&&s&&this.set2f("resolution",i,s,e)},onDraw:function(t){this.set2f("resolution",t.width,t.height),this.bindAndDraw(t)}});t.exports=h},74088:(t,e,i)=>{var s=i(83419),n=i(70463),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.alpha=.2,this.size=0,this.fromX=0,this.fromY=0,this.toX=0,this.toY=1,this.glcolor1=[255,0,0],this.glcolor2=[0,255,0]},onPreRender:function(t,e){t=this.getController(t),this.set1f("alpha",t.alpha,e),this.set1i("size",t.size,e),this.set3fv("color1",t.glcolor1,e),this.set3fv("color2",t.glcolor2,e),this.set2f("positionFrom",t.fromX,t.fromY,e),this.set2f("positionTo",t.toX,t.toY,e)}});t.exports=o},99636:(t,e,i)=>{var s=i(83419),n=i(50831),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.amount=1},onPreRender:function(t,e,i,s){t=this.getController(t),this.set1f("amount",t.amount,e),i&&s&&this.set2f("resolution",i,s,e)},onDraw:function(t){this.set2f("resolution",t.width,t.height),this.bindAndDraw(t)}});t.exports=o},34700:(t,e,i)=>{var s=i(83419),n=i(92595),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.x=0,this.y=0,this.decay=.1,this.power=1,this.glcolor=[0,0,0,1],this.samples=6,this.intensity=1},onPreRender:function(t,e){var i=(t=this.getController(t)).samples;this.set1i("samples",i,e),this.set1f("intensity",t.intensity,e),this.set1f("decay",t.decay,e),this.set1f("power",t.power/i,e),this.set2f("lightPosition",t.x,t.y,e),this.set4fv("color",t.glcolor,e)}});t.exports=o},91157:(t,e,i)=>{var s=i(83419),n=i(72464),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.speed=.5,this.lineWidth=.5,this.gradient=3,this.reveal=!1},onPreRender:function(t,e,i,s){t=this.getController(t),this.setTime("time",e),this.set1f("speed",t.speed,e),this.set1f("lineWidth",t.lineWidth,e),this.set1f("gradient",t.gradient,e),this.setBoolean("reveal",t.reveal,e),i&&s&&this.set2f("resolution",i,s,e)},onDraw:function(t){this.set2f("resolution",t.width,t.height),this.bindAndDraw(t)}});t.exports=o},27797:(t,e,i)=>{var s=i(83419),n=i(39249),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.x=.5,this.y=.5,this.radius=.5,this.strength=.5},onPreRender:function(t,e){t=this.getController(t),this.set1f("radius",t.radius,e),this.set1f("strength",t.strength,e),this.set2f("position",t.x,t.y,e)}});t.exports=o},67603:(t,e,i)=>{var s=i(83419),n=i(2878),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.progress=0,this.wipeWidth=.1,this.direction=0,this.axis=0,this.reveal=!1},onPreRender:function(t,e){var i=(t=this.getController(t)).progress,s=t.wipeWidth,n=t.direction,r=t.axis;this.set4f("config",i,s,n,r,e),this.setBoolean("reveal",t.reveal,e)}});t.exports=o},58918:(t,e,i)=>{var s={Barrel:i(54812),Bloom:i(67329),Blur:i(8861),Bokeh:i(51051),Circle:i(89428),ColorMatrix:i(88904),Displacement:i(63563),Glow:i(94045),Gradient:i(74088),Pixelate:i(99636),Shadow:i(34700),Shine:i(91157),Vignette:i(27797),Wipe:i(67603)};t.exports=s},96615:(t,e,i)=>{var s=i(36060),n=i(79291),r={FX:i(58918),BitmapMaskPipeline:i(31302),Events:i(77085),FXPipeline:i(92651),LightPipeline:i(96569),MobilePipeline:i(56527),MultiPipeline:i(57516),PointLightPipeline:i(43439),PostFXPipeline:i(84057),PreFXPipeline:i(43558),RopePipeline:i(81041),SinglePipeline:i(12385),UtilityPipeline:i(7589)};r=n(!1,r,s),t.exports=r},35407:t=>{t.exports=["#define SHADER_NAME PHASER_ADD_BLEND_FS","precision mediump float;","uniform sampler2D uMainSampler1;","uniform sampler2D uMainSampler2;","uniform float uStrength;","varying vec2 outTexCoord;","void main ()","{"," vec4 frame1 = texture2D(uMainSampler1, outTexCoord);"," vec4 frame2 = texture2D(uMainSampler2, outTexCoord);"," gl_FragColor = frame1 + frame2 * uStrength;","}"].join("\n")},78908:t=>{t.exports=["#define SHADER_NAME PHASER_BITMAP_MASK_FS","precision mediump float;","uniform vec2 uResolution;","uniform sampler2D uMainSampler;","uniform sampler2D uMaskSampler;","uniform bool uInvertMaskAlpha;","void main ()","{"," vec2 uv = gl_FragCoord.xy / uResolution;"," vec4 mainColor = texture2D(uMainSampler, uv);"," vec4 maskColor = texture2D(uMaskSampler, uv);"," if (!uInvertMaskAlpha)"," {"," mainColor *= maskColor.a;"," }"," else"," {"," mainColor *= (1.0 - maskColor.a);"," }"," gl_FragColor = mainColor;","}"].join("\n")},85191:t=>{t.exports=["#define SHADER_NAME PHASER_BITMAP_MASK_VS","precision mediump float;","attribute vec2 inPosition;","void main ()","{"," gl_Position = vec4(inPosition, 0.0, 1.0);","}"].join("\n")},96293:t=>{t.exports=["#define SHADER_NAME PHASER_COLORMATRIX_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform float uColorMatrix[20];","uniform float uAlpha;","varying vec2 outTexCoord;","void main ()","{"," vec4 c = texture2D(uMainSampler, outTexCoord);"," if (uAlpha == 0.0)"," {"," gl_FragColor = c;"," return;"," }"," if (c.a > 0.0)"," {"," c.rgb /= c.a;"," }"," vec4 result;"," result.r = (uColorMatrix[0] * c.r) + (uColorMatrix[1] * c.g) + (uColorMatrix[2] * c.b) + (uColorMatrix[3] * c.a) + uColorMatrix[4];"," result.g = (uColorMatrix[5] * c.r) + (uColorMatrix[6] * c.g) + (uColorMatrix[7] * c.b) + (uColorMatrix[8] * c.a) + uColorMatrix[9];"," result.b = (uColorMatrix[10] * c.r) + (uColorMatrix[11] * c.g) + (uColorMatrix[12] * c.b) + (uColorMatrix[13] * c.a) + uColorMatrix[14];"," result.a = (uColorMatrix[15] * c.r) + (uColorMatrix[16] * c.g) + (uColorMatrix[17] * c.b) + (uColorMatrix[18] * c.a) + uColorMatrix[19];"," vec3 rgb = mix(c.rgb, result.rgb, uAlpha);"," rgb *= result.a;"," gl_FragColor = vec4(rgb, result.a);","}"].join("\n")},36682:t=>{t.exports=["#define SHADER_NAME PHASER_COPY_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform float uBrightness;","varying vec2 outTexCoord;","void main ()","{"," gl_FragColor = texture2D(uMainSampler, outTexCoord) * uBrightness;","}"].join("\n")},99155:t=>{t.exports=["#define SHADER_NAME BARREL_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform float amount;","varying vec2 outTexCoord;","vec2 Distort(vec2 p)","{"," float theta = atan(p.y, p.x);"," float radius = length(p);"," radius = pow(radius, amount);"," p.x = radius * cos(theta);"," p.y = radius * sin(theta);"," return 0.5 * (p + 1.0);","}","void main()","{"," vec2 xy = 2.0 * outTexCoord - 1.0;"," vec2 texCoord = outTexCoord;"," if (length(xy) < 1.0)"," {"," texCoord = Distort(xy);"," }"," gl_FragColor = texture2D(uMainSampler, texCoord);","}"].join("\n")},24400:t=>{t.exports=["#define SHADER_NAME BLOOM_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 offset;","uniform float strength;","uniform vec3 color;","varying vec2 outTexCoord;","void main ()","{"," vec4 sum = texture2D(uMainSampler, outTexCoord) * 0.204164 * strength;"," sum = sum + texture2D(uMainSampler, outTexCoord + offset * 1.407333) * 0.304005;"," sum = sum + texture2D(uMainSampler, outTexCoord - offset * 1.407333) * 0.304005;"," sum = sum + texture2D(uMainSampler, outTexCoord + offset * 3.294215) * 0.093913;"," gl_FragColor = (sum + texture2D(uMainSampler, outTexCoord - offset * 3.294215) * 0.093913) * vec4(color, 1);","}"].join("\n")},94328:t=>{t.exports=["#define SHADER_NAME BLUR_HIGH_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform vec2 offset;","uniform float strength;","uniform vec3 color;","varying vec2 outTexCoord;","void main ()","{"," vec2 uv = outTexCoord;"," vec4 col = vec4(0.0);"," vec2 off1 = vec2(1.411764705882353) * offset * strength;"," vec2 off2 = vec2(3.2941176470588234) * offset * strength;"," vec2 off3 = vec2(5.176470588235294) * offset * strength;"," col += texture2D(uMainSampler, uv) * 0.1964825501511404;"," col += texture2D(uMainSampler, uv + (off1 / resolution)) * 0.2969069646728344;"," col += texture2D(uMainSampler, uv - (off1 / resolution)) * 0.2969069646728344;"," col += texture2D(uMainSampler, uv + (off2 / resolution)) * 0.09447039785044732;"," col += texture2D(uMainSampler, uv - (off2 / resolution)) * 0.09447039785044732;"," col += texture2D(uMainSampler, uv + (off3 / resolution)) * 0.010381362401148057;"," col += texture2D(uMainSampler, uv - (off3 / resolution)) * 0.010381362401148057;"," gl_FragColor = col * vec4(color, 1.0);","}"].join("\n")},41514:t=>{t.exports=["#define SHADER_NAME BLUR_LOW_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform vec2 offset;","uniform float strength;","uniform vec3 color;","varying vec2 outTexCoord;","void main ()","{"," vec2 uv = outTexCoord;"," vec4 col = vec4(0.0);"," vec2 offset = vec2(1.333) * offset * strength;"," col += texture2D(uMainSampler, uv) * 0.29411764705882354;"," col += texture2D(uMainSampler, uv + (offset / resolution)) * 0.35294117647058826;"," col += texture2D(uMainSampler, uv - (offset / resolution)) * 0.35294117647058826;"," gl_FragColor = col * vec4(color, 1.0);","}"].join("\n")},51078:t=>{t.exports=["#define SHADER_NAME BLUR_MED_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform vec2 offset;","uniform float strength;","uniform vec3 color;","varying vec2 outTexCoord;","void main ()","{"," vec2 uv = outTexCoord;"," vec4 col = vec4(0.0);"," vec2 off1 = vec2(1.3846153846) * offset * strength;"," vec2 off2 = vec2(3.2307692308) * offset * strength;"," col += texture2D(uMainSampler, uv) * 0.2270270270;"," col += texture2D(uMainSampler, uv + (off1 / resolution)) * 0.3162162162;"," col += texture2D(uMainSampler, uv - (off1 / resolution)) * 0.3162162162;"," col += texture2D(uMainSampler, uv + (off2 / resolution)) * 0.0702702703;"," col += texture2D(uMainSampler, uv - (off2 / resolution)) * 0.0702702703;"," gl_FragColor = col * vec4(color, 1.0);","}"].join("\n")},90610:t=>{t.exports=["#define SHADER_NAME BOKEH_FS","precision mediump float;","#define ITERATIONS 100.0","#define ONEOVER_ITR 1.0 / ITERATIONS","#define PI 3.141596","#define GOLDEN_ANGLE 2.39996323","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform float radius;","uniform float amount;","uniform float contrast;","uniform bool isTiltShift;","uniform float strength;","uniform vec2 blur;","varying vec2 outTexCoord;","vec2 Sample (in float theta, inout float r)","{"," r += 1.0 / r;"," return (r - 1.0) * vec2(cos(theta), sin(theta)) * 0.06;","}","vec3 Bokeh (sampler2D tex, vec2 uv, float radius)","{"," vec3 acc = vec3(0.0);"," vec3 div = vec3(0.0);"," vec2 pixel = vec2(resolution.y / resolution.x, 1.0) * radius * .025;"," float r = 1.0;"," for (float j = 0.0; j < GOLDEN_ANGLE * ITERATIONS; j += GOLDEN_ANGLE)"," {"," vec3 col = texture2D(tex, uv + pixel * Sample(j, r)).xyz;"," col = contrast > 0.0 ? col * col * (1.0 + contrast) : col;"," vec3 bokeh = vec3(0.5) + pow(col, vec3(10.0)) * amount;"," acc += col * bokeh;"," div += bokeh;"," }"," return acc / div;","}","void main ()","{"," float shift = 1.0;"," if (isTiltShift)"," {"," vec2 uv = vec2(gl_FragCoord.xy / resolution + vec2(-0.5, -0.5)) * 2.0;"," float centerStrength = 1.0;"," shift = length(uv * blur * strength) * centerStrength;"," }"," gl_FragColor = vec4(Bokeh(uMainSampler, outTexCoord * vec2(1.0, 1.0), radius * shift), 0.0);","}"].join("\n")},91899:t=>{t.exports=["#define SHADER_NAME CIRCLE_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform vec3 color;","uniform vec4 backgroundColor;","uniform float thickness;","uniform float scale;","uniform float feather;","varying vec2 outTexCoord;","void main ()","{"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec2 position = (gl_FragCoord.xy / resolution.xy) * 2.0 - 1.0;"," float aspectRatio = resolution.x / resolution.y;"," position.x *= aspectRatio;"," float grad = length(position);"," float outer = aspectRatio;"," float inner = outer - (thickness * 2.0 / resolution.y);"," if (aspectRatio >= 1.0)"," {"," float f = 2.0 + (resolution.y / resolution.x);"," outer = 1.0;"," inner = 1.0 - (thickness * f / resolution.x);"," }"," outer *= scale;"," inner *= scale;"," float circle = smoothstep(outer, outer - 0.01, grad);"," float ring = circle - smoothstep(inner, inner - feather, grad);"," texture = mix(backgroundColor * backgroundColor.a, texture, texture.a);"," texture = (texture * (circle - ring));"," gl_FragColor = vec4(texture.rgb + (ring * color), texture.a);","}"].join("\n")},47838:t=>{t.exports=["#define SHADER_NAME DISPLACEMENT_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform sampler2D uDisplacementSampler;","uniform vec2 amount;","varying vec2 outTexCoord;","void main ()","{"," vec2 disp = (-vec2(0.5, 0.5) + texture2D(uDisplacementSampler, outTexCoord).rr) * amount;"," gl_FragColor = texture2D(uMainSampler, outTexCoord + disp).rgba;","}"].join("\n")},98656:t=>{t.exports=["#define SHADER_NAME GLOW_FS","precision mediump float;","uniform sampler2D uMainSampler;","varying vec2 outTexCoord;","uniform float outerStrength;","uniform float innerStrength;","uniform vec2 resolution;","uniform vec4 glowColor;","uniform bool knockout;","const float PI = 3.14159265358979323846264;","const float DIST = __DIST__;","const float SIZE = min(__SIZE__, PI * 2.0);","const float STEP = ceil(PI * 2.0 / SIZE);","const float MAX_ALPHA = STEP * DIST * (DIST + 1.0) / 2.0;","void main ()","{"," vec2 px = vec2(1.0 / resolution.x, 1.0 / resolution.y);"," float totalAlpha = 0.0;"," vec2 direction;"," vec2 displaced;"," vec4 color;"," for (float angle = 0.0; angle < PI * 2.0; angle += SIZE)"," {"," direction = vec2(cos(angle), sin(angle)) * px;"," for (float curDistance = 0.0; curDistance < DIST; curDistance++)"," {"," displaced = outTexCoord + direction * (curDistance + 1.0);"," color = texture2D(uMainSampler, displaced);"," totalAlpha += (DIST - curDistance) * color.a;"," }"," }"," color = texture2D(uMainSampler, outTexCoord);"," float alphaRatio = (totalAlpha / MAX_ALPHA);"," float innerGlowAlpha = (1.0 - alphaRatio) * innerStrength * color.a;"," float innerGlowStrength = min(1.0, innerGlowAlpha);"," vec4 innerColor = mix(color, glowColor, innerGlowStrength);"," float outerGlowAlpha = alphaRatio * outerStrength * (1.0 - color.a);"," float outerGlowStrength = min(1.0 - innerColor.a, outerGlowAlpha);"," vec4 outerGlowColor = outerGlowStrength * glowColor.rgba;"," if (knockout)"," {"," float resultAlpha = outerGlowAlpha + innerGlowAlpha;"," gl_FragColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);"," }"," else"," {"," gl_FragColor = innerColor + outerGlowColor;"," }","}"].join("\n")},70463:t=>{t.exports=["#define SHADER_NAME GRADIENT_FS","#define SRGB_TO_LINEAR(c) pow((c), vec3(2.2))","#define LINEAR_TO_SRGB(c) pow((c), vec3(1.0 / 2.2))","#define SRGB(r, g, b) SRGB_TO_LINEAR(vec3(float(r), float(g), float(b)) / 255.0)","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 positionFrom;","uniform vec2 positionTo;","uniform vec3 color1;","uniform vec3 color2;","uniform float alpha;","uniform int size;","varying vec2 outTexCoord;","float gradientNoise(in vec2 uv)","{"," const vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);"," return fract(magic.z * fract(dot(uv, magic.xy)));","}","float stepped (in float s, in float scale, in int steps)","{"," return steps > 0 ? floor( s / ((1.0 * scale) / float(steps))) * 1.0 / float(steps - 1) : s;","}","void main ()","{"," vec2 a = positionFrom;"," vec2 b = positionTo;"," vec2 ba = b - a;"," float d = dot(outTexCoord - a, ba) / dot(ba, ba);"," float t = size > 0 ? stepped(d, 1.0, size) : d;"," t = smoothstep(0.0, 1.0, clamp(t, 0.0, 1.0));"," vec3 color = mix(SRGB(color1.r, color1.g, color1.b), SRGB(color2.r, color2.g, color2.b), t);"," color = LINEAR_TO_SRGB(color);"," color += (1.0 / 255.0) * gradientNoise(outTexCoord) - (0.5 / 255.0);"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," gl_FragColor = vec4(mix(color.rgb, texture.rgb, alpha), 1.0) * texture.a;","}"].join("\n")},50831:t=>{t.exports=["#define SHADER_NAME PIXELATE_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform float amount;","varying vec2 outTexCoord;","void main ()","{"," float pixelSize = floor(2.0 + amount);"," vec2 center = pixelSize * floor(outTexCoord * resolution / pixelSize) + pixelSize * vec2(0.5, 0.5);"," vec2 corner1 = center + pixelSize * vec2(-0.5, -0.5);"," vec2 corner2 = center + pixelSize * vec2(+0.5, -0.5);"," vec2 corner3 = center + pixelSize * vec2(+0.5, +0.5);"," vec2 corner4 = center + pixelSize * vec2(-0.5, +0.5);"," vec4 pixel = 0.4 * texture2D(uMainSampler, center / resolution);"," pixel += 0.15 * texture2D(uMainSampler, corner1 / resolution);"," pixel += 0.15 * texture2D(uMainSampler, corner2 / resolution);"," pixel += 0.15 * texture2D(uMainSampler, corner3 / resolution);"," pixel += 0.15 * texture2D(uMainSampler, corner4 / resolution);"," gl_FragColor = pixel;","}"].join("\n")},92595:t=>{t.exports=["#define SHADER_NAME SHADOW_FS","precision mediump float;","uniform sampler2D uMainSampler;","varying vec2 outTexCoord;","uniform vec2 lightPosition;","uniform vec4 color;","uniform float decay;","uniform float power;","uniform float intensity;","uniform int samples;","const int MAX = 12;","void main ()","{"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec2 pc = (lightPosition - outTexCoord) * intensity;"," float shadow = 0.0;"," float limit = max(float(MAX), float(samples));"," for (int i = 0; i < MAX; ++i)"," {"," if (i >= samples)"," {"," break;"," }"," shadow += texture2D(uMainSampler, outTexCoord + float(i) * decay / limit * pc).a * power;"," }"," float mask = 1.0 - texture.a;"," gl_FragColor = mix(texture, color, shadow * mask);","}"].join("\n")},72464:t=>{t.exports=["#define SHADER_NAME SHINE_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform bool reveal;","uniform float speed;","uniform float time;","uniform float lineWidth;","uniform float gradient;","varying vec2 outTexCoord;","void main ()","{","\tvec2 uv = gl_FragCoord.xy / resolution.xy;"," vec4 tex = texture2D(uMainSampler, outTexCoord);"," vec4 col1 = vec4(0.3, 0.0, 0.0, 1.0);"," vec4 col2 = vec4(0.85, 0.85, 0.85, 1.0);"," uv.x = uv.x - mod(time * speed, 2.0) + 0.5;"," float y = uv.x * gradient;"," float s = smoothstep(y - lineWidth, y, uv.y) - smoothstep(y, y + lineWidth, uv.y);"," gl_FragColor = (((s * col1) + (s * col2)) * tex);"," if (!reveal)"," {"," gl_FragColor += tex;"," }","}"].join("\n")},39249:t=>{t.exports=["#define SHADER_NAME VIGNETTE_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform float radius;","uniform float strength;","uniform vec2 position;","varying vec2 outTexCoord;","void main ()","{"," vec4 col = vec4(1.0);"," float d = length(outTexCoord - position);"," if (d <= radius)"," {"," float g = d / radius;"," g = sin(g * 3.14 * strength);"," \tcol = vec4(g * g * g);"," }"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," gl_FragColor = texture * (1.0 - col);","}"].join("\n")},2878:t=>{t.exports=["#define SHADER_NAME WIPE_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec4 config;","uniform bool reveal;","varying vec2 outTexCoord;","void main ()","{"," vec2 uv = outTexCoord;"," vec4 color0;"," vec4 color1;"," if (reveal)"," {"," color0 = vec4(0);"," color1 = texture2D(uMainSampler, uv);"," }"," else"," {"," color0 = texture2D(uMainSampler, uv);"," color1 = vec4(0);"," }"," float distance = config.x;"," float width = config.y;"," float direction = config.z;"," float axis = uv.x;"," if (config.w == 1.0)"," {"," axis = uv.y;"," }"," float adjust = mix(width, -width, distance);"," float value = smoothstep(distance - width, distance + width, abs(direction - axis) + adjust);"," gl_FragColor = mix(color1, color0, value);","}"].join("\n")},31063:t=>{t.exports=["#define SHADER_NAME PHASER_LIGHT_FS","precision mediump float;","struct Light","{"," vec2 position;"," vec3 color;"," float intensity;"," float radius;","};","const int kMaxLights = %LIGHT_COUNT%;","uniform vec4 uCamera; /* x, y, rotation, zoom */","uniform vec2 uResolution;","uniform sampler2D uMainSampler;","uniform sampler2D uNormSampler;","uniform vec3 uAmbientLightColor;","uniform Light uLights[kMaxLights];","uniform mat3 uInverseRotationMatrix;","uniform int uLightCount;","varying vec2 outTexCoord;","varying float outTexId;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," vec3 finalColor = vec3(0.0, 0.0, 0.0);"," vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec4 color = texture * texel;"," if (outTintEffect == 1.0)"," {"," color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);"," }"," else if (outTintEffect == 2.0)"," {"," color = texel;"," }"," vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;"," vec3 normal = normalize(uInverseRotationMatrix * vec3(normalMap * 2.0 - 1.0));"," vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;"," for (int index = 0; index < kMaxLights; ++index)"," {"," if (index < uLightCount)"," {"," Light light = uLights[index];"," vec3 lightDir = vec3((light.position.xy / res) - (gl_FragCoord.xy / res), 0.1);"," vec3 lightNormal = normalize(lightDir);"," float distToSurf = length(lightDir) * uCamera.w;"," float diffuseFactor = max(dot(normal, lightNormal), 0.0);"," float radius = (light.radius / res.x * uCamera.w) * uCamera.w;"," float attenuation = clamp(1.0 - distToSurf * distToSurf / (radius * radius), 0.0, 1.0);"," vec3 diffuse = light.color * diffuseFactor;"," finalColor += (attenuation * diffuse) * light.intensity;"," }"," }"," vec4 colorOutput = vec4(uAmbientLightColor + finalColor, 1.0);"," gl_FragColor = color * vec4(colorOutput.rgb * colorOutput.a, colorOutput.a);","}"].join("\n")},48247:t=>{t.exports=["#define SHADER_NAME PHASER_LINEAR_BLEND_FS","precision mediump float;","uniform sampler2D uMainSampler1;","uniform sampler2D uMainSampler2;","uniform float uStrength;","varying vec2 outTexCoord;","void main ()","{"," vec4 frame1 = texture2D(uMainSampler1, outTexCoord);"," vec4 frame2 = texture2D(uMainSampler2, outTexCoord);"," gl_FragColor = mix(frame1, frame2 * uStrength, 0.5);","}"].join("\n")},41214:t=>{t.exports=["#define SHADER_NAME PHASER_MESH_FS","precision mediump float;","uniform vec3 uLightPosition;","uniform vec3 uLightAmbient;","uniform vec3 uLightDiffuse;","uniform vec3 uLightSpecular;","uniform vec3 uFogColor;","uniform float uFogNear;","uniform float uFogFar;","uniform vec3 uMaterialAmbient;","uniform vec3 uMaterialDiffuse;","uniform vec3 uMaterialSpecular;","uniform float uMaterialShine;","uniform vec3 uCameraPosition;","uniform sampler2D uTexture;","varying vec2 vTextureCoord;","varying vec3 vNormal;","varying vec3 vPosition;","void main (void)","{"," vec4 color = texture2D(uTexture, vTextureCoord);"," vec3 ambient = uLightAmbient * uMaterialAmbient;"," vec3 norm = normalize(vNormal);"," vec3 lightDir = normalize(uLightPosition - vPosition);"," float diff = max(dot(norm, lightDir), 0.0);"," vec3 diffuse = uLightDiffuse * (diff * uMaterialDiffuse);"," vec3 viewDir = normalize(uCameraPosition - vPosition);"," vec3 reflectDir = reflect(-lightDir, norm);"," float spec = pow(max(dot(viewDir, reflectDir), 0.0), uMaterialShine);"," vec3 specular = uLightSpecular * (spec * uMaterialSpecular);"," vec3 result = (ambient + diffuse + specular) * color.rgb;"," float depth = gl_FragCoord.z / gl_FragCoord.w;"," float fogFactor = smoothstep(uFogNear, uFogFar, depth);"," gl_FragColor.rgb = mix(result.rgb, uFogColor, fogFactor);"," gl_FragColor.a = color.a;","}"].join("\n")},39653:t=>{t.exports=["#define SHADER_NAME PHASER_MESH_VS","precision mediump float;","attribute vec3 aVertexPosition;","attribute vec3 aVertexNormal;","attribute vec2 aTextureCoord;","uniform mat4 uViewProjectionMatrix;","uniform mat4 uModelMatrix;","uniform mat4 uNormalMatrix;","varying vec2 vTextureCoord;","varying vec3 vNormal;","varying vec3 vPosition;","void main ()","{"," vTextureCoord = aTextureCoord;"," vPosition = vec3(uModelMatrix * vec4(aVertexPosition, 1.0));"," vNormal = vec3(uNormalMatrix * vec4(aVertexNormal, 1.0));"," gl_Position = uViewProjectionMatrix * uModelMatrix * vec4(aVertexPosition, 1.0);","}"].join("\n")},62143:t=>{t.exports=["#define SHADER_NAME PHASER_MOBILE_FS","#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","uniform sampler2D uMainSampler;","varying vec2 outTexCoord;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec4 color = texture * texel;"," if (outTintEffect == 1.0)"," {"," color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);"," }"," else if (outTintEffect == 2.0)"," {"," color = texel;"," }"," gl_FragColor = color;","}"].join("\n")},47940:t=>{t.exports=["#define SHADER_NAME PHASER_MOBILE_VS","precision mediump float;","uniform mat4 uProjectionMatrix;","uniform int uRoundPixels;","uniform vec2 uResolution;","attribute vec2 inPosition;","attribute vec2 inTexCoord;","attribute float inTexId;","attribute float inTintEffect;","attribute vec4 inTint;","varying vec2 outTexCoord;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);"," if (uRoundPixels == 1)"," {"," gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;"," }"," outTexCoord = inTexCoord;"," outTint = inTint;"," outTintEffect = inTintEffect;","}"].join("\n")},98840:t=>{t.exports=["#define SHADER_NAME PHASER_MULTI_FS","#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","uniform sampler2D uMainSampler[%count%];","varying vec2 outTexCoord;","varying float outTexId;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," vec4 texture;"," %forloop%"," vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);"," vec4 color = texture * texel;"," if (outTintEffect == 1.0)"," {"," color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);"," }"," else if (outTintEffect == 2.0)"," {"," color = texel;"," }"," gl_FragColor = color;","}"].join("\n")},44667:t=>{t.exports=["#define SHADER_NAME PHASER_MULTI_VS","precision mediump float;","uniform mat4 uProjectionMatrix;","uniform int uRoundPixels;","uniform vec2 uResolution;","attribute vec2 inPosition;","attribute vec2 inTexCoord;","attribute float inTexId;","attribute float inTintEffect;","attribute vec4 inTint;","varying vec2 outTexCoord;","varying float outTexId;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);"," if (uRoundPixels == 1)"," {"," gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;"," }"," outTexCoord = inTexCoord;"," outTexId = inTexId;"," outTint = inTint;"," outTintEffect = inTintEffect;","}"].join("\n")},4127:t=>{t.exports=["#define SHADER_NAME PHASER_POINTLIGHT_FS","precision mediump float;","uniform vec2 uResolution;","uniform float uCameraZoom;","varying vec4 lightPosition;","varying vec4 lightColor;","varying float lightRadius;","varying float lightAttenuation;","void main ()","{"," vec2 center = (lightPosition.xy + 1.0) * (uResolution.xy * 0.5);"," float distToSurf = length(center - gl_FragCoord.xy);"," float radius = 1.0 - distToSurf / (lightRadius * uCameraZoom);"," float intensity = smoothstep(0.0, 1.0, radius * lightAttenuation);"," vec4 color = vec4(intensity, intensity, intensity, 0.0) * lightColor;"," gl_FragColor = vec4(color.rgb * lightColor.a, color.a);","}"].join("\n")},89924:t=>{t.exports=["#define SHADER_NAME PHASER_POINTLIGHT_VS","precision mediump float;","uniform mat4 uProjectionMatrix;","attribute vec2 inPosition;","attribute vec2 inLightPosition;","attribute vec4 inLightColor;","attribute float inLightRadius;","attribute float inLightAttenuation;","varying vec4 lightPosition;","varying vec4 lightColor;","varying float lightRadius;","varying float lightAttenuation;","void main ()","{"," lightColor = inLightColor;"," lightRadius = inLightRadius;"," lightAttenuation = inLightAttenuation;"," lightPosition = uProjectionMatrix * vec4(inLightPosition, 1.0, 1.0);"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);","}"].join("\n")},27681:t=>{t.exports=["#define SHADER_NAME PHASER_POSTFX_FS","precision mediump float;","uniform sampler2D uMainSampler;","varying vec2 outTexCoord;","void main ()","{"," gl_FragColor = texture2D(uMainSampler, outTexCoord);","}"].join("\n")},49627:t=>{t.exports=["#define SHADER_NAME PHASER_QUAD_VS","precision mediump float;","attribute vec2 inPosition;","attribute vec2 inTexCoord;","varying vec2 outFragCoord;","varying vec2 outTexCoord;","void main ()","{"," outFragCoord = inPosition.xy * 0.5 + 0.5;"," outTexCoord = inTexCoord;"," gl_Position = vec4(inPosition, 0, 1);","}"].join("\n")},45561:t=>{t.exports=["#define SHADER_NAME PHASER_SINGLE_FS","#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","uniform sampler2D uMainSampler;","varying vec2 outTexCoord;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);"," vec4 color = texture * texel;"," if (outTintEffect == 1.0)"," {"," color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);"," }"," else if (outTintEffect == 2.0)"," {"," color = texel;"," }"," gl_FragColor = color;","}"].join("\n")},60722:t=>{t.exports=["#define SHADER_NAME PHASER_SINGLE_VS","precision mediump float;","uniform mat4 uProjectionMatrix;","uniform int uRoundPixels;","uniform vec2 uResolution;","attribute vec2 inPosition;","attribute vec2 inTexCoord;","attribute float inTexId;","attribute float inTintEffect;","attribute vec4 inTint;","varying vec2 outTexCoord;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);"," if (uRoundPixels == 1)"," {"," gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;"," }"," outTexCoord = inTexCoord;"," outTint = inTint;"," outTintEffect = inTintEffect;","}"].join("\n")},89350:(t,e,i)=>{t.exports={AddBlendFrag:i(35407),BitmapMaskFrag:i(78908),BitmapMaskVert:i(85191),ColorMatrixFrag:i(96293),CopyFrag:i(36682),FXBarrelFrag:i(99155),FXBloomFrag:i(24400),FXBlurHighFrag:i(94328),FXBlurLowFrag:i(41514),FXBlurMedFrag:i(51078),FXBokehFrag:i(90610),FXCircleFrag:i(91899),FXDisplacementFrag:i(47838),FXGlowFrag:i(98656),FXGradientFrag:i(70463),FXPixelateFrag:i(50831),FXShadowFrag:i(92595),FXShineFrag:i(72464),FXVignetteFrag:i(39249),FXWipeFrag:i(2878),LightFrag:i(31063),LinearBlendFrag:i(48247),MeshFrag:i(41214),MeshVert:i(39653),MobileFrag:i(62143),MobileVert:i(47940),MultiFrag:i(98840),MultiVert:i(44667),PointLightFrag:i(4127),PointLightVert:i(89924),PostFXFrag:i(27681),QuadVert:i(49627),SingleFrag:i(45561),SingleVert:i(60722)}},93567:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i){this.webGLAttribLocation=-1,this.gl=t,this.program=e,this.name=i,this.createResource()},createResource:function(){if(null!==this.program.webGLProgram){var t=this.gl;t.isContextLost()||(this.webGLAttribLocation=t.getAttribLocation(this.program.webGLProgram,this.name))}else this.webGLAttribLocation=-1},destroy:function(){this.gl=null,this.program=null,this.name=null,this.webGLAttribLocation=-1}});t.exports=s},26128:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s){this.webGLBuffer=null,this.gl=t,this.initialDataOrSize=e,this.bufferType=i,this.bufferUsage=s,this.createResource()},createResource:function(){if(null!==this.initialDataOrSize){var t=this.gl;if(!t.isContextLost()){var e=this.bufferType,i=t.createBuffer();this.webGLBuffer=i,t.bindBuffer(e,this.webGLBuffer),t.bufferData(e,this.initialDataOrSize,this.bufferUsage),t.bindBuffer(e,null)}}},destroy:function(){var t=this.gl;t.isContextLost()||t.deleteBuffer(this.webGLBuffer),this.webGLBuffer=null,this.initialDataOrSize=null,this.gl=null}});t.exports=s},84387:(t,e,i)=>{var s=i(83419),n={36054:"Incomplete Attachment",36055:"Missing Attachment",36057:"Incomplete Dimensions",36061:"Framebuffer Unsupported"},r=new s({initialize:function(t,e,i,s,n){this.webGLFramebuffer=null,this.gl=t,this.width=e,this.height=i,this.renderTexture=s,this.addDepthStencilBuffer=!!n,this.createResource()},createResource:function(){var t=this.gl;if(!t.isContextLost()){var e,i=this.renderTexture,s=t.createFramebuffer();if(this.webGLFramebuffer=s,t.bindFramebuffer(t.FRAMEBUFFER,s),i.isRenderTexture=!0,i.isAlphaPremultiplied=!1,t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i.webGLTexture,0),(e=t.checkFramebufferStatus(t.FRAMEBUFFER))!==t.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer status: "+(n[e]||e));if(this.addDepthStencilBuffer){var r=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,this.width,this.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r)}t.bindFramebuffer(t.FRAMEBUFFER,null)}},destroy:function(){if(null!==this.webGLFramebuffer){var t=this.gl;if(!t.isContextLost()){t.bindFramebuffer(t.FRAMEBUFFER,this.webGLFramebuffer);var e=t.getFramebufferAttachmentParameter(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);null!==e&&(t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,null,0),t.deleteTexture(e));var i=t.getFramebufferAttachmentParameter(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);null!==i&&t.deleteRenderbuffer(i),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteFramebuffer(this.webGLFramebuffer)}this.renderTexture=null,this.webGLFramebuffer=null,this.gl=null}}});t.exports=r},1482:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i){this.webGLProgram=null,this.gl=t,this.vertexSource=e,this.fragmentSource=i,this.createResource()},createResource:function(){var t=this.gl;if(!t.isContextLost()){var e=t.createProgram(),i=t.createShader(t.VERTEX_SHADER),s=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(i,this.vertexSource),t.shaderSource(s,this.fragmentSource),t.compileShader(i),t.compileShader(s);var n="Shader failed:\n";if(!t.getShaderParameter(i,t.COMPILE_STATUS))throw new Error("Vertex "+n+t.getShaderInfoLog(i));if(!t.getShaderParameter(s,t.COMPILE_STATUS))throw new Error("Fragment "+n+t.getShaderInfoLog(s));if(t.attachShader(e,i),t.attachShader(e,s),t.linkProgram(e),!t.getProgramParameter(e,t.LINK_STATUS))throw new Error("Link "+n+t.getProgramInfoLog(e));t.useProgram(e),this.webGLProgram=e}},destroy:function(){this.webGLProgram&&(this.gl.isContextLost()||this.gl.deleteProgram(this.webGLProgram),this.webGLProgram=null,this.gl=null)}});t.exports=s},82751:(t,e,i)=>{var s=i(83419),n=i(50030),r=new s({initialize:function(t,e,i,s,n,r,o,a,h,l,u,c,d){this.webGLTexture=null,this.isRenderTexture=!1,this.gl=t,this.mipLevel=e,this.minFilter=i,this.magFilter=s,this.wrapT=n,this.wrapS=r,this.format=o,this.pixels=a,this.width=h,this.height=l,this.pma=null==u||u,this.forceSize=!!c,this.flipY=!!d,this.__SPECTOR_Metadata={},this.createResource()},createResource:function(){var t=this.gl;if(!t.isContextLost())if(this.pixels instanceof r)this.webGLTexture=this.pixels.webGLTexture;else{var e=t.createTexture();e.__SPECTOR_Metadata=this.__SPECTOR_Metadata,this.webGLTexture=e,this._processTexture()}},update:function(t,e,i,s,n,r,o,a,h){0!==e&&0!==i&&(this.pixels=t,this.width=e,this.height=i,this.flipY=s,this.wrapS=n,this.wrapT=r,this.minFilter=o,this.magFilter=a,this.format=h,this.gl.isContextLost()||this._processTexture())},_processTexture:function(){var t=this.gl;t.activeTexture(t.TEXTURE0);var e=t.getParameter(t.TEXTURE_BINDING_2D);t.bindTexture(t.TEXTURE_2D,this.webGLTexture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this.minFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this.magFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this.wrapS),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this.wrapT),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.pma),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,this.flipY);var i=this.pixels,s=this.mipLevel,r=this.width,o=this.height,a=this.format,h=!1;if(null==i)t.texImage2D(t.TEXTURE_2D,s,a,r,o,0,a,t.UNSIGNED_BYTE,null),h=n(r,o);else if(i.compressed){r=i.width,o=i.height,h=i.generateMipmap;for(var l=0;l{var s=new(i(83419))({initialize:function(t,e,i){this.webGLUniformLocation=null,this.gl=t,this.program=e,this.name=i,this.createResource()},createResource:function(){if(null!==this.program.webGLProgram){var t=this.gl;t.isContextLost()||(this.webGLUniformLocation=t.getUniformLocation(this.program.webGLProgram,this.name))}else this.webGLUniformLocation=null},destroy:function(){this.gl=null,this.program=null,this.name=null,this.webGLUniformLocation=null}});t.exports=s},9503:(t,e,i)=>{var s={WebGLAttribLocationWrapper:i(93567),WebGLBufferWrapper:i(26128),WebGLProgramWrapper:i(1482),WebGLTextureWrapper:i(82751),WebGLFramebufferWrapper:i(84387),WebGLUniformLocationWrapper:i(57183)};t.exports=s},76531:(t,e,i)=>{var s=i(13560),n=i(83419),r=i(50792),o=i(97480),a=i(8443),h=i(57811),l=i(74403),u=i(45818),c=i(29747),d=i(87841),f=i(86555),p=i(56583),v=i(26099),g=i(38058),m=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.canvas,this.canvasBounds=new d,this.parent=null,this.parentIsWindow=!1,this.parentSize=new f,this.gameSize=new f,this.baseSize=new f,this.displaySize=new f,this.scaleMode=s.SCALE_MODE.NONE,this.zoom=1,this._resetZoom=!1,this.displayScale=new v(1,1),this.autoRound=!1,this.autoCenter=s.CENTER.NO_CENTER,this.orientation=s.ORIENTATION.LANDSCAPE,this.fullscreen,this.fullscreenTarget=null,this._createdFullscreenTarget=!1,this.dirty=!1,this.resizeInterval=500,this._lastCheck=0,this._checkOrientation=!1,this.domlisteners={orientationChange:c,windowResize:c,fullScreenChange:c,fullScreenError:c}},preBoot:function(){this.parseConfig(this.game.config),this.game.events.once(a.BOOT,this.boot,this)},boot:function(){var t=this.game;this.canvas=t.canvas,this.fullscreen=t.device.fullscreen,this.scaleMode!==s.SCALE_MODE.RESIZE&&this.scaleMode!==s.SCALE_MODE.EXPAND&&this.displaySize.setAspectMode(this.scaleMode),this.scaleMode===s.SCALE_MODE.NONE?this.resize(this.width,this.height):(this.getParentBounds(),this.parentSize.width>0&&this.parentSize.height>0&&this.displaySize.setParent(this.parentSize),this.refresh()),t.events.on(a.PRE_STEP,this.step,this),t.events.once(a.READY,this.refresh,this),t.events.once(a.DESTROY,this.destroy,this),this.startListeners()},parseConfig:function(t){this.getParent(t),this.getParentBounds();var e=t.width,i=t.height,n=t.scaleMode,r=t.zoom,o=t.autoRound;if("string"==typeof e)if("%"!==e.substr(-1))e=parseInt(e,10);else{var a=this.parentSize.width;0===a&&(a=window.innerWidth);var h=parseInt(e,10)/100;e=Math.floor(a*h)}if("string"==typeof i)if("%"!==i.substr(-1))i=parseInt(i,10);else{var l=this.parentSize.height;0===l&&(l=window.innerHeight);var c=parseInt(i,10)/100;i=Math.floor(l*c)}this.scaleMode=n,this.autoRound=o,this.autoCenter=t.autoCenter,this.resizeInterval=t.resizeInterval,o&&(e=Math.floor(e),i=Math.floor(i)),this.gameSize.setSize(e,i),r===s.ZOOM.MAX_ZOOM&&(r=this.getMaxZoom()),this.zoom=r,1!==r&&(this._resetZoom=!0),this.baseSize.setSize(e,i),o&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),t.minWidth>0&&this.displaySize.setMin(t.minWidth*r,t.minHeight*r),t.maxWidth>0&&this.displaySize.setMax(t.maxWidth*r,t.maxHeight*r),this.displaySize.setSize(e,i),(t.snapWidth>0||t.snapHeight>0)&&this.displaySize.setSnap(t.snapWidth,t.snapHeight),this.orientation=u(e,i)},getParent:function(t){var e=t.parent;if(null!==e){if(this.parent=l(e),this.parentIsWindow=this.parent===document.body,t.expandParent&&t.scaleMode!==s.SCALE_MODE.NONE){var i=this.parent.getBoundingClientRect();(this.parentIsWindow||0===i.height)&&(document.documentElement.style.height="100%",document.body.style.height="100%",i=this.parent.getBoundingClientRect(),this.parentIsWindow||0!==i.height||(this.parent.style.overflow="hidden",this.parent.style.width="100%",this.parent.style.height="100%"))}t.fullscreenTarget&&!this.fullscreenTarget&&(this.fullscreenTarget=l(t.fullscreenTarget))}},getParentBounds:function(){if(!this.parent)return!1;var t=this.parentSize,e=this.parent.getBoundingClientRect();this.parentIsWindow&&this.game.device.os.iOS&&(e.height=h(!0));var i=e.width,s=e.height;if(t.width!==i||t.height!==s)return t.setSize(i,s),!0;if(this.canvas){var n=this.canvasBounds,r=this.canvas.getBoundingClientRect();if(r.x!==n.x||r.y!==n.y)return!0}return!1},lockOrientation:function(t){var e=screen.lockOrientation||screen.mozLockOrientation||screen.msLockOrientation;return!!e&&e.call(screen,t)},setParentSize:function(t,e){return this.parentSize.setSize(t,e),this.refresh()},setGameSize:function(t,e){var i=this.autoRound;i&&(t=Math.floor(t),e=Math.floor(e));var s=this.width,n=this.height;return this.gameSize.resize(t,e),this.baseSize.resize(t,e),i&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),this.displaySize.setAspectRatio(t/e),this.canvas.width=this.baseSize.width,this.canvas.height=this.baseSize.height,this.refresh(s,n)},resize:function(t,e){var i=this.zoom,s=this.autoRound;s&&(t=Math.floor(t),e=Math.floor(e));var n=this.width,r=this.height;this.gameSize.resize(t,e),this.baseSize.resize(t,e),s&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),this.displaySize.setSize(t*i,e*i),this.canvas.width=this.baseSize.width,this.canvas.height=this.baseSize.height;var o=this.canvas.style,a=t*i,h=e*i;return s&&(a=Math.floor(a),h=Math.floor(h)),a===t&&h===e||(o.width=a+"px",o.height=h+"px"),this.refresh(n,r)},setZoom:function(t){return this.zoom=t,this._resetZoom=!0,this.refresh()},setMaxZoom:function(){return this.zoom=this.getMaxZoom(),this._resetZoom=!0,this.refresh()},setSnap:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.displaySize.setSnap(t,e),this.refresh()},refresh:function(t,e){void 0===t&&(t=this.width),void 0===e&&(e=this.height),this.updateScale(),this.updateBounds(),this.updateOrientation(),this.displayScale.set(this.baseSize.width/this.canvasBounds.width,this.baseSize.height/this.canvasBounds.height);var i=this.game.domContainer;if(i){this.baseSize.setCSS(i);var s=this.canvas.style,n=i.style;n.transform="scale("+this.displaySize.width/this.baseSize.width+","+this.displaySize.height/this.baseSize.height+")",n.marginLeft=s.marginLeft,n.marginTop=s.marginTop}return this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,t,e),this},updateOrientation:function(){if(this._checkOrientation){this._checkOrientation=!1;var t=u(this.width,this.height);t!==this.orientation&&(this.orientation=t,this.emit(o.ORIENTATION_CHANGE,t))}},updateScale:function(){var t,e,i=this.canvas.style,n=this.gameSize.width,r=this.gameSize.height,o=this.zoom,a=this.autoRound;if(this.scaleMode===s.SCALE_MODE.NONE)this.displaySize.setSize(n*o,r*o),t=this.displaySize.width,e=this.displaySize.height,a&&(t=Math.floor(t),e=Math.floor(e)),this._resetZoom&&(i.width=t+"px",i.height=e+"px",this._resetZoom=!1);else if(this.scaleMode===s.SCALE_MODE.RESIZE)this.displaySize.setSize(this.parentSize.width,this.parentSize.height),this.gameSize.setSize(this.displaySize.width,this.displaySize.height),this.baseSize.setSize(this.displaySize.width,this.displaySize.height),t=this.displaySize.width,e=this.displaySize.height,a&&(t=Math.floor(t),e=Math.floor(e)),this.canvas.width=t,this.canvas.height=e;else if(this.scaleMode===s.SCALE_MODE.EXPAND){this.displaySize.setSize(this.parentSize.width,this.parentSize.height),t=this.displaySize.width,e=this.displaySize.height,a&&(t=Math.floor(t),e=Math.floor(e)),i.width=t+"px",i.height=e+"px";var h=this.parentSize.width/this.gameSize.width,l=this.parentSize.height/this.gameSize.height;h=0?0:-o.x*a.x,l=o.y>=0?0:-o.y*a.y;return i=r.width>=o.width?n.width:n.width-(o.width-r.width)*a.x,s=r.height>=o.height?n.height:n.height-(o.height-r.height)*a.y,e.setTo(h,l,i,s),t&&(e.width/=t.zoomX,e.height/=t.zoomY,e.centerX=t.centerX+t.scrollX,e.centerY=t.centerY+t.scrollY),e},step:function(t,e){this.parent&&(this._lastCheck+=e,(this.dirty||this._lastCheck>this.resizeInterval)&&(this.getParentBounds()&&this.refresh(),this.dirty=!1,this._lastCheck=0))},stopListeners:function(){var t=this.domlisteners;window.removeEventListener("orientationchange",t.orientationChange,!1),window.removeEventListener("resize",t.windowResize,!1),["webkit","moz",""].forEach((function(e){document.removeEventListener(e+"fullscreenchange",t.fullScreenChange,!1),document.removeEventListener(e+"fullscreenerror",t.fullScreenError,!1)})),document.removeEventListener("MSFullscreenChange",t.fullScreenChange,!1),document.removeEventListener("MSFullscreenError",t.fullScreenError,!1)},destroy:function(){this.removeAllListeners(),this.stopListeners(),this.game=null,this.canvas=null,this.canvasBounds=null,this.parent=null,this.fullscreenTarget=null,this.parentSize.destroy(),this.gameSize.destroy(),this.baseSize.destroy(),this.displaySize.destroy()},isFullscreen:{get:function(){return this.fullscreen.active}},width:{get:function(){return this.gameSize.width}},height:{get:function(){return this.gameSize.height}},isPortrait:{get:function(){return this.orientation===s.ORIENTATION.PORTRAIT}},isLandscape:{get:function(){return this.orientation===s.ORIENTATION.LANDSCAPE}},isGamePortrait:{get:function(){return this.height>this.width}},isGameLandscape:{get:function(){return this.width>this.height}}});t.exports=m},64743:t=>{t.exports={NO_CENTER:0,CENTER_BOTH:1,CENTER_HORIZONTALLY:2,CENTER_VERTICALLY:3}},39218:t=>{t.exports={LANDSCAPE:"landscape-primary",PORTRAIT:"portrait-primary"}},81050:t=>{t.exports={NONE:0,WIDTH_CONTROLS_HEIGHT:1,HEIGHT_CONTROLS_WIDTH:2,FIT:3,ENVELOP:4,RESIZE:5,EXPAND:6}},80805:t=>{t.exports={NO_ZOOM:1,ZOOM_2X:2,ZOOM_4X:4,MAX_ZOOM:-1}},13560:(t,e,i)=>{var s={CENTER:i(64743),ORIENTATION:i(39218),SCALE_MODE:i(81050),ZOOM:i(80805)};t.exports=s},56139:t=>{t.exports="enterfullscreen"},2336:t=>{t.exports="fullscreenfailed"},47412:t=>{t.exports="fullscreenunsupported"},51452:t=>{t.exports="leavefullscreen"},20666:t=>{t.exports="orientationchange"},47945:t=>{t.exports="resize"},97480:(t,e,i)=>{t.exports={ENTER_FULLSCREEN:i(56139),FULLSCREEN_FAILED:i(2336),FULLSCREEN_UNSUPPORTED:i(47412),LEAVE_FULLSCREEN:i(51452),ORIENTATION_CHANGE:i(20666),RESIZE:i(47945)}},93364:(t,e,i)=>{var s=i(79291),n=i(13560),r={Center:i(64743),Events:i(97480),Orientation:i(39218),ScaleManager:i(76531),ScaleModes:i(81050),Zoom:i(80805)};r=s(!1,r,n.CENTER),r=s(!1,r,n.ORIENTATION),r=s(!1,r,n.SCALE_MODE),r=s(!1,r,n.ZOOM),t.exports=r},27397:(t,e,i)=>{var s=i(95540),n=i(35355);t.exports=function(t){var e=t.game.config.defaultPhysicsSystem,i=s(t.settings,"physics",!1);if(e||i){var r=[];if(e&&r.push(n(e+"Physics")),i)for(var o in i)o=n(o.concat("Physics")),-1===r.indexOf(o)&&r.push(o);return r}}},52106:(t,e,i)=>{var s=i(95540);t.exports=function(t){var e=t.plugins.getDefaultScenePlugins(),i=s(t.settings,"plugins",!1);return Array.isArray(i)?i:e||[]}},87033:t=>{t.exports={game:"game",renderer:"renderer",anims:"anims",cache:"cache",plugins:"plugins",registry:"registry",scale:"scale",sound:"sound",textures:"textures",events:"events",cameras:"cameras",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},97482:(t,e,i)=>{var s=i(83419),n=i(2368),r=new s({initialize:function(t){this.sys=new n(this,t),this.game,this.anims,this.cache,this.registry,this.sound,this.textures,this.events,this.cameras,this.add,this.make,this.scene,this.children,this.lights,this.data,this.input,this.load,this.time,this.tweens,this.physics,this.matter,this.scale,this.plugins,this.renderer},update:function(){}});t.exports=r},60903:(t,e,i)=>{var s=i(83419),n=i(89993),r=i(44594),o=i(8443),a=i(35154),h=i(54899),l=i(29747),u=i(97482),c=i(2368),d=new s({initialize:function(t,e){if(this.game=t,this.keys={},this.scenes=[],this._pending=[],this._start=[],this._queue=[],this._data={},this.isProcessing=!1,this.isBooted=!1,this.customViewports=0,this.systemScene,e){Array.isArray(e)||(e=[e]);for(var i=0;i-1&&(delete this.keys[s],this.scenes.splice(i,1),this._start.indexOf(s)>-1&&(i=this._start.indexOf(s),this._start.splice(i,1)),e.sys.destroy())}return this},bootScene:function(t){var e,i=t.sys,s=i.settings;i.sceneUpdate=l,t.init&&(t.init.call(t,s.data),s.status=n.INIT,s.isTransition&&i.events.emit(r.TRANSITION_INIT,s.transitionFrom,s.transitionDuration)),i.load&&(e=i.load).reset(),e&&t.preload?(t.preload.call(t),s.status=n.LOADING,e.once(h.COMPLETE,this.loadComplete,this),e.start()):this.create(t)},loadComplete:function(t){this.game.sound&&this.game.sound.onBlurPausedSounds&&this.game.sound.unlock(),this.create(t.scene)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this.isProcessing=!0;for(var i=this.scenes.length-1;i>=0;i--){var s=this.scenes[i].sys;s.settings.status>n.START&&s.settings.status<=n.RUNNING&&s.step(t,e),s.scenePlugin&&s.scenePlugin._target&&s.scenePlugin.step(t,e)}},render:function(t){for(var e=0;e=n.LOADING&&i.settings.status=n.START&&o<=n.CREATING)return this;if(o>=n.RUNNING&&o<=n.SLEEPING)r.shutdown(),r.sceneUpdate=l,r.start(e);else if(r.sceneUpdate=l,r.start(e),r.load&&(s=r.load),s&&r.settings.hasOwnProperty("pack")&&(s.reset(),s.addPack({payload:r.settings.pack})))return r.settings.status=n.LOADING,s.once(h.COMPLETE,this.payloadComplete,this),s.start(),this;return this.bootScene(i),this},stop:function(t,e){var i=this.getScene(t);if(i&&!i.sys.isTransitioning()&&i.sys.settings.status!==n.SHUTDOWN){var s=i.sys.load;s&&(s.off(h.COMPLETE,this.loadComplete,this),s.off(h.COMPLETE,this.payloadComplete,this)),i.sys.shutdown(e)}return this},switch:function(t,e){var i=this.getScene(t),s=this.getScene(e);return i&&s&&i!==s&&(this.sleep(t),this.isSleeping(e)?this.wake(e):this.start(e)),this},getAt:function(t){return this.scenes[t]},getIndex:function(t){var e=this.getScene(t);return this.scenes.indexOf(e)},bringToTop:function(t){if(this.isProcessing)this._queue.push({op:"bringToTop",keyA:t,keyB:null});else{var e=this.getIndex(t);if(-1!==e&&e0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this.isProcessing)this._queue.push({op:"moveDown",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e>0){var i=e-1,s=this.getScene(t),n=this.getAt(i);this.scenes[e]=n,this.scenes[i]=s}}return this},moveUp:function(t){if(this.isProcessing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(ei),0,n)}}return this},moveBelow:function(t,e){if(t===e)return this;if(this.isProcessing)this._queue.push({op:"moveBelow",keyA:t,keyB:e});else{var i=this.getIndex(t),s=this.getIndex(e);if(-1!==i&&-1!==s&&s>i){var n=this.getAt(s);this.scenes.splice(s,1),0===i?this.scenes.unshift(n):this.scenes.splice(i-(s{var s=i(45319),n=i(83419),r=i(44594),o=i(95540),a=i(37277),h=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.key=t.sys.settings.key,this.manager=t.sys.game.scene,this.transitionProgress=0,this._elapsed=0,this._target=null,this._duration=0,this._onUpdate,this._onUpdateScope,this._willSleep=!1,this._willRemove=!1,t.sys.events.once(r.BOOT,this.boot,this),t.sys.events.on(r.START,this.pluginStart,this)},boot:function(){this.systems.events.once(r.DESTROY,this.destroy,this)},pluginStart:function(){this._target=null,this.systems.events.once(r.SHUTDOWN,this.shutdown,this)},start:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",this.key),this.manager.queueOp("start",t,e),this},restart:function(t){var e=this.key;return this.manager.queueOp("stop",e),this.manager.queueOp("start",e,t),this},transition:function(t){void 0===t&&(t={});var e=o(t,"target",!1),i=this.manager.getScene(e);if(!e||!this.checkValidTransition(i))return!1;var s=o(t,"duration",1e3);this._elapsed=0,this._target=i,this._duration=s,this._willSleep=o(t,"sleep",!1),this._willRemove=o(t,"remove",!1);var n=o(t,"onUpdate",null);n&&(this._onUpdate=n,this._onUpdateScope=o(t,"onUpdateScope",this.scene));var a=o(t,"allowInput",!1);this.settings.transitionAllowInput=a;var h=i.sys.settings;h.isTransition=!0,h.transitionFrom=this.scene,h.transitionDuration=s,h.transitionAllowInput=a,o(t,"moveAbove",!1)?this.manager.moveAbove(this.key,e):o(t,"moveBelow",!1)&&this.manager.moveBelow(this.key,e),i.sys.isSleeping()?i.sys.wake(o(t,"data")):this.manager.start(e,o(t,"data"));var l=o(t,"onStart",null),u=o(t,"onStartScope",this.scene);return l&&l.call(u,this.scene,i,s),this.systems.events.emit(r.TRANSITION_OUT,i,s),!0},checkValidTransition:function(t){return!(!t||t.sys.isActive()||t.sys.isTransitioning()||t===this.scene||this.systems.isTransitioning())},step:function(t,e){this._elapsed+=e,this.transitionProgress=s(this._elapsed/this._duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.transitionProgress),this._elapsed>=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;t.events.emit(r.TRANSITION_COMPLETE,this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i,s){return this.manager.add(t,e,i,s)},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t,e),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var s=this.manager.getScene(e);return s&&s.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(t),this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isPaused:function(t){return void 0===t&&(t=this.key),this.manager.isPaused(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.swapPosition(t,e),this},moveAbove:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveAbove(t,e),this},moveBelow:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveBelow(t,e),this},remove:function(t){return void 0===t&&(t=this.key),this.manager.remove(t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},getStatus:function(t){var e=this.manager.getScene(t);if(e)return e.sys.getStatus()},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(r.SHUTDOWN,this.shutdown,this),t.off(r.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(r.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});a.register("ScenePlugin",h,"scenePlugin"),t.exports=h},55681:(t,e,i)=>{var s=i(89993),n=i(35154),r=i(46975),o=i(87033),a={create:function(t){return"string"==typeof t?t={key:t}:void 0===t&&(t={}),{status:s.PENDING,key:n(t,"key",""),active:n(t,"active",!1),visible:n(t,"visible",!0),isBooted:!1,isTransition:!1,transitionFrom:null,transitionDuration:0,transitionAllowInput:!0,data:{},pack:n(t,"pack",!1),cameras:n(t,"cameras",null),map:n(t,"map",r(o,n(t,"mapAdd",{}))),physics:n(t,"physics",{}),loader:n(t,"loader",{}),plugins:n(t,"plugins",!1),input:n(t,"input",{})}}};t.exports=a},2368:(t,e,i)=>{var s=i(83419),n=i(89993),r=i(42363),o=i(44594),a=i(27397),h=i(52106),l=i(29747),u=i(55681),c=new s({initialize:function(t,e){this.scene=t,this.game,this.renderer,this.config=e,this.settings=u.create(e),this.canvas,this.context,this.anims,this.cache,this.plugins,this.registry,this.scale,this.sound,this.textures,this.add,this.cameras,this.displayList,this.events,this.make,this.scenePlugin,this.updateList,this.sceneUpdate=l},init:function(t){this.settings.status=n.INIT,this.sceneUpdate=l,this.game=t,this.renderer=t.renderer,this.canvas=t.canvas,this.context=t.context;var e=t.plugins;this.plugins=e,e.addToScene(this,r.Global,[r.CoreScene,h(this),a(this)]),this.events.emit(o.BOOT,this),this.settings.isBooted=!0},step:function(t,e){var i=this.events;i.emit(o.PRE_UPDATE,t,e),i.emit(o.UPDATE,t,e),this.sceneUpdate.call(this.scene,t,e),i.emit(o.POST_UPDATE,t,e)},render:function(t){var e=this.displayList;e.depthSort(),this.events.emit(o.PRE_RENDER,t),this.cameras.render(t,e),this.events.emit(o.RENDER,t)},queueDepthSort:function(){this.displayList.queueDepthSort()},depthSort:function(){this.displayList.depthSort()},pause:function(t){var e=this.settings,i=this.getStatus();return i!==n.CREATING&&i!==n.RUNNING?console.warn("Cannot pause non-running Scene",e.key):this.settings.active&&(e.status=n.PAUSED,e.active=!1,this.events.emit(o.PAUSE,this,t)),this},resume:function(t){var e=this.events,i=this.settings;return this.settings.active||(i.status=n.RUNNING,i.active=!0,e.emit(o.RESUME,this,t)),this},sleep:function(t){var e=this.settings,i=this.getStatus();return i!==n.CREATING&&i!==n.RUNNING?console.warn("Cannot sleep non-running Scene",e.key):(e.status=n.SLEEPING,e.active=!1,e.visible=!1,this.events.emit(o.SLEEP,this,t)),this},wake:function(t){var e=this.events,i=this.settings;return i.status=n.RUNNING,i.active=!0,i.visible=!0,e.emit(o.WAKE,this,t),i.isTransition&&e.emit(o.TRANSITION_WAKE,i.transitionFrom,i.transitionDuration),this},getData:function(){return this.settings.data},getStatus:function(){return this.settings.status},canInput:function(){var t=this.settings.status;return t>n.PENDING&&t<=n.RUNNING},isSleeping:function(){return this.settings.status===n.SLEEPING},isActive:function(){return this.settings.status===n.RUNNING},isPaused:function(){return this.settings.status===n.PAUSED},isTransitioning:function(){return this.settings.isTransition||null!==this.scenePlugin._target},isTransitionOut:function(){return null!==this.scenePlugin._target&&this.scenePlugin._duration>0},isTransitionIn:function(){return this.settings.isTransition},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t,e){return t?this.resume(e):this.pause(e)},start:function(t){var e=this.events,i=this.settings;t&&(i.data=t),i.status=n.START,i.active=!0,i.visible=!0,e.emit(o.START,this),e.emit(o.READY,this,t)},shutdown:function(t){var e=this.events,i=this.settings;e.off(o.TRANSITION_INIT),e.off(o.TRANSITION_START),e.off(o.TRANSITION_COMPLETE),e.off(o.TRANSITION_OUT),i.status=n.SHUTDOWN,i.active=!1,i.visible=!1,e.emit(o.SHUTDOWN,this,t)},destroy:function(){var t=this.events,e=this.settings;e.status=n.DESTROYED,e.active=!1,e.visible=!1,t.emit(o.DESTROY,this),t.removeAllListeners();for(var i=["scene","game","anims","cache","plugins","registry","sound","textures","add","camera","displayList","events","make","scenePlugin","updateList"],s=0;s{t.exports={PENDING:0,INIT:1,START:2,LOADING:3,CREATING:4,RUNNING:5,PAUSED:6,SLEEPING:7,SHUTDOWN:8,DESTROYED:9}},69830:t=>{t.exports="addedtoscene"},7919:t=>{t.exports="boot"},46763:t=>{t.exports="create"},11763:t=>{t.exports="destroy"},71555:t=>{t.exports="pause"},36735:t=>{t.exports="postupdate"},3809:t=>{t.exports="prerender"},90716:t=>{t.exports="preupdate"},58262:t=>{t.exports="ready"},91633:t=>{t.exports="removedfromscene"},10319:t=>{t.exports="render"},87132:t=>{t.exports="resume"},81961:t=>{t.exports="shutdown"},90194:t=>{t.exports="sleep"},6265:t=>{t.exports="start"},33178:t=>{t.exports="transitioncomplete"},43063:t=>{t.exports="transitioninit"},11259:t=>{t.exports="transitionout"},61611:t=>{t.exports="transitionstart"},45209:t=>{t.exports="transitionwake"},22966:t=>{t.exports="update"},21747:t=>{t.exports="wake"},44594:(t,e,i)=>{t.exports={ADDED_TO_SCENE:i(69830),BOOT:i(7919),CREATE:i(46763),DESTROY:i(11763),PAUSE:i(71555),POST_UPDATE:i(36735),PRE_RENDER:i(3809),PRE_UPDATE:i(90716),READY:i(58262),REMOVED_FROM_SCENE:i(91633),RENDER:i(10319),RESUME:i(87132),SHUTDOWN:i(81961),SLEEP:i(90194),START:i(6265),TRANSITION_COMPLETE:i(33178),TRANSITION_INIT:i(43063),TRANSITION_OUT:i(11259),TRANSITION_START:i(61611),TRANSITION_WAKE:i(45209),UPDATE:i(22966),WAKE:i(21747)}},62194:(t,e,i)=>{var s=i(89993),n=i(79291),r={Events:i(44594),GetPhysicsPlugins:i(27397),GetScenePlugins:i(52106),SceneManager:i(60903),ScenePlugin:i(52209),Settings:i(55681),Systems:i(2368)};r=n(!1,r,s),t.exports=r},30341:(t,e,i)=>{var s=i(83419),n=i(50792),r=i(14463),o=i(79291),a=i(29747),h=new s({Extends:n,initialize:function(t,e,i){n.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=this.duration||0,this.totalDuration=this.totalDuration||0,this.config={mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0,pan:0},this.currentConfig=this.config,this.config=o(this.config,i),this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name||(this.markers[t.name]?(console.error("addMarker "+t.name+" already exists in Sound"),1):(t=o(!0,{name:"",start:0,duration:this.totalDuration-(t.start||0),config:{mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0,pan:0}},t),this.markers[t.name]=t,0)))},updateMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name||(this.markers[t.name]?(this.markers[t.name]=o(!0,this.markers[t.name],t),0):(console.warn("Audio Marker: "+t.name+" missing in Sound: "+this.key),1)))},removeMarker:function(t){var e=this.markers[t];return e?(this.markers[t]=null,e):null},play:function(t,e){if(void 0===t&&(t=""),"object"==typeof t&&(e=t,t=""),"string"!=typeof t)return!1;if(t){if(!this.markers[t])return console.warn("Marker: "+t+" missing in Sound: "+this.key),!1;this.currentMarker=this.markers[t],this.currentConfig=this.currentMarker.config,this.duration=this.currentMarker.duration}else this.currentMarker=null,this.currentConfig=this.config,this.duration=this.totalDuration;return this.resetConfig(),this.currentConfig=o(this.currentConfig,e),this.isPlaying=!0,this.isPaused=!1,!0},pause:function(){return!(this.isPaused||!this.isPlaying||(this.isPlaying=!1,this.isPaused=!0,0))},resume:function(){return!(!this.isPaused||this.isPlaying||(this.isPlaying=!0,this.isPaused=!1,0))},stop:function(){return!(!this.isPaused&&!this.isPlaying||(this.isPlaying=!1,this.isPaused=!1,this.resetConfig(),0))},applyConfig:function(){this.mute=this.currentConfig.mute,this.volume=this.currentConfig.volume,this.rate=this.currentConfig.rate,this.detune=this.currentConfig.detune,this.loop=this.currentConfig.loop,this.pan=this.currentConfig.pan},resetConfig:function(){this.currentConfig.seek=0,this.currentConfig.delay=0},update:a,calculateRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e},destroy:function(){this.pendingRemove||(this.stop(),this.emit(r.DESTROY,this),this.removeAllListeners(),this.pendingRemove=!0,this.manager=null,this.config=null,this.currentConfig=null,this.markers=null,this.currentMarker=null)}});t.exports=h},85034:(t,e,i)=>{var s=i(83419),n=i(41786),r=i(50792),o=i(14463),a=i(8443),h=i(46710),l=i(58731),u=i(29747),c=i(26099),d=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.jsonCache=t.cache.json,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,this.gameLostFocus=!1,this.listenerPosition=new c,t.events.on(a.BLUR,this.onGameBlur,this),t.events.on(a.FOCUS,this.onGameFocus,this),t.events.on(a.PRE_STEP,this.update,this),t.events.once(a.DESTROY,this.destroy,this)},add:u,addAudioSprite:function(t,e){void 0===e&&(e={});var i=this.add(t,e);for(var s in i.spritemap=this.jsonCache.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(s)){var r=n(e),o=i.spritemap[s];r.loop=!!o.hasOwnProperty("loop")&&o.loop,i.addMarker({name:s,start:o.start,duration:o.end-o.start,config:r})}return i},get:function(t){return l(this.sounds,"key",t)},getAll:function(t){return t?h(this.sounds,"key",t):h(this.sounds)},getAllPlaying:function(){return h(this.sounds,"isPlaying",!0)},play:function(t,e){var i=this.add(t);return i.once(o.COMPLETE,i.destroy,i),e?e.name?(i.addMarker(e),i.play(e.name)):i.play(e):i.play()},playAudioSprite:function(t,e,i){var s=this.addAudioSprite(t);return s.once(o.COMPLETE,s.destroy,s),s.play(e,i)},remove:function(t){var e=this.sounds.indexOf(t);return-1!==e&&(t.destroy(),this.sounds.splice(e,1),!0)},removeAll:function(){this.sounds.forEach((function(t){t.destroy()})),this.sounds.length=0},removeByKey:function(t){for(var e=0,i=this.sounds.length-1;i>=0;i--){var s=this.sounds[i];s.key===t&&(s.destroy(),this.sounds.splice(i,1),e++)}return e},pauseAll:function(){this.forEachActiveSound((function(t){t.pause()})),this.emit(o.PAUSE_ALL,this)},resumeAll:function(){this.forEachActiveSound((function(t){t.resume()})),this.emit(o.RESUME_ALL,this)},setListenerPosition:u,stopAll:function(){this.forEachActiveSound((function(t){t.stop()})),this.emit(o.STOP_ALL,this)},stopByKey:function(t){var e=0;return this.getAll(t).forEach((function(t){t.stop()&&e++})),e},unlock:u,onBlur:u,onFocus:u,onGameBlur:function(){this.gameLostFocus=!0,this.pauseOnBlur&&this.onBlur()},onGameFocus:function(){this.gameLostFocus=!1,this.pauseOnBlur&&this.onFocus()},update:function(t,e){this.unlocked&&(this.unlocked=!1,this.locked=!1,this.emit(o.UNLOCKED,this));for(var i=this.sounds.length-1;i>=0;i--)this.sounds[i].pendingRemove&&this.sounds.splice(i,1);this.sounds.forEach((function(i){i.update(t,e)}))},destroy:function(){this.game.events.off(a.BLUR,this.onGameBlur,this),this.game.events.off(a.FOCUS,this.onGameFocus,this),this.game.events.off(a.PRE_STEP,this.update,this),this.removeAllListeners(),this.removeAll(),this.sounds.length=0,this.sounds=null,this.listenerPosition=null,this.game=null},forEachActiveSound:function(t,e){var i=this;this.sounds.forEach((function(s,n){s&&!s.pendingRemove&&t.call(e||i,s,n,i.sounds)}))},setRate:function(t){return this.rate=t,this},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound((function(t){t.calculateRate()})),this.emit(o.GLOBAL_RATE,this,t)}},setDetune:function(t){return this.detune=t,this},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound((function(t){t.calculateRate()})),this.emit(o.GLOBAL_DETUNE,this,t)}}});t.exports=d},14747:(t,e,i)=>{var s=i(33684),n=i(25960),r=i(57490),o={create:function(t){var e=t.config.audio,i=t.device.audio;return e.noAudio||!i.webAudio&&!i.audioData?new n(t):i.webAudio&&!e.disableWebAudio?new r(t):new s(t)}};t.exports=o},19723:t=>{t.exports="complete"},98882:t=>{t.exports="decodedall"},57506:t=>{t.exports="decoded"},73146:t=>{t.exports="destroy"},11305:t=>{t.exports="detune"},40577:t=>{t.exports="detune"},30333:t=>{t.exports="mute"},20394:t=>{t.exports="rate"},21802:t=>{t.exports="volume"},1299:t=>{t.exports="looped"},99190:t=>{t.exports="loop"},97125:t=>{t.exports="mute"},89259:t=>{t.exports="pan"},79986:t=>{t.exports="pauseall"},17586:t=>{t.exports="pause"},19618:t=>{t.exports="play"},42306:t=>{t.exports="rate"},10387:t=>{t.exports="resumeall"},48959:t=>{t.exports="resume"},9960:t=>{t.exports="seek"},19180:t=>{t.exports="stopall"},98328:t=>{t.exports="stop"},50401:t=>{t.exports="unlocked"},52498:t=>{t.exports="volume"},14463:(t,e,i)=>{t.exports={COMPLETE:i(19723),DECODED:i(57506),DECODED_ALL:i(98882),DESTROY:i(73146),DETUNE:i(11305),GLOBAL_DETUNE:i(40577),GLOBAL_MUTE:i(30333),GLOBAL_RATE:i(20394),GLOBAL_VOLUME:i(21802),LOOP:i(99190),LOOPED:i(1299),MUTE:i(97125),PAN:i(89259),PAUSE_ALL:i(79986),PAUSE:i(17586),PLAY:i(19618),RATE:i(42306),RESUME_ALL:i(10387),RESUME:i(48959),SEEK:i(9960),STOP_ALL:i(19180),STOP:i(98328),UNLOCKED:i(50401),VOLUME:i(52498)}},64895:(t,e,i)=>{var s=i(30341),n=i(83419),r=i(14463),o=i(45319),a=new n({Extends:s,initialize:function(t,e,i){if(void 0===i&&(i={}),this.tags=t.game.cache.audio.get(e),!this.tags)throw new Error('No cached audio asset with key "'+e);this.audio=null,this.startTime=0,this.previousTime=0,this.duration=this.tags[0].duration,this.totalDuration=this.tags[0].duration,s.call(this,t,e,i)},play:function(t,e){return!(this.manager.isLocked(this,"play",[t,e])||!s.prototype.play.call(this,t,e)||!this.pickAndPlayAudioTag()||(this.emit(r.PLAY,this),0))},pause:function(){return!(this.manager.isLocked(this,"pause")||this.startTime>0||!s.prototype.pause.call(this)||(this.currentConfig.seek=this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0),this.stopAndReleaseAudioTag(),this.emit(r.PAUSE,this),0))},resume:function(){return!(this.manager.isLocked(this,"resume")||this.startTime>0||!s.prototype.resume.call(this)||!this.pickAndPlayAudioTag()||(this.emit(r.RESUME,this),0))},stop:function(){return!this.manager.isLocked(this,"stop")&&!!s.prototype.stop.call(this)&&(this.stopAndReleaseAudioTag(),this.emit(r.STOP,this),!0)},pickAndPlayAudioTag:function(){if(!this.pickAudioTag())return this.reset(),!1;var t=this.currentConfig.seek,e=this.currentConfig.delay,i=(this.currentMarker?this.currentMarker.start:0)+t;return this.previousTime=i,this.audio.currentTime=i,this.applyConfig(),0===e?(this.startTime=0,this.audio.paused&&this.playCatchPromise()):(this.startTime=window.performance.now()+1e3*e,this.audio.paused||this.audio.pause()),this.resetConfig(),!0},pickAudioTag:function(){if(this.audio)return!0;for(var t=0;t0)this.startTime=i-this.manager.loopEndOffset?(this.audio.currentTime=e+Math.max(0,s-i),s=this.audio.currentTime):s=i)return this.reset(),this.stopAndReleaseAudioTag(),void this.emit(r.COMPLETE,this);this.previousTime=s}},destroy:function(){s.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},updateMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},updateVolume:function(){this.audio&&(this.audio.volume=o(this.currentConfig.volume*this.manager.volume,0,1))},calculateRate:function(){s.prototype.calculateRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)},mute:{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||(this.updateMute(),this.emit(r.MUTE,this,t))}},setMute:function(t){return this.mute=t,this},volume:{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||(this.updateVolume(),this.emit(r.VOLUME,this,t))}},setVolume:function(t){return this.volume=t,this},rate:{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,r.RATE,t)||(this.calculateRate(),this.emit(r.RATE,this,t))}},setRate:function(t){return this.rate=t,this},detune:{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,r.DETUNE,t)||(this.calculateRate(),this.emit(r.DETUNE,this,t))}},setDetune:function(t){return this.detune=t,this},seek:{get:function(){return this.isPlaying?this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0):this.isPaused?this.currentConfig.seek:0},set:function(t){this.manager.isLocked(this,"seek",t)||this.startTime>0||(this.isPlaying||this.isPaused)&&(t=Math.min(Math.max(0,t),this.duration),this.isPlaying?(this.previousTime=t,this.audio.currentTime=t):this.isPaused&&(this.currentConfig.seek=t),this.emit(r.SEEK,this,t))}},setSeek:function(t){return this.seek=t,this},loop:{get:function(){return this.currentConfig.loop},set:function(t){this.currentConfig.loop=t,this.manager.isLocked(this,"loop",t)||(this.audio&&(this.audio.loop=t),this.emit(r.LOOP,this,t))}},setLoop:function(t){return this.loop=t,this},pan:{get:function(){return this.currentConfig.pan},set:function(t){this.currentConfig.pan=t,this.emit(r.PAN,this,t)}},setPan:function(t){return this.pan=t,this}});t.exports=a},33684:(t,e,i)=>{var s=i(85034),n=i(83419),r=i(14463),o=i(64895),a=new n({Extends:s,initialize:function(t){this.override=!0,this.audioPlayDelay=.1,this.loopEndOffset=.05,this.onBlurPausedSounds=[],this.locked="ontouchstart"in window,this.lockedActionsQueue=this.locked?[]:null,this._mute=!1,this._volume=1,s.call(this,t)},add:function(t,e){var i=new o(this,t,e);return this.sounds.push(i),i},unlock:function(){this.locked=!1;var t=this;if(this.game.cache.audio.entries.each((function(e,i){for(var s=0;s{t.exports={SoundManagerCreator:i(14747),Events:i(14463),BaseSound:i(30341),BaseSoundManager:i(85034),WebAudioSound:i(71741),WebAudioSoundManager:i(57490),HTML5AudioSound:i(64895),HTML5AudioSoundManager:i(33684),NoAudioSound:i(4603),NoAudioSoundManager:i(25960)}},4603:(t,e,i)=>{var s=i(30341),n=i(83419),r=i(50792),o=i(79291),a=i(29747),h=function(){return!1},l=function(){return null},u=function(){return this},c=new n({Extends:r,initialize:function(t,e,i){void 0===i&&(i={}),r.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=0,this.totalDuration=0,this.config=o({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0,pan:0},i),this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.pan=0,this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:h,updateMarker:h,removeMarker:l,play:h,pause:h,resume:h,stop:h,setMute:u,setVolume:u,setRate:u,setDetune:u,setSeek:u,setLoop:u,setPan:u,applyConfig:l,resetConfig:l,update:a,calculateRate:l,destroy:function(){s.prototype.destroy.call(this)}});t.exports=c},25960:(t,e,i)=>{var s=i(85034),n=i(83419),r=i(50792),o=i(4603),a=i(29747),h=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.pauseOnBlur=!0,this.locked=!1},add:function(t,e){var i=new o(this,t,e);return this.sounds.push(i),i},addAudioSprite:function(t,e){var i=this.add(t,e);return i.spritemap={},i},get:function(t){return s.prototype.get.call(this,t)},getAll:function(t){return s.prototype.getAll.call(this,t)},play:function(t,e){return!1},playAudioSprite:function(t,e,i){return!1},remove:function(t){return s.prototype.remove.call(this,t)},removeAll:function(){return s.prototype.removeAll.call(this)},removeByKey:function(t){return s.prototype.removeByKey.call(this,t)},stopByKey:function(t){return s.prototype.stopByKey.call(this,t)},onBlur:a,onFocus:a,onGameBlur:a,onGameFocus:a,pauseAll:a,resumeAll:a,stopAll:a,update:a,setRate:a,setDetune:a,setMute:a,setVolume:a,unlock:a,forEachActiveSound:function(t,e){s.prototype.forEachActiveSound.call(this,t,e)},destroy:function(){s.prototype.destroy.call(this)}});t.exports=h},71741:(t,e,i)=>{var s=i(30341),n=i(83419),r=i(14463),o=i(95540),a=new n({Extends:s,initialize:function(t,e,i){if(void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),!this.audioBuffer)throw new Error('Audio key "'+e+'" missing from cache');this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.pannerNode=null,this.spatialNode=null,this.spatialSource=null,this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),t.context.createPanner&&(this.spatialNode=t.context.createPanner(),this.volumeNode.connect(this.spatialNode)),t.context.createStereoPanner?(this.pannerNode=t.context.createStereoPanner(),t.context.createPanner?this.spatialNode.connect(this.pannerNode):this.volumeNode.connect(this.pannerNode),this.pannerNode.connect(t.destination)):t.context.createPanner?this.spatialNode.connect(t.destination):this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,s.call(this,t,e,i)},play:function(t,e){return!!s.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit(r.PLAY,this),!0)},pause:function(){return!(this.manager.context.currentTime{var s=i(53134),n=i(85034),r=i(83419),o=i(14463),a=i(8443),h=i(71741),l=i(95540),u=new r({Extends:n,initialize:function(t){this.context=this.createAudioContext(t),this.masterMuteNode=this.context.createGain(),this.masterVolumeNode=this.context.createGain(),this.masterMuteNode.connect(this.masterVolumeNode),this.masterVolumeNode.connect(this.context.destination),this.destination=this.masterMuteNode,this.locked="suspended"===this.context.state&&("ontouchstart"in window||"onclick"in window),n.call(this,t),this.locked&&t.isBooted?this.unlock():t.events.once(a.BOOT,this.unlock,this)},createAudioContext:function(t){var e=t.config.audio;return e.context?(e.context.resume(),e.context):window.hasOwnProperty("AudioContext")?new AudioContext:window.hasOwnProperty("webkitAudioContext")?new window.webkitAudioContext:void 0},setAudioContext:function(t){return this.context&&this.context.close(),this.masterMuteNode&&this.masterMuteNode.disconnect(),this.masterVolumeNode&&this.masterVolumeNode.disconnect(),this.context=t,this.masterMuteNode=t.createGain(),this.masterVolumeNode=t.createGain(),this.masterMuteNode.connect(this.masterVolumeNode),this.masterVolumeNode.connect(t.destination),this.destination=this.masterMuteNode,this},add:function(t,e){var i=new h(this,t,e);return this.sounds.push(i),i},decodeAudio:function(t,e){var i;i=Array.isArray(t)?t:[{key:t,data:e}];for(var n=this.game.cache.audio,r=i.length,a=0;a{var s=i(37105),n=i(83419),r=i(29747),o=i(19186),a=new n({initialize:function(t){this.parent=t,this.list=[],this.position=0,this.addCallback=r,this.removeCallback=r,this._sortKey=""},add:function(t,e){return e?s.Add(this.list,t):s.Add(this.list,t,0,this.addCallback,this)},addAt:function(t,e,i){return i?s.AddAt(this.list,t,e):s.AddAt(this.list,t,e,0,this.addCallback,this)},getAt:function(t){return this.list[t]},getIndex:function(t){return this.list.indexOf(t)},sort:function(t,e){return t?(void 0===e&&(e=function(e,i){return e[t]-i[t]}),o(this.list,e),this):this},getByName:function(t){return s.GetFirst(this.list,"name",t)},getRandom:function(t,e){return s.GetRandom(this.list,t,e)},getFirst:function(t,e,i,n){return s.GetFirst(this.list,t,e,i,n)},getAll:function(t,e,i,n){return s.GetAll(this.list,t,e,i,n)},count:function(t,e){return s.CountAllMatching(this.list,t,e)},swap:function(t,e){s.Swap(this.list,t,e)},moveTo:function(t,e){return s.MoveTo(this.list,t,e)},moveAbove:function(t,e){return s.MoveAbove(this.list,t,e)},moveBelow:function(t,e){return s.MoveBelow(this.list,t,e)},remove:function(t,e){return e?s.Remove(this.list,t):s.Remove(this.list,t,this.removeCallback,this)},removeAt:function(t,e){return e?s.RemoveAt(this.list,t):s.RemoveAt(this.list,t,this.removeCallback,this)},removeBetween:function(t,e,i){return i?s.RemoveBetween(this.list,t,e):s.RemoveBetween(this.list,t,e,this.removeCallback,this)},removeAll:function(t){for(var e=this.list.length;e--;)this.remove(this.list[e],t);return this},bringToTop:function(t){return s.BringToTop(this.list,t)},sendToBack:function(t){return s.SendToBack(this.list,t)},moveUp:function(t){return s.MoveUp(this.list,t),t},moveDown:function(t){return s.MoveDown(this.list,t),t},reverse:function(){return this.list.reverse(),this},shuffle:function(){return s.Shuffle(this.list),this},replace:function(t,e){return s.Replace(this.list,t,e)},exists:function(t){return this.list.indexOf(t)>-1},setAll:function(t,e,i,n){return s.SetAll(this.list,t,e,i,n),this},each:function(t,e){for(var i=[null],s=2;s0?this.list[0]:null}},last:{get:function(){return this.list.length>0?(this.position=this.list.length-1,this.list[this.position]):null}},next:{get:function(){return this.position0?(this.position--,this.list[this.position]):null}}});t.exports=a},90330:(t,e,i)=>{var s=new(i(83419))({initialize:function(t){this.entries={},this.size=0,this.setAll(t)},setAll:function(t){if(Array.isArray(t))for(var e=0;e{var s=i(83419),n=i(50792),r=i(82348),o=new s({Extends:n,initialize:function(){n.call(this),this._pending=[],this._active=[],this._destroy=[],this._toProcess=0,this.checkQueue=!1},isActive:function(t){return this._active.indexOf(t)>-1},isPending:function(t){return this._toProcess>0&&this._pending.indexOf(t)>-1},isDestroying:function(t){return this._destroy.indexOf(t)>-1},add:function(t){return this.checkQueue&&this.isActive(t)&&!this.isDestroying(t)||this.isPending(t)||(this._pending.push(t),this._toProcess++),t},remove:function(t){if(this.isPending(t)){var e=this._pending,i=e.indexOf(t);-1!==i&&e.splice(i,1)}else this.isActive(t)&&(this._destroy.push(t),this._toProcess++);return t},removeAll:function(){for(var t=this._active,e=this._destroy,i=t.length;i--;)e.push(t[i]),this._toProcess++;return this},update:function(){if(0===this._toProcess)return this._active;var t,e,i=this._destroy,s=this._active;for(t=0;t{var s=i(43886);function n(t){if(!(this instanceof n))return new n(t);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function r(t,e,i){if(!i)return e.indexOf(t);for(var s=0;s=t.minX&&e.maxY>=t.minY}function v(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(t,e,i,n,r){for(var o,a=[e,i];a.length;)(i=a.pop())-(e=a.pop())<=n||(o=e+Math.ceil((i-e)/n/2)*n,s(t,o,e,i,r),a.push(e,o,o,i))}n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],s=this.toBBox;if(!p(t,e))return i;for(var n,r,o,a,h=[];e;){for(n=0,r=e.children.length;n=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)},_split:function(t,e){var i=t[e],s=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,s);var r=this._chooseSplitIndex(i,n,s),a=v(i.children.splice(r,i.children.length-r));a.height=i.height,a.leaf=i.leaf,o(i,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=v([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var s,n,r,o,h,l,u,d,f,p,v,g,m,y;for(l=u=1/0,s=e;s<=i-e;s++)f=n=a(t,0,s,this.toBBox),p=r=a(t,s,i,this.toBBox),void 0,void 0,void 0,void 0,v=Math.max(f.minX,p.minX),g=Math.max(f.minY,p.minY),m=Math.min(f.maxX,p.maxX),y=Math.min(f.maxY,p.maxY),o=Math.max(0,m-v)*Math.max(0,y-g),h=c(n)+c(r),o=e;n--)r=t.children[n],h(u,t.leaf?o(r):r),c+=d(u);return c},_adjustParentBBoxes:function(t,e,i){for(var s=i;s>=0;s--)h(e[s],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():o(t[i],this.toBBox)},compareMinX:function(t,e){return t.left-e.left},compareMinY:function(t,e){return t.top-e.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},t.exports=n},35072:(t,e,i)=>{var s=new(i(83419))({initialize:function(t){if(this.entries=[],Array.isArray(t))for(var e=0;e-1&&this.entries.splice(e,1),this},dump:function(){console.group("Set");for(var t=0;t-1},union:function(t){var e=new s;return t.entries.forEach((function(t){e.set(t)})),this.entries.forEach((function(t){e.set(t)})),e},intersect:function(t){var e=new s;return this.entries.forEach((function(i){t.contains(i)&&e.set(i)})),e},difference:function(t){var e=new s;return this.entries.forEach((function(i){t.contains(i)||e.set(i)})),e},size:{get:function(){return this.entries.length},set:function(t){return t{var s=i(45319),n=i(83419),r=i(56583),o=i(26099),a=new n({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=null),this._width=t,this._height=e,this._parent=s,this.aspectMode=i,this.aspectRatio=0===e?1:t/e,this.minWidth=0,this.minHeight=0,this.maxWidth=Number.MAX_VALUE,this.maxHeight=Number.MAX_VALUE,this.snapTo=new o},setAspectMode:function(t){return void 0===t&&(t=0),this.aspectMode=t,this.setSize(this._width,this._height)},setSnap:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.snapTo.set(t,e),this.setSize(this._width,this._height)},setParent:function(t){return this._parent=t,this.setSize(this._width,this._height)},setMin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.minWidth=s(t,0,this.maxWidth),this.minHeight=s(e,0,this.maxHeight),this.setSize(this._width,this._height)},setMax:function(t,e){return void 0===t&&(t=Number.MAX_VALUE),void 0===e&&(e=t),this.maxWidth=s(t,this.minWidth,Number.MAX_VALUE),this.maxHeight=s(e,this.minHeight,Number.MAX_VALUE),this.setSize(this._width,this._height)},setSize:function(t,e){switch(void 0===t&&(t=0),void 0===e&&(e=t),this.aspectMode){case a.NONE:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height;break;case a.WIDTH_CONTROLS_HEIGHT:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(this._width*(1/this.aspectRatio),!1);break;case a.HEIGHT_CONTROLS_WIDTH:this._height=this.getNewHeight(r(e,this.snapTo.y)),this._width=this.getNewWidth(this._height*this.aspectRatio,!1);break;case a.FIT:this.constrain(t,e,!0);break;case a.ENVELOP:this.constrain(t,e,!1)}return this},setAspectRatio:function(t){return this.aspectRatio=t,this.setSize(this._width,this._height)},resize:function(t,e){return this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height,this},getNewWidth:function(t,e){return void 0===e&&(e=!0),t=s(t,this.minWidth,this.maxWidth),e&&this._parent&&t>this._parent.width&&(t=Math.max(this.minWidth,this._parent.width)),t},getNewHeight:function(t,e){return void 0===e&&(e=!0),t=s(t,this.minHeight,this.maxHeight),e&&this._parent&&t>this._parent.height&&(t=Math.max(this.minHeight,this._parent.height)),t},constrain:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=!0),t=this.getNewWidth(t),e=this.getNewHeight(e);var s=this.snapTo,n=0===e?1:t/e;return i&&this.aspectRatio>n||!i&&this.aspectRatio0&&(t=(e=r(e,s.y))*this.aspectRatio)):(i&&this.aspectRation)&&(t=(e=r(e,s.y))*this.aspectRatio,s.x>0&&(e=(t=r(t,s.x))*(1/this.aspectRatio))),this._width=t,this._height=e,this},fitTo:function(t,e){return this.constrain(t,e,!0)},envelop:function(t,e){return this.constrain(t,e,!1)},setWidth:function(t){return this.setSize(t,this._height)},setHeight:function(t){return this.setSize(this._width,t)},toString:function(){return"[{ Size (width="+this._width+" height="+this._height+" aspectRatio="+this.aspectRatio+" aspectMode="+this.aspectMode+") }]"},setCSS:function(t){t&&t.style&&(t.style.width=this._width+"px",t.style.height=this._height+"px")},copy:function(t){return t.setAspectMode(this.aspectMode),t.aspectRatio=this.aspectRatio,t.setSize(this.width,this.height)},destroy:function(){this._parent=null,this.snapTo=null},width:{get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},height:{get:function(){return this._height},set:function(t){this.setSize(this._width,t)}}});a.NONE=0,a.WIDTH_CONTROLS_HEIGHT=1,a.HEIGHT_CONTROLS_WIDTH=2,a.FIT=3,a.ENVELOP=4,t.exports=a},15238:t=>{t.exports="add"},56187:t=>{t.exports="remove"},82348:(t,e,i)=>{t.exports={PROCESS_QUEUE_ADD:i(15238),PROCESS_QUEUE_REMOVE:i(56187)}},41392:(t,e,i)=>{t.exports={Events:i(82348),List:i(73162),Map:i(90330),ProcessQueue:i(25774),RTree:i(59542),Set:i(35072),Size:i(86555)}},57382:(t,e,i)=>{var s=i(83419),n=i(45319),r=i(40987),o=i(8054),a=i(50030),h=i(79237),l=new s({Extends:h,initialize:function(t,e,i,s,n){h.call(this,t,e,i,s,n),this.add("__BASE",0,0,0,s,n),this._source=this.frames.__BASE.source,this.canvas=this._source.image,this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.width=s,this.height=n,this.imageData=this.context.getImageData(0,0,s,n),this.data=null,this.imageData&&(this.data=this.imageData.data),this.pixels=null,this.buffer,this.data&&(this.imageData.data.buffer?(this.buffer=this.imageData.data.buffer,this.pixels=new Uint32Array(this.buffer)):window.ArrayBuffer?(this.buffer=new ArrayBuffer(this.imageData.data.length),this.pixels=new Uint32Array(this.buffer)):this.pixels=this.imageData.data)},update:function(){return this.imageData=this.context.getImageData(0,0,this.width,this.height),this.data=this.imageData.data,this.imageData.data.buffer?(this.buffer=this.imageData.data.buffer,this.pixels=new Uint32Array(this.buffer)):window.ArrayBuffer?(this.buffer=new ArrayBuffer(this.imageData.data.length),this.pixels=new Uint32Array(this.buffer)):this.pixels=this.imageData.data,this.manager.game.config.renderType===o.WEBGL&&this.refresh(),this},draw:function(t,e,i,s){return void 0===s&&(s=!0),this.context.drawImage(i,t,e),s&&this.update(),this},drawFrame:function(t,e,i,s,n){void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=!0);var r=this.manager.getFrame(t,e);if(r){var o=r.canvasData,a=r.cutWidth,h=r.cutHeight,l=r.source.resolution;this.context.drawImage(r.source.image,o.x,o.y,a,h,i,s,a/l,h/l),n&&this.update()}return this},setPixel:function(t,e,i,s,n,r){if(void 0===r&&(r=255),t=Math.abs(Math.floor(t)),e=Math.abs(Math.floor(e)),this.getIndex(t,e)>-1){var o=this.context.getImageData(t,e,1,1);o.data[0]=i,o.data[1]=s,o.data[2]=n,o.data[3]=r,this.context.putImageData(o,t,e)}return this},putData:function(t,e,i,s,n,r,o){return void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=t.width),void 0===o&&(o=t.height),this.context.putImageData(t,e,i,s,n,r,o),this},getData:function(t,e,i,s){return t=n(Math.floor(t),0,this.width-1),e=n(Math.floor(e),0,this.height-1),i=n(i,1,this.width-t),s=n(s,1,this.height-e),this.context.getImageData(t,e,i,s)},getPixel:function(t,e,i){i||(i=new r);var s=this.getIndex(t,e);if(s>-1){var n=this.data,o=n[s+0],a=n[s+1],h=n[s+2],l=n[s+3];i.setTo(o,a,h,l)}return i},getPixels:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.width),void 0===s&&(s=i),t=Math.abs(Math.round(t)),e=Math.abs(Math.round(e));for(var o=n(t,0,this.width),a=n(t+i,0,this.width),h=n(e,0,this.height),l=n(e+s,0,this.height),u=new r,c=[],d=h;d{var s=i(10312),n=i(71911),r=i(27919),o=i(83419),a=i(8054),h=i(4327),l=i(95540),u=i(36060),c=i(32302),d=i(79237),f=i(70554),p=new o({Extends:d,initialize:function(t,e,i,s){void 0===i&&(i=256),void 0===s&&(s=256),this.type="DynamicTexture";var o=t.game.renderer,h=o&&o.type===a.CANVAS,l=h?r.create2D(this,i,s):[this];d.call(this,t,e,l,i,s),this.add("__BASE",0,0,0,i,s),this.renderer=o,this.width=-1,this.height=-1,this.isDrawing=!1,this.canvas=h?l:null,this.context=h?l.getContext("2d",{willReadFrequently:!0}):null,this.dirty=!1,this.isSpriteTexture=!0,this._eraseMode=!1,this.camera=new n(0,0,i,s).setScene(t.game.scene.systemScene,!1),this.renderTarget=h?null:new c(o,i,s,1,0,!1,!0,!0,!1),this.pipeline=h?null:o.pipelines.get(u.SINGLE_PIPELINE),this.setSize(i,s)},setSize:function(t,e){void 0===e&&(e=t);var i=this.get(),s=i.source;if(t!==this.width||e!==this.height){this.canvas&&(this.canvas.width=t,this.canvas.height=e);var n=this.renderTarget;n&&(n.willResize(t,e)&&n.resize(t,e),n.texture!==s.glTexture&&this.renderer.deleteTexture(s.glTexture),this.setFromRenderTarget()),this.camera.setSize(t,e),s.width=t,s.height=e,i.setSize(t,e),this.width=t,this.height=e}else{var r=this.getSourceImage();i.cutX+t>r.width&&(t=r.width-i.cutX),i.cutY+e>r.height&&(e=r.height-i.cutY),i.setSize(t,e,i.cutX,i.cutY)}return this},setFromRenderTarget:function(){var t=this.get().source,e=this.renderTarget;return t.isRenderTexture=!0,t.isGLTexture=!0,t.glTexture=e.texture,this},setIsSpriteTexture:function(t){return this.isSpriteTexture=t,this},fill:function(t,e,i,s,n,r){var o=this.camera,a=this.renderer;void 0===e&&(e=1),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=this.width),void 0===r&&(r=this.height);var h=t>>16&255,l=t>>8&255,u=255&t,c=this.renderTarget;if(o.preRender(),c){c.bind(!0);var d=this.pipeline.manager.set(this.pipeline),p=a.width/c.width,v=a.height/c.height,g=c.height-(s+r);d.drawFillRect(i*p,g*v,n*p,r*v,f.getTintFromFloats(u/255,l/255,h/255,1),e),c.unbind(!0)}else{var m=this.context;a.setContext(m),m.globalCompositeOperation="source-over",m.fillStyle="rgba("+h+","+l+","+u+","+e+")",m.fillRect(i,s,n,r),a.setContext()}return this.dirty=!0,this},clear:function(){if(this.dirty){var t=this.context,e=this.renderTarget;e?e.clear():t&&(t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,this.width,this.height),t.restore()),this.dirty=!1}return this},stamp:function(t,e,i,s,n){void 0===i&&(i=0),void 0===s&&(s=0);var r=l(n,"alpha",1),o=l(n,"tint",16777215),a=l(n,"angle",0),h=l(n,"rotation",0),u=l(n,"scale",1),c=l(n,"scaleX",u),d=l(n,"scaleY",u),f=l(n,"originX",.5),p=l(n,"originY",.5),v=l(n,"blendMode",0),g=l(n,"erase",!1),m=l(n,"skipBatch",!1),y=this.manager.resetStamp(r,o);return y.setAngle(0),0!==a?y.setAngle(a):0!==h&&y.setRotation(h),y.setScale(c,d),y.setTexture(t,e),y.setOrigin(f,p),y.setBlendMode(v),g&&(this._eraseMode=!0),m?this.batchGameObject(y,i,s):this.draw(y,i,s),g&&(this._eraseMode=!1),this},erase:function(t,e,i){return this._eraseMode=!0,this.draw(t,e,i),this._eraseMode=!1,this},draw:function(t,e,i,s,n){return this.beginDraw(),this.batchDraw(t,e,i,s,n),this.endDraw(),this},drawFrame:function(t,e,i,s,n,r){return this.beginDraw(),this.batchDrawFrame(t,e,i,s,n,r),this.endDraw(),this},repeat:function(t,e,i,s,n,r,o,a,l){if(void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=this.width),void 0===r&&(r=this.height),void 0===o&&(o=1),void 0===a&&(a=16777215),void 0===l&&(l=!1),!(e=t instanceof h?t:this.manager.getFrame(t,e)))return this;var u=this.manager.resetStamp(o,a);u.setFrame(e),u.setOrigin(0);var c=e.width,d=e.height;n=Math.floor(n),r=Math.floor(r);var f=Math.ceil(n/c),p=Math.ceil(r/d),v=f*c-n,g=p*d-r;v>0&&(v=c-v),g>0&&(g=d-g),i<0&&(f+=Math.ceil(Math.abs(i)/c)),s<0&&(p+=Math.ceil(Math.abs(s)/d));var m=i,y=s,x=!1,T=this.manager.stampCrop.setTo(0,0,c,d);l||this.beginDraw();for(var w=0;w0&&b===f-1&&(x=!0,T.width=v),g>0&&w===p-1&&(x=!0,T.height=g),x&&u.setCrop(T),this.batchGameObject(u,m,y),u.isCropped=!1,T.setTo(0,0,c,d)),m+=c;m=i,y+=d}return l||this.endDraw(),this},beginDraw:function(){if(!this.isDrawing){var t=this.camera,e=this.renderer,i=this.renderTarget;t.preRender(),i?e.beginCapture(i.width,i.height):e.setContext(this.context),this.isDrawing=!0}return this},batchDraw:function(t,e,i,s,n){return Array.isArray(t)||(t=[t]),this.batchList(t,e,i,s,n),this},batchDrawFrame:function(t,e,i,s,n,r){void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=1),void 0===r&&(r=16777215);var o=this.manager.getFrame(t,e);return o&&(this.renderTarget?this.pipeline.batchTextureFrame(o,i,s,r,n,this.camera.matrix,null):this.batchTextureFrame(o,i,s,n,r)),this},endDraw:function(t){if(void 0===t&&(t=this._eraseMode),this.isDrawing){var e=this.renderer,i=this.renderTarget;if(i){var s=e.endCapture();e.pipelines.setUtility().blitFrame(s,i,1,!1,!1,t,this.isSpriteTexture),e.resetScissor(),e.resetViewport()}else e.setContext();this.dirty=!0,this.isDrawing=!1}return this},batchList:function(t,e,i,s,n){var r=t.length;if(0!==r)for(var o=0;o0&&a.height>0&&o.drawImage(h,a.x,a.y,a.width,a.height,e,i,a.width,a.height),o.restore()}},snapshotArea:function(t,e,i,s,n,r,o){return this.renderTarget?this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer,this.width,this.height,n,!1,t,e,i,s,r,o):this.renderer.snapshotCanvas(this.canvas,n,!1,t,e,i,s,r,o),this},snapshot:function(t,e,i){return this.snapshotArea(0,0,this.width,this.height,t,e,i)},snapshotPixel:function(t,e,i){return this.snapshotArea(t,e,1,1,i,"pixel")},getWebGLTexture:function(){if(this.renderTarget)return this.renderTarget.texture},renderWebGL:function(t,e,i,s){var n=this.manager.resetStamp();n.setTexture(this),n.setOrigin(0),n.renderWebGL(t,n,i,s)},renderCanvas:function(){},destroy:function(){var t=this.manager.stamp;t&&t.texture===this&&this.manager.resetStamp(),d.prototype.destroy.call(this),r.remove(this.canvas),this.renderTarget&&this.renderTarget.destroy(),this.camera.destroy(),this.canvas=null,this.context=null,this.renderer=null}});t.exports=p},4327:(t,e,i)=>{var s=i(83419),n=i(45319),r=i(79291),o=new s({initialize:function(t,e,i,s,n,r,o){this.texture=t,this.name=e,this.source=t.source[i],this.sourceIndex=i,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0},is3Slice:!1,scale9:!1,scale9Borders:{x:0,y:0,w:0,h:0}},this.setSize(r,o,s,n)},setSize:function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=0),this.cutX=i,this.cutY=s,this.cutWidth=t,this.cutHeight=e,this.width=t,this.height=e,this.halfWidth=Math.floor(.5*t),this.halfHeight=Math.floor(.5*e),this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2);var n=this.data,r=n.cut;r.x=i,r.y=s,r.w=t,r.h=e,r.r=i+t,r.b=s+e,n.sourceSize.w=t,n.sourceSize.h=e,n.spriteSourceSize.w=t,n.spriteSourceSize.h=e,n.radius=.5*Math.sqrt(t*t+e*e);var o=n.drawImage;return o.x=i,o.y=s,o.width=t,o.height=e,this.updateUVs()},setTrim:function(t,e,i,s,n,r){var o=this.data,a=o.spriteSourceSize;return o.trim=!0,o.sourceSize.w=t,o.sourceSize.h=e,a.x=i,a.y=s,a.w=n,a.h=r,a.r=i+n,a.b=s+r,this.x=i,this.y=s,this.width=n,this.height=r,this.halfWidth=.5*n,this.halfHeight=.5*r,this.centerX=Math.floor(n/2),this.centerY=Math.floor(r/2),this.updateUVs()},setScale9:function(t,e,i,s){var n=this.data;return n.scale9=!0,n.is3Slice=0===e&&s===this.height,n.scale9Borders.x=t,n.scale9Borders.y=e,n.scale9Borders.w=i,n.scale9Borders.h=s,this},setCropUVs:function(t,e,i,s,r,o,a){var h=this.cutX,l=this.cutY,u=this.cutWidth,c=this.cutHeight,d=this.realWidth,f=this.realHeight,p=h+(e=n(e,0,d)),v=l+(i=n(i,0,f)),g=s=n(s,0,d-e),m=r=n(r,0,f-i),y=this.data;if(y.trim){var x=y.spriteSourceSize,T=e+(s=n(s,0,u-e)),w=i+(r=n(r,0,c-i));if(x.rT||x.y>w)p=0,v=0,g=0,m=0;else{var b=Math.max(x.x,e),S=Math.max(x.y,i),E=Math.min(x.r,T)-b,A=Math.min(x.b,w)-S;g=E,m=A,p=o?h+(u-(b-x.x)-E):h+(b-x.x),v=a?l+(c-(S-x.y)-A):l+(S-x.y),e=b,i=S,s=E,r=A}}else o&&(p=h+(u-e-s)),a&&(v=l+(c-i-r));var C=this.source.width,_=this.source.height;return t.u0=Math.max(0,p/C),t.v0=Math.max(0,v/_),t.u1=Math.min(1,(p+g)/C),t.v1=Math.min(1,(v+m)/_),t.x=e,t.y=i,t.cx=p,t.cy=v,t.cw=g,t.ch=m,t.width=s,t.height=r,t.flipX=o,t.flipY=a,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},setUVs:function(t,e,i,s,n,r){var o=this.data.drawImage;return o.width=t,o.height=e,this.u0=i,this.v0=s,this.u1=n,this.v1=r,this},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,s=this.cutHeight,n=this.data.drawImage;n.width=i,n.height=s;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+s)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new o(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=r(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.texture=null,this.source=null,this.customData=null,this.data=null},glTexture:{get:function(){return this.source.glTexture}},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},scale9:{get:function(){return this.data.scale9}},is3Slice:{get:function(){return this.data.is3Slice}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=o},79237:(t,e,i)=>{var s=i(83419),n=i(4327),r=i(11876),o='Texture "%s" has no frame "%s"',a=new s({initialize:function(t,e,i,s,n){Array.isArray(i)||(i=[i]),this.manager=t,this.key=e,this.source=[],this.dataSource=[],this.frames={},this.customData={},this.firstFrame="__BASE",this.frameTotal=0;for(var o=0;on&&(n=a.cutX+a.cutWidth),a.cutY+a.cutHeight>r&&(r=a.cutY+a.cutHeight)}return{x:i,y:s,width:n-i,height:r-s}},getFrameNames:function(t){void 0===t&&(t=!1);var e=Object.keys(this.frames);if(!t){var i=e.indexOf("__BASE");-1!==i&&e.splice(i,1)}return e},getSourceImage:function(t){null!=t&&1!==this.frameTotal||(t="__BASE");var e=this.frames[t];return e?e.source.image:(console.warn(o,this.key,t),this.frames.__BASE.source.image)},getDataSourceImage:function(t){null!=t&&1!==this.frameTotal||(t="__BASE");var e,i=this.frames[t];return i?e=i.sourceIndex:(console.warn(o,this.key,t),e=this.frames.__BASE.sourceIndex),this.dataSource[e].image},setDataSource:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e{var s=i(27919),n=i(57382),r=i(83419),o=i(40987),a=i(8054),h=i(81320),l=i(50792),u=i(69442),c=i(4327),d=i(8443),f=i(99584),p=i(35154),v=i(88571),g=i(41212),m=i(61309),y=i(87841),x=i(79237),T=new r({Extends:l,initialize:function(t){l.call(this),this.game=t,this.name="TextureManager",this.list={},this._tempCanvas=s.create2D(this),this._tempContext=this._tempCanvas.getContext("2d",{willReadFrequently:!0}),this._pending=0,this.stamp,this.stampCrop=new y,this.silentWarnings=!1,t.events.once(d.BOOT,this.boot,this)},boot:function(){this._pending=3,this.on(u.LOAD,this.updatePending,this),this.on(u.ERROR,this.updatePending,this);var t=this.game.config;this.addBase64("__DEFAULT",t.defaultImage),this.addBase64("__MISSING",t.missingImage),this.addBase64("__WHITE",t.whiteImage),this.game.renderer&&this.game.renderer.gl&&this.addUint8Array("__NORMAL",new Uint8Array([127,127,255,255]),1,1),this.game.events.once(d.DESTROY,this.destroy,this),this.game.events.once(d.SYSTEM_READY,(function(t){this.stamp=new v(t).setOrigin(0)}),this)},updatePending:function(){this._pending--,0===this._pending&&(this.off(u.LOAD),this.off(u.ERROR),this.emit(u.READY))},checkKey:function(t){return!this.exists(t)||(this.silentWarnings||console.error("Texture key already in use: "+t),!1)},remove:function(t){if("string"==typeof t){if(!this.exists(t))return this.silentWarnings||console.warn("No texture found matching key: "+t),this;t=this.get(t)}var e=t.key;return this.list.hasOwnProperty(e)&&(t.destroy(),this.emit(u.REMOVE,e),this.emit(u.REMOVE_KEY+e)),this},removeKey:function(t){return this.list.hasOwnProperty(t)&&delete this.list[t],this},addBase64:function(t,e){if(this.checkKey(t)){var i=this,s=new Image;s.onerror=function(){i.emit(u.ERROR,t)},s.onload=function(){var e=i.create(t,s);m.Image(e,0),i.emit(u.ADD,t,e),i.emit(u.ADD_KEY+t,e),i.emit(u.LOAD,t,e)},s.src=e}return this},getBase64:function(t,e,i,n){void 0===i&&(i="image/png"),void 0===n&&(n=.92);var r="",o=this.getFrame(t,e);if(o&&(o.source.isRenderTexture||o.source.isGLTexture))this.silentWarnings||console.warn("Cannot getBase64 from WebGL Texture");else if(o){var a=o.canvasData,h=s.create2D(this,a.width,a.height),l=h.getContext("2d",{willReadFrequently:!0});a.width>0&&a.height>0&&l.drawImage(o.source.image,a.x,a.y,a.width,a.height,0,0,a.width,a.height),r=h.toDataURL(i,n),s.remove(h)}return r},addImage:function(t,e,i){var s=null;return this.checkKey(t)&&(s=this.create(t,e),m.Image(s,0),i&&s.setDataSource(i),this.emit(u.ADD,t,s),this.emit(u.ADD_KEY+t,s)),s},addGLTexture:function(t,e){var i=null;if(this.checkKey(t)){var s=e.width,n=e.height;(i=this.create(t,e,s,n)).add("__BASE",0,0,0,s,n),this.emit(u.ADD,t,i),this.emit(u.ADD_KEY+t,i)}return i},addCompressedTexture:function(t,e,i){var s=null;if(this.checkKey(t)){if((s=this.create(t,e)).add("__BASE",0,0,0,e.width,e.height),i){var n=function(t,e,i){Array.isArray(i.textures)||Array.isArray(i.frames)?m.JSONArray(t,e,i):m.JSONHash(t,e,i)};if(Array.isArray(i))for(var r=0;r=r.x&&t=r.y&&e=r.x&&t=r.y&&e{var s=i(27919),n=i(83419),r=i(50030),o=i(29795),a=i(82751),h=new n({initialize:function(t,e,i,s,n){void 0===n&&(n=!1);var h=t.manager.game;this.renderer=h.renderer,this.texture=t,this.source=e,this.image=e.compressed?null:e,this.compressionAlgorithm=e.compressed?e.format:null,this.resolution=1,this.width=i||e.naturalWidth||e.videoWidth||e.width||0,this.height=s||e.naturalHeight||e.videoHeight||e.height||0,this.scaleMode=o.DEFAULT,this.isCanvas=e instanceof HTMLCanvasElement,this.isVideo=window.hasOwnProperty("HTMLVideoElement")&&e instanceof HTMLVideoElement,this.isRenderTexture="RenderTexture"===e.type||"DynamicTexture"===e.type,this.isGLTexture=e instanceof a,this.isPowerOf2=r(this.width,this.height),this.glTexture=null,this.flipY=n,this.init(h)},init:function(t){var e=this.renderer;if(e){var i=this.source;if(e.gl){var s=this.image,n=this.flipY,r=this.width,o=this.height,a=this.scaleMode;this.isCanvas?this.glTexture=e.createCanvasTexture(s,!1,n):this.isVideo?this.glTexture=e.createVideoTexture(s,!1,n):this.isRenderTexture?this.glTexture=e.createTextureFromSource(null,r,o,a):this.isGLTexture?this.glTexture=i:this.compressionAlgorithm?this.glTexture=e.createTextureFromSource(i,void 0,void 0,a):i instanceof Uint8Array?this.glTexture=e.createUint8ArrayTexture(i,r,o,a):this.glTexture=e.createTextureFromSource(s,r,o,a)}else this.isRenderTexture&&(this.image=i.canvas)}t.config.antialias||this.setFilter(1)},setFilter:function(t){this.renderer&&this.renderer.gl&&this.renderer.setTextureFilter(this.glTexture,t),this.scaleMode=t},setFlipY:function(t){return void 0===t&&(t=!0),t===this.flipY||(this.flipY=t,this.update()),this},update:function(){var t=this.renderer,e=this.image,i=this.flipY,s=t.gl;s&&this.isCanvas?t.updateCanvasTexture(e,this.glTexture,i):s&&this.isVideo&&t.updateVideoTexture(e,this.glTexture,i)},destroy:function(){this.glTexture&&this.renderer.deleteTexture(this.glTexture),this.isCanvas&&s.remove(this.image),this.renderer=null,this.texture=null,this.source=null,this.image=null,this.glTexture=null}});t.exports=h},19673:t=>{t.exports={LINEAR:0,NEAREST:1}},44538:t=>{t.exports="addtexture"},63486:t=>{t.exports="addtexture-"},94851:t=>{t.exports="onerror"},29099:t=>{t.exports="onload"},8678:t=>{t.exports="ready"},86415:t=>{t.exports="removetexture"},30879:t=>{t.exports="removetexture-"},69442:(t,e,i)=>{t.exports={ADD:i(44538),ADD_KEY:i(63486),ERROR:i(94851),LOAD:i(29099),READY:i(8678),REMOVE:i(86415),REMOVE_KEY:i(30879)}},27458:(t,e,i)=>{var s=i(79291),n=i(19673),r={CanvasTexture:i(57382),DynamicTexture:i(81320),Events:i(69442),FilterMode:n,Frame:i(4327),Parsers:i(61309),Texture:i(79237),TextureManager:i(17130),TextureSource:i(11876)};r=s(!1,r,n),t.exports=r},89905:t=>{t.exports=function(t,e,i){if(i.getElementsByTagName("TextureAtlas")){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);for(var n,r=i.getElementsByTagName("SubTexture"),o=0;o{t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},4832:t=>{t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},78566:(t,e,i)=>{var s=i(41786);t.exports=function(t,e,i){if(i.frames||i.textures){var n=t.source[e];t.add("__BASE",e,0,0,n.width,n.height);for(var r,o=Array.isArray(i.textures)?i.textures[e].frames:i.frames,a=0;a{var s=i(41786);t.exports=function(t,e,i){if(i.frames){var n=t.source[e];t.add("__BASE",e,0,0,n.width,n.height);var r,o=i.frames;for(var a in o)if(o.hasOwnProperty(a)){var h=o[a];if(r=t.add(a,e,h.frame.x,h.frame.y,h.frame.w,h.frame.h)){h.trimmed&&r.setTrim(h.sourceSize.w,h.sourceSize.h,h.spriteSourceSize.x,h.spriteSourceSize.y,h.spriteSourceSize.w,h.spriteSourceSize.h),h.rotated&&(r.rotated=!0,r.updateUVsInverted());var l=h.anchor||h.pivot;l&&(r.customPivot=!0,r.pivotX=l.x,r.pivotY=l.y),h.scale9Borders&&r.setScale9(h.scale9Borders.x,h.scale9Borders.y,h.scale9Borders.w,h.scale9Borders.h),r.customData=s(h)}else console.warn("Invalid atlas json, frame already exists: "+a)}for(var u in i)"frames"!==u&&(Array.isArray(i[u])?t.customData[u]=i[u].slice(0):t.customData[u]=i[u]);return t}console.warn("Invalid Texture Atlas JSON Hash given, missing 'frames' Object")}},31403:t=>{t.exports=function(t){var e,i=[171,75,84,88,32,49,49,187,13,10,26,10],s=new Uint8Array(t,0,12);for(e=0;e>1),v=Math.max(1,v>>1),f+=g}return{mipmaps:d,width:h,height:l,internalFormat:a,compressed:!0,generateMipmap:!1}}console.warn("KTXParser - Only compressed formats supported")}},82038:t=>{function e(t,e,i,s,n,r,o){return void 0===o&&(o=16),Math.floor((t+i)/n)*Math.floor((e+s)/r)*o}function i(t,e){return(t=Math.max(t,16))*(e=Math.max(e,8))/4}function s(t,e){return(t=Math.max(t,8))*(e=Math.max(e,8))/2}function n(t,e){return Math.ceil(t/4)*Math.ceil(e/4)*16}function r(t,i){return e(t,i,3,3,4,4,8)}function o(t,i){return e(t,i,3,3,4,4)}var a={0:{sizeFunc:i,glFormat:[35841]},1:{sizeFunc:i,glFormat:[35843]},2:{sizeFunc:s,glFormat:[35840]},3:{sizeFunc:s,glFormat:[35842]},6:{sizeFunc:r,glFormat:[36196]},7:{sizeFunc:r,glFormat:[33776,35916]},8:{sizeFunc:o,glFormat:[33777,35917]},9:{sizeFunc:o,glFormat:[33778,35918]},11:{sizeFunc:o,glFormat:[33779,35919]},14:{sizeFunc:n,glFormat:[36494,36495]},15:{sizeFunc:n,glFormat:[36492,36493]},22:{sizeFunc:r,glFormat:[37492,37493]},23:{sizeFunc:o,glFormat:[37496,37497]},24:{sizeFunc:r,glFormat:[37494,37495]},25:{sizeFunc:r,glFormat:[37488]},26:{sizeFunc:o,glFormat:[37490]},27:{sizeFunc:o,glFormat:[37808,37840]},28:{sizeFunc:function(t,i){return e(t,i,4,3,5,4)},glFormat:[37809,37841]},29:{sizeFunc:function(t,i){return e(t,i,4,4,5,5)},glFormat:[37810,37842]},30:{sizeFunc:function(t,i){return e(t,i,5,4,6,5)},glFormat:[37811,37843]},31:{sizeFunc:function(t,i){return e(t,i,5,5,6,6)},glFormat:[37812,37844]},32:{sizeFunc:function(t,i){return e(t,i,7,4,8,5)},glFormat:[37813,37845]},33:{sizeFunc:function(t,i){return e(t,i,7,5,8,6)},glFormat:[37814,37846]},34:{sizeFunc:function(t,i){return e(t,i,7,7,8,8)},glFormat:[37815,37847]},35:{sizeFunc:function(t,i){return e(t,i,9,4,10,5)},glFormat:[37816,37848]},36:{sizeFunc:function(t,i){return e(t,i,9,5,10,6)},glFormat:[37817,37849]},37:{sizeFunc:function(t,i){return e(t,i,9,7,10,8)},glFormat:[37818,37850]},38:{sizeFunc:function(t,i){return e(t,i,9,9,10,10)},glFormat:[37819,37851]},39:{sizeFunc:function(t,i){return e(t,i,11,9,12,10)},glFormat:[37820,37852]},40:{sizeFunc:function(t,i){return e(t,i,11,11,12,12)},glFormat:[37821,37853]}};t.exports=function(t){for(var e=new Uint32Array(t,0,13),i=55727696===e[0]?e[2]:e[3],s=e[4],n=a[i].glFormat[s],r=a[i].sizeFunc,o=e[11],h=e[7],l=e[6],u=52+e[12],c=new Uint8Array(t,u),d=new Array(o),f=0,p=h,v=l,g=0;g>1),v=Math.max(1,v>>1),f+=m}return{mipmaps:d,width:h,height:l,internalFormat:n,compressed:!0,generateMipmap:!1}}},75549:(t,e,i)=>{var s=i(95540);t.exports=function(t,e,i,n,r,o,a){var h=s(a,"frameWidth",null),l=s(a,"frameHeight",h);if(null===h)throw new Error("TextureManager.SpriteSheet: Invalid frameWidth given.");var u=t.source[e];t.add("__BASE",e,0,0,u.width,u.height);var c=s(a,"startFrame",0),d=s(a,"endFrame",-1),f=s(a,"margin",0),p=s(a,"spacing",0),v=Math.floor((r-f+p)/(h+p))*Math.floor((o-f+p)/(l+p));0===v&&console.warn("SpriteSheet frame dimensions will result in zero frames for texture:",t.key),(c>v||c<-v)&&(c=0),c<0&&(c=v+c),(-1===d||d>v||dr&&(y=b-r),S>o&&(x=S-o),w>=c&&w<=d&&(t.add(T,e,i+g,n+m,h-y,l-x),T++),(g+=h+p)+h>r&&(g=f,m+=l+p)}return t}},47534:(t,e,i)=>{var s=i(95540);t.exports=function(t,e,i){var n=s(i,"frameWidth",null),r=s(i,"frameHeight",n);if(!n)throw new Error("TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.");var o=t.source[0];t.add("__BASE",0,0,0,o.width,o.height),s(i,"startFrame",0),s(i,"endFrame",-1);for(var a,h=s(i,"margin",0),l=s(i,"spacing",0),u=e.cutX,c=e.cutY,d=e.cutWidth,f=e.cutHeight,p=e.realWidth,v=e.realHeight,g=Math.floor((p-h+l)/(n+l)),m=Math.floor((v-h+l)/(r+l)),y=e.x,x=n-y,T=n-(p-d-y),w=e.y,b=r-w,S=r-(v-f-w),E=h,A=h,C=0,_=0;_{var e=0,i=function(t,i,s,n){var r=e-n.y-n.height;t.add(s,i,n.x,r,n.width,n.height)};t.exports=function(t,s,n){var r=t.source[s];t.add("__BASE",s,0,0,r.width,r.height),e=r.height;for(var o=n.split("\n"),a=/^[ ]*(- )*(\w+)+[: ]+(.*)/,h="",l="",u={x:0,y:0,width:0,height:0},c=0;c{var s=i(50030);function n(t){for(var e=t.mipmaps,i=0;i{t.exports={AtlasXML:i(89905),Canvas:i(72893),Image:i(4832),JSONArray:i(78566),JSONHash:i(39711),KTXParser:i(31403),PVRParser:i(82038),SpriteSheet:i(75549),SpriteSheetFromAtlas:i(47534),UnityYAML:i(86147)}},80341:t=>{t.exports={CSV:0,TILED_JSON:1,ARRAY_2D:2,WELTMEISTER:3}},16536:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s,n,r,o){(void 0===i||i<=0)&&(i=32),(void 0===s||s<=0)&&(s=32),void 0===n&&(n=0),void 0===r&&(r=0),this.name=t,this.firstgid=0|e,this.imageWidth=0|i,this.imageHeight=0|s,this.imageMargin=0|n,this.imageSpacing=0|r,this.properties=o||{},this.images=[],this.total=0},containsImageIndex:function(t){return t>=this.firstgid&&t{var s=new(i(83419))({initialize:function(t){if(this.gids=[],void 0!==t)for(var e=0;e{var s=i(80341),n=i(87010),r=i(46177),o=i(49075);t.exports=function(t,e,i,a,h,l,u,c){void 0===i&&(i=32),void 0===a&&(a=32),void 0===h&&(h=10),void 0===l&&(l=10),void 0===c&&(c=!1);var d=null;if(Array.isArray(u))d=r(void 0!==e?e:"map",s.ARRAY_2D,u,i,a,c);else if(void 0!==e){var f=t.cache.tilemap.get(e);f?d=r(e,f.format,f.data,i,a,c):console.warn("No map data found for key "+e)}return null===d&&(d=new n({tileWidth:i,tileHeight:a,width:h,height:l})),new o(t,d)}},23029:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(91907),o=i(62644),a=i(93232),h=new s({Mixins:[n.AlphaSingle,n.Flip,n.Visible],initialize:function(t,e,i,s,n,r,o,a){this.layer=t,this.index=e,this.x=i,this.y=s,this.width=n,this.height=r,this.right,this.bottom,this.baseWidth=void 0!==o?o:n,this.baseHeight=void 0!==a?a:r,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=void 0,this.collisionCallbackContext=this,this.tint=16777215,this.tintFill=!1,this.physics={}},containsPoint:function(t,e){return!(tthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=o(t.properties),this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldXY(this.x,this.y,void 0,t).x:this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldXY(this.x,this.y,void 0,t).y:this.y*this.baseWidth-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new a),e.x=this.getLeft(t),e.y=this.getTop(t),e.width=this.getRight(t)-e.x,e.height=this.getBottom(t)-e.y,e},getCenterX:function(t){return(this.getLeft(t)+this.getRight(t))/2},getCenterY:function(t){return(this.getTop(t)+this.getBottom(t))/2},intersects:function(t,e,i,s){return!(i<=this.pixelX||s<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){return void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,s,n){return void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=t),void 0===n&&(n=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=s,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=s,n&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,s){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==s&&(this.baseHeight=s),this.updatePixelXY(),this},updatePixelXY:function(){var t=this.layer.orientation;if(t===r.ORTHOGONAL)this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight;else if(t===r.ISOMETRIC)this.pixelX=(this.x-this.y)*this.baseWidth*.5,this.pixelY=(this.x+this.y)*this.baseHeight*.5;else if(t===r.STAGGERED)this.pixelX=this.x*this.baseWidth+this.y%2*(this.baseWidth/2),this.pixelY=this.y*(this.baseHeight/2);else if(t===r.HEXAGONAL){var e,i,s=this.layer.staggerAxis,n=this.layer.staggerIndex,o=this.layer.hexSideLength;"y"===s?(i=(this.baseHeight-o)/2+o,this.pixelX="odd"===n?this.x*this.baseWidth+this.y%2*(this.baseWidth/2):this.x*this.baseWidth-this.y%2*(this.baseWidth/2),this.pixelY=this.y*i):"x"===s&&(e=(this.baseWidth-o)/2+o,this.pixelX=this.x*e,this.pixelY="odd"===n?this.y*this.baseHeight+this.x%2*(this.baseHeight/2):this.y*this.baseHeight-this.x%2*(this.baseHeight/2))}return this.right=this.pixelX+this.baseWidth,this.bottom=this.pixelY+this.baseHeight,this},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||void 0!==this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.layer.tilemapLayer;if(t){var e=t.gidMap[this.index];if(e)return e}return null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=h},49075:(t,e,i)=>{var s=i(84101),n=i(83419),r=i(39506),o=i(80341),a=i(95540),h=i(14977),l=i(27462),u=i(91907),c=i(36305),d=i(19133),f=i(68287),p=i(23029),v=i(81086),g=i(20442),m=i(33629),y=new n({initialize:function(t,e){this.scene=t,this.tileWidth=e.tileWidth,this.tileHeight=e.tileHeight,this.width=e.width,this.height=e.height,this.orientation=e.orientation,this.renderOrder=e.renderOrder,this.format=e.format,this.version=e.version,this.properties=e.properties,this.widthInPixels=e.widthInPixels,this.heightInPixels=e.heightInPixels,this.imageCollections=e.imageCollections,this.images=e.images,this.layers=e.layers,this.tiles=e.tiles,this.tilesets=e.tilesets,this.objects=e.objects,this.currentLayerIndex=0,this.hexSideLength=e.hexSideLength;var i=this.orientation;this._convert={WorldToTileXY:v.GetWorldToTileXYFunction(i),WorldToTileX:v.GetWorldToTileXFunction(i),WorldToTileY:v.GetWorldToTileYFunction(i),TileToWorldXY:v.GetTileToWorldXYFunction(i),TileToWorldX:v.GetTileToWorldXFunction(i),TileToWorldY:v.GetTileToWorldYFunction(i),GetTileCorners:v.GetTileCornersFunction(i)}},setRenderOrder:function(t){var e=["right-down","left-down","right-up","left-up"];return"number"==typeof t&&(t=e[t]),e.indexOf(t)>-1&&(this.renderOrder=t),this},addTilesetImage:function(t,e,i,n,r,a,h,l){if(void 0===t)return null;null==e&&(e=t);var u=this.scene.sys.textures;if(!u.exists(e))return console.warn('Texture key "%s" not found',e),null;var c=u.get(e),d=this.getTilesetIndex(t);if(null===d&&this.format===o.TILED_JSON)return console.warn('Tilemap has no tileset "%s". Its tilesets are %o',t,this.tilesets),null;var f=this.tilesets[d];return f?(f.setTileSize(i,n),f.setSpacing(r,a),f.setImage(c),f):(void 0===i&&(i=this.tileWidth),void 0===n&&(n=this.tileHeight),void 0===r&&(r=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===l&&(l={x:0,y:0}),(f=new m(t,h,i,n,r,a,void 0,void 0,l)).setImage(c),this.tilesets.push(f),this.tiles=s(this),f)},copy:function(t,e,i,s,n,r,o,a){return null!==(a=this.getLayer(a))?(v.Copy(t,e,i,s,n,r,o,a),this):null},createBlankLayer:function(t,e,i,s,n,r,o,a){if(void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=this.width),void 0===r&&(r=this.height),void 0===o&&(o=this.tileWidth),void 0===a&&(a=this.tileHeight),null!==this.getLayerIndex(t))return console.warn("Invalid Tilemap Layer ID: "+t),null;for(var l,u=new h({name:t,tileWidth:o,tileHeight:a,width:n,height:r,orientation:this.orientation}),c=0;c-1&&this.putTileAt(e,r.x,r.y,i,r.tilemapLayer)}return s},removeTileAt:function(t,e,i,s,n){return void 0===i&&(i=!0),void 0===s&&(s=!0),null===(n=this.getLayer(n))?null:v.RemoveTileAt(t,e,i,s,n)},removeTileAtWorldXY:function(t,e,i,s,n,r){return void 0===i&&(i=!0),void 0===s&&(s=!0),null===(r=this.getLayer(r))?null:v.RemoveTileAtWorldXY(t,e,i,s,n,r)},renderDebug:function(t,e,i){return null===(i=this.getLayer(i))?null:(this.orientation===u.ORTHOGONAL&&v.RenderDebug(t,e,i),this)},renderDebugFull:function(t,e){for(var i=this.layers,s=0;s{var s=i(44603),n=i(31989);s.register("tilemap",(function(t){var e=void 0!==t?t:{};return n(this.scene,e.key,e.tileWidth,e.tileHeight,e.width,e.height,e.data,e.insertNull)}))},46029:(t,e,i)=>{var s=i(39429),n=i(31989);s.register("tilemap",(function(t,e,i,s,r,o,a){return null===t&&(t=void 0),null===e&&(e=void 0),null===i&&(i=void 0),null===s&&(s=void 0),null===r&&(r=void 0),n(this.scene,t,e,i,s,r,o,a)}))},20442:(t,e,i)=>{var s=i(83419),n=i(78389),r=i(31401),o=i(95643),a=i(81086),h=i(19218),l=i(26099),u=new s({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.ComputedSize,r.Depth,r.Flip,r.GetBounds,r.Mask,r.Origin,r.Pipeline,r.PostPipeline,r.Transform,r.Visible,r.ScrollFactor,n,h],initialize:function(t,e,i,s,n,r){o.call(this,t,"TilemapLayer"),this.isTilemap=!0,this.tilemap=e,this.layerIndex=i,this.layer=e.layers[i],this.layer.tilemapLayer=this,this.tileset=[],this.tilesDrawn=0,this.tilesTotal=this.layer.width*this.layer.height,this.culledTiles=[],this.skipCull=!1,this.cullPaddingX=1,this.cullPaddingY=1,this.cullCallback=a.GetCullTilesFunction(this.layer.orientation),this._renderOrder=0,this.gidMap=[],this.tempVec=new l,this.collisionCategory=1,this.collisionMask=1,this.setTilesets(s),this.setAlpha(this.layer.alpha),this.setPosition(n,r),this.setOrigin(0,0),this.setSize(e.tileWidth*this.layer.width,e.tileHeight*this.layer.height),this.initPipeline(),this.initPostPipeline(!1)},setTilesets:function(t){var e=[],i=[],s=this.tilemap;Array.isArray(t)||(t=[t]);for(var n=0;n=0&&t<4&&(this._renderOrder=t),this},calculateFacesAt:function(t,e){return a.CalculateFacesAt(t,e,this.layer),this},calculateFacesWithin:function(t,e,i,s){return a.CalculateFacesWithin(t,e,i,s,this.layer),this},createFromTiles:function(t,e,i,s,n){return a.CreateFromTiles(t,e,i,s,n,this.layer)},cull:function(t){return this.cullCallback(this.layer,t,this.culledTiles,this._renderOrder)},copy:function(t,e,i,s,n,r,o){return a.Copy(t,e,i,s,n,r,o,this.layer),this},fill:function(t,e,i,s,n,r){return a.Fill(t,e,i,s,n,r,this.layer),this},filterTiles:function(t,e,i,s,n,r,o){return a.FilterTiles(t,e,i,s,n,r,o,this.layer)},findByIndex:function(t,e,i){return a.FindByIndex(t,e,i,this.layer)},findTile:function(t,e,i,s,n,r,o){return a.FindTile(t,e,i,s,n,r,o,this.layer)},forEachTile:function(t,e,i,s,n,r,o){return a.ForEachTile(t,e,i,s,n,r,o,this.layer),this},setTint:function(t,e,i,s,n,r){return void 0===t&&(t=16777215),this.forEachTile((function(e){e.tint=t,e.tintFill=!1}),this,e,i,s,n,r)},setTintFill:function(t,e,i,s,n,r){return void 0===t&&(t=16777215),this.forEachTile((function(e){e.tint=t,e.tintFill=!0}),this,e,i,s,n,r)},getTileAt:function(t,e,i){return a.GetTileAt(t,e,i,this.layer)},getTileAtWorldXY:function(t,e,i,s){return a.GetTileAtWorldXY(t,e,i,s,this.layer)},getIsoTileAtWorldXY:function(t,e,i,s,n){void 0===i&&(i=!0);var r=this.tempVec;return a.IsometricWorldToTileXY(t,e,!0,r,n,this.layer,i),this.getTileAt(r.x,r.y,s)},getTilesWithin:function(t,e,i,s,n){return a.GetTilesWithin(t,e,i,s,n,this.layer)},getTilesWithinShape:function(t,e,i){return a.GetTilesWithinShape(t,e,i,this.layer)},getTilesWithinWorldXY:function(t,e,i,s,n,r){return a.GetTilesWithinWorldXY(t,e,i,s,n,r,this.layer)},hasTileAt:function(t,e){return a.HasTileAt(t,e,this.layer)},hasTileAtWorldXY:function(t,e,i){return a.HasTileAtWorldXY(t,e,i,this.layer)},putTileAt:function(t,e,i,s){return a.PutTileAt(t,e,i,s,this.layer)},putTileAtWorldXY:function(t,e,i,s,n){return a.PutTileAtWorldXY(t,e,i,s,n,this.layer)},putTilesAt:function(t,e,i,s){return a.PutTilesAt(t,e,i,s,this.layer),this},randomize:function(t,e,i,s,n){return a.Randomize(t,e,i,s,n,this.layer),this},removeTileAt:function(t,e,i,s){return a.RemoveTileAt(t,e,i,s,this.layer)},removeTileAtWorldXY:function(t,e,i,s,n){return a.RemoveTileAtWorldXY(t,e,i,s,n,this.layer)},renderDebug:function(t,e){return a.RenderDebug(t,e,this.layer),this},replaceByIndex:function(t,e,i,s,n,r){return a.ReplaceByIndex(t,e,i,s,n,r,this.layer),this},setSkipCull:function(t){return void 0===t&&(t=!0),this.skipCull=t,this},setCullPadding:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.cullPaddingX=t,this.cullPaddingY=e,this},setCollision:function(t,e,i,s){return a.SetCollision(t,e,i,this.layer,s),this},setCollisionBetween:function(t,e,i,s){return a.SetCollisionBetween(t,e,i,s,this.layer),this},setCollisionByProperty:function(t,e,i){return a.SetCollisionByProperty(t,e,i,this.layer),this},setCollisionByExclusion:function(t,e,i){return a.SetCollisionByExclusion(t,e,i,this.layer),this},setCollisionFromCollisionGroup:function(t,e){return a.SetCollisionFromCollisionGroup(t,e,this.layer),this},setTileIndexCallback:function(t,e,i){return a.SetTileIndexCallback(t,e,i,this.layer),this},setTileLocationCallback:function(t,e,i,s,n,r){return a.SetTileLocationCallback(t,e,i,s,n,r,this.layer),this},shuffle:function(t,e,i,s){return a.Shuffle(t,e,i,s,this.layer),this},swapByIndex:function(t,e,i,s,n,r){return a.SwapByIndex(t,e,i,s,n,r,this.layer),this},tileToWorldX:function(t,e){return this.tilemap.tileToWorldX(t,e,this)},tileToWorldY:function(t,e){return this.tilemap.tileToWorldY(t,e,this)},tileToWorldXY:function(t,e,i,s){return this.tilemap.tileToWorldXY(t,e,i,s,this)},getTileCorners:function(t,e,i){return this.tilemap.getTileCorners(t,e,i,this)},weightedRandomize:function(t,e,i,s,n){return a.WeightedRandomize(e,i,s,n,t,this.layer),this},worldToTileX:function(t,e,i){return this.tilemap.worldToTileX(t,e,i,this)},worldToTileY:function(t,e,i){return this.tilemap.worldToTileY(t,e,i,this)},worldToTileXY:function(t,e,i,s,n){return this.tilemap.worldToTileXY(t,e,i,s,n,this)},destroy:function(t){void 0===t&&(t=!0),this.tilemap&&(this.layer.tilemapLayer===this&&(this.layer.tilemapLayer=void 0),t&&this.tilemap.removeLayer(this),this.tilemap=void 0,this.layer=void 0,this.culledTiles.length=0,this.cullCallback=null,this.gidMap=[],this.tileset=[],o.prototype.destroy.call(this))}});t.exports=u},16153:(t,e,i)=>{var s=i(61340),n=new s,r=new s,o=new s;t.exports=function(t,e,i,s){var a=e.cull(i),h=a.length,l=i.alpha*e.alpha;if(!(0===h||l<=0)){var u=n,c=r,d=o;c.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),u.copyFrom(i.matrix);var f=t.currentContext,p=e.gidMap;f.save(),s?(u.multiplyWithOffset(s,-i.scrollX*e.scrollFactorX,-i.scrollY*e.scrollFactorY),c.e=e.x,c.f=e.y,u.multiply(c,d),d.copyToContext(f)):(c.e-=i.scrollX*e.scrollFactorX,c.f-=i.scrollY*e.scrollFactorY,c.copyToContext(f)),(!t.antialias||e.scaleX>1||e.scaleY>1)&&(f.imageSmoothingEnabled=!1);for(var v=0;v{var s,n;i(29747),s=i(99558),n=i(16153),t.exports={renderWebGL:s,renderCanvas:n}},99558:(t,e,i)=>{var s=i(70554);t.exports=function(t,e,i){var n=e.cull(i),r=n.length,o=i.alpha*e.alpha;if(!(0===r||o<=0)){var a=e.gidMap,h=t.pipelines.set(e.pipeline,e),l=s.getTintAppendFloatAlpha,u=e.scrollFactorX,c=e.scrollFactorY,d=e.x,f=e.y,p=e.scaleX,v=e.scaleY;t.pipelines.preBatch(e);for(var g=0;g{var s=i(83419),n=i(26099),r=new s({initialize:function(t,e,i,s,r,o,a,h,l){(void 0===i||i<=0)&&(i=32),(void 0===s||s<=0)&&(s=32),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a={}),void 0===h&&(h={}),this.name=t,this.firstgid=e,this.tileWidth=i,this.tileHeight=s,this.tileMargin=r,this.tileSpacing=o,this.tileProperties=a,this.tileData=h,this.tileOffset=new n,void 0!==l&&this.tileOffset.set(l.x,l.y),this.image=null,this.glTexture=null,this.rows=0,this.columns=0,this.total=0,this.texCoordinates=[]},getTileProperties:function(t){return this.containsTileIndex(t)?this.tileProperties[t-this.firstgid]:null},getTileData:function(t){return this.containsTileIndex(t)?this.tileData[t-this.firstgid]:null},getTileCollisionGroup:function(t){var e=this.getTileData(t);return e&&e.objectgroup?e.objectgroup:null},containsTileIndex:function(t){return t>=this.firstgid&&ti.width||e.height>i.height?this.updateTileData(e.width,e.height):this.updateTileData(i.width,i.height,i.x,i.y),this},setTileSize:function(t,e){return void 0!==t&&(this.tileWidth=t),void 0!==e&&(this.tileHeight=e),this.image&&this.updateTileData(this.image.source[0].width,this.image.source[0].height),this},setSpacing:function(t,e){return void 0!==t&&(this.tileMargin=t),void 0!==e&&(this.tileSpacing=e),this.image&&this.updateTileData(this.image.source[0].width,this.image.source[0].height),this},updateTileData:function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=0);var n=(e-2*this.tileMargin+this.tileSpacing)/(this.tileHeight+this.tileSpacing),r=(t-2*this.tileMargin+this.tileSpacing)/(this.tileWidth+this.tileSpacing);n%1==0&&r%1==0||console.warn("Image tile area not tile size multiple in: "+this.name),n=Math.floor(n),r=Math.floor(r),this.rows=n,this.columns=r,this.total=n*r,this.texCoordinates.length=0;for(var o=this.tileMargin+i,a=this.tileMargin+s,h=0;h{var s=i(7423);t.exports=function(t,e,i){var n=s(t,e,!0,i),r=s(t,e-1,!0,i),o=s(t,e+1,!0,i),a=s(t-1,e,!0,i),h=s(t+1,e,!0,i),l=n&&n.collides;return l&&(n.faceTop=!0,n.faceBottom=!0,n.faceLeft=!0,n.faceRight=!0),r&&r.collides&&(l&&(n.faceTop=!1),r.faceBottom=!l),o&&o.collides&&(l&&(n.faceBottom=!1),o.faceTop=!l),a&&a.collides&&(l&&(n.faceLeft=!1),a.faceRight=!l),h&&h.collides&&(l&&(n.faceRight=!1),h.faceLeft=!l),n&&!n.collides&&n.resetFaces(),n}},42573:(t,e,i)=>{var s=i(7423),n=i(7386);t.exports=function(t,e,i,r,o){for(var a=null,h=null,l=null,u=null,c=n(t,e,i,r,null,o),d=0;d{var s=new(i(26099));t.exports=function(t,e,i,n){var r=i.tilemapLayer,o=r.cullPaddingX,a=r.cullPaddingY,h=r.tilemap.tileToWorldXY(t,e,s,n,r);return h.x>n.worldView.x+r.scaleX*i.tileWidth*(-o-.5)&&h.xn.worldView.y+r.scaleY*i.tileHeight*(-a-1)&&h.y{var s=i(42573),n=i(7386),r=i(62991),o=i(23029);t.exports=function(t,e,i,a,h,l,u,c){void 0===u&&(u=!0);var d=n(t,e,i,a,null,c),f=[];d.forEach((function(t){var e=new o(t.layer,t.index,t.x,t.y,t.width,t.height,t.baseWidth,t.baseHeight);e.copy(t),f.push(e)}));for(var p=h-t,v=l-e,g=0;g{var s=i(62644),n=i(7386),r=i(27987);t.exports=function(t,e,i,o,a,h){i||(i={}),Array.isArray(t)||(t=[t]);var l=h.tilemapLayer;o||(o=l.scene),a||(a=o.cameras.main);var u,c=h.width,d=h.height,f=n(0,0,c,d,null,h),p=[],v=function(t,e,i){for(var s=0;s{var s=i(87841),n=i(63448),r=i(56583),o=new s;t.exports=function(t,e){var i=t.tilemapLayer.tilemap,s=t.tilemapLayer,a=Math.floor(i.tileWidth*s.scaleX),h=Math.floor(i.tileHeight*s.scaleY),l=r(e.worldView.x-s.x,a,0,!0)-s.cullPaddingX,u=n(e.worldView.right-s.x,a,0,!0)+s.cullPaddingX,c=r(e.worldView.y-s.y,h,0,!0)-s.cullPaddingY,d=n(e.worldView.bottom-s.y,h,0,!0)+s.cullPaddingY;return o.setTo(l,c,u-l,d-c)}},30003:(t,e,i)=>{var s=i(19545),n=i(32483);t.exports=function(t,e,i,r){void 0===i&&(i=[]),void 0===r&&(r=0),i.length=0;var o=t.tilemapLayer,a=s(t,e);return(o.skipCull||1!==o.scrollFactorX||1!==o.scrollFactorY)&&(a.left=0,a.right=t.width,a.top=0,a.bottom=t.height),n(t,a,r,i),i}},35137:(t,e,i)=>{var s=i(7386),n=i(42573),r=i(20576);t.exports=function(t,e,i,o,a,h,l){for(var u=-1!==l.collideIndexes.indexOf(t),c=s(e,i,o,a,null,l),d=0;d{var s=i(7386);t.exports=function(t,e,i,n,r,o,a,h){return s(i,n,r,o,a,h).filter(t,e)}},52692:t=>{t.exports=function(t,e,i,s){void 0===e&&(e=0),void 0===i&&(i=!1);var n,r,o,a=0;if(i){for(r=s.height-1;r>=0;r--)for(n=s.width-1;n>=0;n--)if((o=s.data[r][n])&&o.index===t){if(a===e)return o;a+=1}}else for(r=0;r{var s=i(7386);t.exports=function(t,e,i,n,r,o,a,h){return s(i,n,r,o,a,h).find(t,e)||null}},97560:(t,e,i)=>{var s=i(7386);t.exports=function(t,e,i,n,r,o,a,h){s(i,n,r,o,a,h).forEach(t,e)}},43305:(t,e,i)=>{var s=i(91907),n=i(30003),r=i(9474),o=i(14018),a=i(29747),h=i(54503);t.exports=function(t){return t===s.ORTHOGONAL?n:t===s.HEXAGONAL?r:t===s.STAGGERED?h:t===s.ISOMETRIC?o:a}},7423:(t,e,i)=>{var s=i(62991);t.exports=function(t,e,i,n){if(void 0===i&&(i=!1),s(t,e,n)){var r=n.data[e][t]||null;return r?-1===r.index?i?r:null:r:null}return null}},60540:(t,e,i)=>{var s=i(7423),n=new(i(26099));t.exports=function(t,e,i,r,o){return o.tilemapLayer.worldToTileXY(t,e,!0,n,r),s(n.x,n.y,i,o)}},55826:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n){var r=n.baseTileWidth,o=n.baseTileHeight,a=n.tilemapLayer,h=0,l=0;a&&(i||(i=a.scene.cameras.main),h=a.x+i.scrollX*(1-a.scrollFactorX),l=a.y+i.scrollY*(1-a.scrollFactorY),r*=a.scaleX,o*=a.scaleY);var u=h+t*r,c=l+e*o;return[new s(u,c),new s(u+r,c),new s(u+r,c+o),new s(u,c+o)]}},11758:(t,e,i)=>{var s=i(91907),n=i(27229),r=i(29747),o=i(55826);t.exports=function(t){return t===s.ORTHOGONAL?o:t===s.ISOMETRIC?r:t===s.HEXAGONAL?n:(s.STAGGERED,r)}},39167:(t,e,i)=>{var s=i(91907),n=i(29747),r=i(97281);t.exports=function(t){return t===s.ORTHOGONAL?r:n}},62e3:(t,e,i)=>{var s=i(91907),n=i(19951),r=i(14127),o=i(29747),a=i(97202),h=i(70326);t.exports=function(t){return t===s.ORTHOGONAL?h:t===s.ISOMETRIC?r:t===s.HEXAGONAL?n:t===s.STAGGERED?a:o}},5984:(t,e,i)=>{var s=i(91907),n=i(29747),r=i(28054),o=i(29650);t.exports=function(t){return t===s.ORTHOGONAL?o:t===s.STAGGERED?r:n}},7386:(t,e,i)=>{var s=i(95540);t.exports=function(t,e,i,n,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=o.width),void 0===n&&(n=o.height),r||(r={});var a=s(r,"isNotEmpty",!1),h=s(r,"isColliding",!1),l=s(r,"hasInterestingFace",!1);t<0&&(i+=t,t=0),e<0&&(n+=e,e=0),t+i>o.width&&(i=Math.max(o.width-t,0)),e+n>o.height&&(n=Math.max(o.height-e,0));for(var u=[],c=e;c{var s=i(55738),n=i(7386),r=i(91865),o=i(29747),a=i(26099),h=function(t,e){return r.RectangleToTriangle(e,t)},l=new a,u=new a,c=new a;t.exports=function(t,e,i,a){if(void 0===t)return[];var d=o;t instanceof s.Circle?d=r.CircleToRectangle:t instanceof s.Rectangle?d=r.RectangleToRectangle:t instanceof s.Triangle?d=h:t instanceof s.Line&&(d=r.LineToRectangle),a.tilemapLayer.worldToTileXY(t.left,t.top,!0,u,i);var f=u.x,p=u.y;a.tilemapLayer.worldToTileXY(t.right,t.bottom,!1,c,i);var v=Math.ceil(c.x),g=Math.ceil(c.y),m=Math.max(v-f,1),y=Math.max(g-p,1),x=n(f,p,m,y,e,a),T=a.tileWidth,w=a.tileHeight;a.tilemapLayer&&(T*=a.tilemapLayer.scaleX,w*=a.tilemapLayer.scaleY);for(var b=[],S=new s.Rectangle(0,0,T,w),E=0;E{var s=i(7386),n=i(26099),r=new n,o=new n;t.exports=function(t,e,i,n,a,h,l){var u=l.tilemapLayer.tilemap._convert.WorldToTileXY;u(t,e,!0,r,h,l);var c=r.x,d=r.y;u(t+i,e+n,!1,o,h,l);var f=Math.ceil(o.x),p=Math.ceil(o.y);return s(c,d,f-c,p-d,a,l)}},96113:(t,e,i)=>{var s=i(91907),n=i(20242),r=i(10095);t.exports=function(t){return t===s.ORTHOGONAL?r:n}},16926:(t,e,i)=>{var s=i(91907),n=i(86625),r=i(96897),o=i(29747),a=i(15108),h=i(85896);t.exports=function(t){return t===s.ORTHOGONAL?h:t===s.ISOMETRIC?r:t===s.HEXAGONAL?n:t===s.STAGGERED?a:o}},55762:(t,e,i)=>{var s=i(91907),n=i(20242),r=i(51900),o=i(63288);t.exports=function(t){return t===s.ORTHOGONAL?o:t===s.STAGGERED?r:n}},45091:(t,e,i)=>{var s=i(62991);t.exports=function(t,e,i){if(s(t,e,i)){var n=i.data[e][t];return null!==n&&n.index>-1}return!1}},24152:(t,e,i)=>{var s=i(45091),n=new(i(26099));t.exports=function(t,e,i,r){r.tilemapLayer.worldToTileXY(t,e,!0,n,i);var o=n.x,a=n.y;return s(o,a,r)}},90454:(t,e,i)=>{var s=i(63448),n=i(56583);t.exports=function(t,e){var i,r,o,a,h=t.tilemapLayer.tilemap,l=t.tilemapLayer,u=Math.floor(h.tileWidth*l.scaleX),c=Math.floor(h.tileHeight*l.scaleY),d=t.hexSideLength;if("y"===t.staggerAxis){var f=(c-d)/2+d;i=n(e.worldView.x-l.x,u,0,!0)-l.cullPaddingX,r=s(e.worldView.right-l.x,u,0,!0)+l.cullPaddingX,o=n(e.worldView.y-l.y,f,0,!0)-l.cullPaddingY,a=s(e.worldView.bottom-l.y,f,0,!0)+l.cullPaddingY}else{var p=(u-d)/2+d;i=n(e.worldView.x-l.x,p,0,!0)-l.cullPaddingX,r=s(e.worldView.right-l.x,p,0,!0)+l.cullPaddingX,o=n(e.worldView.y-l.y,c,0,!0)-l.cullPaddingY,a=s(e.worldView.bottom-l.y,c,0,!0)+l.cullPaddingY}return{left:i,right:r,top:o,bottom:a}}},9474:(t,e,i)=>{var s=i(90454),n=i(32483);t.exports=function(t,e,i,r){void 0===i&&(i=[]),void 0===r&&(r=0),i.length=0;var o=t.tilemapLayer,a=s(t,e);return o.skipCull&&1===o.scrollFactorX&&1===o.scrollFactorY&&(a.left=0,a.right=t.width,a.top=0,a.bottom=t.height),n(t,a,r,i),i}},27229:(t,e,i)=>{var s=i(19951),n=i(26099),r=new n;t.exports=function(t,e,i,o){var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(a*=l.scaleX,h*=l.scaleY);var u,c,d=s(t,e,r,i,o),f=[],p=.5773502691896257;"y"===o.staggerAxis?(u=p*a,c=h/2):(u=a/2,c=p*h);for(var v=0;v<6;v++){var g=2*Math.PI*(.5-v)/6;f.push(new n(d.x+u*Math.cos(g),d.y+c*Math.sin(g)))}return f}},19951:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r){i||(i=new s);var o=r.baseTileWidth,a=r.baseTileHeight,h=r.tilemapLayer,l=0,u=0;h&&(n||(n=h.scene.cameras.main),l=h.x+n.scrollX*(1-h.scrollFactorX),u=h.y+n.scrollY*(1-h.scrollFactorY),o*=h.scaleX,a*=h.scaleY);var c,d,f=o/2,p=a/2;return"y"===r.staggerAxis?(c=l+o*t+o,d=u+1.5*e*p+p,e%2==0&&("odd"===this.staggerIndex?c-=f:c+=f)):"x"===this.staggerAxis&&"odd"===this.staggerIndex&&(c=l+1.5*t*f+f,d=u+a*t+a,t%2==0&&("odd"===this.staggerIndex?d-=p:d+=p)),i.set(c,d)}},86625:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r,o){n||(n=new s);var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(r||(r=l.scene.cameras.main),t-=l.x+r.scrollX*(1-l.scrollFactorX),e-=l.y+r.scrollY*(1-l.scrollFactorY),a*=l.scaleX,h*=l.scaleY);var u,c,d,f,p,v=.5773502691896257,g=-.3333333333333333,m=.6666666666666666,y=a/2,x=h/2;"y"===o.staggerAxis?(d=v*(u=(t-y)/(v*a))+g*(c=(e-x)/x),f=0*u+m*c):(d=g*(u=(t-y)/y)+v*(c=(e-x)/(v*h)),f=m*u+0*c),p=-d-f;var T,w=Math.round(d),b=Math.round(f),S=Math.round(p),E=Math.abs(w-d),A=Math.abs(b-f),C=Math.abs(S-p);E>A&&E>C?w=-b-S:A>C&&(b=-w-S);var _=b;return T="odd"===o.staggerIndex?_%2==0?b/2+w:b/2+w-.5:_%2==0?b/2+w:b/2+w+.5,n.set(T,_)}},62991:t=>{t.exports=function(t,e,i){return t>=0&&t=0&&e{var s=i(33528);t.exports=function(t,e,i,n){void 0===i&&(i=[]),void 0===n&&(n=0),i.length=0;var r,o,a,h=t.tilemapLayer,l=t.data,u=t.width,c=t.height,d=h.skipCull,f=u,p=c;if(0===n)for(o=0;o=0;r--)(a=l[o][r])&&-1!==a.index&&a.visible&&0!==a.alpha&&(d||s(r,o,t,e))&&i.push(a);else if(2===n)for(o=p;o>=0;o--)for(r=0;r=0;o--)for(r=f;r>=0;r--)(a=l[o][r])&&-1!==a.index&&a.visible&&0!==a.alpha&&(d||s(r,o,t,e))&&i.push(a);return h.tilesDrawn=i.length,h.tilesTotal=u*c,i}},14127:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r){i||(i=new s);var o=r.baseTileWidth,a=r.baseTileHeight,h=r.tilemapLayer,l=0,u=0;h&&(n||(n=h.scene.cameras.main),l=h.x+n.scrollX*(1-h.scrollFactorX),o*=h.scaleX,u=h.y+n.scrollY*(1-h.scrollFactorY),a*=h.scaleY);var c=l+o/2*(t-e),d=u+(t+e)*(a/2);return i.set(c,d)}},96897:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r,o,a){n||(n=new s);var h=o.baseTileWidth,l=o.baseTileHeight,u=o.tilemapLayer;u&&(r||(r=u.scene.cameras.main),e-=u.y+r.scrollY*(1-u.scrollFactorY),l*=u.scaleY,t-=u.x+r.scrollX*(1-u.scrollFactorX),h*=u.scaleX);var c=h/2,d=l/2;a||(e-=l);var f=.5*((t-=c)/c+e/d),p=.5*(-t/c+e/d);return i&&(f=Math.floor(f),p=Math.floor(p)),n.set(f,p)}},71558:(t,e,i)=>{var s=i(23029),n=i(62991),r=i(72023),o=i(20576);t.exports=function(t,e,i,a,h){if(void 0===a&&(a=!0),!n(e,i,h))return null;var l,u=h.data[i][e],c=u&&u.collides;t instanceof s?(null===h.data[i][e]&&(h.data[i][e]=new s(h,t.index,e,i,h.tileWidth,h.tileHeight)),h.data[i][e].copy(t)):(l=t,null===h.data[i][e]?h.data[i][e]=new s(h,l,e,i,h.tileWidth,h.tileHeight):h.data[i][e].index=l);var d=h.data[i][e],f=-1!==h.collideIndexes.indexOf(d.index);if(-1===(l=t instanceof s?t.index:t))d.width=h.tileWidth,d.height=h.tileHeight;else{var p=h.tilemapLayer.tilemap,v=p.tiles[l][2],g=p.tilesets[v];d.width=g.tileWidth,d.height=g.tileHeight}return o(d,f),a&&c!==d.collides&&r(e,i,h),d}},26303:(t,e,i)=>{var s=i(71558),n=new(i(26099));t.exports=function(t,e,i,r,o,a){return a.tilemapLayer.worldToTileXY(e,i,!0,n,o,a),s(t,n.x,n.y,r,a)}},14051:(t,e,i)=>{var s=i(42573),n=i(71558);t.exports=function(t,e,i,r,o){if(void 0===r&&(r=!0),!Array.isArray(t))return null;Array.isArray(t[0])||(t=[t]);for(var a=t.length,h=t[0].length,l=0;l{var s=i(7386),n=i(26546);t.exports=function(t,e,i,r,o,a){var h,l=s(t,e,i,r,{},a);if(!o)for(o=[],h=0;h{var s=i(23029),n=i(62991),r=i(72023);t.exports=function(t,e,i,o,a){if(void 0===i&&(i=!0),void 0===o&&(o=!0),!n(t,e,a))return null;var h=a.data[e][t];return h?(a.data[e][t]=i?null:new s(a,-1,t,e,a.tileWidth,a.tileHeight),o&&h&&h.collides&&r(t,e,a),h):null}},94178:(t,e,i)=>{var s=i(63557),n=new(i(26099));t.exports=function(t,e,i,r,o,a){return a.tilemapLayer.worldToTileXY(t,e,!0,n,o,a),s(n.x,n.y,i,r,a)}},15533:(t,e,i)=>{var s=i(7386),n=i(3956),r=new n(105,210,231,150),o=new n(243,134,48,200),a=new n(40,39,37,150);t.exports=function(t,e,i){void 0===e&&(e={});var n=void 0!==e.tileColor?e.tileColor:r,h=void 0!==e.collidingTileColor?e.collidingTileColor:o,l=void 0!==e.faceColor?e.faceColor:a,u=s(0,0,i.width,i.height,null,i);t.translateCanvas(i.tilemapLayer.x,i.tilemapLayer.y),t.scaleCanvas(i.tilemapLayer.scaleX,i.tilemapLayer.scaleY);for(var c=0;c{var s=i(7386);t.exports=function(t,e,i,n,r,o,a){for(var h=s(i,n,r,o,null,a),l=0;l{t.exports=function(t,e,i,s){var n,r,o,a=t.data,h=t.width,l=t.height,u=t.tilemapLayer,c=Math.max(0,e.left),d=Math.min(h,e.right),f=Math.max(0,e.top),p=Math.min(l,e.bottom);if(0===i)for(r=f;r=c;n--)(o=a[r][n])&&-1!==o.index&&o.visible&&0!==o.alpha&&s.push(o);else if(2===i)for(r=p;r>=f;r--)for(n=c;a[r]&&n=f;r--)for(n=d;a[r]&&n>=c;n--)(o=a[r][n])&&-1!==o.index&&o.visible&&0!==o.alpha&&s.push(o);return u.tilesDrawn=s.length,u.tilesTotal=h*l,s}},57068:(t,e,i)=>{var s=i(20576),n=i(42573),r=i(9589);t.exports=function(t,e,i,o,a){void 0===e&&(e=!0),void 0===i&&(i=!0),void 0===a&&(a=!0),Array.isArray(t)||(t=[t]);for(var h=0;h{var s=i(20576),n=i(42573),r=i(9589);t.exports=function(t,e,i,o,a,h){if(void 0===i&&(i=!0),void 0===o&&(o=!0),void 0===h&&(h=!0),!(t>e)){for(var l=t;l<=e;l++)r(l,i,a);if(h)for(var u=0;u=t&&d.index<=e&&s(d,i)}o&&n(0,0,a.width,a.height,a)}}},75661:(t,e,i)=>{var s=i(20576),n=i(42573),r=i(9589);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var a=0;a{var s=i(20576),n=i(42573),r=i(97022);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0);for(var a=0;a{var s=i(20576),n=i(42573);t.exports=function(t,e,i){void 0===t&&(t=!0),void 0===e&&(e=!0);for(var r=0;r0&&s(a,t)}}e&&n(0,0,i.width,i.height,i)}},9589:t=>{t.exports=function(t,e,i){var s=i.collideIndexes.indexOf(t);e&&-1===s?i.collideIndexes.push(t):e||-1===s||i.collideIndexes.splice(s,1)}},20576:t=>{t.exports=function(t,e){e?t.setCollision(!0,!0,!0,!0,!1):t.resetCollision(!1)}},79583:t=>{t.exports=function(t,e,i,s){if("number"==typeof t)s.callbacks[t]=null!==e?{callback:e,callbackContext:i}:void 0;else for(var n=0,r=t.length;n{var s=i(7386);t.exports=function(t,e,i,n,r,o,a){for(var h=s(t,e,i,n,null,a),l=0;l{var s=i(7386),n=i(33680);t.exports=function(t,e,i,r,o){var a=s(t,e,i,r,null,o),h=a.map((function(t){return t.index}));n(h);for(var l=0;l{var s=i(63448),n=i(56583);t.exports=function(t,e){var i=t.tilemapLayer.tilemap,r=t.tilemapLayer,o=Math.floor(i.tileWidth*r.scaleX),a=Math.floor(i.tileHeight*r.scaleY);return{left:n(e.worldView.x-r.x,o,0,!0)-r.cullPaddingX,right:s(e.worldView.right-r.x,o,0,!0)+r.cullPaddingX,top:n(e.worldView.y-r.y,a/2,0,!0)-r.cullPaddingY,bottom:s(e.worldView.bottom-r.y,a/2,0,!0)+r.cullPaddingY}}},54503:(t,e,i)=>{var s=i(61325),n=i(32483);t.exports=function(t,e,i,r){void 0===i&&(i=[]),void 0===r&&(r=0),i.length=0;var o=t.tilemapLayer,a=s(t,e);return o.skipCull&&1===o.scrollFactorX&&1===o.scrollFactorY&&(a.left=0,a.right=t.width,a.top=0,a.bottom=t.height),n(t,a,r,i),i}},97202:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r){i||(i=new s);var o=r.baseTileWidth,a=r.baseTileHeight,h=r.tilemapLayer,l=0,u=0;h&&(n||(n=h.scene.cameras.main),l=h.x+n.scrollX*(1-h.scrollFactorX),o*=h.scaleX,u=h.y+n.scrollY*(1-h.scrollFactorY),a*=h.scaleY);var c=l+t*o+e%2*(o/2),d=u+e*(a/2);return i.set(c,d)}},28054:t=>{t.exports=function(t,e,i){var s=i.baseTileHeight,n=i.tilemapLayer,r=0;return n&&(void 0===e&&(e=n.scene.cameras.main),r=n.y+e.scrollY*(1-n.scrollFactorY),s*=n.scaleY),r+t*(s/2)+s}},15108:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r,o){n||(n=new s);var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(r||(r=l.scene.cameras.main),e-=l.y+r.scrollY*(1-l.scrollFactorY),h*=l.scaleY,t-=l.x+r.scrollX*(1-l.scrollFactorX),a*=l.scaleX);var u=i?Math.floor(e/(h/2)):e/(h/2),c=i?Math.floor((t+u%2*.5*a)/a):(t+u%2*.5*a)/a;return n.set(c,u)}},51900:t=>{t.exports=function(t,e,i,s){var n=s.baseTileHeight,r=s.tilemapLayer;return r&&(i||(i=r.scene.cameras.main),t-=r.y+i.scrollY*(1-r.scrollFactorY),n*=r.scaleY),e?Math.floor(t/(n/2)):t/(n/2)}},86560:(t,e,i)=>{var s=i(7386);t.exports=function(t,e,i,n,r,o,a){for(var h=s(i,n,r,o,null,a),l=0;l{t.exports=function(t,e,i){var s=i.baseTileWidth,n=i.tilemapLayer,r=0;return n&&(e||(e=n.scene.cameras.main),r=n.x+e.scrollX*(1-n.scrollFactorX),s*=n.scaleX),r+t*s}},70326:(t,e,i)=>{var s=i(97281),n=i(29650),r=i(26099);t.exports=function(t,e,i,o,a){return i||(i=new r(0,0)),i.x=s(t,o,a),i.y=n(e,o,a),i}},29650:t=>{t.exports=function(t,e,i){var s=i.baseTileHeight,n=i.tilemapLayer,r=0;return n&&(e||(e=n.scene.cameras.main),r=n.y+e.scrollY*(1-n.scrollFactorY),s*=n.scaleY),r+t*s}},77366:(t,e,i)=>{var s=i(7386),n=i(75508);t.exports=function(t,e,i,r,o,a){if(o){var h,l=s(t,e,i,r,null,a),u=0;for(h=0;h{var s=i(85896),n=new(i(26099));t.exports=function(t,e,i,r){return s(t,0,e,n,i,r),n.x}},85896:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r,o){void 0===i&&(i=!0),n||(n=new s);var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(r||(r=l.scene.cameras.main),t-=l.x+r.scrollX*(1-l.scrollFactorX),e-=l.y+r.scrollY*(1-l.scrollFactorY),a*=l.scaleX,h*=l.scaleY);var u=t/a,c=e/h;return i&&(u=Math.floor(u),c=Math.floor(c)),n.set(u,c)}},63288:(t,e,i)=>{var s=i(85896),n=new(i(26099));t.exports=function(t,e,i,r){return s(0,t,e,n,i,r),n.y}},81086:(t,e,i)=>{t.exports={CalculateFacesAt:i(72023),CalculateFacesWithin:i(42573),CheckIsoBounds:i(33528),Copy:i(1785),CreateFromTiles:i(78419),CullBounds:i(19545),CullTiles:i(30003),Fill:i(35137),FilterTiles:i(40253),FindByIndex:i(52692),FindTile:i(66151),ForEachTile:i(97560),GetCullTilesFunction:i(43305),GetTileAt:i(7423),GetTileAtWorldXY:i(60540),GetTileCorners:i(55826),GetTileCornersFunction:i(11758),GetTilesWithin:i(7386),GetTilesWithinShape:i(91141),GetTilesWithinWorldXY:i(96523),GetTileToWorldXFunction:i(39167),GetTileToWorldXYFunction:i(62e3),GetTileToWorldYFunction:i(5984),GetWorldToTileXFunction:i(96113),GetWorldToTileXYFunction:i(16926),GetWorldToTileYFunction:i(55762),HasTileAt:i(45091),HasTileAtWorldXY:i(24152),HexagonalCullBounds:i(90454),HexagonalCullTiles:i(9474),HexagonalGetTileCorners:i(27229),HexagonalTileToWorldXY:i(19951),HexagonalWorldToTileXY:i(86625),IsInLayerBounds:i(62991),IsometricCullTiles:i(14018),IsometricTileToWorldXY:i(14127),IsometricWorldToTileXY:i(96897),PutTileAt:i(71558),PutTileAtWorldXY:i(26303),PutTilesAt:i(14051),Randomize:i(77389),RemoveTileAt:i(63557),RemoveTileAtWorldXY:i(94178),RenderDebug:i(15533),ReplaceByIndex:i(27987),RunCull:i(32483),SetCollision:i(57068),SetCollisionBetween:i(37266),SetCollisionByExclusion:i(75661),SetCollisionByProperty:i(64740),SetCollisionFromCollisionGroup:i(63307),SetLayerCollisionIndex:i(9589),SetTileCollision:i(20576),SetTileIndexCallback:i(79583),SetTileLocationCallback:i(93254),Shuffle:i(32903),StaggeredCullBounds:i(61325),StaggeredCullTiles:i(54503),StaggeredTileToWorldXY:i(97202),StaggeredTileToWorldY:i(28054),StaggeredWorldToTileXY:i(15108),StaggeredWorldToTileY:i(51900),SwapByIndex:i(86560),TileToWorldX:i(97281),TileToWorldXY:i(70326),TileToWorldY:i(29650),WeightedRandomize:i(77366),WorldToTileX:i(10095),WorldToTileXY:i(85896),WorldToTileY:i(63288)}},91907:t=>{t.exports={ORTHOGONAL:0,ISOMETRIC:1,STAGGERED:2,HEXAGONAL:3}},21829:(t,e,i)=>{var s={ORIENTATION:i(91907)};t.exports=s},62501:(t,e,i)=>{var s=i(79291),n=i(21829),r={Components:i(81086),Parsers:i(57442),Formats:i(80341),ImageCollection:i(16536),ParseToTilemap:i(31989),Tile:i(23029),Tilemap:i(49075),TilemapCreator:i(45939),TilemapFactory:i(46029),Tileset:i(33629),TilemapLayer:i(20442),Orientation:i(91907),LayerData:i(14977),MapData:i(87010),ObjectLayer:i(48700)};r=s(!1,r,n.ORIENTATION),t.exports=r},14977:(t,e,i)=>{var s=i(83419),n=i(91907),r=i(95540),o=new s({initialize:function(t){void 0===t&&(t={}),this.name=r(t,"name","layer"),this.id=r(t,"id",0),this.x=r(t,"x",0),this.y=r(t,"y",0),this.width=r(t,"width",0),this.height=r(t,"height",0),this.tileWidth=r(t,"tileWidth",0),this.tileHeight=r(t,"tileHeight",0),this.baseTileWidth=r(t,"baseTileWidth",this.tileWidth),this.baseTileHeight=r(t,"baseTileHeight",this.tileHeight),this.orientation=r(t,"orientation",n.ORTHOGONAL),this.widthInPixels=r(t,"widthInPixels",this.width*this.baseTileWidth),this.heightInPixels=r(t,"heightInPixels",this.height*this.baseTileHeight),this.alpha=r(t,"alpha",1),this.visible=r(t,"visible",!0),this.properties=r(t,"properties",[]),this.indexes=r(t,"indexes",[]),this.collideIndexes=r(t,"collideIndexes",[]),this.callbacks=r(t,"callbacks",[]),this.bodies=r(t,"bodies",[]),this.data=r(t,"data",[]),this.tilemapLayer=r(t,"tilemapLayer",null),this.hexSideLength=r(t,"hexSideLength",0),this.staggerAxis=r(t,"staggerAxis","y"),this.staggerIndex=r(t,"staggerIndex","odd")}});t.exports=o},87010:(t,e,i)=>{var s=i(83419),n=i(91907),r=i(95540),o=new s({initialize:function(t){void 0===t&&(t={}),this.name=r(t,"name","map"),this.width=r(t,"width",0),this.height=r(t,"height",0),this.infinite=r(t,"infinite",!1),this.tileWidth=r(t,"tileWidth",0),this.tileHeight=r(t,"tileHeight",0),this.widthInPixels=r(t,"widthInPixels",this.width*this.tileWidth),this.heightInPixels=r(t,"heightInPixels",this.height*this.tileHeight),this.format=r(t,"format",null),this.orientation=r(t,"orientation",n.ORTHOGONAL),this.renderOrder=r(t,"renderOrder","right-down"),this.version=r(t,"version","1"),this.properties=r(t,"properties",{}),this.layers=r(t,"layers",[]),this.images=r(t,"images",[]),this.objects=r(t,"objects",[]),Array.isArray(this.objects)||(this.objects=[]),this.collision=r(t,"collision",{}),this.tilesets=r(t,"tilesets",[]),this.imageCollections=r(t,"imageCollections",[]),this.tiles=r(t,"tiles",[]),this.hexSideLength=r(t,"hexSideLength",0),this.staggerAxis=r(t,"staggerAxis","y"),this.staggerIndex=r(t,"staggerIndex","odd")}});t.exports=o},48700:(t,e,i)=>{var s=i(83419),n=i(95540),r=new s({initialize:function(t){void 0===t&&(t={}),this.name=n(t,"name","object layer"),this.id=n(t,"id",0),this.opacity=n(t,"opacity",1),this.properties=n(t,"properties",{}),this.propertyTypes=n(t,"propertytypes",{}),this.type=n(t,"type","objectgroup"),this.visible=n(t,"visible",!0),this.objects=n(t,"objects",[]),Array.isArray(this.objects)||(this.objects=[])}});t.exports=r},6641:(t,e,i)=>{var s=i(91907);t.exports=function(t){return"isometric"===(t=t.toLowerCase())?s.ISOMETRIC:"staggered"===t?s.STAGGERED:"hexagonal"===t?s.HEXAGONAL:s.ORTHOGONAL}},46177:(t,e,i)=>{var s=i(80341),n=i(2342),r=i(82593),o=i(46594),a=i(87021);t.exports=function(t,e,i,h,l,u){var c;switch(e){case s.ARRAY_2D:c=n(t,i,h,l,u);break;case s.CSV:c=r(t,i,h,l,u);break;case s.TILED_JSON:c=o(t,i,u);break;case s.WELTMEISTER:c=a(t,i,u);break;default:console.warn("Unrecognized tilemap data format: "+e),c=null}return c}},2342:(t,e,i)=>{var s=i(80341),n=i(14977),r=i(87010),o=i(23029);t.exports=function(t,e,i,a,h){for(var l=new n({tileWidth:i,tileHeight:a}),u=new r({name:t,tileWidth:i,tileHeight:a,format:s.ARRAY_2D,layers:[l]}),c=[],d=e.length,f=0,p=0;p{var s=i(80341),n=i(2342);t.exports=function(t,e,i,r,o){var a=e.trim().split("\n").map((function(t){return t.split(",")})),h=n(t,a,i,r,o);return h.format=s.CSV,h}},6656:(t,e,i)=>{var s=i(14977),n=i(23029);t.exports=function(t,e){for(var i=[],r=0;r-1?new n(a,f,c,u,o.tilesize,o.tilesize):e?null:new n(a,-1,c,u,o.tilesize,o.tilesize),h.push(d)}l.push(h),h=[]}a.data=l,i.push(a)}return i}},96483:(t,e,i)=>{var s=i(33629);t.exports=function(t){for(var e=[],i=[],n=0;n{var s=i(80341),n=i(87010),r=i(6656),o=i(96483);t.exports=function(t,e,i){if(0===e.layer.length)return console.warn("No layers found in the Weltmeister map: "+t),null;for(var a=0,h=0,l=0;la&&(a=e.layer[l].width),e.layer[l].height>h&&(h=e.layer[l].height);var u=new n({width:a,height:h,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:s.WELTMEISTER});return u.layers=r(e,i),u.tilesets=o(e),u}},52833:(t,e,i)=>{t.exports={ParseTileLayers:i(6656),ParseTilesets:i(96483),ParseWeltmeister:i(87021)}},57442:(t,e,i)=>{t.exports={FromOrientationString:i(6641),Parse:i(46177),Parse2DArray:i(2342),ParseCSV:i(82593),Impact:i(52833),Tiled:i(96761)}},51233:(t,e,i)=>{var s=i(79291);t.exports=function(t){for(var e,i,n,r,o,a=0;a{t.exports=function(t){for(var e=window.atob(t),i=e.length,s=new Array(i/4),n=0;n>>0;return s}},84101:(t,e,i)=>{var s=i(33629);t.exports=function(t){var e,i,n=[];for(e=0;e{var s=i(95540);t.exports=function(t,e,i){if(!e)return{i:0,layers:t.layers,name:"",opacity:1,visible:!0,x:0,y:0};var n=e.x+s(e,"startx",0)*t.tilewidth+s(e,"offsetx",0),r=e.y+s(e,"starty",0)*t.tileheight+s(e,"offsety",0);return{i:0,layers:e.layers,name:i.name+e.name+"/",opacity:i.opacity*e.opacity,visible:i.visible&&e.visible,x:i.x+n,y:i.y+r}}},29920:t=>{t.exports=function(t){var e=Boolean(2147483648&t),i=Boolean(1073741824&t),s=Boolean(536870912&t);t&=536870911;var n=0,r=!1;return e&&i&&s?(n=Math.PI/2,r=!0):e&&i&&!s?(n=Math.PI,r=!1):e&&!i&&s?(n=Math.PI/2,r=!1):!e||i||s?!e&&i&&s?(n=3*Math.PI/2,r=!1):e||!i||s?e||i||!s?e||i||s||(n=0,r=!1):(n=3*Math.PI/2,r=!0):(n=Math.PI,r=!0):(n=0,r=!0),{gid:t,flippedHorizontal:e,flippedVertical:i,flippedAntiDiagonal:s,rotation:n,flipped:r}}},12635:(t,e,i)=>{var s=i(95540),n=i(79677);t.exports=function(t){for(var e=[],i=[],r=n(t);r.i0;)if(r.i>=r.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}r=i.pop()}else{var o=r.layers[r.i];if(r.i++,"imagelayer"===o.type){var a=s(o,"offsetx",0)+s(o,"startx",0),h=s(o,"offsety",0)+s(o,"starty",0);e.push({name:r.name+o.name,image:o.image,x:r.x+a+o.x,y:r.y+h+o.y,alpha:r.opacity*o.opacity,visible:r.visible&&o.visible,properties:s(o,"properties",{})})}else if("group"===o.type){var l=n(t,o,r);i.push(r),r=l}}return e}},46594:(t,e,i)=>{var s=i(51233),n=i(84101),r=i(91907),o=i(62644),a=i(80341),h=i(6641),l=i(87010),u=i(12635),c=i(22611),d=i(28200),f=i(24619);t.exports=function(t,e,i){var p=o(e),v=new l({width:p.width,height:p.height,name:t,tileWidth:p.tilewidth,tileHeight:p.tileheight,orientation:h(p.orientation),format:a.TILED_JSON,version:p.version,properties:p.properties,renderOrder:p.renderorder,infinite:p.infinite});v.orientation===r.HEXAGONAL&&(v.hexSideLength=p.hexsidelength,v.staggerAxis=p.staggeraxis,v.staggerIndex=p.staggerindex),v.layers=d(p,i),v.images=u(p);var g=f(p);return v.tilesets=g.tilesets,v.imageCollections=g.imageCollections,v.objects=c(p),v.tiles=n(v),s(v),v}},52205:(t,e,i)=>{var s=i(18254),n=i(29920),r=function(t){return{x:t.x,y:t.y}},o=["id","name","type","rotation","properties","visible","x","y","width","height"];t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0);var a=s(t,o);if(a.x+=e,a.y+=i,t.gid){var h=n(t.gid);a.gid=h.gid,a.flippedHorizontal=h.flippedHorizontal,a.flippedVertical=h.flippedVertical,a.flippedAntiDiagonal=h.flippedAntiDiagonal}else t.polyline?a.polyline=t.polyline.map(r):t.polygon?a.polygon=t.polygon.map(r):t.ellipse?a.ellipse=t.ellipse:t.text?a.text=t.text:t.point?a.point=!0:a.rectangle=!0;return a}},22611:(t,e,i)=>{var s=i(95540),n=i(52205),r=i(48700),o=i(79677);t.exports=function(t){for(var e=[],i=[],a=o(t);a.i0;)if(a.i>=a.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}a=i.pop()}else{var h=a.layers[a.i];if(a.i++,h.opacity*=a.opacity,h.visible=a.visible&&h.visible,"objectgroup"===h.type){h.name=a.name+h.name;for(var l=a.x+s(h,"startx",0)+s(h,"offsetx",0),u=a.y+s(h,"starty",0)+s(h,"offsety",0),c=[],d=0;d{var s=i(41868),n=i(91907),r=i(79677),o=i(6641),a=i(95540),h=i(14977),l=i(29920),u=i(23029);t.exports=function(t,e){for(var i=a(t,"infinite",!1),c=[],d=[],f=r(t);f.i0;)if(f.i>=f.layers.length){if(d.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}f=d.pop()}else{var p=f.layers[f.i];if(f.i++,"tilelayer"===p.type)if(p.compression)console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+p.name+"'");else{if(p.encoding&&"base64"===p.encoding){if(p.chunks)for(var v=0;v0?((y=new u(g,m.gid,O,F,t.tilewidth,t.tileheight)).rotation=m.rotation,y.flipX=m.flipped,T[F][O]=y):(x=e?null:new u(g,-1,O,F,t.tilewidth,t.tileheight),T[F][O]=x),++w===C.width&&(P++,w=0)}}else{(g=new h({name:f.name+p.name,id:p.id,x:f.x+a(p,"offsetx",0)+p.x,y:f.y+a(p,"offsety",0)+p.y,width:p.width,height:p.height,tileWidth:t.tilewidth,tileHeight:t.tileheight,alpha:f.opacity*p.opacity,visible:f.visible&&p.visible,properties:a(p,"properties",[]),orientation:o(t.orientation)})).orientation===n.HEXAGONAL&&(g.hexSideLength=t.hexsidelength,g.staggerAxis=t.staggeraxis,g.staggerIndex=t.staggerindex);for(var D=[],k=0,I=p.data.length;k0?((y=new u(g,m.gid,w,T.length,t.tilewidth,t.tileheight)).rotation=m.rotation,y.flipX=m.flipped,D.push(y)):(x=e?null:new u(g,-1,w,T.length,t.tilewidth,t.tileheight),D.push(x)),++w===p.width&&(T.push(D),w=0,D=[])}g.data=T,c.push(g)}else if("group"===p.type){var B=r(t,p,f);d.push(f),f=B}}return c}},24619:(t,e,i)=>{var s=i(33629),n=i(16536),r=i(52205),o=i(57880);t.exports=function(t){for(var e,i=[],a=[],h=null,l=0;l1){var d=void 0,f=void 0;if(Array.isArray(u.tiles)){d=d||{},f=f||{};for(var p=0;p{t.exports=function(t,e){for(var i=0;i0){var r,o,a,h={},l={};if(Array.isArray(s.edgecolors))for(r=0;r{t.exports={AssignTileProperties:i(51233),Base64Decode:i(41868),BuildTilesetIndex:i(84101),CreateGroupLayer:i(79677),ParseGID:i(29920),ParseImageLayers:i(12635),ParseJSONTiled:i(46594),ParseObject:i(52205),ParseObjectLayers:i(22611),ParseTileLayers:i(28200),ParseTilesets:i(24619)}},33385:(t,e,i)=>{var s=i(83419),n=i(37277),r=i(44594),o=i(94880),a=i(72905),h=new s({initialize:function(t){this.scene=t,this.systems=t.sys,this.now=0,this.startTime=0,this.timeScale=1,this.paused=!1,this._active=[],this._pendingInsertion=[],this._pendingRemoval=[],t.sys.events.once(r.BOOT,this.boot,this),t.sys.events.on(r.START,this.start,this)},boot:function(){this.now=this.systems.game.loop.time,this.systems.events.once(r.DESTROY,this.destroy,this)},start:function(){this.startTime=this.systems.game.loop.time;var t=this.systems.events;t.on(r.PRE_UPDATE,this.preUpdate,this),t.on(r.UPDATE,this.update,this),t.once(r.SHUTDOWN,this.shutdown,this)},addEvent:function(t){var e;return t instanceof o?(e=t,this.removeEvent(e),e.elapsed=e.startAt,e.hasDispatched=!1,e.repeatCount=-1===e.repeat||e.loop?999999999999:e.repeat):e=new o(t),this._pendingInsertion.push(e),e},delayedCall:function(t,e,i,s){return this.addEvent({delay:t,callback:e,args:i,callbackScope:s})},clearPendingEvents:function(){return this._pendingInsertion=[],this},removeEvent:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e-1&&this._active.splice(n,1),s.destroy()}for(i=0;i=s.delay)){var n=s.elapsed-s.delay;if(s.elapsed=s.delay,!s.hasDispatched&&s.callback&&(s.hasDispatched=!0,s.callback.apply(s.callbackScope,s.args)),s.repeatCount>0){if(s.repeatCount--,n>=s.delay)for(;n>=s.delay&&s.repeatCount>0;)s.callback&&s.callback.apply(s.callbackScope,s.args),n-=s.delay,s.repeatCount--;s.elapsed=n,s.hasDispatched=!1}else s.hasDispatched&&this._pendingRemoval.push(s)}}}},shutdown:function(){var t;for(t=0;t{var s=i(83419),n=i(50792),r=i(39429),o=i(95540),a=i(44594),h=i(89809),l=new s({Extends:n,initialize:function(t,e){n.call(this),this.scene=t,this.systems=t.sys,this.elapsed=0,this.paused=!0,this.complete=!1,this.totalComplete=0,this.loop=0,this.iteration=0,this.events=[];var i=this.systems.events;i.on(a.PRE_UPDATE,this.preUpdate,this),i.on(a.UPDATE,this.update,this),i.once(a.SHUTDOWN,this.destroy,this),e&&this.add(e)},preUpdate:function(t,e){this.paused||(this.elapsed+=e)},update:function(){if(!this.paused&&!this.complete){var t,e,i=this.events,s=!1,n=this.systems;for(t=0;t=i.length&&(0!==this.loop&&(-1===this.loop||this.loop>this.iteration)?(this.iteration++,this.reset(!0)):this.complete=!0),this.complete&&this.emit(h.COMPLETE,this)}},play:function(t){return void 0===t&&(t=!0),this.paused=!1,this.complete=!1,this.totalComplete=0,t&&this.reset(),this},pause:function(){return this.paused=!0,this},repeat:function(t){return void 0!==t&&!0!==t||(t=-1),!1===t&&(t=0),this.loop=t,this},resume:function(){return this.paused=!1,this},stop:function(){return this.paused=!0,this.complete=!0,this},reset:function(t){void 0===t&&(t=!1),this.elapsed=0,t||(this.iteration=0);for(var e=0;e0&&(i=e[e.length-1].time);for(var s=0;s{var s=i(83419),n=i(95540),r=new s({initialize:function(t){this.delay=0,this.repeat=0,this.repeatCount=0,this.loop=!1,this.callback,this.callbackScope,this.args,this.timeScale=1,this.startAt=0,this.elapsed=0,this.paused=!1,this.hasDispatched=!1,this.reset(t)},reset:function(t){if(this.delay=n(t,"delay",0),this.repeat=n(t,"repeat",0),this.loop=n(t,"loop",!1),this.callback=n(t,"callback",void 0),this.callbackScope=n(t,"callbackScope",this),this.args=n(t,"args",[]),this.timeScale=n(t,"timeScale",1),this.startAt=n(t,"startAt",0),this.paused=n(t,"paused",!1),this.elapsed=this.startAt,this.hasDispatched=!1,this.repeatCount=-1===this.repeat||this.loop?999999999999:this.repeat,0===this.delay&&(this.repeat>0||this.loop))throw new Error("TimerEvent infinite loop created via zero delay");return this},getProgress:function(){return this.elapsed/this.delay},getOverallProgress:function(){if(this.repeat>0){var t=this.delay+this.delay*this.repeat;return(this.elapsed+this.delay*(this.repeat-this.repeatCount))/t}return this.getProgress()},getRepeatCount:function(){return this.repeatCount},getElapsed:function(){return this.elapsed},getElapsedSeconds:function(){return.001*this.elapsed},getRemaining:function(){return this.delay-this.elapsed},getRemainingSeconds:function(){return.001*this.getRemaining()},getOverallRemaining:function(){return this.delay*(1+this.repeatCount)-this.elapsed},getOverallRemainingSeconds:function(){return.001*this.getOverallRemaining()},remove:function(t){void 0===t&&(t=!1),this.elapsed=this.delay,this.hasDispatched=!t,this.repeatCount=0},destroy:function(){this.callback=void 0,this.callbackScope=void 0,this.args=[]}});t.exports=r},35945:t=>{t.exports="complete"},89809:(t,e,i)=>{t.exports={COMPLETE:i(35945)}},90291:(t,e,i)=>{t.exports={Clock:i(33385),Events:i(89809),Timeline:i(96120),TimerEvent:i(94880)}},40382:(t,e,i)=>{var s=i(72905),n=i(83419),r=i(43491),o=i(88032),a=i(37277),h=i(44594),l=i(93109),u=i(86081),c=i(8357),d=i(43960),f=i(26012),p=new n({initialize:function(t){this.scene=t,this.events=t.sys.events,this.timeScale=1,this.paused=!1,this.processing=!1,this.tweens=[],this.time=0,this.startTime=0,this.nextTime=0,this.prevTime=0,this.maxLag=500,this.lagSkip=33,this.gap=1e3/240,this.events.once(h.BOOT,this.boot,this),this.events.on(h.START,this.start,this)},boot:function(){this.events.once(h.DESTROY,this.destroy,this)},start:function(){this.timeScale=1,this.paused=!1,this.startTime=Date.now(),this.prevTime=this.startTime,this.nextTime=this.gap,this.events.on(h.UPDATE,this.update,this),this.events.once(h.SHUTDOWN,this.shutdown,this)},create:function(t){Array.isArray(t)||(t=[t]);for(var e=[],i=0;i-1},existing:function(t){return this.has(t)||this.tweens.push(t.reset()),this},addCounter:function(t){var e=o(this,t);return this.tweens.push(e.reset()),e},stagger:function(t,e){return l(t,e)},setLagSmooth:function(t,e){return void 0===t&&(t=1/1e-8),void 0===e&&(e=0),this.maxLag=t,this.lagSkip=Math.min(e,this.maxLag),this},setFps:function(t){return void 0===t&&(t=240),this.gap=1e3/t,this.nextTime=1e3*this.time+this.gap,this},getDelta:function(t){var e=Date.now()-this.prevTime;e>this.maxLag&&(this.startTime+=e-this.lagSkip),this.prevTime+=e;var i=this.prevTime-this.startTime,s=i-this.nextTime,n=i-1e3*this.time;return s>0||t?(i/=1e3,this.time=i,this.nextTime+=s+(s>=this.gap?4:this.gap-s)):n=0,n},tick:function(){return this.step(!0),this},update:function(){this.paused||this.step(!1)},step:function(t){void 0===t&&(t=!1);var e=this.getDelta(t);if(!(e<=0)){var i,s;this.processing=!0;var n=[],r=this.tweens;for(i=0;i0){for(i=0;i-1&&(s.isPendingRemove()||s.isDestroyed())&&(r.splice(a,1),s.destroy())}n.length=0}this.processing=!1}},remove:function(t){return this.processing?t.setPendingRemoveState():(s(this.tweens,t),t.setRemovedState()),this},reset:function(t){return this.existing(t),t.seek(),t.setActiveState(),this},makeActive:function(t){return this.existing(t),t.setActiveState(),this},each:function(t,e){var i,s=[null];for(i=1;i{t.exports=function(t,e,i){return t&&t.hasOwnProperty(e)?t[e]:i}},6113:(t,e,i)=>{var s=i(62640),n=i(35355);t.exports=function(t,e){var i=s.Power0;if("string"==typeof t)if(s.hasOwnProperty(t))i=s[t];else{var r="";if(t.indexOf(".")){var o=(r=t.substring(t.indexOf(".")+1)).toLowerCase();"in"===o?r="easeIn":"out"===o?r="easeOut":"inout"===o&&(r="easeInOut")}t=n(t.substring(0,t.indexOf(".")+1)+r),s.hasOwnProperty(t)&&(i=s[t])}else"function"==typeof t&&(i=t);if(!e)return i;var a=e.slice(0);return a.unshift(0),function(t){return a[0]=t,i.apply(this,a)}}},91389:(t,e,i)=>{var s=i(89318),n=i(77259),r={bezier:s,catmull:n,catmullrom:n,linear:i(28392)};t.exports=function(t){if(null===t)return null;var e=r.linear;return"string"==typeof t?r.hasOwnProperty(t)&&(e=r[t]):"function"==typeof t&&(e=t),e}},55292:t=>{t.exports=function(t,e,i){return t.hasOwnProperty(e)?"function"==typeof t[e]?function(i,s,n,r,o,a){return t[e](i,s,n,r,o,a)}:function(){return t[e]}:"function"==typeof i?i:function(){return i}}},82985:(t,e,i)=>{var s=i(81076);t.exports=function(t){var e,i=[];if(t.hasOwnProperty("props"))for(e in t.props)"_"!==e.substring(0,1)&&i.push({key:e,value:t.props[e]});else for(e in t)-1===s.indexOf(e)&&"_"!==e.substring(0,1)&&i.push({key:e,value:t[e]});return i}},62329:(t,e,i)=>{var s=i(35154);t.exports=function(t){var e=s(t,"targets",null);return null===e||("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e])),e}},17777:(t,e,i)=>{var s=i(30976),n=i(99472);function r(t){return!!t.getActive&&"function"==typeof t.getActive}function o(t){return!!t.getStart&&"function"==typeof t.getStart}function a(t){return!!t.getEnd&&"function"==typeof t.getEnd}var h=function(t,e){var i,l,u=function(t,e,i){return i},c=function(t,e,i){return i},d=null,f=typeof e;if("number"===f)u=function(){return e};else if(Array.isArray(e))c=function(){return e[0]},u=function(){return e[e.length-1]};else if("string"===f){var p=e.toLowerCase(),v="random"===p.substring(0,6),g="int"===p.substring(0,3);if(v||g){var m=p.indexOf("("),y=p.indexOf(")"),x=p.indexOf(",");if(!(m&&y&&x))throw new Error("invalid random() format");var T=parseFloat(p.substring(m+1,x)),w=parseFloat(p.substring(x+1,y));u=v?function(){return n(T,w)}:function(){return s(T,w)}}else{p=p[0];var b=parseFloat(e.substr(2));switch(p){case"+":u=function(t,e,i){return i+b};break;case"-":u=function(t,e,i){return i-b};break;case"*":u=function(t,e,i){return i*b};break;case"/":u=function(t,e,i){return i/b};break;default:u=function(){return parseFloat(e)}}}}else if("function"===f)u=e;else if("object"===f)if(o(l=e)||a(l)||r(l))r(e)&&(d=e.getActive),a(e)&&(u=e.getEnd),o(e)&&(c=e.getStart);else if(e.hasOwnProperty("value"))i=h(t,e.value);else{var S=e.hasOwnProperty("to"),E=e.hasOwnProperty("from"),A=e.hasOwnProperty("start");if(S&&(E||A)){if(i=h(t,e.to),A){var C=h(t,e.start);i.getActive=C.getEnd}if(E){var _=h(t,e.from);i.getStart=_.getEnd}}}return i||(i={getActive:d,getEnd:u,getStart:c}),i};t.exports=h},88032:(t,e,i)=>{var s=i(70402),n=i(69902),r=i(23568),o=i(57355),a=i(6113),h=i(55292),l=i(35154),u=i(17777),c=i(269),d=i(86081);t.exports=function(t,e,i){if(e instanceof d)return e.parent=t,e;i=void 0===i?n:c(n,i);var f=l(e,"from",0),p=l(e,"to",1),v=[{value:f}],g=l(e,"delay",i.delay),m=l(e,"easeParams",i.easeParams),y=l(e,"ease",i.ease),x=u("value",p),T=new d(t,v),w=T.add(0,"value",x.getEnd,x.getStart,x.getActive,a(l(e,"ease",y),l(e,"easeParams",m)),h(e,"delay",g),l(e,"duration",i.duration),o(e,"yoyo",i.yoyo),l(e,"hold",i.hold),l(e,"repeat",i.repeat),l(e,"repeatDelay",i.repeatDelay),!1,!1);w.start=f,w.current=f,T.completeDelay=r(e,"completeDelay",0),T.loop=Math.round(r(e,"loop",0)),T.loopDelay=Math.round(r(e,"loopDelay",0)),T.paused=o(e,"paused",!1),T.persist=o(e,"persist",!1),T.callbackScope=l(e,"callbackScope",T);for(var b=s.TYPES,S=0;S{var s=i(6113),n=i(35154),r=i(36383);t.exports=function(t,e){void 0===e&&(e={});var i=n(e,"start",0),o=n(e,"ease",null),a=n(e,"grid",null),h=n(e,"from",0),l="first"===h,u="center"===h,c="last"===h,d="number"==typeof h,f=Array.isArray(t),p=f?parseFloat(t[0]):parseFloat(t),v=f?parseFloat(t[1]):0,g=Math.max(p,v);if(f&&(i+=p),a){var m=a[0],y=a[1],x=0,T=0,w=0,b=0,S=[];c?(x=m-1,T=y-1):d?(x=h%m,T=Math.floor(h/m)):u&&(x=(m-1)/2,T=(y-1)/2);for(var E=r.MIN_SAFE_INTEGER,A=0;AE&&(E=_),S[A][C]=_}}}var M=o?s(o):null;return a?function(t,e,s,n){var r,o=0,a=n%m,h=Math.floor(n/m);if(a>=0&&a=0&&h{var s=i(70402),n=i(69902),r=i(23568),o=i(57355),a=i(6113),h=i(91389),l=i(55292),u=i(82985),c=i(62329),d=i(35154),f=i(17777),p=i(269),v=i(86081);t.exports=function(t,e,i){if(e instanceof v)return e.parent=t,e;i=void 0===i?n:p(n,i);var g=c(e);!g&&i.targets&&(g=i.targets);for(var m=u(e),y=d(e,"delay",i.delay),x=d(e,"duration",i.duration),T=d(e,"easeParams",i.easeParams),w=d(e,"ease",i.ease),b=d(e,"hold",i.hold),S=d(e,"repeat",i.repeat),E=d(e,"repeatDelay",i.repeatDelay),A=o(e,"yoyo",i.yoyo),C=o(e,"flipX",i.flipX),_=o(e,"flipY",i.flipY),M=d(e,"interpolation",i.interpolation),P=function(t,e,i,s){if("texture"===i){var n=s,r=void 0;Array.isArray(s)?(n=s[0],r=s[1]):s.hasOwnProperty("value")?(n=s.value,Array.isArray(s.value)?(n=s.value[0],r=s.value[1]):"string"==typeof s.value&&(n=s.value)):"string"==typeof s&&(n=s),t.addFrame(e,n,r,l(s,"delay",y),d(s,"duration",x),d(s,"hold",b),d(s,"repeat",S),d(s,"repeatDelay",E),o(s,"flipX",C),o(s,"flipY",_))}else{var u=f(i,s),c=h(d(s,"interpolation",M));t.add(e,i,u.getEnd,u.getStart,u.getActive,a(d(s,"ease",w),d(s,"easeParams",T)),l(s,"delay",y),d(s,"duration",x),o(s,"yoyo",A),d(s,"hold",b),d(s,"repeat",S),d(s,"repeatDelay",E),o(s,"flipX",C),o(s,"flipY",_),c,c?s:null)}},R=new v(t,g),L=0;L{var s=i(70402),n=i(23568),r=i(57355),o=i(62329),a=i(35154),h=i(8357),l=i(43960);t.exports=function(t,e){if(e instanceof l)return e.parent=t,e;var i,u=new l(t);u.startDelay=a(e,"delay",0),u.completeDelay=n(e,"completeDelay",0),u.loop=Math.round(n(e,"loop",a(e,"repeat",0))),u.loopDelay=Math.round(n(e,"loopDelay",a(e,"repeatDelay",0))),u.paused=r(e,"paused",!1),u.persist=r(e,"persist",!1),u.callbackScope=a(e,"callbackScope",u);var c=s.TYPES;for(i=0;i{t.exports={GetBoolean:i(57355),GetEaseFunction:i(6113),GetInterpolationFunction:i(91389),GetNewValue:i(55292),GetProps:i(82985),GetTargets:i(62329),GetValueOp:i(17777),NumberTweenBuilder:i(88032),StaggerBuilder:i(93109),TweenBuilder:i(8357)}},73685:t=>{t.exports="active"},98540:t=>{t.exports="complete"},67233:t=>{t.exports="loop"},2859:t=>{t.exports="pause"},98336:t=>{t.exports="repeat"},25764:t=>{t.exports="resume"},32193:t=>{t.exports="start"},84371:t=>{t.exports="stop"},70766:t=>{t.exports="update"},55659:t=>{t.exports="yoyo"},842:(t,e,i)=>{t.exports={TWEEN_ACTIVE:i(73685),TWEEN_COMPLETE:i(98540),TWEEN_LOOP:i(67233),TWEEN_PAUSE:i(2859),TWEEN_RESUME:i(25764),TWEEN_REPEAT:i(98336),TWEEN_START:i(32193),TWEEN_STOP:i(84371),TWEEN_UPDATE:i(70766),TWEEN_YOYO:i(55659)}},43066:(t,e,i)=>{var s={States:i(86353),Builders:i(30231),Events:i(842),TweenManager:i(40382),Tween:i(86081),TweenData:i(48177),TweenFrameData:i(42220),BaseTween:i(70402),TweenChain:i(43960)};t.exports=s},70402:(t,e,i)=>{var s=i(83419),n=i(50792),r=i(842),o=i(86353),a=new s({Extends:n,initialize:function(t){n.call(this),this.parent=t,this.data=[],this.totalData=0,this.startDelay=0,this.hasStarted=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.state=o.PENDING,this.paused=!1,this.callbacks={onActive:null,onComplete:null,onLoop:null,onPause:null,onRepeat:null,onResume:null,onStart:null,onStop:null,onUpdate:null,onYoyo:null},this.callbackScope,this.persist=!1},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return!this.paused&&this.isActive()},isPaused:function(){return this.paused},pause:function(){return this.paused||(this.paused=!0,this.dispatchEvent(r.TWEEN_PAUSE,"onPause")),this},resume:function(){return this.paused&&(this.paused=!1,this.dispatchEvent(r.TWEEN_RESUME,"onResume")),this},makeActive:function(){this.parent.makeActive(this),this.dispatchEvent(r.TWEEN_ACTIVE,"onActive")},onCompleteHandler:function(){this.setPendingRemoveState(),this.dispatchEvent(r.TWEEN_COMPLETE,"onComplete")},complete:function(t){return void 0===t&&(t=0),t?(this.setCompleteDelayState(),this.countdown=t):this.onCompleteHandler(),this},completeAfterLoop:function(t){return void 0===t&&(t=0),this.loopCounter>t&&(this.loopCounter=t),this},remove:function(){return this.parent&&this.parent.remove(this),this},stop:function(){return!this.parent||this.isRemoved()||this.isPendingRemove()||this.isDestroyed()||(this.dispatchEvent(r.TWEEN_STOP,"onStop"),this.setPendingRemoveState()),this},updateLoopCountdown:function(t){this.countdown-=t,this.countdown<=0&&(this.setActiveState(),this.dispatchEvent(r.TWEEN_LOOP,"onLoop"))},updateStartCountdown:function(t){return this.countdown-=t,this.countdown<=0&&(this.hasStarted=!0,this.setActiveState(),this.dispatchEvent(r.TWEEN_START,"onStart"),t=0),t},updateCompleteDelay:function(t){this.countdown-=t,this.countdown<=0&&this.onCompleteHandler()},setCallback:function(t,e,i){return void 0===i&&(i=[]),this.callbacks.hasOwnProperty(t)&&(this.callbacks[t]={func:e,params:i}),this},setPendingState:function(){this.state=o.PENDING},setActiveState:function(){this.state=o.ACTIVE},setLoopDelayState:function(){this.state=o.LOOP_DELAY},setCompleteDelayState:function(){this.state=o.COMPLETE_DELAY},setStartDelayState:function(){this.state=o.START_DELAY,this.countdown=this.startDelay,this.hasStarted=!1},setPendingRemoveState:function(){this.state=o.PENDING_REMOVE},setRemovedState:function(){this.state=o.REMOVED},setFinishedState:function(){this.state=o.FINISHED},setDestroyedState:function(){this.state=o.DESTROYED},isPending:function(){return this.state===o.PENDING},isActive:function(){return this.state===o.ACTIVE},isLoopDelayed:function(){return this.state===o.LOOP_DELAY},isCompleteDelayed:function(){return this.state===o.COMPLETE_DELAY},isStartDelayed:function(){return this.state===o.START_DELAY},isPendingRemove:function(){return this.state===o.PENDING_REMOVE},isRemoved:function(){return this.state===o.REMOVED},isFinished:function(){return this.state===o.FINISHED},isDestroyed:function(){return this.state===o.DESTROYED},destroy:function(){this.data&&this.data.forEach((function(t){t.destroy()})),this.removeAllListeners(),this.callbacks=null,this.data=null,this.parent=null,this.setDestroyedState()}});a.TYPES=["onActive","onComplete","onLoop","onPause","onRepeat","onResume","onStart","onStop","onUpdate","onYoyo"],t.exports=a},95042:(t,e,i)=>{var s=i(83419),n=i(842),r=i(86353),o=new s({initialize:function(t,e,i,s,n,r,o,a,h,l){this.tween=t,this.targetIndex=e,this.duration=s,this.totalDuration=0,this.delay=0,this.getDelay=i,this.yoyo=n,this.hold=r,this.repeat=o,this.repeatDelay=a,this.repeatCounter=0,this.flipX=h,this.flipY=l,this.progress=0,this.elapsed=0,this.state=0,this.isCountdown=!1},getTarget:function(){return this.tween.targets[this.targetIndex]},setTargetValue:function(t){void 0===t&&(t=this.current),this.tween.targets[this.targetIndex][this.key]=t},setCreatedState:function(){this.state=r.CREATED,this.isCountdown=!1},setDelayState:function(){this.state=r.DELAY,this.isCountdown=!0},setPendingRenderState:function(){this.state=r.PENDING_RENDER,this.isCountdown=!1},setPlayingForwardState:function(){this.state=r.PLAYING_FORWARD,this.isCountdown=!1},setPlayingBackwardState:function(){this.state=r.PLAYING_BACKWARD,this.isCountdown=!1},setHoldState:function(){this.state=r.HOLD_DELAY,this.isCountdown=!0},setRepeatState:function(){this.state=r.REPEAT_DELAY,this.isCountdown=!0},setCompleteState:function(){this.state=r.COMPLETE,this.isCountdown=!1},isCreated:function(){return this.state===r.CREATED},isDelayed:function(){return this.state===r.DELAY},isPendingRender:function(){return this.state===r.PENDING_RENDER},isPlayingForward:function(){return this.state===r.PLAYING_FORWARD},isPlayingBackward:function(){return this.state===r.PLAYING_BACKWARD},isHolding:function(){return this.state===r.HOLD_DELAY},isRepeating:function(){return this.state===r.REPEAT_DELAY},isComplete:function(){return this.state===r.COMPLETE},setStateFromEnd:function(t){this.yoyo?this.onRepeat(t,!0,!0):this.repeatCounter>0?this.onRepeat(t,!0,!1):this.setCompleteState()},setStateFromStart:function(t){this.repeatCounter>0?this.onRepeat(t,!1):this.setCompleteState()},reset:function(){var t=this.tween,e=t.totalTargets,i=this.targetIndex,s=t.targets[i],n=this.key;this.progress=0,this.elapsed=0,this.delay=this.getDelay(s,n,0,i,e,t),this.repeatCounter=-1===this.repeat?r.MAX:this.repeat,this.setPendingRenderState();var o=this.duration+this.hold;this.yoyo&&(o+=this.duration);var a=o+this.repeatDelay;this.totalDuration=this.delay+o,-1===this.repeat?(this.totalDuration+=a*r.MAX,t.isInfinite=!0):this.repeat>0&&(this.totalDuration+=a*this.repeat),this.totalDuration>t.duration&&(t.duration=this.totalDuration),this.delay0&&(this.elapsed=this.delay,this.setDelayState())},onRepeat:function(t,e,i){var s=this.tween,r=s.totalTargets,o=this.targetIndex,a=s.targets[o],h=this.key,l="texture"!==h;if(this.elapsed=t,this.progress=t/this.duration,this.flipX&&a.toggleFlipX(),this.flipY&&a.toggleFlipY(),l&&(e||i)&&(this.start=this.getStartValue(a,h,this.start,o,r,s)),i)return this.setPlayingBackwardState(),void this.dispatchEvent(n.TWEEN_YOYO,"onYoyo");this.repeatCounter--,l&&(this.end=this.getEndValue(a,h,this.start,o,r,s)),this.repeatDelay>0?(this.elapsed=this.repeatDelay-t,l&&(this.current=this.start,a[h]=this.current),this.setRepeatState()):(this.setPlayingForwardState(),this.dispatchEvent(n.TWEEN_REPEAT,"onRepeat"))},destroy:function(){this.tween=null,this.getDelay=null,this.setCompleteState()}});t.exports=o},69902:t=>{t.exports={targets:null,delay:0,duration:1e3,ease:"Power0",easeParams:null,hold:0,repeat:0,repeatDelay:0,yoyo:!1,flipX:!1,flipY:!1,persist:!1,interpolation:null}},81076:t=>{t.exports=["callbackScope","completeDelay","delay","duration","ease","easeParams","flipX","flipY","hold","interpolation","loop","loopDelay","onActive","onActiveParams","onComplete","onCompleteParams","onLoop","onLoopParams","onPause","onPauseParams","onRepeat","onRepeatParams","onResume","onResumeParams","onStart","onStartParams","onStop","onStopParams","onUpdate","onUpdateParams","onYoyo","onYoyoParams","paused","persist","props","repeat","repeatDelay","targets","yoyo"]},86081:(t,e,i)=>{var s=i(70402),n=i(83419),r=i(842),o=i(44603),a=i(39429),h=i(36383),l=i(86353),u=i(48177),c=i(42220),d=new n({Extends:s,initialize:function(t,e){s.call(this,t),this.targets=e,this.totalTargets=e.length,this.isSeeking=!1,this.isInfinite=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0},add:function(t,e,i,s,n,r,o,a,h,l,c,d,f,p,v,g){var m=new u(this,t,e,i,s,n,r,o,a,h,l,c,d,f,p,v,g);return this.totalData=this.data.push(m),m},addFrame:function(t,e,i,s,n,r,o,a,h,l){var u=new c(this,t,e,i,s,n,r,o,a,h,l);return this.totalData=this.data.push(u),u},getValue:function(t){void 0===t&&(t=0);var e=null;return this.data&&(e=this.data[t].current),e},hasTarget:function(t){return this.targets&&-1!==this.targets.indexOf(t)},updateTo:function(t,e,i){if(void 0===i&&(i=!1),"texture"!==t)for(var s=0;s0)this.elapsed=0,this.progress=0,this.loopCounter--,this.initTweenData(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.setLoopDelayState()):(this.setActiveState(),this.dispatchEvent(r.TWEEN_LOOP,"onLoop"));else{if(!(this.completeDelay>0))return this.onCompleteHandler(),!0;this.countdown=this.completeDelay,this.setCompleteDelayState()}return!1},onCompleteHandler:function(){this.progress=1,this.totalProgress=1,s.prototype.onCompleteHandler.call(this)},play:function(){return this.isDestroyed()?(console.warn("Cannot play destroyed Tween",this),this):((this.isPendingRemove()||this.isFinished())&&this.seek(),this.paused=!1,this.setActiveState(),this)},seek:function(t,e,i){if(void 0===t&&(t=0),void 0===e&&(e=16.6),void 0===i&&(i=!1),this.isDestroyed())return console.warn("Cannot seek destroyed Tween",this),this;i||(this.isSeeking=!0),this.reset(!0),this.initTweenData(!0),this.setActiveState(),this.dispatchEvent(r.TWEEN_ACTIVE,"onActive");var s=this.paused;if(this.paused=!1,t>0){for(var n=Math.floor(t/e),o=t-n*e,a=0;a0&&this.update(o)}return this.paused=s,this.isSeeking=!1,this},initTweenData:function(t){void 0===t&&(t=!1),this.duration=0,this.startDelay=h.MAX_SAFE_INTEGER;for(var e=this.data,i=0;i0?s+n+(s+o)*r:s+n},reset:function(t){return void 0===t&&(t=!1),this.elapsed=0,this.totalElapsed=0,this.progress=0,this.totalProgress=0,this.loopCounter=this.loop,-1===this.loop&&(this.isInfinite=!0,this.loopCounter=l.MAX),t||(this.initTweenData(),this.setActiveState(),this.dispatchEvent(r.TWEEN_ACTIVE,"onActive")),this},update:function(t){if(this.isPendingRemove()||this.isDestroyed())return!0;if(this.paused||this.isFinished())return!1;if(t*=this.timeScale*this.parent.timeScale,this.isLoopDelayed())return this.updateLoopCountdown(t),!1;if(this.isCompleteDelayed())return this.updateCompleteDelay(t),!1;this.hasStarted||(this.startDelay-=t,this.startDelay<=0&&(this.hasStarted=!0,this.dispatchEvent(r.TWEEN_START,"onStart"),t=0));var e=!1;if(this.isActive())for(var i=this.data,s=0;s{var s=i(72905),n=i(70402),r=i(83419),o=i(842),a=i(44603),h=i(39429),l=i(86353),u=new r({Extends:n,initialize:function(t){n.call(this,t),this.currentTween=null,this.currentIndex=0},init:function(){return this.loopCounter=-1===this.loop?l.MAX:this.loop,this.setCurrentTween(0),this.startDelay>0&&!this.isStartDelayed()?this.setStartDelayState():this.setActiveState(),this.dispatchEvent(o.TWEEN_ACTIVE,"onActive"),this},add:function(t){var e=this.parent.create(t);Array.isArray(e)||(e=[e]);for(var i=this.data,s=0;s0)this.loopCounter--,this.resetTweens(),this.loopDelay>0?(this.countdown=this.loopDelay,this.setLoopDelayState()):(this.setActiveState(),this.dispatchEvent(o.TWEEN_LOOP,"onLoop"));else{if(!(this.completeDelay>0))return this.onCompleteHandler(),!0;this.countdown=this.completeDelay,this.setCompleteDelayState()}return!1},play:function(){return this.isDestroyed()?(console.warn("Cannot play destroyed TweenChain",this),this):((this.isPendingRemove()||this.isPending())&&this.resetTweens(),this.paused=!1,this.startDelay>0&&!this.isStartDelayed()?this.setStartDelayState():this.setActiveState(),this)},resetTweens:function(){for(var t=this.data,e=this.totalData,i=0;i{var s=i(95042),n=i(45319),r=i(83419),o=i(842),a=new r({Extends:s,initialize:function(t,e,i,n,r,o,a,h,l,u,c,d,f,p,v,g,m){s.call(this,t,e,h,l,u,c,d,f,p,v),this.key=i,this.getActiveValue=o,this.getEndValue=n,this.getStartValue=r,this.ease=a,this.start=0,this.previous=0,this.current=0,this.end=0,this.interpolation=g,this.interpolationData=m},reset:function(t){s.prototype.reset.call(this);var e=this.tween.targets[this.targetIndex],i=this.key;t&&(e[i]=this.start),this.start=0,this.previous=0,this.current=0,this.end=0,this.getActiveValue&&(e[i]=this.getActiveValue(e,i,0))},update:function(t){var e=this.tween,i=e.totalTargets,s=this.targetIndex,r=e.targets[s],a=this.key;if(!r)return this.setCompleteState(),!1;if(this.isCountdown&&(this.elapsed-=t,this.elapsed<=0&&(this.elapsed=0,t=0,this.isDelayed()?this.setPendingRenderState():this.isRepeating()?(this.setPlayingForwardState(),this.dispatchEvent(o.TWEEN_REPEAT,"onRepeat")):this.isHolding()&&this.setStateFromEnd(0))),this.isPendingRender())return this.start=this.getStartValue(r,a,r[a],s,i,e),this.end=this.getEndValue(r,a,this.start,s,i,e),this.current=this.start,r[a]=this.start,this.setPlayingForwardState(),!0;var h=this.isPlayingForward(),l=this.isPlayingBackward();if(h||l){var u=this.elapsed,c=this.duration,d=0,f=!1;(u+=t)>=c?(d=u-c,u=c,f=!0):u<0&&(u=0);var p=n(u/c,0,1);if(this.elapsed=u,this.progress=p,this.previous=this.current,f)h?(this.current=this.end,r[a]=this.end,this.hold>0?(this.elapsed=this.hold,this.setHoldState()):this.setStateFromEnd(d)):(this.current=this.start,r[a]=this.start,this.setStateFromStart(d));else{h||(p=1-p);var v=this.ease(p);this.interpolation?this.current=this.interpolation(this.interpolationData,v):this.current=this.start+(this.end-this.start)*v,r[a]=this.current}this.dispatchEvent(o.TWEEN_UPDATE,"onUpdate")}return!this.isComplete()},dispatchEvent:function(t,e){var i=this.tween;if(!i.isSeeking){var s=i.targets[this.targetIndex],n=this.key,r=this.current,o=this.previous;i.emit(t,i,n,s,r,o);var a=i.callbacks[e];a&&a.func.apply(i.callbackScope,[i,s,n,r,o].concat(a.params))}},destroy:function(){s.prototype.destroy.call(this),this.getActiveValue=null,this.getEndValue=null,this.getStartValue=null,this.ease=null}});t.exports=a},42220:(t,e,i)=>{var s=i(95042),n=i(45319),r=i(83419),o=i(842),a=new r({Extends:s,initialize:function(t,e,i,n,r,o,a,h,l,u,c){s.call(this,t,e,r,o,!1,a,h,l,u,c),this.key="texture",this.startTexture=null,this.endTexture=i,this.startFrame=null,this.endFrame=n,this.yoyo=0!==h},reset:function(t){s.prototype.reset.call(this);var e=this.tween.targets[this.targetIndex];this.startTexture||(this.startTexture=e.texture.key,this.startFrame=e.frame.name),t&&e.setTexture(this.startTexture,this.startFrame)},update:function(t){var e=this.tween,i=this.targetIndex,s=e.targets[i];if(!s)return this.setCompleteState(),!1;if(this.isCountdown&&(this.elapsed-=t,this.elapsed<=0&&(this.elapsed=0,t=0,this.isDelayed()?this.setPendingRenderState():this.isRepeating()?(this.setPlayingForwardState(),this.dispatchEvent(o.TWEEN_REPEAT,"onRepeat")):this.isHolding()&&this.setStateFromEnd(0))),this.isPendingRender())return this.startTexture&&s.setTexture(this.startTexture,this.startFrame),this.setPlayingForwardState(),!0;var r=this.isPlayingForward(),a=this.isPlayingBackward();if(r||a){var h=this.elapsed,l=this.duration,u=0,c=!1;(h+=t)>=l?(u=h-l,h=l,c=!0):h<0&&(h=0);var d=n(h/l,0,1);this.elapsed=h,this.progress=d,c&&(r?(s.setTexture(this.endTexture,this.endFrame),this.hold>0?(this.elapsed=this.hold,this.setHoldState()):this.setStateFromEnd(u)):(s.setTexture(this.startTexture,this.startFrame),this.setStateFromStart(u))),this.dispatchEvent(o.TWEEN_UPDATE,"onUpdate")}return!this.isComplete()},dispatchEvent:function(t,e){var i=this.tween;if(!i.isSeeking){var s=i.targets[this.targetIndex],n=this.key;i.emit(t,i,n,s);var r=i.callbacks[e];r&&r.func.apply(i.callbackScope,[i,s,n].concat(r.params))}},destroy:function(){s.prototype.destroy.call(this),this.startTexture=null,this.endTexture=null,this.startFrame=null,this.endFrame=null}});t.exports=a},86353:t=>{t.exports={CREATED:0,DELAY:2,PENDING_RENDER:4,PLAYING_FORWARD:5,PLAYING_BACKWARD:6,HOLD_DELAY:7,REPEAT_DELAY:8,COMPLETE:9,PENDING:20,ACTIVE:21,LOOP_DELAY:22,COMPLETE_DELAY:23,START_DELAY:24,PENDING_REMOVE:25,REMOVED:26,FINISHED:27,DESTROYED:28,MAX:999999999999}},83419:t=>{function e(t,e,i){var s=i?t[e]:Object.getOwnPropertyDescriptor(t,e);return!i&&s.value&&"object"==typeof s.value&&(s=s.value),!(!s||!function(t){return!!t.get&&"function"==typeof t.get||!!t.set&&"function"==typeof t.set}(s))&&(void 0===s.enumerable&&(s.enumerable=!0),void 0===s.configurable&&(s.configurable=!0),s)}function i(t,e){var i=Object.getOwnPropertyDescriptor(t,e);return!!i&&(i.value&&"object"==typeof i.value&&(i=i.value),!1===i.configurable)}function s(t,s,n,o){for(var a in s)if(s.hasOwnProperty(a)){var h=e(s,a,n);if(!1!==h){if(i((o||t).prototype,a)){if(r.ignoreFinals)continue;throw new Error("cannot override final property '"+a+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,a,h)}else t.prototype[a]=s[a]}}function n(t,e){if(e){Array.isArray(e)||(e=[e]);for(var i=0;i{t.exports=function(){}},20242:t=>{t.exports=function(){return null}},71146:t=>{t.exports=function(t,e,i,s,n){if(void 0===n&&(n=t),i>0){var r=i-t.length;if(r<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.push(e),s&&s.call(n,e),e):null;for(var o=e.length-1;o>=0;)-1!==t.indexOf(e[o])&&e.splice(o,1),o--;if(0===(o=e.length))return null;i>0&&o>r&&(e.splice(r),o=r);for(var a=0;a{t.exports=function(t,e,i,s,n,r){if(void 0===i&&(i=0),void 0===r&&(r=t),s>0){var o=s-t.length;if(o<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.splice(i,0,e),n&&n.call(r,e),e):null;for(var a=e.length-1;a>=0;)-1!==t.indexOf(e[a])&&e.pop(),a--;if(0===(a=e.length))return null;s>0&&a>o&&(e.splice(o),a=o);for(var h=a-1;h>=0;h--){var l=e[h];t.splice(i,0,l),n&&n.call(r,l)}return e}},66905:t=>{t.exports=function(t,e){var i=t.indexOf(e);return-1!==i&&i{var s=i(82011);t.exports=function(t,e,i,n,r){void 0===n&&(n=0),void 0===r&&(r=t.length);var o=0;if(s(t,n,r))for(var a=n;a{t.exports=function(t,e,i){var s,n=[null];for(s=3;s{var s=i(82011);t.exports=function(t,e,i,n,r){if(void 0===n&&(n=0),void 0===r&&(r=t.length),s(t,n,r)){var o,a=[null];for(o=5;o{t.exports=function(t,e,i){if(!e.length)return NaN;if(1===e.length)return e[0];var s,n,r=1;if(i){if(te.length&&(r=e.length),i?(s=e[r-1][i],(n=e[r][i])-t<=t-s?e[r]:e[r-1]):(s=e[r-1],(n=e[r])-t<=t-s?n:s)}},43491:t=>{var e=function(t,i){void 0===i&&(i=[]);for(var s=0;s{var s=i(82011);t.exports=function(t,e,i,n,r){void 0===n&&(n=0),void 0===r&&(r=t.length);var o=[];if(s(t,n,r))for(var a=n;a{var s=i(82011);t.exports=function(t,e,i,n,r){if(void 0===n&&(n=0),void 0===r&&(r=t.length),s(t,n,r))for(var o=n;o{t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var s=e+Math.floor(Math.random()*i);return void 0===t[s]?null:t[s]}},85835:t=>{t.exports=function(t,e,i){if(e===i)return t;var s=t.indexOf(e),n=t.indexOf(i);if(s<0||n<0)throw new Error("Supplied items must be elements of the same array");return s>n||(t.splice(s,1),n===t.length-1?t.push(e):t.splice(n,0,e)),t}},83371:t=>{t.exports=function(t,e,i){if(e===i)return t;var s=t.indexOf(e),n=t.indexOf(i);if(s<0||n<0)throw new Error("Supplied items must be elements of the same array");return s{t.exports=function(t,e){var i=t.indexOf(e);if(i>0){var s=t[i-1],n=t.indexOf(s);t[i]=s,t[n]=e}return t}},69693:t=>{t.exports=function(t,e,i){var s=t.indexOf(e);if(-1===s||i<0||i>=t.length)throw new Error("Supplied index out of bounds");return s!==i&&(t.splice(s,1),t.splice(i,0,e)),e}},40853:t=>{t.exports=function(t,e){var i=t.indexOf(e);if(-1!==i&&i{t.exports=function(t,e,i,s){var n,r=[],o=!1;if((i||s)&&(o=!0,i||(i=""),s||(s="")),e=e;n--)o?r.push(i+n.toString()+s):r.push(n);else for(n=t;n<=e;n++)o?r.push(i+n.toString()+s):r.push(n);return r}},593:(t,e,i)=>{var s=i(2284);t.exports=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=1),null===e&&(e=t,t=0);for(var n=[],r=Math.max(s((e-t)/(i||1)),0),o=0;o{function e(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function i(t,e){return te?1:0}var s=function(t,n,r,o,a){for(void 0===r&&(r=0),void 0===o&&(o=t.length-1),void 0===a&&(a=i);o>r;){if(o-r>600){var h=o-r+1,l=n-r+1,u=Math.log(h),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(h-c)/h)*(l-h/2<0?-1:1),f=Math.max(r,Math.floor(n-l*c/h+d)),p=Math.min(o,Math.floor(n+(h-l)*c/h+d));s(t,n,f,p,a)}var v=t[n],g=r,m=o;for(e(t,r,n),a(t[o],v)>0&&e(t,r,o);g0;)m--}0===a(t[r],v)?e(t,r,m):e(t,++m,o),m<=n&&(r=m+1),n<=m&&(o=m-1)}};t.exports=s},88492:(t,e,i)=>{var s=i(35154),n=i(33680),r=function(t,e,i){for(var s=[],n=0;n{var s=i(19133);t.exports=function(t,e,i,n){var r;if(void 0===n&&(n=t),!Array.isArray(e))return-1!==(r=t.indexOf(e))?(s(t,r),i&&i.call(n,e),e):null;for(var o=e.length-1,a=[];o>=0;){var h=e[o];-1!==(r=t.indexOf(h))&&(s(t,r),a.push(h),i&&i.call(n,h)),o--}return a}},60248:(t,e,i)=>{var s=i(19133);t.exports=function(t,e,i,n){if(void 0===n&&(n=t),e<0||e>t.length-1)throw new Error("Index out of bounds");var r=s(t,e);return i&&i.call(n,r),r}},81409:(t,e,i)=>{var s=i(82011);t.exports=function(t,e,i,n,r){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===r&&(r=t),s(t,e,i)){var o=i-e,a=t.splice(e,o);if(n)for(var h=0;h{var s=i(19133);t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);return s(t,n)}},42169:t=>{t.exports=function(t,e,i){var s=t.indexOf(e),n=t.indexOf(i);return-1!==s&&-1===n&&(t[s]=i,!0)}},86003:t=>{t.exports=function(t,e){void 0===e&&(e=1);for(var i=null,s=0;s{t.exports=function(t,e){void 0===e&&(e=1);for(var i=null,s=0;s{t.exports=function(t,e,i,s){var n=t.length;if(e<0||e>n||e>=i||i>n){if(s)throw new Error("Range Error: Values outside acceptable range");return!1}return!0}},89545:t=>{t.exports=function(t,e){var i=t.indexOf(e);return-1!==i&&i>0&&(t.splice(i,1),t.unshift(e)),e}},17810:(t,e,i)=>{var s=i(82011);t.exports=function(t,e,i,n,r){if(void 0===n&&(n=0),void 0===r&&(r=t.length),s(t,n,r))for(var o=n;o{t.exports=function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[i],t[i]=s}return t}},90126:t=>{t.exports=function(t){var e=/\D/g;return t.sort((function(t,i){return parseInt(t.replace(e,""),10)-parseInt(i.replace(e,""),10)})),t}},19133:t=>{t.exports=function(t,e){if(!(e>=t.length)){for(var i=t.length-1,s=t[e],n=e;n{var s=i(82264);function n(t,e){return String(t).localeCompare(e)}function r(t,e,i,s){var n,r,o,a,h,l=t.length,u=0,c=2*i;for(n=0;nl&&(r=l),o>l&&(o=l),a=n,h=r;;)if(a{t.exports=function(t,e,i){if(e===i)return t;var s=t.indexOf(e),n=t.indexOf(i);if(s<0||n<0)throw new Error("Supplied items must be elements of the same array");return t[s]=i,t[n]=e,t}},37105:(t,e,i)=>{t.exports={Matrix:i(54915),Add:i(71146),AddAt:i(51067),BringToTop:i(66905),CountAllMatching:i(21612),Each:i(95428),EachInRange:i(36914),FindClosestInSorted:i(81957),Flatten:i(43491),GetAll:i(46710),GetFirst:i(58731),GetRandom:i(26546),MoveDown:i(70864),MoveTo:i(69693),MoveUp:i(40853),MoveAbove:i(85835),MoveBelow:i(83371),NumberArray:i(20283),NumberArrayStep:i(593),QuickSelect:i(43886),Range:i(88492),Remove:i(72905),RemoveAt:i(60248),RemoveBetween:i(81409),RemoveRandomElement:i(31856),Replace:i(42169),RotateLeft:i(86003),RotateRight:i(49498),SafeRange:i(82011),SendToBack:i(89545),SetAll:i(17810),Shuffle:i(33680),SortByDigits:i(90126),SpliceOne:i(19133),StableSort:i(19186),Swap:i(25630)}},86922:t=>{t.exports=function(t){if(!Array.isArray(t)||!Array.isArray(t[0]))return!1;for(var e=t[0].length,i=1;i{var s=i(41836),n=i(86922);t.exports=function(t){var e="";if(!n(t))return e;for(var i=0;i{t.exports=function(t){return t.reverse()}},21224:t=>{t.exports=function(t){for(var e=0;e{var s=i(37829);t.exports=function(t){return s(t,180)}},44657:(t,e,i)=>{var s=i(37829);t.exports=function(t,e){void 0===e&&(e=1);for(var i=0;i{var s=i(86922),n=i(2429);t.exports=function(t,e){if(void 0===e&&(e=90),!s(t))return null;if("string"!=typeof e&&(e=(e%360+360)%360),90===e||-270===e||"rotateLeft"===e)(t=n(t)).reverse();else if(-90===e||270===e||"rotateRight"===e)t.reverse(),t=n(t);else if(180===Math.abs(e)||"rotate180"===e){for(var i=0;i{var s=i(37829);t.exports=function(t,e){void 0===e&&(e=1);for(var i=0;i{var s=i(86003),n=i(49498);t.exports=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),0!==i&&(i<0?s(t,Math.abs(i)):n(t,i)),0!==e)for(var r=0;r{t.exports=function(t){for(var e=t.length,i=t[0].length,s=new Array(i),n=0;n-1;r--)s[n][r]=t[r][n]}return s}},54915:(t,e,i)=>{t.exports={CheckMatrix:i(86922),MatrixToString:i(63362),ReverseColumns:i(92598),ReverseRows:i(21224),Rotate180:i(98717),RotateLeft:i(44657),RotateMatrix:i(37829),RotateRight:i(92632),Translate:i(69512),TransposeMatrix:i(2429)}},71334:t=>{var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";t.exports=function(t,i){for(var s=new Uint8Array(t),n=s.length,r=i?"data:"+i+";base64,":"",o=0;o>2],r+=e[(3&s[o])<<4|s[o+1]>>4],r+=e[(15&s[o+1])<<2|s[o+2]>>6],r+=e[63&s[o+2]];return n%3==2?r=r.substring(0,r.length-1)+"=":n%3==1&&(r=r.substring(0,r.length-2)+"=="),r}},53134:t=>{for(var e=new Uint8Array(256),i=0;i<64;i++)e["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(i)]=i;t.exports=function(t){var i,s,n,r,o=(t=t.substr(t.indexOf(",")+1)).length,a=.75*o,h=0;"="===t[o-1]&&(a--,"="===t[o-2]&&a--);for(var l=new ArrayBuffer(a),u=new Uint8Array(l),c=0;c>4,u[h++]=(15&s)<<4|n>>2,u[h++]=(3&n)<<6|63&r;return l}},65839:(t,e,i)=>{t.exports={ArrayBufferToBase64:i(71334),Base64ToArrayBuffer:i(53134)}},91799:(t,e,i)=>{t.exports={Array:i(37105),Base64:i(65839),Objects:i(1183),String:i(31749),NOOP:i(29747),NULL:i(20242)}},41786:t=>{t.exports=function(t){var e={};for(var i in t)Array.isArray(t[i])?e[i]=t[i].slice(0):e[i]=t[i];return e}},62644:t=>{var e=function(t){var i,s,n;if("object"!=typeof t||null===t)return t;for(n in i=Array.isArray(t)?[]:{},t)s=t[n],i[n]=e(s);return i};t.exports=e},79291:(t,e,i)=>{var s=i(41212),n=function(){var t,e,i,r,o,a,h=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof h&&(c=h,h=arguments[1]||{},l=2),u===l&&(h=this,--l);l{var s=i(75508),n=i(35154);t.exports=function(t,e,i){var r=n(t,e,null);if(null===r)return i;if(Array.isArray(r))return s.RND.pick(r);if("object"==typeof r){if(r.hasOwnProperty("randInt"))return s.RND.integerInRange(r.randInt[0],r.randInt[1]);if(r.hasOwnProperty("randFloat"))return s.RND.realInRange(r.randFloat[0],r.randFloat[1])}else if("function"==typeof r)return r(e);return r}},95540:t=>{t.exports=function(t,e,i){var s=typeof t;return t&&"number"!==s&&"string"!==s&&t.hasOwnProperty(e)&&void 0!==t[e]?t[e]:i}},82840:(t,e,i)=>{var s=i(35154),n=i(45319);t.exports=function(t,e,i,r,o){void 0===o&&(o=i);var a=s(t,e,o);return n(a,i,r)}},35154:t=>{t.exports=function(t,e,i,s){if(!t&&!s||"number"==typeof t)return i;if(t&&t.hasOwnProperty(e))return t[e];if(s&&s.hasOwnProperty(e))return s[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),r=t,o=s,a=i,h=i,l=!0,u=!0,c=0;c{t.exports=function(t,e){for(var i=0;i{t.exports=function(t,e){for(var i=0;i{t.exports=function(t,e){return t.hasOwnProperty(e)}},41212:t=>{t.exports=function(t){if(!t||"object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}return!0}},46975:(t,e,i)=>{var s=i(41786);t.exports=function(t,e){var i=s(t);for(var n in e)i.hasOwnProperty(n)||(i[n]=e[n]);return i}},269:(t,e,i)=>{var s=i(41786);t.exports=function(t,e){var i=s(t);for(var n in e)i.hasOwnProperty(n)&&(i[n]=e[n]);return i}},18254:(t,e,i)=>{var s=i(97022);t.exports=function(t,e){for(var i={},n=0;n{t.exports=function(t,e,i){if(!t||"number"==typeof t)return!1;if(t.hasOwnProperty(e))return t[e]=i,!0;if(-1!==e.indexOf(".")){for(var s=e.split("."),n=t,r=t,o=0;o{t.exports={Clone:i(41786),DeepCopy:i(62644),Extend:i(79291),GetAdvancedValue:i(23568),GetFastValue:i(95540),GetMinMaxValue:i(82840),GetValue:i(35154),HasAll:i(69036),HasAny:i(1985),HasValue:i(97022),IsPlainObject:i(41212),Merge:i(46975),MergeRight:i(269),Pick:i(18254),SetValue:i(61622)}},27902:t=>{t.exports=function(t,e){return t.replace(/%([0-9]+)/g,(function(t,i){return e[Number(i)-1]}))}},41836:t=>{t.exports=function(t,e,i,s){void 0===e&&(e=0),void 0===i&&(i=" "),void 0===s&&(s=3);var n=0;if(e+1>=(t=t.toString()).length)switch(s){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((n=e-t.length)/2);t=new Array(n-r+1).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},33628:t=>{t.exports=function(t,e){return 0===e?t.slice(1):t.slice(0,e-1)+t.slice(e)}},27671:t=>{t.exports=function(t){return t.split("").reverse().join("")}},45650:t=>{t.exports=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}},35355:t=>{t.exports=function(t){return t&&t[0].toUpperCase()+t.slice(1)}},31749:(t,e,i)=>{t.exports={Format:i(27902),Pad:i(41836),RemoveAt:i(33628),Reverse:i(27671),UppercaseFirst:i(35355),UUID:i(45650)}}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var r=e[s]={exports:{}};return t[s](r,r.exports,i),r.exports}return i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i(85454)})(),s.exports=t());var t}export{t as c,e as g,n as r}; diff --git a/dungeon/dist/assets/phaser-zcydYi9M.js b/dungeon/dist/assets/phaser-zcydYi9M.js deleted file mode 100644 index f8e359fa..00000000 --- a/dungeon/dist/assets/phaser-zcydYi9M.js +++ /dev/null @@ -1 +0,0 @@ -var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i,s={exports:{}};function n(){return i?s.exports:(i=1,t=()=>(()=>{var t={50792:t=>{var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,o){if("function"!=typeof s)throw new TypeError("The listener must be a function");var a=new n(s,r||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function a(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,o=new Array(r);n{var s=i(38829);t.exports=function(t,e,i,n){for(var r=t[0],o=1;o{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"angle",e,i,n,r)}},60757:t=>{t.exports=function(t,e,i){for(var s=0;s{t.exports=function(t,e,i){void 0===i&&(i=0);for(var s=i;s{t.exports=function(t,e,i){void 0===i&&(i=0);for(var s=t.length-1;s>=i;s--){var n=t[s],r=!0;for(var o in e)n[o]!==e[o]&&(r=!1);if(r)return n}return null}},94420:(t,e,i)=>{var s=i(11879),n=i(60461),r=i(95540),o=i(29747),a=new(i(41481))({sys:{queueDepthSort:o,events:{once:o}}},0,0,1,1).setOrigin(0,0);t.exports=function(t,e){void 0===e&&(e={});var i=e.hasOwnProperty("width"),o=e.hasOwnProperty("height"),h=r(e,"width",-1),l=r(e,"height",-1),u=r(e,"cellWidth",1),c=r(e,"cellHeight",u),d=r(e,"position",n.TOP_LEFT),f=r(e,"x",0),p=r(e,"y",0),v=0,g=0,m=h*u,y=l*c;a.setPosition(f,p),a.setSize(u,c);for(var x=0;x{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"alpha",e,i,n,r)}},67285:(t,e,i)=>{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"x",e,i,n,r)}},9074:(t,e,i)=>{var s=i(66979);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"x",e,n,o,a),s(t,"y",i,r,o,a)}},75222:(t,e,i)=>{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"y",e,i,n,r)}},22983:t=>{t.exports=function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=6.28);for(var n=i,r=(s-i)/t.length,o=e.x,a=e.y,h=e.radius,l=0;l{t.exports=function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=6.28);for(var n=i,r=(s-i)/t.length,o=e.width/2,a=e.height/2,h=0;h{var s=i(15258),n=i(26708);t.exports=function(t,e,i){var r;r=i?n(e,i,t.length):s(e,t.length);for(var o=0;o{var s=i(14649),n=i(86003),r=i(49498);t.exports=function(t,e,i){void 0===i&&(i=0);var o=s(e,!1,t.length);i>0?n(o,i):i<0&&r(o,Math.abs(i));for(var a=0;a{var s=i(84993);t.exports=function(t,e,i){var n=s({x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},i),r=s({x1:e.x2,y1:e.y2,x2:e.x3,y2:e.y3},i),o=s({x1:e.x3,y1:e.y3,x2:e.x1,y2:e.y1},i);n.pop(),r.pop(),o.pop();for(var a=(n=n.concat(r,o)).length/t.length,h=0,l=0;l{t.exports=function(t,e,i){for(var s=0;s{t.exports=function(t,e,i,s,n,r){var o;void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=1);var a=0,h=t.length;if(1===r)for(o=n;o=0;o--)t[o][e]+=i+a*s,a++;return t}},43967:t=>{t.exports=function(t,e,i,s,n,r){var o;void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=1);var a=0,h=t.length;if(1===r)for(o=n;o=0;o--)t[o][e]=i+a*s,a++;return t}},88926:(t,e,i)=>{var s=i(28176);t.exports=function(t,e){for(var i=0;i{var s=i(24820);t.exports=function(t,e){for(var i=0;i{var s=i(65822);t.exports=function(t,e){for(var i=0;i{var s=i(26597);t.exports=function(t,e){for(var i=0;i{var s=i(90260);t.exports=function(t,e){for(var i=0;i{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"rotation",e,i,n,r)}},91051:(t,e,i)=>{var s=i(1163),n=i(20339);t.exports=function(t,e,i){for(var r=e.x,o=e.y,a=0;a{var s=i(1163);t.exports=function(t,e,i,n){var r=e.x,o=e.y;if(0===n)return t;for(var a=0;a{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"scaleX",e,i,n,r)}},94868:(t,e,i)=>{var s=i(66979);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"scaleX",e,n,o,a),s(t,"scaleY",i,r,o,a)}},95532:(t,e,i)=>{var s=i(66979);t.exports=function(t,e,i,n,r){return s(t,"scaleY",e,i,n,r)}},8689:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"alpha",e,i,n,r)}},2645:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n){return s(t,"blendMode",e,0,i,n)}},32372:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"depth",e,i,n,r)}},85373:t=>{t.exports=function(t,e,i){for(var s=0;s{var s=i(43967);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"originX",e,n,o,a),s(t,"originY",i,r,o,a),t.forEach((function(t){t.updateDisplayOrigin()})),t}},79939:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"rotation",e,i,n,r)}},2699:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"scaleX",e,n,o,a),s(t,"scaleY",i,r,o,a)}},98739:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"scaleX",e,i,n,r)}},98476:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"scaleY",e,i,n,r)}},6207:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"scrollFactorX",e,n,o,a),s(t,"scrollFactorY",i,r,o,a)}},6607:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"scrollFactorX",e,i,n,r)}},72248:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"scrollFactorY",e,i,n,r)}},14036:t=>{t.exports=function(t,e,i,s,n){for(var r=0;r{var s=i(43967);t.exports=function(t,e,i,n){return s(t,"visible",e,0,i,n)}},77597:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"x",e,i,n,r)}},83194:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r,o,a){return null==i&&(i=e),s(t,"x",e,n,o,a),s(t,"y",i,r,o,a)}},67678:(t,e,i)=>{var s=i(43967);t.exports=function(t,e,i,n,r){return s(t,"y",e,i,n,r)}},35850:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r){var o,a;void 0===n&&(n=0),void 0===r&&(r=new s);var h=t.length;if(1===h)o=t[0].x,a=t[0].y,t[0].x=e,t[0].y=i;else{var l=1,u=0;0===n&&(u=h-1,l=h-2),o=t[u].x,a=t[u].y,t[u].x=e,t[u].y=i;for(var c=0;c=h||-1===l)){var d=t[l],f=d.x,p=d.y;d.x=o,d.y=a,o=f,a=p,0===n?l--:l++}}return r.x=o,r.y=a,r}},8628:(t,e,i)=>{var s=i(33680);t.exports=function(t){return s(t)}},21837:(t,e,i)=>{var s=i(7602);t.exports=function(t,e,i,n,r){void 0===r&&(r=!1);var o,a=Math.abs(n-i)/t.length;if(r)for(o=0;o{var s=i(54261);t.exports=function(t,e,i,n,r){void 0===r&&(r=!1);var o,a=Math.abs(n-i)/t.length;if(r)for(o=0;o{t.exports=function(t,e,i,s,n){if(void 0===n&&(n=!1),0===t.length)return t;if(1===t.length)return n?t[0][e]+=(s+i)/2:t[0][e]=(s+i)/2,t;var r,o=Math.abs(s-i)/(t.length-1);if(n)for(r=0;r{t.exports=function(t){for(var e=0;e{var s=i(15994);t.exports=function(t,e,i){void 0===i&&(i=0);for(var n=0;n{t.exports={AlignTo:i(11517),Angle:i(80318),Call:i(60757),GetFirst:i(69927),GetLast:i(32265),GridAlign:i(94420),IncAlpha:i(41721),IncX:i(67285),IncXY:i(9074),IncY:i(75222),PlaceOnCircle:i(22983),PlaceOnEllipse:i(95253),PlaceOnLine:i(88505),PlaceOnRectangle:i(41346),PlaceOnTriangle:i(11575),PlayAnimation:i(29953),PropertyValueInc:i(66979),PropertyValueSet:i(43967),RandomCircle:i(88926),RandomEllipse:i(33286),RandomLine:i(96e3),RandomRectangle:i(28789),RandomTriangle:i(97154),Rotate:i(20510),RotateAround:i(91051),RotateAroundDistance:i(76332),ScaleX:i(61619),ScaleXY:i(94868),ScaleY:i(95532),SetAlpha:i(8689),SetBlendMode:i(2645),SetDepth:i(32372),SetHitArea:i(85373),SetOrigin:i(81583),SetRotation:i(79939),SetScale:i(2699),SetScaleX:i(98739),SetScaleY:i(98476),SetScrollFactor:i(6207),SetScrollFactorX:i(6607),SetScrollFactorY:i(72248),SetTint:i(14036),SetVisible:i(50159),SetX:i(77597),SetXY:i(83194),SetY:i(67678),ShiftPosition:i(35850),Shuffle:i(8628),SmootherStep:i(21910),SmoothStep:i(21837),Spread:i(62054),ToggleVisible:i(79815),WrapInRectangle:i(39665)}},42099:(t,e,i)=>{var s=i(45319),n=i(83419),r=i(74943),o=i(81957),a=i(41138),h=i(35154),l=i(90126),u=new n({initialize:function(t,e,i){this.manager=t,this.key=e,this.type="frame",this.frames=this.getFrames(t.textureManager,h(i,"frames",[]),h(i,"defaultTextureKey",null),h(i,"sortFrames",!0)),this.frameRate=h(i,"frameRate",null),this.duration=h(i,"duration",null),this.msPerFrame,this.skipMissedFrames=h(i,"skipMissedFrames",!0),this.delay=h(i,"delay",0),this.repeat=h(i,"repeat",0),this.repeatDelay=h(i,"repeatDelay",0),this.yoyo=h(i,"yoyo",!1),this.showBeforeDelay=h(i,"showBeforeDelay",!1),this.showOnStart=h(i,"showOnStart",!1),this.hideOnComplete=h(i,"hideOnComplete",!1),this.randomFrame=h(i,"randomFrame",!1),this.paused=!1,this.calculateDuration(this,this.getTotalFrames(),this.duration,this.frameRate),this.manager.on&&(this.manager.on(r.PAUSE_ALL,this.pause,this),this.manager.on(r.RESUME_ALL,this.resume,this))},getTotalFrames:function(){return this.frames.length},calculateDuration:function(t,e,i,s){null===i&&null===s?(t.frameRate=24,t.duration=24/e*1e3):i&&null===s?(t.duration=i,t.frameRate=e/(i/1e3)):(t.frameRate=s,t.duration=e/s*1e3),t.msPerFrame=1e3/t.frameRate},addFrame:function(t){return this.addFrameAt(this.frames.length,t)},addFrameAt:function(t,e){var i=this.getFrames(this.manager.textureManager,e);if(i.length>0){if(0===t)this.frames=i.concat(this.frames);else if(t===this.frames.length)this.frames=this.frames.concat(i);else{var s=this.frames.slice(0,t),n=this.frames.slice(t);this.frames=s.concat(i,n)}this.updateFrameSequence()}return this},checkFrame:function(t){return t>=0&&t0){r.isLast=!0,r.nextFrame=c[0],c[0].prevFrame=r;var y=1/(c.length-1);for(o=0;o0?t.inReverse&&t.forward?t.forward=!1:this.repeatAnimation(t):t.complete():this.updateAndGetNextTick(t,e.nextFrame)},handleYoyoFrame:function(t,e){if(e||(e=!1),t.inReverse===!e&&t.repeatCounter>0)return(0===t.repeatDelay||t.pendingRepeat)&&(t.forward=e),void this.repeatAnimation(t);if(t.inReverse===e||0!==t.repeatCounter){t.forward=e;var i=e?t.currentFrame.nextFrame:t.currentFrame.prevFrame;this.updateAndGetNextTick(t,i)}else t.complete()},getLastFrame:function(){return this.frames[this.frames.length-1]},previousFrame:function(t){var e=t.currentFrame;e.isFirst?t.yoyo?this.handleYoyoFrame(t,!0):t.repeatCounter>0?(t.inReverse&&!t.forward||(t.forward=!0),this.repeatAnimation(t)):t.complete():this.updateAndGetNextTick(t,e.prevFrame)},updateAndGetNextTick:function(t,e){t.setCurrentFrame(e),this.getNextTick(t)},removeFrame:function(t){var e=this.frames.indexOf(t);return-1!==e&&this.removeFrameAt(e),this},removeFrameAt:function(t){return this.frames.splice(t,1),this.updateFrameSequence(),this},repeatAnimation:function(t){if(2===t._pendingStop){if(0===t._pendingStopValue)return t.stop();t._pendingStopValue--}t.repeatDelay>0&&!t.pendingRepeat?(t.pendingRepeat=!0,t.accumulator-=t.nextTick,t.nextTick+=t.repeatDelay):(t.repeatCounter--,t.forward?t.setCurrentFrame(t.currentFrame.nextFrame):t.setCurrentFrame(t.currentFrame.prevFrame),t.isPlaying&&(this.getNextTick(t),t.handleRepeat()))},toJSON:function(){var t={key:this.key,type:this.type,frames:[],frameRate:this.frameRate,duration:this.duration,skipMissedFrames:this.skipMissedFrames,delay:this.delay,repeat:this.repeat,repeatDelay:this.repeatDelay,yoyo:this.yoyo,showBeforeDelay:this.showBeforeDelay,showOnStart:this.showOnStart,randomFrame:this.randomFrame,hideOnComplete:this.hideOnComplete};return this.frames.forEach((function(e){t.frames.push(e.toJSON())})),t},updateFrameSequence:function(){for(var t,e=this.frames.length,i=1/(e-1),s=0;s1?(t.isLast=!0,t.prevFrame=this.frames[e-2],t.nextFrame=this.frames[0]):e>1&&(t.prevFrame=this.frames[s-1],t.nextFrame=this.frames[s+1]);return this},pause:function(){return this.paused=!0,this},resume:function(){return this.paused=!1,this},destroy:function(){this.manager.off&&(this.manager.off(r.PAUSE_ALL,this.pause,this),this.manager.off(r.RESUME_ALL,this.resume,this)),this.manager.remove(this.key);for(var t=0;t{var s=new(i(83419))({initialize:function(t,e,i,s,n){void 0===n&&(n=!1),this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=s,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0,this.isKeyFrame=n},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration,keyframe:this.isKeyFrame}},destroy:function(){this.frame=void 0}});t.exports=s},60848:(t,e,i)=>{var s=i(42099),n=i(83419),r=i(90330),o=i(50792),a=i(74943),h=i(8443),l=i(95540),u=i(35154),c=i(36383),d=i(20283),f=i(41836),p=new n({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new r,this.mixes=new r,this.paused=!1,this.name="AnimationManager",t.events.once(h.BOOT,this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once(h.DESTROY,this.destroy,this)},addMix:function(t,e,i){var s=this.anims,n=this.mixes,r="string"==typeof t?t:t.key,o="string"==typeof e?e:e.key;if(s.has(r)&&s.has(o)){var a=n.get(r);a||(a={}),a[o]=i,n.set(r,a)}return this},removeMix:function(t,e){var i=this.mixes,s="string"==typeof t?t:t.key,n=i.get(s);if(n)if(e){var r="string"==typeof e?e:e.key;n.hasOwnProperty(r)&&delete n[r]}else e||i.delete(s);return this},getMix:function(t,e){var i=this.mixes,s="string"==typeof t?t:t.key,n="string"==typeof e?e:e.key,r=i.get(s);return r&&r.hasOwnProperty(n)?r[n]:0},add:function(t,e){return this.anims.has(t)?(console.warn("Animation key exists: "+t),this):(e.key=t,this.anims.set(t,e),this.emit(a.ADD_ANIMATION,t,e),this)},exists:function(t){return this.anims.has(t)},createFromAseprite:function(t,e,i){var s=[],n=this.game.cache.json.get(t);if(!n)return console.warn("No Aseprite data found for: "+t),s;var r=this,o=u(n,"meta",null),a=u(n,"frames",null);return o&&a&&u(o,"frameTags",[]).forEach((function(n){var o=[],h=l(n,"name",null),u=l(n,"from",0),d=l(n,"to",0),f=l(n,"direction","forward");if(h&&(!e||e&&e.indexOf(h)>-1)){for(var p=0,v=u;v<=d;v++){var g=v.toString(),m=a[g];if(m){var y=l(m,"duration",c.MAX_SAFE_INTEGER);o.push({key:t,frame:g,duration:y}),p+=y}}"reverse"===f&&(o=o.reverse());var x,T={key:h,frames:o,duration:p,yoyo:"pingpong"===f};i?i.anims&&(x=i.anims.create(T)):x=r.create(T),x&&s.push(x)}})),s},create:function(t){var e=t.key,i=!1;return e&&((i=this.get(e))?console.warn("AnimationManager key already exists: "+e):(i=new s(this,e,t),this.anims.set(e,i),this.emit(a.ADD_ANIMATION,e,i))),i},fromJSON:function(t,e){void 0===e&&(e=!1),e&&this.anims.clear(),"string"==typeof t&&(t=JSON.parse(t));var i=[];if(t.hasOwnProperty("anims")&&Array.isArray(t.anims)){for(var s=0;s{var s=i(42099),n=i(30976),r=i(83419),o=i(90330),a=i(74943),h=i(95540),l=new r({initialize:function(t){this.parent=t,this.animationManager=t.scene.sys.anims,this.animationManager.on(a.REMOVE_ANIMATION,this.globalRemove,this),this.textureManager=this.animationManager.textureManager,this.anims=null,this.isPlaying=!1,this.hasStarted=!1,this.currentAnim=null,this.currentFrame=null,this.nextAnim=null,this.nextAnimsQueue=[],this.timeScale=1,this.frameRate=0,this.duration=0,this.msPerFrame=0,this.skipMissedFrames=!0,this.randomFrame=!1,this.delay=0,this.repeat=0,this.repeatDelay=0,this.yoyo=!1,this.showBeforeDelay=!1,this.showOnStart=!1,this.hideOnComplete=!1,this.forward=!0,this.inReverse=!1,this.accumulator=0,this.nextTick=0,this.delayCounter=0,this.repeatCounter=0,this.pendingRepeat=!1,this._paused=!1,this._wasPlaying=!1,this._pendingStop=0,this._pendingStopValue},chain:function(t){var e=this.parent;if(void 0===t)return this.nextAnimsQueue.length=0,this.nextAnim=null,e;Array.isArray(t)||(t=[t]);for(var i=0;ir&&(l=0),this.randomFrame&&(l=n(0,r-1));var u=s.frames[l];0!==l||this.forward||(u=s.getLastFrame()),this.currentFrame=u}else console.warn("Missing animation: "+i);return this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.setCurrentFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.setCurrentFrame(t),this.parent},playAfterDelay:function(t,e){if(this.isPlaying){var i=this.nextAnim,s=this.nextAnimsQueue;i&&s.unshift(i),this.nextAnim=t,this._pendingStop=1,this._pendingStopValue=e}else this.delayCounter=e,this.play(t,!0);return this.parent},playAfterRepeat:function(t,e){if(void 0===e&&(e=1),this.isPlaying){var i=this.nextAnim,s=this.nextAnimsQueue;i&&s.unshift(i),-1!==this.repeatCounter&&e>this.repeatCounter&&(e=this.repeatCounter),this.nextAnim=t,this._pendingStop=2,this._pendingStopValue=e}else this.play(t);return this.parent},play:function(t,e){void 0===e&&(e=!1);var i=this.currentAnim,s=this.parent,n="string"==typeof t?t:t.key;if(e&&this.isPlaying&&i.key===n)return s;if(i&&this.isPlaying){var r=this.animationManager.getMix(i.key,t);if(r>0)return this.playAfterDelay(t,r)}return this.forward=!0,this.inReverse=!1,this._paused=!1,this._wasPlaying=!0,this.startAnimation(t)},playReverse:function(t,e){void 0===e&&(e=!1);var i="string"==typeof t?t:t.key;return e&&this.isPlaying&&this.currentAnim.key===i?this.parent:(this.forward=!1,this.inReverse=!0,this._paused=!1,this._wasPlaying=!0,this.startAnimation(t))},startAnimation:function(t){this.load(t);var e=this.currentAnim,i=this.parent;return e?(this.repeatCounter=-1===this.repeat?Number.MAX_VALUE:this.repeat,e.getFirstTick(this),this.isPlaying=!0,this.pendingRepeat=!1,this.hasStarted=!1,this._pendingStop=0,this._pendingStopValue=0,this._paused=!1,this.delayCounter+=this.delay,0===this.delayCounter?this.handleStart():this.showBeforeDelay&&this.setCurrentFrame(this.currentFrame),i):i},handleStart:function(){this.showOnStart&&this.parent.setVisible(!0),this.setCurrentFrame(this.currentFrame),this.hasStarted=!0,this.emitEvents(a.ANIMATION_START)},handleRepeat:function(){this.pendingRepeat=!1,this.emitEvents(a.ANIMATION_REPEAT)},handleStop:function(){this._pendingStop=0,this.isPlaying=!1,this.emitEvents(a.ANIMATION_STOP)},handleComplete:function(){this._pendingStop=0,this.isPlaying=!1,this.hideOnComplete&&this.parent.setVisible(!1),this.emitEvents(a.ANIMATION_COMPLETE,a.ANIMATION_COMPLETE_KEY)},emitEvents:function(t,e){var i=this.currentAnim;if(i){var s=this.currentFrame,n=this.parent,r=s.textureFrame;n.emit(t,i,s,n,r),e&&n.emit(e+i.key,i,s,n,r)}},reverse:function(){return this.isPlaying&&(this.inReverse=!this.inReverse,this.forward=!this.forward),this.parent},getProgress:function(){var t=this.currentFrame;if(!t)return 0;var e=t.progress;return this.inReverse&&(e*=-1),e},setProgress:function(t){return this.forward||(t=1-t),this.setCurrentFrame(this.currentAnim.getFrameByProgress(t)),this.parent},setRepeat:function(t){return this.repeatCounter=-1===t?Number.MAX_VALUE:t,this.parent},globalRemove:function(t,e){void 0===e&&(e=this.currentAnim),this.isPlaying&&e.key===this.currentAnim.key&&(this.stop(),this.setCurrentFrame(this.currentAnim.frames[0]))},restart:function(t,e){void 0===t&&(t=!1),void 0===e&&(e=!1);var i=this.currentAnim,s=this.parent;return i?(e&&(this.repeatCounter=-1===this.repeat?Number.MAX_VALUE:this.repeat),i.getFirstTick(this),this.emitEvents(a.ANIMATION_RESTART),this.isPlaying=!0,this.pendingRepeat=!1,this.hasStarted=!t,this._pendingStop=0,this._pendingStopValue=0,this._paused=!1,this.setCurrentFrame(i.frames[0]),this.parent):s},complete:function(){if(this._pendingStop=0,this.isPlaying=!1,this.currentAnim&&this.handleComplete(),this.nextAnim){var t=this.nextAnim;this.nextAnim=this.nextAnimsQueue.length>0?this.nextAnimsQueue.shift():null,this.play(t)}return this.parent},stop:function(){if(this._pendingStop=0,this.isPlaying=!1,this.delayCounter=0,this.currentAnim&&this.handleStop(),this.nextAnim){var t=this.nextAnim;this.nextAnim=this.nextAnimsQueue.shift(),this.play(t)}return this.parent},stopAfterDelay:function(t){return this._pendingStop=1,this._pendingStopValue=t,this.parent},stopAfterRepeat:function(t){return void 0===t&&(t=1),-1!==this.repeatCounter&&t>this.repeatCounter&&(t=this.repeatCounter),this._pendingStop=2,this._pendingStopValue=t,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},getTotalFrames:function(){return this.currentAnim?this.currentAnim.getTotalFrames():0},update:function(t,e){var i=this.currentAnim;if(this.isPlaying&&i&&!i.paused){if(this.accumulator+=e*this.timeScale*this.animationManager.globalTimeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.stop();if(this.hasStarted){if(this.accumulator>=this.nextTick&&(this.forward?i.nextFrame(this):i.previousFrame(this),this.isPlaying&&0===this._pendingStop&&this.skipMissedFrames&&this.accumulator>this.nextTick)){var s=0;do{this.forward?i.nextFrame(this):i.previousFrame(this),s++}while(this.isPlaying&&this.accumulator>this.nextTick&&s<60)}}else this.accumulator>=this.delayCounter&&(this.accumulator-=this.delayCounter,this.handleStart())}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),t.setAlpha&&(e.alpha=t.alpha),e.setSizeToFrame(),e._originComponent&&(t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin()),this.isPlaying&&this.hasStarted&&(this.emitEvents(a.ANIMATION_UPDATE),3===this._pendingStop&&this._pendingStopValue===t&&this.stop()),e},nextFrame:function(){return this.currentAnim&&this.currentAnim.nextFrame(this),this.parent},previousFrame:function(){return this.currentAnim&&this.currentAnim.previousFrame(this),this.parent},get:function(t){return this.anims?this.anims.get(t):null},exists:function(t){return!!this.anims&&this.anims.has(t)},create:function(t){var e=t.key,i=!1;return e&&((i=this.get(e))?console.warn("Animation key already exists: "+e):(i=new s(this,e,t),this.anims||(this.anims=new o),this.anims.set(e,i))),i},createFromAseprite:function(t,e){return this.animationManager.createFromAseprite(t,e,this.parent)},generateFrameNames:function(t,e){return this.animationManager.generateFrameNames(t,e)},generateFrameNumbers:function(t,e){return this.animationManager.generateFrameNumbers(t,e)},remove:function(t){var e=this.get(t);return e&&(this.currentAnim===e&&this.stop(),this.anims.delete(t)),e},destroy:function(){this.animationManager.off(a.REMOVE_ANIMATION,this.globalRemove,this),this.anims&&this.anims.clear(),this.animationManager=null,this.parent=null,this.nextAnim=null,this.nextAnimsQueue.length=0,this.currentAnim=null,this.currentFrame=null},isPaused:{get:function(){return this._paused}}});t.exports=l},57090:t=>{t.exports="add"},25312:t=>{t.exports="animationcomplete"},89580:t=>{t.exports="animationcomplete-"},52860:t=>{t.exports="animationrepeat"},63850:t=>{t.exports="animationrestart"},99085:t=>{t.exports="animationstart"},28087:t=>{t.exports="animationstop"},1794:t=>{t.exports="animationupdate"},52562:t=>{t.exports="pauseall"},57953:t=>{t.exports="remove"},68339:t=>{t.exports="resumeall"},74943:(t,e,i)=>{t.exports={ADD_ANIMATION:i(57090),ANIMATION_COMPLETE:i(25312),ANIMATION_COMPLETE_KEY:i(89580),ANIMATION_REPEAT:i(52860),ANIMATION_RESTART:i(63850),ANIMATION_START:i(99085),ANIMATION_STOP:i(28087),ANIMATION_UPDATE:i(1794),PAUSE_ALL:i(52562),REMOVE_ANIMATION:i(57953),RESUME_ALL:i(68339)}},60421:(t,e,i)=>{t.exports={Animation:i(42099),AnimationFrame:i(41138),AnimationManager:i(60848),AnimationState:i(9674),Events:i(74943)}},2161:(t,e,i)=>{var s=i(83419),n=i(90330),r=i(50792),o=i(24736),a=new s({initialize:function(){this.entries=new n,this.events=new r},add:function(t,e){return this.entries.set(t,e),this.events.emit(o.ADD,this,t,e),this},has:function(t){return this.entries.has(t)},exists:function(t){return this.entries.has(t)},get:function(t){return this.entries.get(t)},remove:function(t){var e=this.get(t);return e&&(this.entries.delete(t),this.events.emit(o.REMOVE,this,t,e.data)),this},getKeys:function(){return this.entries.keys()},destroy:function(){this.entries.clear(),this.events.removeAllListeners(),this.entries=null,this.events=null}});t.exports=a},24047:(t,e,i)=>{var s=i(2161),n=i(83419),r=i(8443),o=new n({initialize:function(t){this.game=t,this.binary=new s,this.bitmapFont=new s,this.json=new s,this.physics=new s,this.shader=new s,this.audio=new s,this.video=new s,this.text=new s,this.html=new s,this.obj=new s,this.tilemap=new s,this.xml=new s,this.custom={},this.game.events.once(r.DESTROY,this.destroy,this)},addCustom:function(t){return this.custom.hasOwnProperty(t)||(this.custom[t]=new s),this.custom[t]},destroy:function(){for(var t=["binary","bitmapFont","json","physics","shader","audio","video","text","html","obj","tilemap","xml"],e=0;e{t.exports="add"},59261:t=>{t.exports="remove"},24736:(t,e,i)=>{t.exports={ADD:i(51464),REMOVE:i(59261)}},83388:(t,e,i)=>{t.exports={BaseCache:i(2161),CacheManager:i(24047),Events:i(24736)}},71911:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(39506),o=i(50792),a=i(19715),h=i(87841),l=i(61340),u=i(80333),c=i(26099),d=new s({Extends:o,Mixins:[n.AlphaSingle,n.Visible],initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),o.call(this),this.scene,this.sceneManager,this.scaleManager,this.cameraManager,this.id=0,this.name="",this.roundPixels=!1,this.useBounds=!1,this.worldView=new h,this.dirty=!0,this._x=t,this._y=e,this._width=i,this._height=s,this._bounds=new h,this._scrollX=0,this._scrollY=0,this._zoomX=1,this._zoomY=1,this._rotation=0,this.matrix=new l,this.transparent=!0,this.backgroundColor=u("rgba(0,0,0,0)"),this.disableCull=!1,this.culledObjects=[],this.midPoint=new c(i/2,s/2),this.originX=.5,this.originY=.5,this._customViewport=!1,this.mask=null,this._maskCamera=null,this.renderList=[],this.isSceneCamera=!0},addToRenderList:function(t){this.renderList.push(t)},setOrigin:function(t,e){return void 0===t&&(t=.5),void 0===e&&(e=t),this.originX=t,this.originY=e,this},getScroll:function(t,e,i){void 0===i&&(i=new c);var s=.5*this.width,n=.5*this.height;return i.x=t-s,i.y=e-n,this.useBounds&&(i.x=this.clampX(i.x),i.y=this.clampY(i.y)),i},centerOnX:function(t){var e=.5*this.width;return this.midPoint.x=t,this.scrollX=t-e,this.useBounds&&(this.scrollX=this.clampX(this.scrollX)),this},centerOnY:function(t){var e=.5*this.height;return this.midPoint.y=t,this.scrollY=t-e,this.useBounds&&(this.scrollY=this.clampY(this.scrollY)),this},centerOn:function(t,e){return this.centerOnX(t),this.centerOnY(e),this},centerToBounds:function(){if(this.useBounds){var t=this._bounds,e=.5*this.width,i=.5*this.height;this.midPoint.set(t.centerX,t.centerY),this.scrollX=t.centerX-e,this.scrollY=t.centerY-i}return this},centerToSize:function(){return this.scrollX=.5*this.width,this.scrollY=.5*this.height,this},cull:function(t){if(this.disableCull)return t;var e=this.matrix.matrix,i=e[0],s=e[1],n=e[2],r=e[3],o=i*r-s*n;if(!o)return t;var a=e[4],h=e[5],l=this.scrollX,u=this.scrollY,c=this.width,d=this.height,f=this.y,p=f+d,v=this.x,g=v+c,m=this.culledObjects,y=t.length;o=1/o,m.length=0;for(var x=0;xv&&S*i+E*n+af&&S*s+E*r+hn&&(t=n),t},clampY:function(t){var e=this._bounds,i=this.displayHeight,s=e.y+(i-this.height)/2,n=Math.max(s,s+e.height-i);return tn&&(t=n),t},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(t){return void 0===t&&(t=0),this.rotation=r(t),this},setBackgroundColor:function(t){return void 0===t&&(t="rgba(0,0,0,0)"),this.backgroundColor=u(t),this.transparent=0===this.backgroundColor.alpha,this},setBounds:function(t,e,i,s,n){return void 0===n&&(n=!1),this._bounds.setTo(t,e,i,s),this.dirty=!0,this.useBounds=!0,n?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},getBounds:function(t){void 0===t&&(t=new h);var e=this._bounds;return t.setTo(e.x,e.y,e.width,e.height),t},setName:function(t){return void 0===t&&(t=""),this.name=t,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setRoundPixels:function(t){return this.roundPixels=t,this},setScene:function(t,e){void 0===e&&(e=!0),this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=t,this.isSceneCamera=e;var i=t.sys;return this.sceneManager=i.game.scene,this.scaleManager=i.scale,this.cameraManager=i.cameras,this.updateSystem(),this},setScroll:function(t,e){return void 0===e&&(e=t),this.scrollX=t,this.scrollY=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},setViewport:function(t,e,i,s){return this.x=t,this.y=e,this.width=i,this.height=s,this},setZoom:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),0===t&&(t=.001),0===e&&(e=.001),this.zoomX=t,this.zoomY=e,this},setMask:function(t,e){return void 0===e&&(e=!0),this.mask=t,this._maskCamera=e?this.cameraManager.default:this,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},toJSON:function(){var t={name:this.name,x:this.x,y:this.y,width:this.width,height:this.height,zoom:this.zoom,rotation:this.rotation,roundPixels:this.roundPixels,scrollX:this.scrollX,scrollY:this.scrollY,backgroundColor:this.backgroundColor.rgba};return this.useBounds&&(t.bounds={x:this._bounds.x,y:this._bounds.y,width:this._bounds.width,height:this._bounds.height}),t},update:function(){},setIsSceneCamera:function(t){return this.isSceneCamera=t,this},updateSystem:function(){if(this.scaleManager&&this.isSceneCamera){var t=0!==this._x||0!==this._y||this.scaleManager.width!==this._width||this.scaleManager.height!==this._height,e=this.sceneManager;t&&!this._customViewport?e.customViewports++:!t&&this._customViewport&&e.customViewports--,this.dirty=!0,this._customViewport=t}},destroy:function(){this.emit(a.DESTROY,this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this.renderList=[],this._bounds=null,this.scene=null,this.scaleManager=null,this.sceneManager=null,this.cameraManager=null},x:{get:function(){return this._x},set:function(t){this._x=t,this.updateSystem()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.updateSystem()}},width:{get:function(){return this._width},set:function(t){this._width=t,this.updateSystem()}},height:{get:function(){return this._height},set:function(t){this._height=t,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(t){t!==this._scrollX&&(this._scrollX=t,this.dirty=!0)}},scrollY:{get:function(){return this._scrollY},set:function(t){t!==this._scrollY&&(this._scrollY=t,this.dirty=!0)}},zoom:{get:function(){return(this._zoomX+this._zoomY)/2},set:function(t){this._zoomX=t,this._zoomY=t,this.dirty=!0}},zoomX:{get:function(){return this._zoomX},set:function(t){this._zoomX=t,this.dirty=!0}},zoomY:{get:function(){return this._zoomY},set:function(t){this._zoomY=t,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=t,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoomX}},displayHeight:{get:function(){return this.height/this.zoomY}}});t.exports=d},38058:(t,e,i)=>{var s=i(71911),n=i(67502),r=i(45319),o=i(83419),a=i(31401),h=i(20052),l=i(19715),u=i(28915),c=i(87841),d=i(26099),f=new o({Extends:s,Mixins:[a.PostPipeline],initialize:function(t,e,i,n){s.call(this,t,e,i,n),this.initPostPipeline(),this.inputEnabled=!0,this.fadeEffect=new h.Fade(this),this.flashEffect=new h.Flash(this),this.shakeEffect=new h.Shake(this),this.panEffect=new h.Pan(this),this.rotateToEffect=new h.RotateTo(this),this.zoomEffect=new h.Zoom(this),this.lerp=new d(1,1),this.followOffset=new d,this.deadzone=null,this._follow=null},setDeadzone:function(t,e){if(void 0===t)this.deadzone=null;else{if(this.deadzone?(this.deadzone.width=t,this.deadzone.height=e):this.deadzone=new c(0,0,t,e),this._follow){var i=this.width/2,s=this.height/2,r=this._follow.x-this.followOffset.x,o=this._follow.y-this.followOffset.y;this.midPoint.set(r,o),this.scrollX=r-i,this.scrollY=o-s}n(this.deadzone,this.midPoint.x,this.midPoint.y)}return this},fadeIn:function(t,e,i,s,n,r){return this.fadeEffect.start(!1,t,e,i,s,!0,n,r)},fadeOut:function(t,e,i,s,n,r){return this.fadeEffect.start(!0,t,e,i,s,!0,n,r)},fadeFrom:function(t,e,i,s,n,r,o){return this.fadeEffect.start(!1,t,e,i,s,n,r,o)},fade:function(t,e,i,s,n,r,o){return this.fadeEffect.start(!0,t,e,i,s,n,r,o)},flash:function(t,e,i,s,n,r,o){return this.flashEffect.start(t,e,i,s,n,r,o)},shake:function(t,e,i,s,n){return this.shakeEffect.start(t,e,i,s,n)},pan:function(t,e,i,s,n,r,o){return this.panEffect.start(t,e,i,s,n,r,o)},rotateTo:function(t,e,i,s,n,r,o){return this.rotateToEffect.start(t,e,i,s,n,r,o)},zoomTo:function(t,e,i,s,n,r){return this.zoomEffect.start(t,e,i,s,n,r)},preRender:function(){this.renderList.length=0;var t=this.width,e=this.height,i=.5*t,s=.5*e,r=this.zoom,o=this.matrix,a=t*this.originX,h=e*this.originY,c=this._follow,d=this.deadzone,f=this.scrollX,p=this.scrollY;d&&n(d,this.midPoint.x,this.midPoint.y);var v=!1;if(c&&!this.panEffect.isRunning){var g=this.lerp,m=c.x-this.followOffset.x,y=c.y-this.followOffset.y;d?(md.right&&(f=u(f,f+(m-d.right),g.x)),yd.bottom&&(p=u(p,p+(y-d.bottom),g.y))):(f=u(f,m-a,g.x),p=u(p,y-h,g.y)),v=!0}this.useBounds&&(f=this.clampX(f),p=this.clampY(p)),this.scrollX=f,this.scrollY=p;var x=f+i,T=p+s;this.midPoint.set(x,T);var w=t/r,b=e/r,S=Math.floor(x-w/2),E=Math.floor(T-b/2);this.worldView.setTo(S,E,w,b),o.applyITRS(Math.floor(this.x+a),Math.floor(this.y+h),this.rotation,r,r),o.translate(-a,-h),this.shakeEffect.preRender(),v&&this.emit(l.FOLLOW_UPDATE,this,c)},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,s,n,o){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===s&&(s=i),void 0===n&&(n=0),void 0===o&&(o=n),this._follow=t,this.roundPixels=e,i=r(i,0,1),s=r(s,0,1),this.lerp.set(i,s),this.followOffset.set(n,o);var a=this.width/2,h=this.height/2,l=t.x-n,u=t.y-o;return this.midPoint.set(l,u),this.scrollX=l-a,this.scrollY=u-h,this.useBounds&&(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.rotateToEffect.reset(),this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.rotateToEffect.update(t,e),this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.resetFX(),s.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=f},32743:(t,e,i)=>{var s=i(38058),n=i(83419),r=i(95540),o=i(37277),a=i(37303),h=i(97480),l=i(44594),u=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this.roundPixels=t.sys.game.config.roundPixels,this.cameras=[],this.main,this.default,t.sys.events.once(l.BOOT,this.boot,this),t.sys.events.on(l.START,this.start,this)},boot:function(){var t=this.systems;t.settings.cameras?this.fromJSON(t.settings.cameras):this.add(),this.main=this.cameras[0],this.default=new s(0,0,t.scale.width,t.scale.height).setScene(this.scene),t.game.scale.on(h.RESIZE,this.onResize,this),this.systems.events.once(l.DESTROY,this.destroy,this)},start:function(){if(!this.main){var t=this.systems;t.settings.cameras?this.fromJSON(t.settings.cameras):this.add(),this.main=this.cameras[0]}var e=this.systems.events;e.on(l.UPDATE,this.update,this),e.once(l.SHUTDOWN,this.shutdown,this)},add:function(t,e,i,n,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.scale.width),void 0===n&&(n=this.scene.sys.scale.height),void 0===r&&(r=!1),void 0===o&&(o="");var a=new s(t,e,i,n);return a.setName(o),a.setScene(this.scene),a.setRoundPixels(this.roundPixels),a.id=this.getNextID(),this.cameras.push(a),r&&(this.main=a),a},addExisting:function(t,e){return void 0===e&&(e=!1),-1===this.cameras.indexOf(t)?(t.id=this.getNextID(),t.setRoundPixels(this.roundPixels),this.cameras.push(t),e&&(this.main=t),t):null},getNextID:function(){for(var t=this.cameras,e=1,i=0;i<32;i++){for(var s=!1,n=0;n0){r.preRender();var o=this.getVisibleChildren(e.getChildren(),r);t.render(i,o,r)}}},getVisibleChildren:function(t,e){return t.filter((function(t){return t.willRender(e)}))},resetAll:function(){for(var t=0;t{var s=i(45319),n=i(83419),r=i(19715),o=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.isComplete=!1,this.direction=!0,this.duration=0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,s,n,o,a,h){if(void 0===t&&(t=!0),void 0===e&&(e=1e3),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=0),void 0===o&&(o=!1),void 0===a&&(a=null),void 0===h&&(h=this.camera.scene),!o&&this.isRunning)return this.camera;this.isRunning=!0,this.isComplete=!1,this.duration=e,this.direction=t,this.progress=0,this.red=i,this.green=s,this.blue=n,this.alpha=t?Number.MIN_VALUE:1,this._elapsed=0,this._onUpdate=a,this._onUpdateScope=h;var l=t?r.FADE_OUT_START:r.FADE_IN_START;return this.camera.emit(l,this.camera,this,e,i,s,n),this.camera},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=s(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsed{var s=i(45319),n=i(83419),r=i(19715),o=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.red=0,this.green=0,this.blue=0,this.alpha=1,this.progress=0,this._elapsed=0,this._alpha,this._onUpdate,this._onUpdateScope},start:function(t,e,i,s,n,o,a){return void 0===t&&(t=250),void 0===e&&(e=255),void 0===i&&(i=255),void 0===s&&(s=255),void 0===n&&(n=!1),void 0===o&&(o=null),void 0===a&&(a=this.camera.scene),!n&&this.isRunning||(this.isRunning=!0,this.duration=t,this.progress=0,this.red=e,this.green=i,this.blue=s,this._alpha=this.alpha,this._elapsed=0,this._onUpdate=o,this._onUpdateScope=a,this.camera.emit(r.FLASH_START,this.camera,this,t,e,i,s)),this.camera},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=s(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsed{var s=i(45319),n=i(83419),r=i(62640),o=i(19715),a=i(26099),h=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=new a,this.current=new a,this.destination=new a,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,s,n,a,h){void 0===i&&(i=1e3),void 0===s&&(s=r.Linear),void 0===n&&(n=!1),void 0===a&&(a=null),void 0===h&&(h=this.camera.scene);var l=this.camera;return!n&&this.isRunning||(this.isRunning=!0,this.duration=i,this.progress=0,this.source.set(l.scrollX,l.scrollY),this.destination.set(t,e),l.getScroll(t,e,this.current),"string"==typeof s&&r.hasOwnProperty(s)?this.ease=r[s]:"function"==typeof s&&(this.ease=s),this._elapsed=0,this._onUpdate=a,this._onUpdateScope=h,this.camera.emit(o.PAN_START,this.camera,this,i,t,e)),l},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=s(this._elapsed/this.duration,0,1);this.progress=i;var n=this.camera;if(this._elapsed{var s=i(45319),n=i(83419),r=i(19715),o=i(62640),a=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=0,this.current=0,this.destination=0,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope,this.clockwise=!0,this.shortestPath=!1},start:function(t,e,i,s,n,a,h){void 0===i&&(i=1e3),void 0===s&&(s=o.Linear),void 0===n&&(n=!1),void 0===a&&(a=null),void 0===h&&(h=this.camera.scene),void 0===e&&(e=!1),this.shortestPath=e;var l=t;t<0?(l=-1*t,this.clockwise=!1):this.clockwise=!0;var u=360*Math.PI/180;l-=Math.floor(l/u)*u;var c=this.camera;if(!n&&this.isRunning)return c;if(this.isRunning=!0,this.duration=i,this.progress=0,this.source=c.rotation,this.destination=l,"string"==typeof s&&o.hasOwnProperty(s)?this.ease=o[s]:"function"==typeof s&&(this.ease=s),this._elapsed=0,this._onUpdate=a,this._onUpdateScope=h,this.shortestPath){var d,f;(d=this.destination>this.source?Math.abs(this.destination-this.source):Math.abs(this.destination+u)-this.source)<(f=this.source>this.destination?Math.abs(this.source-this.destination):Math.abs(this.source+u)-this.destination)?this.clockwise=!0:d>f&&(this.clockwise=!1)}return this.camera.emit(r.ROTATE_START,this.camera,this,i,l),c},update:function(t,e){if(this.isRunning){this._elapsed+=e;var i=s(this._elapsed/this.duration,0,1);this.progress=i;var n=this.camera;if(this._elapsed=l?Math.abs(h-l):Math.abs(h+a)-l;var u;u=this.clockwise?n.rotation+o*r:n.rotation-o*r,n.rotation=u,this._onUpdate&&this._onUpdate.call(this._onUpdateScope,n,i,u)}else n.rotation=this.destination,this._onUpdate&&this._onUpdate.call(this._onUpdateScope,n,i,this.destination),this.effectComplete()}},effectComplete:function(){this._onUpdate=null,this._onUpdateScope=null,this.isRunning=!1,this.camera.emit(r.ROTATE_COMPLETE,this.camera,this)},reset:function(){this.isRunning=!1,this._onUpdate=null,this._onUpdateScope=null},destroy:function(){this.reset(),this.camera=null,this.source=null,this.destination=null}});t.exports=a},30330:(t,e,i)=>{var s=i(45319),n=i(83419),r=i(19715),o=i(26099),a=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.intensity=new o,this.progress=0,this._elapsed=0,this._offsetX=0,this._offsetY=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,s,n){return void 0===t&&(t=100),void 0===e&&(e=.05),void 0===i&&(i=!1),void 0===s&&(s=null),void 0===n&&(n=this.camera.scene),!i&&this.isRunning||(this.isRunning=!0,this.duration=t,this.progress=0,"number"==typeof e?this.intensity.set(e):this.intensity.set(e.x,e.y),this._elapsed=0,this._offsetX=0,this._offsetY=0,this._onUpdate=s,this._onUpdateScope=n,this.camera.emit(r.SHAKE_START,this.camera,this,t,e)),this.camera},preRender:function(){this.isRunning&&this.camera.matrix.translate(this._offsetX,this._offsetY)},update:function(t,e){if(this.isRunning)if(this._elapsed+=e,this.progress=s(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsed{var s=i(45319),n=i(83419),r=i(62640),o=i(19715),a=new n({initialize:function(t){this.camera=t,this.isRunning=!1,this.duration=0,this.source=1,this.destination=1,this.ease,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,s,n,a){void 0===e&&(e=1e3),void 0===i&&(i=r.Linear),void 0===s&&(s=!1),void 0===n&&(n=null),void 0===a&&(a=this.camera.scene);var h=this.camera;return!s&&this.isRunning||(this.isRunning=!0,this.duration=e,this.progress=0,this.source=h.zoom,this.destination=t,"string"==typeof i&&r.hasOwnProperty(i)?this.ease=r[i]:"function"==typeof i&&(this.ease=i),this._elapsed=0,this._onUpdate=n,this._onUpdateScope=a,this.camera.emit(o.ZOOM_START,this.camera,this,e,t)),h},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=s(this._elapsed/this.duration,0,1),this._elapsed{t.exports={Fade:i(5020),Flash:i(10662),Pan:i(20359),Shake:i(30330),RotateTo:i(34208),Zoom:i(45641)}},16438:t=>{t.exports="cameradestroy"},32726:t=>{t.exports="camerafadeincomplete"},87807:t=>{t.exports="camerafadeinstart"},45917:t=>{t.exports="camerafadeoutcomplete"},95666:t=>{t.exports="camerafadeoutstart"},47056:t=>{t.exports="cameraflashcomplete"},91261:t=>{t.exports="cameraflashstart"},45047:t=>{t.exports="followupdate"},81927:t=>{t.exports="camerapancomplete"},74264:t=>{t.exports="camerapanstart"},54419:t=>{t.exports="postrender"},79330:t=>{t.exports="prerender"},93183:t=>{t.exports="camerarotatecomplete"},80112:t=>{t.exports="camerarotatestart"},62252:t=>{t.exports="camerashakecomplete"},86017:t=>{t.exports="camerashakestart"},539:t=>{t.exports="camerazoomcomplete"},51892:t=>{t.exports="camerazoomstart"},19715:(t,e,i)=>{t.exports={DESTROY:i(16438),FADE_IN_COMPLETE:i(32726),FADE_IN_START:i(87807),FADE_OUT_COMPLETE:i(45917),FADE_OUT_START:i(95666),FLASH_COMPLETE:i(47056),FLASH_START:i(91261),FOLLOW_UPDATE:i(45047),PAN_COMPLETE:i(81927),PAN_START:i(74264),POST_RENDER:i(54419),PRE_RENDER:i(79330),ROTATE_COMPLETE:i(93183),ROTATE_START:i(80112),SHAKE_COMPLETE:i(62252),SHAKE_START:i(86017),ZOOM_COMPLETE:i(539),ZOOM_START:i(51892)}},87969:(t,e,i)=>{t.exports={Camera:i(38058),BaseCamera:i(71911),CameraManager:i(32743),Effects:i(20052),Events:i(19715)}},63091:(t,e,i)=>{var s=i(83419),n=i(35154),r=new s({initialize:function(t){this.camera=n(t,"camera",null),this.left=n(t,"left",null),this.right=n(t,"right",null),this.up=n(t,"up",null),this.down=n(t,"down",null),this.zoomIn=n(t,"zoomIn",null),this.zoomOut=n(t,"zoomOut",null),this.zoomSpeed=n(t,"zoomSpeed",.01),this.minZoom=n(t,"minZoom",.001),this.maxZoom=n(t,"maxZoom",1e3),this.speedX=0,this.speedY=0;var e=n(t,"speed",null);"number"==typeof e?(this.speedX=e,this.speedY=e):(this.speedX=n(t,"speed.x",0),this.speedY=n(t,"speed.y",0)),this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this.up&&this.up.isDown?e.scrollY-=this.speedY*t|0:this.down&&this.down.isDown&&(e.scrollY+=this.speedY*t|0),this.left&&this.left.isDown?e.scrollX-=this.speedX*t|0:this.right&&this.right.isDown&&(e.scrollX+=this.speedX*t|0),this.zoomIn&&this.zoomIn.isDown?(e.zoom-=this.zoomSpeed,e.zoomthis.maxZoom&&(e.zoom=this.maxZoom))}},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},58818:(t,e,i)=>{var s=i(83419),n=i(35154),r=new s({initialize:function(t){this.camera=n(t,"camera",null),this.left=n(t,"left",null),this.right=n(t,"right",null),this.up=n(t,"up",null),this.down=n(t,"down",null),this.zoomIn=n(t,"zoomIn",null),this.zoomOut=n(t,"zoomOut",null),this.zoomSpeed=n(t,"zoomSpeed",.01),this.minZoom=n(t,"minZoom",.001),this.maxZoom=n(t,"maxZoom",1e3),this.accelX=0,this.accelY=0;var e=n(t,"acceleration",null);"number"==typeof e?(this.accelX=e,this.accelY=e):(this.accelX=n(t,"acceleration.x",0),this.accelY=n(t,"acceleration.y",0)),this.dragX=0,this.dragY=0;var i=n(t,"drag",null);"number"==typeof i?(this.dragX=i,this.dragY=i):(this.dragX=n(t,"drag.x",0),this.dragY=n(t,"drag.y",0)),this.maxSpeedX=0,this.maxSpeedY=0;var s=n(t,"maxSpeed",null);"number"==typeof s?(this.maxSpeedX=s,this.maxSpeedY=s):(this.maxSpeedX=n(t,"maxSpeed.x",0),this.maxSpeedY=n(t,"maxSpeed.y",0)),this._speedX=0,this._speedY=0,this._zoom=0,this.active=null!==this.camera},start:function(){return this.active=null!==this.camera,this},stop:function(){return this.active=!1,this},setCamera:function(t){return this.camera=t,this},update:function(t){if(this.active){void 0===t&&(t=1);var e=this.camera;this._speedX>0?(this._speedX-=this.dragX*t,this._speedX<0&&(this._speedX=0)):this._speedX<0&&(this._speedX+=this.dragX*t,this._speedX>0&&(this._speedX=0)),this._speedY>0?(this._speedY-=this.dragY*t,this._speedY<0&&(this._speedY=0)):this._speedY<0&&(this._speedY+=this.dragY*t,this._speedY>0&&(this._speedY=0)),this.up&&this.up.isDown?(this._speedY+=this.accelY,this._speedY>this.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoomthis.maxZoom&&(e.zoom=this.maxZoom))}},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},38865:(t,e,i)=>{t.exports={FixedKeyControl:i(63091),SmoothedKeyControl:i(58818)}},26638:(t,e,i)=>{t.exports={Controls:i(38865),Scene2D:i(87969)}},8054:(t,e,i)=>{var s={VERSION:"3.80.1",BlendModes:i(10312),ScaleModes:i(29795),AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,FOREVER:-1,NONE:4,UP:5,DOWN:6,LEFT:7,RIGHT:8};t.exports=s},69547:(t,e,i)=>{var s=i(83419),n=i(8054),r=i(42363),o=i(82264),a=i(95540),h=i(35154),l=i(41212),u=i(29747),c=i(75508),d=i(36060),f=i(80333),p=new s({initialize:function(t){void 0===t&&(t={});var e=h(t,"scale",null);this.width=h(e,"width",1024,t),this.height=h(e,"height",768,t),this.zoom=h(e,"zoom",1,t),this.parent=h(e,"parent",void 0,t),this.scaleMode=h(e,e?"mode":"scaleMode",0,t),this.expandParent=h(e,"expandParent",!0,t),this.autoRound=h(e,"autoRound",!1,t),this.autoCenter=h(e,"autoCenter",0,t),this.resizeInterval=h(e,"resizeInterval",500,t),this.fullscreenTarget=h(e,"fullscreenTarget",null,t),this.minWidth=h(e,"min.width",0,t),this.maxWidth=h(e,"max.width",0,t),this.minHeight=h(e,"min.height",0,t),this.maxHeight=h(e,"max.height",0,t),this.snapWidth=h(e,"snap.width",0,t),this.snapHeight=h(e,"snap.height",0,t),this.renderType=h(t,"type",n.AUTO),this.canvas=h(t,"canvas",null),this.context=h(t,"context",null),this.canvasStyle=h(t,"canvasStyle",null),this.customEnvironment=h(t,"customEnvironment",!1),this.sceneConfig=h(t,"scene",null),this.seed=h(t,"seed",[(Date.now()*Math.random()).toString()]),c.RND=new c.RandomDataGenerator(this.seed),this.gameTitle=h(t,"title",""),this.gameURL=h(t,"url","https://phaser.io"),this.gameVersion=h(t,"version",""),this.autoFocus=h(t,"autoFocus",!0),this.stableSort=h(t,"stableSort",-1),-1===this.stableSort&&(this.stableSort=o.browser.es2019?1:0),o.features.stableSort=this.stableSort,this.domCreateContainer=h(t,"dom.createContainer",!1),this.domPointerEvents=h(t,"dom.pointerEvents","none"),this.inputKeyboard=h(t,"input.keyboard",!0),this.inputKeyboardEventTarget=h(t,"input.keyboard.target",window),this.inputKeyboardCapture=h(t,"input.keyboard.capture",[]),this.inputMouse=h(t,"input.mouse",!0),this.inputMouseEventTarget=h(t,"input.mouse.target",null),this.inputMousePreventDefaultDown=h(t,"input.mouse.preventDefaultDown",!0),this.inputMousePreventDefaultUp=h(t,"input.mouse.preventDefaultUp",!0),this.inputMousePreventDefaultMove=h(t,"input.mouse.preventDefaultMove",!0),this.inputMousePreventDefaultWheel=h(t,"input.mouse.preventDefaultWheel",!0),this.inputTouch=h(t,"input.touch",o.input.touch),this.inputTouchEventTarget=h(t,"input.touch.target",null),this.inputTouchCapture=h(t,"input.touch.capture",!0),this.inputActivePointers=h(t,"input.activePointers",1),this.inputSmoothFactor=h(t,"input.smoothFactor",0),this.inputWindowEvents=h(t,"input.windowEvents",!0),this.inputGamepad=h(t,"input.gamepad",!1),this.inputGamepadEventTarget=h(t,"input.gamepad.target",window),this.disableContextMenu=h(t,"disableContextMenu",!1),this.audio=h(t,"audio",{}),this.hideBanner=!1===h(t,"banner",null),this.hidePhaser=h(t,"banner.hidePhaser",!1),this.bannerTextColor=h(t,"banner.text","#ffffff"),this.bannerBackgroundColor=h(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=h(t,"fps",null),this.disablePreFX=h(t,"disablePreFX",!1),this.disablePostFX=h(t,"disablePostFX",!1);var i=h(t,"render",null);this.pipeline=h(i,"pipeline",null,t),this.autoMobilePipeline=h(i,"autoMobilePipeline",!0,t),this.defaultPipeline=h(i,"defaultPipeline",d.MULTI_PIPELINE,t),this.antialias=h(i,"antialias",!0,t),this.antialiasGL=h(i,"antialiasGL",!0,t),this.mipmapFilter=h(i,"mipmapFilter","",t),this.desynchronized=h(i,"desynchronized",!1,t),this.roundPixels=h(i,"roundPixels",!0,t),this.pixelArt=h(i,"pixelArt",1!==this.zoom,t),this.pixelArt&&(this.antialias=!1,this.antialiasGL=!1,this.roundPixels=!0),this.transparent=h(i,"transparent",!1,t),this.clearBeforeRender=h(i,"clearBeforeRender",!0,t),this.preserveDrawingBuffer=h(i,"preserveDrawingBuffer",!1,t),this.premultipliedAlpha=h(i,"premultipliedAlpha",!0,t),this.failIfMajorPerformanceCaveat=h(i,"failIfMajorPerformanceCaveat",!1,t),this.powerPreference=h(i,"powerPreference","default",t),this.batchSize=h(i,"batchSize",4096,t),this.maxTextures=h(i,"maxTextures",-1,t),this.maxLights=h(i,"maxLights",10,t);var s=h(t,"backgroundColor",0);this.backgroundColor=f(s),this.transparent&&(this.backgroundColor=f(0),this.backgroundColor.alpha=0),this.preBoot=h(t,"callbacks.preBoot",u),this.postBoot=h(t,"callbacks.postBoot",u),this.physics=h(t,"physics",{}),this.defaultPhysicsSystem=h(this.physics,"default",!1),this.loaderBaseURL=h(t,"loader.baseURL",""),this.loaderPath=h(t,"loader.path",""),this.loaderMaxParallelDownloads=h(t,"loader.maxParallelDownloads",o.os.android?6:32),this.loaderCrossOrigin=h(t,"loader.crossOrigin",void 0),this.loaderResponseType=h(t,"loader.responseType",""),this.loaderAsync=h(t,"loader.async",!0),this.loaderUser=h(t,"loader.user",""),this.loaderPassword=h(t,"loader.password",""),this.loaderTimeout=h(t,"loader.timeout",0),this.loaderWithCredentials=h(t,"loader.withCredentials",!1),this.loaderImageLoadType=h(t,"loader.imageLoadType","XHR"),this.loaderLocalScheme=h(t,"loader.localScheme",["file://","capacitor://"]),this.glowFXQuality=h(t,"fx.glow.quality",.1),this.glowFXDistance=h(t,"fx.glow.distance",10),this.installGlobalPlugins=[],this.installScenePlugins=[];var p=h(t,"plugins",null),v=r.DefaultScene;p&&(Array.isArray(p)?this.defaultPlugins=p:l(p)&&(this.installGlobalPlugins=a(p,"global",[]),this.installScenePlugins=a(p,"scene",[]),Array.isArray(p.default)?v=p.default:Array.isArray(p.defaultMerge)&&(v=v.concat(p.defaultMerge)))),this.defaultPlugins=v;var g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=h(t,"images.default",g+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=h(t,"images.missing",g+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),this.whiteImage=h(t,"images.white","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABdJREFUeNpi/P//PwMMMDEgAdwcgAADAJZuAwXJYZOzAAAAAElFTkSuQmCC"),window&&(window.FORCE_WEBGL?this.renderType=n.WEBGL:window.FORCE_CANVAS&&(this.renderType=n.CANVAS))}});t.exports=p},86054:(t,e,i)=>{var s=i(20623),n=i(27919),r=i(8054),o=i(89357);t.exports=function(t){var e=t.config;if((e.customEnvironment||e.canvas)&&e.renderType===r.AUTO)throw new Error("Must set explicit renderType in custom environment");if(!e.customEnvironment&&!e.canvas&&e.renderType!==r.HEADLESS)if(e.renderType===r.AUTO&&(e.renderType=o.webGL?r.WEBGL:r.CANVAS),e.renderType===r.WEBGL){if(!o.webGL)throw new Error("Cannot create WebGL context, aborting.")}else{if(e.renderType!==r.CANVAS)throw new Error("Unknown value for renderer type: "+e.renderType);if(!o.canvas)throw new Error("Cannot create Canvas context, aborting.")}e.antialias||n.disableSmoothing();var a,h,l=t.scale.baseSize,u=l.width,c=l.height;e.canvas?(t.canvas=e.canvas,t.canvas.width=u,t.canvas.height=c):t.canvas=n.create(t,u,c,e.renderType),e.canvasStyle&&(t.canvas.style=e.canvasStyle),e.antialias||s.setCrisp(t.canvas),e.renderType!==r.HEADLESS&&(a=i(68627),h=i(74797),e.renderType===r.WEBGL?t.renderer=new h(t):(t.renderer=new a(t),t.context=t.renderer.gameContext))}},96391:(t,e,i)=>{var s=i(8054);t.exports=function(t){var e=t.config;if(!e.hideBanner){var i="WebGL";e.renderType===s.CANVAS?i="Canvas":e.renderType===s.HEADLESS&&(i="Headless");var n,r=e.audio,o=t.device.audio;if(n=o.webAudio&&!r.disableWebAudio?"Web Audio":r.noAudio||!o.webAudio&&!o.audioData?"No Audio":"HTML5 Audio",t.device.browser.ie)window.console&&console.log("Phaser v"+s.VERSION+" / https://phaser.io");else{var a,h="",l=[h];Array.isArray(e.bannerBackgroundColor)?(e.bannerBackgroundColor.forEach((function(t){h=h.concat("%c "),l.push("background: "+t),a=t})),l[l.length-1]="color: "+e.bannerTextColor+"; background: "+a):(h=h.concat("%c "),l.push("color: "+e.bannerTextColor+"; background: "+e.bannerBackgroundColor)),l.push("background: transparent"),e.gameTitle&&(h=h.concat(e.gameTitle),e.gameVersion&&(h=h.concat(" v"+e.gameVersion)),e.hidePhaser||(h=h.concat(" / "))),e.hidePhaser||(h=h.concat("Phaser v"+s.VERSION+" ("+i+" | "+n+")")),h=h.concat(" %c "+e.gameURL),l[0]=h,console.log.apply(console,l)}}}},50127:(t,e,i)=>{var s=i(40366),n=i(60848),r=i(24047),o=i(27919),a=i(83419),h=i(69547),l=i(83719),u=i(86054),c=i(45893),d=i(96391),f=i(82264),p=i(57264),v=i(50792),g=i(8443),m=i(7003),y=i(37277),x=i(77332),T=i(76531),w=i(60903),b=i(69442),S=i(17130),E=i(65898),A=i(51085),C=i(14747),_=new a({initialize:function(t){this.config=new h(t),this.renderer=null,this.domContainer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new v,this.anims=new n(this),this.textures=new S(this),this.cache=new r(this),this.registry=new c(this,new v),this.input=new m(this,this.config),this.scene=new w(this,this.config.sceneConfig),this.device=f,this.scale=new T(this,this.config),this.sound=null,this.sound=C.create(this),this.loop=new E(this,this.config.fps),this.plugins=new x(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,this.isPaused=!1,p(this.boot.bind(this))},boot:function(){y.hasCore("EventEmitter")?(this.isBooted=!0,this.config.preBoot(this),this.scale.preBoot(),u(this),l(this),d(this),s(this.canvas,this.config.parent),this.textures.once(b.READY,this.texturesReady,this),this.events.emit(g.BOOT)):console.warn("Aborting. Core Plugins missing.")},texturesReady:function(){this.events.emit(g.READY),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),A(this);var t=this.events;t.on(g.HIDDEN,this.onHidden,this),t.on(g.VISIBLE,this.onVisible,this),t.on(g.BLUR,this.onBlur,this),t.on(g.FOCUS,this.onFocus,this)},step:function(t,e){if(this.pendingDestroy)return this.runDestroy();if(!this.isPaused){var i=this.events;i.emit(g.PRE_STEP,t,e),i.emit(g.STEP,t,e),this.scene.update(t,e),i.emit(g.POST_STEP,t,e);var s=this.renderer;s.preRender(),i.emit(g.PRE_RENDER,s,t,e),this.scene.render(s),s.postRender(),i.emit(g.POST_RENDER,s,t,e)}},headlessStep:function(t,e){if(this.pendingDestroy)return this.runDestroy();if(!this.isPaused){var i=this.events;i.emit(g.PRE_STEP,t,e),i.emit(g.STEP,t,e),this.scene.update(t,e),i.emit(g.POST_STEP,t,e),this.scene.isProcessing=!1,i.emit(g.PRE_RENDER,null,t,e),i.emit(g.POST_RENDER,null,t,e)}},onHidden:function(){this.loop.pause(),this.events.emit(g.PAUSE)},pause:function(){var t=this.isPaused;this.isPaused=!0,t||this.events.emit(g.PAUSE)},onVisible:function(){this.loop.resume(),this.events.emit(g.RESUME)},resume:function(){var t=this.isPaused;this.isPaused=!1,t&&this.events.emit(g.RESUME)},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},getFrame:function(){return this.loop.frame},getTime:function(){return this.loop.now},destroy:function(t,e){void 0===e&&(e=!1),this.pendingDestroy=!0,this.removeCanvas=t,this.noReturn=e},runDestroy:function(){this.scene.destroy(),this.events.emit(g.DESTROY),this.events.removeAllListeners(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(o.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.domContainer&&this.domContainer.parentNode&&this.domContainer.parentNode.removeChild(this.domContainer),this.loop.destroy(),this.pendingDestroy=!1}});t.exports=_},65898:(t,e,i)=>{var s=i(83419),n=i(35154),r=i(29747),o=i(43092),a=new s({initialize:function(t,e){this.game=t,this.raf=new o,this.started=!1,this.running=!1,this.minFps=n(e,"min",5),this.targetFps=n(e,"target",60),this.fpsLimit=n(e,"limit",0),this.hasFpsLimit=this.fpsLimit>0,this._limitRate=this.hasFpsLimit?1e3/this.fpsLimit:0,this._min=1e3/this.minFps,this._target=1e3/this.targetFps,this.actualFps=this.targetFps,this.nextFpsUpdate=0,this.framesThisSecond=0,this.callback=r,this.forceSetTimeOut=n(e,"forceSetTimeOut",!1),this.time=0,this.startTime=0,this.lastTime=0,this.frame=0,this.inFocus=!0,this._pauseTime=0,this._coolDown=0,this.delta=0,this.deltaIndex=0,this.deltaHistory=[],this.deltaSmoothingMax=n(e,"deltaHistory",10),this.panicMax=n(e,"panicMax",120),this.rawDelta=0,this.now=0,this.smoothStep=n(e,"smoothStep",!0)},blur:function(){this.inFocus=!1},focus:function(){this.inFocus=!0,this.resetDelta()},pause:function(){this._pauseTime=window.performance.now()},resume:function(){this.resetDelta(),this.startTime+=this.time-this._pauseTime},resetDelta:function(){var t=window.performance.now();this.time=t,this.lastTime=t,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0;for(var e=0;e0||!this.inFocus)&&(this._coolDown--,t=Math.min(t,this._target)),t>this._min&&(t=i[e],t=Math.min(t,this._min)),i[e]=t,this.deltaIndex++,this.deltaIndex>=s&&(this.deltaIndex=0);for(var n=0,r=0;r=this.nextFpsUpdate&&this.updateFPS(t),this.framesThisSecond++,this.delta>=this._limitRate&&(this.callback(t,this.delta),this.delta=0),this.lastTime=t,this.frame++},step:function(t){this.now=t;var e=Math.max(0,t-this.lastTime);this.rawDelta=e,this.time+=this.rawDelta,this.smoothStep&&(e=this.smoothDelta(e)),this.delta=e,t>=this.nextFpsUpdate&&this.updateFPS(t),this.framesThisSecond++,this.callback(t,e),this.lastTime=t,this.frame++},tick:function(){var t=window.performance.now();this.hasFpsLimit?this.stepLimitFPS(t):this.step(t)},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){void 0===t&&(t=!1);var e=window.performance.now();if(!this.running){t&&(this.startTime+=-this.lastTime+(this.lastTime+e));var i=this.hasFpsLimit?this.stepLimitFPS.bind(this):this.step.bind(this);this.raf.start(i,this.forceSetTimeOut,this._target),this.running=!0,this.nextFpsUpdate=e+1e3,this.framesThisSecond=0,this.fpsLimitTriggered=!1,this.tick()}},getDuration:function(){return Math.round(this.lastTime-this.startTime)/1e3},getDurationMS:function(){return Math.round(this.lastTime-this.startTime)},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.raf.destroy(),this.raf=null,this.game=null,this.callback=null}});t.exports=a},51085:(t,e,i)=>{var s=i(8443);t.exports=function(t){var e,i=t.events;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach((function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")})),e&&document.addEventListener(e,(function(t){document.hidden||"pause"===t.type?i.emit(s.HIDDEN):i.emit(s.VISIBLE)}),!1),window.onblur=function(){i.emit(s.BLUR)},window.onfocus=function(){i.emit(s.FOCUS)},window.focus&&t.config.autoFocus&&window.focus()}},97217:t=>{t.exports="blur"},47548:t=>{t.exports="boot"},19814:t=>{t.exports="contextlost"},68446:t=>{t.exports="destroy"},41700:t=>{t.exports="focus"},25432:t=>{t.exports="hidden"},65942:t=>{t.exports="pause"},59211:t=>{t.exports="postrender"},47789:t=>{t.exports="poststep"},39066:t=>{t.exports="prerender"},460:t=>{t.exports="prestep"},16175:t=>{t.exports="ready"},42331:t=>{t.exports="resume"},11966:t=>{t.exports="step"},32969:t=>{t.exports="systemready"},94830:t=>{t.exports="visible"},8443:(t,e,i)=>{t.exports={BLUR:i(97217),BOOT:i(47548),CONTEXT_LOST:i(19814),DESTROY:i(68446),FOCUS:i(41700),HIDDEN:i(25432),PAUSE:i(65942),POST_RENDER:i(59211),POST_STEP:i(47789),PRE_RENDER:i(39066),PRE_STEP:i(460),READY:i(16175),RESUME:i(42331),STEP:i(11966),SYSTEM_READY:i(32969),VISIBLE:i(94830)}},42857:(t,e,i)=>{t.exports={Config:i(69547),CreateRenderer:i(86054),DebugHeader:i(96391),Events:i(8443),TimeStep:i(65898),VisibilityHandler:i(51085)}},99584:(t,e,i)=>{var s=i(5290),n=i(27919),r=i(35154);t.exports=function(t){var e=r(t,"data",[]),i=r(t,"canvas",null),o=r(t,"palette",s),a=r(t,"pixelWidth",1),h=r(t,"pixelHeight",a),l=r(t,"resizeCanvas",!0),u=r(t,"clearCanvas",!0),c=r(t,"preRender",null),d=r(t,"postRender",null),f=Math.floor(Math.abs(e[0].length*a)),p=Math.floor(Math.abs(e.length*h));i||(i=n.create2D(this,f,p),l=!1,u=!1),l&&(i.width=f,i.height=p);var v=i.getContext("2d",{willReadFrequently:!0});u&&v.clearRect(0,0,f,p),c&&c(i,v);for(var g=0;g{t.exports={GenerateTexture:i(99584),Palettes:i(57763)}},5290:t=>{t.exports={0:"#000",1:"#9D9D9D",2:"#FFF",3:"#BE2633",4:"#E06F8B",5:"#493C2B",6:"#A46422",7:"#EB8931",8:"#F7E26B",9:"#2F484E",A:"#44891A",B:"#A3CE27",C:"#1B2632",D:"#005784",E:"#31A2F2",F:"#B2DCEF"}},23816:t=>{t.exports={0:"#000",1:"#fff",2:"#8b4131",3:"#7bbdc5",4:"#8b41ac",5:"#6aac41",6:"#3931a4",7:"#d5de73",8:"#945a20",9:"#5a4100",A:"#bd736a",B:"#525252",C:"#838383",D:"#acee8b",E:"#7b73de",F:"#acacac"}},9866:t=>{t.exports={0:"#000",1:"#2234d1",2:"#0c7e45",3:"#44aacc",4:"#8a3622",5:"#5c2e78",6:"#aa5c3d",7:"#b5b5b5",8:"#5e606e",9:"#4c81fb",A:"#6cd947",B:"#7be2f9",C:"#eb8a60",D:"#e23d69",E:"#ffd93f",F:"#fff"}},77552:t=>{t.exports={0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#f5f4eb"}},92259:t=>{t.exports={0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#fff"}},57763:(t,e,i)=>{t.exports={ARNE16:i(5290),C64:i(23816),CGA:i(9866),JMP:i(77552),MSX:i(92259)}},46728:(t,e,i)=>{var s=i(83419),n=i(36316),r=i(80021),o=i(26099),a=new s({Extends:r,initialize:function(t,e,i,s){r.call(this,"CubicBezierCurve"),Array.isArray(t)&&(s=new o(t[6],t[7]),i=new o(t[4],t[5]),e=new o(t[2],t[3]),t=new o(t[0],t[1])),this.p0=t,this.p1=e,this.p2=i,this.p3=s},getStartPoint:function(t){return void 0===t&&(t=new o),t.copy(this.p0)},getResolution:function(t){return t},getPoint:function(t,e){void 0===e&&(e=new o);var i=this.p0,s=this.p1,r=this.p2,a=this.p3;return e.set(n(t,i.x,s.x,r.x,a.x),n(t,i.y,s.y,r.y,a.y))},draw:function(t,e){void 0===e&&(e=32);var i=this.getPoints(e);t.beginPath(),t.moveTo(this.p0.x,this.p0.y);for(var s=1;s{var s=i(83419),n=i(19217),r=i(87841),o=i(26099),a=new s({initialize:function(t){this.type=t,this.defaultDivisions=5,this.arcLengthDivisions=100,this.cacheArcLengths=[],this.needsUpdate=!0,this.active=!0,this._tmpVec2A=new o,this._tmpVec2B=new o},draw:function(t,e){return void 0===e&&(e=32),t.strokePoints(this.getPoints(e))},getBounds:function(t,e){t||(t=new r),void 0===e&&(e=16);var i=this.getLength();e>i&&(e=i/2);var s=Math.max(1,Math.round(i/e));return n(this.getSpacedPoints(s),t)},getDistancePoints:function(t){var e=this.getLength(),i=Math.max(1,e/t);return this.getSpacedPoints(i)},getEndPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(1,t)},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i=[],s=this.getPoint(0,this._tmpVec2A),n=0;i.push(0);for(var r=1;r<=t;r++)n+=(e=this.getPoint(r/t,this._tmpVec2B)).distance(s),i.push(n),s.copy(e);return this.cacheArcLengths=i,i},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t,e,i){void 0===i&&(i=[]),t||(t=e?this.getLength()/e:this.defaultDivisions);for(var s=0;s<=t;s++)i.push(this.getPoint(s/t));return i},getRandomPoint:function(t){return void 0===t&&(t=new o),this.getPoint(Math.random(),t)},getSpacedPoints:function(t,e,i){void 0===i&&(i=[]),t||(t=e?this.getLength()/e:this.defaultDivisions);for(var s=0;s<=t;s++){var n=this.getUtoTmapping(s/t,null,t);i.push(this.getPoint(n))}return i},getStartPoint:function(t){return void 0===t&&(t=new o),this.getPointAt(0,t)},getTangent:function(t,e){void 0===e&&(e=new o);var i=1e-4,s=t-i,n=t+i;return s<0&&(s=0),n>1&&(n=1),this.getPoint(s,this._tmpVec2A),this.getPoint(n,e),e.subtract(this._tmpVec2A).normalize()},getTangentAt:function(t,e){var i=this.getUtoTmapping(t);return this.getTangent(i,e)},getTFromDistance:function(t,e){return t<=0?0:this.getUtoTmapping(0,t,e)},getUtoTmapping:function(t,e,i){var s,n=this.getLengths(i),r=0,o=n.length;s=e?Math.min(e,n[o-1]):t*n[o-1];for(var a,h=0,l=o-1;h<=l;)if((a=n[r=Math.floor(h+(l-h)/2)]-s)<0)h=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(n[r=l]===s)return r/(o-1);var u=n[r];return(r+(s-u)/(n[r+1]-u))/(o-1)},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()}});t.exports=a},73825:(t,e,i)=>{var s=i(83419),n=i(80021),r=i(39506),o=i(35154),a=i(43396),h=i(26099),l=new s({Extends:n,initialize:function(t,e,i,s,a,l,u,c){if("object"==typeof t){var d=t;t=o(d,"x",0),e=o(d,"y",0),i=o(d,"xRadius",0),s=o(d,"yRadius",i),a=o(d,"startAngle",0),l=o(d,"endAngle",360),u=o(d,"clockwise",!1),c=o(d,"rotation",0)}else void 0===s&&(s=i),void 0===a&&(a=0),void 0===l&&(l=360),void 0===u&&(u=!1),void 0===c&&(c=0);n.call(this,"EllipseCurve"),this.p0=new h(t,e),this._xRadius=i,this._yRadius=s,this._startAngle=r(a),this._endAngle=r(l),this._clockwise=u,this._rotation=r(c)},getStartPoint:function(t){return void 0===t&&(t=new h),this.getPoint(0,t)},getResolution:function(t){return 2*t},getPoint:function(t,e){void 0===e&&(e=new h);for(var i=2*Math.PI,s=this._endAngle-this._startAngle,n=Math.abs(s)i;)s-=i;s{var s=i(83419),n=i(80021),r=i(19217),o=i(87841),a=i(26099),h=new s({Extends:n,initialize:function(t,e){n.call(this,"LineCurve"),Array.isArray(t)&&(e=new a(t[2],t[3]),t=new a(t[0],t[1])),this.p0=t,this.p1=e,this.arcLengthDivisions=1},getBounds:function(t){return void 0===t&&(t=new o),r([this.p0,this.p1],t)},getStartPoint:function(t){return void 0===t&&(t=new a),t.copy(this.p0)},getResolution:function(t){return void 0===t&&(t=1),t},getPoint:function(t,e){return void 0===e&&(e=new a),1===t?e.copy(this.p1):(e.copy(this.p1).subtract(this.p0).scale(t).add(this.p0),e)},getPointAt:function(t,e){return this.getPoint(t,e)},getTangent:function(t,e){return void 0===e&&(e=new a),e.copy(this.p1).subtract(this.p0).normalize(),e},getUtoTmapping:function(t,e,i){var s;if(e){var n=this.getLengths(i),r=n[n.length-1];s=Math.min(e,r)/r}else s=t;return s},draw:function(t){return t.lineBetween(this.p0.x,this.p0.y,this.p1.x,this.p1.y),t},toJSON:function(){return{type:this.type,points:[this.p0.x,this.p0.y,this.p1.x,this.p1.y]}}});h.fromJSON=function(t){var e=t.points,i=new a(e[0],e[1]),s=new a(e[2],e[3]);return new h(i,s)},t.exports=h},14744:(t,e,i)=>{var s=i(83419),n=i(80021),r=i(32112),o=i(26099),a=new s({Extends:n,initialize:function(t,e,i){n.call(this,"QuadraticBezierCurve"),Array.isArray(t)&&(i=new o(t[4],t[5]),e=new o(t[2],t[3]),t=new o(t[0],t[1])),this.p0=t,this.p1=e,this.p2=i},getStartPoint:function(t){return void 0===t&&(t=new o),t.copy(this.p0)},getResolution:function(t){return t},getPoint:function(t,e){void 0===e&&(e=new o);var i=this.p0,s=this.p1,n=this.p2;return e.set(r(t,i.x,s.x,n.x),r(t,i.y,s.y,n.y))},draw:function(t,e){void 0===e&&(e=32);var i=this.getPoints(e);t.beginPath(),t.moveTo(this.p0.x,this.p0.y);for(var s=1;s{var s=i(87842),n=i(83419),r=i(80021),o=i(26099),a=new n({Extends:r,initialize:function(t){void 0===t&&(t=[]),r.call(this,"SplineCurve"),this.points=[],this.addPoints(t)},addPoints:function(t){for(var e=0;ei.length-2?i.length-1:r+1],c=i[r>i.length-3?i.length-1:r+2];return e.set(s(a,h.x,l.x,u.x,c.x),s(a,h.y,l.y,u.y,c.y))},toJSON:function(){for(var t=[],e=0;e{t.exports={Path:i(46669),MoveTo:i(68618),CubicBezier:i(46728),Curve:i(80021),Ellipse:i(73825),Line:i(33951),QuadraticBezier:i(14744),Spline:i(42534)}},68618:(t,e,i)=>{var s=i(83419),n=i(26099),r=new s({initialize:function(t,e){this.active=!1,this.p0=new n(t,e)},getPoint:function(t,e){return void 0===e&&(e=new n),e.copy(this.p0)},getPointAt:function(t,e){return this.getPoint(t,e)},getResolution:function(){return 1},getLength:function(){return 0},toJSON:function(){return{type:"MoveTo",points:[this.p0.x,this.p0.y]}}});t.exports=r},46669:(t,e,i)=>{var s=i(83419),n=i(46728),r=i(73825),o=i(39429),a=i(33951),h=i(68618),l=i(14744),u=i(87841),c=i(42534),d=i(26099),f=i(36383),p=new s({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.defaultDivisions=12,this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new a(e,t)),this},cubicBezierTo:function(t,e,i,s,r,o){var a,h,l,u=this.getEndPoint();return t instanceof d?(a=t,h=e,l=i):(a=new d(i,s),h=new d(r,o),l=new d(t,e)),this.add(new n(u,a,h,l))},quadraticBezierTo:function(t,e,i,s){var n,r,o=this.getEndPoint();return t instanceof d?(n=t,r=e):(n=new d(i,s),r=new d(t,e)),this.add(new l(o,n,r))},draw:function(t,e){for(var i=0;i=e)return this.curves[s];s++}return null},getEndPoint:function(t){return void 0===t&&(t=new d),this.curves.length>0?this.curves[this.curves.length-1].getPoint(1,t):t.copy(this.startPoint),t},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},getPoint:function(t,e){void 0===e&&(e=new d);for(var i=t*this.getLength(),s=this.getCurveLengths(),n=0;n=i){var r=s[n]-i,o=this.curves[n],a=o.getLength(),h=0===a?0:1-r/a;return o.getPointAt(h,e)}n++}return null},getPoints:function(t,e){t||e||(t=this.defaultDivisions);for(var i,s=[],n=0;n1&&!s[s.length-1].equals(s[0])&&s.push(s[0]),s},getRandomPoint:function(t){return void 0===t&&(t=new d),this.getPoint(Math.random(),t)},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getStartPoint:function(t){return void 0===t&&(t=new d),t.copy(this.startPoint)},getTangent:function(t,e){void 0===e&&(e=new d);for(var i=t*this.getLength(),s=this.getCurveLengths(),n=0;n=i){var r=s[n]-i,o=this.curves[n],a=o.getLength(),h=0===a?0:1-r/a;return o.getTangentAt(h,e)}n++}return null},lineTo:function(t,e){t instanceof d?this._tmpVec2B.copy(t):"object"==typeof t?this._tmpVec2B.setFromObject(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new a([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new c(t))},moveTo:function(t,e){return t instanceof d?this.add(new h(t.x,t.y)):this.add(new h(t,e))},toJSON:function(){for(var t=[],e=0;e{var s=i(83419),n=i(24882),r=new s({initialize:function(t,e){this.parent=t,this.events=e,e||(this.events=t.events?t.events:t),this.list={},this.values={},this._frozen=!1,!t.hasOwnProperty("sys")&&this.events&&this.events.once(n.DESTROY,this.destroy,this)},get:function(t){var e=this.list;if(Array.isArray(t)){for(var i=[],s=0;s{var s=i(83419),n=i(45893),r=i(37277),o=i(44594),a=new s({Extends:n,initialize:function(t){n.call(this,t,t.sys.events),this.scene=t,this.systems=t.sys,t.sys.events.once(o.BOOT,this.boot,this),t.sys.events.on(o.START,this.start,this)},boot:function(){this.events=this.systems.events,this.events.once(o.DESTROY,this.destroy,this)},start:function(){this.events.once(o.SHUTDOWN,this.shutdown,this)},shutdown:function(){this.systems.events.off(o.SHUTDOWN,this.shutdown,this)},destroy:function(){n.prototype.destroy.call(this),this.events.off(o.START,this.start,this),this.scene=null,this.systems=null}});r.register("DataManagerPlugin",a,"data"),t.exports=a},10700:t=>{t.exports="changedata"},93608:t=>{t.exports="changedata-"},60883:t=>{t.exports="destroy"},69780:t=>{t.exports="removedata"},22166:t=>{t.exports="setdata"},24882:(t,e,i)=>{t.exports={CHANGE_DATA:i(10700),CHANGE_DATA_KEY:i(93608),DESTROY:i(60883),REMOVE_DATA:i(69780),SET_DATA:i(22166)}},44965:(t,e,i)=>{t.exports={DataManager:i(45893),DataManagerPlugin:i(63646),Events:i(24882)}},7098:(t,e,i)=>{var s=i(84148),n={flac:!1,aac:!1,audioData:!1,dolby:!1,m4a:!1,mp3:!1,ogg:!1,opus:!1,wav:!1,webAudio:!1,webm:!1};t.exports=function(){if("function"==typeof importScripts)return n;n.audioData=!!window.Audio,n.webAudio=!(!window.AudioContext&&!window.webkitAudioContext);var t=document.createElement("audio"),e=!!t.canPlayType;try{if(e){var i=function(e,i){var s=t.canPlayType("audio/"+e).replace(/^no$/,"");return i?Boolean(s||t.canPlayType("audio/"+i).replace(/^no$/,"")):Boolean(s)};if(n.ogg=i('ogg; codecs="vorbis"'),n.opus=i('ogg; codecs="opus"',"opus"),n.mp3=i("mpeg"),n.wav=i("wav"),n.m4a=i("x-m4a"),n.aac=i("aac"),n.flac=i("flac","x-flac"),n.webm=i('webm; codecs="vorbis"'),""!==t.canPlayType('audio/mp4; codecs="ec-3"'))if(s.edge)n.dolby=!0;else if(s.safari&&s.safariVersion>=9&&/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)){var r=parseInt(RegExp.$1,10),o=parseInt(RegExp.$2,10);(10===r&&o>=11||r>10)&&(n.dolby=!0)}}}catch(a){}return n}()},84148:(t,e,i)=>{var s,n=i(25892),r={chrome:!1,chromeVersion:0,edge:!1,firefox:!1,firefoxVersion:0,ie:!1,ieVersion:0,mobileSafari:!1,opera:!1,safari:!1,safariVersion:0,silk:!1,trident:!1,tridentVersion:0,es2019:!1};t.exports=(s=navigator.userAgent,/Edg\/\d+/.test(s)?(r.edge=!0,r.es2019=!0):/OPR/.test(s)?(r.opera=!0,r.es2019=!0):/Chrome\/(\d+)/.test(s)&&!n.windowsPhone?(r.chrome=!0,r.chromeVersion=parseInt(RegExp.$1,10),r.es2019=r.chromeVersion>69):/Firefox\D+(\d+)/.test(s)?(r.firefox=!0,r.firefoxVersion=parseInt(RegExp.$1,10),r.es2019=r.firefoxVersion>10):/AppleWebKit\/(?!.*CriOS)/.test(s)&&n.iOS?(r.mobileSafari=!0,r.es2019=!0):/MSIE (\d+\.\d+);/.test(s)?(r.ie=!0,r.ieVersion=parseInt(RegExp.$1,10)):/Version\/(\d+\.\d+(\.\d+)?) Safari/.test(s)&&!n.windowsPhone?(r.safari=!0,r.safariVersion=parseInt(RegExp.$1,10),r.es2019=r.safariVersion>10):/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(s)&&(r.ie=!0,r.trident=!0,r.tridentVersion=parseInt(RegExp.$1,10),r.ieVersion=parseInt(RegExp.$3,10)),/Silk/.test(s)&&(r.silk=!0),r)},89289:(t,e,i)=>{var s,n,r,o=i(27919),a={supportInverseAlpha:!1,supportNewBlendModes:!1};t.exports=("function"!=typeof importScripts&&void 0!==document&&(a.supportNewBlendModes=(s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",n="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",(r=new Image).onload=function(){var t=new Image;t.onload=function(){var e=o.create2D(t,6).getContext("2d",{willReadFrequently:!0});if(e.globalCompositeOperation="multiply",e.drawImage(r,0,0),e.drawImage(t,2,0),!e.getImageData(2,0,1,1))return!1;var i=e.getImageData(2,0,1,1).data;o.remove(t),a.supportNewBlendModes=255===i[0]&&0===i[1]&&0===i[2]},t.src=s+"/wCKxvRF"+n},r.src=s+"AP804Oa6"+n,!1),a.supportInverseAlpha=function(){var t=o.create2D(this,2).getContext("2d",{willReadFrequently:!0});t.fillStyle="rgba(10, 20, 30, 0.5)",t.fillRect(0,0,1,1);var e=t.getImageData(0,0,1,1);if(null===e)return!1;t.putImageData(e,1,0);var i=t.getImageData(1,0,1,1),s=i.data[0]===e.data[0]&&i.data[1]===e.data[1]&&i.data[2]===e.data[2]&&i.data[3]===e.data[3];return o.remove(this),s}()),a)},89357:(t,e,i)=>{var s=i(25892),n=i(84148),r=i(27919),o={canvas:!1,canvasBitBltShift:null,file:!1,fileSystem:!1,getUserMedia:!0,littleEndian:!1,localStorage:!1,pointerLock:!1,stableSort:!1,support32bit:!1,vibration:!1,webGL:!1,worker:!1};t.exports=function(){if("function"==typeof importScripts)return o;o.canvas=!!window.CanvasRenderingContext2D;try{o.localStorage=!!localStorage.getItem}catch(h){o.localStorage=!1}o.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),o.fileSystem=!!window.requestFileSystem;var t,e,i,a=!1;return o.webGL=function(){if(window.WebGLRenderingContext)try{var t=r.createWebGL(this),e=t.getContext("webgl")||t.getContext("experimental-webgl"),i=r.create2D(this),s=i.getContext("2d",{willReadFrequently:!0}).createImageData(1,1);return a=s.data instanceof Uint8ClampedArray,r.remove(t),r.remove(i),!!e}catch(n){return!1}return!1}(),o.worker=!!window.Worker,o.pointerLock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.oGetUserMedia,window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,o.getUserMedia=o.getUserMedia&&!!navigator.getUserMedia&&!!window.URL,n.firefox&&n.firefoxVersion<21&&(o.getUserMedia=!1),!s.iOS&&(n.ie||n.firefox||n.chrome)&&(o.canvasBitBltShift=!0),(n.safari||n.mobileSafari)&&(o.canvasBitBltShift=!1),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(o.vibration=!0),"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint32Array&&(o.littleEndian=(t=new ArrayBuffer(4),e=new Uint8Array(t),i=new Uint32Array(t),e[0]=161,e[1]=178,e[2]=195,e[3]=212,3569595041===i[0]||2712847316!==i[0]&&null)),o.support32bit="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof Int32Array&&null!==o.littleEndian&&a,o}()},91639:t=>{var e={available:!1,cancel:"",keyboard:!1,request:""};t.exports=function(){if("function"==typeof importScripts)return e;var t,i="Fullscreen",s="FullScreen",n=["request"+i,"request"+s,"webkitRequest"+i,"webkitRequest"+s,"msRequest"+i,"msRequest"+s,"mozRequest"+s,"mozRequest"+i];for(t=0;t{var s=i(84148),n={gamepads:!1,mspointer:!1,touch:!1,wheelEvent:null};t.exports=("function"==typeof importScripts||(("ontouchstart"in document.documentElement||navigator.maxTouchPoints&&navigator.maxTouchPoints>=1)&&(n.touch=!0),(navigator.msPointerEnabled||navigator.pointerEnabled)&&(n.mspointer=!0),navigator.getGamepads&&(n.gamepads=!0),"onwheel"in window||s.ie&&"WheelEvent"in window?n.wheelEvent="wheel":"onmousewheel"in window?n.wheelEvent="mousewheel":s.firefox&&"MouseScrollEvent"in window&&(n.wheelEvent="DOMMouseScroll")),n)},25892:t=>{var e={android:!1,chromeOS:!1,cordova:!1,crosswalk:!1,desktop:!1,ejecta:!1,electron:!1,iOS:!1,iOSVersion:0,iPad:!1,iPhone:!1,kindle:!1,linux:!1,macOS:!1,node:!1,nodeWebkit:!1,pixelRatio:1,webApp:!1,windows:!1,windowsPhone:!1};t.exports=function(){if("function"==typeof importScripts)return e;var t=navigator.userAgent;/Windows/.test(t)?e.windows=!0:/Mac OS/.test(t)&&!/like Mac OS/.test(t)?navigator.maxTouchPoints&&navigator.maxTouchPoints>2?(e.iOS=!0,e.iPad=!0,navigator.appVersion.match(/Version\/(\d+)/),e.iOSVersion=parseInt(RegExp.$1,10)):e.macOS=!0:/Android/.test(t)?e.android=!0:/Linux/.test(t)?e.linux=!0:/iP[ao]d|iPhone/i.test(t)?(e.iOS=!0,navigator.appVersion.match(/OS (\d+)/),e.iOSVersion=parseInt(RegExp.$1,10),e.iPhone=-1!==t.toLowerCase().indexOf("iphone"),e.iPad=-1!==t.toLowerCase().indexOf("ipad")):/Kindle/.test(t)||/\bKF[A-Z][A-Z]+/.test(t)||/Silk.*Mobile Safari/.test(t)?e.kindle=!0:/CrOS/.test(t)&&(e.chromeOS=!0),(/Windows Phone/i.test(t)||/IEMobile/i.test(t))&&(e.android=!1,e.iOS=!1,e.macOS=!1,e.windows=!0,e.windowsPhone=!0);var i=/Silk/.test(t);return(e.windows||e.macOS||e.linux&&!i||e.chromeOS)&&(e.desktop=!0),(e.windowsPhone||/Windows NT/i.test(t)&&/Touch/i.test(t))&&(e.desktop=!1),navigator.standalone&&(e.webApp=!0),"function"!=typeof importScripts&&(void 0!==window.cordova&&(e.cordova=!0),void 0!==window.ejecta&&(e.ejecta=!0)),"undefined"!=typeof process&&process.versions&&process.versions.node&&(e.node=!0),e.node&&"object"==typeof process.versions&&(e.nodeWebkit=!!process.versions["node-webkit"],e.electron=!!process.versions.electron),/Crosswalk/.test(t)&&(e.crosswalk=!0),e.pixelRatio=window.devicePixelRatio||1,e}()},43267:(t,e,i)=>{var s=i(95540),n={h264:!1,hls:!1,mp4:!1,m4v:!1,ogg:!1,vp9:!1,webm:!1,hasRequestVideoFrame:!1};t.exports=function(){if("function"==typeof importScripts)return n;var t=document.createElement("video"),e=!!t.canPlayType,i=/^no$/;try{e&&(t.canPlayType('video/ogg; codecs="theora"').replace(i,"")&&(n.ogg=!0),t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(i,"")&&(n.h264=!0,n.mp4=!0),t.canPlayType("video/x-m4v").replace(i,"")&&(n.m4v=!0),t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(i,"")&&(n.webm=!0),t.canPlayType('video/webm; codecs="vp9"').replace(i,"")&&(n.vp9=!0),t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(i,"")&&(n.hls=!0))}catch(r){}return t.parentNode&&t.parentNode.removeChild(t),n.getVideoURL=function(t){Array.isArray(t)||(t=[t]);for(var e=0;e{t.exports={os:i(25892),browser:i(84148),features:i(89357),input:i(31784),audio:i(7098),video:i(43267),fullscreen:i(91639),canvasFeatures:i(89289)}},89422:(t,e,i)=>{var s=i(83419),n=new Float32Array(20),r=new s({initialize:function(){this._matrix=new Float32Array(20),this.alpha=1,this._dirty=!0,this._data=new Float32Array(20),this.reset()},set:function(t){return this._matrix.set(t),this._dirty=!0,this},reset:function(){var t=this._matrix;return t.fill(0),t[0]=1,t[6]=1,t[12]=1,t[18]=1,this.alpha=1,this._dirty=!0,this},getData:function(){var t=this._data;return this._dirty&&(t.set(this._matrix),t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,this._dirty=!1),t},brightness:function(t,e){void 0===t&&(t=0),void 0===e&&(e=!1);var i=t;return this.multiply([i,0,0,0,0,0,i,0,0,0,0,0,i,0,0,0,0,0,1,0],e)},saturate:function(t,e){void 0===t&&(t=0),void 0===e&&(e=!1);var i=2*t/3+1,s=-.5*(i-1);return this.multiply([i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0],e)},desaturate:function(t){return void 0===t&&(t=!1),this.saturate(-1,t)},hue:function(t,e){void 0===t&&(t=0),void 0===e&&(e=!1),t=t/180*Math.PI;var i=Math.cos(t),s=Math.sin(t),n=.213,r=.715,o=.072;return this.multiply([n+.787*i+s*-n,r+i*-r+s*-r,o+i*-o+.928*s,0,0,n+i*-n+.143*s,r+i*(1-r)+.14*s,o+i*-o+-.283*s,0,0,n+i*-n+-.787*s,r+i*-r+s*r,o+.928*i+s*o,0,0,0,0,0,1,0],e)},grayscale:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=!1),this.saturate(-t,e)},blackWhite:function(t){return void 0===t&&(t=!1),this.multiply(r.BLACK_WHITE,t)},contrast:function(t,e){void 0===t&&(t=0),void 0===e&&(e=!1);var i=t+1,s=-.5*(i-1);return this.multiply([i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0],e)},negative:function(t){return void 0===t&&(t=!1),this.multiply(r.NEGATIVE,t)},desaturateLuminance:function(t){return void 0===t&&(t=!1),this.multiply(r.DESATURATE_LUMINANCE,t)},sepia:function(t){return void 0===t&&(t=!1),this.multiply(r.SEPIA,t)},night:function(t,e){return void 0===t&&(t=.1),void 0===e&&(e=!1),this.multiply([-2*t,-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0],e)},lsd:function(t){return void 0===t&&(t=!1),this.multiply(r.LSD,t)},brown:function(t){return void 0===t&&(t=!1),this.multiply(r.BROWN,t)},vintagePinhole:function(t){return void 0===t&&(t=!1),this.multiply(r.VINTAGE,t)},kodachrome:function(t){return void 0===t&&(t=!1),this.multiply(r.KODACHROME,t)},technicolor:function(t){return void 0===t&&(t=!1),this.multiply(r.TECHNICOLOR,t)},polaroid:function(t){return void 0===t&&(t=!1),this.multiply(r.POLAROID,t)},shiftToBGR:function(t){return void 0===t&&(t=!1),this.multiply(r.SHIFT_BGR,t)},multiply:function(t,e){void 0===e&&(e=!1),e||this.reset();var i=this._matrix,s=n;return s.set(i),i.set([s[0]*t[0]+s[1]*t[5]+s[2]*t[10]+s[3]*t[15],s[0]*t[1]+s[1]*t[6]+s[2]*t[11]+s[3]*t[16],s[0]*t[2]+s[1]*t[7]+s[2]*t[12]+s[3]*t[17],s[0]*t[3]+s[1]*t[8]+s[2]*t[13]+s[3]*t[18],s[0]*t[4]+s[1]*t[9]+s[2]*t[14]+s[3]*t[19]+s[4],s[5]*t[0]+s[6]*t[5]+s[7]*t[10]+s[8]*t[15],s[5]*t[1]+s[6]*t[6]+s[7]*t[11]+s[8]*t[16],s[5]*t[2]+s[6]*t[7]+s[7]*t[12]+s[8]*t[17],s[5]*t[3]+s[6]*t[8]+s[7]*t[13]+s[8]*t[18],s[5]*t[4]+s[6]*t[9]+s[7]*t[14]+s[8]*t[19]+s[9],s[10]*t[0]+s[11]*t[5]+s[12]*t[10]+s[13]*t[15],s[10]*t[1]+s[11]*t[6]+s[12]*t[11]+s[13]*t[16],s[10]*t[2]+s[11]*t[7]+s[12]*t[12]+s[13]*t[17],s[10]*t[3]+s[11]*t[8]+s[12]*t[13]+s[13]*t[18],s[10]*t[4]+s[11]*t[9]+s[12]*t[14]+s[13]*t[19]+s[14],s[15]*t[0]+s[16]*t[5]+s[17]*t[10]+s[18]*t[15],s[15]*t[1]+s[16]*t[6]+s[17]*t[11]+s[18]*t[16],s[15]*t[2]+s[16]*t[7]+s[17]*t[12]+s[18]*t[17],s[15]*t[3]+s[16]*t[8]+s[17]*t[13]+s[18]*t[18],s[15]*t[4]+s[16]*t[9]+s[17]*t[14]+s[18]*t[19]+s[19]]),this._dirty=!0,this}});r.BLACK_WHITE=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],r.NEGATIVE=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],r.DESATURATE_LUMINANCE=[.2764723,.929708,.0938197,0,-37.1,.2764723,.929708,.0938197,0,-37.1,.2764723,.929708,.0938197,0,-37.1,0,0,0,1,0],r.SEPIA=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],r.LSD=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],r.BROWN=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],r.VINTAGE=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],r.KODACHROME=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],r.TECHNICOLOR=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],r.POLAROID=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],r.SHIFT_BGR=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t.exports=r},51767:(t,e,i)=>{var s=i(83419),n=i(29747),r=new s({initialize:function(t,e,i){this._rgb=[0,0,0],this.onChangeCallback=n,this.dirty=!1,this.set(t,e,i)},set:function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this._rgb=[t,e,i],this.onChange(),this},equals:function(t,e,i){var s=this._rgb;return s[0]===t&&s[1]===e&&s[2]===i},onChange:function(){this.dirty=!0;var t=this._rgb;this.onChangeCallback.call(this,t[0],t[1],t[2])},r:{get:function(){return this._rgb[0]},set:function(t){this._rgb[0]=t,this.onChange()}},g:{get:function(){return this._rgb[1]},set:function(t){this._rgb[1]=t,this.onChange()}},b:{get:function(){return this._rgb[2]},set:function(t){this._rgb[2]=t,this.onChange()}},destroy:function(){this.onChangeCallback=null}});t.exports=r},60461:t=>{t.exports={TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12}},54312:(t,e,i)=>{var s=i(62235),n=i(35893),r=i(86327),o=i(88417);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)+a),t}},46768:(t,e,i)=>{var s=i(62235),n=i(26541),r=i(86327),o=i(385);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)+a),t}},35827:(t,e,i)=>{var s=i(62235),n=i(54380),r=i(86327),o=i(40136);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)+a),t}},46871:(t,e,i)=>{var s=i(66786),n=i(35893),r=i(7702);t.exports=function(t,e,i,o){return void 0===i&&(i=0),void 0===o&&(o=0),s(t,n(e)+i,r(e)+o),t}},5198:(t,e,i)=>{var s=i(7702),n=i(26541),r=i(20786),o=i(385);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)+a),t}},11879:(t,e,i)=>{var s=i(60461),n=[];n[s.BOTTOM_CENTER]=i(54312),n[s.BOTTOM_LEFT]=i(46768),n[s.BOTTOM_RIGHT]=i(35827),n[s.CENTER]=i(46871),n[s.LEFT_CENTER]=i(5198),n[s.RIGHT_CENTER]=i(80503),n[s.TOP_CENTER]=i(89698),n[s.TOP_LEFT]=i(922),n[s.TOP_RIGHT]=i(21373),n[s.LEFT_BOTTOM]=n[s.BOTTOM_LEFT],n[s.LEFT_TOP]=n[s.TOP_LEFT],n[s.RIGHT_BOTTOM]=n[s.BOTTOM_RIGHT],n[s.RIGHT_TOP]=n[s.TOP_RIGHT],t.exports=function(t,e,i,s,r){return n[i](t,e,s,r)}},80503:(t,e,i)=>{var s=i(7702),n=i(54380),r=i(20786),o=i(40136);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)+a),t}},89698:(t,e,i)=>{var s=i(35893),n=i(17717),r=i(88417),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)-a),t}},922:(t,e,i)=>{var s=i(26541),n=i(17717),r=i(385),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)-i),o(t,n(e)-a),t}},21373:(t,e,i)=>{var s=i(54380),n=i(17717),r=i(40136),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)-a),t}},91660:(t,e,i)=>{t.exports={BottomCenter:i(54312),BottomLeft:i(46768),BottomRight:i(35827),Center:i(46871),LeftCenter:i(5198),QuickSet:i(11879),RightCenter:i(80503),TopCenter:i(89698),TopLeft:i(922),TopRight:i(21373)}},71926:(t,e,i)=>{var s=i(60461),n=i(79291),r={In:i(91660),To:i(16694)};r=n(!1,r,s),t.exports=r},21578:(t,e,i)=>{var s=i(62235),n=i(35893),r=i(88417),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)+a),t}},10210:(t,e,i)=>{var s=i(62235),n=i(26541),r=i(385),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)-i),o(t,s(e)+a),t}},82341:(t,e,i)=>{var s=i(62235),n=i(54380),r=i(40136),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,n(e)+i),o(t,s(e)+a),t}},87958:(t,e,i)=>{var s=i(62235),n=i(26541),r=i(86327),o=i(40136);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)+a),t}},40080:(t,e,i)=>{var s=i(7702),n=i(26541),r=i(20786),o=i(40136);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)-i),r(t,s(e)+a),t}},88466:(t,e,i)=>{var s=i(26541),n=i(17717),r=i(40136),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)-i),o(t,n(e)-a),t}},38829:(t,e,i)=>{var s=i(60461),n=[];n[s.BOTTOM_CENTER]=i(21578),n[s.BOTTOM_LEFT]=i(10210),n[s.BOTTOM_RIGHT]=i(82341),n[s.LEFT_BOTTOM]=i(87958),n[s.LEFT_CENTER]=i(40080),n[s.LEFT_TOP]=i(88466),n[s.RIGHT_BOTTOM]=i(19211),n[s.RIGHT_CENTER]=i(34609),n[s.RIGHT_TOP]=i(48741),n[s.TOP_CENTER]=i(49440),n[s.TOP_LEFT]=i(81288),n[s.TOP_RIGHT]=i(61323),t.exports=function(t,e,i,s,r){return n[i](t,e,s,r)}},19211:(t,e,i)=>{var s=i(62235),n=i(54380),r=i(86327),o=i(385);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)+a),t}},34609:(t,e,i)=>{var s=i(7702),n=i(54380),r=i(20786),o=i(385);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,n(e)+i),r(t,s(e)+a),t}},48741:(t,e,i)=>{var s=i(54380),n=i(17717),r=i(385),o=i(66737);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),r(t,s(e)+i),o(t,n(e)-a),t}},49440:(t,e,i)=>{var s=i(35893),n=i(17717),r=i(86327),o=i(88417);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)-a),t}},81288:(t,e,i)=>{var s=i(26541),n=i(17717),r=i(86327),o=i(385);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)-i),r(t,n(e)-a),t}},61323:(t,e,i)=>{var s=i(54380),n=i(17717),r=i(86327),o=i(40136);t.exports=function(t,e,i,a){return void 0===i&&(i=0),void 0===a&&(a=0),o(t,s(e)+i),r(t,n(e)-a),t}},16694:(t,e,i)=>{t.exports={BottomCenter:i(21578),BottomLeft:i(10210),BottomRight:i(82341),LeftBottom:i(87958),LeftCenter:i(40080),LeftTop:i(88466),QuickSet:i(38829),RightBottom:i(19211),RightCenter:i(34609),RightTop:i(48741),TopCenter:i(49440),TopLeft:i(81288),TopRight:i(61323)}},66786:(t,e,i)=>{var s=i(88417),n=i(20786);t.exports=function(t,e,i){return s(t,e),n(t,i)}},62235:t=>{t.exports=function(t){return t.y+t.height-t.height*t.originY}},72873:(t,e,i)=>{var s=i(62235),n=i(26541),r=i(54380),o=i(17717),a=i(87841);t.exports=function(t,e){void 0===e&&(e=new a);var i=n(t),h=o(t);return e.x=i,e.y=h,e.width=r(t)-i,e.height=s(t)-h,e}},35893:t=>{t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},7702:t=>{t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},26541:t=>{t.exports=function(t){return t.x-t.width*t.originX}},87431:t=>{t.exports=function(t){return t.width*t.originX}},46928:t=>{t.exports=function(t){return t.height*t.originY}},54380:t=>{t.exports=function(t){return t.x+t.width-t.width*t.originX}},17717:t=>{t.exports=function(t){return t.y-t.height*t.originY}},86327:t=>{t.exports=function(t,e){return t.y=e-t.height+t.height*t.originY,t}},88417:t=>{t.exports=function(t,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},20786:t=>{t.exports=function(t,e){var i=t.height*t.originY;return t.y=e+i-.5*t.height,t}},385:t=>{t.exports=function(t,e){return t.x=e+t.width*t.originX,t}},40136:t=>{t.exports=function(t,e){return t.x=e-t.width+t.width*t.originX,t}},66737:t=>{t.exports=function(t,e){return t.y=e+t.height*t.originY,t}},58724:(t,e,i)=>{t.exports={CenterOn:i(66786),GetBottom:i(62235),GetBounds:i(72873),GetCenterX:i(35893),GetCenterY:i(7702),GetLeft:i(26541),GetOffsetX:i(87431),GetOffsetY:i(46928),GetRight:i(54380),GetTop:i(17717),SetBottom:i(86327),SetCenterX:i(88417),SetCenterY:i(20786),SetLeft:i(385),SetRight:i(40136),SetTop:i(66737)}},20623:t=>{t.exports={setCrisp:function(t){return["optimizeSpeed","-moz-crisp-edges","-o-crisp-edges","-webkit-optimize-contrast","optimize-contrast","crisp-edges","pixelated"].forEach((function(e){t.style["image-rendering"]=e})),t.style.msInterpolationMode="nearest-neighbor",t},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},27919:(t,e,i)=>{var s,n,r,o=i(8054),a=i(68703),h=[],l=!1;t.exports=(r=function(){var t=0;return h.forEach((function(e){e.parent&&t++})),t},{create2D:function(t,e,i){return s(t,e,i,o.CANVAS)},create:s=function(t,e,i,s,r){var u;void 0===e&&(e=1),void 0===i&&(i=1),void 0===s&&(s=o.CANVAS),void 0===r&&(r=!1);var c=n(s);return null===c?(c={parent:t,canvas:document.createElement("canvas"),type:s},s===o.CANVAS&&h.push(c),u=c.canvas):(c.parent=t,u=c.canvas),r&&(c.parent=u),u.width=e,u.height=i,l&&s===o.CANVAS&&a.disable(u.getContext("2d",{willReadFrequently:!1})),u},createWebGL:function(t,e,i){return s(t,e,i,o.WEBGL)},disableSmoothing:function(){l=!0},enableSmoothing:function(){l=!1},first:n=function(t){if(void 0===t&&(t=o.CANVAS),t===o.WEBGL)return null;for(var e=0;e{var e,i="";t.exports={disable:function(t){return""===i&&(i=e(t)),i&&(t[i]=!1),t},enable:function(t){return""===i&&(i=e(t)),i&&(t[i]=!0),t},getPrefix:e=function(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;i{t.exports=function(t,e){return void 0===e&&(e="none"),t.style.msTouchAction=e,t.style["ms-touch-action"]=e,t.style["touch-action"]=e,t}},91610:t=>{t.exports=function(t,e){return void 0===e&&(e="none"),["-webkit-","-khtml-","-moz-","-ms-",""].forEach((function(i){t.style[i+"user-select"]=e})),t.style["-webkit-touch-callout"]=e,t.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",t}},26253:(t,e,i)=>{t.exports={CanvasInterpolation:i(20623),CanvasPool:i(27919),Smoothing:i(68703),TouchAction:i(65208),UserSelect:i(91610)}},40987:(t,e,i)=>{var s=i(83419),n=i(37589),r=i(1e3),o=i(7537),a=i(87837),h=new s({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=255),this.r=0,this.g=0,this.b=0,this.a=255,this._h=0,this._s=0,this._v=0,this._locked=!1,this.gl=[0,0,0,1],this._color=0,this._color32=0,this._rgba="",this.setTo(t,e,i,s)},transparent:function(){return this._locked=!0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this._locked=!1,this.update(!0)},setTo:function(t,e,i,s,n){return void 0===s&&(s=255),void 0===n&&(n=!0),this._locked=!0,this.red=t,this.green=e,this.blue=i,this.alpha=s,this._locked=!1,this.update(n)},setGLTo:function(t,e,i,s){return void 0===s&&(s=1),this._locked=!0,this.redGL=t,this.greenGL=e,this.blueGL=i,this.alphaGL=s,this._locked=!1,this.update(!0)},setFromRGB:function(t){return this._locked=!0,this.red=t.r,this.green=t.g,this.blue=t.b,t.hasOwnProperty("a")&&(this.alpha=t.a),this._locked=!1,this.update(!0)},setFromHSV:function(t,e,i){return o(t,e,i,this)},update:function(t){if(void 0===t&&(t=!1),this._locked)return this;var e=this.r,i=this.g,s=this.b,o=this.a;return this._color=n(e,i,s),this._color32=r(e,i,s,o),this._rgba="rgba("+e+","+i+","+s+","+o/255+")",t&&a(e,i,s,this),this},updateHSV:function(){var t=this.r,e=this.g,i=this.b;return a(t,e,i,this),this},clone:function(){return new h(this.r,this.g,this.b,this.a)},gray:function(t){return this.setTo(t,t,t)},random:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t)),s=Math.floor(t+Math.random()*(e-t)),n=Math.floor(t+Math.random()*(e-t));return this.setTo(i,s,n)},randomGray:function(t,e){void 0===t&&(t=0),void 0===e&&(e=255);var i=Math.floor(t+Math.random()*(e-t));return this.setTo(i,i,i)},saturate:function(t){return this.s+=t/100,this},desaturate:function(t){return this.s-=t/100,this},lighten:function(t){return this.v+=t/100,this},darken:function(t){return this.v-=t/100,this},brighten:function(t){var e=this.r,i=this.g,s=this.b;return e=Math.max(0,Math.min(255,e-Math.round(-t/100*255))),i=Math.max(0,Math.min(255,i-Math.round(-t/100*255))),s=Math.max(0,Math.min(255,s-Math.round(-t/100*255))),this.setTo(e,i,s)},color:{get:function(){return this._color}},color32:{get:function(){return this._color32}},rgba:{get:function(){return this._rgba}},redGL:{get:function(){return this.gl[0]},set:function(t){this.gl[0]=Math.min(Math.abs(t),1),this.r=Math.floor(255*this.gl[0]),this.update(!0)}},greenGL:{get:function(){return this.gl[1]},set:function(t){this.gl[1]=Math.min(Math.abs(t),1),this.g=Math.floor(255*this.gl[1]),this.update(!0)}},blueGL:{get:function(){return this.gl[2]},set:function(t){this.gl[2]=Math.min(Math.abs(t),1),this.b=Math.floor(255*this.gl[2]),this.update(!0)}},alphaGL:{get:function(){return this.gl[3]},set:function(t){this.gl[3]=Math.min(Math.abs(t),1),this.a=Math.floor(255*this.gl[3]),this.update()}},red:{get:function(){return this.r},set:function(t){t=Math.floor(Math.abs(t)),this.r=Math.min(t,255),this.gl[0]=t/255,this.update(!0)}},green:{get:function(){return this.g},set:function(t){t=Math.floor(Math.abs(t)),this.g=Math.min(t,255),this.gl[1]=t/255,this.update(!0)}},blue:{get:function(){return this.b},set:function(t){t=Math.floor(Math.abs(t)),this.b=Math.min(t,255),this.gl[2]=t/255,this.update(!0)}},alpha:{get:function(){return this.a},set:function(t){t=Math.floor(Math.abs(t)),this.a=Math.min(t,255),this.gl[3]=t/255,this.update()}},h:{get:function(){return this._h},set:function(t){this._h=t,o(t,this._s,this._v,this)}},s:{get:function(){return this._s},set:function(t){this._s=t,o(this._h,t,this._v,this)}},v:{get:function(){return this._v},set:function(t){this._v=t,o(this._h,this._s,t,this)}}});t.exports=h},92728:(t,e,i)=>{var s=i(37589);t.exports=function(t){void 0===t&&(t=1024);var e,i=[],n=255,r=255,o=0,a=0;for(e=0;e<=n;e++)i.push({r:r,g:e,b:a,color:s(r,e,a)});for(o=255,e=n;e>=0;e--)i.push({r:e,g:o,b:a,color:s(e,o,a)});for(r=0,e=0;e<=n;e++,o--)i.push({r:r,g:o,b:e,color:s(r,o,e)});for(o=0,a=255,e=0;e<=n;e++,a--,r++)i.push({r:r,g:o,b:a,color:s(r,o,a)});if(1024===t)return i;var h=[],l=0,u=1024/t;for(e=0;e{t.exports=function(t){var e={r:t>>16&255,g:t>>8&255,b:255&t,a:255};return t>16777215&&(e.a=t>>>24),e}},62957:t=>{t.exports=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e}},37589:t=>{t.exports=function(t,e,i){return t<<16|e<<8|i}},1e3:t=>{t.exports=function(t,e,i,s){return s<<24|t<<16|e<<8|i}},62183:(t,e,i)=>{var s=i(40987),n=i(89528);t.exports=function(t,e,i){var r=i,o=i,a=i;if(0!==e){var h=i<.5?i*(1+e):i+e-i*e,l=2*i-h;r=n(l,h,t+1/3),o=n(l,h,t),a=n(l,h,t-1/3)}return(new s).setGLTo(r,o,a,1)}},27939:(t,e,i)=>{var s=i(7537);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],n=0;n<=359;n++)i.push(s(n/359,t,e));return i}},7537:(t,e,i)=>{var s=i(37589);function n(t,e,i,s){var n=(t+6*e)%6,r=Math.min(n,4-n,1);return Math.round(255*(s-s*i*Math.max(0,r)))}t.exports=function(t,e,i,r){void 0===e&&(e=1),void 0===i&&(i=1);var o=n(5,t,e,i),a=n(3,t,e,i),h=n(1,t,e,i);return r?r.setTo?r.setTo(o,a,h,r.alpha,!0):(r.r=o,r.g=a,r.b=h,r.color=s(o,a,h),r):{r:o,g:a,b:h,color:s(o,a,h)}}},70238:(t,e,i)=>{var s=i(40987);t.exports=function(t){var e=new s;t=t.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,s){return e+e+i+i+s+s}));var i=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);if(i){var n=parseInt(i[1],16),r=parseInt(i[2],16),o=parseInt(i[3],16);e.setTo(n,r,o)}return e}},89528:t=>{t.exports=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}},30100:(t,e,i)=>{var s=i(40987),n=i(90664);t.exports=function(t){var e=n(t);return new s(e.r,e.g,e.b,e.a)}},90664:t=>{t.exports=function(t){return t>16777215?{a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},13699:(t,e,i)=>{var s=i(28915),n=function(t,e,i,n,r,o,a,h){void 0===a&&(a=100),void 0===h&&(h=0);var l=h/a;return{r:s(t,n,l),g:s(e,r,l),b:s(i,o,l)}};t.exports={RGBWithRGB:n,ColorWithRGB:function(t,e,i,s,r,o){return void 0===r&&(r=100),void 0===o&&(o=0),n(t.r,t.g,t.b,e,i,s,r,o)},ColorWithColor:function(t,e,i,s){return void 0===i&&(i=100),void 0===s&&(s=0),n(t.r,t.g,t.b,e.r,e.g,e.b,i,s)}}},68957:(t,e,i)=>{var s=i(40987);t.exports=function(t){return new s(t.r,t.g,t.b,t.a)}},87388:(t,e,i)=>{var s=i(40987);t.exports=function(t){var e=new s,i=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t.toLowerCase());if(i){var n=parseInt(i[1],10),r=parseInt(i[2],10),o=parseInt(i[3],10),a=void 0!==i[4]?parseFloat(i[4]):1;e.setTo(n,r,o,255*a)}return e}},87837:t=>{t.exports=function(t,e,i,s){void 0===s&&(s={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var n=Math.min(t,e,i),r=Math.max(t,e,i),o=r-n,a=0,h=0===r?0:o/r,l=r;return r!==n&&(r===t?a=(e-i)/o+(e{var s=i(62957);t.exports=function(t,e,i,n,r){return void 0===n&&(n=255),void 0===r&&(r="#"),"#"===r?"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1,7):"0x"+s(n)+s(t)+s(e)+s(i)}},85386:(t,e,i)=>{var s=i(30976),n=i(40987);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new n(s(t,e),s(t,e),s(t,e))}},80333:(t,e,i)=>{var s=i(70238),n=i(30100),r=i(68957),o=i(87388);t.exports=function(t){switch(typeof t){case"string":return"rgb"===t.substr(0,3).toLowerCase()?o(t):s(t);case"number":return n(t);case"object":return r(t)}}},3956:(t,e,i)=>{var s=i(40987);s.ColorSpectrum=i(92728),s.ColorToRGBA=i(91588),s.ComponentToHex=i(62957),s.GetColor=i(37589),s.GetColor32=i(1e3),s.HexStringToColor=i(70238),s.HSLToColor=i(62183),s.HSVColorWheel=i(27939),s.HSVToRGB=i(7537),s.HueToComponent=i(89528),s.IntegerToColor=i(30100),s.IntegerToRGB=i(90664),s.Interpolate=i(13699),s.ObjectToColor=i(68957),s.RandomRGB=i(85386),s.RGBStringToColor=i(87388),s.RGBToHSV=i(87837),s.RGBToString=i(75723),s.ValueToColor=i(80333),t.exports=s},27460:(t,e,i)=>{t.exports={Align:i(71926),BaseShader:i(73894),Bounds:i(58724),Canvas:i(26253),Color:i(3956),ColorMatrix:i(89422),Masks:i(69781),RGB:i(51767)}},6858:(t,e,i)=>{var s=i(83419),n=i(39429),r=new s({initialize:function(t,e,i,s,n,r){e||(e=t.sys.make.image({x:i,y:s,key:n,frame:r,add:!1})),this.bitmapMask=e,this.invertAlpha=!1,this.isStencil=!1},setBitmap:function(t){this.bitmapMask=t},preRenderWebGL:function(t,e,i){t.pipelines.BITMAPMASK_PIPELINE.beginMask(this,e,i)},postRenderWebGL:function(t,e,i){t.pipelines.BITMAPMASK_PIPELINE.endMask(this,e,i)},preRenderCanvas:function(){},postRenderCanvas:function(){},destroy:function(){this.bitmapMask=null}});n.register("bitmapMask",(function(t,e,i,s,n){return new r(this.scene,t,e,i,s,n)})),t.exports=r},80661:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e){this.geometryMask=e,this.invertAlpha=!1,this.isStencil=!0,this.level=0},setShape:function(t){return this.geometryMask=t,this},setInvertAlpha:function(t){return void 0===t&&(t=!0),this.invertAlpha=t,this},preRenderWebGL:function(t,e,i){var s=t.gl;t.flush(),0===t.maskStack.length&&(s.enable(s.STENCIL_TEST),s.clear(s.STENCIL_BUFFER_BIT),t.maskCount=0),t.currentCameraMask.mask!==this&&(t.currentMask.mask=this),t.maskStack.push({mask:this,camera:i}),this.applyStencil(t,i,!0),t.maskCount++},applyStencil:function(t,e,i){var s=t.gl,n=this.geometryMask,r=t.maskCount,o=255;s.colorMask(!1,!1,!1,!1),i?(s.stencilFunc(s.EQUAL,r,o),s.stencilOp(s.KEEP,s.KEEP,s.INCR),r++):(s.stencilFunc(s.EQUAL,r+1,o),s.stencilOp(s.KEEP,s.KEEP,s.DECR)),this.level=r,n.renderWebGL(t,n,e),t.flush(),s.colorMask(!0,!0,!0,!0),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),this.invertAlpha?s.stencilFunc(s.NOTEQUAL,r,o):s.stencilFunc(s.EQUAL,r,o)},postRenderWebGL:function(t){var e=t.gl;t.maskStack.pop(),t.maskCount--,t.flush();var i=t.currentMask;if(0===t.maskStack.length)i.mask=null,e.disable(e.STENCIL_TEST);else{var s=t.maskStack[t.maskStack.length-1];s.mask.applyStencil(t,s.camera,!1),t.currentCameraMask.mask!==s.mask?(i.mask=s.mask,i.camera=s.camera):i.mask=null}},preRenderCanvas:function(t,e,i){var s=this.geometryMask;t.currentContext.save(),s.renderCanvas(t,s,i,null,null,!0),t.currentContext.clip()},postRenderCanvas:function(t){t.currentContext.restore()},destroy:function(){this.geometryMask=null}});t.exports=s},69781:(t,e,i)=>{t.exports={BitmapMask:i(6858),GeometryMask:i(80661)}},73894:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s){e&&""!==e||(e=["precision mediump float;","uniform vec2 resolution;","varying vec2 fragCoord;","void main () {"," vec2 uv = fragCoord / resolution.xy;"," gl_FragColor = vec4(uv.xyx, 1.0);","}"].join("\n")),i&&""!==i||(i=["precision mediump float;","uniform mat4 uProjectionMatrix;","uniform mat4 uViewMatrix;","uniform vec2 uResolution;","attribute vec2 inPosition;","varying vec2 fragCoord;","varying vec2 outTexCoord;","void main () {"," gl_Position = uProjectionMatrix * uViewMatrix * vec4(inPosition, 1.0, 1.0);"," fragCoord = vec2(inPosition.x, uResolution.y - inPosition.y);"," outTexCoord = vec2(inPosition.x / uResolution.x, fragCoord.y / uResolution.y);","}"].join("\n")),void 0===s&&(s=null),this.key=t,this.fragmentSrc=e,this.vertexSrc=i,this.uniforms=s}});t.exports=s},40366:t=>{t.exports=function(t,e){var i;if(e)"string"==typeof e?i=document.getElementById(e):"object"==typeof e&&1===e.nodeType&&(i=e);else if(t.parentElement||null===e)return t;return i||(i=document.body),i.appendChild(t),t}},83719:(t,e,i)=>{var s=i(40366);t.exports=function(t){var e=t.config;if(e.parent&&e.domCreateContainer){var i=document.createElement("div");i.style.cssText=["display: block;","width: "+t.scale.width+"px;","height: "+t.scale.height+"px;","padding: 0; margin: 0;","position: absolute;","overflow: hidden;","pointer-events: "+e.domPointerEvents+";","transform: scale(1);","transform-origin: left top;"].join(" "),t.domContainer=i,s(i,e.parent)}}},57264:(t,e,i)=>{var s=i(25892);t.exports=function(t){if("complete"!==document.readyState&&"interactive"!==document.readyState){var e=function(){document.removeEventListener("deviceready",e,!0),document.removeEventListener("DOMContentLoaded",e,!0),window.removeEventListener("load",e,!0),t()};document.body?s.cordova?document.addEventListener("deviceready",e,!1):(document.addEventListener("DOMContentLoaded",e,!0),window.addEventListener("load",e,!0)):window.setTimeout(e,20)}else t()}},57811:t=>{t.exports=function(t){if(!t)return window.innerHeight;var e=Math.abs(window.orientation),i={w:0,h:0},s=document.createElement("div");return s.setAttribute("style","position: fixed; height: 100vh; width: 0; top: 0"),document.documentElement.appendChild(s),i.w=90===e?s.offsetHeight:window.innerWidth,i.h=90===e?window.innerWidth:s.offsetHeight,document.documentElement.removeChild(s),s=null,90!==Math.abs(window.orientation)?i.h:i.w}},45818:(t,e,i)=>{var s=i(13560);t.exports=function(t,e){var i=window.screen,n=!!i&&(i.orientation||i.mozOrientation||i.msOrientation);return n&&"string"==typeof n.type?n.type:"string"==typeof n?n:"number"==typeof window.orientation?0===window.orientation||180===window.orientation?s.ORIENTATION.PORTRAIT:s.ORIENTATION.LANDSCAPE:window.matchMedia?window.matchMedia("(orientation: portrait)").matches?s.ORIENTATION.PORTRAIT:window.matchMedia("(orientation: landscape)").matches?s.ORIENTATION.LANDSCAPE:void 0:e>t?s.ORIENTATION.PORTRAIT:s.ORIENTATION.LANDSCAPE}},74403:t=>{t.exports=function(t){var e;return""!==t&&("string"==typeof t?e=document.getElementById(t):t&&1===t.nodeType&&(e=t)),e||(e=document.body),e}},56836:t=>{t.exports=function(t){var e="";try{window.DOMParser?e=(new DOMParser).parseFromString(t,"text/xml"):(e=new ActiveXObject("Microsoft.XMLDOM")).loadXML(t)}catch(i){e=null}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length?e:null}},35846:t=>{t.exports=function(t){t.parentNode&&t.parentNode.removeChild(t)}},43092:(t,e,i)=>{var s=i(83419),n=i(29747),r=new s({initialize:function(){this.isRunning=!1,this.callback=n,this.isSetTimeOut=!1,this.timeOutID=null,this.delay=0;var t=this;this.step=function e(i){t.callback(i),t.isRunning&&(t.timeOutID=window.requestAnimationFrame(e))},this.stepTimeout=function e(){t.isRunning&&(t.timeOutID=window.setTimeout(e,t.delay)),t.callback(window.performance.now())}},start:function(t,e,i){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.delay=i,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=n}});t.exports=r},84902:(t,e,i)=>{var s={AddToDOM:i(40366),DOMContentLoaded:i(57264),GetInnerHeight:i(57811),GetScreenOrientation:i(45818),GetTarget:i(74403),ParseXML:i(56836),RemoveFromDOM:i(35846),RequestAnimationFrame:i(43092)};t.exports=s},47565:(t,e,i)=>{var s=i(83419),n=i(50792),r=i(37277),o=new s({Extends:n,initialize:function(){n.call(this)},shutdown:function(){this.removeAllListeners()},destroy:function(){this.removeAllListeners()}});r.register("EventEmitter",o,"events"),t.exports=o},93055:(t,e,i)=>{t.exports={EventEmitter:i(47565)}},20122:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e){void 0===e&&(e=1),n.call(this,r.BARREL,t),this.amount=e}});t.exports=o},32251:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h){void 0===i&&(i=1),void 0===s&&(s=1),void 0===o&&(o=1),void 0===a&&(a=1),void 0===h&&(h=4),n.call(this,r.BLOOM,t),this.steps=h,this.offsetX=i,this.offsetY=s,this.blurStrength=o,this.strength=a,this.glcolor=[1,1,1],null!=e&&(this.color=e)},color:{get:function(){var t=this.glcolor;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}}});t.exports=o},9047:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h){void 0===e&&(e=0),void 0===i&&(i=2),void 0===s&&(s=2),void 0===o&&(o=1),void 0===h&&(h=4),n.call(this,r.BLUR,t),this.quality=e,this.x=i,this.y=s,this.steps=h,this.strength=o,this.glcolor=[1,1,1],null!=a&&(this.color=a)},color:{get:function(){var t=this.glcolor;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}}});t.exports=o},27885:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h,l){void 0===e&&(e=.5),void 0===i&&(i=1),void 0===s&&(s=.2),void 0===o&&(o=!1),void 0===a&&(a=1),void 0===h&&(h=1),void 0===l&&(l=1),n.call(this,r.BOKEH,t),this.radius=e,this.amount=i,this.contrast=s,this.isTiltShift=o,this.strength=l,this.blurX=a,this.blurY=h}});t.exports=o},12578:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a){void 0===e&&(e=8),void 0===o&&(o=1),void 0===a&&(a=.005),n.call(this,r.CIRCLE,t),this.scale=o,this.feather=a,this.thickness=e,this.glcolor=[1,.2,.7],this.glcolor2=[1,0,0,.4],null!=i&&(this.color=i),null!=s&&(this.backgroundColor=s)},color:{get:function(){var t=this.glcolor;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}},backgroundColor:{get:function(){var t=this.glcolor2;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor2;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}},backgroundAlpha:{get:function(){return this.glcolor2[3]},set:function(t){this.glcolor2[3]=t}}});t.exports=o},15802:(t,e,i)=>{var s=i(83419),n=i(89422),r=i(14811),o=new s({Extends:n,initialize:function(t){n.call(this),this.type=r.COLOR_MATRIX,this.gameObject=t,this.active=!0},destroy:function(){this.gameObject=null,this._matrix=null,this._data=null}});t.exports=o},72898:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e){this.type=t,this.gameObject=e,this.active=!0},setActive:function(t){return this.active=t,this},destroy:function(){this.gameObject=null,this.active=!1}});t.exports=s},44553:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s){void 0===e&&(e="__WHITE"),void 0===i&&(i=.005),void 0===s&&(s=.005),n.call(this,r.DISPLACEMENT,t),this.x=i,this.y=s,this.glTexture,this.setTexture(e)},setTexture:function(t){var e=this.gameObject.scene.sys.textures.getFrame(t);return e&&(this.glTexture=e.glTexture),this}});t.exports=o},68531:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o){void 0===i&&(i=4),void 0===s&&(s=0),void 0===o&&(o=!1),n.call(this,r.GLOW,t),this.outerStrength=i,this.innerStrength=s,this.knockout=o,this.glcolor=[1,1,1,1],void 0!==e&&(this.color=e)},color:{get:function(){var t=this.glcolor;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}}});t.exports=o},37102:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h,l,u){void 0===s&&(s=.2),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===u&&(u=0),n.call(this,r.GRADIENT,t),this.alpha=s,this.size=u,this.fromX=o,this.fromY=a,this.toX=h,this.toY=l,this.glcolor1=[255,0,0],this.glcolor2=[0,255,0],null!=e&&(this.color1=e),null!=i&&(this.color2=i)},color1:{get:function(){var t=this.glcolor1;return(t[0]<<16)+(t[1]<<8)+(0|t[2])},set:function(t){var e=this.glcolor1;e[0]=t>>16&255,e[1]=t>>8&255,e[2]=255&t}},color2:{get:function(){var t=this.glcolor2;return(t[0]<<16)+(t[1]<<8)+(0|t[2])},set:function(t){var e=this.glcolor2;e[0]=t>>16&255,e[1]=t>>8&255,e[2]=255&t}}});t.exports=o},86886:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e){void 0===e&&(e=1),n.call(this,r.PIXELATE,t),this.amount=e}});t.exports=o},92322:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h,l){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=.1),void 0===o&&(o=1),void 0===h&&(h=6),void 0===l&&(l=1),n.call(this,r.SHADOW,t),this.x=e,this.y=i,this.decay=s,this.power=o,this.glcolor=[0,0,0,1],this.samples=h,this.intensity=l,void 0!==a&&(this.color=a)},color:{get:function(){var t=this.glcolor;return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)},set:function(t){var e=this.glcolor;e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255}}});t.exports=o},39563:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o){void 0===e&&(e=.5),void 0===i&&(i=.5),void 0===s&&(s=3),void 0===o&&(o=!1),n.call(this,r.SHINE,t),this.speed=e,this.lineWidth=i,this.gradient=s,this.reveal=o}});t.exports=o},56448:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o){void 0===e&&(e=.5),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===o&&(o=.5),n.call(this,r.VIGNETTE,t),this.x=e,this.y=i,this.radius=s,this.strength=o}});t.exports=o},38433:(t,e,i)=>{var s=i(83419),n=i(72898),r=i(14811),o=new s({Extends:n,initialize:function(t,e,i,s,o){void 0===e&&(e=.1),void 0===i&&(i=0),void 0===s&&(s=0),void 0===o&&(o=!1),n.call(this,r.WIPE,t),this.progress=0,this.wipeWidth=e,this.direction=i,this.axis=s,this.reveal=o}});t.exports=o},14811:t=>{t.exports={GLOW:4,SHADOW:5,PIXELATE:6,VIGNETTE:7,SHINE:8,BLUR:9,GRADIENT:12,BLOOM:13,COLOR_MATRIX:14,CIRCLE:15,BARREL:16,DISPLACEMENT:17,WIPE:18,BOKEH:19}},66064:(t,e,i)=>{var s=i(79291),n=i(14811),r={Barrel:i(20122),Controller:i(72898),Bloom:i(32251),Blur:i(9047),Bokeh:i(27885),Circle:i(12578),ColorMatrix:i(15802),Displacement:i(44553),Glow:i(68531),Gradient:i(37102),Pixelate:i(86886),Shadow:i(92322),Shine:i(39563),Vignette:i(56448),Wipe:i(38433)};r=s(!1,r,n),t.exports=r},25305:(t,e,i)=>{var s=i(10312),n=i(23568);t.exports=function(t,e,i){e.x=n(i,"x",0),e.y=n(i,"y",0),e.depth=n(i,"depth",0),e.flipX=n(i,"flipX",!1),e.flipY=n(i,"flipY",!1);var r=n(i,"scale",null);"number"==typeof r?e.setScale(r):null!==r&&(e.scaleX=n(r,"x",1),e.scaleY=n(r,"y",1));var o=n(i,"scrollFactor",null);"number"==typeof o?e.setScrollFactor(o):null!==o&&(e.scrollFactorX=n(o,"x",1),e.scrollFactorY=n(o,"y",1)),e.rotation=n(i,"rotation",0);var a=n(i,"angle",null);null!==a&&(e.angle=a),e.alpha=n(i,"alpha",1);var h=n(i,"origin",null);if("number"==typeof h)e.setOrigin(h);else if(null!==h){var l=n(h,"x",.5),u=n(h,"y",.5);e.setOrigin(l,u)}return e.blendMode=n(i,"blendMode",s.NORMAL),e.visible=n(i,"visible",!0),n(i,"add",!0)&&t.sys.displayList.add(e),e.preUpdate&&t.sys.updateList.add(e),e}},13059:(t,e,i)=>{var s=i(23568);t.exports=function(t,e){var i=s(e,"anims",null);if(null===i)return t;if("string"==typeof i)t.anims.play(i);else if("object"==typeof i){var n=t.anims,r=s(i,"key",void 0);if(r){var o=s(i,"startFrame",void 0),a=s(i,"delay",0),h=s(i,"repeat",0),l=s(i,"repeatDelay",0),u=s(i,"yoyo",!1),c=s(i,"play",!1),d=s(i,"delayedPlay",0),f={key:r,delay:a,repeat:h,repeatDelay:l,yoyo:u,startFrame:o};c?n.play(f):d>0?n.playAfterDelay(f,d):n.load(f)}}return t}},8050:(t,e,i)=>{var s=i(83419),n=i(73162),r=i(37277),o=i(51708),a=i(44594),h=i(19186),l=new s({Extends:n,initialize:function(t){n.call(this,t),this.sortChildrenFlag=!1,this.scene=t,this.systems=t.sys,this.events=t.sys.events,this.addCallback=this.addChildCallback,this.removeCallback=this.removeChildCallback,this.events.once(a.BOOT,this.boot,this),this.events.on(a.START,this.start,this)},boot:function(){this.events.once(a.DESTROY,this.destroy,this)},addChildCallback:function(t){t.displayList&&t.displayList!==this&&t.removeFromDisplayList(),t.parentContainer&&t.parentContainer.remove(t),t.displayList||(this.queueDepthSort(),t.displayList=this,t.emit(o.ADDED_TO_SCENE,t,this.scene),this.events.emit(a.ADDED_TO_SCENE,t,this.scene))},removeChildCallback:function(t){this.queueDepthSort(),t.displayList=null,t.emit(o.REMOVED_FROM_SCENE,t,this.scene),this.events.emit(a.REMOVED_FROM_SCENE,t,this.scene)},start:function(){this.events.once(a.SHUTDOWN,this.shutdown,this)},queueDepthSort:function(){this.sortChildrenFlag=!0},depthSort:function(){this.sortChildrenFlag&&(h(this.list,this.sortByDepth),this.sortChildrenFlag=!1)},sortByDepth:function(t,e){return t._depth-e._depth},getChildren:function(){return this.list},shutdown:function(){for(var t=this.list;t.length;)t[0].destroy(!0);this.events.off(a.SHUTDOWN,this.shutdown,this)},destroy:function(){this.shutdown(),this.events.off(a.START,this.start,this),this.scene=null,this.systems=null,this.events=null}});r.register("DisplayList",l,"displayList"),t.exports=l},95643:(t,e,i)=>{var s=i(83419),n=i(53774),r=i(45893),o=i(50792),a=i(51708),h=i(44594),l=new s({Extends:o,initialize:function(t,e){o.call(this),this.scene=t,this.displayList=null,this.type=e,this.state=0,this.parentContainer=null,this.name="",this.active=!0,this.tabIndex=-1,this.data=null,this.renderFlags=15,this.cameraFilter=0,this.input=null,this.body=null,this.ignoreDestroy=!1,this.on(a.ADDED_TO_SCENE,this.addedToScene,this),this.on(a.REMOVED_FROM_SCENE,this.removedFromScene,this),t.sys.queueDepthSort()},setActive:function(t){return this.active=t,this},setName:function(t){return this.name=t,this},setState:function(t){return this.state=t,this},setDataEnabled:function(){return this.data||(this.data=new r(this)),this},setData:function(t,e){return this.data||(this.data=new r(this)),this.data.set(t,e),this},incData:function(t,e){return this.data||(this.data=new r(this)),this.data.inc(t,e),this},toggleData:function(t){return this.data||(this.data=new r(this)),this.data.toggle(t),this},getData:function(t){return this.data||(this.data=new r(this)),this.data.get(t)},setInteractive:function(t,e,i){return this.scene.sys.input.enable(this,t,e,i),this},disableInteractive:function(){return this.scene.sys.input.disable(this),this},removeInteractive:function(){return this.scene.sys.input.clear(this),this.input=void 0,this},addedToScene:function(){},removedFromScene:function(){},update:function(){},toJSON:function(){return n(this)},willRender:function(t){return!(this.displayList&&this.displayList.active&&!this.displayList.willRender(t)||l.RENDER_MASK!==this.renderFlags||0!==this.cameraFilter&&this.cameraFilter&t.id)},getIndexList:function(){for(var t=this,e=this.parentContainer,i=[];e&&(i.unshift(e.getIndex(t)),t=e,e.parentContainer);)e=e.parentContainer;return this.displayList?i.unshift(this.displayList.getIndex(t)):i.unshift(this.scene.sys.displayList.getIndex(t)),i},addToDisplayList:function(t){return void 0===t&&(t=this.scene.sys.displayList),this.displayList&&this.displayList!==t&&this.removeFromDisplayList(),t.exists(this)||(this.displayList=t,t.add(this,!0),t.queueDepthSort(),this.emit(a.ADDED_TO_SCENE,this,this.scene),t.events.emit(h.ADDED_TO_SCENE,this,this.scene)),this},addToUpdateList:function(){return this.scene&&this.preUpdate&&this.scene.sys.updateList.add(this),this},removeFromDisplayList:function(){var t=this.displayList||this.scene.sys.displayList;return t&&t.exists(this)&&(t.remove(this,!0),t.queueDepthSort(),this.displayList=null,this.emit(a.REMOVED_FROM_SCENE,this,this.scene),t.events.emit(h.REMOVED_FROM_SCENE,this,this.scene)),this},removeFromUpdateList:function(){return this.scene&&this.preUpdate&&this.scene.sys.updateList.remove(this),this},destroy:function(t){this.scene&&!this.ignoreDestroy&&(void 0===t&&(t=!1),this.preDestroy&&this.preDestroy.call(this),this.emit(a.DESTROY,this,t),this.removeAllListeners(),this.postPipelines&&this.resetPostPipeline(!0),this.removeFromDisplayList(),this.removeFromUpdateList(),this.input&&(this.scene.sys.input.clear(this),this.input=void 0),this.data&&(this.data.destroy(),this.data=void 0),this.body&&(this.body.destroy(),this.body=void 0),this.preFX&&(this.preFX.destroy(),this.preFX=void 0),this.postFX&&(this.postFX.destroy(),this.postFX=void 0),this.active=!1,this.visible=!1,this.scene=void 0,this.parentContainer=void 0)}});l.RENDER_MASK=15,t.exports=l},44603:(t,e,i)=>{var s=i(83419),n=i(37277),r=i(44594),o=new s({initialize:function(t){this.scene=t,this.systems=t.sys,this.events=t.sys.events,this.displayList,this.updateList,this.events.once(r.BOOT,this.boot,this),this.events.on(r.START,this.start,this)},boot:function(){this.displayList=this.systems.displayList,this.updateList=this.systems.updateList,this.events.once(r.DESTROY,this.destroy,this)},start:function(){this.events.once(r.SHUTDOWN,this.shutdown,this)},shutdown:function(){this.events.off(r.SHUTDOWN,this.shutdown,this)},destroy:function(){this.shutdown(),this.events.off(r.START,this.start,this),this.scene=null,this.systems=null,this.events=null,this.displayList=null,this.updateList=null}});o.register=function(t,e){o.prototype.hasOwnProperty(t)||(o.prototype[t]=e)},o.remove=function(t){o.prototype.hasOwnProperty(t)&&delete o.prototype[t]},n.register("GameObjectCreator",o,"make"),t.exports=o},39429:(t,e,i)=>{var s=i(83419),n=i(37277),r=i(44594),o=new s({initialize:function(t){this.scene=t,this.systems=t.sys,this.events=t.sys.events,this.displayList,this.updateList,this.events.once(r.BOOT,this.boot,this),this.events.on(r.START,this.start,this)},boot:function(){this.displayList=this.systems.displayList,this.updateList=this.systems.updateList,this.events.once(r.DESTROY,this.destroy,this)},start:function(){this.events.once(r.SHUTDOWN,this.shutdown,this)},existing:function(t){return(t.renderCanvas||t.renderWebGL)&&this.displayList.add(t),t.preUpdate&&this.updateList.add(t),t},shutdown:function(){this.events.off(r.SHUTDOWN,this.shutdown,this)},destroy:function(){this.shutdown(),this.events.off(r.START,this.start,this),this.scene=null,this.systems=null,this.events=null,this.displayList=null,this.updateList=null}});o.register=function(t,e){o.prototype.hasOwnProperty(t)||(o.prototype[t]=e)},o.remove=function(t){o.prototype.hasOwnProperty(t)&&delete o.prototype[t]},n.register("GameObjectFactory",o,"add"),t.exports=o},91296:(t,e,i)=>{var s=i(61340),n=new s,r=new s,o=new s,a={camera:n,sprite:r,calc:o};t.exports=function(t,e,i){var s=n,h=r,l=o;return h.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),s.copyFrom(e.matrix),i?(s.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),h.e=t.x,h.f=t.y):(h.e-=e.scrollX*t.scrollFactorX,h.f-=e.scrollY*t.scrollFactorY),s.multiply(h,l),a}},45027:(t,e,i)=>{var s=i(83419),n=i(25774),r=i(37277),o=i(44594),a=new s({Extends:n,initialize:function(t){n.call(this),this.checkQueue=!0,this.scene=t,this.systems=t.sys,t.sys.events.once(o.BOOT,this.boot,this),t.sys.events.on(o.START,this.start,this)},boot:function(){this.systems.events.once(o.DESTROY,this.destroy,this)},start:function(){var t=this.systems.events;t.on(o.PRE_UPDATE,this.update,this),t.on(o.UPDATE,this.sceneUpdate,this),t.once(o.SHUTDOWN,this.shutdown,this)},sceneUpdate:function(t,e){for(var i=this._active,s=i.length,n=0;n{t.exports=function(t,e,i,s,n,r,o,a,h,l,u,c,d,f,p){var v=i.x-e.displayOriginX+n,g=i.y-e.displayOriginY+r,m=v+i.w,y=g+i.h,x=o.getXRound(v,g,a),T=o.getYRound(v,g,a),w=o.getXRound(v,y,a),b=o.getYRound(v,y,a),S=o.getXRound(m,y,a),E=o.getYRound(m,y,a),A=o.getXRound(m,g,a),C=o.getYRound(m,g,a);t.batchQuad(e,x,T,w,b,S,E,A,C,s.u0,s.v0,s.u1,s.v1,h,l,u,c,d,f,p)}},53048:t=>{t.exports=function(t,e,i,s){if(void 0===i&&(i=!1),void 0===s)return{local:{x:0,y:0,width:0,height:0},global:{x:0,y:0,width:0,height:0},lines:{shortest:0,longest:0,lengths:null,height:0},wrappedText:"",words:[],characters:[],scaleX:0,scaleY:0};var n,r,o,a=t.text,h=a.length,l=t.maxWidth,u=t.wordWrapCharCode,c=Number.MAX_VALUE,d=Number.MAX_VALUE,f=0,p=0,v=t.fontData.chars,g=t.fontData.lineHeight,m=t.letterSpacing,y=t.lineSpacing,x=0,T=0,w=0,b=null,S=t._align,E=0,A=0,C=t.fontSize/t.fontData.size,_=C*t.scaleX,M=C*t.scaleY,P=null,R=0,L=[],O=Number.MAX_VALUE,F=0,D=0,k=0,I=[],B=[],N=null;if(l>0){for(n=0;nl||W-Y>l?(z.push(G.i-1),G.cr?(z.push(G.i+G.word.length),Y=0,X=null):X=G):G.cr&&(z.push(G.i+G.word.length),Y=0,X=null)}for(n=z.length-1;n>=0;n--)r=a,o=z[n],"\n",a=r.substr(0,o)+"\n"+r.substr(o+1);s.wrappedText=a,h=a.length,I=[],N=null}var H=0;for(n=0;nE&&(c=E),d>A&&(d=A);var q=E+b.xAdvance,K=A+g;fF&&(F=k),kF&&(F=k),k0)for(var J=0;J{var s=i(21859);t.exports=function(t,e,i,n,r,o,a){var h=t.sys.textures.get(i),l=h.get(n),u=t.sys.cache.xml.get(r);if(l&&u){var c=s(u,l,o,a,h);return t.sys.cache.bitmapFont.add(e,{data:c,texture:i,frame:n,fromAtlas:!0}),!0}return!1}},6925:(t,e,i)=>{var s=i(35154);t.exports=function(t,e){var i=e.width,n=e.height,r=Math.floor(i/2),o=Math.floor(n/2),a=s(e,"chars","");if(""!==a){var h=s(e,"image",""),l=t.sys.textures.getFrame(h),u=l.cutX,c=l.cutY,d=l.source.width,f=l.source.height,p=s(e,"offset.x",0),v=s(e,"offset.y",0),g=s(e,"spacing.x",0),m=s(e,"spacing.y",0),y=s(e,"lineSpacing",0),x=s(e,"charsPerRow",null);null===x&&(x=d/i)>a.length&&(x=a.length);for(var T=p,w=v,b={retroFont:!0,font:h,size:i,lineHeight:n+y,chars:{}},S=0,E=0;E{function e(t,e){return parseInt(t.getAttribute(e),10)}t.exports=function(t,i,s,n,r){void 0===s&&(s=0),void 0===n&&(n=0);var o=i.cutX,a=i.cutY,h=i.source.width,l=i.source.height,u=i.sourceIndex,c={},d=t.getElementsByTagName("info")[0],f=t.getElementsByTagName("common")[0];c.font=d.getAttribute("face"),c.size=e(d,"size"),c.lineHeight=e(f,"lineHeight")+n,c.chars={};var p=t.getElementsByTagName("char"),v=void 0!==i&&i.trimmed;if(v)var g=i.height,m=i.width;for(var y=0;y{var s=i(87662),n=i(79291),r={Parse:i(6925)};r=n(!1,r,s),t.exports=r},87662:t=>{t.exports={TEXT_SET1:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},2638:(t,e,i)=>{var s=i(22186),n=i(83419),r=i(12310),o=new n({Extends:s,Mixins:[r],initialize:function(t,e,i,n,r,o,a){s.call(this,t,e,i,n,r,o,a),this.type="DynamicBitmapText",this.scrollX=0,this.scrollY=0,this.cropWidth=0,this.cropHeight=0,this.displayCallback,this.callbackData={parent:this,color:0,tint:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0},index:0,charCode:0,x:0,y:0,scale:0,rotation:0,data:0}},setSize:function(t,e){return this.cropWidth=t,this.cropHeight=e,this},setDisplayCallback:function(t){return this.displayCallback=t,this},setScrollX:function(t){return this.scrollX=t,this},setScrollY:function(t){return this.scrollY=t,this}});t.exports=o},86741:(t,e,i)=>{var s=i(20926);t.exports=function(t,e,i,n){var r=e._text,o=r.length,a=t.currentContext;if(0!==o&&s(t,a,e,i,n)){i.addToRenderList(e);var h=e.fromAtlas?e.frame:e.texture.frames.__BASE,l=e.displayCallback,u=e.callbackData,c=e.fontData.chars,d=e.fontData.lineHeight,f=e._letterSpacing,p=0,v=0,g=0,m=null,y=0,x=0,T=0,w=0,b=0,S=0,E=null,A=0,C=e.frame.source.image,_=h.cutX,M=h.cutY,P=0,R=0,L=e._fontSize/e.fontData.size,O=e._align,F=0,D=0;e.getTextBounds(!1);var k=e._bounds.lines;1===O?D=(k.longest-k.lengths[0])/2:2===O&&(D=k.longest-k.lengths[0]),a.translate(-e.displayOriginX,-e.displayOriginY);var I=i.roundPixels;e.cropWidth>0&&e.cropHeight>0&&(a.beginPath(),a.rect(0,0,e.cropWidth,e.cropHeight),a.clip());for(var B=0;B{var s=i(2638),n=i(25305),r=i(44603),o=i(23568);r.register("dynamicBitmapText",(function(t,e){void 0===t&&(t={});var i=o(t,"font",""),r=o(t,"text",""),a=o(t,"size",!1),h=new s(this.scene,0,0,i,r,a);return void 0!==e&&(t.add=e),n(this.scene,h,t),h}))},72566:(t,e,i)=>{var s=i(2638);i(39429).register("dynamicBitmapText",(function(t,e,i,n,r){return this.displayList.add(new s(this.scene,t,e,i,n,r))}))},12310:(t,e,i)=>{var s,n;i(29747),s=i(73482),n=i(86741),t.exports={renderWebGL:s,renderCanvas:n}},73482:(t,e,i)=>{var s=i(91296),n=i(61340),r=i(70554),o=new n;t.exports=function(t,e,i,n){var a=e.text,h=a.length;if(0!==h){i.addToRenderList(e);var l=t.pipelines.set(e.pipeline,e),u=s(e,i,n);t.pipelines.preBatch(e);var c=u.sprite,d=u.calc,f=o,p=e.cropWidth>0||e.cropHeight>0;p&&(l.flush(),t.pushScissor(d.tx,d.ty,e.cropWidth*d.scaleX,e.cropHeight*d.scaleY));var v,g,m=e.frame.glTexture,y=e.tintFill,x=r.getTintAppendFloatAlpha(e.tintTopLeft,i.alpha*e._alphaTL),T=r.getTintAppendFloatAlpha(e.tintTopRight,i.alpha*e._alphaTR),w=r.getTintAppendFloatAlpha(e.tintBottomLeft,i.alpha*e._alphaBL),b=r.getTintAppendFloatAlpha(e.tintBottomRight,i.alpha*e._alphaBR),S=l.setGameObject(e),E=0,A=0,C=0,_=0,M=e.letterSpacing,P=0,R=0,L=e.scrollX,O=e.scrollY,F=e.fontData,D=F.chars,k=F.lineHeight,I=e.fontSize/F.size,B=0,N=e._align,U=0,X=0,Y=e.getTextBounds(!1);e.maxWidth>0&&(h=(a=Y.wrappedText).length);var z=e._bounds.lines;1===N?X=(z.longest-z.lengths[0])/2:2===N&&(X=z.longest-z.lengths[0]);for(var G=i.roundPixels,V=e.displayCallback,W=e.callbackData,H=0;H{var s=i(83419),n=i(45319),r=i(31401),o=i(95643),a=i(53048),h=i(61327),l=i(21859),u=i(87841),c=i(18658),d=new s({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.Depth,r.GetBounds,r.Mask,r.Origin,r.Pipeline,r.PostPipeline,r.ScrollFactor,r.Texture,r.Tint,r.Transform,r.Visible,c],initialize:function(t,e,i,s,n,r,h){void 0===n&&(n=""),void 0===h&&(h=0),o.call(this,t,"BitmapText"),this.font=s;var l=this.scene.sys.cache.bitmapFont.get(s);l||console.warn("Invalid BitmapText key: "+s),this.fontData=l.data,this._text="",this._fontSize=r||this.fontData.size,this._letterSpacing=0,this._lineSpacing=0,this._align=h,this._bounds=a(),this._dirty=!0,this._maxWidth=0,this.wordWrapCharCode=32,this.charColors=[],this.dropShadowX=0,this.dropShadowY=0,this.dropShadowColor=0,this.dropShadowAlpha=.5,this.fromAtlas=l.fromAtlas,this.setTexture(l.texture,l.frame),this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline(),this.initPostPipeline(),this.setText(n)},setLeftAlign:function(){return this._align=d.ALIGN_LEFT,this._dirty=!0,this},setCenterAlign:function(){return this._align=d.ALIGN_CENTER,this._dirty=!0,this},setRightAlign:function(){return this._align=d.ALIGN_RIGHT,this._dirty=!0,this},setFontSize:function(t){return this._fontSize=t,this._dirty=!0,this},setLetterSpacing:function(t){return void 0===t&&(t=0),this._letterSpacing=t,this._dirty=!0,this},setLineSpacing:function(t){return void 0===t&&(t=0),this.lineSpacing=t,this},setText:function(t){return t||0===t||(t=""),Array.isArray(t)&&(t=t.join("\n")),t!==this.text&&(this._text=t.toString(),this._dirty=!0,this.updateDisplayOrigin()),this},setDropShadow:function(t,e,i,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=.5),this.dropShadowX=t,this.dropShadowY=e,this.dropShadowColor=i,this.dropShadowAlpha=s,this},setCharacterTint:function(t,e,i,s,r,o,a){void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=!1),void 0===s&&(s=-1),void 0===r&&(r=s,o=s,a=s);var h=this.text.length;-1===e&&(e=h),t<0&&(t=h+t),t=n(t,0,h-1);for(var l=n(t+e,t,h),u=this.charColors,c=t;c{var s=i(20926);t.exports=function(t,e,i,n){var r=e._text,o=r.length,a=t.currentContext;if(0!==o&&s(t,a,e,i,n)){i.addToRenderList(e);var h=e.fromAtlas?e.frame:e.texture.frames.__BASE,l=e.fontData.chars,u=e.fontData.lineHeight,c=e._letterSpacing,d=e._lineSpacing,f=0,p=0,v=0,g=null,m=0,y=0,x=0,T=0,w=0,b=0,S=null,E=0,A=h.source.image,C=h.cutX,_=h.cutY,M=e._fontSize/e.fontData.size,P=e._align,R=0,L=0,O=e.getTextBounds(!1);e.maxWidth>0&&(o=(r=O.wrappedText).length);var F=e._bounds.lines;1===P?L=(F.longest-F.lengths[0])/2:2===P&&(L=F.longest-F.lengths[0]),a.translate(-e.displayOriginX,-e.displayOriginY);for(var D=i.roundPixels,k=0;k{var s=i(22186),n=i(25305),r=i(44603),o=i(23568),a=i(35154);r.register("bitmapText",(function(t,e){void 0===t&&(t={});var i=a(t,"font",""),r=o(t,"text",""),h=o(t,"size",!1),l=a(t,"align",0),u=new s(this.scene,0,0,i,r,h,l);return void 0!==e&&(t.add=e),n(this.scene,u,t),u}))},34914:(t,e,i)=>{var s=i(22186);i(39429).register("bitmapText",(function(t,e,i,n,r,o){return this.displayList.add(new s(this.scene,t,e,i,n,r,o))}))},18658:(t,e,i)=>{var s,n;i(29747),s=i(33590),n=i(37289),t.exports={renderWebGL:s,renderCanvas:n}},33590:(t,e,i)=>{var s=i(3217),n=i(91296),r=i(70554);t.exports=function(t,e,i,o){if(0!==e._text.length){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline,e),h=n(e,i,o).calc;t.pipelines.preBatch(e);var l,u,c,d=i.roundPixels,f=i.alpha,p=e.charColors,v=e.tintFill,g=r.getTintAppendFloatAlpha,m=g(e.tintTopLeft,f*e._alphaTL),y=g(e.tintTopRight,f*e._alphaTR),x=g(e.tintBottomLeft,f*e._alphaBL),T=g(e.tintBottomRight,f*e._alphaBR),w=e.frame.glTexture,b=a.setGameObject(e),S=e.getTextBounds(!1).characters,E=e.dropShadowX,A=e.dropShadowY;if(0!==E||0!==A){var C=e.dropShadowColor,_=e.dropShadowAlpha,M=g(C,f*_*e._alphaTL),P=g(C,f*_*e._alphaTR),R=g(C,f*_*e._alphaBL),L=g(C,f*_*e._alphaBR);for(l=0;l{var s=i(48011),n=i(46590),r=i(83419),o=i(31401),a=i(4327),h=i(95643),l=i(73162),u=new r({Extends:h,Mixins:[o.Alpha,o.BlendMode,o.Depth,o.Mask,o.Pipeline,o.PostPipeline,o.ScrollFactor,o.Size,o.Texture,o.Transform,o.Visible,s],initialize:function(t,e,i,s,n){h.call(this,t,"Blitter"),this.setTexture(s,n),this.setPosition(e,i),this.initPipeline(),this.initPostPipeline(),this.children=new l,this.renderList=[],this.dirty=!1},create:function(t,e,i,s,r){void 0===s&&(s=!0),void 0===r&&(r=this.children.length),void 0===i?i=this.frame:i instanceof a||(i=this.texture.get(i));var o=new n(this,t,e,i,s);return this.children.addAt(o,r,!1),this.dirty=!0,o},createFromCallback:function(t,e,i,s){for(var n=this.createMultiple(e,i,s),r=0;r0},getRenderList:function(){return this.dirty&&(this.renderList=this.children.list.filter(this.childCanRender,this),this.dirty=!1),this.renderList},clear:function(){this.children.removeAll(),this.dirty=!0},preDestroy:function(){this.children.destroy(),this.renderList=[]}});t.exports=u},72396:t=>{t.exports=function(t,e,i,s){var n=e.getRenderList();if(0!==n.length){var r=t.currentContext,o=i.alpha*e.alpha;if(0!==o){i.addToRenderList(e),r.globalCompositeOperation=t.blendModes[e.blendMode],r.imageSmoothingEnabled=!e.frame.source.scaleMode;var a=e.x-i.scrollX*e.scrollFactorX,h=e.y-i.scrollY*e.scrollFactorY;r.save(),s&&s.copyToContext(r);for(var l=i.roundPixels,u=0;u0&&p.height>0&&(r.save(),r.translate(c.x+a,c.y+h),r.scale(m,y),r.drawImage(f.source.image,p.x,p.y,p.width,p.height,v,g,p.width,p.height),r.restore())):(l&&(v=Math.round(v),g=Math.round(g)),p.width>0&&p.height>0&&r.drawImage(f.source.image,p.x,p.y,p.width,p.height,v+c.x+a,g+c.y+h,p.width,p.height)))}r.restore()}}}},9403:(t,e,i)=>{var s=i(6107),n=i(25305),r=i(44603),o=i(23568);r.register("blitter",(function(t,e){void 0===t&&(t={});var i=o(t,"key",null),r=o(t,"frame",null),a=new s(this.scene,0,0,i,r);return void 0!==e&&(t.add=e),n(this.scene,a,t),a}))},12709:(t,e,i)=>{var s=i(6107);i(39429).register("blitter",(function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))}))},48011:(t,e,i)=>{var s,n;i(29747),s=i(99485),n=i(72396),t.exports={renderWebGL:s,renderCanvas:n}},99485:(t,e,i)=>{var s=i(61340),n=i(70554),r=new s;t.exports=function(t,e,i,s){var o=e.getRenderList(),a=i.alpha*e.alpha;if(0!==o.length&&0!==a){i.addToRenderList(e);var h=t.pipelines.set(this.pipeline,e),l=i.scrollX*e.scrollFactorX,u=i.scrollY*e.scrollFactorY,c=r.copyFrom(i.matrix);s&&(c.multiplyWithOffset(s,-l,-u),l=0,u=0);var d=e.x-l,f=e.y-u,p=-1;t.pipelines.preBatch(e);for(var v=0;v{var s=i(83419),n=i(4327),r=new s({initialize:function(t,e,i,s,n){this.parent=t,this.x=e,this.y=i,this.frame=s,this.data={},this.tint=16777215,this._visible=n,this._alpha=1,this.flipX=!1,this.flipY=!1,this.hasTransformComponent=!0},setFrame:function(t){return void 0===t?this.frame=this.parent.frame:t instanceof n&&t.texture===this.parent.texture?this.frame=t:this.frame=this.parent.texture.get(t),this},resetFlip:function(){return this.flipX=!1,this.flipY=!1,this},reset:function(t,e,i){return this.x=t,this.y=e,this.flipX=!1,this.flipY=!1,this._alpha=1,this._visible=!0,this.parent.dirty=!0,i&&this.setFrame(i),this},setPosition:function(t,e){return this.x=t,this.y=e,this},setFlipX:function(t){return this.flipX=t,this},setFlipY:function(t){return this.flipY=t,this},setFlip:function(t,e){return this.flipX=t,this.flipY=e,this},setVisible:function(t){return this.visible=t,this},setAlpha:function(t){return this.alpha=t,this},setTint:function(t){return this.tint=t,this},destroy:function(){this.parent.dirty=!0,this.parent.children.remove(this),this.parent=void 0,this.frame=void 0,this.data=void 0},visible:{get:function(){return this._visible},set:function(t){this.parent.dirty|=this._visible!==t,this._visible=t}},alpha:{get:function(){return this._alpha},set:function(t){this.parent.dirty|=this._alpha>0!=t>0,this._alpha=t}}});t.exports=r},16005:(t,e,i)=>{var s=i(45319),n={_alpha:1,_alphaTL:1,_alphaTR:1,_alphaBL:1,_alphaBR:1,clearAlpha:function(){return this.setAlpha(1)},setAlpha:function(t,e,i,n){return void 0===t&&(t=1),void 0===e?this.alpha=t:(this._alphaTL=s(t,0,1),this._alphaTR=s(e,0,1),this._alphaBL=s(i,0,1),this._alphaBR=s(n,0,1)),this},alpha:{get:function(){return this._alpha},set:function(t){var e=s(t,0,1);this._alpha=e,this._alphaTL=e,this._alphaTR=e,this._alphaBL=e,this._alphaBR=e,0===e?this.renderFlags&=-3:this.renderFlags|=2}},alphaTopLeft:{get:function(){return this._alphaTL},set:function(t){var e=s(t,0,1);this._alphaTL=e,0!==e&&(this.renderFlags|=2)}},alphaTopRight:{get:function(){return this._alphaTR},set:function(t){var e=s(t,0,1);this._alphaTR=e,0!==e&&(this.renderFlags|=2)}},alphaBottomLeft:{get:function(){return this._alphaBL},set:function(t){var e=s(t,0,1);this._alphaBL=e,0!==e&&(this.renderFlags|=2)}},alphaBottomRight:{get:function(){return this._alphaBR},set:function(t){var e=s(t,0,1);this._alphaBR=e,0!==e&&(this.renderFlags|=2)}}};t.exports=n},88509:(t,e,i)=>{var s=i(45319),n={_alpha:1,clearAlpha:function(){return this.setAlpha(1)},setAlpha:function(t){return void 0===t&&(t=1),this.alpha=t,this},alpha:{get:function(){return this._alpha},set:function(t){var e=s(t,0,1);this._alpha=e,0===e?this.renderFlags&=-3:this.renderFlags|=2}}};t.exports=n},90065:(t,e,i)=>{var s=i(10312),n={_blendMode:s.NORMAL,blendMode:{get:function(){return this._blendMode},set:function(t){"string"==typeof t&&(t=s[t]),(t|=0)>=-1&&(this._blendMode=t)}},setBlendMode:function(t){return this.blendMode=t,this}};t.exports=n},94215:t=>{t.exports={width:0,height:0,displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}}},61683:t=>{t.exports={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,s){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,s,this.flipX,this.flipY);else{var n=t;this.frame.setCropUVs(this._crop,n.x,n.y,n.width,n.height,this.flipX,this.flipY)}this.isCropped=!0}return this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}}},89272:t=>{t.exports={_depth:0,depth:{get:function(){return this._depth},set:function(t){this.displayList&&this.displayList.queueDepthSort(),this._depth=t}},setDepth:function(t){return void 0===t&&(t=0),this.depth=t,this}}},47059:(t,e,i)=>{var s=i(83419),n=i(66064),r=i(19133),o=new s({initialize:function(t,e){this.gameObject=t,this.isPost=e,this.enabled=!1,this.list=[],this.padding=0},setPadding:function(t){return void 0===t&&(t=0),this.padding=t,this.gameObject},onFXCopy:function(){},onFX:function(){},enable:function(t){if(!this.isPost){var e=this.gameObject.scene.sys.renderer;e&&e.pipelines?(this.gameObject.pipeline=e.pipelines.FX_PIPELINE,void 0!==t&&(this.padding=t),this.enabled=!0):this.enabled=!1}},clear:function(){if(this.isPost)this.gameObject.resetPostPipeline(!0);else{for(var t=this.list,e=0;e{t.exports={flipX:!1,flipY:!1,toggleFlipX:function(){return this.flipX=!this.flipX,this},toggleFlipY:function(){return this.flipY=!this.flipY,this},setFlipX:function(t){return this.flipX=t,this},setFlipY:function(t){return this.flipY=t,this},setFlip:function(t,e){return this.flipX=t,this.flipY=e,this},resetFlip:function(){return this.flipX=!1,this.flipY=!1,this}}},8004:(t,e,i)=>{var s=i(87841),n=i(11520),r=i(26099),o={prepareBoundsOutput:function(t,e){return void 0===e&&(e=!1),0!==this.rotation&&n(t,this.x,this.y,this.rotation),e&&this.parentContainer&&this.parentContainer.getBoundsTransformMatrix().transformPoint(t.x,t.y,t),t},getCenter:function(t,e){return void 0===t&&(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth/2,t.y=this.y-this.displayHeight*this.originY+this.displayHeight/2,this.prepareBoundsOutput(t,e)},getTopLeft:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY,this.prepareBoundsOutput(t,e)},getTopCenter:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth/2,t.y=this.y-this.displayHeight*this.originY,this.prepareBoundsOutput(t,e)},getTopRight:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY,this.prepareBoundsOutput(t,e)},getLeftCenter:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY+this.displayHeight/2,this.prepareBoundsOutput(t,e)},getRightCenter:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY+this.displayHeight/2,this.prepareBoundsOutput(t,e)},getBottomLeft:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,this.prepareBoundsOutput(t,e)},getBottomCenter:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth/2,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,this.prepareBoundsOutput(t,e)},getBottomRight:function(t,e){return t||(t=new r),t.x=this.x-this.displayWidth*this.originX+this.displayWidth,t.y=this.y-this.displayHeight*this.originY+this.displayHeight,this.prepareBoundsOutput(t,e)},getBounds:function(t){var e,i,n,r,o,a,h,l;if(void 0===t&&(t=new s),this.parentContainer){var u=this.parentContainer.getBoundsTransformMatrix();this.getTopLeft(t),u.transformPoint(t.x,t.y,t),e=t.x,i=t.y,this.getTopRight(t),u.transformPoint(t.x,t.y,t),n=t.x,r=t.y,this.getBottomLeft(t),u.transformPoint(t.x,t.y,t),o=t.x,a=t.y,this.getBottomRight(t),u.transformPoint(t.x,t.y,t),h=t.x,l=t.y}else this.getTopLeft(t),e=t.x,i=t.y,this.getTopRight(t),n=t.x,r=t.y,this.getBottomLeft(t),o=t.x,a=t.y,this.getBottomRight(t),h=t.x,l=t.y;return t.x=Math.min(e,n,o,h),t.y=Math.min(i,r,a,l),t.width=Math.max(e,n,o,h)-t.x,t.height=Math.max(i,r,a,l)-t.y,t}};t.exports=o},8573:(t,e,i)=>{var s=i(6858),n=i(80661),r={mask:null,setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this},createBitmapMask:function(t,e,i,n,r){return void 0===t&&(this.texture||this.shader||this.geom)&&(t=this),new s(this.scene,t,e,i,n,r)},createGeometryMask:function(t){return void 0!==t||"Graphics"!==this.type&&!this.geom||(t=this),new n(this.scene,t)}};t.exports=r},27387:t=>{t.exports={_originComponent:!0,originX:.5,originY:.5,_displayOriginX:0,_displayOriginY:0,displayOriginX:{get:function(){return this._displayOriginX},set:function(t){this._displayOriginX=t,this.originX=t/this.width}},displayOriginY:{get:function(){return this._displayOriginY},set:function(t){this._displayOriginY=t,this.originY=t/this.height}},setOrigin:function(t,e){return void 0===t&&(t=.5),void 0===e&&(e=t),this.originX=t,this.originY=e,this.updateDisplayOrigin()},setOriginFromFrame:function(){return this.frame&&this.frame.customPivot?(this.originX=this.frame.pivotX,this.originY=this.frame.pivotY,this.updateDisplayOrigin()):this.setOrigin()},setDisplayOrigin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.displayOriginX=t,this.displayOriginY=e,this},updateDisplayOrigin:function(){return this._displayOriginX=this.originX*this.width,this._displayOriginY=this.originY*this.height,this}}},37640:(t,e,i)=>{var s=i(39506),n=i(57355),r=i(35154),o=i(86353),a=i(26099),h={path:null,rotateToPath:!1,pathRotationOffset:0,pathOffset:null,pathVector:null,pathDelta:null,pathTween:null,pathConfig:null,_prevDirection:o.PLAYING_FORWARD,setPath:function(t,e){void 0===e&&(e=this.pathConfig);var i=this.pathTween;return i&&i.isPlaying()&&i.stop(),this.path=t,e&&this.startFollow(e),this},setRotateToPath:function(t,e){return void 0===e&&(e=0),this.rotateToPath=t,this.pathRotationOffset=e,this},isFollowing:function(){var t=this.pathTween;return t&&t.isPlaying()},startFollow:function(t,e){void 0===t&&(t={}),void 0===e&&(e=0);var i=this.pathTween;i&&i.isPlaying()&&i.stop(),"number"==typeof t&&(t={duration:t}),t.from=r(t,"from",0),t.to=r(t,"to",1);var h=n(t,"positionOnPath",!1);this.rotateToPath=n(t,"rotateToPath",!1),this.pathRotationOffset=r(t,"rotationOffset",0);var l=r(t,"startAt",e);if(l&&(t.onStart=function(t){var e=t.data[0];e.progress=l,e.elapsed=e.duration*l;var i=e.ease(e.progress);e.current=e.start+(e.end-e.start)*i,e.setTargetValue()}),this.pathOffset||(this.pathOffset=new a(this.x,this.y)),this.pathVector||(this.pathVector=new a),this.pathDelta||(this.pathDelta=new a),this.pathDelta.reset(),t.persist=!0,this.pathTween=this.scene.sys.tweens.addCounter(t),this.path.getStartPoint(this.pathOffset),h&&(this.x=this.pathOffset.x,this.y=this.pathOffset.y),this.pathOffset.x=this.x-this.pathOffset.x,this.pathOffset.y=this.y-this.pathOffset.y,this._prevDirection=o.PLAYING_FORWARD,this.rotateToPath){var u=this.path.getPoint(.1);this.rotation=Math.atan2(u.y-this.y,u.x-this.x)+s(this.pathRotationOffset)}return this.pathConfig=t,this},pauseFollow:function(){var t=this.pathTween;return t&&t.isPlaying()&&t.pause(),this},resumeFollow:function(){var t=this.pathTween;return t&&t.isPaused()&&t.resume(),this},stopFollow:function(){var t=this.pathTween;return t&&t.isPlaying()&&t.stop(),this},pathUpdate:function(){var t=this.pathTween;if(t&&t.data){var e=t.data[0],i=this.pathDelta,n=this.pathVector;if(i.copy(n).negate(),e.state===o.COMPLETE)return this.path.getPoint(e.end,n),i.add(n),n.add(this.pathOffset),void this.setPosition(n.x,n.y);if(e.state!==o.PLAYING_FORWARD&&e.state!==o.PLAYING_BACKWARD)return;this.path.getPoint(t.getValue(),n),i.add(n),n.add(this.pathOffset);var r=this.x,a=this.y;this.setPosition(n.x,n.y);var h=this.x-r,l=this.y-a;if(0===h&&0===l)return;if(e.state!==this._prevDirection)return void(this._prevDirection=e.state);this.rotateToPath&&(this.rotation=Math.atan2(l,h)+s(this.pathRotationOffset))}}};t.exports=h},72699:(t,e,i)=>{var s=i(62644),n={defaultPipeline:null,pipeline:null,pipelineData:null,initPipeline:function(t){this.pipelineData={};var e=this.scene.sys.renderer;if(!e)return!1;var i=e.pipelines;if(i){void 0===t&&(t=i.default);var s=i.get(t);if(s)return this.defaultPipeline=s,this.pipeline=s,!0}return!1},setPipeline:function(t,e,i){var n=this.scene.sys.renderer;if(!n)return this;var r=n.pipelines;if(r){var o=r.get(t);o&&(this.pipeline=o),e&&(this.pipelineData=i?s(e):e)}return this},setPipelineData:function(t,e){var i=this.pipelineData;return void 0===e?delete i[t]:i[t]=e,this},resetPipeline:function(t){return void 0===t&&(t=!1),this.pipeline=this.defaultPipeline,t&&(this.pipelineData={}),null!==this.pipeline},getPipelineName:function(){return this.pipeline.name}};t.exports=n},17581:(t,e,i)=>{var s=i(62644),n=i(47059),r=i(19133),o={hasPostPipeline:!1,postPipelines:null,postPipelineData:null,preFX:null,postFX:null,initPostPipeline:function(t){this.postPipelines=[],this.postPipelineData={},this.postFX=new n(this,!0),t&&(this.preFX=new n(this,!1))},setPostPipeline:function(t,e,i){var n=this.scene.sys.renderer;if(!n)return this;var r=n.pipelines;if(r){Array.isArray(t)||(t=[t]);for(var o=0;o0,this},setPostPipelineData:function(t,e){var i=this.postPipelineData;return void 0===e?delete i[t]:i[t]=e,this},getPostPipeline:function(t){for(var e="string"==typeof t,i=this.postPipelines,s=[],n=0;n=0;s--){var n=i[s];(e&&n.name===t||!e&&n===t)&&(n.destroy(),r(i,s))}return this.hasPostPipeline=this.postPipelines.length>0,this},clearFX:function(){return this.preFX&&this.preFX.clear(),this.postFX&&this.postFX.clear(),this}};t.exports=o},80227:t=>{t.exports={scrollFactorX:1,scrollFactorY:1,setScrollFactor:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}}},16736:t=>{var e={_sizeComponent:!0,width:0,height:0,displayWidth:{get:function(){return Math.abs(this.scaleX*this.frame.realWidth)},set:function(t){this.scaleX=t/this.frame.realWidth}},displayHeight:{get:function(){return Math.abs(this.scaleY*this.frame.realHeight)},set:function(t){this.scaleY=t/this.frame.realHeight}},setSizeToFrame:function(t){t||(t=this.frame),this.width=t.realWidth,this.height=t.realHeight;var e=this.input;return e&&!e.customHitArea&&(e.hitArea.width=this.width,e.hitArea.height=this.height),this},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}};t.exports=e},37726:(t,e,i)=>{var s=i(4327),n={texture:null,frame:null,isCropped:!1,setTexture:function(t,e,i,s){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e,i,s)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),t instanceof s?(this.texture=this.scene.sys.textures.get(t.texture.key),this.frame=t):this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this}};t.exports=n},79812:(t,e,i)=>{var s=i(4327),n={texture:null,frame:null,isCropped:!1,setCrop:function(t,e,i,s){if(void 0===t)this.isCropped=!1;else if(this.frame){if("number"==typeof t)this.frame.setCropUVs(this._crop,t,e,i,s,this.flipX,this.flipY);else{var n=t;this.frame.setCropUVs(this._crop,n.x,n.y,n.width,n.height,this.flipX,this.flipY)}this.isCropped=!0}return this},setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!0),t instanceof s?(this.texture=this.scene.sys.textures.get(t.texture.key),this.frame=t):this.frame=this.texture.get(t),this.frame.cutWidth&&this.frame.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this._sizeComponent&&e&&this.setSizeToFrame(),this._originComponent&&i&&(this.frame.customPivot?this.setOrigin(this.frame.pivotX,this.frame.pivotY):this.updateDisplayOrigin()),this.isCropped&&this.frame.updateCropUVs(this._crop,this.flipX,this.flipY),this},resetCropObject:function(){return{u0:0,v0:0,u1:0,v1:0,width:0,height:0,x:0,y:0,flipX:!1,flipY:!1,cx:0,cy:0,cw:0,ch:0}}};t.exports=n},27472:t=>{t.exports={tintTopLeft:16777215,tintTopRight:16777215,tintBottomLeft:16777215,tintBottomRight:16777215,tintFill:!1,clearTint:function(){return this.setTint(16777215),this},setTint:function(t,e,i,s){return void 0===t&&(t=16777215),void 0===e&&(e=t,i=t,s=t),this.tintTopLeft=t,this.tintTopRight=e,this.tintBottomLeft=i,this.tintBottomRight=s,this.tintFill=!1,this},setTintFill:function(t,e,i,s){return this.setTint(t,e,i,s),this.tintFill=!0,this},tint:{get:function(){return this.tintTopLeft},set:function(t){this.setTint(t,t,t,t)}},isTinted:{get:function(){var t=16777215;return this.tintFill||this.tintTopLeft!==t||this.tintTopRight!==t||this.tintBottomLeft!==t||this.tintBottomRight!==t}}}},53774:t=>{t.exports=function(t){var e={name:t.name,type:t.type,x:t.x,y:t.y,depth:t.depth,scale:{x:t.scaleX,y:t.scaleY},origin:{x:t.originX,y:t.originY},flipX:t.flipX,flipY:t.flipY,rotation:t.rotation,alpha:t.alpha,visible:t.visible,blendMode:t.blendMode,textureKey:"",frameKey:"",data:{}};return t.texture&&(e.textureKey=t.texture.key,e.frameKey=t.frame.name),e}},16901:(t,e,i)=>{var s=i(36383),n=i(61340),r=i(85955),o=i(86554),a=i(30954),h=i(26099),l={hasTransformComponent:!0,_scaleX:1,_scaleY:1,_rotation:0,x:0,y:0,z:0,w:0,scale:{get:function(){return(this._scaleX+this._scaleY)/2},set:function(t){this._scaleX=t,this._scaleY=t,0===t?this.renderFlags&=-5:this.renderFlags|=4}},scaleX:{get:function(){return this._scaleX},set:function(t){this._scaleX=t,0===t?this.renderFlags&=-5:0!==this._scaleY&&(this.renderFlags|=4)}},scaleY:{get:function(){return this._scaleY},set:function(t){this._scaleY=t,0===t?this.renderFlags&=-5:0!==this._scaleX&&(this.renderFlags|=4)}},angle:{get:function(){return a(this._rotation*s.RAD_TO_DEG)},set:function(t){this.rotation=a(t)*s.DEG_TO_RAD}},rotation:{get:function(){return this._rotation},set:function(t){this._rotation=o(t)}},setPosition:function(t,e,i,s){return void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),this.x=t,this.y=e,this.z=i,this.w=s,this},copyPosition:function(t){return void 0!==t.x&&(this.x=t.x),void 0!==t.y&&(this.y=t.y),void 0!==t.z&&(this.z=t.z),void 0!==t.w&&(this.w=t.w),this},setRandomPosition:function(t,e,i,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.scale.width),void 0===s&&(s=this.scene.sys.scale.height),this.x=t+Math.random()*i,this.y=e+Math.random()*s,this},setRotation:function(t){return void 0===t&&(t=0),this.rotation=t,this},setAngle:function(t){return void 0===t&&(t=0),this.angle=t,this},setScale:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this},setX:function(t){return void 0===t&&(t=0),this.x=t,this},setY:function(t){return void 0===t&&(t=0),this.y=t,this},setZ:function(t){return void 0===t&&(t=0),this.z=t,this},setW:function(t){return void 0===t&&(t=0),this.w=t,this},getLocalTransformMatrix:function(t){return void 0===t&&(t=new n),t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY)},getWorldTransformMatrix:function(t,e){void 0===t&&(t=new n);var i=this.parentContainer;if(!i)return this.getLocalTransformMatrix(t);for(e||(e=new n),t.applyITRS(this.x,this.y,this._rotation,this._scaleX,this._scaleY);i;)e.applyITRS(i.x,i.y,i._rotation,i._scaleX,i._scaleY),e.multiply(t,t),i=i.parentContainer;return t},getLocalPoint:function(t,e,i,s){i||(i=new h),s||(s=this.scene.sys.cameras.main);var n=s.scrollX,o=s.scrollY,a=t+n*this.scrollFactorX-n,l=e+o*this.scrollFactorY-o;return this.parentContainer?this.getWorldTransformMatrix().applyInverse(a,l,i):r(a,l,this.x,this.y,this.rotation,this.scaleX,this.scaleY,i),this._originComponent&&(i.x+=this._displayOriginX,i.y+=this._displayOriginY),i},getParentRotation:function(){for(var t=0,e=this.parentContainer;e;)t+=e.rotation,e=e.parentContainer;return t}};t.exports=l},61340:(t,e,i)=>{var s=i(83419),n=i(36383),r=i(26099),o=new s({initialize:function(t,e,i,s,n,r){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===n&&(n=0),void 0===r&&(r=0),this.matrix=new Float32Array([t,e,i,s,n,r,0,0,1]),this.decomposedMatrix={translateX:0,translateY:0,scaleX:1,scaleY:1,rotation:0},this.quad=new Float32Array(8)},a:{get:function(){return this.matrix[0]},set:function(t){this.matrix[0]=t}},b:{get:function(){return this.matrix[1]},set:function(t){this.matrix[1]=t}},c:{get:function(){return this.matrix[2]},set:function(t){this.matrix[2]=t}},d:{get:function(){return this.matrix[3]},set:function(t){this.matrix[3]=t}},e:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},f:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},tx:{get:function(){return this.matrix[4]},set:function(t){this.matrix[4]=t}},ty:{get:function(){return this.matrix[5]},set:function(t){this.matrix[5]=t}},rotation:{get:function(){return Math.acos(this.a/this.scaleX)*(Math.atan(-this.c/this.a)<0?-1:1)}},rotationNormalized:{get:function(){var t=this.matrix,e=t[0],i=t[1],s=t[2],r=t[3];return e||i?i>0?Math.acos(e/this.scaleX):-Math.acos(e/this.scaleX):s||r?n.TAU-(r>0?Math.acos(-s/this.scaleY):-Math.acos(s/this.scaleY)):0}},scaleX:{get:function(){return Math.sqrt(this.a*this.a+this.b*this.b)}},scaleY:{get:function(){return Math.sqrt(this.c*this.c+this.d*this.d)}},loadIdentity:function(){var t=this.matrix;return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,this},translate:function(t,e){var i=this.matrix;return i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this},scale:function(t,e){var i=this.matrix;return i[0]*=t,i[1]*=t,i[2]*=e,i[3]*=e,this},rotate:function(t){var e=Math.sin(t),i=Math.cos(t),s=this.matrix,n=s[0],r=s[1],o=s[2],a=s[3];return s[0]=n*i+o*e,s[1]=r*i+a*e,s[2]=n*-e+o*i,s[3]=r*-e+a*i,this},multiply:function(t,e){var i=this.matrix,s=t.matrix,n=i[0],r=i[1],o=i[2],a=i[3],h=i[4],l=i[5],u=s[0],c=s[1],d=s[2],f=s[3],p=s[4],v=s[5],g=void 0===e?i:e.matrix;return g[0]=u*n+c*o,g[1]=u*r+c*a,g[2]=d*n+f*o,g[3]=d*r+f*a,g[4]=p*n+v*o+h,g[5]=p*r+v*a+l,g},multiplyWithOffset:function(t,e,i){var s=this.matrix,n=t.matrix,r=s[0],o=s[1],a=s[2],h=s[3],l=e*r+i*a+s[4],u=e*o+i*h+s[5],c=n[0],d=n[1],f=n[2],p=n[3],v=n[4],g=n[5];return s[0]=c*r+d*a,s[1]=c*o+d*h,s[2]=f*r+p*a,s[3]=f*o+p*h,s[4]=v*r+g*a+l,s[5]=v*o+g*h+u,this},transform:function(t,e,i,s,n,r){var o=this.matrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return o[0]=t*a+e*l,o[1]=t*h+e*u,o[2]=i*a+s*l,o[3]=i*h+s*u,o[4]=n*a+r*l+c,o[5]=n*h+r*u+d,this},transformPoint:function(t,e,i){void 0===i&&(i={x:0,y:0});var s=this.matrix,n=s[0],r=s[1],o=s[2],a=s[3],h=s[4],l=s[5];return i.x=t*n+e*o+h,i.y=t*r+e*a+l,i},invert:function(){var t=this.matrix,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=e*n-i*s;return t[0]=n/a,t[1]=-i/a,t[2]=-s/a,t[3]=e/a,t[4]=(s*o-n*r)/a,t[5]=-(e*o-i*r)/a,this},copyFrom:function(t){var e=this.matrix;return e[0]=t.a,e[1]=t.b,e[2]=t.c,e[3]=t.d,e[4]=t.e,e[5]=t.f,this},copyFromArray:function(t){var e=this.matrix;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],this},copyToContext:function(t){var e=this.matrix;return t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t},setToContext:function(t){return t.setTransform(this),t},copyToArray:function(t){var e=this.matrix;return void 0===t?t=[e[0],e[1],e[2],e[3],e[4],e[5]]:(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5]),t},setTransform:function(t,e,i,s,n,r){var o=this.matrix;return o[0]=t,o[1]=e,o[2]=i,o[3]=s,o[4]=n,o[5]=r,this},decomposeMatrix:function(){var t=this.decomposedMatrix,e=this.matrix,i=e[0],s=e[1],n=e[2],r=e[3],o=i*r-s*n;if(t.translateX=e[4],t.translateY=e[5],i||s){var a=Math.sqrt(i*i+s*s);t.rotation=s>0?Math.acos(i/a):-Math.acos(i/a),t.scaleX=a,t.scaleY=o/a}else if(n||r){var h=Math.sqrt(n*n+r*r);t.rotation=.5*Math.PI-(r>0?Math.acos(-n/h):-Math.acos(n/h)),t.scaleX=o/h,t.scaleY=h}else t.rotation=0,t.scaleX=0,t.scaleY=0;return t},applyITRS:function(t,e,i,s,n){var r=this.matrix,o=Math.sin(i),a=Math.cos(i);return r[4]=t,r[5]=e,r[0]=a*s,r[1]=o*s,r[2]=-o*n,r[3]=a*n,this},applyInverse:function(t,e,i){void 0===i&&(i=new r);var s=this.matrix,n=s[0],o=s[1],a=s[2],h=s[3],l=s[4],u=s[5],c=1/(n*h+a*-o);return i.x=h*c*t+-a*c*e+(u*a-l*h)*c,i.y=n*c*e+-o*c*t+(-u*n+l*o)*c,i},setQuad:function(t,e,i,s,n,r){void 0===n&&(n=!1),void 0===r&&(r=this.quad);var o=this.matrix,a=o[0],h=o[1],l=o[2],u=o[3],c=o[4],d=o[5];return n?(r[0]=Math.round(t*a+e*l+c),r[1]=Math.round(t*h+e*u+d),r[2]=Math.round(t*a+s*l+c),r[3]=Math.round(t*h+s*u+d),r[4]=Math.round(i*a+s*l+c),r[5]=Math.round(i*h+s*u+d),r[6]=Math.round(i*a+e*l+c),r[7]=Math.round(i*h+e*u+d)):(r[0]=t*a+e*l+c,r[1]=t*h+e*u+d,r[2]=t*a+s*l+c,r[3]=t*h+s*u+d,r[4]=i*a+s*l+c,r[5]=i*h+s*u+d,r[6]=i*a+e*l+c,r[7]=i*h+e*u+d),r},getX:function(t,e){return t*this.a+e*this.c+this.e},getY:function(t,e){return t*this.b+e*this.d+this.f},getXRound:function(t,e,i){var s=this.getX(t,e);return i&&(s=Math.round(s)),s},getYRound:function(t,e,i){var s=this.getY(t,e);return i&&(s=Math.round(s)),s},getCSSMatrix:function(){var t=this.matrix;return"matrix("+t[0]+","+t[1]+","+t[2]+","+t[3]+","+t[4]+","+t[5]+")"},destroy:function(){this.matrix=null,this.quad=null,this.decomposedMatrix=null}});t.exports=o},59715:t=>{t.exports={_visible:!0,visible:{get:function(){return this._visible},set:function(t){t?(this._visible=!0,this.renderFlags|=1):(this._visible=!1,this.renderFlags&=-2)}},setVisible:function(t){return this.visible=t,this}}},31401:(t,e,i)=>{t.exports={Alpha:i(16005),AlphaSingle:i(88509),BlendMode:i(90065),ComputedSize:i(94215),Crop:i(61683),Depth:i(89272),Flip:i(54434),FX:i(47059),GetBounds:i(8004),Mask:i(8573),Origin:i(27387),PathFollower:i(37640),Pipeline:i(72699),PostPipeline:i(17581),ScrollFactor:i(80227),Size:i(16736),Texture:i(37726),TextureCrop:i(79812),Tint:i(27472),ToJSON:i(53774),Transform:i(16901),TransformMatrix:i(61340),Visible:i(59715)}},31559:(t,e,i)=>{var s=i(37105),n=i(10312),r=i(83419),o=i(31401),a=i(51708),h=i(95643),l=i(87841),u=i(29959),c=i(36899),d=i(26099),f=new r({Extends:h,Mixins:[o.AlphaSingle,o.BlendMode,o.ComputedSize,o.Depth,o.Mask,o.PostPipeline,o.Transform,o.Visible,u],initialize:function(t,e,i,s){h.call(this,t,"Container"),this.list=[],this.exclusive=!0,this.maxSize=-1,this.position=0,this.localTransform=new o.TransformMatrix,this.tempTransformMatrix=new o.TransformMatrix,this._sortKey="",this._sysEvents=t.sys.events,this.scrollFactorX=1,this.scrollFactorY=1,this.initPostPipeline(),this.setPosition(e,i),this.setBlendMode(n.SKIP_CHECK),s&&this.add(s)},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return.5*this.width}},displayOriginY:{get:function(){return.5*this.height}},setExclusive:function(t){return void 0===t&&(t=!0),this.exclusive=t,this},getBounds:function(t){if(void 0===t&&(t=new l),t.setTo(this.x,this.y,0,0),this.parentContainer){var e=this.parentContainer.getBoundsTransformMatrix().transformPoint(this.x,this.y);t.setTo(e.x,e.y,0,0)}if(this.list.length>0){var i=this.list,s=new l,n=!1;t.setEmpty();for(var r=0;r-1},setAll:function(t,e,i,n){return s.SetAll(this.list,t,e,i,n),this},each:function(t,e){var i,s=[null],n=this.list.slice(),r=n.length;for(i=2;i0?this.list[0]:null}},last:{get:function(){return this.list.length>0?(this.position=this.list.length-1,this.list[this.position]):null}},next:{get:function(){return this.position0?(this.position--,this.list[this.position]):null}},preDestroy:function(){this.removeAll(!!this.exclusive),this.localTransform.destroy(),this.tempTransformMatrix.destroy(),this.list=[]},onChildDestroyed:function(t){s.Remove(this.list,t),this.exclusive&&(t.parentContainer=null,t.removedFromScene())}});t.exports=f},53584:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e);var n=e.list;if(0!==n.length){var r=e.localTransform;s?(r.loadIdentity(),r.multiply(s),r.translate(e.x,e.y),r.rotate(e.rotation),r.scale(e.scaleX,e.scaleY)):r.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);var o=-1!==e.blendMode;o||t.setBlendMode(0);var a=e._alpha,h=e.scrollFactorX,l=e.scrollFactorY;e.mask&&e.mask.preRenderCanvas(t,null,i);for(var u=0;u{var s=i(25305),n=i(31559),r=i(44603),o=i(23568),a=i(95540);r.register("container",(function(t,e){void 0===t&&(t={});var i=o(t,"x",0),r=o(t,"y",0),h=a(t,"children",null),l=new n(this.scene,i,r,h);return void 0!==e&&(t.add=e),s(this.scene,l,t),l}))},24961:(t,e,i)=>{var s=i(31559);i(39429).register("container",(function(t,e,i){return this.displayList.add(new s(this.scene,t,e,i))}))},29959:(t,e,i)=>{var s,n;i(29747),s=i(72249),n=i(53584),t.exports={renderWebGL:s,renderCanvas:n}},72249:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e);var n=e.list,r=n.length;if(0!==r){var o=e.localTransform;s?(o.loadIdentity(),o.multiply(s),o.translate(e.x,e.y),o.rotate(e.rotation),o.scale(e.scaleX,e.scaleY)):o.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),t.pipelines.preBatch(e);var a=-1!==e.blendMode;a||t.setBlendMode(0);for(var h=e.alpha,l=e.scrollFactorX,u=e.scrollFactorY,c=0;c{t.exports=["normal","multiply","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]},3069:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(441),o=i(95643),a=i(41212),h=i(35846),l=i(44594),u=i(61369),c=new s({Extends:o,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.Origin,n.ScrollFactor,n.Transform,n.Visible,r],initialize:function(t,e,i,s,n,r){o.call(this,t,"DOMElement"),this.parent=t.sys.game.domContainer,this.cache=t.sys.cache.html,this.node,this.transformOnly=!1,this.skewX=0,this.skewY=0,this.rotate3d=new u,this.rotate3dAngle="deg",this.pointerEvents="auto",this.width=0,this.height=0,this.displayWidth=0,this.displayHeight=0,this.handler=this.dispatchNativeEvent.bind(this),this.setPosition(e,i),"string"==typeof s?"#"===s[0]?this.setElement(s.substr(1),n,r):this.createElement(s,n,r):s&&this.setElement(s,n,r),t.sys.events.on(l.SLEEP,this.handleSceneEvent,this),t.sys.events.on(l.WAKE,this.handleSceneEvent,this),t.sys.events.on(l.PRE_RENDER,this.preRender,this)},handleSceneEvent:function(t){var e=this.node,i=e.style;e&&(i.display=t.settings.visible?"block":"none")},setSkew:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.skewX=t,this.skewY=e,this},setPerspective:function(t){return this.parent.style.perspective=t+"px",this},perspective:{get:function(){return parseFloat(this.parent.style.perspective)},set:function(t){this.parent.style.perspective=t+"px"}},addListener:function(t){if(this.node){t=t.split(" ");for(var e=0;e{var s=i(47407),n=i(95643),r=i(61340),o=new r,a=new r,h=new r;t.exports=function(t,e,i,r){if(e.node){var l=e.node.style,u=e.scene.sys.settings;if(!l||!u.visible||n.RENDER_MASK!==e.renderFlags||0!==e.cameraFilter&&e.cameraFilter&i.id||e.parentContainer&&!e.parentContainer.willRender())l.display="none";else{var c=e.parentContainer,d=i.alpha*e.alpha;c&&(d*=c.alpha);var f=o,p=a,v=h,g=0,m=0,y="0%",x="0%";r?(g=e.width*e.scaleX*e.originX,m=e.height*e.scaleY*e.originY,p.applyITRS(e.x-g,e.y-m,e.rotation,e.scaleX,e.scaleY),f.copyFrom(i.matrix),f.multiplyWithOffset(r,-i.scrollX*e.scrollFactorX,-i.scrollY*e.scrollFactorY),p.e=e.x-g,p.f=e.y-m,f.multiply(p,v)):(g=e.width*e.originX,m=e.height*e.originY,p.applyITRS(e.x-g,e.y-m,e.rotation,e.scaleX,e.scaleY),f.copyFrom(i.matrix),y=100*e.originX+"%",x=100*e.originY+"%",p.e-=i.scrollX*e.scrollFactorX,p.f-=i.scrollY*e.scrollFactorY,f.multiply(p,v)),e.transformOnly||(l.display="block",l.opacity=d,l.zIndex=e._depth,l.pointerEvents=e.pointerEvents,l.mixBlendMode=s[e._blendMode]),l.transform=v.getCSSMatrix()+" skew("+e.skewX+"rad, "+e.skewY+"rad) rotate3d("+e.rotate3d.x+","+e.rotate3d.y+","+e.rotate3d.z+","+e.rotate3d.w+e.rotate3dAngle+")",l.transformOrigin=y+" "+x}}}},2611:(t,e,i)=>{var s=i(3069);i(39429).register("dom",(function(t,e,i,n,r){var o=new s(this.scene,t,e,i,n,r);return this.displayList.add(o),o}))},441:(t,e,i)=>{var s,n;i(29747),s=i(49381),n=i(49381),t.exports={renderWebGL:s,renderCanvas:n}},62980:t=>{t.exports="addedtoscene"},41337:t=>{t.exports="destroy"},44947:t=>{t.exports="removedfromscene"},49358:t=>{t.exports="complete"},35163:t=>{t.exports="created"},97249:t=>{t.exports="error"},19483:t=>{t.exports="locked"},56059:t=>{t.exports="loop"},26772:t=>{t.exports="metadata"},64437:t=>{t.exports="playing"},83411:t=>{t.exports="play"},75780:t=>{t.exports="seeked"},67799:t=>{t.exports="seeking"},63500:t=>{t.exports="stalled"},55541:t=>{t.exports="stop"},53208:t=>{t.exports="textureready"},4992:t=>{t.exports="unlocked"},12:t=>{t.exports="unsupported"},51708:(t,e,i)=>{t.exports={ADDED_TO_SCENE:i(62980),DESTROY:i(41337),REMOVED_FROM_SCENE:i(44947),VIDEO_COMPLETE:i(49358),VIDEO_CREATED:i(35163),VIDEO_ERROR:i(97249),VIDEO_LOCKED:i(19483),VIDEO_LOOP:i(56059),VIDEO_METADATA:i(26772),VIDEO_PLAY:i(83411),VIDEO_PLAYING:i(64437),VIDEO_SEEKED:i(75780),VIDEO_SEEKING:i(67799),VIDEO_STALLED:i(63500),VIDEO_STOP:i(55541),VIDEO_TEXTURE:i(53208),VIDEO_UNLOCKED:i(4992),VIDEO_UNSUPPORTED:i(12)}},42421:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(95643),o=i(64993),a=new s({Extends:r,Mixins:[n.Alpha,n.BlendMode,n.Depth,n.Flip,n.Origin,n.ScrollFactor,n.Size,n.Texture,n.Tint,n.Transform,n.Visible,o],initialize:function(t){r.call(this,t,"Extern")},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},preUpdate:function(){},render:function(){}});t.exports=a},70217:()=>{},56315:(t,e,i)=>{var s=i(42421);i(39429).register("extern",(function(){var t=new s(this.scene);return this.displayList.add(t),t}))},64993:(t,e,i)=>{var s,n;i(29747),s=i(80287),n=i(70217),t.exports={renderWebGL:s,renderCanvas:n}},80287:(t,e,i)=>{var s=i(91296);t.exports=function(t,e,i,n){t.pipelines.clear();var r=s(e,i,n).calc;e.render.call(e,t,i,r),t.pipelines.rebind()}},85592:t=>{t.exports={ARC:0,BEGIN_PATH:1,CLOSE_PATH:2,FILL_RECT:3,LINE_TO:4,MOVE_TO:5,LINE_STYLE:6,FILL_STYLE:7,FILL_PATH:8,STROKE_PATH:9,FILL_TRIANGLE:10,STROKE_TRIANGLE:11,SAVE:14,RESTORE:15,TRANSLATE:16,SCALE:17,ROTATE:18,GRADIENT_FILL_STYLE:21,GRADIENT_LINE_STYLE:22}},43831:(t,e,i)=>{var s=i(71911),n=i(83419),r=i(85592),o=i(31401),a=i(8497),h=i(95643),l=i(95540),u=i(35154),c=i(36383),d=i(84503),f=new n({Extends:h,Mixins:[o.AlphaSingle,o.BlendMode,o.Depth,o.Mask,o.Pipeline,o.PostPipeline,o.Transform,o.Visible,o.ScrollFactor,d],initialize:function(t,e){var i=u(e,"x",0),s=u(e,"y",0);h.call(this,t,"Graphics"),this.setPosition(i,s),this.initPipeline(),this.initPostPipeline(),this.displayOriginX=0,this.displayOriginY=0,this.commandBuffer=[],this.defaultFillColor=-1,this.defaultFillAlpha=1,this.defaultStrokeWidth=1,this.defaultStrokeColor=-1,this.defaultStrokeAlpha=1,this._lineWidth=1,this.lineStyle(1,0,0),this.fillStyle(0,0),this.setDefaultStyles(e)},setDefaultStyles:function(t){return u(t,"lineStyle",null)&&(this.defaultStrokeWidth=u(t,"lineStyle.width",1),this.defaultStrokeColor=u(t,"lineStyle.color",16777215),this.defaultStrokeAlpha=u(t,"lineStyle.alpha",1),this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha)),u(t,"fillStyle",null)&&(this.defaultFillColor=u(t,"fillStyle.color",16777215),this.defaultFillAlpha=u(t,"fillStyle.alpha",1),this.fillStyle(this.defaultFillColor,this.defaultFillAlpha)),this},lineStyle:function(t,e,i){return void 0===i&&(i=1),this.commandBuffer.push(r.LINE_STYLE,t,e,i),this._lineWidth=t,this},fillStyle:function(t,e){return void 0===e&&(e=1),this.commandBuffer.push(r.FILL_STYLE,t,e),this},fillGradientStyle:function(t,e,i,s,n,o,a,h){return void 0===n&&(n=1),void 0===o&&(o=n),void 0===a&&(a=n),void 0===h&&(h=n),this.commandBuffer.push(r.GRADIENT_FILL_STYLE,n,o,a,h,t,e,i,s),this},lineGradientStyle:function(t,e,i,s,n,o){return void 0===o&&(o=1),this.commandBuffer.push(r.GRADIENT_LINE_STYLE,t,o,e,i,s,n),this},beginPath:function(){return this.commandBuffer.push(r.BEGIN_PATH),this},closePath:function(){return this.commandBuffer.push(r.CLOSE_PATH),this},fillPath:function(){return this.commandBuffer.push(r.FILL_PATH),this},fill:function(){return this.commandBuffer.push(r.FILL_PATH),this},strokePath:function(){return this.commandBuffer.push(r.STROKE_PATH),this},stroke:function(){return this.commandBuffer.push(r.STROKE_PATH),this},fillCircleShape:function(t){return this.fillCircle(t.x,t.y,t.radius)},strokeCircleShape:function(t){return this.strokeCircle(t.x,t.y,t.radius)},fillCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,c.PI2),this.fillPath(),this},strokeCircle:function(t,e,i){return this.beginPath(),this.arc(t,e,i,0,c.PI2),this.strokePath(),this},fillRectShape:function(t){return this.fillRect(t.x,t.y,t.width,t.height)},strokeRectShape:function(t){return this.strokeRect(t.x,t.y,t.width,t.height)},fillRect:function(t,e,i,s){return this.commandBuffer.push(r.FILL_RECT,t,e,i,s),this},strokeRect:function(t,e,i,s){var n=this._lineWidth/2,r=t-n,o=t+n;return this.beginPath(),this.moveTo(t,e),this.lineTo(t,e+s),this.strokePath(),this.beginPath(),this.moveTo(t+i,e),this.lineTo(t+i,e+s),this.strokePath(),this.beginPath(),this.moveTo(r,e),this.lineTo(o+i,e),this.strokePath(),this.beginPath(),this.moveTo(r,e+s),this.lineTo(o+i,e+s),this.strokePath(),this},fillRoundedRect:function(t,e,i,s,n){void 0===n&&(n=20);var r=n,o=n,a=n,h=n;"number"!=typeof n&&(r=l(n,"tl",20),o=l(n,"tr",20),a=l(n,"bl",20),h=l(n,"br",20));var u=r>=0,d=o>=0,f=a>=0,p=h>=0;return r=Math.abs(r),o=Math.abs(o),a=Math.abs(a),h=Math.abs(h),this.beginPath(),this.moveTo(t+r,e),this.lineTo(t+i-o,e),d?this.arc(t+i-o,e+o,o,-c.TAU,0):this.arc(t+i,e,o,Math.PI,c.TAU,!0),this.lineTo(t+i,e+s-h),p?this.arc(t+i-h,e+s-h,h,0,c.TAU):this.arc(t+i,e+s,h,-c.TAU,Math.PI,!0),this.lineTo(t+a,e+s),f?this.arc(t+a,e+s-a,a,c.TAU,Math.PI):this.arc(t,e+s,a,0,-c.TAU,!0),this.lineTo(t,e+r),u?this.arc(t+r,e+r,r,-Math.PI,-c.TAU):this.arc(t,e,r,c.TAU,0,!0),this.fillPath(),this},strokeRoundedRect:function(t,e,i,s,n){void 0===n&&(n=20);var r=n,o=n,a=n,h=n,u=Math.min(i,s)/2;"number"!=typeof n&&(r=l(n,"tl",20),o=l(n,"tr",20),a=l(n,"bl",20),h=l(n,"br",20));var d=r>=0,f=o>=0,p=a>=0,v=h>=0;return r=Math.min(Math.abs(r),u),o=Math.min(Math.abs(o),u),a=Math.min(Math.abs(a),u),h=Math.min(Math.abs(h),u),this.beginPath(),this.moveTo(t+r,e),this.lineTo(t+i-o,e),this.moveTo(t+i-o,e),f?this.arc(t+i-o,e+o,o,-c.TAU,0):this.arc(t+i,e,o,Math.PI,c.TAU,!0),this.lineTo(t+i,e+s-h),this.moveTo(t+i,e+s-h),v?this.arc(t+i-h,e+s-h,h,0,c.TAU):this.arc(t+i,e+s,h,-c.TAU,Math.PI,!0),this.lineTo(t+a,e+s),this.moveTo(t+a,e+s),p?this.arc(t+a,e+s-a,a,c.TAU,Math.PI):this.arc(t,e+s,a,0,-c.TAU,!0),this.lineTo(t,e+r),this.moveTo(t,e+r),d?this.arc(t+r,e+r,r,-Math.PI,-c.TAU):this.arc(t,e,r,c.TAU,0,!0),this.strokePath(),this},fillPointShape:function(t,e){return this.fillPoint(t.x,t.y,e)},fillPoint:function(t,e,i){return!i||i<1?i=1:(t-=i/2,e-=i/2),this.commandBuffer.push(r.FILL_RECT,t,e,i,i),this},fillTriangleShape:function(t){return this.fillTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},strokeTriangleShape:function(t){return this.strokeTriangle(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)},fillTriangle:function(t,e,i,s,n,o){return this.commandBuffer.push(r.FILL_TRIANGLE,t,e,i,s,n,o),this},strokeTriangle:function(t,e,i,s,n,o){return this.commandBuffer.push(r.STROKE_TRIANGLE,t,e,i,s,n,o),this},strokeLineShape:function(t){return this.lineBetween(t.x1,t.y1,t.x2,t.y2)},lineBetween:function(t,e,i,s){return this.beginPath(),this.moveTo(t,e),this.lineTo(i,s),this.strokePath(),this},lineTo:function(t,e){return this.commandBuffer.push(r.LINE_TO,t,e),this},moveTo:function(t,e){return this.commandBuffer.push(r.MOVE_TO,t,e),this},strokePoints:function(t,e,i,s){void 0===e&&(e=!1),void 0===i&&(i=!1),void 0===s&&(s=t.length),this.beginPath(),this.moveTo(t[0].x,t[0].y);for(var n=1;n-1&&this.fillStyle(this.defaultFillColor,this.defaultFillAlpha),this.defaultStrokeColor>-1&&this.lineStyle(this.defaultStrokeWidth,this.defaultStrokeColor,this.defaultStrokeAlpha),this},generateTexture:function(t,e,i){var s,n,r=this.scene.sys,o=r.game.renderer;void 0===e&&(e=r.scale.width),void 0===i&&(i=r.scale.height),f.TargetCamera.setScene(this.scene),f.TargetCamera.setViewport(0,0,e,i),f.TargetCamera.scrollX=this.x,f.TargetCamera.scrollY=this.y;var a={willReadFrequently:!0};if("string"==typeof t)if(r.textures.exists(t)){var h=(s=r.textures.get(t)).getSourceImage();h instanceof HTMLCanvasElement&&(n=h.getContext("2d",a))}else n=(s=r.textures.createCanvas(t,e,i)).getSourceImage().getContext("2d",a);else t instanceof HTMLCanvasElement&&(n=t.getContext("2d",a));return n&&(this.renderCanvas(o,this,f.TargetCamera,null,n,!1),s&&s.refresh()),this},preDestroy:function(){this.commandBuffer=[]}});f.TargetCamera=new s,t.exports=f},32768:(t,e,i)=>{var s=i(85592),n=i(20926);t.exports=function(t,e,i,r,o,a){var h=e.commandBuffer,l=h.length,u=o||t.currentContext;if(0!==l&&n(t,u,e,i,r)){i.addToRenderList(e);var c=1,d=1,f=0,p=0,v=1,g=0,m=0,y=0;u.beginPath();for(var x=0;x>>16,m=(65280&f)>>>8,y=255&f,u.strokeStyle="rgba("+g+","+m+","+y+","+c+")",u.lineWidth=v,x+=3;break;case s.FILL_STYLE:p=h[x+1],d=h[x+2],g=(16711680&p)>>>16,m=(65280&p)>>>8,y=255&p,u.fillStyle="rgba("+g+","+m+","+y+","+d+")",x+=2;break;case s.BEGIN_PATH:u.beginPath();break;case s.CLOSE_PATH:u.closePath();break;case s.FILL_PATH:a||u.fill();break;case s.STROKE_PATH:a||u.stroke();break;case s.FILL_RECT:a?u.rect(h[x+1],h[x+2],h[x+3],h[x+4]):u.fillRect(h[x+1],h[x+2],h[x+3],h[x+4]),x+=4;break;case s.FILL_TRIANGLE:u.beginPath(),u.moveTo(h[x+1],h[x+2]),u.lineTo(h[x+3],h[x+4]),u.lineTo(h[x+5],h[x+6]),u.closePath(),a||u.fill(),x+=6;break;case s.STROKE_TRIANGLE:u.beginPath(),u.moveTo(h[x+1],h[x+2]),u.lineTo(h[x+3],h[x+4]),u.lineTo(h[x+5],h[x+6]),u.closePath(),a||u.stroke(),x+=6;break;case s.LINE_TO:u.lineTo(h[x+1],h[x+2]),x+=2;break;case s.MOVE_TO:u.moveTo(h[x+1],h[x+2]),x+=2;break;case s.LINE_FX_TO:u.lineTo(h[x+1],h[x+2]),x+=5;break;case s.MOVE_FX_TO:u.moveTo(h[x+1],h[x+2]),x+=5;break;case s.SAVE:u.save();break;case s.RESTORE:u.restore();break;case s.TRANSLATE:u.translate(h[x+1],h[x+2]),x+=2;break;case s.SCALE:u.scale(h[x+1],h[x+2]),x+=2;break;case s.ROTATE:u.rotate(h[x+1]),x+=1;break;case s.GRADIENT_FILL_STYLE:x+=5;break;case s.GRADIENT_LINE_STYLE:x+=6}u.restore()}}},87079:(t,e,i)=>{var s=i(44603),n=i(43831);s.register("graphics",(function(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new n(this.scene,t);return t.add&&this.scene.sys.displayList.add(i),i}))},1201:(t,e,i)=>{var s=i(43831);i(39429).register("graphics",(function(t){return this.displayList.add(new s(this.scene,t))}))},84503:(t,e,i)=>{var s,n;i(29747),s=i(77545),i(32768),n=i(32768),t.exports={renderWebGL:s,renderCanvas:n}},77545:(t,e,i)=>{var s=i(85592),n=i(91296),r=i(61340),o=i(70554),a=function(t,e,i){this.x=t,this.y=e,this.width=i},h=function(t,e,i){this.points=[],this.pointsLength=1,this.points[0]=new a(t,e,i)},l=[],u=new r;t.exports=function(t,e,i,r){if(0!==e.commandBuffer.length){i.addToRenderList(e);var c=t.pipelines.set(e.pipeline,e);t.pipelines.preBatch(e);for(var d=n(e,i,r).calc,f=u.loadIdentity(),p=e.commandBuffer,v=i.alpha*e.alpha,g=1,m=c.fillTint,y=c.strokeTint,x=0,T=0,w=0,b=2*Math.PI,S=[],E=0,A=!0,C=null,_=o.getTintAppendFloatAlpha,M=0;M0&&(Y=Y%b-b):Y>b?Y=b:Y<0&&(Y=b+Y%b),null===C&&(C=new h(B+Math.cos(X)*U,N+Math.sin(X)*U,g),S.push(C),I+=.01);I<1+G;)w=Y*I+X,x=B+Math.cos(w)*U,T=N+Math.sin(w)*U,C.points.push(new a(x,T,g)),I+=.01;w=Y+X,x=B+Math.cos(w)*U,T=N+Math.sin(w)*U,C.points.push(new a(x,T,g));break;case s.FILL_RECT:c.batchFillRect(p[++M],p[++M],p[++M],p[++M],f,d);break;case s.FILL_TRIANGLE:c.batchFillTriangle(p[++M],p[++M],p[++M],p[++M],p[++M],p[++M],f,d);break;case s.STROKE_TRIANGLE:c.batchStrokeTriangle(p[++M],p[++M],p[++M],p[++M],p[++M],p[++M],g,f,d);break;case s.LINE_TO:null!==C?C.points.push(new a(p[++M],p[++M],g)):(C=new h(p[++M],p[++M],g),S.push(C));break;case s.MOVE_TO:C=new h(p[++M],p[++M],g),S.push(C);break;case s.SAVE:l.push(f.copyToArray());break;case s.RESTORE:f.copyFromArray(l.pop());break;case s.TRANSLATE:B=p[++M],N=p[++M],f.translate(B,N);break;case s.SCALE:B=p[++M],N=p[++M],f.scale(B,N);break;case s.ROTATE:f.rotate(p[++M])}t.pipelines.postBatch(e)}}},26479:(t,e,i)=>{var s=i(61061),n=i(83419),r=i(51708),o=i(50792),a=i(46710),h=i(95540),l=i(35154),u=i(97022),c=i(41212),d=i(88492),f=i(35072),p=i(68287),v=new n({Extends:o,initialize:function(t,e,i){o.call(this),i?e&&!Array.isArray(e)&&(e=[e]):Array.isArray(e)?c(e[0])&&(i=e,e=null):c(e)&&(i=e,e=null),this.scene=t,this.children=new f,this.isParent=!0,this.type="Group",this.classType=h(i,"classType",p),this.name=h(i,"name",""),this.active=h(i,"active",!0),this.maxSize=h(i,"maxSize",-1),this.defaultKey=h(i,"defaultKey",null),this.defaultFrame=h(i,"defaultFrame",null),this.runChildUpdate=h(i,"runChildUpdate",!1),this.createCallback=h(i,"createCallback",null),this.removeCallback=h(i,"removeCallback",null),this.createMultipleCallback=h(i,"createMultipleCallback",null),this.internalCreateCallback=h(i,"internalCreateCallback",null),this.internalRemoveCallback=h(i,"internalRemoveCallback",null),e&&this.addMultiple(e),i&&this.createMultiple(i),this.on(r.ADDED_TO_SCENE,this.addedToScene,this),this.on(r.REMOVED_FROM_SCENE,this.removedFromScene,this)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},create:function(t,e,i,s,n,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.defaultKey),void 0===s&&(s=this.defaultFrame),void 0===n&&(n=!0),void 0===r&&(r=!0),this.isFull())return null;var o=new this.classType(this.scene,t,e,i,s);return o.addToDisplayList(this.scene.sys.displayList),o.addToUpdateList(),o.visible=n,o.setActive(r),this.add(o),o},createMultiple:function(t){if(this.isFull())return[];Array.isArray(t)||(t=[t]);var e=[];if(t[0].key)for(var i=0;i=0;u--)if((l=d[u]).active===i){if(++c===e)break}else l=null;return l?("number"==typeof n&&(l.x=n),"number"==typeof r&&(l.y=r),l):s?this.create(n,r,o,a,h):null},get:function(t,e,i,s,n){return this.getFirst(!1,!0,t,e,i,s,n)},getFirstAlive:function(t,e,i,s,n,r){return this.getFirst(!0,t,e,i,s,n,r)},getFirstDead:function(t,e,i,s,n,r){return this.getFirst(!1,t,e,i,s,n,r)},playAnimation:function(t,e){return s.PlayAnimation(this.children.entries,t,e),this},isFull:function(){return-1!==this.maxSize&&this.children.size>=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;i{var s=i(44603),n=i(26479);s.register("group",(function(t){return new n(this.scene,null,t)}))},3385:(t,e,i)=>{var s=i(26479);i(39429).register("group",(function(t,e){return this.updateList.add(new s(this.scene,t,e))}))},88571:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(95643),o=i(59819),a=new s({Extends:r,Mixins:[n.Alpha,n.BlendMode,n.Depth,n.Flip,n.GetBounds,n.Mask,n.Origin,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Size,n.TextureCrop,n.Tint,n.Transform,n.Visible,o],initialize:function(t,e,i,s,n){r.call(this,t,"Image"),this._crop=this.resetCropObject(),this.setTexture(s,n),this.setPosition(e,i),this.setSizeToFrame(),this.setOriginFromFrame(),this.initPipeline(),this.initPostPipeline(!0)}});t.exports=a},40652:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e),t.batchSprite(e,e.frame,i,s)}},82459:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(88571);n.register("image",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=r(t,"frame",null),a=new o(this.scene,0,0,i,n);return void 0!==e&&(t.add=e),s(this.scene,a,t),a}))},2117:(t,e,i)=>{var s=i(88571);i(39429).register("image",(function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))}))},59819:(t,e,i)=>{var s,n;i(29747),s=i(99517),n=i(40652),t.exports={renderWebGL:s,renderCanvas:n}},99517:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e),this.pipeline.batchSprite(e,i,s)}},77856:(t,e,i)=>{var s={Events:i(51708),DisplayList:i(8050),GameObjectCreator:i(44603),GameObjectFactory:i(39429),UpdateList:i(45027),Components:i(31401),GetCalcMatrix:i(91296),BuildGameObject:i(25305),BuildGameObjectAnimation:i(13059),GameObject:i(95643),BitmapText:i(22186),Blitter:i(6107),Bob:i(46590),Container:i(31559),DOMElement:i(3069),DynamicBitmapText:i(2638),Extern:i(42421),Graphics:i(43831),Group:i(26479),Image:i(88571),Layer:i(93595),Particles:i(18404),PathFollower:i(1159),RenderTexture:i(591),RetroFont:i(196),Rope:i(77757),Sprite:i(68287),Text:i(50171),GetTextSize:i(14220),MeasureText:i(79557),TextStyle:i(35762),TileSprite:i(20839),Zone:i(41481),Video:i(18471),Shape:i(17803),Arc:i(23629),Curve:i(89),Ellipse:i(19921),Grid:i(30479),IsoBox:i(61475),IsoTriangle:i(16933),Line:i(57847),Polygon:i(24949),Rectangle:i(74561),Star:i(55911),Triangle:i(36931),Factories:{Blitter:i(12709),Container:i(24961),DOMElement:i(2611),DynamicBitmapText:i(72566),Extern:i(56315),Graphics:i(1201),Group:i(3385),Image:i(2117),Layer:i(20005),Particles:i(676),PathFollower:i(90145),RenderTexture:i(60505),Rope:i(96819),Sprite:i(46409),StaticBitmapText:i(34914),Text:i(68005),TileSprite:i(91681),Zone:i(84175),Video:i(89025),Arc:i(42563),Curve:i(40511),Ellipse:i(1543),Grid:i(34137),IsoBox:i(3933),IsoTriangle:i(49803),Line:i(2481),Polygon:i(64827),Rectangle:i(87959),Star:i(93697),Triangle:i(45245)},Creators:{Blitter:i(9403),Container:i(77143),DynamicBitmapText:i(11164),Graphics:i(87079),Group:i(94975),Image:i(82459),Layer:i(25179),Particles:i(92730),RenderTexture:i(34495),Rope:i(26209),Sprite:i(15567),StaticBitmapText:i(57336),Text:i(71259),TileSprite:i(14167),Zone:i(95261),Video:i(11511)}};s.Shader=i(20071),s.Mesh=i(4703),s.NineSlice=i(28103),s.PointLight=i(80321),s.Plane=i(33663),s.Factories.Shader=i(74177),s.Factories.Mesh=i(9225),s.Factories.NineSlice=i(47521),s.Factories.PointLight=i(71255),s.Factories.Plane=i(30985),s.Creators.Shader=i(54935),s.Creators.Mesh=i(20527),s.Creators.NineSlice=i(28279),s.Creators.PointLight=i(39829),s.Creators.Plane=i(56015),s.Light=i(41432),s.LightsManager=i(61356),s.LightsPlugin=i(88992),t.exports=s},93595:(t,e,i)=>{var s=i(10312),n=i(83419),r=i(31401),o=i(53774),a=i(45893),h=i(50792),l=i(51708),u=i(73162),c=i(33963),d=i(44594),f=i(19186),p=new n({Extends:u,Mixins:[r.AlphaSingle,r.BlendMode,r.Depth,r.Mask,r.PostPipeline,r.Visible,h,c],initialize:function(t,e){u.call(this,t),h.call(this),this.scene=t,this.displayList=null,this.type="Layer",this.state=0,this.parentContainer=null,this.name="",this.active=!0,this.tabIndex=-1,this.data=null,this.renderFlags=15,this.cameraFilter=0,this.input=null,this.body=null,this.ignoreDestroy=!1,this.systems=t.sys,this.events=t.sys.events,this.sortChildrenFlag=!1,this.addCallback=this.addChildCallback,this.removeCallback=this.removeChildCallback,this.initPostPipeline(),this.clearAlpha(),this.setBlendMode(s.SKIP_CHECK),e&&this.add(e),t.sys.queueDepthSort()},setActive:function(t){return this.active=t,this},setName:function(t){return this.name=t,this},setState:function(t){return this.state=t,this},setDataEnabled:function(){return this.data||(this.data=new a(this)),this},setData:function(t,e){return this.data||(this.data=new a(this)),this.data.set(t,e),this},incData:function(t,e){return this.data||(this.data=new a(this)),this.data.inc(t,e),this},toggleData:function(t){return this.data||(this.data=new a(this)),this.data.toggle(t),this},getData:function(t){return this.data||(this.data=new a(this)),this.data.get(t)},setInteractive:function(){return this},disableInteractive:function(){return this},removeInteractive:function(){return this},addedToScene:function(){},removedFromScene:function(){},update:function(){},toJSON:function(){return o(this)},willRender:function(t){return!(15!==this.renderFlags||0===this.list.length||0!==this.cameraFilter&&this.cameraFilter&t.id)},getIndexList:function(){for(var t=this,e=this.parentContainer,i=[];e&&(i.unshift(e.getIndex(t)),t=e,e.parentContainer);)e=e.parentContainer;return i.unshift(this.displayList.getIndex(t)),i},addChildCallback:function(t){var e=t.displayList;e&&e!==this&&t.removeFromDisplayList(),t.displayList||(this.queueDepthSort(),t.displayList=this,t.emit(l.ADDED_TO_SCENE,t,this.scene),this.events.emit(d.ADDED_TO_SCENE,t,this.scene))},removeChildCallback:function(t){this.queueDepthSort(),t.displayList=null,t.emit(l.REMOVED_FROM_SCENE,t,this.scene),this.events.emit(d.REMOVED_FROM_SCENE,t,this.scene)},queueDepthSort:function(){this.sortChildrenFlag=!0},depthSort:function(){this.sortChildrenFlag&&(f(this.list,this.sortByDepth),this.sortChildrenFlag=!1)},sortByDepth:function(t,e){return t._depth-e._depth},getChildren:function(){return this.list},addToDisplayList:function(t){return void 0===t&&(t=this.scene.sys.displayList),this.displayList&&this.displayList!==t&&this.removeFromDisplayList(),t.exists(this)||(this.displayList=t,t.add(this,!0),t.queueDepthSort(),this.emit(l.ADDED_TO_SCENE,this,this.scene),t.events.emit(d.ADDED_TO_SCENE,this,this.scene)),this},removeFromDisplayList:function(){var t=this.displayList||this.scene.sys.displayList;return t.exists(this)&&(t.remove(this,!0),t.queueDepthSort(),this.displayList=null,this.emit(l.REMOVED_FROM_SCENE,this,this.scene),t.events.emit(d.REMOVED_FROM_SCENE,this,this.scene)),this},destroy:function(t){if(this.scene&&!this.ignoreDestroy){this.emit(l.DESTROY,this);for(var e=this.list;e.length;)e[0].destroy(t);this.removeAllListeners(),this.resetPostPipeline(!0),this.displayList&&(this.displayList.remove(this,!0,!1),this.displayList.queueDepthSort()),this.data&&(this.data.destroy(),this.data=void 0),this.active=!1,this.visible=!1,this.list=void 0,this.scene=void 0,this.displayList=void 0,this.systems=void 0,this.events=void 0}}});t.exports=p},2956:t=>{t.exports=function(t,e,i){var s=e.list;if(0!==s.length){e.depthSort();var n=-1!==e.blendMode;n||t.setBlendMode(0);var r=e._alpha;e.mask&&e.mask.preRenderCanvas(t,null,i);for(var o=0;o{var s=i(25305),n=i(93595),r=i(44603),o=i(23568);r.register("layer",(function(t,e){void 0===t&&(t={});var i=o(t,"children",null),r=new n(this.scene,i);return void 0!==e&&(t.add=e),s(this.scene,r,t),r}))},20005:(t,e,i)=>{var s=i(93595);i(39429).register("layer",(function(t){return this.displayList.add(new s(this.scene,t))}))},33963:(t,e,i)=>{var s,n;i(29747),s=i(15869),n=i(2956),t.exports={renderWebGL:s,renderCanvas:n}},15869:t=>{t.exports=function(t,e,i){var s=e.list,n=s.length;if(0!==n){e.depthSort(),t.pipelines.preBatch(e);var r=-1!==e.blendMode;r||t.setBlendMode(0);for(var o=e.alpha,a=0;a{var s=i(96503),n=i(83419),r=i(31401),o=i(51767),a=i(70554),h=new n({Extends:s,Mixins:[r.Origin,r.ScrollFactor,r.Visible],initialize:function(t,e,i,n,r,a,h){s.call(this,t,e,i),this.color=new o(n,r,a),this.intensity=h,this.renderFlags=15,this.cameraFilter=0,this.setScrollFactor(1,1),this.setOrigin(),this.setDisplayOrigin(i)},displayWidth:{get:function(){return this.diameter},set:function(t){this.diameter=t}},displayHeight:{get:function(){return this.diameter},set:function(t){this.diameter=t}},width:{get:function(){return this.diameter},set:function(t){this.diameter=t}},height:{get:function(){return this.diameter},set:function(t){this.diameter=t}},willRender:function(t){return!(h.RENDER_MASK!==this.renderFlags||0!==this.cameraFilter&&this.cameraFilter&t.id)},setColor:function(t){var e=a.getFloatsFromUintRGB(t);return this.color.set(e[0],e[1],e[2]),this},setIntensity:function(t){return this.intensity=t,this},setRadius:function(t){return this.radius=t,this}});h.RENDER_MASK=15,t.exports=h},61356:(t,e,i)=>{var s=i(81491),n=i(83419),r=i(20339),o=i(41432),a=i(80321),h=i(51767),l=i(19133),u=i(19186),c=i(70554),d=new n({initialize:function(){this.lights=[],this.ambientColor=new h(.1,.1,.1),this.active=!1,this.maxLights=-1,this.visibleLights=0},addPointLight:function(t,e,i,s,n,r){return this.systems.displayList.add(new a(this.scene,t,e,i,s,n,r))},enable:function(){return-1===this.maxLights&&(this.maxLights=this.systems.renderer.config.maxLights),this.active=!0,this},disable:function(){return this.active=!1,this},getLights:function(t){for(var e=this.lights,i=t.worldView,n=[],o=0;othis.maxLights&&(u(n,this.sortByDistance),n=n.slice(0,this.maxLights)),this.visibleLights=n.length,n},sortByDistance:function(t,e){return t.distance>=e.distance},setAmbientColor:function(t){var e=c.getFloatsFromUintRGB(t);return this.ambientColor.set(e[0],e[1],e[2]),this},getMaxVisibleLights:function(){return this.maxLights},getLightCount:function(){return this.lights.length},addLight:function(t,e,i,s,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=128),void 0===s&&(s=16777215),void 0===n&&(n=1);var r=c.getFloatsFromUintRGB(s),a=new o(t,e,i,r[0],r[1],r[2],n);return this.lights.push(a),a},removeLight:function(t){var e=this.lights.indexOf(t);return e>=0&&l(this.lights,e),this},shutdown:function(){this.lights.length=0},destroy:function(){this.shutdown()}});t.exports=d},88992:(t,e,i)=>{var s=i(83419),n=i(61356),r=i(37277),o=i(44594),a=new s({Extends:n,initialize:function(t){this.scene=t,this.systems=t.sys,t.sys.settings.isBooted||t.sys.events.once(o.BOOT,this.boot,this),n.call(this)},boot:function(){var t=this.systems.events;t.on(o.SHUTDOWN,this.shutdown,this),t.on(o.DESTROY,this.destroy,this)},destroy:function(){this.shutdown(),this.scene=void 0,this.systems=void 0}});r.register("LightsPlugin",a,"lights"),t.exports=a},4703:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(39506),o=i(83997),a=i(95643),h=i(34684),l=i(92515),u=i(91296),c=i(37867),d=i(29807),f=i(43396),p=i(19186),v=i(25836),g=i(39318),m=new s({Extends:a,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.Mask,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Size,n.Texture,n.Transform,n.Visible,d],initialize:function(t,e,i,s,n,r,o,h,l,u,d,f){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s="__WHITE"),a.call(this,t,"Mesh"),this.faces=[],this.vertices=[],this.tintFill=!1,this.debugCallback=null,this.debugGraphic=null,this.hideCCW=!0,this.modelPosition=new v,this.modelScale=new v(1,1,1),this.modelRotation=new v,this.dirtyCache=[0,0,0,0,0,0,0,0,0,0,0,0],this.transformMatrix=new c,this.viewPosition=new v,this.viewMatrix=new c,this.projectionMatrix=new c,this.totalRendered=0,this.totalFrame=0,this.ignoreDirtyCache=!1,this.fov,this.displayOriginX=0,this.displayOriginY=0;var p=t.sys.renderer;this.setPosition(e,i),this.setTexture(s,n),this.setSize(p.width,p.height),this.initPipeline(),this.initPostPipeline(),this.setPerspective(p.width,p.height),r&&this.addVertices(r,o,h,l,u,d,f)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},panX:function(t){return this.viewPosition.addScale(v.LEFT,t),this.dirtyCache[10]=1,this},panY:function(t){return this.viewPosition.y+=v.DOWN.y*t,this.dirtyCache[10]=1,this},panZ:function(t){return this.viewPosition.z+=t,this.dirtyCache[10]=1,this},setPerspective:function(t,e,i,s,n){return void 0===i&&(i=45),void 0===s&&(s=.01),void 0===n&&(n=1e3),this.fov=i,this.projectionMatrix.perspective(r(i),t/e,s,n),this.dirtyCache[10]=1,this.dirtyCache[11]=0,this},setOrtho:function(t,e,i,s){return void 0===t&&(t=this.scene.sys.renderer.getAspectRatio()),void 0===e&&(e=1),void 0===i&&(i=-1e3),void 0===s&&(s=1e3),this.fov=0,this.projectionMatrix.ortho(-t,t,-e,e,i,s),this.dirtyCache[10]=1,this.dirtyCache[11]=1,this},clear:function(){return this.faces.forEach((function(t){t.destroy()})),this.faces=[],this.vertices=[],this},addVerticesFromObj:function(t,e,i,s,n,r,o,a,l){var u,c=this.scene.sys.cache.obj.get(t);return c&&(u=h(c,this,e,i,s,n,r,o,a,l)),u&&0!==u.verts.length||console.warn("Mesh.addVerticesFromObj data empty:",t),this},sortByDepth:function(t,e){return t.depth-e.depth},depthSort:function(){return p(this.faces,this.sortByDepth),this},addVertex:function(t,e,i,s,n,r,o){var a=new g(t,e,i,s,n,r,o);return this.vertices.push(a),a},addFace:function(t,e,i){var s=new o(t,e,i);return this.faces.push(s),this.dirtyCache[9]=-1,s},addVertices:function(t,e,i,s,n,r,o){var a=l(t,e,i,s,n,r,o);return a?(this.faces=this.faces.concat(a.faces),this.vertices=this.vertices.concat(a.vertices)):console.warn("Mesh.addVertices data empty or invalid"),this.dirtyCache[9]=-1,this},getFaceCount:function(){return this.faces.length},getVertexCount:function(){return this.vertices.length},getFace:function(t){return this.faces[t]},hasFaceAt:function(t,e,i){void 0===i&&(i=this.scene.sys.cameras.main);for(var s=u(this,i).calc,n=this.faces,r=0;r{t.exports=function(){}},20527:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(35154),a=i(4703);n.register("mesh",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=r(t,"frame",null),h=o(t,"vertices",[]),l=o(t,"uvs",[]),u=o(t,"indicies",[]),c=o(t,"containsZ",!1),d=o(t,"normals",[]),f=o(t,"colors",16777215),p=o(t,"alphas",1),v=new a(this.scene,0,0,i,n,h,l,u,c,d,f,p);return void 0!==e&&(t.add=e),s(this.scene,v,t),v}))},9225:(t,e,i)=>{var s=i(4703);i(39429).register("mesh",(function(t,e,i,n,r,o,a,h,l,u,c){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a,h,l,u,c))}))},29807:(t,e,i)=>{var s,n;i(29747),s=i(48833),n=i(36488),t.exports={renderWebGL:s,renderCanvas:n}},48833:(t,e,i)=>{var s=i(91296);t.exports=function(t,e,i,n){var r=e.faces,o=r.length;if(0!==o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline,e),h=s(e,i,n).calc;t.pipelines.preBatch(e);for(var l=a.setGameObject(e),u=a.vertexViewF32,c=a.vertexViewU32,d=a.vertexCount*a.currentShader.vertexComponentCount-1,f=e.tintFill,p=[],v=e.debugCallback,g=h.a,m=h.b,y=h.c,x=h.d,T=h.e,w=h.f,b=e.viewPosition.z,S=e.hideCCW,E=i.roundPixels,A=i.alpha*e.alpha,C=0,_=0;_{var s=i(83419),n=i(31401),r=i(95643),o=i(78023),a=i(39318),h=new s({Extends:r,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.GetBounds,n.Mask,n.Origin,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Texture,n.Transform,n.Visible,o],initialize:function(t,e,i,s,n,o,h,l,u,c,d){r.call(this,t,"NineSlice"),this._width,this._height,this._originX=.5,this._originY=.5,this._sizeComponent=!0,this.vertices=[],this.leftWidth,this.rightWidth,this.topHeight,this.bottomHeight,this.tint=16777215,this.tintFill=!1;var f=t.textures.getFrame(s,n);this.is3Slice=!c&&!d,f.scale9&&(this.is3Slice=f.is3Slice);for(var p=this.is3Slice?18:54,v=0;v{var s=i(25305),n=i(44603),r=i(23568),o=i(35154),a=i(28103);n.register("nineslice",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=r(t,"frame",null),h=o(t,"width",256),l=o(t,"height",256),u=o(t,"leftWidth",10),c=o(t,"rightWidth",10),d=o(t,"topHeight",0),f=o(t,"bottomHeight",0),p=new a(this.scene,0,0,i,n,h,l,u,c,d,f);return void 0!==e&&(t.add=e),s(this.scene,p,t),p}))},47521:(t,e,i)=>{var s=i(28103);i(39429).register("nineslice",(function(t,e,i,n,r,o,a,h,l,u){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a,h,l,u))}))},78023:(t,e,i)=>{var s,n=i(29747);s=i(52230),t.exports={renderWebGL:s,renderCanvas:n}},52230:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){var o=e.vertices,a=o.length;if(0!==a){i.addToRenderList(e);var h=t.pipelines.set(e.pipeline,e),l=s(e,i,r,!1).calc;t.pipelines.preBatch(e);var u=h.setGameObject(e),c=h.vertexViewF32,d=h.vertexViewU32,f=h.vertexCount*h.currentShader.vertexComponentCount-1,p=i.roundPixels,v=e.tintFill,g=i.alpha*e.alpha,m=n.getTintAppendFloatAlpha(e.tint,g),y=h.vertexAvailable(),x=-1;y{var s=i(83419),n=i(44777),r=i(37589),o=i(6113),a=i(91389),h=i(90664),l=new s({Extends:n,initialize:function(t){n.call(this,t,null,!1),this.active=!1,this.easeName="Linear",this.r=[],this.g=[],this.b=[]},getMethod:function(){return null===this.propertyValue?0:9},setMethods:function(){var t=this.propertyValue,e=t,i=this.defaultEmit,s=this.defaultUpdate;if(9===this.method){this.start=t[0],this.ease=o("Linear"),this.interpolation=a("linear"),i=this.easedValueEmit,s=this.easeValueUpdate,e=t[0],this.active=!0;for(var n=0;n{var s=i(30976),n=i(45319),r=i(83419),o=i(99472),a=i(6113),h=i(95540),l=i(91389),u=i(77720),c=i(15994),d=new r({initialize:function(t,e,i){void 0===i&&(i=!1),this.propertyKey=t,this.propertyValue=e,this.defaultValue=e,this.steps=0,this.counter=0,this.yoyo=!1,this.direction=0,this.start=0,this.current=0,this.end=0,this.ease=null,this.interpolation=null,this.emitOnly=i,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.active=!0,this.method=0,this._onEmit,this._onUpdate},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=h(t,this.propertyKey,this.defaultValue),this.method=this.getMethod(),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return JSON.stringify(this.propertyValue)},onChange:function(t){var e;switch(this.method){case 1:case 3:case 8:e=t;break;case 2:this.propertyValue.indexOf(t)>=0&&(e=t);break;case 4:var i=(this.end-this.start)/this.steps;e=u(t,i),this.counter=e;break;case 5:case 6:case 7:e=n(t,this.start,this.end);break;case 9:e=this.start[0]}return this.current=e,this},getMethod:function(){var t=this.propertyValue;if(null===t)return 0;var e=typeof t;if("number"===e)return 1;if(Array.isArray(t))return 2;if("function"===e)return 3;if("object"===e){if(this.hasBoth(t,"start","end"))return this.has(t,"steps")?4:5;if(this.hasBoth(t,"min","max"))return 6;if(this.has(t,"random"))return 7;if(this.hasEither(t,"onEmit","onUpdate"))return 8;if(this.hasEither(t,"values","interpolation"))return 9}return 0},setMethods:function(){var t=this.propertyValue,e=t,i=this.defaultEmit,s=this.defaultUpdate;switch(this.method){case 1:i=this.staticValueEmit;break;case 2:i=this.randomStaticValueEmit,e=t[0];break;case 3:this._onEmit=t,i=this.proxyEmit;break;case 4:this.start=t.start,this.end=t.end,this.steps=t.steps,this.counter=this.start,this.yoyo=!!this.has(t,"yoyo")&&t.yoyo,this.direction=0,i=this.steppedEmit,e=this.start;break;case 5:this.start=t.start,this.end=t.end;var n=this.has(t,"ease")?t.ease:"Linear";this.ease=a(n,t.easeParams),i=this.has(t,"random")&&t.random?this.randomRangedValueEmit:this.easedValueEmit,s=this.easeValueUpdate,e=this.start;break;case 6:this.start=t.min,this.end=t.max,i=this.has(t,"int")&&t.int?this.randomRangedIntEmit:this.randomRangedValueEmit,e=this.start;break;case 7:var r=t.random;Array.isArray(r)&&(this.start=r[0],this.end=r[1]),i=this.randomRangedIntEmit,e=this.start;break;case 8:this._onEmit=this.has(t,"onEmit")?t.onEmit:this.defaultEmit,this._onUpdate=this.has(t,"onUpdate")?t.onUpdate:this.defaultUpdate,i=this.proxyEmit,s=this.proxyUpdate;break;case 9:this.start=t.values;var o=this.has(t,"ease")?t.ease:"Linear";this.ease=a(o,t.easeParams),this.interpolation=l(t.interpolation),i=this.easedValueEmit,s=this.easeValueUpdate,e=this.start[0]}return this.onEmit=i,this.onUpdate=s,this.current=e,this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,s){return s},proxyEmit:function(t,e,i){var s=this._onEmit(t,e,i);return this.current=s,s},proxyUpdate:function(t,e,i,s){var n=this._onUpdate(t,e,i,s);return this.current=n,n},staticValueEmit:function(){return this.current},staticValueUpdate:function(){return this.current},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.current=this.propertyValue[t],this.current},randomRangedValueEmit:function(t,e){var i=o(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i,t.data[e].max=this.end),this.current=i,i},randomRangedIntEmit:function(t,e){var i=s(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i,t.data[e].max=this.end),this.current=i,i},steppedEmit:function(){var t,e=this.counter,i=e,s=(this.end-this.start)/this.steps;return this.yoyo?(0===this.direction?(i+=s)>=this.end&&(t=i-this.end,i=this.end-t,this.direction=1):(i-=s)<=this.start&&(t=this.start-i,i=this.start+t,this.direction=0),this.counter=i):this.counter=c(i+s,this.start,this.end),this.current=e,e},easedValueEmit:function(t,e){if(t&&t.data[e]){var i=t.data[e];i.min=this.start,i.max=this.end}return this.current=this.start,this.start},easeValueUpdate:function(t,e,i){var s,n=t.data[e],r=this.ease(i);return s=this.interpolation?this.interpolation(this.start,r):(n.max-n.min)*r+n.min,this.current=s,s},destroy:function(){this.propertyValue=null,this.defaultValue=null,this.ease=null,this.interpolation=null,this._onEmit=null,this._onUpdate=null}});t.exports=d},24502:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(20286),o=new s({Extends:r,initialize:function(t,e,i,s,o){if("object"==typeof t){var a=t;t=n(a,"x",0),e=n(a,"y",0),i=n(a,"power",0),s=n(a,"epsilon",100),o=n(a,"gravity",50)}else void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=100),void 0===o&&(o=50);r.call(this,t,e,!0),this._gravity=o,this._power=i*o,this._epsilon=s*s},update:function(t,e){var i=this.x-t.x,s=this.y-t.y,n=i*i+s*s;if(0!==n){var r=Math.sqrt(n);n{var s=i(9674),n=i(45319),r=i(83419),o=i(39506),a=i(87841),h=i(11520),l=i(26099),u=new r({initialize:function(t){this.emitter=t,this.texture=null,this.frame=null,this.x=0,this.y=0,this.worldPosition=new l,this.velocityX=0,this.velocityY=0,this.accelerationX=0,this.accelerationY=0,this.maxVelocityX=1e4,this.maxVelocityY=1e4,this.bounce=0,this.scaleX=1,this.scaleY=1,this.alpha=1,this.angle=0,this.rotation=0,this.tint=16777215,this.life=1e3,this.lifeCurrent=1e3,this.delayCurrent=0,this.holdCurrent=0,this.lifeT=0,this.data={tint:{min:16777215,max:16777215},alpha:{min:1,max:1},rotate:{min:0,max:0},scaleX:{min:1,max:1},scaleY:{min:1,max:1},x:{min:0,max:0},y:{min:0,max:0},accelerationX:{min:0,max:0},accelerationY:{min:0,max:0},maxVelocityX:{min:0,max:0},maxVelocityY:{min:0,max:0},moveToX:{min:0,max:0},moveToY:{min:0,max:0},bounce:{min:0,max:0}},this.isCropped=!1,this.scene=t.scene,this.anims=new s(this),this.bounds=new a},emit:function(t,e,i,s,n,r){return this.emitter.emit(t,e,i,s,n,r)},isAlive:function(){return this.lifeCurrent>0},kill:function(){this.lifeCurrent=0},setPosition:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e},fire:function(t,e){var i=this.emitter,s=i.ops,n=i.getAnim();if(n?this.anims.play(n):(this.frame=i.getFrame(),this.texture=this.frame.texture),!this.frame)throw new Error("Particle has no texture frame");if(i.getEmitZone(this),void 0===t?this.x+=s.x.onEmit(this,"x"):s.x.steps>0?this.x+=t+s.x.onEmit(this,"x"):this.x+=t,void 0===e?this.y+=s.y.onEmit(this,"y"):s.y.steps>0?this.y+=e+s.y.onEmit(this,"y"):this.y+=e,this.life=s.lifespan.onEmit(this,"lifespan"),this.lifeCurrent=this.life,this.lifeT=0,this.delayCurrent=s.delay.onEmit(this,"delay"),this.holdCurrent=s.hold.onEmit(this,"hold"),this.scaleX=s.scaleX.onEmit(this,"scaleX"),this.scaleY=s.scaleY.active?s.scaleY.onEmit(this,"scaleY"):this.scaleX,this.angle=s.rotate.onEmit(this,"rotate"),this.rotation=o(this.angle),i.worldMatrix.transformPoint(this.x,this.y,this.worldPosition),0===this.delayCurrent&&i.getDeathZone(this))return this.lifeCurrent=0,!1;var r=s.speedX.onEmit(this,"speedX"),a=s.speedY.active?s.speedY.onEmit(this,"speedY"):r;if(i.radial){var h=o(s.angle.onEmit(this,"angle"));this.velocityX=Math.cos(h)*Math.abs(r),this.velocityY=Math.sin(h)*Math.abs(a)}else if(i.moveTo){var l=s.moveToX.onEmit(this,"moveToX"),u=s.moveToY.onEmit(this,"moveToY"),c=this.life/1e3;this.velocityX=(l-this.x)/c,this.velocityY=(u-this.y)/c}else this.velocityX=r,this.velocityY=a;return i.acceleration&&(this.accelerationX=s.accelerationX.onEmit(this,"accelerationX"),this.accelerationY=s.accelerationY.onEmit(this,"accelerationY")),this.maxVelocityX=s.maxVelocityX.onEmit(this,"maxVelocityX"),this.maxVelocityY=s.maxVelocityY.onEmit(this,"maxVelocityY"),this.bounce=s.bounce.onEmit(this,"bounce"),this.alpha=s.alpha.onEmit(this,"alpha"),s.color.active?this.tint=s.color.onEmit(this,"tint"):this.tint=s.tint.onEmit(this,"tint"),!0},update:function(t,e,i){if(this.lifeCurrent<=0)return!(this.holdCurrent>0)||(this.holdCurrent-=t,this.holdCurrent<=0);if(this.delayCurrent>0)return this.delayCurrent-=t,!1;this.anims.update(0,t);var s=this.emitter,r=s.ops,a=1-this.lifeCurrent/this.life;if(this.lifeT=a,this.x=r.x.onUpdate(this,"x",a,this.x),this.y=r.y.onUpdate(this,"y",a,this.y),s.moveTo){var h=r.moveToX.onUpdate(this,"moveToX",a,s.moveToX),l=r.moveToY.onUpdate(this,"moveToY",a,s.moveToY),u=this.lifeCurrent/1e3;this.velocityX=(h-this.x)/u,this.velocityY=(l-this.y)/u}return this.computeVelocity(s,t,e,i,a),this.scaleX=r.scaleX.onUpdate(this,"scaleX",a,this.scaleX),r.scaleY.active?this.scaleY=r.scaleY.onUpdate(this,"scaleY",a,this.scaleY):this.scaleY=this.scaleX,this.angle=r.rotate.onUpdate(this,"rotate",a,this.angle),this.rotation=o(this.angle),s.getDeathZone(this)?(this.lifeCurrent=0,!0):(this.alpha=n(r.alpha.onUpdate(this,"alpha",a,this.alpha),0,1),r.color.active?this.tint=r.color.onUpdate(this,"color",a,this.tint):this.tint=r.tint.onUpdate(this,"tint",a,this.tint),this.lifeCurrent-=t,this.lifeCurrent<=0&&this.holdCurrent<=0)},computeVelocity:function(t,e,i,s,r){var o=t.ops,a=this.velocityX,h=this.velocityY,l=o.accelerationX.onUpdate(this,"accelerationX",r,this.accelerationX),u=o.accelerationY.onUpdate(this,"accelerationY",r,this.accelerationY),c=o.maxVelocityX.onUpdate(this,"maxVelocityX",r,this.maxVelocityX),d=o.maxVelocityY.onUpdate(this,"maxVelocityY",r,this.maxVelocityY);this.bounce=o.bounce.onUpdate(this,"bounce",r,this.bounce),a+=t.gravityX*i+l*i,h+=t.gravityY*i+u*i,a=n(a,-c,c),h=n(h,-d,d),this.velocityX=a,this.velocityY=h,this.x+=a*i,this.y+=h*i,t.worldMatrix.transformPoint(this.x,this.y,this.worldPosition);for(var f=0;f{var s=i(83419),n=i(20286),r=i(87841),o=new s({Extends:n,initialize:function(t,e,i,s,o,a,h,l){void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===h&&(h=!0),void 0===l&&(l=!0),n.call(this,t,e,!0),this.bounds=new r(t,e,i,s),this.collideLeft=o,this.collideRight=a,this.collideTop=h,this.collideBottom=l},update:function(t){var e=this.bounds,i=-t.bounce,s=t.worldPosition;s.xe.right&&this.collideRight&&(t.x-=s.x-e.right,t.velocityX*=i),s.ye.bottom&&this.collideBottom&&(t.y-=s.y-e.bottom,t.velocityY*=i)}});t.exports=o},31600:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(53774),o=i(43459),a=i(26388),h=i(19909),l=i(76472),u=i(44777),c=i(20696),d=i(95643),f=i(95540),p=i(26546),v=i(24502),g=i(1985),m=i(97022),y=i(86091),x=i(73162),T=i(20074),w=i(56480),b=i(68875),S=i(87841),E=i(59996),A=i(72905),C=i(90668),_=i(19186),M=i(61340),P=i(26099),R=i(15994),L=i(69601),O=["active","advance","blendMode","colorEase","deathCallback","deathCallbackScope","duration","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxAliveParticles","maxParticles","name","emitting","particleBringToTop","particleClass","radial","sortCallback","sortOrderAsc","sortProperty","stopAfter","tintFill","timeScale","trackVisible","visible"],F=["accelerationX","accelerationY","alpha","angle","bounce","color","delay","hold","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],D=new s({Extends:d,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.Mask,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Texture,n.Transform,n.Visible,C],initialize:function(t,e,i,s,n){d.call(this,t,"ParticleEmitter"),this.particleClass=w,this.ops={accelerationX:new u("accelerationX",0),accelerationY:new u("accelerationY",0),alpha:new u("alpha",1),angle:new u("angle",{min:0,max:360},!0),bounce:new u("bounce",0),color:new l("color"),delay:new u("delay",0,!0),hold:new u("hold",0,!0),lifespan:new u("lifespan",1e3,!0),maxVelocityX:new u("maxVelocityX",1e4),maxVelocityY:new u("maxVelocityY",1e4),moveToX:new u("moveToX",0),moveToY:new u("moveToY",0),quantity:new u("quantity",1,!0),rotate:new u("rotate",0),scaleX:new u("scaleX",1),scaleY:new u("scaleY",1),speedX:new u("speedX",0,!0),speedY:new u("speedY",0,!0),tint:new u("tint",16777215),x:new u("x",0),y:new u("y",0)},this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.moveTo=!1,this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.maxAliveParticles=0,this.stopAfter=0,this.duration=0,this.frequency=0,this.emitting=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZones=[],this.deathZones=[],this.viewBounds=null,this.follow=null,this.followOffset=new P,this.trackVisible=!1,this.frames=[],this.randomFrame=!0,this.frameQuantity=1,this.anims=[],this.randomAnim=!0,this.animQuantity=1,this.dead=[],this.alive=[],this.counters=new Float32Array(10),this.skipping=!1,this.worldMatrix=new M,this.sortProperty="",this.sortOrderAsc=!0,this.sortCallback=this.depthSortCallback,this.processors=new x(this),this.tintFill=!1,this.initPipeline(),this.initPostPipeline(),this.setPosition(e,i),this.setTexture(s),n&&this.setConfig(n)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},setConfig:function(t){if(!t)return this;var e=0,i="",s=this.ops;for(e=0;e=this.animQuantity&&(this.animCounter=0,this.currentAnim=R(this.currentAnim+1,0,e)),i},setAnim:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=1),this.randomAnim=e,this.animQuantity=i,this.currentAnim=0;var s=typeof t;if(this.anims.length=0,Array.isArray(t))this.anims=this.anims.concat(t);else if("string"===s)this.anims.push(t);else if("object"===s){var n=t;(t=f(n,"anims",null))&&(this.anims=this.anims.concat(t));var r=f(n,"cycle",!1);this.randomAnim=!r,this.animQuantity=f(n,"quantity",i)}return 1===this.anims.length&&(this.animQuantity=1,this.randomAnim=!1),this},setRadial:function(t){return void 0===t&&(t=!0),this.radial=t,this},addParticleBounds:function(t,e,i,s,n,r,o,a){if("object"==typeof t){var h=t;t=h.x,e=h.y,i=m(h,"w")?h.w:h.width,s=m(h,"h")?h.h:h.height}return this.addParticleProcessor(new L(t,e,i,s,n,r,o,a))},setParticleSpeed:function(t,e){return void 0===e&&(e=t),this.ops.speedX.onChange(t),t===e?this.ops.speedY.active=!1:this.ops.speedY.onChange(e),this.radial=!0,this},setParticleScale:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.ops.scaleX.onChange(t),this.ops.scaleY.onChange(e),this},setParticleGravity:function(t,e){return this.gravityX=t,this.gravityY=e,this},setParticleAlpha:function(t){return this.ops.alpha.onChange(t),this},setParticleTint:function(t){return this.ops.tint.onChange(t),this},setEmitterAngle:function(t){return this.ops.angle.onChange(t),this},setParticleLifespan:function(t){return this.ops.lifespan.onChange(t),this},setQuantity:function(t){return this.quantity=t,this},setFrequency:function(t,e){return this.frequency=t,this.flowCounter=t>0?t:0,e&&(this.quantity=e),this},addDeathZone:function(t){var e;Array.isArray(t)||(t=[t]);for(var i=[],s=0;s-1&&(this.zoneTotal++,this.zoneTotal===s.total&&(this.zoneTotal=0,this.zoneIndex++,this.zoneIndex===i&&(this.zoneIndex=0)))}},getDeathZone:function(t){for(var e=this.deathZones,i=0;i=0&&(this.zoneIndex=e),this},addParticleProcessor:function(t){return this.processors.exists(t)||(t.emitter&&t.emitter.removeParticleProcessor(t),this.processors.add(t),t.emitter=this),t},removeParticleProcessor:function(t){return this.processors.exists(t)&&(this.processors.remove(t,!0),t.emitter=null),t},getProcessors:function(){return this.processors.getAll("active",!0)},createGravityWell:function(t){return this.addParticleProcessor(new v(t))},reserve:function(t){var e=this.dead;if(this.maxParticles>0){var i=this.getParticleCount();i+t>this.maxParticles&&(t=this.maxParticles-(i+t))}for(var s=0;s0&&this.getParticleCount()>=this.maxParticles||this.maxAliveParticles>0&&this.getAliveParticleCount()>=this.maxAliveParticles},onParticleEmit:function(t,e){return void 0===t?(this.emitCallback=null,this.emitCallbackScope=null):"function"==typeof t&&(this.emitCallback=t,e&&(this.emitCallbackScope=e)),this},onParticleDeath:function(t,e){return void 0===t?(this.deathCallback=null,this.deathCallbackScope=null):"function"==typeof t&&(this.deathCallback=t,e&&(this.deathCallbackScope=e)),this},killAll:function(){for(var t=this.dead,e=this.alive;e.length>0;)t.push(e.pop());return this},forEachAlive:function(t,e){for(var i=this.alive,s=i.length,n=0;n0&&this.fastForward(t),this.emitting=!0,this.resetCounters(this.frequency,!0),void 0!==e&&(this.duration=Math.abs(e)),this.emit(c.START,this)),this},stop:function(t){return void 0===t&&(t=!1),this.emitting&&(this.emitting=!1,t&&this.killAll(),this.emit(c.STOP,this)),this},pause:function(){return this.active=!1,this},resume:function(){return this.active=!0,this},setSortProperty:function(t,e){return void 0===t&&(t=""),void 0===e&&(e=this.true),this.sortProperty=t,this.sortOrderAsc=e,this.sortCallback=this.depthSortCallback,this},setSortCallback:function(t){return t=""!==this.sortProperty?this.depthSortCallback:null,this.sortCallback=t,this},depthSort:function(){return _(this.alive,this.sortCallback.bind(this)),this},depthSortCallback:function(t,e){var i=this.sortProperty;return this.sortOrderAsc?t[i]-e[i]:e[i]-t[i]},flow:function(t,e,i){return void 0===e&&(e=1),this.emitting=!1,this.frequency=t,this.quantity=e,void 0!==i&&(this.stopAfter=i),this.start()},explode:function(t,e,i){this.frequency=-1,this.resetCounters(-1,!0);var s=this.emitParticle(t,e,i);return this.emit(c.EXPLODE,this,s),s},emitParticleAt:function(t,e,i){return this.emitParticle(i,t,e)},emitParticle:function(t,e,i){if(!this.atLimit()){void 0===t&&(t=this.ops.quantity.onEmit());for(var s=this.dead,n=this.stopAfter,r=this.follow?this.follow.x+this.followOffset.x:e,o=this.follow?this.follow.y+this.followOffset.y:i,a=0;a0&&(this.stopCounter++,this.stopCounter>=n))break;if(this.atLimit())break}return h}},fastForward:function(t,e){void 0===e&&(e=1e3/60);var i=0;for(this.skipping=!0;i0){var u=this.deathCallback,d=this.deathCallbackScope;for(o=h-1;o>=0;o--){var f=a[o];n.splice(f.index,1),r.push(f.particle),u&&u.call(d,f.particle),f.particle.setPosition()}}if(this.emitting||this.skipping){if(0===this.frequency)this.emitParticle();else if(this.frequency>0)for(this.flowCounter-=e;this.flowCounter<=0;)this.emitParticle(),this.flowCounter+=this.frequency;this.skipping||(this.duration>0&&(this.elapsed+=e,this.elapsed>=this.duration&&this.stop()),this.stopAfter>0&&this.stopCounter>=this.stopAfter&&this.stop())}else 1===this.completeFlag&&0===n.length&&(this.completeFlag=0,this.emit(c.COMPLETE,this))},overlap:function(t){for(var e=this.getWorldTransformMatrix(),i=this.alive,s=i.length,n=[],r=0;r0){var u=0;for(this.skipping=!0;u0&&y(s,t,t),s},createEmitter:function(){throw new Error("createEmitter removed. See ParticleEmitter docs for info")},particleX:{get:function(){return this.ops.x.current},set:function(t){this.ops.x.onChange(t)}},particleY:{get:function(){return this.ops.y.current},set:function(t){this.ops.y.onChange(t)}},accelerationX:{get:function(){return this.ops.accelerationX.current},set:function(t){this.ops.accelerationX.onChange(t)}},accelerationY:{get:function(){return this.ops.accelerationY.current},set:function(t){this.ops.accelerationY.onChange(t)}},maxVelocityX:{get:function(){return this.ops.maxVelocityX.current},set:function(t){this.ops.maxVelocityX.onChange(t)}},maxVelocityY:{get:function(){return this.ops.maxVelocityY.current},set:function(t){this.ops.maxVelocityY.onChange(t)}},speed:{get:function(){return this.ops.speedX.current},set:function(t){this.ops.speedX.onChange(t),this.ops.speedY.onChange(t)}},speedX:{get:function(){return this.ops.speedX.current},set:function(t){this.ops.speedX.onChange(t)}},speedY:{get:function(){return this.ops.speedY.current},set:function(t){this.ops.speedY.onChange(t)}},moveToX:{get:function(){return this.ops.moveToX.current},set:function(t){this.ops.moveToX.onChange(t)}},moveToY:{get:function(){return this.ops.moveToY.current},set:function(t){this.ops.moveToY.onChange(t)}},bounce:{get:function(){return this.ops.bounce.current},set:function(t){this.ops.bounce.onChange(t)}},particleScaleX:{get:function(){return this.ops.scaleX.current},set:function(t){this.ops.scaleX.onChange(t)}},particleScaleY:{get:function(){return this.ops.scaleY.current},set:function(t){this.ops.scaleY.onChange(t)}},particleColor:{get:function(){return this.ops.color.current},set:function(t){this.ops.color.onChange(t)}},colorEase:{get:function(){return this.ops.color.easeName},set:function(t){this.ops.color.setEase(t)}},particleTint:{get:function(){return this.ops.tint.current},set:function(t){this.ops.tint.onChange(t)}},particleAlpha:{get:function(){return this.ops.alpha.current},set:function(t){this.ops.alpha.onChange(t)}},lifespan:{get:function(){return this.ops.lifespan.current},set:function(t){this.ops.lifespan.onChange(t)}},particleAngle:{get:function(){return this.ops.angle.current},set:function(t){this.ops.angle.onChange(t)}},particleRotate:{get:function(){return this.ops.rotate.current},set:function(t){this.ops.rotate.onChange(t)}},quantity:{get:function(){return this.ops.quantity.current},set:function(t){this.ops.quantity.onChange(t)}},delay:{get:function(){return this.ops.delay.current},set:function(t){this.ops.delay.onChange(t)}},hold:{get:function(){return this.ops.hold.current},set:function(t){this.ops.hold.onChange(t)}},flowCounter:{get:function(){return this.counters[0]},set:function(t){this.counters[0]=t}},frameCounter:{get:function(){return this.counters[1]},set:function(t){this.counters[1]=t}},animCounter:{get:function(){return this.counters[2]},set:function(t){this.counters[2]=t}},elapsed:{get:function(){return this.counters[3]},set:function(t){this.counters[3]=t}},stopCounter:{get:function(){return this.counters[4]},set:function(t){this.counters[4]=t}},completeFlag:{get:function(){return this.counters[5]},set:function(t){this.counters[5]=t}},zoneIndex:{get:function(){return this.counters[6]},set:function(t){this.counters[6]=t}},zoneTotal:{get:function(){return this.counters[7]},set:function(t){this.counters[7]=t}},currentFrame:{get:function(){return this.counters[8]},set:function(t){this.counters[8]=t}},currentAnim:{get:function(){return this.counters[9]},set:function(t){this.counters[9]=t}},preDestroy:function(){var t;this.texture=null,this.frames=null,this.anims=null,this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.emitZones=null,this.deathZones=null,this.bounds=null,this.follow=null,this.counters=null;var e=this.ops;for(t=0;t{var s=i(59996),n=i(61340),r=new n,o=new n,a=new n,h=new n;t.exports=function(t,e,i,n){var l=r,u=o,c=a,d=h;n?(d.loadIdentity(),d.multiply(n),d.translate(e.x,e.y),d.rotate(e.rotation),d.scale(e.scaleX,e.scaleY)):d.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);var f=t.currentContext,p=i.roundPixels,v=i.alpha,g=e.alpha,m=e.alive,y=m.length,x=e.viewBounds;if(e.visible&&0!==y&&(!x||s(x,i.worldView))){e.sortCallback&&e.depthSort(),i.addToRenderList(e);var T=e.scrollFactorX,w=e.scrollFactorY;f.save(),f.globalCompositeOperation=t.blendModes[e.blendMode];for(var b=0;b0&&C.height>0){var _=-A.halfWidth,M=-A.halfHeight;f.globalAlpha=E,f.save(),u.setToContext(f),p&&(_=Math.round(_),M=Math.round(M)),f.imageSmoothingEnabled=!A.source.scaleMode,f.drawImage(A.source.image,C.x,C.y,C.width,C.height,_,M,C.width,C.height),f.restore()}}}f.restore()}}},92730:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(95540),a=i(31600);n.register("particles",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=o(t,"config",null),h=new a(this.scene,0,0,i);return void 0!==e&&(t.add=e),s(this.scene,h,t),n&&h.setConfig(n),h}))},676:(t,e,i)=>{var s=i(39429),n=i(31600);s.register("particles",(function(t,e,i,s){return void 0!==t&&"string"==typeof t&&console.warn("ParticleEmitterManager was removed in Phaser 3.60. See documentation for details"),this.displayList.add(new n(this.scene,t,e,i,s))}))},90668:(t,e,i)=>{var s,n;i(29747),s=i(21188),n=i(9871),t.exports={renderWebGL:s,renderCanvas:n}},21188:(t,e,i)=>{var s=i(59996),n=i(61340),r=i(70554),o=new n,a=new n,h=new n,l=new n;t.exports=function(t,e,i,n){var u=t.pipelines.set(e.pipeline),c=o,d=a,f=h,p=l;n?(p.loadIdentity(),p.multiply(n),p.translate(e.x,e.y),p.rotate(e.rotation),p.scale(e.scaleX,e.scaleY)):p.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY);var v=r.getTintAppendFloatAlpha,g=i.alpha,m=e.alpha;t.pipelines.preBatch(e);var y=e.alive,x=y.length,T=e.viewBounds;if(0!==x&&(!T||s(T,i.worldView))){e.sortCallback&&e.depthSort(),i.addToRenderList(e),c.copyFrom(i.matrix),c.multiplyWithOffset(p,-i.scrollX*e.scrollFactorX,-i.scrollY*e.scrollFactorY),t.setBlendMode(e.blendMode),e.mask&&(e.mask.preRenderWebGL(t,e,i),t.pipelines.set(e.pipeline));for(var w,b,S=e.tintFill,E=0;E{var s=new(i(83419))({initialize:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=!0),this.emitter,this.x=t,this.y=e,this.active=i},update:function(){},destroy:function(){this.emitter=null}});t.exports=s},9774:t=>{t.exports="complete"},812:t=>{t.exports="deathzone"},30522:t=>{t.exports="explode"},96695:t=>{t.exports="start"},18677:t=>{t.exports="stop"},20696:(t,e,i)=>{t.exports={COMPLETE:i(9774),DEATH_ZONE:i(812),EXPLODE:i(30522),START:i(96695),STOP:i(18677)}},18404:(t,e,i)=>{t.exports={EmitterColorOp:i(76472),EmitterOp:i(44777),Events:i(20696),GravityWell:i(24502),Particle:i(56480),ParticleBounds:i(69601),ParticleEmitter:i(31600),ParticleProcessor:i(20286),Zones:i(21024)}},26388:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e){this.source=t,this.killOnEnter=e},willKill:function(t){var e=t.worldPosition,i=this.source.contains(e.x,e.y);return i&&this.killOnEnter||!i&&!this.killOnEnter}});t.exports=s},19909:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s,n,r){void 0===s&&(s=!1),void 0===n&&(n=!0),void 0===r&&(r=-1),this.source=t,this.points=[],this.quantity=e,this.stepRate=i,this.yoyo=s,this.counter=-1,this.seamless=n,this._length=0,this._direction=0,this.total=r,this.updateSource()},updateSource:function(){if(this.points=this.source.getPoints(this.quantity,this.stepRate),this.seamless){var t=this.points[0],e=this.points[this.points.length-1];t.x===e.x&&t.y===e.y&&this.points.pop()}var i=this._length;return this._length=this.points.length,this._lengththis._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=s},68875:(t,e,i)=>{var s=i(83419),n=i(26099),r=new s({initialize:function(t){this.source=t,this._tempVec=new n,this.total=-1},getPoint:function(t){var e=this._tempVec;this.source.getRandomPoint(e),t.x=e.x,t.y=e.y}});t.exports=r},21024:(t,e,i)=>{t.exports={DeathZone:i(26388),EdgeZone:i(19909),RandomZone:i(68875)}},1159:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(68287),o=new s({Extends:r,Mixins:[n.PathFollower],initialize:function(t,e,i,s,n,o){r.call(this,t,i,s,n,o),this.path=e},preUpdate:function(t,e){this.anims.update(t,e),this.pathUpdate(t)}});t.exports=o},90145:(t,e,i)=>{var s=i(39429),n=i(1159);s.register("follower",(function(t,e,i,s,r){var o=new n(this.scene,t,e,i,s,r);return this.displayList.add(o),this.updateList.add(o),o}))},33663:(t,e,i)=>{var s=i(9674),n=i(83419),r=i(48803),o=i(90664),a=i(4703),h=i(45650),l=new n({Extends:a,initialize:function(t,e,i,n,r,o,h,l){n||(n="__DEFAULT"),a.call(this,t,e,i,n,r),this.type="Plane",this.anims=new s(this),this.gridWidth,this.gridHeight,this.isTiled,this._checkerboard=null,this.hideCCW=!1,this.setGridSize(o,h,l),this.setSizeToFrame(!1),this.setViewHeight()},originX:{get:function(){return.5}},originY:{get:function(){return.5}},setGridSize:function(t,e,i){void 0===t&&(t=8),void 0===e&&(e=8),void 0===i&&(i=!1);var s=!1;return i&&(s=!0),this.gridWidth=t,this.gridHeight=e,this.isTiled=i,this.clear(),r({mesh:this,widthSegments:t,heightSegments:e,isOrtho:!1,tile:i,flipY:s}),this},setSizeToFrame:function(t){void 0===t&&(t=!0);var e=this.frame;if(this.setPerspective(this.width/e.width,this.height/e.height),this._checkerboard&&this._checkerboard!==this.texture&&this.removeCheckerboard(),!t)return this;var i,s,n=this.gridWidth,r=this.gridHeight,o=this.vertices,a=e.u0,h=e.u1,l=e.v0,u=e.v1,c=0;if(this.isTiled)for(l=e.v1,u=e.v0,s=0;s7&&c>7?l.push(r.r,r.g,r.b,i):l.push(a.r,a.g,a.b,s);var d=this.scene.sys.textures.addUint8Array(h(),new Uint8Array(l),16,16);return this.removeCheckerboard(),this.setTexture(d),this.setSizeToFrame(),this.setViewHeight(n),this},removeCheckerboard:function(){this._checkerboard&&(this._checkerboard.destroy(),this._checkerboard=null)},play:function(t,e){return this.anims.play(t,e)},playReverse:function(t,e){return this.anims.playReverse(t,e)},playAfterDelay:function(t,e){return this.anims.playAfterDelay(t,e)},playAfterRepeat:function(t,e){return this.anims.playAfterRepeat(t,e)},stop:function(){return this.anims.stop()},stopAfterDelay:function(t){return this.anims.stopAfterDelay(t)},stopAfterRepeat:function(t){return this.anims.stopAfterRepeat(t)},stopOnFrame:function(t){return this.anims.stopOnFrame(t)},preUpdate:function(t,e){a.prototype.preUpdate.call(this,t,e),this.anims.update(t,e)},preDestroy:function(){this.clear(),this.removeCheckerboard(),this.anims.destroy(),this.anims=void 0,this.debugCallback=null,this.debugGraphic=null}});t.exports=l},56015:(t,e,i)=>{var s=i(25305),n=i(13059),r=i(44603),o=i(23568),a=i(35154),h=i(33663);r.register("plane",(function(t,e){void 0===t&&(t={});var i=o(t,"key",null),r=o(t,"frame",null),l=a(t,"width",8),u=a(t,"height",8),c=a(t,"tile",!1),d=new h(this.scene,0,0,i,r,l,u,c);void 0!==e&&(t.add=e);var f=a(t,"checkerboard",null);if(f){var p=a(f,"color1",16777215),v=a(f,"color2",255),g=a(f,"alpha1",255),m=a(f,"alpha2",255),y=a(f,"height",128);d.createCheckerboard(p,v,g,m,y)}return s(this.scene,d,t),n(d,t),d}))},30985:(t,e,i)=>{var s=i(33663);i(39429).register("plane",(function(t,e,i,n,r,o,a){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a))}))},80321:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(95643),o=i(30100),a=i(36060),h=i(67277),l=new s({Extends:r,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.Mask,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Transform,n.Visible,h],initialize:function(t,e,i,s,n,h,l){void 0===s&&(s=16777215),void 0===n&&(n=128),void 0===h&&(h=1),void 0===l&&(l=.1),r.call(this,t,"PointLight"),this.initPipeline(a.POINTLIGHT_PIPELINE),this.initPostPipeline(),this.setPosition(e,i),this.color=o(s),this.intensity=h,this.attenuation=l,this.width=2*n,this.height=2*n,this._radius=n},radius:{get:function(){return this._radius},set:function(t){this._radius=t,this.width=2*t,this.height=2*t}},originX:{get:function(){return.5}},originY:{get:function(){return.5}},displayOriginX:{get:function(){return this._radius}},displayOriginY:{get:function(){return this._radius}}});t.exports=l},39829:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(80321);n.register("pointlight",(function(t,e){void 0===t&&(t={});var i=r(t,"color",16777215),n=r(t,"radius",128),a=r(t,"intensity",1),h=r(t,"attenuation",.1),l=new o(this.scene,0,0,i,n,a,h);return void 0!==e&&(t.add=e),s(this.scene,l,t),l}))},71255:(t,e,i)=>{var s=i(39429),n=i(80321);s.register("pointlight",(function(t,e,i,s,r,o){return this.displayList.add(new n(this.scene,t,e,i,s,r,o))}))},67277:(t,e,i)=>{var s,n=i(29747);s=i(57787),t.exports={renderWebGL:s,renderCanvas:n}},57787:(t,e,i)=>{var s=i(91296);t.exports=function(t,e,i,n){i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),o=s(e,i,n).calc,a=e.width,h=e.height,l=-e._radius,u=-e._radius,c=l+a,d=u+h,f=o.getX(0,0),p=o.getY(0,0),v=o.getX(l,u),g=o.getY(l,u),m=o.getX(l,d),y=o.getY(l,d),x=o.getX(c,d),T=o.getY(c,d),w=o.getX(c,u),b=o.getY(c,u);t.pipelines.preBatch(e),r.batchPointLight(e,i,v,g,m,y,x,T,w,b,f,p),t.pipelines.postBatch(e)}},591:(t,e,i)=>{var s=i(83419),n=i(81320),r=i(88571),o=new s({Extends:r,initialize:function(t,e,i,s,o){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=32),void 0===o&&(o=32);var a=new n(t.sys.textures,"",s,o);r.call(this,t,e,i,a),this.type="RenderTexture",this.camera=this.texture.camera,this._saved=!1},setSize:function(t,e){this.width=t,this.height=e,this.texture.setSize(t,e),this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this},resize:function(t,e){return this.setSize(t,e),this},saveTexture:function(t){var e=this.texture;return e.key=t,e.manager.addDynamicTexture(e)&&(this._saved=!0),e},fill:function(t,e,i,s,n,r){return this.texture.fill(t,e,i,s,n,r),this},clear:function(){return this.texture.clear(),this},stamp:function(t,e,i,s,n){return this.texture.stamp(t,e,i,s,n),this},erase:function(t,e,i){return this.texture.erase(t,e,i),this},draw:function(t,e,i,s,n){return this.texture.draw(t,e,i,s,n),this},drawFrame:function(t,e,i,s,n,r){return this.texture.drawFrame(t,e,i,s,n,r),this},repeat:function(t,e,i,s,n,r,o,a,h){return this.texture.repeat(t,e,i,s,n,r,o,a,h),this},beginDraw:function(){return this.texture.beginDraw(),this},batchDraw:function(t,e,i,s,n){return this.texture.batchDraw(t,e,i,s,n),this},batchDrawFrame:function(t,e,i,s,n,r){return this.texture.batchDrawFrame(t,e,i,s,n,r),this},endDraw:function(t){return this.texture.endDraw(t),this},snapshotArea:function(t,e,i,s,n,r,o){return this.texture.snapshotArea(t,e,i,s,n,r,o),this},snapshot:function(t,e,i){return this.snapshotArea(0,0,this.width,this.height,t,e,i)},snapshotPixel:function(t,e,i){return this.snapshotArea(t,e,1,1,i,"pixel")},preDestroy:function(){this.camera=null,this._saved||this.texture.destroy()}});t.exports=o},34495:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(591);n.register("renderTexture",(function(t,e){void 0===t&&(t={});var i=r(t,"x",0),n=r(t,"y",0),a=r(t,"width",32),h=r(t,"height",32),l=new o(this.scene,i,n,a,h);return void 0!==e&&(t.add=e),s(this.scene,l,t),l}))},60505:(t,e,i)=>{var s=i(39429),n=i(591);s.register("renderTexture",(function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))}))},77757:(t,e,i)=>{var s=i(9674),n=i(83419),r=i(31401),o=i(95643),a=i(36060),h=i(38745),l=i(26099),u=new n({Extends:o,Mixins:[r.AlphaSingle,r.BlendMode,r.Depth,r.Flip,r.Mask,r.Pipeline,r.PostPipeline,r.Size,r.Texture,r.Transform,r.Visible,r.ScrollFactor,h],initialize:function(t,e,i,n,r,h,u,c,d){void 0===n&&(n="__DEFAULT"),void 0===h&&(h=2),void 0===u&&(u=!0),o.call(this,t,"Rope"),this.anims=new s(this),this.points=h,this.vertices,this.uv,this.colors,this.alphas,this.tintFill="__DEFAULT"===n,this.dirty=!1,this.horizontal=u,this._flipX=!1,this._flipY=!1,this._perp=new l,this.debugCallback=null,this.debugGraphic=null,this.setTexture(n,r),this.setPosition(e,i),this.setSizeToFrame(),this.initPipeline(a.ROPE_PIPELINE),this.initPostPipeline(),Array.isArray(h)&&this.resizeArrays(h.length),this.setPoints(h,c,d),this.updateVertices()},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},preUpdate:function(t,e){var i=this.anims.currentFrame;this.anims.update(t,e),this.anims.currentFrame!==i&&(this.updateUVs(),this.updateVertices())},play:function(t,e,i){return this.anims.play(t,e,i),this},setDirty:function(){return this.dirty=!0,this},setHorizontal:function(t,e,i){return void 0===t&&(t=this.points.length),this.horizontal?this:(this.horizontal=!0,this.setPoints(t,e,i))},setVertical:function(t,e,i){return void 0===t&&(t=this.points.length),this.horizontal?(this.horizontal=!1,this.setPoints(t,e,i)):this},setTintFill:function(t){return void 0===t&&(t=!1),this.tintFill=t,this},setAlphas:function(t,e){var i=this.points.length;if(i<1)return this;var s,n=this.alphas;void 0===t?t=[1]:Array.isArray(t)||void 0!==e||(t=[t]);var r=0;if(void 0!==e)for(s=0;sr&&(o=t[r]),n[r]=o,t.length>r+1&&(o=t[r+1]),n[r+1]=o}return this},setColors:function(t){var e=this.points.length;if(e<1)return this;var i,s=this.colors;void 0===t?t=[16777215]:Array.isArray(t)||(t=[t]);var n=0;if(t.length===e)for(i=0;in&&(r=t[n]),s[n]=r,t.length>n+1&&(r=t[n+1]),s[n+1]=r}return this},setPoints:function(t,e,i){if(void 0===t&&(t=2),"number"==typeof t){var s,n,r,o=t;if(o<2&&(o=2),t=[],this.horizontal)for(r=-this.frame.halfWidth,n=this.frame.width/(o-1),s=0;s{t.exports=function(){}},26209:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(35154),a=i(77757);n.register("rope",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=r(t,"frame",null),h=r(t,"horizontal",!0),l=o(t,"points",void 0),u=o(t,"colors",void 0),c=o(t,"alphas",void 0),d=new a(this.scene,0,0,i,n,l,h,u,c);return void 0!==e&&(t.add=e),s(this.scene,d,t),d}))},96819:(t,e,i)=>{var s=i(77757);i(39429).register("rope",(function(t,e,i,n,r,o,a,h){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a,h))}))},38745:(t,e,i)=>{var s,n;i(29747),s=i(20439),n=i(95262),t.exports={renderWebGL:s,renderCanvas:n}},20439:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.pipelines.set(e.pipeline,e),a=s(e,i,r).calc,h=e.vertices,l=e.uv,u=e.colors,c=e.alphas,d=e.alpha,f=n.getTintAppendFloatAlpha,p=i.roundPixels,v=h.length,g=Math.floor(.5*v);o.flush(),t.pipelines.preBatch(e);var m=o.setGameObject(e),y=o.vertexViewF32,x=o.vertexViewU32,T=o.vertexCount*o.currentShader.vertexComponentCount-1,w=0,b=e.tintFill;e.dirty&&e.updateVertices();for(var S=e.debugCallback,E=[],A=0;A{var s=i(83419),n=i(31401),r=i(95643),o=i(95540),a=i(79291),h=i(61622),l=i(25479),u=i(61340),c=i(95428),d=i(92503),f=new s({Extends:r,Mixins:[n.ComputedSize,n.Depth,n.GetBounds,n.Mask,n.Origin,n.ScrollFactor,n.Transform,n.Visible,l],initialize:function(t,e,i,s,n,o,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=128),void 0===o&&(o=128),r.call(this,t,"Shader"),this.blendMode=-1,this.shader;var l=t.sys.renderer;this.renderer=l,this.gl=l.gl,this.vertexData=new ArrayBuffer(2*Float32Array.BYTES_PER_ELEMENT*6),this.vertexBuffer=l.createVertexBuffer(this.vertexData.byteLength,this.gl.STREAM_DRAW),this._deferSetShader=null,this._deferProjOrtho=null,this.program=null,this.bytes=new Uint8Array(this.vertexData),this.vertexViewF32=new Float32Array(this.vertexData),this._tempMatrix1=new u,this._tempMatrix2=new u,this._tempMatrix3=new u,this.viewMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.projectionMatrix=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.uniforms={},this.pointer=null,this._rendererWidth=l.width,this._rendererHeight=l.height,this._textureCount=0,this.framebuffer=null,this.glTexture=null,this.renderToTexture=!1,this.texture=null,this.setPosition(i,s),this.setSize(n,o),this.setOrigin(.5,.5),this.setShader(e,a,h),this.renderer.on(d.RESTORE_WEBGL,this.onContextRestored,this)},willRender:function(t){return!!this.renderToTexture||!(r.RENDER_MASK!==this.renderFlags||0!==this.cameraFilter&&this.cameraFilter&t.id)},setRenderToTexture:function(t,e){if(!this.renderToTexture){var i=this.width,s=this.height,n=this.renderer;this.glTexture=n.createTextureFromSource(null,i,s,0),this.framebuffer=n.createFramebuffer(i,s,this.glTexture,!1),this._rendererWidth=i,this._rendererHeight=s,this.renderToTexture=!0,this.projOrtho(0,this.width,this.height,0),t&&(this.texture=this.scene.sys.textures.addGLTexture(t,this.glTexture))}return this.shader&&(n.pipelines.clear(),this.load(),this.flush(),n.pipelines.rebind()),this},setShader:function(t,e,i){if(this.renderer.contextLost)return this._deferSetShader={key:t,textures:e,textureData:i},this;if(void 0===e&&(e=[]),"string"==typeof t){var s=this.scene.sys.cache.shader;if(!s.has(t))return console.warn("Shader missing: "+t),this;this.shader=s.get(t)}else this.shader=t;var n=this.gl,r=this.renderer;this.program&&r.deleteProgram(this.program);var o=r.createProgram(this.shader.vertexSrc,this.shader.fragmentSrc);n.uniformMatrix4fv(n.getUniformLocation(o.webGLProgram,"uViewMatrix"),!1,this.viewMatrix),n.uniformMatrix4fv(n.getUniformLocation(o.webGLProgram,"uProjectionMatrix"),!1,this.projectionMatrix),n.uniform2f(n.getUniformLocation(o.webGLProgram,"uResolution"),this.width,this.height),this.program=o;var h=new Date,l={resolution:{type:"2f",value:{x:this.width,y:this.height}},time:{type:"1f",value:0},mouse:{type:"2f",value:{x:this.width/2,y:this.height/2}},date:{type:"4fv",value:[h.getFullYear(),h.getMonth(),h.getDate(),60*h.getHours()*60+60*h.getMinutes()+h.getSeconds()]},sampleRate:{type:"1f",value:44100},iChannel0:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel1:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel2:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel3:{type:"sampler2D",value:null,textureData:{repeat:!0}}};this.shader.uniforms?this.uniforms=a(!0,{},this.shader.uniforms,l):this.uniforms=l;for(var u=0;u<4;u++)e[u]&&this.setSampler2D("iChannel"+u,e[u],u,i);return this.initUniforms(),this.projOrtho(0,this._rendererWidth,this._rendererHeight,0),this},setPointer:function(t){return this.pointer=t,this},projOrtho:function(t,e,i,s){if(this.renderer.contextLost)this._deferProjOrtho={left:t,right:e,bottom:i,top:s};else{var n=1/(t-e),r=1/(i-s),o=this.projectionMatrix;o[0]=-2*n,o[5]=-2*r,o[10]=-.001,o[12]=(t+e)*n,o[13]=(s+i)*r,o[14]=-0;var a=this.program,h=this.gl;this.renderer.setProgram(a),h.uniformMatrix4fv(h.getUniformLocation(a.webGLProgram,"uProjectionMatrix"),!1,this.projectionMatrix),this._rendererWidth=e,this._rendererHeight=i}},initUniforms:function(){var t=this.renderer.glFuncMap,e=this.program;for(var i in this._textureCount=0,this.uniforms){var s=this.uniforms[i],n=s.type,r=t[n];s.uniformLocation=this.renderer.createUniformLocation(e,i),"sampler2D"!==n&&(s.glMatrix=r.matrix,s.glValueLength=r.length,s.glFunc=r.func)}},setSampler2DBuffer:function(t,e,i,s,n,r){void 0===n&&(n=0),void 0===r&&(r={});var o=this.uniforms[t];return o.value=e,r.width=i,r.height=s,o.textureData=r,this._textureCount=n,this.initSampler2D(o),this},setSampler2D:function(t,e,i,s){void 0===i&&(i=0);var n=this.scene.sys.textures;if(n.exists(e)){var r=n.getFrame(e);if(r.glTexture&&r.glTexture.isRenderTexture)return this.setSampler2DBuffer(t,r.glTexture,r.width,r.height,i,s);var o=this.uniforms[t],a=r.source;o.textureKey=e,o.source=a.image,o.value=r.glTexture,a.isGLTexture&&(s||(s={}),s.width=a.width,s.height=a.height),s&&(o.textureData=s),this._textureCount=i,this.initSampler2D(o)}return this},setUniform:function(t,e){return h(this.uniforms,t,e),this},getUniform:function(t){return o(this.uniforms,t,null)},setChannel0:function(t,e){return this.setSampler2D("iChannel0",t,0,e)},setChannel1:function(t,e){return this.setSampler2D("iChannel1",t,1,e)},setChannel2:function(t,e){return this.setSampler2D("iChannel2",t,2,e)},setChannel3:function(t,e){return this.setSampler2D("iChannel3",t,3,e)},initSampler2D:function(t){if(t.value){var e=t.textureData;if(e&&!t.value.isRenderTexture){var i=this.gl,s=t.value,n=i[o(e,"magFilter","linear").toUpperCase()],r=i[o(e,"minFilter","linear").toUpperCase()],a=i[o(e,"wrapS","repeat").toUpperCase()],h=i[o(e,"wrapT","repeat").toUpperCase()],l=i[o(e,"format","rgba").toUpperCase()],u=o(e,"flipY",!1),c=o(e,"width",s.width),d=o(e,"height",s.height),f=o(e,"source",s.pixels);e.repeat&&(a=i.REPEAT,h=i.REPEAT),e.width&&(f=null),s.update(f,c,d,u,a,h,r,n,l)}this.renderer.setProgram(this.program),this._textureCount++}},syncUniforms:function(){var t,e,i,s,n,r=this.gl,o=this.uniforms,a=0;for(var h in o)i=(t=o[h]).glFunc,e=t.glValueLength,s=t.uniformLocation,null!==(n=t.value)&&(1===e?t.glMatrix?i.call(r,s.webGLUniformLocation,t.transpose,n):i.call(r,s.webGLUniformLocation,n):2===e?i.call(r,s.webGLUniformLocation,n.x,n.y):3===e?i.call(r,s.webGLUniformLocation,n.x,n.y,n.z):4===e?i.call(r,s.webGLUniformLocation,n.x,n.y,n.z,n.w):"sampler2D"===t.type&&(r.activeTexture(r.TEXTURE0+a),r.bindTexture(r.TEXTURE_2D,n.webGLTexture),r.uniform1i(s.webGLUniformLocation,a),a++))},load:function(t){var e=this.gl,i=this.width,s=this.height,n=this.renderer,r=this.program,o=this.viewMatrix;if(!this.renderToTexture){var a=-this._displayOriginX,h=-this._displayOriginY;o[0]=t[0],o[1]=t[1],o[4]=t[2],o[5]=t[3],o[8]=t[4],o[9]=t[5],o[12]=o[0]*a+o[4]*h,o[13]=o[1]*a+o[5]*h}e.useProgram(r.webGLProgram),e.uniformMatrix4fv(e.getUniformLocation(r.webGLProgram,"uViewMatrix"),!1,o),e.uniformMatrix4fv(e.getUniformLocation(r.webGLProgram,"uProjectionMatrix"),!1,this.projectionMatrix),e.uniform2f(e.getUniformLocation(r.webGLProgram,"uResolution"),this.width,this.height);var l=this.uniforms,u=l.resolution;u.value.x=i,u.value.y=s,l.time.value=n.game.loop.getDuration();var c=this.pointer;if(c){var d=l.mouse,f=c.x/i,p=1-c.y/s;d.value.x=f.toFixed(2),d.value.y=p.toFixed(2)}this.syncUniforms()},flush:function(){var t=this.width,e=this.height,i=this.program,s=this.gl,n=this.vertexBuffer,r=this.renderer,o=2*Float32Array.BYTES_PER_ELEMENT;this.renderToTexture&&(r.setFramebuffer(this.framebuffer),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT)),s.bindBuffer(s.ARRAY_BUFFER,n.webGLBuffer);var a=s.getAttribLocation(i.webGLProgram,"inPosition");-1!==a&&(s.enableVertexAttribArray(a),s.vertexAttribPointer(a,2,s.FLOAT,!1,o,0));var h=this.vertexViewF32;h[3]=e,h[4]=t,h[5]=e,h[8]=t,h[9]=e,h[10]=t,s.bufferSubData(s.ARRAY_BUFFER,0,this.bytes.subarray(0,6*o)),s.drawArrays(s.TRIANGLES,0,6),this.renderToTexture&&r.setFramebuffer(null,!1)},setAlpha:function(){},setBlendMode:function(){},onContextRestored:function(){if(null!==this._deferSetShader){var t=this._deferSetShader.key,e=this._deferSetShader.textures,i=this._deferSetShader.textureData;this._deferSetShader=null,this.setShader(t,e,i)}if(null!==this._deferProjOrtho){var s=this._deferProjOrtho.left,n=this._deferProjOrtho.right,r=this._deferProjOrtho.bottom,o=this._deferProjOrtho.top;this._deferProjOrtho=null,this.projOrtho(s,n,r,o)}},preDestroy:function(){var t=this.renderer;t.off(d.RESTORE_WEBGL,this.onContextRestored,this),t.deleteProgram(this.program),t.deleteBuffer(this.vertexBuffer),this.renderToTexture&&(t.deleteFramebuffer(this.framebuffer),this.texture.destroy(),this.framebuffer=null,this.glTexture=null,this.texture=null),c(this.uniforms,(function(e){t.deleteUniformLocation(e.uniformLocation),e.uniformLocation=null}))}});t.exports=f},80464:t=>{t.exports=function(){}},54935:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(20071);n.register("shader",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=r(t,"x",0),a=r(t,"y",0),h=r(t,"width",128),l=r(t,"height",128),u=new o(this.scene,i,n,a,h,l);return void 0!==e&&(t.add=e),s(this.scene,u,t),u}))},74177:(t,e,i)=>{var s=i(20071);i(39429).register("shader",(function(t,e,i,n,r,o,a){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a))}))},25479:(t,e,i)=>{var s,n;i(29747),s=i(19257),n=i(80464),t.exports={renderWebGL:s,renderCanvas:n}},19257:(t,e,i)=>{var s=i(91296);t.exports=function(t,e,i,n){if(e.shader){if(i.addToRenderList(e),t.pipelines.clear(),e.renderToTexture)e.load(),e.flush();else{var r=s(e,i,n).calc;t.width===e._rendererWidth&&t.height===e._rendererHeight||e.projOrtho(0,t.width,t.height,0),e.load(r.matrix),e.flush()}t.pipelines.rebind()}}},10441:(t,e,i)=>{var s=i(70554);t.exports=function(t,e,i,n,r,o){for(var a=s.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*n),h=i.pathData,l=i.pathIndexes,u=0;u{t.exports=function(t,e,i,s){var n=i||e.fillColor,r=s||e.fillAlpha,o=(16711680&n)>>>16,a=(65280&n)>>>8,h=255&n;t.fillStyle="rgba("+o+","+a+","+h+","+r+")"}},75177:t=>{t.exports=function(t,e,i,s){var n=i||e.strokeColor,r=s||e.strokeAlpha,o=(16711680&n)>>>16,a=(65280&n)>>>8,h=255&n;t.strokeStyle="rgba("+o+","+a+","+h+","+r+")",t.lineWidth=e.lineWidth}},17803:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(95643),o=i(23031),a=new s({Extends:r,Mixins:[n.AlphaSingle,n.BlendMode,n.Depth,n.GetBounds,n.Mask,n.Origin,n.Pipeline,n.PostPipeline,n.ScrollFactor,n.Transform,n.Visible],initialize:function(t,e,i){void 0===e&&(e="Shape"),r.call(this,t,e),this.geom=i,this.pathData=[],this.pathIndexes=[],this.fillColor=16777215,this.fillAlpha=1,this.strokeColor=16777215,this.strokeAlpha=1,this.lineWidth=1,this.isFilled=!1,this.isStroked=!1,this.closePath=!0,this._tempLine=new o,this.width=0,this.height=0,this.initPipeline(),this.initPostPipeline()},setFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.isFilled=!1:(this.fillColor=t,this.fillAlpha=e,this.isFilled=!0),this},setStrokeStyle:function(t,e,i){return void 0===i&&(i=1),void 0===t?this.isStroked=!1:(this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this.isStroked=!0),this},setClosePath:function(t){return this.closePath=t,this},setSize:function(t,e){return this.width=t,this.height=e,this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this},preDestroy:function(){this.geom=null,this._tempLine=null,this.pathData=[],this.pathIndexes=[]},displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}}});t.exports=a},34682:(t,e,i)=>{var s=i(70554);t.exports=function(t,e,i,n,r){var o=t.strokeTint,a=s.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*i);o.TL=a,o.TR=a,o.BL=a,o.BR=a;var h=e.pathData,l=h.length-1,u=e.lineWidth,c=u/2,d=h[0]-n,f=h[1]-r;e.closePath||(l-=2);for(var p=2;p{var s=i(13609),n=i(83419),r=i(39506),o=i(94811),a=i(96503),h=i(36383),l=i(17803),u=new n({Extends:l,Mixins:[s],initialize:function(t,e,i,s,n,r,o,h,u){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=128),void 0===n&&(n=0),void 0===r&&(r=360),void 0===o&&(o=!1),l.call(this,t,"Arc",new a(0,0,s)),this._startAngle=n,this._endAngle=r,this._anticlockwise=o,this._iterations=.01,this.setPosition(e,i);var c=2*this.geom.radius;this.setSize(c,c),void 0!==h&&this.setFillStyle(h,u),this.updateDisplayOrigin(),this.updateData()},iterations:{get:function(){return this._iterations},set:function(t){this._iterations=t,this.updateData()}},radius:{get:function(){return this.geom.radius},set:function(t){this.geom.radius=t;var e=2*t;this.setSize(e,e),this.updateDisplayOrigin(),this.updateData()}},startAngle:{get:function(){return this._startAngle},set:function(t){this._startAngle=t,this.updateData()}},endAngle:{get:function(){return this._endAngle},set:function(t){this._endAngle=t,this.updateData()}},anticlockwise:{get:function(){return this._anticlockwise},set:function(t){this._anticlockwise=t,this.updateData()}},setRadius:function(t){return this.radius=t,this},setIterations:function(t){return void 0===t&&(t=.01),this.iterations=t,this},setStartAngle:function(t,e){return this._startAngle=t,void 0!==e&&(this._anticlockwise=e),this.updateData()},setEndAngle:function(t,e){return this._endAngle=t,void 0!==e&&(this._anticlockwise=e),this.updateData()},updateData:function(){var t=this._iterations,e=t,i=this.geom.radius,s=r(this._startAngle),n=r(this._endAngle),a=i,l=i;n-=s,this._anticlockwise?n<-h.PI2?n=-h.PI2:n>0&&(n=-h.PI2+n%h.PI2):n>h.PI2?n=h.PI2:n<0&&(n=h.PI2+n%h.PI2);for(var u,c=[a+Math.cos(s)*i,l+Math.sin(s)*i];e<1;)u=n*e+s,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),e+=t;return u=n+s,c.push(a+Math.cos(u)*i,l+Math.sin(u)*i),c.push(a+Math.cos(s)*i,l+Math.sin(s)*i),this.pathIndexes=o(c),this.pathData=c,this}});t.exports=u},42542:(t,e,i)=>{var s=i(39506),n=i(65960),r=i(75177),o=i(20926);t.exports=function(t,e,i,a){i.addToRenderList(e);var h=t.currentContext;if(o(t,h,e,i,a)){var l=e.radius;h.beginPath(),h.arc(l-e.originX*(2*l),l-e.originY*(2*l),l,s(e._startAngle),s(e._endAngle),e.anticlockwise),e.closePath&&h.closePath(),e.isFilled&&(n(h,e),h.fill()),e.isStroked&&(r(h,e),h.stroke()),h.restore()}}},42563:(t,e,i)=>{var s=i(23629),n=i(39429);n.register("arc",(function(t,e,i,n,r,o,a,h){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a,h))})),n.register("circle",(function(t,e,i,n,r){return this.displayList.add(new s(this.scene,t,e,i,0,360,!1,n,r))}))},13609:(t,e,i)=>{var s,n;i(29747),s=i(41447),n=i(42542),t.exports={renderWebGL:s,renderCanvas:n}},41447:(t,e,i)=>{var s=i(91296),n=i(10441),r=i(34682);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=s(e,i,o),l=a.calcMatrix.copyFrom(h.calc),u=e._displayOriginX,c=e._displayOriginY,d=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&n(a,l,e,d,u,c),e.isStroked&&r(a,e,d,u,c),t.pipelines.postBatch(e)}},89:(t,e,i)=>{var s=i(83419),n=i(33141),r=i(94811),o=i(87841),a=i(17803),h=new s({Extends:a,Mixins:[n],initialize:function(t,e,i,s,n,r){void 0===e&&(e=0),void 0===i&&(i=0),a.call(this,t,"Curve",s),this._smoothness=32,this._curveBounds=new o,this.closePath=!1,this.setPosition(e,i),void 0!==n&&this.setFillStyle(n,r),this.updateData()},smoothness:{get:function(){return this._smoothness},set:function(t){this._smoothness=t,this.updateData()}},setSmoothness:function(t){return this._smoothness=t,this.updateData()},updateData:function(){var t=this._curveBounds,e=this._smoothness;this.geom.getBounds(t,e),this.setSize(t.width,t.height),this.updateDisplayOrigin();for(var i=[],s=this.geom.getPoints(e),n=0;n{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX+e._curveBounds.x,l=e._displayOriginY+e._curveBounds.y,u=e.pathData,c=u.length-1,d=u[0]-h,f=u[1]-l;a.beginPath(),a.moveTo(d,f),e.closePath||(c-=2);for(var p=2;p{var s=i(39429),n=i(89);s.register("curve",(function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))}))},33141:(t,e,i)=>{var s,n;i(29747),s=i(53987),n=i(3170),t.exports={renderWebGL:s,renderCanvas:n}},53987:(t,e,i)=>{var s=i(10441),n=i(91296),r=i(34682);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=n(e,i,o),l=a.calcMatrix.copyFrom(h.calc),u=e._displayOriginX+e._curveBounds.x,c=e._displayOriginY+e._curveBounds.y,d=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&s(a,l,e,d,u,c),e.isStroked&&r(a,e,d,u,c),t.pipelines.postBatch(e)}},19921:(t,e,i)=>{var s=i(83419),n=i(94811),r=i(54205),o=i(8497),a=i(17803),h=new s({Extends:a,Mixins:[r],initialize:function(t,e,i,s,n,r,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=128),void 0===n&&(n=128),a.call(this,t,"Ellipse",new o(s/2,n/2,s,n)),this._smoothness=64,this.setPosition(e,i),this.width=s,this.height=n,void 0!==r&&this.setFillStyle(r,h),this.updateDisplayOrigin(),this.updateData()},smoothness:{get:function(){return this._smoothness},set:function(t){this._smoothness=t,this.updateData()}},setSize:function(t,e){return this.width=t,this.height=e,this.geom.setPosition(t/2,e/2),this.geom.setSize(t,e),this.updateData()},setSmoothness:function(t){return this._smoothness=t,this.updateData()},updateData:function(){for(var t=[],e=this.geom.getPoints(this._smoothness),i=0;i{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX,l=e._displayOriginY,u=e.pathData,c=u.length-1,d=u[0]-h,f=u[1]-l;a.beginPath(),a.moveTo(d,f),e.closePath||(c-=2);for(var p=2;p{var s=i(19921);i(39429).register("ellipse",(function(t,e,i,n,r,o){return this.displayList.add(new s(this.scene,t,e,i,n,r,o))}))},54205:(t,e,i)=>{var s,n;i(29747),s=i(19467),n=i(7930),t.exports={renderWebGL:s,renderCanvas:n}},19467:(t,e,i)=>{var s=i(10441),n=i(91296),r=i(34682);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=n(e,i,o),l=a.calcMatrix.copyFrom(h.calc),u=e._displayOriginX,c=e._displayOriginY,d=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&s(a,l,e,d,u,c),e.isStroked&&r(a,e,d,u,c),t.pipelines.postBatch(e)}},30479:(t,e,i)=>{var s=i(83419),n=i(17803),r=i(26015),o=new s({Extends:n,Mixins:[r],initialize:function(t,e,i,s,r,o,a,h,l,u,c){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=128),void 0===r&&(r=128),void 0===o&&(o=32),void 0===a&&(a=32),n.call(this,t,"Grid",null),this.cellWidth=o,this.cellHeight=a,this.showCells=!0,this.outlineFillColor=0,this.outlineFillAlpha=0,this.showOutline=!0,this.showAltCells=!1,this.altFillColor,this.altFillAlpha,this.setPosition(e,i),this.setSize(s,r),this.setFillStyle(h,l),void 0!==u&&this.setOutlineStyle(u,c),this.updateDisplayOrigin()},setFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.showCells=!1:(this.fillColor=t,this.fillAlpha=e,this.showCells=!0),this},setAltFillStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.showAltCells=!1:(this.altFillColor=t,this.altFillAlpha=e,this.showAltCells=!0),this},setOutlineStyle:function(t,e){return void 0===e&&(e=1),void 0===t?this.showOutline=!1:(this.outlineFillColor=t,this.outlineFillAlpha=e,this.showOutline=!0),this}});t.exports=o},49912:(t,e,i)=>{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=-e._displayOriginX,l=-e._displayOriginY,u=i.alpha*e.alpha,c=e.width,d=e.height,f=e.cellWidth,p=e.cellHeight,v=Math.ceil(c/f),g=Math.ceil(d/p),m=f,y=p,x=f-(v*f-c),T=p-(g*p-d),w=e.showCells,b=e.showAltCells,S=e.showOutline,E=0,A=0,C=0,_=0,M=0;if(S&&(m--,y--,x===f&&x--,T===p&&T--),w&&e.fillAlpha>0)for(s(a,e),A=0;A0)for(s(a,e,e.altFillColor,e.altFillAlpha*u),A=0;A0){for(n(a,e,e.outlineFillColor,e.outlineFillAlpha*u),E=1;E{var s=i(39429),n=i(30479);s.register("grid",(function(t,e,i,s,r,o,a,h,l,u){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h,l,u))}))},26015:(t,e,i)=>{var s,n;i(29747),s=i(46161),n=i(49912),t.exports={renderWebGL:s,renderCanvas:n}},46161:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.pipelines.set(e.pipeline),a=s(e,i,r);o.calcMatrix.copyFrom(a.calc).translate(-e._displayOriginX,-e._displayOriginY);var h,l,u=i.alpha*e.alpha,c=e.width,d=e.height,f=e.cellWidth,p=e.cellHeight,v=Math.ceil(c/f),g=Math.ceil(d/p),m=f,y=p,x=f-(v*f-c),T=p-(g*p-d),w=e.showCells,b=e.showAltCells,S=e.showOutline,E=0,A=0,C=0,_=0,M=0;if(S&&(m--,y--,x===f&&x--,T===p&&T--),t.pipelines.preBatch(e),w&&e.fillAlpha>0)for(h=o.fillTint,l=n.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*u),h.TL=l,h.TR=l,h.BL=l,h.BR=l,A=0;A0)for(h=o.fillTint,l=n.getTintAppendFloatAlpha(e.altFillColor,e.altFillAlpha*u),h.TL=l,h.TR=l,h.BL=l,h.BR=l,A=0;A0){var P=o.strokeTint,R=n.getTintAppendFloatAlpha(e.outlineFillColor,e.outlineFillAlpha*u);for(P.TL=R,P.TR=R,P.BL=R,P.BR=R,E=1;E{var s=i(99651),n=i(83419),r=i(17803),o=new n({Extends:r,Mixins:[s],initialize:function(t,e,i,s,n,o,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=48),void 0===n&&(n=32),void 0===o&&(o=15658734),void 0===a&&(a=10066329),void 0===h&&(h=13421772),r.call(this,t,"IsoBox",null),this.projection=4,this.fillTop=o,this.fillLeft=a,this.fillRight=h,this.showTop=!0,this.showLeft=!0,this.showRight=!0,this.isFilled=!0,this.setPosition(e,i),this.setSize(s,n),this.updateDisplayOrigin()},setProjection:function(t){return this.projection=t,this},setFaces:function(t,e,i){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!0),this.showTop=t,this.showLeft=e,this.showRight=i,this},setFillStyle:function(t,e,i){return this.fillTop=t,this.fillLeft=e,this.fillRight=i,this.isFilled=!0,this}});t.exports=o},11508:(t,e,i)=>{var s=i(65960),n=i(20926);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.currentContext;if(n(t,o,e,i,r)&&e.isFilled){var a=e.width,h=e.height,l=a/2,u=a/e.projection;e.showTop&&(s(o,e,e.fillTop),o.beginPath(),o.moveTo(-l,-h),o.lineTo(0,-u-h),o.lineTo(l,-h),o.lineTo(l,-1),o.lineTo(0,u-1),o.lineTo(-l,-1),o.lineTo(-l,-h),o.fill()),e.showLeft&&(s(o,e,e.fillLeft),o.beginPath(),o.moveTo(-l,0),o.lineTo(0,u),o.lineTo(0,u-h),o.lineTo(-l,-h),o.lineTo(-l,0),o.fill()),e.showRight&&(s(o,e,e.fillRight),o.beginPath(),o.moveTo(l,0),o.lineTo(0,u),o.lineTo(0,u-h),o.lineTo(l,-h),o.lineTo(l,0),o.fill()),o.restore()}}},3933:(t,e,i)=>{var s=i(39429),n=i(61475);s.register("isobox",(function(t,e,i,s,r,o,a){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a))}))},99651:(t,e,i)=>{var s,n;i(29747),s=i(68149),n=i(11508),t.exports={renderWebGL:s,renderCanvas:n}},68149:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){i.addToRenderList(e);var o,a,h,l,u,c,d,f,p,v=t.pipelines.set(e.pipeline),g=s(e,i,r),m=v.calcMatrix.copyFrom(g.calc),y=e.width,x=e.height,T=y/2,w=y/e.projection,b=i.alpha*e.alpha;e.isFilled&&(t.pipelines.preBatch(e),e.showTop&&(o=n.getTintAppendFloatAlpha(e.fillTop,b),a=m.getX(-T,-x),h=m.getY(-T,-x),l=m.getX(0,-w-x),u=m.getY(0,-w-x),c=m.getX(T,-x),d=m.getY(T,-x),f=m.getX(0,w-x),p=m.getY(0,w-x),v.batchQuad(e,a,h,l,u,c,d,f,p,0,0,1,1,o,o,o,o,2)),e.showLeft&&(o=n.getTintAppendFloatAlpha(e.fillLeft,b),a=m.getX(-T,0),h=m.getY(-T,0),l=m.getX(0,w),u=m.getY(0,w),c=m.getX(0,w-x),d=m.getY(0,w-x),f=m.getX(-T,-x),p=m.getY(-T,-x),v.batchQuad(e,a,h,l,u,c,d,f,p,0,0,1,1,o,o,o,o,2)),e.showRight&&(o=n.getTintAppendFloatAlpha(e.fillRight,b),a=m.getX(T,0),h=m.getY(T,0),l=m.getX(0,w),u=m.getY(0,w),c=m.getX(0,w-x),d=m.getY(0,w-x),f=m.getX(T,-x),p=m.getY(T,-x),v.batchQuad(e,a,h,l,u,c,d,f,p,0,0,1,1,o,o,o,o,2)),t.pipelines.postBatch(e))}},16933:(t,e,i)=>{var s=i(83419),n=i(60561),r=i(17803),o=new s({Extends:r,Mixins:[n],initialize:function(t,e,i,s,n,o,a,h,l){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=48),void 0===n&&(n=32),void 0===o&&(o=!1),void 0===a&&(a=15658734),void 0===h&&(h=10066329),void 0===l&&(l=13421772),r.call(this,t,"IsoTriangle",null),this.projection=4,this.fillTop=a,this.fillLeft=h,this.fillRight=l,this.showTop=!0,this.showLeft=!0,this.showRight=!0,this.isReversed=o,this.isFilled=!0,this.setPosition(e,i),this.setSize(s,n),this.updateDisplayOrigin()},setProjection:function(t){return this.projection=t,this},setReversed:function(t){return this.isReversed=t,this},setFaces:function(t,e,i){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!0),this.showTop=t,this.showLeft=e,this.showRight=i,this},setFillStyle:function(t,e,i){return this.fillTop=t,this.fillLeft=e,this.fillRight=i,this.isFilled=!0,this}});t.exports=o},79590:(t,e,i)=>{var s=i(65960),n=i(20926);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.currentContext;if(n(t,o,e,i,r)&&e.isFilled){var a=e.width,h=e.height,l=a/2,u=a/e.projection,c=e.isReversed;e.showTop&&c&&(s(o,e,e.fillTop),o.beginPath(),o.moveTo(-l,-h),o.lineTo(0,-u-h),o.lineTo(l,-h),o.lineTo(0,u-h),o.fill()),e.showLeft&&(s(o,e,e.fillLeft),o.beginPath(),c?(o.moveTo(-l,-h),o.lineTo(0,u),o.lineTo(0,u-h)):(o.moveTo(-l,0),o.lineTo(0,u),o.lineTo(0,u-h)),o.fill()),e.showRight&&(s(o,e,e.fillRight),o.beginPath(),c?(o.moveTo(l,-h),o.lineTo(0,u),o.lineTo(0,u-h)):(o.moveTo(l,0),o.lineTo(0,u),o.lineTo(0,u-h)),o.fill()),o.restore()}}},49803:(t,e,i)=>{var s=i(39429),n=i(16933);s.register("isotriangle",(function(t,e,i,s,r,o,a,h){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h))}))},60561:(t,e,i)=>{var s,n;i(29747),s=i(51503),n=i(79590),t.exports={renderWebGL:s,renderCanvas:n}},51503:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.pipelines.set(e.pipeline),a=s(e,i,r),h=o.calcMatrix.copyFrom(a.calc),l=e.width,u=e.height,c=l/2,d=l/e.projection,f=e.isReversed,p=i.alpha*e.alpha;if(e.isFilled){var v,g,m,y,x,T,w;if(t.pipelines.preBatch(e),e.showTop&&f){v=n.getTintAppendFloatAlpha(e.fillTop,p),g=h.getX(-c,-u),m=h.getY(-c,-u),y=h.getX(0,-d-u),x=h.getY(0,-d-u),T=h.getX(c,-u),w=h.getY(c,-u);var b=h.getX(0,d-u),S=h.getY(0,d-u);o.batchQuad(e,g,m,y,x,T,w,b,S,0,0,1,1,v,v,v,v,2)}e.showLeft&&(v=n.getTintAppendFloatAlpha(e.fillLeft,p),f?(g=h.getX(-c,-u),m=h.getY(-c,-u),y=h.getX(0,d),x=h.getY(0,d),T=h.getX(0,d-u),w=h.getY(0,d-u)):(g=h.getX(-c,0),m=h.getY(-c,0),y=h.getX(0,d),x=h.getY(0,d),T=h.getX(0,d-u),w=h.getY(0,d-u)),o.batchTri(e,g,m,y,x,T,w,0,0,1,1,v,v,v,2)),e.showRight&&(v=n.getTintAppendFloatAlpha(e.fillRight,p),f?(g=h.getX(c,-u),m=h.getY(c,-u),y=h.getX(0,d),x=h.getY(0,d),T=h.getX(0,d-u),w=h.getY(0,d-u)):(g=h.getX(c,0),m=h.getY(c,0),y=h.getX(0,d),x=h.getY(0,d),T=h.getX(0,d-u),w=h.getY(0,d-u)),o.batchTri(e,g,m,y,x,T,w,0,0,1,1,v,v,v,2)),t.pipelines.postBatch(e)}}},57847:(t,e,i)=>{var s=i(83419),n=i(17803),r=i(23031),o=i(36823),a=new s({Extends:n,Mixins:[o],initialize:function(t,e,i,s,o,a,h,l,u){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=128),void 0===h&&(h=0),n.call(this,t,"Line",new r(s,o,a,h));var c=Math.max(1,this.geom.right-this.geom.left),d=Math.max(1,this.geom.bottom-this.geom.top);this.lineWidth=1,this._startWidth=1,this._endWidth=1,this.setPosition(e,i),this.setSize(c,d),void 0!==l&&this.setStrokeStyle(1,l,u),this.updateDisplayOrigin()},setLineWidth:function(t,e){return void 0===e&&(e=t),this._startWidth=t,this._endWidth=e,this.lineWidth=t,this},setTo:function(t,e,i,s){return this.geom.setTo(t,e,i,s),this}});t.exports=a},17440:(t,e,i)=>{var s=i(75177),n=i(20926);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.currentContext;if(n(t,o,e,i,r)){var a=e._displayOriginX,h=e._displayOriginY;e.isStroked&&(s(o,e),o.beginPath(),o.moveTo(e.geom.x1-a,e.geom.y1-h),o.lineTo(e.geom.x2-a,e.geom.y2-h),o.stroke()),o.restore()}}},2481:(t,e,i)=>{var s=i(39429),n=i(57847);s.register("line",(function(t,e,i,s,r,o,a,h){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h))}))},36823:(t,e,i)=>{var s,n;i(29747),s=i(77385),n=i(17440),t.exports={renderWebGL:s,renderCanvas:n}},77385:(t,e,i)=>{var s=i(91296),n=i(70554);t.exports=function(t,e,i,r){i.addToRenderList(e);var o=t.pipelines.set(e.pipeline),a=s(e,i,r);o.calcMatrix.copyFrom(a.calc);var h=e._displayOriginX,l=e._displayOriginY,u=i.alpha*e.alpha;if(t.pipelines.preBatch(e),e.isStroked){var c=o.strokeTint,d=n.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*u);c.TL=d,c.TR=d,c.BL=d,c.BR=d,o.batchLine(e.geom.x1-h,e.geom.y1-l,e.geom.x2-h,e.geom.y2-l,e._startWidth/2,e._endWidth/2,1,0,!1,a.sprite,a.camera)}t.pipelines.postBatch(e)}},24949:(t,e,i)=>{var s=i(90273),n=i(83419),r=i(94811),o=i(13829),a=i(25717),h=i(17803),l=i(5469),u=new n({Extends:h,Mixins:[s],initialize:function(t,e,i,s,n,r){void 0===e&&(e=0),void 0===i&&(i=0),h.call(this,t,"Polygon",new a(s));var l=o(this.geom);this.setPosition(e,i),this.setSize(l.width,l.height),void 0!==n&&this.setFillStyle(n,r),this.updateDisplayOrigin(),this.updateData()},smooth:function(t){void 0===t&&(t=1);for(var e=0;e{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX,l=e._displayOriginY,u=e.pathData,c=u.length-1,d=u[0]-h,f=u[1]-l;a.beginPath(),a.moveTo(d,f),e.closePath||(c-=2);for(var p=2;p{var s=i(39429),n=i(24949);s.register("polygon",(function(t,e,i,s,r){return this.displayList.add(new n(this.scene,t,e,i,s,r))}))},90273:(t,e,i)=>{var s,n;i(29747),s=i(73695),n=i(38710),t.exports={renderWebGL:s,renderCanvas:n}},73695:(t,e,i)=>{var s=i(10441),n=i(91296),r=i(34682);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=n(e,i,o),l=a.calcMatrix.copyFrom(h.calc),u=e._displayOriginX,c=e._displayOriginY,d=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&s(a,l,e,d,u,c),e.isStroked&&r(a,e,d,u,c),t.pipelines.postBatch(e)}},74561:(t,e,i)=>{var s=i(83419),n=i(87841),r=i(17803),o=i(95597),a=new s({Extends:r,Mixins:[o],initialize:function(t,e,i,s,o,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=128),void 0===o&&(o=128),r.call(this,t,"Rectangle",new n(0,0,s,o)),this.setPosition(e,i),this.setSize(s,o),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setSize:function(t,e){this.width=t,this.height=e,this.geom.setSize(t,e),this.updateData(),this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),e.getLineD(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},48682:(t,e,i)=>{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX,l=e._displayOriginY;e.isFilled&&(s(a,e),a.fillRect(-h,-l,e.width,e.height)),e.isStroked&&(n(a,e),a.beginPath(),a.rect(-h,-l,e.width,e.height),a.stroke()),a.restore()}}},87959:(t,e,i)=>{var s=i(39429),n=i(74561);s.register("rectangle",(function(t,e,i,s,r,o){return this.displayList.add(new n(this.scene,t,e,i,s,r,o))}))},95597:(t,e,i)=>{var s,n;i(29747),s=i(52059),n=i(48682),t.exports={renderWebGL:s,renderCanvas:n}},52059:(t,e,i)=>{var s=i(91296),n=i(34682),r=i(70554);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=s(e,i,o);a.calcMatrix.copyFrom(h.calc);var l=e._displayOriginX,u=e._displayOriginY,c=i.alpha*e.alpha;if(t.pipelines.preBatch(e),e.isFilled){var d=a.fillTint,f=r.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*c);d.TL=f,d.TR=f,d.BL=f,d.BR=f,a.batchFillRect(-l,-u,e.width,e.height)}e.isStroked&&n(a,e,c,l,u),t.pipelines.postBatch(e)}},55911:(t,e,i)=>{var s=i(81991),n=i(83419),r=i(94811),o=i(17803),a=new n({Extends:o,Mixins:[s],initialize:function(t,e,i,s,n,r,a,h){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=5),void 0===n&&(n=32),void 0===r&&(r=64),o.call(this,t,"Star",null),this._points=s,this._innerRadius=n,this._outerRadius=r,this.setPosition(e,i),this.setSize(2*r,2*r),void 0!==a&&this.setFillStyle(a,h),this.updateDisplayOrigin(),this.updateData()},setPoints:function(t){return this._points=t,this.updateData()},setInnerRadius:function(t){return this._innerRadius=t,this.updateData()},setOuterRadius:function(t){return this._outerRadius=t,this.updateData()},points:{get:function(){return this._points},set:function(t){this._points=t,this.updateData()}},innerRadius:{get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this.updateData()}},outerRadius:{get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this.updateData()}},updateData:function(){var t=[],e=this._points,i=this._innerRadius,s=this._outerRadius,n=Math.PI/2*3,o=Math.PI/e,a=s,h=s;t.push(a,h+-s);for(var l=0;l{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX,l=e._displayOriginY,u=e.pathData,c=u.length-1,d=u[0]-h,f=u[1]-l;a.beginPath(),a.moveTo(d,f),e.closePath||(c-=2);for(var p=2;p{var s=i(55911);i(39429).register("star",(function(t,e,i,n,r,o,a){return this.displayList.add(new s(this.scene,t,e,i,n,r,o,a))}))},81991:(t,e,i)=>{var s,n;i(29747),s=i(57017),n=i(64272),t.exports={renderWebGL:s,renderCanvas:n}},57017:(t,e,i)=>{var s=i(10441),n=i(91296),r=i(34682);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=n(e,i,o),l=a.calcMatrix.copyFrom(h.calc),u=e._displayOriginX,c=e._displayOriginY,d=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&s(a,l,e,d,u,c),e.isStroked&&r(a,e,d,u,c),t.pipelines.postBatch(e)}},36931:(t,e,i)=>{var s=i(83419),n=i(17803),r=i(16483),o=i(96195),a=new s({Extends:n,Mixins:[o],initialize:function(t,e,i,s,o,a,h,l,u,c,d){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===o&&(o=128),void 0===a&&(a=64),void 0===h&&(h=0),void 0===l&&(l=128),void 0===u&&(u=128),n.call(this,t,"Triangle",new r(s,o,a,h,l,u));var f=this.geom.right-this.geom.left,p=this.geom.bottom-this.geom.top;this.setPosition(e,i),this.setSize(f,p),void 0!==c&&this.setFillStyle(c,d),this.updateDisplayOrigin(),this.updateData()},setTo:function(t,e,i,s,n,r){return this.geom.setTo(t,e,i,s,n,r),this.updateData()},updateData:function(){var t=[],e=this.geom,i=this._tempLine;return e.getLineA(i),t.push(i.x1,i.y1,i.x2,i.y2),e.getLineB(i),t.push(i.x2,i.y2),e.getLineC(i),t.push(i.x2,i.y2),this.pathData=t,this}});t.exports=a},85172:(t,e,i)=>{var s=i(65960),n=i(75177),r=i(20926);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.currentContext;if(r(t,a,e,i,o)){var h=e._displayOriginX,l=e._displayOriginY,u=e.geom.x1-h,c=e.geom.y1-l,d=e.geom.x2-h,f=e.geom.y2-l,p=e.geom.x3-h,v=e.geom.y3-l;a.beginPath(),a.moveTo(u,c),a.lineTo(d,f),a.lineTo(p,v),a.closePath(),e.isFilled&&(s(a,e),a.fill()),e.isStroked&&(n(a,e),a.stroke()),a.restore()}}},45245:(t,e,i)=>{var s=i(39429),n=i(36931);s.register("triangle",(function(t,e,i,s,r,o,a,h,l,u){return this.displayList.add(new n(this.scene,t,e,i,s,r,o,a,h,l,u))}))},96195:(t,e,i)=>{var s,n;i(29747),s=i(83253),n=i(85172),t.exports={renderWebGL:s,renderCanvas:n}},83253:(t,e,i)=>{var s=i(91296),n=i(34682),r=i(70554);t.exports=function(t,e,i,o){i.addToRenderList(e);var a=t.pipelines.set(e.pipeline),h=s(e,i,o);a.calcMatrix.copyFrom(h.calc);var l=e._displayOriginX,u=e._displayOriginY,c=i.alpha*e.alpha;if(t.pipelines.preBatch(e),e.isFilled){var d=a.fillTint,f=r.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*c);d.TL=f,d.TR=f,d.BL=f,d.BR=f;var p=e.geom.x1-l,v=e.geom.y1-u,g=e.geom.x2-l,m=e.geom.y2-u,y=e.geom.x3-l,x=e.geom.y3-u;a.batchFillTriangle(p,v,g,m,y,x,h.sprite,h.camera)}e.isStroked&&n(a,e,c,l,u),t.pipelines.postBatch(e)}},68287:(t,e,i)=>{var s=i(9674),n=i(83419),r=i(31401),o=i(95643),a=i(92751),h=new n({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.Depth,r.Flip,r.GetBounds,r.Mask,r.Origin,r.Pipeline,r.PostPipeline,r.ScrollFactor,r.Size,r.TextureCrop,r.Tint,r.Transform,r.Visible,a],initialize:function(t,e,i,n,r){o.call(this,t,"Sprite"),this._crop=this.resetCropObject(),this.anims=new s(this),this.setTexture(n,r),this.setPosition(e,i),this.setSizeToFrame(),this.setOriginFromFrame(),this.initPipeline(),this.initPostPipeline(!0)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},preUpdate:function(t,e){this.anims.update(t,e)},play:function(t,e){return this.anims.play(t,e)},playReverse:function(t,e){return this.anims.playReverse(t,e)},playAfterDelay:function(t,e){return this.anims.playAfterDelay(t,e)},playAfterRepeat:function(t,e){return this.anims.playAfterRepeat(t,e)},chain:function(t){return this.anims.chain(t)},stop:function(){return this.anims.stop()},stopAfterDelay:function(t){return this.anims.stopAfterDelay(t)},stopAfterRepeat:function(t){return this.anims.stopAfterRepeat(t)},stopOnFrame:function(t){return this.anims.stopOnFrame(t)},toJSON:function(){return r.ToJSON(this)},preDestroy:function(){this.anims.destroy(),this.anims=void 0}});t.exports=h},76552:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e),t.batchSprite(e,e.frame,i,s)}},15567:(t,e,i)=>{var s=i(25305),n=i(13059),r=i(44603),o=i(23568),a=i(68287);r.register("sprite",(function(t,e){void 0===t&&(t={});var i=o(t,"key",null),r=o(t,"frame",null),h=new a(this.scene,0,0,i,r);return void 0!==e&&(t.add=e),s(this.scene,h,t),n(h,t),h}))},46409:(t,e,i)=>{var s=i(39429),n=i(68287);s.register("sprite",(function(t,e,i,s){return this.displayList.add(new n(this.scene,t,e,i,s))}))},92751:(t,e,i)=>{var s,n;i(29747),s=i(9409),n=i(76552),t.exports={renderWebGL:s,renderCanvas:n}},9409:t=>{t.exports=function(t,e,i,s){i.addToRenderList(e),e.pipeline.batchSprite(e,i,s)}},14220:t=>{t.exports=function(t,e,i){var s=t.canvas,n=t.context,r=t.style,o=[],a=0,h=i.length;r.maxLines>0&&r.maxLines1&&(u+=t.letterSpacing*(i[l].length-1)),r.wordWrap&&(u-=n.measureText(" ").width),o[l]=Math.ceil(u),a=Math.max(a,o[l])}var c=e.fontSize+r.strokeThickness,d=c*h,f=t.lineSpacing;return h>1&&(d+=f*(h-1)),{width:a,height:d,lines:h,lineWidths:o,lineSpacing:f,lineHeight:c}}},79557:(t,e,i)=>{var s=i(27919);t.exports=function(t){var e=s.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var n=i.measureText(t.testString);if("actualBoundingBoxAscent"in n){var r=n.actualBoundingBoxAscent,o=n.actualBoundingBoxDescent;return s.remove(e),{ascent:r,descent:o,fontSize:r+o}}var a=Math.ceil(n.width*t.baselineX),h=a,l=2*h;h=h*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);var u={ascent:0,descent:0,fontSize:0},c=i.getImageData(0,0,a,l);if(!c)return u.ascent=h,u.descent=h+6,u.fontSize=u.ascent+u.descent,s.remove(e),u;var d,f,p=c.data,v=p.length,g=4*a,m=0,y=!1;for(d=0;dh;d--){for(f=0;f{var s=i(40366),n=i(27919),r=i(83419),o=i(31401),a=i(95643),h=i(14220),l=i(35154),u=i(35846),c=i(61771),d=i(35762),f=i(45650),p=new r({Extends:a,Mixins:[o.Alpha,o.BlendMode,o.ComputedSize,o.Crop,o.Depth,o.Flip,o.GetBounds,o.Mask,o.Origin,o.Pipeline,o.PostPipeline,o.ScrollFactor,o.Tint,o.Transform,o.Visible,c],initialize:function(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),a.call(this,t,"Text"),this.renderer=t.sys.renderer,this.setPosition(e,i),this.setOrigin(0,0),this.initPipeline(),this.initPostPipeline(!0),this.canvas=n.create(this),this.context,this.style=new d(this,r),this.autoRound=!0,this.splitRegExp=/(?:\r\n|\r|\n)/,this._text=void 0,this.padding={left:0,right:0,top:0,bottom:0},this.width=1,this.height=1,this.lineSpacing=0,this.letterSpacing=0,0===this.style.resolution&&(this.style.resolution=1),this._crop=this.resetCropObject(),this._textureKey=f(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.context=this.texture.context,this.frame=this.texture.get(),this.frame.source.resolution=this.style.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.initRTL(),this.setText(s),r&&r.padding&&this.setPadding(r.padding),r&&r.lineSpacing&&this.setLineSpacing(r.lineSpacing)},initRTL:function(){this.style.rtl&&(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",s(this.canvas,this.scene.sys.canvas),this.originX=1)},runWordWrap:function(t){var e=this.style;if(e.wordWrapCallback){var i=e.wordWrapCallback.call(e.wordWrapCallbackScope,t,this);return Array.isArray(i)&&(i=i.join("\n")),i}return e.wordWrapWidth?e.wordWrapUseAdvanced?this.advancedWordWrap(t,this.context,this.style.wordWrapWidth):this.basicWordWrap(t,this.context,this.style.wordWrapWidth):t},advancedWordWrap:function(t,e,i){for(var s="",n=t.replace(/ +/gi," ").split(this.splitRegExp),r=n.length,o=0;ol){if(0===c){for(var v=f;v.length&&(v=v.slice(0,-1),!((p=e.measureText(v).width)<=l)););if(!v.length)throw new Error("wordWrapWidth < a single character");var g=d.substr(v.length);u[c]=g,h+=v}var m=u[c].length?c:c+1,y=u.slice(m).join(" ").replace(/[ \n]*$/gi,"");n.splice(o+1,0,y),r=n.length;break}h+=f,l-=p}s+=h.replace(/[ \n]*$/gi,"")+"\n"}}return s.replace(/[\s|\n]*$/gi,"")},basicWordWrap:function(t,e,i){for(var s="",n=t.split(this.splitRegExp),r=n.length-1,o=e.measureText(" ").width,a=0;a<=r;a++){for(var h=i,l=n[a].split(" "),u=l.length-1,c=0;c<=u;c++){var d=l[c],f=e.measureText(d).width,p=f;ch&&c>0&&(s+="\n",h=i),s+=d,c0&&(d+=l.lineSpacing*v),i.rtl)c=f-c-u.left-u.right;else if("right"===i.align)c+=o-l.lineWidths[v];else if("center"===i.align)c+=(o-l.lineWidths[v])/2;else if("justify"===i.align&&l.lineWidths[v]/l.width>=.85){var g=l.width-l.lineWidths[v],m=e.measureText(" ").width,y=a[v].trim(),x=y.split(" ");g+=(a[v].length-y.length)*m;for(var T=Math.floor(g/m),w=0;T>0;)x[w]+=" ",w=(w+1)%(x.length-1||1),--T;a[v]=x.join(" ")}if(this.autoRound&&(c=Math.round(c),d=Math.round(d)),i.strokeThickness&&(i.syncShadow(e,i.shadowStroke),e.strokeText(a[v],c,d)),i.color){i.syncShadow(e,i.shadowFill);var b=this.letterSpacing;if(0!==b)for(var S=0,E=a[v].split(""),A=0;A{t.exports=function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}},71259:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(50171);n.register("text",(function(t,e){void 0===t&&(t={});var i=r(t,"text",""),n=r(t,"style",null),a=r(t,"padding",null);null!==a&&(n.padding=a);var h=new o(this.scene,0,0,i,n);return void 0!==e&&(t.add=e),s(this.scene,h,t),h.autoRound=r(t,"autoRound",!0),h.resolution=r(t,"resolution",1),h}))},68005:(t,e,i)=>{var s=i(50171);i(39429).register("text",(function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))}))},61771:(t,e,i)=>{var s,n;i(29747),s=i(34397),n=i(79724),t.exports={renderWebGL:s,renderCanvas:n}},35762:(t,e,i)=>{var s=i(83419),n=i(23568),r=i(35154),o=i(79557),a={fontFamily:["fontFamily","Courier"],fontSize:["fontSize","16px"],fontStyle:["fontStyle",""],backgroundColor:["backgroundColor",null],color:["color","#fff"],stroke:["stroke","#fff"],strokeThickness:["strokeThickness",0],shadowOffsetX:["shadow.offsetX",0],shadowOffsetY:["shadow.offsetY",0],shadowColor:["shadow.color","#000"],shadowBlur:["shadow.blur",0],shadowStroke:["shadow.stroke",!1],shadowFill:["shadow.fill",!1],align:["align","left"],maxLines:["maxLines",0],fixedWidth:["fixedWidth",0],fixedHeight:["fixedHeight",0],resolution:["resolution",0],rtl:["rtl",!1],testString:["testString","|MÉqgy"],baselineX:["baselineX",1.2],baselineY:["baselineY",1.4],wordWrapWidth:["wordWrap.width",null],wordWrapCallback:["wordWrap.callback",null],wordWrapCallbackScope:["wordWrap.callbackScope",null],wordWrapUseAdvanced:["wordWrap.useAdvancedWrap",!1]},h=new s({initialize:function(t,e){this.parent=t,this.fontFamily,this.fontSize,this.fontStyle,this.backgroundColor,this.color,this.stroke,this.strokeThickness,this.shadowOffsetX,this.shadowOffsetY,this.shadowColor,this.shadowBlur,this.shadowStroke,this.shadowFill,this.align,this.maxLines,this.fixedWidth,this.fixedHeight,this.resolution,this.rtl,this.testString,this.baselineX,this.baselineY,this.wordWrapWidth,this.wordWrapCallback,this.wordWrapCallbackScope,this.wordWrapUseAdvanced,this._font,this.setStyle(e,!1,!0)},setStyle:function(t,e,i){for(var s in void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px"),a){var h=i?a[s][1]:this[s];this[s]="wordWrapCallback"===s||"wordWrapCallbackScope"===s?r(t,a[s][0],h):n(t,a[s][0],h)}var l=r(t,"font",null);null!==l&&this.setFont(l,!1),this._font=[this.fontStyle,this.fontSize,this.fontFamily].join(" ").trim();var u=r(t,"fill",null);null!==u&&(this.color=u);var c=r(t,"metrics",!1);return c?this.metrics={ascent:r(c,"ascent",0),descent:r(c,"descent",0),fontSize:r(c,"fontSize",0)}:!e&&this.metrics||(this.metrics=o(this)),e?this.parent.updateText():this.parent},syncFont:function(t,e){e.font=this._font},syncStyle:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"},syncShadow:function(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)},update:function(t){return t&&(this._font=[this.fontStyle,this.fontSize,this.fontFamily].join(" ").trim(),this.metrics=o(this)),this.parent.updateText()},setFont:function(t,e){void 0===e&&(e=!0);var i=t,s="",n="";if("string"!=typeof t)i=r(t,"fontFamily","Courier"),s=r(t,"fontSize","16px"),n=r(t,"fontStyle","");else{var o=t.split(" "),a=0;n=o.length>2?o[a++]:"",s=o[a++]||"16px",i=o[a++]||"Courier"}return i===this.fontFamily&&s===this.fontSize&&n===this.fontStyle||(this.fontFamily=i,this.fontSize=s,this.fontStyle=n,e&&this.update(!0)),this.parent},setFontFamily:function(t){return this.fontFamily!==t&&(this.fontFamily=t,this.update(!0)),this.parent},setFontStyle:function(t){return this.fontStyle!==t&&(this.fontStyle=t,this.update(!0)),this.parent},setFontSize:function(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize!==t&&(this.fontSize=t,this.update(!0)),this.parent},setTestString:function(t){return this.testString=t,this.update(!0)},setFixedSize:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(!1)},setBackgroundColor:function(t){return this.backgroundColor=t,this.update(!1)},setFill:function(t){return this.color=t,this.update(!1)},setColor:function(t){return this.color=t,this.update(!1)},setResolution:function(t){return this.resolution=t,this.update(!1)},setStroke:function(t,e){return void 0===e&&(e=this.strokeThickness),void 0===t&&0!==this.strokeThickness?(this.strokeThickness=0,this.update(!0)):this.stroke===t&&this.strokeThickness===e||(this.stroke=t,this.strokeThickness=e,this.update(!0)),this.parent},setShadow:function(t,e,i,s,n,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===n&&(n=!1),void 0===r&&(r=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=i,this.shadowBlur=s,this.shadowStroke=n,this.shadowFill=r,this.update(!1)},setShadowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)},setShadowColor:function(t){return void 0===t&&(t="#000"),this.shadowColor=t,this.update(!1)},setShadowBlur:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)},setShadowStroke:function(t){return this.shadowStroke=t,this.update(!1)},setShadowFill:function(t){return this.shadowFill=t,this.update(!1)},setWordWrapWidth:function(t,e){return void 0===e&&(e=!1),this.wordWrapWidth=t,this.wordWrapUseAdvanced=e,this.update(!1)},setWordWrapCallback:function(t,e){return void 0===e&&(e=null),this.wordWrapCallback=t,this.wordWrapCallbackScope=e,this.update(!1)},setAlign:function(t){return void 0===t&&(t="left"),this.align=t,this.update(!1)},setMaxLines:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)},getTextMetrics:function(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}},toJSON:function(){var t={};for(var e in a)t[e]=this[e];return t.metrics=this.getTextMetrics(),t},destroy:function(){this.parent=void 0}});t.exports=h},34397:(t,e,i)=>{var s=i(70554);t.exports=function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,o=r.width,a=r.height,h=s.getTintAppendFloatAlpha,l=t.pipelines.set(e.pipeline,e),u=l.setTexture2D(r.glTexture,e);l.batchTexture(e,r.glTexture,o,a,e.x,e.y,o/e.style.resolution,a/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,o,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,n,!1,u)}}},20839:(t,e,i)=>{var s=i(27919),n=i(83419),r=i(31401),o=i(95643),a=i(98439),h=i(68703),l=i(56295),u=i(45650),c=i(26099),d=new n({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.ComputedSize,r.Crop,r.Depth,r.Flip,r.GetBounds,r.Mask,r.Origin,r.Pipeline,r.PostPipeline,r.ScrollFactor,r.Tint,r.Transform,r.Visible,l],initialize:function(t,e,i,n,r,h,l){var d=t.sys.renderer;o.call(this,t,"TileSprite");var f=t.sys.textures.get(h),p=f.get(l);p.source.compressionAlgorithm&&(console.warn("TileSprite cannot use compressed texture"),p=(f=t.sys.textures.get("__MISSING")).get()),"DynamicTexture"===f.type&&(console.warn("TileSprite cannot use Dynamic Texture"),p=(f=t.sys.textures.get("__MISSING")).get()),n&&r?(n=Math.floor(n),r=Math.floor(r)):(n=p.width,r=p.height),this._tilePosition=new c,this._tileScale=new c(1,1),this.dirty=!1,this.renderer=d,this.canvas=s.create(this,n,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!1}),this.displayTexture=f,this.displayFrame=p,this._crop=this.resetCropObject(),this._textureKey=u(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.potWidth=a(p.width),this.potHeight=a(p.height),this.fillCanvas=s.create2D(this,this.potWidth,this.potHeight),this.fillContext=this.fillCanvas.getContext("2d",{willReadFrequently:!1}),this.fillPattern=null,this.setPosition(e,i),this.setSize(n,r),this.setFrame(l),this.setOriginFromFrame(),this.initPipeline(),this.initPostPipeline(!0)},setTexture:function(t,e){return this.displayTexture=this.scene.sys.textures.get(t),this.setFrame(e)},setFrame:function(t){var e=this.displayTexture.get(t);return this.potWidth=a(e.width),this.potHeight=a(e.height),this.canvas.width=0,e.cutWidth&&e.cutHeight?this.renderFlags|=8:this.renderFlags&=-9,this.displayFrame=e,this.dirty=!0,this.updateTileTexture(),this},setTilePosition:function(t,e){return void 0!==t&&(this.tilePositionX=t),void 0!==e&&(this.tilePositionY=e),this},setTileScale:function(t,e){return void 0===t&&(t=this.tileScaleX),void 0===e&&(e=t),this.tileScaleX=t,this.tileScaleY=e,this},updateTileTexture:function(){if(this.dirty&&this.renderer){var t=this.displayFrame;if(t.source.isRenderTexture||t.source.isGLTexture)return console.warn("TileSprites can only use Image or Canvas based textures"),void(this.dirty=!1);var e=this.fillContext,i=this.fillCanvas,s=this.potWidth,n=this.potHeight;this.renderer&&this.renderer.gl||(s=t.cutWidth,n=t.cutHeight),e.clearRect(0,0,s,n),i.width=s,i.height=n,e.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,s,n),this.renderer&&this.renderer.gl?this.fillPattern=this.renderer.canvasToTexture(i,this.fillPattern):this.fillPattern=e.createPattern(i,"repeat"),this.updateCanvas(),this.dirty=!1}},updateCanvas:function(){var t=this.canvas;if(t.width===this.width&&t.height===this.height||(t.width=this.width,t.height=this.height,this.frame.setSize(this.width,this.height),this.updateDisplayOrigin(),this.dirty=!0),!this.dirty||this.renderer&&this.renderer.gl)this.dirty=!1;else{var e=this.context;this.scene.sys.game.config.antialias||h.disable(e);var i=this._tileScale.x,s=this._tileScale.y,n=this._tilePosition.x,r=this._tilePosition.y;e.clearRect(0,0,this.width,this.height),e.save(),e.scale(i,s),e.translate(-n,-r),e.fillStyle=this.fillPattern,e.fillRect(n,r,this.width/i,this.height/s),e.restore(),this.dirty=!1}},preDestroy:function(){this.renderer&&this.renderer.gl&&this.renderer.deleteTexture(this.fillPattern),s.remove(this.canvas),s.remove(this.fillCanvas),this.fillPattern=null,this.fillContext=null,this.fillCanvas=null,this.displayTexture=null,this.displayFrame=null;var t=this.texture;t&&t.destroy(),this.renderer=null},tilePositionX:{get:function(){return this._tilePosition.x},set:function(t){this._tilePosition.x=t,this.dirty=!0}},tilePositionY:{get:function(){return this._tilePosition.y},set:function(t){this._tilePosition.y=t,this.dirty=!0}},tileScaleX:{get:function(){return this._tileScale.x},set:function(t){this._tileScale.x=t,this.dirty=!0}},tileScaleY:{get:function(){return this._tileScale.y},set:function(t){this._tileScale.y=t,this.dirty=!0}}});t.exports=d},46992:t=>{t.exports=function(t,e,i,s){e.updateCanvas(),i.addToRenderList(e),t.batchSprite(e,e.frame,i,s)}},14167:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(20839);n.register("tileSprite",(function(t,e){void 0===t&&(t={});var i=r(t,"x",0),n=r(t,"y",0),a=r(t,"width",512),h=r(t,"height",512),l=r(t,"key",""),u=r(t,"frame",""),c=new o(this.scene,i,n,a,h,l,u);return void 0!==e&&(t.add=e),s(this.scene,c,t),c}))},91681:(t,e,i)=>{var s=i(20839);i(39429).register("tileSprite",(function(t,e,i,n,r,o){return this.displayList.add(new s(this.scene,t,e,i,n,r,o))}))},56295:(t,e,i)=>{var s,n;i(29747),s=i(18553),n=i(46992),t.exports={renderWebGL:s,renderCanvas:n}},18553:(t,e,i)=>{var s=i(70554);t.exports=function(t,e,i,n){e.updateCanvas();var r=e.width,o=e.height;if(0!==r&&0!==o){i.addToRenderList(e);var a=s.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(e.fillPattern,e);h.batchTexture(e,e.fillPattern,e.displayFrame.width*e.tileScaleX,e.displayFrame.height*e.tileScaleY,e.x,e.y,r,o,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.originX*r,e.originY*o,0,0,r,o,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,e.tilePositionX%e.displayFrame.width/e.displayFrame.width,e.tilePositionY%e.displayFrame.height/e.displayFrame.height,i,n,!1,l)}}},18471:(t,e,i)=>{var s=i(45319),n=i(83419),r=i(31401),o=i(51708),a=i(8443),h=i(95643),l=i(36383),u=i(14463),c=i(45650),d=i(10247),f=new n({Extends:h,Mixins:[r.Alpha,r.BlendMode,r.ComputedSize,r.Depth,r.Flip,r.GetBounds,r.Mask,r.Origin,r.Pipeline,r.PostPipeline,r.ScrollFactor,r.TextureCrop,r.Tint,r.Transform,r.Visible,d],initialize:function(t,e,i,s){h.call(this,t,"Video"),this.video,this.videoTexture,this.videoTextureSource,this.snapshotTexture,this.flipY=!1,this._key=c(),this.touchLocked=!1,this.playWhenUnlocked=!1,this.frameReady=!1,this.isStalled=!1,this.failedPlayAttempts=0,this.metadata,this.retry=0,this.retryInterval=500,this._systemMuted=!1,this._codeMuted=!1,this._systemPaused=!1,this._codePaused=!1,this._callbacks={ended:this.completeHandler.bind(this),legacy:this.legacyPlayHandler.bind(this),playing:this.playingHandler.bind(this),seeked:this.seekedHandler.bind(this),seeking:this.seekingHandler.bind(this),stalled:this.stalledHandler.bind(this),suspend:this.stalledHandler.bind(this),waiting:this.stalledHandler.bind(this)},this._loadCallbackHandler=this.loadErrorHandler.bind(this),this._metadataCallbackHandler=this.metadataHandler.bind(this),this._crop=this.resetCropObject(),this.markers={},this._markerIn=0,this._markerOut=0,this._playingMarker=!1,this._lastUpdate=0,this.cacheKey="",this.isSeeking=!1,this._playCalled=!1,this._rfvCallbackId=0;var n=t.sys.game;this._device=n.device.video,this.setPosition(e,i),this.setSize(256,256),this.initPipeline(),this.initPostPipeline(!0),n.events.on(a.PAUSE,this.globalPause,this),n.events.on(a.RESUME,this.globalResume,this);var r=t.sys.sound;r&&r.on(u.GLOBAL_MUTE,this.globalMute,this),s&&this.load(s)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},load:function(t){var e=this.scene.sys.cache.video.get(t);return e?(this.cacheKey=t,this.loadHandler(e.url,e.noAudio,e.crossOrigin)):console.warn("No video in cache for key: "+t),this},changeSource:function(t,e,i,s,n){void 0===e&&(e=!0),void 0===i&&(i=!1),this.cacheKey!==t&&(this.load(t),e&&this.play(i,s,n))},getVideoKey:function(){return this.cacheKey},loadURL:function(t,e,i){void 0===e&&(e=!1);var s=this._device.getVideoURL(t);return s?(this.cacheKey="",this.loadHandler(s.url,e,i)):console.warn("No supported video format found for "+t),this},loadMediaStream:function(t,e,i){return this.loadHandler(null,e,i,t)},loadHandler:function(t,e,i,s){e||(e=!1);var n=this.video;if(n?(this.removeLoadEventHandlers(),this.stop()):((n=document.createElement("video")).controls=!1,n.setAttribute("playsinline","playsinline"),n.setAttribute("preload","auto"),n.setAttribute("disablePictureInPicture","true")),e?(n.muted=!0,n.defaultMuted=!0,n.setAttribute("autoplay","autoplay")):(n.muted=!1,n.defaultMuted=!1,n.removeAttribute("autoplay")),i?n.setAttribute("crossorigin",i):n.removeAttribute("crossorigin"),s)if("srcObject"in n)try{n.srcObject=s}catch(o){if("TypeError"!==o.name)throw o;n.src=URL.createObjectURL(s)}else n.src=URL.createObjectURL(s);else n.src=t;this.retry=0,this.video=n,this._playCalled=!1,n.load(),this.addLoadEventHandlers();var r=this.scene.sys.textures.get(this._key);return this.setTexture(r),this},requestVideoFrame:function(t,e){var i=this.video;if(i){var s=e.width,n=e.height,r=this.videoTexture,a=this.videoTextureSource,h=!r||a.source!==i;h?(this._codePaused=i.paused,this._codeMuted=i.muted,r?(a.source=i,a.width=s,a.height=n,r.get().setSize(s,n)):((r=this.scene.sys.textures.create(this._key,i,s,n)).add("__BASE",0,0,0,s,n),this.setTexture(r),this.videoTexture=r,this.videoTextureSource=r.source[0],this.videoTextureSource.setFlipY(this.flipY),this.emit(o.VIDEO_TEXTURE,this,r)),this.setSizeToFrame(),this.updateDisplayOrigin()):a.update(),this.isStalled=!1,this.metadata=e;var l=e.mediaTime;h&&(this._lastUpdate=l,this.emit(o.VIDEO_CREATED,this,s,n),this.frameReady||(this.frameReady=!0,this.emit(o.VIDEO_PLAY,this))),this._playingMarker?l>=this._markerOut&&(i.loop?(i.currentTime=this._markerIn,this.emit(o.VIDEO_LOOP,this)):(this.stop(!1),this.emit(o.VIDEO_COMPLETE,this))):l-1&&i>e&&i=0&&!isNaN(i)&&i>e&&(this.markers[t]=[e,i]),this},playMarker:function(t,e){var i=this.markers[t];return i&&this.play(e,i[0],i[1]),this},removeMarker:function(t){return delete this.markers[t],this},snapshot:function(t,e){return void 0===t&&(t=this.width),void 0===e&&(e=this.height),this.snapshotArea(0,0,this.width,this.height,t,e)},snapshotArea:function(t,e,i,s,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.width),void 0===s&&(s=this.height),void 0===n&&(n=i),void 0===r&&(r=s);var o=this.video,a=this.snapshotTexture;return a?(a.setSize(n,r),o&&a.context.drawImage(o,t,e,i,s,0,0,n,r)):(a=this.scene.sys.textures.createCanvas(c(),n,r),this.snapshotTexture=a,o&&a.context.drawImage(o,t,e,i,s,0,0,n,r)),a.update()},saveSnapshotTexture:function(t){return this.snapshotTexture?this.scene.sys.textures.renameTexture(this.snapshotTexture.key,t):this.snapshotTexture=this.scene.sys.textures.createCanvas(t,this.width,this.height),this.snapshotTexture},playSuccess:function(){if(this._playCalled){this.addEventHandlers(),this._codePaused=!1,this.touchLocked&&(this.touchLocked=!1,this.emit(o.VIDEO_UNLOCKED,this));var t=this.scene.sys.sound;t&&t.mute&&this.setMute(!0),this._markerIn>-1&&(this.video.currentTime=this._markerIn)}},playError:function(t){var e=t.name;"NotAllowedError"===e?(this.touchLocked=!0,this.playWhenUnlocked=!0,this.failedPlayAttempts=1,this.emit(o.VIDEO_LOCKED,this)):"NotSupportedError"===e?(this.stop(!1),this.emit(o.VIDEO_UNSUPPORTED,this,t)):(this.stop(!1),this.emit(o.VIDEO_ERROR,this,t))},legacyPlayHandler:function(){var t=this.video;t&&(this.playSuccess(),t.removeEventListener("playing",this._callbacks.legacy))},playingHandler:function(){this.isStalled=!1,this.emit(o.VIDEO_PLAYING,this)},loadErrorHandler:function(t){this.stop(!1),this.emit(o.VIDEO_ERROR,this,t)},metadataHandler:function(t){this.emit(o.VIDEO_METADATA,this,t)},setSizeToFrame:function(t){t||(t=this.frame),this.width=t.realWidth,this.height=t.realHeight,1!==this.scaleX&&(this.scaleX=this.displayWidth/this.width),1!==this.scaleY&&(this.scaleY=this.displayHeight/this.height);var e=this.input;return e&&!e.customHitArea&&(e.hitArea.width=this.width,e.hitArea.height=this.height),this},stalledHandler:function(t){this.isStalled=!0,this.emit(o.VIDEO_STALLED,this,t)},completeHandler:function(){this._playCalled=!1,this.emit(o.VIDEO_COMPLETE,this)},preUpdate:function(t,e){this.video&&this._playCalled&&this.touchLocked&&this.playWhenUnlocked&&(this.retry+=e,this.retry>=this.retryInterval&&(this.createPlayPromise(!1),this.retry=0))},seekTo:function(t){var e=this.video;if(e){var i=e.duration;if(i!==1/0&&!isNaN(i)){var s=i*t;this.setCurrentTime(s)}}return this},getCurrentTime:function(){return this.video?this.video.currentTime:0},setCurrentTime:function(t){var e=this.video;if(e){if("string"==typeof t){var i=t[0],s=parseFloat(t.substr(1));"+"===i?t=e.currentTime+s:"-"===i&&(t=e.currentTime-s)}e.currentTime=t}return this},seekingHandler:function(){this.isSeeking=!0,this.emit(o.VIDEO_SEEKING,this)},seekedHandler:function(){this.isSeeking=!1,this.emit(o.VIDEO_SEEKED,this)},getProgress:function(){var t=this.video;if(t){var e=t.duration;if(e!==1/0&&!isNaN(e))return t.currentTime/e}return-1},getDuration:function(){return this.video?this.video.duration:0},setMute:function(t){void 0===t&&(t=!0),this._codeMuted=t;var e=this.video;return e&&(e.muted=!!this._systemMuted||t),this},isMuted:function(){return this._codeMuted},globalMute:function(t,e){this._systemMuted=e;var i=this.video;i&&(i.muted=!!this._codeMuted||e)},globalPause:function(){this._systemPaused=!0,this.video&&!this.video.ended&&(this.removeEventHandlers(),this.video.pause())},globalResume:function(){this._systemPaused=!1,!this.video||this._codePaused||this.video.ended||this.createPlayPromise()},setPaused:function(t){void 0===t&&(t=!0);var e=this.video;return this._codePaused=t,e&&!e.ended&&(t?e.paused||(this.removeEventHandlers(),e.pause()):t||(this._playCalled?e.paused&&!this._systemPaused&&this.createPlayPromise():this.play())),this},pause:function(){return this.setPaused(!0)},resume:function(){return this.setPaused(!1)},getVolume:function(){return this.video?this.video.volume:1},setVolume:function(t){return void 0===t&&(t=1),this.video&&(this.video.volume=s(t,0,1)),this},getPlaybackRate:function(){return this.video?this.video.playbackRate:1},setPlaybackRate:function(t){return this.video&&(this.video.playbackRate=t),this},getLoop:function(){return!!this.video&&this.video.loop},setLoop:function(t){return void 0===t&&(t=!0),this.video&&(this.video.loop=t),this},isPlaying:function(){return!!this.video&&!(this.video.paused||this.video.ended)},isPaused:function(){return this.video&&this._playCalled&&this.video.paused||this._codePaused||this._systemPaused},saveTexture:function(t,e){return void 0===e&&(e=!1),this.videoTexture&&(this.scene.sys.textures.renameTexture(this._key,t),this.videoTextureSource.setFlipY(e)),this._key=t,this.flipY=e,!!this.videoTexture},stop:function(t){void 0===t&&(t=!0);var e=this.video;return e&&(this.removeEventHandlers(),e.cancelVideoFrameCallback(this._rfvCallbackId),e.pause()),this.retry=0,this._playCalled=!1,t&&this.emit(o.VIDEO_STOP,this),this},removeVideoElement:function(){var t=this.video;if(t){for(t.parentNode&&t.parentNode.removeChild(t);t.hasChildNodes();)t.removeChild(t.firstChild);t.removeAttribute("autoplay"),t.removeAttribute("src"),this.video=null}},preDestroy:function(){this.stop(!1),this.removeLoadEventHandlers(),this.removeVideoElement();var t=this.scene.sys.game.events;t.off(a.PAUSE,this.globalPause,this),t.off(a.RESUME,this.globalResume,this);var e=this.scene.sys.sound;e&&e.off(u.GLOBAL_MUTE,this.globalMute,this)}});t.exports=f},58352:t=>{t.exports=function(t,e,i,s){e.videoTexture&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}},11511:(t,e,i)=>{var s=i(25305),n=i(44603),r=i(23568),o=i(18471);n.register("video",(function(t,e){void 0===t&&(t={});var i=r(t,"key",null),n=new o(this.scene,0,0,i);return void 0!==e&&(t.add=e),s(this.scene,n,t),n}))},89025:(t,e,i)=>{var s=i(18471);i(39429).register("video",(function(t,e,i){return this.displayList.add(new s(this.scene,t,e,i))}))},10247:(t,e,i)=>{var s,n;i(29747),s=i(29849),n=i(58352),t.exports={renderWebGL:s,renderCanvas:n}},29849:t=>{t.exports=function(t,e,i,s){e.videoTexture&&(i.addToRenderList(e),e.pipeline.batchSprite(e,i,s))}},41481:(t,e,i)=>{var s=i(10312),n=i(96503),r=i(87902),o=i(83419),a=i(31401),h=i(95643),l=i(87841),u=i(37303),c=new o({Extends:h,Mixins:[a.Depth,a.GetBounds,a.Origin,a.Transform,a.ScrollFactor,a.Visible],initialize:function(t,e,i,n,r){void 0===n&&(n=1),void 0===r&&(r=n),h.call(this,t,"Zone"),this.setPosition(e,i),this.width=n,this.height=r,this.blendMode=s.NORMAL,this.updateDisplayOrigin()},displayWidth:{get:function(){return this.scaleX*this.width},set:function(t){this.scaleX=t/this.width}},displayHeight:{get:function(){return this.scaleY*this.height},set:function(t){this.scaleY=t/this.height}},setSize:function(t,e,i){void 0===i&&(i=!0),this.width=t,this.height=e,this.updateDisplayOrigin();var s=this.input;return i&&s&&!s.customHitArea&&(s.hitArea.width=t,s.hitArea.height=e),this},setDisplaySize:function(t,e){return this.displayWidth=t,this.displayHeight=e,this},setCircleDropZone:function(t){return this.setDropZone(new n(0,0,t),r)},setRectangleDropZone:function(t,e){return this.setDropZone(new l(0,0,t,e),u)},setDropZone:function(t,e){return this.input||this.setInteractive(t,e,!0),this},setAlpha:function(){},setBlendMode:function(){},renderCanvas:function(t,e,i){i.addToRenderList(e)},renderWebGL:function(t,e,i){i.addToRenderList(e)}});t.exports=c},95261:(t,e,i)=>{var s=i(44603),n=i(23568),r=i(41481);s.register("zone",(function(t){var e=n(t,"x",0),i=n(t,"y",0),s=n(t,"width",1),o=n(t,"height",s);return new r(this.scene,e,i,s,o)}))},84175:(t,e,i)=>{var s=i(41481);i(39429).register("zone",(function(t,e,i,n){return this.displayList.add(new s(this.scene,t,e,i,n))}))},95166:t=>{t.exports=function(t){return t.radius>0?Math.PI*t.radius*t.radius:0}},96503:(t,e,i)=>{var s=i(83419),n=i(87902),r=i(26241),o=i(79124),a=i(23777),h=i(28176),l=new s({initialize:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.type=a.CIRCLE,this.x=t,this.y=e,this._radius=i,this._diameter=2*i},contains:function(t,e){return n(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return h(this,t)},setTo:function(t,e,i){return this.x=t,this.y=e,this._radius=i,this._diameter=2*i,this},setEmpty:function(){return this._radius=0,this._diameter=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},isEmpty:function(){return this._radius<=0},radius:{get:function(){return this._radius},set:function(t){this._radius=t,this._diameter=2*t}},diameter:{get:function(){return this._diameter},set:function(t){this._diameter=t,this._radius=.5*t}},left:{get:function(){return this.x-this._radius},set:function(t){this.x=t+this._radius}},right:{get:function(){return this.x+this._radius},set:function(t){this.x=t-this._radius}},top:{get:function(){return this.y-this._radius},set:function(t){this.y=t+this._radius}},bottom:{get:function(){return this.y+this._radius},set:function(t){this.y=t-this._radius}}});t.exports=l},71562:t=>{t.exports=function(t){return Math.PI*t.radius*2}},92110:(t,e,i)=>{var s=i(2141);t.exports=function(t,e,i){return void 0===i&&(i=new s),i.x=t.x+t.radius*Math.cos(e),i.y=t.y+t.radius*Math.sin(e),i}},42250:(t,e,i)=>{var s=i(96503);t.exports=function(t){return new s(t.x,t.y,t.radius)}},87902:t=>{t.exports=function(t,e,i){return t.radius>0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},5698:(t,e,i)=>{var s=i(87902);t.exports=function(t,e){return s(t,e.x,e.y)}},70588:(t,e,i)=>{var s=i(87902);t.exports=function(t,e){return s(t,e.x,e.y)&&s(t,e.right,e.y)&&s(t,e.x,e.bottom)&&s(t,e.right,e.bottom)}},26394:t=>{t.exports=function(t,e){return e.setTo(t.x,t.y,t.radius)}},76278:t=>{t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.radius===e.radius}},2074:(t,e,i)=>{var s=i(87841);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=t.left,e.y=t.top,e.width=t.diameter,e.height=t.diameter,e}},26241:(t,e,i)=>{var s=i(92110),n=i(62945),r=i(36383),o=i(2141);t.exports=function(t,e,i){void 0===i&&(i=new o);var a=n(e,0,r.PI2);return s(t,a,i)}},79124:(t,e,i)=>{var s=i(71562),n=i(92110),r=i(62945),o=i(36383);t.exports=function(t,e,i,a){void 0===a&&(a=[]),!e&&i>0&&(e=s(t)/i);for(var h=0;h{t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},39212:t=>{t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},28176:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){void 0===e&&(e=new s);var i=2*Math.PI*Math.random(),n=Math.random()+Math.random(),r=n>1?2-n:n,o=r*Math.cos(i),a=r*Math.sin(i);return e.x=t.x+o*t.radius,e.y=t.y+a*t.radius,e}},88911:(t,e,i)=>{var s=i(96503);s.Area=i(95166),s.Circumference=i(71562),s.CircumferencePoint=i(92110),s.Clone=i(42250),s.Contains=i(87902),s.ContainsPoint=i(5698),s.ContainsRect=i(70588),s.CopyFrom=i(26394),s.Equals=i(76278),s.GetBounds=i(2074),s.GetPoint=i(26241),s.GetPoints=i(79124),s.Offset=i(50884),s.OffsetPoint=i(39212),s.Random=i(28176),t.exports=s},23777:t=>{t.exports={CIRCLE:0,ELLIPSE:1,LINE:2,POINT:3,POLYGON:4,RECTANGLE:5,TRIANGLE:6}},78874:t=>{t.exports=function(t){return t.isEmpty()?0:t.getMajorRadius()*t.getMinorRadius()*Math.PI}},92990:t=>{t.exports=function(t){var e=t.width/2,i=t.height/2,s=Math.pow(e-i,2)/Math.pow(e+i,2);return Math.PI*(e+i)*(1+3*s/(10+Math.sqrt(4-3*s)))}},79522:(t,e,i)=>{var s=i(2141);t.exports=function(t,e,i){void 0===i&&(i=new s);var n=t.width/2,r=t.height/2;return i.x=t.x+n*Math.cos(e),i.y=t.y+r*Math.sin(e),i}},58102:(t,e,i)=>{var s=i(8497);t.exports=function(t){return new s(t.x,t.y,t.width,t.height)}},81154:t=>{t.exports=function(t,e,i){if(t.width<=0||t.height<=0)return!1;var s=(e-t.x)/t.width,n=(i-t.y)/t.height;return(s*=s)+(n*=n)<.25}},46662:(t,e,i)=>{var s=i(81154);t.exports=function(t,e){return s(t,e.x,e.y)}},1632:(t,e,i)=>{var s=i(81154);t.exports=function(t,e){return s(t,e.x,e.y)&&s(t,e.right,e.y)&&s(t,e.x,e.bottom)&&s(t,e.right,e.bottom)}},65534:t=>{t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},8497:(t,e,i)=>{var s=i(83419),n=i(81154),r=i(90549),o=i(48320),a=i(23777),h=i(24820),l=new s({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.type=a.ELLIPSE,this.x=t,this.y=e,this.width=i,this.height=s},contains:function(t,e){return n(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return h(this,t)},setTo:function(t,e,i,s){return this.x=t,this.y=e,this.width=i,this.height=s,this},setEmpty:function(){return this.width=0,this.height=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getMinorRadius:function(){return Math.min(this.width,this.height)/2},getMajorRadius:function(){return Math.max(this.width,this.height)/2},left:{get:function(){return this.x-this.width/2},set:function(t){this.x=t+this.width/2}},right:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},top:{get:function(){return this.y-this.height/2},set:function(t){this.y=t+this.height/2}},bottom:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=l},36146:t=>{t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},23694:(t,e,i)=>{var s=i(87841);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=t.left,e.y=t.top,e.width=t.width,e.height=t.height,e}},90549:(t,e,i)=>{var s=i(79522),n=i(62945),r=i(36383),o=i(2141);t.exports=function(t,e,i){void 0===i&&(i=new o);var a=n(e,0,r.PI2);return s(t,a,i)}},48320:(t,e,i)=>{var s=i(92990),n=i(79522),r=i(62945),o=i(36383);t.exports=function(t,e,i,a){void 0===a&&(a=[]),!e&&i>0&&(e=s(t)/i);for(var h=0;h{t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},44808:t=>{t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},24820:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){void 0===e&&(e=new s);var i=Math.random()*Math.PI*2,n=Math.sqrt(Math.random());return e.x=t.x+n*Math.cos(i)*t.width/2,e.y=t.y+n*Math.sin(i)*t.height/2,e}},49203:(t,e,i)=>{var s=i(8497);s.Area=i(78874),s.Circumference=i(92990),s.CircumferencePoint=i(79522),s.Clone=i(58102),s.Contains=i(81154),s.ContainsPoint=i(46662),s.ContainsRect=i(1632),s.CopyFrom=i(65534),s.Equals=i(36146),s.GetBounds=i(23694),s.GetPoint=i(90549),s.GetPoints=i(48320),s.Offset=i(73424),s.OffsetPoint=i(44808),s.Random=i(24820),t.exports=s},55738:(t,e,i)=>{var s=i(23777),n=i(79291),r={Circle:i(88911),Ellipse:i(49203),Intersects:i(91865),Line:i(2529),Mesh:i(73090),Point:i(43711),Polygon:i(58423),Rectangle:i(93232),Triangle:i(84435)};r=n(!1,r,s),t.exports=r},2044:(t,e,i)=>{var s=i(20339);t.exports=function(t,e){return s(t.x,t.y,e.x,e.y)<=t.radius+e.radius}},81491:t=>{t.exports=function(t,e){var i=e.width/2,s=e.height/2,n=Math.abs(t.x-e.x-i),r=Math.abs(t.y-e.y-s),o=i+t.radius,a=s+t.radius;if(n>o||r>a)return!1;if(n<=i||r<=s)return!0;var h=n-i,l=r-s;return h*h+l*l<=t.radius*t.radius}},63376:(t,e,i)=>{var s=i(2141),n=i(2044);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e)){var r,o,a,h,l=t.x,u=t.y,c=t.radius,d=e.x,f=e.y,p=e.radius;if(u===f)0==(a=(o=-2*f)*o-4*(r=1)*(d*d+(h=(p*p-c*c-d*d+l*l)/(2*(l-d)))*h-2*d*h+f*f-p*p))?i.push(new s(h,-o/(2*r))):a>0&&(i.push(new s(h,(-o+Math.sqrt(a))/(2*r))),i.push(new s(h,(-o-Math.sqrt(a))/(2*r))));else{var v=(l-d)/(u-f),g=(p*p-c*c-d*d+l*l-f*f+u*u)/(2*(u-f));0==(a=(o=2*u*v-2*g*v-2*l)*o-4*(r=v*v+1)*(l*l+u*u+g*g-c*c-2*u*g))?(h=-o/(2*r),i.push(new s(h,g-h*v))):a>0&&(h=(-o+Math.sqrt(a))/(2*r),i.push(new s(h,g-h*v)),h=(-o-Math.sqrt(a))/(2*r),i.push(new s(h,g-h*v)))}}return i}},97439:(t,e,i)=>{var s=i(4042),n=i(81491);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e)){var r=e.getLineA(),o=e.getLineB(),a=e.getLineC(),h=e.getLineD();s(r,t,i),s(o,t,i),s(a,t,i),s(h,t,i)}return i}},4042:(t,e,i)=>{var s=i(2141),n=i(80462);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e)){var r,o,a=t.x1,h=t.y1,l=t.x2,u=t.y2,c=e.x,d=e.y,f=e.radius,p=l-a,v=u-h,g=a-c,m=h-d,y=p*p+v*v,x=2*(p*g+v*m),T=x*x-4*y*(g*g+m*m-f*f);if(0===T){var w=-x/(2*y);r=a+w*p,o=h+w*v,w>=0&&w<=1&&i.push(new s(r,o))}else if(T>0){var b=(-x-Math.sqrt(T))/(2*y);r=a+b*p,o=h+b*v,b>=0&&b<=1&&i.push(new s(r,o));var S=(-x+Math.sqrt(T))/(2*y);r=a+S*p,o=h+S*v,S>=0&&S<=1&&i.push(new s(r,o))}}return i}},36100:(t,e,i)=>{var s=i(25836);t.exports=function(t,e,i,n){void 0===i&&(i=!1);var r,o,a,h=t.x1,l=t.y1,u=t.x2,c=t.y2,d=e.x1,f=e.y1,p=u-h,v=c-l,g=e.x2-d,m=e.y2-f,y=p*m-v*g;if(0===y)return null;if(i){if((o=(d+g*(r=(p*(f-l)+v*(h-d))/(g*v-m*p))-h)/p)<0||r<0||r>1)return null;a=o}else{if(o=((l-f)*p-(h-d)*v)/y,(r=((d-h)*m-(f-l)*g)/y)<0||r>1||o<0||o>1)return null;a=r}return void 0===n&&(n=new s),n.set(h+p*a,l+v*a,a)}},3073:(t,e,i)=>{var s=i(36100),n=i(23031),r=i(25836),o=new n,a=new r;t.exports=function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=new r);var h=!1;n.set(),a.set();for(var l=e[e.length-1],u=0;u{var s=i(25836),n=i(61369),r=i(3073),o=new s;t.exports=function(t,e,i,s){void 0===s&&(s=new n),Array.isArray(e)||(e=[e]);var a=!1;s.set(),o.set();for(var h=0;h{var s=i(2141),n=i(76112),r=i(92773);t.exports=function(t,e,i){if(void 0===i&&(i=[]),r(t,e))for(var o=e.getLineA(),a=e.getLineB(),h=e.getLineC(),l=e.getLineD(),u=[new s,new s,new s,new s],c=[n(o,t,u[0]),n(a,t,u[1]),n(h,t,u[2]),n(l,t,u[3])],d=0;d<4;d++)c[d]&&i.push(u[d]);return i}},71147:(t,e,i)=>{var s=i(61369),n=i(56362),r=new(i(23031));function o(t,e,i,o,a){var h=Math.cos(t),l=Math.sin(t);r.setTo(e,i,e+h,i+l);var u=n(r,o,!0);u&&a.push(new s(u.x,u.y,t,u.w))}function a(t,e){return t.z-e.z}t.exports=function(t,e,i){Array.isArray(i)||(i=[i]);for(var s=[],n=[],r=0;r{var s=i(87841),n=i(59996);t.exports=function(t,e,i){return void 0===i&&(i=new s),n(t,e)&&(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y),i}},52784:(t,e,i)=>{var s=i(60646),n=i(59996);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e)){var r=t.getLineA(),o=t.getLineB(),a=t.getLineC(),h=t.getLineD();s(r,e,i),s(o,e,i),s(a,e,i),s(h,e,i)}return i}},26341:(t,e,i)=>{var s=i(89265),n=i(60646);t.exports=function(t,e,i){if(void 0===i&&(i=[]),s(t,e)){var r=e.getLineA(),o=e.getLineB(),a=e.getLineC();n(r,t,i),n(o,t,i),n(a,t,i)}return i}},38720:(t,e,i)=>{var s=i(4042),n=i(67636);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e)){var r=t.getLineA(),o=t.getLineB(),a=t.getLineC();s(r,e,i),s(o,e,i),s(a,e,i)}return i}},13882:(t,e,i)=>{var s=i(2141),n=i(2822),r=i(76112);t.exports=function(t,e,i){if(void 0===i&&(i=[]),n(t,e))for(var o=t.getLineA(),a=t.getLineB(),h=t.getLineC(),l=[new s,new s,new s],u=[r(o,e,l[0]),r(a,e,l[1]),r(h,e,l[2])],c=0;c<3;c++)u[c]&&i.push(l[c]);return i}},75636:(t,e,i)=>{var s=i(82944),n=i(13882);t.exports=function(t,e,i){if(void 0===i&&(i=[]),s(t,e)){var r=e.getLineA(),o=e.getLineB(),a=e.getLineC();n(t,r,i),n(t,o,i),n(t,a,i)}return i}},80462:(t,e,i)=>{var s=i(87902),n=new(i(2141));t.exports=function(t,e,i){if(void 0===i&&(i=n),s(e,t.x1,t.y1))return i.x=t.x1,i.y=t.y1,!0;if(s(e,t.x2,t.y2))return i.x=t.x2,i.y=t.y2,!0;var r=t.x2-t.x1,o=t.y2-t.y1,a=e.x-t.x1,h=e.y-t.y1,l=r*r+o*o,u=r,c=o;if(l>0){var d=(a*r+h*o)/l;u*=d,c*=d}return i.x=t.x1+u,i.y=t.y1+c,u*u+c*c<=l&&u*r+c*o>=0&&s(e,i.x,i.y)}},76112:t=>{t.exports=function(t,e,i){var s=t.x1,n=t.y1,r=t.x2,o=t.y2,a=e.x1,h=e.y1,l=e.x2,u=e.y2;if(s===r&&n===o||a===l&&h===u)return!1;var c=(u-h)*(r-s)-(l-a)*(o-n);if(0===c)return!1;var d=((l-a)*(n-h)-(u-h)*(s-a))/c,f=((r-s)*(n-h)-(o-n)*(s-a))/c;return!(d<0||d>1||f<0||f>1||(i&&(i.x=s+d*(r-s),i.y=n+d*(o-n)),0))}},92773:t=>{t.exports=function(t,e){var i=t.x1,s=t.y1,n=t.x2,r=t.y2,o=e.x,a=e.y,h=e.right,l=e.bottom,u=0;if(i>=o&&i<=h&&s>=a&&s<=l||n>=o&&n<=h&&r>=a&&r<=l)return!0;if(i=o){if((u=s+(r-s)*(o-i)/(n-i))>a&&u<=l)return!0}else if(i>h&&n<=h&&(u=s+(r-s)*(h-i)/(n-i))>=a&&u<=l)return!0;if(s=a){if((u=i+(n-i)*(a-s)/(r-s))>=o&&u<=h)return!0}else if(s>l&&r<=l&&(u=i+(n-i)*(l-s)/(r-s))>=o&&u<=h)return!0;return!1}},16204:t=>{t.exports=function(t,e,i){void 0===i&&(i=1);var s=e.x1,n=e.y1,r=e.x2,o=e.y2,a=t.x,h=t.y,l=(r-s)*(r-s)+(o-n)*(o-n);if(0===l)return!1;var u=((a-s)*(r-s)+(h-n)*(o-n))/l;if(u<0)return Math.sqrt((s-a)*(s-a)+(n-h)*(n-h))<=i;if(u>=0&&u<=1){var c=((n-h)*(r-s)-(s-a)*(o-n))/l;return Math.abs(c)*Math.sqrt(l)<=i}return Math.sqrt((r-a)*(r-a)+(o-h)*(o-h))<=i}},14199:(t,e,i)=>{var s=i(16204);t.exports=function(t,e){if(!s(t,e))return!1;var i=Math.min(e.x1,e.x2),n=Math.max(e.x1,e.x2),r=Math.min(e.y1,e.y2),o=Math.max(e.y1,e.y2);return t.x>=i&&t.x<=n&&t.y>=r&&t.y<=o}},59996:t=>{t.exports=function(t,e){return!(t.width<=0||t.height<=0||e.width<=0||e.height<=0||t.righte.right||t.y>e.bottom)}},89265:(t,e,i)=>{var s=i(76112),n=i(37303),r=i(48653),o=i(77493);t.exports=function(t,e){if(e.left>t.right||e.rightt.bottom||e.bottom0}},84411:t=>{t.exports=function(t,e,i,s,n,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||n{var s=i(80462),n=i(10690);t.exports=function(t,e){return!(t.left>e.right||t.righte.bottom||t.bottom{var s=i(76112);t.exports=function(t,e){return!!(t.contains(e.x1,e.y1)||t.contains(e.x2,e.y2)||s(t.getLineA(),e)||s(t.getLineB(),e)||s(t.getLineC(),e))}},82944:(t,e,i)=>{var s=i(48653),n=i(71694),r=i(76112);t.exports=function(t,e){if(t.left>e.right||t.righte.bottom||t.bottom0||(c=n(e),(d=s(t,c,!0)).length>0)}},91865:(t,e,i)=>{t.exports={CircleToCircle:i(2044),CircleToRectangle:i(81491),GetCircleToCircle:i(63376),GetCircleToRectangle:i(97439),GetLineToCircle:i(4042),GetLineToLine:i(36100),GetLineToPoints:i(3073),GetLineToPolygon:i(56362),GetLineToRectangle:i(60646),GetRaysFromPointToPolygon:i(71147),GetRectangleIntersection:i(68389),GetRectangleToRectangle:i(52784),GetRectangleToTriangle:i(26341),GetTriangleToCircle:i(38720),GetTriangleToLine:i(13882),GetTriangleToTriangle:i(75636),LineToCircle:i(80462),LineToLine:i(76112),LineToRectangle:i(92773),PointToLine:i(16204),PointToLineSegment:i(14199),RectangleToRectangle:i(59996),RectangleToTriangle:i(89265),RectangleToValues:i(84411),TriangleToCircle:i(67636),TriangleToLine:i(2822),TriangleToTriangle:i(82944)}},91938:t=>{t.exports=function(t){return Math.atan2(t.y2-t.y1,t.x2-t.x1)}},84993:t=>{t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=[]);var s=Math.round(t.x1),n=Math.round(t.y1),r=Math.round(t.x2),o=Math.round(t.y2),a=Math.abs(r-s),h=Math.abs(o-n),l=s-h&&(c-=h,s+=l),f{t.exports=function(t,e,i){var s=e-(t.x1+t.x2)/2,n=i-(t.y1+t.y2)/2;return t.x1+=s,t.y1+=n,t.x2+=s,t.y2+=n,t}},31116:(t,e,i)=>{var s=i(23031);t.exports=function(t){return new s(t.x1,t.y1,t.x2,t.y2)}},59944:t=>{t.exports=function(t,e){return e.setTo(t.x1,t.y1,t.x2,t.y2)}},59220:t=>{t.exports=function(t,e){return t.x1===e.x1&&t.y1===e.y1&&t.x2===e.x2&&t.y2===e.y2}},78177:(t,e,i)=>{var s=i(35001);t.exports=function(t,e,i){void 0===i&&(i=e);var n=s(t),r=t.x2-t.x1,o=t.y2-t.y1;return e&&(t.x1=t.x1-r/n*e,t.y1=t.y1-o/n*e),i&&(t.x2=t.x2+r/n*i,t.y2=t.y2+o/n*i),t}},26708:(t,e,i)=>{var s=i(52816),n=i(6113),r=i(2141);t.exports=function(t,e,i,o,a){void 0===o&&(o=0),void 0===a&&(a=[]);var h,l,u=[],c=t.x1,d=t.y1,f=t.x2-c,p=t.y2-d,v=n(e,a),g=i-1;for(h=0;h0){var m=u[0],y=[m];for(h=1;h=o&&(y.push(x),m=x)}var T=u[u.length-1];return s(m,T){var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=(t.x1+t.x2)/2,e.y=(t.y1+t.y2)/2,e}},99569:(t,e,i)=>{var s=i(2141);t.exports=function(t,e,i){void 0===i&&(i=new s);var n=t.x1,r=t.y1,o=t.x2,a=t.y2,h=(o-n)*(o-n)+(a-r)*(a-r);if(0===h)return i;var l=((e.x-n)*(o-n)+(e.y-r)*(a-r))/h;return i.x=n+l*(o-n),i.y=r+l*(a-r),i}},34638:(t,e,i)=>{var s=i(36383),n=i(91938),r=i(2141);t.exports=function(t,e){void 0===e&&(e=new r);var i=n(t)-s.TAU;return e.x=Math.cos(i),e.y=Math.sin(i),e}},13151:(t,e,i)=>{var s=i(2141);t.exports=function(t,e,i){return void 0===i&&(i=new s),i.x=t.x1+(t.x2-t.x1)*e,i.y=t.y1+(t.y2-t.y1)*e,i}},15258:(t,e,i)=>{var s=i(35001),n=i(2141);t.exports=function(t,e,i,r){void 0===r&&(r=[]),!e&&i>0&&(e=s(t)/i);for(var o=t.x1,a=t.y1,h=t.x2,l=t.y2,u=0;u{t.exports=function(t,e){var i=t.x1,s=t.y1,n=t.x2,r=t.y2,o=(n-i)*(n-i)+(r-s)*(r-s);if(0===o)return!1;var a=((s-e.y)*(n-i)-(i-e.x)*(r-s))/o;return Math.abs(a)*Math.sqrt(o)}},98770:t=>{t.exports=function(t){return Math.abs(t.y1-t.y2)}},35001:t=>{t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},23031:(t,e,i)=>{var s=i(83419),n=i(13151),r=i(15258),o=i(23777),a=i(65822),h=i(26099),l=new s({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.type=o.LINE,this.x1=t,this.y1=e,this.x2=i,this.y2=s},getPoint:function(t,e){return n(this,t,e)},getPoints:function(t,e,i){return r(this,t,e,i)},getRandomPoint:function(t){return a(this,t)},setTo:function(t,e,i,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.x1=t,this.y1=e,this.x2=i,this.y2=s,this},setFromObjects:function(t,e){return this.x1=t.x,this.y1=t.y,this.x2=e.x,this.y2=e.y,this},getPointA:function(t){return void 0===t&&(t=new h),t.set(this.x1,this.y1),t},getPointB:function(t){return void 0===t&&(t=new h),t.set(this.x2,this.y2),t},left:{get:function(){return Math.min(this.x1,this.x2)},set:function(t){this.x1<=this.x2?this.x1=t:this.x2=t}},right:{get:function(){return Math.max(this.x1,this.x2)},set:function(t){this.x1>this.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=l},64795:(t,e,i)=>{var s=i(36383),n=i(15994),r=i(91938);t.exports=function(t){var e=r(t)-s.TAU;return n(e,-Math.PI,Math.PI)}},52616:(t,e,i)=>{var s=i(36383),n=i(91938);t.exports=function(t){return Math.cos(n(t)-s.TAU)}},87231:(t,e,i)=>{var s=i(36383),n=i(91938);t.exports=function(t){return Math.sin(n(t)-s.TAU)}},89662:t=>{t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t}},71165:t=>{t.exports=function(t){return-(t.x2-t.x1)/(t.y2-t.y1)}},65822:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){void 0===e&&(e=new s);var i=Math.random();return e.x=t.x1+i*(t.x2-t.x1),e.y=t.y1+i*(t.y2-t.y1),e}},69777:(t,e,i)=>{var s=i(91938),n=i(64795);t.exports=function(t,e){return 2*n(e)-Math.PI-s(t)}},39706:(t,e,i)=>{var s=i(64400);t.exports=function(t,e){var i=(t.x1+t.x2)/2,n=(t.y1+t.y2)/2;return s(t,i,n,e)}},82585:(t,e,i)=>{var s=i(64400);t.exports=function(t,e,i){return s(t,e.x,e.y,i)}},64400:t=>{t.exports=function(t,e,i,s){var n=Math.cos(s),r=Math.sin(s),o=t.x1-e,a=t.y1-i;return t.x1=o*n-a*r+e,t.y1=o*r+a*n+i,o=t.x2-e,a=t.y2-i,t.x2=o*n-a*r+e,t.y2=o*r+a*n+i,t}},62377:t=>{t.exports=function(t,e,i,s,n){return t.x1=e,t.y1=i,t.x2=e+Math.cos(s)*n,t.y2=i+Math.sin(s)*n,t}},71366:t=>{t.exports=function(t){return(t.y2-t.y1)/(t.x2-t.x1)}},10809:t=>{t.exports=function(t){return Math.abs(t.x1-t.x2)}},2529:(t,e,i)=>{var s=i(23031);s.Angle=i(91938),s.BresenhamPoints=i(84993),s.CenterOn=i(36469),s.Clone=i(31116),s.CopyFrom=i(59944),s.Equals=i(59220),s.Extend=i(78177),s.GetEasedPoints=i(26708),s.GetMidPoint=i(32125),s.GetNearestPoint=i(99569),s.GetNormal=i(34638),s.GetPoint=i(13151),s.GetPoints=i(15258),s.GetShortestDistance=i(26408),s.Height=i(98770),s.Length=i(35001),s.NormalAngle=i(64795),s.NormalX=i(52616),s.NormalY=i(87231),s.Offset=i(89662),s.PerpSlope=i(71165),s.Random=i(65822),s.ReflectAngle=i(69777),s.Rotate=i(39706),s.RotateAroundPoint=i(82585),s.RotateAroundXY=i(64400),s.SetToAngle=i(62377),s.Slope=i(71366),s.Width=i(10809),t.exports=s},83997:(t,e,i)=>{var s=i(83419),n=i(87841),r=i(26099);function o(t,e,i,s){var n=t-i,r=e-s,o=n*n+r*r;return Math.sqrt(o)}var a=new s({initialize:function(t,e,i){this.vertex1=t,this.vertex2=e,this.vertex3=i,this.bounds=new n,this._inCenter=new r},getInCenter:function(t){void 0===t&&(t=!0);var e,i,s,n,r,a,h=this.vertex1,l=this.vertex2,u=this.vertex3;t?(e=h.x,i=h.y,s=l.x,n=l.y,r=u.x,a=u.y):(e=h.vx,i=h.vy,s=l.vx,n=l.vy,r=u.vx,a=u.vy);var c=o(r,a,s,n),d=o(e,i,r,a),f=o(s,n,e,i),p=c+d+f;return this._inCenter.set((e*c+s*d+r*f)/p,(i*c+n*d+a*f)/p)},contains:function(t,e,i){var s=this.vertex1,n=this.vertex2,r=this.vertex3,o=s.vx,a=s.vy,h=n.vx,l=n.vy,u=r.vx,c=r.vy;if(i){var d=i.a,f=i.b,p=i.c,v=i.d,g=i.e,m=i.f;o=s.vx*d+s.vy*p+g,a=s.vx*f+s.vy*v+m,h=n.vx*d+n.vy*p+g,l=n.vx*f+n.vy*v+m,u=r.vx*d+r.vy*p+g,c=r.vx*f+r.vy*v+m}var y=u-o,x=c-a,T=h-o,w=l-a,b=t-o,S=e-a,E=y*y+x*x,A=y*T+x*w,C=y*b+x*S,_=T*T+w*w,M=T*b+w*S,P=E*_-A*A,R=0===P?0:1/P,L=(_*C-A*M)*R,O=(E*M-A*C)*R;return L>=0&&O>=0&&L+O<1},isCounterClockwise:function(t){var e=this.vertex1,i=this.vertex2,s=this.vertex3,n=(i.vx-e.vx)*(s.vy-e.vy)-(i.vy-e.vy)*(s.vx-e.vx);return t<=0?n>=0:n<0},load:function(t,e,i,s,n){return i=this.vertex1.load(t,e,i,s,n),i=this.vertex2.load(t,e,i,s,n),this.vertex3.load(t,e,i,s,n)},transformCoordinatesLocal:function(t,e,i,s){return this.vertex1.transformCoordinatesLocal(t,e,i,s),this.vertex2.transformCoordinatesLocal(t,e,i,s),this.vertex3.transformCoordinatesLocal(t,e,i,s),this},updateBounds:function(){var t=this.vertex1,e=this.vertex2,i=this.vertex3,s=this.bounds;return s.x=Math.min(t.vx,e.vx,i.vx),s.y=Math.min(t.vy,e.vy,i.vy),s.width=Math.max(t.vx,e.vx,i.vx)-s.x,s.height=Math.max(t.vy,e.vy,i.vy)-s.y,this},isInView:function(t,e,i,s,n,r,o,a,h,l,u){this.update(s,n,r,o,a,h,l,u);var c=this.vertex1,d=this.vertex2,f=this.vertex3;if(c.ta<=0&&d.ta<=0&&f.ta<=0)return!1;if(e&&!this.isCounterClockwise(i))return!1;var p=this.bounds;p.x=Math.min(c.tx,d.tx,f.tx),p.y=Math.min(c.ty,d.ty,f.ty),p.width=Math.max(c.tx,d.tx,f.tx)-p.x,p.height=Math.max(c.ty,d.ty,f.ty)-p.y;var v=t.x+t.width,g=t.y+t.height;return!(p.width<=0||p.height<=0||t.width<=0||t.height<=0||p.rightv||p.y>g)},scrollUV:function(t,e){return this.vertex1.scrollUV(t,e),this.vertex2.scrollUV(t,e),this.vertex3.scrollUV(t,e),this},scaleUV:function(t,e){return this.vertex1.scaleUV(t,e),this.vertex2.scaleUV(t,e),this.vertex3.scaleUV(t,e),this},setColor:function(t){return this.vertex1.color=t,this.vertex2.color=t,this.vertex3.color=t,this},update:function(t,e,i,s,n,r,o,a){return this.vertex1.update(e,i,s,n,r,o,a,t),this.vertex2.update(e,i,s,n,r,o,a,t),this.vertex3.update(e,i,s,n,r,o,a,t),this},translate:function(t,e){void 0===e&&(e=0);var i=this.vertex1,s=this.vertex2,n=this.vertex3;return i.x+=t,i.y+=e,s.x+=t,s.y+=e,n.x+=t,n.y+=e,this},x:{get:function(){return this.getInCenter().x},set:function(t){var e=this.getInCenter();this.translate(t-e.x,0)}},y:{get:function(){return this.getInCenter().y},set:function(t){var e=this.getInCenter();this.translate(0,t-e.y)}},alpha:{get:function(){var t=this.vertex1,e=this.vertex2,i=this.vertex3;return(t.alpha+e.alpha+i.alpha)/3},set:function(t){this.vertex1.alpha=t,this.vertex2.alpha=t,this.vertex3.alpha=t}},depth:{get:function(){var t=this.vertex1,e=this.vertex2,i=this.vertex3;return(t.vz+e.vz+i.vz)/3}},destroy:function(){this.vertex1=null,this.vertex2=null,this.vertex3=null}});t.exports=a},48803:(t,e,i)=>{var s=i(83997),n=i(95540),r=i(37867),o=i(25836),a=i(39318),h=new o,l=new o,u=new r;t.exports=function(t){var e,i=n(t,"mesh"),r=n(t,"texture",null),o=n(t,"frame"),c=n(t,"width",1),d=n(t,"height",c),f=n(t,"widthSegments",1),p=n(t,"heightSegments",f),v=n(t,"x",0),g=n(t,"y",0),m=n(t,"z",0),y=n(t,"rotateX",0),x=n(t,"rotateY",0),T=n(t,"rotateZ",0),w=n(t,"zIsUp",!0),b=n(t,"isOrtho",!!i&&i.dirtyCache[11]),S=n(t,"colors",[16777215]),E=n(t,"alphas",[1]),A=n(t,"tile",!1),C=n(t,"flipY",!1),_=n(t,"width",null),M={faces:[],verts:[]};if(h.set(v,g,m),l.set(y,x,T),u.fromRotationXYTranslation(l,h,w),!r&&i)r=i.texture,o||(e=i.frame);else if(i&&"string"==typeof r)r=i.scene.sys.textures.get(r);else if(!r)return M;e||(e=r.get(o)),!_&&b&&r&&i&&(c=e.width/i.height,d=e.height/i.height);var P,R,L=c/2,O=d/2,F=Math.floor(f),D=Math.floor(p),k=F+1,I=D+1,B=c/F,N=d/D,U=[],X=[],Y=0,z=1,G=0,V=1;e&&(Y=e.u0,z=e.u1,C?(G=e.v1,V=e.v0):(G=e.v0,V=e.v1));var W=z-Y,H=V-G;for(R=0;R{var s=i(83997),n=i(37867),r=i(25836),o=i(39318),a=new r,h=new r,l=new n;t.exports=function(t,e,i,n,r,u,c,d,f,p){void 0===i&&(i=1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=!0);var v={faces:[],verts:[]},g=t.materials;a.set(n,r,u),h.set(c,d,f),l.fromRotationXYTranslation(h,a,p);for(var m=0;m{var s=i(83997),n=i(39318);t.exports=function(t,e,i,r,o,a,h,l){if(void 0===r&&(r=!1),void 0===a&&(a=16777215),void 0===h&&(h=1),void 0===l&&(l=!1),t.length===e.length||r){var u,c,d,f,p,v,g,m,y,x,T,w={faces:[],vertices:[]},b=r?3:2,S=Array.isArray(a),E=Array.isArray(h);if(Array.isArray(i)&&i.length>0)for(u=0;u{var e=!0,i="untitled",s="",n="";function r(t){return 0===t.models.length&&t.models.push({faces:[],name:i,textureCoords:[],vertexNormals:[],vertices:[]}),s="",t.models[t.models.length-1]}function o(t,e){var n=t.length>=2?t[1]:i;e.models.push({faces:[],name:n,textureCoords:[],vertexNormals:[],vertices:[]}),s=""}function a(t){2===t.length&&(s=t[1])}function h(t,e){var i=t.length,s=i>=2?parseFloat(t[1]):0,n=i>=3?parseFloat(t[2]):0,o=i>=4?parseFloat(t[3]):0;r(e).vertices.push({x:s,y:n,z:o})}function l(t,i){var s=t.length,n=s>=2?parseFloat(t[1]):0,o=s>=3?parseFloat(t[2]):0,a=s>=4?parseFloat(t[3]):0;isNaN(n)&&(n=0),isNaN(o)&&(o=0),isNaN(a)&&(a=0),e&&(o=1-o),r(i).textureCoords.push({u:n,v:o,w:a})}function u(t,e){var i=t.length,s=i>=2?parseFloat(t[1]):0,n=i>=3?parseFloat(t[2]):0,o=i>=4?parseFloat(t[3]):0;r(e).vertexNormals.push({x:s,y:n,z:o})}function c(t,e){var i=t.length-1;if(!(i<3)){for(var o={group:s,material:n,vertices:[]},a=0;a3)){var u=0,c=0,d=0;u=parseInt(h[0],10),l>1&&""!==h[1]&&(c=parseInt(h[1],10)),l>2&&(d=parseInt(h[2],10)),0!==u&&(u<0&&(u=r(e).vertices.length+1+u),c-=1,u-=1,d-=1,o.vertices.push({textureCoordsIndex:c,vertexIndex:u,vertexNormalIndex:d}))}}r(e).faces.push(o)}}function d(t,e){t.length>=2&&e.materialLibraries.push(t[1])}function f(t){t.length>=2&&(n=t[1])}t.exports=function(t,i){void 0===i&&(i=!0),e=i;var r,p,v={materials:{},materialLibraries:[],models:[]};s="",n="";for(var g=t.split("\n"),m=0;m-1?r.substring(0,p):r).replace(/\s\s+/g," ").trim().split(" ");switch(y[0].toLowerCase()){case"o":o(y,v);break;case"g":a(y);break;case"v":h(y,v);break;case"vt":l(y,v);break;case"vn":u(y,v);break;case"f":c(y,v);break;case"mtllib":d(y,v);break;case"usemtl":f(y)}}return v}},61485:(t,e,i)=>{var s=i(37589);t.exports=function(t){for(var e={},i=t.split("\n"),n="",r=0;r=2?Math.floor(255*a[2]):h,u=a.length>=3?Math.floor(255*a[3]):h;e[n]=s(h,l,u)}}}return e}},92570:t=>{t.exports=function(t,e,i,s){var n,r;if(void 0===i&&void 0===s){var o=t.getInCenter();n=o.x,r=o.y}var a=Math.cos(e),h=Math.sin(e),l=t.vertex1,u=t.vertex2,c=t.vertex3,d=l.x-n,f=l.y-r;l.set(d*a-f*h+n,d*h+f*a+r),d=u.x-n,f=u.y-r,u.set(d*a-f*h+n,d*h+f*a+r),d=c.x-n,f=c.y-r,c.set(d*a-f*h+n,d*h+f*a+r)}},39318:(t,e,i)=>{var s=i(83419),n=i(70554),r=i(25836),o=new s({Extends:r,initialize:function(t,e,i,s,n,o,a,h,l,u){void 0===o&&(o=16777215),void 0===a&&(a=1),void 0===h&&(h=0),void 0===l&&(l=0),void 0===u&&(u=0),r.call(this,t,e,i),this.vx=0,this.vy=0,this.vz=0,this.nx=h,this.ny=l,this.nz=u,this.u=s,this.v=n,this.color=o,this.alpha=a,this.tx=0,this.ty=0,this.ta=0,this.tu=s,this.tv=n},setUVs:function(t,e){return this.u=t,this.v=e,this.tu=t,this.tv=e,this},scrollUV:function(t,e){return this.tu+=t,this.tv+=e,this},scaleUV:function(t,e){return this.tu=this.u*t,this.tv=this.v*e,this},transformCoordinatesLocal:function(t,e,i,s){var n=this.x,r=this.y,o=this.z,a=t.val,h=n*a[0]+r*a[4]+o*a[8]+a[12],l=n*a[1]+r*a[5]+o*a[9]+a[13],u=n*a[2]+r*a[6]+o*a[10]+a[14],c=n*a[3]+r*a[7]+o*a[11]+a[15];this.vx=h/c*e,this.vy=-l/c*i,this.vz=s<=0?u/c:-u/c},resize:function(t,e,i,s,n,r){return this.x=t,this.y=e,this.vx=this.x*i,this.vy=-this.y*s,this.vz=0,n<.5?this.vx+=i*(.5-n):n>.5&&(this.vx-=i*(n-.5)),r<.5?this.vy+=s*(.5-r):r>.5&&(this.vy-=s*(r-.5)),this},update:function(t,e,i,s,n,r,o,a){var h=this.vx*t+this.vy*i+n,l=this.vx*e+this.vy*s+r;return o&&(h=Math.round(h),l=Math.round(l)),this.tx=h,this.ty=l,this.ta=this.alpha*a,this},load:function(t,e,i,s,r){return t[++i]=this.tx,t[++i]=this.ty,t[++i]=this.tu,t[++i]=this.tv,t[++i]=s,t[++i]=r,e[++i]=n.getTintAppendFloatAlpha(this.color,this.ta),i}});t.exports=o},73090:(t,e,i)=>{var s={Face:i(83997),GenerateGridVerts:i(48803),GenerateObjVerts:i(34684),GenerateVerts:i(92515),ParseObj:i(85048),ParseObjMaterial:i(61485),RotateFace:i(92570),Vertex:i(39318)};t.exports=s},96550:t=>{t.exports=function(t){return t.setTo(Math.ceil(t.x),Math.ceil(t.y))}},99706:(t,e,i)=>{var s=i(2141);t.exports=function(t){return new s(t.x,t.y)}},68010:t=>{t.exports=function(t,e){return e.setTo(t.x,t.y)}},27814:t=>{t.exports=function(t,e){return t.x===e.x&&t.y===e.y}},73565:t=>{t.exports=function(t){return t.setTo(Math.floor(t.x),Math.floor(t.y))}},87555:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){if(void 0===e&&(e=new s),!Array.isArray(t))throw new Error("GetCentroid points argument must be an array");var i=t.length;if(i<1)throw new Error("GetCentroid points array must not be empty");if(1===i)e.x=t[0].x,e.y=t[0].y;else{for(var n=0;n{t.exports=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)}},44405:t=>{t.exports=function(t){return t.x*t.x+t.y*t.y}},20873:(t,e,i)=>{var s=i(87841);t.exports=function(t,e){void 0===e&&(e=new s);for(var i=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=0;ai&&(i=h.x),h.xr&&(r=h.y),h.y{var s=i(2141);t.exports=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=new s),n.x=t.x+(e.x-t.x)*i,n.y=t.y+(e.y-t.y)*i,n}},55767:t=>{t.exports=function(t){return t.setTo(t.y,t.x)}},79432:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.setTo(-t.x,-t.y)}},2141:(t,e,i)=>{var s=i(83419),n=i(23777),r=new s({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.type=n.POINT,this.x=t,this.y=e},setTo:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this}});t.exports=r},72930:(t,e,i)=>{var s=i(2141),n=i(44405);t.exports=function(t,e,i){void 0===i&&(i=new s);var r=(t.x*e.x+t.y*e.y)/n(e);return 0!==r&&(i.x=r*e.x,i.y=r*e.y),i}},62880:(t,e,i)=>{var s=i(2141);t.exports=function(t,e,i){void 0===i&&(i=new s);var n=t.x*e.x+t.y*e.y;return 0!==n&&(i.x=n*e.x,i.y=n*e.y),i}},15093:(t,e,i)=>{var s=i(28793);t.exports=function(t,e){if(0!==t.x||0!==t.y){var i=s(t);t.x/=i,t.y/=i}return t.x*=e,t.y*=e,t}},43711:(t,e,i)=>{var s=i(2141);s.Ceil=i(96550),s.Clone=i(99706),s.CopyFrom=i(68010),s.Equals=i(27814),s.Floor=i(73565),s.GetCentroid=i(87555),s.GetMagnitude=i(28793),s.GetMagnitudeSq=i(44405),s.GetRectangleFromPoints=i(20873),s.Interpolate=i(26152),s.Invert=i(55767),s.Negative=i(79432),s.Project=i(72930),s.ProjectUnit=i(62880),s.SetMagnitude=i(15093),t.exports=s},12306:(t,e,i)=>{var s=i(25717);t.exports=function(t){return new s(t.points)}},63814:t=>{t.exports=function(t,e,i){for(var s=!1,n=-1,r=t.points.length-1;++n{var s=i(63814);t.exports=function(t,e){return s(t,e.x,e.y)}},94811:t=>{function e(t,e,s){s=s||2;var r,o,a,h,c,d,p,v=e&&e.length,g=v?e[0]*s:t.length,m=i(t,0,g,s,!0),y=[];if(!m||m.next===m.prev)return y;if(v&&(m=function(t,e,s,n){var r,o,a,h=[];for(r=0,o=e.length;r80*s){r=a=t[0],o=h=t[1];for(var x=s;xa&&(a=c),d>h&&(h=d);p=0!==(p=Math.max(a-r,h-o))?32767/p:0}return n(m,y,s,r,o,p,0),y}function i(t,e,i,s,n){var r,o;if(n===C(t,e,i,s)>0)for(r=e;r=e;r-=s)o=S(r,t[r],t[r+1],o);return o&&m(o,o.next)&&(E(o),o=o.next),o}function s(t,e){if(!t)return t;e||(e=t);var i,s=t;do{if(i=!1,s.steiner||!m(s,s.next)&&0!==g(s.prev,s,s.next))s=s.next;else{if(E(s),(s=e=s.prev)===s.next)break;i=!0}}while(i||s!==e);return e}function n(t,e,i,l,u,c,f){if(t){!f&&c&&function(t,e,i,s){var n=t;do{0===n.z&&(n.z=d(n.x,n.y,e,i,s)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,s,n,r,o,a,h,l=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,s=i,a=0,e=0;e0||h>0&&s;)0!==a&&(0===h||!s||i.z<=s.z)?(n=i,i=i.nextZ,a--):(n=s,s=s.nextZ,h--),r?r.nextZ=n:t=n,n.prevZ=r,r=n;i=s}r.nextZ=null,l*=2}while(o>1)}(n)}(t,l,u,c);for(var p,v,g=t;t.prev!==t.next;)if(p=t.prev,v=t.next,c?o(t,l,u,c):r(t))e.push(p.i/i|0),e.push(t.i/i|0),e.push(v.i/i|0),E(t),t=v.next,g=v.next;else if((t=v)===g){f?1===f?n(t=a(s(t),e,i),e,i,l,u,c,2):2===f&&h(t,e,i,l,u,c):n(s(t),e,i,l,u,c,1);break}}}function r(t){var e=t.prev,i=t,s=t.next;if(g(e,i,s)>=0)return!1;for(var n=e.x,r=i.x,o=s.x,a=e.y,h=i.y,l=s.y,u=nr?n>o?n:o:r>o?r:o,f=a>h?a>l?a:l:h>l?h:l,v=s.next;v!==e;){if(v.x>=u&&v.x<=d&&v.y>=c&&v.y<=f&&p(n,a,r,h,o,l,v.x,v.y)&&g(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function o(t,e,i,s){var n=t.prev,r=t,o=t.next;if(g(n,r,o)>=0)return!1;for(var a=n.x,h=r.x,l=o.x,u=n.y,c=r.y,f=o.y,v=ah?a>l?a:l:h>l?h:l,x=u>c?u>f?u:f:c>f?c:f,T=d(v,m,e,i,s),w=d(y,x,e,i,s),b=t.prevZ,S=t.nextZ;b&&b.z>=T&&S&&S.z<=w;){if(b.x>=v&&b.x<=y&&b.y>=m&&b.y<=x&&b!==n&&b!==o&&p(a,u,h,c,l,f,b.x,b.y)&&g(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,S.x>=v&&S.x<=y&&S.y>=m&&S.y<=x&&S!==n&&S!==o&&p(a,u,h,c,l,f,S.x,S.y)&&g(S.prev,S,S.next)>=0)return!1;S=S.nextZ}for(;b&&b.z>=T;){if(b.x>=v&&b.x<=y&&b.y>=m&&b.y<=x&&b!==n&&b!==o&&p(a,u,h,c,l,f,b.x,b.y)&&g(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;S&&S.z<=w;){if(S.x>=v&&S.x<=y&&S.y>=m&&S.y<=x&&S!==n&&S!==o&&p(a,u,h,c,l,f,S.x,S.y)&&g(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function a(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!m(r,o)&&y(r,n,n.next,o)&&w(r,o)&&w(o,r)&&(e.push(r.i/i|0),e.push(n.i/i|0),e.push(o.i/i|0),E(n),E(n.next),n=t=o),n=n.next}while(n!==t);return s(n)}function h(t,e,i,r,o,a){var h=t;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&v(h,l)){var u=b(h,l);return h=s(h,h.next),u=s(u,u.next),n(h,e,i,r,o,a,0),void n(u,e,i,r,o,a,0)}l=l.next}h=h.next}while(h!==t)}function l(t,e){return t.x-e.x}function u(t,e){var i=function(t,e){var i,s=e,n=t.x,r=t.y,o=-1/0;do{if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){var a=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=n&&a>o&&(o=a,i=s.x=s.x&&s.x>=u&&n!==s.x&&p(ri.x||s.x===i.x&&c(i,s)))&&(i=s,f=h)),s=s.next}while(s!==l);return i}(t,e);if(!i)return e;var n=b(i,t);return s(n,n.next),s(i,i.next)}function c(t,e){return g(t.prev,t,e.prev)<0&&g(e.next,t,t.next)<0}function d(t,e,i,s,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function f(t){var e=t,i=t;do{(e.x=(t-o)*(r-a)&&(t-o)*(s-a)>=(i-o)*(e-a)&&(i-o)*(r-a)>=(n-o)*(s-a)}function v(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&y(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(w(t,e)&&w(e,t)&&function(t,e){var i=t,s=!1,n=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&n<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==t);return s}(t,e)&&(g(t.prev,t,e.prev)||g(t,e.prev,e))||m(t,e)&&g(t.prev,t,t.next)>0&&g(e.prev,e,e.next)>0)}function g(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function m(t,e){return t.x===e.x&&t.y===e.y}function y(t,e,i,s){var n=T(g(t,e,i)),r=T(g(t,e,s)),o=T(g(i,s,t)),a=T(g(i,s,e));return n!==r&&o!==a||!(0!==n||!x(t,i,e))||!(0!==r||!x(t,s,e))||!(0!==o||!x(i,t,s))||!(0!==a||!x(i,e,s))}function x(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function T(t){return t>0?1:t<0?-1:0}function w(t,e){return g(t.prev,t,t.next)<0?g(t,e,t.next)>=0&&g(t,t.prev,e)>=0:g(t,e,t.prev)<0||g(t,t.next,e)<0}function b(t,e){var i=new A(t.i,t.x,t.y),s=new A(e.i,e.x,e.y),n=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,s.next=i,i.prev=s,r.next=s,s.prev=r,s}function S(t,e,i,s){var n=new A(t,e,i);return s?(n.next=s.next,n.prev=s,s.next.prev=n,s.next=n):(n.prev=n,n.next=n),n}function E(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function A(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function C(t,e,i,s){for(var n=0,r=e,o=i-s;r0&&(s+=t[n-1].length,i.holes.push(s))}return i},t.exports=e},13829:(t,e,i)=>{var s=i(87841);t.exports=function(t,e){void 0===e&&(e=new s);for(var i,n=1/0,r=1/0,o=-n,a=-r,h=0;h{t.exports=function(t,e){void 0===e&&(e=[]);for(var i=0;i{var s=i(35001),n=i(23031),r=i(30052);t.exports=function(t,e,i,o){void 0===o&&(o=[]);var a=t.points,h=r(t);!e&&i>0&&(e=h/i);for(var l=0;lc+g)){var m=v.getPoint((u-c)/g);o.push(m);break}c+=g}return o}},30052:(t,e,i)=>{var s=i(35001),n=i(23031);t.exports=function(t){for(var e=t.points,i=0,r=0;r{var s=i(83419),n=i(63814),r=i(9564),o=i(23777),a=new s({initialize:function(t){this.type=o.POLYGON,this.area=0,this.points=[],t&&this.setTo(t)},contains:function(t,e){return n(this,t,e)},setTo:function(t){if(this.area=0,this.points=[],"string"==typeof t&&(t=t.split(" ")),!Array.isArray(t))return this;for(var e,i=0;i{t.exports=function(t){return t.points.reverse(),t}},29524:t=>{function e(t,e,i){var s=e.x,n=e.y,r=i.x-s,o=i.y-n;if(0!==r||0!==o){var a=((t.x-s)*r+(t.y-n)*o)/(r*r+o*o);a>1?(s=i.x,n=i.y):a>0&&(s+=r*a,n+=o*a)}return(r=t.x-s)*r+(o=t.y-n)*o}function i(t,s,n,r,o){for(var a,h=r,l=s+1;lh&&(a=l,h=u)}h>r&&(a-s>1&&i(t,s,a,r,o),o.push(t[a]),n-a>1&&i(t,a,n,r,o))}function s(t,e){var s=t.length-1,n=[t[0]];return i(t,0,s,e,n),n.push(t[s]),n}t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=!1);var n=t.points;if(n.length>2){var r=e*e;i||(n=function(t,e){for(var i,s,n,r,o,a=t[0],h=[a],l=1,u=t.length;le&&(h.push(i),a=i);return a!==i&&h.push(i),h}(n,r)),t.setTo(s(n,r))}return t}},5469:t=>{var e=function(t,e){return t[0]=e[0],t[1]=e[1],t};t.exports=function(t){var i,s=[],n=t.points;for(i=0;i0&&r.push(e([0,0],s[0])),i=0;i1&&r.push(e([0,0],s[s.length-1])),t.setTo(r)}},24709:t=>{t.exports=function(t,e,i){for(var s=t.points,n=0;n{var s=i(25717);s.Clone=i(12306),s.Contains=i(63814),s.ContainsPoint=i(99338),s.Earcut=i(94811),s.GetAABB=i(13829),s.GetNumberArray=i(26173),s.GetPoints=i(9564),s.Perimeter=i(30052),s.Reverse=i(8133),s.Simplify=i(29524),s.Smooth=i(5469),s.Translate=i(24709),t.exports=s},62224:t=>{t.exports=function(t){return t.width*t.height}},98615:t=>{t.exports=function(t){return t.x=Math.ceil(t.x),t.y=Math.ceil(t.y),t}},31688:t=>{t.exports=function(t){return t.x=Math.ceil(t.x),t.y=Math.ceil(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),t}},67502:t=>{t.exports=function(t,e,i){return t.x=e-t.width/2,t.y=i-t.height/2,t}},65085:(t,e,i)=>{var s=i(87841);t.exports=function(t){return new s(t.x,t.y,t.width,t.height)}},37303:t=>{t.exports=function(t,e,i){return!(t.width<=0||t.height<=0)&&t.x<=e&&t.x+t.width>=e&&t.y<=i&&t.y+t.height>=i}},96553:(t,e,i)=>{var s=i(37303);t.exports=function(t,e){return s(t,e.x,e.y)}},70273:t=>{t.exports=function(t,e){return!(e.width*e.height>t.width*t.height)&&e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom{t.exports=function(t,e){return e.setTo(t.x,t.y,t.width,t.height)}},77493:t=>{t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x,y:t.y}),e.push({x:t.right,y:t.y}),e.push({x:t.right,y:t.bottom}),e.push({x:t.x,y:t.bottom}),e}},9219:t=>{t.exports=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}},53751:(t,e,i)=>{var s=i(8249);t.exports=function(t,e){var i=s(t);return i{var s=i(8249);t.exports=function(t,e){var i=s(t);return i>s(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},80774:t=>{t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},83859:t=>{t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},19217:(t,e,i)=>{var s=i(87841),n=i(36383);t.exports=function(t,e){if(void 0===e&&(e=new s),0===t.length)return e;for(var i,r,o,a=Number.MAX_VALUE,h=Number.MAX_VALUE,l=n.MIN_SAFE_INTEGER,u=n.MIN_SAFE_INTEGER,c=0;c{var s=i(87841);t.exports=function(t,e,i,n,r){return void 0===r&&(r=new s),r.setTo(Math.min(t,i),Math.min(e,n),Math.abs(t-i),Math.abs(e-n))}},8249:t=>{t.exports=function(t){return 0===t.height?NaN:t.width/t.height}},27165:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=t.centerX,e.y=t.centerY,e}},20812:(t,e,i)=>{var s=i(13019),n=i(2141);t.exports=function(t,e,i){if(void 0===i&&(i=new n),e<=0||e>=1)return i.x=t.x,i.y=t.y,i;var r=s(t)*e;return e>.5?(r-=t.width+t.height)<=t.width?(i.x=t.right-r,i.y=t.bottom):(i.x=t.x,i.y=t.bottom-(r-t.width)):r<=t.width?(i.x=t.x+r,i.y=t.y):(i.x=t.right,i.y=t.y+(r-t.width)),i}},34819:(t,e,i)=>{var s=i(20812),n=i(13019);t.exports=function(t,e,i,r){void 0===r&&(r=[]),!e&&i>0&&(e=n(t)/i);for(var o=0;o{var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=t.width,e.y=t.height,e}},86091:(t,e,i)=>{var s=i(67502);t.exports=function(t,e,i){var n=t.centerX,r=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),s(t,n,r)}},53951:(t,e,i)=>{var s=i(87841),n=i(59996);t.exports=function(t,e,i){return void 0===i&&(i=new s),n(t,e)?(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y):i.setEmpty(),i}},14649:(t,e,i)=>{var s=i(13019),n=i(2141);t.exports=function(t,e,i,r){if(void 0===r&&(r=[]),!e&&!i)return r;e?i=Math.round(s(t)/e):e=s(t)/i;for(var o=t.x,a=t.y,h=0,l=0;l=t.right&&(h=1,a+=o-t.right,o=t.right);break;case 1:(a+=e)>=t.bottom&&(h=2,o-=a-t.bottom,a=t.bottom);break;case 2:(o-=e)<=t.left&&(h=3,a-=t.left-o,o=t.left);break;case 3:(a-=e)<=t.top&&(h=0,a=t.top)}return r}},33595:t=>{t.exports=function(t,e){for(var i=t.x,s=t.right,n=t.y,r=t.bottom,o=0;o{t.exports=function(t,e){var i=Math.min(t.x,e.x),s=Math.max(t.right,e.right);t.x=i,t.width=s-i;var n=Math.min(t.y,e.y),r=Math.max(t.bottom,e.bottom);return t.y=n,t.height=r-n,t}},92171:t=>{t.exports=function(t,e,i){var s=Math.min(t.x,e),n=Math.max(t.right,e);t.x=s,t.width=n-s;var r=Math.min(t.y,i),o=Math.max(t.bottom,i);return t.y=r,t.height=o-r,t}},42981:t=>{t.exports=function(t,e,i){return t.x+=e,t.y+=i,t}},46907:t=>{t.exports=function(t,e){return t.x+=e.x,t.y+=e.y,t}},60170:t=>{t.exports=function(t,e){return t.xe.x&&t.ye.y}},13019:t=>{t.exports=function(t){return 2*(t.width+t.height)}},85133:(t,e,i)=>{var s=i(2141),n=i(39506);t.exports=function(t,e,i){void 0===i&&(i=new s),e=n(e);var r=Math.sin(e),o=Math.cos(e),a=o>0?t.width/2:t.width/-2,h=r>0?t.height/2:t.height/-2;return Math.abs(a*r){var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=t.x+Math.random()*t.width,e.y=t.y+Math.random()*t.height,e}},86470:(t,e,i)=>{var s=i(30976),n=i(70273),r=i(2141);t.exports=function(t,e,i){if(void 0===i&&(i=new r),n(t,e))switch(s(0,3)){case 0:i.x=t.x+Math.random()*(e.right-t.x),i.y=t.y+Math.random()*(e.top-t.y);break;case 1:i.x=e.x+Math.random()*(t.right-e.x),i.y=e.bottom+Math.random()*(t.bottom-e.bottom);break;case 2:i.x=t.x+Math.random()*(e.x-t.x),i.y=e.y+Math.random()*(t.bottom-e.y);break;case 3:i.x=e.right+Math.random()*(t.right-e.right),i.y=t.y+Math.random()*(e.bottom-t.y)}return i}},87841:(t,e,i)=>{var s=i(83419),n=i(37303),r=i(20812),o=i(34819),a=i(23777),h=i(23031),l=i(26597),u=new s({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.type=a.RECTANGLE,this.x=t,this.y=e,this.width=i,this.height=s},contains:function(t,e){return n(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return l(this,t)},setTo:function(t,e,i,s){return this.x=t,this.y=e,this.width=i,this.height=s,this},setEmpty:function(){return this.setTo(0,0,0,0)},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getLineA:function(t){return void 0===t&&(t=new h),t.setTo(this.x,this.y,this.right,this.y),t},getLineB:function(t){return void 0===t&&(t=new h),t.setTo(this.right,this.y,this.right,this.bottom),t},getLineC:function(t){return void 0===t&&(t=new h),t.setTo(this.right,this.bottom,this.x,this.bottom),t},getLineD:function(t){return void 0===t&&(t=new h),t.setTo(this.x,this.bottom,this.x,this.y),t},left:{get:function(){return this.x},set:function(t){t>=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?this.height=0:this.height=this.bottom-t,this.y=t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=u},94845:t=>{t.exports=function(t,e){return t.width===e.width&&t.height===e.height}},31730:t=>{t.exports=function(t,e,i){return void 0===i&&(i=e),t.width*=e,t.height*=i,t}},36899:(t,e,i)=>{var s=i(87841);t.exports=function(t,e,i){void 0===i&&(i=new s);var n=Math.min(t.x,e.x),r=Math.min(t.y,e.y),o=Math.max(t.right,e.right)-n,a=Math.max(t.bottom,e.bottom)-r;return i.setTo(n,r,o,a)}},93232:(t,e,i)=>{var s=i(87841);s.Area=i(62224),s.Ceil=i(98615),s.CeilAll=i(31688),s.CenterOn=i(67502),s.Clone=i(65085),s.Contains=i(37303),s.ContainsPoint=i(96553),s.ContainsRect=i(70273),s.CopyFrom=i(43459),s.Decompose=i(77493),s.Equals=i(9219),s.FitInside=i(53751),s.FitOutside=i(16088),s.Floor=i(80774),s.FloorAll=i(83859),s.FromPoints=i(19217),s.FromXY=i(9477),s.GetAspectRatio=i(8249),s.GetCenter=i(27165),s.GetPoint=i(20812),s.GetPoints=i(34819),s.GetSize=i(51313),s.Inflate=i(86091),s.Intersection=i(53951),s.MarchingAnts=i(14649),s.MergePoints=i(33595),s.MergeRect=i(20074),s.MergeXY=i(92171),s.Offset=i(42981),s.OffsetPoint=i(46907),s.Overlaps=i(60170),s.Perimeter=i(13019),s.PerimeterPoint=i(85133),s.Random=i(26597),s.RandomOutside=i(86470),s.SameDimensions=i(94845),s.Scale=i(31730),s.Union=i(36899),t.exports=s},41658:t=>{t.exports=function(t){var e=t.x1,i=t.y1,s=t.x2,n=t.y2,r=t.x3,o=t.y3;return Math.abs(((r-e)*(n-i)-(s-e)*(o-i))/2)}},39208:(t,e,i)=>{var s=i(16483);t.exports=function(t,e,i){var n=i*(Math.sqrt(3)/2);return new s(t,e,t+i/2,e+n,t-i/2,e+n)}},39545:(t,e,i)=>{var s=i(94811),n=i(16483);t.exports=function(t,e,i,r,o){void 0===e&&(e=null),void 0===i&&(i=1),void 0===r&&(r=1),void 0===o&&(o=[]);for(var a,h,l,u,c,d,f,p,v,g=s(t,e),m=0;m{var s=i(16483);t.exports=function(t,e,i,n){return void 0===n&&(n=i),new s(t,e,t,e-n,t+i,e)}},23707:(t,e,i)=>{var s=i(97523),n=i(13584);t.exports=function(t,e,i,r){void 0===r&&(r=s);var o=r(t),a=e-o.x,h=i-o.y;return n(t,a,h)}},97523:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){return void 0===e&&(e=new s),e.x=(t.x1+t.x2+t.x3)/3,e.y=(t.y1+t.y2+t.y3)/3,e}},24951:(t,e,i)=>{var s=i(26099);function n(t,e,i,s){return t*s-e*i}t.exports=function(t,e){void 0===e&&(e=new s);var i=t.x3,r=t.y3,o=t.x1-i,a=t.y1-r,h=t.x2-i,l=t.y2-r,u=2*n(o,a,h,l),c=n(a,o*o+a*a,l,h*h+l*l),d=n(o,o*o+a*a,h,h*h+l*l);return e.x=i-c/u,e.y=r+d/u,e}},85614:(t,e,i)=>{var s=i(96503);t.exports=function(t,e){void 0===e&&(e=new s);var i,n,r=t.x1,o=t.y1,a=t.x2,h=t.y2,l=t.x3,u=t.y3,c=a-r,d=h-o,f=l-r,p=u-o,v=c*(r+a)+d*(o+h),g=f*(r+l)+p*(o+u),m=2*(c*(u-h)-d*(l-a));if(Math.abs(m)<1e-6){var y=Math.min(r,a,l),x=Math.min(o,h,u);i=.5*(Math.max(r,a,l)-y),n=.5*(Math.max(o,h,u)-x),e.x=y+i,e.y=x+n,e.radius=Math.sqrt(i*i+n*n)}else e.x=(p*v-d*g)/m,e.y=(c*g-f*v)/m,i=e.x-r,n=e.y-o,e.radius=Math.sqrt(i*i+n*n);return e}},74422:(t,e,i)=>{var s=i(16483);t.exports=function(t){return new s(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}},10690:t=>{t.exports=function(t,e,i){var s=t.x3-t.x1,n=t.y3-t.y1,r=t.x2-t.x1,o=t.y2-t.y1,a=e-t.x1,h=i-t.y1,l=s*s+n*n,u=s*r+n*o,c=s*a+n*h,d=r*r+o*o,f=r*a+o*h,p=l*d-u*u,v=0===p?0:1/p,g=(d*c-u*f)*v,m=(l*f-u*c)*v;return g>=0&&m>=0&&g+m<1}},48653:t=>{t.exports=function(t,e,i,s){void 0===i&&(i=!1),void 0===s&&(s=[]);for(var n,r,o,a,h,l,u=t.x3-t.x1,c=t.y3-t.y1,d=t.x2-t.x1,f=t.y2-t.y1,p=u*u+c*c,v=u*d+c*f,g=d*d+f*f,m=p*g-v*v,y=0===m?0:1/m,x=t.x1,T=t.y1,w=0;w=0&&r>=0&&n+r<1&&(s.push({x:e[w].x,y:e[w].y}),i)));w++);return s}},96006:(t,e,i)=>{var s=i(10690);t.exports=function(t,e){return s(t,e.x,e.y)}},71326:t=>{t.exports=function(t,e){return e.setTo(t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}},71694:t=>{t.exports=function(t,e){return void 0===e&&(e=[]),e.push({x:t.x1,y:t.y1}),e.push({x:t.x2,y:t.y2}),e.push({x:t.x3,y:t.y3}),e}},33522:t=>{t.exports=function(t,e){return t.x1===e.x1&&t.y1===e.y1&&t.x2===e.x2&&t.y2===e.y2&&t.x3===e.x3&&t.y3===e.y3}},20437:(t,e,i)=>{var s=i(2141),n=i(35001);t.exports=function(t,e,i){void 0===i&&(i=new s);var r=t.getLineA(),o=t.getLineB(),a=t.getLineC();if(e<=0||e>=1)return i.x=r.x1,i.y=r.y1,i;var h=n(r),l=n(o),u=n(a),c=(h+l+u)*e,d=0;return ch+l?(d=(c-=h+l)/u,i.x=a.x1+(a.x2-a.x1)*d,i.y=a.y1+(a.y2-a.y1)*d):(d=(c-=h)/l,i.x=o.x1+(o.x2-o.x1)*d,i.y=o.y1+(o.y2-o.y1)*d),i}},80672:(t,e,i)=>{var s=i(35001),n=i(2141);t.exports=function(t,e,i,r){void 0===r&&(r=[]);var o=t.getLineA(),a=t.getLineB(),h=t.getLineC(),l=s(o),u=s(a),c=s(h),d=l+u+c;!e&&i>0&&(e=d/i);for(var f=0;fl+u?(v=(p-=l+u)/c,g.x=h.x1+(h.x2-h.x1)*v,g.y=h.y1+(h.y2-h.y1)*v):(v=(p-=l)/u,g.x=a.x1+(a.x2-a.x1)*v,g.y=a.y1+(a.y2-a.y1)*v),r.push(g)}return r}},39757:(t,e,i)=>{var s=i(2141);function n(t,e,i,s){var n=t-i,r=e-s,o=n*n+r*r;return Math.sqrt(o)}t.exports=function(t,e){void 0===e&&(e=new s);var i=t.x1,r=t.y1,o=t.x2,a=t.y2,h=t.x3,l=t.y3,u=n(h,l,o,a),c=n(i,r,h,l),d=n(o,a,i,r),f=u+c+d;return e.x=(i*u+o*c+h*d)/f,e.y=(r*u+a*c+l*d)/f,e}},13584:t=>{t.exports=function(t,e,i){return t.x1+=e,t.y1+=i,t.x2+=e,t.y2+=i,t.x3+=e,t.y3+=i,t}},1376:(t,e,i)=>{var s=i(35001);t.exports=function(t){var e=t.getLineA(),i=t.getLineB(),n=t.getLineC();return s(e)+s(i)+s(n)}},90260:(t,e,i)=>{var s=i(2141);t.exports=function(t,e){void 0===e&&(e=new s);var i=t.x2-t.x1,n=t.y2-t.y1,r=t.x3-t.x1,o=t.y3-t.y1,a=Math.random(),h=Math.random();return a+h>=1&&(a=1-a,h=1-h),e.x=t.x1+(i*a+r*h),e.y=t.y1+(n*a+o*h),e}},52172:(t,e,i)=>{var s=i(99614),n=i(39757);t.exports=function(t,e){var i=n(t);return s(t,i.x,i.y,e)}},49907:(t,e,i)=>{var s=i(99614);t.exports=function(t,e,i){return s(t,e.x,e.y,i)}},99614:t=>{t.exports=function(t,e,i,s){var n=Math.cos(s),r=Math.sin(s),o=t.x1-e,a=t.y1-i;return t.x1=o*n-a*r+e,t.y1=o*r+a*n+i,o=t.x2-e,a=t.y2-i,t.x2=o*n-a*r+e,t.y2=o*r+a*n+i,o=t.x3-e,a=t.y3-i,t.x3=o*n-a*r+e,t.y3=o*r+a*n+i,t}},16483:(t,e,i)=>{var s=i(83419),n=i(10690),r=i(20437),o=i(80672),a=i(23777),h=i(23031),l=i(90260),u=new s({initialize:function(t,e,i,s,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=0),this.type=a.TRIANGLE,this.x1=t,this.y1=e,this.x2=i,this.y2=s,this.x3=n,this.y3=r},contains:function(t,e){return n(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return l(this,t)},setTo:function(t,e,i,s,n,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x1=t,this.y1=e,this.x2=i,this.y2=s,this.x3=n,this.y3=r,this},getLineA:function(t){return void 0===t&&(t=new h),t.setTo(this.x1,this.y1,this.x2,this.y2),t},getLineB:function(t){return void 0===t&&(t=new h),t.setTo(this.x2,this.y2,this.x3,this.y3),t},getLineC:function(t){return void 0===t&&(t=new h),t.setTo(this.x3,this.y3,this.x1,this.y1),t},left:{get:function(){return Math.min(this.x1,this.x2,this.x3)},set:function(t){var e;e=this.x1<=this.x2&&this.x1<=this.x3?this.x1-t:this.x2<=this.x1&&this.x2<=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},right:{get:function(){return Math.max(this.x1,this.x2,this.x3)},set:function(t){var e;e=this.x1>=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t,this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e;e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e;e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t,this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=u},84435:(t,e,i)=>{var s=i(16483);s.Area=i(41658),s.BuildEquilateral=i(39208),s.BuildFromPolygon=i(39545),s.BuildRight=i(90301),s.CenterOn=i(23707),s.Centroid=i(97523),s.CircumCenter=i(24951),s.CircumCircle=i(85614),s.Clone=i(74422),s.Contains=i(10690),s.ContainsArray=i(48653),s.ContainsPoint=i(96006),s.CopyFrom=i(71326),s.Decompose=i(71694),s.Equals=i(33522),s.GetPoint=i(20437),s.GetPoints=i(80672),s.InCenter=i(39757),s.Perimeter=i(1376),s.Offset=i(13584),s.Random=i(90260),s.Rotate=i(52172),s.RotateAroundPoint=i(49907),s.RotateAroundXY=i(99614),t.exports=s},74457:t=>{t.exports=function(t,e,i){return{gameObject:t,enabled:!0,draggable:!1,dropZone:!1,cursor:!1,target:null,camera:null,hitArea:e,hitAreaCallback:i,hitAreaDebug:null,customHitArea:!1,localX:0,localY:0,dragState:0,dragStartX:0,dragStartY:0,dragStartXGlobal:0,dragStartYGlobal:0,dragX:0,dragY:0}}},84409:t=>{t.exports=function(t,e){return function(i,s,n,r){var o=t.getPixelAlpha(s,n,r.texture.key,r.frame.name);return o&&o>=e}}},7003:(t,e,i)=>{var s=i(83419),n=i(93301),r=i(50792),o=i(8214),a=i(8443),h=i(78970),l=i(85098),u=i(42515),c=i(36210),d=i(61340),f=i(85955),p=new s({initialize:function(t,e){this.game=t,this.scaleManager,this.canvas,this.config=e,this.enabled=!0,this.events=new r,this.isOver=!0,this.defaultCursor="",this.keyboard=e.inputKeyboard?new h(this):null,this.mouse=e.inputMouse?new l(this):null,this.touch=e.inputTouch?new c(this):null,this.pointers=[],this.pointersTotal=e.inputActivePointers,e.inputTouch&&1===this.pointersTotal&&(this.pointersTotal=2);for(var i=0;i<=this.pointersTotal;i++){var s=new u(this,i);s.smoothFactor=e.inputSmoothFactor,this.pointers.push(s)}this.mousePointer=e.inputMouse?this.pointers[0]:null,this.activePointer=this.pointers[0],this.globalTopOnly=!0,this.time=0,this._tempPoint={x:0,y:0},this._tempHitTest=[],this._tempMatrix=new d,this._tempMatrix2=new d,this._tempSkip=!1,this.mousePointerContainer=[this.mousePointer],t.events.once(a.BOOT,this.boot,this)},boot:function(){var t=this.game,e=t.events;this.canvas=t.canvas,this.scaleManager=t.scale,this.events.emit(o.MANAGER_BOOT),e.on(a.PRE_RENDER,this.preRender,this),e.once(a.DESTROY,this.destroy,this)},setCanvasOver:function(t){this.isOver=!0,this.events.emit(o.GAME_OVER,t)},setCanvasOut:function(t){this.isOver=!1,this.events.emit(o.GAME_OUT,t)},preRender:function(){var t=this.game.loop.now,e=this.game.loop.delta,i=this.game.scene.getScenes(!0,!0);this.time=t,this.events.emit(o.MANAGER_UPDATE);for(var s=0;s10&&(t=10-this.pointersTotal);for(var i=0;i{var s=i(96503),n=i(87902),r=i(83419),o=i(93301),a=i(74457),h=i(84409),l=i(20339),u=i(8497),c=i(81154),d=i(8214),f=i(50792),p=i(95540),v=i(23777),g=i(89639),m=i(41212),y=i(37277),x=i(87841),T=i(37303),w=i(44594),b=i(16483),S=i(10690),E=new r({Extends:f,initialize:function(t){f.call(this),this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.manager=t.sys.game.input,this.pluginEvents=new f,this.enabled=!0,this.displayList,this.cameras,g.install(this),this.mouse=this.manager.mouse,this.topOnly=!0,this.pollRate=-1,this._pollTimer=0;var e={cancelled:!1};this._eventContainer={stopPropagation:function(){e.cancelled=!0}},this._eventData=e,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this._temp=[],this._tempZones=[],this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],this._draggable=[],this._drag={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._dragState=[],this._over={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._validTypes=["onDown","onUp","onOver","onOut","onMove","onDragStart","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop"],this._updatedThisFrame=!1,t.sys.events.once(w.BOOT,this.boot,this),t.sys.events.on(w.START,this.start,this)},boot:function(){this.cameras=this.systems.cameras,this.displayList=this.systems.displayList,this.systems.events.once(w.DESTROY,this.destroy,this),this.pluginEvents.emit(d.BOOT)},start:function(){var t=this.systems.events;t.on(w.TRANSITION_START,this.transitionIn,this),t.on(w.TRANSITION_OUT,this.transitionOut,this),t.on(w.TRANSITION_COMPLETE,this.transitionComplete,this),t.on(w.PRE_UPDATE,this.preUpdate,this),t.once(w.SHUTDOWN,this.shutdown,this),this.manager.events.on(d.GAME_OUT,this.onGameOut,this),this.manager.events.on(d.GAME_OVER,this.onGameOver,this),this.enabled=!0,this._dragState=[0,0,0,0,0,0,0,0,0,0],this.pluginEvents.emit(d.START)},onGameOver:function(t){this.isActive()&&this.emit(d.GAME_OVER,t.timeStamp,t)},onGameOut:function(t){this.isActive()&&this.emit(d.GAME_OUT,t.timeStamp,t)},preUpdate:function(){this.pluginEvents.emit(d.PRE_UPDATE);var t=this._pendingRemoval,e=this._pendingInsertion,i=t.length,s=e.length;if(0!==i||0!==s){for(var n=this._list,r=0;r-1&&(n.splice(a,1),this.clear(o,!0))}this._pendingRemoval.length=0,this._list=n.concat(e.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.canInput()},updatePoll:function(t,e){if(!this.isActive())return!1;if(this.pluginEvents.emit(d.UPDATE,t,e),this._updatedThisFrame)return this._updatedThisFrame=!1,!1;var i,s=this.manager,n=s.pointers,r=s.pointersTotal;for(i=0;i0){if(this._pollTimer-=e,!(this._pollTimer<0))return!1;this._pollTimer=this.pollRate}var a=!1;for(i=0;i0&&(a=!0)}return a},update:function(t,e){if(!this.isActive())return!1;for(var i=e.length,s=!1,n=0;n0&&(s=!0)}return this._updatedThisFrame=!0,s},clear:function(t,e){void 0===e&&(e=!1),this.disable(t);var i=t.input;i&&(this.removeDebug(t),this.manager.resetCursor(i),i.gameObject=void 0,i.target=void 0,i.hitArea=void 0,i.hitAreaCallback=void 0,i.callbackContext=void 0,t.input=null),e||this.queueForRemoval(t);var s=this._draggable.indexOf(t);return s>-1&&this._draggable.splice(s,1),t},disable:function(t){var e=t.input;e&&(e.enabled=!1,e.dragState=0);for(var i,s=this._drag,n=this._over,r=this.manager,o=0;o-1&&s[o].splice(i,1),(i=n[o].indexOf(t))>-1&&n[o].splice(i,1);return this},enable:function(t,e,i,s){return void 0===s&&(s=!1),t.input?t.input.enabled=!0:this.setHitArea(t,e,i),t.input&&s&&!t.input.dropZone&&(t.input.dropZone=s),this},hitTestPointer:function(t){for(var e=this.cameras.getCamerasBelowPointer(t),i=0;i0)return t.camera=s,n}return t.camera=e[0],[]},processDownEvents:function(t){var e=0,i=this._temp,s=this._eventData,n=this._eventContainer;s.cancelled=!1;for(var r=!1,o=0;o0&&l(t.x,t.y,t.downX,t.downY)>=n||s>0&&e>=t.downTime+s)&&(i=!0),i)return this.setDragState(t,3),this.processDragStartList(t)},processDragStartList:function(t){if(3!==this.getDragState(t))return 0;for(var e=this._drag[t.id],i=0;i1&&(this.sortGameObjects(i,t),this.topOnly&&i.splice(1)),this._drag[t.id]=i,0===this.dragDistanceThreshold&&0===this.dragTimeThreshold?(this.setDragState(t,3),this.processDragStartList(t)):(this.setDragState(t,2),0))},processDragMoveEvent:function(t){if(2===this.getDragState(t)&&this.processDragThresholdEvent(t,this.manager.game.loop.now),4!==this.getDragState(t))return 0;for(var e=this._tempZones,i=this._drag[t.id],s=0;s0?(o.emit(d.GAMEOBJECT_DRAG_LEAVE,t,h),this.emit(d.DRAG_LEAVE,t,o,h),a.target=e[0],h=a.target,o.emit(d.GAMEOBJECT_DRAG_ENTER,t,h),this.emit(d.DRAG_ENTER,t,o,h)):(o.emit(d.GAMEOBJECT_DRAG_LEAVE,t,h),this.emit(d.DRAG_LEAVE,t,o,h),e[0]?(a.target=e[0],h=a.target,o.emit(d.GAMEOBJECT_DRAG_ENTER,t,h),this.emit(d.DRAG_ENTER,t,o,h)):a.target=null)}else!h&&e[0]&&(a.target=e[0],h=a.target,o.emit(d.GAMEOBJECT_DRAG_ENTER,t,h),this.emit(d.DRAG_ENTER,t,o,h));if(o.parentContainer){var u=t.worldX-a.dragStartXGlobal,c=t.worldY-a.dragStartYGlobal,f=o.getParentRotation(),p=u*Math.cos(f)+c*Math.sin(f),v=c*Math.cos(f)-u*Math.sin(f);p*=1/o.parentContainer.scaleX,v*=1/o.parentContainer.scaleY,n=p+a.dragStartX,r=v+a.dragStartY}else n=t.worldX-a.dragX,r=t.worldY-a.dragY;o.emit(d.GAMEOBJECT_DRAG,t,n,r),this.emit(d.DRAG,t,o,n,r)}return i.length},processDragUpEvent:function(t){for(var e=this._drag[t.id],i=0;i0){var r=this.manager,o=this._eventData,a=this._eventContainer;o.cancelled=!1;for(var h=!1,l=0;l0){var n=this.manager,r=this._eventData,o=this._eventContainer;r.cancelled=!1;var a=!1;this.sortGameObjects(e,t);for(var h=0;h0){for(this.sortGameObjects(n,t),e=0;e0){for(this.sortGameObjects(r,t),e=0;e-1&&this._draggable.splice(n,1)}return this},makePixelPerfect:function(t){void 0===t&&(t=1);var e=this.systems.textures;return h(e,t)},setHitArea:function(t,e,i){if(void 0===e)return this.setHitAreaFromTexture(t);Array.isArray(t)||(t=[t]);var s=!1,n=!1,r=!1,o=!1,h=!1,l=!0;if(m(e)&&Object.keys(e).length){var u=e;if(!t.some((function(t){return t.hasOwnProperty("faces")}))){e=p(u,"hitArea",null),i=p(u,"hitAreaCallback",null),h=p(u,"pixelPerfect",!1);var c=p(u,"alphaTolerance",1);h&&(e={},i=this.makePixelPerfect(c))}s=p(u,"draggable",!1),n=p(u,"dropZone",!1),r=p(u,"cursor",!1),o=p(u,"useHandCursor",!1),e&&i||(this.setHitAreaFromTexture(t),l=!1)}else"function"!=typeof e||i||(i=e,e={});for(var d=0;d{var s=i(35154),n={},r={register:function(t,e,i,s,r){n[t]={plugin:e,mapping:i,settingsKey:s,configKey:r}},getPlugin:function(t){return n[t]},install:function(t){var e=t.scene.sys,i=e.settings.input,r=e.game.config;for(var o in n){var a=n[o].plugin,h=n[o].mapping,l=n[o].settingsKey,u=n[o].configKey;s(i,l,r[u])&&(t[h]=new a(t))}},remove:function(t){n.hasOwnProperty(t)&&delete n[t]}};t.exports=r},42515:(t,e,i)=>{var s=i(31040),n=i(83419),r=i(20339),o=i(43855),a=i(47235),h=i(26099),l=i(25892),u=new n({initialize:function(t,e){this.manager=t,this.id=e,this.event,this.downElement,this.upElement,this.camera=null,this.button=0,this.buttons=0,this.position=new h,this.prevPosition=new h,this.midPoint=new h(-1,-1),this.velocity=new h,this.angle=0,this.distance=0,this.smoothFactor=0,this.motionFactor=.2,this.worldX=0,this.worldY=0,this.moveTime=0,this.downX=0,this.downY=0,this.downTime=0,this.upX=0,this.upY=0,this.upTime=0,this.primaryDown=!1,this.isDown=!1,this.wasTouch=!1,this.wasCanceled=!1,this.movementX=0,this.movementY=0,this.identifier=0,this.pointerId=null,this.active=0===e,this.locked=!1,this.deltaX=0,this.deltaY=0,this.deltaZ=0},updateWorldPoint:function(t){var e=t.getWorldPoint(this.x,this.y);return this.worldX=e.x,this.worldY=e.y,this},positionToCamera:function(t,e){return t.getWorldPoint(this.x,this.y,e)},updateMotion:function(){var t=this.position.x,e=this.position.y,i=this.midPoint.x,n=this.midPoint.y;if(t!==i||e!==n){var r=a(this.motionFactor,i,t),h=a(this.motionFactor,n,e);o(r,t,.1)&&(r=t),o(h,e,.1)&&(h=e),this.midPoint.set(r,h);var l=t-r,u=e-h;this.velocity.set(l,u),this.angle=s(r,h,t,e),this.distance=Math.sqrt(l*l+u*u)}},up:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.button=t.button,this.upElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),0===t.button&&(this.primaryDown=!1,this.upX=this.x,this.upY=this.y),0===this.buttons&&(this.isDown=!1,this.upTime=t.timeStamp,this.wasTouch=!1)},down:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.button=t.button,this.downElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),0===t.button&&(this.primaryDown=!0,this.downX=this.x,this.downY=this.y),l.macOS&&t.ctrlKey&&(this.buttons=2,this.primaryDown=!1),this.isDown||(this.isDown=!0,this.downTime=t.timeStamp),this.wasTouch=!1},move:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.manager.transformPointer(this,t.pageX,t.pageY,!0),this.locked&&(this.movementX=t.movementX||t.mozMovementX||t.webkitMovementX||0,this.movementY=t.movementY||t.mozMovementY||t.webkitMovementY||0),this.moveTime=t.timeStamp,this.wasTouch=!1},wheel:function(t){"buttons"in t&&(this.buttons=t.buttons),this.event=t,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.deltaX=t.deltaX,this.deltaY=t.deltaY,this.deltaZ=t.deltaZ,this.wasTouch=!1},touchstart:function(t,e){t.pointerId&&(this.pointerId=t.pointerId),this.identifier=t.identifier,this.target=t.target,this.active=!0,this.buttons=1,this.event=e,this.downElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.primaryDown=!0,this.downX=this.x,this.downY=this.y,this.downTime=e.timeStamp,this.isDown=!0,this.wasTouch=!0,this.wasCanceled=!1,this.updateMotion()},touchmove:function(t,e){this.event=e,this.manager.transformPointer(this,t.pageX,t.pageY,!0),this.moveTime=e.timeStamp,this.wasTouch=!0,this.updateMotion()},touchend:function(t,e){this.buttons=0,this.event=e,this.upElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.primaryDown=!1,this.upX=this.x,this.upY=this.y,this.upTime=e.timeStamp,this.isDown=!1,this.wasTouch=!0,this.wasCanceled=!1,this.active=!1,this.updateMotion()},touchcancel:function(t,e){this.buttons=0,this.event=e,this.upElement=t.target,this.manager.transformPointer(this,t.pageX,t.pageY,!1),this.primaryDown=!1,this.upX=this.x,this.upY=this.y,this.upTime=e.timeStamp,this.isDown=!1,this.wasTouch=!0,this.wasCanceled=!0,this.active=!1},noButtonDown:function(){return 0===this.buttons},leftButtonDown:function(){return!!(1&this.buttons)},rightButtonDown:function(){return!!(2&this.buttons)},middleButtonDown:function(){return!!(4&this.buttons)},backButtonDown:function(){return!!(8&this.buttons)},forwardButtonDown:function(){return!!(16&this.buttons)},leftButtonReleased:function(){return 0===this.button&&!this.isDown},rightButtonReleased:function(){return 2===this.button&&!this.isDown},middleButtonReleased:function(){return 1===this.button&&!this.isDown},backButtonReleased:function(){return 3===this.button&&!this.isDown},forwardButtonReleased:function(){return 4===this.button&&!this.isDown},getDistance:function(){return this.isDown?r(this.downX,this.downY,this.x,this.y):r(this.downX,this.downY,this.upX,this.upY)},getDistanceX:function(){return this.isDown?Math.abs(this.downX-this.x):Math.abs(this.downX-this.upX)},getDistanceY:function(){return this.isDown?Math.abs(this.downY-this.y):Math.abs(this.downY-this.upY)},getDuration:function(){return this.isDown?this.manager.time-this.downTime:this.upTime-this.downTime},getAngle:function(){return this.isDown?s(this.downX,this.downY,this.x,this.y):s(this.downX,this.downY,this.upX,this.upY)},getInterpolatedPosition:function(t,e){void 0===t&&(t=10),void 0===e&&(e=[]);for(var i=this.prevPosition.x,s=this.prevPosition.y,n=this.position.x,r=this.position.y,o=0;o{t.exports={MOUSE_DOWN:0,MOUSE_MOVE:1,MOUSE_UP:2,TOUCH_START:3,TOUCH_MOVE:4,TOUCH_END:5,POINTER_LOCK_CHANGE:6,TOUCH_CANCEL:7,MOUSE_WHEEL:8}},7179:t=>{t.exports="boot"},85375:t=>{t.exports="destroy"},39843:t=>{t.exports="dragend"},23388:t=>{t.exports="dragenter"},16133:t=>{t.exports="drag"},27829:t=>{t.exports="dragleave"},53904:t=>{t.exports="dragover"},56058:t=>{t.exports="dragstart"},2642:t=>{t.exports="drop"},88171:t=>{t.exports="gameobjectdown"},36147:t=>{t.exports="dragend"},71692:t=>{t.exports="dragenter"},96149:t=>{t.exports="drag"},81285:t=>{t.exports="dragleave"},74048:t=>{t.exports="dragover"},21322:t=>{t.exports="dragstart"},49378:t=>{t.exports="drop"},86754:t=>{t.exports="gameobjectmove"},86433:t=>{t.exports="gameobjectout"},60709:t=>{t.exports="gameobjectover"},24081:t=>{t.exports="pointerdown"},11172:t=>{t.exports="pointermove"},18907:t=>{t.exports="pointerout"},95579:t=>{t.exports="pointerover"},35368:t=>{t.exports="pointerup"},26972:t=>{t.exports="wheel"},47078:t=>{t.exports="gameobjectup"},73802:t=>{t.exports="gameobjectwheel"},56718:t=>{t.exports="gameout"},25936:t=>{t.exports="gameover"},27503:t=>{t.exports="boot"},50852:t=>{t.exports="process"},96438:t=>{t.exports="update"},59152:t=>{t.exports="pointerlockchange"},47777:t=>{t.exports="pointerdown"},27957:t=>{t.exports="pointerdownoutside"},19444:t=>{t.exports="pointermove"},54251:t=>{t.exports="pointerout"},18667:t=>{t.exports="pointerover"},27192:t=>{t.exports="pointerup"},24652:t=>{t.exports="pointerupoutside"},45132:t=>{t.exports="wheel"},44512:t=>{t.exports="preupdate"},15757:t=>{t.exports="shutdown"},41637:t=>{t.exports="start"},93802:t=>{t.exports="update"},8214:(t,e,i)=>{t.exports={BOOT:i(7179),DESTROY:i(85375),DRAG_END:i(39843),DRAG_ENTER:i(23388),DRAG:i(16133),DRAG_LEAVE:i(27829),DRAG_OVER:i(53904),DRAG_START:i(56058),DROP:i(2642),GAME_OUT:i(56718),GAME_OVER:i(25936),GAMEOBJECT_DOWN:i(88171),GAMEOBJECT_DRAG_END:i(36147),GAMEOBJECT_DRAG_ENTER:i(71692),GAMEOBJECT_DRAG:i(96149),GAMEOBJECT_DRAG_LEAVE:i(81285),GAMEOBJECT_DRAG_OVER:i(74048),GAMEOBJECT_DRAG_START:i(21322),GAMEOBJECT_DROP:i(49378),GAMEOBJECT_MOVE:i(86754),GAMEOBJECT_OUT:i(86433),GAMEOBJECT_OVER:i(60709),GAMEOBJECT_POINTER_DOWN:i(24081),GAMEOBJECT_POINTER_MOVE:i(11172),GAMEOBJECT_POINTER_OUT:i(18907),GAMEOBJECT_POINTER_OVER:i(95579),GAMEOBJECT_POINTER_UP:i(35368),GAMEOBJECT_POINTER_WHEEL:i(26972),GAMEOBJECT_UP:i(47078),GAMEOBJECT_WHEEL:i(73802),MANAGER_BOOT:i(27503),MANAGER_PROCESS:i(50852),MANAGER_UPDATE:i(96438),POINTER_DOWN:i(47777),POINTER_DOWN_OUTSIDE:i(27957),POINTER_MOVE:i(19444),POINTER_OUT:i(54251),POINTER_OVER:i(18667),POINTER_UP:i(27192),POINTER_UP_OUTSIDE:i(24652),POINTER_WHEEL:i(45132),POINTERLOCK_CHANGE:i(59152),PRE_UPDATE:i(44512),SHUTDOWN:i(15757),START:i(41637),UPDATE:i(93802)}},97421:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e){this.pad=t,this.events=t.events,this.index=e,this.value=0,this.threshold=.1},update:function(t){this.value=t},getValue:function(){return Math.abs(this.value){var s=i(83419),n=i(92734),r=new s({initialize:function(t,e){this.pad=t,this.events=t.manager,this.index=e,this.value=0,this.threshold=1,this.pressed=!1},update:function(t){this.value=t;var e=this.pad,i=this.index;t>=this.threshold?this.pressed||(this.pressed=!0,this.events.emit(n.BUTTON_DOWN,e,this,t),this.pad.emit(n.GAMEPAD_BUTTON_DOWN,i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit(n.BUTTON_UP,e,this,t),this.pad.emit(n.GAMEPAD_BUTTON_UP,i,t,this))},destroy:function(){this.pad=null,this.events=null}});t.exports=r},99125:(t,e,i)=>{var s=i(97421),n=i(28884),r=i(83419),o=i(50792),a=i(26099),h=new r({Extends:o,initialize:function(t,e){o.call(this),this.manager=t,this.pad=e,this.id=e.id,this.index=e.index;for(var i=[],r=0;r=2&&(this.leftStick.set(r[0].getValue(),r[1].getValue()),n>=4&&this.rightStick.set(r[2].getValue(),r[3].getValue()))}},destroy:function(){var t;for(this.removeAllListeners(),this.manager=null,this.pad=null,t=0;t{var s=i(83419),n=i(50792),r=i(92734),o=i(99125),a=i(35154),h=i(89639),l=i(8214),u=new s({Extends:n,initialize:function(t){n.call(this),this.scene=t.scene,this.settings=this.scene.sys.settings,this.sceneInputPlugin=t,this.enabled=!0,this.target,this.gamepads=[],this.queue=[],this.onGamepadHandler,this._pad1,this._pad2,this._pad3,this._pad4,t.pluginEvents.once(l.BOOT,this.boot,this),t.pluginEvents.on(l.START,this.start,this)},boot:function(){var t=this.scene.sys.game,e=this.settings.input,i=t.config;this.enabled=a(e,"gamepad",i.inputGamepad)&&t.device.input.gamepads,this.target=a(e,"gamepad.target",i.inputGamepadEventTarget),this.sceneInputPlugin.pluginEvents.once(l.DESTROY,this.destroy,this)},start:function(){this.enabled&&(this.startListeners(),this.refreshPads()),this.sceneInputPlugin.pluginEvents.once(l.SHUTDOWN,this.shutdown,this)},isActive:function(){return this.enabled&&this.scene.sys.isActive()},startListeners:function(){var t=this,e=this.target,i=function(e){!e.defaultPrevented&&t.isActive()&&(t.refreshPads(),t.queue.push(e))};this.onGamepadHandler=i,e.addEventListener("gamepadconnected",i,!1),e.addEventListener("gamepaddisconnected",i,!1),this.sceneInputPlugin.pluginEvents.on(l.UPDATE,this.update,this)},stopListeners:function(){this.target.removeEventListener("gamepadconnected",this.onGamepadHandler),this.target.removeEventListener("gamepaddisconnected",this.onGamepadHandler),this.sceneInputPlugin.pluginEvents.off(l.UPDATE,this.update);for(var t=0;t{t.exports={UP:12,DOWN:13,LEFT:14,RIGHT:15,SELECT:8,START:9,B:0,A:1,Y:2,X:3,LEFT_SHOULDER:4,RIGHT_SHOULDER:5}},65294:t=>{t.exports={UP:12,DOWN:13,LEFT:14,RIGHT:15,SHARE:8,OPTIONS:9,PS:16,TOUCHBAR:17,X:0,CIRCLE:1,SQUARE:2,TRIANGLE:3,L1:4,R1:5,L2:6,R2:7,L3:10,R3:11,LEFT_STICK_H:0,LEFT_STICK_V:1,RIGHT_STICK_H:2,RIGHT_STICK_V:3}},90089:t=>{t.exports={UP:12,DOWN:13,LEFT:14,RIGHT:15,MENU:16,A:0,B:1,X:2,Y:3,LB:4,RB:5,LT:6,RT:7,BACK:8,START:9,LS:10,RS:11,LEFT_STICK_H:0,LEFT_STICK_V:1,RIGHT_STICK_H:2,RIGHT_STICK_V:3}},64894:(t,e,i)=>{t.exports={DUALSHOCK_4:i(65294),SNES_USB:i(89651),XBOX_360:i(90089)}},46008:t=>{t.exports="down"},7629:t=>{t.exports="up"},42206:t=>{t.exports="connected"},86544:t=>{t.exports="disconnected"},94784:t=>{t.exports="down"},14325:t=>{t.exports="up"},92734:(t,e,i)=>{t.exports={BUTTON_DOWN:i(46008),BUTTON_UP:i(7629),CONNECTED:i(42206),DISCONNECTED:i(86544),GAMEPAD_BUTTON_DOWN:i(94784),GAMEPAD_BUTTON_UP:i(14325)}},48646:(t,e,i)=>{t.exports={Axis:i(97421),Button:i(28884),Events:i(92734),Gamepad:i(99125),GamepadPlugin:i(56654),Configs:i(64894)}},14350:(t,e,i)=>{var s=i(93301),n=i(79291),r={CreatePixelPerfectHandler:i(84409),CreateInteractiveObject:i(74457),Events:i(8214),Gamepad:i(48646),InputManager:i(7003),InputPlugin:i(48205),InputPluginCache:i(89639),Keyboard:i(51442),Mouse:i(87078),Pointer:i(42515),Touch:i(95618)};r=n(!1,r,s),t.exports=r},78970:(t,e,i)=>{var s=i(72905),n=i(83419),r=i(8443),o=i(8214),a=i(46032),h=i(29747),l=new n({initialize:function(t){this.manager=t,this.queue=[],this.preventDefault=!0,this.captures=[],this.enabled=!1,this.target,this.onKeyDown=h,this.onKeyUp=h,t.events.once(o.MANAGER_BOOT,this.boot,this)},boot:function(){var t=this.manager.config;this.enabled=t.inputKeyboard,this.target=t.inputKeyboardEventTarget,this.addCapture(t.inputKeyboardCapture),!this.target&&window&&(this.target=window),this.enabled&&this.target&&this.startListeners(),this.manager.game.events.on(r.POST_STEP,this.postUpdate,this)},startListeners:function(){var t=this;this.onKeyDown=function(e){if(!e.defaultPrevented&&t.enabled&&t.manager){t.queue.push(e),t.manager.events.emit(o.MANAGER_PROCESS);var i=e.altKey||e.ctrlKey||e.shiftKey||e.metaKey;t.preventDefault&&!i&&t.captures.indexOf(e.keyCode)>-1&&e.preventDefault()}},this.onKeyUp=function(e){if(!e.defaultPrevented&&t.enabled&&t.manager){t.queue.push(e),t.manager.events.emit(o.MANAGER_PROCESS);var i=e.altKey||e.ctrlKey||e.shiftKey||e.metaKey;t.preventDefault&&!i&&t.captures.indexOf(e.keyCode)>-1&&e.preventDefault()}};var e=this.target;e&&(e.addEventListener("keydown",this.onKeyDown,!1),e.addEventListener("keyup",this.onKeyUp,!1),this.enabled=!0)},stopListeners:function(){var t=this.target;t.removeEventListener("keydown",this.onKeyDown,!1),t.removeEventListener("keyup",this.onKeyUp,!1),this.enabled=!1},postUpdate:function(){this.queue=[]},addCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},removeCapture:function(t){"string"==typeof t&&(t=t.split(",")),Array.isArray(t)||(t=[t]);for(var e=this.captures,i=0;i0},clearCaptures:function(){this.captures=[],this.preventDefault=!1},destroy:function(){this.stopListeners(),this.clearCaptures(),this.queue=[],this.manager.game.events.off(r.POST_RENDER,this.postUpdate,this),this.target=null,this.enabled=!1,this.manager=null}});t.exports=l},28846:(t,e,i)=>{var s=i(83419),n=i(50792),r=i(95922),o=i(8443),a=i(35154),h=i(8214),l=i(89639),u=i(30472),c=i(46032),d=i(87960),f=i(74600),p=i(44594),v=i(56583),g=new s({Extends:n,initialize:function(t){n.call(this),this.game=t.systems.game,this.scene=t.scene,this.settings=this.scene.sys.settings,this.sceneInputPlugin=t,this.manager=t.manager.keyboard,this.enabled=!0,this.keys=[],this.combos=[],this.prevCode=null,this.prevTime=0,this.prevType=null,t.pluginEvents.once(h.BOOT,this.boot,this),t.pluginEvents.on(h.START,this.start,this)},boot:function(){var t=this.settings.input;this.enabled=a(t,"keyboard",!0);var e=a(t,"keyboard.capture",null);e&&this.addCaptures(e),this.sceneInputPlugin.pluginEvents.once(h.DESTROY,this.destroy,this)},start:function(){this.sceneInputPlugin.manager.events.on(h.MANAGER_PROCESS,this.update,this),this.sceneInputPlugin.pluginEvents.once(h.SHUTDOWN,this.shutdown,this),this.game.events.on(o.BLUR,this.resetKeys,this),this.scene.sys.events.on(p.PAUSE,this.resetKeys,this),this.scene.sys.events.on(p.SLEEP,this.resetKeys,this)},isActive:function(){return this.enabled&&this.scene.sys.canInput()},addCapture:function(t){return this.manager.addCapture(t),this},removeCapture:function(t){return this.manager.removeCapture(t),this},getCaptures:function(){return this.manager.captures},enableGlobalCapture:function(){return this.manager.preventDefault=!0,this},disableGlobalCapture:function(){return this.manager.preventDefault=!1,this},clearCaptures:function(){return this.manager.clearCaptures(),this},createCursorKeys:function(){return this.addKeys({up:c.UP,down:c.DOWN,left:c.LEFT,right:c.RIGHT,space:c.SPACE,shift:c.SHIFT})},addKeys:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1);var s={};if("string"==typeof t){t=t.split(",");for(var n=0;n-1?s[n]=t:s[t.keyCode]=t,e&&this.addCapture(t.keyCode),t.setEmitOnRepeat(i),t}return"string"==typeof t&&(t=c[t.toUpperCase()]),s[t]||(s[t]=new u(this,t),e&&this.addCapture(t),s[t].setEmitOnRepeat(i)),s[t]},removeKey:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var s,n=this.keys;if(t instanceof u){var r=n.indexOf(t);r>-1&&(s=this.keys[r],this.keys[r]=void 0)}else"string"==typeof t&&(t=c[t.toUpperCase()]);return n[t]&&(s=n[t],n[t]=void 0),s&&(s.plugin=null,i&&this.removeCapture(s.keyCode),e&&s.destroy()),this},removeAllKeys:function(t,e){void 0===t&&(t=!1),void 0===e&&(e=!1);for(var i=this.keys,s=0;st._tick)return t._tick=i,!0}return!1},update:function(){var t=this.manager.queue,e=t.length;if(this.isActive()&&0!==e)for(var i=this.keys,s=0;s{t.exports=function(t,e){return e.timeLastMatched=t.timeStamp,e.index++,e.index===e.size||(e.current=e.keyCodes[e.index],!1)}},87960:(t,e,i)=>{var s=i(83419),n=i(95922),r=i(95540),o=i(68769),a=i(92803),h=new s({initialize:function(t,e,i){if(void 0===i&&(i={}),e.length<2)return!1;this.manager=t,this.enabled=!0,this.keyCodes=[];for(var s=0;s{var s=i(66970);t.exports=function(t,e){if(e.matched)return!0;var i=!1,n=!1;if(t.keyCode===e.current)if(e.index>0&&e.maxKeyDelay>0){var r=e.timeLastMatched+e.maxKeyDelay;t.timeStamp<=r&&(n=!0,i=s(t,e))}else n=!0,i=s(t,e);return!n&&e.resetOnWrongKey&&(e.index=0,e.current=e.keyCodes[0]),i&&(e.timeLastMatched=t.timeStamp,e.matched=!0,e.timeMatched=t.timeStamp),i}},92803:t=>{t.exports=function(t){return t.current=t.keyCodes[0],t.index=0,t.timeLastMatched=0,t.matched=!1,t.timeMatched=0,t}},92612:t=>{t.exports="keydown"},23345:t=>{t.exports="keyup"},21957:t=>{t.exports="keycombomatch"},44743:t=>{t.exports="down"},3771:t=>{t.exports="keydown-"},46358:t=>{t.exports="keyup-"},75674:t=>{t.exports="up"},95922:(t,e,i)=>{t.exports={ANY_KEY_DOWN:i(92612),ANY_KEY_UP:i(23345),COMBO_MATCH:i(21957),DOWN:i(44743),KEY_DOWN:i(3771),KEY_UP:i(46358),UP:i(75674)}},51442:(t,e,i)=>{t.exports={Events:i(95922),KeyboardManager:i(78970),KeyboardPlugin:i(28846),Key:i(30472),KeyCodes:i(46032),KeyCombo:i(87960),AdvanceKeyCombo:i(66970),ProcessKeyCombo:i(68769),ResetKeyCombo:i(92803),JustDown:i(90229),JustUp:i(38796),DownDuration:i(37015),UpDuration:i(41170)}},37015:t=>{t.exports=function(t,e){void 0===e&&(e=50);var i=t.plugin.game.loop.time-t.timeDown;return t.isDown&&i{t.exports=function(t){return!!t._justDown&&(t._justDown=!1,!0)}},38796:t=>{t.exports=function(t){return!!t._justUp&&(t._justUp=!1,!0)}},30472:(t,e,i)=>{var s=i(83419),n=i(50792),r=i(95922),o=new s({Extends:n,initialize:function(t,e){n.call(this),this.plugin=t,this.keyCode=e,this.originalEvent=void 0,this.enabled=!0,this.isDown=!1,this.isUp=!0,this.altKey=!1,this.ctrlKey=!1,this.shiftKey=!1,this.metaKey=!1,this.location=0,this.timeDown=0,this.duration=0,this.timeUp=0,this.emitOnRepeat=!1,this.repeats=0,this._justDown=!1,this._justUp=!1,this._tick=-1},setEmitOnRepeat:function(t){return this.emitOnRepeat=t,this},onDown:function(t){this.originalEvent=t,this.enabled&&(this.altKey=t.altKey,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.location=t.location,this.repeats++,this.isDown?this.emitOnRepeat&&this.emit(r.DOWN,this,t):(this.isDown=!0,this.isUp=!1,this.timeDown=t.timeStamp,this.duration=0,this._justDown=!0,this._justUp=!1,this.emit(r.DOWN,this,t)))},onUp:function(t){this.originalEvent=t,this.enabled&&(this.isDown=!1,this.isUp=!0,this.timeUp=t.timeStamp,this.duration=this.timeUp-this.timeDown,this.repeats=0,this._justDown=!1,this._justUp=!0,this._tick=-1,this.emit(r.UP,this,t))},reset:function(){return this.isDown=!1,this.isUp=!0,this.altKey=!1,this.ctrlKey=!1,this.shiftKey=!1,this.metaKey=!1,this.timeDown=0,this.duration=0,this.timeUp=0,this.repeats=0,this._justDown=!1,this._justUp=!1,this._tick=-1,this},getDuration:function(){return this.isDown?this.plugin.game.loop.time-this.timeDown:0},destroy:function(){this.removeAllListeners(),this.originalEvent=null,this.plugin=null}});t.exports=o},46032:t=>{t.exports={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:42,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,NUMPAD_ZERO:96,NUMPAD_ONE:97,NUMPAD_TWO:98,NUMPAD_THREE:99,NUMPAD_FOUR:100,NUMPAD_FIVE:101,NUMPAD_SIX:102,NUMPAD_SEVEN:103,NUMPAD_EIGHT:104,NUMPAD_NINE:105,NUMPAD_ADD:107,NUMPAD_SUBTRACT:109,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,SEMICOLON:186,PLUS:187,COMMA:188,MINUS:189,PERIOD:190,FORWARD_SLASH:191,BACK_SLASH:220,QUOTES:222,BACKTICK:192,OPEN_BRACKET:219,CLOSED_BRACKET:221,SEMICOLON_FIREFOX:59,COLON:58,COMMA_FIREFOX_WINDOWS:60,COMMA_FIREFOX:62,BRACKET_RIGHT_FIREFOX:174,BRACKET_LEFT_FIREFOX:175}},74600:(t,e,i)=>{var s=i(46032),n={};for(var r in s)n[s[r]]=r;t.exports=n},41170:t=>{t.exports=function(t,e){void 0===e&&(e=50);var i=t.plugin.game.loop.time-t.timeUp;return t.isUp&&i{var s=i(83419),n=i(89357),r=i(8214),o=i(29747),a=new s({initialize:function(t){this.manager=t,this.preventDefaultDown=!0,this.preventDefaultUp=!0,this.preventDefaultMove=!0,this.preventDefaultWheel=!1,this.enabled=!1,this.target,this.locked=!1,this.onMouseMove=o,this.onMouseDown=o,this.onMouseUp=o,this.onMouseDownWindow=o,this.onMouseUpWindow=o,this.onMouseOver=o,this.onMouseOut=o,this.onMouseWheel=o,this.pointerLockChange=o,this.isTop=!0,t.events.once(r.MANAGER_BOOT,this.boot,this)},boot:function(){var t=this.manager.config;this.enabled=t.inputMouse,this.target=t.inputMouseEventTarget,this.passive=t.inputMousePassive,this.preventDefaultDown=t.inputMousePreventDefaultDown,this.preventDefaultUp=t.inputMousePreventDefaultUp,this.preventDefaultMove=t.inputMousePreventDefaultMove,this.preventDefaultWheel=t.inputMousePreventDefaultWheel,this.target?"string"==typeof this.target&&(this.target=document.getElementById(this.target)):this.target=this.manager.game.canvas,t.disableContextMenu&&this.disableContextMenu(),this.enabled&&this.target&&this.startListeners()},disableContextMenu:function(){return this.target.addEventListener("contextmenu",(function(t){return t.preventDefault(),!1})),this},requestPointerLock:function(){if(n.pointerLock){var t=this.target;t.requestPointerLock=t.requestPointerLock||t.mozRequestPointerLock||t.webkitRequestPointerLock,t.requestPointerLock()}},releasePointerLock:function(){n.pointerLock&&(document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.exitPointerLock())},startListeners:function(){var t=this.target;if(t){var e=this,i=this.manager,s=i.canvas,r=window&&window.focus&&i.game.config.autoFocus;this.onMouseMove=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onMouseMove(t),e.preventDefaultMove&&t.preventDefault())},this.onMouseDown=function(t){r&&window.focus(),!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onMouseDown(t),e.preventDefaultDown&&t.target===s&&t.preventDefault())},this.onMouseDownWindow=function(t){t.sourceCapabilities&&t.sourceCapabilities.firesTouchEvents||!t.defaultPrevented&&e.enabled&&i&&i.enabled&&t.target!==s&&i.onMouseDown(t)},this.onMouseUp=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onMouseUp(t),e.preventDefaultUp&&t.target===s&&t.preventDefault())},this.onMouseUpWindow=function(t){t.sourceCapabilities&&t.sourceCapabilities.firesTouchEvents||!t.defaultPrevented&&e.enabled&&i&&i.enabled&&t.target!==s&&i.onMouseUp(t)},this.onMouseOver=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.setCanvasOver(t)},this.onMouseOut=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.setCanvasOut(t)},this.onMouseWheel=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.onMouseWheel(t),e.preventDefaultWheel&&t.target===s&&t.preventDefault()};var o={passive:!0};if(t.addEventListener("mousemove",this.onMouseMove),t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mouseup",this.onMouseUp),t.addEventListener("mouseover",this.onMouseOver,o),t.addEventListener("mouseout",this.onMouseOut,o),this.preventDefaultWheel?t.addEventListener("wheel",this.onMouseWheel,{passive:!1}):t.addEventListener("wheel",this.onMouseWheel,o),window&&i.game.config.inputWindowEvents)try{window.top.addEventListener("mousedown",this.onMouseDownWindow,o),window.top.addEventListener("mouseup",this.onMouseUpWindow,o)}catch(a){window.addEventListener("mousedown",this.onMouseDownWindow,o),window.addEventListener("mouseup",this.onMouseUpWindow,o),this.isTop=!1}n.pointerLock&&(this.pointerLockChange=function(t){var s=e.target;e.locked=document.pointerLockElement===s||document.mozPointerLockElement===s||document.webkitPointerLockElement===s,i.onPointerLockChange(t)},document.addEventListener("pointerlockchange",this.pointerLockChange,!0),document.addEventListener("mozpointerlockchange",this.pointerLockChange,!0),document.addEventListener("webkitpointerlockchange",this.pointerLockChange,!0)),this.enabled=!0}},stopListeners:function(){var t=this.target;t.removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("mouseover",this.onMouseOver),t.removeEventListener("mouseout",this.onMouseOut),window&&((t=this.isTop?window.top:window).removeEventListener("mousedown",this.onMouseDownWindow),t.removeEventListener("mouseup",this.onMouseUpWindow)),n.pointerLock&&(document.removeEventListener("pointerlockchange",this.pointerLockChange,!0),document.removeEventListener("mozpointerlockchange",this.pointerLockChange,!0),document.removeEventListener("webkitpointerlockchange",this.pointerLockChange,!0))},destroy:function(){this.stopListeners(),this.target=null,this.enabled=!1,this.manager=null}});t.exports=a},87078:(t,e,i)=>{t.exports={MouseManager:i(85098)}},36210:(t,e,i)=>{var s=i(83419),n=i(8214),r=i(29747),o=new s({initialize:function(t){this.manager=t,this.capture=!0,this.enabled=!1,this.target,this.onTouchStart=r,this.onTouchStartWindow=r,this.onTouchMove=r,this.onTouchEnd=r,this.onTouchEndWindow=r,this.onTouchCancel=r,this.onTouchCancelWindow=r,this.isTop=!0,t.events.once(n.MANAGER_BOOT,this.boot,this)},boot:function(){var t=this.manager.config;this.enabled=t.inputTouch,this.target=t.inputTouchEventTarget,this.capture=t.inputTouchCapture,this.target?"string"==typeof this.target&&(this.target=document.getElementById(this.target)):this.target=this.manager.game.canvas,t.disableContextMenu&&this.disableContextMenu(),this.enabled&&this.target&&this.startListeners()},disableContextMenu:function(){return this.target.addEventListener("contextmenu",(function(t){return t.preventDefault(),!1})),this},startListeners:function(){var t=this.target;if(t){var e=this,i=this.manager,s=i.canvas,n=window&&window.focus&&i.game.config.autoFocus;this.onTouchMove=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onTouchMove(t),e.capture&&t.cancelable&&t.preventDefault())},this.onTouchStart=function(t){n&&window.focus(),!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onTouchStart(t),e.capture&&t.cancelable&&t.target===s&&t.preventDefault())},this.onTouchStartWindow=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&t.target!==s&&i.onTouchStart(t)},this.onTouchEnd=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onTouchEnd(t),e.capture&&t.cancelable&&t.target===s&&t.preventDefault())},this.onTouchEndWindow=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&t.target!==s&&i.onTouchEnd(t)},this.onTouchCancel=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&(i.onTouchCancel(t),e.capture&&t.preventDefault())},this.onTouchCancelWindow=function(t){!t.defaultPrevented&&e.enabled&&i&&i.enabled&&i.onTouchCancel(t)};var r=this.capture,o={passive:!0},a={passive:!1};if(t.addEventListener("touchstart",this.onTouchStart,r?a:o),t.addEventListener("touchmove",this.onTouchMove,r?a:o),t.addEventListener("touchend",this.onTouchEnd,r?a:o),t.addEventListener("touchcancel",this.onTouchCancel,r?a:o),window&&i.game.config.inputWindowEvents)try{window.top.addEventListener("touchstart",this.onTouchStartWindow,a),window.top.addEventListener("touchend",this.onTouchEndWindow,a),window.top.addEventListener("touchcancel",this.onTouchCancelWindow,a)}catch(h){window.addEventListener("touchstart",this.onTouchStartWindow,a),window.addEventListener("touchend",this.onTouchEndWindow,a),window.addEventListener("touchcancel",this.onTouchCancelWindow,a),this.isTop=!1}this.enabled=!0}},stopListeners:function(){var t=this.target;t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("touchmove",this.onTouchMove),t.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("touchcancel",this.onTouchCancel),window&&((t=this.isTop?window.top:window).removeEventListener("touchstart",this.onTouchStartWindow),t.removeEventListener("touchend",this.onTouchEndWindow),t.removeEventListener("touchcancel",this.onTouchCancelWindow))},destroy:function(){this.stopListeners(),this.target=null,this.enabled=!1,this.manager=null}});t.exports=o},95618:(t,e,i)=>{t.exports={TouchManager:i(36210)}},41299:(t,e,i)=>{var s=i(83419),n=i(23906),r=i(54899),o=i(95540),a=i(98356),h=i(3374),l=i(84376),u=i(92638),c=new s({initialize:function(t,e){if(this.loader=t,this.cache=o(e,"cache",!1),this.type=o(e,"type",!1),!this.type)throw new Error("Invalid File type: "+this.type);this.key=o(e,"key",!1);var i=this.key;if(t.prefix&&""!==t.prefix&&(this.key=t.prefix+i),!this.key)throw new Error("Invalid File key: "+this.key);var s=o(e,"url");void 0===s?s=t.path+i+"."+o(e,"extension",""):"string"!=typeof s||s.match(/^(?:blob:|data:|capacitor:\/\/|http:\/\/|https:\/\/|\/\/)/)||(s=t.path+s),this.url=s,this.src="",this.xhrSettings=u(o(e,"responseType",void 0)),o(e,"xhrSettings",!1)&&(this.xhrSettings=h(this.xhrSettings,o(e,"xhrSettings",{}))),this.xhrLoader=null,this.state="function"==typeof this.url?n.FILE_POPULATED:n.FILE_PENDING,this.bytesTotal=0,this.bytesLoaded=-1,this.percentComplete=-1,this.crossOrigin=void 0,this.data=void 0,this.config=o(e,"config",{}),this.multiFile,this.linkFile,this.base64="string"==typeof s&&0===s.indexOf("data:")},setLink:function(t){this.linkFile=t,t.linkFile=this},resetXHR:function(){this.xhrLoader&&(this.xhrLoader.onload=void 0,this.xhrLoader.onerror=void 0,this.xhrLoader.onprogress=void 0)},load:function(){this.state===n.FILE_POPULATED?this.loader.nextFile(this,!0):(this.state=n.FILE_LOADING,this.src=a(this,this.loader.baseURL),0===this.src.indexOf("data:")&&(this.base64=!0),this.xhrLoader=l(this,this.loader.xhr))},onLoad:function(t,e){var i=t.responseURL&&this.loader.localSchemes.some((function(e){return 0===t.responseURL.indexOf(e)}))&&0===e.target.status,s=!(e.target&&200!==e.target.status)||i;4===t.readyState&&t.status>=400&&t.status<=599&&(s=!1),this.state=n.FILE_LOADED,this.resetXHR(),this.loader.nextFile(this,s)},onBase64Load:function(t){this.xhrLoader=t,this.state=n.FILE_LOADED,this.percentComplete=1,this.loader.emit(r.FILE_PROGRESS,this,this.percentComplete),this.loader.nextFile(this,!0)},onError:function(){this.resetXHR(),this.loader.nextFile(this,!1)},onProgress:function(t){t.lengthComputable&&(this.bytesLoaded=t.loaded,this.bytesTotal=t.total,this.percentComplete=Math.min(this.bytesLoaded/this.bytesTotal,1),this.loader.emit(r.FILE_PROGRESS,this,this.percentComplete))},onProcess:function(){this.state=n.FILE_PROCESSING,this.onProcessComplete()},onProcessComplete:function(){this.state=n.FILE_COMPLETE,this.multiFile&&this.multiFile.onFileComplete(this),this.loader.fileProcessComplete(this)},onProcessError:function(){console.error('Failed to process file: %s "%s"',this.type,this.key),this.state=n.FILE_ERRORED,this.multiFile&&this.multiFile.onFileFailed(this),this.loader.fileProcessComplete(this)},hasCacheConflict:function(){return this.cache&&this.cache.exists(this.key)},addToCache:function(){this.cache&&this.data&&this.cache.add(this.key,this.data)},pendingDestroy:function(t){if(this.state!==n.FILE_PENDING_DESTROY){void 0===t&&(t=this.data);var e=this.key,i=this.type;this.loader.emit(r.FILE_COMPLETE,e,i,t),this.loader.emit(r.FILE_KEY_COMPLETE+i+"-"+e,e,i,t),this.loader.flagForRemoval(this),this.state=n.FILE_PENDING_DESTROY}},destroy:function(){this.loader=null,this.cache=null,this.xhrSettings=null,this.multiFile=null,this.linkFile=null,this.data=null}});c.createObjectURL=function(t,e,i){if("function"==typeof URL)t.src=URL.createObjectURL(e);else{var s=new FileReader;s.onload=function(){t.removeAttribute("crossOrigin"),t.src="data:"+(e.type||i)+";base64,"+s.result.split(",")[1]},s.onerror=t.onerror,s.readAsDataURL(e)}},c.revokeObjectURL=function(t){"function"==typeof URL&&URL.revokeObjectURL(t.src)},t.exports=c},74099:t=>{var e={},i={install:function(t){for(var i in e)t[i]=e[i]},register:function(t,i){e[t]=i},destroy:function(){e={}}};t.exports=i},98356:t=>{t.exports=function(t,e){return!!t.url&&(t.url.match(/^(?:blob:|data:|capacitor:\/\/|http:\/\/|https:\/\/|\/\/)/)?t.url:e+t.url)}},74261:(t,e,i)=>{var s=i(83419),n=i(23906),r=i(35072),o=i(50792),a=i(54899),h=i(74099),l=i(95540),u=i(35154),c=i(37277),d=i(44594),f=i(92638),p=new s({Extends:o,initialize:function(t){o.call(this);var e=t.sys.game.config,i=t.sys.settings.loader;this.scene=t,this.systems=t.sys,this.cacheManager=t.sys.cache,this.textureManager=t.sys.textures,this.sceneManager=t.sys.game.scene,h.install(this),this.prefix="",this.path="",this.baseURL="",this.setBaseURL(l(i,"baseURL",e.loaderBaseURL)),this.setPath(l(i,"path",e.loaderPath)),this.setPrefix(l(i,"prefix",e.loaderPrefix)),this.maxParallelDownloads=l(i,"maxParallelDownloads",e.loaderMaxParallelDownloads),this.xhr=f(l(i,"responseType",e.loaderResponseType),l(i,"async",e.loaderAsync),l(i,"user",e.loaderUser),l(i,"password",e.loaderPassword),l(i,"timeout",e.loaderTimeout),l(i,"withCredentials",e.loaderWithCredentials)),this.crossOrigin=l(i,"crossOrigin",e.loaderCrossOrigin),this.imageLoadType=l(i,"imageLoadType",e.loaderImageLoadType),this.localSchemes=l(i,"localScheme",e.loaderLocalScheme),this.totalToLoad=0,this.progress=0,this.list=new r,this.inflight=new r,this.queue=new r,this._deleteQueue=new r,this.totalFailed=0,this.totalComplete=0,this.state=n.LOADER_IDLE,this.multiKeyIndex=0,t.sys.events.once(d.BOOT,this.boot,this),t.sys.events.on(d.START,this.pluginStart,this)},boot:function(){this.systems.events.once(d.DESTROY,this.destroy,this)},pluginStart:function(){this.systems.events.once(d.SHUTDOWN,this.shutdown,this)},setBaseURL:function(t){return void 0===t&&(t=""),""!==t&&"/"!==t.substr(-1)&&(t=t.concat("/")),this.baseURL=t,this},setPath:function(t){return void 0===t&&(t=""),""!==t&&"/"!==t.substr(-1)&&(t=t.concat("/")),this.path=t,this},setPrefix:function(t){return void 0===t&&(t=""),this.prefix=t,this},setCORS:function(t){return this.crossOrigin=t,this},addFile:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e0},isLoading:function(){return this.state===n.LOADER_LOADING||this.state===n.LOADER_PROCESSING},isReady:function(){return this.state===n.LOADER_IDLE||this.state===n.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit(a.START,this),0===this.list.size?this.loadComplete():(this.state=n.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on(d.UPDATE,this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit(a.PROGRESS,this.progress)},update:function(){this.state===n.LOADER_LOADING&&this.list.size>0&&this.inflight.size{var s=i(79291),n=i(92638);t.exports=function(t,e){var i=void 0===t?n():s({},t);if(e)for(var r in e)void 0!==e[r]&&(i[r]=e[r]);return i}},26430:(t,e,i)=>{var s=i(83419),n=i(23906),r=i(54899),o=new s({initialize:function(t,e,i,s){var r=[];s.forEach((function(t){t&&r.push(t)})),this.loader=t,this.type=e,this.key=i;var o=this.key;t.prefix&&""!==t.prefix&&(this.key=t.prefix+o),this.multiKeyIndex=t.multiKeyIndex++,this.files=r,this.state=n.FILE_PENDING,this.complete=!1,this.pending=r.length,this.failed=0,this.config={},this.baseURL=t.baseURL,this.path=t.path,this.prefix=t.prefix;for(var a=0;a{var s=i(3374);t.exports=function(t,e){var i=s(e,t.xhrSettings);if(!t.base64){var n=new XMLHttpRequest;if(n.open("GET",t.src,i.async,i.user,i.password),n.responseType=t.xhrSettings.responseType,n.timeout=i.timeout,i.headers)for(var r in i.headers)n.setRequestHeader(r,i.headers[r]);return i.header&&i.headerValue&&n.setRequestHeader(i.header,i.headerValue),i.requestedWith&&n.setRequestHeader("X-Requested-With",i.requestedWith),i.overrideMimeType&&n.overrideMimeType(i.overrideMimeType),i.withCredentials&&(n.withCredentials=!0),n.onload=t.onLoad.bind(t,n),n.onerror=t.onError.bind(t,n),n.onprogress=t.onProgress.bind(t),n.ontimeout=t.onError.bind(t,n),n.send(),n}var o=t.url.split(";base64,").pop()||t.url.split(",").pop(),a={responseText:atob(o)};t.onBase64Load(a)}},92638:t=>{t.exports=function(t,e,i,s,n,r){return void 0===t&&(t=""),void 0===e&&(e=!0),void 0===i&&(i=""),void 0===s&&(s=""),void 0===n&&(n=0),void 0===r&&(r=!1),{responseType:t,async:e,user:i,password:s,timeout:n,headers:void 0,header:void 0,headerValue:void 0,requestedWith:!1,overrideMimeType:void 0,withCredentials:r}}},23906:t=>{t.exports={LOADER_IDLE:0,LOADER_LOADING:1,LOADER_PROCESSING:2,LOADER_COMPLETE:3,LOADER_SHUTDOWN:4,LOADER_DESTROYED:5,FILE_PENDING:10,FILE_LOADING:11,FILE_LOADED:12,FILE_FAILED:13,FILE_PROCESSING:14,FILE_ERRORED:16,FILE_COMPLETE:17,FILE_DESTROYED:18,FILE_POPULATED:19,FILE_PENDING_DESTROY:20}},42155:t=>{t.exports="addfile"},38991:t=>{t.exports="complete"},27540:t=>{t.exports="filecomplete"},87464:t=>{t.exports="filecomplete-"},94486:t=>{t.exports="loaderror"},13035:t=>{t.exports="load"},38144:t=>{t.exports="fileprogress"},97520:t=>{t.exports="postprocess"},85595:t=>{t.exports="progress"},55680:t=>{t.exports="start"},54899:(t,e,i)=>{t.exports={ADD:i(42155),COMPLETE:i(38991),FILE_COMPLETE:i(27540),FILE_KEY_COMPLETE:i(87464),FILE_LOAD_ERROR:i(94486),FILE_LOAD:i(13035),FILE_PROGRESS:i(38144),POST_PROCESS:i(97520),PROGRESS:i(85595),START:i(55680)}},14135:(t,e,i)=>{var s=i(83419),n=i(74099),r=i(518),o=i(54899),a=new s({Extends:r,initialize:function(t,e,i,s,n){r.call(this,t,e,i,s,n),this.type="animationJSON"},onProcess:function(){this.loader.once(o.POST_PROCESS,this.onLoadComplete,this),r.prototype.onProcess.call(this)},onLoadComplete:function(){this.loader.systems.anims.fromJSON(this.data)}});n.register("animation",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(518),l=i(26430),u=new s({Extends:l,initialize:function(t,e,i,s,n,u){var c,d;if(a(e)){var f=e;e=r(f,"key"),c=new o(t,{key:e,url:r(f,"textureURL"),extension:r(f,"textureExtension","png"),normalMap:r(f,"normalMap"),xhrSettings:r(f,"textureXhrSettings")}),d=new h(t,{key:e,url:r(f,"atlasURL"),extension:r(f,"atlasExtension","json"),xhrSettings:r(f,"atlasXhrSettings")})}else c=new o(t,e,i,n),d=new h(t,e,s,u);c.linkFile?l.call(this,t,"atlasjson",e,[c,d,c.linkFile]):l.call(this,t,"atlasjson",e,[c,d])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1],i=this.files[2]?this.files[2].data:null;this.loader.textureManager.addAtlas(t.key,t.data,e.data,i),e.addToCache(),this.complete=!0}}});n.register("aseprite",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(518),l=i(26430),u=new s({Extends:l,initialize:function(t,e,i,s,n,u){var c,d;if(a(e)){var f=e;e=r(f,"key"),c=new o(t,{key:e,url:r(f,"textureURL"),extension:r(f,"textureExtension","png"),normalMap:r(f,"normalMap"),xhrSettings:r(f,"textureXhrSettings")}),d=new h(t,{key:e,url:r(f,"atlasURL"),extension:r(f,"atlasExtension","json"),xhrSettings:r(f,"atlasXhrSettings")})}else c=new o(t,e,i,n),d=new h(t,e,s,u);c.linkFile?l.call(this,t,"atlasjson",e,[c,d,c.linkFile]):l.call(this,t,"atlasjson",e,[c,d])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1],i=this.files[2]?this.files[2].data:null;this.loader.textureManager.addAtlas(t.key,t.data,e.data,i),this.complete=!0}}});n.register("atlas",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(26430),l=i(57318),u=new s({Extends:h,initialize:function(t,e,i,s,n,u){var c,d;if(a(e)){var f=e;e=r(f,"key"),c=new o(t,{key:e,url:r(f,"textureURL"),extension:r(f,"textureExtension","png"),normalMap:r(f,"normalMap"),xhrSettings:r(f,"textureXhrSettings")}),d=new l(t,{key:e,url:r(f,"atlasURL"),extension:r(f,"atlasExtension","xml"),xhrSettings:r(f,"atlasXhrSettings")})}else c=new o(t,e,i,n),d=new l(t,e,s,u);c.linkFile?h.call(this,t,"atlasxml",e,[c,d,c.linkFile]):h.call(this,t,"atlasxml",e,[c,d])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1],i=this.files[2]?this.files[2].data:null;this.loader.textureManager.addAtlasXML(t.key,t.data,e.data,i),this.complete=!0}}});n.register("atlasXML",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(89749),l=i(41212),u=new s({Extends:r,initialize:function(t,e,i,s,n){if(l(e)){var o=e;e=a(o,"key"),s=a(o,"xhrSettings"),n=a(o,"context",n)}var h={type:"audio",cache:t.cacheManager.audio,extension:i.type,responseType:"arraybuffer",key:e,url:i.url,xhrSettings:s,config:{context:n}};r.call(this,t,h)},onProcess:function(){this.state=n.FILE_PROCESSING;var t=this;this.config.context.decodeAudioData(this.xhrLoader.response,(function(e){t.data=e,t.onProcessComplete()}),(function(e){console.error("Error decoding audio: "+t.key+" - ",e?e.message:null),t.onProcessError()})),this.config.context=null}});u.create=function(t,e,i,s,n){var r=t.systems.game,o=r.config.audio,c=r.device.audio;l(e)&&(i=a(e,"url",[]),s=a(e,"config",{}));var d=u.getAudioURL(r,i);return d?c.webAudio&&!o.disableWebAudio?new u(t,e,d,n,r.sound.context):new h(t,e,d,s):(console.warn('No audio URLs for "%s" matched this device',e),null)},u.getAudioURL=function(t,e){Array.isArray(e)||(e=[e]);for(var i=0;i{var s=i(21097),n=i(83419),r=i(74099),o=i(95540),a=i(41212),h=i(518),l=i(26430),u=new n({Extends:l,initialize:function(t,e,i,n,r,u,c){if(a(e)){var d=e;e=o(d,"key"),i=o(d,"jsonURL"),n=o(d,"audioURL"),r=o(d,"audioConfig"),u=o(d,"audioXhrSettings"),c=o(d,"jsonXhrSettings")}var f;if(n){var p=s.create(t,e,n,r,u);p&&(f=new h(t,e,i,c),l.call(this,t,"audiosprite",e,[p,f]),this.config.resourceLoad=!1)}else f=new h(t,e,i,c),l.call(this,t,"audiosprite",e,[f]),this.config.resourceLoad=!0,this.config.audioConfig=r,this.config.audioXhrSettings=u},onFileComplete:function(t){if(-1!==this.files.indexOf(t)&&(this.pending--,this.config.resourceLoad&&"json"===t.type&&t.data.hasOwnProperty("resources"))){var e=t.data.resources,i=o(this.config,"audioConfig"),n=o(this.config,"audioXhrSettings"),r=s.create(this.loader,t.key,e,i,n);r&&(this.addToMultiFile(r),this.loader.addFile(r))}},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1];t.addToCache(),e.addToCache(),this.complete=!0}}});r.register("audioSprite",(function(t,e,i,s,n,r){var o,a=this.systems.game,h=a.config.audio,l=a.device.audio;if(h&&h.noAudio||!l.webAudio&&!l.audioData)return this;if(Array.isArray(t))for(var c=0;c{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,n){var o="bin";if(h(e)){var l=e;e=a(l,"key"),i=a(l,"url"),s=a(l,"xhrSettings"),o=a(l,"extension",o),n=a(l,"dataType",n)}var u={type:"binary",cache:t.cacheManager.binary,extension:o,responseType:"arraybuffer",key:e,url:i,xhrSettings:s,config:{dataType:n}};r.call(this,t,u)},onProcess:function(){this.state=n.FILE_PROCESSING;var t=this.config.dataType;this.data=t?new t(this.xhrLoader.response):this.xhrLoader.response,this.onProcessComplete()}});o.register("binary",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(26430),l=i(21859),u=i(57318),c=new s({Extends:h,initialize:function(t,e,i,s,n,l){var c,d;if(a(e)){var f=e;e=r(f,"key"),c=new o(t,{key:e,url:r(f,"textureURL"),extension:r(f,"textureExtension","png"),normalMap:r(f,"normalMap"),xhrSettings:r(f,"textureXhrSettings")}),d=new u(t,{key:e,url:r(f,"fontDataURL"),extension:r(f,"fontDataExtension","xml"),xhrSettings:r(f,"fontDataXhrSettings")})}else c=new o(t,e,i,n),d=new u(t,e,s,l);c.linkFile?h.call(this,t,"bitmapfont",e,[c,d,c.linkFile]):h.call(this,t,"bitmapfont",e,[c,d])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1];t.addToCache();var i=t.cache.get(t.key),s=l(e.data,t.cache.getFrame(t.key),0,0,i);this.loader.cacheManager.bitmapFont.add(t.key,{data:s,texture:t.key,frame:null}),this.complete=!0}}});n.register("bitmapFont",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s){var n="css";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),s=a(o,"xhrSettings"),n=a(o,"extension",n)}var l={type:"script",cache:!1,extension:n,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,l)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=document.createElement("style"),this.data.defer=!1,this.data.innerHTML=this.xhrLoader.responseText,document.head.appendChild(this.data),this.onProcessComplete()}});o.register("css",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(38734),n=i(85722),r=i(83419),o=i(74099),a=i(95540),h=i(19550),l=i(41212),u=i(518),c=i(31403),d=i(46975),f=i(59327),p=i(26430),v=i(82038),g=i(55222),m=new r({Extends:p,initialize:function(t,e,i,s){if(i.multiAtlasURL){var r=new u(t,{key:e,url:i.multiAtlasURL,xhrSettings:s,config:i});p.call(this,t,"texture",e,[r])}else{var o=i.textureURL.substr(i.textureURL.length-3);i.type||(i.type="ktx"===o.toLowerCase()?"KTX":"PVR");var a=new n(t,{key:e,url:i.textureURL,extension:o,xhrSettings:s,config:i});if(i.atlasURL){var h=new u(t,{key:e,url:i.atlasURL,xhrSettings:s,config:i});p.call(this,t,"texture",e,[a,h])}else p.call(this,t,"texture",e,[a])}this.config=i},onFileComplete:function(t){if(-1!==this.files.indexOf(t)){if(this.pending--,!this.config.multiAtlasURL)return;if("json"===t.type&&t.data.hasOwnProperty("textures")){var e=t.data.textures,i=this.config,s=this.loader,r=s.baseURL,o=s.path,h=s.prefix,l=a(i,"multiBaseURL",this.baseURL),u=a(i,"multiPath",this.path),c=a(i,"prefix",this.prefix),d=a(i,"textureXhrSettings");l&&s.setBaseURL(l),u&&s.setPath(u),c&&s.setPrefix(c);for(var f=0;f{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=i(73894),u=new s({Extends:r,initialize:function(t,e,i,s,n){var o="glsl";if(h(e)){var l=e;e=a(l,"key"),i=a(l,"url"),s=a(l,"shaderType","fragment"),n=a(l,"xhrSettings"),o=a(l,"extension",o)}else void 0===s&&(s="fragment");var u={type:"glsl",cache:t.cacheManager.shader,extension:o,responseType:"text",key:e,url:i,config:{shaderType:s},xhrSettings:n};r.call(this,t,u)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()},addToCache:function(){var t=this.data.split("\n"),e=this.extractBlock(t,0);if(e)for(;e;){var i=this.getShaderName(e.header),s=this.getShaderType(e.header),n=this.getShaderUniforms(e.header),r=e.shader;if(this.cache.has(i)){var o=this.cache.get(i);"fragment"===s?o.fragmentSrc=r:o.vertexSrc=r,o.uniforms||(o.uniforms=n)}else"fragment"===s?this.cache.add(i,new l(i,r,"",n)):this.cache.add(i,new l(i,"",r,n));e=this.extractBlock(t,e.offset)}else"fragment"===this.config.shaderType?this.cache.add(this.key,new l(this.key,this.data)):this.cache.add(this.key,new l(this.key,"",this.data))},getShaderName:function(t){for(var e=0;e{var s=i(83419),n=i(54899),r=i(41299),o=i(95540),a=i(98356),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s){if(h(e)){var n=e;e=o(n,"key"),s=o(n,"config",s)}var a={type:"audio",cache:t.cacheManager.audio,extension:i.type,key:e,url:i.url,config:s};r.call(this,t,a),this.locked="ontouchstart"in window,this.loaded=!1,this.filesLoaded=0,this.filesTotal=0},onLoad:function(){this.loaded||(this.loaded=!0,this.loader.nextFile(this,!0))},onError:function(){for(var t=0;t{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s){var n="html";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),s=a(o,"xhrSettings"),n=a(o,"extension",n)}var l={type:"text",cache:t.cacheManager.html,extension:n,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,l)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()}});o.register("html",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,n,o){void 0===s&&(s=512),void 0===n&&(n=512);var l="html";if(h(e)){var u=e;e=a(u,"key"),i=a(u,"url"),o=a(u,"xhrSettings"),l=a(u,"extension",l),s=a(u,"width",s),n=a(u,"height",n)}var c={type:"html",cache:t.textureManager,extension:l,responseType:"text",key:e,url:i,xhrSettings:o,config:{width:s,height:n}};r.call(this,t,c)},onProcess:function(){this.state=n.FILE_PROCESSING;var t=this.config.width,e=this.config.height,i=[];i.push(''),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var s=[i.join("\n")],o=this;try{var a=new window.Blob(s,{type:"image/svg+xml;charset=utf-8"})}catch(h){return o.state=n.FILE_ERRORED,void o.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){r.revokeObjectURL(o.data),o.onProcessComplete()},this.data.onerror=function(){r.revokeObjectURL(o.data),o.onProcessError()},r.createObjectURL(this.data,a,"image/svg+xml")},addToCache:function(){this.cache.addImage(this.key,this.data)}});o.register("htmlTexture",(function(t,e,i,s,n){if(Array.isArray(t))for(var r=0;r{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=i(98356),u=new s({Extends:r,initialize:function t(e,i,s,n,o){var l,u="png";if(h(i)){var c=i;i=a(c,"key"),s=a(c,"url"),l=a(c,"normalMap"),n=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"frameConfig")}Array.isArray(s)&&(l=s[1],s=s[0]);var d={type:"image",cache:e.textureManager,extension:u,responseType:"blob",key:i,url:s,xhrSettings:n,config:o};if(r.call(this,e,d),l){var f=new t(e,this.key,l,n,o);f.type="normalMap",this.setLink(f),e.addFile(f)}this.useImageElementLoad="HTMLImageElement"===e.imageLoadType||this.base64,this.useImageElementLoad&&(this.load=this.loadImage,this.onProcess=this.onProcessImage)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=new Image,this.data.crossOrigin=this.crossOrigin;var t=this;this.data.onload=function(){r.revokeObjectURL(t.data),t.onProcessComplete()},this.data.onerror=function(){r.revokeObjectURL(t.data),t.onProcessError()},r.createObjectURL(this.data,this.xhrLoader.response,"image/png")},onProcessImage:function(){var t=this.state;this.state=n.FILE_PROCESSING,t===n.FILE_LOADED?this.onProcessComplete():this.onProcessError()},loadImage:function(){this.state=n.FILE_LOADING,this.src=l(this,this.loader.baseURL),this.data=new Image,this.data.crossOrigin=this.crossOrigin;var t=this;this.data.onload=function(){t.state=n.FILE_LOADED,t.loader.nextFile(t,!0)},this.data.onerror=function(){t.loader.nextFile(t,!1)},this.data.src=this.src},addToCache:function(){var t=this.linkFile;t?t.state>=n.FILE_COMPLETE&&("spritesheet"===t.type?t.addToCache():"normalMap"===this.type?this.cache.addImage(this.key,t.data,this.data):this.cache.addImage(this.key,this.data,t.data)):this.cache.addImage(this.key,this.data)}});o.register("image",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(35154),l=i(41212),u=new s({Extends:r,initialize:function(t,e,i,s,o){var u="json";if(l(e)){var c=e;e=a(c,"key"),i=a(c,"url"),s=a(c,"xhrSettings"),u=a(c,"extension",u),o=a(c,"dataKey",o)}var d={type:"json",cache:t.cacheManager.json,extension:u,responseType:"text",key:e,url:i,xhrSettings:s,config:o};r.call(this,t,d),l(i)&&(this.data=o?h(i,o):i,this.state=n.FILE_POPULATED)},onProcess:function(){if(this.state!==n.FILE_POPULATED){this.state=n.FILE_PROCESSING;try{var t=JSON.parse(this.xhrLoader.responseText)}catch(i){throw this.onProcessError(),i}var e=this.config;this.data="string"==typeof e?h(t,e,t):t}this.onProcessComplete()}});o.register("json",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(518),l=i(26430),u=new s({Extends:l,initialize:function(t,e,i,s,n,o,u){if(a(e)){var c=e;e=r(c,"key"),i=r(c,"url",!1)?r(c,"url"):r(c,"atlasURL"),o=r(c,"xhrSettings"),s=r(c,"path"),n=r(c,"baseURL"),u=r(c,"textureXhrSettings")}var d=new h(t,e,i,o);l.call(this,t,"multiatlas",e,[d]),this.config.path=s,this.config.baseURL=n,this.config.textureXhrSettings=u},onFileComplete:function(t){if(-1!==this.files.indexOf(t)&&(this.pending--,"json"===t.type&&t.data.hasOwnProperty("textures"))){var e=t.data.textures,i=this.config,s=this.loader,n=s.baseURL,a=s.path,h=s.prefix,l=r(i,"baseURL",this.baseURL),u=r(i,"path",this.path),c=r(i,"prefix",this.prefix),d=r(i,"textureXhrSettings");s.setBaseURL(l),s.setPath(u),s.setPrefix(c);for(var f=0;f{var s=i(83419),n=i(74099),r=i(95540),o=i(41212),a=i(26430),h=i(34328),l=new s({Extends:a,initialize:function(t,e,i,s){var n="js",l=[];if(o(e)){var u=e;e=r(u,"key"),i=r(u,"url"),s=r(u,"xhrSettings"),n=r(u,"extension",n)}Array.isArray(i)||(i=[i]);for(var c=0;c{var s=i(83419),n=i(74099),r=i(95540),o=i(41212),a=i(26430),h=i(85048),l=i(61485),u=i(78776),c=new s({Extends:a,initialize:function(t,e,i,s,n,h){var l,c,d=t.cacheManager.obj;if(o(e)){var f=e;e=r(f,"key"),l=new u(t,{key:e,type:"obj",cache:d,url:r(f,"url"),extension:r(f,"extension","obj"),xhrSettings:r(f,"xhrSettings"),config:{flipUV:r(f,"flipUV",n)}}),(s=r(f,"matURL"))&&(c=new u(t,{key:e,type:"mat",cache:d,url:s,extension:r(f,"matExtension","mat"),xhrSettings:r(f,"xhrSettings")}))}else l=new u(t,{key:e,url:i,type:"obj",cache:d,extension:"obj",xhrSettings:h,config:{flipUV:n}}),s&&(c=new u(t,{key:e,url:s,type:"mat",cache:d,extension:"mat",xhrSettings:h}));a.call(this,t,"obj",e,[l,c])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1],i=h(t.data,t.config.flipUV);e&&(i.materials=l(e.data)),t.cache.add(t.key,i),this.complete=!0}}});n.register("obj",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(23906),r=i(74099),o=i(518),a=new s({Extends:o,initialize:function(t,e,i,s,n){o.call(this,t,e,i,s,n),this.type="packfile"},onProcess:function(){if(this.state!==n.FILE_POPULATED&&(this.state=n.FILE_PROCESSING,this.data=JSON.parse(this.xhrLoader.responseText)),this.data.hasOwnProperty("files")&&this.config){var t={};t[this.config]=this.data,this.data=t}this.loader.addPack(this.data,this.config),this.onProcessComplete()}});r.register("pack",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,o,l){var u="js";if(h(e)){var c=e;e=a(c,"key"),i=a(c,"url"),l=a(c,"xhrSettings"),u=a(c,"extension",u),s=a(c,"start"),o=a(c,"mapping")}var d={type:"plugin",cache:!1,extension:u,responseType:"text",key:e,url:i,xhrSettings:l,config:{start:s,mapping:o}};r.call(this,t,d),"function"==typeof i&&(this.data=i,this.state=n.FILE_POPULATED)},onProcess:function(){var t=this.loader.systems.plugins,e=this.config,i=a(e,"start",!1),s=a(e,"mapping",null);if(this.state===n.FILE_POPULATED)t.install(this.key,this.data,i,s);else{this.state=n.FILE_PROCESSING,this.data=document.createElement("script"),this.data.language="javascript",this.data.type="text/javascript",this.data.defer=!1,this.data.text=this.xhrLoader.responseText,document.head.appendChild(this.data);var r=t.install(this.key,window[this.key],i,s);(i||s)&&(this.loader.systems[s]=r,this.loader.scene[s]=r)}this.onProcessComplete()}});o.register("plugin",(function(t,e,i,s,n){if(Array.isArray(t))for(var r=0;r{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,n){var o="svg";if(h(e)){var l=e;e=a(l,"key"),i=a(l,"url"),s=a(l,"svgConfig",{}),n=a(l,"xhrSettings"),o=a(l,"extension",o)}var u={type:"svg",cache:t.textureManager,extension:o,responseType:"text",key:e,url:i,xhrSettings:n,config:{width:a(s,"width"),height:a(s,"height"),scale:a(s,"scale")}};r.call(this,t,u)},onProcess:function(){this.state=n.FILE_PROCESSING;var t=this.xhrLoader.responseText,e=[t],i=this.config.width,s=this.config.height,o=this.config.scale;t:if(i&&s||o){var a=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("svg")[0],h=a.hasAttribute("viewBox"),l=parseFloat(a.getAttribute("width")),u=parseFloat(a.getAttribute("height"));if(!h&&l&&u)a.setAttribute("viewBox","0 0 "+l+" "+u);else if(h&&!l&&!u){var c=a.getAttribute("viewBox").split(/\s+|,/);l=c[2],u=c[3]}if(o){if(!l||!u)break t;i=l*o,s=u*o}a.setAttribute("width",i.toString()+"px"),a.setAttribute("height",s.toString()+"px"),e=[(new XMLSerializer).serializeToString(a)]}try{var d=new window.Blob(e,{type:"image/svg+xml;charset=utf-8"})}catch(v){return void this.onProcessError()}this.data=new Image,this.data.crossOrigin=this.crossOrigin;var f=this,p=!1;this.data.onload=function(){p||r.revokeObjectURL(f.data),f.onProcessComplete()},this.data.onerror=function(){p?f.onProcessError():(p=!0,r.revokeObjectURL(f.data),f.data.src="data:image/svg+xml,"+encodeURIComponent(e.join("")))},r.createObjectURL(this.data,d,"image/svg+xml")},addToCache:function(){this.cache.addImage(this.key,this.data)}});o.register("svg",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s){var n="js";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),s=a(o,"xhrSettings"),n=a(o,"extension",n)}var l={type:"text",extension:n,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,l)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()},addToCache:function(){var t=this.data.concat("(function(){\nreturn new "+this.key+"();\n}).call(this);"),e=eval;this.loader.sceneManager.add(this.key,e(t)),this.complete=!0}});o.register("sceneFile",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,o,l){var u="js";if(h(e)){var c=e;e=a(c,"key"),i=a(c,"url"),l=a(c,"xhrSettings"),u=a(c,"extension",u),s=a(c,"systemKey"),o=a(c,"sceneKey")}var d={type:"scenePlugin",cache:!1,extension:u,responseType:"text",key:e,url:i,xhrSettings:l,config:{systemKey:s,sceneKey:o}};r.call(this,t,d),"function"==typeof i&&(this.data=i,this.state=n.FILE_POPULATED)},onProcess:function(){var t=this.loader.systems.plugins,e=this.config,i=this.key,s=a(e,"systemKey",i),r=a(e,"sceneKey",i);this.state===n.FILE_POPULATED?t.installScenePlugin(s,this.data,r,this.loader.scene,!0):(this.state=n.FILE_PROCESSING,this.data=document.createElement("script"),this.data.language="javascript",this.data.type="text/javascript",this.data.defer=!1,this.data.text=this.xhrLoader.responseText,document.head.appendChild(this.data),t.installScenePlugin(s,window[this.key],r,this.loader.scene,!0)),this.onProcessComplete()}});o.register("scenePlugin",(function(t,e,i,s,n){if(Array.isArray(t))for(var r=0;r{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s,n){var o="js";if(h(e)){var l=e;e=a(l,"key"),i=a(l,"url"),s=a(l,"type","script"),n=a(l,"xhrSettings"),o=a(l,"extension",o)}else void 0===s&&(s="script");var u={type:s,cache:!1,extension:o,responseType:"text",key:e,url:i,xhrSettings:n};r.call(this,t,u)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=document.createElement("script"),this.data.language="javascript",this.data.type="text/javascript",this.data.defer=!1,this.data.text=this.xhrLoader.responseText,document.head.appendChild(this.data),this.onProcessComplete()}});o.register("script",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(23906),r=i(74099),o=i(19550),a=new s({Extends:o,initialize:function(t,e,i,s,n){o.call(this,t,e,i,n,s),this.type="spritesheet"},addToCache:function(){var t=this.linkFile;t?t.state>=n.FILE_COMPLETE&&("normalMap"===this.type?this.cache.addSpriteSheet(this.key,t.data,this.config,this.data):this.cache.addSpriteSheet(this.key,this.data,this.config,t.data)):this.cache.addSpriteSheet(this.key,this.data,this.config)}});r.register("spritesheet",(function(t,e,i,s){if(Array.isArray(t))for(var n=0;n{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=new s({Extends:r,initialize:function(t,e,i,s){var n="text",o="txt",l=t.cacheManager.text;if(h(e)){var u=e;e=a(u,"key"),i=a(u,"url"),s=a(u,"xhrSettings"),o=a(u,"extension",o),n=a(u,"type",n),l=a(u,"cache",l)}var c={type:n,cache:l,extension:o,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,c)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()}});o.register("text",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=i(80341),u=new s({Extends:r,initialize:function(t,e,i,s){var n="csv";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),s=a(o,"xhrSettings"),n=a(o,"extension",n)}var u={type:"tilemapCSV",cache:t.cacheManager.tilemap,extension:n,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,u),this.tilemapFormat=l.CSV},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=this.xhrLoader.responseText,this.onProcessComplete()},addToCache:function(){var t={format:this.tilemapFormat,data:this.data};this.cache.add(this.key,t)}});o.register("tilemapCSV",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(74099),r=i(518),o=i(80341),a=new s({Extends:r,initialize:function(t,e,i,s){r.call(this,t,e,i,s),this.type="tilemapJSON",this.cache=t.cacheManager.tilemap},addToCache:function(){var t={format:o.WELTMEISTER,data:this.data};this.cache.add(this.key,t)}});n.register("tilemapImpact",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(74099),r=i(518),o=i(80341),a=new s({Extends:r,initialize:function(t,e,i,s){r.call(this,t,e,i,s),this.type="tilemapJSON",this.cache=t.cacheManager.tilemap},addToCache:function(){var t={format:o.TILED_JSON,data:this.data};this.cache.add(this.key,t)}});n.register("tilemapTiledJSON",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(74099),r=i(95540),o=i(19550),a=i(41212),h=i(26430),l=i(78776),u=new s({Extends:h,initialize:function(t,e,i,s,n,u){var c,d;if(a(e)){var f=e;e=r(f,"key"),c=new o(t,{key:e,url:r(f,"textureURL"),extension:r(f,"textureExtension","png"),normalMap:r(f,"normalMap"),xhrSettings:r(f,"textureXhrSettings")}),d=new l(t,{key:e,url:r(f,"atlasURL"),extension:r(f,"atlasExtension","txt"),xhrSettings:r(f,"atlasXhrSettings")})}else c=new o(t,e,i,n),d=new l(t,e,s,u);c.linkFile?h.call(this,t,"unityatlas",e,[c,d,c.linkFile]):h.call(this,t,"unityatlas",e,[c,d])},addToCache:function(){if(this.isReadyToProcess()){var t=this.files[0],e=this.files[1],i=this.files[2]?this.files[2].data:null;this.loader.textureManager.addUnityAtlas(t.key,t.data,e.data,i),this.complete=!0}}});n.register("unityAtlas",(function(t,e,i,s,n){var r;if(Array.isArray(t))for(var o=0;o{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(98356),h=i(95540),l=i(41212),u=new s({Extends:r,initialize:function(t,e,i,s){if(void 0===s&&(s=!1),l(e)){var n=e;e=h(n,"key"),i=h(n,"url",[]),s=h(n,"noAudio",!1)}var o=t.systems.game.device.video.getVideoURL(i);o||console.warn("VideoFile: No supported format for "+e);var a={type:"video",cache:t.cacheManager.video,extension:o.type,key:e,url:o.url,config:{noAudio:s}};r.call(this,t,a)},onProcess:function(){this.data={url:this.src,noAudio:this.config.noAudio,crossOrigin:this.crossOrigin},this.onProcessComplete()},load:function(){this.src=a(this,this.loader.baseURL),this.state=n.FILE_LOADED,this.loader.nextFile(this,!0)}});o.register("video",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{var s=i(83419),n=i(23906),r=i(41299),o=i(74099),a=i(95540),h=i(41212),l=i(56836),u=new s({Extends:r,initialize:function(t,e,i,s){var n="xml";if(h(e)){var o=e;e=a(o,"key"),i=a(o,"url"),s=a(o,"xhrSettings"),n=a(o,"extension",n)}var l={type:"xml",cache:t.cacheManager.xml,extension:n,responseType:"text",key:e,url:i,xhrSettings:s};r.call(this,t,l)},onProcess:function(){this.state=n.FILE_PROCESSING,this.data=l(this.xhrLoader.responseText),this.data?this.onProcessComplete():this.onProcessError()}});o.register("xml",(function(t,e,i){if(Array.isArray(t))for(var s=0;s{t.exports={AnimationJSONFile:i(14135),AsepriteFile:i(76272),AtlasJSONFile:i(38734),AtlasXMLFile:i(74599),AudioFile:i(21097),AudioSpriteFile:i(89524),BinaryFile:i(85722),BitmapFontFile:i(97025),CompressedTextureFile:i(69559),CSSFile:i(16024),GLSLFile:i(47931),HTML5AudioFile:i(89749),HTMLFile:i(88470),HTMLTextureFile:i(14643),ImageFile:i(19550),JSONFile:i(518),MultiAtlasFile:i(59327),MultiScriptFile:i(99297),OBJFile:i(41846),PackFile:i(58610),PluginFile:i(48988),SceneFile:i(88423),ScenePluginFile:i(56812),ScriptFile:i(34328),SpriteSheetFile:i(85035),SVGFile:i(67397),TextFile:i(78776),TilemapCSVFile:i(49477),TilemapImpactFile:i(40807),TilemapJSONFile:i(56775),UnityAtlasFile:i(25771),VideoFile:i(33720),XMLFile:i(57318)}},57777:(t,e,i)=>{var s=i(23906),n=i(79291),r={Events:i(54899),FileTypes:i(64589),File:i(41299),FileTypesManager:i(74099),GetURL:i(98356),LoaderPlugin:i(74261),MergeXHRSettings:i(3374),MultiFile:i(26430),XHRLoader:i(84376),XHRSettings:i(92638)};r=n(!1,r,s),t.exports=r},53307:t=>{t.exports=function(t){for(var e=0,i=0;i{var s=i(6411);t.exports=function(t,e){return s(t)/s(e)/s(t-e)}},30976:t=>{t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},87842:t=>{t.exports=function(t,e,i,s,n){var r=.5*(s-e),o=.5*(n-i),a=t*t;return(2*i-2*s+r+o)*(t*a)+(-3*i+3*s-2*r-o)*a+r*t+i}},26302:t=>{t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var s=Math.pow(i,-e);return Math.ceil(t*s)/s}},45319:t=>{t.exports=function(t,e,i){return Math.max(e,Math.min(i,t))}},39506:(t,e,i)=>{var s=i(36383);t.exports=function(t){return t*s.DEG_TO_RAD}},61241:t=>{t.exports=function(t,e){return Math.abs(t-e)}},38857:(t,e,i)=>{var s=i(45319),n=i(83419),r=i(37867),o=i(29747),a=new r,h=new n({initialize:function t(e,i,s,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=t.DefaultOrder),this._x=e,this._y=i,this._z=s,this._order=n,this.onChangeCallback=o},x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback(this)}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback(this)}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback(this)}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback(this)}},set:function(t,e,i,s){return void 0===s&&(s=this._order),this._x=t,this._y=e,this._z=i,this._order=s,this.onChangeCallback(this),this},copy:function(t){return this.set(t.x,t.y,t.z,t.order)},setFromQuaternion:function(t,e,i){return void 0===e&&(e=this._order),void 0===i&&(i=!1),a.fromQuat(t),this.setFromRotationMatrix(a,e,i)},setFromRotationMatrix:function(t,e,i){void 0===e&&(e=this._order),void 0===i&&(i=!1);var n=t.val,r=n[0],o=n[4],a=n[8],h=n[1],l=n[5],u=n[9],c=n[2],d=n[6],f=n[10],p=0,v=0,g=0,m=.99999;switch(e){case"XYZ":v=Math.asin(s(a,-1,1)),Math.abs(a){t.exports=function(t){if(0===t)return 1;for(var e=t;--t;)e*=t;return e}},99472:t=>{t.exports=function(t,e){return Math.random()*(e-t)+t}},77623:t=>{t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var s=Math.pow(i,-e);return Math.floor(t*s)/s}},62945:(t,e,i)=>{var s=i(45319);t.exports=function(t,e,i){return(i-e)*(t=s(t,0,1))+e}},38265:t=>{t.exports=function(t,e){return t/e/1e3}},78702:t=>{t.exports=function(t){return t==parseFloat(t)?!(t%2):void 0}},94883:t=>{t.exports=function(t){return t===parseFloat(t)?!(t%2):void 0}},28915:t=>{t.exports=function(t,e,i){return(e-t)*i+t}},94908:t=>{t.exports=function(t,e,i){return void 0===i&&(i=0),t.clone().lerp(e,i)}},94434:(t,e,i)=>{var s=new(i(83419))({initialize:function(t){this.val=new Float32Array(9),t?this.copy(t):this.identity()},clone:function(){return new s(this)},set:function(t){return this.copy(t)},copy:function(t){var e=this.val,i=t.val;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},fromMat4:function(t){var e=t.val,i=this.val;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],this},fromArray:function(t){var e=this.val;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},identity:function(){var t=this.val;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this},transpose:function(){var t=this.val,e=t[1],i=t[2],s=t[5];return t[1]=t[3],t[2]=t[6],t[3]=e,t[5]=t[7],t[6]=i,t[7]=s,this},invert:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=l*r-o*h,c=-l*n+o*a,d=h*n-r*a,f=e*u+i*c+s*d;return f?(f=1/f,t[0]=u*f,t[1]=(-l*i+s*h)*f,t[2]=(o*i-s*r)*f,t[3]=c*f,t[4]=(l*e-s*a)*f,t[5]=(-o*e+s*n)*f,t[6]=d*f,t[7]=(-h*e+i*a)*f,t[8]=(r*e-i*n)*f,this):null},adjoint:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return t[0]=r*l-o*h,t[1]=s*h-i*l,t[2]=i*o-s*r,t[3]=o*a-n*l,t[4]=e*l-s*a,t[5]=s*n-e*o,t[6]=n*h-r*a,t[7]=i*a-e*h,t[8]=e*r-i*n,this},determinant:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return e*(l*r-o*h)+i*(-l*n+o*a)+s*(h*n-r*a)},multiply:function(t){var e=this.val,i=e[0],s=e[1],n=e[2],r=e[3],o=e[4],a=e[5],h=e[6],l=e[7],u=e[8],c=t.val,d=c[0],f=c[1],p=c[2],v=c[3],g=c[4],m=c[5],y=c[6],x=c[7],T=c[8];return e[0]=d*i+f*r+p*h,e[1]=d*s+f*o+p*l,e[2]=d*n+f*a+p*u,e[3]=v*i+g*r+m*h,e[4]=v*s+g*o+m*l,e[5]=v*n+g*a+m*u,e[6]=y*i+x*r+T*h,e[7]=y*s+x*o+T*l,e[8]=y*n+x*a+T*u,this},translate:function(t){var e=this.val,i=t.x,s=t.y;return e[6]=i*e[0]+s*e[3]+e[6],e[7]=i*e[1]+s*e[4]+e[7],e[8]=i*e[2]+s*e[5]+e[8],this},rotate:function(t){var e=this.val,i=e[0],s=e[1],n=e[2],r=e[3],o=e[4],a=e[5],h=Math.sin(t),l=Math.cos(t);return e[0]=l*i+h*r,e[1]=l*s+h*o,e[2]=l*n+h*a,e[3]=l*r-h*i,e[4]=l*o-h*s,e[5]=l*a-h*n,this},scale:function(t){var e=this.val,i=t.x,s=t.y;return e[0]=i*e[0],e[1]=i*e[1],e[2]=i*e[2],e[3]=s*e[3],e[4]=s*e[4],e[5]=s*e[5],this},fromQuat:function(t){var e=t.x,i=t.y,s=t.z,n=t.w,r=e+e,o=i+i,a=s+s,h=e*r,l=e*o,u=e*a,c=i*o,d=i*a,f=s*a,p=n*r,v=n*o,g=n*a,m=this.val;return m[0]=1-(c+f),m[3]=l+g,m[6]=u-v,m[1]=l-g,m[4]=1-(h+f),m[7]=d+p,m[2]=u+v,m[5]=d-p,m[8]=1-(h+c),this},normalFromMat4:function(t){var e=t.val,i=this.val,s=e[0],n=e[1],r=e[2],o=e[3],a=e[4],h=e[5],l=e[6],u=e[7],c=e[8],d=e[9],f=e[10],p=e[11],v=e[12],g=e[13],m=e[14],y=e[15],x=s*h-n*a,T=s*l-r*a,w=s*u-o*a,b=n*l-r*h,S=n*u-o*h,E=r*u-o*l,A=c*g-d*v,C=c*m-f*v,_=c*y-p*v,M=d*m-f*g,P=d*y-p*g,R=f*y-p*m,L=x*R-T*P+w*M+b*_-S*C+E*A;return L?(L=1/L,i[0]=(h*R-l*P+u*M)*L,i[1]=(l*_-a*R-u*C)*L,i[2]=(a*P-h*_+u*A)*L,i[3]=(r*P-n*R-o*M)*L,i[4]=(s*R-r*_+o*C)*L,i[5]=(n*_-s*P-o*A)*L,i[6]=(g*E-m*S+y*b)*L,i[7]=(m*w-v*E-y*T)*L,i[8]=(v*S-g*w+y*x)*L,this):null}});t.exports=s},37867:(t,e,i)=>{var s=i(83419),n=i(25836),r=1e-6,o=new s({initialize:function(t){this.val=new Float32Array(16),t?this.copy(t):this.identity()},clone:function(){return new o(this)},set:function(t){return this.copy(t)},setValues:function(t,e,i,s,n,r,o,a,h,l,u,c,d,f,p,v){var g=this.val;return g[0]=t,g[1]=e,g[2]=i,g[3]=s,g[4]=n,g[5]=r,g[6]=o,g[7]=a,g[8]=h,g[9]=l,g[10]=u,g[11]=c,g[12]=d,g[13]=f,g[14]=p,g[15]=v,this},copy:function(t){var e=t.val;return this.setValues(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},fromArray:function(t){return this.setValues(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},zero:function(){return this.setValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},transform:function(t,e,i){var s=a.fromQuat(i).val,n=e.x,r=e.y,o=e.z;return this.setValues(s[0]*n,s[1]*n,s[2]*n,0,s[4]*r,s[5]*r,s[6]*r,0,s[8]*o,s[9]*o,s[10]*o,0,t.x,t.y,t.z,1)},xyz:function(t,e,i){this.identity();var s=this.val;return s[12]=t,s[13]=e,s[14]=i,this},scaling:function(t,e,i){this.zero();var s=this.val;return s[0]=t,s[5]=e,s[10]=i,s[15]=1,this},identity:function(){return this.setValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},transpose:function(){var t=this.val,e=t[1],i=t[2],s=t[3],n=t[6],r=t[7],o=t[11];return t[1]=t[4],t[2]=t[8],t[3]=t[12],t[4]=e,t[6]=t[9],t[7]=t[13],t[8]=i,t[9]=n,t[11]=t[14],t[12]=s,t[13]=r,t[14]=o,this},getInverse:function(t){return this.copy(t),this.invert()},invert:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],v=t[14],g=t[15],m=e*o-i*r,y=e*a-s*r,x=e*h-n*r,T=i*a-s*o,w=i*h-n*o,b=s*h-n*a,S=l*p-u*f,E=l*v-c*f,A=l*g-d*f,C=u*v-c*p,_=u*g-d*p,M=c*g-d*v,P=m*M-y*_+x*C+T*A-w*E+b*S;return P?(P=1/P,this.setValues((o*M-a*_+h*C)*P,(s*_-i*M-n*C)*P,(p*b-v*w+g*T)*P,(c*w-u*b-d*T)*P,(a*A-r*M-h*E)*P,(e*M-s*A+n*E)*P,(v*x-f*b-g*y)*P,(l*b-c*x+d*y)*P,(r*_-o*A+h*S)*P,(i*A-e*_-n*S)*P,(f*w-p*x+g*m)*P,(u*x-l*w-d*m)*P,(o*E-r*C-a*S)*P,(e*C-i*E+s*S)*P,(p*y-f*T-v*m)*P,(l*T-u*y+c*m)*P)):this},adjoint:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],v=t[14],g=t[15];return this.setValues(o*(c*g-d*v)-u*(a*g-h*v)+p*(a*d-h*c),-(i*(c*g-d*v)-u*(s*g-n*v)+p*(s*d-n*c)),i*(a*g-h*v)-o*(s*g-n*v)+p*(s*h-n*a),-(i*(a*d-h*c)-o*(s*d-n*c)+u*(s*h-n*a)),-(r*(c*g-d*v)-l*(a*g-h*v)+f*(a*d-h*c)),e*(c*g-d*v)-l*(s*g-n*v)+f*(s*d-n*c),-(e*(a*g-h*v)-r*(s*g-n*v)+f*(s*h-n*a)),e*(a*d-h*c)-r*(s*d-n*c)+l*(s*h-n*a),r*(u*g-d*p)-l*(o*g-h*p)+f*(o*d-h*u),-(e*(u*g-d*p)-l*(i*g-n*p)+f*(i*d-n*u)),e*(o*g-h*p)-r*(i*g-n*p)+f*(i*h-n*o),-(e*(o*d-h*u)-r*(i*d-n*u)+l*(i*h-n*o)),-(r*(u*v-c*p)-l*(o*v-a*p)+f*(o*c-a*u)),e*(u*v-c*p)-l*(i*v-s*p)+f*(i*c-s*u),-(e*(o*v-a*p)-r*(i*v-s*p)+f*(i*a-s*o)),e*(o*c-a*u)-r*(i*c-s*u)+l*(i*a-s*o))},determinant:function(){var t=this.val,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],f=t[12],p=t[13],v=t[14],g=t[15];return(e*o-i*r)*(c*g-d*v)-(e*a-s*r)*(u*g-d*p)+(e*h-n*r)*(u*v-c*p)+(i*a-s*o)*(l*g-d*f)-(i*h-n*o)*(l*v-c*f)+(s*h-n*a)*(l*p-u*f)},multiply:function(t){var e=this.val,i=e[0],s=e[1],n=e[2],r=e[3],o=e[4],a=e[5],h=e[6],l=e[7],u=e[8],c=e[9],d=e[10],f=e[11],p=e[12],v=e[13],g=e[14],m=e[15],y=t.val,x=y[0],T=y[1],w=y[2],b=y[3];return e[0]=x*i+T*o+w*u+b*p,e[1]=x*s+T*a+w*c+b*v,e[2]=x*n+T*h+w*d+b*g,e[3]=x*r+T*l+w*f+b*m,x=y[4],T=y[5],w=y[6],b=y[7],e[4]=x*i+T*o+w*u+b*p,e[5]=x*s+T*a+w*c+b*v,e[6]=x*n+T*h+w*d+b*g,e[7]=x*r+T*l+w*f+b*m,x=y[8],T=y[9],w=y[10],b=y[11],e[8]=x*i+T*o+w*u+b*p,e[9]=x*s+T*a+w*c+b*v,e[10]=x*n+T*h+w*d+b*g,e[11]=x*r+T*l+w*f+b*m,x=y[12],T=y[13],w=y[14],b=y[15],e[12]=x*i+T*o+w*u+b*p,e[13]=x*s+T*a+w*c+b*v,e[14]=x*n+T*h+w*d+b*g,e[15]=x*r+T*l+w*f+b*m,this},multiplyLocal:function(t){var e=this.val,i=t.val;return this.setValues(e[0]*i[0]+e[1]*i[4]+e[2]*i[8]+e[3]*i[12],e[0]*i[1]+e[1]*i[5]+e[2]*i[9]+e[3]*i[13],e[0]*i[2]+e[1]*i[6]+e[2]*i[10]+e[3]*i[14],e[0]*i[3]+e[1]*i[7]+e[2]*i[11]+e[3]*i[15],e[4]*i[0]+e[5]*i[4]+e[6]*i[8]+e[7]*i[12],e[4]*i[1]+e[5]*i[5]+e[6]*i[9]+e[7]*i[13],e[4]*i[2]+e[5]*i[6]+e[6]*i[10]+e[7]*i[14],e[4]*i[3]+e[5]*i[7]+e[6]*i[11]+e[7]*i[15],e[8]*i[0]+e[9]*i[4]+e[10]*i[8]+e[11]*i[12],e[8]*i[1]+e[9]*i[5]+e[10]*i[9]+e[11]*i[13],e[8]*i[2]+e[9]*i[6]+e[10]*i[10]+e[11]*i[14],e[8]*i[3]+e[9]*i[7]+e[10]*i[11]+e[11]*i[15],e[12]*i[0]+e[13]*i[4]+e[14]*i[8]+e[15]*i[12],e[12]*i[1]+e[13]*i[5]+e[14]*i[9]+e[15]*i[13],e[12]*i[2]+e[13]*i[6]+e[14]*i[10]+e[15]*i[14],e[12]*i[3]+e[13]*i[7]+e[14]*i[11]+e[15]*i[15])},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.val,s=e.val,n=i[0],r=i[4],o=i[8],a=i[12],h=i[1],l=i[5],u=i[9],c=i[13],d=i[2],f=i[6],p=i[10],v=i[14],g=i[3],m=i[7],y=i[11],x=i[15],T=s[0],w=s[4],b=s[8],S=s[12],E=s[1],A=s[5],C=s[9],_=s[13],M=s[2],P=s[6],R=s[10],L=s[14],O=s[3],F=s[7],D=s[11],k=s[15];return this.setValues(n*T+r*E+o*M+a*O,h*T+l*E+u*M+c*O,d*T+f*E+p*M+v*O,g*T+m*E+y*M+x*O,n*w+r*A+o*P+a*F,h*w+l*A+u*P+c*F,d*w+f*A+p*P+v*F,g*w+m*A+y*P+x*F,n*b+r*C+o*R+a*D,h*b+l*C+u*R+c*D,d*b+f*C+p*R+v*D,g*b+m*C+y*R+x*D,n*S+r*_+o*L+a*k,h*S+l*_+u*L+c*k,d*S+f*_+p*L+v*k,g*S+m*_+y*L+x*k)},translate:function(t){return this.translateXYZ(t.x,t.y,t.z)},translateXYZ:function(t,e,i){var s=this.val;return s[12]=s[0]*t+s[4]*e+s[8]*i+s[12],s[13]=s[1]*t+s[5]*e+s[9]*i+s[13],s[14]=s[2]*t+s[6]*e+s[10]*i+s[14],s[15]=s[3]*t+s[7]*e+s[11]*i+s[15],this},scale:function(t){return this.scaleXYZ(t.x,t.y,t.z)},scaleXYZ:function(t,e,i){var s=this.val;return s[0]=s[0]*t,s[1]=s[1]*t,s[2]=s[2]*t,s[3]=s[3]*t,s[4]=s[4]*e,s[5]=s[5]*e,s[6]=s[6]*e,s[7]=s[7]*e,s[8]=s[8]*i,s[9]=s[9]*i,s[10]=s[10]*i,s[11]=s[11]*i,this},makeRotationAxis:function(t,e){var i=Math.cos(e),s=Math.sin(e),n=1-i,r=t.x,o=t.y,a=t.z,h=n*r,l=n*o;return this.setValues(h*r+i,h*o-s*a,h*a+s*o,0,h*o+s*a,l*o+i,l*a-s*r,0,h*a-s*o,l*a+s*r,n*a*a+i,0,0,0,0,1)},rotate:function(t,e){var i=this.val,s=e.x,n=e.y,o=e.z,a=Math.sqrt(s*s+n*n+o*o);if(Math.abs(a){t.exports=function(t,e,i){return Math.min(t+e,i)}},50040:t=>{t.exports=function(t){var e=t.length;if(0===e)return 0;t.sort((function(t,e){return t-e}));var i=Math.floor(e/2);return e%2==0?(t[i]+t[i-1])/2:t[i]}},37204:t=>{t.exports=function(t,e,i){return Math.max(t-e,i)}},65201:t=>{t.exports=function(t,e,i,s){void 0===i&&(i=e+1);var n=(t-e)/(i-e);return n>1?void 0!==s?(n=(s-t)/(s-i))<0&&(n=0):n=1:n<0&&(n=0),n}},15746:(t,e,i)=>{var s=i(83419),n=i(94434),r=i(29747),o=i(25836),a=1e-6,h=new Int8Array([1,2,0]),l=new Float32Array([0,0,0]),u=new o(1,0,0),c=new o(0,1,0),d=new o,f=new n,p=new s({initialize:function(t,e,i,s){this.onChangeCallback=r,this.set(t,e,i,s)},x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback(this)}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback(this)}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback(this)}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback(this)}},copy:function(t){return this.set(t)},set:function(t,e,i,s,n){return void 0===n&&(n=!0),"object"==typeof t?(this._x=t.x||0,this._y=t.y||0,this._z=t.z||0,this._w=t.w||0):(this._x=t||0,this._y=e||0,this._z=i||0,this._w=s||0),n&&this.onChangeCallback(this),this},add:function(t){return this._x+=t.x,this._y+=t.y,this._z+=t.z,this._w+=t.w,this.onChangeCallback(this),this},subtract:function(t){return this._x-=t.x,this._y-=t.y,this._z-=t.z,this._w-=t.w,this.onChangeCallback(this),this},scale:function(t){return this._x*=t,this._y*=t,this._z*=t,this._w*=t,this.onChangeCallback(this),this},length:function(){var t=this.x,e=this.y,i=this.z,s=this.w;return Math.sqrt(t*t+e*e+i*i+s*s)},lengthSq:function(){var t=this.x,e=this.y,i=this.z,s=this.w;return t*t+e*e+i*i+s*s},normalize:function(){var t=this.x,e=this.y,i=this.z,s=this.w,n=t*t+e*e+i*i+s*s;return n>0&&(n=1/Math.sqrt(n),this._x=t*n,this._y=e*n,this._z=i*n,this._w=s*n),this.onChangeCallback(this),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,s=this.y,n=this.z,r=this.w;return this.set(i+e*(t.x-i),s+e*(t.y-s),n+e*(t.z-n),r+e*(t.w-r))},rotationTo:function(t,e){var i=t.x*e.x+t.y*e.y+t.z*e.z;return i<-.999999?(d.copy(u).cross(t).length().999999?this.set(0,0,0,1):(d.copy(t).cross(e),this._x=d.x,this._y=d.y,this._z=d.z,this._w=1+i,this.normalize())},setAxes:function(t,e,i){var s=f.val;return s[0]=e.x,s[3]=e.y,s[6]=e.z,s[1]=i.x,s[4]=i.y,s[7]=i.z,s[2]=-t.x,s[5]=-t.y,s[8]=-t.z,this.fromMat3(f).normalize()},identity:function(){return this.set(0,0,0,1)},setAxisAngle:function(t,e){e*=.5;var i=Math.sin(e);return this.set(i*t.x,i*t.y,i*t.z,Math.cos(e))},multiply:function(t){var e=this.x,i=this.y,s=this.z,n=this.w,r=t.x,o=t.y,a=t.z,h=t.w;return this.set(e*h+n*r+i*a-s*o,i*h+n*o+s*r-e*a,s*h+n*a+e*o-i*r,n*h-e*r-i*o-s*a)},slerp:function(t,e){var i=this.x,s=this.y,n=this.z,r=this.w,o=t.x,h=t.y,l=t.z,u=t.w,c=i*o+s*h+n*l+r*u;c<0&&(c=-c,o=-o,h=-h,l=-l,u=-u);var d=1-e,f=e;if(1-c>a){var p=Math.acos(c),v=Math.sin(p);d=Math.sin((1-e)*p)/v,f=Math.sin(e*p)/v}return this.set(d*i+f*o,d*s+f*h,d*n+f*l,d*r+f*u)},invert:function(){var t=this.x,e=this.y,i=this.z,s=this.w,n=t*t+e*e+i*i+s*s,r=n?1/n:0;return this.set(-t*r,-e*r,-i*r,s*r)},conjugate:function(){return this._x=-this.x,this._y=-this.y,this._z=-this.z,this.onChangeCallback(this),this},rotateX:function(t){t*=.5;var e=this.x,i=this.y,s=this.z,n=this.w,r=Math.sin(t),o=Math.cos(t);return this.set(e*o+n*r,i*o+s*r,s*o-i*r,n*o-e*r)},rotateY:function(t){t*=.5;var e=this.x,i=this.y,s=this.z,n=this.w,r=Math.sin(t),o=Math.cos(t);return this.set(e*o-s*r,i*o+n*r,s*o+e*r,n*o-i*r)},rotateZ:function(t){t*=.5;var e=this.x,i=this.y,s=this.z,n=this.w,r=Math.sin(t),o=Math.cos(t);return this.set(e*o+i*r,i*o-e*r,s*o+n*r,n*o-s*r)},calculateW:function(){var t=this.x,e=this.y,i=this.z;return this.w=-Math.sqrt(1-t*t-e*e-i*i),this},setFromEuler:function(t,e){var i=t.x/2,s=t.y/2,n=t.z/2,r=Math.cos(i),o=Math.cos(s),a=Math.cos(n),h=Math.sin(i),l=Math.sin(s),u=Math.sin(n);switch(t.order){case"XYZ":this.set(h*o*a+r*l*u,r*l*a-h*o*u,r*o*u+h*l*a,r*o*a-h*l*u,e);break;case"YXZ":this.set(h*o*a+r*l*u,r*l*a-h*o*u,r*o*u-h*l*a,r*o*a+h*l*u,e);break;case"ZXY":this.set(h*o*a-r*l*u,r*l*a+h*o*u,r*o*u+h*l*a,r*o*a-h*l*u,e);break;case"ZYX":this.set(h*o*a-r*l*u,r*l*a+h*o*u,r*o*u-h*l*a,r*o*a+h*l*u,e);break;case"YZX":this.set(h*o*a+r*l*u,r*l*a+h*o*u,r*o*u-h*l*a,r*o*a-h*l*u,e);break;case"XZY":this.set(h*o*a-r*l*u,r*l*a-h*o*u,r*o*u+h*l*a,r*o*a+h*l*u,e)}return this},setFromRotationMatrix:function(t){var e,i=t.val,s=i[0],n=i[4],r=i[8],o=i[1],a=i[5],h=i[9],l=i[2],u=i[6],c=i[10],d=s+a+c;return d>0?(e=.5/Math.sqrt(d+1),this.set((u-h)*e,(r-l)*e,(o-n)*e,.25/e)):s>a&&s>c?(e=2*Math.sqrt(1+s-a-c),this.set(.25*e,(n+o)/e,(r+l)/e,(u-h)/e)):a>c?(e=2*Math.sqrt(1+a-s-c),this.set((n+o)/e,.25*e,(h+u)/e,(r-l)/e)):(e=2*Math.sqrt(1+c-s-a),this.set((r+l)/e,(h+u)/e,.25*e,(o-n)/e)),this},fromMat3:function(t){var e,i=t.val,s=i[0]+i[4]+i[8];if(s>0)e=Math.sqrt(s+1),this.w=.5*e,e=.5/e,this._x=(i[7]-i[5])*e,this._y=(i[2]-i[6])*e,this._z=(i[3]-i[1])*e;else{var n=0;i[4]>i[0]&&(n=1),i[8]>i[3*n+n]&&(n=2);var r=h[n],o=h[r];e=Math.sqrt(i[3*n+n]-i[3*r+r]-i[3*o+o]+1),l[n]=.5*e,e=.5/e,l[r]=(i[3*r+n]+i[3*n+r])*e,l[o]=(i[3*o+n]+i[3*n+o])*e,this._x=l[0],this._y=l[1],this._z=l[2],this._w=(i[3*o+r]-i[3*r+o])*e}return this.onChangeCallback(this),this}});t.exports=p},43396:(t,e,i)=>{var s=i(36383);t.exports=function(t){return t*s.RAD_TO_DEG}},74362:t=>{t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t}},60706:t=>{t.exports=function(t,e){void 0===e&&(e=1);var i=2*Math.random()*Math.PI,s=2*Math.random()-1,n=Math.sqrt(1-s*s)*e;return t.x=Math.cos(i)*n,t.y=Math.sin(i)*n,t.z=s*e,t}},67421:t=>{t.exports=function(t,e){return void 0===e&&(e=1),t.x=(2*Math.random()-1)*e,t.y=(2*Math.random()-1)*e,t.z=(2*Math.random()-1)*e,t.w=(2*Math.random()-1)*e,t}},36305:t=>{t.exports=function(t,e){var i=t.x,s=t.y;return t.x=i*Math.cos(e)-s*Math.sin(e),t.y=i*Math.sin(e)+s*Math.cos(e),t}},11520:t=>{t.exports=function(t,e,i,s){var n=Math.cos(s),r=Math.sin(s),o=t.x-e,a=t.y-i;return t.x=o*n-a*r+e,t.y=o*r+a*n+i,t}},1163:t=>{t.exports=function(t,e,i,s,n){var r=s+Math.atan2(t.y-i,t.x-e);return t.x=e+n*Math.cos(r),t.y=i+n*Math.sin(r),t}},70336:t=>{t.exports=function(t,e,i,s,n){return t.x=e+n*Math.cos(s),t.y=i+n*Math.sin(s),t}},72678:(t,e,i)=>{var s=i(25836),n=i(37867),r=i(15746),o=new n,a=new r,h=new s;t.exports=function(t,e,i){return a.setAxisAngle(e,i),o.fromRotationTranslation(a,h.set(0,0,0)),t.transformMat4(o)}},2284:t=>{t.exports=function(t){return t>0?Math.ceil(t):Math.floor(t)}},41013:t=>{t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=10);var s=Math.pow(i,-e);return Math.round(t*s)/s}},16922:t=>{t.exports=function(t,e,i,s){void 0===e&&(e=1),void 0===i&&(i=1),void 0===s&&(s=1),s*=Math.PI/t;for(var n=[],r=[],o=0;o{t.exports=function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}},54261:t=>{t.exports=function(t,e,i){return(t=Math.max(0,Math.min(1,(t-e)/(i-e))))*t*t*(t*(6*t-15)+10)}},44408:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n){void 0===n&&(n=new s);var r=0,o=0;return t>0&&t<=e*i&&(r=t>e-1?t-(o=Math.floor(t/e))*e:t),n.set(r,o)}},85955:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r,o,a,h){void 0===h&&(h=new s);var l=Math.sin(r),u=Math.cos(r),c=u*o,d=l*o,f=-l*a,p=u*a,v=1/(c*p+f*-d);return h.x=p*v*t+-f*v*e+(n*f-i*p)*v,h.y=c*v*e+-d*v*t+(-n*c+i*d)*v,h}},26099:(t,e,i)=>{var s=i(83419),n=i(43855),r=new s({initialize:function(t,e){this.x=0,this.y=0,"object"==typeof t?(this.x=t.x||0,this.y=t.y||0):(void 0===e&&(e=t),this.x=t||0,this.y=e||0)},clone:function(){return new r(this.x,this.y)},copy:function(t){return this.x=t.x||0,this.y=t.y||0,this},setFromObject:function(t){return this.x=t.x||0,this.y=t.y||0,this},set:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setTo:function(t,e){return this.set(t,e)},setToPolar:function(t,e){return null==e&&(e=1),this.x=Math.cos(t)*e,this.y=Math.sin(t)*e,this},equals:function(t){return this.x===t.x&&this.y===t.y},fuzzyEquals:function(t,e){return n(this.x,t.x,e)&&n(this.y,t.y,e)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},setAngle:function(t){return this.setToPolar(t,this.length())},add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},scale:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},negate:function(){return this.x=-this.x,this.y=-this.y,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},length:function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},setLength:function(t){return this.normalize().scale(t)},lengthSq:function(){var t=this.x,e=this.y;return t*t+e*e},normalize:function(){var t=this.x,e=this.y,i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i),this.x=t*i,this.y=e*i),this},normalizeRightHand:function(){var t=this.x;return this.x=-1*this.y,this.y=t,this},normalizeLeftHand:function(){var t=this.x;return this.x=this.y,this.y=-1*t,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,s=this.y;return this.x=i+e*(t.x-i),this.y=s+e*(t.y-s),this},transformMat3:function(t){var e=this.x,i=this.y,s=t.val;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this},transformMat4:function(t){var e=this.x,i=this.y,s=t.val;return this.x=s[0]*e+s[4]*i+s[12],this.y=s[1]*e+s[5]*i+s[13],this},reset:function(){return this.x=0,this.y=0,this},limit:function(t){var e=this.length();return e&&e>t&&this.scale(t/e),this},reflect:function(t){return t=t.clone().normalize(),this.subtract(t.scale(2*this.dot(t)))},mirror:function(t){return this.reflect(t).negate()},rotate:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e*this.x-i*this.y,i*this.x+e*this.y)},project:function(t){var e=this.dot(t)/t.dot(t);return this.copy(t).scale(e)}});r.ZERO=new r,r.RIGHT=new r(1,0),r.LEFT=new r(-1,0),r.UP=new r(0,-1),r.DOWN=new r(0,1),r.ONE=new r(1,1),t.exports=r},25836:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i){this.x=0,this.y=0,this.z=0,"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0)},up:function(){return this.x=0,this.y=1,this.z=0,this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clone:function(){return new s(this.x,this.y,this.z)},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},crossVectors:function(t,e){var i=t.x,s=t.y,n=t.z,r=e.x,o=e.y,a=e.z;return this.x=s*a-n*o,this.y=n*r-i*a,this.z=i*o-s*r,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},set:function(t,e,i){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0),this},setFromMatrixPosition:function(t){return this.fromArray(t.val,12)},setFromMatrixColumn:function(t,e){return this.fromArray(t.val,4*e)},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addScale:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this},scale:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,s=t.z-this.z||0;return Math.sqrt(e*e+i*i+s*s)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,s=t.z-this.z||0;return e*e+i*i+s*s},length:function(){var t=this.x,e=this.y,i=this.z;return Math.sqrt(t*t+e*e+i*i)},lengthSq:function(){var t=this.x,e=this.y,i=this.z;return t*t+e*e+i*i},normalize:function(){var t=this.x,e=this.y,i=this.z,s=t*t+e*e+i*i;return s>0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},cross:function(t){var e=this.x,i=this.y,s=this.z,n=t.x,r=t.y,o=t.z;return this.x=i*o-s*r,this.y=s*n-e*o,this.z=e*r-i*n,this},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,s=this.y,n=this.z;return this.x=i+e*(t.x-i),this.y=s+e*(t.y-s),this.z=n+e*(t.z-n),this},applyMatrix3:function(t){var e=this.x,i=this.y,s=this.z,n=t.val;return this.x=n[0]*e+n[3]*i+n[6]*s,this.y=n[1]*e+n[4]*i+n[7]*s,this.z=n[2]*e+n[5]*i+n[8]*s,this},applyMatrix4:function(t){var e=this.x,i=this.y,s=this.z,n=t.val,r=1/(n[3]*e+n[7]*i+n[11]*s+n[15]);return this.x=(n[0]*e+n[4]*i+n[8]*s+n[12])*r,this.y=(n[1]*e+n[5]*i+n[9]*s+n[13])*r,this.z=(n[2]*e+n[6]*i+n[10]*s+n[14])*r,this},transformMat3:function(t){var e=this.x,i=this.y,s=this.z,n=t.val;return this.x=e*n[0]+i*n[3]+s*n[6],this.y=e*n[1]+i*n[4]+s*n[7],this.z=e*n[2]+i*n[5]+s*n[8],this},transformMat4:function(t){var e=this.x,i=this.y,s=this.z,n=t.val;return this.x=n[0]*e+n[4]*i+n[8]*s+n[12],this.y=n[1]*e+n[5]*i+n[9]*s+n[13],this.z=n[2]*e+n[6]*i+n[10]*s+n[14],this},transformCoordinates:function(t){var e=this.x,i=this.y,s=this.z,n=t.val,r=e*n[0]+i*n[4]+s*n[8]+n[12],o=e*n[1]+i*n[5]+s*n[9]+n[13],a=e*n[2]+i*n[6]+s*n[10]+n[14],h=e*n[3]+i*n[7]+s*n[11]+n[15];return this.x=r/h,this.y=o/h,this.z=a/h,this},transformQuat:function(t){var e=this.x,i=this.y,s=this.z,n=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*s-o*i,l=a*i+o*e-n*s,u=a*s+n*i-r*e,c=-n*e-r*i-o*s;return this.x=h*a+c*-n+l*-o-u*-r,this.y=l*a+c*-r+u*-n-h*-o,this.z=u*a+c*-o+h*-r-l*-n,this},project:function(t){var e=this.x,i=this.y,s=this.z,n=t.val,r=n[0],o=n[1],a=n[2],h=n[3],l=n[4],u=n[5],c=n[6],d=n[7],f=n[8],p=n[9],v=n[10],g=n[11],m=n[12],y=n[13],x=n[14],T=1/(e*h+i*d+s*g+n[15]);return this.x=(e*r+i*l+s*f+m)*T,this.y=(e*o+i*u+s*p+y)*T,this.z=(e*a+i*c+s*v+x)*T,this},projectViewMatrix:function(t,e){return this.applyMatrix4(t).applyMatrix4(e)},unprojectViewMatrix:function(t,e){return this.applyMatrix4(t).applyMatrix4(e)},unproject:function(t,e){var i=t.x,s=t.y,n=t.z,r=t.w,o=this.x-i,a=r-this.y-1-s,h=this.z;return this.x=2*o/n-1,this.y=2*a/r-1,this.z=2*h-1,this.project(e)},reset:function(){return this.x=0,this.y=0,this.z=0,this}});s.ZERO=new s,s.RIGHT=new s(1,0,0),s.LEFT=new s(-1,0,0),s.UP=new s(0,-1,0),s.DOWN=new s(0,1,0),s.FORWARD=new s(0,0,1),s.BACK=new s(0,0,-1),s.ONE=new s(1,1,1),t.exports=s},61369:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s){this.x=0,this.y=0,this.z=0,this.w=0,"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=s||0)},clone:function(){return new s(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this.w=t.w||0,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},set:function(t,e,i,s){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this.w=t.w||0):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=s||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this.w+=t.w||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this.w-=t.w||0,this},scale:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},length:function(){var t=this.x,e=this.y,i=this.z,s=this.w;return Math.sqrt(t*t+e*e+i*i+s*s)},lengthSq:function(){var t=this.x,e=this.y,i=this.z,s=this.w;return t*t+e*e+i*i+s*s},normalize:function(){var t=this.x,e=this.y,i=this.z,s=this.w,n=t*t+e*e+i*i+s*s;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n,this.w=s*n),this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lerp:function(t,e){void 0===e&&(e=0);var i=this.x,s=this.y,n=this.z,r=this.w;return this.x=i+e*(t.x-i),this.y=s+e*(t.y-s),this.z=n+e*(t.z-n),this.w=r+e*(t.w-r),this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this.w*=t.w||1,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this.w/=t.w||1,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,s=t.z-this.z||0,n=t.w-this.w||0;return Math.sqrt(e*e+i*i+s*s+n*n)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,s=t.z-this.z||0,n=t.w-this.w||0;return e*e+i*i+s*s+n*n},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},transformMat4:function(t){var e=this.x,i=this.y,s=this.z,n=this.w,r=t.val;return this.x=r[0]*e+r[4]*i+r[8]*s+r[12]*n,this.y=r[1]*e+r[5]*i+r[9]*s+r[13]*n,this.z=r[2]*e+r[6]*i+r[10]*s+r[14]*n,this.w=r[3]*e+r[7]*i+r[11]*s+r[15]*n,this},transformQuat:function(t){var e=this.x,i=this.y,s=this.z,n=t.x,r=t.y,o=t.z,a=t.w,h=a*e+r*s-o*i,l=a*i+o*e-n*s,u=a*s+n*i-r*e,c=-n*e-r*i-o*s;return this.x=h*a+c*-n+l*-o-u*-r,this.y=l*a+c*-r+u*-n-h*-o,this.z=u*a+c*-o+h*-r-l*-n,this},reset:function(){return this.x=0,this.y=0,this.z=0,this.w=0,this}});s.prototype.sub=s.prototype.subtract,s.prototype.mul=s.prototype.multiply,s.prototype.div=s.prototype.divide,s.prototype.dist=s.prototype.distance,s.prototype.distSq=s.prototype.distanceSq,s.prototype.len=s.prototype.length,s.prototype.lenSq=s.prototype.lengthSq,t.exports=s},60417:t=>{t.exports=function(t,e,i){return Math.abs(t-e)<=i}},15994:t=>{t.exports=function(t,e,i){var s=i-e;return e+((t-e)%s+s)%s}},31040:t=>{t.exports=function(t,e,i,s){return Math.atan2(s-e,i-t)}},55495:t=>{t.exports=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}},128:t=>{t.exports=function(t,e){return Math.atan2(e.x-t.x,e.y-t.y)}},41273:t=>{t.exports=function(t,e,i,s){return Math.atan2(i-t,s-e)}},1432:(t,e,i)=>{var s=i(36383);t.exports=function(t){return t>Math.PI&&(t-=s.PI2),Math.abs(((t+s.TAU)%s.PI2-s.PI2)%s.PI2)}},12407:t=>{t.exports=function(t){return(t%=2*Math.PI)>=0?t:t+2*Math.PI}},53993:(t,e,i)=>{var s=i(99472);t.exports=function(){return s(-Math.PI,Math.PI)}},86564:(t,e,i)=>{var s=i(99472);t.exports=function(){return s(-180,180)}},90154:(t,e,i)=>{var s=i(12407);t.exports=function(t){return s(t+Math.PI)}},48736:(t,e,i)=>{var s=i(36383);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e||(Math.abs(e-t)<=i||Math.abs(e-t)>=s.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e{t.exports=function(t,e){var i=e-t;return 0===i?0:i-360*Math.floor((i- -180)/360)}},86554:(t,e,i)=>{var s=i(15994);t.exports=function(t){return s(t,-Math.PI,Math.PI)}},30954:(t,e,i)=>{var s=i(15994);t.exports=function(t){return s(t,-180,180)}},25588:(t,e,i)=>{t.exports={Between:i(31040),BetweenPoints:i(55495),BetweenPointsY:i(128),BetweenY:i(41273),CounterClockwise:i(1432),Normalize:i(12407),Random:i(53993),RandomDegrees:i(86564),Reverse:i(90154),RotateTo:i(48736),ShortestBetween:i(61430),Wrap:i(86554),WrapDegrees:i(30954)}},36383:t=>{var e={PI2:2*Math.PI,TAU:.5*Math.PI,EPSILON:1e-6,DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,RND:null,MIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER||-9007199254740991,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991};t.exports=e},20339:t=>{t.exports=function(t,e,i,s){var n=t-i,r=e-s;return Math.sqrt(n*n+r*r)}},52816:t=>{t.exports=function(t,e){var i=t.x-e.x,s=t.y-e.y;return Math.sqrt(i*i+s*s)}},64559:t=>{t.exports=function(t,e){var i=t.x-e.x,s=t.y-e.y;return i*i+s*s}},82340:t=>{t.exports=function(t,e,i,s){return Math.max(Math.abs(t-i),Math.abs(e-s))}},14390:t=>{t.exports=function(t,e,i,s,n){return void 0===n&&(n=2),Math.sqrt(Math.pow(i-t,n)+Math.pow(s-e,n))}},2243:t=>{t.exports=function(t,e,i,s){return Math.abs(t-i)+Math.abs(e-s)}},89774:t=>{t.exports=function(t,e,i,s){var n=t-i,r=e-s;return n*n+r*r}},50994:(t,e,i)=>{t.exports={Between:i(20339),BetweenPoints:i(52816),BetweenPointsSquared:i(64559),Chebyshev:i(82340),Power:i(14390),Snake:i(2243),Squared:i(89774)}},62640:(t,e,i)=>{var s=i(54178),n=i(41521),r=i(79980),o=i(85433),a=i(99140),h=i(48857),l=i(81596),u=i(59133),c=i(98516),d=i(35248),f=i(82500),p=i(49752);t.exports={Power0:l,Power1:u.Out,Power2:o.Out,Power3:c.Out,Power4:d.Out,Linear:l,Quad:u.Out,Cubic:o.Out,Quart:c.Out,Quint:d.Out,Sine:f.Out,Expo:h.Out,Circ:r.Out,Elastic:a.Out,Back:s.Out,Bounce:n.Out,Stepped:p,"Quad.easeIn":u.In,"Cubic.easeIn":o.In,"Quart.easeIn":c.In,"Quint.easeIn":d.In,"Sine.easeIn":f.In,"Expo.easeIn":h.In,"Circ.easeIn":r.In,"Elastic.easeIn":a.In,"Back.easeIn":s.In,"Bounce.easeIn":n.In,"Quad.easeOut":u.Out,"Cubic.easeOut":o.Out,"Quart.easeOut":c.Out,"Quint.easeOut":d.Out,"Sine.easeOut":f.Out,"Expo.easeOut":h.Out,"Circ.easeOut":r.Out,"Elastic.easeOut":a.Out,"Back.easeOut":s.Out,"Bounce.easeOut":n.Out,"Quad.easeInOut":u.InOut,"Cubic.easeInOut":o.InOut,"Quart.easeInOut":c.InOut,"Quint.easeInOut":d.InOut,"Sine.easeInOut":f.InOut,"Expo.easeInOut":h.InOut,"Circ.easeInOut":r.InOut,"Elastic.easeInOut":a.InOut,"Back.easeInOut":s.InOut,"Bounce.easeInOut":n.InOut}},1639:t=>{t.exports=function(t,e){return void 0===e&&(e=1.70158),t*t*((e+1)*t-e)}},50099:t=>{t.exports=function(t,e){void 0===e&&(e=1.70158);var i=1.525*e;return(t*=2)<1?t*t*((i+1)*t-i)*.5:.5*((t-=2)*t*((i+1)*t+i)+2)}},41286:t=>{t.exports=function(t,e){return void 0===e&&(e=1.70158),--t*t*((e+1)*t+e)+1}},54178:(t,e,i)=>{t.exports={In:i(1639),Out:i(41286),InOut:i(50099)}},59590:t=>{t.exports=function(t){return(t=1-t)<1/2.75?1-7.5625*t*t:t<2/2.75?1-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}},41788:t=>{t.exports=function(t){var e=!1;return t<.5?(t=1-2*t,e=!0):t=2*t-1,t<1/2.75?t*=7.5625*t:t=t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5}},69905:t=>{t.exports=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}},41521:(t,e,i)=>{t.exports={In:i(59590),Out:i(69905),InOut:i(41788)}},91861:t=>{t.exports=function(t){return 1-Math.sqrt(1-t*t)}},4177:t=>{t.exports=function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},57512:t=>{t.exports=function(t){return Math.sqrt(1- --t*t)}},79980:(t,e,i)=>{t.exports={In:i(91861),Out:i(57512),InOut:i(4177)}},51150:t=>{t.exports=function(t){return t*t*t}},82820:t=>{t.exports=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},35033:t=>{t.exports=function(t){return--t*t*t+1}},85433:(t,e,i)=>{t.exports={In:i(51150),Out:i(35033),InOut:i(82820)}},69965:t=>{t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var s=i/4;return e<1?e=1:s=i*Math.asin(1/e)/(2*Math.PI),-e*Math.pow(2,10*(t-=1))*Math.sin((t-s)*(2*Math.PI)/i)}},50665:t=>{t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var s=i/4;return e<1?e=1:s=i*Math.asin(1/e)/(2*Math.PI),(t*=2)<1?e*Math.pow(2,10*(t-=1))*Math.sin((t-s)*(2*Math.PI)/i)*-.5:e*Math.pow(2,-10*(t-=1))*Math.sin((t-s)*(2*Math.PI)/i)*.5+1}},7744:t=>{t.exports=function(t,e,i){if(void 0===e&&(e=.1),void 0===i&&(i=.1),0===t)return 0;if(1===t)return 1;var s=i/4;return e<1?e=1:s=i*Math.asin(1/e)/(2*Math.PI),e*Math.pow(2,-10*t)*Math.sin((t-s)*(2*Math.PI)/i)+1}},99140:(t,e,i)=>{t.exports={In:i(69965),Out:i(7744),InOut:i(50665)}},24590:t=>{t.exports=function(t){return Math.pow(2,10*(t-1))-.001}},87844:t=>{t.exports=function(t){return(t*=2)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))}},89433:t=>{t.exports=function(t){return 1-Math.pow(2,-10*t)}},48857:(t,e,i)=>{t.exports={In:i(24590),Out:i(89433),InOut:i(87844)}},48820:(t,e,i)=>{t.exports={Back:i(54178),Bounce:i(41521),Circular:i(79980),Cubic:i(85433),Elastic:i(99140),Expo:i(48857),Linear:i(81596),Quadratic:i(59133),Quartic:i(98516),Quintic:i(35248),Sine:i(82500),Stepped:i(49752)}},7147:t=>{t.exports=function(t){return t}},81596:(t,e,i)=>{t.exports=i(7147)},34826:t=>{t.exports=function(t){return t*t}},20544:t=>{t.exports=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},92029:t=>{t.exports=function(t){return t*(2-t)}},59133:(t,e,i)=>{t.exports={In:i(34826),Out:i(92029),InOut:i(20544)}},64413:t=>{t.exports=function(t){return t*t*t*t}},78137:t=>{t.exports=function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},45840:t=>{t.exports=function(t){return 1- --t*t*t*t}},98516:(t,e,i)=>{t.exports={In:i(64413),Out:i(45840),InOut:i(78137)}},87745:t=>{t.exports=function(t){return t*t*t*t*t}},16509:t=>{t.exports=function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},17868:t=>{t.exports=function(t){return--t*t*t*t*t+1}},35248:(t,e,i)=>{t.exports={In:i(87745),Out:i(17868),InOut:i(16509)}},80461:t=>{t.exports=function(t){return 0===t?0:1===t?1:1-Math.cos(t*Math.PI/2)}},34025:t=>{t.exports=function(t){return 0===t?0:1===t?1:.5*(1-Math.cos(Math.PI*t))}},52768:t=>{t.exports=function(t){return 0===t?0:1===t?1:Math.sin(t*Math.PI/2)}},82500:(t,e,i)=>{t.exports={In:i(80461),Out:i(52768),InOut:i(34025)}},72251:t=>{t.exports=function(t,e){return void 0===e&&(e=1),t<=0?0:t>=1?1:1/e*(1+(e*t|0))}},49752:(t,e,i)=>{t.exports=i(72251)},75698:t=>{t.exports=function(t,e){return void 0===e&&(e=1e-4),Math.ceil(t-e)}},43855:t=>{t.exports=function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e){t.exports=function(t,e){return void 0===e&&(e=1e-4),Math.floor(t+e)}},5470:t=>{t.exports=function(t,e,i){return void 0===i&&(i=1e-4),t>e-i}},94977:t=>{t.exports=function(t,e,i){return void 0===i&&(i=1e-4),t{t.exports={Ceil:i(75698),Equal:i(43855),Floor:i(25777),GreaterThan:i(5470),LessThan:i(94977)}},75508:(t,e,i)=>{var s=i(36383),n=i(79291),r={Angle:i(25588),Distance:i(50994),Easing:i(48820),Fuzzy:i(48379),Interpolation:i(38289),Pow2:i(49001),Snap:i(73697),RandomDataGenerator:i(28453),Average:i(53307),Bernstein:i(85710),Between:i(30976),CatmullRom:i(87842),CeilTo:i(26302),Clamp:i(45319),DegToRad:i(39506),Difference:i(61241),Euler:i(38857),Factorial:i(6411),FloatBetween:i(99472),FloorTo:i(77623),FromPercent:i(62945),GetSpeed:i(38265),IsEven:i(78702),IsEvenStrict:i(94883),Linear:i(28915),LinearXY:i(94908),MaxAdd:i(86883),Median:i(50040),MinSub:i(37204),Percent:i(65201),RadToDeg:i(43396),RandomXY:i(74362),RandomXYZ:i(60706),RandomXYZW:i(67421),Rotate:i(36305),RotateAround:i(11520),RotateAroundDistance:i(1163),RotateTo:i(70336),RoundAwayFromZero:i(2284),RoundTo:i(41013),SinCosTableGenerator:i(16922),SmootherStep:i(54261),SmoothStep:i(7602),ToXY:i(44408),TransformXY:i(85955),Within:i(60417),Wrap:i(15994),Vector2:i(26099),Vector3:i(25836),Vector4:i(61369),Matrix3:i(94434),Matrix4:i(37867),Quaternion:i(15746),RotateVec3:i(72678)};r=n(!1,r,s),t.exports=r},89318:(t,e,i)=>{var s=i(85710);t.exports=function(t,e){for(var i=0,n=t.length-1,r=0;r<=n;r++)i+=Math.pow(1-e,n-r)*Math.pow(e,r)*t[r]*s(n,r);return i}},77259:(t,e,i)=>{var s=i(87842);t.exports=function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n);return t[0]===t[i]?(e<0&&(r=Math.floor(n=i*(1+e))),s(n-r,t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i])):e<0?t[0]-(s(-n,t[0],t[0],t[1],t[1])-t[0]):e>1?t[i]-(s(n-i,t[i],t[i],t[i-1],t[i-1])-t[i]):s(n-r,t[r?r-1:0],t[r],t[i{t.exports=function(t,e,i,s,n){return function(t,e){var i=1-t;return i*i*i*e}(t,e)+function(t,e){var i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,s)+function(t,e){return t*t*t*e}(t,n)}},28392:(t,e,i)=>{var s=i(28915);t.exports=function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n);return e<0?s(t[0],t[1],n):e>1?s(t[i],t[i-1],i-n):s(t[r],t[r+1>i?i:r+1],n-r)}},32112:t=>{t.exports=function(t,e,i,s){return function(t,e){var i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,s)}},47235:(t,e,i)=>{var s=i(7602);t.exports=function(t,e,i){return e+(i-e)*s(t,0,1)}},50178:(t,e,i)=>{var s=i(54261);t.exports=function(t,e,i){return e+(i-e)*s(t,0,1)}},38289:(t,e,i)=>{t.exports={Bezier:i(89318),CatmullRom:i(77259),CubicBezier:i(36316),Linear:i(28392),QuadraticBezier:i(32112),SmoothStep:i(47235),SmootherStep:i(50178)}},98439:t=>{t.exports=function(t){var e=Math.log(t)/.6931471805599453;return 1<{t.exports=function(t,e){return t>0&&!(t&t-1)&&e>0&&!(e&e-1)}},81230:t=>{t.exports=function(t){return t>0&&!(t&t-1)}},49001:(t,e,i)=>{t.exports={GetNext:i(98439),IsSize:i(50030),IsValue:i(81230)}},28453:(t,e,i)=>{var s=new(i(83419))({initialize:function(t){void 0===t&&(t=[(Date.now()*Math.random()).toString()]),this.c=1,this.s0=0,this.s1=0,this.s2=0,this.n=0,this.signs=[-1,1],t&&this.init(t)},rnd:function(){var t=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|t,this.s0=this.s1,this.s1=this.s2,this.s2=t-this.c,this.s2},hash:function(t){var e,i=this.n;t=t.toString();for(var s=0;s>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return this.n=i,2.3283064365386963e-10*(i>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.n=4022871197,this.s0=this.hash(" "),this.s1=this.hash(" "),this.s2=this.hash(" "),this.c=1,t)for(var e=0;e0;e--){var i=Math.floor(this.frac()*(e+1)),s=t[i];t[i]=t[e],t[e]=s}return t}});t.exports=s},63448:t=>{t.exports=function(t,e,i,s){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.ceil(t/e),s?(i+t)/e:i+t)}},56583:t=>{t.exports=function(t,e,i,s){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.floor(t/e),s?(i+t)/e:i+t)}},77720:t=>{t.exports=function(t,e,i,s){return void 0===i&&(i=0),0===e?t:(t-=i,t=e*Math.round(t/e),s?(i+t)/e:i+t)}},73697:(t,e,i)=>{t.exports={Ceil:i(63448),Floor:i(56583),To:i(77720)}},85454:(t,e,i)=>{i(63595);var s=i(8054),n=i(79291),r={Actions:i(61061),Animations:i(60421),BlendModes:i(10312),Cache:i(83388),Cameras:i(26638),Core:i(42857),Class:i(83419),Create:i(15822),Curves:i(25410),Data:i(44965),Display:i(27460),DOM:i(84902),Events:i(93055),FX:i(66064),Game:i(50127),GameObjects:i(77856),Geom:i(55738),Input:i(14350),Loader:i(57777),Math:i(75508),Physics:i(44563),Plugins:i(18922),Renderer:i(36909),Scale:i(93364),ScaleModes:i(29795),Scene:i(97482),Scenes:i(62194),Structs:i(41392),Textures:i(27458),Tilemaps:i(62501),Time:i(90291),Tweens:i(43066),Utils:i(91799)};r.Sound=i(23717),r=n(!1,r,s),t.exports=r,i.g.Phaser=r},71289:(t,e,i)=>{var s=i(83419),n=i(92209),r=i(88571),o=new s({Extends:r,Mixins:[n.Acceleration,n.Angular,n.Bounce,n.Collision,n.Debug,n.Drag,n.Enable,n.Friction,n.Gravity,n.Immovable,n.Mass,n.Pushable,n.Size,n.Velocity],initialize:function(t,e,i,s,n){r.call(this,t,e,i,s,n),this.body=null}});t.exports=o},86689:(t,e,i)=>{var s=i(83419),n=i(39506),r=i(20339),o=i(89774),a=i(66022),h=i(95540),l=i(46975),u=i(72441),c=i(47956),d=i(37277),f=i(44594),p=i(26099),v=i(82248),g=new s({initialize:function(t){this.scene=t,this.systems=t.sys,this.config=this.getConfig(),this.world,this.add,this._category=1,t.sys.events.once(f.BOOT,this.boot,this),t.sys.events.on(f.START,this.start,this)},boot:function(){this.world=new v(this.scene,this.config),this.add=new a(this.world),this.systems.events.once(f.DESTROY,this.destroy,this)},start:function(){this.world||(this.world=new v(this.scene,this.config),this.add=new a(this.world));var t=this.systems.events;h(this.config,"customUpdate",!1)||t.on(f.UPDATE,this.world.update,this.world),t.on(f.POST_UPDATE,this.world.postUpdate,this.world),t.once(f.SHUTDOWN,this.shutdown,this)},enableUpdate:function(){this.systems.events.on(f.UPDATE,this.world.update,this.world)},disableUpdate:function(){this.systems.events.off(f.UPDATE,this.world.update,this.world)},getConfig:function(){var t=this.systems.game.config.physics,e=this.systems.settings.physics;return l(h(e,"arcade",{}),h(t,"arcade",{}))},nextCategory:function(){return this._category=this._category<<1,this._category},overlap:function(t,e,i,s,n){return void 0===i&&(i=null),void 0===s&&(s=null),void 0===n&&(n=i),this.world.collideObjects(t,e,i,s,n,!0)},collide:function(t,e,i,s,n){return void 0===i&&(i=null),void 0===s&&(s=null),void 0===n&&(n=i),this.world.collideObjects(t,e,i,s,n,!1)},collideTiles:function(t,e,i,s,n){return this.world.collideTiles(t,e,i,s,n)},overlapTiles:function(t,e,i,s,n){return this.world.overlapTiles(t,e,i,s,n)},pause:function(){return this.world.pause()},resume:function(){return this.world.resume()},accelerateTo:function(t,e,i,s,n,r){void 0===s&&(s=60);var o=Math.atan2(i-t.y,e-t.x);return t.body.acceleration.setToPolar(o,s),void 0!==n&&void 0!==r&&t.body.maxVelocity.set(n,r),o},accelerateToObject:function(t,e,i,s,n){return this.accelerateTo(t,e.x,e.y,i,s,n)},closest:function(t,e){e||(e=this.world.bodies.entries);for(var i=Number.MAX_VALUE,s=null,n=t.x,r=t.y,a=e.length,h=0;hi&&(s=l,i=c)}}return s},moveTo:function(t,e,i,s,n){void 0===s&&(s=60),void 0===n&&(n=0);var o=Math.atan2(i-t.y,e-t.x);return n>0&&(s=r(t.x,t.y,e,i)/(n/1e3)),t.body.velocity.setToPolar(o,s),o},moveToObject:function(t,e,i,s){return this.moveTo(t,e.x,e.y,i,s)},velocityFromAngle:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new p),i.setToPolar(n(t),e)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new p),i.setToPolar(t,e)},overlapRect:function(t,e,i,s,n,r){return c(this.world,t,e,i,s,n,r)},overlapCirc:function(t,e,i,s,n){return u(this.world,t,e,i,s,n)},shutdown:function(){if(this.world){var t=this.systems.events;t.off(f.UPDATE,this.world.update,this.world),t.off(f.POST_UPDATE,this.world.postUpdate,this.world),t.off(f.SHUTDOWN,this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null,this._category=1}},destroy:function(){this.shutdown(),this.scene.sys.events.off(f.START,this.start,this),this.scene=null,this.systems=null}});d.register("ArcadePhysics",g,"arcadePhysics"),t.exports=g},13759:(t,e,i)=>{var s=i(83419),n=i(92209),r=i(68287),o=new s({Extends:r,Mixins:[n.Acceleration,n.Angular,n.Bounce,n.Collision,n.Debug,n.Drag,n.Enable,n.Friction,n.Gravity,n.Immovable,n.Mass,n.Pushable,n.Size,n.Velocity],initialize:function(t,e,i,s,n){r.call(this,t,e,i,s,n),this.body=null}});t.exports=o},37742:(t,e,i)=>{var s=i(83419),n=i(78389),r=i(37747),o=i(63012),a=i(43396),h=i(87841),l=i(37303),u=i(95829),c=i(26099),d=new s({Mixins:[n],initialize:function(t,e){var i=64,s=64,n=void 0!==e;n&&e.displayWidth&&(i=e.displayWidth,s=e.displayHeight),n||(e={x:0,y:0,angle:0,rotation:0,scaleX:1,scaleY:1,displayOriginX:0,displayOriginY:0}),this.world=t,this.gameObject=n?e:void 0,this.isBody=!0,this.transform={x:e.x,y:e.y,rotation:e.angle,scaleX:e.scaleX,scaleY:e.scaleY,displayOriginX:e.displayOriginX,displayOriginY:e.displayOriginY},this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new c,this.position=new c(e.x-e.scaleX*e.displayOriginX,e.y-e.scaleY*e.displayOriginY),this.prev=this.position.clone(),this.prevFrame=this.position.clone(),this.allowRotation=!0,this.rotation=e.angle,this.preRotation=e.angle,this.width=i,this.height=s,this.sourceWidth=i,this.sourceHeight=s,e.frame&&(this.sourceWidth=e.frame.realWidth,this.sourceHeight=e.frame.realHeight),this.halfWidth=Math.abs(i/2),this.halfHeight=Math.abs(s/2),this.center=new c(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.velocity=new c,this.newVelocity=new c,this.deltaMax=new c,this.acceleration=new c,this.allowDrag=!0,this.drag=new c,this.allowGravity=!0,this.gravity=new c,this.bounce=new c,this.worldBounce=null,this.customBoundsRectangle=t.bounds,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.maxVelocity=new c(1e4,1e4),this.maxSpeed=-1,this.friction=new c(1,0),this.useDamping=!1,this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=r.FACING_NONE,this.immovable=!1,this.pushable=!0,this.slideFactor=new c(1,1),this.moves=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision=u(!1),this.touching=u(!0),this.wasTouching=u(!0),this.blocked=u(!0),this.syncBounds=!1,this.physicsType=r.DYNAMIC_BODY,this.collisionCategory=1,this.collisionMask=1,this._sx=e.scaleX,this._sy=e.scaleY,this._dx=0,this._dy=0,this._tx=0,this._ty=0,this._bounds=new h,this.directControl=!1,this.autoFrame=this.position.clone()},updateBounds:function(){var t=this.gameObject,e=this.transform;if(t.parentContainer){var i=t.getWorldTransformMatrix(this.world._tempMatrix,this.world._tempMatrix2);e.x=i.tx,e.y=i.ty,e.rotation=a(i.rotation),e.scaleX=i.scaleX,e.scaleY=i.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY}else e.x=t.x,e.y=t.y,e.rotation=t.angle,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.displayOriginX=t.displayOriginX,e.displayOriginY=t.displayOriginY;var s=!1;if(this.syncBounds){var n=t.getBounds(this._bounds);this.width=n.width,this.height=n.height,s=!0}else{var r=Math.abs(e.scaleX),o=Math.abs(e.scaleY);this._sx===r&&this._sy===o||(this.width=this.sourceWidth*r,this.height=this.sourceHeight*o,this._sx=r,this._sy=o,s=!0)}s&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},updateFromGameObject:function(){this.updateBounds();var t=this.transform;this.position.x=t.x+t.scaleX*(this.offset.x-t.displayOriginX),this.position.y=t.y+t.scaleY*(this.offset.y-t.displayOriginY),this.updateCenter()},resetFlags:function(t){void 0===t&&(t=!1);var e=this.wasTouching,i=this.touching,s=this.blocked;t?u(!0,e):(e.none=i.none,e.up=i.up,e.down=i.down,e.left=i.left,e.right=i.right),u(!0,i),u(!0,s),this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1},preUpdate:function(t,e){if(t&&this.resetFlags(),this.gameObject&&this.updateFromGameObject(),this.rotation=this.transform.rotation,this.preRotation=this.rotation,this.moves){var i=this.position;this.prev.x=i.x,this.prev.y=i.y,this.prevFrame.x=i.x,this.prevFrame.y=i.y}t&&this.update(e)},update:function(t){var e=this.prev,i=this.position,s=this.velocity;if(e.set(i.x,i.y),!this.moves)return this._dx=i.x-e.x,void(this._dy=i.y-e.y);if(this.directControl){var n=this.autoFrame;s.set((i.x-n.x)/t,(i.y-n.y)/t),this.world.updateMotion(this,t),this._dx=i.x-n.x,this._dy=i.y-n.y}else this.world.updateMotion(this,t),this.newVelocity.set(s.x*t,s.y*t),i.add(this.newVelocity),this._dx=i.x-e.x,this._dy=i.y-e.y;var r=s.x,a=s.y;if(this.updateCenter(),this.angle=Math.atan2(a,r),this.speed=Math.sqrt(r*r+a*a),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds){var h=this.blocked;this.world.emit(o.WORLD_BOUNDS,this,h.up,h.down,h.left,h.right)}},postUpdate:function(){var t=this.position,e=t.x-this.prevFrame.x,i=t.y-this.prevFrame.y,s=this.gameObject;if(this.moves){var n=this.deltaMax.x,o=this.deltaMax.y;0!==n&&0!==e&&(e<0&&e<-n?e=-n:e>0&&e>n&&(e=n)),0!==o&&0!==i&&(i<0&&i<-o?i=-o:i>0&&i>o&&(i=o)),s&&(s.x+=e,s.y+=i)}e<0?this.facing=r.FACING_LEFT:e>0&&(this.facing=r.FACING_RIGHT),i<0?this.facing=r.FACING_UP:i>0&&(this.facing=r.FACING_DOWN),this.allowRotation&&s&&(s.angle+=this.deltaZ()),this._tx=e,this._ty=i,this.autoFrame.set(t.x,t.y)},setBoundsRectangle:function(t){return this.customBoundsRectangle=t||this.world.bounds,this},checkWorldBounds:function(){var t=this.position,e=this.velocity,i=this.blocked,s=this.customBoundsRectangle,n=this.world.checkCollision,r=this.worldBounce?-this.worldBounce.x:-this.bounce.x,o=this.worldBounce?-this.worldBounce.y:-this.bounce.y,a=!1;return t.xs.right&&n.right&&(t.x=s.right-this.width,e.x*=r,i.right=!0,a=!0),t.ys.bottom&&n.down&&(t.y=s.bottom-this.height,e.y*=o,i.down=!0,a=!0),a&&(this.blocked.none=!1,this.updateCenter()),a},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this},setGameObject:function(t,e){return void 0===e&&(e=!0),this.world.remove(this),this.gameObject&&this.gameObject.body&&(this.gameObject.body=null),this.gameObject=t,t.body&&(t.body=this),this.setSize(),this.world.add(this),this.enable=e,this},setSize:function(t,e,i){void 0===i&&(i=!0);var s=this.gameObject;if(s&&(!t&&s.frame&&(t=s.frame.realWidth),!e&&s.frame&&(e=s.frame.realHeight)),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&s&&s.getCenter){var n=(s.width-t)/2,r=(s.height-e)/2;this.offset.set(n,r)}return this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter()):this.isCircle=!1,this},reset:function(t,e){this.stop();var i=this.gameObject;i&&(i.setPosition(t,e),this.rotation=i.angle,this.preRotation=i.angle);var s=this.position;i&&i.getTopLeft?i.getTopLeft(s):s.set(t,e),this.prev.copy(s),this.prevFrame.copy(s),this.autoFrame.copy(s),i&&this.updateBounds(),this.updateCenter(),this.collideWorldBounds&&this.checkWorldBounds(),this.resetFlags(!0)},stop:function(){return this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0,this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?this.radius>0&&t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom&&(this.center.x-t)*(this.center.x-t)+(this.center.y-e)*(this.center.y-e)<=this.radius*this.radius:l(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},deltaXFinal:function(){return this._tx},deltaYFinal:function(){return this._ty},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world&&this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position,i=e.x+this.halfWidth,s=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(t.defaultStrokeWidth,this.debugBodyColor),this.isCircle?t.strokeCircle(i,s,this.width/2):(this.checkCollision.up&&t.lineBetween(e.x,e.y,e.x+this.width,e.y),this.checkCollision.right&&t.lineBetween(e.x+this.width,e.y,e.x+this.width,e.y+this.height),this.checkCollision.down&&t.lineBetween(e.x,e.y+this.height,e.x+this.width,e.y+this.height),this.checkCollision.left&&t.lineBetween(e.x,e.y,e.x,e.y+this.height))),this.debugShowVelocity&&(t.lineStyle(t.defaultStrokeWidth,this.world.defaults.velocityDebugColor,1),t.lineBetween(i,s,i+this.velocity.x/2,s+this.velocity.y/2))},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},setDirectControl:function(t){return void 0===t&&(t=!0),this.directControl=t,this},setCollideWorldBounds:function(t,e,i,s){void 0===t&&(t=!0),this.collideWorldBounds=t;var n=void 0!==e,r=void 0!==i;return(n||r)&&(this.worldBounce||(this.worldBounce=new c),n&&(this.worldBounce.x=e),r&&(this.worldBounce.y=i)),void 0!==s&&(this.onWorldBounds=s),this},setVelocity:function(t,e){return this.velocity.set(t,e),t=this.velocity.x,e=this.velocity.y,this.speed=Math.sqrt(t*t+e*e),this},setVelocityX:function(t){return this.setVelocity(t,this.velocity.y)},setVelocityY:function(t){return this.setVelocity(this.velocity.x,t)},setMaxVelocity:function(t,e){return this.maxVelocity.set(t,e),this},setMaxVelocityX:function(t){return this.maxVelocity.x=t,this},setMaxVelocityY:function(t){return this.maxVelocity.y=t,this},setMaxSpeed:function(t){return this.maxSpeed=t,this},setSlideFactor:function(t,e){return this.slideFactor.set(t,e),this},setBounce:function(t,e){return this.bounce.set(t,e),this},setBounceX:function(t){return this.bounce.x=t,this},setBounceY:function(t){return this.bounce.y=t,this},setAcceleration:function(t,e){return this.acceleration.set(t,e),this},setAccelerationX:function(t){return this.acceleration.x=t,this},setAccelerationY:function(t){return this.acceleration.y=t,this},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=t,this},setDrag:function(t,e){return this.drag.set(t,e),this},setDamping:function(t){return this.useDamping=t,this},setDragX:function(t){return this.drag.x=t,this},setDragY:function(t){return this.drag.y=t,this},setGravity:function(t,e){return this.gravity.set(t,e),this},setGravityX:function(t){return this.gravity.x=t,this},setGravityY:function(t){return this.gravity.y=t,this},setFriction:function(t,e){return this.friction.set(t,e),this},setFrictionX:function(t){return this.friction.x=t,this},setFrictionY:function(t){return this.friction.y=t,this},setAngularVelocity:function(t){return this.angularVelocity=t,this},setAngularAcceleration:function(t){return this.angularAcceleration=t,this},setAngularDrag:function(t){return this.angularDrag=t,this},setMass:function(t){return this.mass=t,this},setImmovable:function(t){return void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=t,this},processX:function(t,e,i,s){this.x+=t,this.updateCenter(),null!==e&&(this.velocity.x=e*this.slideFactor.x);var n=this.blocked;i&&(n.left=!0,n.none=!1),s&&(n.right=!0,n.none=!1)},processY:function(t,e,i,s){this.y+=t,this.updateCenter(),null!==e&&(this.velocity.y=e*this.slideFactor.y);var n=this.blocked;i&&(n.up=!0,n.none=!1),s&&(n.down=!0,n.none=!1)},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=d},79342:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s,n,r,o){this.world=t,this.name="",this.active=!0,this.overlapOnly=e,this.object1=i,this.object2=s,this.collideCallback=n,this.processCallback=r,this.callbackContext=o},setName:function(t){return this.name=t,this},update:function(){this.world.collideObjects(this.object1,this.object2,this.collideCallback,this.processCallback,this.callbackContext,this.overlapOnly)},destroy:function(){this.world.removeCollider(this),this.active=!1,this.world=null,this.object1=null,this.object2=null,this.collideCallback=null,this.processCallback=null,this.callbackContext=null}});t.exports=s},66022:(t,e,i)=>{var s=i(71289),n=i(13759),r=i(37742),o=i(83419),a=i(37747),h=i(60758),l=i(72624),u=i(71464),c=new o({initialize:function(t){this.world=t,this.scene=t.scene,this.sys=t.scene.sys},collider:function(t,e,i,s,n){return this.world.addCollider(t,e,i,s,n)},overlap:function(t,e,i,s,n){return this.world.addOverlap(t,e,i,s,n)},existing:function(t,e){var i=e?a.STATIC_BODY:a.DYNAMIC_BODY;return this.world.enableBody(t,i),t},staticImage:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.world.enableBody(r,a.STATIC_BODY),r},image:function(t,e,i,n){var r=new s(this.scene,t,e,i,n);return this.sys.displayList.add(r),this.world.enableBody(r,a.DYNAMIC_BODY),r},staticSprite:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,a.STATIC_BODY),r},sprite:function(t,e,i,s){var r=new n(this.scene,t,e,i,s);return this.sys.displayList.add(r),this.sys.updateList.add(r),this.world.enableBody(r,a.DYNAMIC_BODY),r},staticGroup:function(t,e){return this.sys.updateList.add(new u(this.world,this.world.scene,t,e))},group:function(t,e){return this.sys.updateList.add(new h(this.world,this.world.scene,t,e))},body:function(t,e,i,s){var n=new r(this.world);return n.position.set(t,e),i&&s&&n.setSize(i,s),this.world.add(n,a.DYNAMIC_BODY),n},staticBody:function(t,e,i,s){var n=new l(this.world);return n.position.set(t,e),i&&s&&n.setSize(i,s),this.world.add(n,a.STATIC_BODY),n},destroy:function(){this.world=null,this.scene=null,this.sys=null}});t.exports=c},79599:t=>{t.exports=function(t){var e=0;if(Array.isArray(t))for(var i=0;i{var s=i(37747);t.exports=function(t,e,i,n){var r=0,o=t.deltaAbsX()+e.deltaAbsX()+n;return 0===t._dx&&0===e._dx?(t.embedded=!0,e.embedded=!0):t._dx>e._dx?(r=t.right-e.x)>o&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?r=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType!==s.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.right=!0),t.physicsType!==s.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.left=!0)):t._dxo&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?r=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0,e.physicsType!==s.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.left=!0),t.physicsType!==s.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.right=!0))),t.overlapX=r,e.overlapX=r,r}},45170:(t,e,i)=>{var s=i(37747);t.exports=function(t,e,i,n){var r=0,o=t.deltaAbsY()+e.deltaAbsY()+n;return 0===t._dy&&0===e._dy?(t.embedded=!0,e.embedded=!0):t._dy>e._dy?(r=t.bottom-e.y)>o&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?r=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType!==s.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.down=!0),t.physicsType!==s.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.up=!0)):t._dyo&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?r=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0,e.physicsType!==s.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.up=!0),t.physicsType!==s.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.down=!0))),t.overlapY=r,e.overlapY=r,r}},60758:(t,e,i)=>{var s=i(13759),n=i(83419),r=i(78389),o=i(37747),a=i(95540),h=i(26479),l=i(41212),u=new n({Extends:h,Mixins:[r],initialize:function(t,e,i,n){if(i||n)if(l(i))n=i,i=null,n.internalCreateCallback=this.createCallbackHandler,n.internalRemoveCallback=this.removeCallbackHandler;else if(Array.isArray(i)&&l(i[0])){var r=this;i.forEach((function(t){t.internalCreateCallback=r.createCallbackHandler,t.internalRemoveCallback=r.removeCallbackHandler,t.classType=a(t,"classType",s)})),n=null}else n={internalCreateCallback:this.createCallbackHandler,internalRemoveCallback:this.removeCallbackHandler};else n={internalCreateCallback:this.createCallbackHandler,internalRemoveCallback:this.removeCallbackHandler};this.world=t,n&&(n.classType=a(n,"classType",s)),this.physicsType=o.DYNAMIC_BODY,this.collisionCategory=1,this.collisionMask=1,this.defaults={setCollideWorldBounds:a(n,"collideWorldBounds",!1),setBoundsRectangle:a(n,"customBoundsRectangle",null),setAccelerationX:a(n,"accelerationX",0),setAccelerationY:a(n,"accelerationY",0),setAllowDrag:a(n,"allowDrag",!0),setAllowGravity:a(n,"allowGravity",!0),setAllowRotation:a(n,"allowRotation",!0),setDamping:a(n,"useDamping",!1),setBounceX:a(n,"bounceX",0),setBounceY:a(n,"bounceY",0),setDragX:a(n,"dragX",0),setDragY:a(n,"dragY",0),setEnable:a(n,"enable",!0),setGravityX:a(n,"gravityX",0),setGravityY:a(n,"gravityY",0),setFrictionX:a(n,"frictionX",0),setFrictionY:a(n,"frictionY",0),setMaxSpeed:a(n,"maxSpeed",-1),setMaxVelocityX:a(n,"maxVelocityX",1e4),setMaxVelocityY:a(n,"maxVelocityY",1e4),setVelocityX:a(n,"velocityX",0),setVelocityY:a(n,"velocityY",0),setAngularVelocity:a(n,"angularVelocity",0),setAngularAcceleration:a(n,"angularAcceleration",0),setAngularDrag:a(n,"angularDrag",0),setMass:a(n,"mass",1),setImmovable:a(n,"immovable",!1)},h.call(this,e,i,n),this.type="PhysicsGroup"},createCallbackHandler:function(t){t.body||this.world.enableBody(t,o.DYNAMIC_BODY);var e=t.body;for(var i in this.defaults)e[i](this.defaults[i])},removeCallbackHandler:function(t){t.body&&this.world.disableBody(t)},setVelocity:function(t,e,i){void 0===i&&(i=0);for(var s=this.getChildren(),n=0;n{var e,i,s,n,r,o,a,h,l,u,c,d,f,p,v,g,m,y=function(){return u&&v&&i.blocked.right?(e.processX(-m,a,!1,!0),1):l&&g&&i.blocked.left?(e.processX(m,a,!0),1):f&&g&&e.blocked.right?(i.processX(-m,h,!1,!0),2):d&&v&&e.blocked.left?(i.processX(m,h,!0),2):0},x=function(t){if(s&&n)m*=.5,0===t||3===t?(e.processX(m,r),i.processX(-m,o)):(e.processX(-m,r),i.processX(m,o));else if(s&&!n)0===t||3===t?e.processX(m,a,!0):e.processX(-m,a,!1,!0);else if(!s&&n)0===t||3===t?i.processX(-m,h,!1,!0):i.processX(m,h,!0);else{var v=.5*m;0===t?p?(e.processX(m,0,!0),i.processX(0,null,!1,!0)):f?(e.processX(v,0,!0),i.processX(-v,0,!1,!0)):(e.processX(v,i.velocity.x,!0),i.processX(-v,null,!1,!0)):1===t?c?(e.processX(0,null,!1,!0),i.processX(m,0,!0)):u?(e.processX(-v,0,!1,!0),i.processX(v,0,!0)):(e.processX(-v,null,!1,!0),i.processX(v,e.velocity.x,!0)):2===t?p?(e.processX(-m,0,!1,!0),i.processX(0,null,!0)):d?(e.processX(-v,0,!1,!0),i.processX(v,0,!0)):(e.processX(-v,i.velocity.x,!1,!0),i.processX(v,null,!0)):3===t&&(c?(e.processX(0,null,!0),i.processX(-m,0,!1,!0)):l?(e.processX(v,0,!0),i.processX(-v,0,!1,!0)):(e.processX(v,i.velocity.y,!0),i.processX(-v,null,!1,!0)))}return!0};t.exports={BlockCheck:y,Check:function(){var t=e.velocity.x,s=i.velocity.x,n=Math.sqrt(s*s*i.mass/e.mass)*(s>0?1:-1),a=Math.sqrt(t*t*e.mass/i.mass)*(t>0?1:-1),h=.5*(n+a);return a-=h,r=h+(n-=h)*e.bounce.x,o=h+a*i.bounce.x,l&&g?x(0):d&&v?x(1):u&&v?x(2):!(!f||!g)&&x(3)},Set:function(t,r,o){i=r;var x=(e=t).velocity.x,T=i.velocity.x;return s=e.pushable,l=e._dx<0,u=e._dx>0,c=0===e._dx,v=Math.abs(e.right-i.x)<=Math.abs(i.right-e.x),a=T-x*e.bounce.x,n=i.pushable,d=i._dx<0,f=i._dx>0,p=0===i._dx,g=!v,h=x-T*i.bounce.x,m=Math.abs(o),y()},Run:x,RunImmovableBody1:function(t){1===t?i.velocity.x=0:v?i.processX(m,h,!0):i.processX(-m,h,!1,!0),e.moves&&(i.y+=(e.y-e.prev.y)*e.friction.y,i._dy=i.y-i.prev.y)},RunImmovableBody2:function(t){2===t?e.velocity.x=0:g?e.processX(m,a,!0):e.processX(-m,a,!1,!0),i.moves&&(e.y+=(i.y-i.prev.y)*i.friction.y,e._dy=e.y-e.prev.y)}}},47962:t=>{var e,i,s,n,r,o,a,h,l,u,c,d,f,p,v,g,m,y=function(){return u&&v&&i.blocked.down?(e.processY(-m,a,!1,!0),1):l&&g&&i.blocked.up?(e.processY(m,a,!0),1):f&&g&&e.blocked.down?(i.processY(-m,h,!1,!0),2):d&&v&&e.blocked.up?(i.processY(m,h,!0),2):0},x=function(t){if(s&&n)m*=.5,0===t||3===t?(e.processY(m,r),i.processY(-m,o)):(e.processY(-m,r),i.processY(m,o));else if(s&&!n)0===t||3===t?e.processY(m,a,!0):e.processY(-m,a,!1,!0);else if(!s&&n)0===t||3===t?i.processY(-m,h,!1,!0):i.processY(m,h,!0);else{var v=.5*m;0===t?p?(e.processY(m,0,!0),i.processY(0,null,!1,!0)):f?(e.processY(v,0,!0),i.processY(-v,0,!1,!0)):(e.processY(v,i.velocity.y,!0),i.processY(-v,null,!1,!0)):1===t?c?(e.processY(0,null,!1,!0),i.processY(m,0,!0)):u?(e.processY(-v,0,!1,!0),i.processY(v,0,!0)):(e.processY(-v,null,!1,!0),i.processY(v,e.velocity.y,!0)):2===t?p?(e.processY(-m,0,!1,!0),i.processY(0,null,!0)):d?(e.processY(-v,0,!1,!0),i.processY(v,0,!0)):(e.processY(-v,i.velocity.y,!1,!0),i.processY(v,null,!0)):3===t&&(c?(e.processY(0,null,!0),i.processY(-m,0,!1,!0)):l?(e.processY(v,0,!0),i.processY(-v,0,!1,!0)):(e.processY(v,i.velocity.y,!0),i.processY(-v,null,!1,!0)))}return!0};t.exports={BlockCheck:y,Check:function(){var t=e.velocity.y,s=i.velocity.y,n=Math.sqrt(s*s*i.mass/e.mass)*(s>0?1:-1),a=Math.sqrt(t*t*e.mass/i.mass)*(t>0?1:-1),h=.5*(n+a);return a-=h,r=h+(n-=h)*e.bounce.y,o=h+a*i.bounce.y,l&&g?x(0):d&&v?x(1):u&&v?x(2):!(!f||!g)&&x(3)},Set:function(t,r,o){i=r;var x=(e=t).velocity.y,T=i.velocity.y;return s=e.pushable,l=e._dy<0,u=e._dy>0,c=0===e._dy,v=Math.abs(e.bottom-i.y)<=Math.abs(i.bottom-e.y),a=T-x*e.bounce.y,n=i.pushable,d=i._dy<0,f=i._dy>0,p=0===i._dy,g=!v,h=x-T*i.bounce.y,m=Math.abs(o),y()},Run:x,RunImmovableBody1:function(t){1===t?i.velocity.y=0:v?i.processY(m,h,!0):i.processY(-m,h,!1,!0),e.moves&&(i.x+=(e.x-e.prev.x)*e.friction.x,i._dx=i.x-i.prev.x)},RunImmovableBody2:function(t){2===t?e.velocity.y=0:g?e.processY(m,a,!0):e.processY(-m,a,!1,!0),i.moves&&(e.x+=(i.x-i.prev.x)*i.friction.x,e._dx=e.x-e.prev.x)}}},14087:(t,e,i)=>{var s=i(64897),n=i(3017);t.exports=function(t,e,i,r,o){void 0===o&&(o=s(t,e,i,r));var a=t.immovable,h=e.immovable;if(i||0===o||a&&h||t.customSeparateX||e.customSeparateX)return 0!==o||t.embedded&&e.embedded;var l=n.Set(t,e,o);return a||h?(a?n.RunImmovableBody1(l):h&&n.RunImmovableBody2(l),!0):l>0||n.Check()}},89936:(t,e,i)=>{var s=i(45170),n=i(47962);t.exports=function(t,e,i,r,o){void 0===o&&(o=s(t,e,i,r));var a=t.immovable,h=e.immovable;if(i||0===o||a&&h||t.customSeparateY||e.customSeparateY)return 0!==o||t.embedded&&e.embedded;var l=n.Set(t,e,o);return a||h?(a?n.RunImmovableBody1(l):h&&n.RunImmovableBody2(l),!0):l>0||n.Check()}},95829:t=>{t.exports=function(t,e){return void 0===e&&(e={}),e.none=t,e.up=!1,e.down=!1,e.left=!1,e.right=!1,t||(e.up=!0,e.down=!0,e.left=!0,e.right=!0),e}},72624:(t,e,i)=>{var s=i(87902),n=i(83419),r=i(78389),o=i(37747),a=i(37303),h=i(95829),l=i(26099),u=new n({Mixins:[r],initialize:function(t,e){var i=64,s=64,n=void 0!==e;n&&e.displayWidth&&(i=e.displayWidth,s=e.displayHeight),n||(e={x:0,y:0,angle:0,rotation:0,scaleX:1,scaleY:1,displayOriginX:0,displayOriginY:0}),this.world=t,this.gameObject=n?e:void 0,this.isBody=!0,this.debugShowBody=t.defaults.debugShowStaticBody,this.debugBodyColor=t.defaults.staticBodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new l,this.position=new l(e.x-i*e.originX,e.y-s*e.originY),this.width=i,this.height=s,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center=new l(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.velocity=l.ZERO,this.allowGravity=!1,this.gravity=l.ZERO,this.bounce=l.ZERO,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.mass=1,this.immovable=!0,this.pushable=!1,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision=h(!1),this.touching=h(!0),this.wasTouching=h(!0),this.blocked=h(!0),this.physicsType=o.STATIC_BODY,this.collisionCategory=1,this.collisionMask=1,this._dx=0,this._dy=0},setGameObject:function(t,e){return t&&t!==this.gameObject&&(this.gameObject.body=null,t.body=this,this.gameObject=t),e&&this.updateFromGameObject(),this},updateFromGameObject:function(){this.world.staticTree.remove(this);var t=this.gameObject;return t.getTopLeft(this.position),this.width=t.displayWidth,this.height=t.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.world.staticTree.insert(this),this},setOffset:function(t,e){return void 0===e&&(e=t),this.world.staticTree.remove(this),this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(t,e),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this),this},setSize:function(t,e,i){void 0===i&&(i=!0);var s=this.gameObject;if(s&&s.frame&&(t||(t=s.frame.realWidth),e||(e=s.frame.realHeight)),this.world.staticTree.remove(this),this.width=t,this.height=e,this.halfWidth=Math.floor(t/2),this.halfHeight=Math.floor(e/2),i&&s&&s.getCenter){var n=s.displayWidth/2,r=s.displayHeight/2;this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(n-this.halfWidth,r-this.halfHeight),this.position.x+=this.offset.x,this.position.y+=this.offset.y}return this.updateCenter(),this.isCircle=!1,this.radius=0,this.world.staticTree.insert(this),this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.world.staticTree.remove(this),this.isCircle=!0,this.radius=t,this.width=2*t,this.height=2*t,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(e,i),this.updateCenter(),this.world.staticTree.insert(this)):this.isCircle=!1,this},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(t,e){var i=this.gameObject;void 0===t&&(t=i.x),void 0===e&&(e=i.y),this.world.staticTree.remove(this),i.setPosition(t,e),i.getTopLeft(this.position),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this)},stop:function(){return this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?s(this,t,e):a(this,t,e)},postUpdate:function(){},deltaAbsX:function(){return 0},deltaAbsY:function(){return 0},deltaX:function(){return 0},deltaY:function(){return 0},deltaZ:function(){return 0},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var e=this.position,i=e.x+this.halfWidth,s=e.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(t.defaultStrokeWidth,this.debugBodyColor,1),this.isCircle?t.strokeCircle(i,s,this.width/2):t.strokeRect(e.x,e.y,this.width,this.height))},willDrawDebug:function(){return this.debugShowBody},setMass:function(t){return t<=0&&(t=.1),this.mass=t,this},x:{get:function(){return this.position.x},set:function(t){this.world.staticTree.remove(this),this.position.x=t,this.world.staticTree.insert(this)}},y:{get:function(){return this.position.y},set:function(t){this.world.staticTree.remove(this),this.position.y=t,this.world.staticTree.insert(this)}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});t.exports=u},71464:(t,e,i)=>{var s=i(13759),n=i(83419),r=i(78389),o=i(37747),a=i(95540),h=i(26479),l=i(41212),u=new n({Extends:h,Mixins:[r],initialize:function(t,e,i,n){i||n?l(i)?(n=i,i=null,n.internalCreateCallback=this.createCallbackHandler,n.internalRemoveCallback=this.removeCallbackHandler,n.createMultipleCallback=this.createMultipleCallbackHandler,n.classType=a(n,"classType",s)):Array.isArray(i)&&l(i[0])?(n=i,i=null,n.forEach((function(t){t.internalCreateCallback=this.createCallbackHandler,t.internalRemoveCallback=this.removeCallbackHandler,t.createMultipleCallback=this.createMultipleCallbackHandler,t.classType=a(t,"classType",s)}))):n={internalCreateCallback:this.createCallbackHandler,internalRemoveCallback:this.removeCallbackHandler}:n={internalCreateCallback:this.createCallbackHandler,internalRemoveCallback:this.removeCallbackHandler,createMultipleCallback:this.createMultipleCallbackHandler,classType:s},this.world=t,this.physicsType=o.STATIC_BODY,this.collisionCategory=1,this.collisionMask=1,h.call(this,e,i,n),this.type="StaticPhysicsGroup"},createCallbackHandler:function(t){t.body||this.world.enableBody(t,o.STATIC_BODY)},removeCallbackHandler:function(t){t.body&&this.world.disableBody(t)},createMultipleCallbackHandler:function(){this.refresh()},refresh:function(){for(var t=this.children.entries,e=0;e{var s=i(55495),n=i(37742),r=i(45319),o=i(83419),a=i(79342),h=i(37747),l=i(20339),u=i(52816),c=i(50792),d=i(63012),f=i(43855),p=i(5470),v=i(94977),g=i(64897),m=i(45170),y=i(96523),x=i(35154),T=i(36383),w=i(25774),b=i(96602),S=i(87841),E=i(59542),A=i(40012),C=i(14087),_=i(89936),M=i(35072),P=i(72624),R=i(2483),L=i(61340),O=i(26099),F=i(15994),D=new o({Extends:c,initialize:function(t,e){c.call(this),this.scene=t,this.bodies=new M,this.staticBodies=new M,this.pendingDestroy=new M,this.colliders=new w,this.gravity=new O(x(e,"gravity.x",0),x(e,"gravity.y",0)),this.bounds=new S(x(e,"x",0),x(e,"y",0),x(e,"width",t.sys.scale.width),x(e,"height",t.sys.scale.height)),this.checkCollision={up:x(e,"checkCollision.up",!0),down:x(e,"checkCollision.down",!0),left:x(e,"checkCollision.left",!0),right:x(e,"checkCollision.right",!0)},this.fps=x(e,"fps",60),this.fixedStep=x(e,"fixedStep",!0),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=x(e,"timeScale",1),this.OVERLAP_BIAS=x(e,"overlapBias",4),this.TILE_BIAS=x(e,"tileBias",16),this.forceX=x(e,"forceX",!1),this.isPaused=x(e,"isPaused",!1),this._total=0,this.drawDebug=x(e,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:x(e,"debugShowBody",!0),debugShowStaticBody:x(e,"debugShowStaticBody",!0),debugShowVelocity:x(e,"debugShowVelocity",!0),bodyDebugColor:x(e,"debugBodyColor",16711935),staticBodyDebugColor:x(e,"debugStaticBodyColor",255),velocityDebugColor:x(e,"debugVelocityColor",65280)},this.maxEntries=x(e,"maxEntries",16),this.useTree=x(e,"useTree",!0),this.tree=new E(this.maxEntries),this.staticTree=new E(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new L,this._tempMatrix2=new L,this.tileFilterOptions={isColliding:!0,isNotEmpty:!0,hasInterestingFace:!0},this.drawDebug&&this.createDebugGraphic()},enable:function(t,e){void 0===e&&(e=h.DYNAMIC_BODY),Array.isArray(t)||(t=[t]);for(var i=0;i=r;for(this.fixedStep||(n=.001*e,a=!0,this._elapsed=0),i=0;i=r;)this._elapsed-=r,this.step(n)}},step:function(t){var e,i,s=this.bodies.entries,n=s.length;for(e=0;e0){var l=this.tree,u=this.staticTree;for(s=(i=a.entries).length,t=0;t-1&&t.velocity.length()>d&&(t.velocity.normalize().scale(d),c=d),t.speed=c},separate:function(t,e,i,s,n){var r,o,a=!1,h=!0;if(!t.enable||!e.enable||t.checkCollision.none||e.checkCollision.none||!this.intersects(t,e))return a;if(i&&!1===i.call(s,t.gameObject,e.gameObject))return a;if(t.isCircle||e.isCircle){var l=this.separateCircle(t,e,n);l.result?(a=!0,h=!1):(r=l.x,o=l.y,h=!0)}if(h){var u=!1,c=!1,f=this.OVERLAP_BIAS;n?(u=C(t,e,n,f,r),c=_(t,e,n,f,o)):this.forceX||Math.abs(this.gravity.y+t.gravity.y)E&&(p=l(y,x,E,S)-w):x>A&&(yE&&(p=l(y,x,E,A)-w)),p*=-1}else p=t.halfWidth+e.halfWidth-u(o,a);t.overlapR=p,e.overlapR=p;var C=s(o,a),_=(p+T.EPSILON)*Math.cos(C),M=(p+T.EPSILON)*Math.sin(C),P={overlap:p,result:!1,x:_,y:M};if(i&&(!v||v&&0!==p))return P.result=!0,P;if(!v&&0===p||h&&c||t.customSeparateX||e.customSeparateX)return P.x=void 0,P.y=void 0,P;var R=!t.pushable&&!e.pushable;if(v){var L=o.x-a.x,O=o.y-a.y,F=Math.sqrt(Math.pow(L,2)+Math.pow(O,2)),D=(a.x-o.x)/F||0,k=(a.y-o.y)/F||0,I=2*(d.x*D+d.y*k-f.x*D-f.y*k)/(t.mass+e.mass);(h||c)&&(I*=2),h||(d.x=d.x-I/t.mass*D,d.y=d.y-I/t.mass*k,d.multiply(t.bounce)),c||(f.x=f.x+I/e.mass*D,f.y=f.y+I/e.mass*k,f.multiply(e.bounce)),h||c||(_*=.5,M*=.5),h||(t.x-=_,t.y-=M,t.updateCenter()),c||(e.x+=_,e.y+=M,e.updateCenter()),P.result=!0}else!h||t.pushable||R?(t.x-=_,t.y-=M,t.updateCenter()):(!c||e.pushable||R)&&(e.x+=_,e.y+=M,e.updateCenter()),P.x=void 0,P.y=void 0;return P},intersects:function(t,e){return t!==e&&(t.isCircle||e.isCircle?t.isCircle?e.isCircle?u(t.center,e.center)<=t.halfWidth+e.halfWidth:this.circleBodyIntersects(t,e):this.circleBodyIntersects(e,t):!(t.right<=e.left||t.bottom<=e.top||t.left>=e.right||t.top>=e.bottom))},circleBodyIntersects:function(t,e){var i=r(t.center.x,e.left,e.right),s=r(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-s)*(t.center.y-s)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,s,n){return void 0===i&&(i=null),void 0===s&&(s=null),void 0===n&&(n=i),this.collideObjects(t,e,i,s,n,!0)},collide:function(t,e,i,s,n){return void 0===i&&(i=null),void 0===s&&(s=null),void 0===n&&(n=i),this.collideObjects(t,e,i,s,n,!1)},collideObjects:function(t,e,i,s,n,r){var o,a;!t.isParent||void 0!==t.physicsType&&void 0!==e&&t!==e||(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);var h=Array.isArray(t),l=Array.isArray(e);if(this._total=0,h||l)if(!h&&l)for(o=0;o0},collideHandler:function(t,e,i,s,n,r){if(void 0===e&&t.isParent)return this.collideGroupVsGroup(t,t,i,s,n,r);if(!t||!e)return!1;if(t.body||t.isBody){if(e.body||e.isBody)return this.collideSpriteVsSprite(t,e,i,s,n,r);if(e.isParent)return this.collideSpriteVsGroup(t,e,i,s,n,r);if(e.isTilemap)return this.collideSpriteVsTilemapLayer(t,e,i,s,n,r)}else if(t.isParent){if(e.body||e.isBody)return this.collideSpriteVsGroup(e,t,i,s,n,r);if(e.isParent)return this.collideGroupVsGroup(t,e,i,s,n,r);if(e.isTilemap)return this.collideGroupVsTilemapLayer(t,e,i,s,n,r)}else if(t.isTilemap){if(e.body||e.isBody)return this.collideSpriteVsTilemapLayer(e,t,i,s,n,r);if(e.isParent)return this.collideGroupVsTilemapLayer(e,t,i,s,n,r)}},canCollide:function(t,e){return t&&e&&!!(t.collisionMask&e.collisionCategory)&&!!(e.collisionMask&t.collisionCategory)},collideSpriteVsSprite:function(t,e,i,s,n,r){var o=t.isBody?t:t.body,a=e.isBody?e:e.body;return!!this.canCollide(o,a)&&(this.separate(o,a,s,n,r)&&(i&&i.call(n,t,e),this._total++),!0)},collideSpriteVsGroup:function(t,e,i,s,n,r){var o,a,l,u=t.isBody?t:t.body;if(0!==e.length&&u&&u.enable&&!u.checkCollision.none&&this.canCollide(u,e))if(this.useTree||e.physicsType===h.STATIC_BODY){var c=this.treeMinMax;c.minX=u.left,c.minY=u.top,c.maxX=u.right,c.maxY=u.bottom;var d=e.physicsType===h.DYNAMIC_BODY?this.tree.search(c):this.staticTree.search(c);for(a=d.length,o=0;o{t.exports={setAcceleration:function(t,e){return this.body.acceleration.set(t,e),this},setAccelerationX:function(t){return this.body.acceleration.x=t,this},setAccelerationY:function(t){return this.body.acceleration.y=t,this}}},59023:t=>{t.exports={setAngularVelocity:function(t){return this.body.angularVelocity=t,this},setAngularAcceleration:function(t){return this.body.angularAcceleration=t,this},setAngularDrag:function(t){return this.body.angularDrag=t,this}}},62069:t=>{t.exports={setBounce:function(t,e){return this.body.bounce.set(t,e),this},setBounceX:function(t){return this.body.bounce.x=t,this},setBounceY:function(t){return this.body.bounce.y=t,this},setCollideWorldBounds:function(t,e,i,s){return this.body.setCollideWorldBounds(t,e,i,s),this}}},78389:(t,e,i)=>{var s=i(79599),n={setCollisionCategory:function(t){return(this.body?this.body:this).collisionCategory=t,this},willCollideWith:function(t){return!!((this.body?this.body:this).collisionMask&t)},addCollidesWith:function(t){var e=this.body?this.body:this;return e.collisionMask=e.collisionMask|t,this},removeCollidesWith:function(t){var e=this.body?this.body:this;return e.collisionMask=e.collisionMask&~t,this},setCollidesWith:function(t){return(this.body?this.body:this).collisionMask=s(t),this},resetCollisionCategory:function(){var t=this.body?this.body:this;return t.collisionCategory=1,t.collisionMask=1,this}};t.exports=n},87118:t=>{t.exports={setDebug:function(t,e,i){return this.debugShowBody=t,this.debugShowVelocity=e,this.debugBodyColor=i,this},setDebugBodyColor:function(t){return this.body.debugBodyColor=t,this},debugShowBody:{get:function(){return this.body.debugShowBody},set:function(t){this.body.debugShowBody=t}},debugShowVelocity:{get:function(){return this.body.debugShowVelocity},set:function(t){this.body.debugShowVelocity=t}},debugBodyColor:{get:function(){return this.body.debugBodyColor},set:function(t){this.body.debugBodyColor=t}}}},52819:t=>{t.exports={setDrag:function(t,e){return this.body.drag.set(t,e),this},setDragX:function(t){return this.body.drag.x=t,this},setDragY:function(t){return this.body.drag.y=t,this},setDamping:function(t){return this.body.useDamping=t,this}}},4074:t=>{t.exports={setDirectControl:function(t){return this.body.setDirectControl(t),this},enableBody:function(t,e,i,s,n){return t&&this.body.reset(e,i),s&&(this.body.gameObject.active=!0),n&&(this.body.gameObject.visible=!0),this.body.enable=!0,this},disableBody:function(t,e){return void 0===t&&(t=!1),void 0===e&&(e=!1),this.body.stop(),this.body.enable=!1,t&&(this.body.gameObject.active=!1),e&&(this.body.gameObject.visible=!1),this},refreshBody:function(){return this.body.updateFromGameObject(),this}}},40831:t=>{t.exports={setFriction:function(t,e){return this.body.friction.set(t,e),this},setFrictionX:function(t){return this.body.friction.x=t,this},setFrictionY:function(t){return this.body.friction.y=t,this}}},26775:t=>{t.exports={setGravity:function(t,e){return this.body.gravity.set(t,e),this},setGravityX:function(t){return this.body.gravity.x=t,this},setGravityY:function(t){return this.body.gravity.y=t,this}}},9437:t=>{t.exports={setImmovable:function(t){return void 0===t&&(t=!0),this.body.immovable=t,this}}},30621:t=>{t.exports={setMass:function(t){return this.body.mass=t,this}}},72441:(t,e,i)=>{var s=i(47956),n=i(96503),r=i(2044),o=i(81491);t.exports=function(t,e,i,a,h,l){var u=s(t,e-a,i-a,2*a,2*a,h,l);if(0===u.length)return u;for(var c=new n(e,i,a),d=new n,f=[],p=0;p{t.exports=function(t,e,i,s,n,r,o){void 0===r&&(r=!0),void 0===o&&(o=!1);var a=[],h=[],l=t.treeMinMax;if(l.minX=e,l.minY=i,l.maxX=e+s,l.maxY=i+n,o&&(h=t.staticTree.search(l)),r&&t.useTree)a=t.tree.search(l);else if(r){var u=t.bodies,c={position:{x:e,y:i},left:e,top:i,right:e+s,bottom:i+n,isCircle:!1},d=t.intersects;u.iterate((function(t){d(t,c)&&a.push(t)}))}return h.concat(a)}},62121:t=>{t.exports={setPushable:function(t){return void 0===t&&(t=!0),this.body.pushable=t,this}}},29384:t=>{t.exports={setOffset:function(t,e){return this.body.setOffset(t,e),this},setSize:function(t,e,i){return this.body.setSize(t,e,i),this},setBodySize:function(t,e,i){return this.body.setSize(t,e,i),this},setCircle:function(t,e,i){return this.body.setCircle(t,e,i),this}}},15098:t=>{t.exports={setVelocity:function(t,e){return this.body.setVelocity(t,e),this},setVelocityX:function(t){return this.body.setVelocityX(t),this},setVelocityY:function(t){return this.body.setVelocityY(t),this},setMaxVelocity:function(t,e){return this.body.maxVelocity.set(t,e),this}}},92209:(t,e,i)=>{t.exports={Acceleration:i(1093),Angular:i(59023),Bounce:i(62069),Collision:i(78389),Debug:i(87118),Drag:i(52819),Enable:i(4074),Friction:i(40831),Gravity:i(26775),Immovable:i(9437),Mass:i(30621),OverlapCirc:i(72441),OverlapRect:i(47956),Pushable:i(62121),Size:i(29384),Velocity:i(15098)}},37747:t=>{t.exports={DYNAMIC_BODY:0,STATIC_BODY:1,GROUP:2,TILEMAPLAYER:3,FACING_NONE:10,FACING_UP:11,FACING_DOWN:12,FACING_LEFT:13,FACING_RIGHT:14}},20009:t=>{t.exports="collide"},36768:t=>{t.exports="overlap"},60473:t=>{t.exports="pause"},89954:t=>{t.exports="resume"},61804:t=>{t.exports="tilecollide"},7161:t=>{t.exports="tileoverlap"},34689:t=>{t.exports="worldbounds"},16006:t=>{t.exports="worldstep"},63012:(t,e,i)=>{t.exports={COLLIDE:i(20009),OVERLAP:i(36768),PAUSE:i(60473),RESUME:i(89954),TILE_COLLIDE:i(61804),TILE_OVERLAP:i(7161),WORLD_BOUNDS:i(34689),WORLD_STEP:i(16006)}},27064:(t,e,i)=>{var s=i(37747),n=i(79291),r={ArcadePhysics:i(86689),Body:i(37742),Collider:i(79342),Components:i(92209),Events:i(63012),Factory:i(66022),GetCollidesWith:i(79599),GetOverlapX:i(64897),GetOverlapY:i(45170),SeparateX:i(14087),SeparateY:i(89936),Group:i(60758),Image:i(71289),Sprite:i(13759),StaticBody:i(72624),StaticGroup:i(71464),Tilemap:i(55173),World:i(82248)};r=n(!1,r,s),t.exports=r},96602:t=>{t.exports=function(t,e){return t.collisionCallback?!t.collisionCallback.call(t.collisionCallbackContext,e,t):!t.layer.callbacks[t.index]||!t.layer.callbacks[t.index].callback.call(t.layer.callbacks[t.index].callbackContext,e,t)}},36294:t=>{t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.left=!0):e>0&&(t.blocked.none=!1,t.blocked.right=!0),t.position.x-=e,t.updateCenter(),0===t.bounce.x?t.velocity.x=0:t.velocity.x=-t.velocity.x*t.bounce.x}},67013:t=>{t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):e>0&&(t.blocked.none=!1,t.blocked.down=!0),t.position.y-=e,t.updateCenter(),0===t.bounce.y?t.velocity.y=0:t.velocity.y=-t.velocity.y*t.bounce.y}},40012:(t,e,i)=>{var s=i(21329),n=i(53442),r=i(2483);t.exports=function(t,e,i,o,a,h,l){var u=o.left,c=o.top,d=o.right,f=o.bottom,p=i.faceLeft||i.faceRight,v=i.faceTop||i.faceBottom;if(l||(p=!0,v=!0),!p&&!v)return!1;var g=0,m=0,y=0,x=1;if(e.deltaAbsX()>e.deltaAbsY()?y=-1:e.deltaAbsX(){var s=i(36294);t.exports=function(t,e,i,n,r,o){var a=0,h=e.faceLeft,l=e.faceRight,u=e.collideLeft,c=e.collideRight;return o||(h=!0,l=!0,u=!0,c=!0),t.deltaX()<0&&c&&t.checkCollision.left?l&&t.x0&&u&&t.checkCollision.right&&h&&t.right>i&&(a=t.right-i)>r&&(a=0),0!==a&&(t.customSeparateX?t.overlapX=a:s(t,a)),a}},53442:(t,e,i)=>{var s=i(67013);t.exports=function(t,e,i,n,r,o){var a=0,h=e.faceTop,l=e.faceBottom,u=e.collideUp,c=e.collideDown;return o||(h=!0,l=!0,u=!0,c=!0),t.deltaY()<0&&c&&t.checkCollision.up?l&&t.y0&&u&&t.checkCollision.down&&h&&t.bottom>i&&(a=t.bottom-i)>r&&(a=0),0!==a&&(t.customSeparateY?t.overlapY=a:s(t,a)),a}},2483:t=>{t.exports=function(t,e){return!(e.right<=t.left||e.bottom<=t.top||e.position.x>=t.right||e.position.y>=t.bottom)}},55173:(t,e,i)=>{var s={ProcessTileCallbacks:i(96602),ProcessTileSeparationX:i(36294),ProcessTileSeparationY:i(67013),SeparateTile:i(40012),TileCheckX:i(21329),TileCheckY:i(53442),TileIntersectsBody:i(2483)};t.exports=s},44563:(t,e,i)=>{t.exports={Arcade:i(27064),Matter:i(3875)}},68174:(t,e,i)=>{var s=i(83419),n=i(26099),r=new s({initialize:function(){this.boundsCenter=new n,this.centerDiff=new n},parseBody:function(t){if(!(t=t.hasOwnProperty("body")?t.body:t).hasOwnProperty("bounds")||!t.hasOwnProperty("centerOfMass"))return!1;var e=this.boundsCenter,i=this.centerDiff,s=t.bounds.max.x-t.bounds.min.x,n=t.bounds.max.y-t.bounds.min.y,r=s*t.centerOfMass.x,o=n*t.centerOfMass.y;return e.set(s/2,n/2),i.set(r-e.x,o-e.y),!0},getTopLeft:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e+s.x+r.x,i+s.y+r.y)}return!1},getTopCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e+r.x,i+s.y+r.y)}return!1},getTopRight:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e-(s.x-r.x),i+s.y+r.y)}return!1},getLeftCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e+s.x+r.x,i+r.y)}return!1},getCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.centerDiff;return new n(e+s.x,i+s.y)}return!1},getRightCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e-(s.x-r.x),i+r.y)}return!1},getBottomLeft:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e+s.x+r.x,i-(s.y-r.y))}return!1},getBottomCenter:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e+r.x,i-(s.y-r.y))}return!1},getBottomRight:function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this.parseBody(t)){var s=this.boundsCenter,r=this.centerDiff;return new n(e-(s.x-r.x),i-(s.y-r.y))}return!1}});t.exports=r},19933:(t,e,i)=>{var s=i(6790);s.Body=i(22562),s.Composite=i(69351),s.World=i(4372),s.Collision=i(52284),s.Detector=i(81388),s.Pairs=i(99561),s.Pair=i(4506),s.Query=i(73296),s.Resolver=i(66272),s.Constraint=i(48140),s.Common=i(53402),s.Engine=i(48413),s.Events=i(35810),s.Sleeping=i(53614),s.Plugin=i(73832),s.Bodies=i(66280),s.Composites=i(74116),s.Axes=i(66615),s.Bounds=i(15647),s.Svg=i(74058),s.Vector=i(31725),s.Vertices=i(41598),s.World.add=s.Composite.add,s.World.remove=s.Composite.remove,s.World.addComposite=s.Composite.addComposite,s.World.addBody=s.Composite.addBody,s.World.addConstraint=s.Composite.addConstraint,s.World.clear=s.Composite.clear,t.exports=s},28137:(t,e,i)=>{var s=i(66280),n=i(83419),r=i(74116),o=i(48140),a=i(74058),h=i(75803),l=i(23181),u=i(34803),c=i(73834),d=i(19496),f=i(85791),p=i(98713),v=i(41598),g=new n({initialize:function(t){this.world=t,this.scene=t.scene,this.sys=t.scene.sys},rectangle:function(t,e,i,n,r){var o=s.rectangle(t,e,i,n,r);return this.world.add(o),o},trapezoid:function(t,e,i,n,r,o){var a=s.trapezoid(t,e,i,n,r,o);return this.world.add(a),a},circle:function(t,e,i,n,r){var o=s.circle(t,e,i,n,r);return this.world.add(o),o},polygon:function(t,e,i,n,r){var o=s.polygon(t,e,i,n,r);return this.world.add(o),o},fromVertices:function(t,e,i,n,r,o,a){"string"==typeof i&&(i=v.fromPath(i));var h=s.fromVertices(t,e,i,n,r,o,a);return this.world.add(h),h},fromPhysicsEditor:function(t,e,i,s,n){void 0===n&&(n=!0);var r=d.parseBody(t,e,i,s);return n&&!this.world.has(r)&&this.world.add(r),r},fromSVG:function(t,e,i,n,r,o){void 0===n&&(n=1),void 0===r&&(r={}),void 0===o&&(o=!0);for(var h=i.getElementsByTagName("path"),l=[],u=0;u{var s=i(31884),n=i(95540),r=i(26099);t.exports=function(t,e,i,o){void 0===i&&(i={}),void 0===o&&(o=!0);var a=e.x,h=e.y;if(e.body={temp:!0,position:{x:a,y:h}},[s.Bounce,s.Collision,s.Force,s.Friction,s.Gravity,s.Mass,s.Sensor,s.SetBody,s.Sleep,s.Static,s.Transform,s.Velocity].forEach((function(t){for(var i in t)(s=t[i]).get&&"function"==typeof s.get||s.set&&"function"==typeof s.set?Object.defineProperty(e,i,{get:t[i].get,set:t[i].set}):Object.defineProperty(e,i,{value:t[i]});var s})),e.world=t,e._tempVec2=new r(a,h),i.hasOwnProperty("type")&&"body"===i.type)e.setExistingBody(i,o);else{var l=n(i,"shape",null);l||(l="rectangle"),i.addToWorld=o,e.setBody(l,i)}return e}},23181:(t,e,i)=>{var s=i(83419),n=i(31884),r=i(95643),o=i(95540),a=i(88571),h=i(72699),l=i(26099),u=new s({Extends:a,Mixins:[n.Bounce,n.Collision,n.Force,n.Friction,n.Gravity,n.Mass,n.Sensor,n.SetBody,n.Sleep,n.Static,n.Transform,n.Velocity,h],initialize:function(t,e,i,s,n,a){r.call(this,t.scene,"Image"),this._crop=this.resetCropObject(),this.setTexture(s,n),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new l(e,i);var h=o(a,"shape",null);h?this.setBody(h,a):this.setRectangle(this.width,this.height,a),this.setPosition(e,i),this.initPipeline(),this.initPostPipeline(!0)}});t.exports=u},42045:(t,e,i)=>{var s=i(60461),n=i(66615),r=i(66280),o=i(22562),a=i(68174),h=i(15647),l=i(83419),u=i(52284),c=i(53402),d=i(69351),f=i(74116),p=i(48140),v=i(81388),g=i(20339),m=i(28137),y=i(95540),x=i(35154),T=i(18210),w=i(40178),b=i(6790),S=i(74507),E=i(46975),A=i(4506),C=i(99561),_=i(73832),M=i(37277),P=i(73296),R=i(66272),L=i(44594),O=i(74058),F=i(31725),D=i(41598),k=i(68243);c.setDecomp(i(55973));var I=new l({initialize:function(t){this.scene=t,this.systems=t.sys,this.config=this.getConfig(),this.world,this.add,this.bodyBounds,this.body=o,this.composite=d,this.collision=u,this.detector=v,this.pair=A,this.pairs=C,this.query=P,this.resolver=R,this.constraint=p,this.bodies=r,this.composites=f,this.axes=n,this.bounds=h,this.svg=O,this.vector=F,this.vertices=D,this.verts=D,this._tempVec2=F.create(),x(this.config,"plugins.collisionevents",!0)&&this.enableCollisionEventsPlugin(),x(this.config,"plugins.attractors",!1)&&this.enableAttractorPlugin(),x(this.config,"plugins.wrap",!1)&&this.enableWrapPlugin(),R._restingThresh=x(this.config,"restingThresh",4),R._restingThreshTangent=x(this.config,"restingThreshTangent",6),R._positionDampen=x(this.config,"positionDampen",.9),R._positionWarming=x(this.config,"positionWarming",.8),R._frictionNormalMultiplier=x(this.config,"frictionNormalMultiplier",5),t.sys.events.once(L.BOOT,this.boot,this),t.sys.events.on(L.START,this.start,this)},boot:function(){this.world=new k(this.scene,this.config),this.add=new m(this.world),this.bodyBounds=new a,this.systems.events.once(L.DESTROY,this.destroy,this)},start:function(){this.world||(this.world=new k(this.scene,this.config),this.add=new m(this.world));var t=this.systems.events;t.on(L.UPDATE,this.world.update,this.world),t.on(L.POST_UPDATE,this.world.postUpdate,this.world),t.once(L.SHUTDOWN,this.shutdown,this)},getConfig:function(){var t=this.systems.game.config.physics,e=this.systems.settings.physics;return E(y(e,"matter",{}),y(t,"matter",{}))},enableAttractorPlugin:function(){return _.register(T),_.use(b,T),this},enableWrapPlugin:function(){return _.register(S),_.use(b,S),this},enableCollisionEventsPlugin:function(){return _.register(w),_.use(b,w),this},pause:function(){return this.world.pause()},resume:function(){return this.world.resume()},set60Hz:function(){return this.world.getDelta=this.world.update60Hz,this.world.autoUpdate=!0,this},set30Hz:function(){return this.world.getDelta=this.world.update30Hz,this.world.autoUpdate=!0,this},step:function(t,e){this.world.step(t,e)},containsPoint:function(t,e,i){t=this.getMatterBodies(t);var s=F.create(e,i);return P.point(t,s).length>0},intersectPoint:function(t,e,i){i=this.getMatterBodies(i);var s=F.create(t,e),n=[];return P.point(i,s).forEach((function(t){-1===n.indexOf(t)&&n.push(t)})),n},intersectRect:function(t,e,i,s,n,r){void 0===n&&(n=!1),r=this.getMatterBodies(r);var o={min:{x:t,y:e},max:{x:t+i,y:e+s}},a=[];return P.region(r,o,n).forEach((function(t){-1===a.indexOf(t)&&a.push(t)})),a},intersectRay:function(t,e,i,s,n,r){void 0===n&&(n=1),r=this.getMatterBodies(r);for(var o=[],a=P.ray(r,F.create(t,e),F.create(i,s),n),h=0;h{var s=i(9674),n=i(83419),r=i(31884),o=i(95643),a=i(95540),h=i(72699),l=i(68287),u=i(26099),c=new n({Extends:l,Mixins:[r.Bounce,r.Collision,r.Force,r.Friction,r.Gravity,r.Mass,r.Sensor,r.SetBody,r.Sleep,r.Static,r.Transform,r.Velocity,h],initialize:function(t,e,i,n,r,h){o.call(this,t.scene,"Sprite"),this._crop=this.resetCropObject(),this.anims=new s(this),this.setTexture(n,r),this.setSizeToFrame(),this.setOrigin(),this.world=t,this._tempVec2=new u(e,i);var l=a(h,"shape",null);l?this.setBody(l,h):this.setRectangle(this.width,this.height,h),this.setPosition(e,i),this.initPipeline(),this.initPostPipeline(!0)}});t.exports=c},73834:(t,e,i)=>{var s=i(66280),n=i(22562),r=i(83419),o=i(31884),a=i(62644),h=i(50792),l=i(95540),u=i(97022),c=i(41598),d=new r({Extends:h,Mixins:[o.Bounce,o.Collision,o.Friction,o.Gravity,o.Mass,o.Sensor,o.Sleep,o.Static],initialize:function(t,e,i){h.call(this),this.tile=e,this.world=t,e.physics.matterBody&&e.physics.matterBody.destroy(),e.physics.matterBody=this;var s=l(i,"body",null),r=l(i,"addToWorld",!0);if(s)this.setBody(s,r);else{var o=e.getCollisionGroup();l(o,"objects",[]).length>0?this.setFromTileCollision(i):this.setFromTileRectangle(i)}if(e.flipX||e.flipY){var a={x:e.getCenterX(),y:e.getCenterY()},u=e.flipX?-1:1,c=e.flipY?-1:1;n.scale(s,u,c,a)}},setFromTileRectangle:function(t){void 0===t&&(t={}),u(t,"isStatic")||(t.isStatic=!0),u(t,"addToWorld")||(t.addToWorld=!0);var e=this.tile.getBounds(),i=e.x+e.width/2,n=e.y+e.height/2,r=s.rectangle(i,n,e.width,e.height,t);return this.setBody(r,t.addToWorld),this},setFromTileCollision:function(t){void 0===t&&(t={}),u(t,"isStatic")||(t.isStatic=!0),u(t,"addToWorld")||(t.addToWorld=!0);for(var e=this.tile.tilemapLayer.scaleX,i=this.tile.tilemapLayer.scaleY,r=this.tile.getLeft(),o=this.tile.getTop(),h=this.tile.getCollisionGroup(),d=l(h,"objects",[]),f=[],p=0;p1){var E=a(t);E.parts=f,this.setBody(n.create(E),E.addToWorld)}return this},setBody:function(t,e){return void 0===e&&(e=!0),this.body&&this.removeBody(),this.body=t,this.body.gameObject=this,e&&this.world.add(this.body),this},removeBody:function(){return this.body&&(this.world.remove(this.body),this.body.gameObject=void 0,this.body=void 0),this},destroy:function(){this.removeBody(),this.tile.physics.matterBody=void 0,this.removeAllListeners()}});t.exports=d},19496:(t,e,i)=>{var s=i(66280),n=i(22562),r=i(53402),o=i(95540),a=i(41598),h={parseBody:function(t,e,i,s){void 0===s&&(s={});for(var a=o(i,"fixtures",[]),h=[],l=0;l{var s=i(66280),n=i(22562),r={parseBody:function(t,e,i,r){var o;void 0===r&&(r={});var a=i.vertices;if(1===a.length)r.vertices=a[0],o=n.create(r),s.flagCoincidentParts(o.parts);else{for(var h=[],l=0;l{var s=i(15647),n=i(83419),r=i(69351),o=i(48140),a=i(81388),h=i(1121),l=i(8214),u=i(46975),c=i(53614),d=i(26099),f=i(41598),p=new n({initialize:function(t,e,i){void 0===i&&(i={}),this.scene=t,this.world=e,this.camera=null,this.pointer=null,this.active=!0,this.position=new d,this.body=null,this.part=null,this.constraint=o.create(u(i,{label:"Pointer Constraint",pointA:{x:0,y:0},pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,collisionFilter:{category:1,mask:4294967295,group:0}})),this.world.on(h.BEFORE_UPDATE,this.update,this),t.sys.input.on(l.POINTER_DOWN,this.onDown,this),t.sys.input.on(l.POINTER_UP,this.onUp,this)},onDown:function(t){this.pointer||(this.pointer=t,this.camera=t.camera)},onUp:function(t){t===this.pointer&&(this.pointer=null)},getBody:function(t){var e=this.position,i=this.constraint;this.camera.getWorldPoint(t.x,t.y,e);for(var n=r.allBodies(this.world.localWorld),o=0;o1?1:0;n{var s=i(66280),n=i(22562),r=i(83419),o=i(53402),a=i(69351),h=i(48413),l=i(50792),u=i(1121),c=i(95540),d=i(35154),f=i(22562),p=i(35810),v=i(73834),g=i(4372),m=i(31725),y=new r({Extends:l,initialize:function(t,e){l.call(this),this.scene=t,this.engine=h.create(e),this.localWorld=this.engine.world;var i=d(e,"gravity",null);i?this.setGravity(i.x,i.y,i.scale):!1===i&&this.setGravity(0,0,0),this.walls={left:null,right:null,top:null,bottom:null},this.enabled=d(e,"enabled",!0),this.getDelta=d(e,"getDelta",this.update60Hz);var s=c(e,"runner",{}),n=c(s,"fps",!1),r=c(s,"fps",60),o=c(s,"delta",1e3/r),a=c(s,"deltaMin",1e3/r),u=c(s,"deltaMax",1e3/(.5*r));n||(r=1e3/o),this.runner={fps:r,deltaSampleSize:c(s,"deltaSampleSize",60),counterTimestamp:0,frameCounter:0,deltaHistory:[],timePrev:null,timeScalePrev:1,frameRequestId:null,isFixed:c(s,"isFixed",!1),delta:o,deltaMin:a,deltaMax:u},this.autoUpdate=d(e,"autoUpdate",!0);var f=d(e,"debug",!1);if(this.drawDebug="object"==typeof f||f,this.debugGraphic,this.debugConfig={showAxes:c(f,"showAxes",!1),showAngleIndicator:c(f,"showAngleIndicator",!1),angleColor:c(f,"angleColor",15208787),showBroadphase:c(f,"showBroadphase",!1),broadphaseColor:c(f,"broadphaseColor",16757760),showBounds:c(f,"showBounds",!1),boundsColor:c(f,"boundsColor",16777215),showVelocity:c(f,"showVelocity",!1),velocityColor:c(f,"velocityColor",44783),showCollisions:c(f,"showCollisions",!1),collisionColor:c(f,"collisionColor",16094476),showSeparations:c(f,"showSeparations",!1),separationColor:c(f,"separationColor",16753920),showBody:c(f,"showBody",!0),showStaticBody:c(f,"showStaticBody",!0),showInternalEdges:c(f,"showInternalEdges",!1),renderFill:c(f,"renderFill",!1),renderLine:c(f,"renderLine",!0),fillColor:c(f,"fillColor",1075465),fillOpacity:c(f,"fillOpacity",1),lineColor:c(f,"lineColor",2678297),lineOpacity:c(f,"lineOpacity",1),lineThickness:c(f,"lineThickness",1),staticFillColor:c(f,"staticFillColor",857979),staticLineColor:c(f,"staticLineColor",1255396),showSleeping:c(f,"showSleeping",!1),staticBodySleepOpacity:c(f,"staticBodySleepOpacity",.7),sleepFillColor:c(f,"sleepFillColor",4605510),sleepLineColor:c(f,"sleepLineColor",10066585),showSensors:c(f,"showSensors",!0),sensorFillColor:c(f,"sensorFillColor",857979),sensorLineColor:c(f,"sensorLineColor",1255396),showPositions:c(f,"showPositions",!0),positionSize:c(f,"positionSize",4),positionColor:c(f,"positionColor",14697178),showJoint:c(f,"showJoint",!0),jointColor:c(f,"jointColor",14737474),jointLineOpacity:c(f,"jointLineOpacity",1),jointLineThickness:c(f,"jointLineThickness",2),pinSize:c(f,"pinSize",4),pinColor:c(f,"pinColor",4382944),springColor:c(f,"springColor",14697184),anchorColor:c(f,"anchorColor",15724527),anchorSize:c(f,"anchorSize",4),showConvexHulls:c(f,"showConvexHulls",!1),hullColor:c(f,"hullColor",14091216)},this.drawDebug&&this.createDebugGraphic(),this.setEventsProxy(),c(e,"setBounds",!1)){var p=e.setBounds;if("boolean"==typeof p)this.setBounds();else{var v=c(p,"x",0),g=c(p,"y",0),m=c(p,"width",t.sys.scale.width),y=c(p,"height",t.sys.scale.height),x=c(p,"thickness",64),T=c(p,"left",!0),w=c(p,"right",!0),b=c(p,"top",!0),S=c(p,"bottom",!0);this.setBounds(v,g,m,y,x,T,w,b,S)}}},setCompositeRenderStyle:function(t){var e,i,s,n=t.bodies,r=t.constraints,o=t.composites;for(e=0;e0&&(i=n[0].bodyA,s=n[0].bodyB),t.emit(u.COLLISION_START,e,i,s)})),p.on(e,"collisionActive",(function(e){var i,s,n=e.pairs;n.length>0&&(i=n[0].bodyA,s=n[0].bodyB),t.emit(u.COLLISION_ACTIVE,e,i,s)})),p.on(e,"collisionEnd",(function(e){var i,s,n=e.pairs;n.length>0&&(i=n[0].bodyA,s=n[0].bodyB),t.emit(u.COLLISION_END,e,i,s)}))},setBounds:function(t,e,i,s,n,r,o,a,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.scene.sys.scale.width),void 0===s&&(s=this.scene.sys.scale.height),void 0===n&&(n=64),void 0===r&&(r=!0),void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===h&&(h=!0),this.updateWall(r,"left",t-n,e-n,n,s+2*n),this.updateWall(o,"right",t+i,e-n,n,s+2*n),this.updateWall(a,"top",t,e-n,i,n),this.updateWall(h,"bottom",t,e+s,i,n),this},updateWall:function(t,e,i,s,n,r){var o=this.walls[e];t?(o&&g.remove(this.localWorld,o),i+=n/2,s+=r/2,this.walls[e]=this.create(i,s,n,r,{isStatic:!0,friction:0,frictionStatic:0})):(o&&g.remove(this.localWorld,o),this.walls[e]=null)},createDebugGraphic:function(){var t=this.scene.sys.add.graphics({x:0,y:0});return t.setDepth(Number.MAX_VALUE),this.debugGraphic=t,this.drawDebug=!0,t},disableGravity:function(){return this.localWorld.gravity.x=0,this.localWorld.gravity.y=0,this.localWorld.gravity.scale=0,this},setGravity:function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=.001),this.localWorld.gravity.x=t,this.localWorld.gravity.y=e,this.localWorld.gravity.scale=i,this},create:function(t,e,i,n,r){var o=s.rectangle(t,e,i,n,r);return g.add(this.localWorld,o),o},add:function(t){return g.add(this.localWorld,t),this},remove:function(t,e){Array.isArray(t)||(t=[t]);for(var i=0;is.deltaMax?s.deltaMax:e,s.delta=e),s.timeScalePrev=n.timeScale,s.frameCounter+=1,t-s.counterTimestamp>=1e3&&(s.fps=s.frameCounter*((t-s.counterTimestamp)/1e3),s.counterTimestamp=t,s.frameCounter=0),h.update(i,e)}},step:function(t){h.update(this.engine,t)},update60Hz:function(){return 1e3/60},update30Hz:function(){return 1e3/30},has:function(t){var e=t.hasOwnProperty("body")?t.body:t;return null!==a.get(this.localWorld,e.id,e.type)},getAllBodies:function(){return a.allBodies(this.localWorld)},getAllConstraints:function(){return a.allConstraints(this.localWorld)},getAllComposites:function(){return a.allComposites(this.localWorld)},postUpdate:function(){if(this.drawDebug){var t=this.debugConfig,e=this.engine,i=this.debugGraphic,s=a.allBodies(this.localWorld);this.debugGraphic.clear(),t.showBroadphase&&e.broadphase.controller&&this.renderGrid(e.broadphase,i,t.broadphaseColor,.5),t.showBounds&&this.renderBodyBounds(s,i,t.boundsColor,.5),(t.showBody||t.showStaticBody)&&this.renderBodies(s),t.showJoint&&this.renderJoints(),(t.showAxes||t.showAngleIndicator)&&this.renderBodyAxes(s,i,t.showAxes,t.angleColor,.5),t.showVelocity&&this.renderBodyVelocity(s,i,t.velocityColor,1,2),t.showSeparations&&this.renderSeparations(e.pairs.list,i,t.separationColor),t.showCollisions&&this.renderCollisions(e.pairs.list,i,t.collisionColor)}},renderGrid:function(t,e,i,s){e.lineStyle(1,i,s);for(var n=o.keys(t.buckets),r=0;r0){var l=h[0].vertex.x,u=h[0].vertex.y;2===h.length&&(l=(h[0].vertex.x+h[1].vertex.x)/2,u=(h[0].vertex.y+h[1].vertex.y)/2),a.bodyB===a.supports[0].body||a.bodyA.isStatic?e.lineBetween(l-8*a.normal.x,u-8*a.normal.y,l,u):e.lineBetween(l+8*a.normal.x,u+8*a.normal.y,l,u)}}return this},renderBodyBounds:function(t,e,i,s){e.lineStyle(1,i,s);for(var n=0;n1?1:0;h1?1:0;a1?1:0;a1&&this.renderConvexHull(v,e,f,y)}}},renderBody:function(t,e,i,s,n,r,o,a){void 0===s&&(s=null),void 0===n&&(n=null),void 0===r&&(r=1),void 0===o&&(o=null),void 0===a&&(a=null);for(var h=this.debugConfig,l=h.sensorFillColor,u=h.sensorLineColor,c=t.parts,d=c.length,f=d>1?1:0;f1){var n=t.vertices;e.lineStyle(s,i),e.beginPath(),e.moveTo(n[0].x,n[0].y);for(var r=1;r0&&(e.fillStyle(a),e.fillCircle(u.x,u.y,h),e.fillCircle(c.x,c.y,h)),this},resetCollisionIDs:function(){return n._nextCollidingGroupId=1,n._nextNonCollidingGroupId=-1,n._nextCategory=1,this},shutdown:function(){p.off(this.engine),this.removeAllListeners(),g.clear(this.localWorld,!1),h.clear(this.engine),this.drawDebug&&this.debugGraphic.destroy()},destroy:function(){this.shutdown()}});t.exports=y},70410:t=>{t.exports={setBounce:function(t){return this.body.restitution=t,this}}},66968:t=>{var e={setCollisionCategory:function(t){return this.body.collisionFilter.category=t,this},setCollisionGroup:function(t){return this.body.collisionFilter.group=t,this},setCollidesWith:function(t){var e=0;if(Array.isArray(t))for(var i=0;i{var s=i(22562),n={applyForce:function(t){return this._tempVec2.set(this.body.position.x,this.body.position.y),s.applyForce(this.body,this._tempVec2,t),this},applyForceFrom:function(t,e){return s.applyForce(this.body,t,e),this},thrust:function(t){var e=this.body.angle;return this._tempVec2.set(t*Math.cos(e),t*Math.sin(e)),s.applyForce(this.body,{x:this.body.position.x,y:this.body.position.y},this._tempVec2),this},thrustLeft:function(t){var e=this.body.angle-Math.PI/2;return this._tempVec2.set(t*Math.cos(e),t*Math.sin(e)),s.applyForce(this.body,{x:this.body.position.x,y:this.body.position.y},this._tempVec2),this},thrustRight:function(t){var e=this.body.angle+Math.PI/2;return this._tempVec2.set(t*Math.cos(e),t*Math.sin(e)),s.applyForce(this.body,{x:this.body.position.x,y:this.body.position.y},this._tempVec2),this},thrustBack:function(t){var e=this.body.angle-Math.PI;return this._tempVec2.set(t*Math.cos(e),t*Math.sin(e)),s.applyForce(this.body,{x:this.body.position.x,y:this.body.position.y},this._tempVec2),this}};t.exports=n},5436:t=>{t.exports={setFriction:function(t,e,i){return this.body.friction=t,void 0!==e&&(this.body.frictionAir=e),void 0!==i&&(this.body.frictionStatic=i),this},setFrictionAir:function(t){return this.body.frictionAir=t,this},setFrictionStatic:function(t){return this.body.frictionStatic=t,this}}},39858:t=>{t.exports={setIgnoreGravity:function(t){return this.body.ignoreGravity=t,this}}},37302:(t,e,i)=>{var s=i(22562),n=i(26099),r={setMass:function(t){return s.setMass(this.body,t),this},setDensity:function(t){return s.setDensity(this.body,t),this},centerOfMass:{get:function(){return new n(this.body.centerOfMass.x,this.body.centerOfMass.y)}}};t.exports=r},39132:t=>{t.exports={setSensor:function(t){return this.body.isSensor=t,this},isSensor:function(){return this.body.isSensor}}},57772:(t,e,i)=>{var s=i(66280),n=i(22562),r=i(43855),o=i(95540),a=i(19496),h=i(85791),l=i(41598),u={setRectangle:function(t,e,i){return this.setBody({type:"rectangle",width:t,height:e},i)},setCircle:function(t,e){return this.setBody({type:"circle",radius:t},e)},setPolygon:function(t,e,i){return this.setBody({type:"polygon",sides:e,radius:t},i)},setTrapezoid:function(t,e,i,s){return this.setBody({type:"trapezoid",width:t,height:e,slope:i},s)},setExistingBody:function(t,e){void 0===e&&(e=!0),this.body&&this.world.remove(this.body,!0),this.body=t;for(var i=0;i{var s=i(1121),n=i(53614),r=i(35810),o={setToSleep:function(){return n.set(this.body,!0),this},setAwake:function(){return n.set(this.body,!1),this},setSleepThreshold:function(t){return void 0===t&&(t=60),this.body.sleepThreshold=t,this},setSleepEvents:function(t,e){return this.setSleepStartEvent(t),this.setSleepEndEvent(e),this},setSleepStartEvent:function(t){if(t){var e=this.world;r.on(this.body,"sleepStart",(function(t){e.emit(s.SLEEP_START,t,this)}))}else r.off(this.body,"sleepStart");return this},setSleepEndEvent:function(t){if(t){var e=this.world;r.on(this.body,"sleepEnd",(function(t){e.emit(s.SLEEP_END,t,this)}))}else r.off(this.body,"sleepEnd");return this}};t.exports=o},90556:(t,e,i)=>{var s=i(22562),n={setStatic:function(t){return s.setStatic(this.body,t),this},isStatic:function(){return this.body.isStatic}};t.exports=n},85436:(t,e,i)=>{var s=i(22562),n=i(36383),r=i(86554),o=i(30954),a={x:{get:function(){return this.body.position.x},set:function(t){this._tempVec2.set(t,this.y),s.setPosition(this.body,this._tempVec2)}},y:{get:function(){return this.body.position.y},set:function(t){this._tempVec2.set(this.x,t),s.setPosition(this.body,this._tempVec2)}},scaleX:{get:function(){return this._scaleX},set:function(t){var e=1/this._scaleX,i=1/this._scaleY;this._scaleX=t,0===this._scaleX?this.renderFlags&=-5:this.renderFlags|=4,s.scale(this.body,e,i),s.scale(this.body,t,this._scaleY)}},scaleY:{get:function(){return this._scaleY},set:function(t){var e=1/this._scaleX,i=1/this._scaleY;this._scaleY=t,0===this._scaleY?this.renderFlags&=-5:this.renderFlags|=4,s.scale(this.body,e,i),s.scale(this.body,this._scaleX,t)}},angle:{get:function(){return o(this.body.angle*n.RAD_TO_DEG)},set:function(t){this.rotation=o(t)*n.DEG_TO_RAD}},rotation:{get:function(){return this.body.angle},set:function(t){this._rotation=r(t),s.setAngle(this.body,this._rotation)}},setPosition:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this._tempVec2.set(t,e),s.setPosition(this.body,this._tempVec2),this},setRotation:function(t){return void 0===t&&(t=0),this._rotation=r(t),s.setAngle(this.body,t),this},setFixedRotation:function(){return s.setInertia(this.body,1/0),this},setAngle:function(t){return void 0===t&&(t=0),this.angle=t,s.setAngle(this.body,this.rotation),this},setScale:function(t,e,i){void 0===t&&(t=1),void 0===e&&(e=t);var n=1/this._scaleX,r=1/this._scaleY;return this._scaleX=t,this._scaleY=e,s.scale(this.body,n,r,i),s.scale(this.body,t,e,i),this}};t.exports=a},42081:(t,e,i)=>{var s=i(22562),n={setVelocityX:function(t){return this._tempVec2.set(t,this.body.velocity.y),s.setVelocity(this.body,this._tempVec2),this},setVelocityY:function(t){return this._tempVec2.set(this.body.velocity.x,t),s.setVelocity(this.body,this._tempVec2),this},setVelocity:function(t,e){return this._tempVec2.set(t,e),s.setVelocity(this.body,this._tempVec2),this},getVelocity:function(){return s.getVelocity(this.body)},setAngularVelocity:function(t){return s.setAngularVelocity(this.body,t),this},getAngularVelocity:function(){return s.getAngularVelocity(this.body)},setAngularSpeed:function(t){return s.setAngularSpeed(this.body,t),this},getAngularSpeed:function(){return s.getAngularSpeed(this.body)}};t.exports=n},31884:(t,e,i)=>{t.exports={Bounce:i(70410),Collision:i(66968),Force:i(51607),Friction:i(5436),Gravity:i(39858),Mass:i(37302),Sensor:i(39132),SetBody:i(57772),Sleep:i(38083),Static:i(90556),Transform:i(85436),Velocity:i(42081)}},85608:t=>{t.exports="afteradd"},1213:t=>{t.exports="afterremove"},25968:t=>{t.exports="afterupdate"},67205:t=>{t.exports="beforeadd"},39438:t=>{t.exports="beforeremove"},44823:t=>{t.exports="beforeupdate"},92593:t=>{t.exports="collisionactive"},60128:t=>{t.exports="collisionend"},76861:t=>{t.exports="collisionstart"},92362:t=>{t.exports="dragend"},76408:t=>{t.exports="drag"},93971:t=>{t.exports="dragstart"},5656:t=>{t.exports="pause"},47861:t=>{t.exports="resume"},79099:t=>{t.exports="sleepend"},35906:t=>{t.exports="sleepstart"},1121:(t,e,i)=>{t.exports={AFTER_ADD:i(85608),AFTER_REMOVE:i(1213),AFTER_UPDATE:i(25968),BEFORE_ADD:i(67205),BEFORE_REMOVE:i(39438),BEFORE_UPDATE:i(44823),COLLISION_ACTIVE:i(92593),COLLISION_END:i(60128),COLLISION_START:i(76861),DRAG_END:i(92362),DRAG:i(76408),DRAG_START:i(93971),PAUSE:i(5656),RESUME:i(47861),SLEEP_END:i(79099),SLEEP_START:i(35906)}},3875:(t,e,i)=>{t.exports={BodyBounds:i(68174),Components:i(31884),Events:i(1121),Factory:i(28137),MatterGameObject:i(75803),Image:i(23181),Matter:i(19933),MatterPhysics:i(42045),PolyDecomp:i(55973),Sprite:i(34803),TileBody:i(73834),PhysicsEditorParser:i(19496),PhysicsJSONParser:i(85791),PointerConstraint:i(98713),World:i(68243)}},22562:(t,e,i)=>{var s={};t.exports=s;var n=i(41598),r=i(31725),o=i(53614),a=i(53402),h=i(15647),l=i(66615);!function(){s._timeCorrection=!0,s._inertiaScale=4,s._nextCollidingGroupId=1,s._nextNonCollidingGroupId=-1,s._nextCategory=1,s._baseDelta=1e3/60,s.create=function(e){var i={id:a.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:null,position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inverseMass:0,inertia:0,deltaTime:1e3/60,inverseInertia:0,_original:null,render:{visible:!0,opacity:1,sprite:{xOffset:0,yOffset:0},fillColor:null,fillOpacity:null,lineColor:null,lineOpacity:null,lineThickness:null},gameObject:null,scale:{x:1,y:1},centerOfMass:{x:0,y:0},centerOffset:{x:0,y:0},gravityScale:{x:1,y:1},ignoreGravity:!1,ignorePointer:!1,onCollideCallback:null,onCollideEndCallback:null,onCollideActiveCallback:null,onCollideWith:{}};!e.hasOwnProperty("position")&&e.hasOwnProperty("vertices")?e.position=n.centre(e.vertices):e.hasOwnProperty("vertices")||(i.vertices=n.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"));var s=a.extend(i,e);return t(s,e),s.setOnCollideWith=function(t,e){return e?this.onCollideWith[t.id]=e:delete this.onCollideWith[t.id],this},s},s.nextGroup=function(t){return t?s._nextNonCollidingGroupId--:s._nextCollidingGroupId++},s.nextCategory=function(){return s._nextCategory=s._nextCategory<<1,s._nextCategory};var t=function(t,e){if(e=e||{},s.set(t,{bounds:t.bounds||h.create(t.vertices),positionPrev:t.positionPrev||r.clone(t.position),anglePrev:t.anglePrev||t.angle,vertices:t.vertices,parts:t.parts||[t],isStatic:t.isStatic,isSleeping:t.isSleeping,parent:t.parent||t}),n.rotate(t.vertices,t.angle,t.position),l.rotate(t.axes,t.angle),h.update(t.bounds,t.vertices,t.velocity),s.set(t,{axes:e.axes||t.axes,area:e.area||t.area,mass:e.mass||t.mass,inertia:e.inertia||t.inertia}),1===t.parts.length){var i=t.bounds,o=t.centerOfMass,a=t.centerOffset,u=i.max.x-i.min.x,c=i.max.y-i.min.y;o.x=-(i.min.x-t.position.x)/u,o.y=-(i.min.y-t.position.y)/c,a.x=u*o.x,a.y=c*o.y}};s.set=function(t,e,i){var n;for(n in"string"==typeof e&&(n=e,(e={})[n]=i),e)if(Object.prototype.hasOwnProperty.call(e,n))switch(i=e[n],n){case"isStatic":s.setStatic(t,i);break;case"isSleeping":o.set(t,i);break;case"mass":s.setMass(t,i);break;case"density":s.setDensity(t,i);break;case"inertia":s.setInertia(t,i);break;case"vertices":s.setVertices(t,i);break;case"position":s.setPosition(t,i);break;case"angle":s.setAngle(t,i);break;case"velocity":s.setVelocity(t,i);break;case"angularVelocity":s.setAngularVelocity(t,i);break;case"speed":s.setSpeed(t,i);break;case"angularSpeed":s.setAngularSpeed(t,i);break;case"parts":s.setParts(t,i);break;case"centre":s.setCentre(t,i);break;default:t[n]=i}},s.setStatic=function(t,e){for(var i=0;i0&&r.rotateAbout(a.position,s,t.position,a.position)}},s.setVelocity=function(t,e){var i=t.deltaTime/s._baseDelta;t.positionPrev.x=t.position.x-e.x*i,t.positionPrev.y=t.position.y-e.y*i,t.velocity.x=(t.position.x-t.positionPrev.x)/i,t.velocity.y=(t.position.y-t.positionPrev.y)/i,t.speed=r.magnitude(t.velocity)},s.getVelocity=function(t){var e=s._baseDelta/t.deltaTime;return{x:(t.position.x-t.positionPrev.x)*e,y:(t.position.y-t.positionPrev.y)*e}},s.getSpeed=function(t){return r.magnitude(s.getVelocity(t))},s.setSpeed=function(t,e){s.setVelocity(t,r.mult(r.normalise(s.getVelocity(t)),e))},s.setAngularVelocity=function(t,e){var i=t.deltaTime/s._baseDelta;t.anglePrev=t.angle-e*i,t.angularVelocity=(t.angle-t.anglePrev)/i,t.angularSpeed=Math.abs(t.angularVelocity)},s.getAngularVelocity=function(t){return(t.angle-t.anglePrev)*s._baseDelta/t.deltaTime},s.getAngularSpeed=function(t){return Math.abs(s.getAngularVelocity(t))},s.setAngularSpeed=function(t,e){s.setAngularVelocity(t,a.sign(s.getAngularVelocity(t))*e)},s.translate=function(t,e,i){s.setPosition(t,r.add(t.position,e),i)},s.rotate=function(t,e,i,n){if(i){var r=Math.cos(e),o=Math.sin(e),a=t.position.x-i.x,h=t.position.y-i.y;s.setPosition(t,{x:i.x+(a*r-h*o),y:i.y+(a*o+h*r)},n),s.setAngle(t,t.angle+e,n)}else s.setAngle(t,t.angle+e,n)},s.scale=function(t,e,i,r){var o=0,a=0;r=r||t.position;for(var u=t.inertia===1/0,c=0;c0&&(o+=d.area,a+=d.inertia),d.position.x=r.x+(d.position.x-r.x)*e,d.position.y=r.y+(d.position.y-r.y)*i,h.update(d.bounds,d.vertices,t.velocity)}t.parts.length>1&&(t.area=o,t.isStatic||(s.setMass(t,t.density*o),s.setInertia(t,a))),t.circleRadius&&(e===i?t.circleRadius*=e:t.circleRadius=null),u&&s.setInertia(t,1/0)},s.update=function(t,e){var i=(e=(void 0!==e?e:1e3/60)*t.timeScale)*e,o=s._timeCorrection?e/(t.deltaTime||e):1,u=1-t.frictionAir*(e/a._baseDelta),c=(t.position.x-t.positionPrev.x)*o,d=(t.position.y-t.positionPrev.y)*o;t.velocity.x=c*u+t.force.x/t.mass*i,t.velocity.y=d*u+t.force.y/t.mass*i,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.position.x+=t.velocity.x,t.position.y+=t.velocity.y,t.deltaTime=e,t.angularVelocity=(t.angle-t.anglePrev)*u*o+t.torque/t.inertia*i,t.anglePrev=t.angle,t.angle+=t.angularVelocity,t.speed=r.magnitude(t.velocity),t.angularSpeed=Math.abs(t.angularVelocity);for(var f=0;f0&&(p.position.x+=t.velocity.x,p.position.y+=t.velocity.y),0!==t.angularVelocity&&(n.rotate(p.vertices,t.angularVelocity,t.position),l.rotate(p.axes,t.angularVelocity),f>0&&r.rotateAbout(p.position,t.angularVelocity,t.position,p.position)),h.update(p.bounds,p.vertices,t.velocity)}},s.updateVelocities=function(t){var e=s._baseDelta/t.deltaTime,i=t.velocity;i.x=(t.position.x-t.positionPrev.x)*e,i.y=(t.position.y-t.positionPrev.y)*e,t.speed=Math.sqrt(i.x*i.x+i.y*i.y),t.angularVelocity=(t.angle-t.anglePrev)*e,t.angularSpeed=Math.abs(t.angularVelocity)},s.applyForce=function(t,e,i){var s=e.x-t.position.x,n=e.y-t.position.y;t.force.x+=i.x,t.force.y+=i.y,t.torque+=s*i.y-n*i.x},s._totalProperties=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},i=1===t.parts.length?0:1;i{var s={};t.exports=s;var n=i(35810),r=i(53402),o=i(15647),a=i(22562);s.create=function(t){return r.extend({id:r.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{},cache:{allBodies:null,allConstraints:null,allComposites:null}},t)},s.setModified=function(t,e,i,r){if(n.trigger(t,"compositeModified",t),t.isModified=e,e&&t.cache&&(t.cache.allBodies=null,t.cache.allConstraints=null,t.cache.allComposites=null),i&&t.parent&&s.setModified(t.parent,e,i,r),r)for(var o=0;o{var s={};t.exports=s;var n=i(69351);s.create=n.create,s.add=n.add,s.remove=n.remove,s.clear=n.clear,s.addComposite=n.addComposite,s.addBody=n.addBody,s.addConstraint=n.addConstraint},52284:(t,e,i)=>{var s={};t.exports=s;var n,r,o,a=i(41598),h=i(4506);n=[],r={overlap:0,axis:null},o={overlap:0,axis:null},s.create=function(t,e){return{pair:null,collided:!1,bodyA:t,bodyB:e,parentA:t.parent,parentB:e.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[]}},s.collides=function(t,e,i){if(s._overlapAxes(r,t.vertices,e.vertices,t.axes),r.overlap<=0)return null;if(s._overlapAxes(o,e.vertices,t.vertices,e.axes),o.overlap<=0)return null;var n,l,u=i&&i.table[h.id(t,e)];u?n=u.collision:((n=s.create(t,e)).collided=!0,n.bodyA=t.idE?E=a:aA?A=a:an?n=o:o{var e={};t.exports=e,e.create=function(t){return{vertex:t,normalImpulse:0,tangentImpulse:0}}},81388:(t,e,i)=>{var s={};t.exports=s;var n=i(53402),r=i(52284);s.create=function(t){return n.extend({bodies:[],pairs:null},t)},s.setBodies=function(t,e){t.bodies=e.slice(0)},s.clear=function(t){t.bodies=[]},s.collisions=function(t){var e,i,n=[],o=t.pairs,a=t.bodies,h=a.length,l=s.canCollide,u=r.collides;for(a.sort(s._compareBoundsX),e=0;ef)break;if(!(p<_.min.y||v>_.max.y)&&(!g||!x.isStatic&&!x.isSleeping)&&l(c.collisionFilter,x.collisionFilter)){var T=x.parts.length;if(y&&1===T)(A=u(c,x,o))&&n.push(A);else for(var w=T>1?1:0,b=m>1?1:0;b_.max.x||d.max.x<_.min.x||d.max.y<_.min.y||d.min.y>_.max.y||(A=u(S,C,o))&&n.push(A)}}}}return n},s.canCollide=function(t,e){return t.group===e.group&&0!==t.group?t.group>0:!!(t.mask&e.category)&&!!(e.mask&t.category)},s._compareBoundsX=function(t,e){return t.bounds.min.x-e.bounds.min.x}},4506:(t,e,i)=>{var s={};t.exports=s;var n=i(43424);s.create=function(t,e){var i=t.bodyA,n=t.bodyB,r={id:s.id(i,n),bodyA:i,bodyB:n,collision:t,contacts:[],activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:i.isSensor||n.isSensor,timeCreated:e,timeUpdated:e,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return s.update(r,t,e),r},s.update=function(t,e,i){var s=t.contacts,r=e.supports,o=t.activeContacts,a=e.parentA,h=e.parentB,l=a.vertices.length;t.isActive=!0,t.timeUpdated=i,t.collision=e,t.separation=e.depth,t.inverseMass=a.inverseMass+h.inverseMass,t.friction=a.frictionh.frictionStatic?a.frictionStatic:h.frictionStatic,t.restitution=a.restitution>h.restitution?a.restitution:h.restitution,t.slop=a.slop>h.slop?a.slop:h.slop,e.pair=t,o.length=0;for(var u=0;u{var s={};t.exports=s;var n=i(4506),r=i(53402);s.create=function(t){return r.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},t)},s.update=function(t,e,i){var s,r,o,a,h=t.list,l=h.length,u=t.table,c=e.length,d=t.collisionStart,f=t.collisionEnd,p=t.collisionActive;for(d.length=0,f.length=0,p.length=0,a=0;a{var s={};t.exports=s;var n=i(31725),r=i(52284),o=i(15647),a=i(66280),h=i(41598);s.collides=function(t,e){for(var i=[],s=e.length,n=t.bounds,a=r.collides,h=o.overlaps,l=0;l{var s={};t.exports=s;var n=i(41598),r=i(53402),o=i(15647);s._restingThresh=2,s._restingThreshTangent=Math.sqrt(6),s._positionDampen=.9,s._positionWarming=.8,s._frictionNormalMultiplier=5,s._frictionMaxStatic=Number.MAX_VALUE,s.preSolvePosition=function(t){var e,i,s,n=t.length;for(e=0;eV?(n=Y>0?Y:-Y,(i=v.friction*(Y>0?1:-1)*l)<-n?i=-n:i>n&&(i=n)):(i=Y,n=f);var W=O*b-F*w,H=D*b-k*w,j=_/(M+m.inverseInertia*W*W+y.inverseInertia*H*H),q=(1+v.restitution)*X*j;if(i*=j,X0&&(R.normalImpulse=0),q=R.normalImpulse-K}if(Y<-c||Y>c)R.tangentImpulse=0;else{var Z=R.tangentImpulse;R.tangentImpulse+=i,R.tangentImpulse<-n&&(R.tangentImpulse=-n),R.tangentImpulse>n&&(R.tangentImpulse=n),i=R.tangentImpulse-Z}var J=w*q+S*i,Q=b*q+E*i;m.isStatic||m.isSleeping||(m.positionPrev.x+=J*m.inverseMass,m.positionPrev.y+=Q*m.inverseMass,m.anglePrev+=(O*Q-F*J)*m.inverseInertia),y.isStatic||y.isSleeping||(y.positionPrev.x-=J*y.inverseMass,y.positionPrev.y-=Q*y.inverseMass,y.anglePrev-=(D*Q-k*J)*y.inverseInertia)}}}}},48140:(t,e,i)=>{var s={};t.exports=s;var n=i(41598),r=i(31725),o=i(53614),a=i(15647),h=i(66615),l=i(53402);s._warming=.4,s._torqueDampen=1,s._minLength=1e-6,s.create=function(t){var e=t;e.bodyA&&!e.pointA&&(e.pointA={x:0,y:0}),e.bodyB&&!e.pointB&&(e.pointB={x:0,y:0});var i=e.bodyA?r.add(e.bodyA.position,e.pointA):e.pointA,s=e.bodyB?r.add(e.bodyB.position,e.pointB):e.pointB,n=r.magnitude(r.sub(i,s));e.length=void 0!==e.length?e.length:n,e.id=e.id||l.nextId(),e.label=e.label||"Constraint",e.type="constraint",e.stiffness=e.stiffness||(e.length>0?1:.7),e.damping=e.damping||0,e.angularStiffness=e.angularStiffness||0,e.angleA=e.bodyA?e.bodyA.angle:e.angleA,e.angleB=e.bodyB?e.bodyB.angle:e.angleB,e.plugin={};var o={visible:!0,type:"line",anchors:!0,lineColor:null,lineOpacity:null,lineThickness:null,pinSize:null,anchorColor:null,anchorSize:null};return 0===e.length&&e.stiffness>.1?(o.type="pin",o.anchors=!1):e.stiffness<.9&&(o.type="spring"),e.render=l.extend(o,e.render),e},s.preSolveAll=function(t){for(var e=0;e=1||0===t.length?t.stiffness*e:t.stiffness*e*e,x=t.damping*e,T=r.mult(u,m*y),w=(i?i.inverseMass:0)+(n?n.inverseMass:0),b=w+((i?i.inverseInertia:0)+(n?n.inverseInertia:0));if(x>0){var S=r.create();p=r.div(u,c),g=r.sub(n&&r.sub(n.position,n.positionPrev)||S,i&&r.sub(i.position,i.positionPrev)||S),v=r.dot(p,g)}i&&!i.isStatic&&(f=i.inverseMass/w,i.constraintImpulse.x-=T.x*f,i.constraintImpulse.y-=T.y*f,i.position.x-=T.x*f,i.position.y-=T.y*f,x>0&&(i.positionPrev.x-=x*p.x*v*f,i.positionPrev.y-=x*p.y*v*f),d=r.cross(o,T)/b*s._torqueDampen*i.inverseInertia*(1-t.angularStiffness),i.constraintImpulse.angle-=d,i.angle-=d),n&&!n.isStatic&&(f=n.inverseMass/w,n.constraintImpulse.x+=T.x*f,n.constraintImpulse.y+=T.y*f,n.position.x+=T.x*f,n.position.y+=T.y*f,x>0&&(n.positionPrev.x+=x*p.x*v*f,n.positionPrev.y+=x*p.y*v*f),d=r.cross(a,T)/b*s._torqueDampen*n.inverseInertia*(1-t.angularStiffness),n.constraintImpulse.angle+=d,n.angle+=d)}}},s.postSolveAll=function(t){for(var e=0;e0&&(c.position.x+=l.x,c.position.y+=l.y),0!==l.angle&&(n.rotate(c.vertices,l.angle,i.position),h.rotate(c.axes,l.angle),u>0&&r.rotateAbout(c.position,l.angle,i.position,c.position)),a.update(c.bounds,c.vertices,i.velocity)}l.angle*=s._warming,l.x*=s._warming,l.y*=s._warming}}},s.pointAWorld=function(t){return{x:(t.bodyA?t.bodyA.position.x:0)+(t.pointA?t.pointA.x:0),y:(t.bodyA?t.bodyA.position.y:0)+(t.pointA?t.pointA.y:0)}},s.pointBWorld=function(t){return{x:(t.bodyB?t.bodyB.position.x:0)+(t.pointB?t.pointB.x:0),y:(t.bodyB?t.bodyB.position.y:0)+(t.pointB?t.pointB.y:0)}},s.currentLength=function(t){var e=(t.bodyA?t.bodyA.position.x:0)+(t.pointA?t.pointA.x:0),i=(t.bodyA?t.bodyA.position.y:0)+(t.pointA?t.pointA.y:0),s=e-((t.bodyB?t.bodyB.position.x:0)+(t.pointB?t.pointB.x:0)),n=i-((t.bodyB?t.bodyB.position.y:0)+(t.pointB?t.pointB.y:0));return Math.sqrt(s*s+n*n)}},53402:(t,e,i)=>{var s={};t.exports=s,function(){s._baseDelta=1e3/60,s._nextId=0,s._seed=0,s._nowStartTime=+new Date,s._warnedOnce={},s._decomp=null,s.extend=function(t,e){var i,n;"boolean"==typeof e?(i=2,n=e):(i=1,n=!0);for(var r=i;r0;e--){var i=Math.floor(s.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t},s.choose=function(t){return t[Math.floor(s.random()*t.length)]},s.isElement=function(t){return"undefined"!=typeof HTMLElement?t instanceof HTMLElement:!!(t&&t.nodeType&&t.nodeName)},s.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},s.isFunction=function(t){return"function"==typeof t},s.isPlainObject=function(t){return"object"==typeof t&&t.constructor===Object},s.isString=function(t){return"[object String]"===toString.call(t)},s.clamp=function(t,e,i){return ti?i:t},s.sign=function(t){return t<0?-1:1},s.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-s._nowStartTime},s.random=function(e,i){return i=void 0!==i?i:1,(e=void 0!==e?e:0)+t()*(i-e)};var t=function(){return s._seed=(9301*s._seed+49297)%233280,s._seed/233280};s.colorToNumber=function(t){return 3==(t=t.replace("#","")).length&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),parseInt(t,16)},s.logLevel=1,s.log=function(){console&&s.logLevel>0&&s.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},s.info=function(){console&&s.logLevel>0&&s.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},s.warn=function(){console&&s.logLevel>0&&s.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},s.warnOnce=function(){var t=Array.prototype.slice.call(arguments).join(" ");s._warnedOnce[t]||(s.warn(t),s._warnedOnce[t]=!0)},s.deprecated=function(t,e,i){t[e]=s.chain((function(){s.warnOnce("🔅 deprecated 🔅",i)}),t[e])},s.nextId=function(){return s._nextId++},s.indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0;i{var s={};t.exports=s;var n=i(53614),r=i(66272),o=i(81388),a=i(99561),h=i(35810),l=i(69351),u=i(48140),c=i(53402),d=i(22562);s.create=function(t){t=t||{};var e=c.extend({positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},gravity:{x:0,y:1,scale:.001},timing:{timestamp:0,timeScale:1,lastDelta:0,lastElapsed:0}},t);return e.world=t.world||l.create({label:"World"}),e.pairs=t.pairs||a.create(),e.detector=t.detector||o.create(),e.grid={buckets:[]},e.world.gravity=e.gravity,e.broadphase=e.grid,e.metrics={},e},s.update=function(t,e){var i,d=c.now(),f=t.world,p=t.detector,v=t.pairs,g=t.timing,m=g.timestamp;e=void 0!==e?e:c._baseDelta,e*=g.timeScale,g.timestamp+=e,g.lastDelta=e;var y={timestamp:g.timestamp,delta:e};h.trigger(t,"beforeUpdate",y);var x=l.allBodies(f),T=l.allConstraints(f);for(f.isModified&&(o.setBodies(p,x),l.setModified(f,!1,!1,!0)),t.enableSleeping&&n.update(x,e),s._bodiesApplyGravity(x,t.gravity),e>0&&s._bodiesUpdate(x,e),h.trigger(t,"beforeSolve",y),u.preSolveAll(x),i=0;i0&&h.trigger(t,"collisionStart",{pairs:v.collisionStart,timestamp:g.timestamp,delta:e});var b=c.clamp(20/t.positionIterations,0,1);for(r.preSolvePosition(v.list),i=0;i0&&h.trigger(t,"collisionActive",{pairs:v.collisionActive,timestamp:g.timestamp,delta:e}),v.collisionEnd.length>0&&h.trigger(t,"collisionEnd",{pairs:v.collisionEnd,timestamp:g.timestamp,delta:e}),s._bodiesClearForces(x),h.trigger(t,"afterUpdate",y),t.timing.lastElapsed=c.now()-d,t},s.merge=function(t,e){if(c.extend(t,e),e.world){t.world=e.world,s.clear(t);for(var i=l.allBodies(t.world),r=0;r{var s={};t.exports=s;var n=i(53402);s.on=function(t,e,i){for(var s,n=e.split(" "),r=0;r0){i||(i={}),s=e.split(" ");for(var l=0;l{var s={};t.exports=s;var n=i(73832),r=i(53402);s.name="matter-js",s.version="0.19.0",s.uses=[],s.used=[],s.use=function(){n.use(s,Array.prototype.slice.call(arguments))},s.before=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathBefore(s,t,e)},s.after=function(t,e){return t=t.replace(/^Matter./,""),r.chainPathAfter(s,t,e)}},73832:(t,e,i)=>{var s={};t.exports=s;var n=i(53402);s._registry={},s.register=function(t){if(s.isPlugin(t)||n.warn("Plugin.register:",s.toString(t),"does not implement all required fields."),t.name in s._registry){var e=s._registry[t.name],i=s.versionParse(t.version).number,r=s.versionParse(e.version).number;i>r?(n.warn("Plugin.register:",s.toString(e),"was upgraded to",s.toString(t)),s._registry[t.name]=t):i-1},s.isFor=function(t,e){var i=t.for&&s.dependencyParse(t.for);return!t.for||e.name===i.name&&s.versionSatisfies(e.version,i.range)},s.use=function(t,e){if(t.uses=(t.uses||[]).concat(e||[]),0!==t.uses.length){for(var i=s.dependencies(t),r=n.topologicalSort(i),o=[],a=0;a0&&!h.silent&&n.info(o.join(" "))}else n.warn("Plugin.use:",s.toString(t),"does not specify any dependencies to install.")},s.dependencies=function(t,e){var i=s.dependencyParse(t),r=i.name;if(!(r in(e=e||{}))){t=s.resolve(t)||t,e[r]=n.map(t.uses||[],(function(e){s.isPlugin(e)&&s.register(e);var r=s.dependencyParse(e),o=s.resolve(e);return o&&!s.versionSatisfies(o.version,r.range)?(n.warn("Plugin.dependencies:",s.toString(o),"does not satisfy",s.toString(r),"used by",s.toString(i)+"."),o._warned=!0,t._warned=!0):o||(n.warn("Plugin.dependencies:",s.toString(e),"used by",s.toString(i),"could not be resolved."),t._warned=!0),r.name}));for(var o=0;o=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;e.test(t)||n.warn("Plugin.versionParse:",t,"is not a valid version or range.");var i=e.exec(t),s=Number(i[4]),r=Number(i[5]),o=Number(i[6]);return{isRange:Boolean(i[1]||i[2]),version:i[3],range:t,operator:i[1]||i[2]||"",major:s,minor:r,patch:o,parts:[s,r,o],prerelease:i[7],number:1e8*s+1e4*r+o}},s.versionSatisfies=function(t,e){e=e||"*";var i=s.versionParse(e),n=s.versionParse(t);if(i.isRange){if("*"===i.operator||"*"===t)return!0;if(">"===i.operator)return n.number>i.number;if(">="===i.operator)return n.number>=i.number;if("~"===i.operator)return n.major===i.major&&n.minor===i.minor&&n.patch>=i.patch;if("^"===i.operator)return i.major>0?n.major===i.major&&n.number>=i.number:i.minor>0?n.minor===i.minor&&n.patch>=i.patch:n.patch===i.patch}return t===e||"*"===t}},53614:(t,e,i)=>{var s={};t.exports=s;var n=i(22562),r=i(35810),o=i(53402);s._motionWakeThreshold=.18,s._motionSleepThreshold=.08,s._minBias=.9,s.update=function(t,e){for(var i=e/o._baseDelta,r=s._motionSleepThreshold,a=0;a0&&h.motion=h.sleepThreshold/i&&s.set(h,!0)):h.sleepCounter>0&&(h.sleepCounter-=1)}else s.set(h,!1)}},s.afterCollisions=function(t){for(var e=s._motionSleepThreshold,i=0;ie&&s.set(h,!1)}}}},s.set=function(t,e){var i=t.isSleeping;e?(t.isSleeping=!0,t.sleepCounter=t.sleepThreshold,t.positionImpulse.x=0,t.positionImpulse.y=0,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.anglePrev=t.angle,t.speed=0,t.angularSpeed=0,t.motion=0,i||r.trigger(t,"sleepStart")):(t.isSleeping=!1,t.sleepCounter=0,i&&r.trigger(t,"sleepEnd"))}},66280:(t,e,i)=>{var s={};t.exports=s;var n=i(41598),r=i(53402),o=i(22562),a=i(15647),h=i(31725);s.rectangle=function(t,e,i,s,a){a=a||{};var h={label:"Rectangle Body",position:{x:t,y:e},vertices:n.fromPath("L 0 0 L "+i+" 0 L "+i+" "+s+" L 0 "+s)};if(a.chamfer){var l=a.chamfer;h.vertices=n.chamfer(h.vertices,l.radius,l.quality,l.qualityMin,l.qualityMax),delete a.chamfer}return o.create(r.extend({},h,a))},s.trapezoid=function(t,e,i,s,a,h){h=h||{};var l,u=i*(a*=.5),c=u+(1-2*a)*i,d=c+u;l=a<.5?"L 0 0 L "+u+" "+-s+" L "+c+" "+-s+" L "+d+" 0":"L 0 0 L "+c+" "+-s+" L "+d+" 0";var f={label:"Trapezoid Body",position:{x:t,y:e},vertices:n.fromPath(l)};if(h.chamfer){var p=h.chamfer;f.vertices=n.chamfer(f.vertices,p.radius,p.quality,p.qualityMin,p.qualityMax),delete h.chamfer}return o.create(r.extend({},f,h))},s.circle=function(t,e,i,n,o){n=n||{};var a={label:"Circle Body",circleRadius:i};o=o||25;var h=Math.ceil(Math.max(10,Math.min(o,i)));return h%2==1&&(h+=1),s.polygon(t,e,h,i,r.extend({},a,n))},s.polygon=function(t,e,i,a,h){if(h=h||{},i<3)return s.circle(t,e,a,h);for(var l=2*Math.PI/i,u="",c=.5*l,d=0;d0&&n.area(C)1?(p=o.create(r.extend({parts:v.slice(0)},s)),o.setPosition(p,{x:t,y:e}),p):v[0]},s.flagCoincidentParts=function(t,e){void 0===e&&(e=5);for(var i=0;i{var s={};t.exports=s;var n=i(69351),r=i(48140),o=i(53402),a=i(22562),h=i(66280);s.stack=function(t,e,i,s,r,o,h){for(var l,u=n.create({label:"Stack"}),c=t,d=e,f=0,p=0;pv&&(v=y),a.translate(m,{x:.5*x,y:.5*y}),c=m.bounds.max.x+r,n.addBody(u,m),l=m,f+=1}else c+=r}d+=v+o,c=t}return u},s.chain=function(t,e,i,s,a,h){for(var l=t.bodies,u=1;u0)for(l=0;l0&&(d=f[l-1+(h-1)*e],n.addConstraint(t,r.create(o.extend({bodyA:d,bodyB:c},a)))),s&&ld||o<(l=d-l)||o>i-1-l))return 1===c&&a.translate(u,{x:(o+(i%2==1?1:-1))*f,y:0}),h(t+(u?o*f:0)+o*r,s,o,l,u,c)}))},s.newtonsCradle=function(t,e,i,s,o){for(var a=n.create({label:"Newtons Cradle"}),l=0;l{var s={};t.exports=s;var n=i(31725),r=i(53402);s.fromVertices=function(t){for(var e={},i=0;i{var e={};t.exports=e,e.create=function(t){var i={min:{x:0,y:0},max:{x:0,y:0}};return t&&e.update(i,t),i},e.update=function(t,e,i){t.min.x=1/0,t.max.x=-1/0,t.min.y=1/0,t.max.y=-1/0;for(var s=0;st.max.x&&(t.max.x=n.x),n.xt.max.y&&(t.max.y=n.y),n.y0?t.max.x+=i.x:t.min.x+=i.x,i.y>0?t.max.y+=i.y:t.min.y+=i.y)},e.contains=function(t,e){return e.x>=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},e.overlaps=function(t,e){return t.min.x<=e.max.x&&t.max.x>=e.min.x&&t.max.y>=e.min.y&&t.min.y<=e.max.y},e.translate=function(t,e){t.min.x+=e.x,t.max.x+=e.x,t.min.y+=e.y,t.max.y+=e.y},e.shift=function(t,e){var i=t.max.x-t.min.x,s=t.max.y-t.min.y;t.min.x=e.x,t.max.x=e.x+i,t.min.y=e.y,t.max.y=e.y+s}},74058:(t,e,i)=>{var s={};t.exports=s,i(15647);var n=i(53402);s.pathToVertices=function(t,e){"undefined"==typeof window||"SVGPathSeg"in window||n.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var i,r,o,a,h,l,u,c,d,f,p,v=[],g=0,m=0,y=0;e=e||15;var x=function(t,e,i){var s=i%2==1&&i>1;if(!d||t!=d.x||e!=d.y){d&&s?(f=d.x,p=d.y):(f=0,p=0);var n={x:f+t,y:p+e};!s&&d||(d=n),v.push(n),m=f+t,y=p+e}},T=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":m=t.x,y=t.y;break;case"H":m=t.x;break;case"V":y=t.y}x(m,y,t.pathSegType)}};for(s._svgPathToAbsolute(t),o=t.getTotalLength(),l=[],i=0;i{var e={};t.exports=e,e.create=function(t,e){return{x:t||0,y:e||0}},e.clone=function(t){return{x:t.x,y:t.y}},e.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},e.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},e.rotate=function(t,e,i){var s=Math.cos(e),n=Math.sin(e);i||(i={});var r=t.x*s-t.y*n;return i.y=t.x*n+t.y*s,i.x=r,i},e.rotateAbout=function(t,e,i,s){var n=Math.cos(e),r=Math.sin(e);s||(s={});var o=i.x+((t.x-i.x)*n-(t.y-i.y)*r);return s.y=i.y+((t.x-i.x)*r+(t.y-i.y)*n),s.x=o,s},e.normalise=function(t){var i=e.magnitude(t);return 0===i?{x:0,y:0}:{x:t.x/i,y:t.y/i}},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.cross=function(t,e){return t.x*e.y-t.y*e.x},e.cross3=function(t,e,i){return(e.x-t.x)*(i.y-t.y)-(e.y-t.y)*(i.x-t.x)},e.add=function(t,e,i){return i||(i={}),i.x=t.x+e.x,i.y=t.y+e.y,i},e.sub=function(t,e,i){return i||(i={}),i.x=t.x-e.x,i.y=t.y-e.y,i},e.mult=function(t,e){return{x:t.x*e,y:t.y*e}},e.div=function(t,e){return{x:t.x/e,y:t.y/e}},e.perp=function(t,e){return{x:(e=!0===e?-1:1)*-t.y,y:e*t.x}},e.neg=function(t){return{x:-t.x,y:-t.y}},e.angle=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},e._temp=[e.create(),e.create(),e.create(),e.create(),e.create(),e.create()]},41598:(t,e,i)=>{var s={};t.exports=s;var n=i(31725),r=i(53402);s.create=function(t,e){for(var i=[],s=0;s0)return!1;o=i}return!0},s.scale=function(t,e,i,r){if(1===e&&1===i)return t;var o,a;r=r||s.centre(t);for(var h=0;h=0?h-1:t.length-1],u=t[h],c=t[(h+1)%t.length],d=e[h0&&(r|=2),3===r)return!1;return 0!==r||null},s.hull=function(t){var e,i,s=[],r=[];for((t=t.slice(0)).sort((function(t,e){var i=t.x-e.x;return 0!==i?i:t.y-e.y})),i=0;i=2&&n.cross3(r[r.length-2],r[r.length-1],e)<=0;)r.pop();r.push(e)}for(i=t.length-1;i>=0;i-=1){for(e=t[i];s.length>=2&&n.cross3(s[s.length-2],s[s.length-1],e)<=0;)s.pop();s.push(e)}return s.pop(),r.pop(),s.concat(r)}},18210:(t,e,i)=>{var s=i(19933),n={name:"matter-attractors",version:"0.1.7",for:"matter-js@^0.19.0",silent:!0,install:function(t){t.after("Body.create",(function(){n.Body.init(this)})),t.before("Engine.update",(function(t){n.Engine.update(t)}))},Body:{init:function(t){t.plugin.attractors=t.plugin.attractors||[]}},Engine:{update:function(t){for(var e=s.Composite.allBodies(t.world),i=0;i0)for(var o=0;o{t.exports={name:"matter-collision-events",version:"0.1.6",for:"matter-js@^0.19.0",silent:!0,install:function(t){t.after("Engine.create",(function(){t.Events.on(this,"collisionStart",(function(e){e.pairs.map((function(e){var i=e.bodyA,s=e.bodyB;i.gameObject&&i.gameObject.emit("collide",i,s,e),s.gameObject&&s.gameObject.emit("collide",s,i,e),t.Events.trigger(i,"onCollide",{pair:e}),t.Events.trigger(s,"onCollide",{pair:e}),i.onCollideCallback&&i.onCollideCallback(e),s.onCollideCallback&&s.onCollideCallback(e),i.onCollideWith[s.id]&&i.onCollideWith[s.id](s,e),s.onCollideWith[i.id]&&s.onCollideWith[i.id](i,e)}))})),t.Events.on(this,"collisionActive",(function(e){e.pairs.map((function(e){var i=e.bodyA,s=e.bodyB;i.gameObject&&i.gameObject.emit("collideActive",i,s,e),s.gameObject&&s.gameObject.emit("collideActive",s,i,e),t.Events.trigger(i,"onCollideActive",{pair:e}),t.Events.trigger(s,"onCollideActive",{pair:e}),i.onCollideActiveCallback&&i.onCollideActiveCallback(e),s.onCollideActiveCallback&&s.onCollideActiveCallback(e)}))})),t.Events.on(this,"collisionEnd",(function(e){e.pairs.map((function(e){var i=e.bodyA,s=e.bodyB;i.gameObject&&i.gameObject.emit("collideEnd",i,s,e),s.gameObject&&s.gameObject.emit("collideEnd",s,i,e),t.Events.trigger(i,"onCollideEnd",{pair:e}),t.Events.trigger(s,"onCollideEnd",{pair:e}),i.onCollideEndCallback&&i.onCollideEndCallback(e),s.onCollideEndCallback&&s.onCollideEndCallback(e)}))}))}))}}},74507:(t,e,i)=>{var s=i(19933),n={name:"matter-wrap",version:"0.1.4",for:"matter-js@^0.19.0",silent:!0,install:function(t){t.after("Engine.update",(function(){n.Engine.update(this)}))},Engine:{update:function(t){for(var e=t.world,i=s.Composite.allBodies(e),r=s.Composite.allComposites(e),o=0;oe.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?s=e.min.y-t.max.y:t.max.y{function e(t,e,i){i=i||0;var s,n,r,o,a,h,l,u=[0,0];return s=t[1][1]-t[0][1],n=t[0][0]-t[1][0],r=s*t[0][0]+n*t[0][1],o=e[1][1]-e[0][1],a=e[0][0]-e[1][0],h=o*e[0][0]+a*e[0][1],S(l=s*a-o*n,0,i)||(u[0]=(a*r-n*h)/l,u[1]=(s*h-o*r)/l),u}function i(t,e,i,s){var n=e[0]-t[0],r=e[1]-t[1],o=s[0]-i[0],a=s[1]-i[1];if(o*r-a*n==0)return!1;var h=(n*(i[1]-t[1])+r*(t[0]-i[0]))/(o*r-a*n),l=(o*(t[1]-i[1])+a*(i[0]-t[0]))/(a*n-o*r);return h>=0&&h<=1&&l>=0&&l<=1}function s(t,e,i){return(e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1])}function n(t,e,i){return s(t,e,i)>0}function r(t,e,i){return s(t,e,i)>=0}function o(t,e,i){return s(t,e,i)<0}function a(t,e,i){return s(t,e,i)<=0}t.exports={decomp:function(t){var e=T(t);return e.length>0?w(t,e):[t]},quickDecomp:function t(e,i,s,h,l,u,v){u=u||100,v=v||0,l=l||25,i=void 0!==i?i:[],s=s||[],h=h||[];var g=[0,0],m=[0,0],x=[0,0],T=0,w=0,S=0,E=0,A=0,C=0,_=0,M=[],P=[],R=e,L=e;if(L.length<3)return i;if(++v>u)return console.warn("quickDecomp: max level ("+u+") reached."),i;for(var O=0;OA&&(A+=e.length),E=Number.MAX_VALUE,A3&&s>=0;--s)u(d(t,s-1),d(t,s),d(t,s+1),e)&&(t.splice(s%t.length,1),i++);return i},removeDuplicatePoints:function(t,e){for(var i=t.length-1;i>=1;--i)for(var s=t[i],n=i-1;n>=0;--n)E(s,t[n],e)&&t.splice(i,1)},makeCCW:function(t){for(var e=0,i=t,s=1;si[e][0])&&(e=s);return!n(d(t,e-1),d(t,e),d(t,e+1))&&(function(t){for(var e=[],i=t.length,s=0;s!==i;s++)e.push(t.pop());for(s=0;s!==i;s++)t[s]=e[s]}(t),!0)}};var h=[],l=[];function u(t,e,i,n){if(n){var r=h,o=l;r[0]=e[0]-t[0],r[1]=e[1]-t[1],o[0]=i[0]-e[0],o[1]=i[1]-e[1];var a=r[0]*o[0]+r[1]*o[1],u=Math.sqrt(r[0]*r[0]+r[1]*r[1]),c=Math.sqrt(o[0]*o[0]+o[1]*o[1]);return Math.acos(a/(u*c)){var s=new(i(83419))({initialize:function(t){this.pluginManager=t,this.game=t.game},init:function(){},start:function(){},stop:function(){},destroy:function(){this.pluginManager=null,this.game=null,this.scene=null,this.systems=null}});t.exports=s},42363:t=>{t.exports={Global:["game","anims","cache","plugins","registry","scale","sound","textures","renderer"],CoreScene:["EventEmitter","CameraManager","GameObjectCreator","GameObjectFactory","ScenePlugin","DisplayList","UpdateList"],DefaultScene:["Clock","DataManagerPlugin","InputPlugin","Loader","TweenManager","LightsPlugin"]}},37277:t=>{var e={},i={},s={register:function(t,i,s,n){void 0===n&&(n=!1),e[t]={plugin:i,mapping:s,custom:n}},registerCustom:function(t,e,s,n){i[t]={plugin:e,mapping:s,data:n}},hasCore:function(t){return e.hasOwnProperty(t)},hasCustom:function(t){return i.hasOwnProperty(t)},getCore:function(t){return e[t]},getCustom:function(t){return i[t]},getCustomClass:function(t){return i.hasOwnProperty(t)?i[t].plugin:null},remove:function(t){e.hasOwnProperty(t)&&delete e[t]},removeCustom:function(t){i.hasOwnProperty(t)&&delete i[t]},destroyCorePlugins:function(){for(var t in e)e.hasOwnProperty(t)&&delete e[t]},destroyCustomPlugins:function(){for(var t in i)i.hasOwnProperty(t)&&delete i[t]}};t.exports=s},77332:(t,e,i)=>{var s=i(83419),n=i(8443),r=i(50792),o=i(74099),a=i(44603),h=i(39429),l=i(95540),u=i(37277),c=i(72905),d=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.plugins=[],this.scenePlugins=[],this._pendingGlobal=[],this._pendingScene=[],t.isBooted?this.boot():t.events.once(n.BOOT,this.boot,this)},boot:function(){var t,e,i,s,r,o,a,h=this.game.config,u=h.installGlobalPlugins;for(u=u.concat(this._pendingGlobal),t=0;t{var s=i(52018),n=i(83419),r=i(44594),o=new n({Extends:s,initialize:function(t,e,i){s.call(this,e),this.scene=t,this.systems=t.sys,this.pluginKey=i,t.sys.events.once(r.BOOT,this.boot,this)},boot:function(){},destroy:function(){this.pluginManager=null,this.game=null,this.scene=null,this.systems=null}});t.exports=o},18922:(t,e,i)=>{t.exports={BasePlugin:i(52018),DefaultPlugins:i(42363),PluginCache:i(37277),PluginManager:i(77332),ScenePlugin:i(45145)}},63595:()=>{HTMLVideoElement&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(t){const e=performance.now(),i=this.getVideoPlaybackQuality(),s=this.mozPresentedFrames||this.mozPaintedFrames||i.totalVideoFrames-i.droppedVideoFrames,n=(r,o)=>{const a=this.getVideoPlaybackQuality(),h=this.mozPresentedFrames||this.mozPaintedFrames||a.totalVideoFrames-a.droppedVideoFrames;if(h>s){const s=this.mozFrameDelay||a.totalFrameDelay-i.totalFrameDelay||0,n=o-r;t(o,{presentationTime:o+1e3*s,expectedDisplayTime:o+n,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+n/1e3,presentedFrames:h,processingDuration:s}),delete this._rvfcpolyfillmap[e]}else this._rvfcpolyfillmap[e]=requestAnimationFrame((t=>n(o,t)))};return this._rvfcpolyfillmap[e]=requestAnimationFrame((t=>n(e,t))),e},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(t){cancelAnimationFrame(this._rvfcpolyfillmap[t]),delete this._rvfcpolyfillmap[t]})},10312:t=>{t.exports={SKIP_CHECK:-1,NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16,ERASE:17,SOURCE_IN:18,SOURCE_OUT:19,SOURCE_ATOP:20,DESTINATION_OVER:21,DESTINATION_IN:22,DESTINATION_OUT:23,DESTINATION_ATOP:24,LIGHTER:25,COPY:26,XOR:27}},29795:t=>{t.exports={DEFAULT:0,LINEAR:0,NEAREST:1}},68627:(t,e,i)=>{var s=i(19715),n=i(32880),r=i(83419),o=i(8054),a=i(50792),h=i(92503),l=i(56373),u=i(97480),c=i(69442),d=i(61340),f=new r({Extends:a,initialize:function(t){a.call(this);var e=t.config;this.config={clearBeforeRender:e.clearBeforeRender,backgroundColor:e.backgroundColor,antialias:e.antialias,roundPixels:e.roundPixels},this.game=t,this.type=o.CANVAS,this.drawCount=0,this.width=0,this.height=0,this.gameCanvas=t.canvas;var i={alpha:t.config.transparent,desynchronized:t.config.desynchronized,willReadFrequently:!1};this.gameContext=e.context?e.context:this.gameCanvas.getContext("2d",i),this.currentContext=this.gameContext,this.antialias=t.config.antialias,this.blendModes=l(),this.snapshotState={x:0,y:0,width:1,height:1,getPixel:!1,callback:null,type:"image/png",encoder:.92},this._tempMatrix1=new d,this._tempMatrix2=new d,this._tempMatrix3=new d,this.isBooted=!1,this.init()},init:function(){this.game.textures.once(c.READY,this.boot,this)},boot:function(){var t=this.game,e=t.scale.baseSize;this.width=e.width,this.height=e.height,this.isBooted=!0,t.scale.on(u.RESIZE,this.onResize,this),this.resize(e.width,e.height)},onResize:function(t,e){e.width===this.width&&e.height===this.height||this.resize(e.width,e.height)},resize:function(t,e){this.width=t,this.height=e,this.emit(h.RESIZE,t,e)},resetTransform:function(){this.currentContext.setTransform(1,0,0,1,0,0)},setBlendMode:function(t){return this.currentContext.globalCompositeOperation=t,this},setContext:function(t){return this.currentContext=t||this.gameContext,this},setAlpha:function(t){return this.currentContext.globalAlpha=t,this},preRender:function(){var t=this.gameContext,e=this.config,i=this.width,s=this.height;t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),e.clearBeforeRender&&(t.clearRect(0,0,i,s),e.transparent||(t.fillStyle=e.backgroundColor.rgba,t.fillRect(0,0,i,s))),t.save(),this.drawCount=0,this.emit(h.PRE_RENDER)},render:function(t,e,i){var n=e.length;this.emit(h.RENDER,t,i);var r=i.x,o=i.y,a=i.width,l=i.height,u=i.renderToTexture?i.context:t.sys.context;u.save(),this.game.scene.customViewports&&(u.beginPath(),u.rect(r,o,a,l),u.clip()),i.emit(s.PRE_RENDER,i),this.currentContext=u;var c=i.mask;c&&c.preRenderCanvas(this,null,i._maskCamera),i.transparent||(u.fillStyle=i.backgroundColor.rgba,u.fillRect(r,o,a,l)),u.globalAlpha=i.alpha,u.globalCompositeOperation="source-over",this.drawCount+=n,i.renderToTexture&&i.emit(s.PRE_RENDER,i),i.matrix.copyToContext(u);for(var d=0;d=0?m=-(m+c):m<0&&(m=Math.abs(m)-c)),t.flipY&&(y>=0?y=-(y+d):y<0&&(y=Math.abs(y)-d))}var T=1,w=1;t.flipX&&(f||(m+=-e.realWidth+2*v),T=-1),t.flipY&&(f||(y+=-e.realHeight+2*g),w=-1);var b=t.x,S=t.y;a.applyITRS(b,S,t.rotation,t.scaleX*T,t.scaleY*w),o.copyFrom(i.matrix),s?(o.multiplyWithOffset(s,-i.scrollX*t.scrollFactorX,-i.scrollY*t.scrollFactorY),a.e=b,a.f=S):(a.e-=i.scrollX*t.scrollFactorX,a.f-=i.scrollY*t.scrollFactorY),o.multiply(a),i.roundPixels&&(o.e=Math.round(o.e),o.f=Math.round(o.f)),r.save(),o.setToContext(r),r.globalCompositeOperation=this.blendModes[t.blendMode],r.globalAlpha=n,r.imageSmoothingEnabled=!e.source.scaleMode,t.mask&&t.mask.preRenderCanvas(this,t,i),c>0&&d>0&&(i.roundPixels?r.drawImage(e.source.image,l,u,c,d,Math.round(m),Math.round(y),Math.round(c/p),Math.round(d/p)):r.drawImage(e.source.image,l,u,c,d,m,y,c/p,d/p)),t.mask&&t.mask.postRenderCanvas(this,t,i),r.restore()}},destroy:function(){this.removeAllListeners(),this.game=null,this.gameCanvas=null,this.gameContext=null}});t.exports=f},55830:(t,e,i)=>{t.exports={CanvasRenderer:i(68627),GetBlendModes:i(56373),SetTransform:i(20926)}},56373:(t,e,i)=>{var s=i(10312),n=i(89289);t.exports=function(){var t=[],e=n.supportNewBlendModes,i="source-over";return t[s.NORMAL]=i,t[s.ADD]="lighter",t[s.MULTIPLY]=e?"multiply":i,t[s.SCREEN]=e?"screen":i,t[s.OVERLAY]=e?"overlay":i,t[s.DARKEN]=e?"darken":i,t[s.LIGHTEN]=e?"lighten":i,t[s.COLOR_DODGE]=e?"color-dodge":i,t[s.COLOR_BURN]=e?"color-burn":i,t[s.HARD_LIGHT]=e?"hard-light":i,t[s.SOFT_LIGHT]=e?"soft-light":i,t[s.DIFFERENCE]=e?"difference":i,t[s.EXCLUSION]=e?"exclusion":i,t[s.HUE]=e?"hue":i,t[s.SATURATION]=e?"saturation":i,t[s.COLOR]=e?"color":i,t[s.LUMINOSITY]=e?"luminosity":i,t[s.ERASE]="destination-out",t[s.SOURCE_IN]="source-in",t[s.SOURCE_OUT]="source-out",t[s.SOURCE_ATOP]="source-atop",t[s.DESTINATION_OVER]="destination-over",t[s.DESTINATION_IN]="destination-in",t[s.DESTINATION_OUT]="destination-out",t[s.DESTINATION_ATOP]="destination-atop",t[s.LIGHTER]="lighter",t[s.COPY]="copy",t[s.XOR]="xor",t}},20926:(t,e,i)=>{var s=i(91296);t.exports=function(t,e,i,n,r){var o=n.alpha*i.alpha;if(o<=0)return!1;var a=s(i,n,r).calc;return e.globalCompositeOperation=t.blendModes[i.blendMode],e.globalAlpha=o,e.save(),a.setToContext(e),e.imageSmoothingEnabled=i.frame?!i.frame.source.scaleMode:t.antialias,!0}},63899:t=>{t.exports="losewebgl"},6119:t=>{t.exports="postrender"},48070:t=>{t.exports="prerender"},15640:t=>{t.exports="render"},8912:t=>{t.exports="resize"},87124:t=>{t.exports="restorewebgl"},92503:(t,e,i)=>{t.exports={LOSE_WEBGL:i(63899),POST_RENDER:i(6119),PRE_RENDER:i(48070),RENDER:i(15640),RESIZE:i(8912),RESTORE_WEBGL:i(87124)}},36909:(t,e,i)=>{t.exports={Events:i(92503),Snapshot:i(89966)},t.exports.Canvas=i(55830),t.exports.WebGL=i(4159)},32880:(t,e,i)=>{var s=i(27919),n=i(40987),r=i(95540);t.exports=function(t,e){var i=r(e,"callback"),o=r(e,"type","image/png"),a=r(e,"encoder",.92),h=Math.abs(Math.round(r(e,"x",0))),l=Math.abs(Math.round(r(e,"y",0))),u=Math.floor(r(e,"width",t.width)),c=Math.floor(r(e,"height",t.height));if(r(e,"getPixel",!1)){var d=t.getContext("2d",{willReadFrequently:!1}).getImageData(h,l,1,1).data;i.call(null,new n(d[0],d[1],d[2],d[3]))}else if(0!==h||0!==l||u!==t.width||c!==t.height){var f=s.createWebGL(this,u,c),p=f.getContext("2d",{willReadFrequently:!0});u>0&&c>0&&p.drawImage(t,h,l,u,c,0,0,u,c);var v=new Image;v.onerror=function(){i.call(null),s.remove(f)},v.onload=function(){i.call(null,v),s.remove(f)},v.src=f.toDataURL(o,a)}else{var g=new Image;g.onerror=function(){i.call(null)},g.onload=function(){i.call(null,g)},g.src=t.toDataURL(o,a)}}},88815:(t,e,i)=>{var s=i(27919),n=i(40987),r=i(95540);t.exports=function(t,e){var i=t,o=r(e,"callback"),a=r(e,"type","image/png"),h=r(e,"encoder",.92),l=Math.abs(Math.round(r(e,"x",0))),u=Math.abs(Math.round(r(e,"y",0))),c=r(e,"getPixel",!1),d=r(e,"isFramebuffer",!1),f=d?r(e,"bufferWidth",1):i.drawingBufferWidth,p=d?r(e,"bufferHeight",1):i.drawingBufferHeight;if(c){var v=new Uint8Array(4),g=d?u:p-u;i.readPixels(l,g,1,1,i.RGBA,i.UNSIGNED_BYTE,v),o.call(null,new n(v[0],v[1],v[2],v[3]))}else{var m=Math.floor(r(e,"width",f)),y=Math.floor(r(e,"height",p)),x=m*y*4,T=new Uint8Array(x);i.readPixels(l,p-u-y,m,y,i.RGBA,i.UNSIGNED_BYTE,T);for(var w=s.createWebGL(this,m,y),b=w.getContext("2d",{willReadFrequently:!0}),S=b.getImageData(0,0,m,y),E=S.data,A=0;A{t.exports={Canvas:i(32880),WebGL:i(88815)}},7530:(t,e,i)=>{var s=i(83419),n=i(36060),r=i(90330),o=i(82264),a=i(95540),h=i(32302),l=i(63448),u=i(31302),c=i(58918),d=i(14811),f=i(92651),p=i(96569),v=i(56527),g=i(57516),m=i(43439),y=i(81041),x=i(12385),T=i(7589),w=i(95428),b=i(72905),S=new s({initialize:function(t){this.game=t.game,this.renderer=t,this.classes=new r([[n.UTILITY_PIPELINE,T],[n.MULTI_PIPELINE,g],[n.BITMAPMASK_PIPELINE,u],[n.SINGLE_PIPELINE,x],[n.ROPE_PIPELINE,y],[n.LIGHT_PIPELINE,p],[n.POINTLIGHT_PIPELINE,m],[n.MOBILE_PIPELINE,v]]),this.postPipelineClasses=new r,this.pipelines=new r,this.postPipelineInstances=[],this.default=null,this.current=null,this.previous=null,this.MULTI_PIPELINE=null,this.BITMAPMASK_PIPELINE=null,this.UTILITY_PIPELINE=null,this.MOBILE_PIPELINE=null,this.FX_PIPELINE=null,this.fullFrame1,this.fullFrame2,this.halfFrame1,this.halfFrame2,this.renderTargets=[],this.maxDimension=0,this.frameInc=32,this.targetIndex=0},boot:function(t,e,i){var s=this.renderer,r=this.renderTargets;this.frameInc=Math.floor(a(t,"frameInc",32));var l,u,p=s.width,v=s.height,g=this.game.config.disablePreFX;if(this.game.config.disablePostFX||this.postPipelineClasses.setAll([[String(d.BARREL),c.Barrel],[String(d.BLOOM),c.Bloom],[String(d.BLUR),c.Blur],[String(d.BOKEH),c.Bokeh],[String(d.CIRCLE),c.Circle],[String(d.COLOR_MATRIX),c.ColorMatrix],[String(d.DISPLACEMENT),c.Displacement],[String(d.GLOW),c.Glow],[String(d.GRADIENT),c.Gradient],[String(d.PIXELATE),c.Pixelate],[String(d.SHADOW),c.Shadow],[String(d.SHINE),c.Shine],[String(d.VIGNETTE),c.Vignette],[String(d.WIPE),c.Wipe]]),!g){this.classes.set(n.FX_PIPELINE,f);for(var m=Math.min(p,v),y=Math.ceil(m/this.frameInc),x=1;x=0;i--){var s=e[i];s.active&&s.preBatch(t)}}},postBatch:function(t){if(t.hasPostPipeline){this.flush();for(var e=t.postPipelines,i=0;i=0;i--){var s=e[i];s.active&&s.preBatch(t)}}},postBatchCamera:function(t){if(t.hasPostPipeline){this.flush();for(var e=t.postPipelines,i=0;ithis.maxDimension)return this.targetIndex=e.length-3,e[this.targetIndex];var i=3*(l(t,this.frameInc,0,!0)-1);return this.targetIndex=i,e[i]},getSwapRenderTarget:function(){return this.renderTargets[this.targetIndex+1]},getAltSwapRenderTarget:function(){return this.renderTargets[this.targetIndex+2]},destroy:function(){this.flush(),this.classes.clear(),this.postPipelineClasses.clear(),this.pipelines.clear(),this.renderer=null,this.game=null,this.classes=null,this.postPipelineClasses=null,this.pipelines=null,this.default=null,this.current=null,this.previous=null}});t.exports=S},32302:(t,e,i)=>{var s=i(83419),n=i(92503),r=new s({initialize:function(t,e,i,s,n,r,o,a,h){void 0===s&&(s=1),void 0===n&&(n=0),void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=!0),void 0===h&&(h=!0),this.renderer=t,this.framebuffer=null,this.texture=null,this.width=0,this.height=0,this.scale=s,this.minFilter=n,this.autoClear=r,this.autoResize=!0,this.hasDepthBuffer=a,this.forceClamp=h,this.resize(e,i),o?this.setAutoResize(!0):this.autoResize=!1},setAutoResize:function(t){return t&&!this.autoResize?(this.renderer.on(n.RESIZE,this.resize,this),this.autoResize=!0):!t&&this.autoResize&&(this.renderer.off(n.RESIZE,this.resize,this),this.autoResize=!1),this},resize:function(t,e){if((t=Math.round(t*this.scale))<=0&&(t=1),(e=Math.round(e*this.scale))<=0&&(e=1),this.autoResize&&(t!==this.width||e!==this.height)){var i=this.renderer;i.deleteFramebuffer(this.framebuffer),i.deleteTexture(this.texture),this.texture=i.createTextureFromSource(null,t,e,this.minFilter,this.forceClamp),this.framebuffer=i.createFramebuffer(t,e,this.texture,this.hasDepthBuffer),this.width=t,this.height=e}return this},willResize:function(t,e){return(t=Math.round(t*this.scale))<=0&&(t=1),(e=Math.round(e*this.scale))<=0&&(e=1),t!==this.width||e!==this.height},bind:function(t,e,i){void 0===t&&(t=!1);var s=this.renderer;if(t&&s.flush(),e&&i&&this.resize(e,i),s.pushFramebuffer(this.framebuffer,!1,!1),t&&this.adjustViewport(),this.autoClear){var n=this.renderer.gl;n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT)}s.clearStencilMask()},adjustViewport:function(){var t=this.renderer.gl;t.viewport(0,0,this.width,this.height),t.disable(t.SCISSOR_TEST)},clear:function(){var t=this.renderer,e=t.gl;t.pushFramebuffer(this.framebuffer),e.disable(e.SCISSOR_TEST),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),t.popFramebuffer(),t.resetScissor()},unbind:function(t){void 0===t&&(t=!1);var e=this.renderer;return t&&e.flush(),e.popFramebuffer()},destroy:function(){var t=this.renderer;t.off(n.RESIZE,this.resize,this),t.deleteFramebuffer(this.framebuffer),t.deleteTexture(this.texture),this.renderer=null,this.framebuffer=null,this.texture=null}});t.exports=r},70554:t=>{t.exports={getTintFromFloats:function(t,e,i,s){return((255*s&255)<<24|(255*t&255)<<16|(255*e&255)<<8|255*i&255)>>>0},getTintAppendFloatAlpha:function(t,e){return((255*e&255)<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255*e&255)<<24|(255&t)<<16|(t>>8&255)<<8|t>>16&255)>>>0},getFloatsFromUintRGB:function(t){return[(t>>16&255)/255,(t>>8&255)/255,(255&t)/255]},checkShaderMax:function(t,e){var i=Math.min(16,t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS));return e&&-1!==e?Math.min(i,e):i},parseFragmentShaderMaxTextures:function(t,e){if(!t)return"";for(var i="",s=0;s0&&(i+="\n\telse "),s{var s=i(83419),n=i(62644),r=i(50792),o=i(77085),a=i(95540),h=i(37867),l=i(92503),u=i(32302),c=i(70554),d=i(38683),f=new s({Extends:r,initialize:function(t){r.call(this);var e=t.game,i=e.renderer,s=i.gl;this.name=a(t,"name","WebGLPipeline"),this.game=e,this.renderer=i,this.manager,this.gl=s,this.view=e.canvas,this.width=0,this.height=0,this.vertexCount=0,this.vertexCapacity=0,this.vertexData,this.vertexBuffer,this.activeBuffer,this.topology=a(t,"topology",s.TRIANGLES),this.bytes,this.vertexViewF32,this.vertexViewU32,this.active=!0,this.forceZero=a(t,"forceZero",!1),this.hasBooted=!1,this.isPostFX=!1,this.isPreFX=!1,this.renderTargets=[],this.currentRenderTarget,this.shaders=[],this.currentShader,this.projectionMatrix,this.projectionWidth=0,this.projectionHeight=0,this.config=t,this.glReset=!1,this.batch=[],this.currentBatch=null,this.currentTexture=null,this.currentUnit=0,this.activeTextures=[],this.resizeUniform=a(t,"resizeUniform","")},boot:function(){var t,e=this.gl,i=this.config,s=this.renderer;this.isPostFX||(this.projectionMatrix=(new h).identity());var n=this.renderTargets,r=a(i,"renderTarget",!1);"boolean"==typeof r&&r&&(r=1);var c=s.width,d=s.height;if("number"==typeof r)for(t=0;tT&&(T=x[t].vertexSize);var w=a(i,"batchSize",s.config.batchSize);this.vertexCapacity=6*w;var b=new ArrayBuffer(this.vertexCapacity*T);this.vertexData=b,this.bytes=new Uint8Array(b),this.vertexViewF32=new Float32Array(b),this.vertexViewU32=new Uint32Array(b);var S=a(i,"vertices",null);for(S?(this.vertexViewF32.set(S),this.vertexBuffer=s.createVertexBuffer(b,e.STATIC_DRAW)):this.vertexBuffer=s.createVertexBuffer(b.byteLength,e.DYNAMIC_DRAW),this.setVertexBuffer(),t=x.length-1;t>=0;t--)x[t].rebind();this.hasBooted=!0,s.on(l.RESIZE,this.resize,this),s.on(l.PRE_RENDER,this.onPreRender,this),s.on(l.RENDER,this.onRender,this),s.on(l.POST_RENDER,this.onPostRender,this),this.emit(o.BOOT,this),this.onBoot()},onBoot:function(){},onResize:function(){},setShader:function(t,e,i){var s=this.renderer;return t===this.currentShader&&s.currentProgram===this.currentShader.program||(this.flush(),this.setVertexBuffer(i)&&!e&&(e=!0),t.bind(e,!1),this.currentShader=t),this},getShaderByName:function(t){for(var e=this.shaders,i=0;i-1&&(m=b.substring(20))}y&&x&&g.push(new d(this,m,y,x,n(T)))}this.shaders=g}return 0===this.shaders.length?console.warn("Pipeline: "+this.name+" - Invalid shader config"):this.currentShader=this.shaders[0],this},createBatch:function(t){return this.currentBatch={start:this.vertexCount,count:0,texture:[t],unit:0,maxUnit:0},this.currentUnit=0,this.currentTexture=t,this.batch.push(this.currentBatch),0},addTextureToBatch:function(t){var e=this.currentBatch;e&&(e.texture.push(t),e.unit++,e.maxUnit++)},pushBatch:function(t){if(!this.currentBatch||this.forceZero&&t!==this.currentTexture)return this.createBatch(t);if(t===this.currentTexture)return this.currentUnit;var e=this.currentBatch,i=e.texture.indexOf(t);return-1===i?e.texture.length===this.renderer.maxTextures?this.createBatch(t):(e.unit++,e.maxUnit++,e.texture.push(t),this.currentUnit=e.unit,this.currentTexture=t,e.unit):(this.currentUnit=i,this.currentTexture=t,i)},setGameObject:function(t,e){return void 0===e&&(e=t.frame),this.pushBatch(e.source.glTexture)},shouldFlush:function(t){return void 0===t&&(t=0),this.vertexCount+t>this.vertexCapacity},vertexAvailable:function(){return this.vertexCapacity-this.vertexCount},resize:function(t,e){t===this.width&&e===this.height||this.flush(),this.width=t,this.height=e;for(var i=this.renderTargets,s=0;s=0;i--){var s=e[i].rebind();t&&s!==t||(this.currentShader=s)}return this.activeTextures.length=0,this.emit(o.REBIND,this.currentShader),this.onActive(this.currentShader),this.onRebind(),this.glReset=!1,this},restoreContext:function(){var t=this.shaders,e=!!this.vertexBuffer;this.activeBuffer=null,this.activeTextures.length=0,this.batch.length=0,this.currentBatch=null,this.currentTexture=null,this.currentUnit=0,e&&this.setVertexBuffer();for(var i=0;i0){this.emit(o.BEFORE_FLUSH,this,t),this.onBeforeFlush(t);var e=this.gl,i=this.vertexCount,s=this.currentShader.vertexSize,n=this.topology;if(this.active){var r,a,h;this.setVertexBuffer(),i===this.vertexCapacity?e.bufferData(e.ARRAY_BUFFER,this.vertexData,e.DYNAMIC_DRAW):e.bufferSubData(e.ARRAY_BUFFER,0,this.bytes.subarray(0,i*s));var l=this.batch,u=this.activeTextures;if(this.forceZero)for(u[0]||e.activeTexture(e.TEXTURE0),r=0;r{var s=i(95428),n=i(72905),r=i(19715),o=i(83419),a=i(8054),h=i(50792),l=i(92503),u=i(50030),c=i(37867),d=i(29747),f=i(7530),p=i(32302),v=i(97480),g=i(69442),m=i(70554),y=i(88815),x=i(26128),T=i(1482),w=i(82751),b=i(84387),S=i(93567),E=i(57183),A=new o({Extends:h,initialize:function(t){h.call(this);var e=t.config,i={alpha:e.transparent,desynchronized:e.desynchronized,depth:!0,antialias:e.antialiasGL,premultipliedAlpha:e.premultipliedAlpha,stencil:!0,failIfMajorPerformanceCaveat:e.failIfMajorPerformanceCaveat,powerPreference:e.powerPreference,preserveDrawingBuffer:e.preserveDrawingBuffer,willReadFrequently:!1};this.config={clearBeforeRender:e.clearBeforeRender,antialias:e.antialias,backgroundColor:e.backgroundColor,contextCreation:i,roundPixels:e.roundPixels,maxTextures:e.maxTextures,maxTextureSize:e.maxTextureSize,batchSize:e.batchSize,maxLights:e.maxLights,mipmapFilter:e.mipmapFilter},this.game=t,this.type=a.WEBGL,this.pipelines=null,this.width=0,this.height=0,this.canvas=t.canvas,this.blendModes=[],this.contextLost=!1,this.snapshotState={x:0,y:0,width:1,height:1,getPixel:!1,callback:null,type:"image/png",encoder:.92,isFramebuffer:!1,bufferWidth:0,bufferHeight:0},this.maxTextures=0,this.textureIndexes,this.glBufferWrappers=[],this.glProgramWrappers=[],this.glTextureWrappers=[],this.glFramebufferWrappers=[],this.glAttribLocationWrappers=[],this.glUniformLocationWrappers=[],this.currentFramebuffer=null,this.fboStack=[],this.currentProgram=null,this.currentBlendMode=1/0,this.currentScissorEnabled=!1,this.currentScissor=null,this.scissorStack=[],this.contextLostHandler=d,this.contextRestoredHandler=d,this.gl=null,this.supportedExtensions=null,this.instancedArraysExtension=null,this.vaoExtension=null,this.extensions={},this.glFormats,this.compression,this.drawingBufferHeight=0,this.blankTexture=null,this.normalTexture=null,this.whiteTexture=null,this.maskCount=0,this.maskStack=[],this.currentMask={mask:null,camera:null},this.currentCameraMask={mask:null,camera:null},this.glFuncMap=null,this.currentType="",this.newType=!1,this.nextTypeMatch=!1,this.finalType=!1,this.mipmapFilter=null,this.defaultScissor=[0,0,0,0],this.isBooted=!1,this.renderTarget=null,this.projectionMatrix,this.projectionWidth=0,this.projectionHeight=0,this.maskSource=null,this.maskTarget=null,this.spector=null,this._debugCapture=!1,this.init(this.config)},init:function(t){var e,i=this.game,n=this.canvas,r=t.backgroundColor;if(!(e=i.config.context?i.config.context:n.getContext("webgl",t.contextCreation)||n.getContext("experimental-webgl",t.contextCreation))||e.isContextLost())throw this.contextLost=!0,new Error("WebGL unsupported");this.gl=e;var o=this,h=function(){var t=e.getSupportedExtensions();o.supportedExtensions=t;var i="ANGLE_instanced_arrays";o.instancedArraysExtension=t.indexOf(i)>-1?e.getExtension(i):null;var s="OES_vertex_array_object";o.vaoExtension=t.indexOf(s)>-1?e.getExtension(s):null};h(),this.contextLostHandler=function(t){o.contextLost=!0,console&&console.warn("WebGL Context lost. Renderer disabled"),o.emit(l.LOSE_WEBGL,o),t.preventDefault()},n.addEventListener("webglcontextlost",this.contextLostHandler,!1),this.contextRestoredHandler=function(t){if(e.isContextLost())console&&console.log("WebGL Context restored, but context is still lost");else{o.currentProgram=null,o.currentFramebuffer=null,o.setBlendMode(a.BlendModes.NORMAL),e.disable(e.BLEND),e.disable(e.DEPTH_TEST),e.enable(e.CULL_FACE),o.compression=o.getCompressedTextures();var i=function(t){t.createResource()};s(o.glTextureWrappers,i),s(o.glBufferWrappers,i),s(o.glFramebufferWrappers,i),s(o.glProgramWrappers,i),s(o.glAttribLocationWrappers,i),s(o.glUniformLocationWrappers,i),o.createTemporaryTextures(),o.pipelines.restoreContext(),o.resize(o.game.scale.baseSize.width,o.game.scale.baseSize.height),h(),o.contextLost=!1,console&&console.warn("WebGL Context restored. Renderer running again."),o.emit(l.RESTORE_WEBGL,o),t.preventDefault()}},n.addEventListener("webglcontextrestored",this.contextRestoredHandler,!1),i.context=e;for(var u=0;u<=27;u++)this.blendModes.push({func:[e.ONE,e.ONE_MINUS_SRC_ALPHA],equation:e.FUNC_ADD});return this.blendModes[1].func=[e.ONE,e.DST_ALPHA],this.blendModes[2].func=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA],this.blendModes[3].func=[e.ONE,e.ONE_MINUS_SRC_COLOR],this.blendModes[17]={func:[e.ZERO,e.ONE_MINUS_SRC_ALPHA],equation:e.FUNC_REVERSE_SUBTRACT},this.glFormats=[e.BYTE,e.SHORT,e.UNSIGNED_BYTE,e.UNSIGNED_SHORT,e.FLOAT],this.glFuncMap={mat2:{func:e.uniformMatrix2fv,length:1,matrix:!0},mat3:{func:e.uniformMatrix3fv,length:1,matrix:!0},mat4:{func:e.uniformMatrix4fv,length:1,matrix:!0},"1f":{func:e.uniform1f,length:1},"1fv":{func:e.uniform1fv,length:1},"1i":{func:e.uniform1i,length:1},"1iv":{func:e.uniform1iv,length:1},"2f":{func:e.uniform2f,length:2},"2fv":{func:e.uniform2fv,length:1},"2i":{func:e.uniform2i,length:2},"2iv":{func:e.uniform2iv,length:1},"3f":{func:e.uniform3f,length:3},"3fv":{func:e.uniform3fv,length:1},"3i":{func:e.uniform3i,length:3},"3iv":{func:e.uniform3iv,length:1},"4f":{func:e.uniform4f,length:4},"4fv":{func:e.uniform4fv,length:1},"4i":{func:e.uniform4i,length:4},"4iv":{func:e.uniform4iv,length:1}},t.maxTextures&&-1!==t.maxTextures||(t.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)),t.maxTextureSize||(t.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)),this.compression=this.getCompressedTextures(),e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.enable(e.BLEND),e.clearColor(r.redGL,r.greenGL,r.blueGL,r.alphaGL),-1!==["NEAREST","LINEAR","NEAREST_MIPMAP_NEAREST","LINEAR_MIPMAP_NEAREST","NEAREST_MIPMAP_LINEAR","LINEAR_MIPMAP_LINEAR"].indexOf(t.mipmapFilter)&&(this.mipmapFilter=e[t.mipmapFilter]),this.maxTextures=m.checkShaderMax(e,t.maxTextures),this.textureIndexes=[],this.createTemporaryTextures(),this.pipelines=new f(this),this.setBlendMode(a.BlendModes.NORMAL),this.projectionMatrix=(new c).identity(),i.textures.once(g.READY,this.boot,this),this},boot:function(){var t=this.game,e=this.pipelines,i=t.scale.baseSize,s=i.width,n=i.height;this.width=s,this.height=n,this.isBooted=!0,this.renderTarget=new p(this,s,n,1,0,!0,!0),this.maskTarget=new p(this,s,n,1,0,!0,!0),this.maskSource=new p(this,s,n,1,0,!0,!0);var r=t.config;e.boot(r.pipeline,r.defaultPipeline,r.autoMobilePipeline),this.blankTexture=t.textures.getFrame("__DEFAULT").glTexture,this.normalTexture=t.textures.getFrame("__NORMAL").glTexture,this.whiteTexture=t.textures.getFrame("__WHITE").glTexture;var o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,null),o.enable(o.SCISSOR_TEST),t.scale.on(v.RESIZE,this.onResize,this),this.resize(s,n)},createTemporaryTextures:function(){for(var t=this.gl,e=0;e0&&s>0;if(o&&a){var h=o[0],l=o[1],u=o[2],c=o[3];a=h!==t||l!==e||u!==i||c!==s}a&&(this.flush(),r.scissor(t,n-e-s,i,s))},resetScissor:function(){var t=this.gl;t.enable(t.SCISSOR_TEST);var e=this.currentScissor;if(e){var i=e[0],s=e[1],n=e[2],r=e[3];n>0&&r>0&&t.scissor(i,this.drawingBufferHeight-s-r,n,r)}},popScissor:function(){var t=this.scissorStack;t.pop();var e=t[t.length-1];e&&this.setScissor(e[0],e[1],e[2],e[3]),this.currentScissor=e},hasActiveStencilMask:function(){var t=this.currentMask.mask,e=this.currentCameraMask.mask;return t&&t.isStencil||e&&e.isStencil},resetViewport:function(){var t=this.gl;t.viewport(0,0,this.width,this.height),this.drawingBufferHeight=t.drawingBufferHeight},setBlendMode:function(t,e){void 0===e&&(e=!1);var i=this.gl,s=this.blendModes[t];return!!(e||t!==a.BlendModes.SKIP_CHECK&&this.currentBlendMode!==t)&&(this.flush(),i.enable(i.BLEND),i.blendEquation(s.equation),s.func.length>2?i.blendFuncSeparate(s.func[0],s.func[1],s.func[2],s.func[3]):i.blendFunc(s.func[0],s.func[1]),this.currentBlendMode=t,!0)},addBlendMode:function(t,e){return this.blendModes.push({func:t,equation:e})-1},updateBlendMode:function(t,e,i){return this.blendModes[t]&&(this.blendModes[t].func=e,i&&(this.blendModes[t].equation=i)),this},removeBlendMode:function(t){return t>17&&this.blendModes[t]&&this.blendModes.splice(t,1),this},pushFramebuffer:function(t,e,i,s,n){return t===this.currentFramebuffer?this:(this.fboStack.push(t),this.setFramebuffer(t,e,i,s,n))},setFramebuffer:function(t,e,i,s,n){if(void 0===e&&(e=!1),void 0===i&&(i=!0),void 0===s&&(s=null),void 0===n&&(n=!1),t===this.currentFramebuffer)return this;var r=this.gl,o=this.width,a=this.height;return t&&t.renderTexture&&i?(o=t.renderTexture.width,a=t.renderTexture.height):this.flush(),t?r.bindFramebuffer(r.FRAMEBUFFER,t.webGLFramebuffer):r.bindFramebuffer(r.FRAMEBUFFER,null),i&&r.viewport(0,0,o,a),s&&r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,s.webGLTexture,0),n&&(r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT)),e&&(t?(this.drawingBufferHeight=a,this.pushScissor(0,0,o,a)):(this.drawingBufferHeight=this.height,this.popScissor())),this.currentFramebuffer=t,this},popFramebuffer:function(t,e){void 0===t&&(t=!1),void 0===e&&(e=!0);var i=this.fboStack;i.pop();var s=i[i.length-1];return s||(s=null),this.setFramebuffer(s,t,e),s},restoreFramebuffer:function(t,e){void 0===t&&(t=!1),void 0===e&&(e=!0);var i=this.fboStack,s=i[i.length-1];s||(s=null),this.currentFramebuffer=null,this.setFramebuffer(s,t,e)},setProgram:function(t){return t!==this.currentProgram&&(this.flush(),this.gl.useProgram(t.webGLProgram),this.currentProgram=t,!0)},resetProgram:function(){return this.gl.useProgram(this.currentProgram.webGLProgramWrapper),this},createTextureFromSource:function(t,e,i,s,n){void 0===n&&(n=!1);var r=this.gl,o=r.NEAREST,h=r.NEAREST,l=r.CLAMP_TO_EDGE;e=t?t.width:e,i=t?t.height:i;var c=u(e,i);if(c&&!n&&(l=r.REPEAT),s===a.ScaleModes.LINEAR&&this.config.antialias){var d=t&&t.compressed,f=!d&&c||d&&t.mipmaps.length>1;o=this.mipmapFilter&&f?this.mipmapFilter:r.LINEAR,h=r.LINEAR}return t||"number"!=typeof e||"number"!=typeof i?this.createTexture2D(0,o,h,l,l,r.RGBA,t):this.createTexture2D(0,o,h,l,l,r.RGBA,null,e,i)},createTexture2D:function(t,e,i,s,n,r,o,a,h,l,u,c){"number"!=typeof a&&(a=o?o.width:1),"number"!=typeof h&&(h=o?o.height:1);var d=new w(this.gl,t,e,i,s,n,r,o,a,h,l,u,c);return this.glTextureWrappers.push(d),d},createFramebuffer:function(t,e,i,s){this.currentFramebuffer=null;var n=new b(this.gl,t,e,i,s);return this.glFramebufferWrappers.push(n),n},beginBitmapMask:function(t,e){this.gl&&(this.flush(),this.maskTarget.bind(!0),this.currentCameraMask.mask!==t&&(this.currentMask.mask=t,this.currentMask.camera=e))},drawBitmapMask:function(t,e,i){this.flush(),this.maskSource.bind(),this.setBlendMode(0,!0),t.renderWebGL(this,t,e),this.maskSource.unbind(!0),this.maskTarget.unbind();var s=this.gl,n=this.getCurrentStencilMask();n?(s.enable(s.STENCIL_TEST),n.mask.applyStencil(this,n.camera,!0)):this.currentMask.mask=null,this.pipelines.set(i),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.maskTarget.texture.webGLTexture),s.activeTexture(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,this.maskSource.texture.webGLTexture)},createProgram:function(t,e){var i=new T(this.gl,t,e);return this.glProgramWrappers.push(i),i},createVertexBuffer:function(t,e){var i=this.gl,s=new x(i,t,i.ARRAY_BUFFER,e);return this.glBufferWrappers.push(s),s},createAttribLocation:function(t,e){var i=new S(this.gl,t,e);return this.glAttribLocationWrappers.push(i),i},createUniformLocation:function(t,e){var i=new E(this.gl,t,e);return this.glUniformLocationWrappers.push(i),i},createIndexBuffer:function(t,e){var i=this.gl,s=new x(i,t,i.ELEMENT_ARRAY_BUFFER,e);return this.glBufferWrappers.push(s),s},deleteTexture:function(t){if(t)return n(this.glTextureWrappers,t),t.destroy(),this},deleteFramebuffer:function(t){return t?(n(this.fboStack,t),n(this.glFramebufferWrappers,t),t.destroy(),this):this},deleteProgram:function(t){return t&&(n(this.glProgramWrappers,t),t.destroy()),this},deleteAttribLocation:function(t){return t&&(n(this.glAttribLocationWrappers,t),t.destroy()),this},deleteUniformLocation:function(t){return t&&(n(this.glUniformLocationWrappers,t),t.destroy()),this},deleteBuffer:function(t){return t?(n(this.glBufferWrappers,t),t.destroy(),this):this},preRenderCamera:function(t){var e=t.x,i=t.y,s=t.width,n=t.height,o=t.backgroundColor;t.emit(r.PRE_RENDER,t),this.pipelines.preBatchCamera(t),this.pushScissor(e,i,s,n),t.mask&&(this.currentCameraMask.mask=t.mask,this.currentCameraMask.camera=t._maskCamera,t.mask.preRenderWebGL(this,t,t._maskCamera)),o.alphaGL>0&&this.pipelines.setMulti().drawFillRect(e,i,s,n,m.getTintFromFloats(o.blueGL,o.greenGL,o.redGL,1),o.alphaGL)},getCurrentStencilMask:function(){var t=null,e=this.maskStack,i=this.currentCameraMask;return e.length>0?t=e[e.length-1]:i.mask&&i.mask.isStencil&&(t=i),t},postRenderCamera:function(t){var e=t.flashEffect,i=t.fadeEffect;if(e.isRunning||i.isRunning||i.isComplete){var s=this.pipelines.setMulti();e.postRenderWebGL(s,m.getTintFromFloats),i.postRenderWebGL(s,m.getTintFromFloats)}t.dirty=!1,this.popScissor(),t.mask&&(this.currentCameraMask.mask=null,t.mask.postRenderWebGL(this,t._maskCamera)),this.pipelines.postBatchCamera(t),t.emit(r.POST_RENDER,t)},preRender:function(){if(!this.contextLost){var t=this.gl;if(t.bindFramebuffer(t.FRAMEBUFFER,null),this.config.clearBeforeRender){var e=this.config.backgroundColor;t.clearColor(e.redGL,e.greenGL,e.blueGL,e.alphaGL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)}t.enable(t.SCISSOR_TEST),this.currentScissor=this.defaultScissor,this.scissorStack.length=0,this.scissorStack.push(this.currentScissor),this.game.scene.customViewports&&t.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.currentMask.mask=null,this.currentCameraMask.mask=null,this.maskStack.length=0,this.emit(l.PRE_RENDER)}},render:function(t,e,i){if(!this.contextLost){var s=e.length;if(this.emit(l.RENDER,t,i),this.preRenderCamera(i),0===s)return this.setBlendMode(a.BlendModes.NORMAL),void this.postRenderCamera(i);this.currentType="";for(var n=this.currentMask,r=0;r{var s=i(83419),n=i(95428),r=i(95540),o=i(14500),a=new s({initialize:function(t,e,i,s,n){this.pipeline=t,this.name=e,this.renderer=t.renderer,this.gl=this.renderer.gl,this.fragSrc=s,this.vertSrc=i,this.program=this.renderer.createProgram(i,s),this.attributes,this.vertexComponentCount=0,this.vertexSize=0,this.uniforms={},this.createAttributes(n),this.createUniforms()},createAttributes:function(t){var e=0,i=0,s=[];this.vertexComponentCount=0;for(var n=0;n=0?(e.enableVertexAttribArray(p.webGLAttribLocation),e.vertexAttribPointer(p.webGLAttribLocation,h,l,f,s,u),a.enabled=!0,a.location=p):-1!==p.webGLAttribLocation&&e.disableVertexAttribArray(p.webGLAttribLocation)}else c?e.vertexAttribPointer(d.webGLAttribLocation,h,l,f,s,u):!c&&-1!==d&&d.webGLAttribLocation>-1&&(e.disableVertexAttribArray(d.webGLAttribLocation),a.location=-1)}return this},createUniforms:function(){var t,e,i,s=this.gl,n=this.program,r=this.uniforms,o=s.getProgramParameter(n.webGLProgram,s.ACTIVE_UNIFORMS);for(t=0;t0&&(e=e.substr(0,h),r.hasOwnProperty(e)||null!==(i=this.renderer.createUniformLocation(n,e))&&(r[e]={name:e,location:i,setter:null,value1:null,value2:null,value3:null,value4:null}))}}return this},syncUniforms:function(){var t=this.gl;for(var e in this.renderer.setProgram(this.program),this.uniforms){var i=this.uniforms[e];i.setter&&i.setter.call(t,i.location.webGLUniformLocation,i.value1,i.value2,i.value3,i.value4)}},hasUniform:function(t){return this.uniforms.hasOwnProperty(t)},resetUniform:function(t){var e=this.uniforms[t];return e&&(e.value1=null,e.value2=null,e.value3=null,e.value4=null),this},setUniform1:function(t,e,i,s){var n=this.uniforms[e];return n?((s||n.value1!==i)&&(n.setter||(n.setter=t),n.value1=i,this.renderer.setProgram(this.program),t.call(this.gl,n.location.webGLUniformLocation,i),this.pipeline.currentShader=this),this):this},setUniform2:function(t,e,i,s,n){var r=this.uniforms[e];return r?((n||r.value1!==i||r.value2!==s)&&(r.setter||(r.setter=t),r.value1=i,r.value2=s,this.renderer.setProgram(this.program),t.call(this.gl,r.location.webGLUniformLocation,i,s),this.pipeline.currentShader=this),this):this},setUniform3:function(t,e,i,s,n,r){var o=this.uniforms[e];return o?((r||o.value1!==i||o.value2!==s||o.value3!==n)&&(o.setter||(o.setter=t),o.value1=i,o.value2=s,o.value3=n,this.renderer.setProgram(this.program),t.call(this.gl,o.location.webGLUniformLocation,i,s,n),this.pipeline.currentShader=this),this):this},setUniform4:function(t,e,i,s,n,r,o){var a=this.uniforms[e];return a?((o||a.value1!==i||a.value2!==s||a.value3!==n||a.value4!==r)&&(a.setter||(a.setter=t),a.value1=i,a.value2=s,a.value3=n,a.value4=r,this.renderer.setProgram(this.program),t.call(this.gl,a.location.webGLUniformLocation,i,s,n,r),this.pipeline.currentShader=this),this):this},setBoolean:function(t,e){return this.setUniform1(this.gl.uniform1i,t,Number(e))},set1f:function(t,e){return this.setUniform1(this.gl.uniform1f,t,e)},set2f:function(t,e,i){return this.setUniform2(this.gl.uniform2f,t,e,i)},set3f:function(t,e,i,s){return this.setUniform3(this.gl.uniform3f,t,e,i,s)},set4f:function(t,e,i,s,n){return this.setUniform4(this.gl.uniform4f,t,e,i,s,n)},set1fv:function(t,e){return this.setUniform1(this.gl.uniform1fv,t,e,!0)},set2fv:function(t,e){return this.setUniform1(this.gl.uniform2fv,t,e,!0)},set3fv:function(t,e){return this.setUniform1(this.gl.uniform3fv,t,e,!0)},set4fv:function(t,e){return this.setUniform1(this.gl.uniform4fv,t,e,!0)},set1iv:function(t,e){return this.setUniform1(this.gl.uniform1iv,t,e,!0)},set2iv:function(t,e){return this.setUniform1(this.gl.uniform2iv,t,e,!0)},set3iv:function(t,e){return this.setUniform1(this.gl.uniform3iv,t,e,!0)},set4iv:function(t,e){return this.setUniform1(this.gl.uniform4iv,t,e,!0)},set1i:function(t,e){return this.setUniform1(this.gl.uniform1i,t,e)},set2i:function(t,e,i){return this.setUniform2(this.gl.uniform2i,t,e,i)},set3i:function(t,e,i,s){return this.setUniform3(this.gl.uniform3i,t,e,i,s)},set4i:function(t,e,i,s,n){return this.setUniform4(this.gl.uniform4i,t,e,i,s,n)},setMatrix2fv:function(t,e,i){return this.setUniform2(this.gl.uniformMatrix2fv,t,e,i,!0)},setMatrix3fv:function(t,e,i){return this.setUniform2(this.gl.uniformMatrix3fv,t,e,i,!0)},setMatrix4fv:function(t,e,i){return this.setUniform2(this.gl.uniformMatrix4fv,t,e,i,!0)},createProgram:function(t,e){return void 0===t&&(t=this.vertSrc),void 0===e&&(e=this.fragSrc),this.program&&this.renderer.deleteProgram(this.program),this.vertSrc=t,this.fragSrc=e,this.program=this.renderer.createProgram(t,e),this.createUniforms(),this.rebind()},destroy:function(){var t=this.renderer;n(this.uniforms,(function(e){t.deleteUniformLocation(e.location)})),this.uniforms=null,n(this.attributes,(function(e){t.deleteAttribLocation(e.location)})),this.attributes=null,t.deleteProgram(this.program),this.pipeline=null,this.renderer=null,this.gl=null,this.program=null}});t.exports=a},14500:t=>{t.exports={BYTE:{enum:5120,size:1},UNSIGNED_BYTE:{enum:5121,size:1},SHORT:{enum:5122,size:2},UNSIGNED_SHORT:{enum:5123,size:2},INT:{enum:5124,size:4},UNSIGNED_INT:{enum:5125,size:4},FLOAT:{enum:5126,size:4}}},4159:(t,e,i)=>{var s=i(14500),n=i(79291),r={PipelineManager:i(7530),Pipelines:i(96615),RenderTarget:i(32302),Utils:i(70554),WebGLPipeline:i(29100),WebGLRenderer:i(74797),WebGLShader:i(38683),Wrappers:i(9503)};r=n(!1,r,s),t.exports=r},31302:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(78908),o=i(85191),a=i(14500),h=i(29100),l=new s({Extends:h,initialize:function(t){t.fragShader=n(t,"fragShader",r),t.vertShader=n(t,"vertShader",o),t.batchSize=n(t,"batchSize",1),t.vertices=n(t,"vertices",[-1,1,-1,-7,7,1]),t.attributes=n(t,"attributes",[{name:"inPosition",size:2,type:a.FLOAT}]),h.call(this,t)},boot:function(){h.prototype.boot.call(this),this.set1i("uMainSampler",0),this.set1i("uMaskSampler",1)},resize:function(t,e){h.prototype.resize.call(this,t,e),this.set2f("uResolution",t,e)},beginMask:function(t,e,i){this.renderer.beginBitmapMask(t,i)},endMask:function(t,e,i){var s=this.gl,n=this.renderer,r=t.bitmapMask;r&&s&&(n.drawBitmapMask(r,e,this),i&&this.set2f("uResolution",i.width,i.height),this.set1i("uInvertMaskAlpha",t.invertAlpha),s.drawArrays(this.topology,0,3),i&&this.set2f("uResolution",this.width,this.height),s.bindTexture(s.TEXTURE_2D,null))}});t.exports=l},92651:(t,e,i)=>{var s=i(83419),n=i(58918),r=i(14811),o=i(95540),a=i(43558),h=i(89350),l=i(70554),u=new s({Extends:a,initialize:function(t){t.shaders=[l.setGlowQuality(h.FXGlowFrag,t.game),h.FXShadowFrag,h.FXPixelateFrag,h.FXVignetteFrag,h.FXShineFrag,h.FXBlurLowFrag,h.FXBlurMedFrag,h.FXBlurHighFrag,h.FXGradientFrag,h.FXBloomFrag,h.ColorMatrixFrag,h.FXCircleFrag,h.FXBarrelFrag,h.FXDisplacementFrag,h.FXWipeFrag,h.FXBokehFrag],a.call(this,t);var e=this.game;this.glow=new n.Glow(e),this.shadow=new n.Shadow(e),this.pixelate=new n.Pixelate(e),this.vignette=new n.Vignette(e),this.shine=new n.Shine(e),this.gradient=new n.Gradient(e),this.circle=new n.Circle(e),this.barrel=new n.Barrel(e),this.wipe=new n.Wipe(e),this.bokeh=new n.Bokeh(e);var i=[];i[r.GLOW]=this.onGlow,i[r.SHADOW]=this.onShadow,i[r.PIXELATE]=this.onPixelate,i[r.VIGNETTE]=this.onVignette,i[r.SHINE]=this.onShine,i[r.BLUR]=this.onBlur,i[r.GRADIENT]=this.onGradient,i[r.BLOOM]=this.onBloom,i[r.COLOR_MATRIX]=this.onColorMatrix,i[r.CIRCLE]=this.onCircle,i[r.BARREL]=this.onBarrel,i[r.DISPLACEMENT]=this.onDisplacement,i[r.WIPE]=this.onWipe,i[r.BOKEH]=this.onBokeh,this.fxHandlers=i,this.source,this.target,this.swap},onDraw:function(t,e,i){this.source=t,this.target=e,this.swap=i;var s=t.width,n=t.height,r=this.tempSprite,o=this.fxHandlers;if(r&&r.preFX)for(var a=r.preFX.list,h=0;h{var s=i(83419),n=i(95540),r=i(31063),o=i(57516),a=i(61340),h=i(26099),l=i(29100),u=new s({Extends:o,initialize:function(t){var e=n(t,"fragShader",r);t.fragShader=e.replace("%LIGHT_COUNT%",t.game.renderer.config.maxLights),o.call(this,t),this.inverseRotationMatrix=new Float32Array([1,0,0,0,1,0,0,0,1]),this.currentNormalMap,this.lightsActive=!0,this.tempVec2=new h,this._tempMatrix=new a,this._tempMatrix2=new a},boot:function(){l.prototype.boot.call(this)},onRender:function(t,e){var i=t.sys.lights;if(this.lightsActive=!1,i&&i.active){var s,n=i.getLights(e),r=n.length;this.lightsActive=!0;var o=this.renderer.height,a=e.matrix,h=this.tempVec2;for(this.set1i("uMainSampler",0),this.set1i("uNormSampler",1),this.set2f("uResolution",this.width/2,this.height/2),this.set4f("uCamera",e.x,e.y,e.rotation,e.zoom),this.set3f("uAmbientLightColor",i.ambientColor.r,i.ambientColor.g,i.ambientColor.b),this.set1i("uLightCount",r),s=0;s0&&this.flush();var e=this.inverseRotationMatrix;if(t){var i=-t,s=Math.cos(i),n=Math.sin(i);e[1]=n,e[3]=-n,e[0]=e[4]=s}else e[0]=e[4]=1,e[1]=e[3]=0;this.setMatrix3fv("uInverseRotationMatrix",!1,e),this.currentNormalMapRotation=t}},setTexture2D:function(t,e){var i=this.renderer;void 0===t&&(t=i.whiteTexture);var s=this.getNormalMap(e);this.isNewNormalMap(t,s)&&(this.flush(),this.createBatch(t),this.addTextureToBatch(s),this.currentNormalMap=s);var n=0;return e&&e.parentContainer?n=e.getWorldTransformMatrix(this._tempMatrix,this._tempMatrix2).rotationNormalized:e&&(n=e.rotation),this.setNormalMapRotation(n),0},setGameObject:function(t,e){void 0===e&&(e=t.frame);var i=e.glTexture,s=this.getNormalMap(t);if(this.isNewNormalMap(i,s)&&(this.flush(),this.createBatch(i),this.addTextureToBatch(s),this.currentNormalMap=s),t.parentContainer){var n=t.getWorldTransformMatrix(this._tempMatrix,this._tempMatrix2);this.setNormalMapRotation(n.rotationNormalized)}else this.setNormalMapRotation(t.rotation);return 0},isNewNormalMap:function(t,e){return this.currentTexture!==t||this.currentNormalMap!==e},getNormalMap:function(t){var e;return t?(t.displayTexture?e=t.displayTexture.dataSource[t.displayFrame.sourceIndex]:t.texture?e=t.texture.dataSource[t.frame.sourceIndex]:t.tileset&&(e=Array.isArray(t.tileset)?t.tileset[0].image.dataSource[0]:t.tileset.image.dataSource[0]),e?e.glTexture:this.renderer.normalTexture):this.renderer.normalTexture},batchSprite:function(t,e,i){this.lightsActive&&o.prototype.batchSprite.call(this,t,e,i)},batchTexture:function(t,e,i,s,n,r,a,h,l,u,c,d,f,p,v,g,m,y,x,T,w,b,S,E,A,C,_,M,P,R,L,O){this.lightsActive&&o.prototype.batchTexture.call(this,t,e,i,s,n,r,a,h,l,u,c,d,f,p,v,g,m,y,x,T,w,b,S,E,A,C,_,M,P,R,L,O)},batchTextureFrame:function(t,e,i,s,n,r,a){this.lightsActive&&o.prototype.batchTextureFrame.call(this,t,e,i,s,n,r,a)}});t.exports=u},56527:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(57516),o=i(45561),a=i(60722),h=i(14500),l=i(29100),u=new s({Extends:r,initialize:function(t){t.fragShader=n(t,"fragShader",o),t.vertShader=n(t,"vertShader",a),t.attributes=n(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2},{name:"inTexId"},{name:"inTintEffect"},{name:"inTint",size:4,type:h.UNSIGNED_BYTE,normalized:!0}]),t.forceZero=!0,t.resizeUniform="uResolution",r.call(this,t)},boot:function(){l.prototype.boot.call(this);var t=this.renderer;this.set1i("uMainSampler",0),this.set2f("uResolution",t.width,t.height),this.set1i("uRoundPixels",t.config.roundPixels)}});t.exports=u},57516:(t,e,i)=>{var s=i(83419),n=i(94811),r=i(95540),o=i(98840),a=i(44667),h=i(61340),l=i(70554),u=i(14500),c=i(29100),d=new s({Extends:c,initialize:function(t){var e=t.game.renderer,i=r(t,"fragShader",o);t.fragShader=l.parseFragmentShaderMaxTextures(i,e.maxTextures),t.vertShader=r(t,"vertShader",a),t.attributes=r(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2},{name:"inTexId"},{name:"inTintEffect"},{name:"inTint",size:4,type:u.UNSIGNED_BYTE,normalized:!0}]),t.resizeUniform="uResolution",c.call(this,t),this._tempMatrix1=new h,this._tempMatrix2=new h,this._tempMatrix3=new h,this.calcMatrix=new h,this.tempTriangle=[{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0}],this.strokeTint={TL:0,TR:0,BL:0,BR:0},this.fillTint={TL:0,TR:0,BL:0,BR:0},this.currentFrame={u0:0,v0:0,u1:1,v1:1},this.firstQuad=[0,0,0,0,0],this.prevQuad=[0,0,0,0,0],this.polygonCache=[]},boot:function(){c.prototype.boot.call(this);var t=this.renderer;this.set1iv("uMainSampler",t.textureIndexes),this.set2f("uResolution",t.width,t.height),this.set1i("uRoundPixels",t.config.roundPixels)},batchSprite:function(t,e,i){this.manager.set(this,t);var s=this._tempMatrix1,n=this._tempMatrix2,r=this._tempMatrix3,o=t.frame,a=o.glTexture,h=o.u0,u=o.v0,c=o.u1,d=o.v1,f=o.x,p=o.y,v=o.cutWidth,g=o.cutHeight,m=o.customPivot,y=t.displayOriginX,x=t.displayOriginY,T=-y+f,w=-x+p;if(t.isCropped){var b=t._crop;b.flipX===t.flipX&&b.flipY===t.flipY||o.updateCropUVs(b,t.flipX,t.flipY),h=b.u0,u=b.v0,c=b.u1,d=b.v1,v=b.width,g=b.height,T=-y+(f=b.x),w=-x+(p=b.y)}var S=1,E=1;t.flipX&&(m||(T+=-o.realWidth+2*y),S=-1),t.flipY&&(m||(w+=-o.realHeight+2*x),E=-1);var A=t.x,C=t.y;n.applyITRS(A,C,t.rotation,t.scaleX*S,t.scaleY*E),s.copyFrom(e.matrix),i?(s.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),n.e=A,n.f=C):(n.e-=e.scrollX*t.scrollFactorX,n.f-=e.scrollY*t.scrollFactorY),s.multiply(n,r);var _=r.setQuad(T,w,T+v,w+g),M=l.getTintAppendFloatAlpha,P=e.alpha,R=M(t.tintTopLeft,P*t._alphaTL),L=M(t.tintTopRight,P*t._alphaTR),O=M(t.tintBottomLeft,P*t._alphaBL),F=M(t.tintBottomRight,P*t._alphaBR);this.shouldFlush(6)&&this.flush();var D=this.setGameObject(t,o);this.manager.preBatch(t),this.currentShader.set1i("uRoundPixels",e.roundPixels),this.batchQuad(t,_[0],_[1],_[2],_[3],_[4],_[5],_[6],_[7],h,u,c,d,R,L,O,F,t.tintFill,a,D),this.manager.postBatch(t)},batchTexture:function(t,e,i,s,n,r,o,a,h,l,u,c,d,f,p,v,g,m,y,x,T,w,b,S,E,A,C,_,M,P,R,L,O){void 0===O&&(O=!1),this.manager.set(this,t);var F=this._tempMatrix1,D=this._tempMatrix2,k=this._tempMatrix3,I=m/i+C,B=y/s+_,N=(m+x)/i+C,U=(y+T)/s+_,X=o,Y=a,z=-v,G=-g;if(t.isCropped){var V=t._crop,W=V.width,H=V.height;X=W,Y=H,o=W,a=H;var j=m=V.x,q=y=V.y;c&&(j=x-V.x-W),d&&(q=T-V.y-H),I=j/i+C,B=q/s+_,N=(j+W)/i+C,U=(q+H)/s+_,z=-v+m,G=-g+y}c&&(X*=-1,z+=o),(d^=!R&&e.isRenderTexture?1:0)&&(Y*=-1,G+=a),D.applyITRS(n,r,u,h,l),F.copyFrom(M.matrix),P?(F.multiplyWithOffset(P,-M.scrollX*f,-M.scrollY*p),D.e=n,D.f=r):(D.e-=M.scrollX*f,D.f-=M.scrollY*p),F.multiply(D,k);var K=k.setQuad(z,G,z+X,G+Y);null==L&&(L=this.setTexture2D(e)),t&&!O&&this.manager.preBatch(t),this.currentShader.set1i("uRoundPixels",M.roundPixels),this.batchQuad(t,K[0],K[1],K[2],K[3],K[4],K[5],K[6],K[7],I,B,N,U,w,b,S,E,A,e,L),t&&!O&&this.manager.postBatch(t)},batchTextureFrame:function(t,e,i,s,n,r,o){this.manager.set(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2;o?a.multiply(o,h):h=a;var u=h.setQuad(e,i,e+t.width,i+t.height),c=this.setTexture2D(t.source.glTexture);s=l.getTintAppendFloatAlpha(s,n),this.batchQuad(null,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],t.u0,t.v0,t.u1,t.v1,s,s,s,s,0,t.glTexture,c)},batchFillRect:function(t,e,i,s,n,r){this.renderer.pipelines.set(this);var o=this.calcMatrix;r&&r.multiply(n,o);var a=o.setQuad(t,e,t+i,e+s),h=this.fillTint;this.batchQuad(null,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],0,0,1,1,h.TL,h.TR,h.BL,h.BR,2)},batchFillTriangle:function(t,e,i,s,n,r,o,a){this.renderer.pipelines.set(this);var h=this.calcMatrix;a&&a.multiply(o,h);var l=h.getX(t,e),u=h.getY(t,e),c=h.getX(i,s),d=h.getY(i,s),f=h.getX(n,r),p=h.getY(n,r),v=this.fillTint;this.currentShader.set1i("uRoundPixels",!1),this.batchTri(null,l,u,c,d,f,p,0,0,1,1,v.TL,v.TR,v.BL,2)},batchStrokeTriangle:function(t,e,i,s,n,r,o,a,h){var l=this.tempTriangle;l[0].x=t,l[0].y=e,l[0].width=o,l[1].x=i,l[1].y=s,l[1].width=o,l[2].x=n,l[2].y=r,l[2].width=o,l[3].x=t,l[3].y=e,l[3].width=o,this.batchStrokePath(l,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.pipelines.set(this);var s=this.calcMatrix;i&&i.multiply(e,s);for(var r,o,a=t.length,h=this.polygonCache,l=this.fillTint.TL,u=this.fillTint.TR,c=this.fillTint.BL,d=0;d0&&X[4]?this.batchQuad(null,F,D,P,R,X[0],X[1],X[2],X[3],0,0,1,1,I,B,N,U,2):(Y[0]=F,Y[1]=D,Y[2]=P,Y[3]=R,Y[4]=1),h&&Y[4]?this.batchQuad(null,_,M,L,O,Y[0],Y[1],Y[2],Y[3],0,0,1,1,I,B,N,U,2):(X[0]=_,X[1]=M,X[2]=L,X[3]=O,X[4]=1)}}},destroy:function(){return this._tempMatrix1.destroy(),this._tempMatrix2.destroy(),this._tempMatrix3.destroy(),this._tempMatrix1=null,this._tempMatrix1=null,this._tempMatrix1=null,c.prototype.destroy.call(this),this}});t.exports=d},43439:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(4127),o=i(89924),a=i(29100),h=new s({Extends:a,initialize:function(t){t.vertShader=n(t,"vertShader",o),t.fragShader=n(t,"fragShader",r),t.attributes=n(t,"attributes",[{name:"inPosition",size:2},{name:"inLightPosition",size:2},{name:"inLightRadius"},{name:"inLightAttenuation"},{name:"inLightColor",size:4}]),a.call(this,t)},onRender:function(t,e){this.set2f("uResolution",this.width,this.height),this.set1f("uCameraZoom",e.zoom)},batchPointLight:function(t,e,i,s,n,r,o,a,h,l,u,c){var d=t.color,f=t.intensity,p=t.radius,v=t.attenuation,g=d.r*f,m=d.g*f,y=d.b*f,x=e.alpha*t.alpha;this.shouldFlush(6)&&this.flush(),this.currentBatch||this.setTexture2D(),this.batchLightVert(i,s,u,c,p,v,g,m,y,x),this.batchLightVert(n,r,u,c,p,v,g,m,y,x),this.batchLightVert(o,a,u,c,p,v,g,m,y,x),this.batchLightVert(i,s,u,c,p,v,g,m,y,x),this.batchLightVert(o,a,u,c,p,v,g,m,y,x),this.batchLightVert(h,l,u,c,p,v,g,m,y,x),this.currentBatch.count=this.vertexCount-this.currentBatch.start},batchLightVert:function(t,e,i,s,n,r,o,a,h,l){var u=this.vertexViewF32,c=this.vertexCount*this.currentShader.vertexComponentCount-1;u[++c]=t,u[++c]=e,u[++c]=i,u[++c]=s,u[++c]=n,u[++c]=r,u[++c]=o,u[++c]=a,u[++c]=h,u[++c]=l,this.vertexCount++}});t.exports=h},84057:(t,e,i)=>{var s=i(83419),n=i(89422),r=i(95540),o=i(27681),a=i(49627),h=i(29100),l=new s({Extends:h,initialize:function(t){t.renderTarget=r(t,"renderTarget",1),t.fragShader=r(t,"fragShader",o),t.vertShader=r(t,"vertShader",a),t.attributes=r(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2}]),t.batchSize=1,t.vertices=[-1,-1,0,0,-1,1,0,1,1,1,1,1,-1,-1,0,0,1,1,1,1,1,-1,1,0],h.call(this,t),this.isPostFX=!0,this.gameObject,this.controller,this.colorMatrix=new n,this.fullFrame1,this.fullFrame2,this.halfFrame1,this.halfFrame2,this.renderer.isBooted&&(this.manager=this.renderer.pipelines)},bootFX:function(){h.prototype.boot.call(this);var t=this.manager.UTILITY_PIPELINE;this.fullFrame1=t.fullFrame1,this.fullFrame2=t.fullFrame2,this.halfFrame1=t.halfFrame1,this.halfFrame2=t.halfFrame2;var e=this.renderer;this.set1i("uMainSampler",0),this.set2f("uResolution",e.width,e.height),this.set1i("uRoundPixels",e.config.roundPixels);for(var i=this.renderTargets,s=0;s{var s=i(10312),n=i(67502),r=i(83419),o=i(96293),a=i(95540),h=i(57516),l=i(27681),u=i(87841),c=i(32302),d=i(45561),f=i(60722),p=i(29100),v=new r({Extends:h,initialize:function(t){var e=a(t,"fragShader",l),i=a(t,"vertShader",f),s=a(t,"drawShader",l),n=[{name:"DrawSprite",fragShader:d,vertShader:f},{name:"CopySprite",fragShader:e,vertShader:i},{name:"DrawGame",fragShader:s,vertShader:f},{name:"ColorMatrix",fragShader:o}],r=a(t,"shaders",[]);t.shaders=n.concat(r),t.vertShader||(t.vertShader=i),t.batchSize=1,h.call(this,t),this.isPreFX=!0,this.customMainSampler=null,this.drawSpriteShader,this.copyShader,this.gameShader,this.colorMatrixShader,this.quadVertexData,this.quadVertexBuffer,this.quadVertexViewF32,this.spriteBounds=new u,this.targetBounds=new u,this.fsTarget,this.tempSprite,this.renderer.isBooted&&(this.manager=this.renderer.pipelines,this.boot())},boot:function(){p.prototype.boot.call(this);var t=this.shaders,e=this.renderer;this.drawSpriteShader=t[0],this.copyShader=t[1],this.gameShader=t[2],this.colorMatrixShader=t[3],this.fsTarget=new c(e,e.width,e.height,1,0,!0,!0),this.renderTargets=this.manager.renderTargets.concat(this.fsTarget);var i=new ArrayBuffer(168);this.quadVertexData=i,this.quadVertexViewF32=new Float32Array(i),this.quadVertexBuffer=e.createVertexBuffer(i,this.gl.STATIC_DRAW),this.onResize(e.width,e.height),this.currentShader=this.copyShader,this.set2f("uResolution",e.width,e.height),this.set1i("uRoundPixels",e.config.roundPixels)},onResize:function(t,e){var i=this.quadVertexViewF32;i[1]=e,i[22]=e,i[14]=t,i[28]=t,i[35]=t,i[36]=e},batchQuad:function(t,e,i,s,r,o,a,h,l,u,c,d,f,p,v,g,m,y,x){var T=Math.min(e,s,o,h),w=Math.min(i,r,a,l),b=Math.max(e,s,o,h)-T,S=Math.max(i,r,a,l)-w,E=this.spriteBounds.setTo(T,w,b,S),A=t?t.preFX.padding:0,C=b+2*A,_=S+2*A,M=Math.abs(Math.max(C,_)),P=this.manager.getRenderTarget(M),R=this.targetBounds.setTo(0,0,P.width,P.height);n(R,E.centerX,E.centerY),this.tempSprite=t;var L=this.gl,O=this.renderer;O.clearStencilMask(),this.setShader(this.drawSpriteShader),this.set1i("uMainSampler",0),this.set2f("uResolution",O.width,O.height),this.set1i("uRoundPixels",O.config.roundPixels),this.flipProjectionMatrix(!0),t&&(this.onDrawSprite(t,P),t.preFX.onFX(this));var F=this.fsTarget;return this.flush(),L.viewport(0,0,O.width,O.height),L.bindFramebuffer(L.FRAMEBUFFER,F.framebuffer.webGLFramebuffer),L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,F.texture.webGLTexture,0),L.clearColor(0,0,0,0),L.clear(L.COLOR_BUFFER_BIT),this.setTexture2D(x),this.batchVert(e,i,u,c,0,y,p),this.batchVert(s,r,u,f,0,y,g),this.batchVert(o,a,d,f,0,y,m),this.batchVert(e,i,u,c,0,y,p),this.batchVert(o,a,d,f,0,y,m),this.batchVert(h,l,d,c,0,y,v),this.flush(),this.flipProjectionMatrix(!1),L.activeTexture(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,P.texture.webGLTexture),L.copyTexSubImage2D(L.TEXTURE_2D,0,0,0,R.x,R.y,R.width,R.height),L.bindFramebuffer(L.FRAMEBUFFER,null),L.bindTexture(L.TEXTURE_2D,null),this.onBatch(t),this.currentShader=this.copyShader,this.onDraw(P,this.manager.getSwapRenderTarget(),this.manager.getAltSwapRenderTarget()),!0},onDrawSprite:function(){},onCopySprite:function(){},copySprite:function(t,e,i,n,r,o,a){void 0===i&&(i=!0),void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===a&&(a=this.copyShader);var h=this.gl,l=this.tempSprite;o&&(a=this.colorMatrixShader),this.currentShader=a;var u=this.setVertexBuffer(this.quadVertexBuffer);a.bind(u,!1);var c=this.renderer;if(this.set1i("uMainSampler",0),this.set2f("uResolution",c.width,c.height),this.set1i("uRoundPixels",c.config.roundPixels),l.preFX.onFXCopy(this),this.onCopySprite(t,e,l),o&&(this.set1fv("uColorMatrix",o.getData()),this.set1f("uAlpha",o.alpha)),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,t.texture.webGLTexture),t.height>e.height)h.viewport(0,0,t.width,t.height),this.setTargetUVs(t,e);else{var d=e.height-t.height;h.viewport(0,d,t.width,t.height),this.resetUVs()}if(h.bindFramebuffer(h.FRAMEBUFFER,e.framebuffer.webGLFramebuffer),h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,e.texture.webGLTexture,0),i&&(h.clearColor(0,0,0,Number(!n)),h.clear(h.COLOR_BUFFER_BIT)),r){var f=this.renderer.currentBlendMode;this.renderer.setBlendMode(s.ERASE)}h.bufferData(h.ARRAY_BUFFER,this.quadVertexData,h.STATIC_DRAW),h.drawArrays(h.TRIANGLES,0,6),r&&this.renderer.setBlendMode(f),h.bindFramebuffer(h.FRAMEBUFFER,null)},copy:function(t,e){var i=this.gl;this.set1i("uMainSampler",0),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,t.texture.webGLTexture),i.viewport(0,0,t.width,t.height),this.setUVs(0,0,0,1,1,1,1,0),i.bindFramebuffer(i.FRAMEBUFFER,e.framebuffer.webGLFramebuffer),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.texture.webGLTexture,0),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.bufferData(i.ARRAY_BUFFER,this.quadVertexData,i.STATIC_DRAW),i.drawArrays(i.TRIANGLES,0,6),i.bindFramebuffer(i.FRAMEBUFFER,null)},blendFrames:function(t,e,i,s,n){this.manager.blendFrames(t,e,i,s,n)},blendFramesAdditive:function(t,e,i,s,n){this.manager.blendFramesAdditive(t,e,i,s,n)},drawToGame:function(t){this.currentShader=null,this.setShader(this.copyShader),this.bindAndDraw(t)},copyToGame:function(t){this.currentShader=null,this.setShader(this.gameShader),this.bindAndDraw(t)},bindAndDraw:function(t){var e=this.gl,i=this.renderer;this.set1i("uMainSampler",0),this.customMainSampler?this.setTexture2D(this.customMainSampler):this.setTexture2D(t.texture);var s=this._tempMatrix1.loadIdentity(),n=this.targetBounds.x,r=this.targetBounds.y,o=n+t.width,a=r+t.height,h=s.getX(n,r),l=s.getX(n,a),u=s.getX(o,a),c=s.getX(o,r),d=s.getY(n,r),f=s.getY(n,a),p=s.getY(o,a),v=s.getY(o,r),g=16777215;this.batchVert(h,d,0,0,0,0,g),this.batchVert(l,f,0,1,0,0,g),this.batchVert(u,p,1,1,0,0,g),this.batchVert(h,d,0,0,0,0,g),this.batchVert(u,p,1,1,0,0,g),this.batchVert(c,v,1,0,0,0,g),i.restoreFramebuffer(!1,!0),i.currentFramebuffer||e.viewport(0,0,i.width,i.height),i.restoreStencilMask(),this.flush(),this.tempSprite=null},onDraw:function(t){this.drawToGame(t)},setUVs:function(t,e,i,s,n,r,o,a){var h=this.quadVertexViewF32;h[2]=t,h[3]=e,h[9]=i,h[10]=s,h[16]=n,h[17]=r,h[23]=t,h[24]=e,h[30]=n,h[31]=r,h[37]=o,h[38]=a},setTargetUVs:function(t,e){var i=e.height/t.height;i=i>.5?.5-(i-.5):.5-i+.5,this.setUVs(0,i,0,1+i,1,1+i,1,i)},resetUVs:function(){this.setUVs(0,0,0,1,1,1,1,0)},destroy:function(){return this.renderer.deleteBuffer(this.quadVertexBuffer),this.drawSpriteShader=null,this.copyShader=null,this.gameShader=null,this.colorMatrixShader=null,this.quadVertexData=null,this.quadVertexBuffer=null,this.quadVertexViewF32=null,this.fsTarget=null,this.tempSprite=null,h.prototype.destroy.call(this),this}});t.exports=v},81041:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(57516),o=new s({Extends:r,initialize:function(t){t.topology=5,t.batchSize=n(t,"batchSize",256),r.call(this,t)}});t.exports=o},12385:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(57516),o=i(45561),a=i(60722),h=i(29100),l=new s({Extends:r,initialize:function(t){t.fragShader=n(t,"fragShader",o),t.vertShader=n(t,"vertShader",a),t.forceZero=!0,r.call(this,t)},boot:function(){h.prototype.boot.call(this);var t=this.renderer;this.set1i("uMainSampler",0),this.set2f("uResolution",t.width,t.height),this.set1i("uRoundPixels",t.config.roundPixels)}});t.exports=l},7589:(t,e,i)=>{var s=i(35407),n=i(10312),r=i(83419),o=i(89422),a=i(96293),h=i(36682),l=i(95540),u=i(48247),c=i(49627),d=i(29100),f=new r({Extends:d,initialize:function(t){t.renderTarget=l(t,"renderTarget",[{scale:1,autoResize:!0},{scale:1,autoResize:!0},{scale:.5,autoResize:!0},{scale:.5,autoResize:!0}]),t.vertShader=l(t,"vertShader",c),t.shaders=l(t,"shaders",[{name:"Copy",fragShader:h},{name:"AddBlend",fragShader:s},{name:"LinearBlend",fragShader:u},{name:"ColorMatrix",fragShader:a}]),t.attributes=l(t,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2}]),t.vertices=[-1,-1,0,0,-1,1,0,1,1,1,1,1,-1,-1,0,0,1,1,1,1,1,-1,1,0],t.batchSize=1,d.call(this,t),this.colorMatrix=new o,this.copyShader,this.addShader,this.linearShader,this.colorMatrixShader,this.fullFrame1,this.fullFrame2,this.halfFrame1,this.halfFrame2},boot:function(){d.prototype.boot.call(this);var t=this.shaders,e=this.renderTargets;this.copyShader=t[0],this.addShader=t[1],this.linearShader=t[2],this.colorMatrixShader=t[3],this.fullFrame1=e[0],this.fullFrame2=e[1],this.halfFrame1=e[2],this.halfFrame2=e[3]},copyFrame:function(t,e,i,s,n){void 0===i&&(i=1),void 0===s&&(s=!0),void 0===n&&(n=!0);var r=this.gl;this.setShader(this.copyShader),this.set1i("uMainSampler",0),this.set1f("uBrightness",i),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,t.texture.webGLTexture),e?(r.viewport(0,0,e.width,e.height),r.bindFramebuffer(r.FRAMEBUFFER,e.framebuffer.webGLFramebuffer),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e.texture.webGLTexture,0)):r.viewport(0,0,t.width,t.height),s&&(n?r.clearColor(0,0,0,0):r.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT)),r.bufferData(r.ARRAY_BUFFER,this.vertexData,r.STATIC_DRAW),r.drawArrays(r.TRIANGLES,0,6),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindTexture(r.TEXTURE_2D,null)},blitFrame:function(t,e,i,s,r,o,a){void 0===i&&(i=1),void 0===s&&(s=!0),void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=!1);var h=this.gl;if(this.setShader(this.copyShader),this.set1i("uMainSampler",0),this.set1f("uBrightness",i),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,t.texture.webGLTexture),t.height>e.height)h.viewport(0,0,t.width,t.height),this.setTargetUVs(t,e);else{var l=e.height-t.height;h.viewport(0,l,t.width,t.height)}if(h.bindFramebuffer(h.FRAMEBUFFER,e.framebuffer.webGLFramebuffer),h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,e.texture.webGLTexture,0),s&&(r?h.clearColor(0,0,0,0):h.clearColor(0,0,0,1),h.clear(h.COLOR_BUFFER_BIT)),o){var u=this.renderer.currentBlendMode;this.renderer.setBlendMode(n.ERASE)}a&&this.flipY(),h.bufferData(h.ARRAY_BUFFER,this.vertexData,h.STATIC_DRAW),h.drawArrays(h.TRIANGLES,0,6),o&&this.renderer.setBlendMode(u),h.bindFramebuffer(h.FRAMEBUFFER,null),h.bindTexture(h.TEXTURE_2D,null),this.resetUVs()},copyFrameRect:function(t,e,i,s,n,r,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0);var h=this.gl;h.bindFramebuffer(h.FRAMEBUFFER,t.framebuffer.webGLFramebuffer),h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,t.texture.webGLTexture,0),o&&(a?h.clearColor(0,0,0,0):h.clearColor(0,0,0,1),h.clear(h.COLOR_BUFFER_BIT)),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,e.texture.webGLTexture),h.copyTexSubImage2D(h.TEXTURE_2D,0,0,0,i,s,n,r),h.bindFramebuffer(h.FRAMEBUFFER,null),h.bindTexture(h.TEXTURE_2D,null)},copyToGame:function(t){var e=this.gl;this.setShader(this.copyShader),this.set1i("uMainSampler",0),this.set1f("uBrightness",1),this.renderer.popFramebuffer(),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t.texture.webGLTexture),e.bufferData(e.ARRAY_BUFFER,this.vertexData,e.STATIC_DRAW),e.drawArrays(e.TRIANGLES,0,6)},drawFrame:function(t,e,i,s){void 0===i&&(i=!0),void 0===s&&(s=this.colorMatrix);var n=this.gl;this.setShader(this.colorMatrixShader),this.set1i("uMainSampler",0),this.set1fv("uColorMatrix",s.getData()),this.set1f("uAlpha",s.alpha),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,t.texture.webGLTexture),e?(n.viewport(0,0,e.width,e.height),n.bindFramebuffer(n.FRAMEBUFFER,e.framebuffer.webGLFramebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e.texture.webGLTexture,0)):n.viewport(0,0,t.width,t.height),i?n.clearColor(0,0,0,0):n.clearColor(0,0,0,1),n.clear(n.COLOR_BUFFER_BIT),n.bufferData(n.ARRAY_BUFFER,this.vertexData,n.STATIC_DRAW),n.drawArrays(n.TRIANGLES,0,6),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindTexture(n.TEXTURE_2D,null)},blendFrames:function(t,e,i,s,n,r){void 0===s&&(s=1),void 0===n&&(n=!0),void 0===r&&(r=this.linearShader);var o=this.gl;this.setShader(r),this.set1i("uMainSampler1",0),this.set1i("uMainSampler2",1),this.set1f("uStrength",s),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,t.texture.webGLTexture),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,e.texture.webGLTexture),i?(o.bindFramebuffer(o.FRAMEBUFFER,i.framebuffer.webGLFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,i.texture.webGLTexture,0),o.viewport(0,0,i.width,i.height)):o.viewport(0,0,t.width,t.height),n?o.clearColor(0,0,0,0):o.clearColor(0,0,0,1),o.clear(o.COLOR_BUFFER_BIT),o.bufferData(o.ARRAY_BUFFER,this.vertexData,o.STATIC_DRAW),o.drawArrays(o.TRIANGLES,0,6),o.bindFramebuffer(o.FRAMEBUFFER,null),o.bindTexture(o.TEXTURE_2D,null)},blendFramesAdditive:function(t,e,i,s,n){this.blendFrames(t,e,i,s,n,this.addShader)},clearFrame:function(t,e){void 0===e&&(e=!0);var i=this.gl;i.viewport(0,0,t.width,t.height),i.bindFramebuffer(i.FRAMEBUFFER,t.framebuffer.webGLFramebuffer),e?i.clearColor(0,0,0,0):i.clearColor(0,0,0,1),i.clear(i.COLOR_BUFFER_BIT);var s=this.renderer.currentFramebuffer;i.bindFramebuffer(i.FRAMEBUFFER,s.webGLFramebuffer)},setUVs:function(t,e,i,s,n,r,o,a){var h=this.vertexViewF32;h[2]=t,h[3]=e,h[6]=i,h[7]=s,h[10]=n,h[11]=r,h[14]=t,h[15]=e,h[18]=n,h[19]=r,h[22]=o,h[23]=a},setTargetUVs:function(t,e){var i=e.height/t.height;i=i>.5?.5-(i-.5):.5-i+.5,this.setUVs(0,i,0,1+i,1,1+i,1,i)},flipX:function(){this.setUVs(1,0,1,1,0,1,0,0)},flipY:function(){this.setUVs(0,1,0,0,1,0,1,1)},resetUVs:function(){this.setUVs(0,0,0,1,1,1,1,0)}});t.exports=f},36060:t=>{t.exports={BITMAPMASK_PIPELINE:"BitmapMaskPipeline",LIGHT_PIPELINE:"Light2D",POINTLIGHT_PIPELINE:"PointLightPipeline",SINGLE_PIPELINE:"SinglePipeline",MULTI_PIPELINE:"MultiPipeline",ROPE_PIPELINE:"RopePipeline",GRAPHICS_PIPELINE:"GraphicsPipeline",POSTFX_PIPELINE:"PostFXPipeline",UTILITY_PIPELINE:"UtilityPipeline",MOBILE_PIPELINE:"MobilePipeline",FX_PIPELINE:"FxPipeline"}},84817:t=>{t.exports="pipelineafterflush"},36712:t=>{t.exports="pipelinebeforeflush"},40285:t=>{t.exports="pipelinebind"},65918:t=>{t.exports="pipelineboot"},92852:t=>{t.exports="pipelinedestroy"},56072:t=>{t.exports="pipelinerebind"},57566:t=>{t.exports="pipelineresize"},77085:(t,e,i)=>{t.exports={AFTER_FLUSH:i(84817),BEFORE_FLUSH:i(36712),BIND:i(40285),BOOT:i(65918),DESTROY:i(92852),REBIND:i(56072),RESIZE:i(57566)}},54812:(t,e,i)=>{var s=i(83419),n=i(99155),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.amount=1},onPreRender:function(t,e){t=this.getController(t),this.set1f("amount",t.amount,e)}});t.exports=o},67329:(t,e,i)=>{var s=i(83419),n=i(24400),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.steps=4,this.offsetX=1,this.offsetY=1,this.blurStrength=1,this.strength=1,this.glcolor=[1,1,1]},onPreRender:function(t){t=this.getController(t),this.set1f("strength",t.blurStrength),this.set3fv("color",t.glcolor)},onDraw:function(t){var e=this.getController(),i=this.fullFrame1,s=this.fullFrame2;this.copyFrame(t,s);for(var n=2/t.width*e.offsetX,r=2/t.height*e.offsetY,o=0;o{var s=i(83419),n=i(41514),r=i(51078),o=i(94328),a=i(84057),h=new s({Extends:a,initialize:function(t){a.call(this,{game:t,shaders:[{name:"Gaussian5",fragShader:n},{name:"Gaussian9",fragShader:r},{name:"Gaussian13",fragShader:o}]}),this.activeShader=this.shaders[0],this.x=2,this.y=2,this.steps=4,this.strength=1,this.glcolor=[1,1,1]},setQualityLow:function(){return this.activeShader=this.shaders[0],this},setQualityMedium:function(){return this.activeShader=this.shaders[1],this},setQualityHigh:function(){return this.activeShader=this.shaders[2],this},onDraw:function(t){var e=this.getController(),i=this.gl,s=this.fullFrame1,n=i.getParameter(i.FRAMEBUFFER_BINDING);this.bind(this.shaders[e.quality]),i.activeTexture(i.TEXTURE0),i.viewport(0,0,t.width,t.height),this.set1i("uMainSampler",0),this.set2f("resolution",t.width,t.height),this.set1f("strength",e.strength),this.set3fv("color",e.glcolor);for(var r=0;r{var s=i(83419),n=i(90610),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.isTiltShift=!1,this.strength=1,this.blurX=1,this.blurY=1,this.radius=.5,this.amount=1,this.contrast=.2},onPreRender:function(t,e,i,s){t=this.getController(t),this.set1f("radius",t.radius,e),this.set1f("amount",t.amount,e),this.set1f("contrast",t.contrast,e),this.set1f("strength",t.strength,e),this.set2f("blur",t.blurX,t.blurY,e),this.setBoolean("isTiltShift",t.isTiltShift,e),i&&s&&this.set2f("resolution",i,s,e)},onDraw:function(t){this.set2f("resolution",t.width,t.height),this.bindAndDraw(t)}});t.exports=o},89428:(t,e,i)=>{var s=i(83419),n=i(91899),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.scale=1,this.feather=.005,this.thickness=8,this.glcolor=[1,.2,.7],this.glcolor2=[1,0,0,.4]},onPreRender:function(t,e,i,s){t=this.getController(t),this.set1f("scale",t.scale,e),this.set1f("feather",t.feather,e),this.set1f("thickness",t.thickness,e),this.set3fv("color",t.glcolor,e),this.set4fv("backgroundColor",t.glcolor2,e),i&&s&&this.set2f("resolution",i,s,e)},onDraw:function(t){this.set2f("resolution",t.width,t.height),this.bindAndDraw(t)}});t.exports=o},88904:(t,e,i)=>{var s=i(83419),n=i(84057),r=new s({Extends:n,initialize:function(t){n.call(this,{game:t})},onDraw:function(t){var e=this.fullFrame1;this.controller?this.manager.drawFrame(t,e,!0,this.controller):this.drawFrame(t,e),this.copyToGame(e)}});t.exports=r},63563:(t,e,i)=>{var s=i(83419),n=i(47838),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.x=.005,this.y=.005,this.glTexture},onBoot:function(){this.setTexture("__WHITE")},setTexture:function(t){var e=this.game.textures.getFrame(t);e&&(this.glTexture=e.glTexture)},onDraw:function(t){var e=this.getController(),i=this.fullFrame1;this.bind(),this.set1i("uMainSampler",0),this.set1i("uDisplacementSampler",1),this.set2f("amount",e.x,e.y),this.bindTexture(e.glTexture,1),this.copySprite(t,i),this.copyToGame(i)}});t.exports=o},94045:(t,e,i)=>{var s=i(83419),n=i(95540),r=i(98656),o=i(84057),a=i(70554),h=new s({Extends:o,initialize:function(t,e){var i=n(e,"quality",.1),s=n(e,"distance",10);o.call(this,{game:t,fragShader:a.setGlowQuality(r,t,i,s)}),this.outerStrength=4,this.innerStrength=0,this.knockout=!1,this.glcolor=[1,1,1,1]},onPreRender:function(t,e,i,s){t=this.getController(t),this.set1f("outerStrength",t.outerStrength,e),this.set1f("innerStrength",t.innerStrength,e),this.set4fv("glowColor",t.glcolor,e),this.setBoolean("knockout",t.knockout,e),i&&s&&this.set2f("resolution",i,s,e)},onDraw:function(t){this.set2f("resolution",t.width,t.height),this.bindAndDraw(t)}});t.exports=h},74088:(t,e,i)=>{var s=i(83419),n=i(70463),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.alpha=.2,this.size=0,this.fromX=0,this.fromY=0,this.toX=0,this.toY=1,this.glcolor1=[255,0,0],this.glcolor2=[0,255,0]},onPreRender:function(t,e){t=this.getController(t),this.set1f("alpha",t.alpha,e),this.set1i("size",t.size,e),this.set3fv("color1",t.glcolor1,e),this.set3fv("color2",t.glcolor2,e),this.set2f("positionFrom",t.fromX,t.fromY,e),this.set2f("positionTo",t.toX,t.toY,e)}});t.exports=o},99636:(t,e,i)=>{var s=i(83419),n=i(50831),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.amount=1},onPreRender:function(t,e,i,s){t=this.getController(t),this.set1f("amount",t.amount,e),i&&s&&this.set2f("resolution",i,s,e)},onDraw:function(t){this.set2f("resolution",t.width,t.height),this.bindAndDraw(t)}});t.exports=o},34700:(t,e,i)=>{var s=i(83419),n=i(92595),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.x=0,this.y=0,this.decay=.1,this.power=1,this.glcolor=[0,0,0,1],this.samples=6,this.intensity=1},onPreRender:function(t,e){var i=(t=this.getController(t)).samples;this.set1i("samples",i,e),this.set1f("intensity",t.intensity,e),this.set1f("decay",t.decay,e),this.set1f("power",t.power/i,e),this.set2f("lightPosition",t.x,t.y,e),this.set4fv("color",t.glcolor,e)}});t.exports=o},91157:(t,e,i)=>{var s=i(83419),n=i(72464),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.speed=.5,this.lineWidth=.5,this.gradient=3,this.reveal=!1},onPreRender:function(t,e,i,s){t=this.getController(t),this.setTime("time",e),this.set1f("speed",t.speed,e),this.set1f("lineWidth",t.lineWidth,e),this.set1f("gradient",t.gradient,e),this.setBoolean("reveal",t.reveal,e),i&&s&&this.set2f("resolution",i,s,e)},onDraw:function(t){this.set2f("resolution",t.width,t.height),this.bindAndDraw(t)}});t.exports=o},27797:(t,e,i)=>{var s=i(83419),n=i(39249),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.x=.5,this.y=.5,this.radius=.5,this.strength=.5},onPreRender:function(t,e){t=this.getController(t),this.set1f("radius",t.radius,e),this.set1f("strength",t.strength,e),this.set2f("position",t.x,t.y,e)}});t.exports=o},67603:(t,e,i)=>{var s=i(83419),n=i(2878),r=i(84057),o=new s({Extends:r,initialize:function(t){r.call(this,{game:t,fragShader:n}),this.progress=0,this.wipeWidth=.1,this.direction=0,this.axis=0,this.reveal=!1},onPreRender:function(t,e){var i=(t=this.getController(t)).progress,s=t.wipeWidth,n=t.direction,r=t.axis;this.set4f("config",i,s,n,r,e),this.setBoolean("reveal",t.reveal,e)}});t.exports=o},58918:(t,e,i)=>{var s={Barrel:i(54812),Bloom:i(67329),Blur:i(8861),Bokeh:i(51051),Circle:i(89428),ColorMatrix:i(88904),Displacement:i(63563),Glow:i(94045),Gradient:i(74088),Pixelate:i(99636),Shadow:i(34700),Shine:i(91157),Vignette:i(27797),Wipe:i(67603)};t.exports=s},96615:(t,e,i)=>{var s=i(36060),n=i(79291),r={FX:i(58918),BitmapMaskPipeline:i(31302),Events:i(77085),FXPipeline:i(92651),LightPipeline:i(96569),MobilePipeline:i(56527),MultiPipeline:i(57516),PointLightPipeline:i(43439),PostFXPipeline:i(84057),PreFXPipeline:i(43558),RopePipeline:i(81041),SinglePipeline:i(12385),UtilityPipeline:i(7589)};r=n(!1,r,s),t.exports=r},35407:t=>{t.exports=["#define SHADER_NAME PHASER_ADD_BLEND_FS","precision mediump float;","uniform sampler2D uMainSampler1;","uniform sampler2D uMainSampler2;","uniform float uStrength;","varying vec2 outTexCoord;","void main ()","{"," vec4 frame1 = texture2D(uMainSampler1, outTexCoord);"," vec4 frame2 = texture2D(uMainSampler2, outTexCoord);"," gl_FragColor = frame1 + frame2 * uStrength;","}"].join("\n")},78908:t=>{t.exports=["#define SHADER_NAME PHASER_BITMAP_MASK_FS","precision mediump float;","uniform vec2 uResolution;","uniform sampler2D uMainSampler;","uniform sampler2D uMaskSampler;","uniform bool uInvertMaskAlpha;","void main ()","{"," vec2 uv = gl_FragCoord.xy / uResolution;"," vec4 mainColor = texture2D(uMainSampler, uv);"," vec4 maskColor = texture2D(uMaskSampler, uv);"," if (!uInvertMaskAlpha)"," {"," mainColor *= maskColor.a;"," }"," else"," {"," mainColor *= (1.0 - maskColor.a);"," }"," gl_FragColor = mainColor;","}"].join("\n")},85191:t=>{t.exports=["#define SHADER_NAME PHASER_BITMAP_MASK_VS","precision mediump float;","attribute vec2 inPosition;","void main ()","{"," gl_Position = vec4(inPosition, 0.0, 1.0);","}"].join("\n")},96293:t=>{t.exports=["#define SHADER_NAME PHASER_COLORMATRIX_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform float uColorMatrix[20];","uniform float uAlpha;","varying vec2 outTexCoord;","void main ()","{"," vec4 c = texture2D(uMainSampler, outTexCoord);"," if (uAlpha == 0.0)"," {"," gl_FragColor = c;"," return;"," }"," if (c.a > 0.0)"," {"," c.rgb /= c.a;"," }"," vec4 result;"," result.r = (uColorMatrix[0] * c.r) + (uColorMatrix[1] * c.g) + (uColorMatrix[2] * c.b) + (uColorMatrix[3] * c.a) + uColorMatrix[4];"," result.g = (uColorMatrix[5] * c.r) + (uColorMatrix[6] * c.g) + (uColorMatrix[7] * c.b) + (uColorMatrix[8] * c.a) + uColorMatrix[9];"," result.b = (uColorMatrix[10] * c.r) + (uColorMatrix[11] * c.g) + (uColorMatrix[12] * c.b) + (uColorMatrix[13] * c.a) + uColorMatrix[14];"," result.a = (uColorMatrix[15] * c.r) + (uColorMatrix[16] * c.g) + (uColorMatrix[17] * c.b) + (uColorMatrix[18] * c.a) + uColorMatrix[19];"," vec3 rgb = mix(c.rgb, result.rgb, uAlpha);"," rgb *= result.a;"," gl_FragColor = vec4(rgb, result.a);","}"].join("\n")},36682:t=>{t.exports=["#define SHADER_NAME PHASER_COPY_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform float uBrightness;","varying vec2 outTexCoord;","void main ()","{"," gl_FragColor = texture2D(uMainSampler, outTexCoord) * uBrightness;","}"].join("\n")},99155:t=>{t.exports=["#define SHADER_NAME BARREL_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform float amount;","varying vec2 outTexCoord;","vec2 Distort(vec2 p)","{"," float theta = atan(p.y, p.x);"," float radius = length(p);"," radius = pow(radius, amount);"," p.x = radius * cos(theta);"," p.y = radius * sin(theta);"," return 0.5 * (p + 1.0);","}","void main()","{"," vec2 xy = 2.0 * outTexCoord - 1.0;"," vec2 texCoord = outTexCoord;"," if (length(xy) < 1.0)"," {"," texCoord = Distort(xy);"," }"," gl_FragColor = texture2D(uMainSampler, texCoord);","}"].join("\n")},24400:t=>{t.exports=["#define SHADER_NAME BLOOM_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 offset;","uniform float strength;","uniform vec3 color;","varying vec2 outTexCoord;","void main ()","{"," vec4 sum = texture2D(uMainSampler, outTexCoord) * 0.204164 * strength;"," sum = sum + texture2D(uMainSampler, outTexCoord + offset * 1.407333) * 0.304005;"," sum = sum + texture2D(uMainSampler, outTexCoord - offset * 1.407333) * 0.304005;"," sum = sum + texture2D(uMainSampler, outTexCoord + offset * 3.294215) * 0.093913;"," gl_FragColor = (sum + texture2D(uMainSampler, outTexCoord - offset * 3.294215) * 0.093913) * vec4(color, 1);","}"].join("\n")},94328:t=>{t.exports=["#define SHADER_NAME BLUR_HIGH_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform vec2 offset;","uniform float strength;","uniform vec3 color;","varying vec2 outTexCoord;","void main ()","{"," vec2 uv = outTexCoord;"," vec4 col = vec4(0.0);"," vec2 off1 = vec2(1.411764705882353) * offset * strength;"," vec2 off2 = vec2(3.2941176470588234) * offset * strength;"," vec2 off3 = vec2(5.176470588235294) * offset * strength;"," col += texture2D(uMainSampler, uv) * 0.1964825501511404;"," col += texture2D(uMainSampler, uv + (off1 / resolution)) * 0.2969069646728344;"," col += texture2D(uMainSampler, uv - (off1 / resolution)) * 0.2969069646728344;"," col += texture2D(uMainSampler, uv + (off2 / resolution)) * 0.09447039785044732;"," col += texture2D(uMainSampler, uv - (off2 / resolution)) * 0.09447039785044732;"," col += texture2D(uMainSampler, uv + (off3 / resolution)) * 0.010381362401148057;"," col += texture2D(uMainSampler, uv - (off3 / resolution)) * 0.010381362401148057;"," gl_FragColor = col * vec4(color, 1.0);","}"].join("\n")},41514:t=>{t.exports=["#define SHADER_NAME BLUR_LOW_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform vec2 offset;","uniform float strength;","uniform vec3 color;","varying vec2 outTexCoord;","void main ()","{"," vec2 uv = outTexCoord;"," vec4 col = vec4(0.0);"," vec2 offset = vec2(1.333) * offset * strength;"," col += texture2D(uMainSampler, uv) * 0.29411764705882354;"," col += texture2D(uMainSampler, uv + (offset / resolution)) * 0.35294117647058826;"," col += texture2D(uMainSampler, uv - (offset / resolution)) * 0.35294117647058826;"," gl_FragColor = col * vec4(color, 1.0);","}"].join("\n")},51078:t=>{t.exports=["#define SHADER_NAME BLUR_MED_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform vec2 offset;","uniform float strength;","uniform vec3 color;","varying vec2 outTexCoord;","void main ()","{"," vec2 uv = outTexCoord;"," vec4 col = vec4(0.0);"," vec2 off1 = vec2(1.3846153846) * offset * strength;"," vec2 off2 = vec2(3.2307692308) * offset * strength;"," col += texture2D(uMainSampler, uv) * 0.2270270270;"," col += texture2D(uMainSampler, uv + (off1 / resolution)) * 0.3162162162;"," col += texture2D(uMainSampler, uv - (off1 / resolution)) * 0.3162162162;"," col += texture2D(uMainSampler, uv + (off2 / resolution)) * 0.0702702703;"," col += texture2D(uMainSampler, uv - (off2 / resolution)) * 0.0702702703;"," gl_FragColor = col * vec4(color, 1.0);","}"].join("\n")},90610:t=>{t.exports=["#define SHADER_NAME BOKEH_FS","precision mediump float;","#define ITERATIONS 100.0","#define ONEOVER_ITR 1.0 / ITERATIONS","#define PI 3.141596","#define GOLDEN_ANGLE 2.39996323","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform float radius;","uniform float amount;","uniform float contrast;","uniform bool isTiltShift;","uniform float strength;","uniform vec2 blur;","varying vec2 outTexCoord;","vec2 Sample (in float theta, inout float r)","{"," r += 1.0 / r;"," return (r - 1.0) * vec2(cos(theta), sin(theta)) * 0.06;","}","vec3 Bokeh (sampler2D tex, vec2 uv, float radius)","{"," vec3 acc = vec3(0.0);"," vec3 div = vec3(0.0);"," vec2 pixel = vec2(resolution.y / resolution.x, 1.0) * radius * .025;"," float r = 1.0;"," for (float j = 0.0; j < GOLDEN_ANGLE * ITERATIONS; j += GOLDEN_ANGLE)"," {"," vec3 col = texture2D(tex, uv + pixel * Sample(j, r)).xyz;"," col = contrast > 0.0 ? col * col * (1.0 + contrast) : col;"," vec3 bokeh = vec3(0.5) + pow(col, vec3(10.0)) * amount;"," acc += col * bokeh;"," div += bokeh;"," }"," return acc / div;","}","void main ()","{"," float shift = 1.0;"," if (isTiltShift)"," {"," vec2 uv = vec2(gl_FragCoord.xy / resolution + vec2(-0.5, -0.5)) * 2.0;"," float centerStrength = 1.0;"," shift = length(uv * blur * strength) * centerStrength;"," }"," gl_FragColor = vec4(Bokeh(uMainSampler, outTexCoord * vec2(1.0, 1.0), radius * shift), 0.0);","}"].join("\n")},91899:t=>{t.exports=["#define SHADER_NAME CIRCLE_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform vec3 color;","uniform vec4 backgroundColor;","uniform float thickness;","uniform float scale;","uniform float feather;","varying vec2 outTexCoord;","void main ()","{"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec2 position = (gl_FragCoord.xy / resolution.xy) * 2.0 - 1.0;"," float aspectRatio = resolution.x / resolution.y;"," position.x *= aspectRatio;"," float grad = length(position);"," float outer = aspectRatio;"," float inner = outer - (thickness * 2.0 / resolution.y);"," if (aspectRatio >= 1.0)"," {"," float f = 2.0 + (resolution.y / resolution.x);"," outer = 1.0;"," inner = 1.0 - (thickness * f / resolution.x);"," }"," outer *= scale;"," inner *= scale;"," float circle = smoothstep(outer, outer - 0.01, grad);"," float ring = circle - smoothstep(inner, inner - feather, grad);"," texture = mix(backgroundColor * backgroundColor.a, texture, texture.a);"," texture = (texture * (circle - ring));"," gl_FragColor = vec4(texture.rgb + (ring * color), texture.a);","}"].join("\n")},47838:t=>{t.exports=["#define SHADER_NAME DISPLACEMENT_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform sampler2D uDisplacementSampler;","uniform vec2 amount;","varying vec2 outTexCoord;","void main ()","{"," vec2 disp = (-vec2(0.5, 0.5) + texture2D(uDisplacementSampler, outTexCoord).rr) * amount;"," gl_FragColor = texture2D(uMainSampler, outTexCoord + disp).rgba;","}"].join("\n")},98656:t=>{t.exports=["#define SHADER_NAME GLOW_FS","precision mediump float;","uniform sampler2D uMainSampler;","varying vec2 outTexCoord;","uniform float outerStrength;","uniform float innerStrength;","uniform vec2 resolution;","uniform vec4 glowColor;","uniform bool knockout;","const float PI = 3.14159265358979323846264;","const float DIST = __DIST__;","const float SIZE = min(__SIZE__, PI * 2.0);","const float STEP = ceil(PI * 2.0 / SIZE);","const float MAX_ALPHA = STEP * DIST * (DIST + 1.0) / 2.0;","void main ()","{"," vec2 px = vec2(1.0 / resolution.x, 1.0 / resolution.y);"," float totalAlpha = 0.0;"," vec2 direction;"," vec2 displaced;"," vec4 color;"," for (float angle = 0.0; angle < PI * 2.0; angle += SIZE)"," {"," direction = vec2(cos(angle), sin(angle)) * px;"," for (float curDistance = 0.0; curDistance < DIST; curDistance++)"," {"," displaced = outTexCoord + direction * (curDistance + 1.0);"," color = texture2D(uMainSampler, displaced);"," totalAlpha += (DIST - curDistance) * color.a;"," }"," }"," color = texture2D(uMainSampler, outTexCoord);"," float alphaRatio = (totalAlpha / MAX_ALPHA);"," float innerGlowAlpha = (1.0 - alphaRatio) * innerStrength * color.a;"," float innerGlowStrength = min(1.0, innerGlowAlpha);"," vec4 innerColor = mix(color, glowColor, innerGlowStrength);"," float outerGlowAlpha = alphaRatio * outerStrength * (1.0 - color.a);"," float outerGlowStrength = min(1.0 - innerColor.a, outerGlowAlpha);"," vec4 outerGlowColor = outerGlowStrength * glowColor.rgba;"," if (knockout)"," {"," float resultAlpha = outerGlowAlpha + innerGlowAlpha;"," gl_FragColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);"," }"," else"," {"," gl_FragColor = innerColor + outerGlowColor;"," }","}"].join("\n")},70463:t=>{t.exports=["#define SHADER_NAME GRADIENT_FS","#define SRGB_TO_LINEAR(c) pow((c), vec3(2.2))","#define LINEAR_TO_SRGB(c) pow((c), vec3(1.0 / 2.2))","#define SRGB(r, g, b) SRGB_TO_LINEAR(vec3(float(r), float(g), float(b)) / 255.0)","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 positionFrom;","uniform vec2 positionTo;","uniform vec3 color1;","uniform vec3 color2;","uniform float alpha;","uniform int size;","varying vec2 outTexCoord;","float gradientNoise(in vec2 uv)","{"," const vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);"," return fract(magic.z * fract(dot(uv, magic.xy)));","}","float stepped (in float s, in float scale, in int steps)","{"," return steps > 0 ? floor( s / ((1.0 * scale) / float(steps))) * 1.0 / float(steps - 1) : s;","}","void main ()","{"," vec2 a = positionFrom;"," vec2 b = positionTo;"," vec2 ba = b - a;"," float d = dot(outTexCoord - a, ba) / dot(ba, ba);"," float t = size > 0 ? stepped(d, 1.0, size) : d;"," t = smoothstep(0.0, 1.0, clamp(t, 0.0, 1.0));"," vec3 color = mix(SRGB(color1.r, color1.g, color1.b), SRGB(color2.r, color2.g, color2.b), t);"," color = LINEAR_TO_SRGB(color);"," color += (1.0 / 255.0) * gradientNoise(outTexCoord) - (0.5 / 255.0);"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," gl_FragColor = vec4(mix(color.rgb, texture.rgb, alpha), 1.0) * texture.a;","}"].join("\n")},50831:t=>{t.exports=["#define SHADER_NAME PIXELATE_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform float amount;","varying vec2 outTexCoord;","void main ()","{"," float pixelSize = floor(2.0 + amount);"," vec2 center = pixelSize * floor(outTexCoord * resolution / pixelSize) + pixelSize * vec2(0.5, 0.5);"," vec2 corner1 = center + pixelSize * vec2(-0.5, -0.5);"," vec2 corner2 = center + pixelSize * vec2(+0.5, -0.5);"," vec2 corner3 = center + pixelSize * vec2(+0.5, +0.5);"," vec2 corner4 = center + pixelSize * vec2(-0.5, +0.5);"," vec4 pixel = 0.4 * texture2D(uMainSampler, center / resolution);"," pixel += 0.15 * texture2D(uMainSampler, corner1 / resolution);"," pixel += 0.15 * texture2D(uMainSampler, corner2 / resolution);"," pixel += 0.15 * texture2D(uMainSampler, corner3 / resolution);"," pixel += 0.15 * texture2D(uMainSampler, corner4 / resolution);"," gl_FragColor = pixel;","}"].join("\n")},92595:t=>{t.exports=["#define SHADER_NAME SHADOW_FS","precision mediump float;","uniform sampler2D uMainSampler;","varying vec2 outTexCoord;","uniform vec2 lightPosition;","uniform vec4 color;","uniform float decay;","uniform float power;","uniform float intensity;","uniform int samples;","const int MAX = 12;","void main ()","{"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec2 pc = (lightPosition - outTexCoord) * intensity;"," float shadow = 0.0;"," float limit = max(float(MAX), float(samples));"," for (int i = 0; i < MAX; ++i)"," {"," if (i >= samples)"," {"," break;"," }"," shadow += texture2D(uMainSampler, outTexCoord + float(i) * decay / limit * pc).a * power;"," }"," float mask = 1.0 - texture.a;"," gl_FragColor = mix(texture, color, shadow * mask);","}"].join("\n")},72464:t=>{t.exports=["#define SHADER_NAME SHINE_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec2 resolution;","uniform bool reveal;","uniform float speed;","uniform float time;","uniform float lineWidth;","uniform float gradient;","varying vec2 outTexCoord;","void main ()","{","\tvec2 uv = gl_FragCoord.xy / resolution.xy;"," vec4 tex = texture2D(uMainSampler, outTexCoord);"," vec4 col1 = vec4(0.3, 0.0, 0.0, 1.0);"," vec4 col2 = vec4(0.85, 0.85, 0.85, 1.0);"," uv.x = uv.x - mod(time * speed, 2.0) + 0.5;"," float y = uv.x * gradient;"," float s = smoothstep(y - lineWidth, y, uv.y) - smoothstep(y, y + lineWidth, uv.y);"," gl_FragColor = (((s * col1) + (s * col2)) * tex);"," if (!reveal)"," {"," gl_FragColor += tex;"," }","}"].join("\n")},39249:t=>{t.exports=["#define SHADER_NAME VIGNETTE_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform float radius;","uniform float strength;","uniform vec2 position;","varying vec2 outTexCoord;","void main ()","{"," vec4 col = vec4(1.0);"," float d = length(outTexCoord - position);"," if (d <= radius)"," {"," float g = d / radius;"," g = sin(g * 3.14 * strength);"," \tcol = vec4(g * g * g);"," }"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," gl_FragColor = texture * (1.0 - col);","}"].join("\n")},2878:t=>{t.exports=["#define SHADER_NAME WIPE_FS","precision mediump float;","uniform sampler2D uMainSampler;","uniform vec4 config;","uniform bool reveal;","varying vec2 outTexCoord;","void main ()","{"," vec2 uv = outTexCoord;"," vec4 color0;"," vec4 color1;"," if (reveal)"," {"," color0 = vec4(0);"," color1 = texture2D(uMainSampler, uv);"," }"," else"," {"," color0 = texture2D(uMainSampler, uv);"," color1 = vec4(0);"," }"," float distance = config.x;"," float width = config.y;"," float direction = config.z;"," float axis = uv.x;"," if (config.w == 1.0)"," {"," axis = uv.y;"," }"," float adjust = mix(width, -width, distance);"," float value = smoothstep(distance - width, distance + width, abs(direction - axis) + adjust);"," gl_FragColor = mix(color1, color0, value);","}"].join("\n")},31063:t=>{t.exports=["#define SHADER_NAME PHASER_LIGHT_FS","precision mediump float;","struct Light","{"," vec2 position;"," vec3 color;"," float intensity;"," float radius;","};","const int kMaxLights = %LIGHT_COUNT%;","uniform vec4 uCamera; /* x, y, rotation, zoom */","uniform vec2 uResolution;","uniform sampler2D uMainSampler;","uniform sampler2D uNormSampler;","uniform vec3 uAmbientLightColor;","uniform Light uLights[kMaxLights];","uniform mat3 uInverseRotationMatrix;","uniform int uLightCount;","varying vec2 outTexCoord;","varying float outTexId;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," vec3 finalColor = vec3(0.0, 0.0, 0.0);"," vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec4 color = texture * texel;"," if (outTintEffect == 1.0)"," {"," color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);"," }"," else if (outTintEffect == 2.0)"," {"," color = texel;"," }"," vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;"," vec3 normal = normalize(uInverseRotationMatrix * vec3(normalMap * 2.0 - 1.0));"," vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;"," for (int index = 0; index < kMaxLights; ++index)"," {"," if (index < uLightCount)"," {"," Light light = uLights[index];"," vec3 lightDir = vec3((light.position.xy / res) - (gl_FragCoord.xy / res), 0.1);"," vec3 lightNormal = normalize(lightDir);"," float distToSurf = length(lightDir) * uCamera.w;"," float diffuseFactor = max(dot(normal, lightNormal), 0.0);"," float radius = (light.radius / res.x * uCamera.w) * uCamera.w;"," float attenuation = clamp(1.0 - distToSurf * distToSurf / (radius * radius), 0.0, 1.0);"," vec3 diffuse = light.color * diffuseFactor;"," finalColor += (attenuation * diffuse) * light.intensity;"," }"," }"," vec4 colorOutput = vec4(uAmbientLightColor + finalColor, 1.0);"," gl_FragColor = color * vec4(colorOutput.rgb * colorOutput.a, colorOutput.a);","}"].join("\n")},48247:t=>{t.exports=["#define SHADER_NAME PHASER_LINEAR_BLEND_FS","precision mediump float;","uniform sampler2D uMainSampler1;","uniform sampler2D uMainSampler2;","uniform float uStrength;","varying vec2 outTexCoord;","void main ()","{"," vec4 frame1 = texture2D(uMainSampler1, outTexCoord);"," vec4 frame2 = texture2D(uMainSampler2, outTexCoord);"," gl_FragColor = mix(frame1, frame2 * uStrength, 0.5);","}"].join("\n")},41214:t=>{t.exports=["#define SHADER_NAME PHASER_MESH_FS","precision mediump float;","uniform vec3 uLightPosition;","uniform vec3 uLightAmbient;","uniform vec3 uLightDiffuse;","uniform vec3 uLightSpecular;","uniform vec3 uFogColor;","uniform float uFogNear;","uniform float uFogFar;","uniform vec3 uMaterialAmbient;","uniform vec3 uMaterialDiffuse;","uniform vec3 uMaterialSpecular;","uniform float uMaterialShine;","uniform vec3 uCameraPosition;","uniform sampler2D uTexture;","varying vec2 vTextureCoord;","varying vec3 vNormal;","varying vec3 vPosition;","void main (void)","{"," vec4 color = texture2D(uTexture, vTextureCoord);"," vec3 ambient = uLightAmbient * uMaterialAmbient;"," vec3 norm = normalize(vNormal);"," vec3 lightDir = normalize(uLightPosition - vPosition);"," float diff = max(dot(norm, lightDir), 0.0);"," vec3 diffuse = uLightDiffuse * (diff * uMaterialDiffuse);"," vec3 viewDir = normalize(uCameraPosition - vPosition);"," vec3 reflectDir = reflect(-lightDir, norm);"," float spec = pow(max(dot(viewDir, reflectDir), 0.0), uMaterialShine);"," vec3 specular = uLightSpecular * (spec * uMaterialSpecular);"," vec3 result = (ambient + diffuse + specular) * color.rgb;"," float depth = gl_FragCoord.z / gl_FragCoord.w;"," float fogFactor = smoothstep(uFogNear, uFogFar, depth);"," gl_FragColor.rgb = mix(result.rgb, uFogColor, fogFactor);"," gl_FragColor.a = color.a;","}"].join("\n")},39653:t=>{t.exports=["#define SHADER_NAME PHASER_MESH_VS","precision mediump float;","attribute vec3 aVertexPosition;","attribute vec3 aVertexNormal;","attribute vec2 aTextureCoord;","uniform mat4 uViewProjectionMatrix;","uniform mat4 uModelMatrix;","uniform mat4 uNormalMatrix;","varying vec2 vTextureCoord;","varying vec3 vNormal;","varying vec3 vPosition;","void main ()","{"," vTextureCoord = aTextureCoord;"," vPosition = vec3(uModelMatrix * vec4(aVertexPosition, 1.0));"," vNormal = vec3(uNormalMatrix * vec4(aVertexNormal, 1.0));"," gl_Position = uViewProjectionMatrix * uModelMatrix * vec4(aVertexPosition, 1.0);","}"].join("\n")},62143:t=>{t.exports=["#define SHADER_NAME PHASER_MOBILE_FS","#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","uniform sampler2D uMainSampler;","varying vec2 outTexCoord;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec4 color = texture * texel;"," if (outTintEffect == 1.0)"," {"," color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);"," }"," else if (outTintEffect == 2.0)"," {"," color = texel;"," }"," gl_FragColor = color;","}"].join("\n")},47940:t=>{t.exports=["#define SHADER_NAME PHASER_MOBILE_VS","precision mediump float;","uniform mat4 uProjectionMatrix;","uniform int uRoundPixels;","uniform vec2 uResolution;","attribute vec2 inPosition;","attribute vec2 inTexCoord;","attribute float inTexId;","attribute float inTintEffect;","attribute vec4 inTint;","varying vec2 outTexCoord;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);"," if (uRoundPixels == 1)"," {"," gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;"," }"," outTexCoord = inTexCoord;"," outTint = inTint;"," outTintEffect = inTintEffect;","}"].join("\n")},98840:t=>{t.exports=["#define SHADER_NAME PHASER_MULTI_FS","#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","uniform sampler2D uMainSampler[%count%];","varying vec2 outTexCoord;","varying float outTexId;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," vec4 texture;"," %forloop%"," vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);"," vec4 color = texture * texel;"," if (outTintEffect == 1.0)"," {"," color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);"," }"," else if (outTintEffect == 2.0)"," {"," color = texel;"," }"," gl_FragColor = color;","}"].join("\n")},44667:t=>{t.exports=["#define SHADER_NAME PHASER_MULTI_VS","precision mediump float;","uniform mat4 uProjectionMatrix;","uniform int uRoundPixels;","uniform vec2 uResolution;","attribute vec2 inPosition;","attribute vec2 inTexCoord;","attribute float inTexId;","attribute float inTintEffect;","attribute vec4 inTint;","varying vec2 outTexCoord;","varying float outTexId;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);"," if (uRoundPixels == 1)"," {"," gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;"," }"," outTexCoord = inTexCoord;"," outTexId = inTexId;"," outTint = inTint;"," outTintEffect = inTintEffect;","}"].join("\n")},4127:t=>{t.exports=["#define SHADER_NAME PHASER_POINTLIGHT_FS","precision mediump float;","uniform vec2 uResolution;","uniform float uCameraZoom;","varying vec4 lightPosition;","varying vec4 lightColor;","varying float lightRadius;","varying float lightAttenuation;","void main ()","{"," vec2 center = (lightPosition.xy + 1.0) * (uResolution.xy * 0.5);"," float distToSurf = length(center - gl_FragCoord.xy);"," float radius = 1.0 - distToSurf / (lightRadius * uCameraZoom);"," float intensity = smoothstep(0.0, 1.0, radius * lightAttenuation);"," vec4 color = vec4(intensity, intensity, intensity, 0.0) * lightColor;"," gl_FragColor = vec4(color.rgb * lightColor.a, color.a);","}"].join("\n")},89924:t=>{t.exports=["#define SHADER_NAME PHASER_POINTLIGHT_VS","precision mediump float;","uniform mat4 uProjectionMatrix;","attribute vec2 inPosition;","attribute vec2 inLightPosition;","attribute vec4 inLightColor;","attribute float inLightRadius;","attribute float inLightAttenuation;","varying vec4 lightPosition;","varying vec4 lightColor;","varying float lightRadius;","varying float lightAttenuation;","void main ()","{"," lightColor = inLightColor;"," lightRadius = inLightRadius;"," lightAttenuation = inLightAttenuation;"," lightPosition = uProjectionMatrix * vec4(inLightPosition, 1.0, 1.0);"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);","}"].join("\n")},27681:t=>{t.exports=["#define SHADER_NAME PHASER_POSTFX_FS","precision mediump float;","uniform sampler2D uMainSampler;","varying vec2 outTexCoord;","void main ()","{"," gl_FragColor = texture2D(uMainSampler, outTexCoord);","}"].join("\n")},49627:t=>{t.exports=["#define SHADER_NAME PHASER_QUAD_VS","precision mediump float;","attribute vec2 inPosition;","attribute vec2 inTexCoord;","varying vec2 outFragCoord;","varying vec2 outTexCoord;","void main ()","{"," outFragCoord = inPosition.xy * 0.5 + 0.5;"," outTexCoord = inTexCoord;"," gl_Position = vec4(inPosition, 0, 1);","}"].join("\n")},45561:t=>{t.exports=["#define SHADER_NAME PHASER_SINGLE_FS","#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","uniform sampler2D uMainSampler;","varying vec2 outTexCoord;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," vec4 texture = texture2D(uMainSampler, outTexCoord);"," vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);"," vec4 color = texture * texel;"," if (outTintEffect == 1.0)"," {"," color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);"," }"," else if (outTintEffect == 2.0)"," {"," color = texel;"," }"," gl_FragColor = color;","}"].join("\n")},60722:t=>{t.exports=["#define SHADER_NAME PHASER_SINGLE_VS","precision mediump float;","uniform mat4 uProjectionMatrix;","uniform int uRoundPixels;","uniform vec2 uResolution;","attribute vec2 inPosition;","attribute vec2 inTexCoord;","attribute float inTexId;","attribute float inTintEffect;","attribute vec4 inTint;","varying vec2 outTexCoord;","varying float outTintEffect;","varying vec4 outTint;","void main ()","{"," gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);"," if (uRoundPixels == 1)"," {"," gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;"," }"," outTexCoord = inTexCoord;"," outTint = inTint;"," outTintEffect = inTintEffect;","}"].join("\n")},89350:(t,e,i)=>{t.exports={AddBlendFrag:i(35407),BitmapMaskFrag:i(78908),BitmapMaskVert:i(85191),ColorMatrixFrag:i(96293),CopyFrag:i(36682),FXBarrelFrag:i(99155),FXBloomFrag:i(24400),FXBlurHighFrag:i(94328),FXBlurLowFrag:i(41514),FXBlurMedFrag:i(51078),FXBokehFrag:i(90610),FXCircleFrag:i(91899),FXDisplacementFrag:i(47838),FXGlowFrag:i(98656),FXGradientFrag:i(70463),FXPixelateFrag:i(50831),FXShadowFrag:i(92595),FXShineFrag:i(72464),FXVignetteFrag:i(39249),FXWipeFrag:i(2878),LightFrag:i(31063),LinearBlendFrag:i(48247),MeshFrag:i(41214),MeshVert:i(39653),MobileFrag:i(62143),MobileVert:i(47940),MultiFrag:i(98840),MultiVert:i(44667),PointLightFrag:i(4127),PointLightVert:i(89924),PostFXFrag:i(27681),QuadVert:i(49627),SingleFrag:i(45561),SingleVert:i(60722)}},93567:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i){this.webGLAttribLocation=-1,this.gl=t,this.program=e,this.name=i,this.createResource()},createResource:function(){if(null!==this.program.webGLProgram){var t=this.gl;t.isContextLost()||(this.webGLAttribLocation=t.getAttribLocation(this.program.webGLProgram,this.name))}else this.webGLAttribLocation=-1},destroy:function(){this.gl=null,this.program=null,this.name=null,this.webGLAttribLocation=-1}});t.exports=s},26128:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s){this.webGLBuffer=null,this.gl=t,this.initialDataOrSize=e,this.bufferType=i,this.bufferUsage=s,this.createResource()},createResource:function(){if(null!==this.initialDataOrSize){var t=this.gl;if(!t.isContextLost()){var e=this.bufferType,i=t.createBuffer();this.webGLBuffer=i,t.bindBuffer(e,this.webGLBuffer),t.bufferData(e,this.initialDataOrSize,this.bufferUsage),t.bindBuffer(e,null)}}},destroy:function(){var t=this.gl;t.isContextLost()||t.deleteBuffer(this.webGLBuffer),this.webGLBuffer=null,this.initialDataOrSize=null,this.gl=null}});t.exports=s},84387:(t,e,i)=>{var s=i(83419),n={36054:"Incomplete Attachment",36055:"Missing Attachment",36057:"Incomplete Dimensions",36061:"Framebuffer Unsupported"},r=new s({initialize:function(t,e,i,s,n){this.webGLFramebuffer=null,this.gl=t,this.width=e,this.height=i,this.renderTexture=s,this.addDepthStencilBuffer=!!n,this.createResource()},createResource:function(){var t=this.gl;if(!t.isContextLost()){var e,i=this.renderTexture,s=t.createFramebuffer();if(this.webGLFramebuffer=s,t.bindFramebuffer(t.FRAMEBUFFER,s),i.isRenderTexture=!0,i.isAlphaPremultiplied=!1,t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i.webGLTexture,0),(e=t.checkFramebufferStatus(t.FRAMEBUFFER))!==t.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer status: "+(n[e]||e));if(this.addDepthStencilBuffer){var r=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,this.width,this.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r)}t.bindFramebuffer(t.FRAMEBUFFER,null)}},destroy:function(){if(null!==this.webGLFramebuffer){var t=this.gl;if(!t.isContextLost()){t.bindFramebuffer(t.FRAMEBUFFER,this.webGLFramebuffer);var e=t.getFramebufferAttachmentParameter(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);null!==e&&(t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,null,0),t.deleteTexture(e));var i=t.getFramebufferAttachmentParameter(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);null!==i&&t.deleteRenderbuffer(i),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteFramebuffer(this.webGLFramebuffer)}this.renderTexture=null,this.webGLFramebuffer=null,this.gl=null}}});t.exports=r},1482:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i){this.webGLProgram=null,this.gl=t,this.vertexSource=e,this.fragmentSource=i,this.createResource()},createResource:function(){var t=this.gl;if(!t.isContextLost()){var e=t.createProgram(),i=t.createShader(t.VERTEX_SHADER),s=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(i,this.vertexSource),t.shaderSource(s,this.fragmentSource),t.compileShader(i),t.compileShader(s);var n="Shader failed:\n";if(!t.getShaderParameter(i,t.COMPILE_STATUS))throw new Error("Vertex "+n+t.getShaderInfoLog(i));if(!t.getShaderParameter(s,t.COMPILE_STATUS))throw new Error("Fragment "+n+t.getShaderInfoLog(s));if(t.attachShader(e,i),t.attachShader(e,s),t.linkProgram(e),!t.getProgramParameter(e,t.LINK_STATUS))throw new Error("Link "+n+t.getProgramInfoLog(e));t.useProgram(e),this.webGLProgram=e}},destroy:function(){this.webGLProgram&&(this.gl.isContextLost()||this.gl.deleteProgram(this.webGLProgram),this.webGLProgram=null,this.gl=null)}});t.exports=s},82751:(t,e,i)=>{var s=i(83419),n=i(50030),r=new s({initialize:function(t,e,i,s,n,r,o,a,h,l,u,c,d){this.webGLTexture=null,this.isRenderTexture=!1,this.gl=t,this.mipLevel=e,this.minFilter=i,this.magFilter=s,this.wrapT=n,this.wrapS=r,this.format=o,this.pixels=a,this.width=h,this.height=l,this.pma=null==u||u,this.forceSize=!!c,this.flipY=!!d,this.__SPECTOR_Metadata={},this.createResource()},createResource:function(){var t=this.gl;if(!t.isContextLost())if(this.pixels instanceof r)this.webGLTexture=this.pixels.webGLTexture;else{var e=t.createTexture();e.__SPECTOR_Metadata=this.__SPECTOR_Metadata,this.webGLTexture=e,this._processTexture()}},update:function(t,e,i,s,n,r,o,a,h){0!==e&&0!==i&&(this.pixels=t,this.width=e,this.height=i,this.flipY=s,this.wrapS=n,this.wrapT=r,this.minFilter=o,this.magFilter=a,this.format=h,this.gl.isContextLost()||this._processTexture())},_processTexture:function(){var t=this.gl;t.activeTexture(t.TEXTURE0);var e=t.getParameter(t.TEXTURE_BINDING_2D);t.bindTexture(t.TEXTURE_2D,this.webGLTexture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this.minFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this.magFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this.wrapS),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this.wrapT),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.pma),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,this.flipY);var i=this.pixels,s=this.mipLevel,r=this.width,o=this.height,a=this.format,h=!1;if(null==i)t.texImage2D(t.TEXTURE_2D,s,a,r,o,0,a,t.UNSIGNED_BYTE,null),h=n(r,o);else if(i.compressed){r=i.width,o=i.height,h=i.generateMipmap;for(var l=0;l{var s=new(i(83419))({initialize:function(t,e,i){this.webGLUniformLocation=null,this.gl=t,this.program=e,this.name=i,this.createResource()},createResource:function(){if(null!==this.program.webGLProgram){var t=this.gl;t.isContextLost()||(this.webGLUniformLocation=t.getUniformLocation(this.program.webGLProgram,this.name))}else this.webGLUniformLocation=null},destroy:function(){this.gl=null,this.program=null,this.name=null,this.webGLUniformLocation=null}});t.exports=s},9503:(t,e,i)=>{var s={WebGLAttribLocationWrapper:i(93567),WebGLBufferWrapper:i(26128),WebGLProgramWrapper:i(1482),WebGLTextureWrapper:i(82751),WebGLFramebufferWrapper:i(84387),WebGLUniformLocationWrapper:i(57183)};t.exports=s},76531:(t,e,i)=>{var s=i(13560),n=i(83419),r=i(50792),o=i(97480),a=i(8443),h=i(57811),l=i(74403),u=i(45818),c=i(29747),d=i(87841),f=i(86555),p=i(56583),v=i(26099),g=i(38058),m=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.canvas,this.canvasBounds=new d,this.parent=null,this.parentIsWindow=!1,this.parentSize=new f,this.gameSize=new f,this.baseSize=new f,this.displaySize=new f,this.scaleMode=s.SCALE_MODE.NONE,this.zoom=1,this._resetZoom=!1,this.displayScale=new v(1,1),this.autoRound=!1,this.autoCenter=s.CENTER.NO_CENTER,this.orientation=s.ORIENTATION.LANDSCAPE,this.fullscreen,this.fullscreenTarget=null,this._createdFullscreenTarget=!1,this.dirty=!1,this.resizeInterval=500,this._lastCheck=0,this._checkOrientation=!1,this.domlisteners={orientationChange:c,windowResize:c,fullScreenChange:c,fullScreenError:c}},preBoot:function(){this.parseConfig(this.game.config),this.game.events.once(a.BOOT,this.boot,this)},boot:function(){var t=this.game;this.canvas=t.canvas,this.fullscreen=t.device.fullscreen,this.scaleMode!==s.SCALE_MODE.RESIZE&&this.scaleMode!==s.SCALE_MODE.EXPAND&&this.displaySize.setAspectMode(this.scaleMode),this.scaleMode===s.SCALE_MODE.NONE?this.resize(this.width,this.height):(this.getParentBounds(),this.parentSize.width>0&&this.parentSize.height>0&&this.displaySize.setParent(this.parentSize),this.refresh()),t.events.on(a.PRE_STEP,this.step,this),t.events.once(a.READY,this.refresh,this),t.events.once(a.DESTROY,this.destroy,this),this.startListeners()},parseConfig:function(t){this.getParent(t),this.getParentBounds();var e=t.width,i=t.height,n=t.scaleMode,r=t.zoom,o=t.autoRound;if("string"==typeof e)if("%"!==e.substr(-1))e=parseInt(e,10);else{var a=this.parentSize.width;0===a&&(a=window.innerWidth);var h=parseInt(e,10)/100;e=Math.floor(a*h)}if("string"==typeof i)if("%"!==i.substr(-1))i=parseInt(i,10);else{var l=this.parentSize.height;0===l&&(l=window.innerHeight);var c=parseInt(i,10)/100;i=Math.floor(l*c)}this.scaleMode=n,this.autoRound=o,this.autoCenter=t.autoCenter,this.resizeInterval=t.resizeInterval,o&&(e=Math.floor(e),i=Math.floor(i)),this.gameSize.setSize(e,i),r===s.ZOOM.MAX_ZOOM&&(r=this.getMaxZoom()),this.zoom=r,1!==r&&(this._resetZoom=!0),this.baseSize.setSize(e,i),o&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),t.minWidth>0&&this.displaySize.setMin(t.minWidth*r,t.minHeight*r),t.maxWidth>0&&this.displaySize.setMax(t.maxWidth*r,t.maxHeight*r),this.displaySize.setSize(e,i),(t.snapWidth>0||t.snapHeight>0)&&this.displaySize.setSnap(t.snapWidth,t.snapHeight),this.orientation=u(e,i)},getParent:function(t){var e=t.parent;if(null!==e){if(this.parent=l(e),this.parentIsWindow=this.parent===document.body,t.expandParent&&t.scaleMode!==s.SCALE_MODE.NONE){var i=this.parent.getBoundingClientRect();(this.parentIsWindow||0===i.height)&&(document.documentElement.style.height="100%",document.body.style.height="100%",i=this.parent.getBoundingClientRect(),this.parentIsWindow||0!==i.height||(this.parent.style.overflow="hidden",this.parent.style.width="100%",this.parent.style.height="100%"))}t.fullscreenTarget&&!this.fullscreenTarget&&(this.fullscreenTarget=l(t.fullscreenTarget))}},getParentBounds:function(){if(!this.parent)return!1;var t=this.parentSize,e=this.parent.getBoundingClientRect();this.parentIsWindow&&this.game.device.os.iOS&&(e.height=h(!0));var i=e.width,s=e.height;if(t.width!==i||t.height!==s)return t.setSize(i,s),!0;if(this.canvas){var n=this.canvasBounds,r=this.canvas.getBoundingClientRect();if(r.x!==n.x||r.y!==n.y)return!0}return!1},lockOrientation:function(t){var e=screen.lockOrientation||screen.mozLockOrientation||screen.msLockOrientation;return!!e&&e.call(screen,t)},setParentSize:function(t,e){return this.parentSize.setSize(t,e),this.refresh()},setGameSize:function(t,e){var i=this.autoRound;i&&(t=Math.floor(t),e=Math.floor(e));var s=this.width,n=this.height;return this.gameSize.resize(t,e),this.baseSize.resize(t,e),i&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),this.displaySize.setAspectRatio(t/e),this.canvas.width=this.baseSize.width,this.canvas.height=this.baseSize.height,this.refresh(s,n)},resize:function(t,e){var i=this.zoom,s=this.autoRound;s&&(t=Math.floor(t),e=Math.floor(e));var n=this.width,r=this.height;this.gameSize.resize(t,e),this.baseSize.resize(t,e),s&&(this.baseSize.width=Math.floor(this.baseSize.width),this.baseSize.height=Math.floor(this.baseSize.height)),this.displaySize.setSize(t*i,e*i),this.canvas.width=this.baseSize.width,this.canvas.height=this.baseSize.height;var o=this.canvas.style,a=t*i,h=e*i;return s&&(a=Math.floor(a),h=Math.floor(h)),a===t&&h===e||(o.width=a+"px",o.height=h+"px"),this.refresh(n,r)},setZoom:function(t){return this.zoom=t,this._resetZoom=!0,this.refresh()},setMaxZoom:function(){return this.zoom=this.getMaxZoom(),this._resetZoom=!0,this.refresh()},setSnap:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.displaySize.setSnap(t,e),this.refresh()},refresh:function(t,e){void 0===t&&(t=this.width),void 0===e&&(e=this.height),this.updateScale(),this.updateBounds(),this.updateOrientation(),this.displayScale.set(this.baseSize.width/this.canvasBounds.width,this.baseSize.height/this.canvasBounds.height);var i=this.game.domContainer;if(i){this.baseSize.setCSS(i);var s=this.canvas.style,n=i.style;n.transform="scale("+this.displaySize.width/this.baseSize.width+","+this.displaySize.height/this.baseSize.height+")",n.marginLeft=s.marginLeft,n.marginTop=s.marginTop}return this.emit(o.RESIZE,this.gameSize,this.baseSize,this.displaySize,t,e),this},updateOrientation:function(){if(this._checkOrientation){this._checkOrientation=!1;var t=u(this.width,this.height);t!==this.orientation&&(this.orientation=t,this.emit(o.ORIENTATION_CHANGE,t))}},updateScale:function(){var t,e,i=this.canvas.style,n=this.gameSize.width,r=this.gameSize.height,o=this.zoom,a=this.autoRound;if(this.scaleMode===s.SCALE_MODE.NONE)this.displaySize.setSize(n*o,r*o),t=this.displaySize.width,e=this.displaySize.height,a&&(t=Math.floor(t),e=Math.floor(e)),this._resetZoom&&(i.width=t+"px",i.height=e+"px",this._resetZoom=!1);else if(this.scaleMode===s.SCALE_MODE.RESIZE)this.displaySize.setSize(this.parentSize.width,this.parentSize.height),this.gameSize.setSize(this.displaySize.width,this.displaySize.height),this.baseSize.setSize(this.displaySize.width,this.displaySize.height),t=this.displaySize.width,e=this.displaySize.height,a&&(t=Math.floor(t),e=Math.floor(e)),this.canvas.width=t,this.canvas.height=e;else if(this.scaleMode===s.SCALE_MODE.EXPAND){this.displaySize.setSize(this.parentSize.width,this.parentSize.height),t=this.displaySize.width,e=this.displaySize.height,a&&(t=Math.floor(t),e=Math.floor(e)),i.width=t+"px",i.height=e+"px";var h=this.parentSize.width/this.gameSize.width,l=this.parentSize.height/this.gameSize.height;h=0?0:-o.x*a.x,l=o.y>=0?0:-o.y*a.y;return i=r.width>=o.width?n.width:n.width-(o.width-r.width)*a.x,s=r.height>=o.height?n.height:n.height-(o.height-r.height)*a.y,e.setTo(h,l,i,s),t&&(e.width/=t.zoomX,e.height/=t.zoomY,e.centerX=t.centerX+t.scrollX,e.centerY=t.centerY+t.scrollY),e},step:function(t,e){this.parent&&(this._lastCheck+=e,(this.dirty||this._lastCheck>this.resizeInterval)&&(this.getParentBounds()&&this.refresh(),this.dirty=!1,this._lastCheck=0))},stopListeners:function(){var t=this.domlisteners;window.removeEventListener("orientationchange",t.orientationChange,!1),window.removeEventListener("resize",t.windowResize,!1),["webkit","moz",""].forEach((function(e){document.removeEventListener(e+"fullscreenchange",t.fullScreenChange,!1),document.removeEventListener(e+"fullscreenerror",t.fullScreenError,!1)})),document.removeEventListener("MSFullscreenChange",t.fullScreenChange,!1),document.removeEventListener("MSFullscreenError",t.fullScreenError,!1)},destroy:function(){this.removeAllListeners(),this.stopListeners(),this.game=null,this.canvas=null,this.canvasBounds=null,this.parent=null,this.fullscreenTarget=null,this.parentSize.destroy(),this.gameSize.destroy(),this.baseSize.destroy(),this.displaySize.destroy()},isFullscreen:{get:function(){return this.fullscreen.active}},width:{get:function(){return this.gameSize.width}},height:{get:function(){return this.gameSize.height}},isPortrait:{get:function(){return this.orientation===s.ORIENTATION.PORTRAIT}},isLandscape:{get:function(){return this.orientation===s.ORIENTATION.LANDSCAPE}},isGamePortrait:{get:function(){return this.height>this.width}},isGameLandscape:{get:function(){return this.width>this.height}}});t.exports=m},64743:t=>{t.exports={NO_CENTER:0,CENTER_BOTH:1,CENTER_HORIZONTALLY:2,CENTER_VERTICALLY:3}},39218:t=>{t.exports={LANDSCAPE:"landscape-primary",PORTRAIT:"portrait-primary"}},81050:t=>{t.exports={NONE:0,WIDTH_CONTROLS_HEIGHT:1,HEIGHT_CONTROLS_WIDTH:2,FIT:3,ENVELOP:4,RESIZE:5,EXPAND:6}},80805:t=>{t.exports={NO_ZOOM:1,ZOOM_2X:2,ZOOM_4X:4,MAX_ZOOM:-1}},13560:(t,e,i)=>{var s={CENTER:i(64743),ORIENTATION:i(39218),SCALE_MODE:i(81050),ZOOM:i(80805)};t.exports=s},56139:t=>{t.exports="enterfullscreen"},2336:t=>{t.exports="fullscreenfailed"},47412:t=>{t.exports="fullscreenunsupported"},51452:t=>{t.exports="leavefullscreen"},20666:t=>{t.exports="orientationchange"},47945:t=>{t.exports="resize"},97480:(t,e,i)=>{t.exports={ENTER_FULLSCREEN:i(56139),FULLSCREEN_FAILED:i(2336),FULLSCREEN_UNSUPPORTED:i(47412),LEAVE_FULLSCREEN:i(51452),ORIENTATION_CHANGE:i(20666),RESIZE:i(47945)}},93364:(t,e,i)=>{var s=i(79291),n=i(13560),r={Center:i(64743),Events:i(97480),Orientation:i(39218),ScaleManager:i(76531),ScaleModes:i(81050),Zoom:i(80805)};r=s(!1,r,n.CENTER),r=s(!1,r,n.ORIENTATION),r=s(!1,r,n.SCALE_MODE),r=s(!1,r,n.ZOOM),t.exports=r},27397:(t,e,i)=>{var s=i(95540),n=i(35355);t.exports=function(t){var e=t.game.config.defaultPhysicsSystem,i=s(t.settings,"physics",!1);if(e||i){var r=[];if(e&&r.push(n(e+"Physics")),i)for(var o in i)o=n(o.concat("Physics")),-1===r.indexOf(o)&&r.push(o);return r}}},52106:(t,e,i)=>{var s=i(95540);t.exports=function(t){var e=t.plugins.getDefaultScenePlugins(),i=s(t.settings,"plugins",!1);return Array.isArray(i)?i:e||[]}},87033:t=>{t.exports={game:"game",renderer:"renderer",anims:"anims",cache:"cache",plugins:"plugins",registry:"registry",scale:"scale",sound:"sound",textures:"textures",events:"events",cameras:"cameras",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},97482:(t,e,i)=>{var s=i(83419),n=i(2368),r=new s({initialize:function(t){this.sys=new n(this,t),this.game,this.anims,this.cache,this.registry,this.sound,this.textures,this.events,this.cameras,this.add,this.make,this.scene,this.children,this.lights,this.data,this.input,this.load,this.time,this.tweens,this.physics,this.matter,this.scale,this.plugins,this.renderer},update:function(){}});t.exports=r},60903:(t,e,i)=>{var s=i(83419),n=i(89993),r=i(44594),o=i(8443),a=i(35154),h=i(54899),l=i(29747),u=i(97482),c=i(2368),d=new s({initialize:function(t,e){if(this.game=t,this.keys={},this.scenes=[],this._pending=[],this._start=[],this._queue=[],this._data={},this.isProcessing=!1,this.isBooted=!1,this.customViewports=0,this.systemScene,e){Array.isArray(e)||(e=[e]);for(var i=0;i-1&&(delete this.keys[s],this.scenes.splice(i,1),this._start.indexOf(s)>-1&&(i=this._start.indexOf(s),this._start.splice(i,1)),e.sys.destroy())}return this},bootScene:function(t){var e,i=t.sys,s=i.settings;i.sceneUpdate=l,t.init&&(t.init.call(t,s.data),s.status=n.INIT,s.isTransition&&i.events.emit(r.TRANSITION_INIT,s.transitionFrom,s.transitionDuration)),i.load&&(e=i.load).reset(),e&&t.preload?(t.preload.call(t),s.status=n.LOADING,e.once(h.COMPLETE,this.loadComplete,this),e.start()):this.create(t)},loadComplete:function(t){this.game.sound&&this.game.sound.onBlurPausedSounds&&this.game.sound.unlock(),this.create(t.scene)},payloadComplete:function(t){this.bootScene(t.scene)},update:function(t,e){this.processQueue(),this.isProcessing=!0;for(var i=this.scenes.length-1;i>=0;i--){var s=this.scenes[i].sys;s.settings.status>n.START&&s.settings.status<=n.RUNNING&&s.step(t,e),s.scenePlugin&&s.scenePlugin._target&&s.scenePlugin.step(t,e)}},render:function(t){for(var e=0;e=n.LOADING&&i.settings.status=n.START&&o<=n.CREATING)return this;if(o>=n.RUNNING&&o<=n.SLEEPING)r.shutdown(),r.sceneUpdate=l,r.start(e);else if(r.sceneUpdate=l,r.start(e),r.load&&(s=r.load),s&&r.settings.hasOwnProperty("pack")&&(s.reset(),s.addPack({payload:r.settings.pack})))return r.settings.status=n.LOADING,s.once(h.COMPLETE,this.payloadComplete,this),s.start(),this;return this.bootScene(i),this},stop:function(t,e){var i=this.getScene(t);if(i&&!i.sys.isTransitioning()&&i.sys.settings.status!==n.SHUTDOWN){var s=i.sys.load;s&&(s.off(h.COMPLETE,this.loadComplete,this),s.off(h.COMPLETE,this.payloadComplete,this)),i.sys.shutdown(e)}return this},switch:function(t,e){var i=this.getScene(t),s=this.getScene(e);return i&&s&&i!==s&&(this.sleep(t),this.isSleeping(e)?this.wake(e):this.start(e)),this},getAt:function(t){return this.scenes[t]},getIndex:function(t){var e=this.getScene(t);return this.scenes.indexOf(e)},bringToTop:function(t){if(this.isProcessing)this._queue.push({op:"bringToTop",keyA:t,keyB:null});else{var e=this.getIndex(t);if(-1!==e&&e0){var i=this.getScene(t);this.scenes.splice(e,1),this.scenes.unshift(i)}}return this},moveDown:function(t){if(this.isProcessing)this._queue.push({op:"moveDown",keyA:t,keyB:null});else{var e=this.getIndex(t);if(e>0){var i=e-1,s=this.getScene(t),n=this.getAt(i);this.scenes[e]=n,this.scenes[i]=s}}return this},moveUp:function(t){if(this.isProcessing)this._queue.push({op:"moveUp",keyA:t,keyB:null});else{var e=this.getIndex(t);if(ei),0,n)}}return this},moveBelow:function(t,e){if(t===e)return this;if(this.isProcessing)this._queue.push({op:"moveBelow",keyA:t,keyB:e});else{var i=this.getIndex(t),s=this.getIndex(e);if(-1!==i&&-1!==s&&s>i){var n=this.getAt(s);this.scenes.splice(s,1),0===i?this.scenes.unshift(n):this.scenes.splice(i-(s{var s=i(45319),n=i(83419),r=i(44594),o=i(95540),a=i(37277),h=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.key=t.sys.settings.key,this.manager=t.sys.game.scene,this.transitionProgress=0,this._elapsed=0,this._target=null,this._duration=0,this._onUpdate,this._onUpdateScope,this._willSleep=!1,this._willRemove=!1,t.sys.events.once(r.BOOT,this.boot,this),t.sys.events.on(r.START,this.pluginStart,this)},boot:function(){this.systems.events.once(r.DESTROY,this.destroy,this)},pluginStart:function(){this._target=null,this.systems.events.once(r.SHUTDOWN,this.shutdown,this)},start:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",this.key),this.manager.queueOp("start",t,e),this},restart:function(t){var e=this.key;return this.manager.queueOp("stop",e),this.manager.queueOp("start",e,t),this},transition:function(t){void 0===t&&(t={});var e=o(t,"target",!1),i=this.manager.getScene(e);if(!e||!this.checkValidTransition(i))return!1;var s=o(t,"duration",1e3);this._elapsed=0,this._target=i,this._duration=s,this._willSleep=o(t,"sleep",!1),this._willRemove=o(t,"remove",!1);var n=o(t,"onUpdate",null);n&&(this._onUpdate=n,this._onUpdateScope=o(t,"onUpdateScope",this.scene));var a=o(t,"allowInput",!1);this.settings.transitionAllowInput=a;var h=i.sys.settings;h.isTransition=!0,h.transitionFrom=this.scene,h.transitionDuration=s,h.transitionAllowInput=a,o(t,"moveAbove",!1)?this.manager.moveAbove(this.key,e):o(t,"moveBelow",!1)&&this.manager.moveBelow(this.key,e),i.sys.isSleeping()?i.sys.wake(o(t,"data")):this.manager.start(e,o(t,"data"));var l=o(t,"onStart",null),u=o(t,"onStartScope",this.scene);return l&&l.call(u,this.scene,i,s),this.systems.events.emit(r.TRANSITION_OUT,i,s),!0},checkValidTransition:function(t){return!(!t||t.sys.isActive()||t.sys.isTransitioning()||t===this.scene||this.systems.isTransitioning())},step:function(t,e){this._elapsed+=e,this.transitionProgress=s(this._elapsed/this._duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.transitionProgress),this._elapsed>=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;t.events.emit(r.TRANSITION_COMPLETE,this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i,s){return this.manager.add(t,e,i,s)},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t,e),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var s=this.manager.getScene(e);return s&&s.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(t),this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isPaused:function(t){return void 0===t&&(t=this.key),this.manager.isPaused(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.swapPosition(t,e),this},moveAbove:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveAbove(t,e),this},moveBelow:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveBelow(t,e),this},remove:function(t){return void 0===t&&(t=this.key),this.manager.remove(t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},getStatus:function(t){var e=this.manager.getScene(t);if(e)return e.sys.getStatus()},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(r.SHUTDOWN,this.shutdown,this),t.off(r.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(r.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});a.register("ScenePlugin",h,"scenePlugin"),t.exports=h},55681:(t,e,i)=>{var s=i(89993),n=i(35154),r=i(46975),o=i(87033),a={create:function(t){return"string"==typeof t?t={key:t}:void 0===t&&(t={}),{status:s.PENDING,key:n(t,"key",""),active:n(t,"active",!1),visible:n(t,"visible",!0),isBooted:!1,isTransition:!1,transitionFrom:null,transitionDuration:0,transitionAllowInput:!0,data:{},pack:n(t,"pack",!1),cameras:n(t,"cameras",null),map:n(t,"map",r(o,n(t,"mapAdd",{}))),physics:n(t,"physics",{}),loader:n(t,"loader",{}),plugins:n(t,"plugins",!1),input:n(t,"input",{})}}};t.exports=a},2368:(t,e,i)=>{var s=i(83419),n=i(89993),r=i(42363),o=i(44594),a=i(27397),h=i(52106),l=i(29747),u=i(55681),c=new s({initialize:function(t,e){this.scene=t,this.game,this.renderer,this.config=e,this.settings=u.create(e),this.canvas,this.context,this.anims,this.cache,this.plugins,this.registry,this.scale,this.sound,this.textures,this.add,this.cameras,this.displayList,this.events,this.make,this.scenePlugin,this.updateList,this.sceneUpdate=l},init:function(t){this.settings.status=n.INIT,this.sceneUpdate=l,this.game=t,this.renderer=t.renderer,this.canvas=t.canvas,this.context=t.context;var e=t.plugins;this.plugins=e,e.addToScene(this,r.Global,[r.CoreScene,h(this),a(this)]),this.events.emit(o.BOOT,this),this.settings.isBooted=!0},step:function(t,e){var i=this.events;i.emit(o.PRE_UPDATE,t,e),i.emit(o.UPDATE,t,e),this.sceneUpdate.call(this.scene,t,e),i.emit(o.POST_UPDATE,t,e)},render:function(t){var e=this.displayList;e.depthSort(),this.events.emit(o.PRE_RENDER,t),this.cameras.render(t,e),this.events.emit(o.RENDER,t)},queueDepthSort:function(){this.displayList.queueDepthSort()},depthSort:function(){this.displayList.depthSort()},pause:function(t){var e=this.settings,i=this.getStatus();return i!==n.CREATING&&i!==n.RUNNING?console.warn("Cannot pause non-running Scene",e.key):this.settings.active&&(e.status=n.PAUSED,e.active=!1,this.events.emit(o.PAUSE,this,t)),this},resume:function(t){var e=this.events,i=this.settings;return this.settings.active||(i.status=n.RUNNING,i.active=!0,e.emit(o.RESUME,this,t)),this},sleep:function(t){var e=this.settings,i=this.getStatus();return i!==n.CREATING&&i!==n.RUNNING?console.warn("Cannot sleep non-running Scene",e.key):(e.status=n.SLEEPING,e.active=!1,e.visible=!1,this.events.emit(o.SLEEP,this,t)),this},wake:function(t){var e=this.events,i=this.settings;return i.status=n.RUNNING,i.active=!0,i.visible=!0,e.emit(o.WAKE,this,t),i.isTransition&&e.emit(o.TRANSITION_WAKE,i.transitionFrom,i.transitionDuration),this},getData:function(){return this.settings.data},getStatus:function(){return this.settings.status},canInput:function(){var t=this.settings.status;return t>n.PENDING&&t<=n.RUNNING},isSleeping:function(){return this.settings.status===n.SLEEPING},isActive:function(){return this.settings.status===n.RUNNING},isPaused:function(){return this.settings.status===n.PAUSED},isTransitioning:function(){return this.settings.isTransition||null!==this.scenePlugin._target},isTransitionOut:function(){return null!==this.scenePlugin._target&&this.scenePlugin._duration>0},isTransitionIn:function(){return this.settings.isTransition},isVisible:function(){return this.settings.visible},setVisible:function(t){return this.settings.visible=t,this},setActive:function(t,e){return t?this.resume(e):this.pause(e)},start:function(t){var e=this.events,i=this.settings;t&&(i.data=t),i.status=n.START,i.active=!0,i.visible=!0,e.emit(o.START,this),e.emit(o.READY,this,t)},shutdown:function(t){var e=this.events,i=this.settings;e.off(o.TRANSITION_INIT),e.off(o.TRANSITION_START),e.off(o.TRANSITION_COMPLETE),e.off(o.TRANSITION_OUT),i.status=n.SHUTDOWN,i.active=!1,i.visible=!1,e.emit(o.SHUTDOWN,this,t)},destroy:function(){var t=this.events,e=this.settings;e.status=n.DESTROYED,e.active=!1,e.visible=!1,t.emit(o.DESTROY,this),t.removeAllListeners();for(var i=["scene","game","anims","cache","plugins","registry","sound","textures","add","camera","displayList","events","make","scenePlugin","updateList"],s=0;s{t.exports={PENDING:0,INIT:1,START:2,LOADING:3,CREATING:4,RUNNING:5,PAUSED:6,SLEEPING:7,SHUTDOWN:8,DESTROYED:9}},69830:t=>{t.exports="addedtoscene"},7919:t=>{t.exports="boot"},46763:t=>{t.exports="create"},11763:t=>{t.exports="destroy"},71555:t=>{t.exports="pause"},36735:t=>{t.exports="postupdate"},3809:t=>{t.exports="prerender"},90716:t=>{t.exports="preupdate"},58262:t=>{t.exports="ready"},91633:t=>{t.exports="removedfromscene"},10319:t=>{t.exports="render"},87132:t=>{t.exports="resume"},81961:t=>{t.exports="shutdown"},90194:t=>{t.exports="sleep"},6265:t=>{t.exports="start"},33178:t=>{t.exports="transitioncomplete"},43063:t=>{t.exports="transitioninit"},11259:t=>{t.exports="transitionout"},61611:t=>{t.exports="transitionstart"},45209:t=>{t.exports="transitionwake"},22966:t=>{t.exports="update"},21747:t=>{t.exports="wake"},44594:(t,e,i)=>{t.exports={ADDED_TO_SCENE:i(69830),BOOT:i(7919),CREATE:i(46763),DESTROY:i(11763),PAUSE:i(71555),POST_UPDATE:i(36735),PRE_RENDER:i(3809),PRE_UPDATE:i(90716),READY:i(58262),REMOVED_FROM_SCENE:i(91633),RENDER:i(10319),RESUME:i(87132),SHUTDOWN:i(81961),SLEEP:i(90194),START:i(6265),TRANSITION_COMPLETE:i(33178),TRANSITION_INIT:i(43063),TRANSITION_OUT:i(11259),TRANSITION_START:i(61611),TRANSITION_WAKE:i(45209),UPDATE:i(22966),WAKE:i(21747)}},62194:(t,e,i)=>{var s=i(89993),n=i(79291),r={Events:i(44594),GetPhysicsPlugins:i(27397),GetScenePlugins:i(52106),SceneManager:i(60903),ScenePlugin:i(52209),Settings:i(55681),Systems:i(2368)};r=n(!1,r,s),t.exports=r},30341:(t,e,i)=>{var s=i(83419),n=i(50792),r=i(14463),o=i(79291),a=i(29747),h=new s({Extends:n,initialize:function(t,e,i){n.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=this.duration||0,this.totalDuration=this.totalDuration||0,this.config={mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0,pan:0},this.currentConfig=this.config,this.config=o(this.config,i),this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name||(this.markers[t.name]?(console.error("addMarker "+t.name+" already exists in Sound"),1):(t=o(!0,{name:"",start:0,duration:this.totalDuration-(t.start||0),config:{mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0,pan:0}},t),this.markers[t.name]=t,0)))},updateMarker:function(t){return!(!t||!t.name||"string"!=typeof t.name||(this.markers[t.name]?(this.markers[t.name]=o(!0,this.markers[t.name],t),0):(console.warn("Audio Marker: "+t.name+" missing in Sound: "+this.key),1)))},removeMarker:function(t){var e=this.markers[t];return e?(this.markers[t]=null,e):null},play:function(t,e){if(void 0===t&&(t=""),"object"==typeof t&&(e=t,t=""),"string"!=typeof t)return!1;if(t){if(!this.markers[t])return console.warn("Marker: "+t+" missing in Sound: "+this.key),!1;this.currentMarker=this.markers[t],this.currentConfig=this.currentMarker.config,this.duration=this.currentMarker.duration}else this.currentMarker=null,this.currentConfig=this.config,this.duration=this.totalDuration;return this.resetConfig(),this.currentConfig=o(this.currentConfig,e),this.isPlaying=!0,this.isPaused=!1,!0},pause:function(){return!(this.isPaused||!this.isPlaying||(this.isPlaying=!1,this.isPaused=!0,0))},resume:function(){return!(!this.isPaused||this.isPlaying||(this.isPlaying=!0,this.isPaused=!1,0))},stop:function(){return!(!this.isPaused&&!this.isPlaying||(this.isPlaying=!1,this.isPaused=!1,this.resetConfig(),0))},applyConfig:function(){this.mute=this.currentConfig.mute,this.volume=this.currentConfig.volume,this.rate=this.currentConfig.rate,this.detune=this.currentConfig.detune,this.loop=this.currentConfig.loop,this.pan=this.currentConfig.pan},resetConfig:function(){this.currentConfig.seek=0,this.currentConfig.delay=0},update:a,calculateRate:function(){var t=this.currentConfig.detune+this.manager.detune,e=Math.pow(1.0005777895065548,t);this.totalRate=this.currentConfig.rate*this.manager.rate*e},destroy:function(){this.pendingRemove||(this.stop(),this.emit(r.DESTROY,this),this.removeAllListeners(),this.pendingRemove=!0,this.manager=null,this.config=null,this.currentConfig=null,this.markers=null,this.currentMarker=null)}});t.exports=h},85034:(t,e,i)=>{var s=i(83419),n=i(41786),r=i(50792),o=i(14463),a=i(8443),h=i(46710),l=i(58731),u=i(29747),c=i(26099),d=new s({Extends:r,initialize:function(t){r.call(this),this.game=t,this.jsonCache=t.cache.json,this.sounds=[],this.mute=!1,this.volume=1,this.pauseOnBlur=!0,this._rate=1,this._detune=0,this.locked=this.locked||!1,this.unlocked=!1,this.gameLostFocus=!1,this.listenerPosition=new c,t.events.on(a.BLUR,this.onGameBlur,this),t.events.on(a.FOCUS,this.onGameFocus,this),t.events.on(a.PRE_STEP,this.update,this),t.events.once(a.DESTROY,this.destroy,this)},add:u,addAudioSprite:function(t,e){void 0===e&&(e={});var i=this.add(t,e);for(var s in i.spritemap=this.jsonCache.get(t).spritemap,i.spritemap)if(i.spritemap.hasOwnProperty(s)){var r=n(e),o=i.spritemap[s];r.loop=!!o.hasOwnProperty("loop")&&o.loop,i.addMarker({name:s,start:o.start,duration:o.end-o.start,config:r})}return i},get:function(t){return l(this.sounds,"key",t)},getAll:function(t){return t?h(this.sounds,"key",t):h(this.sounds)},getAllPlaying:function(){return h(this.sounds,"isPlaying",!0)},play:function(t,e){var i=this.add(t);return i.once(o.COMPLETE,i.destroy,i),e?e.name?(i.addMarker(e),i.play(e.name)):i.play(e):i.play()},playAudioSprite:function(t,e,i){var s=this.addAudioSprite(t);return s.once(o.COMPLETE,s.destroy,s),s.play(e,i)},remove:function(t){var e=this.sounds.indexOf(t);return-1!==e&&(t.destroy(),this.sounds.splice(e,1),!0)},removeAll:function(){this.sounds.forEach((function(t){t.destroy()})),this.sounds.length=0},removeByKey:function(t){for(var e=0,i=this.sounds.length-1;i>=0;i--){var s=this.sounds[i];s.key===t&&(s.destroy(),this.sounds.splice(i,1),e++)}return e},pauseAll:function(){this.forEachActiveSound((function(t){t.pause()})),this.emit(o.PAUSE_ALL,this)},resumeAll:function(){this.forEachActiveSound((function(t){t.resume()})),this.emit(o.RESUME_ALL,this)},setListenerPosition:u,stopAll:function(){this.forEachActiveSound((function(t){t.stop()})),this.emit(o.STOP_ALL,this)},stopByKey:function(t){var e=0;return this.getAll(t).forEach((function(t){t.stop()&&e++})),e},unlock:u,onBlur:u,onFocus:u,onGameBlur:function(){this.gameLostFocus=!0,this.pauseOnBlur&&this.onBlur()},onGameFocus:function(){this.gameLostFocus=!1,this.pauseOnBlur&&this.onFocus()},update:function(t,e){this.unlocked&&(this.unlocked=!1,this.locked=!1,this.emit(o.UNLOCKED,this));for(var i=this.sounds.length-1;i>=0;i--)this.sounds[i].pendingRemove&&this.sounds.splice(i,1);this.sounds.forEach((function(i){i.update(t,e)}))},destroy:function(){this.game.events.off(a.BLUR,this.onGameBlur,this),this.game.events.off(a.FOCUS,this.onGameFocus,this),this.game.events.off(a.PRE_STEP,this.update,this),this.removeAllListeners(),this.removeAll(),this.sounds.length=0,this.sounds=null,this.listenerPosition=null,this.game=null},forEachActiveSound:function(t,e){var i=this;this.sounds.forEach((function(s,n){s&&!s.pendingRemove&&t.call(e||i,s,n,i.sounds)}))},setRate:function(t){return this.rate=t,this},rate:{get:function(){return this._rate},set:function(t){this._rate=t,this.forEachActiveSound((function(t){t.calculateRate()})),this.emit(o.GLOBAL_RATE,this,t)}},setDetune:function(t){return this.detune=t,this},detune:{get:function(){return this._detune},set:function(t){this._detune=t,this.forEachActiveSound((function(t){t.calculateRate()})),this.emit(o.GLOBAL_DETUNE,this,t)}}});t.exports=d},14747:(t,e,i)=>{var s=i(33684),n=i(25960),r=i(57490),o={create:function(t){var e=t.config.audio,i=t.device.audio;return e.noAudio||!i.webAudio&&!i.audioData?new n(t):i.webAudio&&!e.disableWebAudio?new r(t):new s(t)}};t.exports=o},19723:t=>{t.exports="complete"},98882:t=>{t.exports="decodedall"},57506:t=>{t.exports="decoded"},73146:t=>{t.exports="destroy"},11305:t=>{t.exports="detune"},40577:t=>{t.exports="detune"},30333:t=>{t.exports="mute"},20394:t=>{t.exports="rate"},21802:t=>{t.exports="volume"},1299:t=>{t.exports="looped"},99190:t=>{t.exports="loop"},97125:t=>{t.exports="mute"},89259:t=>{t.exports="pan"},79986:t=>{t.exports="pauseall"},17586:t=>{t.exports="pause"},19618:t=>{t.exports="play"},42306:t=>{t.exports="rate"},10387:t=>{t.exports="resumeall"},48959:t=>{t.exports="resume"},9960:t=>{t.exports="seek"},19180:t=>{t.exports="stopall"},98328:t=>{t.exports="stop"},50401:t=>{t.exports="unlocked"},52498:t=>{t.exports="volume"},14463:(t,e,i)=>{t.exports={COMPLETE:i(19723),DECODED:i(57506),DECODED_ALL:i(98882),DESTROY:i(73146),DETUNE:i(11305),GLOBAL_DETUNE:i(40577),GLOBAL_MUTE:i(30333),GLOBAL_RATE:i(20394),GLOBAL_VOLUME:i(21802),LOOP:i(99190),LOOPED:i(1299),MUTE:i(97125),PAN:i(89259),PAUSE_ALL:i(79986),PAUSE:i(17586),PLAY:i(19618),RATE:i(42306),RESUME_ALL:i(10387),RESUME:i(48959),SEEK:i(9960),STOP_ALL:i(19180),STOP:i(98328),UNLOCKED:i(50401),VOLUME:i(52498)}},64895:(t,e,i)=>{var s=i(30341),n=i(83419),r=i(14463),o=i(45319),a=new n({Extends:s,initialize:function(t,e,i){if(void 0===i&&(i={}),this.tags=t.game.cache.audio.get(e),!this.tags)throw new Error('No cached audio asset with key "'+e);this.audio=null,this.startTime=0,this.previousTime=0,this.duration=this.tags[0].duration,this.totalDuration=this.tags[0].duration,s.call(this,t,e,i)},play:function(t,e){return!(this.manager.isLocked(this,"play",[t,e])||!s.prototype.play.call(this,t,e)||!this.pickAndPlayAudioTag()||(this.emit(r.PLAY,this),0))},pause:function(){return!(this.manager.isLocked(this,"pause")||this.startTime>0||!s.prototype.pause.call(this)||(this.currentConfig.seek=this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0),this.stopAndReleaseAudioTag(),this.emit(r.PAUSE,this),0))},resume:function(){return!(this.manager.isLocked(this,"resume")||this.startTime>0||!s.prototype.resume.call(this)||!this.pickAndPlayAudioTag()||(this.emit(r.RESUME,this),0))},stop:function(){return!this.manager.isLocked(this,"stop")&&!!s.prototype.stop.call(this)&&(this.stopAndReleaseAudioTag(),this.emit(r.STOP,this),!0)},pickAndPlayAudioTag:function(){if(!this.pickAudioTag())return this.reset(),!1;var t=this.currentConfig.seek,e=this.currentConfig.delay,i=(this.currentMarker?this.currentMarker.start:0)+t;return this.previousTime=i,this.audio.currentTime=i,this.applyConfig(),0===e?(this.startTime=0,this.audio.paused&&this.playCatchPromise()):(this.startTime=window.performance.now()+1e3*e,this.audio.paused||this.audio.pause()),this.resetConfig(),!0},pickAudioTag:function(){if(this.audio)return!0;for(var t=0;t0)this.startTime=i-this.manager.loopEndOffset?(this.audio.currentTime=e+Math.max(0,s-i),s=this.audio.currentTime):s=i)return this.reset(),this.stopAndReleaseAudioTag(),void this.emit(r.COMPLETE,this);this.previousTime=s}},destroy:function(){s.prototype.destroy.call(this),this.tags=null,this.audio&&this.stopAndReleaseAudioTag()},updateMute:function(){this.audio&&(this.audio.muted=this.currentConfig.mute||this.manager.mute)},updateVolume:function(){this.audio&&(this.audio.volume=o(this.currentConfig.volume*this.manager.volume,0,1))},calculateRate:function(){s.prototype.calculateRate.call(this),this.audio&&(this.audio.playbackRate=this.totalRate)},mute:{get:function(){return this.currentConfig.mute},set:function(t){this.currentConfig.mute=t,this.manager.isLocked(this,"mute",t)||(this.updateMute(),this.emit(r.MUTE,this,t))}},setMute:function(t){return this.mute=t,this},volume:{get:function(){return this.currentConfig.volume},set:function(t){this.currentConfig.volume=t,this.manager.isLocked(this,"volume",t)||(this.updateVolume(),this.emit(r.VOLUME,this,t))}},setVolume:function(t){return this.volume=t,this},rate:{get:function(){return this.currentConfig.rate},set:function(t){this.currentConfig.rate=t,this.manager.isLocked(this,r.RATE,t)||(this.calculateRate(),this.emit(r.RATE,this,t))}},setRate:function(t){return this.rate=t,this},detune:{get:function(){return this.currentConfig.detune},set:function(t){this.currentConfig.detune=t,this.manager.isLocked(this,r.DETUNE,t)||(this.calculateRate(),this.emit(r.DETUNE,this,t))}},setDetune:function(t){return this.detune=t,this},seek:{get:function(){return this.isPlaying?this.audio.currentTime-(this.currentMarker?this.currentMarker.start:0):this.isPaused?this.currentConfig.seek:0},set:function(t){this.manager.isLocked(this,"seek",t)||this.startTime>0||(this.isPlaying||this.isPaused)&&(t=Math.min(Math.max(0,t),this.duration),this.isPlaying?(this.previousTime=t,this.audio.currentTime=t):this.isPaused&&(this.currentConfig.seek=t),this.emit(r.SEEK,this,t))}},setSeek:function(t){return this.seek=t,this},loop:{get:function(){return this.currentConfig.loop},set:function(t){this.currentConfig.loop=t,this.manager.isLocked(this,"loop",t)||(this.audio&&(this.audio.loop=t),this.emit(r.LOOP,this,t))}},setLoop:function(t){return this.loop=t,this},pan:{get:function(){return this.currentConfig.pan},set:function(t){this.currentConfig.pan=t,this.emit(r.PAN,this,t)}},setPan:function(t){return this.pan=t,this}});t.exports=a},33684:(t,e,i)=>{var s=i(85034),n=i(83419),r=i(14463),o=i(64895),a=new n({Extends:s,initialize:function(t){this.override=!0,this.audioPlayDelay=.1,this.loopEndOffset=.05,this.onBlurPausedSounds=[],this.locked="ontouchstart"in window,this.lockedActionsQueue=this.locked?[]:null,this._mute=!1,this._volume=1,s.call(this,t)},add:function(t,e){var i=new o(this,t,e);return this.sounds.push(i),i},unlock:function(){this.locked=!1;var t=this;if(this.game.cache.audio.entries.each((function(e,i){for(var s=0;s{t.exports={SoundManagerCreator:i(14747),Events:i(14463),BaseSound:i(30341),BaseSoundManager:i(85034),WebAudioSound:i(71741),WebAudioSoundManager:i(57490),HTML5AudioSound:i(64895),HTML5AudioSoundManager:i(33684),NoAudioSound:i(4603),NoAudioSoundManager:i(25960)}},4603:(t,e,i)=>{var s=i(30341),n=i(83419),r=i(50792),o=i(79291),a=i(29747),h=function(){return!1},l=function(){return null},u=function(){return this},c=new n({Extends:r,initialize:function(t,e,i){void 0===i&&(i={}),r.call(this),this.manager=t,this.key=e,this.isPlaying=!1,this.isPaused=!1,this.totalRate=1,this.duration=0,this.totalDuration=0,this.config=o({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!1,delay:0,pan:0},i),this.currentConfig=this.config,this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.seek=0,this.loop=!1,this.pan=0,this.markers={},this.currentMarker=null,this.pendingRemove=!1},addMarker:h,updateMarker:h,removeMarker:l,play:h,pause:h,resume:h,stop:h,setMute:u,setVolume:u,setRate:u,setDetune:u,setSeek:u,setLoop:u,setPan:u,applyConfig:l,resetConfig:l,update:a,calculateRate:l,destroy:function(){s.prototype.destroy.call(this)}});t.exports=c},25960:(t,e,i)=>{var s=i(85034),n=i(83419),r=i(50792),o=i(4603),a=i(29747),h=new n({Extends:r,initialize:function(t){r.call(this),this.game=t,this.sounds=[],this.mute=!1,this.volume=1,this.rate=1,this.detune=0,this.pauseOnBlur=!0,this.locked=!1},add:function(t,e){var i=new o(this,t,e);return this.sounds.push(i),i},addAudioSprite:function(t,e){var i=this.add(t,e);return i.spritemap={},i},get:function(t){return s.prototype.get.call(this,t)},getAll:function(t){return s.prototype.getAll.call(this,t)},play:function(t,e){return!1},playAudioSprite:function(t,e,i){return!1},remove:function(t){return s.prototype.remove.call(this,t)},removeAll:function(){return s.prototype.removeAll.call(this)},removeByKey:function(t){return s.prototype.removeByKey.call(this,t)},stopByKey:function(t){return s.prototype.stopByKey.call(this,t)},onBlur:a,onFocus:a,onGameBlur:a,onGameFocus:a,pauseAll:a,resumeAll:a,stopAll:a,update:a,setRate:a,setDetune:a,setMute:a,setVolume:a,unlock:a,forEachActiveSound:function(t,e){s.prototype.forEachActiveSound.call(this,t,e)},destroy:function(){s.prototype.destroy.call(this)}});t.exports=h},71741:(t,e,i)=>{var s=i(30341),n=i(83419),r=i(14463),o=i(95540),a=new n({Extends:s,initialize:function(t,e,i){if(void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),!this.audioBuffer)throw new Error('Audio key "'+e+'" missing from cache');this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.pannerNode=null,this.spatialNode=null,this.spatialSource=null,this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),t.context.createPanner&&(this.spatialNode=t.context.createPanner(),this.volumeNode.connect(this.spatialNode)),t.context.createStereoPanner?(this.pannerNode=t.context.createStereoPanner(),t.context.createPanner?this.spatialNode.connect(this.pannerNode):this.volumeNode.connect(this.pannerNode),this.pannerNode.connect(t.destination)):t.context.createPanner?this.spatialNode.connect(t.destination):this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,s.call(this,t,e,i)},play:function(t,e){return!!s.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit(r.PLAY,this),!0)},pause:function(){return!(this.manager.context.currentTime{var s=i(53134),n=i(85034),r=i(83419),o=i(14463),a=i(8443),h=i(71741),l=i(95540),u=new r({Extends:n,initialize:function(t){this.context=this.createAudioContext(t),this.masterMuteNode=this.context.createGain(),this.masterVolumeNode=this.context.createGain(),this.masterMuteNode.connect(this.masterVolumeNode),this.masterVolumeNode.connect(this.context.destination),this.destination=this.masterMuteNode,this.locked="suspended"===this.context.state&&("ontouchstart"in window||"onclick"in window),n.call(this,t),this.locked&&t.isBooted?this.unlock():t.events.once(a.BOOT,this.unlock,this)},createAudioContext:function(t){var e=t.config.audio;return e.context?(e.context.resume(),e.context):window.hasOwnProperty("AudioContext")?new AudioContext:window.hasOwnProperty("webkitAudioContext")?new window.webkitAudioContext:void 0},setAudioContext:function(t){return this.context&&this.context.close(),this.masterMuteNode&&this.masterMuteNode.disconnect(),this.masterVolumeNode&&this.masterVolumeNode.disconnect(),this.context=t,this.masterMuteNode=t.createGain(),this.masterVolumeNode=t.createGain(),this.masterMuteNode.connect(this.masterVolumeNode),this.masterVolumeNode.connect(t.destination),this.destination=this.masterMuteNode,this},add:function(t,e){var i=new h(this,t,e);return this.sounds.push(i),i},decodeAudio:function(t,e){var i;i=Array.isArray(t)?t:[{key:t,data:e}];for(var n=this.game.cache.audio,r=i.length,a=0;a{var s=i(37105),n=i(83419),r=i(29747),o=i(19186),a=new n({initialize:function(t){this.parent=t,this.list=[],this.position=0,this.addCallback=r,this.removeCallback=r,this._sortKey=""},add:function(t,e){return e?s.Add(this.list,t):s.Add(this.list,t,0,this.addCallback,this)},addAt:function(t,e,i){return i?s.AddAt(this.list,t,e):s.AddAt(this.list,t,e,0,this.addCallback,this)},getAt:function(t){return this.list[t]},getIndex:function(t){return this.list.indexOf(t)},sort:function(t,e){return t?(void 0===e&&(e=function(e,i){return e[t]-i[t]}),o(this.list,e),this):this},getByName:function(t){return s.GetFirst(this.list,"name",t)},getRandom:function(t,e){return s.GetRandom(this.list,t,e)},getFirst:function(t,e,i,n){return s.GetFirst(this.list,t,e,i,n)},getAll:function(t,e,i,n){return s.GetAll(this.list,t,e,i,n)},count:function(t,e){return s.CountAllMatching(this.list,t,e)},swap:function(t,e){s.Swap(this.list,t,e)},moveTo:function(t,e){return s.MoveTo(this.list,t,e)},moveAbove:function(t,e){return s.MoveAbove(this.list,t,e)},moveBelow:function(t,e){return s.MoveBelow(this.list,t,e)},remove:function(t,e){return e?s.Remove(this.list,t):s.Remove(this.list,t,this.removeCallback,this)},removeAt:function(t,e){return e?s.RemoveAt(this.list,t):s.RemoveAt(this.list,t,this.removeCallback,this)},removeBetween:function(t,e,i){return i?s.RemoveBetween(this.list,t,e):s.RemoveBetween(this.list,t,e,this.removeCallback,this)},removeAll:function(t){for(var e=this.list.length;e--;)this.remove(this.list[e],t);return this},bringToTop:function(t){return s.BringToTop(this.list,t)},sendToBack:function(t){return s.SendToBack(this.list,t)},moveUp:function(t){return s.MoveUp(this.list,t),t},moveDown:function(t){return s.MoveDown(this.list,t),t},reverse:function(){return this.list.reverse(),this},shuffle:function(){return s.Shuffle(this.list),this},replace:function(t,e){return s.Replace(this.list,t,e)},exists:function(t){return this.list.indexOf(t)>-1},setAll:function(t,e,i,n){return s.SetAll(this.list,t,e,i,n),this},each:function(t,e){for(var i=[null],s=2;s0?this.list[0]:null}},last:{get:function(){return this.list.length>0?(this.position=this.list.length-1,this.list[this.position]):null}},next:{get:function(){return this.position0?(this.position--,this.list[this.position]):null}}});t.exports=a},90330:(t,e,i)=>{var s=new(i(83419))({initialize:function(t){this.entries={},this.size=0,this.setAll(t)},setAll:function(t){if(Array.isArray(t))for(var e=0;e{var s=i(83419),n=i(50792),r=i(82348),o=new s({Extends:n,initialize:function(){n.call(this),this._pending=[],this._active=[],this._destroy=[],this._toProcess=0,this.checkQueue=!1},isActive:function(t){return this._active.indexOf(t)>-1},isPending:function(t){return this._toProcess>0&&this._pending.indexOf(t)>-1},isDestroying:function(t){return this._destroy.indexOf(t)>-1},add:function(t){return this.checkQueue&&this.isActive(t)&&!this.isDestroying(t)||this.isPending(t)||(this._pending.push(t),this._toProcess++),t},remove:function(t){if(this.isPending(t)){var e=this._pending,i=e.indexOf(t);-1!==i&&e.splice(i,1)}else this.isActive(t)&&(this._destroy.push(t),this._toProcess++);return t},removeAll:function(){for(var t=this._active,e=this._destroy,i=t.length;i--;)e.push(t[i]),this._toProcess++;return this},update:function(){if(0===this._toProcess)return this._active;var t,e,i=this._destroy,s=this._active;for(t=0;t{var s=i(43886);function n(t){if(!(this instanceof n))return new n(t);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function r(t,e,i){if(!i)return e.indexOf(t);for(var s=0;s=t.minX&&e.maxY>=t.minY}function v(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(t,e,i,n,r){for(var o,a=[e,i];a.length;)(i=a.pop())-(e=a.pop())<=n||(o=e+Math.ceil((i-e)/n/2)*n,s(t,o,e,i,r),a.push(e,o,o,i))}n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],s=this.toBBox;if(!p(t,e))return i;for(var n,r,o,a,h=[];e;){for(n=0,r=e.children.length;n=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)},_split:function(t,e){var i=t[e],s=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,s);var r=this._chooseSplitIndex(i,n,s),a=v(i.children.splice(r,i.children.length-r));a.height=i.height,a.leaf=i.leaf,o(i,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=v([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var s,n,r,o,h,l,u,d,f,p,v,g,m,y;for(l=u=1/0,s=e;s<=i-e;s++)f=n=a(t,0,s,this.toBBox),p=r=a(t,s,i,this.toBBox),void 0,void 0,void 0,void 0,v=Math.max(f.minX,p.minX),g=Math.max(f.minY,p.minY),m=Math.min(f.maxX,p.maxX),y=Math.min(f.maxY,p.maxY),o=Math.max(0,m-v)*Math.max(0,y-g),h=c(n)+c(r),o=e;n--)r=t.children[n],h(u,t.leaf?o(r):r),c+=d(u);return c},_adjustParentBBoxes:function(t,e,i){for(var s=i;s>=0;s--)h(e[s],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():o(t[i],this.toBBox)},compareMinX:function(t,e){return t.left-e.left},compareMinY:function(t,e){return t.top-e.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},t.exports=n},35072:(t,e,i)=>{var s=new(i(83419))({initialize:function(t){if(this.entries=[],Array.isArray(t))for(var e=0;e-1&&this.entries.splice(e,1),this},dump:function(){console.group("Set");for(var t=0;t-1},union:function(t){var e=new s;return t.entries.forEach((function(t){e.set(t)})),this.entries.forEach((function(t){e.set(t)})),e},intersect:function(t){var e=new s;return this.entries.forEach((function(i){t.contains(i)&&e.set(i)})),e},difference:function(t){var e=new s;return this.entries.forEach((function(i){t.contains(i)||e.set(i)})),e},size:{get:function(){return this.entries.length},set:function(t){return t{var s=i(45319),n=i(83419),r=i(56583),o=i(26099),a=new n({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=null),this._width=t,this._height=e,this._parent=s,this.aspectMode=i,this.aspectRatio=0===e?1:t/e,this.minWidth=0,this.minHeight=0,this.maxWidth=Number.MAX_VALUE,this.maxHeight=Number.MAX_VALUE,this.snapTo=new o},setAspectMode:function(t){return void 0===t&&(t=0),this.aspectMode=t,this.setSize(this._width,this._height)},setSnap:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.snapTo.set(t,e),this.setSize(this._width,this._height)},setParent:function(t){return this._parent=t,this.setSize(this._width,this._height)},setMin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.minWidth=s(t,0,this.maxWidth),this.minHeight=s(e,0,this.maxHeight),this.setSize(this._width,this._height)},setMax:function(t,e){return void 0===t&&(t=Number.MAX_VALUE),void 0===e&&(e=t),this.maxWidth=s(t,this.minWidth,Number.MAX_VALUE),this.maxHeight=s(e,this.minHeight,Number.MAX_VALUE),this.setSize(this._width,this._height)},setSize:function(t,e){switch(void 0===t&&(t=0),void 0===e&&(e=t),this.aspectMode){case a.NONE:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height;break;case a.WIDTH_CONTROLS_HEIGHT:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(this._width*(1/this.aspectRatio),!1);break;case a.HEIGHT_CONTROLS_WIDTH:this._height=this.getNewHeight(r(e,this.snapTo.y)),this._width=this.getNewWidth(this._height*this.aspectRatio,!1);break;case a.FIT:this.constrain(t,e,!0);break;case a.ENVELOP:this.constrain(t,e,!1)}return this},setAspectRatio:function(t){return this.aspectRatio=t,this.setSize(this._width,this._height)},resize:function(t,e){return this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height,this},getNewWidth:function(t,e){return void 0===e&&(e=!0),t=s(t,this.minWidth,this.maxWidth),e&&this._parent&&t>this._parent.width&&(t=Math.max(this.minWidth,this._parent.width)),t},getNewHeight:function(t,e){return void 0===e&&(e=!0),t=s(t,this.minHeight,this.maxHeight),e&&this._parent&&t>this._parent.height&&(t=Math.max(this.minHeight,this._parent.height)),t},constrain:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=!0),t=this.getNewWidth(t),e=this.getNewHeight(e);var s=this.snapTo,n=0===e?1:t/e;return i&&this.aspectRatio>n||!i&&this.aspectRatio0&&(t=(e=r(e,s.y))*this.aspectRatio)):(i&&this.aspectRation)&&(t=(e=r(e,s.y))*this.aspectRatio,s.x>0&&(e=(t=r(t,s.x))*(1/this.aspectRatio))),this._width=t,this._height=e,this},fitTo:function(t,e){return this.constrain(t,e,!0)},envelop:function(t,e){return this.constrain(t,e,!1)},setWidth:function(t){return this.setSize(t,this._height)},setHeight:function(t){return this.setSize(this._width,t)},toString:function(){return"[{ Size (width="+this._width+" height="+this._height+" aspectRatio="+this.aspectRatio+" aspectMode="+this.aspectMode+") }]"},setCSS:function(t){t&&t.style&&(t.style.width=this._width+"px",t.style.height=this._height+"px")},copy:function(t){return t.setAspectMode(this.aspectMode),t.aspectRatio=this.aspectRatio,t.setSize(this.width,this.height)},destroy:function(){this._parent=null,this.snapTo=null},width:{get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},height:{get:function(){return this._height},set:function(t){this.setSize(this._width,t)}}});a.NONE=0,a.WIDTH_CONTROLS_HEIGHT=1,a.HEIGHT_CONTROLS_WIDTH=2,a.FIT=3,a.ENVELOP=4,t.exports=a},15238:t=>{t.exports="add"},56187:t=>{t.exports="remove"},82348:(t,e,i)=>{t.exports={PROCESS_QUEUE_ADD:i(15238),PROCESS_QUEUE_REMOVE:i(56187)}},41392:(t,e,i)=>{t.exports={Events:i(82348),List:i(73162),Map:i(90330),ProcessQueue:i(25774),RTree:i(59542),Set:i(35072),Size:i(86555)}},57382:(t,e,i)=>{var s=i(83419),n=i(45319),r=i(40987),o=i(8054),a=i(50030),h=i(79237),l=new s({Extends:h,initialize:function(t,e,i,s,n){h.call(this,t,e,i,s,n),this.add("__BASE",0,0,0,s,n),this._source=this.frames.__BASE.source,this.canvas=this._source.image,this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.width=s,this.height=n,this.imageData=this.context.getImageData(0,0,s,n),this.data=null,this.imageData&&(this.data=this.imageData.data),this.pixels=null,this.buffer,this.data&&(this.imageData.data.buffer?(this.buffer=this.imageData.data.buffer,this.pixels=new Uint32Array(this.buffer)):window.ArrayBuffer?(this.buffer=new ArrayBuffer(this.imageData.data.length),this.pixels=new Uint32Array(this.buffer)):this.pixels=this.imageData.data)},update:function(){return this.imageData=this.context.getImageData(0,0,this.width,this.height),this.data=this.imageData.data,this.imageData.data.buffer?(this.buffer=this.imageData.data.buffer,this.pixels=new Uint32Array(this.buffer)):window.ArrayBuffer?(this.buffer=new ArrayBuffer(this.imageData.data.length),this.pixels=new Uint32Array(this.buffer)):this.pixels=this.imageData.data,this.manager.game.config.renderType===o.WEBGL&&this.refresh(),this},draw:function(t,e,i,s){return void 0===s&&(s=!0),this.context.drawImage(i,t,e),s&&this.update(),this},drawFrame:function(t,e,i,s,n){void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=!0);var r=this.manager.getFrame(t,e);if(r){var o=r.canvasData,a=r.cutWidth,h=r.cutHeight,l=r.source.resolution;this.context.drawImage(r.source.image,o.x,o.y,a,h,i,s,a/l,h/l),n&&this.update()}return this},setPixel:function(t,e,i,s,n,r){if(void 0===r&&(r=255),t=Math.abs(Math.floor(t)),e=Math.abs(Math.floor(e)),this.getIndex(t,e)>-1){var o=this.context.getImageData(t,e,1,1);o.data[0]=i,o.data[1]=s,o.data[2]=n,o.data[3]=r,this.context.putImageData(o,t,e)}return this},putData:function(t,e,i,s,n,r,o){return void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=t.width),void 0===o&&(o=t.height),this.context.putImageData(t,e,i,s,n,r,o),this},getData:function(t,e,i,s){return t=n(Math.floor(t),0,this.width-1),e=n(Math.floor(e),0,this.height-1),i=n(i,1,this.width-t),s=n(s,1,this.height-e),this.context.getImageData(t,e,i,s)},getPixel:function(t,e,i){i||(i=new r);var s=this.getIndex(t,e);if(s>-1){var n=this.data,o=n[s+0],a=n[s+1],h=n[s+2],l=n[s+3];i.setTo(o,a,h,l)}return i},getPixels:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.width),void 0===s&&(s=i),t=Math.abs(Math.round(t)),e=Math.abs(Math.round(e));for(var o=n(t,0,this.width),a=n(t+i,0,this.width),h=n(e,0,this.height),l=n(e+s,0,this.height),u=new r,c=[],d=h;d{var s=i(10312),n=i(71911),r=i(27919),o=i(83419),a=i(8054),h=i(4327),l=i(95540),u=i(36060),c=i(32302),d=i(79237),f=i(70554),p=new o({Extends:d,initialize:function(t,e,i,s){void 0===i&&(i=256),void 0===s&&(s=256),this.type="DynamicTexture";var o=t.game.renderer,h=o&&o.type===a.CANVAS,l=h?r.create2D(this,i,s):[this];d.call(this,t,e,l,i,s),this.add("__BASE",0,0,0,i,s),this.renderer=o,this.width=-1,this.height=-1,this.isDrawing=!1,this.canvas=h?l:null,this.context=h?l.getContext("2d",{willReadFrequently:!0}):null,this.dirty=!1,this.isSpriteTexture=!0,this._eraseMode=!1,this.camera=new n(0,0,i,s).setScene(t.game.scene.systemScene,!1),this.renderTarget=h?null:new c(o,i,s,1,0,!1,!0,!0,!1),this.pipeline=h?null:o.pipelines.get(u.SINGLE_PIPELINE),this.setSize(i,s)},setSize:function(t,e){void 0===e&&(e=t);var i=this.get(),s=i.source;if(t!==this.width||e!==this.height){this.canvas&&(this.canvas.width=t,this.canvas.height=e);var n=this.renderTarget;n&&(n.willResize(t,e)&&n.resize(t,e),n.texture!==s.glTexture&&this.renderer.deleteTexture(s.glTexture),this.setFromRenderTarget()),this.camera.setSize(t,e),s.width=t,s.height=e,i.setSize(t,e),this.width=t,this.height=e}else{var r=this.getSourceImage();i.cutX+t>r.width&&(t=r.width-i.cutX),i.cutY+e>r.height&&(e=r.height-i.cutY),i.setSize(t,e,i.cutX,i.cutY)}return this},setFromRenderTarget:function(){var t=this.get().source,e=this.renderTarget;return t.isRenderTexture=!0,t.isGLTexture=!0,t.glTexture=e.texture,this},setIsSpriteTexture:function(t){return this.isSpriteTexture=t,this},fill:function(t,e,i,s,n,r){var o=this.camera,a=this.renderer;void 0===e&&(e=1),void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=this.width),void 0===r&&(r=this.height);var h=t>>16&255,l=t>>8&255,u=255&t,c=this.renderTarget;if(o.preRender(),c){c.bind(!0);var d=this.pipeline.manager.set(this.pipeline),p=a.width/c.width,v=a.height/c.height,g=c.height-(s+r);d.drawFillRect(i*p,g*v,n*p,r*v,f.getTintFromFloats(u/255,l/255,h/255,1),e),c.unbind(!0)}else{var m=this.context;a.setContext(m),m.globalCompositeOperation="source-over",m.fillStyle="rgba("+h+","+l+","+u+","+e+")",m.fillRect(i,s,n,r),a.setContext()}return this.dirty=!0,this},clear:function(){if(this.dirty){var t=this.context,e=this.renderTarget;e?e.clear():t&&(t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,this.width,this.height),t.restore()),this.dirty=!1}return this},stamp:function(t,e,i,s,n){void 0===i&&(i=0),void 0===s&&(s=0);var r=l(n,"alpha",1),o=l(n,"tint",16777215),a=l(n,"angle",0),h=l(n,"rotation",0),u=l(n,"scale",1),c=l(n,"scaleX",u),d=l(n,"scaleY",u),f=l(n,"originX",.5),p=l(n,"originY",.5),v=l(n,"blendMode",0),g=l(n,"erase",!1),m=l(n,"skipBatch",!1),y=this.manager.resetStamp(r,o);return y.setAngle(0),0!==a?y.setAngle(a):0!==h&&y.setRotation(h),y.setScale(c,d),y.setTexture(t,e),y.setOrigin(f,p),y.setBlendMode(v),g&&(this._eraseMode=!0),m?this.batchGameObject(y,i,s):this.draw(y,i,s),g&&(this._eraseMode=!1),this},erase:function(t,e,i){return this._eraseMode=!0,this.draw(t,e,i),this._eraseMode=!1,this},draw:function(t,e,i,s,n){return this.beginDraw(),this.batchDraw(t,e,i,s,n),this.endDraw(),this},drawFrame:function(t,e,i,s,n,r){return this.beginDraw(),this.batchDrawFrame(t,e,i,s,n,r),this.endDraw(),this},repeat:function(t,e,i,s,n,r,o,a,l){if(void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=this.width),void 0===r&&(r=this.height),void 0===o&&(o=1),void 0===a&&(a=16777215),void 0===l&&(l=!1),!(e=t instanceof h?t:this.manager.getFrame(t,e)))return this;var u=this.manager.resetStamp(o,a);u.setFrame(e),u.setOrigin(0);var c=e.width,d=e.height;n=Math.floor(n),r=Math.floor(r);var f=Math.ceil(n/c),p=Math.ceil(r/d),v=f*c-n,g=p*d-r;v>0&&(v=c-v),g>0&&(g=d-g),i<0&&(f+=Math.ceil(Math.abs(i)/c)),s<0&&(p+=Math.ceil(Math.abs(s)/d));var m=i,y=s,x=!1,T=this.manager.stampCrop.setTo(0,0,c,d);l||this.beginDraw();for(var w=0;w0&&b===f-1&&(x=!0,T.width=v),g>0&&w===p-1&&(x=!0,T.height=g),x&&u.setCrop(T),this.batchGameObject(u,m,y),u.isCropped=!1,T.setTo(0,0,c,d)),m+=c;m=i,y+=d}return l||this.endDraw(),this},beginDraw:function(){if(!this.isDrawing){var t=this.camera,e=this.renderer,i=this.renderTarget;t.preRender(),i?e.beginCapture(i.width,i.height):e.setContext(this.context),this.isDrawing=!0}return this},batchDraw:function(t,e,i,s,n){return Array.isArray(t)||(t=[t]),this.batchList(t,e,i,s,n),this},batchDrawFrame:function(t,e,i,s,n,r){void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=1),void 0===r&&(r=16777215);var o=this.manager.getFrame(t,e);return o&&(this.renderTarget?this.pipeline.batchTextureFrame(o,i,s,r,n,this.camera.matrix,null):this.batchTextureFrame(o,i,s,n,r)),this},endDraw:function(t){if(void 0===t&&(t=this._eraseMode),this.isDrawing){var e=this.renderer,i=this.renderTarget;if(i){var s=e.endCapture();e.pipelines.setUtility().blitFrame(s,i,1,!1,!1,t,this.isSpriteTexture),e.resetScissor(),e.resetViewport()}else e.setContext();this.dirty=!0,this.isDrawing=!1}return this},batchList:function(t,e,i,s,n){var r=t.length;if(0!==r)for(var o=0;o0&&a.height>0&&o.drawImage(h,a.x,a.y,a.width,a.height,e,i,a.width,a.height),o.restore()}},snapshotArea:function(t,e,i,s,n,r,o){return this.renderTarget?this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer,this.width,this.height,n,!1,t,e,i,s,r,o):this.renderer.snapshotCanvas(this.canvas,n,!1,t,e,i,s,r,o),this},snapshot:function(t,e,i){return this.snapshotArea(0,0,this.width,this.height,t,e,i)},snapshotPixel:function(t,e,i){return this.snapshotArea(t,e,1,1,i,"pixel")},getWebGLTexture:function(){if(this.renderTarget)return this.renderTarget.texture},renderWebGL:function(t,e,i,s){var n=this.manager.resetStamp();n.setTexture(this),n.setOrigin(0),n.renderWebGL(t,n,i,s)},renderCanvas:function(){},destroy:function(){var t=this.manager.stamp;t&&t.texture===this&&this.manager.resetStamp(),d.prototype.destroy.call(this),r.remove(this.canvas),this.renderTarget&&this.renderTarget.destroy(),this.camera.destroy(),this.canvas=null,this.context=null,this.renderer=null}});t.exports=p},4327:(t,e,i)=>{var s=i(83419),n=i(45319),r=i(79291),o=new s({initialize:function(t,e,i,s,n,r,o){this.texture=t,this.name=e,this.source=t.source[i],this.sourceIndex=i,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0},is3Slice:!1,scale9:!1,scale9Borders:{x:0,y:0,w:0,h:0}},this.setSize(r,o,s,n)},setSize:function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=0),this.cutX=i,this.cutY=s,this.cutWidth=t,this.cutHeight=e,this.width=t,this.height=e,this.halfWidth=Math.floor(.5*t),this.halfHeight=Math.floor(.5*e),this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2);var n=this.data,r=n.cut;r.x=i,r.y=s,r.w=t,r.h=e,r.r=i+t,r.b=s+e,n.sourceSize.w=t,n.sourceSize.h=e,n.spriteSourceSize.w=t,n.spriteSourceSize.h=e,n.radius=.5*Math.sqrt(t*t+e*e);var o=n.drawImage;return o.x=i,o.y=s,o.width=t,o.height=e,this.updateUVs()},setTrim:function(t,e,i,s,n,r){var o=this.data,a=o.spriteSourceSize;return o.trim=!0,o.sourceSize.w=t,o.sourceSize.h=e,a.x=i,a.y=s,a.w=n,a.h=r,a.r=i+n,a.b=s+r,this.x=i,this.y=s,this.width=n,this.height=r,this.halfWidth=.5*n,this.halfHeight=.5*r,this.centerX=Math.floor(n/2),this.centerY=Math.floor(r/2),this.updateUVs()},setScale9:function(t,e,i,s){var n=this.data;return n.scale9=!0,n.is3Slice=0===e&&s===this.height,n.scale9Borders.x=t,n.scale9Borders.y=e,n.scale9Borders.w=i,n.scale9Borders.h=s,this},setCropUVs:function(t,e,i,s,r,o,a){var h=this.cutX,l=this.cutY,u=this.cutWidth,c=this.cutHeight,d=this.realWidth,f=this.realHeight,p=h+(e=n(e,0,d)),v=l+(i=n(i,0,f)),g=s=n(s,0,d-e),m=r=n(r,0,f-i),y=this.data;if(y.trim){var x=y.spriteSourceSize,T=e+(s=n(s,0,u-e)),w=i+(r=n(r,0,c-i));if(x.rT||x.y>w)p=0,v=0,g=0,m=0;else{var b=Math.max(x.x,e),S=Math.max(x.y,i),E=Math.min(x.r,T)-b,A=Math.min(x.b,w)-S;g=E,m=A,p=o?h+(u-(b-x.x)-E):h+(b-x.x),v=a?l+(c-(S-x.y)-A):l+(S-x.y),e=b,i=S,s=E,r=A}}else o&&(p=h+(u-e-s)),a&&(v=l+(c-i-r));var C=this.source.width,_=this.source.height;return t.u0=Math.max(0,p/C),t.v0=Math.max(0,v/_),t.u1=Math.min(1,(p+g)/C),t.v1=Math.min(1,(v+m)/_),t.x=e,t.y=i,t.cx=p,t.cy=v,t.cw=g,t.ch=m,t.width=s,t.height=r,t.flipX=o,t.flipY=a,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},setUVs:function(t,e,i,s,n,r){var o=this.data.drawImage;return o.width=t,o.height=e,this.u0=i,this.v0=s,this.u1=n,this.v1=r,this},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,s=this.cutHeight,n=this.data.drawImage;n.width=i,n.height=s;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+s)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new o(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=r(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.texture=null,this.source=null,this.customData=null,this.data=null},glTexture:{get:function(){return this.source.glTexture}},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},scale9:{get:function(){return this.data.scale9}},is3Slice:{get:function(){return this.data.is3Slice}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=o},79237:(t,e,i)=>{var s=i(83419),n=i(4327),r=i(11876),o='Texture "%s" has no frame "%s"',a=new s({initialize:function(t,e,i,s,n){Array.isArray(i)||(i=[i]),this.manager=t,this.key=e,this.source=[],this.dataSource=[],this.frames={},this.customData={},this.firstFrame="__BASE",this.frameTotal=0;for(var o=0;on&&(n=a.cutX+a.cutWidth),a.cutY+a.cutHeight>r&&(r=a.cutY+a.cutHeight)}return{x:i,y:s,width:n-i,height:r-s}},getFrameNames:function(t){void 0===t&&(t=!1);var e=Object.keys(this.frames);if(!t){var i=e.indexOf("__BASE");-1!==i&&e.splice(i,1)}return e},getSourceImage:function(t){null!=t&&1!==this.frameTotal||(t="__BASE");var e=this.frames[t];return e?e.source.image:(console.warn(o,this.key,t),this.frames.__BASE.source.image)},getDataSourceImage:function(t){null!=t&&1!==this.frameTotal||(t="__BASE");var e,i=this.frames[t];return i?e=i.sourceIndex:(console.warn(o,this.key,t),e=this.frames.__BASE.sourceIndex),this.dataSource[e].image},setDataSource:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e{var s=i(27919),n=i(57382),r=i(83419),o=i(40987),a=i(8054),h=i(81320),l=i(50792),u=i(69442),c=i(4327),d=i(8443),f=i(99584),p=i(35154),v=i(88571),g=i(41212),m=i(61309),y=i(87841),x=i(79237),T=new r({Extends:l,initialize:function(t){l.call(this),this.game=t,this.name="TextureManager",this.list={},this._tempCanvas=s.create2D(this),this._tempContext=this._tempCanvas.getContext("2d",{willReadFrequently:!0}),this._pending=0,this.stamp,this.stampCrop=new y,this.silentWarnings=!1,t.events.once(d.BOOT,this.boot,this)},boot:function(){this._pending=3,this.on(u.LOAD,this.updatePending,this),this.on(u.ERROR,this.updatePending,this);var t=this.game.config;this.addBase64("__DEFAULT",t.defaultImage),this.addBase64("__MISSING",t.missingImage),this.addBase64("__WHITE",t.whiteImage),this.game.renderer&&this.game.renderer.gl&&this.addUint8Array("__NORMAL",new Uint8Array([127,127,255,255]),1,1),this.game.events.once(d.DESTROY,this.destroy,this),this.game.events.once(d.SYSTEM_READY,(function(t){this.stamp=new v(t).setOrigin(0)}),this)},updatePending:function(){this._pending--,0===this._pending&&(this.off(u.LOAD),this.off(u.ERROR),this.emit(u.READY))},checkKey:function(t){return!this.exists(t)||(this.silentWarnings||console.error("Texture key already in use: "+t),!1)},remove:function(t){if("string"==typeof t){if(!this.exists(t))return this.silentWarnings||console.warn("No texture found matching key: "+t),this;t=this.get(t)}var e=t.key;return this.list.hasOwnProperty(e)&&(t.destroy(),this.emit(u.REMOVE,e),this.emit(u.REMOVE_KEY+e)),this},removeKey:function(t){return this.list.hasOwnProperty(t)&&delete this.list[t],this},addBase64:function(t,e){if(this.checkKey(t)){var i=this,s=new Image;s.onerror=function(){i.emit(u.ERROR,t)},s.onload=function(){var e=i.create(t,s);m.Image(e,0),i.emit(u.ADD,t,e),i.emit(u.ADD_KEY+t,e),i.emit(u.LOAD,t,e)},s.src=e}return this},getBase64:function(t,e,i,n){void 0===i&&(i="image/png"),void 0===n&&(n=.92);var r="",o=this.getFrame(t,e);if(o&&(o.source.isRenderTexture||o.source.isGLTexture))this.silentWarnings||console.warn("Cannot getBase64 from WebGL Texture");else if(o){var a=o.canvasData,h=s.create2D(this,a.width,a.height),l=h.getContext("2d",{willReadFrequently:!0});a.width>0&&a.height>0&&l.drawImage(o.source.image,a.x,a.y,a.width,a.height,0,0,a.width,a.height),r=h.toDataURL(i,n),s.remove(h)}return r},addImage:function(t,e,i){var s=null;return this.checkKey(t)&&(s=this.create(t,e),m.Image(s,0),i&&s.setDataSource(i),this.emit(u.ADD,t,s),this.emit(u.ADD_KEY+t,s)),s},addGLTexture:function(t,e){var i=null;if(this.checkKey(t)){var s=e.width,n=e.height;(i=this.create(t,e,s,n)).add("__BASE",0,0,0,s,n),this.emit(u.ADD,t,i),this.emit(u.ADD_KEY+t,i)}return i},addCompressedTexture:function(t,e,i){var s=null;if(this.checkKey(t)){if((s=this.create(t,e)).add("__BASE",0,0,0,e.width,e.height),i){var n=function(t,e,i){Array.isArray(i.textures)||Array.isArray(i.frames)?m.JSONArray(t,e,i):m.JSONHash(t,e,i)};if(Array.isArray(i))for(var r=0;r=r.x&&t=r.y&&e=r.x&&t=r.y&&e{var s=i(27919),n=i(83419),r=i(50030),o=i(29795),a=i(82751),h=new n({initialize:function(t,e,i,s,n){void 0===n&&(n=!1);var h=t.manager.game;this.renderer=h.renderer,this.texture=t,this.source=e,this.image=e.compressed?null:e,this.compressionAlgorithm=e.compressed?e.format:null,this.resolution=1,this.width=i||e.naturalWidth||e.videoWidth||e.width||0,this.height=s||e.naturalHeight||e.videoHeight||e.height||0,this.scaleMode=o.DEFAULT,this.isCanvas=e instanceof HTMLCanvasElement,this.isVideo=window.hasOwnProperty("HTMLVideoElement")&&e instanceof HTMLVideoElement,this.isRenderTexture="RenderTexture"===e.type||"DynamicTexture"===e.type,this.isGLTexture=e instanceof a,this.isPowerOf2=r(this.width,this.height),this.glTexture=null,this.flipY=n,this.init(h)},init:function(t){var e=this.renderer;if(e){var i=this.source;if(e.gl){var s=this.image,n=this.flipY,r=this.width,o=this.height,a=this.scaleMode;this.isCanvas?this.glTexture=e.createCanvasTexture(s,!1,n):this.isVideo?this.glTexture=e.createVideoTexture(s,!1,n):this.isRenderTexture?this.glTexture=e.createTextureFromSource(null,r,o,a):this.isGLTexture?this.glTexture=i:this.compressionAlgorithm?this.glTexture=e.createTextureFromSource(i,void 0,void 0,a):i instanceof Uint8Array?this.glTexture=e.createUint8ArrayTexture(i,r,o,a):this.glTexture=e.createTextureFromSource(s,r,o,a)}else this.isRenderTexture&&(this.image=i.canvas)}t.config.antialias||this.setFilter(1)},setFilter:function(t){this.renderer&&this.renderer.gl&&this.renderer.setTextureFilter(this.glTexture,t),this.scaleMode=t},setFlipY:function(t){return void 0===t&&(t=!0),t===this.flipY||(this.flipY=t,this.update()),this},update:function(){var t=this.renderer,e=this.image,i=this.flipY,s=t.gl;s&&this.isCanvas?t.updateCanvasTexture(e,this.glTexture,i):s&&this.isVideo&&t.updateVideoTexture(e,this.glTexture,i)},destroy:function(){this.glTexture&&this.renderer.deleteTexture(this.glTexture),this.isCanvas&&s.remove(this.image),this.renderer=null,this.texture=null,this.source=null,this.image=null,this.glTexture=null}});t.exports=h},19673:t=>{t.exports={LINEAR:0,NEAREST:1}},44538:t=>{t.exports="addtexture"},63486:t=>{t.exports="addtexture-"},94851:t=>{t.exports="onerror"},29099:t=>{t.exports="onload"},8678:t=>{t.exports="ready"},86415:t=>{t.exports="removetexture"},30879:t=>{t.exports="removetexture-"},69442:(t,e,i)=>{t.exports={ADD:i(44538),ADD_KEY:i(63486),ERROR:i(94851),LOAD:i(29099),READY:i(8678),REMOVE:i(86415),REMOVE_KEY:i(30879)}},27458:(t,e,i)=>{var s=i(79291),n=i(19673),r={CanvasTexture:i(57382),DynamicTexture:i(81320),Events:i(69442),FilterMode:n,Frame:i(4327),Parsers:i(61309),Texture:i(79237),TextureManager:i(17130),TextureSource:i(11876)};r=s(!1,r,n),t.exports=r},89905:t=>{t.exports=function(t,e,i){if(i.getElementsByTagName("TextureAtlas")){var s=t.source[e];t.add("__BASE",e,0,0,s.width,s.height);for(var n,r=i.getElementsByTagName("SubTexture"),o=0;o{t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},4832:t=>{t.exports=function(t,e){var i=t.source[e];return t.add("__BASE",e,0,0,i.width,i.height),t}},78566:(t,e,i)=>{var s=i(41786);t.exports=function(t,e,i){if(i.frames||i.textures){var n=t.source[e];t.add("__BASE",e,0,0,n.width,n.height);for(var r,o=Array.isArray(i.textures)?i.textures[e].frames:i.frames,a=0;a{var s=i(41786);t.exports=function(t,e,i){if(i.frames){var n=t.source[e];t.add("__BASE",e,0,0,n.width,n.height);var r,o=i.frames;for(var a in o)if(o.hasOwnProperty(a)){var h=o[a];if(r=t.add(a,e,h.frame.x,h.frame.y,h.frame.w,h.frame.h)){h.trimmed&&r.setTrim(h.sourceSize.w,h.sourceSize.h,h.spriteSourceSize.x,h.spriteSourceSize.y,h.spriteSourceSize.w,h.spriteSourceSize.h),h.rotated&&(r.rotated=!0,r.updateUVsInverted());var l=h.anchor||h.pivot;l&&(r.customPivot=!0,r.pivotX=l.x,r.pivotY=l.y),h.scale9Borders&&r.setScale9(h.scale9Borders.x,h.scale9Borders.y,h.scale9Borders.w,h.scale9Borders.h),r.customData=s(h)}else console.warn("Invalid atlas json, frame already exists: "+a)}for(var u in i)"frames"!==u&&(Array.isArray(i[u])?t.customData[u]=i[u].slice(0):t.customData[u]=i[u]);return t}console.warn("Invalid Texture Atlas JSON Hash given, missing 'frames' Object")}},31403:t=>{t.exports=function(t){var e,i=[171,75,84,88,32,49,49,187,13,10,26,10],s=new Uint8Array(t,0,12);for(e=0;e>1),v=Math.max(1,v>>1),f+=g}return{mipmaps:d,width:h,height:l,internalFormat:a,compressed:!0,generateMipmap:!1}}console.warn("KTXParser - Only compressed formats supported")}},82038:t=>{function e(t,e,i,s,n,r,o){return void 0===o&&(o=16),Math.floor((t+i)/n)*Math.floor((e+s)/r)*o}function i(t,e){return(t=Math.max(t,16))*(e=Math.max(e,8))/4}function s(t,e){return(t=Math.max(t,8))*(e=Math.max(e,8))/2}function n(t,e){return Math.ceil(t/4)*Math.ceil(e/4)*16}function r(t,i){return e(t,i,3,3,4,4,8)}function o(t,i){return e(t,i,3,3,4,4)}var a={0:{sizeFunc:i,glFormat:[35841]},1:{sizeFunc:i,glFormat:[35843]},2:{sizeFunc:s,glFormat:[35840]},3:{sizeFunc:s,glFormat:[35842]},6:{sizeFunc:r,glFormat:[36196]},7:{sizeFunc:r,glFormat:[33776,35916]},8:{sizeFunc:o,glFormat:[33777,35917]},9:{sizeFunc:o,glFormat:[33778,35918]},11:{sizeFunc:o,glFormat:[33779,35919]},14:{sizeFunc:n,glFormat:[36494,36495]},15:{sizeFunc:n,glFormat:[36492,36493]},22:{sizeFunc:r,glFormat:[37492,37493]},23:{sizeFunc:o,glFormat:[37496,37497]},24:{sizeFunc:r,glFormat:[37494,37495]},25:{sizeFunc:r,glFormat:[37488]},26:{sizeFunc:o,glFormat:[37490]},27:{sizeFunc:o,glFormat:[37808,37840]},28:{sizeFunc:function(t,i){return e(t,i,4,3,5,4)},glFormat:[37809,37841]},29:{sizeFunc:function(t,i){return e(t,i,4,4,5,5)},glFormat:[37810,37842]},30:{sizeFunc:function(t,i){return e(t,i,5,4,6,5)},glFormat:[37811,37843]},31:{sizeFunc:function(t,i){return e(t,i,5,5,6,6)},glFormat:[37812,37844]},32:{sizeFunc:function(t,i){return e(t,i,7,4,8,5)},glFormat:[37813,37845]},33:{sizeFunc:function(t,i){return e(t,i,7,5,8,6)},glFormat:[37814,37846]},34:{sizeFunc:function(t,i){return e(t,i,7,7,8,8)},glFormat:[37815,37847]},35:{sizeFunc:function(t,i){return e(t,i,9,4,10,5)},glFormat:[37816,37848]},36:{sizeFunc:function(t,i){return e(t,i,9,5,10,6)},glFormat:[37817,37849]},37:{sizeFunc:function(t,i){return e(t,i,9,7,10,8)},glFormat:[37818,37850]},38:{sizeFunc:function(t,i){return e(t,i,9,9,10,10)},glFormat:[37819,37851]},39:{sizeFunc:function(t,i){return e(t,i,11,9,12,10)},glFormat:[37820,37852]},40:{sizeFunc:function(t,i){return e(t,i,11,11,12,12)},glFormat:[37821,37853]}};t.exports=function(t){for(var e=new Uint32Array(t,0,13),i=55727696===e[0]?e[2]:e[3],s=e[4],n=a[i].glFormat[s],r=a[i].sizeFunc,o=e[11],h=e[7],l=e[6],u=52+e[12],c=new Uint8Array(t,u),d=new Array(o),f=0,p=h,v=l,g=0;g>1),v=Math.max(1,v>>1),f+=m}return{mipmaps:d,width:h,height:l,internalFormat:n,compressed:!0,generateMipmap:!1}}},75549:(t,e,i)=>{var s=i(95540);t.exports=function(t,e,i,n,r,o,a){var h=s(a,"frameWidth",null),l=s(a,"frameHeight",h);if(null===h)throw new Error("TextureManager.SpriteSheet: Invalid frameWidth given.");var u=t.source[e];t.add("__BASE",e,0,0,u.width,u.height);var c=s(a,"startFrame",0),d=s(a,"endFrame",-1),f=s(a,"margin",0),p=s(a,"spacing",0),v=Math.floor((r-f+p)/(h+p))*Math.floor((o-f+p)/(l+p));0===v&&console.warn("SpriteSheet frame dimensions will result in zero frames for texture:",t.key),(c>v||c<-v)&&(c=0),c<0&&(c=v+c),(-1===d||d>v||dr&&(y=b-r),S>o&&(x=S-o),w>=c&&w<=d&&(t.add(T,e,i+g,n+m,h-y,l-x),T++),(g+=h+p)+h>r&&(g=f,m+=l+p)}return t}},47534:(t,e,i)=>{var s=i(95540);t.exports=function(t,e,i){var n=s(i,"frameWidth",null),r=s(i,"frameHeight",n);if(!n)throw new Error("TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.");var o=t.source[0];t.add("__BASE",0,0,0,o.width,o.height),s(i,"startFrame",0),s(i,"endFrame",-1);for(var a,h=s(i,"margin",0),l=s(i,"spacing",0),u=e.cutX,c=e.cutY,d=e.cutWidth,f=e.cutHeight,p=e.realWidth,v=e.realHeight,g=Math.floor((p-h+l)/(n+l)),m=Math.floor((v-h+l)/(r+l)),y=e.x,x=n-y,T=n-(p-d-y),w=e.y,b=r-w,S=r-(v-f-w),E=h,A=h,C=0,_=0;_{var e=0,i=function(t,i,s,n){var r=e-n.y-n.height;t.add(s,i,n.x,r,n.width,n.height)};t.exports=function(t,s,n){var r=t.source[s];t.add("__BASE",s,0,0,r.width,r.height),e=r.height;for(var o=n.split("\n"),a=/^[ ]*(- )*(\w+)+[: ]+(.*)/,h="",l="",u={x:0,y:0,width:0,height:0},c=0;c{var s=i(50030);function n(t){for(var e=t.mipmaps,i=0;i{t.exports={AtlasXML:i(89905),Canvas:i(72893),Image:i(4832),JSONArray:i(78566),JSONHash:i(39711),KTXParser:i(31403),PVRParser:i(82038),SpriteSheet:i(75549),SpriteSheetFromAtlas:i(47534),UnityYAML:i(86147)}},80341:t=>{t.exports={CSV:0,TILED_JSON:1,ARRAY_2D:2,WELTMEISTER:3}},16536:(t,e,i)=>{var s=new(i(83419))({initialize:function(t,e,i,s,n,r,o){(void 0===i||i<=0)&&(i=32),(void 0===s||s<=0)&&(s=32),void 0===n&&(n=0),void 0===r&&(r=0),this.name=t,this.firstgid=0|e,this.imageWidth=0|i,this.imageHeight=0|s,this.imageMargin=0|n,this.imageSpacing=0|r,this.properties=o||{},this.images=[],this.total=0},containsImageIndex:function(t){return t>=this.firstgid&&t{var s=new(i(83419))({initialize:function(t){if(this.gids=[],void 0!==t)for(var e=0;e{var s=i(80341),n=i(87010),r=i(46177),o=i(49075);t.exports=function(t,e,i,a,h,l,u,c){void 0===i&&(i=32),void 0===a&&(a=32),void 0===h&&(h=10),void 0===l&&(l=10),void 0===c&&(c=!1);var d=null;if(Array.isArray(u))d=r(void 0!==e?e:"map",s.ARRAY_2D,u,i,a,c);else if(void 0!==e){var f=t.cache.tilemap.get(e);f?d=r(e,f.format,f.data,i,a,c):console.warn("No map data found for key "+e)}return null===d&&(d=new n({tileWidth:i,tileHeight:a,width:h,height:l})),new o(t,d)}},23029:(t,e,i)=>{var s=i(83419),n=i(31401),r=i(91907),o=i(62644),a=i(93232),h=new s({Mixins:[n.AlphaSingle,n.Flip,n.Visible],initialize:function(t,e,i,s,n,r,o,a){this.layer=t,this.index=e,this.x=i,this.y=s,this.width=n,this.height=r,this.right,this.bottom,this.baseWidth=void 0!==o?o:n,this.baseHeight=void 0!==a?a:r,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=void 0,this.collisionCallbackContext=this,this.tint=16777215,this.tintFill=!1,this.physics={}},containsPoint:function(t,e){return!(tthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=o(t.properties),this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldXY(this.x,this.y,void 0,t).x:this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldXY(this.x,this.y,void 0,t).y:this.y*this.baseWidth-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new a),e.x=this.getLeft(t),e.y=this.getTop(t),e.width=this.getRight(t)-e.x,e.height=this.getBottom(t)-e.y,e},getCenterX:function(t){return(this.getLeft(t)+this.getRight(t))/2},getCenterY:function(t){return(this.getTop(t)+this.getBottom(t))/2},intersects:function(t,e,i,s){return!(i<=this.pixelX||s<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){return void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,s,n){return void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=t),void 0===n&&(n=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=s,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=s,n&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,s){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==s&&(this.baseHeight=s),this.updatePixelXY(),this},updatePixelXY:function(){var t=this.layer.orientation;if(t===r.ORTHOGONAL)this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight;else if(t===r.ISOMETRIC)this.pixelX=(this.x-this.y)*this.baseWidth*.5,this.pixelY=(this.x+this.y)*this.baseHeight*.5;else if(t===r.STAGGERED)this.pixelX=this.x*this.baseWidth+this.y%2*(this.baseWidth/2),this.pixelY=this.y*(this.baseHeight/2);else if(t===r.HEXAGONAL){var e,i,s=this.layer.staggerAxis,n=this.layer.staggerIndex,o=this.layer.hexSideLength;"y"===s?(i=(this.baseHeight-o)/2+o,this.pixelX="odd"===n?this.x*this.baseWidth+this.y%2*(this.baseWidth/2):this.x*this.baseWidth-this.y%2*(this.baseWidth/2),this.pixelY=this.y*i):"x"===s&&(e=(this.baseWidth-o)/2+o,this.pixelX=this.x*e,this.pixelY="odd"===n?this.y*this.baseHeight+this.x%2*(this.baseHeight/2):this.y*this.baseHeight-this.x%2*(this.baseHeight/2))}return this.right=this.pixelX+this.baseWidth,this.bottom=this.pixelY+this.baseHeight,this},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||void 0!==this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.layer.tilemapLayer;if(t){var e=t.gidMap[this.index];if(e)return e}return null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=h},49075:(t,e,i)=>{var s=i(84101),n=i(83419),r=i(39506),o=i(80341),a=i(95540),h=i(14977),l=i(27462),u=i(91907),c=i(36305),d=i(19133),f=i(68287),p=i(23029),v=i(81086),g=i(20442),m=i(33629),y=new n({initialize:function(t,e){this.scene=t,this.tileWidth=e.tileWidth,this.tileHeight=e.tileHeight,this.width=e.width,this.height=e.height,this.orientation=e.orientation,this.renderOrder=e.renderOrder,this.format=e.format,this.version=e.version,this.properties=e.properties,this.widthInPixels=e.widthInPixels,this.heightInPixels=e.heightInPixels,this.imageCollections=e.imageCollections,this.images=e.images,this.layers=e.layers,this.tiles=e.tiles,this.tilesets=e.tilesets,this.objects=e.objects,this.currentLayerIndex=0,this.hexSideLength=e.hexSideLength;var i=this.orientation;this._convert={WorldToTileXY:v.GetWorldToTileXYFunction(i),WorldToTileX:v.GetWorldToTileXFunction(i),WorldToTileY:v.GetWorldToTileYFunction(i),TileToWorldXY:v.GetTileToWorldXYFunction(i),TileToWorldX:v.GetTileToWorldXFunction(i),TileToWorldY:v.GetTileToWorldYFunction(i),GetTileCorners:v.GetTileCornersFunction(i)}},setRenderOrder:function(t){var e=["right-down","left-down","right-up","left-up"];return"number"==typeof t&&(t=e[t]),e.indexOf(t)>-1&&(this.renderOrder=t),this},addTilesetImage:function(t,e,i,n,r,a,h,l){if(void 0===t)return null;null==e&&(e=t);var u=this.scene.sys.textures;if(!u.exists(e))return console.warn('Texture key "%s" not found',e),null;var c=u.get(e),d=this.getTilesetIndex(t);if(null===d&&this.format===o.TILED_JSON)return console.warn('Tilemap has no tileset "%s". Its tilesets are %o',t,this.tilesets),null;var f=this.tilesets[d];return f?(f.setTileSize(i,n),f.setSpacing(r,a),f.setImage(c),f):(void 0===i&&(i=this.tileWidth),void 0===n&&(n=this.tileHeight),void 0===r&&(r=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===l&&(l={x:0,y:0}),(f=new m(t,h,i,n,r,a,void 0,void 0,l)).setImage(c),this.tilesets.push(f),this.tiles=s(this),f)},copy:function(t,e,i,s,n,r,o,a){return null!==(a=this.getLayer(a))?(v.Copy(t,e,i,s,n,r,o,a),this):null},createBlankLayer:function(t,e,i,s,n,r,o,a){if(void 0===i&&(i=0),void 0===s&&(s=0),void 0===n&&(n=this.width),void 0===r&&(r=this.height),void 0===o&&(o=this.tileWidth),void 0===a&&(a=this.tileHeight),null!==this.getLayerIndex(t))return console.warn("Invalid Tilemap Layer ID: "+t),null;for(var l,u=new h({name:t,tileWidth:o,tileHeight:a,width:n,height:r,orientation:this.orientation}),c=0;c-1&&this.putTileAt(e,r.x,r.y,i,r.tilemapLayer)}return s},removeTileAt:function(t,e,i,s,n){return void 0===i&&(i=!0),void 0===s&&(s=!0),null===(n=this.getLayer(n))?null:v.RemoveTileAt(t,e,i,s,n)},removeTileAtWorldXY:function(t,e,i,s,n,r){return void 0===i&&(i=!0),void 0===s&&(s=!0),null===(r=this.getLayer(r))?null:v.RemoveTileAtWorldXY(t,e,i,s,n,r)},renderDebug:function(t,e,i){return null===(i=this.getLayer(i))?null:(this.orientation===u.ORTHOGONAL&&v.RenderDebug(t,e,i),this)},renderDebugFull:function(t,e){for(var i=this.layers,s=0;s{var s=i(44603),n=i(31989);s.register("tilemap",(function(t){var e=void 0!==t?t:{};return n(this.scene,e.key,e.tileWidth,e.tileHeight,e.width,e.height,e.data,e.insertNull)}))},46029:(t,e,i)=>{var s=i(39429),n=i(31989);s.register("tilemap",(function(t,e,i,s,r,o,a){return null===t&&(t=void 0),null===e&&(e=void 0),null===i&&(i=void 0),null===s&&(s=void 0),null===r&&(r=void 0),n(this.scene,t,e,i,s,r,o,a)}))},20442:(t,e,i)=>{var s=i(83419),n=i(78389),r=i(31401),o=i(95643),a=i(81086),h=i(19218),l=i(26099),u=new s({Extends:o,Mixins:[r.Alpha,r.BlendMode,r.ComputedSize,r.Depth,r.Flip,r.GetBounds,r.Mask,r.Origin,r.Pipeline,r.PostPipeline,r.Transform,r.Visible,r.ScrollFactor,n,h],initialize:function(t,e,i,s,n,r){o.call(this,t,"TilemapLayer"),this.isTilemap=!0,this.tilemap=e,this.layerIndex=i,this.layer=e.layers[i],this.layer.tilemapLayer=this,this.tileset=[],this.tilesDrawn=0,this.tilesTotal=this.layer.width*this.layer.height,this.culledTiles=[],this.skipCull=!1,this.cullPaddingX=1,this.cullPaddingY=1,this.cullCallback=a.GetCullTilesFunction(this.layer.orientation),this._renderOrder=0,this.gidMap=[],this.tempVec=new l,this.collisionCategory=1,this.collisionMask=1,this.setTilesets(s),this.setAlpha(this.layer.alpha),this.setPosition(n,r),this.setOrigin(0,0),this.setSize(e.tileWidth*this.layer.width,e.tileHeight*this.layer.height),this.initPipeline(),this.initPostPipeline(!1)},setTilesets:function(t){var e=[],i=[],s=this.tilemap;Array.isArray(t)||(t=[t]);for(var n=0;n=0&&t<4&&(this._renderOrder=t),this},calculateFacesAt:function(t,e){return a.CalculateFacesAt(t,e,this.layer),this},calculateFacesWithin:function(t,e,i,s){return a.CalculateFacesWithin(t,e,i,s,this.layer),this},createFromTiles:function(t,e,i,s,n){return a.CreateFromTiles(t,e,i,s,n,this.layer)},cull:function(t){return this.cullCallback(this.layer,t,this.culledTiles,this._renderOrder)},copy:function(t,e,i,s,n,r,o){return a.Copy(t,e,i,s,n,r,o,this.layer),this},fill:function(t,e,i,s,n,r){return a.Fill(t,e,i,s,n,r,this.layer),this},filterTiles:function(t,e,i,s,n,r,o){return a.FilterTiles(t,e,i,s,n,r,o,this.layer)},findByIndex:function(t,e,i){return a.FindByIndex(t,e,i,this.layer)},findTile:function(t,e,i,s,n,r,o){return a.FindTile(t,e,i,s,n,r,o,this.layer)},forEachTile:function(t,e,i,s,n,r,o){return a.ForEachTile(t,e,i,s,n,r,o,this.layer),this},setTint:function(t,e,i,s,n,r){return void 0===t&&(t=16777215),this.forEachTile((function(e){e.tint=t,e.tintFill=!1}),this,e,i,s,n,r)},setTintFill:function(t,e,i,s,n,r){return void 0===t&&(t=16777215),this.forEachTile((function(e){e.tint=t,e.tintFill=!0}),this,e,i,s,n,r)},getTileAt:function(t,e,i){return a.GetTileAt(t,e,i,this.layer)},getTileAtWorldXY:function(t,e,i,s){return a.GetTileAtWorldXY(t,e,i,s,this.layer)},getIsoTileAtWorldXY:function(t,e,i,s,n){void 0===i&&(i=!0);var r=this.tempVec;return a.IsometricWorldToTileXY(t,e,!0,r,n,this.layer,i),this.getTileAt(r.x,r.y,s)},getTilesWithin:function(t,e,i,s,n){return a.GetTilesWithin(t,e,i,s,n,this.layer)},getTilesWithinShape:function(t,e,i){return a.GetTilesWithinShape(t,e,i,this.layer)},getTilesWithinWorldXY:function(t,e,i,s,n,r){return a.GetTilesWithinWorldXY(t,e,i,s,n,r,this.layer)},hasTileAt:function(t,e){return a.HasTileAt(t,e,this.layer)},hasTileAtWorldXY:function(t,e,i){return a.HasTileAtWorldXY(t,e,i,this.layer)},putTileAt:function(t,e,i,s){return a.PutTileAt(t,e,i,s,this.layer)},putTileAtWorldXY:function(t,e,i,s,n){return a.PutTileAtWorldXY(t,e,i,s,n,this.layer)},putTilesAt:function(t,e,i,s){return a.PutTilesAt(t,e,i,s,this.layer),this},randomize:function(t,e,i,s,n){return a.Randomize(t,e,i,s,n,this.layer),this},removeTileAt:function(t,e,i,s){return a.RemoveTileAt(t,e,i,s,this.layer)},removeTileAtWorldXY:function(t,e,i,s,n){return a.RemoveTileAtWorldXY(t,e,i,s,n,this.layer)},renderDebug:function(t,e){return a.RenderDebug(t,e,this.layer),this},replaceByIndex:function(t,e,i,s,n,r){return a.ReplaceByIndex(t,e,i,s,n,r,this.layer),this},setSkipCull:function(t){return void 0===t&&(t=!0),this.skipCull=t,this},setCullPadding:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.cullPaddingX=t,this.cullPaddingY=e,this},setCollision:function(t,e,i,s){return a.SetCollision(t,e,i,this.layer,s),this},setCollisionBetween:function(t,e,i,s){return a.SetCollisionBetween(t,e,i,s,this.layer),this},setCollisionByProperty:function(t,e,i){return a.SetCollisionByProperty(t,e,i,this.layer),this},setCollisionByExclusion:function(t,e,i){return a.SetCollisionByExclusion(t,e,i,this.layer),this},setCollisionFromCollisionGroup:function(t,e){return a.SetCollisionFromCollisionGroup(t,e,this.layer),this},setTileIndexCallback:function(t,e,i){return a.SetTileIndexCallback(t,e,i,this.layer),this},setTileLocationCallback:function(t,e,i,s,n,r){return a.SetTileLocationCallback(t,e,i,s,n,r,this.layer),this},shuffle:function(t,e,i,s){return a.Shuffle(t,e,i,s,this.layer),this},swapByIndex:function(t,e,i,s,n,r){return a.SwapByIndex(t,e,i,s,n,r,this.layer),this},tileToWorldX:function(t,e){return this.tilemap.tileToWorldX(t,e,this)},tileToWorldY:function(t,e){return this.tilemap.tileToWorldY(t,e,this)},tileToWorldXY:function(t,e,i,s){return this.tilemap.tileToWorldXY(t,e,i,s,this)},getTileCorners:function(t,e,i){return this.tilemap.getTileCorners(t,e,i,this)},weightedRandomize:function(t,e,i,s,n){return a.WeightedRandomize(e,i,s,n,t,this.layer),this},worldToTileX:function(t,e,i){return this.tilemap.worldToTileX(t,e,i,this)},worldToTileY:function(t,e,i){return this.tilemap.worldToTileY(t,e,i,this)},worldToTileXY:function(t,e,i,s,n){return this.tilemap.worldToTileXY(t,e,i,s,n,this)},destroy:function(t){void 0===t&&(t=!0),this.tilemap&&(this.layer.tilemapLayer===this&&(this.layer.tilemapLayer=void 0),t&&this.tilemap.removeLayer(this),this.tilemap=void 0,this.layer=void 0,this.culledTiles.length=0,this.cullCallback=null,this.gidMap=[],this.tileset=[],o.prototype.destroy.call(this))}});t.exports=u},16153:(t,e,i)=>{var s=i(61340),n=new s,r=new s,o=new s;t.exports=function(t,e,i,s){var a=e.cull(i),h=a.length,l=i.alpha*e.alpha;if(!(0===h||l<=0)){var u=n,c=r,d=o;c.applyITRS(e.x,e.y,e.rotation,e.scaleX,e.scaleY),u.copyFrom(i.matrix);var f=t.currentContext,p=e.gidMap;f.save(),s?(u.multiplyWithOffset(s,-i.scrollX*e.scrollFactorX,-i.scrollY*e.scrollFactorY),c.e=e.x,c.f=e.y,u.multiply(c,d),d.copyToContext(f)):(c.e-=i.scrollX*e.scrollFactorX,c.f-=i.scrollY*e.scrollFactorY,c.copyToContext(f)),(!t.antialias||e.scaleX>1||e.scaleY>1)&&(f.imageSmoothingEnabled=!1);for(var v=0;v{var s,n;i(29747),s=i(99558),n=i(16153),t.exports={renderWebGL:s,renderCanvas:n}},99558:(t,e,i)=>{var s=i(70554);t.exports=function(t,e,i){var n=e.cull(i),r=n.length,o=i.alpha*e.alpha;if(!(0===r||o<=0)){var a=e.gidMap,h=t.pipelines.set(e.pipeline,e),l=s.getTintAppendFloatAlpha,u=e.scrollFactorX,c=e.scrollFactorY,d=e.x,f=e.y,p=e.scaleX,v=e.scaleY;t.pipelines.preBatch(e);for(var g=0;g{var s=i(83419),n=i(26099),r=new s({initialize:function(t,e,i,s,r,o,a,h,l){(void 0===i||i<=0)&&(i=32),(void 0===s||s<=0)&&(s=32),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a={}),void 0===h&&(h={}),this.name=t,this.firstgid=e,this.tileWidth=i,this.tileHeight=s,this.tileMargin=r,this.tileSpacing=o,this.tileProperties=a,this.tileData=h,this.tileOffset=new n,void 0!==l&&this.tileOffset.set(l.x,l.y),this.image=null,this.glTexture=null,this.rows=0,this.columns=0,this.total=0,this.texCoordinates=[]},getTileProperties:function(t){return this.containsTileIndex(t)?this.tileProperties[t-this.firstgid]:null},getTileData:function(t){return this.containsTileIndex(t)?this.tileData[t-this.firstgid]:null},getTileCollisionGroup:function(t){var e=this.getTileData(t);return e&&e.objectgroup?e.objectgroup:null},containsTileIndex:function(t){return t>=this.firstgid&&ti.width||e.height>i.height?this.updateTileData(e.width,e.height):this.updateTileData(i.width,i.height,i.x,i.y),this},setTileSize:function(t,e){return void 0!==t&&(this.tileWidth=t),void 0!==e&&(this.tileHeight=e),this.image&&this.updateTileData(this.image.source[0].width,this.image.source[0].height),this},setSpacing:function(t,e){return void 0!==t&&(this.tileMargin=t),void 0!==e&&(this.tileSpacing=e),this.image&&this.updateTileData(this.image.source[0].width,this.image.source[0].height),this},updateTileData:function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=0);var n=(e-2*this.tileMargin+this.tileSpacing)/(this.tileHeight+this.tileSpacing),r=(t-2*this.tileMargin+this.tileSpacing)/(this.tileWidth+this.tileSpacing);n%1==0&&r%1==0||console.warn("Image tile area not tile size multiple in: "+this.name),n=Math.floor(n),r=Math.floor(r),this.rows=n,this.columns=r,this.total=n*r,this.texCoordinates.length=0;for(var o=this.tileMargin+i,a=this.tileMargin+s,h=0;h{var s=i(7423);t.exports=function(t,e,i){var n=s(t,e,!0,i),r=s(t,e-1,!0,i),o=s(t,e+1,!0,i),a=s(t-1,e,!0,i),h=s(t+1,e,!0,i),l=n&&n.collides;return l&&(n.faceTop=!0,n.faceBottom=!0,n.faceLeft=!0,n.faceRight=!0),r&&r.collides&&(l&&(n.faceTop=!1),r.faceBottom=!l),o&&o.collides&&(l&&(n.faceBottom=!1),o.faceTop=!l),a&&a.collides&&(l&&(n.faceLeft=!1),a.faceRight=!l),h&&h.collides&&(l&&(n.faceRight=!1),h.faceLeft=!l),n&&!n.collides&&n.resetFaces(),n}},42573:(t,e,i)=>{var s=i(7423),n=i(7386);t.exports=function(t,e,i,r,o){for(var a=null,h=null,l=null,u=null,c=n(t,e,i,r,null,o),d=0;d{var s=new(i(26099));t.exports=function(t,e,i,n){var r=i.tilemapLayer,o=r.cullPaddingX,a=r.cullPaddingY,h=r.tilemap.tileToWorldXY(t,e,s,n,r);return h.x>n.worldView.x+r.scaleX*i.tileWidth*(-o-.5)&&h.xn.worldView.y+r.scaleY*i.tileHeight*(-a-1)&&h.y{var s=i(42573),n=i(7386),r=i(62991),o=i(23029);t.exports=function(t,e,i,a,h,l,u,c){void 0===u&&(u=!0);var d=n(t,e,i,a,null,c),f=[];d.forEach((function(t){var e=new o(t.layer,t.index,t.x,t.y,t.width,t.height,t.baseWidth,t.baseHeight);e.copy(t),f.push(e)}));for(var p=h-t,v=l-e,g=0;g{var s=i(62644),n=i(7386),r=i(27987);t.exports=function(t,e,i,o,a,h){i||(i={}),Array.isArray(t)||(t=[t]);var l=h.tilemapLayer;o||(o=l.scene),a||(a=o.cameras.main);var u,c=h.width,d=h.height,f=n(0,0,c,d,null,h),p=[],v=function(t,e,i){for(var s=0;s{var s=i(87841),n=i(63448),r=i(56583),o=new s;t.exports=function(t,e){var i=t.tilemapLayer.tilemap,s=t.tilemapLayer,a=Math.floor(i.tileWidth*s.scaleX),h=Math.floor(i.tileHeight*s.scaleY),l=r(e.worldView.x-s.x,a,0,!0)-s.cullPaddingX,u=n(e.worldView.right-s.x,a,0,!0)+s.cullPaddingX,c=r(e.worldView.y-s.y,h,0,!0)-s.cullPaddingY,d=n(e.worldView.bottom-s.y,h,0,!0)+s.cullPaddingY;return o.setTo(l,c,u-l,d-c)}},30003:(t,e,i)=>{var s=i(19545),n=i(32483);t.exports=function(t,e,i,r){void 0===i&&(i=[]),void 0===r&&(r=0),i.length=0;var o=t.tilemapLayer,a=s(t,e);return(o.skipCull||1!==o.scrollFactorX||1!==o.scrollFactorY)&&(a.left=0,a.right=t.width,a.top=0,a.bottom=t.height),n(t,a,r,i),i}},35137:(t,e,i)=>{var s=i(7386),n=i(42573),r=i(20576);t.exports=function(t,e,i,o,a,h,l){for(var u=-1!==l.collideIndexes.indexOf(t),c=s(e,i,o,a,null,l),d=0;d{var s=i(7386);t.exports=function(t,e,i,n,r,o,a,h){return s(i,n,r,o,a,h).filter(t,e)}},52692:t=>{t.exports=function(t,e,i,s){void 0===e&&(e=0),void 0===i&&(i=!1);var n,r,o,a=0;if(i){for(r=s.height-1;r>=0;r--)for(n=s.width-1;n>=0;n--)if((o=s.data[r][n])&&o.index===t){if(a===e)return o;a+=1}}else for(r=0;r{var s=i(7386);t.exports=function(t,e,i,n,r,o,a,h){return s(i,n,r,o,a,h).find(t,e)||null}},97560:(t,e,i)=>{var s=i(7386);t.exports=function(t,e,i,n,r,o,a,h){s(i,n,r,o,a,h).forEach(t,e)}},43305:(t,e,i)=>{var s=i(91907),n=i(30003),r=i(9474),o=i(14018),a=i(29747),h=i(54503);t.exports=function(t){return t===s.ORTHOGONAL?n:t===s.HEXAGONAL?r:t===s.STAGGERED?h:t===s.ISOMETRIC?o:a}},7423:(t,e,i)=>{var s=i(62991);t.exports=function(t,e,i,n){if(void 0===i&&(i=!1),s(t,e,n)){var r=n.data[e][t]||null;return r?-1===r.index?i?r:null:r:null}return null}},60540:(t,e,i)=>{var s=i(7423),n=new(i(26099));t.exports=function(t,e,i,r,o){return o.tilemapLayer.worldToTileXY(t,e,!0,n,r),s(n.x,n.y,i,o)}},55826:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n){var r=n.baseTileWidth,o=n.baseTileHeight,a=n.tilemapLayer,h=0,l=0;a&&(i||(i=a.scene.cameras.main),h=a.x+i.scrollX*(1-a.scrollFactorX),l=a.y+i.scrollY*(1-a.scrollFactorY),r*=a.scaleX,o*=a.scaleY);var u=h+t*r,c=l+e*o;return[new s(u,c),new s(u+r,c),new s(u+r,c+o),new s(u,c+o)]}},11758:(t,e,i)=>{var s=i(91907),n=i(27229),r=i(29747),o=i(55826);t.exports=function(t){return t===s.ORTHOGONAL?o:t===s.ISOMETRIC?r:t===s.HEXAGONAL?n:(s.STAGGERED,r)}},39167:(t,e,i)=>{var s=i(91907),n=i(29747),r=i(97281);t.exports=function(t){return t===s.ORTHOGONAL?r:n}},62e3:(t,e,i)=>{var s=i(91907),n=i(19951),r=i(14127),o=i(29747),a=i(97202),h=i(70326);t.exports=function(t){return t===s.ORTHOGONAL?h:t===s.ISOMETRIC?r:t===s.HEXAGONAL?n:t===s.STAGGERED?a:o}},5984:(t,e,i)=>{var s=i(91907),n=i(29747),r=i(28054),o=i(29650);t.exports=function(t){return t===s.ORTHOGONAL?o:t===s.STAGGERED?r:n}},7386:(t,e,i)=>{var s=i(95540);t.exports=function(t,e,i,n,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=o.width),void 0===n&&(n=o.height),r||(r={});var a=s(r,"isNotEmpty",!1),h=s(r,"isColliding",!1),l=s(r,"hasInterestingFace",!1);t<0&&(i+=t,t=0),e<0&&(n+=e,e=0),t+i>o.width&&(i=Math.max(o.width-t,0)),e+n>o.height&&(n=Math.max(o.height-e,0));for(var u=[],c=e;c{var s=i(55738),n=i(7386),r=i(91865),o=i(29747),a=i(26099),h=function(t,e){return r.RectangleToTriangle(e,t)},l=new a,u=new a,c=new a;t.exports=function(t,e,i,a){if(void 0===t)return[];var d=o;t instanceof s.Circle?d=r.CircleToRectangle:t instanceof s.Rectangle?d=r.RectangleToRectangle:t instanceof s.Triangle?d=h:t instanceof s.Line&&(d=r.LineToRectangle),a.tilemapLayer.worldToTileXY(t.left,t.top,!0,u,i);var f=u.x,p=u.y;a.tilemapLayer.worldToTileXY(t.right,t.bottom,!1,c,i);var v=Math.ceil(c.x),g=Math.ceil(c.y),m=Math.max(v-f,1),y=Math.max(g-p,1),x=n(f,p,m,y,e,a),T=a.tileWidth,w=a.tileHeight;a.tilemapLayer&&(T*=a.tilemapLayer.scaleX,w*=a.tilemapLayer.scaleY);for(var b=[],S=new s.Rectangle(0,0,T,w),E=0;E{var s=i(7386),n=i(26099),r=new n,o=new n;t.exports=function(t,e,i,n,a,h,l){var u=l.tilemapLayer.tilemap._convert.WorldToTileXY;u(t,e,!0,r,h,l);var c=r.x,d=r.y;u(t+i,e+n,!1,o,h,l);var f=Math.ceil(o.x),p=Math.ceil(o.y);return s(c,d,f-c,p-d,a,l)}},96113:(t,e,i)=>{var s=i(91907),n=i(20242),r=i(10095);t.exports=function(t){return t===s.ORTHOGONAL?r:n}},16926:(t,e,i)=>{var s=i(91907),n=i(86625),r=i(96897),o=i(29747),a=i(15108),h=i(85896);t.exports=function(t){return t===s.ORTHOGONAL?h:t===s.ISOMETRIC?r:t===s.HEXAGONAL?n:t===s.STAGGERED?a:o}},55762:(t,e,i)=>{var s=i(91907),n=i(20242),r=i(51900),o=i(63288);t.exports=function(t){return t===s.ORTHOGONAL?o:t===s.STAGGERED?r:n}},45091:(t,e,i)=>{var s=i(62991);t.exports=function(t,e,i){if(s(t,e,i)){var n=i.data[e][t];return null!==n&&n.index>-1}return!1}},24152:(t,e,i)=>{var s=i(45091),n=new(i(26099));t.exports=function(t,e,i,r){r.tilemapLayer.worldToTileXY(t,e,!0,n,i);var o=n.x,a=n.y;return s(o,a,r)}},90454:(t,e,i)=>{var s=i(63448),n=i(56583);t.exports=function(t,e){var i,r,o,a,h=t.tilemapLayer.tilemap,l=t.tilemapLayer,u=Math.floor(h.tileWidth*l.scaleX),c=Math.floor(h.tileHeight*l.scaleY),d=t.hexSideLength;if("y"===t.staggerAxis){var f=(c-d)/2+d;i=n(e.worldView.x-l.x,u,0,!0)-l.cullPaddingX,r=s(e.worldView.right-l.x,u,0,!0)+l.cullPaddingX,o=n(e.worldView.y-l.y,f,0,!0)-l.cullPaddingY,a=s(e.worldView.bottom-l.y,f,0,!0)+l.cullPaddingY}else{var p=(u-d)/2+d;i=n(e.worldView.x-l.x,p,0,!0)-l.cullPaddingX,r=s(e.worldView.right-l.x,p,0,!0)+l.cullPaddingX,o=n(e.worldView.y-l.y,c,0,!0)-l.cullPaddingY,a=s(e.worldView.bottom-l.y,c,0,!0)+l.cullPaddingY}return{left:i,right:r,top:o,bottom:a}}},9474:(t,e,i)=>{var s=i(90454),n=i(32483);t.exports=function(t,e,i,r){void 0===i&&(i=[]),void 0===r&&(r=0),i.length=0;var o=t.tilemapLayer,a=s(t,e);return o.skipCull&&1===o.scrollFactorX&&1===o.scrollFactorY&&(a.left=0,a.right=t.width,a.top=0,a.bottom=t.height),n(t,a,r,i),i}},27229:(t,e,i)=>{var s=i(19951),n=i(26099),r=new n;t.exports=function(t,e,i,o){var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(a*=l.scaleX,h*=l.scaleY);var u,c,d=s(t,e,r,i,o),f=[],p=.5773502691896257;"y"===o.staggerAxis?(u=p*a,c=h/2):(u=a/2,c=p*h);for(var v=0;v<6;v++){var g=2*Math.PI*(.5-v)/6;f.push(new n(d.x+u*Math.cos(g),d.y+c*Math.sin(g)))}return f}},19951:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r){i||(i=new s);var o=r.baseTileWidth,a=r.baseTileHeight,h=r.tilemapLayer,l=0,u=0;h&&(n||(n=h.scene.cameras.main),l=h.x+n.scrollX*(1-h.scrollFactorX),u=h.y+n.scrollY*(1-h.scrollFactorY),o*=h.scaleX,a*=h.scaleY);var c,d,f=o/2,p=a/2;return"y"===r.staggerAxis?(c=l+o*t+o,d=u+1.5*e*p+p,e%2==0&&("odd"===this.staggerIndex?c-=f:c+=f)):"x"===this.staggerAxis&&"odd"===this.staggerIndex&&(c=l+1.5*t*f+f,d=u+a*t+a,t%2==0&&("odd"===this.staggerIndex?d-=p:d+=p)),i.set(c,d)}},86625:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r,o){n||(n=new s);var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(r||(r=l.scene.cameras.main),t-=l.x+r.scrollX*(1-l.scrollFactorX),e-=l.y+r.scrollY*(1-l.scrollFactorY),a*=l.scaleX,h*=l.scaleY);var u,c,d,f,p,v=.5773502691896257,g=-.3333333333333333,m=.6666666666666666,y=a/2,x=h/2;"y"===o.staggerAxis?(d=v*(u=(t-y)/(v*a))+g*(c=(e-x)/x),f=0*u+m*c):(d=g*(u=(t-y)/y)+v*(c=(e-x)/(v*h)),f=m*u+0*c),p=-d-f;var T,w=Math.round(d),b=Math.round(f),S=Math.round(p),E=Math.abs(w-d),A=Math.abs(b-f),C=Math.abs(S-p);E>A&&E>C?w=-b-S:A>C&&(b=-w-S);var _=b;return T="odd"===o.staggerIndex?_%2==0?b/2+w:b/2+w-.5:_%2==0?b/2+w:b/2+w+.5,n.set(T,_)}},62991:t=>{t.exports=function(t,e,i){return t>=0&&t=0&&e{var s=i(33528);t.exports=function(t,e,i,n){void 0===i&&(i=[]),void 0===n&&(n=0),i.length=0;var r,o,a,h=t.tilemapLayer,l=t.data,u=t.width,c=t.height,d=h.skipCull,f=u,p=c;if(0===n)for(o=0;o=0;r--)(a=l[o][r])&&-1!==a.index&&a.visible&&0!==a.alpha&&(d||s(r,o,t,e))&&i.push(a);else if(2===n)for(o=p;o>=0;o--)for(r=0;r=0;o--)for(r=f;r>=0;r--)(a=l[o][r])&&-1!==a.index&&a.visible&&0!==a.alpha&&(d||s(r,o,t,e))&&i.push(a);return h.tilesDrawn=i.length,h.tilesTotal=u*c,i}},14127:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r){i||(i=new s);var o=r.baseTileWidth,a=r.baseTileHeight,h=r.tilemapLayer,l=0,u=0;h&&(n||(n=h.scene.cameras.main),l=h.x+n.scrollX*(1-h.scrollFactorX),o*=h.scaleX,u=h.y+n.scrollY*(1-h.scrollFactorY),a*=h.scaleY);var c=l+o/2*(t-e),d=u+(t+e)*(a/2);return i.set(c,d)}},96897:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r,o,a){n||(n=new s);var h=o.baseTileWidth,l=o.baseTileHeight,u=o.tilemapLayer;u&&(r||(r=u.scene.cameras.main),e-=u.y+r.scrollY*(1-u.scrollFactorY),l*=u.scaleY,t-=u.x+r.scrollX*(1-u.scrollFactorX),h*=u.scaleX);var c=h/2,d=l/2;a||(e-=l);var f=.5*((t-=c)/c+e/d),p=.5*(-t/c+e/d);return i&&(f=Math.floor(f),p=Math.floor(p)),n.set(f,p)}},71558:(t,e,i)=>{var s=i(23029),n=i(62991),r=i(72023),o=i(20576);t.exports=function(t,e,i,a,h){if(void 0===a&&(a=!0),!n(e,i,h))return null;var l,u=h.data[i][e],c=u&&u.collides;t instanceof s?(null===h.data[i][e]&&(h.data[i][e]=new s(h,t.index,e,i,h.tileWidth,h.tileHeight)),h.data[i][e].copy(t)):(l=t,null===h.data[i][e]?h.data[i][e]=new s(h,l,e,i,h.tileWidth,h.tileHeight):h.data[i][e].index=l);var d=h.data[i][e],f=-1!==h.collideIndexes.indexOf(d.index);if(-1===(l=t instanceof s?t.index:t))d.width=h.tileWidth,d.height=h.tileHeight;else{var p=h.tilemapLayer.tilemap,v=p.tiles[l][2],g=p.tilesets[v];d.width=g.tileWidth,d.height=g.tileHeight}return o(d,f),a&&c!==d.collides&&r(e,i,h),d}},26303:(t,e,i)=>{var s=i(71558),n=new(i(26099));t.exports=function(t,e,i,r,o,a){return a.tilemapLayer.worldToTileXY(e,i,!0,n,o,a),s(t,n.x,n.y,r,a)}},14051:(t,e,i)=>{var s=i(42573),n=i(71558);t.exports=function(t,e,i,r,o){if(void 0===r&&(r=!0),!Array.isArray(t))return null;Array.isArray(t[0])||(t=[t]);for(var a=t.length,h=t[0].length,l=0;l{var s=i(7386),n=i(26546);t.exports=function(t,e,i,r,o,a){var h,l=s(t,e,i,r,{},a);if(!o)for(o=[],h=0;h{var s=i(23029),n=i(62991),r=i(72023);t.exports=function(t,e,i,o,a){if(void 0===i&&(i=!0),void 0===o&&(o=!0),!n(t,e,a))return null;var h=a.data[e][t];return h?(a.data[e][t]=i?null:new s(a,-1,t,e,a.tileWidth,a.tileHeight),o&&h&&h.collides&&r(t,e,a),h):null}},94178:(t,e,i)=>{var s=i(63557),n=new(i(26099));t.exports=function(t,e,i,r,o,a){return a.tilemapLayer.worldToTileXY(t,e,!0,n,o,a),s(n.x,n.y,i,r,a)}},15533:(t,e,i)=>{var s=i(7386),n=i(3956),r=new n(105,210,231,150),o=new n(243,134,48,200),a=new n(40,39,37,150);t.exports=function(t,e,i){void 0===e&&(e={});var n=void 0!==e.tileColor?e.tileColor:r,h=void 0!==e.collidingTileColor?e.collidingTileColor:o,l=void 0!==e.faceColor?e.faceColor:a,u=s(0,0,i.width,i.height,null,i);t.translateCanvas(i.tilemapLayer.x,i.tilemapLayer.y),t.scaleCanvas(i.tilemapLayer.scaleX,i.tilemapLayer.scaleY);for(var c=0;c{var s=i(7386);t.exports=function(t,e,i,n,r,o,a){for(var h=s(i,n,r,o,null,a),l=0;l{t.exports=function(t,e,i,s){var n,r,o,a=t.data,h=t.width,l=t.height,u=t.tilemapLayer,c=Math.max(0,e.left),d=Math.min(h,e.right),f=Math.max(0,e.top),p=Math.min(l,e.bottom);if(0===i)for(r=f;r=c;n--)(o=a[r][n])&&-1!==o.index&&o.visible&&0!==o.alpha&&s.push(o);else if(2===i)for(r=p;r>=f;r--)for(n=c;a[r]&&n=f;r--)for(n=d;a[r]&&n>=c;n--)(o=a[r][n])&&-1!==o.index&&o.visible&&0!==o.alpha&&s.push(o);return u.tilesDrawn=s.length,u.tilesTotal=h*l,s}},57068:(t,e,i)=>{var s=i(20576),n=i(42573),r=i(9589);t.exports=function(t,e,i,o,a){void 0===e&&(e=!0),void 0===i&&(i=!0),void 0===a&&(a=!0),Array.isArray(t)||(t=[t]);for(var h=0;h{var s=i(20576),n=i(42573),r=i(9589);t.exports=function(t,e,i,o,a,h){if(void 0===i&&(i=!0),void 0===o&&(o=!0),void 0===h&&(h=!0),!(t>e)){for(var l=t;l<=e;l++)r(l,i,a);if(h)for(var u=0;u=t&&d.index<=e&&s(d,i)}o&&n(0,0,a.width,a.height,a)}}},75661:(t,e,i)=>{var s=i(20576),n=i(42573),r=i(9589);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var a=0;a{var s=i(20576),n=i(42573),r=i(97022);t.exports=function(t,e,i,o){void 0===e&&(e=!0),void 0===i&&(i=!0);for(var a=0;a{var s=i(20576),n=i(42573);t.exports=function(t,e,i){void 0===t&&(t=!0),void 0===e&&(e=!0);for(var r=0;r0&&s(a,t)}}e&&n(0,0,i.width,i.height,i)}},9589:t=>{t.exports=function(t,e,i){var s=i.collideIndexes.indexOf(t);e&&-1===s?i.collideIndexes.push(t):e||-1===s||i.collideIndexes.splice(s,1)}},20576:t=>{t.exports=function(t,e){e?t.setCollision(!0,!0,!0,!0,!1):t.resetCollision(!1)}},79583:t=>{t.exports=function(t,e,i,s){if("number"==typeof t)s.callbacks[t]=null!==e?{callback:e,callbackContext:i}:void 0;else for(var n=0,r=t.length;n{var s=i(7386);t.exports=function(t,e,i,n,r,o,a){for(var h=s(t,e,i,n,null,a),l=0;l{var s=i(7386),n=i(33680);t.exports=function(t,e,i,r,o){var a=s(t,e,i,r,null,o),h=a.map((function(t){return t.index}));n(h);for(var l=0;l{var s=i(63448),n=i(56583);t.exports=function(t,e){var i=t.tilemapLayer.tilemap,r=t.tilemapLayer,o=Math.floor(i.tileWidth*r.scaleX),a=Math.floor(i.tileHeight*r.scaleY);return{left:n(e.worldView.x-r.x,o,0,!0)-r.cullPaddingX,right:s(e.worldView.right-r.x,o,0,!0)+r.cullPaddingX,top:n(e.worldView.y-r.y,a/2,0,!0)-r.cullPaddingY,bottom:s(e.worldView.bottom-r.y,a/2,0,!0)+r.cullPaddingY}}},54503:(t,e,i)=>{var s=i(61325),n=i(32483);t.exports=function(t,e,i,r){void 0===i&&(i=[]),void 0===r&&(r=0),i.length=0;var o=t.tilemapLayer,a=s(t,e);return o.skipCull&&1===o.scrollFactorX&&1===o.scrollFactorY&&(a.left=0,a.right=t.width,a.top=0,a.bottom=t.height),n(t,a,r,i),i}},97202:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r){i||(i=new s);var o=r.baseTileWidth,a=r.baseTileHeight,h=r.tilemapLayer,l=0,u=0;h&&(n||(n=h.scene.cameras.main),l=h.x+n.scrollX*(1-h.scrollFactorX),o*=h.scaleX,u=h.y+n.scrollY*(1-h.scrollFactorY),a*=h.scaleY);var c=l+t*o+e%2*(o/2),d=u+e*(a/2);return i.set(c,d)}},28054:t=>{t.exports=function(t,e,i){var s=i.baseTileHeight,n=i.tilemapLayer,r=0;return n&&(void 0===e&&(e=n.scene.cameras.main),r=n.y+e.scrollY*(1-n.scrollFactorY),s*=n.scaleY),r+t*(s/2)+s}},15108:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r,o){n||(n=new s);var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(r||(r=l.scene.cameras.main),e-=l.y+r.scrollY*(1-l.scrollFactorY),h*=l.scaleY,t-=l.x+r.scrollX*(1-l.scrollFactorX),a*=l.scaleX);var u=i?Math.floor(e/(h/2)):e/(h/2),c=i?Math.floor((t+u%2*.5*a)/a):(t+u%2*.5*a)/a;return n.set(c,u)}},51900:t=>{t.exports=function(t,e,i,s){var n=s.baseTileHeight,r=s.tilemapLayer;return r&&(i||(i=r.scene.cameras.main),t-=r.y+i.scrollY*(1-r.scrollFactorY),n*=r.scaleY),e?Math.floor(t/(n/2)):t/(n/2)}},86560:(t,e,i)=>{var s=i(7386);t.exports=function(t,e,i,n,r,o,a){for(var h=s(i,n,r,o,null,a),l=0;l{t.exports=function(t,e,i){var s=i.baseTileWidth,n=i.tilemapLayer,r=0;return n&&(e||(e=n.scene.cameras.main),r=n.x+e.scrollX*(1-n.scrollFactorX),s*=n.scaleX),r+t*s}},70326:(t,e,i)=>{var s=i(97281),n=i(29650),r=i(26099);t.exports=function(t,e,i,o,a){return i||(i=new r(0,0)),i.x=s(t,o,a),i.y=n(e,o,a),i}},29650:t=>{t.exports=function(t,e,i){var s=i.baseTileHeight,n=i.tilemapLayer,r=0;return n&&(e||(e=n.scene.cameras.main),r=n.y+e.scrollY*(1-n.scrollFactorY),s*=n.scaleY),r+t*s}},77366:(t,e,i)=>{var s=i(7386),n=i(75508);t.exports=function(t,e,i,r,o,a){if(o){var h,l=s(t,e,i,r,null,a),u=0;for(h=0;h{var s=i(85896),n=new(i(26099));t.exports=function(t,e,i,r){return s(t,0,e,n,i,r),n.x}},85896:(t,e,i)=>{var s=i(26099);t.exports=function(t,e,i,n,r,o){void 0===i&&(i=!0),n||(n=new s);var a=o.baseTileWidth,h=o.baseTileHeight,l=o.tilemapLayer;l&&(r||(r=l.scene.cameras.main),t-=l.x+r.scrollX*(1-l.scrollFactorX),e-=l.y+r.scrollY*(1-l.scrollFactorY),a*=l.scaleX,h*=l.scaleY);var u=t/a,c=e/h;return i&&(u=Math.floor(u),c=Math.floor(c)),n.set(u,c)}},63288:(t,e,i)=>{var s=i(85896),n=new(i(26099));t.exports=function(t,e,i,r){return s(0,t,e,n,i,r),n.y}},81086:(t,e,i)=>{t.exports={CalculateFacesAt:i(72023),CalculateFacesWithin:i(42573),CheckIsoBounds:i(33528),Copy:i(1785),CreateFromTiles:i(78419),CullBounds:i(19545),CullTiles:i(30003),Fill:i(35137),FilterTiles:i(40253),FindByIndex:i(52692),FindTile:i(66151),ForEachTile:i(97560),GetCullTilesFunction:i(43305),GetTileAt:i(7423),GetTileAtWorldXY:i(60540),GetTileCorners:i(55826),GetTileCornersFunction:i(11758),GetTilesWithin:i(7386),GetTilesWithinShape:i(91141),GetTilesWithinWorldXY:i(96523),GetTileToWorldXFunction:i(39167),GetTileToWorldXYFunction:i(62e3),GetTileToWorldYFunction:i(5984),GetWorldToTileXFunction:i(96113),GetWorldToTileXYFunction:i(16926),GetWorldToTileYFunction:i(55762),HasTileAt:i(45091),HasTileAtWorldXY:i(24152),HexagonalCullBounds:i(90454),HexagonalCullTiles:i(9474),HexagonalGetTileCorners:i(27229),HexagonalTileToWorldXY:i(19951),HexagonalWorldToTileXY:i(86625),IsInLayerBounds:i(62991),IsometricCullTiles:i(14018),IsometricTileToWorldXY:i(14127),IsometricWorldToTileXY:i(96897),PutTileAt:i(71558),PutTileAtWorldXY:i(26303),PutTilesAt:i(14051),Randomize:i(77389),RemoveTileAt:i(63557),RemoveTileAtWorldXY:i(94178),RenderDebug:i(15533),ReplaceByIndex:i(27987),RunCull:i(32483),SetCollision:i(57068),SetCollisionBetween:i(37266),SetCollisionByExclusion:i(75661),SetCollisionByProperty:i(64740),SetCollisionFromCollisionGroup:i(63307),SetLayerCollisionIndex:i(9589),SetTileCollision:i(20576),SetTileIndexCallback:i(79583),SetTileLocationCallback:i(93254),Shuffle:i(32903),StaggeredCullBounds:i(61325),StaggeredCullTiles:i(54503),StaggeredTileToWorldXY:i(97202),StaggeredTileToWorldY:i(28054),StaggeredWorldToTileXY:i(15108),StaggeredWorldToTileY:i(51900),SwapByIndex:i(86560),TileToWorldX:i(97281),TileToWorldXY:i(70326),TileToWorldY:i(29650),WeightedRandomize:i(77366),WorldToTileX:i(10095),WorldToTileXY:i(85896),WorldToTileY:i(63288)}},91907:t=>{t.exports={ORTHOGONAL:0,ISOMETRIC:1,STAGGERED:2,HEXAGONAL:3}},21829:(t,e,i)=>{var s={ORIENTATION:i(91907)};t.exports=s},62501:(t,e,i)=>{var s=i(79291),n=i(21829),r={Components:i(81086),Parsers:i(57442),Formats:i(80341),ImageCollection:i(16536),ParseToTilemap:i(31989),Tile:i(23029),Tilemap:i(49075),TilemapCreator:i(45939),TilemapFactory:i(46029),Tileset:i(33629),TilemapLayer:i(20442),Orientation:i(91907),LayerData:i(14977),MapData:i(87010),ObjectLayer:i(48700)};r=s(!1,r,n.ORIENTATION),t.exports=r},14977:(t,e,i)=>{var s=i(83419),n=i(91907),r=i(95540),o=new s({initialize:function(t){void 0===t&&(t={}),this.name=r(t,"name","layer"),this.id=r(t,"id",0),this.x=r(t,"x",0),this.y=r(t,"y",0),this.width=r(t,"width",0),this.height=r(t,"height",0),this.tileWidth=r(t,"tileWidth",0),this.tileHeight=r(t,"tileHeight",0),this.baseTileWidth=r(t,"baseTileWidth",this.tileWidth),this.baseTileHeight=r(t,"baseTileHeight",this.tileHeight),this.orientation=r(t,"orientation",n.ORTHOGONAL),this.widthInPixels=r(t,"widthInPixels",this.width*this.baseTileWidth),this.heightInPixels=r(t,"heightInPixels",this.height*this.baseTileHeight),this.alpha=r(t,"alpha",1),this.visible=r(t,"visible",!0),this.properties=r(t,"properties",[]),this.indexes=r(t,"indexes",[]),this.collideIndexes=r(t,"collideIndexes",[]),this.callbacks=r(t,"callbacks",[]),this.bodies=r(t,"bodies",[]),this.data=r(t,"data",[]),this.tilemapLayer=r(t,"tilemapLayer",null),this.hexSideLength=r(t,"hexSideLength",0),this.staggerAxis=r(t,"staggerAxis","y"),this.staggerIndex=r(t,"staggerIndex","odd")}});t.exports=o},87010:(t,e,i)=>{var s=i(83419),n=i(91907),r=i(95540),o=new s({initialize:function(t){void 0===t&&(t={}),this.name=r(t,"name","map"),this.width=r(t,"width",0),this.height=r(t,"height",0),this.infinite=r(t,"infinite",!1),this.tileWidth=r(t,"tileWidth",0),this.tileHeight=r(t,"tileHeight",0),this.widthInPixels=r(t,"widthInPixels",this.width*this.tileWidth),this.heightInPixels=r(t,"heightInPixels",this.height*this.tileHeight),this.format=r(t,"format",null),this.orientation=r(t,"orientation",n.ORTHOGONAL),this.renderOrder=r(t,"renderOrder","right-down"),this.version=r(t,"version","1"),this.properties=r(t,"properties",{}),this.layers=r(t,"layers",[]),this.images=r(t,"images",[]),this.objects=r(t,"objects",[]),Array.isArray(this.objects)||(this.objects=[]),this.collision=r(t,"collision",{}),this.tilesets=r(t,"tilesets",[]),this.imageCollections=r(t,"imageCollections",[]),this.tiles=r(t,"tiles",[]),this.hexSideLength=r(t,"hexSideLength",0),this.staggerAxis=r(t,"staggerAxis","y"),this.staggerIndex=r(t,"staggerIndex","odd")}});t.exports=o},48700:(t,e,i)=>{var s=i(83419),n=i(95540),r=new s({initialize:function(t){void 0===t&&(t={}),this.name=n(t,"name","object layer"),this.id=n(t,"id",0),this.opacity=n(t,"opacity",1),this.properties=n(t,"properties",{}),this.propertyTypes=n(t,"propertytypes",{}),this.type=n(t,"type","objectgroup"),this.visible=n(t,"visible",!0),this.objects=n(t,"objects",[]),Array.isArray(this.objects)||(this.objects=[])}});t.exports=r},6641:(t,e,i)=>{var s=i(91907);t.exports=function(t){return"isometric"===(t=t.toLowerCase())?s.ISOMETRIC:"staggered"===t?s.STAGGERED:"hexagonal"===t?s.HEXAGONAL:s.ORTHOGONAL}},46177:(t,e,i)=>{var s=i(80341),n=i(2342),r=i(82593),o=i(46594),a=i(87021);t.exports=function(t,e,i,h,l,u){var c;switch(e){case s.ARRAY_2D:c=n(t,i,h,l,u);break;case s.CSV:c=r(t,i,h,l,u);break;case s.TILED_JSON:c=o(t,i,u);break;case s.WELTMEISTER:c=a(t,i,u);break;default:console.warn("Unrecognized tilemap data format: "+e),c=null}return c}},2342:(t,e,i)=>{var s=i(80341),n=i(14977),r=i(87010),o=i(23029);t.exports=function(t,e,i,a,h){for(var l=new n({tileWidth:i,tileHeight:a}),u=new r({name:t,tileWidth:i,tileHeight:a,format:s.ARRAY_2D,layers:[l]}),c=[],d=e.length,f=0,p=0;p{var s=i(80341),n=i(2342);t.exports=function(t,e,i,r,o){var a=e.trim().split("\n").map((function(t){return t.split(",")})),h=n(t,a,i,r,o);return h.format=s.CSV,h}},6656:(t,e,i)=>{var s=i(14977),n=i(23029);t.exports=function(t,e){for(var i=[],r=0;r-1?new n(a,f,c,u,o.tilesize,o.tilesize):e?null:new n(a,-1,c,u,o.tilesize,o.tilesize),h.push(d)}l.push(h),h=[]}a.data=l,i.push(a)}return i}},96483:(t,e,i)=>{var s=i(33629);t.exports=function(t){for(var e=[],i=[],n=0;n{var s=i(80341),n=i(87010),r=i(6656),o=i(96483);t.exports=function(t,e,i){if(0===e.layer.length)return console.warn("No layers found in the Weltmeister map: "+t),null;for(var a=0,h=0,l=0;la&&(a=e.layer[l].width),e.layer[l].height>h&&(h=e.layer[l].height);var u=new n({width:a,height:h,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:s.WELTMEISTER});return u.layers=r(e,i),u.tilesets=o(e),u}},52833:(t,e,i)=>{t.exports={ParseTileLayers:i(6656),ParseTilesets:i(96483),ParseWeltmeister:i(87021)}},57442:(t,e,i)=>{t.exports={FromOrientationString:i(6641),Parse:i(46177),Parse2DArray:i(2342),ParseCSV:i(82593),Impact:i(52833),Tiled:i(96761)}},51233:(t,e,i)=>{var s=i(79291);t.exports=function(t){for(var e,i,n,r,o,a=0;a{t.exports=function(t){for(var e=window.atob(t),i=e.length,s=new Array(i/4),n=0;n>>0;return s}},84101:(t,e,i)=>{var s=i(33629);t.exports=function(t){var e,i,n=[];for(e=0;e{var s=i(95540);t.exports=function(t,e,i){if(!e)return{i:0,layers:t.layers,name:"",opacity:1,visible:!0,x:0,y:0};var n=e.x+s(e,"startx",0)*t.tilewidth+s(e,"offsetx",0),r=e.y+s(e,"starty",0)*t.tileheight+s(e,"offsety",0);return{i:0,layers:e.layers,name:i.name+e.name+"/",opacity:i.opacity*e.opacity,visible:i.visible&&e.visible,x:i.x+n,y:i.y+r}}},29920:t=>{t.exports=function(t){var e=Boolean(2147483648&t),i=Boolean(1073741824&t),s=Boolean(536870912&t);t&=536870911;var n=0,r=!1;return e&&i&&s?(n=Math.PI/2,r=!0):e&&i&&!s?(n=Math.PI,r=!1):e&&!i&&s?(n=Math.PI/2,r=!1):!e||i||s?!e&&i&&s?(n=3*Math.PI/2,r=!1):e||!i||s?e||i||!s?e||i||s||(n=0,r=!1):(n=3*Math.PI/2,r=!0):(n=Math.PI,r=!0):(n=0,r=!0),{gid:t,flippedHorizontal:e,flippedVertical:i,flippedAntiDiagonal:s,rotation:n,flipped:r}}},12635:(t,e,i)=>{var s=i(95540),n=i(79677);t.exports=function(t){for(var e=[],i=[],r=n(t);r.i0;)if(r.i>=r.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}r=i.pop()}else{var o=r.layers[r.i];if(r.i++,"imagelayer"===o.type){var a=s(o,"offsetx",0)+s(o,"startx",0),h=s(o,"offsety",0)+s(o,"starty",0);e.push({name:r.name+o.name,image:o.image,x:r.x+a+o.x,y:r.y+h+o.y,alpha:r.opacity*o.opacity,visible:r.visible&&o.visible,properties:s(o,"properties",{})})}else if("group"===o.type){var l=n(t,o,r);i.push(r),r=l}}return e}},46594:(t,e,i)=>{var s=i(51233),n=i(84101),r=i(91907),o=i(62644),a=i(80341),h=i(6641),l=i(87010),u=i(12635),c=i(22611),d=i(28200),f=i(24619);t.exports=function(t,e,i){var p=o(e),v=new l({width:p.width,height:p.height,name:t,tileWidth:p.tilewidth,tileHeight:p.tileheight,orientation:h(p.orientation),format:a.TILED_JSON,version:p.version,properties:p.properties,renderOrder:p.renderorder,infinite:p.infinite});v.orientation===r.HEXAGONAL&&(v.hexSideLength=p.hexsidelength,v.staggerAxis=p.staggeraxis,v.staggerIndex=p.staggerindex),v.layers=d(p,i),v.images=u(p);var g=f(p);return v.tilesets=g.tilesets,v.imageCollections=g.imageCollections,v.objects=c(p),v.tiles=n(v),s(v),v}},52205:(t,e,i)=>{var s=i(18254),n=i(29920),r=function(t){return{x:t.x,y:t.y}},o=["id","name","type","rotation","properties","visible","x","y","width","height"];t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0);var a=s(t,o);if(a.x+=e,a.y+=i,t.gid){var h=n(t.gid);a.gid=h.gid,a.flippedHorizontal=h.flippedHorizontal,a.flippedVertical=h.flippedVertical,a.flippedAntiDiagonal=h.flippedAntiDiagonal}else t.polyline?a.polyline=t.polyline.map(r):t.polygon?a.polygon=t.polygon.map(r):t.ellipse?a.ellipse=t.ellipse:t.text?a.text=t.text:t.point?a.point=!0:a.rectangle=!0;return a}},22611:(t,e,i)=>{var s=i(95540),n=i(52205),r=i(48700),o=i(79677);t.exports=function(t){for(var e=[],i=[],a=o(t);a.i0;)if(a.i>=a.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}a=i.pop()}else{var h=a.layers[a.i];if(a.i++,h.opacity*=a.opacity,h.visible=a.visible&&h.visible,"objectgroup"===h.type){h.name=a.name+h.name;for(var l=a.x+s(h,"startx",0)+s(h,"offsetx",0),u=a.y+s(h,"starty",0)+s(h,"offsety",0),c=[],d=0;d{var s=i(41868),n=i(91907),r=i(79677),o=i(6641),a=i(95540),h=i(14977),l=i(29920),u=i(23029);t.exports=function(t,e){for(var i=a(t,"infinite",!1),c=[],d=[],f=r(t);f.i0;)if(f.i>=f.layers.length){if(d.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}f=d.pop()}else{var p=f.layers[f.i];if(f.i++,"tilelayer"===p.type)if(p.compression)console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+p.name+"'");else{if(p.encoding&&"base64"===p.encoding){if(p.chunks)for(var v=0;v0?((y=new u(g,m.gid,O,F,t.tilewidth,t.tileheight)).rotation=m.rotation,y.flipX=m.flipped,T[F][O]=y):(x=e?null:new u(g,-1,O,F,t.tilewidth,t.tileheight),T[F][O]=x),++w===C.width&&(P++,w=0)}}else{(g=new h({name:f.name+p.name,id:p.id,x:f.x+a(p,"offsetx",0)+p.x,y:f.y+a(p,"offsety",0)+p.y,width:p.width,height:p.height,tileWidth:t.tilewidth,tileHeight:t.tileheight,alpha:f.opacity*p.opacity,visible:f.visible&&p.visible,properties:a(p,"properties",[]),orientation:o(t.orientation)})).orientation===n.HEXAGONAL&&(g.hexSideLength=t.hexsidelength,g.staggerAxis=t.staggeraxis,g.staggerIndex=t.staggerindex);for(var D=[],k=0,I=p.data.length;k0?((y=new u(g,m.gid,w,T.length,t.tilewidth,t.tileheight)).rotation=m.rotation,y.flipX=m.flipped,D.push(y)):(x=e?null:new u(g,-1,w,T.length,t.tilewidth,t.tileheight),D.push(x)),++w===p.width&&(T.push(D),w=0,D=[])}g.data=T,c.push(g)}else if("group"===p.type){var B=r(t,p,f);d.push(f),f=B}}return c}},24619:(t,e,i)=>{var s=i(33629),n=i(16536),r=i(52205),o=i(57880);t.exports=function(t){for(var e,i=[],a=[],h=null,l=0;l1){var d=void 0,f=void 0;if(Array.isArray(u.tiles)){d=d||{},f=f||{};for(var p=0;p{t.exports=function(t,e){for(var i=0;i0){var r,o,a,h={},l={};if(Array.isArray(s.edgecolors))for(r=0;r{t.exports={AssignTileProperties:i(51233),Base64Decode:i(41868),BuildTilesetIndex:i(84101),CreateGroupLayer:i(79677),ParseGID:i(29920),ParseImageLayers:i(12635),ParseJSONTiled:i(46594),ParseObject:i(52205),ParseObjectLayers:i(22611),ParseTileLayers:i(28200),ParseTilesets:i(24619)}},33385:(t,e,i)=>{var s=i(83419),n=i(37277),r=i(44594),o=i(94880),a=i(72905),h=new s({initialize:function(t){this.scene=t,this.systems=t.sys,this.now=0,this.startTime=0,this.timeScale=1,this.paused=!1,this._active=[],this._pendingInsertion=[],this._pendingRemoval=[],t.sys.events.once(r.BOOT,this.boot,this),t.sys.events.on(r.START,this.start,this)},boot:function(){this.now=this.systems.game.loop.time,this.systems.events.once(r.DESTROY,this.destroy,this)},start:function(){this.startTime=this.systems.game.loop.time;var t=this.systems.events;t.on(r.PRE_UPDATE,this.preUpdate,this),t.on(r.UPDATE,this.update,this),t.once(r.SHUTDOWN,this.shutdown,this)},addEvent:function(t){var e;return t instanceof o?(e=t,this.removeEvent(e),e.elapsed=e.startAt,e.hasDispatched=!1,e.repeatCount=-1===e.repeat||e.loop?999999999999:e.repeat):e=new o(t),this._pendingInsertion.push(e),e},delayedCall:function(t,e,i,s){return this.addEvent({delay:t,callback:e,args:i,callbackScope:s})},clearPendingEvents:function(){return this._pendingInsertion=[],this},removeEvent:function(t){Array.isArray(t)||(t=[t]);for(var e=0;e-1&&this._active.splice(n,1),s.destroy()}for(i=0;i=s.delay)){var n=s.elapsed-s.delay;if(s.elapsed=s.delay,!s.hasDispatched&&s.callback&&(s.hasDispatched=!0,s.callback.apply(s.callbackScope,s.args)),s.repeatCount>0){if(s.repeatCount--,n>=s.delay)for(;n>=s.delay&&s.repeatCount>0;)s.callback&&s.callback.apply(s.callbackScope,s.args),n-=s.delay,s.repeatCount--;s.elapsed=n,s.hasDispatched=!1}else s.hasDispatched&&this._pendingRemoval.push(s)}}}},shutdown:function(){var t;for(t=0;t{var s=i(83419),n=i(50792),r=i(39429),o=i(95540),a=i(44594),h=i(89809),l=new s({Extends:n,initialize:function(t,e){n.call(this),this.scene=t,this.systems=t.sys,this.elapsed=0,this.paused=!0,this.complete=!1,this.totalComplete=0,this.loop=0,this.iteration=0,this.events=[];var i=this.systems.events;i.on(a.PRE_UPDATE,this.preUpdate,this),i.on(a.UPDATE,this.update,this),i.once(a.SHUTDOWN,this.destroy,this),e&&this.add(e)},preUpdate:function(t,e){this.paused||(this.elapsed+=e)},update:function(){if(!this.paused&&!this.complete){var t,e,i=this.events,s=!1,n=this.systems;for(t=0;t=i.length&&(0!==this.loop&&(-1===this.loop||this.loop>this.iteration)?(this.iteration++,this.reset(!0)):this.complete=!0),this.complete&&this.emit(h.COMPLETE,this)}},play:function(t){return void 0===t&&(t=!0),this.paused=!1,this.complete=!1,this.totalComplete=0,t&&this.reset(),this},pause:function(){return this.paused=!0,this},repeat:function(t){return void 0!==t&&!0!==t||(t=-1),!1===t&&(t=0),this.loop=t,this},resume:function(){return this.paused=!1,this},stop:function(){return this.paused=!0,this.complete=!0,this},reset:function(t){void 0===t&&(t=!1),this.elapsed=0,t||(this.iteration=0);for(var e=0;e0&&(i=e[e.length-1].time);for(var s=0;s{var s=i(83419),n=i(95540),r=new s({initialize:function(t){this.delay=0,this.repeat=0,this.repeatCount=0,this.loop=!1,this.callback,this.callbackScope,this.args,this.timeScale=1,this.startAt=0,this.elapsed=0,this.paused=!1,this.hasDispatched=!1,this.reset(t)},reset:function(t){if(this.delay=n(t,"delay",0),this.repeat=n(t,"repeat",0),this.loop=n(t,"loop",!1),this.callback=n(t,"callback",void 0),this.callbackScope=n(t,"callbackScope",this),this.args=n(t,"args",[]),this.timeScale=n(t,"timeScale",1),this.startAt=n(t,"startAt",0),this.paused=n(t,"paused",!1),this.elapsed=this.startAt,this.hasDispatched=!1,this.repeatCount=-1===this.repeat||this.loop?999999999999:this.repeat,0===this.delay&&(this.repeat>0||this.loop))throw new Error("TimerEvent infinite loop created via zero delay");return this},getProgress:function(){return this.elapsed/this.delay},getOverallProgress:function(){if(this.repeat>0){var t=this.delay+this.delay*this.repeat;return(this.elapsed+this.delay*(this.repeat-this.repeatCount))/t}return this.getProgress()},getRepeatCount:function(){return this.repeatCount},getElapsed:function(){return this.elapsed},getElapsedSeconds:function(){return.001*this.elapsed},getRemaining:function(){return this.delay-this.elapsed},getRemainingSeconds:function(){return.001*this.getRemaining()},getOverallRemaining:function(){return this.delay*(1+this.repeatCount)-this.elapsed},getOverallRemainingSeconds:function(){return.001*this.getOverallRemaining()},remove:function(t){void 0===t&&(t=!1),this.elapsed=this.delay,this.hasDispatched=!t,this.repeatCount=0},destroy:function(){this.callback=void 0,this.callbackScope=void 0,this.args=[]}});t.exports=r},35945:t=>{t.exports="complete"},89809:(t,e,i)=>{t.exports={COMPLETE:i(35945)}},90291:(t,e,i)=>{t.exports={Clock:i(33385),Events:i(89809),Timeline:i(96120),TimerEvent:i(94880)}},40382:(t,e,i)=>{var s=i(72905),n=i(83419),r=i(43491),o=i(88032),a=i(37277),h=i(44594),l=i(93109),u=i(86081),c=i(8357),d=i(43960),f=i(26012),p=new n({initialize:function(t){this.scene=t,this.events=t.sys.events,this.timeScale=1,this.paused=!1,this.processing=!1,this.tweens=[],this.time=0,this.startTime=0,this.nextTime=0,this.prevTime=0,this.maxLag=500,this.lagSkip=33,this.gap=1e3/240,this.events.once(h.BOOT,this.boot,this),this.events.on(h.START,this.start,this)},boot:function(){this.events.once(h.DESTROY,this.destroy,this)},start:function(){this.timeScale=1,this.paused=!1,this.startTime=Date.now(),this.prevTime=this.startTime,this.nextTime=this.gap,this.events.on(h.UPDATE,this.update,this),this.events.once(h.SHUTDOWN,this.shutdown,this)},create:function(t){Array.isArray(t)||(t=[t]);for(var e=[],i=0;i-1},existing:function(t){return this.has(t)||this.tweens.push(t.reset()),this},addCounter:function(t){var e=o(this,t);return this.tweens.push(e.reset()),e},stagger:function(t,e){return l(t,e)},setLagSmooth:function(t,e){return void 0===t&&(t=1/1e-8),void 0===e&&(e=0),this.maxLag=t,this.lagSkip=Math.min(e,this.maxLag),this},setFps:function(t){return void 0===t&&(t=240),this.gap=1e3/t,this.nextTime=1e3*this.time+this.gap,this},getDelta:function(t){var e=Date.now()-this.prevTime;e>this.maxLag&&(this.startTime+=e-this.lagSkip),this.prevTime+=e;var i=this.prevTime-this.startTime,s=i-this.nextTime,n=i-1e3*this.time;return s>0||t?(i/=1e3,this.time=i,this.nextTime+=s+(s>=this.gap?4:this.gap-s)):n=0,n},tick:function(){return this.step(!0),this},update:function(){this.paused||this.step(!1)},step:function(t){void 0===t&&(t=!1);var e=this.getDelta(t);if(!(e<=0)){var i,s;this.processing=!0;var n=[],r=this.tweens;for(i=0;i0){for(i=0;i-1&&(s.isPendingRemove()||s.isDestroyed())&&(r.splice(a,1),s.destroy())}n.length=0}this.processing=!1}},remove:function(t){return this.processing?t.setPendingRemoveState():(s(this.tweens,t),t.setRemovedState()),this},reset:function(t){return this.existing(t),t.seek(),t.setActiveState(),this},makeActive:function(t){return this.existing(t),t.setActiveState(),this},each:function(t,e){var i,s=[null];for(i=1;i{t.exports=function(t,e,i){return t&&t.hasOwnProperty(e)?t[e]:i}},6113:(t,e,i)=>{var s=i(62640),n=i(35355);t.exports=function(t,e){var i=s.Power0;if("string"==typeof t)if(s.hasOwnProperty(t))i=s[t];else{var r="";if(t.indexOf(".")){var o=(r=t.substring(t.indexOf(".")+1)).toLowerCase();"in"===o?r="easeIn":"out"===o?r="easeOut":"inout"===o&&(r="easeInOut")}t=n(t.substring(0,t.indexOf(".")+1)+r),s.hasOwnProperty(t)&&(i=s[t])}else"function"==typeof t&&(i=t);if(!e)return i;var a=e.slice(0);return a.unshift(0),function(t){return a[0]=t,i.apply(this,a)}}},91389:(t,e,i)=>{var s=i(89318),n=i(77259),r={bezier:s,catmull:n,catmullrom:n,linear:i(28392)};t.exports=function(t){if(null===t)return null;var e=r.linear;return"string"==typeof t?r.hasOwnProperty(t)&&(e=r[t]):"function"==typeof t&&(e=t),e}},55292:t=>{t.exports=function(t,e,i){return t.hasOwnProperty(e)?"function"==typeof t[e]?function(i,s,n,r,o,a){return t[e](i,s,n,r,o,a)}:function(){return t[e]}:"function"==typeof i?i:function(){return i}}},82985:(t,e,i)=>{var s=i(81076);t.exports=function(t){var e,i=[];if(t.hasOwnProperty("props"))for(e in t.props)"_"!==e.substring(0,1)&&i.push({key:e,value:t.props[e]});else for(e in t)-1===s.indexOf(e)&&"_"!==e.substring(0,1)&&i.push({key:e,value:t[e]});return i}},62329:(t,e,i)=>{var s=i(35154);t.exports=function(t){var e=s(t,"targets",null);return null===e||("function"==typeof e&&(e=e.call()),Array.isArray(e)||(e=[e])),e}},17777:(t,e,i)=>{var s=i(30976),n=i(99472);function r(t){return!!t.getActive&&"function"==typeof t.getActive}function o(t){return!!t.getStart&&"function"==typeof t.getStart}function a(t){return!!t.getEnd&&"function"==typeof t.getEnd}var h=function(t,e){var i,l,u=function(t,e,i){return i},c=function(t,e,i){return i},d=null,f=typeof e;if("number"===f)u=function(){return e};else if(Array.isArray(e))c=function(){return e[0]},u=function(){return e[e.length-1]};else if("string"===f){var p=e.toLowerCase(),v="random"===p.substring(0,6),g="int"===p.substring(0,3);if(v||g){var m=p.indexOf("("),y=p.indexOf(")"),x=p.indexOf(",");if(!(m&&y&&x))throw new Error("invalid random() format");var T=parseFloat(p.substring(m+1,x)),w=parseFloat(p.substring(x+1,y));u=v?function(){return n(T,w)}:function(){return s(T,w)}}else{p=p[0];var b=parseFloat(e.substr(2));switch(p){case"+":u=function(t,e,i){return i+b};break;case"-":u=function(t,e,i){return i-b};break;case"*":u=function(t,e,i){return i*b};break;case"/":u=function(t,e,i){return i/b};break;default:u=function(){return parseFloat(e)}}}}else if("function"===f)u=e;else if("object"===f)if(o(l=e)||a(l)||r(l))r(e)&&(d=e.getActive),a(e)&&(u=e.getEnd),o(e)&&(c=e.getStart);else if(e.hasOwnProperty("value"))i=h(t,e.value);else{var S=e.hasOwnProperty("to"),E=e.hasOwnProperty("from"),A=e.hasOwnProperty("start");if(S&&(E||A)){if(i=h(t,e.to),A){var C=h(t,e.start);i.getActive=C.getEnd}if(E){var _=h(t,e.from);i.getStart=_.getEnd}}}return i||(i={getActive:d,getEnd:u,getStart:c}),i};t.exports=h},88032:(t,e,i)=>{var s=i(70402),n=i(69902),r=i(23568),o=i(57355),a=i(6113),h=i(55292),l=i(35154),u=i(17777),c=i(269),d=i(86081);t.exports=function(t,e,i){if(e instanceof d)return e.parent=t,e;i=void 0===i?n:c(n,i);var f=l(e,"from",0),p=l(e,"to",1),v=[{value:f}],g=l(e,"delay",i.delay),m=l(e,"easeParams",i.easeParams),y=l(e,"ease",i.ease),x=u("value",p),T=new d(t,v),w=T.add(0,"value",x.getEnd,x.getStart,x.getActive,a(l(e,"ease",y),l(e,"easeParams",m)),h(e,"delay",g),l(e,"duration",i.duration),o(e,"yoyo",i.yoyo),l(e,"hold",i.hold),l(e,"repeat",i.repeat),l(e,"repeatDelay",i.repeatDelay),!1,!1);w.start=f,w.current=f,T.completeDelay=r(e,"completeDelay",0),T.loop=Math.round(r(e,"loop",0)),T.loopDelay=Math.round(r(e,"loopDelay",0)),T.paused=o(e,"paused",!1),T.persist=o(e,"persist",!1),T.callbackScope=l(e,"callbackScope",T);for(var b=s.TYPES,S=0;S{var s=i(6113),n=i(35154),r=i(36383);t.exports=function(t,e){void 0===e&&(e={});var i=n(e,"start",0),o=n(e,"ease",null),a=n(e,"grid",null),h=n(e,"from",0),l="first"===h,u="center"===h,c="last"===h,d="number"==typeof h,f=Array.isArray(t),p=f?parseFloat(t[0]):parseFloat(t),v=f?parseFloat(t[1]):0,g=Math.max(p,v);if(f&&(i+=p),a){var m=a[0],y=a[1],x=0,T=0,w=0,b=0,S=[];c?(x=m-1,T=y-1):d?(x=h%m,T=Math.floor(h/m)):u&&(x=(m-1)/2,T=(y-1)/2);for(var E=r.MIN_SAFE_INTEGER,A=0;AE&&(E=_),S[A][C]=_}}}var M=o?s(o):null;return a?function(t,e,s,n){var r,o=0,a=n%m,h=Math.floor(n/m);if(a>=0&&a=0&&h{var s=i(70402),n=i(69902),r=i(23568),o=i(57355),a=i(6113),h=i(91389),l=i(55292),u=i(82985),c=i(62329),d=i(35154),f=i(17777),p=i(269),v=i(86081);t.exports=function(t,e,i){if(e instanceof v)return e.parent=t,e;i=void 0===i?n:p(n,i);var g=c(e);!g&&i.targets&&(g=i.targets);for(var m=u(e),y=d(e,"delay",i.delay),x=d(e,"duration",i.duration),T=d(e,"easeParams",i.easeParams),w=d(e,"ease",i.ease),b=d(e,"hold",i.hold),S=d(e,"repeat",i.repeat),E=d(e,"repeatDelay",i.repeatDelay),A=o(e,"yoyo",i.yoyo),C=o(e,"flipX",i.flipX),_=o(e,"flipY",i.flipY),M=d(e,"interpolation",i.interpolation),P=function(t,e,i,s){if("texture"===i){var n=s,r=void 0;Array.isArray(s)?(n=s[0],r=s[1]):s.hasOwnProperty("value")?(n=s.value,Array.isArray(s.value)?(n=s.value[0],r=s.value[1]):"string"==typeof s.value&&(n=s.value)):"string"==typeof s&&(n=s),t.addFrame(e,n,r,l(s,"delay",y),d(s,"duration",x),d(s,"hold",b),d(s,"repeat",S),d(s,"repeatDelay",E),o(s,"flipX",C),o(s,"flipY",_))}else{var u=f(i,s),c=h(d(s,"interpolation",M));t.add(e,i,u.getEnd,u.getStart,u.getActive,a(d(s,"ease",w),d(s,"easeParams",T)),l(s,"delay",y),d(s,"duration",x),o(s,"yoyo",A),d(s,"hold",b),d(s,"repeat",S),d(s,"repeatDelay",E),o(s,"flipX",C),o(s,"flipY",_),c,c?s:null)}},R=new v(t,g),L=0;L{var s=i(70402),n=i(23568),r=i(57355),o=i(62329),a=i(35154),h=i(8357),l=i(43960);t.exports=function(t,e){if(e instanceof l)return e.parent=t,e;var i,u=new l(t);u.startDelay=a(e,"delay",0),u.completeDelay=n(e,"completeDelay",0),u.loop=Math.round(n(e,"loop",a(e,"repeat",0))),u.loopDelay=Math.round(n(e,"loopDelay",a(e,"repeatDelay",0))),u.paused=r(e,"paused",!1),u.persist=r(e,"persist",!1),u.callbackScope=a(e,"callbackScope",u);var c=s.TYPES;for(i=0;i{t.exports={GetBoolean:i(57355),GetEaseFunction:i(6113),GetInterpolationFunction:i(91389),GetNewValue:i(55292),GetProps:i(82985),GetTargets:i(62329),GetValueOp:i(17777),NumberTweenBuilder:i(88032),StaggerBuilder:i(93109),TweenBuilder:i(8357)}},73685:t=>{t.exports="active"},98540:t=>{t.exports="complete"},67233:t=>{t.exports="loop"},2859:t=>{t.exports="pause"},98336:t=>{t.exports="repeat"},25764:t=>{t.exports="resume"},32193:t=>{t.exports="start"},84371:t=>{t.exports="stop"},70766:t=>{t.exports="update"},55659:t=>{t.exports="yoyo"},842:(t,e,i)=>{t.exports={TWEEN_ACTIVE:i(73685),TWEEN_COMPLETE:i(98540),TWEEN_LOOP:i(67233),TWEEN_PAUSE:i(2859),TWEEN_RESUME:i(25764),TWEEN_REPEAT:i(98336),TWEEN_START:i(32193),TWEEN_STOP:i(84371),TWEEN_UPDATE:i(70766),TWEEN_YOYO:i(55659)}},43066:(t,e,i)=>{var s={States:i(86353),Builders:i(30231),Events:i(842),TweenManager:i(40382),Tween:i(86081),TweenData:i(48177),TweenFrameData:i(42220),BaseTween:i(70402),TweenChain:i(43960)};t.exports=s},70402:(t,e,i)=>{var s=i(83419),n=i(50792),r=i(842),o=i(86353),a=new s({Extends:n,initialize:function(t){n.call(this),this.parent=t,this.data=[],this.totalData=0,this.startDelay=0,this.hasStarted=!1,this.timeScale=1,this.loop=0,this.loopDelay=0,this.loopCounter=0,this.completeDelay=0,this.countdown=0,this.state=o.PENDING,this.paused=!1,this.callbacks={onActive:null,onComplete:null,onLoop:null,onPause:null,onRepeat:null,onResume:null,onStart:null,onStop:null,onUpdate:null,onYoyo:null},this.callbackScope,this.persist=!1},setTimeScale:function(t){return this.timeScale=t,this},getTimeScale:function(){return this.timeScale},isPlaying:function(){return!this.paused&&this.isActive()},isPaused:function(){return this.paused},pause:function(){return this.paused||(this.paused=!0,this.dispatchEvent(r.TWEEN_PAUSE,"onPause")),this},resume:function(){return this.paused&&(this.paused=!1,this.dispatchEvent(r.TWEEN_RESUME,"onResume")),this},makeActive:function(){this.parent.makeActive(this),this.dispatchEvent(r.TWEEN_ACTIVE,"onActive")},onCompleteHandler:function(){this.setPendingRemoveState(),this.dispatchEvent(r.TWEEN_COMPLETE,"onComplete")},complete:function(t){return void 0===t&&(t=0),t?(this.setCompleteDelayState(),this.countdown=t):this.onCompleteHandler(),this},completeAfterLoop:function(t){return void 0===t&&(t=0),this.loopCounter>t&&(this.loopCounter=t),this},remove:function(){return this.parent&&this.parent.remove(this),this},stop:function(){return!this.parent||this.isRemoved()||this.isPendingRemove()||this.isDestroyed()||(this.dispatchEvent(r.TWEEN_STOP,"onStop"),this.setPendingRemoveState()),this},updateLoopCountdown:function(t){this.countdown-=t,this.countdown<=0&&(this.setActiveState(),this.dispatchEvent(r.TWEEN_LOOP,"onLoop"))},updateStartCountdown:function(t){return this.countdown-=t,this.countdown<=0&&(this.hasStarted=!0,this.setActiveState(),this.dispatchEvent(r.TWEEN_START,"onStart"),t=0),t},updateCompleteDelay:function(t){this.countdown-=t,this.countdown<=0&&this.onCompleteHandler()},setCallback:function(t,e,i){return void 0===i&&(i=[]),this.callbacks.hasOwnProperty(t)&&(this.callbacks[t]={func:e,params:i}),this},setPendingState:function(){this.state=o.PENDING},setActiveState:function(){this.state=o.ACTIVE},setLoopDelayState:function(){this.state=o.LOOP_DELAY},setCompleteDelayState:function(){this.state=o.COMPLETE_DELAY},setStartDelayState:function(){this.state=o.START_DELAY,this.countdown=this.startDelay,this.hasStarted=!1},setPendingRemoveState:function(){this.state=o.PENDING_REMOVE},setRemovedState:function(){this.state=o.REMOVED},setFinishedState:function(){this.state=o.FINISHED},setDestroyedState:function(){this.state=o.DESTROYED},isPending:function(){return this.state===o.PENDING},isActive:function(){return this.state===o.ACTIVE},isLoopDelayed:function(){return this.state===o.LOOP_DELAY},isCompleteDelayed:function(){return this.state===o.COMPLETE_DELAY},isStartDelayed:function(){return this.state===o.START_DELAY},isPendingRemove:function(){return this.state===o.PENDING_REMOVE},isRemoved:function(){return this.state===o.REMOVED},isFinished:function(){return this.state===o.FINISHED},isDestroyed:function(){return this.state===o.DESTROYED},destroy:function(){this.data&&this.data.forEach((function(t){t.destroy()})),this.removeAllListeners(),this.callbacks=null,this.data=null,this.parent=null,this.setDestroyedState()}});a.TYPES=["onActive","onComplete","onLoop","onPause","onRepeat","onResume","onStart","onStop","onUpdate","onYoyo"],t.exports=a},95042:(t,e,i)=>{var s=i(83419),n=i(842),r=i(86353),o=new s({initialize:function(t,e,i,s,n,r,o,a,h,l){this.tween=t,this.targetIndex=e,this.duration=s,this.totalDuration=0,this.delay=0,this.getDelay=i,this.yoyo=n,this.hold=r,this.repeat=o,this.repeatDelay=a,this.repeatCounter=0,this.flipX=h,this.flipY=l,this.progress=0,this.elapsed=0,this.state=0,this.isCountdown=!1},getTarget:function(){return this.tween.targets[this.targetIndex]},setTargetValue:function(t){void 0===t&&(t=this.current),this.tween.targets[this.targetIndex][this.key]=t},setCreatedState:function(){this.state=r.CREATED,this.isCountdown=!1},setDelayState:function(){this.state=r.DELAY,this.isCountdown=!0},setPendingRenderState:function(){this.state=r.PENDING_RENDER,this.isCountdown=!1},setPlayingForwardState:function(){this.state=r.PLAYING_FORWARD,this.isCountdown=!1},setPlayingBackwardState:function(){this.state=r.PLAYING_BACKWARD,this.isCountdown=!1},setHoldState:function(){this.state=r.HOLD_DELAY,this.isCountdown=!0},setRepeatState:function(){this.state=r.REPEAT_DELAY,this.isCountdown=!0},setCompleteState:function(){this.state=r.COMPLETE,this.isCountdown=!1},isCreated:function(){return this.state===r.CREATED},isDelayed:function(){return this.state===r.DELAY},isPendingRender:function(){return this.state===r.PENDING_RENDER},isPlayingForward:function(){return this.state===r.PLAYING_FORWARD},isPlayingBackward:function(){return this.state===r.PLAYING_BACKWARD},isHolding:function(){return this.state===r.HOLD_DELAY},isRepeating:function(){return this.state===r.REPEAT_DELAY},isComplete:function(){return this.state===r.COMPLETE},setStateFromEnd:function(t){this.yoyo?this.onRepeat(t,!0,!0):this.repeatCounter>0?this.onRepeat(t,!0,!1):this.setCompleteState()},setStateFromStart:function(t){this.repeatCounter>0?this.onRepeat(t,!1):this.setCompleteState()},reset:function(){var t=this.tween,e=t.totalTargets,i=this.targetIndex,s=t.targets[i],n=this.key;this.progress=0,this.elapsed=0,this.delay=this.getDelay(s,n,0,i,e,t),this.repeatCounter=-1===this.repeat?r.MAX:this.repeat,this.setPendingRenderState();var o=this.duration+this.hold;this.yoyo&&(o+=this.duration);var a=o+this.repeatDelay;this.totalDuration=this.delay+o,-1===this.repeat?(this.totalDuration+=a*r.MAX,t.isInfinite=!0):this.repeat>0&&(this.totalDuration+=a*this.repeat),this.totalDuration>t.duration&&(t.duration=this.totalDuration),this.delay0&&(this.elapsed=this.delay,this.setDelayState())},onRepeat:function(t,e,i){var s=this.tween,r=s.totalTargets,o=this.targetIndex,a=s.targets[o],h=this.key,l="texture"!==h;if(this.elapsed=t,this.progress=t/this.duration,this.flipX&&a.toggleFlipX(),this.flipY&&a.toggleFlipY(),l&&(e||i)&&(this.start=this.getStartValue(a,h,this.start,o,r,s)),i)return this.setPlayingBackwardState(),void this.dispatchEvent(n.TWEEN_YOYO,"onYoyo");this.repeatCounter--,l&&(this.end=this.getEndValue(a,h,this.start,o,r,s)),this.repeatDelay>0?(this.elapsed=this.repeatDelay-t,l&&(this.current=this.start,a[h]=this.current),this.setRepeatState()):(this.setPlayingForwardState(),this.dispatchEvent(n.TWEEN_REPEAT,"onRepeat"))},destroy:function(){this.tween=null,this.getDelay=null,this.setCompleteState()}});t.exports=o},69902:t=>{t.exports={targets:null,delay:0,duration:1e3,ease:"Power0",easeParams:null,hold:0,repeat:0,repeatDelay:0,yoyo:!1,flipX:!1,flipY:!1,persist:!1,interpolation:null}},81076:t=>{t.exports=["callbackScope","completeDelay","delay","duration","ease","easeParams","flipX","flipY","hold","interpolation","loop","loopDelay","onActive","onActiveParams","onComplete","onCompleteParams","onLoop","onLoopParams","onPause","onPauseParams","onRepeat","onRepeatParams","onResume","onResumeParams","onStart","onStartParams","onStop","onStopParams","onUpdate","onUpdateParams","onYoyo","onYoyoParams","paused","persist","props","repeat","repeatDelay","targets","yoyo"]},86081:(t,e,i)=>{var s=i(70402),n=i(83419),r=i(842),o=i(44603),a=i(39429),h=i(36383),l=i(86353),u=i(48177),c=i(42220),d=new n({Extends:s,initialize:function(t,e){s.call(this,t),this.targets=e,this.totalTargets=e.length,this.isSeeking=!1,this.isInfinite=!1,this.elapsed=0,this.totalElapsed=0,this.duration=0,this.progress=0,this.totalDuration=0,this.totalProgress=0},add:function(t,e,i,s,n,r,o,a,h,l,c,d,f,p,v,g){var m=new u(this,t,e,i,s,n,r,o,a,h,l,c,d,f,p,v,g);return this.totalData=this.data.push(m),m},addFrame:function(t,e,i,s,n,r,o,a,h,l){var u=new c(this,t,e,i,s,n,r,o,a,h,l);return this.totalData=this.data.push(u),u},getValue:function(t){void 0===t&&(t=0);var e=null;return this.data&&(e=this.data[t].current),e},hasTarget:function(t){return this.targets&&-1!==this.targets.indexOf(t)},updateTo:function(t,e,i){if(void 0===i&&(i=!1),"texture"!==t)for(var s=0;s0)this.elapsed=0,this.progress=0,this.loopCounter--,this.initTweenData(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.setLoopDelayState()):(this.setActiveState(),this.dispatchEvent(r.TWEEN_LOOP,"onLoop"));else{if(!(this.completeDelay>0))return this.onCompleteHandler(),!0;this.countdown=this.completeDelay,this.setCompleteDelayState()}return!1},onCompleteHandler:function(){this.progress=1,this.totalProgress=1,s.prototype.onCompleteHandler.call(this)},play:function(){return this.isDestroyed()?(console.warn("Cannot play destroyed Tween",this),this):((this.isPendingRemove()||this.isFinished())&&this.seek(),this.paused=!1,this.setActiveState(),this)},seek:function(t,e,i){if(void 0===t&&(t=0),void 0===e&&(e=16.6),void 0===i&&(i=!1),this.isDestroyed())return console.warn("Cannot seek destroyed Tween",this),this;i||(this.isSeeking=!0),this.reset(!0),this.initTweenData(!0),this.setActiveState(),this.dispatchEvent(r.TWEEN_ACTIVE,"onActive");var s=this.paused;if(this.paused=!1,t>0){for(var n=Math.floor(t/e),o=t-n*e,a=0;a0&&this.update(o)}return this.paused=s,this.isSeeking=!1,this},initTweenData:function(t){void 0===t&&(t=!1),this.duration=0,this.startDelay=h.MAX_SAFE_INTEGER;for(var e=this.data,i=0;i0?s+n+(s+o)*r:s+n},reset:function(t){return void 0===t&&(t=!1),this.elapsed=0,this.totalElapsed=0,this.progress=0,this.totalProgress=0,this.loopCounter=this.loop,-1===this.loop&&(this.isInfinite=!0,this.loopCounter=l.MAX),t||(this.initTweenData(),this.setActiveState(),this.dispatchEvent(r.TWEEN_ACTIVE,"onActive")),this},update:function(t){if(this.isPendingRemove()||this.isDestroyed())return!0;if(this.paused||this.isFinished())return!1;if(t*=this.timeScale*this.parent.timeScale,this.isLoopDelayed())return this.updateLoopCountdown(t),!1;if(this.isCompleteDelayed())return this.updateCompleteDelay(t),!1;this.hasStarted||(this.startDelay-=t,this.startDelay<=0&&(this.hasStarted=!0,this.dispatchEvent(r.TWEEN_START,"onStart"),t=0));var e=!1;if(this.isActive())for(var i=this.data,s=0;s{var s=i(72905),n=i(70402),r=i(83419),o=i(842),a=i(44603),h=i(39429),l=i(86353),u=new r({Extends:n,initialize:function(t){n.call(this,t),this.currentTween=null,this.currentIndex=0},init:function(){return this.loopCounter=-1===this.loop?l.MAX:this.loop,this.setCurrentTween(0),this.startDelay>0&&!this.isStartDelayed()?this.setStartDelayState():this.setActiveState(),this.dispatchEvent(o.TWEEN_ACTIVE,"onActive"),this},add:function(t){var e=this.parent.create(t);Array.isArray(e)||(e=[e]);for(var i=this.data,s=0;s0)this.loopCounter--,this.resetTweens(),this.loopDelay>0?(this.countdown=this.loopDelay,this.setLoopDelayState()):(this.setActiveState(),this.dispatchEvent(o.TWEEN_LOOP,"onLoop"));else{if(!(this.completeDelay>0))return this.onCompleteHandler(),!0;this.countdown=this.completeDelay,this.setCompleteDelayState()}return!1},play:function(){return this.isDestroyed()?(console.warn("Cannot play destroyed TweenChain",this),this):((this.isPendingRemove()||this.isPending())&&this.resetTweens(),this.paused=!1,this.startDelay>0&&!this.isStartDelayed()?this.setStartDelayState():this.setActiveState(),this)},resetTweens:function(){for(var t=this.data,e=this.totalData,i=0;i{var s=i(95042),n=i(45319),r=i(83419),o=i(842),a=new r({Extends:s,initialize:function(t,e,i,n,r,o,a,h,l,u,c,d,f,p,v,g,m){s.call(this,t,e,h,l,u,c,d,f,p,v),this.key=i,this.getActiveValue=o,this.getEndValue=n,this.getStartValue=r,this.ease=a,this.start=0,this.previous=0,this.current=0,this.end=0,this.interpolation=g,this.interpolationData=m},reset:function(t){s.prototype.reset.call(this);var e=this.tween.targets[this.targetIndex],i=this.key;t&&(e[i]=this.start),this.start=0,this.previous=0,this.current=0,this.end=0,this.getActiveValue&&(e[i]=this.getActiveValue(e,i,0))},update:function(t){var e=this.tween,i=e.totalTargets,s=this.targetIndex,r=e.targets[s],a=this.key;if(!r)return this.setCompleteState(),!1;if(this.isCountdown&&(this.elapsed-=t,this.elapsed<=0&&(this.elapsed=0,t=0,this.isDelayed()?this.setPendingRenderState():this.isRepeating()?(this.setPlayingForwardState(),this.dispatchEvent(o.TWEEN_REPEAT,"onRepeat")):this.isHolding()&&this.setStateFromEnd(0))),this.isPendingRender())return this.start=this.getStartValue(r,a,r[a],s,i,e),this.end=this.getEndValue(r,a,this.start,s,i,e),this.current=this.start,r[a]=this.start,this.setPlayingForwardState(),!0;var h=this.isPlayingForward(),l=this.isPlayingBackward();if(h||l){var u=this.elapsed,c=this.duration,d=0,f=!1;(u+=t)>=c?(d=u-c,u=c,f=!0):u<0&&(u=0);var p=n(u/c,0,1);if(this.elapsed=u,this.progress=p,this.previous=this.current,f)h?(this.current=this.end,r[a]=this.end,this.hold>0?(this.elapsed=this.hold,this.setHoldState()):this.setStateFromEnd(d)):(this.current=this.start,r[a]=this.start,this.setStateFromStart(d));else{h||(p=1-p);var v=this.ease(p);this.interpolation?this.current=this.interpolation(this.interpolationData,v):this.current=this.start+(this.end-this.start)*v,r[a]=this.current}this.dispatchEvent(o.TWEEN_UPDATE,"onUpdate")}return!this.isComplete()},dispatchEvent:function(t,e){var i=this.tween;if(!i.isSeeking){var s=i.targets[this.targetIndex],n=this.key,r=this.current,o=this.previous;i.emit(t,i,n,s,r,o);var a=i.callbacks[e];a&&a.func.apply(i.callbackScope,[i,s,n,r,o].concat(a.params))}},destroy:function(){s.prototype.destroy.call(this),this.getActiveValue=null,this.getEndValue=null,this.getStartValue=null,this.ease=null}});t.exports=a},42220:(t,e,i)=>{var s=i(95042),n=i(45319),r=i(83419),o=i(842),a=new r({Extends:s,initialize:function(t,e,i,n,r,o,a,h,l,u,c){s.call(this,t,e,r,o,!1,a,h,l,u,c),this.key="texture",this.startTexture=null,this.endTexture=i,this.startFrame=null,this.endFrame=n,this.yoyo=0!==h},reset:function(t){s.prototype.reset.call(this);var e=this.tween.targets[this.targetIndex];this.startTexture||(this.startTexture=e.texture.key,this.startFrame=e.frame.name),t&&e.setTexture(this.startTexture,this.startFrame)},update:function(t){var e=this.tween,i=this.targetIndex,s=e.targets[i];if(!s)return this.setCompleteState(),!1;if(this.isCountdown&&(this.elapsed-=t,this.elapsed<=0&&(this.elapsed=0,t=0,this.isDelayed()?this.setPendingRenderState():this.isRepeating()?(this.setPlayingForwardState(),this.dispatchEvent(o.TWEEN_REPEAT,"onRepeat")):this.isHolding()&&this.setStateFromEnd(0))),this.isPendingRender())return this.startTexture&&s.setTexture(this.startTexture,this.startFrame),this.setPlayingForwardState(),!0;var r=this.isPlayingForward(),a=this.isPlayingBackward();if(r||a){var h=this.elapsed,l=this.duration,u=0,c=!1;(h+=t)>=l?(u=h-l,h=l,c=!0):h<0&&(h=0);var d=n(h/l,0,1);this.elapsed=h,this.progress=d,c&&(r?(s.setTexture(this.endTexture,this.endFrame),this.hold>0?(this.elapsed=this.hold,this.setHoldState()):this.setStateFromEnd(u)):(s.setTexture(this.startTexture,this.startFrame),this.setStateFromStart(u))),this.dispatchEvent(o.TWEEN_UPDATE,"onUpdate")}return!this.isComplete()},dispatchEvent:function(t,e){var i=this.tween;if(!i.isSeeking){var s=i.targets[this.targetIndex],n=this.key;i.emit(t,i,n,s);var r=i.callbacks[e];r&&r.func.apply(i.callbackScope,[i,s,n].concat(r.params))}},destroy:function(){s.prototype.destroy.call(this),this.startTexture=null,this.endTexture=null,this.startFrame=null,this.endFrame=null}});t.exports=a},86353:t=>{t.exports={CREATED:0,DELAY:2,PENDING_RENDER:4,PLAYING_FORWARD:5,PLAYING_BACKWARD:6,HOLD_DELAY:7,REPEAT_DELAY:8,COMPLETE:9,PENDING:20,ACTIVE:21,LOOP_DELAY:22,COMPLETE_DELAY:23,START_DELAY:24,PENDING_REMOVE:25,REMOVED:26,FINISHED:27,DESTROYED:28,MAX:999999999999}},83419:t=>{function e(t,e,i){var s=i?t[e]:Object.getOwnPropertyDescriptor(t,e);return!i&&s.value&&"object"==typeof s.value&&(s=s.value),!(!s||!function(t){return!!t.get&&"function"==typeof t.get||!!t.set&&"function"==typeof t.set}(s))&&(void 0===s.enumerable&&(s.enumerable=!0),void 0===s.configurable&&(s.configurable=!0),s)}function i(t,e){var i=Object.getOwnPropertyDescriptor(t,e);return!!i&&(i.value&&"object"==typeof i.value&&(i=i.value),!1===i.configurable)}function s(t,s,n,o){for(var a in s)if(s.hasOwnProperty(a)){var h=e(s,a,n);if(!1!==h){if(i((o||t).prototype,a)){if(r.ignoreFinals)continue;throw new Error("cannot override final property '"+a+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,a,h)}else t.prototype[a]=s[a]}}function n(t,e){if(e){Array.isArray(e)||(e=[e]);for(var i=0;i{t.exports=function(){}},20242:t=>{t.exports=function(){return null}},71146:t=>{t.exports=function(t,e,i,s,n){if(void 0===n&&(n=t),i>0){var r=i-t.length;if(r<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.push(e),s&&s.call(n,e),e):null;for(var o=e.length-1;o>=0;)-1!==t.indexOf(e[o])&&e.splice(o,1),o--;if(0===(o=e.length))return null;i>0&&o>r&&(e.splice(r),o=r);for(var a=0;a{t.exports=function(t,e,i,s,n,r){if(void 0===i&&(i=0),void 0===r&&(r=t),s>0){var o=s-t.length;if(o<=0)return null}if(!Array.isArray(e))return-1===t.indexOf(e)?(t.splice(i,0,e),n&&n.call(r,e),e):null;for(var a=e.length-1;a>=0;)-1!==t.indexOf(e[a])&&e.pop(),a--;if(0===(a=e.length))return null;s>0&&a>o&&(e.splice(o),a=o);for(var h=a-1;h>=0;h--){var l=e[h];t.splice(i,0,l),n&&n.call(r,l)}return e}},66905:t=>{t.exports=function(t,e){var i=t.indexOf(e);return-1!==i&&i{var s=i(82011);t.exports=function(t,e,i,n,r){void 0===n&&(n=0),void 0===r&&(r=t.length);var o=0;if(s(t,n,r))for(var a=n;a{t.exports=function(t,e,i){var s,n=[null];for(s=3;s{var s=i(82011);t.exports=function(t,e,i,n,r){if(void 0===n&&(n=0),void 0===r&&(r=t.length),s(t,n,r)){var o,a=[null];for(o=5;o{t.exports=function(t,e,i){if(!e.length)return NaN;if(1===e.length)return e[0];var s,n,r=1;if(i){if(te.length&&(r=e.length),i?(s=e[r-1][i],(n=e[r][i])-t<=t-s?e[r]:e[r-1]):(s=e[r-1],(n=e[r])-t<=t-s?n:s)}},43491:t=>{var e=function(t,i){void 0===i&&(i=[]);for(var s=0;s{var s=i(82011);t.exports=function(t,e,i,n,r){void 0===n&&(n=0),void 0===r&&(r=t.length);var o=[];if(s(t,n,r))for(var a=n;a{var s=i(82011);t.exports=function(t,e,i,n,r){if(void 0===n&&(n=0),void 0===r&&(r=t.length),s(t,n,r))for(var o=n;o{t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var s=e+Math.floor(Math.random()*i);return void 0===t[s]?null:t[s]}},85835:t=>{t.exports=function(t,e,i){if(e===i)return t;var s=t.indexOf(e),n=t.indexOf(i);if(s<0||n<0)throw new Error("Supplied items must be elements of the same array");return s>n||(t.splice(s,1),n===t.length-1?t.push(e):t.splice(n,0,e)),t}},83371:t=>{t.exports=function(t,e,i){if(e===i)return t;var s=t.indexOf(e),n=t.indexOf(i);if(s<0||n<0)throw new Error("Supplied items must be elements of the same array");return s{t.exports=function(t,e){var i=t.indexOf(e);if(i>0){var s=t[i-1],n=t.indexOf(s);t[i]=s,t[n]=e}return t}},69693:t=>{t.exports=function(t,e,i){var s=t.indexOf(e);if(-1===s||i<0||i>=t.length)throw new Error("Supplied index out of bounds");return s!==i&&(t.splice(s,1),t.splice(i,0,e)),e}},40853:t=>{t.exports=function(t,e){var i=t.indexOf(e);if(-1!==i&&i{t.exports=function(t,e,i,s){var n,r=[],o=!1;if((i||s)&&(o=!0,i||(i=""),s||(s="")),e=e;n--)o?r.push(i+n.toString()+s):r.push(n);else for(n=t;n<=e;n++)o?r.push(i+n.toString()+s):r.push(n);return r}},593:(t,e,i)=>{var s=i(2284);t.exports=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=1),null===e&&(e=t,t=0);for(var n=[],r=Math.max(s((e-t)/(i||1)),0),o=0;o{function e(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function i(t,e){return te?1:0}var s=function(t,n,r,o,a){for(void 0===r&&(r=0),void 0===o&&(o=t.length-1),void 0===a&&(a=i);o>r;){if(o-r>600){var h=o-r+1,l=n-r+1,u=Math.log(h),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(h-c)/h)*(l-h/2<0?-1:1),f=Math.max(r,Math.floor(n-l*c/h+d)),p=Math.min(o,Math.floor(n+(h-l)*c/h+d));s(t,n,f,p,a)}var v=t[n],g=r,m=o;for(e(t,r,n),a(t[o],v)>0&&e(t,r,o);g0;)m--}0===a(t[r],v)?e(t,r,m):e(t,++m,o),m<=n&&(r=m+1),n<=m&&(o=m-1)}};t.exports=s},88492:(t,e,i)=>{var s=i(35154),n=i(33680),r=function(t,e,i){for(var s=[],n=0;n{var s=i(19133);t.exports=function(t,e,i,n){var r;if(void 0===n&&(n=t),!Array.isArray(e))return-1!==(r=t.indexOf(e))?(s(t,r),i&&i.call(n,e),e):null;for(var o=e.length-1,a=[];o>=0;){var h=e[o];-1!==(r=t.indexOf(h))&&(s(t,r),a.push(h),i&&i.call(n,h)),o--}return a}},60248:(t,e,i)=>{var s=i(19133);t.exports=function(t,e,i,n){if(void 0===n&&(n=t),e<0||e>t.length-1)throw new Error("Index out of bounds");var r=s(t,e);return i&&i.call(n,r),r}},81409:(t,e,i)=>{var s=i(82011);t.exports=function(t,e,i,n,r){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===r&&(r=t),s(t,e,i)){var o=i-e,a=t.splice(e,o);if(n)for(var h=0;h{var s=i(19133);t.exports=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);return s(t,n)}},42169:t=>{t.exports=function(t,e,i){var s=t.indexOf(e),n=t.indexOf(i);return-1!==s&&-1===n&&(t[s]=i,!0)}},86003:t=>{t.exports=function(t,e){void 0===e&&(e=1);for(var i=null,s=0;s{t.exports=function(t,e){void 0===e&&(e=1);for(var i=null,s=0;s{t.exports=function(t,e,i,s){var n=t.length;if(e<0||e>n||e>=i||i>n){if(s)throw new Error("Range Error: Values outside acceptable range");return!1}return!0}},89545:t=>{t.exports=function(t,e){var i=t.indexOf(e);return-1!==i&&i>0&&(t.splice(i,1),t.unshift(e)),e}},17810:(t,e,i)=>{var s=i(82011);t.exports=function(t,e,i,n,r){if(void 0===n&&(n=0),void 0===r&&(r=t.length),s(t,n,r))for(var o=n;o{t.exports=function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[i],t[i]=s}return t}},90126:t=>{t.exports=function(t){var e=/\D/g;return t.sort((function(t,i){return parseInt(t.replace(e,""),10)-parseInt(i.replace(e,""),10)})),t}},19133:t=>{t.exports=function(t,e){if(!(e>=t.length)){for(var i=t.length-1,s=t[e],n=e;n{var s=i(82264);function n(t,e){return String(t).localeCompare(e)}function r(t,e,i,s){var n,r,o,a,h,l=t.length,u=0,c=2*i;for(n=0;nl&&(r=l),o>l&&(o=l),a=n,h=r;;)if(a{t.exports=function(t,e,i){if(e===i)return t;var s=t.indexOf(e),n=t.indexOf(i);if(s<0||n<0)throw new Error("Supplied items must be elements of the same array");return t[s]=i,t[n]=e,t}},37105:(t,e,i)=>{t.exports={Matrix:i(54915),Add:i(71146),AddAt:i(51067),BringToTop:i(66905),CountAllMatching:i(21612),Each:i(95428),EachInRange:i(36914),FindClosestInSorted:i(81957),Flatten:i(43491),GetAll:i(46710),GetFirst:i(58731),GetRandom:i(26546),MoveDown:i(70864),MoveTo:i(69693),MoveUp:i(40853),MoveAbove:i(85835),MoveBelow:i(83371),NumberArray:i(20283),NumberArrayStep:i(593),QuickSelect:i(43886),Range:i(88492),Remove:i(72905),RemoveAt:i(60248),RemoveBetween:i(81409),RemoveRandomElement:i(31856),Replace:i(42169),RotateLeft:i(86003),RotateRight:i(49498),SafeRange:i(82011),SendToBack:i(89545),SetAll:i(17810),Shuffle:i(33680),SortByDigits:i(90126),SpliceOne:i(19133),StableSort:i(19186),Swap:i(25630)}},86922:t=>{t.exports=function(t){if(!Array.isArray(t)||!Array.isArray(t[0]))return!1;for(var e=t[0].length,i=1;i{var s=i(41836),n=i(86922);t.exports=function(t){var e="";if(!n(t))return e;for(var i=0;i{t.exports=function(t){return t.reverse()}},21224:t=>{t.exports=function(t){for(var e=0;e{var s=i(37829);t.exports=function(t){return s(t,180)}},44657:(t,e,i)=>{var s=i(37829);t.exports=function(t,e){void 0===e&&(e=1);for(var i=0;i{var s=i(86922),n=i(2429);t.exports=function(t,e){if(void 0===e&&(e=90),!s(t))return null;if("string"!=typeof e&&(e=(e%360+360)%360),90===e||-270===e||"rotateLeft"===e)(t=n(t)).reverse();else if(-90===e||270===e||"rotateRight"===e)t.reverse(),t=n(t);else if(180===Math.abs(e)||"rotate180"===e){for(var i=0;i{var s=i(37829);t.exports=function(t,e){void 0===e&&(e=1);for(var i=0;i{var s=i(86003),n=i(49498);t.exports=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),0!==i&&(i<0?s(t,Math.abs(i)):n(t,i)),0!==e)for(var r=0;r{t.exports=function(t){for(var e=t.length,i=t[0].length,s=new Array(i),n=0;n-1;r--)s[n][r]=t[r][n]}return s}},54915:(t,e,i)=>{t.exports={CheckMatrix:i(86922),MatrixToString:i(63362),ReverseColumns:i(92598),ReverseRows:i(21224),Rotate180:i(98717),RotateLeft:i(44657),RotateMatrix:i(37829),RotateRight:i(92632),Translate:i(69512),TransposeMatrix:i(2429)}},71334:t=>{var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";t.exports=function(t,i){for(var s=new Uint8Array(t),n=s.length,r=i?"data:"+i+";base64,":"",o=0;o>2],r+=e[(3&s[o])<<4|s[o+1]>>4],r+=e[(15&s[o+1])<<2|s[o+2]>>6],r+=e[63&s[o+2]];return n%3==2?r=r.substring(0,r.length-1)+"=":n%3==1&&(r=r.substring(0,r.length-2)+"=="),r}},53134:t=>{for(var e=new Uint8Array(256),i=0;i<64;i++)e["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(i)]=i;t.exports=function(t){var i,s,n,r,o=(t=t.substr(t.indexOf(",")+1)).length,a=.75*o,h=0;"="===t[o-1]&&(a--,"="===t[o-2]&&a--);for(var l=new ArrayBuffer(a),u=new Uint8Array(l),c=0;c>4,u[h++]=(15&s)<<4|n>>2,u[h++]=(3&n)<<6|63&r;return l}},65839:(t,e,i)=>{t.exports={ArrayBufferToBase64:i(71334),Base64ToArrayBuffer:i(53134)}},91799:(t,e,i)=>{t.exports={Array:i(37105),Base64:i(65839),Objects:i(1183),String:i(31749),NOOP:i(29747),NULL:i(20242)}},41786:t=>{t.exports=function(t){var e={};for(var i in t)Array.isArray(t[i])?e[i]=t[i].slice(0):e[i]=t[i];return e}},62644:t=>{var e=function(t){var i,s,n;if("object"!=typeof t||null===t)return t;for(n in i=Array.isArray(t)?[]:{},t)s=t[n],i[n]=e(s);return i};t.exports=e},79291:(t,e,i)=>{var s=i(41212),n=function(){var t,e,i,r,o,a,h=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof h&&(c=h,h=arguments[1]||{},l=2),u===l&&(h=this,--l);l{var s=i(75508),n=i(35154);t.exports=function(t,e,i){var r=n(t,e,null);if(null===r)return i;if(Array.isArray(r))return s.RND.pick(r);if("object"==typeof r){if(r.hasOwnProperty("randInt"))return s.RND.integerInRange(r.randInt[0],r.randInt[1]);if(r.hasOwnProperty("randFloat"))return s.RND.realInRange(r.randFloat[0],r.randFloat[1])}else if("function"==typeof r)return r(e);return r}},95540:t=>{t.exports=function(t,e,i){var s=typeof t;return t&&"number"!==s&&"string"!==s&&t.hasOwnProperty(e)&&void 0!==t[e]?t[e]:i}},82840:(t,e,i)=>{var s=i(35154),n=i(45319);t.exports=function(t,e,i,r,o){void 0===o&&(o=i);var a=s(t,e,o);return n(a,i,r)}},35154:t=>{t.exports=function(t,e,i,s){if(!t&&!s||"number"==typeof t)return i;if(t&&t.hasOwnProperty(e))return t[e];if(s&&s.hasOwnProperty(e))return s[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),r=t,o=s,a=i,h=i,l=!0,u=!0,c=0;c{t.exports=function(t,e){for(var i=0;i{t.exports=function(t,e){for(var i=0;i{t.exports=function(t,e){return t.hasOwnProperty(e)}},41212:t=>{t.exports=function(t){if(!t||"object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}return!0}},46975:(t,e,i)=>{var s=i(41786);t.exports=function(t,e){var i=s(t);for(var n in e)i.hasOwnProperty(n)||(i[n]=e[n]);return i}},269:(t,e,i)=>{var s=i(41786);t.exports=function(t,e){var i=s(t);for(var n in e)i.hasOwnProperty(n)&&(i[n]=e[n]);return i}},18254:(t,e,i)=>{var s=i(97022);t.exports=function(t,e){for(var i={},n=0;n{t.exports=function(t,e,i){if(!t||"number"==typeof t)return!1;if(t.hasOwnProperty(e))return t[e]=i,!0;if(-1!==e.indexOf(".")){for(var s=e.split("."),n=t,r=t,o=0;o{t.exports={Clone:i(41786),DeepCopy:i(62644),Extend:i(79291),GetAdvancedValue:i(23568),GetFastValue:i(95540),GetMinMaxValue:i(82840),GetValue:i(35154),HasAll:i(69036),HasAny:i(1985),HasValue:i(97022),IsPlainObject:i(41212),Merge:i(46975),MergeRight:i(269),Pick:i(18254),SetValue:i(61622)}},27902:t=>{t.exports=function(t,e){return t.replace(/%([0-9]+)/g,(function(t,i){return e[Number(i)-1]}))}},41836:t=>{t.exports=function(t,e,i,s){void 0===e&&(e=0),void 0===i&&(i=" "),void 0===s&&(s=3);var n=0;if(e+1>=(t=t.toString()).length)switch(s){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((n=e-t.length)/2);t=new Array(n-r+1).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},33628:t=>{t.exports=function(t,e){return 0===e?t.slice(1):t.slice(0,e-1)+t.slice(e)}},27671:t=>{t.exports=function(t){return t.split("").reverse().join("")}},45650:t=>{t.exports=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}},35355:t=>{t.exports=function(t){return t&&t[0].toUpperCase()+t.slice(1)}},31749:(t,e,i)=>{t.exports={Format:i(27902),Pad:i(41836),RemoveAt:i(33628),Reverse:i(27671),UppercaseFirst:i(35355),UUID:i(45650)}}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var r=e[s]={exports:{}};return t[s](r,r.exports,i),r.exports}return i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i(85454)})(),s.exports=t());var t}export{t as c,e as g,n as r}; diff --git a/dungeon/dist/index.html b/dungeon/dist/index.html index 059336c6..b4e87ade 100644 --- a/dungeon/dist/index.html +++ b/dungeon/dist/index.html @@ -4,7 +4,7 @@ - Phaser - Template + Phaser - Dungeon - - + + diff --git a/fate/dist/assets/index-DBbMvyNZ.js b/fate/dist/assets/index-D7tYnf-8.js similarity index 67% rename from fate/dist/assets/index-DBbMvyNZ.js rename to fate/dist/assets/index-D7tYnf-8.js index 40244edd..449adfb5 100644 --- a/fate/dist/assets/index-DBbMvyNZ.js +++ b/fate/dist/assets/index-D7tYnf-8.js @@ -1 +1 @@ -import{c as t,p as e}from"./phaser-YLX_gXuc.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const n of t)if("childList"===n.type)for(const t of n.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();const n="156",i=1,r=2,s=3,a=0,o=1,l=2,c=100,h=101,u=102,d=200,p=201,m=202,f=203,g=204,v=205,y=206,x=207,_=208,b=209,M=210,w=0,S=1,T=2,A=0,E=1,R=2,C=3,P=4,L=5,I=301,N=302,O=303,D=304,U=306,B=1e3,F=1001,k=1002,z=1003,V=1004,H=1005,G=1006,W=1007,j=1008,X=1009,q=1012,Y=1014,K=1015,J=1016,Z=1020,$=1023,Q=1026,tt=1027,et=33776,nt=33777,it=33778,rt=33779,st=36492,at=2300,ot=2301,lt=2302,ct=2400,ht=2401,ut=2402,dt=3001,pt="srgb",mt="srgb-linear",ft="display-p3",gt=7680,vt=512,yt=513,xt=514,_t=515,bt=516,Mt=517,wt=518,St=519,Tt=35044,At="300 es",Et=1035,Rt=2e3,Ct=2001;class Pt{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e>8&255]+Lt[t>>16&255]+Lt[t>>24&255]+"-"+Lt[255&e]+Lt[e>>8&255]+"-"+Lt[e>>16&15|64]+Lt[e>>24&255]+"-"+Lt[63&n|128]+Lt[n>>8&255]+"-"+Lt[n>>16&255]+Lt[n>>24&255]+Lt[255&i]+Lt[i>>8&255]+Lt[i>>16&255]+Lt[i>>24&255]).toLowerCase()}function Dt(t,e,n){return Math.max(e,Math.min(n,t))}function Ut(t,e){return(t%e+e)%e}function Bt(t,e,n){return(1-n)*t+n*e}function Ft(t){return!(t&t-1)&&0!==t}function kt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function zt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Vt(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Ht(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Gt=It,Wt=function(t){return t*It},jt=function(t){return t*Nt};class Xt{constructor(t=0,e=0){Xt.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Dt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class qt{constructor(t,e,n,i,r,s,a,o,l){qt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,a,o,l)}set(t,e,n,i,r,s,a,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=a,c[3]=e,c[4]=r,c[5]=o,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],m=i[0],f=i[3],g=i[6],v=i[1],y=i[4],x=i[7],_=i[2],b=i[5],M=i[8];return r[0]=s*m+a*v+o*_,r[3]=s*f+a*y+o*b,r[6]=s*g+a*x+o*M,r[1]=l*m+c*v+h*_,r[4]=l*f+c*y+h*b,r[7]=l*g+c*x+h*M,r[2]=u*m+d*v+p*_,r[5]=u*f+d*y+p*b,r[8]=u*g+d*x+p*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-n*r*c+n*a*o+i*r*l-i*s*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=h*m,t[1]=(i*l-c*n)*m,t[2]=(a*n-i*s)*m,t[3]=u*m,t[4]=(c*e-i*o)*m,t[5]=(i*r-a*e)*m,t[6]=d*m,t[7]=(n*o-l*e)*m,t[8]=(s*e-n*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+t,-i*l,i*o,-i*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Yt.makeScale(t,e)),this}rotate(t){return this.premultiply(Yt.makeRotation(-t)),this}translate(t,e){return this.premultiply(Yt.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const Yt=new qt;function Kt(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Jt={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Zt(t,e){return new Jt[t](e)}function $t(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Qt(){const t=$t("canvas");return t.style.display="block",t}const te={};function ee(t){t in te||(te[t]=!0,console.warn(t))}function ne(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ie(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const re=(new qt).fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),se=(new qt).fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]),ae={[mt]:t=>t,[pt]:t=>t.convertSRGBToLinear(),[ft]:function(t){return t.convertSRGBToLinear().applyMatrix3(se)}},oe={[mt]:t=>t,[pt]:t=>t.convertLinearToSRGB(),[ft]:function(t){return t.applyMatrix3(re).convertLinearToSRGB()}},le={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return mt},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(!1===this.enabled||e===n||!e||!n)return t;const i=ae[e],r=oe[n];if(void 0===i||void 0===r)throw new Error(`Unsupported color space conversion, "${e}" to "${n}".`);return r(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}};let ce;class he{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===ce&&(ce=$t("canvas")),ce.width=t.width,ce.height=t.height;const n=ce.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=ce}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=$t("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case B:t.x=t.x-Math.floor(t.x);break;case F:t.x=t.x<0?0:1;break;case k:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case B:t.y=t.y-Math.floor(t.y);break;case F:t.y=t.y<0?0:1;break;case k:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return ee("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===pt?dt:3e3}set encoding(t){ee("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===dt?pt:""}}fe.DEFAULT_IMAGE=null,fe.DEFAULT_MAPPING=300,fe.DEFAULT_ANISOTROPY=1;class ge{constructor(t=0,e=0,n=0,i=1){ge.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const s=.01,a=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],p=o[9],m=o[2],f=o[6],g=o[10];if(Math.abs(c-u)o&&t>v?tv?o=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+m*r,t===1-a){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-a*d,t[e+2]=l*p+c*d+a*u-o*h,t[e+3]=c*p-a*h-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){const n=t._x,i=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(n/2),c=a(i/2),h=a(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=n+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(s-i)*t}else if(n>a&&n>h){const t=2*Math.sqrt(1+n-a-h);this._w=(c-o)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-n-a);this._w=(s-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Dt(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+s*a+i*l-r*o,this._y=i*c+s*o+r*a-n*l,this._z=r*c+s*l+n*o-i*a,this._w=s*c-n*a-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),c=Math.atan2(l,a),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Me{constructor(t=0,e=0,n=0){Me.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Se.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Se.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,s=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=o*e+s*i-a*n,c=o*n+a*e-r*i,h=o*i+r*n-s*e,u=-r*e-s*n-a*i;return this.x=l*o+u*-r+c*-a-h*-s,this.y=c*o+u*-s+h*-r-l*-a,this.z=h*o+u*-a+l*-s-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return we.copy(this).projectOnVector(t),this.sub(we)}reflect(t){return this.sub(we.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Dt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const we=new Me,Se=new be;class Te{constructor(t=new Me(1/0,1/0,1/0),e=new Me(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Ee),Ee.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(De),Ue.subVectors(this.max,De),Ce.subVectors(t.a,De),Pe.subVectors(t.b,De),Le.subVectors(t.c,De),Ie.subVectors(Pe,Ce),Ne.subVectors(Le,Pe),Oe.subVectors(Ce,Le);let e=[0,-Ie.z,Ie.y,0,-Ne.z,Ne.y,0,-Oe.z,Oe.y,Ie.z,0,-Ie.x,Ne.z,0,-Ne.x,Oe.z,0,-Oe.x,-Ie.y,Ie.x,0,-Ne.y,Ne.x,0,-Oe.y,Oe.x,0];return!!ke(e,Ce,Pe,Le,Ue)&&(e=[1,0,0,0,1,0,0,0,1],!!ke(e,Ce,Pe,Le,Ue)&&(Be.crossVectors(Ie,Ne),e=[Be.x,Be.y,Be.z],ke(e,Ce,Pe,Le,Ue)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Ee).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Ee).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ae[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ae[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ae[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ae[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ae[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ae[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ae[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ae[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ae)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Ae=[new Me,new Me,new Me,new Me,new Me,new Me,new Me,new Me],Ee=new Me,Re=new Te,Ce=new Me,Pe=new Me,Le=new Me,Ie=new Me,Ne=new Me,Oe=new Me,De=new Me,Ue=new Me,Be=new Me,Fe=new Me;function ke(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){Fe.fromArray(t,s);const a=r.x*Math.abs(Fe.x)+r.y*Math.abs(Fe.y)+r.z*Math.abs(Fe.z),o=e.dot(Fe),l=n.dot(Fe),c=i.dot(Fe);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const ze=new Te,Ve=new Me,He=new Me;class Ge{constructor(t=new Me,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):ze.setFromPoints(t).getCenter(n);let i=0;for(let r=0,s=t.length;rthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Ve.subVectors(t,this.center);const e=Ve.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(Ve,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(He.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ve.copy(t.center).add(He)),this.expandByPoint(Ve.copy(t.center).sub(He))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const We=new Me,je=new Me,Xe=new Me,qe=new Me,Ye=new Me,Ke=new Me,Je=new Me;class Ze{constructor(t=new Me,e=new Me(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,We)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=We.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(We.copy(this.origin).addScaledVector(this.direction,e),We.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){je.copy(t).add(e).multiplyScalar(.5),Xe.copy(e).sub(t).normalize(),qe.copy(this.origin).sub(je);const r=.5*t.distanceTo(e),s=-this.direction.dot(Xe),a=qe.dot(this.direction),o=-qe.dot(Xe),l=qe.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*o-a,u=s*a-o,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*a)+u*(s*h+u+2*o)+l}else u=r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u<=-p?(h=Math.max(0,-(-s*r+a)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(s*r+a)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(je).addScaledVector(Xe,u),d}intersectSphere(t,e){We.subVectors(t.center,this.origin);const n=We.dot(this.direction),i=We.dot(We)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,a,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s=0?(a=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,We)}intersectTriangle(t,e,n,i,r){Ye.subVectors(e,t),Ke.subVectors(n,t),Je.crossVectors(Ye,Ke);let s,a=this.direction.dot(Je);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}qe.subVectors(this.origin,t);const o=s*this.direction.dot(Ke.crossVectors(qe,Ke));if(o<0)return null;const l=s*this.direction.dot(Ye.cross(qe));if(l<0)return null;if(o+l>a)return null;const c=-s*qe.dot(Je);return c<0?null:this.at(c/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class $e{constructor(t,e,n,i,r,s,a,o,l,c,h,u,d,p,m,f){$e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,m,f)}set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new $e).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Qe.setFromMatrixColumn(t,0).length(),r=1/Qe.setFromMatrixColumn(t,1).length(),s=1/Qe.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*a,e[4]=-s*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=s*c,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(en,t,nn)}lookAt(t,e,n){const i=this.elements;return an.subVectors(t,e),0===an.lengthSq()&&(an.z=1),an.normalize(),rn.crossVectors(n,an),0===rn.lengthSq()&&(1===Math.abs(n.z)?an.x+=1e-4:an.z+=1e-4,an.normalize(),rn.crossVectors(n,an)),rn.normalize(),sn.crossVectors(an,rn),i[0]=rn.x,i[4]=sn.x,i[8]=an.x,i[1]=rn.y,i[5]=sn.y,i[9]=an.y,i[2]=rn.z,i[6]=sn.z,i[10]=an.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],y=n[7],x=n[11],_=n[15],b=i[0],M=i[4],w=i[8],S=i[12],T=i[1],A=i[5],E=i[9],R=i[13],C=i[2],P=i[6],L=i[10],I=i[14],N=i[3],O=i[7],D=i[11],U=i[15];return r[0]=s*b+a*T+o*C+l*N,r[4]=s*M+a*A+o*P+l*O,r[8]=s*w+a*E+o*L+l*D,r[12]=s*S+a*R+o*I+l*U,r[1]=c*b+h*T+u*C+d*N,r[5]=c*M+h*A+u*P+d*O,r[9]=c*w+h*E+u*L+d*D,r[13]=c*S+h*R+u*I+d*U,r[2]=p*b+m*T+f*C+g*N,r[6]=p*M+m*A+f*P+g*O,r[10]=p*w+m*E+f*L+g*D,r[14]=p*S+m*R+f*I+g*U,r[3]=v*b+y*T+x*C+_*N,r[7]=v*M+y*A+x*P+_*O,r[11]=v*w+y*E+x*L+_*D,r[15]=v*S+y*R+x*I+_*U,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*l*h-r*a*u+n*l*u+i*a*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*s*u-i*s*d+i*l*c-r*o*c)+t[11]*(+e*l*h-e*a*d-r*s*h+n*s*d+r*a*c-n*l*c)+t[15]*(-i*a*c-e*o*h+e*a*u+i*s*h-n*s*u+n*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],m=t[13],f=t[14],g=t[15],v=h*f*l-m*u*l+m*o*d-a*f*d-h*o*g+a*u*g,y=p*u*l-c*f*l-p*o*d+s*f*d+c*o*g-s*u*g,x=c*m*l-p*h*l+p*a*d-s*m*d-c*a*g+s*h*g,_=p*h*o-c*m*o-p*a*u+s*m*u+c*a*f-s*h*f,b=e*v+n*y+i*x+r*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/b;return t[0]=v*M,t[1]=(m*u*r-h*f*r-m*i*d+n*f*d+h*i*g-n*u*g)*M,t[2]=(a*f*r-m*o*r+m*i*l-n*f*l-a*i*g+n*o*g)*M,t[3]=(h*o*r-a*u*r-h*i*l+n*u*l+a*i*d-n*o*d)*M,t[4]=y*M,t[5]=(c*f*r-p*u*r+p*i*d-e*f*d-c*i*g+e*u*g)*M,t[6]=(p*o*r-s*f*r-p*i*l+e*f*l+s*i*g-e*o*g)*M,t[7]=(s*u*r-c*o*r+c*i*l-e*u*l-s*i*d+e*o*d)*M,t[8]=x*M,t[9]=(p*h*r-c*m*r-p*n*d+e*m*d+c*n*g-e*h*g)*M,t[10]=(s*m*r-p*a*r+p*n*l-e*m*l-s*n*g+e*a*g)*M,t[11]=(c*a*r-s*h*r-c*n*l+e*h*l+s*n*d-e*a*d)*M,t[12]=_*M,t[13]=(c*m*i-p*h*i+p*n*u-e*m*u-c*n*f+e*h*f)*M,t[14]=(p*a*i-s*m*i-p*n*o+e*m*o+s*n*f-e*a*f)*M,t[15]=(s*h*i-c*a*i+c*n*o-e*h*o-s*n*u+e*a*u)*M,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*s,0,l*o-i*a,c*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,u=r*l,d=r*c,p=r*h,m=s*c,f=s*h,g=a*h,v=o*l,y=o*c,x=o*h,_=n.x,b=n.y,M=n.z;return i[0]=(1-(m+g))*_,i[1]=(d+x)*_,i[2]=(p-y)*_,i[3]=0,i[4]=(d-x)*b,i[5]=(1-(u+g))*b,i[6]=(f+v)*b,i[7]=0,i[8]=(p+y)*M,i[9]=(f-v)*M,i[10]=(1-(u+m))*M,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Qe.set(i[0],i[1],i[2]).length();const s=Qe.set(i[4],i[5],i[6]).length(),a=Qe.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],tn.copy(this);const o=1/r,l=1/s,c=1/a;return tn.elements[0]*=o,tn.elements[1]*=o,tn.elements[2]*=o,tn.elements[4]*=l,tn.elements[5]*=l,tn.elements[6]*=l,tn.elements[8]*=c,tn.elements[9]*=c,tn.elements[10]*=c,e.setFromRotationMatrix(tn),n.x=r,n.y=s,n.z=a,this}makePerspective(t,e,n,i,r,s,a=2e3){const o=this.elements,l=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i);let d,p;if(a===Rt)d=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(a!==Ct)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-s/(s-r),p=-s*r/(s-r)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,i,r,s,a=2e3){const o=this.elements,l=1/(e-t),c=1/(n-i),h=1/(s-r),u=(e+t)*l,d=(n+i)*c;let p,m;if(a===Rt)p=(s+r)*h,m=-2*h;else{if(a!==Ct)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=r*h,m=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=m,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Qe=new Me,tn=new $e,en=new Me(0,0,0),nn=new Me(1,1,1),rn=new Me,sn=new Me,an=new Me,on=new $e,ln=new be;class cn{constructor(t=0,e=0,n=0,i=cn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],a=i[8],o=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(Dt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Dt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Dt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Dt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Dt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Dt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return on.makeRotationFromQuaternion(t),this.setFromRotationMatrix(on,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ln.setFromEuler(this),this.setFromQuaternion(ln,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}cn.DEFAULT_ORDER="XYZ";class hn{constructor(){this.mask=1}set(t){this.mask=1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(n=n.concat(r))}return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gn,t,vn),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gn,yn,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Tn.subVectors(i,e),An.subVectors(n,e),En.subVectors(t,e);const s=Tn.dot(Tn),a=Tn.dot(An),o=Tn.dot(En),l=An.dot(An),c=An.dot(En),h=s*l-a*a;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*o-a*c)*u,p=(s*c-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Rn),Rn.x>=0&&Rn.y>=0&&Rn.x+Rn.y<=1}static getUV(t,e,n,i,r,s,a,o){return!1===Dn&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Dn=!0),this.getInterpolation(t,e,n,i,r,s,a,o)}static getInterpolation(t,e,n,i,r,s,a,o){return this.getBarycoord(t,e,n,i,Rn),o.setScalar(0),o.addScaledVector(r,Rn.x),o.addScaledVector(s,Rn.y),o.addScaledVector(a,Rn.z),o}static isFrontFacing(t,e,n,i){return Tn.subVectors(n,e),An.subVectors(t,e),Tn.cross(An).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Tn.subVectors(this.c,this.b),An.subVectors(this.a,this.b),.5*Tn.cross(An).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Un.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Un.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return!1===Dn&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Dn=!0),Un.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}getInterpolation(t,e,n,i,r){return Un.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return Un.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Un.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,a;Cn.subVectors(i,n),Pn.subVectors(r,n),In.subVectors(t,n);const o=Cn.dot(In),l=Pn.dot(In);if(o<=0&&l<=0)return e.copy(n);Nn.subVectors(t,i);const c=Cn.dot(Nn),h=Pn.dot(Nn);if(c>=0&&h<=c)return e.copy(i);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return s=o/(o-c),e.copy(n).addScaledVector(Cn,s);On.subVectors(t,r);const d=Cn.dot(On),p=Pn.dot(On);if(p>=0&&d<=p)return e.copy(r);const m=d*l-o*p;if(m<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(n).addScaledVector(Pn,a);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return Ln.subVectors(r,i),a=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(Ln,a);const g=1/(f+m+u);return s=m*g,a=u*g,e.copy(n).addScaledVector(Cn,s).addScaledVector(Pn,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Bn=0;class Fn extends Pt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Bn++}),this.uuid=Ot(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=c,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=gt,this.stencilZFail=gt,this.stencilZPass=gt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=this.alphaHash),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}const kn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},zn={h:0,s:0,l:0},Vn={h:0,s:0,l:0};function Hn(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}class Gn{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=pt){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,le.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=le.workingColorSpace){return this.r=t,this.g=e,this.b=n,le.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=le.workingColorSpace){if(t=Ut(t,1),e=Dt(e,0,1),n=Dt(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=Hn(r,i,t+1/3),this.g=Hn(r,i,t),this.b=Hn(r,i,t-1/3)}return le.toWorkingColorSpace(this,i),this}setStyle(t,e=pt){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(n,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=pt){const n=kn[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ne(t.r),this.g=ne(t.g),this.b=ne(t.b),this}copyLinearToSRGB(t){return this.r=ie(t.r),this.g=ie(t.g),this.b=ie(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=pt){return le.fromWorkingColorSpace(Wn.copy(this),t),65536*Math.round(Dt(255*Wn.r,0,255))+256*Math.round(Dt(255*Wn.g,0,255))+Math.round(Dt(255*Wn.b,0,255))}getHexString(t=pt){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=le.workingColorSpace){le.fromWorkingColorSpace(Wn.copy(this),e);const n=Wn.r,i=Wn.g,r=Wn.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let o,l;const c=(a+s)/2;if(a===s)o=0,l=0;else{const t=s-a;switch(l=c<=.5?t/(s+a):t/(2-s-a),s){case n:o=(i-r)/t+(i0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const o in n){const e=n[o];t.data.attributes[o]=e.toJSON(t.data)}const i={};let r=!1;for(const o in this.morphAttributes){const e=this.morphAttributes[o],n=[];for(let i=0,r=e.length;i0&&(i[o]=n,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const l in i){const t=i[l];this.setAttribute(l,t.clone(e))}const r=t.morphAttributes;for(const l in r){const t=[],n=r[l];for(let i=0,r=n.length;i0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t(t.far-t.near)**2)return}ai.copy(r).invert(),oi.copy(t.ray).applyMatrix4(ai),null!==n.boundingBox&&!1===oi.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,oi)}}_computeIntersections(t,e,n){let i;const r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(s))for(let p=0,m=u.length;pn.far?null:{distance:c,point:Mi.clone(),object:t}}(t,e,n,i,hi,ui,di,bi);if(h){r&&(fi.fromBufferAttribute(r,o),gi.fromBufferAttribute(r,l),vi.fromBufferAttribute(r,c),h.uv=Un.getInterpolation(bi,hi,ui,di,fi,gi,vi,new Xt)),s&&(fi.fromBufferAttribute(s,o),gi.fromBufferAttribute(s,l),vi.fromBufferAttribute(s,c),h.uv1=Un.getInterpolation(bi,hi,ui,di,fi,gi,vi,new Xt),h.uv2=h.uv1),a&&(yi.fromBufferAttribute(a,o),xi.fromBufferAttribute(a,l),_i.fromBufferAttribute(a,c),h.normal=Un.getInterpolation(bi,hi,ui,di,yi,xi,_i,new Me),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const t={a:o,b:l,c:c,normal:new Me,materialIndex:0};Un.getNormal(hi,ui,di,t.normal),h.face=t}return h}class Ti extends si{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,m,f,g,v){const y=s/f,x=p/g,_=s/2,b=p/2,M=m/2,w=f+1,S=g+1;let T=0,A=0;const E=new Me;for(let a=0;a0?1:-1,c.push(E.x,E.y,E.z),h.push(o/f),h.push(1-a/g),T+=1}}for(let a=0;a0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const i in this.extensions)!0===this.extensions[i]&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class Li extends Sn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new $e,this.projectionMatrix=new $e,this.projectionMatrixInverse=new $e,this.coordinateSystem=Rt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}class Ii extends Li{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Nt*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*It*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Nt*Math.atan(Math.tan(.5*It*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*It*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Ni=-90;class Oi extends Sn{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null;const i=new Ii(Ni,1,t,e);i.layers=this.layers,this.add(i);const r=new Ii(Ni,1,t,e);r.layers=this.layers,this.add(r);const s=new Ii(Ni,1,t,e);s.layers=this.layers,this.add(s);const a=new Ii(Ni,1,t,e);a.layers=this.layers,this.add(a);const o=new Ii(Ni,1,t,e);o.layers=this.layers,this.add(o);const l=new Ii(Ni,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,s,a,o]=e;for(const l of e)this.remove(l);if(t===Rt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==Ct)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const l of e)this.add(l),l.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[i,r,s,a,o,l]=this.children,c=t.getRenderTarget(),h=t.xr.enabled;t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,a),t.setRenderTarget(n,4),t.render(e,o),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(c),t.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}class Di extends fe{constructor(t,e,n,i,r,s,a,o,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:I,n,i,r,s,a,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Ui extends ye{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];void 0!==e.encoding&&(ee("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),e.colorSpace=e.encoding===dt?pt:""),this.texture=new Di(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:G}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new Ti(5,5,5),a=new Pi({name:"CubemapFromEquirect",uniforms:Ai(n),vertexShader:i,fragmentShader:r,side:1,blending:0});a.uniforms.tEquirect.value=e;const o=new wi(s,a),l=e.minFilter;return e.minFilter===j&&(e.minFilter=G),new Oi(1,10,this).update(t,o),e.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,n,i);t.setRenderTarget(r)}}const Bi=new Me,Fi=new Me,ki=new qt;let zi=class{constructor(t=new Me(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Bi.subVectors(n,e).cross(Fi.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Bi),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||ki.getNormalMatrix(t),i=this.coplanarPoint(Bi).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}};const Vi=new Ge,Hi=new Me;class Gi{constructor(t=new zi,e=new zi,n=new zi,i=new zi,r=new zi,s=new zi){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=2e3){const n=this.planes,i=t.elements,r=i[0],s=i[1],a=i[2],o=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],m=i[10],f=i[11],g=i[12],v=i[13],y=i[14],x=i[15];if(n[0].setComponents(o-r,u-l,f-d,x-g).normalize(),n[1].setComponents(o+r,u+l,f+d,x+g).normalize(),n[2].setComponents(o+s,u+c,f+p,x+v).normalize(),n[3].setComponents(o-s,u-c,f-p,x-v).normalize(),n[4].setComponents(o-a,u-h,f-m,x-y).normalize(),e===Rt)n[5].setComponents(o+a,u+h,f+m,x+y).normalize();else{if(e!==Ct)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(a,h,m,y).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Vi.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Vi.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Vi)}intersectsSprite(t){return Vi.center.set(0,0,0),Vi.radius=.7071067811865476,Vi.applyMatrix4(t.matrixWorld),this.intersectsSphere(Vi)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(n)0?t.max.x:t.min.x,Hi.y=i.normal.y>0?t.max.y:t.min.y,Hi.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Hi)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Wi(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function ji(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Yi={common:{diffuse:{value:new Gn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qt},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qt},normalScale:{value:new Xt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Gn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Gn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0},uvTransform:{value:new qt}},sprite:{diffuse:{value:new Gn(16777215)},opacity:{value:1},center:{value:new Xt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qt},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0}}},Ki={basic:{uniforms:Ei([Yi.common,Yi.specularmap,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.fog]),vertexShader:qi.meshbasic_vert,fragmentShader:qi.meshbasic_frag},lambert:{uniforms:Ei([Yi.common,Yi.specularmap,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.fog,Yi.lights,{emissive:{value:new Gn(0)}}]),vertexShader:qi.meshlambert_vert,fragmentShader:qi.meshlambert_frag},phong:{uniforms:Ei([Yi.common,Yi.specularmap,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.fog,Yi.lights,{emissive:{value:new Gn(0)},specular:{value:new Gn(1118481)},shininess:{value:30}}]),vertexShader:qi.meshphong_vert,fragmentShader:qi.meshphong_frag},standard:{uniforms:Ei([Yi.common,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.roughnessmap,Yi.metalnessmap,Yi.fog,Yi.lights,{emissive:{value:new Gn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:qi.meshphysical_vert,fragmentShader:qi.meshphysical_frag},toon:{uniforms:Ei([Yi.common,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.gradientmap,Yi.fog,Yi.lights,{emissive:{value:new Gn(0)}}]),vertexShader:qi.meshtoon_vert,fragmentShader:qi.meshtoon_frag},matcap:{uniforms:Ei([Yi.common,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.fog,{matcap:{value:null}}]),vertexShader:qi.meshmatcap_vert,fragmentShader:qi.meshmatcap_frag},points:{uniforms:Ei([Yi.points,Yi.fog]),vertexShader:qi.points_vert,fragmentShader:qi.points_frag},dashed:{uniforms:Ei([Yi.common,Yi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qi.linedashed_vert,fragmentShader:qi.linedashed_frag},depth:{uniforms:Ei([Yi.common,Yi.displacementmap]),vertexShader:qi.depth_vert,fragmentShader:qi.depth_frag},normal:{uniforms:Ei([Yi.common,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,{opacity:{value:1}}]),vertexShader:qi.meshnormal_vert,fragmentShader:qi.meshnormal_frag},sprite:{uniforms:Ei([Yi.sprite,Yi.fog]),vertexShader:qi.sprite_vert,fragmentShader:qi.sprite_frag},background:{uniforms:{uvTransform:{value:new qt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:qi.background_vert,fragmentShader:qi.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:qi.backgroundCube_vert,fragmentShader:qi.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:qi.cube_vert,fragmentShader:qi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qi.equirect_vert,fragmentShader:qi.equirect_frag},distanceRGBA:{uniforms:Ei([Yi.common,Yi.displacementmap,{referencePosition:{value:new Me},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qi.distanceRGBA_vert,fragmentShader:qi.distanceRGBA_frag},shadow:{uniforms:Ei([Yi.lights,Yi.fog,{color:{value:new Gn(0)},opacity:{value:1}}]),vertexShader:qi.shadow_vert,fragmentShader:qi.shadow_frag}};Ki.physical={uniforms:Ei([Ki.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qt},clearcoatNormalScale:{value:new Xt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qt},sheen:{value:0},sheenColor:{value:new Gn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qt},transmissionSamplerSize:{value:new Xt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qt},attenuationDistance:{value:0},attenuationColor:{value:new Gn(0)},specularColor:{value:new Gn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qt},anisotropyVector:{value:new Xt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qt}}]),vertexShader:qi.meshphysical_vert,fragmentShader:qi.meshphysical_frag};const Ji={r:0,b:0,g:0};function Zi(t,e,n,i,r,s,a){const o=new Gn(0);let l,c,h=!0===s?0:1,u=null,d=0,p=null;function m(e,n){e.getRGB(Ji,Ri(t)),i.buffers.color.setClear(Ji.r,Ji.g,Ji.b,n,a)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),h=e,m(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,m(o,h)},render:function(s,f){let g=!1,v=!0===f.isScene?f.background:null;v&&v.isTexture&&(v=(f.backgroundBlurriness>0?n:e).get(v)),null===v?m(o,h):v&&v.isColor&&(m(v,1),g=!0);const y=t.xr.getEnvironmentBlendMode();"additive"===y?i.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===y&&i.buffers.color.setClear(0,0,0,0,a),(t.autoClear||g)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),v&&(v.isCubeTexture||v.mapping===U)?(void 0===c&&(c=new wi(new Ti(1,1,1),new Pi({name:"BackgroundCubeMaterial",uniforms:Ai(Ki.backgroundCube.uniforms),vertexShader:Ki.backgroundCube.vertexShader,fragmentShader:Ki.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),c.material.uniforms.envMap.value=v,c.material.uniforms.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=f.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,c.material.toneMapped=v.colorSpace!==pt,u===v&&d===v.version&&p===t.toneMapping||(c.material.needsUpdate=!0,u=v,d=v.version,p=t.toneMapping),c.layers.enableAll(),s.unshift(c,c.geometry,c.material,0,0,null)):v&&v.isTexture&&(void 0===l&&(l=new wi(new Xi(2,2),new Pi({name:"BackgroundMaterial",uniforms:Ai(Ki.background.uniforms),vertexShader:Ki.background.vertexShader,fragmentShader:Ki.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=v,l.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,l.material.toneMapped=v.colorSpace!==pt,!0===v.matrixAutoUpdate&&v.updateMatrix(),l.material.uniforms.uvTransform.value.copy(v.matrix),u===v&&d===v.version&&p===t.toneMapping||(l.material.needsUpdate=!0,u=v,d=v.version,p=t.toneMapping),l.layers.enableAll(),s.unshift(l,l.geometry,l.material,0,0,null))}}}function $i(t,e,n,i){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||null!==s,o={},l=p(null);let c=l,h=!1;function u(e){return i.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function d(e){return i.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function p(t){const e=[],n=[],i=[];for(let s=0;s=0){const e=r[l];let n=s[l];if(void 0===n&&("instanceMatrix"===l&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===l&&t.instanceColor&&(n=t.instanceColor)),void 0===e)return!0;if(e.attribute!==n)return!0;if(n&&e.data!==n.data)return!0;a++}return c.attributesNum!==a||c.index!==i}(r,x,d,_),b&&function(t,e,n,i){const r={},s=e.attributes;let a=0;const o=n.getAttributes();for(const l in o)if(o[l].location>=0){let e=s[l];void 0===e&&("instanceMatrix"===l&&t.instanceMatrix&&(e=t.instanceMatrix),"instanceColor"===l&&t.instanceColor&&(e=t.instanceColor));const n={};n.attribute=e,e&&e.data&&(n.data=e.data),r[l]=n,a++}c.attributes=r,c.attributesNum=a,c.index=i}(r,x,d,_)}else{const t=!0===l.wireframe;c.geometry===x.id&&c.program===d.id&&c.wireframe===t||(c.geometry=x.id,c.program=d.id,c.wireframe=t,b=!0)}null!==_&&n.update(_,t.ELEMENT_ARRAY_BUFFER),(b||h)&&(h=!1,function(r,s,a,o){if(!1===i.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;m();const l=o.attributes,c=a.getAttributes(),h=s.defaultAttributeValues;for(const e in c){const s=c[e];if(s.location>=0){let a=l[e];if(void 0===a&&("instanceMatrix"===e&&r.instanceMatrix&&(a=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(a=r.instanceColor)),void 0!==a){const e=a.normalized,l=a.itemSize,c=n.get(a);if(void 0===c)continue;const h=c.buffer,u=c.type,d=c.bytesPerElement,p=!0===i.isWebGL2&&(u===t.INT||u===t.UNSIGNED_INT||1013===a.gpuType);if(a.isInterleavedBufferAttribute){const n=a.data,i=n.stride,c=a.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name;let a=void 0!==n.precision?n.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=s||e.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),m=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),g=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),y=u>0,x=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:s?t.getParameter(t.MAX_SAMPLES):0}}function er(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new zi,o=new qt,l={value:null,needsUpdate:!1};function c(t,n,i,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length0),e.numPlanes=i,e.numIntersection=0);else{const t=s?0:i,e=4*t;let r=m.clippingState||null;l.value=r,r=c(u,o,e,h);for(let i=0;i!==e;++i)r[i]=n[i];m.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function nr(t){let e=new WeakMap;function n(t,e){return e===O?t.mapping=I:e===D&&(t.mapping=N),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const s=r.mapping;if(s===O||s===D){if(e.has(r))return n(e.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const a=new Ui(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}class ir extends Li{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const rr=[.125,.215,.35,.446,.526,.582],sr=new ir,ar=new Gn;let or=null;const lr=(1+Math.sqrt(5))/2,cr=1/lr,hr=[new Me(1,1,1),new Me(-1,1,1),new Me(1,1,-1),new Me(-1,1,-1),new Me(0,lr,cr),new Me(0,lr,-cr),new Me(cr,0,lr),new Me(-cr,0,lr),new Me(lr,cr,0),new Me(-lr,cr,0)];class ur{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){or=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=fr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=mr(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;tt-4?o=rr[a-t+4-1]:0===a&&(o=0),i.push(o);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,m=3,f=2,g=1,v=new Float32Array(m*p*d),y=new Float32Array(f*p*d),x=new Float32Array(g*p*d);for(let t=0;t2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];v.set(i,m*p*t),y.set(u,f*p*t);const r=[t,t,t,t,t,t];x.set(r,g*p*t)}const _=new si;_.setAttribute("position",new Yn(v,m)),_.setAttribute("uv",new Yn(y,f)),_.setAttribute("faceIndex",new Yn(x,g)),e.push(_),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(20),r=new Me(0,1,0);return new Pi({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,t,e)}return i}_compileMaterial(t){const e=new wi(this._lodPlanes[0],t);this._renderer.compile(e,sr)}_sceneToCubeUV(t,e,n,i){const r=new Ii(90,1,e,n),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(ar),o.toneMapping=A,o.autoClear=!1;const h=new jn({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),u=new wi(new Ti,h);let d=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,d=!0):(h.color.copy(ar),d=!0);for(let m=0;m<6;m++){const e=m%3;0===e?(r.up.set(0,s[m],0),r.lookAt(a[m],0,0)):1===e?(r.up.set(0,0,s[m]),r.lookAt(0,a[m],0)):(r.up.set(0,s[m],0),r.lookAt(0,0,a[m]));const n=this._cubeSize;pr(i,e*n,m>2?n:0,n,n),o.setRenderTarget(i),d&&o.render(u,r),o.render(t,r)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=c,o.autoClear=l,t.background=p}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===I||t.mapping===N;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=fr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=mr());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new wi(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const a=this._cubeSize;pr(e,0,0,3*a,2*a),n.setRenderTarget(e),n.render(s,sr)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let i=1;i20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let x=0;x<20;++x){const t=x/p,e=Math.exp(-t*t/2);f.push(e),0===x?g+=e:xv-4?i-v+4:0),4*(this._cubeSize-y),3*y,2*y),o.setRenderTarget(e),o.render(c,sr)}}function dr(t,e,n){const i=new ye(t,e,n);return i.texture.mapping=U,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function pr(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function mr(){return new Pi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function fr(){return new Pi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function gr(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,a=s===O||s===D,o=s===I||s===N;if(a||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=e.get(r);return null===n&&(n=new ur(t)),i=a?n.fromEquirectangular(r,i):n.fromCubemap(r,i),e.set(r,i),i.texture}if(e.has(r))return e.get(r).texture;{const s=r.image;if(a&&s&&s.height>0||o&&s&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(s)){null===n&&(n=new ur(t));const s=a?n.fromEquirectangular(r):n.fromCubemap(r);return e.set(r,s),r.addEventListener("dispose",i),s.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function vr(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function yr(t,e,n,i){const r={},s=new WeakMap;function a(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const n in o.attributes)e.remove(o.attributes[n]);for(const n in o.morphAttributes){const t=o.morphAttributes[n];for(let n=0,i=t.length;ne.maxTextureSize&&(f=Math.ceil(m/e.maxTextureSize),m=e.maxTextureSize);const g=new Float32Array(m*f*4*r),v=new xe(g,m,f,r);v.type=K,v.needsUpdate=!0;const y=4*p;for(let e=0;e0)return t;const r=e*n;let s=Cr[r];if(void 0===s&&(s=new Float32Array(r),Cr[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function Dr(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n":" "} ${t}: ${n[a]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function Is(t,e){const n=function(t){switch(t){case mt:return["Linear","( value )"];case pt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Ns(t,e){let n;switch(e){case E:n="Linear";break;case R:n="Reinhard";break;case C:n="OptimizedCineon";break;case P:n="ACESFilmic";break;case L:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Os(t){return""!==t}function Ds(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Us(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Bs=/^[ \t]*#include +<([\w\d./]+)>/gm;function Fs(t){return t.replace(Bs,zs)}const ks=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function zs(t,e){let n=qi[e];if(void 0===n){const t=ks.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");n=qi[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return Fs(n)}const Vs=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Hs(t){return t.replace(Vs,Gs)}function Gs(t,e,n,i){let r="";for(let s=parseInt(e);s0&&(x+="\n"),_=[g,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v].filter(Os).join("\n"),_.length>0&&(_+="\n")):(x=[Ws(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Os).join("\n"),_=[g,Ws(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",n.envMap?"#define "+m:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==A?"#define TONE_MAPPING":"",n.toneMapping!==A?qi.tonemapping_pars_fragment:"",n.toneMapping!==A?Ns("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",qi.colorspace_pars_fragment,Is("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Os).join("\n")),c=Fs(c),c=Ds(c,n),c=Us(c,n),h=Fs(h),h=Ds(h,n),h=Us(h,n),c=Hs(c),h=Hs(h),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,_=["#define varying in",n.glslVersion===At?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===At?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+_);const M=b+x+c,E=b+_+h,R=Cs(o,o.VERTEX_SHADER,M),C=Cs(o,o.FRAGMENT_SHADER,E);if(o.attachShader(y,R),o.attachShader(y,C),void 0!==n.index0AttributeName?o.bindAttribLocation(y,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(y,0,"position"),o.linkProgram(y),t.debug.checkShaderErrors){const e=o.getProgramInfoLog(y).trim(),n=o.getShaderInfoLog(R).trim(),i=o.getShaderInfoLog(C).trim();let r=!0,s=!0;if(!1===o.getProgramParameter(y,o.LINK_STATUS))if(r=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(o,y,R,C);else{const t=Ls(o,R,"vertex"),n=Ls(o,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(y,o.VALIDATE_STATUS)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==n&&""!==i||(s=!1);s&&(this.diagnostics={runnable:r,programLog:e,vertexShader:{log:n,prefix:x},fragmentShader:{log:i,prefix:_}})}let P,L;return o.deleteShader(R),o.deleteShader(C),this.getUniforms=function(){return void 0===P&&(P=new Rs(o,y)),P},this.getAttributes=function(){return void 0===L&&(L=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r0,q=s.clearcoat>0,Y=s.iridescence>0,K=s.sheen>0,J=s.transmission>0,Z=X&&!!s.anisotropyMap,$=q&&!!s.clearcoatMap,Q=q&&!!s.clearcoatNormalMap,tt=q&&!!s.clearcoatRoughnessMap,et=Y&&!!s.iridescenceMap,nt=Y&&!!s.iridescenceThicknessMap,it=K&&!!s.sheenColorMap,rt=K&&!!s.sheenRoughnessMap,st=!!s.specularMap,at=!!s.specularColorMap,ot=!!s.specularIntensityMap,lt=J&&!!s.transmissionMap,ct=J&&!!s.thicknessMap,ht=!!s.gradientMap,ut=!!s.alphaMap,dt=s.alphaTest>0,ft=!!s.alphaHash,gt=!!s.extensions,vt=!!x.attributes.uv1,yt=!!x.attributes.uv2,xt=!!x.attributes.uv3;let _t=A;return s.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(_t=t.toneMapping)),{isWebGL2:h,shaderID:w,shaderType:s.type,shaderName:s.name,vertexShader:E,fragmentShader:R,defines:s.defines,customVertexShaderID:C,customFragmentShaderID:P,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:N,instancingColor:N&&null!==v.instanceColor,supportsVertexTextures:d,outputColorSpace:null===I?t.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:mt,map:O,matcap:D,envMap:B,envMapMode:B&&b.mapping,envMapCubeUVHeight:M,aoMap:F,lightMap:k,bumpMap:z,normalMap:V,displacementMap:d&&H,emissiveMap:G,normalMapObjectSpace:V&&1===s.normalMapType,normalMapTangentSpace:V&&0===s.normalMapType,metalnessMap:W,roughnessMap:j,anisotropy:X,anisotropyMap:Z,clearcoat:q,clearcoatMap:$,clearcoatNormalMap:Q,clearcoatRoughnessMap:tt,iridescence:Y,iridescenceMap:et,iridescenceThicknessMap:nt,sheen:K,sheenColorMap:it,sheenRoughnessMap:rt,specularMap:st,specularColorMap:at,specularIntensityMap:ot,transmission:J,transmissionMap:lt,thicknessMap:ct,gradientMap:ht,opaque:!1===s.transparent&&1===s.blending,alphaMap:ut,alphaTest:dt,alphaHash:ft,combine:s.combine,mapUv:O&&f(s.map.channel),aoMapUv:F&&f(s.aoMap.channel),lightMapUv:k&&f(s.lightMap.channel),bumpMapUv:z&&f(s.bumpMap.channel),normalMapUv:V&&f(s.normalMap.channel),displacementMapUv:H&&f(s.displacementMap.channel),emissiveMapUv:G&&f(s.emissiveMap.channel),metalnessMapUv:W&&f(s.metalnessMap.channel),roughnessMapUv:j&&f(s.roughnessMap.channel),anisotropyMapUv:Z&&f(s.anisotropyMap.channel),clearcoatMapUv:$&&f(s.clearcoatMap.channel),clearcoatNormalMapUv:Q&&f(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:tt&&f(s.clearcoatRoughnessMap.channel),iridescenceMapUv:et&&f(s.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&f(s.iridescenceThicknessMap.channel),sheenColorMapUv:it&&f(s.sheenColorMap.channel),sheenRoughnessMapUv:rt&&f(s.sheenRoughnessMap.channel),specularMapUv:st&&f(s.specularMap.channel),specularColorMapUv:at&&f(s.specularColorMap.channel),specularIntensityMapUv:ot&&f(s.specularIntensityMap.channel),transmissionMapUv:lt&&f(s.transmissionMap.channel),thicknessMapUv:ct&&f(s.thicknessMap.channel),alphaMapUv:ut&&f(s.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(V||X),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,vertexUv1s:vt,vertexUv2s:yt,vertexUv3s:xt,pointsUvs:!0===v.isPoints&&!!x.attributes.uv&&(O||ut),fog:!!y,useFog:!0===s.fog,fogExp2:y&&y.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:T,morphTextureStride:L,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.length>0,shadowMapType:t.shadowMap.type,toneMapping:_t,useLegacyLights:t._useLegacyLights,decodeVideoTexture:O&&!0===s.map.isVideoTexture&&s.map.colorSpace===pt,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:gt&&!0===s.extensions.derivatives,extensionFragDepth:gt&&!0===s.extensions.fragDepth,extensionDrawBuffers:gt&&!0===s.extensions.drawBuffers,extensionShaderTextureLOD:gt&&!0===s.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0),e.supportsVertexTextures&&o.enable(1),e.instancing&&o.enable(2),e.instancingColor&&o.enable(3),e.matcap&&o.enable(4),e.envMap&&o.enable(5),e.normalMapObjectSpace&&o.enable(6),e.normalMapTangentSpace&&o.enable(7),e.clearcoat&&o.enable(8),e.iridescence&&o.enable(9),e.alphaTest&&o.enable(10),e.vertexColors&&o.enable(11),e.vertexAlphas&&o.enable(12),e.vertexUv1s&&o.enable(13),e.vertexUv2s&&o.enable(14),e.vertexUv3s&&o.enable(15),e.vertexTangents&&o.enable(16),e.anisotropy&&o.enable(17),t.push(o.mask),o.disableAll(),e.fog&&o.enable(0),e.useFog&&o.enable(1),e.flatShading&&o.enable(2),e.logarithmicDepthBuffer&&o.enable(3),e.skinning&&o.enable(4),e.morphTargets&&o.enable(5),e.morphNormals&&o.enable(6),e.morphColors&&o.enable(7),e.premultipliedAlpha&&o.enable(8),e.shadowMapEnabled&&o.enable(9),e.useLegacyLights&&o.enable(10),e.doubleSided&&o.enable(11),e.flipSided&&o.enable(12),e.useDepthPacking&&o.enable(13),e.dithering&&o.enable(14),e.transmission&&o.enable(15),e.sheen&&o.enable(16),e.opaque&&o.enable(17),e.pointsUvs&&o.enable(18),e.decodeVideoTexture&&o.enable(19),t.push(o.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=m[t.type];let n;if(e){const t=Ki[e];n=Ci.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,r=c.length;t0?i.push(h):!0===a.transparent?r.push(h):n.push(h)},unshift:function(t,e,a,o,l,c){const h=s(t,e,a,o,l,c);a.transmission>0?i.unshift(h):!0===a.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n1&&n.sort(t||Zs),i.length>1&&i.sort(e||$s),r.length>1&&r.sort(e||$s)}}}function ta(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new Qs,t.set(e,[r])):n>=i.length?(r=new Qs,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}}function ea(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Me,color:new Gn};break;case"SpotLight":n={position:new Me,direction:new Me,color:new Gn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Me,color:new Gn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Me,skyColor:new Gn,groundColor:new Gn};break;case"RectAreaLight":n={color:new Gn,position:new Me,halfWidth:new Me,halfHeight:new Me}}return t[e.id]=n,n}}}let na=0;function ia(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function ra(t,e){const n=new ea,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let l=0;l<9;l++)r.probe.push(new Me);const s=new Me,a=new $e,o=new $e;return{setup:function(s,a){let o=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,d=0,p=0,m=0,f=0,g=0,v=0,y=0,x=0;s.sort(ia);const _=!0===a?Math.PI:1;for(let t=0,e=s.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Yi.LTC_FLOAT_1,r.rectAreaLTC2=Yi.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Yi.LTC_HALF_1,r.rectAreaLTC2=Yi.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=c;const b=r.hash;b.directionalLength===h&&b.pointLength===u&&b.spotLength===d&&b.rectAreaLength===p&&b.hemiLength===m&&b.numDirectionalShadows===f&&b.numPointShadows===g&&b.numSpotShadows===v&&b.numSpotMaps===y||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=m,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=v+y-x,r.spotLightMap.length=y,r.numSpotLightShadowsWithMaps=x,b.directionalLength=h,b.pointLength=u,b.spotLength=d,b.rectAreaLength=p,b.hemiLength=m,b.numDirectionalShadows=f,b.numPointShadows=g,b.numSpotShadows=v,b.numSpotMaps=y,r.version=na++)},setupView:function(t,e){let n=0,i=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let d=0,p=t.length;d=s.length?(a=new sa(t,e),s.push(a)):a=s[r],a},dispose:function(){n=new WeakMap}}}class oa extends Fn{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class la extends Fn{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function ca(t,e,n){let r=new Gi;const c=new Xt,h=new Xt,u=new ge,d=new oa({depthPacking:3201}),p=new la,m={},f=n.maxTextureSize,g={[a]:1,[o]:0,[l]:2},v=new Pi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Xt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),y=v.clone();y.defines.HORIZONTAL_PASS=1;const x=new si;x.setAttribute("position",new Yn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new wi(x,v),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=i;let M=this.type;function w(n,i){const r=e.update(_);v.defines.VSM_SAMPLES!==n.blurSamples&&(v.defines.VSM_SAMPLES=n.blurSamples,y.defines.VSM_SAMPLES=n.blurSamples,v.needsUpdate=!0,y.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new ye(c.x,c.y)),v.uniforms.shadow_pass.value=n.map.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,v,_,null),y.uniforms.shadow_pass.value=n.mapPass.texture,y.uniforms.resolution.value=n.mapSize,y.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,y,_,null)}function S(e,n,i,r){let a=null;const o=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?p:d,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const t=a.uuid,e=n.uuid;let i=m[t];void 0===i&&(i={},m[t]=i);let r=i[e];void 0===r&&(r=a.clone(),i[e]=r),a=r}return a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===s?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:g[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(t.properties.get(a).light=i),a}function T(n,i,a,o,l){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&l===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let s=0,c=e.length;sf||c.y>f)&&(c.x>f&&(h.x=Math.floor(f/l.x),c.x=h.x*l.x,o.mapSize.x=h.x),c.y>f&&(h.y=Math.floor(f/l.y),c.y=h.y*l.y,o.mapSize.y=h.y)),null===o.map||!0===p||!0===m){const t=this.type!==s?{minFilter:z,magFilter:z}:{};null!==o.map&&o.map.dispose(),o.map=new ye(c.x,c.y,t),o.map.texture.name=a.name+".shadowMap",o.camera.updateProjectionMatrix()}t.setRenderTarget(o.map),t.clear();const v=o.getViewportCount();for(let t=0;t=1):-1!==j.indexOf("OpenGL ES")&&(W=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),G=W>=2);let X=null,q={};const Y=t.getParameter(t.SCISSOR_BOX),K=t.getParameter(t.VIEWPORT),J=(new ge).fromArray(Y),Z=(new ge).fromArray(K);function $(e,n,r,s){const a=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let l=0;li||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?zt:Math.floor,s=i(r*t.width),a=i(r*t.height);void 0===f&&(f=y(s,a));const o=n?y(s,a):f;return o.width=s,o.height=a,o.getContext("2d").drawImage(t,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+a+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function _(t){return Ft(t.width)&&Ft(t.height)}function b(t,e){return t.generateMipmaps&&e&&t.minFilter!==z&&t.minFilter!==G}function M(e){t.generateMipmap(e)}function w(n,i,r,s,a=!1){if(!1===o)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return i===t.RED&&(r===t.FLOAT&&(l=t.R32F),r===t.HALF_FLOAT&&(l=t.R16F),r===t.UNSIGNED_BYTE&&(l=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(l=t.R8UI),r===t.UNSIGNED_SHORT&&(l=t.R16UI),r===t.UNSIGNED_INT&&(l=t.R32UI),r===t.BYTE&&(l=t.R8I),r===t.SHORT&&(l=t.R16I),r===t.INT&&(l=t.R32I)),i===t.RG&&(r===t.FLOAT&&(l=t.RG32F),r===t.HALF_FLOAT&&(l=t.RG16F),r===t.UNSIGNED_BYTE&&(l=t.RG8)),i===t.RGBA&&(r===t.FLOAT&&(l=t.RGBA32F),r===t.HALF_FLOAT&&(l=t.RGBA16F),r===t.UNSIGNED_BYTE&&(l=s===pt&&!1===a?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(l=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(l=t.RGB5_A1)),l!==t.R16F&&l!==t.R32F&&l!==t.RG16F&&l!==t.RG32F&&l!==t.RGBA16F&&l!==t.RGBA32F||e.get("EXT_color_buffer_float"),l}function S(t,e,n){return!0===b(t,n)||t.isFramebufferTexture&&t.minFilter!==z&&t.minFilter!==G?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function T(e){return e===z||e===V||e===H?t.NEAREST:t.LINEAR}function A(t){const e=t.target;e.removeEventListener("dispose",A),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=g.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&R(t),0===Object.keys(r).length&&g.delete(n)}i.remove(t)}(e),e.isVideoTexture&&m.delete(e)}function E(e){const n=e.target;n.removeEventListener("dispose",E),function(e){const n=e.texture,r=i.get(e),s=i.get(n);if(void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),a.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let i=0;i<6;i++){if(Array.isArray(r.__webglFramebuffer[i]))for(let e=0;e0&&s.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void U(s,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(t.TEXTURE_2D,s.__webglTexture,t.TEXTURE0+r)}const L={[B]:t.REPEAT,[F]:t.CLAMP_TO_EDGE,[k]:t.MIRRORED_REPEAT},I={[z]:t.NEAREST,[V]:t.NEAREST_MIPMAP_NEAREST,[H]:t.NEAREST_MIPMAP_LINEAR,[G]:t.LINEAR,[W]:t.LINEAR_MIPMAP_NEAREST,[j]:t.LINEAR_MIPMAP_LINEAR},N={[vt]:t.NEVER,[St]:t.ALWAYS,[yt]:t.LESS,[_t]:t.LEQUAL,[xt]:t.EQUAL,[wt]:t.GEQUAL,[bt]:t.GREATER,[Mt]:t.NOTEQUAL};function O(n,s,a){if(a?(t.texParameteri(n,t.TEXTURE_WRAP_S,L[s.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,L[s.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,L[s.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,I[s.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,I[s.minFilter])):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),s.wrapS===F&&s.wrapT===F||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,t.TEXTURE_MAG_FILTER,T(s.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,T(s.minFilter)),s.minFilter!==z&&s.minFilter!==G&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),s.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,N[s.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){const a=e.get("EXT_texture_filter_anisotropic");if(s.magFilter===z)return;if(s.minFilter!==H&&s.minFilter!==j)return;if(s.type===K&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&s.type===J&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||i.get(s).__currentAnisotropy)&&(t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function D(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",A));const r=n.source;let s=g.get(r);void 0===s&&(s={},g.set(r,s));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(o!==e.__cacheKey){void 0===s[o]&&(s[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,i=!0),s[o].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&R(n)),e.__cacheKey=o,e.__webglTexture=s[o].texture}return i}function U(e,r,a){let l=t.TEXTURE_2D;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),r.isData3DTexture&&(l=t.TEXTURE_3D);const c=D(e,r),u=r.source;n.bindTexture(l,e.__webglTexture,t.TEXTURE0+a);const d=i.get(u);if(u.version!==d.__version||!0===c){n.activeTexture(t.TEXTURE0+a),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const e=function(t){return!o&&(t.wrapS!==F||t.wrapT!==F||t.minFilter!==z&&t.minFilter!==G)}(r)&&!1===_(r.image);let i=x(r.image,e,!1,h);i=at(r,i);const p=_(i)||o,m=s.convert(r.format,r.colorSpace);let f,g=s.convert(r.type),v=w(r.internalFormat,m,g,r.colorSpace,r.isVideoTexture);O(l,r,p);const y=r.mipmaps,T=o&&!0!==r.isVideoTexture,A=void 0===d.__version||!0===c,E=S(r,i,p);if(r.isDepthTexture)v=t.DEPTH_COMPONENT,o?v=r.type===K?t.DEPTH_COMPONENT32F:r.type===Y?t.DEPTH_COMPONENT24:r.type===Z?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT16:r.type===K&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Q&&v===t.DEPTH_COMPONENT&&r.type!==q&&r.type!==Y&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Y,g=s.convert(r.type)),r.format===tt&&v===t.DEPTH_COMPONENT&&(v=t.DEPTH_STENCIL,r.type!==Z&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Z,g=s.convert(r.type))),A&&(T?n.texStorage2D(t.TEXTURE_2D,1,v,i.width,i.height):n.texImage2D(t.TEXTURE_2D,0,v,i.width,i.height,0,m,g,null));else if(r.isDataTexture)if(y.length>0&&p){T&&A&&n.texStorage2D(t.TEXTURE_2D,E,v,y[0].width,y[0].height);for(let e=0,i=y.length;e>=1,r>>=1}}else if(y.length>0&&p){T&&A&&n.texStorage2D(t.TEXTURE_2D,E,v,y[0].width,y[0].height);for(let e=0,i=y.length;e>c),i=Math.max(1,r.height>>c);l===t.TEXTURE_3D||l===t.TEXTURE_2D_ARRAY?n.texImage3D(l,c,p,e,i,r.depth,0,h,u,null):n.texImage2D(l,c,p,e,i,0,h,u,null)}n.bindFramebuffer(t.FRAMEBUFFER,e),st(r)?d.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,o,l,i.get(a).__webglTexture,0,rt(r)):(l===t.TEXTURE_2D||l>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,o,l,i.get(a).__webglTexture,c),n.bindFramebuffer(t.FRAMEBUFFER,null)}function nt(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer){let r=t.DEPTH_COMPONENT16;if(i||st(n)){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===K?r=t.DEPTH_COMPONENT32F:e.type===Y&&(r=t.DEPTH_COMPONENT24));const i=rt(n);st(n)?d.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,i,r,n.width,n.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,i,r,n.width,n.height)}else t.renderbufferStorage(t.RENDERBUFFER,r,n.width,n.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)}else if(n.depthBuffer&&n.stencilBuffer){const r=rt(n);i&&!1===st(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,n.width,n.height):st(n)?d.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let r=0;r0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function at(t,n){const i=t.colorSpace,r=t.format,s=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===Et||i!==mt&&""!==i&&(i===pt||i===ft?!1===o?!0===e.has("EXT_sRGB")&&r===$?(t.format=Et,t.minFilter=G,t.generateMipmaps=!1):n=he.sRGBToLinear(n):r===$&&s===X||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),n}this.allocateTextureUnit=function(){const t=C;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),C+=1,t},this.resetTextureUnits=function(){C=0},this.setTexture2D=P,this.setTexture2DArray=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?U(s,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture,t.TEXTURE0+r)},this.setTexture3D=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?U(s,e,r):n.bindTexture(t.TEXTURE_3D,s.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?function(e,r,a){if(6!==r.image.length)return;const l=D(e,r),h=r.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+a);const u=i.get(h);if(h.version!==u.__version||!0===l){n.activeTexture(t.TEXTURE0+a),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const e=r.isCompressedTexture||r.image[0].isCompressedTexture,i=r.image[0]&&r.image[0].isDataTexture,d=[];for(let t=0;t<6;t++)d[t]=e||i?i?r.image[t].image:r.image[t]:x(r.image[t],!1,!0,c),d[t]=at(r,d[t]);const p=d[0],m=_(p)||o,f=s.convert(r.format,r.colorSpace),g=s.convert(r.type),v=w(r.internalFormat,f,g,r.colorSpace),y=o&&!0!==r.isVideoTexture,T=void 0===u.__version||!0===l;let A,E=S(r,p,m);if(O(t.TEXTURE_CUBE_MAP,r,m),e){y&&T&&n.texStorage2D(t.TEXTURE_CUBE_MAP,E,v,p.width,p.height);for(let e=0;e<6;e++){A=d[e].mipmaps;for(let i=0;i0&&E++,n.texStorage2D(t.TEXTURE_CUBE_MAP,E,v,d[0].width,d[0].height));for(let e=0;e<6;e++)if(i){y?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,d[e].width,d[e].height,f,g,d[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,v,d[e].width,d[e].height,0,f,g,d[e].data);for(let i=0;i0){c.__webglFramebuffer[e]=[];for(let n=0;n0){c.__webglFramebuffer=[];for(let e=0;e0&&!1===st(e)){const i=d?l:[l];c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,c.__webglMultisampledFramebuffer);for(let n=0;n0)for(let i=0;i0)for(let n=0;n0&&!1===st(e)){const r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],s=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const l=[],c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=i.get(e),u=!0===e.isWebGLMultipleRenderTargets;if(u)for(let e=0;eo+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(fa)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new ma;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class va extends fe{constructor(t,e,n,i,r,s,a,o,l,c){if((c=void 0!==c?c:Q)!==Q&&c!==tt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Q&&(n=Y),void 0===n&&c===tt&&(n=Z),super(null,i,r,s,a,o,c,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==a?a:z,this.minFilter=void 0!==o?o:z,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class ya extends Pt{constructor(t,e){super();const n=this;let i=null,r=1,s=null,a="local-floor",o=1,l=null,c=null,h=null,u=null,d=null,p=null;const m=e.getContextAttributes();let f=null,g=null;const v=[],y=[],x=new Ii;x.layers.enable(1),x.viewport=new ge;const _=new Ii;_.layers.enable(2),_.viewport=new ge;const b=[x,_],M=new pa;M.layers.enable(1),M.layers.enable(2);let w=null,S=null;function T(t){const e=y.indexOf(t.inputSource);if(-1===e)return;const n=v[e];void 0!==n&&(n.update(t.inputSource,t.frame,l||s),n.dispatchEvent({type:t.type,data:t.inputSource}))}function A(){i.removeEventListener("select",T),i.removeEventListener("selectstart",T),i.removeEventListener("selectend",T),i.removeEventListener("squeeze",T),i.removeEventListener("squeezestart",T),i.removeEventListener("squeezeend",T),i.removeEventListener("end",A),i.removeEventListener("inputsourceschange",E);for(let t=0;t=0&&(y[i]=null,v[i].disconnect(n))}for(let e=0;e=y.length){y.push(n),i=t;break}if(null===y[t]){y[t]=n,i=t;break}}if(-1===i)break}const r=v[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=v[t];return void 0===e&&(e=new ga,v[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=v[t];return void 0===e&&(e=new ga,v[t]=e),e.getGripSpace()},this.getHand=function(t){let e=v[t];return void 0===e&&(e=new ga,v[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(f=t.getRenderTarget(),i.addEventListener("select",T),i.addEventListener("selectstart",T),i.addEventListener("selectend",T),i.addEventListener("squeeze",T),i.addEventListener("squeezestart",T),i.addEventListener("squeezeend",T),i.addEventListener("end",A),i.addEventListener("inputsourceschange",E),!0!==m.xrCompatible&&await e.makeXRCompatible(),void 0===i.renderState.layers||!1===t.capabilities.isWebGL2){const n={antialias:void 0!==i.renderState.layers||m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:d}),g=new ye(d.framebufferWidth,d.framebufferHeight,{format:$,type:X,colorSpace:t.outputColorSpace,stencilBuffer:m.stencil})}else{let n=null,s=null,a=null;m.depth&&(a=m.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,n=m.stencil?tt:Q,s=m.stencil?Z:Y);const o={colorFormat:e.RGBA8,depthFormat:a,scaleFactor:r};h=new XRWebGLBinding(i,e),u=h.createProjectionLayer(o),i.updateRenderState({layers:[u]}),g=new ye(u.textureWidth,u.textureHeight,{format:$,type:X,depthTexture:new va(u.textureWidth,u.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:m.stencil,colorSpace:t.outputColorSpace,samples:m.antialias?4:0}),t.properties.get(g).__ignoreDepthValues=u.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await i.requestReferenceSpace(a),I.setContext(i),I.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode};const R=new Me,C=new Me;function P(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;M.near=_.near=x.near=t.near,M.far=_.far=x.far=t.far,w===M.near&&S===M.far||(i.updateRenderState({depthNear:M.near,depthFar:M.far}),w=M.near,S=M.far);const e=t.parent,n=M.cameras;P(M,e);for(let i=0;i0&&(i.alphaTest.value=r.alphaTest);const s=e.get(r).envMap;if(s&&(i.envMap.value=s,i.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;const e=!0===t._useLegacyLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*e,n(r.lightMap,i.lightMapTransform)}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,i.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,Ri(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,s,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,i){t.metalness.value=i.metalness,i.metalnessMap&&(t.metalnessMap.value=i.metalnessMap,n(i.metalnessMap,t.metalnessMapTransform)),t.roughness.value=i.roughness,i.roughnessMap&&(t.roughnessMap.value=i.roughnessMap,n(i.roughnessMap,t.roughnessMapTransform));e.get(i).envMap&&(t.envMapIntensity.value=i.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&t.clearcoatNormalScale.value.negate())),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,o)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,a):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function _a(t,e,n,i){let r={},s={},a=[];const o=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(t,e,n){const i=t.value;if(void 0===n[e]){if("number"==typeof i)n[e]=i;else{const t=Array.isArray(i)?i:[i],r=[];for(let e=0;e0&&(i=n%16,0!==i&&16-i-s.boundary<0&&(n+=16-i,t.__offset=n)),n+=s.storage}i=n%16,i>0&&(n+=16-i),t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t0),u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let m=A;i.toneMapped&&(null!==w&&!0!==w.isXRRenderTarget||(m=x.toneMapping));const f=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==f?f.length:0,y=ot.get(i),_=g.state.lights;if(!0===V&&(!0===H||t!==T)){const e=t===T&&i.id===S;_t.setState(i,t,e)}let b=!1;i.version===y.__version?y.needsLights&&y.lightsStateVersion!==_.state.version||y.outputColorSpace!==o||r.isInstancedMesh&&!1===y.instancing?b=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&!1===y.skinning?b=!0:r.isSkinnedMesh||!0!==y.skinning?r.isInstancedMesh&&!0===y.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===y.instancingColor&&null!==r.instanceColor||y.envMap!==l||!0===i.fog&&y.fog!==s?b=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===_t.numPlanes&&y.numIntersection===_t.numIntersection?(y.vertexAlphas!==c||y.vertexTangents!==h||y.morphTargets!==u||y.morphNormals!==d||y.morphColors!==p||y.toneMapping!==m||!0===rt.isWebGL2&&y.morphTargetsCount!==v)&&(b=!0):b=!0:b=!0:b=!0:(b=!0,y.__version=i.version);let M=y.currentProgram;!0===b&&(M=qt(i,e,r));let E=!1,R=!1,C=!1;const P=M.getUniforms(),L=y.uniforms;if(st.useProgram(M.program)&&(E=!0,R=!0,C=!0),i.id!==S&&(S=i.id,R=!0),E||T!==t){P.setValue(Ct,"projectionMatrix",t.projectionMatrix),P.setValue(Ct,"viewMatrix",t.matrixWorldInverse);const e=P.map.cameraPosition;void 0!==e&&e.setValue(Ct,tt.setFromMatrixPosition(t.matrixWorld)),rt.logarithmicDepthBuffer&&P.setValue(Ct,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&P.setValue(Ct,"isOrthographic",!0===t.isOrthographicCamera),T!==t&&(T=t,R=!0,C=!0)}if(r.isSkinnedMesh){P.setOptional(Ct,r,"bindMatrix"),P.setOptional(Ct,r,"bindMatrixInverse");const t=r.skeleton;t&&(rt.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),P.setValue(Ct,"boneTexture",t.boneTexture,lt),P.setValue(Ct,"boneTextureSize",t.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const I=n.morphAttributes;var D,U;if((void 0!==I.position||void 0!==I.normal||void 0!==I.color&&!0===rt.isWebGL2)&&wt.update(r,n,M),(R||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,P.setValue(Ct,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(L.envMap.value=l,L.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),R&&(P.setValue(Ct,"toneMappingExposure",x.toneMappingExposure),y.needsLights&&(U=C,(D=L).ambientLightColor.needsUpdate=U,D.lightProbe.needsUpdate=U,D.directionalLights.needsUpdate=U,D.directionalLightShadows.needsUpdate=U,D.pointLights.needsUpdate=U,D.pointLightShadows.needsUpdate=U,D.spotLights.needsUpdate=U,D.spotLightShadows.needsUpdate=U,D.rectAreaLights.needsUpdate=U,D.hemisphereLights.needsUpdate=U),s&&!0===i.fog&&vt.refreshFogUniforms(L,s),vt.refreshMaterialUniforms(L,i,O,N,G),Rs.upload(Ct,y.uniformsList,L,lt)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Rs.upload(Ct,y.uniformsList,L,lt),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&P.setValue(Ct,"center",r.center),P.setValue(Ct,"modelViewMatrix",r.modelViewMatrix),P.setValue(Ct,"normalMatrix",r.normalMatrix),P.setValue(Ct,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e0&&function(t,e,n,i){const r=rt.isWebGL2;null===G&&(G=new ye(1,1,{generateMipmaps:!0,type:it.has("EXT_color_buffer_half_float")?J:X,minFilter:j,samples:r?4:0})),x.getDrawingBufferSize(Q),r?G.setSize(Q.x,Q.y):G.setSize(zt(Q.x),zt(Q.y));const s=x.getRenderTarget();x.setRenderTarget(G),x.getClearColor(P),L=x.getClearAlpha(),L<1&&x.setClearColor(16777215,.5),x.clear();const a=x.toneMapping;x.toneMapping=A,Wt(t,n,i),lt.updateMultisampleRenderTarget(G),lt.updateRenderTargetMipmap(G);let o=!1;for(let l=0,c=e.length;l0&&Wt(r,e,n),s.length>0&&Wt(s,e,n),a.length>0&&Wt(a,e,n),st.buffers.depth.setTest(!0),st.buffers.depth.setMask(!0),st.buffers.color.setMask(!0),st.setPolygonOffset(!1)}function Wt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r0?y[y.length-1]:null,v.pop(),f=v.length>0?v[v.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(t,e,n){ot.get(t.texture).__webglTexture=e,ot.get(t.depthTexture).__webglTexture=n;const i=ot.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===it.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=ot.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){w=t,b=e,M=n;let i=!0,r=null,s=!1,a=!1;if(t){const o=ot.get(t);void 0!==o.__useDefaultFramebuffer?(st.bindFramebuffer(Ct.FRAMEBUFFER,null),i=!1):void 0===o.__webglFramebuffer?lt.setupRenderTarget(t):o.__hasExternalTextures&<.rebindTextures(t,ot.get(t.texture).__webglTexture,ot.get(t.depthTexture).__webglTexture);const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const c=ot.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][n]:c[e],s=!0):r=rt.isWebGL2&&t.samples>0&&!1===lt.useMultisampledRTT(t)?ot.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,E.copy(t.viewport),R.copy(t.scissor),C=t.scissorTest}else E.copy(B).multiplyScalar(O).floor(),R.copy(F).multiplyScalar(O).floor(),C=k;if(st.bindFramebuffer(Ct.FRAMEBUFFER,r)&&rt.drawBuffers&&i&&st.drawBuffers(t,r),st.viewport(E),st.scissor(R),st.setScissorTest(C),s){const i=ot.get(t.texture);Ct.framebufferTexture2D(Ct.FRAMEBUFFER,Ct.COLOR_ATTACHMENT0,Ct.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(a){const i=ot.get(t.texture),r=e||0;Ct.framebufferTextureLayer(Ct.FRAMEBUFFER,Ct.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}S=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ot.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){st.bindFramebuffer(Ct.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==$&&At.convert(o)!==Ct.getParameter(Ct.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===J&&(it.has("EXT_color_buffer_half_float")||rt.isWebGL2&&it.has("EXT_color_buffer_float"));if(!(l===X||At.convert(l)===Ct.getParameter(Ct.IMPLEMENTATION_COLOR_READ_TYPE)||l===K&&(rt.isWebGL2||it.has("OES_texture_float")||it.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Ct.readPixels(e,n,i,r,At.convert(o),At.convert(l),s)}finally{const t=null!==w?ot.get(w).__webglFramebuffer:null;st.bindFramebuffer(Ct.FRAMEBUFFER,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i);lt.setTexture2D(e,0),Ct.copyTexSubImage2D(Ct.TEXTURE_2D,n,0,0,t.x,t.y,r,s),st.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,s=e.image.height,a=At.convert(n.format),o=At.convert(n.type);lt.setTexture2D(n,0),Ct.pixelStorei(Ct.UNPACK_FLIP_Y_WEBGL,n.flipY),Ct.pixelStorei(Ct.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),Ct.pixelStorei(Ct.UNPACK_ALIGNMENT,n.unpackAlignment),e.isDataTexture?Ct.texSubImage2D(Ct.TEXTURE_2D,i,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?Ct.compressedTexSubImage2D(Ct.TEXTURE_2D,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):Ct.texSubImage2D(Ct.TEXTURE_2D,i,t.x,t.y,a,o,e.image),0===i&&n.generateMipmaps&&Ct.generateMipmap(Ct.TEXTURE_2D),st.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(x.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=At.convert(i.format),c=At.convert(i.type);let h;if(i.isData3DTexture)lt.setTexture3D(i,0),h=Ct.TEXTURE_3D;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");lt.setTexture2DArray(i,0),h=Ct.TEXTURE_2D_ARRAY}Ct.pixelStorei(Ct.UNPACK_FLIP_Y_WEBGL,i.flipY),Ct.pixelStorei(Ct.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Ct.pixelStorei(Ct.UNPACK_ALIGNMENT,i.unpackAlignment);const u=Ct.getParameter(Ct.UNPACK_ROW_LENGTH),d=Ct.getParameter(Ct.UNPACK_IMAGE_HEIGHT),p=Ct.getParameter(Ct.UNPACK_SKIP_PIXELS),m=Ct.getParameter(Ct.UNPACK_SKIP_ROWS),f=Ct.getParameter(Ct.UNPACK_SKIP_IMAGES),g=n.isCompressedTexture?n.mipmaps[0]:n.image;Ct.pixelStorei(Ct.UNPACK_ROW_LENGTH,g.width),Ct.pixelStorei(Ct.UNPACK_IMAGE_HEIGHT,g.height),Ct.pixelStorei(Ct.UNPACK_SKIP_PIXELS,t.min.x),Ct.pixelStorei(Ct.UNPACK_SKIP_ROWS,t.min.y),Ct.pixelStorei(Ct.UNPACK_SKIP_IMAGES,t.min.z),n.isDataTexture||n.isData3DTexture?Ct.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,g.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Ct.compressedTexSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,g.data)):Ct.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,g),Ct.pixelStorei(Ct.UNPACK_ROW_LENGTH,u),Ct.pixelStorei(Ct.UNPACK_IMAGE_HEIGHT,d),Ct.pixelStorei(Ct.UNPACK_SKIP_PIXELS,p),Ct.pixelStorei(Ct.UNPACK_SKIP_ROWS,m),Ct.pixelStorei(Ct.UNPACK_SKIP_IMAGES,f),0===r&&i.generateMipmaps&&Ct.generateMipmap(h),st.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?lt.setTextureCube(t,0):t.isData3DTexture?lt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?lt.setTexture2DArray(t,0):lt.setTexture2D(t,0),st.unbindTexture()},this.resetState=function(){b=0,M=0,w=null,st.reset(),Et.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Rt}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(t){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!t}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===pt?dt:3e3}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===dt?pt:mt}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}(class extends ba{}).prototype.isWebGL1Renderer=!0;class Ma{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Gn(t),this.density=e}clone(){return new Ma(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class wa{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new Gn(t),this.near=e,this.far=n}clone(){return new wa(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Sa extends Sn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e}}class Ta{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Tt,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Ot()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;it.far||e.push({distance:o,point:Pa.clone(),uv:Un.getInterpolation(Pa,Ua,Ba,Fa,ka,za,Va,new Xt),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Ga(t,e,n,i,r,s){Na.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Oa.x=s*Na.x-r*Na.y,Oa.y=r*Na.x+s*Na.y):Oa.copy(Na),t.copy(e),t.x+=Oa.x,t.y+=Oa.y,t.applyMatrix4(Da)}const Wa=new Me,ja=new Me;class Xa extends Sn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,i=e.length;n0){let n,i;for(n=1,i=e.length;n0){Wa.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Wa);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Wa.setFromMatrixPosition(t.matrixWorld),ja.setFromMatrixPosition(this.matrixWorld);const n=Wa.distanceTo(ja)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i=t))break;e[i-1].object.visible=!1,e[i].object.visible=!0}for(this._currentLevel=i-1;io)continue;u.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(u);rt.far||e.push({distance:r,point:h.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}else for(let f=Math.max(0,s.start),g=Math.min(m.count,s.start+s.count)-1;fo)continue;u.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(u);nt.far||e.push({distance:n,point:h.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;tr.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,object:a})}}class Uo{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let a,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),a=n[i]-s,a<0)o=i+1;else{if(!(a>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=e||(s.isVector2?new Xt:new Me);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new Me,i=[],r=[],s=[],a=new Me,o=new $e;for(let d=0;d<=t;d++){const e=d/t;i[d]=this.getTangentAt(e,new Me)}r[0]=new Me,s[0]=new Me;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let d=1;d<=t;d++){if(r[d]=r[d-1].clone(),s[d]=s[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(Dt(i[d-1].dot(i[d]),-1,1));r[d].applyMatrix4(o.makeRotationAxis(a,t))}s[d].crossVectors(i[d],r[d])}if(!0===e){let e=Math.acos(Dt(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Bo extends Uo{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e){const n=e||new Xt,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;ri.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(Go(a,o.x,l.x,c.x,h.x),Go(a,o.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?a=i[(l-1)%r]:(ko.subVectors(i[0],i[1]).add(i[0]),a=ko);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2=n){const t=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class tl extends si{constructor(t=[new Xt(0,-.5),new Xt(.5,0),new Xt(0,.5)],e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Dt(i,0,2*Math.PI);const r=[],s=[],a=[],o=[],l=[],c=1/e,h=new Me,u=new Xt,d=new Me,p=new Me,m=new Me;let f=0,g=0;for(let v=0;v<=t.length-1;v++)switch(v){case 0:f=t[v+1].x-t[v].x,g=t[v+1].y-t[v].y,d.x=1*g,d.y=-f,d.z=0*g,m.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case t.length-1:o.push(m.x,m.y,m.z);break;default:f=t[v+1].x-t[v].x,g=t[v+1].y-t[v].y,d.x=1*g,d.y=-f,d.z=0*g,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),o.push(d.x,d.y,d.z),m.copy(p)}for(let v=0;v<=e;v++){const r=n+v*c*i,d=Math.sin(r),p=Math.cos(r);for(let n=0;n<=t.length-1;n++){h.x=t[n].x*d,h.y=t[n].y,h.z=t[n].x*p,s.push(h.x,h.y,h.z),u.x=v/e,u.y=n/(t.length-1),a.push(u.x,u.y);const i=o[3*n+0]*d,r=o[3*n+1],c=o[3*n+0]*p;l.push(i,r,c)}}for(let v=0;v0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(u,3)),this.setAttribute("uv",new Zn(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new il(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rl extends il{constructor(t=1,e=1,n=32,i=1,r=!1,s=0,a=2*Math.PI){super(0,t,e,n,i,r,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(t){return new rl(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class sl extends si{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function a(t,e,n,i){const r=i+1,s=[];for(let a=0;a<=r;a++){s[a]=[];const i=t.clone().lerp(n,a/r),o=e.clone().lerp(n,a/r),l=r-a;for(let t=0;t<=l;t++)s[a][t]=0===t&&a===r?i:i.clone().lerp(o,t/l)}for(let a=0;a.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Zn(r,3)),this.setAttribute("normal",new Zn(r.slice(),3)),this.setAttribute("uv",new Zn(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new sl(t.vertices,t.indices,t.radius,t.details)}}class al extends sl{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new al(t.radius,t.detail)}}const ol=new Me,ll=new Me,cl=new Me,hl=new Un;class ul extends Qo{constructor(t){super(t),this.uuid=Ot(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n0)for(s=e;s=e;s-=i)a=Nl(s,t[s],t[s+1],a);return a&&El(a,a.next)&&(Ol(a),a=a.next),a}function pl(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!El(i,i.next)&&0!==Al(i.prev,i,i.next))i=i.next;else{if(Ol(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function ml(t,e,n,i,r,s,a){if(!t)return;!a&&s&&function(t,e,n,i){let r=t;do{0===r.z&&(r.z=Ml(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,s,a,o,l,c=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,i=n,o=0,e=0;e0||l>0&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(a>1)}(r)}(t,i,r,s);let o,l,c=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,s?gl(t,i,r,s):fl(t))e.push(o.i/n|0),e.push(t.i/n|0),e.push(l.i/n|0),Ol(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?ml(t=vl(pl(t),e,n),e,n,i,r,s,2):2===a&&yl(t,e,n,i,r,s):ml(pl(t),e,n,i,r,s,1);break}}function fl(t){const e=t.prev,n=t,i=t.next;if(Al(e,n,i)>=0)return!1;const r=e.x,s=n.x,a=i.x,o=e.y,l=n.y,c=i.y,h=rs?r>a?r:a:s>a?s:a,p=o>l?o>c?o:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=p&&Sl(r,o,s,l,a,c,m.x,m.y)&&Al(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function gl(t,e,n,i){const r=t.prev,s=t,a=t.next;if(Al(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,h=r.y,u=s.y,d=a.y,p=ol?o>c?o:c:l>c?l:c,g=h>u?h>d?h:d:u>d?u:d,v=Ml(p,m,e,n,i),y=Ml(f,g,e,n,i);let x=t.prevZ,_=t.nextZ;for(;x&&x.z>=v&&_&&_.z<=y;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==a&&Sl(o,h,l,u,c,d,x.x,x.y)&&Al(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,_.x>=p&&_.x<=f&&_.y>=m&&_.y<=g&&_!==r&&_!==a&&Sl(o,h,l,u,c,d,_.x,_.y)&&Al(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;x&&x.z>=v;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==a&&Sl(o,h,l,u,c,d,x.x,x.y)&&Al(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;_&&_.z<=y;){if(_.x>=p&&_.x<=f&&_.y>=m&&_.y<=g&&_!==r&&_!==a&&Sl(o,h,l,u,c,d,_.x,_.y)&&Al(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function vl(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!El(r,s)&&Rl(r,i,i.next,s)&&Ll(r,s)&&Ll(s,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(s.i/n|0),Ol(i),Ol(i.next),i=t=s),i=i.next}while(i!==t);return pl(i)}function yl(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Tl(a,t)){let o=Il(a,t);return a=pl(a,a.next),o=pl(o,o.next),ml(a,e,n,i,r,s,0),void ml(o,e,n,i,r,s,0)}t=t.next}a=a.next}while(a!==t)}function xl(t,e){return t.x-e.x}function _l(t,e){const n=function(t,e){let n,i=e,r=-1/0;const s=t.x,a=t.y;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){const t=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=s&&t>r&&(r=t,n=i.x=i.x&&i.x>=l&&s!==i.x&&Sl(an.x||i.x===n.x&&bl(n,i)))&&(n=i,u=h)),i=i.next}while(i!==o);return n}(t,e);if(!n)return e;const i=Il(n,t);return pl(i,i.next),pl(n,n.next)}function bl(t,e){return Al(t.prev,t,e.prev)<0&&Al(e.next,t,t.next)<0}function Ml(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function wl(t){let e=t,n=t;do{(e.x=(t-a)*(s-o)&&(t-a)*(i-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(r-a)*(i-o)}function Tl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Rl(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Ll(t,e)&&Ll(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(Al(t.prev,t,e.prev)||Al(t,e.prev,e))||El(t,e)&&Al(t.prev,t,t.next)>0&&Al(e.prev,e,e.next)>0)}function Al(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function El(t,e){return t.x===e.x&&t.y===e.y}function Rl(t,e,n,i){const r=Pl(Al(t,e,n)),s=Pl(Al(t,e,i)),a=Pl(Al(n,i,t)),o=Pl(Al(n,i,e));return r!==s&&a!==o||!(0!==r||!Cl(t,n,e))||!(0!==s||!Cl(t,i,e))||!(0!==a||!Cl(n,t,i))||!(0!==o||!Cl(n,e,i))}function Cl(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Pl(t){return t>0?1:t<0?-1:0}function Ll(t,e){return Al(t.prev,t,t.next)<0?Al(t,e,t.next)>=0&&Al(t,t.prev,e)>=0:Al(t,e,t.prev)<0||Al(t,t.next,e)<0}function Il(t,e){const n=new Dl(t.i,t.x,t.y),i=new Dl(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Nl(t,e,n,i){const r=new Dl(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Ol(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Dl(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Ul{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r80*n){o=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),d>h&&(h=d);p=Math.max(c-o,h-l),p=0!==p?32767/p:0}return ml(s,a,n,o,l,p,0),a}(n,i);for(let o=0;o2&&t[e-1].equals(t[0])&&t.pop()}function Fl(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-o/u,m=e.y+a/u,f=((n.x-c/d-p)*c-(n.y+l/d-m)*l)/(a*c-o*l);i=p+a*f-t.x,r=m+o*f-t.y;const g=i*i+r*r;if(g<=2)return new Xt(i,r);s=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),t?(i=-o,r=a,s=Math.sqrt(h)):(i=a,r=o,s=Math.sqrt(h/2))}return new Xt(i/s,r/s)}const L=[];for(let e=0,n=A.length,i=n-1,r=e+1;e=0;e--){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=u*Math.sin(t*Math.PI/2)+d;for(let e=0,r=A.length;e=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=o+2*p;t0)&&d.push(e,i,a),(g!==n-1||o0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class nc extends Fn{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Gn(16777215),this.specular=new Gn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Xt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=w,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ic extends Fn{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Gn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Xt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class rc extends Fn{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Xt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class sc extends Fn{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Gn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Xt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=w,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ac extends Fn{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Gn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Xt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class oc extends yo{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function lc(t,e,n){return hc(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)}function cc(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function hc(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function uc(t){const e=t.length,n=new Array(e);for(let i=0;i!==e;++i)n[i]=i;return n.sort((function(e,n){return t[e]-t[n]})),n}function dc(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[a++]=t[i+n]}return r}function pc(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(e.push(s.time),n.push.apply(n,a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(e.push(s.time),a.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(e.push(s.time),n.push(a)),s=t[r++]}while(void 0!==s)}class mc{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let s;n:{i:if(!(t=r)break t;{const a=e[1];t=r)break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=lc(n,r,s),this.values=lc(this.values,r*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let a=0;a!==r;a++){const e=n[a];if("number"==typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,e),t=!1;break}if(null!==s&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,e,s),t=!1;break}s=e}if(void 0!==i&&hc(i))for(let a=0,o=i.length;a!==o;++a){const e=i[a];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,e),t=!1;break}}return t}optimize(){const t=lc(this.times),e=lc(this.values),n=this.getValueSize(),i=this.getInterpolation()===lt,r=t.length-1;let s=1;for(let a=1;a0){t[s]=t[r];for(let t=r*n,i=s*n,a=0;a!==n;++a)e[i+a]=e[t+a];++s}return s!==t.length?(this.times=lc(t,0,s),this.values=lc(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=lc(this.times,0),e=lc(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}yc.prototype.TimeBufferType=Float32Array,yc.prototype.ValueBufferType=Float32Array,yc.prototype.DefaultInterpolation=ot;class xc extends yc{}xc.prototype.ValueTypeName="bool",xc.prototype.ValueBufferType=Array,xc.prototype.DefaultInterpolation=at,xc.prototype.InterpolantFactoryMethodLinear=void 0,xc.prototype.InterpolantFactoryMethodSmooth=void 0;class _c extends yc{}_c.prototype.ValueTypeName="color";class bc extends yc{}bc.prototype.ValueTypeName="number";class Mc extends mc{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-e)/(i-e);let l=t*a;for(let c=l+a;l!==c;l+=4)be.slerpFlat(r,0,s,l-a,s,l,o);return r}}class wc extends yc{InterpolantFactoryMethodLinear(t){return new Mc(this.times,this.values,this.getValueSize(),t)}}wc.prototype.ValueTypeName="quaternion",wc.prototype.DefaultInterpolation=ot,wc.prototype.InterpolantFactoryMethodSmooth=void 0;class Sc extends yc{}Sc.prototype.ValueTypeName="string",Sc.prototype.ValueBufferType=Array,Sc.prototype.DefaultInterpolation=at,Sc.prototype.InterpolantFactoryMethodLinear=void 0,Sc.prototype.InterpolantFactoryMethodSmooth=void 0;class Tc extends yc{}Tc.prototype.ValueTypeName="vector";class Ac{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=Ot(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let s=0,a=n.length;s!==a;++s)e.push(Ec(n[s]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,s=n.length;r!==s;++r)e.push(yc.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let a=0;a1){const t=n[1];let r=i[t];r||(i[t]=r=[]),r.push(e)}}const s=[];for(const a in i)s.push(this.CreateFromMorphTargetSequence(a,i[a],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const s=[],a=[];pc(n,s,a,i),0!==s.length&&r.push(new t(e,s,a))}},i=[],r=t.name||"default",s=t.fps||30,a=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let c=0;c{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Ic[t])return void Ic[t].push({onLoad:e,onProgress:n,onError:i});Ic[t]=[],Ic[t].push({onLoad:e,onProgress:n,onError:i});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=Ic[t],i=e.body.getReader(),r=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=n.length;t{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{Rc.add(t,e);const n=Ic[t];delete Ic[t];for(let t=0,i=n.length;t{const n=Ic[t];if(void 0===n)throw this.manager.itemError(t),e;delete Ic[t];for(let t=0,i=n.length;t{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Dc extends Lc{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Rc.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const a=$t("img");function o(){c(),Rc.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}class Uc extends Lc{constructor(t){super(t)}load(t,e,n,i){const r=new fe,s=new Dc(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class Bc extends Sn{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Gn(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}class Fc extends Bc{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Sn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Gn(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const kc=new $e,zc=new Me,Vc=new Me;class Hc{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Xt(512,512),this.map=null,this.mapPass=null,this.matrix=new $e,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Gi,this._frameExtents=new Xt(1,1),this._viewportCount=1,this._viewports=[new ge(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;zc.setFromMatrixPosition(t.matrixWorld),e.position.copy(zc),Vc.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Vc),e.updateMatrixWorld(),kc.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(kc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(kc)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Gc extends Hc{constructor(){super(new Ii(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=2*Nt*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class Wc extends Bc{constructor(t,e,n=0,i=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Sn.DEFAULT_UP),this.updateMatrix(),this.target=new Sn,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Gc}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const jc=new $e,Xc=new Me,qc=new Me;class Yc extends Hc{constructor(){super(new Ii(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Xt(4,2),this._viewportCount=6,this._viewports=[new ge(2,1,1,1),new ge(0,1,1,1),new ge(3,1,1,1),new ge(1,1,1,1),new ge(3,0,1,1),new ge(1,0,1,1)],this._cubeDirections=[new Me(1,0,0),new Me(-1,0,0),new Me(0,0,1),new Me(0,0,-1),new Me(0,1,0),new Me(0,-1,0)],this._cubeUps=[new Me(0,1,0),new Me(0,1,0),new Me(0,1,0),new Me(0,1,0),new Me(0,0,1),new Me(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Xc.setFromMatrixPosition(t.matrixWorld),n.position.copy(Xc),qc.copy(n.position),qc.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(qc),n.updateMatrixWorld(),i.makeTranslation(-Xc.x,-Xc.y,-Xc.z),jc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jc)}}class Kc extends Bc{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Yc}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class Jc extends Hc{constructor(){super(new ir(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Zc extends Bc{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Sn.DEFAULT_UP),this.updateMatrix(),this.target=new Sn,this.shadow=new Jc}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class $c extends Bc{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class Qc extends Bc{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class th{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new Me)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*i),e.addScaledVector(s[2],.488603*r),e.addScaledVector(s[3],.488603*n),e.addScaledVector(s[4],n*i*1.092548),e.addScaledVector(s[5],i*r*1.092548),e.addScaledVector(s[6],.315392*(3*r*r-1)),e.addScaledVector(s[7],n*r*1.092548),e.addScaledVector(s[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*i),e.addScaledVector(s[2],1.023328*r),e.addScaledVector(s[3],1.023328*n),e.addScaledVector(s[4],.858086*n*i),e.addScaledVector(s[5],.858086*i*r),e.addScaledVector(s[6],.743125*r*r-.247708),e.addScaledVector(s[7],.858086*n*r),e.addScaledVector(s[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}class eh extends Bc{constructor(t=new th,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class nh extends Lc{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,s=new Oc(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(s){i?i(s):console.error(s),r.manager.itemError(t)}}),n,i)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const i=nh.createMaterialFromType(t.type);if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=t.sheen),void 0!==t.sheenColor&&(i.sheenColor=(new Gn).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(i.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.specularIntensity&&(i.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.iridescence&&(i.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(i.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.thickness&&(i.thickness=t.thickness),void 0!==t.attenuationDistance&&(i.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(t.attenuationColor),void 0!==t.anisotropy&&(i.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(i.anisotropyRotation=t.anisotropyRotation),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.shadowSide&&(i.shadowSide=t.shadowSide),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.alphaHash&&(i.alphaHash=t.alphaHash),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),1!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.alphaToCoverage&&(i.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(i.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(i.forceSinglePass=t.forceSinglePass),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const r in t.uniforms){const e=t.uniforms[r];switch(i.uniforms[r]={},e.type){case"t":i.uniforms[r].value=n(e.value);break;case"c":i.uniforms[r].value=(new Gn).setHex(e.value);break;case"v2":i.uniforms[r].value=(new Xt).fromArray(e.value);break;case"v3":i.uniforms[r].value=(new Me).fromArray(e.value);break;case"v4":i.uniforms[r].value=(new ge).fromArray(e.value);break;case"m3":i.uniforms[r].value=(new qt).fromArray(e.value);break;case"m4":i.uniforms[r].value=(new $e).fromArray(e.value);break;default:i.uniforms[r].value=e.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(i.glslVersion=t.glslVersion),void 0!==t.extensions)for(const r in t.extensions)i.extensions[r]=t.extensions[r];if(void 0!==t.lights&&(i.lights=t.lights),void 0!==t.clipping&&(i.clipping=t.clipping),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new Xt).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Xt).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(i.iridescenceMap=n(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.anisotropyMap&&(i.anisotropyMap=n(t.anisotropyMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}static createMaterialFromType(t){return new{ShadowMaterial:$l,SpriteMaterial:Ra,RawShaderMaterial:Ql,ShaderMaterial:Pi,PointsMaterial:Co,MeshPhysicalMaterial:ec,MeshStandardMaterial:tc,MeshPhongMaterial:nc,MeshToonMaterial:ic,MeshNormalMaterial:rc,MeshLambertMaterial:sc,MeshDepthMaterial:oa,MeshDistanceMaterial:la,MeshBasicMaterial:jn,MeshMatcapMaterial:ac,LineDashedMaterial:oc,LineBasicMaterial:yo,Material:Fn}[t]}}class ih{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,r=t.length;i0){const n=new Cc(e);r=new Dc(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,r=t.length;e0){i=new Dc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let o=e,l=e+e;o!==l;++o)if(n[o]!==n[o+e]){a.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let r=n,s=i;r!==s;++r)e[r]=e[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let s=0;s!==r;++s)t[e+s]=t[n+s]}_slerp(t,e,n,i){be.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;be.multiplyQuaternionsFlat(t,s,t,e,t,n),be.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[n+a]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const mh="\\[\\]\\.:\\/",fh=new RegExp("["+mh+"]","g"),gh="[^"+mh+"]",vh="[^"+mh.replace("\\.","")+"]",yh=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",gh)+/(WCOD+)?/.source.replace("WCOD",vh)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",gh)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",gh)+"$"),xh=["material","materials","bones","map"];class _h{constructor(t,e,n){this.path=e,this.parsedPath=n||_h.parseTrackName(e),this.node=_h.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new _h.Composite(t,e,n):new _h(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(fh,"")}static parseTrackName(t){const e=yh.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==xh.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(a);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const s=2202===n;if(0===t)return-1===r||!s||1&~r?i:e-i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&!(1&~r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=ht,i.endingEnd=ht):(i.endingStart=t?this.zeroSlopeAtStart?ht:ct:ut,i.endingEnd=e?this.zeroSlopeAtEnd?ht:ct:ut)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=n,this}}const Mh=new Float32Array(1);class wh extends Pt{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,a=t._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let h=0;h!==r;++h){const t=i[h],r=t.name;let l=c[r];if(void 0!==l)++l.referenceCount,s[h]=l;else{if(l=s[h],void 0!==l){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,o,r));continue}const i=e&&e._propertyBindings[h].binding.parsedPath;l=new ph(_h.create(n,r,i),t.ValueTypeName,t.getValueSize()),++l.referenceCount,this._addInactiveBinding(l,o,r),s[h]=l}a[h].resultBuffer=l.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let l=0;l!==n;++l)e[l]._update(i,t,r,s);const a=this._bindings,o=this._nActiveBindings;for(let l=0;l!==o;++l)a[l].apply(s);return this}setTime(t){this.time=0;for(let e=0;ethis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Rh).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Ph=new Me,Lh=new Me;class Ih{constructor(t=new Me,e=new Me){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Ph.subVectors(t,this.start),Lh.subVectors(this.end,this.start);const n=Lh.dot(Lh);let i=Lh.dot(Ph)/n;return e&&(i=Dt(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Nh=new Me;class Oh extends Sn{constructor(t,e){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const n=new si,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,a=1,o=32;sNumber.EPSILON){if(l<0&&(n=e[s],o=-o,a=e[r],l=-l),t.ya.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-o*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return i}const n=Ul.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,a;const o=[];if(1===i.length)return s=i[0],a=new ul,a.curves=s.curves,o.push(a),o;let l=!n(i[0].getPoints());l=t?!l:l;const c=[],h=[];let u,d,p=[],m=0;h[m]=void 0,p[m]=[];for(let f=0,g=i.length;f1){let t=!1,n=0;for(let e=0,i=h.length;e0&&!1===t&&(p=c)}for(let f=0,g=h.length;f{if(Vh.has(t)){const e=Vh.get(t);if(void 0===e)return;if(e>=5)return;Vh.set(t,e+1)}else Vh.set(t,1);e?console.error(`%c [enable3d] ${t} `,"background: #222; color: #bada55"):console.warn(`%c [enable3d] ${t} `,"background: #222; color: #bada55")};var Gh={},Wh={};Object.defineProperty(Wh,"__esModule",{value:!0}),Wh.VERSION=void 0,Wh.VERSION="0.0.5";var jh=t&&t.__spreadArray||function(t,e){for(var n=0,i=e.length,r=t.length;n{t()})):this.eventEmitter.on("update",(()=>{t()}))}get on(){return{update:t=>this.onUpdateEvent(t),collision:t=>this.onCollision(t)}}get once(){return{update:t=>this.onUpdateEvent(t,!0)}}onCollision(t){this.checkCollisions=!0,this.physics.collisionEvents.on("collision",(e=>{const{bodies:n,event:i}=e;n[0].name===this.name?t(n[1],i):n[1].name===this.name&&t(n[0],i)}))}transform(){const t=this.physics.worldTransform;this.ammo.getMotionState().getWorldTransform(t)}refresh(){const t=this.physics.worldTransform;this.ammo.getMotionState().setWorldTransform(t)}setRotation(t,e,n){const i=this.tmpEuler.set(t,e,n),r=this.tmpQuaternion.set(0,0,0,1);r.setFromEuler(i),this.tmpBtQuaternion.setValue(0,0,0,1);const s=this.tmpBtQuaternion;s.setValue(r.x,r.y,r.z,r.w),this.physics.worldTransform.setRotation(s)}get rotation(){let t,e,n;const i=this.physics.worldTransform.getRotation();let r=this.tmpQuaternion.set(i.x(),i.y(),i.z(),i.w());r.w>1&&(r=r.normalize());const s=2*Math.acos(r.w),a=Math.sqrt(1-r.w*r.w);return a<.001?(t=r.x,e=r.y,n=r.z):(t=r.x/a,e=r.y/a,n=r.z/a),{x:t*s,y:e*s,z:n*s}}get quaternion(){const t=this.physics.worldTransform.getRotation();return{x:t.x(),y:t.y(),z:t.z(),w:t.w()}}setPosition(t,e,n){this.physics.worldTransform.getOrigin().setValue(t,e,n)}get position(){const t=this.physics.worldTransform;return{x:t.getOrigin().x(),y:t.getOrigin().y(),z:t.getOrigin().z()}}get velocity(){return{x:this.ammo.getLinearVelocity().x(),y:this.ammo.getLinearVelocity().y(),z:this.ammo.getLinearVelocity().z()}}get angularVelocity(){return{x:this.ammo.getAngularVelocity().x(),y:this.ammo.getAngularVelocity().y(),z:this.ammo.getAngularVelocity().z()}}setVelocity(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.setLinearVelocity(this.tmpBtVector3)}setVelocityX(t){this.tmpBtVector3.setValue(t,this.velocity.y,this.velocity.z),this.ammo.setLinearVelocity(this.tmpBtVector3)}setVelocityY(t){this.tmpBtVector3.setValue(this.velocity.x,t,this.velocity.z),this.ammo.setLinearVelocity(this.tmpBtVector3)}setVelocityZ(t){this.tmpBtVector3.setValue(this.velocity.x,this.velocity.y,t),this.ammo.setLinearVelocity(this.tmpBtVector3)}setAngularVelocity(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.setAngularVelocity(this.tmpBtVector3)}setAngularVelocityX(t){this.tmpBtVector3.setValue(t,this.angularVelocity.y,this.angularVelocity.z),this.ammo.setAngularVelocity(this.tmpBtVector3)}setAngularVelocityY(t){this.tmpBtVector3.setValue(this.angularVelocity.x,t,this.angularVelocity.z),this.ammo.setAngularVelocity(this.tmpBtVector3)}setAngularVelocityZ(t){this.tmpBtVector3.setValue(this.angularVelocity.x,this.angularVelocity.y,t),this.ammo.setAngularVelocity(this.tmpBtVector3)}applyForce(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyCentralImpulse(this.tmpBtVector3)}applyForceX(t){this.tmpBtVector3.setValue(t,0,0),this.ammo.applyCentralImpulse(this.tmpBtVector3)}applyForceY(t){this.tmpBtVector3.setValue(0,t,0),this.ammo.applyCentralImpulse(this.tmpBtVector3)}applyForceZ(t){this.tmpBtVector3.setValue(0,0,t),this.ammo.applyCentralImpulse(this.tmpBtVector3)}applyCentralForce(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyCentralForce(this.tmpBtVector3)}applyCentralImpulse(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyCentralImpulse(this.tmpBtVector3)}applyCentralLocalForce(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyCentralLocalForce(this.tmpBtVector3)}applyImpulse(t,e){this.tmpBtVector3.setValue(t.x||0,t.y||0,t.z||0),this.tmpBtVector3_1.setValue(e.x||0,e.y||0,e.z||0),this.ammo.applyImpulse(this.tmpBtVector3,this.tmpBtVector3_1)}applyLocalTorque(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyLocalTorque(this.tmpBtVector3)}applyTorque(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyTorque(this.tmpBtVector3)}applyTorqueImpulse(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyTorqueImpulse(this.tmpBtVector3)}setCollisionFlags(t){this.ammo.setCollisionFlags(t)}getCollisionFlags(){return this.ammo.getCollisionFlags()}setRestitution(t){this.ammo.setRestitution(t)}setBounciness(t){this.setRestitution(t)}setFriction(t){this.ammo.setFriction(t)}setDamping(t,e){this.ammo.setDamping(t,e)}setGravity(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.setGravity(this.tmpBtVector3)}setLinearFactor(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.setLinearFactor(this.tmpBtVector3)}setAngularFactor(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.setAngularFactor(this.tmpBtVector3)}setCcdMotionThreshold(t){this.ammo.setCcdMotionThreshold(t)}setCcdSweptSphereRadius(t){this.ammo.setCcdSweptSphereRadius(t)}}class Qh extends Sn{constructor(){super(),this.isExtendedObject3D=!0,this.isGroup=!1,this.vector3=new Me,this.hasBody=!1,this.fragmentDepth=0,this.breakable=!1,this.fractureImpulse=1,this._currentAnimation="",this._animationActions=new Map,this.name=`object-${this.id}`}get world(){return{theta:this.worldTheta,phi:this.worldPhi}}get worldTheta(){return this.getWorldDirection(this.vector3),Math.atan2(this.vector3.x,this.vector3.z)}get worldPhi(){return this.getWorldDirection(this.vector3),Math.acos(this.vector3.y)}set animationMixer(t){this._animationMixer=t}get animationMixer(){return this._animationMixer||(this._animationMixer=new wh(this)),this._animationMixer}get anims(){return{current:this._currentAnimation,add:(t,e)=>this._animsAdd(t,e),get:t=>this._animsGet(t),play:(t,e=500,n=!0)=>this._animsPlay(t,e,n),mixer:this.animationMixer}}get animation(){return Hh('Please use "anims" instead of "animation"'),this.anims}_animsAdd(t,e){this._animationActions.set(t,this.animationMixer.clipAction(e))}_animsGet(t){const e=this._animationActions.get(t);return e||Hh(`Animation(${t}) not found!`),e}_animsPlay(t,e=500,n=!0){const i=this._animationActions.get(t),r=this._animationActions.get(this._currentAnimation);i&&(i.reset(),r&&(i.crossFadeFrom(r,e/1e3,!0),i.clampWhenFinished=!0),n||i.setLoop(2200,0),i.play()),this._currentAnimation=t}setAction(t){Hh(`setAction(${t}) is deprecated. Use animation.play(${t}) instead!`)}traverse(t){super.traverse(t)}traverseVisible(t){super.traverseVisible(t)}traverseAncestors(t){super.traverseAncestors(t)}}class tu extends wi{constructor(t,e){super(t,e),this.isExtendedMesh=!0,this.isGroup=!1,this.vector3=new Me,this.hasBody=!1,this.fragmentDepth=0,this.breakable=!1,this.fractureImpulse=1,this.name=`object-${this.id}`}get world(){return{theta:this.worldTheta,phi:this.worldPhi}}get worldTheta(){return this.getWorldDirection(this.vector3),Math.atan2(this.vector3.x,this.vector3.z)}get worldPhi(){return this.getWorldDirection(this.vector3),Math.acos(this.vector3.y)}}class eu{constructor(t,e){this.factory=t,this.addExisting=e}addPlane(t={},e={}){const n=this.factory.add.plane(t,e);return this.addExisting(n,t),n}addSphere(t={},e={}){const n=this.factory.add.sphere(t,e);return this.addExisting(n,t),n}addBox(t={},e={}){const n=this.factory.add.box(t,e);return this.addExisting(n,t),n}addGround(t,e={}){const n=this.factory.add.ground(t,e),i={...t,mass:0,collisionFlags:1};return this.addExisting(n,i),n}addCapsule(t={},e={}){const n=this.factory.add.capsule(t,e);return this.addExisting(n,t),n}addCylinder(t={},e={}){const n=this.factory.add.cylinder(t,e);return this.addExisting(n,t),n}addCone(t={},e={}){const n=this.factory.add.cone(t,e);return this.addExisting(n,t),n}addTorus(t={},e={}){const n=this.factory.add.torus(t,e);return this.addExisting(n,t),n}addExtrude(t,e={}){const n=this.factory.add.extrude(t,e);return n.translateX(1),this.addExisting(n),n}}class nu{constructor(t,e){this.worldTransform=t,this.physicsWorld=e,this.tmpBtVector3=new Ammo.btVector3}toAmmoV3(t,e=0){return new Ammo.btVector3(void 0!==(null==t?void 0:t.x)?t.x:e,void 0!==(null==t?void 0:t.y)?t.y:e,void 0!==(null==t?void 0:t.z)?t.z:e)}get addConstraints(){return{lock:(t,e,n)=>this.lock(t,e,n),fixed:(t,e,n)=>this.fixed(t,e,n),pointToPoint:(t,e,n,i)=>this.pointToPoint(t,e,n,i),hinge:(t,e,n,i)=>this.hinge(t,e,n,i),slider:(t,e,n={},i)=>this.slider(t,e,n,i),spring:(t,e,n={},i)=>this.spring(t,e,n,i),coneTwist:(t,e,n={frameA:{},frameB:{}},i)=>this.coneTwist(t,e,n,i),dof:(t,e,n,i)=>this.dof(t,e,n,i)}}getTransform(t,e,n={x:0,y:0,z:0},i=!1){n={x:0,y:0,z:0,...n};const r=new Ammo.btTransform;if(r.setIdentity(),i){const i=(s=t.getWorldTransform().getOrigin(),a=e.getWorldTransform().getOrigin(),o=(s.x()-a.x())/2+n.x,l=(s.y()-a.y())/2+n.y,c=(s.z()-a.z())/2+n.z,new Ammo.btVector3(o,l,c)),r=new Ammo.btTransform;r.setIdentity(),r.setOrigin(i);const h=t.getCenterOfMassTransform().inverse().op_mul(e.getWorldTransform());return h.op_mul(r),{transformA:h,transformB:r}}return r.setOrigin(new Ammo.btVector3(n.x,n.y,n.z)),{transformA:t.getCenterOfMassTransform().inverse().op_mul(e.getWorldTransform()).op_mul(r),transformB:r};var s,a,o,l,c}lock(t,e,n=!0){const i={x:0,y:0,z:0};return this.dof(t,e,{angularLowerLimit:i,angularUpperLimit:i},n)}fixed(t,e,n=!0){const i=this.getTransform(t.ammo,e.ammo);i.transformA.setRotation(t.ammo.getWorldTransform().getRotation()),i.transformB.setRotation(e.ammo.getWorldTransform().getRotation());const r=new Ammo.btFixedConstraint(t.ammo,e.ammo,i.transformA,i.transformB);return this.physicsWorld.addConstraint(r,n),r}pointToPoint(t,e,n={},i=!0){const{pivotA:r,pivotB:s}=n,a=new Ammo.btVector3((null==r?void 0:r.x)||0,(null==r?void 0:r.y)||0,(null==r?void 0:r.z)||0),o=new Ammo.btVector3((null==s?void 0:s.x)||0,(null==s?void 0:s.y)||0,(null==s?void 0:s.z)||0),l=new Ammo.btPoint2PointConstraint(t.ammo,e.ammo,a,o);return this.physicsWorld.addConstraint(l,i),l}hinge(t,e,n={},i=!0){const{pivotA:r,pivotB:s,axisA:a,axisB:o}=n,l=new Ammo.btVector3((null==r?void 0:r.x)||0,(null==r?void 0:r.y)||0,(null==r?void 0:r.z)||0),c=new Ammo.btVector3((null==s?void 0:s.x)||0,(null==s?void 0:s.y)||0,(null==s?void 0:s.z)||0),h=new Ammo.btVector3((null==a?void 0:a.x)||0,(null==a?void 0:a.y)||0,(null==a?void 0:a.z)||0),u=new Ammo.btVector3((null==o?void 0:o.x)||0,(null==o?void 0:o.y)||0,(null==o?void 0:o.z)||0),d=new Ammo.btHingeConstraint(t.ammo,e.ammo,l,c,h,u,!0);return this.physicsWorld.addConstraint(d,i),d}slider(t,e,n={},i=!0){const r=this.getTransform(t.ammo,e.ammo),{frameA:s={},frameB:a={},linearLowerLimit:o=0,linearUpperLimit:l=0,angularLowerLimit:c=0,angularUpperLimit:h=0}=n,u=r.transformA.getRotation();u.setEulerZYX(s.x||0,s.y||0,s.z||0),r.transformA.setRotation(u);const d=r.transformB.getRotation();d.setEulerZYX(a.x||0,a.y||0,a.z||0),r.transformB.setRotation(d);const p=new Ammo.btSliderConstraint(t.ammo,e.ammo,r.transformA,r.transformB,!0);return p.setLowerLinLimit(o),p.setUpperLinLimit(l),p.setLowerAngLimit(c),p.setUpperAngLimit(h),this.physicsWorld.addConstraint(p,i),p}spring(t,e,n={},i=!0){const{stiffness:r=50,damping:s=.01,angularLock:a=!1,linearLowerLimit:o={},linearUpperLimit:l={},angularLowerLimit:c={},angularUpperLimit:h={},offset:u={},center:d=!1,enableSpring:p=!0}=n,m={x:0,y:0,z:0,...u},f=this.getTransform(t.ammo,e.ammo,m,d),g=new Ammo.btGeneric6DofSpringConstraint(t.ammo,e.ammo,f.transformA,f.transformB,!0);this.tmpBtVector3.setValue(o.x||0,o.y||0,o.z||0),g.setLinearLowerLimit(this.tmpBtVector3),this.tmpBtVector3.setValue(l.x||0,l.y||0,l.z||0),g.setLinearUpperLimit(this.tmpBtVector3),a?(this.tmpBtVector3.setValue(0,0,0),g.setAngularLowerLimit(this.tmpBtVector3),g.setAngularUpperLimit(this.tmpBtVector3)):(console.log(c,h),g.setAngularLowerLimit(this.toAmmoV3(c,-Math.PI)),g.setAngularUpperLimit(this.toAmmoV3(h,Math.PI)));for(let v=0;v<3;v++)g.enableSpring(v,p),g.setStiffness(v,r),g.setDamping(v,s);return this.physicsWorld.addConstraint(g,i),g}coneTwist(t,e,n,i=!0){const{frameA:r,frameB:s}=n,a=new Ammo.btTransform;a.setIdentity(),a.getOrigin().setValue((null==r?void 0:r.x)||0,(null==r?void 0:r.y)||0,(null==r?void 0:r.z)||0);const o=new Ammo.btTransform;o.setIdentity(),o.getOrigin().setValue((null==s?void 0:s.x)||0,(null==s?void 0:s.y)||0,(null==s?void 0:s.z)||0),this.getTransform(t.ammo,e.ammo);const l=new Ammo.btConeTwistConstraint(e.ammo,t.ammo,a,o);return l.setAngularOnly(!0),this.physicsWorld.addConstraint(l,i),l}dof(t,e,n={},i=!0){const{offset:r,center:s=!1}=n,a={x:0,y:0,z:0,...r},o=this.getTransform(t.ammo,e.ammo,a,s),l=new Ammo.btGeneric6DofConstraint(t.ammo,e.ammo,o.transformA,o.transformB,!0),{linearLowerLimit:c,linearUpperLimit:h,angularLowerLimit:u,angularUpperLimit:d}=n,p=this.toAmmoV3(c),m=this.toAmmoV3(h),f=this.toAmmoV3(u,-Math.PI),g=this.toAmmoV3(d,Math.PI);return l.setLinearLowerLimit(p),l.setLinearUpperLimit(m),l.setAngularLowerLimit(f),l.setAngularUpperLimit(g),Ammo.destroy(p),Ammo.destroy(m),Ammo.destroy(f),Ammo.destroy(g),this.physicsWorld.addConstraint(l,i),l}}const iu="hull",ru="manual",su=function(){const t=new Me,e=new Me,n=new $e;return function(i,r,s,a={}){if(a.type=iu,cu(a),a.fit===ru)return console.warn("cannot use fit: manual with type: hull"),null;const o=pu(i,r),l=new Ammo.btVector3,c=new Ammo.btConvexHullShape;c.setMargin(a.margin),e.addVectors(o.max,o.min).multiplyScalar(.5);let h=0;for(let t=0;tu&&console.warn(`too many vertices for hull shape; sampling ~${u} from ~${h} vertices`);const d=Math.min(1,u/h);for(let m=0;m=100){const t=new Ammo.btShapeHull(c);t.buildHull(a.margin),Ammo.destroy(c),p=new Ammo.btConvexHullShape(Ammo.getPointer(t.getVertexPointer()),t.numVertices()),Ammo.destroy(t)}return Ammo.destroy(l),hu(p,a,du(s,a)),p}}(),au=function(){const t=new Me,e=new Me,n=new $e;return function(i,r,s,a,o={}){if(o.type="hacd",cu(o),o.fit===ru)return console.warn("cannot use fit: manual with type: hacd"),[];if(!Ammo.hasOwnProperty("HACD"))return console.warn("HACD unavailable in included build of Ammo.js. Visit https://github.com/mozillareality/ammo.js for the latest version."),[];const l=pu(i,r);du(a,o);let c=0,h=0;e.addVectors(l.max,l.min).multiplyScalar(.5);for(let t=0;t=123?t.copy(e.matrixWorld).invert():t.getInverse(e.matrixWorld),(new Me).setFromMatrixScale(e.matrixWorld),e.traverse((n=>{const s=new $e;n.isMesh&&(i.includeInvisible||n.el&&n.el.object3D.visible||n.visible)&&(n===e?s.identity():(n.updateWorldMatrix(!0),s.multiplyMatrices(t,n.matrixWorld)),r(n.geometry.isBufferGeometry?n.geometry.attributes.position.array:n.geometry.vertices,s.elements,n.geometry.index?n.geometry.index.array:null))}))}}(),du=function(){const t=new $e;return function(e,n={}){const i=new Me(1,1,1);return"all"===n.fit&&(t.fromArray(e),i.setFromMatrixScale(t)),i}}();new Me;const pu=function(t,e){const n=new Te;let i=1/0,r=1/0,s=1/0,a=-1/0,o=-1/0,l=-1/0;return n.min.set(0,0,0),n.max.set(0,0,0),mu(t,e,(t=>{t.xa&&(a=t.x),t.y>o&&(o=t.y),t.z>l&&(l=t.z)})),n.min.set(i,r,s),n.max.set(a,o,l),n},mu=function(){const t=new Me,e=new $e;return function(n,i,r){for(let s=0;sthis.makePlane(t,e),box:(t={},e={})=>this.makeBox(t,e),sphere:(t={},e={})=>this.makeSphere(t,e),capsule:(t={},e={})=>this.makeCapsule(t,e),cylinder:(t={},e={})=>this.makeCylinder(t,e),cone:(t={},e={})=>this.makeCone(t,e),torus:(t={},e={})=>this.makeTorus(t,e),extrude:(t,e={})=>this.makeExtrude(t,e)}}get add(){return{mesh:t=>this.addMesh(t),existing:t=>this.addExisting(t),plane:(t={},e={})=>this.addPlane(t,e),box:(t={},e={})=>this.addBox(t,e),ground:(t,e={})=>this.addGround(t,e),sphere:(t={},e={})=>this.addSphere(t,e),capsule:(t={},e={})=>this.addCapsule(t,e),cylinder:(t={},e={})=>this.addCylinder(t,e),cone:(t={},e={})=>this.addCone(t,e),torus:(t={},e={})=>this.addTorus(t,e),extrude:(t,e={})=>this.addExtrude(t,e),material:(t={})=>this.addMaterial(t)}}addExisting(...t){"headless"!==this.scene&&this.scene.add(...t)}addMesh(t){if(Array.isArray(t))for(let e=0;e{var r,s;const{bodies:a,event:o}=i;(null==(r=a[0])?void 0:r.name)&&(null==(s=a[1])?void 0:s.name)&&(null==t?void 0:t.name)&&(null==e?void 0:e.name)&&(a[0].name===t.name&&a[1].name===e.name||a[1].name===t.name&&a[0].name===e.name)&&n(o)})))}}class yu{constructor(t,e,n={}){this.scene=t,this.world=e,this.options=n,this.debugDrawMode=n.debugDrawMode||1;const i=32768&this.debugDrawMode||!1,r=n.maxBufferSize||1e6;this.geometry=new si;const s=new Float32Array(3*r),a=new Float32Array(3*r);this.geometry.setAttribute("position",new Yn(s,3).setUsage(Tt)),this.geometry.setAttribute("color",new Yn(a,3).setUsage(Tt)),this.index=0;const o=new yo({vertexColors:!0,depthTest:!i});this.mesh=new Eo(this.geometry,o),i&&(this.mesh.renderOrder=999),this.mesh.frustumCulled=!1,this.enabled=!1,this.debugDrawer=new Ammo.DebugDrawer,this.debugDrawer.drawLine=this.drawLine.bind(this),this.debugDrawer.drawContactPoint=this.drawContactPoint.bind(this),this.debugDrawer.reportErrorWarning=this.reportErrorWarning.bind(this),this.debugDrawer.draw3dText=this.draw3dText.bind(this),this.debugDrawer.setDebugMode=this.setDebugMode.bind(this),this.debugDrawer.getDebugMode=this.getDebugMode.bind(this),this.world.setDebugDrawer(this.debugDrawer)}enable(){this.enabled=!0,this.scene.add(this.mesh)}disable(){this.enabled=!1,this.scene.remove(this.mesh)}update(){this.enabled&&(0!=this.index&&(this.geometry.attributes.position.needsUpdate=!0,this.geometry.attributes.color.needsUpdate=!0),this.index=0,this.world.debugDrawWorld(),this.geometry.setDrawRange(0,this.index))}drawLine(t,e,n){const i=Ammo.HEAPF32,r=i[(n+0)/4],s=i[(n+4)/4],a=i[(n+8)/4],o=i[(t+0)/4],l=i[(t+4)/4],c=i[(t+8)/4];this.geometry.attributes.position.setXYZ(this.index,o,l,c),this.geometry.attributes.color.setXYZ(this.index++,r,s,a);const h=i[(e+0)/4],u=i[(e+4)/4],d=i[(e+8)/4];this.geometry.attributes.position.setXYZ(this.index,h,u,d),this.geometry.attributes.color.setXYZ(this.index++,r,s,a)}drawContactPoint(t,e,n,i,r){const s=Ammo.HEAPF32,a=s[(r+0)/4],o=s[(r+4)/4],l=s[(r+8)/4],c=s[(t+0)/4],h=s[(t+4)/4],u=s[(t+8)/4];this.geometry.attributes.position.setXYZ(this.index,c,h,u),this.geometry.attributes.color.setXYZ(this.index++,a,o,l);const d=s[(e+0)/4]*n,p=s[(e+4)/4]*n,m=s[(e+8)/4]*n;this.geometry.attributes.position.setXYZ(this.index,c+d,h+p,u+m),this.geometry.attributes.color.setXYZ(this.index++,a,o,l)}reportErrorWarning(t){Ammo.hasOwnProperty("Pointer_stringify")?console.warn(Ammo.Pointer_stringify(t)):this.warnedOnce||(this.warnedOnce=!0,console.warn("Cannot print warningString, please rebuild Ammo.js using 'debug' flag"))}draw3dText(t,e){console.warn("TODO: draw3dText")}setDebugMode(t){this.debugDrawMode=t}getDebugMode(){return this.debugDrawMode}}const xu=new Me,_u=new Ih,bu=new zi,Mu=new Me,wu=new Un;class Su{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new Ru,this.unassigned=new Ru,this.vertices=[]}setFromPoints(t){if(t.length>=4){this.makeEmpty();for(let e=0,n=t.length;ethis.tolerance)return!1;return!0}intersectRay(t,e){const n=this.faces;let i=-1/0,r=1/0;for(let s=0,a=n.length;s0&&o>=0)return null;const l=0!==o?-a/o:0;if(!(l<=0)&&(o>0?r=Math.min(l,r):i=Math.max(l,i),i>r))return null}return i!==-1/0?t.at(i,e):t.at(r,e),e}intersectsRay(t){return null!==this.intersectRay(t,xu)}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(t,e){return t.face=e,null===e.outside?this.assigned.append(t):this.assigned.insertBefore(e.outside,t),e.outside=t,this}removeVertexFromFace(t,e){return t===e.outside&&(null!==t.next&&t.next.face===e?e.outside=t.next:e.outside=null),this.assigned.remove(t),this}removeAllVerticesFromFace(t){if(null!==t.outside){const e=t.outside;let n=t.outside;for(;null!==n.next&&n.next.face===t;)n=n.next;return this.assigned.removeSubList(e,n),e.prev=n.next=null,t.outside=null,e}}deleteFaceVertices(t,e){const n=this.removeAllVerticesFromFace(t);if(void 0!==n)if(void 0===e)this.unassigned.appendChain(n);else{let t=n;do{const n=t.next;e.distanceToPoint(t.point)>this.tolerance?this.addVertexToFace(t,e):this.unassigned.append(t),t=n}while(null!==t)}return this}resolveUnassignedPoints(t){if(!1===this.unassigned.isEmpty()){let e=this.unassigned.first();do{const n=e.next;let i=this.tolerance,r=null;for(let s=0;si&&(i=t,r=n),i>1e3*this.tolerance)break}}null!==r&&this.addVertexToFace(e,r),e=n}while(null!==e)}return this}computeExtremes(){const t=new Me,e=new Me,n=[],i=[];for(let r=0;r<3;r++)n[r]=i[r]=this.vertices[0];t.copy(this.vertices[0].point),e.copy(this.vertices[0].point);for(let r=0,s=this.vertices.length;re.getComponent(t)&&(e.setComponent(t,a.getComponent(t)),i[t]=s)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(t.x),Math.abs(e.x))+Math.max(Math.abs(t.y),Math.abs(e.y))+Math.max(Math.abs(t.z),Math.abs(e.z))),{min:n,max:i}}computeInitialHull(){const t=this.vertices,e=this.computeExtremes(),n=e.min,i=e.max;let r=0,s=0;for(let u=0;u<3;u++){const t=i[u].point.getComponent(u)-n[u].point.getComponent(u);t>r&&(r=t,s=u)}const a=n[s],o=i[s];let l,c;r=0,_u.set(a.point,o.point);for(let u=0,d=this.vertices.length;ur&&(r=t,l=e)}}r=-1,bu.setFromCoplanarPoints(a.point,o.point,l.point);for(let u=0,d=this.vertices.length;ur&&(r=t,c=e)}}const h=[];if(bu.distanceToPoint(c.point)<0){h.push(Tu.create(a,o,l),Tu.create(c,o,a),Tu.create(c,l,o),Tu.create(c,a,l));for(let t=0;t<3;t++){const e=(t+1)%3;h[t+1].getEdge(2).setTwin(h[0].getEdge(e)),h[t+1].getEdge(1).setTwin(h[e+1].getEdge(0))}}else{h.push(Tu.create(a,l,o),Tu.create(c,a,o),Tu.create(c,o,l),Tu.create(c,l,a));for(let t=0;t<3;t++){const e=(t+1)%3;h[t+1].getEdge(2).setTwin(h[0].getEdge((3-t)%3)),h[t+1].getEdge(0).setTwin(h[e+1].getEdge(1))}}for(let u=0;u<4;u++)this.faces.push(h[u]);for(let u=0,d=t.length;ur&&(r=i,t=this.faces[n])}null!==t&&this.addVertexToFace(e,t)}}return this}reindexFaces(){const t=[];for(let e=0;ee&&(e=r,t=i),i=i.next}while(null!==i&&i.face===n);return t}}computeHorizon(t,e,n,i){let r;this.deleteFaceVertices(n),n.mark=1,r=null===e?e=n.getEdge(0):e.next;do{const e=r.twin,n=e.face;0===n.mark&&(n.distanceToPoint(t)>this.tolerance?this.computeHorizon(t,e,n,i):i.push(r)),r=r.next}while(r!==e);return this}addAdjoiningFace(t,e){const n=Tu.create(t,e.tail(),e.head());return this.faces.push(n),n.getEdge(-1).setTwin(e.twin),n.getEdge(0)}addNewFaces(t,e){this.newFaces=[];let n=null,i=null;for(let r=0;r0;)e=e.next,t--;for(;t<0;)e=e.prev,t++;return e}compute(){const t=this.edge.tail(),e=this.edge.head(),n=this.edge.next.head();return wu.set(t.point,e.point,n.point),wu.getNormal(this.normal),wu.getMidpoint(this.midpoint),this.area=wu.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(t){return this.normal.dot(t)-this.constant}}class Au{constructor(t,e){this.vertex=t,this.prev=null,this.next=null,this.twin=null,this.face=e}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const t=this.head(),e=this.tail();return null!==e?e.point.distanceTo(t.point):-1}lengthSquared(){const t=this.head(),e=this.tail();return null!==e?e.point.distanceToSquared(t.point):-1}setTwin(t){return this.twin=t,t.twin=this,this}}class Eu{constructor(t){this.point=t,this.prev=null,this.next=null,this.face=null}}class Ru{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(t,e){return e.prev=t.prev,e.next=t,null===e.prev?this.head=e:e.prev.next=e,t.prev=e,this}insertAfter(t,e){return e.prev=t,e.next=t.next,null===e.next?this.tail=e:e.next.prev=e,t.next=e,this}append(t){return null===this.head?this.head=t:this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t,this}appendChain(t){for(null===this.head?this.head=t:this.tail.next=t,t.prev=this.tail;null!==t.next;)t=t.next;return this.tail=t,this}remove(t){return null===t.prev?this.head=t.next:t.prev.next=t.next,null===t.next?this.tail=t.prev:t.next.prev=t.prev,this}removeSubList(t,e){return null===t.prev?this.head=e.next:t.prev.next=e.next,null===e.next?this.tail=t.prev:e.next.prev=t.prev,this}isEmpty(){return null===this.head}}class Cu extends si{constructor(t=[]){super();const e=[],n=[],i=(new Su).setFromPoints(t).faces;for(let r=0;rnew(window.THREE&&window.THREE.ConvexGeometry?window.THREE.ConvexGeometry:Cu)(t),Lu=function(t,e){this.minSizeForBreak=t||1.4,this.smallDelta=e||1e-4,this.tempLine1=new Ih,this.tempPlane1=new zi,this.tempPlane2=new zi,this.tempPlane_Cut=new zi,this.tempCM1=new Me,this.tempCM2=new Me,this.tempVector3=new Me,this.tempVector3_2=new Me,this.tempVector3_3=new Me,this.tempVector3_P0=new Me,this.tempVector3_P1=new Me,this.tempVector3_P2=new Me,this.tempVector3_N0=new Me,this.tempVector3_N1=new Me,this.tempVector3_AB=new Me,this.tempVector3_CB=new Me,this.tempResultObjects={object1:null,object2:null},this.segments=[];for(var n=0;n<900;n++)this.segments[n]=!1};var Iu;Lu.prototype={constructor:Lu,prepareBreakableObject:function(t,e,n,i,r){t.geometry.isBufferGeometry||console.error("THREE.ConvexObjectBreaker.prepareBreakableObject(): Parameter object must have a BufferGeometry."),t.userData.ammoPhysicsData={};var s=t.userData.ammoPhysicsData;s.mass=e,s.velocity=n.clone(),s.angularVelocity=i.clone(),s.breakable=r},subdivideByImpact:function(t,e,n,i,r){var s=[],a=this.tempPlane1,o=this.tempPlane2;this.tempVector3.addVectors(e,n),a.setFromCoplanarPoints(e,t.position,this.tempVector3);var l=r+i,c=this;return function r(h,u,d,p){if(Math.random()<.05*p||p>l)s.push(h);else{var m=Math.PI;0===p?(o.normal.copy(a.normal),o.constant=a.constant):p<=i?(m=(d-u)*(.2+.6*Math.random())+u,c.tempVector3_2.copy(t.position).sub(e).applyAxisAngle(n,m).add(e),o.setFromCoplanarPoints(e,c.tempVector3,c.tempVector3_2)):(m=(.5*(1&p)+.2*(2-Math.random()))*Math.PI,c.tempVector3_2.copy(e).sub(h.position).applyAxisAngle(n,m).add(h.position),c.tempVector3_3.copy(n).add(h.position),o.setFromCoplanarPoints(h.position,c.tempVector3_3,c.tempVector3_2)),c.cutByPlane(h,o,c.tempResultObjects);var f=c.tempResultObjects.object1,g=c.tempResultObjects.object2;f&&r(f,u,m,p+1),g&&r(g,m,d,p+1)}}(t,0,2*Math.PI,0),s},cutByPlane:function(t,e,n){var i=t.geometry,r=i.attributes.position.array,s=i.attributes.normal.array,a=r.length/3,o=a/3,l=i.getIndex();function c(t,e){var n=3*t+e;return l?l[n]:n}l&&(o=(l=l.array).length/3);for(var h=[],u=[],d=this.smallDelta,p=a*a,m=0;md?(N=2,u.push(f.clone())):O<-d?(N=1,h.push(f.clone())):(N=3,h.push(f.clone()),u.push(f.clone()));var O,D=0;if((O=A.distanceToPoint(g))>d?(D=2,u.push(g.clone())):O<-d?(D=1,h.push(g.clone())):(D=3,h.push(g.clone()),u.push(g.clone())),1===N&&2===D||2===N&&1===D){this.tempLine1.start.copy(f),this.tempLine1.end.copy(g);var U=new Me;if(void 0===(U=A.intersectLine(this.tempLine1,U)))return console.error("Internal error: segment does not intersect plane."),n.segmentedObject1=null,n.segmentedObject2=null,0;h.push(U),u.push(U.clone())}}}var B=.5*t.userData.ammoPhysicsData.mass;this.tempCM1.set(0,0,0);var F=0,k=h.length;if(k>0){for(m=0;m0){for(m=0;m4)try{(G=new wi(Pu(h),t.material)).position.copy(this.tempCM1),G.quaternion.copy(t.quaternion),G.userData=t.userData,this.prepareBreakableObject(G,B,t.userData.ammoPhysicsData.velocity,t.userData.ammoPhysicsData.angularVelocity,2*F>this.minSizeForBreak),j++}catch(X){Hh("Error in ConvexObjectBreaker.ts",!0),Hh(X,!0)}if(V>4)try{(W=new wi(Pu(u),t.material)).position.copy(this.tempCM2),W.quaternion.copy(t.quaternion),W.userData=t.userData,this.prepareBreakableObject(W,B,t.userData.ammoPhysicsData.velocity,t.userData.ammoPhysicsData.angularVelocity,2*z>this.minSizeForBreak),j++}catch(X){Hh("Error in ConvexObjectBreaker.ts",!0),Hh(X,!0)}return n.object1=G,n.object2=W,j}},Lu.transformFreeVector=function(t,e){var n=t.x,i=t.y,r=t.z,s=e.elements;return t.x=s[0]*n+s[4]*i+s[8]*r,t.y=s[1]*n+s[5]*i+s[9]*r,t.z=s[2]*n+s[6]*i+s[10]*r,t},Lu.transformFreeVectorInverse=function(t,e){var n=t.x,i=t.y,r=t.z,s=e.elements;return t.x=s[0]*n+s[1]*i+s[2]*r,t.y=s[4]*n+s[5]*i+s[6]*r,t.z=s[8]*n+s[9]*i+s[10]*r,t},Lu.transformTiedVectorInverse=function(t,e){var n=t.x,i=t.y,r=t.z,s=e.elements;return t.x=s[0]*n+s[1]*i+s[2]*r-s[12],t.y=s[4]*n+s[5]*i+s[6]*r-s[13],t.z=s[8]*n+s[9]*i+s[10]*r-s[14],t},Lu.transformPlaneToLocalSpace=(Iu=new Me,function(t,e,n){n.normal.copy(t.normal),n.constant=t.constant;var i=Lu.transformTiedVectorInverse(t.coplanarPoint(Iu),e);Lu.transformFreeVectorInverse(n.normal,e),n.constant=-i.dot(n.normal)});const Nu=(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){t instanceof Error&&console.error(t.message)}return!1})();function Ou(t,e){e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{Object.defineProperty(t.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n)||Object.create(null))}))}))}class Du{constructor(t){this.physics=t}setRayFromWorld(t=0,e=0,n=0){this._btRayFrom.setValue(t,e,n)}setRayToWorld(t=0,e=0,n=0){this._btRayTo.setValue(t,e,n)}hasHit(){return this._btRayCallback.hasHit()}rayTest(){void 0!==this._btRayCallback&&Ammo.destroy(this._btRayCallback),this._btRayCallback="closest"===this.type?new Ammo.ClosestRayResultCallback(this._btRayFrom,this._btRayTo):new Ammo.AllHitsRayResultCallback(this._btRayFrom,this._btRayTo),this.physics.physicsWorld.rayTest(this._btRayFrom,this._btRayTo,this._btRayCallback)}destroy(){void 0!==this._btRayFrom&&Ammo.destroy(this._btRayFrom),void 0!==this._btRayTo&&Ammo.destroy(this._btRayTo),void 0!==this._btRayCallback&&Ammo.destroy(this._btRayCallback)}}class Uu{constructor(t){this.physics=t,this.type="closest",this._btRayFrom=new Ammo.btVector3(0,0,0),this._btRayTo=new Ammo.btVector3(0,0,0)}}class Bu{constructor(t){this.physics=t,this.type="allHits",this._btRayFrom=new Ammo.btVector3(0,0,0),this._btRayTo=new Ammo.btVector3(0,0,0)}}Ou(Uu,[Du,class{constructor(t){this.physics=t}getHitPointWorld(){const t=this._btRayCallback.get_m_hitPointWorld();return{x:t.x(),y:t.y(),z:t.z()}}getHitNormalWorld(){const t=this._btRayCallback.get_m_hitNormalWorld();return{x:t.x(),y:t.y(),z:t.z()}}getCollisionObject(){return Ammo.castObject(this._btRayCallback.get_m_collisionObject(),Ammo.btRigidBody).threeObject}}]),Ou(Bu,[Du,class{constructor(t){this.physics=t}getHitPointsWorld(){const t=this._btRayCallback.get_m_hitPointWorld(),e=[];for(let n=t.size()-1;n>=0;n--){const i=t.at(n);e.push({x:i.x(),y:i.y(),z:i.z()})}return e}getHitPointWorld(){return Hh("Use getHitPointsWorld() instead of getHitPointWorld() for the AllHitsRayCaster!"),this.getHitPointsWorld()}getHitNormalsWorld(){const t=this._btRayCallback.get_m_hitNormalWorld(),e=[];for(let n=t.size()-1;n>=0;n--){const i=t.at(n);e.push({x:i.x(),y:i.y(),z:i.z()})}return e}getCollisionObjects(){const t=[],e=this._btRayCallback.get_m_collisionObjects();for(let n=e.size()-1;n>=0;n--){const i=Ammo.castObject(e.at(n),Ammo.btRigidBody);t.push(i.threeObject)}return t}}]);class Fu extends Xh{constructor(t,e={}){super(),this.scene=t,this.config=e,this.rigidBodies=[],this.earlierDetectedCollisions=[],this.complexShapes=["plane","hull","hacd","vhacd","convexMesh","concaveMesh"],this.gravity=e.gravity||{x:0,y:-9.81,z:0},this.isHeadless="headless"===t,this.tmpEuler=new cn,this.tmpQuaternion=new be,this.tmpVector3=new Me,this.tmpVector3a=new Me,this.tmpMatrix4=new $e,this.tmpMatrix4a=new $e,this.tmpBtVector3=new Ammo.btVector3,this.tmpBtQuaternion=new Ammo.btQuaternion(0,0,0,1),this.emptyV3=new Me,this.impactPoint=new Me,this.impactNormal=new Me,"headless"!==t&&(this.defaultMaterial=new fu),this.start()}get tmpTrans(){return console.warn("Use worldTransform instead of tmpTrans."),this.worldTransform}set tmpTrans(t){console.warn("Use worldTransform instead of tmpTrans."),this.worldTransform=t}destroy(t){var e;const n=Object.keys(t).includes("body")?t.body:t;if(void 0===(null==n?void 0:n.ammo))return;let i=n.ammo.threeObject;const r=i.name;if(r&&i&&(null==(e=null==i?void 0:i.body)?void 0:e.ammo)){i.body.isSoftBody?this.physicsWorld.removeSoftBody(i.body.ammo):this.physicsWorld.removeRigidBody(i.body.ammo),i.body.destructor(),i.body=void 0,i.hasBody=!1,delete n.ammo.threeObject;for(let t=0;tthis.addExisting(t,e))),this.constraints=new nu(this.worldTransform,this.physicsWorld),"headless"!==this.scene&&(this.debugDrawer=new yu(this.scene,this.physicsWorld,{}))}updateDebugger(){"headless"!==this.scene&&this.debugDrawer&&this.debugDrawer.enabled&&this.debugDrawer.update()}setupPhysicsWorld(){const t=this.gravity,{softBodies:e=!1}=this.config;let n;if(!e){const t=new Ammo.btDefaultCollisionConfiguration,e=new Ammo.btCollisionDispatcher(t),i=new Ammo.btDbvtBroadphase,r=new Ammo.btSequentialImpulseConstraintSolver;n=new Ammo.btDiscreteDynamicsWorld(e,i,r,t)}if(e){const t=new Ammo.btSoftBodyRigidBodyCollisionConfiguration,e=new Ammo.btCollisionDispatcher(t),i=new Ammo.btDbvtBroadphase,r=new Ammo.btSequentialImpulseConstraintSolver,s=new Ammo.btDefaultSoftBodySolver;n=new Ammo.btSoftRigidDynamicsWorld(e,i,r,t,s)}return n.setGravity(new Ammo.btVector3(t.x,t.y,t.z)),n}createDebrisFromBreakableObject(t,e){"headless"!==this.scene&&(t.material=e.material,t.shape="hull",t.fragmentDepth=e.fragmentDepth+1,t.name=`${e.name}__DEBRIS_${t.id}`,this.scene.add(t),this.addExisting(t,{autoCenter:!0}),t.body.fractureImpulse=e.body.fractureImpulse,t.body.breakable=!1,setTimeout((()=>{t.body.breakable=!0}),2500))}removeDebris(t){"headless"!==this.scene&&(this.scene.remove(t),this.destroy(t))}update(t){this.updatePhysics(t),this.detectCollisions()}updatePhysics(t){const e=t/1e3;this.physicsWorld.stepSimulation(e,this.config.maxSubSteps||4,this.config.fixedTimeStep||1/60);for(let i=0;i=123?this.tmpMatrix4a.copy(t.parent.matrixWorld).invert():this.tmpMatrix4a.getInverse(t.parent.matrixWorld):this.tmpMatrix4a.identity(),this.tmpMatrix4a.multiply(this.tmpMatrix4),this.tmpMatrix4a.decompose(t.position,t.quaternion,t.scale)}}}detectCollisions(){var t,e;const n=[];this.impactPoint.set(0,0,0),this.impactNormal.set(0,0,0);const i=this.physicsWorld.getDispatcher(),r=i.getNumManifolds();for(let s=0;st.combinedName===s))&&(b="collision"),!n.find((t=>t.combinedName===s))){n.push({combinedName:s,collision:!0});const e={x:i.x(),y:i.y(),z:i.z()},a={x:r.x(),y:r.y(),z:r.z()};c.body.impact.push({impulse:t,point:e,normal:a,name:h.name}),h.body.impact.push({impulse:t,point:e,normal:a,name:c.name}),this.collisionEvents.emit("collision",{bodies:[c,h],event:b})}}t>=_&&(_=t,(p||m)&&(this.impactPoint.set(i.x(),i.y(),i.z()),this.impactNormal.set(r.x(),r.y(),r.z())));break}}if(!x)continue;if(!y)continue;const M=2;if(this.emptyV3.set(0,0,0),c.userData.ammoPhysicsData={mass:1,velocity:this.emptyV3,angularVelocity:this.emptyV3,breakable:p,physicsBody:o},h.userData.ammoPhysicsData={mass:1,velocity:this.emptyV3,angularVelocity:this.emptyV3,breakable:m,physicsBody:l},p&&_>f&&c.fragmentDepthg&&h.fragmentDepth{const{combinedName:e}=t;if(!n.find((t=>t.combinedName===e))){const t=e.split("__"),n=this.rigidBodies.find((e=>e.uuid===t[0])),i=this.rigidBodies.find((e=>e.uuid===t[1])),r="end";n&&i&&this.collisionEvents.emit("collision",{bodies:[n,i],event:r})}})),this.earlierDetectedCollisions=[...n]}setGravity(t=0,e=-9.8,n=0){this.tmpBtVector3.setValue(t,e,n),this.physicsWorld.setGravity(this.tmpBtVector3)}get debug(){return this.isHeadless?null:{enable:()=>{this.debugDrawer.enable()},mode:(t=1)=>{this.debugDrawer.setDebugMode(t)},disable:()=>{this.debugDrawer.disable()}}}start(){"undefined"!=typeof Ammo?"function"==typeof Ammo?Ammo().then((()=>{this.setup()})):this.setup():Hh("Are you sure you included ammo.js?")}get add(){return{collider:(t,e,n)=>this.collisionEvents.addCollider(t,e,n),constraints:this.constraints.addConstraints,existing:(t,e)=>this.addExisting(t,e),plane:(t={},e={})=>this.shapes.addPlane(t,e),sphere:(t={},e={})=>this.shapes.addSphere(t,e),ground:(t={},e={})=>this.shapes.addGround(t,e),box:(t={},e={})=>this.shapes.addBox(t,e),capsule:(t={},e={})=>this.shapes.addCapsule(t,e),cylinder:(t={},e={})=>this.shapes.addCylinder(t,e),cone:(t={},e={})=>this.shapes.addCone(t,e),torus:(t={},e={})=>this.shapes.addTorus(t,e),extrude:(t,e={})=>this.shapes.addExtrude(t,e),raycaster:(t="closest")=>"closest"===t?new Uu(this):new Bu(this)}}prepareThreeObjectForCollisionShape(t,e={}){var n,i;const{autoCenter:r=!1}=e,s={width:1,height:1,depth:1,radius:1,radiusTop:1,radiusBottom:1,tube:.4,tubularSegments:6};let a="unknown";const o=(null==(n=t.geometry)?void 0:n.type)||"unknown";/box/i.test(o)?a="box":/cone/i.test(o)?a="cone":/cylinder/i.test(o)?a="cylinder":/extrude/i.test(o)?a="extrude":/plane/i.test(o)?a="plane":/sphere/i.test(o)?a="sphere":/torus/i.test(o)&&(a="torus");let l={...s,...null==(i=null==t?void 0:t.geometry)?void 0:i.parameters};if(e.shape?(l={...s,...e},a=e.shape):t.shape&&(a=t.shape),Object.keys(l).forEach((t=>{void 0===l[t]&&s[t]&&(l[t]=s[t])})),r)if(t.isMesh&&t.geometry)t.geometry.center();else if(t.isGroup){const e=new Te,n=new Me;e.setFromObject(t).getCenter(n),t.traverse((t=>{t.isMesh&&t.geometry.translate(-n.x,-n.y,-n.z)}))}return"cylinder"===a&&(l.radius=e.radius||l.radiusTop),"extrude"===a&&(a="hacd"),"mesh"!==a&&"convex"!==a||(a="convexMesh"),"concave"===a&&(a="concaveMesh"),"unknown"===a&&(Hh(`Shape for ${null==t?void 0:t.name} not recognized! Will fallback to box.`),a="box"),{shape:a,params:l,object:t}}createCollisionShape(t,e,n){const i=(null==n?void 0:n.quaternion)?null==n?void 0:n.quaternion:new be(0,0,0,1),{axis:r="y"}=e,s=new Ammo.btVector3,a=null==n?void 0:n.geometry;n&&(null==a?void 0:a.isGeometry)&&(n.geometry=(new si).fromGeometry(a));let o,l={};switch(-1!==this.complexShapes.indexOf(t)&&(l=(t=>{const e=(new $e).elements,n=[],i=[],r=[];return uu(t,{},((t,e,s)=>{n.push(t),i.push(e),r.push(s)})),{vertices:n,matrices:i,indexes:r,matrixWorld:e}})(n)),t){case"box":s.setValue(e.width/2,e.height/2,e.depth/2),o=new Ammo.btBoxShape(s);break;case"sphere":o=new Ammo.btSphereShape(e.radius);break;case"cylinder":switch(r){case"y":s.setValue(e.radius,e.height/2,e.radius),o=new Ammo.btCylinderShape(s);break;case"x":s.setValue(e.height/2,e.radius,e.radius),o=new Ammo.btCylinderShapeX(s);break;case"z":s.setValue(e.radius,e.radius,e.height/2),o=new Ammo.btCylinderShapeZ(s)}break;case"cone":switch(r){case"y":o=new Ammo.btConeShape(e.radius,e.height);break;case"x":o=new Ammo.btConeShapeX(e.radius,e.height);break;case"z":o=new Ammo.btConeShapeZ(e.radius,e.height)}break;case"capsule":switch(r){case"y":o=new Ammo.btCapsuleShape(e.radius,e.height);break;case"x":o=new Ammo.btCapsuleShapeX(e.radius,e.height);break;case"z":o=new Ammo.btCapsuleShapeZ(e.radius,e.height)}break;case"torus":o=((t,e)=>{const{radius:n=1,tube:i=.4,tubularSegments:r=8}=t,s=Math.PI,a=r,o=Math.sqrt(2*i*i-2*i*i*Math.cos(2*s/a)),l=new Ammo.btVector3(i,s/a+.5*o,i),c=new Ammo.btCylinderShape(l);c.setMargin(.05);const h=new Ammo.btCompoundShape,u=new Ammo.btVector3(0,0,1),d=new Ammo.btVector3(0,n,0),p=new Ammo.btQuaternion(e.x,e.y,e.z,e.w);for(let m=0;m{const{_childOffset:n,_compoundOffset:i}=t;if(n){const{pos:i,quat:r,scale:s,margin:a}=n,o=this.applyPosQuatScaleMargin(t,i,r,s,a);e.addChildShape(o,t)}else if(i){const n=new Ammo.btTransform;n.setIdentity(),n.setOrigin(new Ammo.btVector3(i.x,i.y,i.z)),e.addChildShape(n,t)}else{const n=new Ammo.btTransform;n.setIdentity(),e.addChildShape(n,t)}})),e}addExisting(t,e={}){const{hasBody:n}=t;if(n)return void Hh(`Object "${t.name}" already has a physical body!`);const i=new Me,r=new be,s=new Me;t.getWorldPosition(i),t.getWorldQuaternion(r),t.getWorldScale(s);const a="1"===(e.collisionFlags||0).toString(2).slice(-1),o="1"===(e.collisionFlags||0).toString(2).slice(-2,-1),{shape:l="unknown",compound:c=[],mass:h=(a||o?0:1),collisionFlags:u=0,collisionGroup:d=1,collisionMask:p=-1,offset:m,breakable:f=!1,addChildren:g=!0,margin:v=.01,ignoreScale:y=!1,fractureImpulse:x=1}=e;if(y&&s.set(1,1,1),c.length>=1){const e=c.map((t=>this.createCollisionShape(t.shape,t))),n=this.mergeCollisionShapesToCompoundShape(e),a=this.applyPosQuatScaleMargin(n,i,r,s,v),l=this.collisionShapeToRigidBody(n,a,h,o);return this.addRigidBodyToWorld(t,l,u,d,p,m),t.body.breakable=f,t.body.fractureImpulse=x,void(t.body.ignoreScale=y)}const _=[];if("unknown"!==l||t.isMesh){const n=this.prepareThreeObjectForCollisionShape(t,e),i=this.createCollisionShape(n.shape,n.params,n.object);_.push(i)}if("unknown"===l&&g&&t.children.length>=1&&t.children.forEach((t=>{if(t.isMesh){const e=this.prepareThreeObjectForCollisionShape(t),n=this.createCollisionShape(e.shape,e.params,e.object);n._childOffset={pos:t.position.clone(),quat:t.quaternion.clone(),scale:t.scale.clone(),margin:v},_.push(n)}})),0===_.length){const n=this.prepareThreeObjectForCollisionShape(t,e),i=this.createCollisionShape(n.shape,n.params,n.object);_.push(i)}const b=1===_.length?_[0]:this.mergeCollisionShapesToCompoundShape(_),M=this.applyPosQuatScaleMargin(b,i,r,s,v),w=this.collisionShapeToRigidBody(b,M,h,o);this.addRigidBodyToWorld(t,w,u,d,p,m),t.body.breakable=f,t.body.fractureImpulse=x,t.body.ignoreScale=y}addRigidBodyToWorld(t,e,n,i,r,s){this.rigidBodies.push(t),this.physicsWorld.addRigidBody(e,i,r);const a=Object.values(e)[0];t.name||(t.name=`object-${t.id}`),e.name=t.name,t.body=new $h(this,e),t.hasBody=!0,t.ptr=a,e.threeObject=t,s&&(t.body.offset={x:0,y:0,z:0,...s}),t.body.setCollisionFlags(n)}applyPosQuatScaleMargin(t,e=new Me,n=new be,i=new Me,r=.01){t.setMargin(r);const s=new Ammo.btQuaternion(0,0,0,1);s.setValue(n.x,n.y,n.z,n.w);const a=new Ammo.btTransform;a.setIdentity(),a.getOrigin().setValue(e.x,e.y,e.z),a.setRotation(s),Ammo.destroy(s);const o=new Ammo.btVector3(i.x,i.y,i.z);return t.setLocalScaling(o),Ammo.destroy(o),a}collisionShapeToRigidBody(t,e,n,i){const r=new Ammo.btDefaultMotionState(e),s=new Ammo.btVector3(0,0,0);n>0&&t.calculateLocalInertia(n,s);const a=new Ammo.btRigidBodyConstructionInfo(n,r,t,s),o=new Ammo.btRigidBody(a);return(n>0||i)&&o.setActivationState(4),o}}class ku{constructor(t={}){this.threeGraphicsConfig=t;const{alpha:e=!1,anisotropy:n=1,camera:i=zh.Perspective({z:25,y:5}),antialias:s=!1,usePhysics:a=!0,renderer:o}=t;this.textureAnisotropy=n,this.camera=i,this.scene=new Sa,this.renderer=o||new ba({antialias:s,alpha:e}),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=r,this.cache=Rc,this.cache.enabled=!0,a&&("undefined"!=typeof Ammo?this.physics=new Fu(this.scene,t):Hh("Are you sure you included ammo.js?"))}}console.log("%c %c %c %c %c Powered by enable3d v0.25.4 %c https://enable3d.io/","background: #ff0000","background: #ffff00","background: #00ff00","background: #00ffff","color: #fff; background: #000000;","background: none");var zu=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};try{URL.revokeObjectURL(zu(""))}catch(Sm){zu=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)}}var Vu=Uint8Array,Hu=Uint16Array,Gu=Uint32Array,Wu=new Vu([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ju=new Vu([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Xu=new Vu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qu=function(t,e){for(var n=new Hu(31),i=0;i<31;++i)n[i]=e+=1<>>1|(21845&Qu)<<1;td=(61680&(td=(52428&td)>>>2|(13107&td)<<2))>>>4|(3855&td)<<4,$u[Qu]=((65280&td)>>>8|(255&td)<<8)>>>1}var ed=function(t,e,n){for(var i=t.length,r=0,s=new Hu(e);r>>l]=c}else for(a=new Hu(i),r=0;r>>15-t[r]);return a},nd=new Vu(288);for(Qu=0;Qu<144;++Qu)nd[Qu]=8;for(Qu=144;Qu<256;++Qu)nd[Qu]=9;for(Qu=256;Qu<280;++Qu)nd[Qu]=7;for(Qu=280;Qu<288;++Qu)nd[Qu]=8;var id=new Vu(32);for(Qu=0;Qu<32;++Qu)id[Qu]=5;var rd=ed(nd,9,1),sd=ed(id,5,1),ad=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},od=function(t,e,n){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(7&e)&n},ld=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},cd=new Vu(0),hd="undefined"!=typeof TextDecoder&&new TextDecoder;try{hd.decode(cd,{stream:!0})}catch(Sm){}function ud(t,e,n){const i=n.length-t-1;if(e>=n[i])return i-1;if(e<=n[t])return t;let r=t,s=i,a=Math.floor((r+s)/2);for(;e=n[a+1];)e=s&&(r[e][0]=r[t][0]/o[c+1][l],i=r[e][0]*o[l][c]);const h=u-1<=c?s-1:n-u;for(let n=l>=-1?1:-l;n<=h;++n)r[e][n]=(r[t][n]-r[t][n-1])/o[c+1][l+n],i+=r[e][n]*o[l+n][c];u<=c&&(r[e][s]=-r[t][s-1]/o[c+1][u],i+=r[e][s]*o[u][c]),a[s][u]=i;const d=t;t=e,e=d}}let h=n;for(let u=1;u<=i;++u){for(let t=0;t<=n;++t)a[u][t]*=h;h*=n-u}return a}(o,i,t,s,e),c=[];for(let h=0;h=21&&e===Od(t,0,21)}(t))md=(new Md).parse(t);else{const e=Od(t);if(!function(t){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function i(e){const i=t[e-1];return t=t.slice(n+e),n++,i}for(let r=0;r0,s="string"==typeof r.Content&&""!==r.Content;if(t||s){const t=this.parseImage(n[i]);e[r.RelativeFilename||r.Filename]=t}}}}for(const n in t){const i=t[n];void 0!==e[i]?t[n]=e[i]:t[n]=t[n].split("\\").pop()}return t}parseImage(t){const e=t.Content,n=t.RelativeFilename||t.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let r;switch(i){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof e)return"data:"+r+";base64,"+e;{const t=new Uint8Array(e);return window.URL.createObjectURL(new Blob([t],{type:r}))}}parseTextures(t){const e=new Map;if("Texture"in md.Objects){const n=md.Objects.Texture;for(const i in n){const r=this.parseTexture(n[i],t);e.set(parseInt(i),r)}}return e}parseTexture(t,e){const n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;const i=t.WrapModeU,r=t.WrapModeV,s=void 0!==i?i.value:0,a=void 0!==r?r.value:0;if(n.wrapS=0===s?B:F,n.wrapT=0===a?B:F,"Scaling"in t){const e=t.Scaling.value;n.repeat.x=e[0],n.repeat.y=e[1]}if("Translation"in t){const e=t.Translation.value;n.offset.x=e[0],n.offset.y=e[1]}return n}loadTexture(t,e){let n;const i=this.textureLoader.path,r=fd.get(t.id).children;let s;void 0!==r&&r.length>0&&void 0!==e[r[0].ID]&&(n=e[r[0].ID],0!==n.indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));const a=t.FileName.slice(-3).toLowerCase();if("tga"===a){const e=this.manager.getHandler(".tga");null===e?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),s=new fe):(e.setPath(this.textureLoader.path),s=e.load(n))}else"psd"===a?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),s=new fe):s=this.textureLoader.load(n);return this.textureLoader.setPath(i),s}parseMaterials(t){const e=new Map;if("Material"in md.Objects){const n=md.Objects.Material;for(const i in n){const r=this.parseMaterial(n[i],t);null!==r&&e.set(parseInt(i),r)}}return e}parseMaterial(t,e){const n=t.id,i=t.attrName;let r=t.ShadingModel;if("object"==typeof r&&(r=r.value),!fd.has(n))return null;const s=this.parseParameters(t,e,n);let a;switch(r.toLowerCase()){case"phong":a=new nc;break;case"lambert":a=new sc;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),a=new nc}return a.setValues(s),a.name=i,a}parseParameters(t,e,n){const i={};t.BumpFactor&&(i.bumpScale=t.BumpFactor.value),t.Diffuse?i.color=(new Gn).fromArray(t.Diffuse.value).convertSRGBToLinear():!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(i.color=(new Gn).fromArray(t.DiffuseColor.value).convertSRGBToLinear()),t.DisplacementFactor&&(i.displacementScale=t.DisplacementFactor.value),t.Emissive?i.emissive=(new Gn).fromArray(t.Emissive.value).convertSRGBToLinear():!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(i.emissive=(new Gn).fromArray(t.EmissiveColor.value).convertSRGBToLinear()),t.EmissiveFactor&&(i.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(i.opacity=parseFloat(t.Opacity.value)),i.opacity<1&&(i.transparent=!0),t.ReflectionFactor&&(i.reflectivity=t.ReflectionFactor.value),t.Shininess&&(i.shininess=t.Shininess.value),t.Specular?i.specular=(new Gn).fromArray(t.Specular.value).convertSRGBToLinear():t.SpecularColor&&"Color"===t.SpecularColor.type&&(i.specular=(new Gn).fromArray(t.SpecularColor.value).convertSRGBToLinear());const r=this;return fd.get(n).children.forEach((function(t){const n=t.relationship;switch(n){case"Bump":i.bumpMap=r.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":i.aoMap=r.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=r.getTexture(e,t.ID),void 0!==i.map&&(i.map.colorSpace=pt);break;case"DisplacementColor":i.displacementMap=r.getTexture(e,t.ID);break;case"EmissiveColor":i.emissiveMap=r.getTexture(e,t.ID),void 0!==i.emissiveMap&&(i.emissiveMap.colorSpace=pt);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=r.getTexture(e,t.ID);break;case"ReflectionColor":i.envMap=r.getTexture(e,t.ID),void 0!==i.envMap&&(i.envMap.mapping=O,i.envMap.colorSpace=pt);break;case"SpecularColor":i.specularMap=r.getTexture(e,t.ID),void 0!==i.specularMap&&(i.specularMap.colorSpace=pt);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=r.getTexture(e,t.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),i}getTexture(t,e){return"LayeredTexture"in md.Objects&&e in md.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=fd.get(e).children[0].ID),t.get(e)}parseDeformers(){const t={},e={};if("Deformer"in md.Objects){const n=md.Objects.Deformer;for(const i in n){const r=n[i],s=fd.get(parseInt(i));if("Skin"===r.attrType){const e=this.parseSkeleton(s,n);e.ID=i,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),e.geometryID=s.parents[0].ID,t[i]=e}else if("BlendShape"===r.attrType){const t={id:i};t.rawTargets=this.parseMorphTargets(s,n),t.id=i,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[i]=t}}}return{skeletons:t,morphTargets:e}}parseSkeleton(t,e){const n=[];return t.children.forEach((function(t){const i=e[t.ID];if("Cluster"!==i.attrType)return;const r={ID:t.ID,indices:[],weights:[],transformLink:(new $e).fromArray(i.TransformLink.a)};"Indexes"in i&&(r.indices=i.Indexes.a,r.weights=i.Weights.a),n.push(r)})),{rawBones:n,bones:[]}}parseMorphTargets(t,e){const n=[];for(let i=0;i1?s=a:a.length>0?s=a[0]:(s=new nc({name:Lc.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(s)),"color"in r.attributes&&a.forEach((function(t){t.vertexColors=!0})),r.FBX_Deformer?(i=new no(r,s),i.normalizeSkinWeights()):i=new wi(r,s),i}createCurve(t,e){const n=t.children.reduce((function(t,n){return e.has(n.ID)&&(t=e.get(n.ID)),t}),null),i=new yo({name:Lc.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new So(n,i)}getTransformData(t,e){const n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),n.eulerOrder="RotationOrder"in e?Id(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}setLookAtProperties(t,e){"LookAtProperty"in e&&fd.get(t.ID).children.forEach((function(e){if("LookAtProperty"===e.relationship){const n=md.Objects.Model[e.ID];if("Lcl_Translation"in n){const e=n.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(e),gd.add(t.target)):t.lookAt((new Me).fromArray(e))}}}))}bindSkeleton(t,e,n){const i=this.parsePoseNodes();for(const r in t){const s=t[r];fd.get(parseInt(s.ID)).parents.forEach((function(t){if(e.has(t.ID)){const e=t.ID;fd.get(e).parents.forEach((function(t){n.has(t.ID)&&n.get(t.ID).bind(new oo(s.bones),i[t.ID])}))}}))}}parsePoseNodes(){const t={};if("Pose"in md.Objects){const e=md.Objects.Pose;for(const n in e)if("BindPose"===e[n].attrType&&e[n].NbPoseNodes>0){const i=e[n].PoseNode;Array.isArray(i)?i.forEach((function(e){t[e.Node]=(new $e).fromArray(e.Matrix.a)})):t[i.Node]=(new $e).fromArray(i.Matrix.a)}}return t}createAmbientLight(){if("GlobalSettings"in md&&"AmbientColor"in md.GlobalSettings){const t=md.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],i=t[2];if(0!==e||0!==n||0!==i){const t=new Gn(e,n,i).convertSRGBToLinear();gd.add(new $c(t,1))}}}}class xd{constructor(){this.negativeMaterialIndices=!1}parse(t){const e=new Map;if("Geometry"in md.Objects){const n=md.Objects.Geometry;for(const i in n){const r=fd.get(parseInt(i)),s=this.parseGeometry(r,n[i],t);e.set(parseInt(i),s)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),e}parseGeometry(t,e,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}parseMeshGeometry(t,e,n){const i=n.skeletons,r=[],s=t.parents.map((function(t){return md.Objects.Model[t.ID]}));if(0===s.length)return;const a=t.children.reduce((function(t,e){return void 0!==i[e.ID]&&(t=i[e.ID]),t}),null);t.children.forEach((function(t){void 0!==n.morphTargets[t.ID]&&r.push(n.morphTargets[t.ID])}));const o=s[0],l={};"RotationOrder"in o&&(l.eulerOrder=Id(o.RotationOrder.value)),"InheritType"in o&&(l.inheritType=parseInt(o.InheritType.value)),"GeometricTranslation"in o&&(l.translation=o.GeometricTranslation.value),"GeometricRotation"in o&&(l.rotation=o.GeometricRotation.value),"GeometricScaling"in o&&(l.scale=o.GeometricScaling.value);const c=Ld(l);return this.genGeometry(e,a,r,c)}genGeometry(t,e,n,i){const r=new si;t.attrName&&(r.name=t.attrName);const s=this.parseGeoNode(t,e),a=this.genBuffers(s),o=new Zn(a.vertex,3);if(o.applyMatrix4(i),r.setAttribute("position",o),a.colors.length>0&&r.setAttribute("color",new Zn(a.colors,3)),e&&(r.setAttribute("skinIndex",new Kn(a.weightsIndices,4)),r.setAttribute("skinWeight",new Zn(a.vertexWeights,4)),r.FBX_Deformer=e),a.normal.length>0){const t=(new qt).getNormalMatrix(i),e=new Zn(a.normal,3);e.applyNormalMatrix(t),r.setAttribute("normal",e)}if(a.uvs.forEach((function(t,e){const n=0===e?"uv":`uv${e}`;r.setAttribute(n,new Zn(a.uvs[e],2))})),s.material&&"AllSame"!==s.material.mappingType){let t=a.materialIndex[0],e=0;if(a.materialIndex.forEach((function(n,i){n!==t&&(r.addGroup(e,i-e,t),t=n,e=i)})),r.groups.length>0){const e=r.groups[r.groups.length-1],n=e.start+e.count;n!==a.materialIndex.length&&r.addGroup(n,a.materialIndex.length-n,t)}0===r.groups.length&&r.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(r,t,n,i),r}parseGeoNode(t,e){const n={};if(n.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],n.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];let e=0;for(;t.LayerElementUV[e];)t.LayerElementUV[e].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[e])),e++}return n.weightTable={},null!==e&&(n.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(i,r){void 0===n.weightTable[i]&&(n.weightTable[i]=[]),n.weightTable[i].push({id:e,weight:t.weights[r]})}))}))),n}genBuffers(t){const e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,r=!1,s=[],a=[],o=[],l=[],c=[],h=[];const u=this;return t.vertexIndices.forEach((function(d,p){let m,f=!1;d<0&&(d=~d,f=!0);let g=[],v=[];if(s.push(3*d,3*d+1,3*d+2),t.color){const e=Rd(p,n,d,t.color);o.push(e[0],e[1],e[2])}if(t.skeleton){if(void 0!==t.weightTable[d]&&t.weightTable[d].forEach((function(t){v.push(t.weight),g.push(t.id)})),v.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const t=[0,0,0,0],e=[0,0,0,0];v.forEach((function(n,i){let r=n,s=g[i];e.forEach((function(e,n,i){if(r>e){i[n]=r,r=e;const a=t[n];t[n]=s,s=a}}))})),g=t,v=e}for(;v.length<4;)v.push(0),g.push(0);for(let t=0;t<4;++t)c.push(v[t]),h.push(g[t])}if(t.normal){const e=Rd(p,n,d,t.normal);a.push(e[0],e[1],e[2])}t.material&&"AllSame"!==t.material.mappingType&&(m=Rd(p,n,d,t.material)[0],m<0&&(u.negativeMaterialIndices=!0,m=0)),t.uv&&t.uv.forEach((function(t,e){const i=Rd(p,n,d,t);void 0===l[e]&&(l[e]=[]),l[e].push(i[0]),l[e].push(i[1])})),i++,f&&(i>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),u.genFace(e,t,s,m,a,o,l,c,h,i),n++,i=0,s=[],a=[],o=[],l=[],c=[],h=[])})),e}genFace(t,e,n,i,r,s,a,o,l,c){for(let h=2;h1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const s=t.get(r[0].ID);n[i]={name:e[i].attrName,layer:s}}return n}addClip(t){let e=[];const n=this;return t.layer.forEach((function(t){e=e.concat(n.generateTracks(t))})),new Ac(t.name,-1,e)}generateTracks(t){const e=[];let n=new Me,i=new be,r=new Me;if(t.transform&&t.transform.decompose(n,i,r),n=n.toArray(),i=(new cn).setFromQuaternion(i,t.eulerOrder).toArray(),r=r.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){const i=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");void 0!==i&&e.push(i)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){const n=this.generateRotationTrack(t.modelName,t.R.curves,i,t.preRotation,t.postRotation,t.eulerOrder);void 0!==n&&e.push(n)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){const n=this.generateVectorTrack(t.modelName,t.S.curves,r,"scale");void 0!==n&&e.push(n)}if(void 0!==t.DeformPercent){const n=this.generateMorphTrack(t);void 0!==n&&e.push(n)}return e}generateVectorTrack(t,e,n,i){const r=this.getTimesForAllAxes(e),s=this.getKeyframeTrackValues(r,e,n);return new Tc(t+"."+i,r,s)}generateRotationTrack(t,e,n,i,r,s){void 0!==e.x&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(Wt)),void 0!==e.y&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(Wt)),void 0!==e.z&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(Wt));const a=this.getTimesForAllAxes(e),o=this.getKeyframeTrackValues(a,e,n);void 0!==i&&((i=i.map(Wt)).push(s),i=(new cn).fromArray(i),i=(new be).setFromEuler(i)),void 0!==r&&((r=r.map(Wt)).push(s),r=(new cn).fromArray(r),r=(new be).setFromEuler(r).invert());const l=new be,c=new cn,h=[];for(let u=0;u1){let t=1,n=e[0];for(let i=1;i=180){const s=r/180,a=i/s;let o=n+a;const l=t.times[e-1],c=(t.times[e]-l)/s;let h=l+c;const u=[],d=[];for(;h1&&(n=t[1].replace(/^(\w+)::/,""),i=t[2]),{id:e,name:n,type:i}}parseNodeProperty(t,e,n){let i=e[1].replace(/^"/,"").replace(/"$/,"").trim(),r=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===r&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const s=this.getCurrentNode();if("Properties70"!==s.name){if("C"===i){const t=r.split(",").slice(1),e=parseInt(t[0]),n=parseInt(t[1]);let a=r.split(",").slice(3);a=a.map((function(t){return t.trim().replace(/^"/,"")})),i="connections",r=[e,n],function(t,e){for(let n=0,i=t.length,r=e.length;n=t.size():t.getOffset()+160+16>=t.size()}parseNode(t,e){const n={},i=e>=7500?t.getUint64():t.getUint32(),r=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();const s=t.getUint8(),a=t.getString(s);if(0===i)return null;const o=[];for(let u=0;u0?o[0]:"",c=o.length>1?o[1]:"",h=o.length>2?o[2]:"";for(n.singleProperty=1===r&&t.getOffset()===i;i>t.getOffset();){const i=this.parseNode(t,e);null!==i&&this.parseSubNode(a,n,i)}return n.propertyList=o,"number"==typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==h&&(n.attrType=h),""!==a&&(n.name=a),n}parseSubNode(t,e,n){if(!0===n.singleProperty){const t=n.propertyList[0];Array.isArray(t)?(e[n.name]=n,n.a=t):e[n.name]=t}else if("Connections"===t&&"C"===n.name){const t=[];n.propertyList.forEach((function(e,n){0!==n&&t.push(e)})),void 0===e.connections&&(e.connections=[]),e.connections.push(t)}else if("Properties70"===n.name)Object.keys(n).forEach((function(t){e[t]=n[t]}));else if("Properties70"===t&&"P"===n.name){let t=n.propertyList[0],i=n.propertyList[1];const r=n.propertyList[2],s=n.propertyList[3];let a;0===t.indexOf("Lcl ")&&(t=t.replace("Lcl ","Lcl_")),0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),a="Color"===i||"ColorRGB"===i||"Vector"===i||"Vector3D"===i||0===i.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],e[t]={type:i,type2:r,flag:s,value:a}}else void 0===e[n.name]?"number"==typeof n.id?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:"PoseNode"===n.name?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):void 0===e[n.name][n.id]&&(e[n.name][n.id]=n)}parseProperty(t){const e=t.getString(1);let n;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return n=t.getUint32(),t.getArrayBuffer(n);case"S":return n=t.getUint32(),t.getString(n);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=t.getUint32(),r=t.getUint32(),s=t.getUint32();if(0===r)switch(e){case"b":case"c":return t.getBooleanArray(i);case"d":return t.getFloat64Array(i);case"f":return t.getFloat32Array(i);case"i":return t.getInt32Array(i);case"l":return t.getInt64Array(i)}const a=function(t,e){return function(t,e,n){var i=t.length;if(!i||n&&!n.l&&i<5)return e||new Vu(0);var r=!e||n,s=!n||n.i;n||(n={}),e||(e=new Vu(3*i));var a,o=function(t){var n=e.length;if(t>n){var i=new Vu(Math.max(2*n,t));i.set(e),e=i}},l=n.f||0,c=n.p||0,h=n.b||0,u=n.l,d=n.d,p=n.m,m=n.n,f=8*i;do{if(!u){n.f=l=od(t,c,1);var g=od(t,c+1,3);if(c+=3,!g){var v=t[(R=((a=c)/8|0)+(7&a&&1)+4)-4]|t[R-3]<<8,y=R+v;if(y>i){if(s)throw"unexpected EOF";break}r&&o(h+v),e.set(t.subarray(R,y),h),n.b=h+=v,n.p=c=8*y;continue}if(1==g)u=rd,d=sd,p=9,m=5;else{if(2!=g)throw"invalid block type";var x=od(t,c,31)+257,_=od(t,c+10,15)+4,b=x+od(t,c+5,31)+1;c+=14;for(var M=new Vu(b),w=new Vu(19),S=0;S<_;++S)w[Xu[S]]=od(t,c+3*S,7);c+=3*_;var T=ad(w),A=(1<>>4)<16)M[S++]=R;else{var P=0,L=0;for(16==R?(L=3+od(t,c,3),c+=2,P=M[S-1]):17==R?(L=3+od(t,c,7),c+=3):18==R&&(L=11+od(t,c,127),c+=7);L--;)M[S++]=P}}var I=M.subarray(0,x),N=M.subarray(x);p=ad(I),m=ad(N),u=ed(I,p,1),d=ed(N,m,1)}if(c>f){if(s)throw"unexpected EOF";break}}r&&o(h+131072);for(var O=(1<>>4;if((c+=15&P)>f){if(s)throw"unexpected EOF";break}if(!P)throw"invalid length/literal";if(B<256)e[h++]=B;else{if(256==B){U=c,u=null;break}var F=B-254;if(B>264){var k=Wu[S=B-257];F=od(t,c,(1<>>4;if(!z)throw"invalid distance";if(c+=15&z,N=Zu[V],V>3&&(k=ju[V],N+=ld(t,c)&(1<f){if(s)throw"unexpected EOF";break}r&&o(h+131072);for(var H=h+F;ht.length)&&(n=t.length);var i=new(t instanceof Hu?Hu:t instanceof Gu?Gu:Vu)(n-e);return i.set(t.subarray(e,n)),i}(e,0,h)}((function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"}(t),t.subarray(2,-4)),void 0)}(new Uint8Array(t.getArrayBuffer(s))),o=new wd(a.buffer);switch(e){case"b":case"c":return o.getBooleanArray(i);case"d":return o.getFloat64Array(i);case"f":return o.getFloat32Array(i);case"i":return o.getInt32Array(i);case"l":return o.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}}}class wd{constructor(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===e||e,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(t){this.offset+=t}getBoolean(){return!(1&~this.getUint8())}getBooleanArray(t){const e=[];for(let n=0;n=0&&(n=new Uint8Array(this.dv.buffer,e,i)),this._textDecoder.decode(n)}}class Sd{add(t,e){this[t]=e}}function Td(t){const e=t.match(/FBXVersion: (\d+)/);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Ad(t){return t/46186158e3}const Ed=[];function Rd(t,e,n,i){let r;switch(i.mappingType){case"ByPolygonVertex":r=t;break;case"ByPolygon":r=e;break;case"ByVertice":r=n;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(r=i.indices[r]);const s=r*i.dataSize,a=s+i.dataSize;return function(t,e,n,i){for(let r=n,s=0;r=2.0 are supported.")));const l=new Tp(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h=0&&void 0===a[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(s),l.setPlugins(a),l.parse(n,i)}parseAsync(t,e){const n=this;return new Promise((function(i,r){n.parse(t,e,i,r)}))}}function Fd(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const kd={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class zd{constructor(t){this.parser=t,this.name=kd.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,i=e.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class $d{constructor(t){this.parser=t,this.name=kd.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=i.images[s.source];let o=n.textureLoader;if(a.uri){const t=n.options.manager.getHandler(a.uri);null!==t&&(o=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class Qd{constructor(t){this.parser=t,this.name=kd.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=i.images[s.source];let o=n.textureLoader;if(a.uri){const t=n.options.manager.getHandler(a.uri);null!==t&&(o=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class tp{constructor(t){this.name=kd.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const t=n.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(e){const n=t.byteOffset||0,i=t.byteLength||0,s=t.count,a=t.byteStride,o=new Uint8Array(e,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,a,o,t.mode,t.filter).then((function(t){return t.buffer})):r.ready.then((function(){const e=new ArrayBuffer(s*a);return r.decodeGltfBuffer(new Uint8Array(e),s,a,o,t.mode,t.filter),e}))}))}return null}}class ep{constructor(t){this.name=kd.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=e.meshes[n.mesh];for(const o of i.primitives)if(o.mode!==hp.TRIANGLES&&o.mode!==hp.TRIANGLE_STRIP&&o.mode!==hp.TRIANGLE_FAN&&void 0!==o.mode)return null;const r=n.extensions[this.name].attributes,s=[],a={};for(const o in r)s.push(this.parser.getDependency("accessor",r[o]).then((t=>(a[o]=t,a[o]))));return s.length<1?null:(s.push(this.parser.createNodeMesh(t)),Promise.all(s).then((t=>{const e=t.pop(),n=e.isGroup?e.children:[e],i=t[0].count,r=[];for(const s of n){const t=new $e,e=new Me,n=new be,o=new Me(1,1,1),l=new vo(s.geometry,s.material,i);for(let r=0;r-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||i&&r<98?this.textureLoader=new Uc(this.options.manager):this.textureLoader=new hh(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Oc(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){const s={scene:e[0][i.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:i.asset,parser:n,userData:{}};yp(r,s,i),xp(s,i),Promise.all(n._invokeAll((function(t){return t.afterRoot&&t.afterRoot(s)}))).then((function(){t(s)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=e.length;i{const n=this.associations.get(t);null!=n&&this.associations.set(e,n);for(const[i,s]of t.children.entries())r(s,e.children[i])};return r(n,i),i.name+="_instance_"+t.uses[e]++,i}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n=2&&p.setY(e,h[t*s+1]),s>=3&&p.setZ(e,h[t*s+2]),s>=4&&p.setW(e,h[t*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(t){const e=this.json,n=this.options,i=e.textures[t].source,r=e.images[i];let s=this.textureLoader;if(r.uri){const t=n.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,i,s)}loadTextureImage(t,e,n){const i=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(e,n).then((function(e){e.flipY=!1,e.name=s.name||a.name||"",""===e.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(e.name=a.uri);const n=(r.samplers||{})[s.sampler]||{};return e.magFilter=dp[n.magFilter]||G,e.minFilter=dp[n.minFilter]||j,e.wrapS=pp[n.wrapS]||B,e.wrapT=pp[n.wrapT]||B,i.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[o]=l,l}loadImageSource(t,e){const n=this.json,i=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((t=>t.clone()));const r=n.images[t],s=self.URL||self.webkitURL;let a=r.uri||"",o=!1;if(void 0!==r.bufferView)a=this.getDependency("bufferView",r.bufferView).then((function(t){o=!0;const e=new Blob([t],{type:r.mimeType});return a=s.createObjectURL(e),a}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const l=Promise.resolve(a).then((function(t){return new Promise((function(n,r){let s=n;!0===e.isImageBitmapLoader&&(s=function(t){const e=new fe(t);e.needsUpdate=!0,n(e)}),e.load(ih.resolveURL(t,i.path),s,void 0,r)}))})).then((function(t){var e;return!0===o&&s.revokeObjectURL(a),t.userData.mimeType=r.mimeType||((e=r.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),t}));return this.sourceCache[t]=l,l}assignTexture(t,e,n,i){const r=this;return this.getDependency("texture",n.index).then((function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[kd.KHR_TEXTURE_TRANSFORM]){const t=void 0!==n.extensions?n.extensions[kd.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(s);s=r.extensions[kd.KHR_TEXTURE_TRANSFORM].extendTexture(s,t),r.associations.set(s,e)}}return void 0!==i&&(s.colorSpace=i),t[e]=s,s}))}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const i=void 0===e.attributes.tangent,r=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new Co,Fn.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,e.sizeAttenuation=!1,this.cache.add(t,e)),n=e}else if(t.isLine){const t="LineBasicMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new yo,Fn.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,this.cache.add(t,e)),n=e}if(i||r||s){let t="ClonedMaterial:"+n.uuid+":";i&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),s&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=n.clone(),r&&(e.vertexColors=!0),s&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}t.material=n}getMaterialType(){return tc}loadMaterial(t){const e=this,n=this.json,i=this.extensions,r=n.materials[t];let s;const a={},o=[];if((r.extensions||{})[kd.KHR_MATERIALS_UNLIT]){const t=i[kd.KHR_MATERIALS_UNLIT];s=t.getMaterialType(),o.push(t.extendParams(a,r,e))}else{const n=r.pbrMetallicRoughness||{};if(a.color=new Gn(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)){const t=n.baseColorFactor;a.color.setRGB(t[0],t[1],t[2],mt),a.opacity=t[3]}void 0!==n.baseColorTexture&&o.push(e.assignTexture(a,"map",n.baseColorTexture,pt)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(o.push(e.assignTexture(a,"metalnessMap",n.metallicRoughnessTexture)),o.push(e.assignTexture(a,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),o.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,a)}))))}!0===r.doubleSided&&(a.side=2);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,"MASK"===l&&(a.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==jn&&(o.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new Xt(1,1),void 0!==r.normalTexture.scale)){const t=r.normalTexture.scale;a.normalScale.set(t,t)}if(void 0!==r.occlusionTexture&&s!==jn&&(o.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(a.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==jn){const t=r.emissiveFactor;a.emissive=(new Gn).setRGB(t[0],t[1],t[2],mt)}return void 0!==r.emissiveTexture&&s!==jn&&o.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,pt)),Promise.all(o).then((function(){const n=new s(a);return r.name&&(n.name=r.name),xp(n,r),e.associations.set(n,{materials:t}),r.extensions&&yp(i,n,r),n}))}createUniqueName(t){const e=_h.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,i=this.primitiveCache;function r(t){return n[kd.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(n){return Ap(n,t,e)}))}const s=[];for(let a=0,o=t.length;a0&&_p(u,r),u.name=e.createUniqueName(r.name||"mesh_"+t),xp(u,r),c.extensions&&yp(i,u,c),e.assignFinalMaterial(u),l.push(u)}for(let i=0,r=l.length;i1?new ma:1===e.length?e[0]:new Sn,a!==e[0])for(let t=0,n=e.length;t{const e=new Map;for(const[n,r]of i.associations)(n instanceof Fn||n instanceof fe)&&e.set(n,r);return t.traverse((t=>{const n=i.associations.get(t);null!=n&&e.set(t,n)})),e})(r),r}))}_createAnimationTracks(t,e,n,i,r){const s=[],a=t.name?t.name:t.uuid,o=[];let l;switch(gp[r.path]===gp.weights?t.traverse((function(t){t.morphTargetInfluences&&o.push(t.name?t.name:t.uuid)})):o.push(a),gp[r.path]){case gp.weights:l=bc;break;case gp.rotation:l=wc;break;case gp.position:case gp.scale:l=Tc;break;default:l=1===n.itemSize?bc:Tc}const c=void 0!==i.interpolation?vp[i.interpolation]:ot,h=this._getArrayFromAccessor(n);for(let u=0,d=o.length;u1){const t=Math.sqrt(v);p=(e*=t)*e,m=(n*=t)*n}const y=p*g+m*f,x=(p*m-y)/y;let _=Math.sqrt(Math.max(0,x));s===a&&(_=-_);const b=_*e*d/n,M=-_*n*u/e,w=Math.cos(r)*b-Math.sin(r)*M+(o.x+l.x)/2,S=Math.sin(r)*b+Math.cos(r)*M+(o.y+l.y)/2,T=i(1,0,(u-b)/e,(d-M)/n),A=i((u-b)/e,(d-M)/n,(-u-b)/e,(-d-M)/n)%(2*Math.PI);t.currentPath.absellipse(w,S,e,n,T,T+A,0===a,r)}function i(t,e,n,i){const r=t*n+e*i,s=Math.sqrt(t*t+e*e)*Math.sqrt(n*n+i*i);let a=Math.acos(Math.max(-1,Math.min(1,r/s)));return t*i-e*n<0&&(a=-a),a}function r(t,e){e=Object.assign({},e);let n={};if(t.hasAttribute("class")){const e=t.getAttribute("class").split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0;tNumber.EPSILON}function d(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function p(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}const m=[],f={},g=[],v=new qt,y=new qt,x=new qt,_=new qt,b=new Xt,M=new Me,w=new qt,S=(new DOMParser).parseFromString(t,"image/svg+xml");return function t(e,i){if(1!==e.nodeType)return;const o=function(t){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))))return null;const e=function(t){const e=new qt,n=v;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const n=c(t.getAttribute("x")),i=c(t.getAttribute("y"));e.translate(n,i)}if(t.hasAttribute("transform")){const i=t.getAttribute("transform").split(")");for(let t=i.length-1;t>=0;t--){const r=i[t].trim();if(""===r)continue;const s=r.indexOf("("),o=r.length;if(s>0&&s=1){const t=e[0];let i=0;e.length>=2&&(i=e[1]),n.translate(t,i)}break;case"rotate":if(e.length>=1){let t=0,i=0,r=0;t=e[0]*Math.PI/180,e.length>=3&&(i=e[1],r=e[2]),y.makeTranslation(-i,-r),x.makeRotation(t),_.multiplyMatrices(x,y),y.makeTranslation(i,r),n.multiplyMatrices(y,_)}break;case"scale":if(e.length>=1){const t=e[0];let i=t;e.length>=2&&(i=e[1]),n.scale(t,i)}break;case"skewX":1===e.length&&n.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&n.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&n.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}e.premultiply(n)}}return e}(t);return g.length>0&&e.premultiply(g[g.length-1]),w.copy(e),g.push(e),e}(e);let l=!1,S=null;switch(e.nodeName){case"svg":case"g":i=r(e,i);break;case"style":!function(t){if(t.sheet&&t.sheet.cssRules&&t.sheet.cssRules.length)for(let e=0;et.trim()));for(let t=0;t""!==t)));f[i[t]]=Object.assign(f[i[t]]||{},e)}}}(e);break;case"path":i=r(e,i),e.hasAttribute("d")&&(S=function(t){const e=new kh,i=new Xt,r=new Xt,o=new Xt;let l=!0,c=!1;const h=t.getAttribute("d");if(""===h||"none"===h)return null;const u=h.match(/[a-df-z][^a-df-z]*/gi);for(let d=0,p=u.length;d0&&(i.copy(o),e.currentPath.currentPoint.copy(i),l=!0);break;default:console.warn(t)}c=!1}return e}(e));break;case"rect":i=r(e,i),S=function(t){const e=c(t.getAttribute("x")||0),n=c(t.getAttribute("y")||0),i=c(t.getAttribute("rx")||t.getAttribute("ry")||0),r=c(t.getAttribute("ry")||t.getAttribute("rx")||0),s=c(t.getAttribute("width")),a=c(t.getAttribute("height")),o=.448084975506,l=new kh;return l.moveTo(e+i,n),l.lineTo(e+s-i,n),(0!==i||0!==r)&&l.bezierCurveTo(e+s-i*o,n,e+s,n+r*o,e+s,n+r),l.lineTo(e+s,n+a-r),(0!==i||0!==r)&&l.bezierCurveTo(e+s,n+a-r*o,e+s-i*o,n+a,e+s-i,n+a),l.lineTo(e+i,n+a),(0!==i||0!==r)&&l.bezierCurveTo(e+i*o,n+a,e,n+a-r*o,e,n+a-r),l.lineTo(e,n+r),(0!==i||0!==r)&&l.bezierCurveTo(e,n+r*o,e+i*o,n,e+i,n),l}(e);break;case"polygon":i=r(e,i),S=function(t){const e=new kh;let n=0;return t.getAttribute("points").replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,(function(t,i,r){const s=c(i),a=c(r);0===n?e.moveTo(s,a):e.lineTo(s,a),n++})),e.currentPath.autoClose=!0,e}(e);break;case"polyline":i=r(e,i),S=function(t){const e=new kh;let n=0;return t.getAttribute("points").replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,(function(t,i,r){const s=c(i),a=c(r);0===n?e.moveTo(s,a):e.lineTo(s,a),n++})),e.currentPath.autoClose=!1,e}(e);break;case"circle":i=r(e,i),S=function(t){const e=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),i=c(t.getAttribute("r")||0),r=new Qo;r.absarc(e,n,i,0,2*Math.PI);const s=new kh;return s.subPaths.push(r),s}(e);break;case"ellipse":i=r(e,i),S=function(t){const e=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),i=c(t.getAttribute("rx")||0),r=c(t.getAttribute("ry")||0),s=new Qo;s.absellipse(e,n,i,r,0,2*Math.PI);const a=new kh;return a.subPaths.push(s),a}(e);break;case"line":i=r(e,i),S=function(t){const e=c(t.getAttribute("x1")||0),n=c(t.getAttribute("y1")||0),i=c(t.getAttribute("x2")||0),r=c(t.getAttribute("y2")||0),s=new kh;return s.moveTo(e,n),s.lineTo(i,r),s.currentPath.autoClose=!1,s}(e);break;case"defs":l=!0;break;case"use":i=r(e,i);const o=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),h=e.viewportElement.getElementById(o);h?t(h,i):console.warn("SVGLoader: 'use node' references non-existent node id: "+o)}S&&(void 0!==i.fill&&"none"!==i.fill&&S.color.setStyle(i.fill,Ep),function(t,e){function n(t){M.set(t.x,t.y,1).applyMatrix3(e),t.set(M.x,M.y)}function i(t){const n=t.xRadius,i=t.yRadius,r=Math.cos(t.aRotation),s=Math.sin(t.aRotation),a=new Me(n*r,n*s,0),o=new Me(-i*s,i*r,0),l=a.applyMatrix3(e),c=o.applyMatrix3(e),u=v.set(l.x,c.x,0,l.y,c.y,0,0,0,1),d=y.copy(u).invert(),p=x.copy(d).transpose().multiply(d).elements,m=function(t,e,n){let i,r,s,a,o;const l=t+n,c=t-n,h=Math.sqrt(c*c+4*e*e);return l>0?(i=.5*(l+h),o=1/i,r=t*o*n-e*o*e):l<0?r=.5*(l-h):(i=.5*h,r=-.5*h),s=c>0?c+h:c-h,Math.abs(s)>2*Math.abs(e)?(o=-2*e/s,a=1/Math.sqrt(1+o*o),s=o*a):0===Math.abs(e)?(s=1,a=0):(o=-.5*s/e,s=1/Math.sqrt(1+o*o),a=o*s),c>0&&(o=s,s=-a,a=o),{rt1:i,rt2:r,cs:s,sn:a}}(p[0],p[1],p[4]),f=Math.sqrt(m.rt1),g=Math.sqrt(m.rt2);if(t.xRadius=1/f,t.yRadius=1/g,t.aRotation=Math.atan2(m.sn,m.cs),!((t.aEndAngle-t.aStartAngle)%(2*Math.PI){const{x:e,y:n}=new Me(Math.cos(t),Math.sin(t),0).applyMatrix3(r);return Math.atan2(n,e)};t.aStartAngle=s(t.aStartAngle),t.aEndAngle=s(t.aEndAngle),h(e)&&(t.aClockwise=!t.aClockwise)}}function r(t){const n=d(e),i=p(e);t.xRadius*=n,t.yRadius*=i;const r=n>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=r,h(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const s=t.subPaths;for(let a=0,o=s.length;a0?w.copy(g[g.length-1]):w.identity())}(S.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:m,xml:S.documentElement}}static createShapes(t){const e=999999999,n={loc:0,t:0};function i(t,e,i,s){const a=t.x,o=e.x,l=i.x,c=s.x,h=t.y,u=e.y,d=i.y,p=s.y,m=(c-l)*(h-d)-(p-d)*(a-l),f=(p-d)*(o-a)-(c-l)*(u-h),g=m/f,v=((o-a)*(h-d)-(u-h)*(a-l))/f;if(0===f&&0!==m||g<=0||g>=1||v<0||v>1)return null;if(0===m&&0===f){for(let l=0;l<2;l++){if(r(0===l?i:s,t,e),0==n.loc){const t=0===l?i:s;return{x:t.x,y:t.y,t:n.t}}if(2==n.loc)return{x:+(a+n.t*(o-a)).toPrecision(10),y:+(h+n.t*(u-h)).toPrecision(10),t:n.t}}return null}for(let y=0;y<2;y++)if(r(0===y?i:s,t,e),0==n.loc){const t=0===y?i:s;return{x:t.x,y:t.y,t:n.t}}return{x:+(a+g*(o-a)).toPrecision(10),y:+(h+g*(u-h)).toPrecision(10),t:g}}function r(t,e,i){const r=i.x-e.x,s=i.y-e.y,a=t.x-e.x,o=t.y-e.y,l=r*o-a*s;if(t.x===e.x&&t.y===e.y)return n.loc=0,void(n.t=0);if(t.x===i.x&&t.y===i.y)return n.loc=1,void(n.t=1);if(l<-Number.EPSILON)return void(n.loc=3);if(l>Number.EPSILON)return void(n.loc=4);if(r*a<0||s*o<0)return void(n.loc=5);if(Math.sqrt(r*r+s*s){const n=t.getPoints();let i=-999999999,r=e,o=-999999999,l=e;for(let e=0;ei&&(i=t.y),t.yo&&(o=t.x),t.x=l&&(s=l-1),{curves:t.curves,points:n,isCW:Ul.isClockWise(n),identifier:-1,boundingBox:new Ch(new Xt(l,r),new Xt(o,i))}}));o=o.filter((t=>t.points.length>1));for(let h=0;hfunction(t,e,n,r,s){null!=s&&""!==s||(s="nonzero");const a=new Xt;t.boundingBox.getCenter(a);const o=function(t,e,n){const r=new Xt;e.getCenter(r);const s=[];return n.forEach((e=>{if(e.boundingBox.containsPoint(r)){const n=function(t,e){const n=[],r=[];for(let s=1;st.t<=s.t+Number.EPSILON&&t.t>=s.t-Number.EPSILON))&&(n.push(s),r.push(new Xt(s.x,s.y)))}}return r}(t,e.points);n.forEach((t=>{s.push({identifier:e.identifier,isCW:e.isCW,point:t})}))}})),s.sort(((t,e)=>t.point.x-e.point.x)),s}([new Xt(n,a.y),new Xt(r,a.y)],t.boundingBox,e);o.sort(((t,e)=>t.point.x-e.point.x));const l=[],c=[];o.forEach((e=>{e.identifier===t.identifier?l.push(e):c.push(e)}));const h=l[0].point.x,u=[];let d=0;for(;d0&&u[u.length-1]===c[d].identifier?u.pop():u.push(c[d].identifier),d++;if(u.push(t.identifier),"evenodd"===s){const e=u.length%2==0,n=u[u.length-2];return{identifier:t.identifier,isHole:e,for:n}}if("nonzero"===s){let n=!0,i=null,r=null;for(let t=0;t{if(!l[t.identifier].isHole){const e=new ul;e.curves=t.curves,l.filter((e=>e.isHole&&e.for===t.identifier)).forEach((t=>{const n=o[t.identifier],i=new Qo;i.curves=n.curves,e.holes.push(i)})),c.push(e)}})),c}static getStrokeStyle(t,e,n,i,r){return{strokeColor:e=void 0!==e?e:"#000",strokeWidth:t=void 0!==t?t:1,strokeLineJoin:n=void 0!==n?n:"miter",strokeLineCap:i=void 0!==i?i:"butt",strokeMiterLimit:r=void 0!==r?r:4}}static pointsToStroke(t,e,n,i){const r=[],s=[],a=[];if(0===Rp.pointsToStrokeWithBuffers(t,e,n,i,r,s,a))return null;const o=new si;return o.setAttribute("position",new Zn(r,3)),o.setAttribute("normal",new Zn(s,3)),o.setAttribute("uv",new Zn(a,2)),o}static pointsToStrokeWithBuffers(t,e,n,i,r,s,a,o){const l=new Xt,c=new Xt,h=new Xt,u=new Xt,d=new Xt,p=new Xt,m=new Xt,f=new Xt,g=new Xt,v=new Xt,y=new Xt,x=new Xt,_=new Xt,b=new Xt,M=new Xt,w=new Xt,S=new Xt;n=void 0!==n?n:12,i=void 0!==i?i:.001,o=void 0!==o?o:0,t=function(t){let e=!1;for(let r=1,s=t.length-1;r=i&&n.push(t[r]);return n.push(t[t.length-1]),n}(t);const T=t.length;if(T<2)return 0;const A=t[0].equals(t[T-1]);let E,R,C=t[0];const P=e.strokeWidth/2,L=1/(T-1);let I,N,O,D,U=0,B=!1,F=0,k=3*o,z=2*o;V(t[0],t[1],l).multiplyScalar(P),f.copy(t[0]).sub(l),g.copy(t[0]).add(l),v.copy(f),y.copy(g);for(let Y=1;YNumber.EPSILON){const n=P/t;h.multiplyScalar(-n),u.subVectors(E,C),d.copy(u).setLength(n).add(h),w.copy(d).negate();const i=d.length(),r=u.length();u.divideScalar(r),p.subVectors(R,E);const s=p.length();switch(p.divideScalar(s),u.dot(w){const n=/\.fbx$|\.glb$|\.gltf$/.test(e);/\.jpe?g$|\.png$/.test(e)?this.textureLoader.load(e,(e=>t(e))):(n?this.fileLoader.setResponseType("arraybuffer"):this.fileLoader.setResponseType("undefined"),this.fileLoader.load(e,(e=>t(e))))}))}async textureAtlas(t,e,n="JSONHash"){let i=JSON.parse(await this.file(e));if(i.textures){const t=i.textures[0].frames;let e={frames:{}};t.forEach((t=>{e={...e,frames:{...e.frames,[t.filename]:{frame:t.frame,rotated:t.rotated,sourceSize:t.sourceSize,spriteSourceSize:t.spriteSourceSize,trimmed:t.trimmed}}}})),i=e}return{texture:await this.texture(t),json:i}}file(t){const e=this.cache.get(t);return t=e||t,new Promise((e=>{this.fileLoader.load(t,(t=>e(t)))}))}svg(t){const e=this.cache.get(t);return t=e||t,new Promise((e=>{this.svgLoader.load(t,(t=>e(t)))}))}texture(t){if(!/^data:image\/[\S]+;base64,/gm.test(t)){const e=this.cache.get(t);t=e||t}return new Promise((e=>{this.textureLoader.load(t,(t=>{t.anisotropy=this.textureAnisotropy,t.needsUpdate=!0,e(t)}))}))}object(t){const e=this.cache.get(t);return t=e||t,new Promise((e=>{this.objectLoader.load(t,(t=>{e(t)}))}))}gltf(t){const e=this.cache.get(t);return t=e||t,new Promise((e=>{this.gltfLoader.load(t,(t=>{e(t)}))}))}fbx(t){const e=this.cache.get(t);return t=e||t,new Promise((e=>{this.fbxLoader.load(t,(t=>{e(t)}))}))}}class Pp extends Sn{constructor(t,e,n,i){super(),this.scene=t,this.light=e,this.size=n,this.color=i,this.geo=new jl(n||.2,16,8),this.mat=new jn({color:i||e.color}),this.mesh=new wi(this.geo,this.mat),this.add(this.mesh),e.add(this)}dispose(){this.mesh.geometry.dispose(),Array.isArray(this.mesh.material)?this.mesh.material.forEach((t=>t.dispose())):this.mesh.material.dispose(),this.remove(this.mesh)}update(){}}class Lp{constructor(t){this.scene=t}get helper(){return{directionalLightHelper:(t,e,n)=>{const i=new Fh(t,e,n);return this.scene.add(i),i},spotLightHelper:(t,e)=>{const n=new Oh(t,e);return this.scene.add(n),n},pointLightHelper:(t,e,n)=>new Pp(this.scene,t,e,n)}}directionalLight(t={}){const{color:e=16777215,intensity:n=1}=t,i=new Zc(e,n);return i.castShadow=!0,this.scene.add(i),i}hemisphereLight(t={}){const{skyColor:e=16777215,groundColor:n=16777215,intensity:i=1}=t,r=new Fc(e,n,i);return this.scene.add(r),r}ambientLight(t={}){const{color:e=16777215,intensity:n=1}=t,i=new $c(e,n);return this.scene.add(i),i}pointLight(t={}){const{color:e=16777215,intensity:n=1,distance:i=0,decay:r=1}=t,s=new Kc(e,n,i,r);return s.castShadow=!0,this.scene.add(s),s}spotLight(t={}){const{color:e=16777215,intensity:n=1,distance:i=0,angle:r=Math.PI/8,penumbra:s=0,decay:a=1}=t,o=new Wc(e,n,i,r,s,a);return o.castShadow=!0,this.scene.add(o),o}rectAreaLight(t={}){const{color:e=16777215,intensity:n=1,width:i=10,height:r=10}=t,s=new Qc(e,n,i,r);return this.scene.add(s),s}}class Ip{constructor(t){this.scene=t}add(t,e={}){const n=this.make(t,e);return n?this.scene.add(n):console.warn("Could not make heightmap"),n}make(t,e={}){const{image:n}=t,{width:i,height:r}=n,{colorScale:s,heightScale:a=100,colorSpace:o=""}=e,l=document.createElement("canvas");l.width=i,l.height=r;const c=l.getContext("2d");if(!c)return;c.drawImage(t.image,0,0);const h=c.getImageData(0,0,i,r),u=new Xi(10,10,i-1,r-1);let d={color:13421772,side:2};s&&(d={...d,vertexColors:!0});const p=new nc(d),m=new tu(u,p);m.receiveShadow=m.castShadow=!0,m.shape="concave";const f=u.attributes.position.array;for(let g=0;gMath.PI&&(y-=f),M<-Math.PI?M+=f:M>Math.PI&&(M-=f),a.theta=y<=M?Math.max(y,Math.min(M,a.theta)):a.theta>(y+M)/2?Math.max(y,a.theta):Math.min(M,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),!0===n.enableDamping?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.zoomToCursor&&b||n.object.isOrthographicCamera?a.radius=N(a.radius):a.radius=N(a.radius*l),e.setFromSpherical(a),e.applyQuaternion(u),v.copy(n.target).add(e),n.object.lookAt(n.target),!0===n.enableDamping?(o.theta*=1-n.dampingFactor,o.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(o.set(0,0,0),c.set(0,0,0));let w=!1;if(n.zoomToCursor&&b){let i=null;if(n.object.isPerspectiveCamera){const t=e.length();i=N(t*l);const r=t-i;n.object.position.addScaledVector(x,r),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const t=new Me(_.x,_.y,0);t.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),w=!0;const r=new Me(_.x,_.y,0);r.unproject(n.object),n.object.position.sub(r).add(t),n.object.updateMatrixWorld(),i=e.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;null!==i&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(i).add(n.object.position):(Up.origin.copy(n.object.position),Up.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Up.direction))s||8*(1-p.dot(n.object.quaternion))>s||m.distanceToSquared(n.target)>0)&&(n.dispatchEvent(Np),d.copy(n.object.position),p.copy(n.object.quaternion),m.copy(n.target),w=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",q),n.domElement.removeEventListener("pointerdown",H),n.domElement.removeEventListener("pointercancel",W),n.domElement.removeEventListener("wheel",j),n.domElement.removeEventListener("pointermove",G),n.domElement.removeEventListener("pointerup",W),null!==n._domElementKeyEvents&&(n._domElementKeyEvents.removeEventListener("keydown",X),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=i.NONE;const s=1e-6,a=new Eh,o=new Eh;let l=1;const c=new Me,h=new Xt,u=new Xt,d=new Xt,p=new Xt,m=new Xt,f=new Xt,g=new Xt,v=new Xt,y=new Xt,x=new Me,_=new Xt;let b=!1;const M=[],w={};function S(){return Math.pow(.95,n.zoomSpeed)}function T(t){o.theta-=t}function A(t){o.phi-=t}const E=function(){const t=new Me;return function(e,n){t.setFromMatrixColumn(n,0),t.multiplyScalar(-e),c.add(t)}}(),R=function(){const t=new Me;return function(e,i){!0===n.screenSpacePanning?t.setFromMatrixColumn(i,1):(t.setFromMatrixColumn(i,0),t.crossVectors(n.object.up,t)),t.multiplyScalar(e),c.add(t)}}(),C=function(){const t=new Me;return function(e,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const s=n.object.position;t.copy(s).sub(n.target);let a=t.length();a*=Math.tan(n.object.fov/2*Math.PI/180),E(2*e*a/r.clientHeight,n.object.matrix),R(2*i*a/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(E(e*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),R(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function P(t){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function L(t){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(t){if(!n.zoomToCursor)return;b=!0;const e=n.domElement.getBoundingClientRect(),i=t.clientX-e.left,r=t.clientY-e.top,s=e.width,a=e.height;_.x=i/s*2-1,_.y=-r/a*2+1,x.set(_.x,_.y,1).unproject(n.object).sub(n.object.position).normalize()}function N(t){return Math.max(n.minDistance,Math.min(n.maxDistance,t))}function O(t){h.set(t.clientX,t.clientY)}function D(t){p.set(t.clientX,t.clientY)}function U(){if(1===M.length)h.set(M[0].pageX,M[0].pageY);else{const t=.5*(M[0].pageX+M[1].pageX),e=.5*(M[0].pageY+M[1].pageY);h.set(t,e)}}function B(){if(1===M.length)p.set(M[0].pageX,M[0].pageY);else{const t=.5*(M[0].pageX+M[1].pageX),e=.5*(M[0].pageY+M[1].pageY);p.set(t,e)}}function F(){const t=M[0].pageX-M[1].pageX,e=M[0].pageY-M[1].pageY,n=Math.sqrt(t*t+e*e);g.set(0,n)}function k(t){if(1==M.length)u.set(t.pageX,t.pageY);else{const e=K(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);u.set(n,i)}d.subVectors(u,h).multiplyScalar(n.rotateSpeed);const e=n.domElement;T(2*Math.PI*d.x/e.clientHeight),A(2*Math.PI*d.y/e.clientHeight),h.copy(u)}function z(t){if(1===M.length)m.set(t.pageX,t.pageY);else{const e=K(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);m.set(n,i)}f.subVectors(m,p).multiplyScalar(n.panSpeed),C(f.x,f.y),p.copy(m)}function V(t){const e=K(t),i=t.pageX-e.x,r=t.pageY-e.y,s=Math.sqrt(i*i+r*r);v.set(0,s),y.set(0,Math.pow(v.y/g.y,n.zoomSpeed)),P(y.y),g.copy(v)}function H(t){!1!==n.enabled&&(0===M.length&&(n.domElement.setPointerCapture(t.pointerId),n.domElement.addEventListener("pointermove",G),n.domElement.addEventListener("pointerup",W)),function(t){M.push(t)}(t),"touch"===t.pointerType?function(t){switch(Y(t),M.length){case 1:switch(n.touches.ONE){case 0:if(!1===n.enableRotate)return;U(),r=i.TOUCH_ROTATE;break;case 1:if(!1===n.enablePan)return;B(),r=i.TOUCH_PAN;break;default:r=i.NONE}break;case 2:switch(n.touches.TWO){case 2:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&F(),n.enablePan&&B(),r=i.TOUCH_DOLLY_PAN;break;case 3:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&F(),n.enableRotate&&U(),r=i.TOUCH_DOLLY_ROTATE;break;default:r=i.NONE}break;default:r=i.NONE}r!==i.NONE&&n.dispatchEvent(Op)}(t):function(t){let e;switch(t.button){case 0:e=n.mouseButtons.LEFT;break;case 1:e=n.mouseButtons.MIDDLE;break;case 2:e=n.mouseButtons.RIGHT;break;default:e=-1}switch(e){case 1:if(!1===n.enableZoom)return;!function(t){I(t),g.set(t.clientX,t.clientY)}(t),r=i.DOLLY;break;case 0:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===n.enablePan)return;D(t),r=i.PAN}else{if(!1===n.enableRotate)return;O(t),r=i.ROTATE}break;case 2:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===n.enableRotate)return;O(t),r=i.ROTATE}else{if(!1===n.enablePan)return;D(t),r=i.PAN}break;default:r=i.NONE}r!==i.NONE&&n.dispatchEvent(Op)}(t))}function G(t){!1!==n.enabled&&("touch"===t.pointerType?function(t){switch(Y(t),r){case i.TOUCH_ROTATE:if(!1===n.enableRotate)return;k(t),n.update();break;case i.TOUCH_PAN:if(!1===n.enablePan)return;z(t),n.update();break;case i.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(t){n.enableZoom&&V(t),n.enablePan&&z(t)}(t),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(t){n.enableZoom&&V(t),n.enableRotate&&k(t)}(t),n.update();break;default:r=i.NONE}}(t):function(t){switch(r){case i.ROTATE:if(!1===n.enableRotate)return;!function(t){u.set(t.clientX,t.clientY),d.subVectors(u,h).multiplyScalar(n.rotateSpeed);const e=n.domElement;T(2*Math.PI*d.x/e.clientHeight),A(2*Math.PI*d.y/e.clientHeight),h.copy(u),n.update()}(t);break;case i.DOLLY:if(!1===n.enableZoom)return;!function(t){v.set(t.clientX,t.clientY),y.subVectors(v,g),y.y>0?P(S()):y.y<0&&L(S()),g.copy(v),n.update()}(t);break;case i.PAN:if(!1===n.enablePan)return;!function(t){m.set(t.clientX,t.clientY),f.subVectors(m,p).multiplyScalar(n.panSpeed),C(f.x,f.y),p.copy(m),n.update()}(t)}}(t))}function W(t){!function(t){delete w[t.pointerId];for(let e=0;e0&&P(S()),n.update()}(t),n.dispatchEvent(Dp))}function X(t){!1!==n.enabled&&!1!==n.enablePan&&function(t){let e=!1;switch(t.code){case n.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?A(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(0,n.keyPanSpeed),e=!0;break;case n.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?A(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(0,-n.keyPanSpeed),e=!0;break;case n.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?T(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(n.keyPanSpeed,0),e=!0;break;case n.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?T(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(-n.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),n.update())}(t)}function q(t){!1!==n.enabled&&t.preventDefault()}function Y(t){let e=w[t.pointerId];void 0===e&&(e=new Xt,w[t.pointerId]=e),e.set(t.pageX,t.pageY)}function K(t){const e=t.pointerId===M[0].pointerId?M[1]:M[0];return w[e.pointerId]}n.domElement.addEventListener("contextmenu",q),n.domElement.addEventListener("pointerdown",H),n.domElement.addEventListener("pointercancel",W),n.domElement.addEventListener("wheel",j,{passive:!1}),this.update()}}class zp{constructor(t,e,n,i,r,s,a){this.scene=t,this.renderer=e,this.camera=n,this.lights=i,this.physics=r,this.load=s,this.factories=a}async warpSpeed(...t){let e={};const n=t.filter((t=>/^-\w+/.test(t))),i=n.length>0;if((0===t.length||i)&&(t=["light","camera","lookAtCenter","ground","grid","orbitControls","fog","sky"]),i&&n.map((t=>t.substr(1))).forEach((e=>{const n=t.indexOf(e);t.splice(n,1)})),t.includes("sky")){const t=["varying vec3 vWorldPosition;","","void main() {","","vec4 worldPosition = modelMatrix * vec4( position, 1.0 );","vWorldPosition = worldPosition.xyz;","","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","","}"].join("\n"),e=["uniform vec3 topColor;","uniform vec3 bottomColor;","uniform float offset;","uniform float exponent;","","varying vec3 vWorldPosition;","","void main() {","","float h = normalize( vWorldPosition + offset ).y;","gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( max( h , 0.0), exponent ), 0.0 ) ), 1.0 );","","}"].join("\n"),n={topColor:{value:new Gn(30719)},bottomColor:{value:new Gn(15595007)},offset:{value:33},exponent:{value:.6}};var r=new jl(500,32,15),s=new Pi({uniforms:n,vertexShader:t,fragmentShader:e,side:1}),a=new wi(r,s);this.scene.add(a)}if(t.includes("camera")&&(this.camera.position.set(0,6,12),e={camera:this.camera,...e}),t.includes("light")){const t=1,n=this.lights.hemisphereLight({skyColor:16777215,groundColor:0,intensity:t}),i=this.lights.ambientLight({color:16777215,intensity:t}),r=this.lights.directionalLight({color:16777215,intensity:t});r.position.set(100,200,50);const s=20;r.shadow.camera.top=s,r.shadow.camera.bottom=-s,r.shadow.camera.left=-s,r.shadow.camera.right=s,r.shadow.mapSize.set(1024,1024),e={lights:{ambientLight:i,directionalLight:r,hemisphereLight:n},...e}}if(t.includes("lookAtCenter")&&this.camera.lookAt(this.scene.position),t.includes("ground")){const n=t.includes("grid"),i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOnAAADusBZ+q87AAAAJtJREFUeJzt0EENwDAAxLDbNP6UOxh+NEYQ5dl2drFv286598GrA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAu37AD8eaBH5JQdVbAAAAAElFTkSuQmCC",r=await this.load.texture(i);r.wrapS=r.wrapT=B,r.repeat.set(21,21);const s={name:"ground",width:21,height:21,depth:1,y:-.5},a={phong:{map:n?r:null,color:16777215}};let o;window.__loadPhysics?(o=this.physics.add.ground(s,a),o.body.setRestitution(1)):o=this.factories.add.ground(s,a),o.receiveShadow=!0,e={ground:o,...e}}return t.includes("orbitControls")&&(e={orbitControls:new kp(this.camera,document.getElementById("enable3d-phaser-canvas")||this.renderer.domElement),...e}),e}}class Vp{constructor(){this._mixers=[]}animationMixer(t){const e=new wh(t);return this.mixers.add(e),e}get mixers(){return{create:t=>this.animationMixer(t),add:t=>this._mixers.push(t),get:()=>this._mixers,update:t=>{var e;return null==(e=this._mixers)?void 0:e.forEach((e=>e.update(t/1e3)))}}}}class Hp extends wi{constructor(t,e={}){super(t),this.isReflector=!0,this.type="Reflector",this.camera=new Ii;const n=this,i=void 0!==e.color?new Gn(e.color):new Gn(8355711),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||Hp.ReflectorShader,l=void 0!==e.multisample?e.multisample:4,c=new zi,h=new Me,u=new Me,d=new Me,p=new $e,m=new Me(0,0,-1),f=new ge,g=new Me,v=new Me,y=new ge,x=new $e,_=this.camera,b=new ye(r,s,{samples:l,type:J}),M=new Pi({name:void 0!==o.name?o.name:"unspecified",uniforms:Ci.clone(o.uniforms),fragmentShader:o.fragmentShader,vertexShader:o.vertexShader});M.uniforms.tDiffuse.value=b.texture,M.uniforms.color.value=i,M.uniforms.textureMatrix.value=x,this.material=M,this.onBeforeRender=function(t,e,i){if(u.setFromMatrixPosition(n.matrixWorld),d.setFromMatrixPosition(i.matrixWorld),p.extractRotation(n.matrixWorld),h.set(0,0,1),h.applyMatrix4(p),g.subVectors(u,d),g.dot(h)>0)return;g.reflect(h).negate(),g.add(u),p.extractRotation(i.matrixWorld),m.set(0,0,-1),m.applyMatrix4(p),m.add(d),v.subVectors(u,m),v.reflect(h).negate(),v.add(u),_.position.copy(g),_.up.set(0,1,0),_.up.applyMatrix4(p),_.up.reflect(h),_.lookAt(v),_.far=i.far,_.updateMatrixWorld(),_.projectionMatrix.copy(i.projectionMatrix),x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(_.projectionMatrix),x.multiply(_.matrixWorldInverse),x.multiply(n.matrixWorld),c.setFromNormalAndCoplanarPoint(h,u),c.applyMatrix4(_.matrixWorldInverse),f.set(c.normal.x,c.normal.y,c.normal.z,c.constant);const r=_.projectionMatrix;y.x=(Math.sign(f.x)+r.elements[8])/r.elements[0],y.y=(Math.sign(f.y)+r.elements[9])/r.elements[5],y.z=-1,y.w=(1+r.elements[10])/r.elements[14],f.multiplyScalar(2/f.dot(y)),r.elements[2]=f.x,r.elements[6]=f.y,r.elements[10]=f.z+1-a,r.elements[14]=f.w,n.visible=!1;const s=t.getRenderTarget(),o=t.xr.enabled,l=t.shadowMap.autoUpdate;t.xr.enabled=!1,t.shadowMap.autoUpdate=!1,t.setRenderTarget(b),t.state.buffers.depth.setMask(!0),!1===t.autoClear&&t.clear(),t.render(e,_),t.xr.enabled=o,t.shadowMap.autoUpdate=l,t.setRenderTarget(s);const M=i.viewport;void 0!==M&&t.state.viewport(M),n.visible=!0},this.getRenderTarget=function(){return b},this.dispose=function(){b.dispose(),n.material.dispose()}}}Hp.ReflectorShader={name:"ReflectorShader",uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:"\n\t\tuniform mat4 textureMatrix;\n\t\tvarying vec4 vUv;\n\n\t\t#include \n\t\t#include \n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t#include \n\n\t\t}",fragmentShader:"\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\t\tvarying vec4 vUv;\n\n\t\t#include \n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}"};class Gp extends wi{constructor(t,e={}){super(t),this.isRefractor=!0,this.type="Refractor",this.camera=new Ii;const n=this,i=void 0!==e.color?new Gn(e.color):new Gn(8355711),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||Gp.RefractorShader,l=void 0!==e.multisample?e.multisample:4,c=this.camera;c.matrixAutoUpdate=!1,c.userData.refractor=!0;const h=new zi,u=new $e,d=new ye(r,s,{samples:l,type:J});this.material=new Pi({uniforms:Ci.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,transparent:!0}),this.material.uniforms.color.value=i,this.material.uniforms.tDiffuse.value=d.texture,this.material.uniforms.textureMatrix.value=u;const p=function(){const t=new Me,e=new Me,i=new $e,r=new Me,s=new Me;return function(a){return t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(a.matrixWorld),r.subVectors(t,e),i.extractRotation(n.matrixWorld),s.set(0,0,1),s.applyMatrix4(i),r.dot(s)<0}}(),m=function(){const t=new Me,e=new Me,i=new be,r=new Me;return function(){n.matrixWorld.decompose(e,i,r),t.set(0,0,1).applyQuaternion(i).normalize(),t.negate(),h.setFromNormalAndCoplanarPoint(t,e)}}(),f=function(){const t=new zi,e=new ge,n=new ge;return function(i){c.matrixWorld.copy(i.matrixWorld),c.matrixWorldInverse.copy(c.matrixWorld).invert(),c.projectionMatrix.copy(i.projectionMatrix),c.far=i.far,t.copy(h),t.applyMatrix4(c.matrixWorldInverse),e.set(t.normal.x,t.normal.y,t.normal.z,t.constant);const r=c.projectionMatrix;n.x=(Math.sign(e.x)+r.elements[8])/r.elements[0],n.y=(Math.sign(e.y)+r.elements[9])/r.elements[5],n.z=-1,n.w=(1+r.elements[10])/r.elements[14],e.multiplyScalar(2/e.dot(n)),r.elements[2]=e.x,r.elements[6]=e.y,r.elements[10]=e.z+1-a,r.elements[14]=e.w}}();this.onBeforeRender=function(t,e,i){!0!==i.userData.refractor&&1!=!p(i)&&(m(),function(t){u.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),u.multiply(t.projectionMatrix),u.multiply(t.matrixWorldInverse),u.multiply(n.matrixWorld)}(i),f(i),function(t,e,i){n.visible=!1;const r=t.getRenderTarget(),s=t.xr.enabled,a=t.shadowMap.autoUpdate;t.xr.enabled=!1,t.shadowMap.autoUpdate=!1,t.setRenderTarget(d),!1===t.autoClear&&t.clear(),t.render(e,c),t.xr.enabled=s,t.shadowMap.autoUpdate=a,t.setRenderTarget(r);const o=i.viewport;void 0!==o&&t.state.viewport(o),n.visible=!0}(t,e,i))},this.getRenderTarget=function(){return d},this.dispose=function(){d.dispose(),n.material.dispose()}}}Gp.RefractorShader={uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:"\n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec4 vUv;\n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}"};class Wp extends wi{constructor(t,e={}){super(t),this.isWater=!0,this.type="Water";const n=this,i=void 0!==e.color?new Gn(e.color):new Gn(16777215),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.flowDirection||new Xt(1,0),l=e.flowSpeed||.03,c=e.reflectivity||.02,h=e.scale||1,u=e.shader||Wp.WaterShader,d=new Uc,p=e.flowMap||void 0,m=e.normalMap0||d.load("textures/water/Water_1_M_Normal.jpg"),f=e.normalMap1||d.load("textures/water/Water_2_M_Normal.jpg"),g=.15,v=.075,y=new $e,x=new uh;if(void 0===Hp)return void console.error("THREE.Water: Required component Reflector not found.");if(void 0===Gp)return void console.error("THREE.Water: Required component Refractor not found.");const _=new Hp(t,{textureWidth:r,textureHeight:s,clipBias:a}),b=new Gp(t,{textureWidth:r,textureHeight:s,clipBias:a});_.matrixAutoUpdate=!1,b.matrixAutoUpdate=!1,this.material=new Pi({uniforms:Ci.merge([Yi.fog,u.uniforms]),vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,transparent:!0,fog:!0}),void 0!==p?(this.material.defines.USE_FLOWMAP="",this.material.uniforms.tFlowMap={type:"t",value:p}):this.material.uniforms.flowDirection={type:"v2",value:o},m.wrapS=m.wrapT=B,f.wrapS=f.wrapT=B,this.material.uniforms.tReflectionMap.value=_.getRenderTarget().texture,this.material.uniforms.tRefractionMap.value=b.getRenderTarget().texture,this.material.uniforms.tNormalMap0.value=m,this.material.uniforms.tNormalMap1.value=f,this.material.uniforms.color.value=i,this.material.uniforms.reflectivity.value=c,this.material.uniforms.textureMatrix.value=y,this.material.uniforms.config.value.x=0,this.material.uniforms.config.value.y=v,this.material.uniforms.config.value.z=v,this.material.uniforms.config.value.w=h,this.onBeforeRender=function(t,e,i){!function(t){y.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),y.multiply(t.projectionMatrix),y.multiply(t.matrixWorldInverse),y.multiply(n.matrixWorld)}(i),function(){const t=x.getDelta(),e=n.material.uniforms.config;e.value.x+=l*t,e.value.y=e.value.x+v,e.value.x>=g?(e.value.x=0,e.value.y=v):e.value.y>=g&&(e.value.y=e.value.y-g)}(),n.visible=!1,_.matrixWorld.copy(n.matrixWorld),b.matrixWorld.copy(n.matrixWorld),_.onBeforeRender(t,e,i),b.onBeforeRender(t,e,i),n.visible=!0}}}Wp.WaterShader={uniforms:{color:{type:"c",value:null},reflectivity:{type:"f",value:0},tReflectionMap:{type:"t",value:null},tRefractionMap:{type:"t",value:null},tNormalMap0:{type:"t",value:null},tNormalMap1:{type:"t",value:null},textureMatrix:{type:"m4",value:null},config:{type:"v4",value:new ge}},vertexShader:"\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tvCoord = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvToEye = cameraPosition - worldPosition.xyz;\n\n\t\t\tvec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex\n\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}",fragmentShader:"\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform sampler2D tReflectionMap;\n\t\tuniform sampler2D tRefractionMap;\n\t\tuniform sampler2D tNormalMap0;\n\t\tuniform sampler2D tNormalMap1;\n\n\t\t#ifdef USE_FLOWMAP\n\t\t\tuniform sampler2D tFlowMap;\n\t\t#else\n\t\t\tuniform vec2 flowDirection;\n\t\t#endif\n\n\t\tuniform vec3 color;\n\t\tuniform float reflectivity;\n\t\tuniform vec4 config;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\tfloat flowMapOffset0 = config.x;\n\t\t\tfloat flowMapOffset1 = config.y;\n\t\t\tfloat halfCycle = config.z;\n\t\t\tfloat scale = config.w;\n\n\t\t\tvec3 toEye = normalize( vToEye );\n\n\t\t\t// determine flow direction\n\t\t\tvec2 flow;\n\t\t\t#ifdef USE_FLOWMAP\n\t\t\t\tflow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;\n\t\t\t#else\n\t\t\t\tflow = flowDirection;\n\t\t\t#endif\n\t\t\tflow.x *= - 1.0;\n\n\t\t\t// sample normal maps (distort uvs with flowdata)\n\t\t\tvec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );\n\t\t\tvec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );\n\n\t\t\t// linear interpolate to get the final normal color\n\t\t\tfloat flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;\n\t\t\tvec4 normalColor = mix( normalColor0, normalColor1, flowLerp );\n\n\t\t\t// calculate normal vector\n\t\t\tvec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n\n\t\t\t// calculate the fresnel term to blend reflection and refraction maps\n\t\t\tfloat theta = max( dot( toEye, normal ), 0.0 );\n\t\t\tfloat reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );\n\n\t\t\t// calculate final uv coords\n\t\t\tvec3 coord = vCoord.xyz / vCoord.w;\n\t\t\tvec2 uv = coord.xy + coord.z * normal.xz * 0.05;\n\n\t\t\tvec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );\n\t\t\tvec4 refractColor = texture2D( tRefractionMap, uv );\n\n\t\t\t// multiply water color with the mix of both textures\n\t\t\tgl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}"};class jp{constructor(t,e,n){this.scene=t,this.renderer=e,this.factories=n}water(t={}){((t,e,n={})=>{const{width:i=20,height:r=20,x:s=0,y:a=0,z:o=0,color:l="#ffffff",scale:c=4,flowX:h=1,flowY:u=1,normalMap0:d,normalMap1:p}=n,m=new Xi(i,r),f=new tc({color:30654,transparent:!0,opacity:.8}),g=new wi(m,f);g.position.set(s,a,o),g.rotation.x=-.5*Math.PI,t.add(g);const v=new Xi(i,r),y=new Wp(v,{color:l,scale:c,flowDirection:new Xt(h,u),textureWidth:1024,textureHeight:1024,normalMap0:d,normalMap1:p,encoding:e.outputEncoding});y.position.set(s,a+.1,o),y.rotation.x=-.5*Math.PI,t.add(y)})(this.scene,this.renderer,t)}textureCube(t){6!==t.length&&Hh("You need to pass 6 urls to textureCube()");const e=new Xp;return t.forEach(((t,n)=>{t.wrapS=t.wrapT=B;const i=this.factories.add.material({phong:{map:t}});e.materials[n]=i})),e}}class Xp{constructor(){this.materials=new Array(6)}get texture(){return{left:this.getTexture(0),right:this.getTexture(1),up:this.getTexture(2),down:this.getTexture(3),front:this.getTexture(4),back:this.getTexture(5)}}getTexture(t){return this.materials[t].map}}class qp{constructor(t,e){this.camera=t,this.renderer=e,this.tmpVector2=new Xt}fromSVGtoShape(t){if(t){const e=new Rp,n=[];return e.parse(t).paths.forEach((t=>{Rp.createShapes(t).forEach((t=>{n.push(t)}))})),n}return[]}from3dto2d(t){const e=new Me(t.x,t.y,t.z),n=this.renderer.domElement;this.camera.updateMatrixWorld(),e.project(this.camera);const i=Math.round((e.x+1)*(n.width/2)),r=Math.round((1-e.y)*(n.height/2));return new Xt(i,r)}from2dto3d(t,e,n){var i;if(!this.tmpPlane){const t=new Xi(1e4,1e4),e=new jn({transparent:!0,opacity:.25});this.tmpPlane=new wi(t,e),this.tmpPlane.name="_tmp_raycast_plane"}let r;this.tmpRaycaster||(this.tmpRaycaster=new Sh),this.tmpVector3||(this.tmpVector3=new Me),this.tmpPlane.setRotationFromEuler(this.camera.rotation);const s=this.camera.position;this.tmpPlane.position.set(s.x,s.y,s.z),this.camera.getWorldDirection(this.tmpVector3),this.tmpPlane.position.add(this.tmpVector3.clone().multiplyScalar(n)),this.tmpPlane.updateMatrix(),this.tmpPlane.updateMatrixWorld(!0),this.tmpVector2.set(t,e),this.tmpRaycaster.setFromCamera(this.tmpVector2,this.camera);const a=this.tmpRaycaster.intersectObjects([this.tmpPlane]);return"_tmp_raycast_plane"===(null==(i=a[0])?void 0:i.object.name)&&(r=a[0].point),r}}class Yp{static createButton(t){const e=document.createElement("button");function n(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function i(t){t.style.position="absolute",t.style.bottom="20px",t.style.padding="12px 6px",t.style.border="1px solid #fff",t.style.borderRadius="4px",t.style.background="rgba(0,0,0,0.1)",t.style.color="#fff",t.style.font="normal 13px sans-serif",t.style.textAlign="center",t.style.opacity="0.5",t.style.outline="none",t.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",i(e),navigator.xr.isSessionSupported("immersive-vr").then((function(i){i?function(){let n=null;async function i(i){i.addEventListener("end",r),await t.xr.setSession(i),e.textContent="EXIT VR",n=i}function r(){n.removeEventListener("end",r),e.textContent="ENTER VR",n=null}e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){if(null===n){const t={optionalFeatures:["local-floor","bounded-floor","hand-tracking","layers"]};navigator.xr.requestSession("immersive-vr",t).then(i)}else n.end()}}():(n(),e.textContent="VR NOT SUPPORTED"),i&&Yp.xrSessionIsGranted&&e.click()})).catch((function(t){n(),console.warn("Exception when trying to call xr.isSessionSupported",t),e.textContent="VR NOT ALLOWED"})),e;{const t=document.createElement("a");return!1===window.isSecureContext?(t.href=document.location.href.replace(/^http:/,"https:"),t.innerHTML="WEBXR NEEDS HTTPS"):(t.href="https://immersiveweb.dev/",t.innerHTML="WEBXR NOT AVAILABLE"),t.style.left="calc(50% - 90px)",t.style.width="180px",t.style.textDecoration="none",i(t),t}}static registerSessionGrantedListener(){if("xr"in navigator){if(/WebXRViewer\//i.test(navigator.userAgent))return;navigator.xr.addEventListener("sessiongranted",(()=>{Yp.xrSessionIsGranted=!0}))}}}Yp.xrSessionIsGranted=!1,Yp.registerSessionGrantedListener();const Kp={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Jp(t){const e=await fetch(t);if(e.ok)return e.json();throw new Error(e.statusText)}const Zp={xAxis:0,yAxis:0,button:0,state:Kp.ComponentState.DEFAULT};class $p{constructor(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Kp.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(Zp)}updateFromComponent({xAxis:t,yAxis:e,button:n,state:i}){const{normalizedXAxis:r,normalizedYAxis:s}=function(t=0,e=0){let n=t,i=e;if(Math.sqrt(t*t+e*e)>1){const r=Math.atan2(e,t);n=Math.cos(r),i=Math.sin(r)}return{normalizedXAxis:.5*n+.5,normalizedYAxis:.5*i+.5}}(t,e);switch(this.componentProperty){case Kp.ComponentProperty.X_AXIS:this.value=this.states.includes(i)?r:.5;break;case Kp.ComponentProperty.Y_AXIS:this.value=this.states.includes(i)?s:.5;break;case Kp.ComponentProperty.BUTTON:this.value=this.states.includes(i)?n:0;break;case Kp.ComponentProperty.STATE:this.valueNodeProperty===Kp.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(i):this.value=this.states.includes(i)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Qp{constructor(t,e){if(!(t&&e&&e.visualResponses&&e.gamepadIndices&&0!==Object.keys(e.gamepadIndices).length))throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach((t=>{const n=new $p(e.visualResponses[t]);this.visualResponses[t]=n})),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Kp.ComponentState.DEFAULT,button:void 0!==this.gamepadIndices.button?0:void 0,xAxis:void 0!==this.gamepadIndices.xAxis?0:void 0,yAxis:void 0!==this.gamepadIndices.yAxis?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(t){if(this.values.state=Kp.ComponentState.DEFAULT,void 0!==this.gamepadIndices.button&&t.buttons.length>this.gamepadIndices.button){const e=t.buttons[this.gamepadIndices.button];this.values.button=e.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,e.pressed||1===this.values.button?this.values.state=Kp.ComponentState.PRESSED:(e.touched||this.values.button>Kp.ButtonTouchThreshold)&&(this.values.state=Kp.ComponentState.TOUCHED)}void 0!==this.gamepadIndices.xAxis&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Kp.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Kp.AxisTouchThreshold&&(this.values.state=Kp.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.yAxis&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Kp.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Kp.AxisTouchThreshold&&(this.values.state=Kp.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach((t=>{t.updateFromComponent(this.values)}))}}class tm{constructor(t,e,n){if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=n,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach((t=>{const e=this.layoutDescription.components[t];this.components[t]=new Qp(t,e)})),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const t=[];return Object.values(this.components).forEach((e=>{t.push(e.data)})),t}updateFromGamepad(){Object.values(this.components).forEach((t=>{t.updateFromGamepad(this.xrInputSource.gamepad)}))}}class em extends Sn{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(t){return this.envMap==t||(this.envMap=t,this.traverse((t=>{t.isMesh&&(t.material.envMap=this.envMap,t.material.needsUpdate=!0)}))),this}updateMatrixWorld(t){super.updateMatrixWorld(t),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach((t=>{Object.values(t.visualResponses).forEach((t=>{const{valueNode:e,minNode:n,maxNode:i,value:r,valueNodeProperty:s}=t;e&&(s===Kp.VisualResponseProperty.VISIBILITY?e.visible=r:s===Kp.VisualResponseProperty.TRANSFORM&&(e.quaternion.slerpQuaternions(n.quaternion,i.quaternion,r),e.position.lerpVectors(n.position,i.position,r)))}))})))}}function nm(t,e){!function(t,e){Object.values(t.components).forEach((t=>{const{type:n,touchPointNodeName:i,visualResponses:r}=t;if(n===Kp.ComponentType.TOUCHPAD)if(t.touchPointNode=e.getObjectByName(i),t.touchPointNode){const e=new jl(.001),n=new jn({color:255}),i=new wi(e,n);t.touchPointNode.add(i)}else console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);Object.values(r).forEach((t=>{const{valueNodeName:n,minNodeName:i,maxNodeName:r,valueNodeProperty:s}=t;if(s===Kp.VisualResponseProperty.TRANSFORM){if(t.minNode=e.getObjectByName(i),t.maxNode=e.getObjectByName(r),!t.minNode)return void console.warn(`Could not find ${i} in the model`);if(!t.maxNode)return void console.warn(`Could not find ${r} in the model`)}t.valueNode=e.getObjectByName(n),t.valueNode||console.warn(`Could not find ${n} in the model`)}))}))}(t.motionController,e),t.envMap&&e.traverse((e=>{e.isMesh&&(e.material.envMap=t.envMap,e.material.needsUpdate=!0)})),t.add(e)}class im{constructor(t=null){this.gltfLoader=t,this.path="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",this._assetCache={},this.gltfLoader||(this.gltfLoader=new Bd)}createControllerModel(t){const e=new em;let n=null;return t.addEventListener("connected",(t=>{const i=t.data;"tracked-pointer"===i.targetRayMode&&i.gamepad&&async function(t,e,n=null,i=!0){if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const r=await async function(t){if(!t)throw new Error("No basePath supplied");return await Jp(`${t}/profilesList.json`)}(e);let s;if(t.profiles.some((t=>{const n=r[t];return n&&(s={profileId:t,profilePath:`${e}/${n.path}`,deprecated:!!n.deprecated}),!!s})),!s){if(!n)throw new Error("No matching profile name found");const t=r[n];if(!t)throw new Error(`No matching profile name found and default profile "${n}" missing.`);s={profileId:n,profilePath:`${e}/${t.path}`,deprecated:!!t.deprecated}}const a=await Jp(s.profilePath);let o;if(i){let e;if(e="any"===t.handedness?a.layouts[Object.keys(a.layouts)[0]]:a.layouts[t.handedness],!e)throw new Error(`No matching handedness, ${t.handedness}, in profile ${s.profileId}`);e.assetPath&&(o=s.profilePath.replace("profile.json",e.assetPath))}return{profile:a,assetPath:o}}(i,this.path,"generic-trigger").then((({profile:t,assetPath:r})=>{e.motionController=new tm(i,t,r);const s=this._assetCache[e.motionController.assetUrl];if(s)n=s.scene.clone(),nm(e,n);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(e.motionController.assetUrl,(t=>{this._assetCache[e.motionController.assetUrl]=t,n=t.scene.clone(),nm(e,n)}),null,(()=>{throw new Error(`Asset ${e.motionController.assetUrl} missing or malformed.`)}))}})).catch((t=>{console.warn(t)}))})),t.addEventListener("disconnected",(()=>{e.motionController=null,e.remove(n),n=null})),e}}class rm{constructor(t,e){this._renderer=t,this._scene=e,this.controllerModelFactory=new im;const n=new Qh;n.name="dot",this.cameraGroup=new ma,this.cameraGroup.add(n),e.add(this.cameraGroup),t.xr.enabled=!0;const i=Yp.createButton(t);i.style.cssText+="background: rgba(0, 0, 0, 0.8); ",document.body.appendChild(i),this._renderer.xr.getCamera().add(this.cameraGroup)}get isPresenting(){var t,e;return!!(null==(e=null==(t=this._renderer)?void 0:t.xr)?void 0:e.isPresenting)}getController(t){const e=this._renderer.xr.getController(t);return this.cameraGroup.add(e),e}getControllerGrip(t){const e=this._renderer.xr.getControllerGrip(t),n=this.controllerModelFactory.createControllerModel(e);return e.add(n),this.cameraGroup.add(e),e}getControllerRay(t){const{targetRayMode:e}=t;if("tracked-pointer"===e){const t=new si;t.setAttribute("position",new Zn([0,0,0,0,0,-1],3)),t.setAttribute("color",new Zn([1,0,0,1,1,1],3));const e=new yo({vertexColors:!0});return new So(t,e)}if("gaze"===e){const t=new Gl(.02,.04,32).translate(0,0,-1),e=new jn({color:"red",opacity:.5,transparent:!0});return new wi(t,e)}}get camera(){return this.WebXRCamera}get WebXRCamera(){var t;return{group:this.cameraGroup,position:null==(t=this._renderer.xr.getCamera())?void 0:t.position,rotation:this.isPresenting?this._renderer.xr.getCamera().rotation:void 0,getWorldDirection:t=>this.isPresenting?this._renderer.xr.getCamera().getWorldDirection(t):void 0}}}class sm{constructor(t){this.top=0,this.array=new Float32Array(t)}write(t){this.array[this.top++]=t.x,this.array[this.top++]=t.y,this.array[this.top++]=t.z}}class am{constructor(t){this.top=0,this.array=new Float32Array(t)}write(t){this.array[this.top++]=t.x,this.array[this.top++]=t.y}}class om{constructor(t){this.plane=null,this.front=null,this.back=null,this.polygons=[],t&&this.build(t)}clone(){const t=new om;return t.plane=this.plane&&this.plane.clone(),t.front=this.front&&this.front.clone(),t.back=this.back&&this.back.clone(),t.polygons=this.polygons.map((t=>t.clone())),t}invert(){for(let e=0;ecm.EPSILON?1:0;s|=n,a.push(n)}switch(s){case 0:(this.normal.dot(t.plane.normal)>0?e:n).push(t);break;case 1:i.push(t);break;case 2:r.push(t);break;case 3:{const e=[],n=[];for(let i=0;i=3&&i.push(new hm(e,t.shared)),n.length>=3&&r.push(new hm(n,t.shared));break}}}static fromPoints(t,e,n){const i=(new lm).copy(e).sub(t).cross((new lm).copy(n).sub(t)).normalize();return new cm(i.clone(),i.dot(t))}}cm.EPSILON=1e-5;class hm{constructor(t,e){this.vertices=t,this.shared=e,this.plane=cm.fromPoints(t[0].pos,t[1].pos,t[2].pos)}clone(){return new hm(this.vertices.map((t=>t.clone())),this.shared)}flip(){this.vertices.reverse().map((t=>t.flip())),this.plane.flip()}}class um{constructor(t,e,n,i){this.pos=(new lm).copy(t),this.normal=(new lm).copy(e),this.uv=(new lm).copy(n),this.uv.z=0,i&&(this.color=(new lm).copy(i))}clone(){return new um(this.pos,this.normal,this.uv,this.color)}flip(){this.normal.negate()}interpolate(t,e){return new um(this.pos.clone().lerp(t.pos,e),this.normal.clone().lerp(t.normal,e),this.uv.clone().lerp(t.uv,e),this.color&&t.color&&this.color.clone().lerp(t.color,e))}}class dm{constructor(){this.polygons=[]}static fromPolygons(t){const e=new dm;return e.polygons=t,e}static fromGeometry(t,e){let n=[];const i=t.attributes.position,r=t.attributes.normal,s=t.attributes.uv,a=t.attributes.color,o=t.groups;let l;if(t.index)l=t.index.array;else{l=new Array(i.array.length/i.itemSize|0);for(let t=0;t0)for(const e of o)h>=e.start&&h!Number.isNaN(t.plane.normal.x))))}static toGeometry(t,e){let n=0;const i=t.polygons;for(const d of i)n+=d.vertices.length-2;const r=new si,s=new sm(3*n*3),a=new sm(3*n*3),o=new am(2*n*3);let l;const c=[],h=[];for(const d of i){const t=d.vertices,e=t.length;void 0!==d.shared&&(c[d.shared]||(c[d.shared]=[])),e&&void 0!==t[0].color&&(l||(l=new sm(3*n*3)));for(let n=3;n<=e;n++)(void 0===d.shared?h:c[d.shared]).push(s.top/3,s.top/3+1,s.top/3+2),s.write(t[0].pos),s.write(t[n-2].pos),s.write(t[n-1].pos),a.write(t[0].normal),a.write(t[n-2].normal),a.write(t[n-1].normal),o&&(o.write(t[0].uv),o.write(t[n-2].uv),o.write(t[n-1].uv)),l&&(l.write(t[0].color),l.write(t[n-2].color),l.write(t[n-1].color))}r.setAttribute("position",new Yn(s.array,3)),r.setAttribute("normal",new Yn(a.array,3)),o&&r.setAttribute("uv",new Yn(o.array,2)),l&&r.setAttribute("color",new Yn(l.array,3));for(let d=0;dt.clone())).filter((t=>Number.isFinite(t.plane.w))),t}toPolygons(){return this.polygons}union(t){const e=new om(this.clone().polygons),n=new om(t.clone().polygons);return e.clipTo(n),n.clipTo(e),n.invert(),n.clipTo(e),n.invert(),e.build(n.allPolygons()),dm.fromPolygons(e.allPolygons())}subtract(t){const e=new om(this.clone().polygons),n=new om(t.clone().polygons);return e.invert(),e.clipTo(n),n.clipTo(e),n.invert(),n.clipTo(e),n.invert(),e.build(n.allPolygons()),e.invert(),dm.fromPolygons(e.allPolygons())}intersect(t){const e=new om(this.clone().polygons),n=new om(t.clone().polygons);return e.invert(),n.clipTo(e),n.invert(),e.clipTo(n),n.clipTo(e),e.build(n.allPolygons()),e.invert(),dm.fromPolygons(e.allPolygons())}inverse(){const t=this.clone();for(const e of t.polygons)e.flip();return t}toMesh(t,e){return dm.toMesh(this,t,e)}toGeometry(t){return dm.toGeometry(this,t)}}class pm{static union(t,e){return this.doCSG(t,e,"union")}static subtract(t,e){return this.doCSG(t,e,"subtract")}static intersect(t,e){return this.doCSG(t,e,"intersect")}static doCSG(t,e,n){return t.updateMatrix(),e.updateMatrix(),"union"===n?dm.union(t,e):"subtract"===n?dm.subtract(t,e):"intersect"===n?dm.intersect(t,e):void 0}}class mm extends ku{constructor(t,e={}){var n;const i=document.getElementById("enable3d-three-canvas");let r={};i&&(r={canvas:i}),e.renderer=new ba({...r,antialias:e.antialias||!1}),super(e),null==(n=t.sys.game.canvas.parentElement)||n.insertBefore(e.renderer.domElement,t.sys.game.canvas),t.sys.game.canvas.style.position="relative";const s=()=>{var n,i;if(!e.renderer)return;const{width:r,height:s,marginLeft:a,marginTop:o}=t.sys.game.canvas.style;e.renderer.domElement.id="enable3d-three-canvas",(null==(n=this.camera)?void 0:n.aspect)&&(this.camera.aspect=t.sys.game.scale.baseSize.width/t.sys.game.scale.baseSize.height),null==(i=this.camera)||i.updateProjectionMatrix(),e.renderer.setSize(t.sys.game.scale.baseSize.width,t.sys.game.scale.baseSize.height),e.renderer.domElement.style.width=r,e.renderer.domElement.style.height=s,e.renderer.domElement.style.marginLeft=a,e.renderer.domElement.style.marginTop=o};s(),t.scale.on("resize",(()=>{s()}));const a=document.createElement("style");a.innerText="\n #enable3d-phaser-canvas:focus,\n #enable3d-three-canvas:focus {\n outline: none;\n }\n\n #enable3d-three-canvas {\n position: absolute;\n }\n ",document.head.appendChild(a);const{enableXR:o=!1}=e;if(this.isXrEnabled=o,this.scene3D=t,o&&(this.webXR=new rm(this.renderer,this.scene)),this.isXrEnabled){let e=0;this.renderer.setAnimationLoop((n=>{if(this.renderer.xr.isPresenting){const i=n-e;e=n,t.updateLoopXR(n,i),this.renderer.state.reset(),this.preRender(),this.composer?this.composer.render():this.renderer.render(this.scene,this.camera),this.postRender()}}))}t.add.extern().render=t=>{this.renderer.xr.isPresenting||(this.preRender(),this.composer?this.composer.render():this.renderer.render(this.scene,this.camera),this.postRender())},t.events.on("postupdate",((t,e)=>{var n,i,r;null==(n=this.animationMixers)||n.update(e),null==(i=this.physics)||i.update(e),null==(r=this.physics)||r.updateDebugger()})),this.load=new Cp(this.cache,this.textureAnisotropy),this.lights=new Lp(this.scene),this.transform=new qp(this.camera,this.renderer),this.csg=pm,this.heightMap=new Ip(this.scene),this.factories=new gu(this.scene),this.misc=new jp(this.scene,this.renderer,this.factories),this.cameras=new zh,this.ws=new zp(this.scene,this.renderer,this.camera,this.lights,this.physics,this.load,this.factories),this.mixers=new Vp,t.events.once("shutdown",(()=>{t.clearThirdDimension(),t.events.removeListener("update")}))}preRender(){}postRender(){}destroy(t){var e;null==(e=this.physics)||e.destroy(t.body),this.scene.remove(t),t=null}async warpSpeed(...t){return await this.ws.warpSpeed(...t)}haveSomeFun(t=20){((t=20,e)=>{if(window.__loadPhysics)for(let n=0;nMath.floor(Math.random()*(e-t+1)+t),i=t=>t[Math.floor(Math.random()*t.length)];Math.random()>.5?e.add.box({x:n(-10,10),y:n(10,20),z:n(-10,10),width:n(1,2)/10,height:n(1,2)/10,depth:n(1,2)/10,mass:1},{[i(t)]:{color:Math.floor(16777215*Math.random())}}).body.setRestitution(Math.floor(10*Math.random())/20):e.add.sphere({x:n(-10,10),y:n(10,20),z:n(-10,10),radius:n(1,2)/10,mass:1},{[i(t)]:{color:Math.floor(16777215*Math.random())}}).body.setRestitution(Math.floor(10*Math.random())/20)}else console.log("There is not much fun without physics enabled!")})(t,this.physics)}get animationMixers(){var t;return null==(t=this.mixers)?void 0:t.mixers}get make(){return this.factories.make}get add(){return this.factories.add}}class fm extends e.Scene{constructor(t){super(t)}async warpSpeed(...t){return await this.third.warpSpeed(...t)}haveSomeFun(t=20){this.third.haveSomeFun(t)}requestThirdDimension(){Hh("You do not need requestThirdDimension() anymore. Place accessThirdDimension() inside init() instead!")}clearThirdDimension(){for(const t in this.third)delete this.third[t];delete this.third}accessThirdDimension(t={}){this.clearThirdDimension(),this.third=new mm(this,t),this.cameras.main.transparent=!0,this.cameras.main.setBackgroundColor("rgba(0,0,0,0)"),this.third.scene.background=new Gn("white")}updateLoopXR(t,e){this.preUpdateXR(t,e),this.updateXR(t,e),this.postUpdateXR(t,e)}preUpdateXR(t,e){}updateXR(t,e){}postUpdateXR(t,e){this.third.isXrEnabled&&(this.time.update(t,e),this.third.physics.update(e),this.third.physics.updateDebugger(),this.third.animationMixers.update(e))}}window.__loadPhysics=!1,window.__ammoPath="";const gm=t=>(window.setTimeout((()=>{var e,n;window.__loadPhysics?(e=window.__ammoPath,n=()=>{Ammo().then((()=>{t()}))},((t,e)=>{var n=document.createElement("script");n.onload=()=>{e()},n.onerror=()=>{throw new Error(`failed to load ${t}`)},n.async=!0,n.src=t,document.head.appendChild(n)})(Nu?`${e}/ammo.wasm.js`:`${e}/ammo.js`,(()=>n()))):t()}),50),{withPhysics(t){window.__loadPhysics=!0,window.__ammoPath=t}});var vm;document.createElement("canvas"),new Sh,new Xt,new Xt,new Xt,vm=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(e,n){var i={};e.exports=i,function(){i._nextId=0,i._seed=0,i._nowStartTime=+new Date,i._warnedOnce={},i._decomp=null,i.extend=function(t,e){var n,r;"boolean"==typeof e?(n=2,r=e):(n=1,r=!0);for(var s=n;s0;e--){var n=Math.floor(i.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}return t},i.choose=function(t){return t[Math.floor(i.random()*t.length)]},i.isElement=function(t){return"undefined"!=typeof HTMLElement?t instanceof HTMLElement:!!(t&&t.nodeType&&t.nodeName)},i.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},i.isFunction=function(t){return"function"==typeof t},i.isPlainObject=function(t){return"object"==typeof t&&t.constructor===Object},i.isString=function(t){return"[object String]"===toString.call(t)},i.clamp=function(t,e,n){return tn?n:t},i.sign=function(t){return t<0?-1:1},i.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-i._nowStartTime},i.random=function(t,n){return n=void 0!==n?n:1,(t=void 0!==t?t:0)+e()*(n-t)};var e=function(){return i._seed=(9301*i._seed+49297)%233280,i._seed/233280};i.colorToNumber=function(t){return 3==(t=t.replace("#","")).length&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),parseInt(t,16)},i.logLevel=1,i.log=function(){console&&i.logLevel>0&&i.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.info=function(){console&&i.logLevel>0&&i.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.warn=function(){console&&i.logLevel>0&&i.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.warnOnce=function(){var t=Array.prototype.slice.call(arguments).join(" ");i._warnedOnce[t]||(i.warn(t),i._warnedOnce[t]=!0)},i.deprecated=function(t,e,n){t[e]=i.chain((function(){i.warnOnce("🔅 deprecated 🔅",n)}),t[e])},i.nextId=function(){return i._nextId++},i.indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0;nt.max.x&&(t.max.x=r.x),r.xt.max.y&&(t.max.y=r.y),r.y0?t.max.x+=n.x:t.min.x+=n.x,n.y>0?t.max.y+=n.y:t.min.y+=n.y)},n.contains=function(t,e){return e.x>=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},n.overlaps=function(t,e){return t.min.x<=e.max.x&&t.max.x>=e.min.x&&t.max.y>=e.min.y&&t.min.y<=e.max.y},n.translate=function(t,e){t.min.x+=e.x,t.max.x+=e.x,t.min.y+=e.y,t.max.y+=e.y},n.shift=function(t,e){var n=t.max.x-t.min.x,i=t.max.y-t.min.y;t.min.x=e.x,t.max.x=e.x+n,t.min.y=e.y,t.max.y=e.y+i}},function(t,e){var n={};t.exports=n,n.create=function(t,e){return{x:t||0,y:e||0}},n.clone=function(t){return{x:t.x,y:t.y}},n.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},n.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},n.rotate=function(t,e,n){var i=Math.cos(e),r=Math.sin(e);n||(n={});var s=t.x*i-t.y*r;return n.y=t.x*r+t.y*i,n.x=s,n},n.rotateAbout=function(t,e,n,i){var r=Math.cos(e),s=Math.sin(e);i||(i={});var a=n.x+((t.x-n.x)*r-(t.y-n.y)*s);return i.y=n.y+((t.x-n.x)*s+(t.y-n.y)*r),i.x=a,i},n.normalise=function(t){var e=n.magnitude(t);return 0===e?{x:0,y:0}:{x:t.x/e,y:t.y/e}},n.dot=function(t,e){return t.x*e.x+t.y*e.y},n.cross=function(t,e){return t.x*e.y-t.y*e.x},n.cross3=function(t,e,n){return(e.x-t.x)*(n.y-t.y)-(e.y-t.y)*(n.x-t.x)},n.add=function(t,e,n){return n||(n={}),n.x=t.x+e.x,n.y=t.y+e.y,n},n.sub=function(t,e,n){return n||(n={}),n.x=t.x-e.x,n.y=t.y-e.y,n},n.mult=function(t,e){return{x:t.x*e,y:t.y*e}},n.div=function(t,e){return{x:t.x/e,y:t.y/e}},n.perp=function(t,e){return{x:(e=!0===e?-1:1)*-t.y,y:e*t.x}},n.neg=function(t){return{x:-t.x,y:-t.y}},n.angle=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},n._temp=[n.create(),n.create(),n.create(),n.create(),n.create(),n.create()]},function(t,e,n){var i={};t.exports=i;var r=n(2),s=n(0);i.create=function(t,e){for(var n=[],i=0;i0)return!1}return!0},i.scale=function(t,e,n,s){if(1===e&&1===n)return t;var a,o;s=s||i.centre(t);for(var l=0;l=0?l-1:t.length-1],h=t[l],u=t[(l+1)%t.length],d=e[l0&&(s|=2),3===s)return!1;return 0!==s||null},i.hull=function(t){var e,n,i=[],s=[];for((t=t.slice(0)).sort((function(t,e){var n=t.x-e.x;return 0!==n?n:t.y-e.y})),n=0;n=2&&r.cross3(s[s.length-2],s[s.length-1],e)<=0;)s.pop();s.push(e)}for(n=t.length-1;n>=0;n-=1){for(e=t[n];i.length>=2&&r.cross3(i[i.length-2],i[i.length-1],e)<=0;)i.pop();i.push(e)}return i.pop(),s.pop(),i.concat(s)}},function(t,e,n){var i={};t.exports=i;var r=n(0);i.on=function(t,e,n){for(var i,r=e.split(" "),s=0;s0){n||(n={}),i=e.split(" ");for(var c=0;c0&&s.rotateAbout(a.position,n,t.position,a.position)}},i.setVelocity=function(t,e){t.positionPrev.x=t.position.x-e.x,t.positionPrev.y=t.position.y-e.y,t.velocity.x=e.x,t.velocity.y=e.y,t.speed=s.magnitude(t.velocity)},i.setAngularVelocity=function(t,e){t.anglePrev=t.angle-e,t.angularVelocity=e,t.angularSpeed=Math.abs(t.angularVelocity)},i.translate=function(t,e){i.setPosition(t,s.add(t.position,e))},i.rotate=function(t,e,n){if(n){var r=Math.cos(e),s=Math.sin(e),a=t.position.x-n.x,o=t.position.y-n.y;i.setPosition(t,{x:n.x+(a*r-o*s),y:n.y+(a*s+o*r)}),i.setAngle(t,t.angle+e)}else i.setAngle(t,t.angle+e)},i.scale=function(t,e,n,s){var a=0,o=0;s=s||t.position;for(var h=0;h0&&(a+=u.area,o+=u.inertia),u.position.x=s.x+(u.position.x-s.x)*e,u.position.y=s.y+(u.position.y-s.y)*n,l.update(u.bounds,u.vertices,t.velocity)}t.parts.length>1&&(t.area=a,t.isStatic||(i.setMass(t,t.density*a),i.setInertia(t,o))),t.circleRadius&&(e===n?t.circleRadius*=e:t.circleRadius=null)},i.update=function(t,e,n,i){var a=Math.pow(e*n*t.timeScale,2),o=1-t.frictionAir*n*t.timeScale,h=t.position.x-t.positionPrev.x,u=t.position.y-t.positionPrev.y;t.velocity.x=h*o*i+t.force.x/t.mass*a,t.velocity.y=u*o*i+t.force.y/t.mass*a,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.position.x+=t.velocity.x,t.position.y+=t.velocity.y,t.angularVelocity=(t.angle-t.anglePrev)*o*i+t.torque/t.inertia*a,t.anglePrev=t.angle,t.angle+=t.angularVelocity,t.speed=s.magnitude(t.velocity),t.angularSpeed=Math.abs(t.angularVelocity);for(var d=0;d0&&(p.position.x+=t.velocity.x,p.position.y+=t.velocity.y),0!==t.angularVelocity&&(r.rotate(p.vertices,t.angularVelocity,t.position),c.rotate(p.axes,t.angularVelocity),d>0&&s.rotateAbout(p.position,t.angularVelocity,t.position,p.position)),l.update(p.bounds,p.vertices,t.velocity)}},i.applyForce=function(t,e,n){t.force.x+=n.x,t.force.y+=n.y;var i=e.x-t.position.x,r=e.y-t.position.y;t.torque+=i*n.y-r*n.x},i._totalProperties=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===t.parts.length?0:1;n0&&s.motion=s.sleepThreshold&&i.set(s,!0)):s.sleepCounter>0&&(s.sleepCounter-=1)}else i.set(s,!1)}},i.afterCollisions=function(t,e){for(var n=e*e*e,r=0;ri._motionWakeThreshold*n&&i.set(c,!1)}}}},i.set=function(t,e){var n=t.isSleeping;e?(t.isSleeping=!0,t.sleepCounter=t.sleepThreshold,t.positionImpulse.x=0,t.positionImpulse.y=0,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.anglePrev=t.angle,t.speed=0,t.angularSpeed=0,t.motion=0,n||r.trigger(t,"sleepStart")):(t.isSleeping=!1,t.sleepCounter=0,n&&r.trigger(t,"sleepEnd"))}},function(t,e,n){var i={};t.exports=i;var r=n(3),s=n(2),a=n(7),o=n(1),l=n(10),c=n(0);i._warming=.4,i._torqueDampen=1,i._minLength=1e-6,i.create=function(t){var e=t;e.bodyA&&!e.pointA&&(e.pointA={x:0,y:0}),e.bodyB&&!e.pointB&&(e.pointB={x:0,y:0});var n=e.bodyA?s.add(e.bodyA.position,e.pointA):e.pointA,i=e.bodyB?s.add(e.bodyB.position,e.pointB):e.pointB,r=s.magnitude(s.sub(n,i));e.length=void 0!==e.length?e.length:r,e.id=e.id||c.nextId(),e.label=e.label||"Constraint",e.type="constraint",e.stiffness=e.stiffness||(e.length>0?1:.7),e.damping=e.damping||0,e.angularStiffness=e.angularStiffness||0,e.angleA=e.bodyA?e.bodyA.angle:e.angleA,e.angleB=e.bodyB?e.bodyB.angle:e.angleB,e.plugin={};var a={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===e.length&&e.stiffness>.1?(a.type="pin",a.anchors=!1):e.stiffness<.9&&(a.type="spring"),e.render=c.extend(a,e.render),e},i.preSolveAll=function(t){for(var e=0;e0&&(u.position.x+=c.x,u.position.y+=c.y),0!==c.angle&&(r.rotate(u.vertices,c.angle,n.position),l.rotate(u.axes,c.angle),h>0&&s.rotateAbout(u.position,c.angle,n.position,u.position)),o.update(u.bounds,u.vertices,n.velocity)}c.angle*=i._warming,c.x*=i._warming,c.y*=i._warming}}},i.pointAWorld=function(t){return{x:(t.bodyA?t.bodyA.position.x:0)+t.pointA.x,y:(t.bodyA?t.bodyA.position.y:0)+t.pointA.y}},i.pointBWorld=function(t){return{x:(t.bodyB?t.bodyB.position.x:0)+t.pointB.x,y:(t.bodyB?t.bodyB.position.y:0)+t.pointB.y}}},function(t,e,n){var i={};t.exports=i;var r=n(17);i.create=function(t,e){var n=t.bodyA,r=t.bodyB,s=t.parentA,a=t.parentB,o={id:i.id(n,r),bodyA:n,bodyB:r,contacts:{},activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:n.isSensor||r.isSensor,timeCreated:e,timeUpdated:e,inverseMass:s.inverseMass+a.inverseMass,friction:Math.min(s.friction,a.friction),frictionStatic:Math.max(s.frictionStatic,a.frictionStatic),restitution:Math.max(s.restitution,a.restitution),slop:Math.max(s.slop,a.slop)};return i.update(o,t,e),o},i.update=function(t,e,n){var s=t.contacts,a=e.supports,o=t.activeContacts,l=e.parentA,c=e.parentB;if(t.collision=e,t.inverseMass=l.inverseMass+c.inverseMass,t.friction=Math.min(l.friction,c.friction),t.frictionStatic=Math.max(l.frictionStatic,c.frictionStatic),t.restitution=Math.max(l.restitution,c.restitution),t.slop=Math.max(l.slop,c.slop),o.length=0,e.collided){for(var h=0;h0&&r.area(A)1?(m=a.create(s.extend({parts:f.slice(0)},i)),a.setPosition(m,{x:t,y:e}),m):f[0]}},function(t,e,n){var i={};t.exports=i;var r=n(0);i.create=function(t){var e={};return t||r.log("Mouse.create: element was undefined, defaulting to document.body","warn"),e.element=t||document.body,e.absolute={x:0,y:0},e.position={x:0,y:0},e.mousedownPosition={x:0,y:0},e.mouseupPosition={x:0,y:0},e.offset={x:0,y:0},e.scale={x:1,y:1},e.wheelDelta=0,e.button=-1,e.pixelRatio=parseInt(e.element.getAttribute("data-pixel-ratio"),10)||1,e.sourceEvents={mousemove:null,mousedown:null,mouseup:null,mousewheel:null},e.mousemove=function(t){var n=i._getRelativeMousePosition(t,e.element,e.pixelRatio);t.changedTouches&&(e.button=0,t.preventDefault()),e.absolute.x=n.x,e.absolute.y=n.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y,e.sourceEvents.mousemove=t},e.mousedown=function(t){var n=i._getRelativeMousePosition(t,e.element,e.pixelRatio);t.changedTouches?(e.button=0,t.preventDefault()):e.button=t.button,e.absolute.x=n.x,e.absolute.y=n.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y,e.mousedownPosition.x=e.position.x,e.mousedownPosition.y=e.position.y,e.sourceEvents.mousedown=t},e.mouseup=function(t){var n=i._getRelativeMousePosition(t,e.element,e.pixelRatio);t.changedTouches&&t.preventDefault(),e.button=-1,e.absolute.x=n.x,e.absolute.y=n.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y,e.mouseupPosition.x=e.position.x,e.mouseupPosition.y=e.position.y,e.sourceEvents.mouseup=t},e.mousewheel=function(t){e.wheelDelta=Math.max(-1,Math.min(1,t.wheelDelta||-t.detail)),t.preventDefault()},i.setElement(e,e.element),e},i.setElement=function(t,e){t.element=e,e.addEventListener("mousemove",t.mousemove),e.addEventListener("mousedown",t.mousedown),e.addEventListener("mouseup",t.mouseup),e.addEventListener("mousewheel",t.mousewheel),e.addEventListener("DOMMouseScroll",t.mousewheel),e.addEventListener("touchmove",t.mousemove),e.addEventListener("touchstart",t.mousedown),e.addEventListener("touchend",t.mouseup)},i.clearSourceEvents=function(t){t.sourceEvents.mousemove=null,t.sourceEvents.mousedown=null,t.sourceEvents.mouseup=null,t.sourceEvents.mousewheel=null,t.wheelDelta=0},i.setOffset=function(t,e){t.offset.x=e.x,t.offset.y=e.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y},i.setScale=function(t,e){t.scale.x=e.x,t.scale.y=e.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y},i._getRelativeMousePosition=function(t,e,n){var i,r,s=e.getBoundingClientRect(),a=document.documentElement||document.body.parentNode||document.body,o=void 0!==window.pageXOffset?window.pageXOffset:a.scrollLeft,l=void 0!==window.pageYOffset?window.pageYOffset:a.scrollTop,c=t.changedTouches;return c?(i=c[0].pageX-s.left-o,r=c[0].pageY-s.top-l):(i=t.pageX-s.left-o,r=t.pageY-s.top-l),{x:i/(e.clientWidth/(e.width||e.clientWidth)*n),y:r/(e.clientHeight/(e.height||e.clientHeight)*n)}}},function(t,e,n){var i={};t.exports=i;var r=n(14),s=n(9),a=n(1);i.collisions=function(t,e){for(var n=[],o=e.pairs.table,l=0;l1?1:0;u1?1:0;p0:!!(t.mask&e.category)&&!!(e.mask&t.category)}},function(t,e,n){var i={};t.exports=i;var r=n(3),s=n(2);i.collides=function(t,e,n){var a,o,l,c,h=!1;if(n){var u=t.parent,d=e.parent,p=u.speed*u.speed+u.angularSpeed*u.angularSpeed+d.speed*d.speed+d.angularSpeed*d.angularSpeed;h=n&&n.collided&&p<.2,c=n}else c={collided:!1,bodyA:t,bodyB:e};if(n&&h){var m=c.axisBody,f=m===t?e:t,g=[m.axes[n.axisNumber]];if(l=i._overlapAxes(m.vertices,f.vertices,g),c.reused=!0,l.overlap<=0)return c.collided=!1,c}else{if((a=i._overlapAxes(t.vertices,e.vertices,t.axes)).overlap<=0)return c.collided=!1,c;if((o=i._overlapAxes(e.vertices,t.vertices,e.axes)).overlap<=0)return c.collided=!1,c;a.overlapr?r=o:o=0?a.index-1:h.length-1],c.x=r.x-u.x,c.y=r.y-u.y,l=-s.dot(n,c),o=r,r=h[(a.index+1)%h.length],c.x=r.x-u.x,c.y=r.y-u.y,(i=-s.dot(n,c))s?(r.warn("Plugin.register:",i.toString(e),"was upgraded to",i.toString(t)),i._registry[t.name]=t):n-1},i.isFor=function(t,e){var n=t.for&&i.dependencyParse(t.for);return!t.for||e.name===n.name&&i.versionSatisfies(e.version,n.range)},i.use=function(t,e){if(t.uses=(t.uses||[]).concat(e||[]),0!==t.uses.length){for(var n=i.dependencies(t),s=r.topologicalSort(n),a=[],o=0;o0&&r.info(a.join(" "))}else r.warn("Plugin.use:",i.toString(t),"does not specify any dependencies to install.")},i.dependencies=function(t,e){var n=i.dependencyParse(t),s=n.name;if(!(s in(e=e||{}))){t=i.resolve(t)||t,e[s]=r.map(t.uses||[],(function(e){i.isPlugin(e)&&i.register(e);var s=i.dependencyParse(e),a=i.resolve(e);return a&&!i.versionSatisfies(a.version,s.range)?(r.warn("Plugin.dependencies:",i.toString(a),"does not satisfy",i.toString(s),"used by",i.toString(n)+"."),a._warned=!0,t._warned=!0):a||(r.warn("Plugin.dependencies:",i.toString(e),"used by",i.toString(n),"could not be resolved."),t._warned=!0),s.name}));for(var a=0;a=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-]+)?$/;e.test(t)||r.warn("Plugin.versionParse:",t,"is not a valid version or range.");var n=e.exec(t),i=Number(n[4]),s=Number(n[5]),a=Number(n[6]);return{isRange:Boolean(n[1]||n[2]),version:n[3],range:t,operator:n[1]||n[2]||"",major:i,minor:s,patch:a,parts:[i,s,a],prerelease:n[7],number:1e8*i+1e4*s+a}},i.versionSatisfies=function(t,e){e=e||"*";var n=i.versionParse(e),r=i.versionParse(t);if(n.isRange){if("*"===n.operator||"*"===t)return!0;if(">"===n.operator)return r.number>n.number;if(">="===n.operator)return r.number>=n.number;if("~"===n.operator)return r.major===n.major&&r.minor===n.minor&&r.patch>=n.patch;if("^"===n.operator)return n.major>0?r.major===n.major&&r.number>=n.number:n.minor>0?r.minor===n.minor&&r.patch>=n.patch:r.patch===n.patch}return t===e||"*"===t}},function(t,e,n){var i={};t.exports=i;var r=n(0),s=n(5),a=n(1),o=n(4),l=n(2),c=n(12);!function(){var t,e;"undefined"!=typeof window&&(t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout((function(){t(r.now())}),1e3/60)},e=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),i._goodFps=30,i._goodDelta=1e3/60,i.create=function(t){var e={controller:i,engine:null,element:null,canvas:null,mouse:null,frameRequestId:null,timing:{historySize:60,delta:0,deltaHistory:[],lastTime:0,lastTimestamp:0,lastElapsed:0,timestampElapsed:0,timestampElapsedHistory:[],engineDeltaHistory:[],engineElapsedHistory:[],elapsedHistory:[]},options:{width:800,height:600,pixelRatio:1,background:"#14151f",wireframeBackground:"#14151f",hasBounds:!!t.bounds,enabled:!0,wireframes:!0,showSleeping:!0,showDebug:!1,showStats:!1,showPerformance:!1,showBroadphase:!1,showBounds:!1,showVelocity:!1,showCollisions:!1,showSeparations:!1,showAxes:!1,showPositions:!1,showAngleIndicator:!1,showIds:!1,showVertexNumbers:!1,showConvexHulls:!1,showInternalEdges:!1,showMousePosition:!1}},n=r.extend(e,t);return n.canvas&&(n.canvas.width=n.options.width||n.canvas.width,n.canvas.height=n.options.height||n.canvas.height),n.mouse=t.mouse,n.engine=t.engine,n.canvas=n.canvas||u(n.options.width,n.options.height),n.context=n.canvas.getContext("2d"),n.textures={},n.bounds=n.bounds||{min:{x:0,y:0},max:{x:n.canvas.width,y:n.canvas.height}},1!==n.options.pixelRatio&&i.setPixelRatio(n,n.options.pixelRatio),r.isElement(n.element)?n.element.appendChild(n.canvas):n.canvas.parentNode||r.log("Render.create: options.element was undefined, render.canvas was created but not appended","warn"),n},i.run=function(e){!function r(s){e.frameRequestId=t(r),n(e,s),i.world(e,s),(e.options.showStats||e.options.showDebug)&&i.stats(e,e.context,s),(e.options.showPerformance||e.options.showDebug)&&i.performance(e,e.context,s)}()},i.stop=function(t){e(t.frameRequestId)},i.setPixelRatio=function(t,e){var n=t.options,i=t.canvas;"auto"===e&&(e=d(i)),n.pixelRatio=e,i.setAttribute("data-pixel-ratio",e),i.width=n.width*e,i.height=n.height*e,i.style.width=n.width+"px",i.style.height=n.height+"px"},i.lookAt=function(t,e,n,i){i=void 0===i||i,e=r.isArray(e)?e:[e],n=n||{x:0,y:0};for(var s={min:{x:1/0,y:1/0},max:{x:-1/0,y:-1/0}},a=0;as.max.x&&(s.max.x=h.x),l.ys.max.y&&(s.max.y=h.y))}var u=s.max.x-s.min.x+2*n.x,d=s.max.y-s.min.y+2*n.y,p=t.canvas.height,m=t.canvas.width/p,f=u/d,g=1,v=1;f>m?v=f/m:g=m/f,t.options.hasBounds=!0,t.bounds.min.x=s.min.x,t.bounds.max.x=s.min.x+u*g,t.bounds.min.y=s.min.y,t.bounds.max.y=s.min.y+d*v,i&&(t.bounds.min.x+=.5*u-u*g*.5,t.bounds.max.x+=.5*u-u*g*.5,t.bounds.min.y+=.5*d-d*v*.5,t.bounds.max.y+=.5*d-d*v*.5),t.bounds.min.x-=n.x,t.bounds.max.x-=n.x,t.bounds.min.y-=n.y,t.bounds.max.y-=n.y,t.mouse&&(c.setScale(t.mouse,{x:(t.bounds.max.x-t.bounds.min.x)/t.canvas.width,y:(t.bounds.max.y-t.bounds.min.y)/t.canvas.height}),c.setOffset(t.mouse,t.bounds.min))},i.startViewTransform=function(t){var e=t.bounds.max.x-t.bounds.min.x,n=t.bounds.max.y-t.bounds.min.y,i=e/t.options.width,r=n/t.options.height;t.context.setTransform(t.options.pixelRatio/i,0,0,t.options.pixelRatio/r,0,0),t.context.translate(-t.bounds.min.x,-t.bounds.min.y)},i.endViewTransform=function(t){t.context.setTransform(t.options.pixelRatio,0,0,t.options.pixelRatio,0,0)},i.world=function(t,e){var n,h=r.now(),u=t.engine,d=u.world,p=t.canvas,f=t.context,g=t.options,v=t.timing,y=s.allBodies(d),x=s.allConstraints(d),_=g.wireframes?g.wireframeBackground:g.background,b=[],M=[],w={timestamp:u.timing.timestamp};if(o.trigger(t,"beforeRender",w),t.currentBackground!==_&&m(t,_),f.globalCompositeOperation="source-in",f.fillStyle="transparent",f.fillRect(0,0,p.width,p.height),f.globalCompositeOperation="source-over",g.hasBounds){for(n=0;n1?1:0;o1?1:0;o1?1:0;s1?1:0;o1?1:0;a1?1:0;a1?1:0;r0)){var h=i.activeContacts[0].vertex.x,u=i.activeContacts[0].vertex.y;2===i.activeContacts.length&&(h=(i.activeContacts[0].vertex.x+i.activeContacts[1].vertex.x)/2,u=(i.activeContacts[0].vertex.y+i.activeContacts[1].vertex.y)/2),r.bodyB===r.supports[0].body||!0===r.bodyA.isStatic?o.moveTo(h-8*r.normal.x,u-8*r.normal.y):o.moveTo(h+8*r.normal.x,u+8*r.normal.y),o.lineTo(h,u)}l.wireframes?o.strokeStyle="rgba(255,165,0,0.7)":o.strokeStyle="orange",o.lineWidth=1,o.stroke()},i.separations=function(t,e,n){var i,r,s,a,o,l=n,c=t.options;for(l.beginPath(),o=0;o0&&c.trigger(t,"collisionStart",{pairs:w.collisionStart}),s.preSolvePosition(w.list),f=0;f0&&c.trigger(t,"collisionActive",{pairs:w.collisionActive}),w.collisionEnd.length>0&&c.trigger(t,"collisionEnd",{pairs:w.collisionEnd}),i._bodiesClearForces(_),c.trigger(t,"afterUpdate",x),t.timing.lastElapsed=d.now()-p,t},i.merge=function(t,e){if(d.extend(t,e),e.world){t.world=e.world,i.clear(t);for(var n=h.allBodies(t.world),s=0;sp.friction*p.frictionStatic*O*n&&(U=L,D=a.clamp(p.friction*I*n,-U,U));var B=s.cross(S,v),F=s.cross(T,v),k=_/(f.inverseMass+g.inverseMass+f.inverseInertia*B*B+g.inverseInertia*F*F);if(N*=k,D*=k,C<0&&C*C>i._restingThresh*n)M.normalImpulse=0;else{var z=M.normalImpulse;M.normalImpulse=Math.min(M.normalImpulse+N,0),N=M.normalImpulse-z}if(P*P>i._restingThreshTangent*n)M.tangentImpulse=0;else{var V=M.tangentImpulse;M.tangentImpulse=a.clamp(M.tangentImpulse+D,-U,U),D=M.tangentImpulse-V}r.x=v.x*N+y.x*D,r.y=v.y*N+y.y*D,f.isStatic||f.isSleeping||(f.positionPrev.x+=r.x*f.inverseMass,f.positionPrev.y+=r.y*f.inverseMass,f.anglePrev+=s.cross(S,r)*f.inverseInertia),g.isStatic||g.isSleeping||(g.positionPrev.x-=r.x*g.inverseMass,g.positionPrev.y-=r.y*g.inverseMass,g.anglePrev-=s.cross(T,r)*g.inverseInertia)}}}}},function(t,e,n){var i={};t.exports=i;var r=n(9),s=n(0);i._pairMaxIdleLife=1e3,i.create=function(t){return s.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},t)},i.update=function(t,e,n){var i,s,a,o,l=t.list,c=t.table,h=t.collisionStart,u=t.collisionEnd,d=t.collisionActive;for(h.length=0,u.length=0,d.length=0,o=0;oi._pairMaxIdleLife&&c.push(a);for(a=0;ah.bounds.max.x||p.bounds.max.yh.bounds.max.y))){var m=i._getRegion(t,p);if(!p.region||m.id!==p.region.id||r){p.region&&!r||(p.region=m);var f=i._regionUnion(m,p.region);for(a=f.startCol;a<=f.endCol;a++)for(o=f.startRow;o<=f.endRow;o++){l=u[c=i._getBucketId(a,o)];var g=a>=m.startCol&&a<=m.endCol&&o>=m.startRow&&o<=m.endRow,v=a>=p.region.startCol&&a<=p.region.endCol&&o>=p.region.startRow&&o<=p.region.endRow;!g&&v&&v&&l&&i._bucketRemoveBody(t,l,p),(p.region===m||g&&!v||r)&&(l||(l=i._createBucket(u,c)),i._bucketAddBody(t,l,p))}p.region=m,d=!0}}}d&&(t.pairsList=i._createActivePairsList(t))},i.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]},i._regionUnion=function(t,e){var n=Math.min(t.startCol,e.startCol),r=Math.max(t.endCol,e.endCol),s=Math.min(t.startRow,e.startRow),a=Math.max(t.endRow,e.endRow);return i._createRegion(n,r,s,a)},i._getRegion=function(t,e){var n=e.bounds,r=Math.floor(n.min.x/t.bucketWidth),s=Math.floor(n.max.x/t.bucketWidth),a=Math.floor(n.min.y/t.bucketHeight),o=Math.floor(n.max.y/t.bucketHeight);return i._createRegion(r,s,a,o)},i._createRegion=function(t,e,n,i){return{id:t+","+e+","+n+","+i,startCol:t,endCol:e,startRow:n,endRow:i}},i._getBucketId=function(t,e){return"C"+t+"R"+e},i._createBucket=function(t,e){return t[e]=[]},i._bucketAddBody=function(t,e,n){for(var i=0;i0?i.push(n):delete t.pairs[e[r]];return i}},function(t,e,n){var i=t.exports=n(23);i.Axes=n(10),i.Bodies=n(11),i.Body=n(6),i.Bounds=n(1),i.Common=n(0),i.Composite=n(5),i.Composites=n(24),i.Constraint=n(8),i.Contact=n(17),i.Detector=n(13),i.Engine=n(18),i.Events=n(4),i.Grid=n(21),i.Mouse=n(12),i.MouseConstraint=n(25),i.Pair=n(9),i.Pairs=n(20),i.Plugin=n(15),i.Query=n(26),i.Render=n(16),i.Resolver=n(19),i.Runner=n(27),i.SAT=n(14),i.Sleeping=n(7),i.Svg=n(28),i.Vector=n(2),i.Vertices=n(3),i.World=n(29),i.Engine.run=i.Runner.run,i.Common.deprecated(i.Engine,"run","Engine.run ➤ use Matter.Runner.run(engine) instead")},function(t,e,n){var i={};t.exports=i;var r=n(15),s=n(0);i.name="matter-js",i.version="0.17.1",i.uses=[],i.used=[],i.use=function(){r.use(i,Array.prototype.slice.call(arguments))},i.before=function(t,e){return t=t.replace(/^Matter./,""),s.chainPathBefore(i,t,e)},i.after=function(t,e){return t=t.replace(/^Matter./,""),s.chainPathAfter(i,t,e)}},function(t,e,n){var i={};t.exports=i;var r=n(5),s=n(8),a=n(0),o=n(6),l=n(11),c=a.deprecated;i.stack=function(t,e,n,i,s,a,l){for(var c,h=r.create({label:"Stack"}),u=t,d=e,p=0,m=0;mf&&(f=y),o.translate(v,{x:.5*x,y:.5*y}),u=v.bounds.max.x+s,r.addBody(h,v),c=v,p+=1}else u+=s}d+=f+a,u=t}return h},i.chain=function(t,e,n,i,o,l){for(var c=t.bodies,h=1;h0)for(c=0;c0&&(d=p[c-1+(l-1)*e],r.addConstraint(t,s.create(a.extend({bodyA:d,bodyB:u},o)))),i&&cd||a<(c=d-c)||a>n-1-c))return 1===u&&o.translate(h,{x:(a+(n%2==1?1:-1))*p,y:0}),l(t+(h?a*p:0)+a*s,i,a,c,h,u)}))},i.newtonsCradle=function(t,e,n,i,a){for(var o=r.create({label:"Newtons Cradle"}),c=0;c1?1:0;ht.deltaMax?t.deltaMax:i)/t.delta,t.delta=i),0!==t.timeScalePrev&&(s*=r.timeScale/t.timeScalePrev),0===r.timeScale&&(s=0),t.timeScalePrev=r.timeScale,t.correction=s,t.frameCounter+=1,n-t.counterTimestamp>=1e3&&(t.fps=t.frameCounter*((n-t.counterTimestamp)/1e3),t.counterTimestamp=n,t.frameCounter=0),o.trigger(t,"tick",a),o.trigger(t,"beforeUpdate",a),l.update(e,i,s),o.trigger(t,"afterUpdate",a),o.trigger(t,"afterTick",a)},i.stop=function(t){s(t.frameRequestId)},i.start=function(t,e){i.run(t,e)}},function(t,e,n){var i={};t.exports=i,n(1);var r=n(0);i.pathToVertices=function(t,e){"undefined"==typeof window||"SVGPathSeg"in window||r.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var n,s,a,o,l,c,h,u,d,p,m,f=[],g=0,v=0,y=0;e=e||15;var x=function(t,e,n){var i=n%2==1&&n>1;if(!d||t!=d.x||e!=d.y){d&&i?(p=d.x,m=d.y):(p=0,m=0);var r={x:p+t,y:m+e};!i&&d||(d=r),f.push(r),v=p+t,y=m+e}},_=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":v=t.x,y=t.y;break;case"H":v=t.x;break;case"V":y=t.y}x(v,y,t.pathSegType)}};for(i._svgPathToAbsolute(t),a=t.getTotalLength(),c=[],n=0;n{this.time.delayedCall(2e3*(e+1),(()=>this.showLine(t,60*(e+1))),null,this)}))}showLine(t,e){let n=this.introLayer.add(this.add.bitmapText(this.center_width,e,"computer",t,35).setOrigin(.5).setAlpha(0));this.tweens.add({targets:n,duration:2e3,alpha:1})}}class xm extends Phaser.Scene{constructor(){super({key:"game_over"})}create(){this.cameras.main.setBackgroundColor(0),this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.introLayer=this.add.layer(),this.splashLayer=this.add.layer(),this.text=["GAME OVER","You failed to deliver the probes","you survived but the mission failed!","Go back to the solar system,","The gulag of the dark side of the moon","awaits for reeducation..."],this.showHistory(),this.input.keyboard.on("keydown-SPACE",this.startSplash,this),this.input.keyboard.on("keydown-ENTER",this.startSplash,this)}showHistory(){this.text.forEach(((t,e)=>{this.time.delayedCall(2e3*(e+1),(()=>this.showLine(t,60*(e+1))),null,this)}))}showLine(t,e){let n=this.introLayer.add(this.add.bitmapText(this.center_width,e,"computer",t,45).setTint(450954).setOrigin(.5).setAlpha(0));this.tweens.add({targets:n,duration:2e3,alpha:1})}startSplash(){location.reload(),this.scene.start("bootstrap")}}class _m{constructor(t){this.scene=t}typeText(t,e,n,i=150,r=450954,s=40){let a=[],o=0,l=0;t.split("").forEach(((t,c)=>{"\n"===t&&(o++,l=0),a.push(this.scene.add.bitmapText(n-350+25*l++,i+o*s/1.3,e,t,s).setTint(r).setAlpha(0))}));const c=this.scene.add.rectangle(n-335+25*l,i+25+o*s/1.3,25,5,r).setOrigin(.5).setAlpha(0),h=this.scene.add.timeline();return this.typeAudio=this.scene.sound.add("type"),a.forEach(((t,e)=>{h.add({at:0,tween:{targets:t,alpha:{from:0,to:.5},duration:100}})})),h.add({at:0,tween:{targets:c,alpha:{from:0,to:.8},duration:100,repeat:5,yoyo:!0,onStart:()=>{this.typeAudio.stop()}}}),this.typeAudio.play({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!0,delay:0}),h.play(),a.push(c),a}removeTyped(t){t.flat().forEach((t=>t.destroy()))}}class bm{constructor(){this._functions=[this.flat,this.tlaf,this.horizontal,this.multiWave,this.cos,this.tan,this.ripple]}get functions(){return this._functions}sin(t,e){return Math.sin(t)}flat(t,e,n){return t+n}tlaf(t,e,n){return-t-n}horizontal(t,e,n){return n}wave(t,e){return Math.sin(Math.PI*(t+e))}multiWave(t,e){return Math.sin(Math.PI*(t+e))}cos(t,e,n){return Math.cos(t)*Phaser.Math.Between(.1,.9)}tan(t,e,n){return Math.tan(t)}ripple(t,e,n){return Math.sin(e*t*(Math.PI/360))}}class Mm{constructor(t){this.scene=t}lightning(){if(Phaser.Math.Between(1,11)<10)return;const t=this.scene.add.timeline();t.add({targets:this.scene.lightningEffect,alpha:{from:0,to:1},duration:100,repeat:3}),this.scene.lights.out&&t.add({targets:this.scene.lightsOut,alpha:{from:1,to:.5},duration:500}),t.add({targets:this.scene.lightningEffect,alpha:{from:1,to:0},duration:2e3}),this.scene.lights.out&&t.add({targets:this.scene.lightsOut,alpha:{from:.5,to:1},duration:500}),t.play(),this.scene.playRandom("thunder"+Phaser.Math.Between(0,3))}}const wm={type:e.WEBGL,transparent:!0,scale:{mode:e.Scale.FIT,autoCenter:e.Scale.CENTER_BOTH,width:1280,height:720},scene:[class extends fm{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.setLoadEvents(),this.loadFonts(),this.loadImages(),this.loadAudios(),this.loadVideos(),this.setRegistry()}setLoadEvents(){this.load.on("progress",(function(t){this.progressBar.clear(),this.progressBar.fillStyle(237666,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*t,16)}),this),this.load.on("complete",(()=>{this.scene.start("story")}),this)}loadFonts(){this.load.bitmapFont("pixelFont","assets/fonts/mario.png","assets/fonts/mario.xml"),this.load.bitmapFont("computer","assets/fonts/computer.png","assets/fonts/computer.xml")}loadImages(){this.load.image("pello_logo_old","assets/images/pello_logo_old.png")}setRegistry(){this.registry.set("deviation","0"),this.registry.set("probes","20")}loadAudios(){Array(4).fill(0).forEach(((t,e)=>{this.load.audio(`thunder${e}`,`./assets/sounds/thunder${e}.mp3`)})),Array(2).fill(0).forEach(((t,e)=>{this.load.audio(`passby${e}`,`./assets/sounds/passby${e}.mp3`)})),Array(4).fill(0).forEach(((t,e)=>{this.load.audio(`hit${e+1}`,`assets/sounds/hit${e+1}.mp3`)})),this.load.image("logo","assets/images/logo.png"),this.load.audio("hymn","assets/sounds/hymn.mp3"),this.load.audio("music","assets/sounds/music.mp3"),this.load.audio("type","assets/sounds/type.mp3"),this.load.audio("shot","assets/sounds/shot.mp3"),this.load.audio("voice_start","assets/sounds/voice_start.mp3"),this.load.audio("voice_drop","assets/sounds/voice_drop.mp3"),this.load.audio("voice_hit","assets/sounds/voice_hit.mp3")}loadVideos(){Array(4).fill(0).forEach(((t,e)=>{this.load.video(`video${e}`,`./assets/videos/video${e}.mp4`,"loadeddata",!1,!0)}))}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(450954,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}},class extends fm{constructor(){super({key:"story"})}create(){this.game.sound.stopAll(),this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.utils=new _m(this),this.loadAudios(),this.showIntro(),this.cameras.main.setBackgroundColor(0),this.input.keyboard.on("keydown-SPACE",(()=>this.startGame()),this)}startGame(){this.utils.typeAudio&&this.utils.typeAudio.stop(),this.theme&&this.theme.stop(),this.scene.start("splash")}playMusic(t="hymn"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.7,rate:1,detune:0,seek:0,loop:!0,delay:0})}loadAudios(){this.audios={type:this.sound.add("type")}}playAudio(t){this.audios[t].play()}showIntro(){let t,e;t=this.utils.typeText(" IN 1968 YURI GAGARIN DIED\nDURING A ROUTINE FLIGHT","computer",this.center_width,this.center_height),this.time.delayedCall(5500,(()=>{e=this.utils.typeText(" OR SO THEY MADE US BELIEVE...","computer",this.center_width,this.center_height+100)}),null,this),this.time.delayedCall(7e3,(()=>this.playMusic()),null,this),this.time.delayedCall(1e4,(()=>{this.utils.removeTyped([t,e]),this.aGameBy()}),null,this)}aGameBy(){let t,e=this.utils.typeText(" A GAME BY\nPELLO","computer",1250,10),n=this.add.image(990,120,"pello_logo_old").setScale(.2).setOrigin(.5),i=this.add.video(400,300,"video0");this.time.delayedCall(5e3,(()=>{this.utils.removeTyped([e]),n.destroy(),t=this.utils.typeText(" MINIJAM #96\nFATE","computer",1250,400)}),null,this),this.time.delayedCall(9e3,(()=>{this.utils.removeTyped([t]),i.stop(),i.destroy(),this.tools()})),i.play(!0)}tools(){let t,e=this.utils.typeText(" TOOLS: PHASER AND ENABLE3D","computer",550,10),n=this.add.video(this.center_width,500,"video1").setOrigin(.5);this.time.delayedCall(5e3,(()=>{this.utils.removeTyped([e]),t=this.utils.typeText(" MY FIRST 3D GAME!","computer",550,50)}),null,this),this.time.delayedCall(9e3,(()=>{this.utils.removeTyped([t]),n.stop(),n.destroy(),this.otherTools()})),n.play(!0)}otherTools(){let t,e=this.utils.typeText(" VSCODE, GULP, BLENDER, FFMPEG,...","computer",550,500),n=this.add.video(this.center_width,100,"video2").setOrigin(.5);this.time.delayedCall(5e3,(()=>{this.utils.removeTyped([e]),t=this.utils.typeText(" GAZILLIONS OF COFFEE WERE CONSUMED","computer",550,600)}),null,this),this.time.delayedCall(1e4,(()=>{this.utils.removeTyped([t]),n.stop(),n.destroy(),this.lastVideo()})),n.play(!0)}lastVideo(){let t,e=this.utils.typeText(" MUSIC: SACRED WAR, BY THE RED ARMY CHOIR","computer",400,50),n=this.add.video(this.center_width,400,"video3").setOrigin(.5);this.time.delayedCall(5e3,(()=>{this.utils.removeTyped([e]),t=this.utils.typeText(" EVOLUTION, BY BENSOUND","computer",550,100)}),null,this),this.time.delayedCall(1e4,(()=>{this.utils.removeTyped([t]),n.stop(),n.destroy(),this.explanation()})),n.play(!0)}explanation(){this.tweens.add({targets:this.theme,volume:{from:1,to:0},duration:16e3}),this.utils.typeText(" GAGARIN WAS SENT ON A SECRET MISSION\nBEYOND THE OORT CLOUD, PROPELLED BY\nNUCLEAR DETONATIONS.\n\nHE HAS NOW PASSED THE FRONTIER OF\nOUR SOLAR SYSTEM\nHIS MISSION:\nTO SET 20 PROBES AND RECOLLECT DATA\nFROM THE DEADLIEST STELLAR OBJECT:\nA NEUTRINO STAR!\n\nHE HAS TO AVOID INCOMING DEBRIS\nAND GET AS CLOSE AS POSSIBLE TO THE STAR.\nTHAT WILL MEAN CERTAIN DEATH, BUT ALSO\nA MASSIVE ACHIEVEMENT FOR SOVIET SCIENTISTS!\n\nTHE FATAL FATE OF GAGARIN IS NOW TIED\nTO THE GLORIOUS FATE OF MOTHER RUSSIA...\n\n\nSPACE TO CONTINUE","computer",450,50)}},class extends fm{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.utils=new _m(this),this.showLogo(),this.showInstructions(),this.input.keyboard.on("keydown-SPACE",(()=>this.loadNext()),this),this.playMusic()}playMusic(t="music"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.5,rate:1,detune:0,seek:0,loop:!0,delay:0})}showLogo(){this.logo=this.add.image(this.center_width,170,"logo").setOrigin(.5).setScale(.7).setAlpha(0),this.tweens.add({targets:this.logo,duration:3e3,alpha:{from:0,to:1}})}showInstructions(){this.utils.typeText("ARROWS + W + S\nMOUSE FOR POV\n","computer",this.center_width+190,this.center_height),this.time.delayedCall(2e3,(()=>{this.utils.typeText(" PRESS SPACE","computer",this.center_width+190,this.center_height+100)}),null,this),this.time.delayedCall(4e3,(()=>{this.utils.typeText(" A GAME BY PELLO","computer",this.center_width+140,this.center_height+200),this.add.image(this.center_width,this.center_height+300,"pello_logo_old").setScale(.2).setOrigin(.5)}),null,this)}loadNext(){this.utils.typeAudio&&this.utils.typeAudio.stop(),this.scene.start("game")}},class extends fm{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null}init(t){this.accessThirdDimension({gravity:{x:0,y:0,z:0}}),this.third.load.preload("stars","assets/images/stars.png"),this.third.load.preload("nebulaset","assets/images/nebulaset.png")}create(){this.bulletHell=new bm,this.x=-500,this.third.warpSpeed("-ground","-grid","-sky","-light"),this.setLights(),this.createBottom(),this.third.camera.position.set(0,0,20),this.third.camera.lookAt(0,0,0),this.third.load.texture("nebulaset").then((t=>this.third.scene.background=t)),this.particles=[],this.waves=[],this.remaining=2e4,this.addWaveEvent=this.time.addEvent({delay:3e3,callback:this.addWave,callbackScope:this,loop:!0}),this.addClockEvent=this.time.addEvent({delay:50,callback:this.updateClock,callbackScope:this,loop:!0}),this.setCenters(),this.setLightning(),this.setNeutrinoStar(),this.loadAudios(),this.prepareShip(),this.setScores(),this.cursor=this.input.keyboard.createCursorKeys(),this.W=this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W),this.S=this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S),this.playAudio("voice_start")}setLightning(){this.lightsOut=this.add.rectangle(0,40,this.width,this.height+100,0).setOrigin(0),this.lightsOut.setAlpha(0),this.lightningEffect=this.add.rectangle(0,40,this.width,this.height+100,16777215).setOrigin(0),this.lightningEffect.setAlpha(0),this.lightning=new Mm(this)}setLights(){this.spot=this.third.lights.spotLight({color:"blue",angle:Math.PI/8}),this.directional=this.third.lights.directionalLight({intensity:.5}),this.directional.position.set(5,5,5),this.third.lights.hemisphereLight({intensity:.7}),this.directional.shadow.camera.top=4,this.directional.shadow.camera.bottom=-4,this.directional.shadow.camera.left=-4,this.directional.shadow.camera.right=4}setNeutrinoStar(){this.torus=this.addRing(0),this.proximity=0,this.star=this.third.add.sphere({name:"neutrinoStarBack",radius:22,x:0,y:14.5,z:-150},{lambert:{color:16777184,transparent:!0,opacity:.5}}),this.third.physics.add.existing(this.star),this.star.body.setCollisionFlags(2),this.starFront=this.third.add.sphere({name:"neutrinoStarBack",radius:17,x:0,y:12,z:-120},{lambert:{color:"black",transparent:!1}}),this.third.physics.add.existing(this.starFront),this.starFront.body.setCollisionFlags(2)}addRings(){this.rings=Array(20).fill(0).map(((t,e)=>{this.addRing(e)}))}addRing(t){let e=this.third.add.cylinder({x:0,y:12,z:-120,height:1,radiusSegments:200,radiusBottom:75*(t+1),radiusTop:75*(t+1)},{lambert:{color:16777184,transparent:!0,opacity:.8}});return e.rotation.set(.1,0,0),this.third.physics.add.existing(e,{shape:"hacd"}),e.body.setCollisionFlags(6),e}setCenters(){this.width=this.cameras.main.width,this.height=this.cameras.main.height,this.center_width=this.width/2,this.center_height=this.height/2}updateClock(){this.remaining<0?(this.remaining=2e4,this.releaseProbe()):this.nextDropText.setText("NEXT DROP: "+this.remaining),this.remaining-=50}createBottom(){this.third.load.texture("stars").then((t=>{t.wrapS=t.wrapT=1e3,t.offset.set(0,0),t.repeat.set(2,2),this.ground=this.third.physics.add.ground({width:2e3,height:2e3,y:-50},{phong:{map:t,transparent:!0}})}))}releaseProbe(){this.updateProbes(-1),this.tweens.add({targets:this.probesText,duration:400,alpha:{from:.5,to:1},repeat:5})}setScores(){this.deviationText=this.add.bitmapText(175,30,"computer","DEVIATION: "+this.registry.get("deviation"),30).setTint(237666).setOrigin(.5),this.nextDropText=this.add.bitmapText(this.center_width,30,"computer","NEXT DROP: "+this.remaining,30).setTint(237666).setOrigin(.5),this.probesText=this.add.bitmapText(this.width-150,30,"computer","PROBES: "+this.registry.get("probes"),30).setTint(237666).setOrigin(.5)}prepareShip(){this.third.load.gltf("./assets/objects/ship.glb").then((t=>{this.object=new Qh,this.object.add(t.scene);const e=this.third.add.material({standard:{color:13369344,transparent:!1,opacity:1}});this.object.traverse((t=>{t.isMesh&&t.material.isMaterial&&(t.material=e)})),this.ship=this.createShip("convexMesh",0,this.object),this.setShipColliderWithParticles()}))}createShip(t,e,n){this.left=!1;const i=new Qh;i.add(n.clone()),i.position.set(e,-2,10),i.rotation.set(0,Math.PI,0);let r={addChildren:!1,shape:t};return this.third.add.existing(i),this.third.physics.add.existing(i,r),i.body.needUpdate=!0,i.body.setLinearFactor(0,0,0),i.body.setAngularFactor(1,1,0),i.body.setFriction(20,20,20),i.body.setCollisionFlags(2),i}setShipColliderWithParticles(){this.ship.body.on.collision(((t,e)=>{/particle/.test(t.name)&&(this.updateDeviation(1),this.cameras.main.shake(500),this.playAudio(`hit${Phaser.Math.Between(1,4)}`),this.third.destroy(this.ship),this.ship=this.createShip("convexMesh",0,this.object),this.setShipColliderWithParticles())}))}loadAudios(){this.audios={thunder0:this.sound.add("thunder0"),thunder1:this.sound.add("thunder1"),thunder2:this.sound.add("thunder2"),thunder3:this.sound.add("thunder3"),passby0:this.sound.add("passby0"),passby1:this.sound.add("passby1"),shot:this.sound.add("shot"),hit1:this.sound.add("hit1"),hit2:this.sound.add("hit2"),hit3:this.sound.add("hit3"),hit4:this.sound.add("hit4"),voice_start:this.sound.add("voice_start"),voice_drop:this.sound.add("voice_drop"),voice_hit:this.sound.add("voice_hit")}}playAudio(t){this.audios[t].play()}playRandom(t){this.audios[t].play({rate:Phaser.Math.Between(1,1.5),detune:Phaser.Math.Between(-1e3,1e3),delay:0})}update(t,e){if(this.currentTime=t,this.ship&&this.ship.body){let{x:t,y:e,z:n}=this.ship.position;this.cursor.up.isDown&&this.ship.position.y<6/(n/5)?(e+=.1,this.createWingTrails()):this.cursor.down.isDown&&this.ship.position.y>-7/(n/5)&&(e-=.1,this.createWingTrails()),this.cursor.left.isDown&&this.ship.position.x>-7/(n/6)?(t-=.1,this.ship.rotation.set(0,Math.PI,-.2),this.createWingTrails(!0)):this.cursor.right.isDown&&this.ship.position.x<7/(n/6)&&(t+=.1,this.ship.rotation.set(0,Math.PI,.2),this.createWingTrails(!1)),this.cursor.right.isDown||this.cursor.left.isDown||this.ship.rotation.set(0,Math.PI,0),this.W.isDown&&this.ship.position.z>7?(this.ship.position.set(t,e,n-.1),n-=.1):this.S.isDown&&this.ship.position.z<15&&(this.ship.position.set(t,e,n+.1),n+=.1),this.ship.position.set(t,e,n),this.ship.body.needUpdate=!0,this.createTrail()}if(this.ground&&this.ground.setRotationFromEuler(new cn(0,0,1)),this.star){this.star.material.opacity=.5/Math.sin(3*t);let n=Math.sin(t)/10;this.starFront.position.set(this.starFront.position.x+n,this.starFront.position.y+n,this.starFront.position.z+n+this.proximity),this.starFront.rotation.set(0,t,0),this.starFront.body.needUpdate=!0,this.star.position.set(this.star.position.x+n,this.star.position.y+n,this.star.position.z+n+this.proximity),this.star.body.needUpdate=!0,this.proximity+=1e-6,this.torus.rotation.set(.1,e,0),this.torus.position.set(this.torus.position.x,this.torus.position.y,this.star.position.z+this.proximity),this.torus.body.needUpdate=!0}}createTrail(){const t=Phaser.Math.Between(-1,1)>0?11393254:16777215,e=this.third.add.box({x:this.ship.position.x,y:this.ship.position.y+.3,z:this.ship.position.z+1,width:.2,height:.2,depth:.2},{lambert:{color:t,transparent:!0,opacity:.4}});this.third.physics.add.existing(e),e.body.setVelocityZ(15),this.tweens.add({targets:e.scale,duration:600,scale:{from:1,to:0},repeat:1,onComplete:()=>{this.destroyParticle(e)}})}createWingTrails(t=null){const e=Phaser.Math.Between(-1,1)>0?11393254:16777215,[n,i]=null===t?[0,0]:t?[-.3,.3]:[.3,-.3],r=this.third.add.box({x:this.ship.position.x+1.3,y:this.ship.position.y+.5+i,z:this.ship.position.z+.5,width:.05,height:.05,depth:.05},{lambert:{color:e,transparent:!0,opacity:.4}}),s=this.third.add.box({x:this.ship.position.x-1.3,y:this.ship.position.y+.5+n,z:this.ship.position.z+.5,width:.05,height:.05,depth:.05},{lambert:{color:e,transparent:!0,opacity:.4}});this.third.physics.add.existing(r),this.third.physics.add.existing(s),r.body.setVelocityZ(15),s.body.setVelocityZ(15),this.tweens.add({targets:[r.scale,s.scale],duration:600,scale:{from:1,to:0},repeat:1,onComplete:()=>{this.destroyParticle(r),this.destroyParticle(s)}})}addWave(t=-25,e=!1){this.lightning.lightning();const{f1:n,f2:i,c:r}=this.applyFunctionsInterval();for(let s=0;s{let o=t+i,l=r(o,16*i,s),c=this.third.add.sphere({name:"particle"+Math.random(),radius:.25,x:o,y:l,z:t-(e?o:0)},{lambert:{color:a}});return this.third.physics.add.existing(c),this.particles.push(c),c.body.setVelocityZ(15),c}));this.playAudio("shot"),this.waves.push(o),this.time.delayedCall(4e3,(()=>this.playRandom("passby"+Phaser.Math.Between(0,1))),null,this),this.time.delayedCall(6e3,(()=>this.removeWave()),null,this)}}applyFunctionsInterval(){return{20:{f1:0,f2:3,c:3},19:{f1:0,f2:4,c:3},18:{f1:0,f2:3,c:4},17:{f1:0,f2:3,c:5},16:{f1:0,f2:3,c:6},15:{f1:0,f2:3,c:6},14:{f1:0,f2:3,c:6},13:{f1:0,f2:3,c:6},12:{f1:0,f2:4,c:4},11:{f1:0,f2:4,c:4},10:{f1:0,f2:4,c:4},9:{f1:0,f2:4,c:5},8:{f1:0,f2:4,c:5},7:{f1:0,f2:5,c:4},6:{f1:0,f2:5,c:5},5:{f1:0,f2:5,c:5},4:{f1:0,f2:5,c:6},3:{f1:0,f2:6,c:5},2:{f1:0,f2:6,c:5},1:{f1:0,f2:6,c:6},0:{f1:0,f2:6,c:6}}[this.registry.get("probes")]}removeWave(){this.waves.shift().forEach((t=>this.destroyParticle(t)))}destroyParticle(t){t.userData.dead=!0,t.visible=!1,this.third.physics.destroy(t),t=null}finishScene(t="outro"){this.scene.start(t)}updateDeviation(t=0){const e=+this.registry.get("deviation")+t;this.registry.set("deviation",e),this.playAudio("voice_hit"),this.deviationText.setText("DEVIATION: "+Number(e).toLocaleString()),10===e&&this.finishScene("game_over")}updateProbes(t=0){const e=+this.registry.get("probes")+t;this.registry.set("probes",e),this.playAudio("voice_drop"),this.probesText.setText("PROBES: "+Number(e).toLocaleString()),0===e&&this.finishScene("outro")}},ym,xm],...((t={})=>{const{antialias:e=!0,parent:n,canvasId:i="enable3d-phaser-canvas"}=t,r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.id=i;const s=n?document.getElementById(n):document.body;s?s.appendChild(r):Hh(`Parent "${n}" not found!`);const a={antialias:e},o={alpha:void 0===a.alpha||a.alpha,depth:void 0===a.depth||a.depth,stencil:void 0===a.stencil||a.stencil,antialias:void 0!==a.antialias&&a.antialias,premultipliedAlpha:void 0===a.premultipliedAlpha||a.premultipliedAlpha,preserveDrawingBuffer:void 0!==a.preserveDrawingBuffer&&a.preserveDrawingBuffer,powerPreference:void 0!==a.powerPreference?a.powerPreference:"default",failIfMajorPerformanceCaveat:void 0!==a.failIfMajorPerformanceCaveat&&a.failIfMajorPerformanceCaveat,xrCompatible:!0},l=(()=>{try{const t=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!t.getContext("webgl2"))}catch(Sm){return!1}})()?"webgl2":"webgl",c=r.getContext(l,o);return{canvas:r,context:c}})()};window.addEventListener("load",(()=>{gm((()=>new e.Game(wm))).withPhysics("./assets/ammo")})); +import{c as t,p as e}from"./phaser-YLX_gXuc.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const n of t)if("childList"===n.type)for(const t of n.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();const n="156",i=1,r=2,s=3,a=0,o=1,l=2,c=100,h=101,u=102,d=200,p=201,m=202,f=203,g=204,v=205,y=206,x=207,_=208,b=209,M=210,w=0,S=1,T=2,A=0,E=1,R=2,C=3,P=4,L=5,I=301,N=302,O=303,D=304,U=306,B=1e3,F=1001,k=1002,z=1003,V=1004,H=1005,G=1006,W=1007,j=1008,X=1009,q=1012,Y=1014,K=1015,J=1016,Z=1020,$=1023,Q=1026,tt=1027,et=33776,nt=33777,it=33778,rt=33779,st=36492,at=2300,ot=2301,lt=2302,ct=2400,ht=2401,ut=2402,dt=3001,pt="srgb",mt="srgb-linear",ft="display-p3",gt=7680,vt=512,yt=513,xt=514,_t=515,bt=516,Mt=517,wt=518,St=519,Tt=35044,At="300 es",Et=1035,Rt=2e3,Ct=2001;class Pt{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e>8&255]+Lt[t>>16&255]+Lt[t>>24&255]+"-"+Lt[255&e]+Lt[e>>8&255]+"-"+Lt[e>>16&15|64]+Lt[e>>24&255]+"-"+Lt[63&n|128]+Lt[n>>8&255]+"-"+Lt[n>>16&255]+Lt[n>>24&255]+Lt[255&i]+Lt[i>>8&255]+Lt[i>>16&255]+Lt[i>>24&255]).toLowerCase()}function Dt(t,e,n){return Math.max(e,Math.min(n,t))}function Ut(t,e){return(t%e+e)%e}function Bt(t,e,n){return(1-n)*t+n*e}function Ft(t){return!(t&t-1)&&0!==t}function kt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function zt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Vt(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Ht(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Gt=It,Wt=function(t){return t*It},jt=function(t){return t*Nt};class Xt{constructor(t=0,e=0){Xt.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Dt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class qt{constructor(t,e,n,i,r,s,a,o,l){qt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,a,o,l)}set(t,e,n,i,r,s,a,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=a,c[3]=e,c[4]=r,c[5]=o,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],m=i[0],f=i[3],g=i[6],v=i[1],y=i[4],x=i[7],_=i[2],b=i[5],M=i[8];return r[0]=s*m+a*v+o*_,r[3]=s*f+a*y+o*b,r[6]=s*g+a*x+o*M,r[1]=l*m+c*v+h*_,r[4]=l*f+c*y+h*b,r[7]=l*g+c*x+h*M,r[2]=u*m+d*v+p*_,r[5]=u*f+d*y+p*b,r[8]=u*g+d*x+p*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-n*r*c+n*a*o+i*r*l-i*s*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=h*m,t[1]=(i*l-c*n)*m,t[2]=(a*n-i*s)*m,t[3]=u*m,t[4]=(c*e-i*o)*m,t[5]=(i*r-a*e)*m,t[6]=d*m,t[7]=(n*o-l*e)*m,t[8]=(s*e-n*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+t,-i*l,i*o,-i*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Yt.makeScale(t,e)),this}rotate(t){return this.premultiply(Yt.makeRotation(-t)),this}translate(t,e){return this.premultiply(Yt.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const Yt=new qt;function Kt(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Jt={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Zt(t,e){return new Jt[t](e)}function $t(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Qt(){const t=$t("canvas");return t.style.display="block",t}const te={};function ee(t){t in te||(te[t]=!0,console.warn(t))}function ne(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ie(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const re=(new qt).fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),se=(new qt).fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]),ae={[mt]:t=>t,[pt]:t=>t.convertSRGBToLinear(),[ft]:function(t){return t.convertSRGBToLinear().applyMatrix3(se)}},oe={[mt]:t=>t,[pt]:t=>t.convertLinearToSRGB(),[ft]:function(t){return t.applyMatrix3(re).convertLinearToSRGB()}},le={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return mt},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(!1===this.enabled||e===n||!e||!n)return t;const i=ae[e],r=oe[n];if(void 0===i||void 0===r)throw new Error(`Unsupported color space conversion, "${e}" to "${n}".`);return r(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}};let ce;class he{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===ce&&(ce=$t("canvas")),ce.width=t.width,ce.height=t.height;const n=ce.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=ce}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=$t("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case B:t.x=t.x-Math.floor(t.x);break;case F:t.x=t.x<0?0:1;break;case k:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case B:t.y=t.y-Math.floor(t.y);break;case F:t.y=t.y<0?0:1;break;case k:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return ee("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===pt?dt:3e3}set encoding(t){ee("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===dt?pt:""}}fe.DEFAULT_IMAGE=null,fe.DEFAULT_MAPPING=300,fe.DEFAULT_ANISOTROPY=1;class ge{constructor(t=0,e=0,n=0,i=1){ge.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const s=.01,a=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],p=o[9],m=o[2],f=o[6],g=o[10];if(Math.abs(c-u)o&&t>v?tv?o=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+m*r,t===1-a){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-a*d,t[e+2]=l*p+c*d+a*u-o*h,t[e+3]=c*p-a*h-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){const n=t._x,i=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(n/2),c=a(i/2),h=a(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=n+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(s-i)*t}else if(n>a&&n>h){const t=2*Math.sqrt(1+n-a-h);this._w=(c-o)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-n-a);this._w=(s-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Dt(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+s*a+i*l-r*o,this._y=i*c+s*o+r*a-n*l,this._z=r*c+s*l+n*o-i*a,this._w=s*c-n*a-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),c=Math.atan2(l,a),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Me{constructor(t=0,e=0,n=0){Me.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Se.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Se.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,s=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=o*e+s*i-a*n,c=o*n+a*e-r*i,h=o*i+r*n-s*e,u=-r*e-s*n-a*i;return this.x=l*o+u*-r+c*-a-h*-s,this.y=c*o+u*-s+h*-r-l*-a,this.z=h*o+u*-a+l*-s-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return we.copy(this).projectOnVector(t),this.sub(we)}reflect(t){return this.sub(we.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Dt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const we=new Me,Se=new be;class Te{constructor(t=new Me(1/0,1/0,1/0),e=new Me(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Ee),Ee.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(De),Ue.subVectors(this.max,De),Ce.subVectors(t.a,De),Pe.subVectors(t.b,De),Le.subVectors(t.c,De),Ie.subVectors(Pe,Ce),Ne.subVectors(Le,Pe),Oe.subVectors(Ce,Le);let e=[0,-Ie.z,Ie.y,0,-Ne.z,Ne.y,0,-Oe.z,Oe.y,Ie.z,0,-Ie.x,Ne.z,0,-Ne.x,Oe.z,0,-Oe.x,-Ie.y,Ie.x,0,-Ne.y,Ne.x,0,-Oe.y,Oe.x,0];return!!ke(e,Ce,Pe,Le,Ue)&&(e=[1,0,0,0,1,0,0,0,1],!!ke(e,Ce,Pe,Le,Ue)&&(Be.crossVectors(Ie,Ne),e=[Be.x,Be.y,Be.z],ke(e,Ce,Pe,Le,Ue)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Ee).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Ee).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ae[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ae[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ae[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ae[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ae[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ae[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ae[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ae[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ae)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Ae=[new Me,new Me,new Me,new Me,new Me,new Me,new Me,new Me],Ee=new Me,Re=new Te,Ce=new Me,Pe=new Me,Le=new Me,Ie=new Me,Ne=new Me,Oe=new Me,De=new Me,Ue=new Me,Be=new Me,Fe=new Me;function ke(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){Fe.fromArray(t,s);const a=r.x*Math.abs(Fe.x)+r.y*Math.abs(Fe.y)+r.z*Math.abs(Fe.z),o=e.dot(Fe),l=n.dot(Fe),c=i.dot(Fe);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const ze=new Te,Ve=new Me,He=new Me;class Ge{constructor(t=new Me,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):ze.setFromPoints(t).getCenter(n);let i=0;for(let r=0,s=t.length;rthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Ve.subVectors(t,this.center);const e=Ve.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(Ve,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(He.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ve.copy(t.center).add(He)),this.expandByPoint(Ve.copy(t.center).sub(He))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const We=new Me,je=new Me,Xe=new Me,qe=new Me,Ye=new Me,Ke=new Me,Je=new Me;class Ze{constructor(t=new Me,e=new Me(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,We)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=We.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(We.copy(this.origin).addScaledVector(this.direction,e),We.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){je.copy(t).add(e).multiplyScalar(.5),Xe.copy(e).sub(t).normalize(),qe.copy(this.origin).sub(je);const r=.5*t.distanceTo(e),s=-this.direction.dot(Xe),a=qe.dot(this.direction),o=-qe.dot(Xe),l=qe.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*o-a,u=s*a-o,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*a)+u*(s*h+u+2*o)+l}else u=r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u<=-p?(h=Math.max(0,-(-s*r+a)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(s*r+a)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(je).addScaledVector(Xe,u),d}intersectSphere(t,e){We.subVectors(t.center,this.origin);const n=We.dot(this.direction),i=We.dot(We)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,a,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s=0?(a=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,We)}intersectTriangle(t,e,n,i,r){Ye.subVectors(e,t),Ke.subVectors(n,t),Je.crossVectors(Ye,Ke);let s,a=this.direction.dot(Je);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}qe.subVectors(this.origin,t);const o=s*this.direction.dot(Ke.crossVectors(qe,Ke));if(o<0)return null;const l=s*this.direction.dot(Ye.cross(qe));if(l<0)return null;if(o+l>a)return null;const c=-s*qe.dot(Je);return c<0?null:this.at(c/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class $e{constructor(t,e,n,i,r,s,a,o,l,c,h,u,d,p,m,f){$e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,m,f)}set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new $e).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Qe.setFromMatrixColumn(t,0).length(),r=1/Qe.setFromMatrixColumn(t,1).length(),s=1/Qe.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*a,e[4]=-s*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=s*c,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(en,t,nn)}lookAt(t,e,n){const i=this.elements;return an.subVectors(t,e),0===an.lengthSq()&&(an.z=1),an.normalize(),rn.crossVectors(n,an),0===rn.lengthSq()&&(1===Math.abs(n.z)?an.x+=1e-4:an.z+=1e-4,an.normalize(),rn.crossVectors(n,an)),rn.normalize(),sn.crossVectors(an,rn),i[0]=rn.x,i[4]=sn.x,i[8]=an.x,i[1]=rn.y,i[5]=sn.y,i[9]=an.y,i[2]=rn.z,i[6]=sn.z,i[10]=an.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],y=n[7],x=n[11],_=n[15],b=i[0],M=i[4],w=i[8],S=i[12],T=i[1],A=i[5],E=i[9],R=i[13],C=i[2],P=i[6],L=i[10],I=i[14],N=i[3],O=i[7],D=i[11],U=i[15];return r[0]=s*b+a*T+o*C+l*N,r[4]=s*M+a*A+o*P+l*O,r[8]=s*w+a*E+o*L+l*D,r[12]=s*S+a*R+o*I+l*U,r[1]=c*b+h*T+u*C+d*N,r[5]=c*M+h*A+u*P+d*O,r[9]=c*w+h*E+u*L+d*D,r[13]=c*S+h*R+u*I+d*U,r[2]=p*b+m*T+f*C+g*N,r[6]=p*M+m*A+f*P+g*O,r[10]=p*w+m*E+f*L+g*D,r[14]=p*S+m*R+f*I+g*U,r[3]=v*b+y*T+x*C+_*N,r[7]=v*M+y*A+x*P+_*O,r[11]=v*w+y*E+x*L+_*D,r[15]=v*S+y*R+x*I+_*U,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*l*h-r*a*u+n*l*u+i*a*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*s*u-i*s*d+i*l*c-r*o*c)+t[11]*(+e*l*h-e*a*d-r*s*h+n*s*d+r*a*c-n*l*c)+t[15]*(-i*a*c-e*o*h+e*a*u+i*s*h-n*s*u+n*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],m=t[13],f=t[14],g=t[15],v=h*f*l-m*u*l+m*o*d-a*f*d-h*o*g+a*u*g,y=p*u*l-c*f*l-p*o*d+s*f*d+c*o*g-s*u*g,x=c*m*l-p*h*l+p*a*d-s*m*d-c*a*g+s*h*g,_=p*h*o-c*m*o-p*a*u+s*m*u+c*a*f-s*h*f,b=e*v+n*y+i*x+r*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/b;return t[0]=v*M,t[1]=(m*u*r-h*f*r-m*i*d+n*f*d+h*i*g-n*u*g)*M,t[2]=(a*f*r-m*o*r+m*i*l-n*f*l-a*i*g+n*o*g)*M,t[3]=(h*o*r-a*u*r-h*i*l+n*u*l+a*i*d-n*o*d)*M,t[4]=y*M,t[5]=(c*f*r-p*u*r+p*i*d-e*f*d-c*i*g+e*u*g)*M,t[6]=(p*o*r-s*f*r-p*i*l+e*f*l+s*i*g-e*o*g)*M,t[7]=(s*u*r-c*o*r+c*i*l-e*u*l-s*i*d+e*o*d)*M,t[8]=x*M,t[9]=(p*h*r-c*m*r-p*n*d+e*m*d+c*n*g-e*h*g)*M,t[10]=(s*m*r-p*a*r+p*n*l-e*m*l-s*n*g+e*a*g)*M,t[11]=(c*a*r-s*h*r-c*n*l+e*h*l+s*n*d-e*a*d)*M,t[12]=_*M,t[13]=(c*m*i-p*h*i+p*n*u-e*m*u-c*n*f+e*h*f)*M,t[14]=(p*a*i-s*m*i-p*n*o+e*m*o+s*n*f-e*a*f)*M,t[15]=(s*h*i-c*a*i+c*n*o-e*h*o-s*n*u+e*a*u)*M,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*s,0,l*o-i*a,c*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,u=r*l,d=r*c,p=r*h,m=s*c,f=s*h,g=a*h,v=o*l,y=o*c,x=o*h,_=n.x,b=n.y,M=n.z;return i[0]=(1-(m+g))*_,i[1]=(d+x)*_,i[2]=(p-y)*_,i[3]=0,i[4]=(d-x)*b,i[5]=(1-(u+g))*b,i[6]=(f+v)*b,i[7]=0,i[8]=(p+y)*M,i[9]=(f-v)*M,i[10]=(1-(u+m))*M,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Qe.set(i[0],i[1],i[2]).length();const s=Qe.set(i[4],i[5],i[6]).length(),a=Qe.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],tn.copy(this);const o=1/r,l=1/s,c=1/a;return tn.elements[0]*=o,tn.elements[1]*=o,tn.elements[2]*=o,tn.elements[4]*=l,tn.elements[5]*=l,tn.elements[6]*=l,tn.elements[8]*=c,tn.elements[9]*=c,tn.elements[10]*=c,e.setFromRotationMatrix(tn),n.x=r,n.y=s,n.z=a,this}makePerspective(t,e,n,i,r,s,a=2e3){const o=this.elements,l=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i);let d,p;if(a===Rt)d=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(a!==Ct)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-s/(s-r),p=-s*r/(s-r)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,i,r,s,a=2e3){const o=this.elements,l=1/(e-t),c=1/(n-i),h=1/(s-r),u=(e+t)*l,d=(n+i)*c;let p,m;if(a===Rt)p=(s+r)*h,m=-2*h;else{if(a!==Ct)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=r*h,m=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=m,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Qe=new Me,tn=new $e,en=new Me(0,0,0),nn=new Me(1,1,1),rn=new Me,sn=new Me,an=new Me,on=new $e,ln=new be;class cn{constructor(t=0,e=0,n=0,i=cn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],a=i[8],o=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(Dt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Dt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Dt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Dt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Dt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Dt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return on.makeRotationFromQuaternion(t),this.setFromRotationMatrix(on,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ln.setFromEuler(this),this.setFromQuaternion(ln,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}cn.DEFAULT_ORDER="XYZ";class hn{constructor(){this.mask=1}set(t){this.mask=1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(n=n.concat(r))}return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gn,t,vn),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gn,yn,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Tn.subVectors(i,e),An.subVectors(n,e),En.subVectors(t,e);const s=Tn.dot(Tn),a=Tn.dot(An),o=Tn.dot(En),l=An.dot(An),c=An.dot(En),h=s*l-a*a;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*o-a*c)*u,p=(s*c-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Rn),Rn.x>=0&&Rn.y>=0&&Rn.x+Rn.y<=1}static getUV(t,e,n,i,r,s,a,o){return!1===Dn&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Dn=!0),this.getInterpolation(t,e,n,i,r,s,a,o)}static getInterpolation(t,e,n,i,r,s,a,o){return this.getBarycoord(t,e,n,i,Rn),o.setScalar(0),o.addScaledVector(r,Rn.x),o.addScaledVector(s,Rn.y),o.addScaledVector(a,Rn.z),o}static isFrontFacing(t,e,n,i){return Tn.subVectors(n,e),An.subVectors(t,e),Tn.cross(An).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Tn.subVectors(this.c,this.b),An.subVectors(this.a,this.b),.5*Tn.cross(An).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Un.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Un.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return!1===Dn&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Dn=!0),Un.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}getInterpolation(t,e,n,i,r){return Un.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return Un.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Un.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,a;Cn.subVectors(i,n),Pn.subVectors(r,n),In.subVectors(t,n);const o=Cn.dot(In),l=Pn.dot(In);if(o<=0&&l<=0)return e.copy(n);Nn.subVectors(t,i);const c=Cn.dot(Nn),h=Pn.dot(Nn);if(c>=0&&h<=c)return e.copy(i);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return s=o/(o-c),e.copy(n).addScaledVector(Cn,s);On.subVectors(t,r);const d=Cn.dot(On),p=Pn.dot(On);if(p>=0&&d<=p)return e.copy(r);const m=d*l-o*p;if(m<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(n).addScaledVector(Pn,a);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return Ln.subVectors(r,i),a=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(Ln,a);const g=1/(f+m+u);return s=m*g,a=u*g,e.copy(n).addScaledVector(Cn,s).addScaledVector(Pn,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Bn=0;class Fn extends Pt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Bn++}),this.uuid=Ot(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=c,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=gt,this.stencilZFail=gt,this.stencilZPass=gt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=this.alphaHash),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}const kn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},zn={h:0,s:0,l:0},Vn={h:0,s:0,l:0};function Hn(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}class Gn{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=pt){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,le.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=le.workingColorSpace){return this.r=t,this.g=e,this.b=n,le.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=le.workingColorSpace){if(t=Ut(t,1),e=Dt(e,0,1),n=Dt(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=Hn(r,i,t+1/3),this.g=Hn(r,i,t),this.b=Hn(r,i,t-1/3)}return le.toWorkingColorSpace(this,i),this}setStyle(t,e=pt){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(n,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=pt){const n=kn[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ne(t.r),this.g=ne(t.g),this.b=ne(t.b),this}copyLinearToSRGB(t){return this.r=ie(t.r),this.g=ie(t.g),this.b=ie(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=pt){return le.fromWorkingColorSpace(Wn.copy(this),t),65536*Math.round(Dt(255*Wn.r,0,255))+256*Math.round(Dt(255*Wn.g,0,255))+Math.round(Dt(255*Wn.b,0,255))}getHexString(t=pt){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=le.workingColorSpace){le.fromWorkingColorSpace(Wn.copy(this),e);const n=Wn.r,i=Wn.g,r=Wn.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let o,l;const c=(a+s)/2;if(a===s)o=0,l=0;else{const t=s-a;switch(l=c<=.5?t/(s+a):t/(2-s-a),s){case n:o=(i-r)/t+(i0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const o in n){const e=n[o];t.data.attributes[o]=e.toJSON(t.data)}const i={};let r=!1;for(const o in this.morphAttributes){const e=this.morphAttributes[o],n=[];for(let i=0,r=e.length;i0&&(i[o]=n,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const l in i){const t=i[l];this.setAttribute(l,t.clone(e))}const r=t.morphAttributes;for(const l in r){const t=[],n=r[l];for(let i=0,r=n.length;i0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t(t.far-t.near)**2)return}ai.copy(r).invert(),oi.copy(t.ray).applyMatrix4(ai),null!==n.boundingBox&&!1===oi.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,oi)}}_computeIntersections(t,e,n){let i;const r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(s))for(let p=0,m=u.length;pn.far?null:{distance:c,point:Mi.clone(),object:t}}(t,e,n,i,hi,ui,di,bi);if(h){r&&(fi.fromBufferAttribute(r,o),gi.fromBufferAttribute(r,l),vi.fromBufferAttribute(r,c),h.uv=Un.getInterpolation(bi,hi,ui,di,fi,gi,vi,new Xt)),s&&(fi.fromBufferAttribute(s,o),gi.fromBufferAttribute(s,l),vi.fromBufferAttribute(s,c),h.uv1=Un.getInterpolation(bi,hi,ui,di,fi,gi,vi,new Xt),h.uv2=h.uv1),a&&(yi.fromBufferAttribute(a,o),xi.fromBufferAttribute(a,l),_i.fromBufferAttribute(a,c),h.normal=Un.getInterpolation(bi,hi,ui,di,yi,xi,_i,new Me),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const t={a:o,b:l,c:c,normal:new Me,materialIndex:0};Un.getNormal(hi,ui,di,t.normal),h.face=t}return h}class Ti extends si{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,m,f,g,v){const y=s/f,x=p/g,_=s/2,b=p/2,M=m/2,w=f+1,S=g+1;let T=0,A=0;const E=new Me;for(let a=0;a0?1:-1,c.push(E.x,E.y,E.z),h.push(o/f),h.push(1-a/g),T+=1}}for(let a=0;a0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const i in this.extensions)!0===this.extensions[i]&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class Li extends Sn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new $e,this.projectionMatrix=new $e,this.projectionMatrixInverse=new $e,this.coordinateSystem=Rt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}class Ii extends Li{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Nt*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*It*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Nt*Math.atan(Math.tan(.5*It*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*It*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Ni=-90;class Oi extends Sn{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null;const i=new Ii(Ni,1,t,e);i.layers=this.layers,this.add(i);const r=new Ii(Ni,1,t,e);r.layers=this.layers,this.add(r);const s=new Ii(Ni,1,t,e);s.layers=this.layers,this.add(s);const a=new Ii(Ni,1,t,e);a.layers=this.layers,this.add(a);const o=new Ii(Ni,1,t,e);o.layers=this.layers,this.add(o);const l=new Ii(Ni,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,s,a,o]=e;for(const l of e)this.remove(l);if(t===Rt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==Ct)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const l of e)this.add(l),l.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[i,r,s,a,o,l]=this.children,c=t.getRenderTarget(),h=t.xr.enabled;t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,a),t.setRenderTarget(n,4),t.render(e,o),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(c),t.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}class Di extends fe{constructor(t,e,n,i,r,s,a,o,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:I,n,i,r,s,a,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Ui extends ye{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];void 0!==e.encoding&&(ee("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),e.colorSpace=e.encoding===dt?pt:""),this.texture=new Di(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:G}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new Ti(5,5,5),a=new Pi({name:"CubemapFromEquirect",uniforms:Ai(n),vertexShader:i,fragmentShader:r,side:1,blending:0});a.uniforms.tEquirect.value=e;const o=new wi(s,a),l=e.minFilter;return e.minFilter===j&&(e.minFilter=G),new Oi(1,10,this).update(t,o),e.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,n,i);t.setRenderTarget(r)}}const Bi=new Me,Fi=new Me,ki=new qt;let zi=class{constructor(t=new Me(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Bi.subVectors(n,e).cross(Fi.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Bi),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||ki.getNormalMatrix(t),i=this.coplanarPoint(Bi).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}};const Vi=new Ge,Hi=new Me;class Gi{constructor(t=new zi,e=new zi,n=new zi,i=new zi,r=new zi,s=new zi){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=2e3){const n=this.planes,i=t.elements,r=i[0],s=i[1],a=i[2],o=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],m=i[10],f=i[11],g=i[12],v=i[13],y=i[14],x=i[15];if(n[0].setComponents(o-r,u-l,f-d,x-g).normalize(),n[1].setComponents(o+r,u+l,f+d,x+g).normalize(),n[2].setComponents(o+s,u+c,f+p,x+v).normalize(),n[3].setComponents(o-s,u-c,f-p,x-v).normalize(),n[4].setComponents(o-a,u-h,f-m,x-y).normalize(),e===Rt)n[5].setComponents(o+a,u+h,f+m,x+y).normalize();else{if(e!==Ct)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(a,h,m,y).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Vi.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Vi.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Vi)}intersectsSprite(t){return Vi.center.set(0,0,0),Vi.radius=.7071067811865476,Vi.applyMatrix4(t.matrixWorld),this.intersectsSphere(Vi)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(n)0?t.max.x:t.min.x,Hi.y=i.normal.y>0?t.max.y:t.min.y,Hi.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Hi)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Wi(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function ji(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Yi={common:{diffuse:{value:new Gn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qt},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qt},normalScale:{value:new Xt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Gn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Gn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0},uvTransform:{value:new qt}},sprite:{diffuse:{value:new Gn(16777215)},opacity:{value:1},center:{value:new Xt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qt},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0}}},Ki={basic:{uniforms:Ei([Yi.common,Yi.specularmap,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.fog]),vertexShader:qi.meshbasic_vert,fragmentShader:qi.meshbasic_frag},lambert:{uniforms:Ei([Yi.common,Yi.specularmap,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.fog,Yi.lights,{emissive:{value:new Gn(0)}}]),vertexShader:qi.meshlambert_vert,fragmentShader:qi.meshlambert_frag},phong:{uniforms:Ei([Yi.common,Yi.specularmap,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.fog,Yi.lights,{emissive:{value:new Gn(0)},specular:{value:new Gn(1118481)},shininess:{value:30}}]),vertexShader:qi.meshphong_vert,fragmentShader:qi.meshphong_frag},standard:{uniforms:Ei([Yi.common,Yi.envmap,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.roughnessmap,Yi.metalnessmap,Yi.fog,Yi.lights,{emissive:{value:new Gn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:qi.meshphysical_vert,fragmentShader:qi.meshphysical_frag},toon:{uniforms:Ei([Yi.common,Yi.aomap,Yi.lightmap,Yi.emissivemap,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.gradientmap,Yi.fog,Yi.lights,{emissive:{value:new Gn(0)}}]),vertexShader:qi.meshtoon_vert,fragmentShader:qi.meshtoon_frag},matcap:{uniforms:Ei([Yi.common,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,Yi.fog,{matcap:{value:null}}]),vertexShader:qi.meshmatcap_vert,fragmentShader:qi.meshmatcap_frag},points:{uniforms:Ei([Yi.points,Yi.fog]),vertexShader:qi.points_vert,fragmentShader:qi.points_frag},dashed:{uniforms:Ei([Yi.common,Yi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qi.linedashed_vert,fragmentShader:qi.linedashed_frag},depth:{uniforms:Ei([Yi.common,Yi.displacementmap]),vertexShader:qi.depth_vert,fragmentShader:qi.depth_frag},normal:{uniforms:Ei([Yi.common,Yi.bumpmap,Yi.normalmap,Yi.displacementmap,{opacity:{value:1}}]),vertexShader:qi.meshnormal_vert,fragmentShader:qi.meshnormal_frag},sprite:{uniforms:Ei([Yi.sprite,Yi.fog]),vertexShader:qi.sprite_vert,fragmentShader:qi.sprite_frag},background:{uniforms:{uvTransform:{value:new qt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:qi.background_vert,fragmentShader:qi.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:qi.backgroundCube_vert,fragmentShader:qi.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:qi.cube_vert,fragmentShader:qi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qi.equirect_vert,fragmentShader:qi.equirect_frag},distanceRGBA:{uniforms:Ei([Yi.common,Yi.displacementmap,{referencePosition:{value:new Me},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qi.distanceRGBA_vert,fragmentShader:qi.distanceRGBA_frag},shadow:{uniforms:Ei([Yi.lights,Yi.fog,{color:{value:new Gn(0)},opacity:{value:1}}]),vertexShader:qi.shadow_vert,fragmentShader:qi.shadow_frag}};Ki.physical={uniforms:Ei([Ki.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qt},clearcoatNormalScale:{value:new Xt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qt},sheen:{value:0},sheenColor:{value:new Gn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qt},transmissionSamplerSize:{value:new Xt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qt},attenuationDistance:{value:0},attenuationColor:{value:new Gn(0)},specularColor:{value:new Gn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qt},anisotropyVector:{value:new Xt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qt}}]),vertexShader:qi.meshphysical_vert,fragmentShader:qi.meshphysical_frag};const Ji={r:0,b:0,g:0};function Zi(t,e,n,i,r,s,a){const o=new Gn(0);let l,c,h=!0===s?0:1,u=null,d=0,p=null;function m(e,n){e.getRGB(Ji,Ri(t)),i.buffers.color.setClear(Ji.r,Ji.g,Ji.b,n,a)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),h=e,m(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,m(o,h)},render:function(s,f){let g=!1,v=!0===f.isScene?f.background:null;v&&v.isTexture&&(v=(f.backgroundBlurriness>0?n:e).get(v)),null===v?m(o,h):v&&v.isColor&&(m(v,1),g=!0);const y=t.xr.getEnvironmentBlendMode();"additive"===y?i.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===y&&i.buffers.color.setClear(0,0,0,0,a),(t.autoClear||g)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),v&&(v.isCubeTexture||v.mapping===U)?(void 0===c&&(c=new wi(new Ti(1,1,1),new Pi({name:"BackgroundCubeMaterial",uniforms:Ai(Ki.backgroundCube.uniforms),vertexShader:Ki.backgroundCube.vertexShader,fragmentShader:Ki.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),c.material.uniforms.envMap.value=v,c.material.uniforms.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=f.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,c.material.toneMapped=v.colorSpace!==pt,u===v&&d===v.version&&p===t.toneMapping||(c.material.needsUpdate=!0,u=v,d=v.version,p=t.toneMapping),c.layers.enableAll(),s.unshift(c,c.geometry,c.material,0,0,null)):v&&v.isTexture&&(void 0===l&&(l=new wi(new Xi(2,2),new Pi({name:"BackgroundMaterial",uniforms:Ai(Ki.background.uniforms),vertexShader:Ki.background.vertexShader,fragmentShader:Ki.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=v,l.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,l.material.toneMapped=v.colorSpace!==pt,!0===v.matrixAutoUpdate&&v.updateMatrix(),l.material.uniforms.uvTransform.value.copy(v.matrix),u===v&&d===v.version&&p===t.toneMapping||(l.material.needsUpdate=!0,u=v,d=v.version,p=t.toneMapping),l.layers.enableAll(),s.unshift(l,l.geometry,l.material,0,0,null))}}}function $i(t,e,n,i){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||null!==s,o={},l=p(null);let c=l,h=!1;function u(e){return i.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function d(e){return i.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function p(t){const e=[],n=[],i=[];for(let s=0;s=0){const e=r[l];let n=s[l];if(void 0===n&&("instanceMatrix"===l&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===l&&t.instanceColor&&(n=t.instanceColor)),void 0===e)return!0;if(e.attribute!==n)return!0;if(n&&e.data!==n.data)return!0;a++}return c.attributesNum!==a||c.index!==i}(r,x,d,_),b&&function(t,e,n,i){const r={},s=e.attributes;let a=0;const o=n.getAttributes();for(const l in o)if(o[l].location>=0){let e=s[l];void 0===e&&("instanceMatrix"===l&&t.instanceMatrix&&(e=t.instanceMatrix),"instanceColor"===l&&t.instanceColor&&(e=t.instanceColor));const n={};n.attribute=e,e&&e.data&&(n.data=e.data),r[l]=n,a++}c.attributes=r,c.attributesNum=a,c.index=i}(r,x,d,_)}else{const t=!0===l.wireframe;c.geometry===x.id&&c.program===d.id&&c.wireframe===t||(c.geometry=x.id,c.program=d.id,c.wireframe=t,b=!0)}null!==_&&n.update(_,t.ELEMENT_ARRAY_BUFFER),(b||h)&&(h=!1,function(r,s,a,o){if(!1===i.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;m();const l=o.attributes,c=a.getAttributes(),h=s.defaultAttributeValues;for(const e in c){const s=c[e];if(s.location>=0){let a=l[e];if(void 0===a&&("instanceMatrix"===e&&r.instanceMatrix&&(a=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(a=r.instanceColor)),void 0!==a){const e=a.normalized,l=a.itemSize,c=n.get(a);if(void 0===c)continue;const h=c.buffer,u=c.type,d=c.bytesPerElement,p=!0===i.isWebGL2&&(u===t.INT||u===t.UNSIGNED_INT||1013===a.gpuType);if(a.isInterleavedBufferAttribute){const n=a.data,i=n.stride,c=a.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name;let a=void 0!==n.precision?n.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=s||e.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),m=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),g=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),y=u>0,x=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:s?t.getParameter(t.MAX_SAMPLES):0}}function er(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new zi,o=new qt,l={value:null,needsUpdate:!1};function c(t,n,i,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length0),e.numPlanes=i,e.numIntersection=0);else{const t=s?0:i,e=4*t;let r=m.clippingState||null;l.value=r,r=c(u,o,e,h);for(let i=0;i!==e;++i)r[i]=n[i];m.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function nr(t){let e=new WeakMap;function n(t,e){return e===O?t.mapping=I:e===D&&(t.mapping=N),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const s=r.mapping;if(s===O||s===D){if(e.has(r))return n(e.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const a=new Ui(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}class ir extends Li{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const rr=[.125,.215,.35,.446,.526,.582],sr=new ir,ar=new Gn;let or=null;const lr=(1+Math.sqrt(5))/2,cr=1/lr,hr=[new Me(1,1,1),new Me(-1,1,1),new Me(1,1,-1),new Me(-1,1,-1),new Me(0,lr,cr),new Me(0,lr,-cr),new Me(cr,0,lr),new Me(-cr,0,lr),new Me(lr,cr,0),new Me(-lr,cr,0)];class ur{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){or=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=fr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=mr(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;tt-4?o=rr[a-t+4-1]:0===a&&(o=0),i.push(o);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,m=3,f=2,g=1,v=new Float32Array(m*p*d),y=new Float32Array(f*p*d),x=new Float32Array(g*p*d);for(let t=0;t2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];v.set(i,m*p*t),y.set(u,f*p*t);const r=[t,t,t,t,t,t];x.set(r,g*p*t)}const _=new si;_.setAttribute("position",new Yn(v,m)),_.setAttribute("uv",new Yn(y,f)),_.setAttribute("faceIndex",new Yn(x,g)),e.push(_),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(20),r=new Me(0,1,0);return new Pi({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,t,e)}return i}_compileMaterial(t){const e=new wi(this._lodPlanes[0],t);this._renderer.compile(e,sr)}_sceneToCubeUV(t,e,n,i){const r=new Ii(90,1,e,n),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(ar),o.toneMapping=A,o.autoClear=!1;const h=new jn({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),u=new wi(new Ti,h);let d=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,d=!0):(h.color.copy(ar),d=!0);for(let m=0;m<6;m++){const e=m%3;0===e?(r.up.set(0,s[m],0),r.lookAt(a[m],0,0)):1===e?(r.up.set(0,0,s[m]),r.lookAt(0,a[m],0)):(r.up.set(0,s[m],0),r.lookAt(0,0,a[m]));const n=this._cubeSize;pr(i,e*n,m>2?n:0,n,n),o.setRenderTarget(i),d&&o.render(u,r),o.render(t,r)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=c,o.autoClear=l,t.background=p}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===I||t.mapping===N;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=fr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=mr());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new wi(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const a=this._cubeSize;pr(e,0,0,3*a,2*a),n.setRenderTarget(e),n.render(s,sr)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let i=1;i20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let x=0;x<20;++x){const t=x/p,e=Math.exp(-t*t/2);f.push(e),0===x?g+=e:xv-4?i-v+4:0),4*(this._cubeSize-y),3*y,2*y),o.setRenderTarget(e),o.render(c,sr)}}function dr(t,e,n){const i=new ye(t,e,n);return i.texture.mapping=U,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function pr(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function mr(){return new Pi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function fr(){return new Pi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function gr(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,a=s===O||s===D,o=s===I||s===N;if(a||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=e.get(r);return null===n&&(n=new ur(t)),i=a?n.fromEquirectangular(r,i):n.fromCubemap(r,i),e.set(r,i),i.texture}if(e.has(r))return e.get(r).texture;{const s=r.image;if(a&&s&&s.height>0||o&&s&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(s)){null===n&&(n=new ur(t));const s=a?n.fromEquirectangular(r):n.fromCubemap(r);return e.set(r,s),r.addEventListener("dispose",i),s.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function vr(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function yr(t,e,n,i){const r={},s=new WeakMap;function a(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const n in o.attributes)e.remove(o.attributes[n]);for(const n in o.morphAttributes){const t=o.morphAttributes[n];for(let n=0,i=t.length;ne.maxTextureSize&&(f=Math.ceil(m/e.maxTextureSize),m=e.maxTextureSize);const g=new Float32Array(m*f*4*r),v=new xe(g,m,f,r);v.type=K,v.needsUpdate=!0;const y=4*p;for(let e=0;e0)return t;const r=e*n;let s=Cr[r];if(void 0===s&&(s=new Float32Array(r),Cr[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function Dr(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n":" "} ${t}: ${n[a]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function Is(t,e){const n=function(t){switch(t){case mt:return["Linear","( value )"];case pt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Ns(t,e){let n;switch(e){case E:n="Linear";break;case R:n="Reinhard";break;case C:n="OptimizedCineon";break;case P:n="ACESFilmic";break;case L:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Os(t){return""!==t}function Ds(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Us(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Bs=/^[ \t]*#include +<([\w\d./]+)>/gm;function Fs(t){return t.replace(Bs,zs)}const ks=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function zs(t,e){let n=qi[e];if(void 0===n){const t=ks.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");n=qi[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return Fs(n)}const Vs=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Hs(t){return t.replace(Vs,Gs)}function Gs(t,e,n,i){let r="";for(let s=parseInt(e);s0&&(x+="\n"),_=[g,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v].filter(Os).join("\n"),_.length>0&&(_+="\n")):(x=[Ws(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Os).join("\n"),_=[g,Ws(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",n.envMap?"#define "+m:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==A?"#define TONE_MAPPING":"",n.toneMapping!==A?qi.tonemapping_pars_fragment:"",n.toneMapping!==A?Ns("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",qi.colorspace_pars_fragment,Is("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Os).join("\n")),c=Fs(c),c=Ds(c,n),c=Us(c,n),h=Fs(h),h=Ds(h,n),h=Us(h,n),c=Hs(c),h=Hs(h),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,_=["#define varying in",n.glslVersion===At?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===At?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+_);const M=b+x+c,E=b+_+h,R=Cs(o,o.VERTEX_SHADER,M),C=Cs(o,o.FRAGMENT_SHADER,E);if(o.attachShader(y,R),o.attachShader(y,C),void 0!==n.index0AttributeName?o.bindAttribLocation(y,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(y,0,"position"),o.linkProgram(y),t.debug.checkShaderErrors){const e=o.getProgramInfoLog(y).trim(),n=o.getShaderInfoLog(R).trim(),i=o.getShaderInfoLog(C).trim();let r=!0,s=!0;if(!1===o.getProgramParameter(y,o.LINK_STATUS))if(r=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(o,y,R,C);else{const t=Ls(o,R,"vertex"),n=Ls(o,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(y,o.VALIDATE_STATUS)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==n&&""!==i||(s=!1);s&&(this.diagnostics={runnable:r,programLog:e,vertexShader:{log:n,prefix:x},fragmentShader:{log:i,prefix:_}})}let P,L;return o.deleteShader(R),o.deleteShader(C),this.getUniforms=function(){return void 0===P&&(P=new Rs(o,y)),P},this.getAttributes=function(){return void 0===L&&(L=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r0,q=s.clearcoat>0,Y=s.iridescence>0,K=s.sheen>0,J=s.transmission>0,Z=X&&!!s.anisotropyMap,$=q&&!!s.clearcoatMap,Q=q&&!!s.clearcoatNormalMap,tt=q&&!!s.clearcoatRoughnessMap,et=Y&&!!s.iridescenceMap,nt=Y&&!!s.iridescenceThicknessMap,it=K&&!!s.sheenColorMap,rt=K&&!!s.sheenRoughnessMap,st=!!s.specularMap,at=!!s.specularColorMap,ot=!!s.specularIntensityMap,lt=J&&!!s.transmissionMap,ct=J&&!!s.thicknessMap,ht=!!s.gradientMap,ut=!!s.alphaMap,dt=s.alphaTest>0,ft=!!s.alphaHash,gt=!!s.extensions,vt=!!x.attributes.uv1,yt=!!x.attributes.uv2,xt=!!x.attributes.uv3;let _t=A;return s.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(_t=t.toneMapping)),{isWebGL2:h,shaderID:w,shaderType:s.type,shaderName:s.name,vertexShader:E,fragmentShader:R,defines:s.defines,customVertexShaderID:C,customFragmentShaderID:P,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:N,instancingColor:N&&null!==v.instanceColor,supportsVertexTextures:d,outputColorSpace:null===I?t.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:mt,map:O,matcap:D,envMap:B,envMapMode:B&&b.mapping,envMapCubeUVHeight:M,aoMap:F,lightMap:k,bumpMap:z,normalMap:V,displacementMap:d&&H,emissiveMap:G,normalMapObjectSpace:V&&1===s.normalMapType,normalMapTangentSpace:V&&0===s.normalMapType,metalnessMap:W,roughnessMap:j,anisotropy:X,anisotropyMap:Z,clearcoat:q,clearcoatMap:$,clearcoatNormalMap:Q,clearcoatRoughnessMap:tt,iridescence:Y,iridescenceMap:et,iridescenceThicknessMap:nt,sheen:K,sheenColorMap:it,sheenRoughnessMap:rt,specularMap:st,specularColorMap:at,specularIntensityMap:ot,transmission:J,transmissionMap:lt,thicknessMap:ct,gradientMap:ht,opaque:!1===s.transparent&&1===s.blending,alphaMap:ut,alphaTest:dt,alphaHash:ft,combine:s.combine,mapUv:O&&f(s.map.channel),aoMapUv:F&&f(s.aoMap.channel),lightMapUv:k&&f(s.lightMap.channel),bumpMapUv:z&&f(s.bumpMap.channel),normalMapUv:V&&f(s.normalMap.channel),displacementMapUv:H&&f(s.displacementMap.channel),emissiveMapUv:G&&f(s.emissiveMap.channel),metalnessMapUv:W&&f(s.metalnessMap.channel),roughnessMapUv:j&&f(s.roughnessMap.channel),anisotropyMapUv:Z&&f(s.anisotropyMap.channel),clearcoatMapUv:$&&f(s.clearcoatMap.channel),clearcoatNormalMapUv:Q&&f(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:tt&&f(s.clearcoatRoughnessMap.channel),iridescenceMapUv:et&&f(s.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&f(s.iridescenceThicknessMap.channel),sheenColorMapUv:it&&f(s.sheenColorMap.channel),sheenRoughnessMapUv:rt&&f(s.sheenRoughnessMap.channel),specularMapUv:st&&f(s.specularMap.channel),specularColorMapUv:at&&f(s.specularColorMap.channel),specularIntensityMapUv:ot&&f(s.specularIntensityMap.channel),transmissionMapUv:lt&&f(s.transmissionMap.channel),thicknessMapUv:ct&&f(s.thicknessMap.channel),alphaMapUv:ut&&f(s.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(V||X),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,vertexUv1s:vt,vertexUv2s:yt,vertexUv3s:xt,pointsUvs:!0===v.isPoints&&!!x.attributes.uv&&(O||ut),fog:!!y,useFog:!0===s.fog,fogExp2:y&&y.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:T,morphTextureStride:L,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.length>0,shadowMapType:t.shadowMap.type,toneMapping:_t,useLegacyLights:t._useLegacyLights,decodeVideoTexture:O&&!0===s.map.isVideoTexture&&s.map.colorSpace===pt,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:gt&&!0===s.extensions.derivatives,extensionFragDepth:gt&&!0===s.extensions.fragDepth,extensionDrawBuffers:gt&&!0===s.extensions.drawBuffers,extensionShaderTextureLOD:gt&&!0===s.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0),e.supportsVertexTextures&&o.enable(1),e.instancing&&o.enable(2),e.instancingColor&&o.enable(3),e.matcap&&o.enable(4),e.envMap&&o.enable(5),e.normalMapObjectSpace&&o.enable(6),e.normalMapTangentSpace&&o.enable(7),e.clearcoat&&o.enable(8),e.iridescence&&o.enable(9),e.alphaTest&&o.enable(10),e.vertexColors&&o.enable(11),e.vertexAlphas&&o.enable(12),e.vertexUv1s&&o.enable(13),e.vertexUv2s&&o.enable(14),e.vertexUv3s&&o.enable(15),e.vertexTangents&&o.enable(16),e.anisotropy&&o.enable(17),t.push(o.mask),o.disableAll(),e.fog&&o.enable(0),e.useFog&&o.enable(1),e.flatShading&&o.enable(2),e.logarithmicDepthBuffer&&o.enable(3),e.skinning&&o.enable(4),e.morphTargets&&o.enable(5),e.morphNormals&&o.enable(6),e.morphColors&&o.enable(7),e.premultipliedAlpha&&o.enable(8),e.shadowMapEnabled&&o.enable(9),e.useLegacyLights&&o.enable(10),e.doubleSided&&o.enable(11),e.flipSided&&o.enable(12),e.useDepthPacking&&o.enable(13),e.dithering&&o.enable(14),e.transmission&&o.enable(15),e.sheen&&o.enable(16),e.opaque&&o.enable(17),e.pointsUvs&&o.enable(18),e.decodeVideoTexture&&o.enable(19),t.push(o.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=m[t.type];let n;if(e){const t=Ki[e];n=Ci.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,r=c.length;t0?i.push(h):!0===a.transparent?r.push(h):n.push(h)},unshift:function(t,e,a,o,l,c){const h=s(t,e,a,o,l,c);a.transmission>0?i.unshift(h):!0===a.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n1&&n.sort(t||Zs),i.length>1&&i.sort(e||$s),r.length>1&&r.sort(e||$s)}}}function ta(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new Qs,t.set(e,[r])):n>=i.length?(r=new Qs,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}}function ea(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Me,color:new Gn};break;case"SpotLight":n={position:new Me,direction:new Me,color:new Gn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Me,color:new Gn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Me,skyColor:new Gn,groundColor:new Gn};break;case"RectAreaLight":n={color:new Gn,position:new Me,halfWidth:new Me,halfHeight:new Me}}return t[e.id]=n,n}}}let na=0;function ia(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function ra(t,e){const n=new ea,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let l=0;l<9;l++)r.probe.push(new Me);const s=new Me,a=new $e,o=new $e;return{setup:function(s,a){let o=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,d=0,p=0,m=0,f=0,g=0,v=0,y=0,x=0;s.sort(ia);const _=!0===a?Math.PI:1;for(let t=0,e=s.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Yi.LTC_FLOAT_1,r.rectAreaLTC2=Yi.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Yi.LTC_HALF_1,r.rectAreaLTC2=Yi.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=c;const b=r.hash;b.directionalLength===h&&b.pointLength===u&&b.spotLength===d&&b.rectAreaLength===p&&b.hemiLength===m&&b.numDirectionalShadows===f&&b.numPointShadows===g&&b.numSpotShadows===v&&b.numSpotMaps===y||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=m,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=v+y-x,r.spotLightMap.length=y,r.numSpotLightShadowsWithMaps=x,b.directionalLength=h,b.pointLength=u,b.spotLength=d,b.rectAreaLength=p,b.hemiLength=m,b.numDirectionalShadows=f,b.numPointShadows=g,b.numSpotShadows=v,b.numSpotMaps=y,r.version=na++)},setupView:function(t,e){let n=0,i=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let d=0,p=t.length;d=s.length?(a=new sa(t,e),s.push(a)):a=s[r],a},dispose:function(){n=new WeakMap}}}class oa extends Fn{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class la extends Fn{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function ca(t,e,n){let r=new Gi;const c=new Xt,h=new Xt,u=new ge,d=new oa({depthPacking:3201}),p=new la,m={},f=n.maxTextureSize,g={[a]:1,[o]:0,[l]:2},v=new Pi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Xt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),y=v.clone();y.defines.HORIZONTAL_PASS=1;const x=new si;x.setAttribute("position",new Yn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new wi(x,v),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=i;let M=this.type;function w(n,i){const r=e.update(_);v.defines.VSM_SAMPLES!==n.blurSamples&&(v.defines.VSM_SAMPLES=n.blurSamples,y.defines.VSM_SAMPLES=n.blurSamples,v.needsUpdate=!0,y.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new ye(c.x,c.y)),v.uniforms.shadow_pass.value=n.map.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,v,_,null),y.uniforms.shadow_pass.value=n.mapPass.texture,y.uniforms.resolution.value=n.mapSize,y.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,y,_,null)}function S(e,n,i,r){let a=null;const o=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?p:d,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const t=a.uuid,e=n.uuid;let i=m[t];void 0===i&&(i={},m[t]=i);let r=i[e];void 0===r&&(r=a.clone(),i[e]=r),a=r}return a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===s?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:g[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(t.properties.get(a).light=i),a}function T(n,i,a,o,l){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&l===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let s=0,c=e.length;sf||c.y>f)&&(c.x>f&&(h.x=Math.floor(f/l.x),c.x=h.x*l.x,o.mapSize.x=h.x),c.y>f&&(h.y=Math.floor(f/l.y),c.y=h.y*l.y,o.mapSize.y=h.y)),null===o.map||!0===p||!0===m){const t=this.type!==s?{minFilter:z,magFilter:z}:{};null!==o.map&&o.map.dispose(),o.map=new ye(c.x,c.y,t),o.map.texture.name=a.name+".shadowMap",o.camera.updateProjectionMatrix()}t.setRenderTarget(o.map),t.clear();const v=o.getViewportCount();for(let t=0;t=1):-1!==j.indexOf("OpenGL ES")&&(W=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),G=W>=2);let X=null,q={};const Y=t.getParameter(t.SCISSOR_BOX),K=t.getParameter(t.VIEWPORT),J=(new ge).fromArray(Y),Z=(new ge).fromArray(K);function $(e,n,r,s){const a=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let l=0;li||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?zt:Math.floor,s=i(r*t.width),a=i(r*t.height);void 0===f&&(f=y(s,a));const o=n?y(s,a):f;return o.width=s,o.height=a,o.getContext("2d").drawImage(t,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+a+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function _(t){return Ft(t.width)&&Ft(t.height)}function b(t,e){return t.generateMipmaps&&e&&t.minFilter!==z&&t.minFilter!==G}function M(e){t.generateMipmap(e)}function w(n,i,r,s,a=!1){if(!1===o)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return i===t.RED&&(r===t.FLOAT&&(l=t.R32F),r===t.HALF_FLOAT&&(l=t.R16F),r===t.UNSIGNED_BYTE&&(l=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(l=t.R8UI),r===t.UNSIGNED_SHORT&&(l=t.R16UI),r===t.UNSIGNED_INT&&(l=t.R32UI),r===t.BYTE&&(l=t.R8I),r===t.SHORT&&(l=t.R16I),r===t.INT&&(l=t.R32I)),i===t.RG&&(r===t.FLOAT&&(l=t.RG32F),r===t.HALF_FLOAT&&(l=t.RG16F),r===t.UNSIGNED_BYTE&&(l=t.RG8)),i===t.RGBA&&(r===t.FLOAT&&(l=t.RGBA32F),r===t.HALF_FLOAT&&(l=t.RGBA16F),r===t.UNSIGNED_BYTE&&(l=s===pt&&!1===a?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(l=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(l=t.RGB5_A1)),l!==t.R16F&&l!==t.R32F&&l!==t.RG16F&&l!==t.RG32F&&l!==t.RGBA16F&&l!==t.RGBA32F||e.get("EXT_color_buffer_float"),l}function S(t,e,n){return!0===b(t,n)||t.isFramebufferTexture&&t.minFilter!==z&&t.minFilter!==G?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function T(e){return e===z||e===V||e===H?t.NEAREST:t.LINEAR}function A(t){const e=t.target;e.removeEventListener("dispose",A),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=g.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&R(t),0===Object.keys(r).length&&g.delete(n)}i.remove(t)}(e),e.isVideoTexture&&m.delete(e)}function E(e){const n=e.target;n.removeEventListener("dispose",E),function(e){const n=e.texture,r=i.get(e),s=i.get(n);if(void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),a.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let i=0;i<6;i++){if(Array.isArray(r.__webglFramebuffer[i]))for(let e=0;e0&&s.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void U(s,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(t.TEXTURE_2D,s.__webglTexture,t.TEXTURE0+r)}const L={[B]:t.REPEAT,[F]:t.CLAMP_TO_EDGE,[k]:t.MIRRORED_REPEAT},I={[z]:t.NEAREST,[V]:t.NEAREST_MIPMAP_NEAREST,[H]:t.NEAREST_MIPMAP_LINEAR,[G]:t.LINEAR,[W]:t.LINEAR_MIPMAP_NEAREST,[j]:t.LINEAR_MIPMAP_LINEAR},N={[vt]:t.NEVER,[St]:t.ALWAYS,[yt]:t.LESS,[_t]:t.LEQUAL,[xt]:t.EQUAL,[wt]:t.GEQUAL,[bt]:t.GREATER,[Mt]:t.NOTEQUAL};function O(n,s,a){if(a?(t.texParameteri(n,t.TEXTURE_WRAP_S,L[s.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,L[s.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,L[s.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,I[s.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,I[s.minFilter])):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),s.wrapS===F&&s.wrapT===F||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,t.TEXTURE_MAG_FILTER,T(s.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,T(s.minFilter)),s.minFilter!==z&&s.minFilter!==G&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),s.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,N[s.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){const a=e.get("EXT_texture_filter_anisotropic");if(s.magFilter===z)return;if(s.minFilter!==H&&s.minFilter!==j)return;if(s.type===K&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&s.type===J&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||i.get(s).__currentAnisotropy)&&(t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function D(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",A));const r=n.source;let s=g.get(r);void 0===s&&(s={},g.set(r,s));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(o!==e.__cacheKey){void 0===s[o]&&(s[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,i=!0),s[o].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&R(n)),e.__cacheKey=o,e.__webglTexture=s[o].texture}return i}function U(e,r,a){let l=t.TEXTURE_2D;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),r.isData3DTexture&&(l=t.TEXTURE_3D);const c=D(e,r),u=r.source;n.bindTexture(l,e.__webglTexture,t.TEXTURE0+a);const d=i.get(u);if(u.version!==d.__version||!0===c){n.activeTexture(t.TEXTURE0+a),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const e=function(t){return!o&&(t.wrapS!==F||t.wrapT!==F||t.minFilter!==z&&t.minFilter!==G)}(r)&&!1===_(r.image);let i=x(r.image,e,!1,h);i=at(r,i);const p=_(i)||o,m=s.convert(r.format,r.colorSpace);let f,g=s.convert(r.type),v=w(r.internalFormat,m,g,r.colorSpace,r.isVideoTexture);O(l,r,p);const y=r.mipmaps,T=o&&!0!==r.isVideoTexture,A=void 0===d.__version||!0===c,E=S(r,i,p);if(r.isDepthTexture)v=t.DEPTH_COMPONENT,o?v=r.type===K?t.DEPTH_COMPONENT32F:r.type===Y?t.DEPTH_COMPONENT24:r.type===Z?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT16:r.type===K&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Q&&v===t.DEPTH_COMPONENT&&r.type!==q&&r.type!==Y&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Y,g=s.convert(r.type)),r.format===tt&&v===t.DEPTH_COMPONENT&&(v=t.DEPTH_STENCIL,r.type!==Z&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Z,g=s.convert(r.type))),A&&(T?n.texStorage2D(t.TEXTURE_2D,1,v,i.width,i.height):n.texImage2D(t.TEXTURE_2D,0,v,i.width,i.height,0,m,g,null));else if(r.isDataTexture)if(y.length>0&&p){T&&A&&n.texStorage2D(t.TEXTURE_2D,E,v,y[0].width,y[0].height);for(let e=0,i=y.length;e>=1,r>>=1}}else if(y.length>0&&p){T&&A&&n.texStorage2D(t.TEXTURE_2D,E,v,y[0].width,y[0].height);for(let e=0,i=y.length;e>c),i=Math.max(1,r.height>>c);l===t.TEXTURE_3D||l===t.TEXTURE_2D_ARRAY?n.texImage3D(l,c,p,e,i,r.depth,0,h,u,null):n.texImage2D(l,c,p,e,i,0,h,u,null)}n.bindFramebuffer(t.FRAMEBUFFER,e),st(r)?d.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,o,l,i.get(a).__webglTexture,0,rt(r)):(l===t.TEXTURE_2D||l>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,o,l,i.get(a).__webglTexture,c),n.bindFramebuffer(t.FRAMEBUFFER,null)}function nt(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer){let r=t.DEPTH_COMPONENT16;if(i||st(n)){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===K?r=t.DEPTH_COMPONENT32F:e.type===Y&&(r=t.DEPTH_COMPONENT24));const i=rt(n);st(n)?d.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,i,r,n.width,n.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,i,r,n.width,n.height)}else t.renderbufferStorage(t.RENDERBUFFER,r,n.width,n.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)}else if(n.depthBuffer&&n.stencilBuffer){const r=rt(n);i&&!1===st(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,n.width,n.height):st(n)?d.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let r=0;r0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function at(t,n){const i=t.colorSpace,r=t.format,s=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===Et||i!==mt&&""!==i&&(i===pt||i===ft?!1===o?!0===e.has("EXT_sRGB")&&r===$?(t.format=Et,t.minFilter=G,t.generateMipmaps=!1):n=he.sRGBToLinear(n):r===$&&s===X||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),n}this.allocateTextureUnit=function(){const t=C;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),C+=1,t},this.resetTextureUnits=function(){C=0},this.setTexture2D=P,this.setTexture2DArray=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?U(s,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture,t.TEXTURE0+r)},this.setTexture3D=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?U(s,e,r):n.bindTexture(t.TEXTURE_3D,s.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?function(e,r,a){if(6!==r.image.length)return;const l=D(e,r),h=r.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+a);const u=i.get(h);if(h.version!==u.__version||!0===l){n.activeTexture(t.TEXTURE0+a),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const e=r.isCompressedTexture||r.image[0].isCompressedTexture,i=r.image[0]&&r.image[0].isDataTexture,d=[];for(let t=0;t<6;t++)d[t]=e||i?i?r.image[t].image:r.image[t]:x(r.image[t],!1,!0,c),d[t]=at(r,d[t]);const p=d[0],m=_(p)||o,f=s.convert(r.format,r.colorSpace),g=s.convert(r.type),v=w(r.internalFormat,f,g,r.colorSpace),y=o&&!0!==r.isVideoTexture,T=void 0===u.__version||!0===l;let A,E=S(r,p,m);if(O(t.TEXTURE_CUBE_MAP,r,m),e){y&&T&&n.texStorage2D(t.TEXTURE_CUBE_MAP,E,v,p.width,p.height);for(let e=0;e<6;e++){A=d[e].mipmaps;for(let i=0;i0&&E++,n.texStorage2D(t.TEXTURE_CUBE_MAP,E,v,d[0].width,d[0].height));for(let e=0;e<6;e++)if(i){y?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,d[e].width,d[e].height,f,g,d[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,v,d[e].width,d[e].height,0,f,g,d[e].data);for(let i=0;i0){c.__webglFramebuffer[e]=[];for(let n=0;n0){c.__webglFramebuffer=[];for(let e=0;e0&&!1===st(e)){const i=d?l:[l];c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,c.__webglMultisampledFramebuffer);for(let n=0;n0)for(let i=0;i0)for(let n=0;n0&&!1===st(e)){const r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],s=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const l=[],c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=i.get(e),u=!0===e.isWebGLMultipleRenderTargets;if(u)for(let e=0;eo+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(fa)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new ma;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class va extends fe{constructor(t,e,n,i,r,s,a,o,l,c){if((c=void 0!==c?c:Q)!==Q&&c!==tt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Q&&(n=Y),void 0===n&&c===tt&&(n=Z),super(null,i,r,s,a,o,c,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==a?a:z,this.minFilter=void 0!==o?o:z,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class ya extends Pt{constructor(t,e){super();const n=this;let i=null,r=1,s=null,a="local-floor",o=1,l=null,c=null,h=null,u=null,d=null,p=null;const m=e.getContextAttributes();let f=null,g=null;const v=[],y=[],x=new Ii;x.layers.enable(1),x.viewport=new ge;const _=new Ii;_.layers.enable(2),_.viewport=new ge;const b=[x,_],M=new pa;M.layers.enable(1),M.layers.enable(2);let w=null,S=null;function T(t){const e=y.indexOf(t.inputSource);if(-1===e)return;const n=v[e];void 0!==n&&(n.update(t.inputSource,t.frame,l||s),n.dispatchEvent({type:t.type,data:t.inputSource}))}function A(){i.removeEventListener("select",T),i.removeEventListener("selectstart",T),i.removeEventListener("selectend",T),i.removeEventListener("squeeze",T),i.removeEventListener("squeezestart",T),i.removeEventListener("squeezeend",T),i.removeEventListener("end",A),i.removeEventListener("inputsourceschange",E);for(let t=0;t=0&&(y[i]=null,v[i].disconnect(n))}for(let e=0;e=y.length){y.push(n),i=t;break}if(null===y[t]){y[t]=n,i=t;break}}if(-1===i)break}const r=v[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=v[t];return void 0===e&&(e=new ga,v[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=v[t];return void 0===e&&(e=new ga,v[t]=e),e.getGripSpace()},this.getHand=function(t){let e=v[t];return void 0===e&&(e=new ga,v[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(f=t.getRenderTarget(),i.addEventListener("select",T),i.addEventListener("selectstart",T),i.addEventListener("selectend",T),i.addEventListener("squeeze",T),i.addEventListener("squeezestart",T),i.addEventListener("squeezeend",T),i.addEventListener("end",A),i.addEventListener("inputsourceschange",E),!0!==m.xrCompatible&&await e.makeXRCompatible(),void 0===i.renderState.layers||!1===t.capabilities.isWebGL2){const n={antialias:void 0!==i.renderState.layers||m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:d}),g=new ye(d.framebufferWidth,d.framebufferHeight,{format:$,type:X,colorSpace:t.outputColorSpace,stencilBuffer:m.stencil})}else{let n=null,s=null,a=null;m.depth&&(a=m.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,n=m.stencil?tt:Q,s=m.stencil?Z:Y);const o={colorFormat:e.RGBA8,depthFormat:a,scaleFactor:r};h=new XRWebGLBinding(i,e),u=h.createProjectionLayer(o),i.updateRenderState({layers:[u]}),g=new ye(u.textureWidth,u.textureHeight,{format:$,type:X,depthTexture:new va(u.textureWidth,u.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:m.stencil,colorSpace:t.outputColorSpace,samples:m.antialias?4:0}),t.properties.get(g).__ignoreDepthValues=u.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await i.requestReferenceSpace(a),I.setContext(i),I.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode};const R=new Me,C=new Me;function P(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;M.near=_.near=x.near=t.near,M.far=_.far=x.far=t.far,w===M.near&&S===M.far||(i.updateRenderState({depthNear:M.near,depthFar:M.far}),w=M.near,S=M.far);const e=t.parent,n=M.cameras;P(M,e);for(let i=0;i0&&(i.alphaTest.value=r.alphaTest);const s=e.get(r).envMap;if(s&&(i.envMap.value=s,i.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;const e=!0===t._useLegacyLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*e,n(r.lightMap,i.lightMapTransform)}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,i.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,Ri(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,s,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,i){t.metalness.value=i.metalness,i.metalnessMap&&(t.metalnessMap.value=i.metalnessMap,n(i.metalnessMap,t.metalnessMapTransform)),t.roughness.value=i.roughness,i.roughnessMap&&(t.roughnessMap.value=i.roughnessMap,n(i.roughnessMap,t.roughnessMapTransform));e.get(i).envMap&&(t.envMapIntensity.value=i.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&t.clearcoatNormalScale.value.negate())),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,o)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,a):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function _a(t,e,n,i){let r={},s={},a=[];const o=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(t,e,n){const i=t.value;if(void 0===n[e]){if("number"==typeof i)n[e]=i;else{const t=Array.isArray(i)?i:[i],r=[];for(let e=0;e0&&(i=n%16,0!==i&&16-i-s.boundary<0&&(n+=16-i,t.__offset=n)),n+=s.storage}i=n%16,i>0&&(n+=16-i),t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t0),u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let m=A;i.toneMapped&&(null!==w&&!0!==w.isXRRenderTarget||(m=x.toneMapping));const f=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==f?f.length:0,y=ot.get(i),_=g.state.lights;if(!0===V&&(!0===H||t!==T)){const e=t===T&&i.id===S;_t.setState(i,t,e)}let b=!1;i.version===y.__version?y.needsLights&&y.lightsStateVersion!==_.state.version||y.outputColorSpace!==o||r.isInstancedMesh&&!1===y.instancing?b=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&!1===y.skinning?b=!0:r.isSkinnedMesh||!0!==y.skinning?r.isInstancedMesh&&!0===y.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===y.instancingColor&&null!==r.instanceColor||y.envMap!==l||!0===i.fog&&y.fog!==s?b=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===_t.numPlanes&&y.numIntersection===_t.numIntersection?(y.vertexAlphas!==c||y.vertexTangents!==h||y.morphTargets!==u||y.morphNormals!==d||y.morphColors!==p||y.toneMapping!==m||!0===rt.isWebGL2&&y.morphTargetsCount!==v)&&(b=!0):b=!0:b=!0:b=!0:(b=!0,y.__version=i.version);let M=y.currentProgram;!0===b&&(M=qt(i,e,r));let E=!1,R=!1,C=!1;const P=M.getUniforms(),L=y.uniforms;if(st.useProgram(M.program)&&(E=!0,R=!0,C=!0),i.id!==S&&(S=i.id,R=!0),E||T!==t){P.setValue(Ct,"projectionMatrix",t.projectionMatrix),P.setValue(Ct,"viewMatrix",t.matrixWorldInverse);const e=P.map.cameraPosition;void 0!==e&&e.setValue(Ct,tt.setFromMatrixPosition(t.matrixWorld)),rt.logarithmicDepthBuffer&&P.setValue(Ct,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&P.setValue(Ct,"isOrthographic",!0===t.isOrthographicCamera),T!==t&&(T=t,R=!0,C=!0)}if(r.isSkinnedMesh){P.setOptional(Ct,r,"bindMatrix"),P.setOptional(Ct,r,"bindMatrixInverse");const t=r.skeleton;t&&(rt.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),P.setValue(Ct,"boneTexture",t.boneTexture,lt),P.setValue(Ct,"boneTextureSize",t.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const I=n.morphAttributes;var D,U;if((void 0!==I.position||void 0!==I.normal||void 0!==I.color&&!0===rt.isWebGL2)&&wt.update(r,n,M),(R||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,P.setValue(Ct,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(L.envMap.value=l,L.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),R&&(P.setValue(Ct,"toneMappingExposure",x.toneMappingExposure),y.needsLights&&(U=C,(D=L).ambientLightColor.needsUpdate=U,D.lightProbe.needsUpdate=U,D.directionalLights.needsUpdate=U,D.directionalLightShadows.needsUpdate=U,D.pointLights.needsUpdate=U,D.pointLightShadows.needsUpdate=U,D.spotLights.needsUpdate=U,D.spotLightShadows.needsUpdate=U,D.rectAreaLights.needsUpdate=U,D.hemisphereLights.needsUpdate=U),s&&!0===i.fog&&vt.refreshFogUniforms(L,s),vt.refreshMaterialUniforms(L,i,O,N,G),Rs.upload(Ct,y.uniformsList,L,lt)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Rs.upload(Ct,y.uniformsList,L,lt),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&P.setValue(Ct,"center",r.center),P.setValue(Ct,"modelViewMatrix",r.modelViewMatrix),P.setValue(Ct,"normalMatrix",r.normalMatrix),P.setValue(Ct,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e0&&function(t,e,n,i){const r=rt.isWebGL2;null===G&&(G=new ye(1,1,{generateMipmaps:!0,type:it.has("EXT_color_buffer_half_float")?J:X,minFilter:j,samples:r?4:0})),x.getDrawingBufferSize(Q),r?G.setSize(Q.x,Q.y):G.setSize(zt(Q.x),zt(Q.y));const s=x.getRenderTarget();x.setRenderTarget(G),x.getClearColor(P),L=x.getClearAlpha(),L<1&&x.setClearColor(16777215,.5),x.clear();const a=x.toneMapping;x.toneMapping=A,Wt(t,n,i),lt.updateMultisampleRenderTarget(G),lt.updateRenderTargetMipmap(G);let o=!1;for(let l=0,c=e.length;l0&&Wt(r,e,n),s.length>0&&Wt(s,e,n),a.length>0&&Wt(a,e,n),st.buffers.depth.setTest(!0),st.buffers.depth.setMask(!0),st.buffers.color.setMask(!0),st.setPolygonOffset(!1)}function Wt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r0?y[y.length-1]:null,v.pop(),f=v.length>0?v[v.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(t,e,n){ot.get(t.texture).__webglTexture=e,ot.get(t.depthTexture).__webglTexture=n;const i=ot.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===it.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=ot.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){w=t,b=e,M=n;let i=!0,r=null,s=!1,a=!1;if(t){const o=ot.get(t);void 0!==o.__useDefaultFramebuffer?(st.bindFramebuffer(Ct.FRAMEBUFFER,null),i=!1):void 0===o.__webglFramebuffer?lt.setupRenderTarget(t):o.__hasExternalTextures&<.rebindTextures(t,ot.get(t.texture).__webglTexture,ot.get(t.depthTexture).__webglTexture);const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const c=ot.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][n]:c[e],s=!0):r=rt.isWebGL2&&t.samples>0&&!1===lt.useMultisampledRTT(t)?ot.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,E.copy(t.viewport),R.copy(t.scissor),C=t.scissorTest}else E.copy(B).multiplyScalar(O).floor(),R.copy(F).multiplyScalar(O).floor(),C=k;if(st.bindFramebuffer(Ct.FRAMEBUFFER,r)&&rt.drawBuffers&&i&&st.drawBuffers(t,r),st.viewport(E),st.scissor(R),st.setScissorTest(C),s){const i=ot.get(t.texture);Ct.framebufferTexture2D(Ct.FRAMEBUFFER,Ct.COLOR_ATTACHMENT0,Ct.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(a){const i=ot.get(t.texture),r=e||0;Ct.framebufferTextureLayer(Ct.FRAMEBUFFER,Ct.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}S=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ot.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){st.bindFramebuffer(Ct.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==$&&At.convert(o)!==Ct.getParameter(Ct.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===J&&(it.has("EXT_color_buffer_half_float")||rt.isWebGL2&&it.has("EXT_color_buffer_float"));if(!(l===X||At.convert(l)===Ct.getParameter(Ct.IMPLEMENTATION_COLOR_READ_TYPE)||l===K&&(rt.isWebGL2||it.has("OES_texture_float")||it.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Ct.readPixels(e,n,i,r,At.convert(o),At.convert(l),s)}finally{const t=null!==w?ot.get(w).__webglFramebuffer:null;st.bindFramebuffer(Ct.FRAMEBUFFER,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i);lt.setTexture2D(e,0),Ct.copyTexSubImage2D(Ct.TEXTURE_2D,n,0,0,t.x,t.y,r,s),st.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,s=e.image.height,a=At.convert(n.format),o=At.convert(n.type);lt.setTexture2D(n,0),Ct.pixelStorei(Ct.UNPACK_FLIP_Y_WEBGL,n.flipY),Ct.pixelStorei(Ct.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),Ct.pixelStorei(Ct.UNPACK_ALIGNMENT,n.unpackAlignment),e.isDataTexture?Ct.texSubImage2D(Ct.TEXTURE_2D,i,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?Ct.compressedTexSubImage2D(Ct.TEXTURE_2D,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):Ct.texSubImage2D(Ct.TEXTURE_2D,i,t.x,t.y,a,o,e.image),0===i&&n.generateMipmaps&&Ct.generateMipmap(Ct.TEXTURE_2D),st.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(x.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=At.convert(i.format),c=At.convert(i.type);let h;if(i.isData3DTexture)lt.setTexture3D(i,0),h=Ct.TEXTURE_3D;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");lt.setTexture2DArray(i,0),h=Ct.TEXTURE_2D_ARRAY}Ct.pixelStorei(Ct.UNPACK_FLIP_Y_WEBGL,i.flipY),Ct.pixelStorei(Ct.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Ct.pixelStorei(Ct.UNPACK_ALIGNMENT,i.unpackAlignment);const u=Ct.getParameter(Ct.UNPACK_ROW_LENGTH),d=Ct.getParameter(Ct.UNPACK_IMAGE_HEIGHT),p=Ct.getParameter(Ct.UNPACK_SKIP_PIXELS),m=Ct.getParameter(Ct.UNPACK_SKIP_ROWS),f=Ct.getParameter(Ct.UNPACK_SKIP_IMAGES),g=n.isCompressedTexture?n.mipmaps[0]:n.image;Ct.pixelStorei(Ct.UNPACK_ROW_LENGTH,g.width),Ct.pixelStorei(Ct.UNPACK_IMAGE_HEIGHT,g.height),Ct.pixelStorei(Ct.UNPACK_SKIP_PIXELS,t.min.x),Ct.pixelStorei(Ct.UNPACK_SKIP_ROWS,t.min.y),Ct.pixelStorei(Ct.UNPACK_SKIP_IMAGES,t.min.z),n.isDataTexture||n.isData3DTexture?Ct.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,g.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Ct.compressedTexSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,g.data)):Ct.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,g),Ct.pixelStorei(Ct.UNPACK_ROW_LENGTH,u),Ct.pixelStorei(Ct.UNPACK_IMAGE_HEIGHT,d),Ct.pixelStorei(Ct.UNPACK_SKIP_PIXELS,p),Ct.pixelStorei(Ct.UNPACK_SKIP_ROWS,m),Ct.pixelStorei(Ct.UNPACK_SKIP_IMAGES,f),0===r&&i.generateMipmaps&&Ct.generateMipmap(h),st.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?lt.setTextureCube(t,0):t.isData3DTexture?lt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?lt.setTexture2DArray(t,0):lt.setTexture2D(t,0),st.unbindTexture()},this.resetState=function(){b=0,M=0,w=null,st.reset(),Et.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Rt}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(t){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!t}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===pt?dt:3e3}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===dt?pt:mt}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}(class extends ba{}).prototype.isWebGL1Renderer=!0;class Ma{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Gn(t),this.density=e}clone(){return new Ma(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class wa{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new Gn(t),this.near=e,this.far=n}clone(){return new wa(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Sa extends Sn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e}}class Ta{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Tt,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Ot()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;it.far||e.push({distance:o,point:Pa.clone(),uv:Un.getInterpolation(Pa,Ua,Ba,Fa,ka,za,Va,new Xt),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Ga(t,e,n,i,r,s){Na.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Oa.x=s*Na.x-r*Na.y,Oa.y=r*Na.x+s*Na.y):Oa.copy(Na),t.copy(e),t.x+=Oa.x,t.y+=Oa.y,t.applyMatrix4(Da)}const Wa=new Me,ja=new Me;class Xa extends Sn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,i=e.length;n0){let n,i;for(n=1,i=e.length;n0){Wa.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Wa);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Wa.setFromMatrixPosition(t.matrixWorld),ja.setFromMatrixPosition(this.matrixWorld);const n=Wa.distanceTo(ja)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i=t))break;e[i-1].object.visible=!1,e[i].object.visible=!0}for(this._currentLevel=i-1;io)continue;u.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(u);rt.far||e.push({distance:r,point:h.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}else for(let f=Math.max(0,s.start),g=Math.min(m.count,s.start+s.count)-1;fo)continue;u.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(u);nt.far||e.push({distance:n,point:h.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;tr.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,object:a})}}class Uo{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let a,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),a=n[i]-s,a<0)o=i+1;else{if(!(a>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=e||(s.isVector2?new Xt:new Me);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new Me,i=[],r=[],s=[],a=new Me,o=new $e;for(let d=0;d<=t;d++){const e=d/t;i[d]=this.getTangentAt(e,new Me)}r[0]=new Me,s[0]=new Me;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let d=1;d<=t;d++){if(r[d]=r[d-1].clone(),s[d]=s[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(Dt(i[d-1].dot(i[d]),-1,1));r[d].applyMatrix4(o.makeRotationAxis(a,t))}s[d].crossVectors(i[d],r[d])}if(!0===e){let e=Math.acos(Dt(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Bo extends Uo{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e){const n=e||new Xt,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;ri.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(Go(a,o.x,l.x,c.x,h.x),Go(a,o.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?a=i[(l-1)%r]:(ko.subVectors(i[0],i[1]).add(i[0]),a=ko);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2=n){const t=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class tl extends si{constructor(t=[new Xt(0,-.5),new Xt(.5,0),new Xt(0,.5)],e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Dt(i,0,2*Math.PI);const r=[],s=[],a=[],o=[],l=[],c=1/e,h=new Me,u=new Xt,d=new Me,p=new Me,m=new Me;let f=0,g=0;for(let v=0;v<=t.length-1;v++)switch(v){case 0:f=t[v+1].x-t[v].x,g=t[v+1].y-t[v].y,d.x=1*g,d.y=-f,d.z=0*g,m.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case t.length-1:o.push(m.x,m.y,m.z);break;default:f=t[v+1].x-t[v].x,g=t[v+1].y-t[v].y,d.x=1*g,d.y=-f,d.z=0*g,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),o.push(d.x,d.y,d.z),m.copy(p)}for(let v=0;v<=e;v++){const r=n+v*c*i,d=Math.sin(r),p=Math.cos(r);for(let n=0;n<=t.length-1;n++){h.x=t[n].x*d,h.y=t[n].y,h.z=t[n].x*p,s.push(h.x,h.y,h.z),u.x=v/e,u.y=n/(t.length-1),a.push(u.x,u.y);const i=o[3*n+0]*d,r=o[3*n+1],c=o[3*n+0]*p;l.push(i,r,c)}}for(let v=0;v0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(u,3)),this.setAttribute("uv",new Zn(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new il(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rl extends il{constructor(t=1,e=1,n=32,i=1,r=!1,s=0,a=2*Math.PI){super(0,t,e,n,i,r,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(t){return new rl(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class sl extends si{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function a(t,e,n,i){const r=i+1,s=[];for(let a=0;a<=r;a++){s[a]=[];const i=t.clone().lerp(n,a/r),o=e.clone().lerp(n,a/r),l=r-a;for(let t=0;t<=l;t++)s[a][t]=0===t&&a===r?i:i.clone().lerp(o,t/l)}for(let a=0;a.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Zn(r,3)),this.setAttribute("normal",new Zn(r.slice(),3)),this.setAttribute("uv",new Zn(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new sl(t.vertices,t.indices,t.radius,t.details)}}class al extends sl{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new al(t.radius,t.detail)}}const ol=new Me,ll=new Me,cl=new Me,hl=new Un;class ul extends Qo{constructor(t){super(t),this.uuid=Ot(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n0)for(s=e;s=e;s-=i)a=Nl(s,t[s],t[s+1],a);return a&&El(a,a.next)&&(Ol(a),a=a.next),a}function pl(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!El(i,i.next)&&0!==Al(i.prev,i,i.next))i=i.next;else{if(Ol(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function ml(t,e,n,i,r,s,a){if(!t)return;!a&&s&&function(t,e,n,i){let r=t;do{0===r.z&&(r.z=Ml(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,s,a,o,l,c=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,i=n,o=0,e=0;e0||l>0&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(a>1)}(r)}(t,i,r,s);let o,l,c=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,s?gl(t,i,r,s):fl(t))e.push(o.i/n|0),e.push(t.i/n|0),e.push(l.i/n|0),Ol(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?ml(t=vl(pl(t),e,n),e,n,i,r,s,2):2===a&&yl(t,e,n,i,r,s):ml(pl(t),e,n,i,r,s,1);break}}function fl(t){const e=t.prev,n=t,i=t.next;if(Al(e,n,i)>=0)return!1;const r=e.x,s=n.x,a=i.x,o=e.y,l=n.y,c=i.y,h=rs?r>a?r:a:s>a?s:a,p=o>l?o>c?o:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=p&&Sl(r,o,s,l,a,c,m.x,m.y)&&Al(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function gl(t,e,n,i){const r=t.prev,s=t,a=t.next;if(Al(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,h=r.y,u=s.y,d=a.y,p=ol?o>c?o:c:l>c?l:c,g=h>u?h>d?h:d:u>d?u:d,v=Ml(p,m,e,n,i),y=Ml(f,g,e,n,i);let x=t.prevZ,_=t.nextZ;for(;x&&x.z>=v&&_&&_.z<=y;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==a&&Sl(o,h,l,u,c,d,x.x,x.y)&&Al(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,_.x>=p&&_.x<=f&&_.y>=m&&_.y<=g&&_!==r&&_!==a&&Sl(o,h,l,u,c,d,_.x,_.y)&&Al(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;x&&x.z>=v;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==a&&Sl(o,h,l,u,c,d,x.x,x.y)&&Al(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;_&&_.z<=y;){if(_.x>=p&&_.x<=f&&_.y>=m&&_.y<=g&&_!==r&&_!==a&&Sl(o,h,l,u,c,d,_.x,_.y)&&Al(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function vl(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!El(r,s)&&Rl(r,i,i.next,s)&&Ll(r,s)&&Ll(s,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(s.i/n|0),Ol(i),Ol(i.next),i=t=s),i=i.next}while(i!==t);return pl(i)}function yl(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Tl(a,t)){let o=Il(a,t);return a=pl(a,a.next),o=pl(o,o.next),ml(a,e,n,i,r,s,0),void ml(o,e,n,i,r,s,0)}t=t.next}a=a.next}while(a!==t)}function xl(t,e){return t.x-e.x}function _l(t,e){const n=function(t,e){let n,i=e,r=-1/0;const s=t.x,a=t.y;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){const t=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=s&&t>r&&(r=t,n=i.x=i.x&&i.x>=l&&s!==i.x&&Sl(an.x||i.x===n.x&&bl(n,i)))&&(n=i,u=h)),i=i.next}while(i!==o);return n}(t,e);if(!n)return e;const i=Il(n,t);return pl(i,i.next),pl(n,n.next)}function bl(t,e){return Al(t.prev,t,e.prev)<0&&Al(e.next,t,t.next)<0}function Ml(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function wl(t){let e=t,n=t;do{(e.x=(t-a)*(s-o)&&(t-a)*(i-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(r-a)*(i-o)}function Tl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Rl(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Ll(t,e)&&Ll(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(Al(t.prev,t,e.prev)||Al(t,e.prev,e))||El(t,e)&&Al(t.prev,t,t.next)>0&&Al(e.prev,e,e.next)>0)}function Al(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function El(t,e){return t.x===e.x&&t.y===e.y}function Rl(t,e,n,i){const r=Pl(Al(t,e,n)),s=Pl(Al(t,e,i)),a=Pl(Al(n,i,t)),o=Pl(Al(n,i,e));return r!==s&&a!==o||!(0!==r||!Cl(t,n,e))||!(0!==s||!Cl(t,i,e))||!(0!==a||!Cl(n,t,i))||!(0!==o||!Cl(n,e,i))}function Cl(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Pl(t){return t>0?1:t<0?-1:0}function Ll(t,e){return Al(t.prev,t,t.next)<0?Al(t,e,t.next)>=0&&Al(t,t.prev,e)>=0:Al(t,e,t.prev)<0||Al(t,t.next,e)<0}function Il(t,e){const n=new Dl(t.i,t.x,t.y),i=new Dl(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Nl(t,e,n,i){const r=new Dl(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Ol(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Dl(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Ul{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r80*n){o=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),d>h&&(h=d);p=Math.max(c-o,h-l),p=0!==p?32767/p:0}return ml(s,a,n,o,l,p,0),a}(n,i);for(let o=0;o2&&t[e-1].equals(t[0])&&t.pop()}function Fl(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-o/u,m=e.y+a/u,f=((n.x-c/d-p)*c-(n.y+l/d-m)*l)/(a*c-o*l);i=p+a*f-t.x,r=m+o*f-t.y;const g=i*i+r*r;if(g<=2)return new Xt(i,r);s=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),t?(i=-o,r=a,s=Math.sqrt(h)):(i=a,r=o,s=Math.sqrt(h/2))}return new Xt(i/s,r/s)}const L=[];for(let e=0,n=A.length,i=n-1,r=e+1;e=0;e--){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=u*Math.sin(t*Math.PI/2)+d;for(let e=0,r=A.length;e=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=o+2*p;t0)&&d.push(e,i,a),(g!==n-1||o0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class nc extends Fn{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Gn(16777215),this.specular=new Gn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Xt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=w,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ic extends Fn{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Gn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Xt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class rc extends Fn{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Xt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class sc extends Fn{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Gn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Xt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=w,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ac extends Fn{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Gn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Xt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class oc extends yo{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function lc(t,e,n){return hc(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)}function cc(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function hc(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function uc(t){const e=t.length,n=new Array(e);for(let i=0;i!==e;++i)n[i]=i;return n.sort((function(e,n){return t[e]-t[n]})),n}function dc(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[a++]=t[i+n]}return r}function pc(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(e.push(s.time),n.push.apply(n,a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(e.push(s.time),a.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(e.push(s.time),n.push(a)),s=t[r++]}while(void 0!==s)}class mc{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let s;n:{i:if(!(t=r)break t;{const a=e[1];t=r)break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=lc(n,r,s),this.values=lc(this.values,r*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let a=0;a!==r;a++){const e=n[a];if("number"==typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,e),t=!1;break}if(null!==s&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,e,s),t=!1;break}s=e}if(void 0!==i&&hc(i))for(let a=0,o=i.length;a!==o;++a){const e=i[a];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,e),t=!1;break}}return t}optimize(){const t=lc(this.times),e=lc(this.values),n=this.getValueSize(),i=this.getInterpolation()===lt,r=t.length-1;let s=1;for(let a=1;a0){t[s]=t[r];for(let t=r*n,i=s*n,a=0;a!==n;++a)e[i+a]=e[t+a];++s}return s!==t.length?(this.times=lc(t,0,s),this.values=lc(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=lc(this.times,0),e=lc(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}yc.prototype.TimeBufferType=Float32Array,yc.prototype.ValueBufferType=Float32Array,yc.prototype.DefaultInterpolation=ot;class xc extends yc{}xc.prototype.ValueTypeName="bool",xc.prototype.ValueBufferType=Array,xc.prototype.DefaultInterpolation=at,xc.prototype.InterpolantFactoryMethodLinear=void 0,xc.prototype.InterpolantFactoryMethodSmooth=void 0;class _c extends yc{}_c.prototype.ValueTypeName="color";class bc extends yc{}bc.prototype.ValueTypeName="number";class Mc extends mc{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-e)/(i-e);let l=t*a;for(let c=l+a;l!==c;l+=4)be.slerpFlat(r,0,s,l-a,s,l,o);return r}}class wc extends yc{InterpolantFactoryMethodLinear(t){return new Mc(this.times,this.values,this.getValueSize(),t)}}wc.prototype.ValueTypeName="quaternion",wc.prototype.DefaultInterpolation=ot,wc.prototype.InterpolantFactoryMethodSmooth=void 0;class Sc extends yc{}Sc.prototype.ValueTypeName="string",Sc.prototype.ValueBufferType=Array,Sc.prototype.DefaultInterpolation=at,Sc.prototype.InterpolantFactoryMethodLinear=void 0,Sc.prototype.InterpolantFactoryMethodSmooth=void 0;class Tc extends yc{}Tc.prototype.ValueTypeName="vector";class Ac{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=Ot(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let s=0,a=n.length;s!==a;++s)e.push(Ec(n[s]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,s=n.length;r!==s;++r)e.push(yc.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let a=0;a1){const t=n[1];let r=i[t];r||(i[t]=r=[]),r.push(e)}}const s=[];for(const a in i)s.push(this.CreateFromMorphTargetSequence(a,i[a],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const s=[],a=[];pc(n,s,a,i),0!==s.length&&r.push(new t(e,s,a))}},i=[],r=t.name||"default",s=t.fps||30,a=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let c=0;c{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Ic[t])return void Ic[t].push({onLoad:e,onProgress:n,onError:i});Ic[t]=[],Ic[t].push({onLoad:e,onProgress:n,onError:i});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=Ic[t],i=e.body.getReader(),r=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=n.length;t{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{Rc.add(t,e);const n=Ic[t];delete Ic[t];for(let t=0,i=n.length;t{const n=Ic[t];if(void 0===n)throw this.manager.itemError(t),e;delete Ic[t];for(let t=0,i=n.length;t{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Dc extends Lc{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Rc.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const a=$t("img");function o(){c(),Rc.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}class Uc extends Lc{constructor(t){super(t)}load(t,e,n,i){const r=new fe,s=new Dc(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class Bc extends Sn{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Gn(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}class Fc extends Bc{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Sn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Gn(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const kc=new $e,zc=new Me,Vc=new Me;class Hc{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Xt(512,512),this.map=null,this.mapPass=null,this.matrix=new $e,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Gi,this._frameExtents=new Xt(1,1),this._viewportCount=1,this._viewports=[new ge(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;zc.setFromMatrixPosition(t.matrixWorld),e.position.copy(zc),Vc.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Vc),e.updateMatrixWorld(),kc.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(kc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(kc)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Gc extends Hc{constructor(){super(new Ii(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=2*Nt*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class Wc extends Bc{constructor(t,e,n=0,i=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Sn.DEFAULT_UP),this.updateMatrix(),this.target=new Sn,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Gc}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const jc=new $e,Xc=new Me,qc=new Me;class Yc extends Hc{constructor(){super(new Ii(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Xt(4,2),this._viewportCount=6,this._viewports=[new ge(2,1,1,1),new ge(0,1,1,1),new ge(3,1,1,1),new ge(1,1,1,1),new ge(3,0,1,1),new ge(1,0,1,1)],this._cubeDirections=[new Me(1,0,0),new Me(-1,0,0),new Me(0,0,1),new Me(0,0,-1),new Me(0,1,0),new Me(0,-1,0)],this._cubeUps=[new Me(0,1,0),new Me(0,1,0),new Me(0,1,0),new Me(0,1,0),new Me(0,0,1),new Me(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Xc.setFromMatrixPosition(t.matrixWorld),n.position.copy(Xc),qc.copy(n.position),qc.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(qc),n.updateMatrixWorld(),i.makeTranslation(-Xc.x,-Xc.y,-Xc.z),jc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jc)}}class Kc extends Bc{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Yc}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class Jc extends Hc{constructor(){super(new ir(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Zc extends Bc{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Sn.DEFAULT_UP),this.updateMatrix(),this.target=new Sn,this.shadow=new Jc}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class $c extends Bc{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class Qc extends Bc{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class th{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new Me)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*i),e.addScaledVector(s[2],.488603*r),e.addScaledVector(s[3],.488603*n),e.addScaledVector(s[4],n*i*1.092548),e.addScaledVector(s[5],i*r*1.092548),e.addScaledVector(s[6],.315392*(3*r*r-1)),e.addScaledVector(s[7],n*r*1.092548),e.addScaledVector(s[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*i),e.addScaledVector(s[2],1.023328*r),e.addScaledVector(s[3],1.023328*n),e.addScaledVector(s[4],.858086*n*i),e.addScaledVector(s[5],.858086*i*r),e.addScaledVector(s[6],.743125*r*r-.247708),e.addScaledVector(s[7],.858086*n*r),e.addScaledVector(s[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}class eh extends Bc{constructor(t=new th,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class nh extends Lc{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,s=new Oc(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(s){i?i(s):console.error(s),r.manager.itemError(t)}}),n,i)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const i=nh.createMaterialFromType(t.type);if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=t.sheen),void 0!==t.sheenColor&&(i.sheenColor=(new Gn).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(i.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.specularIntensity&&(i.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.iridescence&&(i.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(i.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.thickness&&(i.thickness=t.thickness),void 0!==t.attenuationDistance&&(i.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(t.attenuationColor),void 0!==t.anisotropy&&(i.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(i.anisotropyRotation=t.anisotropyRotation),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.shadowSide&&(i.shadowSide=t.shadowSide),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.alphaHash&&(i.alphaHash=t.alphaHash),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),1!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.alphaToCoverage&&(i.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(i.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(i.forceSinglePass=t.forceSinglePass),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const r in t.uniforms){const e=t.uniforms[r];switch(i.uniforms[r]={},e.type){case"t":i.uniforms[r].value=n(e.value);break;case"c":i.uniforms[r].value=(new Gn).setHex(e.value);break;case"v2":i.uniforms[r].value=(new Xt).fromArray(e.value);break;case"v3":i.uniforms[r].value=(new Me).fromArray(e.value);break;case"v4":i.uniforms[r].value=(new ge).fromArray(e.value);break;case"m3":i.uniforms[r].value=(new qt).fromArray(e.value);break;case"m4":i.uniforms[r].value=(new $e).fromArray(e.value);break;default:i.uniforms[r].value=e.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(i.glslVersion=t.glslVersion),void 0!==t.extensions)for(const r in t.extensions)i.extensions[r]=t.extensions[r];if(void 0!==t.lights&&(i.lights=t.lights),void 0!==t.clipping&&(i.clipping=t.clipping),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new Xt).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Xt).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(i.iridescenceMap=n(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.anisotropyMap&&(i.anisotropyMap=n(t.anisotropyMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}static createMaterialFromType(t){return new{ShadowMaterial:$l,SpriteMaterial:Ra,RawShaderMaterial:Ql,ShaderMaterial:Pi,PointsMaterial:Co,MeshPhysicalMaterial:ec,MeshStandardMaterial:tc,MeshPhongMaterial:nc,MeshToonMaterial:ic,MeshNormalMaterial:rc,MeshLambertMaterial:sc,MeshDepthMaterial:oa,MeshDistanceMaterial:la,MeshBasicMaterial:jn,MeshMatcapMaterial:ac,LineDashedMaterial:oc,LineBasicMaterial:yo,Material:Fn}[t]}}class ih{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,r=t.length;i0){const n=new Cc(e);r=new Dc(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,r=t.length;e0){i=new Dc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let o=e,l=e+e;o!==l;++o)if(n[o]!==n[o+e]){a.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let r=n,s=i;r!==s;++r)e[r]=e[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let s=0;s!==r;++s)t[e+s]=t[n+s]}_slerp(t,e,n,i){be.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;be.multiplyQuaternionsFlat(t,s,t,e,t,n),be.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[n+a]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const mh="\\[\\]\\.:\\/",fh=new RegExp("["+mh+"]","g"),gh="[^"+mh+"]",vh="[^"+mh.replace("\\.","")+"]",yh=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",gh)+/(WCOD+)?/.source.replace("WCOD",vh)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",gh)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",gh)+"$"),xh=["material","materials","bones","map"];class _h{constructor(t,e,n){this.path=e,this.parsedPath=n||_h.parseTrackName(e),this.node=_h.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new _h.Composite(t,e,n):new _h(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(fh,"")}static parseTrackName(t){const e=yh.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==xh.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(a);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const s=2202===n;if(0===t)return-1===r||!s||1&~r?i:e-i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&!(1&~r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=ht,i.endingEnd=ht):(i.endingStart=t?this.zeroSlopeAtStart?ht:ct:ut,i.endingEnd=e?this.zeroSlopeAtEnd?ht:ct:ut)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=n,this}}const Mh=new Float32Array(1);class wh extends Pt{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,a=t._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let h=0;h!==r;++h){const t=i[h],r=t.name;let l=c[r];if(void 0!==l)++l.referenceCount,s[h]=l;else{if(l=s[h],void 0!==l){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,o,r));continue}const i=e&&e._propertyBindings[h].binding.parsedPath;l=new ph(_h.create(n,r,i),t.ValueTypeName,t.getValueSize()),++l.referenceCount,this._addInactiveBinding(l,o,r),s[h]=l}a[h].resultBuffer=l.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let l=0;l!==n;++l)e[l]._update(i,t,r,s);const a=this._bindings,o=this._nActiveBindings;for(let l=0;l!==o;++l)a[l].apply(s);return this}setTime(t){this.time=0;for(let e=0;ethis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Rh).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Ph=new Me,Lh=new Me;class Ih{constructor(t=new Me,e=new Me){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Ph.subVectors(t,this.start),Lh.subVectors(this.end,this.start);const n=Lh.dot(Lh);let i=Lh.dot(Ph)/n;return e&&(i=Dt(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Nh=new Me;class Oh extends Sn{constructor(t,e){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const n=new si,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,a=1,o=32;sNumber.EPSILON){if(l<0&&(n=e[s],o=-o,a=e[r],l=-l),t.ya.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-o*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return i}const n=Ul.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,a;const o=[];if(1===i.length)return s=i[0],a=new ul,a.curves=s.curves,o.push(a),o;let l=!n(i[0].getPoints());l=t?!l:l;const c=[],h=[];let u,d,p=[],m=0;h[m]=void 0,p[m]=[];for(let f=0,g=i.length;f1){let t=!1,n=0;for(let e=0,i=h.length;e0&&!1===t&&(p=c)}for(let f=0,g=h.length;f{if(Vh.has(t)){const e=Vh.get(t);if(void 0===e)return;if(e>=5)return;Vh.set(t,e+1)}else Vh.set(t,1);e?console.error(`%c [enable3d] ${t} `,"background: #222; color: #bada55"):console.warn(`%c [enable3d] ${t} `,"background: #222; color: #bada55")};var Gh={},Wh={};Object.defineProperty(Wh,"__esModule",{value:!0}),Wh.VERSION=void 0,Wh.VERSION="0.0.5";var jh=t&&t.__spreadArray||function(t,e){for(var n=0,i=e.length,r=t.length;n{t()})):this.eventEmitter.on("update",(()=>{t()}))}get on(){return{update:t=>this.onUpdateEvent(t),collision:t=>this.onCollision(t)}}get once(){return{update:t=>this.onUpdateEvent(t,!0)}}onCollision(t){this.checkCollisions=!0,this.physics.collisionEvents.on("collision",(e=>{const{bodies:n,event:i}=e;n[0].name===this.name?t(n[1],i):n[1].name===this.name&&t(n[0],i)}))}transform(){const t=this.physics.worldTransform;this.ammo.getMotionState().getWorldTransform(t)}refresh(){const t=this.physics.worldTransform;this.ammo.getMotionState().setWorldTransform(t)}setRotation(t,e,n){const i=this.tmpEuler.set(t,e,n),r=this.tmpQuaternion.set(0,0,0,1);r.setFromEuler(i),this.tmpBtQuaternion.setValue(0,0,0,1);const s=this.tmpBtQuaternion;s.setValue(r.x,r.y,r.z,r.w),this.physics.worldTransform.setRotation(s)}get rotation(){let t,e,n;const i=this.physics.worldTransform.getRotation();let r=this.tmpQuaternion.set(i.x(),i.y(),i.z(),i.w());r.w>1&&(r=r.normalize());const s=2*Math.acos(r.w),a=Math.sqrt(1-r.w*r.w);return a<.001?(t=r.x,e=r.y,n=r.z):(t=r.x/a,e=r.y/a,n=r.z/a),{x:t*s,y:e*s,z:n*s}}get quaternion(){const t=this.physics.worldTransform.getRotation();return{x:t.x(),y:t.y(),z:t.z(),w:t.w()}}setPosition(t,e,n){this.physics.worldTransform.getOrigin().setValue(t,e,n)}get position(){const t=this.physics.worldTransform;return{x:t.getOrigin().x(),y:t.getOrigin().y(),z:t.getOrigin().z()}}get velocity(){return{x:this.ammo.getLinearVelocity().x(),y:this.ammo.getLinearVelocity().y(),z:this.ammo.getLinearVelocity().z()}}get angularVelocity(){return{x:this.ammo.getAngularVelocity().x(),y:this.ammo.getAngularVelocity().y(),z:this.ammo.getAngularVelocity().z()}}setVelocity(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.setLinearVelocity(this.tmpBtVector3)}setVelocityX(t){this.tmpBtVector3.setValue(t,this.velocity.y,this.velocity.z),this.ammo.setLinearVelocity(this.tmpBtVector3)}setVelocityY(t){this.tmpBtVector3.setValue(this.velocity.x,t,this.velocity.z),this.ammo.setLinearVelocity(this.tmpBtVector3)}setVelocityZ(t){this.tmpBtVector3.setValue(this.velocity.x,this.velocity.y,t),this.ammo.setLinearVelocity(this.tmpBtVector3)}setAngularVelocity(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.setAngularVelocity(this.tmpBtVector3)}setAngularVelocityX(t){this.tmpBtVector3.setValue(t,this.angularVelocity.y,this.angularVelocity.z),this.ammo.setAngularVelocity(this.tmpBtVector3)}setAngularVelocityY(t){this.tmpBtVector3.setValue(this.angularVelocity.x,t,this.angularVelocity.z),this.ammo.setAngularVelocity(this.tmpBtVector3)}setAngularVelocityZ(t){this.tmpBtVector3.setValue(this.angularVelocity.x,this.angularVelocity.y,t),this.ammo.setAngularVelocity(this.tmpBtVector3)}applyForce(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyCentralImpulse(this.tmpBtVector3)}applyForceX(t){this.tmpBtVector3.setValue(t,0,0),this.ammo.applyCentralImpulse(this.tmpBtVector3)}applyForceY(t){this.tmpBtVector3.setValue(0,t,0),this.ammo.applyCentralImpulse(this.tmpBtVector3)}applyForceZ(t){this.tmpBtVector3.setValue(0,0,t),this.ammo.applyCentralImpulse(this.tmpBtVector3)}applyCentralForce(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyCentralForce(this.tmpBtVector3)}applyCentralImpulse(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyCentralImpulse(this.tmpBtVector3)}applyCentralLocalForce(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyCentralLocalForce(this.tmpBtVector3)}applyImpulse(t,e){this.tmpBtVector3.setValue(t.x||0,t.y||0,t.z||0),this.tmpBtVector3_1.setValue(e.x||0,e.y||0,e.z||0),this.ammo.applyImpulse(this.tmpBtVector3,this.tmpBtVector3_1)}applyLocalTorque(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyLocalTorque(this.tmpBtVector3)}applyTorque(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyTorque(this.tmpBtVector3)}applyTorqueImpulse(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.applyTorqueImpulse(this.tmpBtVector3)}setCollisionFlags(t){this.ammo.setCollisionFlags(t)}getCollisionFlags(){return this.ammo.getCollisionFlags()}setRestitution(t){this.ammo.setRestitution(t)}setBounciness(t){this.setRestitution(t)}setFriction(t){this.ammo.setFriction(t)}setDamping(t,e){this.ammo.setDamping(t,e)}setGravity(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.setGravity(this.tmpBtVector3)}setLinearFactor(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.setLinearFactor(this.tmpBtVector3)}setAngularFactor(t,e,n){this.tmpBtVector3.setValue(t,e,n),this.ammo.setAngularFactor(this.tmpBtVector3)}setCcdMotionThreshold(t){this.ammo.setCcdMotionThreshold(t)}setCcdSweptSphereRadius(t){this.ammo.setCcdSweptSphereRadius(t)}}class Qh extends Sn{constructor(){super(),this.isExtendedObject3D=!0,this.isGroup=!1,this.vector3=new Me,this.hasBody=!1,this.fragmentDepth=0,this.breakable=!1,this.fractureImpulse=1,this._currentAnimation="",this._animationActions=new Map,this.name=`object-${this.id}`}get world(){return{theta:this.worldTheta,phi:this.worldPhi}}get worldTheta(){return this.getWorldDirection(this.vector3),Math.atan2(this.vector3.x,this.vector3.z)}get worldPhi(){return this.getWorldDirection(this.vector3),Math.acos(this.vector3.y)}set animationMixer(t){this._animationMixer=t}get animationMixer(){return this._animationMixer||(this._animationMixer=new wh(this)),this._animationMixer}get anims(){return{current:this._currentAnimation,add:(t,e)=>this._animsAdd(t,e),get:t=>this._animsGet(t),play:(t,e=500,n=!0)=>this._animsPlay(t,e,n),mixer:this.animationMixer}}get animation(){return Hh('Please use "anims" instead of "animation"'),this.anims}_animsAdd(t,e){this._animationActions.set(t,this.animationMixer.clipAction(e))}_animsGet(t){const e=this._animationActions.get(t);return e||Hh(`Animation(${t}) not found!`),e}_animsPlay(t,e=500,n=!0){const i=this._animationActions.get(t),r=this._animationActions.get(this._currentAnimation);i&&(i.reset(),r&&(i.crossFadeFrom(r,e/1e3,!0),i.clampWhenFinished=!0),n||i.setLoop(2200,0),i.play()),this._currentAnimation=t}setAction(t){Hh(`setAction(${t}) is deprecated. Use animation.play(${t}) instead!`)}traverse(t){super.traverse(t)}traverseVisible(t){super.traverseVisible(t)}traverseAncestors(t){super.traverseAncestors(t)}}class tu extends wi{constructor(t,e){super(t,e),this.isExtendedMesh=!0,this.isGroup=!1,this.vector3=new Me,this.hasBody=!1,this.fragmentDepth=0,this.breakable=!1,this.fractureImpulse=1,this.name=`object-${this.id}`}get world(){return{theta:this.worldTheta,phi:this.worldPhi}}get worldTheta(){return this.getWorldDirection(this.vector3),Math.atan2(this.vector3.x,this.vector3.z)}get worldPhi(){return this.getWorldDirection(this.vector3),Math.acos(this.vector3.y)}}class eu{constructor(t,e){this.factory=t,this.addExisting=e}addPlane(t={},e={}){const n=this.factory.add.plane(t,e);return this.addExisting(n,t),n}addSphere(t={},e={}){const n=this.factory.add.sphere(t,e);return this.addExisting(n,t),n}addBox(t={},e={}){const n=this.factory.add.box(t,e);return this.addExisting(n,t),n}addGround(t,e={}){const n=this.factory.add.ground(t,e),i={...t,mass:0,collisionFlags:1};return this.addExisting(n,i),n}addCapsule(t={},e={}){const n=this.factory.add.capsule(t,e);return this.addExisting(n,t),n}addCylinder(t={},e={}){const n=this.factory.add.cylinder(t,e);return this.addExisting(n,t),n}addCone(t={},e={}){const n=this.factory.add.cone(t,e);return this.addExisting(n,t),n}addTorus(t={},e={}){const n=this.factory.add.torus(t,e);return this.addExisting(n,t),n}addExtrude(t,e={}){const n=this.factory.add.extrude(t,e);return n.translateX(1),this.addExisting(n),n}}class nu{constructor(t,e){this.worldTransform=t,this.physicsWorld=e,this.tmpBtVector3=new Ammo.btVector3}toAmmoV3(t,e=0){return new Ammo.btVector3(void 0!==(null==t?void 0:t.x)?t.x:e,void 0!==(null==t?void 0:t.y)?t.y:e,void 0!==(null==t?void 0:t.z)?t.z:e)}get addConstraints(){return{lock:(t,e,n)=>this.lock(t,e,n),fixed:(t,e,n)=>this.fixed(t,e,n),pointToPoint:(t,e,n,i)=>this.pointToPoint(t,e,n,i),hinge:(t,e,n,i)=>this.hinge(t,e,n,i),slider:(t,e,n={},i)=>this.slider(t,e,n,i),spring:(t,e,n={},i)=>this.spring(t,e,n,i),coneTwist:(t,e,n={frameA:{},frameB:{}},i)=>this.coneTwist(t,e,n,i),dof:(t,e,n,i)=>this.dof(t,e,n,i)}}getTransform(t,e,n={x:0,y:0,z:0},i=!1){n={x:0,y:0,z:0,...n};const r=new Ammo.btTransform;if(r.setIdentity(),i){const i=(s=t.getWorldTransform().getOrigin(),a=e.getWorldTransform().getOrigin(),o=(s.x()-a.x())/2+n.x,l=(s.y()-a.y())/2+n.y,c=(s.z()-a.z())/2+n.z,new Ammo.btVector3(o,l,c)),r=new Ammo.btTransform;r.setIdentity(),r.setOrigin(i);const h=t.getCenterOfMassTransform().inverse().op_mul(e.getWorldTransform());return h.op_mul(r),{transformA:h,transformB:r}}return r.setOrigin(new Ammo.btVector3(n.x,n.y,n.z)),{transformA:t.getCenterOfMassTransform().inverse().op_mul(e.getWorldTransform()).op_mul(r),transformB:r};var s,a,o,l,c}lock(t,e,n=!0){const i={x:0,y:0,z:0};return this.dof(t,e,{angularLowerLimit:i,angularUpperLimit:i},n)}fixed(t,e,n=!0){const i=this.getTransform(t.ammo,e.ammo);i.transformA.setRotation(t.ammo.getWorldTransform().getRotation()),i.transformB.setRotation(e.ammo.getWorldTransform().getRotation());const r=new Ammo.btFixedConstraint(t.ammo,e.ammo,i.transformA,i.transformB);return this.physicsWorld.addConstraint(r,n),r}pointToPoint(t,e,n={},i=!0){const{pivotA:r,pivotB:s}=n,a=new Ammo.btVector3((null==r?void 0:r.x)||0,(null==r?void 0:r.y)||0,(null==r?void 0:r.z)||0),o=new Ammo.btVector3((null==s?void 0:s.x)||0,(null==s?void 0:s.y)||0,(null==s?void 0:s.z)||0),l=new Ammo.btPoint2PointConstraint(t.ammo,e.ammo,a,o);return this.physicsWorld.addConstraint(l,i),l}hinge(t,e,n={},i=!0){const{pivotA:r,pivotB:s,axisA:a,axisB:o}=n,l=new Ammo.btVector3((null==r?void 0:r.x)||0,(null==r?void 0:r.y)||0,(null==r?void 0:r.z)||0),c=new Ammo.btVector3((null==s?void 0:s.x)||0,(null==s?void 0:s.y)||0,(null==s?void 0:s.z)||0),h=new Ammo.btVector3((null==a?void 0:a.x)||0,(null==a?void 0:a.y)||0,(null==a?void 0:a.z)||0),u=new Ammo.btVector3((null==o?void 0:o.x)||0,(null==o?void 0:o.y)||0,(null==o?void 0:o.z)||0),d=new Ammo.btHingeConstraint(t.ammo,e.ammo,l,c,h,u,!0);return this.physicsWorld.addConstraint(d,i),d}slider(t,e,n={},i=!0){const r=this.getTransform(t.ammo,e.ammo),{frameA:s={},frameB:a={},linearLowerLimit:o=0,linearUpperLimit:l=0,angularLowerLimit:c=0,angularUpperLimit:h=0}=n,u=r.transformA.getRotation();u.setEulerZYX(s.x||0,s.y||0,s.z||0),r.transformA.setRotation(u);const d=r.transformB.getRotation();d.setEulerZYX(a.x||0,a.y||0,a.z||0),r.transformB.setRotation(d);const p=new Ammo.btSliderConstraint(t.ammo,e.ammo,r.transformA,r.transformB,!0);return p.setLowerLinLimit(o),p.setUpperLinLimit(l),p.setLowerAngLimit(c),p.setUpperAngLimit(h),this.physicsWorld.addConstraint(p,i),p}spring(t,e,n={},i=!0){const{stiffness:r=50,damping:s=.01,angularLock:a=!1,linearLowerLimit:o={},linearUpperLimit:l={},angularLowerLimit:c={},angularUpperLimit:h={},offset:u={},center:d=!1,enableSpring:p=!0}=n,m={x:0,y:0,z:0,...u},f=this.getTransform(t.ammo,e.ammo,m,d),g=new Ammo.btGeneric6DofSpringConstraint(t.ammo,e.ammo,f.transformA,f.transformB,!0);this.tmpBtVector3.setValue(o.x||0,o.y||0,o.z||0),g.setLinearLowerLimit(this.tmpBtVector3),this.tmpBtVector3.setValue(l.x||0,l.y||0,l.z||0),g.setLinearUpperLimit(this.tmpBtVector3),a?(this.tmpBtVector3.setValue(0,0,0),g.setAngularLowerLimit(this.tmpBtVector3),g.setAngularUpperLimit(this.tmpBtVector3)):(console.log(c,h),g.setAngularLowerLimit(this.toAmmoV3(c,-Math.PI)),g.setAngularUpperLimit(this.toAmmoV3(h,Math.PI)));for(let v=0;v<3;v++)g.enableSpring(v,p),g.setStiffness(v,r),g.setDamping(v,s);return this.physicsWorld.addConstraint(g,i),g}coneTwist(t,e,n,i=!0){const{frameA:r,frameB:s}=n,a=new Ammo.btTransform;a.setIdentity(),a.getOrigin().setValue((null==r?void 0:r.x)||0,(null==r?void 0:r.y)||0,(null==r?void 0:r.z)||0);const o=new Ammo.btTransform;o.setIdentity(),o.getOrigin().setValue((null==s?void 0:s.x)||0,(null==s?void 0:s.y)||0,(null==s?void 0:s.z)||0),this.getTransform(t.ammo,e.ammo);const l=new Ammo.btConeTwistConstraint(e.ammo,t.ammo,a,o);return l.setAngularOnly(!0),this.physicsWorld.addConstraint(l,i),l}dof(t,e,n={},i=!0){const{offset:r,center:s=!1}=n,a={x:0,y:0,z:0,...r},o=this.getTransform(t.ammo,e.ammo,a,s),l=new Ammo.btGeneric6DofConstraint(t.ammo,e.ammo,o.transformA,o.transformB,!0),{linearLowerLimit:c,linearUpperLimit:h,angularLowerLimit:u,angularUpperLimit:d}=n,p=this.toAmmoV3(c),m=this.toAmmoV3(h),f=this.toAmmoV3(u,-Math.PI),g=this.toAmmoV3(d,Math.PI);return l.setLinearLowerLimit(p),l.setLinearUpperLimit(m),l.setAngularLowerLimit(f),l.setAngularUpperLimit(g),Ammo.destroy(p),Ammo.destroy(m),Ammo.destroy(f),Ammo.destroy(g),this.physicsWorld.addConstraint(l,i),l}}const iu="hull",ru="manual",su=function(){const t=new Me,e=new Me,n=new $e;return function(i,r,s,a={}){if(a.type=iu,cu(a),a.fit===ru)return console.warn("cannot use fit: manual with type: hull"),null;const o=pu(i,r),l=new Ammo.btVector3,c=new Ammo.btConvexHullShape;c.setMargin(a.margin),e.addVectors(o.max,o.min).multiplyScalar(.5);let h=0;for(let t=0;tu&&console.warn(`too many vertices for hull shape; sampling ~${u} from ~${h} vertices`);const d=Math.min(1,u/h);for(let m=0;m=100){const t=new Ammo.btShapeHull(c);t.buildHull(a.margin),Ammo.destroy(c),p=new Ammo.btConvexHullShape(Ammo.getPointer(t.getVertexPointer()),t.numVertices()),Ammo.destroy(t)}return Ammo.destroy(l),hu(p,a,du(s,a)),p}}(),au=function(){const t=new Me,e=new Me,n=new $e;return function(i,r,s,a,o={}){if(o.type="hacd",cu(o),o.fit===ru)return console.warn("cannot use fit: manual with type: hacd"),[];if(!Ammo.hasOwnProperty("HACD"))return console.warn("HACD unavailable in included build of Ammo.js. Visit https://github.com/mozillareality/ammo.js for the latest version."),[];const l=pu(i,r);du(a,o);let c=0,h=0;e.addVectors(l.max,l.min).multiplyScalar(.5);for(let t=0;t=123?t.copy(e.matrixWorld).invert():t.getInverse(e.matrixWorld),(new Me).setFromMatrixScale(e.matrixWorld),e.traverse((n=>{const s=new $e;n.isMesh&&(i.includeInvisible||n.el&&n.el.object3D.visible||n.visible)&&(n===e?s.identity():(n.updateWorldMatrix(!0),s.multiplyMatrices(t,n.matrixWorld)),r(n.geometry.isBufferGeometry?n.geometry.attributes.position.array:n.geometry.vertices,s.elements,n.geometry.index?n.geometry.index.array:null))}))}}(),du=function(){const t=new $e;return function(e,n={}){const i=new Me(1,1,1);return"all"===n.fit&&(t.fromArray(e),i.setFromMatrixScale(t)),i}}();new Me;const pu=function(t,e){const n=new Te;let i=1/0,r=1/0,s=1/0,a=-1/0,o=-1/0,l=-1/0;return n.min.set(0,0,0),n.max.set(0,0,0),mu(t,e,(t=>{t.xa&&(a=t.x),t.y>o&&(o=t.y),t.z>l&&(l=t.z)})),n.min.set(i,r,s),n.max.set(a,o,l),n},mu=function(){const t=new Me,e=new $e;return function(n,i,r){for(let s=0;sthis.makePlane(t,e),box:(t={},e={})=>this.makeBox(t,e),sphere:(t={},e={})=>this.makeSphere(t,e),capsule:(t={},e={})=>this.makeCapsule(t,e),cylinder:(t={},e={})=>this.makeCylinder(t,e),cone:(t={},e={})=>this.makeCone(t,e),torus:(t={},e={})=>this.makeTorus(t,e),extrude:(t,e={})=>this.makeExtrude(t,e)}}get add(){return{mesh:t=>this.addMesh(t),existing:t=>this.addExisting(t),plane:(t={},e={})=>this.addPlane(t,e),box:(t={},e={})=>this.addBox(t,e),ground:(t,e={})=>this.addGround(t,e),sphere:(t={},e={})=>this.addSphere(t,e),capsule:(t={},e={})=>this.addCapsule(t,e),cylinder:(t={},e={})=>this.addCylinder(t,e),cone:(t={},e={})=>this.addCone(t,e),torus:(t={},e={})=>this.addTorus(t,e),extrude:(t,e={})=>this.addExtrude(t,e),material:(t={})=>this.addMaterial(t)}}addExisting(...t){"headless"!==this.scene&&this.scene.add(...t)}addMesh(t){if(Array.isArray(t))for(let e=0;e{var r,s;const{bodies:a,event:o}=i;(null==(r=a[0])?void 0:r.name)&&(null==(s=a[1])?void 0:s.name)&&(null==t?void 0:t.name)&&(null==e?void 0:e.name)&&(a[0].name===t.name&&a[1].name===e.name||a[1].name===t.name&&a[0].name===e.name)&&n(o)})))}}class yu{constructor(t,e,n={}){this.scene=t,this.world=e,this.options=n,this.debugDrawMode=n.debugDrawMode||1;const i=32768&this.debugDrawMode||!1,r=n.maxBufferSize||1e6;this.geometry=new si;const s=new Float32Array(3*r),a=new Float32Array(3*r);this.geometry.setAttribute("position",new Yn(s,3).setUsage(Tt)),this.geometry.setAttribute("color",new Yn(a,3).setUsage(Tt)),this.index=0;const o=new yo({vertexColors:!0,depthTest:!i});this.mesh=new Eo(this.geometry,o),i&&(this.mesh.renderOrder=999),this.mesh.frustumCulled=!1,this.enabled=!1,this.debugDrawer=new Ammo.DebugDrawer,this.debugDrawer.drawLine=this.drawLine.bind(this),this.debugDrawer.drawContactPoint=this.drawContactPoint.bind(this),this.debugDrawer.reportErrorWarning=this.reportErrorWarning.bind(this),this.debugDrawer.draw3dText=this.draw3dText.bind(this),this.debugDrawer.setDebugMode=this.setDebugMode.bind(this),this.debugDrawer.getDebugMode=this.getDebugMode.bind(this),this.world.setDebugDrawer(this.debugDrawer)}enable(){this.enabled=!0,this.scene.add(this.mesh)}disable(){this.enabled=!1,this.scene.remove(this.mesh)}update(){this.enabled&&(0!=this.index&&(this.geometry.attributes.position.needsUpdate=!0,this.geometry.attributes.color.needsUpdate=!0),this.index=0,this.world.debugDrawWorld(),this.geometry.setDrawRange(0,this.index))}drawLine(t,e,n){const i=Ammo.HEAPF32,r=i[(n+0)/4],s=i[(n+4)/4],a=i[(n+8)/4],o=i[(t+0)/4],l=i[(t+4)/4],c=i[(t+8)/4];this.geometry.attributes.position.setXYZ(this.index,o,l,c),this.geometry.attributes.color.setXYZ(this.index++,r,s,a);const h=i[(e+0)/4],u=i[(e+4)/4],d=i[(e+8)/4];this.geometry.attributes.position.setXYZ(this.index,h,u,d),this.geometry.attributes.color.setXYZ(this.index++,r,s,a)}drawContactPoint(t,e,n,i,r){const s=Ammo.HEAPF32,a=s[(r+0)/4],o=s[(r+4)/4],l=s[(r+8)/4],c=s[(t+0)/4],h=s[(t+4)/4],u=s[(t+8)/4];this.geometry.attributes.position.setXYZ(this.index,c,h,u),this.geometry.attributes.color.setXYZ(this.index++,a,o,l);const d=s[(e+0)/4]*n,p=s[(e+4)/4]*n,m=s[(e+8)/4]*n;this.geometry.attributes.position.setXYZ(this.index,c+d,h+p,u+m),this.geometry.attributes.color.setXYZ(this.index++,a,o,l)}reportErrorWarning(t){Ammo.hasOwnProperty("Pointer_stringify")?console.warn(Ammo.Pointer_stringify(t)):this.warnedOnce||(this.warnedOnce=!0,console.warn("Cannot print warningString, please rebuild Ammo.js using 'debug' flag"))}draw3dText(t,e){console.warn("TODO: draw3dText")}setDebugMode(t){this.debugDrawMode=t}getDebugMode(){return this.debugDrawMode}}const xu=new Me,_u=new Ih,bu=new zi,Mu=new Me,wu=new Un;class Su{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new Ru,this.unassigned=new Ru,this.vertices=[]}setFromPoints(t){if(t.length>=4){this.makeEmpty();for(let e=0,n=t.length;ethis.tolerance)return!1;return!0}intersectRay(t,e){const n=this.faces;let i=-1/0,r=1/0;for(let s=0,a=n.length;s0&&o>=0)return null;const l=0!==o?-a/o:0;if(!(l<=0)&&(o>0?r=Math.min(l,r):i=Math.max(l,i),i>r))return null}return i!==-1/0?t.at(i,e):t.at(r,e),e}intersectsRay(t){return null!==this.intersectRay(t,xu)}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(t,e){return t.face=e,null===e.outside?this.assigned.append(t):this.assigned.insertBefore(e.outside,t),e.outside=t,this}removeVertexFromFace(t,e){return t===e.outside&&(null!==t.next&&t.next.face===e?e.outside=t.next:e.outside=null),this.assigned.remove(t),this}removeAllVerticesFromFace(t){if(null!==t.outside){const e=t.outside;let n=t.outside;for(;null!==n.next&&n.next.face===t;)n=n.next;return this.assigned.removeSubList(e,n),e.prev=n.next=null,t.outside=null,e}}deleteFaceVertices(t,e){const n=this.removeAllVerticesFromFace(t);if(void 0!==n)if(void 0===e)this.unassigned.appendChain(n);else{let t=n;do{const n=t.next;e.distanceToPoint(t.point)>this.tolerance?this.addVertexToFace(t,e):this.unassigned.append(t),t=n}while(null!==t)}return this}resolveUnassignedPoints(t){if(!1===this.unassigned.isEmpty()){let e=this.unassigned.first();do{const n=e.next;let i=this.tolerance,r=null;for(let s=0;si&&(i=t,r=n),i>1e3*this.tolerance)break}}null!==r&&this.addVertexToFace(e,r),e=n}while(null!==e)}return this}computeExtremes(){const t=new Me,e=new Me,n=[],i=[];for(let r=0;r<3;r++)n[r]=i[r]=this.vertices[0];t.copy(this.vertices[0].point),e.copy(this.vertices[0].point);for(let r=0,s=this.vertices.length;re.getComponent(t)&&(e.setComponent(t,a.getComponent(t)),i[t]=s)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(t.x),Math.abs(e.x))+Math.max(Math.abs(t.y),Math.abs(e.y))+Math.max(Math.abs(t.z),Math.abs(e.z))),{min:n,max:i}}computeInitialHull(){const t=this.vertices,e=this.computeExtremes(),n=e.min,i=e.max;let r=0,s=0;for(let u=0;u<3;u++){const t=i[u].point.getComponent(u)-n[u].point.getComponent(u);t>r&&(r=t,s=u)}const a=n[s],o=i[s];let l,c;r=0,_u.set(a.point,o.point);for(let u=0,d=this.vertices.length;ur&&(r=t,l=e)}}r=-1,bu.setFromCoplanarPoints(a.point,o.point,l.point);for(let u=0,d=this.vertices.length;ur&&(r=t,c=e)}}const h=[];if(bu.distanceToPoint(c.point)<0){h.push(Tu.create(a,o,l),Tu.create(c,o,a),Tu.create(c,l,o),Tu.create(c,a,l));for(let t=0;t<3;t++){const e=(t+1)%3;h[t+1].getEdge(2).setTwin(h[0].getEdge(e)),h[t+1].getEdge(1).setTwin(h[e+1].getEdge(0))}}else{h.push(Tu.create(a,l,o),Tu.create(c,a,o),Tu.create(c,o,l),Tu.create(c,l,a));for(let t=0;t<3;t++){const e=(t+1)%3;h[t+1].getEdge(2).setTwin(h[0].getEdge((3-t)%3)),h[t+1].getEdge(0).setTwin(h[e+1].getEdge(1))}}for(let u=0;u<4;u++)this.faces.push(h[u]);for(let u=0,d=t.length;ur&&(r=i,t=this.faces[n])}null!==t&&this.addVertexToFace(e,t)}}return this}reindexFaces(){const t=[];for(let e=0;ee&&(e=r,t=i),i=i.next}while(null!==i&&i.face===n);return t}}computeHorizon(t,e,n,i){let r;this.deleteFaceVertices(n),n.mark=1,r=null===e?e=n.getEdge(0):e.next;do{const e=r.twin,n=e.face;0===n.mark&&(n.distanceToPoint(t)>this.tolerance?this.computeHorizon(t,e,n,i):i.push(r)),r=r.next}while(r!==e);return this}addAdjoiningFace(t,e){const n=Tu.create(t,e.tail(),e.head());return this.faces.push(n),n.getEdge(-1).setTwin(e.twin),n.getEdge(0)}addNewFaces(t,e){this.newFaces=[];let n=null,i=null;for(let r=0;r0;)e=e.next,t--;for(;t<0;)e=e.prev,t++;return e}compute(){const t=this.edge.tail(),e=this.edge.head(),n=this.edge.next.head();return wu.set(t.point,e.point,n.point),wu.getNormal(this.normal),wu.getMidpoint(this.midpoint),this.area=wu.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(t){return this.normal.dot(t)-this.constant}}class Au{constructor(t,e){this.vertex=t,this.prev=null,this.next=null,this.twin=null,this.face=e}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const t=this.head(),e=this.tail();return null!==e?e.point.distanceTo(t.point):-1}lengthSquared(){const t=this.head(),e=this.tail();return null!==e?e.point.distanceToSquared(t.point):-1}setTwin(t){return this.twin=t,t.twin=this,this}}class Eu{constructor(t){this.point=t,this.prev=null,this.next=null,this.face=null}}class Ru{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(t,e){return e.prev=t.prev,e.next=t,null===e.prev?this.head=e:e.prev.next=e,t.prev=e,this}insertAfter(t,e){return e.prev=t,e.next=t.next,null===e.next?this.tail=e:e.next.prev=e,t.next=e,this}append(t){return null===this.head?this.head=t:this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t,this}appendChain(t){for(null===this.head?this.head=t:this.tail.next=t,t.prev=this.tail;null!==t.next;)t=t.next;return this.tail=t,this}remove(t){return null===t.prev?this.head=t.next:t.prev.next=t.next,null===t.next?this.tail=t.prev:t.next.prev=t.prev,this}removeSubList(t,e){return null===t.prev?this.head=e.next:t.prev.next=e.next,null===e.next?this.tail=t.prev:e.next.prev=t.prev,this}isEmpty(){return null===this.head}}class Cu extends si{constructor(t=[]){super();const e=[],n=[],i=(new Su).setFromPoints(t).faces;for(let r=0;rnew(window.THREE&&window.THREE.ConvexGeometry?window.THREE.ConvexGeometry:Cu)(t),Lu=function(t,e){this.minSizeForBreak=t||1.4,this.smallDelta=e||1e-4,this.tempLine1=new Ih,this.tempPlane1=new zi,this.tempPlane2=new zi,this.tempPlane_Cut=new zi,this.tempCM1=new Me,this.tempCM2=new Me,this.tempVector3=new Me,this.tempVector3_2=new Me,this.tempVector3_3=new Me,this.tempVector3_P0=new Me,this.tempVector3_P1=new Me,this.tempVector3_P2=new Me,this.tempVector3_N0=new Me,this.tempVector3_N1=new Me,this.tempVector3_AB=new Me,this.tempVector3_CB=new Me,this.tempResultObjects={object1:null,object2:null},this.segments=[];for(var n=0;n<900;n++)this.segments[n]=!1};var Iu;Lu.prototype={constructor:Lu,prepareBreakableObject:function(t,e,n,i,r){t.geometry.isBufferGeometry||console.error("THREE.ConvexObjectBreaker.prepareBreakableObject(): Parameter object must have a BufferGeometry."),t.userData.ammoPhysicsData={};var s=t.userData.ammoPhysicsData;s.mass=e,s.velocity=n.clone(),s.angularVelocity=i.clone(),s.breakable=r},subdivideByImpact:function(t,e,n,i,r){var s=[],a=this.tempPlane1,o=this.tempPlane2;this.tempVector3.addVectors(e,n),a.setFromCoplanarPoints(e,t.position,this.tempVector3);var l=r+i,c=this;return function r(h,u,d,p){if(Math.random()<.05*p||p>l)s.push(h);else{var m=Math.PI;0===p?(o.normal.copy(a.normal),o.constant=a.constant):p<=i?(m=(d-u)*(.2+.6*Math.random())+u,c.tempVector3_2.copy(t.position).sub(e).applyAxisAngle(n,m).add(e),o.setFromCoplanarPoints(e,c.tempVector3,c.tempVector3_2)):(m=(.5*(1&p)+.2*(2-Math.random()))*Math.PI,c.tempVector3_2.copy(e).sub(h.position).applyAxisAngle(n,m).add(h.position),c.tempVector3_3.copy(n).add(h.position),o.setFromCoplanarPoints(h.position,c.tempVector3_3,c.tempVector3_2)),c.cutByPlane(h,o,c.tempResultObjects);var f=c.tempResultObjects.object1,g=c.tempResultObjects.object2;f&&r(f,u,m,p+1),g&&r(g,m,d,p+1)}}(t,0,2*Math.PI,0),s},cutByPlane:function(t,e,n){var i=t.geometry,r=i.attributes.position.array,s=i.attributes.normal.array,a=r.length/3,o=a/3,l=i.getIndex();function c(t,e){var n=3*t+e;return l?l[n]:n}l&&(o=(l=l.array).length/3);for(var h=[],u=[],d=this.smallDelta,p=a*a,m=0;md?(N=2,u.push(f.clone())):O<-d?(N=1,h.push(f.clone())):(N=3,h.push(f.clone()),u.push(f.clone()));var O,D=0;if((O=A.distanceToPoint(g))>d?(D=2,u.push(g.clone())):O<-d?(D=1,h.push(g.clone())):(D=3,h.push(g.clone()),u.push(g.clone())),1===N&&2===D||2===N&&1===D){this.tempLine1.start.copy(f),this.tempLine1.end.copy(g);var U=new Me;if(void 0===(U=A.intersectLine(this.tempLine1,U)))return console.error("Internal error: segment does not intersect plane."),n.segmentedObject1=null,n.segmentedObject2=null,0;h.push(U),u.push(U.clone())}}}var B=.5*t.userData.ammoPhysicsData.mass;this.tempCM1.set(0,0,0);var F=0,k=h.length;if(k>0){for(m=0;m0){for(m=0;m4)try{(G=new wi(Pu(h),t.material)).position.copy(this.tempCM1),G.quaternion.copy(t.quaternion),G.userData=t.userData,this.prepareBreakableObject(G,B,t.userData.ammoPhysicsData.velocity,t.userData.ammoPhysicsData.angularVelocity,2*F>this.minSizeForBreak),j++}catch(X){Hh("Error in ConvexObjectBreaker.ts",!0),Hh(X,!0)}if(V>4)try{(W=new wi(Pu(u),t.material)).position.copy(this.tempCM2),W.quaternion.copy(t.quaternion),W.userData=t.userData,this.prepareBreakableObject(W,B,t.userData.ammoPhysicsData.velocity,t.userData.ammoPhysicsData.angularVelocity,2*z>this.minSizeForBreak),j++}catch(X){Hh("Error in ConvexObjectBreaker.ts",!0),Hh(X,!0)}return n.object1=G,n.object2=W,j}},Lu.transformFreeVector=function(t,e){var n=t.x,i=t.y,r=t.z,s=e.elements;return t.x=s[0]*n+s[4]*i+s[8]*r,t.y=s[1]*n+s[5]*i+s[9]*r,t.z=s[2]*n+s[6]*i+s[10]*r,t},Lu.transformFreeVectorInverse=function(t,e){var n=t.x,i=t.y,r=t.z,s=e.elements;return t.x=s[0]*n+s[1]*i+s[2]*r,t.y=s[4]*n+s[5]*i+s[6]*r,t.z=s[8]*n+s[9]*i+s[10]*r,t},Lu.transformTiedVectorInverse=function(t,e){var n=t.x,i=t.y,r=t.z,s=e.elements;return t.x=s[0]*n+s[1]*i+s[2]*r-s[12],t.y=s[4]*n+s[5]*i+s[6]*r-s[13],t.z=s[8]*n+s[9]*i+s[10]*r-s[14],t},Lu.transformPlaneToLocalSpace=(Iu=new Me,function(t,e,n){n.normal.copy(t.normal),n.constant=t.constant;var i=Lu.transformTiedVectorInverse(t.coplanarPoint(Iu),e);Lu.transformFreeVectorInverse(n.normal,e),n.constant=-i.dot(n.normal)});const Nu=(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){t instanceof Error&&console.error(t.message)}return!1})();function Ou(t,e){e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((n=>{Object.defineProperty(t.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n)||Object.create(null))}))}))}class Du{constructor(t){this.physics=t}setRayFromWorld(t=0,e=0,n=0){this._btRayFrom.setValue(t,e,n)}setRayToWorld(t=0,e=0,n=0){this._btRayTo.setValue(t,e,n)}hasHit(){return this._btRayCallback.hasHit()}rayTest(){void 0!==this._btRayCallback&&Ammo.destroy(this._btRayCallback),this._btRayCallback="closest"===this.type?new Ammo.ClosestRayResultCallback(this._btRayFrom,this._btRayTo):new Ammo.AllHitsRayResultCallback(this._btRayFrom,this._btRayTo),this.physics.physicsWorld.rayTest(this._btRayFrom,this._btRayTo,this._btRayCallback)}destroy(){void 0!==this._btRayFrom&&Ammo.destroy(this._btRayFrom),void 0!==this._btRayTo&&Ammo.destroy(this._btRayTo),void 0!==this._btRayCallback&&Ammo.destroy(this._btRayCallback)}}class Uu{constructor(t){this.physics=t,this.type="closest",this._btRayFrom=new Ammo.btVector3(0,0,0),this._btRayTo=new Ammo.btVector3(0,0,0)}}class Bu{constructor(t){this.physics=t,this.type="allHits",this._btRayFrom=new Ammo.btVector3(0,0,0),this._btRayTo=new Ammo.btVector3(0,0,0)}}Ou(Uu,[Du,class{constructor(t){this.physics=t}getHitPointWorld(){const t=this._btRayCallback.get_m_hitPointWorld();return{x:t.x(),y:t.y(),z:t.z()}}getHitNormalWorld(){const t=this._btRayCallback.get_m_hitNormalWorld();return{x:t.x(),y:t.y(),z:t.z()}}getCollisionObject(){return Ammo.castObject(this._btRayCallback.get_m_collisionObject(),Ammo.btRigidBody).threeObject}}]),Ou(Bu,[Du,class{constructor(t){this.physics=t}getHitPointsWorld(){const t=this._btRayCallback.get_m_hitPointWorld(),e=[];for(let n=t.size()-1;n>=0;n--){const i=t.at(n);e.push({x:i.x(),y:i.y(),z:i.z()})}return e}getHitPointWorld(){return Hh("Use getHitPointsWorld() instead of getHitPointWorld() for the AllHitsRayCaster!"),this.getHitPointsWorld()}getHitNormalsWorld(){const t=this._btRayCallback.get_m_hitNormalWorld(),e=[];for(let n=t.size()-1;n>=0;n--){const i=t.at(n);e.push({x:i.x(),y:i.y(),z:i.z()})}return e}getCollisionObjects(){const t=[],e=this._btRayCallback.get_m_collisionObjects();for(let n=e.size()-1;n>=0;n--){const i=Ammo.castObject(e.at(n),Ammo.btRigidBody);t.push(i.threeObject)}return t}}]);class Fu extends Xh{constructor(t,e={}){super(),this.scene=t,this.config=e,this.rigidBodies=[],this.earlierDetectedCollisions=[],this.complexShapes=["plane","hull","hacd","vhacd","convexMesh","concaveMesh"],this.gravity=e.gravity||{x:0,y:-9.81,z:0},this.isHeadless="headless"===t,this.tmpEuler=new cn,this.tmpQuaternion=new be,this.tmpVector3=new Me,this.tmpVector3a=new Me,this.tmpMatrix4=new $e,this.tmpMatrix4a=new $e,this.tmpBtVector3=new Ammo.btVector3,this.tmpBtQuaternion=new Ammo.btQuaternion(0,0,0,1),this.emptyV3=new Me,this.impactPoint=new Me,this.impactNormal=new Me,"headless"!==t&&(this.defaultMaterial=new fu),this.start()}get tmpTrans(){return console.warn("Use worldTransform instead of tmpTrans."),this.worldTransform}set tmpTrans(t){console.warn("Use worldTransform instead of tmpTrans."),this.worldTransform=t}destroy(t){var e;const n=Object.keys(t).includes("body")?t.body:t;if(void 0===(null==n?void 0:n.ammo))return;let i=n.ammo.threeObject;const r=i.name;if(r&&i&&(null==(e=null==i?void 0:i.body)?void 0:e.ammo)){i.body.isSoftBody?this.physicsWorld.removeSoftBody(i.body.ammo):this.physicsWorld.removeRigidBody(i.body.ammo),i.body.destructor(),i.body=void 0,i.hasBody=!1,delete n.ammo.threeObject;for(let t=0;tthis.addExisting(t,e))),this.constraints=new nu(this.worldTransform,this.physicsWorld),"headless"!==this.scene&&(this.debugDrawer=new yu(this.scene,this.physicsWorld,{}))}updateDebugger(){"headless"!==this.scene&&this.debugDrawer&&this.debugDrawer.enabled&&this.debugDrawer.update()}setupPhysicsWorld(){const t=this.gravity,{softBodies:e=!1}=this.config;let n;if(!e){const t=new Ammo.btDefaultCollisionConfiguration,e=new Ammo.btCollisionDispatcher(t),i=new Ammo.btDbvtBroadphase,r=new Ammo.btSequentialImpulseConstraintSolver;n=new Ammo.btDiscreteDynamicsWorld(e,i,r,t)}if(e){const t=new Ammo.btSoftBodyRigidBodyCollisionConfiguration,e=new Ammo.btCollisionDispatcher(t),i=new Ammo.btDbvtBroadphase,r=new Ammo.btSequentialImpulseConstraintSolver,s=new Ammo.btDefaultSoftBodySolver;n=new Ammo.btSoftRigidDynamicsWorld(e,i,r,t,s)}return n.setGravity(new Ammo.btVector3(t.x,t.y,t.z)),n}createDebrisFromBreakableObject(t,e){"headless"!==this.scene&&(t.material=e.material,t.shape="hull",t.fragmentDepth=e.fragmentDepth+1,t.name=`${e.name}__DEBRIS_${t.id}`,this.scene.add(t),this.addExisting(t,{autoCenter:!0}),t.body.fractureImpulse=e.body.fractureImpulse,t.body.breakable=!1,setTimeout((()=>{t.body.breakable=!0}),2500))}removeDebris(t){"headless"!==this.scene&&(this.scene.remove(t),this.destroy(t))}update(t){this.updatePhysics(t),this.detectCollisions()}updatePhysics(t){const e=t/1e3;this.physicsWorld.stepSimulation(e,this.config.maxSubSteps||4,this.config.fixedTimeStep||1/60);for(let i=0;i=123?this.tmpMatrix4a.copy(t.parent.matrixWorld).invert():this.tmpMatrix4a.getInverse(t.parent.matrixWorld):this.tmpMatrix4a.identity(),this.tmpMatrix4a.multiply(this.tmpMatrix4),this.tmpMatrix4a.decompose(t.position,t.quaternion,t.scale)}}}detectCollisions(){var t,e;const n=[];this.impactPoint.set(0,0,0),this.impactNormal.set(0,0,0);const i=this.physicsWorld.getDispatcher(),r=i.getNumManifolds();for(let s=0;st.combinedName===s))&&(b="collision"),!n.find((t=>t.combinedName===s))){n.push({combinedName:s,collision:!0});const e={x:i.x(),y:i.y(),z:i.z()},a={x:r.x(),y:r.y(),z:r.z()};c.body.impact.push({impulse:t,point:e,normal:a,name:h.name}),h.body.impact.push({impulse:t,point:e,normal:a,name:c.name}),this.collisionEvents.emit("collision",{bodies:[c,h],event:b})}}t>=_&&(_=t,(p||m)&&(this.impactPoint.set(i.x(),i.y(),i.z()),this.impactNormal.set(r.x(),r.y(),r.z())));break}}if(!x)continue;if(!y)continue;const M=2;if(this.emptyV3.set(0,0,0),c.userData.ammoPhysicsData={mass:1,velocity:this.emptyV3,angularVelocity:this.emptyV3,breakable:p,physicsBody:o},h.userData.ammoPhysicsData={mass:1,velocity:this.emptyV3,angularVelocity:this.emptyV3,breakable:m,physicsBody:l},p&&_>f&&c.fragmentDepthg&&h.fragmentDepth{const{combinedName:e}=t;if(!n.find((t=>t.combinedName===e))){const t=e.split("__"),n=this.rigidBodies.find((e=>e.uuid===t[0])),i=this.rigidBodies.find((e=>e.uuid===t[1])),r="end";n&&i&&this.collisionEvents.emit("collision",{bodies:[n,i],event:r})}})),this.earlierDetectedCollisions=[...n]}setGravity(t=0,e=-9.8,n=0){this.tmpBtVector3.setValue(t,e,n),this.physicsWorld.setGravity(this.tmpBtVector3)}get debug(){return this.isHeadless?null:{enable:()=>{this.debugDrawer.enable()},mode:(t=1)=>{this.debugDrawer.setDebugMode(t)},disable:()=>{this.debugDrawer.disable()}}}start(){"undefined"!=typeof Ammo?"function"==typeof Ammo?Ammo().then((()=>{this.setup()})):this.setup():Hh("Are you sure you included ammo.js?")}get add(){return{collider:(t,e,n)=>this.collisionEvents.addCollider(t,e,n),constraints:this.constraints.addConstraints,existing:(t,e)=>this.addExisting(t,e),plane:(t={},e={})=>this.shapes.addPlane(t,e),sphere:(t={},e={})=>this.shapes.addSphere(t,e),ground:(t={},e={})=>this.shapes.addGround(t,e),box:(t={},e={})=>this.shapes.addBox(t,e),capsule:(t={},e={})=>this.shapes.addCapsule(t,e),cylinder:(t={},e={})=>this.shapes.addCylinder(t,e),cone:(t={},e={})=>this.shapes.addCone(t,e),torus:(t={},e={})=>this.shapes.addTorus(t,e),extrude:(t,e={})=>this.shapes.addExtrude(t,e),raycaster:(t="closest")=>"closest"===t?new Uu(this):new Bu(this)}}prepareThreeObjectForCollisionShape(t,e={}){var n,i;const{autoCenter:r=!1}=e,s={width:1,height:1,depth:1,radius:1,radiusTop:1,radiusBottom:1,tube:.4,tubularSegments:6};let a="unknown";const o=(null==(n=t.geometry)?void 0:n.type)||"unknown";/box/i.test(o)?a="box":/cone/i.test(o)?a="cone":/cylinder/i.test(o)?a="cylinder":/extrude/i.test(o)?a="extrude":/plane/i.test(o)?a="plane":/sphere/i.test(o)?a="sphere":/torus/i.test(o)&&(a="torus");let l={...s,...null==(i=null==t?void 0:t.geometry)?void 0:i.parameters};if(e.shape?(l={...s,...e},a=e.shape):t.shape&&(a=t.shape),Object.keys(l).forEach((t=>{void 0===l[t]&&s[t]&&(l[t]=s[t])})),r)if(t.isMesh&&t.geometry)t.geometry.center();else if(t.isGroup){const e=new Te,n=new Me;e.setFromObject(t).getCenter(n),t.traverse((t=>{t.isMesh&&t.geometry.translate(-n.x,-n.y,-n.z)}))}return"cylinder"===a&&(l.radius=e.radius||l.radiusTop),"extrude"===a&&(a="hacd"),"mesh"!==a&&"convex"!==a||(a="convexMesh"),"concave"===a&&(a="concaveMesh"),"unknown"===a&&(Hh(`Shape for ${null==t?void 0:t.name} not recognized! Will fallback to box.`),a="box"),{shape:a,params:l,object:t}}createCollisionShape(t,e,n){const i=(null==n?void 0:n.quaternion)?null==n?void 0:n.quaternion:new be(0,0,0,1),{axis:r="y"}=e,s=new Ammo.btVector3,a=null==n?void 0:n.geometry;n&&(null==a?void 0:a.isGeometry)&&(n.geometry=(new si).fromGeometry(a));let o,l={};switch(-1!==this.complexShapes.indexOf(t)&&(l=(t=>{const e=(new $e).elements,n=[],i=[],r=[];return uu(t,{},((t,e,s)=>{n.push(t),i.push(e),r.push(s)})),{vertices:n,matrices:i,indexes:r,matrixWorld:e}})(n)),t){case"box":s.setValue(e.width/2,e.height/2,e.depth/2),o=new Ammo.btBoxShape(s);break;case"sphere":o=new Ammo.btSphereShape(e.radius);break;case"cylinder":switch(r){case"y":s.setValue(e.radius,e.height/2,e.radius),o=new Ammo.btCylinderShape(s);break;case"x":s.setValue(e.height/2,e.radius,e.radius),o=new Ammo.btCylinderShapeX(s);break;case"z":s.setValue(e.radius,e.radius,e.height/2),o=new Ammo.btCylinderShapeZ(s)}break;case"cone":switch(r){case"y":o=new Ammo.btConeShape(e.radius,e.height);break;case"x":o=new Ammo.btConeShapeX(e.radius,e.height);break;case"z":o=new Ammo.btConeShapeZ(e.radius,e.height)}break;case"capsule":switch(r){case"y":o=new Ammo.btCapsuleShape(e.radius,e.height);break;case"x":o=new Ammo.btCapsuleShapeX(e.radius,e.height);break;case"z":o=new Ammo.btCapsuleShapeZ(e.radius,e.height)}break;case"torus":o=((t,e)=>{const{radius:n=1,tube:i=.4,tubularSegments:r=8}=t,s=Math.PI,a=r,o=Math.sqrt(2*i*i-2*i*i*Math.cos(2*s/a)),l=new Ammo.btVector3(i,s/a+.5*o,i),c=new Ammo.btCylinderShape(l);c.setMargin(.05);const h=new Ammo.btCompoundShape,u=new Ammo.btVector3(0,0,1),d=new Ammo.btVector3(0,n,0),p=new Ammo.btQuaternion(e.x,e.y,e.z,e.w);for(let m=0;m{const{_childOffset:n,_compoundOffset:i}=t;if(n){const{pos:i,quat:r,scale:s,margin:a}=n,o=this.applyPosQuatScaleMargin(t,i,r,s,a);e.addChildShape(o,t)}else if(i){const n=new Ammo.btTransform;n.setIdentity(),n.setOrigin(new Ammo.btVector3(i.x,i.y,i.z)),e.addChildShape(n,t)}else{const n=new Ammo.btTransform;n.setIdentity(),e.addChildShape(n,t)}})),e}addExisting(t,e={}){const{hasBody:n}=t;if(n)return void Hh(`Object "${t.name}" already has a physical body!`);const i=new Me,r=new be,s=new Me;t.getWorldPosition(i),t.getWorldQuaternion(r),t.getWorldScale(s);const a="1"===(e.collisionFlags||0).toString(2).slice(-1),o="1"===(e.collisionFlags||0).toString(2).slice(-2,-1),{shape:l="unknown",compound:c=[],mass:h=(a||o?0:1),collisionFlags:u=0,collisionGroup:d=1,collisionMask:p=-1,offset:m,breakable:f=!1,addChildren:g=!0,margin:v=.01,ignoreScale:y=!1,fractureImpulse:x=1}=e;if(y&&s.set(1,1,1),c.length>=1){const e=c.map((t=>this.createCollisionShape(t.shape,t))),n=this.mergeCollisionShapesToCompoundShape(e),a=this.applyPosQuatScaleMargin(n,i,r,s,v),l=this.collisionShapeToRigidBody(n,a,h,o);return this.addRigidBodyToWorld(t,l,u,d,p,m),t.body.breakable=f,t.body.fractureImpulse=x,void(t.body.ignoreScale=y)}const _=[];if("unknown"!==l||t.isMesh){const n=this.prepareThreeObjectForCollisionShape(t,e),i=this.createCollisionShape(n.shape,n.params,n.object);_.push(i)}if("unknown"===l&&g&&t.children.length>=1&&t.children.forEach((t=>{if(t.isMesh){const e=this.prepareThreeObjectForCollisionShape(t),n=this.createCollisionShape(e.shape,e.params,e.object);n._childOffset={pos:t.position.clone(),quat:t.quaternion.clone(),scale:t.scale.clone(),margin:v},_.push(n)}})),0===_.length){const n=this.prepareThreeObjectForCollisionShape(t,e),i=this.createCollisionShape(n.shape,n.params,n.object);_.push(i)}const b=1===_.length?_[0]:this.mergeCollisionShapesToCompoundShape(_),M=this.applyPosQuatScaleMargin(b,i,r,s,v),w=this.collisionShapeToRigidBody(b,M,h,o);this.addRigidBodyToWorld(t,w,u,d,p,m),t.body.breakable=f,t.body.fractureImpulse=x,t.body.ignoreScale=y}addRigidBodyToWorld(t,e,n,i,r,s){this.rigidBodies.push(t),this.physicsWorld.addRigidBody(e,i,r);const a=Object.values(e)[0];t.name||(t.name=`object-${t.id}`),e.name=t.name,t.body=new $h(this,e),t.hasBody=!0,t.ptr=a,e.threeObject=t,s&&(t.body.offset={x:0,y:0,z:0,...s}),t.body.setCollisionFlags(n)}applyPosQuatScaleMargin(t,e=new Me,n=new be,i=new Me,r=.01){t.setMargin(r);const s=new Ammo.btQuaternion(0,0,0,1);s.setValue(n.x,n.y,n.z,n.w);const a=new Ammo.btTransform;a.setIdentity(),a.getOrigin().setValue(e.x,e.y,e.z),a.setRotation(s),Ammo.destroy(s);const o=new Ammo.btVector3(i.x,i.y,i.z);return t.setLocalScaling(o),Ammo.destroy(o),a}collisionShapeToRigidBody(t,e,n,i){const r=new Ammo.btDefaultMotionState(e),s=new Ammo.btVector3(0,0,0);n>0&&t.calculateLocalInertia(n,s);const a=new Ammo.btRigidBodyConstructionInfo(n,r,t,s),o=new Ammo.btRigidBody(a);return(n>0||i)&&o.setActivationState(4),o}}class ku{constructor(t={}){this.threeGraphicsConfig=t;const{alpha:e=!1,anisotropy:n=1,camera:i=zh.Perspective({z:25,y:5}),antialias:s=!1,usePhysics:a=!0,renderer:o}=t;this.textureAnisotropy=n,this.camera=i,this.scene=new Sa,this.renderer=o||new ba({antialias:s,alpha:e}),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=r,this.cache=Rc,this.cache.enabled=!0,a&&("undefined"!=typeof Ammo?this.physics=new Fu(this.scene,t):Hh("Are you sure you included ammo.js?"))}}console.log("%c %c %c %c %c Powered by enable3d v0.25.4 %c https://enable3d.io/","background: #ff0000","background: #ffff00","background: #00ff00","background: #00ffff","color: #fff; background: #000000;","background: none");var zu=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};try{URL.revokeObjectURL(zu(""))}catch(Sm){zu=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)}}var Vu=Uint8Array,Hu=Uint16Array,Gu=Uint32Array,Wu=new Vu([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ju=new Vu([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Xu=new Vu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qu=function(t,e){for(var n=new Hu(31),i=0;i<31;++i)n[i]=e+=1<>>1|(21845&Qu)<<1;td=(61680&(td=(52428&td)>>>2|(13107&td)<<2))>>>4|(3855&td)<<4,$u[Qu]=((65280&td)>>>8|(255&td)<<8)>>>1}var ed=function(t,e,n){for(var i=t.length,r=0,s=new Hu(e);r>>l]=c}else for(a=new Hu(i),r=0;r>>15-t[r]);return a},nd=new Vu(288);for(Qu=0;Qu<144;++Qu)nd[Qu]=8;for(Qu=144;Qu<256;++Qu)nd[Qu]=9;for(Qu=256;Qu<280;++Qu)nd[Qu]=7;for(Qu=280;Qu<288;++Qu)nd[Qu]=8;var id=new Vu(32);for(Qu=0;Qu<32;++Qu)id[Qu]=5;var rd=ed(nd,9,1),sd=ed(id,5,1),ad=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},od=function(t,e,n){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(7&e)&n},ld=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},cd=new Vu(0),hd="undefined"!=typeof TextDecoder&&new TextDecoder;try{hd.decode(cd,{stream:!0})}catch(Sm){}function ud(t,e,n){const i=n.length-t-1;if(e>=n[i])return i-1;if(e<=n[t])return t;let r=t,s=i,a=Math.floor((r+s)/2);for(;e=n[a+1];)e=s&&(r[e][0]=r[t][0]/o[c+1][l],i=r[e][0]*o[l][c]);const h=u-1<=c?s-1:n-u;for(let n=l>=-1?1:-l;n<=h;++n)r[e][n]=(r[t][n]-r[t][n-1])/o[c+1][l+n],i+=r[e][n]*o[l+n][c];u<=c&&(r[e][s]=-r[t][s-1]/o[c+1][u],i+=r[e][s]*o[u][c]),a[s][u]=i;const d=t;t=e,e=d}}let h=n;for(let u=1;u<=i;++u){for(let t=0;t<=n;++t)a[u][t]*=h;h*=n-u}return a}(o,i,t,s,e),c=[];for(let h=0;h=21&&e===Od(t,0,21)}(t))md=(new Md).parse(t);else{const e=Od(t);if(!function(t){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function i(e){const i=t[e-1];return t=t.slice(n+e),n++,i}for(let r=0;r0,s="string"==typeof r.Content&&""!==r.Content;if(t||s){const t=this.parseImage(n[i]);e[r.RelativeFilename||r.Filename]=t}}}}for(const n in t){const i=t[n];void 0!==e[i]?t[n]=e[i]:t[n]=t[n].split("\\").pop()}return t}parseImage(t){const e=t.Content,n=t.RelativeFilename||t.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let r;switch(i){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof e)return"data:"+r+";base64,"+e;{const t=new Uint8Array(e);return window.URL.createObjectURL(new Blob([t],{type:r}))}}parseTextures(t){const e=new Map;if("Texture"in md.Objects){const n=md.Objects.Texture;for(const i in n){const r=this.parseTexture(n[i],t);e.set(parseInt(i),r)}}return e}parseTexture(t,e){const n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;const i=t.WrapModeU,r=t.WrapModeV,s=void 0!==i?i.value:0,a=void 0!==r?r.value:0;if(n.wrapS=0===s?B:F,n.wrapT=0===a?B:F,"Scaling"in t){const e=t.Scaling.value;n.repeat.x=e[0],n.repeat.y=e[1]}if("Translation"in t){const e=t.Translation.value;n.offset.x=e[0],n.offset.y=e[1]}return n}loadTexture(t,e){let n;const i=this.textureLoader.path,r=fd.get(t.id).children;let s;void 0!==r&&r.length>0&&void 0!==e[r[0].ID]&&(n=e[r[0].ID],0!==n.indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));const a=t.FileName.slice(-3).toLowerCase();if("tga"===a){const e=this.manager.getHandler(".tga");null===e?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),s=new fe):(e.setPath(this.textureLoader.path),s=e.load(n))}else"psd"===a?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),s=new fe):s=this.textureLoader.load(n);return this.textureLoader.setPath(i),s}parseMaterials(t){const e=new Map;if("Material"in md.Objects){const n=md.Objects.Material;for(const i in n){const r=this.parseMaterial(n[i],t);null!==r&&e.set(parseInt(i),r)}}return e}parseMaterial(t,e){const n=t.id,i=t.attrName;let r=t.ShadingModel;if("object"==typeof r&&(r=r.value),!fd.has(n))return null;const s=this.parseParameters(t,e,n);let a;switch(r.toLowerCase()){case"phong":a=new nc;break;case"lambert":a=new sc;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),a=new nc}return a.setValues(s),a.name=i,a}parseParameters(t,e,n){const i={};t.BumpFactor&&(i.bumpScale=t.BumpFactor.value),t.Diffuse?i.color=(new Gn).fromArray(t.Diffuse.value).convertSRGBToLinear():!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(i.color=(new Gn).fromArray(t.DiffuseColor.value).convertSRGBToLinear()),t.DisplacementFactor&&(i.displacementScale=t.DisplacementFactor.value),t.Emissive?i.emissive=(new Gn).fromArray(t.Emissive.value).convertSRGBToLinear():!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(i.emissive=(new Gn).fromArray(t.EmissiveColor.value).convertSRGBToLinear()),t.EmissiveFactor&&(i.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(i.opacity=parseFloat(t.Opacity.value)),i.opacity<1&&(i.transparent=!0),t.ReflectionFactor&&(i.reflectivity=t.ReflectionFactor.value),t.Shininess&&(i.shininess=t.Shininess.value),t.Specular?i.specular=(new Gn).fromArray(t.Specular.value).convertSRGBToLinear():t.SpecularColor&&"Color"===t.SpecularColor.type&&(i.specular=(new Gn).fromArray(t.SpecularColor.value).convertSRGBToLinear());const r=this;return fd.get(n).children.forEach((function(t){const n=t.relationship;switch(n){case"Bump":i.bumpMap=r.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":i.aoMap=r.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=r.getTexture(e,t.ID),void 0!==i.map&&(i.map.colorSpace=pt);break;case"DisplacementColor":i.displacementMap=r.getTexture(e,t.ID);break;case"EmissiveColor":i.emissiveMap=r.getTexture(e,t.ID),void 0!==i.emissiveMap&&(i.emissiveMap.colorSpace=pt);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=r.getTexture(e,t.ID);break;case"ReflectionColor":i.envMap=r.getTexture(e,t.ID),void 0!==i.envMap&&(i.envMap.mapping=O,i.envMap.colorSpace=pt);break;case"SpecularColor":i.specularMap=r.getTexture(e,t.ID),void 0!==i.specularMap&&(i.specularMap.colorSpace=pt);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=r.getTexture(e,t.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),i}getTexture(t,e){return"LayeredTexture"in md.Objects&&e in md.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=fd.get(e).children[0].ID),t.get(e)}parseDeformers(){const t={},e={};if("Deformer"in md.Objects){const n=md.Objects.Deformer;for(const i in n){const r=n[i],s=fd.get(parseInt(i));if("Skin"===r.attrType){const e=this.parseSkeleton(s,n);e.ID=i,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),e.geometryID=s.parents[0].ID,t[i]=e}else if("BlendShape"===r.attrType){const t={id:i};t.rawTargets=this.parseMorphTargets(s,n),t.id=i,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[i]=t}}}return{skeletons:t,morphTargets:e}}parseSkeleton(t,e){const n=[];return t.children.forEach((function(t){const i=e[t.ID];if("Cluster"!==i.attrType)return;const r={ID:t.ID,indices:[],weights:[],transformLink:(new $e).fromArray(i.TransformLink.a)};"Indexes"in i&&(r.indices=i.Indexes.a,r.weights=i.Weights.a),n.push(r)})),{rawBones:n,bones:[]}}parseMorphTargets(t,e){const n=[];for(let i=0;i1?s=a:a.length>0?s=a[0]:(s=new nc({name:Lc.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(s)),"color"in r.attributes&&a.forEach((function(t){t.vertexColors=!0})),r.FBX_Deformer?(i=new no(r,s),i.normalizeSkinWeights()):i=new wi(r,s),i}createCurve(t,e){const n=t.children.reduce((function(t,n){return e.has(n.ID)&&(t=e.get(n.ID)),t}),null),i=new yo({name:Lc.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new So(n,i)}getTransformData(t,e){const n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),n.eulerOrder="RotationOrder"in e?Id(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}setLookAtProperties(t,e){"LookAtProperty"in e&&fd.get(t.ID).children.forEach((function(e){if("LookAtProperty"===e.relationship){const n=md.Objects.Model[e.ID];if("Lcl_Translation"in n){const e=n.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(e),gd.add(t.target)):t.lookAt((new Me).fromArray(e))}}}))}bindSkeleton(t,e,n){const i=this.parsePoseNodes();for(const r in t){const s=t[r];fd.get(parseInt(s.ID)).parents.forEach((function(t){if(e.has(t.ID)){const e=t.ID;fd.get(e).parents.forEach((function(t){n.has(t.ID)&&n.get(t.ID).bind(new oo(s.bones),i[t.ID])}))}}))}}parsePoseNodes(){const t={};if("Pose"in md.Objects){const e=md.Objects.Pose;for(const n in e)if("BindPose"===e[n].attrType&&e[n].NbPoseNodes>0){const i=e[n].PoseNode;Array.isArray(i)?i.forEach((function(e){t[e.Node]=(new $e).fromArray(e.Matrix.a)})):t[i.Node]=(new $e).fromArray(i.Matrix.a)}}return t}createAmbientLight(){if("GlobalSettings"in md&&"AmbientColor"in md.GlobalSettings){const t=md.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],i=t[2];if(0!==e||0!==n||0!==i){const t=new Gn(e,n,i).convertSRGBToLinear();gd.add(new $c(t,1))}}}}class xd{constructor(){this.negativeMaterialIndices=!1}parse(t){const e=new Map;if("Geometry"in md.Objects){const n=md.Objects.Geometry;for(const i in n){const r=fd.get(parseInt(i)),s=this.parseGeometry(r,n[i],t);e.set(parseInt(i),s)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),e}parseGeometry(t,e,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}parseMeshGeometry(t,e,n){const i=n.skeletons,r=[],s=t.parents.map((function(t){return md.Objects.Model[t.ID]}));if(0===s.length)return;const a=t.children.reduce((function(t,e){return void 0!==i[e.ID]&&(t=i[e.ID]),t}),null);t.children.forEach((function(t){void 0!==n.morphTargets[t.ID]&&r.push(n.morphTargets[t.ID])}));const o=s[0],l={};"RotationOrder"in o&&(l.eulerOrder=Id(o.RotationOrder.value)),"InheritType"in o&&(l.inheritType=parseInt(o.InheritType.value)),"GeometricTranslation"in o&&(l.translation=o.GeometricTranslation.value),"GeometricRotation"in o&&(l.rotation=o.GeometricRotation.value),"GeometricScaling"in o&&(l.scale=o.GeometricScaling.value);const c=Ld(l);return this.genGeometry(e,a,r,c)}genGeometry(t,e,n,i){const r=new si;t.attrName&&(r.name=t.attrName);const s=this.parseGeoNode(t,e),a=this.genBuffers(s),o=new Zn(a.vertex,3);if(o.applyMatrix4(i),r.setAttribute("position",o),a.colors.length>0&&r.setAttribute("color",new Zn(a.colors,3)),e&&(r.setAttribute("skinIndex",new Kn(a.weightsIndices,4)),r.setAttribute("skinWeight",new Zn(a.vertexWeights,4)),r.FBX_Deformer=e),a.normal.length>0){const t=(new qt).getNormalMatrix(i),e=new Zn(a.normal,3);e.applyNormalMatrix(t),r.setAttribute("normal",e)}if(a.uvs.forEach((function(t,e){const n=0===e?"uv":`uv${e}`;r.setAttribute(n,new Zn(a.uvs[e],2))})),s.material&&"AllSame"!==s.material.mappingType){let t=a.materialIndex[0],e=0;if(a.materialIndex.forEach((function(n,i){n!==t&&(r.addGroup(e,i-e,t),t=n,e=i)})),r.groups.length>0){const e=r.groups[r.groups.length-1],n=e.start+e.count;n!==a.materialIndex.length&&r.addGroup(n,a.materialIndex.length-n,t)}0===r.groups.length&&r.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(r,t,n,i),r}parseGeoNode(t,e){const n={};if(n.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],n.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];let e=0;for(;t.LayerElementUV[e];)t.LayerElementUV[e].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[e])),e++}return n.weightTable={},null!==e&&(n.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(i,r){void 0===n.weightTable[i]&&(n.weightTable[i]=[]),n.weightTable[i].push({id:e,weight:t.weights[r]})}))}))),n}genBuffers(t){const e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,r=!1,s=[],a=[],o=[],l=[],c=[],h=[];const u=this;return t.vertexIndices.forEach((function(d,p){let m,f=!1;d<0&&(d=~d,f=!0);let g=[],v=[];if(s.push(3*d,3*d+1,3*d+2),t.color){const e=Rd(p,n,d,t.color);o.push(e[0],e[1],e[2])}if(t.skeleton){if(void 0!==t.weightTable[d]&&t.weightTable[d].forEach((function(t){v.push(t.weight),g.push(t.id)})),v.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const t=[0,0,0,0],e=[0,0,0,0];v.forEach((function(n,i){let r=n,s=g[i];e.forEach((function(e,n,i){if(r>e){i[n]=r,r=e;const a=t[n];t[n]=s,s=a}}))})),g=t,v=e}for(;v.length<4;)v.push(0),g.push(0);for(let t=0;t<4;++t)c.push(v[t]),h.push(g[t])}if(t.normal){const e=Rd(p,n,d,t.normal);a.push(e[0],e[1],e[2])}t.material&&"AllSame"!==t.material.mappingType&&(m=Rd(p,n,d,t.material)[0],m<0&&(u.negativeMaterialIndices=!0,m=0)),t.uv&&t.uv.forEach((function(t,e){const i=Rd(p,n,d,t);void 0===l[e]&&(l[e]=[]),l[e].push(i[0]),l[e].push(i[1])})),i++,f&&(i>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),u.genFace(e,t,s,m,a,o,l,c,h,i),n++,i=0,s=[],a=[],o=[],l=[],c=[],h=[])})),e}genFace(t,e,n,i,r,s,a,o,l,c){for(let h=2;h1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const s=t.get(r[0].ID);n[i]={name:e[i].attrName,layer:s}}return n}addClip(t){let e=[];const n=this;return t.layer.forEach((function(t){e=e.concat(n.generateTracks(t))})),new Ac(t.name,-1,e)}generateTracks(t){const e=[];let n=new Me,i=new be,r=new Me;if(t.transform&&t.transform.decompose(n,i,r),n=n.toArray(),i=(new cn).setFromQuaternion(i,t.eulerOrder).toArray(),r=r.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){const i=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");void 0!==i&&e.push(i)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){const n=this.generateRotationTrack(t.modelName,t.R.curves,i,t.preRotation,t.postRotation,t.eulerOrder);void 0!==n&&e.push(n)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){const n=this.generateVectorTrack(t.modelName,t.S.curves,r,"scale");void 0!==n&&e.push(n)}if(void 0!==t.DeformPercent){const n=this.generateMorphTrack(t);void 0!==n&&e.push(n)}return e}generateVectorTrack(t,e,n,i){const r=this.getTimesForAllAxes(e),s=this.getKeyframeTrackValues(r,e,n);return new Tc(t+"."+i,r,s)}generateRotationTrack(t,e,n,i,r,s){void 0!==e.x&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(Wt)),void 0!==e.y&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(Wt)),void 0!==e.z&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(Wt));const a=this.getTimesForAllAxes(e),o=this.getKeyframeTrackValues(a,e,n);void 0!==i&&((i=i.map(Wt)).push(s),i=(new cn).fromArray(i),i=(new be).setFromEuler(i)),void 0!==r&&((r=r.map(Wt)).push(s),r=(new cn).fromArray(r),r=(new be).setFromEuler(r).invert());const l=new be,c=new cn,h=[];for(let u=0;u1){let t=1,n=e[0];for(let i=1;i=180){const s=r/180,a=i/s;let o=n+a;const l=t.times[e-1],c=(t.times[e]-l)/s;let h=l+c;const u=[],d=[];for(;h1&&(n=t[1].replace(/^(\w+)::/,""),i=t[2]),{id:e,name:n,type:i}}parseNodeProperty(t,e,n){let i=e[1].replace(/^"/,"").replace(/"$/,"").trim(),r=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===r&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const s=this.getCurrentNode();if("Properties70"!==s.name){if("C"===i){const t=r.split(",").slice(1),e=parseInt(t[0]),n=parseInt(t[1]);let a=r.split(",").slice(3);a=a.map((function(t){return t.trim().replace(/^"/,"")})),i="connections",r=[e,n],function(t,e){for(let n=0,i=t.length,r=e.length;n=t.size():t.getOffset()+160+16>=t.size()}parseNode(t,e){const n={},i=e>=7500?t.getUint64():t.getUint32(),r=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();const s=t.getUint8(),a=t.getString(s);if(0===i)return null;const o=[];for(let u=0;u0?o[0]:"",c=o.length>1?o[1]:"",h=o.length>2?o[2]:"";for(n.singleProperty=1===r&&t.getOffset()===i;i>t.getOffset();){const i=this.parseNode(t,e);null!==i&&this.parseSubNode(a,n,i)}return n.propertyList=o,"number"==typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==h&&(n.attrType=h),""!==a&&(n.name=a),n}parseSubNode(t,e,n){if(!0===n.singleProperty){const t=n.propertyList[0];Array.isArray(t)?(e[n.name]=n,n.a=t):e[n.name]=t}else if("Connections"===t&&"C"===n.name){const t=[];n.propertyList.forEach((function(e,n){0!==n&&t.push(e)})),void 0===e.connections&&(e.connections=[]),e.connections.push(t)}else if("Properties70"===n.name)Object.keys(n).forEach((function(t){e[t]=n[t]}));else if("Properties70"===t&&"P"===n.name){let t=n.propertyList[0],i=n.propertyList[1];const r=n.propertyList[2],s=n.propertyList[3];let a;0===t.indexOf("Lcl ")&&(t=t.replace("Lcl ","Lcl_")),0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),a="Color"===i||"ColorRGB"===i||"Vector"===i||"Vector3D"===i||0===i.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],e[t]={type:i,type2:r,flag:s,value:a}}else void 0===e[n.name]?"number"==typeof n.id?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:"PoseNode"===n.name?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):void 0===e[n.name][n.id]&&(e[n.name][n.id]=n)}parseProperty(t){const e=t.getString(1);let n;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return n=t.getUint32(),t.getArrayBuffer(n);case"S":return n=t.getUint32(),t.getString(n);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=t.getUint32(),r=t.getUint32(),s=t.getUint32();if(0===r)switch(e){case"b":case"c":return t.getBooleanArray(i);case"d":return t.getFloat64Array(i);case"f":return t.getFloat32Array(i);case"i":return t.getInt32Array(i);case"l":return t.getInt64Array(i)}const a=function(t,e){return function(t,e,n){var i=t.length;if(!i||n&&!n.l&&i<5)return e||new Vu(0);var r=!e||n,s=!n||n.i;n||(n={}),e||(e=new Vu(3*i));var a,o=function(t){var n=e.length;if(t>n){var i=new Vu(Math.max(2*n,t));i.set(e),e=i}},l=n.f||0,c=n.p||0,h=n.b||0,u=n.l,d=n.d,p=n.m,m=n.n,f=8*i;do{if(!u){n.f=l=od(t,c,1);var g=od(t,c+1,3);if(c+=3,!g){var v=t[(R=((a=c)/8|0)+(7&a&&1)+4)-4]|t[R-3]<<8,y=R+v;if(y>i){if(s)throw"unexpected EOF";break}r&&o(h+v),e.set(t.subarray(R,y),h),n.b=h+=v,n.p=c=8*y;continue}if(1==g)u=rd,d=sd,p=9,m=5;else{if(2!=g)throw"invalid block type";var x=od(t,c,31)+257,_=od(t,c+10,15)+4,b=x+od(t,c+5,31)+1;c+=14;for(var M=new Vu(b),w=new Vu(19),S=0;S<_;++S)w[Xu[S]]=od(t,c+3*S,7);c+=3*_;var T=ad(w),A=(1<>>4)<16)M[S++]=R;else{var P=0,L=0;for(16==R?(L=3+od(t,c,3),c+=2,P=M[S-1]):17==R?(L=3+od(t,c,7),c+=3):18==R&&(L=11+od(t,c,127),c+=7);L--;)M[S++]=P}}var I=M.subarray(0,x),N=M.subarray(x);p=ad(I),m=ad(N),u=ed(I,p,1),d=ed(N,m,1)}if(c>f){if(s)throw"unexpected EOF";break}}r&&o(h+131072);for(var O=(1<>>4;if((c+=15&P)>f){if(s)throw"unexpected EOF";break}if(!P)throw"invalid length/literal";if(B<256)e[h++]=B;else{if(256==B){U=c,u=null;break}var F=B-254;if(B>264){var k=Wu[S=B-257];F=od(t,c,(1<>>4;if(!z)throw"invalid distance";if(c+=15&z,N=Zu[V],V>3&&(k=ju[V],N+=ld(t,c)&(1<f){if(s)throw"unexpected EOF";break}r&&o(h+131072);for(var H=h+F;ht.length)&&(n=t.length);var i=new(t instanceof Hu?Hu:t instanceof Gu?Gu:Vu)(n-0);return i.set(t.subarray(0,n)),i}(e,0,h)}((function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"}(t),t.subarray(2,-4)),void 0)}(new Uint8Array(t.getArrayBuffer(s))),o=new wd(a.buffer);switch(e){case"b":case"c":return o.getBooleanArray(i);case"d":return o.getFloat64Array(i);case"f":return o.getFloat32Array(i);case"i":return o.getInt32Array(i);case"l":return o.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}}}class wd{constructor(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===e||e,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(t){this.offset+=t}getBoolean(){return!(1&~this.getUint8())}getBooleanArray(t){const e=[];for(let n=0;n=0&&(n=new Uint8Array(this.dv.buffer,e,i)),this._textDecoder.decode(n)}}class Sd{add(t,e){this[t]=e}}function Td(t){const e=t.match(/FBXVersion: (\d+)/);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Ad(t){return t/46186158e3}const Ed=[];function Rd(t,e,n,i){let r;switch(i.mappingType){case"ByPolygonVertex":r=t;break;case"ByPolygon":r=e;break;case"ByVertice":r=n;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(r=i.indices[r]);const s=r*i.dataSize,a=s+i.dataSize;return function(t,e,n,i){for(let r=n,s=0;r=2.0 are supported.")));const l=new Tp(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h=0&&void 0===a[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(s),l.setPlugins(a),l.parse(n,i)}parseAsync(t,e){const n=this;return new Promise((function(i,r){n.parse(t,e,i,r)}))}}function Fd(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const kd={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class zd{constructor(t){this.parser=t,this.name=kd.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,i=e.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class $d{constructor(t){this.parser=t,this.name=kd.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=i.images[s.source];let o=n.textureLoader;if(a.uri){const t=n.options.manager.getHandler(a.uri);null!==t&&(o=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class Qd{constructor(t){this.parser=t,this.name=kd.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=i.images[s.source];let o=n.textureLoader;if(a.uri){const t=n.options.manager.getHandler(a.uri);null!==t&&(o=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class tp{constructor(t){this.name=kd.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const t=n.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(e){const n=t.byteOffset||0,i=t.byteLength||0,s=t.count,a=t.byteStride,o=new Uint8Array(e,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,a,o,t.mode,t.filter).then((function(t){return t.buffer})):r.ready.then((function(){const e=new ArrayBuffer(s*a);return r.decodeGltfBuffer(new Uint8Array(e),s,a,o,t.mode,t.filter),e}))}))}return null}}class ep{constructor(t){this.name=kd.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=e.meshes[n.mesh];for(const o of i.primitives)if(o.mode!==hp.TRIANGLES&&o.mode!==hp.TRIANGLE_STRIP&&o.mode!==hp.TRIANGLE_FAN&&void 0!==o.mode)return null;const r=n.extensions[this.name].attributes,s=[],a={};for(const o in r)s.push(this.parser.getDependency("accessor",r[o]).then((t=>(a[o]=t,a[o]))));return s.length<1?null:(s.push(this.parser.createNodeMesh(t)),Promise.all(s).then((t=>{const e=t.pop(),n=e.isGroup?e.children:[e],i=t[0].count,r=[];for(const s of n){const t=new $e,e=new Me,n=new be,o=new Me(1,1,1),l=new vo(s.geometry,s.material,i);for(let r=0;r-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||i&&r<98?this.textureLoader=new Uc(this.options.manager):this.textureLoader=new hh(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Oc(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){const s={scene:e[0][i.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:i.asset,parser:n,userData:{}};yp(r,s,i),xp(s,i),Promise.all(n._invokeAll((function(t){return t.afterRoot&&t.afterRoot(s)}))).then((function(){t(s)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=e.length;i{const n=this.associations.get(t);null!=n&&this.associations.set(e,n);for(const[i,s]of t.children.entries())r(s,e.children[i])};return r(n,i),i.name+="_instance_"+t.uses[e]++,i}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n=2&&p.setY(e,h[t*s+1]),s>=3&&p.setZ(e,h[t*s+2]),s>=4&&p.setW(e,h[t*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(t){const e=this.json,n=this.options,i=e.textures[t].source,r=e.images[i];let s=this.textureLoader;if(r.uri){const t=n.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,i,s)}loadTextureImage(t,e,n){const i=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(e,n).then((function(e){e.flipY=!1,e.name=s.name||a.name||"",""===e.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(e.name=a.uri);const n=(r.samplers||{})[s.sampler]||{};return e.magFilter=dp[n.magFilter]||G,e.minFilter=dp[n.minFilter]||j,e.wrapS=pp[n.wrapS]||B,e.wrapT=pp[n.wrapT]||B,i.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[o]=l,l}loadImageSource(t,e){const n=this.json,i=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((t=>t.clone()));const r=n.images[t],s=self.URL||self.webkitURL;let a=r.uri||"",o=!1;if(void 0!==r.bufferView)a=this.getDependency("bufferView",r.bufferView).then((function(t){o=!0;const e=new Blob([t],{type:r.mimeType});return a=s.createObjectURL(e),a}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const l=Promise.resolve(a).then((function(t){return new Promise((function(n,r){let s=n;!0===e.isImageBitmapLoader&&(s=function(t){const e=new fe(t);e.needsUpdate=!0,n(e)}),e.load(ih.resolveURL(t,i.path),s,void 0,r)}))})).then((function(t){var e;return!0===o&&s.revokeObjectURL(a),t.userData.mimeType=r.mimeType||((e=r.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),t}));return this.sourceCache[t]=l,l}assignTexture(t,e,n,i){const r=this;return this.getDependency("texture",n.index).then((function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[kd.KHR_TEXTURE_TRANSFORM]){const t=void 0!==n.extensions?n.extensions[kd.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(s);s=r.extensions[kd.KHR_TEXTURE_TRANSFORM].extendTexture(s,t),r.associations.set(s,e)}}return void 0!==i&&(s.colorSpace=i),t[e]=s,s}))}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const i=void 0===e.attributes.tangent,r=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new Co,Fn.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,e.sizeAttenuation=!1,this.cache.add(t,e)),n=e}else if(t.isLine){const t="LineBasicMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new yo,Fn.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,this.cache.add(t,e)),n=e}if(i||r||s){let t="ClonedMaterial:"+n.uuid+":";i&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),s&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=n.clone(),r&&(e.vertexColors=!0),s&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}t.material=n}getMaterialType(){return tc}loadMaterial(t){const e=this,n=this.json,i=this.extensions,r=n.materials[t];let s;const a={},o=[];if((r.extensions||{})[kd.KHR_MATERIALS_UNLIT]){const t=i[kd.KHR_MATERIALS_UNLIT];s=t.getMaterialType(),o.push(t.extendParams(a,r,e))}else{const n=r.pbrMetallicRoughness||{};if(a.color=new Gn(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)){const t=n.baseColorFactor;a.color.setRGB(t[0],t[1],t[2],mt),a.opacity=t[3]}void 0!==n.baseColorTexture&&o.push(e.assignTexture(a,"map",n.baseColorTexture,pt)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(o.push(e.assignTexture(a,"metalnessMap",n.metallicRoughnessTexture)),o.push(e.assignTexture(a,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),o.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,a)}))))}!0===r.doubleSided&&(a.side=2);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,"MASK"===l&&(a.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==jn&&(o.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new Xt(1,1),void 0!==r.normalTexture.scale)){const t=r.normalTexture.scale;a.normalScale.set(t,t)}if(void 0!==r.occlusionTexture&&s!==jn&&(o.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(a.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==jn){const t=r.emissiveFactor;a.emissive=(new Gn).setRGB(t[0],t[1],t[2],mt)}return void 0!==r.emissiveTexture&&s!==jn&&o.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,pt)),Promise.all(o).then((function(){const n=new s(a);return r.name&&(n.name=r.name),xp(n,r),e.associations.set(n,{materials:t}),r.extensions&&yp(i,n,r),n}))}createUniqueName(t){const e=_h.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,i=this.primitiveCache;function r(t){return n[kd.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(n){return Ap(n,t,e)}))}const s=[];for(let a=0,o=t.length;a0&&_p(u,r),u.name=e.createUniqueName(r.name||"mesh_"+t),xp(u,r),c.extensions&&yp(i,u,c),e.assignFinalMaterial(u),l.push(u)}for(let i=0,r=l.length;i1?new ma:1===e.length?e[0]:new Sn,a!==e[0])for(let t=0,n=e.length;t{const e=new Map;for(const[n,r]of i.associations)(n instanceof Fn||n instanceof fe)&&e.set(n,r);return t.traverse((t=>{const n=i.associations.get(t);null!=n&&e.set(t,n)})),e})(r),r}))}_createAnimationTracks(t,e,n,i,r){const s=[],a=t.name?t.name:t.uuid,o=[];let l;switch(gp[r.path]===gp.weights?t.traverse((function(t){t.morphTargetInfluences&&o.push(t.name?t.name:t.uuid)})):o.push(a),gp[r.path]){case gp.weights:l=bc;break;case gp.rotation:l=wc;break;case gp.position:case gp.scale:l=Tc;break;default:l=1===n.itemSize?bc:Tc}const c=void 0!==i.interpolation?vp[i.interpolation]:ot,h=this._getArrayFromAccessor(n);for(let u=0,d=o.length;u1){const t=Math.sqrt(v);p=(e*=t)*e,m=(n*=t)*n}const y=p*g+m*f,x=(p*m-y)/y;let _=Math.sqrt(Math.max(0,x));s===a&&(_=-_);const b=_*e*d/n,M=-_*n*u/e,w=Math.cos(r)*b-Math.sin(r)*M+(o.x+l.x)/2,S=Math.sin(r)*b+Math.cos(r)*M+(o.y+l.y)/2,T=i(1,0,(u-b)/e,(d-M)/n),A=i((u-b)/e,(d-M)/n,(-u-b)/e,(-d-M)/n)%(2*Math.PI);t.currentPath.absellipse(w,S,e,n,T,T+A,0===a,r)}function i(t,e,n,i){const r=t*n+e*i,s=Math.sqrt(t*t+e*e)*Math.sqrt(n*n+i*i);let a=Math.acos(Math.max(-1,Math.min(1,r/s)));return t*i-e*n<0&&(a=-a),a}function r(t,e){e=Object.assign({},e);let n={};if(t.hasAttribute("class")){const e=t.getAttribute("class").split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0;tNumber.EPSILON}function d(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function p(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}const m=[],f={},g=[],v=new qt,y=new qt,x=new qt,_=new qt,b=new Xt,M=new Me,w=new qt,S=(new DOMParser).parseFromString(t,"image/svg+xml");return function t(e,i){if(1!==e.nodeType)return;const o=function(t){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))))return null;const e=function(t){const e=new qt,n=v;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const n=c(t.getAttribute("x")),i=c(t.getAttribute("y"));e.translate(n,i)}if(t.hasAttribute("transform")){const i=t.getAttribute("transform").split(")");for(let t=i.length-1;t>=0;t--){const r=i[t].trim();if(""===r)continue;const s=r.indexOf("("),o=r.length;if(s>0&&s=1){const t=e[0];let i=0;e.length>=2&&(i=e[1]),n.translate(t,i)}break;case"rotate":if(e.length>=1){let t=0,i=0,r=0;t=e[0]*Math.PI/180,e.length>=3&&(i=e[1],r=e[2]),y.makeTranslation(-i,-r),x.makeRotation(t),_.multiplyMatrices(x,y),y.makeTranslation(i,r),n.multiplyMatrices(y,_)}break;case"scale":if(e.length>=1){const t=e[0];let i=t;e.length>=2&&(i=e[1]),n.scale(t,i)}break;case"skewX":1===e.length&&n.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&n.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&n.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}e.premultiply(n)}}return e}(t);return g.length>0&&e.premultiply(g[g.length-1]),w.copy(e),g.push(e),e}(e);let l=!1,S=null;switch(e.nodeName){case"svg":case"g":i=r(e,i);break;case"style":!function(t){if(t.sheet&&t.sheet.cssRules&&t.sheet.cssRules.length)for(let e=0;et.trim()));for(let t=0;t""!==t)));f[i[t]]=Object.assign(f[i[t]]||{},e)}}}(e);break;case"path":i=r(e,i),e.hasAttribute("d")&&(S=function(t){const e=new kh,i=new Xt,r=new Xt,o=new Xt;let l=!0,c=!1;const h=t.getAttribute("d");if(""===h||"none"===h)return null;const u=h.match(/[a-df-z][^a-df-z]*/gi);for(let d=0,p=u.length;d0&&(i.copy(o),e.currentPath.currentPoint.copy(i),l=!0);break;default:console.warn(t)}c=!1}return e}(e));break;case"rect":i=r(e,i),S=function(t){const e=c(t.getAttribute("x")||0),n=c(t.getAttribute("y")||0),i=c(t.getAttribute("rx")||t.getAttribute("ry")||0),r=c(t.getAttribute("ry")||t.getAttribute("rx")||0),s=c(t.getAttribute("width")),a=c(t.getAttribute("height")),o=.448084975506,l=new kh;return l.moveTo(e+i,n),l.lineTo(e+s-i,n),(0!==i||0!==r)&&l.bezierCurveTo(e+s-i*o,n,e+s,n+r*o,e+s,n+r),l.lineTo(e+s,n+a-r),(0!==i||0!==r)&&l.bezierCurveTo(e+s,n+a-r*o,e+s-i*o,n+a,e+s-i,n+a),l.lineTo(e+i,n+a),(0!==i||0!==r)&&l.bezierCurveTo(e+i*o,n+a,e,n+a-r*o,e,n+a-r),l.lineTo(e,n+r),(0!==i||0!==r)&&l.bezierCurveTo(e,n+r*o,e+i*o,n,e+i,n),l}(e);break;case"polygon":i=r(e,i),S=function(t){const e=new kh;let n=0;return t.getAttribute("points").replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,(function(t,i,r){const s=c(i),a=c(r);0===n?e.moveTo(s,a):e.lineTo(s,a),n++})),e.currentPath.autoClose=!0,e}(e);break;case"polyline":i=r(e,i),S=function(t){const e=new kh;let n=0;return t.getAttribute("points").replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,(function(t,i,r){const s=c(i),a=c(r);0===n?e.moveTo(s,a):e.lineTo(s,a),n++})),e.currentPath.autoClose=!1,e}(e);break;case"circle":i=r(e,i),S=function(t){const e=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),i=c(t.getAttribute("r")||0),r=new Qo;r.absarc(e,n,i,0,2*Math.PI);const s=new kh;return s.subPaths.push(r),s}(e);break;case"ellipse":i=r(e,i),S=function(t){const e=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),i=c(t.getAttribute("rx")||0),r=c(t.getAttribute("ry")||0),s=new Qo;s.absellipse(e,n,i,r,0,2*Math.PI);const a=new kh;return a.subPaths.push(s),a}(e);break;case"line":i=r(e,i),S=function(t){const e=c(t.getAttribute("x1")||0),n=c(t.getAttribute("y1")||0),i=c(t.getAttribute("x2")||0),r=c(t.getAttribute("y2")||0),s=new kh;return s.moveTo(e,n),s.lineTo(i,r),s.currentPath.autoClose=!1,s}(e);break;case"defs":l=!0;break;case"use":i=r(e,i);const o=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),h=e.viewportElement.getElementById(o);h?t(h,i):console.warn("SVGLoader: 'use node' references non-existent node id: "+o)}S&&(void 0!==i.fill&&"none"!==i.fill&&S.color.setStyle(i.fill,Ep),function(t,e){function n(t){M.set(t.x,t.y,1).applyMatrix3(e),t.set(M.x,M.y)}function i(t){const n=t.xRadius,i=t.yRadius,r=Math.cos(t.aRotation),s=Math.sin(t.aRotation),a=new Me(n*r,n*s,0),o=new Me(-i*s,i*r,0),l=a.applyMatrix3(e),c=o.applyMatrix3(e),u=v.set(l.x,c.x,0,l.y,c.y,0,0,0,1),d=y.copy(u).invert(),p=x.copy(d).transpose().multiply(d).elements,m=function(t,e,n){let i,r,s,a,o;const l=t+n,c=t-n,h=Math.sqrt(c*c+4*e*e);return l>0?(i=.5*(l+h),o=1/i,r=t*o*n-e*o*e):l<0?r=.5*(l-h):(i=.5*h,r=-.5*h),s=c>0?c+h:c-h,Math.abs(s)>2*Math.abs(e)?(o=-2*e/s,a=1/Math.sqrt(1+o*o),s=o*a):0===Math.abs(e)?(s=1,a=0):(o=-.5*s/e,s=1/Math.sqrt(1+o*o),a=o*s),c>0&&(o=s,s=-a,a=o),{rt1:i,rt2:r,cs:s,sn:a}}(p[0],p[1],p[4]),f=Math.sqrt(m.rt1),g=Math.sqrt(m.rt2);if(t.xRadius=1/f,t.yRadius=1/g,t.aRotation=Math.atan2(m.sn,m.cs),!((t.aEndAngle-t.aStartAngle)%(2*Math.PI){const{x:e,y:n}=new Me(Math.cos(t),Math.sin(t),0).applyMatrix3(r);return Math.atan2(n,e)};t.aStartAngle=s(t.aStartAngle),t.aEndAngle=s(t.aEndAngle),h(e)&&(t.aClockwise=!t.aClockwise)}}function r(t){const n=d(e),i=p(e);t.xRadius*=n,t.yRadius*=i;const r=n>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=r,h(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const s=t.subPaths;for(let a=0,o=s.length;a0?w.copy(g[g.length-1]):w.identity())}(S.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:m,xml:S.documentElement}}static createShapes(t){const e=999999999,n={loc:0,t:0};function i(t,e,i,s){const a=t.x,o=e.x,l=i.x,c=s.x,h=t.y,u=e.y,d=i.y,p=s.y,m=(c-l)*(h-d)-(p-d)*(a-l),f=(p-d)*(o-a)-(c-l)*(u-h),g=m/f,v=((o-a)*(h-d)-(u-h)*(a-l))/f;if(0===f&&0!==m||g<=0||g>=1||v<0||v>1)return null;if(0===m&&0===f){for(let l=0;l<2;l++){if(r(0===l?i:s,t,e),0==n.loc){const t=0===l?i:s;return{x:t.x,y:t.y,t:n.t}}if(2==n.loc)return{x:+(a+n.t*(o-a)).toPrecision(10),y:+(h+n.t*(u-h)).toPrecision(10),t:n.t}}return null}for(let y=0;y<2;y++)if(r(0===y?i:s,t,e),0==n.loc){const t=0===y?i:s;return{x:t.x,y:t.y,t:n.t}}return{x:+(a+g*(o-a)).toPrecision(10),y:+(h+g*(u-h)).toPrecision(10),t:g}}function r(t,e,i){const r=i.x-e.x,s=i.y-e.y,a=t.x-e.x,o=t.y-e.y,l=r*o-a*s;if(t.x===e.x&&t.y===e.y)return n.loc=0,void(n.t=0);if(t.x===i.x&&t.y===i.y)return n.loc=1,void(n.t=1);if(l<-Number.EPSILON)return void(n.loc=3);if(l>Number.EPSILON)return void(n.loc=4);if(r*a<0||s*o<0)return void(n.loc=5);if(Math.sqrt(r*r+s*s){const n=t.getPoints();let i=-999999999,r=e,o=-999999999,l=e;for(let e=0;ei&&(i=t.y),t.yo&&(o=t.x),t.x=l&&(s=l-1),{curves:t.curves,points:n,isCW:Ul.isClockWise(n),identifier:-1,boundingBox:new Ch(new Xt(l,r),new Xt(o,i))}}));o=o.filter((t=>t.points.length>1));for(let h=0;hfunction(t,e,n,r,s){null!=s&&""!==s||(s="nonzero");const a=new Xt;t.boundingBox.getCenter(a);const o=function(t,e,n){const r=new Xt;e.getCenter(r);const s=[];return n.forEach((e=>{if(e.boundingBox.containsPoint(r)){const n=function(t,e){const n=[],r=[];for(let s=1;st.t<=s.t+Number.EPSILON&&t.t>=s.t-Number.EPSILON))&&(n.push(s),r.push(new Xt(s.x,s.y)))}}return r}(t,e.points);n.forEach((t=>{s.push({identifier:e.identifier,isCW:e.isCW,point:t})}))}})),s.sort(((t,e)=>t.point.x-e.point.x)),s}([new Xt(n,a.y),new Xt(r,a.y)],t.boundingBox,e);o.sort(((t,e)=>t.point.x-e.point.x));const l=[],c=[];o.forEach((e=>{e.identifier===t.identifier?l.push(e):c.push(e)}));const h=l[0].point.x,u=[];let d=0;for(;d0&&u[u.length-1]===c[d].identifier?u.pop():u.push(c[d].identifier),d++;if(u.push(t.identifier),"evenodd"===s){const e=u.length%2==0,n=u[u.length-2];return{identifier:t.identifier,isHole:e,for:n}}if("nonzero"===s){let n=!0,i=null,r=null;for(let t=0;t{if(!l[t.identifier].isHole){const e=new ul;e.curves=t.curves,l.filter((e=>e.isHole&&e.for===t.identifier)).forEach((t=>{const n=o[t.identifier],i=new Qo;i.curves=n.curves,e.holes.push(i)})),c.push(e)}})),c}static getStrokeStyle(t,e,n,i,r){return{strokeColor:e=void 0!==e?e:"#000",strokeWidth:t=void 0!==t?t:1,strokeLineJoin:n=void 0!==n?n:"miter",strokeLineCap:i=void 0!==i?i:"butt",strokeMiterLimit:r=void 0!==r?r:4}}static pointsToStroke(t,e,n,i){const r=[],s=[],a=[];if(0===Rp.pointsToStrokeWithBuffers(t,e,n,i,r,s,a))return null;const o=new si;return o.setAttribute("position",new Zn(r,3)),o.setAttribute("normal",new Zn(s,3)),o.setAttribute("uv",new Zn(a,2)),o}static pointsToStrokeWithBuffers(t,e,n,i,r,s,a,o){const l=new Xt,c=new Xt,h=new Xt,u=new Xt,d=new Xt,p=new Xt,m=new Xt,f=new Xt,g=new Xt,v=new Xt,y=new Xt,x=new Xt,_=new Xt,b=new Xt,M=new Xt,w=new Xt,S=new Xt;n=void 0!==n?n:12,i=void 0!==i?i:.001,o=void 0!==o?o:0,t=function(t){let e=!1;for(let r=1,s=t.length-1;r=i&&n.push(t[r]);return n.push(t[t.length-1]),n}(t);const T=t.length;if(T<2)return 0;const A=t[0].equals(t[T-1]);let E,R,C=t[0];const P=e.strokeWidth/2,L=1/(T-1);let I,N,O,D,U=0,B=!1,F=0,k=3*o,z=2*o;V(t[0],t[1],l).multiplyScalar(P),f.copy(t[0]).sub(l),g.copy(t[0]).add(l),v.copy(f),y.copy(g);for(let Y=1;YNumber.EPSILON){const n=P/t;h.multiplyScalar(-n),u.subVectors(E,C),d.copy(u).setLength(n).add(h),w.copy(d).negate();const i=d.length(),r=u.length();u.divideScalar(r),p.subVectors(R,E);const s=p.length();switch(p.divideScalar(s),u.dot(w){const n=/\.fbx$|\.glb$|\.gltf$/.test(e);/\.jpe?g$|\.png$/.test(e)?this.textureLoader.load(e,(e=>t(e))):(n?this.fileLoader.setResponseType("arraybuffer"):this.fileLoader.setResponseType("undefined"),this.fileLoader.load(e,(e=>t(e))))}))}async textureAtlas(t,e,n="JSONHash"){let i=JSON.parse(await this.file(e));if(i.textures){const t=i.textures[0].frames;let e={frames:{}};t.forEach((t=>{e={...e,frames:{...e.frames,[t.filename]:{frame:t.frame,rotated:t.rotated,sourceSize:t.sourceSize,spriteSourceSize:t.spriteSourceSize,trimmed:t.trimmed}}}})),i=e}return{texture:await this.texture(t),json:i}}file(t){const e=this.cache.get(t);return t=e||t,new Promise((e=>{this.fileLoader.load(t,(t=>e(t)))}))}svg(t){const e=this.cache.get(t);return t=e||t,new Promise((e=>{this.svgLoader.load(t,(t=>e(t)))}))}texture(t){if(!/^data:image\/[\S]+;base64,/gm.test(t)){const e=this.cache.get(t);t=e||t}return new Promise((e=>{this.textureLoader.load(t,(t=>{t.anisotropy=this.textureAnisotropy,t.needsUpdate=!0,e(t)}))}))}object(t){const e=this.cache.get(t);return t=e||t,new Promise((e=>{this.objectLoader.load(t,(t=>{e(t)}))}))}gltf(t){const e=this.cache.get(t);return t=e||t,new Promise((e=>{this.gltfLoader.load(t,(t=>{e(t)}))}))}fbx(t){const e=this.cache.get(t);return t=e||t,new Promise((e=>{this.fbxLoader.load(t,(t=>{e(t)}))}))}}class Pp extends Sn{constructor(t,e,n,i){super(),this.scene=t,this.light=e,this.size=n,this.color=i,this.geo=new jl(n||.2,16,8),this.mat=new jn({color:i||e.color}),this.mesh=new wi(this.geo,this.mat),this.add(this.mesh),e.add(this)}dispose(){this.mesh.geometry.dispose(),Array.isArray(this.mesh.material)?this.mesh.material.forEach((t=>t.dispose())):this.mesh.material.dispose(),this.remove(this.mesh)}update(){}}class Lp{constructor(t){this.scene=t}get helper(){return{directionalLightHelper:(t,e,n)=>{const i=new Fh(t,e,n);return this.scene.add(i),i},spotLightHelper:(t,e)=>{const n=new Oh(t,e);return this.scene.add(n),n},pointLightHelper:(t,e,n)=>new Pp(this.scene,t,e,n)}}directionalLight(t={}){const{color:e=16777215,intensity:n=1}=t,i=new Zc(e,n);return i.castShadow=!0,this.scene.add(i),i}hemisphereLight(t={}){const{skyColor:e=16777215,groundColor:n=16777215,intensity:i=1}=t,r=new Fc(e,n,i);return this.scene.add(r),r}ambientLight(t={}){const{color:e=16777215,intensity:n=1}=t,i=new $c(e,n);return this.scene.add(i),i}pointLight(t={}){const{color:e=16777215,intensity:n=1,distance:i=0,decay:r=1}=t,s=new Kc(e,n,i,r);return s.castShadow=!0,this.scene.add(s),s}spotLight(t={}){const{color:e=16777215,intensity:n=1,distance:i=0,angle:r=Math.PI/8,penumbra:s=0,decay:a=1}=t,o=new Wc(e,n,i,r,s,a);return o.castShadow=!0,this.scene.add(o),o}rectAreaLight(t={}){const{color:e=16777215,intensity:n=1,width:i=10,height:r=10}=t,s=new Qc(e,n,i,r);return this.scene.add(s),s}}class Ip{constructor(t){this.scene=t}add(t,e={}){const n=this.make(t,e);return n?this.scene.add(n):console.warn("Could not make heightmap"),n}make(t,e={}){const{image:n}=t,{width:i,height:r}=n,{colorScale:s,heightScale:a=100,colorSpace:o=""}=e,l=document.createElement("canvas");l.width=i,l.height=r;const c=l.getContext("2d");if(!c)return;c.drawImage(t.image,0,0);const h=c.getImageData(0,0,i,r),u=new Xi(10,10,i-1,r-1);let d={color:13421772,side:2};s&&(d={...d,vertexColors:!0});const p=new nc(d),m=new tu(u,p);m.receiveShadow=m.castShadow=!0,m.shape="concave";const f=u.attributes.position.array;for(let g=0;gMath.PI&&(y-=f),M<-Math.PI?M+=f:M>Math.PI&&(M-=f),a.theta=y<=M?Math.max(y,Math.min(M,a.theta)):a.theta>(y+M)/2?Math.max(y,a.theta):Math.min(M,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),!0===n.enableDamping?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.zoomToCursor&&b||n.object.isOrthographicCamera?a.radius=N(a.radius):a.radius=N(a.radius*l),e.setFromSpherical(a),e.applyQuaternion(u),v.copy(n.target).add(e),n.object.lookAt(n.target),!0===n.enableDamping?(o.theta*=1-n.dampingFactor,o.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(o.set(0,0,0),c.set(0,0,0));let w=!1;if(n.zoomToCursor&&b){let i=null;if(n.object.isPerspectiveCamera){const t=e.length();i=N(t*l);const r=t-i;n.object.position.addScaledVector(x,r),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const t=new Me(_.x,_.y,0);t.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),w=!0;const r=new Me(_.x,_.y,0);r.unproject(n.object),n.object.position.sub(r).add(t),n.object.updateMatrixWorld(),i=e.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;null!==i&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(i).add(n.object.position):(Up.origin.copy(n.object.position),Up.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Up.direction))s||8*(1-p.dot(n.object.quaternion))>s||m.distanceToSquared(n.target)>0)&&(n.dispatchEvent(Np),d.copy(n.object.position),p.copy(n.object.quaternion),m.copy(n.target),w=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",q),n.domElement.removeEventListener("pointerdown",H),n.domElement.removeEventListener("pointercancel",W),n.domElement.removeEventListener("wheel",j),n.domElement.removeEventListener("pointermove",G),n.domElement.removeEventListener("pointerup",W),null!==n._domElementKeyEvents&&(n._domElementKeyEvents.removeEventListener("keydown",X),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=i.NONE;const s=1e-6,a=new Eh,o=new Eh;let l=1;const c=new Me,h=new Xt,u=new Xt,d=new Xt,p=new Xt,m=new Xt,f=new Xt,g=new Xt,v=new Xt,y=new Xt,x=new Me,_=new Xt;let b=!1;const M=[],w={};function S(){return Math.pow(.95,n.zoomSpeed)}function T(t){o.theta-=t}function A(t){o.phi-=t}const E=function(){const t=new Me;return function(e,n){t.setFromMatrixColumn(n,0),t.multiplyScalar(-e),c.add(t)}}(),R=function(){const t=new Me;return function(e,i){!0===n.screenSpacePanning?t.setFromMatrixColumn(i,1):(t.setFromMatrixColumn(i,0),t.crossVectors(n.object.up,t)),t.multiplyScalar(e),c.add(t)}}(),C=function(){const t=new Me;return function(e,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const s=n.object.position;t.copy(s).sub(n.target);let a=t.length();a*=Math.tan(n.object.fov/2*Math.PI/180),E(2*e*a/r.clientHeight,n.object.matrix),R(2*i*a/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(E(e*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),R(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function P(t){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function L(t){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(t){if(!n.zoomToCursor)return;b=!0;const e=n.domElement.getBoundingClientRect(),i=t.clientX-e.left,r=t.clientY-e.top,s=e.width,a=e.height;_.x=i/s*2-1,_.y=-r/a*2+1,x.set(_.x,_.y,1).unproject(n.object).sub(n.object.position).normalize()}function N(t){return Math.max(n.minDistance,Math.min(n.maxDistance,t))}function O(t){h.set(t.clientX,t.clientY)}function D(t){p.set(t.clientX,t.clientY)}function U(){if(1===M.length)h.set(M[0].pageX,M[0].pageY);else{const t=.5*(M[0].pageX+M[1].pageX),e=.5*(M[0].pageY+M[1].pageY);h.set(t,e)}}function B(){if(1===M.length)p.set(M[0].pageX,M[0].pageY);else{const t=.5*(M[0].pageX+M[1].pageX),e=.5*(M[0].pageY+M[1].pageY);p.set(t,e)}}function F(){const t=M[0].pageX-M[1].pageX,e=M[0].pageY-M[1].pageY,n=Math.sqrt(t*t+e*e);g.set(0,n)}function k(t){if(1==M.length)u.set(t.pageX,t.pageY);else{const e=K(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);u.set(n,i)}d.subVectors(u,h).multiplyScalar(n.rotateSpeed);const e=n.domElement;T(2*Math.PI*d.x/e.clientHeight),A(2*Math.PI*d.y/e.clientHeight),h.copy(u)}function z(t){if(1===M.length)m.set(t.pageX,t.pageY);else{const e=K(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);m.set(n,i)}f.subVectors(m,p).multiplyScalar(n.panSpeed),C(f.x,f.y),p.copy(m)}function V(t){const e=K(t),i=t.pageX-e.x,r=t.pageY-e.y,s=Math.sqrt(i*i+r*r);v.set(0,s),y.set(0,Math.pow(v.y/g.y,n.zoomSpeed)),P(y.y),g.copy(v)}function H(t){!1!==n.enabled&&(0===M.length&&(n.domElement.setPointerCapture(t.pointerId),n.domElement.addEventListener("pointermove",G),n.domElement.addEventListener("pointerup",W)),function(t){M.push(t)}(t),"touch"===t.pointerType?function(t){switch(Y(t),M.length){case 1:switch(n.touches.ONE){case 0:if(!1===n.enableRotate)return;U(),r=i.TOUCH_ROTATE;break;case 1:if(!1===n.enablePan)return;B(),r=i.TOUCH_PAN;break;default:r=i.NONE}break;case 2:switch(n.touches.TWO){case 2:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&F(),n.enablePan&&B(),r=i.TOUCH_DOLLY_PAN;break;case 3:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&F(),n.enableRotate&&U(),r=i.TOUCH_DOLLY_ROTATE;break;default:r=i.NONE}break;default:r=i.NONE}r!==i.NONE&&n.dispatchEvent(Op)}(t):function(t){let e;switch(t.button){case 0:e=n.mouseButtons.LEFT;break;case 1:e=n.mouseButtons.MIDDLE;break;case 2:e=n.mouseButtons.RIGHT;break;default:e=-1}switch(e){case 1:if(!1===n.enableZoom)return;!function(t){I(t),g.set(t.clientX,t.clientY)}(t),r=i.DOLLY;break;case 0:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===n.enablePan)return;D(t),r=i.PAN}else{if(!1===n.enableRotate)return;O(t),r=i.ROTATE}break;case 2:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===n.enableRotate)return;O(t),r=i.ROTATE}else{if(!1===n.enablePan)return;D(t),r=i.PAN}break;default:r=i.NONE}r!==i.NONE&&n.dispatchEvent(Op)}(t))}function G(t){!1!==n.enabled&&("touch"===t.pointerType?function(t){switch(Y(t),r){case i.TOUCH_ROTATE:if(!1===n.enableRotate)return;k(t),n.update();break;case i.TOUCH_PAN:if(!1===n.enablePan)return;z(t),n.update();break;case i.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(t){n.enableZoom&&V(t),n.enablePan&&z(t)}(t),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(t){n.enableZoom&&V(t),n.enableRotate&&k(t)}(t),n.update();break;default:r=i.NONE}}(t):function(t){switch(r){case i.ROTATE:if(!1===n.enableRotate)return;!function(t){u.set(t.clientX,t.clientY),d.subVectors(u,h).multiplyScalar(n.rotateSpeed);const e=n.domElement;T(2*Math.PI*d.x/e.clientHeight),A(2*Math.PI*d.y/e.clientHeight),h.copy(u),n.update()}(t);break;case i.DOLLY:if(!1===n.enableZoom)return;!function(t){v.set(t.clientX,t.clientY),y.subVectors(v,g),y.y>0?P(S()):y.y<0&&L(S()),g.copy(v),n.update()}(t);break;case i.PAN:if(!1===n.enablePan)return;!function(t){m.set(t.clientX,t.clientY),f.subVectors(m,p).multiplyScalar(n.panSpeed),C(f.x,f.y),p.copy(m),n.update()}(t)}}(t))}function W(t){!function(t){delete w[t.pointerId];for(let e=0;e0&&P(S()),n.update()}(t),n.dispatchEvent(Dp))}function X(t){!1!==n.enabled&&!1!==n.enablePan&&function(t){let e=!1;switch(t.code){case n.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?A(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(0,n.keyPanSpeed),e=!0;break;case n.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?A(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(0,-n.keyPanSpeed),e=!0;break;case n.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?T(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(n.keyPanSpeed,0),e=!0;break;case n.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?T(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(-n.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),n.update())}(t)}function q(t){!1!==n.enabled&&t.preventDefault()}function Y(t){let e=w[t.pointerId];void 0===e&&(e=new Xt,w[t.pointerId]=e),e.set(t.pageX,t.pageY)}function K(t){const e=t.pointerId===M[0].pointerId?M[1]:M[0];return w[e.pointerId]}n.domElement.addEventListener("contextmenu",q),n.domElement.addEventListener("pointerdown",H),n.domElement.addEventListener("pointercancel",W),n.domElement.addEventListener("wheel",j,{passive:!1}),this.update()}}class zp{constructor(t,e,n,i,r,s,a){this.scene=t,this.renderer=e,this.camera=n,this.lights=i,this.physics=r,this.load=s,this.factories=a}async warpSpeed(...t){let e={};const n=t.filter((t=>/^-\w+/.test(t))),i=n.length>0;if((0===t.length||i)&&(t=["light","camera","lookAtCenter","ground","grid","orbitControls","fog","sky"]),i&&n.map((t=>t.substr(1))).forEach((e=>{const n=t.indexOf(e);t.splice(n,1)})),t.includes("sky")){const t=["varying vec3 vWorldPosition;","","void main() {","","vec4 worldPosition = modelMatrix * vec4( position, 1.0 );","vWorldPosition = worldPosition.xyz;","","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","","}"].join("\n"),e=["uniform vec3 topColor;","uniform vec3 bottomColor;","uniform float offset;","uniform float exponent;","","varying vec3 vWorldPosition;","","void main() {","","float h = normalize( vWorldPosition + offset ).y;","gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( max( h , 0.0), exponent ), 0.0 ) ), 1.0 );","","}"].join("\n"),n={topColor:{value:new Gn(30719)},bottomColor:{value:new Gn(15595007)},offset:{value:33},exponent:{value:.6}};var r=new jl(500,32,15),s=new Pi({uniforms:n,vertexShader:t,fragmentShader:e,side:1}),a=new wi(r,s);this.scene.add(a)}if(t.includes("camera")&&(this.camera.position.set(0,6,12),e={camera:this.camera,...e}),t.includes("light")){const t=1,n=this.lights.hemisphereLight({skyColor:16777215,groundColor:0,intensity:t}),i=this.lights.ambientLight({color:16777215,intensity:t}),r=this.lights.directionalLight({color:16777215,intensity:t});r.position.set(100,200,50);const s=20;r.shadow.camera.top=s,r.shadow.camera.bottom=-s,r.shadow.camera.left=-s,r.shadow.camera.right=s,r.shadow.mapSize.set(1024,1024),e={lights:{ambientLight:i,directionalLight:r,hemisphereLight:n},...e}}if(t.includes("lookAtCenter")&&this.camera.lookAt(this.scene.position),t.includes("ground")){const n=t.includes("grid"),i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOnAAADusBZ+q87AAAAJtJREFUeJzt0EENwDAAxLDbNP6UOxh+NEYQ5dl2drFv286598GrA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAu37AD8eaBH5JQdVbAAAAAElFTkSuQmCC",r=await this.load.texture(i);r.wrapS=r.wrapT=B,r.repeat.set(21,21);const s={name:"ground",width:21,height:21,depth:1,y:-.5},a={phong:{map:n?r:null,color:16777215}};let o;window.__loadPhysics?(o=this.physics.add.ground(s,a),o.body.setRestitution(1)):o=this.factories.add.ground(s,a),o.receiveShadow=!0,e={ground:o,...e}}return t.includes("orbitControls")&&(e={orbitControls:new kp(this.camera,document.getElementById("enable3d-phaser-canvas")||this.renderer.domElement),...e}),e}}class Vp{constructor(){this._mixers=[]}animationMixer(t){const e=new wh(t);return this.mixers.add(e),e}get mixers(){return{create:t=>this.animationMixer(t),add:t=>this._mixers.push(t),get:()=>this._mixers,update:t=>{var e;return null==(e=this._mixers)?void 0:e.forEach((e=>e.update(t/1e3)))}}}}class Hp extends wi{constructor(t,e={}){super(t),this.isReflector=!0,this.type="Reflector",this.camera=new Ii;const n=this,i=void 0!==e.color?new Gn(e.color):new Gn(8355711),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||Hp.ReflectorShader,l=void 0!==e.multisample?e.multisample:4,c=new zi,h=new Me,u=new Me,d=new Me,p=new $e,m=new Me(0,0,-1),f=new ge,g=new Me,v=new Me,y=new ge,x=new $e,_=this.camera,b=new ye(r,s,{samples:l,type:J}),M=new Pi({name:void 0!==o.name?o.name:"unspecified",uniforms:Ci.clone(o.uniforms),fragmentShader:o.fragmentShader,vertexShader:o.vertexShader});M.uniforms.tDiffuse.value=b.texture,M.uniforms.color.value=i,M.uniforms.textureMatrix.value=x,this.material=M,this.onBeforeRender=function(t,e,i){if(u.setFromMatrixPosition(n.matrixWorld),d.setFromMatrixPosition(i.matrixWorld),p.extractRotation(n.matrixWorld),h.set(0,0,1),h.applyMatrix4(p),g.subVectors(u,d),g.dot(h)>0)return;g.reflect(h).negate(),g.add(u),p.extractRotation(i.matrixWorld),m.set(0,0,-1),m.applyMatrix4(p),m.add(d),v.subVectors(u,m),v.reflect(h).negate(),v.add(u),_.position.copy(g),_.up.set(0,1,0),_.up.applyMatrix4(p),_.up.reflect(h),_.lookAt(v),_.far=i.far,_.updateMatrixWorld(),_.projectionMatrix.copy(i.projectionMatrix),x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(_.projectionMatrix),x.multiply(_.matrixWorldInverse),x.multiply(n.matrixWorld),c.setFromNormalAndCoplanarPoint(h,u),c.applyMatrix4(_.matrixWorldInverse),f.set(c.normal.x,c.normal.y,c.normal.z,c.constant);const r=_.projectionMatrix;y.x=(Math.sign(f.x)+r.elements[8])/r.elements[0],y.y=(Math.sign(f.y)+r.elements[9])/r.elements[5],y.z=-1,y.w=(1+r.elements[10])/r.elements[14],f.multiplyScalar(2/f.dot(y)),r.elements[2]=f.x,r.elements[6]=f.y,r.elements[10]=f.z+1-a,r.elements[14]=f.w,n.visible=!1;const s=t.getRenderTarget(),o=t.xr.enabled,l=t.shadowMap.autoUpdate;t.xr.enabled=!1,t.shadowMap.autoUpdate=!1,t.setRenderTarget(b),t.state.buffers.depth.setMask(!0),!1===t.autoClear&&t.clear(),t.render(e,_),t.xr.enabled=o,t.shadowMap.autoUpdate=l,t.setRenderTarget(s);const M=i.viewport;void 0!==M&&t.state.viewport(M),n.visible=!0},this.getRenderTarget=function(){return b},this.dispose=function(){b.dispose(),n.material.dispose()}}}Hp.ReflectorShader={name:"ReflectorShader",uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:"\n\t\tuniform mat4 textureMatrix;\n\t\tvarying vec4 vUv;\n\n\t\t#include \n\t\t#include \n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t#include \n\n\t\t}",fragmentShader:"\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\t\tvarying vec4 vUv;\n\n\t\t#include \n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}"};class Gp extends wi{constructor(t,e={}){super(t),this.isRefractor=!0,this.type="Refractor",this.camera=new Ii;const n=this,i=void 0!==e.color?new Gn(e.color):new Gn(8355711),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||Gp.RefractorShader,l=void 0!==e.multisample?e.multisample:4,c=this.camera;c.matrixAutoUpdate=!1,c.userData.refractor=!0;const h=new zi,u=new $e,d=new ye(r,s,{samples:l,type:J});this.material=new Pi({uniforms:Ci.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,transparent:!0}),this.material.uniforms.color.value=i,this.material.uniforms.tDiffuse.value=d.texture,this.material.uniforms.textureMatrix.value=u;const p=function(){const t=new Me,e=new Me,i=new $e,r=new Me,s=new Me;return function(a){return t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(a.matrixWorld),r.subVectors(t,e),i.extractRotation(n.matrixWorld),s.set(0,0,1),s.applyMatrix4(i),r.dot(s)<0}}(),m=function(){const t=new Me,e=new Me,i=new be,r=new Me;return function(){n.matrixWorld.decompose(e,i,r),t.set(0,0,1).applyQuaternion(i).normalize(),t.negate(),h.setFromNormalAndCoplanarPoint(t,e)}}(),f=function(){const t=new zi,e=new ge,n=new ge;return function(i){c.matrixWorld.copy(i.matrixWorld),c.matrixWorldInverse.copy(c.matrixWorld).invert(),c.projectionMatrix.copy(i.projectionMatrix),c.far=i.far,t.copy(h),t.applyMatrix4(c.matrixWorldInverse),e.set(t.normal.x,t.normal.y,t.normal.z,t.constant);const r=c.projectionMatrix;n.x=(Math.sign(e.x)+r.elements[8])/r.elements[0],n.y=(Math.sign(e.y)+r.elements[9])/r.elements[5],n.z=-1,n.w=(1+r.elements[10])/r.elements[14],e.multiplyScalar(2/e.dot(n)),r.elements[2]=e.x,r.elements[6]=e.y,r.elements[10]=e.z+1-a,r.elements[14]=e.w}}();this.onBeforeRender=function(t,e,i){!0!==i.userData.refractor&&1!=!p(i)&&(m(),function(t){u.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),u.multiply(t.projectionMatrix),u.multiply(t.matrixWorldInverse),u.multiply(n.matrixWorld)}(i),f(i),function(t,e,i){n.visible=!1;const r=t.getRenderTarget(),s=t.xr.enabled,a=t.shadowMap.autoUpdate;t.xr.enabled=!1,t.shadowMap.autoUpdate=!1,t.setRenderTarget(d),!1===t.autoClear&&t.clear(),t.render(e,c),t.xr.enabled=s,t.shadowMap.autoUpdate=a,t.setRenderTarget(r);const o=i.viewport;void 0!==o&&t.state.viewport(o),n.visible=!0}(t,e,i))},this.getRenderTarget=function(){return d},this.dispose=function(){d.dispose(),n.material.dispose()}}}Gp.RefractorShader={uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:"\n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec4 vUv;\n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}"};class Wp extends wi{constructor(t,e={}){super(t),this.isWater=!0,this.type="Water";const n=this,i=void 0!==e.color?new Gn(e.color):new Gn(16777215),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.flowDirection||new Xt(1,0),l=e.flowSpeed||.03,c=e.reflectivity||.02,h=e.scale||1,u=e.shader||Wp.WaterShader,d=new Uc,p=e.flowMap||void 0,m=e.normalMap0||d.load("textures/water/Water_1_M_Normal.jpg"),f=e.normalMap1||d.load("textures/water/Water_2_M_Normal.jpg"),g=.15,v=.075,y=new $e,x=new uh;if(void 0===Hp)return void console.error("THREE.Water: Required component Reflector not found.");if(void 0===Gp)return void console.error("THREE.Water: Required component Refractor not found.");const _=new Hp(t,{textureWidth:r,textureHeight:s,clipBias:a}),b=new Gp(t,{textureWidth:r,textureHeight:s,clipBias:a});_.matrixAutoUpdate=!1,b.matrixAutoUpdate=!1,this.material=new Pi({uniforms:Ci.merge([Yi.fog,u.uniforms]),vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,transparent:!0,fog:!0}),void 0!==p?(this.material.defines.USE_FLOWMAP="",this.material.uniforms.tFlowMap={type:"t",value:p}):this.material.uniforms.flowDirection={type:"v2",value:o},m.wrapS=m.wrapT=B,f.wrapS=f.wrapT=B,this.material.uniforms.tReflectionMap.value=_.getRenderTarget().texture,this.material.uniforms.tRefractionMap.value=b.getRenderTarget().texture,this.material.uniforms.tNormalMap0.value=m,this.material.uniforms.tNormalMap1.value=f,this.material.uniforms.color.value=i,this.material.uniforms.reflectivity.value=c,this.material.uniforms.textureMatrix.value=y,this.material.uniforms.config.value.x=0,this.material.uniforms.config.value.y=v,this.material.uniforms.config.value.z=v,this.material.uniforms.config.value.w=h,this.onBeforeRender=function(t,e,i){!function(t){y.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),y.multiply(t.projectionMatrix),y.multiply(t.matrixWorldInverse),y.multiply(n.matrixWorld)}(i),function(){const t=x.getDelta(),e=n.material.uniforms.config;e.value.x+=l*t,e.value.y=e.value.x+v,e.value.x>=g?(e.value.x=0,e.value.y=v):e.value.y>=g&&(e.value.y=e.value.y-g)}(),n.visible=!1,_.matrixWorld.copy(n.matrixWorld),b.matrixWorld.copy(n.matrixWorld),_.onBeforeRender(t,e,i),b.onBeforeRender(t,e,i),n.visible=!0}}}Wp.WaterShader={uniforms:{color:{type:"c",value:null},reflectivity:{type:"f",value:0},tReflectionMap:{type:"t",value:null},tRefractionMap:{type:"t",value:null},tNormalMap0:{type:"t",value:null},tNormalMap1:{type:"t",value:null},textureMatrix:{type:"m4",value:null},config:{type:"v4",value:new ge}},vertexShader:"\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tvCoord = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvToEye = cameraPosition - worldPosition.xyz;\n\n\t\t\tvec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex\n\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}",fragmentShader:"\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform sampler2D tReflectionMap;\n\t\tuniform sampler2D tRefractionMap;\n\t\tuniform sampler2D tNormalMap0;\n\t\tuniform sampler2D tNormalMap1;\n\n\t\t#ifdef USE_FLOWMAP\n\t\t\tuniform sampler2D tFlowMap;\n\t\t#else\n\t\t\tuniform vec2 flowDirection;\n\t\t#endif\n\n\t\tuniform vec3 color;\n\t\tuniform float reflectivity;\n\t\tuniform vec4 config;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\tfloat flowMapOffset0 = config.x;\n\t\t\tfloat flowMapOffset1 = config.y;\n\t\t\tfloat halfCycle = config.z;\n\t\t\tfloat scale = config.w;\n\n\t\t\tvec3 toEye = normalize( vToEye );\n\n\t\t\t// determine flow direction\n\t\t\tvec2 flow;\n\t\t\t#ifdef USE_FLOWMAP\n\t\t\t\tflow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;\n\t\t\t#else\n\t\t\t\tflow = flowDirection;\n\t\t\t#endif\n\t\t\tflow.x *= - 1.0;\n\n\t\t\t// sample normal maps (distort uvs with flowdata)\n\t\t\tvec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );\n\t\t\tvec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );\n\n\t\t\t// linear interpolate to get the final normal color\n\t\t\tfloat flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;\n\t\t\tvec4 normalColor = mix( normalColor0, normalColor1, flowLerp );\n\n\t\t\t// calculate normal vector\n\t\t\tvec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n\n\t\t\t// calculate the fresnel term to blend reflection and refraction maps\n\t\t\tfloat theta = max( dot( toEye, normal ), 0.0 );\n\t\t\tfloat reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );\n\n\t\t\t// calculate final uv coords\n\t\t\tvec3 coord = vCoord.xyz / vCoord.w;\n\t\t\tvec2 uv = coord.xy + coord.z * normal.xz * 0.05;\n\n\t\t\tvec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );\n\t\t\tvec4 refractColor = texture2D( tRefractionMap, uv );\n\n\t\t\t// multiply water color with the mix of both textures\n\t\t\tgl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}"};class jp{constructor(t,e,n){this.scene=t,this.renderer=e,this.factories=n}water(t={}){((t,e,n={})=>{const{width:i=20,height:r=20,x:s=0,y:a=0,z:o=0,color:l="#ffffff",scale:c=4,flowX:h=1,flowY:u=1,normalMap0:d,normalMap1:p}=n,m=new Xi(i,r),f=new tc({color:30654,transparent:!0,opacity:.8}),g=new wi(m,f);g.position.set(s,a,o),g.rotation.x=-.5*Math.PI,t.add(g);const v=new Xi(i,r),y=new Wp(v,{color:l,scale:c,flowDirection:new Xt(h,u),textureWidth:1024,textureHeight:1024,normalMap0:d,normalMap1:p,encoding:e.outputEncoding});y.position.set(s,a+.1,o),y.rotation.x=-.5*Math.PI,t.add(y)})(this.scene,this.renderer,t)}textureCube(t){6!==t.length&&Hh("You need to pass 6 urls to textureCube()");const e=new Xp;return t.forEach(((t,n)=>{t.wrapS=t.wrapT=B;const i=this.factories.add.material({phong:{map:t}});e.materials[n]=i})),e}}class Xp{constructor(){this.materials=new Array(6)}get texture(){return{left:this.getTexture(0),right:this.getTexture(1),up:this.getTexture(2),down:this.getTexture(3),front:this.getTexture(4),back:this.getTexture(5)}}getTexture(t){return this.materials[t].map}}class qp{constructor(t,e){this.camera=t,this.renderer=e,this.tmpVector2=new Xt}fromSVGtoShape(t){if(t){const e=new Rp,n=[];return e.parse(t).paths.forEach((t=>{Rp.createShapes(t).forEach((t=>{n.push(t)}))})),n}return[]}from3dto2d(t){const e=new Me(t.x,t.y,t.z),n=this.renderer.domElement;this.camera.updateMatrixWorld(),e.project(this.camera);const i=Math.round((e.x+1)*(n.width/2)),r=Math.round((1-e.y)*(n.height/2));return new Xt(i,r)}from2dto3d(t,e,n){var i;if(!this.tmpPlane){const t=new Xi(1e4,1e4),e=new jn({transparent:!0,opacity:.25});this.tmpPlane=new wi(t,e),this.tmpPlane.name="_tmp_raycast_plane"}let r;this.tmpRaycaster||(this.tmpRaycaster=new Sh),this.tmpVector3||(this.tmpVector3=new Me),this.tmpPlane.setRotationFromEuler(this.camera.rotation);const s=this.camera.position;this.tmpPlane.position.set(s.x,s.y,s.z),this.camera.getWorldDirection(this.tmpVector3),this.tmpPlane.position.add(this.tmpVector3.clone().multiplyScalar(n)),this.tmpPlane.updateMatrix(),this.tmpPlane.updateMatrixWorld(!0),this.tmpVector2.set(t,e),this.tmpRaycaster.setFromCamera(this.tmpVector2,this.camera);const a=this.tmpRaycaster.intersectObjects([this.tmpPlane]);return"_tmp_raycast_plane"===(null==(i=a[0])?void 0:i.object.name)&&(r=a[0].point),r}}class Yp{static createButton(t){const e=document.createElement("button");function n(){e.style.display="",e.style.cursor="auto",e.style.left="calc(50% - 75px)",e.style.width="150px",e.onmouseenter=null,e.onmouseleave=null,e.onclick=null}function i(t){t.style.position="absolute",t.style.bottom="20px",t.style.padding="12px 6px",t.style.border="1px solid #fff",t.style.borderRadius="4px",t.style.background="rgba(0,0,0,0.1)",t.style.color="#fff",t.style.font="normal 13px sans-serif",t.style.textAlign="center",t.style.opacity="0.5",t.style.outline="none",t.style.zIndex="999"}if("xr"in navigator)return e.id="VRButton",e.style.display="none",i(e),navigator.xr.isSessionSupported("immersive-vr").then((function(i){i?function(){let n=null;async function i(i){i.addEventListener("end",r),await t.xr.setSession(i),e.textContent="EXIT VR",n=i}function r(){n.removeEventListener("end",r),e.textContent="ENTER VR",n=null}e.style.display="",e.style.cursor="pointer",e.style.left="calc(50% - 50px)",e.style.width="100px",e.textContent="ENTER VR",e.onmouseenter=function(){e.style.opacity="1.0"},e.onmouseleave=function(){e.style.opacity="0.5"},e.onclick=function(){if(null===n){const t={optionalFeatures:["local-floor","bounded-floor","hand-tracking","layers"]};navigator.xr.requestSession("immersive-vr",t).then(i)}else n.end()}}():(n(),e.textContent="VR NOT SUPPORTED"),i&&Yp.xrSessionIsGranted&&e.click()})).catch((function(t){n(),console.warn("Exception when trying to call xr.isSessionSupported",t),e.textContent="VR NOT ALLOWED"})),e;{const t=document.createElement("a");return!1===window.isSecureContext?(t.href=document.location.href.replace(/^http:/,"https:"),t.innerHTML="WEBXR NEEDS HTTPS"):(t.href="https://immersiveweb.dev/",t.innerHTML="WEBXR NOT AVAILABLE"),t.style.left="calc(50% - 90px)",t.style.width="180px",t.style.textDecoration="none",i(t),t}}static registerSessionGrantedListener(){if("xr"in navigator){if(/WebXRViewer\//i.test(navigator.userAgent))return;navigator.xr.addEventListener("sessiongranted",(()=>{Yp.xrSessionIsGranted=!0}))}}}Yp.xrSessionIsGranted=!1,Yp.registerSessionGrantedListener();const Kp={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Jp(t){const e=await fetch(t);if(e.ok)return e.json();throw new Error(e.statusText)}const Zp={xAxis:0,yAxis:0,button:0,state:Kp.ComponentState.DEFAULT};class $p{constructor(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===Kp.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(Zp)}updateFromComponent({xAxis:t,yAxis:e,button:n,state:i}){const{normalizedXAxis:r,normalizedYAxis:s}=function(t=0,e=0){let n=t,i=e;if(Math.sqrt(t*t+e*e)>1){const r=Math.atan2(e,t);n=Math.cos(r),i=Math.sin(r)}return{normalizedXAxis:.5*n+.5,normalizedYAxis:.5*i+.5}}(t,e);switch(this.componentProperty){case Kp.ComponentProperty.X_AXIS:this.value=this.states.includes(i)?r:.5;break;case Kp.ComponentProperty.Y_AXIS:this.value=this.states.includes(i)?s:.5;break;case Kp.ComponentProperty.BUTTON:this.value=this.states.includes(i)?n:0;break;case Kp.ComponentProperty.STATE:this.valueNodeProperty===Kp.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(i):this.value=this.states.includes(i)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Qp{constructor(t,e){if(!(t&&e&&e.visualResponses&&e.gamepadIndices&&0!==Object.keys(e.gamepadIndices).length))throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach((t=>{const n=new $p(e.visualResponses[t]);this.visualResponses[t]=n})),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Kp.ComponentState.DEFAULT,button:void 0!==this.gamepadIndices.button?0:void 0,xAxis:void 0!==this.gamepadIndices.xAxis?0:void 0,yAxis:void 0!==this.gamepadIndices.yAxis?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(t){if(this.values.state=Kp.ComponentState.DEFAULT,void 0!==this.gamepadIndices.button&&t.buttons.length>this.gamepadIndices.button){const e=t.buttons[this.gamepadIndices.button];this.values.button=e.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,e.pressed||1===this.values.button?this.values.state=Kp.ComponentState.PRESSED:(e.touched||this.values.button>Kp.ButtonTouchThreshold)&&(this.values.state=Kp.ComponentState.TOUCHED)}void 0!==this.gamepadIndices.xAxis&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Kp.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Kp.AxisTouchThreshold&&(this.values.state=Kp.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.yAxis&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Kp.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Kp.AxisTouchThreshold&&(this.values.state=Kp.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach((t=>{t.updateFromComponent(this.values)}))}}class tm{constructor(t,e,n){if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=n,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach((t=>{const e=this.layoutDescription.components[t];this.components[t]=new Qp(t,e)})),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const t=[];return Object.values(this.components).forEach((e=>{t.push(e.data)})),t}updateFromGamepad(){Object.values(this.components).forEach((t=>{t.updateFromGamepad(this.xrInputSource.gamepad)}))}}class em extends Sn{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(t){return this.envMap==t||(this.envMap=t,this.traverse((t=>{t.isMesh&&(t.material.envMap=this.envMap,t.material.needsUpdate=!0)}))),this}updateMatrixWorld(t){super.updateMatrixWorld(t),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach((t=>{Object.values(t.visualResponses).forEach((t=>{const{valueNode:e,minNode:n,maxNode:i,value:r,valueNodeProperty:s}=t;e&&(s===Kp.VisualResponseProperty.VISIBILITY?e.visible=r:s===Kp.VisualResponseProperty.TRANSFORM&&(e.quaternion.slerpQuaternions(n.quaternion,i.quaternion,r),e.position.lerpVectors(n.position,i.position,r)))}))})))}}function nm(t,e){!function(t,e){Object.values(t.components).forEach((t=>{const{type:n,touchPointNodeName:i,visualResponses:r}=t;if(n===Kp.ComponentType.TOUCHPAD)if(t.touchPointNode=e.getObjectByName(i),t.touchPointNode){const e=new jl(.001),n=new jn({color:255}),i=new wi(e,n);t.touchPointNode.add(i)}else console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);Object.values(r).forEach((t=>{const{valueNodeName:n,minNodeName:i,maxNodeName:r,valueNodeProperty:s}=t;if(s===Kp.VisualResponseProperty.TRANSFORM){if(t.minNode=e.getObjectByName(i),t.maxNode=e.getObjectByName(r),!t.minNode)return void console.warn(`Could not find ${i} in the model`);if(!t.maxNode)return void console.warn(`Could not find ${r} in the model`)}t.valueNode=e.getObjectByName(n),t.valueNode||console.warn(`Could not find ${n} in the model`)}))}))}(t.motionController,e),t.envMap&&e.traverse((e=>{e.isMesh&&(e.material.envMap=t.envMap,e.material.needsUpdate=!0)})),t.add(e)}class im{constructor(t=null){this.gltfLoader=t,this.path="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",this._assetCache={},this.gltfLoader||(this.gltfLoader=new Bd)}createControllerModel(t){const e=new em;let n=null;return t.addEventListener("connected",(t=>{const i=t.data;"tracked-pointer"===i.targetRayMode&&i.gamepad&&async function(t,e,n=null,i=!0){if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const r=await async function(t){if(!t)throw new Error("No basePath supplied");return await Jp(`${t}/profilesList.json`)}(e);let s;if(t.profiles.some((t=>{const n=r[t];return n&&(s={profileId:t,profilePath:`${e}/${n.path}`,deprecated:!!n.deprecated}),!!s})),!s){if(!n)throw new Error("No matching profile name found");const t=r[n];if(!t)throw new Error(`No matching profile name found and default profile "${n}" missing.`);s={profileId:n,profilePath:`${e}/${t.path}`,deprecated:!!t.deprecated}}const a=await Jp(s.profilePath);let o;if(i){let e;if(e="any"===t.handedness?a.layouts[Object.keys(a.layouts)[0]]:a.layouts[t.handedness],!e)throw new Error(`No matching handedness, ${t.handedness}, in profile ${s.profileId}`);e.assetPath&&(o=s.profilePath.replace("profile.json",e.assetPath))}return{profile:a,assetPath:o}}(i,this.path,"generic-trigger").then((({profile:t,assetPath:r})=>{e.motionController=new tm(i,t,r);const s=this._assetCache[e.motionController.assetUrl];if(s)n=s.scene.clone(),nm(e,n);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(e.motionController.assetUrl,(t=>{this._assetCache[e.motionController.assetUrl]=t,n=t.scene.clone(),nm(e,n)}),null,(()=>{throw new Error(`Asset ${e.motionController.assetUrl} missing or malformed.`)}))}})).catch((t=>{console.warn(t)}))})),t.addEventListener("disconnected",(()=>{e.motionController=null,e.remove(n),n=null})),e}}class rm{constructor(t,e){this._renderer=t,this._scene=e,this.controllerModelFactory=new im;const n=new Qh;n.name="dot",this.cameraGroup=new ma,this.cameraGroup.add(n),e.add(this.cameraGroup),t.xr.enabled=!0;const i=Yp.createButton(t);i.style.cssText+="background: rgba(0, 0, 0, 0.8); ",document.body.appendChild(i),this._renderer.xr.getCamera().add(this.cameraGroup)}get isPresenting(){var t,e;return!!(null==(e=null==(t=this._renderer)?void 0:t.xr)?void 0:e.isPresenting)}getController(t){const e=this._renderer.xr.getController(t);return this.cameraGroup.add(e),e}getControllerGrip(t){const e=this._renderer.xr.getControllerGrip(t),n=this.controllerModelFactory.createControllerModel(e);return e.add(n),this.cameraGroup.add(e),e}getControllerRay(t){const{targetRayMode:e}=t;if("tracked-pointer"===e){const t=new si;t.setAttribute("position",new Zn([0,0,0,0,0,-1],3)),t.setAttribute("color",new Zn([1,0,0,1,1,1],3));const e=new yo({vertexColors:!0});return new So(t,e)}if("gaze"===e){const t=new Gl(.02,.04,32).translate(0,0,-1),e=new jn({color:"red",opacity:.5,transparent:!0});return new wi(t,e)}}get camera(){return this.WebXRCamera}get WebXRCamera(){var t;return{group:this.cameraGroup,position:null==(t=this._renderer.xr.getCamera())?void 0:t.position,rotation:this.isPresenting?this._renderer.xr.getCamera().rotation:void 0,getWorldDirection:t=>this.isPresenting?this._renderer.xr.getCamera().getWorldDirection(t):void 0}}}class sm{constructor(t){this.top=0,this.array=new Float32Array(t)}write(t){this.array[this.top++]=t.x,this.array[this.top++]=t.y,this.array[this.top++]=t.z}}class am{constructor(t){this.top=0,this.array=new Float32Array(t)}write(t){this.array[this.top++]=t.x,this.array[this.top++]=t.y}}class om{constructor(t){this.plane=null,this.front=null,this.back=null,this.polygons=[],t&&this.build(t)}clone(){const t=new om;return t.plane=this.plane&&this.plane.clone(),t.front=this.front&&this.front.clone(),t.back=this.back&&this.back.clone(),t.polygons=this.polygons.map((t=>t.clone())),t}invert(){for(let e=0;ecm.EPSILON?1:0;s|=n,a.push(n)}switch(s){case 0:(this.normal.dot(t.plane.normal)>0?e:n).push(t);break;case 1:i.push(t);break;case 2:r.push(t);break;case 3:{const e=[],n=[];for(let i=0;i=3&&i.push(new hm(e,t.shared)),n.length>=3&&r.push(new hm(n,t.shared));break}}}static fromPoints(t,e,n){const i=(new lm).copy(e).sub(t).cross((new lm).copy(n).sub(t)).normalize();return new cm(i.clone(),i.dot(t))}}cm.EPSILON=1e-5;class hm{constructor(t,e){this.vertices=t,this.shared=e,this.plane=cm.fromPoints(t[0].pos,t[1].pos,t[2].pos)}clone(){return new hm(this.vertices.map((t=>t.clone())),this.shared)}flip(){this.vertices.reverse().map((t=>t.flip())),this.plane.flip()}}class um{constructor(t,e,n,i){this.pos=(new lm).copy(t),this.normal=(new lm).copy(e),this.uv=(new lm).copy(n),this.uv.z=0,i&&(this.color=(new lm).copy(i))}clone(){return new um(this.pos,this.normal,this.uv,this.color)}flip(){this.normal.negate()}interpolate(t,e){return new um(this.pos.clone().lerp(t.pos,e),this.normal.clone().lerp(t.normal,e),this.uv.clone().lerp(t.uv,e),this.color&&t.color&&this.color.clone().lerp(t.color,e))}}class dm{constructor(){this.polygons=[]}static fromPolygons(t){const e=new dm;return e.polygons=t,e}static fromGeometry(t,e){let n=[];const i=t.attributes.position,r=t.attributes.normal,s=t.attributes.uv,a=t.attributes.color,o=t.groups;let l;if(t.index)l=t.index.array;else{l=new Uint16Array(i.array.length/i.itemSize|0);for(let t=0;t0)for(const e of o)h>=e.start&&h!Number.isNaN(t.plane.normal.x))))}static toGeometry(t,e){let n=0;const i=t.polygons;for(const d of i)n+=d.vertices.length-2;const r=new si,s=new sm(3*n*3),a=new sm(3*n*3),o=new am(2*n*3);let l;const c=[],h=[];for(const d of i){const t=d.vertices,e=t.length;void 0!==d.shared&&(c[d.shared]||(c[d.shared]=[])),e&&void 0!==t[0].color&&(l||(l=new sm(3*n*3)));for(let n=3;n<=e;n++)(void 0===d.shared?h:c[d.shared]).push(s.top/3,s.top/3+1,s.top/3+2),s.write(t[0].pos),s.write(t[n-2].pos),s.write(t[n-1].pos),a.write(t[0].normal),a.write(t[n-2].normal),a.write(t[n-1].normal),o&&(o.write(t[0].uv),o.write(t[n-2].uv),o.write(t[n-1].uv)),l&&(l.write(t[0].color),l.write(t[n-2].color),l.write(t[n-1].color))}r.setAttribute("position",new Yn(s.array,3)),r.setAttribute("normal",new Yn(a.array,3)),o&&r.setAttribute("uv",new Yn(o.array,2)),l&&r.setAttribute("color",new Yn(l.array,3));for(let d=0;dt.clone())).filter((t=>Number.isFinite(t.plane.w))),t}toPolygons(){return this.polygons}union(t){const e=new om(this.clone().polygons),n=new om(t.clone().polygons);return e.clipTo(n),n.clipTo(e),n.invert(),n.clipTo(e),n.invert(),e.build(n.allPolygons()),dm.fromPolygons(e.allPolygons())}subtract(t){const e=new om(this.clone().polygons),n=new om(t.clone().polygons);return e.invert(),e.clipTo(n),n.clipTo(e),n.invert(),n.clipTo(e),n.invert(),e.build(n.allPolygons()),e.invert(),dm.fromPolygons(e.allPolygons())}intersect(t){const e=new om(this.clone().polygons),n=new om(t.clone().polygons);return e.invert(),n.clipTo(e),n.invert(),e.clipTo(n),n.clipTo(e),e.build(n.allPolygons()),e.invert(),dm.fromPolygons(e.allPolygons())}inverse(){const t=this.clone();for(const e of t.polygons)e.flip();return t}toMesh(t,e){return dm.toMesh(this,t,e)}toGeometry(t){return dm.toGeometry(this,t)}}class pm{static union(t,e){return this.doCSG(t,e,"union")}static subtract(t,e){return this.doCSG(t,e,"subtract")}static intersect(t,e){return this.doCSG(t,e,"intersect")}static doCSG(t,e,n){return t.updateMatrix(),e.updateMatrix(),"union"===n?dm.union(t,e):"subtract"===n?dm.subtract(t,e):"intersect"===n?dm.intersect(t,e):void 0}}class mm extends ku{constructor(t,e={}){var n;const i=document.getElementById("enable3d-three-canvas");let r={};i&&(r={canvas:i}),e.renderer=new ba({...r,antialias:e.antialias||!1}),super(e),null==(n=t.sys.game.canvas.parentElement)||n.insertBefore(e.renderer.domElement,t.sys.game.canvas),t.sys.game.canvas.style.position="relative";const s=()=>{var n,i;if(!e.renderer)return;const{width:r,height:s,marginLeft:a,marginTop:o}=t.sys.game.canvas.style;e.renderer.domElement.id="enable3d-three-canvas",(null==(n=this.camera)?void 0:n.aspect)&&(this.camera.aspect=t.sys.game.scale.baseSize.width/t.sys.game.scale.baseSize.height),null==(i=this.camera)||i.updateProjectionMatrix(),e.renderer.setSize(t.sys.game.scale.baseSize.width,t.sys.game.scale.baseSize.height),e.renderer.domElement.style.width=r,e.renderer.domElement.style.height=s,e.renderer.domElement.style.marginLeft=a,e.renderer.domElement.style.marginTop=o};s(),t.scale.on("resize",(()=>{s()}));const a=document.createElement("style");a.innerText="\n #enable3d-phaser-canvas:focus,\n #enable3d-three-canvas:focus {\n outline: none;\n }\n\n #enable3d-three-canvas {\n position: absolute;\n }\n ",document.head.appendChild(a);const{enableXR:o=!1}=e;if(this.isXrEnabled=o,this.scene3D=t,o&&(this.webXR=new rm(this.renderer,this.scene)),this.isXrEnabled){let e=0;this.renderer.setAnimationLoop((n=>{if(this.renderer.xr.isPresenting){const i=n-e;e=n,t.updateLoopXR(n,i),this.renderer.state.reset(),this.preRender(),this.composer?this.composer.render():this.renderer.render(this.scene,this.camera),this.postRender()}}))}t.add.extern().render=t=>{this.renderer.xr.isPresenting||(this.preRender(),this.composer?this.composer.render():this.renderer.render(this.scene,this.camera),this.postRender())},t.events.on("postupdate",((t,e)=>{var n,i,r;null==(n=this.animationMixers)||n.update(e),null==(i=this.physics)||i.update(e),null==(r=this.physics)||r.updateDebugger()})),this.load=new Cp(this.cache,this.textureAnisotropy),this.lights=new Lp(this.scene),this.transform=new qp(this.camera,this.renderer),this.csg=pm,this.heightMap=new Ip(this.scene),this.factories=new gu(this.scene),this.misc=new jp(this.scene,this.renderer,this.factories),this.cameras=new zh,this.ws=new zp(this.scene,this.renderer,this.camera,this.lights,this.physics,this.load,this.factories),this.mixers=new Vp,t.events.once("shutdown",(()=>{t.clearThirdDimension(),t.events.removeListener("update")}))}preRender(){}postRender(){}destroy(t){var e;null==(e=this.physics)||e.destroy(t.body),this.scene.remove(t),t=null}async warpSpeed(...t){return await this.ws.warpSpeed(...t)}haveSomeFun(t=20){((t=20,e)=>{if(window.__loadPhysics)for(let n=0;nMath.floor(Math.random()*(e-t+1)+t),i=t=>t[Math.floor(Math.random()*t.length)];Math.random()>.5?e.add.box({x:n(-10,10),y:n(10,20),z:n(-10,10),width:n(1,2)/10,height:n(1,2)/10,depth:n(1,2)/10,mass:1},{[i(t)]:{color:Math.floor(16777215*Math.random())}}).body.setRestitution(Math.floor(10*Math.random())/20):e.add.sphere({x:n(-10,10),y:n(10,20),z:n(-10,10),radius:n(1,2)/10,mass:1},{[i(t)]:{color:Math.floor(16777215*Math.random())}}).body.setRestitution(Math.floor(10*Math.random())/20)}else console.log("There is not much fun without physics enabled!")})(t,this.physics)}get animationMixers(){var t;return null==(t=this.mixers)?void 0:t.mixers}get make(){return this.factories.make}get add(){return this.factories.add}}class fm extends e.Scene{constructor(t){super(t)}async warpSpeed(...t){return await this.third.warpSpeed(...t)}haveSomeFun(t=20){this.third.haveSomeFun(t)}requestThirdDimension(){Hh("You do not need requestThirdDimension() anymore. Place accessThirdDimension() inside init() instead!")}clearThirdDimension(){for(const t in this.third)delete this.third[t];delete this.third}accessThirdDimension(t={}){this.clearThirdDimension(),this.third=new mm(this,t),this.cameras.main.transparent=!0,this.cameras.main.setBackgroundColor("rgba(0,0,0,0)"),this.third.scene.background=new Gn("white")}updateLoopXR(t,e){this.preUpdateXR(t,e),this.updateXR(t,e),this.postUpdateXR(t,e)}preUpdateXR(t,e){}updateXR(t,e){}postUpdateXR(t,e){this.third.isXrEnabled&&(this.time.update(t,e),this.third.physics.update(e),this.third.physics.updateDebugger(),this.third.animationMixers.update(e))}}window.__loadPhysics=!1,window.__ammoPath="";const gm=t=>(window.setTimeout((()=>{var e,n;window.__loadPhysics?(e=window.__ammoPath,n=()=>{Ammo().then((()=>{t()}))},((t,e)=>{var n=document.createElement("script");n.onload=()=>{e()},n.onerror=()=>{throw new Error(`failed to load ${t}`)},n.async=!0,n.src=t,document.head.appendChild(n)})(Nu?`${e}/ammo.wasm.js`:`${e}/ammo.js`,(()=>n()))):t()}),50),{withPhysics(t){window.__loadPhysics=!0,window.__ammoPath=t}});var vm;document.createElement("canvas"),new Sh,new Xt,new Xt,new Xt,vm=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(e,n){var i={};e.exports=i,function(){i._nextId=0,i._seed=0,i._nowStartTime=+new Date,i._warnedOnce={},i._decomp=null,i.extend=function(t,e){var n,r;"boolean"==typeof e?(n=2,r=e):(n=1,r=!0);for(var s=n;s0;e--){var n=Math.floor(i.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}return t},i.choose=function(t){return t[Math.floor(i.random()*t.length)]},i.isElement=function(t){return"undefined"!=typeof HTMLElement?t instanceof HTMLElement:!!(t&&t.nodeType&&t.nodeName)},i.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},i.isFunction=function(t){return"function"==typeof t},i.isPlainObject=function(t){return"object"==typeof t&&t.constructor===Object},i.isString=function(t){return"[object String]"===toString.call(t)},i.clamp=function(t,e,n){return tn?n:t},i.sign=function(t){return t<0?-1:1},i.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-i._nowStartTime},i.random=function(t,n){return n=void 0!==n?n:1,(t=void 0!==t?t:0)+e()*(n-t)};var e=function(){return i._seed=(9301*i._seed+49297)%233280,i._seed/233280};i.colorToNumber=function(t){return 3==(t=t.replace("#","")).length&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),parseInt(t,16)},i.logLevel=1,i.log=function(){console&&i.logLevel>0&&i.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.info=function(){console&&i.logLevel>0&&i.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.warn=function(){console&&i.logLevel>0&&i.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},i.warnOnce=function(){var t=Array.prototype.slice.call(arguments).join(" ");i._warnedOnce[t]||(i.warn(t),i._warnedOnce[t]=!0)},i.deprecated=function(t,e,n){t[e]=i.chain((function(){i.warnOnce("🔅 deprecated 🔅",n)}),t[e])},i.nextId=function(){return i._nextId++},i.indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0;nt.max.x&&(t.max.x=r.x),r.xt.max.y&&(t.max.y=r.y),r.y0?t.max.x+=n.x:t.min.x+=n.x,n.y>0?t.max.y+=n.y:t.min.y+=n.y)},n.contains=function(t,e){return e.x>=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},n.overlaps=function(t,e){return t.min.x<=e.max.x&&t.max.x>=e.min.x&&t.max.y>=e.min.y&&t.min.y<=e.max.y},n.translate=function(t,e){t.min.x+=e.x,t.max.x+=e.x,t.min.y+=e.y,t.max.y+=e.y},n.shift=function(t,e){var n=t.max.x-t.min.x,i=t.max.y-t.min.y;t.min.x=e.x,t.max.x=e.x+n,t.min.y=e.y,t.max.y=e.y+i}},function(t,e){var n={};t.exports=n,n.create=function(t,e){return{x:t||0,y:e||0}},n.clone=function(t){return{x:t.x,y:t.y}},n.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},n.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},n.rotate=function(t,e,n){var i=Math.cos(e),r=Math.sin(e);n||(n={});var s=t.x*i-t.y*r;return n.y=t.x*r+t.y*i,n.x=s,n},n.rotateAbout=function(t,e,n,i){var r=Math.cos(e),s=Math.sin(e);i||(i={});var a=n.x+((t.x-n.x)*r-(t.y-n.y)*s);return i.y=n.y+((t.x-n.x)*s+(t.y-n.y)*r),i.x=a,i},n.normalise=function(t){var e=n.magnitude(t);return 0===e?{x:0,y:0}:{x:t.x/e,y:t.y/e}},n.dot=function(t,e){return t.x*e.x+t.y*e.y},n.cross=function(t,e){return t.x*e.y-t.y*e.x},n.cross3=function(t,e,n){return(e.x-t.x)*(n.y-t.y)-(e.y-t.y)*(n.x-t.x)},n.add=function(t,e,n){return n||(n={}),n.x=t.x+e.x,n.y=t.y+e.y,n},n.sub=function(t,e,n){return n||(n={}),n.x=t.x-e.x,n.y=t.y-e.y,n},n.mult=function(t,e){return{x:t.x*e,y:t.y*e}},n.div=function(t,e){return{x:t.x/e,y:t.y/e}},n.perp=function(t,e){return{x:(e=!0===e?-1:1)*-t.y,y:e*t.x}},n.neg=function(t){return{x:-t.x,y:-t.y}},n.angle=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},n._temp=[n.create(),n.create(),n.create(),n.create(),n.create(),n.create()]},function(t,e,n){var i={};t.exports=i;var r=n(2),s=n(0);i.create=function(t,e){for(var n=[],i=0;i0)return!1}return!0},i.scale=function(t,e,n,s){if(1===e&&1===n)return t;var a,o;s=s||i.centre(t);for(var l=0;l=0?l-1:t.length-1],h=t[l],u=t[(l+1)%t.length],d=e[l0&&(s|=2),3===s)return!1;return 0!==s||null},i.hull=function(t){var e,n,i=[],s=[];for((t=t.slice(0)).sort((function(t,e){var n=t.x-e.x;return 0!==n?n:t.y-e.y})),n=0;n=2&&r.cross3(s[s.length-2],s[s.length-1],e)<=0;)s.pop();s.push(e)}for(n=t.length-1;n>=0;n-=1){for(e=t[n];i.length>=2&&r.cross3(i[i.length-2],i[i.length-1],e)<=0;)i.pop();i.push(e)}return i.pop(),s.pop(),i.concat(s)}},function(t,e,n){var i={};t.exports=i;var r=n(0);i.on=function(t,e,n){for(var i,r=e.split(" "),s=0;s0){n||(n={}),i=e.split(" ");for(var c=0;c0&&s.rotateAbout(a.position,n,t.position,a.position)}},i.setVelocity=function(t,e){t.positionPrev.x=t.position.x-e.x,t.positionPrev.y=t.position.y-e.y,t.velocity.x=e.x,t.velocity.y=e.y,t.speed=s.magnitude(t.velocity)},i.setAngularVelocity=function(t,e){t.anglePrev=t.angle-e,t.angularVelocity=e,t.angularSpeed=Math.abs(t.angularVelocity)},i.translate=function(t,e){i.setPosition(t,s.add(t.position,e))},i.rotate=function(t,e,n){if(n){var r=Math.cos(e),s=Math.sin(e),a=t.position.x-n.x,o=t.position.y-n.y;i.setPosition(t,{x:n.x+(a*r-o*s),y:n.y+(a*s+o*r)}),i.setAngle(t,t.angle+e)}else i.setAngle(t,t.angle+e)},i.scale=function(t,e,n,s){var a=0,o=0;s=s||t.position;for(var h=0;h0&&(a+=u.area,o+=u.inertia),u.position.x=s.x+(u.position.x-s.x)*e,u.position.y=s.y+(u.position.y-s.y)*n,l.update(u.bounds,u.vertices,t.velocity)}t.parts.length>1&&(t.area=a,t.isStatic||(i.setMass(t,t.density*a),i.setInertia(t,o))),t.circleRadius&&(e===n?t.circleRadius*=e:t.circleRadius=null)},i.update=function(t,e,n,i){var a=Math.pow(e*n*t.timeScale,2),o=1-t.frictionAir*n*t.timeScale,h=t.position.x-t.positionPrev.x,u=t.position.y-t.positionPrev.y;t.velocity.x=h*o*i+t.force.x/t.mass*a,t.velocity.y=u*o*i+t.force.y/t.mass*a,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.position.x+=t.velocity.x,t.position.y+=t.velocity.y,t.angularVelocity=(t.angle-t.anglePrev)*o*i+t.torque/t.inertia*a,t.anglePrev=t.angle,t.angle+=t.angularVelocity,t.speed=s.magnitude(t.velocity),t.angularSpeed=Math.abs(t.angularVelocity);for(var d=0;d0&&(p.position.x+=t.velocity.x,p.position.y+=t.velocity.y),0!==t.angularVelocity&&(r.rotate(p.vertices,t.angularVelocity,t.position),c.rotate(p.axes,t.angularVelocity),d>0&&s.rotateAbout(p.position,t.angularVelocity,t.position,p.position)),l.update(p.bounds,p.vertices,t.velocity)}},i.applyForce=function(t,e,n){t.force.x+=n.x,t.force.y+=n.y;var i=e.x-t.position.x,r=e.y-t.position.y;t.torque+=i*n.y-r*n.x},i._totalProperties=function(t){for(var e={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===t.parts.length?0:1;n0&&s.motion=s.sleepThreshold&&i.set(s,!0)):s.sleepCounter>0&&(s.sleepCounter-=1)}else i.set(s,!1)}},i.afterCollisions=function(t,e){for(var n=e*e*e,r=0;ri._motionWakeThreshold*n&&i.set(c,!1)}}}},i.set=function(t,e){var n=t.isSleeping;e?(t.isSleeping=!0,t.sleepCounter=t.sleepThreshold,t.positionImpulse.x=0,t.positionImpulse.y=0,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.anglePrev=t.angle,t.speed=0,t.angularSpeed=0,t.motion=0,n||r.trigger(t,"sleepStart")):(t.isSleeping=!1,t.sleepCounter=0,n&&r.trigger(t,"sleepEnd"))}},function(t,e,n){var i={};t.exports=i;var r=n(3),s=n(2),a=n(7),o=n(1),l=n(10),c=n(0);i._warming=.4,i._torqueDampen=1,i._minLength=1e-6,i.create=function(t){var e=t;e.bodyA&&!e.pointA&&(e.pointA={x:0,y:0}),e.bodyB&&!e.pointB&&(e.pointB={x:0,y:0});var n=e.bodyA?s.add(e.bodyA.position,e.pointA):e.pointA,i=e.bodyB?s.add(e.bodyB.position,e.pointB):e.pointB,r=s.magnitude(s.sub(n,i));e.length=void 0!==e.length?e.length:r,e.id=e.id||c.nextId(),e.label=e.label||"Constraint",e.type="constraint",e.stiffness=e.stiffness||(e.length>0?1:.7),e.damping=e.damping||0,e.angularStiffness=e.angularStiffness||0,e.angleA=e.bodyA?e.bodyA.angle:e.angleA,e.angleB=e.bodyB?e.bodyB.angle:e.angleB,e.plugin={};var a={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===e.length&&e.stiffness>.1?(a.type="pin",a.anchors=!1):e.stiffness<.9&&(a.type="spring"),e.render=c.extend(a,e.render),e},i.preSolveAll=function(t){for(var e=0;e0&&(u.position.x+=c.x,u.position.y+=c.y),0!==c.angle&&(r.rotate(u.vertices,c.angle,n.position),l.rotate(u.axes,c.angle),h>0&&s.rotateAbout(u.position,c.angle,n.position,u.position)),o.update(u.bounds,u.vertices,n.velocity)}c.angle*=i._warming,c.x*=i._warming,c.y*=i._warming}}},i.pointAWorld=function(t){return{x:(t.bodyA?t.bodyA.position.x:0)+t.pointA.x,y:(t.bodyA?t.bodyA.position.y:0)+t.pointA.y}},i.pointBWorld=function(t){return{x:(t.bodyB?t.bodyB.position.x:0)+t.pointB.x,y:(t.bodyB?t.bodyB.position.y:0)+t.pointB.y}}},function(t,e,n){var i={};t.exports=i;var r=n(17);i.create=function(t,e){var n=t.bodyA,r=t.bodyB,s=t.parentA,a=t.parentB,o={id:i.id(n,r),bodyA:n,bodyB:r,contacts:{},activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:n.isSensor||r.isSensor,timeCreated:e,timeUpdated:e,inverseMass:s.inverseMass+a.inverseMass,friction:Math.min(s.friction,a.friction),frictionStatic:Math.max(s.frictionStatic,a.frictionStatic),restitution:Math.max(s.restitution,a.restitution),slop:Math.max(s.slop,a.slop)};return i.update(o,t,e),o},i.update=function(t,e,n){var s=t.contacts,a=e.supports,o=t.activeContacts,l=e.parentA,c=e.parentB;if(t.collision=e,t.inverseMass=l.inverseMass+c.inverseMass,t.friction=Math.min(l.friction,c.friction),t.frictionStatic=Math.max(l.frictionStatic,c.frictionStatic),t.restitution=Math.max(l.restitution,c.restitution),t.slop=Math.max(l.slop,c.slop),o.length=0,e.collided){for(var h=0;h0&&r.area(A)1?(m=a.create(s.extend({parts:f.slice(0)},i)),a.setPosition(m,{x:t,y:e}),m):f[0]}},function(t,e,n){var i={};t.exports=i;var r=n(0);i.create=function(t){var e={};return t||r.log("Mouse.create: element was undefined, defaulting to document.body","warn"),e.element=t||document.body,e.absolute={x:0,y:0},e.position={x:0,y:0},e.mousedownPosition={x:0,y:0},e.mouseupPosition={x:0,y:0},e.offset={x:0,y:0},e.scale={x:1,y:1},e.wheelDelta=0,e.button=-1,e.pixelRatio=parseInt(e.element.getAttribute("data-pixel-ratio"),10)||1,e.sourceEvents={mousemove:null,mousedown:null,mouseup:null,mousewheel:null},e.mousemove=function(t){var n=i._getRelativeMousePosition(t,e.element,e.pixelRatio);t.changedTouches&&(e.button=0,t.preventDefault()),e.absolute.x=n.x,e.absolute.y=n.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y,e.sourceEvents.mousemove=t},e.mousedown=function(t){var n=i._getRelativeMousePosition(t,e.element,e.pixelRatio);t.changedTouches?(e.button=0,t.preventDefault()):e.button=t.button,e.absolute.x=n.x,e.absolute.y=n.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y,e.mousedownPosition.x=e.position.x,e.mousedownPosition.y=e.position.y,e.sourceEvents.mousedown=t},e.mouseup=function(t){var n=i._getRelativeMousePosition(t,e.element,e.pixelRatio);t.changedTouches&&t.preventDefault(),e.button=-1,e.absolute.x=n.x,e.absolute.y=n.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y,e.mouseupPosition.x=e.position.x,e.mouseupPosition.y=e.position.y,e.sourceEvents.mouseup=t},e.mousewheel=function(t){e.wheelDelta=Math.max(-1,Math.min(1,t.wheelDelta||-t.detail)),t.preventDefault()},i.setElement(e,e.element),e},i.setElement=function(t,e){t.element=e,e.addEventListener("mousemove",t.mousemove),e.addEventListener("mousedown",t.mousedown),e.addEventListener("mouseup",t.mouseup),e.addEventListener("mousewheel",t.mousewheel),e.addEventListener("DOMMouseScroll",t.mousewheel),e.addEventListener("touchmove",t.mousemove),e.addEventListener("touchstart",t.mousedown),e.addEventListener("touchend",t.mouseup)},i.clearSourceEvents=function(t){t.sourceEvents.mousemove=null,t.sourceEvents.mousedown=null,t.sourceEvents.mouseup=null,t.sourceEvents.mousewheel=null,t.wheelDelta=0},i.setOffset=function(t,e){t.offset.x=e.x,t.offset.y=e.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y},i.setScale=function(t,e){t.scale.x=e.x,t.scale.y=e.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y},i._getRelativeMousePosition=function(t,e,n){var i,r,s=e.getBoundingClientRect(),a=document.documentElement||document.body.parentNode||document.body,o=void 0!==window.pageXOffset?window.pageXOffset:a.scrollLeft,l=void 0!==window.pageYOffset?window.pageYOffset:a.scrollTop,c=t.changedTouches;return c?(i=c[0].pageX-s.left-o,r=c[0].pageY-s.top-l):(i=t.pageX-s.left-o,r=t.pageY-s.top-l),{x:i/(e.clientWidth/(e.width||e.clientWidth)*n),y:r/(e.clientHeight/(e.height||e.clientHeight)*n)}}},function(t,e,n){var i={};t.exports=i;var r=n(14),s=n(9),a=n(1);i.collisions=function(t,e){for(var n=[],o=e.pairs.table,l=0;l1?1:0;u1?1:0;p0:!!(t.mask&e.category)&&!!(e.mask&t.category)}},function(t,e,n){var i={};t.exports=i;var r=n(3),s=n(2);i.collides=function(t,e,n){var a,o,l,c,h=!1;if(n){var u=t.parent,d=e.parent,p=u.speed*u.speed+u.angularSpeed*u.angularSpeed+d.speed*d.speed+d.angularSpeed*d.angularSpeed;h=n&&n.collided&&p<.2,c=n}else c={collided:!1,bodyA:t,bodyB:e};if(n&&h){var m=c.axisBody,f=m===t?e:t,g=[m.axes[n.axisNumber]];if(l=i._overlapAxes(m.vertices,f.vertices,g),c.reused=!0,l.overlap<=0)return c.collided=!1,c}else{if((a=i._overlapAxes(t.vertices,e.vertices,t.axes)).overlap<=0)return c.collided=!1,c;if((o=i._overlapAxes(e.vertices,t.vertices,e.axes)).overlap<=0)return c.collided=!1,c;a.overlapr?r=o:o=0?a.index-1:h.length-1],c.x=r.x-u.x,c.y=r.y-u.y,l=-s.dot(n,c),o=r,r=h[(a.index+1)%h.length],c.x=r.x-u.x,c.y=r.y-u.y,(i=-s.dot(n,c))s?(r.warn("Plugin.register:",i.toString(e),"was upgraded to",i.toString(t)),i._registry[t.name]=t):n-1},i.isFor=function(t,e){var n=t.for&&i.dependencyParse(t.for);return!t.for||e.name===n.name&&i.versionSatisfies(e.version,n.range)},i.use=function(t,e){if(t.uses=(t.uses||[]).concat(e||[]),0!==t.uses.length){for(var n=i.dependencies(t),s=r.topologicalSort(n),a=[],o=0;o0&&r.info(a.join(" "))}else r.warn("Plugin.use:",i.toString(t),"does not specify any dependencies to install.")},i.dependencies=function(t,e){var n=i.dependencyParse(t),s=n.name;if(!(s in(e=e||{}))){t=i.resolve(t)||t,e[s]=r.map(t.uses||[],(function(e){i.isPlugin(e)&&i.register(e);var s=i.dependencyParse(e),a=i.resolve(e);return a&&!i.versionSatisfies(a.version,s.range)?(r.warn("Plugin.dependencies:",i.toString(a),"does not satisfy",i.toString(s),"used by",i.toString(n)+"."),a._warned=!0,t._warned=!0):a||(r.warn("Plugin.dependencies:",i.toString(e),"used by",i.toString(n),"could not be resolved."),t._warned=!0),s.name}));for(var a=0;a=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-]+)?$/;e.test(t)||r.warn("Plugin.versionParse:",t,"is not a valid version or range.");var n=e.exec(t),i=Number(n[4]),s=Number(n[5]),a=Number(n[6]);return{isRange:Boolean(n[1]||n[2]),version:n[3],range:t,operator:n[1]||n[2]||"",major:i,minor:s,patch:a,parts:[i,s,a],prerelease:n[7],number:1e8*i+1e4*s+a}},i.versionSatisfies=function(t,e){e=e||"*";var n=i.versionParse(e),r=i.versionParse(t);if(n.isRange){if("*"===n.operator||"*"===t)return!0;if(">"===n.operator)return r.number>n.number;if(">="===n.operator)return r.number>=n.number;if("~"===n.operator)return r.major===n.major&&r.minor===n.minor&&r.patch>=n.patch;if("^"===n.operator)return n.major>0?r.major===n.major&&r.number>=n.number:n.minor>0?r.minor===n.minor&&r.patch>=n.patch:r.patch===n.patch}return t===e||"*"===t}},function(t,e,n){var i={};t.exports=i;var r=n(0),s=n(5),a=n(1),o=n(4),l=n(2),c=n(12);!function(){var t,e;"undefined"!=typeof window&&(t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout((function(){t(r.now())}),1e3/60)},e=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),i._goodFps=30,i._goodDelta=1e3/60,i.create=function(t){var e={controller:i,engine:null,element:null,canvas:null,mouse:null,frameRequestId:null,timing:{historySize:60,delta:0,deltaHistory:[],lastTime:0,lastTimestamp:0,lastElapsed:0,timestampElapsed:0,timestampElapsedHistory:[],engineDeltaHistory:[],engineElapsedHistory:[],elapsedHistory:[]},options:{width:800,height:600,pixelRatio:1,background:"#14151f",wireframeBackground:"#14151f",hasBounds:!!t.bounds,enabled:!0,wireframes:!0,showSleeping:!0,showDebug:!1,showStats:!1,showPerformance:!1,showBroadphase:!1,showBounds:!1,showVelocity:!1,showCollisions:!1,showSeparations:!1,showAxes:!1,showPositions:!1,showAngleIndicator:!1,showIds:!1,showVertexNumbers:!1,showConvexHulls:!1,showInternalEdges:!1,showMousePosition:!1}},n=r.extend(e,t);return n.canvas&&(n.canvas.width=n.options.width||n.canvas.width,n.canvas.height=n.options.height||n.canvas.height),n.mouse=t.mouse,n.engine=t.engine,n.canvas=n.canvas||u(n.options.width,n.options.height),n.context=n.canvas.getContext("2d"),n.textures={},n.bounds=n.bounds||{min:{x:0,y:0},max:{x:n.canvas.width,y:n.canvas.height}},1!==n.options.pixelRatio&&i.setPixelRatio(n,n.options.pixelRatio),r.isElement(n.element)?n.element.appendChild(n.canvas):n.canvas.parentNode||r.log("Render.create: options.element was undefined, render.canvas was created but not appended","warn"),n},i.run=function(e){!function r(s){e.frameRequestId=t(r),n(e,s),i.world(e,s),(e.options.showStats||e.options.showDebug)&&i.stats(e,e.context,s),(e.options.showPerformance||e.options.showDebug)&&i.performance(e,e.context,s)}()},i.stop=function(t){e(t.frameRequestId)},i.setPixelRatio=function(t,e){var n=t.options,i=t.canvas;"auto"===e&&(e=d(i)),n.pixelRatio=e,i.setAttribute("data-pixel-ratio",e),i.width=n.width*e,i.height=n.height*e,i.style.width=n.width+"px",i.style.height=n.height+"px"},i.lookAt=function(t,e,n,i){i=void 0===i||i,e=r.isArray(e)?e:[e],n=n||{x:0,y:0};for(var s={min:{x:1/0,y:1/0},max:{x:-1/0,y:-1/0}},a=0;as.max.x&&(s.max.x=h.x),l.ys.max.y&&(s.max.y=h.y))}var u=s.max.x-s.min.x+2*n.x,d=s.max.y-s.min.y+2*n.y,p=t.canvas.height,m=t.canvas.width/p,f=u/d,g=1,v=1;f>m?v=f/m:g=m/f,t.options.hasBounds=!0,t.bounds.min.x=s.min.x,t.bounds.max.x=s.min.x+u*g,t.bounds.min.y=s.min.y,t.bounds.max.y=s.min.y+d*v,i&&(t.bounds.min.x+=.5*u-u*g*.5,t.bounds.max.x+=.5*u-u*g*.5,t.bounds.min.y+=.5*d-d*v*.5,t.bounds.max.y+=.5*d-d*v*.5),t.bounds.min.x-=n.x,t.bounds.max.x-=n.x,t.bounds.min.y-=n.y,t.bounds.max.y-=n.y,t.mouse&&(c.setScale(t.mouse,{x:(t.bounds.max.x-t.bounds.min.x)/t.canvas.width,y:(t.bounds.max.y-t.bounds.min.y)/t.canvas.height}),c.setOffset(t.mouse,t.bounds.min))},i.startViewTransform=function(t){var e=t.bounds.max.x-t.bounds.min.x,n=t.bounds.max.y-t.bounds.min.y,i=e/t.options.width,r=n/t.options.height;t.context.setTransform(t.options.pixelRatio/i,0,0,t.options.pixelRatio/r,0,0),t.context.translate(-t.bounds.min.x,-t.bounds.min.y)},i.endViewTransform=function(t){t.context.setTransform(t.options.pixelRatio,0,0,t.options.pixelRatio,0,0)},i.world=function(t,e){var n,h=r.now(),u=t.engine,d=u.world,p=t.canvas,f=t.context,g=t.options,v=t.timing,y=s.allBodies(d),x=s.allConstraints(d),_=g.wireframes?g.wireframeBackground:g.background,b=[],M=[],w={timestamp:u.timing.timestamp};if(o.trigger(t,"beforeRender",w),t.currentBackground!==_&&m(t,_),f.globalCompositeOperation="source-in",f.fillStyle="transparent",f.fillRect(0,0,p.width,p.height),f.globalCompositeOperation="source-over",g.hasBounds){for(n=0;n1?1:0;o1?1:0;o1?1:0;s1?1:0;o1?1:0;a1?1:0;a1?1:0;r0)){var h=i.activeContacts[0].vertex.x,u=i.activeContacts[0].vertex.y;2===i.activeContacts.length&&(h=(i.activeContacts[0].vertex.x+i.activeContacts[1].vertex.x)/2,u=(i.activeContacts[0].vertex.y+i.activeContacts[1].vertex.y)/2),r.bodyB===r.supports[0].body||!0===r.bodyA.isStatic?o.moveTo(h-8*r.normal.x,u-8*r.normal.y):o.moveTo(h+8*r.normal.x,u+8*r.normal.y),o.lineTo(h,u)}l.wireframes?o.strokeStyle="rgba(255,165,0,0.7)":o.strokeStyle="orange",o.lineWidth=1,o.stroke()},i.separations=function(t,e,n){var i,r,s,a,o,l=n,c=t.options;for(l.beginPath(),o=0;o0&&c.trigger(t,"collisionStart",{pairs:w.collisionStart}),s.preSolvePosition(w.list),f=0;f0&&c.trigger(t,"collisionActive",{pairs:w.collisionActive}),w.collisionEnd.length>0&&c.trigger(t,"collisionEnd",{pairs:w.collisionEnd}),i._bodiesClearForces(_),c.trigger(t,"afterUpdate",x),t.timing.lastElapsed=d.now()-p,t},i.merge=function(t,e){if(d.extend(t,e),e.world){t.world=e.world,i.clear(t);for(var n=h.allBodies(t.world),s=0;sp.friction*p.frictionStatic*O*n&&(U=L,D=a.clamp(p.friction*I*n,-U,U));var B=s.cross(S,v),F=s.cross(T,v),k=_/(f.inverseMass+g.inverseMass+f.inverseInertia*B*B+g.inverseInertia*F*F);if(N*=k,D*=k,C<0&&C*C>i._restingThresh*n)M.normalImpulse=0;else{var z=M.normalImpulse;M.normalImpulse=Math.min(M.normalImpulse+N,0),N=M.normalImpulse-z}if(P*P>i._restingThreshTangent*n)M.tangentImpulse=0;else{var V=M.tangentImpulse;M.tangentImpulse=a.clamp(M.tangentImpulse+D,-U,U),D=M.tangentImpulse-V}r.x=v.x*N+y.x*D,r.y=v.y*N+y.y*D,f.isStatic||f.isSleeping||(f.positionPrev.x+=r.x*f.inverseMass,f.positionPrev.y+=r.y*f.inverseMass,f.anglePrev+=s.cross(S,r)*f.inverseInertia),g.isStatic||g.isSleeping||(g.positionPrev.x-=r.x*g.inverseMass,g.positionPrev.y-=r.y*g.inverseMass,g.anglePrev-=s.cross(T,r)*g.inverseInertia)}}}}},function(t,e,n){var i={};t.exports=i;var r=n(9),s=n(0);i._pairMaxIdleLife=1e3,i.create=function(t){return s.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},t)},i.update=function(t,e,n){var i,s,a,o,l=t.list,c=t.table,h=t.collisionStart,u=t.collisionEnd,d=t.collisionActive;for(h.length=0,u.length=0,d.length=0,o=0;oi._pairMaxIdleLife&&c.push(a);for(a=0;ah.bounds.max.x||p.bounds.max.yh.bounds.max.y))){var m=i._getRegion(t,p);if(!p.region||m.id!==p.region.id||r){p.region&&!r||(p.region=m);var f=i._regionUnion(m,p.region);for(a=f.startCol;a<=f.endCol;a++)for(o=f.startRow;o<=f.endRow;o++){l=u[c=i._getBucketId(a,o)];var g=a>=m.startCol&&a<=m.endCol&&o>=m.startRow&&o<=m.endRow,v=a>=p.region.startCol&&a<=p.region.endCol&&o>=p.region.startRow&&o<=p.region.endRow;!g&&v&&v&&l&&i._bucketRemoveBody(t,l,p),(p.region===m||g&&!v||r)&&(l||(l=i._createBucket(u,c)),i._bucketAddBody(t,l,p))}p.region=m,d=!0}}}d&&(t.pairsList=i._createActivePairsList(t))},i.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]},i._regionUnion=function(t,e){var n=Math.min(t.startCol,e.startCol),r=Math.max(t.endCol,e.endCol),s=Math.min(t.startRow,e.startRow),a=Math.max(t.endRow,e.endRow);return i._createRegion(n,r,s,a)},i._getRegion=function(t,e){var n=e.bounds,r=Math.floor(n.min.x/t.bucketWidth),s=Math.floor(n.max.x/t.bucketWidth),a=Math.floor(n.min.y/t.bucketHeight),o=Math.floor(n.max.y/t.bucketHeight);return i._createRegion(r,s,a,o)},i._createRegion=function(t,e,n,i){return{id:t+","+e+","+n+","+i,startCol:t,endCol:e,startRow:n,endRow:i}},i._getBucketId=function(t,e){return"C"+t+"R"+e},i._createBucket=function(t,e){return t[e]=[]},i._bucketAddBody=function(t,e,n){for(var i=0;i0?i.push(n):delete t.pairs[e[r]];return i}},function(t,e,n){var i=t.exports=n(23);i.Axes=n(10),i.Bodies=n(11),i.Body=n(6),i.Bounds=n(1),i.Common=n(0),i.Composite=n(5),i.Composites=n(24),i.Constraint=n(8),i.Contact=n(17),i.Detector=n(13),i.Engine=n(18),i.Events=n(4),i.Grid=n(21),i.Mouse=n(12),i.MouseConstraint=n(25),i.Pair=n(9),i.Pairs=n(20),i.Plugin=n(15),i.Query=n(26),i.Render=n(16),i.Resolver=n(19),i.Runner=n(27),i.SAT=n(14),i.Sleeping=n(7),i.Svg=n(28),i.Vector=n(2),i.Vertices=n(3),i.World=n(29),i.Engine.run=i.Runner.run,i.Common.deprecated(i.Engine,"run","Engine.run ➤ use Matter.Runner.run(engine) instead")},function(t,e,n){var i={};t.exports=i;var r=n(15),s=n(0);i.name="matter-js",i.version="0.17.1",i.uses=[],i.used=[],i.use=function(){r.use(i,Array.prototype.slice.call(arguments))},i.before=function(t,e){return t=t.replace(/^Matter./,""),s.chainPathBefore(i,t,e)},i.after=function(t,e){return t=t.replace(/^Matter./,""),s.chainPathAfter(i,t,e)}},function(t,e,n){var i={};t.exports=i;var r=n(5),s=n(8),a=n(0),o=n(6),l=n(11),c=a.deprecated;i.stack=function(t,e,n,i,s,a,l){for(var c,h=r.create({label:"Stack"}),u=t,d=e,p=0,m=0;mf&&(f=y),o.translate(v,{x:.5*x,y:.5*y}),u=v.bounds.max.x+s,r.addBody(h,v),c=v,p+=1}else u+=s}d+=f+a,u=t}return h},i.chain=function(t,e,n,i,o,l){for(var c=t.bodies,h=1;h0)for(c=0;c0&&(d=p[c-1+(l-1)*e],r.addConstraint(t,s.create(a.extend({bodyA:d,bodyB:u},o)))),i&&cd||a<(c=d-c)||a>n-1-c))return 1===u&&o.translate(h,{x:(a+(n%2==1?1:-1))*p,y:0}),l(t+(h?a*p:0)+a*s,i,a,c,h,u)}))},i.newtonsCradle=function(t,e,n,i,a){for(var o=r.create({label:"Newtons Cradle"}),c=0;c1?1:0;ht.deltaMax?t.deltaMax:i)/t.delta,t.delta=i),0!==t.timeScalePrev&&(s*=r.timeScale/t.timeScalePrev),0===r.timeScale&&(s=0),t.timeScalePrev=r.timeScale,t.correction=s,t.frameCounter+=1,n-t.counterTimestamp>=1e3&&(t.fps=t.frameCounter*((n-t.counterTimestamp)/1e3),t.counterTimestamp=n,t.frameCounter=0),o.trigger(t,"tick",a),o.trigger(t,"beforeUpdate",a),l.update(e,i,s),o.trigger(t,"afterUpdate",a),o.trigger(t,"afterTick",a)},i.stop=function(t){s(t.frameRequestId)},i.start=function(t,e){i.run(t,e)}},function(t,e,n){var i={};t.exports=i,n(1);var r=n(0);i.pathToVertices=function(t,e){"undefined"==typeof window||"SVGPathSeg"in window||r.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var n,s,a,o,l,c,h,u,d,p,m,f=[],g=0,v=0,y=0;e=e||15;var x=function(t,e,n){var i=n%2==1&&n>1;if(!d||t!=d.x||e!=d.y){d&&i?(p=d.x,m=d.y):(p=0,m=0);var r={x:p+t,y:m+e};!i&&d||(d=r),f.push(r),v=p+t,y=m+e}},_=function(t){var e=t.pathSegTypeAsLetter.toUpperCase();if("Z"!==e){switch(e){case"M":case"L":case"T":case"C":case"S":case"Q":v=t.x,y=t.y;break;case"H":v=t.x;break;case"V":y=t.y}x(v,y,t.pathSegType)}};for(i._svgPathToAbsolute(t),a=t.getTotalLength(),c=[],n=0;n{this.time.delayedCall(2e3*(e+1),(()=>this.showLine(t,60*(e+1))),null,this)}))}showLine(t,e){let n=this.introLayer.add(this.add.bitmapText(this.center_width,e,"computer",t,35).setOrigin(.5).setAlpha(0));this.tweens.add({targets:n,duration:2e3,alpha:1})}}class xm extends Phaser.Scene{constructor(){super({key:"game_over"})}create(){this.cameras.main.setBackgroundColor(0),this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.introLayer=this.add.layer(),this.splashLayer=this.add.layer(),this.text=["GAME OVER","You failed to deliver the probes","you survived but the mission failed!","Go back to the solar system,","The gulag of the dark side of the moon","awaits for reeducation..."],this.showHistory(),this.input.keyboard.on("keydown-SPACE",this.startSplash,this),this.input.keyboard.on("keydown-ENTER",this.startSplash,this)}showHistory(){this.text.forEach(((t,e)=>{this.time.delayedCall(2e3*(e+1),(()=>this.showLine(t,60*(e+1))),null,this)}))}showLine(t,e){let n=this.introLayer.add(this.add.bitmapText(this.center_width,e,"computer",t,45).setTint(450954).setOrigin(.5).setAlpha(0));this.tweens.add({targets:n,duration:2e3,alpha:1})}startSplash(){location.reload(),this.scene.start("bootstrap")}}class _m{constructor(t){this.scene=t}typeText(t,e,n,i=150,r=450954,s=40){let a=[],o=0,l=0;t.split("").forEach(((t,c)=>{"\n"===t&&(o++,l=0),a.push(this.scene.add.bitmapText(n-350+25*l++,i+o*s/1.3,e,t,s).setTint(r).setAlpha(0))}));const c=this.scene.add.rectangle(n-335+25*l,i+25+o*s/1.3,25,5,r).setOrigin(.5).setAlpha(0),h=this.scene.add.timeline();return this.typeAudio=this.scene.sound.add("type"),a.forEach(((t,e)=>{h.add({at:0,tween:{targets:t,alpha:{from:0,to:.5},duration:100}})})),h.add({at:0,tween:{targets:c,alpha:{from:0,to:.8},duration:100,repeat:5,yoyo:!0,onStart:()=>{this.typeAudio.stop()}}}),this.typeAudio.play({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!0,delay:0}),h.play(),a.push(c),a}removeTyped(t){t.flat().forEach((t=>t.destroy()))}}class bm{constructor(){this._functions=[this.flat,this.tlaf,this.horizontal,this.multiWave,this.cos,this.tan,this.ripple]}get functions(){return this._functions}sin(t,e){return Math.sin(t)}flat(t,e,n){return t+n}tlaf(t,e,n){return-t-n}horizontal(t,e,n){return n}wave(t,e){return Math.sin(Math.PI*(t+e))}multiWave(t,e){return Math.sin(Math.PI*(t+e))}cos(t,e,n){return Math.cos(t)*Phaser.Math.Between(.1,.9)}tan(t,e,n){return Math.tan(t)}ripple(t,e,n){return Math.sin(e*t*(Math.PI/360))}}class Mm{constructor(t){this.scene=t}lightning(){if(Phaser.Math.Between(1,11)<10)return;const t=this.scene.add.timeline();t.add({targets:this.scene.lightningEffect,alpha:{from:0,to:1},duration:100,repeat:3}),this.scene.lights.out&&t.add({targets:this.scene.lightsOut,alpha:{from:1,to:.5},duration:500}),t.add({targets:this.scene.lightningEffect,alpha:{from:1,to:0},duration:2e3}),this.scene.lights.out&&t.add({targets:this.scene.lightsOut,alpha:{from:.5,to:1},duration:500}),t.play(),this.scene.playRandom("thunder"+Phaser.Math.Between(0,3))}}const wm={type:e.WEBGL,transparent:!0,scale:{mode:e.Scale.FIT,autoCenter:e.Scale.CENTER_BOTH,width:1280,height:720},parent:"game-container",scene:[class extends fm{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.setLoadEvents(),this.loadFonts(),this.loadImages(),this.loadAudios(),this.loadVideos(),this.setRegistry()}setLoadEvents(){this.load.on("progress",(function(t){this.progressBar.clear(),this.progressBar.fillStyle(237666,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*t,16)}),this),this.load.on("complete",(()=>{this.scene.start("story")}),this)}loadFonts(){this.load.bitmapFont("pixelFont","assets/fonts/mario.png","assets/fonts/mario.xml"),this.load.bitmapFont("computer","assets/fonts/computer.png","assets/fonts/computer.xml")}loadImages(){this.load.image("pello_logo_old","assets/images/pello_logo_old.png")}setRegistry(){this.registry.set("deviation","0"),this.registry.set("probes","20")}loadAudios(){Array(4).fill(0).forEach(((t,e)=>{this.load.audio(`thunder${e}`,`./assets/sounds/thunder${e}.mp3`)})),Array(2).fill(0).forEach(((t,e)=>{this.load.audio(`passby${e}`,`./assets/sounds/passby${e}.mp3`)})),Array(4).fill(0).forEach(((t,e)=>{this.load.audio(`hit${e+1}`,`assets/sounds/hit${e+1}.mp3`)})),this.load.image("logo","assets/images/logo.png"),this.load.audio("hymn","assets/sounds/hymn.mp3"),this.load.audio("music","assets/sounds/music.mp3"),this.load.audio("type","assets/sounds/type.mp3"),this.load.audio("shot","assets/sounds/shot.mp3"),this.load.audio("voice_start","assets/sounds/voice_start.mp3"),this.load.audio("voice_drop","assets/sounds/voice_drop.mp3"),this.load.audio("voice_hit","assets/sounds/voice_hit.mp3")}loadVideos(){Array(4).fill(0).forEach(((t,e)=>{this.load.video(`video${e}`,`./assets/videos/video${e}.mp4`,"loadeddata",!1,!0)}))}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(450954,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}},class extends fm{constructor(){super({key:"story"})}create(){this.game.sound.stopAll(),this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.utils=new _m(this),this.loadAudios(),this.showIntro(),this.cameras.main.setBackgroundColor(0),this.input.keyboard.on("keydown-SPACE",(()=>this.startGame()),this)}startGame(){this.utils.typeAudio&&this.utils.typeAudio.stop(),this.theme&&this.theme.stop(),this.scene.start("splash")}playMusic(t="hymn"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.7,rate:1,detune:0,seek:0,loop:!0,delay:0})}loadAudios(){this.audios={type:this.sound.add("type")}}playAudio(t){this.audios[t].play()}showIntro(){let t,e;t=this.utils.typeText(" IN 1968 YURI GAGARIN DIED\nDURING A ROUTINE FLIGHT","computer",this.center_width,this.center_height),this.time.delayedCall(5500,(()=>{e=this.utils.typeText(" OR SO THEY MADE US BELIEVE...","computer",this.center_width,this.center_height+100)}),null,this),this.time.delayedCall(7e3,(()=>this.playMusic()),null,this),this.time.delayedCall(1e4,(()=>{this.utils.removeTyped([t,e]),this.aGameBy()}),null,this)}aGameBy(){let t,e=this.utils.typeText(" A GAME BY\nPELLO","computer",1250,10),n=this.add.image(990,120,"pello_logo_old").setScale(.2).setOrigin(.5),i=this.add.video(400,300,"video0");this.time.delayedCall(5e3,(()=>{this.utils.removeTyped([e]),n.destroy(),t=this.utils.typeText(" MINIJAM #96\nFATE","computer",1250,400)}),null,this),this.time.delayedCall(9e3,(()=>{this.utils.removeTyped([t]),i.stop(),i.destroy(),this.tools()})),i.play(!0)}tools(){let t,e=this.utils.typeText(" TOOLS: PHASER AND ENABLE3D","computer",550,10),n=this.add.video(this.center_width,500,"video1").setOrigin(.5);this.time.delayedCall(5e3,(()=>{this.utils.removeTyped([e]),t=this.utils.typeText(" MY FIRST 3D GAME!","computer",550,50)}),null,this),this.time.delayedCall(9e3,(()=>{this.utils.removeTyped([t]),n.stop(),n.destroy(),this.otherTools()})),n.play(!0)}otherTools(){let t,e=this.utils.typeText(" VSCODE, GULP, BLENDER, FFMPEG,...","computer",550,500),n=this.add.video(this.center_width,100,"video2").setOrigin(.5);this.time.delayedCall(5e3,(()=>{this.utils.removeTyped([e]),t=this.utils.typeText(" GAZILLIONS OF COFFEE WERE CONSUMED","computer",550,600)}),null,this),this.time.delayedCall(1e4,(()=>{this.utils.removeTyped([t]),n.stop(),n.destroy(),this.lastVideo()})),n.play(!0)}lastVideo(){let t,e=this.utils.typeText(" MUSIC: SACRED WAR, BY THE RED ARMY CHOIR","computer",400,50),n=this.add.video(this.center_width,400,"video3").setOrigin(.5);this.time.delayedCall(5e3,(()=>{this.utils.removeTyped([e]),t=this.utils.typeText(" EVOLUTION, BY BENSOUND","computer",550,100)}),null,this),this.time.delayedCall(1e4,(()=>{this.utils.removeTyped([t]),n.stop(),n.destroy(),this.explanation()})),n.play(!0)}explanation(){this.tweens.add({targets:this.theme,volume:{from:1,to:0},duration:16e3}),this.utils.typeText(" GAGARIN WAS SENT ON A SECRET MISSION\nBEYOND THE OORT CLOUD, PROPELLED BY\nNUCLEAR DETONATIONS.\n\n HE HAS NOW PASSED THE FRONTIER OF\nOUR SOLAR SYSTEM\nHIS MISSION:\nTO SET 20 PROBES AND RECOLLECT DATA \nFROM THE DEADLIEST STELLAR OBJECT:\nA NEUTRINO STAR!\n\nHE HAS TO AVOID INCOMING DEBRIS \nAND GET AS CLOSE AS POSSIBLE TO THE STAR.\nTHAT WILL MEAN CERTAIN DEATH, BUT ALSO\nA MASSIVE ACHIEVEMENT FOR SOVIET SCIENTISTS!\n\nTHE FATAL FATE OF GAGARIN IS NOW TIED\nTO THE GLORIOUS FATE OF MOTHER RUSSIA...\n\n\nSPACE TO CONTINUE","computer",450,50)}},class extends fm{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.utils=new _m(this),this.showLogo(),this.showInstructions(),this.input.keyboard.on("keydown-SPACE",(()=>this.loadNext()),this),this.playMusic()}playMusic(t="music"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.5,rate:1,detune:0,seek:0,loop:!0,delay:0})}showLogo(){this.logo=this.add.image(this.center_width,170,"logo").setOrigin(.5).setScale(.7).setAlpha(0),this.tweens.add({targets:this.logo,duration:3e3,alpha:{from:0,to:1}})}showInstructions(){this.utils.typeText("ARROWS + W + S\nMOUSE FOR POV\n","computer",this.center_width+190,this.center_height),this.time.delayedCall(2e3,(()=>{this.utils.typeText(" PRESS SPACE","computer",this.center_width+190,this.center_height+100)}),null,this),this.time.delayedCall(4e3,(()=>{this.utils.typeText(" A GAME BY PELLO","computer",this.center_width+140,this.center_height+200),this.add.image(this.center_width,this.center_height+300,"pello_logo_old").setScale(.2).setOrigin(.5)}),null,this)}loadNext(){this.utils.typeAudio&&this.utils.typeAudio.stop(),this.scene.start("game")}},class extends fm{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null}init(t){this.accessThirdDimension({gravity:{x:0,y:0,z:0}}),this.third.load.preload("stars","assets/images/stars.png"),this.third.load.preload("nebulaset","assets/images/nebulaset.png")}create(){this.bulletHell=new bm,this.x=-500,this.third.warpSpeed("-ground","-grid","-sky","-light"),this.setLights(),this.createBottom(),this.third.camera.position.set(0,0,20),this.third.camera.lookAt(0,0,0),this.third.load.texture("nebulaset").then((t=>this.third.scene.background=t)),this.particles=[],this.waves=[],this.remaining=2e4,this.addWaveEvent=this.time.addEvent({delay:3e3,callback:this.addWave,callbackScope:this,loop:!0}),this.addClockEvent=this.time.addEvent({delay:50,callback:this.updateClock,callbackScope:this,loop:!0}),this.setCenters(),this.setLightning(),this.setNeutrinoStar(),this.loadAudios(),this.prepareShip(),this.setScores(),this.cursor=this.input.keyboard.createCursorKeys(),this.W=this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W),this.S=this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S),this.playAudio("voice_start")}setLightning(){this.lightsOut=this.add.rectangle(0,40,this.width,this.height+100,0).setOrigin(0),this.lightsOut.setAlpha(0),this.lightningEffect=this.add.rectangle(0,40,this.width,this.height+100,16777215).setOrigin(0),this.lightningEffect.setAlpha(0),this.lightning=new Mm(this)}setLights(){this.spot=this.third.lights.spotLight({color:"blue",angle:Math.PI/8}),this.directional=this.third.lights.directionalLight({intensity:.5}),this.directional.position.set(5,5,5),this.third.lights.hemisphereLight({intensity:.7}),this.directional.shadow.camera.top=4,this.directional.shadow.camera.bottom=-4,this.directional.shadow.camera.left=-4,this.directional.shadow.camera.right=4}setNeutrinoStar(){this.torus=this.addRing(0),this.proximity=0,this.star=this.third.add.sphere({name:"neutrinoStarBack",radius:22,x:0,y:14.5,z:-150},{lambert:{color:16777184,transparent:!0,opacity:.5}}),this.third.physics.add.existing(this.star),this.star.body.setCollisionFlags(2),this.starFront=this.third.add.sphere({name:"neutrinoStarBack",radius:17,x:0,y:12,z:-120},{lambert:{color:"black",transparent:!1}}),this.third.physics.add.existing(this.starFront),this.starFront.body.setCollisionFlags(2)}addRings(){this.rings=Array(20).fill(0).map(((t,e)=>{this.addRing(e)}))}addRing(t){let e=this.third.add.cylinder({x:0,y:12,z:-120,height:1,radiusSegments:200,radiusBottom:75*(t+1),radiusTop:75*(t+1)},{lambert:{color:16777184,transparent:!0,opacity:.8}});return e.rotation.set(.1,0,0),this.third.physics.add.existing(e,{shape:"hacd"}),e.body.setCollisionFlags(6),e}setCenters(){this.width=this.cameras.main.width,this.height=this.cameras.main.height,this.center_width=this.width/2,this.center_height=this.height/2}updateClock(){this.remaining<0?(this.remaining=2e4,this.releaseProbe()):this.nextDropText.setText("NEXT DROP: "+this.remaining),this.remaining-=50}createBottom(){this.third.load.texture("stars").then((t=>{t.wrapS=t.wrapT=1e3,t.offset.set(0,0),t.repeat.set(2,2),this.ground=this.third.physics.add.ground({width:2e3,height:2e3,y:-50},{phong:{map:t,transparent:!0}})}))}releaseProbe(){this.updateProbes(-1),this.tweens.add({targets:this.probesText,duration:400,alpha:{from:.5,to:1},repeat:5})}setScores(){this.deviationText=this.add.bitmapText(175,30,"computer","DEVIATION: "+this.registry.get("deviation"),30).setTint(237666).setOrigin(.5),this.nextDropText=this.add.bitmapText(this.center_width,30,"computer","NEXT DROP: "+this.remaining,30).setTint(237666).setOrigin(.5),this.probesText=this.add.bitmapText(this.width-150,30,"computer","PROBES: "+this.registry.get("probes"),30).setTint(237666).setOrigin(.5)}prepareShip(){this.third.load.gltf("./assets/objects/ship.glb").then((t=>{this.object=new Qh,this.object.add(t.scene);const e=this.third.add.material({standard:{color:13369344,transparent:!1,opacity:1}});this.object.traverse((t=>{t.isMesh&&t.material.isMaterial&&(t.material=e)})),this.ship=this.createShip("convexMesh",0,this.object),this.setShipColliderWithParticles()}))}createShip(t,e,n){this.left=!1;const i=new Qh;i.add(n.clone()),i.position.set(e,-2,10),i.rotation.set(0,Math.PI,0);let r={addChildren:!1,shape:t};return this.third.add.existing(i),this.third.physics.add.existing(i,r),i.body.needUpdate=!0,i.body.setLinearFactor(0,0,0),i.body.setAngularFactor(1,1,0),i.body.setFriction(20,20,20),i.body.setCollisionFlags(2),i}setShipColliderWithParticles(){this.ship.body.on.collision(((t,e)=>{/particle/.test(t.name)&&(this.updateDeviation(1),this.cameras.main.shake(500),this.playAudio(`hit${Phaser.Math.Between(1,4)}`),this.third.destroy(this.ship),this.ship=this.createShip("convexMesh",0,this.object),this.setShipColliderWithParticles())}))}loadAudios(){this.audios={thunder0:this.sound.add("thunder0"),thunder1:this.sound.add("thunder1"),thunder2:this.sound.add("thunder2"),thunder3:this.sound.add("thunder3"),passby0:this.sound.add("passby0"),passby1:this.sound.add("passby1"),shot:this.sound.add("shot"),hit1:this.sound.add("hit1"),hit2:this.sound.add("hit2"),hit3:this.sound.add("hit3"),hit4:this.sound.add("hit4"),voice_start:this.sound.add("voice_start"),voice_drop:this.sound.add("voice_drop"),voice_hit:this.sound.add("voice_hit")}}playAudio(t){this.audios[t].play()}playRandom(t){this.audios[t].play({rate:Phaser.Math.Between(1,1.5),detune:Phaser.Math.Between(-1e3,1e3),delay:0})}update(t,e){if(this.currentTime=t,this.ship&&this.ship.body){let{x:t,y:e,z:n}=this.ship.position;this.cursor.up.isDown&&this.ship.position.y<6/(n/5)?(e+=.1,this.createWingTrails()):this.cursor.down.isDown&&this.ship.position.y>-7/(n/5)&&(e-=.1,this.createWingTrails()),this.cursor.left.isDown&&this.ship.position.x>-7/(n/6)?(t-=.1,this.ship.rotation.set(0,Math.PI,-.2),this.createWingTrails(!0)):this.cursor.right.isDown&&this.ship.position.x<7/(n/6)&&(t+=.1,this.ship.rotation.set(0,Math.PI,.2),this.createWingTrails(!1)),this.cursor.right.isDown||this.cursor.left.isDown||this.ship.rotation.set(0,Math.PI,0),this.W.isDown&&this.ship.position.z>7?(this.ship.position.set(t,e,n-.1),n-=.1):this.S.isDown&&this.ship.position.z<15&&(this.ship.position.set(t,e,n+.1),n+=.1),this.ship.position.set(t,e,n),this.ship.body.needUpdate=!0,this.createTrail()}if(this.ground&&this.ground.setRotationFromEuler(new cn(0,0,1)),this.star){this.star.material.opacity=.5/Math.sin(3*t);let n=Math.sin(t)/10;this.starFront.position.set(this.starFront.position.x+n,this.starFront.position.y+n,this.starFront.position.z+n+this.proximity),this.starFront.rotation.set(0,t,0),this.starFront.body.needUpdate=!0,this.star.position.set(this.star.position.x+n,this.star.position.y+n,this.star.position.z+n+this.proximity),this.star.body.needUpdate=!0,this.proximity+=1e-6,this.torus.rotation.set(.1,e,0),this.torus.position.set(this.torus.position.x,this.torus.position.y,this.star.position.z+this.proximity),this.torus.body.needUpdate=!0}}createTrail(){const t=Phaser.Math.Between(-1,1)>0?11393254:16777215,e=this.third.add.box({x:this.ship.position.x,y:this.ship.position.y+.3,z:this.ship.position.z+1,width:.2,height:.2,depth:.2},{lambert:{color:t,transparent:!0,opacity:.4}});this.third.physics.add.existing(e),e.body.setVelocityZ(15),this.tweens.add({targets:e.scale,duration:600,scale:{from:1,to:0},repeat:1,onComplete:()=>{this.destroyParticle(e)}})}createWingTrails(t=null){const e=Phaser.Math.Between(-1,1)>0?11393254:16777215,[n,i]=null===t?[0,0]:t?[-.3,.3]:[.3,-.3],r=this.third.add.box({x:this.ship.position.x+1.3,y:this.ship.position.y+.5+i,z:this.ship.position.z+.5,width:.05,height:.05,depth:.05},{lambert:{color:e,transparent:!0,opacity:.4}}),s=this.third.add.box({x:this.ship.position.x-1.3,y:this.ship.position.y+.5+n,z:this.ship.position.z+.5,width:.05,height:.05,depth:.05},{lambert:{color:e,transparent:!0,opacity:.4}});this.third.physics.add.existing(r),this.third.physics.add.existing(s),r.body.setVelocityZ(15),s.body.setVelocityZ(15),this.tweens.add({targets:[r.scale,s.scale],duration:600,scale:{from:1,to:0},repeat:1,onComplete:()=>{this.destroyParticle(r),this.destroyParticle(s)}})}addWave(t=-25,e=!1){this.lightning.lightning();const{f1:n,f2:i,c:r}=this.applyFunctionsInterval();for(let s=0;s{let o=t+i,l=r(o,16*i,s),c=this.third.add.sphere({name:"particle"+Math.random(),radius:.25,x:o,y:l,z:t-(e?o:0)},{lambert:{color:a}});return this.third.physics.add.existing(c),this.particles.push(c),c.body.setVelocityZ(15),c}));this.playAudio("shot"),this.waves.push(o),this.time.delayedCall(4e3,(()=>this.playRandom("passby"+Phaser.Math.Between(0,1))),null,this),this.time.delayedCall(6e3,(()=>this.removeWave()),null,this)}}applyFunctionsInterval(){return{20:{f1:0,f2:3,c:3},19:{f1:0,f2:4,c:3},18:{f1:0,f2:3,c:4},17:{f1:0,f2:3,c:5},16:{f1:0,f2:3,c:6},15:{f1:0,f2:3,c:6},14:{f1:0,f2:3,c:6},13:{f1:0,f2:3,c:6},12:{f1:0,f2:4,c:4},11:{f1:0,f2:4,c:4},10:{f1:0,f2:4,c:4},9:{f1:0,f2:4,c:5},8:{f1:0,f2:4,c:5},7:{f1:0,f2:5,c:4},6:{f1:0,f2:5,c:5},5:{f1:0,f2:5,c:5},4:{f1:0,f2:5,c:6},3:{f1:0,f2:6,c:5},2:{f1:0,f2:6,c:5},1:{f1:0,f2:6,c:6},0:{f1:0,f2:6,c:6}}[this.registry.get("probes")]}removeWave(){this.waves.shift().forEach((t=>this.destroyParticle(t)))}destroyParticle(t){t.userData.dead=!0,t.visible=!1,this.third.physics.destroy(t),t=null}finishScene(t="outro"){this.scene.start(t)}updateDeviation(t=0){const e=+this.registry.get("deviation")+t;this.registry.set("deviation",e),this.playAudio("voice_hit"),this.deviationText.setText("DEVIATION: "+Number(e).toLocaleString()),10===e&&this.finishScene("game_over")}updateProbes(t=0){const e=+this.registry.get("probes")+t;this.registry.set("probes",e),this.playAudio("voice_drop"),this.probesText.setText("PROBES: "+Number(e).toLocaleString()),0===e&&this.finishScene("outro")}},ym,xm],...((t={})=>{const{antialias:e=!0,parent:n,canvasId:i="enable3d-phaser-canvas"}=t,r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.id=i;const s=n?document.getElementById(n):document.body;s?s.appendChild(r):Hh(`Parent "${n}" not found!`);const a={antialias:e},o={alpha:void 0===a.alpha||a.alpha,depth:void 0===a.depth||a.depth,stencil:void 0===a.stencil||a.stencil,antialias:void 0!==a.antialias&&a.antialias,premultipliedAlpha:void 0===a.premultipliedAlpha||a.premultipliedAlpha,preserveDrawingBuffer:void 0!==a.preserveDrawingBuffer&&a.preserveDrawingBuffer,powerPreference:void 0!==a.powerPreference?a.powerPreference:"default",failIfMajorPerformanceCaveat:void 0!==a.failIfMajorPerformanceCaveat&&a.failIfMajorPerformanceCaveat,xrCompatible:!0},l=(()=>{try{const t=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!t.getContext("webgl2"))}catch(Sm){return!1}})()?"webgl2":"webgl",c=r.getContext(l,o);return{canvas:r,context:c}})()};window.addEventListener("load",(()=>{gm((()=>new e.Game(wm))).withPhysics("./assets/ammo")})); diff --git a/fate/dist/index.html b/fate/dist/index.html index dea32630..556d0934 100644 --- a/fate/dist/index.html +++ b/fate/dist/index.html @@ -4,7 +4,7 @@ - Phaser - Template + Phaser - Fate - + diff --git a/fate/src/main.js b/fate/src/main.js index 3737ad11..ed19f696 100644 --- a/fate/src/main.js +++ b/fate/src/main.js @@ -16,6 +16,7 @@ const config = { width: 1280, height: 720, }, + parent: "game-container", scene: [Bootloader, Story, Splash, Game, Outro, GameOver], ...Canvas(), }; diff --git a/fate/src/scenes/story.js b/fate/src/scenes/story.js index 13f2cd95..69a27ab5 100644 --- a/fate/src/scenes/story.js +++ b/fate/src/scenes/story.js @@ -253,16 +253,14 @@ This is a long text that explains the story of the game. It is typed and then re }); const text = " GAGARIN WAS SENT ON A SECRET MISSION\nBEYOND THE OORT CLOUD, " + - "PROPELLED BY\nNUCLEAR DETONATIONS.\n\n - HE HAS NOW PASSED THE FRONTIER OF\nOUR SOLAR SYSTEM\n" + - "HIS MISSION:\nTO SET 20 PROBES AND RECOLLECT DATA - \nFROM THE DEADLIEST STELLAR OBJECT:\n" + - "A NEUTRINO STAR!\n\nHE HAS TO AVOID INCOMING DEBRIS - \nAND GET AS CLOSE AS POSSIBLE TO THE STAR.\n" + + "PROPELLED BY\nNUCLEAR DETONATIONS.\n\nHE HAS NOW PASSED THE FRONTIER OF\nOUR SOLAR SYSTEM\n" + + "HIS MISSION:\nTO SET 20 PROBES AND RECOLLECT DATA \nFROM THE DEADLIEST STELLAR OBJECT:\n" + + "A NEUTRINO STAR!\n\nHE HAS TO AVOID INCOMING DEBRIS \nAND GET AS CLOSE AS POSSIBLE TO THE STAR.\n" + "THAT WILL MEAN CERTAIN DEATH, BUT ALSO\nA MASSIVE ACHIEVEMENT " + "FOR SOVIET SCIENTISTS!\n\n" + "THE FATAL FATE OF GAGARIN IS NOW TIED\nTO THE GLORIOUS FATE " + "OF MOTHER RUSSIA...\n\n\nSPACE TO CONTINUE"; - let text1 = this.utils.typeText(text, "computer", 450, 50); + + this.utils.typeText(text, "computer", 450, 50); } } diff --git a/mars/dist/assets/index-CP-uPpKM.js b/mars/dist/assets/index-CP-uPpKM.js deleted file mode 100644 index 05a50961..00000000 --- a/mars/dist/assets/index-CP-uPpKM.js +++ /dev/null @@ -1,1951 +0,0 @@ -import { g as e, P as s, c as t } from "./phaser-X8YdoW2c.js"; -!(function () { - const t = document.createElement("link").relList; - if (!(t && t.supports && t.supports("modulepreload"))) { - for (const t of document.querySelectorAll('link[rel="modulepreload"]')) - e(t); - new MutationObserver((t) => { - for (const s of t) - if ("childList" === s.type) - for (const t of s.addedNodes) - "LINK" === t.tagName && "modulepreload" === t.rel && e(t); - }).observe(document, { childList: !0, subtree: !0 }); - } - function e(t) { - if (t.ep) return; - t.ep = !0; - const e = (function (t) { - const e = {}; - return ( - t.integrity && (e.integrity = t.integrity), - t.referrerPolicy && (e.referrerPolicy = t.referrerPolicy), - "use-credentials" === t.crossOrigin - ? (e.credentials = "include") - : "anonymous" === t.crossOrigin - ? (e.credentials = "omit") - : (e.credentials = "same-origin"), - e - ); - })(t); - fetch(t.href, e); - } -})(); -class i extends Phaser.Scene { - constructor() { - super({ key: "bootloader" }); - } - preload() { - this.createBars(), - this.setLoadEvents(), - this.loadFonts(), - this.loadImages(), - this.loadMaps(), - this.loadAudios(), - this.loadSpritesheets(), - this.setRegistry(); - } - setLoadEvents() { - this.load.on( - "progress", - function (t) { - this.progressBar.clear(), - this.progressBar.fillStyle(11411474, 1), - this.progressBar.fillRect( - this.cameras.main.width / 4, - this.cameras.main.height / 2 - 16, - (this.cameras.main.width / 2) * t, - 16 - ); - }, - this - ), - this.load.on( - "complete", - () => { - this.scene.start("splash"); - }, - this - ); - } - loadFonts() { - this.load.bitmapFont( - "pico", - "assets/fonts/pico.png", - "assets/fonts/pico.xml" - ); - } - loadImages() { - this.load.image("body", "assets/images/body.png"), - this.load.image("landscape", "assets/images/landscape.png"), - this.load.image("record", "assets/images/record.png"), - this.load.image("hole", "assets/images/hole.png"), - this.load.image("pello", "assets/images/pello_ok.png"), - this.load.image("mars", "assets/maps/mars64.png"), - this.load.image("background", "assets/maps/mars.png"); - } - loadMaps() { - Array(7) - .fill(0) - .forEach((t, e) => { - this.load.tilemapTiledJSON(`scene${e}`, `assets/maps/scene${e}.json`); - }); - } - loadAudios() { - this.load.audio("mars_background", "assets/sounds/mars_background.mp3"), - this.load.audio("step", "assets/sounds/step.mp3"), - this.load.audio("creepy", "assets/sounds/creepy.mp3"), - this.load.audio("heartbeat", "assets/sounds/heartbeat.mp3"), - this.load.audio("breath", "assets/sounds/breath.mp3"), - this.load.audio("blip", "assets/sounds/blip.mp3"), - this.load.audio("ohmygod", "assets/sounds/ohmygod.mp3"), - this.load.audio("kill", "assets/sounds/kill.mp3"), - this.load.audio("tracker", "assets/sounds/tracker.mp3"), - this.load.audio("holeshout", "assets/sounds/holeshout.mp3"), - this.load.audio("oxygen", "assets/sounds/oxygen.mp3"), - this.load.audio("monster", "assets/sounds/monster.mp3"), - this.load.audio("killed", "assets/sounds/killed.mp3"), - this.load.audio("creepy_static", "assets/sounds/creepy_static.mp3"), - this.load.audio("shock", "assets/sounds/shock.mp3"), - this.load.audio("cave", "assets/sounds/cave.mp3"), - this.load.audio("type", "assets/sounds/type.mp3"), - Array(4) - .fill(0) - .forEach((t, e) => { - this.load.audio(`static${e}`, `assets/sounds/static${e}.mp3`); - }), - Array(6) - .fill(0) - .forEach((t, e) => { - this.load.audio( - `diary${e + 1}`, - `assets/sounds/diary/diary${e + 1}.mp3` - ); - }), - Array(6) - .fill(0) - .forEach((t, e) => { - this.load.audio( - `officer${e + 1}`, - `assets/sounds/officer/officer${e + 1}.mp3` - ); - }); - } - loadSpritesheets() { - this.load.spritesheet("player", "assets/images/player.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("debris", "assets/images/debris.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("step", "assets/images/step.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("wave", "assets/images/wave.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("drone", "assets/images/drone.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("monster", "assets/images/monster.png", { - frameWidth: 128, - frameHeight: 64, - }); - } - setRegistry() { - this.registry.set("score", 0); - } - createBars() { - (this.loadBar = this.add.graphics()), - this.loadBar.fillStyle(7017483, 1), - this.loadBar.fillRect( - this.cameras.main.width / 4 - 2, - this.cameras.main.height / 2 - 18, - this.cameras.main.width / 2 + 4, - 20 - ), - (this.progressBar = this.add.graphics()); - } -} -class n { - constructor(t) { - this.scene = t; - } - typeText(t, e, s, i = 150, n = 450954, a = 40) { - let h = [], - o = 0, - r = 0; - t.split("").forEach((t, l) => { - "\n" === t && ((o += 2), (r = 0)), - h.push( - this.scene.add - .bitmapText(s - 350 + 25 * r++, i + o * a, e, t, a) - .setTint(n) - .setAlpha(0) - ); - }); - const l = this.scene.add - .rectangle(s - 335 + 25 * r, i + 25 + o * a, 25, 5, n) - .setOrigin(0.5) - .setAlpha(0), - d = this.scene.tweens.timeline(); - return ( - (this.typeAudio = this.scene.sound.add("type")), - h.forEach((t, e) => { - d.add({ targets: t, alpha: { from: 0, to: 0.5 }, duration: 100 }); - }), - d.add({ - targets: l, - alpha: { from: 0, to: 0.8 }, - duration: 100, - repeat: 5, - yoyo: !0, - onStart: () => { - this.typeAudio.stop(); - }, - }), - this.typeAudio.play({ - mute: !1, - volume: 1, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }), - d.play(), - h.push(l), - h - ); - } - removeTyped(t) { - t.flat().forEach((t) => t.destroy()); - } -} -class a extends Phaser.Scene { - constructor() { - super({ key: "outro" }); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - (this.introLayer = this.add.layer()), - (this.splashLayer = this.add.layer()), - this.add.tileSprite(0, 0, 800, 600, "landscape").setOrigin(0), - (this.utils = new n(this)), - (this.title = this.add - .bitmapText( - this.center_width, - this.center_height + 100, - "pico", - "MARSTRANDED", - 60 - ) - .setTint(7017483) - .setAlpha(0) - .setDropShadow(0, 4, 7024682, 0.9) - .setOrigin(0.5)), - this.tweens.add({ - targets: this.title, - alpha: { from: 0, to: 1 }, - duration: 4e3, - }), - this.input.keyboard.on("keydown-SPACE", this.startSplash, this), - this.input.keyboard.on("keydown-ENTER", this.startSplash, this); - } - playMusic(t = "mars_background") { - (this.theme = this.sound.add(t)), - this.theme.stop(), - this.theme.play({ - mute: !1, - volume: 1.5, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }); - } - startSplash() { - this.sound.stopAll(), this.scene.start("splash"); - } -} -class h extends Phaser.GameObjects.Rectangle { - constructor(t, e, s, i, n, a = 16771755) { - super( - t, - (e += Phaser.Math.Between(-30, 30)), - (s += Phaser.Math.Between(-30, 30)), - Phaser.Math.Between(30, 55), - Phaser.Math.Between(30, 55), - a - ), - t.add.existing(this), - t.physics.add.existing(this), - this.body.setAllowGravity(!1), - this.body.setVelocityX(100 * i), - this.body.setVelocityY(100 * n), - this.init(); - } - init() { - this.scene.tweens.add({ - targets: this, - duration: 800, - scale: { from: 1, to: 0 }, - onComplete: () => { - this.destroy(); - }, - }); - } -} -class o extends Phaser.Scene { - constructor() { - super({ key: "splash" }); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.cameras.main.setBackgroundColor(0), - (this.smokeLayer = this.add.layer()), - this.showTitle(), - this.time.delayedCall(1e3, () => this.showInstructions(), null, this), - this.input.keyboard.on("keydown-SPACE", () => this.startGame(), this), - this.playMusic(); - } - showTitle() { - (this.step = this.sound.add("step")), - "MARSTRANDED".split("").forEach((t, e) => { - this.time.delayedCall( - 600 * (e + 1), - () => { - this.add - .bitmapText(70 * e + 50, 200, "pico", t, 70) - .setTint(7017483) - .setOrigin(0.5) - .setDropShadow(0, 4, 7024682, 0.9), - Array(Phaser.Math.Between(2, 4)) - .fill(0) - .forEach((t) => { - this.smokeLayer.add( - new h( - this, - 70 * e + 80 + Phaser.Math.Between(-30, 30), - 200 + Phaser.Math.Between(-30, 30), - 0, - -1, - 7024682 - ) - ); - }), - this.step.play({ rate: 0.8 }), - this.step.resume(); - }, - null, - this - ); - }); - } - startGame() { - this.theme && this.theme.stop(), - this.sound.add("blip").play(), - this.scene.start("transition", { - next: "game", - name: "STAGE", - number: 0, - time: 30, - }); - } - playMusic(t = "mars_background") { - (this.theme = this.sound.add(t)), - this.theme.stop(), - this.theme.play({ - mute: !1, - volume: 2, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }); - } - showInstructions() { - this.add - .bitmapText(this.center_width, 450, "pico", "WASD/Arrows", 40) - .setTint(7017483) - .setOrigin(0.5) - .setDropShadow(0, 3, 7024682, 0.9), - this.add - .sprite(this.center_width - 140, 355, "pello") - .setOrigin(0.5) - .setScale(0.5), - this.add - .bitmapText(this.center_width + 60, 350, "pico", "By PELLO", 35) - .setTint(7017483) - .setOrigin(0.5) - .setDropShadow(0, 3, 7024682, 0.9), - (this.space = this.add - .bitmapText(this.center_width, 520, "pico", "SPACE start", 30) - .setTint(7017483) - .setOrigin(0.5) - .setDropShadow(0, 2, 7024682, 0.9)), - this.tweens.add({ - targets: this.space, - duration: 300, - alpha: { from: 0, to: 1 }, - repeat: -1, - yoyo: !0, - }); - } -} -class r extends Phaser.Scene { - constructor() { - super({ key: "transition" }); - } - init(t) { - this.number = t.number; - } - create() { - (this.missions = [ - "", - "Go north, locate containers.", - "Find landing zone. North East.", - "Locate landing, South East.", - "Go East, locate containers.", - "Other landings: North East", - "Find out ship origin...", - ]), - (this.utils = new n(this)), - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.add.tileSprite(0, 0, 800, 600, "landscape").setOrigin(0), - 7 === this.number - ? this.scene.start("outro", { number: this.number }) - : this.sound.stopAll(), - this.showInstructions(), - this.input.keyboard.on("keydown-ENTER", () => this.loadNext(), this), - this.input.keyboard.on("keydown-SPACE", () => this.loadNext(), this); - } - showInstructions() { - const t = Array(8) - .fill(0) - .map((t, e) => `DAY ${e}`); - (this.text1 = this.add - .bitmapText(this.center_width, 20, "pico", t[this.number], 30) - .setOrigin(0.5) - .setAlpha(0)), - (this.text2 = this.add - .bitmapText( - this.center_width, - 70, - "pico", - "AUDIO RECORD OF CAPTAIN BRAUN", - 20 - ) - .setOrigin(0.5) - .setAlpha(0)), - this.number > 0 - ? this.showSceneInstructions() - : this.showFirstInstructions(); - } - showSceneInstructions() { - this.tweens.add({ - targets: [this.text1, this.text2, this.play], - duration: 1e3, - alpha: { from: 0, to: 1 }, - onComplete: () => { - this.playDiary(); - }, - }); - } - showFirstInstructions() { - this.playBackground(), - (this.text2 = this.add - .bitmapText(this.center_width, 70, "pico", "THE CRASH", 20) - .setOrigin(0.5) - .setAlpha(0)), - this.playCreepy(), - this.tweens.add({ - targets: [this.text1], - duration: 2e3, - alpha: { from: 0, to: 1 }, - onComplete: () => { - this.playIntro(); - }, - }); - } - playIntro() { - this.utils.typeText( - "YOU JUST CRASHED ON MARS\nYOU ARE ALIVE BUT YOUR\nSHIP IS COMPLETELY LOST\nIF YOU WANT TO LIVE YOU\nMUST FIND LANDING REMAINS\nTRY GOING EAST...", - "pico", - this.center_width, - 150, - 16777215, - 20 - ); - } - playBackground() { - (this.theme = this.sound.add("mars_background")), - this.theme.stop(), - this.theme.play({ - mute: !1, - volume: 1, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }); - } - playDiary() { - (this.wave = this.add - .sprite(this.center_width, 200, "wave") - .setOrigin(0.5)), - this.anims.create({ - key: "wave", - frames: this.anims.generateFrameNumbers("wave", { start: 0, end: 4 }), - frameRate: 20, - repeat: -1, - }), - this.wave.anims.play("wave", !0), - (this.recording = this.sound.add(`diary${this.number}`)), - this.recording.on( - "complete", - function () { - this.wave.destroy(), this.showMission(), this.playCreepy(); - }.bind(this) - ), - this.recording.play(); - } - playCreepy() { - (this.creepy = this.sound.add("creepy")), - this.creepy.play({ - mute: !1, - volume: 0.9, - rate: 0.9, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }); - } - showMission() { - (this.text3 = this.add - .bitmapText(this.center_width, 300, "pico", "MISSION OBJECTIVE:", 30) - .setOrigin(0.5)), - this.utils.typeText( - this.missions[this.number], - "pico", - this.center_width, - 400, - 16777215, - 20 - ); - } - loadNext() { - this.sound.add("blip").play(), - this.sound.stopAll(), - this.scene.start("game", { number: this.number }); - } -} -class l extends Phaser.GameObjects.Sprite { - constructor(t, e, s, i = "step") { - super(t, e, s, "step", Phaser.Math.Between(0, 3)), - t.add.existing(this), - this.setOrigin(0), - t.tweens.add({ - targets: [this], - duration: 2e3, - alpha: { from: 1, to: 0.1 }, - }); - } -} -class d extends Phaser.GameObjects.Sprite { - constructor(t, e, s, i = 100) { - super(t, e, s, "player"), - this.setOrigin(0), - this.setScale(1), - this.scene.add.existing(this), - this.scene.physics.add.existing(this), - this.body.setAllowGravity(!1), - (this.dead = !1), - this.init(), - (this.shells = 0), - (this.lastDirection = 0), - (this.steps = 0), - (this.stepDelta = 0), - (this.moveDelta = 0), - (this.rate = 0.2), - (this.previousRate = 0.2), - (this.oxygen = i), - (this.locked = !1); - } - init() { - this.addControls(), this.scene.events.on("update", this.update, this); - } - addControls() { - (this.cursor = this.scene.input.keyboard.createCursorKeys()), - (this.W = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.W - )), - (this.A = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.A - )), - (this.S = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.S - )), - (this.D = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.D - )); - } - update(t, e) { - if (!this.dead && !this.locked) { - if ( - ((this.stepDelta += e), - (this.moveDelta += e), - (Phaser.Input.Keyboard.JustDown(this.W) || - Phaser.Input.Keyboard.JustDown(this.cursor.up)) && - this.canMoveUp()) - ) { - this.moveDelta = 0; - const { x: t, y: e } = this; - (this.locked = !0), - this.scene.tweens.add({ - targets: this, - y: "-=64", - duration: 200, - onComplete: () => { - this.locked = !1; - }, - }), - this.step(t, e); - } else if ( - (Phaser.Input.Keyboard.JustDown(this.D) || - Phaser.Input.Keyboard.JustDown(this.cursor.right)) && - this.canMoveRight() - ) { - this.moveDelta = 0; - const { x: t, y: e } = this; - (this.locked = !0), - this.scene.tweens.add({ - targets: this, - x: "+=64", - duration: 200, - onComplete: () => { - this.locked = !1; - }, - }), - this.step(t, e); - } else if ( - (Phaser.Input.Keyboard.JustDown(this.A) || - Phaser.Input.Keyboard.JustDown(this.cursor.left)) && - this.canMoveLeft() - ) { - this.moveDelta = 0; - const { x: t, y: e } = this; - (this.locked = !0), - this.scene.tweens.add({ - targets: this, - x: "-=64", - duration: 200, - onComplete: () => { - this.locked = !1; - }, - }), - this.step(t, e); - } else if ( - (Phaser.Input.Keyboard.JustDown(this.S) || - Phaser.Input.Keyboard.JustDown(this.cursor.down)) && - this.canMoveDown() - ) { - this.moveDelta = 0; - const { x: t, y: e } = this; - (this.locked = !0), - this.scene.tweens.add({ - targets: this, - y: "+=64", - duration: 200, - onComplete: () => { - this.locked = !1; - }, - }), - this.step(t, e); - } - this.adaptBreath(); - } - } - canMoveUp() { - return ( - !this.scene.platform.getTileAtWorldXY(this.x, this.y - 1) && - this.moveDelta > 200 - ); - } - canMoveRight() { - return ( - !this.scene.platform.getTileAtWorldXY(this.x + 64, this.y) && - this.moveDelta > 200 - ); - } - canMoveDown() { - return ( - !this.scene.platform.getTileAtWorldXY(this.x, this.y + 64) && - this.moveDelta > 200 - ); - } - canMoveLeft() { - return ( - !this.scene.platform.getTileAtWorldXY(this.x - 1, this.y) && - this.moveDelta > 200 - ); - } - step(t, e) { - this.steps++, - this.scene.smokeLayer.add(new l(this.scene, t, e)), - this.scene.playRandom("step", 1); - } - adaptBreath() { - this.stepDelta > 2e3 && - (this.steps > 2 - ? ((this.previousRate = this.rate), - (this.rate = this.steps < 11 ? this.steps / 10 : 1), - this.scene.breath(this.rate), - this.updateOxygen(this.steps + Math.round(this.steps / 2))) - : this.rate !== this.previousRate - ? ((this.previousRate = this.rate), - (this.rate = this.rate > 0.2 ? this.rate - 0.1 : 0.2), - this.scene.breath(this.rate), - this.scene.updateOxygen(this.steps)) - : this.scene.updateOxygen(this.steps), - (this.steps = this.stepDelta = 0)); - } - updateOxygen(t) { - t >= this.oxygen ? ((this.oxygen = 0), this.death()) : (this.oxygen -= t), - this.scene.updateOxygen(); - } - death() { - (this.dead = !0), - this.body.stop(), - (this.body.enable = !1), - this.scene.restartScene(); - } -} -class c extends Phaser.GameObjects.Sprite { - constructor(t, e, s) { - super(t, e, s, "hole"), - (this.name = "hole"), - this.setOrigin(0), - this.setAlpha(0), - t.add.existing(this), - t.physics.add.existing(this), - this.body.setAllowGravity(!1); - } -} -class u extends Phaser.GameObjects.Sprite { - constructor(t, e, s) { - super(t, e, s, "body"), - (this.name = "body"), - this.setOrigin(0), - (this.rotation = 1.6), - t.add.existing(this); - } -} -let p = class extends Phaser.GameObjects.Rectangle { - constructor(t, e, s, i, n, a = "") { - super(t, e, s, 192, 192), - this.setOrigin(0), - (this.type = i), - (this.description = n), - (this.extra = a), - t.add.existing(this), - t.physics.add.existing(this), - this.body.setAllowGravity(!1), - (this.activated = !1); - } - touch() { - switch (this.type) { - case "note": - this.showNote(this.description); - break; - case "radio": - this.useRadio(); - break; - case "exit": - this.exitScene(); - break; - case "hole": - this.activateHole(); - break; - case "oxygen": - this.useOxygen(); - break; - case "braun": - this.activateBraun(); - break; - case "ending": - this.revealEnding(); - } - } - showNote(t) { - const e = this.scene.add.bitmapText(this.x, this.y, "pico", t, 15); - this.scene.tweens.add({ - targets: e, - alpha: { from: 1, to: 0 }, - duration: 6e3, - ease: "Sine", - onComplete: () => { - e.destroy(); - }, - }); - } - showExit(t) { - const e = this.scene.add.bitmapText( - this.x - 128, - this.y - 64, - "pico", - t, - 25 - ); - this.scene.tweens.add({ - targets: e, - alpha: { from: 0.8, to: 1 }, - duration: 100, - repeat: 5, - }); - } - useRadio() { - (this.officerAudio = this.scene.sound.add(this.description)), - this.officerAudio.play(), - this.officerAudio.on( - "complete", - function () { - this.scene.playRandomStatic(), - this.extra && this.scene.sound.add(this.extra).play(); - }.bind(this) - ); - } - exitScene() { - this.showExit(this.description), - this.showNote(this.extra), - this.scene.finishScene(); - } - useOxygen() { - this.showNote("Oxygen supplies!"), - (this.scene.player.oxygen = 100), - this.scene.updateOxygen(), - this.scene.playAudio("oxygen"); - } - revealEnding() { - const t = this.scene.sound.add("ohmygod"); - t.play(), - this.scene.cameras.main.shake(1e4), - this.showExit(this.description), - this.scene.sound.add("monster").play({ volume: 1.5, rate: 0.8 }); - const e = this.scene.add - .sprite(this.x + 128, this.y + 128, "monster") - .setOrigin(0.5); - this.scene.anims.create({ - key: "monster", - frames: this.scene.anims.generateFrameNumbers("monster", { - start: 0, - end: 5, - }), - frameRate: 3, - }), - e.anims.play("monster", !0), - t.on( - "complete", - function () { - this.scene.breathing.pause(), - this.scene.playAudio("holeshout"), - this.scene.finishScene(!1); - }.bind(this) - ); - } - activateHole() { - this.scene.holes.add(new c(this.scene, this.x + 64, this.y + 64)); - } - activateBraun() { - this.showExit(this.description), - this.scene.playAudio("shock"), - new u(this.scene, this.x + 128, this.y + 64); - } -}; -var m, - y = { exports: {} }; -(m = y), - function () { - var t, e, s, i, n, a, h, o, r, l, d, c, u, p, y; - (s = Math.floor), - (l = Math.min), - (e = function (t, e) { - return t < e ? -1 : t > e ? 1 : 0; - }), - (r = function (t, i, n, a, h) { - var o; - if ((null == n && (n = 0), null == h && (h = e), n < 0)) - throw new Error("lo must be non-negative"); - for (null == a && (a = t.length); n < a; ) - h(i, t[(o = s((n + a) / 2))]) < 0 ? (a = o) : (n = o + 1); - return [].splice.apply(t, [n, n - n].concat(i)), i; - }), - (a = function (t, s, i) { - return null == i && (i = e), t.push(s), p(t, 0, t.length - 1, i); - }), - (n = function (t, s) { - var i, n; - return ( - null == s && (s = e), - (i = t.pop()), - t.length ? ((n = t[0]), (t[0] = i), y(t, 0, s)) : (n = i), - n - ); - }), - (o = function (t, s, i) { - var n; - return null == i && (i = e), (n = t[0]), (t[0] = s), y(t, 0, i), n; - }), - (h = function (t, s, i) { - var n; - return ( - null == i && (i = e), - t.length && - i(t[0], s) < 0 && - ((s = (n = [t[0], s])[0]), (t[0] = n[1]), y(t, 0, i)), - s - ); - }), - (i = function (t, i) { - var n, a, h, o, r, l; - for ( - null == i && (i = e), - r = [], - a = 0, - h = (o = function () { - l = []; - for ( - var e = 0, i = s(t.length / 2); - 0 <= i ? e < i : e > i; - 0 <= i ? e++ : e-- - ) - l.push(e); - return l; - } - .apply(this) - .reverse()).length; - a < h; - a++ - ) - (n = o[a]), r.push(y(t, n, i)); - return r; - }), - (u = function (t, s, i) { - var n; - if ((null == i && (i = e), -1 !== (n = t.indexOf(s)))) - return p(t, 0, n, i), y(t, n, i); - }), - (d = function (t, s, n) { - var a, o, r, l, d; - if ((null == n && (n = e), !(o = t.slice(0, s)).length)) return o; - for (i(o, n), r = 0, l = (d = t.slice(s)).length; r < l; r++) - (a = d[r]), h(o, a, n); - return o.sort(n).reverse(); - }), - (c = function (t, s, a) { - var h, o, d, c, u, p, m, y, g; - if ((null == a && (a = e), 10 * s <= t.length)) { - if (!(d = t.slice(0, s).sort(a)).length) return d; - for ( - o = d[d.length - 1], c = 0, p = (m = t.slice(s)).length; - c < p; - c++ - ) - a((h = m[c]), o) < 0 && - (r(d, h, 0, null, a), d.pop(), (o = d[d.length - 1])); - return d; - } - for ( - i(t, a), g = [], u = 0, y = l(s, t.length); - 0 <= y ? u < y : u > y; - 0 <= y ? ++u : --u - ) - g.push(n(t, a)); - return g; - }), - (p = function (t, s, i, n) { - var a, h, o; - for ( - null == n && (n = e), a = t[i]; - i > s && n(a, (h = t[(o = (i - 1) >> 1)])) < 0; - - ) - (t[i] = h), (i = o); - return (t[i] = a); - }), - (y = function (t, s, i) { - var n, a, h, o, r; - for ( - null == i && (i = e), a = t.length, r = s, h = t[s], n = 2 * s + 1; - n < a; - - ) - (o = n + 1) < a && !(i(t[n], t[o]) < 0) && (n = o), - (t[s] = t[n]), - (n = 2 * (s = n) + 1); - return (t[s] = h), p(t, r, s, i); - }), - (t = (function () { - function t(t) { - (this.cmp = null != t ? t : e), (this.nodes = []); - } - return ( - (t.push = a), - (t.pop = n), - (t.replace = o), - (t.pushpop = h), - (t.heapify = i), - (t.updateItem = u), - (t.nlargest = d), - (t.nsmallest = c), - (t.prototype.push = function (t) { - return a(this.nodes, t, this.cmp); - }), - (t.prototype.pop = function () { - return n(this.nodes, this.cmp); - }), - (t.prototype.peek = function () { - return this.nodes[0]; - }), - (t.prototype.contains = function (t) { - return -1 !== this.nodes.indexOf(t); - }), - (t.prototype.replace = function (t) { - return o(this.nodes, t, this.cmp); - }), - (t.prototype.pushpop = function (t) { - return h(this.nodes, t, this.cmp); - }), - (t.prototype.heapify = function () { - return i(this.nodes, this.cmp); - }), - (t.prototype.updateItem = function (t) { - return u(this.nodes, t, this.cmp); - }), - (t.prototype.clear = function () { - return (this.nodes = []); - }), - (t.prototype.empty = function () { - return 0 === this.nodes.length; - }), - (t.prototype.size = function () { - return this.nodes.length; - }), - (t.prototype.clone = function () { - var e; - return ((e = new t()).nodes = this.nodes.slice(0)), e; - }), - (t.prototype.toArray = function () { - return this.nodes.slice(0); - }), - (t.prototype.insert = t.prototype.push), - (t.prototype.top = t.prototype.peek), - (t.prototype.front = t.prototype.peek), - (t.prototype.has = t.prototype.contains), - (t.prototype.copy = t.prototype.clone), - t - ); - })()), - (m.exports = t); - }.call(t); -var g = {}, - f = function () { - (this.pointsToAvoid = {}), - this.startX, - this.callback, - this.startY, - this.endX, - this.endY, - (this.nodeHash = {}), - this.openList; - }, - b = function (t, e, s, i, n) { - (this.parent = t), - (this.x = e), - (this.y = s), - (this.costSoFar = i), - (this.simpleDistanceToTarget = n), - (this.bestGuessDistance = function () { - return this.costSoFar + this.simpleDistanceToTarget; - }); - }, - v = y.exports, - x = g, - S = 1; -(g.js = function () { - var t, - e, - s, - i = 1.4, - n = !1, - a = {}, - h = {}, - o = {}, - r = {}, - l = !0, - d = {}, - c = [], - u = Number.MAX_VALUE, - p = !1; - (this.setAcceptableTiles = function (t) { - t instanceof Array - ? (s = t) - : !isNaN(parseFloat(t)) && isFinite(t) && (s = [t]); - }), - (this.enableSync = function () { - n = !0; - }), - (this.disableSync = function () { - n = !1; - }), - (this.enableDiagonals = function () { - p = !0; - }), - (this.disableDiagonals = function () { - p = !1; - }), - (this.setGrid = function (e) { - t = e; - for (var s = 0; s < t.length; s++) - for (var i = 0; i < t[0].length; i++) h[t[s][i]] || (h[t[s][i]] = 1); - }), - (this.setTileCost = function (t, e) { - h[t] = e; - }), - (this.setAdditionalPointCost = function (t, e, s) { - void 0 === o[e] && (o[e] = {}), (o[e][t] = s); - }), - (this.removeAdditionalPointCost = function (t, e) { - void 0 !== o[e] && delete o[e][t]; - }), - (this.removeAllAdditionalPointCosts = function () { - o = {}; - }), - (this.setDirectionalCondition = function (t, e, s) { - void 0 === r[e] && (r[e] = {}), (r[e][t] = s); - }), - (this.removeAllDirectionalConditions = function () { - r = {}; - }), - (this.setIterationsPerCalculation = function (t) { - u = t; - }), - (this.avoidAdditionalPoint = function (t, e) { - void 0 === a[e] && (a[e] = {}), (a[e][t] = 1); - }), - (this.stopAvoidingAdditionalPoint = function (t, e) { - void 0 !== a[e] && delete a[e][t]; - }), - (this.enableCornerCutting = function () { - l = !0; - }), - (this.disableCornerCutting = function () { - l = !1; - }), - (this.stopAvoidingAllAdditionalPoints = function () { - a = {}; - }), - (this.findPath = function (e, i, a, h, o) { - var r = function (t) { - n - ? o(t) - : setTimeout(function () { - o(t); - }); - }; - if (void 0 === s) - throw new Error( - "You can't set a path without first calling setAcceptableTiles() on EasyStar." - ); - if (void 0 === t) - throw new Error( - "You can't set a path without first calling setGrid() on EasyStar." - ); - if ( - e < 0 || - i < 0 || - a < 0 || - h < 0 || - e > t[0].length - 1 || - i > t.length - 1 || - a > t[0].length - 1 || - h > t.length - 1 - ) - throw new Error( - "Your start or end point is outside the scope of your grid." - ); - if (e !== a || i !== h) { - for (var l = t[h][a], u = !1, p = 0; p < s.length; p++) - if (l === s[p]) { - u = !0; - break; - } - if (!1 !== u) { - var m = new f(); - (m.openList = new v(function (t, e) { - return t.bestGuessDistance() - e.bestGuessDistance(); - })), - (m.isDoneCalculating = !1), - (m.nodeHash = {}), - (m.startX = e), - (m.startY = i), - (m.endX = a), - (m.endY = h), - (m.callback = r), - m.openList.push(E(m, m.startX, m.startY, null, 1)); - var y = S++; - return (d[y] = m), c.push(y), y; - } - r(null); - } else r([]); - }), - (this.cancelPath = function (t) { - return t in d && (delete d[t], !0); - }), - (this.calculate = function () { - if (0 !== c.length && void 0 !== t && void 0 !== s) - for (e = 0; e < u; e++) { - if (0 === c.length) return; - n && (e = 0); - var a = c[0], - h = d[a]; - if (void 0 !== h) - if (0 !== h.openList.size()) { - var o = h.openList.pop(); - if (h.endX !== o.x || h.endY !== o.y) - (o.list = 0), - o.y > 0 && m(h, o, 0, -1, 1 * w(o.x, o.y - 1)), - o.x < t[0].length - 1 && m(h, o, 1, 0, 1 * w(o.x + 1, o.y)), - o.y < t.length - 1 && m(h, o, 0, 1, 1 * w(o.x, o.y + 1)), - o.x > 0 && m(h, o, -1, 0, 1 * w(o.x - 1, o.y)), - p && - (o.x > 0 && - o.y > 0 && - (l || - (y(t, s, o.x, o.y - 1, o) && - y(t, s, o.x - 1, o.y, o))) && - m(h, o, -1, -1, i * w(o.x - 1, o.y - 1)), - o.x < t[0].length - 1 && - o.y < t.length - 1 && - (l || - (y(t, s, o.x, o.y + 1, o) && - y(t, s, o.x + 1, o.y, o))) && - m(h, o, 1, 1, i * w(o.x + 1, o.y + 1)), - o.x < t[0].length - 1 && - o.y > 0 && - (l || - (y(t, s, o.x, o.y - 1, o) && - y(t, s, o.x + 1, o.y, o))) && - m(h, o, 1, -1, i * w(o.x + 1, o.y - 1)), - o.x > 0 && - o.y < t.length - 1 && - (l || - (y(t, s, o.x, o.y + 1, o) && - y(t, s, o.x - 1, o.y, o))) && - m(h, o, -1, 1, i * w(o.x - 1, o.y + 1))); - else { - var r = []; - r.push({ x: o.x, y: o.y }); - for (var g = o.parent; null != g; ) - r.push({ x: g.x, y: g.y }), (g = g.parent); - r.reverse(); - var f = r; - h.callback(f), delete d[a], c.shift(); - } - } else h.callback(null), delete d[a], c.shift(); - else c.shift(); - } - }); - var m = function (e, i, n, h, o) { - var r = i.x + n, - l = i.y + h; - if ((void 0 === a[l] || void 0 === a[l][r]) && y(t, s, r, l, i)) { - var d = E(e, r, l, i, o); - void 0 === d.list - ? ((d.list = 1), e.openList.push(d)) - : i.costSoFar + o < d.costSoFar && - ((d.costSoFar = i.costSoFar + o), - (d.parent = i), - e.openList.updateItem(d)); - } - }, - y = function (t, e, s, i, n) { - var a = r[i] && r[i][s]; - if (a) { - var h = x(n.x - s, n.y - i); - if ( - !(function () { - for (var t = 0; t < a.length; t++) if (a[t] === h) return !0; - return !1; - })() - ) - return !1; - } - for (var o = 0; o < e.length; o++) if (t[i][s] === e[o]) return !0; - return !1; - }, - x = function (t, e) { - if (0 === t && -1 === e) return g.TOP; - if (1 === t && -1 === e) return g.TOP_RIGHT; - if (1 === t && 0 === e) return g.RIGHT; - if (1 === t && 1 === e) return g.BOTTOM_RIGHT; - if (0 === t && 1 === e) return g.BOTTOM; - if (-1 === t && 1 === e) return g.BOTTOM_LEFT; - if (-1 === t && 0 === e) return g.LEFT; - if (-1 === t && -1 === e) return g.TOP_LEFT; - throw new Error("These differences are not valid: " + t + ", " + e); - }, - w = function (e, s) { - return (o[s] && o[s][e]) || h[t[s][e]]; - }, - E = function (t, e, s, i, n) { - if (void 0 !== t.nodeHash[s]) { - if (void 0 !== t.nodeHash[s][e]) return t.nodeHash[s][e]; - } else t.nodeHash[s] = {}; - var a = T(e, s, t.endX, t.endY); - if (null !== i) var h = i.costSoFar + n; - else h = 0; - var o = new b(i, e, s, h, a); - return (t.nodeHash[s][e] = o), o; - }, - T = function (t, e, s, n) { - var a, h; - return p - ? (a = Math.abs(t - s)) < (h = Math.abs(e - n)) - ? i * a + h - : i * h + a - : (a = Math.abs(t - s)) + (h = Math.abs(e - n)); - }; -}), - (g.TOP = "TOP"), - (g.TOP_RIGHT = "TOP_RIGHT"), - (g.RIGHT = "RIGHT"), - (g.BOTTOM_RIGHT = "BOTTOM_RIGHT"), - (g.BOTTOM = "BOTTOM"), - (g.BOTTOM_LEFT = "BOTTOM_LEFT"), - (g.LEFT = "LEFT"), - (g.TOP_LEFT = "TOP_LEFT"); -const w = e(x); -class E extends Phaser.GameObjects.Sprite { - constructor(t, e, s, i) { - super(t, e, s, "drone"), - (this.name = "drone"), - this.setScale(1), - (this.grid = i), - t.add.existing(this), - t.physics.add.existing(this), - this.body.setAllowGravity(!1), - (this.easystar = new w.js()), - this.init(); - } - init() { - this.easystar.setGrid(this.grid), - this.easystar.setAcceptableTiles([0]), - this.scene.events.on("update", this.update, this), - this.scene.tweens.add({ - targets: this, - duration: 500, - repeat: -1, - scale: { from: 0.95, to: 1 }, - yoyo: !0, - }), - this.scene.anims.create({ - key: this.name, - frames: this.scene.anims.generateFrameNumbers(this.name, { - start: 0, - end: 3, - }), - frameRate: 5, - repeat: -1, - }), - this.anims.play(this.name, !0), - (this.flipX = this.direction < 0), - this.scene.time.delayedCall( - Phaser.Math.Between(3e3, 5e3), - () => { - this.scene.playAudio("kill"), this.launchMove(); - }, - null, - this - ); - } - launchMove() { - this.scene && - (this.delayedMove = this.scene.time.addEvent({ - delay: 2e3, - callback: this.move.bind(this), - startAt: 0, - callbackScope: this, - loop: !0, - })); - } - move() { - try { - if (!this.scene.player) return; - this.moveTimeline && this.moveTimeline.destroy(), - this.easystar.findPath( - Math.floor(this.x / 64), - Math.floor(this.y / 64), - Math.floor(this.scene.player.x / 64), - Math.floor(this.scene.player.y / 64), - this.moveIt.bind(this) - ), - this.easystar.setIterationsPerCalculation(1e4), - this.easystar.enableSync(), - this.easystar.calculate(); - } catch (t) { - console.log("Cant move yet: ", t); - } - } - moveIt(t) { - if (null === t) console.log("hello sneaky pete"); - else { - let e = []; - (this.i = 0), (this.path = t); - for (let s = 0; s < t.length - 1; s++) { - if (this.scene.player.dead) return; - let i = 64 * t[s + 1].x, - n = 64 * t[s + 1].y; - e.push({ targets: this, duration: 400, x: i, y: n }); - } - this.moveTimeline = this.scene.tweens.timeline({ - tweens: e, - onComplete: () => { - this.delayedMove.remove(), - this.alpha > 0 && !this.scene.player.dead && this.launchMove(); - }, - }); - } - } -} -const T = { - setBloomEnable(t) { - return void 0 === t && (t = !0), (this.bloomEnable = t), this; - }, - setBloomRadius(t) { - return (this.bloomRadius = t), this; - }, - setBloomIntensity(t) { - return (this.bloomIntensity = t), this; - }, - setBloomThreshold(t) { - return (this.bloomThreshold = t), this; - }, - setBloomTexelSize(t, e) { - return ( - void 0 === e && (e = t), - (this.bloomTexelWidth = t), - (this.bloomTexelHeight = e), - this - ); - }, - }, - k = { - setChromaticEnable(t) { - return void 0 === t && (t = !0), (this.chromaticEnable = t), this; - }, - setChabIntensity(t) { - return (this.chabIntensity = t), this; - }, - }, - A = { - setVignetteEnable(t) { - return void 0 === t && (t = !0), (this.vignetteEnable = t), this; - }, - setVignetteStrength(t) { - return (this.vignetteStrength = t), this; - }, - setVignetteIntensity(t) { - return (this.vignetteIntensity = t), this; - }, - }, - O = { - setNoiseEnable(t) { - return void 0 === t && (t = !0), (this.noiseEnable = t), this; - }, - setNoiseStrength(t) { - return (this.noiseStrength = t), this; - }, - setNoiseSeed(t) { - return (this.noiseSeed = t), this; - }, - }, - M = { - setVHSEnable(t) { - return void 0 === t && (t = !0), (this.vhsEnable = t), this; - }, - setVhsStrength(t) { - return (this.vhsStrength = t), this; - }, - }, - P = { - setScanlinesEnable(t) { - return void 0 === t && (t = !0), (this.scanlinesEnable = t), this; - }, - setScanStrength(t) { - return (this.scanStrength = t), this; - }, - }, - I = { - setCRTEnable(t) { - return void 0 === t && (t = !0), (this.crtEnable = t), this; - }, - setCrtSize(t, e) { - return ( - void 0 === e && (e = t), (this.crtWidth = t), (this.crtHeight = e), this - ); - }, - }; -var C = { - setEnable: function (t) { - return ( - void 0 === t && (t = !0), - (this.bloomEnable = t), - (this.chromaticEnable = t), - (this.vignetteEnable = t), - (this.noiseEnable = t), - (this.vhsEnable = t), - (this.scanlinesEnable = t), - (this.crtEnable = t), - this - ); - }, -}; -Object.assign(C, T, k, A, O, M, P, I); -const B = Phaser.Game; -var D = function (t) { - return t instanceof B; -}; -const R = Phaser.Scene; -var L = function (t) { - return t instanceof R; -}; -const H = Phaser.Renderer.WebGL.Pipelines.PostFXPipeline, - _ = Phaser.Utils.Objects.GetValue; -class N extends H { - constructor(t) { - super({ - name: "rexHorrifiPostFx", - game: t, - renderTarget: !0, - fragShader: - "#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n\nuniform float time;\n\n// Scene buffer\nuniform sampler2D uMainSampler; \nvarying vec2 outTexCoord;\n\n// Effect parameters\n#define SAMPLES 32.\n\n// Bloom\nuniform float bloomEnable;\nuniform vec3 bloom;\nuniform vec2 bloomTexel;\n\n// Chromatic abberation\nuniform float chromaticEnable;\nuniform float chabIntensity;\n\n// Vignette\nuniform float vignetteEnable;\nuniform vec2 vignette;\n\n// Noise\nuniform float noiseEnable;\nuniform float noiseStrength;\nuniform float noiseSeed;\n\n// VHS\nuniform float vhsEnable;\nuniform float vhsStrength;\n\n// Scanlines\nuniform float scanlinesEnable;\nuniform float scanStrength;\n\n// CRT\nuniform float crtEnable;\nuniform vec2 crtSize;\n\n\n// Noise\nfloat noise(vec2 uv) {\n return fract(sin(uv.x*12.9898+uv.y*78.233)*437.585453*noiseSeed);\n}\n\n// VHS\nvec4 vhs(vec2 uv) {\n vec2 tcoord = uv;\n tcoord.x += sin(time*noise(uv));\n return texture2D( uMainSampler, tcoord)*vhsStrength;\t\n}\n\n// Vignette\nfloat vig(vec2 uv) {\n uv *= 1. - uv;\n return ( pow(uv.x*uv.y*vignette.x*10.,vignette.y) );\n}\n\n// Chromatic abberation\nvec3 chromatic(vec2 uv, float offset) {\n float r = texture2D( uMainSampler, vec2(uv.x+offset, uv.y)).r;\n float g = texture2D( uMainSampler, uv).g;\n float b = texture2D( uMainSampler, vec2(uv.x-offset, uv.y)).b;\n return vec3(r,g,b);\n}\n\n// Bloom\nvec4 blur(vec2 uv) {\n float total = 0.;\n float rad = 1.;\n mat2 ang = mat2(.73736882209777832,-.67549037933349609,.67549037933349609,.73736882209777832);\n vec2 point = normalize(fract(cos(uv*mat2(195,174,286,183))*742.)-.5)*(bloom.x/sqrt(SAMPLES));\n vec4 amount = vec4(0);\n\t\n for ( float i=0.; i .5 ) {\n mainUv = crtCurve(outTexCoord);\n }\n\t\n // Base coloring\n vec4 color = texture2D( uMainSampler, mainUv);\n\t\n // Chromatic abberation\n if ( chromaticEnable > .5 ) {\n color.rgb *= chromatic(mainUv, chabIntensity * 0.01);\n }\n\t\n // Scanlines\n if ( scanlinesEnable > .5 ) {\n color.rgb *= (1.-scanStrength)+(sin(mainUv.y*1024.)*scanStrength);\n }\n\n // Bloom\n if ( bloomEnable > .5 ) {\n color.rgb += blur(mainUv).rgb;\n }\n\t\n // Noise\n if ( noiseEnable > .5 ) {\n color.rgb += noise(mainUv)*noiseStrength;\n }\n\t\n // VHS\n if ( vhsEnable > .5 ) {\n color += vhs(mainUv);\n }\n\t\n // Vignette\n if ( vignetteEnable > .5) {\n color.rgb *= vig(mainUv);\n }\n\t\n // Cutoff edges\n if ( crtEnable > .5) {\n if ( (mainUv.x < 0.)|| (mainUv.y < 0.) || (mainUv.x > 1.)|| (mainUv.y > 1.) ) {\n color.rgb *= 0.;\n }\n }\n\t\n gl_FragColor = color;\n}\n", - }), - (this.now = 0), - (this.bloomEnable = !1), - (this.bloomRadius = 0), - (this.bloomIntensity = 0), - (this.bloomThreshold = 0), - (this.bloomTexelWidth = 0), - (this.bloomTexelHeight = 0), - (this.chromaticEnable = !1), - (this.chabIntensity = 0), - (this.vignetteEnable = !1), - (this.vignetteStrength = 0), - (this.vignetteIntensity = 0), - (this.noiseEnable = !1), - (this.noiseStrength = 0), - (this.noiseSeed = Math.random()), - (this.vhsEnable = !1), - (this.vhsStrength = 0), - (this.scanlinesEnable = !1), - (this.scanStrength = 0), - (this.crtEnable = !1), - (this.crtWidth = 0), - (this.crtHeight = 0); - } - resetFromJSON(t) { - var e = _(t, "enable", !1); - return ( - this.setBloomEnable(_(t, "bloomEnable", e)), - this.setBloomRadius(_(t, "bloomRadius", 0)), - this.setBloomIntensity(_(t, "bloomIntensity", 0)), - this.setBloomThreshold(_(t, "bloomThreshold", 0)), - this.setBloomTexelSize( - _(t, "bloomTexelWidth", 0), - _(t, "bloomTexelHeight") - ), - this.setChromaticEnable(_(t, "chromaticEnable", e)), - this.setChabIntensity(_(t, "chabIntensity", 0)), - this.setVignetteEnable(_(t, "vignetteEnable", e)), - this.setVignetteStrength(_(t, "vignetteStrength", 0)), - this.setVignetteIntensity(_(t, "vignetteIntensity", 0)), - this.setNoiseEnable(_(t, "noiseEnable", e)), - this.setNoiseStrength(_(t, "noiseStrength", 0)), - this.setNoiseSeed(_(0, "noiseSeed", Math.random())), - this.setVHSEnable(_(t, "vhsEnable", e)), - this.setVhsStrength(_(t, "vhsStrength", 0)), - this.setScanlinesEnable(_(t, "scanlinesEnable", e)), - this.setScanStrength(_(t, "scanStrength", 0)), - this.setCRTEnable(_(t, "crtEnable", e)), - this.setCrtSize(_(t, "crtWidth", 0), _(t, "crtHeight", void 0)), - this - ); - } - onPreRender() { - var t, e; - this.set1f("noiseSeed", this.noiseSeed), - this.set1f("bloomEnable", this.bloomEnable ? 1 : 0), - this.set3f( - "bloom", - this.bloomRadius, - this.bloomIntensity, - this.bloomThreshold - ), - this.set2f("bloomTexel", this.bloomTexelWidth, this.bloomTexelHeight), - this.set1f("chromaticEnable", this.chromaticEnable ? 1 : 0), - this.set1f("chabIntensity", this.chabIntensity), - this.set1f("vignetteEnable", this.vignetteEnable ? 1 : 0), - this.set2f("vignette", this.vignetteStrength, this.vignetteIntensity), - this.set1f("noiseEnable", this.noiseEnable ? 1 : 0), - this.set1f("noiseStrength", this.noiseStrength), - this.set1f("vhsEnable", this.vhsEnable ? 1 : 0), - this.set1f("vhsStrength", this.vhsStrength), - this.set1f("scanlinesEnable", this.scanlinesEnable ? 1 : 0), - this.set1f("scanStrength", this.scanStrength), - this.set1f("crtEnable", this.crtEnable ? 1 : 0), - this.set2f("crtSize", this.crtWidth, this.crtHeight), - this.vhsEnable && - (this.now += - ((t = this.game), - ((e = t), - null == e || "object" != typeof e - ? null - : D(e) - ? e - : D(e.game) - ? e.game - : L(e) - ? e.sys.game - : L(e.scene) - ? e.scene.sys.game - : void 0).loop.delta)), - this.set1f("time", this.now); - } -} -Object.assign(N.prototype, C); -class F extends Phaser.Scene { - constructor() { - super({ key: "game" }), - (this.player = null), - (this.score = 0), - (this.scoreText = null); - } - init(t) { - (this.name = t.name), (this.number = t.number); - } - create() { - (this.backgroundColors = [ - 11411474, 9837584, 5247498, 4198922, 3150346, 3084810, 0, - ]), - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.cameras.main.setBackgroundColor(this.backgroundColors[this.number]), - this.addLight(), - this.createMap(), - (this.smokeLayer = this.add.layer()), - this.addPlayer(), - this.addOxygen(), - this.cameras.main.startFollow(this.player, !0, 0.05, 0.05, 0, 0), - this.loadAudios(), - this.addEffects(), - this.playMusic(); - } - addOxygen() { - this.oxygenBar = this.add - .rectangle(this.center_width, 40, 1.8 * this.player.oxygen, 20, 7017483) - .setOrigin(0.5) - .setScrollFactor(0); - } - addEffects() { - this.cameras.main.setPostPipeline(N); - } - addDay() { - this.dayText = this.add - .bitmapText(20, 10, "pico", "Day " + (this.number + 1), 20) - .setTint(7017483) - .setOrigin(0) - .setScrollFactor(0) - .setDropShadow(0, 2, 7024682, 0.9); - } - addLight() { - this.lights.disable(), - this.lights.setAmbientColor(11411474), - (this.playerLight = this.lights - .addLight(0, 100, 100) - .setColor(16777215) - .setIntensity(3)); - } - createMap() { - (this.tileMap = this.make.tilemap({ - key: "scene" + this.number, - tileWidth: 64, - tileHeight: 64, - })), - (this.tileSetBg = this.tileMap.addTilesetImage("mars")), - (this.tileSet = this.tileMap.addTilesetImage("mars")), - (this.platform = this.tileMap.createLayer( - "scene" + this.number, - this.tileSet - )), - (this.border = this.tileMap.createLayer("border", this.tileSet)), - (this.objectsLayer = this.tileMap.getObjectLayer("objects")), - this.border.setCollisionByExclusion([-1]), - this.platform.setCollisionByExclusion([-1]), - (this.holes = this.add.group()), - (this.foes = this.add.group()), - (this.objects = this.add.group()), - this.createGrid(), - this.addObjects(); - } - addObjects() { - this.objectsLayer.objects.forEach((t) => { - if (t.name.startsWith("object")) { - const [e, s, i, n] = t.name.split(":"); - this.objects.add(new p(this, t.x, t.y, s, i, n)); - } - t.name.startsWith("drone") && - this.foes.add(new E(this, t.x, t.y, this.grid)); - }); - } - createGrid() { - (this.grid = []), - Array(40) - .fill(0) - .forEach((t, e) => { - (this.grid[e] = []), - Array(40) - .fill(0) - .forEach((t, s) => { - let i = this.platform.getTileAt(Math.floor(s), Math.floor(e)), - n = this.border.getTileAt(Math.floor(s), Math.floor(e)); - this.grid[e][s] = i || n ? 1 : 0; - }); - }); - } - addPlayer() { - this.trailLayer = this.add.layer(); - const t = this.objectsLayer.objects.find((t) => "player" === t.name); - (this.player = new d(this, t.x, t.y)), - this.physics.add.collider( - this.player, - this.platform, - this.hitFloor, - () => !0, - this - ), - this.physics.add.overlap( - this.player, - this.objects, - this.touchObject, - () => !0, - this - ), - this.physics.add.overlap( - this.player, - this.foes, - this.playerHitByFoe, - () => !0, - this - ), - this.physics.add.overlap( - this.player, - this.holes, - this.playerHitHole, - () => !0, - this - ); - } - hitFloor(t, e) {} - touchObject(t, e) { - "hole" === e.type && this.playTracker(), - e.activated || ((e.activated = !0), e.touch()); - } - playerHitByFoe(t, e) { - this.cameras.main.shake(100), - this.playAudio("killed"), - t.death(), - this.restartScene(); - } - playerHitHole(t, e) { - t.dead || - (this.playAudio("holeshout"), - e.setAlpha(1), - t.setAlpha(0), - this.cameras.main.shake(50), - t.death(), - this.restartScene()); - } - loadAudios() { - (this.audios = { - mars_background: this.sound.add("mars_background"), - step: this.sound.add("step"), - kill: this.sound.add("kill"), - blip: this.sound.add("blip"), - ohmygod: this.sound.add("ohmygod"), - holeshout: this.sound.add("holeshout"), - oxygen: this.sound.add("oxygen"), - shock: this.sound.add("shock"), - killed: this.sound.add("killed"), - }), - (this.tracker = this.sound.add("tracker")); - } - playTracker() { - this.tracker.isPlaying || this.tracker.play(); - } - playRandomStatic() { - const t = - this.number < 6 ? "static" + Phaser.Math.Between(0, 3) : "creepy_static"; - this.sound - .add(t) - .play({ - rate: Phaser.Math.Between(9, 11) / 10, - delay: 0, - volume: Phaser.Math.Between(5, 10) / 10, - }); - } - playAudio(t) { - this.audios[t].play(); - } - playRandom(t, e = 1) { - this.audios[t].play({ - rate: Phaser.Math.Between(0.9, 1), - detune: Phaser.Math.Between(-500, 500), - delay: 0, - volume: e, - }); - } - playOfficer() { - this.sound.add(`officer${this.number}`).play(); - } - playMusic() { - const t = this.number < 6 ? "mars_background" : "cave"; - (this.theme = this.sound.add(t)), - this.theme.stop(), - this.theme.play({ - mute: !1, - volume: 1.5, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }), - this.sound - .add("creepy") - .play({ - mute: !1, - volume: 1, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }), - (this.breathing = this.sound.add("breath")), - this.breath(0.2); - } - breath(t = 0.2, e = 0.4) { - const s = Phaser.Math.Between(500, 1e3); - this.tweens.add({ - targets: this.breathing, - volume: 0, - duration: s, - onComplete: () => { - this.breathing.play({ rate: t, volume: e }); - }, - }); - } - restartScene() { - const t = this.cameras.main.worldView.centerX, - e = this.cameras.main.worldView.centerY; - (this.fadeBlack = this.add - .rectangle(t - 100, e - 50, 1e4, 11e3, 0) - .setOrigin(0.5)), - (this.failure = this.add - .bitmapText(t, e, "pico", "FAILURE", 40) - .setTint(7017483) - .setOrigin(0.5) - .setDropShadow(0, 2, 7024682, 0.9)), - this.tweens.add({ - targets: [this.failure, this.fadeBlack], - alpha: { from: 0, to: 1 }, - duration: 2e3, - }), - this.time.delayedCall( - 3e3, - () => { - this.sound.stopAll(), - this.scene.start("transition", { number: this.number }); - }, - null, - this - ); - } - finishScene(t = !0) { - const e = this.cameras.main.worldView.centerX, - s = this.cameras.main.worldView.centerY; - (this.fadeBlack = this.add - .rectangle(e - 100, s - 50, 2e3, 2e3, 0) - .setOrigin(0.5)), - this.tweens.add({ - targets: [this.fadeBlack], - alpha: { from: 0, to: 1 }, - duration: 3e3, - }), - (this.player.dead = !0), - this.player.body.stop(), - this.mute && this.sound.add("blip").play(), - this.time.delayedCall( - 3e3, - () => { - this.mute && this.sound.stopAll(), - this.scene.start("transition", { - next: "underwater", - name: "STAGE", - number: this.number + 1, - }); - }, - null, - this - ); - } - updateOxygen() { - this.oxygenBar.width = 1.8 * this.player.oxygen; - } - skipThis() { - (this.player.dead = !0), - this.player.body.stop(), - this.theme.stop(), - this.scene.start("transition", { number: this.number + 1 }); - } -} -const G = { - width: 800, - height: 800, - scale: { mode: s.Scale.FIT, autoCenter: s.Scale.CENTER_BOTH }, - autoRound: !1, - parent: "game-container", - physics: { default: "arcade", arcade: { gravity: { y: 300 }, debug: !1 } }, - scene: [i, o, r, F, a], -}; -new s.Game(G); diff --git a/mars/dist/assets/index-DXyQYrwv.js b/mars/dist/assets/index-DXyQYrwv.js new file mode 100644 index 00000000..b1b25ae8 --- /dev/null +++ b/mars/dist/assets/index-DXyQYrwv.js @@ -0,0 +1 @@ +import{c as t,g as e,P as s}from"./phaser-X8YdoW2c.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const s of t)if("childList"===s.type)for(const t of s.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();class i extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.setLoadEvents(),this.loadFonts(),this.loadImages(),this.loadMaps(),this.loadAudios(),this.loadSpritesheets(),this.setRegistry()}setLoadEvents(){this.load.on("progress",(function(t){this.progressBar.clear(),this.progressBar.fillStyle(11411474,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*t,16)}),this),this.load.on("complete",(()=>{this.scene.start("splash")}),this)}loadFonts(){this.load.bitmapFont("pico","assets/fonts/pico.png","assets/fonts/pico.xml")}loadImages(){this.load.image("body","assets/images/body.png"),this.load.image("landscape","assets/images/landscape.png"),this.load.image("record","assets/images/record.png"),this.load.image("hole","assets/images/hole.png"),this.load.image("pello","assets/images/pello_ok.png"),this.load.image("mars","assets/maps/mars64.png"),this.load.image("background","assets/maps/mars.png")}loadMaps(){Array(7).fill(0).forEach(((t,e)=>{this.load.tilemapTiledJSON(`scene${e}`,`assets/maps/scene${e}.json`)}))}loadAudios(){this.load.audio("mars_background","assets/sounds/mars_background.mp3"),this.load.audio("step","assets/sounds/step.mp3"),this.load.audio("creepy","assets/sounds/creepy.mp3"),this.load.audio("heartbeat","assets/sounds/heartbeat.mp3"),this.load.audio("breath","assets/sounds/breath.mp3"),this.load.audio("blip","assets/sounds/blip.mp3"),this.load.audio("ohmygod","assets/sounds/ohmygod.mp3"),this.load.audio("kill","assets/sounds/kill.mp3"),this.load.audio("tracker","assets/sounds/tracker.mp3"),this.load.audio("holeshout","assets/sounds/holeshout.mp3"),this.load.audio("oxygen","assets/sounds/oxygen.mp3"),this.load.audio("monster","assets/sounds/monster.mp3"),this.load.audio("killed","assets/sounds/killed.mp3"),this.load.audio("creepy_static","assets/sounds/creepy_static.mp3"),this.load.audio("shock","assets/sounds/shock.mp3"),this.load.audio("cave","assets/sounds/cave.mp3"),this.load.audio("type","assets/sounds/type.mp3"),Array(4).fill(0).forEach(((t,e)=>{this.load.audio(`static${e}`,`assets/sounds/static${e}.mp3`)})),Array(6).fill(0).forEach(((t,e)=>{this.load.audio(`diary${e+1}`,`assets/sounds/diary/diary${e+1}.mp3`)})),Array(6).fill(0).forEach(((t,e)=>{this.load.audio(`officer${e+1}`,`assets/sounds/officer/officer${e+1}.mp3`)}))}loadSpritesheets(){this.load.spritesheet("player","assets/images/player.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("debris","assets/images/debris.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("step","assets/images/step.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("wave","assets/images/wave.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("drone","assets/images/drone.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("monster","assets/images/monster.png",{frameWidth:128,frameHeight:64})}setRegistry(){this.registry.set("score",0)}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(7017483,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class n extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="step"){super(t,e,s,"step",Phaser.Math.Between(0,3)),t.add.existing(this),this.setOrigin(0),t.tweens.add({targets:[this],duration:2e3,alpha:{from:1,to:.1}})}}class a extends Phaser.GameObjects.Sprite{constructor(t,e,s,i=100){super(t,e,s,"player"),this.setOrigin(0),this.setScale(1),this.scene.add.existing(this),this.scene.physics.add.existing(this),this.body.setAllowGravity(!1),this.dead=!1,this.init(),this.shells=0,this.lastDirection=0,this.steps=0,this.stepDelta=0,this.moveDelta=0,this.rate=.2,this.previousRate=.2,this.oxygen=i,this.locked=!1}init(){this.addControls(),this.scene.events.on("update",this.update,this)}addControls(){this.cursor=this.scene.input.keyboard.createCursorKeys(),this.W=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W),this.A=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.A),this.S=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S),this.D=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.D)}update(t,e){if(!this.dead&&!this.locked){if(this.stepDelta+=e,this.moveDelta+=e,(Phaser.Input.Keyboard.JustDown(this.W)||Phaser.Input.Keyboard.JustDown(this.cursor.up))&&this.canMoveUp()){this.moveDelta=0;const{x:t,y:e}=this;this.locked=!0,this.scene.tweens.add({targets:this,y:"-=64",duration:200,onComplete:()=>{this.locked=!1}}),this.step(t,e)}else if((Phaser.Input.Keyboard.JustDown(this.D)||Phaser.Input.Keyboard.JustDown(this.cursor.right))&&this.canMoveRight()){this.moveDelta=0;const{x:t,y:e}=this;this.locked=!0,this.scene.tweens.add({targets:this,x:"+=64",duration:200,onComplete:()=>{this.locked=!1}}),this.step(t,e)}else if((Phaser.Input.Keyboard.JustDown(this.A)||Phaser.Input.Keyboard.JustDown(this.cursor.left))&&this.canMoveLeft()){this.moveDelta=0;const{x:t,y:e}=this;this.locked=!0,this.scene.tweens.add({targets:this,x:"-=64",duration:200,onComplete:()=>{this.locked=!1}}),this.step(t,e)}else if((Phaser.Input.Keyboard.JustDown(this.S)||Phaser.Input.Keyboard.JustDown(this.cursor.down))&&this.canMoveDown()){this.moveDelta=0;const{x:t,y:e}=this;this.locked=!0,this.scene.tweens.add({targets:this,y:"+=64",duration:200,onComplete:()=>{this.locked=!1}}),this.step(t,e)}this.adaptBreath()}}canMoveUp(){return!this.scene.platform.getTileAtWorldXY(this.x,this.y-1)&&this.moveDelta>200}canMoveRight(){return!this.scene.platform.getTileAtWorldXY(this.x+64,this.y)&&this.moveDelta>200}canMoveDown(){return!this.scene.platform.getTileAtWorldXY(this.x,this.y+64)&&this.moveDelta>200}canMoveLeft(){return!this.scene.platform.getTileAtWorldXY(this.x-1,this.y)&&this.moveDelta>200}step(t,e){this.steps++,this.scene.smokeLayer.add(new n(this.scene,t,e)),this.scene.playRandom("step",1)}adaptBreath(){this.stepDelta>2e3&&(this.steps>2?(this.previousRate=this.rate,this.rate=this.steps<11?this.steps/10:1,this.scene.breath(this.rate),this.updateOxygen(this.steps+Math.round(this.steps/2))):this.rate!==this.previousRate?(this.previousRate=this.rate,this.rate=this.rate>.2?this.rate-.1:.2,this.scene.breath(this.rate),this.scene.updateOxygen(this.steps)):this.scene.updateOxygen(this.steps),this.steps=this.stepDelta=0)}updateOxygen(t){t>=this.oxygen?(this.oxygen=0,this.death()):this.oxygen-=t,this.scene.updateOxygen()}death(){this.dead=!0,this.body.stop(),this.body.enable=!1,this.scene.restartScene()}}class h extends Phaser.GameObjects.Sprite{constructor(t,e,s){super(t,e,s,"hole"),this.name="hole",this.setOrigin(0),this.setAlpha(0),t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1)}}class o extends Phaser.GameObjects.Sprite{constructor(t,e,s){super(t,e,s,"body"),this.name="body",this.setOrigin(0),this.rotation=1.6,t.add.existing(this)}}let r=class extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i,n,a=""){super(t,e,s,192,192),this.setOrigin(0),this.type=i,this.description=n,this.extra=a,t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1),this.activated=!1}touch(){switch(this.type){case"note":this.showNote(this.description);break;case"radio":this.useRadio();break;case"exit":this.exitScene();break;case"hole":this.activateHole();break;case"oxygen":this.useOxygen();break;case"braun":this.activateBraun();break;case"ending":this.revealEnding()}}showNote(t){const e=this.scene.add.bitmapText(this.x,this.y,"pico",t,15);this.scene.tweens.add({targets:e,alpha:{from:1,to:0},duration:6e3,ease:"Sine",onComplete:()=>{e.destroy()}})}showExit(t){const e=this.scene.add.bitmapText(this.x-128,this.y-64,"pico",t,25);this.scene.tweens.add({targets:e,alpha:{from:.8,to:1},duration:100,repeat:5})}useRadio(){this.officerAudio=this.scene.sound.add(this.description),this.officerAudio.play(),this.officerAudio.on("complete",function(){this.scene.playRandomStatic(),this.extra&&this.scene.sound.add(this.extra).play()}.bind(this))}exitScene(){this.showExit(this.description),this.showNote(this.extra),this.scene.finishScene()}useOxygen(){this.showNote("Oxygen supplies!"),this.scene.player.oxygen=100,this.scene.updateOxygen(),this.scene.playAudio("oxygen")}revealEnding(){const t=this.scene.sound.add("ohmygod");t.play(),this.scene.cameras.main.shake(1e4),this.showExit(this.description),this.scene.sound.add("monster").play({volume:1.5,rate:.8});const e=this.scene.add.sprite(this.x+128,this.y+128,"monster").setOrigin(.5);this.scene.anims.create({key:"monster",frames:this.scene.anims.generateFrameNumbers("monster",{start:0,end:5}),frameRate:3}),e.anims.play("monster",!0),t.on("complete",function(){this.scene.breathing.pause(),this.scene.playAudio("holeshout"),this.scene.finishScene(!1)}.bind(this))}activateHole(){this.scene.holes.add(new h(this.scene,this.x+64,this.y+64))}activateBraun(){this.showExit(this.description),this.scene.playAudio("shock"),new o(this.scene,this.x+128,this.y+64)}};var l,d={exports:{}};l=d,function(){var t,e,s,i,n,a,h,o,r,d,c,u,p,m,y;s=Math.floor,d=Math.min,e=function(t,e){return te?1:0},r=function(t,i,n,a,h){var o;if(null==n&&(n=0),null==h&&(h=e),n<0)throw new Error("lo must be non-negative");for(null==a&&(a=t.length);ni;0<=i?e++:e--)l.push(e);return l}.apply(this).reverse()).length;ay;0<=y?++u:--u)g.push(n(t,a));return g},m=function(t,s,i,n){var a,h,o;for(null==n&&(n=e),a=t[i];i>s&&n(a,h=t[o=i-1>>1])<0;)t[i]=h,i=o;return t[i]=a},y=function(t,s,i){var n,a,h,o,r;for(null==i&&(i=e),a=t.length,r=s,h=t[s],n=2*s+1;nt[0].length-1||i>t.length-1||a>t[0].length-1||h>t.length-1)throw new Error("Your start or end point is outside the scope of your grid.");if(e!==a||i!==h){for(var l=t[h][a],c=!1,p=0;p0&&v(h,o,0,-1,1*w(o.x,o.y-1)),o.x0&&v(h,o,-1,0,1*w(o.x-1,o.y)),b&&(o.x>0&&o.y>0&&(l||x(t,s,o.x,o.y-1,o)&&x(t,s,o.x-1,o.y,o))&&v(h,o,-1,-1,i*w(o.x-1,o.y-1)),o.x0&&(l||x(t,s,o.x,o.y-1,o)&&x(t,s,o.x+1,o.y,o))&&v(h,o,1,-1,i*w(o.x+1,o.y-1)),o.x>0&&o.y{this.scene.playAudio("kill"),this.launchMove()}),null,this)}launchMove(){this.scene&&(this.delayedMove=this.scene.time.addEvent({delay:2e3,callback:this.move.bind(this),startAt:0,callbackScope:this,loop:!0}))}move(){try{if(!this.scene.player)return;this.moveTimeline&&this.moveTimeline.destroy(),this.easystar.findPath(Math.floor(this.x/64),Math.floor(this.y/64),Math.floor(this.scene.player.x/64),Math.floor(this.scene.player.y/64),this.moveIt.bind(this)),this.easystar.setIterationsPerCalculation(1e4),this.easystar.enableSync(),this.easystar.calculate()}catch(t){console.log("Cant move yet: ",t)}}moveIt(t){if(null===t)console.log("hello sneaky pete");else{let e=[];this.i=0,this.path=t;for(let s=0;s{this.delayedMove.remove(),this.alpha>0&&!this.scene.player.dead&&this.launchMove()}})}}}const v={setBloomEnable(t){return void 0===t&&(t=!0),this.bloomEnable=t,this},setBloomRadius(t){return this.bloomRadius=t,this},setBloomIntensity(t){return this.bloomIntensity=t,this},setBloomThreshold(t){return this.bloomThreshold=t,this},setBloomTexelSize(t,e){return void 0===e&&(e=t),this.bloomTexelWidth=t,this.bloomTexelHeight=e,this}},x={setChromaticEnable(t){return void 0===t&&(t=!0),this.chromaticEnable=t,this},setChabIntensity(t){return this.chabIntensity=t,this}},S={setVignetteEnable(t){return void 0===t&&(t=!0),this.vignetteEnable=t,this},setVignetteStrength(t){return this.vignetteStrength=t,this},setVignetteIntensity(t){return this.vignetteIntensity=t,this}},w={setNoiseEnable(t){return void 0===t&&(t=!0),this.noiseEnable=t,this},setNoiseStrength(t){return this.noiseStrength=t,this},setNoiseSeed(t){return this.noiseSeed=t,this}},E={setVHSEnable(t){return void 0===t&&(t=!0),this.vhsEnable=t,this},setVhsStrength(t){return this.vhsStrength=t,this}},T={setScanlinesEnable(t){return void 0===t&&(t=!0),this.scanlinesEnable=t,this},setScanStrength(t){return this.scanStrength=t,this}},k={setCRTEnable(t){return void 0===t&&(t=!0),this.crtEnable=t,this},setCrtSize(t,e){return void 0===e&&(e=t),this.crtWidth=t,this.crtHeight=e,this}};var A={setEnable:function(t){return void 0===t&&(t=!0),this.bloomEnable=t,this.chromaticEnable=t,this.vignetteEnable=t,this.noiseEnable=t,this.vhsEnable=t,this.scanlinesEnable=t,this.crtEnable=t,this}};Object.assign(A,v,x,S,w,E,T,k);const O=Phaser.Game;var M=function(t){return t instanceof O};const P=Phaser.Scene;var I=function(t){return t instanceof P};const C=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,B=Phaser.Utils.Objects.GetValue;class D extends C{constructor(t){super({name:"rexHorrifiPostFx",game:t,renderTarget:!0,fragShader:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n\nuniform float time;\n\n// Scene buffer\nuniform sampler2D uMainSampler; \nvarying vec2 outTexCoord;\n\n// Effect parameters\n#define SAMPLES 32.\n\n// Bloom\nuniform float bloomEnable;\nuniform vec3 bloom;\nuniform vec2 bloomTexel;\n\n// Chromatic abberation\nuniform float chromaticEnable;\nuniform float chabIntensity;\n\n// Vignette\nuniform float vignetteEnable;\nuniform vec2 vignette;\n\n// Noise\nuniform float noiseEnable;\nuniform float noiseStrength;\nuniform float noiseSeed;\n\n// VHS\nuniform float vhsEnable;\nuniform float vhsStrength;\n\n// Scanlines\nuniform float scanlinesEnable;\nuniform float scanStrength;\n\n// CRT\nuniform float crtEnable;\nuniform vec2 crtSize;\n\n\n// Noise\nfloat noise(vec2 uv) {\n return fract(sin(uv.x*12.9898+uv.y*78.233)*437.585453*noiseSeed);\n}\n\n// VHS\nvec4 vhs(vec2 uv) {\n vec2 tcoord = uv;\n tcoord.x += sin(time*noise(uv));\n return texture2D( uMainSampler, tcoord)*vhsStrength;\t\n}\n\n// Vignette\nfloat vig(vec2 uv) {\n uv *= 1. - uv;\n return ( pow(uv.x*uv.y*vignette.x*10.,vignette.y) );\n}\n\n// Chromatic abberation\nvec3 chromatic(vec2 uv, float offset) {\n float r = texture2D( uMainSampler, vec2(uv.x+offset, uv.y)).r;\n float g = texture2D( uMainSampler, uv).g;\n float b = texture2D( uMainSampler, vec2(uv.x-offset, uv.y)).b;\n return vec3(r,g,b);\n}\n\n// Bloom\nvec4 blur(vec2 uv) {\n float total = 0.;\n float rad = 1.;\n mat2 ang = mat2(.73736882209777832,-.67549037933349609,.67549037933349609,.73736882209777832);\n vec2 point = normalize(fract(cos(uv*mat2(195,174,286,183))*742.)-.5)*(bloom.x/sqrt(SAMPLES));\n vec4 amount = vec4(0);\n\t\n for ( float i=0.; i .5 ) {\n mainUv = crtCurve(outTexCoord);\n }\n\t\n // Base coloring\n vec4 color = texture2D( uMainSampler, mainUv);\n\t\n // Chromatic abberation\n if ( chromaticEnable > .5 ) {\n color.rgb *= chromatic(mainUv, chabIntensity * 0.01);\n }\n\t\n // Scanlines\n if ( scanlinesEnable > .5 ) {\n color.rgb *= (1.-scanStrength)+(sin(mainUv.y*1024.)*scanStrength);\n }\n\n // Bloom\n if ( bloomEnable > .5 ) {\n color.rgb += blur(mainUv).rgb;\n }\n\t\n // Noise\n if ( noiseEnable > .5 ) {\n color.rgb += noise(mainUv)*noiseStrength;\n }\n\t\n // VHS\n if ( vhsEnable > .5 ) {\n color += vhs(mainUv);\n }\n\t\n // Vignette\n if ( vignetteEnable > .5) {\n color.rgb *= vig(mainUv);\n }\n\t\n // Cutoff edges\n if ( crtEnable > .5) {\n if ( (mainUv.x < 0.)|| (mainUv.y < 0.) || (mainUv.x > 1.)|| (mainUv.y > 1.) ) {\n color.rgb *= 0.;\n }\n }\n\t\n gl_FragColor = color;\n}\n"}),this.now=0,this.bloomEnable=!1,this.bloomRadius=0,this.bloomIntensity=0,this.bloomThreshold=0,this.bloomTexelWidth=0,this.bloomTexelHeight=0,this.chromaticEnable=!1,this.chabIntensity=0,this.vignetteEnable=!1,this.vignetteStrength=0,this.vignetteIntensity=0,this.noiseEnable=!1,this.noiseStrength=0,this.noiseSeed=Math.random(),this.vhsEnable=!1,this.vhsStrength=0,this.scanlinesEnable=!1,this.scanStrength=0,this.crtEnable=!1,this.crtWidth=0,this.crtHeight=0}resetFromJSON(t){var e=B(t,"enable",!1);return this.setBloomEnable(B(t,"bloomEnable",e)),this.setBloomRadius(B(t,"bloomRadius",0)),this.setBloomIntensity(B(t,"bloomIntensity",0)),this.setBloomThreshold(B(t,"bloomThreshold",0)),this.setBloomTexelSize(B(t,"bloomTexelWidth",0),B(t,"bloomTexelHeight")),this.setChromaticEnable(B(t,"chromaticEnable",e)),this.setChabIntensity(B(t,"chabIntensity",0)),this.setVignetteEnable(B(t,"vignetteEnable",e)),this.setVignetteStrength(B(t,"vignetteStrength",0)),this.setVignetteIntensity(B(t,"vignetteIntensity",0)),this.setNoiseEnable(B(t,"noiseEnable",e)),this.setNoiseStrength(B(t,"noiseStrength",0)),this.setNoiseSeed(B(0,"noiseSeed",Math.random())),this.setVHSEnable(B(t,"vhsEnable",e)),this.setVhsStrength(B(t,"vhsStrength",0)),this.setScanlinesEnable(B(t,"scanlinesEnable",e)),this.setScanStrength(B(t,"scanStrength",0)),this.setCRTEnable(B(t,"crtEnable",e)),this.setCrtSize(B(t,"crtWidth",0),B(t,"crtHeight",void 0)),this}onPreRender(){var t,e;this.set1f("noiseSeed",this.noiseSeed),this.set1f("bloomEnable",this.bloomEnable?1:0),this.set3f("bloom",this.bloomRadius,this.bloomIntensity,this.bloomThreshold),this.set2f("bloomTexel",this.bloomTexelWidth,this.bloomTexelHeight),this.set1f("chromaticEnable",this.chromaticEnable?1:0),this.set1f("chabIntensity",this.chabIntensity),this.set1f("vignetteEnable",this.vignetteEnable?1:0),this.set2f("vignette",this.vignetteStrength,this.vignetteIntensity),this.set1f("noiseEnable",this.noiseEnable?1:0),this.set1f("noiseStrength",this.noiseStrength),this.set1f("vhsEnable",this.vhsEnable?1:0),this.set1f("vhsStrength",this.vhsStrength),this.set1f("scanlinesEnable",this.scanlinesEnable?1:0),this.set1f("scanStrength",this.scanStrength),this.set1f("crtEnable",this.crtEnable?1:0),this.set2f("crtSize",this.crtWidth,this.crtHeight),this.vhsEnable&&(this.now+=(t=this.game,(e=t,null==e||"object"!=typeof e?null:M(e)?e:M(e.game)?e.game:I(e)?e.sys.game:I(e.scene)?e.scene.sys.game:void 0).loop.delta)),this.set1f("time",this.now)}}Object.assign(D.prototype,A);class R extends Phaser.Scene{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null}init(t){this.name=t.name,this.number=t.number}create(){this.backgroundColors=[11411474,9837584,5247498,4198922,3150346,3084810,0],this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(this.backgroundColors[this.number]),this.addLight(),this.createMap(),this.smokeLayer=this.add.layer(),this.addPlayer(),this.addOxygen(),this.cameras.main.startFollow(this.player,!0,.05,.05,0,0),this.loadAudios(),this.addEffects(),this.playMusic()}addOxygen(){this.oxygenBar=this.add.rectangle(this.center_width,40,1.8*this.player.oxygen,20,7017483).setOrigin(.5).setScrollFactor(0)}addEffects(){this.cameras.main.setPostPipeline(D)}addDay(){this.dayText=this.add.bitmapText(20,10,"pico","Day "+(this.number+1),20).setTint(7017483).setOrigin(0).setScrollFactor(0).setDropShadow(0,2,7024682,.9)}addLight(){this.lights.disable(),this.lights.setAmbientColor(11411474),this.playerLight=this.lights.addLight(0,100,100).setColor(16777215).setIntensity(3)}createMap(){this.tileMap=this.make.tilemap({key:"scene"+this.number,tileWidth:64,tileHeight:64}),this.tileSetBg=this.tileMap.addTilesetImage("mars"),this.tileSet=this.tileMap.addTilesetImage("mars"),this.platform=this.tileMap.createLayer("scene"+this.number,this.tileSet),this.border=this.tileMap.createLayer("border",this.tileSet),this.objectsLayer=this.tileMap.getObjectLayer("objects"),this.border.setCollisionByExclusion([-1]),this.platform.setCollisionByExclusion([-1]),this.holes=this.add.group(),this.foes=this.add.group(),this.objects=this.add.group(),this.createGrid(),this.addObjects()}addObjects(){this.objectsLayer.objects.forEach((t=>{if(t.name.startsWith("object")){const[e,s,i,n]=t.name.split(":");this.objects.add(new r(this,t.x,t.y,s,i,n))}t.name.startsWith("drone")&&this.foes.add(new b(this,t.x,t.y,this.grid))}))}createGrid(){this.grid=[],Array(40).fill(0).forEach(((t,e)=>{this.grid[e]=[],Array(40).fill(0).forEach(((t,s)=>{let i=this.platform.getTileAt(Math.floor(s),Math.floor(e)),n=this.border.getTileAt(Math.floor(s),Math.floor(e));this.grid[e][s]=i||n?1:0}))}))}addPlayer(){this.trailLayer=this.add.layer();const t=this.objectsLayer.objects.find((t=>"player"===t.name));this.player=new a(this,t.x,t.y),this.physics.add.collider(this.player,this.platform,this.hitFloor,(()=>!0),this),this.physics.add.overlap(this.player,this.objects,this.touchObject,(()=>!0),this),this.physics.add.overlap(this.player,this.foes,this.playerHitByFoe,(()=>!0),this),this.physics.add.overlap(this.player,this.holes,this.playerHitHole,(()=>!0),this)}hitFloor(t,e){}touchObject(t,e){"hole"===e.type&&this.playTracker(),e.activated||(e.activated=!0,e.touch())}playerHitByFoe(t,e){this.cameras.main.shake(100),this.playAudio("killed"),t.death(),this.restartScene()}playerHitHole(t,e){t.dead||(this.playAudio("holeshout"),e.setAlpha(1),t.setAlpha(0),this.cameras.main.shake(50),t.death(),this.restartScene())}loadAudios(){this.audios={mars_background:this.sound.add("mars_background"),step:this.sound.add("step"),kill:this.sound.add("kill"),blip:this.sound.add("blip"),ohmygod:this.sound.add("ohmygod"),holeshout:this.sound.add("holeshout"),oxygen:this.sound.add("oxygen"),shock:this.sound.add("shock"),killed:this.sound.add("killed")},this.tracker=this.sound.add("tracker")}playTracker(){this.tracker.isPlaying||this.tracker.play()}playRandomStatic(){const t=this.number<6?"static"+Phaser.Math.Between(0,3):"creepy_static";this.sound.add(t).play({rate:Phaser.Math.Between(9,11)/10,delay:0,volume:Phaser.Math.Between(5,10)/10})}playAudio(t){this.audios[t].play()}playRandom(t,e=1){this.audios[t].play({rate:Phaser.Math.Between(.9,1),detune:Phaser.Math.Between(-500,500),delay:0,volume:e})}playOfficer(){this.sound.add(`officer${this.number}`).play()}playMusic(){const t=this.number<6?"mars_background":"cave";this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:1.5,rate:1,detune:0,seek:0,loop:!0,delay:0}),this.sound.add("creepy").play({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!0,delay:0}),this.breathing=this.sound.add("breath"),this.breath(.2)}breath(t=.2,e=.4){const s=Phaser.Math.Between(500,1e3);this.tweens.add({targets:this.breathing,volume:0,duration:s,onComplete:()=>{this.breathing.play({rate:t,volume:e})}})}restartScene(){const t=this.cameras.main.worldView.centerX,e=this.cameras.main.worldView.centerY;this.fadeBlack=this.add.rectangle(t-100,e-50,1e4,11e3,0).setOrigin(.5),this.failure=this.add.bitmapText(t,e,"pico","FAILURE",40).setTint(7017483).setOrigin(.5).setDropShadow(0,2,7024682,.9),this.tweens.add({targets:[this.failure,this.fadeBlack],alpha:{from:0,to:1},duration:2e3}),this.time.delayedCall(3e3,(()=>{this.sound.stopAll(),this.scene.start("transition",{number:this.number})}),null,this)}finishScene(t=!0){const e=this.cameras.main.worldView.centerX,s=this.cameras.main.worldView.centerY;this.fadeBlack=this.add.rectangle(e-100,s-50,2e3,2e3,0).setOrigin(.5),this.tweens.add({targets:[this.fadeBlack],alpha:{from:0,to:1},duration:3e3}),this.player.dead=!0,this.player.body.stop(),this.mute&&this.sound.add("blip").play(),this.time.delayedCall(3e3,(()=>{this.mute&&this.sound.stopAll(),this.scene.start("transition",{next:"underwater",name:"STAGE",number:this.number+1})}),null,this)}updateOxygen(){this.oxygenBar.width=1.8*this.player.oxygen}skipThis(){this.player.dead=!0,this.player.body.stop(),this.theme.stop(),this.scene.start("transition",{number:this.number+1})}}class L{constructor(t){this.scene=t}typeText(t,e,s,i=150,n=450954,a=40){let h=[],o=0,r=0;t.split("").forEach(((t,l)=>{"\n"===t&&(o+=2,r=0),h.push(this.scene.add.bitmapText(s-350+25*r++,i+o*a,e,t,a).setTint(n).setAlpha(0))}));const l=this.scene.add.rectangle(s-335+25*r,i+25+o*a,25,5,n).setOrigin(.5).setAlpha(0),d=this.scene.add.timeline();return this.typeAudio=this.scene.sound.add("type"),h.forEach(((t,e)=>{d.add({at:0,tween:{targets:t,alpha:{from:0,to:.5},duration:100}})})),d.add({at:100,tween:{targets:l,alpha:{from:0,to:.8},duration:100,repeat:5,yoyo:!0,onStart:()=>{this.typeAudio.stop()}}}),this.typeAudio.play({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!0,delay:0}),d.play(),h.push(l),h}removeTyped(t){t.flat().forEach((t=>t.destroy()))}}class H extends Phaser.Scene{constructor(){super({key:"outro"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.introLayer=this.add.layer(),this.splashLayer=this.add.layer(),this.add.tileSprite(0,0,800,600,"landscape").setOrigin(0),this.utils=new L(this),this.title=this.add.bitmapText(this.center_width,this.center_height+100,"pico","MARSTRANDED",60).setTint(7017483).setAlpha(0).setDropShadow(0,4,7024682,.9).setOrigin(.5),this.tweens.add({targets:this.title,alpha:{from:0,to:1},duration:4e3}),this.input.keyboard.on("keydown-SPACE",this.startSplash,this),this.input.keyboard.on("keydown-ENTER",this.startSplash,this)}playMusic(t="mars_background"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:1.5,rate:1,detune:0,seek:0,loop:!0,delay:0})}startSplash(){this.sound.stopAll(),this.scene.start("splash")}}class _ extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i,n,a=16771755){super(t,e+=Phaser.Math.Between(-30,30),s+=Phaser.Math.Between(-30,30),Phaser.Math.Between(30,55),Phaser.Math.Between(30,55),a),t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setVelocityX(100*i),this.body.setVelocityY(100*n),this.init()}init(){this.scene.tweens.add({targets:this,duration:800,scale:{from:1,to:0},onComplete:()=>{this.destroy()}})}}class N extends Phaser.Scene{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(0),this.smokeLayer=this.add.layer(),this.showTitle(),this.time.delayedCall(1e3,(()=>this.showInstructions()),null,this),this.input.keyboard.on("keydown-SPACE",(()=>this.startGame()),this),this.playMusic()}showTitle(){this.step=this.sound.add("step"),"MARSTRANDED".split("").forEach(((t,e)=>{this.time.delayedCall(600*(e+1),(()=>{this.add.bitmapText(70*e+50,200,"pico",t,70).setTint(7017483).setOrigin(.5).setDropShadow(0,4,7024682,.9),Array(Phaser.Math.Between(2,4)).fill(0).forEach((t=>{this.smokeLayer.add(new _(this,70*e+80+Phaser.Math.Between(-30,30),200+Phaser.Math.Between(-30,30),0,-1,7024682))})),this.step.play({rate:.8}),this.step.resume()}),null,this)}))}startGame(){this.theme&&this.theme.stop(),this.sound.add("blip").play(),this.scene.start("transition",{next:"game",name:"STAGE",number:0,time:30})}playMusic(t="mars_background"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:2,rate:1,detune:0,seek:0,loop:!0,delay:0})}showInstructions(){this.add.bitmapText(this.center_width,450,"pico","WASD/Arrows",40).setTint(7017483).setOrigin(.5).setDropShadow(0,3,7024682,.9),this.add.sprite(this.center_width-140,355,"pello").setOrigin(.5).setScale(.5),this.add.bitmapText(this.center_width+60,350,"pico","By PELLO",35).setTint(7017483).setOrigin(.5).setDropShadow(0,3,7024682,.9),this.space=this.add.bitmapText(this.center_width,520,"pico","SPACE start",30).setTint(7017483).setOrigin(.5).setDropShadow(0,2,7024682,.9),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}}class F extends Phaser.Scene{constructor(){super({key:"transition"})}init(t){this.number=t.number}create(){this.missions=["","Go north, locate containers.","Find landing zone. North East.","Locate landing, South East.","Go East, locate containers.","Other landings: North East","Find out ship origin..."],this.utils=new L(this),this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.add.tileSprite(0,0,800,600,"landscape").setOrigin(0),7===this.number?this.scene.start("outro",{number:this.number}):this.sound.stopAll(),this.showInstructions(),this.input.keyboard.on("keydown-ENTER",(()=>this.loadNext()),this),this.input.keyboard.on("keydown-SPACE",(()=>this.loadNext()),this)}showInstructions(){const t=Array(8).fill(0).map(((t,e)=>`DAY ${e}`));this.text1=this.add.bitmapText(this.center_width,20,"pico",t[this.number],30).setOrigin(.5).setAlpha(0),this.text2=this.add.bitmapText(this.center_width,70,"pico","AUDIO RECORD OF CAPTAIN BRAUN",20).setOrigin(.5).setAlpha(0),this.number>0?this.showSceneInstructions():this.showFirstInstructions()}showSceneInstructions(){this.tweens.add({targets:[this.text1,this.text2,this.play],duration:1e3,alpha:{from:0,to:1},onComplete:()=>{this.playDiary()}})}showFirstInstructions(){this.playBackground(),this.text2=this.add.bitmapText(this.center_width,70,"pico","THE CRASH",20).setOrigin(.5).setAlpha(0),this.playCreepy(),this.tweens.add({targets:[this.text1],duration:2e3,alpha:{from:0,to:1},onComplete:()=>{this.playIntro()}})}playIntro(){this.utils.typeText("YOU JUST CRASHED ON MARS\nYOU ARE ALIVE BUT YOUR\nSHIP IS COMPLETELY LOST\nIF YOU WANT TO LIVE YOU\nMUST FIND LANDING REMAINS\nTRY GOING EAST...","pico",this.center_width,150,16777215,20)}playBackground(){this.theme=this.sound.add("mars_background"),this.theme.stop(),this.theme.play({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!0,delay:0})}playDiary(){this.wave=this.add.sprite(this.center_width,200,"wave").setOrigin(.5),this.anims.create({key:"wave",frames:this.anims.generateFrameNumbers("wave",{start:0,end:4}),frameRate:20,repeat:-1}),this.wave.anims.play("wave",!0),this.recording=this.sound.add(`diary${this.number}`),this.recording.on("complete",function(){this.wave.destroy(),this.showMission(),this.playCreepy()}.bind(this)),this.recording.play()}playCreepy(){this.creepy=this.sound.add("creepy"),this.creepy.play({mute:!1,volume:.9,rate:.9,detune:0,seek:0,loop:!0,delay:0})}showMission(){this.text3=this.add.bitmapText(this.center_width,300,"pico","MISSION OBJECTIVE:",30).setOrigin(.5),this.utils.typeText(this.missions[this.number],"pico",this.center_width,400,16777215,20)}loadNext(){this.sound.add("blip").play(),this.sound.stopAll(),this.scene.start("game",{number:this.number})}}const G={width:800,height:800,scale:{mode:s.Scale.FIT,autoCenter:s.Scale.CENTER_BOTH},autoRound:!1,parent:"game-container",physics:{default:"arcade",arcade:{gravity:{y:300},debug:!1}},scene:[i,N,F,R,H]};new s.Game(G); diff --git a/mars/dist/index.html b/mars/dist/index.html index 005b5d19..3bbf5197 100644 --- a/mars/dist/index.html +++ b/mars/dist/index.html @@ -4,7 +4,7 @@ - Phaser - Template + Phaser - Mars - + diff --git a/pushpull/dist/assets/index-D29MUjmQ.js b/pushpull/dist/assets/index-D29MUjmQ.js deleted file mode 100644 index 66c041a0..00000000 --- a/pushpull/dist/assets/index-D29MUjmQ.js +++ /dev/null @@ -1,782 +0,0 @@ -import { P as t } from "./phaser-CmFXOKba.js"; -!(function () { - const t = document.createElement("link").relList; - if (!(t && t.supports && t.supports("modulepreload"))) { - for (const t of document.querySelectorAll('link[rel="modulepreload"]')) - e(t); - new MutationObserver((t) => { - for (const s of t) - if ("childList" === s.type) - for (const t of s.addedNodes) - "LINK" === t.tagName && "modulepreload" === t.rel && e(t); - }).observe(document, { childList: !0, subtree: !0 }); - } - function e(t) { - if (t.ep) return; - t.ep = !0; - const e = (function (t) { - const e = {}; - return ( - t.integrity && (e.integrity = t.integrity), - t.referrerPolicy && (e.referrerPolicy = t.referrerPolicy), - "use-credentials" === t.crossOrigin - ? (e.credentials = "include") - : "anonymous" === t.crossOrigin - ? (e.credentials = "omit") - : (e.credentials = "same-origin"), - e - ); - })(t); - fetch(t.href, e); - } -})(); -class e extends Phaser.Scene { - constructor() { - super({ key: "bootloader" }); - } - preload() { - this.createBars(), - this.setLoadEvents(), - this.loadFonts(), - this.loadAudios(), - this.loadImages(), - this.loadSpritesheets(), - this.loadMaps(), - this.setRegistry(); - } - setLoadEvents() { - this.load.on( - "progress", - function (t) { - this.progressBar.clear(), - this.progressBar.fillStyle(10941206, 1), - this.progressBar.fillRect( - this.cameras.main.width / 4, - this.cameras.main.height / 2 - 16, - (this.cameras.main.width / 2) * t, - 16 - ); - }, - this - ), - this.load.on( - "complete", - () => { - this.scene.start("splash"); - }, - this - ); - } - loadFonts() { - this.load.bitmapFont( - "mario", - "assets/fonts/mario.png", - "assets/fonts/mario.xml" - ); - } - loadImages() { - this.load.image("pello", "assets/images/pello.png"), - this.load.image("background", "assets/images/background.png"), - this.load.image("tileset_fg", "assets/maps/tileset_fg.png"), - this.load.image("block_red", "assets/images/block_red.png"), - this.load.image("block_green", "assets/images/block_green.png"), - this.load.image("block_blue", "assets/images/block_blue.png"), - this.load.image("block_yellow", "assets/images/block_yellow.png"), - this.load.image("star", "assets/images/star.png"); - } - loadMaps() { - Array(9) - .fill(0) - .forEach((t, e) => { - this.load.tilemapTiledJSON(`scene${e}`, `assets/maps/scene${e}.json`); - }); - } - loadAudios() { - this.load.audio("music", "assets/sounds/music.mp3"), - this.load.audio("splash", "assets/sounds/splash.mp3"), - this.load.audio("win", "assets/sounds/win.mp3"), - this.load.audio("hover", "assets/sounds/hover.mp3"), - this.load.audio("select", "assets/sounds/select.mp3"), - this.load.audio("bump", "assets/sounds/bump.mp3"), - this.load.audio("move", "assets/sounds/move.mp3"); - } - loadSpritesheets() { - this.load.spritesheet("spider", "assets/images/spider.png", { - frameWidth: 32, - frameHeight: 32, - }), - this.load.spritesheet("heart", "assets/images/heart.png", { - frameWidth: 32, - frameHeight: 32, - }), - this.load.spritesheet("frog", "assets/images/frog.png", { - frameWidth: 32, - frameHeight: 48, - }), - this.load.spritesheet("frog2", "assets/images/frog2.png", { - frameWidth: 48, - frameHeight: 32, - }), - this.load.spritesheet("trail", "assets/images/trail.png", { - frameWidth: 32, - frameHeight: 32, - }), - this.load.spritesheet("block", "assets/images/block.png", { - frameWidth: 48, - frameHeight: 48, - }); - } - setRegistry() { - this.registry.set("score", 0), this.registry.set("moves", 0); - } - createBars() { - (this.loadBar = this.add.graphics()), - this.loadBar.fillStyle(16769126, 1), - this.loadBar.fillRect( - this.cameras.main.width / 4 - 2, - this.cameras.main.height / 2 - 18, - this.cameras.main.width / 2 + 4, - 20 - ), - (this.progressBar = this.add.graphics()); - } -} -class s extends Phaser.Scene { - constructor() { - super({ key: "outro" }); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - (this.introLayer = this.add.layer()), - this.cameras.main.setBackgroundColor(3970982), - (this.splashLayer = this.add.layer()), - this.showCount(), - this.addStartButton(), - this.input.keyboard.on("keydown-SPACE", this.startSplash, this), - this.input.keyboard.on("keydown-ENTER", this.startSplash, this); - } - showCount() { - (this.winText = this.add - .bitmapText( - this.center_width, - -100, - "mario", - "TOTAL MOVES: " + this.registry.get("moves"), - 30 - ) - .setOrigin(0.5) - .setTint(16769126) - .setDropShadow(2, 3, 7715143, 0.7)), - this.tweens.add({ - targets: this.winText, - duration: 500, - y: { from: this.winText.y, to: this.center_height }, - }), - this.tweens.add({ - targets: this.winText, - duration: 100, - scale: { from: 1, to: 1.1 }, - repeat: -1, - yoyo: !0, - }); - } - addStartButton() { - (this.startButton = this.add - .bitmapText(this.center_width, 500, "mario", "Click to start", 30) - .setOrigin(0.5) - .setTint(10113024) - .setDropShadow(2, 3, 6895104, 0.7)), - this.startButton.setInteractive(), - this.startButton.on("pointerdown", () => { - this.startSplash(); - }), - this.startButton.on("pointerover", () => { - this.startButton.setTint(4089973); - }), - this.startButton.on("pointerout", () => { - this.startButton.setTint(16777215); - }), - this.tweens.add({ - targets: this.space, - duration: 300, - alpha: { from: 0, to: 1 }, - repeat: -1, - yoyo: !0, - }); - } - startSplash() { - this.sound.stopAll(), this.scene.start("splash"); - } -} -class i extends Phaser.Scene { - constructor() { - super({ key: "splash" }); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - (this.background = this.add - .tileSprite(0, 0, 1024, 1024, "background") - .setOrigin(0)), - this.cameras.main.setBackgroundColor(3970982), - this.time.delayedCall(1e3, () => this.showInstructions(), null, this), - this.addStartButton(), - this.input.keyboard.on("keydown-SPACE", () => this.startGame(), this), - this.playMusic(), - this.showTitle(), - this.addStartButton(); - } - update() { - (this.background.tilePositionX += 1), (this.background.tilePositionY += 1); - } - startGame() { - this.theme && this.theme.stop(), - this.playGameMusic(), - this.scene.start("transition", { name: "STAGE", number: 0 }); - } - playGameMusic(t = "music") { - (this.theme = this.sound.add(t)), - this.theme.stop(), - this.theme.play({ - mute: !1, - volume: 0.2, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }); - } - showTitle() { - (this.gameLogo1 = this.add - .bitmapText(this.center_width - 1e3, 100, "mario", "Push", 120) - .setOrigin(0.5) - .setTint(16777215) - .setDropShadow(3, 4, 7715143, 0.7)), - (this.gameLogo2 = this.add - .bitmapText(this.center_width + 1e3, 220, "mario", "Pull", 120) - .setOrigin(0.5) - .setTint(16769126) - .setDropShadow(2, 3, 6895104, 0.7)), - this.titleTweens(); - } - titleTweens() { - this.tweens.add({ - targets: [this.gameLogo2], - duration: 1e3, - x: { from: this.gameLogo2.x, to: this.center_width }, - onComplete: () => { - this.tweens.add({ - targets: [this.gameLogo2], - duration: 1e3, - x: "-=20", - repeat: -1, - ease: "Linear", - }); - }, - }), - this.tweens.add({ - targets: [this.gameLogo1], - duration: 1e3, - x: { from: this.gameLogo1.x, to: this.center_width }, - onComplete: () => { - this.tweens.add({ - targets: [this.gameLogo1], - duration: 1e3, - x: "+=20", - repeat: -1, - ease: "Linear", - }); - }, - }); - } - playMusic(t = "splash") { - (this.theme = this.sound.add(t)), - this.theme.stop(), - this.theme.play({ - mute: !1, - volume: 0.5, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }); - } - addStartButton() { - (this.startButton = this.add - .bitmapText(this.center_width, 500, "mario", "start", 30) - .setOrigin(0.5) - .setTint(16769126) - .setDropShadow(2, 3, 6895104, 0.7)), - this.startButton.setInteractive(), - this.startButton.on("pointerdown", () => { - this.sound.add("move").play(), this.startGame(); - }), - this.startButton.on("pointerover", () => { - this.startButton.setTint(4089973); - }), - this.startButton.on("pointerout", () => { - this.startButton.setTint(16769126); - }), - this.tweens.add({ - targets: this.space, - duration: 300, - alpha: { from: 0, to: 1 }, - repeat: -1, - yoyo: !0, - }); - } - showInstructions() { - this.add - .sprite(this.center_width - 80, 400, "pello") - .setOrigin(0.5) - .setScale(0.5), - this.add - .bitmapText(this.center_width + 40, 400, "mario", "By PELLO", 15) - .setOrigin(0.5), - this.tweens.add({ - targets: this.space, - duration: 300, - alpha: { from: 0, to: 1 }, - repeat: -1, - yoyo: !0, - }); - } -} -class a extends Phaser.Scene { - constructor() { - super({ key: "transition" }); - } - init(t) { - (this.name = t.name), (this.number = t.number); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.cameras.main.setBackgroundColor(3970982), - 9 === this.number && - this.scene.start("outro", { name: this.name, number: this.number }), - this.add - .bitmapText( - this.center_width, - this.center_height - 20, - "mario", - [ - "Tutorial", - "Stage0", - "Stage1", - "Stage2", - "Stage3", - "Stage4", - "Stage5", - "Stage6", - "Stage7", - "Outro", - ][this.number], - 40 - ) - .setOrigin(0.5) - .setTint(10941206) - .setDropShadow(2, 3, 7715143, 0.7), - this.add - .bitmapText( - this.center_width, - this.center_height + 20, - "mario", - "Ready?", - 30 - ) - .setOrigin(0.5) - .setTint(10941206) - .setDropShadow(2, 3, 7715143, 0.7), - this.time.delayedCall(1e3, () => this.loadNext(), null, this); - } - loadNext() { - this.scene.start("game", { - name: this.name, - number: this.number, - limitedTime: 10 + 3 * this.number, - }); - } -} -class h extends Phaser.GameObjects.Sprite { - constructor(t, e, s, i = "block_blue", a = 100) { - super(t, e, s, i), this.setOrigin(0, 0), (this.scene = t), (this.name = i); - } -} -class r extends Phaser.GameObjects.Container { - constructor(t, e, s, i = 2, a = 3, h = "blue", r = 100) { - super(t, e, s), - (this.w = +i), - (this.h = +a), - (this.id = Math.random()), - (this.name = "block_" + h), - this.scene.add.existing(this), - this.scene.physics.add.existing(this), - (this.body.immovable = !0), - (this.active = !1), - this.setKeys(), - (this.defaultVelocity = r), - this.createBlock(), - (this.allowChangeDirection = !0), - this.scene.events.on("update", this.update, this), - this.setListeners(); - } - createBlock() { - this.body.setSize(32 * this.w, 32 * this.h); - for (let t = 0; t < this.w; t++) - for (let e = 0; e < this.h; e++) - this.add(new h(this.scene, 32 * t, 32 * e, this.name)); - } - setKeys() { - (this.cursor = this.scene.input.keyboard.createCursorKeys()), - (this.W = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.W - )), - (this.A = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.A - )), - (this.S = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.S - )), - (this.D = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.D - )), - this.scene.events.on("update", this.update, this); - } - setListeners() { - this.setInteractive( - new Phaser.Geom.Rectangle(0, 0, 64, 96), - Phaser.Geom.Rectangle.Contains - ), - this.on("pointerdown", (t) => { - this.scene.playAudio("select"), - this.iterate((t) => t.setTint(3170416)), - this.activate(); - }), - this.on("pointerover", () => { - this.scene.playAudio("hover"), this.iterate((t) => t.setTint(3170416)); - }), - this.on("pointerout", () => { - this.iterate((t) => t.clearTint()); - }); - } - activate() { - this.scene.activeBlock && this.scene.activeBlock.deactivate(), - (this.active = !0), - (this.scene.activeBlock = this); - } - deactivate() { - this.active = !1; - } - update() { - this.active && - ((Phaser.Input.Keyboard.JustUp(this.S) || - Phaser.Input.Keyboard.JustUp(this.cursor.down)) && - this.canMoveDown() - ? (this.leaveTrail(32 * this.w, 32), - (this.y += 32), - this.scene.updateMoves()) - : (Phaser.Input.Keyboard.JustUp(this.W) || - Phaser.Input.Keyboard.JustUp(this.cursor.up)) && - this.canMoveUp() - ? (this.leaveTrail(32 * this.w, 32, 0, 32 * (this.h - 1)), - (this.y -= 32), - this.scene.updateMoves()) - : (Phaser.Input.Keyboard.JustUp(this.D) || - Phaser.Input.Keyboard.JustUp(this.cursor.right)) && - this.canMoveRight() - ? (this.leaveTrail(32, 32 * this.h), - (this.x += 32), - this.scene.updateMoves()) - : (Phaser.Input.Keyboard.JustUp(this.A) || - Phaser.Input.Keyboard.JustUp(this.cursor.left)) && - this.canMoveLeft() && - (this.leaveTrail(32, 32 * this.h, 32 * (this.w - 1)), - (this.x -= 32), - this.scene.updateMoves())); - } - leaveTrail(t, e, s = 0, i = 0) { - this.scene.playAudio("move"); - const a = this.scene.add - .rectangle(this.x + s, this.y + i, t, e, 13421772) - .setOrigin(0); - this.scene.tweens.add({ - targets: [a], - duration: 300, - alpha: { from: 1, to: 0 }, - onComplete: () => { - a.destroy(); - }, - }); - } - isOverlap(t = 0, e = 0) { - return !this.scene.blocks.children.entries - .map((s) => { - if (s.id === this.id) return !1; - let i = this.getBounds(), - a = s.getBounds(); - return ( - (i.x += 1), - (i.y += 1), - (i.width = 32 * this.w - 2), - (i.height = 32 * this.h - 2), - (i.x += t), - (i.y += e), - Phaser.Geom.Intersects.RectangleToRectangle(i, a) - ); - }) - .every((t) => !t); - } - canMoveDown(t = 32) { - if (this.isOverlap(0, 1)) return this.scene.playAudio("bump"), !1; - t = 32 * this.h; - const e = Array(this.w) - .fill(0) - .map((e, s) => - this.scene.platform.getTileAtWorldXY(this.x + 32 * s, this.y + t) - ) - .every((t) => !t); - return e || this.scene.playAudio("bump"), e; - } - canMoveUp(t = 32) { - if (this.isOverlap(0, -1)) return this.scene.playAudio("bump"), !1; - const e = Array(this.w) - .fill(0) - .map((t, e) => - this.scene.platform.getTileAtWorldXY(this.x + 32 * e, this.y - 1) - ) - .every((t) => !t); - return e || this.scene.playAudio("bump"), e; - } - canMoveLeft(t = 32) { - if (this.isOverlap(-1, 0)) return this.scene.playAudio("bump"), !1; - const e = Array(this.h) - .fill(0) - .map((e, s) => - this.scene.platform.getTileAtWorldXY(this.x - t, this.y + 32 * s) - ) - .every((t) => !t); - return e || this.scene.playAudio("bump"), e; - } - canMoveRight(t = 32) { - if (this.isOverlap(1, 0)) return this.scene.playAudio("bump"), !1; - t = 32 * this.w; - const e = Array(this.h) - .fill(0) - .map((e, s) => - this.scene.platform.getTileAtWorldXY(this.x + t, this.y + 32 * s) - ) - .every((t) => !t); - return e || this.scene.playAudio("bump"), e; - } -} -class o extends Phaser.GameObjects.Sprite { - constructor(t, e, s, i = "star") { - super(t, e, s, "star"), - (this.name = i), - this.setOrigin(0.5), - this.setAlpha(0), - t.add.existing(this), - t.physics.add.existing(this), - this.body.setAllowGravity(!1); - } -} -class n extends Phaser.Scene { - constructor() { - super({ key: "game" }), - (this.player = null), - (this.score = 0), - (this.scoreText = null); - } - init(t) { - (this.name = t.name), - (this.number = t.number || 0), - (this.limitedTime = t.limitedTime || 10); - } - preload() {} - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.cameras.main.setBackgroundColor(0), - this.input.mouse.disableContextMenu(), - this.addPointer(), - this.addMap(), - this.addMoves(), - this.addRetry(), - this.loadAudios(), - this.showTexts(), - (this.solved = !1); - } - addRetry() { - this.R = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.R); - } - addMoves() { - (this.movesText = this.add - .bitmapText(this.center_width, 32, "mario", "0", 30) - .setOrigin(0.5) - .setTint(16769126) - .setDropShadow(3, 4, 7715143, 0.7)), - (this.totalMoves = 0); - } - addMap() { - (this.tileMap = this.make.tilemap({ - key: `scene${this.number}`, - tileWidth: 32, - tileHeight: 32, - })), - (this.tileSetBg = this.tileMap.addTilesetImage("tileset_fg")), - this.tileMap.createLayer("background", this.tileSetBg), - (this.tileSet = this.tileMap.addTilesetImage("tileset_fg")), - (this.platform = this.tileMap.createLayer( - `scene${this.number}`, - this.tileSet - )), - (this.objectsLayer = this.tileMap.getObjectLayer("objects")), - this.platform.setCollisionByExclusion([-1]), - this.physics.world.setBounds(0, 0, this.width, this.height), - (this.exits = this.add.group()), - (this.blocks = this.add.group()), - (this.texts = []), - this.addObjects(); - } - addObjects() { - this.objectsLayer.objects.forEach((t) => { - if (t.name.startsWith("block")) { - const [e, s, i, a] = t.name.split("_"); - (this.activeBlock = new r(this, t.x, t.y, s, i, a)), - this.blocks.add(this.activeBlock), - t.name.startsWith("block_1_1") && this.addPlayer(this.activeBlock); - } - t.name.startsWith("exit") && this.exits.add(new o(this, t.x - 16, t.y)); - }); - } - showTexts() { - this.number > 0 || - [ - "Select cubes", - "Pull/push them with WASD/Arrows", - "MOVE the red to exit", - ].forEach((t, e) => { - this.add - .bitmapText(this.center_width, 425 + 35 * e, "mario", t, 15) - .setOrigin(0.5) - .setTint(16769126) - .setDropShadow(1, 2, 12526882, 0.7); - }); - } - addPlayer(t) { - (this.player = t), - this.physics.add.overlap( - this.player, - this.exits, - this.hitExit, - () => !0, - this - ); - } - hitBlockBlock(t, e) {} - hitExit(t, e) { - (this.player.active = !1), e.destroy(), this.finishScene(); - } - addPointer() { - (this.pointer = this.input.activePointer), - this.input.mouse.disableContextMenu(); - } - loadAudios() { - this.audios = { - bump: this.sound.add("bump"), - hover: this.sound.add("hover"), - select: this.sound.add("select"), - move: this.sound.add("move"), - win: this.sound.add("win"), - }; - } - playAudio(t) { - this.audios[t].play(); - } - playRandom(t, e = 1) { - this.audios[t].play({ - rate: Phaser.Math.Between(1, 1.5), - detune: Phaser.Math.Between(-1e3, 1e3), - delay: 0, - volume: e, - }); - } - update() { - Phaser.Input.Keyboard.JustDown(this.R) && this.restartScene(); - } - finishScene() { - if (this.solved) return; - this.playAudio("win"), (this.solved = !0); - const t = +this.registry.get("moves") + this.totalMoves; - this.registry.set("moves", t), - (this.winText = this.add - .bitmapText(this.center_width, -100, "mario", "STAGE CLEARED!", 30) - .setOrigin(0.5) - .setTint(16769126) - .setDropShadow(2, 3, 7715143, 0.7)), - this.tweens.add({ - targets: this.winText, - duration: 500, - y: { from: this.winText.y, to: this.center_height }, - }), - this.tweens.add({ - targets: [this.winText, this.movesText], - duration: 100, - scale: { from: 1, to: 1.1 }, - repeat: -1, - yoyo: !0, - }), - this.time.delayedCall( - 2e3, - () => { - this.scene.start("transition", { - next: "underwater", - name: "STAGE", - number: this.number + 1, - }); - }, - null, - this - ); - } - restartScene() { - this.scene.start("game", { - next: "underwater", - name: "STAGE", - number: this.number, - }); - } - updateMoves() { - this.totalMoves++, - this.movesText.setText(this.totalMoves), - this.tweens.add({ - targets: [this.timerText], - duration: 200, - alpha: { from: 0.6, to: 1 }, - repeat: -1, - }); - } -} -const d = { - width: 608, - height: 608, - scale: { mode: t.Scale.FIT, autoCenter: t.Scale.CENTER_BOTH }, - autoRound: !1, - parent: "game-container", - physics: { default: "arcade", arcade: { gravity: { y: 0 }, debug: !1 } }, - plugins: {}, - scene: [e, i, a, n, s], -}; -new t.Game(d); diff --git a/pushpull/dist/assets/index-DV1PhKTq.js b/pushpull/dist/assets/index-DV1PhKTq.js new file mode 100644 index 00000000..57397273 --- /dev/null +++ b/pushpull/dist/assets/index-DV1PhKTq.js @@ -0,0 +1 @@ +import{P as t}from"./phaser-CmFXOKba.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const s of t)if("childList"===s.type)for(const t of s.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();class e extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.setLoadEvents(),this.loadFonts(),this.loadAudios(),this.loadImages(),this.loadSpritesheets(),this.loadMaps(),this.setRegistry()}setLoadEvents(){this.load.on("progress",(function(t){this.progressBar.clear(),this.progressBar.fillStyle(10941206,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*t,16)}),this),this.load.on("complete",(()=>{this.scene.start("splash")}),this)}loadFonts(){this.load.bitmapFont("mario","assets/fonts/mario.png","assets/fonts/mario.xml")}loadImages(){this.load.image("pello","assets/images/pello.png"),this.load.image("background","assets/images/background.png"),this.load.image("tileset_fg","assets/maps/tileset_fg.png"),this.load.image("block_red","assets/images/block_red.png"),this.load.image("block_green","assets/images/block_green.png"),this.load.image("block_blue","assets/images/block_blue.png"),this.load.image("block_yellow","assets/images/block_yellow.png"),this.load.image("star","assets/images/star.png")}loadMaps(){Array(9).fill(0).forEach(((t,e)=>{this.load.tilemapTiledJSON(`scene${e}`,`assets/maps/scene${e}.json`)}))}loadAudios(){this.load.audio("music","assets/sounds/music.mp3"),this.load.audio("splash","assets/sounds/splash.mp3"),this.load.audio("win","assets/sounds/win.mp3"),this.load.audio("hover","assets/sounds/hover.mp3"),this.load.audio("select","assets/sounds/select.mp3"),this.load.audio("bump","assets/sounds/bump.mp3"),this.load.audio("move","assets/sounds/move.mp3")}loadSpritesheets(){this.load.spritesheet("spider","assets/images/spider.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("heart","assets/images/heart.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("frog","assets/images/frog.png",{frameWidth:32,frameHeight:48}),this.load.spritesheet("frog2","assets/images/frog2.png",{frameWidth:48,frameHeight:32}),this.load.spritesheet("trail","assets/images/trail.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("block","assets/images/block.png",{frameWidth:48,frameHeight:48})}setRegistry(){this.registry.set("score",0),this.registry.set("moves",0)}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(16769126,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class s extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="block_blue",a=100){super(t,e,s,i),this.setOrigin(0,0),this.scene=t,this.name=i}}class i extends Phaser.GameObjects.Container{constructor(t,e,s,i=2,a=3,h="blue",r=100){super(t,e,s),this.w=+i,this.h=+a,this.id=Math.random(),this.name="block_"+h,this.scene.add.existing(this),this.scene.physics.add.existing(this),this.body.immovable=!0,this.active=!1,this.setKeys(),this.defaultVelocity=r,this.createBlock(),this.allowChangeDirection=!0,this.scene.events.on("update",this.update,this),this.setListeners()}createBlock(){this.body.setSize(32*this.w,32*this.h);for(let t=0;t{this.scene.playAudio("select"),this.iterate((t=>t.setTint(3170416))),this.activate()})),this.on("pointerover",(()=>{this.scene.playAudio("hover"),this.iterate((t=>t.setTint(3170416)))})),this.on("pointerout",(()=>{this.iterate((t=>t.clearTint()))}))}activate(){this.scene.activeBlock&&this.scene.activeBlock.deactivate(),this.active=!0,this.scene.activeBlock=this}deactivate(){this.active=!1}update(){this.active&&((Phaser.Input.Keyboard.JustUp(this.S)||Phaser.Input.Keyboard.JustUp(this.cursor.down))&&this.canMoveDown()?(this.leaveTrail(32*this.w,32),this.y+=32,this.scene.updateMoves()):(Phaser.Input.Keyboard.JustUp(this.W)||Phaser.Input.Keyboard.JustUp(this.cursor.up))&&this.canMoveUp()?(this.leaveTrail(32*this.w,32,0,32*(this.h-1)),this.y-=32,this.scene.updateMoves()):(Phaser.Input.Keyboard.JustUp(this.D)||Phaser.Input.Keyboard.JustUp(this.cursor.right))&&this.canMoveRight()?(this.leaveTrail(32,32*this.h),this.x+=32,this.scene.updateMoves()):(Phaser.Input.Keyboard.JustUp(this.A)||Phaser.Input.Keyboard.JustUp(this.cursor.left))&&this.canMoveLeft()&&(this.leaveTrail(32,32*this.h,32*(this.w-1)),this.x-=32,this.scene.updateMoves()))}leaveTrail(t,e,s=0,i=0){this.scene.playAudio("move");const a=this.scene.add.rectangle(this.x+s,this.y+i,t,e,13421772).setOrigin(0);this.scene.tweens.add({targets:[a],duration:300,alpha:{from:1,to:0},onComplete:()=>{a.destroy()}})}isOverlap(t=0,e=0){return!this.scene.blocks.children.entries.map((s=>{if(s.id===this.id)return!1;let i=this.getBounds(),a=s.getBounds();return i.x+=1,i.y+=1,i.width=32*this.w-2,i.height=32*this.h-2,i.x+=t,i.y+=e,Phaser.Geom.Intersects.RectangleToRectangle(i,a)})).every((t=>!t))}canMoveDown(t=32){if(this.isOverlap(0,1))return this.scene.playAudio("bump"),!1;t=32*this.h;const e=Array(this.w).fill(0).map(((e,s)=>this.scene.platform.getTileAtWorldXY(this.x+32*s,this.y+t))).every((t=>!t));return e||this.scene.playAudio("bump"),e}canMoveUp(t=32){if(this.isOverlap(0,-1))return this.scene.playAudio("bump"),!1;const e=Array(this.w).fill(0).map(((t,e)=>this.scene.platform.getTileAtWorldXY(this.x+32*e,this.y-1))).every((t=>!t));return e||this.scene.playAudio("bump"),e}canMoveLeft(t=32){if(this.isOverlap(-1,0))return this.scene.playAudio("bump"),!1;const e=Array(this.h).fill(0).map(((e,s)=>this.scene.platform.getTileAtWorldXY(this.x-t,this.y+32*s))).every((t=>!t));return e||this.scene.playAudio("bump"),e}canMoveRight(t=32){if(this.isOverlap(1,0))return this.scene.playAudio("bump"),!1;t=32*this.w;const e=Array(this.h).fill(0).map(((e,s)=>this.scene.platform.getTileAtWorldXY(this.x+t,this.y+32*s))).every((t=>!t));return e||this.scene.playAudio("bump"),e}}class a extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="star"){super(t,e,s,"star"),this.name=i,this.setOrigin(.5),this.setAlpha(0),t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1)}}class h extends Phaser.Scene{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null}init(t){this.name=t.name,this.number=t.number||0,this.limitedTime=t.limitedTime||10}preload(){}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(0),this.input.mouse.disableContextMenu(),this.addPointer(),this.addMap(),this.addMoves(),this.addRetry(),this.loadAudios(),this.showTexts(),this.solved=!1}addRetry(){this.R=this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.R)}addMoves(){this.movesText=this.add.bitmapText(this.center_width,32,"mario","0",30).setOrigin(.5).setTint(16769126).setDropShadow(3,4,7715143,.7),this.totalMoves=0}addMap(){this.tileMap=this.make.tilemap({key:`scene${this.number}`,tileWidth:32,tileHeight:32}),this.tileSetBg=this.tileMap.addTilesetImage("tileset_fg"),this.tileMap.createLayer("background",this.tileSetBg),this.tileSet=this.tileMap.addTilesetImage("tileset_fg"),this.platform=this.tileMap.createLayer(`scene${this.number}`,this.tileSet),this.objectsLayer=this.tileMap.getObjectLayer("objects"),this.platform.setCollisionByExclusion([-1]),this.physics.world.setBounds(0,0,this.width,this.height),this.exits=this.add.group(),this.blocks=this.add.group(),this.texts=[],this.addObjects()}addObjects(){this.objectsLayer.objects.forEach((t=>{if(t.name.startsWith("block")){const[e,s,a,h]=t.name.split("_");this.activeBlock=new i(this,t.x,t.y,s,a,h),this.blocks.add(this.activeBlock),t.name.startsWith("block_1_1")&&this.addPlayer(this.activeBlock)}t.name.startsWith("exit")&&this.exits.add(new a(this,t.x-16,t.y))}))}showTexts(){this.number>0||["Select cubes","Pull/push them with WASD/Arrows","MOVE the red to exit"].forEach(((t,e)=>{this.add.bitmapText(this.center_width,425+35*e,"mario",t,15).setOrigin(.5).setTint(16769126).setDropShadow(1,2,12526882,.7)}))}addPlayer(t){this.player=t,this.physics.add.overlap(this.player,this.exits,this.hitExit,(()=>!0),this)}hitBlockBlock(t,e){}hitExit(t,e){this.player.active=!1,e.destroy(),this.finishScene()}addPointer(){this.pointer=this.input.activePointer,this.input.mouse.disableContextMenu()}loadAudios(){this.audios={bump:this.sound.add("bump"),hover:this.sound.add("hover"),select:this.sound.add("select"),move:this.sound.add("move"),win:this.sound.add("win")}}playAudio(t){this.audios[t].play()}playRandom(t,e=1){this.audios[t].play({rate:Phaser.Math.Between(1,1.5),detune:Phaser.Math.Between(-1e3,1e3),delay:0,volume:e})}update(){Phaser.Input.Keyboard.JustDown(this.R)&&this.restartScene()}finishScene(){if(this.solved)return;this.playAudio("win"),this.solved=!0;const t=+this.registry.get("moves")+this.totalMoves;this.registry.set("moves",t),this.winText=this.add.bitmapText(this.center_width,-100,"mario","STAGE CLEARED!",30).setOrigin(.5).setTint(16769126).setDropShadow(2,3,7715143,.7),this.tweens.add({targets:this.winText,duration:500,y:{from:this.winText.y,to:this.center_height}}),this.tweens.add({targets:[this.winText,this.movesText],duration:100,scale:{from:1,to:1.1},repeat:-1,yoyo:!0}),this.time.delayedCall(2e3,(()=>{this.scene.start("transition",{next:"underwater",name:"STAGE",number:this.number+1})}),null,this)}restartScene(){this.scene.start("game",{next:"underwater",name:"STAGE",number:this.number})}updateMoves(){this.totalMoves++,this.movesText.setText(this.totalMoves),this.tweens.add({targets:[this.timerText],duration:200,alpha:{from:.6,to:1},repeat:-1})}}class r extends Phaser.Scene{constructor(){super({key:"outro"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.introLayer=this.add.layer(),this.cameras.main.setBackgroundColor(3970982),this.splashLayer=this.add.layer(),this.showCount(),this.addStartButton(),this.input.keyboard.on("keydown-SPACE",this.startSplash,this),this.input.keyboard.on("keydown-ENTER",this.startSplash,this)}showCount(){this.winText=this.add.bitmapText(this.center_width,-100,"mario","TOTAL MOVES: "+this.registry.get("moves"),30).setOrigin(.5).setTint(16769126).setDropShadow(2,3,7715143,.7),this.tweens.add({targets:this.winText,duration:500,y:{from:this.winText.y,to:this.center_height}}),this.tweens.add({targets:this.winText,duration:100,scale:{from:1,to:1.1},repeat:-1,yoyo:!0})}addStartButton(){this.startButton=this.add.bitmapText(this.center_width,500,"mario","Click to start",30).setOrigin(.5).setTint(10113024).setDropShadow(2,3,6895104,.7),this.startButton.setInteractive(),this.startButton.on("pointerdown",(()=>{this.startSplash()})),this.startButton.on("pointerover",(()=>{this.startButton.setTint(4089973)})),this.startButton.on("pointerout",(()=>{this.startButton.setTint(16777215)})),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}startSplash(){this.sound.stopAll(),this.scene.start("splash")}}class o extends Phaser.Scene{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.background=this.add.tileSprite(0,0,1024,1024,"background").setOrigin(0),this.cameras.main.setBackgroundColor(3970982),this.time.delayedCall(1e3,(()=>this.showInstructions()),null,this),this.addStartButton(),this.input.keyboard.on("keydown-SPACE",(()=>this.startGame()),this),this.playMusic(),this.showTitle(),this.addStartButton()}update(){this.background.tilePositionX+=1,this.background.tilePositionY+=1}startGame(){this.theme&&this.theme.stop(),this.playGameMusic(),this.scene.start("transition",{name:"STAGE",number:0})}playGameMusic(t="music"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.2,rate:1,detune:0,seek:0,loop:!0,delay:0})}showTitle(){this.gameLogo1=this.add.bitmapText(this.center_width-1e3,100,"mario","Push",120).setOrigin(.5).setTint(16777215).setDropShadow(3,4,7715143,.7),this.gameLogo2=this.add.bitmapText(this.center_width+1e3,220,"mario","Pull",120).setOrigin(.5).setTint(16769126).setDropShadow(2,3,6895104,.7),this.titleTweens()}titleTweens(){this.tweens.add({targets:[this.gameLogo2],duration:1e3,x:{from:this.gameLogo2.x,to:this.center_width},onComplete:()=>{this.tweens.add({targets:[this.gameLogo2],duration:1e3,x:"-=20",repeat:-1,ease:"Linear"})}}),this.tweens.add({targets:[this.gameLogo1],duration:1e3,x:{from:this.gameLogo1.x,to:this.center_width},onComplete:()=>{this.tweens.add({targets:[this.gameLogo1],duration:1e3,x:"+=20",repeat:-1,ease:"Linear"})}})}playMusic(t="splash"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:.5,rate:1,detune:0,seek:0,loop:!0,delay:0})}addStartButton(){this.startButton=this.add.bitmapText(this.center_width,500,"mario","start",30).setOrigin(.5).setTint(16769126).setDropShadow(2,3,6895104,.7),this.startButton.setInteractive(),this.startButton.on("pointerdown",(()=>{this.sound.add("move").play(),this.startGame()})),this.startButton.on("pointerover",(()=>{this.startButton.setTint(4089973)})),this.startButton.on("pointerout",(()=>{this.startButton.setTint(16769126)})),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}showInstructions(){this.add.sprite(this.center_width-80,400,"pello").setOrigin(.5).setScale(.5),this.add.bitmapText(this.center_width+40,400,"mario","By PELLO",15).setOrigin(.5),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}}class n extends Phaser.Scene{constructor(){super({key:"transition"})}init(t){this.name=t.name,this.number=t.number}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(3970982),9===this.number&&this.scene.start("outro",{name:this.name,number:this.number}),this.add.bitmapText(this.center_width,this.center_height-20,"mario",["Tutorial","Stage0","Stage1","Stage2","Stage3","Stage4","Stage5","Stage6","Stage7","Outro"][this.number],40).setOrigin(.5).setTint(10941206).setDropShadow(2,3,7715143,.7),this.add.bitmapText(this.center_width,this.center_height+20,"mario","Ready?",30).setOrigin(.5).setTint(10941206).setDropShadow(2,3,7715143,.7),this.time.delayedCall(1e3,(()=>this.loadNext()),null,this)}loadNext(){this.scene.start("game",{name:this.name,number:this.number,limitedTime:10+3*this.number})}}const d={width:608,height:608,scale:{mode:t.Scale.FIT,autoCenter:t.Scale.CENTER_BOTH},autoRound:!1,parent:"game-container",physics:{default:"arcade",arcade:{gravity:{y:0},debug:!1}},plugins:{},scene:[e,o,n,h,r]};new t.Game(d); diff --git a/pushpull/dist/index.html b/pushpull/dist/index.html index 69d1fbd8..fad1b84b 100644 --- a/pushpull/dist/index.html +++ b/pushpull/dist/index.html @@ -4,7 +4,7 @@ - Phaser - Template + Phaser - Pushpull - + diff --git a/runner/dist/index.html b/runner/dist/index.html index c679847a..a0f96785 100644 --- a/runner/dist/index.html +++ b/runner/dist/index.html @@ -5,7 +5,7 @@ - Phaser - Template + Phaser - Runner - + diff --git a/wallhammer/dist/assets/index-Du4WbNGK.js b/wallhammer/dist/assets/index-Du4WbNGK.js deleted file mode 100644 index 0349925a..00000000 --- a/wallhammer/dist/assets/index-Du4WbNGK.js +++ /dev/null @@ -1,1419 +0,0 @@ -import { P as t } from "./phaser-CmFXOKba.js"; -!(function () { - const t = document.createElement("link").relList; - if (!(t && t.supports && t.supports("modulepreload"))) { - for (const t of document.querySelectorAll('link[rel="modulepreload"]')) - e(t); - new MutationObserver((t) => { - for (const s of t) - if ("childList" === s.type) - for (const t of s.addedNodes) - "LINK" === t.tagName && "modulepreload" === t.rel && e(t); - }).observe(document, { childList: !0, subtree: !0 }); - } - function e(t) { - if (t.ep) return; - t.ep = !0; - const e = (function (t) { - const e = {}; - return ( - t.integrity && (e.integrity = t.integrity), - t.referrerPolicy && (e.referrerPolicy = t.referrerPolicy), - "use-credentials" === t.crossOrigin - ? (e.credentials = "include") - : "anonymous" === t.crossOrigin - ? (e.credentials = "omit") - : (e.credentials = "same-origin"), - e - ); - })(t); - fetch(t.href, e); - } -})(); -class e extends Phaser.Scene { - constructor() { - super({ key: "bootloader" }); - } - preload() { - this.createBars(), - this.load.on( - "progress", - function (t) { - this.progressBar.clear(), - this.progressBar.fillStyle(15767863, 1), - this.progressBar.fillRect( - this.cameras.main.width / 4, - this.cameras.main.height / 2 - 16, - (this.cameras.main.width / 2) * t, - 16 - ); - }, - this - ), - this.load.on( - "complete", - () => { - this.scene.start("splash"); - }, - this - ), - Array(5) - .fill(0) - .forEach((t, e) => { - this.load.audio(`music${e}`, `assets/sounds/music${e}.mp3`); - }), - this.load.image("pello", "assets/images/pello.png"), - this.load.image("landscape", "assets/images/landscape.png"), - this.load.audio("build", "assets/sounds/build.mp3"), - this.load.audio("coin", "assets/sounds/coin.mp3"), - this.load.audio("death", "assets/sounds/death.mp3"), - this.load.audio("jump", "assets/sounds/jump.mp3"), - this.load.audio("kill", "assets/sounds/kill.mp3"), - this.load.audio("land", "assets/sounds/land.mp3"), - this.load.audio("lunchbox", "assets/sounds/lunchbox.mp3"), - this.load.audio("prize", "assets/sounds/prize.mp3"), - this.load.audio("stone_fail", "assets/sounds/stone_fail.mp3"), - this.load.audio("stone", "assets/sounds/stone.mp3"), - this.load.audio("foedeath", "assets/sounds/foedeath.mp3"), - this.load.audio("stage", "assets/sounds/stage.mp3"), - this.load.audio("splash", "assets/sounds/splash.mp3"), - Array(2) - .fill(0) - .forEach((t, e) => { - this.load.image(`brick${e}`, `assets/images/brick${e}.png`); - }), - Array(5) - .fill(0) - .forEach((t, e) => { - this.load.image( - `platform${e + 2}`, - `assets/images/platform${e + 2}.png` - ); - }), - this.load.bitmapFont( - "pixelFont", - "assets/fonts/mario.png", - "assets/fonts/mario.xml" - ), - this.load.spritesheet("walt", "assets/images/walt.png", { - frameWidth: 64, - frameHeight: 64, - }), - Array(5) - .fill(0) - .forEach((t, e) => { - this.load.tilemapTiledJSON(`scene${e}`, `assets/maps/scene${e}.json`); - }), - this.load.image("softbricks", "assets/maps/softbricks.png"), - this.load.image("bricks", "assets/maps/bricks.png"), - this.load.image("background", "assets/maps/background.png"), - this.load.image("chain", "assets/images/chain.png"), - this.load.spritesheet("bat", "assets/images/bat.png", { - frameWidth: 32, - frameHeight: 32, - }), - this.load.spritesheet("zombie", "assets/images/zombie.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("coin", "assets/images/coin.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("lunchbox", "assets/images/lunchbox.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("hammer", "assets/images/hammer.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("speed", "assets/images/speed.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("boots", "assets/images/boots.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.spritesheet("star", "assets/images/star.png", { - frameWidth: 64, - frameHeight: 64, - }), - this.load.bitmapFont( - "hammerfont", - "assets/fonts/hammer.png", - "assets/fonts/hammer.xml" - ), - this.registry.set("score", 0), - this.registry.set("coins", 0); - } - createBars() { - (this.loadBar = this.add.graphics()), - this.loadBar.fillStyle(13264642, 1), - this.loadBar.fillRect( - this.cameras.main.width / 4 - 2, - this.cameras.main.height / 2 - 18, - this.cameras.main.width / 2 + 4, - 20 - ), - (this.progressBar = this.add.graphics()); - } -} -class s extends Phaser.Scene { - constructor() { - super({ key: "outro" }); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - (this.introLayer = this.add.layer()), - (this.splashLayer = this.add.layer()), - (this.text = [ - "You did it!!", - "Thanks to your building skills", - "and your mighty hammer,", - "you saved the earth.", - "Made in 3 days for Minijam", - "by Pello", - "", - "Press SPACE", - ]), - this.showHistory(), - this.input.keyboard.on("keydown-SPACE", this.startSplash, this), - this.input.keyboard.on("keydown-ENTER", this.startSplash, this); - } - startSplash() { - this.scene.start("splash"); - } - showHistory() { - this.text.forEach((t, e) => { - this.time.delayedCall( - 2e3 * (e + 1), - () => this.showLine(t, 70 * (e + 1)), - null, - this - ); - }); - } - showLine(t, e) { - let s = this.introLayer.add( - this.add - .bitmapText(this.center_width, e, "pixelFont", t, 25) - .setOrigin(0.5) - .setAlpha(0) - ); - this.tweens.add({ targets: s, duration: 2e3, alpha: 1 }); - } -} -Phaser.GameObjects.Rectangle, Phaser.GameObjects.Rectangle; -class i extends Phaser.GameObjects.Rectangle { - constructor(t, e, s, i, a, h = 16771755, r = !1) { - super( - t, - e, - s, - (i = i || Phaser.Math.Between(10, 25)), - (a = a || Phaser.Math.Between(10, 25)), - h - ), - t.add.existing(this), - t.physics.add.existing(this), - this.body.setAllowGravity(!1), - this.body.setVelocityX(Phaser.Math.Between(-20, 20)), - this.init(); - } - init() { - this.scene.tweens.add({ - targets: this, - duration: 800, - scale: { from: 1, to: 0 }, - onComplete: () => { - this.destroy(); - }, - }); - } -} -class a extends Phaser.GameObjects.Rectangle { - constructor(t, e, s, i = 11550208, a, h, r = !1) { - super( - t, - e, - s + 5, - (a = a || Phaser.Math.Between(15, 30)), - (h = h || Phaser.Math.Between(15, 30)), - i - ), - t.add.existing(this), - t.physics.add.existing(this), - this.body.setAllowGravity(!0), - this.body.setVelocityX(Phaser.Math.Between(-50, 50)), - this.body.setVelocityY(a * h); - } -} -class h extends Phaser.Scene { - constructor() { - super({ key: "splash" }); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.cameras.main.setBackgroundColor(0), - this.time.delayedCall(1e3, () => this.showInstructions(), null, this), - this.input.keyboard.on("keydown-SPACE", () => this.startGame(), this), - this.input.keyboard.on("keydown-ENTER", () => this.startGame(), this), - this.playMusic(), - this.showTitle(), - this.playAudioRandomly("stone"); - } - startGame() { - this.theme && this.theme.stop(), - this.scene.start("transition", { - next: "game", - name: "STAGE", - number: 0, - time: 30, - }); - } - showTitle() { - "WALL".split("").forEach((t, e) => { - this.time.delayedCall( - 200 * (e + 1), - () => { - this.playAudioRandomly("stone_fail"), - Phaser.Math.Between(0, 5) > 2 && this.playAudioRandomly("stone"); - let s = this.add - .bitmapText(130 * (e + 1) + 140, 200, "hammerfont", t, 170) - .setTint(13264642) - .setOrigin(0.5) - .setDropShadow(4, 6, 15767863, 0.9); - Array(Phaser.Math.Between(4, 6)) - .fill(0) - .forEach((t) => new a(this, s.x, s.y, 13264642)); - }, - null, - this - ); - }), - "HAMMER".split("").forEach((t, e) => { - this.time.delayedCall( - 200 * (e + 1) + 800, - () => { - this.playAudioRandomly("stone_fail"), - Phaser.Math.Between(0, 5) > 2 && this.playAudioRandomly("stone"); - let s = this.add - .bitmapText(130 * (e + 1), 350, "hammerfont", t, 170) - .setTint(13264642) - .setOrigin(0.5) - .setDropShadow(4, 6, 15767863, 0.9); - Array(Phaser.Math.Between(4, 6)) - .fill(0) - .forEach((t) => new a(this, s.x, s.y, 13264642)); - }, - null, - this - ); - }); - } - playAudioRandomly(t) { - const e = Phaser.Math.Between(0.8, 1); - this.sound.add(t).play({ volume: e, rate: 1 }); - } - playMusic(t = "splash") { - (this.theme = this.sound.add(t)), - this.theme.stop(), - this.theme.play({ - mute: !1, - volume: 1, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }); - } - showInstructions() { - this.add - .bitmapText(this.center_width, 450, "pixelFont", "WASD/Arrows: move", 30) - .setOrigin(0.5), - this.add - .bitmapText( - this.center_width, - 500, - "pixelFont", - "S/DOWN: BUILD WALL", - 30 - ) - .setOrigin(0.5), - this.add - .bitmapText(this.center_width, 550, "pixelFont", "SPACE: HAMMER", 30) - .setOrigin(0.5), - this.add - .sprite(this.center_width - 120, 620, "pello") - .setOrigin(0.5) - .setScale(0.3), - this.add - .bitmapText(this.center_width + 40, 620, "pixelFont", "By PELLO", 15) - .setOrigin(0.5), - (this.space = this.add - .bitmapText( - this.center_width, - 670, - "pixelFont", - "Press SPACE to start", - 30 - ) - .setOrigin(0.5)), - this.tweens.add({ - targets: this.space, - duration: 300, - alpha: { from: 0, to: 1 }, - repeat: -1, - yoyo: !0, - }); - } -} -class r extends Phaser.Scene { - constructor() { - super({ key: "transition" }); - } - init(t) { - (this.name = t.name), (this.number = t.number), (this.next = t.next); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - 5 === this.number && this.loadOutro(), - this.addScore(), - this.add.sprite(this.center_width, this.center_height - 170, "walt"), - this.add - .bitmapText( - this.center_width, - this.center_height - 20, - "pixelFont", - ["TUTORIAL", "STAGE 1", "STAGE 2", "STAGE 3", "STAGE 4"][this.number], - 40 - ) - .setOrigin(0.5), - this.add - .bitmapText( - this.center_width, - this.center_height + 20, - "pixelFont", - "Ready?", - 30 - ) - .setOrigin(0.5), - this.input.keyboard.on("keydown-ENTER", () => this.loadNext(), this), - this.input.keyboard.on("keydown-SPACE", () => this.loadNext(), this), - this.time.delayedCall( - 3e3, - () => { - this.loadNext(); - }, - null, - this - ); - } - loadNext() { - this.scene.start("game", { name: this.name, number: this.number }); - } - loadOutro() { - this.scene.start("outro", { name: this.name, number: this.number }); - } - addScore() { - (this.scoreCoins = this.add - .bitmapText( - this.center_width + 32, - this.center_height - 100, - "pixelFont", - "x" + this.registry.get("coins"), - 30 - ) - .setDropShadow(0, 4, 2236962, 0.9) - .setOrigin(0.5) - .setScrollFactor(0)), - (this.scoreCoinsLogo = this.add - .sprite(this.center_width - 32, this.center_height - 100, "coin") - .setScale(0.7) - .setOrigin(0.5) - .setScrollFactor(0)), - this.anims.create({ - key: "coinscore", - frames: this.anims.generateFrameNumbers("coin", { start: 0, end: 7 }), - frameRate: 8, - }), - this.scoreCoinsLogo.play({ key: "coinscore", repeat: -1 }); - } -} -class o extends Phaser.GameObjects.Rectangle { - constructor(t, e, s, i = 32, a = 32, h = "") { - super(t, e, s, i, a, 16777215), - (this.type = h), - (this.y = s), - t.add.existing(this), - t.physics.add.existing(this), - this.body.setAllowGravity(!1), - this.scene.tweens.add({ - targets: this, - duration: 300, - scale: { from: 1, to: 0 }, - onComplete: () => { - this.destroy(); - }, - }); - } -} -class n extends Phaser.GameObjects.Sprite { - constructor(t, e, s, i = "brick0") { - super(t, e, s, i), - (this.name = i), - this.scene.add.existing(this), - this.scene.physics.add.existing(this), - (this.body.immovable = !0), - (this.body.moves = !1), - this.scene.tweens.add({ - targets: this, - duration: 50, - x: { from: this.x, to: this.x + Phaser.Math.Between(-7, 7) }, - y: { from: this.y, to: this.y + Phaser.Math.Between(-7, 7) }, - repeat: 5, - }); - } -} -class d extends Phaser.GameObjects.Sprite { - constructor(t, e, s, i = 10) { - super(t, e, s, "walt"), - this.setOrigin(0.5), - this.scene.add.existing(this), - this.scene.physics.add.existing(this), - (this.cursor = this.scene.input.keyboard.createCursorKeys()), - (this.spaceBar = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.SPACE - )), - (this.down = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.DOWN - )), - (this.right = !0), - this.body.setGravityY(100), - this.body.setSize(48, 60), - this.init(), - (this.jumping = !1), - (this.building = !1), - (this.falling = !1), - (this.mjolnir = !1), - (this.walkVelocity = 200), - (this.jumpVelocity = -400), - (this.invincible = !1), - (this.health = i), - (this.dead = !1), - (this.W = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.W - )), - (this.A = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.A - )), - (this.S = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.S - )), - (this.D = this.scene.input.keyboard.addKey( - Phaser.Input.Keyboard.KeyCodes.D - )); - } - init() { - this.scene.anims.create({ - key: "startidle", - frames: this.scene.anims.generateFrameNumbers("walt", { - start: 0, - end: 1, - }), - frameRate: 3, - repeat: -1, - }), - this.scene.anims.create({ - key: "playeridle", - frames: this.scene.anims.generateFrameNumbers("walt", { - start: 2, - end: 3, - }), - frameRate: 3, - repeat: -1, - }), - this.scene.anims.create({ - key: "playerwalk", - frames: this.scene.anims.generateFrameNumbers("walt", { - start: 4, - end: 6, - }), - frameRate: 10, - repeat: -1, - }), - this.scene.anims.create({ - key: "playerjump", - frames: this.scene.anims.generateFrameNumbers("walt", { - start: 4, - end: 4, - }), - frameRate: 1, - }), - this.scene.anims.create({ - key: "playerhammer", - frames: this.scene.anims.generateFrameNumbers("walt", { - start: 7, - end: 8, - }), - frameRate: 10, - }), - this.scene.anims.create({ - key: "playerbuild", - frames: this.scene.anims.generateFrameNumbers("walt", { - start: 9, - end: 10, - }), - frameRate: 10, - repeat: 2, - }), - this.scene.anims.create({ - key: "playerdead", - frames: this.scene.anims.generateFrameNumbers("walt", { - start: 11, - end: 16, - }), - frameRate: 5, - }), - this.anims.play("startidle", !0), - this.on("animationcomplete", this.animationComplete, this); - } - update() { - this.dead || - (this.jumping && - this.body.velocity.y >= 0 && - (this.body.setGravityY(700), (this.falling = !0)), - (Phaser.Input.Keyboard.JustDown(this.cursor.up) || - Phaser.Input.Keyboard.JustDown(this.W)) && - this.body.blocked.down - ? ((this.building = !1), - this.body.setVelocityY(this.jumpVelocity), - this.body.setGravityY(400), - this.anims.play("playerjump", !0), - this.scene.playAudio("jump"), - (this.jumping = !0), - this.jumpSmoke()) - : this.cursor.right.isDown || this.D.isDown - ? ((this.building = !1), - this.body.blocked.down && this.anims.play("playerwalk", !0), - (this.right = !0), - (this.flipX = this.body.velocity.x < 0), - this.body.setVelocityX(this.walkVelocity)) - : this.cursor.left.isDown || this.A.isDown - ? ((this.building = !1), - this.body.blocked.down && this.anims.play("playerwalk", !0), - (this.right = !1), - (this.flipX = !0), - this.body.setVelocityX(-this.walkVelocity)) - : (this.body.blocked.down && - (this.jumping && - (this.scene.playAudio("land"), this.landSmoke()), - (this.jumping = !1), - (this.falling = !1), - this.building || this.anims.play("playeridle", !0)), - this.body.setVelocityX(0)), - Phaser.Input.Keyboard.JustDown(this.spaceBar) && this.hammerBlow(), - (Phaser.Input.Keyboard.JustDown(this.cursor.down) || - Phaser.Input.Keyboard.JustDown(this.S)) && - this.buildBlock()); - } - landSmoke() { - this.jumpSmoke(20); - } - jumpSmoke(t = 10, e) { - Array(Phaser.Math.Between(3, 6)) - .fill(0) - .forEach((s) => { - const a = e || Phaser.Math.Between(-1, 1) > 0 ? 1 : -1; - (e = e || Phaser.Math.Between(0, 20)), - new i(this.scene, this.x + a * e, this.y + t); - }); - } - buildBlock() { - (this.building = !0), - this.anims.play("playerbuild", !0), - this.scene.playAudio("build"); - const t = this.right ? 64 : -64, - e = -400 === this.jumpVelocity ? 0 : -128; - this.buildSmoke(32, t), - this.scene.bricks.add(new n(this.scene, this.x + t, this.y + e)); - } - buildSmoke(t = 10, e) { - Array(Phaser.Math.Between(8, 14)) - .fill(0) - .forEach((s) => { - const a = Phaser.Math.Between(-20, 20); - new i(this.scene, this.x + (e + a), this.y + t); - }); - } - hammerBlow() { - (this.building = !0), this.anims.play("playerhammer", !0); - const t = this.right ? 32 : -32, - e = this.mjolnir ? 128 : 32; - this.scene.blows.add(new o(this.scene, this.x + t, this.y, e, e)); - } - turn() { - this.right = !this.right; - } - animationComplete(t, e) { - "playerground" === t.key && this.anims.play("playeridle", !0), - ("playerhammer" !== t.key && "playerbuild" !== t.key) || - ((this.building = !1), - this.anims.play(this.jumping ? "playerjump" : "playeridle", !0)); - } - hit() { - this.health--, - this.anims.play("playerdead", !0), - (this.body.enable = !1), - 0 === this.health && this.die(); - } - die() { - (this.dead = !0), - this.anims.play("playerdead", !0), - (this.body.immovable = !0), - (this.body.moves = !1), - this.scene.restartScene(); - } - applyPrize(t) { - switch (t) { - case "speed": - (this.walkVelocity = 330), this.flashPlayer(); - break; - case "hammer": - (this.mjolnir = !0), this.flashPlayer(); - break; - case "boots": - (this.jumpVelocity = -600), this.flashPlayer(); - break; - case "coin": - this.scene.updateCoins(); - break; - case "star": - (this.invincible = !0), - this.scene.tweens.add({ - targets: this, - duration: 300, - alpha: { from: 0.7, to: 1 }, - repeat: -1, - }); - } - } - flashPlayer() { - this.scene.tweens.add({ - targets: this, - duration: 50, - scale: { from: 1.2, to: 1 }, - repeat: 10, - }); - } -} -class l extends Phaser.Physics.Arcade.Sprite { - constructor(t, e, s, i = "right") { - super(t, e, s, "bat"), - (this.name = "bat"), - this.scene.physics.add.existing(this), - this.scene.physics.world.enable(this), - this.body.setAllowGravity(!1), - this.scene.add.existing(this), - (this.direction = "right" === i ? 1 : -1), - this.init(); - } - init() { - this.scene.anims.create({ - key: this.name, - frames: this.scene.anims.generateFrameNumbers(this.name, { - start: 0, - end: 1, - }), - frameRate: 5, - repeat: -1, - }), - this.scene.anims.create({ - key: this.name + "death", - frames: this.scene.anims.generateFrameNumbers(this.name, { - start: 2, - end: 5, - }), - frameRate: 5, - }), - this.anims.play(this.name, !0), - this.body.setVelocityX(150 * this.direction), - (this.flipX = this.direction > 0), - this.on("animationcomplete", this.animationComplete, this); - } - update() {} - turn() { - (this.direction = -this.direction), - (this.flipX = this.direction > 0), - this.body.setVelocityX(150 * this.direction); - } - death() { - (this.dead = !0), - (this.body.enable = !1), - (this.body.rotation = 0), - this.anims.play(this.name + "death"); - } - animationComplete(t, e) { - t.key === this.name + "death" && this.destroy(); - } -} -class c extends Phaser.Physics.Arcade.Sprite { - constructor(t, e, s, i = "right") { - super(t, e, s, "zombie"), - (this.name = "zombie"), - (this.scene = t), - this.scene.physics.add.existing(this), - this.scene.physics.world.enable(this), - this.body.setAllowGravity(!0), - this.scene.add.existing(this), - (this.direction = "right" === i ? -1 : 1), - this.init(); - } - init() { - this.scene.anims.create({ - key: this.name, - frames: this.scene.anims.generateFrameNumbers(this.name, { - start: 0, - end: 2, - }), - frameRate: 5, - repeat: -1, - }), - this.scene.anims.create({ - key: this.name + "death", - frames: this.scene.anims.generateFrameNumbers(this.name, { - start: 3, - end: 5, - }), - frameRate: 5, - }), - this.anims.play(this.name, !0), - this.body.setVelocityX(100 * this.direction), - (this.flipX = this.direction < 0), - this.on("animationcomplete", this.animationComplete, this); - } - turn() { - (this.direction = -this.direction), - (this.flipX = this.direction < 0), - this.body.setVelocityX(100 * this.direction); - } - death() { - (this.dead = !0), - (this.body.enable = !1), - (this.body.rotation = 0), - this.anims.play(this.name + "death"); - } - animationComplete(t, e) { - t.key === this.name + "death" && this.destroy(); - } -} -class m extends Phaser.GameObjects.Rectangle { - constructor(t, e, s, i = 32, a = 32, h = "") { - super(t, e, s, i, a, 16777215), - (this.type = h), - this.setAlpha(0), - (this.x = e), - (this.y = s), - t.add.existing(this), - t.physics.add.existing(this), - (this.body.immovable = !0), - (this.body.moves = !1); - } - disable() { - (this.visible = !1), this.destroy(); - } - destroy() { - super.destroy(); - } -} -class p extends Phaser.GameObjects.Sprite { - constructor(t, e, s, i = "coin") { - super(t, e, s, i), - (this.name = i), - this.setScale(0.7), - this.setOrigin(0.5), - t.add.existing(this), - t.physics.add.existing(this), - (this.body.immovable = !0), - (this.body.moves = !1), - (this.disabled = !1), - this.init(); - } - init() { - this.scene.anims.create({ - key: this.name, - frames: this.scene.anims.generateFrameNumbers(this.name, { - start: 0, - end: 7, - }), - frameRate: 10, - repeat: -1, - }), - this.anims.play(this.name, !0), - this.scene.tweens.add({ - targets: this, - duration: 500, - y: this.y - 20, - repeat: -1, - yoyo: !0, - }); - } - pick() { - const { x: t, y: e } = this.scene.cameras.main.getWorldPoint( - this.scene.scoreCoinsLogo.x, - this.scene.scoreCoinsLogo.y - ); - (this.disabled = !0), - this.scene.tweens.add({ - targets: this, - duration: 500, - x: { from: this.x, to: t }, - y: { from: this.y, to: e }, - scale: { from: 0.7, to: 0.5 }, - onComplete: () => { - this.destroy(); - }, - }); - } -} -class y extends Phaser.GameObjects.Sprite { - constructor(t, e, s, i = "lunchbox") { - super(t, e, s, i), - (this.scene = t), - (this.name = i), - this.setScale(1), - this.setOrigin(0.5), - t.add.existing(this), - t.physics.add.existing(this), - (this.body.immovable = !0), - (this.body.moves = !1), - (this.disabled = !1), - this.init(); - } - init() { - this.scene.anims.create({ - key: this.name, - frames: this.scene.anims.generateFrameNumbers(this.name, { - start: 0, - end: 0, - }), - frameRate: 1, - }), - this.scene.anims.create({ - key: this.name + "opened", - frames: this.scene.anims.generateFrameNumbers(this.name, { - start: 1, - end: 1, - }), - frameRate: 1, - }), - this.anims.play(this.name, !0), - this.scene.tweens.add({ - targets: this, - duration: 500, - y: this.y - 20, - repeat: -1, - yoyo: !0, - }); - } - pick() { - this.anims.play(this.name + "opened", !0), - this.showPrize(), - (this.disabled = !0), - this.scene.time.delayedCall( - 1e3, - () => { - this.destroy(), this.prizeSprite.destroy(); - }, - null, - this - ); - } - showPrize() { - const t = Phaser.Math.RND.pick([ - "boots", - "hammer", - "coin", - "star", - "speed", - ]); - this.scene.player.applyPrize(t), - (this.prizeSprite = this.scene.add - .sprite(this.x, this.y, t) - .setOrigin(0.5) - .setScale(0.8)), - this.scene.tweens.add({ - targets: this.prizeSprite, - duration: 500, - y: { from: this.y, to: this.y - 64 }, - onComplete: () => { - this.scene.playAudio("prize"); - }, - }); - } -} -class u extends Phaser.GameObjects.Container { - constructor(t, e, s, i = 4, a = !1) { - super(t, e, s), - (this.x = e), - (this.y = s), - this.scene.add.existing(this), - this.scene.physics.add.existing(this), - this.body.setAllowGravity(!1), - this.body.setBounce(1), - this.body.setSize(64 * i, 64), - this.body.setOffset(-2, -2), - (this.body.immovable = !0), - (this.body.moves = !1), - (this.chain = new Phaser.GameObjects.Sprite( - this.scene, - 32 * i - 32, - -2048, - "chain" - ).setOrigin(0)), - this.add(this.chain), - (this.platform = new Phaser.GameObjects.Sprite( - this.scene, - 0, - 0, - "platform" + i - ).setOrigin(0)), - this.add(this.platform), - this.init(); - } - init() { - const t = Phaser.Math.Between(0, 7); - let e = this.x, - s = this.y; - switch (t) { - case 0: - e = Phaser.Math.Between(-50, 50); - break; - case 1: - s = Phaser.Math.Between(-50, 50); - break; - case 2: - (e = Phaser.Math.Between(-100, 100)), - (s = Phaser.Math.Between(-100, 100)); - } - this.scene.tweens.add({ - targets: this, - duration: Phaser.Math.Between(4e3, 6e3), - x: { from: this.x, to: e }, - y: { from: this.y, to: s }, - repeat: -1, - yoyo: !0, - }); - } -} -class b extends t.Scene { - constructor() { - super({ key: "game" }), - (this.player = null), - (this.score = 0), - (this.scoreText = null); - } - init(t) { - (this.name = t.name), (this.number = t.number); - } - preload() {} - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.cameras.main.setBackgroundColor(6464191), - this.add.tileSprite(0, 1e3, 10240, 512, "landscape").setOrigin(0.5), - this.createMap(), - this.cameras.main.setBounds(0, 0, 41840, 40160), - this.physics.world.setBounds(0, 0, 41840, 40160), - this.addPlayer(), - this.cameras.main.startFollow(this.player, !0, 0.05, 0.05, 0, 240), - this.physics.world.enable([this.player]), - this.addScore(), - this.loadAudios(), - this.playMusic(); - } - addScore() { - (this.scoreCoins = this.add - .bitmapText(75, 10, "pixelFont", "x0", 30) - .setDropShadow(0, 4, 2236962, 0.9) - .setOrigin(0) - .setScrollFactor(0)), - (this.scoreCoinsLogo = this.add - .sprite(50, 25, "coin") - .setScale(1) - .setOrigin(0.5) - .setScrollFactor(0)), - this.anims.create({ - key: "coinscore", - frames: this.anims.generateFrameNumbers("coin", { start: 0, end: 7 }), - frameRate: 8, - }), - this.scoreCoinsLogo.play({ key: "coinscore", repeat: -1 }); - } - createMap() { - (this.tileMap = this.make.tilemap({ - key: "scene" + this.number, - tileWidth: 64, - tileHeight: 64, - })), - (this.tileSetBg = this.tileMap.addTilesetImage("background")), - console.log(this.tileMap), - this.tileMap.createLayer("background", this.tileSetBg), - (this.tileSet = this.tileMap.addTilesetImage("softbricks")), - (this.platform = this.tileMap.createLayer( - "scene" + this.number, - this.tileSet - )), - (this.objectsLayer = this.tileMap.getObjectLayer("objects")), - this.platform.setCollisionByExclusion([-1]), - (this.batGroup = this.add.group()), - (this.zombieGroup = this.add.group()), - (this.foesGroup = this.add.group()), - (this.turnGroup = this.add.group()), - (this.exitGroup = this.add.group()), - (this.platformGroup = this.add.group()), - (this.lunchBoxGroup = this.add.group()), - (this.bricks = this.add.group()), - this.addsObjects(), - this.addColliders(); - } - addsObjects() { - this.objectsLayer.objects.forEach((t) => { - if ("bat" === t.name) { - let e = new l(this, t.x, t.y, t.type); - this.batGroup.add(e), this.foesGroup.add(e); - } - if ("zombie" === t.name) { - let e = new c(this, t.x, t.y, t.type); - this.zombieGroup.add(e), this.foesGroup.add(e); - } - "platform" === t.name && - this.platformGroup.add(new u(this, t.x, t.y, t.type)), - "turn" === t.name && this.turnGroup.add(new m(this, t.x, t.y)), - "lunchbox" === t.name && this.lunchBoxGroup.add(new y(this, t.x, t.y)), - "text" === t.name && - this.add - .bitmapText(t.x, t.y, "pixelFont", t.text.text, 30) - .setDropShadow(2, 4, 2236962, 0.9) - .setOrigin(0), - "exit" === t.name && - this.exitGroup.add( - new m(this, t.x, t.y, t.width, t.height, t.type).setOrigin(0.5) - ); - }); - } - addColliders() { - this.physics.add.collider( - this.batGroup, - this.platform, - this.turnFoe, - () => !0, - this - ), - this.physics.add.collider( - this.zombieGroup, - this.bricks, - this.turnFoe, - () => !0, - this - ), - this.physics.add.collider( - this.batGroup, - this.bricks, - this.turnFoe, - () => !0, - this - ), - this.physics.add.collider( - this.zombieGroup, - this.turnGroup, - this.turnFoe, - () => !0, - this - ), - this.physics.add.collider( - this.zombieGroup, - this.platform, - this.hitFloor, - () => !0, - this - ); - } - turnFoe(t, e) { - t.turn(); - } - hitFloor() {} - addPlayer() { - (this.elements = this.add.group()), (this.coins = this.add.group()); - const t = this.objectsLayer.objects.find((t) => "player" === t.name); - (this.player = new d(this, t.x, t.y, 0)), - this.physics.add.collider( - this.player, - this.platform, - this.hitFloor, - () => !0, - this - ), - this.physics.add.collider( - this.player, - this.platformGroup, - this.hitFloor, - () => !0, - this - ), - this.physics.add.collider( - this.player, - this.bricks, - this.hitFloor, - () => !0, - this - ), - this.physics.add.overlap( - this.player, - this.coins, - this.pickCoin, - () => !0, - this - ), - this.physics.add.overlap( - this.player, - this.lunchBoxGroup, - this.pickLunchBox, - () => !0, - this - ), - this.physics.add.overlap( - this.player, - this.exitGroup, - () => { - this.playAudio("stage"), - this.time.delayedCall(1e3, () => this.finishScene(), null, this); - }, - () => !0, - this - ), - (this.blows = this.add.group()), - this.physics.add.overlap( - this.blows, - this.platform, - this.blowPlatform, - () => !0, - this - ), - this.physics.add.overlap( - this.blows, - this.bricks, - this.blowBrick, - () => !0, - this - ), - this.physics.add.overlap( - this.blows, - this.foesGroup, - this.blowFoe, - () => !0, - this - ), - this.physics.add.overlap( - this.bricks, - this.foesGroup, - this.foeBlowBrick, - () => !0, - this - ), - this.physics.add.collider( - this.player, - this.batGroup, - this.hitPlayer, - () => !0, - this - ), - this.physics.add.collider( - this.player, - this.zombieGroup, - this.hitPlayer, - () => !0, - this - ); - } - pickCoin(t, e) { - e.disabled || (e.pick(), this.playAudio("coin"), this.updateCoins()); - } - pickLunchBox(t, e) { - e.disabled || (this.playAudio("lunchbox"), e.pick()); - } - hitPlayer(t, e) { - t.invincible - ? (e.death(), this.playAudio("foedeath")) - : !t.dead && this.number > 0 && (t.die(), this.playAudio("death")); - } - blowFoe(t, e) { - this.playAudio("kill"), this.playAudio("foedeath"), e.death(); - } - foeBlowBrick(e, s) { - s.turn(), - Array(t.Math.Between(4, 6)) - .fill(0) - .forEach((t) => new a(this, e.x, e.y)), - e.destroy(); - } - blowPlatform(e, s) { - const i = this.getTile(s); - this.isBreakable(i) && - (this.playAudioRandomly("stone_fail"), - this.playAudioRandomly("stone"), - this.player.mjolnir && this.cameras.main.shake(30), - e.destroy(), - Array(t.Math.Between(4, 6)) - .fill(0) - .forEach((t) => new a(this, i.pixelX, i.pixelY)), - this.platform.removeTileAt(i.x, i.y), - this.spawnCoin(i)); - } - getTile(t) { - const { x: e, y: s } = t; - return this.platform.getTileAt(e, s); - } - isBreakable(t) { - return "break" === (null == t ? void 0 : t.properties.element); - } - spawnCoin(e) { - t.Math.Between(0, 11) > 5 && - this.time.delayedCall( - 500, - () => { - this.coins.add(new p(this, e.pixelX, e.pixelY)); - }, - null, - this - ); - } - blowBrick(e, s) { - this.player.mjolnir && this.cameras.main.shake(30), - this.playAudio("stone_fail"), - this.playAudioRandomly("stone"), - e.destroy(), - Array(t.Math.Between(4, 6)) - .fill(0) - .forEach((t) => new a(this, s.x, s.y)), - s.destroy(); - } - hitFloor(e, s) { - if ( - this.player.jumping && - !this.player.falling && - 0 === this.player.body.velocity.y - ) { - const e = this.getTile(s); - this.isBreakable(e) - ? (this.playAudioRandomly("stone"), - Array(t.Math.Between(4, 6)) - .fill(0) - .forEach((t) => new a(this, e.pixelX, e.pixelY)), - this.platform.removeTileAt(e.x, e.y)) - : "brick0" === (null == s ? void 0 : s.name) && - (this.playAudioRandomly("stone"), - Array(t.Math.Between(4, 6)) - .fill(0) - .forEach((t) => new a(this, s.x, s.y)), - s.destroy()); - } - } - loadAudios() { - this.audios = { - build: this.sound.add("build"), - coin: this.sound.add("coin"), - death: this.sound.add("death"), - jump: this.sound.add("jump"), - kill: this.sound.add("kill"), - land: this.sound.add("land"), - lunchbox: this.sound.add("lunchbox"), - prize: this.sound.add("prize"), - stone_fail: this.sound.add("stone_fail"), - stone: this.sound.add("stone"), - foedeath: this.sound.add("foedeath"), - stage: this.sound.add("stage"), - }; - } - playAudio(t) { - this.audios[t].play(); - } - playAudioRandomly(e) { - const s = t.Math.Between(0.8, 1), - i = t.Math.Between(0.8, 1); - this.audios[e].play({ volume: s, rate: i }); - } - playMusic(t = "game") { - (this.theme = this.sound.add("music" + this.number)), - this.theme.stop(), - this.theme.play({ - mute: !1, - volume: 0.7, - rate: 1, - detune: 0, - seek: 0, - loop: !0, - delay: 0, - }); - } - update() { - this.player.update(), - 3 === this.number && this.player.y > 1500 && this.restartScene(); - } - finishScene() { - this.theme && this.theme.stop(), - this.scene.start("transition", { - name: "STAGE", - number: this.number + 1, - }); - } - restartScene() { - this.time.delayedCall( - 1e3, - () => { - this.theme && this.theme.stop(), - this.scene.start("transition", { - name: "STAGE", - number: this.number, - }); - }, - null, - this - ); - } - updateCoins() { - const t = +this.registry.get("coins") + 1; - this.registry.set("coins", t), - this.scoreCoins.setText("x" + t), - this.tweens.add({ - targets: [this.scoreCoins, this.scoreCoinsLogo], - scale: { from: 1.4, to: 1 }, - duration: 50, - repeat: 10, - }); - } -} -const g = { - width: 1e3, - height: 800, - scale: { mode: t.Scale.FIT, autoCenter: t.Scale.CENTER_BOTH }, - autoRound: !1, - parent: "game-container", - physics: { default: "arcade", arcade: { gravity: { y: 300 }, debug: !0 } }, - scene: [e, h, r, b, s], -}; -new t.Game(g); diff --git a/wallhammer/dist/assets/index-SLRyrvV8.js b/wallhammer/dist/assets/index-SLRyrvV8.js new file mode 100644 index 00000000..0e912154 --- /dev/null +++ b/wallhammer/dist/assets/index-SLRyrvV8.js @@ -0,0 +1 @@ +import{P as t}from"./phaser-CmFXOKba.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const s of t)if("childList"===s.type)for(const t of s.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();class e extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.load.on("progress",(function(t){this.progressBar.clear(),this.progressBar.fillStyle(15767863,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*t,16)}),this),this.load.on("complete",(()=>{this.scene.start("splash")}),this),Array(5).fill(0).forEach(((t,e)=>{this.load.audio(`music${e}`,`assets/sounds/music${e}.mp3`)})),this.load.image("pello","assets/images/pello.png"),this.load.image("landscape","assets/images/landscape.png"),this.load.audio("build","assets/sounds/build.mp3"),this.load.audio("coin","assets/sounds/coin.mp3"),this.load.audio("death","assets/sounds/death.mp3"),this.load.audio("jump","assets/sounds/jump.mp3"),this.load.audio("kill","assets/sounds/kill.mp3"),this.load.audio("land","assets/sounds/land.mp3"),this.load.audio("lunchbox","assets/sounds/lunchbox.mp3"),this.load.audio("prize","assets/sounds/prize.mp3"),this.load.audio("stone_fail","assets/sounds/stone_fail.mp3"),this.load.audio("stone","assets/sounds/stone.mp3"),this.load.audio("foedeath","assets/sounds/foedeath.mp3"),this.load.audio("stage","assets/sounds/stage.mp3"),this.load.audio("splash","assets/sounds/splash.mp3"),Array(2).fill(0).forEach(((t,e)=>{this.load.image(`brick${e}`,`assets/images/brick${e}.png`)})),Array(5).fill(0).forEach(((t,e)=>{this.load.image(`platform${e+2}`,`assets/images/platform${e+2}.png`)})),this.load.bitmapFont("pixelFont","assets/fonts/mario.png","assets/fonts/mario.xml"),this.load.spritesheet("walt","assets/images/walt.png",{frameWidth:64,frameHeight:64}),Array(5).fill(0).forEach(((t,e)=>{this.load.tilemapTiledJSON(`scene${e}`,`assets/maps/scene${e}.json`)})),this.load.image("softbricks","assets/maps/softbricks.png"),this.load.image("bricks","assets/maps/bricks.png"),this.load.image("background","assets/maps/background.png"),this.load.image("chain","assets/images/chain.png"),this.load.spritesheet("bat","assets/images/bat.png",{frameWidth:32,frameHeight:32}),this.load.spritesheet("zombie","assets/images/zombie.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("coin","assets/images/coin.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("lunchbox","assets/images/lunchbox.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("hammer","assets/images/hammer.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("speed","assets/images/speed.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("boots","assets/images/boots.png",{frameWidth:64,frameHeight:64}),this.load.spritesheet("star","assets/images/star.png",{frameWidth:64,frameHeight:64}),this.load.bitmapFont("hammerfont","assets/fonts/hammer.png","assets/fonts/hammer.xml"),this.registry.set("score",0),this.registry.set("coins",0)}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(13264642,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class s extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i=32,a=32,h=""){super(t,e,s,i,a,16777215),this.type=h,this.y=s,t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1),this.scene.tweens.add({targets:this,duration:300,scale:{from:1,to:0},onComplete:()=>{this.destroy()}})}}class i extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="brick0"){super(t,e,s,i),this.name=i,this.scene.add.existing(this),this.scene.physics.add.existing(this),this.body.immovable=!0,this.body.moves=!1,this.scene.tweens.add({targets:this,duration:50,x:{from:this.x,to:this.x+Phaser.Math.Between(-7,7)},y:{from:this.y,to:this.y+Phaser.Math.Between(-7,7)},repeat:5})}}Phaser.GameObjects.Rectangle,Phaser.GameObjects.Rectangle;class a extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i,a,h=16771755,r=!1){super(t,e,s,i=i||Phaser.Math.Between(10,25),a=a||Phaser.Math.Between(10,25),h),t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setVelocityX(Phaser.Math.Between(-20,20)),this.init()}init(){this.scene.tweens.add({targets:this,duration:800,scale:{from:1,to:0},onComplete:()=>{this.destroy()}})}}class h extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i=11550208,a,h,r=!1){super(t,e,s+5,a=a||Phaser.Math.Between(15,30),h=h||Phaser.Math.Between(15,30),i),t.add.existing(this),t.physics.add.existing(this),this.body.setAllowGravity(!0),this.body.setVelocityX(Phaser.Math.Between(-50,50)),this.body.setVelocityY(a*h)}}class r extends Phaser.GameObjects.Sprite{constructor(t,e,s,i=10){super(t,e,s,"walt"),this.setOrigin(.5),this.scene.add.existing(this),this.scene.physics.add.existing(this),this.cursor=this.scene.input.keyboard.createCursorKeys(),this.spaceBar=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE),this.down=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.DOWN),this.right=!0,this.body.setGravityY(100),this.body.setSize(48,60),this.init(),this.jumping=!1,this.building=!1,this.falling=!1,this.mjolnir=!1,this.walkVelocity=200,this.jumpVelocity=-400,this.invincible=!1,this.health=i,this.dead=!1,this.W=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W),this.A=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.A),this.S=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S),this.D=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.D)}init(){this.scene.anims.create({key:"startidle",frames:this.scene.anims.generateFrameNumbers("walt",{start:0,end:1}),frameRate:3,repeat:-1}),this.scene.anims.create({key:"playeridle",frames:this.scene.anims.generateFrameNumbers("walt",{start:2,end:3}),frameRate:3,repeat:-1}),this.scene.anims.create({key:"playerwalk",frames:this.scene.anims.generateFrameNumbers("walt",{start:4,end:6}),frameRate:10,repeat:-1}),this.scene.anims.create({key:"playerjump",frames:this.scene.anims.generateFrameNumbers("walt",{start:4,end:4}),frameRate:1}),this.scene.anims.create({key:"playerhammer",frames:this.scene.anims.generateFrameNumbers("walt",{start:7,end:8}),frameRate:10}),this.scene.anims.create({key:"playerbuild",frames:this.scene.anims.generateFrameNumbers("walt",{start:9,end:10}),frameRate:10,repeat:2}),this.scene.anims.create({key:"playerdead",frames:this.scene.anims.generateFrameNumbers("walt",{start:11,end:16}),frameRate:5}),this.anims.play("startidle",!0),this.on("animationcomplete",this.animationComplete,this)}update(){this.dead||(this.jumping&&this.body.velocity.y>=0&&(this.body.setGravityY(700),this.falling=!0),(Phaser.Input.Keyboard.JustDown(this.cursor.up)||Phaser.Input.Keyboard.JustDown(this.W))&&this.body.blocked.down?(this.building=!1,this.body.setVelocityY(this.jumpVelocity),this.body.setGravityY(400),this.anims.play("playerjump",!0),this.scene.playAudio("jump"),this.jumping=!0,this.jumpSmoke()):this.cursor.right.isDown||this.D.isDown?(this.building=!1,this.body.blocked.down&&this.anims.play("playerwalk",!0),this.right=!0,this.flipX=this.body.velocity.x<0,this.body.setVelocityX(this.walkVelocity)):this.cursor.left.isDown||this.A.isDown?(this.building=!1,this.body.blocked.down&&this.anims.play("playerwalk",!0),this.right=!1,this.flipX=!0,this.body.setVelocityX(-this.walkVelocity)):(this.body.blocked.down&&(this.jumping&&(this.scene.playAudio("land"),this.landSmoke()),this.jumping=!1,this.falling=!1,this.building||this.anims.play("playeridle",!0)),this.body.setVelocityX(0)),Phaser.Input.Keyboard.JustDown(this.spaceBar)&&this.hammerBlow(),(Phaser.Input.Keyboard.JustDown(this.cursor.down)||Phaser.Input.Keyboard.JustDown(this.S))&&this.buildBlock())}landSmoke(){this.jumpSmoke(20)}jumpSmoke(t=10,e){Array(Phaser.Math.Between(3,6)).fill(0).forEach((s=>{const i=e||Phaser.Math.Between(-1,1)>0?1:-1;e=e||Phaser.Math.Between(0,20),new a(this.scene,this.x+i*e,this.y+t)}))}buildBlock(){this.building=!0,this.anims.play("playerbuild",!0),this.scene.playAudio("build");const t=this.right?64:-64,e=-400===this.jumpVelocity?0:-128;this.buildSmoke(32,t),this.scene.bricks.add(new i(this.scene,this.x+t,this.y+e))}buildSmoke(t=10,e){Array(Phaser.Math.Between(8,14)).fill(0).forEach((s=>{const i=Phaser.Math.Between(-20,20);new a(this.scene,this.x+(e+i),this.y+t)}))}hammerBlow(){this.building=!0,this.anims.play("playerhammer",!0);const t=this.right?32:-32,e=this.mjolnir?128:32;this.scene.blows.add(new s(this.scene,this.x+t,this.y,e,e))}turn(){this.right=!this.right}animationComplete(t,e){"playerground"===t.key&&this.anims.play("playeridle",!0),"playerhammer"!==t.key&&"playerbuild"!==t.key||(this.building=!1,this.anims.play(this.jumping?"playerjump":"playeridle",!0))}hit(){this.health--,this.anims.play("playerdead",!0),this.body.enable=!1,0===this.health&&this.die()}die(){this.dead=!0,this.anims.play("playerdead",!0),this.body.immovable=!0,this.body.moves=!1,this.scene.restartScene()}applyPrize(t){switch(t){case"speed":this.walkVelocity=330,this.flashPlayer();break;case"hammer":this.mjolnir=!0,this.flashPlayer();break;case"boots":this.jumpVelocity=-600,this.flashPlayer();break;case"coin":this.scene.updateCoins();break;case"star":this.invincible=!0,this.scene.tweens.add({targets:this,duration:300,alpha:{from:.7,to:1},repeat:-1})}}flashPlayer(){this.scene.tweens.add({targets:this,duration:50,scale:{from:1.2,to:1},repeat:10})}}class o extends Phaser.Physics.Arcade.Sprite{constructor(t,e,s,i="right"){super(t,e,s,"bat"),this.name="bat",this.scene.physics.add.existing(this),this.scene.physics.world.enable(this),this.body.setAllowGravity(!1),this.scene.add.existing(this),this.direction="right"===i?1:-1,this.init()}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:1}),frameRate:5,repeat:-1}),this.scene.anims.create({key:this.name+"death",frames:this.scene.anims.generateFrameNumbers(this.name,{start:2,end:5}),frameRate:5}),this.anims.play(this.name,!0),this.body.setVelocityX(150*this.direction),this.flipX=this.direction>0,this.on("animationcomplete",this.animationComplete,this)}update(){}turn(){this.direction=-this.direction,this.flipX=this.direction>0,this.body.setVelocityX(150*this.direction)}death(){this.dead=!0,this.body.enable=!1,this.body.rotation=0,this.anims.play(this.name+"death")}animationComplete(t,e){t.key===this.name+"death"&&this.destroy()}}class n extends Phaser.Physics.Arcade.Sprite{constructor(t,e,s,i="right"){super(t,e,s,"zombie"),this.name="zombie",this.scene=t,this.scene.physics.add.existing(this),this.scene.physics.world.enable(this),this.body.setAllowGravity(!0),this.scene.add.existing(this),this.direction="right"===i?-1:1,this.init()}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:2}),frameRate:5,repeat:-1}),this.scene.anims.create({key:this.name+"death",frames:this.scene.anims.generateFrameNumbers(this.name,{start:3,end:5}),frameRate:5}),this.anims.play(this.name,!0),this.body.setVelocityX(100*this.direction),this.flipX=this.direction<0,this.on("animationcomplete",this.animationComplete,this)}turn(){this.direction=-this.direction,this.flipX=this.direction<0,this.body.setVelocityX(100*this.direction)}death(){this.dead=!0,this.body.enable=!1,this.body.rotation=0,this.anims.play(this.name+"death")}animationComplete(t,e){t.key===this.name+"death"&&this.destroy()}}class d extends Phaser.GameObjects.Rectangle{constructor(t,e,s,i=32,a=32,h=""){super(t,e,s,i,a,16777215),this.type=h,this.setAlpha(0),this.x=e,this.y=s,t.add.existing(this),t.physics.add.existing(this),this.body.immovable=!0,this.body.moves=!1}disable(){this.visible=!1,this.destroy()}destroy(){super.destroy()}}class l extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="coin"){super(t,e,s,i),this.name=i,this.setScale(.7),this.setOrigin(.5),t.add.existing(this),t.physics.add.existing(this),this.body.immovable=!0,this.body.moves=!1,this.disabled=!1,this.init()}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:7}),frameRate:10,repeat:-1}),this.anims.play(this.name,!0),this.scene.tweens.add({targets:this,duration:500,y:this.y-20,repeat:-1,yoyo:!0})}pick(){const{x:t,y:e}=this.scene.cameras.main.getWorldPoint(this.scene.scoreCoinsLogo.x,this.scene.scoreCoinsLogo.y);this.disabled=!0,this.scene.tweens.add({targets:this,duration:500,x:{from:this.x,to:t},y:{from:this.y,to:e},scale:{from:.7,to:.5},onComplete:()=>{this.destroy()}})}}class c extends Phaser.GameObjects.Sprite{constructor(t,e,s,i="lunchbox"){super(t,e,s,i),this.scene=t,this.name=i,this.setScale(1),this.setOrigin(.5),t.add.existing(this),t.physics.add.existing(this),this.body.immovable=!0,this.body.moves=!1,this.disabled=!1,this.init()}init(){this.scene.anims.create({key:this.name,frames:this.scene.anims.generateFrameNumbers(this.name,{start:0,end:0}),frameRate:1}),this.scene.anims.create({key:this.name+"opened",frames:this.scene.anims.generateFrameNumbers(this.name,{start:1,end:1}),frameRate:1}),this.anims.play(this.name,!0),this.scene.tweens.add({targets:this,duration:500,y:this.y-20,repeat:-1,yoyo:!0})}pick(){this.anims.play(this.name+"opened",!0),this.showPrize(),this.disabled=!0,this.scene.time.delayedCall(1e3,(()=>{this.destroy(),this.prizeSprite.destroy()}),null,this)}showPrize(){const t=Phaser.Math.RND.pick(["boots","hammer","coin","star","speed"]);this.scene.player.applyPrize(t),this.prizeSprite=this.scene.add.sprite(this.x,this.y,t).setOrigin(.5).setScale(.8),this.scene.tweens.add({targets:this.prizeSprite,duration:500,y:{from:this.y,to:this.y-64},onComplete:()=>{this.scene.playAudio("prize")}})}}class m extends Phaser.GameObjects.Container{constructor(t,e,s,i=4,a=!1){super(t,e,s),this.x=e,this.y=s,this.scene.add.existing(this),this.scene.physics.add.existing(this),this.body.setAllowGravity(!1),this.body.setBounce(1),this.body.setSize(64*i,64),this.body.setOffset(-2,-2),this.body.immovable=!0,this.body.moves=!1,this.chain=new Phaser.GameObjects.Sprite(this.scene,32*i-32,-2048,"chain").setOrigin(0),this.add(this.chain),this.platform=new Phaser.GameObjects.Sprite(this.scene,0,0,"platform"+i).setOrigin(0),this.add(this.platform),this.init()}init(){const t=Phaser.Math.Between(0,7);let e=this.x,s=this.y;switch(t){case 0:e=Phaser.Math.Between(-50,50);break;case 1:s=Phaser.Math.Between(-50,50);break;case 2:e=Phaser.Math.Between(-100,100),s=Phaser.Math.Between(-100,100)}this.scene.tweens.add({targets:this,duration:Phaser.Math.Between(4e3,6e3),x:{from:this.x,to:e},y:{from:this.y,to:s},repeat:-1,yoyo:!0})}}class p extends t.Scene{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null}init(t){this.name=t.name,this.number=t.number}preload(){}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(6464191),this.add.tileSprite(0,1e3,10240,512,"landscape").setOrigin(.5),this.createMap(),this.cameras.main.setBounds(0,0,41840,40160),this.physics.world.setBounds(0,0,41840,40160),this.addPlayer(),this.cameras.main.startFollow(this.player,!0,.05,.05,0,240),this.physics.world.enable([this.player]),this.addScore(),this.loadAudios(),this.playMusic()}addScore(){this.scoreCoins=this.add.bitmapText(75,10,"pixelFont","x0",30).setDropShadow(0,4,2236962,.9).setOrigin(0).setScrollFactor(0),this.scoreCoinsLogo=this.add.sprite(50,25,"coin").setScale(1).setOrigin(.5).setScrollFactor(0),this.anims.create({key:"coinscore",frames:this.anims.generateFrameNumbers("coin",{start:0,end:7}),frameRate:8}),this.scoreCoinsLogo.play({key:"coinscore",repeat:-1})}createMap(){this.tileMap=this.make.tilemap({key:"scene"+this.number,tileWidth:64,tileHeight:64}),this.tileSetBg=this.tileMap.addTilesetImage("background"),console.log(this.tileMap),this.tileMap.createLayer("background",this.tileSetBg),this.tileSet=this.tileMap.addTilesetImage("softbricks"),this.platform=this.tileMap.createLayer("scene"+this.number,this.tileSet),this.objectsLayer=this.tileMap.getObjectLayer("objects"),this.platform.setCollisionByExclusion([-1]),this.batGroup=this.add.group(),this.zombieGroup=this.add.group(),this.foesGroup=this.add.group(),this.turnGroup=this.add.group(),this.exitGroup=this.add.group(),this.platformGroup=this.add.group(),this.lunchBoxGroup=this.add.group(),this.bricks=this.add.group(),this.addsObjects(),this.addColliders()}addsObjects(){this.objectsLayer.objects.forEach((t=>{if("bat"===t.name){let e=new o(this,t.x,t.y,t.type);this.batGroup.add(e),this.foesGroup.add(e)}if("zombie"===t.name){let e=new n(this,t.x,t.y,t.type);this.zombieGroup.add(e),this.foesGroup.add(e)}"platform"===t.name&&this.platformGroup.add(new m(this,t.x,t.y,t.type)),"turn"===t.name&&this.turnGroup.add(new d(this,t.x,t.y)),"lunchbox"===t.name&&this.lunchBoxGroup.add(new c(this,t.x,t.y)),"text"===t.name&&this.add.bitmapText(t.x,t.y,"pixelFont",t.text.text,30).setDropShadow(2,4,2236962,.9).setOrigin(0),"exit"===t.name&&this.exitGroup.add(new d(this,t.x,t.y,t.width,t.height,t.type).setOrigin(.5))}))}addColliders(){this.physics.add.collider(this.batGroup,this.platform,this.turnFoe,(()=>!0),this),this.physics.add.collider(this.zombieGroup,this.bricks,this.turnFoe,(()=>!0),this),this.physics.add.collider(this.batGroup,this.bricks,this.turnFoe,(()=>!0),this),this.physics.add.collider(this.zombieGroup,this.turnGroup,this.turnFoe,(()=>!0),this),this.physics.add.collider(this.zombieGroup,this.platform,this.hitFloor,(()=>!0),this)}turnFoe(t,e){t.turn()}hitFloor(){}addPlayer(){this.elements=this.add.group(),this.coins=this.add.group();const t=this.objectsLayer.objects.find((t=>"player"===t.name));this.player=new r(this,t.x,t.y,0),this.physics.add.collider(this.player,this.platform,this.hitFloor,(()=>!0),this),this.physics.add.collider(this.player,this.platformGroup,this.hitFloor,(()=>!0),this),this.physics.add.collider(this.player,this.bricks,this.hitFloor,(()=>!0),this),this.physics.add.overlap(this.player,this.coins,this.pickCoin,(()=>!0),this),this.physics.add.overlap(this.player,this.lunchBoxGroup,this.pickLunchBox,(()=>!0),this),this.physics.add.overlap(this.player,this.exitGroup,(()=>{this.playAudio("stage"),this.time.delayedCall(1e3,(()=>this.finishScene()),null,this)}),(()=>!0),this),this.blows=this.add.group(),this.physics.add.overlap(this.blows,this.platform,this.blowPlatform,(()=>!0),this),this.physics.add.overlap(this.blows,this.bricks,this.blowBrick,(()=>!0),this),this.physics.add.overlap(this.blows,this.foesGroup,this.blowFoe,(()=>!0),this),this.physics.add.overlap(this.bricks,this.foesGroup,this.foeBlowBrick,(()=>!0),this),this.physics.add.collider(this.player,this.batGroup,this.hitPlayer,(()=>!0),this),this.physics.add.collider(this.player,this.zombieGroup,this.hitPlayer,(()=>!0),this)}pickCoin(t,e){e.disabled||(e.pick(),this.playAudio("coin"),this.updateCoins())}pickLunchBox(t,e){e.disabled||(this.playAudio("lunchbox"),e.pick())}hitPlayer(t,e){t.invincible?(e.death(),this.playAudio("foedeath")):!t.dead&&this.number>0&&(t.die(),this.playAudio("death"))}blowFoe(t,e){this.playAudio("kill"),this.playAudio("foedeath"),e.death()}foeBlowBrick(e,s){s.turn(),Array(t.Math.Between(4,6)).fill(0).forEach((t=>new h(this,e.x,e.y))),e.destroy()}blowPlatform(e,s){const i=this.getTile(s);this.isBreakable(i)&&(this.playAudioRandomly("stone_fail"),this.playAudioRandomly("stone"),this.player.mjolnir&&this.cameras.main.shake(30),e.destroy(),Array(t.Math.Between(4,6)).fill(0).forEach((t=>new h(this,i.pixelX,i.pixelY))),this.platform.removeTileAt(i.x,i.y),this.spawnCoin(i))}getTile(t){const{x:e,y:s}=t;return this.platform.getTileAt(e,s)}isBreakable(t){return"break"===(null==t?void 0:t.properties.element)}spawnCoin(e){t.Math.Between(0,11)>5&&this.time.delayedCall(500,(()=>{this.coins.add(new l(this,e.pixelX,e.pixelY))}),null,this)}blowBrick(e,s){this.player.mjolnir&&this.cameras.main.shake(30),this.playAudio("stone_fail"),this.playAudioRandomly("stone"),e.destroy(),Array(t.Math.Between(4,6)).fill(0).forEach((t=>new h(this,s.x,s.y))),s.destroy()}hitFloor(e,s){if(this.player.jumping&&!this.player.falling&&0===this.player.body.velocity.y){const e=this.getTile(s);this.isBreakable(e)?(this.playAudioRandomly("stone"),Array(t.Math.Between(4,6)).fill(0).forEach((t=>new h(this,e.pixelX,e.pixelY))),this.platform.removeTileAt(e.x,e.y)):"brick0"===(null==s?void 0:s.name)&&(this.playAudioRandomly("stone"),Array(t.Math.Between(4,6)).fill(0).forEach((t=>new h(this,s.x,s.y))),s.destroy())}}loadAudios(){this.audios={build:this.sound.add("build"),coin:this.sound.add("coin"),death:this.sound.add("death"),jump:this.sound.add("jump"),kill:this.sound.add("kill"),land:this.sound.add("land"),lunchbox:this.sound.add("lunchbox"),prize:this.sound.add("prize"),stone_fail:this.sound.add("stone_fail"),stone:this.sound.add("stone"),foedeath:this.sound.add("foedeath"),stage:this.sound.add("stage")}}playAudio(t){this.audios[t].play()}playAudioRandomly(e){const s=t.Math.Between(.8,1),i=t.Math.Between(.8,1);this.audios[e].play({volume:s,rate:i})}playMusic(t="game"){this.theme=this.sound.add("music"+this.number),this.theme.stop(),this.theme.play({mute:!1,volume:.7,rate:1,detune:0,seek:0,loop:!0,delay:0})}update(){this.player.update(),3===this.number&&this.player.y>1500&&this.restartScene()}finishScene(){this.theme&&this.theme.stop(),this.scene.start("transition",{name:"STAGE",number:this.number+1})}restartScene(){this.time.delayedCall(1e3,(()=>{this.theme&&this.theme.stop(),this.scene.start("transition",{name:"STAGE",number:this.number})}),null,this)}updateCoins(){const t=+this.registry.get("coins")+1;this.registry.set("coins",t),this.scoreCoins.setText("x"+t),this.tweens.add({targets:[this.scoreCoins,this.scoreCoinsLogo],scale:{from:1.4,to:1},duration:50,repeat:10})}}class y extends Phaser.Scene{constructor(){super({key:"outro"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.introLayer=this.add.layer(),this.splashLayer=this.add.layer(),this.text=["You did it!!","Thanks to your building skills","and your mighty hammer,","you saved the earth.","Made in 3 days for Minijam","by Pello","","Press SPACE"],this.showHistory(),this.input.keyboard.on("keydown-SPACE",this.startSplash,this),this.input.keyboard.on("keydown-ENTER",this.startSplash,this)}startSplash(){this.scene.start("splash")}showHistory(){this.text.forEach(((t,e)=>{this.time.delayedCall(2e3*(e+1),(()=>this.showLine(t,70*(e+1))),null,this)}))}showLine(t,e){let s=this.introLayer.add(this.add.bitmapText(this.center_width,e,"pixelFont",t,25).setOrigin(.5).setAlpha(0));this.tweens.add({targets:s,duration:2e3,alpha:1})}}class u extends Phaser.Scene{constructor(){super({key:"splash"})}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(0),this.time.delayedCall(1e3,(()=>this.showInstructions()),null,this),this.input.keyboard.on("keydown-SPACE",(()=>this.startGame()),this),this.input.keyboard.on("keydown-ENTER",(()=>this.startGame()),this),this.playMusic(),this.showTitle(),this.playAudioRandomly("stone")}startGame(){this.theme&&this.theme.stop(),this.scene.start("transition",{next:"game",name:"STAGE",number:0,time:30})}showTitle(){"WALL".split("").forEach(((t,e)=>{this.time.delayedCall(200*(e+1),(()=>{this.playAudioRandomly("stone_fail"),Phaser.Math.Between(0,5)>2&&this.playAudioRandomly("stone");let s=this.add.bitmapText(130*(e+1)+140,200,"hammerfont",t,170).setTint(13264642).setOrigin(.5).setDropShadow(4,6,15767863,.9);Array(Phaser.Math.Between(4,6)).fill(0).forEach((t=>new h(this,s.x,s.y,13264642)))}),null,this)})),"HAMMER".split("").forEach(((t,e)=>{this.time.delayedCall(200*(e+1)+800,(()=>{this.playAudioRandomly("stone_fail"),Phaser.Math.Between(0,5)>2&&this.playAudioRandomly("stone");let s=this.add.bitmapText(130*(e+1),350,"hammerfont",t,170).setTint(13264642).setOrigin(.5).setDropShadow(4,6,15767863,.9);Array(Phaser.Math.Between(4,6)).fill(0).forEach((t=>new h(this,s.x,s.y,13264642)))}),null,this)}))}playAudioRandomly(t){const e=Phaser.Math.Between(.8,1);this.sound.add(t).play({volume:e,rate:1})}playMusic(t="splash"){this.theme=this.sound.add(t),this.theme.stop(),this.theme.play({mute:!1,volume:1,rate:1,detune:0,seek:0,loop:!0,delay:0})}showInstructions(){this.add.bitmapText(this.center_width,450,"pixelFont","WASD/Arrows: move",30).setOrigin(.5),this.add.bitmapText(this.center_width,500,"pixelFont","S/DOWN: BUILD WALL",30).setOrigin(.5),this.add.bitmapText(this.center_width,550,"pixelFont","SPACE: HAMMER",30).setOrigin(.5),this.add.sprite(this.center_width-120,620,"pello").setOrigin(.5).setScale(.3),this.add.bitmapText(this.center_width+40,620,"pixelFont","By PELLO",15).setOrigin(.5),this.space=this.add.bitmapText(this.center_width,670,"pixelFont","Press SPACE to start",30).setOrigin(.5),this.tweens.add({targets:this.space,duration:300,alpha:{from:0,to:1},repeat:-1,yoyo:!0})}}class g extends Phaser.Scene{constructor(){super({key:"transition"})}init(t){this.name=t.name,this.number=t.number,this.next=t.next}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,5===this.number&&this.loadOutro(),this.addScore(),this.add.sprite(this.center_width,this.center_height-170,"walt"),this.add.bitmapText(this.center_width,this.center_height-20,"pixelFont",["TUTORIAL","STAGE 1","STAGE 2","STAGE 3","STAGE 4"][this.number],40).setOrigin(.5),this.add.bitmapText(this.center_width,this.center_height+20,"pixelFont","Ready?",30).setOrigin(.5),this.input.keyboard.on("keydown-ENTER",(()=>this.loadNext()),this),this.input.keyboard.on("keydown-SPACE",(()=>this.loadNext()),this),this.time.delayedCall(3e3,(()=>{this.loadNext()}),null,this)}loadNext(){this.scene.start("game",{name:this.name,number:this.number})}loadOutro(){this.scene.start("outro",{name:this.name,number:this.number})}addScore(){this.scoreCoins=this.add.bitmapText(this.center_width+32,this.center_height-100,"pixelFont","x"+this.registry.get("coins"),30).setDropShadow(0,4,2236962,.9).setOrigin(.5).setScrollFactor(0),this.scoreCoinsLogo=this.add.sprite(this.center_width-32,this.center_height-100,"coin").setScale(.7).setOrigin(.5).setScrollFactor(0),this.anims.create({key:"coinscore",frames:this.anims.generateFrameNumbers("coin",{start:0,end:7}),frameRate:8}),this.scoreCoinsLogo.play({key:"coinscore",repeat:-1})}}const b={width:1e3,height:800,scale:{mode:t.Scale.FIT,autoCenter:t.Scale.CENTER_BOTH},autoRound:!1,parent:"game-container",physics:{default:"arcade",arcade:{gravity:{y:300},debug:!0}},scene:[e,u,g,p,y]};new t.Game(b); diff --git a/wallhammer/dist/index.html b/wallhammer/dist/index.html index de7cc03b..8a6712cc 100644 --- a/wallhammer/dist/index.html +++ b/wallhammer/dist/index.html @@ -4,7 +4,7 @@ - Phaser - Template + Phaser - Wallhammer - + diff --git a/zenbaki/dist/assets/html/index.html b/zenbaki/dist/assets/html/index.html index 7dc25a01..01bb260a 100644 --- a/zenbaki/dist/assets/html/index.html +++ b/zenbaki/dist/assets/html/index.html @@ -36,8 +36,8 @@

Options

-
+

diff --git a/zenbaki/dist/assets/index-BA24paxW.js b/zenbaki/dist/assets/index-BA24paxW.js deleted file mode 100644 index e94c4828..00000000 --- a/zenbaki/dist/assets/index-BA24paxW.js +++ /dev/null @@ -1,2554 +0,0 @@ -import { - P as Phaser$1, - c as commonjsGlobal, - g as getAugmentedNamespace, - a as getDefaultExportFromCjs, -} from "./phaser-CYd07urT.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 s of e) - if ("childList" === s.type) - for (const e of s.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); - } -})(); -class Bootloader extends Phaser.Scene { - constructor() { - super({ key: "bootloader" }); - } - preload() { - this.createBars(), - this.setLoadEvents(), - Array(15) - .fill(0) - .forEach((e, t) => { - this.load.image(`cloud${t}`, `assets/images/cloud${t}.png`); - }), - this.load.image("pello", "assets/images/pello.png"), - this.load.image("sensei", "assets/images/sensei.png"), - this.load.audio("win", "assets/sounds/win.mp3"), - this.load.audio("drip", "assets/sounds/drip.mp3"), - this.load.audio("fail", "assets/sounds/fail.mp3"), - this.load.bitmapFont( - "mainFont", - "assets/fonts/hiro.png", - "assets/fonts/hiro.xml" - ), - this.registry.set("score", 0); - } - setLoadEvents() { - this.load.on( - "progress", - function (e) { - this.progressBar.clear(), - this.progressBar.fillStyle(8966732, 1), - this.progressBar.fillRect( - this.cameras.main.width / 4, - this.cameras.main.height / 2 - 16, - (this.cameras.main.width / 2) * e, - 16 - ); - }, - this - ), - this.load.on( - "complete", - () => { - this.scene.start("game"); - }, - this - ); - } - createBars() { - (this.loadBar = this.add.graphics()), - this.loadBar.fillStyle(33923, 1), - this.loadBar.fillRect( - this.cameras.main.width / 4 - 2, - this.cameras.main.height / 2 - 18, - this.cameras.main.width / 2 + 4, - 20 - ), - (this.progressBar = this.add.graphics()); - } -} -class Player { - constructor(e, t) { - (this.scene = e), - (this.name = t), - (this.score = 0), - (this.lastMessage = null), - (this.dead = !1), - (this.penalties = 0); - } - hasSpammed() { - return ( - !!this.lastMessage && - (new Date() - this.lastMessage) / 1e3 < this.scene.spamTimeWait - ); - } - setPenalty() { - this.penalties++, - (this.score = 0), - (this.dead = !0), - this.scene.time.delayedCall( - 1e4 * this.penalties, - () => { - this.dead = !1; - }, - null, - this - ); - } -} -var client$1 = { exports: {} }; -const __viteBrowserExternal = {}, - __viteBrowserExternal$1 = Object.freeze( - Object.defineProperty( - { __proto__: null, default: __viteBrowserExternal }, - Symbol.toStringTag, - { value: "Module" } - ) - ), - require$$1 = getAugmentedNamespace(__viteBrowserExternal$1); -var utils = { exports: {} }; -const actionMessageRegex = /^\u0001ACTION ([^\u0001]+)\u0001$/, - justinFanRegex = /^(justinfan)(\d+$)/, - unescapeIRCRegex = /\\([sn:r\\])/g, - escapeIRCRegex = /([ \n;\r\\])/g, - ircEscapedChars = { s: " ", n: "", ":": ";", r: "" }, - ircUnescapedChars = { " ": "s", "\n": "n", ";": ":", "\r": "r" }, - urlRegex = new RegExp( - "^(?:(?:https?|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))\\.?)(?::\\d{2,5})?(?:[/?#]\\S*)?$", - "i" - ), - regexEmoteRegex = /[|\\^$*+?:#]/, - _$4 = (utils.exports = { - get: (e, t) => (void 0 === e ? t : e), - hasOwn: (e, t) => ({}).hasOwnProperty.call(e, t), - promiseDelay: (e) => new Promise((t) => setTimeout(t, e)), - isFinite: (e) => isFinite(e) && !isNaN(parseFloat(e)), - toNumber(e, t) { - if (null === e) return 0; - const s = Math.pow(10, _$4.isFinite(t) ? t : 0); - return Math.round(e * s) / s; - }, - isInteger: (e) => !isNaN(_$4.toNumber(e, 0)), - isRegex: (e) => regexEmoteRegex.test(e), - isURL: (e) => urlRegex.test(e), - justinfan: () => `justinfan${Math.floor(8e4 * Math.random() + 1e3)}`, - isJustinfan: (e) => justinFanRegex.test(e), - channel(e) { - const t = (e || "").toLowerCase(); - return "#" === t[0] ? t : "#" + t; - }, - username(e) { - const t = (e || "").toLowerCase(); - return "#" === t[0] ? t.slice(1) : t; - }, - token: (e) => (e ? e.toLowerCase().replace("oauth:", "") : ""), - password(e) { - const t = _$4.token(e); - return t ? `oauth:${t}` : ""; - }, - actionMessage: (e) => e.match(actionMessageRegex), - replaceAll(e, t) { - if (null == e) return null; - for (const s in t) e = e.replace(new RegExp(s, "g"), t[s]); - return e; - }, - unescapeHtml: (e) => - e - .replace(/\\&\\;/g, "&") - .replace(/\\<\\;/g, "<") - .replace(/\\>\\;/g, ">") - .replace(/\\"\\;/g, '"') - .replace(/\\'\\;/g, "'"), - unescapeIRC: (e) => - e && "string" == typeof e && e.includes("\\") - ? e.replace(unescapeIRCRegex, (e, t) => - t in ircEscapedChars ? ircEscapedChars[t] : t - ) - : e, - escapeIRC: (e) => - e && "string" == typeof e - ? e.replace(escapeIRCRegex, (e, t) => - t in ircUnescapedChars ? `\\${ircUnescapedChars[t]}` : t - ) - : e, - addWord: (e, t) => (e.length ? e + " " + t : e + t), - splitLine(e, t) { - let s = e.substring(0, t).lastIndexOf(" "); - return -1 === s && (s = t - 1), [e.substring(0, s), e.substring(s + 1)]; - }, - extractNumber(e) { - const t = e.split(" "); - for (let s = 0; s < t.length; s++) if (_$4.isInteger(t[s])) return ~~t[s]; - return 0; - }, - formatDate(e) { - let t = e.getHours(), - s = e.getMinutes(); - return ( - (t = (t < 10 ? "0" : "") + t), - (s = (s < 10 ? "0" : "") + s), - `${t}:${s}` - ); - }, - inherits(e, t) { - e.super_ = t; - const s = function () {}; - (s.prototype = t.prototype), - (e.prototype = new s()), - (e.prototype.constructor = e); - }, - isNode() { - try { - return ( - "object" == typeof process && - "[object process]" === Object.prototype.toString.call(process) - ); - } catch (e) {} - return !1; - }, - }); -var utilsExports = utils.exports; -const fetch$1 = require$$1, - _$3 = utilsExports; -var api = function (e, t) { - let s = void 0 !== e.url ? e.url : e.uri; - if ( - (_$3.isURL(s) || - (s = `https://api.twitch.tv/kraken${"/" === s[0] ? s : `/${s}`}`), - _$3.isNode()) - ) { - const i = Object.assign({ method: "GET", json: !0 }, e); - i.qs && (s += `?${new URLSearchParams(i.qs)}`); - const n = {}; - "fetchAgent" in this.opts.connection && - (n.agent = this.opts.connection.fetchAgent); - const o = fetch$1(s, { - ...n, - method: i.method, - headers: i.headers, - body: i.body, - }); - let r = {}; - o.then( - (e) => ( - (r = { statusCode: e.status, headers: e.headers }), - i.json ? e.json() : e.text() - ) - ).then( - (e) => t(null, r, e), - (e) => t(e, r, null) - ); - } else { - const i = Object.assign({ method: "GET", headers: {} }, e, { url: s }), - n = new XMLHttpRequest(); - n.open(i.method, i.url, !0); - for (const e in i.headers) n.setRequestHeader(e, i.headers[e]); - (n.responseType = "json"), - n.addEventListener("load", (e) => { - 4 === n.readyState && - (200 !== n.status - ? t(n.status, null, null) - : t(null, null, n.response)); - }), - n.send(); - } -}; -const _$2 = utilsExports; -function followersonly(e, t) { - return ( - (e = _$2.channel(e)), - (t = _$2.get(t, 30)), - this._sendCommand(null, e, `/followers ${t}`, (s, i) => { - this.once("_promiseFollowers", (n) => { - n ? i(n) : s([e, ~~t]); - }); - }) - ); -} -function followersonlyoff(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/followersoff", (t, s) => { - this.once("_promiseFollowersoff", (i) => { - i ? s(i) : t([e]); - }); - }) - ); -} -function part(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, null, `PART ${e}`, (t, s) => { - this.once("_promisePart", (i) => { - i ? s(i) : t([e]); - }); - }) - ); -} -function r9kbeta(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/r9kbeta", (t, s) => { - this.once("_promiseR9kbeta", (i) => { - i ? s(i) : t([e]); - }); - }) - ); -} -function r9kbetaoff(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/r9kbetaoff", (t, s) => { - this.once("_promiseR9kbetaoff", (i) => { - i ? s(i) : t([e]); - }); - }) - ); -} -function slow(e, t) { - return ( - (e = _$2.channel(e)), - (t = _$2.get(t, 300)), - this._sendCommand(null, e, `/slow ${t}`, (s, i) => { - this.once("_promiseSlow", (n) => { - n ? i(n) : s([e, ~~t]); - }); - }) - ); -} -function slowoff(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/slowoff", (t, s) => { - this.once("_promiseSlowoff", (i) => { - i ? s(i) : t([e]); - }); - }) - ); -} -var commands = { - action(e, t) { - return ( - (e = _$2.channel(e)), - (t = `ACTION ${t}`), - this._sendMessage(this._getPromiseDelay(), e, t, (s, i) => { - s([e, t]); - }) - ); - }, - ban(e, t, s) { - return ( - (e = _$2.channel(e)), - (t = _$2.username(t)), - (s = _$2.get(s, "")), - this._sendCommand(null, e, `/ban ${t} ${s}`, (i, n) => { - this.once("_promiseBan", (o) => { - o ? n(o) : i([e, t, s]); - }); - }) - ); - }, - clear(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/clear", (t, s) => { - this.once("_promiseClear", (i) => { - i ? s(i) : t([e]); - }); - }) - ); - }, - color(e, t) { - return ( - (t = _$2.get(t, e)), - this._sendCommand(null, "#tmijs", `/color ${t}`, (e, s) => { - this.once("_promiseColor", (i) => { - i ? s(i) : e([t]); - }); - }) - ); - }, - commercial(e, t) { - return ( - (e = _$2.channel(e)), - (t = _$2.get(t, 30)), - this._sendCommand(null, e, `/commercial ${t}`, (s, i) => { - this.once("_promiseCommercial", (n) => { - n ? i(n) : s([e, ~~t]); - }); - }) - ); - }, - deletemessage(e, t) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, `/delete ${t}`, (t, s) => { - this.once("_promiseDeletemessage", (i) => { - i ? s(i) : t([e]); - }); - }) - ); - }, - emoteonly(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/emoteonly", (t, s) => { - this.once("_promiseEmoteonly", (i) => { - i ? s(i) : t([e]); - }); - }) - ); - }, - emoteonlyoff(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/emoteonlyoff", (t, s) => { - this.once("_promiseEmoteonlyoff", (i) => { - i ? s(i) : t([e]); - }); - }) - ); - }, - followersonly: followersonly, - followersmode: followersonly, - followersonlyoff: followersonlyoff, - followersmodeoff: followersonlyoff, - host(e, t) { - return ( - (e = _$2.channel(e)), - (t = _$2.username(t)), - this._sendCommand(2e3, e, `/host ${t}`, (s, i) => { - this.once("_promiseHost", (n, o) => { - n ? i(n) : s([e, t, ~~o]); - }); - }) - ); - }, - join(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(void 0, null, `JOIN ${e}`, (t, s) => { - const i = "_promiseJoin"; - let n = !1; - const o = (r, a) => { - e === _$2.channel(a) && - (this.removeListener(i, o), (n = !0), r ? s(r) : t([e])); - }; - this.on(i, o); - const r = this._getPromiseDelay(); - _$2.promiseDelay(r).then(() => { - n || this.emit(i, "No response from Twitch.", e); - }); - }) - ); - }, - mod(e, t) { - return ( - (e = _$2.channel(e)), - (t = _$2.username(t)), - this._sendCommand(null, e, `/mod ${t}`, (s, i) => { - this.once("_promiseMod", (n) => { - n ? i(n) : s([e, t]); - }); - }) - ); - }, - mods(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/mods", (t, s) => { - this.once("_promiseMods", (i, n) => { - i - ? s(i) - : (n.forEach((t) => { - this.moderators[e] || (this.moderators[e] = []), - this.moderators[e].includes(t) || this.moderators[e].push(t); - }), - t(n)); - }); - }) - ); - }, - part: part, - leave: part, - ping() { - return this._sendCommand(null, null, "PING", (e, t) => { - (this.latency = new Date()), - (this.pingTimeout = setTimeout( - () => { - null !== this.ws && - ((this.wasCloseCalled = !1), - this.log.error("Ping timeout."), - this.ws.close(), - clearInterval(this.pingLoop), - clearTimeout(this.pingTimeout)); - }, - _$2.get(this.opts.connection.timeout, 9999) - )), - this.once("_promisePing", (t) => e([parseFloat(t)])); - }); - }, - r9kbeta: r9kbeta, - r9kmode: r9kbeta, - r9kbetaoff: r9kbetaoff, - r9kmodeoff: r9kbetaoff, - raw(e) { - return this._sendCommand(null, null, e, (t, s) => { - t([e]); - }); - }, - say(e, t) { - return ( - (e = _$2.channel(e)), - (t.startsWith(".") && !t.startsWith("..")) || - t.startsWith("/") || - t.startsWith("\\") - ? "me " === t.substr(1, 3) - ? this.action(e, t.substr(4)) - : this._sendCommand(null, e, t, (s, i) => { - s([e, t]); - }) - : this._sendMessage(this._getPromiseDelay(), e, t, (s, i) => { - s([e, t]); - }) - ); - }, - slow: slow, - slowmode: slow, - slowoff: slowoff, - slowmodeoff: slowoff, - subscribers(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/subscribers", (t, s) => { - this.once("_promiseSubscribers", (i) => { - i ? s(i) : t([e]); - }); - }) - ); - }, - subscribersoff(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/subscribersoff", (t, s) => { - this.once("_promiseSubscribersoff", (i) => { - i ? s(i) : t([e]); - }); - }) - ); - }, - timeout(e, t, s, i) { - return ( - (e = _$2.channel(e)), - (t = _$2.username(t)), - null === s || _$2.isInteger(s) || ((i = s), (s = 300)), - (s = _$2.get(s, 300)), - (i = _$2.get(i, "")), - this._sendCommand(null, e, `/timeout ${t} ${s} ${i}`, (n, o) => { - this.once("_promiseTimeout", (r) => { - r ? o(r) : n([e, t, ~~s, i]); - }); - }) - ); - }, - unban(e, t) { - return ( - (e = _$2.channel(e)), - (t = _$2.username(t)), - this._sendCommand(null, e, `/unban ${t}`, (s, i) => { - this.once("_promiseUnban", (n) => { - n ? i(n) : s([e, t]); - }); - }) - ); - }, - unhost(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(2e3, e, "/unhost", (t, s) => { - this.once("_promiseUnhost", (i) => { - i ? s(i) : t([e]); - }); - }) - ); - }, - unmod(e, t) { - return ( - (e = _$2.channel(e)), - (t = _$2.username(t)), - this._sendCommand(null, e, `/unmod ${t}`, (s, i) => { - this.once("_promiseUnmod", (n) => { - n ? i(n) : s([e, t]); - }); - }) - ); - }, - unvip(e, t) { - return ( - (e = _$2.channel(e)), - (t = _$2.username(t)), - this._sendCommand(null, e, `/unvip ${t}`, (s, i) => { - this.once("_promiseUnvip", (n) => { - n ? i(n) : s([e, t]); - }); - }) - ); - }, - vip(e, t) { - return ( - (e = _$2.channel(e)), - (t = _$2.username(t)), - this._sendCommand(null, e, `/vip ${t}`, (s, i) => { - this.once("_promiseVip", (n) => { - n ? i(n) : s([e, t]); - }); - }) - ); - }, - vips(e) { - return ( - (e = _$2.channel(e)), - this._sendCommand(null, e, "/vips", (e, t) => { - this.once("_promiseVips", (s, i) => { - s ? t(s) : e(i); - }); - }) - ); - }, - whisper(e, t) { - return (e = _$2.username(e)) === this.getUsername() - ? Promise.reject("Cannot send a whisper to the same account.") - : this._sendCommand(null, "#tmijs", `/w ${e} ${t}`, (e, t) => { - this.once("_promiseWhisper", (e) => { - e && t(e); - }); - }).catch((s) => { - if ( - s && - "string" == typeof s && - 0 !== s.indexOf("No response from Twitch.") - ) - throw s; - const i = _$2.channel(e), - n = Object.assign( - { - "message-type": "whisper", - "message-id": null, - "thread-id": null, - username: this.getUsername(), - }, - this.globaluserstate - ); - return ( - this.emits( - ["whisper", "message"], - [ - [i, n, t, !0], - [i, n, t, !0], - ] - ), - [e, t] - ); - }); - }, -}; -function EventEmitter() { - (this._events = this._events || {}), - (this._maxListeners = this._maxListeners || void 0); -} -var events = EventEmitter; -function isFunction(e) { - return "function" == typeof e; -} -function isNumber(e) { - return "number" == typeof e; -} -function isObject(e) { - return "object" == typeof e && null !== e; -} -function isUndefined(e) { - return void 0 === e; -} -(EventEmitter.EventEmitter = EventEmitter), - (EventEmitter.prototype._events = void 0), - (EventEmitter.prototype._maxListeners = void 0), - (EventEmitter.defaultMaxListeners = 10), - (EventEmitter.prototype.setMaxListeners = function (e) { - if (!isNumber(e) || e < 0 || isNaN(e)) - throw TypeError("n must be a positive number"); - return (this._maxListeners = e), this; - }), - (EventEmitter.prototype.emit = function (e) { - var t, s, i, n, o, r; - if ( - (this._events || (this._events = {}), - "error" === e && - (!this._events.error || - (isObject(this._events.error) && !this._events.error.length))) - ) { - if ((t = arguments[1]) instanceof Error) throw t; - throw TypeError('Uncaught, unspecified "error" event.'); - } - if (isUndefined((s = this._events[e]))) return !1; - if (isFunction(s)) - switch (arguments.length) { - case 1: - s.call(this); - break; - case 2: - s.call(this, arguments[1]); - break; - case 3: - s.call(this, arguments[1], arguments[2]); - break; - default: - (n = Array.prototype.slice.call(arguments, 1)), s.apply(this, n); - } - else if (isObject(s)) - for ( - n = Array.prototype.slice.call(arguments, 1), - i = (r = s.slice()).length, - o = 0; - o < i; - o++ - ) - r[o].apply(this, n); - return !0; - }), - (EventEmitter.prototype.addListener = function (e, t) { - var s; - if (!isFunction(t)) throw TypeError("listener must be a function"); - return ( - this._events || (this._events = {}), - this._events.newListener && - this.emit("newListener", e, isFunction(t.listener) ? t.listener : t), - this._events[e] - ? isObject(this._events[e]) - ? this._events[e].push(t) - : (this._events[e] = [this._events[e], t]) - : (this._events[e] = t), - isObject(this._events[e]) && - !this._events[e].warned && - (s = isUndefined(this._maxListeners) - ? EventEmitter.defaultMaxListeners - : this._maxListeners) && - s > 0 && - this._events[e].length > s && - ((this._events[e].warned = !0), - console.error( - "(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", - this._events[e].length - ), - "function" == typeof console.trace && console.trace()), - this - ); - }), - (EventEmitter.prototype.on = EventEmitter.prototype.addListener), - (EventEmitter.prototype.once = function (e, t) { - if (!isFunction(t)) throw TypeError("listener must be a function"); - var s = !1; - if (this._events.hasOwnProperty(e) && "_" === e.charAt(0)) { - var i = 1, - n = e; - for (var o in this._events) - this._events.hasOwnProperty(o) && o.startsWith(n) && i++; - e += i; - } - function r() { - "_" !== e.charAt(0) || - isNaN(e.substr(e.length - 1)) || - (e = e.substring(0, e.length - 1)), - this.removeListener(e, r), - s || ((s = !0), t.apply(this, arguments)); - } - return (r.listener = t), this.on(e, r), this; - }), - (EventEmitter.prototype.removeListener = function (e, t) { - var s, i, n, o; - if (!isFunction(t)) throw TypeError("listener must be a function"); - if (!this._events || !this._events[e]) return this; - if ( - ((n = (s = this._events[e]).length), - (i = -1), - s === t || (isFunction(s.listener) && s.listener === t)) - ) { - if ( - (delete this._events[e], - this._events.hasOwnProperty(e + "2") && "_" === e.charAt(0)) - ) { - var r = e; - for (var a in this._events) - this._events.hasOwnProperty(a) && - a.startsWith(r) && - (isNaN(parseInt(a.substr(a.length - 1))) || - ((this._events[e + parseInt(a.substr(a.length - 1) - 1)] = - this._events[a]), - delete this._events[a])); - (this._events[e] = this._events[e + "1"]), delete this._events[e + "1"]; - } - this._events.removeListener && this.emit("removeListener", e, t); - } else if (isObject(s)) { - for (o = n; o-- > 0; ) - if (s[o] === t || (s[o].listener && s[o].listener === t)) { - i = o; - break; - } - if (i < 0) return this; - 1 === s.length - ? ((s.length = 0), delete this._events[e]) - : s.splice(i, 1), - this._events.removeListener && this.emit("removeListener", e, t); - } - return this; - }), - (EventEmitter.prototype.removeAllListeners = function (e) { - var t, s; - if (!this._events) return this; - if (!this._events.removeListener) - return ( - 0 === arguments.length - ? (this._events = {}) - : this._events[e] && delete this._events[e], - this - ); - if (0 === arguments.length) { - for (t in this._events) - "removeListener" !== t && this.removeAllListeners(t); - return ( - this.removeAllListeners("removeListener"), (this._events = {}), this - ); - } - if (isFunction((s = this._events[e]))) this.removeListener(e, s); - else if (s) for (; s.length; ) this.removeListener(e, s[s.length - 1]); - return delete this._events[e], this; - }), - (EventEmitter.prototype.listeners = function (e) { - return this._events && this._events[e] - ? isFunction(this._events[e]) - ? [this._events[e]] - : this._events[e].slice() - : []; - }), - (EventEmitter.prototype.listenerCount = function (e) { - if (this._events) { - var t = this._events[e]; - if (isFunction(t)) return 1; - if (t) return t.length; - } - return 0; - }), - (EventEmitter.listenerCount = function (e, t) { - return e.listenerCount(t); - }); -const _$1 = utilsExports; -let currentLevel = "info"; -const levels = { trace: 0, debug: 1, info: 2, warn: 3, error: 4, fatal: 5 }; -function log(e) { - return function (t) { - levels[e] >= levels[currentLevel] && - console.log(`[${_$1.formatDate(new Date())}] ${e}: ${t}`); - }; -} -var logger = { - setLevel(e) { - currentLevel = e; - }, - trace: log("trace"), - debug: log("debug"), - info: log("info"), - warn: log("warn"), - error: log("error"), - fatal: log("fatal"), -}; -const _ = utilsExports, - nonspaceRegex = /\S+/g; -function parseComplexTag(e, t, s = ",", i = "/", n) { - const o = e[t]; - if (void 0 === o) return e; - const r = "string" == typeof o; - if (((e[t + "-raw"] = r ? o : null), !0 === o)) return (e[t] = null), e; - if (((e[t] = {}), r)) { - const r = o.split(s); - for (let s = 0; s < r.length; s++) { - const o = r[s].split(i); - let a = o[1]; - void 0 !== n && a && (a = a.split(n)), (e[t][o[0]] = a || null); - } - } - return e; -} -var parser = { - badges: (e) => parseComplexTag(e, "badges"), - badgeInfo: (e) => parseComplexTag(e, "badge-info"), - emotes: (e) => parseComplexTag(e, "emotes", "/", ":", ","), - emoteRegex(e, t, s, i) { - nonspaceRegex.lastIndex = 0; - const n = new RegExp("(\\b|^|\\s)" + _.unescapeHtml(t) + "(\\b|$|\\s)"); - let o; - for (; null !== (o = nonspaceRegex.exec(e)); ) - n.test(o[0]) && - ((i[s] = i[s] || []), - i[s].push([o.index, nonspaceRegex.lastIndex - 1])); - }, - emoteString(e, t, s, i) { - let n; - for (nonspaceRegex.lastIndex = 0; null !== (n = nonspaceRegex.exec(e)); ) - n[0] === _.unescapeHtml(t) && - ((i[s] = i[s] || []), - i[s].push([n.index, nonspaceRegex.lastIndex - 1])); - }, - transformEmotes(e) { - let t = ""; - return ( - Object.keys(e).forEach((s) => { - (t = `${t + s}:`), - e[s].forEach((e) => (t = `${t + e.join("-")},`)), - (t = `${t.slice(0, -1)}/`); - }), - t.slice(0, -1) - ); - }, - formTags(e) { - const t = []; - for (const s in e) { - const i = _.escapeIRC(e[s]); - t.push(`${s}=${i}`); - } - return `@${t.join(";")}`; - }, - msg(e) { - const t = { raw: e, tags: {}, prefix: null, command: null, params: [] }; - let s = 0, - i = 0; - if (64 === e.charCodeAt(0)) { - if (((i = e.indexOf(" ")), -1 === i)) return null; - const n = e.slice(1, i).split(";"); - for (let e = 0; e < n.length; e++) { - const s = n[e], - i = s.split("="); - t.tags[i[0]] = s.substring(s.indexOf("=") + 1) || !0; - } - s = i + 1; - } - for (; 32 === e.charCodeAt(s); ) s++; - if (58 === e.charCodeAt(s)) { - if (((i = e.indexOf(" ", s)), -1 === i)) return null; - for (t.prefix = e.slice(s + 1, i), s = i + 1; 32 === e.charCodeAt(s); ) - s++; - } - if (((i = e.indexOf(" ", s)), -1 === i)) - return e.length > s ? ((t.command = e.slice(s)), t) : null; - for (t.command = e.slice(s, i), s = i + 1; 32 === e.charCodeAt(s); ) s++; - for (; s < e.length; ) { - if (((i = e.indexOf(" ", s)), 58 === e.charCodeAt(s))) { - t.params.push(e.slice(s + 1)); - break; - } - if (-1 === i) { - if (-1 === i) { - t.params.push(e.slice(s)); - break; - } - } else - for (t.params.push(e.slice(s, i)), s = i + 1; 32 === e.charCodeAt(s); ) - s++; - } - return t; - }, -}; -class Queue { - constructor(e) { - (this.queue = []), - (this.index = 0), - (this.defaultDelay = void 0 === e ? 3e3 : e); - } - add(e, t) { - this.queue.push({ fn: e, delay: t }); - } - next() { - const e = this.index++, - t = this.queue[e]; - if (!t) return; - const s = this.queue[this.index]; - if ((t.fn(), s)) { - const e = void 0 === s.delay ? this.defaultDelay : s.delay; - setTimeout(() => this.next(), e); - } - } -} -var timer = Queue; -!(function (e) { - const t = - void 0 !== commonjsGlobal - ? commonjsGlobal - : "undefined" != typeof window - ? window - : {}, - s = t.WebSocket || require$$1, - i = t.fetch || require$$1, - n = api, - o = commands, - r = events.EventEmitter, - a = logger, - h = parser, - c = timer, - l = utilsExports; - let m = !1; - const d = function e(t) { - if (this instanceof e == 0) return new e(t); - (this.opts = l.get(t, {})), - (this.opts.channels = this.opts.channels || []), - (this.opts.connection = this.opts.connection || {}), - (this.opts.identity = this.opts.identity || {}), - (this.opts.options = this.opts.options || {}), - (this.clientId = l.get(this.opts.options.clientId, null)), - (this._globalDefaultChannel = l.channel( - l.get(this.opts.options.globalDefaultChannel, "#tmijs") - )), - (this._skipMembership = l.get(this.opts.options.skipMembership, !1)), - (this._skipUpdatingEmotesets = l.get( - this.opts.options.skipUpdatingEmotesets, - !1 - )), - (this._updateEmotesetsTimer = null), - (this._updateEmotesetsTimerDelay = l.get( - this.opts.options.updateEmotesetsTimer, - 6e4 - )), - (this.maxReconnectAttempts = l.get( - this.opts.connection.maxReconnectAttempts, - 1 / 0 - )), - (this.maxReconnectInterval = l.get( - this.opts.connection.maxReconnectInterval, - 3e4 - )), - (this.reconnect = l.get(this.opts.connection.reconnect, !0)), - (this.reconnectDecay = l.get(this.opts.connection.reconnectDecay, 1.5)), - (this.reconnectInterval = l.get( - this.opts.connection.reconnectInterval, - 1e3 - )), - (this.reconnecting = !1), - (this.reconnections = 0), - (this.reconnectTimer = this.reconnectInterval), - (this.secure = l.get( - this.opts.connection.secure, - !this.opts.connection.server && !this.opts.connection.port - )), - (this.emotes = ""), - (this.emotesets = {}), - (this.channels = []), - (this.currentLatency = 0), - (this.globaluserstate = {}), - (this.lastJoined = ""), - (this.latency = new Date()), - (this.moderators = {}), - (this.pingLoop = null), - (this.pingTimeout = null), - (this.reason = ""), - (this.username = ""), - (this.userstate = {}), - (this.wasCloseCalled = !1), - (this.ws = null); - let s = "error"; - this.opts.options.debug && (s = "info"), (this.log = this.opts.logger || a); - try { - a.setLevel(s); - } catch (i) {} - this.opts.channels.forEach((e, t, s) => (s[t] = l.channel(e))), - r.call(this), - this.setMaxListeners(0); - }; - l.inherits(d, r); - for (const u in o) d.prototype[u] = o[u]; - (d.prototype.emits = function (e, t) { - for (let s = 0; s < e.length; s++) { - const i = s < t.length ? t[s] : t[t.length - 1]; - this.emit.apply(this, [e[s]].concat(i)); - } - }), - (d.prototype.api = function (...e) { - m || - (this.log.warn( - "Client.prototype.api is deprecated and will be removed for version 2.0.0" - ), - (m = !0)), - n(...e); - }), - (d.prototype.handleMessage = function (e) { - if (!e) return; - this.listenerCount("raw_message") && - this.emit("raw_message", JSON.parse(JSON.stringify(e)), e); - const t = l.channel(l.get(e.params[0], null)); - let s = l.get(e.params[1], null); - const i = l.get(e.tags["msg-id"], null), - n = (e.tags = h.badges(h.badgeInfo(h.emotes(e.tags)))); - for (const o in n) { - if ("emote-sets" === o || "ban-duration" === o || "bits" === o) - continue; - let e = n[o]; - "boolean" == typeof e - ? (e = null) - : "1" === e - ? (e = !0) - : "0" === e - ? (e = !1) - : "string" == typeof e && (e = l.unescapeIRC(e)), - (n[o] = e); - } - if (null === e.prefix) - switch (e.command) { - case "PING": - this.emit("ping"), this._isConnected() && this.ws.send("PONG"); - break; - case "PONG": { - const e = new Date(); - (this.currentLatency = - (e.getTime() - this.latency.getTime()) / 1e3), - this.emits(["pong", "_promisePing"], [[this.currentLatency]]), - clearTimeout(this.pingTimeout); - break; - } - default: - this.log.warn( - `Could not parse message with no prefix:\n${JSON.stringify( - e, - null, - 4 - )}` - ); - } - else if ("tmi.twitch.tv" === e.prefix) - switch (e.command) { - case "002": - case "003": - case "004": - case "372": - case "375": - case "CAP": - case "SERVERCHANGE": - break; - case "001": - this.username = e.params[0]; - break; - case "376": { - this.log.info("Connected to server."), - (this.userstate[this._globalDefaultChannel] = {}), - this.emits( - ["connected", "_promiseConnect"], - [[this.server, this.port], [null]] - ), - (this.reconnections = 0), - (this.reconnectTimer = this.reconnectInterval), - (this.pingLoop = setInterval(() => { - this._isConnected() && this.ws.send("PING"), - (this.latency = new Date()), - (this.pingTimeout = setTimeout( - () => { - null !== this.ws && - ((this.wasCloseCalled = !1), - this.log.error("Ping timeout."), - this.ws.close(), - clearInterval(this.pingLoop), - clearTimeout(this.pingTimeout), - clearTimeout(this._updateEmotesetsTimer)); - }, - l.get(this.opts.connection.timeout, 9999) - )); - }, 6e4)); - let e = l.get(this.opts.options.joinInterval, 2e3); - e < 300 && (e = 300); - const t = new c(e), - s = [...new Set([...this.opts.channels, ...this.channels])]; - this.channels = []; - for (let i = 0; i < s.length; i++) { - const e = s[i]; - t.add(() => { - this._isConnected() && - this.join(e).catch((e) => this.log.error(e)); - }); - } - t.next(); - break; - } - case "NOTICE": { - const n = [null], - o = [t, i, s], - r = [t, !0], - a = [t, !1], - h = [o, n], - c = [o, [i]], - l = `[${t}] ${s}`; - switch (i) { - case "subs_on": - this.log.info( - `[${t}] This room is now in subscribers-only mode.` - ), - this.emits( - ["subscriber", "subscribers", "_promiseSubscribers"], - [r, r, n] - ); - break; - case "subs_off": - this.log.info( - `[${t}] This room is no longer in subscribers-only mode.` - ), - this.emits( - ["subscriber", "subscribers", "_promiseSubscribersoff"], - [a, a, n] - ); - break; - case "emote_only_on": - this.log.info(`[${t}] This room is now in emote-only mode.`), - this.emits(["emoteonly", "_promiseEmoteonly"], [r, n]); - break; - case "emote_only_off": - this.log.info( - `[${t}] This room is no longer in emote-only mode.` - ), - this.emits(["emoteonly", "_promiseEmoteonlyoff"], [a, n]); - break; - case "slow_on": - case "slow_off": - case "followers_on_zero": - case "followers_on": - case "followers_off": - case "host_on": - case "host_off": - break; - case "r9k_on": - this.log.info(`[${t}] This room is now in r9k mode.`), - this.emits( - ["r9kmode", "r9kbeta", "_promiseR9kbeta"], - [r, r, n] - ); - break; - case "r9k_off": - this.log.info(`[${t}] This room is no longer in r9k mode.`), - this.emits( - ["r9kmode", "r9kbeta", "_promiseR9kbetaoff"], - [a, a, n] - ); - break; - case "room_mods": { - const e = s.split(": "), - i = (e.length > 1 ? e[1] : "") - .toLowerCase() - .split(", ") - .filter((e) => e); - this.emits( - ["_promiseMods", "mods"], - [ - [null, i], - [t, i], - ] - ); - break; - } - case "no_mods": - this.emits( - ["_promiseMods", "mods"], - [ - [null, []], - [t, []], - ] - ); - break; - case "vips_success": { - s.endsWith(".") && (s = s.slice(0, -1)); - const e = s.split(": "), - i = (e.length > 1 ? e[1] : "") - .toLowerCase() - .split(", ") - .filter((e) => e); - this.emits( - ["_promiseVips", "vips"], - [ - [null, i], - [t, i], - ] - ); - break; - } - case "no_vips": - this.emits( - ["_promiseVips", "vips"], - [ - [null, []], - [t, []], - ] - ); - break; - case "already_banned": - case "bad_ban_admin": - case "bad_ban_anon": - case "bad_ban_broadcaster": - case "bad_ban_global_mod": - case "bad_ban_mod": - case "bad_ban_self": - case "bad_ban_staff": - case "usage_ban": - this.log.info(l), this.emits(["notice", "_promiseBan"], c); - break; - case "ban_success": - this.log.info(l), this.emits(["notice", "_promiseBan"], h); - break; - case "usage_clear": - this.log.info(l), this.emits(["notice", "_promiseClear"], c); - break; - case "usage_mods": - this.log.info(l), - this.emits(["notice", "_promiseMods"], [o, [i, []]]); - break; - case "mod_success": - this.log.info(l), this.emits(["notice", "_promiseMod"], h); - break; - case "usage_vips": - this.log.info(l), - this.emits(["notice", "_promiseVips"], [o, [i, []]]); - break; - case "usage_vip": - case "bad_vip_grantee_banned": - case "bad_vip_grantee_already_vip": - case "bad_vip_max_vips_reached": - case "bad_vip_achievement_incomplete": - this.log.info(l), - this.emits(["notice", "_promiseVip"], [o, [i, []]]); - break; - case "vip_success": - this.log.info(l), this.emits(["notice", "_promiseVip"], h); - break; - case "usage_mod": - case "bad_mod_banned": - case "bad_mod_mod": - this.log.info(l), this.emits(["notice", "_promiseMod"], c); - break; - case "unmod_success": - this.log.info(l), this.emits(["notice", "_promiseUnmod"], h); - break; - case "unvip_success": - this.log.info(l), this.emits(["notice", "_promiseUnvip"], h); - break; - case "usage_unmod": - case "bad_unmod_mod": - this.log.info(l), this.emits(["notice", "_promiseUnmod"], c); - break; - case "usage_unvip": - case "bad_unvip_grantee_not_vip": - this.log.info(l), this.emits(["notice", "_promiseUnvip"], c); - break; - case "color_changed": - this.log.info(l), this.emits(["notice", "_promiseColor"], h); - break; - case "usage_color": - case "turbo_only_color": - this.log.info(l), this.emits(["notice", "_promiseColor"], c); - break; - case "commercial_success": - this.log.info(l), - this.emits(["notice", "_promiseCommercial"], h); - break; - case "usage_commercial": - case "bad_commercial_error": - this.log.info(l), - this.emits(["notice", "_promiseCommercial"], c); - break; - case "hosts_remaining": { - this.log.info(l); - const e = isNaN(s[0]) ? 0 : parseInt(s[0]); - this.emits(["notice", "_promiseHost"], [o, [null, ~~e]]); - break; - } - case "bad_host_hosting": - case "bad_host_rate_exceeded": - case "bad_host_error": - case "usage_host": - this.log.info(l), - this.emits(["notice", "_promiseHost"], [o, [i, null]]); - break; - case "already_r9k_on": - case "usage_r9k_on": - this.log.info(l), this.emits(["notice", "_promiseR9kbeta"], c); - break; - case "already_r9k_off": - case "usage_r9k_off": - this.log.info(l), - this.emits(["notice", "_promiseR9kbetaoff"], c); - break; - case "timeout_success": - this.log.info(l), this.emits(["notice", "_promiseTimeout"], h); - break; - case "delete_message_success": - this.log.info(`[${t} ${s}]`), - this.emits(["notice", "_promiseDeletemessage"], h); - break; - case "already_subs_off": - case "usage_subs_off": - this.log.info(l), - this.emits(["notice", "_promiseSubscribersoff"], c); - break; - case "already_subs_on": - case "usage_subs_on": - this.log.info(l), - this.emits(["notice", "_promiseSubscribers"], c); - break; - case "already_emote_only_off": - case "usage_emote_only_off": - this.log.info(l), - this.emits(["notice", "_promiseEmoteonlyoff"], c); - break; - case "already_emote_only_on": - case "usage_emote_only_on": - this.log.info(l), - this.emits(["notice", "_promiseEmoteonly"], c); - break; - case "usage_slow_on": - this.log.info(l), this.emits(["notice", "_promiseSlow"], c); - break; - case "usage_slow_off": - this.log.info(l), this.emits(["notice", "_promiseSlowoff"], c); - break; - case "usage_timeout": - case "bad_timeout_admin": - case "bad_timeout_anon": - case "bad_timeout_broadcaster": - case "bad_timeout_duration": - case "bad_timeout_global_mod": - case "bad_timeout_mod": - case "bad_timeout_self": - case "bad_timeout_staff": - this.log.info(l), this.emits(["notice", "_promiseTimeout"], c); - break; - case "untimeout_success": - case "unban_success": - this.log.info(l), this.emits(["notice", "_promiseUnban"], h); - break; - case "usage_unban": - case "bad_unban_no_ban": - this.log.info(l), this.emits(["notice", "_promiseUnban"], c); - break; - case "usage_delete": - case "bad_delete_message_error": - case "bad_delete_message_broadcaster": - case "bad_delete_message_mod": - this.log.info(l), - this.emits(["notice", "_promiseDeletemessage"], c); - break; - case "usage_unhost": - case "not_hosting": - this.log.info(l), this.emits(["notice", "_promiseUnhost"], c); - break; - case "whisper_invalid_login": - case "whisper_invalid_self": - case "whisper_limit_per_min": - case "whisper_limit_per_sec": - case "whisper_restricted": - case "whisper_restricted_recipient": - this.log.info(l), this.emits(["notice", "_promiseWhisper"], c); - break; - case "no_permission": - case "msg_banned": - case "msg_room_not_found": - case "msg_channel_suspended": - case "tos_ban": - case "invalid_user": - this.log.info(l), - this.emits( - [ - "notice", - "_promiseBan", - "_promiseClear", - "_promiseUnban", - "_promiseTimeout", - "_promiseDeletemessage", - "_promiseMods", - "_promiseMod", - "_promiseUnmod", - "_promiseVips", - "_promiseVip", - "_promiseUnvip", - "_promiseCommercial", - "_promiseHost", - "_promiseUnhost", - "_promiseJoin", - "_promisePart", - "_promiseR9kbeta", - "_promiseR9kbetaoff", - "_promiseSlow", - "_promiseSlowoff", - "_promiseFollowers", - "_promiseFollowersoff", - "_promiseSubscribers", - "_promiseSubscribersoff", - "_promiseEmoteonly", - "_promiseEmoteonlyoff", - "_promiseWhisper", - ], - [o, [i, t]] - ); - break; - case "msg_rejected": - case "msg_rejected_mandatory": - this.log.info(l), this.emit("automod", t, i, s); - break; - case "unrecognized_cmd": - case "cmds_available": - case "host_target_went_offline": - case "msg_censored_broadcaster": - case "msg_duplicate": - case "msg_emoteonly": - case "msg_verified_email": - case "msg_ratelimit": - case "msg_subsonly": - case "msg_timedout": - case "msg_bad_characters": - case "msg_channel_blocked": - case "msg_facebook": - case "msg_followersonly": - case "msg_followersonly_followed": - case "msg_followersonly_zero": - case "msg_slowmode": - case "msg_suspended": - case "no_help": - case "usage_disconnect": - case "usage_help": - case "usage_me": - case "unavailable_command": - this.log.info(l), this.emit("notice", t, i, s); - break; - default: - s.includes("Login unsuccessful") || - s.includes("Login authentication failed") || - s.includes("Error logging in") || - s.includes("Improperly formatted auth") - ? ((this.wasCloseCalled = !1), - (this.reconnect = !1), - (this.reason = s), - this.log.error(this.reason), - this.ws.close()) - : s.includes("Invalid NICK") - ? ((this.wasCloseCalled = !1), - (this.reconnect = !1), - (this.reason = "Invalid NICK."), - this.log.error(this.reason), - this.ws.close()) - : (this.log.warn( - `Could not parse NOTICE from tmi.twitch.tv:\n${JSON.stringify( - e, - null, - 4 - )}` - ), - this.emit("notice", t, i, s)); - } - break; - } - case "USERNOTICE": { - const e = n["display-name"] || n.login, - o = n["msg-param-sub-plan"] || "", - r = - l.unescapeIRC(l.get(n["msg-param-sub-plan-name"], "")) || null, - a = { prime: o.includes("Prime"), plan: o, planName: r }, - h = ~~(n["msg-param-streak-months"] || 0), - c = - n["msg-param-recipient-display-name"] || - n["msg-param-recipient-user-name"], - m = ~~n["msg-param-mass-gift-count"]; - switch (((n["message-type"] = i), i)) { - case "resub": - this.emits(["resub", "subanniversary"], [[t, e, h, s, n, a]]); - break; - case "sub": - this.emits(["subscription", "sub"], [[t, e, a, s, n]]); - break; - case "subgift": - this.emit("subgift", t, e, h, c, a, n); - break; - case "anonsubgift": - this.emit("anonsubgift", t, h, c, a, n); - break; - case "submysterygift": - this.emit("submysterygift", t, e, m, a, n); - break; - case "anonsubmysterygift": - this.emit("anonsubmysterygift", t, m, a, n); - break; - case "primepaidupgrade": - this.emit("primepaidupgrade", t, e, a, n); - break; - case "giftpaidupgrade": { - const s = - n["msg-param-sender-name"] || n["msg-param-sender-login"]; - this.emit("giftpaidupgrade", t, e, s, n); - break; - } - case "anongiftpaidupgrade": - this.emit("anongiftpaidupgrade", t, e, n); - break; - case "raid": { - const e = n["msg-param-displayName"] || n["msg-param-login"], - s = +n["msg-param-viewerCount"]; - this.emit("raided", t, e, s, n); - break; - } - case "ritual": { - const i = n["msg-param-ritual-name"]; - "new_chatter" === i - ? this.emit("newchatter", t, e, n, s) - : this.emit("ritual", i, t, e, n, s); - break; - } - default: - this.emit("usernotice", i, t, n, s); - } - break; - } - case "HOSTTARGET": { - const e = s.split(" "), - i = ~~e[1] || 0; - "-" === e[0] - ? (this.log.info(`[${t}] Exited host mode.`), - this.emits(["unhost", "_promiseUnhost"], [[t, i], [null]])) - : (this.log.info( - `[${t}] Now hosting ${e[0]} for ${i} viewer(s).` - ), - this.emit("hosting", t, e[0], i)); - break; - } - case "CLEARCHAT": - if (e.params.length > 1) { - const i = l.get(e.tags["ban-duration"], null); - null === i - ? (this.log.info(`[${t}] ${s} has been banned.`), - this.emit("ban", t, s, null, e.tags)) - : (this.log.info( - `[${t}] ${s} has been timed out for ${i} seconds.` - ), - this.emit("timeout", t, s, null, ~~i, e.tags)); - } else - this.log.info(`[${t}] Chat was cleared by a moderator.`), - this.emits(["clearchat", "_promiseClear"], [[t], [null]]); - break; - case "CLEARMSG": - if (e.params.length > 1) { - const e = s, - i = n.login; - (n["message-type"] = "messagedeleted"), - this.log.info(`[${t}] ${i}'s message has been deleted.`), - this.emit("messagedeleted", t, i, e, n); - } - break; - case "RECONNECT": - this.log.info("Received RECONNECT request from Twitch.."), - this.log.info( - `Disconnecting and reconnecting in ${Math.round( - this.reconnectTimer / 1e3 - )} seconds..` - ), - this.disconnect().catch((e) => this.log.error(e)), - setTimeout( - () => this.connect().catch((e) => this.log.error(e)), - this.reconnectTimer - ); - break; - case "USERSTATE": - (e.tags.username = this.username), - "mod" === e.tags["user-type"] && - (this.moderators[t] || (this.moderators[t] = []), - this.moderators[t].includes(this.username) || - this.moderators[t].push(this.username)), - l.isJustinfan(this.getUsername()) || - this.userstate[t] || - ((this.userstate[t] = n), - (this.lastJoined = t), - this.channels.push(t), - this.log.info(`Joined ${t}`), - this.emit("join", t, l.username(this.getUsername()), !0)), - e.tags["emote-sets"] !== this.emotes && - this._updateEmoteset(e.tags["emote-sets"]), - (this.userstate[t] = n); - break; - case "GLOBALUSERSTATE": - (this.globaluserstate = n), - this.emit("globaluserstate", n), - void 0 !== e.tags["emote-sets"] && - this._updateEmoteset(e.tags["emote-sets"]); - break; - case "ROOMSTATE": - if ( - (l.channel(this.lastJoined) === t && - this.emit("_promiseJoin", null, t), - (e.tags.channel = t), - this.emit("roomstate", t, e.tags), - !l.hasOwn(e.tags, "subs-only")) - ) { - if (l.hasOwn(e.tags, "slow")) - if ("boolean" != typeof e.tags.slow || e.tags.slow) { - const s = [t, !0, ~~e.tags.slow]; - this.log.info(`[${t}] This room is now in slow mode.`), - this.emits( - ["slow", "slowmode", "_promiseSlow"], - [s, s, [null]] - ); - } else { - const e = [t, !1, 0]; - this.log.info(`[${t}] This room is no longer in slow mode.`), - this.emits( - ["slow", "slowmode", "_promiseSlowoff"], - [e, e, [null]] - ); - } - if (l.hasOwn(e.tags, "followers-only")) - if ("-1" === e.tags["followers-only"]) { - const e = [t, !1, 0]; - this.log.info( - `[${t}] This room is no longer in followers-only mode.` - ), - this.emits( - [ - "followersonly", - "followersmode", - "_promiseFollowersoff", - ], - [e, e, [null]] - ); - } else { - const s = [t, !0, ~~e.tags["followers-only"]]; - this.log.info( - `[${t}] This room is now in follower-only mode.` - ), - this.emits( - ["followersonly", "followersmode", "_promiseFollowers"], - [s, s, [null]] - ); - } - } - break; - default: - this.log.warn( - `Could not parse message from tmi.twitch.tv:\n${JSON.stringify( - e, - null, - 4 - )}` - ); - } - else if ("jtv" === e.prefix) - "MODE" === e.command - ? "+o" === s - ? (this.moderators[t] || (this.moderators[t] = []), - this.moderators[t].includes(e.params[2]) || - this.moderators[t].push(e.params[2]), - this.emit("mod", t, e.params[2])) - : "-o" === s && - (this.moderators[t] || (this.moderators[t] = []), - this.moderators[t].filter((t) => t !== e.params[2]), - this.emit("unmod", t, e.params[2])) - : this.log.warn( - `Could not parse message from jtv:\n${JSON.stringify(e, null, 4)}` - ); - else - switch (e.command) { - case "353": - this.emit("names", e.params[2], e.params[3].split(" ")); - break; - case "366": - break; - case "JOIN": { - const s = e.prefix.split("!")[0]; - l.isJustinfan(this.getUsername()) && - this.username === s && - ((this.lastJoined = t), - this.channels.push(t), - this.log.info(`Joined ${t}`), - this.emit("join", t, s, !0)), - this.username !== s && this.emit("join", t, s, !1); - break; - } - case "PART": { - let s = !1; - const i = e.prefix.split("!")[0]; - if (this.username === i) { - (s = !0), this.userstate[t] && delete this.userstate[t]; - let e = this.channels.indexOf(t); - -1 !== e && this.channels.splice(e, 1), - (e = this.opts.channels.indexOf(t)), - -1 !== e && this.opts.channels.splice(e, 1), - this.log.info(`Left ${t}`), - this.emit("_promisePart", null); - } - this.emit("part", t, i, s); - break; - } - case "WHISPER": { - const t = e.prefix.split("!")[0]; - this.log.info(`[WHISPER] <${t}>: ${s}`), - l.hasOwn(e.tags, "username") || (e.tags.username = t), - (e.tags["message-type"] = "whisper"); - const i = l.channel(e.tags.username); - this.emits(["whisper", "message"], [[i, e.tags, s, !1]]); - break; - } - case "PRIVMSG": - if ( - ((e.tags.username = e.prefix.split("!")[0]), - "jtv" === e.tags.username) - ) { - const e = l.username(s.split(" ")[0]), - i = s.includes("auto"); - if (s.includes("hosting you for")) { - const n = l.extractNumber(s); - this.emit("hosted", t, e, n, i); - } else - s.includes("hosting you") && this.emit("hosted", t, e, 0, i); - } else { - const i = l.get(this.opts.options.messagesLogLevel, "info"), - n = l.actionMessage(s); - if ( - ((e.tags["message-type"] = n ? "action" : "chat"), - (s = n ? n[1] : s), - l.hasOwn(e.tags, "bits")) - ) - this.emit("cheer", t, e.tags, s); - else { - if (l.hasOwn(e.tags, "msg-id")) { - if ("highlighted-message" === e.tags["msg-id"]) { - const i = e.tags["msg-id"]; - this.emit("redeem", t, e.tags.username, i, e.tags, s); - } else if ("skip-subs-mode-message" === e.tags["msg-id"]) { - const i = e.tags["msg-id"]; - this.emit("redeem", t, e.tags.username, i, e.tags, s); - } - } else if (l.hasOwn(e.tags, "custom-reward-id")) { - const i = e.tags["custom-reward-id"]; - this.emit("redeem", t, e.tags.username, i, e.tags, s); - } - n - ? (this.log[i](`[${t}] *<${e.tags.username}>: ${s}`), - this.emits(["action", "message"], [[t, e.tags, s, !1]])) - : (this.log[i](`[${t}] <${e.tags.username}>: ${s}`), - this.emits(["chat", "message"], [[t, e.tags, s, !1]])); - } - } - break; - default: - this.log.warn( - `Could not parse message:\n${JSON.stringify(e, null, 4)}` - ); - } - }), - (d.prototype.connect = function () { - return new Promise((e, t) => { - (this.server = l.get( - this.opts.connection.server, - "irc-ws.chat.twitch.tv" - )), - (this.port = l.get(this.opts.connection.port, 80)), - this.secure && (this.port = 443), - 443 === this.port && (this.secure = !0), - (this.reconnectTimer = this.reconnectTimer * this.reconnectDecay), - this.reconnectTimer >= this.maxReconnectInterval && - (this.reconnectTimer = this.maxReconnectInterval), - this._openConnection(), - this.once("_promiseConnect", (s) => { - s ? t(s) : e([this.server, ~~this.port]); - }); - }); - }), - (d.prototype._openConnection = function () { - const e = `${this.secure ? "wss" : "ws"}://${this.server}:${this.port}/`, - t = {}; - "agent" in this.opts.connection && (t.agent = this.opts.connection.agent), - (this.ws = new s(e, "irc", t)), - (this.ws.onmessage = this._onMessage.bind(this)), - (this.ws.onerror = this._onError.bind(this)), - (this.ws.onclose = this._onClose.bind(this)), - (this.ws.onopen = this._onOpen.bind(this)); - }), - (d.prototype._onOpen = function () { - this._isConnected() && - (this.log.info(`Connecting to ${this.server} on port ${this.port}..`), - this.emit("connecting", this.server, ~~this.port), - (this.username = l.get(this.opts.identity.username, l.justinfan())), - this._getToken() - .then((e) => { - const t = l.password(e); - this.log.info("Sending authentication to server.."), - this.emit("logon"); - let s = "twitch.tv/tags twitch.tv/commands"; - this._skipMembership || (s += " twitch.tv/membership"), - this.ws.send("CAP REQ :" + s), - t - ? this.ws.send(`PASS ${t}`) - : l.isJustinfan(this.username) && - this.ws.send("PASS SCHMOOPIIE"), - this.ws.send(`NICK ${this.username}`); - }) - .catch((e) => { - this.emits( - ["_promiseConnect", "disconnected"], - [[e], ["Could not get a token."]] - ); - })); - }), - (d.prototype._getToken = function () { - const e = this.opts.identity.password; - let t; - return "function" == typeof e - ? ((t = e()), t instanceof Promise ? t : Promise.resolve(t)) - : Promise.resolve(e); - }), - (d.prototype._onMessage = function (e) { - e.data - .trim() - .split("\r\n") - .forEach((e) => { - const t = h.msg(e); - t && this.handleMessage(t); - }); - }), - (d.prototype._onError = function () { - (this.moderators = {}), - (this.userstate = {}), - (this.globaluserstate = {}), - clearInterval(this.pingLoop), - clearTimeout(this.pingTimeout), - clearTimeout(this._updateEmotesetsTimer), - (this.reason = - null === this.ws ? "Connection closed." : "Unable to connect."), - this.emits(["_promiseConnect", "disconnected"], [[this.reason]]), - this.reconnect && - this.reconnections === this.maxReconnectAttempts && - (this.emit("maxreconnect"), - this.log.error("Maximum reconnection attempts reached.")), - this.reconnect && - !this.reconnecting && - this.reconnections <= this.maxReconnectAttempts - 1 && - ((this.reconnecting = !0), - (this.reconnections = this.reconnections + 1), - this.log.error( - `Reconnecting in ${Math.round(this.reconnectTimer / 1e3)} seconds..` - ), - this.emit("reconnect"), - setTimeout(() => { - (this.reconnecting = !1), - this.connect().catch((e) => this.log.error(e)); - }, this.reconnectTimer)), - (this.ws = null); - }), - (d.prototype._onClose = function () { - (this.moderators = {}), - (this.userstate = {}), - (this.globaluserstate = {}), - clearInterval(this.pingLoop), - clearTimeout(this.pingTimeout), - clearTimeout(this._updateEmotesetsTimer), - this.wasCloseCalled - ? ((this.wasCloseCalled = !1), - (this.reason = "Connection closed."), - this.log.info(this.reason), - this.emits( - ["_promiseConnect", "_promiseDisconnect", "disconnected"], - [[this.reason], [null], [this.reason]] - )) - : (this.emits(["_promiseConnect", "disconnected"], [[this.reason]]), - this.reconnect && - this.reconnections === this.maxReconnectAttempts && - (this.emit("maxreconnect"), - this.log.error("Maximum reconnection attempts reached.")), - this.reconnect && - !this.reconnecting && - this.reconnections <= this.maxReconnectAttempts - 1 && - ((this.reconnecting = !0), - (this.reconnections = this.reconnections + 1), - this.log.error( - `Could not connect to server. Reconnecting in ${Math.round( - this.reconnectTimer / 1e3 - )} seconds..` - ), - this.emit("reconnect"), - setTimeout(() => { - (this.reconnecting = !1), - this.connect().catch((e) => this.log.error(e)); - }, this.reconnectTimer))), - (this.ws = null); - }), - (d.prototype._getPromiseDelay = function () { - return this.currentLatency <= 600 ? 600 : this.currentLatency + 100; - }), - (d.prototype._sendCommand = function (e, t, s, i) { - return new Promise((n, o) => { - if (!this._isConnected()) return o("Not connected to server."); - if ( - ((null !== e && "number" != typeof e) || - (null === e && (e = this._getPromiseDelay()), - l.promiseDelay(e).then(() => o("No response from Twitch."))), - null !== t) - ) { - const e = l.channel(t); - this.log.info(`[${e}] Executing command: ${s}`), - this.ws.send(`PRIVMSG ${e} :${s}`); - } else this.log.info(`Executing command: ${s}`), this.ws.send(s); - "function" == typeof i ? i(n, o) : n(); - }); - }), - (d.prototype._sendMessage = function (e, t, s, i) { - return new Promise((n, o) => { - if (!this._isConnected()) return o("Not connected to server."); - if (l.isJustinfan(this.getUsername())) - return o("Cannot send anonymous messages."); - const r = l.channel(t); - if ((this.userstate[r] || (this.userstate[r] = {}), s.length >= 500)) { - const i = l.splitLine(s, 500); - (s = i[0]), - setTimeout(() => { - this._sendMessage(e, t, i[1], () => {}); - }, 350); - } - this.ws.send(`PRIVMSG ${r} :${s}`); - const a = {}; - Object.keys(this.emotesets).forEach((e) => - this.emotesets[e].forEach((e) => - (l.isRegex(e.code) ? h.emoteRegex : h.emoteString)( - s, - e.code, - e.id, - a - ) - ) - ); - const c = Object.assign( - this.userstate[r], - h.emotes({ emotes: h.transformEmotes(a) || null }) - ), - m = l.get(this.opts.options.messagesLogLevel, "info"), - d = l.actionMessage(s); - d - ? ((c["message-type"] = "action"), - this.log[m](`[${r}] *<${this.getUsername()}>: ${d[1]}`), - this.emits(["action", "message"], [[r, c, d[1], !0]])) - : ((c["message-type"] = "chat"), - this.log[m](`[${r}] <${this.getUsername()}>: ${s}`), - this.emits(["chat", "message"], [[r, c, s, !0]])), - "function" == typeof i ? i(n, o) : n(); - }); - }), - (d.prototype._updateEmoteset = function (e) { - let t = void 0 !== e; - if ( - (t && (e === this.emotes ? (t = !1) : (this.emotes = e)), - this._skipUpdatingEmotesets) - ) - return void (t && this.emit("emotesets", e, {})); - const s = () => { - this._updateEmotesetsTimerDelay > 0 && - (clearTimeout(this._updateEmotesetsTimer), - (this._updateEmotesetsTimer = setTimeout( - () => this._updateEmoteset(e), - this._updateEmotesetsTimerDelay - ))); - }; - this._getToken() - .then((t) => { - const s = `https://api.twitch.tv/kraken/chat/emoticon_images?emotesets=${e}`, - n = {}; - return ( - "fetchAgent" in this.opts.connection && - (n.agent = this.opts.connection.fetchAgent), - i(s, { - ...n, - headers: { - Accept: "application/vnd.twitchtv.v5+json", - Authorization: `OAuth ${l.token(t)}`, - "Client-ID": this.clientId, - }, - }) - ); - }) - .then((e) => e.json()) - .then((t) => { - (this.emotesets = t.emoticon_sets || {}), - this.emit("emotesets", e, this.emotesets), - s(); - }) - .catch(() => s()); - }), - (d.prototype.getUsername = function () { - return this.username; - }), - (d.prototype.getOptions = function () { - return this.opts; - }), - (d.prototype.getChannels = function () { - return this.channels; - }), - (d.prototype.isMod = function (e, t) { - const s = l.channel(e); - return ( - this.moderators[s] || (this.moderators[s] = []), - this.moderators[s].includes(l.username(t)) - ); - }), - (d.prototype.readyState = function () { - return null === this.ws - ? "CLOSED" - : ["CONNECTING", "OPEN", "CLOSING", "CLOSED"][this.ws.readyState]; - }), - (d.prototype._isConnected = function () { - return null !== this.ws && 1 === this.ws.readyState; - }), - (d.prototype.disconnect = function () { - return new Promise((e, t) => { - null !== this.ws && 3 !== this.ws.readyState - ? ((this.wasCloseCalled = !0), - this.log.info("Disconnecting from server.."), - this.ws.close(), - this.once("_promiseDisconnect", () => - e([this.server, ~~this.port]) - )) - : (this.log.error( - "Cannot disconnect from server. Socket is not opened or connection is already closing." - ), - t( - "Cannot disconnect from server. Socket is not opened or connection is already closing." - )); - }); - }), - (d.prototype.off = d.prototype.removeListener), - e.exports && (e.exports = d), - "undefined" != typeof window && (window.tmi = { client: d, Client: d }); -})(client$1); -var clientExports = client$1.exports; -const client = clientExports; -var tmi_js = { client: client, Client: client }; -const tmi = getDefaultExportFromCjs(tmi_js); -class Chat { - constructor(e, t, s, i) { - (this.scene = e), (this._username = t), (this._password = s); - const n = new URLSearchParams(window.location.search); - (this.channel = n.get("channel") || "devdiaries"), - (this.feedback = "1" == n.get("feedback")), - (this.maxPlayers = this.isValidNumberWithMax(n.get("maxplayers")) - ? +n.get("maxplayers") - : 500), - this.init(); - } - init() { - console.log( - "Chat channel: ", - this.channel, - "feedback: ", - this.feedback, - "maxPlayers: ", - this.maxPlayers - ), - (this.client = new tmi.Client({ - options: { debug: !1 }, - channels: [this.channel], - })), - this.client - .connect() - .then((e) => { - console.log("Connected!, loading game"), this.scene.loadGame(); - }) - .catch(console.error), - this.setOnJoinListener(), - this.setOnMessageListener(), - this.setOnChatListener; - } - setOnJoinListener() { - this.client.on("join", (e, t, s) => { - console.log("Somebody joined the chat: ", e, t), - s && this.scene.addPlayer(t); - }); - } - setOnMessageListener() { - this.client.on("message", (e, t, s, i) => { - console.log(`Message: ${t.username} just ${s}`), - this.processMessage(t.username, s); - }); - } - setOnChatListener() { - this.client.on("chat", async (e, t, s, i) => { - t.mod; - const n = s.toLowerCase().split(" "); - console.log("Received chat: ", e, t, n), - this.processMessage(t["display-name"], s); - }); - } - processMessage(e, t) { - this.isValidNumber(t) && this.scene.guess(e, +t); - } - sendAction(e, t) { - console.log("Sending action: ", this.feedback, e, t), - this.feedback && this.client.action(e, t); - } - say(e) { - this.feedback && this.client.say(this.channel, e); - } - isValidNumberWithMax(e, t = 100) { - return this.isValidNumber(e) && +e > 0 && +e <= t; - } - isValidNumber(e) { - return !isNaN(e); - } -} -class Game extends Phaser.Scene { - constructor() { - super({ key: "game" }), - (this.player = null), - (this.score = 0), - (this.scoreText = null), - (this.nextOperator = ""), - (this.lastMessage = null), - (this.number = ""), - (this.counter = 0), - (this.failed = !1); - } - preload() { - const e = new URLSearchParams(window.location.search); - let t = e.get("background") || "#00b140"; - (t = parseInt(t.substring(1), 16)), - (this.backgroundColor = "0x" + t.toString(16)); - let s = e.get("foreground") || "#F0EAD6"; - (s = parseInt(s.substring(1), 16)), - (this.foregroundColor = "0x" + s.toString(16)), - (this.spamTimeWait = 2), - (this.result = Phaser.Math.Between(1, 9)); - } - create() { - (this.width = this.sys.game.config.width), - (this.height = this.sys.game.config.height), - (this.center_width = this.width / 2), - (this.center_height = this.height / 2), - this.cameras.main.setBackgroundColor(+this.foregroundColor), - (this.allPlayers = {}), - this.addChat(), - this.loadAudios(), - this.addUI(); - } - addChat() { - this.chat = new Chat(this); - } - loadGame() { - this.generateNextOperation(); - } - addUI() { - (this.circle = this.add.circle( - this.center_width, - this.center_height - 50, - 100, - 15871022 - )), - (this.numberText = this.add - .bitmapText( - this.center_width, - this.center_height - 50, - "mainFont", - this.number, - 120 - ) - .setOrigin(0.5) - .setTint(0)), - (this.operatorText = this.add - .bitmapText( - this.center_width, - this.center_height + 80, - "mainFont", - `${this.nextOperator}${this.number}`, - 50 - ) - .setOrigin(0.5) - .setTint(0)), - this.addClouds(), - this.addScore(), - (this.byText = this.add - .bitmapText( - this.center_width, - this.height - 10, - "mainFont", - "by Pello", - 10 - ) - .setOrigin(0.5) - .setTint(0)); - } - addClouds() { - (this.cloudLeft = this.add - .image( - this.center_width - 100, - this.center_height - 120 + Phaser.Math.Between(-15, 15), - "cloud" + Phaser.Math.Between(1, 14) - ) - .setScale(0.1 * Phaser.Math.Between(5, 9))), - (this.cloudRight = this.add - .image( - this.center_width + 100, - this.center_height + 30 + Phaser.Math.Between(-15, 15), - "cloud" + Phaser.Math.Between(1, 14) - ) - .setScale(0.1 * Phaser.Math.Between(4, 6))), - this.tweens.add({ - targets: [this.cloudLeft], - x: { from: -156, to: this.width + 156 }, - duration: 3e4, - onComplete: () => { - this.cloudLeft.destroy(); - }, - }), - this.tweens.add({ - targets: this.cloudRight, - x: { from: this.width + 156, to: -156 }, - duration: 3e4, - onComplete: () => { - this.cloudLeft.destroy(), this.addClouds(); - }, - }); - } - addScore() { - const e = this.createScoreBoard(); - this.add - .bitmapText(this.center_width, 25, "mainFont", "zenbaki", 25) - .setOrigin(0.5) - .setTint(0), - e.slice(0, 3).forEach((e, t) => { - const s = `${t + 1}. ${e.name}: ${e.score}`; - this.add - .bitmapText(this.center_width, 100 + 50 * t, "mainFont", s, 30) - .setOrigin(0.5) - .setTint(this.foregroundColor) - .setDropShadow(1, 2, 12526882, 0.7); - }), - (this.scoreText1 = this.add - .bitmapText( - this.center_width, - this.center_height + 130, - "mainFont", - "", - 20 - ) - .setOrigin(0.5) - .setTint(0)), - (this.scoreText2 = this.add - .bitmapText( - this.center_width, - this.center_height + 160, - "mainFont", - "", - 25 - ) - .setOrigin(0.5) - .setTint(0)); - } - addPlayer(e) { - if (this.allPlayers[e]) return this.allPlayers[e]; - const t = new Player(this, e); - return ( - (this.allPlayers[e] = t), this.chat.say(`Player ${e} joins game!`), t - ); - } - guess(e, t) { - if (this.failed) return; - console.log("Game> guess: ", e, t); - const s = this.addPlayer(e); - if (!s.dead && !s.hasSpammed()) - if ( - ((s.lastMessage = new Date()), - console.log("Game> guess go on: ", e, t), - this.result === parseInt(t)) - ) { - const i = this.calculateScore(); - (s.score += i), - this.showScore(e, i), - this.generateNextOperation(), - console.log("Player", e, "guess", t); - } else - this.number === parseInt(t) - ? console.log("Player, ", e, " is too slow") - : (this.cameras.main.shake(100, 0.01), - this.playAudio("fail"), - (this.failed = !0), - s.setPenalty(), - this.showShame(e), - this.chat.say(`Player ${e} failed! Shame on you!`)); - } - calculateScore() { - return this.counter + { "+": 1, "-": 2, "*": 4, "/": 5 }[this.nextOperator]; - } - loadAudios() { - this.audios = { - win: this.sound.add("win"), - drip: this.sound.add("drip"), - fail: this.sound.add("fail"), - }; - } - playAudio(e) { - this.audios[e].play({ volume: 0.5 }); - } - showResult() { - const e = this.createScoreBoard(); - (this.scoreRectangle = this.add - .rectangle(0, 0, this.width, this.height, this.foregroundColor, 0.9) - .setOrigin(0, 0)), - (this.scores = this.add.group()), - (this.sensei = this.add - .image(this.center_width, this.height - 60, "sensei") - .setOrigin(0.5) - .setScale(0.4)), - this.scores.add(this.sensei), - this.scores.add( - this.add - .bitmapText(this.center_width, 60, "mainFont", "Senseis:", 30) - .setOrigin(0.5) - .setTint(0) - ), - e.slice(0, 5).forEach((e, t) => { - const s = `${t + 1}. ${e.name}, ${e.score}`; - this.scores.add( - this.add - .bitmapText(this.center_width, 100 + 20 * t, "mainFont", s, 15) - .setOrigin(0.5) - .setTint(0) - ); - }), - this.removeResult(); - } - removeResult() { - this.time.delayedCall( - 5e3, - () => { - this.tweens.add({ - targets: [this.scoreRectangle, this.scores, this.sensei], - duration: 1e3, - alpha: { from: 1, to: 0 }, - onComplete: () => { - this.scoreRectangle.destroy(), - this.scores.getChildren().forEach(function (e) { - e.destroy(); - }, this), - this.scores.clear(!0, !0); - }, - }), - this.resetScore(), - this.generateNextOperation(); - }, - null, - this - ); - } - createScoreBoard() { - return [...Object.values(this.allPlayers)].sort( - (e, t) => t.score - e.score - ); - } - resetScore() { - (this.number = 0), (this.counter = 0), (this.failed = !1); - } - generateNextOperation() { - this.counter++, - (this.number = this.result), - (this.nextOperand = Phaser.Math.Between(1, 9)), - (this.nextOperator = this.selectOperator()), - (this.result = parseInt( - eval(this.number + this.nextOperator + this.nextOperand) - )), - console.log( - "Current: ", - this.number, - " operator: ", - this.nextOperator, - " nextNumber: ", - this.nextOperand, - ", Result: ", - this.result - ), - this.showNextOperation(this.nextOperator, this.nextOperand), - this.playAudio("drip"); - } - selectOperator() { - return this.number % this.nextOperand == 0 && 1 !== this.nextOperand - ? Phaser.Math.RND.pick(["+", "-", "+", "-", "/"]) - : this.number + this.nextOperand >= 100 - ? Phaser.Math.RND.pick(["-"]) - : this.number - this.nextOperand <= -100 - ? Phaser.Math.RND.pick(["+"]) - : Math.abs(this.number * this.nextOperand) < 100 - ? Phaser.Math.RND.pick(["+", "-", "+", "-", "*"]) - : Phaser.Math.RND.pick(["+", "-", "+", "-"]); - } - showScore(e, t) { - this.scoreText1.setText("Great!").setAlpha(1), - this.scoreText2.setText(`${e} +${t}`).setAlpha(1), - this.tweens.add({ - targets: [this.scoreText1], - alpha: { from: 1, to: 0 }, - ease: "Linear", - duration: 3e3, - }); - } - showShame(e) { - this.scoreText1 - .setText( - Phaser.Math.RND.pick([ - "You're a disgrace", - "Shame on you", - "You dishonor us all", - "You're a disappointment", - "You're a failure", - "You dishonor this dojo", - ]) - ) - .setAlpha(1), - this.scoreText2.setText(`${e}`).setAlpha(1), - this.tweens.add({ - targets: [this.scoreText1, this.scoreText2], - alpha: { from: 1, to: 0 }, - ease: "Linear", - duration: 3e3, - onComplete: () => { - this.showResult(); - }, - }); - } - showNextOperation(e, t) { - this.numberText.setText(this.number), this.operatorText.setText(`${e}${t}`); - } -} -const config = { - width: 260, - height: 380, - scale: { autoCenter: Phaser$1.Scale.CENTER_BOTH }, - autoRound: !1, - parent: "game-container", - physics: { default: "arcade", arcade: { gravity: { y: 300 }, debug: !1 } }, - scene: [Bootloader, Game], -}; -new Phaser$1.Game(config); diff --git a/zenbaki/dist/assets/index-BRcjDLKl.js b/zenbaki/dist/assets/index-BRcjDLKl.js new file mode 100644 index 00000000..144a7529 --- /dev/null +++ b/zenbaki/dist/assets/index-BRcjDLKl.js @@ -0,0 +1 @@ +import{g as getAugmentedNamespace,c as commonjsGlobal,a as getDefaultExportFromCjs,P as Phaser$1}from"./phaser-CYd07urT.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 s of e)if("childList"===s.type)for(const e of s.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)}}();class Bootloader extends Phaser.Scene{constructor(){super({key:"bootloader"})}preload(){this.createBars(),this.setLoadEvents(),Array(15).fill(0).forEach(((e,t)=>{this.load.image(`cloud${t}`,`assets/images/cloud${t}.png`)})),this.load.image("pello","assets/images/pello.png"),this.load.image("sensei","assets/images/sensei.png"),this.load.audio("win","assets/sounds/win.mp3"),this.load.audio("drip","assets/sounds/drip.mp3"),this.load.audio("fail","assets/sounds/fail.mp3"),this.load.bitmapFont("mainFont","assets/fonts/hiro.png","assets/fonts/hiro.xml"),this.registry.set("score",0)}setLoadEvents(){this.load.on("progress",(function(e){this.progressBar.clear(),this.progressBar.fillStyle(8966732,1),this.progressBar.fillRect(this.cameras.main.width/4,this.cameras.main.height/2-16,this.cameras.main.width/2*e,16)}),this),this.load.on("complete",(()=>{this.scene.start("game")}),this)}createBars(){this.loadBar=this.add.graphics(),this.loadBar.fillStyle(33923,1),this.loadBar.fillRect(this.cameras.main.width/4-2,this.cameras.main.height/2-18,this.cameras.main.width/2+4,20),this.progressBar=this.add.graphics()}}class Player{constructor(e,t){this.scene=e,this.name=t,this.score=0,this.lastMessage=null,this.dead=!1,this.penalties=0}hasSpammed(){return!!this.lastMessage&&(new Date-this.lastMessage)/1e3{this.dead=!1}),null,this)}}var client$1={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$1=getAugmentedNamespace(__viteBrowserExternal$1);var utils={exports:{}};const actionMessageRegex=/^\u0001ACTION ([^\u0001]+)\u0001$/,justinFanRegex=/^(justinfan)(\d+$)/,unescapeIRCRegex=/\\([sn:r\\])/g,escapeIRCRegex=/([ \n;\r\\])/g,ircEscapedChars={s:" ",n:"",":":";",r:""},ircUnescapedChars={" ":"s","\n":"n",";":":","\r":"r"},urlRegex=new RegExp("^(?:(?:https?|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))\\.?)(?::\\d{2,5})?(?:[/?#]\\S*)?$","i"),regexEmoteRegex=/[|\\^$*+?:#]/,_$4=utils.exports={get:(e,t)=>void 0===e?t:e,hasOwn:(e,t)=>({}.hasOwnProperty.call(e,t)),promiseDelay:e=>new Promise((t=>setTimeout(t,e))),isFinite:e=>isFinite(e)&&!isNaN(parseFloat(e)),toNumber(e,t){if(null===e)return 0;const s=Math.pow(10,_$4.isFinite(t)?t:0);return Math.round(e*s)/s},isInteger:e=>!isNaN(_$4.toNumber(e,0)),isRegex:e=>regexEmoteRegex.test(e),isURL:e=>urlRegex.test(e),justinfan:()=>`justinfan${Math.floor(8e4*Math.random()+1e3)}`,isJustinfan:e=>justinFanRegex.test(e),channel(e){const t=(e||"").toLowerCase();return"#"===t[0]?t:"#"+t},username(e){const t=(e||"").toLowerCase();return"#"===t[0]?t.slice(1):t},token:e=>e?e.toLowerCase().replace("oauth:",""):"",password(e){const t=_$4.token(e);return t?`oauth:${t}`:""},actionMessage:e=>e.match(actionMessageRegex),replaceAll(e,t){if(null==e)return null;for(const s in t)e=e.replace(new RegExp(s,"g"),t[s]);return e},unescapeHtml:e=>e.replace(/\\&\\;/g,"&").replace(/\\<\\;/g,"<").replace(/\\>\\;/g,">").replace(/\\"\\;/g,'"').replace(/\\'\\;/g,"'"),unescapeIRC:e=>e&&"string"==typeof e&&e.includes("\\")?e.replace(unescapeIRCRegex,((e,t)=>t in ircEscapedChars?ircEscapedChars[t]:t)):e,escapeIRC:e=>e&&"string"==typeof e?e.replace(escapeIRCRegex,((e,t)=>t in ircUnescapedChars?`\\${ircUnescapedChars[t]}`:t)):e,addWord:(e,t)=>e.length?e+" "+t:e+t,splitLine(e,t){let s=e.substring(0,t).lastIndexOf(" ");return-1===s&&(s=t-1),[e.substring(0,s),e.substring(s+1)]},extractNumber(e){const t=e.split(" ");for(let s=0;s(r={statusCode:e.status,headers:e.headers},i.json?e.json():e.text()))).then((e=>t(null,r,e)),(e=>t(e,r,null)))}else{const i=Object.assign({method:"GET",headers:{}},e,{url:s}),n=new XMLHttpRequest;n.open(i.method,i.url,!0);for(const e in i.headers)n.setRequestHeader(e,i.headers[e]);n.responseType="json",n.addEventListener("load",(e=>{4===n.readyState&&(200!==n.status?t(n.status,null,null):t(null,null,n.response))})),n.send()}};const _$2=utilsExports;function followersonly(e,t){return e=_$2.channel(e),t=_$2.get(t,30),this._sendCommand(null,e,`/followers ${t}`,((s,i)=>{this.once("_promiseFollowers",(n=>{n?i(n):s([e,~~t])}))}))}function followersonlyoff(e){return e=_$2.channel(e),this._sendCommand(null,e,"/followersoff",((t,s)=>{this.once("_promiseFollowersoff",(i=>{i?s(i):t([e])}))}))}function part(e){return e=_$2.channel(e),this._sendCommand(null,null,`PART ${e}`,((t,s)=>{this.once("_promisePart",(i=>{i?s(i):t([e])}))}))}function r9kbeta(e){return e=_$2.channel(e),this._sendCommand(null,e,"/r9kbeta",((t,s)=>{this.once("_promiseR9kbeta",(i=>{i?s(i):t([e])}))}))}function r9kbetaoff(e){return e=_$2.channel(e),this._sendCommand(null,e,"/r9kbetaoff",((t,s)=>{this.once("_promiseR9kbetaoff",(i=>{i?s(i):t([e])}))}))}function slow(e,t){return e=_$2.channel(e),t=_$2.get(t,300),this._sendCommand(null,e,`/slow ${t}`,((s,i)=>{this.once("_promiseSlow",(n=>{n?i(n):s([e,~~t])}))}))}function slowoff(e){return e=_$2.channel(e),this._sendCommand(null,e,"/slowoff",((t,s)=>{this.once("_promiseSlowoff",(i=>{i?s(i):t([e])}))}))}var commands={action(e,t){return e=_$2.channel(e),t=`ACTION ${t}`,this._sendMessage(this._getPromiseDelay(),e,t,((s,i)=>{s([e,t])}))},ban(e,t,s){return e=_$2.channel(e),t=_$2.username(t),s=_$2.get(s,""),this._sendCommand(null,e,`/ban ${t} ${s}`,((i,n)=>{this.once("_promiseBan",(o=>{o?n(o):i([e,t,s])}))}))},clear(e){return e=_$2.channel(e),this._sendCommand(null,e,"/clear",((t,s)=>{this.once("_promiseClear",(i=>{i?s(i):t([e])}))}))},color(e,t){return t=_$2.get(t,e),this._sendCommand(null,"#tmijs",`/color ${t}`,((e,s)=>{this.once("_promiseColor",(i=>{i?s(i):e([t])}))}))},commercial(e,t){return e=_$2.channel(e),t=_$2.get(t,30),this._sendCommand(null,e,`/commercial ${t}`,((s,i)=>{this.once("_promiseCommercial",(n=>{n?i(n):s([e,~~t])}))}))},deletemessage(e,t){return e=_$2.channel(e),this._sendCommand(null,e,`/delete ${t}`,((t,s)=>{this.once("_promiseDeletemessage",(i=>{i?s(i):t([e])}))}))},emoteonly(e){return e=_$2.channel(e),this._sendCommand(null,e,"/emoteonly",((t,s)=>{this.once("_promiseEmoteonly",(i=>{i?s(i):t([e])}))}))},emoteonlyoff(e){return e=_$2.channel(e),this._sendCommand(null,e,"/emoteonlyoff",((t,s)=>{this.once("_promiseEmoteonlyoff",(i=>{i?s(i):t([e])}))}))},followersonly:followersonly,followersmode:followersonly,followersonlyoff:followersonlyoff,followersmodeoff:followersonlyoff,host(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(2e3,e,`/host ${t}`,((s,i)=>{this.once("_promiseHost",((n,o)=>{n?i(n):s([e,t,~~o])}))}))},join(e){return e=_$2.channel(e),this._sendCommand(void 0,null,`JOIN ${e}`,((t,s)=>{const i="_promiseJoin";let n=!1;const o=(r,a)=>{e===_$2.channel(a)&&(this.removeListener(i,o),n=!0,r?s(r):t([e]))};this.on(i,o);const r=this._getPromiseDelay();_$2.promiseDelay(r).then((()=>{n||this.emit(i,"No response from Twitch.",e)}))}))},mod(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(null,e,`/mod ${t}`,((s,i)=>{this.once("_promiseMod",(n=>{n?i(n):s([e,t])}))}))},mods(e){return e=_$2.channel(e),this._sendCommand(null,e,"/mods",((t,s)=>{this.once("_promiseMods",((i,n)=>{i?s(i):(n.forEach((t=>{this.moderators[e]||(this.moderators[e]=[]),this.moderators[e].includes(t)||this.moderators[e].push(t)})),t(n))}))}))},part:part,leave:part,ping(){return this._sendCommand(null,null,"PING",((e,t)=>{this.latency=new Date,this.pingTimeout=setTimeout((()=>{null!==this.ws&&(this.wasCloseCalled=!1,this.log.error("Ping timeout."),this.ws.close(),clearInterval(this.pingLoop),clearTimeout(this.pingTimeout))}),_$2.get(this.opts.connection.timeout,9999)),this.once("_promisePing",(t=>e([parseFloat(t)])))}))},r9kbeta:r9kbeta,r9kmode:r9kbeta,r9kbetaoff:r9kbetaoff,r9kmodeoff:r9kbetaoff,raw(e){return this._sendCommand(null,null,e,((t,s)=>{t([e])}))},say(e,t){return e=_$2.channel(e),t.startsWith(".")&&!t.startsWith("..")||t.startsWith("/")||t.startsWith("\\")?"me "===t.substr(1,3)?this.action(e,t.substr(4)):this._sendCommand(null,e,t,((s,i)=>{s([e,t])})):this._sendMessage(this._getPromiseDelay(),e,t,((s,i)=>{s([e,t])}))},slow:slow,slowmode:slow,slowoff:slowoff,slowmodeoff:slowoff,subscribers(e){return e=_$2.channel(e),this._sendCommand(null,e,"/subscribers",((t,s)=>{this.once("_promiseSubscribers",(i=>{i?s(i):t([e])}))}))},subscribersoff(e){return e=_$2.channel(e),this._sendCommand(null,e,"/subscribersoff",((t,s)=>{this.once("_promiseSubscribersoff",(i=>{i?s(i):t([e])}))}))},timeout(e,t,s,i){return e=_$2.channel(e),t=_$2.username(t),null===s||_$2.isInteger(s)||(i=s,s=300),s=_$2.get(s,300),i=_$2.get(i,""),this._sendCommand(null,e,`/timeout ${t} ${s} ${i}`,((n,o)=>{this.once("_promiseTimeout",(r=>{r?o(r):n([e,t,~~s,i])}))}))},unban(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(null,e,`/unban ${t}`,((s,i)=>{this.once("_promiseUnban",(n=>{n?i(n):s([e,t])}))}))},unhost(e){return e=_$2.channel(e),this._sendCommand(2e3,e,"/unhost",((t,s)=>{this.once("_promiseUnhost",(i=>{i?s(i):t([e])}))}))},unmod(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(null,e,`/unmod ${t}`,((s,i)=>{this.once("_promiseUnmod",(n=>{n?i(n):s([e,t])}))}))},unvip(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(null,e,`/unvip ${t}`,((s,i)=>{this.once("_promiseUnvip",(n=>{n?i(n):s([e,t])}))}))},vip(e,t){return e=_$2.channel(e),t=_$2.username(t),this._sendCommand(null,e,`/vip ${t}`,((s,i)=>{this.once("_promiseVip",(n=>{n?i(n):s([e,t])}))}))},vips(e){return e=_$2.channel(e),this._sendCommand(null,e,"/vips",((e,t)=>{this.once("_promiseVips",((s,i)=>{s?t(s):e(i)}))}))},whisper(e,t){return(e=_$2.username(e))===this.getUsername()?Promise.reject("Cannot send a whisper to the same account."):this._sendCommand(null,"#tmijs",`/w ${e} ${t}`,((e,t)=>{this.once("_promiseWhisper",(e=>{e&&t(e)}))})).catch((s=>{if(s&&"string"==typeof s&&0!==s.indexOf("No response from Twitch."))throw s;const i=_$2.channel(e),n=Object.assign({"message-type":"whisper","message-id":null,"thread-id":null,username:this.getUsername()},this.globaluserstate);return this.emits(["whisper","message"],[[i,n,t,!0],[i,n,t,!0]]),[e,t]}))}};function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var events=EventEmitter;function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(e){if(!isNumber(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},EventEmitter.prototype.emit=function(e){var t,s,i,n,o,r;if(this._events||(this._events={}),"error"===e&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(isUndefined(s=this._events[e]))return!1;if(isFunction(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),s.apply(this,n)}else if(isObject(s))for(n=Array.prototype.slice.call(arguments,1),i=(r=s.slice()).length,o=0;o0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(e,t){if(!isFunction(t))throw TypeError("listener must be a function");var s=!1;if(this._events.hasOwnProperty(e)&&"_"===e.charAt(0)){var i=1,n=e;for(var o in this._events)this._events.hasOwnProperty(o)&&o.startsWith(n)&&i++;e+=i}function r(){"_"!==e.charAt(0)||isNaN(e.substr(e.length-1))||(e=e.substring(0,e.length-1)),this.removeListener(e,r),s||(s=!0,t.apply(this,arguments))}return r.listener=t,this.on(e,r),this},EventEmitter.prototype.removeListener=function(e,t){var s,i,n,o;if(!isFunction(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=(s=this._events[e]).length,i=-1,s===t||isFunction(s.listener)&&s.listener===t){if(delete this._events[e],this._events.hasOwnProperty(e+"2")&&"_"===e.charAt(0)){var r=e;for(var a in this._events)this._events.hasOwnProperty(a)&&a.startsWith(r)&&(isNaN(parseInt(a.substr(a.length-1)))||(this._events[e+parseInt(a.substr(a.length-1)-1)]=this._events[a],delete this._events[a]));this._events[e]=this._events[e+"1"],delete this._events[e+"1"]}this._events.removeListener&&this.emit("removeListener",e,t)}else if(isObject(s)){for(o=n;o-- >0;)if(s[o]===t||s[o].listener&&s[o].listener===t){i=o;break}if(i<0)return this;1===s.length?(s.length=0,delete this._events[e]):s.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},EventEmitter.prototype.removeAllListeners=function(e){var t,s;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(isFunction(s=this._events[e]))this.removeListener(e,s);else if(s)for(;s.length;)this.removeListener(e,s[s.length-1]);return delete this._events[e],this},EventEmitter.prototype.listeners=function(e){return this._events&&this._events[e]?isFunction(this._events[e])?[this._events[e]]:this._events[e].slice():[]},EventEmitter.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(isFunction(t))return 1;if(t)return t.length}return 0},EventEmitter.listenerCount=function(e,t){return e.listenerCount(t)};const _$1=utilsExports;let currentLevel="info";const levels={trace:0,debug:1,info:2,warn:3,error:4,fatal:5};function log(e){return function(t){levels[e]>=levels[currentLevel]&&console.log(`[${_$1.formatDate(new Date)}] ${e}: ${t}`)}}var logger={setLevel(e){currentLevel=e},trace:log("trace"),debug:log("debug"),info:log("info"),warn:log("warn"),error:log("error"),fatal:log("fatal")};const _=utilsExports,nonspaceRegex=/\S+/g;function parseComplexTag(e,t,s=",",i="/",n){const o=e[t];if(void 0===o)return e;const r="string"==typeof o;if(e[t+"-raw"]=r?o:null,!0===o)return e[t]=null,e;if(e[t]={},r){const r=o.split(s);for(let s=0;sparseComplexTag(e,"badges"),badgeInfo:e=>parseComplexTag(e,"badge-info"),emotes:e=>parseComplexTag(e,"emotes","/",":",","),emoteRegex(e,t,s,i){nonspaceRegex.lastIndex=0;const n=new RegExp("(\\b|^|\\s)"+_.unescapeHtml(t)+"(\\b|$|\\s)");let o;for(;null!==(o=nonspaceRegex.exec(e));)n.test(o[0])&&(i[s]=i[s]||[],i[s].push([o.index,nonspaceRegex.lastIndex-1]))},emoteString(e,t,s,i){let n;for(nonspaceRegex.lastIndex=0;null!==(n=nonspaceRegex.exec(e));)n[0]===_.unescapeHtml(t)&&(i[s]=i[s]||[],i[s].push([n.index,nonspaceRegex.lastIndex-1]))},transformEmotes(e){let t="";return Object.keys(e).forEach((s=>{t=`${t+s}:`,e[s].forEach((e=>t=`${t+e.join("-")},`)),t=`${t.slice(0,-1)}/`})),t.slice(0,-1)},formTags(e){const t=[];for(const s in e){const i=_.escapeIRC(e[s]);t.push(`${s}=${i}`)}return`@${t.join(";")}`},msg(e){const t={raw:e,tags:{},prefix:null,command:null,params:[]};let s=0,i=0;if(64===e.charCodeAt(0)){if(i=e.indexOf(" "),-1===i)return null;const n=e.slice(1,i).split(";");for(let e=0;es?(t.command=e.slice(s),t):null;for(t.command=e.slice(s,i),s=i+1;32===e.charCodeAt(s);)s++;for(;sthis.next()),e)}}}var timer=Queue;!function(e){const t=void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:{},s=t.WebSocket||require$$1,i=t.fetch||require$$1,n=api,o=commands,r=events.EventEmitter,a=logger,h=parser,c=timer,l=utilsExports;let m=!1;const d=function e(t){if(this instanceof e==0)return new e(t);this.opts=l.get(t,{}),this.opts.channels=this.opts.channels||[],this.opts.connection=this.opts.connection||{},this.opts.identity=this.opts.identity||{},this.opts.options=this.opts.options||{},this.clientId=l.get(this.opts.options.clientId,null),this._globalDefaultChannel=l.channel(l.get(this.opts.options.globalDefaultChannel,"#tmijs")),this._skipMembership=l.get(this.opts.options.skipMembership,!1),this._skipUpdatingEmotesets=l.get(this.opts.options.skipUpdatingEmotesets,!1),this._updateEmotesetsTimer=null,this._updateEmotesetsTimerDelay=l.get(this.opts.options.updateEmotesetsTimer,6e4),this.maxReconnectAttempts=l.get(this.opts.connection.maxReconnectAttempts,1/0),this.maxReconnectInterval=l.get(this.opts.connection.maxReconnectInterval,3e4),this.reconnect=l.get(this.opts.connection.reconnect,!0),this.reconnectDecay=l.get(this.opts.connection.reconnectDecay,1.5),this.reconnectInterval=l.get(this.opts.connection.reconnectInterval,1e3),this.reconnecting=!1,this.reconnections=0,this.reconnectTimer=this.reconnectInterval,this.secure=l.get(this.opts.connection.secure,!this.opts.connection.server&&!this.opts.connection.port),this.emotes="",this.emotesets={},this.channels=[],this.currentLatency=0,this.globaluserstate={},this.lastJoined="",this.latency=new Date,this.moderators={},this.pingLoop=null,this.pingTimeout=null,this.reason="",this.username="",this.userstate={},this.wasCloseCalled=!1,this.ws=null;let s="error";this.opts.options.debug&&(s="info"),this.log=this.opts.logger||a;try{a.setLevel(s)}catch(i){}this.opts.channels.forEach(((e,t,s)=>s[t]=l.channel(e))),r.call(this),this.setMaxListeners(0)};l.inherits(d,r);for(const u in o)d.prototype[u]=o[u];d.prototype.emits=function(e,t){for(let s=0;s{this._isConnected()&&this.ws.send("PING"),this.latency=new Date,this.pingTimeout=setTimeout((()=>{null!==this.ws&&(this.wasCloseCalled=!1,this.log.error("Ping timeout."),this.ws.close(),clearInterval(this.pingLoop),clearTimeout(this.pingTimeout),clearTimeout(this._updateEmotesetsTimer))}),l.get(this.opts.connection.timeout,9999))}),6e4);let e=l.get(this.opts.options.joinInterval,2e3);e<300&&(e=300);const t=new c(e),s=[...new Set([...this.opts.channels,...this.channels])];this.channels=[];for(let i=0;i{this._isConnected()&&this.join(e).catch((e=>this.log.error(e)))}))}t.next();break}case"NOTICE":{const n=[null],o=[t,i,s],r=[t,!0],a=[t,!1],h=[o,n],c=[o,[i]],l=`[${t}] ${s}`;switch(i){case"subs_on":this.log.info(`[${t}] This room is now in subscribers-only mode.`),this.emits(["subscriber","subscribers","_promiseSubscribers"],[r,r,n]);break;case"subs_off":this.log.info(`[${t}] This room is no longer in subscribers-only mode.`),this.emits(["subscriber","subscribers","_promiseSubscribersoff"],[a,a,n]);break;case"emote_only_on":this.log.info(`[${t}] This room is now in emote-only mode.`),this.emits(["emoteonly","_promiseEmoteonly"],[r,n]);break;case"emote_only_off":this.log.info(`[${t}] This room is no longer in emote-only mode.`),this.emits(["emoteonly","_promiseEmoteonlyoff"],[a,n]);break;case"slow_on":case"slow_off":case"followers_on_zero":case"followers_on":case"followers_off":case"host_on":case"host_off":break;case"r9k_on":this.log.info(`[${t}] This room is now in r9k mode.`),this.emits(["r9kmode","r9kbeta","_promiseR9kbeta"],[r,r,n]);break;case"r9k_off":this.log.info(`[${t}] This room is no longer in r9k mode.`),this.emits(["r9kmode","r9kbeta","_promiseR9kbetaoff"],[a,a,n]);break;case"room_mods":{const e=s.split(": "),i=(e.length>1?e[1]:"").toLowerCase().split(", ").filter((e=>e));this.emits(["_promiseMods","mods"],[[null,i],[t,i]]);break}case"no_mods":this.emits(["_promiseMods","mods"],[[null,[]],[t,[]]]);break;case"vips_success":{s.endsWith(".")&&(s=s.slice(0,-1));const e=s.split(": "),i=(e.length>1?e[1]:"").toLowerCase().split(", ").filter((e=>e));this.emits(["_promiseVips","vips"],[[null,i],[t,i]]);break}case"no_vips":this.emits(["_promiseVips","vips"],[[null,[]],[t,[]]]);break;case"already_banned":case"bad_ban_admin":case"bad_ban_anon":case"bad_ban_broadcaster":case"bad_ban_global_mod":case"bad_ban_mod":case"bad_ban_self":case"bad_ban_staff":case"usage_ban":this.log.info(l),this.emits(["notice","_promiseBan"],c);break;case"ban_success":this.log.info(l),this.emits(["notice","_promiseBan"],h);break;case"usage_clear":this.log.info(l),this.emits(["notice","_promiseClear"],c);break;case"usage_mods":this.log.info(l),this.emits(["notice","_promiseMods"],[o,[i,[]]]);break;case"mod_success":this.log.info(l),this.emits(["notice","_promiseMod"],h);break;case"usage_vips":this.log.info(l),this.emits(["notice","_promiseVips"],[o,[i,[]]]);break;case"usage_vip":case"bad_vip_grantee_banned":case"bad_vip_grantee_already_vip":case"bad_vip_max_vips_reached":case"bad_vip_achievement_incomplete":this.log.info(l),this.emits(["notice","_promiseVip"],[o,[i,[]]]);break;case"vip_success":this.log.info(l),this.emits(["notice","_promiseVip"],h);break;case"usage_mod":case"bad_mod_banned":case"bad_mod_mod":this.log.info(l),this.emits(["notice","_promiseMod"],c);break;case"unmod_success":this.log.info(l),this.emits(["notice","_promiseUnmod"],h);break;case"unvip_success":this.log.info(l),this.emits(["notice","_promiseUnvip"],h);break;case"usage_unmod":case"bad_unmod_mod":this.log.info(l),this.emits(["notice","_promiseUnmod"],c);break;case"usage_unvip":case"bad_unvip_grantee_not_vip":this.log.info(l),this.emits(["notice","_promiseUnvip"],c);break;case"color_changed":this.log.info(l),this.emits(["notice","_promiseColor"],h);break;case"usage_color":case"turbo_only_color":this.log.info(l),this.emits(["notice","_promiseColor"],c);break;case"commercial_success":this.log.info(l),this.emits(["notice","_promiseCommercial"],h);break;case"usage_commercial":case"bad_commercial_error":this.log.info(l),this.emits(["notice","_promiseCommercial"],c);break;case"hosts_remaining":{this.log.info(l);const e=isNaN(s[0])?0:parseInt(s[0]);this.emits(["notice","_promiseHost"],[o,[null,~~e]]);break}case"bad_host_hosting":case"bad_host_rate_exceeded":case"bad_host_error":case"usage_host":this.log.info(l),this.emits(["notice","_promiseHost"],[o,[i,null]]);break;case"already_r9k_on":case"usage_r9k_on":this.log.info(l),this.emits(["notice","_promiseR9kbeta"],c);break;case"already_r9k_off":case"usage_r9k_off":this.log.info(l),this.emits(["notice","_promiseR9kbetaoff"],c);break;case"timeout_success":this.log.info(l),this.emits(["notice","_promiseTimeout"],h);break;case"delete_message_success":this.log.info(`[${t} ${s}]`),this.emits(["notice","_promiseDeletemessage"],h);break;case"already_subs_off":case"usage_subs_off":this.log.info(l),this.emits(["notice","_promiseSubscribersoff"],c);break;case"already_subs_on":case"usage_subs_on":this.log.info(l),this.emits(["notice","_promiseSubscribers"],c);break;case"already_emote_only_off":case"usage_emote_only_off":this.log.info(l),this.emits(["notice","_promiseEmoteonlyoff"],c);break;case"already_emote_only_on":case"usage_emote_only_on":this.log.info(l),this.emits(["notice","_promiseEmoteonly"],c);break;case"usage_slow_on":this.log.info(l),this.emits(["notice","_promiseSlow"],c);break;case"usage_slow_off":this.log.info(l),this.emits(["notice","_promiseSlowoff"],c);break;case"usage_timeout":case"bad_timeout_admin":case"bad_timeout_anon":case"bad_timeout_broadcaster":case"bad_timeout_duration":case"bad_timeout_global_mod":case"bad_timeout_mod":case"bad_timeout_self":case"bad_timeout_staff":this.log.info(l),this.emits(["notice","_promiseTimeout"],c);break;case"untimeout_success":case"unban_success":this.log.info(l),this.emits(["notice","_promiseUnban"],h);break;case"usage_unban":case"bad_unban_no_ban":this.log.info(l),this.emits(["notice","_promiseUnban"],c);break;case"usage_delete":case"bad_delete_message_error":case"bad_delete_message_broadcaster":case"bad_delete_message_mod":this.log.info(l),this.emits(["notice","_promiseDeletemessage"],c);break;case"usage_unhost":case"not_hosting":this.log.info(l),this.emits(["notice","_promiseUnhost"],c);break;case"whisper_invalid_login":case"whisper_invalid_self":case"whisper_limit_per_min":case"whisper_limit_per_sec":case"whisper_restricted":case"whisper_restricted_recipient":this.log.info(l),this.emits(["notice","_promiseWhisper"],c);break;case"no_permission":case"msg_banned":case"msg_room_not_found":case"msg_channel_suspended":case"tos_ban":case"invalid_user":this.log.info(l),this.emits(["notice","_promiseBan","_promiseClear","_promiseUnban","_promiseTimeout","_promiseDeletemessage","_promiseMods","_promiseMod","_promiseUnmod","_promiseVips","_promiseVip","_promiseUnvip","_promiseCommercial","_promiseHost","_promiseUnhost","_promiseJoin","_promisePart","_promiseR9kbeta","_promiseR9kbetaoff","_promiseSlow","_promiseSlowoff","_promiseFollowers","_promiseFollowersoff","_promiseSubscribers","_promiseSubscribersoff","_promiseEmoteonly","_promiseEmoteonlyoff","_promiseWhisper"],[o,[i,t]]);break;case"msg_rejected":case"msg_rejected_mandatory":this.log.info(l),this.emit("automod",t,i,s);break;case"unrecognized_cmd":case"cmds_available":case"host_target_went_offline":case"msg_censored_broadcaster":case"msg_duplicate":case"msg_emoteonly":case"msg_verified_email":case"msg_ratelimit":case"msg_subsonly":case"msg_timedout":case"msg_bad_characters":case"msg_channel_blocked":case"msg_facebook":case"msg_followersonly":case"msg_followersonly_followed":case"msg_followersonly_zero":case"msg_slowmode":case"msg_suspended":case"no_help":case"usage_disconnect":case"usage_help":case"usage_me":case"unavailable_command":this.log.info(l),this.emit("notice",t,i,s);break;default:s.includes("Login unsuccessful")||s.includes("Login authentication failed")||s.includes("Error logging in")||s.includes("Improperly formatted auth")?(this.wasCloseCalled=!1,this.reconnect=!1,this.reason=s,this.log.error(this.reason),this.ws.close()):s.includes("Invalid NICK")?(this.wasCloseCalled=!1,this.reconnect=!1,this.reason="Invalid NICK.",this.log.error(this.reason),this.ws.close()):(this.log.warn(`Could not parse NOTICE from tmi.twitch.tv:\n${JSON.stringify(e,null,4)}`),this.emit("notice",t,i,s))}break}case"USERNOTICE":{const e=n["display-name"]||n.login,o=n["msg-param-sub-plan"]||"",r=l.unescapeIRC(l.get(n["msg-param-sub-plan-name"],""))||null,a={prime:o.includes("Prime"),plan:o,planName:r},h=~~(n["msg-param-streak-months"]||0),c=n["msg-param-recipient-display-name"]||n["msg-param-recipient-user-name"],m=~~n["msg-param-mass-gift-count"];switch(n["message-type"]=i,i){case"resub":this.emits(["resub","subanniversary"],[[t,e,h,s,n,a]]);break;case"sub":this.emits(["subscription","sub"],[[t,e,a,s,n]]);break;case"subgift":this.emit("subgift",t,e,h,c,a,n);break;case"anonsubgift":this.emit("anonsubgift",t,h,c,a,n);break;case"submysterygift":this.emit("submysterygift",t,e,m,a,n);break;case"anonsubmysterygift":this.emit("anonsubmysterygift",t,m,a,n);break;case"primepaidupgrade":this.emit("primepaidupgrade",t,e,a,n);break;case"giftpaidupgrade":{const s=n["msg-param-sender-name"]||n["msg-param-sender-login"];this.emit("giftpaidupgrade",t,e,s,n);break}case"anongiftpaidupgrade":this.emit("anongiftpaidupgrade",t,e,n);break;case"raid":{const e=n["msg-param-displayName"]||n["msg-param-login"],s=+n["msg-param-viewerCount"];this.emit("raided",t,e,s,n);break}case"ritual":{const i=n["msg-param-ritual-name"];"new_chatter"===i?this.emit("newchatter",t,e,n,s):this.emit("ritual",i,t,e,n,s);break}default:this.emit("usernotice",i,t,n,s)}break}case"HOSTTARGET":{const e=s.split(" "),i=~~e[1]||0;"-"===e[0]?(this.log.info(`[${t}] Exited host mode.`),this.emits(["unhost","_promiseUnhost"],[[t,i],[null]])):(this.log.info(`[${t}] Now hosting ${e[0]} for ${i} viewer(s).`),this.emit("hosting",t,e[0],i));break}case"CLEARCHAT":if(e.params.length>1){const i=l.get(e.tags["ban-duration"],null);null===i?(this.log.info(`[${t}] ${s} has been banned.`),this.emit("ban",t,s,null,e.tags)):(this.log.info(`[${t}] ${s} has been timed out for ${i} seconds.`),this.emit("timeout",t,s,null,~~i,e.tags))}else this.log.info(`[${t}] Chat was cleared by a moderator.`),this.emits(["clearchat","_promiseClear"],[[t],[null]]);break;case"CLEARMSG":if(e.params.length>1){const e=s,i=n.login;n["message-type"]="messagedeleted",this.log.info(`[${t}] ${i}'s message has been deleted.`),this.emit("messagedeleted",t,i,e,n)}break;case"RECONNECT":this.log.info("Received RECONNECT request from Twitch.."),this.log.info(`Disconnecting and reconnecting in ${Math.round(this.reconnectTimer/1e3)} seconds..`),this.disconnect().catch((e=>this.log.error(e))),setTimeout((()=>this.connect().catch((e=>this.log.error(e)))),this.reconnectTimer);break;case"USERSTATE":e.tags.username=this.username,"mod"===e.tags["user-type"]&&(this.moderators[t]||(this.moderators[t]=[]),this.moderators[t].includes(this.username)||this.moderators[t].push(this.username)),l.isJustinfan(this.getUsername())||this.userstate[t]||(this.userstate[t]=n,this.lastJoined=t,this.channels.push(t),this.log.info(`Joined ${t}`),this.emit("join",t,l.username(this.getUsername()),!0)),e.tags["emote-sets"]!==this.emotes&&this._updateEmoteset(e.tags["emote-sets"]),this.userstate[t]=n;break;case"GLOBALUSERSTATE":this.globaluserstate=n,this.emit("globaluserstate",n),void 0!==e.tags["emote-sets"]&&this._updateEmoteset(e.tags["emote-sets"]);break;case"ROOMSTATE":if(l.channel(this.lastJoined)===t&&this.emit("_promiseJoin",null,t),e.tags.channel=t,this.emit("roomstate",t,e.tags),!l.hasOwn(e.tags,"subs-only")){if(l.hasOwn(e.tags,"slow"))if("boolean"!=typeof e.tags.slow||e.tags.slow){const s=[t,!0,~~e.tags.slow];this.log.info(`[${t}] This room is now in slow mode.`),this.emits(["slow","slowmode","_promiseSlow"],[s,s,[null]])}else{const e=[t,!1,0];this.log.info(`[${t}] This room is no longer in slow mode.`),this.emits(["slow","slowmode","_promiseSlowoff"],[e,e,[null]])}if(l.hasOwn(e.tags,"followers-only"))if("-1"===e.tags["followers-only"]){const e=[t,!1,0];this.log.info(`[${t}] This room is no longer in followers-only mode.`),this.emits(["followersonly","followersmode","_promiseFollowersoff"],[e,e,[null]])}else{const s=[t,!0,~~e.tags["followers-only"]];this.log.info(`[${t}] This room is now in follower-only mode.`),this.emits(["followersonly","followersmode","_promiseFollowers"],[s,s,[null]])}}break;default:this.log.warn(`Could not parse message from tmi.twitch.tv:\n${JSON.stringify(e,null,4)}`)}else if("jtv"===e.prefix)"MODE"===e.command?"+o"===s?(this.moderators[t]||(this.moderators[t]=[]),this.moderators[t].includes(e.params[2])||this.moderators[t].push(e.params[2]),this.emit("mod",t,e.params[2])):"-o"===s&&(this.moderators[t]||(this.moderators[t]=[]),this.moderators[t].filter((t=>t!==e.params[2])),this.emit("unmod",t,e.params[2])):this.log.warn(`Could not parse message from jtv:\n${JSON.stringify(e,null,4)}`);else switch(e.command){case"353":this.emit("names",e.params[2],e.params[3].split(" "));break;case"366":break;case"JOIN":{const s=e.prefix.split("!")[0];l.isJustinfan(this.getUsername())&&this.username===s&&(this.lastJoined=t,this.channels.push(t),this.log.info(`Joined ${t}`),this.emit("join",t,s,!0)),this.username!==s&&this.emit("join",t,s,!1);break}case"PART":{let s=!1;const i=e.prefix.split("!")[0];if(this.username===i){s=!0,this.userstate[t]&&delete this.userstate[t];let e=this.channels.indexOf(t);-1!==e&&this.channels.splice(e,1),e=this.opts.channels.indexOf(t),-1!==e&&this.opts.channels.splice(e,1),this.log.info(`Left ${t}`),this.emit("_promisePart",null)}this.emit("part",t,i,s);break}case"WHISPER":{const t=e.prefix.split("!")[0];this.log.info(`[WHISPER] <${t}>: ${s}`),l.hasOwn(e.tags,"username")||(e.tags.username=t),e.tags["message-type"]="whisper";const i=l.channel(e.tags.username);this.emits(["whisper","message"],[[i,e.tags,s,!1]]);break}case"PRIVMSG":if(e.tags.username=e.prefix.split("!")[0],"jtv"===e.tags.username){const e=l.username(s.split(" ")[0]),i=s.includes("auto");if(s.includes("hosting you for")){const n=l.extractNumber(s);this.emit("hosted",t,e,n,i)}else s.includes("hosting you")&&this.emit("hosted",t,e,0,i)}else{const i=l.get(this.opts.options.messagesLogLevel,"info"),n=l.actionMessage(s);if(e.tags["message-type"]=n?"action":"chat",s=n?n[1]:s,l.hasOwn(e.tags,"bits"))this.emit("cheer",t,e.tags,s);else{if(l.hasOwn(e.tags,"msg-id")){if("highlighted-message"===e.tags["msg-id"]){const i=e.tags["msg-id"];this.emit("redeem",t,e.tags.username,i,e.tags,s)}else if("skip-subs-mode-message"===e.tags["msg-id"]){const i=e.tags["msg-id"];this.emit("redeem",t,e.tags.username,i,e.tags,s)}}else if(l.hasOwn(e.tags,"custom-reward-id")){const i=e.tags["custom-reward-id"];this.emit("redeem",t,e.tags.username,i,e.tags,s)}n?(this.log[i](`[${t}] *<${e.tags.username}>: ${s}`),this.emits(["action","message"],[[t,e.tags,s,!1]])):(this.log[i](`[${t}] <${e.tags.username}>: ${s}`),this.emits(["chat","message"],[[t,e.tags,s,!1]]))}}break;default:this.log.warn(`Could not parse message:\n${JSON.stringify(e,null,4)}`)}},d.prototype.connect=function(){return new Promise(((e,t)=>{this.server=l.get(this.opts.connection.server,"irc-ws.chat.twitch.tv"),this.port=l.get(this.opts.connection.port,80),this.secure&&(this.port=443),443===this.port&&(this.secure=!0),this.reconnectTimer=this.reconnectTimer*this.reconnectDecay,this.reconnectTimer>=this.maxReconnectInterval&&(this.reconnectTimer=this.maxReconnectInterval),this._openConnection(),this.once("_promiseConnect",(s=>{s?t(s):e([this.server,~~this.port])}))}))},d.prototype._openConnection=function(){const e=`${this.secure?"wss":"ws"}://${this.server}:${this.port}/`,t={};"agent"in this.opts.connection&&(t.agent=this.opts.connection.agent),this.ws=new s(e,"irc",t),this.ws.onmessage=this._onMessage.bind(this),this.ws.onerror=this._onError.bind(this),this.ws.onclose=this._onClose.bind(this),this.ws.onopen=this._onOpen.bind(this)},d.prototype._onOpen=function(){this._isConnected()&&(this.log.info(`Connecting to ${this.server} on port ${this.port}..`),this.emit("connecting",this.server,~~this.port),this.username=l.get(this.opts.identity.username,l.justinfan()),this._getToken().then((e=>{const t=l.password(e);this.log.info("Sending authentication to server.."),this.emit("logon");let s="twitch.tv/tags twitch.tv/commands";this._skipMembership||(s+=" twitch.tv/membership"),this.ws.send("CAP REQ :"+s),t?this.ws.send(`PASS ${t}`):l.isJustinfan(this.username)&&this.ws.send("PASS SCHMOOPIIE"),this.ws.send(`NICK ${this.username}`)})).catch((e=>{this.emits(["_promiseConnect","disconnected"],[[e],["Could not get a token."]])})))},d.prototype._getToken=function(){const e=this.opts.identity.password;let t;return"function"==typeof e?(t=e(),t instanceof Promise?t:Promise.resolve(t)):Promise.resolve(e)},d.prototype._onMessage=function(e){e.data.trim().split("\r\n").forEach((e=>{const t=h.msg(e);t&&this.handleMessage(t)}))},d.prototype._onError=function(){this.moderators={},this.userstate={},this.globaluserstate={},clearInterval(this.pingLoop),clearTimeout(this.pingTimeout),clearTimeout(this._updateEmotesetsTimer),this.reason=null===this.ws?"Connection closed.":"Unable to connect.",this.emits(["_promiseConnect","disconnected"],[[this.reason]]),this.reconnect&&this.reconnections===this.maxReconnectAttempts&&(this.emit("maxreconnect"),this.log.error("Maximum reconnection attempts reached.")),this.reconnect&&!this.reconnecting&&this.reconnections<=this.maxReconnectAttempts-1&&(this.reconnecting=!0,this.reconnections=this.reconnections+1,this.log.error(`Reconnecting in ${Math.round(this.reconnectTimer/1e3)} seconds..`),this.emit("reconnect"),setTimeout((()=>{this.reconnecting=!1,this.connect().catch((e=>this.log.error(e)))}),this.reconnectTimer)),this.ws=null},d.prototype._onClose=function(){this.moderators={},this.userstate={},this.globaluserstate={},clearInterval(this.pingLoop),clearTimeout(this.pingTimeout),clearTimeout(this._updateEmotesetsTimer),this.wasCloseCalled?(this.wasCloseCalled=!1,this.reason="Connection closed.",this.log.info(this.reason),this.emits(["_promiseConnect","_promiseDisconnect","disconnected"],[[this.reason],[null],[this.reason]])):(this.emits(["_promiseConnect","disconnected"],[[this.reason]]),this.reconnect&&this.reconnections===this.maxReconnectAttempts&&(this.emit("maxreconnect"),this.log.error("Maximum reconnection attempts reached.")),this.reconnect&&!this.reconnecting&&this.reconnections<=this.maxReconnectAttempts-1&&(this.reconnecting=!0,this.reconnections=this.reconnections+1,this.log.error(`Could not connect to server. Reconnecting in ${Math.round(this.reconnectTimer/1e3)} seconds..`),this.emit("reconnect"),setTimeout((()=>{this.reconnecting=!1,this.connect().catch((e=>this.log.error(e)))}),this.reconnectTimer))),this.ws=null},d.prototype._getPromiseDelay=function(){return this.currentLatency<=600?600:this.currentLatency+100},d.prototype._sendCommand=function(e,t,s,i){return new Promise(((n,o)=>{if(!this._isConnected())return o("Not connected to server.");if(null!==e&&"number"!=typeof e||(null===e&&(e=this._getPromiseDelay()),l.promiseDelay(e).then((()=>o("No response from Twitch.")))),null!==t){const e=l.channel(t);this.log.info(`[${e}] Executing command: ${s}`),this.ws.send(`PRIVMSG ${e} :${s}`)}else this.log.info(`Executing command: ${s}`),this.ws.send(s);"function"==typeof i?i(n,o):n()}))},d.prototype._sendMessage=function(e,t,s,i){return new Promise(((n,o)=>{if(!this._isConnected())return o("Not connected to server.");if(l.isJustinfan(this.getUsername()))return o("Cannot send anonymous messages.");const r=l.channel(t);if(this.userstate[r]||(this.userstate[r]={}),s.length>=500){const i=l.splitLine(s,500);s=i[0],setTimeout((()=>{this._sendMessage(e,t,i[1],(()=>{}))}),350)}this.ws.send(`PRIVMSG ${r} :${s}`);const a={};Object.keys(this.emotesets).forEach((e=>this.emotesets[e].forEach((e=>(l.isRegex(e.code)?h.emoteRegex:h.emoteString)(s,e.code,e.id,a)))));const c=Object.assign(this.userstate[r],h.emotes({emotes:h.transformEmotes(a)||null})),m=l.get(this.opts.options.messagesLogLevel,"info"),d=l.actionMessage(s);d?(c["message-type"]="action",this.log[m](`[${r}] *<${this.getUsername()}>: ${d[1]}`),this.emits(["action","message"],[[r,c,d[1],!0]])):(c["message-type"]="chat",this.log[m](`[${r}] <${this.getUsername()}>: ${s}`),this.emits(["chat","message"],[[r,c,s,!0]])),"function"==typeof i?i(n,o):n()}))},d.prototype._updateEmoteset=function(e){let t=void 0!==e;if(t&&(e===this.emotes?t=!1:this.emotes=e),this._skipUpdatingEmotesets)return void(t&&this.emit("emotesets",e,{}));const s=()=>{this._updateEmotesetsTimerDelay>0&&(clearTimeout(this._updateEmotesetsTimer),this._updateEmotesetsTimer=setTimeout((()=>this._updateEmoteset(e)),this._updateEmotesetsTimerDelay))};this._getToken().then((t=>{const s=`https://api.twitch.tv/kraken/chat/emoticon_images?emotesets=${e}`,n={};return"fetchAgent"in this.opts.connection&&(n.agent=this.opts.connection.fetchAgent),i(s,{...n,headers:{Accept:"application/vnd.twitchtv.v5+json",Authorization:`OAuth ${l.token(t)}`,"Client-ID":this.clientId}})})).then((e=>e.json())).then((t=>{this.emotesets=t.emoticon_sets||{},this.emit("emotesets",e,this.emotesets),s()})).catch((()=>s()))},d.prototype.getUsername=function(){return this.username},d.prototype.getOptions=function(){return this.opts},d.prototype.getChannels=function(){return this.channels},d.prototype.isMod=function(e,t){const s=l.channel(e);return this.moderators[s]||(this.moderators[s]=[]),this.moderators[s].includes(l.username(t))},d.prototype.readyState=function(){return null===this.ws?"CLOSED":["CONNECTING","OPEN","CLOSING","CLOSED"][this.ws.readyState]},d.prototype._isConnected=function(){return null!==this.ws&&1===this.ws.readyState},d.prototype.disconnect=function(){return new Promise(((e,t)=>{null!==this.ws&&3!==this.ws.readyState?(this.wasCloseCalled=!0,this.log.info("Disconnecting from server.."),this.ws.close(),this.once("_promiseDisconnect",(()=>e([this.server,~~this.port])))):(this.log.error("Cannot disconnect from server. Socket is not opened or connection is already closing."),t("Cannot disconnect from server. Socket is not opened or connection is already closing."))}))},d.prototype.off=d.prototype.removeListener,e.exports&&(e.exports=d),"undefined"!=typeof window&&(window.tmi={client:d,Client:d})}(client$1);var clientExports=client$1.exports;const client=clientExports;var tmi_js={client:client,Client:client};const tmi=getDefaultExportFromCjs(tmi_js);class Chat{constructor(e,t,s,i){this.scene=e,this._username=t,this._password=s;const n=new URLSearchParams(window.location.search);this.channel=n.get("channel")||"devdiaries",this.feedback="1"==n.get("feedback"),this.maxPlayers=this.isValidNumberWithMax(n.get("maxplayers"))?+n.get("maxplayers"):500,this.init()}init(){console.log("Chat channel: ",this.channel,"feedback: ",this.feedback,"maxPlayers: ",this.maxPlayers),this.client=new tmi.Client({options:{debug:!1},channels:[this.channel]}),this.client.connect().then((e=>{console.log("Connected!, loading game"),this.scene.loadGame()})).catch(console.error),this.setOnJoinListener(),this.setOnMessageListener(),this.setOnChatListener}setOnJoinListener(){this.client.on("join",((e,t,s)=>{console.log("Somebody joined the chat: ",e,t),s&&this.scene.addPlayer(t)}))}setOnMessageListener(){this.client.on("message",((e,t,s,i)=>{console.log(`Message: ${t.username} just ${s}`),this.processMessage(t.username,s)}))}setOnChatListener(){this.client.on("chat",(async(e,t,s,i)=>{t.mod;const n=s.toLowerCase().split(" ");console.log("Received chat: ",e,t,n),this.processMessage(t["display-name"],s)}))}processMessage(e,t){this.isValidNumber(t)&&this.scene.guess(e,+t)}sendAction(e,t){console.log("Sending action: ",this.feedback,e,t),this.feedback&&this.client.action(e,t)}say(e){this.feedback&&this.client.say(this.channel,e)}isValidNumberWithMax(e,t=100){return this.isValidNumber(e)&&+e>0&&+e<=t}isValidNumber(e){return!isNaN(e)}}class Game extends Phaser.Scene{constructor(){super({key:"game"}),this.player=null,this.score=0,this.scoreText=null,this.nextOperator="",this.lastMessage=null,this.number="",this.counter=0,this.failed=!1}preload(){const e=new URLSearchParams(window.location.search);let t=e.get("background")||"#00b140";t=parseInt(t.substring(1),16),this.backgroundColor="0x"+t.toString(16);let s=e.get("foreground")||"#F0EAD6";s=parseInt(s.substring(1),16),this.foregroundColor="0x"+s.toString(16),this.spamTimeWait=2,this.result=Phaser.Math.Between(1,9)}create(){this.width=this.sys.game.config.width,this.height=this.sys.game.config.height,this.center_width=this.width/2,this.center_height=this.height/2,this.cameras.main.setBackgroundColor(+this.foregroundColor),this.allPlayers={},this.addChat(),this.loadAudios(),this.addUI()}addChat(){this.chat=new Chat(this)}loadGame(){this.generateNextOperation()}addUI(){this.circle=this.add.circle(this.center_width,this.center_height-50,100,15871022),this.numberText=this.add.bitmapText(this.center_width,this.center_height-50,"mainFont",this.number,120).setOrigin(.5).setTint(0),this.operatorText=this.add.bitmapText(this.center_width,this.center_height+80,"mainFont",`${this.nextOperator}${this.number}`,50).setOrigin(.5).setTint(0),this.addClouds(),this.addScore(),this.byText=this.add.bitmapText(this.center_width,this.height-10,"mainFont","by Pello",10).setOrigin(.5).setTint(0)}addClouds(){this.cloudLeft=this.add.image(this.center_width-100,this.center_height-120+Phaser.Math.Between(-15,15),"cloud"+Phaser.Math.Between(1,14)).setScale(.1*Phaser.Math.Between(5,9)),this.cloudRight=this.add.image(this.center_width+100,this.center_height+30+Phaser.Math.Between(-15,15),"cloud"+Phaser.Math.Between(1,14)).setScale(.1*Phaser.Math.Between(4,6)),this.tweens.add({targets:[this.cloudLeft],x:{from:-156,to:this.width+156},duration:3e4,onComplete:()=>{this.cloudLeft.destroy()}}),this.tweens.add({targets:this.cloudRight,x:{from:this.width+156,to:-156},duration:3e4,onComplete:()=>{this.cloudLeft.destroy(),this.addClouds()}})}addScore(){const e=this.createScoreBoard();this.add.bitmapText(this.center_width,25,"mainFont","zenbaki",25).setOrigin(.5).setTint(0),e.slice(0,3).forEach(((e,t)=>{const s=`${t+1}. ${e.name}: ${e.score}`;this.add.bitmapText(this.center_width,100+50*t,"mainFont",s,30).setOrigin(.5).setTint(this.foregroundColor).setDropShadow(1,2,12526882,.7)})),this.scoreText1=this.add.bitmapText(this.center_width,this.center_height+130,"mainFont","",20).setOrigin(.5).setTint(0),this.scoreText2=this.add.bitmapText(this.center_width,this.center_height+160,"mainFont","",25).setOrigin(.5).setTint(0)}addPlayer(e){if(this.allPlayers[e])return this.allPlayers[e];const t=new Player(this,e);return this.allPlayers[e]=t,this.chat.say(`Player ${e} joins game!`),t}guess(e,t){if(this.failed)return;console.log("Game> guess: ",e,t);const s=this.addPlayer(e);if(!s.dead&&!s.hasSpammed())if(s.lastMessage=new Date,console.log("Game> guess go on: ",e,t),this.result===parseInt(t)){const i=this.calculateScore();s.score+=i,this.showScore(e,i),this.generateNextOperation(),console.log("Player",e,"guess",t)}else this.number===parseInt(t)?console.log("Player, ",e," is too slow"):(this.cameras.main.shake(100,.01),this.playAudio("fail"),this.failed=!0,s.setPenalty(),this.showShame(e),this.chat.say(`Player ${e} failed! Shame on you!`))}calculateScore(){return this.counter+{"+":1,"-":2,"*":4,"/":5}[this.nextOperator]}loadAudios(){this.audios={win:this.sound.add("win"),drip:this.sound.add("drip"),fail:this.sound.add("fail")}}playAudio(e){this.audios[e].play({volume:.5})}showResult(){const e=this.createScoreBoard();this.scoreRectangle=this.add.rectangle(0,0,this.width,this.height,this.foregroundColor,.9).setOrigin(0,0),this.scores=this.add.group(),this.sensei=this.add.image(this.center_width,this.height-60,"sensei").setOrigin(.5).setScale(.4),this.scores.add(this.sensei),this.scores.add(this.add.bitmapText(this.center_width,60,"mainFont","Senseis:",30).setOrigin(.5).setTint(0)),e.slice(0,5).forEach(((e,t)=>{const s=`${t+1}. ${e.name}, ${e.score}`;this.scores.add(this.add.bitmapText(this.center_width,100+20*t,"mainFont",s,15).setOrigin(.5).setTint(0))})),this.removeResult()}removeResult(){this.time.delayedCall(5e3,(()=>{this.tweens.add({targets:[this.scoreRectangle,this.scores,this.sensei],duration:1e3,alpha:{from:1,to:0},onComplete:()=>{this.scoreRectangle.destroy(),this.scores.getChildren().forEach((function(e){e.destroy()}),this),this.scores.clear(!0,!0)}}),this.resetScore(),this.generateNextOperation()}),null,this)}createScoreBoard(){return[...Object.values(this.allPlayers)].sort(((e,t)=>t.score-e.score))}resetScore(){this.number=0,this.counter=0,this.failed=!1}generateNextOperation(){this.counter++,this.number=this.result,this.nextOperand=Phaser.Math.Between(1,9),this.nextOperator=this.selectOperator(),this.result=parseInt(eval(this.number+this.nextOperator+this.nextOperand)),console.log("Current: ",this.number," operator: ",this.nextOperator," nextNumber: ",this.nextOperand,", Result: ",this.result),this.showNextOperation(this.nextOperator,this.nextOperand),this.playAudio("drip")}selectOperator(){return this.number%this.nextOperand==0&&1!==this.nextOperand?Phaser.Math.RND.pick(["+","-","+","-","/"]):this.number+this.nextOperand>=100?Phaser.Math.RND.pick(["-"]):this.number-this.nextOperand<=-100?Phaser.Math.RND.pick(["+"]):Math.abs(this.number*this.nextOperand)<100?Phaser.Math.RND.pick(["+","-","+","-","*"]):Phaser.Math.RND.pick(["+","-","+","-"])}showScore(e,t){this.scoreText1.setText("Great!").setAlpha(1),this.scoreText2.setText(`${e} +${t}`).setAlpha(1),this.tweens.add({targets:[this.scoreText1],alpha:{from:1,to:0},ease:"Linear",duration:3e3})}showShame(e){this.scoreText1.setText(Phaser.Math.RND.pick(["You're a disgrace","Shame on you","You dishonor us all","You're a disappointment","You're a failure","You dishonor this dojo"])).setAlpha(1),this.scoreText2.setText(`${e}`).setAlpha(1),this.tweens.add({targets:[this.scoreText1,this.scoreText2],alpha:{from:1,to:0},ease:"Linear",duration:3e3,onComplete:()=>{this.showResult()}})}showNextOperation(e,t){this.numberText.setText(this.number),this.operatorText.setText(`${e}${t}`)}}const config={width:260,height:380,scale:{autoCenter:Phaser$1.Scale.CENTER_BOTH},autoRound:!1,parent:"game-container",physics:{default:"arcade",arcade:{gravity:{y:300},debug:!1}},scene:[Bootloader,Game]};new Phaser$1.Game(config); diff --git a/zenbaki/dist/index.html b/zenbaki/dist/index.html index 33da6957..6b5e79bf 100644 --- a/zenbaki/dist/index.html +++ b/zenbaki/dist/index.html @@ -4,7 +4,7 @@ - Phaser - Template + Phaser - Zenbaki - +