@drincs/pixi-vn 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/canvas/CanvasManager.cjs +1 -1
  2. package/dist/canvas/CanvasManager.js +1 -1
  3. package/dist/canvas/CanvasManagerStatic.cjs +1 -1
  4. package/dist/canvas/CanvasManagerStatic.js +1 -1
  5. package/dist/canvas/components/Container.cjs +1 -1
  6. package/dist/canvas/components/Container.js +1 -1
  7. package/dist/canvas/components/ImageContainer.cjs +1 -1
  8. package/dist/canvas/components/ImageContainer.js +1 -1
  9. package/dist/canvas/components/ImageSprite.cjs +2 -2
  10. package/dist/canvas/components/ImageSprite.js +2 -2
  11. package/dist/canvas/components/Sprite.cjs +1 -1
  12. package/dist/canvas/components/Sprite.js +1 -1
  13. package/dist/canvas/components/Text.cjs +1 -1
  14. package/dist/canvas/components/Text.js +1 -1
  15. package/dist/canvas/components/VideoSprite.cjs +2 -2
  16. package/dist/canvas/components/VideoSprite.js +2 -2
  17. package/dist/canvas/decorators/canvas-element-decorator.cjs +1 -1
  18. package/dist/canvas/decorators/canvas-element-decorator.js +1 -1
  19. package/dist/canvas/decorators/event-decorator.cjs +1 -1
  20. package/dist/canvas/decorators/event-decorator.js +1 -1
  21. package/dist/canvas/functions/canvas-effect.cjs +1 -1
  22. package/dist/canvas/functions/canvas-effect.js +1 -1
  23. package/dist/canvas/functions/canvas-import-utility.cjs +1 -1
  24. package/dist/canvas/functions/canvas-import-utility.js +1 -1
  25. package/dist/canvas/functions/canvas-transition.cjs +1 -1
  26. package/dist/canvas/functions/canvas-transition.js +1 -1
  27. package/dist/canvas/functions/image-container-utility.cjs +1 -1
  28. package/dist/canvas/functions/image-container-utility.js +1 -1
  29. package/dist/canvas/functions/image-utility.cjs +1 -1
  30. package/dist/canvas/functions/image-utility.js +1 -1
  31. package/dist/canvas/functions/video-utility.cjs +1 -1
  32. package/dist/canvas/functions/video-utility.js +1 -1
  33. package/dist/canvas/index.cjs +1 -1
  34. package/dist/canvas/index.js +1 -1
  35. package/dist/canvas/tickers/classes/TickerBase.cjs +1 -1
  36. package/dist/canvas/tickers/classes/TickerBase.js +1 -1
  37. package/dist/canvas/tickers/components/FadeAlphaTicker.cjs +1 -1
  38. package/dist/canvas/tickers/components/FadeAlphaTicker.js +1 -1
  39. package/dist/canvas/tickers/components/MoveTicker.cjs +1 -1
  40. package/dist/canvas/tickers/components/MoveTicker.js +1 -1
  41. package/dist/canvas/tickers/components/RotateTicker.cjs +1 -1
  42. package/dist/canvas/tickers/components/RotateTicker.js +1 -1
  43. package/dist/canvas/tickers/components/ZoomTicker.cjs +1 -1
  44. package/dist/canvas/tickers/components/ZoomTicker.js +1 -1
  45. package/dist/canvas/tickers/decorators/ticker-decorator.cjs +1 -1
  46. package/dist/canvas/tickers/decorators/ticker-decorator.js +1 -1
  47. package/dist/canvas/tickers/functions/ticker-texture-utility.cjs +1 -1
  48. package/dist/canvas/tickers/functions/ticker-texture-utility.js +1 -1
  49. package/dist/canvas/tickers/index.cjs +1 -1
  50. package/dist/canvas/tickers/index.js +1 -1
  51. package/dist/character/classes/CharacterBaseModel.cjs +17 -17
  52. package/dist/character/classes/CharacterBaseModel.js +17 -17
  53. package/dist/character/classes/CharacterStoredClass.cjs +16 -16
  54. package/dist/character/classes/CharacterStoredClass.js +16 -16
  55. package/dist/character/decorators/character-decorator.cjs +1 -1
  56. package/dist/character/decorators/character-decorator.js +1 -1
  57. package/dist/character/index.cjs +16 -16
  58. package/dist/character/index.js +16 -16
  59. package/dist/classes/CachedMap.cjs +1 -1
  60. package/dist/classes/CachedMap.d.cts +1 -1
  61. package/dist/classes/CachedMap.d.ts +1 -1
  62. package/dist/classes/CachedMap.js +1 -1
  63. package/dist/classes/index.cjs +1 -1
  64. package/dist/classes/index.js +1 -1
  65. package/dist/constants.cjs +1 -1
  66. package/dist/constants.d.cts +5 -1
  67. package/dist/constants.d.ts +5 -1
  68. package/dist/constants.js +1 -1
  69. package/dist/history/HistoryManager.cjs +2 -2
  70. package/dist/history/HistoryManager.d.cts +24 -13
  71. package/dist/history/HistoryManager.d.ts +24 -13
  72. package/dist/history/HistoryManager.js +2 -2
  73. package/dist/history/HistoryManagerStatic.cjs +1 -1
  74. package/dist/history/HistoryManagerStatic.d.cts +9 -8
  75. package/dist/history/HistoryManagerStatic.d.ts +9 -8
  76. package/dist/history/HistoryManagerStatic.js +1 -1
  77. package/dist/history/index.cjs +2 -2
  78. package/dist/history/index.d.cts +4 -2
  79. package/dist/history/index.d.ts +4 -2
  80. package/dist/history/index.js +2 -2
  81. package/dist/history/interfaces/HistoryManagerInterface.d.cts +54 -11
  82. package/dist/history/interfaces/HistoryManagerInterface.d.ts +54 -11
  83. package/dist/{index-CWhYJ7yq.d.ts → index-CvpVN1rC.d.ts} +3 -3
  84. package/dist/{index-CVn6zVij.d.cts → index-DCnX_VPi.d.cts} +3 -3
  85. package/dist/index.cjs +73 -73
  86. package/dist/index.d.cts +6 -5
  87. package/dist/index.d.ts +6 -5
  88. package/dist/index.js +73 -73
  89. package/dist/narration/NarrationManager.cjs +16 -16
  90. package/dist/narration/NarrationManager.d.cts +1 -1
  91. package/dist/narration/NarrationManager.d.ts +1 -1
  92. package/dist/narration/NarrationManager.js +16 -16
  93. package/dist/narration/NarrationManagerStatic.cjs +1 -1
  94. package/dist/narration/NarrationManagerStatic.js +1 -1
  95. package/dist/narration/classes/ChoiceMenuOption.cjs +1 -1
  96. package/dist/narration/classes/ChoiceMenuOption.js +1 -1
  97. package/dist/narration/decorators/RegisteredLabels.cjs +1 -1
  98. package/dist/narration/decorators/RegisteredLabels.js +1 -1
  99. package/dist/narration/decorators/newLabel.cjs +1 -1
  100. package/dist/narration/decorators/newLabel.js +1 -1
  101. package/dist/narration/index.cjs +17 -17
  102. package/dist/narration/index.d.cts +2 -2
  103. package/dist/narration/index.d.ts +2 -2
  104. package/dist/narration/index.js +17 -17
  105. package/dist/narration/interfaces/HistoryStep.d.cts +5 -5
  106. package/dist/narration/interfaces/HistoryStep.d.ts +5 -5
  107. package/dist/narration/interfaces/{NarrativeHistory.d.cts → NarrationHistory.d.cts} +2 -2
  108. package/dist/narration/interfaces/{NarrativeHistory.d.ts → NarrationHistory.d.ts} +2 -2
  109. package/dist/narration/interfaces/NarrationManagerInterface.d.cts +1 -1
  110. package/dist/narration/interfaces/NarrationManagerInterface.d.ts +1 -1
  111. package/dist/pixi-devtools/additionalPositionsProperties.cjs +1 -1
  112. package/dist/pixi-devtools/additionalPositionsProperties.js +1 -1
  113. package/dist/pixi-vn.d.d.cts +44 -1
  114. package/dist/pixi-vn.d.d.ts +44 -1
  115. package/dist/storage/StorageManager.cjs +1 -1
  116. package/dist/storage/StorageManager.js +1 -1
  117. package/dist/storage/StorageManagerStatic.cjs +1 -1
  118. package/dist/storage/StorageManagerStatic.js +1 -1
  119. package/dist/storage/classes/StoredClassModel.cjs +1 -1
  120. package/dist/storage/classes/StoredClassModel.js +1 -1
  121. package/dist/storage/index.cjs +1 -1
  122. package/dist/storage/index.js +1 -1
  123. package/dist/utils/diff-utility.d.cts +2 -2
  124. package/dist/utils/diff-utility.d.ts +2 -2
  125. package/package.json +3 -3
  126. /package/dist/narration/interfaces/{NarrativeHistory.cjs → NarrationHistory.cjs} +0 -0
  127. /package/dist/narration/interfaces/{NarrativeHistory.js → NarrationHistory.js} +0 -0
@@ -566,4 +566,4 @@ fn mainFragment(
566
566
 
567
567
  outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
568
568
 
569
- `}};});var mh,gh,To,dm=p(()=>{J();Is();hm();Os();hi();xe();pt();cm();To=class extends Jt{constructor(){mh??(mh=nr({name:"tiling-sprite-shader",bits:[Ci,lm,hr]})),gh??(gh=ar({name:"tiling-sprite-shader",bits:[am,um,lr]}));let t=new Tt({uMapCoord:{value:new M,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new M,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:gh,gpuProgram:mh,resources:{localUniforms:new Tt({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:k.EMPTY.source,uSampler:k.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var wo,fm=p(()=>{So();wo=class extends Tr{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function pm(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height;}var mm=p(()=>{});function gm(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,h=r.c,l=r.d,u=r.tx,c=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+h*d+u,i[e+1]=a*f+l*d+c,e+=t,s++;}}var xm=p(()=>{});function _m(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=M.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),gm(t,2,0,a);}var ym=p(()=>{J();xm();});var Po,Mi,bm=p(()=>{F();si();Ks();ai();di();qs();So();dm();fm();mm();ym();Po=new wo,Mi=class{constructor(t){this._state=Ue.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash");}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ye);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e);}else r.break(e),s.shader||(s.shader=new To),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,_e(t.groupColorAlpha,r.uColor,0),this._state.blendMode=ae(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Po,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Tr({indices:Po.indices,positions:Po.positions.slice(),uvs:Po.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:true,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),_m(t,r.uvs),pm(t,r.positions);}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===Qt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Mi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"};});var xh=p(()=>{F();bm();I.add(Mi);});var vm,Tm,wm=p(()=>{lt();So();vm=class Sm extends Tr{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(G(z,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e);}build(t){t={...Sm.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;r.push(f*h,d*l),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,m=d*this.verticesX+f,x=d*this.verticesX+f+1,g=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(m,x,g,x,_,g);}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};vm.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Tm=vm;});var Pm,Mm,Am=p(()=>{wm();Pm=class Cm extends Tm{constructor(t={}){t={...Cm.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=r>f?1:r/f,m=Math.min(c,d),x=h*e,g=l*r;t[0]=t[8]=t[16]=t[24]=-x,t[2]=t[10]=t[18]=t[26]=s*m-x,t[4]=t[12]=t[20]=t[28]=e-o*m-x,t[6]=t[14]=t[22]=t[30]=e-x,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*m-g,t[17]=t[19]=t[21]=t[23]=r-a*m-g,t[25]=t[27]=t[29]=t[31]=r-g,this.getBuffer("aPosition").update();}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update();}};Pm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Mm=Pm;});var Ai,Em=p(()=>{F();Gt();qs();Am();Ai=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash");}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];H.return(e.geometry),H.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=H.get(ye);return e.geometry=H.get(Mm),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null;}};Ai.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"};});var _h=p(()=>{F();Em();I.add(Ai);});var Ei,Bm=p(()=>{F();Ei=class{constructor(t){this._renderer=t;}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Ei.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"};});function Rm(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var Fm=p(()=>{});var u_,Bi,km=p(()=>{F();J();Ot();ii();ni();xe();pt();Xe();ai();zt();Fm();xt();u_=new Zt({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Bi=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Tt({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Lt({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=true;return}let o=s.bounds;if(t.renderables?Rm(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,u=false,c=false,f=true;for(let d=0;d<r.length;d++){let m=r[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),h+=m.padding,m.antialias==="off"?l=false:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=false),!!!(m.compatibleRenderers&e.type)){c=false;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){U("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),c=false;break}c=m.enabled||c,u||(u=m.blendRequired);}if(!c){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m);}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=true;return}s.skip=false,s.bounds=o,s.blendRequired=u,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=_t.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:o});}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=k.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a);}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,false),_t.returnTexture(r);else {let a=e.inputTexture,h=_t.getOptimalTexture(s.width,s.height,a.source._resolution,false),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,true);let c=a;a=h,h=c;}n[l].apply(this,a,e.previousRenderSurface,false),_t.returnTexture(a),_t.returnTexture(h);}e.blendRequired&&_t.returnTexture(o);}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=_t.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=V.shared,u=n.previousRenderSurface===r,c=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(c=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,x=m.uOutputFrame,g=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,v=m.uGlobalFrame,b=m.uOutputTexture;if(u){let w=this._filterStackIndex;for(;w>0;){w--;let E=this._filterStack[this._filterStackIndex-1];if(!E.skip){h.x=E.bounds.minX,h.y=E.bounds.minY;break}}x[0]=a.minX-h.x,x[1]=a.minY-h.y;}else x[0]=0,x[1]=0;x[2]=e.frame.width,x[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*g[2]-.5*_[2],y[3]=e.frame.height*g[3]-.5*_[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=h.x*c,v[1]=h.y*c,v[2]=P.source.width*c,v[3]=P.source.height*c;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof k?(b[0]=r.frame.width,b[1]=r.frame.height):(b[0]=S.width,b[1]=S.height),b[2]=S.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(w,0);}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:u_,shader:t,state:t._state,topology:"triangle-list"}),o.type===Qt.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new rt,container:null,filterEffect:null,blendRequired:false,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(M.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Bi.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"filter"};});var yh=p(()=>{F();Bm();km();I.add(Bi);I.add(Ei);});var c_={};var Im=p(()=>{pu();xn();Su();wu();ms();vs();Aa();Ea();ka();sh();ch();ph();xh();_h();yh();});var d_={};var Lm=p(()=>{xn();ms();vs();Aa();Ea();ka();sh();ch();ph();xh();_h();yh();});var $t={};eg($t,{DistortionFilter:()=>zi,EqualizerFilter:()=>kt,Filter:()=>ht,MonoFilter:()=>Hi,ReverbFilter:()=>Wi,StereoFilter:()=>Vi,StreamFilter:()=>Ni,TelephoneFilter:()=>Yi});var Bh;function Rh(i){return Bh=i,i}function $(){return Bh}var ht=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var zi=class extends ht{constructor(t=0){let e;if(!$().useLegacy){let{audioContext:r}=$().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,$().useLegacy)return;let e=t*1e3,r=44100,s=new Float32Array(r),o=Math.PI/180,n=0,a;for(;n<r;++n)a=n*2/r-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var ot=class{static setParamValue(t,e){if(t.setValueAtTime){let r=$().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var X=class extends ht{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,h=0,l=0){let u=[],c=[{f:X.F32,type:"lowshelf",gain:i},{f:X.F64,type:"peaking",gain:t},{f:X.F125,type:"peaking",gain:e},{f:X.F250,type:"peaking",gain:r},{f:X.F500,type:"peaking",gain:s},{f:X.F1K,type:"peaking",gain:o},{f:X.F2K,type:"peaking",gain:n},{f:X.F4K,type:"peaking",gain:a},{f:X.F8K,type:"peaking",gain:h},{f:X.F16K,type:"highshelf",gain:l}];$().useLegacy||(u=c.map(f=>{let d=$().context.audioContext.createBiquadFilter();return d.type=f.type,ot.setParamValue(d.Q,1),d.frequency.value=f.f,ot.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(i,t=0){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);ot.setParamValue(this.bandsMap[i].gain,t);}getGain(i){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);return this.bandsMap[i].gain.value}set f32(i){this.setGain(X.F32,i);}get f32(){return this.getGain(X.F32)}set f64(i){this.setGain(X.F64,i);}get f64(){return this.getGain(X.F64)}set f125(i){this.setGain(X.F125,i);}get f125(){return this.getGain(X.F125)}set f250(i){this.setGain(X.F250,i);}get f250(){return this.getGain(X.F250)}set f500(i){this.setGain(X.F500,i);}get f500(){return this.getGain(X.F500)}set f1k(i){this.setGain(X.F1K,i);}get f1k(){return this.getGain(X.F1K)}set f2k(i){this.setGain(X.F2K,i);}get f2k(){return this.getGain(X.F2K)}set f4k(i){this.setGain(X.F4K,i);}get f4k(){return this.getGain(X.F4K)}set f8k(i){this.setGain(X.F8K,i);}get f8k(){return this.getGain(X.F8K)}set f16k(i){this.setGain(X.F16K,i);}get f16k(){return this.getGain(X.F16K)}reset(){this.bands.forEach(i=>{ot.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},kt=X;kt.F32=32;kt.F64=64;kt.F125=125;kt.F250=250;kt.F500=500;kt.F1K=1e3;kt.F2K=2e3;kt.F4K=4e3;kt.F8K=8e3;kt.F16K=16e3;var Hi=class extends ht{constructor(){let t,e;if(!$().useLegacy){let{audioContext:r}=$().context;e=r.createChannelSplitter(),t=r.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var Wi=class extends ht{constructor(t=3,e=2,r=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=r,this._rebuild();}_clamp(t,e,r){return Math.min(r,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if($().useLegacy)return;let{audioContext:t}=$().context,e=t.sampleRate,r=e*this._seconds,s=t.createBuffer(2,r,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<r;l++)a=this._reverse?r-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var Vi=class extends ht{constructor(t=0){let e,r,s;if(!$().useLegacy){let{audioContext:o}=$().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(r=o.createPanner(),r.panningModel="equalpower",s=r);}super(s),this._stereo=e,this._panner=r,this.pan=t;}set pan(t){this._pan=t,this._stereo?ot.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Ni=class extends ht{constructor(){let t,e;if(!$().useLegacy){let{audioContext:r}=$().context;t=r.createMediaStreamDestination(),e=r.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Yi=class extends ht{constructor(){let t,e;if(!$().useLegacy){let{audioContext:r}=$().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",ot.setParamValue(s.frequency,2e3),o.type="lowpass",ot.setParamValue(o.frequency,2e3),n.type="highpass",ot.setParamValue(n.frequency,500),a.type="highpass",ot.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};F();var Gm={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Im(),c_));}};F();var Dm={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Lm(),d_));}};F();F();vs();ms();Cn();Wt();Dn();Yr();Mt();ps();Oi(fa());I.add(Gm,Dm);var Ri=class extends Y{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var p_=0,bh=class extends Y{constructor(i){super(),this.id=p_++,this.init(i);}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(i){this._playing=false,this._duration=i.source.duration;let t=this._source=i.source.cloneNode(false);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters");}refresh(){let i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=i.volume*(i.muted?0:1),r=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*r,this._source.playbackRate=this._speed*i.speed*t.speed;}refreshPaused(){let i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(i){let{start:t,end:e,speed:r,loop:s,volume:o,muted:n}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=r,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-bh.PADDING),this._end=Math.min(this._end+bh.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),ut.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){ut.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){ut.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Co=bh;Co.PADDING=.1;var Fi=class extends Y{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Co(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,r=this.parent;if(e.readyState===4){r.isLoaded=true;let h=r.autoPlayStart();t&&setTimeout(()=>{t(null,r,h);},0);return}if(!r.url){t(new Error("sound.url or sound.source must be set"));return}e.src=r.url;let s=()=>{a(),r.isLoaded=true;let h=r.autoPlayStart();t&&t(null,r,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var ki=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var He=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],vh=["audio/mpeg","audio/ogg"],We={};function Um(i){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),r={},s=/^no$/;He.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";r[o]=!!n||!!a;}),Object.assign(We,r);}Um();var g_=0,Ii=class extends Y{constructor(t){super(),this.id=g_++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let r=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);ot.setParamValue(this._gain.gain,o*s*r),ot.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,r=this._paused||e.paused||t.paused;r!==this._pausedReal&&(this._pausedReal=r,r?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",r));}play(t){let{start:e,end:r,speed:s,loop:o,volume:n,muted:a,filters:h}=t;r&&console.assert(r>e,"End time is before start time"),this._paused=false;let{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=r,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=r,this._source.loopStart=e,this._source.start(0,e)):r?this._source.start(0,e,r-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){ut.shared.remove(this._updateListener,this),t&&ut.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Ve=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(r=>{e===null?this._input.connect(r.destination):e.connect(r.destination),e=r;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Om=class extends Ve{constructor(i){let t=i.audioContext,e=t.createBufferSource(),r=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(r),r.connect(i.destination),super(s,r),this.context=i,this.bufferSource=e,this.gain=r,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Om.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,ot.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Mo=Om;Mo.BUFFER_SIZE=0;var Ne=class{init(t){this.parent=t,this._nodes=new Mo(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Ii(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,r=await it.get().fetch(e);this._decode(await r.arrayBuffer(),t);}_decode(t,e){let r=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?r(null,t):this.parent.context.decode(t,r);}};var wr=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=$().useLegacy?new Fi:new Ne;return new wr(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(i){let[t]=i.map(e=>({url:e,ext:Pt.extname(e).slice(1)})).filter(({ext:e})=>We[e]).sort((e,r)=>He.indexOf(e.ext)-He.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return $().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get filters(){return this.media.filters}set filters(i){this.media.filters=i;}addSprites(i,t){if(typeof i=="object"){let r={};for(let s in i)r[s]=this.addSprites(s,i[s]);return r}console.assert(!this._sprites[i],`Alias ${i} is already taken`);let e=new ki(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(i){if(i){let t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let r=this._createInstance();return this._instances.push(r),this.isPlaying=true,r.once("end",()=>{e.complete&&e.complete(this),this._onComplete(r);}),r.once("stop",()=>{this._onComplete(r);}),r.play(e),r}refresh(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh();}refreshPaused(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}_preload(i){this.media.load(i);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0;}_onComplete(i){if(this._instances){let t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(i);}_createInstance(){if(wr._pool.length>0){let i=wr._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),wr._pool.indexOf(i)<0&&wr._pool.push(i);}},ve=wr;ve._pool=[];var Pr=class i extends Ve{constructor(){let t=window,e=new i.AudioContext,r=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(r),r.connect(e.destination),super(s,r),this.autoPause=true,this._ctx=e,this._offlineCtx=new i.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=r,this.analyser=s,this.events=new Y,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let r=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},r);s&&s.catch(r);}};var Ao=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Pr),this._htmlAudioContext=new Ri,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return Pr.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof ve)return this._sounds[t]=e,e;let r=this._getOptions(e),s=ve.from(r);return this._sounds[t]=s,s}_getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let r=!!this._sounds[t];return e&&console.assert(r,`No sound matching alias '${t}'.`),r}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let r=this.find(t);return e!==void 0&&(r.volume=e),r.volume}speed(t,e){let r=this.find(t);return e!==void 0&&(r.speed=e),r.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var zm=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=Pt.basename(t,Pt.extname(t))),e},Hm={extension:T.Asset,detection:{test:async()=>true,add:async i=>[...i,...He.filter(t=>We[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:Ze.High},test(i){let t=Pt.extname(i).slice(1);return !!We[t]||vh.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>ve.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return $().add(zm(t),e),e},async unload(i,t){$().remove(zm(t));}}};I.add(Hm);Rh(new Ao);({DistortionFilter:$t.DistortionFilter,EqualizerFilter:$t.EqualizerFilter,MonoFilter:$t.MonoFilter,ReverbFilter:$t.ReverbFilter,StereoFilter:$t.StereoFilter,StreamFilter:$t.StreamFilter,TelephoneFilter:$t.TelephoneFilter});var re={OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___"};var Q;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(Q||={});var Ft=class i{static init(t){i._getStepCounter=t.getStepCounter,i._setStepCounter=t.setStepCounter,i._getCurrentGameStepState=t.getCurrentGameStepState,i._restoreGameStepState=t.restoreGameStepState,i._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(i._onGoNextEnd=t.onGoNextEnd),i._getVariable=t.getVariable,i._setVariable=t.setVariable,i._removeVariable=t.removeVariable,i._getFlag=t.getFlag,i._setFlag=t.setFlag,t.onLabelClosing&&(i._onLabelClosing=t.onLabelClosing),i._addHistoryItem=t.addHistoryItem,i._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,i._getCharacter=t.getCharacter;}static _getStepCounter=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return i._getStepCounter()}static set stepCounter(t){i._setStepCounter(t);}static _getCurrentGameStepState=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return i._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return i._restoreGameStepState}static _getOpenedLabels=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return i._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return i._onGoNextEnd}static _getVariable=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return i._getVariable}static _setVariable=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return i._setVariable}static _removeVariable=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return i._removeVariable}static _getFlag=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return i._getFlag}static _setFlag=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return i._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return i._onLabelClosing}static _addHistoryItem=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return i._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentStepsRunningNumber(){return i._getCurrentStepsRunningNumber()}static _getCharacter=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getCharacter(){return i._getCharacter}static onEnd;static onError};function Cr(i){try{if(typeof i>"u")return i;let t=JSON.stringify(i);return JSON.parse(t)}catch(t){throw Q.error("Error creating exportable element",i,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var Mr=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Vm=new Set,Sh=typeof process=="object"&&process?process:{},Nm=(i,t,e,r)=>{typeof Sh.emitWarning=="function"?Sh.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},Eo=globalThis.AbortController,Wm=globalThis.AbortSignal;if(typeof Eo>"u"){Wm=class{onabort;_onabort=[];reason;aborted=false;addEventListener(r,s){this._onabort.push(s);}},Eo=class{constructor(){t();}signal=new Wm;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let i=Sh.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,Nm("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var y_=i=>!Vm.has(i),Se=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Ym=i=>Se(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?Ar:null:null,Ar=class extends Array{constructor(t){super(t),this.fill(0);}},Th=class i{heap;length;static#h=false;static create(t){let e=Ym(t);if(!e)return [];i.#h=true;let r=new i(t,e);return i.#h=false,r}constructor(t,e){if(!i.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Bo=class i{#h;#c;#m;#M;#g;#R;#F;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#x;#i;#r;#t;#l;#d;#a;#o;#_;#n;#y;#b;#f;#v;#C;#u;#k;static unsafeExposeInternals(t){return {starts:t.#b,ttls:t.#f,sizes:t.#y,keyMap:t.#i,keyList:t.#r,valList:t.#t,next:t.#l,prev:t.#d,get head(){return t.#a},get tail(){return t.#o},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,r,s,o)=>t.#L(e,r,s,o),moveToTail:e=>t.#B(e),indexes:e=>t.#S(e),rindexes:e=>t.#T(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#c}get calculatedSize(){return this.#x}get size(){return this.#s}get fetchMethod(){return this.#R}get memoMethod(){return this.#F}get dispose(){return this.#m}get onInsert(){return this.#M}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:u,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:d,maxSize:m=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:S,ignoreFetchAbort:w}=t;if(e!==0&&!Se(e))throw new TypeError("max option must be a nonnegative integer");let E=e?Ym(e):Array;if(!E)throw new Error("invalid max value: "+e);if(this.#h=e,this.#c=m,this.maxEntrySize=x||this.#c,this.sizeCalculation=g,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#F=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#R=_,this.#C=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new E(e),this.#d=new E(e),this.#a=0,this.#o=0,this.#_=Th.create(e),this.#s=0,this.#x=0,typeof l=="function"&&(this.#m=l),typeof u=="function"&&(this.#M=u),typeof c=="function"?(this.#g=c,this.#n=[]):(this.#g=void 0,this.#n=void 0),this.#v=!!this.#m,this.#k=!!this.#M,this.#u=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!w,this.maxEntrySize!==0){if(this.#c!==0&&!Se(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!Se(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V();}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=Se(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!Se(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#D();}if(this.#h===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#c){let B="LRU_CACHE_UNBOUNDED";y_(B)&&(Vm.add(B),Nm("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,i));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#D(){let t=new Ar(this.#h),e=new Ar(this.#h);this.#f=t,this.#b=e,this.#U=(o,n,a=Mr.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(o)&&this.#w(this.#r[o],"expire");},n+1);h.unref&&h.unref();}},this.#A=o=>{e[o]=t[o]!==0?Mr.now():0;},this.#P=(o,n)=>{if(t[n]){let a=t[n],h=e[n];if(!a||!h)return;o.ttl=a,o.start=h,o.now=r||s();let l=o.now-h;o.remainingTTL=a-l;}};let r=0,s=()=>{let o=Mr.now();if(this.ttlResolution>0){r=o;let n=setTimeout(()=>r=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=this.#i.get(o);if(n===void 0)return 0;let a=t[n],h=e[n];if(!a||!h)return 1/0;let l=(r||s())-h;return a-l},this.#p=o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a};}#A=()=>{};#P=()=>{};#U=()=>{};#p=()=>false;#V(){let t=new Ar(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,r,s,o)=>{if(this.#e(r))return 0;if(!Se(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!Se(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#I=(e,r,s)=>{if(t[e]=r,this.#c){let o=this.#c-t[e];for(;this.#x>o;)this.#G(true);}this.#x+=t[e],s&&(s.entrySize=r,s.totalCalculatedSize=this.#x);};}#E=t=>{};#I=(t,e,r)=>{};#O=(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#o;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#d[e];}*#T({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#a;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#o));)e=this.#l[e];}#z(t){return t!==void 0&&this.#i.get(this.#r[t])===t}*entries(){for(let t of this.#S())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*rentries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*keys(){for(let t of this.#S()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#T()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#S())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let r of this.#S()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#r[r],this))return this.get(this.#r[r],e)}}forEach(t,e=this){for(let r of this.#S()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[r],this);}}rforEach(t,e=this){for(let r of this.#T()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[r],this);}}purgeStale(){let t=false;for(let e of this.#T({allowStale:true}))this.#p(e)&&(this.#w(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let r=this.#t[e],s=this.#e(r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(this.#f&&this.#b){let n=this.#f[e],a=this.#b[e];if(n&&a){let h=n-(Mr.now()-a);o.ttl=h,o.start=Date.now();}}return this.#y&&(o.size=this.#y[e]),o}dump(){let t=[];for(let e of this.#S({allowStale:true})){let r=this.#r[e],s=this.#t[e],o=this.#e(s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(this.#f&&this.#b){n.ttl=this.#f[e];let a=Mr.now()-this.#b[e];n.start=Math.floor(Date.now()-a);}this.#y&&(n.size=this.#y[e]),t.unshift([r,n]);}return t}load(t){this.clear();for(let[e,r]of t){if(r.start){let s=Date.now()-r.start;r.start=Mr.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=r,{noUpdateTTL:l=this.noUpdateTTL}=r,u=this.#O(t,e,r.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#w(t,"set"),this;let c=this.#s===0?void 0:this.#i.get(t);if(c===void 0)c=this.#s===0?this.#o:this.#_.length!==0?this.#_.pop():this.#s===this.#h?this.#G(false):this.#s,this.#r[c]=t,this.#t[c]=e,this.#i.set(t,c),this.#l[this.#o]=c,this.#d[c]=this.#o,this.#o=c,this.#s++,this.#I(c,u,h),h&&(h.set="add"),l=false,this.#k&&this.#M?.(e,t,"add");else {this.#B(c);let f=this.#t[c];if(e!==f){if(this.#C&&this.#e(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!n&&(this.#v&&this.#m?.(d,t,"set"),this.#u&&this.#n?.push([d,t,"set"]));}else n||(this.#v&&this.#m?.(f,t,"set"),this.#u&&this.#n?.push([f,t,"set"]));if(this.#E(c),this.#I(c,u,h),this.#t[c]=e,h){h.set="replace";let d=f&&this.#e(f)?f.__staleWhileFetching:f;d!==void 0&&(h.oldValue=d);}}else h&&(h.set="update");this.#k&&this.onInsert?.(e,t,e===f?"update":"replace");}if(s!==0&&!this.#f&&this.#D(),this.#f&&(l||this.#U(c,s,o),h&&this.#P(h,c)),!n&&this.#u&&this.#n){let f=this.#n,d;for(;d=f?.shift();)this.#g?.(...d);}return this}pop(){try{for(;this.#s;){let t=this.#t[this.#a];if(this.#G(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#u&&this.#n){let t=this.#n,e;for(;e=t?.shift();)this.#g?.(...e);}}}#G(t){let e=this.#a,r=this.#r[e],s=this.#t[e];return this.#C&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#u)&&(this.#v&&this.#m?.(s,r,"evict"),this.#u&&this.#n?.push([s,r,"evict"])),this.#E(e),t&&(this.#r[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#s===1?(this.#a=this.#o=0,this.#_.length=0):this.#a=this.#l[e],this.#i.delete(r),this.#s--,e}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=this.#i.get(t);if(o!==void 0){let n=this.#t[o];if(this.#e(n)&&n.__staleWhileFetching===void 0)return false;if(this.#p(o))s&&(s.has="stale",this.#P(s,o));else return r&&this.#A(o),s&&(s.has="hit",this.#P(s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!r&&this.#p(s))return;let o=this.#t[s];return this.#e(o)?o.__staleWhileFetching:o}#L(t,e,r,s){let o=e===void 0?void 0:this.#t[e];if(this.#e(o))return o;let n=new Eo,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:r,context:s},l=(x,g=false)=>{let{aborted:_}=n.signal,y=r.ignoreFetchAbort&&x!==void 0;if(r.status&&(_&&!g?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,y&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),_&&!y&&!g)return c(n.signal.reason);let v=d;return this.#t[e]===d&&(x===void 0?v.__staleWhileFetching?this.#t[e]=v.__staleWhileFetching:this.#w(t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,x,h.options))),x},u=x=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=x),c(x)),c=x=>{let{aborted:g}=n.signal,_=g&&r.allowStaleOnFetchAbort,y=_||r.allowStaleOnFetchRejection,v=y||r.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#w(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return r.status&&b.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#R?.(t,o,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(x(void 0),r.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(l,u),m=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,m,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=m,m}#e(t){if(!this.#C)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Eo}async fetch(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#C)return _&&(_.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:_});let v={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:_,signal:y},b=this.#i.get(t);if(b===void 0){_&&(_.fetch="miss");let P=this.#L(t,b,v,x);return P.__returned=P}else {let P=this.#t[b];if(this.#e(P)){let C=r&&P.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",C&&(_.returnedStale=true)),C?P.__staleWhileFetching:P.__returned=P}let S=this.#p(b);if(!g&&!S)return _&&(_.fetch="hit"),this.#B(b),s&&this.#A(b),_&&this.#P(_,b),P;let w=this.#L(t,b,v,x),B=w.__staleWhileFetching!==void 0&&r;return _&&(_.fetch=S?"stale":"refresh",B&&S&&(_.returnedStale=true)),B?w.__staleWhileFetching:w.__returned=w}}async forceFetch(t,e={}){let r=await this.fetch(t,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,e={}){let r=this.#F;if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let h=r(t,a,{options:n,context:s});return this.set(t,h,n),h}get(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=this.#i.get(t);if(a!==void 0){let h=this.#t[a],l=this.#e(h);return n&&this.#P(n,a),this.#p(a)?(n&&(n.get="stale"),l?(n&&r&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?h.__staleWhileFetching:void 0):(o||this.#w(t,"expire"),n&&r&&(n.returnedStale=true),r?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#A(a),h))}else n&&(n.get="miss");}#H(t,e){this.#d[e]=t,this.#l[t]=e;}#B(t){t!==this.#o&&(t===this.#a?this.#a=this.#l[t]:this.#H(this.#d[t],this.#l[t]),this.#H(this.#o,t),this.#o=t);}delete(t){return this.#w(t,"delete")}#w(t,e){let r=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(r=true,this.#s===1)this.#W(e);else {this.#E(s);let o=this.#t[s];if(this.#e(o)?o.__abortController.abort(new Error("deleted")):(this.#v||this.#u)&&(this.#v&&this.#m?.(o,t,e),this.#u&&this.#n?.push([o,t,e])),this.#i.delete(t),this.#r[s]=void 0,this.#t[s]=void 0,s===this.#o)this.#o=this.#d[s];else if(s===this.#a)this.#a=this.#l[s];else {let n=this.#d[s];this.#l[n]=this.#l[s];let a=this.#l[s];this.#d[a]=this.#d[s];}this.#s--,this.#_.push(s);}}if(this.#u&&this.#n?.length){let s=this.#n,o;for(;o=s?.shift();)this.#g?.(...o);}return r}clear(){return this.#W("delete")}#W(t){for(let e of this.#T({allowStale:true})){let r=this.#t[e];if(this.#e(r))r.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(r,s,t),this.#u&&this.#n?.push([r,s,t]);}}if(this.#i.clear(),this.#t.fill(void 0),this.#r.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#a=0,this.#o=0,this.#_.length=0,this.#x=0,this.#s=0,this.#u&&this.#n){let e=this.#n,r;for(;r=e?.shift();)this.#g?.(...r);}}};var Er=class{cache;map=new Map;constructor(t){this.cache=new Bo({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}get keys(){return this.map.keys}get values(){return this.map.values}};var Gi=new Er({cacheSize:10}),$m;(s=>{function i(o){let n=Gi.get(o);if(!n){Q.error(`Label "${o}" not found`);return}return n}s.get=i;function t(o){if(Array.isArray(o)){o.forEach(n=>t(n));return}Gi.has(o.id)&&Q.info(`Label "${o.id}" already exists, it will be overwritten`),Gi.set(o.id,o);}s.add=t;function e(){return Array.from(Gi.values())}s.values=e;function r(o){return Gi.has(o)}s.has=r;})($m||={});var wh=$m;var Ph=class i{constructor(){}static stepsRunning=0;static goNextRequests=0;static choiceMadeTemp=void 0;static lastHistoryStep=null;static get allOpenedLabels(){return Ft.getVariable(re.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(t){Ft.setVariable(re.OPENED_LABELS_COUNTER_KEY,t);}static getCurrentStepTimesCounterData(t=""){let e=i.currentLabelStepIndex;if(e===null)return Q.error("currentLabelStepIndex is null"),null;let r=`${e}${t}`,s=i.currentLabelId,o=i._currentLabel;if(!s||e===null||!o)return Q.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let n=o.getStepSha(e)||"error",a=Ft.getVariable(re.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return a[s]||(a[s]={}),(!a[s][r]||a[s][r].stepSha1!=n)&&(a[s][r]={stepSha1:n}),a[s][r]}static setCurrentStepTimesCounterData(t="",e){let r=i.currentLabelStepIndex,s=r+t,o=i.currentLabelId;if(!o||r===null){Q.error("currentLabelId or currentLabelStepIndex is null");return}let n=Ft.getVariable(re.CURRENT_STEP_TIMES_COUNTER_KEY)||{};n[o]||(n[o]={}),n[o][s]=e,Ft.setVariable(re.CURRENT_STEP_TIMES_COUNTER_KEY,n);}static getCurrentStepTimesCounter(t=""){let e=i._stepCounter,r=i.getCurrentStepTimesCounterData(t);if(!r)return Q.error("getCurrentStepTimesCounter obj is null"),0;let s=r.stepCounters||r.lastStepIndexs||[];return s.find(n=>n===e)||(s.push(e),delete r.lastStepIndexs,r.stepCounters=s,i.setCurrentStepTimesCounterData(t,r)),s.length}static getRandomNumber(t,e,r={}){let s=r.nestedId||"";if(r.onceOnly||false){let n=i.getCurrentStepTimesCounterData(s);if(!n)return;let a=n.usedRandomNumbers||{},h=Array.from({length:e-t+1},(c,f)=>f+t).filter(c=>!a[`${t}-${e}`]?.includes(c));if(h.length===0)return;let l=Math.floor(Math.random()*h.length),u=h[l];return a[`${t}-${e}`]||(a[`${t}-${e}`]=[]),a[`${t}-${e}`].push(u),n.usedRandomNumbers=a,i.setCurrentStepTimesCounterData(s,n),u}return Math.floor(Math.random()*(e-t+1))+t}static resetCurrentStepTimesCounter(t=""){let e=i.currentLabelStepIndex,r=e+t,s=i.currentLabelId;if(!s||e===null){Q.error("currentLabelId or currentLabelStepIndex is null");return}let o=Ft.getVariable(re.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[s]||(o[s]={}),o[s][r]={stepCounters:[],stepSha1:""},Ft.setVariable(re.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static get allChoicesMade(){return Ft.getVariable(re.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(t){Ft.setVariable(re.ALL_CHOICES_MADE_KEY,t);}static _stepCounter=0;static increaseStepCounter(){i._stepCounter++;}static _openedLabels=[];static get openedLabels(){return Cr(i._openedLabels)}static set openedLabels(t){i._openedLabels=Cr(t);}static _originalOpenedLabels=[];static get originalOpenedLabels(){return Cr(i._originalOpenedLabels)}static set originalOpenedLabels(t){i._originalOpenedLabels=Cr(t);}static get _currentLabel(){if(i.currentLabelId)return wh.get(i.currentLabelId)}static get currentLabelId(){if(i._openedLabels.length>0)return i._openedLabels[i._openedLabels.length-1].label}static get currentLabelStepIndex(){return i._openedLabels.length>0?i._openedLabels[i._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(t,e){let r=i.allOpenedLabels,s=i.allOpenedLabels[t]?.biggestStep||0,o=i.allOpenedLabels[t]?.openCount||0;(!s||s<e)&&(r[t]={biggestStep:e,openCount:o},i.allOpenedLabels=r);}static addChoicesMade(t,e,r,s){let o=i.allChoicesMade,n=o.findIndex(a=>a.labelId===t&&a.stepIndex===e&&a.choiceIndex===s&&a.stepSha1===r);n<0?o.push({labelId:t,stepIndex:e,choiceIndex:s,stepSha1:r,madeTimes:1}):o[n].madeTimes++,i.allChoicesMade=o;}static pushNewLabel(t){if(!wh.get(t))throw new Error(`[Pixi\u2019VN] Label ${t} not found`);i._openedLabels.push({label:t,currentStepIndex:0});let r=i.allOpenedLabels,s=i.allOpenedLabels[t]?.biggestStep||0,o=i.allOpenedLabels[t]?.openCount||0;r[t]={biggestStep:s,openCount:o+1},i.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(i._openedLabels.length>0){let t=i._openedLabels[i._openedLabels.length-1];i._openedLabels[i._openedLabels.length-1]={...t,currentStepIndex:t.currentStepIndex+1};}}static _onStepStart;static set onStepStart(t){i._onStepStart=t;}static get onStepStart(){return async(t,e)=>{let r=[];return i.onLoadingLabel&&t===0&&r.push(i.onLoadingLabel(t,e)),i._onStepStart&&r.push(i._onStepStart(t,e)),await Promise.all(r)}}static onLoadingLabel;static onStepEnd};export{Ph as default};
569
+ `}};});var mh,gh,To,dm=p(()=>{J();Is();hm();Os();hi();xe();pt();cm();To=class extends Jt{constructor(){mh??(mh=nr({name:"tiling-sprite-shader",bits:[Ci,lm,hr]})),gh??(gh=ar({name:"tiling-sprite-shader",bits:[am,um,lr]}));let t=new Tt({uMapCoord:{value:new M,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new M,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:gh,gpuProgram:mh,resources:{localUniforms:new Tt({uTransformMatrix:{value:new M,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:k.EMPTY.source,uSampler:k.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var wo,fm=p(()=>{So();wo=class extends Tr{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function pm(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height;}var mm=p(()=>{});function gm(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,h=r.c,l=r.d,u=r.tx,c=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+h*d+u,i[e+1]=a*f+l*d+c,e+=t,s++;}}var xm=p(()=>{});function _m(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=M.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),gm(t,2,0,a);}var ym=p(()=>{J();xm();});var Po,Mi,bm=p(()=>{F();si();Ks();ai();di();qs();So();dm();fm();mm();ym();Po=new wo,Mi=class{constructor(t){this._state=Ue.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash");}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ye);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e);}else r.break(e),s.shader||(s.shader=new To),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,_e(t.groupColorAlpha,r.uColor,0),this._state.blendMode=ae(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Po,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Tr({indices:Po.indices,positions:Po.positions.slice(),uvs:Po.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:true,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),_m(t,r.uvs),pm(t,r.positions);}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===Qt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Mi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"};});var xh=p(()=>{F();bm();I.add(Mi);});var vm,Tm,wm=p(()=>{lt();So();vm=class Sm extends Tr{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(G(z,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e);}build(t){t={...Sm.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;r.push(f*h,d*l),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,m=d*this.verticesX+f,x=d*this.verticesX+f+1,g=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(m,x,g,x,_,g);}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};vm.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Tm=vm;});var Pm,Mm,Am=p(()=>{wm();Pm=class Cm extends Tm{constructor(t={}){t={...Cm.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=r>f?1:r/f,m=Math.min(c,d),x=h*e,g=l*r;t[0]=t[8]=t[16]=t[24]=-x,t[2]=t[10]=t[18]=t[26]=s*m-x,t[4]=t[12]=t[20]=t[28]=e-o*m-x,t[6]=t[14]=t[22]=t[30]=e-x,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*m-g,t[17]=t[19]=t[21]=t[23]=r-a*m-g,t[25]=t[27]=t[29]=t[31]=r-g,this.getBuffer("aPosition").update();}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update();}};Pm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Mm=Pm;});var Ai,Em=p(()=>{F();Gt();qs();Am();Ai=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash");}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];H.return(e.geometry),H.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=H.get(ye);return e.geometry=H.get(Mm),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null;}};Ai.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"};});var _h=p(()=>{F();Em();I.add(Ai);});var Ei,Bm=p(()=>{F();Ei=class{constructor(t){this._renderer=t;}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Ei.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"};});function Rm(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var Fm=p(()=>{});var u_,Bi,km=p(()=>{F();J();Ot();ii();ni();xe();pt();Xe();ai();zt();Fm();xt();u_=new Zt({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Bi=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Tt({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Lt({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=true;return}let o=s.bounds;if(t.renderables?Rm(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,u=false,c=false,f=true;for(let d=0;d<r.length;d++){let m=r[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),h+=m.padding,m.antialias==="off"?l=false:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=false),!!!(m.compatibleRenderers&e.type)){c=false;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){U("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),c=false;break}c=m.enabled||c,u||(u=m.blendRequired);}if(!c){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m);}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=true;return}s.skip=false,s.bounds=o,s.blendRequired=u,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=_t.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:o});}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=k.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a);}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,false),_t.returnTexture(r);else {let a=e.inputTexture,h=_t.getOptimalTexture(s.width,s.height,a.source._resolution,false),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,true);let c=a;a=h,h=c;}n[l].apply(this,a,e.previousRenderSurface,false),_t.returnTexture(a),_t.returnTexture(h);}e.blendRequired&&_t.returnTexture(o);}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=_t.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=V.shared,u=n.previousRenderSurface===r,c=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(c=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,x=m.uOutputFrame,g=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,v=m.uGlobalFrame,b=m.uOutputTexture;if(u){let w=this._filterStackIndex;for(;w>0;){w--;let E=this._filterStack[this._filterStackIndex-1];if(!E.skip){h.x=E.bounds.minX,h.y=E.bounds.minY;break}}x[0]=a.minX-h.x,x[1]=a.minY-h.y;}else x[0]=0,x[1]=0;x[2]=e.frame.width,x[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*g[2]-.5*_[2],y[3]=e.frame.height*g[3]-.5*_[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=h.x*c,v[1]=h.y*c,v[2]=P.source.width*c,v[3]=P.source.height*c;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof k?(b[0]=r.frame.width,b[1]=r.frame.height):(b[0]=S.width,b[1]=S.height),b[2]=S.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(w,0);}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:u_,shader:t,state:t._state,topology:"triangle-list"}),o.type===Qt.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new rt,container:null,filterEffect:null,blendRequired:false,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(M.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Bi.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"filter"};});var yh=p(()=>{F();Bm();km();I.add(Bi);I.add(Ei);});var c_={};var Im=p(()=>{pu();xn();Su();wu();ms();vs();Aa();Ea();ka();sh();ch();ph();xh();_h();yh();});var d_={};var Lm=p(()=>{xn();ms();vs();Aa();Ea();ka();sh();ch();ph();xh();_h();yh();});var $t={};eg($t,{DistortionFilter:()=>zi,EqualizerFilter:()=>kt,Filter:()=>ht,MonoFilter:()=>Hi,ReverbFilter:()=>Wi,StereoFilter:()=>Vi,StreamFilter:()=>Ni,TelephoneFilter:()=>Yi});var Bh;function Rh(i){return Bh=i,i}function $(){return Bh}var ht=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var zi=class extends ht{constructor(t=0){let e;if(!$().useLegacy){let{audioContext:r}=$().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,$().useLegacy)return;let e=t*1e3,r=44100,s=new Float32Array(r),o=Math.PI/180,n=0,a;for(;n<r;++n)a=n*2/r-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var ot=class{static setParamValue(t,e){if(t.setValueAtTime){let r=$().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var X=class extends ht{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,h=0,l=0){let u=[],c=[{f:X.F32,type:"lowshelf",gain:i},{f:X.F64,type:"peaking",gain:t},{f:X.F125,type:"peaking",gain:e},{f:X.F250,type:"peaking",gain:r},{f:X.F500,type:"peaking",gain:s},{f:X.F1K,type:"peaking",gain:o},{f:X.F2K,type:"peaking",gain:n},{f:X.F4K,type:"peaking",gain:a},{f:X.F8K,type:"peaking",gain:h},{f:X.F16K,type:"highshelf",gain:l}];$().useLegacy||(u=c.map(f=>{let d=$().context.audioContext.createBiquadFilter();return d.type=f.type,ot.setParamValue(d.Q,1),d.frequency.value=f.f,ot.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(i,t=0){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);ot.setParamValue(this.bandsMap[i].gain,t);}getGain(i){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);return this.bandsMap[i].gain.value}set f32(i){this.setGain(X.F32,i);}get f32(){return this.getGain(X.F32)}set f64(i){this.setGain(X.F64,i);}get f64(){return this.getGain(X.F64)}set f125(i){this.setGain(X.F125,i);}get f125(){return this.getGain(X.F125)}set f250(i){this.setGain(X.F250,i);}get f250(){return this.getGain(X.F250)}set f500(i){this.setGain(X.F500,i);}get f500(){return this.getGain(X.F500)}set f1k(i){this.setGain(X.F1K,i);}get f1k(){return this.getGain(X.F1K)}set f2k(i){this.setGain(X.F2K,i);}get f2k(){return this.getGain(X.F2K)}set f4k(i){this.setGain(X.F4K,i);}get f4k(){return this.getGain(X.F4K)}set f8k(i){this.setGain(X.F8K,i);}get f8k(){return this.getGain(X.F8K)}set f16k(i){this.setGain(X.F16K,i);}get f16k(){return this.getGain(X.F16K)}reset(){this.bands.forEach(i=>{ot.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},kt=X;kt.F32=32;kt.F64=64;kt.F125=125;kt.F250=250;kt.F500=500;kt.F1K=1e3;kt.F2K=2e3;kt.F4K=4e3;kt.F8K=8e3;kt.F16K=16e3;var Hi=class extends ht{constructor(){let t,e;if(!$().useLegacy){let{audioContext:r}=$().context;e=r.createChannelSplitter(),t=r.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var Wi=class extends ht{constructor(t=3,e=2,r=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=r,this._rebuild();}_clamp(t,e,r){return Math.min(r,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if($().useLegacy)return;let{audioContext:t}=$().context,e=t.sampleRate,r=e*this._seconds,s=t.createBuffer(2,r,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<r;l++)a=this._reverse?r-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var Vi=class extends ht{constructor(t=0){let e,r,s;if(!$().useLegacy){let{audioContext:o}=$().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(r=o.createPanner(),r.panningModel="equalpower",s=r);}super(s),this._stereo=e,this._panner=r,this.pan=t;}set pan(t){this._pan=t,this._stereo?ot.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Ni=class extends ht{constructor(){let t,e;if(!$().useLegacy){let{audioContext:r}=$().context;t=r.createMediaStreamDestination(),e=r.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Yi=class extends ht{constructor(){let t,e;if(!$().useLegacy){let{audioContext:r}=$().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",ot.setParamValue(s.frequency,2e3),o.type="lowpass",ot.setParamValue(o.frequency,2e3),n.type="highpass",ot.setParamValue(n.frequency,500),a.type="highpass",ot.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};F();var Gm={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Im(),c_));}};F();var Dm={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Lm(),d_));}};F();F();vs();ms();Cn();Wt();Dn();Yr();Mt();ps();Oi(fa());I.add(Gm,Dm);var Ri=class extends Y{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var p_=0,bh=class extends Y{constructor(i){super(),this.id=p_++,this.init(i);}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(i){this._playing=false,this._duration=i.source.duration;let t=this._source=i.source.cloneNode(false);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters");}refresh(){let i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=i.volume*(i.muted?0:1),r=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*r,this._source.playbackRate=this._speed*i.speed*t.speed;}refreshPaused(){let i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(i){let{start:t,end:e,speed:r,loop:s,volume:o,muted:n}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=r,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-bh.PADDING),this._end=Math.min(this._end+bh.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),ut.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){ut.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){ut.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Co=bh;Co.PADDING=.1;var Fi=class extends Y{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Co(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,r=this.parent;if(e.readyState===4){r.isLoaded=true;let h=r.autoPlayStart();t&&setTimeout(()=>{t(null,r,h);},0);return}if(!r.url){t(new Error("sound.url or sound.source must be set"));return}e.src=r.url;let s=()=>{a(),r.isLoaded=true;let h=r.autoPlayStart();t&&t(null,r,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var ki=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var He=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],vh=["audio/mpeg","audio/ogg"],We={};function Um(i){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),r={},s=/^no$/;He.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";r[o]=!!n||!!a;}),Object.assign(We,r);}Um();var g_=0,Ii=class extends Y{constructor(t){super(),this.id=g_++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let r=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);ot.setParamValue(this._gain.gain,o*s*r),ot.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,r=this._paused||e.paused||t.paused;r!==this._pausedReal&&(this._pausedReal=r,r?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",r));}play(t){let{start:e,end:r,speed:s,loop:o,volume:n,muted:a,filters:h}=t;r&&console.assert(r>e,"End time is before start time"),this._paused=false;let{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=r,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=r,this._source.loopStart=e,this._source.start(0,e)):r?this._source.start(0,e,r-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){ut.shared.remove(this._updateListener,this),t&&ut.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Ve=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(r=>{e===null?this._input.connect(r.destination):e.connect(r.destination),e=r;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Om=class extends Ve{constructor(i){let t=i.audioContext,e=t.createBufferSource(),r=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(r),r.connect(i.destination),super(s,r),this.context=i,this.bufferSource=e,this.gain=r,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Om.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,ot.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Mo=Om;Mo.BUFFER_SIZE=0;var Ne=class{init(t){this.parent=t,this._nodes=new Mo(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Ii(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,r=await it.get().fetch(e);this._decode(await r.arrayBuffer(),t);}_decode(t,e){let r=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?r(null,t):this.parent.context.decode(t,r);}};var wr=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=$().useLegacy?new Fi:new Ne;return new wr(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(i){let[t]=i.map(e=>({url:e,ext:Pt.extname(e).slice(1)})).filter(({ext:e})=>We[e]).sort((e,r)=>He.indexOf(e.ext)-He.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return $().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get filters(){return this.media.filters}set filters(i){this.media.filters=i;}addSprites(i,t){if(typeof i=="object"){let r={};for(let s in i)r[s]=this.addSprites(s,i[s]);return r}console.assert(!this._sprites[i],`Alias ${i} is already taken`);let e=new ki(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(i){if(i){let t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let r=this._createInstance();return this._instances.push(r),this.isPlaying=true,r.once("end",()=>{e.complete&&e.complete(this),this._onComplete(r);}),r.once("stop",()=>{this._onComplete(r);}),r.play(e),r}refresh(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh();}refreshPaused(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}_preload(i){this.media.load(i);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0;}_onComplete(i){if(this._instances){let t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(i);}_createInstance(){if(wr._pool.length>0){let i=wr._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),wr._pool.indexOf(i)<0&&wr._pool.push(i);}},ve=wr;ve._pool=[];var Pr=class i extends Ve{constructor(){let t=window,e=new i.AudioContext,r=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(r),r.connect(e.destination),super(s,r),this.autoPause=true,this._ctx=e,this._offlineCtx=new i.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=r,this.analyser=s,this.events=new Y,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let r=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},r);s&&s.catch(r);}};var Ao=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Pr),this._htmlAudioContext=new Ri,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return Pr.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof ve)return this._sounds[t]=e,e;let r=this._getOptions(e),s=ve.from(r);return this._sounds[t]=s,s}_getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let r=!!this._sounds[t];return e&&console.assert(r,`No sound matching alias '${t}'.`),r}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let r=this.find(t);return e!==void 0&&(r.volume=e),r.volume}speed(t,e){let r=this.find(t);return e!==void 0&&(r.speed=e),r.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var zm=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=Pt.basename(t,Pt.extname(t))),e},Hm={extension:T.Asset,detection:{test:async()=>true,add:async i=>[...i,...He.filter(t=>We[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:Ze.High},test(i){let t=Pt.extname(i).slice(1);return !!We[t]||vh.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>ve.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return $().add(zm(t),e),e},async unload(i,t){$().remove(zm(t));}}};I.add(Hm);Rh(new Ao);({DistortionFilter:$t.DistortionFilter,EqualizerFilter:$t.EqualizerFilter,MonoFilter:$t.MonoFilter,ReverbFilter:$t.ReverbFilter,StereoFilter:$t.StereoFilter,StreamFilter:$t.StreamFilter,TelephoneFilter:$t.TelephoneFilter});var re={OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___"};var Q;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(Q||={});var Ft=class i{static init(t){i._getStepCounter=t.getStepCounter,i._setStepCounter=t.setStepCounter,i._getCurrentGameStepState=t.getCurrentGameStepState,i._restoreGameStepState=t.restoreGameStepState,i._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(i._onGoNextEnd=t.onGoNextEnd),i._getVariable=t.getVariable,i._setVariable=t.setVariable,i._removeVariable=t.removeVariable,i._getFlag=t.getFlag,i._setFlag=t.setFlag,t.onLabelClosing&&(i._onLabelClosing=t.onLabelClosing),i._addHistoryItem=t.addHistoryItem,i._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,i._getCharacter=t.getCharacter;}static _getStepCounter=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return i._getStepCounter()}static set stepCounter(t){i._setStepCounter(t);}static _getCurrentGameStepState=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return i._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return i._restoreGameStepState}static _getOpenedLabels=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return i._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return i._onGoNextEnd}static _getVariable=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return i._getVariable}static _setVariable=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return i._setVariable}static _removeVariable=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return i._removeVariable}static _getFlag=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return i._getFlag}static _setFlag=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return i._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return i._onLabelClosing}static _addHistoryItem=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return i._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentStepsRunningNumber(){return i._getCurrentStepsRunningNumber()}static _getCharacter=()=>{throw Q.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getCharacter(){return i._getCharacter}static onEnd;static onError};function Cr(i){try{if(typeof i>"u")return i;let t=JSON.stringify(i);return JSON.parse(t)}catch(t){throw Q.error("Error creating exportable element",i,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var Mr=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Vm=new Set,Sh=typeof process=="object"&&process?process:{},Nm=(i,t,e,r)=>{typeof Sh.emitWarning=="function"?Sh.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},Eo=globalThis.AbortController,Wm=globalThis.AbortSignal;if(typeof Eo>"u"){Wm=class{onabort;_onabort=[];reason;aborted=false;addEventListener(r,s){this._onabort.push(s);}},Eo=class{constructor(){t();}signal=new Wm;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let i=Sh.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,Nm("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var y_=i=>!Vm.has(i),Se=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Ym=i=>Se(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?Ar:null:null,Ar=class extends Array{constructor(t){super(t),this.fill(0);}},Th=class i{heap;length;static#h=false;static create(t){let e=Ym(t);if(!e)return [];i.#h=true;let r=new i(t,e);return i.#h=false,r}constructor(t,e){if(!i.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Bo=class i{#h;#c;#m;#M;#g;#R;#F;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#x;#i;#r;#t;#l;#d;#a;#o;#_;#n;#y;#b;#f;#v;#C;#u;#k;static unsafeExposeInternals(t){return {starts:t.#b,ttls:t.#f,sizes:t.#y,keyMap:t.#i,keyList:t.#r,valList:t.#t,next:t.#l,prev:t.#d,get head(){return t.#a},get tail(){return t.#o},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,r,s,o)=>t.#L(e,r,s,o),moveToTail:e=>t.#B(e),indexes:e=>t.#S(e),rindexes:e=>t.#T(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#c}get calculatedSize(){return this.#x}get size(){return this.#s}get fetchMethod(){return this.#R}get memoMethod(){return this.#F}get dispose(){return this.#m}get onInsert(){return this.#M}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:u,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:d,maxSize:m=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:S,ignoreFetchAbort:w}=t;if(e!==0&&!Se(e))throw new TypeError("max option must be a nonnegative integer");let E=e?Ym(e):Array;if(!E)throw new Error("invalid max value: "+e);if(this.#h=e,this.#c=m,this.maxEntrySize=x||this.#c,this.sizeCalculation=g,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#F=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#R=_,this.#C=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new E(e),this.#d=new E(e),this.#a=0,this.#o=0,this.#_=Th.create(e),this.#s=0,this.#x=0,typeof l=="function"&&(this.#m=l),typeof u=="function"&&(this.#M=u),typeof c=="function"?(this.#g=c,this.#n=[]):(this.#g=void 0,this.#n=void 0),this.#v=!!this.#m,this.#k=!!this.#M,this.#u=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!w,this.maxEntrySize!==0){if(this.#c!==0&&!Se(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!Se(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V();}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=Se(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!Se(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#D();}if(this.#h===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#c){let B="LRU_CACHE_UNBOUNDED";y_(B)&&(Vm.add(B),Nm("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,i));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#D(){let t=new Ar(this.#h),e=new Ar(this.#h);this.#f=t,this.#b=e,this.#U=(o,n,a=Mr.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(o)&&this.#w(this.#r[o],"expire");},n+1);h.unref&&h.unref();}},this.#A=o=>{e[o]=t[o]!==0?Mr.now():0;},this.#P=(o,n)=>{if(t[n]){let a=t[n],h=e[n];if(!a||!h)return;o.ttl=a,o.start=h,o.now=r||s();let l=o.now-h;o.remainingTTL=a-l;}};let r=0,s=()=>{let o=Mr.now();if(this.ttlResolution>0){r=o;let n=setTimeout(()=>r=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=this.#i.get(o);if(n===void 0)return 0;let a=t[n],h=e[n];if(!a||!h)return 1/0;let l=(r||s())-h;return a-l},this.#p=o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a};}#A=()=>{};#P=()=>{};#U=()=>{};#p=()=>false;#V(){let t=new Ar(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,r,s,o)=>{if(this.#e(r))return 0;if(!Se(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!Se(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#I=(e,r,s)=>{if(t[e]=r,this.#c){let o=this.#c-t[e];for(;this.#x>o;)this.#G(true);}this.#x+=t[e],s&&(s.entrySize=r,s.totalCalculatedSize=this.#x);};}#E=t=>{};#I=(t,e,r)=>{};#O=(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#o;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#d[e];}*#T({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#a;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#o));)e=this.#l[e];}#z(t){return t!==void 0&&this.#i.get(this.#r[t])===t}*entries(){for(let t of this.#S())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*rentries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*keys(){for(let t of this.#S()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#T()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#S())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let r of this.#S()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#r[r],this))return this.get(this.#r[r],e)}}forEach(t,e=this){for(let r of this.#S()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[r],this);}}rforEach(t,e=this){for(let r of this.#T()){let s=this.#t[r],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[r],this);}}purgeStale(){let t=false;for(let e of this.#T({allowStale:true}))this.#p(e)&&(this.#w(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let r=this.#t[e],s=this.#e(r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(this.#f&&this.#b){let n=this.#f[e],a=this.#b[e];if(n&&a){let h=n-(Mr.now()-a);o.ttl=h,o.start=Date.now();}}return this.#y&&(o.size=this.#y[e]),o}dump(){let t=[];for(let e of this.#S({allowStale:true})){let r=this.#r[e],s=this.#t[e],o=this.#e(s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(this.#f&&this.#b){n.ttl=this.#f[e];let a=Mr.now()-this.#b[e];n.start=Math.floor(Date.now()-a);}this.#y&&(n.size=this.#y[e]),t.unshift([r,n]);}return t}load(t){this.clear();for(let[e,r]of t){if(r.start){let s=Date.now()-r.start;r.start=Mr.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=r,{noUpdateTTL:l=this.noUpdateTTL}=r,u=this.#O(t,e,r.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#w(t,"set"),this;let c=this.#s===0?void 0:this.#i.get(t);if(c===void 0)c=this.#s===0?this.#o:this.#_.length!==0?this.#_.pop():this.#s===this.#h?this.#G(false):this.#s,this.#r[c]=t,this.#t[c]=e,this.#i.set(t,c),this.#l[this.#o]=c,this.#d[c]=this.#o,this.#o=c,this.#s++,this.#I(c,u,h),h&&(h.set="add"),l=false,this.#k&&this.#M?.(e,t,"add");else {this.#B(c);let f=this.#t[c];if(e!==f){if(this.#C&&this.#e(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!n&&(this.#v&&this.#m?.(d,t,"set"),this.#u&&this.#n?.push([d,t,"set"]));}else n||(this.#v&&this.#m?.(f,t,"set"),this.#u&&this.#n?.push([f,t,"set"]));if(this.#E(c),this.#I(c,u,h),this.#t[c]=e,h){h.set="replace";let d=f&&this.#e(f)?f.__staleWhileFetching:f;d!==void 0&&(h.oldValue=d);}}else h&&(h.set="update");this.#k&&this.onInsert?.(e,t,e===f?"update":"replace");}if(s!==0&&!this.#f&&this.#D(),this.#f&&(l||this.#U(c,s,o),h&&this.#P(h,c)),!n&&this.#u&&this.#n){let f=this.#n,d;for(;d=f?.shift();)this.#g?.(...d);}return this}pop(){try{for(;this.#s;){let t=this.#t[this.#a];if(this.#G(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#u&&this.#n){let t=this.#n,e;for(;e=t?.shift();)this.#g?.(...e);}}}#G(t){let e=this.#a,r=this.#r[e],s=this.#t[e];return this.#C&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#u)&&(this.#v&&this.#m?.(s,r,"evict"),this.#u&&this.#n?.push([s,r,"evict"])),this.#E(e),t&&(this.#r[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#s===1?(this.#a=this.#o=0,this.#_.length=0):this.#a=this.#l[e],this.#i.delete(r),this.#s--,e}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=this.#i.get(t);if(o!==void 0){let n=this.#t[o];if(this.#e(n)&&n.__staleWhileFetching===void 0)return false;if(this.#p(o))s&&(s.has="stale",this.#P(s,o));else return r&&this.#A(o),s&&(s.has="hit",this.#P(s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!r&&this.#p(s))return;let o=this.#t[s];return this.#e(o)?o.__staleWhileFetching:o}#L(t,e,r,s){let o=e===void 0?void 0:this.#t[e];if(this.#e(o))return o;let n=new Eo,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:r,context:s},l=(x,g=false)=>{let{aborted:_}=n.signal,y=r.ignoreFetchAbort&&x!==void 0;if(r.status&&(_&&!g?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,y&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),_&&!y&&!g)return c(n.signal.reason);let v=d;return this.#t[e]===d&&(x===void 0?v.__staleWhileFetching?this.#t[e]=v.__staleWhileFetching:this.#w(t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,x,h.options))),x},u=x=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=x),c(x)),c=x=>{let{aborted:g}=n.signal,_=g&&r.allowStaleOnFetchAbort,y=_||r.allowStaleOnFetchRejection,v=y||r.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#w(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return r.status&&b.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#R?.(t,o,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(x(void 0),r.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(l,u),m=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,m,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=m,m}#e(t){if(!this.#C)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Eo}async fetch(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#C)return _&&(_.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:_});let v={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:_,signal:y},b=this.#i.get(t);if(b===void 0){_&&(_.fetch="miss");let P=this.#L(t,b,v,x);return P.__returned=P}else {let P=this.#t[b];if(this.#e(P)){let C=r&&P.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",C&&(_.returnedStale=true)),C?P.__staleWhileFetching:P.__returned=P}let S=this.#p(b);if(!g&&!S)return _&&(_.fetch="hit"),this.#B(b),s&&this.#A(b),_&&this.#P(_,b),P;let w=this.#L(t,b,v,x),B=w.__staleWhileFetching!==void 0&&r;return _&&(_.fetch=S?"stale":"refresh",B&&S&&(_.returnedStale=true)),B?w.__staleWhileFetching:w.__returned=w}}async forceFetch(t,e={}){let r=await this.fetch(t,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,e={}){let r=this.#F;if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let h=r(t,a,{options:n,context:s});return this.set(t,h,n),h}get(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=this.#i.get(t);if(a!==void 0){let h=this.#t[a],l=this.#e(h);return n&&this.#P(n,a),this.#p(a)?(n&&(n.get="stale"),l?(n&&r&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?h.__staleWhileFetching:void 0):(o||this.#w(t,"expire"),n&&r&&(n.returnedStale=true),r?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#A(a),h))}else n&&(n.get="miss");}#H(t,e){this.#d[e]=t,this.#l[t]=e;}#B(t){t!==this.#o&&(t===this.#a?this.#a=this.#l[t]:this.#H(this.#d[t],this.#l[t]),this.#H(this.#o,t),this.#o=t);}delete(t){return this.#w(t,"delete")}#w(t,e){let r=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(r=true,this.#s===1)this.#W(e);else {this.#E(s);let o=this.#t[s];if(this.#e(o)?o.__abortController.abort(new Error("deleted")):(this.#v||this.#u)&&(this.#v&&this.#m?.(o,t,e),this.#u&&this.#n?.push([o,t,e])),this.#i.delete(t),this.#r[s]=void 0,this.#t[s]=void 0,s===this.#o)this.#o=this.#d[s];else if(s===this.#a)this.#a=this.#l[s];else {let n=this.#d[s];this.#l[n]=this.#l[s];let a=this.#l[s];this.#d[a]=this.#d[s];}this.#s--,this.#_.push(s);}}if(this.#u&&this.#n?.length){let s=this.#n,o;for(;o=s?.shift();)this.#g?.(...o);}return r}clear(){return this.#W("delete")}#W(t){for(let e of this.#T({allowStale:true})){let r=this.#t[e];if(this.#e(r))r.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(r,s,t),this.#u&&this.#n?.push([r,s,t]);}}if(this.#i.clear(),this.#t.fill(void 0),this.#r.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#a=0,this.#o=0,this.#_.length=0,this.#x=0,this.#s=0,this.#u&&this.#n){let e=this.#n,r;for(;r=e?.shift();)this.#g?.(...r);}}};var Er=class{cache;map=new Map;constructor(t){this.cache=new Bo({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var Gi=new Er({cacheSize:10}),$m;(s=>{function i(o){let n=Gi.get(o);if(!n){Q.error(`Label "${o}" not found`);return}return n}s.get=i;function t(o){if(Array.isArray(o)){o.forEach(n=>t(n));return}Gi.has(o.id)&&Q.info(`Label "${o.id}" already exists, it will be overwritten`),Gi.set(o.id,o);}s.add=t;function e(){return Array.from(Gi.values())}s.values=e;function r(o){return Gi.has(o)}s.has=r;})($m||={});var wh=$m;var Ph=class i{constructor(){}static stepsRunning=0;static goNextRequests=0;static choiceMadeTemp=void 0;static lastHistoryStep=null;static get allOpenedLabels(){return Ft.getVariable(re.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(t){Ft.setVariable(re.OPENED_LABELS_COUNTER_KEY,t);}static getCurrentStepTimesCounterData(t=""){let e=i.currentLabelStepIndex;if(e===null)return Q.error("currentLabelStepIndex is null"),null;let r=`${e}${t}`,s=i.currentLabelId,o=i._currentLabel;if(!s||e===null||!o)return Q.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let n=o.getStepSha(e)||"error",a=Ft.getVariable(re.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return a[s]||(a[s]={}),(!a[s][r]||a[s][r].stepSha1!=n)&&(a[s][r]={stepSha1:n}),a[s][r]}static setCurrentStepTimesCounterData(t="",e){let r=i.currentLabelStepIndex,s=r+t,o=i.currentLabelId;if(!o||r===null){Q.error("currentLabelId or currentLabelStepIndex is null");return}let n=Ft.getVariable(re.CURRENT_STEP_TIMES_COUNTER_KEY)||{};n[o]||(n[o]={}),n[o][s]=e,Ft.setVariable(re.CURRENT_STEP_TIMES_COUNTER_KEY,n);}static getCurrentStepTimesCounter(t=""){let e=i._stepCounter,r=i.getCurrentStepTimesCounterData(t);if(!r)return Q.error("getCurrentStepTimesCounter obj is null"),0;let s=r.stepCounters||r.lastStepIndexs||[];return s.find(n=>n===e)||(s.push(e),delete r.lastStepIndexs,r.stepCounters=s,i.setCurrentStepTimesCounterData(t,r)),s.length}static getRandomNumber(t,e,r={}){let s=r.nestedId||"";if(r.onceOnly||false){let n=i.getCurrentStepTimesCounterData(s);if(!n)return;let a=n.usedRandomNumbers||{},h=Array.from({length:e-t+1},(c,f)=>f+t).filter(c=>!a[`${t}-${e}`]?.includes(c));if(h.length===0)return;let l=Math.floor(Math.random()*h.length),u=h[l];return a[`${t}-${e}`]||(a[`${t}-${e}`]=[]),a[`${t}-${e}`].push(u),n.usedRandomNumbers=a,i.setCurrentStepTimesCounterData(s,n),u}return Math.floor(Math.random()*(e-t+1))+t}static resetCurrentStepTimesCounter(t=""){let e=i.currentLabelStepIndex,r=e+t,s=i.currentLabelId;if(!s||e===null){Q.error("currentLabelId or currentLabelStepIndex is null");return}let o=Ft.getVariable(re.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[s]||(o[s]={}),o[s][r]={stepCounters:[],stepSha1:""},Ft.setVariable(re.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static get allChoicesMade(){return Ft.getVariable(re.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(t){Ft.setVariable(re.ALL_CHOICES_MADE_KEY,t);}static _stepCounter=0;static increaseStepCounter(){i._stepCounter++;}static _openedLabels=[];static get openedLabels(){return Cr(i._openedLabels)}static set openedLabels(t){i._openedLabels=Cr(t);}static _originalOpenedLabels=[];static get originalOpenedLabels(){return Cr(i._originalOpenedLabels)}static set originalOpenedLabels(t){i._originalOpenedLabels=Cr(t);}static get _currentLabel(){if(i.currentLabelId)return wh.get(i.currentLabelId)}static get currentLabelId(){if(i._openedLabels.length>0)return i._openedLabels[i._openedLabels.length-1].label}static get currentLabelStepIndex(){return i._openedLabels.length>0?i._openedLabels[i._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(t,e){let r=i.allOpenedLabels,s=i.allOpenedLabels[t]?.biggestStep||0,o=i.allOpenedLabels[t]?.openCount||0;(!s||s<e)&&(r[t]={biggestStep:e,openCount:o},i.allOpenedLabels=r);}static addChoicesMade(t,e,r,s){let o=i.allChoicesMade,n=o.findIndex(a=>a.labelId===t&&a.stepIndex===e&&a.choiceIndex===s&&a.stepSha1===r);n<0?o.push({labelId:t,stepIndex:e,choiceIndex:s,stepSha1:r,madeTimes:1}):o[n].madeTimes++,i.allChoicesMade=o;}static pushNewLabel(t){if(!wh.get(t))throw new Error(`[Pixi\u2019VN] Label ${t} not found`);i._openedLabels.push({label:t,currentStepIndex:0});let r=i.allOpenedLabels,s=i.allOpenedLabels[t]?.biggestStep||0,o=i.allOpenedLabels[t]?.openCount||0;r[t]={biggestStep:s,openCount:o+1},i.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(i._openedLabels.length>0){let t=i._openedLabels[i._openedLabels.length-1];i._openedLabels[i._openedLabels.length-1]={...t,currentStepIndex:t.currentStepIndex+1};}}static _onStepStart;static set onStepStart(t){i._onStepStart=t;}static get onStepStart(){return async(t,e)=>{let r=[];return i.onLoadingLabel&&t===0&&r.push(i.onLoadingLabel(t,e)),i._onStepStart&&r.push(i._onStepStart(t,e)),await Promise.all(r)}}static onLoadingLabel;static onStepEnd};export{Ph as default};
@@ -1 +1 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=Object.create;var k=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var at=Object.getPrototypeOf,ht=Object.prototype.hasOwnProperty;var U=(h=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(h,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):h)(function(h){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+h+'" is not supported')});var $=(h,t)=>()=>(t||h((t={exports:{}}).exports,t),t.exports);var lt=(h,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ot(t))!ht.call(h,s)&&s!==e&&k(h,s,{get:()=>t[s],enumerable:!(i=rt(t,s))||i.enumerable});return h};var ft=(h,t,e)=>(e=h!=null?nt(at(h)):{},lt(k(e,"default",{value:h,enumerable:true}),h));var tt=$((P,Z)=>{(function(h,t){typeof P=="object"?Z.exports=P=t():typeof define=="function"&&define.amd?define([],t):h.CryptoJS=t();})(P,function(){var h=h||function(t,e){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof global<"u"&&global.crypto&&(i=global.crypto),!i&&typeof U=="function")try{i=U("crypto");}catch{}var s=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},r=Object.create||function(){function n(){}return function(a){var d;return n.prototype=a,d=new n,n.prototype=null,d}}(),o={},f=o.lib={},l=f.Base=function(){return {extend:function(n){var a=r(this);return n&&a.mixIn(n),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var a in n)n.hasOwnProperty(a)&&(this[a]=n[a]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),b=f.WordArray=l.extend({init:function(n,a){n=this.words=n||[],a!=e?this.sigBytes=a:this.sigBytes=n.length*4;},toString:function(n){return (n||u).stringify(this)},concat:function(n){var a=this.words,d=n.words,c=this.sigBytes,m=n.sigBytes;if(this.clamp(),c%4)for(var v=0;v<m;v++){var A=d[v>>>2]>>>24-v%4*8&255;a[c+v>>>2]|=A<<24-(c+v)%4*8;}else for(var T=0;T<m;T+=4)a[c+T>>>2]=d[T>>>2];return this.sigBytes+=m,this},clamp:function(){var n=this.words,a=this.sigBytes;n[a>>>2]&=4294967295<<32-a%4*8,n.length=t.ceil(a/4);},clone:function(){var n=l.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var a=[],d=0;d<n;d+=4)a.push(s());return new b.init(a,n)}}),p=o.enc={},u=p.Hex={stringify:function(n){for(var a=n.words,d=n.sigBytes,c=[],m=0;m<d;m++){var v=a[m>>>2]>>>24-m%4*8&255;c.push((v>>>4).toString(16)),c.push((v&15).toString(16));}return c.join("")},parse:function(n){for(var a=n.length,d=[],c=0;c<a;c+=2)d[c>>>3]|=parseInt(n.substr(c,2),16)<<24-c%8*4;return new b.init(d,a/2)}},g=p.Latin1={stringify:function(n){for(var a=n.words,d=n.sigBytes,c=[],m=0;m<d;m++){var v=a[m>>>2]>>>24-m%4*8&255;c.push(String.fromCharCode(v));}return c.join("")},parse:function(n){for(var a=n.length,d=[],c=0;c<a;c++)d[c>>>2]|=(n.charCodeAt(c)&255)<<24-c%4*8;return new b.init(d,a)}},y=p.Utf8={stringify:function(n){try{return decodeURIComponent(escape(g.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return g.parse(unescape(encodeURIComponent(n)))}},_=f.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new b.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=y.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var a,d=this._data,c=d.words,m=d.sigBytes,v=this.blockSize,A=v*4,T=m/A;n?T=t.ceil(T):T=t.max((T|0)-this._minBufferSize,0);var L=T*v,O=t.min(L*4,m);if(L){for(var M=0;M<L;M+=v)this._doProcessBlock(c,M);a=c.splice(0,L),d.sigBytes-=O;}return new b.init(a,O)},clone:function(){var n=l.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});f.Hasher=_.extend({cfg:l.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){_.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(n){return function(a,d){return new n.init(d).finalize(a)}},_createHmacHelper:function(n){return function(a,d){return new S.HMAC.init(n,d).finalize(a)}}});var S=o.algo={};return o}(Math);return h});});var it=$((H,et)=>{(function(h,t){typeof H=="object"?et.exports=H=t(tt()):typeof define=="function"&&define.amd?define(["./core"],t):t(h.CryptoJS);})(H,function(h){return function(){var t=h,e=t.lib,i=e.WordArray,s=e.Hasher,r=t.algo,o=[],f=r.SHA1=s.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,b){for(var p=this._hash.words,u=p[0],g=p[1],y=p[2],_=p[3],w=p[4],S=0;S<80;S++){if(S<16)o[S]=l[b+S]|0;else {var n=o[S-3]^o[S-8]^o[S-14]^o[S-16];o[S]=n<<1|n>>>31;}var a=(u<<5|u>>>27)+w+o[S];S<20?a+=(g&y|~g&_)+1518500249:S<40?a+=(g^y^_)+1859775393:S<60?a+=(g&y|g&_|y&_)-1894007588:a+=(g^y^_)-899497514,w=_,_=y,y=g<<30|g>>>2,g=u,u=a;}p[0]=p[0]+u|0,p[1]=p[1]+g|0,p[2]=p[2]+y|0,p[3]=p[3]+_|0,p[4]=p[4]+w|0;},_doFinalize:function(){var l=this._data,b=l.words,p=this._nDataBytes*8,u=l.sigBytes*8;return b[u>>>5]|=128<<24-u%32,b[(u+64>>>9<<4)+14]=Math.floor(p/4294967296),b[(u+64>>>9<<4)+15]=p,l.sigBytes=b.length*4,this._process(),this._hash},clone:function(){var l=s.clone.call(this);return l._hash=this._hash.clone(),l}});t.SHA1=s._createHelper(f),t.HmacSHA1=s._createHmacHelper(f);}(),h.SHA1});});var x;(s=>(s.log=(r,...o)=>console.log(`[Pixi\u2019VN] ${r}`,...o),s.warn=(r,...o)=>console.warn(`[Pixi\u2019VN] ${r}`,...o),s.error=(r,...o)=>console.error(`[Pixi\u2019VN] ${r}`,...o),s.info=(r,...o)=>console.info(`[Pixi\u2019VN] ${r}`,...o)))(x||={});var E=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,q=new Set,G=typeof process=="object"&&process?process:{},J=(h,t,e,i)=>{typeof G.emitWarning=="function"?G.emitWarning(h,t,e,i):console.error(`[${e}] ${t}: ${h}`);},B=globalThis.AbortController,K=globalThis.AbortSignal;if(typeof B>"u"){K=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},B=class{constructor(){t();}signal=new K;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let h=G.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{h&&(h=false,J("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var ct=h=>!q.has(h),C=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),Y=h=>C(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?I:null:null,I=class extends Array{constructor(t){super(t),this.fill(0);}},j=class h{heap;length;static#h=false;static create(t){let e=Y(t);if(!e)return [];h.#h=true;let i=new h(t,e);return h.#h=false,i}constructor(t,e){if(!h.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},D=class h{#h;#c;#g;#C;#b;#z;#R;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#y;#s;#i;#t;#l;#u;#a;#r;#m;#o;#S;#w;#d;#v;#x;#f;#F;static unsafeExposeInternals(t){return {starts:t.#w,ttls:t.#d,sizes:t.#S,keyMap:t.#s,keyList:t.#i,valList:t.#t,next:t.#l,prev:t.#u,get head(){return t.#a},get tail(){return t.#r},free:t.#m,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,r)=>t.#D(e,i,s,r),moveToTail:e=>t.#I(e),indexes:e=>t.#_(e),rindexes:e=>t.#T(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#c}get calculatedSize(){return this.#y}get size(){return this.#n}get fetchMethod(){return this.#z}get memoMethod(){return this.#R}get dispose(){return this.#g}get onInsert(){return this.#C}get disposeAfter(){return this.#b}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:f,allowStale:l,dispose:b,onInsert:p,disposeAfter:u,noDisposeOnSet:g,noUpdateTTL:y,maxSize:_=0,maxEntrySize:w=0,sizeCalculation:S,fetchMethod:n,memoMethod:a,noDeleteOnFetchRejection:d,noDeleteOnStaleGet:c,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:v,ignoreFetchAbort:A}=t;if(e!==0&&!C(e))throw new TypeError("max option must be a nonnegative integer");let T=e?Y(e):Array;if(!T)throw new Error("invalid max value: "+e);if(this.#h=e,this.#c=_,this.maxEntrySize=w||this.#c,this.sizeCalculation=S,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(a!==void 0&&typeof a!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#R=a,n!==void 0&&typeof n!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#z=n,this.#x=!!n,this.#s=new Map,this.#i=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new T(e),this.#u=new T(e),this.#a=0,this.#r=0,this.#m=j.create(e),this.#n=0,this.#y=0,typeof b=="function"&&(this.#g=b),typeof p=="function"&&(this.#C=p),typeof u=="function"?(this.#b=u,this.#o=[]):(this.#b=void 0,this.#o=void 0),this.#v=!!this.#g,this.#F=!!this.#C,this.#f=!!this.#b,this.noDisposeOnSet=!!g,this.noUpdateTTL=!!y,this.noDeleteOnFetchRejection=!!d,this.allowStaleOnFetchRejection=!!m,this.allowStaleOnFetchAbort=!!v,this.ignoreFetchAbort=!!A,this.maxEntrySize!==0){if(this.#c!==0&&!C(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!C(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#N();}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!c,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!f,this.ttlResolution=C(s)||s===0?s:1,this.ttlAutopurge=!!r,this.ttl=i||0,this.ttl){if(!C(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#P();}if(this.#h===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#c){let L="LRU_CACHE_UNBOUNDED";ct(L)&&(q.add(L),J("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",L,h));}}getRemainingTTL(t){return this.#s.has(t)?1/0:0}#P(){let t=new I(this.#h),e=new I(this.#h);this.#d=t,this.#w=e,this.#H=(r,o,f=E.now())=>{if(e[r]=o!==0?f:0,t[r]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#p(r)&&this.#L(this.#i[r],"expire");},o+1);l.unref&&l.unref();}},this.#O=r=>{e[r]=t[r]!==0?E.now():0;},this.#A=(r,o)=>{if(t[o]){let f=t[o],l=e[o];if(!f||!l)return;r.ttl=f,r.start=l,r.now=i||s();let b=r.now-l;r.remainingTTL=f-b;}};let i=0,s=()=>{let r=E.now();if(this.ttlResolution>0){i=r;let o=setTimeout(()=>i=0,this.ttlResolution);o.unref&&o.unref();}return r};this.getRemainingTTL=r=>{let o=this.#s.get(r);if(o===void 0)return 0;let f=t[o],l=e[o];if(!f||!l)return 1/0;let b=(i||s())-l;return f-b},this.#p=r=>{let o=e[r],f=t[r];return !!f&&!!o&&(i||s())-o>f};}#O=()=>{};#A=()=>{};#H=()=>{};#p=()=>false;#N(){let t=new I(this.#h);this.#y=0,this.#S=t,this.#E=e=>{this.#y-=t[e],t[e]=0;},this.#M=(e,i,s,r)=>{if(this.#e(i))return 0;if(!C(s))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(s=r(i,e),!C(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#W=(e,i,s)=>{if(t[e]=i,this.#c){let r=this.#c-t[e];for(;this.#y>r;)this.#B(true);}this.#y+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#y);};}#E=t=>{};#W=(t,e,i)=>{};#M=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#_({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#r;!(!this.#U(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#u[e];}*#T({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#a;!(!this.#U(e)||((t||!this.#p(e))&&(yield e),e===this.#r));)e=this.#l[e];}#U(t){return t!==void 0&&this.#s.get(this.#i[t])===t}*entries(){for(let t of this.#_())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#i[t],this.#t[t]]);}*rentries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#i[t],this.#t[t]]);}*keys(){for(let t of this.#_()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#T()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#_())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#_()){let s=this.#t[i],r=this.#e(s)?s.__staleWhileFetching:s;if(r!==void 0&&t(r,this.#i[i],this))return this.get(this.#i[i],e)}}forEach(t,e=this){for(let i of this.#_()){let s=this.#t[i],r=this.#e(s)?s.__staleWhileFetching:s;r!==void 0&&t.call(e,r,this.#i[i],this);}}rforEach(t,e=this){for(let i of this.#T()){let s=this.#t[i],r=this.#e(s)?s.__staleWhileFetching:s;r!==void 0&&t.call(e,r,this.#i[i],this);}}purgeStale(){let t=false;for(let e of this.#T({allowStale:true}))this.#p(e)&&(this.#L(this.#i[e],"expire"),t=true);return t}info(t){let e=this.#s.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let r={value:s};if(this.#d&&this.#w){let o=this.#d[e],f=this.#w[e];if(o&&f){let l=o-(E.now()-f);r.ttl=l,r.start=Date.now();}}return this.#S&&(r.size=this.#S[e]),r}dump(){let t=[];for(let e of this.#_({allowStale:true})){let i=this.#i[e],s=this.#t[e],r=this.#e(s)?s.__staleWhileFetching:s;if(r===void 0||i===void 0)continue;let o={value:r};if(this.#d&&this.#w){o.ttl=this.#d[e];let f=E.now()-this.#w[e];o.start=Math.floor(Date.now()-f);}this.#S&&(o.size=this.#S[e]),t.unshift([i,o]);}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=E.now()-s;}this.set(e,i.value,i);}}set(t,e,i={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:f=this.sizeCalculation,status:l}=i,{noUpdateTTL:b=this.noUpdateTTL}=i,p=this.#M(t,e,i.size||0,f);if(this.maxEntrySize&&p>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),this.#L(t,"set"),this;let u=this.#n===0?void 0:this.#s.get(t);if(u===void 0)u=this.#n===0?this.#r:this.#m.length!==0?this.#m.pop():this.#n===this.#h?this.#B(false):this.#n,this.#i[u]=t,this.#t[u]=e,this.#s.set(t,u),this.#l[this.#r]=u,this.#u[u]=this.#r,this.#r=u,this.#n++,this.#W(u,p,l),l&&(l.set="add"),b=false,this.#F&&this.#C?.(e,t,"add");else {this.#I(u);let g=this.#t[u];if(e!==g){if(this.#x&&this.#e(g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:y}=g;y!==void 0&&!o&&(this.#v&&this.#g?.(y,t,"set"),this.#f&&this.#o?.push([y,t,"set"]));}else o||(this.#v&&this.#g?.(g,t,"set"),this.#f&&this.#o?.push([g,t,"set"]));if(this.#E(u),this.#W(u,p,l),this.#t[u]=e,l){l.set="replace";let y=g&&this.#e(g)?g.__staleWhileFetching:g;y!==void 0&&(l.oldValue=y);}}else l&&(l.set="update");this.#F&&this.onInsert?.(e,t,e===g?"update":"replace");}if(s!==0&&!this.#d&&this.#P(),this.#d&&(b||this.#H(u,s,r),l&&this.#A(l,u)),!o&&this.#f&&this.#o){let g=this.#o,y;for(;y=g?.shift();)this.#b?.(...y);}return this}pop(){try{for(;this.#n;){let t=this.#t[this.#a];if(this.#B(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#f&&this.#o){let t=this.#o,e;for(;e=t?.shift();)this.#b?.(...e);}}}#B(t){let e=this.#a,i=this.#i[e],s=this.#t[e];return this.#x&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#f)&&(this.#v&&this.#g?.(s,i,"evict"),this.#f&&this.#o?.push([s,i,"evict"])),this.#E(e),t&&(this.#i[e]=void 0,this.#t[e]=void 0,this.#m.push(e)),this.#n===1?(this.#a=this.#r=0,this.#m.length=0):this.#a=this.#l[e],this.#s.delete(i),this.#n--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,r=this.#s.get(t);if(r!==void 0){let o=this.#t[r];if(this.#e(o)&&o.__staleWhileFetching===void 0)return false;if(this.#p(r))s&&(s.has="stale",this.#A(s,r));else return i&&this.#O(r),s&&(s.has="hit",this.#A(s,r)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#s.get(t);if(s===void 0||!i&&this.#p(s))return;let r=this.#t[s];return this.#e(r)?r.__staleWhileFetching:r}#D(t,e,i,s){let r=e===void 0?void 0:this.#t[e];if(this.#e(r))return r;let o=new B,{signal:f}=i;f?.addEventListener("abort",()=>o.abort(f.reason),{signal:o.signal});let l={signal:o.signal,options:i,context:s},b=(w,S=false)=>{let{aborted:n}=o.signal,a=i.ignoreFetchAbort&&w!==void 0;if(i.status&&(n&&!S?(i.status.fetchAborted=true,i.status.fetchError=o.signal.reason,a&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),n&&!a&&!S)return u(o.signal.reason);let d=y;return this.#t[e]===y&&(w===void 0?d.__staleWhileFetching?this.#t[e]=d.__staleWhileFetching:this.#L(t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,w,l.options))),w},p=w=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=w),u(w)),u=w=>{let{aborted:S}=o.signal,n=S&&i.allowStaleOnFetchAbort,a=n||i.allowStaleOnFetchRejection,d=a||i.noDeleteOnFetchRejection,c=y;if(this.#t[e]===y&&(!d||c.__staleWhileFetching===void 0?this.#L(t,"fetch"):n||(this.#t[e]=c.__staleWhileFetching)),a)return i.status&&c.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),c.__staleWhileFetching;if(c.__returned===c)throw w},g=(w,S)=>{let n=this.#z?.(t,r,l);n&&n instanceof Promise&&n.then(a=>w(a===void 0?void 0:a),S),o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(w(void 0),i.allowStaleOnFetchAbort&&(w=a=>b(a,true)));});};i.status&&(i.status.fetchDispatched=true);let y=new Promise(g).then(b,p),_=Object.assign(y,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(t,_,{...l.options,status:void 0}),e=this.#s.get(t)):this.#t[e]=_,_}#e(t){if(!this.#x)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof B}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:f=this.noDisposeOnSet,size:l=0,sizeCalculation:b=this.sizeCalculation,noUpdateTTL:p=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:_=this.allowStaleOnFetchAbort,context:w,forceRefresh:S=false,status:n,signal:a}=e;if(!this.#x)return n&&(n.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:n});let d={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:f,size:l,sizeCalculation:b,noUpdateTTL:p,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:_,ignoreFetchAbort:y,status:n,signal:a},c=this.#s.get(t);if(c===void 0){n&&(n.fetch="miss");let m=this.#D(t,c,d,w);return m.__returned=m}else {let m=this.#t[c];if(this.#e(m)){let O=i&&m.__staleWhileFetching!==void 0;return n&&(n.fetch="inflight",O&&(n.returnedStale=true)),O?m.__staleWhileFetching:m.__returned=m}let v=this.#p(c);if(!S&&!v)return n&&(n.fetch="hit"),this.#I(c),s&&this.#O(c),n&&this.#A(n,c),m;let A=this.#D(t,c,d,w),L=A.__staleWhileFetching!==void 0&&i;return n&&(n.fetch=v?"stale":"refresh",L&&v&&(n.returnedStale=true)),L?A.__staleWhileFetching:A.__returned=A}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#R;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:r,...o}=e,f=this.get(t,o);if(!r&&f!==void 0)return f;let l=i(t,f,{options:o,context:s});return this.set(t,l,o),l}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=e,f=this.#s.get(t);if(f!==void 0){let l=this.#t[f],b=this.#e(l);return o&&this.#A(o,f),this.#p(f)?(o&&(o.get="stale"),b?(o&&i&&l.__staleWhileFetching!==void 0&&(o.returnedStale=true),i?l.__staleWhileFetching:void 0):(r||this.#L(t,"expire"),o&&i&&(o.returnedStale=true),i?l:void 0)):(o&&(o.get="hit"),b?l.__staleWhileFetching:(this.#I(f),s&&this.#O(f),l))}else o&&(o.get="miss");}#G(t,e){this.#u[e]=t,this.#l[t]=e;}#I(t){t!==this.#r&&(t===this.#a?this.#a=this.#l[t]:this.#G(this.#u[t],this.#l[t]),this.#G(this.#r,t),this.#r=t);}delete(t){return this.#L(t,"delete")}#L(t,e){let i=false;if(this.#n!==0){let s=this.#s.get(t);if(s!==void 0)if(i=true,this.#n===1)this.#j(e);else {this.#E(s);let r=this.#t[s];if(this.#e(r)?r.__abortController.abort(new Error("deleted")):(this.#v||this.#f)&&(this.#v&&this.#g?.(r,t,e),this.#f&&this.#o?.push([r,t,e])),this.#s.delete(t),this.#i[s]=void 0,this.#t[s]=void 0,s===this.#r)this.#r=this.#u[s];else if(s===this.#a)this.#a=this.#l[s];else {let o=this.#u[s];this.#l[o]=this.#l[s];let f=this.#l[s];this.#u[f]=this.#u[s];}this.#n--,this.#m.push(s);}}if(this.#f&&this.#o?.length){let s=this.#o,r;for(;r=s?.shift();)this.#b?.(...r);}return i}clear(){return this.#j("delete")}#j(t){for(let e of this.#T({allowStale:true})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else {let s=this.#i[e];this.#v&&this.#g?.(i,s,t),this.#f&&this.#o?.push([i,s,t]);}}if(this.#s.clear(),this.#t.fill(void 0),this.#i.fill(void 0),this.#d&&this.#w&&(this.#d.fill(0),this.#w.fill(0)),this.#S&&this.#S.fill(0),this.#a=0,this.#r=0,this.#m.length=0,this.#y=0,this.#n=0,this.#f&&this.#o){let e=this.#o,i;for(;i=e?.shift();)this.#b?.(...i);}}};var z=class{cache;map=new Map;constructor(t){this.cache=new D({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}get keys(){return this.map.keys}get values(){return this.map.values}};var R=new z({cacheSize:10}),X;(s=>{function h(r){let o=R.get(r);if(!o){x.error(`Label "${r}" not found`);return}return o}s.get=h;function t(r){if(Array.isArray(r)){r.forEach(o=>t(o));return}R.has(r.id)&&x.info(`Label "${r.id}" already exists, it will be overwritten`),R.set(r.id,r);}s.add=t;function e(){return Array.from(R.values())}s.values=e;function i(r){return R.has(r)}s.has=i;})(X||={});var Q=X;var st=ft(it());var F=class{constructor(t,e){this._id=t,this._onStepStart=e?.onStepStart,this._onLoadingLabel=e?.onLoadingLabel,this._onStepEnd=e?.onStepEnd;}_id;get id(){return this._id}_onStepStart;get onStepStart(){return async(t,e)=>{if(this._onLoadingLabel&&t===0&&await this._onLoadingLabel(t,e),this._onStepStart)return await this._onStepStart(t,e)}}_onLoadingLabel;get onLoadingLabel(){return this._onLoadingLabel}_onStepEnd;get onStepEnd(){return this._onStepEnd}};var W=class extends F{get stepCount(){return this.steps.length}getStepById(t){return this.steps[t]}constructor(t,e,i){super(t,i),this._steps=e;}_steps;get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(t){if(t<0||t>=this.steps.length)return x.warn("stepSha not found, setting to ERROR"),"error";try{let e=this.steps[t];return (0,st.default)(e.toString().toLocaleLowerCase()).toString()}catch(e){return x.warn("stepSha not found, setting to ERROR",e),"error"}}};var ut="__close-label-id__";function N(){return new W(ut,[],{})}var V=class{text;_label;get label(){let t=this._label;if(typeof t=="string"){let e=Q.get(t);e?t=e:(x.error(`Label ${t} not found, so it will be closed`),t=N());}return t}type;oneTime;onlyHaveNoChoice;autoSelect;props={};devProps={};constructor(t,e,i,s){let{type:r="call",oneTime:o=false,onlyHaveNoChoice:f=false,autoSelect:l=false,...b}=s||{};this.text=t,this._label=e,this.type=r,this.oneTime=o,this.onlyHaveNoChoice=f,this.autoSelect=l,this.devProps=b,this.props=i;}};function Mt(h,t,e,i){let s=typeof t=="string"?t:t.id;return {...i,label:s,props:e,text:h,type:i?.type||"call"}}exports.default=V;exports.newChoiceOption=Mt;
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=Object.create;var k=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var at=Object.getPrototypeOf,ht=Object.prototype.hasOwnProperty;var U=(h=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(h,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):h)(function(h){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+h+'" is not supported')});var $=(h,t)=>()=>(t||h((t={exports:{}}).exports,t),t.exports);var lt=(h,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ot(t))!ht.call(h,s)&&s!==e&&k(h,s,{get:()=>t[s],enumerable:!(i=rt(t,s))||i.enumerable});return h};var ft=(h,t,e)=>(e=h!=null?nt(at(h)):{},lt(k(e,"default",{value:h,enumerable:true}),h));var tt=$((P,Z)=>{(function(h,t){typeof P=="object"?Z.exports=P=t():typeof define=="function"&&define.amd?define([],t):h.CryptoJS=t();})(P,function(){var h=h||function(t,e){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof global<"u"&&global.crypto&&(i=global.crypto),!i&&typeof U=="function")try{i=U("crypto");}catch{}var s=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},r=Object.create||function(){function n(){}return function(a){var d;return n.prototype=a,d=new n,n.prototype=null,d}}(),o={},f=o.lib={},l=f.Base=function(){return {extend:function(n){var a=r(this);return n&&a.mixIn(n),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var a in n)n.hasOwnProperty(a)&&(this[a]=n[a]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),b=f.WordArray=l.extend({init:function(n,a){n=this.words=n||[],a!=e?this.sigBytes=a:this.sigBytes=n.length*4;},toString:function(n){return (n||u).stringify(this)},concat:function(n){var a=this.words,d=n.words,c=this.sigBytes,m=n.sigBytes;if(this.clamp(),c%4)for(var v=0;v<m;v++){var A=d[v>>>2]>>>24-v%4*8&255;a[c+v>>>2]|=A<<24-(c+v)%4*8;}else for(var T=0;T<m;T+=4)a[c+T>>>2]=d[T>>>2];return this.sigBytes+=m,this},clamp:function(){var n=this.words,a=this.sigBytes;n[a>>>2]&=4294967295<<32-a%4*8,n.length=t.ceil(a/4);},clone:function(){var n=l.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var a=[],d=0;d<n;d+=4)a.push(s());return new b.init(a,n)}}),p=o.enc={},u=p.Hex={stringify:function(n){for(var a=n.words,d=n.sigBytes,c=[],m=0;m<d;m++){var v=a[m>>>2]>>>24-m%4*8&255;c.push((v>>>4).toString(16)),c.push((v&15).toString(16));}return c.join("")},parse:function(n){for(var a=n.length,d=[],c=0;c<a;c+=2)d[c>>>3]|=parseInt(n.substr(c,2),16)<<24-c%8*4;return new b.init(d,a/2)}},g=p.Latin1={stringify:function(n){for(var a=n.words,d=n.sigBytes,c=[],m=0;m<d;m++){var v=a[m>>>2]>>>24-m%4*8&255;c.push(String.fromCharCode(v));}return c.join("")},parse:function(n){for(var a=n.length,d=[],c=0;c<a;c++)d[c>>>2]|=(n.charCodeAt(c)&255)<<24-c%4*8;return new b.init(d,a)}},y=p.Utf8={stringify:function(n){try{return decodeURIComponent(escape(g.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return g.parse(unescape(encodeURIComponent(n)))}},_=f.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new b.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=y.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var a,d=this._data,c=d.words,m=d.sigBytes,v=this.blockSize,A=v*4,T=m/A;n?T=t.ceil(T):T=t.max((T|0)-this._minBufferSize,0);var L=T*v,O=t.min(L*4,m);if(L){for(var M=0;M<L;M+=v)this._doProcessBlock(c,M);a=c.splice(0,L),d.sigBytes-=O;}return new b.init(a,O)},clone:function(){var n=l.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});f.Hasher=_.extend({cfg:l.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){_.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(n){return function(a,d){return new n.init(d).finalize(a)}},_createHmacHelper:function(n){return function(a,d){return new S.HMAC.init(n,d).finalize(a)}}});var S=o.algo={};return o}(Math);return h});});var it=$((H,et)=>{(function(h,t){typeof H=="object"?et.exports=H=t(tt()):typeof define=="function"&&define.amd?define(["./core"],t):t(h.CryptoJS);})(H,function(h){return function(){var t=h,e=t.lib,i=e.WordArray,s=e.Hasher,r=t.algo,o=[],f=r.SHA1=s.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,b){for(var p=this._hash.words,u=p[0],g=p[1],y=p[2],_=p[3],w=p[4],S=0;S<80;S++){if(S<16)o[S]=l[b+S]|0;else {var n=o[S-3]^o[S-8]^o[S-14]^o[S-16];o[S]=n<<1|n>>>31;}var a=(u<<5|u>>>27)+w+o[S];S<20?a+=(g&y|~g&_)+1518500249:S<40?a+=(g^y^_)+1859775393:S<60?a+=(g&y|g&_|y&_)-1894007588:a+=(g^y^_)-899497514,w=_,_=y,y=g<<30|g>>>2,g=u,u=a;}p[0]=p[0]+u|0,p[1]=p[1]+g|0,p[2]=p[2]+y|0,p[3]=p[3]+_|0,p[4]=p[4]+w|0;},_doFinalize:function(){var l=this._data,b=l.words,p=this._nDataBytes*8,u=l.sigBytes*8;return b[u>>>5]|=128<<24-u%32,b[(u+64>>>9<<4)+14]=Math.floor(p/4294967296),b[(u+64>>>9<<4)+15]=p,l.sigBytes=b.length*4,this._process(),this._hash},clone:function(){var l=s.clone.call(this);return l._hash=this._hash.clone(),l}});t.SHA1=s._createHelper(f),t.HmacSHA1=s._createHmacHelper(f);}(),h.SHA1});});var x;(s=>(s.log=(r,...o)=>console.log(`[Pixi\u2019VN] ${r}`,...o),s.warn=(r,...o)=>console.warn(`[Pixi\u2019VN] ${r}`,...o),s.error=(r,...o)=>console.error(`[Pixi\u2019VN] ${r}`,...o),s.info=(r,...o)=>console.info(`[Pixi\u2019VN] ${r}`,...o)))(x||={});var E=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,q=new Set,G=typeof process=="object"&&process?process:{},J=(h,t,e,i)=>{typeof G.emitWarning=="function"?G.emitWarning(h,t,e,i):console.error(`[${e}] ${t}: ${h}`);},B=globalThis.AbortController,K=globalThis.AbortSignal;if(typeof B>"u"){K=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},B=class{constructor(){t();}signal=new K;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let h=G.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{h&&(h=false,J("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var ct=h=>!q.has(h),C=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),Y=h=>C(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?I:null:null,I=class extends Array{constructor(t){super(t),this.fill(0);}},j=class h{heap;length;static#h=false;static create(t){let e=Y(t);if(!e)return [];h.#h=true;let i=new h(t,e);return h.#h=false,i}constructor(t,e){if(!h.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},D=class h{#h;#c;#g;#C;#b;#z;#R;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#y;#s;#i;#t;#l;#u;#a;#r;#m;#o;#S;#w;#d;#v;#x;#f;#F;static unsafeExposeInternals(t){return {starts:t.#w,ttls:t.#d,sizes:t.#S,keyMap:t.#s,keyList:t.#i,valList:t.#t,next:t.#l,prev:t.#u,get head(){return t.#a},get tail(){return t.#r},free:t.#m,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,r)=>t.#D(e,i,s,r),moveToTail:e=>t.#I(e),indexes:e=>t.#_(e),rindexes:e=>t.#T(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#c}get calculatedSize(){return this.#y}get size(){return this.#n}get fetchMethod(){return this.#z}get memoMethod(){return this.#R}get dispose(){return this.#g}get onInsert(){return this.#C}get disposeAfter(){return this.#b}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:f,allowStale:l,dispose:b,onInsert:p,disposeAfter:u,noDisposeOnSet:g,noUpdateTTL:y,maxSize:_=0,maxEntrySize:w=0,sizeCalculation:S,fetchMethod:n,memoMethod:a,noDeleteOnFetchRejection:d,noDeleteOnStaleGet:c,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:v,ignoreFetchAbort:A}=t;if(e!==0&&!C(e))throw new TypeError("max option must be a nonnegative integer");let T=e?Y(e):Array;if(!T)throw new Error("invalid max value: "+e);if(this.#h=e,this.#c=_,this.maxEntrySize=w||this.#c,this.sizeCalculation=S,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(a!==void 0&&typeof a!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#R=a,n!==void 0&&typeof n!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#z=n,this.#x=!!n,this.#s=new Map,this.#i=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new T(e),this.#u=new T(e),this.#a=0,this.#r=0,this.#m=j.create(e),this.#n=0,this.#y=0,typeof b=="function"&&(this.#g=b),typeof p=="function"&&(this.#C=p),typeof u=="function"?(this.#b=u,this.#o=[]):(this.#b=void 0,this.#o=void 0),this.#v=!!this.#g,this.#F=!!this.#C,this.#f=!!this.#b,this.noDisposeOnSet=!!g,this.noUpdateTTL=!!y,this.noDeleteOnFetchRejection=!!d,this.allowStaleOnFetchRejection=!!m,this.allowStaleOnFetchAbort=!!v,this.ignoreFetchAbort=!!A,this.maxEntrySize!==0){if(this.#c!==0&&!C(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!C(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#N();}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!c,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!f,this.ttlResolution=C(s)||s===0?s:1,this.ttlAutopurge=!!r,this.ttl=i||0,this.ttl){if(!C(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#P();}if(this.#h===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#c){let L="LRU_CACHE_UNBOUNDED";ct(L)&&(q.add(L),J("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",L,h));}}getRemainingTTL(t){return this.#s.has(t)?1/0:0}#P(){let t=new I(this.#h),e=new I(this.#h);this.#d=t,this.#w=e,this.#H=(r,o,f=E.now())=>{if(e[r]=o!==0?f:0,t[r]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#p(r)&&this.#L(this.#i[r],"expire");},o+1);l.unref&&l.unref();}},this.#O=r=>{e[r]=t[r]!==0?E.now():0;},this.#A=(r,o)=>{if(t[o]){let f=t[o],l=e[o];if(!f||!l)return;r.ttl=f,r.start=l,r.now=i||s();let b=r.now-l;r.remainingTTL=f-b;}};let i=0,s=()=>{let r=E.now();if(this.ttlResolution>0){i=r;let o=setTimeout(()=>i=0,this.ttlResolution);o.unref&&o.unref();}return r};this.getRemainingTTL=r=>{let o=this.#s.get(r);if(o===void 0)return 0;let f=t[o],l=e[o];if(!f||!l)return 1/0;let b=(i||s())-l;return f-b},this.#p=r=>{let o=e[r],f=t[r];return !!f&&!!o&&(i||s())-o>f};}#O=()=>{};#A=()=>{};#H=()=>{};#p=()=>false;#N(){let t=new I(this.#h);this.#y=0,this.#S=t,this.#E=e=>{this.#y-=t[e],t[e]=0;},this.#M=(e,i,s,r)=>{if(this.#e(i))return 0;if(!C(s))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(s=r(i,e),!C(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#W=(e,i,s)=>{if(t[e]=i,this.#c){let r=this.#c-t[e];for(;this.#y>r;)this.#B(true);}this.#y+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#y);};}#E=t=>{};#W=(t,e,i)=>{};#M=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#_({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#r;!(!this.#U(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#u[e];}*#T({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#a;!(!this.#U(e)||((t||!this.#p(e))&&(yield e),e===this.#r));)e=this.#l[e];}#U(t){return t!==void 0&&this.#s.get(this.#i[t])===t}*entries(){for(let t of this.#_())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#i[t],this.#t[t]]);}*rentries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#i[t],this.#t[t]]);}*keys(){for(let t of this.#_()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#T()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#_())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#_()){let s=this.#t[i],r=this.#e(s)?s.__staleWhileFetching:s;if(r!==void 0&&t(r,this.#i[i],this))return this.get(this.#i[i],e)}}forEach(t,e=this){for(let i of this.#_()){let s=this.#t[i],r=this.#e(s)?s.__staleWhileFetching:s;r!==void 0&&t.call(e,r,this.#i[i],this);}}rforEach(t,e=this){for(let i of this.#T()){let s=this.#t[i],r=this.#e(s)?s.__staleWhileFetching:s;r!==void 0&&t.call(e,r,this.#i[i],this);}}purgeStale(){let t=false;for(let e of this.#T({allowStale:true}))this.#p(e)&&(this.#L(this.#i[e],"expire"),t=true);return t}info(t){let e=this.#s.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let r={value:s};if(this.#d&&this.#w){let o=this.#d[e],f=this.#w[e];if(o&&f){let l=o-(E.now()-f);r.ttl=l,r.start=Date.now();}}return this.#S&&(r.size=this.#S[e]),r}dump(){let t=[];for(let e of this.#_({allowStale:true})){let i=this.#i[e],s=this.#t[e],r=this.#e(s)?s.__staleWhileFetching:s;if(r===void 0||i===void 0)continue;let o={value:r};if(this.#d&&this.#w){o.ttl=this.#d[e];let f=E.now()-this.#w[e];o.start=Math.floor(Date.now()-f);}this.#S&&(o.size=this.#S[e]),t.unshift([i,o]);}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=E.now()-s;}this.set(e,i.value,i);}}set(t,e,i={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:f=this.sizeCalculation,status:l}=i,{noUpdateTTL:b=this.noUpdateTTL}=i,p=this.#M(t,e,i.size||0,f);if(this.maxEntrySize&&p>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),this.#L(t,"set"),this;let u=this.#n===0?void 0:this.#s.get(t);if(u===void 0)u=this.#n===0?this.#r:this.#m.length!==0?this.#m.pop():this.#n===this.#h?this.#B(false):this.#n,this.#i[u]=t,this.#t[u]=e,this.#s.set(t,u),this.#l[this.#r]=u,this.#u[u]=this.#r,this.#r=u,this.#n++,this.#W(u,p,l),l&&(l.set="add"),b=false,this.#F&&this.#C?.(e,t,"add");else {this.#I(u);let g=this.#t[u];if(e!==g){if(this.#x&&this.#e(g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:y}=g;y!==void 0&&!o&&(this.#v&&this.#g?.(y,t,"set"),this.#f&&this.#o?.push([y,t,"set"]));}else o||(this.#v&&this.#g?.(g,t,"set"),this.#f&&this.#o?.push([g,t,"set"]));if(this.#E(u),this.#W(u,p,l),this.#t[u]=e,l){l.set="replace";let y=g&&this.#e(g)?g.__staleWhileFetching:g;y!==void 0&&(l.oldValue=y);}}else l&&(l.set="update");this.#F&&this.onInsert?.(e,t,e===g?"update":"replace");}if(s!==0&&!this.#d&&this.#P(),this.#d&&(b||this.#H(u,s,r),l&&this.#A(l,u)),!o&&this.#f&&this.#o){let g=this.#o,y;for(;y=g?.shift();)this.#b?.(...y);}return this}pop(){try{for(;this.#n;){let t=this.#t[this.#a];if(this.#B(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#f&&this.#o){let t=this.#o,e;for(;e=t?.shift();)this.#b?.(...e);}}}#B(t){let e=this.#a,i=this.#i[e],s=this.#t[e];return this.#x&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#f)&&(this.#v&&this.#g?.(s,i,"evict"),this.#f&&this.#o?.push([s,i,"evict"])),this.#E(e),t&&(this.#i[e]=void 0,this.#t[e]=void 0,this.#m.push(e)),this.#n===1?(this.#a=this.#r=0,this.#m.length=0):this.#a=this.#l[e],this.#s.delete(i),this.#n--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,r=this.#s.get(t);if(r!==void 0){let o=this.#t[r];if(this.#e(o)&&o.__staleWhileFetching===void 0)return false;if(this.#p(r))s&&(s.has="stale",this.#A(s,r));else return i&&this.#O(r),s&&(s.has="hit",this.#A(s,r)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#s.get(t);if(s===void 0||!i&&this.#p(s))return;let r=this.#t[s];return this.#e(r)?r.__staleWhileFetching:r}#D(t,e,i,s){let r=e===void 0?void 0:this.#t[e];if(this.#e(r))return r;let o=new B,{signal:f}=i;f?.addEventListener("abort",()=>o.abort(f.reason),{signal:o.signal});let l={signal:o.signal,options:i,context:s},b=(w,S=false)=>{let{aborted:n}=o.signal,a=i.ignoreFetchAbort&&w!==void 0;if(i.status&&(n&&!S?(i.status.fetchAborted=true,i.status.fetchError=o.signal.reason,a&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),n&&!a&&!S)return u(o.signal.reason);let d=y;return this.#t[e]===y&&(w===void 0?d.__staleWhileFetching?this.#t[e]=d.__staleWhileFetching:this.#L(t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,w,l.options))),w},p=w=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=w),u(w)),u=w=>{let{aborted:S}=o.signal,n=S&&i.allowStaleOnFetchAbort,a=n||i.allowStaleOnFetchRejection,d=a||i.noDeleteOnFetchRejection,c=y;if(this.#t[e]===y&&(!d||c.__staleWhileFetching===void 0?this.#L(t,"fetch"):n||(this.#t[e]=c.__staleWhileFetching)),a)return i.status&&c.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),c.__staleWhileFetching;if(c.__returned===c)throw w},g=(w,S)=>{let n=this.#z?.(t,r,l);n&&n instanceof Promise&&n.then(a=>w(a===void 0?void 0:a),S),o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(w(void 0),i.allowStaleOnFetchAbort&&(w=a=>b(a,true)));});};i.status&&(i.status.fetchDispatched=true);let y=new Promise(g).then(b,p),_=Object.assign(y,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(t,_,{...l.options,status:void 0}),e=this.#s.get(t)):this.#t[e]=_,_}#e(t){if(!this.#x)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof B}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:f=this.noDisposeOnSet,size:l=0,sizeCalculation:b=this.sizeCalculation,noUpdateTTL:p=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:_=this.allowStaleOnFetchAbort,context:w,forceRefresh:S=false,status:n,signal:a}=e;if(!this.#x)return n&&(n.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:n});let d={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:f,size:l,sizeCalculation:b,noUpdateTTL:p,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:_,ignoreFetchAbort:y,status:n,signal:a},c=this.#s.get(t);if(c===void 0){n&&(n.fetch="miss");let m=this.#D(t,c,d,w);return m.__returned=m}else {let m=this.#t[c];if(this.#e(m)){let O=i&&m.__staleWhileFetching!==void 0;return n&&(n.fetch="inflight",O&&(n.returnedStale=true)),O?m.__staleWhileFetching:m.__returned=m}let v=this.#p(c);if(!S&&!v)return n&&(n.fetch="hit"),this.#I(c),s&&this.#O(c),n&&this.#A(n,c),m;let A=this.#D(t,c,d,w),L=A.__staleWhileFetching!==void 0&&i;return n&&(n.fetch=v?"stale":"refresh",L&&v&&(n.returnedStale=true)),L?A.__staleWhileFetching:A.__returned=A}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#R;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:r,...o}=e,f=this.get(t,o);if(!r&&f!==void 0)return f;let l=i(t,f,{options:o,context:s});return this.set(t,l,o),l}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=e,f=this.#s.get(t);if(f!==void 0){let l=this.#t[f],b=this.#e(l);return o&&this.#A(o,f),this.#p(f)?(o&&(o.get="stale"),b?(o&&i&&l.__staleWhileFetching!==void 0&&(o.returnedStale=true),i?l.__staleWhileFetching:void 0):(r||this.#L(t,"expire"),o&&i&&(o.returnedStale=true),i?l:void 0)):(o&&(o.get="hit"),b?l.__staleWhileFetching:(this.#I(f),s&&this.#O(f),l))}else o&&(o.get="miss");}#G(t,e){this.#u[e]=t,this.#l[t]=e;}#I(t){t!==this.#r&&(t===this.#a?this.#a=this.#l[t]:this.#G(this.#u[t],this.#l[t]),this.#G(this.#r,t),this.#r=t);}delete(t){return this.#L(t,"delete")}#L(t,e){let i=false;if(this.#n!==0){let s=this.#s.get(t);if(s!==void 0)if(i=true,this.#n===1)this.#j(e);else {this.#E(s);let r=this.#t[s];if(this.#e(r)?r.__abortController.abort(new Error("deleted")):(this.#v||this.#f)&&(this.#v&&this.#g?.(r,t,e),this.#f&&this.#o?.push([r,t,e])),this.#s.delete(t),this.#i[s]=void 0,this.#t[s]=void 0,s===this.#r)this.#r=this.#u[s];else if(s===this.#a)this.#a=this.#l[s];else {let o=this.#u[s];this.#l[o]=this.#l[s];let f=this.#l[s];this.#u[f]=this.#u[s];}this.#n--,this.#m.push(s);}}if(this.#f&&this.#o?.length){let s=this.#o,r;for(;r=s?.shift();)this.#b?.(...r);}return i}clear(){return this.#j("delete")}#j(t){for(let e of this.#T({allowStale:true})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else {let s=this.#i[e];this.#v&&this.#g?.(i,s,t),this.#f&&this.#o?.push([i,s,t]);}}if(this.#s.clear(),this.#t.fill(void 0),this.#i.fill(void 0),this.#d&&this.#w&&(this.#d.fill(0),this.#w.fill(0)),this.#S&&this.#S.fill(0),this.#a=0,this.#r=0,this.#m.length=0,this.#y=0,this.#n=0,this.#f&&this.#o){let e=this.#o,i;for(;i=e?.shift();)this.#b?.(...i);}}};var z=class{cache;map=new Map;constructor(t){this.cache=new D({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var R=new z({cacheSize:10}),X;(s=>{function h(r){let o=R.get(r);if(!o){x.error(`Label "${r}" not found`);return}return o}s.get=h;function t(r){if(Array.isArray(r)){r.forEach(o=>t(o));return}R.has(r.id)&&x.info(`Label "${r.id}" already exists, it will be overwritten`),R.set(r.id,r);}s.add=t;function e(){return Array.from(R.values())}s.values=e;function i(r){return R.has(r)}s.has=i;})(X||={});var Q=X;var st=ft(it());var F=class{constructor(t,e){this._id=t,this._onStepStart=e?.onStepStart,this._onLoadingLabel=e?.onLoadingLabel,this._onStepEnd=e?.onStepEnd;}_id;get id(){return this._id}_onStepStart;get onStepStart(){return async(t,e)=>{if(this._onLoadingLabel&&t===0&&await this._onLoadingLabel(t,e),this._onStepStart)return await this._onStepStart(t,e)}}_onLoadingLabel;get onLoadingLabel(){return this._onLoadingLabel}_onStepEnd;get onStepEnd(){return this._onStepEnd}};var W=class extends F{get stepCount(){return this.steps.length}getStepById(t){return this.steps[t]}constructor(t,e,i){super(t,i),this._steps=e;}_steps;get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(t){if(t<0||t>=this.steps.length)return x.warn("stepSha not found, setting to ERROR"),"error";try{let e=this.steps[t];return (0,st.default)(e.toString().toLocaleLowerCase()).toString()}catch(e){return x.warn("stepSha not found, setting to ERROR",e),"error"}}};var ut="__close-label-id__";function N(){return new W(ut,[],{})}var V=class{text;_label;get label(){let t=this._label;if(typeof t=="string"){let e=Q.get(t);e?t=e:(x.error(`Label ${t} not found, so it will be closed`),t=N());}return t}type;oneTime;onlyHaveNoChoice;autoSelect;props={};devProps={};constructor(t,e,i,s){let{type:r="call",oneTime:o=false,onlyHaveNoChoice:f=false,autoSelect:l=false,...b}=s||{};this.text=t,this._label=e,this.type=r,this.oneTime=o,this.onlyHaveNoChoice=f,this.autoSelect=l,this.devProps=b,this.props=i;}};function Mt(h,t,e,i){let s=typeof t=="string"?t:t.id;return {...i,label:s,props:e,text:h,type:i?.type||"call"}}exports.default=V;exports.newChoiceOption=Mt;