From e6f41810a793db136f3c0adff8a62a50a00b06ea Mon Sep 17 00:00:00 2001 From: han4wluc Date: Mon, 13 Apr 2026 21:51:25 +0800 Subject: [PATCH] Fix audio volume scale to 0-100 --- package.json | 2 +- playground/pages/docs/nodes/rect.md | 2 +- playground/pages/docs/nodes/sound.md | 6 +- playground/pages/docs/nodes/sprite.md | 2 +- playground/pages/docs/nodes/text.md | 2 +- playground/pages/docs/nodes/video.md | 6 +- playground/static/RouteGraphics.js | 601 +++++++++++++----- spec/audio/updateSound.spec.js | 6 +- spec/elements/updateVideo.spec.js | 4 +- src/plugins/audio/sound/addSound.js | 4 +- src/plugins/audio/sound/updateSound.js | 7 +- .../util/bindContainerInteractions.js | 3 +- src/plugins/elements/rect/addRect.js | 3 +- src/plugins/elements/rect/updateRect.js | 3 +- src/plugins/elements/sprite/addSprite.js | 3 +- src/plugins/elements/sprite/updateSprite.js | 3 +- src/plugins/elements/text/addText.js | 3 +- src/plugins/elements/text/updateText.js | 3 +- src/plugins/elements/video/addVideo.js | 3 +- src/plugins/elements/video/parseVideo.js | 2 +- src/plugins/elements/video/updateVideo.js | 3 +- src/schemas/audio/sound.yaml | 5 +- src/schemas/elements/container.computed.yaml | 6 +- src/schemas/elements/container.element.yaml | 6 +- src/schemas/elements/rect.computed.yaml | 6 +- src/schemas/elements/rect.element.yaml | 6 +- src/schemas/elements/sprite.computed.yaml | 6 +- src/schemas/elements/sprite.element.yaml | 6 +- src/schemas/elements/text.computed.yaml | 6 +- src/schemas/elements/text.element.yaml | 6 +- src/schemas/elements/video.computed.yaml | 6 +- src/schemas/elements/video.element.yaml | 8 +- src/types.js | 2 +- src/util/normalizeVolume.js | 2 + tasks/TASK/000/TASK-015.md | 3 +- 35 files changed, 516 insertions(+), 229 deletions(-) create mode 100644 src/util/normalizeVolume.js diff --git a/package.json b/package.json index e2d0a51f..9a112dd0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "route-graphics", - "version": "1.7.4", + "version": "1.7.5", "description": "A 2D graphics rendering interface that takes JSON input and renders pixels using PixiJS", "main": "dist/RouteGraphics.js", "type": "module", diff --git a/playground/pages/docs/nodes/rect.md b/playground/pages/docs/nodes/rect.md index 760e003a..ed5b962f 100644 --- a/playground/pages/docs/nodes/rect.md +++ b/playground/pages/docs/nodes/rect.md @@ -89,7 +89,7 @@ elements: action: panelHover click: soundSrc: click-sfx - soundVolume: 900 + soundVolume: 90 payload: action: panelClick rightClick: diff --git a/playground/pages/docs/nodes/sound.md b/playground/pages/docs/nodes/sound.md index 295a839d..8706b500 100644 --- a/playground/pages/docs/nodes/sound.md +++ b/playground/pages/docs/nodes/sound.md @@ -20,7 +20,7 @@ Try it in the [Playground](/playground/?template=sound-demo). | `id` | string | Yes | - | Audio id. | | `type` | string | Yes | - | Must be `sound`. | | `src` | string | Yes | - | Audio source alias/URL. | -| `volume` | number | No | `800` | Runtime maps to `volume / 1000`; can exceed `1000`. | +| `volume` | number | No | `80` | Runtime maps to `volume / 100`. | | `loop` | boolean | No | `false` | Loop playback. | | `delay` | number | No | `0` | Delay in ms before adding to audio stage. | @@ -46,7 +46,7 @@ audio: - id: bgm-main type: sound src: bgm-1 - volume: 700 + volume: 70 loop: true ``` @@ -58,5 +58,5 @@ audio: type: sound src: sfx-announce delay: 1200 - volume: 900 + volume: 90 ``` diff --git a/playground/pages/docs/nodes/sprite.md b/playground/pages/docs/nodes/sprite.md index 1cb86a6b..86213c7a 100644 --- a/playground/pages/docs/nodes/sprite.md +++ b/playground/pages/docs/nodes/sprite.md @@ -72,7 +72,7 @@ elements: click: src: fighter-pressed soundSrc: click-sfx - soundVolume: 900 + soundVolume: 90 payload: action: selectHero rightClick: diff --git a/playground/pages/docs/nodes/text.md b/playground/pages/docs/nodes/text.md index 0d56d01a..23719baf 100644 --- a/playground/pages/docs/nodes/text.md +++ b/playground/pages/docs/nodes/text.md @@ -96,7 +96,7 @@ elements: target: start click: soundSrc: click-sfx - soundVolume: 850 + soundVolume: 85 textStyle: fill: "#66ff99" payload: diff --git a/playground/pages/docs/nodes/video.md b/playground/pages/docs/nodes/video.md index 653e69a4..e0583eee 100644 --- a/playground/pages/docs/nodes/video.md +++ b/playground/pages/docs/nodes/video.md @@ -27,7 +27,7 @@ Try it in the [Playground](/playground/?template=video-demo). | `anchorX` | number | No | `0` | Anchor offset ratio. | | `anchorY` | number | No | `0` | Anchor offset ratio. | | `alpha` | number | No | `1` | Opacity `0..1`. | -| `volume` | number | No | `1000` | Runtime uses `volume / 1000`. | +| `volume` | number | No | `100` | Runtime uses `volume / 100`. | | `loop` | boolean | No | `false` | Replay video on end. | ## Behavior Notes @@ -61,7 +61,7 @@ elements: height: 720 src: background-loop.mp4 loop: true - volume: 200 + volume: 20 alpha: 0.9 ``` @@ -76,7 +76,7 @@ elements: width: 1120 height: 630 src: chapter-1.mp4 - volume: 700 + volume: 70 animations: - id: cutscene-fade diff --git a/playground/static/RouteGraphics.js b/playground/static/RouteGraphics.js index 100e5497..998b1b66 100644 --- a/playground/static/RouteGraphics.js +++ b/playground/static/RouteGraphics.js @@ -1,9 +1,9 @@ -var QI=Object.create;var gf=Object.defineProperty;var JI=Object.getOwnPropertyDescriptor;var tB=Object.getOwnPropertyNames;var eB=Object.getPrototypeOf,rB=Object.prototype.hasOwnProperty;var x=(r,t)=>()=>(r&&(t=r(r=0)),t);var J=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),jy=(r,t)=>{for(var e in t)gf(r,e,{get:t[e],enumerable:!0})},iB=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of tB(t))!rB.call(r,s)&&s!==e&&gf(r,s,{get:()=>t[s],enumerable:!(i=JI(t,s))||i.enumerable});return r};var qi=(r,t,e)=>(e=r!=null?QI(eB(r)):{},iB(t||!r||!r.__esModule?gf(e,"default",{value:r,enumerable:!0}):e,r));var v,xf,Cn,L,B=x(()=>{"use strict";v=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(v||{}),xf=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Cn=(r,t)=>xf(r).priority??t,L={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(xf).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(xf).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(o=>o.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((o,n)=>Cn(n.value,e)-Cn(o.value,e)))},i=>{let s=t.findIndex(o=>o.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>Cn(o,e)-Cn(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})},mixin(r,...t){for(let e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}}});var qy=J((pD,yf)=>{"use strict";var oB=Object.prototype.hasOwnProperty,Ie="~";function Rn(){}Object.create&&(Rn.prototype=Object.create(null),new Rn().__proto__||(Ie=!1));function nB(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function Yy(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new nB(e,i||r,s),n=Ie?Ie+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Bh(r,t){--r._eventsCount===0?r._events=new Rn:delete r._events[t]}function Ee(){this._events=new Rn,this._eventsCount=0}Ee.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)oB.call(e,i)&&t.push(Ie?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Ee.prototype.listeners=function(t){var e=Ie?Ie+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s{Ky=qi(qy(),1),It=Ky.default});var aB,Qr,me,sr,s_,Zy,_f,lB,Fh,o_,n_,Qy,Jy,t_,Mn,hB,cB,uB,dB,Tf,e_,fB,bf,vf,r_,Sf,je,i_,kh,wf=x(()=>{aB={grad:.9,turn:360,rad:360/(2*Math.PI)},Qr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},me=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},sr=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},s_=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Zy=function(r){return{r:sr(r.r,0,255),g:sr(r.g,0,255),b:sr(r.b,0,255),a:sr(r.a)}},_f=function(r){return{r:me(r.r),g:me(r.g),b:me(r.b),a:me(r.a,3)}},lB=/^#([0-9a-f]{3,8})$/i,Fh=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},o_=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=Math.max(t,e,i),n=o-Math.min(t,e,i),a=n?o===t?(e-i)/n:o===e?2+(i-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},n_=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var o=Math.floor(t),n=i*(1-e),a=i*(1-(t-o)*e),l=i*(1-(1-t+o)*e),h=o%6;return{r:255*[i,a,n,n,l,i][h],g:255*[l,i,i,a,n,n][h],b:255*[n,n,l,i,i,a][h],a:s}},Qy=function(r){return{h:s_(r.h),s:sr(r.s,0,100),l:sr(r.l,0,100),a:sr(r.a)}},Jy=function(r){return{h:me(r.h),s:me(r.s),l:me(r.l),a:me(r.a,3)}},t_=function(r){return n_((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Mn=function(r){return{h:(t=o_(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},hB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,cB=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,uB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,dB=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Tf={string:[[function(r){var t=lB.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?me(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?me(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=uB.exec(r)||dB.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Zy({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=hB.exec(r)||cB.exec(r);if(!t)return null;var e,i,s=Qy({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(aB[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return t_(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return Qr(t)&&Qr(e)&&Qr(i)?Zy({r:Number(t),g:Number(e),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!Qr(t)||!Qr(e)||!Qr(i))return null;var n=Qy({h:Number(t),s:Number(e),l:Number(i),a:Number(o)});return t_(n)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!Qr(t)||!Qr(e)||!Qr(i))return null;var n=function(a){return{h:s_(a.h),s:sr(a.s,0,100),v:sr(a.v,0,100),a:sr(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(o)});return n_(n)},"hsv"]]},e_=function(r,t){for(var e=0;e=.5},r.prototype.toHex=function(){return t=_f(this.rgba),e=t.r,i=t.g,s=t.b,n=(o=t.a)<1?Fh(me(255*o)):"","#"+Fh(e)+Fh(i)+Fh(s)+n;var t,e,i,s,o,n},r.prototype.toRgb=function(){return _f(this.rgba)},r.prototype.toRgbString=function(){return t=_f(this.rgba),e=t.r,i=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+i+", "+s+", "+o+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,o},r.prototype.toHsl=function(){return Jy(Mn(this.rgba))},r.prototype.toHslString=function(){return t=Jy(Mn(this.rgba)),e=t.h,i=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+o+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,o},r.prototype.toHsv=function(){return t=o_(this.rgba),{h:me(t.h),s:me(t.s),v:me(t.v),a:me(t.a,3)};var t},r.prototype.invert=function(){return je({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),je(bf(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),je(bf(this.rgba,-t))},r.prototype.grayscale=function(){return je(bf(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),je(r_(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),je(r_(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?je({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):me(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Mn(this.rgba);return typeof t=="number"?je({h:t,s:e.s,l:e.l,a:e.a}):me(e.h)},r.prototype.isEqual=function(t){return this.toHex()===je(t).toHex()},r}(),je=function(r){return r instanceof Sf?r:new Sf(r)},i_=[],kh=function(r){r.forEach(function(t){i_.indexOf(t)<0&&(t(Sf,Tf),i_.push(t))})}});function Gh(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,h=i[this.toHex()];if(h)return h;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new r(e[f]).toRgb();for(var m in e){var g=(a=c,l=o[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));g{});var Ws,nt,be=x(()=>{wf();Ef();kh([Gh]);Ws=class In{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof In)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=In._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=In.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=je(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof In||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Ws.shared=new Ws;Ws._temp=new Ws;Ws.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;nt=Ws});var a_,l_=x(()=>{"use strict";a_={cullArea:null,cullable:!1,cullableChildren:!0}});var h_,c_,u_,Af=x(()=>{"use strict";h_=Math.PI*2,c_=180/Math.PI,u_=Math.PI/180});var dt,Pf,or=x(()=>{"use strict";dt=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Pf.x=0,Pf.y=0,Pf}},Pf=new dt});var k,pB,mB,gt=x(()=>{Af();or();k=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new dt;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new dt;let i=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,h=1/(i*n+o*-s),c=t.x,u=t.y;return e.x=n*h*c+-o*h*u+(l*o-a*n)*h,e.y=i*h*u+-s*h*c+(-l*i+a*s)*h,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}appendFrom(t,e){let i=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,l=t.ty,h=e.a,c=e.b,u=e.c,d=e.d;return this.a=i*h+s*u,this.b=i*c+s*d,this.c=o*h+n*u,this.d=o*c+n*d,this.tx=a*h+l*u+e.tx,this.ty=a*c+l*d+e.ty,this}setTransform(t,e,i,s,o,n,a,l,h){return this.a=Math.cos(a+h)*o,this.b=Math.sin(a+h)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(h_-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return mB.identity()}static get shared(){return pB.identity()}},pB=new k,mB=new k});var ve,Uh=x(()=>{"use strict";ve=class r{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new r(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function ut(r="default"){return Cf[r]===void 0&&(Cf[r]=-1),++Cf[r]}var Cf,Te=x(()=>{"use strict";Cf={default:-1}});function j(r,t,e=3){if(d_[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t} +var XF=Object.create;var Fp=Object.defineProperty;var jF=Object.getOwnPropertyDescriptor;var YF=Object.getOwnPropertyNames;var qF=Object.getPrototypeOf,KF=Object.prototype.hasOwnProperty;var y=(r,e)=>()=>(r&&(e=r(r=0)),e);var ee=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ub=(r,e)=>{for(var t in e)Fp(r,t,{get:e[t],enumerable:!0})},ZF=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of YF(e))!KF.call(r,s)&&s!==t&&Fp(r,s,{get:()=>e[s],enumerable:!(i=jF(e,s))||i.enumerable});return r};var fs=(r,e,t)=>(t=r!=null?XF(qF(r)):{},ZF(e||!r||!r.__esModule?Fp(t,"default",{value:r,enumerable:!0}):t,r));var S,Op,Su,V,U=y(()=>{"use strict";S=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(S||{}),Op=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Su=(r,e)=>Op(r).priority??e,V={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Op).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...r){return r.map(Op).forEach(e=>{e.type.forEach(t=>{let i=this._addHandlers,s=this._queue;i[t]?i[t]?.(e):(s[t]=s[t]||[],s[t]?.push(e))})}),this},handle(r,e,t){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=e,s[r]=t;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>e(n)),delete o[r]),this},handleByMap(r,e){return this.handle(r,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByNamedList(r,e,t=-1){return this.handle(r,i=>{e.findIndex(o=>o.name===i.name)>=0||(e.push({name:i.name,value:i.ref}),e.sort((o,n)=>Su(n.value,t)-Su(o.value,t)))},i=>{let s=e.findIndex(o=>o.name===i.name);s!==-1&&e.splice(s,1)})},handleByList(r,e,t=-1){return this.handle(r,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,o)=>Su(o,t)-Su(s,t)))},i=>{let s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})},mixin(r,...e){for(let t of e)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(t))}}});var Lb=ee((e4,Up)=>{"use strict";var JF=Object.prototype.hasOwnProperty,Ut="~";function fa(){}Object.create&&(fa.prototype=Object.create(null),new fa().__proto__||(Ut=!1));function e2(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function Gb(r,e,t,i,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new e2(t,i||r,s),n=Ut?Ut+e:e;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function wu(r,e){--r._eventsCount===0?r._events=new fa:delete r._events[e]}function Ct(){this._events=new fa,this._eventsCount=0}Ct.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)JF.call(t,i)&&e.push(Ut?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Ct.prototype.listeners=function(e){var t=Ut?Ut+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s{Db=fs(Lb(),1),Ce=Db.default});var t2,ui,mt,dr,jb,Nb,Gp,r2,Eu,Yb,qb,Hb,Vb,Wb,pa,i2,s2,o2,n2,Np,zb,a2,Lp,Dp,$b,Hp,Jt,Xb,Au,Vp=y(()=>{t2={grad:.9,turn:360,rad:360/(2*Math.PI)},ui=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},mt=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*r)/t+0},dr=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),r>t?t:r>e?r:e},jb=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Nb=function(r){return{r:dr(r.r,0,255),g:dr(r.g,0,255),b:dr(r.b,0,255),a:dr(r.a)}},Gp=function(r){return{r:mt(r.r),g:mt(r.g),b:mt(r.b),a:mt(r.a,3)}},r2=/^#([0-9a-f]{3,8})$/i,Eu=function(r){var e=r.toString(16);return e.length<2?"0"+e:e},Yb=function(r){var e=r.r,t=r.g,i=r.b,s=r.a,o=Math.max(e,t,i),n=o-Math.min(e,t,i),a=n?o===e?(t-i)/n:o===t?2+(i-e)/n:4+(e-t)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},qb=function(r){var e=r.h,t=r.s,i=r.v,s=r.a;e=e/360*6,t/=100,i/=100;var o=Math.floor(e),n=i*(1-t),a=i*(1-(e-o)*t),l=i*(1-(1-e+o)*t),c=o%6;return{r:255*[i,a,n,n,l,i][c],g:255*[l,i,i,a,n,n][c],b:255*[n,n,l,i,i,a][c],a:s}},Hb=function(r){return{h:jb(r.h),s:dr(r.s,0,100),l:dr(r.l,0,100),a:dr(r.a)}},Vb=function(r){return{h:mt(r.h),s:mt(r.s),l:mt(r.l),a:mt(r.a,3)}},Wb=function(r){return qb((t=(e=r).s,{h:e.h,s:(t*=((i=e.l)<50?i:100-i)/100)>0?2*t/(i+t)*100:0,v:i+t,a:e.a}));var e,t,i},pa=function(r){return{h:(e=Yb(r)).h,s:(s=(200-(t=e.s))*(i=e.v)/100)>0&&s<200?t*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,t,i,s},i2=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,s2=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,o2=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,n2=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Np={string:[[function(r){var e=r2.exec(r);return e?(r=e[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?mt(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?mt(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var e=o2.exec(r)||n2.exec(r);return e?e[2]!==e[4]||e[4]!==e[6]?null:Nb({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(r){var e=i2.exec(r)||s2.exec(r);if(!e)return null;var t,i,s=Hb({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(t2[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Wb(s)},"hsl"]],object:[[function(r){var e=r.r,t=r.g,i=r.b,s=r.a,o=s===void 0?1:s;return ui(e)&&ui(t)&&ui(i)?Nb({r:Number(e),g:Number(t),b:Number(i),a:Number(o)}):null},"rgb"],[function(r){var e=r.h,t=r.s,i=r.l,s=r.a,o=s===void 0?1:s;if(!ui(e)||!ui(t)||!ui(i))return null;var n=Hb({h:Number(e),s:Number(t),l:Number(i),a:Number(o)});return Wb(n)},"hsl"],[function(r){var e=r.h,t=r.s,i=r.v,s=r.a,o=s===void 0?1:s;if(!ui(e)||!ui(t)||!ui(i))return null;var n=function(a){return{h:jb(a.h),s:dr(a.s,0,100),v:dr(a.v,0,100),a:dr(a.a)}}({h:Number(e),s:Number(t),v:Number(i),a:Number(o)});return qb(n)},"hsv"]]},zb=function(r,e){for(var t=0;t=.5},r.prototype.toHex=function(){return e=Gp(this.rgba),t=e.r,i=e.g,s=e.b,n=(o=e.a)<1?Eu(mt(255*o)):"","#"+Eu(t)+Eu(i)+Eu(s)+n;var e,t,i,s,o,n},r.prototype.toRgb=function(){return Gp(this.rgba)},r.prototype.toRgbString=function(){return e=Gp(this.rgba),t=e.r,i=e.g,s=e.b,(o=e.a)<1?"rgba("+t+", "+i+", "+s+", "+o+")":"rgb("+t+", "+i+", "+s+")";var e,t,i,s,o},r.prototype.toHsl=function(){return Vb(pa(this.rgba))},r.prototype.toHslString=function(){return e=Vb(pa(this.rgba)),t=e.h,i=e.s,s=e.l,(o=e.a)<1?"hsla("+t+", "+i+"%, "+s+"%, "+o+")":"hsl("+t+", "+i+"%, "+s+"%)";var e,t,i,s,o},r.prototype.toHsv=function(){return e=Yb(this.rgba),{h:mt(e.h),s:mt(e.s),v:mt(e.v),a:mt(e.a,3)};var e},r.prototype.invert=function(){return Jt({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},r.prototype.saturate=function(e){return e===void 0&&(e=.1),Jt(Lp(this.rgba,e))},r.prototype.desaturate=function(e){return e===void 0&&(e=.1),Jt(Lp(this.rgba,-e))},r.prototype.grayscale=function(){return Jt(Lp(this.rgba,-1))},r.prototype.lighten=function(e){return e===void 0&&(e=.1),Jt($b(this.rgba,e))},r.prototype.darken=function(e){return e===void 0&&(e=.1),Jt($b(this.rgba,-e))},r.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},r.prototype.alpha=function(e){return typeof e=="number"?Jt({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):mt(this.rgba.a,3);var t},r.prototype.hue=function(e){var t=pa(this.rgba);return typeof e=="number"?Jt({h:e,s:t.s,l:t.l,a:t.a}):mt(t.h)},r.prototype.isEqual=function(e){return this.toHex()===Jt(e).toHex()},r}(),Jt=function(r){return r instanceof Hp?r:new Hp(r)},Xb=[],Au=function(r){r.forEach(function(e){Xb.indexOf(e)<0&&(e(Hp,Np),Xb.push(e))})}});function Pu(r,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in t)i[t[s]]=s;var o={};r.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=i[this.toHex()];if(c)return c;if(n?.closest){var u=this.toRgb(),h=1/0,d="black";if(!o.length)for(var f in t)o[f]=new r(t[f]).toRgb();for(var p in t){var m=(a=u,l=o[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));m{});var po,oe,Tt=y(()=>{Vp();Wp();Au([Pu]);po=class ma{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof ma)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,t){let i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((o,n)=>o===t[n]);if(e!==null&&t!==null){let o=Object.keys(e),n=Object.keys(t);return o.length!==n.length?!1:o.every(a=>e[a]===t[a])}return e===t}toRgba(){let[e,t,i,s]=this._components;return{r:e,g:t,b:i,a:s}}toRgb(){let[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){let[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){let[t,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(t*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);let[t,i,s,o]=this._components;return e[0]=t,e[1]=i,e[2]=s,e[3]=o,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);let[t,i,s]=this._components;return e[0]=t,e[1]=i,e[2]=s,e}toNumber(){return this._int}toBgrNumber(){let[e,t,i]=this.toUint8RgbArray();return(i<<16)+(t<<8)+e}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[t,i,s,o]=ma._temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return t&&(i=i*e+.5|0,s=s*e+.5|0,o=o*e+.5|0),(e*255<<24)+(i<<16)+(s<<8)+o}toHex(){let e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(e){return this._components[3]=this._clamp(e),this}_normalize(e){let t,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;t=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,i,s,o=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[t,i,s,o=255]=e,t/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=ma.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=Jt(e);n.isValid()&&({r:t,g:i,b:s,a:o}=n.rgba,t/=255,i/=255,s/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=i,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);let[e,t,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,t),i)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof ma||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}};po.shared=new po;po._temp=new po;po.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;oe=po});var Kb,Zb=y(()=>{"use strict";Kb={cullArea:null,cullable:!1,cullableChildren:!0}});var Qb,Jb,ev,zp=y(()=>{"use strict";Qb=Math.PI*2,Jb=180/Math.PI,ev=Math.PI/180});var de,$p,fr=y(()=>{"use strict";de=class r{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new r(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return $p.x=0,$p.y=0,$p}},$p=new de});var G,l2,c2,ge=y(()=>{zp();fr();G=class r{constructor(e=1,t=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,i,s,o,n){return this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,t){this.array||(this.array=new Float32Array(9));let i=t||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(e,t){t=t||new de;let i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new de;let i=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,l=this.ty,c=1/(i*n+o*-s),u=e.x,h=e.y;return t.x=n*c*u+-o*c*h+(l*o-a*n)*c,t.y=i*c*h+-s*c*u+(-l*i+a*s)*c,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*t-this.b*i,this.b=s*i+this.b*t,this.c=o*t-this.d*i,this.d=o*i+this.d*t,this.tx=n*t-this.ty*i,this.ty=n*i+this.ty*t,this}append(e){let t=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}appendFrom(e,t){let i=e.a,s=e.b,o=e.c,n=e.d,a=e.tx,l=e.ty,c=t.a,u=t.b,h=t.c,d=t.d;return this.a=i*c+s*h,this.b=i*u+s*d,this.c=o*c+n*h,this.d=o*u+n*d,this.tx=a*c+l*h+t.tx,this.ty=a*u+l*d+t.ty,this}setTransform(e,t,i,s,o,n,a,l,c){return this.a=Math.cos(a+c)*o,this.b=Math.sin(a+c)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=e-(i*this.a+s*this.c),this.ty=t-(i*this.b+s*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,t),c=Math.abs(a+l);return c<1e-5||Math.abs(Qb-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*t+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,t=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-t*i;return this.a=s/n,this.b=-t/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-t*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return c2.identity()}static get shared(){return l2.identity()}},l2=new G,c2=new G});var St,Cu=y(()=>{"use strict";St=class r{constructor(e,t,i){this._x=t||0,this._y=i||0,this._observer=e}clone(e){return new r(e??this._observer,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}});function he(r="default"){return Xp[r]===void 0&&(Xp[r]=-1),++Xp[r]}var Xp,wt=y(()=>{"use strict";Xp={default:-1}});function X(r,e,t=3){if(tv[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} Deprecated since v${r}`):(i=i.split(` -`).splice(e).join(` -`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} -Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} -Deprecated since v${r}`),console.warn(i))),d_[t]=!0}var d_,it,f_,zt=x(()=>{"use strict";d_={},it="8.0.0",f_="8.3.4"});var Ki,Rf=x(()=>{"use strict";Ki=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var Mf,st,Be=x(()=>{Rf();Mf=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new Ki(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},st=new Mf});var p_,m_=x(()=>{zt();p_={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){j("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function Oh(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s{"use strict"});var g_,x_=x(()=>{If();zt();g_={allowChildren:!0,removeChildren(r=0,t){let e=t??this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let n=e-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Oh(this.children,r,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n0&&this._didViewChangeTick++,s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){let t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){this.allowChildren||j(it,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;let e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;let e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);let i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}}});var y_,__=x(()=>{"use strict";y_={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){let i=this.children,s=i.length;for(let o=0;o=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var Jr,Lh=x(()=>{"use strict";Jr=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t{B();Be();Bf=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e{Lh();b_();v_={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let t=this._maskEffect;t?.mask!==r&&(t&&(this.removeEffect(t),Dh.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=Dh.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let t=this._filterEffect||(this._filterEffect=new Jr);r=r;let e=r?.length>0,i=t.filters?.length>0,s=e!==i;r=Array.isArray(r)?r.slice(0):r,t.filters=Object.freeze(r),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new Jr),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var S_,w_=x(()=>{zt();S_={label:null,get name(){return j(it,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){j(it,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){let e=this.children;for(let i=0;i{or();Nh=[new dt,new dt,new dt,new dt],ot=class r{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&e=u&&t<=d&&e>=f&&e<=m&&!(t>g&&tb&&et.right?t.right:this.right)<=C)return!1;let P=this.yt.bottom?t.bottom:this.bottom)>P}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Nh[0].set(t.left,t.top),l=Nh[1].set(t.left,t.bottom),h=Nh[2].set(t.right,t.top),c=Nh[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=o||Math.min(a.y,l.y,h.y,c.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),m=d*i+f*o,g=d*s+f*o,p=d*i+f*n,b=d*s+f*n;if(Math.max(m,g,p,b)<=d*a.x+f*a.y||Math.min(m,g,p,b)>=d*c.x+f*c.y)return!1;let y=u*(a.y-h.y),_=u*(h.x-a.x),S=y*i+_*o,E=y*s+_*o,w=y*i+_*n,T=y*s+_*n;return!(Math.max(S,E,w,T)<=y*a.x+_*a.y||Math.min(S,E,w,T)>=y*c.x+_*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new r),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,i=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e=this.y&&i=this.x&&s=this.y&&o{gt();ae();E_=new k,At=class r{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=E_,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new ot);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=E_,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,h=o.d,c=o.tx,u=o.ty,d=this.minX,f=this.minY,m=this.maxX,g=this.maxY,p=n*t+l*e+c,b=a*t+h*e+u;pm&&(m=p),b>g&&(g=b),p=n*i+l*e+c,b=a*i+h*e+u,pm&&(m=p),b>g&&(g=b),p=n*t+l*s+c,b=a*t+h*s+u,pm&&(m=p),b>g&&(g=b),p=n*i+l*s+c,b=a*i+h*s+u,pm&&(m=p),b>g&&(g=b),this.minX=d,this.minY=f,this.maxX=m,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxXthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+l*o+c,f=a*e+h*o+u,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+l*o+c,f=a*s+h*o+u,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minXt.right&&(this.maxX=t.right),this.minYt.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,s){return this.minXe&&(this.maxX=e),this.minYs&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new r(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let h=s.a,c=s.b,u=s.c,d=s.d,f=s.tx,m=s.ty;for(let g=e;ga?y:a,l=_>l?_:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}});var ee,Ye,Zi=x(()=>{gt();Rf();Ne();ee=new Ki(k),Ye=new Ki(At)});var gB,A_,P_=x(()=>{gt();Ne();Zi();gB=new k,A_={getFastGlobalBounds(r,t){t||(t=new At),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=Ye.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n{gt();Zi()});function Vh(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;let e=r>>16&255,i=r>>8&255,s=r&255,o=t>>16&255,n=t>>8&255,a=t&255,l=e*o/255|0,h=i*n/255|0,c=s*a/255|0;return(l<<16)+(h<<8)+c}var Ff=x(()=>{"use strict"});function $s(r,t){return r===R_?t:t===R_?r:Vh(r,t)}var R_,kf=x(()=>{Ff();R_=16777215});function Fn(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var M_,I_=x(()=>{Bn();Zi();kf();M_={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let e=Hh(this,ee.get().identity());return r.appendFrom(this.localTransform,e),ee.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?Fn(this.renderGroup.worldColor):this.parentRenderGroup?Fn($s(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=$s(t,e.localColor),e=e.parent;return Fn(t)}}});function N(...r){Gf!==B_&&(Gf++,Gf===B_?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Gf,B_,Pt=x(()=>{"use strict";Gf=0,B_=500});function Xs(r,t,e){return t.clear(),e||(e=k.IDENTITY),F_(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function F_(r,t,e,i,s){let o;if(s)o=ee.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=ee.get(),o.appendFrom(l,e)}let n=t,a=!!r.effects.length;if(a&&(t=Ye.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,t.addBounds(r.bounds));let l=r.children;for(let h=0;h{gt();Zi()});function Uf(r,t){let e=r.children;for(let i=0;i{"use strict"});var xB,G_,U_=x(()=>{gt();Ne();Bn();Wh();k_();xB=new k,G_={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new At});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),Uf(this,r),r.didChange&&Xs(this,r.localBounds,xB),r.localBounds},getBounds(r,t){return zs(this,r,t||new At)}}});var O_,L_=x(()=>{"use strict";O_={_onRender:null,set onRender(r){let t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function yB(r,t){return r._zIndex-t._zIndex}var D_,N_=x(()=>{"use strict";D_={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(yB))}}});var H_,V_=x(()=>{or();Zi();H_={getGlobalPosition(r=new dt,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){let i=this.getGlobalTransform(ee.get(),e);return t=i.apply(r,t),ee.return(i),t},toLocal(r,t,e,i){t&&(r=t.toGlobal(r,e,i));let s=this.getGlobalTransform(ee.get(),i);return e=s.applyInverse(r,e),ee.return(s),e}}});var js,Of=x(()=>{Te();js=class{constructor(){this.uid=ut("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function ti(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Lf(r){return!(r&r-1)&&!!r}var kn=x(()=>{"use strict"});function zh(r){let t={};for(let e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var Df=x(()=>{"use strict"});function _B(r){let t=W_[r];return t===void 0&&(W_[r]=ut("resource")),t}var W_,z_,$h,Nf=x(()=>{Ae();Te();zt();W_=Object.create(null);z_=class $_ extends It{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...$_.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){j(it,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=_B(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};z_.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};$h=z_});var X_,wt,He=x(()=>{Ae();kn();Df();Te();Nf();X_=class j_ extends It{constructor(t={}){super(),this.options=t,this.uid=ut("textureSource"),this._resourceType="textureSource",this._resourceId=ut("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...j_.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new $h(zh(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=ut("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*i),o=Math.round(e*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=ut("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Lf(this.pixelWidth)&&Lf(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};X_.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};wt=X_});function bB(){for(let r=0;r<16;r++){let t=[];Hf.push(t);for(let e=0;e<16;e++){let i=Xh(Qi[r]*Qi[e]+ts[r]*Ji[e]),s=Xh(Ji[r]*Qi[e]+es[r]*Ji[e]),o=Xh(Qi[r]*ts[e]+ts[r]*es[e]),n=Xh(Ji[r]*ts[e]+es[r]*es[e]);for(let a=0;a<16;a++)if(Qi[a]===i&&Ji[a]===s&&ts[a]===o&&es[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new k;t.set(Qi[r],Ji[r],ts[r],es[r],0,0),Y_.push(t)}}var Qi,Ji,ts,es,Hf,Y_,Xh,Dt,q_=x(()=>{gt();Qi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ji=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ts=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],es=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Hf=[],Y_=[],Xh=Math.sign;bB();Dt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Qi[r],uY:r=>Ji[r],vX:r=>ts[r],vY:r=>es[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Hf[r][t],sub:(r,t)=>Hf[r][Dt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Dt.S:Dt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Dt.E:Dt.W:t>0?r>0?Dt.SE:Dt.SW:r>0?Dt.NE:Dt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=Y_[Dt.inv(t)];s.tx=e,s.ty=i,r.append(s)}}});var Vf,K_=x(()=>{"use strict";Vf=()=>{}});var rs,Wf=x(()=>{B();He();rs=class extends wt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};rs.extension=v.TextureSource});var Z_,Ys,zf=x(()=>{gt();Z_=new k,Ys=class{constructor(t,e){this.mapCoord=new k,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s{Ae();q_();ae();Te();zt();K_();Wf();He();zf();M=class extends It{constructor({source:t,label:e,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:h}={}){if(super(),this.uid=ut("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new ot,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new wt,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=h||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Ys(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:s}=this._source,o=e.x/i,n=e.y/s,a=e.width/i,l=e.height/s,h=this.rotate;if(h){let c=a/2,u=l/2,d=o+c,f=n+u;h=Dt.add(h,Dt.NW),t.x0=d+c*Dt.uX(h),t.y0=f+u*Dt.uY(h),h=Dt.add(h,2),t.x1=d+c*Dt.uX(h),t.y1=f+u*Dt.uY(h),h=Dt.add(h,2),t.x2=d+c*Dt.uX(h),t.y2=f+u*Dt.uY(h),h=Dt.add(h,2),t.x3=d+c*Dt.uX(h),t.y3=f+u*Dt.uY(h)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+l,t.x3=o,t.y3=n+l}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return j(it,"Texture.baseTexture is now Texture.source"),this._source}};M.EMPTY=new M({label:"EMPTY",source:new wt({label:"EMPTY"})});M.EMPTY.destroy=Vf;M.WHITE=new M({source:new rs({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});M.WHITE.destroy=Vf});var vB,$f,$t,Si=x(()=>{kn();He();vt();vB=0,$f=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let s=new wt({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1});return new M({source:s,label:`texturePool_${vB++}`})}getOptimalTexture(t,e,i=1,s){let o=Math.ceil(t*i-1e-6),n=Math.ceil(e*i-1e-6);o=ti(o),n=ti(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=i,l.source.width=o/i,l.source.height=n/i,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=!1){let i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let i=this._texturePool[e];if(i)for(let s=0;s{gt();Of();Si();jh=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new k,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new js,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let i=0;i-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let i=0;i0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e{"use strict"});var Xf,jf,Yf,qs,Gn,is,at,yr=x(()=>{Ae();be();l_();B();gt();Af();Uh();Te();zt();Be();m_();x_();__();T_();w_();P_();I_();U_();L_();N_();V_();Q_();tb();Xf=new ve(null),jf=new ve(null),Yf=new ve(null,1,1),qs=1,Gn=2,is=4,at=class r extends It{constructor(t={}){super(),this.uid=ut("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new k,this.relativeGroupTransform=new k,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new ve(this,0,0),this._scale=Yf,this._pivot=jf,this._skew=Xf,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],J_(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){j("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),L.mixin(r,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||j(it,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s1){for(let s=0;s-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=st.get(jh,this),this.groupTransform=k.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),st.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new k),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*c_}set angle(t){this.rotation=t*u_}get pivot(){return this._pivot===jf&&(this._pivot=new ve(this,0,0)),this._pivot}set pivot(t){this._pivot===jf&&(this._pivot=new ve(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Xf&&(this._skew=new ve(this,0,0)),this._skew}set skew(t){this._skew===Xf&&(this._skew=new ve(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Yf&&(this._scale=new ve(this,1,1)),this._scale}set scale(t){this._scale===Yf&&(this._scale=new ve(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,h=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(l*e.a+h*e.c),e.ty=o._y-(l*e.b+h*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=qs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let i=nt.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=qs,this._onUpdate())}get tint(){return Fn(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Gn,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=is,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=is,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=is,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s{or();wi=class r{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new dt,this.page=new dt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function TB(r){return function(t){return t.test(r)}}function Ei(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=TB(e),o={apple:{phone:s(qf)&&!s(ei),ipod:s(eb),tablet:!s(qf)&&(s(rb)||ub(t))&&!s(ei),universal:s(ib),device:(s(qf)||s(eb)||s(rb)||s(ib)||ub(t))&&!s(ei)},amazon:{phone:s(Ks),tablet:!s(Ks)&&s(qh),device:s(Ks)||s(qh)},android:{phone:!s(ei)&&s(Ks)||!s(ei)&&s(Kf),tablet:!s(ei)&&!s(Ks)&&!s(Kf)&&(s(qh)||s(sb)),device:!s(ei)&&(s(Ks)||s(qh)||s(Kf)||s(sb))||s(/\bokhttp\b/i)},windows:{phone:s(ei),tablet:s(ob),device:s(ei)||s(ob)},other:{blackberry:s(nb),blackberry10:s(ab),opera:s(lb),firefox:s(cb),chrome:s(hb),device:s(nb)||s(ab)||s(lb)||s(cb)||s(hb)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var qf,eb,rb,ib,Kf,sb,Ks,qh,ei,ob,nb,ab,lb,hb,cb,ub,Zf=x(()=>{qf=/iPhone/i,eb=/iPod/i,rb=/iPad/i,ib=/\biOS-universal(?:.+)Mac\b/i,Kf=/\bAndroid(?:.+)Mobile\b/i,sb=/Android/i,Ks=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,qh=/Silk/i,ei=/Windows Phone/i,ob=/\bWindows(?:.+)ARM\b/i,nb=/BlackBerry/i,ab=/BB10/i,lb=/Opera Mini/i,hb=/\b(CriOS|Chrome)(?:.+)Mobile/i,cb=/Mobile(?:.+)Firefox\b/i,ub=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var Qf=x(()=>{Zf();Zf()});var SB,db,fb=x(()=>{Qf();SB=Ei.default??Ei,db=SB(globalThis.navigator)});var wB,Kh,EB,AB,pb,mb,PB,CB,RB,Jf,xb,yb=x(()=>{Yh();B();fb();If();wB=9,Kh=100,EB=0,AB=0,pb=2,mb=1,PB=-1e3,CB=-1e3,RB=2,Jf=class gb{constructor(t,e=db){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let t=document.createElement("button");t.style.width=`${mb}px`,t.style.height=`${mb}px`,t.style.position="absolute",t.style.top=`${PB}px`,t.style.left=`${CB}px`,t.style.zIndex=RB.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${Kh}px`,this._div.style.height=`${Kh}px`,this._div.style.position="absolute",this._div.style.top=`${EB}px`,this._div.style.left=`${AB}px`,this._div.style.zIndex=pb.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let i=0;i=0;i--){let s=this._children[i];e.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Oh(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${i}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let i=0;i title : ${t.title}
tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=` +`).splice(t).join(` +`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e} +Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e} +Deprecated since v${r}`),console.warn(i))),tv[e]=!0}var tv,ie,rv,Xe=y(()=>{"use strict";tv={},ie="8.0.0",rv="8.3.4"});var ps,jp=y(()=>{"use strict";ps=class{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t0?t=this._pool[--this._index]:t=new this._classType,t.init?.(e),t}return(e){e.reset?.(),this._pool[this._index++]=e}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var Yp,se,Gt=y(()=>{jp();Yp=class{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new ps(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(t=>{let i=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[i]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}},se=new Yp});var iv,sv=y(()=>{Xe();iv={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function Mu(r,e,t){let i=r.length,s;if(e>=i||t===0)return;t=e+t>i?i-e:t;let o=i-t;for(s=e;s{"use strict"});var ov,nv=y(()=>{qp();Xe();ov={allowChildren:!0,removeChildren(r=0,e){let t=e??this.children.length,i=t-r,s=[];if(i>0&&i<=t){for(let n=t-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Mu(this.children,r,t);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n0&&this._didViewChangeTick++,s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let e=this.getChildAt(r);return this.removeChild(e)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,e)},getChildIndex(r){let e=this.children.indexOf(r);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(r,e){this.allowChildren||X(ie,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:t}=this;if(e<0||e>t.length)throw new Error(`${r}addChildAt: The index ${e} supplied is out of bounds ${t.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===e)return r;s!==-1&&r.parent.children.splice(s,1)}e===t.length?t.push(r):t.splice(e,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,e),r.emit("added",this),r},swapChildren(r,e){if(r===e)return;let t=this.getChildIndex(r),i=this.getChildIndex(e);this.children[t]=e,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(e=>this.reparentChildAt(e,this.children.length)),r[0])},reparentChildAt(r,e){if(r.parent===this)return this.setChildIndex(r,e),r;let t=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,e);let i=this.worldTransform.clone();return i.invert(),t.prepend(i),r.setFromMatrix(t),r}}});var av,lv=y(()=>{"use strict";av={collectRenderables(r,e,t){this.parentRenderLayer&&this.parentRenderLayer!==t||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,e,t):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,e,t))},collectRenderablesSimple(r,e,t){let i=this.children,s=i.length;for(let o=0;o=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var hi,Ru=y(()=>{"use strict";hi=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e{U();Gt();Kp=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t{Ru();cv();uv={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((t,i)=>t.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let e=this.effects.indexOf(r);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let e=this._maskEffect;e?.mask!==r&&(e&&(this.removeEffect(e),Iu.returnMaskEffect(e),this._maskEffect=null),r!=null&&(this._maskEffect=Iu.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let e=this._filterEffect||(this._filterEffect=new hi);r=r;let t=r?.length>0,i=e.filters?.length>0,s=t!==i;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),s&&(t?this.addEffect(e):(this.removeEffect(e),e.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new hi),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var dv,fv=y(()=>{Xe();dv={label:null,get name(){return X(ie,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){X(ie,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,e=!1){return this.getChildByLabel(r,e)},getChildByLabel(r,e=!1){let t=this.children;for(let i=0;i{fr();Bu=[new de,new de,new de,new de],Q=class r{constructor(e=0,t=0,i=0,s=0){this.type="rectangle",this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e=this.y&&t=h&&e<=d&&t>=f&&t<=p&&!(e>m&&e_&&te.right?e.right:this.right)<=I)return!1;let C=this.ye.bottom?e.bottom:this.bottom)>C}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Bu[0].set(e.left,e.top),l=Bu[1].set(e.left,e.bottom),c=Bu[2].set(e.right,e.top),u=Bu[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=i||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;let v=h*(a.y-c.y),x=h*(c.x-a.x),T=v*i+x*o,b=v*s+x*o,w=v*i+x*n,E=v*s+x*n;return!(Math.max(T,b,w,E)<=v*a.x+x*a.y||Math.min(T,b,w,E)>=v*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,t=.001){let i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=s,this.height=o-s,this}getBounds(e){return e||(e=new r),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;let t=e.x,i=e.y,s=e.x+e.width,o=e.y+e.height;return t>=this.x&&t=this.y&&i=this.x&&s=this.y&&o{ge();ut();pv=new G,Ee=class r{constructor(e=1/0,t=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=pv,this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Q);let e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=pv,this}set(e,t,i,s){this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}addFrame(e,t,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,c=o.d,u=o.tx,h=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=n*e+l*t+u,_=a*e+c*t+h;gp&&(p=g),_>m&&(m=_),g=n*i+l*t+u,_=a*i+c*t+h,gp&&(p=g),_>m&&(m=_),g=n*e+l*s+u,_=a*e+c*s+h,gp&&(p=g),_>m&&(m=_),g=n*i+l*s+u,_=a*i+c*s+h,gp&&(p=g),_>m&&(m=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(e,t){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,t)}addBounds(e,t){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,t)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxXthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*t+l*o+u,f=a*t+c*o+h,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+l*o+u,f=a*s+c*o+h,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(e){return this.minXe.right&&(this.maxX=e.right),this.minYe.bottom&&(this.maxY=e.bottom),this}fitBounds(e,t,i,s){return this.minXt&&(this.maxX=t),this.minYs&&(this.maxY=s),this}pad(e,t=e){return this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new r(this.minX,this.minY,this.maxX,this.maxY)}scale(e,t=e){return this.minX*=e,this.minY*=t,this.maxX*=e,this.maxY*=t,this}get x(){return this.minX}set x(e){let t=this.maxX-this.minX;this.minX=e,this.maxX=e+t}get y(){return this.minY}set y(e){let t=this.maxY-this.minY;this.minY=e,this.maxY=e+t}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,t,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let c=s.a,u=s.b,h=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=t;ma?v:a,l=x>l?x:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}containsPoint(e,t){return this.minX<=e&&this.minY<=t&&this.maxX>=e&&this.maxY>=t}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}});var st,er,ms=y(()=>{ge();jp();$t();st=new ps(G),er=new ps(Ee)});var u2,mv,gv=y(()=>{ge();$t();ms();u2=new G,mv={getFastGlobalBounds(r,e){e||(e=new Ee),e.clear(),this._getGlobalBoundsRecursive(!!r,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let t=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(t.worldTransform),e},_getGlobalBoundsRecursive(r,e,t){let i=e;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==t||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=er.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n{ge();ms()});function Fu(r,e){if(r===16777215||!e)return e;if(e===16777215||!r)return r;let t=r>>16&255,i=r>>8&255,s=r&255,o=e>>16&255,n=e>>8&255,a=e&255,l=t*o/255|0,c=i*n/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}var Zp=y(()=>{"use strict"});function go(r,e){return r===yv?e:e===yv?r:Fu(r,e)}var yv,Qp=y(()=>{Zp();yv=16777215});function xa(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var _v,bv=y(()=>{ga();ms();Qp();_v={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,t=this.parent;for(;t;)e*=t.alpha,t=t.parent;return e},getGlobalTransform(r,e){if(e)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let t=ku(this,st.get().identity());return r.appendFrom(this.localTransform,t),st.return(t),r},getGlobalTint(r){if(r)return this.renderGroup?xa(this.renderGroup.worldColor):this.parentRenderGroup?xa(go(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,t=this.parent;for(;t;)e=go(e,t.localColor),t=t.parent;return xa(e)}}});function W(...r){Jp!==vv&&(Jp++,Jp===vv?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Jp,vv,Ae=y(()=>{"use strict";Jp=0,vv=500});function xo(r,e,t){return e.clear(),t||(t=G.IDENTITY),Tv(r,e,t,r,!0),e.isValid||e.set(0,0,0,0),e}function Tv(r,e,t,i,s){let o;if(s)o=st.get(),o=t.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=st.get(),o.appendFrom(l,t)}let n=e,a=!!r.effects.length;if(a&&(e=er.get().clear()),r.boundsArea)e.addRect(r.boundsArea,o);else{r.renderPipeId&&(e.matrix=o,e.addBounds(r.bounds));let l=r.children;for(let c=0;c{ge();ms()});function em(r,e){let t=r.children;for(let i=0;i{"use strict"});var h2,wv,Ev=y(()=>{ge();$t();ga();Ou();Sv();h2=new G,wv={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,e){let t=Math.sign(this.scale.x)||1;e!==0?this.scale.x=r/e*t:this.scale.x=t},_setHeight(r,e){let t=Math.sign(this.scale.y)||1;e!==0?this.scale.y=r/e*t:this.scale.y=t},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Ee});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),em(this,r),r.didChange&&xo(this,r.localBounds,h2),r.localBounds},getBounds(r,e){return mo(this,r,e||new Ee)}}});var Av,Pv=y(()=>{"use strict";Av={_onRender:null,set onRender(r){let e=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function d2(r,e){return r._zIndex-e._zIndex}var Cv,Mv=y(()=>{"use strict";Cv={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(d2))}}});var Rv,Iv=y(()=>{fr();ms();Rv={getGlobalPosition(r=new de,e=!1){return this.parent?this.parent.toGlobal(this._position,r,e):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,e,t=!1){let i=this.getGlobalTransform(st.get(),t);return e=i.apply(r,e),st.return(i),e},toLocal(r,e,t,i){e&&(r=e.toGlobal(r,t,i));let s=this.getGlobalTransform(st.get(),i);return t=s.applyInverse(r,t),st.return(s),t}}});var yo,tm=y(()=>{wt();yo=class{constructor(){this.uid=he("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function di(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function rm(r){return!(r&r-1)&&!!r}var ya=y(()=>{"use strict"});function Uu(r){let e={};for(let t in r)r[t]!==void 0&&(e[t]=r[t]);return e}var im=y(()=>{"use strict"});function f2(r){let e=Bv[r];return e===void 0&&(Bv[r]=he("resource")),e}var Bv,kv,Gu,sm=y(()=>{Mt();wt();Xe();Bv=Object.create(null);kv=class Fv extends Ce{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...Fv.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){X(ie,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=f2(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};kv.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Gu=kv});var Ov,we,Xt=y(()=>{Mt();ya();im();wt();sm();Ov=class Uv extends Ce{constructor(e={}){super(),this.options=e,this.uid=he("textureSource"),this._resourceType="textureSource",this._resourceId=he("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...Uv.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new Gu(Uu(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=he("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){let{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,t,i){i||(i=this._resolution),e||(e=this.width),t||(t=this.height);let s=Math.round(e*i),o=Math.round(t*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=he("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=rm(this.pixelWidth)&&rm(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};Ov.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};we=Ov});function p2(){for(let r=0;r<16;r++){let e=[];om.push(e);for(let t=0;t<16;t++){let i=Lu(gs[r]*gs[t]+ys[r]*xs[t]),s=Lu(xs[r]*gs[t]+_s[r]*xs[t]),o=Lu(gs[r]*ys[t]+ys[r]*_s[t]),n=Lu(xs[r]*ys[t]+_s[r]*_s[t]);for(let a=0;a<16;a++)if(gs[a]===i&&xs[a]===s&&ys[a]===o&&_s[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new G;e.set(gs[r],xs[r],ys[r],_s[r],0,0),Gv.push(e)}}var gs,xs,ys,_s,om,Gv,Lu,He,Lv=y(()=>{ge();gs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],xs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ys=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],_s=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],om=[],Gv=[],Lu=Math.sign;p2();He={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>gs[r],uY:r=>xs[r],vX:r=>ys[r],vY:r=>_s[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>om[r][e],sub:(r,e)=>om[r][He.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?He.S:He.N:Math.abs(e)*2<=Math.abs(r)?r>0?He.E:He.W:e>0?r>0?He.SE:He.SW:r>0?He.NE:He.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=Gv[He.inv(e)];s.tx=t,s.ty=i,r.append(s)}}});var nm,Dv=y(()=>{"use strict";nm=()=>{}});var bs,am=y(()=>{U();Xt();bs=class extends we{constructor(e){let t=e.resource||new Float32Array(e.width*e.height*4),i=e.format;i||(t instanceof Float32Array?i="rgba32float":t instanceof Int32Array||t instanceof Uint32Array?i="rgba32uint":t instanceof Int16Array||t instanceof Uint16Array?i="rgba16uint":(t instanceof Int8Array,i="bgra8unorm")),super({...e,resource:t,format:i}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}};bs.extension=S.TextureSource});var Nv,_o,lm=y(()=>{ge();Nv=new G,_o=class{constructor(e,t){this.mapCoord=new G,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof t>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=t,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){this.texture!==e&&(this._texture?.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(e,t){t===void 0&&(t=e);let i=this.mapCoord;for(let s=0;s{Mt();Lv();ut();wt();Xe();Dv();am();Xt();lm();k=class extends Ce{constructor({source:e,label:t,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=he("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Q,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new we,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:u,height:h}=this._source;this.frame.width=u,this.frame.height=h}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new _o(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:t}=this,{width:i,height:s}=this._source,o=t.x/i,n=t.y/s,a=t.width/i,l=t.height/s,c=this.rotate;if(c){let u=a/2,h=l/2,d=o+u,f=n+h;c=He.add(c,He.NW),e.x0=d+u*He.uX(c),e.y0=f+h*He.uY(c),c=He.add(c,2),e.x1=d+u*He.uX(c),e.y1=f+h*He.uY(c),c=He.add(c,2),e.x2=d+u*He.uX(c),e.y2=f+h*He.uY(c),c=He.add(c,2),e.x3=d+u*He.uX(c),e.y3=f+h*He.uY(c)}else e.x0=o,e.y0=n,e.x1=o+a,e.y1=n,e.x2=o+a,e.y2=n+l,e.x3=o,e.y3=n+l}destroy(e=!1){this._source&&e&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return X(ie,"Texture.baseTexture is now Texture.source"),this._source}};k.EMPTY=new k({label:"EMPTY",source:new we({label:"EMPTY"})});k.EMPTY.destroy=nm;k.WHITE=new k({source:new bs({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});k.WHITE.destroy=nm});var m2,cm,je,Oi=y(()=>{ya();Xt();ve();m2=0,cm=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,i){let s=new we({...this.textureOptions,width:e,height:t,resolution:1,antialias:i,autoGarbageCollect:!1});return new k({source:s,label:`texturePool_${m2++}`})}getOptimalTexture(e,t,i=1,s){let o=Math.ceil(e*i-1e-6),n=Math.ceil(t*i-1e-6);o=di(o),n=di(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=i,l.source.width=o/i,l.source.height=n/i,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=e,l.frame.height=t,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(e,t=!1){let i=e.source;return this.getOptimalTexture(e.width,e.height,i._resolution,t)}returnTexture(e){let t=this._poolKeyHash[e.uid];this._texturePool[t].push(e)}clear(e){if(e=e!==!1,e)for(let t in this._texturePool){let i=this._texturePool[t];if(i)for(let s=0;s{ge();tm();Oi();Du=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new G,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new yo,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let t=e.children;for(let i=0;i-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let t=e.children;for(let i=0;i0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let t=0;t{"use strict"});var um,hm,dm,bo,_a,vs,te,Pr=y(()=>{Mt();Tt();Zb();U();ge();zp();Cu();wt();Xe();Gt();sv();nv();lv();hv();fv();gv();bv();Ev();Pv();Mv();Iv();Hv();Wv();um=new St(null),hm=new St(null),dm=new St(null,1,1),bo=1,_a=2,vs=4,te=class r extends Ce{constructor(e={}){super(),this.uid=he("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new G,this.relativeGroupTransform=new G,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new St(this,0,0),this._scale=dm,this._pivot=hm,this._skew=um,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],Vv(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(t=>this.addChild(t)),e.parent?.addChild(this)}static mixin(e){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),V.mixin(r,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||X(ie,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s1){for(let s=0;s-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(t):this.parentRenderGroup&&this.parentRenderGroup.removeChild(t),t.parentRenderLayer&&t.parentRenderLayer.detach(t),t.parent=null,this.emit("childRemoved",t,this,i),t.emit("removed",this)),t}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=se.get(Du,this),this.groupTransform=G.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),se.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new G),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*Jb}set angle(e){this.rotation=e*ev}get pivot(){return this._pivot===hm&&(this._pivot=new St(this,0,0)),this._pivot}set pivot(e){this._pivot===hm&&(this._pivot=new St(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===um&&(this._skew=new St(this,0,0)),this._skew}set skew(e){this._skew===um&&(this._skew=new St(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===dm&&(this._scale=new St(this,1,1)),this._scale}set scale(e){this._scale===dm&&(this._scale=new St(this,0,0)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let t=this.getLocalBounds().width;this._setWidth(e,t)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let t=this.getLocalBounds().height;this._setHeight(e,t)}getSize(e){e||(e={});let t=this.getLocalBounds();return e.width=Math.abs(this.scale.x*t.width),e.height=Math.abs(this.scale.y*t.height),e}setSize(e,t){let i=this.getLocalBounds();typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,i.width),t!==void 0&&this._setHeight(t,i.height)}_updateSkew(){let e=this._rotation,t=this._skew;this._cx=Math.cos(e+t._y),this._sx=Math.sin(e+t._y),this._cy=-Math.sin(e-t._x),this._sy=Math.cos(e-t._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let t=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,c=s._y;t.a=this._cx*n,t.b=this._sx*n,t.c=this._cy*a,t.d=this._sy*a,t.tx=o._x-(l*t.a+c*t.c),t.ty=o._y-(l*t.b+c*t.d)}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=bo,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=oe.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=bo,this._onUpdate())}get tint(){return xa(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=_a,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let t=e?2:0;(this.localDisplayStatus&2)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=vs,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let t=e?0:4;(this.localDisplayStatus&4)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=vs,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let t=e?1:0;(this.localDisplayStatus&1)!==t&&(this._updateFlags|=vs,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let t;if(this.children.length&&(t=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof e=="boolean"?e:e?.children)&&t)for(let s=0;s{fr();Ui=class r{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new de,this.page=new de,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function g2(r){return function(e){return e.test(r)}}function Gi(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var s=g2(t),o={apple:{phone:s(fm)&&!s(fi),ipod:s(zv),tablet:!s(fm)&&(s($v)||e0(e))&&!s(fi),universal:s(Xv),device:(s(fm)||s(zv)||s($v)||s(Xv)||e0(e))&&!s(fi)},amazon:{phone:s(vo),tablet:!s(vo)&&s(Hu),device:s(vo)||s(Hu)},android:{phone:!s(fi)&&s(vo)||!s(fi)&&s(pm),tablet:!s(fi)&&!s(vo)&&!s(pm)&&(s(Hu)||s(jv)),device:!s(fi)&&(s(vo)||s(Hu)||s(pm)||s(jv))||s(/\bokhttp\b/i)},windows:{phone:s(fi),tablet:s(Yv),device:s(fi)||s(Yv)},other:{blackberry:s(qv),blackberry10:s(Kv),opera:s(Zv),firefox:s(Jv),chrome:s(Qv),device:s(qv)||s(Kv)||s(Zv)||s(Jv)||s(Qv)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var fm,zv,$v,Xv,pm,jv,vo,Hu,fi,Yv,qv,Kv,Zv,Qv,Jv,e0,mm=y(()=>{fm=/iPhone/i,zv=/iPod/i,$v=/iPad/i,Xv=/\biOS-universal(?:.+)Mac\b/i,pm=/\bAndroid(?:.+)Mobile\b/i,jv=/Android/i,vo=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Hu=/Silk/i,fi=/Windows Phone/i,Yv=/\bWindows(?:.+)ARM\b/i,qv=/BlackBerry/i,Kv=/BB10/i,Zv=/Opera Mini/i,Qv=/\b(CriOS|Chrome)(?:.+)Mobile/i,Jv=/Mobile(?:.+)Firefox\b/i,e0=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var gm=y(()=>{mm();mm()});var x2,t0,r0=y(()=>{gm();x2=Gi.default??Gi,t0=x2(globalThis.navigator)});var y2,Vu,_2,b2,i0,s0,v2,T2,S2,xm,n0,a0=y(()=>{Nu();U();r0();qp();y2=9,Vu=100,_2=0,b2=0,i0=2,s0=1,v2=-1e3,T2=-1e3,S2=2,xm=class o0{constructor(e,t=t0){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${s0}px`,e.style.height=`${s0}px`,e.style.position="absolute",e.style.top=`${v2}px`,e.style.left=`${T2}px`,e.style.zIndex=S2.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${Vu}px`,this._div.style.height=`${Vu}px`,this._div.style.position="absolute",this._div.style.top=`${_2}px`,this._div.style.left=`${b2}px`,this._div.style.zIndex=i0.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let e=this._renderer.view.canvas;if(e.parentNode)e.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let t=new MutationObserver(()=>{e.parentNode&&(e.parentNode.appendChild(this._div),t.disconnect(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let e of this._children)e._accessibleDiv&&e._accessibleDiv.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;this._pool.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let t=e.children;if(t)for(let i=0;i=0;i--){let s=this._children[i];t.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Mu(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${i}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let i=0;i title : ${e.title}
tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let t=this._pool.pop();t||(e.accessibleType==="button"?t=document.createElement("button"):(t=document.createElement(e.accessibleType),t.style.cssText=` color: transparent; pointer-events: none; padding: 0; @@ -16,9 +16,9 @@ Deprecated since v${r}`),console.warn(i))),d_[t]=!0}var d_,it,f_,zt=x(()=>{"use -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; - `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${Kh}px`,e.style.height=`${Kh}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=pb.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:i}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new wi(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==wB||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(t){t?this._activate():this._deactivate()}};Jf.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"accessibility"};Jf.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};xb=Jf});var _b,bb=x(()=>{"use strict";_b={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var vb=x(()=>{B();yr();yb();bb();L.add(xb);L.mixin(at,_b)});var Un,Tb=x(()=>{B();Un=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,i=o}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Un.extension=v.Application});var Mr,On=x(()=>{"use strict";Mr=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Mr||{})});var Zs,Sb=x(()=>{"use strict";Zs=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var wb,le,Qs=x(()=>{On();Sb();wb=class qe{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Zs(null,null,1/0),this.deltaMS=1/qe.targetFPMS,this.elapsedMS=1/qe.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Mr.NORMAL){return this._addListener(new Zs(t,e,i))}addOnce(t,e,i=Mr.NORMAL){return this._addListener(new Zs(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o{B();On();Qs();Ln=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Mr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?le.shared:new le,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Ln.extension=v.Application});var tp=x(()=>{B();Tb();Eb();L.add(Un);L.add(Ln)});var ep,Ir,rp=x(()=>{On();Qs();ep=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(le.system.add(this._tickerUpdate,this,Mr.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(le.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime{or();Yh();ri=class extends wi{constructor(){super(...arguments),this.client=new dt,this.movement=new dt,this.offset=new dt,this.global=new dt,this.screen=new dt}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,o,n,a,l,h,c,u,d,f,m,g){throw new Error("Method not implemented.")}}});var Fe,ip=x(()=>{Zh();Fe=class extends ri{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var Br,sp=x(()=>{Zh();Br=class extends ri{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Br.DOM_DELTA_PIXEL=0;Br.DOM_DELTA_LINE=1;Br.DOM_DELTA_PAGE=2});var MB,IB,Dn,Qh,Ab=x(()=>{Ae();or();Pt();rp();Zh();ip();sp();MB=2048,IB=new dt,Dn=new dt,Qh=class{constructor(t){this.dispatch=new It,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=i.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=i[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let i=0;i=0;u--){let d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,o,n||o(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let l=this._isInteractive(e),h=t.isInteractive();return h&&h&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:l&&!o(t,i)&&s(t,i)?h?[t]:[]:null}hitTestRecursive(t,e,i,s,o){if(this._interactivePrune(t)||o(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ir.pauseUpdate=!1),t.interactiveChildren&&t.children){let l=t.children,h=i;for(let c=l.length-1;c>=0;c--){let u=l[c],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,h,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,Dn),!t.hitArea.contains(Dn.x,Dn.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i0&&o!==e.target){let l=t.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(t,l,o);if(this.dispatchEvent(h,"pointerout"),i&&this.dispatchEvent(h,"mouseout"),!e.composedPath().includes(o)){let c=this.createPointerEvent(t,"pointerleave",o);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(h)}if(o!==e.target){let l=t.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(e,l);this.dispatchEvent(h,"pointerover"),i&&this.dispatchEvent(h,"mouseover");let c=o?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(h)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),i&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Fe)){N("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let o=this.clonePointerEvent(i,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Fe)){N("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),i&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Fe)){N("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!i.composedPath().includes(o)){let a=o;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(i,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){let h=a.button===2;this.dispatchEvent(a,h?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof Fe)){N("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let o=i;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Br)){N("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{B();Ab();rp();ip();sp();BB=1,FB={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},np=class op{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Qh(null),Ir.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Fe(null),this._rootWheelEvent=new Br(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...op.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,op._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;let i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i0&&(e=t.composedPath()[0]);let i=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=BB),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=FB[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};np.extension={name:"events",type:[v.WebGLSystem,v.CanvasSystem,v.WebGPUSystem],priority:-1};np.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};Jh=np});var Pb,Cb=x(()=>{ap();Yh();Pb={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Jh.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;let a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(r,a,n)}),o?l.once(r,a,n):l.on(r,a,n)},removeEventListener(r,t,e){let i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof wi))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}}});var Rb=x(()=>{B();yr();ap();Cb();L.add(Jh);L.mixin(at,Pb)});var Nn,Mb=x(()=>{B();Nn=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let i=0;i{Ne();yr();Ai=class extends at{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new At(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:i,y:s}=t;return i>=e.minX&&i<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,l=a.length;for(let h=0;h{B();Mb();L.add(Nn)});var ge,ii=x(()=>{"use strict";ge=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(ge||{})});var Bb,Fb=x(()=>{"use strict";Bb={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")}});var kb,Y,Ft=x(()=>{Fb();kb=Bb,Y={get(){return kb},set(r){kb=r}}});function _r(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Hn(r){return r.split("?")[0].split("#")[0]}function kB(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function GB(r,t,e){return r.replace(new RegExp(kB(t),"g"),e)}function UB(r,t){let e="",i=0,s=-1,o=0,n=-1;for(let a=0;a<=r.length;++a){if(a2){let l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var he,ss=x(()=>{Ft();he={toPosix(r){return GB(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){_r(r),r=this.toPosix(r);let t=/^file:\/\/\//.exec(r);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(_r(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;let i=Hn(this.toPosix(t??Y.get().getBaseUrl())),s=Hn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?he.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(_r(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="",e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));let i=r.endsWith("/");return r=UB(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return _r(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e0)if(t===void 0)t=i;else{let s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(_r(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0),e=t===47,i=-1,s=!0,o=this.getProtocol(r),n=r;r=r.slice(o.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(n)?o+r:o:e&&i===1?"//":o+r.slice(0,i)},rootname(r){_r(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){let e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){_r(r),t&&_r(t),r=Hn(this.toPosix(r));let e=0,i=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let n=t.length-1,a=-1;for(o=r.length-1;o>=0;--o){let l=r.charCodeAt(o);if(l===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(i=o):(n=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===47){if(!s){e=o+1;break}}else i===-1&&(s=!1,i=o+1);return i===-1?"":r.slice(e,i)},extname(r){_r(r),r=Hn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,o=0;for(let n=r.length-1;n>=0;--n){let a=r.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}i===-1&&(s=!1,i=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){_r(r);let t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Hn(this.toPosix(r));let e=r.charCodeAt(0),i=this.isAbsolute(r),s,o="";t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,a=0,l=-1,h=!0,c=r.length-1,u=0;for(;c>=s;--c){if(e=r.charCodeAt(c),e===47){if(!h){a=c+1;break}continue}l===-1&&(h=!1,l=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||l===-1||u===0||u===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&i?t.base=t.name=r.slice(1,l):t.base=t.name=r.slice(a,l)):(a===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,l)):(t.name=r.slice(a,n),t.base=r.slice(a,l)),t.ext=r.slice(n,l)),t.dir=this.dirname(r),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var ke,Vn=x(()=>{"use strict";ke=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r)});function Gb(r,t,e,i,s){let o=t[e];for(let n=0;n{let n=o.substring(1,o.length-1).split(",");s.push(n)}),Gb(r,s,0,e,i)}else i.push(r);return i}var Ob=x(()=>{"use strict"});var os,ec=x(()=>{"use strict";os=r=>!Array.isArray(r)});function OB(r){return r.split(".").pop().split("?").shift().split("#").shift()}var Ke,Js=x(()=>{Pt();ss();Vn();Ob();ec();Ke=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){let{alias:e,src:i}=t;return ke(e||i,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&N("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let i=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let h=this._createBundleAssetId(t,a);i.push(h),l=[a,h]}else{let h=a.map(c=>this._createBundleAssetId(t,c));i.push(...h),l=[...a,...h]}this.add({...o,alias:l,src:n})}),this._bundles[t]=i}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=o=>{this.hasKey(o)&&N(`[Resolver] already has key: ${o} overwriting`)},ke(e).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:h}=o,c=ke(n).map(f=>typeof f=="string"?Ub(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(i):i(u);let d=[];c.forEach(f=>{f.forEach(m=>{let g={};if(typeof m!="object"){g.src=m;for(let p=0;p{this._assetMap[f]=d})})}resolveBundle(t){let e=os(t);t=ke(t);let i={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let l in n){let h=n[l];a[this._extractAssetIdFromBundle(s,l)]=h}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let i={};for(let s in e)i[s]=e[s].src;return i}return e.src}resolve(t){let e=os(t);t=ke(t);let i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let h=o.filter(c=>c[a]?c[a]===l:!1);h.length&&(o=h)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;eo.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:i,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=he.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??OB(t.src),t}};Ke.RETINA_PREFIX=/@([0-9\.]+)x/});var Wn,lp=x(()=>{"use strict";Wn=(r,t)=>{let e=t.split("?")[1];return e&&(r+=`?${e}`),r}});var Lb,Pi,hp=x(()=>{ae();vt();Lb=class zn{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof M?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let i=parseFloat(e.meta.scale);i?(this.resolution=i,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=zn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,i=zn.BATCH_SIZE;for(;e-t{this._batchIndex*zn.BATCH_SIZE{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){let s=he.dirname(r[0]);t.linkedSheets.forEach((o,n)=>{let a=Db([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(i,a)})}return i}var LB,Nb,Hb=x(()=>{ii();Js();lp();B();vt();ss();hp();LB=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Nb={extension:v.Asset,cache:{test:r=>r instanceof Pi,getCacheableAssets:(r,t)=>Db(r,t,!1)},resolver:{extension:{type:v.ResolveParser,name:"resolveSpritesheet"},test:r=>{let e=r.split("?")[0].split("."),i=e.pop(),s=e.pop();return i==="json"&&LB.includes(s)},parse:r=>{let t=r.split(".");return{resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:v.LoadParser,priority:ge.Normal,name:"spritesheetLoader"},async testParse(r,t){return he.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){let{texture:i,imageFilename:s,textureOptions:o}=t?.data??{},n=he.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof M)a=i;else{let c=Wn(n+(s??r.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let l=new Pi(a.source,r);await l.parse();let h=r?.meta?.related_multi_packs;if(Array.isArray(h)){let c=[];for(let d of h){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=Wn(f,t.src),c.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(c);l.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[l].concat(l.linkedSheets.filter(f=>f!==d))})}return l},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}}});var rc=x(()=>{B();Hb();L.add(Nb)});function ic(r,t,e){let{width:i,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;r.minX=o.x-t._x*i,r.maxX=r.minX+n,r.minY=o.y-t._y*s,r.maxY=r.minY+a}else r.minX=-t._x*i,r.maxX=r.minX+i,r.minY=-t._y*s,r.maxY=r.minY+s}var cp=x(()=>{"use strict"});var kt,$n=x(()=>{Uh();vt();cp();zt();tc();kt=class r extends Ai{constructor(t=M.EMPTY){t instanceof M&&(t={texture:t});let{texture:e=M.EMPTY,anchor:i,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new ve({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof M?new r(t):new r(M.from(t,e))}set texture(t){t||(t=M.EMPTY);let e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return ic(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return j("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,i=this._bounds,{width:s,height:o}=e.orig;i.minX=-t._x*s,i.maxX=i.minX+s,i.minY=-t._y*o,i.maxY=i.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function sc(r,t,e){let i=DB;r.measurable=!0,zs(r,e,i),t.addBoundsMask(i),r.measurable=!1}var DB,up=x(()=>{Ne();Bn();DB=new At});function oc(r,t,e){let i=Ye.get();r.measurable=!0;let s=ee.get().identity(),o=Vb(r,e,s);Xs(r,i,o),r.measurable=!1,t.addBoundsMask(i),ee.return(s),Ye.return(i)}function Vb(r,t,e){return r?(r!==t&&(Vb(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e):(N("Mask bounds, renderable is not inside the root container"),e)}var dp=x(()=>{Wh();Zi();Pt()});var Xn,Wb=x(()=>{B();$n();up();dp();Xn=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof kt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||sc(this.mask,t,e)}addLocalBounds(t,e){oc(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof kt}};Xn.extension=v.MaskEffect});var jn,zb=x(()=>{B();jn=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}};jn.extension=v.MaskEffect});var Yn,$b=x(()=>{B();yr();up();dp();Yn=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){sc(this.mask,t,e)}addLocalBounds(t,e){oc(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof at}};Yn.extension=v.MaskEffect});var Pe,to=x(()=>{Ft();B();He();Pe=class extends wt{constructor(t){t.resource||(t.resource=Y.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){let s=super.resize(t,e,i);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Pe.extension=v.TextureSource});var Ve,eo=x(()=>{Ft();B();Pt();He();Ve=class extends wt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=Y.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,N("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Ve.extension=v.TextureSource});async function nc(){return fp??(fp=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),fp}var fp,pp=x(()=>{"use strict"});var ac,ro,mp=x(()=>{B();Qs();pp();He();ac=class Xb extends wt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Xb.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=le.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await nc(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(le.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(le.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(le.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};ac.extension=v.TextureSource;ac.defaultOptions={...wt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};ac.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};ro=ac});var gp,Tt,Ci=x(()=>{Pt();Vn();gp=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||N(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i=ke(t),s;for(let l=0;l{o.set(l,e)});let n=[...o.keys()],a={cacheKeys:n,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),n.forEach(l=>{let h=s?s[l]:e;this._cache.has(l)&&this._cache.get(l)!==h&&N("[Cache] already has key:",l),this._cache.set(l,o.get(l))})}remove(t){if(!this._cacheMap.has(t)){N(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}},Tt=new gp});function jb(r={}){let t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s{Tt.has(i)&&Tt.remove(i)}),t||Tt.set(i,o),o}function qb(r,t=!1){return typeof r=="string"?Tt.get(r):r instanceof wt?new M({source:r}):Yb(r,t)}var xp,yp=x(()=>{Ci();B();He();vt();xp=[];L.handleByList(v.TextureSource,xp);M.from=qb;wt.from=jb});var lc=x(()=>{B();Wb();zb();$b();Wf();to();eo();mp();yp();L.add(Xn,jn,Yn,ro,Ve,Pe,rs)});var xe,Ri=x(()=>{"use strict";xe=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let i in t){let s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){let i=this.resources[e];t!==i&&(i&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let i in e)e[i]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}});function cc(){return(!hc||hc?.isContextLost())&&(hc=Y.get().createCanvas().getContext("webgl",{})),hc}var hc,_p=x(()=>{Ft()});function HB(r){let t="";for(let e=0;e0&&(t+=` -else `),e{"use strict";NB=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` -`)});function nr(){if(io)return io;let r=cc();return io=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),io=Kb(io,r),r.getExtension("WEBGL_lose_context")?.loseContext(),io}var io,ns=x(()=>{_p();Zb();io=null});function so(r,t){let e=2166136261;for(let i=0;i>>=0;return Qb[e]||VB(r,t,e)}function VB(r,t,e){let i={},s=0;bp||(bp=nr());for(let n=0;n{Ri();vt();ns();Qb={};bp=0});var Fr,vp=x(()=>{"use strict";Fr=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function qn(r,t){let e=r.byteLength/8|0,i=new Float64Array(r,0,e);new Float64Array(t,0,e).set(i);let o=r.byteLength-e*8;if(o>0){let n=new Uint8Array(r,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var Tp=x(()=>{"use strict"});var Jb,Ot,as=x(()=>{"use strict";Jb={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Ot=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(Ot||{})});function si(r,t){return t.alphaMode==="no-premultiply-alpha"&&Jb[r]||r}var Kn=x(()=>{as()});var dc,tv=x(()=>{"use strict";dc=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t0?iv[--wp]:new Sp}function rv(r){iv[wp++]=r}var Sp,iv,wp,Zn,sv,ov,nv=x(()=>{Te();vp();Tp();Kn();ns();tv();Sp=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new dc,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},iv=[],wp=0;Zn=0,sv=class fc{constructor(t={}){this.uid=ut("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],fc.defaultOptions.maxTextures=fc.defaultOptions.maxTextures??nr(),t={...fc.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:i,indicesInitialSize:s}=t;this.attributeBuffer=new Fr(i*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;tthis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",m=this.maxTextures;for(let g=this.elementStart;g=m||S)&&(this._finishBatch(i,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=_,a=p.topology,i=ev(),s=i.textures,s.clear(),++Zn),p._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,p._batch=i,u+=p.indexSize,p.packAsQuad?(this.packQuadAttributes(p,l,h,p._attributeStart,p._textureId),this.packQuadIndex(c,p._indexStart,p._attributeStart/this.vertexSize)):(this.packAttributes(p,l,h,p._attributeStart,p._textureId),this.packIndex(p,c,p._indexStart,p._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,d,u-d,s,n,a,t,f),d=u,++Zn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,i,s,o,n,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=i,++Zn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),i=new Fr(e);qn(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){let e=this.indexBuffer,i=Math.max(t,e.length*1.5);i+=i%2;let s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o{"use strict";ht=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(ht||{})});var Yt,Mi=x(()=>{Ae();Te();oi();Yt=class extends It{constructor(t){let{data:e,size:i}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=ut("buffer"),this._resourceType="buffer",this._resourceId=ut("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e?.byteLength);let a=!!e;this.descriptor={size:i,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ht.STATIC)}set static(t){t?this.descriptor.usage|=ht.STATIC:this.descriptor.usage&=~ht.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength{Mi();oi()});function lv(r,t,e){let i=r.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=i.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,h=s.BYTES_PER_ELEMENT,c=(i.offset||0)/h,u=(i.stride||2*4)/h;for(let d=c;da&&(a=f),m>l&&(l=m),f{"use strict"});function WB(r){return(r instanceof Yt||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=Ep(r.buffer,!1),r}var ar,oo=x(()=>{Ae();Ne();Te();Mi();av();hv();ar=class extends It{constructor(t={}){super(),this.uid=ut("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new At,this._boundsDirty=!0;let{attributes:e,indexBuffer:i,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let i=WB(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=Ep(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,lv(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var zB,$B,pc,cv=x(()=>{Mi();oi();oo();zB=new Float32Array(1),$B=new Uint32Array(1),pc=class extends ar{constructor(){let e=new Yt({data:zB,label:"attribute-batch-buffer",usage:ht.VERTEX|ht.COPY_DST,shrinkToFit:!1}),i=new Yt({data:$B,label:"index-batch-buffer",usage:ht.INDEX|ht.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:i})}}});function ni(r,t){let e=uv[r];return e===void 0&&(Ap[t]===void 0&&(Ap[t]=1),uv[r]=e=Ap[t]++),e}var Ap,uv,Qn=x(()=>{"use strict";Ap=Object.create(null),uv=Object.create(null)});function dv(){if(!mc){mc="mediump";let r=cc();r&&r.getShaderPrecisionFormat&&(mc=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return mc}var mc,fv=x(()=>{_p()});function pv(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),` + `,e.accessibleText&&(t.innerText=e.accessibleText)),t.style.width=`${Vu}px`,t.style.height=`${Vu}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=i0.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e.interactive&&(e._accessibleDiv.tabIndex=e.tabIndex)}_dispatchEvent(e,t){let{container:i}=e.target,s=this._renderer.events.rootBoundary,o=Object.assign(new Ui(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,t.forEach(n=>s.dispatchEvent(o,n))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode!==y2||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}};xm.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"accessibility"};xm.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};n0=xm});var l0,c0=y(()=>{"use strict";l0={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var u0=y(()=>{U();Pr();a0();c0();V.add(n0);V.mixin(te,l0)});var ba,h0=y(()=>{U();ba=class{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let t,i;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;t=s,i=o}this.renderer.resize(t,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};ba.extension=S.Application});var Dr,va=y(()=>{"use strict";Dr=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Dr||{})});var To,d0=y(()=>{"use strict";To=class{constructor(e,t=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=t,this.priority=i,this._once=s}match(e,t=null){return this._fn===e&&this._context===t}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));let t=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let t=this.next;return this.next=e?null:t,this.previous=null,t}}});var f0,ht,So=y(()=>{va();d0();f0=class tr{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new To(null,null,1/0),this.deltaMS=1/tr.targetFPMS,this.elapsedMS=1/tr.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,i=Dr.NORMAL){return this._addListener(new To(e,t,i))}addOnce(e,t,i=Dr.NORMAL){return this._addListener(new To(e,t,i,!0))}_addListener(e){let t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,t){let i=this._head.next;for(;i;)i.match(e,t)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){let o=e-this._lastFrame|0;if(o{U();va();So();Ta=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,Dr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?ht.shared:new ht,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};Ta.extension=S.Application});var ym=y(()=>{U();h0();p0();V.add(ba);V.add(Ta)});var _m,Nr,bm=y(()=>{va();So();_m=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(ht.system.add(this._tickerUpdate,this,Dr.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(ht.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime{fr();Nu();pi=class extends Ui{constructor(){super(...arguments),this.client=new de,this.movement=new de,this.offset=new de,this.global=new de,this.screen=new de}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,i,s,o,n,a,l,c,u,h,d,f,p,m){throw new Error("Method not implemented.")}}});var Lt,vm=y(()=>{Wu();Lt=class extends pi{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var Hr,Tm=y(()=>{Wu();Hr=class extends pi{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Hr.DOM_DELTA_PIXEL=0;Hr.DOM_DELTA_LINE=1;Hr.DOM_DELTA_PAGE=2});var w2,E2,Sa,zu,m0=y(()=>{Mt();fr();Ae();bm();Wu();vm();Tm();w2=2048,E2=new de,Sa=new de,zu=class{constructor(e){this.dispatch=new Ce,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,s)=>i.priority-s.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;let t=this.mappingTable[e.type];if(t)for(let i=0,s=t.length;i=0;s--)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;let s=Array.isArray(t)?t:[t];for(let o=i.length-1;o>=0;o--)s.forEach(n=>{e.currentTarget=i[o],this.notifyTarget(e,n)})}propagationPath(e){let t=[e];for(let i=0;i=0;h--){let d=u[h],f=this.hitTestMoveRecursive(d,this._isInteractive(t)?t:d.eventMode,i,s,o,n||o(e,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=e.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let l=this._isInteractive(t),c=e.isInteractive();return c&&c&&this._allInteractiveElements.push(e),n||this._hitElements.length>0?null:a?this._hitElements:l&&!o(e,i)&&s(e,i)?c?[e]:[]:null}hitTestRecursive(e,t,i,s,o){if(this._interactivePrune(e)||o(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(Nr.pauseUpdate=!1),e.interactiveChildren&&e.children){let l=e.children,c=i;for(let u=l.length-1;u>=0;u--){let h=l[u],d=this.hitTestRecursive(h,this._isInteractive(t)?t:h.eventMode,c,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=e.isInteractive();return(d.length>0||f)&&d.push(e),d}}}let n=this._isInteractive(t),a=e.isInteractive();return n&&s(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,Sa),!e.hitArea.contains(Sa.x,Sa.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i0&&o!==t.target){let l=e.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(e,l,o);if(this.dispatchEvent(c,"pointerout"),i&&this.dispatchEvent(c,"mouseout"),!t.composedPath().includes(o)){let u=this.createPointerEvent(e,"pointerleave",o);for(u.eventPhase=u.AT_TARGET;u.target&&!t.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),i&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(c)}if(o!==t.target){let l=e.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(t,l);this.dispatchEvent(c,"pointerover"),i&&this.dispatchEvent(c,"mouseover");let u=o?.parent;for(;u&&u!==this.rootTarget.parent&&u!==t.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let d=this.clonePointerEvent(t,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&n.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&n.push("globaltouchmove")),i&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&n.push("globalmousemove"),this.cursor=t.target?.cursor),n.length>0&&this.all(t,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof Lt)){W("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let o=this.clonePointerEvent(i,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(o)}mapPointerOut(e){if(!(e instanceof Lt)){W("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId);if(t.overTargets){let i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.findMountedTarget(t.overTargets),o=this.createPointerEvent(e,"pointerout",s);this.dispatchEvent(o),i&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(e,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;t.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(e){if(!(e instanceof Lt)){W("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let s=this.trackingData(e.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[e.button]),n=o;if(o&&!i.composedPath().includes(o)){let a=o;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[e.button],n=a}if(n){let a=this.clonePointerEvent(i,"click");a.target=n,a.path=null,s.clicksByButton[e.button]||(s.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});let l=s.clicksByButton[e.button];if(l.target===a.target&&t-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=t,a.detail=l.clickCount,a.pointerType==="mouse"){let c=a.button===2;this.dispatchEvent(a,c?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof Lt)){W("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),s=this.createPointerEvent(e);if(i){let o=i;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(s)}mapWheel(e){if(!(e instanceof Hr)){W("EventBoundary cannot map a non-wheel event as a wheel event");return}let t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i{U();m0();bm();vm();Tm();A2=1,P2={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},wm=class Sm{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new zu(null),Nr.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Lt(null),this._rootWheelEvent=new Hr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Sm.defaultEventFeatures},{set:(t,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),t[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){let{canvas:t,resolution:i}=this.renderer;this.setTargetElement(t),this.resolution=i,Sm._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this._currentCursor===e)return;this._currentCursor=e;let i=this.cursorStyles[e];if(i)switch(typeof i){case"string":t&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":t&&Object.assign(this.domElement.style,i);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=this._normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,s=t.length;i0&&(t=e.composedPath()[0]);let i=t!==this.domElement?"outside":"",s=this._normalizeToPointerData(e);for(let o=0,n=s.length;o"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=e.type,t.push(o)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=A2),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,t.push(i)}else t.push(e);return t}normalizeWheelEvent(e){let t=this._rootWheelEvent;return this._transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}_bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this._transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=P2[e.type]||e.type),e}_transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};wm.extension={name:"events",type:[S.WebGLSystem,S.CanvasSystem,S.WebGPUSystem],priority:-1};wm.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};$u=wm});var g0,x0=y(()=>{Em();Nu();g0={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??$u.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,e,t){let i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof t=="object"?t.signal:void 0,o=typeof t=="object"?t.once===!0:!1,n=typeof e=="function"?void 0:e;r=i?`${r}capture`:r;let a=typeof e=="function"?e:e.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(r,a,n)}),o?l.once(r,a,n):l.on(r,a,n)},removeEventListener(r,e,t){let i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof e=="function"?void 0:e;r=i?`${r}capture`:r,e=typeof e=="function"?e:e.handleEvent,this.off(r,e,s)},dispatchEvent(r){if(!(r instanceof Ui))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}}});var y0=y(()=>{U();Pr();Em();x0();V.add($u);V.mixin(te,g0)});var wa,_0=y(()=>{U();wa=class{constructor(e){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=e,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(e,t){this._attachedDomElements.includes(e)||(this._attachedDomElements.push(e),e.on("destroyed",this._destroyRenderableBound))}updateRenderable(e){}validateRenderable(e){return!0}destroyRenderable(e){let t=this._attachedDomElements.indexOf(e);t!==-1&&this._attachedDomElements.splice(t,1),e.off("destroyed",this._destroyRenderableBound)}postrender(){let e=this._attachedDomElements;if(e.length===0){this._domElement.remove();return}let t=this._renderer.view.canvas;this._domElement.parentNode!==t.parentNode&&t.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${t.offsetLeft}px, ${t.offsetTop}px)`;for(let i=0;i{$t();Pr();Li=class extends te{constructor(e){super(e),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new Ee(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){let t=this.bounds,{x:i,y:s}=e;return i>=t.minX&&i<=t.maxX&&s>=t.minY&&s<=t.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}destroy(e){super.destroy(e),this._bounds=null}collectRenderablesSimple(e,t,i){let{renderPipes:s,renderableGC:o}=t;s.blendMode.setBlendMode(this,this.groupBlendMode,e),s[this.renderPipeId].addRenderable(this,e),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,l=a.length;for(let c=0;c{U();_0();V.add(wa)});var Dt,Di=y(()=>{"use strict";Dt=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(Dt||{})});var v0,T0=y(()=>{"use strict";v0={createCanvas:(r,e)=>{let t=document.createElement("canvas");return t.width=r,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,e)=>fetch(r,e),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")}});var S0,j,Re=y(()=>{T0();S0=v0,j={get(){return S0},set(r){S0=r}}});function Cr(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Ea(r){return r.split("?")[0].split("#")[0]}function C2(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M2(r,e,t){return r.replace(new RegExp(C2(e),"g"),t)}function R2(r,e){let t="",i=0,s=-1,o=0,n=-1;for(let a=0;a<=r.length;++a){if(a2){let l=t.lastIndexOf("/");if(l!==t.length-1){l===-1?(t="",i=0):(t=t.slice(0,l),i=t.length-1-t.lastIndexOf("/")),s=a,o=0;continue}}else if(t.length===2||t.length===1){t="",i=0,s=a,o=0;continue}}e&&(t.length>0?t+="/..":t="..",i=2)}else t.length>0?t+=`/${r.slice(s+1,a)}`:t=r.slice(s+1,a),i=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return t}var dt,Ts=y(()=>{Re();dt={toPosix(r){return M2(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){Cr(r),r=this.toPosix(r);let e=/^file:\/\/\//.exec(r);if(e)return e[0];let t=/^[^/:]+:\/{0,2}/.exec(r);return t?t[0]:""},toAbsolute(r,e,t){if(Cr(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;let i=Ea(this.toPosix(e??j.get().getBaseUrl())),s=Ea(this.toPosix(t??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?dt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(Cr(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let e="",t=r.startsWith("/");this.hasProtocol(r)&&(e=this.rootname(r),r=r.slice(e.length));let i=r.endsWith("/");return r=R2(r,!1),r.length>0&&i&&(r+="/"),t?`/${r}`:e+r},isAbsolute(r){return Cr(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let e;for(let t=0;t0)if(e===void 0)e=i;else{let s=r[t-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(r){if(Cr(r),r.length===0)return".";r=this.toPosix(r);let e=r.charCodeAt(0),t=e===47,i=-1,s=!0,o=this.getProtocol(r),n=r;r=r.slice(o.length);for(let a=r.length-1;a>=1;--a)if(e=r.charCodeAt(a),e===47){if(!s){i=a;break}}else s=!1;return i===-1?t?"/":this.isUrl(n)?o+r:o:t&&i===1?"//":o+r.slice(0,i)},rootname(r){Cr(r),r=this.toPosix(r);let e="";if(r.startsWith("/")?e="/":e=this.getProtocol(r),this.isUrl(r)){let t=r.indexOf("/",e.length);t!==-1?e=r.slice(0,t):e=r,e.endsWith("/")||(e+="/")}return e},basename(r,e){Cr(r),e&&Cr(e),r=Ea(this.toPosix(r));let t=0,i=-1,s=!0,o;if(e!==void 0&&e.length>0&&e.length<=r.length){if(e.length===r.length&&e===r)return"";let n=e.length-1,a=-1;for(o=r.length-1;o>=0;--o){let l=r.charCodeAt(o);if(l===47){if(!s){t=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(l===e.charCodeAt(n)?--n===-1&&(i=o):(n=-1,i=a))}return t===i?i=a:i===-1&&(i=r.length),r.slice(t,i)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===47){if(!s){t=o+1;break}}else i===-1&&(s=!1,i=o+1);return i===-1?"":r.slice(t,i)},extname(r){Cr(r),r=Ea(this.toPosix(r));let e=-1,t=0,i=-1,s=!0,o=0;for(let n=r.length-1;n>=0;--n){let a=r.charCodeAt(n);if(a===47){if(!s){t=n+1;break}continue}i===-1&&(s=!1,i=n+1),a===46?e===-1?e=n:o!==1&&(o=1):e!==-1&&(o=-1)}return e===-1||i===-1||o===0||o===1&&e===i-1&&e===t+1?"":r.slice(e,i)},parse(r){Cr(r);let e={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return e;r=Ea(this.toPosix(r));let t=r.charCodeAt(0),i=this.isAbsolute(r),s,o="";e.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,a=0,l=-1,c=!0,u=r.length-1,h=0;for(;u>=s;--u){if(t=r.charCodeAt(u),t===47){if(!c){a=u+1;break}continue}l===-1&&(c=!1,l=u+1),t===46?n===-1?n=u:h!==1&&(h=1):n!==-1&&(h=-1)}return n===-1||l===-1||h===0||h===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&i?e.base=e.name=r.slice(1,l):e.base=e.name=r.slice(a,l)):(a===0&&i?(e.name=r.slice(1,n),e.base=r.slice(1,l)):(e.name=r.slice(a,n),e.base=r.slice(a,l)),e.ext=r.slice(n,l)),e.dir=this.dirname(r),o&&(e.dir=o+e.dir),e},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Nt,Aa=y(()=>{"use strict";Nt=(r,e,t=!1)=>(Array.isArray(r)||(r=[r]),e?r.map(i=>typeof i=="string"||t?e(i):i):r)});function w0(r,e,t,i,s){let o=e[t];for(let n=0;n{let n=o.substring(1,o.length-1).split(",");s.push(n)}),w0(r,s,0,t,i)}else i.push(r);return i}var A0=y(()=>{"use strict"});var Ss,ju=y(()=>{"use strict";Ss=r=>!Array.isArray(r)});function I2(r){return r.split(".").pop().split("?").shift().split("#").shift()}var rr,wo=y(()=>{Ae();Ts();Aa();A0();ju();rr=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{let t=e;this._defaultSearchParams=Object.keys(t).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(t[i])}`).join("&")}}getAlias(e){let{alias:t,src:i}=e;return Nt(t||i,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(e){this._manifest&&W("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){let i=[],s=t;Array.isArray(t)||(s=Object.entries(t).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let c=this._createBundleAssetId(e,a);i.push(c),l=[a,c]}else{let c=a.map(u=>this._createBundleAssetId(e,u));i.push(...c),l=[...a,...c]}this.add({...o,alias:l,src:n})}),this._bundles[e]=i}add(e){let t=[];Array.isArray(e)?t.push(...e):t.push(e);let i;i=o=>{this.hasKey(o)&&W(`[Resolver] already has key: ${o} overwriting`)},Nt(t).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:c}=o,u=Nt(n).map(f=>typeof f=="string"?E0(f):Array.isArray(f)?f:[f]),h=this.getAlias(o);Array.isArray(h)?h.forEach(i):i(h);let d=[];u.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let g=0;g{this._assetMap[f]=d})})}resolveBundle(e){let t=Ss(e);e=Nt(e);let i={};return e.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let l in n){let c=n[l];a[this._extractAssetIdFromBundle(s,l)]=c}i[s]=a}}),t?i[e[0]]:i}resolveUrl(e){let t=this.resolve(e);if(typeof e!="string"){let i={};for(let s in t)i[s]=t[s].src;return i}return t.src}resolve(e){let t=Ss(e);e=Nt(e);let i={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let c=o.filter(u=>u[a]?u[a]===l:!1);c.length&&(o=c)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),t?i[e[0]]:i}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;to.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;let t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}_buildResolvedAsset(e,t){let{aliases:i,data:s,loadParser:o,format:n}=t;return(this._basePath||this._rootPath)&&(e.src=dt.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...s||{},...e.data},e.loadParser=o??e.loadParser,e.format=n??e.format??I2(e.src),e}};rr.RETINA_PREFIX=/@([0-9\.]+)x/});var Pa,Am=y(()=>{"use strict";Pa=(r,e)=>{let t=e.split("?")[1];return t&&(r+=`?${t}`),r}});var P0,Ni,Pm=y(()=>{ut();ve();P0=class Ca{constructor(e,t){this.linkedSheets=[],this._texture=e instanceof k?e:null,this.textureSource=e.source,this.textures={},this.animations={},this.data=t;let i=parseFloat(t.meta.scale);i?(this.resolution=i,e.source.resolution=this.resolution):this.resolution=e.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=Ca.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e,i=Ca.BATCH_SIZE;for(;t-e{this._batchIndex*Ca.BATCH_SIZE{i[s]=e}),Object.keys(e.textures).forEach(s=>{i[s]=e.textures[s]}),!t){let s=dt.dirname(r[0]);e.linkedSheets.forEach((o,n)=>{let a=C0([`${s}/${e.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(i,a)})}return i}var B2,M0,R0=y(()=>{Di();wo();Am();U();ve();Ts();Pm();B2=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];M0={extension:S.Asset,cache:{test:r=>r instanceof Ni,getCacheableAssets:(r,e)=>C0(r,e,!1)},resolver:{extension:{type:S.ResolveParser,name:"resolveSpritesheet"},test:r=>{let t=r.split("?")[0].split("."),i=t.pop(),s=t.pop();return i==="json"&&B2.includes(s)},parse:r=>{let e=r.split(".");return{resolution:parseFloat(rr.RETINA_PREFIX.exec(r)?.[1]??"1"),format:e[e.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:S.LoadParser,priority:Dt.Normal,name:"spritesheetLoader"},async testParse(r,e){return dt.extname(e.src).toLowerCase()===".json"&&!!r.frames},async parse(r,e,t){let{texture:i,imageFilename:s,textureOptions:o}=e?.data??{},n=dt.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof k)a=i;else{let u=Pa(n+(s??r.meta.image),e.src);a=(await t.load([{src:u,data:o}]))[u]}let l=new Ni(a.source,r);await l.parse();let c=r?.meta?.related_multi_packs;if(Array.isArray(c)){let u=[];for(let d of c){if(typeof d!="string")continue;let f=n+d;e.data?.ignoreMultiPack||(f=Pa(f,e.src),u.push(t.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let h=await Promise.all(u);l.linkedSheets=h,h.forEach(d=>{d.linkedSheets=[l].concat(l.linkedSheets.filter(f=>f!==d))})}return l},async unload(r,e,t){await t.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}}});var Yu=y(()=>{U();R0();V.add(M0)});function qu(r,e,t){let{width:i,height:s}=t.orig,o=t.trim;if(o){let n=o.width,a=o.height;r.minX=o.x-e._x*i,r.maxX=r.minX+n,r.minY=o.y-e._y*s,r.maxY=r.minY+a}else r.minX=-e._x*i,r.maxX=r.minX+i,r.minY=-e._y*s,r.maxY=r.minY+s}var Cm=y(()=>{"use strict"});var Te,Ma=y(()=>{Cu();ve();Cm();Xe();Xu();Te=class r extends Li{constructor(e=k.EMPTY){e instanceof k&&(e={texture:e});let{texture:t=k.EMPTY,anchor:i,roundPixels:s,width:o,height:n,...a}=e;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new St({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:t.defaultAnchor&&(this.anchor=t.defaultAnchor),this.texture=t,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(e,t=!1){return e instanceof k?new r(e):new r(k.from(e,t))}set texture(e){e||(e=k.EMPTY);let t=this._texture;t!==e&&(t&&t.dynamic&&t.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return qu(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return X("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let e=this._anchor,t=this._texture,i=this._bounds,{width:s,height:o}=t.orig;i.minX=-e._x*s,i.maxX=i.minX+s,i.minY=-e._y*o,i.maxY=i.minY+o}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),t!==void 0&&this._setHeight(t,this._texture.orig.height)}}});function Ku(r,e,t){let i=k2;r.measurable=!0,mo(r,t,i),e.addBoundsMask(i),r.measurable=!1}var k2,Mm=y(()=>{$t();ga();k2=new Ee});function Zu(r,e,t){let i=er.get();r.measurable=!0;let s=st.get().identity(),o=I0(r,t,s);xo(r,i,o),r.measurable=!1,e.addBoundsMask(i),st.return(s),er.return(i)}function I0(r,e,t){return r?(r!==e&&(I0(r.parent,e,t),r.updateLocalTransform(),t.append(r.localTransform)),t):(W("Mask bounds, renderable is not inside the root container"),t)}var Rm=y(()=>{Ou();ms();Ae()});var Ra,B0=y(()=>{U();Ma();Mm();Rm();Ra=class{constructor(e){this.priority=0,this.inverse=!1,this.pipe="alphaMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof Te),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(e,t){this.inverse||Ku(this.mask,e,t)}addLocalBounds(e,t){Zu(this.mask,e,t)}containsPoint(e,t){let i=this.mask;return t(i,e)}destroy(){this.reset()}static test(e){return e instanceof Te}};Ra.extension=S.MaskEffect});var Ia,k0=y(()=>{U();Ia=class{constructor(e){this.priority=0,this.pipe="colorMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}};Ia.extension=S.MaskEffect});var Ba,F0=y(()=>{U();Pr();Mm();Rm();Ba=class{constructor(e){this.priority=0,this.pipe="stencilMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(e,t){Ku(this.mask,e,t)}addLocalBounds(e,t){Zu(this.mask,e,t)}containsPoint(e,t){let i=this.mask;return t(i,e)}destroy(){this.reset()}static test(e){return e instanceof te}};Ba.extension=S.MaskEffect});var Rt,Eo=y(()=>{Re();U();Xt();Rt=class extends we{constructor(e){e.resource||(e.resource=j.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,t=this.height,i=this._resolution){let s=super.resize(e,t,i);return s&&this.resizeCanvas(),s}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Rt.extension=S.TextureSource});var jt,Ao=y(()=>{Re();U();Ae();Xt();jt=class extends we{constructor(e){if(e.resource&&globalThis.HTMLImageElement&&e.resource instanceof HTMLImageElement){let t=j.get().createCanvas(e.resource.width,e.resource.height);t.getContext("2d").drawImage(e.resource,0,0,e.resource.width,e.resource.height),e.resource=t,W("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}};jt.extension=S.TextureSource});async function Qu(){return Im??(Im=(async()=>{let e=document.createElement("canvas").getContext("webgl");if(!e)return"premultiply-alpha-on-upload";let t=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return"premultiply-alpha-on-upload";let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);let s=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);let o=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,o),e.deleteFramebuffer(s),e.deleteTexture(i),e.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Im}var Im,Bm=y(()=>{"use strict"});var Ju,Po,km=y(()=>{U();So();Bm();Xt();Ju=class O0 extends we{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...O0.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let e=ht.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let e=this.resource,t=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(t.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.alphaMode=await Qu(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,t.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${t.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(ht.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ht.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ht.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};Ju.extension=S.TextureSource;Ju.defaultOptions={...we.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Ju.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Po=Ju});var Fm,Se,Hi=y(()=>{Ae();Aa();Fm=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){let t=this._cache.get(e);return t||W(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){let i=Nt(e),s;for(let l=0;l{o.set(l,t)});let n=[...o.keys()],a={cacheKeys:n,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),n.forEach(l=>{let c=s?s[l]:t;this._cache.has(l)&&this._cache.get(l)!==c&&W("[Cache] already has key:",l),this._cache.set(l,o.get(l))})}remove(e){if(!this._cacheMap.has(e)){W(`[Assets] Asset id ${e} was not found in the Cache`);return}let t=this._cacheMap.get(e);t.cacheKeys.forEach(s=>{this._cache.delete(s)}),t.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}},Se=new Fm});function U0(r={}){let e=r&&r.resource,t=e?r.resource:r,i=e?r:{resource:r};for(let s=0;s{Se.has(i)&&Se.remove(i)}),e||Se.set(i,o),o}function L0(r,e=!1){return typeof r=="string"?Se.get(r):r instanceof we?new k({source:r}):G0(r,e)}var Om,Um=y(()=>{Hi();U();Xt();ve();Om=[];V.handleByList(S.TextureSource,Om);k.from=L0;we.from=U0});var eh=y(()=>{U();B0();k0();F0();am();Eo();Ao();km();Um();V.add(Ra,Ia,Ba,Po,jt,Rt,bs)});var gt,Vi=y(()=>{"use strict";gt=class{constructor(e){this.resources=Object.create(null),this._dirty=!0;let t=0;for(let i in e){let s=e[i];this.setResource(s,t++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let e=[],t=0;for(let i in this.resources)e[t++]=this.resources[i]._resourceId;this._key=e.join("|")}setResource(e,t){let i=this.resources[t];e!==i&&(i&&e.off?.("change",this.onResourceChange,this),e.on?.("change",this.onResourceChange,this),this.resources[t]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e){let t=this.resources;for(let i in t)t[i]._touched=e}destroy(){let e=this.resources;for(let t in e)e[t].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(e){if(this._dirty=!0,e.destroyed){let t=this.resources;for(let i in t)t[i]===e&&(t[i]=null)}else this._updateKey()}}});function rh(){return(!th||th?.isContextLost())&&(th=j.get().createCanvas().getContext("webgl",{})),th}var th,Gm=y(()=>{Re()});function O2(r){let e="";for(let t=0;t0&&(e+=` +else `),t{"use strict";F2=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +`)});function pr(){if(Co)return Co;let r=rh();return Co=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),Co=D0(Co,r),r.getExtension("WEBGL_lose_context")?.loseContext(),Co}var Co,ws=y(()=>{Gm();N0();Co=null});function Mo(r,e){let t=2166136261;for(let i=0;i>>=0;return H0[t]||U2(r,e,t)}function U2(r,e,t){let i={},s=0;Lm||(Lm=pr());for(let n=0;n{Vi();ve();ws();H0={};Lm=0});var Vr,Dm=y(()=>{"use strict";Vr=class{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}});function ka(r,e){let t=r.byteLength/8|0,i=new Float64Array(r,0,t);new Float64Array(e,0,t).set(i);let o=r.byteLength-t*8;if(o>0){let n=new Uint8Array(r,t*8,o);new Uint8Array(e,t*8,o).set(n)}}var Nm=y(()=>{"use strict"});var V0,Fe,Es=y(()=>{"use strict";V0={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Fe=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(Fe||{})});function mi(r,e){return e.alphaMode==="no-premultiply-alpha"&&V0[r]||r}var Fa=y(()=>{Es()});var sh,W0=y(()=>{"use strict";sh=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e0?X0[--Vm]:new Hm}function $0(r){X0[Vm++]=r}var Hm,X0,Vm,Oa,j0,Y0,q0=y(()=>{wt();Dm();Nm();Fa();ws();W0();Hm=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new sh,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},X0=[],Vm=0;Oa=0,j0=class oh{constructor(e={}){this.uid=he("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],oh.defaultOptions.maxTextures=oh.defaultOptions.maxTextures??pr(),e={...oh.defaultOptions,...e};let{maxTextures:t,attributesInitialSize:i,indicesInitialSize:s}=e;this.attributeBuffer=new Vr(i*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=t}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;ethis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,c=this.attributeBuffer.uint32View,u=this.indexBuffer,h=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let m=this.elementStart;m=p||T)&&(this._finishBatch(i,d,h-d,s,n,a,e,f),f="renderBatch",d=h,n=x,a=g.topology,i=z0(),s=i.textures,s.clear(),++Oa),g._textureId=v._textureBindLocation=s.count,s.ids[v.uid]=s.count,s.textures[s.count++]=v,g._batch=i,h+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,l,c,g._attributeStart,g._textureId),this.packQuadIndex(u,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,l,c,g._attributeStart,g._textureId),this.packIndex(g,u,g._indexStart,g._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,d,h-d,s,n,a,e,f),d=h,++Oa),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=h}_finishBatch(e,t,i,s,o,n,a,l){e.gpuBindGroup=null,e.bindGroup=null,e.action=l,e.batcher=this,e.textures=s,e.blendMode=o,e.topology=n,e.start=t,e.size=i,++Oa,this.batches[this.batchIndex++]=e,a.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){let t=Math.max(e,this.attributeBuffer.size*2),i=new Vr(t);ka(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(e){let t=this.indexBuffer,i=Math.max(e,t.length*1.5);i+=i%2;let s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==t.BYTES_PER_ELEMENT)for(let o=0;o{"use strict";le=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(le||{})});var Ke,Wi=y(()=>{Mt();wt();gi();Ke=class extends Ce{constructor(e){let{data:t,size:i}=e,{usage:s,label:o,shrinkToFit:n}=e;super(),this.uid=he("buffer"),this._resourceType="buffer",this._resourceId=he("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,t instanceof Array&&(t=new Float32Array(t)),this._data=t,i??(i=t?.byteLength);let a=!!t;this.descriptor={size:i,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&le.STATIC)}set static(e){e?this.descriptor.usage|=le.STATIC:this.descriptor.usage&=~le.STATIC}setDataWithSize(e,t,i){if(this._updateID++,this._updateSize=t*e.BYTES_PER_ELEMENT,this._data===e){i&&this.emit("update",this);return}let s=this._data;if(this._data=e,this._dataInt32=null,!s||s.length!==e.length){!this.shrinkToFit&&s&&e.byteLength{Wi();gi()});function Z0(r,e,t){let i=r.getAttribute(e);if(!i)return t.minX=0,t.minY=0,t.maxX=0,t.maxY=0,t;let s=i.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,c=s.BYTES_PER_ELEMENT,u=(i.offset||0)/c,h=(i.stride||2*4)/c;for(let d=u;da&&(a=f),p>l&&(l=p),f{"use strict"});function G2(r){return(r instanceof Ke||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=Wm(r.buffer,!1),r}var mr,Ro=y(()=>{Mt();$t();wt();Wi();K0();Q0();mr=class extends Ce{constructor(e={}){super(),this.uid=he("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Ee,this._boundsDirty=!0;let{attributes:t,indexBuffer:i,topology:s}=e;if(this.buffers=[],this.attributes={},t)for(let o in t)this.addAttribute(o,t[o]);this.instanceCount=e.instanceCount??1,i&&this.addIndex(i),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(let e in this.attributes){let t=this.attributes[e];return t.buffer.data.length/(t.stride/4||t.size)}return 0}addAttribute(e,t){let i=G2(t);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[e]=i}addIndex(e){this.indexBuffer=Wm(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Z0(this,"aPosition",this._bounds)):this._bounds}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(t=>t.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var L2,D2,nh,J0=y(()=>{Wi();gi();Ro();L2=new Float32Array(1),D2=new Uint32Array(1),nh=class extends mr{constructor(){let t=new Ke({data:L2,label:"attribute-batch-buffer",usage:le.VERTEX|le.COPY_DST,shrinkToFit:!1}),i=new Ke({data:D2,label:"index-batch-buffer",usage:le.INDEX|le.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:s,offset:0},aUV:{buffer:t,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:i})}}});function xi(r,e){let t=eT[r];return t===void 0&&(zm[e]===void 0&&(zm[e]=1),eT[r]=t=zm[e]++),t}var zm,eT,Ua=y(()=>{"use strict";zm=Object.create(null),eT=Object.create(null)});function tT(){if(!ah){ah="mediump";let r=rh();r&&r.getShaderPrecisionFormat&&(ah=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return ah}var ah,rT=y(()=>{Gm()});function iT(r,e,t){return e?r:t?(r=r.replace("out vec4 finalColor;",""),` #ifdef GL_ES // This checks if it is WebGL1 #define in varying @@ -33,27 +33,27 @@ else `),e{"use strict"});function gv(r,t,e){let i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&i!=="highp"&&(s="mediump"),`precision ${s} float; -${r}`}else if(i!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var xv=x(()=>{"use strict"});function yv(r,t){return t?`#version 300 es -${r}`:r}var _v=x(()=>{"use strict"});function bv(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let i=e?XB:jB;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`} -${r}`}var XB,jB,vv=x(()=>{"use strict";XB={},jB={}});function Tv(r,t){return t?r.replace("#version 300 es",""):r}var Sv=x(()=>{"use strict"});var Pp,Cp,wv,lr,ls=x(()=>{Qn();fv();mv();xv();_v();vv();Sv();Pp={stripVersion:Tv,ensurePrecision:gv,addProgramDefines:pv,setProgramName:bv,insertVersion:yv},Cp=Object.create(null),wv=class Rp{constructor(t){t={...Rp.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:dv()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(Pp).forEach(n=>{let a=i[n];s=Pp[n](s,a,!0),o=Pp[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=ni(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(t){let e=`${t.vertex}:${t.fragment}`;return Cp[e]||(Cp[e]=new Rp(t)),Cp[e]}};wv.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};lr=wv});function We(r){return Ev[r]??Ev.float32}var Ev,hs=x(()=>{"use strict";Ev={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function Av({source:r,entryPoint:t}){let e={},i=r.indexOf(`fn ${t}`);if(i!==-1){let s=r.indexOf("->",i);if(s!==-1){let o=r.substring(i,s),n=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,a;for(;(a=n.exec(o))!==null;){let l=YB[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:l,stride:We(l).stride,offset:0,instance:!1,start:0}}}}return e}var YB,Pv=x(()=>{hs();YB={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"}});function gc(r){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=r.match(t)?.map(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(i)[1],10),name:u.match(s)[2],isUniform:u.match(s)[1]==="",type:u.match(o)[1]}));if(!h)return{groups:[],structs:[]};let c=r.match(n)?.map(u=>{let d=u.match(l)[1],f=u.match(a).reduce((m,g)=>{let[p,b]=g.split(":");return m[p.trim()]=b.trim(),m},{});return f?{name:d,members:f}:null}).filter(({name:u})=>h.some(d=>d.type===u))??[];return{groups:h,structs:c}}var Cv=x(()=>{"use strict"});var no,Rv=x(()=>{"use strict";no=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(no||{})});function Mv({groups:r}){let t=[];for(let e=0;e{Rv()});function Bv({groups:r}){let t=[];for(let e=0;e{"use strict"});function kv(r,t){let e=new Set,i=new Set,s=[...r.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...r.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:s,groups:o}}var Gv=x(()=>{"use strict"});var Mp,hr,ao=x(()=>{Qn();Pv();Cv();Iv();Fv();Gv();Mp=Object.create(null),hr=class r{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:i,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=i,e.source===i.source){let a=gc(e.source);this.structsAndGroups=a}else{let a=gc(i.source),l=gc(e.source);this.structsAndGroups=kv(a,l)}this.layout=s??Bv(this.structsAndGroups),this.gpuLayout=o??Mv(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=ni(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Av(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){let e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Mp[e]||(Mp[e]=new r(t)),Mp[e]}}});function Ip(r,t,e){if(r)for(let i in r){let s=i.toLocaleLowerCase(),o=t[s];if(o){let n=r[i];i==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n)}else N(`${i} placement hook does not exist in shader`)}}var Uv=x(()=>{Pt()});function Bp(r){let t={};return(r.match(qB)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{t[i]=[]}),t}var qB,Ov=x(()=>{"use strict";qB=/\{\{(.*?)\}\}/g});function Lv(r,t){let e,i=/@in\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function Fp(r,t,e=!1){let i=[];Lv(t,i),r.forEach(a=>{a.header&&Lv(a.header,i)});let s=i;e&&s.sort();let o=s.map((a,l)=>` @location(${l}) ${a},`).join(` -`),n=t.replace(/@in\s+[^;]+;\s*/g,"");return n=n.replace("{{in}}",` + `}var sT=y(()=>{"use strict"});function oT(r,e,t){let i=t?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let s=t?e.requestedFragmentPrecision:e.requestedVertexPrecision;return s==="highp"&&i!=="highp"&&(s="mediump"),`precision ${s} float; +${r}`}else if(i!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var nT=y(()=>{"use strict"});function aT(r,e){return e?`#version 300 es +${r}`:r}var lT=y(()=>{"use strict"});function cT(r,{name:e="pixi-program"},t=!0){e=e.replace(/\s+/g,"-"),e+=t?"-fragment":"-vertex";let i=t?N2:H2;return i[e]?(i[e]++,e+=`-${i[e]}`):i[e]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${e}`} +${r}`}var N2,H2,uT=y(()=>{"use strict";N2={},H2={}});function hT(r,e){return e?r.replace("#version 300 es",""):r}var dT=y(()=>{"use strict"});var $m,Xm,fT,gr,As=y(()=>{Ua();rT();sT();nT();lT();uT();dT();$m={stripVersion:hT,ensurePrecision:oT,addProgramDefines:iT,setProgramName:cT,insertVersion:aT},Xm=Object.create(null),fT=class jm{constructor(e){e={...jm.defaultOptions,...e};let t=e.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:t,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:tT()},setProgramName:{name:e.name},addProgramDefines:t,insertVersion:t},s=e.fragment,o=e.vertex;Object.keys($m).forEach(n=>{let a=i[n];s=$m[n](s,a,!0),o=$m[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=xi(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(e){let t=`${e.vertex}:${e.fragment}`;return Xm[t]||(Xm[t]=new jm(e)),Xm[t]}};fT.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};gr=fT});function Yt(r){return pT[r]??pT.float32}var pT,Ps=y(()=>{"use strict";pT={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function mT({source:r,entryPoint:e}){let t={},i=r.indexOf(`fn ${e}`);if(i!==-1){let s=r.indexOf("->",i);if(s!==-1){let o=r.substring(i,s),n=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,a;for(;(a=n.exec(o))!==null;){let l=V2[a[3]]??"float32";t[a[2]]={location:parseInt(a[1],10),format:l,stride:Yt(l).stride,offset:0,instance:!1,start:0}}}}return t}var V2,gT=y(()=>{Ps();V2={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"}});function lh(r){let e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,t=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,c=r.match(e)?.map(h=>({group:parseInt(h.match(t)[1],10),binding:parseInt(h.match(i)[1],10),name:h.match(s)[2],isUniform:h.match(s)[1]==="",type:h.match(o)[1]}));if(!c)return{groups:[],structs:[]};let u=r.match(n)?.map(h=>{let d=h.match(l)[1],f=h.match(a).reduce((p,m)=>{let[g,_]=m.split(":");return p[g.trim()]=_.trim(),p},{});return f?{name:d,members:f}:null}).filter(({name:h})=>c.some(d=>d.type===h))??[];return{groups:c,structs:u}}var xT=y(()=>{"use strict"});var Io,yT=y(()=>{"use strict";Io=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(Io||{})});function _T({groups:r}){let e=[];for(let t=0;t{yT()});function vT({groups:r}){let e=[];for(let t=0;t{"use strict"});function ST(r,e){let t=new Set,i=new Set,s=[...r.structs,...e.structs].filter(n=>t.has(n.name)?!1:(t.add(n.name),!0)),o=[...r.groups,...e.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:s,groups:o}}var wT=y(()=>{"use strict"});var Ym,xr,Bo=y(()=>{Ua();gT();xT();bT();TT();wT();Ym=Object.create(null),xr=class r{constructor(e){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:t,vertex:i,layout:s,gpuLayout:o,name:n}=e;if(this.name=n,this.fragment=t,this.vertex=i,t.source===i.source){let a=lh(t.source);this.structsAndGroups=a}else{let a=lh(i.source),l=lh(t.source);this.structsAndGroups=ST(a,l)}this.layout=s??vT(this.structsAndGroups),this.gpuLayout=o??_T(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:e,fragment:t}=this,i=e.source+t.source+e.entryPoint+t.entryPoint;this._layoutKey=xi(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=mT(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(e){let t=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return Ym[t]||(Ym[t]=new r(e)),Ym[t]}}});function qm(r,e,t){if(r)for(let i in r){let s=i.toLocaleLowerCase(),o=e[s];if(o){let n=r[i];i==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),t&&o.push(`//----${t}----//`),o.push(n)}else W(`${i} placement hook does not exist in shader`)}}var ET=y(()=>{Ae()});function Km(r){let e={};return(r.match(W2)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{e[i]=[]}),e}var W2,AT=y(()=>{"use strict";W2=/\{\{(.*?)\}\}/g});function PT(r,e){let t,i=/@in\s+([^;]+);/g;for(;(t=i.exec(r))!==null;)e.push(t[1])}function Zm(r,e,t=!1){let i=[];PT(e,i),r.forEach(a=>{a.header&&PT(a.header,i)});let s=i;t&&s.sort();let o=s.map((a,l)=>` @location(${l}) ${a},`).join(` +`),n=e.replace(/@in\s+[^;]+;\s*/g,"");return n=n.replace("{{in}}",` ${o} -`),n}var Dv=x(()=>{"use strict"});function Nv(r,t){let e,i=/@out\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function KB(r){let e=/\b(\w+)\s*:/g.exec(r);return e?e[1]:""}function ZB(r){let t=/@.*?\s+/g;return r.replace(t,"")}function Hv(r,t){let e=[];Nv(t,e),r.forEach(l=>{l.header&&Nv(l.header,e)});let i=0,s=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`, -`),o=e.sort().map(l=>` var ${ZB(l)};`).join(` +`),n}var CT=y(()=>{"use strict"});function MT(r,e){let t,i=/@out\s+([^;]+);/g;for(;(t=i.exec(r))!==null;)e.push(t[1])}function z2(r){let t=/\b(\w+)\s*:/g.exec(r);return t?t[1]:""}function $2(r){let e=/@.*?\s+/g;return r.replace(e,"")}function RT(r,e){let t=[];MT(e,t),r.forEach(l=>{l.header&&MT(l.header,t)});let i=0,s=t.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`, +`),o=t.sort().map(l=>` var ${$2(l)};`).join(` `),n=`return VSOutput( - ${e.sort().map(l=>` ${KB(l)}`).join(`, -`)});`,a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",` + ${t.sort().map(l=>` ${z2(l)}`).join(`, +`)});`,a=e.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",` ${s} `),a=a.replace("{{start}}",` ${o} `),a=a.replace("{{return}}",` ${n} -`),a}var Vv=x(()=>{"use strict"});function kp(r,t){let e=r;for(let i in t){let s=t[i];s.join(` -`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----// +`),a}var IT=y(()=>{"use strict"});function Qm(r,e){let t=r;for(let i in e){let s=e[i];s.join(` +`).length?t=t.replace(`{{${i}}}`,`//-----${i} START-----// ${s.join(` `)} -//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}var Wv=x(()=>{"use strict"});function zv({template:r,bits:t}){let e=Xv(r,t);if(Ii[e])return Ii[e];let{vertex:i,fragment:s}=JB(r,t);return Ii[e]=jv(i,s,t),Ii[e]}function $v({template:r,bits:t}){let e=Xv(r,t);return Ii[e]||(Ii[e]=jv(r.vertex,r.fragment,t)),Ii[e]}function JB(r,t){let e=t.map(n=>n.vertex).filter(n=>!!n),i=t.map(n=>n.fragment).filter(n=>!!n),s=Fp(e,r.vertex,!0);s=Hv(e,s);let o=Fp(i,r.fragment,!0);return{vertex:s,fragment:o}}function Xv(r,t){return t.map(e=>(Gp.has(e)||Gp.set(e,QB++),Gp.get(e))).sort((e,i)=>e-i).join("-")+r.vertex+r.fragment}function jv(r,t,e){let i=Bp(r),s=Bp(t);return e.forEach(o=>{Ip(o.vertex,i,o.name),Ip(o.fragment,s,o.name)}),{vertex:kp(r,i),fragment:kp(t,s)}}var Ii,Gp,QB,Yv=x(()=>{Uv();Ov();Dv();Vv();Wv();Ii=Object.create(null),Gp=new Map,QB=0});var qv,Kv,Zv,Qv,Jv=x(()=>{"use strict";qv=` +//----${i} FINISH----//`):t=t.replace(`{{${i}}}`,"")}return t}var BT=y(()=>{"use strict"});function kT({template:r,bits:e}){let t=OT(r,e);if(zi[t])return zi[t];let{vertex:i,fragment:s}=j2(r,e);return zi[t]=UT(i,s,e),zi[t]}function FT({template:r,bits:e}){let t=OT(r,e);return zi[t]||(zi[t]=UT(r.vertex,r.fragment,e)),zi[t]}function j2(r,e){let t=e.map(n=>n.vertex).filter(n=>!!n),i=e.map(n=>n.fragment).filter(n=>!!n),s=Zm(t,r.vertex,!0);s=RT(t,s);let o=Zm(i,r.fragment,!0);return{vertex:s,fragment:o}}function OT(r,e){return e.map(t=>(Jm.has(t)||Jm.set(t,X2++),Jm.get(t))).sort((t,i)=>t-i).join("-")+r.vertex+r.fragment}function UT(r,e,t){let i=Km(r),s=Km(e);return t.forEach(o=>{qm(o.vertex,i,o.name),qm(o.fragment,s,o.name)}),{vertex:Qm(r,i),fragment:Qm(e,s)}}var zi,Jm,X2,GT=y(()=>{ET();AT();CT();IT();BT();zi=Object.create(null),Jm=new Map,X2=0});var LT,DT,NT,HT,VT=y(()=>{"use strict";LT=` @in aPosition: vec2; @in aUV: vec2; @@ -97,7 +97,7 @@ ${s.join(` {{return}} }; -`,Kv=` +`,DT=` @in vUV : vec2; @in vColor : vec4; @@ -120,7 +120,7 @@ ${s.join(` return finalColor; }; -`,Zv=` +`,NT=` in vec2 aPosition; in vec2 aUV; @@ -156,7 +156,7 @@ ${s.join(` {{end}} } -`,Qv=` +`,HT=` in vec4 vColor; in vec2 vUV; @@ -177,7 +177,7 @@ ${s.join(` {{end}} } -`});var t0,e0,r0=x(()=>{"use strict";t0={name:"global-uniforms-bit",vertex:{header:` +`});var WT,zT,$T=y(()=>{"use strict";WT={name:"global-uniforms-bit",vertex:{header:` struct GlobalUniforms { uProjectionMatrix:mat3x3, uWorldTransformMatrix:mat3x3, @@ -186,22 +186,22 @@ ${s.join(` } @group(0) @binding(0) var globalUniforms : GlobalUniforms; - `}},e0={name:"global-uniforms-bit",vertex:{header:` + `}},zT={name:"global-uniforms-bit",vertex:{header:` uniform mat3 uProjectionMatrix; uniform mat3 uWorldTransformMatrix; uniform vec4 uWorldColorAlpha; uniform vec2 uResolution; - `}}});function kr({bits:r,name:t}){let e=zv({template:{fragment:Kv,vertex:qv},bits:[t0,...r]});return hr.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Gr({bits:r,name:t}){return new lr({name:t,...$v({template:{vertex:Zv,fragment:Qv},bits:[e0,...r]})})}var Bi=x(()=>{ls();ao();Yv();Jv();r0()});var lo,ho,Jn=x(()=>{"use strict";lo={name:"color-bit",vertex:{header:` + `}}});function Wr({bits:r,name:e}){let t=kT({template:{fragment:DT,vertex:LT},bits:[WT,...r]});return xr.from({name:e,vertex:{source:t.vertex,entryPoint:"main"},fragment:{source:t.fragment,entryPoint:"main"}})}function zr({bits:r,name:e}){return new gr({name:e,...FT({template:{vertex:NT,fragment:HT},bits:[zT,...r]})})}var $i=y(()=>{As();Bo();GT();VT();$T()});var ko,Fo,Ga=y(()=>{"use strict";ko={name:"color-bit",vertex:{header:` @in aColor: vec4; `,main:` vColor *= vec4(aColor.rgb * aColor.a, aColor.a); - `}},ho={name:"color-bit",vertex:{header:` + `}},Fo={name:"color-bit",vertex:{header:` in vec4 aColor; `,main:` vColor *= vec4(aColor.rgb * aColor.a, aColor.a); - `}}});function tF(r){let t=[];if(r===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let i=0;i;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(` -`)}function eF(r){let t=[];if(r===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let t=0;for(let i=0;i;`),e.push(`@group(1) @binding(${t++}) var textureSampler${i+1}: sampler;`)}return e.join(` +`)}function q2(r){let e=[];if(r===1)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let t=0;t; @out @interpolate(flat) vTextureId : u32; `,main:` @@ -214,14 +214,14 @@ ${s.join(` `},fragment:{header:` @in @interpolate(flat) vTextureId: u32; - ${tF(r)} + ${Y2(r)} `,main:` var uvDx = dpdx(vUV); var uvDy = dpdy(vUV); - ${eF(r)} - `}}),Up[r]}function rF(r){let t=[];for(let e=0;e0&&t.push("else"),e0&&e.push("else"),t{"use strict";Up={};Op={}});var Ur,Or,Fi=x(()=>{"use strict";Ur={name:"round-pixels-bit",vertex:{header:` + ${K2(r)} + `}}),tg[r]}var eg,tg,La=y(()=>{"use strict";eg={};tg={}});var $r,Xr,Xi=y(()=>{"use strict";$r={name:"round-pixels-bit",vertex:{header:` fn roundPixels(position: vec2, targetSize: vec2) -> vec2 { return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; } - `}},Or={name:"round-pixels-bit",vertex:{header:` + `}},Xr={name:"round-pixels-bit",vertex:{header:` vec2 roundPixels(vec2 position, vec2 targetSize) { return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; } - `}}});var Lp,i0,s0=x(()=>{"use strict";Lp=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4","vec2","vec3","vec4"],i0=Lp.reduce((r,t)=>(r[t]=!0,r),{})});function o0(r,t){switch(r){case"f32":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var n0=x(()=>{"use strict"});var a0,Ct,Ge=x(()=>{Te();Qn();s0();n0();a0=class l0{constructor(t,e){this._touched=0,this.uid=ut("uniform"),this._resourceType="uniformGroup",this._resourceId=ut("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...l0.defaultOptions,...e},this.uniformStructures=t;let i={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!i0[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Lp.join(", ")}`);o.value??(o.value=o0(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ni(Object.keys(i).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};a0.defaultOptions={ubo:!1,isStatic:!1};Ct=a0});function fo(r){let t=h0[r];if(t)return t;let e=new Int32Array(r);for(let i=0;i{Ge();h0={}});var re,Lr=x(()=>{"use strict";re=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(re||{})});var qt,br=x(()=>{Ae();Te();ls();Ri();ao();Lr();Ge();qt=class r extends It{constructor(t){super(),this.uid=ut("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,n===void 0&&(n=0,e&&(n|=re.WEBGPU),i&&(n|=re.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let h in a)for(let c in a[h]){let u=a[h][c];l[u]={group:h,binding:c,name:u}}else if(e&&s&&!a){let h=e.structsAndGroups.groups;a={},h.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let c in o)l[c]||(s[99]||(s[99]=new xe,this._ownedBindGroups.push(s[99])),l[c]={group:99,binding:h,name:c},a[99]=a[99]||{},a[99][h]=c,h++);for(let c in o){let u=c,d=o[c];!d.source&&!d._resourceType&&(d=new Ct(d));let f=l[u];f&&(s[f.group]||(s[f.group]=new xe,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,i){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[i]||(o[i]=t),this.groups[e]||(this.groups[e]=new xe,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let i={};for(let s in e){let o=e[s];Object.defineProperty(i,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return i}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=hr.from(e)),i&&(n=lr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var yc,c0=x(()=>{Bi();Jn();ta();Fi();xc();br();yc=class extends qt{constructor(t){let e=Gr({name:"batch",bits:[ho,uo(t),Or]}),i=kr({name:"batch",bits:[lo,co(t),Ur]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:fo(t)}})}}});var u0,d0,ea,Dp=x(()=>{B();nv();cv();c0();u0=null,d0=class f0 extends ov{constructor(){super(...arguments),this.geometry=new pc,this.shader=u0||(u0=new yc(this.maxTextures)),this.name=f0.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,h=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:m,uvs:g}=t,p=t.color,b=t.attributeOffset,y=b+t.attributeSize;for(let _=b;_{"use strict"});function Np(r,t,e,i,s){let o=t.a,n=t.b,a=t.c,l=t.d,h=t.tx,c=t.ty;e||(e=0),i||(i=2),s||(s=r.length/i-e);let u=e*i;for(let d=0;d{"use strict"});var iF,cs,Hp=x(()=>{gt();Ff();iF=new k,cs=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Vh(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||iF}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var po,y0,_0,b0=x(()=>{B();po={extension:{type:v.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,o,n,a;if(r.type==="circle"){let S=r;e=S.x,i=S.y,n=a=S.radius,s=o=0}else if(r.type==="ellipse"){let S=r;e=S.x,i=S.y,n=S.halfWidth,a=S.halfHeight,s=o=0}else{let S=r,E=S.width/2,w=S.height/2;e=S.x+E,i=S.y+w,n=a=Math.max(0,Math.min(S.radius,Math.min(E,w))),s=E-n,o=w-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let l=Math.ceil(2.3*Math.sqrt(n+a)),h=l*8+(s?4:0)+(o?4:0);if(h===0)return t;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=i+o,t[2]=t[4]=e-s,t[5]=t[7]=i-o,t;let c=0,u=l*4+(s?2:0)+2,d=u,f=h,m=s+n,g=o,p=e+m,b=e-m,y=i+g;if(t[c++]=p,t[c++]=y,t[--u]=y,t[--u]=b,o){let S=i-g;t[d++]=b,t[d++]=S,t[--f]=S,t[--f]=p}for(let S=1;S0&&(s[o++]=l,s[o++]=h,s[o++]=l-1),l++;s[o++]=h+1,s[o++]=h,s[o++]=l-1}},y0={...po,extension:{...po.extension,name:"ellipse"}},_0={...po,extension:{...po.extension,name:"roundedRectangle"}}});function v0(r){let t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],o=r[t-1];i{"use strict"});function S0(r,t,e,i,s,o,n,a){let l=r-e*s,h=t-i*s,c=r+e*o,u=t+i*o,d,f;n?(d=i,f=-e):(d=-i,f=e);let m=l+d,g=h+f,p=c+d,b=u+f;return a.push(m,g),a.push(p,b),2}function us(r,t,e,i,s,o,n,a){let l=e-r,h=i-t,c=Math.atan2(l,h),u=Math.atan2(s-r,o-t);a&&cu&&(u+=Math.PI*2);let d=c,f=u-c,m=Math.abs(f),g=Math.sqrt(l*l+h*h),p=(15*m*Math.sqrt(g)/Math.PI>>0)+1,b=f/p;if(d+=b,a){n.push(r,t),n.push(e,i);for(let y=1,_=d;y=0&&(a.join==="round"?g+=us(w,T,w-P*U,T-R*U,w-I*U,T-F*U,f,!1)+4:g+=2,f.push(w-I*$,T-F*$),f.push(w+I*U,T+F*U));continue}let mt=(-P+S)*(-R+T)-(-P+w)*(-R+E),St=(-I+C)*(-F+T)-(-I+w)*(-F+A),ct=(W*St-et*mt)/Mt,Bt=(yt*mt-tt*St)/Mt,ne=(ct-w)*(ct-w)+(Bt-T)*(Bt-T),Zt=w+(ct-w)*U,pe=T+(Bt-T)*U,xr=w-(ct-w)*$,Yi=T-(Bt-T)*$,KI=Math.min(W*W+tt*tt,et*et+yt*yt),Xy=Wt?U:$,ZI=KI+Xy*Xy*y;ne<=ZI?a.join==="bevel"||ne/y>_?(Wt?(f.push(Zt,pe),f.push(w+P*$,T+R*$),f.push(Zt,pe),f.push(w+I*$,T+F*$)):(f.push(w-P*U,T-R*U),f.push(xr,Yi),f.push(w-I*U,T-F*U),f.push(xr,Yi)),g+=2):a.join==="round"?Wt?(f.push(Zt,pe),f.push(w+P*$,T+R*$),g+=us(w,T,w+P*$,T+R*$,w+I*$,T+F*$,f,!0)+4,f.push(Zt,pe),f.push(w+I*$,T+F*$)):(f.push(w-P*U,T-R*U),f.push(xr,Yi),g+=us(w,T,w-P*U,T-R*U,w-I*U,T-F*U,f,!1)+4,f.push(w-I*U,T-F*U),f.push(xr,Yi)):(f.push(Zt,pe),f.push(xr,Yi)):(f.push(w-P*U,T-R*U),f.push(w+P*$,T+R*$),a.join==="round"?Wt?g+=us(w,T,w+P*$,T+R*$,w+I*$,T+F*$,f,!0)+2:g+=us(w,T,w-P*U,T-R*U,w-I*U,T-F*U,f,!1)+2:a.join==="miter"&&ne/y<=_&&(Wt?(f.push(xr,Yi),f.push(xr,Yi)):(f.push(Zt,pe),f.push(Zt,pe)),g+=2),f.push(w-I*U,T-F*U),f.push(w+I*$,T+F*$),g+=2)}S=r[(m-2)*2],E=r[(m-2)*2+1],w=r[(m-1)*2],T=r[(m-1)*2+1],P=-(E-T),R=S-w,G=Math.sqrt(P*P+R*R),P/=G,R/=G,P*=b,R*=b,f.push(w-P*U,T-R*U),f.push(w+P*$,T+R*$),u||(a.cap==="round"?g+=us(w-P*(U-$)*.5,T-R*(U-$)*.5,w-P*U,T-R*U,w+P*$,T+R*$,f,!1)+2:a.cap==="square"&&(g+=S0(w,T,P,R,U,$,!1,f)));let V=1e-4*1e-4;for(let O=p;O{or();T0()});function A0(r,t,e,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],h=t||Math.abs(o-a){});var Sc=J((b5,$p)=>{"use strict";$p.exports=vc;$p.exports.default=vc;function vc(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,o=R0(r,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,h,c,u,d,f;if(i&&(o=cF(r,t,o,e)),r.length>80*e){a=h=r[0],l=c=r[1];for(var m=e;mh&&(h=u),d>c&&(c=d);f=Math.max(h-a,c-l),f=f!==0?32767/f:0}return ra(o,n,e,a,l,f,0),n}function R0(r,t,e,i,s){var o,n;if(s===zp(r,t,e,i)>0)for(o=t;o=t;o-=i)n=C0(o,r[o],r[o+1],n);return n&&Tc(n,n.next)&&(sa(n),n=n.next),n}function ds(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Tc(e,e.next)||Xt(e.prev,e,e.next)===0)){if(sa(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function ra(r,t,e,i,s,o,n){if(r){!n&&o&&mF(r,i,s,o);for(var a=r,l,h;r.prev!==r.next;){if(l=r.prev,h=r.next,o?aF(r,i,s,o):nF(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(h.i/e|0),sa(r),r=h.next,a=h.next;continue}if(r=h,r===a){n?n===1?(r=lF(ds(r),t,e),ra(r,t,e,i,s,o,2)):n===2&&hF(r,t,e,i,s,o):ra(ds(r),t,e,i,s,o,1);break}}}}function nF(r){var t=r.prev,e=r,i=r.next;if(Xt(t,e,i)>=0)return!1;for(var s=t.x,o=e.x,n=i.x,a=t.y,l=e.y,h=i.y,c=so?s>n?s:n:o>n?o:n,f=a>l?a>h?a:h:l>h?l:h,m=i.next;m!==t;){if(m.x>=c&&m.x<=d&&m.y>=u&&m.y<=f&&mo(s,a,o,l,n,h,m.x,m.y)&&Xt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function aF(r,t,e,i){var s=r.prev,o=r,n=r.next;if(Xt(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,h=n.x,c=s.y,u=o.y,d=n.y,f=al?a>h?a:h:l>h?l:h,p=c>u?c>d?c:d:u>d?u:d,b=Vp(f,m,t,e,i),y=Vp(g,p,t,e,i),_=r.prevZ,S=r.nextZ;_&&_.z>=b&&S&&S.z<=y;){if(_.x>=f&&_.x<=g&&_.y>=m&&_.y<=p&&_!==s&&_!==n&&mo(a,c,l,u,h,d,_.x,_.y)&&Xt(_.prev,_,_.next)>=0||(_=_.prevZ,S.x>=f&&S.x<=g&&S.y>=m&&S.y<=p&&S!==s&&S!==n&&mo(a,c,l,u,h,d,S.x,S.y)&&Xt(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;_&&_.z>=b;){if(_.x>=f&&_.x<=g&&_.y>=m&&_.y<=p&&_!==s&&_!==n&&mo(a,c,l,u,h,d,_.x,_.y)&&Xt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;S&&S.z<=y;){if(S.x>=f&&S.x<=g&&S.y>=m&&S.y<=p&&S!==s&&S!==n&&mo(a,c,l,u,h,d,S.x,S.y)&&Xt(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function lF(r,t,e){var i=r;do{var s=i.prev,o=i.next.next;!Tc(s,o)&&M0(s,i,i.next,o)&&ia(s,o)&&ia(o,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(o.i/e|0),sa(i),sa(i.next),i=r=o),i=i.next}while(i!==r);return ds(i)}function hF(r,t,e,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&yF(n,a)){var l=I0(n,a);n=ds(n,n.next),l=ds(l,l.next),ra(n,t,e,i,s,o,0),ra(l,t,e,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function cF(r,t,e,i){var s=[],o,n,a,l,h;for(o=0,n=t.length;o=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>o&&(o=a,n=e.x=e.x&&e.x>=h&&i!==e.x&&mo(sn.x||e.x===n.x&&pF(n,e)))&&(n=e,u=d)),e=e.next;while(e!==l);return n}function pF(r,t){return Xt(r.prev,r,t.prev)<0&&Xt(t.next,r,r.next)<0}function mF(r,t,e,i){var s=r;do s.z===0&&(s.z=Vp(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,gF(s)}function gF(r){var t,e,i,s,o,n,a,l,h=1;do{for(e=r,r=null,o=null,n=0;e;){for(n++,i=e,a=0,t=0;t0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;e=i}o.nextZ=null,h*=2}while(n>1);return r}function Vp(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function xF(r){var t=r,e=r;do(t.x=(r-n)*(o-a)&&(r-n)*(i-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(i-a)}function yF(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!_F(r,t)&&(ia(r,t)&&ia(t,r)&&bF(r,t)&&(Xt(r.prev,r,t.prev)||Xt(r,t.prev,t))||Tc(r,t)&&Xt(r.prev,r,r.next)>0&&Xt(t.prev,t,t.next)>0)}function Xt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Tc(r,t){return r.x===t.x&&r.y===t.y}function M0(r,t,e,i){var s=bc(Xt(r,t,e)),o=bc(Xt(r,t,i)),n=bc(Xt(e,i,r)),a=bc(Xt(e,i,t));return!!(s!==o&&n!==a||s===0&&_c(r,e,t)||o===0&&_c(r,i,t)||n===0&&_c(e,r,i)||a===0&&_c(e,t,i))}function _c(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function bc(r){return r>0?1:r<0?-1:0}function _F(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&M0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function ia(r,t){return Xt(r.prev,r,r.next)<0?Xt(r,t,r.next)>=0&&Xt(r,r.prev,t)>=0:Xt(r,t,r.prev)<0||Xt(r,r.next,t)<0}function bF(r,t){var e=r,i=!1,s=(r.x+t.x)/2,o=(r.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function I0(r,t){var e=new Wp(r.i,r.x,r.y),i=new Wp(t.i,t.x,t.y),s=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function C0(r,t,e,i){var s=new Wp(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function sa(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Wp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}vc.deviation=function(r,t,e,i){var s=t&&t.length,o=s?t[0]*e:r.length,n=Math.abs(zp(r,0,o,e));if(s)for(var a=0,l=t.length;a0&&(i+=r[s-1].length,e.holes.push(i))}return e}});function wc(r,t,e,i,s,o,n){let a=(0,B0.default)(r,t,2);if(!a)return;for(let h=0;h{B0=qi(Sc(),1)});var vF,F0,k0=x(()=>{B();Xp();vF=[],F0={extension:{type:v.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e{B();G0={extension:{type:v.ShapeBuilder,name:"rectangle"},build(r,t){let e=r,i=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=i,t[1]=s,t[2]=i+o,t[3]=s,t[4]=i+o,t[5]=s+n,t[6]=i,t[7]=s+n),t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[6],t[i+n+1]=r[7],n+=e,t[i+n]=r[4],t[i+n+1]=r[5],n+=e;let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var O0,L0=x(()=>{B();O0={extension:{type:v.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,o){let n=0;i*=e,t[i+n]=r[0],t[i+n+1]=r[1],n+=e,t[i+n]=r[2],t[i+n+1]=r[3],n+=e,t[i+n]=r[4],t[i+n+1]=r[5];let a=i/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function N0(r,t){for(let e=0;e{be();Ft();gt();eo();vt();Te();zt();Df();D0=[{offset:0,color:"white"},{offset:1,color:"black"}],Yp=class jp{constructor(...t){this.uid=ut("fillGradient"),this.type="linear",this.colorStops=[];let e=TF(t);e={...e.type==="radial"?jp.defaultRadialOptions:jp.defaultLinearOptions,...zh(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:nt.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:s}=this.end,o=i-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let p=t;t=i,i=p,o*=-1}if(n<0){let p=e;e=s,s=p,n*=-1}}let l=this.colorStops.length?this.colorStops:D0,h=this._textureSize,{canvas:c,context:u}=H0(h,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);N0(d,l),u.fillStyle=d,u.fillRect(0,0,h,1),this.texture=new M({source:new Ve({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),g=new k;g.scale(f/h,1),g.rotate(m),g.translate(t,e),this.textureSpace==="local"&&g.scale(h,h),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:D0,e=this._textureSize,{canvas:i,context:s}=H0(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,h=this.innerRadius,c=this.outerRadius,u=a-c,d=l-c,f=e/(c*2),m=(o-u)*f,g=(n-d)*f,p=s.createRadialGradient(m,g,h*f,(a-u)*f,(l-d)*f,c*f);N0(p,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=p,s.translate(m,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-g),s.fillRect(0,0,e,e),this.texture=new M({source:new Ve({resource:i,addressMode:this._wrapMode})});let b=new k;b.scale(1/f,1/f),b.translate(u,d),this.textureSpace==="local"&&b.scale(e,e),this.transform=b}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Yp.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Yp.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};ze=Yp});function V0(r,t,e,i){let s=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){let n=e.getBounds(wF);t.width&&n.pad(t.width);let{x:a,y:l}=n,h=1/n.width,c=1/n.height,u=-a*h,d=-l*c,f=s.a,m=s.b,g=s.c,p=s.d;s.a*=h,s.b*=h,s.c*=c,s.d*=c,s.tx=u*f+d*g+s.tx,s.ty=u*m+d*p+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof ze)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(SF.copyFrom(i).invert()),s}var SF,wF,W0=x(()=>{gt();ae();go();SF=new k,wF=new ot});function $0(r,t){let{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s{let u=a.length,d=o.length/2,f=[],m=Ec[l.type],g="triangle-list";if(m.build(l,f),h&&Np(f,h),e){let _=l.closePath??!0,S=t;S.pixelLine?(A0(f,_,o,a),g="line-list"):w0(f,S,!1,_,o,a)}else if(c){let _=[],S=f.slice();CF(c).forEach(w=>{_.push(S.length/2),S.push(...w)}),wc(S,_,o,2,d,a,u)}else m.triangulate(f,o,2,d,a,u);let p=n.length/2,b=t.texture;if(b!==M.WHITE){let _=V0(AF,t,l,h);p0(o,2,d,n,p,2,o.length/2-d,_)}else m0(n,p,2,o.length/2-d);let y=st.get(cs);y.indexOffset=u,y.indexSize=a.length-u,y.attributeOffset=d,y.attributeSize=o.length/2-d,y.baseColor=t.color,y.alpha=t.alpha,y.texture=b,y.geometryData=s,y.topology=g,i.push(y)})}function CF(r){let t=[];for(let e=0;e{B();gt();ae();g0();x0();vt();Be();Hp();b0();E0();P0();k0();U0();L0();W0();Xp();Ec={};L.handleByMap(v.ShapeBuilder,Ec);L.add(G0,F0,O0,po,y0,_0);EF=new ot,AF=new k});var qp,Kp,Qp,xo,Ac=x(()=>{B();uc();Dp();Of();zt();Be();X0();qp=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Kp=class{constructor(){this.batcher=new ea,this.instructions=new js}init(){this.instructions.reset()}get geometry(){return j(f_,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Qp=class Zp{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Zp.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Zp.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),$0(t,e);let i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=st.get(Kp),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c{st.return(i)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};Qp.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"graphicsContext"};Qp.defaultOptions={bezierSmoothness:.5};xo=Qp});var RF,Jp,tm,em,rm,im,sm,om,Qt,vr=x(()=>{"use strict";RF={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Jp=0,tm=1,em=2,rm=3,im=4,sm=5,om=class j0{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}var yo=x(()=>{"use strict"});var oa,Y0=x(()=>{B();vr();Be();yo();Hp();oa=class{constructor(t,e){this.state=Qt.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i{let a=st.get(cs);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{st.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};oa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"graphics"}});var nm=x(()=>{B();Ac();Y0();L.add(oa);L.add(xo)});var ki,Pc=x(()=>{"use strict";ki=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let e=this.geometry.getBuffer("aUV"),i=e.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length{B();gt();Ri();Ge();Kn();Be();yo();Pc();na=class{constructor(t,e){this.localUniforms=new Ct({uTransformMatrix:{value:new k,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new xe({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),i=e.batched,s=t.batched;if(e.batched=s,i!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,i.addToBatch(o,e)}else i.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(st.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=si(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Dr(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=st.get(ki);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&st.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};na.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"mesh"}});var am=x(()=>{B();q0();L.add(na)});var Cc,K0=x(()=>{"use strict";Cc=class{execute(t,e){let i=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(i),s.geometry.bind(a.geometry,o.glProgram);let h=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,h,0)}}});function lm(r,t=null){let e=r*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i{"use strict"});function J0(r){return{dynamicUpdate:Q0(r,!0),staticUpdate:Q0(r,!1)}}function Q0(r,t){let e=[];e.push(` + `}}});var rg,XT,jT=y(()=>{"use strict";rg=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4","vec2","vec3","vec4"],XT=rg.reduce((r,e)=>(r[e]=!0,r),{})});function YT(r,e){switch(r){case"f32":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var qT=y(()=>{"use strict"});var KT,be,It=y(()=>{wt();Ua();jT();qT();KT=class ZT{constructor(e,t){this._touched=0,this.uid=he("uniform"),this._resourceType="uniformGroup",this._resourceId=he("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,t={...ZT.defaultOptions,...t},this.uniformStructures=e;let i={};for(let s in e){let o=e[s];if(o.name=s,o.size=o.size??1,!XT[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${rg.join(", ")}`);o.value??(o.value=YT(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=t.ubo,this.isStatic=t.isStatic,this._signature=xi(Object.keys(i).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};KT.defaultOptions={ubo:!1,isStatic:!1};be=KT});function Go(r){let e=QT[r];if(e)return e;let t=new Int32Array(r);for(let i=0;i{It();QT={}});var ot,jr=y(()=>{"use strict";ot=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(ot||{})});var Ze,Mr=y(()=>{Mt();wt();As();Vi();Bo();jr();It();Ze=class r extends Ce{constructor(e){super(),this.uid=he("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:t,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=e;this.gpuProgram=t,this.glProgram=i,n===void 0&&(n=0,t&&(n|=ot.WEBGPU),i&&(n|=ot.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!t&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!t&&s&&a)for(let c in a)for(let u in a[c]){let h=a[c][u];l[h]={group:c,binding:u,name:h}}else if(t&&s&&!a){let c=t.structsAndGroups.groups;a={},c.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u})}else if(o){s={},a={},t&&t.structsAndGroups.groups.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[h.name]=h});let c=0;for(let u in o)l[u]||(s[99]||(s[99]=new gt,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:c,name:u},a[99]=a[99]||{},a[99][c]=u,c++);for(let u in o){let h=u,d=o[u];!d.source&&!d._resourceType&&(d=new be(d));let f=l[h];f&&(s[f.group]||(s[f.group]=new gt,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(e,t,i){var s,o;(s=this._uniformBindMap)[t]||(s[t]={}),(o=this._uniformBindMap[t])[i]||(o[i]=e),this.groups[t]||(this.groups[t]=new gt,this._ownedBindGroups.push(this.groups[t]))}_buildResourceAccessor(e,t){let i={};for(let s in t){let o=t[s];Object.defineProperty(i,o.name,{get(){return e[o.group].getResource(o.binding)},set(n){e[o.group].setResource(n,o.binding)}})}return i}destroy(e=!1){this.emit("destroy",this),e&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(t=>{t.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(e){let{gpu:t,gl:i,...s}=e,o,n;return t&&(o=xr.from(t)),i&&(n=gr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var uh,JT=y(()=>{$i();Ga();La();Xi();ch();Mr();uh=class extends Ze{constructor(e){let t=zr({name:"batch",bits:[Fo,Uo(e),Xr]}),i=Wr({name:"batch",bits:[ko,Oo(e),$r]});super({glProgram:t,gpuProgram:i,resources:{batchSamplers:Go(e)}})}}});var eS,tS,Da,ig=y(()=>{U();q0();J0();JT();eS=null,tS=class rS extends Y0{constructor(){super(...arguments),this.geometry=new nh,this.shader=eS||(eS=new uh(this.maxTextures)),this.name=rS.extension.name,this.vertexSize=6}packAttributes(e,t,i,s,o){let n=o<<16|e.roundPixels&65535,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=e,g=e.color,_=e.attributeOffset,v=_+e.attributeSize;for(let x=_;x{"use strict"});function sg(r,e,t,i,s){let o=e.a,n=e.b,a=e.c,l=e.d,c=e.tx,u=e.ty;t||(t=0),i||(i=2),s||(s=r.length/i-t);let h=t*i;for(let d=0;d{"use strict"});var Z2,Cs,og=y(()=>{ge();Zp();Z2=new G,Cs=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let e=this.baseColor,t=e>>16|e&65280|(e&255)<<16,i=this.renderable;return i?Fu(t,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||Z2}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var Lo,aS,lS,cS=y(()=>{U();Lo={extension:{type:S.ShapeBuilder,name:"circle"},build(r,e){let t,i,s,o,n,a;if(r.type==="circle"){let T=r;t=T.x,i=T.y,n=a=T.radius,s=o=0}else if(r.type==="ellipse"){let T=r;t=T.x,i=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=r,b=T.width/2,w=T.height/2;t=T.x+b,i=T.y+w,n=a=Math.max(0,Math.min(T.radius,Math.min(b,w))),s=b-n,o=w-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(n+a)),c=l*8+(s?4:0)+(o?4:0);if(c===0)return e;if(l===0)return e[0]=e[6]=t+s,e[1]=e[3]=i+o,e[2]=e[4]=t-s,e[5]=e[7]=i-o,e;let u=0,h=l*4+(s?2:0)+2,d=h,f=c,p=s+n,m=o,g=t+p,_=t-p,v=i+m;if(e[u++]=g,e[u++]=v,e[--h]=v,e[--h]=_,o){let T=i-m;e[d++]=_,e[d++]=T,e[--f]=T,e[--f]=g}for(let T=1;T0&&(s[o++]=l,s[o++]=c,s[o++]=l-1),l++;s[o++]=c+1,s[o++]=c,s[o++]=l-1}},aS={...Lo,extension:{...Lo.extension,name:"ellipse"}},lS={...Lo,extension:{...Lo.extension,name:"roundedRectangle"}}});function uS(r){let e=r.length;if(e<6)return 1;let t=0;for(let i=0,s=r[e-2],o=r[e-1];i{"use strict"});function dS(r,e,t,i,s,o,n,a){let l=r-t*s,c=e-i*s,u=r+t*o,h=e+i*o,d,f;n?(d=i,f=-t):(d=-i,f=t);let p=l+d,m=c+f,g=u+d,_=h+f;return a.push(p,m),a.push(g,_),2}function Ms(r,e,t,i,s,o,n,a){let l=t-r,c=i-e,u=Math.atan2(l,c),h=Math.atan2(s-r,o-e);a&&uh&&(h+=Math.PI*2);let d=u,f=h-u,p=Math.abs(f),m=Math.sqrt(l*l+c*c),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,a){n.push(r,e),n.push(t,i);for(let v=1,x=d;v=0&&(a.join==="round"?m+=Ms(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+4:m+=2,f.push(w-P*D,E-R*D),f.push(w+P*O,E+R*O));continue}let it=(-C+T)*(-A+E)-(-C+w)*(-A+b),bt=(-P+I)*(-R+E)-(-P+w)*(-R+B),Le=(Y*bt-J*it)/Me,vt=(Be*it-ue*bt)/Me,Ft=(Le-w)*(Le-w)+(vt-E)*(vt-E),Pt=w+(Le-w)*O,Ot=E+(vt-E)*O,Ar=w-(Le-w)*D,ds=E-(vt-E)*D,zF=Math.min(Y*Y+ue*ue,J*J+Be*Be),Ob=$e?O:D,$F=zF+Ob*Ob*v;Ft<=$F?a.join==="bevel"||Ft/v>x?($e?(f.push(Pt,Ot),f.push(w+C*D,E+A*D),f.push(Pt,Ot),f.push(w+P*D,E+R*D)):(f.push(w-C*O,E-A*O),f.push(Ar,ds),f.push(w-P*O,E-R*O),f.push(Ar,ds)),m+=2):a.join==="round"?$e?(f.push(Pt,Ot),f.push(w+C*D,E+A*D),m+=Ms(w,E,w+C*D,E+A*D,w+P*D,E+R*D,f,!0)+4,f.push(Pt,Ot),f.push(w+P*D,E+R*D)):(f.push(w-C*O,E-A*O),f.push(Ar,ds),m+=Ms(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+4,f.push(w-P*O,E-R*O),f.push(Ar,ds)):(f.push(Pt,Ot),f.push(Ar,ds)):(f.push(w-C*O,E-A*O),f.push(w+C*D,E+A*D),a.join==="round"?$e?m+=Ms(w,E,w+C*D,E+A*D,w+P*D,E+R*D,f,!0)+2:m+=Ms(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+2:a.join==="miter"&&Ft/v<=x&&($e?(f.push(Ar,ds),f.push(Ar,ds)):(f.push(Pt,Ot),f.push(Pt,Ot)),m+=2),f.push(w-P*O,E-R*O),f.push(w+P*D,E+R*D),m+=2)}T=r[(p-2)*2],b=r[(p-2)*2+1],w=r[(p-1)*2],E=r[(p-1)*2+1],C=-(b-E),A=T-w,M=Math.sqrt(C*C+A*A),C/=M,A/=M,C*=_,A*=_,f.push(w-C*O,E-A*O),f.push(w+C*D,E+A*D),h||(a.cap==="round"?m+=Ms(w-C*(O-D)*.5,E-A*(O-D)*.5,w-C*O,E-A*O,w+C*D,E+A*D,f,!1)+2:a.cap==="square"&&(m+=dS(w,E,C,A,O,D,!1,f)));let N=1e-4*1e-4;for(let L=g;L{fr();hS()});function mS(r,e,t,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],c=e||Math.abs(o-a){});var mh=ee((nj,cg)=>{"use strict";cg.exports=fh;cg.exports.default=fh;function fh(r,e,t){t=t||2;var i=e&&e.length,s=i?e[0]*t:r.length,o=yS(r,0,s,t,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,c,u,h,d,f;if(i&&(o=sO(r,e,o,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(var p=t;pc&&(c=h),d>u&&(u=d);f=Math.max(c-a,u-l),f=f!==0?32767/f:0}return Na(o,n,t,a,l,f,0),n}function yS(r,e,t,i,s){var o,n;if(s===lg(r,e,t,i)>0)for(o=e;o=e;o-=i)n=xS(o,r[o],r[o+1],n);return n&&ph(n,n.next)&&(Va(n),n=n.next),n}function Rs(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(ph(t,t.next)||Ye(t.prev,t,t.next)===0)){if(Va(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Na(r,e,t,i,s,o,n){if(r){!n&&o&&cO(r,i,s,o);for(var a=r,l,c;r.prev!==r.next;){if(l=r.prev,c=r.next,o?tO(r,i,s,o):eO(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),Va(r),r=c.next,a=c.next;continue}if(r=c,r===a){n?n===1?(r=rO(Rs(r),e,t),Na(r,e,t,i,s,o,2)):n===2&&iO(r,e,t,i,s,o):Na(Rs(r),e,t,i,s,o,1);break}}}}function eO(r){var e=r.prev,t=r,i=r.next;if(Ye(e,t,i)>=0)return!1;for(var s=e.x,o=t.x,n=i.x,a=e.y,l=t.y,c=i.y,u=so?s>n?s:n:o>n?o:n,f=a>l?a>c?a:c:l>c?l:c,p=i.next;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=h&&p.y<=f&&Do(s,a,o,l,n,c,p.x,p.y)&&Ye(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function tO(r,e,t,i){var s=r.prev,o=r,n=r.next;if(Ye(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,c=n.x,u=s.y,h=o.y,d=n.y,f=al?a>c?a:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,_=ng(f,p,e,t,i),v=ng(m,g,e,t,i),x=r.prevZ,T=r.nextZ;x&&x.z>=_&&T&&T.z<=v;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==n&&Do(a,u,l,h,c,d,x.x,x.y)&&Ye(x.prev,x,x.next)>=0||(x=x.prevZ,T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&Do(a,u,l,h,c,d,T.x,T.y)&&Ye(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;x&&x.z>=_;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==n&&Do(a,u,l,h,c,d,x.x,x.y)&&Ye(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;T&&T.z<=v;){if(T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&Do(a,u,l,h,c,d,T.x,T.y)&&Ye(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function rO(r,e,t){var i=r;do{var s=i.prev,o=i.next.next;!ph(s,o)&&_S(s,i,i.next,o)&&Ha(s,o)&&Ha(o,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(o.i/t|0),Va(i),Va(i.next),i=r=o),i=i.next}while(i!==r);return Rs(i)}function iO(r,e,t,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&dO(n,a)){var l=bS(n,a);n=Rs(n,n.next),l=Rs(l,l.next),Na(n,e,t,i,s,o,0),Na(l,e,t,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function sO(r,e,t,i){var s=[],o,n,a,l,c;for(o=0,n=e.length;o=t.next.y&&t.next.y!==t.y){var a=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>o&&(o=a,n=t.x=t.x&&t.x>=c&&i!==t.x&&Do(sn.x||t.x===n.x&&lO(n,t)))&&(n=t,h=d)),t=t.next;while(t!==l);return n}function lO(r,e){return Ye(r.prev,r,e.prev)<0&&Ye(e.next,r,r.next)<0}function cO(r,e,t,i){var s=r;do s.z===0&&(s.z=ng(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,uO(s)}function uO(r){var e,t,i,s,o,n,a,l,c=1;do{for(t=r,r=null,o=null,n=0;t;){for(n++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;t=i}o.nextZ=null,c*=2}while(n>1);return r}function ng(r,e,t,i,s){return r=(r-t)*s|0,e=(e-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function hO(r){var e=r,t=r;do(e.x=(r-n)*(o-a)&&(r-n)*(i-a)>=(t-n)*(e-a)&&(t-n)*(o-a)>=(s-n)*(i-a)}function dO(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!fO(r,e)&&(Ha(r,e)&&Ha(e,r)&&pO(r,e)&&(Ye(r.prev,r,e.prev)||Ye(r,e.prev,e))||ph(r,e)&&Ye(r.prev,r,r.next)>0&&Ye(e.prev,e,e.next)>0)}function Ye(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ph(r,e){return r.x===e.x&&r.y===e.y}function _S(r,e,t,i){var s=dh(Ye(r,e,t)),o=dh(Ye(r,e,i)),n=dh(Ye(t,i,r)),a=dh(Ye(t,i,e));return!!(s!==o&&n!==a||s===0&&hh(r,t,e)||o===0&&hh(r,i,e)||n===0&&hh(t,r,i)||a===0&&hh(t,e,i))}function hh(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function dh(r){return r>0?1:r<0?-1:0}function fO(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&_S(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ha(r,e){return Ye(r.prev,r,r.next)<0?Ye(r,e,r.next)>=0&&Ye(r,r.prev,e)>=0:Ye(r,e,r.prev)<0||Ye(r,r.next,e)<0}function pO(r,e){var t=r,i=!1,s=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&s<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function bS(r,e){var t=new ag(r.i,r.x,r.y),i=new ag(e.i,e.x,e.y),s=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=s,s.prev=t,i.next=t,t.prev=i,o.next=i,i.prev=o,i}function xS(r,e,t,i){var s=new ag(r,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Va(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function ag(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}fh.deviation=function(r,e,t,i){var s=e&&e.length,o=s?e[0]*t:r.length,n=Math.abs(lg(r,0,o,t));if(s)for(var a=0,l=e.length;a0&&(i+=r[s-1].length,t.holes.push(i))}return t}});function gh(r,e,t,i,s,o,n){let a=(0,vS.default)(r,e,2);if(!a)return;for(let c=0;c{vS=fs(mh(),1)});var mO,TS,SS=y(()=>{U();ug();mO=[],TS={extension:{type:S.ShapeBuilder,name:"polygon"},build(r,e){for(let t=0;t{U();wS={extension:{type:S.ShapeBuilder,name:"rectangle"},build(r,e){let t=r,i=t.x,s=t.y,o=t.width,n=t.height;return o>=0&&n>=0&&(e[0]=i,e[1]=s,e[2]=i+o,e[3]=s,e[4]=i+o,e[5]=s+n,e[6]=i,e[7]=s+n),e},triangulate(r,e,t,i,s,o){let n=0;i*=t,e[i+n]=r[0],e[i+n+1]=r[1],n+=t,e[i+n]=r[2],e[i+n+1]=r[3],n+=t,e[i+n]=r[6],e[i+n+1]=r[7],n+=t,e[i+n]=r[4],e[i+n+1]=r[5],n+=t;let a=i/t;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var AS,PS=y(()=>{U();AS={extension:{type:S.ShapeBuilder,name:"triangle"},build(r,e){return e[0]=r.x,e[1]=r.y,e[2]=r.x2,e[3]=r.y2,e[4]=r.x3,e[5]=r.y3,e},triangulate(r,e,t,i,s,o){let n=0;i*=t,e[i+n]=r[0],e[i+n+1]=r[1],n+=t,e[i+n]=r[2],e[i+n+1]=r[3],n+=t,e[i+n]=r[4],e[i+n+1]=r[5];let a=i/t;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function MS(r,e){for(let t=0;t{Tt();Re();ge();Ao();ve();wt();Xe();im();CS=[{offset:0,color:"white"},{offset:1,color:"black"}],dg=class hg{constructor(...e){this.uid=he("fillGradient"),this.type="linear",this.colorStops=[];let t=gO(e);t={...t.type==="radial"?hg.defaultRadialOptions:hg.defaultLinearOptions,...Uu(t)},this._textureSize=t.textureSize,this._wrapMode=t.wrapMode,t.type==="radial"?(this.center=t.center,this.outerCenter=t.outerCenter??this.center,this.innerRadius=t.innerRadius,this.outerRadius=t.outerRadius,this.scale=t.scale,this.rotation=t.rotation):(this.start=t.start,this.end=t.end),this.textureSpace=t.textureSpace,this.type=t.type,t.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(e,t){return this.colorStops.push({offset:e,color:oe.shared.setValue(t).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:t}=this.start,{x:i,y:s}=this.end,o=i-e,n=s-t,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=e;e=i,i=g,o*=-1}if(n<0){let g=t;t=s,s=g,n*=-1}}let l=this.colorStops.length?this.colorStops:CS,c=this._textureSize,{canvas:u,context:h}=RS(c,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);MS(d,l),h.fillStyle=d,h.fillRect(0,0,c,1),this.texture=new k({source:new jt({resource:u,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new G;m.scale(f/c,1),m.rotate(p),m.translate(e,t),this.textureSpace==="local"&&m.scale(c,c),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:CS,t=this._textureSize,{canvas:i,context:s}=RS(t,t),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,u=this.outerRadius,h=a-u,d=l-u,f=t/(u*2),p=(o-h)*f,m=(n-d)*f,g=s.createRadialGradient(p,m,c*f,(a-h)*f,(l-d)*f,u*f);MS(g,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,t,t),s.fillStyle=g,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,t,t),this.texture=new k({source:new jt({resource:i,addressMode:this._wrapMode})});let _=new G;_.scale(1/f,1/f),_.translate(h,d),this.textureSpace==="local"&&_.scale(t,t),this.transform=_}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};dg.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};dg.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};qt=dg});function IS(r,e,t,i){let s=e.matrix?r.copyFrom(e.matrix).invert():r.identity();if(e.textureSpace==="local"){let n=t.getBounds(yO);e.width&&n.pad(e.width);let{x:a,y:l}=n,c=1/n.width,u=1/n.height,h=-a*c,d=-l*u,f=s.a,p=s.b,m=s.c,g=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*f+d*m+s.tx,s.ty=h*p+d*g+s.ty}else s.translate(e.texture.frame.x,e.texture.frame.y),s.scale(1/e.texture.source.width,1/e.texture.source.height);let o=e.texture.source.style;return!(e.fill instanceof qt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(xO.copyFrom(i).invert()),s}var xO,yO,BS=y(()=>{ge();ut();No();xO=new G,yO=new Q});function FS(r,e){let{geometryData:t,batches:i}=e;i.length=0,t.indices.length=0,t.vertices.length=0,t.uvs.length=0;for(let s=0;s{let h=a.length,d=o.length/2,f=[],p=xh[l.type],m="triangle-list";if(p.build(l,f),c&&sg(f,c),t){let x=l.closePath??!0,T=e;T.pixelLine?(mS(f,x,o,a),m="line-list"):fS(f,T,!1,x,o,a)}else if(u){let x=[],T=f.slice();TO(u).forEach(w=>{x.push(T.length/2),T.push(...w)}),gh(T,x,o,2,d,a,h)}else p.triangulate(f,o,2,d,a,h);let g=n.length/2,_=e.texture;if(_!==k.WHITE){let x=IS(bO,e,l,c);iS(o,2,d,n,g,2,o.length/2-d,x)}else sS(n,g,2,o.length/2-d);let v=se.get(Cs);v.indexOffset=h,v.indexSize=a.length-h,v.attributeOffset=d,v.attributeSize=o.length/2-d,v.baseColor=e.color,v.alpha=e.alpha,v.texture=_,v.geometryData=s,v.topology=m,i.push(v)})}function TO(r){let e=[];for(let t=0;t{U();ge();ut();oS();nS();ve();Gt();og();cS();pS();gS();SS();ES();PS();BS();ug();xh={};V.handleByMap(S.ShapeBuilder,xh);V.add(wS,TS,AS,Lo,aS,lS);_O=new Q,bO=new G});var fg,pg,gg,Ho,yh=y(()=>{U();ih();ig();tm();Xe();Gt();OS();fg=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},pg=class{constructor(){this.batcher=new Da,this.instructions=new yo}init(){this.instructions.reset()}get geometry(){return X(rv,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},gg=class mg{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){mg.defaultOptions.bezierSmoothness=e?.bezierSmoothness??mg.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let t=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){t?this._cleanGraphicsContextData(e):t=this._initContext(e),FS(e,t);let i=e.batchMode;e.customShader||i==="no-batch"?t.isBatchable=!1:i==="auto"&&(t.isBatchable=t.geometryData.vertices.length<400),e.dirty=!1}return t}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let t=se.get(pg),{batches:i,geometryData:s}=this._gpuContextHash[e.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u{se.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}};gg.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"graphicsContext"};gg.defaultOptions={bezierSmoothness:.5};Ho=gg});var SO,xg,yg,_g,bg,vg,Tg,Sg,Je,Rr=y(()=>{"use strict";SO={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},xg=0,yg=1,_g=2,bg=3,vg=4,Tg=5,Sg=class US{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<>24&255)/255;e[t++]=(r&255)/255*i,e[t++]=(r>>8&255)/255*i,e[t++]=(r>>16&255)/255*i,e[t++]=i}var Vo=y(()=>{"use strict"});var Wa,GS=y(()=>{U();Rr();Gt();Vo();og();Wa=class{constructor(e,t){this.state=Je.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(e){let t=e.context,i=!!this._graphicsBatchesHash[e.uid],s=this.renderer.graphicsContext.updateGpuContext(t);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(e,t){let i=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),i.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){let t=this._graphicsBatchesHash[e.uid];if(t)for(let i=0;i{let a=se.get(Cs);return n.copyTo(a),a.renderable=e,a.roundPixels=s,a});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=o,o}_removeBatchForRenderable(e){this._graphicsBatchesHash[e].forEach(t=>{se.return(t)}),this._graphicsBatchesHash[e]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let e in this._graphicsBatchesHash)this._removeBatchForRenderable(e);this._graphicsBatchesHash=null}};Wa.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"graphics"}});var wg=y(()=>{U();yh();GS();V.add(Wa);V.add(Ho)});var ji,_h=y(()=>{"use strict";ji=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(e){this._topology=e}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(e){this.texture!==e&&(this.texture=e,this._textureMatrixUpdateId=-1)}get uvs(){let t=this.geometry.getBuffer("aUV"),i=t.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==t._updateID)&&((!s||s.length{U();ge();Vi();It();Fa();Gt();Vo();_h();za=class{constructor(e,t){this.localUniforms=new be({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new gt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),e.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),e.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(e){let t=this._getMeshData(e),i=t.batched,s=e.batched;if(t.batched=s,i!==s)return!0;if(s){let o=e._geometry;if(o.indices.length!==t.indexSize||o.positions.length!==t.vertexSize)return t.indexSize=o.indices.length,t.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(e);return n.texture.uid!==e._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,e._texture)}return!1}addRenderable(e,t){let i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(e);if(s){let o=this._getBatchableMesh(e);o.setTexture(e._texture),o.geometry=e._geometry,i.addToBatch(o,t)}else i.break(t),t.add(e)}updateRenderable(e){if(e.batched){let t=this._gpuBatchableMeshHash[e.uid];t.setTexture(e._texture),t.geometry=e._geometry,t._batcher.updateElement(t)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;let t=this._gpuBatchableMeshHash[e.uid];t&&(se.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=mi(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),Yr(e.groupColorAlpha,t.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){return this._meshDataHash[e.uid]||this._initMeshData(e)}_initMeshData(e){return this._meshDataHash[e.uid]={batched:e.batched,indexSize:e._geometry.indices?.length,vertexSize:e._geometry.positions?.length},e.on("destroyed",this._destroyRenderableBound),this._meshDataHash[e.uid]}_getBatchableMesh(e){return this._gpuBatchableMeshHash[e.uid]||this._initBatchableMesh(e)}_initBatchableMesh(e){let t=se.get(ji);return t.renderable=e,t.setTexture(e._texture),t.transform=e.groupTransform,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t}destroy(){for(let e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&se.return(this._gpuBatchableMeshHash[e]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};za.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"mesh"}});var Eg=y(()=>{U();LS();V.add(za)});var bh,DS=y(()=>{"use strict";bh=class{execute(e,t){let i=e.state,s=e.renderer,o=t.shader||e.defaultShader;o.resources.uTexture=t.texture._source,o.resources.uniforms=e.localUniforms;let n=s.gl,a=e.getBuffers(t);s.shader.bind(o),s.state.set(i),s.geometry.bind(a.geometry,o.glProgram);let c=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,t.particleChildren.length*6,c,0)}}});function Ag(r,e=null){let t=r*6;if(t>65535?e||(e=new Uint32Array(t)):e||(e=new Uint16Array(t)),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let i=0,s=0;i{"use strict"});function VS(r){return{dynamicUpdate:HS(r,!0),staticUpdate:HS(r,!1)}}function HS(r,e){let t=[];t.push(` var index = 0; @@ -258,13 +258,13 @@ ${s.join(` { const p = ps[i]; - `);let i=0;for(let o in r){let n=r[o];if(t!==n.dynamic)continue;e.push(`offset = index + ${i}`),e.push(n.code);let a=We(n.format);i+=a.stride/4}e.push(` + `);let i=0;for(let o in r){let n=r[o];if(e!==n.dynamic)continue;t.push(`offset = index + ${i}`),t.push(n.code);let a=Yt(n.format);i+=a.stride/4}t.push(` index += stride * 4; } - `),e.unshift(` + `),t.unshift(` var stride = ${i}; - `);let s=e.join(` -`);return new Function("ps","f32v","u32v",s)}var tT=x(()=>{hs()});function MF(r){let t=[];for(let e in r){let i=r[e];t.push(e,i.code,i.dynamic?"d":"s")}return t.join("_")}var Rc,eT=x(()=>{Mi();oi();oo();hs();vp();Z0();tT();Rc=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,i=t.properties,s=0,o=0;for(let c in i){let u=i[c],d=We(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Fr(e*4*s),this.dynamicAttributeBuffer=new Fr(e*4*o),this.indexBuffer=lm(e);let n=new ar,a=0,l=0;this._staticBuffer=new Yt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:ht.VERTEX|ht.COPY_DST}),this._dynamicBuffer=new Yt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:ht.VERTEX|ht.COPY_DST});for(let c in i){let u=i[c],d=We(u.format);u.dynamic?(n.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=d.size):(n.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:u.format}),l+=d.size)}n.addIndex(this.indexBuffer);let h=this.getParticleUpdate(i);this._dynamicUpload=h.dynamicUpdate,this._staticUpload=h.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=MF(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return J0(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Fr(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Fr(this._size*this._dynamicStride*4*4),this.indexBuffer=lm(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let i=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,i.float32View,i.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var rT,iT=x(()=>{rT=`varying vec2 vUV; + `);let s=t.join(` +`);return new Function("ps","f32v","u32v",s)}var WS=y(()=>{Ps()});function wO(r){let e=[];for(let t in r){let i=r[t];e.push(t,i.code,i.dynamic?"d":"s")}return e.join("_")}var vh,zS=y(()=>{Wi();gi();Ro();Ps();Dm();NS();WS();vh=class{constructor(e){this._size=0,this._generateParticleUpdateCache={};let t=this._size=e.size??1e3,i=e.properties,s=0,o=0;for(let u in i){let h=i[u],d=Yt(h.format);h.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Vr(t*4*s),this.dynamicAttributeBuffer=new Vr(t*4*o),this.indexBuffer=Ag(t);let n=new mr,a=0,l=0;this._staticBuffer=new Ke({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:le.VERTEX|le.COPY_DST}),this._dynamicBuffer=new Ke({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:le.VERTEX|le.COPY_DST});for(let u in i){let h=i[u],d=Yt(h.format);h.dynamic?(n.addAttribute(h.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:h.format}),a+=d.size):(n.addAttribute(h.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:l*4,format:h.format}),l+=d.size)}n.addIndex(this.indexBuffer);let c=this.getParticleUpdate(i);this._dynamicUpload=c.dynamicUpdate,this._staticUpload=c.staticUpdate,this.geometry=n}getParticleUpdate(e){let t=wO(e);return this._generateParticleUpdateCache[t]?this._generateParticleUpdateCache[t]:(this._generateParticleUpdateCache[t]=this.generateParticleUpdate(e),this._generateParticleUpdateCache[t])}generateParticleUpdate(e){return VS(e)}update(e,t){e.length>this._size&&(t=!0,this._size=Math.max(e.length,this._size*1.5|0),this.staticAttributeBuffer=new Vr(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Vr(this._size*this._dynamicStride*4*4),this.indexBuffer=Ag(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let i=this.dynamicAttributeBuffer;if(this._dynamicUpload(e,i.float32View,i.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,e.length*this._dynamicStride*4,!0),t){let s=this.staticAttributeBuffer;this._staticUpload(e,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,e.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var $S,XS=y(()=>{$S=`varying vec2 vUV; varying vec4 vColor; uniform sampler2D uTexture; @@ -272,7 +272,7 @@ uniform sampler2D uTexture; void main(void){ vec4 color = texture2D(uTexture, vUV) * vColor; gl_FragColor = color; -}`});var sT,oT=x(()=>{sT=`attribute vec2 aVertex; +}`});var jS,YS=y(()=>{jS=`attribute vec2 aVertex; attribute vec2 aUV; attribute vec4 aColor; @@ -311,7 +311,7 @@ void main(void){ vUV = aUV; vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor; } -`});var hm,nT=x(()=>{hm=` +`});var Pg,qS=y(()=>{Pg=` struct ParticleUniforms { uProjectionMatrix:mat3x3, uColor:vec4, @@ -364,8 +364,8 @@ fn mainFragment( var sample = textureSample(uTexture, uSampler, uv) * color; return sample; -}`});var Mc,aT=x(()=>{be();gt();ls();ao();br();vt();Nf();iT();oT();nT();Mc=class extends qt{constructor(){let t=lr.from({vertex:sT,fragment:rT}),e=hr.from({fragment:{source:hm,entryPoint:"mainFragment"},vertex:{source:hm,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:M.WHITE.source,uSampler:new $h({}),uniforms:{uTranslationMatrix:{value:new k,type:"mat3x3"},uColor:{value:new nt(16777215),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}}})}}});var _o,cm=x(()=>{gt();Ge();Kn();vr();yo();eT();aT();_o=class{constructor(t,e){this.state=Qt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Ct({uTranslationMatrix:{value:new k,type:"mat3x3"},uColor:{value:new Float32Array(4),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Mc,this.state=Qt.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Rc({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let i=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=si(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|t._roundPixels,Dr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var aa,lT=x(()=>{B();K0();cm();aa=class extends _o{constructor(t){super(t,new Cc)}};aa.extension={type:[v.WebGLPipes],name:"particle"}});var Ic,hT=x(()=>{"use strict";Ic=class{execute(t,e){let i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);i.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var la,cT=x(()=>{B();hT();cm();la=class extends _o{constructor(t){super(t,new Ic)}};la.extension={type:[v.WebGPUPipes],name:"particle"}});var um=x(()=>{B();lT();cT();L.add(aa);L.add(la)});var Nr,ha=x(()=>{"use strict";Nr=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function ca(r,t){let{texture:e,bounds:i}=r;ic(i,t._anchor,e);let s=t._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var dm=x(()=>{cp()});var ua,uT=x(()=>{B();Be();ha();dm();ua=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),st.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,ca(s,t)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:st.get(Nr)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};ua.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"text"}});var fm,$e,bo=x(()=>{Ft();kn();fm=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=Y.get().createCanvas();i.width=t,i.height=e;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ti(t),e=ti(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:i,height:s}=e,o=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},$e=new fm});function dT(r,t,e){for(let i=0,s=4*e*t;i{ae()});var gT,ai,Bc=x(()=>{gt();Te();gT={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},ai=class{constructor(t,e){this.uid=ut("fillPattern"),this.transform=new k,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=gT[e].addressModeU,t.source.style.addressModeV=gT[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var yT=J((z6,xT)=>{xT.exports=BF;var pm={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},IF=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function BF(r){var t=[];return r.replace(IF,function(e,i,s){var o=i.toLowerCase();for(s=kF(s),o=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==pm[o])return s.unshift(i),t.push(s);if(s.length0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:N(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return t}var _T,vT=x(()=>{_T=qi(yT(),1);Pt()});var Fc,TT=x(()=>{ae();Fc=class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}strokeContains(t,e,i,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,l=(1-s)*i,h=Math.sqrt(o*o+n*n);return h<=a+l&&h>a-(i-l)}getBounds(t){return t||(t=new ot),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var kc,ST=x(()=>{ae();kc=class r{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),l=i-a,h=o-l,c=n-l,u=o+a,d=n+a,f=t-this.x,m=e-this.y,g=f*f/(h*h)+m*m/(c*c),p=f*f/(u*u)+m*m/(d*d);return g>1&&p<=1}getBounds(t){return t||(t=new ot),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function wT(r,t,e,i,s,o){let n=r-e,a=t-i,l=s-e,h=o-i,c=n*l+a*h,u=l*l+h*h,d=-1;u!==0&&(d=c/u);let f,m;d<0?(f=e,m=i):d>1?(f=s,m=o):(f=e+d*l,m=i+d*h);let g=r-f,p=t-m;return g*g+p*p}var ET=x(()=>{"use strict"});var GF,UF,vo,AT=x(()=>{ET();ae();vo=class r{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;se!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}strokeContains(t,e,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:l}=this,h=l.length-(this.closePath?0:2);for(let c=0;cs?h:s,o=cn?c:n}return t.x=i,t.width=s-i,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var Gc,Uc,PT=x(()=>{ae();Gc=(r,t,e,i,s,o,n)=>{let a=r-e,l=t-i,h=Math.sqrt(a*a+l*l);return h>=s-o&&h<=s+n},Uc=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o}getBounds(t){return t||(t=new ot),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,i,s=.5){let{x:o,y:n,width:a,height:l,radius:h}=this,c=i*(1-s),u=i-c,d=o+h,f=n+h,m=a-h*2,g=l-h*2,p=o+a,b=n+l;return(t>=o-c&&t<=o+u||t>=p-u&&t<=p+c)&&e>=f&&e<=f+g||(e>=n-c&&e<=n+u||e>=b-u&&e<=b+c)&&t>=d&&t<=d+m?!0:tp-h&&ep-h&&e>b-h&&Gc(t,e,p-h,b-h,h,u,c)||tb-h&&Gc(t,e,d,b-h,h,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Lc(r,t,e,i,s,o,n,a,l,h){let u=Math.min(.99,Math.max(0,h??xo.defaultOptions.bezierSmoothness)),d=(LF-u)/1;return d*=d,DF(t,e,i,s,o,n,a,l,r,d),r}function DF(r,t,e,i,s,o,n,a,l,h){gm(r,t,e,i,s,o,n,a,l,h,0),l.push(n,a)}function gm(r,t,e,i,s,o,n,a,l,h,c){if(c>OF)return;let u=Math.PI,d=(r+e)/2,f=(t+i)/2,m=(e+s)/2,g=(i+o)/2,p=(s+n)/2,b=(o+a)/2,y=(d+m)/2,_=(f+g)/2,S=(m+p)/2,E=(g+b)/2,w=(y+S)/2,T=(_+E)/2;if(c>0){let C=n-r,A=a-t,P=Math.abs((e-n)*A-(i-a)*C),R=Math.abs((s-n)*A-(o-a)*C),I,F;if(P>Oc&&R>Oc){if((P+R)*(P+R)<=h*(C*C+A*A)){if(To=u&&(I=2*u-I),F>=u&&(F=2*u-F),I+Ffs){l.push(e,i);return}if(F>fs){l.push(s,o);return}}}}else if(P>Oc){if(P*P<=h*(C*C+A*A)){if(To=u&&(I=2*u-I),Ifs){l.push(e,i);return}}}else if(R>Oc){if(R*R<=h*(C*C+A*A)){if(To=u&&(I=2*u-I),Ifs){l.push(s,o);return}}}else if(C=w-(r+n)/2,A=T-(t+a)/2,C*C+A*A<=h){l.push(w,T);return}}gm(r,t,d,f,y,_,w,T,l,h,c+1),gm(w,T,S,E,p,b,n,a,l,h,c+1)}var OF,Oc,LF,mm,To,fs,xm=x(()=>{Ac();OF=8,Oc=11920929e-14,LF=1,mm=.01,To=0,fs=0});function RT(r,t,e,i,s,o,n,a){let h=Math.min(.99,Math.max(0,a??xo.defaultOptions.bezierSmoothness)),c=(VF-h)/1;return c*=c,zF(t,e,i,s,o,n,r,c),r}function zF(r,t,e,i,s,o,n,a){ym(n,r,t,e,i,s,o,a,0),n.push(s,o)}function ym(r,t,e,i,s,o,n,a,l){if(l>NF)return;let h=Math.PI,c=(t+i)/2,u=(e+s)/2,d=(i+o)/2,f=(s+n)/2,m=(c+d)/2,g=(u+f)/2,p=o-t,b=n-e,y=Math.abs((i-o)*b-(s-n)*p);if(y>HF){if(y*y<=a*(p*p+b*b)){if(CT=h&&(_=2*h-_),_{Ac();NF=8,HF=11920929e-14,VF=1,WF=.01,CT=0});function Dc(r,t,e,i,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let h=l/a,c=s;h*=n?-1:1;for(let u=0;u{"use strict"});function IT(r,t,e,i,s,o){let n=r[r.length-2],l=r[r.length-1]-e,h=n-t,c=s-e,u=i-t,d=Math.abs(l*u-h*c);if(d<1e-8||o===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}let f=l*l+h*h,m=c*c+u*u,g=l*c+h*u,p=o*Math.sqrt(f)/d,b=o*Math.sqrt(m)/d,y=p*g/f,_=b*g/m,S=p*u+b*h,E=p*c+b*l,w=h*(b+y),T=l*(b+y),C=u*(p+_),A=c*(p+_),P=Math.atan2(T-E,w-S),R=Math.atan2(A-E,C-S);Dc(r,S+t,E+e,o,P,R,h*c>u*l)}var BT=x(()=>{_m()});function $F(r,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function kT(r,t,e,i,s,o,n,a=0,l=0,h=0){if(o===0||n===0)return;let c=Math.sin(a*da/360),u=Math.cos(a*da/360),d=u*(t-i)/2+c*(e-s)/2,f=-c*(t-i)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let m=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);m>1&&(o*=Math.sqrt(m),n*=Math.sqrt(m)),XF(t,e,i,s,o,n,l,h,c,u,d,f,bm);let{ang1:g,ang2:p}=bm,{centerX:b,centerY:y}=bm,_=Math.abs(p)/(da/4);Math.abs(1-_)<1e-7&&(_=1);let S=Math.max(Math.ceil(_),1);p/=S;let E=r[r.length-2],w=r[r.length-1],T={x:0,y:0};for(let C=0;C{xm();da=Math.PI*2,bm={centerX:0,centerY:0,ang1:0,ang2:0},vm=({x:r,y:t},e,i,s,o,n,a,l)=>{r*=e,t*=i;let h=s*r-o*t,c=o*r+s*t;return l.x=h+n,l.y=c+a,l};FT=(r,t,e,i)=>{let s=r*i-t*e<0?-1:1,o=r*e+t*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},XF=(r,t,e,i,s,o,n,a,l,h,c,u,d)=>{let f=Math.pow(s,2),m=Math.pow(o,2),g=Math.pow(c,2),p=Math.pow(u,2),b=f*m-f*p-m*g;b<0&&(b=0),b/=f*p+m*g,b=Math.sqrt(b)*(n===a?-1:1);let y=b*s/o*u,_=b*-o/s*c,S=h*y-l*_+(r+e)/2,E=l*y+h*_+(t+i)/2,w=(c-y)/s,T=(u-_)/o,C=(-c-y)/s,A=(-u-_)/o,P=FT(1,0,w,T),R=FT(w,T,C,A);a===0&&R>0&&(R-=da),a===1&&R<0&&(R+=da),d.centerX=S,d.centerY=E,d.ang1=P,d.ang2=R}});function UT(r,t,e){let i=(n,a)=>{let l=a.x-n.x,h=a.y-n.y,c=Math.sqrt(l*l+h*h),u=l/c,d=h/c;return{len:c,nx:u,ny:d}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n0&&(f=-1,m=!0);let g=d/2,p,b=Math.abs(Math.cos(g)*l/Math.sin(g));b>Math.min(c.len/2,u.len/2)?(b=Math.min(c.len/2,u.len/2),p=Math.abs(b*Math.sin(g)/Math.cos(g))):p=l;let y=a.x+u.nx*b+-u.ny*p*f,_=a.y+u.ny*b+u.nx*p*f,S=Math.atan2(c.ny,c.nx)+Math.PI/2*f,E=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&r.moveTo(y+Math.cos(S)*p,_+Math.sin(S)*p),r.arc(y,_,p,S,E,m),o=a}}function OT(r,t,e,i){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,h)=>({x:a.x+(l.x-a.x)*h,y:a.y+(l.y-a.y)*h}),n=t.length;for(let a=0;a{"use strict"});var jF,Nc,DT=x(()=>{TT();ST();AT();ae();PT();Ne();xm();MT();_m();BT();GT();LT();jF=new ot,Nc=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new At,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==t||o!==e)&&i.push(t,e),this}arc(t,e,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Dc(a,t,e,i,s,o,n),this}arcTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return IT(n,t,e,i,s,o),this}arcToSvg(t,e,i,s,o,n,a){let l=this._currentPoly.points;return kT(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,i,s,o),this}bezierCurveTo(t,e,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return Lc(this._currentPoly.points,l.lastX,l.lastY,t,e,i,s,o,n,a),this}quadraticCurveTo(t,e,i,s,o){this._ensurePoly();let n=this._currentPoly;return RT(this._currentPoly.points,n.lastX,n.lastY,t,e,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let i=this.shapePrimitives,s=i.length;for(let o=0;o1){let o=null;for(let n=s;n=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,n)}ellipse(t,e,i,s,o){return this.drawShape(new kc(t,e,i,s),o),this}roundRect(t,e,i,s,o,n){return this.drawShape(new Uc(t,e,i,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new vo,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new vo,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e{or();Te();Pt();vT();DT();Gi=class r{constructor(t,e=!1){this.instructions=[],this.uid=ut("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?bT(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Nc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(dt.shared),l=0,h=0;if(!n||n.action!=="bezierCurveTo")l=a.x,h=a.y;else{l=n.data[2],h=n.data[3];let c=a.x,u=a.y;l=c+(c-l),h=u+(u-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,i,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(dt.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else{n=s.data[0],a=s.data[1];let l=o.x,h=o.y;n=l+(l-n),a=h+(h-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,s,o){return this.instructions.push({action:"rect",data:[t,e,i,s,o]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,h=i*2,c=Math.PI*2/h,u=[];for(let d=0;d{"use strict"});function NT(r,t){let e=r.querySelectorAll("defs");for(let i=0;i{be();Pt();go();Sm()});function wm(r){let t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var VT=x(()=>{"use strict"});function Em(r,t){let e=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in WT){let a=r.getAttribute(n);a&&zT(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a{be();VT();WT={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function XT(r,t){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let e={context:t,defs:{},path:new Gi};NT(r,e);let i=r.children,{fillStyle:s,strokeStyle:o}=Em(r,e);for(let n=0;nparseInt(A,10)),t.context.poly(_,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":S=r.getAttribute("points"),_=S.match(/\d+/g).map(A=>parseInt(A,10)),t.context.poly(_,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{N(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(e=null);for(let A=0;A{Pt();Tm();HT();Sm();$T()});function KF(r){return nt.isColorLike(r)}function qT(r){return r instanceof ai}function KT(r){return r instanceof ze}function ZF(r){return r instanceof M}function QF(r,t,e){let i=nt.shared.setValue(t??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=M.WHITE,{...e,...r}}function JF(r,t,e){return r.texture=t,{...e,...r}}function ZT(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function QT(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,{...e,...r}}function t2(r,t){let e={...t,...r},i=nt.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function li(r,t){if(r==null)return null;let e={},i=r;return KF(r)?QF(e,r,t):ZF(r)?JF(e,r,t):qT(r)?ZT(e,r,t):KT(r)?QT(e,r,t):i.fill&&qT(i.fill)?ZT(i,i.fill,t):i.fill&&KT(i.fill)?QT(i,i.fill,t):t2(i,t)}function So(r,t){let{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=t,h=li(r,l);return h?{width:e,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...h}:null}var Am=x(()=>{be();vt();go();Bc()});var e2,JT,Pm,Ue,Hc=x(()=>{Ae();be();gt();or();vt();Te();zt();Ne();Tm();YT();Am();e2=new dt,JT=new k,Pm=class Hr extends It{constructor(){super(...arguments),this.uid=ut("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Gi,this._transform=new k,this._fillStyle={...Hr.defaultFillStyle},this._strokeStyle={...Hr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new At,this._boundsDirty=!0}clone(){let t=new Hr;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=li(t,Hr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=So(t,Hr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=li(t,Hr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=li(t,Hr.defaultStrokeStyle),this}texture(t,e,i,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?nt.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Gi,this}fill(t,e){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(j(it,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=li(t,Hr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(dt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=So(t,Hr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,s,o,n),this}arcTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,e,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(t,e,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*t+i.c*e+i.tx,n=i.b*t+i.d*e+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,o){return this._tick++,this._activePath.roundRect(t,e,i,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,i,s,o,n),this}roundPoly(t,e,i,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,i,s,o,n),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,o){return this._tick++,this._activePath.filletRect(t,e,i,s,o),this}chamferRect(t,e,i,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,i,s,o,n),this}star(t,e,i,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,i,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,XT(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,s,o,n){return t instanceof k?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,o,n),this)}transform(t,e,i,s,o,n){return t instanceof k?(this._transform.append(t),this):(JT.set(t,e,i,s,o,n),this._transform.append(JT),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e{be();tS=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function s2(r){let t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Ht.defaultDropShadow;r.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){j(it,"strokeThickness is now a part of stroke");let e=t.stroke,i={};if(nt.isColorLike(e))i.color=e;else if(e instanceof ze||e instanceof ai)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){j(it,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;r.fontSize==null?r.fontSize=Ht.defaultTextStyle.fontSize:typeof r.fontSize=="string"?e=parseInt(r.fontSize,10):e=r.fontSize;let i=new ze({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>nt.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var Rm,Ht,ps=x(()=>{Ae();be();zt();go();Bc();Hc();Am();Cm();Rm=class wo extends It{constructor(t={}){super(),s2(t);let e={...wo.defaultTextStyle,...t};for(let i in e){let s=i;this[s]=e[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...wo.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...wo.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Ue.defaultFillStyle,...t},()=>{this._fill=li({...this._originalFill},Ue.defaultFillStyle)})),this._fill=li(t===0?"black":t,Ue.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ue.defaultStrokeStyle,...t},()=>{this._stroke=So({...this._originalStroke},Ue.defaultStrokeStyle)})),this._stroke=So(t,Ue.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Vc(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=wo.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new wo({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,o)=>(i[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(nt.isColorLike(t)||t instanceof ze||t instanceof ai)}};Rm.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Rm.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};Ht=Rm});function Wc(r,t,e,i){let s=o2;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=$t.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}var o2,Mm=x(()=>{Si();Ne();o2=new At});function ms(r){let t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!n2.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}var n2,zc=x(()=>{"use strict";n2=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Im,Tr,Jt,pa=x(()=>{Ft();zc();Im={willReadFrequently:!0},Tr=class q{static get experimentalLetterSpacingSupported(){let t=q._experimentalLetterSpacingSupported;if(t!==void 0){let e=Y.get().getCanvasRenderingContext2D().prototype;t=q._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,o,n,a,l,h){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h}static measureText(t=" ",e,i=q._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(q._measurementCache[o])return q._measurementCache[o];let n=ms(e),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let l=q.__context;l.font=n;let c=(s?q._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let y=0;y0)if(s)n-=e,h-=e;else{let c=(q.graphemeSegmenter(t).length-1)*e;n+=c,h+=c}return Math.max(n,h)}static _wordWrap(t,e,i=q._canvas){let s=i.getContext("2d",Im),o=0,n="",a="",l=Object.create(null),{letterSpacing:h,whiteSpace:c}=e,u=q._collapseSpaces(c),d=q._collapseNewlines(c),f=!u,m=e.wordWrapWidth+h,g=q._tokenize(t);for(let p=0;pm)if(n!==""&&(a+=q._addLine(n),n="",o=0),q.canBreakWords(b,e.breakWords)){let _=q.wordWrapSplit(b);for(let S=0;S<_.length;S++){let E=_[S],w=E,T=1;for(;_[S+T];){let A=_[S+T];if(!q.canBreakChars(w,A,b,S,e.breakWords))E+=A;else break;w=A,T++}S+=T-1;let C=q._getFromCache(E,h,l,s);C+o>m&&(a+=q._addLine(n),f=!1,n="",o=0),n+=E,o+=C}}else{n.length>0&&(a+=q._addLine(n),n="",o=0);let _=p===g.length-1;a+=q._addLine(b,!_),f=!1,n="",o=0}else y+o>m&&(f=!1,a+=q._addLine(n),n="",o=0),(n.length>0||!q.isBreakingSpace(b)||f)&&(n+=b,o+=y)}return a+=q._addLine(n,!1),a}static _addLine(t,e=!0){return t=q._trimRight(t),t=e?`${t} -`:t,t}static _getFromCache(t,e,i,s){let o=i[t];return typeof o!="number"&&(o=q._measureText(t,e,s)+e,i[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let i=t[e];if(!q.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:q._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:q._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],i="";if(typeof t!="string")return e;for(let s=0;s{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})();Tr.experimentalLetterSpacing=!1;Tr._fonts={};Tr._newlines=[10,13];Tr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Tr._measurementCache={};Jt=Tr});function Eo(r,t,e,i=0){if(r.texture===M.WHITE&&!r.fill)return nt.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof ai){let s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(k.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof ze){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&e&&(a=e.width+i,l=e.height+i);let h,c=!1;if(o){let{start:u,end:d}=s;h=t.createLinearGradient(u.x*a,u.y*l,d.x*a,d.y*l),c=Math.abs(d.x-u.x){let g=f+m.offset*u;h.addColorStop(Math.floor(g*rS)/rS,nt.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(u=>{h.addColorStop(u.offset,nt.shared.setValue(u.color).toHex())});return h}}else{let s=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(k.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return N("FillStyle not recognised",r),"red"}var rS,Bm=x(()=>{be();gt();vt();Pt();go();Bc();rS=1e5});var ma,iS=x(()=>{be();B();kn();bo();Si();mT();zt();ps();Mm();pa();zc();Bm();ma=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let s=Jt.measureText(t||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=ti(o),n=ti(n),{width:o,height:n}}getTexture(t,e,i,s){typeof t=="string"&&(j("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Ht||(t.style=new Ht(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),$e.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:i}=t,s=t.resolution??this._renderer.resolution,o=Jt.measureText(e||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),l=$e.getOptimalCanvasAndContext(n,a),{canvas:h}=l;this.renderTextToCanvas(e,i,s,l);let c=Wc(h,n,a,s);if(i.trim){let u=pT(h,s);c.frame.copyFrom(u),c.updateUvs()}return{texture:c,canvasAndContext:l}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",$t.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&($e.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){let{canvas:o,context:n}=s,a=ms(e),l=Jt.measureText(t||" ",e),h=l.lines,c=l.lineHeight,u=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,m=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=e.textBaseline,e._stroke?.width){let y=e._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap}n.font=a;let g,p,b=e.dropShadow?2:1;for(let y=0;y{B();uT();iS();L.add(ma);L.add(ua)});var ce,km=x(()=>{zt();tc();Hc();ce=class r extends Ai{constructor(t){t instanceof Ue&&(t={context:t});let{context:e,roundPixels:i,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Ue,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(t,e,i){j(it,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){j(it,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){j(it,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Ue.defaultStrokeStyle.width||t.color!==Ue.defaultStrokeStyle.color||t.alpha!==Ue.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return j(it,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return j(it,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return j(it,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return j(it,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return j(it,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return j(it,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var sS,oS,nS=x(()=>{"use strict";sS={name:"local-uniform-msdf-bit",vertex:{header:` +}`});var Th,KS=y(()=>{Tt();ge();As();Bo();Mr();ve();sm();XS();YS();qS();Th=class extends Ze{constructor(){let e=gr.from({vertex:jS,fragment:$S}),t=xr.from({fragment:{source:Pg,entryPoint:"mainFragment"},vertex:{source:Pg,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:t,resources:{uTexture:k.WHITE.source,uSampler:new Gu({}),uniforms:{uTranslationMatrix:{value:new G,type:"mat3x3"},uColor:{value:new oe(16777215),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}}})}}});var Wo,Cg=y(()=>{ge();It();Fa();Rr();Vo();zS();KS();Wo=class{constructor(e,t){this.state=Je.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new be({uTranslationMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array(4),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}),this.renderer=e,this.adaptor=t,this.defaultShader=new Th,this.state=Je.for2d()}validateRenderable(e){return!1}addRenderable(e,t){this.renderer.renderPipes.batch.break(t),t.add(e)}getBuffers(e){return this._gpuBufferHash[e.uid]||this._initBuffer(e)}_initBuffer(e){return this._gpuBufferHash[e.uid]=new vh({size:e.particleChildren.length,properties:e._properties}),e.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[e.uid]}updateRenderable(e){}destroyRenderable(e){this._gpuBufferHash[e.uid].destroy(),this._gpuBufferHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}execute(e){let t=e.particleChildren;if(t.length===0)return;let i=this.renderer,s=this.getBuffers(e);e.texture||(e.texture=t[0].texture);let o=this.state;s.update(t,e._childrenDirty),e._childrenDirty=!1,o.blendMode=mi(e.blendMode,e.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;e.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|e._roundPixels,Yr(e.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,e)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var $a,ZS=y(()=>{U();DS();Cg();$a=class extends Wo{constructor(e){super(e,new bh)}};$a.extension={type:[S.WebGLPipes],name:"particle"}});var Sh,QS=y(()=>{"use strict";Sh=class{execute(e,t){let i=e.renderer,s=t.shader||e.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(t.texture);let o=e.state,n=e.getBuffers(t);i.encoder.draw({geometry:n.geometry,shader:t.shader||e.defaultShader,state:o,size:t.particleChildren.length*6})}}});var Xa,JS=y(()=>{U();QS();Cg();Xa=class extends Wo{constructor(e){super(e,new Sh)}};Xa.extension={type:[S.WebGPUPipes],name:"particle"}});var Mg=y(()=>{U();ZS();JS();V.add($a);V.add(Xa)});var qr,ja=y(()=>{"use strict";qr=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function Ya(r,e){let{texture:t,bounds:i}=r;qu(i,e._anchor,t);let s=e._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Rg=y(()=>{Cm()});var qa,ew=y(()=>{U();Gt();ja();Rg();qa=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e];if(!t)continue;let i=t.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();return t.currentKey!==i}addRenderable(e,t){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,t)}updateRenderable(e){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),i._batcher.updateElement(i)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.canvasText.decreaseReferenceCount(t.currentKey),se.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e),e._didTextUpdate=!1,Ya(s,e)}_updateGpuText(e){let t=this._getGpuText(e),i=t.batchableSprite;t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),t.texture=i.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e._getKey(),i.texture=t.texture}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:null,currentKey:"--",batchableSprite:se.get(qr)};return t.batchableSprite.renderable=e,t.batchableSprite.transform=e.groupTransform,t.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},t.batchableSprite.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuText[e.uid]=t,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._updateText(e),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};qa.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"text"}});var Ig,Kt,zo=y(()=>{Re();ya();Ig=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let i=j.get().createCanvas();i.width=e,i.height=t;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(e,t,i=1){e=Math.ceil(e*i-1e-6),t=Math.ceil(t*i-1e-6),e=di(e),t=di(t);let s=(e<<17)+(t<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(e,t)),o}returnCanvasAndContext(e){let t=e.canvas,{width:i,height:s}=t,o=(i<<17)+(s<<1);e.context.clearRect(0,0,i,s),this._canvasPool[o].push(e)}clear(){this._canvasPool={}}},Kt=new Ig});function tw(r,e,t){for(let i=0,s=4*t*e;i{ut()});var ow,yi,wh=y(()=>{ge();wt();ow={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},yi=class{constructor(e,t){this.uid=he("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=ow[t].addressModeU,e.source.style.addressModeV=ow[t].addressModeV)}setTransform(e){let t=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/t.frame.width,1/t.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var aw=ee((Rq,nw)=>{nw.exports=AO;var Bg={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},EO=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function AO(r){var e=[];return r.replace(EO,function(t,i,s){var o=i.toLowerCase();for(s=CO(s),o=="m"&&s.length>2&&(e.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==Bg[o])return s.unshift(i),e.push(s);if(s.length0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:W(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return e}var lw,uw=y(()=>{lw=fs(aw(),1);Ae()});var Eh,hw=y(()=>{ut();Eh=class r{constructor(e=0,t=0,i=0){this.type="circle",this.x=e,this.y=t,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-t;return s*=s,o*=o,s+o<=i}strokeContains(e,t,i,s=.5){if(this.radius===0)return!1;let o=this.x-e,n=this.y-t,a=this.radius,l=(1-s)*i,c=Math.sqrt(o*o+n*n);return c<=a+l&&c>a-(i-l)}getBounds(e){return e||(e=new Q),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var Ah,dw=y(()=>{ut();Ah=class r{constructor(e=0,t=0,i=0,s=0){this.type="ellipse",this.x=e,this.y=t,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,t){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(e-this.x)/this.halfWidth,s=(t-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(e,t,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),l=i-a,c=o-l,u=n-l,h=o+a,d=n+a,f=e-this.x,p=t-this.y,m=f*f/(c*c)+p*p/(u*u),g=f*f/(h*h)+p*p/(d*d);return m>1&&g<=1}getBounds(e){return e||(e=new Q),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function fw(r,e,t,i,s,o){let n=r-t,a=e-i,l=s-t,c=o-i,u=n*l+a*c,h=l*l+c*c,d=-1;h!==0&&(d=u/h);let f,p;d<0?(f=t,p=i):d>1?(f=s,p=o):(f=t+d*l,p=i+d*c);let m=r-f,g=e-p;return m*m+g*g}var pw=y(()=>{"use strict"});var MO,RO,$o,mw=y(()=>{pw();ut();$o=class r{constructor(...e){this.type="polygon";let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){let i=[];for(let s=0,o=t.length;st!=u>t&&e<(c-a)*((t-l)/(u-l))+a&&(i=!i)}return i}strokeContains(e,t,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:l}=this,c=l.length-(this.closePath?0:2);for(let u=0;us?c:s,o=un?u:n}return e.x=i,e.width=s-i,e.y=o,e.height=n-o,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,t)=>`${e}, ${t}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var Ph,Ch,gw=y(()=>{ut();Ph=(r,e,t,i,s,o,n)=>{let a=r-t,l=e-i,c=Math.sqrt(a*a+l*l);return c>=s-o&&c<=s+n},Ch=class r{constructor(e=0,t=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=e,this.y=t,this.width=i,this.height=s,this.radius=o}getBounds(e){return e||(e=new Q),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=t-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=e-(this.x+this.width-i),s*s+o*o<=n)||(o=t-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(e,t,i,s=.5){let{x:o,y:n,width:a,height:l,radius:c}=this,u=i*(1-s),h=i-u,d=o+c,f=n+c,p=a-c*2,m=l-c*2,g=o+a,_=n+l;return(e>=o-u&&e<=o+h||e>=g-h&&e<=g+u)&&t>=f&&t<=f+m||(t>=n-u&&t<=n+h||t>=_-h&&t<=_+u)&&e>=d&&e<=d+p?!0:eg-c&&tg-c&&t>_-c&&Ph(e,t,g-c,_-c,c,h,u)||e_-c&&Ph(e,t,d,_-c,c,h,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Rh(r,e,t,i,s,o,n,a,l,c){let h=Math.min(.99,Math.max(0,c??Ho.defaultOptions.bezierSmoothness)),d=(BO-h)/1;return d*=d,kO(e,t,i,s,o,n,a,l,r,d),r}function kO(r,e,t,i,s,o,n,a,l,c){Fg(r,e,t,i,s,o,n,a,l,c,0),l.push(n,a)}function Fg(r,e,t,i,s,o,n,a,l,c,u){if(u>IO)return;let h=Math.PI,d=(r+t)/2,f=(e+i)/2,p=(t+s)/2,m=(i+o)/2,g=(s+n)/2,_=(o+a)/2,v=(d+p)/2,x=(f+m)/2,T=(p+g)/2,b=(m+_)/2,w=(v+T)/2,E=(x+b)/2;if(u>0){let I=n-r,B=a-e,C=Math.abs((t-n)*B-(i-a)*I),A=Math.abs((s-n)*B-(o-a)*I),P,R;if(C>Mh&&A>Mh){if((C+A)*(C+A)<=c*(I*I+B*B)){if(Xo=h&&(P=2*h-P),R>=h&&(R=2*h-R),P+RIs){l.push(t,i);return}if(R>Is){l.push(s,o);return}}}}else if(C>Mh){if(C*C<=c*(I*I+B*B)){if(Xo=h&&(P=2*h-P),PIs){l.push(t,i);return}}}else if(A>Mh){if(A*A<=c*(I*I+B*B)){if(Xo=h&&(P=2*h-P),PIs){l.push(s,o);return}}}else if(I=w-(r+n)/2,B=E-(e+a)/2,I*I+B*B<=c){l.push(w,E);return}}Fg(r,e,d,f,v,x,w,E,l,c,u+1),Fg(w,E,T,b,g,_,n,a,l,c,u+1)}var IO,Mh,BO,kg,Xo,Is,Og=y(()=>{yh();IO=8,Mh=11920929e-14,BO=1,kg=.01,Xo=0,Is=0});function yw(r,e,t,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??Ho.defaultOptions.bezierSmoothness)),u=(UO-c)/1;return u*=u,LO(e,t,i,s,o,n,r,u),r}function LO(r,e,t,i,s,o,n,a){Ug(n,r,e,t,i,s,o,a,0),n.push(s,o)}function Ug(r,e,t,i,s,o,n,a,l){if(l>FO)return;let c=Math.PI,u=(e+i)/2,h=(t+s)/2,d=(i+o)/2,f=(s+n)/2,p=(u+d)/2,m=(h+f)/2,g=o-e,_=n-t,v=Math.abs((i-o)*_-(s-n)*g);if(v>OO){if(v*v<=a*(g*g+_*_)){if(xw=c&&(x=2*c-x),x{yh();FO=8,OO=11920929e-14,UO=1,GO=.01,xw=0});function Ih(r,e,t,i,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let c=l/a,u=s;c*=n?-1:1;for(let h=0;h{"use strict"});function bw(r,e,t,i,s,o){let n=r[r.length-2],l=r[r.length-1]-t,c=n-e,u=s-t,h=i-e,d=Math.abs(l*h-c*u);if(d<1e-8||o===0){(r[r.length-2]!==e||r[r.length-1]!==t)&&r.push(e,t);return}let f=l*l+c*c,p=u*u+h*h,m=l*u+c*h,g=o*Math.sqrt(f)/d,_=o*Math.sqrt(p)/d,v=g*m/f,x=_*m/p,T=g*h+_*c,b=g*u+_*l,w=c*(_+v),E=l*(_+v),I=h*(g+x),B=u*(g+x),C=Math.atan2(E-b,w-T),A=Math.atan2(B-b,I-T);Ih(r,T+e,b+t,o,C,A,c*u>h*l)}var vw=y(()=>{Gg()});function DO(r,e){let t=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=e===1.5707963267948966?.551915024494:t,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+e),a=Math.sin(r+e);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function Sw(r,e,t,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let u=Math.sin(a*Ka/360),h=Math.cos(a*Ka/360),d=h*(e-i)/2+u*(t-s)/2,f=-u*(e-i)/2+h*(t-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),NO(e,t,i,s,o,n,l,c,u,h,d,f,Lg);let{ang1:m,ang2:g}=Lg,{centerX:_,centerY:v}=Lg,x=Math.abs(g)/(Ka/4);Math.abs(1-x)<1e-7&&(x=1);let T=Math.max(Math.ceil(x),1);g/=T;let b=r[r.length-2],w=r[r.length-1],E={x:0,y:0};for(let I=0;I{Og();Ka=Math.PI*2,Lg={centerX:0,centerY:0,ang1:0,ang2:0},Dg=({x:r,y:e},t,i,s,o,n,a,l)=>{r*=t,e*=i;let c=s*r-o*e,u=o*r+s*e;return l.x=c+n,l.y=u+a,l};Tw=(r,e,t,i)=>{let s=r*i-e*t<0?-1:1,o=r*t+e*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},NO=(r,e,t,i,s,o,n,a,l,c,u,h,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(u,2),g=Math.pow(h,2),_=f*p-f*g-p*m;_<0&&(_=0),_/=f*g+p*m,_=Math.sqrt(_)*(n===a?-1:1);let v=_*s/o*h,x=_*-o/s*u,T=c*v-l*x+(r+t)/2,b=l*v+c*x+(e+i)/2,w=(u-v)/s,E=(h-x)/o,I=(-u-v)/s,B=(-h-x)/o,C=Tw(1,0,w,E),A=Tw(w,E,I,B);a===0&&A>0&&(A-=Ka),a===1&&A<0&&(A+=Ka),d.centerX=T,d.centerY=b,d.ang1=C,d.ang2=A}});function Ew(r,e,t){let i=(n,a)=>{let l=a.x-n.x,c=a.y-n.y,u=Math.sqrt(l*l+c*c),h=l/u,d=c/u;return{len:u,nx:h,ny:d}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)},o=e[e.length-1];for(let n=0;n0&&(f=-1,p=!0);let m=d/2,g,_=Math.abs(Math.cos(m)*l/Math.sin(m));_>Math.min(u.len/2,h.len/2)?(_=Math.min(u.len/2,h.len/2),g=Math.abs(_*Math.sin(m)/Math.cos(m))):g=l;let v=a.x+h.nx*_+-h.ny*g*f,x=a.y+h.ny*_+h.nx*g*f,T=Math.atan2(u.ny,u.nx)+Math.PI/2*f,b=Math.atan2(h.ny,h.nx)-Math.PI/2*f;n===0&&r.moveTo(v+Math.cos(T)*g,x+Math.sin(T)*g),r.arc(v,x,g,T,b,p),o=a}}function Aw(r,e,t,i){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,c)=>({x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c}),n=e.length;for(let a=0;a{"use strict"});var HO,Bh,Cw=y(()=>{hw();dw();mw();ut();gw();$t();Og();_w();Gg();vw();ww();Pw();HO=new Q,Bh=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Ee,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==e||o!==t)&&i.push(e,t),this}arc(e,t,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Ih(a,e,t,i,s,o,n),this}arcTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return bw(n,e,t,i,s,o),this}arcToSvg(e,t,i,s,o,n,a){let l=this._currentPoly.points;return Sw(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,e,t,i,s,o),this}bezierCurveTo(e,t,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return Rh(this._currentPoly.points,l.lastX,l.lastY,e,t,i,s,o,n,a),this}quadraticCurveTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly;return yw(this._currentPoly.points,n.lastX,n.lastY,e,t,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));let i=this.shapePrimitives,s=i.length;for(let o=0;o1){let o=null;for(let n=s;n=2;h-=2)u[h]===u[h-2]&&u[h-1]===u[h-3]&&u.splice(h-1,2);return this.poly(u,!0,n)}ellipse(e,t,i,s,o){return this.drawShape(new Ah(e,t,i,s),o),this}roundRect(e,t,i,s,o,n){return this.drawShape(new Ch(e,t,i,s,o),n),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let i=this._currentPoly;return i&&this.endPoly(),i=new $o,i.points.push(e,t),this._currentPoly=i,this}endPoly(e=!1){let t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new $o,e)){let t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let i=t.shape.x,s=t.shape.y;if(t.transform&&!t.transform.isIdentity()){let o=t.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t{fr();wt();Ae();uw();Cw();Yi=class r{constructor(e,t=!1){this.instructions=[],this.uid=he("graphicsPath"),this._dirty=!0,this.checkForHoles=t,typeof e=="string"?cw(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Bh(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,t){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,t]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,t,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(de.shared),l=0,c=0;if(!n||n.action!=="bezierCurveTo")l=a.x,c=a.y;else{l=n.data[2],c=n.data[3];let u=a.x,h=a.y;l=u+(u-l),c=h+(h-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,e,t,i,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,t,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(de.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else{n=s.data[0],a=s.data[1];let l=o.x,c=o.y;n=l+(l-n),a=c+(c-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,e,t,i]}),this._dirty=!0,this}rect(e,t,i,s,o){return this.instructions.push({action:"rect",data:[e,t,i,s,o]}),this._dirty=!0,this}circle(e,t,i,s){return this.instructions.push({action:"circle",data:[e,t,i,s]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,t,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,c=i*2,u=Math.PI*2/c,h=[];for(let d=0;d{"use strict"});function Mw(r,e){let t=r.querySelectorAll("defs");for(let i=0;i{Tt();Ae();No();Hg()});function Vg(r){let e=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var Iw=y(()=>{"use strict"});function Wg(r,e){let t=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Bw){let a=r.getAttribute(n);a&&kw(e,o,n,a.trim())}if(t){let n=t.split(";");for(let a=0;a{Tt();Iw();Bw={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function Ow(r,e){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let t={context:e,defs:{},path:new Yi};Mw(r,t);let i=r.children,{fillStyle:s,strokeStyle:o}=Wg(r,t);for(let n=0;nparseInt(B,10)),e.context.poly(x,!0),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"polyline":T=r.getAttribute("points"),x=T.match(/\d+/g).map(B=>parseInt(B,10)),e.context.poly(x,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{W(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(t=null);for(let B=0;B{Ae();Ng();Rw();Hg();Fw()});function zO(r){return oe.isColorLike(r)}function Lw(r){return r instanceof yi}function Dw(r){return r instanceof qt}function $O(r){return r instanceof k}function XO(r,e,t){let i=oe.shared.setValue(e??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?t.alpha:i.alpha,r.texture=k.WHITE,{...t,...r}}function jO(r,e,t){return r.texture=e,{...t,...r}}function Nw(r,e,t){return r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,{...t,...r}}function Hw(r,e,t){return e.buildGradient(),r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,r.textureSpace=e.textureSpace,{...t,...r}}function YO(r,e){let t={...e,...r},i=oe.shared.setValue(t.color);return t.alpha*=i.alpha,t.color=i.toNumber(),t}function _i(r,e){if(r==null)return null;let t={},i=r;return zO(r)?XO(t,r,e):$O(r)?jO(t,r,e):Lw(r)?Nw(t,r,e):Dw(r)?Hw(t,r,e):i.fill&&Lw(i.fill)?Nw(i,i.fill,e):i.fill&&Dw(i.fill)?Hw(i,i.fill,e):YO(i,e)}function jo(r,e){let{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=e,c=_i(r,l);return c?{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var zg=y(()=>{Tt();ve();No();wh()});var qO,Vw,$g,Ht,kh=y(()=>{Mt();Tt();ge();fr();ve();wt();Xe();$t();Ng();Gw();zg();qO=new de,Vw=new G,$g=class Kr extends Ce{constructor(){super(...arguments),this.uid=he("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Yi,this._transform=new G,this._fillStyle={...Kr.defaultFillStyle},this._strokeStyle={...Kr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Ee,this._boundsDirty=!0}clone(){let e=new Kr;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=_i(e,Kr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=jo(e,Kr.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=_i(e,Kr.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=_i(e,Kr.defaultStrokeStyle),this}texture(e,t,i,s,o,n){return this.instructions.push({action:"texture",data:{image:e,dx:i||0,dy:s||0,dw:o||e.frame.width,dh:n||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:t?oe.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Yi,this}fill(e,t){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(e!=null&&(t!==void 0&&typeof e=="number"&&(X(ie,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:t}),this._fillStyle=_i(e,Kr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:t}=this._activePath.getLastPoint(de.shared);this._activePath.clear(),this._activePath.moveTo(e,t)}stroke(e){let t,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?t=i.data.path:t=this._activePath.clone(),t?(e!=null&&(this._strokeStyle=jo(e,Kr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:t}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let t=this.instructions[this.instructions.length-1-e],i=this._activePath.clone();if(t&&(t.action==="stroke"||t.action==="fill"))if(t.data.hole)t.data.hole.addPath(i);else{t.data.hole=i;break}}return this._initNextPathLocation(),this}arc(e,t,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,i,s,o,n),this}arcTo(e,t,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(e,t,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,t,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(e,t,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*t+l.tx,l.b*e+l.d*t+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(e,t,i,s){return this._tick++,this._activePath.ellipse(e,t,i,s,this._transform.clone()),this}circle(e,t,i){return this._tick++,this._activePath.circle(e,t,i,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,t){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*e+i.c*t+i.tx,i.b*e+i.d*t+i.ty),this}moveTo(e,t){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*e+i.c*t+i.tx,n=i.b*e+i.d*t+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(e,t,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(e,t,i,s){return this._tick++,this._activePath.rect(e,t,i,s,this._transform.clone()),this}roundRect(e,t,i,s,o){return this._tick++,this._activePath.roundRect(e,t,i,s,o,this._transform.clone()),this}poly(e,t){return this._tick++,this._activePath.poly(e,t,this._transform.clone()),this}regularPoly(e,t,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(e,t,i,s,o,n),this}roundPoly(e,t,i,s,o,n){return this._tick++,this._activePath.roundPoly(e,t,i,s,o,n),this}roundShape(e,t,i,s){return this._tick++,this._activePath.roundShape(e,t,i,s),this}filletRect(e,t,i,s,o){return this._tick++,this._activePath.filletRect(e,t,i,s,o),this}chamferRect(e,t,i,s,o,n){return this._tick++,this._activePath.chamferRect(e,t,i,s,o,n),this}star(e,t,i,s,o=0,n=0){return this._tick++,this._activePath.star(e,t,i,s,o,n,this._transform.clone()),this}svg(e){return this._tick++,Ow(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,t=e){return this._transform.scale(e,t),this}setTransform(e,t,i,s,o,n){return e instanceof G?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,t,i,s,o,n),this)}transform(e,t,i,s,o,n){return e instanceof G?(this._transform.append(e),this):(Vw.set(e,t,i,s,o,n),this._transform.append(Vw),this)}translate(e,t=e){return this._transform.translate(e,t),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let e=this._bounds;e.clear();for(let t=0;t{Tt();Ww=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function QO(r){let e=r;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let t=Oe.defaultDropShadow;r.dropShadow={alpha:e.dropShadowAlpha??t.alpha,angle:e.dropShadowAngle??t.angle,blur:e.dropShadowBlur??t.blur,color:e.dropShadowColor??t.color,distance:e.dropShadowDistance??t.distance}}if(e.strokeThickness!==void 0){X(ie,"strokeThickness is now a part of stroke");let t=e.stroke,i={};if(oe.isColorLike(t))i.color=t;else if(t instanceof qt||t instanceof yi)i.fill=t;else if(Object.hasOwnProperty.call(t,"color")||Object.hasOwnProperty.call(t,"fill"))i=t;else throw new Error("Invalid stroke value.");r.stroke={...i,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){X(ie,"gradient fill is now a fill pattern: `new FillGradient(...)`");let t;r.fontSize==null?r.fontSize=Oe.defaultTextStyle.fontSize:typeof r.fontSize=="string"?t=parseInt(r.fontSize,10):t=r.fontSize;let i=new qt({start:{x:0,y:0},end:{x:0,y:(t||0)*1.7}}),s=e.fillGradientStops.map(o=>oe.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var jg,Oe,Bs=y(()=>{Mt();Tt();Xe();No();wh();kh();zg();Xg();jg=class Yo extends Ce{constructor(e={}){super(),QO(e);let t={...Yo.defaultTextStyle,...e};for(let i in t){let s=i;this[s]=t[i]}this.update()}get align(){return this._align}set align(e){this._align=e,this.update()}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords=e,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(e){e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...Yo.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...Yo.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily=e,this.update()}get fontSize(){return this._fontSize}set fontSize(e){typeof e=="string"?this._fontSize=parseInt(e,10):this._fontSize=e,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle=e.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant=e,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight=e,this.update()}get leading(){return this._leading}set leading(e){this._leading=e,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing=e,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight=e,this.update()}get padding(){return this._padding}set padding(e){this._padding=e,this.update()}get trim(){return this._trim}set trim(e){this._trim=e,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline=e,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace=e,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap=e,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth=e,this.update()}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...Ht.defaultFillStyle,...e},()=>{this._fill=_i({...this._originalFill},Ht.defaultFillStyle)})),this._fill=_i(e===0?"black":e,Ht.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...Ht.defaultStrokeStyle,...e},()=>{this._stroke=jo({...this._originalStroke},Ht.defaultStrokeStyle)})),this._stroke=jo(e,Ht.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Fh(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=Yo.defaultTextStyle;for(let t in e)this[t]=e[t]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Yo({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(e=!1){if(this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(e,t){return new Proxy(e,{set:(i,s,o)=>(i[s]=o,t?.(s,o),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(oe.isColorLike(e)||e instanceof qt||e instanceof yi)}};jg.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};jg.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};Oe=jg});function Oh(r,e,t,i){let s=JO;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=je.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/i,o.frame.height=t/i,o.source.emit("update",o.source),o.updateUvs(),o}var JO,Yg=y(()=>{Oi();$t();JO=new Ee});function ks(r){let e=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,t=r.fontFamily;Array.isArray(r.fontFamily)||(t=r.fontFamily.split(","));for(let i=t.length-1;i>=0;i--){let s=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!eU.includes(s)&&(s=`"${s}"`),t[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${e} ${t.join(",")}`}var eU,Uh=y(()=>{"use strict";eU=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var qg,Ir,De,Qa=y(()=>{Re();Uh();qg={willReadFrequently:!0},Ir=class q{static get experimentalLetterSpacingSupported(){let e=q._experimentalLetterSpacingSupported;if(e!==void 0){let t=j.get().getCanvasRenderingContext2D().prototype;e=q._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,i,s,o,n,a,l,c){this.text=e,this.style=t,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c}static measureText(e=" ",t,i=q._canvas,s=t.wordWrap){let o=`${e}:${t.styleKey}`;if(q._measurementCache[o])return q._measurementCache[o];let n=ks(t),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);let l=q.__context;l.font=n;let u=(s?q._wordWrap(e,t,i):e).split(/(?:\r\n|\r|\n)/),h=new Array(u.length),d=0;for(let v=0;v0)if(s)n-=t,c-=t;else{let u=(q.graphemeSegmenter(e).length-1)*t;n+=u,c+=u}return Math.max(n,c)}static _wordWrap(e,t,i=q._canvas){let s=i.getContext("2d",qg),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:u}=t,h=q._collapseSpaces(u),d=q._collapseNewlines(u),f=!h,p=t.wordWrapWidth+c,m=q._tokenize(e);for(let g=0;gp)if(n!==""&&(a+=q._addLine(n),n="",o=0),q.canBreakWords(_,t.breakWords)){let x=q.wordWrapSplit(_);for(let T=0;Tp&&(a+=q._addLine(n),f=!1,n="",o=0),n+=b,o+=I}}else{n.length>0&&(a+=q._addLine(n),n="",o=0);let x=g===m.length-1;a+=q._addLine(_,!x),f=!1,n="",o=0}else v+o>p&&(f=!1,a+=q._addLine(n),n="",o=0),(n.length>0||!q.isBreakingSpace(_)||f)&&(n+=_,o+=v)}return a+=q._addLine(n,!1),a}static _addLine(e,t=!0){return e=q._trimRight(e),e=t?`${e} +`:e,e}static _getFromCache(e,t,i,s){let o=i[e];return typeof o!="number"&&(o=q._measureText(e,t,s)+t,i[e]=o),o}static _collapseSpaces(e){return e==="normal"||e==="pre-line"}static _collapseNewlines(e){return e==="normal"}static _trimRight(e){if(typeof e!="string")return"";for(let t=e.length-1;t>=0;t--){let i=e[t];if(!q.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:q._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:q._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let t=[],i="";if(typeof e!="string")return t;for(let s=0;s{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return e=>[...r.segment(e)].map(t=>t.segment)}return r=>[...r]})();Ir.experimentalLetterSpacing=!1;Ir._fonts={};Ir._newlines=[10,13];Ir._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Ir._measurementCache={};De=Ir});function qo(r,e,t,i=0){if(r.texture===k.WHITE&&!r.fill)return oe.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof yi){let s=r.fill,o=e.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(G.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof qt){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&t&&(a=t.width+i,l=t.height+i);let c,u=!1;if(o){let{start:h,end:d}=s;c=e.createLinearGradient(h.x*a,h.y*l,d.x*a,d.y*l),u=Math.abs(d.x-h.x){let m=f+p.offset*h;c.addColorStop(Math.floor(m*$w)/$w,oe.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(h=>{c.addColorStop(h.offset,oe.shared.setValue(h.color).toHex())});return c}}else{let s=e.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(G.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return W("FillStyle not recognised",r),"red"}var $w,Kg=y(()=>{Tt();ge();ve();Ae();No();wh();$w=1e5});var Ja,Xw=y(()=>{Tt();U();ya();zo();Oi();sw();Xe();Bs();Yg();Qa();Uh();Kg();Ja=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,i){let s=De.measureText(e||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*t),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*t);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=di(o),n=di(n),{width:o,height:n}}getTexture(e,t,i,s){typeof e=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:t}),e.style instanceof Oe||(e.style=new Oe(e.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(o._source),Kt.returnCanvasAndContext(n),o}createTextureAndCanvas(e){let{text:t,style:i}=e,s=e.resolution??this._renderer.resolution,o=De.measureText(t||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),l=Kt.getOptimalCanvasAndContext(n,a),{canvas:c}=l;this.renderTextToCanvas(t,i,s,l);let u=Oh(c,n,a,s);if(i.trim){let h=iw(c,s);u.frame.copyFrom(h),u.updateUvs()}return{texture:u,canvasAndContext:l}}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let t=e._getKey();if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(e);return this._activeTextures[t]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}returnTexture(e){let t=e.source;t.resource=null,t.uploadMethodId="unknown",t.alphaMode="no-premultiply-alpha",je.returnTexture(e)}decreaseReferenceCount(e){let t=this._activeTextures[e];t.usageCount--,t.usageCount===0&&(Kt.returnCanvasAndContext(t.canvasAndContext),this.returnTexture(t.texture),this._activeTextures[e]=null)}getReferenceCount(e){return this._activeTextures[e].usageCount}renderTextToCanvas(e,t,i,s){let{canvas:o,context:n}=s,a=ks(t),l=De.measureText(e||" ",t),c=l.lines,u=l.lineHeight,h=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,p=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=t.textBaseline,t._stroke?.width){let v=t._stroke;n.lineWidth=v.width,n.miterLimit=v.miterLimit,n.lineJoin=v.join,n.lineCap=v.cap}n.font=a;let m,g,_=t.dropShadow?2:1;for(let v=0;v<_;++v){let x=t.dropShadow&&v===0,T=x?Math.ceil(Math.max(1,p)+t.padding*2):0,b=T*i;if(x){n.fillStyle="black",n.strokeStyle="black";let I=t.dropShadow,B=I.color,C=I.alpha;n.shadowColor=oe.shared.setValue(B).setAlpha(C).toRgbaString();let A=I.blur*i,P=I.distance*i;n.shadowBlur=A,n.shadowOffsetX=Math.cos(I.angle)*P,n.shadowOffsetY=Math.sin(I.angle)*P+b}else{if(n.fillStyle=t._fill?qo(t._fill,n,l):null,t._stroke?.width){let I=t._stroke.width*t._stroke.alignment;n.strokeStyle=qo(t._stroke,n,l,I)}n.shadowColor="black"}let w=(u-f.fontSize)/2;u-f.fontSize<0&&(w=0);let E=t._stroke?.width??0;for(let I=0;I{U();ew();Xw();V.add(Ja);V.add(qa)});var Ue,Qg=y(()=>{Xe();Xu();kh();Ue=class r extends Li{constructor(e){e instanceof Ht&&(e={context:e});let{context:t,roundPixels:i,...s}=e||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",t?this._context=t:this._context=this._ownedContext=new Ht,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(e){e!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=e,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(e){return this._context.containsPoint(e)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||e?.context===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_callContextMethod(e,t){return this.context[e](...t),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(e,t,i){X(ie,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return e&&(s.width=e),t&&(s.color=t),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(e,t){X(ie,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return e!==void 0&&(i.color=e),t!==void 0&&(i.alpha=t),this.context.fillStyle=i,this}endFill(){X(ie,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let e=this.context.strokeStyle;return(e.width!==Ht.defaultStrokeStyle.width||e.color!==Ht.defaultStrokeStyle.color||e.alpha!==Ht.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return X(ie,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return X(ie,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return X(ie,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return X(ie,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return X(ie,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return X(ie,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}});var jw,Yw,qw=y(()=>{"use strict";jw={name:"local-uniform-msdf-bit",vertex:{header:` struct LocalUniforms { uColor:vec4, uTransformMatrix:mat3x3, @@ -392,7 +392,7 @@ fn mainFragment( @group(2) @binding(0) var localUniforms : LocalUniforms; `,main:` outColor = vec4(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance)); - `}},oS={name:"local-uniform-msdf-bit",vertex:{header:` + `}},Yw={name:"local-uniform-msdf-bit",vertex:{header:` uniform mat3 uTransformMatrix; uniform vec4 uColor; uniform float uRound; @@ -408,7 +408,7 @@ fn mainFragment( uniform float uDistance; `,main:` outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance)); - `}}});var aS,lS,hS=x(()=>{"use strict";aS={name:"msdf-bit",fragment:{header:` + `}}});var Kw,Zw,Qw=y(()=>{"use strict";Kw={name:"msdf-bit",fragment:{header:` fn calculateMSDFAlpha(msdfColor:vec4, shapeColor:vec4, distance:f32) -> f32 { // MSDF @@ -435,7 +435,7 @@ fn mainFragment( return coverage; } - `}},lS={name:"msdf-bit",fragment:{header:` + `}},Zw={name:"msdf-bit",fragment:{header:` float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) { // MSDF @@ -462,16 +462,16 @@ fn mainFragment( return coverage; } - `}}});var Gm,Um,$c,cS=x(()=>{gt();ns();Bi();Jn();ta();Fi();xc();br();Ge();nS();hS();$c=class extends qt{constructor(){let t=new Ct({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new k,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=nr();Gm??(Gm=kr({name:"sdf-shader",bits:[lo,co(e),sS,aS,Ur]})),Um??(Um=Gr({name:"sdf-shader",bits:[ho,uo(e),oS,lS,Or]})),super({glProgram:Um,gpuProgram:Gm,resources:{localUniforms:t,batchSamplers:fo(e)}})}}});var Ao,Om=x(()=>{Ae();zt();Ao=class extends It{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return j(it,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return j(it,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return j(it,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return j(it,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return j(it,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});function Xc(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let t=[];for(let e=0,i=r.length;e{"use strict"});var uS,Dm,fS=x(()=>{be();ae();bo();eo();vt();zt();pa();zc();Bm();ps();Om();Lm();uS=class dS extends Ao{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let e={...dS.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=M.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=ms(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=Jt.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){let e=Xc(t).filter(p=>!this._currentChars.includes(p)).filter((p,b,y)=>y.indexOf(p)===b);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.texture.source,a=this._style,l=this._currentX,h=this._currentY,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*c,d=0,f=!1,m=s.width/this.resolution,g=s.height/this.resolution;for(let p=0;pm&&(h+=d,d=T,l=0,h+d>g)){n.update();let A=this._nextPage();s=A.canvasAndContext.canvas,o=A.canvasAndContext.context,n=A.texture.source,h=0}let C=_/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[b]={id:b.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:C,kerning:{}},f){this._drawGlyph(o,y,l+u,h+u,c,a);let A=n.width*c,P=n.height*c,R=new ot(l/A*n.width,h/P*n.height,w/A*n.width,T/P*n.height);this.chars[b].texture=new M({source:n,frame:R}),l+=Math.ceil(w)}}n.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return j(it,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let i=this._measureCache;for(let s=0;s{let g=o.width;for(let p=0;p{let m=o.chars.length-1;if(i){let g=o.chars[m];for(;g===" ";)o.width-=e.chars[g].xAdvance,g=o.chars[--m]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let m=0;mf?(c(),h(l),p||o.charPositions.push(0)):(l.start=o.width,h(l),p||o.charPositions.push(0)),g==="\r"||g===` -`)o.width!==0&&c();else if(!p){let E=b.xAdvance+(b.kerning[n]||0)+d;o.width+=E,o.spaceWidth=E,o.spacesIndex.push(o.charPositions.length),o.chars.push(g)}}else{let S=b.kerning[n]||0,E=b.xAdvance+S+d;l.positions[l.index++]=l.width+S,l.chars.push(g),l.width+=E}n=g}return c(),t.align==="center"?a2(s):t.align==="right"?l2(s):t.align==="justify"&&h2(s),s}function a2(r){for(let t=0;t{"use strict"});var Yc,Hm,ga,Vm=x(()=>{Ci();zt();Pt();ps();fS();Nm();Lm();Yc=0,Hm=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let i=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!Tt.has(i)){let n=new Dm({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});Yc++,Yc>50&&N("BitmapText",`You have dynamically created ${Yc} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Yc--,Tt.remove(i)}),Tt.set(i,n)}let o=Tt.get(i);return o.ensureCharacters?.(t),o}getLayout(t,e,i=!0){let s=this.getFont(t,e);return jc([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},j(it,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Ht?s:new Ht(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Dm({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),l=Xc(e.chars);return a.ensureCharacters(l.join("")),Tt.set(`${i}-bitmap`,a),a.once("destroy",()=>Tt.remove(`${i}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,i=Tt.get(e);i&&i.destroy()}},ga=new Hm});function pS(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}var xa,mS=x(()=>{Ci();B();Be();km();cS();Vm();Nm();xa=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let i=this._getGpuBitmapText(t);pS(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(st.return(e.customShader),e.customShader=null),st.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);pS(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:i}=e,s=ga.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=st.get($c)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,l=jc(o,n,s,!0),h=0,c=n.padding,u=l.scale,d=l.width,f=l.height+l.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),i.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let m=s.applyFillAsTint?n._fill.color:16777215;for(let g=0;g{B();mS();L.add(xa)});var ya,gS=x(()=>{B();vt();Be();ha();dm();ya=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),i._batcher.updateElement(i)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),st.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,ca(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=i;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),ca(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:M.EMPTY,currentKey:"--",batchableSprite:st.get(Nr),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=M.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};ya.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"htmlText"}});function xS(){let{userAgent:r}=Y.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var yS=x(()=>{Ft()});var _S,bS,Po,zm=x(()=>{"use strict";_S="http://www.w3.org/2000/svg",bS="http://www.w3.org/1999/xhtml",Po=class{constructor(){this.svgRoot=document.createElementNS(_S,"svg"),this.foreignObject=document.createElementNS(_S,"foreignObject"),this.domElement=document.createElementNS(bS,"div"),this.styleElement=document.createElementNS(bS,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}});function SS(r){let t=r._stroke,e=r._fill,s=[`div { ${[`color: ${nt.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[ES(t)]:[],...r.dropShadow?[wS(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return c2(r.tagStyles,s),s.join(" ")}function wS(r){let t=nt.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function ES(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${nt.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${nt.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function c2(r,t){for(let e in r){let i=r[e],s=[];for(let o in i)TS[o]?s.push(TS[o](i[o])):vS[o]&&s.push(vS[o].replace("{{VALUE}}",i[o]));t.push(`${e} { ${s.join(";")} }`)}}var vS,TS,AS=x(()=>{be();vS={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},TS={fill:r=>`color: ${nt.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:ES,dropShadow:wS}});var qc,PS=x(()=>{Pt();ps();Cm();AS();qc=class r extends Ht{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Vc(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new r({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=SS(this)),this._cssStyle}addOverride(...t){let e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&N("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&N("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function CS(r,t){let e=t.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(e))for(let l=0;l{let h=l.split(":")[1].trim();a(h)});for(let l in t.tagStyles){let h=t.tagStyles[l].fontFamily;a(h)}return i}var RS=x(()=>{"use strict"});async function MS(r){let e=await(await Y.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(e)})}var IS=x(()=>{Ft()});async function $m(r,t){let e=await MS(t);return`@font-face { + `}}});var Jg,ex,Gh,Jw=y(()=>{ge();ws();$i();Ga();La();Xi();ch();Mr();It();qw();Qw();Gh=class extends Ze{constructor(){let e=new be({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new G,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),t=pr();Jg??(Jg=Wr({name:"sdf-shader",bits:[ko,Oo(t),jw,Kw,$r]})),ex??(ex=zr({name:"sdf-shader",bits:[Fo,Uo(t),Yw,Zw,Xr]})),super({glProgram:ex,gpuProgram:Jg,resources:{localUniforms:e,batchSamplers:Go(t)}})}}});var Ko,tx=y(()=>{Mt();Xe();Ko=class extends Ce{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return X(ie,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return X(ie,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return X(ie,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return X(ie,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return X(ie,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners();for(let t in this.chars)this.chars[t].texture?.destroy();this.chars=null,e&&(this.pages.forEach(t=>t.texture.destroy(!0)),this.pages=null)}}});function Lh(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let e=[];for(let t=0,i=r.length;t{"use strict"});var eE,ix,rE=y(()=>{Tt();ut();zo();Ao();ve();Xe();Qa();Uh();Kg();Bs();tx();rx();eE=class tE extends Ko{constructor(e){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let t={...tE.defaultOptions,...e};this._textureSize=t.textureSize,this._mipmap=t.mipmap;let i=t.style.clone();t.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=k.WHITE,i._fill.fill=null),this.applyFillAsTint=t.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=ks(i);t.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=t.skipKerning??!1,this.resolution=t.resolution??1,this._padding=t.padding??4,this.fontMetrics=De.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(e){let t=Lh(e).filter(g=>!this._currentChars.includes(g)).filter((g,_,v)=>v.indexOf(g)===_);if(!t.length)return;this._currentChars=[...this._currentChars,...t];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.texture.source,a=this._style,l=this._currentX,c=this._currentY,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,h=this._padding*u,d=0,f=!1,p=s.width/this.resolution,m=s.height/this.resolution;for(let g=0;gp&&(c+=d,d=E,l=0,c+d>m)){n.update();let B=this._nextPage();s=B.canvasAndContext.canvas,o=B.canvasAndContext.context,n=B.texture.source,c=0}let I=x/u-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:I,kerning:{}},f){this._drawGlyph(o,v,l+h,c+h,u,a);let B=n.width*u,C=n.height*u,A=new Q(l/B*n.width,c/C*n.height,w/B*n.width,E/C*n.height);this.chars[_].texture=new k({source:n,frame:A}),l+=Math.ceil(w)}}n.update(),this._currentX=l,this._currentY=c,this._skipKerning&&this._applyKerning(t,o)}get pageTextures(){return X(ie,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,t){let i=this._measureCache;for(let s=0;s{let m=o.width;for(let g=0;g{let p=o.chars.length-1;if(i){let m=o.chars[p];for(;m===" ";)o.width-=t.chars[m].xAdvance,m=o.chars[--p]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=t.lineHeight},h=t.baseMeasurementFontSize/e.fontSize,d=e.letterSpacing*h,f=e.wordWrapWidth*h;for(let p=0;pf?(u(),c(l),g||o.charPositions.push(0)):(l.start=o.width,c(l),g||o.charPositions.push(0)),m==="\r"||m===` +`)o.width!==0&&u();else if(!g){let b=_.xAdvance+(_.kerning[n]||0)+d;o.width+=b,o.spaceWidth=b,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let T=_.kerning[n]||0,b=_.xAdvance+T+d;l.positions[l.index++]=l.width+T,l.chars.push(m),l.width+=b}n=m}return u(),e.align==="center"?tU(s):e.align==="right"?rU(s):e.align==="justify"&&iU(s),s}function tU(r){for(let e=0;e{"use strict"});var Nh,ox,el,nx=y(()=>{Hi();Xe();Ae();Bs();rE();sx();rx();Nh=0,ox=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(e,t){let i=`${t.fontFamily}-bitmap`,s=!0;if(t._fill.fill&&!t._stroke)i+=t._fill.fill.styleKey,s=!1;else if(t._stroke||t.dropShadow){let n=t.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!Se.has(i)){let n=new ix({style:t,overrideFill:s,overrideSize:!0,...this.defaultOptions});Nh++,Nh>50&&W("BitmapText",`You have dynamically created ${Nh} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Nh--,Se.remove(i)}),Se.set(i,n)}let o=Se.get(i);return o.ensureCharacters?.(e),o}getLayout(e,t,i=!0){let s=this.getFont(e,t);return Dh([...e],t,s,i)}measureText(e,t,i=!0){return this.getLayout(e,t,i)}install(...e){let t=e[0];typeof t=="string"&&(t={name:t,style:e[1],chars:e[2]?.chars,resolution:e[2]?.resolution,padding:e[2]?.padding,skipKerning:e[2]?.skipKerning},X(ie,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=t?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");t={...this.defaultOptions,...t};let s=t.style,o=s instanceof Oe?s:new Oe(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new ix({style:o,overrideFill:n,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1}),l=Lh(t.chars);return a.ensureCharacters(l.join("")),Se.set(`${i}-bitmap`,a),a.once("destroy",()=>Se.remove(`${i}-bitmap`)),a}uninstall(e){let t=`${e}-bitmap`,i=Se.get(t);i&&i.destroy()}},el=new ox});function iE(r,e){e.groupTransform=r.groupTransform,e.groupColorAlpha=r.groupColorAlpha,e.groupColor=r.groupColor,e.groupBlendMode=r.groupBlendMode,e.globalDisplayStatus=r.globalDisplayStatus,e.groupTransform=r.groupTransform,e.localDisplayStatus=r.localDisplayStatus,e.groupAlpha=r.groupAlpha,e._roundPixels=r._roundPixels}var tl,sE=y(()=>{Hi();U();Gt();Qg();Jw();nx();sx();tl=class{constructor(e){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(e){let t=this._getGpuBitmapText(e);return e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,t)),this._renderer.renderPipes.graphics.validateRenderable(t)}addRenderable(e,t){let i=this._getGpuBitmapText(e);iE(e,i),e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,i)),this._renderer.renderPipes.graphics.addRenderable(i,t),i.context.customShader&&this._updateDistanceField(e)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(e.uid)}_destroyRenderableByUid(e){let t=this._gpuBitmapText[e].context;t.customShader&&(se.return(t.customShader),t.customShader=null),se.return(this._gpuBitmapText[e]),this._gpuBitmapText[e]=null}updateRenderable(e){let t=this._getGpuBitmapText(e);iE(e,t),this._renderer.renderPipes.graphics.updateRenderable(t),t.context.customShader&&this._updateDistanceField(e)}_updateContext(e,t){let{context:i}=t,s=el.getFont(e.text,e._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=se.get(Gh)));let o=Array.from(e.text),n=e._style,a=s.baseLineOffset,l=Dh(o,n,s,!0),c=0,u=n.padding,h=l.scale,d=l.width,f=l.height+l.offsetY;n._stroke&&(d+=n._stroke.width/h,f+=n._stroke.width/h),i.translate(-e._anchor._x*d-u,-e._anchor._y*f-u).scale(h,h);let p=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m{U();sE();V.add(tl)});var rl,oE=y(()=>{U();ve();Gt();ja();Rg();rl=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e];if(!t)continue;let i=t.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();return t.textureNeedsUploading?(t.textureNeedsUploading=!1,!0):t.currentKey!==i}addRenderable(e,t){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,t)}updateRenderable(e){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),i._batcher.updateElement(i)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.htmlText.decreaseReferenceCount(t.currentKey),se.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e).catch(o=>{console.error(o)}),e._didTextUpdate=!1,Ya(s,e)}async _updateGpuText(e){e._didTextUpdate=!1;let t=this._getGpuText(e);if(t.generatingTexture)return;let i=e._getKey();this._renderer.htmlText.decreaseReferenceCount(t.currentKey),t.generatingTexture=!0,t.currentKey=i;let s=e.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(e.text,s,e._style,e._getKey()),n=t.batchableSprite;n.texture=t.texture=o,t.generatingTexture=!1,t.textureNeedsUploading=!0,e.onViewUpdate(),Ya(n,e)}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:k.EMPTY,currentKey:"--",batchableSprite:se.get(qr),textureNeedsUploading:!1,generatingTexture:!1},i=t.batchableSprite;return i.renderable=e,i.transform=e.groupTransform,i.texture=k.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|e._roundPixels,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._gpuText[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};rl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"htmlText"}});function nE(){let{userAgent:r}=j.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var aE=y(()=>{Re()});var lE,cE,Zo,lx=y(()=>{"use strict";lE="http://www.w3.org/2000/svg",cE="http://www.w3.org/1999/xhtml",Zo=class{constructor(){this.svgRoot=document.createElementNS(lE,"svg"),this.foreignObject=document.createElementNS(lE,"foreignObject"),this.domElement=document.createElementNS(cE,"div"),this.styleElement=document.createElementNS(cE,"style"),this.image=new Image;let{foreignObject:e,svgRoot:t,styleElement:i,domElement:s}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",t.appendChild(e),e.appendChild(i),e.appendChild(s)}}});function dE(r){let e=r._stroke,t=r._fill,s=[`div { ${[`color: ${oe.shared.setValue(t.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...e?[pE(e)]:[],...r.dropShadow?[fE(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return sU(r.tagStyles,s),s.join(" ")}function fE(r){let e=oe.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),t=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${t}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${e}`:`text-shadow: ${s} ${e}`}function pE(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${oe.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${oe.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function sU(r,e){for(let t in r){let i=r[t],s=[];for(let o in i)hE[o]?s.push(hE[o](i[o])):uE[o]&&s.push(uE[o].replace("{{VALUE}}",i[o]));e.push(`${t} { ${s.join(";")} }`)}}var uE,hE,mE=y(()=>{Tt();uE={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},hE={fill:r=>`color: ${oe.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:pE,dropShadow:fE}});var Hh,gE=y(()=>{Ae();Bs();Xg();mE();Hh=class r extends Oe{constructor(e={}){super(e),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=e.cssOverrides),this.tagStyles=e.tagStyles??{}}set cssOverrides(e){this._cssOverrides=e instanceof Array?e:[e],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Fh(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new r({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=dE(this)),this._cssStyle}addOverride(...e){let t=e.filter(i=>!this.cssOverrides.includes(i));t.length>0&&(this.cssOverrides.push(...t),this.update())}removeOverride(...e){let t=e.filter(i=>this.cssOverrides.includes(i));t.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!t.includes(i)),this.update())}set fill(e){typeof e!="string"&&typeof e!="number"&&W("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&W("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}});function xE(r,e){let t=e.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(t))for(let l=0;l{let c=l.split(":")[1].trim();a(c)});for(let l in e.tagStyles){let c=e.tagStyles[l].fontFamily;a(c)}return i}var yE=y(()=>{"use strict"});async function _E(r){let t=await(await j.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(t)})}var bE=y(()=>{Re()});async function cx(r,e){let t=await _E(e);return`@font-face { font-family: "${r.fontFamily}"; - src: url('${e}'); + src: url('${t}'); font-weight: ${r.fontWeight}; font-style: ${r.fontStyle}; - }`}var BS=x(()=>{IS()});async function FS(r,t,e){let i=r.filter(s=>Tt.has(`${s}-and-url`)).map((s,o)=>{if(!Kc.has(s)){let{url:n}=Tt.get(`${s}-and-url`);o===0?Kc.set(s,$m({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):Kc.set(s,$m({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return Kc.get(s)});return(await Promise.all(i)).join(` -`)}var Kc,kS=x(()=>{Ci();BS();Kc=new Map});function GS(r,t,e,i,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`
${r}
`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=i;let{width:l,height:h}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(a)}var US=x(()=>{"use strict"});function OS(r,t){let e=$e.getOptimalCanvasAndContext(r.width,r.height,t),{context:i}=e;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),e}var LS=x(()=>{bo()});function DS(r,t,e){return new Promise(async i=>{e&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}var NS=x(()=>{"use strict"});function VS(r,t,e,i){i||(i=HS||(HS=new Po));let{domElement:s,styleElement:o,svgRoot:n}=i;s.innerHTML=`
${r}
`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let l=t.padding*2;return{width:a.width-l,height:a.height-l}}var HS,WS=x(()=>{zm()});var Co,zS=x(()=>{B();bo();Si();Lr();yS();Pt();Be();Mm();zm();PS();RS();kS();US();LS();NS();WS();Co=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===re.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,i).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,i){let s=st.get(Po),o=CS(t,i),n=await FS(o,i,qc.defaultTextStyle),a=VS(t,i,n,s),l=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*e),h=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*e),c=s.image,u=2;c.width=(l|0)+u,c.height=(h|0)+u;let d=GS(t,i,e,n,s);await DS(c,d,xS()&&o.length>0);let f=c,m;this._createCanvas&&(m=OS(c,e));let g=Wc(m?m.canvas:f,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(g.source),$e.returnCanvasAndContext(m)),st.return(s),g}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{N("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){$t.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};Co.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"htmlText"};Co.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var Xm=x(()=>{B();gS();zS();L.add(Co);L.add(ya)});var $S,Ro,Zc=x(()=>{Mi();oi();oo();zt();$S=class XS extends ar{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(j(it,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...XS.defaultOptions,...e};let i=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(i.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new Yt({data:i,label:"attribute-mesh-positions",shrinkToFit:n,usage:ht.VERTEX|ht.COPY_DST}),l=new Yt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:ht.VERTEX|ht.COPY_DST}),h=new Yt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:ht.INDEX|ht.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,topology:e.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};$S.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};Ro=$S});var gs,jS,Mo,Io=x(()=>{"use strict";gs={name:"local-uniform-bit",vertex:{header:` + }`}var vE=y(()=>{bE()});async function TE(r,e,t){let i=r.filter(s=>Se.has(`${s}-and-url`)).map((s,o)=>{if(!Vh.has(s)){let{url:n}=Se.get(`${s}-and-url`);o===0?Vh.set(s,cx({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n)):Vh.set(s,cx({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n))}return Vh.get(s)});return(await Promise.all(i)).join(` +`)}var Vh,SE=y(()=>{Hi();vE();Vh=new Map});function wE(r,e,t,i,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`
${r}
`,o.setAttribute("style",`transform: scale(${t});transform-origin: top left; display: inline-block`),n.textContent=i;let{width:l,height:c}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",c.toString()),new XMLSerializer().serializeToString(a)}var EE=y(()=>{"use strict"});function AE(r,e){let t=Kt.getOptimalCanvasAndContext(r.width,r.height,e),{context:i}=t;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),t}var PE=y(()=>{zo()});function CE(r,e,t){return new Promise(async i=>{t&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(e)}`,r.crossOrigin="anonymous"})}var ME=y(()=>{"use strict"});function IE(r,e,t,i){i||(i=RE||(RE=new Zo));let{domElement:s,styleElement:o,svgRoot:n}=i;s.innerHTML=`
${r}
`,s.setAttribute("style","transform-origin: top left; display: inline-block"),t&&(o.textContent=t),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let l=e.padding*2;return{width:a.width-l,height:a.height-l}}var RE,BE=y(()=>{lx()});var Qo,kE=y(()=>{U();zo();Oi();jr();aE();Ae();Gt();Yg();lx();gE();yE();SE();EE();PE();ME();BE();Qo=class{constructor(e){this._activeTextures={},this._renderer=e,this._createCanvas=e.type===ot.WEBGPU}getTexture(e){return this._buildTexturePromise(e.text,e.resolution,e.style)}getManagedTexture(e,t,i,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(e,t,i).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(e,t,i){let s=se.get(Zo),o=xE(e,i),n=await TE(o,i,Hh.defaultTextStyle),a=IE(e,i,n,s),l=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*t),c=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*t),u=s.image,h=2;u.width=(l|0)+h,u.height=(c|0)+h;let d=wE(e,i,t,n,s);await CE(u,d,nE()&&o.length>0);let f=u,p;this._createCanvas&&(p=AE(u,t));let m=Oh(p?p.canvas:f,u.width-h,u.height-h,t);return this._createCanvas&&(this._renderer.texture.initSource(m.source),Kt.returnCanvasAndContext(p)),se.return(s),m}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){let t=this._activeTextures[e];t&&(t.usageCount--,t.usageCount===0&&(t.texture?this._cleanUp(t):t.promise.then(i=>{t.texture=i,this._cleanUp(t)}).catch(()=>{W("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[e]=null))}_cleanUp(e){je.returnTexture(e.texture),e.texture.source.resource=null,e.texture.source.uploadMethodId="unknown"}getReferenceCount(e){return this._activeTextures[e].usageCount}destroy(){this._activeTextures=null}};Qo.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"htmlText"};Qo.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var ux=y(()=>{U();oE();kE();V.add(Qo);V.add(rl)});var FE,Jo,Wh=y(()=>{Wi();gi();Ro();Xe();FE=class OE extends mr{constructor(...e){let t=e[0]??{};t instanceof Float32Array&&(X(ie,"use new MeshGeometry({ positions, uvs, indices }) instead"),t={positions:t,uvs:e[1],indices:e[2]}),t={...OE.defaultOptions,...t};let i=t.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=t.uvs;s||(t.positions?s=new Float32Array(i.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=t.indices||new Uint32Array([0,1,2,0,2,3]),n=t.shrinkBuffersToFit,a=new Ke({data:i,label:"attribute-mesh-positions",shrinkToFit:n,usage:le.VERTEX|le.COPY_DST}),l=new Ke({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:le.VERTEX|le.COPY_DST}),c=new Ke({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:le.INDEX|le.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:c,topology:t.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(e){this.attributes.aPosition.buffer.data=e}get uvs(){return this.attributes.aUV.buffer.data}set uvs(e){this.attributes.aUV.buffer.data=e}get indices(){return this.indexBuffer.data}set indices(e){this.indexBuffer.data=e}};FE.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};Jo=FE});var Fs,UE,en,tn=y(()=>{"use strict";Fs={name:"local-uniform-bit",vertex:{header:` struct LocalUniforms { uTransformMatrix:mat3x3, @@ -488,7 +488,7 @@ fn mainFragment( { vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); } - `}},jS={...gs,vertex:{...gs.vertex,header:gs.vertex.header.replace("group(1)","group(2)")}},Mo={name:"local-uniform-bit",vertex:{header:` + `}},UE={...Fs,vertex:{...Fs.vertex,header:Fs.vertex.header.replace("group(1)","group(2)")}},en={name:"local-uniform-bit",vertex:{header:` uniform mat3 uTransformMatrix; uniform vec4 uColor; @@ -501,7 +501,7 @@ fn mainFragment( { gl_Position.xy = roundPixels(gl_Position.xy, uResolution); } - `}}});var YS,qS,KS=x(()=>{"use strict";YS={name:"tiling-bit",vertex:{header:` + `}}});var GE,LE,DE=y(()=>{"use strict";GE={name:"tiling-bit",vertex:{header:` struct TilingUniforms { uMapCoord:mat3x3, uClampFrame:vec4, @@ -544,7 +544,7 @@ fn mainFragment( } outColor = textureSampleBias(uTexture, uSampler, coord, bias); - `}},qS={name:"tiling-bit",vertex:{header:` + `}},LE={name:"tiling-bit",vertex:{header:` uniform mat3 uTextureTransform; uniform vec4 uSizeAnchor; @@ -566,7 +566,7 @@ fn mainFragment( outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0 - `}}});var jm,Ym,Qc,ZS=x(()=>{gt();Bi();Io();Fi();br();Ge();vt();KS();Qc=class extends qt{constructor(){jm??(jm=kr({name:"tiling-sprite-shader",bits:[gs,YS,Ur]})),Ym??(Ym=Gr({name:"tiling-sprite-shader",bits:[Mo,qS,Or]}));let t=new Ct({uMapCoord:{value:new k,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new k,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:Ym,gpuProgram:jm,resources:{localUniforms:new Ct({uTransformMatrix:{value:new k,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:M.EMPTY.source,uSampler:M.EMPTY.source.style}})}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,h=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*l/t,i.b*l/e,i.c*h/t,i.d*h/e,i.tx/t,i.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,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 Jc,QS=x(()=>{Zc();Jc=class extends Ro{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 JS(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}var tw=x(()=>{"use strict"});function ew(r,t,e,i){let s=0,o=r.length/(t||2),n=i.a,a=i.b,l=i.c,h=i.d,c=i.tx,u=i.ty;for(e*=t;s{"use strict"});function iw(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.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=k.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),ew(t,2,0,a)}var sw=x(()=>{gt();rw()});var tu,_a,ow=x(()=>{B();Kn();vr();Lr();yo();Pc();Zc();ZS();QS();tw();sw();tu=new Jc,_a=class{constructor(t){this._state=Qt.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),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ki);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,i.addToBatch(a,e)}else i.break(e),s.shader||(s.shader=new Qc),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,Dr(t.groupColorAlpha,i.uColor,0),this._state.blendMode=si(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:tu,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){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 Ro({indices:tu.indices,positions:tu.positions.slice(),uvs:tu.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),iw(t,i.uvs),JS(t,i.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),i=t.texture,s=!0;return this._renderer.type===re.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};_a.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"tilingSprite"}});var qm=x(()=>{B();ow();L.add(_a)});var nw,lw,hw=x(()=>{zt();Zc();nw=class aw extends Ro{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(j(it,"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={...aw.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,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,h=this.height/a;for(let u=0;u{hw();cw=class uw extends lw{constructor(t={}){t={...uw.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:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:h}=this,c=s+o,u=e>c?1:e/c,d=n+a,f=i>d?1:i/d,m=Math.min(u,f),g=l*e,p=h*i;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*m-g,t[4]=t[12]=t[20]=t[28]=e-o*m-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-p,t[9]=t[11]=t[13]=t[15]=n*m-p,t[17]=t[19]=t[21]=t[23]=i-a*m-p,t[25]=t[27]=t[29]=t[31]=i-p,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,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};cw.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};dw=cw});var ba,pw=x(()=>{B();Be();Pc();fw();ba=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 i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,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];st.return(e.geometry),st.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=st.get(ki);return e.geometry=st.get(dw),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}};ba.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"nineSliceSprite"}});var Km=x(()=>{B();pw();L.add(ba)});var va,mw=x(()=>{B();va=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};va.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"filter"}});function gw(r,t){t.clear();let e=t.matrix;for(let i=0;i{"use strict"});var u2,Ta,yw=x(()=>{B();gt();or();Ri();oo();Ge();vt();Si();Lr();Ne();xw();Pt();u2=new ar({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])}),Ta=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Ct({uInputSize:{value:new Float32Array(4),type:"vec4"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new xe({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?gw(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,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,l=0,h=!0,c=!1,u=!1,d=!0;for(let f=0;f0?this._filterStack[this._filterStackIndex-1].bounds:null,l=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(l,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,!1),$t.returnTexture(i);else{let a=e.inputTexture,l=$t.getOptimalTexture(s.width,s.height,a.source._resolution,!1),h=0;for(h=0;h0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,m=f.uniforms,g=m.uOutputFrame,p=m.uInputSize,b=m.uInputPixel,y=m.uInputClamp,_=m.uGlobalFrame,S=m.uOutputTexture;if(c){let T=this._filterStackIndex;for(;T>0;){T--;let C=this._filterStack[this._filterStackIndex-1];if(!C.skip){l.x=C.bounds.minX,l.y=C.bounds.minY;break}}g[0]=a.minX-l.x,g[1]=a.minY-l.y}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,p[0]=e.source.width,p[1]=e.source.height,p[2]=1/p[0],p[3]=1/p[1],b[0]=e.source.pixelWidth,b[1]=e.source.pixelHeight,b[2]=1/b[0],b[3]=1/b[1],y[0]=.5*b[2],y[1]=.5*b[3],y[2]=e.frame.width*p[2]-.5*b[2],y[3]=e.frame.height*p[3]-.5*b[3];let E=this.renderer.renderTarget.rootRenderTarget.colorTexture;_[0]=l.x*u,_[1]=l.y*u,_[2]=E.source.width*u,_[3]=E.source.height*u;let w=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof M?(S[0]=i.frame.width,S[1]=i.frame.height):(S[0]=w.width,S[1]=w.height),S[2]=w.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let T=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(T,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:u2,shader:t,state:t._state,topology:"triangle-list"}),o.type===re.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new At,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(k.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}};Ta.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"filter"}});var Zm=x(()=>{B();mw();yw();L.add(Ta);L.add(va)});var d2={};var _w=x(()=>{vb();tp();Rb();Ib();rc();lc();nm();am();um();Fm();Wm();Xm();qm();Km();Zm()});var f2={};var vw=x(()=>{tp();rc();lc();nm();am();um();Fm();Wm();Xm();qm();Km();Zm()});var Sw,ww,Ew=x(()=>{ls();ao();br();vr();Sw=class Qm extends qt{constructor(t){t={...Qm.defaultOptions,...t},super(t),this.enabled=!0,this._state=Qt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:i,...s}=t,o,n;return e&&(o=hr.from(e)),i&&(n=lr.from(i)),new Qm({gpuProgram:o,glProgram:n,...s})}};Sw.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};ww=Sw});async function Aw(r){if(!r)for(let t=0;t{B();Jm=[];L.handleByNamedList(v.Environment,Jm)});function eu(){if(typeof Sa=="boolean")return Sa;try{Sa=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Sa=!1}return Sa}var Sa,tg=x(()=>{"use strict"});var ye,Bo=x(()=>{"use strict";ye=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(ye||{})});var Fo,eg=x(()=>{"use strict";Fo=class{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,o,n,a,l){let{name:h,items:c}=this;for(let u=0,d=c.length;u{be();Pw();yr();tg();zt();Bo();eg();Ae();p2=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],Cw=class Rw extends It{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let e=[...p2,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Aw(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...Rw.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i{this.runners[e]=new Fo(e)})}_addSystems(t){let e;for(e in t){let i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){let i=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=i[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!eu())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};Cw.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Ui=Cw});var Ea,Bw=x(()=>{B();gt();ns();uc();Bi();Jn();ta();Io();Fi();br();Ge();Ea=class{init(){let t=new Ct({uTransformMatrix:{value:new k,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),e=kr({name:"graphics",bits:[lo,co(nr()),jS,Ur]});this.shader=new qt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),h=o.encoder;h.setGeometry(a.geometry,s.gpuProgram);let c=o.globalUniforms.bindGroup;h.setBindGroup(0,c,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);h.setBindGroup(2,u,s.gpuProgram);let d=l.instructions,f=null;for(let m=0;m{"use strict";Fw={name:"texture-bit",vertex:{header:` + `}}});var hx,dx,zh,NE=y(()=>{ge();$i();tn();Xi();Mr();It();ve();DE();zh=class extends Ze{constructor(){hx??(hx=Wr({name:"tiling-sprite-shader",bits:[Fs,GE,$r]})),dx??(dx=zr({name:"tiling-sprite-shader",bits:[en,LE,Xr]}));let e=new be({uMapCoord:{value:new G,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new G,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:dx,gpuProgram:hx,resources:{localUniforms:new be({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:k.EMPTY.source,uSampler:k.EMPTY.source.style}})}updateUniforms(e,t,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,c=n.height,u=n.textureMatrix,h=a.uniforms.uTextureTransform;h.set(i.a*l/e,i.b*l/t,i.c*c/e,i.d*c/t,i.tx/e,i.ty/t),h.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=h,a.uniforms.uSizeAnchor[0]=e,a.uniforms.uSizeAnchor[1]=t,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var $h,HE=y(()=>{Wh();$h=class extends Jo{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 VE(r,e){let t=r.anchor.x,i=r.anchor.y;e[0]=-t*r.width,e[1]=-i*r.height,e[2]=(1-t)*r.width,e[3]=-i*r.height,e[4]=(1-t)*r.width,e[5]=(1-i)*r.height,e[6]=-t*r.width,e[7]=(1-i)*r.height}var WE=y(()=>{"use strict"});function zE(r,e,t,i){let s=0,o=r.length/(e||2),n=i.a,a=i.b,l=i.c,c=i.d,u=i.tx,h=i.ty;for(t*=e;s{"use strict"});function XE(r,e){let t=r.texture,i=t.frame.width,s=t.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),e[0]=e[6]=-o,e[2]=e[4]=1-o,e[1]=e[3]=-n,e[5]=e[7]=1-n;let a=G.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),zE(e,2,0,a)}var jE=y(()=>{ge();$E()});var Xh,il,YE=y(()=>{U();Fa();Rr();jr();Vo();_h();Wh();NE();HE();WE();jE();Xh=new $h,il=class{constructor(e){this._state=Je.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(e){let t=this._getTilingSpriteData(e),i=t.canBatch;this._updateCanBatch(e);let s=t.canBatch;if(s&&s===i){let{batchableMesh:o}=t;return!o._batcher.checkAndUpdateTexture(o,e.texture)}return i!==s}addRenderable(e,t){let i=this._renderer.renderPipes.batch;this._updateCanBatch(e);let s=this._getTilingSpriteData(e),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ji);let a=s.batchableMesh;e.didViewUpdate&&(this._updateBatchableMesh(e),a.geometry=o,a.renderable=e,a.transform=e.groupTransform,a.setTexture(e._texture)),a.roundPixels=this._renderer._roundPixels|e._roundPixels,i.addToBatch(a,t)}else i.break(t),s.shader||(s.shader=new zh),this.updateRenderable(e),t.add(e)}execute(e){let{shader:t}=this._tilingSpriteDataHash[e.uid];t.groups[0]=this._renderer.globalUniforms.bindGroup;let i=t.resources.localUniforms.uniforms;i.uTransformMatrix=e.groupTransform,i.uRound=this._renderer._roundPixels|e._roundPixels,Yr(e.groupColorAlpha,i.uColor,0),this._state.blendMode=mi(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:Xh,shader:t,state:this._state})}updateRenderable(e){let t=this._getTilingSpriteData(e),{canBatch:i}=t;if(i){let{batchableMesh:s}=t;e.didViewUpdate&&this._updateBatchableMesh(e),s._batcher.updateElement(s)}else if(e.didViewUpdate){let{shader:s}=t;s.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}}destroyRenderable(e){let t=this._getTilingSpriteData(e);t.batchableMesh=null,t.shader?.destroy(),this._tilingSpriteDataHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(e){return this._tilingSpriteDataHash[e.uid]||this._initTilingSpriteData(e)}_initTilingSpriteData(e){let t=new Jo({indices:Xh.indices,positions:Xh.positions.slice(),uvs:Xh.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:t},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let t=this._getTilingSpriteData(e),{geometry:i}=t,s=e.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),XE(e,i.uvs),VE(e,i.positions)}destroy(){for(let e in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[e].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(e){let t=this._getTilingSpriteData(e),i=e.texture,s=!0;return this._renderer.type===ot.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),t.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),t.canBatch}};il.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"tilingSprite"}});var fx=y(()=>{U();YE();V.add(il)});var qE,ZE,QE=y(()=>{Xe();Wh();qE=class KE extends Jo{constructor(...e){super({});let t=e[0]??{};typeof t=="number"&&(X(ie,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),t={width:t,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(t)}build(e){e={...KE.defaultOptions,...e},this.verticesX=this.verticesX??e.verticesX,this.verticesY=this.verticesY??e.verticesY,this.width=this.width??e.width,this.height=this.height??e.height;let t=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,c=this.height/a;for(let h=0;h{QE();JE=class eA extends ZE{constructor(e={}){e={...eA.defaultOptions,...e},super({width:e.width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,{width:t,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:c}=this,u=s+o,h=t>u?1:t/u,d=n+a,f=i>d?1:i/d,p=Math.min(h,f),m=l*t,g=c*i;e[0]=e[8]=e[16]=e[24]=-m,e[2]=e[10]=e[18]=e[26]=s*p-m,e[4]=e[12]=e[20]=e[28]=t-o*p-m,e[6]=e[14]=e[22]=e[30]=t-m,e[1]=e[3]=e[5]=e[7]=-g,e[9]=e[11]=e[13]=e[15]=n*p-g,e[17]=e[19]=e[21]=e[23]=i-a*p-g,e[25]=e[27]=e[29]=e[31]=i-g,this.getBuffer("aPosition").update()}updateUvs(){let e=this.uvs;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1;let t=1/this._originalWidth,i=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=t*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-t*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};JE.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};tA=JE});var sl,iA=y(()=>{U();Gt();_h();rA();sl=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(e,t){let i=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i,t)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];se.return(t.geometry),se.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){t.geometry.update(e),t.setTexture(e._texture)}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=se.get(ji);return t.geometry=se.get(tA),t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e.didViewUpdate||this._updateBatchableSprite(e,t),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};sl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"nineSliceSprite"}});var px=y(()=>{U();iA();V.add(sl)});var ol,sA=y(()=>{U();ol=class{constructor(e){this._renderer=e}push(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};ol.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"filter"}});function oA(r,e){e.clear();let t=e.matrix;for(let i=0;i{"use strict"});var oU,nl,aA=y(()=>{U();ge();fr();Vi();Ro();It();ve();Oi();jr();$t();nA();Ae();oU=new mr({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])}),nl=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new be({uInputSize:{value:new Float32Array(4),type:"vec4"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new gt({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=this.renderer,i=e.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(e.renderables?oA(e.renderables,o):e.filterEffect.filterArea?(o.clear(),o.addRect(e.filterEffect.filterArea),o.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,o),e.container){let p=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=t.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,c=!0,u=!1,h=!1,d=!0;for(let f=0;f0?this._filterStack[this._filterStackIndex-1].bounds:null,l=e.renderTarget.getRenderTarget(t.previousRenderSurface);o=this.getBackTexture(l,s,a)}t.backTexture=o;let n=t.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),e.globalUniforms.pop(),n.length===1)n[0].apply(this,i,t.previousRenderSurface,!1),je.returnTexture(i);else{let a=t.inputTexture,l=je.getOptimalTexture(s.width,s.height,a.source._resolution,!1),c=0;for(c=0;c0&&this._filterStack[d].skip;)--d;d>0&&(h=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,m=p.uOutputFrame,g=p.uInputSize,_=p.uInputPixel,v=p.uInputClamp,x=p.uGlobalFrame,T=p.uOutputTexture;if(u){let E=this._filterStackIndex;for(;E>0;){E--;let I=this._filterStack[this._filterStackIndex-1];if(!I.skip){l.x=I.bounds.minX,l.y=I.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=t.frame.width,m[3]=t.frame.height,g[0]=t.source.width,g[1]=t.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=t.source.pixelWidth,_[1]=t.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],v[0]=.5*_[2],v[1]=.5*_[3],v[2]=t.frame.width*g[2]-.5*_[2],v[3]=t.frame.height*g[3]-.5*_[3];let b=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=l.x*h,x[1]=l.y*h,x[2]=b.source.width*h,x[3]=b.source.height*h;let w=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof k?(T[0]=i.frame.width,T[1]=i.frame.height):(T[0]=w.width,T[1]=w.height),T[2]=w.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let E=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(E,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:oU,shader:e,state:e._state,topology:"triangle-list"}),o.type===ot.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Ee,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,t){let i=this._activeFilterData,s=e.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=t.worldTransform.copyTo(G.shared),n=t.renderGroup||t.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/t.texture.frame.width,1/t.texture.frame.height),s.translate(t.anchor.x,t.anchor.y),s}};nl.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"filter"}});var mx=y(()=>{U();sA();aA();V.add(nl);V.add(ol)});var nU={};var lA=y(()=>{u0();ym();y0();b0();Yu();eh();wg();Eg();Mg();Zg();ax();ux();fx();px();mx()});var aU={};var uA=y(()=>{ym();Yu();eh();wg();Eg();Mg();Zg();ax();ux();fx();px();mx()});var dA,rn,xx=y(()=>{As();Bo();Mr();Rr();dA=class gx extends Ze{constructor(e){e={...gx.defaultOptions,...e},super(e),this.enabled=!0,this._state=Je.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1)}apply(e,t,i,s){e.applyFilter(this,t,i,s)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:t,gl:i,...s}=e,o,n;return t&&(o=xr.from(t)),i&&(n=gr.from(i)),new gx({gpuProgram:o,glProgram:n,...s})}};dA.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};rn=dA});async function fA(r){if(!r)for(let e=0;e{U();yx=[];V.handleByNamedList(S.Environment,yx)});function jh(){if(typeof al=="boolean")return al;try{al=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{al=!1}return al}var al,_x=y(()=>{"use strict"});var xt,sn=y(()=>{"use strict";xt=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(xt||{})});var on,bx=y(()=>{"use strict";on=class{constructor(e){this.items=[],this._name=e}emit(e,t,i,s,o,n,a,l){let{name:c,items:u}=this;for(let h=0,d=u.length;h{Tt();pA();Pr();_x();Xe();sn();bx();Mt();lU=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],mA=class gA extends Ce{constructor(e){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;let t=[...lU,...this.config.runners??[]];this._addRunners(...t),this._unsafeEvalCheck()}async init(e={}){let t=e.skipExtensionImports===!0?!0:e.manageImports===!1;await fA(t),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)e={...this._systemsHash[i].constructor.defaultOptions,...e};e={...gA.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let i=0;i{this.runners[t]=new on(t)})}_addSystems(e){let t;for(t in e){let i=e[t];this._addSystem(i.value,i.name)}}_addSystem(e,t){let i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(e,t){let i=t.reduce((s,o)=>(s[o.name]=o.value,s),{});e.forEach(s=>{let o=s.value,n=s.name,a=i[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!jh())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};mA.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};qi=mA});var cl,_A=y(()=>{U();ge();ws();ih();$i();Ga();La();tn();Xi();Mr();It();cl=class{init(){let e=new be({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),t=Wr({name:"graphics",bits:[ko,Oo(pr()),UE,$r]});this.shader=new Ze({gpuProgram:t,resources:{localUniforms:e}})}execute(e,t){let i=t.context,s=i.customShader||this.shader,o=e.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),c=o.encoder;c.setGeometry(a.geometry,s.gpuProgram);let u=o.globalUniforms.bindGroup;c.setBindGroup(0,u,s.gpuProgram);let h=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,h,s.gpuProgram);let d=l.instructions,f=null;for(let p=0;p{"use strict";bA={name:"texture-bit",vertex:{header:` struct TextureUniforms { uTextureMatrix:mat3x3, @@ -582,7 +582,7 @@ fn mainFragment( `,main:` outColor = textureSample(uTexture, uSampler, vUV); - `}},kw={name:"texture-bit",vertex:{header:` + `}},vA={name:"texture-bit",vertex:{header:` uniform mat3 uTextureMatrix; `,main:` uv = (uTextureMatrix * vec3(uv, 1.0)).xy; @@ -592,7 +592,7 @@ fn mainFragment( `,main:` outColor = texture(uTexture, vUV); - `}}});var Aa,Gw=x(()=>{B();gt();Bi();Io();Fi();rg();br();vt();Pt();Aa=class{init(){let t=kr({name:"mesh",bits:[gs,Fw,Ur]});this._shader=new qt({gpuProgram:t,resources:{uTexture:M.EMPTY._source,uSampler:M.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new k}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){N("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Aa.extension={type:[v.WebGPUPipesAdaptor],name:"mesh"}});var su,Pa,Uw=x(()=>{B();vr();uc();su=Qt.for2d(),Pa=class{start(t,e,i){let s=t.renderer,o=s.encoder,n=i.gpuProgram;this._shader=i,this._geometry=e,o.setGeometry(e,n),su.blendMode="normal",s.pipeline.getPipeline(e,n,su);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let i=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let l=e.textures;e.bindGroup=so(l.textures,l.count)}su.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,su,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Pa.extension={type:[v.WebGPUPipesAdaptor],name:"batch"}});var Ca,Ow=x(()=>{B();Ca=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}};Ca.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"customRender"}});function Ra(r,t){let e=r.instructionSet,i=e.instructions;for(let s=0;s{"use strict"});var m2,Ma,Lw=x(()=>{B();gt();Be();ha();ig();m2=new k,Ma=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(st.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let i=t._batchableRenderGroup??(t._batchableRenderGroup=st.get(Nr));i.renderable=t.root,i.transform=t.root.relativeGroupTransform,i.texture=t.texture,i.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(i,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=m2.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),Ra(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),Ra(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};Ma.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"renderGroup"}});function Ia(r,t){t||(t=0);for(let e=t;e{"use strict"});function og(r,t=!1){x2(r);let e=r.childrenToUpdate,i=r.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,l=n.index;for(let h=0;h1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Hw(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;let i=r.localTransform;r.updateLocalTransform();let s=r.parent;if(s&&!s.renderGroup?(e|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&Dw&&Nw(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&Dw&&Nw(r,g2,e)),!r.renderGroup){let o=r.children,n=o.length;for(let h=0;h1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&Gn&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&is&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}var g2,Dw,Vw=x(()=>{yr();sg();kf();g2=new at,Dw=is|qs|Gn});function Ww(r,t){let{list:e,index:i}=r.childrenRenderablesToUpdate,s=!1;for(let o=0;o{"use strict"});var y2,Ba,$w=x(()=>{B();gt();Si();Ne();sg();ig();Vw();zw();y2=new k,Ba=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=y2;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Ra(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let i=t.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(t.renderGroupChildren[i],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let i=t.root.getLocalBounds();i.ceil();let s=t.texture;t.texture&&$t.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=$t.getOptimalTexture(i.width,i.height,n,a),t._textureBounds||(t._textureBounds=new At),t._textureBounds.copyFrom(i),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&($t.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,i=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=i,t.structureDidChange?Ia(t.childrenRenderablesToUpdate.list,0):Ww(t,i),og(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s{B();Be();ha();Fa=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 i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,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];st.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=st.get(Nr);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)st.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};Fa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"sprite"}});var ko,ng=x(()=>{Ae();ko="8.9.2"});var ka,Ga,ag=x(()=>{B();ng();ka=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,ko)}static destroy(){}};ka.extension=v.Application;Ga=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,ko)}destroy(){this._renderer=null}};Ga.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"initHook",priority:-10}});var lg,hg,Yw=x(()=>{B();vr();Dp();lg=class jw{constructor(t,e){this.state=Qt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new ea)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=jw.getBatcher(t.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let i in e){let s=e[i],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let i in e){let s=e[i],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,i=e.geometry,s=e.shader;this._adaptor.start(this,i,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};lg.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"batch"};lg._availableBatchers=Object.create(null);hg=lg;L.handleByMap(v.Batcher,hg._availableBatchers);L.add(ea)});var qw,Kw=x(()=>{qw=`in vec2 vMaskCoord; + `}}});var ul,TA=y(()=>{U();ge();$i();tn();Xi();vx();Mr();ve();Ae();ul=class{init(){let e=Wr({name:"mesh",bits:[Fs,bA,$r]});this._shader=new Ze({gpuProgram:e,resources:{uTexture:k.EMPTY._source,uSampler:k.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new G}}}})}execute(e,t){let i=e.renderer,s=t._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(t.texture);else if(!s.gpuProgram){W("Mesh shader has no gpuProgram",t.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=e.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}i.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}};ul.extension={type:[S.WebGPUPipesAdaptor],name:"mesh"}});var Kh,hl,SA=y(()=>{U();Rr();ih();Kh=Je.for2d(),hl=class{start(e,t,i){let s=e.renderer,o=s.encoder,n=i.gpuProgram;this._shader=i,this._geometry=t,o.setGeometry(t,n),Kh.blendMode="normal",s.pipeline.getPipeline(t,n,Kh);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(e,t){let i=this._shader.gpuProgram,s=e.renderer,o=s.encoder;if(!t.bindGroup){let l=t.textures;t.bindGroup=Mo(l.textures,l.count)}Kh.blendMode=t.blendMode;let n=s.bindGroup.getBindGroup(t.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,Kh,t.topology);t.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(t.size,1,t.start)}};hl.extension={type:[S.WebGPUPipesAdaptor],name:"batch"}});var dl,wA=y(()=>{U();dl=class{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}};dl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"customRender"}});function fl(r,e){let t=r.instructionSet,i=t.instructions;for(let s=0;s{"use strict"});var cU,pl,EA=y(()=>{U();ge();Gt();ja();Tx();cU=new G,pl=class{constructor(e){this._renderer=e}addRenderGroup(e,t){e.isCachedAsTexture?this._addRenderableCacheAsTexture(e,t):this._addRenderableDirect(e,t)}execute(e){e.isRenderable&&(e.isCachedAsTexture?this._executeCacheAsTexture(e):this._executeDirect(e))}destroy(){this._renderer=null}_addRenderableDirect(e,t){this._renderer.renderPipes.batch.break(t),e._batchableRenderGroup&&(se.return(e._batchableRenderGroup),e._batchableRenderGroup=null),t.add(e)}_addRenderableCacheAsTexture(e,t){let i=e._batchableRenderGroup??(e._batchableRenderGroup=se.get(qr));i.renderable=e.root,i.transform=e.root.relativeGroupTransform,i.texture=e.texture,i.bounds=e._textureBounds,t.add(e),this._renderer.renderPipes.batch.addToBatch(i,t)}_executeCacheAsTexture(e){if(e.textureNeedsUpdate){e.textureNeedsUpdate=!1;let t=cU.identity().translate(-e._textureBounds.x,-e._textureBounds.y);this._renderer.renderTarget.push(e.texture,!0,null,e.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:t,worldColor:4294967295}),fl(e,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup),e._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(e){this._renderer.globalUniforms.push({worldTransformMatrix:e.inverseParentTextureTransform,worldColor:e.worldColorAlpha}),fl(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};pl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"renderGroup"}});function ml(r,e){e||(e=0);for(let t=e;t{"use strict"});function wx(r,e=!1){hU(r);let t=r.childrenToUpdate,i=r.updateTick++;for(let s in t){let o=Number(s),n=t[s],a=n.list,l=n.index;for(let c=0;c1?1:t,r.worldAlpha=t,r.worldColorAlpha=r.worldColor+((t*255|0)<<24)}function CA(r,e,t){if(e===r.updateTick)return;r.updateTick=e,r.didChange=!1;let i=r.localTransform;r.updateLocalTransform();let s=r.parent;if(s&&!s.renderGroup?(t|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),t&AA&&PA(r,s,t)):(t=r._updateFlags,r.relativeGroupTransform.copyFrom(i),t&AA&&PA(r,uU,t)),!r.renderGroup){let o=r.children,n=o.length;for(let c=0;c1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}t&_a&&(r.groupBlendMode=r.localBlendMode==="inherit"?e.groupBlendMode:r.localBlendMode),t&vs&&(r.globalDisplayStatus=r.localDisplayStatus&e.globalDisplayStatus),r._updateFlags=0}var uU,AA,MA=y(()=>{Pr();Sx();Qp();uU=new te,AA=vs|bo|_a});function RA(r,e){let{list:t,index:i}=r.childrenRenderablesToUpdate,s=!1;for(let o=0;o{"use strict"});var dU,gl,BA=y(()=>{U();ge();Oi();$t();Sx();Tx();MA();IA();dU=new G,gl=class{constructor(e){this._renderer=e}render({container:e,transform:t}){let i=e.parent,s=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;let o=this._renderer,n=dU;t&&(n=n.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));let a=o.renderPipes;this._updateCachedRenderGroups(e.renderGroup,null),this._updateRenderGroups(e.renderGroup),o.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),fl(e.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(n),e.parent=i,e.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(e,t){if(e.isCachedAsTexture){if(!e.updateCacheTexture)return;t=e}e._parentCacheAsTextureRenderGroup=t;for(let i=e.renderGroupChildren.length-1;i>=0;i--)this._updateCachedRenderGroups(e.renderGroupChildren[i],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){let i=e.root.getLocalBounds();i.ceil();let s=e.texture;e.texture&&je.returnTexture(e.texture);let o=this._renderer,n=e.textureOptions.resolution||o.view.resolution,a=e.textureOptions.antialias??o.view.antialias;e.texture=je.getOptimalTexture(i.width,i.height,n,a),e._textureBounds||(e._textureBounds=new Ee),e._textureBounds.copyFrom(i),s!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(je.returnTexture(e.texture),e.texture=null)}_updateRenderGroups(e){let t=this._renderer,i=t.renderPipes;if(e.runOnRender(t),e.instructionSet.renderPipes=i,e.structureDidChange?ml(e.childrenRenderablesToUpdate.list,0):RA(e,i),wx(e),e.structureDidChange?(e.structureDidChange=!1,this._buildInstructions(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!(e.isCachedAsTexture&&!e.textureNeedsUpdate))for(let s=0;s{U();Gt();ja();xl=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(e,t){let i=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i,t)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];se.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){t.bounds=e.visualBounds,t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=se.get(qr);return t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.bounds=e.visualBounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)se.return(this._gpuSpriteHash[e]);this._gpuSpriteHash=null,this._renderer=null}};xl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"sprite"}});var nn,Ex=y(()=>{Mt();nn="8.9.2"});var yl,_l,Ax=y(()=>{U();Ex();yl=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,nn)}static destroy(){}};yl.extension=S.Application;_l=class{constructor(e){this._renderer=e}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,nn)}destroy(){this._renderer=null}};_l.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"initHook",priority:-10}});var Px,Cx,OA=y(()=>{U();Rr();ig();Px=class FA{constructor(e,t){this.state=Je.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let t=this._batchersByInstructionSet[e.uid];t||(t=this._batchersByInstructionSet[e.uid]=Object.create(null),t.default||(t.default=new Da)),this._activeBatches=t,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(e,t){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(t);let i=this._activeBatches[e.batcherName];i||(i=this._activeBatches[e.batcherName]=FA.getBatcher(e.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);let t=this._activeBatches;for(let i in t){let s=t[i],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(e){let t=this._batchersByInstructionSet[e.uid];for(let i in t){let s=t[i],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(e){if(e.action==="startBatch"){let t=e.batcher,i=t.geometry,s=t.shader;this._adaptor.start(this,i,s)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}};Px.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"batch"};Px._availableBatchers=Object.create(null);Cx=Px;V.handleByMap(S.Batcher,Cx._availableBatchers);V.add(Da)});var UA,GA=y(()=>{UA=`in vec2 vMaskCoord; in vec2 vTextureCoord; uniform sampler2D uTexture; @@ -626,7 +626,7 @@ void main(void) finalColor = original * a; } -`});var Zw,Qw=x(()=>{Zw=`in vec2 aPosition; +`});var LA,DA=y(()=>{LA=`in vec2 aPosition; out vec2 vTextureCoord; out vec2 vMaskCoord; @@ -663,7 +663,7 @@ void main(void) vTextureCoord = filterTextureCoord(aPosition); vMaskCoord = getFilterCoord(aPosition); } -`});var cg,Jw=x(()=>{cg=`struct GlobalFilterUniforms { +`});var Mx,NA=y(()=>{Mx=`struct GlobalFilterUniforms { uInputSize:vec4, uInputPixel:vec4, uInputClamp:vec4, @@ -761,9 +761,9 @@ fn mainFragment( return source * a; } -`});var ou,tE=x(()=>{gt();ls();ao();Ge();zf();Ew();Kw();Qw();Jw();ou=class extends ww{constructor(t){let{sprite:e,...i}=t,s=new Ys(e.texture),o=new Ct({uFilterMatrix:{value:new k,type:"mat3x3"},uMaskClamp:{value:s.uClampFrame,type:"vec4"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=hr.from({vertex:{source:cg,entryPoint:"mainVertex"},fragment:{source:cg,entryPoint:"mainFragment"}}),a=lr.from({vertex:Zw,fragment:qw,name:"mask-filter"});super({...i,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}});var _2,ug,Ua,eE=x(()=>{B();Lh();tE();Ne();Bn();$n();Be();vt();Si();Lr();_2=new At,ug=class extends Jr{constructor(){super(),this.filters=[new ou({sprite:new kt(M.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},Ua=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){let s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(i,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=st.get(ug);if(s.inverse=t.inverse,i){t.mask.mask.measurable=!0;let o=zs(t.mask.mask,!0,_2);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=$t.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let l=s.sprite;l.texture=a,l.worldTransform.tx=o.minX,l.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(e.type===re.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();i&&$t.returnTexture(s.filterTexture),st.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};Ua.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"alphaMask"}});var Oa,rE=x(()=>{B();Oa=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};Oa.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"colorMask"}});var La,iE=x(()=>{B();Bo();as();La=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let l=this._maskHash.get(o);l.instructionsStart=i.instructionSize,a.collectRenderables(i,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let h=i.instructionSize-l.instructionsStart-1;l.instructionsLength=h;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,i){let s=t,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a{be();B();dg=class sE{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new nt(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...sE.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};dg.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"background",priority:0};dg.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};oE=dg});var Da,Na,aE=x(()=>{B();Lh();Pt();Da={};L.handle(v.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Da[r.name]=r.ref},r=>{delete Da[r.name]});Na=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Da[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!Da[e]){N(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[e];i||(i=this._filterHash[e]=new Jr,i.filters=[new Da[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};Na.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"blendMode"}});var fg,pg,hE,cE=x(()=>{B();yr();vt();fg={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},pg=class lE{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof at||t instanceof M?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,lE.defaultImageOptions);let{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>o(l.result),l.onerror=n,l.readAsDataURL(a)},fg[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(fg[e],i);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:fg[e],quality:i});return new Promise((n,a)=>{let l=new FileReader;l.onload=()=>n(l.result),l.onerror=a,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer;if(e instanceof M)return i.texture.generateCanvas(e);let s=i.textureGenerator.generateTexture(t),o=i.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,i=this._renderer,s=e instanceof M?e:i.textureGenerator.generateTexture(t),o=i.texture.getPixels(s);return e instanceof at&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof M?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),i=document.createElement("a");i.download=t.filename??"image.png",i.href=e.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let i=this.canvas(t),s=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};pg.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"extract"};pg.defaultImageOptions={format:"png",quality:1};hE=pg});var hi,mg=x(()=>{He();vt();hi=class r extends M{static create(t){return new r({source:new wt(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}});var b2,v2,T2,Ha,uE=x(()=>{be();B();gt();ae();Ne();Wh();yr();mg();b2=new ot,v2=new At,T2=[0,0,0,0],Ha=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof at&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:nt.shared.setValue(o).toArray():o=T2;let n=t.frame?.copyTo(b2)||Xs(s,v2).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=hi.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:i}),l=k.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:l,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};Ha.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGenerator"}});var Va,dE=x(()=>{B();gt();or();yo();Ri();Lr();Ge();Va=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t"},uWorldTransformMatrix:{value:new k,type:"mat3x3"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4"},uResolution:{value:[0,0],type:"vec2"}},{isStatic:!0})}destroy(){this._renderer=null}};Va.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"globalUniforms"}});var S2,Wa,fE=x(()=>{B();Qs();S2=1,Wa=class{constructor(){this._tasks=[],this._offset=0}init(){le.system.add(this._update,this)}repeat(t,e,i=!0){let s=S2++,o=0;return i&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e=i.duration){let s=t-i.start;i.func(s),i.last=t}}}destroy(){le.system.remove(this._update,this),this._tasks.length=0}};Wa.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"scheduler",priority:0}});function mE(r){if(!pE){if(Y.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${ko} (${r}) http://www.pixijs.com/ +`});var Zh,HA=y(()=>{ge();As();Bo();It();lm();xx();GA();DA();NA();Zh=class extends rn{constructor(e){let{sprite:t,...i}=e,s=new _o(t.texture),o=new be({uFilterMatrix:{value:new G,type:"mat3x3"},uMaskClamp:{value:s.uClampFrame,type:"vec4"},uAlpha:{value:1,type:"f32"},uInverse:{value:e.inverse?1:0,type:"f32"}}),n=xr.from({vertex:{source:Mx,entryPoint:"mainVertex"},fragment:{source:Mx,entryPoint:"mainFragment"}}),a=gr.from({vertex:LA,fragment:UA,name:"mask-filter"});super({...i,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=s}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=e?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(e,t,i,s){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,i,s)}}});var fU,Rx,bl,VA=y(()=>{U();Ru();HA();$t();ga();Ma();Gt();ve();Oi();jr();fU=new Ee,Rx=class extends hi{constructor(){super(),this.filters=[new Zh({sprite:new Te(k.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}},bl=class{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,i){let s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.renderMaskToTexture){let o=e.mask;o.includeInBuild=!0,o.collectRenderables(i,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){let t=this._renderer,i=e.mask.renderMaskToTexture;if(e.action==="pushMaskBegin"){let s=se.get(Rx);if(s.inverse=e.inverse,i){e.mask.mask.measurable=!0;let o=mo(e.mask.mask,!0,fU);e.mask.mask.measurable=!1,o.ceil();let n=t.renderTarget.renderTarget.colorTexture.source,a=je.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);t.renderTarget.push(a,!0),t.globalUniforms.push({offset:o,worldColor:4294967295});let l=s.sprite;l.texture=a,l.worldTransform.tx=o.minX,l.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:e.maskedContainer,filterTexture:a})}else s.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:e.maskedContainer})}else if(e.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(t.type===ot.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(e.action==="popMaskEnd"){t.filter.pop();let s=this._activeMaskStage.pop();i&&je.returnTexture(s.filterTexture),se.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};bl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"alphaMask"}});var vl,WA=y(()=>{U();vl=class{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&e.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(e,t,i){this._renderer.renderPipes.batch.break(i);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._colorStack=null}};vl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"colorMask"}});var Tl,zA=y(()=>{U();sn();Es();Tl=class{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,i){var s;let o=e,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let l=this._maskHash.get(o);l.instructionsStart=i.instructionSize,a.collectRenderables(i,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});let c=i.instructionSize-l.instructionsStart-1;l.instructionsLength=c;let u=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[u]??(s[u]=0)}pop(e,t,i){let s=e,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(e);for(let a=0;a{Tt();U();Ix=class $A{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new oe(0),this.color=this._backgroundColor,this.alpha=1}init(e){e={...$A.defaultOptions,...e},this.clearBeforeRender=e.clearBeforeRender,this.color=e.background||e.backgroundColor||this._backgroundColor,this.alpha=e.backgroundAlpha,this._backgroundColor.setAlpha(e.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Ix.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"background",priority:0};Ix.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};XA=Ix});var Sl,wl,YA=y(()=>{U();Ru();Ae();Sl={};V.handle(S.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Sl[r.name]=r.ref},r=>{delete Sl[r.name]});wl=class{constructor(e){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(e,t,i){if(this._activeBlendMode===t){this._isAdvanced&&this._renderableList.push(e);return}this._activeBlendMode=t,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Sl[t],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(e))}_beginAdvancedBlendMode(e){this._renderer.renderPipes.batch.break(e);let t=this._activeBlendMode;if(!Sl[t]){W(`Unable to assign BlendMode: '${t}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let i=this._filterHash[t];i||(i=this._filterHash[t]=new hi,i.filters=[new Sl[t]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,e.add(s)}_endAdvancedBlendMode(e){this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(let e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}};wl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"blendMode"}});var Bx,kx,KA,ZA=y(()=>{U();Pr();ve();Bx={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},kx=class qA{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof te||e instanceof k?{target:e,...t}:{...t,...e}}async image(e){let t=new Image;return t.src=await this.base64(e),t}async base64(e){e=this._normalizeOptions(e,qA.defaultImageOptions);let{format:t,quality:i}=e,s=this.canvas(e);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>o(l.result),l.onerror=n,l.readAsDataURL(a)},Bx[t],i)});if(s.toDataURL!==void 0)return s.toDataURL(Bx[t],i);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Bx[t],quality:i});return new Promise((n,a)=>{let l=new FileReader;l.onload=()=>n(l.result),l.onerror=a,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){e=this._normalizeOptions(e);let t=e.target,i=this._renderer;if(t instanceof k)return i.texture.generateCanvas(t);let s=i.textureGenerator.generateTexture(e),o=i.texture.generateCanvas(s);return s.destroy(!0),o}pixels(e){e=this._normalizeOptions(e);let t=e.target,i=this._renderer,s=t instanceof k?t:i.textureGenerator.generateTexture(e),o=i.texture.getPixels(s);return t instanceof te&&s.destroy(!0),o}texture(e){return e=this._normalizeOptions(e),e.target instanceof k?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);let t=this.canvas(e),i=document.createElement("a");i.download=e.filename??"image.png",i.href=t.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(e){let t=e.width??200;e=this._normalizeOptions(e);let i=this.canvas(e),s=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let o=["font-size: 1px;",`padding: ${t}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};kx.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"extract"};kx.defaultImageOptions={format:"png",quality:1};KA=kx});var Ki,Fx=y(()=>{Xt();ve();Ki=class r extends k{static create(e){return new r({source:new we(e)})}resize(e,t,i){return this.source.resize(e,t,i),this}}});var pU,mU,gU,El,QA=y(()=>{Tt();U();ge();ut();$t();Ou();Pr();Fx();pU=new Q,mU=new Ee,gU=[0,0,0,0],El=class{constructor(e){this._renderer=e}generateTexture(e){e instanceof te&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});let t=e.resolution||this._renderer.resolution,i=e.antialias||this._renderer.view.antialias,s=e.target,o=e.clearColor;o?o=Array.isArray(o)&&o.length===4?o:oe.shared.setValue(o).toArray():o=gU;let n=e.frame?.copyTo(pU)||xo(s,mU).rectangle;n.width=Math.max(n.width,1/t)|0,n.height=Math.max(n.height,1/t)|0;let a=Ki.create({...e.textureSourceOptions,width:n.width,height:n.height,resolution:t,antialias:i}),l=G.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:l,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};El.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"textureGenerator"}});var Al,JA=y(()=>{U();ge();fr();Vo();Vi();jr();It();Al=class{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e"},uWorldTransformMatrix:{value:new G,type:"mat3x3"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4"},uResolution:{value:[0,0],type:"vec2"}},{isStatic:!0})}destroy(){this._renderer=null}};Al.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"globalUniforms"}});var xU,Pl,e1=y(()=>{U();So();xU=1,Pl=class{constructor(){this._tasks=[],this._offset=0}init(){ht.system.add(this._update,this)}repeat(e,t,i=!0){let s=xU++,o=0;return i&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(e){for(let t=0;t=i.duration){let s=e-i.start;i.func(s),i.last=e}}}destroy(){ht.system.remove(this._update,this),this._tasks.length=0}};Pl.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"scheduler",priority:0}});function r1(r){if(!t1){if(j.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let e=[`%c %c %c %c %c PixiJS %c v${nn} (${r}) http://www.pixijs.com/ -`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${ko} - ${r} - http://www.pixijs.com/`);pE=!0}}var pE,gE=x(()=>{Ft();ng();pE=!1});var Go,xE=x(()=>{B();gE();Lr();Go=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===re.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),mE(e)}}};Go.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"hello",priority:-2};Go.defaultOptions={hello:!1}});function yE(r){let t=!1;for(let i in r)if(r[i]==null){t=!0;break}if(!t)return r;let e=Object.create(null);for(let i in r){let s=r[i];s&&(e[i]=s)}return e}function _E(r){let t=0;for(let e=0;e{"use strict"});var w2,gg,TE,SE=x(()=>{B();bE();w2=0,gg=class vE{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...vE.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedHashes)e.context[e.hash]=yE(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)_E(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=w2++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,i=this._renderer.renderPipes,s=0;for(let o=0;othis.maxUnusedTime){if(!n.destroyed){let h=i;a&&(a.structureDidChange=!0),h[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let i of t.renderGroupChildren)this._updateInstructionGCTick(i,e)}};gg.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"renderableGC",priority:0};gg.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};TE=gg});var xg,EE,AE=x(()=>{B();xg=class wE{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...wE.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};xg.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGC"};xg.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};EE=xg});var PE,za,yg=x(()=>{Te();He();vt();PE=class CE{constructor(t={}){if(this.uid=ut("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...CE.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;ei.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof M||t.depthStencilTexture instanceof wt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new wt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};PE.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};za=PE});function xs(r,t){if(!$a.has(r)){let e=new M({source:new Pe({resource:r,...t})}),i=()=>{$a.get(r)===e&&$a.delete(r)};e.once("destroy",i),e.source.once("destroy",i),$a.set(r,e)}return $a.get(r)}var $a,nu=x(()=>{to();vt();$a=new Map});var _g,ME,IE=x(()=>{Ft();B();ae();zt();yg();nu();_g=class RE{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...RE.defaultOptions,...t},t.view&&(j(it,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new ot(0,0,t.width,t.height),this.canvas=t.canvas||Y.get().createCanvas(),this.antialias=!!t.antialias,this.texture=xs(this.canvas,t),this.renderTarget=new za({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};_g.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"view",priority:0};_g.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};ME=_g});var au,lu,bg=x(()=>{Ow();Lw();$w();Xw();ag();Yw();eE();rE();iE();nE();aE();cE();uE();dE();fE();xE();SE();AE();IE();au=[oE,Va,Go,ME,Ba,EE,Ha,hE,Ga,TE,Wa],lu=[Na,hg,Fa,Ma,Ua,La,Oa,Ca]});var Xa,BE=x(()=>{B();Xa=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){let s=this._gpu.device,o=e.layout[i],n=[],a=this._renderer;for(let c in o){let u=t.resources[c]??t.resources[o[c]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let m=f.buffer;d={buffer:a.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;d=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[c],resource:d})}let l=a.shader.getProgramData(e).bindGroups[i],h=s.createBindGroup({layout:l,entries:n});return this._hash[t._key]=h,h}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};Xa.extension={type:[v.WebGPUSystem],name:"bindGroup"}});var ja,FE=x(()=>{B();Tp();ja=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(qn(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};ja.extension={type:[v.WebGPUSystem],name:"buffer"}});var Ya,kE=x(()=>{B();Ya=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};Ya.extension={type:[v.WebGPUSystem],name:"colorMask"}});var Uo,GE=x(()=>{Ft();B();Uo=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await Y.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};Uo.extension={type:[v.WebGPUSystem],name:"device"};Uo.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var qa,UE=x(()=>{B();qa=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){let o=this._renderer.pipeline.getPipeline(t,e,i,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let i in t.groups){let s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){let{geometry:e,shader:i,state:s,topology:o,size:n,start:a,instanceCount:l,skipSync:h}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,o),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,h),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,l??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),l??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,i={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in i)this._setVertexBuffer(a,i[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};qa.extension={type:[v.WebGPUSystem],name:"encoder",priority:1}});var Ka,OE=x(()=>{B();as();Ka=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Ot.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Ka.extension={type:[v.WebGPUSystem],name:"stencil"}});var Oo,vg=x(()=>{tg();Mi();oi();Oo=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!eu())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new Yt({data:new Float32Array(e.layout.size/4),usage:ht.UNIFORM|ht.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,i=this._syncFunctionHash[e];if(!i){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);i=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new Yt({data:new Float32Array(s.layout.size/4),usage:ht.UNIFORM|ht.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),i||(i=0),s.syncFunction(t.uniforms,e,o,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function LE(r){let t=r.map(i=>({data:i,offset:0,size:0})),e=0;for(let i=0;i1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var Za,Tg=x(()=>{"use strict";Za={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}}});var ci,Sg=x(()=>{"use strict";ci=[{type:"mat3x3",test:r=>r.value.a!==void 0,ubo:` +`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${nn} - ${r} - http://www.pixijs.com/`);t1=!0}}var t1,i1=y(()=>{Re();Ex();t1=!1});var an,s1=y(()=>{U();i1();jr();an=class{constructor(e){this._renderer=e}init(e){if(e.hello){let t=this._renderer.name;this._renderer.type===ot.WEBGL&&(t+=` ${this._renderer.context.webGLVersion}`),r1(t)}}};an.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"hello",priority:-2};an.defaultOptions={hello:!1}});function o1(r){let e=!1;for(let i in r)if(r[i]==null){e=!0;break}if(!e)return r;let t=Object.create(null);for(let i in r){let s=r[i];s&&(t[i]=s)}return t}function n1(r){let e=0;for(let t=0;t{"use strict"});var yU,Ox,c1,u1=y(()=>{U();a1();yU=0,Ox=class l1{constructor(e){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=e}init(e){e={...l1.defaultOptions,...e},this.maxUnusedTime=e.renderableGCMaxUnusedTime,this._frequency=e.renderableGCFrequency,this.enabled=e.renderableGCActive}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let t of this._managedHashes)t.context[t.hash]=o1(t.context[t.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let t of this._managedArrays)n1(t.context[t.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(e,t){this._managedHashes.push({context:e,hash:t})}addManagedArray(e,t){this._managedArrays.push({context:e,hash:t})}prerender({container:e}){this._now=performance.now(),e.renderGroup.gcTick=yU++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}addRenderable(e){this.enabled&&(e._lastUsed===-1&&(this._managedRenderables.push(e),e.once("destroyed",this._removeRenderable,this)),e._lastUsed=this._now)}run(){let e=this._now,t=this._managedRenderables,i=this._renderer.renderPipes,s=0;for(let o=0;othis.maxUnusedTime){if(!n.destroyed){let c=i;a&&(a.structureDidChange=!0),c[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else t[o-s]=n}t.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(e){let t=this._managedRenderables.indexOf(e);t>=0&&(e.off("destroyed",this._removeRenderable,this),this._managedRenderables[t]=null)}_updateInstructionGCTick(e,t){e.instructionSet.gcTick=t;for(let i of e.renderGroupChildren)this._updateInstructionGCTick(i,t)}};Ox.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"renderableGC",priority:0};Ox.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};c1=Ox});var Ux,d1,f1=y(()=>{U();Ux=class h1{constructor(e){this._renderer=e,this.count=0,this.checkCount=0}init(e){e={...h1.defaultOptions,...e},this.checkCountMax=e.textureGCCheckCountMax,this.maxIdle=e.textureGCAMaxIdle??e.textureGCMaxIdle,this.active=e.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this._renderer.texture.managedTextures;for(let t=0;t-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};Ux.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"textureGC"};Ux.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};d1=Ux});var p1,Cl,Gx=y(()=>{wt();Xt();ve();p1=class m1{constructor(e={}){if(this.uid=he("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,e={...m1.defaultOptions,...e},this.stencil=e.stencil,this.depth=e.depth,this.isRoot=e.isRoot,typeof e.colorTextures=="number"){this._managedColorTextures=!0;for(let t=0;ti.source)];let t=this.colorTexture.source;this.resize(t.width,t.height,t._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(e.depthStencilTexture||this.stencil)&&(e.depthStencilTexture instanceof k||e.depthStencilTexture instanceof we?this.depthStencilTexture=e.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new we({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,t,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(e,t,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,t,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(e=>{e.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};p1.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Cl=p1});function Os(r,e){if(!Ml.has(r)){let t=new k({source:new Rt({resource:r,...e})}),i=()=>{Ml.get(r)===t&&Ml.delete(r)};t.once("destroy",i),t.source.once("destroy",i),Ml.set(r,t)}return Ml.get(r)}var Ml,Qh=y(()=>{Eo();ve();Ml=new Map});var Lx,x1,y1=y(()=>{Re();U();ut();Xe();Gx();Qh();Lx=class g1{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(e){e={...g1.defaultOptions,...e},e.view&&(X(ie,"ViewSystem.view has been renamed to ViewSystem.canvas"),e.canvas=e.view),this.screen=new Q(0,0,e.width,e.height),this.canvas=e.canvas||j.get().createCanvas(),this.antialias=!!e.antialias,this.texture=Os(this.canvas,e),this.renderTarget=new Cl({colorTextures:[this.texture],depth:!!e.depth,isRoot:!0}),this.texture.source.transparent=e.backgroundAlpha<1,this.resolution=e.resolution}resize(e,t,i){this.texture.source.resize(e,t,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){(typeof e=="boolean"?e:!!e?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Lx.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"view",priority:0};Lx.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};x1=Lx});var Jh,ed,Dx=y(()=>{wA();EA();BA();kA();Ax();OA();VA();WA();zA();jA();YA();ZA();QA();JA();e1();s1();u1();f1();y1();Jh=[XA,Al,an,x1,gl,d1,El,KA,_l,c1,Pl],ed=[wl,Cx,xl,pl,bl,Tl,vl,dl]});var Rl,_1=y(()=>{U();Rl=class{constructor(e){this._hash=Object.create(null),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(e){this._gpu=e}getBindGroup(e,t,i){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,i)}_createBindGroup(e,t,i){let s=this._gpu.device,o=t.layout[i],n=[],a=this._renderer;for(let u in o){let h=e.resources[u]??e.resources[o[u]],d;if(h._resourceType==="uniformGroup"){let f=h;a.ubo.updateUniformGroup(f);let p=f.buffer;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.descriptor.size}}else if(h._resourceType==="buffer"){let f=h;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(h._resourceType==="bufferResource"){let f=h;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(h._resourceType==="textureSampler"){let f=h;d=a.texture.getGpuSampler(f)}else if(h._resourceType==="textureSource"){let f=h;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[u],resource:d})}let l=a.shader.getProgramData(t).bindGroups[i],c=s.createBindGroup({layout:l,entries:n});return this._hash[e._key]=c,c}destroy(){for(let e of Object.keys(this._hash))this._hash[e]=null;this._hash=null,this._renderer=null}};Rl.extension={type:[S.WebGPUSystem],name:"bindGroup"}});var Il,b1=y(()=>{U();Nm();Il=class{constructor(e){this._gpuBuffers=Object.create(null),this._managedBuffers=[],e.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(e){this._gpu=e}getGPUBuffer(e){return this._gpuBuffers[e.uid]||this.createGPUBuffer(e)}updateBuffer(e){let t=this._gpuBuffers[e.uid]||this.createGPUBuffer(e),i=e.data;return e._updateID&&i&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,i.buffer,0,(e._updateSize||i.byteLength)+3&-4)),t}destroyAll(){for(let e in this._gpuBuffers)this._gpuBuffers[e].destroy();this._gpuBuffers={}}createGPUBuffer(e){this._gpuBuffers[e.uid]||(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this),e.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(e));let t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&(ka(e.data.buffer,t.getMappedRange()),t.unmap()),this._gpuBuffers[e.uid]=t,t}onBufferChange(e){this._gpuBuffers[e.uid].destroy(),e._updateID=0,this._gpuBuffers[e.uid]=this.createGPUBuffer(e)}onBufferDestroy(e){this._managedBuffers.splice(this._managedBuffers.indexOf(e),1),this._destroyBuffer(e)}destroy(){this._managedBuffers.forEach(e=>this._destroyBuffer(e)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(e){this._gpuBuffers[e.uid].destroy(),e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this),e.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[e.uid]=null}};Il.extension={type:[S.WebGPUSystem],name:"buffer"}});var Bl,v1=y(()=>{U();Bl=class{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}};Bl.extension={type:[S.WebGPUSystem],name:"colorMask"}});var ln,T1=y(()=>{Re();U();ln=class{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(e).then(t=>{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){let t=await j.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>t.features.has(o)),s=await t.requestDevice({requiredFeatures:i});return{adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null}};ln.extension={type:[S.WebGPUSystem],name:"device"};ln.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var kl,S1=y(()=>{U();kl=class{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,i,s){let o=this._renderer.pipeline.getPipeline(e,t,i,s);this.setPipeline(o)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;let t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,i){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(t,i,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){let i=this._renderer.pipeline.getBufferNamesToBind(e,t);for(let s in i)this._setVertexBuffer(s,e.attributes[i[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(let i in e.groups){let s=e.groups[i];t||this._syncBindGroup(s),this.setBindGroup(i,s,e.gpuProgram)}}_syncBindGroup(e){for(let t in e.resources){let i=e.resources[t];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(e){let{geometry:t,shader:i,state:s,topology:o,size:n,start:a,instanceCount:l,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,i.gpuProgram,s,o),this.setGeometry(t,i.gpuProgram),this._setShaderBindGroups(i,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,l??t.instanceCount,a||0):this.renderPassEncoder.draw(n||t.getSize(),l??t.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);let t=this._boundPipeline,i={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(let a in i)this._setVertexBuffer(a,i[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}};kl.extension={type:[S.WebGPUSystem],name:"encoder",priority:1}});var Fl,w1=y(()=>{U();Es();Fl=class{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Fe.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){let i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=e,i.stencilReference=t;let s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Fl.extension={type:[S.WebGPUSystem],name:"stencil"}});var cn,Nx=y(()=>{_x();Wi();gi();cn=class{constructor(e){this._syncFunctionHash=Object.create(null),this._adaptor=e,this._systemCheck()}_systemCheck(){if(!jh())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(e){let t=this.getUniformGroupData(e);e.buffer||(e.buffer=new Ke({data:new Float32Array(t.layout.size/4),usage:le.UNIFORM|le.COPY_DST}))}getUniformGroupData(e){return this._syncFunctionHash[e._signature]||this._initUniformGroup(e)}_initUniformGroup(e){let t=e._signature,i=this._syncFunctionHash[t];if(!i){let s=Object.keys(e.uniformStructures).map(a=>e.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);i=this._syncFunctionHash[t]={layout:o,syncFunction:n}}return this._syncFunctionHash[t]}_generateUboSync(e){return this._adaptor.generateUboSync(e)}syncUniformGroup(e,t,i){let s=this.getUniformGroupData(e);e.buffer||(e.buffer=new Ke({data:new Float32Array(s.layout.size/4),usage:le.UNIFORM|le.COPY_DST}));let o=null;return t||(t=e.buffer.data,o=e.buffer.dataInt32),i||(i=0),s.syncFunction(e.uniforms,t,o,i),!0}updateUniformGroup(e){if(e.isStatic&&!e._dirtyId)return!1;e._dirtyId=0;let t=this.syncUniformGroup(e);return e.buffer.update(),t}destroy(){this._syncFunctionHash=null}}});function E1(r){let e=r.map(i=>({data:i,offset:0,size:0})),t=0;for(let i=0;i1&&(o=Math.max(o,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=o,s.offset=t,t+=o}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}var Ol,Hx=y(()=>{"use strict";Ol={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}}});var bi,Vx=y(()=>{"use strict";bi=[{type:"mat3x3",test:r=>r.value.a!==void 0,ubo:` var matrix = uv[name].toArray(true); data[offset] = matrix[0]; data[offset + 1] = matrix[1]; @@ -834,23 +834,23 @@ fn mainFragment( cv[2] = v.blue; gl.uniform3f(ud[name].location, v.red, v.green, v.blue); } - `}]});function hu(r,t,e,i){let s=[` + `}]});function td(r,e,t,i){let s=[` var v = null; var v2 = null; var t = 0; var index = 0; var name = null; var arrayOffset = null; - `],o=0;for(let a=0;a1)u=l.offset/4,s.push(e(l,u-o));else{let d=i[l.data.type];u=l.offset/4,s.push(` - v = uv.${h}; - offset += ${u-o}; + `],o=0;for(let a=0;a1)h=l.offset/4,s.push(t(l,h-o));else{let d=i[l.data.type];h=l.offset/4,s.push(` + v = uv.${c}; + offset += ${h-o}; ${d}; - `)}o=u}let n=s.join(` -`);return new Function("uv","data","dataInt32","offset",n)}var wg=x(()=>{Sg()});function Lo(r,t){return` - for (let i = 0; i < ${r*t}; i++) { + `)}o=h}let n=s.join(` +`);return new Function("uv","data","dataInt32","offset",n)}var Wx=y(()=>{Vx()});function un(r,e){return` + for (let i = 0; i < ${r*e}; i++) { data[offset + (((i / ${r})|0) * 4) + (i % ${r})] = v[i]; } - `}var Eg,DE,Ag=x(()=>{"use strict";Eg={f32:` + `}var zx,A1,$x=y(()=>{"use strict";zx={f32:` data[offset] = v;`,i32:` dataInt32[offset] = v;`,"vec2":` data[offset] = v[0]; @@ -886,28 +886,28 @@ fn mainFragment( data[offset + 10] = v[8];`,"mat4x4":` for (let i = 0; i < 16; i++) { data[offset + i] = v[i]; - }`,"mat3x2":Lo(3,2),"mat4x2":Lo(4,2),"mat2x3":Lo(2,3),"mat4x3":Lo(4,3),"mat2x4":Lo(2,4),"mat3x4":Lo(3,4)},DE={...Eg,"mat2x2":` + }`,"mat3x2":un(3,2),"mat4x2":un(4,2),"mat2x3":un(2,3),"mat4x3":un(4,3),"mat2x4":un(2,4),"mat3x4":un(3,4)},A1={...zx,"mat2x2":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 2] = v[2]; data[offset + 3] = v[3]; - `}});function NE(r,t){let{size:e,align:i}=Za[r.data.type],s=(i-e)/4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return` + `}});function P1(r,e){let{size:t,align:i}=Ol[r.data.type],s=(i-t)/4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return` v = uv.${r.data.name}; - ${t!==0?`offset += ${t};`:""} + ${e!==0?`offset += ${e};`:""} arrayOffset = offset; t = 0; - for(var i=0; i < ${r.data.size*(e/4)}; i++) + for(var i=0; i < ${r.data.size*(t/4)}; i++) { - for(var j = 0; j < ${e/4}; j++) + for(var j = 0; j < ${t/4}; j++) { ${o}[arrayOffset++] = v[t++]; } ${s!==0?`arrayOffset += ${s};`:""} } - `}var HE=x(()=>{Tg()});function VE(r){return hu(r,"uboWgsl",NE,DE)}var WE=x(()=>{wg();Ag();HE()});var Qa,zE=x(()=>{B();vg();Tg();WE();Qa=class extends Oo{constructor(){super({createUboElements:LE,generateUboSync:VE})}};Qa.extension={type:[v.WebGPUSystem],name:"ubo"}});var Oi,cu=x(()=>{Ae();Te();Oi=class extends It{constructor({buffer:t,offset:e,size:i}){super(),this.uid=ut("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=ut("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=ut("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var uu,$E=x(()=>{"use strict";uu=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let i=0;i{B();Mi();cu();oi();$E();Ri();Li=128,Ja=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new uu({minUniformOffsetAlignment:Li});let e=256/Li;for(let i=0;i{Pt();hs()});var Vr,Cg=x(()=>{as();Vr=[];Vr[Ot.NONE]=void 0;Vr[Ot.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Vr[Ot.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Vr[Ot.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Vr[Ot.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Vr[Ot.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function P2(r,t,e,i,s){return r<<24|t<<16|e<<10|i<<5|s}function C2(r,t,e,i){return e<<6|r<<3|i<<1|t}var A2,tl,jE=x(()=>{B();Pt();Pg();as();Qn();Cg();A2={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};tl=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(Ot.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Vr[t],this._updatePipeHash())}setPipeline(t,e,i,s){let o=this.getPipeline(t,e,i);s.setPipeline(o)}getPipeline(t,e,i,s){t._layoutKey||(du(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=P2(t._layoutKey,e._layoutKey,i.data,i._blendModeId,A2[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,i,s),this._pipeCache[o])}_createPipeline(t,e,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Ot.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(e).pipeline,h={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(h.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"}),o.createRenderPipeline(h)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],i=0,s=Object.keys(t.attributes).sort();for(let n=0;n{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let l in e.attributeData){let h=t.attributes[l];(h.divisor??1)!==1&&N(`Attribute ${l} has an invalid divisor value of '${h.divisor}'. WebGPU only supports a divisor value of 1`),h.buffer===o&&(n.arrayStride=h.stride,n.stepMode=h.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[l].location,offset:h.offset,format:h.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){let t=C2(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};tl.extension={type:[v.WebGPUSystem],name:"pipeline"}});function YE(r,t,e,i,s,o){let n=o?1:-1;return r.identity(),r.a=1/i*2,r.d=n*(1/s*2),r.tx=-1-t*r.a,r.ty=-n-e*r.d,r}var qE=x(()=>{"use strict"});function KE(r){let t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var ZE=x(()=>{"use strict"});var Do,Rg=x(()=>{gt();ae();Bo();qE();eg();to();He();vt();nu();ZE();yg();Do=class{constructor(t){this.rootViewPort=new ot,this.viewport=new ot,this.onRenderTargetChange=new Fo("onRenderTargetChange"),this.projectionMatrix=new k,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=KE(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,i,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let l=o.colorTexture,h=this.viewport,c=l.pixelWidth,u=l.pixelHeight;if(!s&&t instanceof M&&(s=t.frame),s){let d=l._resolution;h.x=s.x*d+.5|0,h.y=s.y*d+.5|0,h.width=s.width*d+.5|0,h.height=s.height*d+.5|0}else h.x=0,h.y=0,h.width=c,h.height=u;return YE(this.projectionMatrix,0,0,h.width/l.resolution,h.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,i,h),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=ye.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=ye.ALL,i,s){let o=this.bind(t,e,i,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,i,s,o){i.x<0&&(s.width+=i.x,o.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,o.y-=i.y,i.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(t,e,i,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return Pe.test(t)&&(t=xs(t).source),t instanceof za?e=t:t instanceof wt&&(e=new za({colorTextures:[t]}),Pe.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var fu,QE=x(()=>{"use strict";fu=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var pu,JE=x(()=>{Bo();to();He();QE();pu=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),l=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:o},s),e}startRenderPass(t,e=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,i);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i){typeof e=="boolean"&&(e=e?ye.ALL:ye.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((h,c)=>{let u=o.contexts[c],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(h).createView({mipLevelCount:1}),o.msaaTextures[c]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[c]));let m=e&ye.COLOR?"clear":"load";return i??(i=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:i,storeOp:"store",loadOp:m}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let h=e&ye.STENCIL?"clear":"load",c=e&ye.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:h,depthClearValue:1,depthLoadOp:c,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,i,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let h=a.createCommandEncoder(),c=this.getDescriptor(t,e,i),u=h.beginRenderPass(c);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=h.finish();a.queue.submit([d])}else this.startRenderPass(t,e,i,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new fu;return t.colorTextures.forEach((i,s)=>{if(Pe.test(i.resource)){let o=i.resource.getContext("webgpu"),n=i.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=i.source.antialias,i.source.antialias){let o=new wt({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,s)=>{e.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var el,tA=x(()=>{B();Rg();JE();el=class extends Do{constructor(t){super(t),this.adaptor=new pu,this.adaptor.init(t,this)}};el.extension={type:[v.WebGPUSystem],name:"renderTarget"}});var rl,eA=x(()=>{B();rl=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,i=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};rl.extension={type:[v.WebGPUSystem],name:"shader"}});var Oe,rA=x(()=>{"use strict";Oe={};Oe.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Oe.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Oe.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Oe.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Oe.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Oe.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Oe["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Oe["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Oe["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Oe.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Oe.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Oe.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var il,iA=x(()=>{B();vr();rA();il=class{constructor(){this.defaultState=new Qt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Oe[t.blendMode]||Oe.normal}]}destroy(){this.gpu=null}};il.extension={type:[v.WebGPUSystem],name:"state"}});var sA,oA=x(()=>{"use strict";sA={type:"image",upload(r,t,e){let i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),o=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*o},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}}});var Mg,R2,nA,aA=x(()=>{"use strict";Mg={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},R2={blockBytes:4,blockWidth:1,blockHeight:1},nA={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight,o=Mg[r.format]||R2;for(let n=0;n>1,1),s=Math.max(s>>1,1)}}}});var mu,Ig=x(()=>{"use strict";mu={type:"image",upload(r,t,e){let i=r.resource;if(!i)return;let s=Math.min(t.width,r.resourceWidth||r.pixelWidth),o=Math.min(t.height,r.resourceHeight||r.pixelHeight),n=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var lA,hA=x(()=>{Ig();lA={type:"video",upload(r,t,e){mu.upload(r,t,e)}}});var gu,cA=x(()=>{"use strict";gu=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:` + `}var C1=y(()=>{Hx()});function M1(r){return td(r,"uboWgsl",P1,A1)}var R1=y(()=>{Wx();$x();C1()});var Ul,I1=y(()=>{U();Nx();Hx();R1();Ul=class extends cn{constructor(){super({createUboElements:E1,generateUboSync:M1})}};Ul.extension={type:[S.WebGPUSystem],name:"ubo"}});var Zi,rd=y(()=>{Mt();wt();Zi=class extends Ce{constructor({buffer:e,offset:t,size:i}){super(),this.uid=he("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=he("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=t|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=he("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var id,B1=y(()=>{"use strict";id=class{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);let t=this.byteIndex,i=t+e*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,t}addGroup(e){let t=this.addEmptyGroup(e.length);for(let i=0;i{U();Wi();rd();gi();B1();Vi();Qi=128,Gl=class{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new id({minUniformOffsetAlignment:Qi});let t=256/Qi;for(let i=0;i{Ae();Ps()});var Zr,jx=y(()=>{Es();Zr=[];Zr[Fe.NONE]=void 0;Zr[Fe.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Zr[Fe.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Zr[Fe.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Zr[Fe.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Zr[Fe.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function vU(r,e,t,i,s){return r<<24|e<<16|t<<10|i<<5|s}function TU(r,e,t,i){return t<<6|r<<3|i<<1|e}var bU,Ll,F1=y(()=>{U();Ae();Xx();Es();Ua();jx();bU={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Ll=class{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=e}contextChange(e){this._gpu=e,this.setStencilMode(Fe.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){this._multisampleCount=e.msaaSamples,this._depthStencilAttachment=e.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=Zr[e],this._updatePipeHash())}setPipeline(e,t,i,s){let o=this.getPipeline(e,t,i);s.setPipeline(o)}getPipeline(e,t,i,s){e._layoutKey||(sd(e,t.attributeData),this._generateBufferKey(e)),s||(s=e.topology);let o=vU(e._layoutKey,t._layoutKey,i.data,i._blendModeId,bU[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(e,t,i,s),this._pipeCache[o])}_createPipeline(e,t,i,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(e,t),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===Fe.RENDERING_MASK_ADD?0:this._colorMask;let l=this._renderer.shader.getProgramData(t).pipeline,c={vertex:{module:this._getModule(t.vertex.source),entryPoint:t.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(t.fragment.source),entryPoint:t.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(c.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"}),o.createRenderPipeline(c)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){let t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){let t=[],i=0,s=Object.keys(e.attributes).sort();for(let n=0;n{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let l in t.attributeData){let c=e.attributes[l];(c.divisor??1)!==1&&W(`Attribute ${l} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===o&&(n.arrayStride=c.stride,n.stepMode=c.instance?"instance":"vertex",a.push({shaderLocation:t.attributeData[l].location,offset:c.offset,format:c.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){let e=TU(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[e]||(this._pipeStateCaches[e]=Object.create(null)),this._pipeCache=this._pipeStateCaches[e]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};Ll.extension={type:[S.WebGPUSystem],name:"pipeline"}});function O1(r,e,t,i,s,o){let n=o?1:-1;return r.identity(),r.a=1/i*2,r.d=n*(1/s*2),r.tx=-1-e*r.a,r.ty=-n-t*r.d,r}var U1=y(()=>{"use strict"});function G1(r){let e=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}var L1=y(()=>{"use strict"});var hn,Yx=y(()=>{ge();ut();sn();U1();bx();Eo();Xt();ve();Qh();L1();Gx();hn=class{constructor(e){this.rootViewPort=new Q,this.viewport=new Q,this.onRenderTargetChange=new on("onRenderTargetChange"),this.projectionMatrix=new G,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:t,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(e,t,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=G1(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,t=!0,i,s){let o=this.getRenderTarget(e),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=e;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let l=o.colorTexture,c=this.viewport,u=l.pixelWidth,h=l.pixelHeight;if(!s&&e instanceof k&&(s=e.frame),s){let d=l._resolution;c.x=s.x*d+.5|0,c.y=s.y*d+.5|0,c.width=s.width*d+.5|0,c.height=s.height*d+.5|0}else c.x=0,c.y=0,c.width=u,c.height=h;return O1(this.projectionMatrix,0,0,c.width/l.resolution,c.height/l.resolution,!o.isRoot),this.adaptor.startRenderPass(o,t,i,c),n&&this.onRenderTargetChange.emit(o),o}clear(e,t=xt.ALL,i){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=xt.ALL,i,s){let o=this.bind(e,t,i,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,i,s,o){i.x<0&&(s.width+=i.x,o.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,o.y-=i.y,i.y=0);let{pixelWidth:n,pixelHeight:a}=e;return s.width=Math.min(s.width,n-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(e,t,i,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,t)=>{e!==t&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return Rt.test(e)&&(e=Os(e).source),e instanceof Cl?t=e:e instanceof we&&(t=new Cl({colorTextures:[e]}),Rt.test(e.source.resource)&&(t.isRoot=!0),e.once("destroy",()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);let i=this._gpuRenderTargetHash[t.uid];i&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var od,D1=y(()=>{"use strict";od=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var nd,N1=y(()=>{sn();Eo();Xt();D1();nd=class{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,i,s,o){let n=this._renderer,a=this._getGpuColorTexture(e),l=n.texture.getGpuSource(t.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:o},s),t}startRenderPass(e,t=!0,i,s){let n=this._renderTargetSystem.getGpuRenderTarget(e),a=this.getDescriptor(e,t,i);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,i){typeof t=="boolean"&&(t=t?xt.ALL:xt.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(e),n=e.colorTextures.map((c,u)=>{let h=o.contexts[u],d,f;h?d=h.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(c).createView({mipLevelCount:1}),o.msaaTextures[u]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[u]));let p=t&xt.COLOR?"clear":"load";return i??(i=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:i,storeOp:"store",loadOp:p}}),a;if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=o.msaa?4:1),e.depthStencilTexture){let c=t&xt.STENCIL?"clear":"load",u=t&xt.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:c,depthClearValue:1,depthLoadOp:u,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(e,t=!0,i,s){if(!t)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let c=a.createCommandEncoder(),u=this.getDescriptor(e,t,i),h=c.beginRenderPass(u);h.setViewport(s.x,s.y,s.width,s.height,0,1),h.end();let d=c.finish();a.queue.submit([d])}else this.startRenderPass(e,t,i,s)}initGpuRenderTarget(e){e.isRoot=!0;let t=new od;return e.colorTextures.forEach((i,s)=>{if(Rt.test(i.resource)){let o=i.resource.getContext("webgpu"),n=i.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}t.contexts[s]=o}if(t.msaa=i.source.antialias,i.source.antialias){let o=new we({width:0,height:0,sampleCount:4});t.msaaTextures[s]=o}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}destroyGpuRenderTarget(e){e.contexts.forEach(t=>{t.unconfigure()}),e.msaaTextures.forEach(t=>{t.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach((i,s)=>{t.msaaTextures[s]?.resize(i.source.width,i.source.height,i.source._resolution)})}}});var Dl,H1=y(()=>{U();Yx();N1();Dl=class extends hn{constructor(e){super(e),this.adaptor=new nd,this.adaptor.init(e,this)}};Dl.extension={type:[S.WebGPUSystem],name:"renderTarget"}});var Nl,V1=y(()=>{U();Nl=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e,this.maxTextures=e.device.limits.maxSampledTexturesPerShaderStage}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){let t=this._gpu.device,i=e.gpuLayout.map(o=>t.createBindGroupLayout({entries:o})),s={bindGroupLayouts:i};return this._gpuProgramData[e._layoutKey]={bindGroups:i,pipeline:t.createPipelineLayout(s)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Nl.extension={type:[S.WebGPUSystem],name:"shader"}});var Vt,W1=y(()=>{"use strict";Vt={};Vt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Vt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Vt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Vt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Vt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Vt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Vt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Vt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Vt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Vt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Vt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Vt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Hl,z1=y(()=>{U();Rr();W1();Hl=class{constructor(){this.defaultState=new Je,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e){return[{format:"bgra8unorm",writeMask:0,blend:Vt[e.blendMode]||Vt.normal}]}destroy(){this.gpu=null}};Hl.extension={type:[S.WebGPUSystem],name:"state"}});var $1,X1=y(()=>{"use strict";$1={type:"image",upload(r,e,t){let i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),o=i.byteLength/s;t.device.queue.writeTexture({texture:e},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*o},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}}});var qx,SU,j1,Y1=y(()=>{"use strict";qx={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},SU={blockBytes:4,blockWidth:1,blockHeight:1},j1={type:"compressed",upload(r,e,t){let i=r.pixelWidth,s=r.pixelHeight,o=qx[r.format]||SU;for(let n=0;n>1,1),s=Math.max(s>>1,1)}}}});var ad,Kx=y(()=>{"use strict";ad={type:"image",upload(r,e,t){let i=r.resource;if(!i)return;let s=Math.min(e.width,r.resourceWidth||r.pixelWidth),o=Math.min(e.height,r.resourceHeight||r.pixelHeight),n=r.alphaMode==="premultiply-alpha-on-upload";t.device.queue.copyExternalImageToTexture({source:i},{texture:e,premultipliedAlpha:n},{width:s,height:o})}}});var q1,K1=y(()=>{Kx();q1={type:"video",upload(r,e,t){ad.upload(r,e,t)}}});var ld,Z1=y(()=>{"use strict";ld=class{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:` var pos : array, 3> = array, 3>( vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0)); @@ -931,7 +931,7 @@ fn mainFragment( fn fragmentMain(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(img, imgSampler, texCoord); } - `})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};i=this.device.createTexture(l)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let l=0;l{Ft();B();Ge();bo();Ri();oA();aA();Ig();hA();cA();sl=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:mu,buffer:sA,video:lA,compressed:nA},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let l=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(l))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let i=Mg[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,o=Math.ceil(t.pixelHeight/i.blockHeight)*i.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new gu(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new xe({0:e,1:e.style,2:new Ct({uTextureMatrix:{type:"mat3x3",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,i=e.gpu.device.createCommandEncoder(),s=Y.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:Y.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([i.finish()]),s}getPixels(t){let e=this.generateCanvas(t),i=$e.getOptimalCanvasAndContext(e.width,e.height),s=i.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),l=new Uint8ClampedArray(a.data.buffer);return $e.returnCanvasAndContext(i),{pixels:l,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};sl.extension={type:[v.WebGPUSystem],name:"texture"}});var mA={};jy(mA,{WebGPURenderer:()=>Bg});var M2,I2,B2,dA,fA,pA,Bg,gA=x(()=>{B();Bw();Gw();Uw();wa();bg();Lr();BE();FE();kE();GE();UE();OE();zE();XE();jE();tA();eA();iA();uA();M2=[...au,Qa,qa,Uo,ja,sl,el,rl,il,tl,Ya,Ka,Xa],I2=[...lu,Ja],B2=[Pa,Aa,Ea],dA=[],fA=[],pA=[];L.handleByNamedList(v.WebGPUSystem,dA);L.handleByNamedList(v.WebGPUPipes,fA);L.handleByNamedList(v.WebGPUPipesAdaptor,pA);L.add(...M2,...I2,...B2);Bg=class extends Ui{constructor(){let t={name:"webgpu",type:re.WEBGPU,systems:dA,renderPipes:fA,renderPipeAdaptors:pA};super(t)}}});var ol,xA=x(()=>{B();gt();ns();Bi();Jn();ta();Io();Fi();xc();br();Ge();ol=class{init(){let t=new Ct({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new k,type:"mat3x3"},uRound:{value:0,type:"f32"}}),e=nr(),i=Gr({name:"graphics",bits:[ho,uo(e),Mo,Or]});this.shader=new qt({glProgram:i,resources:{localUniforms:t,batchSamplers:fo(e)}})}execute(t,e){let i=e.context,s=i.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let h=l.instructions;for(let c=0;c{B();gt();Bi();Io();Fi();rg();br();vt();Pt();nl=class{init(){let t=Gr({name:"mesh",bits:[Mo,kw,Or]});this._shader=new qt({glProgram:t,resources:{uTexture:M.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new k}}}})}execute(t,e){let i=t.renderer,s=e._shader;if(s){if(!s.glProgram){N("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};nl.extension={type:[v.WebGLPipesAdaptor],name:"mesh"}});var al,_A=x(()=>{B();vr();al=class{constructor(){this._tempState=Qt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,i){let s=t.renderer,o=this._didUploadHash[i.uid];s.shader.bind(i,o),o||(this._didUploadHash[i.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,i.glProgram)}execute(t,e){let i=t.renderer;this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o{"use strict";ll=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(ll||{})});var xu,vA=x(()=>{"use strict";xu=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var hl,TA=x(()=>{B();oi();bA();vA();hl=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){let{_gl:i}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,i.bindBufferBase(i.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let i=0,s=this._nextBindBaseIndex;for(;i<2;){s>=this._maxBindings&&(s=this._minBaseLocation,i++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,i>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,i,s){let{_gl:o}=this;i||(i=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,i*256,s||256)}updateBuffer(t){let{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);let s=t.data,o=t.descriptor.usage&ht.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?i.byteLength>=s.byteLength?e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,e.bufferData(i.type,s,o)):(i.byteLength=t.descriptor.size,e.bufferData(i.type,i.byteLength,o)),i}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,i=ll.ARRAY_BUFFER;t.descriptor.usage&ht.INDEX?i=ll.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&ht.UNIFORM&&(i=ll.UNIFORM_BUFFER);let s=new xu(e.createBuffer(),i);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};hl.extension={type:[v.WebGLSystem],name:"buffer"}});var Fg,wA,EA=x(()=>{Ft();B();Pt();Fg=class SA{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){t={...SA.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(N("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=Y.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let i=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:i,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&N("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&N("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,s=this.webGLVersion===2,o=this.extensions;i.uint32Indices=s||!!o.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!o.vertexArrayObject,i.srgbTextures=s||!!o.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices||N("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Fg.extension={type:[v.WebGLSystem],name:"context"};Fg.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};wA=Fg});var yu,kg,_t,Gg=x(()=>{"use strict";yu=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(yu||{}),kg=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(kg||{}),_t=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(_t||{})});function PA(r){return AA[r]??AA.float32}var AA,CA=x(()=>{Gg();AA={uint8x2:_t.UNSIGNED_BYTE,uint8x4:_t.UNSIGNED_BYTE,sint8x2:_t.BYTE,sint8x4:_t.BYTE,unorm8x2:_t.UNSIGNED_BYTE,unorm8x4:_t.UNSIGNED_BYTE,snorm8x2:_t.BYTE,snorm8x4:_t.BYTE,uint16x2:_t.UNSIGNED_SHORT,uint16x4:_t.UNSIGNED_SHORT,sint16x2:_t.SHORT,sint16x4:_t.SHORT,unorm16x2:_t.UNSIGNED_SHORT,unorm16x4:_t.UNSIGNED_SHORT,snorm16x2:_t.SHORT,snorm16x4:_t.SHORT,float16x2:_t.HALF_FLOAT,float16x4:_t.HALF_FLOAT,float32:_t.FLOAT,float32x2:_t.FLOAT,float32x3:_t.FLOAT,float32x4:_t.FLOAT,uint32:_t.UNSIGNED_INT,uint32x2:_t.UNSIGNED_INT,uint32x3:_t.UNSIGNED_INT,uint32x4:_t.UNSIGNED_INT,sint32:_t.INT,sint32x2:_t.INT,sint32x3:_t.INT,sint32x4:_t.INT}});var F2,cl,RA=x(()=>{B();hs();Pg();CA();F2={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},cl=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(s,o,n,a)=>{i.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,l)=>{i.drawElementsInstancedANGLE(s,o,n,a,l)},t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let i=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,h,(i||0)*l,s):o.drawElements(a,e||n.indexBuffer.data.length,h,(i||0)*l)}else s>1?o.drawArraysInstanced(a,i||0,e||n.getSize(),s):o.drawArrays(a,i||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};cl.extension={type:[v.WebGLSystem],name:"geometry"}});var k2,Ug,IA,BA=x(()=>{B();Pt();oo();br();vr();He();vt();ls();k2=new ar({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Ug=class MA{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:i}={...MA.defaultOptions,...t};this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(N("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Qt.for2d();let s=new lr({vertex:` + `})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){let t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=e,s=e.depthOrArrayLayers||1,o=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let l={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};i=this.device.createTexture(l)}let n=this.device.createCommandEncoder({}),a=t.getBindGroupLayout(0);for(let l=0;l{Re();U();It();zo();Vi();X1();Y1();Kx();K1();Z1();Vl=class{constructor(e){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:ad,buffer:$1,video:q1,compressed:j1},this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuSources"),e.renderableGC.addManagedHash(this,"_gpuSamplers"),e.renderableGC.addManagedHash(this,"_bindGroupHash"),e.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(e){this._gpu=e}initSource(e){if(e.autoGenerateMipmaps){let l=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(l))+1}let t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;e.uploadMethodId!=="compressed"&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC);let i=qx[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(e.pixelWidth/i.blockWidth)*i.blockWidth,o=Math.ceil(e.pixelHeight/i.blockHeight)*i.blockHeight,n={label:e.label,size:{width:s,height:o},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},a=this._gpu.device.createTexture(n);return this._gpuSources[e.uid]=a,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),a}onSourceUpdate(e){let t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onSourceUnload(e){let t=this._gpuSources[e.uid];t&&(this._gpuSources[e.uid]=null,t.destroy())}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new ld(this._gpu.device));let t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceDestroy(e){e.off("update",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("destroy",this.onSourceDestroy,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}onSourceResize(e){let t=this._gpuSources[e.uid];t?(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(this._textureViewHash[e.uid]=null,this._bindGroupHash[e.uid]=null,this.onSourceUnload(e),this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return this._gpuSources[e.uid]||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]??this._createTextureBindGroup(e)}_createTextureBindGroup(e){let t=e.source;return this._bindGroupHash[e.uid]=new gt({0:t,1:t.style,2:new be({uTextureMatrix:{type:"mat3x3",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){let t=e.source;return this._textureViewHash[t.uid]??this._createTextureView(t)}_createTextureView(e){return this._textureViewHash[e.uid]=this.getGpuSource(e).createView(),this._textureViewHash[e.uid]}generateCanvas(e){let t=this._renderer,i=t.gpu.device.createCommandEncoder(),s=j.get().createCanvas();s.width=e.source.pixelWidth,s.height=e.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:j.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),t.gpu.device.queue.submit([i.finish()]),s}getPixels(e){let t=this.generateCanvas(e),i=Kt.getOptimalCanvasAndContext(t.width,t.height),s=i.context;s.drawImage(t,0,0);let{width:o,height:n}=t,a=s.getImageData(0,0,o,n),l=new Uint8ClampedArray(a.data.buffer);return Kt.returnCanvasAndContext(i),{pixels:l,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null;for(let e of Object.keys(this._bindGroupHash)){let t=Number(e);this._bindGroupHash[t]?.destroy(),this._bindGroupHash[t]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};Vl.extension={type:[S.WebGPUSystem],name:"texture"}});var rP={};Ub(rP,{WebGPURenderer:()=>Zx});var wU,EU,AU,J1,eP,tP,Zx,iP=y(()=>{U();_A();TA();SA();ll();Dx();jr();_1();b1();v1();T1();S1();w1();I1();k1();F1();H1();V1();z1();Q1();wU=[...Jh,Ul,kl,ln,Il,Vl,Dl,Nl,Hl,Ll,Bl,Fl,Rl],EU=[...ed,Gl],AU=[hl,ul,cl],J1=[],eP=[],tP=[];V.handleByNamedList(S.WebGPUSystem,J1);V.handleByNamedList(S.WebGPUPipes,eP);V.handleByNamedList(S.WebGPUPipesAdaptor,tP);V.add(...wU,...EU,...AU);Zx=class extends qi{constructor(){let e={name:"webgpu",type:ot.WEBGPU,systems:J1,renderPipes:eP,renderPipeAdaptors:tP};super(e)}}});var Wl,sP=y(()=>{U();ge();ws();$i();Ga();La();tn();Xi();ch();Mr();It();Wl=class{init(){let e=new be({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new G,type:"mat3x3"},uRound:{value:0,type:"f32"}}),t=pr(),i=zr({name:"graphics",bits:[Fo,Uo(t),en,Xr]});this.shader=new Ze({glProgram:i,resources:{localUniforms:e,batchSamplers:Go(t)}})}execute(e,t){let i=t.context,s=i.customShader||this.shader,o=e.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(e.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let c=l.instructions;for(let u=0;u{U();ge();$i();tn();Xi();vx();Mr();ve();Ae();zl=class{init(){let e=zr({name:"mesh",bits:[en,vA,Xr]});this._shader=new Ze({glProgram:e,resources:{uTexture:k.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new G}}}})}execute(e,t){let i=e.renderer,s=t._shader;if(s){if(!s.glProgram){W("Mesh shader has no glProgram",t.shader);return}}else{s=this._shader;let o=t.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=e.localUniformsBindGroup,i.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}};zl.extension={type:[S.WebGLPipesAdaptor],name:"mesh"}});var $l,nP=y(()=>{U();Rr();$l=class{constructor(){this._tempState=Je.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,t,i){let s=e.renderer,o=this._didUploadHash[i.uid];s.shader.bind(i,o),o||(this._didUploadHash[i.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(t,i.glProgram)}execute(e,t){let i=e.renderer;this._tempState.blendMode=t.blendMode,i.state.set(this._tempState);let s=t.textures.textures;for(let o=0;o{"use strict";Xl=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Xl||{})});var cd,lP=y(()=>{"use strict";cd=class{constructor(e,t){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=t}}});var jl,cP=y(()=>{U();gi();aP();lP();jl=class{constructor(e){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let e=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=e.MAX_UNIFORM_BUFFER_BINDINGS?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(e){return this._gpuBuffers[e.uid]||this.createGLBuffer(e)}bind(e){let{_gl:t}=this,i=this.getGlBuffer(e);t.bindBuffer(i.type,i.buffer)}bindBufferBase(e,t){let{_gl:i}=this;this._boundBufferBases[t]!==e&&(this._boundBufferBases[t]=e,e._lastBindBaseLocation=t,i.bindBufferBase(i.UNIFORM_BUFFER,t,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let t=this.getLastBindBaseLocation(e);if(t>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,t;let i=0,s=this._nextBindBaseIndex;for(;i<2;){s>=this._maxBindings&&(s=this._minBaseLocation,i++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return t=s,this._nextBindBaseIndex=s+1,i>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[t]=null,t)}getLastBindBaseLocation(e){let t=e._lastBindBaseLocation;return this._boundBufferBases[t]===e?t:-1}bindBufferRange(e,t,i,s){let{_gl:o}=this;i||(i=0),t||(t=0),this._boundBufferBases[t]=null,o.bindBufferRange(o.UNIFORM_BUFFER,t||0,e.buffer,i*256,s||256)}updateBuffer(e){let{_gl:t}=this,i=this.getGlBuffer(e);if(e._updateID===i.updateID)return i;i.updateID=e._updateID,t.bindBuffer(i.type,i.buffer);let s=e.data,o=e.descriptor.usage&le.STATIC?t.STATIC_DRAW:t.DYNAMIC_DRAW;return s?i.byteLength>=s.byteLength?t.bufferSubData(i.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,t.bufferData(i.type,s,o)):(i.byteLength=e.descriptor.size,t.bufferData(i.type,i.byteLength,o)),i}destroyAll(){let e=this._gl;for(let t in this._gpuBuffers)e.deleteBuffer(this._gpuBuffers[t].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(e,t){let i=this._gpuBuffers[e.uid],s=this._gl;t||s.deleteBuffer(i.buffer),this._gpuBuffers[e.uid]=null}createGLBuffer(e){let{_gl:t}=this,i=Xl.ARRAY_BUFFER;e.descriptor.usage&le.INDEX?i=Xl.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&le.UNIFORM&&(i=Xl.UNIFORM_BUFFER);let s=new cd(t.createBuffer(),i);return this._gpuBuffers[e.uid]=s,e.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};jl.extension={type:[S.WebGLSystem],name:"buffer"}});var Qx,hP,dP=y(()=>{Re();U();Ae();Qx=class uP{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...uP.defaultOptions,...e};let t=this.multiView=e.multiView;if(e.context&&t&&(W("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),t=!1),t?this.canvas=j.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{let i=this._renderer.background.alpha<1,s=e.premultipliedAlpha??!0,o=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:i,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&W("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:t}=this;(t.width{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){let t=e.getContextAttributes();t&&!t.stencil&&W("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,s=this.webGLVersion===2,o=this.extensions;i.uint32Indices=s||!!o.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!o.vertexArrayObject,i.srgbTextures=s||!!o.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices||W("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Qx.extension={type:[S.WebGLSystem],name:"context"};Qx.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};hP=Qx});var ud,Jx,ye,ey=y(()=>{"use strict";ud=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(ud||{}),Jx=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Jx||{}),ye=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(ye||{})});function pP(r){return fP[r]??fP.float32}var fP,mP=y(()=>{ey();fP={uint8x2:ye.UNSIGNED_BYTE,uint8x4:ye.UNSIGNED_BYTE,sint8x2:ye.BYTE,sint8x4:ye.BYTE,unorm8x2:ye.UNSIGNED_BYTE,unorm8x4:ye.UNSIGNED_BYTE,snorm8x2:ye.BYTE,snorm8x4:ye.BYTE,uint16x2:ye.UNSIGNED_SHORT,uint16x4:ye.UNSIGNED_SHORT,sint16x2:ye.SHORT,sint16x4:ye.SHORT,unorm16x2:ye.UNSIGNED_SHORT,unorm16x4:ye.UNSIGNED_SHORT,snorm16x2:ye.SHORT,snorm16x4:ye.SHORT,float16x2:ye.HALF_FLOAT,float16x4:ye.HALF_FLOAT,float32:ye.FLOAT,float32x2:ye.FLOAT,float32x3:ye.FLOAT,float32x4:ye.FLOAT,uint32:ye.UNSIGNED_INT,uint32x2:ye.UNSIGNED_INT,uint32x3:ye.UNSIGNED_INT,uint32x4:ye.UNSIGNED_INT,sint32:ye.INT,sint32x2:ye.INT,sint32x3:ye.INT,sint32x4:ye.INT}});var PU,Yl,gP=y(()=>{U();Ps();Xx();mP();PU={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Yl=class{constructor(e){this._geometryVaoHash=Object.create(null),this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let t=this._renderer.context.extensions.vertexArrayObject;t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.bindVertexArray=s=>t.bindVertexArrayOES(s),e.deleteVertexArray=s=>t.deleteVertexArrayOES(s));let i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(e.drawArraysInstanced=(s,o,n,a)=>{i.drawArraysInstancedANGLE(s,o,n,a)},e.drawElementsInstanced=(s,o,n,a,l)=>{i.drawElementsInstancedANGLE(s,o,n,a,l)},e.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(e,t){let i=this.gl;this._activeGeometry=e;let s=this.getVao(e,t);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this._renderer.buffer;for(let i=0;i1?o.drawElementsInstanced(a,t||n.indexBuffer.data.length,c,(i||0)*l,s):o.drawElements(a,t||n.indexBuffer.data.length,c,(i||0)*l)}else s>1?o.drawArraysInstanced(a,i||0,t||n.getSize(),s):o.drawArrays(a,i||0,t||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};Yl.extension={type:[S.WebGLSystem],name:"geometry"}});var CU,ty,yP,_P=y(()=>{U();Ae();Ro();Mr();Rr();Xt();ve();As();CU=new mr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),ty=class xP{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){let{useBackBuffer:t,antialias:i}={...xP.defaultOptions,...e};this.useBackBuffer=t,this._antialias=i,this._renderer.context.supports.msaa||(W("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Je.for2d();let s=new gr({vertex:` attribute vec2 aPosition; out vec2 vUv; @@ -950,15 +950,15 @@ fn mainFragment( void main() { finalColor = texture(uTexture, vUv); - }`,name:"big-triangle"});this._bigTriangleShader=new qt({glProgram:s,resources:{uTexture:M.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:k2,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new M({source:new wt({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};Ug.extension={type:[v.WebGLSystem],name:"backBuffer",priority:1};Ug.defaultOptions={useBackBuffer:!1};IA=Ug});var ul,FA=x(()=>{B();ul=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}};ul.extension={type:[v.WebGLSystem],name:"colorMask"}});var dl,kA=x(()=>{B();dl=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:i,shader:s,state:o,skipSync:n,topology:a,size:l,start:h,instanceCount:c}=t;e.shader.bind(s,n),e.geometry.bind(i,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,l,h,c??i.instanceCount)}destroy(){this._renderer=null}};dl.extension={type:[v.WebGLSystem],name:"encoder"}});var fl,GA=x(()=>{B();Cg();as();fl=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Ot.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Ot.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Ot.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Vr[t],n=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===Ot.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==n.stencilMode||n.stencilReference!==e)&&(n.stencilMode=t,n.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[o.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[o.stencilBack.passOp]))}};fl.extension={type:[v.WebGLSystem],name:"stencil"}});function UA(r){let t=r.map(o=>({data:o,offset:0,size:0})),e=16,i=0,s=0;for(let o=0;o1&&(i=Math.max(i,e)*n.data.size);let a=i===12?16:i;n.size=i;let l=s%e;l>0&&e-l{"use strict";Og={f32:4,i32:4,"vec2":8,"vec3":12,"vec4":16,"vec2":8,"vec3":12,"vec4":16,"mat2x2":32,"mat3x3":48,"mat4x4":64}});function OA(r,t){let e=Math.max(Og[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return` + }`,name:"big-triangle"});this._bigTriangleShader=new Ze({glProgram:s,resources:{uTexture:k.WHITE.source}})}renderStart(e){let t=this._renderer.renderTarget.getRenderTarget(e.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!t.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(e.target);this._targetTexture=i.colorTexture,e.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let e=this._renderer;e.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(e.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,e.encoder.draw({geometry:CU,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(e){return this._backBufferTexture=this._backBufferTexture||new k({source:new we({width:e.width,height:e.height,resolution:e._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(e.width,e.height,e._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};ty.extension={type:[S.WebGLSystem],name:"backBuffer",priority:1};ty.defaultOptions={useBackBuffer:!1};yP=ty});var ql,bP=y(()=>{U();ql=class{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.gl.colorMask(!!(e&8),!!(e&4),!!(e&2),!!(e&1)))}};ql.extension={type:[S.WebGLSystem],name:"colorMask"}});var Kl,vP=y(()=>{U();Kl=class{constructor(e){this.commandFinished=Promise.resolve(),this._renderer=e}setGeometry(e,t){this._renderer.geometry.bind(e,t.glProgram)}finishRenderPass(){}draw(e){let t=this._renderer,{geometry:i,shader:s,state:o,skipSync:n,topology:a,size:l,start:c,instanceCount:u}=e;t.shader.bind(s,n),t.geometry.bind(i,t.shader._activeProgram),o&&t.state.set(o),t.geometry.draw(a,l,c,u??i.instanceCount)}destroy(){this._renderer=null}};Kl.extension={type:[S.WebGLSystem],name:"encoder"}});var Zl,TP=y(()=>{U();jx();Es();Zl=class{constructor(e){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Fe.NONE},this._renderTargetStencilState=Object.create(null),e.renderTarget.onRenderTargetChange.add(this)}contextChange(e){this._gl=e,this._comparisonFuncMapping={always:e.ALWAYS,never:e.NEVER,equal:e.EQUAL,"not-equal":e.NOTEQUAL,less:e.LESS,"less-equal":e.LEQUAL,greater:e.GREATER,"greater-equal":e.GEQUAL},this._stencilOpsMapping={keep:e.KEEP,zero:e.ZERO,replace:e.REPLACE,invert:e.INVERT,"increment-clamp":e.INCR,"decrement-clamp":e.DECR,"increment-wrap":e.INCR_WRAP,"decrement-wrap":e.DECR_WRAP},this.resetState()}onRenderTargetChange(e){if(this._activeRenderTarget===e)return;this._activeRenderTarget=e;let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Fe.DISABLED,stencilReference:0}),this.setStencilMode(t.stencilMode,t.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Fe.NONE,this._stencilCache.stencilReference=0}setStencilMode(e,t){let i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Zr[e],n=this._stencilCache;if(i.stencilMode=e,i.stencilReference=t,e===Fe.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(e!==n.stencilMode||n.stencilReference!==t)&&(n.stencilMode=e,n.stencilReference=t,s.stencilFunc(this._comparisonFuncMapping[o.stencilBack.compare],t,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[o.stencilBack.passOp]))}};Zl.extension={type:[S.WebGLSystem],name:"stencil"}});function SP(r){let e=r.map(o=>({data:o,offset:0,size:0})),t=16,i=0,s=0;for(let o=0;o1&&(i=Math.max(i,t)*n.data.size);let a=i===12?16:i;n.size=i;let l=s%t;l>0&&t-l{"use strict";ry={f32:4,i32:4,"vec2":8,"vec3":12,"vec4":16,"vec2":8,"vec3":12,"vec4":16,"mat2x2":32,"mat3x3":48,"mat4x4":64}});function wP(r,e){let t=Math.max(ry[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4,o=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return` v = uv.${r.data.name}; - offset += ${t}; + offset += ${e}; arrayOffset = offset; t = 0; - for(var i=0; i < ${r.data.size*e}; i++) + for(var i=0; i < ${r.data.size*t}; i++) { for(var j = 0; j < ${i}; j++) { @@ -966,37 +966,37 @@ fn mainFragment( } ${s!==0?`arrayOffset += ${s};`:""} } - `}var LA=x(()=>{Lg()});function DA(r){return hu(r,"uboStd40",OA,Eg)}var NA=x(()=>{wg();Ag();LA()});var pl,HA=x(()=>{B();vg();Lg();NA();pl=class extends Oo{constructor(){super({createUboElements:UA,generateUboSync:DA})}};pl.extension={type:[v.WebGLSystem],name:"ubo"}});var _u,VA=x(()=>{"use strict";_u=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var bu,WA=x(()=>{ae();Pt();to();Bo();VA();bu=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new ot}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new ot}copyToTexture(t,e,i,s,o){let n=this._renderTargetSystem,a=this._renderer,l=n.getGpuRenderTarget(t),h=a.gl;return this.finishRenderPass(t),h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),a.texture.bind(e,0),h.copyTexSubImage2D(h.TEXTURE_2D,0,o.x,o.y,i.x,i.y,s.width,s.height),e}startRenderPass(t,e=!0,i,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),l=s.y;t.isRoot&&(l=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let h=this._renderer.gl;h.bindFramebuffer(h.FRAMEBUFFER,a.framebuffer);let c=this._viewPortCache;(c.x!==s.x||c.y!==l||c.width!==s.width||c.height!==s.height)&&(c.x=s.x,c.y=l,c.width=s.width,c.height=s.height,h.viewport(s.x,l,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,i)}finishRenderPass(t){let i=this._renderTargetSystem.getGpuRenderTarget(t);if(!i.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,i.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,i.framebuffer),s.blitFramebuffer(0,0,i.width,i.height,0,0,i.width,i.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,i.framebuffer)}initGpuRenderTarget(t){let i=this._renderer.gl,s=new _u,o=t.colorTexture;return Pe.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),i.bindFramebuffer(i.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?ye.ALL:ye.NONE);let o=this._renderer.gl;if(e&ye.COLOR){i??(i=s.defaultClearColor);let n=this._clearColorCache,a=i;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let i=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,i),(t.stencil||t.depth)&&this._resizeStencil(i)}_initColor(t,e){let i=this._renderer,s=i.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let l=n.source;l.antialias&&(i.context.supports.msaa?e.msaa=!0:N("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(l,0);let c=i.texture.getGlSource(l).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,c,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,l)=>{let h=s.createRenderbuffer();e.msaaRenderBuffer[l]=h})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(i.width,i.height,i._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,l)=>{let h=a.source;s.texture.bindSource(h,0);let u=s.texture.getGlSource(h).internalFormat,d=e.msaaRenderBuffer[l];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,h.pixelWidth,h.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+l,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&Pe.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&Pe.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}}});var ml,zA=x(()=>{B();Rg();WA();ml=class extends Do{constructor(t){super(t),this.adaptor=new bu,this.adaptor.init(t,this)}};ml.extension={type:[v.WebGLSystem],name:"renderTarget"}});function $A(r,t){let e=[],i=[` + `}var EP=y(()=>{iy()});function AP(r){return td(r,"uboStd40",wP,zx)}var PP=y(()=>{Wx();$x();EP()});var Ql,CP=y(()=>{U();Nx();iy();PP();Ql=class extends cn{constructor(){super({createUboElements:SP,generateUboSync:AP})}};Ql.extension={type:[S.WebGLSystem],name:"ubo"}});var hd,MP=y(()=>{"use strict";hd=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var dd,RP=y(()=>{ut();Ae();Eo();sn();MP();dd=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new Q}init(e,t){this._renderer=e,this._renderTargetSystem=t,e.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new Q}copyToTexture(e,t,i,s,o){let n=this._renderTargetSystem,a=this._renderer,l=n.getGpuRenderTarget(e),c=a.gl;return this.finishRenderPass(e),c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),a.texture.bind(t,0),c.copyTexSubImage2D(c.TEXTURE_2D,0,o.x,o.y,i.x,i.y,s.width,s.height),t}startRenderPass(e,t=!0,i,s){let o=this._renderTargetSystem,n=e.colorTexture,a=o.getGpuRenderTarget(e),l=s.y;e.isRoot&&(l=n.pixelHeight-s.height),e.colorTextures.forEach(h=>{this._renderer.texture.unbind(h)});let c=this._renderer.gl;c.bindFramebuffer(c.FRAMEBUFFER,a.framebuffer);let u=this._viewPortCache;(u.x!==s.x||u.y!==l||u.width!==s.width||u.height!==s.height)&&(u.x=s.x,u.y=l,u.width=s.width,u.height=s.height,c.viewport(s.x,l,s.width,s.height)),!a.depthStencilRenderBuffer&&(e.stencil||e.depth)&&this._initStencil(a),this.clear(e,t,i)}finishRenderPass(e){let i=this._renderTargetSystem.getGpuRenderTarget(e);if(!i.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,i.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,i.framebuffer),s.blitFramebuffer(0,0,i.width,i.height,0,0,i.width,i.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,i.framebuffer)}initGpuRenderTarget(e){let i=this._renderer.gl,s=new hd,o=e.colorTexture;return Rt.test(o.resource)?(this._renderer.context.ensureCanvasSize(e.colorTexture.resource),s.framebuffer=null,s):(this._initColor(e,s),i.bindFramebuffer(i.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(e){let t=this._renderer.gl;e.framebuffer&&(t.deleteFramebuffer(e.framebuffer),e.framebuffer=null),e.resolveTargetFramebuffer&&(t.deleteFramebuffer(e.resolveTargetFramebuffer),e.resolveTargetFramebuffer=null),e.depthStencilRenderBuffer&&(t.deleteRenderbuffer(e.depthStencilRenderBuffer),e.depthStencilRenderBuffer=null),e.msaaRenderBuffer.forEach(i=>{t.deleteRenderbuffer(i)}),e.msaaRenderBuffer=null}clear(e,t,i){if(!t)return;let s=this._renderTargetSystem;typeof t=="boolean"&&(t=t?xt.ALL:xt.NONE);let o=this._renderer.gl;if(t&xt.COLOR){i??(i=s.defaultClearColor);let n=this._clearColorCache,a=i;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(t)}resizeGpuRenderTarget(e){if(e.isRoot)return;let i=this._renderTargetSystem.getGpuRenderTarget(e);this._resizeColor(e,i),(e.stencil||e.depth)&&this._resizeStencil(i)}_initColor(e,t){let i=this._renderer,s=i.gl,o=s.createFramebuffer();if(t.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),t.width=e.colorTexture.source.pixelWidth,t.height=e.colorTexture.source.pixelHeight,e.colorTextures.forEach((n,a)=>{let l=n.source;l.antialias&&(i.context.supports.msaa?t.msaa=!0:W("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(l,0);let u=i.texture.getGlSource(l).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,u,0)}),t.msaa){let n=s.createFramebuffer();t.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),e.colorTextures.forEach((a,l)=>{let c=s.createRenderbuffer();t.msaaRenderBuffer[l]=c})}else t.framebuffer=o;this._resizeColor(e,t)}_resizeColor(e,t){let i=e.colorTexture.source;if(t.width=i.pixelWidth,t.height=i.pixelHeight,e.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(i.width,i.height,i._resolution)}),t.msaa){let s=this._renderer,o=s.gl,n=t.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),e.colorTextures.forEach((a,l)=>{let c=a.source;s.texture.bindSource(c,0);let h=s.texture.getGlSource(c).internalFormat,d=t.msaaRenderBuffer[l];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,h,c.pixelWidth,c.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+l,o.RENDERBUFFER,d)})}}_initStencil(e){if(e.framebuffer===null)return;let t=this._renderer.gl,i=t.createRenderbuffer();e.depthStencilRenderBuffer=i,t.bindRenderbuffer(t.RENDERBUFFER,i),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,i),this._resizeStencil(e)}_resizeStencil(e){let t=this._renderer.gl;t.bindRenderbuffer(t.RENDERBUFFER,e.depthStencilRenderBuffer),e.msaa?t.renderbufferStorageMultisample(t.RENDERBUFFER,4,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,this._renderer.context.webGLVersion===2?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL,e.width,e.height)}prerender(e){let t=e.colorTexture.resource;this._renderer.context.multiView&&Rt.test(t)&&this._renderer.context.ensureCanvasSize(t)}postrender(e){if(this._renderer.context.multiView&&Rt.test(e.colorTexture.resource)){let t=this._renderer.context.canvas,i=e.colorTexture;i.context2D.drawImage(t,0,i.pixelHeight-t.height)}}}});var Jl,IP=y(()=>{U();Yx();RP();Jl=class extends hn{constructor(e){super(e),this.adaptor=new dd,this.adaptor.init(e,this)}};Jl.extension={type:[S.WebGLSystem],name:"renderTarget"}});function BP(r,e){let t=[],i=[` var g = s.groups; var sS = r.shader; var p = s.glProgram; var ugS = r.uniformGroup; var resources; - `],s=!1,o=0,n=t._getProgramData(r.glProgram);for(let l in r.groups){let h=r.groups[l];e.push(` + `],s=!1,o=0,n=e._getProgramData(r.glProgram);for(let l in r.groups){let c=r.groups[l];t.push(` resources = g[${l}].resources; - `);for(let c in h.resources){let u=h.resources[c];if(u instanceof Ct)if(u.ubo){let d=r._uniformBindMap[l][Number(c)];e.push(` + `);for(let u in c.resources){let h=c.resources[u];if(h instanceof be)if(h.ubo){let d=r._uniformBindMap[l][Number(u)];t.push(` sS.bindUniformBlock( - resources[${c}], + resources[${u}], '${d}', ${r.glProgram._uniformBlockData[d].index} ); - `)}else e.push(` - ugS.updateUniformGroup(resources[${c}], p, sD); - `);else if(u instanceof Oi){let d=r._uniformBindMap[l][Number(c)];e.push(` + `)}else t.push(` + ugS.updateUniformGroup(resources[${u}], p, sD); + `);else if(h instanceof Zi){let d=r._uniformBindMap[l][Number(u)];t.push(` sS.bindUniformBlock( - resources[${c}], + resources[${u}], '${d}', ${r.glProgram._uniformBlockData[d].index} ); - `)}else if(u instanceof wt){let d=r._uniformBindMap[l][c],f=n.uniformData[d];f&&(s||(s=!0,i.push(` + `)}else if(h instanceof we){let d=r._uniformBindMap[l][u],f=n.uniformData[d];f&&(s||(s=!0,i.push(` var tS = r.texture; - `)),t._gl.uniform1i(f.location,o),e.push(` - tS.bind(resources[${c}], ${o}); - `),o++)}}}let a=[...i,...e].join(` -`);return new Function("r","s","sD",a)}var XA=x(()=>{cu();Ge();He()});var vu,jA=x(()=>{"use strict";vu=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function Dg(r,t,e){let i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}var YA=x(()=>{"use strict"});function Ng(r){let t=new Array(r);for(let e=0;e{"use strict"});function Vg(r,t){if(!Su){let e=Object.keys(qA);Su={};for(let i=0;i{"use strict";Su=null,qA={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},G2={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function ZA(r,t,e=!1){let i={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let n=0;nn>a?1:-1);for(let n=0;n{hs();Wg()});function JA(r,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s{"use strict"});function e1(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s{Hg();Wg()});function i1(r,t){let e=r.getShaderSource(t).split(` -`).map((h,c)=>`${c}: ${h}`),i=r.getShaderInfoLog(t),s=i.split(` -`),o={},n=s.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!o[h]?(o[h]=!0,!0):!1),a=[""];n.forEach(h=>{e[h-1]=`%c${e[h-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=e.join(` -`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function s1(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||i1(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||i1(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var o1=x(()=>{"use strict"});function n1(r,t){let e=Dg(r,r.VERTEX_SHADER,t.vertex),i=Dg(r,r.FRAGMENT_SHADER,t.fragment),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);let o=t.transformFeedbackVaryings;o&&(typeof r.transformFeedbackVaryings!="function"?N("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||s1(r,s,e,i),t._attributeData=ZA(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=e1(s,r),t._uniformBlockData=JA(s,r),r.deleteShader(e),r.deleteShader(i);let n={};for(let l in t._uniformData){let h=t._uniformData[l];n[l]={location:r.getUniformLocation(s,l),value:Tu(h.type,h.size)}}return new vu(s,n)}var a1=x(()=>{Pt();jA();YA();Hg();QA();t1();r1();o1()});var wu,gl,l1=x(()=>{B();ns();XA();a1();wu={textureCount:0,blockIndex:0},gl=class{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=nr()}bind(t,e){if(this._setProgram(t.glProgram),e)return;wu.textureCount=0,wu.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),i(this._renderer,t,wu)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,wu)}bindUniformBlock(t,e,i=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,l=s.updateBuffer(a),h=s.freeLocationForBufferBase(l);if(n){let{offset:u,size:d}=t;u===0&&d===a.data.byteLength?s.bindBufferBase(l,h):s.bindBufferRange(l,h,u)}else s.getLastBindBaseLocation(l)!==h&&s.bindBufferBase(l,h);let c=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[i]!==h&&(o.uniformBlockBindings[i]=h,this._renderer.gl.uniformBlockBinding(o.program,c,h))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=n1(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return $A(t,e)}resetState(){this._activeProgram=null}};gl.extension={type:[v.WebGLSystem],name:"shader"}});var h1,c1,u1=x(()=>{"use strict";h1={f32:`if (cv !== v) { + `)),e._gl.uniform1i(f.location,o),t.push(` + tS.bind(resources[${u}], ${o}); + `),o++)}}}let a=[...i,...t].join(` +`);return new Function("r","s","sD",a)}var kP=y(()=>{rd();It();Xt()});var fd,FP=y(()=>{"use strict";fd=class{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function sy(r,e,t){let i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}var OP=y(()=>{"use strict"});function oy(r){let e=new Array(r);for(let t=0;t{"use strict"});function ay(r,e){if(!md){let t=Object.keys(UP);md={};for(let i=0;i{"use strict";md=null,UP={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},MU={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function LP(r,e,t=!1){let i={},s=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES);for(let n=0;nn>a?1:-1);for(let n=0;n{Ps();ly()});function NP(r,e){if(!e.ACTIVE_UNIFORM_BLOCKS)return{};let t={},i=e.getProgramParameter(r,e.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s{"use strict"});function VP(r,e){let t={},i=e.getProgramParameter(r,e.ACTIVE_UNIFORMS);for(let s=0;s{ny();ly()});function zP(r,e){let t=r.getShaderSource(e).split(` +`).map((c,u)=>`${u}: ${c}`),i=r.getShaderInfoLog(e),s=i.split(` +`),o={},n=s.map(c=>parseFloat(c.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(c=>c&&!o[c]?(o[c]=!0,!0):!1),a=[""];n.forEach(c=>{t[c-1]=`%c${t[c-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=t.join(` +`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function $P(r,e,t,i){r.getProgramParameter(e,r.LINK_STATUS)||(r.getShaderParameter(t,r.COMPILE_STATUS)||zP(r,t),r.getShaderParameter(i,r.COMPILE_STATUS)||zP(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(e)))}var XP=y(()=>{"use strict"});function jP(r,e){let t=sy(r,r.VERTEX_SHADER,e.vertex),i=sy(r,r.FRAGMENT_SHADER,e.fragment),s=r.createProgram();r.attachShader(s,t),r.attachShader(s,i);let o=e.transformFeedbackVaryings;o&&(typeof r.transformFeedbackVaryings!="function"?W("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||$P(r,s,t,i),e._attributeData=LP(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)),e._uniformData=VP(s,r),e._uniformBlockData=NP(s,r),r.deleteShader(t),r.deleteShader(i);let n={};for(let l in e._uniformData){let c=e._uniformData[l];n[l]={location:r.getUniformLocation(s,l),value:pd(c.type,c.size)}}return new fd(s,n)}var YP=y(()=>{Ae();FP();OP();ny();DP();HP();WP();XP()});var gd,ec,qP=y(()=>{U();ws();kP();YP();gd={textureCount:0,blockIndex:0},ec=class{constructor(e){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(e){this._gl=e,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=pr()}bind(e,t){if(this._setProgram(e.glProgram),t)return;gd.textureCount=0,gd.blockIndex=0;let i=this._shaderSyncFunctions[e.glProgram._key];i||(i=this._shaderSyncFunctions[e.glProgram._key]=this._generateShaderSync(e,this)),this._renderer.buffer.nextBindBase(!!e.glProgram.transformFeedbackVaryings),i(this._renderer,e,gd)}updateUniformGroup(e){this._renderer.uniformGroup.updateUniformGroup(e,this._activeProgram,gd)}bindUniformBlock(e,t,i=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=e._bufferResource;n||this._renderer.ubo.updateUniformGroup(e);let a=e.buffer,l=s.updateBuffer(a),c=s.freeLocationForBufferBase(l);if(n){let{offset:h,size:d}=e;h===0&&d===a.data.byteLength?s.bindBufferBase(l,c):s.bindBufferRange(l,c,h)}else s.getLastBindBaseLocation(l)!==c&&s.bindBufferBase(l,c);let u=this._activeProgram._uniformBlockData[t].index;o.uniformBlockBindings[i]!==c&&(o.uniformBlockBindings[i]=c,this._renderer.gl.uniformBlockBinding(o.program,u,c))}_setProgram(e){if(this._activeProgram===e)return;this._activeProgram=e;let t=this._getProgramData(e);this._gl.useProgram(t.program)}_getProgramData(e){return this._programDataHash[e._key]||this._createProgramData(e)}_createProgramData(e){let t=e._key;return this._programDataHash[t]=jP(this._gl,e),this._programDataHash[t]}destroy(){for(let e of Object.keys(this._programDataHash))this._programDataHash[e].destroy(),this._programDataHash[e]=null;this._programDataHash=null}_generateShaderSync(e,t){return BP(e,t)}resetState(){this._activeProgram=null}};ec.extension={type:[S.WebGLSystem],name:"shader"}});var KP,ZP,QP=y(()=>{"use strict";KP={f32:`if (cv !== v) { cu.value = v; gl.uniform1f(location, v); }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { @@ -1068,30 +1068,30 @@ fn mainFragment( cv[2] = v[2]; cv[3] = v[3]; gl.uniform4i(location, v[0], v[1], v[2], v[3]); - }`,"mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);"},c1={f32:"gl.uniform1fv(location, v);","vec2":"gl.uniform2fv(location, v);","vec3":"gl.uniform3fv(location, v);","vec4":"gl.uniform4fv(location, v);","mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);"}});function d1(r,t){let e=[` + }`,"mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);"},ZP={f32:"gl.uniform1fv(location, v);","vec2":"gl.uniform2fv(location, v);","vec3":"gl.uniform3fv(location, v);","vec4":"gl.uniform4fv(location, v);","mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);"}});function JP(r,e){let t=[` var v = null; var cv = null; var cu = null; var t = 0; var gl = renderer.gl; var name = null; - `];for(let i in r.uniforms){if(!t[i]){r.uniforms[i]instanceof Ct?r.uniforms[i].ubo?e.push(` + `];for(let i in r.uniforms){if(!e[i]){r.uniforms[i]instanceof be?r.uniforms[i].ubo?t.push(` renderer.shader.bindUniformBlock(uv.${i}, "${i}"); - `):e.push(` + `):t.push(` renderer.shader.updateUniformGroup(uv.${i}); - `):r.uniforms[i]instanceof Oi&&e.push(` + `):r.uniforms[i]instanceof Zi&&t.push(` renderer.shader.bindBufferResource(uv.${i}, "${i}"); - `);continue}let s=r.uniformStructures[i],o=!1;for(let n=0;n{cu();Ge();Sg();u1()});var xl,p1=x(()=>{B();f1();xl=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return d1(t,e)}_getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};xl.extension={type:[v.WebGLSystem],name:"uniformGroup"}});function m1(r){let t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof Y.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return t}var g1=x(()=>{Ft()});var U2,O2,L2,D2,N2,H2,x1,y1,_1=x(()=>{B();vr();g1();U2=0,O2=1,L2=2,D2=3,N2=4,H2=5,x1=class zg{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[U2]=this.setBlend,this.map[O2]=this.setOffset,this.map[L2]=this.setCullFace,this.map[D2]=this.setDepthTest,this.map[N2]=this.setFrontFace,this.map[H2]=this.setDepthMask,this.checks=[],this.defaultState=Qt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=m1(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<>=1,i++;this.stateId=t.data}for(let e=0;e{Gg();Eu=class{constructor(t){this.target=kg.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=_t.UNSIGNED_BYTE,this.internalFormat=yu.RGBA,this.format=yu.RGBA,this.samplerType=0}}});var v1,T1=x(()=>{"use strict";v1={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}}});var V2,S1,w1=x(()=>{"use strict";V2={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},S1={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!V2[r.format];for(let n=0;n>1,1),s=Math.max(s>>1,1)}}}});var Au,$g=x(()=>{"use strict";Au={id:"image",upload(r,t,e,i){let s=t.width,o=t.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,h=r.resourceHeight;l{$g();E1={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Au.upload(r,t,e,i)}}});var Xg,P1,Pu,C1,R1=x(()=>{"use strict";Xg={linear:9729,nearest:9728},P1={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Pu={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},C1={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function jg(r,t,e,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let h=Pu[n?"clamp-to-edge":r.addressModeU],c=Pu[n?"clamp-to-edge":r.addressModeV],u=Pu[n?"clamp-to-edge":r.addressModeW];t[s](l,t.TEXTURE_WRAP_S,h),t[s](l,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,u)}if((!a||r.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,Xg[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){let h=P1[r.minFilter][r.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,h)}}else t[s](l,t.TEXTURE_MIN_FILTER,Xg[r.minFilter]);if(i&&r.maxAnisotropy>1){let h=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,h)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,C1[r.compare])}var M1=x(()=>{R1()});function I1(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var B1=x(()=>{"use strict"});function F1(r,t){let e={},i=r.RGBA;return r instanceof Y.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...e,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var k1=x(()=>{Ft()});function G1(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var U1=x(()=>{"use strict"});var W2,yl,O1=x(()=>{Ft();B();vt();b1();T1();w1();$g();A1();M1();B1();k1();U1();W2=4,yl=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Au,buffer:v1,video:E1,compressed:S1},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=F1(t,this._renderer.context.extensions),this._mapFormatToType=G1(t),this._mapFormatToFormat=I1(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(M.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=M.EMPTY.source);let s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){let e=t.source,i=this._boundTextures,s=this._gl;for(let o=0;o1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,jg(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:i,height:s}=this.getPixels(t),o=Y.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),o=Math.max(Math.round(i.height*e),1),n=new Uint8Array(W2*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(t),h=a.renderTarget.getGpuRenderTarget(l),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,h.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(M.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};yl.extension={type:[v.WebGLSystem],name:"texture"}});var H1={};jy(H1,{WebGLRenderer:()=>Yg});var z2,$2,X2,L1,D1,N1,Yg,V1=x(()=>{B();xA();yA();_A();wa();bg();Lr();TA();EA();RA();BA();FA();kA();GA();HA();zA();l1();p1();_1();O1();z2=[...au,pl,IA,wA,hl,yl,ml,cl,xl,gl,dl,y1,fl,ul],$2=[...lu],X2=[al,nl,ol],L1=[],D1=[],N1=[];L.handleByNamedList(v.WebGLSystem,L1);L.handleByNamedList(v.WebGLPipes,D1);L.handleByNamedList(v.WebGLPipesAdaptor,N1);L.add(...z2,...$2,...X2);Yg=class extends Ui{constructor(){let t={name:"webgl",type:re.WEBGL,systems:L1,renderPipes:D1,renderPipeAdaptors:N1};super(t)}}});var wC=J((Ydt,Sx)=>{"use strict";var _G=Object.prototype.hasOwnProperty,De="~";function Ul(){}Object.create&&(Ul.prototype=Object.create(null),new Ul().__proto__||(De=!1));function bG(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function SC(r,t,e,i,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new bG(e,i||r,s),n=De?De+t:t;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function bd(r,t){--r._eventsCount===0?r._events=new Ul:delete r._events[t]}function Me(){this._events=new Ul,this._eventsCount=0}Me.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)_G.call(e,i)&&t.push(De?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Me.prototype.listeners=function(t){var e=De?De+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s{(function(r){var t=typeof Yo=="object"&&Yo&&!Yo.nodeType&&Yo,e=typeof qo=="object"&&qo&&!qo.nodeType&&qo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,l=26,h=38,c=700,u=72,d=128,f="-",m=/^xn--/,g=/[^\x20-\x7E]/,p=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=n-a,_=Math.floor,S=String.fromCharCode,E;function w(V){throw new RangeError(b[V])}function T(V,O){for(var W=V.length,tt=[];W--;)tt[W]=O(V[W]);return tt}function C(V,O){var W=V.split("@"),tt="";W.length>1&&(tt=W[0]+"@",V=W[1]),V=V.replace(p,".");var et=V.split("."),yt=T(et,O).join(".");return tt+yt}function A(V){for(var O=[],W=0,tt=V.length,et,yt;W=55296&&et<=56319&&W65535&&(O-=65536,W+=S(O>>>10&1023|55296),O=56320|O&1023),W+=S(O),W}).join("")}function R(V){return V-48<10?V-22:V-65<26?V-65:V-97<26?V-97:n}function I(V,O){return V+22+75*(V<26)-((O!=0)<<5)}function F(V,O,W){var tt=0;for(V=W?_(V/c):V>>1,V+=_(V/O);V>y*l>>1;tt+=n)V=_(V/y);return _(tt+(y+1)*V/(V+h))}function G(V){var O=[],W=V.length,tt,et=0,yt=d,Ut=u,Mt,Wt,mt,St,ct,Bt,ne,Zt,pe;for(Mt=V.lastIndexOf(f),Mt<0&&(Mt=0),Wt=0;Wt=128&&w("not-basic"),O.push(V.charCodeAt(Wt));for(mt=Mt>0?Mt+1:0;mt=W&&w("invalid-input"),ne=R(V.charCodeAt(mt++)),(ne>=n||ne>_((o-et)/ct))&&w("overflow"),et+=ne*ct,Zt=Bt<=Ut?a:Bt>=Ut+l?l:Bt-Ut,!(ne_(o/pe)&&w("overflow"),ct*=pe;tt=O.length+1,Ut=F(et-St,tt,St==0),_(et/tt)>o-yt&&w("overflow"),yt+=_(et/tt),et%=tt,O.splice(et++,0,yt)}return P(O)}function z(V){var O,W,tt,et,yt,Ut,Mt,Wt,mt,St,ct,Bt=[],ne,Zt,pe,xr;for(V=A(V),ne=V.length,O=d,W=0,yt=u,Ut=0;Ut=O&&ct_((o-W)/Zt)&&w("overflow"),W+=(Mt-O)*Zt,O=Mt,Ut=0;Uto&&w("overflow"),ct==O){for(Wt=W,mt=n;St=mt<=yt?a:mt>=yt+l?l:mt-yt,!(Wt{"use strict";AC.exports=TypeError});var PC=J(()=>{});var Hl=J((Qdt,jC)=>{var Fx=typeof Map=="function"&&Map.prototype,wx=Object.getOwnPropertyDescriptor&&Fx?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Td=Fx&&wx&&typeof wx.get=="function"?wx.get:null,CC=Fx&&Map.prototype.forEach,kx=typeof Set=="function"&&Set.prototype,Ex=Object.getOwnPropertyDescriptor&&kx?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Sd=kx&&Ex&&typeof Ex.get=="function"?Ex.get:null,RC=kx&&Set.prototype.forEach,vG=typeof WeakMap=="function"&&WeakMap.prototype,Ll=vG?WeakMap.prototype.has:null,TG=typeof WeakSet=="function"&&WeakSet.prototype,Dl=TG?WeakSet.prototype.has:null,SG=typeof WeakRef=="function"&&WeakRef.prototype,MC=SG?WeakRef.prototype.deref:null,wG=Boolean.prototype.valueOf,EG=Object.prototype.toString,AG=Function.prototype.toString,PG=String.prototype.match,Gx=String.prototype.slice,Vi=String.prototype.replace,CG=String.prototype.toUpperCase,IC=String.prototype.toLowerCase,NC=RegExp.prototype.test,BC=Array.prototype.concat,zr=Array.prototype.join,RG=Array.prototype.slice,FC=Math.floor,Cx=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ax=Object.getOwnPropertySymbols,Rx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ko=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Nl=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ko||!0)?Symbol.toStringTag:null,HC=Object.prototype.propertyIsEnumerable,kC=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function GC(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||NC.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-FC(-r):FC(r);if(i!==r){var s=String(i),o=Gx.call(t,s.length+1);return Vi.call(s,e,"$&_")+"."+Vi.call(Vi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Vi.call(t,e,"$&_")}var Mx=PC(),UC=Mx.custom,OC=zC(UC)?UC:null,VC={__proto__:null,double:'"',single:"'"},MG={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};jC.exports=function r(t,e,i,s){var o=e||{};if(fi(o,"quoteStyle")&&!fi(VC,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(fi(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=fi(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(fi(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(fi(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return XC(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?GC(t,l):l}if(typeof t=="bigint"){var h=String(t)+"n";return a?GC(t,h):h}var c=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return Ix(t)?"[Array]":"[Object]";var u=YG(o,i);if(typeof s>"u")s=[];else if($C(s,t)>=0)return"[Circular]";function d(F,G,z){if(G&&(s=RG.call(s),s.push(G)),z){var U={depth:o.depth};return fi(o,"quoteStyle")&&(U.quoteStyle=o.quoteStyle),r(F,U,i+1,s)}return r(F,o,i+1,s)}if(typeof t=="function"&&!LC(t)){var f=DG(t),m=vd(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(m.length>0?" { "+zr.call(m,", ")+" }":"")}if(zC(t)){var g=Ko?Vi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Rx.call(t);return typeof t=="object"&&!Ko?Ol(g):g}if($G(t)){for(var p="<"+IC.call(String(t.nodeName)),b=t.attributes||[],y=0;y",p}if(Ix(t)){if(t.length===0)return"[]";var _=vd(t,d);return u&&!jG(_)?"["+Bx(_,u)+"]":"[ "+zr.call(_,", ")+" ]"}if(FG(t)){var S=vd(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!HC.call(t,"cause")?"{ ["+String(t)+"] "+zr.call(BC.call("[cause]: "+d(t.cause),S),", ")+" }":S.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+zr.call(S,", ")+" }"}if(typeof t=="object"&&n){if(OC&&typeof t[OC]=="function"&&Mx)return Mx(t,{depth:c-i});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(NG(t)){var E=[];return CC&&CC.call(t,function(F,G){E.push(d(G,t,!0)+" => "+d(F,t))}),DC("Map",Td.call(t),E,u)}if(WG(t)){var w=[];return RC&&RC.call(t,function(F){w.push(d(F,t))}),DC("Set",Sd.call(t),w,u)}if(HG(t))return Px("WeakMap");if(zG(t))return Px("WeakSet");if(VG(t))return Px("WeakRef");if(GG(t))return Ol(d(Number(t)));if(OG(t))return Ol(d(Cx.call(t)));if(UG(t))return Ol(wG.call(t));if(kG(t))return Ol(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!BG(t)&&!LC(t)){var T=vd(t,d),C=kC?kC(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",P=!C&&Nl&&Object(t)===t&&Nl in t?Gx.call(Wi(t),8,-1):A?"Object":"",R=C||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",I=R+(P||A?"["+zr.call(BC.call([],P||[],A||[]),": ")+"] ":"");return T.length===0?I+"{}":u?I+"{"+Bx(T,u)+"}":I+"{ "+zr.call(T,", ")+" }"}return String(t)};function WC(r,t,e){var i=e.quoteStyle||t,s=VC[i];return s+r+s}function IG(r){return Vi.call(String(r),/"/g,""")}function Ts(r){return!Nl||!(typeof r=="object"&&(Nl in r||typeof r[Nl]<"u"))}function Ix(r){return Wi(r)==="[object Array]"&&Ts(r)}function BG(r){return Wi(r)==="[object Date]"&&Ts(r)}function LC(r){return Wi(r)==="[object RegExp]"&&Ts(r)}function FG(r){return Wi(r)==="[object Error]"&&Ts(r)}function kG(r){return Wi(r)==="[object String]"&&Ts(r)}function GG(r){return Wi(r)==="[object Number]"&&Ts(r)}function UG(r){return Wi(r)==="[object Boolean]"&&Ts(r)}function zC(r){if(Ko)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Rx)return!1;try{return Rx.call(r),!0}catch{}return!1}function OG(r){if(!r||typeof r!="object"||!Cx)return!1;try{return Cx.call(r),!0}catch{}return!1}var LG=Object.prototype.hasOwnProperty||function(r){return r in this};function fi(r,t){return LG.call(r,t)}function Wi(r){return EG.call(r)}function DG(r){if(r.name)return r.name;var t=PG.call(AG.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function $C(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;et.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return XC(Gx.call(r,0,t.maxStringLength),t)+i}var s=MG[t.quoteStyle||"single"];s.lastIndex=0;var o=Vi.call(Vi.call(r,s,"\\$1"),/[\x00-\x1f]/g,XG);return WC(o,"single",t)}function XG(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+CG.call(t.toString(16))}function Ol(r){return"Object("+r+")"}function Px(r){return r+" { ? }"}function DC(r,t,e,i){var s=i?Bx(e,i):zr.call(e,", ");return r+" ("+t+") {"+s+"}"}function jG(r){for(var t=0;t=0)return!1;return!0}function YG(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=zr.call(Array(r.indent+1)," ");else return null;return{base:e,prev:zr.call(Array(t+1),e)}}function Bx(r,t){if(r.length===0)return"";var e=` -`+t.prev+t.base;return e+zr.call(r,","+e)+` -`+t.prev}function vd(r,t){var e=Ix(r),i=[];if(e){i.length=r.length;for(var s=0;s{"use strict";var qG=Hl(),KG=vs(),wd=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},ZG=function(r,t){if(r){var e=wd(r,t);return e&&e.value}},QG=function(r,t,e){var i=wd(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},JG=function(r,t){return r?!!wd(r,t):!1},tU=function(r,t){if(r)return wd(r,t,!0)};YC.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new KG("Side channel does not contain "+qG(i))},delete:function(i){var s=t&&t.next,o=tU(t,i);return o&&s&&s===o&&(t=void 0),!!o},get:function(i){return ZG(t,i)},has:function(i){return JG(t,i)},set:function(i,s){t||(t={next:void 0}),QG(t,i,s)}};return e}});var Ux=J((tft,KC)=>{"use strict";KC.exports=Object});var QC=J((eft,ZC)=>{"use strict";ZC.exports=Error});var tR=J((rft,JC)=>{"use strict";JC.exports=EvalError});var rR=J((ift,eR)=>{"use strict";eR.exports=RangeError});var sR=J((sft,iR)=>{"use strict";iR.exports=ReferenceError});var nR=J((oft,oR)=>{"use strict";oR.exports=SyntaxError});var lR=J((nft,aR)=>{"use strict";aR.exports=URIError});var cR=J((aft,hR)=>{"use strict";hR.exports=Math.abs});var dR=J((lft,uR)=>{"use strict";uR.exports=Math.floor});var pR=J((hft,fR)=>{"use strict";fR.exports=Math.max});var gR=J((cft,mR)=>{"use strict";mR.exports=Math.min});var yR=J((uft,xR)=>{"use strict";xR.exports=Math.pow});var bR=J((dft,_R)=>{"use strict";_R.exports=Math.round});var TR=J((fft,vR)=>{"use strict";vR.exports=Number.isNaN||function(t){return t!==t}});var wR=J((pft,SR)=>{"use strict";var eU=TR();SR.exports=function(t){return eU(t)||t===0?t:t<0?-1:1}});var AR=J((mft,ER)=>{"use strict";ER.exports=Object.getOwnPropertyDescriptor});var Ox=J((gft,PR)=>{"use strict";var Ed=AR();if(Ed)try{Ed([],"length")}catch{Ed=null}PR.exports=Ed});var RR=J((xft,CR)=>{"use strict";var Ad=Object.defineProperty||!1;if(Ad)try{Ad({},"a",{value:1})}catch{Ad=!1}CR.exports=Ad});var IR=J((yft,MR)=>{"use strict";MR.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var kR=J((_ft,FR)=>{"use strict";var BR=typeof Symbol<"u"&&Symbol,rU=IR();FR.exports=function(){return typeof BR!="function"||typeof Symbol!="function"||typeof BR("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:rU()}});var Lx=J((bft,GR)=>{"use strict";GR.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Dx=J((vft,UR)=>{"use strict";var iU=Ux();UR.exports=iU.getPrototypeOf||null});var DR=J((Tft,LR)=>{"use strict";var sU="Function.prototype.bind called on incompatible ",oU=Object.prototype.toString,nU=Math.max,aU="[object Function]",OR=function(t,e){for(var i=[],s=0;s{"use strict";var cU=DR();NR.exports=Function.prototype.bind||cU});var Pd=J((wft,HR)=>{"use strict";HR.exports=Function.prototype.call});var Nx=J((Eft,VR)=>{"use strict";VR.exports=Function.prototype.apply});var zR=J((Aft,WR)=>{"use strict";WR.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var XR=J((Pft,$R)=>{"use strict";var uU=Vl(),dU=Nx(),fU=Pd(),pU=zR();$R.exports=pU||uU.call(fU,dU)});var Hx=J((Cft,jR)=>{"use strict";var mU=Vl(),gU=vs(),xU=Pd(),yU=XR();jR.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new gU("a function is required");return yU(mU,xU,t)}});var JR=J((Rft,QR)=>{"use strict";var _U=Hx(),YR=Ox(),KR;try{KR=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var Vx=!!KR&&YR&&YR(Object.prototype,"__proto__"),ZR=Object,qR=ZR.getPrototypeOf;QR.exports=Vx&&typeof Vx.get=="function"?_U([Vx.get]):typeof qR=="function"?function(t){return qR(t==null?t:ZR(t))}:!1});var sM=J((Mft,iM)=>{"use strict";var tM=Lx(),eM=Dx(),rM=JR();iM.exports=tM?function(t){return tM(t)}:eM?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return eM(t)}:rM?function(t){return rM(t)}:null});var nM=J((Ift,oM)=>{"use strict";var bU=Function.prototype.call,vU=Object.prototype.hasOwnProperty,TU=Vl();oM.exports=TU.call(bU,vU)});var Md=J((Bft,dM)=>{"use strict";var pt,SU=Ux(),wU=QC(),EU=tR(),AU=rR(),PU=sR(),tn=nR(),Jo=vs(),CU=lR(),RU=cR(),MU=dR(),IU=pR(),BU=gR(),FU=yR(),kU=bR(),GU=wR(),cM=Function,Wx=function(r){try{return cM('"use strict"; return ('+r+").constructor;")()}catch{}},Wl=Ox(),UU=RR(),zx=function(){throw new Jo},OU=Wl?function(){try{return arguments.callee,zx}catch{try{return Wl(arguments,"callee").get}catch{return zx}}}():zx,Zo=kR()(),_e=sM(),LU=Dx(),DU=Lx(),uM=Nx(),zl=Pd(),Qo={},NU=typeof Uint8Array>"u"||!_e?pt:_e(Uint8Array),Ss={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?pt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?pt:ArrayBuffer,"%ArrayIteratorPrototype%":Zo&&_e?_e([][Symbol.iterator]()):pt,"%AsyncFromSyncIteratorPrototype%":pt,"%AsyncFunction%":Qo,"%AsyncGenerator%":Qo,"%AsyncGeneratorFunction%":Qo,"%AsyncIteratorPrototype%":Qo,"%Atomics%":typeof Atomics>"u"?pt:Atomics,"%BigInt%":typeof BigInt>"u"?pt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?pt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?pt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?pt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":wU,"%eval%":eval,"%EvalError%":EU,"%Float16Array%":typeof Float16Array>"u"?pt:Float16Array,"%Float32Array%":typeof Float32Array>"u"?pt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?pt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?pt:FinalizationRegistry,"%Function%":cM,"%GeneratorFunction%":Qo,"%Int8Array%":typeof Int8Array>"u"?pt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?pt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?pt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Zo&&_e?_e(_e([][Symbol.iterator]())):pt,"%JSON%":typeof JSON=="object"?JSON:pt,"%Map%":typeof Map>"u"?pt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Zo||!_e?pt:_e(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":SU,"%Object.getOwnPropertyDescriptor%":Wl,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?pt:Promise,"%Proxy%":typeof Proxy>"u"?pt:Proxy,"%RangeError%":AU,"%ReferenceError%":PU,"%Reflect%":typeof Reflect>"u"?pt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?pt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Zo||!_e?pt:_e(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?pt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Zo&&_e?_e(""[Symbol.iterator]()):pt,"%Symbol%":Zo?Symbol:pt,"%SyntaxError%":tn,"%ThrowTypeError%":OU,"%TypedArray%":NU,"%TypeError%":Jo,"%Uint8Array%":typeof Uint8Array>"u"?pt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?pt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?pt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?pt:Uint32Array,"%URIError%":CU,"%WeakMap%":typeof WeakMap>"u"?pt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?pt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?pt:WeakSet,"%Function.prototype.call%":zl,"%Function.prototype.apply%":uM,"%Object.defineProperty%":UU,"%Object.getPrototypeOf%":LU,"%Math.abs%":RU,"%Math.floor%":MU,"%Math.max%":IU,"%Math.min%":BU,"%Math.pow%":FU,"%Math.round%":kU,"%Math.sign%":GU,"%Reflect.getPrototypeOf%":DU};if(_e)try{null.error}catch(r){aM=_e(_e(r)),Ss["%Error.prototype%"]=aM}var aM,HU=function r(t){var e;if(t==="%AsyncFunction%")e=Wx("async function () {}");else if(t==="%GeneratorFunction%")e=Wx("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Wx("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&_e&&(e=_e(s.prototype))}return Ss[t]=e,e},lM={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},$l=Vl(),Cd=nM(),VU=$l.call(zl,Array.prototype.concat),WU=$l.call(uM,Array.prototype.splice),hM=$l.call(zl,String.prototype.replace),Rd=$l.call(zl,String.prototype.slice),zU=$l.call(zl,RegExp.prototype.exec),$U=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,XU=/\\(\\)?/g,jU=function(t){var e=Rd(t,0,1),i=Rd(t,-1);if(e==="%"&&i!=="%")throw new tn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new tn("invalid intrinsic syntax, expected opening `%`");var s=[];return hM(t,$U,function(o,n,a,l){s[s.length]=a?hM(l,XU,"$1"):n||o}),s},YU=function(t,e){var i=t,s;if(Cd(lM,i)&&(s=lM[i],i="%"+s[0]+"%"),Cd(Ss,i)){var o=Ss[i];if(o===Qo&&(o=HU(i)),typeof o>"u"&&!e)throw new Jo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new tn("intrinsic "+t+" does not exist!")};dM.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Jo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Jo('"allowMissing" argument must be a boolean');if(zU(/^%?[^%]*%?$/,t)===null)throw new tn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=jU(t),s=i.length>0?i[0]:"",o=YU("%"+s+"%",e),n=o.name,a=o.value,l=!1,h=o.alias;h&&(s=h[0],WU(i,VU([0,1],h)));for(var c=1,u=!0;c=i.length){var g=Wl(a,d);u=!!g,u&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[d]}else u=Cd(a,d),a=a[d];u&&!l&&(Ss[n]=a)}}return a}});var $x=J((Fft,mM)=>{"use strict";var fM=Md(),pM=Hx(),qU=pM([fM("%String.prototype.indexOf%")]);mM.exports=function(t,e){var i=fM(t,!!e);return typeof i=="function"&&qU(t,".prototype.")>-1?pM([i]):i}});var Xx=J((kft,xM)=>{"use strict";var KU=Md(),Xl=$x(),ZU=Hl(),QU=vs(),gM=KU("%Map%",!0),JU=Xl("Map.prototype.get",!0),tO=Xl("Map.prototype.set",!0),eO=Xl("Map.prototype.has",!0),rO=Xl("Map.prototype.delete",!0),iO=Xl("Map.prototype.size",!0);xM.exports=!!gM&&function(){var t,e={assert:function(i){if(!e.has(i))throw new QU("Side channel does not contain "+ZU(i))},delete:function(i){if(t){var s=rO(t,i);return iO(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return JU(t,i)},has:function(i){return t?eO(t,i):!1},set:function(i,s){t||(t=new gM),tO(t,i,s)}};return e}});var _M=J((Gft,yM)=>{"use strict";var sO=Md(),Bd=$x(),oO=Hl(),Id=Xx(),nO=vs(),en=sO("%WeakMap%",!0),aO=Bd("WeakMap.prototype.get",!0),lO=Bd("WeakMap.prototype.set",!0),hO=Bd("WeakMap.prototype.has",!0),cO=Bd("WeakMap.prototype.delete",!0);yM.exports=en?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new nO("Side channel does not contain "+oO(s))},delete:function(s){if(en&&s&&(typeof s=="object"||typeof s=="function")){if(t)return cO(t,s)}else if(Id&&e)return e.delete(s);return!1},get:function(s){return en&&s&&(typeof s=="object"||typeof s=="function")&&t?aO(t,s):e&&e.get(s)},has:function(s){return en&&s&&(typeof s=="object"||typeof s=="function")&&t?hO(t,s):!!e&&e.has(s)},set:function(s,o){en&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new en),lO(t,s,o)):Id&&(e||(e=Id()),e.set(s,o))}};return i}:Id});var vM=J((Uft,bM)=>{"use strict";var uO=vs(),dO=Hl(),fO=qC(),pO=Xx(),mO=_M(),gO=mO||pO||fO;bM.exports=function(){var t,e={assert:function(i){if(!e.has(i))throw new uO("Side channel does not contain "+dO(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,s){t||(t=gO()),t.set(i,s)}};return e}});var Fd=J((Oft,TM)=>{"use strict";var xO=String.prototype.replace,yO=/%20/g,jx={RFC1738:"RFC1738",RFC3986:"RFC3986"};TM.exports={default:jx.RFC3986,formatters:{RFC1738:function(r){return xO.call(r,yO,"+")},RFC3986:function(r){return String(r)}},RFC1738:jx.RFC1738,RFC3986:jx.RFC3986}});var Kx=J((Lft,wM)=>{"use strict";var _O=Fd(),Yx=Object.prototype.hasOwnProperty,ws=Array.isArray,$r=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),bO=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(ws(i)){for(var s=[],o=0;o=qx?n.slice(l,l+qx):n,c=[],u=0;u=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===_O.RFC1738&&(d===40||d===41)){c[c.length]=h.charAt(u);continue}if(d<128){c[c.length]=$r[d];continue}if(d<2048){c[c.length]=$r[192|d>>6]+$r[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=$r[224|d>>12]+$r[128|d>>6&63]+$r[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|h.charCodeAt(u)&1023),c[c.length]=$r[240|d>>18]+$r[128|d>>12&63]+$r[128|d>>6&63]+$r[128|d&63]}a+=c.join("")}return a},EO=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s{"use strict";var AM=vM(),kd=Kx(),jl=Fd(),MO=Object.prototype.hasOwnProperty,PM={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Xr=Array.isArray,IO=Array.prototype.push,CM=function(r,t){IO.apply(r,Xr(t)?t:[t])},BO=Date.prototype.toISOString,EM=jl.default,de={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:kd.encode,encodeValuesOnly:!1,filter:void 0,format:EM,formatter:jl.formatters[EM],indices:!1,serializeDate:function(t){return BO.call(t)},skipNulls:!1,strictNullHandling:!1},FO=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Zx={},kO=function r(t,e,i,s,o,n,a,l,h,c,u,d,f,m,g,p,b,y){for(var _=t,S=y,E=0,w=!1;(S=S.get(Zx))!==void 0&&!w;){var T=S.get(t);if(E+=1,typeof T<"u"){if(T===E)throw new RangeError("Cyclic object value");w=!0}typeof S.get(Zx)>"u"&&(E=0)}if(typeof c=="function"?_=c(e,_):_ instanceof Date?_=f(_):i==="comma"&&Xr(_)&&(_=kd.maybeMap(_,function(W){return W instanceof Date?f(W):W})),_===null){if(n)return h&&!p?h(e,de.encoder,b,"key",m):e;_=""}if(FO(_)||kd.isBuffer(_)){if(h){var C=p?e:h(e,de.encoder,b,"key",m);return[g(C)+"="+g(h(_,de.encoder,b,"value",m))]}return[g(e)+"="+g(String(_))]}var A=[];if(typeof _>"u")return A;var P;if(i==="comma"&&Xr(_))p&&h&&(_=kd.maybeMap(_,h)),P=[{value:_.length>0?_.join(",")||null:void 0}];else if(Xr(c))P=c;else{var R=Object.keys(_);P=u?R.sort(u):R}var I=l?String(e).replace(/\./g,"%2E"):String(e),F=s&&Xr(_)&&_.length===1?I+"[]":I;if(o&&Xr(_)&&_.length===0)return F+"[]";for(var G=0;G"u"?t.encodeDotInKeys===!0?!0:de.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:de.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:de.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:de.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?de.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:de.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:de.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:de.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:de.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:de.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:de.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:de.strictNullHandling}};RM.exports=function(r,t){var e=r,i=GO(t),s,o;typeof i.filter=="function"?(o=i.filter,e=o("",e)):Xr(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=PM[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var h=AM(),c=0;c0?m+f:""}});var kM=J((Nft,FM)=>{"use strict";var Es=Kx(),Qx=Object.prototype.hasOwnProperty,IM=Array.isArray,Kt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Es.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},UO=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},BM=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},OO="utf8=%26%2310003%3B",LO="utf8=%E2%9C%93",DO=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,h=e.charset;if(e.charsetSentinel)for(l=0;l-1&&(m=IM(m)?[m]:m);var g=Qx.call(i,f);g&&e.duplicates==="combine"?i[f]=Es.combine(i[f],m):(!g||e.duplicates==="last")&&(i[f]=m)}return i},NO=function(r,t,e,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=i?t:BM(t,e,s),a=r.length-1;a>=0;--a){var l,h=r[a];if(h==="[]"&&e.parseArrays)l=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:Es.combine([],n);else{l=e.plainObjects?{__proto__:null}:{};var c=h.charAt(0)==="["&&h.charAt(h.length-1)==="]"?h.slice(1,-1):h,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?l={0:n}:!isNaN(d)&&h!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(l=[],l[d]=n):u!=="__proto__"&&(l[u]=n)}n=l}return n},HO=function(t,e,i,s){if(t){var o=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),h=l?o.slice(0,l.index):o,c=[];if(h){if(!i.plainObjects&&Qx.call(Object.prototype,h)&&!i.allowPrototypes)return;c.push(h)}for(var u=0;i.depth>0&&(l=a.exec(o))!==null&&u"u"?Kt.charset:t.charset,i=typeof t.duplicates>"u"?Kt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Kt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Kt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Kt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Kt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Kt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Kt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Kt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Kt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Kt.decoder,delimiter:typeof t.delimiter=="string"||Es.isRegExp(t.delimiter)?t.delimiter:Kt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Kt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Kt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Kt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Kt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Kt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Kt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};FM.exports=function(r,t){var e=VO(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?DO(r,e):r,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n{"use strict";var WO=MM(),zO=kM(),$O=Fd();GM.exports={formats:$O,parse:zO,stringify:WO}});var NM=J(sn=>{"use strict";var XO=EC();function fr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var jO=/^([a-z0-9.+-]+:)/i,YO=/:[0-9]*$/,qO=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,KO=["<",">",'"',"`"," ","\r",` -`," "],ZO=["{","}","|","\\","^","`"].concat(KO),Jx=["'"].concat(ZO),OM=["%","/","?",";","#"].concat(Jx),LM=["/","?","#"],QO=255,DM=/^[+a-z0-9A-Z_-]{0,63}$/,JO=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,tL={javascript:!0,"javascript:":!0},ty={javascript:!0,"javascript:":!0},rn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},ey=UM();function Yl(r,t,e){if(r&&typeof r=="object"&&r instanceof fr)return r;var i=new fr;return i.parse(r,t,e),i}fr.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i127?E+="x":E+=S[w];if(!E.match(DM)){var C=y.slice(0,f),A=y.slice(f+1),P=S.match(JO);P&&(C.push(P[1]),A.unshift(P[2])),A.length&&(a="/"+A.join(".")+a),this.hostname=C.join(".");break}}}this.hostname.length>QO?this.hostname="":this.hostname=this.hostname.toLowerCase(),b||(this.hostname=XO.toASCII(this.hostname));var R=this.port?":"+this.port:"",I=this.hostname||"";this.host=I+R,this.href+=this.host,b&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!tL[c])for(var f=0,_=Jx.length;f<_;f++){var F=Jx[f];if(a.indexOf(F)!==-1){var G=encodeURIComponent(F);G===F&&(G=escape(F)),a=a.split(F).join(G)}}var z=a.indexOf("#");z!==-1&&(this.hash=a.substr(z),a=a.slice(0,z));var U=a.indexOf("?");if(U!==-1?(this.search=a.substr(U),this.query=a.substr(U+1),t&&(this.query=ey.parse(this.query)),a=a.slice(0,U)):t&&(this.search="",this.query={}),a&&(this.pathname=a),rn[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var R=this.pathname||"",$=this.search||"";this.path=R+$}return this.href=this.format(),this};function eL(r){return typeof r=="string"&&(r=Yl(r)),r instanceof fr?r.format():fr.prototype.format.call(r)}fr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,o="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=ey.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||rn[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+i};function rL(r,t){return Yl(r,!1,!0).resolve(t)}fr.prototype.resolve=function(r){return this.resolveObject(Yl(r,!1,!0)).format()};function iL(r,t){return r?Yl(r,!1,!0).resolveObject(t):t}fr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new fr;t.parse(r,!1,!0),r=t}for(var e=new fr,i=Object.keys(this),s=0;s0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!y.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var w=y.slice(-1)[0],T=(e.host||r.host||y.length>1)&&(w==="."||w==="..")||w==="",C=0,A=y.length;A>=0;A--)w=y[A],w==="."?y.splice(A,1):w===".."?(y.splice(A,1),C++):C&&(y.splice(A,1),C--);if(!p&&!b)for(;C--;C)y.unshift("..");p&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),T&&y.join("/").substr(-1)!=="/"&&y.push("");var P=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(S){e.hostname=P?"":y.length?y.shift():"",e.host=e.hostname;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return p=p||e.host&&y.length,p&&!P&&y.unshift(""),y.length>0?e.pathname=y.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e};fr.prototype.parseHost=function(){var r=this.host,t=YO.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};sn.parse=Yl;sn.resolve=rL;sn.resolveObject=iL;sn.format=eL;sn.Url=fr});var sB=()=>{let r=new Map;return{load:async n=>{let a=[];for(let[l,h]of Object.entries(n))r.has(l)||a.push([l,h]);a.length>0&&await Promise.all(a.map(async([l,h])=>{let d={buffer:await(await fetch(h.url)).arrayBuffer(),type:h.type};r.set(l,d)}))},getBufferMap:()=>{let n={};for(let[a,l]of r.entries())n[a]=l;return n},clear:()=>r.clear(),size:()=>r.size,has:n=>r.has(n)}};B();var bw={extension:{type:v.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(_w(),d2))}};B();var Tw={extension:{type:v.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(vw(),f2))}};B();B();lc();rc();B();Ft();wa();var ru;function Mw(r){return ru!==void 0||(ru=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:r??Ui.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Y.get().getWebGLRenderingContext())return!1;let i=Y.get().createCanvas().getContext("webgl",t),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),ru}Ft();var iu;async function Iw(r={}){return iu!==void 0||(iu=await(async()=>{let t=Y.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),iu}wa();var W1=["webgl","webgpu","canvas"];async function z1(r){let t=[];r.preference?(t.push(r.preference),W1.forEach(o=>{o!==r.preference&&t.push(o)})):t=W1.slice();let e,i={};for(let o=0;o(gA(),mA));e=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&Mw(r.failIfMajorPerformanceCaveat??Ui.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(V1(),H1));e=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(i),s}yr();ag();zt();var $1=class qg{constructor(...t){this.stage=new at,t[0]!==void 0&&j(it,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await z1(t),qg._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return j(it,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let i=qg._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};$1._plugins=[];var _l=$1;L.handleByList(v.Application,_l._plugins);L.add(ka);B();ii();lp();Ft();B();ss();ae();vt();Om();Vm();var bl=class extends Ao{constructor(t,e){super();let{textures:i,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l}=i[n.page],h=new ot(n.x+a.x,n.y+a.y,n.width,n.height),c=new M({source:l,frame:h});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t")?Kg.test(Y.get().parseXML(r)):!1},parse(r){return Kg.parse(Y.get().parseXML(r))}};var j2=[".xml",".fnt"],X1={extension:{type:v.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof bl,getCacheableAssets(r,t){let e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},j1={extension:{type:v.LoadParser,priority:ge.Normal},name:"loadBitmapFont",test(r){return j2.includes(he.extname(r).toLowerCase())},async testParse(r){return Cu.test(r)||Zg.test(r)},async parse(r,t,e){let i=Cu.test(r)?Cu.parse(r):Zg.parse(r),{src:s}=t,{pages:o}=i,n=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;ul[u.src]);return new bl({data:i,textures:h},s)},async load(r,t){return await(await Y.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};Pt();var Ru=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;iArray.isArray(r)&&r.every(t=>t instanceof M),getCacheableAssets:(r,t)=>{let e={};return r.forEach(i=>{t.forEach((s,o)=>{e[i+(o===0?"":o+1)]=s})}),e}};B();async function Mu(r){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var q1={extension:{type:v.DetectionParser,priority:1},test:async()=>Mu("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};B();var K1=["png","jpg","jpeg"],Z1={extension:{type:v.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...K1],remove:async r=>r.filter(t=>!K1.includes(t))};B();var Y2="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function No(r){return Y2?!1:document.createElement("video").canPlayType(r)!==""}var Q1={extension:{type:v.DetectionParser,priority:0},test:async()=>No("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};B();var J1={extension:{type:v.DetectionParser,priority:0},test:async()=>No("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};B();var tP={extension:{type:v.DetectionParser,priority:0},test:async()=>No("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};B();var eP={extension:{type:v.DetectionParser,priority:0},test:async()=>Mu("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};Pt();ss();Vn();ec();var Iu=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||N(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n({alias:[h],src:h,data:{}})),a=n.length,l=n.map(async h=>{let c=he.toAbsolute(h.src);if(!s[h.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,h)),s[h.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[c],delete s[h.src],new Error(`[Loader.load] Failed to load ${c}. -${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=ke(t,s=>({alias:[s],src:s})).map(async s=>{let o=he.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&N(`[Assets] loadParser name conflict "${e.name}"`):N("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Ft();B();function cr(r,t){if(Array.isArray(t)){for(let e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}ss();function ur(r,t){let e=r.split("?")[0],i=he.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}ii();var q2=".json",K2="application/json",rP={extension:{type:v.LoadParser,priority:ge.Low},name:"loadJson",test(r){return cr(r,K2)||ur(r,q2)},async load(r){return await(await Y.get().fetch(r)).json()}};Ft();B();ii();var Z2=".txt",Q2="text/plain",iP={name:"loadTxt",extension:{type:v.LoadParser,priority:ge.Low,name:"loadTxt"},test(r){return cr(r,Q2)||ur(r,Z2)},async load(r){return await(await Y.get().fetch(r)).text()}};Ft();B();Pt();ss();Ci();ii();var J2=["normal","bold","100","200","300","400","500","600","700","800","900"],tk=[".ttf",".otf",".woff",".woff2"],ek=["font/ttf","font/otf","font/woff","font/woff2"],rk=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function ik(r){let t=he.extname(r),s=he.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(rk)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var sk=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function ok(r){return sk.test(r)?r:encodeURI(r)}var sP={extension:{type:v.LoadParser,priority:ge.Low},name:"loadWebFont",test(r){return cr(r,ek)||ur(r,tk)},async load(r,t){let e=Y.get().getFontFaceSet();if(e){let i=[],s=t.data?.family??ik(r),o=t.data?.weights?.filter(a=>J2.includes(a))??["normal"],n=t.data??{};for(let a=0;a{Tt.remove(`${t.family}-and-url`),Y.get().getFontFaceSet().delete(t)})}};Ft();B();eo();Hc();Js();function Ho(r,t=1){let e=Ke.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}ii();vt();Pt();Ci();function Vo(r,t,e){r.label=e,r._sourceOrigin=e;let i=new M({source:r,label:e}),s=()=>{delete t.promiseCache[e],Tt.has(e)&&Tt.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(N("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),i.once("destroy",()=>{r.destroyed||(N("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var nk=".svg",ak="image/svg+xml",oP={extension:{type:v.LoadParser,priority:ge.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return cr(r,ak)||ur(r,nk)},async load(r,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?hk(r):lk(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function lk(r,t,e,i){let o=await(await Y.get().fetch(r)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=i,await a.decode(),URL.revokeObjectURL(n);let l=document.createElement("canvas"),h=l.getContext("2d"),c=t.data?.resolution||Ho(r),u=t.data?.width??a.width,d=t.data?.height??a.height;l.width=u*c,l.height=d*c,h.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...m}=t.data??{},g=new Ve({resource:l,alphaMode:"premultiply-alpha-on-upload",resolution:c,...m});return Vo(g,e,r)}async function hk(r){let e=await(await Y.get().fetch(r)).text(),i=new Ue;return i.svg(e),i}Ft();B();eo();var ck=`(function () { + ${a};`)}}return new Function("ud","uv","renderer","syncData",t.join(` +`))}var eC=y(()=>{rd();It();Vx();QP()});var tc,tC=y(()=>{U();eC();tc=class{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,i){let s=this._renderer.shader._getProgramData(t);(!e.isStatic||e._dirtyId!==s.uniformDirtyGroups[e.uid])&&(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,t)(s.uniformData,e.uniforms,this._renderer,i))}_getUniformSyncFunction(e,t){return this._uniformGroupSyncHash[e._signature]?.[t._key]||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){let i=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,t._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,t._uniformData)),i[t._key]=this._cache[s],i[t._key]}_generateUniformsSync(e,t){return JP(e,t)}_getSignature(e,t,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),t[n]&&o.push(t[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};tc.extension={type:[S.WebGLSystem],name:"uniformGroup"}});function rC(r){let e={};if(e.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e.add=[r.ONE,r.ONE],e.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof j.get().getWebGLRenderingContext()))e.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],e.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(e.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],e.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return e}var iC=y(()=>{Re()});var RU,IU,BU,kU,FU,OU,sC,oC,nC=y(()=>{U();Rr();iC();RU=0,IU=1,BU=2,kU=3,FU=4,OU=5,sC=class cy{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[RU]=this.setBlend,this.map[IU]=this.setOffset,this.map[BU]=this.setCullFace,this.map[kU]=this.setDepthTest,this.map[FU]=this.setFrontFace,this.map[OU]=this.setDepthMask,this.checks=[],this.defaultState=Je.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=rC(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<>=1,i++;this.stateId=e.data}for(let t=0;t{ey();xd=class{constructor(e){this.target=Jx.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=ye.UNSIGNED_BYTE,this.internalFormat=ud.RGBA,this.format=ud.RGBA,this.samplerType=0}}});var lC,cC=y(()=>{"use strict";lC={id:"buffer",upload(r,e,t){e.width===r.width||e.height===r.height?t.texSubImage2D(t.TEXTURE_2D,0,0,0,r.width,r.height,e.format,e.type,r.resource):t.texImage2D(e.target,0,e.internalFormat,r.width,r.height,0,e.format,e.type,r.resource),e.width=r.width,e.height=r.height}}});var UU,uC,hC=y(()=>{"use strict";UU={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},uC={id:"compressed",upload(r,e,t){t.pixelStorei(t.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!UU[r.format];for(let n=0;n>1,1),s=Math.max(s>>1,1)}}}});var yd,uy=y(()=>{"use strict";yd={id:"image",upload(r,e,t,i){let s=e.width,o=e.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l{uy();dC={id:"video",upload(r,e,t,i){if(!r.isValid){t.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}yd.upload(r,e,t,i)}}});var hy,pC,_d,mC,gC=y(()=>{"use strict";hy={linear:9729,nearest:9728},pC={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},_d={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},mC={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function dy(r,e,t,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let c=_d[n?"clamp-to-edge":r.addressModeU],u=_d[n?"clamp-to-edge":r.addressModeV],h=_d[n?"clamp-to-edge":r.addressModeW];e[s](l,e.TEXTURE_WRAP_S,c),e[s](l,e.TEXTURE_WRAP_T,u),e.TEXTURE_WRAP_R&&e[s](l,e.TEXTURE_WRAP_R,h)}if((!a||r.magFilter!=="linear")&&e[s](l,e.TEXTURE_MAG_FILTER,hy[r.magFilter]),t){if(!a||r.mipmapFilter!=="linear"){let c=pC[r.minFilter][r.mipmapFilter];e[s](l,e.TEXTURE_MIN_FILTER,c)}}else e[s](l,e.TEXTURE_MIN_FILTER,hy[r.minFilter]);if(i&&r.maxAnisotropy>1){let c=Math.min(r.maxAnisotropy,e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,c)}r.compare&&e[s](l,e.TEXTURE_COMPARE_FUNC,mC[r.compare])}var xC=y(()=>{gC()});function yC(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var _C=y(()=>{"use strict"});function bC(r,e){let t={},i=r.RGBA;return r instanceof j.get().getWebGLRenderingContext()?e.srgb&&(t={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(t={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...t,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var vC=y(()=>{Re()});function TC(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var SC=y(()=>{"use strict"});var GU,rc,wC=y(()=>{Re();U();ve();aC();cC();hC();uy();fC();xC();_C();vC();SC();GU=4,rc=class{constructor(e){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:yd,buffer:lC,video:dC,compressed:uC},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=bC(e,this._renderer.context.extensions),this._mapFormatToType=TC(e),this._mapFormatToFormat=yC(e)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let t=0;t<16;t++)this.bind(k.EMPTY,t)}initSource(e){this.bind(e)}bind(e,t=0){let i=e.source;e?(this.bindSource(i,t),this._useSeparateSamplers&&this._bindSampler(i.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){let i=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[t]!==e){this._boundTextures[t]=e,this._activateLocation(t),e||(e=k.EMPTY.source);let s=this.getGlSource(e);i.bindTexture(s.target,s.texture)}}_bindSampler(e,t=0){let i=this._gl;if(!e){this._boundSamplers[t]=null,i.bindSampler(t,null);return}let s=this._getGlSampler(e);this._boundSamplers[t]!==s&&(this._boundSamplers[t]=s,i.bindSampler(t,s))}unbind(e){let t=e.source,i=this._boundTextures,s=this._gl;for(let o=0;o1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e){let t=this._glTextures[e.uid];t&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(t.texture))}onSourceUpdate(e){let t=this._gl,i=this.getGlSource(e);t.bindTexture(t.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=e;let s=e.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,i,t,this._renderer.context.webGLVersion):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.pixelWidth,e.pixelHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&this.bindSource(e,0);let i=this.getGlSource(e);this._gl.generateMipmap(i.target)}onSourceDestroy(e){e.off("destroy",this.onSourceDestroy,this),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}_initSampler(e){let t=this._gl,i=this._gl.createSampler();return this._glSamplers[e._resourceId]=i,dy(e,t,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return this._glTextures[e.uid]||this._initSource(e)}generateCanvas(e){let{pixels:t,width:i,height:s}=this.getPixels(e),o=j.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(t),n.putImageData(a,0,0)}return o}getPixels(e){let t=e.source.resolution,i=e.frame,s=Math.max(Math.round(i.width*t),1),o=Math.max(Math.round(i.height*t),1),n=new Uint8Array(GU*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(e),c=a.renderTarget.getGpuRenderTarget(l),u=a.gl;return u.bindFramebuffer(u.FRAMEBUFFER,c.resolveTargetFramebuffer),u.readPixels(Math.round(i.x*t),Math.round(i.y*t),s,o,u.RGBA,u.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(k.EMPTY.source),this._boundSamplers=Object.create(null);let e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};rc.extension={type:[S.WebGLSystem],name:"texture"}});var CC={};Ub(CC,{WebGLRenderer:()=>fy});var LU,DU,NU,EC,AC,PC,fy,MC=y(()=>{U();sP();oP();nP();ll();Dx();jr();cP();dP();gP();_P();bP();vP();TP();CP();IP();qP();tC();nC();wC();LU=[...Jh,Ql,yP,hP,jl,rc,Jl,Yl,tc,ec,Kl,oC,Zl,ql],DU=[...ed],NU=[$l,zl,Wl],EC=[],AC=[],PC=[];V.handleByNamedList(S.WebGLSystem,EC);V.handleByNamedList(S.WebGLPipes,AC);V.handleByNamedList(S.WebGLPipesAdaptor,PC);V.add(...LU,...DU,...NU);fy=class extends qi{constructor(){let e={name:"webgl",type:ot.WEBGL,systems:EC,renderPipes:AC,renderPipeAdaptors:PC};super(e)}}});var xI=ee((y_e,u_)=>{"use strict";var eN=Object.prototype.hasOwnProperty,zt="~";function Ec(){}Object.create&&(Ec.prototype=Object.create(null),new Ec().__proto__||(zt=!1));function tN(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function gI(r,e,t,i,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new tN(t,i||r,s),n=zt?zt+e:e;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Nf(r,e){--r._eventsCount===0?r._events=new Ec:delete r._events[e]}function kt(){this._events=new Ec,this._eventsCount=0}kt.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)eN.call(t,i)&&e.push(zt?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};kt.prototype.listeners=function(e){var t=zt?zt+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s{(function(r){var e=typeof kn=="object"&&kn&&!kn.nodeType&&kn,t=typeof Fn=="object"&&Fn&&!Fn.nodeType&&Fn,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,l=26,c=38,u=700,h=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=n-a,x=Math.floor,T=String.fromCharCode,b;function w(N){throw new RangeError(_[N])}function E(N,L){for(var Y=N.length,ue=[];Y--;)ue[Y]=L(N[Y]);return ue}function I(N,L){var Y=N.split("@"),ue="";Y.length>1&&(ue=Y[0]+"@",N=Y[1]),N=N.replace(g,".");var J=N.split("."),Be=E(J,L).join(".");return ue+Be}function B(N){for(var L=[],Y=0,ue=N.length,J,Be;Y=55296&&J<=56319&&Y65535&&(L-=65536,Y+=T(L>>>10&1023|55296),L=56320|L&1023),Y+=T(L),Y}).join("")}function A(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:n}function P(N,L){return N+22+75*(N<26)-((L!=0)<<5)}function R(N,L,Y){var ue=0;for(N=Y?x(N/u):N>>1,N+=x(N/L);N>v*l>>1;ue+=n)N=x(N/v);return x(ue+(v+1)*N/(N+c))}function M(N){var L=[],Y=N.length,ue,J=0,Be=d,ke=h,Me,$e,it,bt,Le,vt,Ft,Pt,Ot;for(Me=N.lastIndexOf(f),Me<0&&(Me=0),$e=0;$e=128&&w("not-basic"),L.push(N.charCodeAt($e));for(it=Me>0?Me+1:0;it=Y&&w("invalid-input"),Ft=A(N.charCodeAt(it++)),(Ft>=n||Ft>x((o-J)/Le))&&w("overflow"),J+=Ft*Le,Pt=vt<=ke?a:vt>=ke+l?l:vt-ke,!(Ftx(o/Ot)&&w("overflow"),Le*=Ot;ue=L.length+1,ke=R(J-bt,ue,bt==0),x(J/ue)>o-Be&&w("overflow"),Be+=x(J/ue),J%=ue,L.splice(J++,0,Be)}return C(L)}function F(N){var L,Y,ue,J,Be,ke,Me,$e,it,bt,Le,vt=[],Ft,Pt,Ot,Ar;for(N=B(N),Ft=N.length,L=d,Y=0,Be=h,ke=0;ke=L&&Lex((o-Y)/Pt)&&w("overflow"),Y+=(Me-L)*Pt,L=Me,ke=0;keo&&w("overflow"),Le==L){for($e=Y,it=n;bt=it<=Be?a:it>=Be+l?l:it-Be,!($e{"use strict";_I.exports=TypeError});var bI=ee(()=>{});var Rc=ee((T_e,NI)=>{var b_=typeof Map=="function"&&Map.prototype,h_=Object.getOwnPropertyDescriptor&&b_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Vf=b_&&h_&&typeof h_.get=="function"?h_.get:null,vI=b_&&Map.prototype.forEach,v_=typeof Set=="function"&&Set.prototype,d_=Object.getOwnPropertyDescriptor&&v_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Wf=v_&&d_&&typeof d_.get=="function"?d_.get:null,TI=v_&&Set.prototype.forEach,rN=typeof WeakMap=="function"&&WeakMap.prototype,Pc=rN?WeakMap.prototype.has:null,iN=typeof WeakSet=="function"&&WeakSet.prototype,Cc=iN?WeakSet.prototype.has:null,sN=typeof WeakRef=="function"&&WeakRef.prototype,SI=sN?WeakRef.prototype.deref:null,oN=Boolean.prototype.valueOf,nN=Object.prototype.toString,aN=Function.prototype.toString,lN=String.prototype.match,T_=String.prototype.slice,as=String.prototype.replace,cN=String.prototype.toUpperCase,wI=String.prototype.toLowerCase,kI=RegExp.prototype.test,EI=Array.prototype.concat,ti=Array.prototype.join,uN=Array.prototype.slice,AI=Math.floor,m_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,f_=Object.getOwnPropertySymbols,g_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,On=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Mc=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===On||!0)?Symbol.toStringTag:null,FI=Object.prototype.propertyIsEnumerable,PI=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function CI(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||kI.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-AI(-r):AI(r);if(i!==r){var s=String(i),o=T_.call(e,s.length+1);return as.call(s,t,"$&_")+"."+as.call(as.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return as.call(e,t,"$&_")}var x_=bI(),MI=x_.custom,RI=GI(MI)?MI:null,OI={__proto__:null,double:'"',single:"'"},hN={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};NI.exports=function r(e,t,i,s){var o=t||{};if(Ei(o,"quoteStyle")&&!Ei(OI,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ei(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=Ei(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ei(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ei(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return DI(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?CI(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return a?CI(e,c):c}var u=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof e=="object")return y_(e)?"[Array]":"[Object]";var h=MN(o,i);if(typeof s>"u")s=[];else if(LI(s,e)>=0)return"[Circular]";function d(R,M,F){if(M&&(s=uN.call(s),s.push(M)),F){var O={depth:o.depth};return Ei(o,"quoteStyle")&&(O.quoteStyle=o.quoteStyle),r(R,O,i+1,s)}return r(R,o,i+1,s)}if(typeof e=="function"&&!II(e)){var f=bN(e),p=Hf(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+ti.call(p,", ")+" }":"")}if(GI(e)){var m=On?as.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):g_.call(e);return typeof e=="object"&&!On?Ac(m):m}if(AN(e)){for(var g="<"+wI.call(String(e.nodeName)),_=e.attributes||[],v=0;v<_.length;v++)g+=" "+_[v].name+"="+UI(dN(_[v].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="",g}if(y_(e)){if(e.length===0)return"[]";var x=Hf(e,d);return h&&!CN(x)?"["+__(x,h)+"]":"[ "+ti.call(x,", ")+" ]"}if(pN(e)){var T=Hf(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!FI.call(e,"cause")?"{ ["+String(e)+"] "+ti.call(EI.call("[cause]: "+d(e.cause),T),", ")+" }":T.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ti.call(T,", ")+" }"}if(typeof e=="object"&&n){if(RI&&typeof e[RI]=="function"&&x_)return x_(e,{depth:u-i});if(n!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(vN(e)){var b=[];return vI&&vI.call(e,function(R,M){b.push(d(M,e,!0)+" => "+d(R,e))}),BI("Map",Vf.call(e),b,h)}if(wN(e)){var w=[];return TI&&TI.call(e,function(R){w.push(d(R,e))}),BI("Set",Wf.call(e),w,h)}if(TN(e))return p_("WeakMap");if(EN(e))return p_("WeakSet");if(SN(e))return p_("WeakRef");if(gN(e))return Ac(d(Number(e)));if(yN(e))return Ac(d(m_.call(e)));if(xN(e))return Ac(oN.call(e));if(mN(e))return Ac(d(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof global<"u"&&e===global)return"{ [object globalThis] }";if(!fN(e)&&!II(e)){var E=Hf(e,d),I=PI?PI(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",C=!I&&Mc&&Object(e)===e&&Mc in e?T_.call(ls(e),8,-1):B?"Object":"",A=I||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",P=A+(C||B?"["+ti.call(EI.call([],C||[],B||[]),": ")+"] ":"");return E.length===0?P+"{}":h?P+"{"+__(E,h)+"}":P+"{ "+ti.call(E,", ")+" }"}return String(e)};function UI(r,e,t){var i=t.quoteStyle||e,s=OI[i];return s+r+s}function dN(r){return as.call(String(r),/"/g,""")}function Xs(r){return!Mc||!(typeof r=="object"&&(Mc in r||typeof r[Mc]<"u"))}function y_(r){return ls(r)==="[object Array]"&&Xs(r)}function fN(r){return ls(r)==="[object Date]"&&Xs(r)}function II(r){return ls(r)==="[object RegExp]"&&Xs(r)}function pN(r){return ls(r)==="[object Error]"&&Xs(r)}function mN(r){return ls(r)==="[object String]"&&Xs(r)}function gN(r){return ls(r)==="[object Number]"&&Xs(r)}function xN(r){return ls(r)==="[object Boolean]"&&Xs(r)}function GI(r){if(On)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!g_)return!1;try{return g_.call(r),!0}catch{}return!1}function yN(r){if(!r||typeof r!="object"||!m_)return!1;try{return m_.call(r),!0}catch{}return!1}var _N=Object.prototype.hasOwnProperty||function(r){return r in this};function Ei(r,e){return _N.call(r,e)}function ls(r){return nN.call(r)}function bN(r){if(r.name)return r.name;var e=lN.call(aN.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function LI(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return DI(T_.call(r,0,e.maxStringLength),e)+i}var s=hN[e.quoteStyle||"single"];s.lastIndex=0;var o=as.call(as.call(r,s,"\\$1"),/[\x00-\x1f]/g,PN);return UI(o,"single",e)}function PN(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+cN.call(e.toString(16))}function Ac(r){return"Object("+r+")"}function p_(r){return r+" { ? }"}function BI(r,e,t,i){var s=i?__(t,i):ti.call(t,", ");return r+" ("+e+") {"+s+"}"}function CN(r){for(var e=0;e=0)return!1;return!0}function MN(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=ti.call(Array(r.indent+1)," ");else return null;return{base:t,prev:ti.call(Array(e+1),t)}}function __(r,e){if(r.length===0)return"";var t=` +`+e.prev+e.base;return t+ti.call(r,","+t)+` +`+e.prev}function Hf(r,e){var t=y_(r),i=[];if(t){i.length=r.length;for(var s=0;s{"use strict";var RN=Rc(),IN=$s(),zf=function(r,e,t){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===e)return i.next=s.next,t||(s.next=r.next,r.next=s),s},BN=function(r,e){if(r){var t=zf(r,e);return t&&t.value}},kN=function(r,e,t){var i=zf(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},FN=function(r,e){return r?!!zf(r,e):!1},ON=function(r,e){if(r)return zf(r,e,!0)};HI.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new IN("Side channel does not contain "+RN(i))},delete:function(i){var s=e&&e.next,o=ON(e,i);return o&&s&&s===o&&(e=void 0),!!o},get:function(i){return BN(e,i)},has:function(i){return FN(e,i)},set:function(i,s){e||(e={next:void 0}),kN(e,i,s)}};return t}});var S_=ee((w_e,WI)=>{"use strict";WI.exports=Object});var $I=ee((E_e,zI)=>{"use strict";zI.exports=Error});var jI=ee((A_e,XI)=>{"use strict";XI.exports=EvalError});var qI=ee((P_e,YI)=>{"use strict";YI.exports=RangeError});var ZI=ee((C_e,KI)=>{"use strict";KI.exports=ReferenceError});var JI=ee((M_e,QI)=>{"use strict";QI.exports=SyntaxError});var tB=ee((R_e,eB)=>{"use strict";eB.exports=URIError});var iB=ee((I_e,rB)=>{"use strict";rB.exports=Math.abs});var oB=ee((B_e,sB)=>{"use strict";sB.exports=Math.floor});var aB=ee((k_e,nB)=>{"use strict";nB.exports=Math.max});var cB=ee((F_e,lB)=>{"use strict";lB.exports=Math.min});var hB=ee((O_e,uB)=>{"use strict";uB.exports=Math.pow});var fB=ee((U_e,dB)=>{"use strict";dB.exports=Math.round});var mB=ee((G_e,pB)=>{"use strict";pB.exports=Number.isNaN||function(e){return e!==e}});var xB=ee((L_e,gB)=>{"use strict";var UN=mB();gB.exports=function(e){return UN(e)||e===0?e:e<0?-1:1}});var _B=ee((D_e,yB)=>{"use strict";yB.exports=Object.getOwnPropertyDescriptor});var w_=ee((N_e,bB)=>{"use strict";var $f=_B();if($f)try{$f([],"length")}catch{$f=null}bB.exports=$f});var TB=ee((H_e,vB)=>{"use strict";var Xf=Object.defineProperty||!1;if(Xf)try{Xf({},"a",{value:1})}catch{Xf=!1}vB.exports=Xf});var wB=ee((V_e,SB)=>{"use strict";SB.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;e[t]=s;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var n=Object.getOwnPropertySymbols(e);if(n.length!==1||n[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var PB=ee((W_e,AB)=>{"use strict";var EB=typeof Symbol<"u"&&Symbol,GN=wB();AB.exports=function(){return typeof EB!="function"||typeof Symbol!="function"||typeof EB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:GN()}});var E_=ee((z_e,CB)=>{"use strict";CB.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var A_=ee(($_e,MB)=>{"use strict";var LN=S_();MB.exports=LN.getPrototypeOf||null});var BB=ee((X_e,IB)=>{"use strict";var DN="Function.prototype.bind called on incompatible ",NN=Object.prototype.toString,HN=Math.max,VN="[object Function]",RB=function(e,t){for(var i=[],s=0;s{"use strict";var $N=BB();kB.exports=Function.prototype.bind||$N});var jf=ee((Y_e,FB)=>{"use strict";FB.exports=Function.prototype.call});var P_=ee((q_e,OB)=>{"use strict";OB.exports=Function.prototype.apply});var GB=ee((K_e,UB)=>{"use strict";UB.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var DB=ee((Z_e,LB)=>{"use strict";var XN=Ic(),jN=P_(),YN=jf(),qN=GB();LB.exports=qN||XN.call(YN,jN)});var C_=ee((Q_e,NB)=>{"use strict";var KN=Ic(),ZN=$s(),QN=jf(),JN=DB();NB.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new ZN("a function is required");return JN(KN,QN,e)}});var XB=ee((J_e,$B)=>{"use strict";var e3=C_(),HB=w_(),WB;try{WB=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var M_=!!WB&&HB&&HB(Object.prototype,"__proto__"),zB=Object,VB=zB.getPrototypeOf;$B.exports=M_&&typeof M_.get=="function"?e3([M_.get]):typeof VB=="function"?function(e){return VB(e==null?e:zB(e))}:!1});var ZB=ee((ebe,KB)=>{"use strict";var jB=E_(),YB=A_(),qB=XB();KB.exports=jB?function(e){return jB(e)}:YB?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return YB(e)}:qB?function(e){return qB(e)}:null});var JB=ee((tbe,QB)=>{"use strict";var t3=Function.prototype.call,r3=Object.prototype.hasOwnProperty,i3=Ic();QB.exports=i3.call(t3,r3)});var Kf=ee((rbe,ok)=>{"use strict";var me,s3=S_(),o3=$I(),n3=jI(),a3=qI(),l3=ZI(),Dn=JI(),Ln=$s(),c3=tB(),u3=iB(),h3=oB(),d3=aB(),f3=cB(),p3=hB(),m3=fB(),g3=xB(),ik=Function,R_=function(r){try{return ik('"use strict"; return ('+r+").constructor;")()}catch{}},Bc=w_(),x3=TB(),I_=function(){throw new Ln},y3=Bc?function(){try{return arguments.callee,I_}catch{try{return Bc(arguments,"callee").get}catch{return I_}}}():I_,Un=PB()(),_t=ZB(),_3=A_(),b3=E_(),sk=P_(),kc=jf(),Gn={},v3=typeof Uint8Array>"u"||!_t?me:_t(Uint8Array),js={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?me:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?me:ArrayBuffer,"%ArrayIteratorPrototype%":Un&&_t?_t([][Symbol.iterator]()):me,"%AsyncFromSyncIteratorPrototype%":me,"%AsyncFunction%":Gn,"%AsyncGenerator%":Gn,"%AsyncGeneratorFunction%":Gn,"%AsyncIteratorPrototype%":Gn,"%Atomics%":typeof Atomics>"u"?me:Atomics,"%BigInt%":typeof BigInt>"u"?me:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?me:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?me:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?me:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o3,"%eval%":eval,"%EvalError%":n3,"%Float16Array%":typeof Float16Array>"u"?me:Float16Array,"%Float32Array%":typeof Float32Array>"u"?me:Float32Array,"%Float64Array%":typeof Float64Array>"u"?me:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?me:FinalizationRegistry,"%Function%":ik,"%GeneratorFunction%":Gn,"%Int8Array%":typeof Int8Array>"u"?me:Int8Array,"%Int16Array%":typeof Int16Array>"u"?me:Int16Array,"%Int32Array%":typeof Int32Array>"u"?me:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Un&&_t?_t(_t([][Symbol.iterator]())):me,"%JSON%":typeof JSON=="object"?JSON:me,"%Map%":typeof Map>"u"?me:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Un||!_t?me:_t(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":s3,"%Object.getOwnPropertyDescriptor%":Bc,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?me:Promise,"%Proxy%":typeof Proxy>"u"?me:Proxy,"%RangeError%":a3,"%ReferenceError%":l3,"%Reflect%":typeof Reflect>"u"?me:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?me:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Un||!_t?me:_t(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?me:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Un&&_t?_t(""[Symbol.iterator]()):me,"%Symbol%":Un?Symbol:me,"%SyntaxError%":Dn,"%ThrowTypeError%":y3,"%TypedArray%":v3,"%TypeError%":Ln,"%Uint8Array%":typeof Uint8Array>"u"?me:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?me:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?me:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?me:Uint32Array,"%URIError%":c3,"%WeakMap%":typeof WeakMap>"u"?me:WeakMap,"%WeakRef%":typeof WeakRef>"u"?me:WeakRef,"%WeakSet%":typeof WeakSet>"u"?me:WeakSet,"%Function.prototype.call%":kc,"%Function.prototype.apply%":sk,"%Object.defineProperty%":x3,"%Object.getPrototypeOf%":_3,"%Math.abs%":u3,"%Math.floor%":h3,"%Math.max%":d3,"%Math.min%":f3,"%Math.pow%":p3,"%Math.round%":m3,"%Math.sign%":g3,"%Reflect.getPrototypeOf%":b3};if(_t)try{null.error}catch(r){ek=_t(_t(r)),js["%Error.prototype%"]=ek}var ek,T3=function r(e){var t;if(e==="%AsyncFunction%")t=R_("async function () {}");else if(e==="%GeneratorFunction%")t=R_("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=R_("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&_t&&(t=_t(s.prototype))}return js[e]=t,t},tk={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Fc=Ic(),Yf=JB(),S3=Fc.call(kc,Array.prototype.concat),w3=Fc.call(sk,Array.prototype.splice),rk=Fc.call(kc,String.prototype.replace),qf=Fc.call(kc,String.prototype.slice),E3=Fc.call(kc,RegExp.prototype.exec),A3=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P3=/\\(\\)?/g,C3=function(e){var t=qf(e,0,1),i=qf(e,-1);if(t==="%"&&i!=="%")throw new Dn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Dn("invalid intrinsic syntax, expected opening `%`");var s=[];return rk(e,A3,function(o,n,a,l){s[s.length]=a?rk(l,P3,"$1"):n||o}),s},M3=function(e,t){var i=e,s;if(Yf(tk,i)&&(s=tk[i],i="%"+s[0]+"%"),Yf(js,i)){var o=js[i];if(o===Gn&&(o=T3(i)),typeof o>"u"&&!t)throw new Ln("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new Dn("intrinsic "+e+" does not exist!")};ok.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Ln("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Ln('"allowMissing" argument must be a boolean');if(E3(/^%?[^%]*%?$/,e)===null)throw new Dn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=C3(e),s=i.length>0?i[0]:"",o=M3("%"+s+"%",t),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],w3(i,S3([0,1],c)));for(var u=1,h=!0;u=i.length){var m=Bc(a,d);h=!!m,h&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else h=Yf(a,d),a=a[d];h&&!l&&(js[n]=a)}}return a}});var B_=ee((ibe,lk)=>{"use strict";var nk=Kf(),ak=C_(),R3=ak([nk("%String.prototype.indexOf%")]);lk.exports=function(e,t){var i=nk(e,!!t);return typeof i=="function"&&R3(e,".prototype.")>-1?ak([i]):i}});var k_=ee((sbe,uk)=>{"use strict";var I3=Kf(),Oc=B_(),B3=Rc(),k3=$s(),ck=I3("%Map%",!0),F3=Oc("Map.prototype.get",!0),O3=Oc("Map.prototype.set",!0),U3=Oc("Map.prototype.has",!0),G3=Oc("Map.prototype.delete",!0),L3=Oc("Map.prototype.size",!0);uk.exports=!!ck&&function(){var e,t={assert:function(i){if(!t.has(i))throw new k3("Side channel does not contain "+B3(i))},delete:function(i){if(e){var s=G3(e,i);return L3(e)===0&&(e=void 0),s}return!1},get:function(i){if(e)return F3(e,i)},has:function(i){return e?U3(e,i):!1},set:function(i,s){e||(e=new ck),O3(e,i,s)}};return t}});var dk=ee((obe,hk)=>{"use strict";var D3=Kf(),Qf=B_(),N3=Rc(),Zf=k_(),H3=$s(),Nn=D3("%WeakMap%",!0),V3=Qf("WeakMap.prototype.get",!0),W3=Qf("WeakMap.prototype.set",!0),z3=Qf("WeakMap.prototype.has",!0),$3=Qf("WeakMap.prototype.delete",!0);hk.exports=Nn?function(){var e,t,i={assert:function(s){if(!i.has(s))throw new H3("Side channel does not contain "+N3(s))},delete:function(s){if(Nn&&s&&(typeof s=="object"||typeof s=="function")){if(e)return $3(e,s)}else if(Zf&&t)return t.delete(s);return!1},get:function(s){return Nn&&s&&(typeof s=="object"||typeof s=="function")&&e?V3(e,s):t&&t.get(s)},has:function(s){return Nn&&s&&(typeof s=="object"||typeof s=="function")&&e?z3(e,s):!!t&&t.has(s)},set:function(s,o){Nn&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Nn),W3(e,s,o)):Zf&&(t||(t=Zf()),t.set(s,o))}};return i}:Zf});var pk=ee((nbe,fk)=>{"use strict";var X3=$s(),j3=Rc(),Y3=VI(),q3=k_(),K3=dk(),Z3=K3||q3||Y3;fk.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new X3("Side channel does not contain "+j3(i))},delete:function(i){return!!e&&e.delete(i)},get:function(i){return e&&e.get(i)},has:function(i){return!!e&&e.has(i)},set:function(i,s){e||(e=Z3()),e.set(i,s)}};return t}});var Jf=ee((abe,mk)=>{"use strict";var Q3=String.prototype.replace,J3=/%20/g,F_={RFC1738:"RFC1738",RFC3986:"RFC3986"};mk.exports={default:F_.RFC3986,formatters:{RFC1738:function(r){return Q3.call(r,J3,"+")},RFC3986:function(r){return String(r)}},RFC1738:F_.RFC1738,RFC3986:F_.RFC3986}});var G_=ee((lbe,xk)=>{"use strict";var eH=Jf(),O_=Object.prototype.hasOwnProperty,Ys=Array.isArray,ri=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),tH=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(Ys(i)){for(var s=[],o=0;o=U_?n.slice(l,l+U_):n,u=[],h=0;h=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===eH.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(h);continue}if(d<128){u[u.length]=ri[d];continue}if(d<2048){u[u.length]=ri[192|d>>6]+ri[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=ri[224|d>>12]+ri[128|d>>6&63]+ri[128|d&63];continue}h+=1,d=65536+((d&1023)<<10|c.charCodeAt(h)&1023),u[u.length]=ri[240|d>>18]+ri[128|d>>12&63]+ri[128|d>>6&63]+ri[128|d&63]}a+=u.join("")}return a},nH=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],s=0;s{"use strict";var _k=pk(),ep=G_(),Uc=Jf(),hH=Object.prototype.hasOwnProperty,bk={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ii=Array.isArray,dH=Array.prototype.push,vk=function(r,e){dH.apply(r,ii(e)?e:[e])},fH=Date.prototype.toISOString,yk=Uc.default,ft={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ep.encode,encodeValuesOnly:!1,filter:void 0,format:yk,formatter:Uc.formatters[yk],indices:!1,serializeDate:function(e){return fH.call(e)},skipNulls:!1,strictNullHandling:!1},pH=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},L_={},mH=function r(e,t,i,s,o,n,a,l,c,u,h,d,f,p,m,g,_,v){for(var x=e,T=v,b=0,w=!1;(T=T.get(L_))!==void 0&&!w;){var E=T.get(e);if(b+=1,typeof E<"u"){if(E===b)throw new RangeError("Cyclic object value");w=!0}typeof T.get(L_)>"u"&&(b=0)}if(typeof u=="function"?x=u(t,x):x instanceof Date?x=f(x):i==="comma"&&ii(x)&&(x=ep.maybeMap(x,function(Y){return Y instanceof Date?f(Y):Y})),x===null){if(n)return c&&!g?c(t,ft.encoder,_,"key",p):t;x=""}if(pH(x)||ep.isBuffer(x)){if(c){var I=g?t:c(t,ft.encoder,_,"key",p);return[m(I)+"="+m(c(x,ft.encoder,_,"value",p))]}return[m(t)+"="+m(String(x))]}var B=[];if(typeof x>"u")return B;var C;if(i==="comma"&&ii(x))g&&c&&(x=ep.maybeMap(x,c)),C=[{value:x.length>0?x.join(",")||null:void 0}];else if(ii(u))C=u;else{var A=Object.keys(x);C=h?A.sort(h):A}var P=l?String(t).replace(/\./g,"%2E"):String(t),R=s&&ii(x)&&x.length===1?P+"[]":P;if(o&&ii(x)&&x.length===0)return R+"[]";for(var M=0;M"u"?e.encodeDotInKeys===!0?!0:ft.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:ft.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:ft.allowEmptyArrays,arrayFormat:n,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ft.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?ft.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:ft.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:ft.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:ft.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:ft.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:ft.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:ft.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ft.strictNullHandling}};Tk.exports=function(r,e){var t=r,i=gH(e),s,o;typeof i.filter=="function"?(o=i.filter,t=o("",t)):ii(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof t!="object"||t===null)return"";var a=bk[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(t)),i.sort&&s.sort(i.sort);for(var c=_k(),u=0;u0?p+f:""}});var Pk=ee((ube,Ak)=>{"use strict";var qs=G_(),D_=Object.prototype.hasOwnProperty,wk=Array.isArray,Qe={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:qs.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},xH=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Ek=function(r,e,t){if(r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1)return r.split(",");if(e.throwOnLimitExceeded&&t>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return r},yH="utf8=%26%2310003%3B",_H="utf8=%E2%9C%93",bH=function(e,t){var i={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=t.parameterLimit===1/0?void 0:t.parameterLimit,n=s.split(t.delimiter,t.throwOnLimitExceeded?o+1:o);if(t.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,c=t.charset;if(t.charsetSentinel)for(l=0;l-1&&(p=wk(p)?[p]:p);var m=D_.call(i,f);m&&t.duplicates==="combine"?i[f]=qs.combine(i[f],p):(!m||t.duplicates==="last")&&(i[f]=p)}return i},vH=function(r,e,t,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(e)&&e[o]?e[o].length:0}for(var n=i?e:Ek(e,t,s),a=r.length-1;a>=0;--a){var l,c=r[a];if(c==="[]"&&t.parseArrays)l=t.allowEmptyArrays&&(n===""||t.strictNullHandling&&n===null)?[]:qs.combine([],n);else{l=t.plainObjects?{__proto__:null}:{};var u=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,h=t.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(h,10);!t.parseArrays&&h===""?l={0:n}:!isNaN(d)&&c!==h&&String(d)===h&&d>=0&&t.parseArrays&&d<=t.arrayLimit?(l=[],l[d]=n):h!=="__proto__"&&(l[h]=n)}n=l}return n},TH=function(e,t,i,s){if(e){var o=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),c=l?o.slice(0,l.index):o,u=[];if(c){if(!i.plainObjects&&D_.call(Object.prototype,c)&&!i.allowPrototypes)return;u.push(c)}for(var h=0;i.depth>0&&(l=a.exec(o))!==null&&h"u"?Qe.charset:e.charset,i=typeof e.duplicates>"u"?Qe.duplicates:e.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:Qe.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Qe.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Qe.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Qe.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Qe.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Qe.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Qe.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:Qe.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:Qe.decoder,delimiter:typeof e.delimiter=="string"||qs.isRegExp(e.delimiter)?e.delimiter:Qe.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Qe.depth,duplicates:i,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Qe.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Qe.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Qe.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:Qe.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Qe.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};Ak.exports=function(r,e){var t=SH(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?bH(r,t):r,s=t.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n{"use strict";var wH=Sk(),EH=Pk(),AH=Jf();Ck.exports={formats:AH,parse:EH,stringify:wH}});var kk=ee(Vn=>{"use strict";var PH=yI();function Tr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var CH=/^([a-z0-9.+-]+:)/i,MH=/:[0-9]*$/,RH=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,IH=["<",">",'"',"`"," ","\r",` +`," "],BH=["{","}","|","\\","^","`"].concat(IH),N_=["'"].concat(BH),Rk=["%","/","?",";","#"].concat(N_),Ik=["/","?","#"],kH=255,Bk=/^[+a-z0-9A-Z_-]{0,63}$/,FH=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,OH={javascript:!0,"javascript:":!0},H_={javascript:!0,"javascript:":!0},Hn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},V_=Mk();function Gc(r,e,t){if(r&&typeof r=="object"&&r instanceof Tr)return r;var i=new Tr;return i.parse(r,e,t),i}Tr.prototype.parse=function(r,e,t){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i127?b+="x":b+=T[w];if(!b.match(Bk)){var I=v.slice(0,f),B=v.slice(f+1),C=T.match(FH);C&&(I.push(C[1]),B.unshift(C[2])),B.length&&(a="/"+B.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>kH?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=PH.toASCII(this.hostname));var A=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+A,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!OH[u])for(var f=0,x=N_.length;f0?t.host.split("@"):!1;b&&(t.auth=b.shift(),t.hostname=b.shift(),t.host=t.hostname)}return t.search=r.search,t.query=r.query,(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!v.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var w=v.slice(-1)[0],E=(t.host||r.host||v.length>1)&&(w==="."||w==="..")||w==="",I=0,B=v.length;B>=0;B--)w=v[B],w==="."?v.splice(B,1):w===".."?(v.splice(B,1),I++):I&&(v.splice(B,1),I--);if(!g&&!_)for(;I--;I)v.unshift("..");g&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),E&&v.join("/").substr(-1)!=="/"&&v.push("");var C=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(T){t.hostname=C?"":v.length?v.shift():"",t.host=t.hostname;var b=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;b&&(t.auth=b.shift(),t.hostname=b.shift(),t.host=t.hostname)}return g=g||t.host&&v.length,g&&!C&&v.unshift(""),v.length>0?t.pathname=v.join("/"):(t.pathname=null,t.path=null),(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=r.auth||t.auth,t.slashes=t.slashes||r.slashes,t.href=t.format(),t};Tr.prototype.parseHost=function(){var r=this.host,e=MH.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};Vn.parse=Gc;Vn.resolve=GH;Vn.resolveObject=LH;Vn.format=UH;Vn.Url=Tr});var QF=()=>{let r=new Map,e=l=>typeof l=="string"&&l.startsWith("blob:"),t=l=>typeof l?.type=="string"&&(l.type.startsWith("image/")||l.type.startsWith("video/"))&&typeof l?.url=="string"&&!e(l.url);return{load:async l=>{let c=[];for(let[u,h]of Object.entries(l))r.has(u)||c.push([u,h]);c.length>0&&await Promise.all(c.map(async([u,h])=>{if(t(h)){r.set(u,{url:h.url,type:h.type,source:"url"});return}let p={buffer:await(await fetch(h.url)).arrayBuffer(),type:h.type,source:"buffer"};r.set(u,p)}))},getBufferMap:()=>{let l={};for(let[c,u]of r.entries())l[c]=u;return l},clear:()=>r.clear(),size:()=>r.size,has:l=>r.has(l)}};U();var cA={extension:{type:S.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(lA(),nU))}};U();var hA={extension:{type:S.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(uA(),aU))}};U();eh();Yu();U();Re();ll();var Yh;function xA(r){return Yh!==void 0||(Yh=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:r??qi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let i=j.get().createCanvas().getContext("webgl",e),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),Yh}Re();var qh;async function yA(r={}){return qh!==void 0||(qh=await(async()=>{let e=j.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),qh}ll();var RC=["webgl","webgpu","canvas"];async function IC(r){let e=[];r.preference?(e.push(r.preference),RC.forEach(o=>{o!==r.preference&&e.push(o)})):e=RC.slice();let t,i={};for(let o=0;o(iP(),rP));t=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&xA(r.failIfMajorPerformanceCaveat??qi.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(MC(),CC));t=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!t)throw new Error("No available renderer for the current environment");let s=new t;return await s.init(i),s}Pr();Ax();Xe();var BC=class py{constructor(...e){this.stage=new te,e[0]!==void 0&&X(ie,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await IC(e),py._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(ie,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,t=!1){let i=py._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};BC._plugins=[];var ic=BC;V.handleByList(S.Application,ic._plugins);V.add(yl);U();Di();Am();Re();U();Ts();ut();ve();tx();nx();var sc=class extends Ko{constructor(e,t){super();let{textures:i,data:s}=e;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l}=i[n.page],c=new Q(n.x+a.x,n.y+a.y,n.width,n.height),u=new k({source:l,frame:c});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:u}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=t}destroy(){super.destroy();for(let e=0;e")?my.test(j.get().parseXML(r)):!1},parse(r){return my.parse(j.get().parseXML(r))}};var HU=[".xml",".fnt"],kC={extension:{type:S.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof sc,getCacheableAssets(r,e){let t={};return r.forEach(i=>{t[i]=e,t[`${i}-bitmap`]=e}),t[`${e.fontFamily}-bitmap`]=e,t}},FC={extension:{type:S.LoadParser,priority:Dt.Normal},name:"loadBitmapFont",test(r){return HU.includes(dt.extname(r).toLowerCase())},async testParse(r){return bd.test(r)||gy.test(r)},async parse(r,e,t){let i=bd.test(r)?bd.parse(r):gy.parse(r),{src:s}=e,{pages:o}=i,n=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let h=0;hl[h.src]);return new sc({data:i,textures:c},s)},async load(r,e){return await(await j.get().fetch(r)).text()},async unload(r,e,t){await Promise.all(r.pages.map(i=>t.unload(i.texture.source._sourceOrigin))),r.destroy()}};Ae();var vd=class{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.forEach(t=>{this._assetList.push(t)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let e=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;iArray.isArray(r)&&r.every(e=>e instanceof k),getCacheableAssets:(r,e)=>{let t={};return r.forEach(i=>{e.forEach((s,o)=>{t[i+(o===0?"":o+1)]=s})}),t}};U();async function Td(r){if("Image"in globalThis)return new Promise(e=>{let t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let e=await(await fetch(r)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}var UC={extension:{type:S.DetectionParser,priority:1},test:async()=>Td("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(e=>e!=="avif")};U();var GC=["png","jpg","jpeg"],LC={extension:{type:S.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...GC],remove:async r=>r.filter(e=>!GC.includes(e))};U();var VU="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function dn(r){return VU?!1:document.createElement("video").canPlayType(r)!==""}var DC={extension:{type:S.DetectionParser,priority:0},test:async()=>dn("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(e=>e!=="mp4"&&e!=="m4v")};U();var NC={extension:{type:S.DetectionParser,priority:0},test:async()=>dn("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(e=>e!=="ogv")};U();var HC={extension:{type:S.DetectionParser,priority:0},test:async()=>dn("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(e=>e!=="webm")};U();var VC={extension:{type:S.DetectionParser,priority:0},test:async()=>Td("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(e=>e!=="webp")};Ae();Ts();Aa();ju();var Sd=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,i)=>(this._parsersValidated=!1,e[t]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(t.loadParser&&(o=this._parserHash[t.loadParser],o||W(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!o){for(let n=0;n({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let u=dt.toAbsolute(c.src);if(!s[c.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,c)),s[c.src]=await this.promiseCache[u].promise,t&&t(++i/a)}catch(h){throw delete this.promiseCache[u],delete s[c.src],new Error(`[Loader.load] Failed to load ${u}. +${h}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(e){let i=Nt(e,s=>({alias:[s],src:s})).map(async s=>{let o=dt.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(e=>e.name).reduce((e,t)=>(t.name?e[t.name]&&W(`[Assets] loadParser name conflict "${t.name}"`):W("[Assets] loadParser should have a name"),{...e,[t.name]:t}),{})}};Re();U();function yr(r,e){if(Array.isArray(e)){for(let t of e)if(r.startsWith(`data:${t}`))return!0;return!1}return r.startsWith(`data:${e}`)}Ts();function _r(r,e){let t=r.split("?")[0],i=dt.extname(t).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}Di();var WU=".json",zU="application/json",WC={extension:{type:S.LoadParser,priority:Dt.Low},name:"loadJson",test(r){return yr(r,zU)||_r(r,WU)},async load(r){return await(await j.get().fetch(r)).json()}};Re();U();Di();var $U=".txt",XU="text/plain",zC={name:"loadTxt",extension:{type:S.LoadParser,priority:Dt.Low,name:"loadTxt"},test(r){return yr(r,XU)||_r(r,$U)},async load(r){return await(await j.get().fetch(r)).text()}};Re();U();Ae();Ts();Hi();Di();var jU=["normal","bold","100","200","300","400","500","600","700","800","900"],YU=[".ttf",".otf",".woff",".woff2"],qU=["font/ttf","font/otf","font/woff","font/woff2"],KU=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function ZU(r){let e=dt.extname(r),s=dt.basename(r,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(KU)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var QU=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function JU(r){return QU.test(r)?r:encodeURI(r)}var $C={extension:{type:S.LoadParser,priority:Dt.Low},name:"loadWebFont",test(r){return yr(r,qU)||_r(r,YU)},async load(r,e){let t=j.get().getFontFaceSet();if(t){let i=[],s=e.data?.family??ZU(r),o=e.data?.weights?.filter(a=>jU.includes(a))??["normal"],n=e.data??{};for(let a=0;a{Se.remove(`${e.family}-and-url`),j.get().getFontFaceSet().delete(e)})}};Re();U();Ao();kh();wo();function fn(r,e=1){let t=rr.RETINA_PREFIX?.exec(r);return t?parseFloat(t[1]):e}Di();ve();Ae();Hi();function pn(r,e,t){r.label=t,r._sourceOrigin=t;let i=new k({source:r,label:t}),s=()=>{delete e.promiseCache[t],Se.has(t)&&Se.remove(t)};return i.source.once("destroy",()=>{e.promiseCache[t]&&(W("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),i.once("destroy",()=>{r.destroyed||(W("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var eG=".svg",tG="image/svg+xml",XC={extension:{type:S.LoadParser,priority:Dt.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return yr(r,tG)||_r(r,eG)},async load(r,e,t){return e.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?iG(r):rG(r,e,t,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function rG(r,e,t,i){let o=await(await j.get().fetch(r)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=i,await a.decode(),URL.revokeObjectURL(n);let l=document.createElement("canvas"),c=l.getContext("2d"),u=e.data?.resolution||fn(r),h=e.data?.width??a.width,d=e.data?.height??a.height;l.width=h*u,l.height=d*u,c.drawImage(a,0,0,h*u,d*u);let{parseAsGraphicsContext:f,...p}=e.data??{},m=new jt({resource:l,alphaMode:"premultiply-alpha-on-upload",resolution:u,...p});return pn(m,t,r)}async function iG(r){let t=await(await j.get().fetch(r)).text(),i=new Ht;return i.svg(t),i}Re();U();Ao();var sG=`(function () { 'use strict'; const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII="; @@ -1112,7 +1112,7 @@ ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=ke(t }); })(); -`,Wo=null,zo=class{constructor(){Wo||(Wo=URL.createObjectURL(new Blob([ck],{type:"application/javascript"}))),this.worker=new Worker(Wo)}};zo.revokeObjectURL=function(){Wo&&(URL.revokeObjectURL(Wo),Wo=null)};var uk=`(function () { +`,mn=null,gn=class{constructor(){mn||(mn=URL.createObjectURL(new Blob([sG],{type:"application/javascript"}))),this.worker=new Worker(mn)}};gn.revokeObjectURL=function(){mn&&(URL.revokeObjectURL(mn),mn=null)};var oG=`(function () { 'use strict'; async function loadImageBitmap(url, alphaMode) { @@ -1141,20 +1141,293 @@ ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=ke(t }; })(); -`,$o=null,vl=class{constructor(){$o||($o=URL.createObjectURL(new Blob([uk],{type:"application/javascript"}))),this.worker=new Worker($o)}};vl.revokeObjectURL=function(){$o&&(URL.revokeObjectURL($o),$o=null)};var nP=0,Qg,Jg=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new zo;e.addEventListener("message",i=>{e.terminate(),zo.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Qg===void 0&&(Qg=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[nP]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:nP++,id:i})}},tx=new Jg;ii();var dk=[".jpeg",".jpg",".png",".webp",".avif"],fk=["image/jpeg","image/png","image/webp","image/avif"];async function pk(r,t){let e=await Y.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var Bu={name:"loadTextures",extension:{type:v.LoadParser,priority:ge.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return cr(r,fk)||ur(r,dk)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await tx.isImageBitmapSupported()?i=await tx.loadImageBitmap(r,t):i=await pk(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new Ve({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Ho(r),...t.data});return Vo(s,e,r)},unload(r){r.destroy(!0)}};B();mp();pp();var aP=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],mk=aP.map(r=>`video/${r.substring(1)}`);function gk(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=yk(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function xk(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function yk(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var lP={name:"loadVideo",extension:{type:v.LoadParser,name:"loadVideo"},test(r){let t=cr(r,mk),e=ur(r,aP);return t||e},async load(r,t,e){let i={...ro.defaultOptions,resolution:t.data?.resolution||Ho(r),alphaMode:t.data?.alphaMode||await nc(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let h=o[l];h!==void 0&&s.setAttribute(l,h)}),i.muted===!0&&(s.muted=!0),gk(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=ro.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let h=async()=>{let c=new ro({...i,resource:s});s.removeEventListener("canplay",h),t.data.preload&&await xk(s),l(Vo(c,e,r))};s.addEventListener("canplay",h),s.appendChild(n)})},unload(r){r.destroy(!0)}};B();Js();B();Js();var Fu={extension:{type:v.ResolveParser,name:"resolveTexture"},test:Bu.test,parse:r=>({resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var hP={extension:{type:v.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Ke.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Fu.parse};Js();Vn();ec();var ku=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ke,this.loader=new Iu,this.cache=Tt,this._backgroundLoader=new Ru(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){N("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=os(t),s=ke(t).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,l=0,h=()=>{e?.(++a/l)},c=n.map(u=>{let d=s[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{o[u]=f})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Tt.get(t);let e={};for(let i=0;i{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(h=>{o[h]=a}),Tt.set(l,a)}),o}async unload(t){this._initialized||await this.init();let e=ke(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=ke(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{Tt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},Sr=new ku;L.handleByList(v.LoadParser,Sr.loader.parsers).handleByList(v.ResolveParser,Sr.resolver.parsers).handleByList(v.CacheParser,Sr.cache.parsers).handleByList(v.DetectionParser,Sr.detections);L.add(Y1,Z1,q1,eP,Q1,J1,tP,rP,iP,sP,oP,Bu,lP,j1,X1,Fu,hP);var cP={loader:v.LoadParser,resolver:v.ResolveParser,cache:v.CacheParser,detection:v.DetectionParser};L.handle(v.Asset,r=>{let t=r.ref;Object.entries(cP).filter(([e])=>!!t[e]).forEach(([e,i])=>L.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(cP).filter(e=>!!t[e]).forEach(e=>L.remove(t[e]))});vt();On();Qs();$n();var Tl=class r extends kt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:h=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof M?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=l,this.onLoop=h,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(le.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(le.shared.add(this.update,this,Mr.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrames)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;ithis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(le.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(le.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Uh();zt();tc();var Gu=class extends Ai{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:h,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new ve({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=h??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function uP(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&(j(it,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}pa();ps();var Di=class extends Gu{constructor(...t){let e=uP(t,"Text");super(e,Ht),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=Jt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ii();gt();ae();mg();vt();nu();yp();yr();km();$n();pa();ps();hp();Ae();var _k=qi(Sc(),1);L.add(bw,Tw);var bk=new(window.AudioContext||window.webkitAudioContext),ex={},vk=async(r,t)=>{if(!ex[r]&&t.byteLength!==0)try{let e=await bk.decodeAudioData(t);ex[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},Tk=r=>ex[r],Xo={load:vk,getAsset:Tk};var ue=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var rx=({type:r})=>({type:r});var ix=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var dP={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var fP={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var ys={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var Se={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var _s=(r,t)=>{let e={fill:t?.fill??Se.fill,fontFamily:t?.fontFamily??Se.fontFamily,fontSize:t?.fontSize??Se.fontSize,align:t?.align??Se.align,lineHeight:t?.lineHeight??Se.lineHeight,wordWrap:t?.wordWrap??Se.wordWrap,breakWords:t?.breakWords??Se.breakWords,strokeColor:t?.strokeColor??Se.strokeColor,strokeWidth:t?.strokeWidth??Se.strokeWidth,wordWrapWidth:t?.wordWrapWidth??Se.wordWrapWidth};r.style=e};var pP=(r=[])=>{if(r instanceof Map)return r;let t=new Map;for(let e of r)t.has(e.targetId)||t.set(e.targetId,[]),t.get(e.targetId).push(e);return t},Uu=(r,t)=>r instanceof Map?r.get(t)??[]:r.filter(e=>e.targetId===t),Sk=(r,t)=>Uu(r,t).filter(e=>e.type==="live"),Ou=(r,t)=>Uu(r,t).find(e=>e.type==="replace")??null,Q=({animations:r,targetId:t,animationBus:e,completionTracker:i,element:s,targetState:o,onComplete:n})=>{let a=Sk(r,t);if(a.length===0)return!1;for(let l of a){let h=i.getVersion();i.track(h),e.dispatch({type:"START",payload:{id:l.id,element:s,properties:l.tween,targetState:o,onComplete:()=>{i.complete(h),n?.(l)}}})}return!0};var gP=Symbol("routeGraphicsTextAnchorRatios"),mP=(r,t)=>typeof r!="number"||r===0?0:t/r,Lu=(r,t)=>{let e=r.width||t.width,i=r.height||t.height,s=typeof t.__anchorXRatio=="number"?t.__anchorXRatio:mP(e,t.originX),o=typeof t.__anchorYRatio=="number"?t.__anchorYRatio:mP(i,t.originY);r[gP]={x:s,y:o}},wk=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?Se.lineHeight:r.lineHeight/r.fontSize,Ek=(r,t)=>{if(!t)return r;let e={...r,...t};if(t.fontSize!==void 0||t.lineHeight!==void 0){let i=t.lineHeight??wk(r);e.lineHeight=Math.round(e.fontSize*i)}return e},Wr=(r,t,e)=>{let i=r[gP],s=Ek(t,e);if(!i){_s(r,s);return}let o=r.x+r.width*i.x,n=r.y+r.height*i.y;_s(r,s),r.x=o-r.width*i.x,r.y=n-r.height*i.y};var xP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=new Di({label:e.id});l.zIndex=a,l.text=e.content,_s(l,e.textStyle),Lu(l,e),l.alpha=e.alpha,l.x=e.x,l.y=e.y;let h=e?.hover,c=e?.click,u=e?.rightClick,d={isHovering:!1,isPressed:!1,isRightPressed:!1},f=({isHovering:m,isPressed:g,isRightPressed:p})=>{p&&u?.textStyle?Wr(l,e.textStyle,u.textStyle):g&&c?.textStyle?Wr(l,e.textStyle,c.textStyle):m&&h?.textStyle?Wr(l,e.textStyle,h.textStyle):Wr(l,e.textStyle)};if(h){let{cursor:m,soundSrc:g,payload:p}=h;l.eventMode="static";let b=()=>{d.isHovering=!0,p&&s&&s("hover",{_event:{id:l.label},...p}),m&&(l.cursor=m),g&&r.audioStage.add({id:`hover-${Date.now()}`,url:g,loop:!1}),f(d)},y=()=>{d.isHovering=!1,l.cursor="auto",f(d)};l.on("pointerover",b),l.on("pointerout",y)}if(c){let{soundSrc:m,soundVolume:g,payload:p}=c;l.eventMode="static";let b=()=>{d.isPressed=!0,f(d)},y=()=>{d.isPressed=!1,f(d),p&&s&&s("click",{_event:{id:l.label},...p}),m&&r.audioStage.add({id:`click-${Date.now()}`,url:m,loop:!1,volume:(g??1e3)/1e3})},_=()=>{d.isPressed=!1,f(d)};l.on("pointerdown",b),l.on("pointerup",y),l.on("pointerupoutside",_)}if(u){let{soundSrc:m,payload:g}=u;l.eventMode="static";let p=()=>{d.isRightPressed=!0,f(d)},b=()=>{d.isRightPressed=!1,f(d)},y=()=>{d.isRightPressed=!1,f(d),g&&s&&s("rightClick",{_event:{id:l.label},...g}),m&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:m,loop:!1})},_=()=>{d.isRightPressed=!1,f(d)};l.on("rightdown",p),l.on("rightup",b),l.on("rightclick",y),l.on("rightupoutside",_)}t.addChild(l),Q({animations:i,targetId:e.id,animationBus:o,completionTracker:n,element:l,targetState:{x:e.x,y:e.y,alpha:e.alpha}})};var Ak=Object.prototype.hasOwnProperty,Et=(r,t)=>{if(Object.is(r,t))return!0;if(r===null||t===null||typeof r!="object"||typeof t!="object")return!1;let e=Array.isArray(r),i=Array.isArray(t);if(e!==i)return!1;if(e&&i){if(r.length!==t.length)return!1;for(let n=0;n{let h=t.children.find(g=>g.label===e.id);if(!h)return;h.zIndex=l;let{x:c,y:u,alpha:d}=i,f=()=>{if(!Et(e,i)){h.text=i.content,_s(h,i.textStyle),Lu(h,i),h.x=c,h.y=u,h.alpha=d,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightclick"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let g=i?.hover,p=i?.click,b=i?.rightClick,y={isHovering:!1,isPressed:!1,isRightPressed:!1},_=({isHovering:S,isPressed:E,isRightPressed:w})=>{w&&b?.textStyle?Wr(h,i.textStyle,b.textStyle):E&&p?.textStyle?Wr(h,i.textStyle,p.textStyle):S&&g?.textStyle?Wr(h,i.textStyle,g.textStyle):Wr(h,i.textStyle)};if(g){let{cursor:S,soundSrc:E,payload:w}=g;h.eventMode="static";let T=()=>{y.isHovering=!0,w&&s&&s("hover",{_event:{id:h.label},...w}),S&&(h.cursor=S),E&&r.audioStage.add({id:`hover-${Date.now()}`,url:E,loop:!1}),_(y)},C=()=>{y.isHovering=!1,h.cursor="auto",_(y)};h.on("pointerover",T),h.on("pointerout",C)}if(p){let{soundSrc:S,soundVolume:E,payload:w}=p;h.eventMode="static";let T=()=>{y.isPressed=!0,_(y)},C=()=>{y.isPressed=!1,_(y),w&&s&&s("click",{_event:{id:h.label},...w}),S&&r.audioStage.add({id:`click-${Date.now()}`,url:S,loop:!1,volume:(E??1e3)/1e3})},A=()=>{y.isPressed=!1,_(y)};h.on("pointerdown",T),h.on("pointerup",C),h.on("pointerupoutside",A)}if(b){let{soundSrc:S,payload:E}=b;h.eventMode="static";let w=()=>{y.isRightPressed=!0,_(y)},T=()=>{y.isRightPressed=!1,_(y)},C=()=>{y.isRightPressed=!1,_(y),E&&s&&s("rightClick",{_event:{id:h.label},...E}),S&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:S,loop:!1})},A=()=>{y.isRightPressed=!1,_(y)};h.on("rightdown",w),h.on("rightup",T),h.on("rightclick",C),h.on("rightupoutside",A)}}};Q({animations:o,targetId:e.id,animationBus:n,completionTracker:a,element:h,targetState:{x:c,y:u,alpha:d},onComplete:()=>{f()}})||f()};var _P=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;Q({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var bP=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,l=t-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var Ce=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(ys).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(ys).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===ys.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=bP({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var vP=({state:r})=>{let t={...Se,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),r.width&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let e=String(r.content??""),{width:i,height:s}=Jt.measureText(e,new Ht(t)),o=Math.round(i),n=Math.round(s),l={...Ce({...r,width:o,height:n}),content:e,textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}};return Object.defineProperties(l,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1}}),l};var Pk=ue({type:"text",add:xP,update:yP,delete:_P,parse:vP});var TP=({app:r,parent:t,element:e,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a})=>{let{id:l,x:h,y:c,width:u,height:d,fill:f,border:m,alpha:g}=e,p=new ce;p.label=l,p.zIndex=n,(()=>{p.clear(),p.rect(0,0,Math.round(u),Math.round(d)).fill(f),p.x=Math.round(h),p.y=Math.round(c),p.alpha=g,m&&p.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)})})();let y=e?.hover,_=e?.click,S=e?.rightClick,E=e?.scrollUp,w=e?.scrollDown,T=e?.drag;if(y){let{cursor:C,soundSrc:A,payload:P}=y;p.eventMode="static";let R=()=>{P&&o&&o("hover",{_event:{id:p.label},...P}),C&&(p.cursor=C),A&&r.audioStage.add({id:`hover-${Date.now()}`,url:A,loop:!1})},I=()=>{p.cursor="auto"};p.on("pointerover",R),p.on("pointerout",I)}if(_){let{soundSrc:C,soundVolume:A,payload:P}=_;p.eventMode="static";let R=()=>{P&&o&&o("click",{_event:{id:p.label},...P}),C&&r.audioStage.add({id:`click-${Date.now()}`,url:C,loop:!1,volume:(A??1e3)/1e3})};p.on("pointerup",R)}if(S){let{soundSrc:C,payload:A}=S;p.eventMode="static";let P=()=>{A&&o&&o("rightClick",{_event:{id:p.label},...A}),C&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:C,loop:!1})};p.on("rightclick",P)}if(E||w){p.eventMode="static";let C=A=>{if(A.deltaY<0&&E){let{payload:P}=E;P&&o&&o("scrollUp",{_event:{id:p.label},...P})}else if(A.deltaY>0&&w){let{payload:P}=w;P&&o&&o("scrollDown",{_event:{id:p.label},...P})}};p.on("wheel",C)}if(T){let{start:C,end:A,move:P}=T;p.eventMode="static";let R=()=>{p._isDragging=!0,C&&o&&o("dragStart",{_event:{id:p.label},...typeof C?.payload=="object"?C.payload:{}})},I=()=>{p._isDragging=!1,A&&o&&o("dragEnd",{_event:{id:p.label},...typeof A?.payload=="object"?A.payload:{}})},F=G=>{P&&o&&p._isDragging&&o("dragMove",{_event:{id:p.label,x:G.global.x,y:G.global.y},...typeof P?.payload=="object"?P.payload:{}})};p.on("pointerdown",R),p.on("pointerup",I),p.on("globalpointermove",F),p.on("pointerupoutside",I)}t.addChild(p),Q({animations:i,targetId:l,animationBus:s,completionTracker:a,element:p,targetState:{x:h,y:c,alpha:g}})};var SP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=a;let{x:c,y:u,width:d,height:f,fill:m,border:g,alpha:p}=i,b=()=>{if(!Et(e,i)){h.clear(),h.rect(0,0,Math.round(d),Math.round(f)).fill(m),h.x=Math.round(c),h.y=Math.round(u),h.alpha=p,g&&h.stroke({color:g.color,alpha:g.alpha,width:Math.round(g.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let _=i?.hover,S=i?.click,E=i?.rightClick,w=i?.scrollUp,T=i?.scrollDown,C=i?.drag;if(_){let{cursor:A,soundSrc:P,payload:R}=_;h.eventMode="static";let I=()=>{R&&n&&n("hover",{_event:{id:h.label},...R}),A&&(h.cursor=A),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},F=()=>{h.cursor="auto"};h.on("pointerover",I),h.on("pointerout",F)}if(S){let{soundSrc:A,soundVolume:P,payload:R}=S;h.eventMode="static";let I=()=>{R&&n&&n("click",{_event:{id:h.label},...R}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:(P??1e3)/1e3})};h.on("pointerup",I)}if(E){let{soundSrc:A,payload:P}=E;h.eventMode="static";let R=()=>{P&&n&&n("rightClick",{_event:{id:h.label},...P}),A&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:A,loop:!1})};h.on("rightclick",R)}if(w||T){h.eventMode="static";let A=P=>{if(P.deltaY<0&&w){let{payload:R}=w;R&&n&&n("scrollUp",{_event:{id:h.label},...R})}else if(P.deltaY>0&&T){let{payload:R}=T;R&&n&&n("scrollDown",{_event:{id:h.label},...R})}};h.on("wheel",A)}if(C){let{start:A,end:P,move:R}=C;h.eventMode="static";let I=()=>{h._isDragging=!0,A&&n&&n("dragStart",{_event:{id:h.label},...typeof A?.payload=="object"?A.payload:{}})},F=()=>{h._isDragging=!1,P&&n&&n("dragEnd",{_event:{id:h.label},...typeof P?.payload=="object"?P.payload:{}})},G=z=>{R&&n&&h._isDragging&&n("dragMove",{_event:{id:h.label,x:z.global.x,y:z.global.y},...typeof R?.payload=="object"?R.payload:{}})};h.on("pointerdown",I),h.on("pointerup",F),h.on("globalpointermove",G),h.on("pointerupoutside",F)}}};Q({animations:s,targetId:e.id,animationBus:o,completionTracker:l,element:h,targetState:{x:c,y:u,alpha:p},onComplete:()=>{b()}})||b()};var wP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o)return;Q({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var EP=({state:r})=>{let t=Ce(r),e=t;return r.border&&(e={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:r.border?.width??0}}),{...e,fill:r.fill??"white",rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scroll&&{scroll:r.scroll}}};var Ck=ue({type:"rect",add:TP,update:SP,delete:wP,parse:EP});var AP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,src:f,alpha:m}=e,g=f?M.from(f):M.EMPTY,p=new kt(g);p.label=l,p.zIndex=a,p.x=Math.round(h),p.y=Math.round(c),p.width=Math.round(u),p.height=Math.round(d),p.alpha=m;let b=e?.hover,y=e?.click,_=e?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},E=({isHovering:w,isPressed:T,isRightPressed:C})=>{if(C&&_?.src){let A=M.from(_.src);p.texture=A}else if(T&&y?.src){let A=M.from(y.src);p.texture=A}else if(w&&b?.src){let A=M.from(b.src);p.texture=A}else p.texture=g};if(b){let{cursor:w,soundSrc:T,payload:C}=b;p.eventMode="static";let A=()=>{S.isHovering=!0,C&&s&&s("hover",{_event:{id:p.label},...C}),w&&(p.cursor=w),T&&r.audioStage.add({id:`hover-${Date.now()}`,url:T,loop:!1}),E(S)},P=()=>{S.isHovering=!1,p.cursor="auto",E(S)};p.on("pointerover",A),p.on("pointerout",P)}if(y){let{soundSrc:w,soundVolume:T,payload:C}=y;p.eventMode="static";let A=()=>{S.isPressed=!0,E(S)},P=()=>{S.isPressed=!1,E(S),C&&s&&s("click",{_event:{id:p.label},...C}),w&&r.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1,volume:(T??1e3)/1e3})},R=()=>{S.isPressed=!1,E(S)};p.on("pointerdown",A),p.on("pointerup",P),p.on("pointerupoutside",R)}if(_){let{soundSrc:w,payload:T}=_;p.eventMode="static";let C=()=>{S.isRightPressed=!0,E(S)},A=()=>{S.isRightPressed=!1,E(S)},P=()=>{S.isRightPressed=!1,E(S),T&&s&&s("rightClick",{_event:{id:p.label},...T}),w&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:w,loop:!1})},R=()=>{S.isRightPressed=!1,E(S)};p.on("rightdown",C),p.on("rightup",A),p.on("rightclick",P),p.on("rightupoutside",R)}t.addChild(p),Q({animations:i,targetId:l,animationBus:o,completionTracker:n,element:p,targetState:{x:h,y:c,width:u,height:d,alpha:m}})};var PP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(_=>_.label===e.id);if(!h)return;h.zIndex=l;let{id:c,x:u,y:d,width:f,height:m,src:g,alpha:p}=i,b=()=>{if(!Et(e,i)){let _=g?M.from(g):M.EMPTY;h.texture=_,h.x=Math.round(u),h.y=Math.round(d),h.width=Math.round(f),h.height=Math.round(m),h.alpha=p,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightclick"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let S=i?.hover,E=i?.click,w=i?.rightClick,T={isHovering:!1,isPressed:!1,isRightPressed:!1},C=({isHovering:A,isPressed:P,isRightPressed:R})=>{if(R&&w?.src){let I=M.from(w.src);h.texture=I}else if(P&&E?.src){let I=M.from(E.src);h.texture=I}else if(A&&S?.src){let I=M.from(S.src);h.texture=I}else h.texture=_};if(S){let{cursor:A,soundSrc:P,payload:R}=S;h.eventMode="static";let I=()=>{T.isHovering=!0,R&&a&&a("hover",{_event:{id:h.label},...R}),A&&(h.cursor=A),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1}),C(T)},F=()=>{T.isHovering=!1,h.cursor="auto",C(T)};h.on("pointerover",I),h.on("pointerout",F)}if(E){let{soundSrc:A,soundVolume:P,payload:R}=E;h.eventMode="static";let I=()=>{T.isPressed=!0,C(T)},F=()=>{T.isPressed=!1,C(T),R&&a&&a("click",{_event:{id:h.label},...R}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:(P??1e3)/1e3})},G=()=>{T.isPressed=!1,C(T)};h.on("pointerdown",I),h.on("pointerup",F),h.on("pointerupoutside",G)}if(w){let{soundSrc:A,payload:P}=w;h.eventMode="static";let R=()=>{T.isRightPressed=!0,C(T)},I=()=>{T.isRightPressed=!1,C(T)},F=()=>{T.isRightPressed=!1,C(T),P&&a&&a("rightClick",{_event:{id:h.label},...P}),A&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:A,loop:!1})},G=()=>{T.isRightPressed=!1,C(T)};h.on("rightdown",R),h.on("rightup",I),h.on("rightclick",F),h.on("rightupoutside",G)}}};Q({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,width:f,height:m,alpha:p},onComplete:()=>{b()}})||b()};var CP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===t.id);if(!o)return;Q({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var RP=({state:r})=>({...Ce(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var Rk=ue({type:"sprite",add:AP,update:PP,delete:CP,parse:RP});var Mk=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,sx=({videoElement:r,video:t})=>{t&&r?._videoEndedListener&&t.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},Du=({videoElement:r,video:t,loop:e,completionTracker:i})=>{if(sx({videoElement:r,video:t}),(e??!1)||Mk(t))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};t.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var MP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,completionTracker:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,src:f,volume:m,loop:g,alpha:p}=e,b=M.from(f),y=b.source.resource;y.pause(),y.currentTime=0,y.loop=g??!1,y.volume=m/1e3,y.muted=!1;let _=new kt(b);_.label=l,_.zIndex=a,_._videoEndedListener=void 0,_._playbackStateVersion=null,_.x=Math.round(h),_.y=Math.round(c),_.width=Math.round(u),_.height=Math.round(d),_.alpha=p??1,Du({videoElement:_,video:y,loop:g,completionTracker:n}),y.play(),t.addChild(_),Q({animations:i,targetId:l,animationBus:o,completionTracker:n,element:_,targetState:{x:h,y:c,width:u,height:d,alpha:p??1}})};var IP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,eventHandler:n,completionTracker:a,zIndex:l})=>{let h=t.children.find(b=>b.label===e.id);if(!h)return;h.zIndex=l;let{x:c,y:u,width:d,height:f,alpha:m}=i,g=()=>{if(!Et(e,i)){h.x=Math.round(c),h.y=Math.round(u),h.width=Math.round(d),h.height=Math.round(f),h.alpha=m??1;let b=h.texture.source.resource;if(e.src!==i.src){let y=b;sx({videoElement:h,video:y}),y&&y.pause();let _=M.from(i.src);h.texture=_,b=_.source.resource,b.muted=!1,b.pause(),b.currentTime=0}Du({videoElement:h,video:b,loop:i.loop,completionTracker:a}),b.volume=i.volume/1e3,b.loop=i.loop??!1,e.src!==i.src&&b.play()}};Q({animations:s,targetId:e.id,animationBus:o,completionTracker:a,element:h,targetState:{x:c,y:u,width:d,height:f,alpha:m??1},onComplete:g})||g()};var BP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;let a=()=>{if(n&&!n.destroyed){n._playbackStateVersion!==null&&o.complete(n._playbackStateVersion);let h=n.texture.source.resource;h&&(n._videoEndedListener&&h.removeEventListener("ended",n._videoEndedListener),h.pause()),t.removeChild(n),n.destroy()}};Q({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var FP=({state:r})=>({...Ce(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var Ik=ue({type:"video",add:MP,update:IP,delete:BP,parse:FP});var kP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,eventHandler:n,zIndex:a})=>{let{id:l,x:h,y:c,width:u,height:d,alpha:f,thumbSrc:m,barSrc:g,direction:p,min:b,max:y,step:_,initialValue:S,originX:E,originY:w,hover:T,change:C}=e,A=new at;A.label=l,A.zIndex=a,A.x=h,A.y=c,A.alpha=f,A.sortableChildren=!0,A.eventMode="static";let P=0,R=g?M.from(g):M.EMPTY,I=new kt(R);I.label=`${l}-bar`,I.eventMode="static";let F=m?M.from(m):M.EMPTY,G=new kt(F);G.label=`${l}-thumb`,G.eventMode="static";let z=S??b,U=y-b,$=mt=>{let St=(mt-b)/U;p==="horizontal"?(G.x=St*(I.width-G.width),G.y=(I.height-G.height)/2):(G.x=(I.width-G.width)/2,G.y=St*(I.height-G.height))};(()=>{I.width=u,I.height=d;let mt=p==="horizontal"?d-P*2:u-P*2,St=m?M.from(m):M.EMPTY,ct=St.width,Bt=St.height,ne=mt/ct,Zt=mt/Bt,pe=Math.min(ne,Zt);G.width=ct*pe,G.height=Bt*pe,$(z)})();let O=F,W=R,tt=!1,et=mt=>{let St;if(p==="horizontal"){let Bt=mt.x-G.width/2;St=Math.max(0,Math.min(1,Bt/(I.width-G.width)))}else{let Bt=mt.y-G.height/2;St=Math.max(0,Math.min(1,Bt/(I.height-G.height)))}let ct=b+St*U;return _>0&&(ct=Math.round((ct-b)/_)*_+b,ct=Math.max(b,Math.min(y,ct))),ct},yt=mt=>{let St=A.toLocal(mt.global),ct=et(St);ct!==z&&(z=ct,$(z),C?.payload&&n&&n("change",{_event:{id:l,value:z},...C.payload}))},Ut=mt=>{tt=!0,yt(mt)},Mt=mt=>{tt&&yt(mt)},Wt=()=>{tt&&(tt=!1)};if(A.on("pointerdown",Ut),A.on("globalpointermove",Mt),A.on("pointerup",Wt),A.on("pointerupoutside",Wt),T){let{cursor:mt,soundSrc:St,thumbSrc:ct,barSrc:Bt}=T,ne=()=>{mt&&(I.cursor=mt,G.cursor=mt),St&&r.audioStage.add({id:`hover-${Date.now()}`,url:St,loop:!1}),ct&&(G.texture=M.from(ct)),Bt&&(I.texture=M.from(Bt))},Zt=()=>{tt||(I.cursor="auto",G.cursor="auto",G.texture=O,I.texture=W)};A.on("pointerover",ne),A.on("pointerout",Zt),A.on("pointerupoutside",Zt)}A.addChild(I),A.addChild(G),t.addChild(A),Q({animations:i,targetId:l,animationBus:s,completionTracker:o,element:A,targetState:{x:h,y:c,alpha:f}})};var GP=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let h=t.children.find(g=>g.label===e.id);if(!h)return;h.zIndex=l;let c=()=>{if(!Et(e,i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let g=h.getChildByLabel(`${i.id}-bar`),p=h.getChildByLabel(`${i.id}-thumb`),b=!Et(e.hover,i.hover)||!Et(e.change,i.change)||e.min!==i.min||e.max!==i.max||e.step!==i.step||e.direction!==i.direction;if(g&&p){g.width=i.width,g.height=i.height;let y=0,_=i.direction==="horizontal"?i.height-y*2:i.width-y*2,S=i.thumbSrc?M.from(i.thumbSrc):M.EMPTY,E=S.width||16,w=S.height||16,T=_/E,C=_/w,A=Math.min(T,C);if(p.width=E*A,p.height=w*A,e.barSrc!==i.barSrc){let I=i.barSrc?M.from(i.barSrc):M.EMPTY;g.texture=I}if(e.thumbSrc!==i.thumbSrc){let I=i.thumbSrc?M.from(i.thumbSrc):M.EMPTY;p.texture=I}let P=i.max-i.min,R=(i.initialValue-i.min)/P;i.direction==="horizontal"?(p.x=R*(g.width-p.width),p.y=(g.height-p.height)/2):(p.x=(g.width-p.width)/2,p.y=R*(g.height-p.height))}if(b&&(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove")),b){let{hover:y,change:_,min:S,max:E,step:w,direction:T,initialValue:C}=i,A=C??S,P=E-S;h.eventMode="static";let R=W=>{let tt=(W-S)/P;T==="horizontal"?(p.x=tt*(g.width-p.width),p.y=(g.height-p.height)/2):(p.x=(g.width-p.width)/2,p.y=tt*(g.height-p.height))},I=W=>{let tt;if(T==="horizontal"){let yt=W.x-p.width/2;tt=Math.max(0,Math.min(1,yt/(g.width-p.width)))}else{let yt=W.y-p.height/2;tt=Math.max(0,Math.min(1,yt/(g.height-p.height)))}let et=S+tt*P;return w>0&&(et=Math.round((et-S)/w)*w+S,et=Math.max(S,Math.min(E,et))),et},F=p.texture,G=g.texture,z=!1,U=W=>{let tt=h.toLocal(W.global),et=I(tt);et!==A&&(A=et,R(A),_?.payload&&a&&a("change",{_event:{id:i.id,value:A},..._.payload}))},$=W=>{z=!0,U(W)},V=W=>{z&&U(W)},O=()=>{z&&(z=!1)};if(h.on("pointerdown",$),h.on("globalpointermove",V),h.on("pointerup",O),h.on("pointerupoutside",O),y){let{cursor:W,soundSrc:tt,thumbSrc:et,barSrc:yt}=y,Ut=()=>{W&&(h.cursor=W,p.cursor=W),tt&&r.audioStage.add({id:`hover-${Date.now()}`,url:tt,loop:!1}),et&&(p.texture=M.from(et)),yt&&(g.texture=M.from(yt))},Mt=()=>{z||(h.cursor="auto",p.cursor="auto",p.texture=F,g.texture=G)};h.on("pointerover",Ut),h.on("pointerout",Mt),h.on("pointerupoutside",Mt)}}}},{x:u,y:d,alpha:f}=i;Q({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,alpha:f},onComplete:c})||c()};var UP=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};Q({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var OP=({state:r})=>{let t=Ce(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValuei)throw new Error("Input error: slider initialValue must be between min and max");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var Bk=ue({type:"slider",add:kP,update:GP,delete:UP,parse:OP});var Sl=({container:r,element:t,interactive:e=!0,allowViewportWithoutScroll:i=!1})=>{let s=0,o=0;t.children.forEach(h=>{s=Math.max(h.width+h.x,s),o=Math.max(h.height+h.y,o)});let n=!!(t.height&&o>t.height),a=!!(t.width&&s>t.width);if((t.scroll||i)&&(n||a)){let h=new at({label:`${r.label}-content`});[...r.children].forEach(p=>{h.addChild(p)}),r.addChild(h);let u=new ce({label:`${r.label}-clip`}).rect(0,0,t.width||s,t.height||o).fill({color:16711680,alpha:0});r.addChild(u),h.mask=u;let d=-(o-(t.height||o)),f=-(s-(t.width||s)),m=t.anchorToBottom&&n?d:0,g=t.anchorToBottom&&a?f:0;t.anchorToBottom&&(h.y=m,h.x=g),e&&(r.eventMode="static",r.hitArea=new ot(0,0,t.width||s,t.height||o),r.on("wheel",p=>{if(p.preventDefault(),n&&p.deltaY!==0){let b=m-p.deltaY;b>0?m=0:b0?g=0:y{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel")};var LP=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,zIndex:a,completionTracker:l,signal:h})=>{let{id:c,x:u,y:d,children:f,scroll:m,alpha:g}=e,p=new at;if(p.label=c,p.zIndex=a,p.x=Math.round(u),p.y=Math.round(d),p.alpha=g,t.addChild(p),f&&f.length>0)for(let E of f){let w=n.find(T=>T.type===E.type);if(!w)throw new Error(`No plugin found for child element type: ${E.type}`);w.add({app:r,parent:p,element:E,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,completionTracker:l,signal:h})}(m||e.anchorToBottom)&&Sl({container:p,element:e,interactive:!!m,allowViewportWithoutScroll:!!e.anchorToBottom});let y=e?.hover,_=e?.click,S=e?.rightClick;if(y){let{cursor:E,soundSrc:w,payload:T}=y;p.eventMode="static";let C=()=>{T&&s&&s("hover",{_event:{id:p.label},...T}),E&&(p.cursor=E),w&&r.audioStage.add({id:`hover-${Date.now()}`,url:w,loop:!1})},A=()=>{p.cursor="auto"};p.on("pointerover",C),p.on("pointerout",A)}if(_){let{soundSrc:E,soundVolume:w,payload:T}=_;p.eventMode="static";let C=()=>{T&&s&&s("click",{_event:{id:p.label},...T}),E&&r.audioStage.add({id:`click-${Date.now()}`,url:E,loop:!1,volume:(w??1e3)/1e3})};p.on("pointerup",C)}if(S){let{soundSrc:E,payload:w}=S;p.eventMode="static";let T=()=>{w&&s&&s("rightClick",{_event:{id:p.label},...w}),E&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:E,loop:!1})};p.on("rightclick",T)}Q({animations:i,targetId:c,animationBus:o,completionTracker:l,element:p,targetState:{x:u,y:d,alpha:g}})};var wl=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of wl(e))t.add(i);return t};var DP=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let h of r)i.add(h.id),s.set(h.id,h);for(let h of t)i.add(h.id),o.set(h.id,h);for(let h of i){let c=s.get(h),u=o.get(h);if(!c&&u)n.push(u);else if(c&&!u)a.push(c);else{let d=wl(u),f=e instanceof Map?Array.from(e.keys()).some(m=>d.has(m)):e.find(m=>d.has(m.targetId));(!Et(c,u)||f)&&l.push({prev:c,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var Nu=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,Fk=r=>r,kk=r=>r*r,Gk=r=>1-(1-r)*(1-r),Uk=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,NP=Object.freeze({linear:Fk,easeInQuad:kk,easeOutQuad:Gk,easeInOutQuad:Uk,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let e=2.5949095;return r<.5?Math.pow(2*r,2)*((e+1)*2*r-e)/2:(Math.pow(2*r-2,2)*((e+1)*(r*2-2)+e)+2)/2},easeInBounce:r=>1-Nu(1-r),easeOutBounce:Nu,easeInOutBounce:r=>r<.5?(1-Nu(1-2*r))/2:(1+Nu(2*r-1))/2,easeInElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*t)},easeOutElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*t)+1},easeInOutElastic:r=>{let t=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*t))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*t)/2+1}}),nx=Object.freeze(Object.keys(NP)),Ok=(r="linear")=>{let t=NP[r];if(!t)throw new Error(`Unsupported easing: ${r}`);return t},El=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,t.push({time:e,value:s,easing:"linear"});return}o!==void 0&&(e+=o,i=a?i+s:s,t.push({time:e,value:i,easing:n}))}),t},Al=r=>{let t=0;for(let{timeline:e}of r){let i=e[e.length-1];i&&i.time>t&&(t=i.time)}return t},Pl=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e=i&&t<=n){let l=(t-i)/(n-i);return s+(a-s)*Ok(o)(l)}}return r[r.length-1].value};var Lk=new Set(["animated-sprite","text-revealing"]),Dk={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},lx=r=>Math.min(1,Math.max(0,r)),Hu=(r,t,e)=>{if(r===t)return er.getLocalBounds().rectangle.clone(),zP=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),HP=(r,t)=>{let e=zP(WP(t)),i=r.renderer.generateTexture({target:t,frame:e}),s=new kt(i);s.x=e.x,s.y=e.y;let o=new at;return o.x=t.x??0,o.y=t.y??0,o.scale.set(t.scale?.x??1,t.scale?.y??1),o.rotation=t.rotation??0,o.alpha=t.alpha??1,o.addChild(s),{wrapper:o,texture:i}},Nk=(r={})=>Object.entries(r).map(([t,e])=>({property:t,timeline:El([{value:e.initialValue??Dk[t]??0},...e.keyframes])})),Vu=(r,t,e)=>{if(!r||!t)return{duration:0,apply:()=>{}};let i=Nk(t),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:Al(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=Pl(a,o);switch(n){case"translateX":r.x=s.x+l*e.renderer.width;break;case"translateY":r.y=s.y+l*e.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},Hk=r=>El([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),Vk=(r,t)=>{let e=document.createElement("canvas");e.width=r,e.height=t;let i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:e,context:i}},Wk=(r,t,e="red")=>{switch(e){case"green":return r[t+1];case"blue":return r[t+2];case"alpha":return r[t+3];default:return r[t]}},ax=({app:r,texture:t,width:e,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(e*i),a=new kt(M.from(t));a.width=e,a.height=i;let l=new at;l.addChild(a);let h=hi.create({width:e,height:i});r.renderer.render({container:l,target:h,clear:!0});let c=r.renderer.extract.pixels(h).pixels;for(let u=0,d=0;u{let s=null;for(let o of t.items){let n=ax({app:r,texture:o.texture,width:e,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a{let s=Hk(t),o=Al([{timeline:s}]),n=Math.max(t?.softness??.001,1e-4);if(!t)return{duration:o,progressTimeline:s,sample:()=>0,destroy:()=>{}};if(t.kind==="single"){let l=ax({app:r,texture:t.texture,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1});return{duration:o,progressTimeline:s,sample:(h,c)=>Hu(h-n,h+n,l[c]/255),destroy:()=>{}}}if(t.kind==="sequence"){let l=t.textures.map(h=>ax({app:r,texture:h,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1}));return{duration:o,progressTimeline:s,sample:(h,c)=>{let u=lx(h)*Math.max(0,l.length-1);if(t.sample==="linear"&&l.length>1){let f=Math.floor(u),m=Math.min(l.length-1,f+1),g=u-f,p=(l[f][c]*(1-g)+l[m][c]*g)/255;return Hu(h-n,h+n,p)}let d=Math.min(l.length-1,Math.max(0,Math.round(u)));return Hu(h-n,h+n,l[d][c]/255)},destroy:()=>{}}}let a=zk(r,t,e,i);return{duration:o,progressTimeline:s,sample:(l,h)=>Hu(l-n,l+n,a[h]/255),destroy:()=>{}}},Xk=r=>{let t=new at;for(let e of r)e?.wrapper&&t.addChild(e.wrapper);return zP(WP(t))},VP=({app:r,container:t,target:e,frame:i})=>{r.renderer.render({container:t,target:e,clear:!0,transform:new k(1,0,0,1,-i.x,-i.y)})},Wu=r=>{r?.texture?.destroy(!0)},jk=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=new at;o.zIndex=s,e?.wrapper&&o.addChild(e.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=Vu(e?.wrapper??null,t.prev?.tween,r),a=Vu(i?.wrapper??null,t.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),Wu(e),Wu(i)}}},Yk=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=Xk([e,i]),n=new at,a=new at;e?.wrapper&&n.addChild(e.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=hi.create({width:o.width,height:o.height}),h=hi.create({width:o.width,height:o.height}),{canvas:c,context:u}=Vk(o.width,o.height),d=u.createImageData(o.width,o.height),f=M.from(c),m=new at;m.zIndex=s;let g=new kt(f);g.x=o.x,g.y=o.y,m.addChild(g);let p=$k(r,t.mask,o.width,o.height),b=Vu(e?.wrapper??null,t.prev?.tween,r),y=Vu(i?.wrapper??null,t.next?.tween,r),_=new Uint8ClampedArray(o.width*o.height*4);return{overlay:m,duration:Math.max(b.duration,y.duration,p.duration),apply:S=>{b.apply(S),y.apply(S);let E=_,w=_;e?.wrapper&&(VP({app:r,container:n,target:l,frame:o}),E=r.renderer.extract.pixels(l).pixels),i?.wrapper&&(VP({app:r,container:a,target:h,frame:o}),w=r.renderer.extract.pixels(h).pixels);let T=lx(Pl(p.progressTimeline,S)),C=d.data;for(let A=0,P=0;A{m.removeFromParent(),m.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),h.destroy(!0),f.destroy(!0),Wu(e),Wu(i),p.destroy()}}},qk=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>t.mask?Yk({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}):jk({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}),Kk=({app:r,parent:t,nextElement:e,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,zIndex:h,signal:c})=>{if(!e)return null;let u=i.add({app:r,parent:t,element:e,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,zIndex:h,signal:c});if(u&&typeof u.then=="function")throw new Error(`Replace animations do not support async add pipelines for "${e.type}" yet.`);return t.children.find(d=>d.label===e.id)??null},zu=({app:r,parent:t,prevElement:e,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:h,plugin:c,zIndex:u,signal:d})=>{if(!e&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(i&&Lk.has(i.type))throw new Error(`Replace animations are not supported for element type "${i.type}" yet.`);let f=e?t.children.find(E=>E.label===e.id)??null:null;if(e&&!f)throw new Error(`Replace animation "${s.id}" could not find the previous live element "${e.id}".`);let m=f?HP(r,f):null;f&&c.delete({app:r,parent:t,element:e,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:h,signal:d});let g=i?Kk({app:r,parent:t,nextElement:i,plugin:c,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:h,zIndex:u,signal:d}):null;if(i&&!g)throw new Error(`Replace animation "${s.id}" could not create the next live element "${i.id}".`);let p=g?HP(r,g):null;g&&(g.visible=!1);let b=qk({app:r,animation:s,prevSubject:m,nextSubject:p,zIndex:u});t.addChild(b.overlay);let y=a.getVersion();a.track(y);let _=!1,S=()=>{_||(_=!0,g&&!g.destroyed&&(g.visible=!0),b.destroy())};n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:b.duration,applyFrame:b.apply,applyTargetState:S,onComplete:()=>{a.complete(y),S()},onCancel:()=>{a.complete(y),S()},isValid:()=>!!b.overlay&&!b.overlay.destroyed&&(!g||!g.destroyed)}})};var Cl=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,signal:h})=>{t.sortableChildren=!0;let c=new Map(l.map(y=>[y.type,y])),u=pP(s),d=new Map;for(let y=0;y{let _=c.get(y);if(!_)throw new Error(`No plugin found for element type: ${y}`);return _},b=y=>t.children.find(_=>_.label===y)?.zIndex??-1;for(let y of t.children){let _=d.get(y.label);_!==void 0&&(y.zIndex=_)}for(let y of m){let _=Ou(u,y.id),S=p(y.type);if(_){zu({app:r,parent:t,prevElement:y,nextElement:null,animation:_,animations:u,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,plugin:S,zIndex:b(y.id),signal:h});continue}S.delete({app:r,parent:t,element:y,animations:u,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,signal:h})}for(let y of f){let _=Ou(u,y.id),S=p(y.type),E=d.get(y.id)??-1;if(_){zu({app:r,parent:t,prevElement:null,nextElement:y,animation:_,animations:u,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,plugin:S,zIndex:E,signal:h});continue}S.add({app:r,parent:t,element:y,animations:u,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,zIndex:E,signal:h})}for(let{prev:y,next:_}of g){let S=p(_.type),E=d.get(_.id)??-1,w=Ou(u,_.id);if(w){zu({app:r,parent:t,prevElement:y,nextElement:_,animation:w,animations:u,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,plugin:S,zIndex:E,signal:h});continue}S.update({app:r,parent:t,prevElement:y,nextElement:_,animations:u,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,zIndex:E,signal:h})}};var $P=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,zIndex:l,completionTracker:h,signal:c})=>{let u=t.children.find(b=>b.label===e.id);if(!u)return;u.zIndex=l;let{x:d,y:f,alpha:m}=i,g=()=>{if(!Et(e,i)){u.x=Math.round(d),u.y=Math.round(f),u.label=i.id,u.alpha=m,u.removeAllListeners("pointerover"),u.removeAllListeners("pointerout"),u.removeAllListeners("pointerup"),u.removeAllListeners("rightclick"),u.eventMode="auto",u.cursor="auto";let S=i?.hover,E=i?.click,w=i?.rightClick,T=!!(S||E||w);if(S){let{cursor:P,soundSrc:R,payload:I}=S;u.eventMode="static";let F=()=>{I&&s&&s("hover",{_event:{id:u.label},...I}),P&&(u.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},G=()=>{u.cursor="auto"};u.on("pointerover",F),u.on("pointerout",G)}if(E){let{soundSrc:P,soundVolume:R,payload:I}=E;u.eventMode="static";let F=()=>{I&&s&&s("click",{_event:{id:u.label},...I}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:(R??1e3)/1e3})};u.on("pointerup",F)}if(w){let{soundSrc:P,payload:R}=w;u.eventMode="static";let I=()=>{R&&s&&s("rightClick",{_event:{id:u.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};u.on("rightclick",I)}let C=e.scroll||e.anchorToBottom,A=i.scroll||i.anchorToBottom;C!==A?A?Sl({container:u,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom}):ox({container:u}):A&&(ox({container:u}),Sl({container:u,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom})),!i.scroll&&T&&(u.eventMode="static")}let b=!Et(e.children,i.children),y=wl({children:i.children}),_=Array.from(y).some(S=>Uu(o,S).length>0);if(b||_){let E=u.children.find(w=>w.label===`${i.id}-content`)||u;Cl({app:r,parent:E,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:h,signal:c})}};Q({animations:o,targetId:e.id,animationBus:n,completionTracker:h,element:u,targetState:{x:d,y:f,alpha:m},onComplete:()=>{g()}})||g()};var XP=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))};Q({animations:s,targetId:e.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var jP=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,h=0,c=0,u=0,d=0,f=0,m=0,g=0,p=0;for(let _=0;_0?e==="horizontal"?(E.x=h,E.y=f):e==="vertical"&&(E.x=m,E.y=c):(e==="horizontal"||e==="vertical")&&(E.x=0,E.y=0);let w=t.find(T=>T.type===E.type);if(w){let T=(E.scaleX??1)*(r.scaleX??1),C=(E.scaleY??1)*(r.scaleY??1);E=w.parse({state:{...E,scaleX:T,scaleY:C},parserPlugins:t})}e==="horizontal"?(r.width&&E.width+g>r.width&&!i&&!r.anchorToBottom?(h=0,g=0,f+=u+s,u=E.height,E.x=0,E.y=f):u=Math.max(u,E.height),h+=E.width+S,g=E.x+E.width,a=Math.max(h,a),l=Math.max(E.height+E.y,l)):e==="vertical"?(r.height&&E.height+p>r.height&&!i&&!r.anchorToBottom?(c=0,p=0,m+=d+s,d=E.width,E.x=m,E.y=0):d=Math.max(d,E.width),c+=E.height+S,p=E.y+E.height,a=Math.max(E.width+E.x,a),l=Math.max(c,l)):(a=Math.max(E.width+E.x,a),l=Math.max(E.height+E.y,l)),n.push(E)}let y={...Ce({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},rotation:r.rotation??0};return r.rightClick&&(y.rightClick=r.rightClick),y};var Zk=ue({type:"container",add:LP,update:$P,delete:XP,parse:jP});function hx(r,t){let e=r.text.substring(0,t),s=Jt.measureText(e,r.style).width;return r.x+s}var Qk=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&t?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),e()},r);s=()=>{clearTimeout(n),o(),i(t.reason)},t?.addEventListener("abort",s,{once:!0})}),cx=Qk;var ui=Symbol("textRevealRuntime"),Jk=18,tG=64,eG=1.25,YP=r=>typeof r=="number"&&r>0?r:1,rG=r=>{let t=new kt(M.EMPTY);if(r?.indicator?.revealing?.src){let e=M.from(r.indicator.revealing.src);t=new kt(e),t.width=r.indicator.revealing.width??e.width,t.height=r.indicator.revealing.height??e.height}return t},Rl=(r,t)=>{if(!t?.indicator?.complete?.src)return;let e=M.from(t.indicator.complete.src);r.texture=e,r.width=t.indicator.complete.width??e.width,r.height=t.indicator.complete.height??e.height},Xu=(r,t,e)=>{r.x=e,r.y=t?t.y+(t.lineMaxHeight-r.height):0},$u=(r,t,e)=>{if(!t||t.text.length===0){r.x=e;return}r.x=hx(t,t.text.length-1)+e},iG=(r,t)=>{if(r[ui]){let e=r[ui];delete r[ui],e()}r[ui]=t},ux=r=>{if(r[ui]){let e=r[ui];delete r[ui],e()}r.onRender=void 0,r.removeChildren().forEach(e=>{e.destroy({children:!0})})},qP=(r,t="",e="")=>{let i=new Ht(r.textStyle),s=new Di({text:t,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new Ht(r.furigana.textStyle);o=new Di({text:e,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},KP=(r,t)=>{let e=null,i=null,s=0,o=0,n=[];for(let a=0;a0){let f=h.getLocalBounds();n.push({chunk:l,container:h,lastTextObject:u,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else h.destroy()}return{lines:n,lastTextObject:e,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:r.getLocalBounds()}},sG=({contentContainer:r,indicatorSprite:t,element:e})=>{let i=e?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=KP(r,e);Xu(t,o,i),$u(t,s,i),Rl(t,e)},oG=async({contentContainer:r,indicatorSprite:t,element:e,signal:i})=>{let s=YP(e.speed??50),o=e?.indicator?.offset??12,n=Math.max(1,Math.floor(1e3/s)),a=Math.max(1,Math.floor(4e3/s));for(let l=0;l{let n=i?.indicator?.offset??12,a=YP(i.speed??50),{lines:l,lastTextObject:h,lastChunk:c,totalCharacters:u,maxLineHeight:d,bounds:f}=KP(t,i);if(Xu(e,c,n),l.length===0||u===0||!l.some(P=>P.bounds.width>0&&P.bounds.height>0)||!globalThis.document||!s)return $u(e,h,n),Rl(e,i),!1;let m=Math.max(Jk,Math.min(tG,Math.round(d*eG))),g=Math.max(1,Math.round(u/a*1e3)),p=l.map(P=>{let R=Math.max(1,P.totalCharacters),I=1+m/Math.max(1,P.bounds.width);return R*I}),b=p.reduce((P,R)=>P+R,0),y=[],_=0;for(let P=0;P0?_/b:0;_+=R,y.push({...l[P],startProgress:I,endProgress:b>0?_/b:1})}let S=o.getVersion(),E=`${i.id}-soft-wipe`,w=y.map(P=>{let R=document.createElement("canvas");R.width=Math.max(1,Math.ceil(P.bounds.width+m)),R.height=Math.max(1,Math.ceil(P.bounds.height));let I=R.getContext("2d");if(!I)return null;let F=xs(R),G=new kt(F);return G.x=Math.floor(P.bounds.x-m),G.y=Math.floor(P.bounds.y),P.container.mask=G,t.addChild(G),{canvas:R,context:I,texture:F,sprite:G,line:P}});if(w.some(P=>P===null))return w.forEach(P=>{P&&(P.line.container.mask===P.sprite&&(P.line.container.mask=null),P.sprite.parent&&P.sprite.parent.removeChild(P.sprite),P.sprite.destroy(),P.texture.destroy(!0))}),$u(e,h,n),Rl(e,i),!1;let T=!1,C=P=>{T||(T=!0,r[ui]===A&&delete r[ui],w.forEach(R=>{R.line.container.mask===R.sprite&&(R.line.container.mask=null),R.sprite.parent&&R.sprite.parent.removeChild(R.sprite),R.sprite.destroy(),R.texture.destroy(!0)}),P&&($u(e,h,n),Rl(e,i)))},A=()=>{s.dispatch({type:"CANCEL",id:E}),C(!1)};return iG(r,A),o.track(S),s.dispatch({type:"START",payload:{id:E,driver:"custom",duration:g,applyFrame:P=>{let R=g>0?Math.min(P/g,1):1,I=y[0],F=0;for(let G=0;Get&&(O.fillStyle="#ffffff",O.fillRect(et,yt,Math.min(Wt-et,z.bounds.width),z.bounds.height));let mt=Math.max(et,Mt-m),St=Math.min(et+z.bounds.width,Mt);if(St>mt){let ct=O.createLinearGradient(mt,0,St,0);ct.addColorStop(0,"rgba(255, 255, 255, 1)"),ct.addColorStop(1,"rgba(255, 255, 255, 0)"),O.fillStyle=ct,O.fillRect(mt,yt,St-mt,z.bounds.height)}tt.source.update(),(V<1||G===y.length-1)&&(I=z,F=Math.min(1,(Mt-et)/Math.max(1,z.bounds.width)))}Xu(e,I.chunk,n),e.x=I.bounds.x+Math.min(I.bounds.width,I.bounds.width*F)+n},applyTargetState:()=>{C(!1)},onComplete:()=>{o.complete(S),C(!0)},onCancel:()=>{o.complete(S),C(!1)},isValid:()=>!!r&&!r.destroyed&&!t.destroyed&&!e.destroyed}}),!0},ju=async({container:r,element:t,completionTracker:e,animationBus:i,zIndex:s,signal:o})=>{if(o?.aborted||r.destroyed)return;ux(r),r.zIndex=s;let n=new at({label:`${t.id}-content`}),a=rG(t);r.addChild(n),r.addChild(a);try{if(t.revealEffect==="softWipe"){if(!nG({container:r,contentContainer:n,indicatorSprite:a,element:t,animationBus:i,completionTracker:e})&&!o?.aborted&&!r.destroyed){let u=e.getVersion();e.track(u),e.complete(u)}return}let l=e.getVersion(),h=!1;e.track(l),t.revealEffect==="none"?(sG({contentContainer:n,indicatorSprite:a,element:t}),h=!0):h=await oG({contentContainer:n,indicatorSprite:a,element:t,signal:o}),h&&!o?.aborted&&!r.destroyed&&e.complete(l)}catch(l){if(l?.name!=="AbortError"&&!o?.aborted)throw l}};var ZP=async({parent:r,element:t,animations:e,animationBus:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new at;a.label=t.id,a.zIndex=o,t.x!==void 0&&(a.x=Math.round(t.x)),t.y!==void 0&&(a.y=Math.round(t.y)),t.alpha!==void 0&&(a.alpha=t.alpha),r.addChild(a),Q({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:a,targetState:{x:t.x??0,y:t.y??0,alpha:t.alpha??1}}),await ju({container:a,element:t,completionTracker:s,animationBus:i,zIndex:o,signal:n})};var QP=async({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,completionTracker:o,zIndex:n,signal:a})=>{if(a?.aborted)return;let l=r.children.find(u=>u.label===t.id);if(!l)return;let h=async()=>{e.x!==void 0&&(l.x=e.x),e.y!==void 0&&(l.y=e.y),e.alpha!==void 0&&(l.alpha=e.alpha),await ju({container:l,element:e,completionTracker:o,animationBus:s,zIndex:n,signal:a})};Q({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:l,targetState:{x:e.x??l.x,y:e.y??l.y,alpha:e.alpha??l.alpha},onComplete:()=>{h()}})||await h()};var JP=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(ux(o),o.destroy({children:!0}))};Q({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var aG=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,l=[...r],h=new WeakSet;for(;l.length>0;){let u=l[0];if(!u.text||u.text.length===0){l.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},m=Jt.measureText(u.text,new Ht(f));if(m.lineWidths[0]>d&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let g=m.lines[0];m.lines.length===1&&u.text.endsWith(" ")&&!g.endsWith(" ")&&(g+=" ");let p=Jt.measureText(g,new Ht({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:g,textStyle:f,height:p.height,x:s,y:o};if(u.furigana&&!h.has(u)){h.add(u);let _=Jt.measureText(u.furigana.text,new Ht(u.furigana.textStyle)),S=-_.height+o+2,E={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(m.lineWidths[0]-_.width)/2),y:S};b.furigana=E}i.push(b),n=Math.max(n,p.height),s+=Math.round(m.lineWidths[0]),a=Math.max(a,s);let y=m.lines.slice(1).join(" ");y&&y.length>0?u.text=y:l.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let u=0;u{let m=f.height;f.height&&delete f.height;let g=f.y+(d-m),p=f.furigana;return p&&(p.y=p.y-f.y+g),{...f,...p&&{furigana:p},y:g}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},tC=({state:r})=>{let t={...Se,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let m={...t,...c.furigana.textStyle||{}};m.lineHeight=Math.round(m.lineHeight*m.fontSize),r.width&&(m.wordWrapWidth=r.width,m.wordWrap=!0),d={text:String(c.furigana.text),textStyle:m}}return{text:String(c.text).replace(/ +$/,m=>"\xA0".repeat(m.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=aG(e,i),a=r.width||o,h=Ce({...r,width:a,height:n});if(h.alpha=r.alpha??1,r.indicator){let c=r.indicator;h.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...h,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var lG=ue({type:"text-revealing",add:ZP,update:QP,delete:JP,parse:tC});var Yu=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},qu=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var eC=async({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,zIndex:n,signal:a})=>{if(a?.aborted)return;let{id:l,x:h,y:c,width:u,height:d,spritesheetSrc:f,spritesheetData:m,animation:g,alpha:p}=e,b=m,y=Object.keys(b.frames),_=new Pi(M.from(f),b);if(await _.parse(),a?.aborted||t.destroyed)return;let S=g.frames.map(w=>_.textures[y[w]]),E=new Tl(S);E.label=l,E.zIndex=n,E.animationSpeed=g.animationSpeed??.5,E.loop=g.loop??!0,r.debug?Yu(E,l,r.debug):E.play(),E.x=Math.round(h),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(d),E.alpha=p,t.addChild(E),Q({animations:i,targetId:l,animationBus:s,completionTracker:o,element:E,targetState:{x:h,y:c,width:u,height:d,alpha:p}})};var rC=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let h=t.children.find(b=>b.label===e.id);if(!h)return;h.zIndex=a;let c=async()=>{if(!(l?.aborted||h.destroyed)&&!Et(e,i)&&(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,!Et(e.animation,i.animation))){h.animationSpeed=i.animation.animationSpeed??.5,h.loop=i.animation.loop??!0;let b=i.spritesheetData,y=Object.keys(b.frames),_=new Pi(M.from(i.spritesheetSrc),b);if(await _.parse(),l?.aborted||h.destroyed)return;let S=i.animation.frames.map(E=>_.textures[y[E]]);h.textures=S,r.debug?e.id!==i.id&&(qu(h),Yu(h,i.id,r.debug)):h.play()}},{x:u,y:d,width:f,height:m,alpha:g}=i;Q({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:h,targetState:{x:u,y:d,width:f,height:m,alpha:g},onComplete:()=>{c()}})||await c()};var iC=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;let a=()=>{r.debug&&qu(n),n&&!n.destroyed&&(n.stop(),n.destroy())};Q({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var sC=({state:r})=>({...Ce(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var hG=ue({type:"animated-sprite",add:eC,update:rC,delete:iC,parse:sC});var cG=rx({type:"tween"});var bs=new Map,uG=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:(r.volume??800)/1e3}),oC=r=>bs.has(r),Ml=r=>{let t=bs.get(r);t!==void 0&&(clearTimeout(t),bs.delete(r))},dx=({app:r,element:t})=>{let e=uG(t);if(Ml(e.id),t.delay&&t.delay>0){let i=setTimeout(()=>{bs.delete(e.id),r.audioStage.add(e)},t.delay);bs.set(e.id,i);return}r.audioStage.add(e)},fx=()=>{for(let r of bs.values())clearTimeout(r);bs.clear()},nC=({app:r,element:t})=>{dx({app:r,element:t})};var aC=({app:r,prevElement:t,nextElement:e})=>{let i=t.id;if((e.delay??0)>0){r.audioStage.remove(i),dx({app:r,element:e});return}if(oC(i)){Ml(i),r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}o.url=e.src,o.loop=e.loop??!1,o.volume=(e.volume??800)/1e3};var lC=({app:r,element:t})=>{Ml(t.id),r.audioStage.remove(t.id)};var dG=ix({type:"sound",add:nC,update:aC,delete:lC});var Il=class extends kt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function px(r){let t=new ce;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function mx(r){let t=new ce;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function gx(r){let t=new ce;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Bl(r,t,e){return r+(t-r)*e}function Zu(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function hC(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,l=t&255,h=Math.round(Bl(i,n,e)),c=Math.round(Bl(s,a,e)),u=Math.round(Bl(o,l,e));return h<<16|c<<8|u}var Ku=class r{constructor(t,e,i=!1){this.value=i?Zu(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?hC(e.value,e.next.value,i):Bl(e.value,e.next.value,i)}};var Qu=class{static type="alpha";constructor(t){this.list=new wr(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Ju=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var td=class{static type="scale";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},ed=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var fG=Math.PI/180,rd=class{static type="speed";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},id=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},sd=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*fG}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Nut=Math.PI/180,od=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},nd=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Ni=Math.PI/180,ad=class{static type="rotation";constructor(t){this.minStart=t.minStart*Ni,this.maxStart=t.maxStart*Ni,this.minSpeed=t.minSpeed*Ni,this.maxSpeed=t.maxSpeed*Ni,this.accel=(t.accel??0)*Ni}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},ld=class{static type="rotationStatic";constructor(t){this.min=t.min*Ni,this.max=t.max*Ni}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},hd=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Ni}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var cd=class{static type="color";constructor(t){this.list=new wr(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},ud=class{static type="colorStatic";constructor(t){this.color=Zu(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var dd=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},fd=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},xx=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},yx=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},pG={rect:dd,rectangle:dd,torus:fd,circle:fd,point:xx,line:yx};var pd=class{static type="spawnShape";constructor(t){let e=pG[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},md=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var cC=new Map,uC=new Map;function _x(r,t){cC.set(r,t)}function Re(r){uC.set(r.type,r)}function dC(r,t){let e=cC.get(r);return e?e(t):null}function fC(r){return uC.get(r)}_x("circle",gx);_x("snowflake",px);_x("raindrop",mx);Re(Qu);Re(Ju);Re(td);Re(ed);Re(rd);Re(id);Re(sd);Re(od);Re(nd);Re(ad);Re(ld);Re(hd);Re(cd);Re(ud);Re(pd);Re(md);var gd=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var Fl=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new gd(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=fC(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new Il(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.xs.x+s.width||e.ys.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function mG(r,t){let e=new ce,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var kl=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o,zIndex:n})=>{let a=new at;a.label=e.id,a.zIndex=n,t.addChild(a);let l=e.width,h=e.height;a.x=e.x??0,a.y=e.y??0;let c={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},u;if(typeof e.texture=="object"&&e.texture.shape)u=mG(r,e.texture);else{let m=e.texture??"circle";if(u=dC(m,r),!u)try{u=M.from(m)}catch{console.warn(`Failed to load particle texture: ${m}`);return}}c.texture=u;let d=new Fl(a,c);if(a.emitter=d,c.recycleOnBounds){let m=Math.min(e.count??100,c.maxParticles);d.spawn(m);let g=d._activeFirst;for(;g;)g.y=d.random()*h,g.age=d.random()*g.maxLife*.8,g=g.next}let f=m=>{if(d.destroyed){r.ticker.remove(f);return}d.update(m.deltaTime/60)};if(a.tickerCallback=f,r?.debug){let m=g=>{if(d.destroyed){window.removeEventListener("snapShotKeyFrame",m);return}g?.detail?.deltaMS&&d.update(Number(g.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",m),a.customTickerHandler=m}else r.ticker.add(f);e.alpha!==void 0&&(a.alpha=e.alpha),Q({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:a,targetState:{x:e.x??0,y:e.y??0,alpha:e.alpha}})};var xd=({app:r,parent:t,element:e,animationBus:i,animations:s,completionTracker:o})=>{let n=t.getChildByLabel(e.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};Q({animations:s,targetId:e.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var pC=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(c=>c.label===e.id);if(!l){kl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});return}if(l.zIndex=a,gG(e,i))xd({app:r,parent:t,element:e,animations:s,animationBus:o,completionTracker:n}),kl({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});else{let c=()=>{i.alpha!==void 0&&(l.alpha=i.alpha),i.x!==void 0&&(l.x=i.x),i.y!==void 0&&(l.y=i.y)};Q({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:l,targetState:{x:i.x??l.x,y:i.y??l.y,alpha:i.alpha??l.alpha},onComplete:c})||c()}};function gG(r,t){return r.count!==t.count||!Et(r.texture,t.texture)||!Et(r.behaviors,t.behaviors)||!Et(r.emitter,t.emitter)||r.width!==t.width||r.height!==t.height}function mC(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(ys).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(ys).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function gC(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function xC(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;tr.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function _C(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function bC(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var vC=({state:r})=>{mC(r),gC(r),xC(r),yC(r),_C(r),bC(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var xG=ue({type:"particles",add:kl,update:pC,delete:xd,parse:vC});var TC=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)e.add(l.id),i.set(l.id,l);for(let l of t)e.add(l.id),s.set(l.id,l);for(let l of e){let h=i.get(l),c=s.get(l);!h&&c?o.push(c):h&&!c?n.push(h):(h.src!==c.src||h.volume!==c.volume||h.loop!==c.loop||h.delay!==c.delay)&&a.push({prev:h,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var bx=({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=TC(t,e);for(let a of o){let l=i.find(h=>h.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(h=>h.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let h=i.find(c=>c.type===l.type);if(!h)throw new Error(`No audio plugin found for type: ${l.type}`);h.update({app:r,prevElement:a,nextElement:l})}};var Ze=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ze||{}),vx=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(vx||{}),yd=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(yd||{}),rt=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(rt||{}),jo=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(jo||{}),D=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(D||{}),di=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(di||{}),lt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(lt||{}),H=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(H||{}),dr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(dr||{}),Gl=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Gl||{}),Er=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Er||{}),Qe=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(Qe||{}),Hi=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Hi||{}),_d=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(_d||{}),Le=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Le||{}),ie=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(ie||{});var Rt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Rt||{}),Xe=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Xe||{});var Tx={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var K={ADAPTER:Tx,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Qf();var yG=Ei.default??Ei,Ar=yG(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Ps=qi(wC(),1),hL=qi(Sc(),1);var ry=qi(NM(),1);var HM={};function ft(r,t,e=3){if(HM[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t} +`,xn=null,oc=class{constructor(){xn||(xn=URL.createObjectURL(new Blob([oG],{type:"application/javascript"}))),this.worker=new Worker(xn)}};oc.revokeObjectURL=function(){xn&&(URL.revokeObjectURL(xn),xn=null)};var jC=0,xy,yy=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(e=>{let{worker:t}=new gn;t.addEventListener("message",i=>{t.terminate(),gn.revokeObjectURL(),e(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e,t){return this._run("loadImageBitmap",[e,t?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){xy===void 0&&(xy=navigator.hardwareConcurrency||4);let e=this._workerPool.pop();return!e&&this._createdWorkers{this._complete(t.data),this._returnWorker(t.target),this._next()})),e}_returnWorker(e){this._workerPool.push(e)}_complete(e){e.error!==void 0?this._resolveHash[e.uuid].reject(e.error):this._resolveHash[e.uuid].resolve(e.data),this._resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:e,arguments:t,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let e=this._getWorker();if(!e)return;let t=this._queue.pop(),i=t.id;this._resolveHash[jC]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:jC++,id:i})}},_y=new yy;Di();var nG=[".jpeg",".jpg",".png",".webp",".avif"],aG=["image/jpeg","image/png","image/webp","image/avif"];async function lG(r,e){let t=await j.get().fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);let i=await t.blob();return e?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var wd={name:"loadTextures",extension:{type:S.LoadParser,priority:Dt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return yr(r,aG)||_r(r,nG)},async load(r,e,t){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await _y.isImageBitmapSupported()?i=await _y.loadImageBitmap(r,e):i=await lG(r,e):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new jt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:e.data?.resolution||fn(r),...e.data});return pn(s,t,r)},unload(r){r.destroy(!0)}};U();km();Bm();var YC=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],cG=YC.map(r=>`video/${r.substring(1)}`);function uG(r,e,t){t===void 0&&!e.startsWith("data:")?r.crossOrigin=dG(e):t!==!1&&(r.crossOrigin=typeof t=="string"?t:"anonymous")}function hG(r){return new Promise((e,t)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),e()}function s(n){o(),t(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function dG(r,e=globalThis.location){if(r.startsWith("data:"))return"";e||(e=globalThis.location);let t=new URL(r,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}var qC={name:"loadVideo",extension:{type:S.LoadParser,name:"loadVideo"},test(r){let e=yr(r,cG),t=_r(r,YC);return e||t},async load(r,e,t){let i={...Po.defaultOptions,resolution:e.data?.resolution||fn(r),alphaMode:e.data?.alphaMode||await Qu(),...e.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let c=o[l];c!==void 0&&s.setAttribute(l,c)}),i.muted===!0&&(s.muted=!0),uG(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=Po.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let c=async()=>{let u=new Po({...i,resource:s});s.removeEventListener("canplay",c),e.data.preload&&await hG(s),l(pn(u,t,r))};s.addEventListener("canplay",c),s.appendChild(n)})},unload(r){r.destroy(!0)}};U();wo();U();wo();var Ed={extension:{type:S.ResolveParser,name:"resolveTexture"},test:wd.test,parse:r=>({resolution:parseFloat(rr.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var KC={extension:{type:S.ResolveParser,priority:-2,name:"resolveJson"},test:r=>rr.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Ed.parse};wo();Aa();ju();var Ad=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new rr,this.loader=new Sd,this.cache=Se,this._backgroundLoader=new vd(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){if(this._initialized){W("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let o=e.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let t=e.texturePreference?.resolution??1,i=typeof t=="number"?[t]:t,s=await this._detectFormats({preferredFormats:e.texturePreference?.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),e.preferences&&this.setPreferences(e.preferences)}add(e){this.resolver.add(e)}async load(e,t){this._initialized||await this.init();let i=Ss(e),s=Nt(e).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(c=>!this.resolver.hasKey(c))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,t);return i?n[s[0]]:n}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let i=!1;typeof e=="string"&&(i=!0,e=[e]);let s=this.resolver.resolveBundle(e),o={},n=Object.keys(s),a=0,l=0,c=()=>{t?.(++a/l)},u=n.map(h=>{let d=s[h];return l+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{o[h]=f})});return await Promise.all(u),i?o[e[0]]:o}async backgroundLoad(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);let t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);let t=this.resolver.resolveBundle(e);Object.values(t).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return Se.get(e);let t={};for(let i=0;i{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(c=>{o[c]=a}),Se.set(l,a)}),o}async unload(e){this._initialized||await this.init();let t=Nt(e).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(t);await this._unloadFromResolved(i)}async unloadBundle(e){this._initialized||await this.init(),e=Nt(e);let t=this.resolver.resolveBundle(e),i=Object.keys(t).map(s=>this._unloadFromResolved(t[s]));await Promise.all(i)}async _unloadFromResolved(e){let t=Object.values(e);t.forEach(i=>{Se.remove(i.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(let i of e.detections)e.skipDetections||await i.test()?t=await i.add(t):e.skipDetections||(t=await i.remove(t));return t=t.filter((i,s)=>t.indexOf(i)===s),t}get detections(){return this._detections}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(i=>i in e).forEach(i=>{t.config[i]=e[i]})})}},br=new Ad;V.handleByList(S.LoadParser,br.loader.parsers).handleByList(S.ResolveParser,br.resolver.parsers).handleByList(S.CacheParser,br.cache.parsers).handleByList(S.DetectionParser,br.detections);V.add(OC,LC,UC,VC,DC,NC,HC,WC,zC,$C,XC,wd,qC,FC,kC,Ed,KC);var ZC={loader:S.LoadParser,resolver:S.ResolveParser,cache:S.CacheParser,detection:S.DetectionParser};V.handle(S.Asset,r=>{let e=r.ref;Object.entries(ZC).filter(([t])=>!!e[t]).forEach(([t,i])=>V.add(Object.assign(e[t],{extension:e[t].extension??i})))},r=>{let e=r.ref;Object.keys(ZC).filter(t=>!!e[t]).forEach(t=>V.remove(e[t]))});ve();va();So();Ma();var nc=class r extends Te{constructor(...e){let t=e[0];Array.isArray(e[0])&&(t={textures:e[0],autoUpdate:e[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:c=null,textures:u,updateAnchor:h=!1,...d}=t,[f]=u;super({...d,texture:f instanceof k?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=h,this.onComplete=a,this.onFrameChange=l,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=u,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ht.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ht.shared.add(this.update,this,Dr.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(e){this.stop(),this.currentFrame=e}gotoAndPlay(e){this.currentFrame=e,this.play()}update(e){if(!this._playing)return;let t=e.deltaTime,i=this.animationSpeed*t,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrames)&&this.onLoop(),this._updateTexture())}_updateTexture(){let e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this.texture=this._textures[e],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(e){let t=[];for(let i=0;ithis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${e}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(ht.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ht.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Cu();Xe();Xu();var Pd=class extends Li{constructor(e,t){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:c,...u}=e;super({...u}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new St({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=c??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this.bounds.width),t!==void 0&&this._setHeight(t,this.bounds.height)}containsPoint(e){let t=this.bounds.width,i=this.bounds.height,s=-t*this.anchor.x,o=0;return e.x>=s&&e.x<=s+t&&(o=-i*this.anchor.y,e.y>=o&&e.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}};function QC(r,e){let t=r[0]??{};return(typeof t=="string"||r[1])&&(X(ie,`use new ${e}({ text: "hi!", style }) instead`),t={text:t,style:r[1]}),t}Qa();Bs();var Br=class extends Pd{constructor(...e){let t=QC(e,"Text");super(t,Oe),this.renderPipeId="text"}updateBounds(){let e=this._bounds,t=this._anchor,i=De.measureText(this._text,this._style),{width:s,height:o}=i;e.minX=-t._x*s,e.maxX=e.minX+s,e.minY=-t._y*o,e.maxY=e.minY+o}};xx();ge();ut();It();Fx();ve();Qh();Um();Pr();Qg();Ma();Qa();Bs();Pm();Mt();var fG=fs(mh(),1);V.add(cA,hA);var pG=new(window.AudioContext||window.webkitAudioContext),by={},mG=async(r,e)=>{if(!by[r]&&e.byteLength!==0)try{let t=await pG.decodeAudioData(e);by[r]=t}catch(t){console.error(`AudioAsset.load: Failed to decode ${r}:`,t)}},gG=r=>by[r],yn={load:mG,getAsset:gG};var et=({type:r,add:e,update:t,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:r,add:e,update:t,delete:i,parse:s,shouldUpdateUnchanged:o});var vy=({type:r})=>({type:r});var Ty=({type:r,add:e,update:t,delete:i})=>({type:r,add:e,update:t,delete:i});var Cd={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var Md={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var Us={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",SPRITESHEET_ANIMATION:"spritesheet-animation",VIDEO:"video"};var Ge={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var xG=(r={})=>{let e=typeof r.stroke=="object"&&r.stroke!==null?r.stroke:{};return{...e,color:r.strokeColor??e.color??Ge.strokeColor,width:r.strokeWidth??e.width??Ge.strokeWidth}},ir=(r={})=>{let{strokeColor:e,strokeWidth:t,stroke:i,...s}=r;return{...s,stroke:xG({strokeColor:e,strokeWidth:t,stroke:i})}};var Qr=(r,e)=>{let t={fill:e?.fill??Ge.fill,fontFamily:e?.fontFamily??Ge.fontFamily,fontSize:e?.fontSize??Ge.fontSize,align:e?.align??Ge.align,lineHeight:e?.lineHeight??Ge.lineHeight,wordWrap:e?.wordWrap??Ge.wordWrap,breakWords:e?.breakWords??Ge.breakWords,strokeColor:e?.strokeColor??Ge.strokeColor,strokeWidth:e?.strokeWidth??Ge.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Ge.wordWrapWidth};r.style=ir(t)};var We=(r,e=100)=>Math.min(Math.max(r??e,0),100)/100;var yG=(r,e)=>typeof e!="string"?e:r[e]??e,_G=(r,e,t,i)=>{let s=yG(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n{for(let i of e)for(let[s,o]of Object.entries(i.tween)){if(!Cd[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&_G(r,s,t,o.initialValue)}},Rd=({animations:r,animationBus:e,completionTracker:t,element:i,targetState:s,onComplete:o})=>{for(let n of r){for(let[l,c]of Object.entries(n.tween))if(c.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,l)))throw new Error(`Animation "${n.id}" cannot auto-resolve property "${l}" from targetState.`);let a=t.getVersion();t.track(a),e.dispatch({type:"START",payload:{id:n.id,element:i,properties:n.tween,targetState:s,onComplete:()=>{t.complete(a),o?.(n)}}})}};function Id(r,e){let t=r.text.substring(0,e),s=De.measureText(t,r.style).width;return r.x+s}var bG=async(r,e)=>new Promise((t,i)=>{if(e?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&e?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),t()},r);s=()=>{clearTimeout(n),o(),i(e.reason)},e?.addEventListener("abort",s,{once:!0})}),Sy=bG;var vi=Symbol("textRevealRuntime"),kd=Symbol("textRevealSnapshot"),vG=18,TG=64,SG=1.25,Ey=50,wG=0,Ay=100,wy=Ay-1,eM=10,EG=120,AG=.9,rM=(r=Ey)=>typeof r!="number"||!Number.isFinite(r)?Ey:Math.max(wG,Math.min(Ay,r)),PG=r=>rM(r)>=Ay,iM=r=>{let e=Math.min(rM(r),wy),i=(wy>0?e/wy:0)**AG;return eM*(EG/eM)**i},CG=r=>r?.revealEffect==="softWipe"?"softWipe":"typewriter",_n=r=>r?.revealEffect==="none"||PG(r?.speed??Ey),MG=r=>{let e=new Te(k.EMPTY);if(r?.indicator?.revealing?.src){let t=k.from(r.indicator.revealing.src);e=new Te(t),e.width=r.indicator.revealing.width??t.width,e.height=r.indicator.revealing.height??t.height}return e},lc=(r,e)=>{if(!e?.indicator?.complete?.src)return;let t=k.from(e.indicator.complete.src);r.texture=t,r.width=e.indicator.complete.width??t.width,r.height=e.indicator.complete.height??t.height},cc=(r,e,t)=>{r.x=t,r.y=e?e.y+(e.lineMaxHeight-r.height):0},Bd=(r,e,t)=>{if(!e||e.text.length===0){r.x=t;return}r.x=Id(e,e.text.length-1)+t},RG=(r,e)=>{if(r[vi]){let t=r[vi];delete r[vi],t()}r[vi]=e},IG=r=>r?.[kd]??null,ac=(r,e)=>r?e?(r[kd]=e,e):(delete r[kd],null):null,sM=r=>{let e=IG(r);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},oM=r=>!!sM(r),Py=r=>{if(r[vi]){let t=r[vi];delete r[vi],t()}delete r[kd],r.onRender=void 0,r.removeChildren().forEach(t=>{t.destroy({children:!0})})},nM=(r,e="",t="")=>{let i=new Oe(ir(r.textStyle)),s=new Br({text:e,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new Oe(ir(r.furigana.textStyle));o=new Br({text:t,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},aM=(r,e)=>{let t=null,i=null,s=0,o=0,n=[];for(let a=0;a0){let f=c.getLocalBounds();n.push({chunk:l,container:c,lastTextObject:h,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else c.destroy()}return{lines:n,lastTextObject:t,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:r.getLocalBounds()}},tM=({contentContainer:r,indicatorSprite:e,element:t})=>{let i=t?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=aM(r,t);cc(e,o,i),Bd(e,s,i),lc(e,t)},BG=({indicatorSprite:r,element:e})=>{let t=e?.indicator?.offset??12,i=e.content[0]??null;cc(r,i,t)},kG=async({contentContainer:r,indicatorSprite:e,element:t,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=iM(t.speed??50),a=t?.indicator?.offset??12,l=Math.max(1,Math.floor(1e3/n)),c=Math.max(1,Math.floor(4e3/n)),u=Math.max(0,Math.floor(s));o&&(o.revealedCharacters=u,o.completed=!1);for(let h=0;h0?Math.round(b/v.length*T):0;g.text=v.substring(0,b),_&&(_.text=x.substring(0,w)),u-=b,b>0&&(e.x=Id(g,b-1)+a);for(let E=b;E{let n=i?.indicator?.offset??12,a=iM(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d,bounds:f}=aM(e,i);if(cc(t,u,n),l.length===0||h===0||!l.some(C=>C.bounds.width>0&&C.bounds.height>0)||!globalThis.document||!s)return Bd(t,c,n),lc(t,i),!1;let p=Math.max(vG,Math.min(TG,Math.round(d*SG))),m=Math.max(1,Math.round(h/a*1e3)),g=l.map(C=>{let A=Math.max(1,C.totalCharacters),P=1+p/Math.max(1,C.bounds.width);return A*P}),_=g.reduce((C,A)=>C+A,0),v=[],x=0;for(let C=0;C0?x/_:0;x+=A,v.push({...l[C],startProgress:P,endProgress:_>0?x/_:1})}let T=o.getVersion(),b=`${i.id}-soft-wipe`,w=v.map(C=>{let A=document.createElement("canvas");A.width=Math.max(1,Math.ceil(C.bounds.width+p)),A.height=Math.max(1,Math.ceil(C.bounds.height));let P=A.getContext("2d");if(!P)return null;let R=Os(A),M=new Te(R);return M.x=Math.floor(C.bounds.x-p),M.y=Math.floor(C.bounds.y),C.container.mask=M,e.addChild(M),{canvas:A,context:P,texture:R,sprite:M,line:C}});if(w.some(C=>C===null))return w.forEach(C=>{C&&(C.line.container.mask===C.sprite&&(C.line.container.mask=null),C.sprite.parent&&C.sprite.parent.removeChild(C.sprite),C.sprite.destroy(),C.texture.destroy(!0))}),Bd(t,c,n),lc(t,i),!1;let E=!1,I=C=>{E||(E=!0,r[vi]===B&&delete r[vi],w.forEach(A=>{A.line.container.mask===A.sprite&&(A.line.container.mask=null),A.sprite.parent&&A.sprite.parent.removeChild(A.sprite),A.sprite.destroy(),A.texture.destroy(!0)}),C&&(Bd(t,c,n),lc(t,i)))},B=()=>{s.dispatch({type:"CANCEL",id:b}),I(!1)};return RG(r,B),o.track(T),s.dispatch({type:"START",payload:{id:b,driver:"custom",duration:m,applyFrame:C=>{let A=m>0?Math.min(C/m,1):1,P=v[0],R=0;for(let M=0;MJ&&(L.fillStyle="#ffffff",L.fillRect(J,Be,Math.min($e-J,F.bounds.width),F.bounds.height));let it=Math.max(J,Me-p),bt=Math.min(J+F.bounds.width,Me);if(bt>it){let Le=L.createLinearGradient(it,0,bt,0);Le.addColorStop(0,"rgba(255, 255, 255, 1)"),Le.addColorStop(1,"rgba(255, 255, 255, 0)"),L.fillStyle=Le,L.fillRect(it,Be,bt-it,F.bounds.height)}ue.source.update(),(N<1||M===v.length-1)&&(P=F,R=Math.min(1,(Me-J)/Math.max(1,F.bounds.width)))}cc(t,P.chunk,n),t.x=P.bounds.x+Math.min(P.bounds.width,P.bounds.width*R)+n},applyTargetState:()=>{I(!1)},onComplete:()=>{o.complete(T),I(!0)},onCancel:()=>{o.complete(T),I(!1)},isValid:()=>!!r&&!r.destroyed&&!e.destroyed&&!t.destroyed}}),!0},Ti=async({container:r,element:e,completionTracker:t,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;let a=_n(e),l=n==="resume"?sM(r):null;if(n==="resume"&&!l)return;Py(r),r.zIndex=s;let c=new te({label:`${e.id}-content`}),u=MG(e);r.addChild(c),r.addChild(u);try{if(n==="paused-initial"){a||ac(r,{mode:CG(e),revealedCharacters:0,completed:!1}),a?(ac(r,{mode:"none",completed:!0}),tM({contentContainer:c,indicatorSprite:u,element:e})):BG({indicatorSprite:u,element:e});return}let h=t.getVersion(),d=!1;if(a)t.track(h),ac(r,{mode:"none",completed:!0}),tM({contentContainer:c,indicatorSprite:u,element:e}),d=!0;else if(e.revealEffect==="softWipe")if(ac(r,{mode:"softWipe",completed:!1}),!FG({container:r,contentContainer:c,indicatorSprite:u,element:e,animationBus:i,completionTracker:t})&&!o?.aborted&&!r.destroyed)t.track(h),d=!0;else return;else{t.track(h);let f=ac(r,{mode:"typewriter",revealedCharacters:l?.revealedCharacters??0,completed:!1});d=await kG({contentContainer:c,indicatorSprite:u,element:e,signal:o,startAtCharacter:l?.revealedCharacters??0,snapshot:f})}d&&!o?.aborted&&!r.destroyed&&t.complete(h)}catch(h){if(h?.name!=="AbortError"&&!o?.aborted)throw h}};var Fd=({suppressAnimations:r=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:r,deferredMountOperations:e}),lM=r=>{switch(r?.type){case"play-animated-sprite":r.animatedSprite?.destroyed||r.animatedSprite?.play();return;case"play-video":r.video?.play();return;case"start-particles":if(r.app?.debug){let e=t=>{if(r.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",e);return}t?.detail?.deltaMS&&(r.emitter.update(Number(t.detail.deltaMS)/1e3),typeof r.app?.render=="function"&&r.app.render())};window.addEventListener("snapShotKeyFrame",e),r.container.customTickerHandler=e;return}r.app.ticker.add(r.tickerCallback);return;case"autoplay-text-reveal":Ti({container:r.container,element:r.element,completionTracker:r.completionTracker,animationBus:r.animationBus,zIndex:r.zIndex,signal:r.signal,playback:"autoplay"});return;case"start-update-animations":if(!r.element||r.element.destroyed)return;Rd({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},uc=(r,e)=>{if(e?.type){if(!r?.suppressAnimations){lM(e);return}r.deferredMountOperations.push(e)}},Od=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},cM=(r,e)=>uc(r,{type:"play-animated-sprite",animatedSprite:e}),uM=(r,e)=>uc(r,{type:"play-video",video:e}),hM=(r,{app:e,emitter:t,container:i,tickerCallback:s})=>uc(r,{type:"start-particles",app:e,emitter:t,container:i,tickerCallback:s}),Ud=(r,{container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>uc(r,{type:"autoplay-text-reveal",container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n}),dM=(r,{animations:e,animationBus:t,completionTracker:i,element:s,targetState:o})=>uc(r,{type:"start-update-animations",animations:e,animationBus:t,completionTracker:i,element:s,targetState:o}),fM=r=>{if(!r?.deferredMountOperations?.length)return;let e=r.deferredMountOperations.splice(0);for(let t of e)lM(t)};var pM=(r=[])=>{if(r instanceof Map)return r;let e=new Map;for(let t of r)e.has(t.targetId)||e.set(t.targetId,[]),e.get(t.targetId).push(t);return e},Gd=(r,e)=>r instanceof Map?r.get(e)??[]:r.filter(t=>t.targetId===e),OG=(r,e)=>Gd(r,e).filter(t=>t.type==="update"),Ld=(r,e)=>Gd(r,e).find(t=>t.type==="transition")??null,UG=({animations:r,targetId:e,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=OG(r,e);if(l.length===0)return!1;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return JC(s,l),dM(a,{animations:l,animationBus:t,completionTracker:i,element:s,targetState:o}),!0}return Rd({animations:l,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var ne=UG;var xM=Symbol("routeGraphicsTextAnchorRatios"),yM=Symbol("routeGraphicsTextLayoutState"),mM=(r,e)=>typeof r!="number"||r===0?0:e/r,Cy=r=>r?.align??Ge.align,gM=r=>{let e=r[yM];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:r.width},My=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},hc=r=>{let e=r.measuredWidth??r.width,t=My(r.width,e,Cy(r.textStyle));return{x:r.x+t,y:r.y}},Dd=(r,e)=>{let t=e.__fixedWidth&&typeof e.width=="number"?e.width:r.width||e.width,i=r.height||e.height,s=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:mM(t,e.originX),o=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:mM(i,e.originY);r[xM]={x:s,y:o},r[yM]={fixedWidth:!!e.__fixedWidth,layoutWidth:e.width}},GG=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?Ge.lineHeight:r.lineHeight/r.fontSize,LG=(r,e)=>{if(!e)return r;let t={...r,...e};if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??GG(r);t.lineHeight=Math.round(t.fontSize*i)}return t},Jr=(r,e,t)=>{let i=r[xM],s=gM(r),o=LG(e,t);if(!i){Qr(r,o);return}let n=My(s,r.width,Cy(r.style)),l=r.x-n+s*i.x,c=r.y+r.height*i.y;Qr(r,o);let u=gM(r),h=My(u,r.width,Cy(r.style));r.x=l-u*i.x+h,r.y=c-r.height*i.y},Nd=(r,e)=>{let t=hc({...e,measuredWidth:r.width,width:e.__fixedWidth&&typeof e.width=="number"?e.width:r.width});r.x=t.x,r.y=t.y};var _M=r=>{if(!(!r||typeof r!="object")){if(typeof r.button=="number")return r.button;if(typeof r.data?.button=="number")return r.data.button;if(typeof r.nativeEvent?.button=="number")return r.nativeEvent.button}},nt=r=>{let e=_M(r);return e===void 0||e===0},bM=r=>_M(r)===2;var Ry=Symbol.for("routeGraphics.setInheritedHover"),vM=Symbol.for("routeGraphics.treeInheritedHoverActive"),Iy=Symbol.for("routeGraphics.setInheritedPress"),TM=Symbol.for("routeGraphics.treeInheritedPressActive"),By=Symbol.for("routeGraphics.setInheritedRightPress"),SM=Symbol.for("routeGraphics.treeInheritedRightPressActive"),bn=r=>Array.isArray(r?.children)?r.children:[],ky=({displayObject:r,symbol:e,source:t,isActive:i})=>{let s=r?.[e];typeof s=="function"&&s(t,i)},Hd=({displayObject:r,symbol:e})=>{r&&e in r&&delete r[e]},Fy=({displayObject:r,symbol:e,onStateChange:t})=>{let i=!1,s=new Set,o=({nextDirectActive:n=i,onInheritedChange:a})=>{let l=i||s.size>0;i=n,a?.(s);let c=i||s.size>0;return l!==c&&t(c),c};return r[e]=(n,a)=>o({onInheritedChange:l=>{if(n){if(a){l.add(n);return}l.delete(n)}}}),{setDirectState:n=>o({nextDirectActive:n}),isActive:()=>i||s.size>0,destroy:()=>{Hd({displayObject:r,symbol:e})}}},vn=r=>Hd({displayObject:r,symbol:Ry}),Vd=r=>Hd({displayObject:r,symbol:Iy}),Wd=r=>Hd({displayObject:r,symbol:By}),ei=({displayObject:r,onHoverChange:e})=>{let t=Fy({displayObject:r,symbol:Ry,onStateChange:e});return{setDirectHover:t.setDirectState,isHovering:t.isActive,destroy:t.destroy}},Ji=({displayObject:r,onPressChange:e})=>{let t=Fy({displayObject:r,symbol:Iy,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},es=({displayObject:r,onPressChange:e})=>{let t=Fy({displayObject:r,symbol:By,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},Oy=r=>r?.[vM]===!0,Uy=r=>r?.[TM]===!0,Gy=r=>r?.[SM]===!0,Tn=({root:r,isHovered:e})=>{if(!r)return;r[vM]=e;let t=[...bn(r)];for(;t.length>0;){let i=t.pop();ky({displayObject:i,symbol:Ry,source:r,isActive:e}),t.push(...bn(i))}},Gs=({root:r,isPressed:e})=>{if(!r)return;r[TM]=e;let t=[...bn(r)];for(;t.length>0;){let i=t.pop();ky({displayObject:i,symbol:Iy,source:r,isActive:e}),t.push(...bn(i))}},Si=({root:r,isPressed:e})=>{if(!r)return;r[SM]=e;let t=[...bn(r)];for(;t.length>0;){let i=t.pop();ky({displayObject:i,symbol:By,source:r,isActive:e}),t.push(...bn(i))}};var wM=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=new Br({label:t.id});c.zIndex=l,c.text=t.content,Qr(c,t.textStyle),Dd(c,t),c.alpha=t.alpha,Nd(c,t);let u=t?.hover,h=t?.click,d=t?.rightClick,f=null,p=null,m=null,g=()=>{let _=f?.isHovering()??!1,v=p?.isPressed()??!1;(m?.isPressed()??!1)&&d?.textStyle?Jr(c,t.textStyle,d.textStyle):v&&h?.textStyle?Jr(c,t.textStyle,h.textStyle):_&&u?.textStyle?Jr(c,t.textStyle,u.textStyle):Jr(c,t.textStyle)};if(u){let{cursor:_,soundSrc:v,payload:x}=u;c.eventMode="static",f=ei({displayObject:c,onHoverChange:g});let T=()=>{f.setDirectHover(!0),x&&s&&s("hover",{_event:{id:c.label},...x}),_&&(c.cursor=_),v&&r.audioStage.add({id:`hover-${Date.now()}`,url:v,loop:!1})},b=()=>{f.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",T),c.on("pointerout",b)}if(h){let{soundSrc:_,soundVolume:v,payload:x}=h;c.eventMode="static",p=Ji({displayObject:c,onPressChange:g});let T=E=>{nt(E)&&p.setDirectPress(!0)},b=E=>{nt(E)&&(p.setDirectPress(!1),x&&s&&s("click",{_event:{id:c.label},...x}),_&&r.audioStage.add({id:`click-${Date.now()}`,url:_,loop:!1,volume:We(v)}))},w=()=>{p.setDirectPress(!1)};c.on("pointerdown",T),c.on("pointerup",b),c.on("pointerupoutside",w)}if(d){let{soundSrc:_,payload:v}=d;c.eventMode="static",m=es({displayObject:c,onPressChange:g});let x=()=>{m.setDirectPress(!0)},T=()=>{m.setDirectPress(!1)},b=()=>{m.setDirectPress(!1),v&&s&&s("rightClick",{_event:{id:c.label},...v}),_&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:_,loop:!1})},w=()=>{m.setDirectPress(!1)};c.on("rightdown",x),c.on("rightup",T),c.on("rightclick",b),c.on("rightupoutside",w)}e.addChild(c),ne({animations:i,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{...hc(t),alpha:t.alpha},renderContext:a})};var DG=Object.prototype.hasOwnProperty,pe=(r,e)=>{if(Object.is(r,e))return!0;if(r===null||e===null||typeof r!="object"||typeof e!="object")return!1;let t=Array.isArray(r),i=Array.isArray(e);if(t!==i)return!1;if(t&&i){if(r.length!==e.length)return!1;for(let n=0;n{let c=e.children.find(f=>f.label===t.id);if(!c)return;c.zIndex=l;let{alpha:u}=i,h=()=>{if(!pe(t,i)){c.text=i.content,Qr(c,i.textStyle),Dd(c,i),Nd(c,i),c.alpha=u,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),vn(c),Vd(c),Wd(c);let f=i?.hover,p=i?.click,m=i?.rightClick,g=null,_=null,v=null,x=()=>{let T=g?.isHovering()??!1,b=_?.isPressed()??!1;(v?.isPressed()??!1)&&m?.textStyle?Jr(c,i.textStyle,m.textStyle):b&&p?.textStyle?Jr(c,i.textStyle,p.textStyle):T&&f?.textStyle?Jr(c,i.textStyle,f.textStyle):Jr(c,i.textStyle)};if(f){let{cursor:T,soundSrc:b,payload:w}=f;c.eventMode="static",g=ei({displayObject:c,onHoverChange:x});let E=()=>{g.setDirectHover(!0),w&&s&&s("hover",{_event:{id:c.label},...w}),T&&(c.cursor=T),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1})},I=()=>{g.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",E),c.on("pointerout",I)}if(p){let{soundSrc:T,soundVolume:b,payload:w}=p;c.eventMode="static",_=Ji({displayObject:c,onPressChange:x});let E=C=>{nt(C)&&_.setDirectPress(!0)},I=C=>{nt(C)&&(_.setDirectPress(!1),w&&s&&s("click",{_event:{id:c.label},...w}),T&&r.audioStage.add({id:`click-${Date.now()}`,url:T,loop:!1,volume:We(b)}))},B=()=>{_.setDirectPress(!1)};c.on("pointerdown",E),c.on("pointerup",I),c.on("pointerupoutside",B)}if(m){let{soundSrc:T,payload:b}=m;c.eventMode="static",v=es({displayObject:c,onPressChange:x});let w=()=>{v.setDirectPress(!0)},E=()=>{v.setDirectPress(!1)},I=()=>{v.setDirectPress(!1),b&&s&&s("rightClick",{_event:{id:c.label},...b}),T&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:T,loop:!1})},B=()=>{v.setDirectPress(!1)};c.on("rightdown",w),c.on("rightup",E),c.on("rightclick",I),c.on("rightupoutside",B)}}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:a,element:c,targetState:{...hc(i),alpha:u},onComplete:()=>{h()}})||h()};var AM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var PM=({positionX:r=0,positionY:e=0,width:t,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof t!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:t*s,y:i*o},a=r-n.x,l=e-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var yt=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(Us).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Us).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let e=r.scaleX?r.scaleX*r.width:r.width,t=r.scaleY?r.scaleY*r.height:r.height;r.type===Us.CONTAINER&&(e=r.width,t=r.height);let{x:i,y:s,originX:o,originY:n}=PM({positionX:r.x,positionY:r.y,width:e,height:t,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(e),height:Math.round(t),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var CM=({state:r})=>{let e={...Ge,...r.textStyle};e.lineHeight=Math.round(e.fontSize*e.lineHeight),typeof r.width=="number"&&(e.wordWrapWidth=r.width,e.wordWrap=!0);let t=String(r.content??""),{width:i,height:s}=De.measureText(t,new Oe(ir(e))),o=Math.round(i),n=Math.round(s),a=typeof r.width=="number"?Math.round(r.width):o,c={...yt({...r,width:a,height:n}),content:t,measuredWidth:o,textStyle:{...e},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}};return Object.defineProperties(c,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),c};var NG=et({type:"text",add:wM,update:EM,delete:AM,parse:CM});var MM="__rtglRectScrollHandled",zd=({canvas:r,rect:e,width:t,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1;e.eventMode="static",e.hitArea=new Q(0,0,Math.round(t),Math.round(i));let l=(f,p)=>{p?.[MM]||(p&&(p[MM]=!0),f<0&&s?.payload&&n?n("scrollUp",{_event:{id:e.label},...s.payload}):f>0&&o?.payload&&n&&n("scrollDown",{_event:{id:e.label},...o.payload}))},c=()=>{a=!0},u=()=>{a=!1},h=f=>{f.preventDefault?.(),l(f.deltaY,f.nativeEvent)},d=f=>{a&&(f.preventDefault(),l(f.deltaY,f))};e.on("pointerover",c),e.on("pointerout",u),e.on("wheel",h),r?.addEventListener("wheel",d,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",c),e.off("pointerout",u),e.off("wheel",h),r?.removeEventListener("wheel",d),e.hitArea=null,delete e._cleanupScrollInteraction}};var HG=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,RM=({app:r,parent:e,element:t,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:c,x:u,y:h,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:v}=t,x=new Ue;x.label=c,x.zIndex=n;let T={x:u,y:h,alpha:g};_!==void 0&&(T.scaleX=_),v!==void 0&&(T.scaleY=v),(()=>{x.clear(),x.rect(0,0,Math.round(d),Math.round(f)).fill(HG(p)),x.x=Math.round(u),x.y=Math.round(h),x.alpha=g,x.scale.x=1,x.scale.y=1,m&&x.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)})})();let w=t?.hover,E=t?.click,I=t?.rightClick,B=t?.scrollUp,C=t?.scrollDown,A=t?.drag;if(w){let{cursor:P,soundSrc:R,payload:M}=w;x.eventMode="static";let F=()=>{M&&o&&o("hover",{_event:{id:x.label},...M}),P&&(x.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},O=()=>{x.cursor="auto"};x.on("pointerover",F),x.on("pointerout",O)}if(E){let{soundSrc:P,soundVolume:R,payload:M}=E;x.eventMode="static";let F=O=>{nt(O)&&(M&&o&&o("click",{_event:{id:x.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:We(R)}))};x.on("pointerup",F)}if(I){let{soundSrc:P,payload:R}=I;x.eventMode="static";let M=()=>{R&&o&&o("rightClick",{_event:{id:x.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};x.on("rightclick",M)}if((B||C)&&zd({canvas:r.canvas,rect:x,width:d,height:f,scrollUpEvent:B,scrollDownEvent:C,eventHandler:o}),A){let{start:P,end:R,move:M}=A;x.eventMode="static";let F=()=>{x._isDragging=!0,P&&o&&o("dragStart",{_event:{id:x.label},...typeof P?.payload=="object"?P.payload:{}})},O=()=>{x._isDragging=!1,R&&o&&o("dragEnd",{_event:{id:x.label},...typeof R?.payload=="object"?R.payload:{}})},D=N=>{M&&o&&x._isDragging&&o("dragMove",{_event:{id:x.label,x:N.global.x,y:N.global.y},...typeof M?.payload=="object"?M.payload:{}})};x.on("pointerdown",F),x.on("pointerup",O),x.on("globalpointermove",D),x.on("pointerupoutside",O)}e.addChild(x),ne({animations:i,targetId:c,animationBus:s,completionTracker:a,element:x,targetState:T,renderContext:l})};var VG=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,IM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=e.children.find(w=>w.label===t.id);if(!c)return;c.zIndex=a;let{x:u,y:h,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:v}=i,x={x:u,y:h,alpha:g};_!==void 0&&(x.scaleX=_),v!==void 0&&(x.scaleY=v);let T=()=>{if(!pe(t,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(d),Math.round(f)).fill(VG(p)),c.x=Math.round(u),c.y=Math.round(h),c.alpha=g,c.scale.x=1,c.scale.y=1,m&&c.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightclick"),c.removeAllListeners("wheel"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove"),c.removeAllListeners("pointerupoutside");let w=i?.hover,E=i?.click,I=i?.rightClick,B=i?.scrollUp,C=i?.scrollDown,A=i?.drag;if(w){let{cursor:P,soundSrc:R,payload:M}=w;c.eventMode="static";let F=()=>{M&&n&&n("hover",{_event:{id:c.label},...M}),P&&(c.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},O=()=>{c.cursor="auto"};c.on("pointerover",F),c.on("pointerout",O)}if(E){let{soundSrc:P,soundVolume:R,payload:M}=E;c.eventMode="static";let F=O=>{nt(O)&&(M&&n&&n("click",{_event:{id:c.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:We(R)}))};c.on("pointerup",F)}if(I){let{soundSrc:P,payload:R}=I;c.eventMode="static";let M=()=>{R&&n&&n("rightClick",{_event:{id:c.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};c.on("rightclick",M)}if((B||C)&&zd({canvas:r.canvas,rect:c,width:d,height:f,scrollUpEvent:B,scrollDownEvent:C,eventHandler:n}),A){let{start:P,end:R,move:M}=A;c.eventMode="static";let F=()=>{c._isDragging=!0,P&&n&&n("dragStart",{_event:{id:c.label},...typeof P?.payload=="object"?P.payload:{}})},O=()=>{c._isDragging=!1,R&&n&&n("dragEnd",{_event:{id:c.label},...typeof R?.payload=="object"?R.payload:{}})},D=N=>{M&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:N.global.x,y:N.global.y},...typeof M?.payload=="object"?M.payload:{}})};c.on("pointerdown",F),c.on("pointerup",O),c.on("globalpointermove",D),c.on("pointerupoutside",O)}}};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:l,element:c,targetState:x,onComplete:()=>{T()}})||T()};var BM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var kM=({state:r})=>{let e=yt(r),t=r.border?.width,i=e;return typeof t=="number"&&t>0&&(i={...e,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:t}}),{...i,...r.fill!==void 0?{fill:r.fill}:{},...r.scaleX!==void 0?{scaleX:r.scaleX}:{},...r.scaleY!==void 0?{scaleY:r.scaleY}:{},rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}}};var WG=et({type:"rect",add:RM,update:IM,delete:BM,parse:kM});var FM=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,src:p,alpha:m}=t,g=p?k.from(p):k.EMPTY,_=new Te(g);_.label=c,_.zIndex=l,_.x=Math.round(u),_.y=Math.round(h),_.width=Math.round(d),_.height=Math.round(f),_.alpha=m;let v=t?.hover,x=t?.click,T=t?.rightClick,b=null,w=null,E=null,I=()=>{let B=b?.isHovering()??!1,C=w?.isPressed()??!1;if((E?.isPressed()??!1)&&T?.src){let P=k.from(T.src);_.texture=P}else if(C&&x?.src){let P=k.from(x.src);_.texture=P}else if(B&&v?.src){let P=k.from(v.src);_.texture=P}else _.texture=g};if(v){let{cursor:B,soundSrc:C,payload:A}=v;_.eventMode="static",b=ei({displayObject:_,onHoverChange:I});let P=()=>{b.setDirectHover(!0),A&&s&&s("hover",{_event:{id:_.label},...A}),B&&(_.cursor=B),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1})},R=()=>{b.setDirectHover(!1),_.cursor="auto"};_.on("pointerover",P),_.on("pointerout",R)}if(x){let{soundSrc:B,soundVolume:C,payload:A}=x;_.eventMode="static",w=Ji({displayObject:_,onPressChange:I});let P=F=>{nt(F)&&w.setDirectPress(!0)},R=F=>{nt(F)&&(w.setDirectPress(!1),A&&s&&s("click",{_event:{id:_.label},...A}),B&&r.audioStage.add({id:`click-${Date.now()}`,url:B,loop:!1,volume:We(C)}))},M=()=>{w.setDirectPress(!1)};_.on("pointerdown",P),_.on("pointerup",R),_.on("pointerupoutside",M)}if(T){let{soundSrc:B,payload:C}=T;_.eventMode="static",E=es({displayObject:_,onPressChange:I});let A=()=>{E.setDirectPress(!0)},P=()=>{E.setDirectPress(!1)},R=()=>{E.setDirectPress(!1),C&&s&&s("rightClick",{_event:{id:_.label},...C}),B&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:B,loop:!1})},M=()=>{E.setDirectPress(!1)};_.on("rightdown",A),_.on("rightup",P),_.on("rightclick",R),_.on("rightupoutside",M)}e.addChild(_),ne({animations:i,targetId:c,animationBus:o,completionTracker:n,element:_,targetState:{x:u,y:h,width:d,height:f,alpha:m},renderContext:a})};var OM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(x=>x.label===t.id);if(!c)return;c.zIndex=l;let{id:u,x:h,y:d,width:f,height:p,src:m,alpha:g}=i,_=()=>{if(!pe(t,i)){let x=m?k.from(m):k.EMPTY;c.texture=x,c.x=Math.round(h),c.y=Math.round(d),c.width=Math.round(f),c.height=Math.round(p),c.alpha=g,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),vn(c),Vd(c),Wd(c);let T=i?.hover,b=i?.click,w=i?.rightClick,E=null,I=null,B=null,C=()=>{let A=E?.isHovering()??!1,P=I?.isPressed()??!1;if((B?.isPressed()??!1)&&w?.src){let M=k.from(w.src);c.texture=M}else if(P&&b?.src){let M=k.from(b.src);c.texture=M}else if(A&&T?.src){let M=k.from(T.src);c.texture=M}else c.texture=x};if(T){let{cursor:A,soundSrc:P,payload:R}=T;c.eventMode="static",E=ei({displayObject:c,onHoverChange:C});let M=()=>{E.setDirectHover(!0),R&&a&&a("hover",{_event:{id:c.label},...R}),A&&(c.cursor=A),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},F=()=>{E.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",M),c.on("pointerout",F)}if(b){let{soundSrc:A,soundVolume:P,payload:R}=b;c.eventMode="static",I=Ji({displayObject:c,onPressChange:C});let M=D=>{nt(D)&&I.setDirectPress(!0)},F=D=>{nt(D)&&(I.setDirectPress(!1),R&&a&&a("click",{_event:{id:c.label},...R}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:We(P)}))},O=()=>{I.setDirectPress(!1)};c.on("pointerdown",M),c.on("pointerup",F),c.on("pointerupoutside",O)}if(w){let{soundSrc:A,payload:P}=w;c.eventMode="static",B=es({displayObject:c,onPressChange:C});let R=()=>{B.setDirectPress(!0)},M=()=>{B.setDirectPress(!1)},F=()=>{B.setDirectPress(!1),P&&a&&a("rightClick",{_event:{id:c.label},...P}),A&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:A,loop:!1})},O=()=>{B.setDirectPress(!1)};c.on("rightdown",R),c.on("rightup",M),c.on("rightclick",F),c.on("rightupoutside",O)}}};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:g},onComplete:()=>{_()}})||_()};var UM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var GM=({state:r})=>({...yt(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var zG=et({type:"sprite",add:FM,update:OM,delete:UM,parse:GM});var $G=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,Ly=({videoElement:r,video:e})=>{e&&r?._videoEndedListener&&e.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},$d=({videoElement:r,video:e,loop:t,completionTracker:i})=>{if(Ly({videoElement:r,video:e}),(t??!1)||$G(e))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};e.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var LM=({parent:r,element:e,renderContext:t,completionTracker:i,zIndex:s})=>{let{id:o,x:n,y:a,width:l,height:c,src:u,volume:h,loop:d,alpha:f}=e,p=k.from(u),m=p.source.resource;m.pause(),m.currentTime=0,m.loop=d??!1,m.volume=We(h),m.muted=!1;let g=new Te(p);g.label=o,g.zIndex=s,g._videoEndedListener=void 0,g._playbackStateVersion=null,g.x=Math.round(n),g.y=Math.round(a),g.width=Math.round(l),g.height=Math.round(c),g.alpha=f??1,$d({videoElement:g,video:m,loop:d,completionTracker:i}),uM(t,m),r.addChild(g)};var DM=({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(g=>g.label===e.id);if(!l)return;l.zIndex=a;let{x:c,y:u,width:h,height:d,alpha:f}=t,p=()=>{if(!pe(e,t)){l.x=Math.round(c),l.y=Math.round(u),l.width=Math.round(h),l.height=Math.round(d),l.alpha=f??1;let g=l.texture.source.resource;if(e.src!==t.src){let _=g;Ly({videoElement:l,video:_}),_&&_.pause();let v=k.from(t.src);l.texture=v,g=v.source.resource,g.muted=!1,g.pause(),g.currentTime=0}$d({videoElement:l,video:g,loop:t.loop,completionTracker:n}),g.volume=We(t.volume),g.loop=t.loop??!1,e.src!==t.src&&g.play()}};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:u,width:h,height:d,alpha:f??1},onComplete:p})||p()};var NM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.children.find(l=>l.label===e.id);if(!o)return;let n=()=>{if(o&&!o.destroyed){o._playbackStateVersion!==null&&s.complete(o._playbackStateVersion);let l=o.texture.source.resource;l&&(o._videoEndedListener&&l.removeEventListener("ended",o._videoEndedListener),l.pause()),r.removeChild(o),o.destroy()}};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var HM=({state:r})=>({...yt(r),src:r.src,volume:r.volume??100,loop:r.loop??!1});var XG=et({type:"video",add:LM,update:DM,delete:NM,parse:HM});var VM=0,WM=16,jG=(r,e)=>r!==null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,e),Ny=r=>Math.max(0,Math.min(1,r)),Ls=r=>r?k.from(r):k.EMPTY,Sn=r=>({bar:`${r}-bar`,inactiveBar:`${r}-inactive-bar`,barMask:`${r}-bar-mask`,thumb:`${r}-thumb`}),$M=({sliderContainer:r,fromId:e,toId:t})=>{if(e===t)return;let i=Sn(e),s=Sn(t);for(let[o,n]of Object.entries(i)){let a=r.getChildByLabel(n);a&&(a.label=s[o])}},wn=({sliderContainer:r,id:e})=>{let t=Sn(e);return{bar:r.getChildByLabel(t.bar),inactiveBar:r.getChildByLabel(t.inactiveBar),barMask:r.getChildByLabel(t.barMask),thumb:r.getChildByLabel(t.thumb)}},Dy=({baseValue:r,override:e,key:t})=>jG(e,t)?e[t]??"":r??"",YG=(r,e=null)=>({thumbSrc:Dy({baseValue:r.thumbSrc,override:e,key:"thumbSrc"}),barSrc:Dy({baseValue:r.barSrc,override:e,key:"barSrc"}),inactiveBarSrc:Dy({baseValue:r.inactiveBarSrc,override:e,key:"inactiveBarSrc"})}),qG=r=>{let e=new Te(k.EMPTY);return e.label=r,e.eventMode="static",e.zIndex=0,e},KG=r=>{let e=new Ue;return e.label=r,e.zIndex=0,e},ZG=({sliderContainer:r,id:e,bar:t})=>{let i=Sn(e),{inactiveBar:s,barMask:o}=wn({sliderContainer:r,id:e});return s||(s=qG(i.inactiveBar),r.addChild(s)),o||(o=KG(i.barMask),r.addChild(o)),t.mask=o,{inactiveBar:s,barMask:o}},QG=({sliderContainer:r,id:e,bar:t})=>{let{inactiveBar:i,barMask:s}=wn({sliderContainer:r,id:e});t?.mask===s&&(t.mask=null),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy())},XM=({currentValue:r,min:e,max:t})=>{let i=t-e;return i<=0?0:Ny((r-e)/i)},JG=({barMask:r,direction:e,width:t,height:i,currentValue:s,min:o,max:n})=>{if(!r)return;let a=XM({currentValue:s,min:o,max:n}),l=Math.round(e==="horizontal"?t*a:t),c=Math.round(e==="horizontal"?i:i*a);r.clear(),!(l<=0||c<=0)&&r.rect(0,0,l,c).fill({color:16777215,alpha:0})},eL=({thumb:r,direction:e,currentValue:t,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=XM({currentValue:t,min:i,max:s});if(e==="horizontal"){r.x=a*(o-r.width),r.y=(n-r.height)/2;return}r.x=(o-r.width)/2,r.y=a*(n-r.height)},Xd=({thumb:r,thumbSrc:e,direction:t,trackWidth:i,trackHeight:s})=>{let o=t==="horizontal"?s-VM*2:i-VM*2,n=Ls(e),a=n.width||WM,l=n.height||WM,c=o/a,u=o/l,h=Math.min(c,u);r.width=a*h,r.height=l*h},dc=({sliderContainer:r,sliderComputedNode:e,thumb:t,currentValue:i,hoverOverride:s=null})=>{let{id:o,width:n,height:a,direction:l,min:c,max:u}=e,{barSrc:h,inactiveBarSrc:d,thumbSrc:f}=YG(e,s),{bar:p}=wn({sliderContainer:r,id:o});if(p){if(p.texture=Ls(h),p.width=n,p.height=a,t.texture=Ls(f),d){let{inactiveBar:m,barMask:g}=ZG({sliderContainer:r,id:o,bar:p});m.texture=Ls(d),m.width=n,m.height=a,JG({barMask:g,direction:l,width:n,height:a,currentValue:i,min:c,max:u})}else QG({sliderContainer:r,id:o,bar:p});eL({thumb:t,direction:l,currentValue:i,min:c,max:u,trackWidth:n,trackHeight:a})}},tL=({position:r,thumb:e,direction:t,min:i,max:s,step:o,trackWidth:n,trackHeight:a})=>{let l=s-i,c;if(t==="horizontal"){let h=r.x-e.width/2,d=Math.max(n-e.width,1);c=Ny(h/d)}else{let h=r.y-e.height/2,d=Math.max(a-e.height,1);c=Ny(h/d)}let u=i+c*l;return o>0&&(u=Math.round((u-i)/o)*o+i,u=Math.max(i,Math.min(s,u))),u},zM=({sliderContainer:r,sliderComputedNode:e,cursor:t})=>{let i=t??"auto",{bar:s,inactiveBar:o,thumb:n}=wn({sliderContainer:r,id:e.id});r.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},jd=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s})=>{vn(e);let{id:o,hover:n,change:a,min:l,max:c,step:u,direction:h,initialValue:d,width:f,height:p}=t,m=d??l,g=!1,_=null,v=()=>{dc({sliderContainer:e,sliderComputedNode:t,thumb:i,currentValue:m,hoverOverride:_?.isHovering()?n:null})},x=B=>{let C=e.toLocal(B.global),A=tL({position:C,thumb:i,direction:h,min:l,max:c,step:u,trackWidth:f,trackHeight:p});A!==m&&(m=A,v(),a?.payload&&s&&s("change",{_event:{id:o,value:m},...a.payload}))},T=B=>{g=!0,x(B)},b=B=>{g&&x(B)},w=()=>{g&&(g=!1)};if(e.on("pointerdown",T),e.on("globalpointermove",b),e.on("pointerup",w),e.on("pointerupoutside",w),!n)return;_=ei({displayObject:e,onHoverChange:v});let E=()=>{_.setDirectHover(!0),v(),zM({sliderContainer:e,sliderComputedNode:t,cursor:n.cursor}),n.soundSrc&&r.audioStage.add({id:`hover-${Date.now()}`,url:n.soundSrc,loop:!1})},I=()=>{g||(_.setDirectHover(!1),v(),zM({sliderContainer:e,sliderComputedNode:t,cursor:null}))};e.on("pointerover",E),e.on("pointerout",I),e.on("pointerupoutside",I)};var jM=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,alpha:p,thumbSrc:m,barSrc:g,initialValue:_,min:v}=t,x=new te;x.label=c,x.zIndex=l,x.x=u,x.y=h,x.alpha=p,x.sortableChildren=!0,x.eventMode="static";let T=Sn(c),b=new Te(Ls(g));b.label=T.bar,b.eventMode="static",b.zIndex=1;let w=new Te(Ls(m));w.label=T.thumb,w.eventMode="static",w.zIndex=2;let E=_??v;Xd({thumb:w,thumbSrc:m,direction:t.direction,trackWidth:d,trackHeight:f}),x.addChild(b),x.addChild(w),dc({sliderContainer:x,sliderComputedNode:t,thumb:w,currentValue:E}),jd({app:r,sliderContainer:x,sliderComputedNode:t,thumb:w,eventHandler:n}),e.addChild(x),ne({animations:i,targetId:c,animationBus:s,completionTracker:o,element:x,targetState:{x:u,y:h,alpha:p},renderContext:a})};var YM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(m=>m.label===t.id);if(!c)return;c.zIndex=l;let u=()=>{if(!pe(t,i)){c.x=i.x,c.y=i.y,c.alpha=i.alpha,c.label=i.id,c.pivot.set(i.originX,i.originY),$M({sliderContainer:c,fromId:t.id,toId:i.id});let{bar:m,thumb:g}=wn({sliderContainer:c,id:i.id}),_=!pe(t.hover,i.hover)||!pe(t.change,i.change)||t.min!==i.min||t.max!==i.max||t.step!==i.step||t.direction!==i.direction||t.initialValue!==i.initialValue||t.thumbSrc!==i.thumbSrc||t.barSrc!==i.barSrc||t.inactiveBarSrc!==i.inactiveBarSrc||t.width!==i.width||t.height!==i.height||t.id!==i.id;if(m&&g&&(Xd({thumb:g,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),dc({sliderContainer:c,sliderComputedNode:i,thumb:g,currentValue:i.initialValue})),!m||!g)return;_&&(c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove")),_&&jd({app:r,sliderContainer:c,sliderComputedNode:i,thumb:g,eventHandler:a})}},{x:h,y:d,alpha:f}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,alpha:f},onComplete:u})||u()};var qM=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var KM=({state:r})=>{let e=yt(r),t=r.min??0,i=r.max??100;if(i<=t)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValuei)throw new Error("Input error: slider initialValue must be between min and max");return{...e,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",...r.inactiveBarSrc!==void 0&&{inactiveBarSrc:r.inactiveBarSrc??""},alpha:r.alpha??1,min:t,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var rL=et({type:"slider",add:jM,update:YM,delete:qM,parse:KM});var Pn=Symbol("routeGraphicsInputRuntime"),Yd={top:10,right:12,bottom:10,left:12},En={fill:"#FFFFFF",fillAlpha:1,strokeColor:"#2E2E2E",strokeWidth:1,strokeAlpha:1},qd={strokeColor:"#4A89FF",strokeWidth:2,strokeAlpha:1},ZM={fill:"#4A89FF",alpha:.3},Hy={fill:"#111111",width:2},iL=(r={})=>{let e=r.fontSize??Ge.fontSize,t=r.lineHeight??Ge.lineHeight;return typeof t!="number"?Math.round(e*Ge.lineHeight):t>8?Math.round(t):Math.round(e*t)},Jd=(r={},e={})=>({...Ge,...r,align:r.align??"left",lineHeight:iL(r),wordWrap:!1,breakWords:!1,wordWrapWidth:e.wordWrapWidth??0,whiteSpace:"pre"}),Vy=r=>typeof r=="number"?{top:r,right:r,bottom:r,left:r}:Array.isArray(r)?{top:r[0]??0,right:r[1]??r[0]??0,bottom:r[2]??r[0]??0,left:r[3]??r[1]??r[0]??0}:{top:r?.top??Yd.top,right:r?.right??Yd.right,bottom:r?.bottom??Yd.bottom,left:r?.left??Yd.left},An=r=>String(r??"").replace(/\r\n/g,` +`).replace(/\r/g,` +`),sL=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},eR=r=>new Oe(ir(r)),Zt=(r,e)=>De.measureText(r,eR(e)).width,ts=(r,e,t)=>Math.max(e,Math.min(t,r)),QM=({text:r,style:e,targetX:t})=>{let i=Number.isFinite(t)?t:0;if(i<=0||r.length===0)return 0;let s=Zt(r,e);if(i>=s)return r.length;for(let o=1;o<=r.length;o+=1){let n=Zt(r.slice(0,o-1),e),a=Zt(r.slice(0,o),e),l=n+(a-n)/2;if(i{let t=Math.max(r.x,e.x),i=Math.max(r.y,e.y),s=Math.min(r.x+r.width,e.x+e.width),o=Math.min(r.y+r.height,e.y+e.height),n=s-t,a=o-i;return n<=0||a<=0?null:{x:t,y:i,width:n,height:a}},oL=r=>{let e=r?.mask;if(!e?.getBounds)return null;let t=e.getBounds();return!t||t.width<=0||t.height<=0?null:{x:t.x,y:t.y,width:t.width,height:t.height}},nL=({app:r,container:e,fallbackElement:t})=>{if(!e||e.destroyed)return null;let i=e.getBounds?.(),s=i?{x:i.x,y:i.y,width:i.width,height:i.height}:{x:e.x??t.x,y:e.y??t.y,width:t.width,height:t.height};if(s.width<=0||s.height<=0)return null;let o={...s},n=e;for(;n;){if(n.visible===!1||n.renderable===!1)return{fullBounds:s,visibleBounds:null};let l=oL(n);if(l&&(o=JM(o,l),!o))return{fullBounds:s,visibleBounds:null};n=n.parent}let a=r?.renderer?{x:0,y:0,width:r.renderer.width,height:r.renderer.height}:null;return a&&(o=JM(o,a)),{fullBounds:s,visibleBounds:o}},aL=(r,e)=>e?{top:Math.max(0,e.y-r.y),right:Math.max(0,r.x+r.width-(e.x+e.width)),bottom:Math.max(0,r.y+r.height-(e.y+e.height)),left:Math.max(0,e.x-r.x)}:{top:r.height,right:0,bottom:0,left:0},lL=({displayedValue:r,textStyle:e})=>{let t=Zt(r,e);return{lines:[{text:r,width:t,startIndex:0}],lineHeight:e.lineHeight,totalHeight:e.lineHeight,maxLineWidth:t,textValue:r}},cL=({displayedValue:r,textStyle:e})=>{let t=An(r),i=t.split(` +`),s=i.map((a,l)=>({text:a,width:Zt(a,e),startIndex:l===0?0:i.slice(0,l).reduce((c,u)=>c+u.length+1,0)})),o=s.reduce((a,l)=>Math.max(a,l.width),0),n=e.lineHeight;return{lines:s,lineHeight:n,totalHeight:s.length*n,maxLineWidth:o,textValue:t}},uL=({element:r,displayedValue:e,textStyle:t})=>r.multiline?cL({displayedValue:e,textStyle:t}):lL({displayedValue:e,textStyle:t}),Kd=({value:r,index:e})=>{let t=An(r),i=ts(e,0,t.length),s=0,o=0;for(let n=0;nsL(r,e,t),hL=r=>new Br({label:r,text:""}),dL=(r,e)=>{for(;r.textNodes.lengthe;){let t=r.textNodes.pop();t?.removeFromParent(),t?.destroy()}},Zd=({contentWidth:r,lineWidth:e,align:t,scrollOffsetX:i})=>e>r?-i:Wy({contentWidth:r,lineWidth:e,align:t}),tR=({contentWidth:r,lineWidth:e,align:t})=>Wy({contentWidth:r,lineWidth:e,align:t}),Qd=({padding:r,contentWidth:e,lineWidth:t,align:i,scrollOffsetX:s})=>r.left+tR({contentWidth:e,lineWidth:t,align:i})-s,rR=r=>{let e=new Ue;e.label=`${r.id}-background`;let t=new Ue;t.label=`${r.id}-selection`;let i=new te;i.label=`${r.id}-text`;let s=new Br({label:`${r.id}-placeholder`,text:r.placeholder}),o=new Ue;o.label=`${r.id}-caret`;let n=new Ue;return n.label=`${r.id}-clip`,i.mask=n,s.mask=n,t.mask=n,o.mask=n,{background:e,selection:t,text:i,placeholder:s,caret:o,clip:n}},iR=({app:r,container:e,display:t,element:i})=>({app:r,container:e,...t,value:An(i.value??""),selectionStart:An(i.value??"").length,selectionEnd:An(i.value??"").length,focused:!1,nativeFocused:!1,composing:!1,blinkVisible:!0,blinkTick:0,scrollOffsetX:0,scrollOffsetY:0,selectionAnchor:null,draggingSelection:!1,textNodes:[],layoutState:null,lastExternalValue:An(i.value??""),tickerListener:null,element:i}),ef=(r,e,t)=>{let i=nL({app:r,container:e,fallbackElement:t});if(!i)return null;let{fullBounds:s,visibleBounds:o}=i,n=aL(s,o);return{x:s.x,y:s.y,width:s.width,height:s.height,visible:!!o&&e.visible!==!1&&e.renderable!==!1,clipInsets:n}},tt=(r,e)=>{let t=Vy(e.padding),i=Math.max(0,e.width-t.left-t.right),s=Math.max(0,e.height-t.top-t.bottom),o=Jd(e.textStyle,{wordWrapWidth:i}),n=Jd({...e.textStyle,fill:"#7A7A7A"},{wordWrapWidth:i}),a=String(r.value??""),l=uL({element:e,displayedValue:a,textStyle:o}),c=o.align??"left",u=ts(Math.min(r.selectionStart,r.selectionEnd),0,a.length),h=ts(Math.max(r.selectionStart,r.selectionEnd),0,a.length),d=ts(r.selectionEnd??a.length,0,a.length);if(r.layoutState={padding:t,contentWidth:i,contentHeight:s,textStyle:o,placeholderStyle:n,displayedValue:a,layout:l,align:c},dL(r,l.lines.length),r.textNodes.forEach((p,m)=>{let g=l.lines[m]??{text:"",width:0};Qr(p,o),p.text=g.text}),Qr(r.placeholder,n),r.placeholder.text=e.placeholder??"",e.multiline){let p=Kd({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),g=m?.width??0,_=Zt((m?.text??"").slice(0,p.column),o),v=l.totalHeight,x=p.line*l.lineHeight,T=x+l.lineHeight;if(g<=i)r.scrollOffsetX=0;else if(r.focused){let w=Math.max(0,g-i);_-r.scrollOffsetX>i-8?r.scrollOffsetX=_-(i-8):_-r.scrollOffsetX<8&&(r.scrollOffsetX=_-8),r.scrollOffsetX=ts(r.scrollOffsetX,0,w)}else r.scrollOffsetX=0;if(v<=s)r.scrollOffsetY=0;else if(r.focused){let b=Math.max(0,v-s);T-r.scrollOffsetY>s?r.scrollOffsetY=T-s:x-r.scrollOffsetY<0&&(r.scrollOffsetY=x),r.scrollOffsetY=ts(r.scrollOffsetY,0,b)}else r.scrollOffsetY=0}else{let p=l.lines[0],m=Zt(p.text.slice(0,d),o);if(p.width<=i)r.scrollOffsetX=0;else if(r.focused){let _=Math.max(0,p.width-i);m-r.scrollOffsetX>i-8?r.scrollOffsetX=m-(i-8):m-r.scrollOffsetX<8&&(r.scrollOffsetX=m-8),r.scrollOffsetX=ts(r.scrollOffsetX,0,_)}else r.scrollOffsetX=0;r.scrollOffsetY=0}if(e.multiline)r.text.x=t.left-r.scrollOffsetX,r.text.y=t.top-r.scrollOffsetY,r.textNodes.forEach((p,m)=>{let g=l.lines[m]??{width:0};p.x=tR({contentWidth:i,lineWidth:g.width,align:c}),p.y=m*l.lineHeight});else{let p=l.lines[0],m=r.textNodes[0],g=Zd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX});m.x=0,m.y=0,r.text.x=t.left+g,r.text.y=t.top+Math.max(0,(s-m.height)/2)}let f=De.measureText(r.placeholder.text,eR(n));if(r.placeholder.x=t.left,r.placeholder.y=e.multiline?t.top:t.top+Math.max(0,(s-r.placeholder.height)/2),f.width<=i&&(r.placeholder.x+=Wy({contentWidth:i,lineWidth:f.width,align:c})),r.placeholder.visible=r.value.length===0&&r.composing!==!0,r.background.clear(),r.background.rect(0,0,e.width,e.height),r.background.fill({color:En.fill,alpha:En.fillAlpha}),En.strokeWidth>0&&r.background.stroke({color:En.strokeColor,alpha:En.strokeAlpha,width:En.strokeWidth}),r.focused&&qd.strokeWidth>0&&e.disabled!==!0&&r.background.stroke({color:qd.strokeColor,alpha:qd.strokeAlpha,width:qd.strokeWidth}),r.clip.clear(),r.clip.rect(t.left,t.top,i,Math.max(0,s)),r.clip.fill({color:16777215,alpha:1}),r.selection.clear(),r.focused&&u!==h&&e.disabled!==!0){if(e.multiline){let p=Kd({value:a,index:u}),m=Kd({value:a,index:h});for(let g=p.line;g<=m.line;g+=1){let _=l.lines[g];if(!_)continue;let v=g===p.line?p.column:0,x=g===m.line?m.column:_.text.length,T=Qd({padding:t,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Zt(_.text.slice(0,v),o),b=Qd({padding:t,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Zt(_.text.slice(0,x),o),w=t.top+g*l.lineHeight-r.scrollOffsetY;r.selection.rect(T,w,Math.max(b-T,1),l.lineHeight)}}else{let p=l.lines[0],m=Zd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),g=t.left+m+Zt(p.text.slice(0,u),o),_=t.left+m+Zt(p.text.slice(0,h),o),v=t.top+Math.max(0,(s-r.text.height)/2);r.selection.rect(g,v,Math.max(_-g,1),Math.max(r.text.height,o.lineHeight))}r.selection.fill({color:ZM.fill,alpha:ZM.alpha})}if(r.caret.clear(),r.focused&&r.selectionStart===r.selectionEnd&&r.blinkVisible!==!1&&e.disabled!==!0){if(e.multiline){let p=Kd({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),g=Qd({padding:t,contentWidth:i,lineWidth:m?.width??0,align:c,scrollOffsetX:r.scrollOffsetX})+Zt((m?.text??"").slice(0,p.column),o),_=t.top+p.line*l.lineHeight-r.scrollOffsetY;r.caret.rect(g,_,Hy.width,l.lineHeight)}else{let p=l.lines[0],m=Zd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),g=t.left+m+Zt(p.text.slice(0,d),o),_=t.top+Math.max(0,(s-r.text.height)/2);r.caret.rect(g,_,Hy.width,Math.max(r.text.height,o.lineHeight))}r.caret.fill({color:Hy.fill,alpha:1})}},zy=(r,e)=>{let t=r.layoutState;if(!t)return 0;let{padding:i,contentWidth:s,textStyle:o,displayedValue:n,layout:a,align:l}=t,c=e?.x??0,u=e?.y??0;if(!r.element.multiline){let m=a.lines[0]??{text:n,width:Zt(n,o)},g=Zd({contentWidth:s,lineWidth:m.width,align:l,scrollOffsetX:r.scrollOffsetX}),_=i.left+g;return QM({text:m.text,style:o,targetX:c-_})}let h=a.lineHeight||o.lineHeight||1,d=ts(Math.floor((u-i.top+r.scrollOffsetY)/h),0,Math.max(a.lines.length-1,0)),f=a.lines[d]??{text:"",startIndex:0},p=QM({text:f.text,style:o,targetX:c-Qd({padding:i,contentWidth:s,lineWidth:f.width??0,align:l,scrollOffsetX:r.scrollOffsetX})});return f.startIndex+p};var rs=({eventHandler:r,eventName:e,element:t,eventConfig:i,snapshot:s})=>{!r||!i||r(e,{_event:{id:t.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},fL=({app:r,container:e,element:t,runtime:i,eventHandler:s})=>({onValueChange:o=>{i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.lastExternalValue=o.value,tt(i,t),rs({eventHandler:s,eventName:"change",element:t,eventConfig:t.change,snapshot:o})},onFocus:o=>{let n=i.nativeFocused===!0;i.nativeFocused=!0,i.focused=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.selectionAnchor=o.selectionStart===o.selectionEnd?o.selectionEnd:i.selectionAnchor,i.blinkVisible=!0,i.blinkTick=0,tt(i,t),!n&&rs({eventHandler:s,eventName:"focus",element:t,eventConfig:t.focusEvent,snapshot:o})},onBlur:o=>{i.nativeFocused=!1,i.focused=!1,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.blinkVisible=!1,i.composing=!1,tt(i,t),rs({eventHandler:s,eventName:"blur",element:t,eventConfig:t.blurEvent,snapshot:o})},onSelectionChange:o=>{i.nativeFocused=o.focused,i.focused=o.focused,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,o.selectionStart===o.selectionEnd&&(i.selectionAnchor=o.selectionEnd),tt(i,t),rs({eventHandler:s,eventName:"selectionChange",element:t,eventConfig:t.selectionChange,snapshot:o})},onSubmit:o=>{rs({eventHandler:s,eventName:"submit",element:t,eventConfig:t.submit,snapshot:o})},onCompositionStart:o=>{i.composing=!0,tt(i,t),rs({eventHandler:s,eventName:"compositionStart",element:t,eventConfig:t.compositionStart,snapshot:o})},onCompositionUpdate:o=>{i.composing=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,tt(i,t),rs({eventHandler:s,eventName:"compositionUpdate",element:t,eventConfig:t.compositionUpdate,snapshot:o})},onCompositionEnd:o=>{i.composing=!1,i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,tt(i,t),rs({eventHandler:s,eventName:"compositionEnd",element:t,eventConfig:t.compositionEnd,snapshot:o})}}),sR=({app:r,parent:e,element:t,eventHandler:i,zIndex:s})=>{if(!r.inputDomBridge?.mount||!r.inputDomBridge?.focus||!r.inputDomBridge?.setSelection)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let o=new te({label:t.id});o.zIndex=s,o.sortableChildren=!0,o.eventMode="static",o.cursor=t.disabled?"default":"text",o.x=Math.round(t.x),o.y=Math.round(t.y),o.alpha=t.alpha;let n=rR(t),a=iR({app:r,container:o,display:n,element:t});o.addChild(a.background,a.selection,a.text,a.placeholder,a.caret,a.clip),a.tickerListener=f=>{if(!a.focused){if(a.blinkVisible===!1)return;a.blinkVisible=!1,tt(a,a.element);return}a.blinkTick+=f.deltaMS??f.deltaTime??16,a.blinkTick>=530&&(a.blinkTick=0,a.blinkVisible=!a.blinkVisible,tt(a,a.element))},r.ticker?.add?.(a.tickerListener);let l=({start:f,end:p,shouldFocus:m=!1})=>{if(m){r.inputDomBridge.focus(t.id,{selectionStart:f,selectionEnd:p});return}r.inputDomBridge.setSelection(t.id,f,p)},c=({start:f,end:p,shouldFocus:m=!1,anchor:g=a.selectionAnchor})=>{a.focused=!0,a.selectionStart=f,a.selectionEnd=p,a.selectionAnchor=g,a.blinkVisible=!0,a.blinkTick=0,tt(a,a.element),l({start:f,end:p,shouldFocus:m})},u=f=>{if(a.element.disabled===!0)return;let p=o.toLocal(f.global),m=zy(a,p),g=!!f.shiftKey&&a.focused,_=g?a.selectionAnchor??(a.selectionStart!==a.selectionEnd?a.selectionStart:a.selectionEnd):m,v=g?Math.min(_,m):m,x=g?Math.max(_,m):m;a.draggingSelection=!0,c({start:v,end:x,shouldFocus:!0,anchor:_})},h=f=>{if(!a.draggingSelection||a.element.disabled===!0)return;let p=o.toLocal(f.global),m=zy(a,p),g=a.selectionAnchor??m,_=Math.min(g,m),v=Math.max(g,m);c({start:_,end:v,anchor:g})},d=()=>{a.draggingSelection=!1};o.on("pointerdown",u),o.on("globalpointermove",h),o.on("pointerup",d),o.on("pointerupoutside",d),o.on("pointerup",()=>{a.element.disabled!==!0&&r.inputDomBridge.focus(t.id,{selectionStart:a.selectionStart,selectionEnd:a.selectionEnd})}),o[Pn]=a,tt(a,t),r.inputDomBridge.mount(t.id,{...t,value:a.value,callbacks:fL({app:r,container:o,element:t,runtime:a,eventHandler:i}),getGeometry:()=>ef(r,o,t)}),e.addChild(o)};var is=({eventHandler:r,eventName:e,element:t,eventConfig:i,snapshot:s})=>{!r||!i||r(e,{_event:{id:t.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},pL=({element:r,runtime:e,eventHandler:t})=>({onValueChange:i=>{e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.lastExternalValue=i.value,tt(e,r),is({eventHandler:t,eventName:"change",element:r,eventConfig:r.change,snapshot:i})},onFocus:i=>{let s=e.nativeFocused===!0;e.nativeFocused=!0,e.focused=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:e.selectionAnchor,e.blinkVisible=!0,e.blinkTick=0,tt(e,r),!s&&is({eventHandler:t,eventName:"focus",element:r,eventConfig:r.focusEvent,snapshot:i})},onBlur:i=>{e.nativeFocused=!1,e.focused=!1,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.blinkVisible=!1,e.composing=!1,tt(e,r),is({eventHandler:t,eventName:"blur",element:r,eventConfig:r.blurEvent,snapshot:i})},onSelectionChange:i=>{e.nativeFocused=i.focused,e.focused=i.focused,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(e.selectionAnchor=i.selectionEnd),tt(e,r),is({eventHandler:t,eventName:"selectionChange",element:r,eventConfig:r.selectionChange,snapshot:i})},onSubmit:i=>{is({eventHandler:t,eventName:"submit",element:r,eventConfig:r.submit,snapshot:i})},onCompositionStart:i=>{e.composing=!0,tt(e,r),is({eventHandler:t,eventName:"compositionStart",element:r,eventConfig:r.compositionStart,snapshot:i})},onCompositionUpdate:i=>{e.composing=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,tt(e,r),is({eventHandler:t,eventName:"compositionUpdate",element:r,eventConfig:r.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{e.composing=!1,e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,tt(e,r),is({eventHandler:t,eventName:"compositionEnd",element:r,eventConfig:r.compositionEnd,snapshot:i})}}),oR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,zIndex:o})=>{let n=e.children.find(u=>u.label===t.id);if(!n)return;if(!r.inputDomBridge?.update)throw new Error("Input plugin requires app.inputDomBridge to be initialized");n.zIndex=o;let a=n[Pn];if(!a)return;let l={...i},c=a.focused!==!0||i.value!==t.value;c&&a.composing!==!0?(a.value=i.value,a.lastExternalValue=i.value):l.value=a.value,a.element=l,n.label=i.id,n.cursor=i.disabled?"default":"text",n.x=Math.round(i.x),n.y=Math.round(i.y),n.alpha=i.alpha,i.disabled===!0&&(a.draggingSelection=!1),(!pe(t,i)||c)&&tt(a,l),r.inputDomBridge.update(i.id,{...l,value:a.value,callbacks:pL({element:l,runtime:a,eventHandler:s}),getGeometry:()=>ef(r,n,l)})};var nR=({app:r,parent:e,element:t})=>{let i=e.getChildByLabel(t.id);if(!i)return;if(!r.inputDomBridge?.unmount)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let s=i[Pn];s?.tickerListener&&r.ticker?.remove?.(s.tickerListener),r.inputDomBridge.unmount(t.id),i.destroy({children:!0})};var aR=({state:r})=>{let e=yt(r),t=String(r.value??""),i=String(r.placeholder??"");return delete e.originX,delete e.originY,{...e,value:t,placeholder:i,multiline:r.multiline===!0,disabled:r.disabled===!0,...typeof r.maxLength=="number"&&{maxLength:Math.round(r.maxLength)},textStyle:Jd(r.textStyle),padding:Vy(r.padding),...r.change&&{change:r.change},...r.submit&&{submit:r.submit},...r.focusEvent&&{focusEvent:r.focusEvent},...r.blurEvent&&{blurEvent:r.blurEvent},...r.selectionChange&&{selectionChange:r.selectionChange},...r.compositionStart&&{compositionStart:r.compositionStart},...r.compositionUpdate&&{compositionUpdate:r.compositionUpdate},...r.compositionEnd&&{compositionEnd:r.compositionEnd}}};var mL=et({type:"input",add:sR,update:oR,delete:nR,parse:aR});var gL=24,xL=24,Ds=(r,e,t)=>Math.min(t,Math.max(e,r)),uR=r=>Ds(r,0,1),Cn=r=>{r?.stopPropagation?.()},yL=r=>r?k.from(r):k.EMPTY,tf=({label:r})=>{let e=new Te(k.EMPTY);return e.label=r,e.eventMode="static",e.cursor="pointer",e},_L=({config:r,state:e})=>r?e?.pressed&&r.pressSrc?r.pressSrc:e?.hovered&&r.hoverSrc?r.hoverSrc:r.src??"":"",rf=({sprite:r,config:e,state:t,width:i,height:s})=>{r&&(r.texture=yL(_L({config:e,state:t})),r.width=Math.max(i,0),r.height=Math.max(s,0),r.visible=r.width>0&&r.height>0,r.eventMode=r.visible?"static":"none")},bL=r=>({root:`${r}-scrollbar-vertical`,track:`${r}-scrollbar-vertical-track`,thumb:`${r}-scrollbar-vertical-thumb`,startButton:`${r}-scrollbar-vertical-start-button`,endButton:`${r}-scrollbar-vertical-end-button`}),lR=(r,e)=>Math.abs(r-e)<.5,cR=({hasOverflow:r,minScroll:e,previousOffset:t,wasAtEnd:i,anchorToEnd:s})=>r?s&&(t===void 0||i)?e:typeof t=="number"?Ds(t,e,0):0:0,vL=({controller:r})=>{let e=bL(r.container.label),t=r.element.scrollbar?.vertical;if(!t)return null;let i=new te({label:e.root});i.eventMode="static",i.cursor="pointer";let s=tf({label:e.track}),o=tf({label:e.thumb}),n={config:t,root:i,track:s,thumb:o,startButton:null,endButton:null,states:{track:{hovered:!1,pressed:!1},thumb:{hovered:!1,pressed:!1,dragging:!1},startButton:{hovered:!1,pressed:!1},endButton:{hovered:!1,pressed:!1}},dragOffsetY:0};i.addChild(s),i.addChild(o),t.startButton&&(n.startButton=tf({label:e.startButton}),i.addChild(n.startButton)),t.endButton&&(n.endButton=tf({label:e.endButton}),i.addChild(n.endButton));let a=()=>{hR({controller:r})};s.on("pointerover",()=>{n.states.track.hovered=!0,a()}),s.on("pointerout",()=>{n.states.track.hovered=!1,a()}),s.on("pointerdown",h=>{Cn(h),n.states.track.pressed=!0,a();let d=i.toLocal(h.global),{thumb:f}=n,p=r.viewportHeight;d.yf.y+f.height&&r.setScrollOffsets({y:r.scrollYOffset-p,source:"track"})});let l=h=>{Cn(h),n.states.track.pressed=!1,a()};s.on("pointerup",l),s.on("pointerupoutside",l),o.on("pointerover",()=>{n.states.thumb.hovered=!0,a()}),o.on("pointerout",()=>{n.states.thumb.hovered=!1,n.states.thumb.dragging||a()}),o.on("pointerdown",h=>{Cn(h);let d=i.toLocal(h.global);n.states.thumb.pressed=!0,n.states.thumb.dragging=!0,n.dragOffsetY=d.y-n.thumb.y,a()});let c=h=>{if(Cn(h),!n.states.thumb.dragging){n.states.thumb.pressed=!1,a();return}n.states.thumb.dragging=!1,n.states.thumb.pressed=!1,a()};i.on("globalpointermove",h=>{if(!n.states.thumb.dragging)return;let d=i.toLocal(h.global),f=n.track.y,p=Math.max(n.track.height-n.thumb.height,0);if(p<=0||r.minScrollY===0){r.setScrollOffsets({y:0,source:"thumb"});return}let m=Ds(d.y-n.dragOffsetY,f,f+p),g=uR((m-f)/p);r.setScrollOffsets({y:r.minScrollY*g,source:"thumb"})}),o.on("pointerup",c),o.on("pointerupoutside",c),i.on("pointerup",c),i.on("pointerupoutside",c);let u=({sprite:h,config:d,state:f,deltaDirection:p})=>{if(!h||!d)return;h.on("pointerover",()=>{f.hovered=!0,a()}),h.on("pointerout",()=>{f.hovered=!1,a()}),h.on("pointerdown",g=>{Cn(g),f.pressed=!0,a(),r.setScrollOffsets({y:r.scrollYOffset+p*Math.max(d.step??gL,0),source:"button"})});let m=g=>{Cn(g),f.pressed=!1,a()};h.on("pointerup",m),h.on("pointerupoutside",m)};return u({sprite:n.startButton,config:t.startButton,state:n.states.startButton,deltaDirection:1}),u({sprite:n.endButton,config:t.endButton,state:n.states.endButton,deltaDirection:-1}),r.container.addChild(i),n},hR=({controller:r})=>{let e=r.verticalScrollbar;if(!e)return;let{config:t,root:i,track:s,thumb:o,startButton:n,endButton:a,states:l}=e,c=Math.max(t.thickness??0,0),u=n?Math.max(t.startButton?.size??c,0):0,h=a?Math.max(t.endButton?.size??c,0):0,d=Math.max(r.viewportHeight-u-h,0),f=Math.min(xL,d),p=t.thumb?.length,m=typeof p=="number"?p:r.totalHeight>0?Math.round(r.viewportHeight/r.totalHeight*d):d,g=d>0?typeof p=="number"?Ds(m,0,d):Ds(m,f,d):0,_=Math.max(d-g,0),v=r.minScrollY===0?0:uR(r.scrollYOffset/r.minScrollY);i.visible=r.hasVerticalOverflow&&r.element.scroll&&c>0&&r.viewportHeight>0,i.x=Math.max(r.viewportWidth-c,0),i.y=0,s.x=0,s.y=u,rf({sprite:s,config:t.track,state:l.track,width:c,height:d}),o.x=0,o.y=u+_*v,rf({sprite:o,config:t.thumb,state:l.thumb,width:c,height:g}),n&&(n.x=0,n.y=0,rf({sprite:n,config:t.startButton,state:l.startButton,width:c,height:u})),a&&(a.x=0,a.y=r.viewportHeight-h,rf({sprite:a,config:t.endButton,state:l.endButton,width:c,height:h}))},dR=({container:r})=>{let e=r.__routeGraphicsScrollController;return e?{scrollXOffset:e.scrollXOffset,scrollYOffset:e.scrollYOffset,wasAtHorizontalEnd:e.hasHorizontalOverflow&&lR(e.scrollXOffset,e.minScrollX),wasAtVerticalEnd:e.hasVerticalOverflow&&lR(e.scrollYOffset,e.minScrollY)}:null},fc=({container:r,element:e,interactive:t=!0,allowViewportWithoutScroll:i=!1,previousState:s=null})=>{let o=0,n=0;e.children.forEach(u=>{o=Math.max(u.width+u.x,o),n=Math.max(u.height+u.y,n)});let a=!!(e.height&&n>e.height),l=!!(e.width&&o>e.width);if((e.scroll||i)&&(a||l)){let u=new te({label:`${r.label}-content`});[...r.children].forEach(g=>{u.addChild(g)}),r.addChild(u);let d=new Ue({label:`${r.label}-clip`}).rect(0,0,e.width||o,e.height||n).fill({color:16711680,alpha:0});r.addChild(d),u.mask=d;let f=-(n-(e.height||n)),p=-(o-(e.width||o)),m={container:r,contentContainer:u,clip:d,element:e,totalWidth:o,totalHeight:n,viewportWidth:e.width||o,viewportHeight:e.height||n,hasHorizontalOverflow:l,hasVerticalOverflow:a,minScrollX:p,minScrollY:f,scrollXOffset:cR({hasOverflow:l,minScroll:p,previousOffset:s?.scrollXOffset,wasAtEnd:s?.wasAtHorizontalEnd,anchorToEnd:!!e.anchorToBottom}),scrollYOffset:cR({hasOverflow:a,minScroll:f,previousOffset:s?.scrollYOffset,wasAtEnd:s?.wasAtVerticalEnd,anchorToEnd:!!e.anchorToBottom}),verticalScrollbar:null,setScrollOffsets:({x:g,y:_})=>{let v=g??m.scrollXOffset,x=_??m.scrollYOffset;m.scrollXOffset=m.hasHorizontalOverflow?Ds(v,m.minScrollX,0):0,m.scrollYOffset=m.hasVerticalOverflow?Ds(x,m.minScrollY,0):0,m.contentContainer.x=m.scrollXOffset,m.contentContainer.y=m.scrollYOffset,hR({controller:m})}};r.__routeGraphicsScrollController=m,m.verticalScrollbar=vL({controller:m}),m.setScrollOffsets({x:m.scrollXOffset,y:m.scrollYOffset,source:"initial"}),t&&(r.eventMode="static",r.hitArea=new Q(0,0,e.width||o,e.height||n),r.on("wheel",g=>{if(g.preventDefault(),a&&g.deltaY!==0&&m.setScrollOffsets({y:m.scrollYOffset-g.deltaY,source:"wheel"}),l&&(g.deltaX!==0||g.shiftKey&&g.deltaY!==0)){let _=g.deltaX!==0?g.deltaX:g.deltaY;m.setScrollOffsets({x:m.scrollXOffset-_,source:"wheel"})}}))}},$y=({container:r})=>{let e=r.__routeGraphicsScrollController,t=r.children.find(o=>o.label&&o.label.endsWith("-content")),i=r.children.find(o=>o.label&&o.label.endsWith("-clip")),s=r.children.find(o=>o.label&&o.label.endsWith("-scrollbar-vertical"));t&&([...t.children].forEach(n=>{n.mask=null,r.addChild(n)}),r.removeChild(t),t.destroy({children:!1})),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy({children:!0})),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel"),e&&(r.__routeGraphicsScrollController=void 0)};var Xy=({container:r,element:e,enabled:t})=>{let i=Number.isFinite(e?.width)?e.width:0,s=Number.isFinite(e?.height)?e.height:0;if(t&&i>0&&s>0){r.hitArea=new Q(0,0,i,s);return}r.hitArea=null},fR=(r,e)=>{let t=e??null;for(;t;){if(t===r)return!0;t=t.parent??null}return!1},Ns=(r,e)=>{let t=e??null;for(;t;){if(t===r)return!1;if(typeof t.label=="string"&&t.label.startsWith(`${r.label}-scrollbar-`))return!0;t=t.parent??null}return!1},TL=(r,e)=>{if(!e||typeof e.x!="number"||typeof e.y!="number")return!1;let t=r.toLocal(e),i=r.hitArea;return i?.contains?i.contains(t.x,t.y):!1},sf=({app:r,container:e,element:t,eventHandler:i})=>{let s=Oy(e),o=Uy(e),n=Gy(e),a=s;Tn({root:e,isHovered:!1}),Gs({root:e,isPressed:!1}),Si({root:e,isPressed:!1}),e.removeAllListeners("pointerover"),e.removeAllListeners("pointerout"),e.removeAllListeners("pointerdown"),e.removeAllListeners("pointerup"),e.removeAllListeners("pointerupoutside"),e.removeAllListeners("rightdown"),e.removeAllListeners("rightup"),e.removeAllListeners("rightupoutside"),e.removeAllListeners("rightclick"),e.cursor="auto",t.scroll||(e.eventMode="auto",Xy({container:e,element:t,enabled:!1}));let l=t?.hover,c=t?.click,u=t?.rightClick;if(!!(l||c||u)&&(e.eventMode="static",t.scroll?e.hitArea||Xy({container:e,element:t,enabled:!0}):Xy({container:e,element:t,enabled:!0})),l){let{cursor:d,soundSrc:f,payload:p,inheritToChildren:m}=l,g=v=>{fR(e,v?.relatedTarget)||a||(a=!0,p&&i&&i("hover",{_event:{id:e.label},...p}),d&&(e.cursor=d),f&&r.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),m&&Tn({root:e,isHovered:!0}))},_=v=>{fR(e,v?.relatedTarget)||TL(e,v?.global)||a&&(a=!1,e.cursor="auto",m&&Tn({root:e,isHovered:!1}))};e.on("pointerover",g),e.on("pointerout",_)}if(c){let{soundSrc:d,soundVolume:f,payload:p,inheritToChildren:m}=c,g=x=>{nt(x)&&(Ns(e,x?.target)||m&&Gs({root:e,isPressed:!0}))},_=x=>{nt(x)&&(Ns(e,x?.target)||(m&&Gs({root:e,isPressed:!1}),p&&i&&i("click",{_event:{id:e.label},...p}),d&&r.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1,volume:We(f)})))},v=x=>{nt(x)&&(Ns(e,x?.target)||m&&Gs({root:e,isPressed:!1}))};e.on("pointerdown",g),e.on("pointerup",_),e.on("pointerupoutside",v)}if(u){let{soundSrc:d,payload:f,inheritToChildren:p}=u,m=T=>{Ns(e,T?.target)||p&&Si({root:e,isPressed:!0})},g=T=>{Ns(e,T?.target)||p&&Si({root:e,isPressed:!1})},_=T=>{bM(T)&&(Ns(e,T?.target)||p&&Si({root:e,isPressed:!1}))},v=T=>{Ns(e,T?.target)||(p&&Si({root:e,isPressed:!1}),f&&i&&i("rightClick",{_event:{id:e.label},...f}),d&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:d,loop:!1}))},x=()=>{p&&Si({root:e,isPressed:!1})};e.on("rightdown",m),e.on("rightup",g),e.on("pointerup",_),e.on("rightclick",v),e.on("pointerupoutside",_),e.on("rightupoutside",x)}l?.inheritToChildren&&s&&Tn({root:e,isHovered:!0}),c?.inheritToChildren&&o&&Gs({root:e,isPressed:!0}),u?.inheritToChildren&&n&&Si({root:e,isPressed:!0})},pR=({container:r})=>{Oy(r)&&Tn({root:r,isHovered:!0})},mR=({container:r})=>{Uy(r)&&Gs({root:r,isPressed:!0})},gR=({container:r})=>{Gy(r)&&Si({root:r,isPressed:!0})};var pc=r=>{let e=new Set;if(r.id&&e.add(r.id),r.children&&Array.isArray(r.children))for(let t of r.children)for(let i of pc(t))e.add(i);return e};var xR=(r,e,t=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let c of r)i.add(c.id),s.set(c.id,c);for(let c of e)i.add(c.id),o.set(c.id,c);for(let c of i){let u=s.get(c),h=o.get(c);if(!u&&h)n.push(h);else if(u&&!h)a.push(u);else{let d=pc(h),f=t instanceof Map?Array.from(t.keys()).some(p=>d.has(p)):t.find(p=>d.has(p.targetId));(!pe(u,h)||f)&&l.push({prev:u,next:h})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var of=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,SL=r=>r,wL=r=>r*r,EL=r=>1-(1-r)*(1-r),AL=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,yR=Object.freeze({linear:SL,easeInQuad:wL,easeOutQuad:EL,easeInOutQuad:AL,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let t=2.5949095;return r<.5?Math.pow(2*r,2)*((t+1)*2*r-t)/2:(Math.pow(2*r-2,2)*((t+1)*(r*2-2)+t)+2)/2},easeInBounce:r=>1-of(1-r),easeOutBounce:of,easeInOutBounce:r=>r<.5?(1-of(1-2*r))/2:(1+of(2*r-1))/2,easeInElastic:r=>{let e=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*e)},easeOutElastic:r=>{let e=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*e)+1},easeInOutElastic:r=>{let e=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*e))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*e)/2+1}}),nf=Object.freeze(Object.keys(yR)),PL=(r="linear")=>{let e=yR[r];if(!e)throw new Error(`Unsupported easing: ${r}`);return e},Mn=r=>{let e=[],t=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,e.push({time:t,value:s,easing:"linear"});return}o!==void 0&&(t+=o,i=a?i+s:s,e.push({time:t,value:i,easing:n}))}),e},mc=r=>{let e=0;for(let{timeline:t}of r){let i=t[t.length-1];i&&i.time>e&&(e=i.time)}return e},gc=(r,e)=>{if(r.length===0)return 0;if(e<=r[0].time)return r[0].value;if(e>=r[r.length-1].time)return r[r.length-1].value;for(let t=0;t=i&&e<=n){let l=(e-i)/(n-i);return s+(a-s)*PL(o)(l)}}return r[r.length-1].value};var CL={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},qy=r=>Math.min(1,Math.max(0,r));var SR=r=>r.getLocalBounds().rectangle.clone(),wR=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),_R=(r,e)=>{let t=wR(SR(e)),i=r.renderer.generateTexture({target:e,frame:t}),s=new Te(i);s.x=t.x,s.y=t.y;let o=new te;return o.x=e.x??0,o.y=e.y??0,o.scale.set(e.scale?.x??1,e.scale?.y??1),o.rotation=e.rotation??0,o.alpha=e.alpha??1,o.addChild(s),{wrapper:o,texture:i}},ML=(r={})=>Object.entries(r).map(([e,t])=>({property:e,timeline:Mn([{value:t.initialValue??CL[e]??0},...t.keyframes])})),cf=(r,e,t)=>{if(!r||!e)return{duration:0,apply:()=>{}};let i=ML(e),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:mc(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=gc(a,o);switch(n){case"translateX":r.x=s.x+l*t.renderer.width;break;case"translateY":r.y=s.y+l*t.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},RL=r=>Mn([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),ER=` +in vec2 aPosition; +out vec2 vTextureCoord; +out vec2 vSecondaryCoord; + +uniform vec4 uInputSize; +uniform vec4 uOutputFrame; +uniform vec4 uOutputTexture; +uniform mat3 uSecondaryMatrix; + +vec4 filterVertexPosition(void) +{ + vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; + + position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; + position.y = position.y * (2.0 * uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +vec2 filterTextureCoord(void) +{ + return aPosition * (uOutputFrame.zw * uInputSize.zw); +} + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); + vSecondaryCoord = (uSecondaryMatrix * vec3(vTextureCoord, 1.0)).xy; +} +`,IL=` +in vec2 vTextureCoord; +in vec2 vSecondaryCoord; +out vec4 finalColor; + +uniform sampler2D uTexture; +uniform sampler2D uNextTexture; +uniform sampler2D uMaskTextureA; +uniform sampler2D uMaskTextureB; +uniform float uProgress; +uniform float uSoftness; +uniform float uMaskMix; +uniform float uMaskInvert; +uniform vec4 uMaskChannelWeights; +uniform vec4 uSecondaryClamp; + +float sampleMaskValue(vec2 secondaryUv) +{ + vec2 clampedUv = clamp(secondaryUv, uSecondaryClamp.xy, uSecondaryClamp.zw); + vec4 rawMaskA = texture(uMaskTextureA, clampedUv); + vec4 rawMaskB = texture(uMaskTextureB, clampedUv); + float maskA = dot(rawMaskA, uMaskChannelWeights); + float maskB = dot(rawMaskB, uMaskChannelWeights); + float maskValue = mix(maskA, maskB, clamp(uMaskMix, 0.0, 1.0)); + + return mix(maskValue, 1.0 - maskValue, clamp(uMaskInvert, 0.0, 1.0)); +} + +float sampleReveal(float maskValue) +{ + float progress = clamp(uProgress, 0.0, 1.0); + float lowerEdge = clamp(maskValue - uSoftness, 0.0, 1.0); + float upperEdge = clamp(maskValue + uSoftness, 0.0, 1.0); + + if (lowerEdge == upperEdge) { + return progress < lowerEdge ? 0.0 : 1.0; + } + + float t = clamp((progress - lowerEdge) / (upperEdge - lowerEdge), 0.0, 1.0); + return t * t * (3.0 - 2.0 * t); +} + +void main() +{ + vec2 uv = clamp(vTextureCoord, vec2(0.0), vec2(1.0)); + vec2 secondaryUv = clamp(vSecondaryCoord, uSecondaryClamp.xy, uSecondaryClamp.zw); + vec4 prevColor = texture(uTexture, uv); + vec4 nextColor = texture(uNextTexture, secondaryUv); + float reveal = sampleReveal(sampleMaskValue(secondaryUv)); + + finalColor = mix(prevColor, nextColor, reveal); +} +`,bR=` +struct GlobalFilterUniforms { + uInputSize: vec4, + uInputPixel: vec4, + uInputClamp: vec4, + uOutputFrame: vec4, + uGlobalFrame: vec4, + uOutputTexture: vec4, +}; + +struct ReplaceMaskUniforms { + uProgress: f32, + uSoftness: f32, + uMaskMix: f32, + uMaskInvert: f32, + uMaskChannelWeights: vec4, + uSecondaryMatrix: mat3x3, + uSecondaryClamp: vec4, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler: sampler; +@group(1) @binding(0) var replaceMaskUniforms: ReplaceMaskUniforms; +@group(1) @binding(1) var uNextTexture: texture_2d; +@group(1) @binding(2) var uMaskTextureA: texture_2d; +@group(1) @binding(3) var uMaskTextureB: texture_2d; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv: vec2, + @location(1) secondaryUv: vec2, +}; + +fn filterVertexPosition(aPosition: vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord(aPosition: vec2) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn sampleMaskValue(uv: vec2) -> f32 +{ + let rawMaskA = textureSample(uMaskTextureA, uSampler, uv); + let rawMaskB = textureSample(uMaskTextureB, uSampler, uv); + let maskA = dot(rawMaskA, replaceMaskUniforms.uMaskChannelWeights); + let maskB = dot(rawMaskB, replaceMaskUniforms.uMaskChannelWeights); + let maskValue = mix(maskA, maskB, clamp(replaceMaskUniforms.uMaskMix, 0.0, 1.0)); + + return mix(maskValue, 1.0 - maskValue, clamp(replaceMaskUniforms.uMaskInvert, 0.0, 1.0)); +} + +fn sampleReveal(maskValue: f32) -> f32 +{ + let progress = clamp(replaceMaskUniforms.uProgress, 0.0, 1.0); + let lowerEdge = clamp(maskValue - replaceMaskUniforms.uSoftness, 0.0, 1.0); + let upperEdge = clamp(maskValue + replaceMaskUniforms.uSoftness, 0.0, 1.0); + + if (lowerEdge == upperEdge) { + if (progress < lowerEdge) { + return 0.0; + } + + return 1.0; + } + + let t = clamp((progress - lowerEdge) / (upperEdge - lowerEdge), 0.0, 1.0); + return t * t * (3.0 - 2.0 * t); +} + +@vertex +fn mainVertex(@location(0) aPosition: vec2) -> VSOutput +{ + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition), + (replaceMaskUniforms.uSecondaryMatrix * vec3(filterTextureCoord(aPosition), 1.0)).xy, + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @location(1) secondaryUv: vec2, +) -> @location(0) vec4 +{ + let clampedUv = clamp(uv, vec2(0.0), vec2(1.0)); + let clampedSecondaryUv = clamp( + secondaryUv, + replaceMaskUniforms.uSecondaryClamp.xy, + replaceMaskUniforms.uSecondaryClamp.zw, + ); + let prevColor = textureSample(uTexture, uSampler, clampedUv); + let nextColor = textureSample(uNextTexture, uSampler, clampedSecondaryUv); + let reveal = sampleReveal(sampleMaskValue(clampedSecondaryUv)); + + return mix(prevColor, nextColor, reveal); +} +`,BL=` +in vec2 vTextureCoord; +out vec4 finalColor; + +uniform sampler2D uTexture; +uniform float uMaskInvert; +uniform vec4 uMaskChannelWeights; + +void main() +{ + vec4 rawMask = texture(uTexture, clamp(vTextureCoord, vec2(0.0), vec2(1.0))); + float maskValue = dot(rawMask, uMaskChannelWeights); + float outputValue = mix(maskValue, 1.0 - maskValue, clamp(uMaskInvert, 0.0, 1.0)); + + finalColor = vec4(outputValue, outputValue, outputValue, 1.0); +} +`,vR=` +struct GlobalFilterUniforms { + uInputSize: vec4, + uInputPixel: vec4, + uInputClamp: vec4, + uOutputFrame: vec4, + uGlobalFrame: vec4, + uOutputTexture: vec4, +}; + +struct MaskChannelUniforms { + uMaskInvert: f32, + uMaskChannelWeights: vec4, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler: sampler; +@group(1) @binding(0) var maskChannelUniforms: MaskChannelUniforms; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv: vec2, +}; + +fn filterVertexPosition(aPosition: vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord(aPosition: vec2) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +@vertex +fn mainVertex(@location(0) aPosition: vec2) -> VSOutput +{ + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition), + ); +} + +@fragment +fn mainFragment(@location(0) uv: vec2) -> @location(0) vec4 +{ + let rawMask = textureSample(uTexture, uSampler, clamp(uv, vec2(0.0), vec2(1.0))); + let maskValue = dot(rawMask, maskChannelUniforms.uMaskChannelWeights); + let outputValue = mix( + maskValue, + 1.0 - maskValue, + clamp(maskChannelUniforms.uMaskInvert, 0.0, 1.0), + ); + + return vec4(outputValue, outputValue, outputValue, 1.0); +} +`,kL=(r,e)=>{let t=document.createElement("canvas");t.width=r,t.height=e;let i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:t,context:i}},FL=(r,e,t="red")=>{switch(t){case"green":return r[e+1];case"blue":return r[e+2];case"alpha":return r[e+3];default:return r[e]}},OL=({app:r,texture:e,width:t,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(t*i),a=new Te(k.from(e));a.width=t,a.height=i;let l=new te;l.addChild(a);let c=Ki.create({width:t,height:i});r.renderer.render({container:l,target:c,clear:!0});let u=r.renderer.extract.pixels(c).pixels;for(let h=0,d=0;h{let s=null;for(let o of e.items){let n=OL({app:r,texture:o.texture,width:t,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a{switch(r){case"green":return new Float32Array([0,1,0,0]);case"blue":return new Float32Array([0,0,1,0]);case"alpha":return new Float32Array([0,0,0,1]);default:return new Float32Array([1,0,0,0])}},jy=lf("red"),Yy=(r,e)=>Ki.create({width:r,height:e,resolution:1}),GL=(r,e)=>{let t=new be({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:r,type:"vec4"}});return{filter:rn.from({gpu:{vertex:{source:vR,entryPoint:"mainVertex"},fragment:{source:vR,entryPoint:"mainFragment"}},gl:{vertex:ER,fragment:BL,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:t}}),maskChannelUniforms:t}},TR=({app:r,texture:e,width:t,height:i,channelWeights:s,invert:o=!1})=>{let n=k.from(e),a=new Te(n);a.width=t,a.height=i,a.filterArea=new Q(0,0,t,i);let l=new te;l.addChild(a);let c=Yy(t,i),{filter:u}=GL(s,o);return a.filters=[u],r.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},LL=(r,e,t)=>{let{canvas:i,context:s}=kL(r,e),o=s.createImageData(r,e),n=o.data;for(let a=0,l=0;a{if(!e)return{textures:[k.WHITE.source],channelWeights:lf("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let o=TR({app:r,texture:e.texture,width:t,height:i,channelWeights:lf(e.channel??"red"),invert:e.invert??!1});return{textures:[o.source],channelWeights:jy,invert:0,destroy:()=>{o.destroy(!0)}}}if(e.kind==="sequence"){let o=e.textures.map(n=>TR({app:r,texture:n,width:t,height:i,channelWeights:lf(e.channel??"red"),invert:e.invert??!1}));return{textures:o.map(n=>n.source),channelWeights:jy,invert:0,destroy:()=>{for(let n of o)n.destroy(!0)}}}let s=LL(t,i,UL(r,e,t,i));return{textures:[s.source],channelWeights:jy,invert:0,destroy:()=>{s.destroyed||s.destroy(!0)}}},NL=()=>{let r=new be({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4"},uSecondaryMatrix:{value:new G,type:"mat3x3"},uSecondaryClamp:{value:new Float32Array([0,0,1,1]),type:"vec4"}});return{filter:rn.from({gpu:{vertex:{source:bR,entryPoint:"mainVertex"},fragment:{source:bR,entryPoint:"mainFragment"}},gl:{vertex:ER,fragment:IL,name:"replace-mask-filter"},resources:{replaceMaskUniforms:r,uNextTexture:k.EMPTY.source,uMaskTextureA:k.EMPTY.source,uMaskTextureB:k.EMPTY.source}}),replaceMaskUniforms:r}},HL=({progress:r=0,frameCount:e=0,sampleMode:t="hold"}={})=>{if(e<=1)return{fromIndex:0,toIndex:0,mix:0};let i=qy(r)*Math.max(0,e-1);if(t==="linear"){let o=Math.floor(i),n=Math.min(e-1,o+1);return{fromIndex:o,toIndex:n,mix:i-o}}let s=Math.min(e-1,Math.max(0,Math.round(i)));return{fromIndex:s,toIndex:s,mix:0}},VL=(r,e,t,i,s)=>{let o=RL(e),n=mc([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=DL(r,e,t,i),d=s.resources.replaceMaskUniforms,f=-1,p=-1;return{duration:n,progressTimeline:o,apply:m=>{let g=e?.kind==="sequence"?HL({progress:m,frameCount:l.length,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};g.fromIndex!==f&&(s.resources.uMaskTextureA=l[g.fromIndex]??k.EMPTY.source,f=g.fromIndex),g.toIndex!==p&&(s.resources.uMaskTextureB=l[g.toIndex]??k.EMPTY.source,p=g.toIndex),d.uniforms.uProgress=qy(m),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=g.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},WL=(r,e)=>{let t=Math.max(1,r),i=Math.max(1,e);return new Float32Array([.5/t,.5/i,1-.5/t,1-.5/i])},zL=r=>{let e=new te;for(let t of r)t?.wrapper&&e.addChild(t.wrapper);return wR(SR(e))},af=({app:r,container:e,target:t,frame:i})=>{r.renderer.render({container:e,target:t,clear:!0,transform:new G(1,0,0,1,-i.x,-i.y)})},Hs=r=>{r?.wrapper&&!r.wrapper.destroyed&&r.wrapper.destroy({children:!0}),r?.texture?.destroy(!0)},$L=({prevElement:r,nextElement:e,animation:t,prevSubject:i,nextSubject:s})=>{if(!i||!s||r?.id!==e?.id)return{prevSubject:i,nextSubject:s};let o=i,n=s;return t.mask!==void 0&&t.prev===void 0&&t.next===void 0?{prevSubject:o,nextSubject:n}:(t.prev===void 0&&(o=null),t.next===void 0&&(n=null),{prevSubject:o,nextSubject:n})},XL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=new te;o.zIndex=s,t?.wrapper&&o.addChild(t.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=cf(t?.wrapper??null,e.prev?.tween,r),a=cf(i?.wrapper??null,e.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),Hs(t),Hs(i)}}},jL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=zL([t,i]),n=new te,a=new te;t?.wrapper&&n.addChild(t.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=Yy(o.width,o.height),c=Yy(o.width,o.height),u=new te;u.zIndex=s;let h=new Te(l);h.x=o.x,h.y=o.y,h.filterArea=new Q(0,0,o.width,o.height),u.addChild(h);let{filter:d}=NL();d.resources.uNextTexture=c.source,h.filters=[d];let f=WL(o.width,o.height),p=typeof d.apply=="function"?d.apply.bind(d):(T,b,w,E)=>{T.applyFilter(d,b,w,E)};d.apply=(T,b,w,E)=>{let I=d.resources.replaceMaskUniforms;T.calculateSpriteMatrix(I.uniforms.uSecondaryMatrix,h),I.uniforms.uSecondaryClamp=f,I.update(),p(T,b,w,E)};let m=VL(r,e.mask,o.width,o.height,d),g=cf(t?.wrapper??null,e.prev?.tween,r),_=cf(i?.wrapper??null,e.next?.tween,r),v=!1,x=!1;return t?.wrapper||af({app:r,container:n,target:l,frame:o}),i?.wrapper||af({app:r,container:a,target:c,frame:o}),{overlay:u,duration:Math.max(g.duration,_.duration,m.duration),apply:T=>{g.apply(T),_.apply(T),t?.wrapper&&(g.duration>0||!v)&&(af({app:r,container:n,target:l,frame:o}),v=!0),i?.wrapper&&(_.duration>0||!x)&&(af({app:r,container:a,target:c,frame:o}),x=!0);let b=qy(gc(m.progressTimeline,T));m.apply(b)},destroy:()=>{u.removeFromParent(),h.filters=[],d.destroy(),u.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),Hs(t),Hs(i),m.destroy()}}},YL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>e.mask?jL({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}):XL({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}),qL=({app:r,parent:e,nextElement:t,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h})=>{if(!t)return null;let d=i.add({app:r,parent:e,element:t,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h});return d&&typeof d.then=="function"?d.then(()=>h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null):h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null},KL=async r=>r&&typeof r.then=="function"?r:r??null,uf=({app:r,parent:e,prevElement:t,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,plugin:h,zIndex:d,signal:f})=>{if(!t&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||e.destroyed)return;let p=t?e.children.find(P=>P.label===t.id)??null:null;if(t&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${t.id}".`);let m=p?_R(r,p):null,g=new te,_=Fd({suppressAnimations:!0}),v=a.getVersion(),x=!1,T=()=>{x||(a.track(v),x=!0)},b=()=>{x&&(a.complete(v),x=!1)},w=({flushDeferredEffects:P})=>{if(!B){if(B=!0,E.value&&!E.value.destroyed&&(E.value.visible=!0),I.value?.destroy(),P){fM(_);return}Od(_)}},E={value:null},I={value:null},B=!1;T();let C=P=>{if(f?.aborted||e.destroyed){Od(_),g.destroy({children:!0}),Hs(m),b();return}if(i&&!P)throw Od(_),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);E.value=P;let R=P?_R(r,P):null,M=$L({prevElement:t,nextElement:i,animation:s,prevSubject:m,nextSubject:R});M.prevSubject!==m&&Hs(m),M.nextSubject!==R&&Hs(R),g.destroy({children:!1}),p&&h.delete({app:r,parent:e,element:t,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:f}),P&&(P.zIndex=d,e.addChild(P),P.visible=!1);let F=YL({app:r,animation:s,prevSubject:M.prevSubject,nextSubject:M.nextSubject,zIndex:d});I.value=F,e.addChild(F.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:F.duration,applyFrame:F.apply,applyTargetState:()=>{w({flushDeferredEffects:!1})},onComplete:()=>{try{w({flushDeferredEffects:!0})}finally{b()}},onCancel:()=>{b()},isValid:()=>!!F.overlay&&!F.overlay.destroyed&&(!P||!P.destroyed)}})},A=i?qL({app:r,parent:g,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:f}):null;if(A&&typeof A.then=="function"){KL(A).then(C);return}C(A??null)};var Vs=({app:r,parent:e,prevComputedTree:t,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=Fd(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(b=>[b.type,b])),d=pM(s),f=new Map,p=new Map;for(let b of t)f.set(b.id,b);for(let b=0;bb.id)),x=b=>{let w=h.get(b);if(!w)throw new Error(`No plugin found for element type: ${b}`);return w},T=b=>e.children.find(w=>w.label===b)?.zIndex??-1;for(let b of i){let w=f.get(b.id);!w||v.has(b.id)||!pe(w,b)||x(b.type).shouldUpdateUnchanged?.({app:r,parent:e,prevElement:w,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:u})!==!0||(_.push({prev:w,next:b}),v.add(b.id))}for(let b of e.children){let w=p.get(b.label);w!==void 0&&(b.zIndex=w)}for(let b of g){let w=c.suppressAnimations?null:Ld(d,b.id),E=x(b.type);if(w){uf({app:r,parent:e,prevElement:b,nextElement:null,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:T(b.id),signal:u});continue}E.delete({app:r,parent:e,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}for(let b of m){let w=c.suppressAnimations?null:Ld(d,b.id),E=x(b.type),I=p.get(b.id)??-1;if(w){uf({app:r,parent:e,prevElement:null,nextElement:b,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:I,signal:u});continue}E.add({app:r,parent:e,element:b,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}for(let{prev:b,next:w}of _){let E=x(w.type),I=p.get(w.id)??-1,B=c.suppressAnimations?null:Ld(d,w.id);if(B){uf({app:r,parent:e,prevElement:b,nextElement:w,animation:B,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:I,signal:u});continue}E.update({app:r,parent:e,prevElement:b,nextElement:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}};var ZL=(r=[])=>{let e=new Set;for(let t of r)if(t?.id){if(e.has(t.id))return!0;e.add(t.id)}return!1},QL=({app:r,container:e,children:t,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of t){let u=o.find(h=>h.type===c.type);if(!u)throw new Error(`No plugin found for child element type: ${c.type}`);u.add({app:r,parent:e,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},AR=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:u})=>{let{id:h,x:d,y:f,children:p,scroll:m,alpha:g}=t,_=new te;_.label=h,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=g,e.addChild(_),p&&p.length>0&&(ZL(p)?QL({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):Vs({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(m||t.anchorToBottom)&&fc({container:_,element:t,interactive:!!m,allowViewportWithoutScroll:!!t.anchorToBottom}),sf({app:r,container:_,element:t,eventHandler:s})};var PR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:u,signal:h})=>{let d=e.children.find(v=>v.label===t.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,g=()=>{if(!pe(t,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=m,d.scale.x=1,d.scale.y=1;let b=t.scroll||t.anchorToBottom,w=i.scroll||i.anchorToBottom,E=w?dR({container:d}):null;b!==w?w?fc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:E}):$y({container:d}):w&&($y({container:d}),fc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:E})),sf({app:r,container:d,element:i,eventHandler:s})}let v=!pe(t.children,i.children),x=pc({children:i.children}),T=Array.from(x).some(b=>Gd(o,b).length>0);if(v||T){let w=d.children.find(E=>E.label===`${i.id}-content`)||d;Vs({app:r,parent:w,nextComputedTree:i.children,prevComputedTree:t.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),pR({container:d}),mR({container:d}),gR({container:d})}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:u,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{g()}})||g()};var CR=({app:r,parent:e,element:t,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=e.getChildByLabel(t.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(e.removeChild(a),a.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var MR=({state:r,parserPlugins:e=[]})=>{let t=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0;for(let x=0;x0?t==="horizontal"?(b.x=c,b.y=f):t==="vertical"&&(b.x=p,b.y=u):(t==="horizontal"||t==="vertical")&&(b.x=0,b.y=0);let w=e.find(E=>E.type===b.type);if(w){let E=b.scaleX!==void 0||r.scaleX!==void 0,I=b.scaleY!==void 0||r.scaleY!==void 0,B=(b.scaleX??1)*(r.scaleX??1),C=(b.scaleY??1)*(r.scaleY??1);b=w.parse({state:{...b,...E?{scaleX:B}:{},...I?{scaleY:C}:{}},parserPlugins:e})}t==="horizontal"?(r.width&&b.width+m>r.width&&!i&&!r.anchorToBottom?(c=0,m=0,f+=h+s,h=b.height,b.x=0,b.y=f):h=Math.max(h,b.height),c+=b.width+T,m=b.x+b.width,a=Math.max(c,a),l=Math.max(b.height+b.y,l)):t==="vertical"?(r.height&&b.height+g>r.height&&!i&&!r.anchorToBottom?(u=0,g=0,p+=d+s,d=b.width,b.x=p,b.y=0):d=Math.max(d,b.width),u+=b.height+T,g=b.y+b.height,a=Math.max(b.width+b.x,a),l=Math.max(u,l)):(a=Math.max(b.width+b.x,a),l=Math.max(b.height+b.y,l)),n.push(b)}let v={...yt({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:t,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},...r.scrollbar&&{scrollbar:structuredClone(r.scrollbar)},rotation:r.rotation??0};return r.rightClick&&(v.rightClick=r.rightClick),v};var JL=et({type:"container",add:AR,update:PR,delete:CR,parse:MR});var RR=async({parent:r,element:e,animationBus:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new te;if(a.label=e.id,a.zIndex=o,e.x!==void 0&&(a.x=Math.round(e.x)),e.y!==void 0&&(a.y=Math.round(e.y)),e.alpha!==void 0&&(a.alpha=e.alpha),r.addChild(a),i?.suppressAnimations&&!_n(e)){await Ti({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"paused-initial"}),Ud(i,{container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n});return}await Ti({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"autoplay"})};var IR=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),eD=(r,e)=>IR(r)!==IR(e),BR=async({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===e.id);if(!c)return;let u=async()=>{if(t.x!==void 0&&(c.x=t.x),t.y!==void 0&&(c.y=t.y),t.alpha!==void 0&&(c.alpha=t.alpha),!eD(e,t)){o?.suppressAnimations!==!0&&!_n(t)&&await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&!_n(t)){await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),Ud(o,{container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:c,targetState:{x:t.x??c.x,y:t.y??c.y,alpha:t.alpha??c.alpha},onComplete:()=>{u()}})||await u()};var kR=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(Py(o),o.destroy({children:!0}))};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var tD=r=>r===` +`||r==="\r",rD=r=>typeof r=="string"&&De.isBreakingSpace(r),iD=(r,e,t)=>{let i=0,s=0;for(;i{let t=[],i=[],s=0,o=0,n=0,a=0,l=0,c=[...r],u=new WeakSet,h=Math.max(10,r.reduce((p,m)=>p+(m?.text?.length??0),0)*4),d=()=>{t.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[]};for(;c.length>0;){if(l+=1,l>h)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let p=c[0];if(!p.text||p.text.length===0){c.shift();continue}let m=p.text,g=Math.max(1,Math.round(e-s)),_={...p.textStyle,wordWrapWidth:g},v=De.measureText(p.text,new Oe(ir(_)));if(v.lineWidths[0]>g&&i.length>0){d();continue}let x=v.lines[0]??"",T=v.lines.length>1,b="",w=!1;if(v.lines.length===1&&p.text.endsWith(" ")&&!x.endsWith(" ")&&(x+=" "),x.length>0){let C=iD(m,x,T);b=C.remainingText,w=C.consumedExplicitNewline}if(x.length===0&&m.length>0){let C=m.match(/^\s+/)?.[0]??"";x=C.length>0?C:m[0],b=m.slice(x.length)}if(b===m){let C=m.match(/^\s+/)?.[0]??m[0]??"";if(C.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");x=C,b=m.slice(C.length)}let E=De.measureText(x,new Oe({...ir(p.textStyle),wordWrap:!1,breakWords:!1})),I=Math.max(0,Math.round(E.width??v.lineWidths[0]??0)),B={text:x,textStyle:_,height:E.height,x:s,y:o};if(p.furigana&&!u.has(p)){u.add(p);let C=De.measureText(p.furigana.text,new Oe(ir(p.furigana.textStyle))),A=-C.height+o+2,P={text:p.furigana.text,textStyle:p.furigana.textStyle,x:Math.round(s+(I-C.width)/2),y:A};B.furigana=P}i.push(B),n=Math.max(n,E.height),s+=I,a=Math.max(a,s),b&&b.length>0?p.text=b:c.shift(),(T||w)&&s>0&&d()}i.length>0&&t.push({lineParts:i,y:o,lineMaxHeight:n});for(let p=0;p{let _=g.height;g.height&&delete g.height;let v=g.y+(m-_),x=g.furigana;return x&&(x.y=x.y-g.y+v),{...g,...x&&{furigana:x},y:v}})}let f=t.length>0?t[t.length-1].y+t[t.length-1].lineMaxHeight:0;return{chunks:t,width:Math.max(a,e),height:f}},FR=({state:r})=>{let e={...Ge,wordWrap:!0,...r.textStyle||{}},t=(r.content||[]).map(u=>{let h={...e,...u.textStyle||{}};h.lineHeight=Math.round(h.lineHeight*h.fontSize),r.width&&(h.wordWrapWidth=r.width,h.wordWrap=!0);let d=null;if(u.furigana){let p={...e,...u.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(u.furigana.text),textStyle:p}}return{text:String(u.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:h,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=sD(t,i),a=r.width||o,c=yt({...r,width:a,height:n});if(c.alpha=r.alpha??1,r.indicator){let u=r.indicator;c.indicator={revealing:{src:u.revealing?.src??"",width:u.revealing?.width??12,height:u.revealing?.height??12},complete:{src:u.complete?.src??"",width:u.complete?.width??12,height:u.complete?.height??12},offset:u.offset??12}}return{...c,content:s,textStyle:{...e,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var oD=et({type:"text-revealing",add:RR,update:BR,delete:kR,parse:FR,shouldUpdateUnchanged:({parent:r,nextElement:e})=>oM(r.children.find(t=>t.label===e.id))});var hf=(r,e,t,i)=>{if(!t)return;let s=o=>{o?.detail?.elementId===e&&typeof o?.detail?.frameIndex=="number"&&(r.gotoAndStop(o?.detail?.frameIndex),i?.())};window.addEventListener("snapShotAnimatedSpriteFrame",s),r._snapShotKeyFrameHandler=s},df=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var OR=(r={})=>{if(r.frame){let n=r.frame.w??0,a=r.frame.h??0,l=r.sourceSize?.w??n,c=r.sourceSize?.h??a,u={frame:{x:r.frame.x??0,y:r.frame.y??0,w:n,h:a},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.spriteSourceSize?.x??0,y:r.spriteSourceSize?.y??0,w:r.spriteSourceSize?.w??n,h:r.spriteSourceSize?.h??a},sourceSize:{w:l,h:c}};return r.anchor?u.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(u.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(u.borders={...r.borders}),u}let e=r.width??r.w??0,t=r.height??r.h??0,i=r.sourceWidth??e,s=r.sourceHeight??t,o={frame:{x:r.x??0,y:r.y??0,w:e,h:t},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.offsetX??0,y:r.offsetY??0,w:e,h:t},sourceSize:{w:i,h:s}};return r.anchor?o.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(o.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(o.borders={...r.borders}),o},Ky=(r={})=>!r||typeof r!="object"?{}:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Array.isArray(t)?t.map(i=>String(i)):[]])),nD=(r,e={})=>{let t=Math.max(0,Number(e.from??0)),i=Math.min(r.length-1,Number(e.to??t));if(!Number.isFinite(t)||!Number.isFinite(i)||i!Array.isArray(r)||e.length===0?{}:Object.fromEntries(r.map(t=>{let i=typeof t?.name=="string"?t.name:"";return i?[i,nD(e,t)]:null}).filter(Boolean)),Rn=(r={})=>{let e=r??{},t=Ky(e.animations);return{frames:Array.isArray(e.frames)?Object.fromEntries(e.frames.map(s=>{let o=s?.filename??s?.name;return typeof o!="string"||o.length===0?null:[o,OR(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,OR(o)])),...Object.keys(t).length>0?{animations:t}:{},meta:{...e.meta??{},scale:String(e.scale??e.meta?.scale??1),...e.width!=null||e.height!=null?{size:{w:e.width??e.meta?.size?.w??0,h:e.height??e.meta?.size?.h??0}}:{}}}},In=(r={},e={},t={},i=[])=>({...aD(t?.frameTags,i),...Ky(e),...Ky(r)}),lD=(r,e)=>{if(!Array.isArray(e?.frames))return[];let t=Object.keys(r.frames??{});return e.frames.map(i=>typeof i=="number"?t[i]:String(i)).filter(Boolean)},Ws=({atlas:r={frames:{}},clips:e={},playback:t,legacyAnimation:i})=>{let s=t??i??{},o={fps:s.fps??null,loop:s.loop??!0,autoplay:s.autoplay??!0};return typeof s.clip=="string"&&s.clip.length>0&&(o.clip=s.clip),Array.isArray(s.frames)?o.frames=s.frames.map(n=>typeof n=="number"?Object.keys(r.frames??{})[n]:String(n)).filter(Boolean):o.clip||(o.frames=lD(r,i)),o.fps==null&&(typeof s.animationSpeed=="number"?o.fps=s.animationSpeed*60:o.fps=30),o.clip&&(!Array.isArray(o.frames)||o.frames.length===0)&&(o.frames=Array.isArray(e[o.clip])?[...e[o.clip]]:[]),Array.isArray(o.frames)||(o.frames=[]),o},ff=({spritesheet:r,atlas:e,clips:t={},playback:i,legacyAnimation:s})=>{let o=Ws({atlas:e,clips:t,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>r.textures[a]),playback:o}},pf=r=>typeof r=="number"?r/60:.5;var UR=async({app:r,parent:e,element:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:l,y:c,width:u,height:h,src:d,atlas:f,clips:p,playback:m,alpha:g}=t,_=Rn(f),v=In(p,f?.animations,f?.meta,Object.keys(_.frames??{})),x=Ws({atlas:_,clips:v,playback:m}),T=s?.getVersion?.();s?.track?.(T);try{let b=new Ni(k.from(d),_);if(await b.parse(),n?.aborted||e.destroyed)return;let{frameTextures:w}=ff({spritesheet:b,atlas:_,clips:v,playback:x}),E=new nc(w);E.label=a,E.zIndex=o,E.animationSpeed=pf(x.fps),E.loop=x.loop,r.debug?hf(E,a,r.debug,()=>{typeof r.render=="function"&&r.render()}):x.autoplay&&cM(i,E),E.x=Math.round(l),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(h),E.alpha=g,e.addChild(E),typeof r.render=="function"&&r.render()}finally{s?.complete?.(T)}};var GR=async({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=e.children.find(_=>_.label===t.id);if(!c)return;c.zIndex=a;let u=async()=>{if(!(l?.aborted||c.destroyed)&&!pe(t,i)){let _=i.src,v=Rn(i.atlas),x=In(i.clips,i.atlas?.animations,i.atlas?.meta,Object.keys(v.frames??{})),T=Ws({atlas:v,clips:x,playback:i.playback});c.x=Math.round(i.x),c.y=Math.round(i.y),c.width=Math.round(i.width),c.height=Math.round(i.height),c.alpha=i.alpha;let b=!pe(t.playback,i.playback),w=!pe(t.clips,i.clips),E=t.src!==_||!pe(t.atlas,i.atlas);if(c.animationSpeed=pf(T.fps),c.loop=T.loop,b||w||E){let I=n?.getVersion?.();n?.track?.(I);try{let B=new Ni(k.from(_),v);if(await B.parse(),l?.aborted||c.destroyed)return;let{frameTextures:C}=ff({spritesheet:B,atlas:v,clips:x,playback:T});c.textures=C,typeof r.render=="function"&&r.render(),!r.debug&&T.autoplay?c.play():(r.debug||c.stop?.(),t.id!==i.id&&(df(c),hf(c,i.id,r.debug,()=>{typeof r.render=="function"&&r.render()})))}finally{n?.complete?.(I)}}}},{x:h,y:d,width:f,height:p,alpha:m}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:m},onComplete:()=>{u()}})||await u()};var LR=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.children.find(c=>c.label===t.id);if(!n)return;let a=()=>{r.debug&&df(n),n&&!n.destroyed&&(n.stop(),n.destroy())};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var DR=({state:r})=>{let e=yt(r),t=r.atlas,i=Rn(t),s=In(r.clips,t?.animations,t?.meta,Object.keys(i.frames??{})),o=Ws({atlas:i,clips:s,playback:r.playback});return{...e,type:"spritesheet-animation",src:r.src??"",atlas:i,clips:s,playback:o,alpha:r.alpha??1}};var NR=et({type:"spritesheet-animation",add:UR,update:GR,delete:LR,parse:DR}),cD=NR;var uD=vy({type:"tween"});var zs=new Map,hD=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:We(r.volume,80)}),HR=r=>zs.has(r),xc=r=>{let e=zs.get(r);e!==void 0&&(clearTimeout(e),zs.delete(r))},Zy=({app:r,element:e})=>{let t=hD(e);if(xc(t.id),e.delay&&e.delay>0){let i=setTimeout(()=>{zs.delete(t.id),r.audioStage.add(t)},e.delay);zs.set(t.id,i);return}r.audioStage.add(t)},Qy=()=>{for(let r of zs.values())clearTimeout(r);zs.clear()},VR=({app:r,element:e})=>{Zy({app:r,element:e})};var WR=({app:r,prevElement:e,nextElement:t})=>{let i=e.id;if((t.delay??0)>0){r.audioStage.remove(i),Zy({app:r,element:t});return}if(HR(i)){xc(i),r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:We(t.volume,80)});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:We(t.volume,80)});return}o.url=t.src,o.loop=t.loop??!1,o.volume=We(t.volume,80)};var zR=({app:r,element:e})=>{xc(e.id),r.audioStage.remove(e.id)};var dD=Ty({type:"sound",add:VR,update:WR,delete:zR});var yc=class extends Te{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(e){super(),this.emitter=e,this.anchor.set(.5,.5)}init(e){this.maxLife=e,this.age=0,this.oneOverLife=1/e,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Jy(r){let e=new Ue;return e.circle(0,0,3),e.fill({color:16777215}),r.renderer.generateTexture(e)}function e_(r){let e=new Ue;return e.rect(0,0,1,8),e.fill({color:8965375}),r.renderer.generateTexture(e)}function t_(r){let e=new Ue;return e.circle(0,0,4),e.fill({color:16777215}),r.renderer.generateTexture(e)}function _c(r,e,t){return r+(e-r)*t}function gf(r){if(typeof r=="number")return r;let e=r.replace(/^(#|0x)/,"");return parseInt(e,16)}function $R(r,e,t){let i=r>>16&255,s=r>>8&255,o=r&255,n=e>>16&255,a=e>>8&255,l=e&255,c=Math.round(_c(i,n,t)),u=Math.round(_c(s,a,t)),h=Math.round(_c(o,l,t));return c<<16|u<<8|h}var mf=class r{constructor(e,t,i=!1){this.value=i?gf(e):e,this.time=t,this.next=null}static createList(e,t=!1){let i=[...e].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,t),o=s;for(let n=1;n=t.next.time)return t.next?t.next.value:t.value;let i=(e-t.time)/(t.next.time-t.time);return this.isColor?$R(t.value,t.next.value,i):_c(t.value,t.next.value,i)}};var xf=class{static type="alpha";constructor(e){this.list=new kr(!1),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.alpha=i,t=t.next}updateParticle(e,t){e.alpha=this.list.getValue(e.agePercent)}},yf=class{static type="alphaStatic";constructor(e){this.alpha=e.alpha}initParticles(e){let t=e;for(;t;)t.alpha=this.alpha,t=t.next}updateParticle(e,t){}};function XR(r,e,t){return Math.min(Math.max(r,e),t)}function Bt(r,e){if(typeof e=="number")return e;let t=e.min,i=e.max??e.min;if(t===i)return t;let s=e.distribution;return!s||s.kind==="uniform"?t+r()*(i-t):s.kind==="bias"?t+fD(r,s)*(i-t):s.kind==="normal"?pD(r,t,i,s):t+r()*(i-t)}function fD(r,e){let t=e.toward??"min",i=XR(e.strength??.5,0,1),s=1+i*4;if(t==="max")return 1-Math.pow(1-r(),s);if(t==="center"){let o=(r()+r())/2;return r()*(1-i)+o*i}return Math.pow(r(),s)}function pD(r,e,t,i){let s=i.mean??(e+t)/2,o=i.deviation??(t-e)/6,n=Math.max(r(),1e-7),a=r(),l=Math.sqrt(-2*Math.log(n))*Math.cos(2*Math.PI*a);return XR(s+l*o,e,t)}var _f=class{static type="scale";constructor(e){this.list=new kr(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.scaleMult=i;let s=this.list.getValue(0)*i;t.scale.set(s,s),t=t.next}}updateParticle(e,t){let i=this.list.getValue(e.agePercent)*e.config.scaleMult;e.scale.set(i,i)}},bf=class{static type="scaleStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=Bt(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.scale.set(i,i),t=t.next}}updateParticle(e,t){}};var mD=Math.PI/180,vf=class{static type="speed";constructor(e){this.list=new kr(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.speedMult=i;let s=this.list.getValue(0)*i;t.velocity.x=Math.cos(t.rotation)*s,t.velocity.y=Math.sin(t.rotation)*s,t=t.next}}updateParticle(e,t){let i=this.list.getValue(e.agePercent)*e.config.speedMult,s=Math.sqrt(e.velocity.x*e.velocity.x+e.velocity.y*e.velocity.y);s>0&&(e.velocity.x=e.velocity.x/s*i,e.velocity.y=e.velocity.y/s*i),e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}},Tf=class{static type="speedStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=Bt(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}},Sf=class{static type="movePoint";constructor(e){this.speed={min:e.speed.min,max:e.speed.max??e.speed.min,distribution:e.speed.distribution},this.direction=e.direction}initParticles(e){let t=e;for(;t;){let i=Bt(t.emitter.random.bind(t.emitter),this.speed),s=Bt(t.emitter.random.bind(t.emitter),this.direction)*mD;t.velocity.x=Math.cos(s)*i,t.velocity.y=Math.sin(s)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var tye=Math.PI/180,wf=class{static type="acceleration";constructor(e){this.accelX=e.accel.x,this.accelY=e.accel.y,this.minStart=e.minStart,this.maxStart=e.maxStart,this.rotate=e.rotate??!1,this.maxSpeed=e.maxSpeed??0}initParticles(e){let t=e;for(;t;){let i=t.emitter.random()*(this.maxStart-this.minStart)+this.minStart;t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){let i=e.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*t,i.y+=this.accelY*t,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}e.x+=(s+i.x)/2*t,e.y+=(o+i.y)/2*t,this.rotate&&(e.rotation=Math.atan2(i.y,i.x))}},Ef=class{static type="gravity";constructor(e){this.gravity=e.gravity}initParticles(e){}updateParticle(e,t){e.velocity.y+=this.gravity*t,e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var bc=Math.PI/180,Af=class{static type="rotation";constructor(e){this.startRange={min:e.minStart,max:e.maxStart??e.minStart,distribution:e.startDistribution},this.speedRange={min:e.minSpeed,max:e.maxSpeed??e.minSpeed,distribution:e.speedDistribution},this.accel=(e.accel??0)*bc}initParticles(e){let t=e;for(;t;)t.rotation=Bt(t.emitter.random.bind(t.emitter),this.startRange)*bc,t.rotationSpeed=Bt(t.emitter.random.bind(t.emitter),this.speedRange)*bc,t=t.next}updateParticle(e,t){if(this.accel!==0){let i=e.rotationSpeed;e.rotationSpeed+=this.accel*t,e.rotation+=(i+e.rotationSpeed)/2*t}else e.rotation+=e.rotationSpeed*t}},Pf=class{static type="rotationStatic";constructor(e){this.range={min:e.min,max:e.max??e.min,distribution:e.distribution}}initParticles(e){let t=e;for(;t;)t.rotation=Bt(t.emitter.random.bind(t.emitter),this.range)*bc,t=t.next}updateParticle(e,t){}},Cf=class{static type="noRotation";constructor(e){this.rotation=(e.rotation??0)*bc}initParticles(e){let t=e;for(;t;)t.rotation=this.rotation,t=t.next}updateParticle(e,t){e.rotation=this.rotation}};var Mf=class{static type="color";constructor(e){this.list=new kr(!0),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.tint=i,t=t.next}updateParticle(e,t){e.tint=this.list.getValue(e.agePercent)}},Rf=class{static type="colorStatic";constructor(e){this.color=gf(e.color)}initParticles(e){let t=e;for(;t;)t.tint=this.color,t=t.next}updateParticle(e,t){}};var If=class{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}getRandPos(e,t){e.x=this.x+t.random()*this.w,e.y=this.y+t.random()*this.h}},Bf=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius,this.innerRadius=e.innerRadius??0,this.affectRotation=e.affectRotation??!1}getRandPos(e,t){let i=t.random()*Math.PI*2,s=this.radius-this.innerRadius,o=t.random()*s+this.innerRadius;e.x=this.x+Math.cos(i)*o,e.y=this.y+Math.sin(i)*o,this.affectRotation&&(e.rotation=i)}},r_=class{constructor(e){this.x=e.x,this.y=e.y}getRandPos(e,t){e.x=this.x,e.y=this.y}},i_=class{constructor(e){this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2}getRandPos(e,t){let i=t.random();e.x=this.x1+(this.x2-this.x1)*i,e.y=this.y1+(this.y2-this.y1)*i}},gD={rect:If,rectangle:If,torus:Bf,circle:Bf,point:r_,line:i_};var kf=class{static type="spawnShape";constructor(e){let t=gD[e.type];if(!t)throw new Error(`Unknown spawn shape type: ${e.type}`);this.shape=new t(e.data)}initParticles(e){let t=e,i={x:0,y:0,rotation:void 0};for(;t;)this.shape.getRandPos(i,t.emitter),t.x=i.x,t.y=i.y,i.rotation!==void 0&&(t.rotation=i.rotation),t=t.next}updateParticle(e,t){}},Ff=class{static type="spawnBurst";constructor(e){this.x=e.x,this.y=e.y,this.spacing=(e.spacing??0)*Math.PI/180,this.startAngle=(e.startAngle??0)*Math.PI/180}initParticles(e){let t=e,i=this.startAngle;for(;t;)t.x=this.x,t.y=this.y,t.rotation=i,i+=this.spacing,t=t.next}updateParticle(e,t){}};var jR=Math.PI/180,Of=class{static type="movement";constructor(e={}){this.velocity=e.velocity??null,this.accelX=e.acceleration?.x??0,this.accelY=e.acceleration?.y??0,this.maxSpeed=e.maxSpeed??0,this.faceVelocity=e.faceVelocity??!1}initParticles(e){let t=e;for(;t;){if(this.velocity){let i=this.#t(t.emitter.random.bind(t.emitter)),s=Bt(t.emitter.random.bind(t.emitter),this.velocity.speed);t.velocity.x=Math.cos(i)*s,t.velocity.y=Math.sin(i)*s,this.faceVelocity&&s>0&&(t.rotation=i)}t=t.next}}updateParticle(e,t){let i=e.velocity;if(this.accelX!==0||this.accelY!==0){let o=i.x,n=i.y;i.x+=this.accelX*t,i.y+=this.accelY*t,this.#e(i),e.x+=(o+i.x)/2*t,e.y+=(n+i.y)/2*t}else this.#e(i),e.x+=i.x*t,e.y+=i.y*t;this.faceVelocity&&Math.sqrt(i.x*i.x+i.y*i.y)>0&&(e.rotation=Math.atan2(i.y,i.x))}#t(e){return this.velocity?this.velocity.kind==="radial"?Bt(e,this.velocity.angle??{min:0,max:360})*jR:Bt(e,this.velocity.direction??0)*jR:0}#e(e){if(this.maxSpeed<=0)return;let t=Math.sqrt(e.x*e.x+e.y*e.y);if(t>this.maxSpeed&&t>0){let i=this.maxSpeed/t;e.x*=i,e.y*=i}}};var YR=new Map,qR=new Map;function s_(r,e){YR.set(r,e)}function Et(r){qR.set(r.type,r)}function KR(r,e){let t=YR.get(r);return t?t(e):null}function ZR(r){return qR.get(r)}s_("circle",t_);s_("snowflake",Jy);s_("raindrop",e_);Et(xf);Et(yf);Et(_f);Et(bf);Et(vf);Et(Tf);Et(Sf);Et(wf);Et(Ef);Et(Af);Et(Pf);Et(Cf);Et(Mf);Et(Rf);Et(kf);Et(Ff);Et(Of);var Uf=class{constructor(e){this.seed=e,this.state=e}next(){let e=this.state+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};function xD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}var vc=class{container=null;texture=null;textureSelector=null;_textureCycleIndex=0;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(e,t){this.container=e,this.init(t)}init(e){if(this.rng=e.seed!==void 0&&e.seed!==null?new Uf(e.seed):null,e.texture&&(xD(e.texture)?(this.textureSelector=e.texture,this.texture=e.texture.items[0]?.texture??null):(this.textureSelector=null,this.texture=e.texture)),this._textureCycleIndex=0,e.lifetime&&(this.lifetime.min=e.lifetime.min??1,this.lifetime.max=e.lifetime.max??e.lifetime.min??2,this.lifetime.distribution=e.lifetime.distribution),this.frequency=e.frequency??.1,this.particlesPerWave=e.particlesPerWave??1,this.maxParticles=e.maxParticles??1e3,this.emitterLifetime=e.emitterLifetime??-1,this.spawnBounds=null,this.recycleOnBounds=!1,e.spawnBounds&&(this.spawnBounds=e.spawnBounds,this.recycleOnBounds=e.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],e.behaviors)for(let t of e.behaviors){let i=ZR(t.type);if(!i){console.warn(`Unknown behavior type: ${t.type}`);continue}let s=new i(t.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=e.emit??!0}_createParticle(){let e;return this._poolFirst?(e=this._poolFirst,this._poolFirst=e.next,e.next=null):e=new yc(this),e}spawn(e){if(this.destroyed||e<=0)return null;let t=this.maxParticles-this.particleCount;if(e=Math.min(e,t),e<=0)return null;let i=this.textureSelector?.pick==="perWave"?this._pickTexture():null,s=null,o=null;for(let n=0;n0&&(this._emitterAge+=e,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=e;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let t=this._activeFirst;for(;t;){let i=t.next;if(t.age+=e,t.age>=t.maxLife){this.recycle(t),t=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(t.xs.x+s.width||t.ys.y+s.height){this.recycle(t),t=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(t,e);t=i}}stop(e=!1){if(this.emit=!1,e)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}_pickTexture(){if(!this.textureSelector)return this.texture;let{mode:e,items:t}=this.textureSelector;if(!t.length)return this.texture;if(e==="cycle"){let i=t[this._textureCycleIndex%t.length];return this._textureCycleIndex+=1,i.texture}if(e==="random"){let i=t.reduce((o,n)=>o+(n.weight??1),0),s=this.random()*i;for(let o of t)if(s-=o.weight??1,s<=0)return o.texture;return t[t.length-1].texture}return t[0].texture}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let e=this._activeFirst;for(;e;){let t=e.next;e.destroy(),e=t}for(e=this._poolFirst;e;){let t=e.next;e.destroy(),e=t}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function yD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}function _D(r,e){let t=new Ue,i=e.color??"#ffffff";switch(e.shape){case"circle":{let s=e.radius??3;t.circle(0,0,s),t.fill({color:i});break}case"ellipse":{let s=e.width??2,o=e.height??6;t.ellipse(0,0,s/2,o/2),t.fill({color:i});break}case"rect":{let s=e.width??4,o=e.height??4;t.rect(-s/2,-o/2,s,o),t.fill({color:i});break}default:t.circle(0,0,3),t.fill({color:i})}return r.renderer.generateTexture(t)}function QR(r,e){if(typeof e=="object"&&e?.shape)return _D(r,e);let t=e??"circle",i=KR(t,r);if(!i)try{i=k.from(t)}catch{return console.warn(`Failed to load particle texture: ${t}`),null}return i}function bD(r,e){let t=[];for(let i of e.items){let s=i.src?i.src:i,o=QR(r,s);if(!o)return null;t.push(i.weight===void 0?{texture:o}:{texture:o,weight:i.weight})}return{mode:e.mode,pick:e.pick??"perParticle",items:t}}var Tc=({app:r,parent:e,element:t,renderContext:i,zIndex:s})=>{let o=new te;o.label=t.id,o.zIndex=s,e.addChild(o);let n=t.width,a=t.height;o.x=t.x??0,o.y=t.y??0;let l={lifetime:t.emitter?.lifetime??{min:1,max:2},frequency:t.emitter?.frequency??.1,particlesPerWave:t.emitter?.particlesPerWave??1,maxParticles:t.emitter?.maxParticles??t.count??100,emitterLifetime:t.emitter?.emitterLifetime??-1,spawnBounds:t.emitter?.spawnBounds,recycleOnBounds:t.emitter?.recycleOnBounds??!1,seed:t.emitter?.seed,behaviors:t.behaviors},c=yD(t.texture)?bD(r,t.texture):QR(r,t.texture);if(!c)return;l.texture=c;let u=new vc(o,l);o.emitter=u;let h=l.frequency<=0;if(h){u.emitNow(),u.emit=!1;let f=p=>{if(!p.length)return;let[m,...g]=p;(m===0&&typeof requestAnimationFrame=="function"?requestAnimationFrame:v=>setTimeout(v,m))(()=>{u.destroyed||u.particleCount>0||(u.emitNow(),f(g))})};f([0,50,150])}if(l.recycleOnBounds&&!h){let f=Math.min(t.count??100,l.maxParticles);u.spawn(f);let p=u._activeFirst;for(;p;)p.y=u.random()*a,p.age=u.random()*p.maxLife*.8,p=p.next}let d=f=>{if(u.destroyed){r.ticker.remove(d);return}let p=Math.min(typeof f.deltaMS=="number"?f.deltaMS/1e3:f.deltaTime/60,.1);u.update(p)};o.tickerCallback=d,hM(i,{app:r,emitter:u,container:o,tickerCallback:d}),t.alpha!==void 0&&(o.alpha=t.alpha)};var Gf=({app:r,parent:e,element:t,animationBus:i,animations:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var JR=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=e.children.find(h=>h.label===t.id);if(!c){Tc({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});return}if(c.zIndex=l,vD(t,i))Gf({app:r,parent:e,element:t,animations:s,animationBus:o,completionTracker:n}),Tc({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});else{let h=()=>{i.alpha!==void 0&&(c.alpha=i.alpha),i.x!==void 0&&(c.x=i.x),i.y!==void 0&&(c.y=i.y)};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:i.x??c.x,y:i.y??c.y,alpha:i.alpha??c.alpha},onComplete:h})||h()}};function vD(r,e){return r.count!==e.count||!pe(r.texture,e.texture)||!pe(r.behaviors,e.behaviors)||!pe(r.emitter,e.emitter)||r.width!==e.width||r.height!==e.height}function o_(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Us).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Us).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function eI(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let e=typeof r.texture=="string",t=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!e&&!t)throw new Error("Input Error: texture must be a string or shape object");if(t){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function tI(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let e=0;er.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function iI(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function sI(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var TD=new Set(["continuous","burst"]),SD=new Set(["point","rect","circle","line"]),wD=new Set(["single","random","cycle"]),ED=new Set(["perParticle","perWave"]),oI=new Set(["uniform","normal","bias"]),nI=new Set(["min","max","center"]),AD=new Set(["none","fixed","random","spin"]);function uI(r){if(PD(r),!r.modules||typeof r.modules!="object"||Array.isArray(r.modules))throw new Error("Input Error: Particles require 'modules'");let{emission:e,movement:t,appearance:i,bounds:s}=r.modules;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Input Error: modules.emission must be an object");if(!i||typeof i!="object"||Array.isArray(i))throw new Error("Input Error: modules.appearance must be an object");CD(e),RD(t,i),ID(i),UD(s)}function PD(r){if(r.texture!==void 0||r.behaviors!==void 0||r.emitter!==void 0)throw new Error("Input Error: Structured particles cannot mix 'modules' with legacy texture/behaviors/emitter fields");if(r.count!==void 0)throw new Error("Input Error: Structured particles do not support legacy 'count'");if(r.alpha!==void 0&&(ce(r.alpha,"alpha"),r.alpha<0||r.alpha>1))throw new Error("Input Error: alpha must be between 0 and 1");r.x!==void 0&&ce(r.x,"x"),r.y!==void 0&&ce(r.y,"y"),r.seed!==void 0&&ce(r.seed,"seed")}function CD(r){if(!TD.has(r.mode))throw new Error("Input Error: modules.emission.mode must be 'continuous' or 'burst'");if(r.mode==="continuous"){if(ce(r.rate,"modules.emission.rate"),r.rate<=0)throw new Error("Input Error: modules.emission.rate must be positive")}else if(cI(r.burstCount,"modules.emission.burstCount"),r.burstCount<=0)throw new Error("Input Error: modules.emission.burstCount must be positive");if(r.maxActive!==void 0&&(cI(r.maxActive,"modules.emission.maxActive"),r.maxActive<=0))throw new Error("Input Error: modules.emission.maxActive must be positive");if(r.duration!==void 0&&r.duration!=="infinite"&&(ce(r.duration,"modules.emission.duration"),r.duration<0))throw new Error("Input Error: modules.emission.duration must be non-negative");if(ss(r.particleLifetime,"modules.emission.particleLifetime",{allowNegative:!1}),!r.source||typeof r.source!="object"||Array.isArray(r.source))throw new Error("Input Error: modules.emission.source must be an object");if(!SD.has(r.source.kind))throw new Error("Input Error: modules.emission.source.kind must be one of point, rect, circle, line");if(!r.source.data||typeof r.source.data!="object"||Array.isArray(r.source.data))throw new Error("Input Error: modules.emission.source.data must be an object");MD(r.source.kind,r.source.data)}function MD(r,e){if(r==="point"){ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y");return}if(r==="rect"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(e.width,"modules.emission.source.data.width"),ce(e.height,"modules.emission.source.data.height"),e.width<=0||e.height<=0)throw new Error("Input Error: modules.emission.source.data.width and height must be positive");return}if(r==="circle"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(e.radius,"modules.emission.source.data.radius"),e.radius<=0)throw new Error("Input Error: modules.emission.source.data.radius must be positive");if(e.innerRadius!==void 0&&(ce(e.innerRadius,"modules.emission.source.data.innerRadius"),e.innerRadius<0||e.innerRadius>e.radius))throw new Error("Input Error: modules.emission.source.data.innerRadius must be between 0 and radius");if(e.affectRotation!==void 0&&typeof e.affectRotation!="boolean")throw new Error("Input Error: modules.emission.source.data.affectRotation must be a boolean");return}ce(e.x1,"modules.emission.source.data.x1"),ce(e.y1,"modules.emission.source.data.y1"),ce(e.x2,"modules.emission.source.data.x2"),ce(e.y2,"modules.emission.source.data.y2")}function RD(r,e){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.movement must be an object");if(r.velocity!==void 0){if(!r.velocity||typeof r.velocity!="object"||Array.isArray(r.velocity))throw new Error("Input Error: modules.movement.velocity must be an object");let{velocity:t}=r;if(t.kind!=="directional"&&t.kind!=="radial")throw new Error("Input Error: modules.movement.velocity.kind must be 'directional' or 'radial'");ss(t.speed,"modules.movement.velocity.speed",{allowNegative:!1}),t.kind==="directional"?ss(t.direction,"modules.movement.velocity.direction",{allowNegative:!0}):t.angle!==void 0&&ss(t.angle,"modules.movement.velocity.angle",{allowNegative:!0})}if(r.acceleration!==void 0){if(!r.acceleration||typeof r.acceleration!="object"||Array.isArray(r.acceleration))throw new Error("Input Error: modules.movement.acceleration must be an object");ce(r.acceleration.x,"modules.movement.acceleration.x"),ce(r.acceleration.y,"modules.movement.acceleration.y")}if(r.maxSpeed!==void 0&&(ce(r.maxSpeed,"modules.movement.maxSpeed"),r.maxSpeed<0))throw new Error("Input Error: modules.movement.maxSpeed must be non-negative");if(r.faceVelocity!==void 0&&typeof r.faceVelocity!="boolean")throw new Error("Input Error: modules.movement.faceVelocity must be a boolean");if(!r.velocity&&!r.acceleration)throw new Error("Input Error: modules.movement must define velocity, acceleration, or both");if(r.faceVelocity&&e?.rotation&&e.rotation.mode!=="none")throw new Error("Input Error: modules.appearance.rotation cannot be combined with modules.movement.faceVelocity")}}function ID(r){BD(r.texture),r.scale!==void 0&&aI(r.scale,"modules.appearance.scale",{allowNegative:!1,modes:["single","range","curve"]}),r.alpha!==void 0&&aI(r.alpha,"modules.appearance.alpha",{min:0,max:1,modes:["single","curve"]}),r.color!==void 0&&FD(r.color,"modules.appearance.color"),r.rotation!==void 0&&OD(r.rotation)}function BD(r){if(r===void 0)throw new Error("Input Error: modules.appearance.texture is required");if(typeof r!="string"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.texture must be a string or object");if(r.shape){hI(r,"modules.appearance.texture");return}if(!wD.has(r.mode))throw new Error("Input Error: modules.appearance.texture.mode must be 'single', 'random', or 'cycle'");if(r.pick!==void 0&&!ED.has(r.pick))throw new Error("Input Error: modules.appearance.texture.pick must be 'perParticle' or 'perWave'");if(!Array.isArray(r.items)||r.items.length===0)throw new Error("Input Error: modules.appearance.texture.items must be a non-empty array");if(r.mode==="single"&&r.items.length!==1)throw new Error("Input Error: modules.appearance.texture.mode 'single' requires exactly one item");for(let e=0;e1)throw new Error(`Input Error: ${e}.keys[${s}].time must be between 0 and 1`);if(o.time1)throw new Error(`Input Error: ${e}.keys[${i}].time must be between 0 and 1`);if(s.time(r.max??r.min))throw new Error(`Input Error: ${e}.min cannot be greater than max`);r.distribution!==void 0&&LD(r.distribution,`${e}.distribution`)}function Sc(r,e,t={}){if(ce(r,e),!t.allowNegative&&r<0)throw new Error(`Input Error: ${e} must be non-negative`);if(t.min!==void 0&&rt.max)throw new Error(`Input Error: ${e} must be at most ${t.max}`)}function LD(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!oI.has(r.kind))throw new Error(`Input Error: ${e}.kind must be one of ${[...oI].join(", ")}`);if(r.kind==="bias"){if(!nI.has(r.toward??"min"))throw new Error(`Input Error: ${e}.toward must be one of ${[...nI].join(", ")}`);r.strength!==void 0&&ce(r.strength,`${e}.strength`)}r.kind==="normal"&&(r.mean!==void 0&&ce(r.mean,`${e}.mean`),r.deviation!==void 0&&ce(r.deviation,`${e}.deviation`))}function ce(r,e){if(typeof r!="number"||Number.isNaN(r))throw new Error(`Input Error: ${e} must be a number`)}function cI(r,e){if(ce(r,e),!Number.isInteger(r))throw new Error(`Input Error: ${e} must be an integer`)}function dI(r){let e=DD(r),t=[];t.push(ND(r.modules.emission.source));let i=VD(r.modules.movement);i&&t.push(i),t.push(...WD(r.modules.appearance));let s=KD(r.modules.bounds,r.width,r.height);s&&(e.spawnBounds=s.spawnBounds,e.recycleOnBounds=!0);let o=zD(r.modules.appearance.texture),n=e.maxParticles;return{id:r.id,type:r.type,count:n,texture:o,behaviors:t,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}}function DD(r){let{emission:e}=r.modules,t={lifetime:os(e.particleLifetime),maxParticles:e.mode==="burst"?Math.max(e.maxActive??e.burstCount,e.burstCount):e.maxActive??100,emitterLifetime:e.duration===void 0||e.duration==="infinite"?-1:e.duration,seed:r.seed};return e.mode==="continuous"?(t.frequency=1/e.rate,t.particlesPerWave=1):(t.frequency=0,t.particlesPerWave=e.burstCount),t}function ND(r){return{type:"spawnShape",config:{type:r.kind,data:HD(r.kind,r.data)}}}function HD(r,e){return r==="rect"?{x:e.x,y:e.y,w:e.width,h:e.height}:{...e}}function VD(r){if(!r)return null;let e={maxSpeed:r.maxSpeed??0,faceVelocity:r.faceVelocity??!1};return r.velocity&&(e.velocity={kind:r.velocity.kind,speed:os(r.velocity.speed)},r.velocity.kind==="directional"?e.velocity.direction=os(r.velocity.direction):e.velocity.angle=os(r.velocity.angle??{min:0,max:360})),r.acceleration&&(e.acceleration={x:r.acceleration.x,y:r.acceleration.y}),{type:"movement",config:e}}function WD(r){let e=[];if(r.scale&&e.push(XD(r.scale)),r.alpha&&e.push(jD(r.alpha)),r.color&&e.push(YD(r.color)),r.rotation){let t=qD(r.rotation);t&&e.push(t)}return e}function zD(r){if(typeof r=="string")return r;if(r.shape)return{...r};let e={mode:r.mode,pick:r.pick??"perParticle",items:r.items.map($D)};if(e.mode==="single"&&e.items.length===1){let[t]=e.items;return t.src??fI(t)}return e}function $D(r){if(r.src)return r.weight===void 0?{src:r.src}:{src:r.src,weight:r.weight};let e=fI(r);return r.weight!==void 0&&(e.weight=r.weight),e}function fI(r){return{shape:r.shape,...r.radius!==void 0?{radius:r.radius}:{},...r.width!==void 0?{width:r.width}:{},...r.height!==void 0?{height:r.height}:{},...r.color!==void 0?{color:r.color}:{}}}function XD(r){return r.mode==="curve"?{type:"scale",config:{list:n_(r.keys)}}:{type:"scaleStatic",config:r.mode==="single"?{min:r.value,max:r.value}:os(r)}}function jD(r){return r.mode==="curve"?{type:"alpha",config:{list:n_(r.keys)}}:{type:"alphaStatic",config:{alpha:r.value}}}function YD(r){return r.mode==="gradient"?{type:"color",config:{list:n_(r.keys)}}:{type:"colorStatic",config:{color:r.value}}}function qD(r){if(r.mode==="none")return null;if(r.mode==="fixed")return{type:"noRotation",config:{rotation:r.value}};if(r.mode==="random"){let i=os(r);return{type:"rotationStatic",config:{min:i.min,max:i.max,distribution:i.distribution}}}let e=os(r.start),t=os(r.speed);return{type:"rotation",config:{minStart:e.min,maxStart:e.max,startDistribution:e.distribution,minSpeed:t.min,maxSpeed:t.max,speedDistribution:t.distribution,accel:r.accel??0}}}function KD(r,e,t){if(!r||r.mode==="none")return null;if(r.source==="custom")return{spawnBounds:{...r.custom}};let i=ZD(r.padding??0);return{spawnBounds:{x:-i.left,y:-i.top,width:e+i.left+i.right,height:t+i.top+i.bottom}}}function ZD(r){return typeof r=="number"?{top:r,right:r,bottom:r,left:r}:{top:r.top,right:r.right,bottom:r.bottom,left:r.left}}function n_(r){return r.map(e=>({time:e.time,value:e.value}))}function os(r){return typeof r=="number"?{min:r,max:r}:{min:r.min,max:r.max??r.min,...r.distribution!==void 0?{distribution:{...r.distribution}}:{}}}var pI=({state:r})=>{if(r.modules)return o_(r),uI(r),dI(r);o_(r),eI(r),tI(r),rI(r),iI(r),sI(r);let e=r.emitter?.maxParticles??r.count??100,t=r.emitter;return t&&t.maxParticles===void 0&&r.count!==void 0&&(t={...t,maxParticles:e}),{id:r.id,type:r.type,count:e,texture:r.texture,behaviors:r.behaviors,emitter:t,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var QD=et({type:"particles",add:Tc,update:JR,delete:Gf,parse:pI});var mI=(r=[],e=[])=>{let t=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)t.add(l.id),i.set(l.id,l);for(let l of e)t.add(l.id),s.set(l.id,l);for(let l of t){let c=i.get(l),u=s.get(l);!c&&u?o.push(u):c&&!u?n.push(c):(c.src!==u.src||c.volume!==u.volume||c.loop!==u.loop||c.delay!==u.delay)&&a.push({prev:c,next:u})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var a_=({app:r,prevAudioTree:e,nextAudioTree:t,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=mI(e,t);for(let a of o){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);c.update({app:r,prevElement:a,nextElement:l})}};var sr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(sr||{}),l_=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(l_||{}),Lf=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Lf||{}),re=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(re||{}),Bn=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Bn||{}),H=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(H||{}),wi=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(wi||{}),ae=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(ae||{}),z=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(z||{}),vr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(vr||{}),wc=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(wc||{}),Fr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Fr||{}),or=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(or||{}),ns=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(ns||{}),Df=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Df||{}),Wt=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Wt||{}),at=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(at||{});var Pe=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pe||{}),Qt=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Qt||{});var c_={createCanvas:(r,e)=>{let t=document.createElement("canvas");return t.width=r,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,e)=>fetch(r,e),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var K={ADAPTER:c_,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};gm();var JD=Gi.default??Gi,Or=JD(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Zs=fs(xI(),1),zH=fs(mh(),1);var W_=fs(kk(),1);var Fk={};function fe(r,e,t=3){if(Fk[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} Deprecated since v${r}`):(i=i.split(` -`).splice(e).join(` -`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} -Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} -Deprecated since v${r}`),console.warn(i))),HM[t]=!0}var iy;function sy(){return typeof iy>"u"&&(iy=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!K.ADAPTER.getWebGLRenderingContext())return!1;let t=K.ADAPTER.createCanvas(),e=t.getContext("webgl",r)||t.getContext("experimental-webgl",r),i=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,i}catch{return!1}}()),iy}wf();Ef();kh([Gh]);var on=class Gd{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof Gd)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){let i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,o)=>s===e[o]);if(t!==null&&e!==null){let s=Object.keys(t),o=Object.keys(e);return s.length!==o.length?!1:s.every(n=>t[n]===e[n])}return t===e}toRgba(){let[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){let[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){let[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){let[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,i,s,o]=Gd.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,i,s,o]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=o,t}normalize(t){let e,i,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,o=255]=t,e/=255,i/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Gd.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=je(t);n.isValid()&&({r:e,g:i,b:s,a:o}=n.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);let[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),i)}),t)}};on.shared=new on,on.temp=new on,on.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Pr=on;function sL(){let r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[rt.NORMAL_NPM]=rt.NORMAL,r[rt.ADD_NPM]=rt.ADD,r[rt.SCREEN_NPM]=rt.SCREEN,t[rt.NORMAL]=rt.NORMAL_NPM,t[rt.ADD]=rt.ADD_NPM,t[rt.SCREEN]=rt.SCREEN_NPM;let e=[];return e.push(t),e.push(r),e}var oy=sL();function nn(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function As(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Ud(r){return!(r&r-1)&&!!r}function Od(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function ny(r,t,e){let i=r.length,s;if(t>=i||e===0)return;e=t+e>i?i-t:e;let o=i-e;for(s=t;s(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(X||{}),ly=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},zM=(r,t)=>ly(r).priority??t,Z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(ly).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(ly).forEach(t=>{t.type.forEach(e=>{let i=this._addHandlers,s=this._queue;i[e]?i[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(r,t,e){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>t(n)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,o)=>zM(o,e)-zM(s,e)))},i=>{let s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};var ql=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};var cL=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` -`);function uL(r){let t="";for(let e=0;e0&&(t+=` -else `),e=0;--i){let s=Kl[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var te=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:h,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(te.prototype,{dispatch:{value:te.prototype.emit},run:{value:te.prototype.emit}});var tr=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new te("setRealSize"),this.onUpdate=new te("update"),this.onError=new te("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var Cs=class extends tr{constructor(t,e){let{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Qe.UNPACK);let o=e.realWidth,n=e.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(e.target,0,i.internalFormat,o,n,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var dL={scaleMode:dr.NEAREST,alphaMode:Qe.NPM},my=class ln extends Ps.default{constructor(t=null,e=null){super(),e=Object.assign({},ln.defaultOptions,e);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:h,format:c,type:u,target:d,resolution:f,resourceOptions:m}=e;t&&!(t instanceof tr)&&(t=an(t,m),t.internal=!0),this.resolution=f||K.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=h,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=pi(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Ud(this.realWidth)&&Ud(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete jr[this.cacheId],delete Je[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),ln.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=K.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${pi()}`}o=t._pixiId}let n=jr[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new ln(t,e),n.cacheId=o,ln.addToCache(n,o)),n}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);let o=new Cs(t,{width:e,height:i,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=D.RGBA,a=lt.FLOAT):t instanceof Int32Array?(n=D.RGBA_INTEGER,a=lt.INT):t instanceof Uint32Array?(n=D.RGBA_INTEGER,a=lt.UNSIGNED_INT):t instanceof Int16Array?(n=D.RGBA_INTEGER,a=lt.SHORT):t instanceof Uint16Array?(n=D.RGBA_INTEGER,a=lt.UNSIGNED_SHORT):t instanceof Int8Array?(n=D.RGBA,a=lt.BYTE):(n=D.RGBA,a=lt.UNSIGNED_BYTE),o.internal=!0,new ln(o,Object.assign({},dL,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),jr[e]&&jr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),jr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=jr[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete jr[t],e}}else if(t?.textureCacheIds){for(let e=0;e1){for(let u=0;u(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(pr||{});var oe=class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};oe.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var Hd=[new oe,new oe,new oe,new oe],bt=class r{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=pr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&et.right?t.right:this.right)<=C)return!1;let A=this.yt.bottom?t.bottom:this.bottom)>A}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Hd[0].set(t.left,t.top),l=Hd[1].set(t.left,t.bottom),h=Hd[2].set(t.right,t.top),c=Hd[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=o||Math.min(a.y,l.y,h.y,c.y)>=n))return!1;let d=u*(l.y-a.y),f=u*(a.x-l.x),m=d*i+f*o,g=d*s+f*o,p=d*i+f*n,b=d*s+f*n;if(Math.max(m,g,p,b)<=d*a.x+f*a.y||Math.min(m,g,p,b)>=d*c.x+f*c.y)return!1;let y=u*(a.y-h.y),_=u*(h.x-a.x),S=y*i+_*o,E=y*s+_*o,w=y*i+_*n,T=y*s+_*n;return!(Math.max(S,E,w,T)<=y*a.x+_*a.y||Math.min(S,E,w,T)>=y*c.x+_*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=o-s,this}};bt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Vd=class r{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=pr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=i}getBounds(){return new bt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Vd.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Wd=class r{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=pr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new bt(this.x-this.width,this.y-this.height,this.width,this.height)}};Wd.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var zd=class r{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let i=[];for(let s=0,o=e.length;se!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}};zd.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};var $d=class r{constructor(t=0,e=0,i=0,s=0,o=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=o,this.type=pr.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),o=e-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=t-(this.x+this.width-i),s*s+o*o<=n)||(o=e-(this.y+this.height-i),s*s+o*o<=n)||(s=t-(this.x+i),s*s+o*o<=n))return!0}return!1}};$d.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Gt=class r{constructor(t=1,e=0,i=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,o,n){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new oe;let i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new oe;let i=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),i=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=o*e-this.d*i,this.d=o*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){let e=this.a,i=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*o+this.ty,this}setTransform(t,e,i,s,o,n,a,l,h){return this.a=Math.cos(a+h)*o,this.b=Math.sin(a+h)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,i=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(gy-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*i+n.y*o),t}invert(){let t=this.a,e=this.b,i=this.c,s=this.d,o=this.tx,n=t*s-e*i;return this.a=s/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new r}static get TEMP_MATRIX(){return new r}};Gt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var Rs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ms=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Is=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Bs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],xy=[],jM=[],Xd=Math.sign;function _L(){for(let r=0;r<16;r++){let t=[];xy.push(t);for(let e=0;e<16;e++){let i=Xd(Rs[r]*Rs[e]+Is[r]*Ms[e]),s=Xd(Ms[r]*Rs[e]+Bs[r]*Ms[e]),o=Xd(Rs[r]*Is[e]+Is[r]*Bs[e]),n=Xd(Ms[r]*Is[e]+Bs[r]*Bs[e]);for(let a=0;a<16;a++)if(Rs[a]===i&&Ms[a]===s&&Is[a]===o&&Bs[a]===n){t.push(a);break}}}for(let r=0;r<16;r++){let t=new Gt;t.set(Rs[r],Ms[r],Is[r],Bs[r],0,0),jM.push(t)}}_L();var Lt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Rs[r],uY:r=>Ms[r],vX:r=>Is[r],vY:r=>Bs[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>xy[r][t],sub:(r,t)=>xy[r][Lt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Lt.S:Lt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Lt.E:Lt.W:t>0?r>0?Lt.SE:Lt.SW:r>0?Lt.NE:Lt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{let s=jM[Lt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};var gi=class r{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new r(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};gi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var yy=class{constructor(){this.worldTransform=new Gt,this.localTransform=new Gt,this.position=new gi(this.onChange,this,0,0),this.scale=new gi(this.onChange,this,1,1),this.pivot=new gi(this.onChange,this,0,0),this.skew=new gi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){let e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};yy.IDENTITY=new yy;var jd=yy;jd.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var YM=`varying vec2 vTextureCoord; +`).splice(t).join(` +`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e} +Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e} +Deprecated since v${r}`),console.warn(i))),Fk[e]=!0}var z_;function $_(){return typeof z_>"u"&&(z_=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!K.ADAPTER.getWebGLRenderingContext())return!1;let e=K.ADAPTER.createCanvas(),t=e.getContext("webgl",r)||e.getContext("experimental-webgl",r),i=!!t?.getContextAttributes()?.stencil;if(t){let s=t.getExtension("WEBGL_lose_context");s&&s.loseContext()}return t=null,i}catch{return!1}}()),z_}Vp();Wp();Au([Pu]);var Wn=class tp{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof tp)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}isSourceEqual(e,t){let i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((s,o)=>s===t[o]);if(e!==null&&t!==null){let s=Object.keys(e),o=Object.keys(t);return s.length!==o.length?!1:s.every(n=>e[n]===t[n])}return e===t}toRgba(){let[e,t,i,s]=this._components;return{r:e,g:t,b:i,a:s}}toRgb(){let[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){let[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){let[t,i,s]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toRgbArray(e){e=e??[];let[t,i,s]=this._components;return e[0]=t,e[1]=i,e[2]=s,e}toNumber(){return this._int}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[t,i,s,o]=tp.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return t&&(i=i*e+.5|0,s=s*e+.5|0,o=o*e+.5|0),(e*255<<24)+(i<<16)+(s<<8)+o}toHex(){let e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}round(e){let[t,i,s]=this._components;return this._components[0]=Math.round(t*e)/e,this._components[1]=Math.round(i*e)/e,this._components[2]=Math.round(s*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];let[t,i,s,o]=this._components;return e[0]=t,e[1]=i,e[2]=s,e[3]=o,e}normalize(e){let t,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;t=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,i,s,o=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[t,i,s,o=255]=e,t/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=tp.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=Jt(e);n.isValid()&&({r:t,g:i,b:s,a:o}=n.rgba,t/=255,i/=255,s/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=i,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);let[e,t,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,t),i)}),e)}};Wn.shared=new Wn,Wn.temp=new Wn,Wn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Ur=Wn;function DH(){let r=[],e=[];for(let i=0;i<32;i++)r[i]=i,e[i]=i;r[re.NORMAL_NPM]=re.NORMAL,r[re.ADD_NPM]=re.ADD,r[re.SCREEN_NPM]=re.SCREEN,e[re.NORMAL]=re.NORMAL_NPM,e[re.ADD]=re.ADD_NPM,e[re.SCREEN]=re.SCREEN_NPM;let t=[];return t.push(e),t.push(r),t}var X_=DH();function zn(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function Ks(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function rp(r){return!(r&r-1)&&!!r}function ip(r){let e=(r>65535?1:0)<<4;r>>>=e;let t=(r>255?1:0)<<3;return r>>>=t,e|=t,t=(r>15?1:0)<<2,r>>>=t,e|=t,t=(r>3?1:0)<<1,r>>>=t,e|=t,e|r>>1}function j_(r,e,t){let i=r.length,s;if(e>=i||t===0)return;t=e+t>i?i-e:t;let o=i-t;for(s=e;s(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))($||{}),q_=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Gk=(r,e)=>q_(r).priority??e,Z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(q_).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...r){return r.map(q_).forEach(e=>{e.type.forEach(t=>{let i=this._addHandlers,s=this._queue;i[t]?i[t]?.(e):(s[t]=s[t]||[],s[t]?.push(e))})}),this},handle(r,e,t){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=e,s[r]=t;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>e(n)),delete o[r]),this},handleByMap(r,e){return this.handle(r,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(r,e,t=-1){return this.handle(r,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,o)=>Gk(o,t)-Gk(s,t)))},i=>{let s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})}};var Lc=class{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}};var $H=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +`);function XH(r){let e="";for(let t=0;t0&&(e+=` +else `),t=0;--i){let s=Dc[i];if(s.test&&s.test(r,t))return new s(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var rt=class{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:c,items:u}=this;this._aliasCount++;for(let h=0,d=u.length;h0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){let t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this}contains(e){return this.items.includes(e)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(rt.prototype,{dispatch:{value:rt.prototype.emit},run:{value:rt.prototype.emit}});var ar=class{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new rt("setRealSize"),this.onUpdate=new rt("update"),this.onError=new rt("onError")}bind(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)}resize(e,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(e,t,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(e,t){return!1}};var Qs=class extends ar{constructor(e,t){let{width:i,height:s}=t||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,i){let s=e.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===or.UNPACK);let o=t.realWidth,n=t.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(t.target,0,0,0,o,n,t.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(t.target,0,i.internalFormat,o,n,0,t.format,i.type,this.data)),!0}dispose(){this.data=null}static test(e){return e===null||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}};var jH={scaleMode:vr.NEAREST,alphaMode:or.NPM},rb=class Xn extends Zs.default{constructor(e=null,t=null){super(),t=Object.assign({},Xn.defaultOptions,t);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:c,format:u,type:h,target:d,resolution:f,resourceOptions:p}=t;e&&!(e instanceof ar)&&(e=$n(e,p),e.internal=!0),this.resolution=f||K.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=c,this._scaleMode=n,this.format=u,this.type=h,this.target=d,this.alphaMode=i,this.uid=Ai(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(e)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)}setStyle(e,t){let i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,i=!0),i&&this.dirtyStyleId++,this}setSize(e,t,i){return i=i||this.resolution,this.setRealSize(e*i,t*i,i)}setRealSize(e,t,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=rp(this.realWidth)&&rp(this.realHeight)}setResolution(e){let t=this.resolution;return t===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit("update",this)),this._refreshPOT(),this)}setResource(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(e){this.emit("error",this,e)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete si[this.cacheId],delete nr[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Xn.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,t,i=K.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else{if(!e._pixiId){let a=t?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Ai()}`}o=e._pixiId}let n=si[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Xn(e,t),n.cacheId=o,Xn.addToCache(n,o)),n}static fromBuffer(e,t,i,s){e=e||new Float32Array(t*i*4);let o=new Qs(e,{width:t,height:i,...s?.resourceOptions}),n,a;return e instanceof Float32Array?(n=H.RGBA,a=ae.FLOAT):e instanceof Int32Array?(n=H.RGBA_INTEGER,a=ae.INT):e instanceof Uint32Array?(n=H.RGBA_INTEGER,a=ae.UNSIGNED_INT):e instanceof Int16Array?(n=H.RGBA_INTEGER,a=ae.SHORT):e instanceof Uint16Array?(n=H.RGBA_INTEGER,a=ae.UNSIGNED_SHORT):e instanceof Int8Array?(n=H.RGBA,a=ae.BYTE):(n=H.RGBA,a=ae.UNSIGNED_BYTE),o.internal=!0,new Xn(o,Object.assign({},jH,{type:a,format:n},s))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),si[t]&&si[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),si[t]=e)}static removeFromCache(e){if(typeof e=="string"){let t=si[e];if(t){let i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete si[e],t}}else if(e?.textureCacheIds){for(let t=0;t1){for(let h=0;h(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(Sr||{});var ct=class r{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new r(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}};ct.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var ap=[new ct,new ct,new ct,new ct],_e=class r{constructor(e=0,t=0,i=0,s=0){this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s),this.type=Sr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e=this.y&&te.right?e.right:this.right)<=I)return!1;let B=this.ye.bottom?e.bottom:this.bottom)>B}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=ap[0].set(e.left,e.top),l=ap[1].set(e.left,e.bottom),c=ap[2].set(e.right,e.top),u=ap[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=i||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;let v=h*(a.y-c.y),x=h*(c.x-a.x),T=v*i+x*o,b=v*s+x*o,w=v*i+x*n,E=v*s+x*n;return!(Math.max(T,b,w,E)<=v*a.x+x*a.y||Math.min(T,b,w,E)>=v*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,t=.001){let i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=s,this.height=o-s,this}};_e.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var lp=class r{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=Sr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-t;return s*=s,o*=o,s+o<=i}getBounds(){return new _e(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};lp.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var cp=class r{constructor(e=0,t=0,i=0,s=0){this.x=e,this.y=t,this.width=i,this.height=s,this.type=Sr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,s=(t-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new _e(this.x-this.width,this.y-this.height,this.width,this.height)}};cp.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var up=class r{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){let i=[];for(let s=0,o=t.length;st!=u>t&&e<(c-a)*((t-l)/(u-l))+a&&(i=!i)}return i}};up.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,e)=>`${r}, ${e}`,"")}]`};var hp=class r{constructor(e=0,t=0,i=0,s=0,o=20){this.x=e,this.y=t,this.width=i,this.height=s,this.radius=o,this.type=Sr.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=t-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=e-(this.x+this.width-i),s*s+o*o<=n)||(o=t-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}};hp.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Ie=class r{constructor(e=1,t=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,i,s,o,n){return this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,t){this.array||(this.array=new Float32Array(9));let i=t||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(e,t){t=t||new ct;let i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new ct;let i=1/(this.a*this.d+this.c*-this.b),s=e.x,o=e.y;return t.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*t-this.b*i,this.b=s*i+this.b*t,this.c=o*t-this.d*i,this.d=o*i+this.d*t,this.tx=n*t-this.ty*i,this.ty=n*i+this.ty*t,this}append(e){let t=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}setTransform(e,t,i,s,o,n,a,l,c){return this.a=Math.cos(a+c)*o,this.b=Math.sin(a+c)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=e-(i*this.a+s*this.c),this.ty=t-(i*this.b+s*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,t),c=Math.abs(a+l);return c<1e-5||Math.abs(ib-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*t+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,t=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-t*i;return this.a=s/n,this.b=-t/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-t*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}static get IDENTITY(){return new r}static get TEMP_MATRIX(){return new r}};Ie.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var Js=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],eo=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],to=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ro=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],sb=[],Nk=[],dp=Math.sign;function eV(){for(let r=0;r<16;r++){let e=[];sb.push(e);for(let t=0;t<16;t++){let i=dp(Js[r]*Js[t]+to[r]*eo[t]),s=dp(eo[r]*Js[t]+ro[r]*eo[t]),o=dp(Js[r]*to[t]+to[r]*ro[t]),n=dp(eo[r]*to[t]+ro[r]*ro[t]);for(let a=0;a<16;a++)if(Js[a]===i&&eo[a]===s&&to[a]===o&&ro[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new Ie;e.set(Js[r],eo[r],to[r],ro[r],0,0),Nk.push(e)}}eV();var Ne={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Js[r],uY:r=>eo[r],vX:r=>to[r],vY:r=>ro[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>sb[r][e],sub:(r,e)=>sb[r][Ne.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?Ne.S:Ne.N:Math.abs(e)*2<=Math.abs(r)?r>0?Ne.E:Ne.W:e>0?r>0?Ne.SE:Ne.SW:r>0?Ne.NE:Ne.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=Nk[Ne.inv(e)];s.tx=t,s.ty=i,r.append(s)}};var Ci=class r{constructor(e,t,i=0,s=0){this._x=i,this._y=s,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new r(e,t,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}};Ci.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var ob=class{constructor(){this.worldTransform=new Ie,this.localTransform=new Ie,this.position=new Ci(this.onChange,this,0,0),this.scale=new Ci(this.onChange,this,1,1),this.pivot=new Ci(this.onChange,this,0,0),this.skew=new Ci(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){let e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){let t=r.worldTransform,i=this.worldTransform;i.a=e.a*t.a+e.b*t.c,i.b=e.a*t.b+e.b*t.d,i.c=e.c*t.a+e.d*t.c,i.d=e.c*t.b+e.d*t.d,i.tx=e.tx*t.a+e.ty*t.c+t.tx,i.ty=e.tx*t.b+e.ty*t.d+t.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};ob.IDENTITY=new ob;var fp=ob;fp.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var Hk=`varying vec2 vTextureCoord; uniform sampler2D uSampler; void main(void){ gl_FragColor *= texture2D(uSampler, vTextureCoord); -}`;var qM=`attribute vec2 aVertexPosition; +}`;var Vk=`attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; uniform mat3 projectionMatrix; @@ -1165,13 +1438,13 @@ void main(void){ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; } -`;function Yd(r,t,e){let i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function _y(r){let t=new Array(r);for(let e=0;er.type==="float"&&r.size===1&&!r.isArray,code:r=>` +`;function pp(r,e,t){let i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}function nb(r){let e=new Array(r);for(let t=0;tr.type==="float"&&r.size===1&&!r.isArray,code:r=>` if(uv["${r}"] !== ud["${r}"].value) { ud["${r}"].value = uv["${r}"] gl.uniform1f(ud["${r}"].location, uv["${r}"]) } - `},{test:(r,t)=>(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray&&(t==null||t.castToBaseTexture!==void 0),code:r=>`t = syncData.textureCount++; + `},{test:(r,e)=>(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray&&(e==null||e.castToBaseTexture!==void 0),code:r=>`t = syncData.textureCount++; renderer.texture.bind(uv["${r}"], t); @@ -1180,7 +1453,7 @@ void main(void){ ud["${r}"].value = t; gl.uniform1i(ud["${r}"].location, t); ; // eslint-disable-line max-len - }`},{test:(r,t)=>r.type==="mat3"&&r.size===1&&!r.isArray&&t.a!==void 0,code:r=>` + }`},{test:(r,e)=>r.type==="mat3"&&r.size===1&&!r.isArray&&e.a!==void 0,code:r=>` gl.uniformMatrix3fv(ud["${r}"].location, false, uv["${r}"].toArray(true)); `,codeUbo:r=>` var ${r}_matrix = uv.${r}.toArray(true); @@ -1196,7 +1469,7 @@ void main(void){ data[offset + 8] = ${r}_matrix[6]; data[offset + 9] = ${r}_matrix[7]; data[offset + 10] = ${r}_matrix[8]; - `},{test:(r,t)=>r.type==="vec2"&&r.size===1&&!r.isArray&&t.x!==void 0,code:r=>` + `},{test:(r,e)=>r.type==="vec2"&&r.size===1&&!r.isArray&&e.x!==void 0,code:r=>` cv = ud["${r}"].value; v = uv["${r}"]; @@ -1220,7 +1493,7 @@ void main(void){ cv[1] = v[1]; gl.uniform2f(ud["${r}"].location, v[0], v[1]); } - `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.width!==void 0,code:r=>` + `},{test:(r,e)=>r.type==="vec4"&&r.size===1&&!r.isArray&&e.width!==void 0,code:r=>` cv = ud["${r}"].value; v = uv["${r}"]; @@ -1238,7 +1511,7 @@ void main(void){ data[offset+1] = v.y; data[offset+2] = v.width; data[offset+3] = v.height; - `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>` + `},{test:(r,e)=>r.type==="vec4"&&r.size===1&&!r.isArray&&e.red!==void 0,code:r=>` cv = ud["${r}"].value; v = uv["${r}"]; @@ -1256,7 +1529,7 @@ void main(void){ data[offset+1] = v.green; data[offset+2] = v.blue; data[offset+3] = v.alpha; - `},{test:(r,t)=>r.type==="vec3"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>` + `},{test:(r,e)=>r.type==="vec3"&&r.size===1&&!r.isArray&&e.red!==void 0,code:r=>` cv = ud["${r}"].value; v = uv["${r}"]; @@ -1285,7 +1558,7 @@ void main(void){ cv[3] = v[3]; gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3]) - }`}];var bL={float:` + }`}];var tV={float:` if (cv !== v) { cu.value = v; @@ -1421,36 +1694,36 @@ void main(void){ cu.value = v; gl.uniform1i(location, v); - }`},vL={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function by(r,t){let e=[` + }`},rV={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function ab(r,e){let t=[` var v = null; var cv = null; var cu = null; var t = 0; var gl = renderer.gl; - `];for(let i in r.uniforms){let s=t[i];if(!s){r.uniforms[i]?.group===!0&&(r.uniforms[i].ubo?e.push(` + `];for(let i in r.uniforms){let s=e[i];if(!s){r.uniforms[i]?.group===!0&&(r.uniforms[i].ubo?t.push(` renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}'); - `):e.push(` + `):t.push(` renderer.shader.syncUniformGroup(uv.${i}, syncData); - `));continue}let o=r.uniforms[i],n=!1;for(let a=0;a=Ze.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),qd=t}return qd}var Zd;function vy(){if(!Zd){Zd=Le.MEDIUM;let r=Kd();if(r&&r.getShaderPrecisionFormat){let t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(Zd=t.precision?Le.HIGH:Le.MEDIUM)}}return Zd}function ZM(r,t){let e=r.getShaderSource(t).split(` -`).map((h,c)=>`${c}: ${h}`),i=r.getShaderInfoLog(t),s=i.split(` -`),o={},n=s.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!o[h]?(o[h]=!0,!0):!1),a=[""];n.forEach(h=>{e[h-1]=`%c${e[h-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=e.join(` -`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Ty(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||ZM(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||ZM(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}var TL={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function th(r){return TL[r]}var Qd=null,QM={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function eh(r,t){if(!Qd){let e=Object.keys(QM);Qd={};for(let i=0;i=sr.WEBGL2&&(e=r.getContext("webgl2",{})),e||(e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),mp=e}return mp}var xp;function lb(){if(!xp){xp=Wt.MEDIUM;let r=gp();if(r&&r.getShaderPrecisionFormat){let e=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);e&&(xp=e.precision?Wt.HIGH:Wt.MEDIUM)}}return xp}function zk(r,e){let t=r.getShaderSource(e).split(` +`).map((c,u)=>`${u}: ${c}`),i=r.getShaderInfoLog(e),s=i.split(` +`),o={},n=s.map(c=>parseFloat(c.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(c=>c&&!o[c]?(o[c]=!0,!0):!1),a=[""];n.forEach(c=>{t[c-1]=`%c${t[c-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=t.join(` +`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function cb(r,e,t,i){r.getProgramParameter(e,r.LINK_STATUS)||(r.getShaderParameter(t,r.COMPILE_STATUS)||zk(r,t),r.getShaderParameter(i,r.COMPILE_STATUS)||zk(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(e)))}var iV={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Wc(r){return iV[r]}var yp=null,$k={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function zc(r,e){if(!yp){let t=Object.keys($k);yp={};for(let i=0;i0&&(e+=` -else `),i0&&(t+=` +else `),ithis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){let{_bufferedTextures:t,maxTextures:e}=this,i=Cr._textureArrayPool,s=this.renderer.batch,o=this._tempBoundTextures,n=this.renderer.textureGC.count,a=++xt._globalBatch,l=0,h=i[0],c=0;s.copyBoundTextures(o,e);for(let u=0;u=e&&(s.boundArray(h,o,a,e),this.buildDrawCalls(h,c,u),c=u,h=i[++l],++a),d._batchEnabled=a,d.touched=n,h.elements[h.count++]=d)}h.count>0&&(s.boundArray(h,o,a,e),this.buildDrawCalls(h,c,this._bufferSize),++l,++a);for(let u=0;u0);for(let g=0;gthis.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)}buildTexturesAndDrawCalls(){let{_bufferedTextures:e,maxTextures:t}=this,i=Gr._textureArrayPool,s=this.renderer.batch,o=this._tempBoundTextures,n=this.renderer.textureGC.count,a=++xe._globalBatch,l=0,c=i[0],u=0;s.copyBoundTextures(o,t);for(let h=0;h=t&&(s.boundArray(c,o,a,t),this.buildDrawCalls(c,u,h),u=h,c=i[++l],++a),d._batchEnabled=a,d.touched=n,c.elements[c.count++]=d)}c.count>0&&(s.boundArray(c,o,a,t),this.buildDrawCalls(c,u,this._bufferSize),++l,++a);for(let h=0;h0);for(let m=0;m=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){let{elements:o,ids:n,count:a}=t,l=0;for(let h=0;h=0&&u=Ze.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};_i.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},_i.extension={type:X.RendererSystem,name:"context"};Z.add(_i);var zi=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new te("disposeFramebuffer"),this.multisample=Rt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new xt(null,{scaleMode:dr.NEAREST,resolution:1,mipmap:Er.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new xt(null,{scaleMode:dr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Er.OFF,format:D.DEPTH_COMPONENT,type:lt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{i(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Qe.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var Os=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){let s=e.width,o=e.height;if(i){let n=t.width/2/s,a=t.height/2/o,l=t.x/s+n,h=t.y/o+a;i=Lt.add(i,Lt.NW),this.x0=l+n*Lt.uX(i),this.y0=h+a*Lt.uY(i),i=Lt.add(i,2),this.x1=l+n*Lt.uX(i),this.y1=h+a*Lt.uY(i),i=Lt.add(i,2),this.x2=l+n*Lt.uX(i),this.y2=h+a*Lt.uY(i),i=Lt.add(i,2),this.x3=l+n*Lt.uX(i),this.y3=h+a*Lt.uY(i)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};Os.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var nI=new Os;function rf(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var ah=class r extends Ps.default{constructor(t,e,i,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new bt(0,0,1,1)),t instanceof r&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=nI,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new oe(n.x,n.y):new oe(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&Je[e.url]&&r.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new r(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===nI&&(this._uvs=new Os),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=K.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof xt){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${pi()}`,xt.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${pi()}`}o=t._pixiId}let n=Je[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof xt)?(e.resolution||(e.resolution=Dd(t)),n=new r(new xt(t,e)),n.baseTexture.cacheId=o,xt.addToCache(n.baseTexture,o),r.addToCache(n,o)):!n&&t instanceof xt&&(n=new r(t),r.addToCache(n,o)),n}static fromURL(t,e){let i=Object.assign({autoLoad:!1},e?.resourceOptions),s=r.from(t,Object.assign({resourceOptions:i},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new r(xt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){let o=new xt(t,Object.assign({scaleMode:xt.defaultOptions.scaleMode,resolution:Dd(e)},s)),{resource:n}=o;n instanceof Us&&(n.url=e);let a=new r(o);return i||(i=e),xt.addToCache(a.baseTexture,i),r.addToCache(a,i),i!==e&&(xt.addToCache(a.baseTexture,e),r.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Je[e]&&Je[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Je[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Je[t];if(e){let i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Je[t],e}}else if(t?.textureCacheIds){for(let e=0;ethis.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",h=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${i} + ${o} = ${i+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${h} ${l} ${c}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return r._EMPTY||(r._EMPTY=new r(new xt),rf(r._EMPTY),rf(r._EMPTY.baseTexture)),r._EMPTY}static get WHITE(){if(!r._WHITE){let t=K.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),r._WHITE=new r(xt.from(t)),rf(r._WHITE),rf(r._WHITE.baseTexture)}return r._WHITE}};var Ls=class r extends ah{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,i&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new r(new Gs(t))}};var dn=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Rt.NONE){let s=new Gs(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Ls(s)}getOptimalTexture(t,e,i=1,s=Rt.NONE){let o;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=As(t),e=As(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(t,e,i){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Rt.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let i=this.texturePool[e];if(i)for(let s=0;s0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let i=this.texturePool[e];if(i)for(let s=0;s1&&(c=this.getOptimalFilterTexture(h.width,h.height,e.resolution),c.filterFrame=h.filterFrame),i[u].apply(this,h,c,Hi.CLEAR,e);let d=h;h=c,c=d}i[u].apply(this,h,l.renderTexture,Hi.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(h),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Hi.CLEAR){let{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,i.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Hi.CLEAR||e===Hi.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(i,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(jo.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(jo.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Gt.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=Rt.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Rt.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let i=sf[0],s=sf[1],o=sf[2],n=sf[3];i.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(i.x,s.x,o.x,n.x),l=Math.min(i.y,s.y,o.y,n.y),h=Math.max(i.x,s.x,o.x,n.x),c=Math.max(i.y,s.y,o.y,n.y);e.x=a,e.y=l,e.width=h-a,e.height=c-l}roundFrame(t,e,i,s,o){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(o){let{a:n,b:a,c:l,d:h}=o;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(h)>1e-4))return}o=o?Ey.copyFrom(o):Ey.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};fn.extension={type:X.RendererSystem,name:"filter"};Z.add(fn);var uh=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Rt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var EL=new bt,pn=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new zi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new bt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;K.PREFER_ENV===Ze.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=i),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n>i,a=e.height>>i,l=n/e.width;this.setViewport(e.x*l,e.y*l,n,a)}else{let n=t.width>>i,a=t.height>>i;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=i,o.height=s,this.gl.viewport(t,e,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,s,o=yd.COLOR|yd.DEPTH){let{gl:n}=this;n.clearColor(t,e,i,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,i=new uh(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){let{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let l=0;l1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let l=t.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let l,h;this.renderer.context.webGLVersion===1?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH_STENCIL):t.depth&&t.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH24_STENCIL8):t.depth?(l=i.DEPTH_ATTACHMENT,h=i.DEPTH_COMPONENT24):(l=i.STENCIL_ATTACHMENT,h=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,h,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,h,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,i=Rt.NONE;if(t<=1||e===null)return i;for(let s=0;s=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;ii.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,l)=>i.drawElementsInstancedANGLE(s,o,n,a,l),t.drawArraysInstanced=(s,o,n,a)=>i.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:i}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let s=0;s=0;--s)e[s]=i[s]||null,e[s]&&(e[s]._batchLocation=s)}boundArray(e,t,i,s){let{elements:o,ids:n,count:a}=e,l=0;for(let c=0;c=0&&h=sr.WEBGL2&&(i=e.getContext("webgl2",t)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){let{gl:e}=this,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})}handleContextLost(e){e.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let e=this.renderer.view;this.renderer=null,e.removeEventListener!==void 0&&(e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(e){let t=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=i||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};Ii.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ii.extension={type:$.RendererSystem,name:"context"};Z.add(Ii);var cs=class{constructor(e,t){if(this.width=Math.round(e),this.height=Math.round(t),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new rt("disposeFramebuffer"),this.multisample=Pe.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new xe(null,{scaleMode:vr.NEAREST,resolution:1,mipmap:Fr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new xe(null,{scaleMode:vr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Fr.OFF,format:H.DEPTH_COMPONENT,type:ae.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(e,t){if(e=Math.round(e),t=Math.round(t),!e||!t)throw new Error("Framebuffer width and height must not be zero");if(!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(let i=0;i{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{i(n),this.onError.emit(n)})}),this._load)}process(){let e=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let t=globalThis.createImageBitmap,i=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>t(s,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===or.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,i){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,i,this.bitmap),!this.preserveBitmap){let s=!0,o=t._glTextures;for(let n in o){let a=o[n];if(a!==i&&a.dirtyId!==t.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(e){return typeof HTMLImageElement<"u"&&(typeof e=="string"||e instanceof HTMLImageElement)}};var ao=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(e,t,i){let s=t.width,o=t.height;if(i){let n=e.width/2/s,a=e.height/2/o,l=e.x/s+n,c=e.y/o+a;i=Ne.add(i,Ne.NW),this.x0=l+n*Ne.uX(i),this.y0=c+a*Ne.uY(i),i=Ne.add(i,2),this.x1=l+n*Ne.uX(i),this.y1=c+a*Ne.uY(i),i=Ne.add(i,2),this.x2=l+n*Ne.uX(i),this.y2=c+a*Ne.uY(i),i=Ne.add(i,2),this.x3=l+n*Ne.uX(i),this.y3=c+a*Ne.uY(i)}else this.x0=e.x/s,this.y0=e.y/o,this.x1=(e.x+e.width)/s,this.y1=e.y/o,this.x2=(e.x+e.width)/s,this.y2=(e.y+e.height)/o,this.x3=e.x/s,this.y3=(e.y+e.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};ao.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var Jk=new ao;function Tp(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var Kc=class r extends Zs.default{constructor(e,t,i,s,o,n,a){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new _e(0,0,1,1)),e instanceof r&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=Jk,this.uvMatrix=null,this.orig=i||t,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new ct(n.x,n.y):new ct(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],e.valid?this.noFrame?e.valid&&this.onBaseTextureUpdated(e):this.frame=t:e.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&e.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(e){if(this.baseTexture){if(e){let{resource:t}=this.baseTexture;t?.url&&nr[t.url]&&r.removeFromCache(t.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),i=new r(this.baseTexture,!this.noFrame&&e,t,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===Jk&&(this._uvs=new ao),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},i=K.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else if(e instanceof xe){if(!e.cacheId){let a=t?.pixiIdPrefix||"pixiid";e.cacheId=`${a}-${Ai()}`,xe.addToCache(e,e.cacheId)}o=e.cacheId}else{if(!e._pixiId){let a=t?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Ai()}`}o=e._pixiId}let n=nr[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(e instanceof xe)?(t.resolution||(t.resolution=op(e)),n=new r(new xe(e,t)),n.baseTexture.cacheId=o,xe.addToCache(n.baseTexture,o),r.addToCache(n,o)):!n&&e instanceof xe&&(n=new r(e),r.addToCache(n,o)),n}static fromURL(e,t){let i=Object.assign({autoLoad:!1},t?.resourceOptions),s=r.from(e,Object.assign({resourceOptions:i},t),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(e,t,i,s){return new r(xe.fromBuffer(e,t,i,s))}static fromLoader(e,t,i,s){let o=new xe(e,Object.assign({scaleMode:xe.defaultOptions.scaleMode,resolution:op(t)},s)),{resource:n}=o;n instanceof no&&(n.url=t);let a=new r(o);return i||(i=t),xe.addToCache(a.baseTexture,i),r.addToCache(a,i),i!==t&&(xe.addToCache(a.baseTexture,t),r.addToCache(a,t)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),nr[t]&&nr[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),nr[t]=e)}static removeFromCache(e){if(typeof e=="string"){let t=nr[e];if(t){let i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete nr[e],t}}else if(e?.textureCacheIds){for(let t=0;tthis.baseTexture.width,a=i+o>this.baseTexture.height;if(n||a){let l=n&&a?"and":"or",c=`X: ${t} + ${s} = ${t+s} > ${this.baseTexture.width}`,u=`Y: ${i} + ${o} = ${i+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${c} ${l} ${u}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(e){this._rotate=e,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return r._EMPTY||(r._EMPTY=new r(new xe),Tp(r._EMPTY),Tp(r._EMPTY.baseTexture)),r._EMPTY}static get WHITE(){if(!r._WHITE){let e=K.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),r._WHITE=new r(xe.from(e)),Tp(r._WHITE),Tp(r._WHITE.baseTexture)}return r._WHITE}};var lo=class r extends Kc{constructor(e,t){super(e,t),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t,i=!0){let s=this.baseTexture.resolution,o=Math.round(e*s)/s,n=Math.round(t*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,i&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(e){let{baseTexture:t}=this;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))}static create(e){return new r(new oo(e))}};var Kn=class{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,i=Pe.NONE){let s=new oo(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new lo(s)}getOptimalTexture(e,t,i=1,s=Pe.NONE){let o;e=Math.max(Math.ceil(e*i-1e-6),1),t=Math.max(Math.ceil(t*i-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=Ks(e),t=Ks(t),o=((e&65535)<<16|t&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(e,t,s)),n.filterPoolKey=o,n.setResolution(i),n}getFilterTexture(e,t,i){let s=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||Pe.NONE);return s.filterFrame=e.filterFrame,s}returnTexture(e){let t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(let t in this.texturePool){let i=this.texturePool[t];if(i)for(let s=0;s0&&e.height>0;for(let t in this.texturePool){if(!(Number(t)<0))continue;let i=this.texturePool[t];if(i)for(let s=0;s1&&(u=this.getOptimalFilterTexture(c.width,c.height,t.resolution),u.filterFrame=c.filterFrame),i[h].apply(this,c,u,ns.CLEAR,t);let d=c;c=u,u=d}i[h].apply(this,c,l.renderTexture,ns.BLEND,t),h>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(u)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=ns.CLEAR){let{renderTexture:i,state:s}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=e.filterFrame.width,n.height=e.filterFrame.height,i.bind(e,e.filterFrame,n)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(t===ns.CLEAR||t===ns.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,i,s){let o=this.renderer;o.state.set(e.state),this.bindAndClear(i,s),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Bn.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Bn.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){let{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:o}=t._texture,n=e.set(s.width,0,0,s.height,i.x,i.y),a=t.worldTransform.copyTo(Ie.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(t.anchor.x,t.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,i=1,s=Pe.NONE){return this.texturePool.getOptimalTexture(e,t,i,s)}getFilterTexture(e,t,i){if(typeof e=="number"){let o=e;e=t,t=o}e=e||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,i||Pe.NONE);return s.filterFrame=e.filterFrame,s}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,t){let i=Sp[0],s=Sp[1],o=Sp[2],n=Sp[3];i.set(t.left,t.top),s.set(t.left,t.bottom),o.set(t.right,t.top),n.set(t.right,t.bottom),e.apply(i,i),e.apply(s,s),e.apply(o,o),e.apply(n,n);let a=Math.min(i.x,s.x,o.x,n.x),l=Math.min(i.y,s.y,o.y,n.y),c=Math.max(i.x,s.x,o.x,n.x),u=Math.max(i.y,s.y,o.y,n.y);t.x=a,t.y=l,t.width=c-a,t.height=u-l}roundFrame(e,t,i,s,o){if(!(e.width<=0||e.height<=0||i.width<=0||i.height<=0)){if(o){let{a:n,b:a,c:l,d:c}=o;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(c)>1e-4))return}o=o?db.copyFrom(o):db.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(o,e),e.ceil(t),this.transformAABB(o.invert(),e)}}};Zn.extension={type:$.RendererSystem,name:"filter"};Z.add(Zn);var eu=class{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Pe.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var nV=new _e,Qn=class{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new cs(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new _e,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;K.PREFER_ENV===sr.WEBGL_LEGACY&&(t=null,i=null),t?e.drawBuffers=s=>t.drawBuffersWEBGL(s):(this.hasMRT=!1,e.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,i=0){let{gl:s}=this;if(e){let o=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==i&&(e.dirtyId++,e.dirtyFormat++,o.mipLevel=i),o.dirtyId!==e.dirtyId&&(o.dirtyId=e.dirtyId,o.dirtyFormat!==e.dirtyFormat?(o.dirtyFormat=e.dirtyFormat,o.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):o.dirtySize!==e.dirtySize&&(o.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let n=0;n>i,a=t.height>>i,l=n/t.width;this.setViewport(t.x*l,t.y*l,n,a)}else{let n=e.width>>i,a=e.height>>i;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,t,i,s){let o=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),s=Math.round(s),(o.width!==i||o.height!==s||o.x!==e||o.y!==t)&&(o.x=e,o.y=t,o.width=i,o.height=s,this.gl.viewport(e,t,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(e,t,i,s,o=Lf.COLOR|Lf.DEPTH){let{gl:n}=this;n.clearColor(e,t,i,s),n.clear(o)}initFramebuffer(e){let{gl:t}=this,i=new eu(t.createFramebuffer());return i.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(e),e.disposeRunner.add(this),i}resizeFramebuffer(e){let{gl:t}=this,i=e.glFramebuffers[this.CONTEXT_UID];if(i.stencil){t.bindRenderbuffer(t.RENDERBUFFER,i.stencil);let n;this.renderer.context.webGLVersion===1?n=t.DEPTH_STENCIL:e.depth&&e.stencil?n=t.DEPTH24_STENCIL8:e.depth?n=t.DEPTH_COMPONENT24:n=t.STENCIL_INDEX8,i.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,n,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,n,e.width,e.height)}let s=e.colorTextures,o=s.length;t.drawBuffers||(o=Math.min(o,1));for(let n=0;n1&&this.canMultisampleFramebuffer(e)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let l=0;l1&&i.drawBuffers(a),e.depthTexture&&this.writeDepthTexture){let l=e.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,t)}if((e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let l,c;this.renderer.context.webGLVersion===1?(l=i.DEPTH_STENCIL_ATTACHMENT,c=i.DEPTH_STENCIL):e.depth&&e.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,c=i.DEPTH24_STENCIL8):e.depth?(l=i.DEPTH_ATTACHMENT,c=i.DEPTH_COMPONENT24):(l=i.STENCIL_ATTACHMENT,c=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,c,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){let{msaaSamples:t}=this,i=Pe.NONE;if(e<=1||t===null)return i;for(let s=0;s=0&&this.managedFramebuffers.splice(o,1),e.disposeRunner.remove(this),t||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,t)}disposeAll(e){let t=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;ii.createVertexArrayOES(),e.bindVertexArray=s=>i.bindVertexArrayOES(s),e.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(t.webGLVersion!==2){let i=e.getExtension("ANGLE_instanced_arrays");i?(e.vertexAttribDivisor=(s,o)=>i.vertexAttribDivisorANGLE(s,o),e.drawElementsInstanced=(s,o,n,a,l)=>i.drawElementsInstancedANGLE(s,o,n,a,l),e.drawArraysInstanced=(s,o,n,a)=>i.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||this.renderer.shader.shader;let{gl:i}=this,s=e.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[t.program.id]||this.initGeometryVao(e,t,o);this._activeGeometry=e,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this.renderer.buffer;for(let i=0;i"u"?.5:t,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,t){t===void 0&&(t=e);let i=this.mapCoord;for(let s=0;s0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};gn.extension={type:X.RendererSystem,name:"mask"};Z.add(gn);var xn=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var cI=new Gt,uI=[],dI=class of extends xn{constructor(t){super(t),this.glConst=K.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,uI.pop()??new bt);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:i,c:s,d:o}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(o)>1e-4)}testScissor(t){let{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||of.isMatrixRotated(e.worldTransform)||of.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,o){of.isMatrixRotated(o)||(o=o?cI.copyFrom(o):cI.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&uI.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};dI.extension={type:X.RendererSystem,name:"scissor"};var Py=dI;Z.add(Py);var yn=class extends xn{constructor(t){super(t),this.glConst=K.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,i.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{let i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}};yn.extension={type:X.RendererSystem,name:"stencil"};Z.add(yn);var _n=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ft("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ft("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ft("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};_n.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"_plugin"};Z.add(_n);var bn=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Gt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/e.width*2,o.d=n*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-n-e.y*o.d}setTransform(t){}destroy(){this.renderer=null}};bn.extension={type:X.RendererSystem,name:"projection"};Z.add(bn);var AL=new jd,fI=new bt,vn=class{constructor(t){this.renderer=t,this._tempMatrix=new Gt}generateTexture(t,e){let{region:i,...s}=e||{},o=i?.copyTo(fI)||t.getLocalBounds(fI,!0),n=s.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/n),o.height=Math.max(o.height,1/n),s.width=o.width,s.height=o.height,s.resolution=n,s.multisample??(s.multisample=this.renderer.multisample);let a=Ls.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=t.transform;return t.transform=AL,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}};vn.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"textureGenerator"};Z.add(vn);var Ds=new bt,mh=new bt,Tn=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new bt,this.destinationFrame=new bt,this.viewportFrame=new bt}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(Ds.width=t.frame.width,Ds.height=t.frame.height,e=Ds),i||(mh.x=t.frame.x,mh.y=t.frame.y,mh.width=e.width,mh.height=e.height,i=mh),n=o.framebuffer):(a=s.resolution,e||(Ds.width=s._view.screen.width,Ds.height=s._view.screen.height,e=Ds),i||(i=Ds,i.width=e.width,i.height=e.height));let l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,t||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(n,l),this.renderer.projection.update(i,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Pr.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:l,y:h,width:c,height:u}=this.viewportFrame;l=Math.round(l),h=Math.round(h),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,h,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};Tn.extension={type:X.RendererSystem,name:"renderTexture"};Z.add(Tn);var gh=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function pI(r,t){let e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;sl>h?1:-1);for(let l=0;l0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}};ea.extension={type:$.RendererSystem,name:"mask"};Z.add(ea);var ta=class{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){let{gl:t}=this.renderer,i=this.getStackLength();this.maskStack=e;let s=this.getStackLength();s!==i&&(s===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var iF=new Ie,sF=[],oF=class wp extends ta{constructor(e){super(e),this.glConst=K.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0}calcScissorRect(e){if(e._scissorRectLocal)return;let t=e._scissorRect,{maskObject:i}=e,{renderer:s}=this,o=s.renderTexture,n=i.getBounds(!0,sF.pop()??new _e);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),t&&n.fit(t),e._scissorRectLocal=n}static isMatrixRotated(e){if(!e)return!1;let{a:t,b:i,c:s,d:o}=e;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(o)>1e-4)}testScissor(e){let{maskObject:t}=e;if(!t.isFastRect||!t.isFastRect()||wp.isMatrixRotated(t.worldTransform)||wp.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);let i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,t,i,s,o){wp.isMatrixRotated(o)||(o=o?iF.copyFrom(o):iF.identity(),o.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,e),e.fit(s),e.x=Math.round(e.x*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))}push(e){e._scissorRectLocal||this.calcScissorRect(e);let{gl:t}=this.renderer;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){let{gl:t}=this.renderer;e&&sF.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)}_useCurrent(){let e=this.maskStack[this.maskStack.length-1]._scissorRect,t;this.renderer.renderTexture.current?t=e.y:t=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)}};oF.extension={type:$.RendererSystem,name:"scissor"};var pb=oF;Z.add(pb);var ra=class extends ta{constructor(e){super(e),this.glConst=K.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){let t=e.maskObject,{gl:i}=this.renderer,s=e._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),e._stencilCounter++;let o=e._colorMask;o!==0&&(e._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,o!==0&&(e._colorMask=o,i.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(e){let t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.STENCIL_TEST);else{let i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,s!==0&&(i._colorMask=s,t.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}};ra.extension={type:$.RendererSystem,name:"stencil"};Z.add(ra);var ia=class{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return fe("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return fe("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return fe("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){let e=this.rendererPlugins;for(let t in e)this.plugins[t]=new e[t](this.renderer)}destroy(){for(let e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}};ia.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_plugin"};Z.add(ia);var sa=class{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ie,this.transform=null}update(e,t,i,s){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(e,t,i,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/t.width*2,o.d=n*(1/t.height*2),o.tx=-1-t.x*o.a,o.ty=-n-t.y*o.d}setTransform(e){}destroy(){this.renderer=null}};sa.extension={type:$.RendererSystem,name:"projection"};Z.add(sa);var aV=new fp,nF=new _e,oa=class{constructor(e){this.renderer=e,this._tempMatrix=new Ie}generateTexture(e,t){let{region:i,...s}=t||{},o=i?.copyTo(nF)||e.getLocalBounds(nF,!0),n=s.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/n),o.height=Math.max(o.height,1/n),s.width=o.width,s.height=o.height,s.resolution=n,s.multisample??(s.multisample=this.renderer.multisample);let a=lo.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let l=e.transform;return e.transform=aV,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=l,a}destroy(){}};oa.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"textureGenerator"};Z.add(oa);var co=new _e,su=new _e,na=class{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new _e,this.destinationFrame=new _e,this.viewportFrame=new _e}contextChange(){let e=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,i){let s=this.renderer;this.current=e;let o,n,a;e?(o=e.baseTexture,a=o.resolution,t||(co.width=e.frame.width,co.height=e.frame.height,t=co),i||(su.x=e.frame.x,su.y=e.frame.y,su.width=t.width,su.height=t.height,i=su),n=o.framebuffer):(a=s.resolution,t||(co.width=s._view.screen.width,co.height=s._view.screen.height,t=co),i||(i=co,i.width=t.width,i.height=t.height));let l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,e||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(n,l),this.renderer.projection.update(i,t,a,!n),e?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(i)}clear(e,t){let i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Ur.shared.setValue(e||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:l,y:c,width:u,height:h}=this.viewportFrame;l=Math.round(l),c=Math.round(c),u=Math.round(u),h=Math.round(h),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,c,u,h)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,t),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};na.extension={type:$.RendererSystem,name:"renderTexture"};Z.add(na);var ou=class{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function aF(r,e){let t={},i=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES);for(let s=0;sl>c?1:-1);for(let l=0;l({data:o,offset:0,dataLen:0,dirty:0})),e=0,i=0,s=0;for(let o=0;o1&&(e=Math.max(e,16)*n.data.size),n.dataLen=e,i%e!==0&&i<16){let a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=e,i=e):(n.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function yI(r,t){let e=[];for(let i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function Ry(r,t){if(!r.autoManage)return{size:0,syncFunc:PL};let e=yI(r.uniforms,t),{uboElements:i,size:s}=xI(e),o=[` + `},cF={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function uF(r){let e=r.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),t=0,i=0,s=0;for(let o=0;o1&&(t=Math.max(t,16)*n.data.size),n.dataLen=t,i%t!==0&&i<16){let a=i%t%16;i+=a,s+=a}i+t>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=t,i=t):(n.offset=s,i+=t,s+=t)}return s=Math.ceil(s/16)*16,{uboElements:e,size:s}}function hF(r,e){let t=[];for(let i in r)e[i]&&t.push(e[i]);return t.sort((i,s)=>i.index-s.index),t}function gb(r,e){if(!r.autoManage)return{size:0,syncFunc:lV};let t=hF(r.uniforms,e),{uboElements:i,size:s}=uF(t),o=[` var v = null; var v2 = null; var cv = null; @@ -1601,9 +1874,9 @@ void main(void) var gl = renderer.gl var index = 0; var data = buffer.data; - `];for(let n=0;n1){let u=th(a.data.type),d=Math.max(gI[a.data.type]/16,1),f=u/d,m=(4-f%4)%4;o.push(` - cv = ud.${h}.value; - v = uv.${h}; + `];for(let n=0;n1){let h=Wc(a.data.type),d=Math.max(cF[a.data.type]/16,1),f=h/d,p=(4-f%4)%4;o.push(` + cv = ud.${c}.value; + v = uv.${c}; offset = ${a.offset/4}; t = 0; @@ -1614,18 +1887,18 @@ void main(void) { data[offset++] = v[t++]; } - offset += ${m}; + offset += ${p}; } - `)}else{let u=CL[a.data.type];o.push(` - cv = ud.${h}.value; - v = uv.${h}; + `)}else{let h=cV[a.data.type];o.push(` + cv = ud.${c}.value; + v = uv.${c}; offset = ${a.offset/4}; - ${u}; + ${h}; `)}}return o.push(` renderer.buffer.update(buffer); `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(` -`))}}var RL=0,nf={textureCount:0,uboCount:0},$i=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=RL++}systemCheck(){if(!tf())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(nf.textureCount=0,nf.uboCount=0,this.syncUniformGroup(t.uniformGroup,nf)),s}setUniforms(t){let e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){let i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=by(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;let s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,nf,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=Ry(t,this.shader.program.uniformData)),t.autoManage){let l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){let s=t.uniforms,o=[`${i}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,i=t.program,s=Cy(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};$i.extension={type:X.RendererSystem,name:"shader"};Z.add($i);var bi=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};bi.defaultOptions={hello:!1},bi.extension={type:[X.RendererSystem,X.CanvasRendererSystem],name:"startup"};Z.add(bi);function _I(r,t=[]){return t[rt.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.ADD]=[r.ONE,r.ONE],t[rt.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.NONE]=[0,0],t[rt.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[rt.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[rt.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[rt.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[rt.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[rt.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[rt.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[rt.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[rt.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[rt.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[rt.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var ML=0,IL=1,BL=2,FL=3,kL=4,GL=5,bI=class My{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=rt.NONE,this._blendEq=!1,this.map=[],this.map[ML]=this.setBlend,this.map[IL]=this.setOffset,this.map[BL]=this.setCullFace,this.map[FL]=this.setDepthTest,this.map[kL]=this.setFrontFace,this.map[GL]=this.setDepthMask,this.checks=[],this.defaultState=new Yr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=_I(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<>1,i++;this.stateId=t.data}for(let e=0;et.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new te(e)})}addSystem(t,e){let i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){let i=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var xh=class af{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=af.defaultMaxIdle,this.checkCountMax=af.defaultCheckCountMax,this.mode=af.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==_d.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,i=!1;for(let s=0;sthis.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,i=!0)}if(i){let s=0;for(let o=0;o=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};xh.defaultMode=_d.AUTO,xh.defaultMaxIdle=60*60,xh.defaultCheckCountMax=60*10,xh.extension={type:X.RendererSystem,name:"textureGC"};var Zr=xh;Z.add(Zr);var Ns=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=lt.UNSIGNED_BYTE,this.internalFormat=D.RGBA,this.samplerType=0}};function vI(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.R8]:H.FLOAT,[r.R8_SNORM]:H.FLOAT,[r.RG8]:H.FLOAT,[r.RG8_SNORM]:H.FLOAT,[r.RGB8]:H.FLOAT,[r.RGB8_SNORM]:H.FLOAT,[r.RGB565]:H.FLOAT,[r.RGBA4]:H.FLOAT,[r.RGB5_A1]:H.FLOAT,[r.RGBA8]:H.FLOAT,[r.RGBA8_SNORM]:H.FLOAT,[r.RGB10_A2]:H.FLOAT,[r.RGB10_A2UI]:H.FLOAT,[r.SRGB8]:H.FLOAT,[r.SRGB8_ALPHA8]:H.FLOAT,[r.R16F]:H.FLOAT,[r.RG16F]:H.FLOAT,[r.RGB16F]:H.FLOAT,[r.RGBA16F]:H.FLOAT,[r.R32F]:H.FLOAT,[r.RG32F]:H.FLOAT,[r.RGB32F]:H.FLOAT,[r.RGBA32F]:H.FLOAT,[r.R11F_G11F_B10F]:H.FLOAT,[r.RGB9_E5]:H.FLOAT,[r.R8I]:H.INT,[r.R8UI]:H.UINT,[r.R16I]:H.INT,[r.R16UI]:H.UINT,[r.R32I]:H.INT,[r.R32UI]:H.UINT,[r.RG8I]:H.INT,[r.RG8UI]:H.UINT,[r.RG16I]:H.INT,[r.RG16UI]:H.UINT,[r.RG32I]:H.INT,[r.RG32UI]:H.UINT,[r.RGB8I]:H.INT,[r.RGB8UI]:H.UINT,[r.RGB16I]:H.INT,[r.RGB16UI]:H.UINT,[r.RGB32I]:H.INT,[r.RGB32UI]:H.UINT,[r.RGBA8I]:H.INT,[r.RGBA8UI]:H.UINT,[r.RGBA16I]:H.INT,[r.RGBA16UI]:H.UINT,[r.RGBA32I]:H.INT,[r.RGBA32UI]:H.UINT,[r.DEPTH_COMPONENT16]:H.FLOAT,[r.DEPTH_COMPONENT24]:H.FLOAT,[r.DEPTH_COMPONENT32F]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT,[r.DEPTH24_STENCIL8]:H.FLOAT,[r.DEPTH32F_STENCIL8]:H.FLOAT}:t={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT},t}function TI(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[lt.UNSIGNED_BYTE]:{[D.RGBA]:r.RGBA8,[D.RGB]:r.RGB8,[D.RG]:r.RG8,[D.RED]:r.R8,[D.RGBA_INTEGER]:r.RGBA8UI,[D.RGB_INTEGER]:r.RGB8UI,[D.RG_INTEGER]:r.RG8UI,[D.RED_INTEGER]:r.R8UI,[D.ALPHA]:r.ALPHA,[D.LUMINANCE]:r.LUMINANCE,[D.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[lt.BYTE]:{[D.RGBA]:r.RGBA8_SNORM,[D.RGB]:r.RGB8_SNORM,[D.RG]:r.RG8_SNORM,[D.RED]:r.R8_SNORM,[D.RGBA_INTEGER]:r.RGBA8I,[D.RGB_INTEGER]:r.RGB8I,[D.RG_INTEGER]:r.RG8I,[D.RED_INTEGER]:r.R8I},[lt.UNSIGNED_SHORT]:{[D.RGBA_INTEGER]:r.RGBA16UI,[D.RGB_INTEGER]:r.RGB16UI,[D.RG_INTEGER]:r.RG16UI,[D.RED_INTEGER]:r.R16UI,[D.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[lt.SHORT]:{[D.RGBA_INTEGER]:r.RGBA16I,[D.RGB_INTEGER]:r.RGB16I,[D.RG_INTEGER]:r.RG16I,[D.RED_INTEGER]:r.R16I},[lt.UNSIGNED_INT]:{[D.RGBA_INTEGER]:r.RGBA32UI,[D.RGB_INTEGER]:r.RGB32UI,[D.RG_INTEGER]:r.RG32UI,[D.RED_INTEGER]:r.R32UI,[D.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[lt.INT]:{[D.RGBA_INTEGER]:r.RGBA32I,[D.RGB_INTEGER]:r.RGB32I,[D.RG_INTEGER]:r.RG32I,[D.RED_INTEGER]:r.R32I},[lt.FLOAT]:{[D.RGBA]:r.RGBA32F,[D.RGB]:r.RGB32F,[D.RG]:r.RG32F,[D.RED]:r.R32F,[D.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[lt.HALF_FLOAT]:{[D.RGBA]:r.RGBA16F,[D.RGB]:r.RGB16F,[D.RG]:r.RG16F,[D.RED]:r.R16F},[lt.UNSIGNED_SHORT_5_6_5]:{[D.RGB]:r.RGB565},[lt.UNSIGNED_SHORT_4_4_4_4]:{[D.RGBA]:r.RGBA4},[lt.UNSIGNED_SHORT_5_5_5_1]:{[D.RGBA]:r.RGB5_A1},[lt.UNSIGNED_INT_2_10_10_10_REV]:{[D.RGBA]:r.RGB10_A2,[D.RGBA_INTEGER]:r.RGB10_A2UI},[lt.UNSIGNED_INT_10F_11F_11F_REV]:{[D.RGB]:r.R11F_G11F_B10F},[lt.UNSIGNED_INT_5_9_9_9_REV]:{[D.RGB]:r.RGB9_E5},[lt.UNSIGNED_INT_24_8]:{[D.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[lt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[D.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[lt.UNSIGNED_BYTE]:{[D.RGBA]:r.RGBA,[D.RGB]:r.RGB,[D.ALPHA]:r.ALPHA,[D.LUMINANCE]:r.LUMINANCE,[D.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[lt.UNSIGNED_SHORT_5_6_5]:{[D.RGB]:r.RGB},[lt.UNSIGNED_SHORT_4_4_4_4]:{[D.RGBA]:r.RGBA},[lt.UNSIGNED_SHORT_5_5_5_1]:{[D.RGBA]:r.RGBA}},t}var wn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xt,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=TI(t),this.samplerTypes=vI(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==H.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new Ns(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??H.FLOAT,this.webGLVersion===2&&t.type===lt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==H.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=i.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&ny(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Er.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Gl.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let i=this.gl;if(e.mipmap&&t.mipmap!==Er.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===dr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===dr.LINEAR){let o=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===dr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===dr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};wn.extension={type:X.RendererSystem,name:"texture"};Z.add(wn);var En=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:i,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Hs||{});var An=class{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var SI=class rr{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new An(null,null,1/0),this.deltaMS=1/rr.targetFPMS,this.elapsedMS=1/rr.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Hs.NORMAL){return this._addListener(new An(t,e,i))}addOnce(t,e,i=Hs.NORMAL){return this._addListener(new An(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?gr.shared:new gr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};yh.extension=X.Application;Z.add(yh);var UL=[];Z.handleByList(X.Renderer,UL);var _h=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{let i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Rt.HIGH?this.multisample=Rt.HIGH:e>=Rt.MEDIUM?this.multisample=Rt.MEDIUM:e>=Rt.LOW?this.multisample=Rt.LOW:this.multisample=Rt.NONE}destroy(){}};_h.extension={type:X.RendererSystem,name:"_multisample"};Z.add(_h);var lf=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var bh=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}update(t){let{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let i=0;ie.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}};var Th=class extends Xi{constructor(t,e){let{width:i,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:i,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=di.TEXTURE_2D_ARRAY}upload(t,e,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let l=0;l0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=di.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){let s=this.itemDirtyIds;for(let o=0;o{if(this.url===null){t(this);return}try{let i=await K.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Qe.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return r._EMPTY=r._EMPTY??K.ADAPTER.createCanvas(0,0),r._EMPTY}};var ky=class uf extends fe{constructor(t,e){e=e||{},super(K.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},uf.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;fe.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,o=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${pi()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=uf.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&uf.SVG_XML.test(t)}};ky.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var Gy=ky;var df=class extends fe{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var Uy=class Oy extends fe{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];fe.crossOrigin(i,s,e.crossorigin);for(let o=0;o{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(gr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(gr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(gr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Oy.TYPES.includes(e)}};Uy.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Uy.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var Ly=Uy;Kl.push(Eh,Us,Sh,Ly,df,Gy,Cs,Fy,Th);var OL={vec3(r,t,e,i){(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2])&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],r.uniform3f(t,i[0],i[1],i[2]))},int(r,t,e,i){r.uniform1i(t,i)},ivec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},ivec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},ivec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},uint(r,t,e,i){r.uniform1ui(t,i)},uvec2(r,t,e,i){r.uniform2ui(t,i[0],i[1])},uvec3(r,t,e,i){r.uniform3ui(t,i[0],i[1],i[2])},uvec4(r,t,e,i){r.uniform4ui(t,i[0],i[1],i[2],i[3])},bvec2(r,t,e,i){r.uniform2i(t,i[0],i[1])},bvec3(r,t,e,i){r.uniform3i(t,i[0],i[1],i[2])},bvec4(r,t,e,i){r.uniform4i(t,i[0],i[1],i[2],i[3])},mat2(r,t,e,i){r.uniformMatrix2fv(t,!1,i)},mat4(r,t,e,i){r.uniformMatrix4fv(t,!1,i)}},LL={float(r,t,e,i){r.uniform1fv(t,i)},vec2(r,t,e,i){r.uniform2fv(t,i)},vec3(r,t,e,i){r.uniform3fv(t,i)},vec4(r,t,e,i){r.uniform4fv(t,i)},int(r,t,e,i){r.uniform1iv(t,i)},ivec2(r,t,e,i){r.uniform2iv(t,i)},ivec3(r,t,e,i){r.uniform3iv(t,i)},ivec4(r,t,e,i){r.uniform4iv(t,i)},uint(r,t,e,i){r.uniform1uiv(t,i)},uvec2(r,t,e,i){r.uniform2uiv(t,i)},uvec3(r,t,e,i){r.uniform3uiv(t,i)},uvec4(r,t,e,i){r.uniform4uiv(t,i)},bool(r,t,e,i){r.uniform1iv(t,i)},bvec2(r,t,e,i){r.uniform2iv(t,i)},bvec3(r,t,e,i){r.uniform3iv(t,i)},bvec4(r,t,e,i){r.uniform4iv(t,i)},sampler2D(r,t,e,i){r.uniform1iv(t,i)},samplerCube(r,t,e,i){r.uniform1iv(t,i)},sampler2DArray(r,t,e,i){r.uniform1iv(t,i)}};function EI(r,t,e,i,s){let o=0,n=null,a=null,l=s.gl;for(let h in r.uniforms){let c=t[h],u=i[h],d=e[h],f=r.uniforms[h];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,l.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,l.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,u.toArray(!0)):l.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,l.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,l.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],l.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?OL:LL)[c.type].call(null,l,d.location,d.value,u)}}function DL(){Object.assign($i.prototype,{systemCheck(){},syncUniforms(r,t){let{shader:e,renderer:i}=this;EI(r,e.program.uniformData,t.uniformData,r.uniforms,i)}})}DL();var Ah=new(window.AudioContext||window.webkitAudioContext),NL=(r,t)=>{let e,i=Ah.createGain();i.gain.value=t.volume??1,i.connect(Ah.destination);let s={id:r,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let g=Xo.getAsset(s.url);if(!g){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Ah.createBufferSource(),e.buffer=g,e.loop=s.loop,i.gain.setValueAtTime(s.volume,Ah.currentTime),e.connect(i),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),i.disconnect(),i.connect(Ah.destination))},update:g=>{s={...s,...g}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:g=>{s.url=g},setLoop:g=>{s.loop=g},setVolume:g=>{s.volume=g,i.gain.value=g},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},AI=()=>{let r=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(l=>l.id!==a)},getById:a=>t.find(l=>l.id===a),tick:()=>{for(let l of t){let h=r.find(c=>c.id===l.id);if(!h){let c=NL(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(c),c.play();continue}(h.url!==l.url||h.loop!==l.loop)&&(h.stop(),h.setUrl(l.url),h.setLoop(l.loop??!1),h.play()),h.getVolume()!==(l.volume??1)&&h.setVolume(l.volume??1)}let a=[];for(let l of r)t.find(h=>h.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],t=[]}}};var HL=({JSONObject:r,parserPlugins:t=[]})=>r.map(i=>{let s=t.find(o=>o.type===i.type);if(!s)throw new Error(`No parser plugin found for element type: ${i.type} (id: ${i.id??"unknown"})`);return s.parse({state:i,parserPlugins:t})});var Dy=HL;var PI=({type:r,parse:t})=>({type:r,parse:t});var Ny=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Hy(r,t,e,i){r.addEventListener?r.addEventListener(t,e,i):r.attachEvent&&r.attachEvent(`on${t}`,e)}function Ph(r,t,e,i){r&&(r.removeEventListener?r.removeEventListener(t,e,i):r.detachEvent&&r.detachEvent(`on${t}`,e))}function MI(r,t){let e=t.slice(0,t.length-1),i=[];for(let s=0;s=0;)t[e-1]+=",",t.splice(e,1),e=t.lastIndexOf("");return t}function VL(r,t){let e=r.length>=t.length?r:t,i=r.length>=t.length?t:r,s=!0;for(let o=0;oMh[r.toLowerCase()]||Rr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),WL=r=>Object.keys(Mh).find(t=>Mh[t]===r),zL=r=>Object.keys(Rr).find(t=>Rr[t]===r),kI=r=>{FI=r||"all"},Ih=()=>FI||"all",$L=()=>Vt.slice(0),XL=()=>Vt.map(r=>WL(r)||zL(r)||String.fromCharCode(r)),jL=()=>{let r=[];return Object.keys(jt).forEach(t=>{jt[t].forEach(({key:e,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:e.split("+").map(n=>Pn(n))})})}),r},GI=r=>{let t=r.target||r.srcElement,{tagName:e}=t,i=!0,s=e==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(s||e==="TEXTAREA"||e==="SELECT")&&!t.readOnly)&&(i=!1),i},YL=r=>(typeof r=="string"&&(r=Pn(r)),Vt.indexOf(r)!==-1),qL=(r,t)=>{let e,i;r||(r=Ih());for(let s in jt)if(Object.prototype.hasOwnProperty.call(jt,s))for(e=jt[s],i=0;iWy(o)):i++;Ih()===r&&kI(t||"all")};function KL(r){let t=BI(r);r.key&&r.key.toLowerCase()==="capslock"&&(t=Pn(r.key));let e=Vt.indexOf(t);if(e>=0&&Vt.splice(e,1),r.key&&r.key.toLowerCase()==="meta"&&Vt.splice(0,Vt.length),(t===93||t===224)&&(t=91),t in we){we[t]=!1;for(let i in Rr)Rr[i]===t&&(ir[i]=!1)}}var UI=(r,...t)=>{if(typeof r>"u")Object.keys(jt).forEach(e=>{Array.isArray(jt[e])&&jt[e].forEach(i=>ff(i)),delete jt[e]}),Wy(null);else if(Array.isArray(r))r.forEach(e=>{e.key&&ff(e)});else if(typeof r=="object")r.key&&ff(r);else if(typeof r=="string"){let[e,i]=t;typeof e=="function"&&(i=e,e=""),ff({key:r,scope:e,method:i,splitKey:"+"})}},ff=({key:r,scope:t,method:e,splitKey:i="+"})=>{II(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":Pn(a);if(!jt[l])return;t||(t=Ih());let h=n>1?MI(Rr,o):[],c=[];jt[l]=jt[l].filter(u=>{let d=(e?u.method===e:!0)&&u.scope===t&&VL(u.mods,h);return d&&c.push(u.element),!d}),c.forEach(u=>Wy(u))})};function CI(r,t,e,i){if(t.element!==i)return;let s;if(t.scope===e||t.scope==="all"){s=t.mods.length>0;for(let o in we)Object.prototype.hasOwnProperty.call(we,o)&&(!we[o]&&t.mods.indexOf(+o)>-1||we[o]&&t.mods.indexOf(+o)===-1)&&(s=!1);(t.mods.length===0&&!we[16]&&!we[18]&&!we[17]&&!we[91]||s||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(Vt),t.method(r,t)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function RI(r,t){let e=jt["*"],i=BI(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(ir.filter||GI).call(this,r))return;if((i===93||i===224)&&(i=91),Vt.indexOf(i)===-1&&i!==229&&Vt.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=Ch[a];r[a]&&Vt.indexOf(l)===-1?Vt.push(l):!r[a]&&Vt.indexOf(l)>-1?Vt.splice(Vt.indexOf(l),1):a==="metaKey"&&r[a]&&(Vt=Vt.filter(h=>h in Ch||h===i))}),i in we){we[i]=!0;for(let a in Rr)if(Object.prototype.hasOwnProperty.call(Rr,a)){let l=Ch[Rr[a]];ir[a]=r[l]}if(!e)return}for(let a in we)Object.prototype.hasOwnProperty.call(we,a)&&(we[a]=r[Ch[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(Vt.indexOf(17)===-1&&Vt.push(17),Vt.indexOf(18)===-1&&Vt.push(18),we[17]=!0,we[18]=!0);let s=Ih();if(e)for(let a=0;a1&&(s=MI(Rr,f));let m=f[f.length-1];m=m==="*"?"*":Pn(m),m in jt||(jt[m]=[]),jt[m].push({keyup:l,keydown:h,scope:o,mods:s,shortcut:i[a],method:e,key:i[a],splitKey:c,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!Ti.has(n)){let f=(g=window.event)=>RI(g,n),m=(g=window.event)=>{RI(g,n),KL(g)};Ti.set(n,{keydownListener:f,keyupListenr:m,capture:u}),Hy(n,"keydown",f,u),Hy(n,"keyup",m,u)}if(!Rh){let f=()=>{Vt=[]};Rh={listener:f,capture:u},Hy(window,"focus",f,u)}}};function ZL(r,t="all"){Object.keys(jt).forEach(e=>{jt[e].filter(i=>i.scope===t&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function Wy(r){let t=Object.values(jt).flat();if(t.findIndex(({element:e})=>e===r)<0&&r){let{keydownListener:e,keyupListenr:i,capture:s}=Ti.get(r)||{};e&&i&&(Ph(r,"keyup",i,s),Ph(r,"keydown",e,s),Ti.delete(r))}if((t.length<=0||Ti.size<=0)&&(Array.from(Ti.keys()).forEach(e=>{let{keydownListener:i,keyupListenr:s,capture:o}=Ti.get(e)||{};i&&s&&(Ph(e,"keyup",s,o),Ph(e,"keydown",i,o),Ti.delete(e))}),Ti.clear(),Object.keys(jt).forEach(e=>delete jt[e]),Rh)){let{listener:e,capture:i}=Rh;Ph(window,"focus",e,i),Rh=null}}var Vy={getPressedKeyString:XL,setScope:kI,getScope:Ih,deleteScope:qL,getPressedKeyCodes:$L,getAllKeyCodes:jL,isPressed:YL,filter:GI,trigger:ZL,unbind:UI,keyMap:Mh,modifier:Rr,modifierMap:Ch};for(let r in Vy){let t=r;Object.prototype.hasOwnProperty.call(Vy,t)&&(ir[t]=Vy[t])}if(typeof window<"u"){let r=window.hotkeys;ir.noConflict=t=>(t&&window.hotkeys===ir&&(window.hotkeys=r),ir),window.hotkeys=ir}var QL=Object.prototype.hasOwnProperty,OI=r=>{let t=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let h=t.get(l);h?Et(h.payload,s[l].payload)||(n.push(l),ir.unbind(l)):o.push(l)}),t.forEach((l,h)=>{QL.call(s,h)||a.push(h)}),a.forEach(l=>{ir.unbind(l),t.delete(l)}),[...o,...n].forEach(l=>{let c=s[l].payload??{};ir(l,()=>{r&&r("keydown",{_event:{key:l},...c})}),t.set(l,{value:l,payload:c})})},destroy:()=>{for(let s of t.keys())ir.unbind(s);t.clear()}}};var DI=(r,t)=>typeof t!="string"?t:r[t]??t,JL=(r,t,e,i)=>{let s=DI(e,t);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},LI=(r,t,e,i)=>{let s=DI(e,t);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;nObject.entries(t).map(([i,s])=>{if(!dP[i])throw new Error(`${i} is not a supported property for animation.`);let o=JL(r,i,e,0),n=s.initialValue??o,a=El([{value:n},...s.keyframes]);return{property:i,timeline:a}}),NI=()=>{let r=[],t=new Map,e=new Map,i=0,s=(w,T)=>{e.get(w)?.forEach(C=>{try{C(T)}catch{}})},o=w=>{if(s("completed",{id:w.id}),w.onComplete)try{w.onComplete()}catch{}},n=w=>{let{id:T,element:C,properties:A,targetState:P,onComplete:R,onCancel:I,propertyPathMap:F=fP}=w,G=tD(C,A,F),z={id:T,kind:"property",element:C,timelines:G,duration:Al(G),currentTime:0,stateVersion:i,targetState:P,onComplete:R,onCancel:I,applyFrame:U=>{for(let{property:$,timeline:V}of G){let O=Pl(V,U);try{LI(C,$,F,O)}catch{}}},applyTargetState:()=>{if(!(!C||C.destroyed)){if(P===null){C.destroy();return}if(P)for(let[U,$]of Object.entries(P))try{LI(C,U,F,$)}catch{}}},isValid:()=>!!C&&!C.destroyed};z.applyFrame(0),t.set(T,z),s("started",{id:T})},a=w=>{let T={id:w.id,kind:"custom",duration:w.duration??0,currentTime:0,stateVersion:i,onComplete:w.onComplete,onCancel:w.onCancel,applyFrame:w.applyFrame??(()=>{}),applyTargetState:w.applyTargetState??(()=>{}),isValid:w.isValid??(()=>!0)};T.applyFrame(0),t.set(T.id,T),s("started",{id:T.id})},l=w=>{if(w.driver==="custom"){a(w);return}n(w)},h=w=>{try{w.applyTargetState?.()}catch{}if(w.onCancel)try{w.onCancel()}catch{}},c=w=>{switch(w.type){case"START":l(w.payload);break;case"CANCEL":d(w.id);break}},u=()=>{let w=r.splice(0);for(let T of w)c(T)},d=w=>{let T=t.get(w);T&&(h(T),t.delete(w),s("cancelled",{id:w}))},f=w=>{r.push(w)},m=()=>{for(let[w,T]of t)h(T),s("cancelled",{id:w});t.clear(),i++},g=w=>{u();let T=[];for(let[C,A]of t){if(A.stateVersion!==i){T.push(C);continue}if(!A.isValid()){T.push(C);continue}if(A.currentTime+=w,A.currentTime>=A.duration){A.applyFrame(A.duration),o(A),T.push(C);continue}A.applyFrame(A.currentTime)}for(let C of T)t.delete(C)},p=()=>{u()},b=(w,T)=>(e.has(w)||e.set(w,new Set),e.get(w).add(T),()=>y(w,T)),y=(w,T)=>{e.get(w)?.delete(T)};return{dispatch:f,cancelAll:m,flush:p,tick:g,on:b,off:y,getState:()=>({stateVersion:i,activeCount:t.size,animations:Array.from(t.entries()).map(([w,T])=>({id:w,currentTime:T.currentTime,duration:T.duration,progress:T.duration>0?T.currentTime/T.duration:0}))}),isAnimating:w=>t.has(w),destroy:()=>{m(),e.clear()}}};var HI=r=>{let t=0,e=0,i=null;return{reset:h=>{t>0&&i!==null&&r?.("renderComplete",{id:i,aborted:!0}),e++,t=0,i=h},track:h=>{h===e&&t++},complete:h=>{h===e&&(t--,t===0&&r?.("renderComplete",{id:i,aborted:!1}))},getVersion:()=>e,completeIfEmpty:()=>{t===0&&r?.("renderComplete",{id:i,aborted:!1})}}};var VI=new Set(["live","replace"]),eD=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),rD=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),WI=new Set(["single","sequence","composite"]),mf=new Set(["red","green","blue","alpha"]),zI=new Set(["max","min","multiply","add"]),iD=new Set(nx),ji=(r,t)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${t} must be an object.`)},Vs=(r,t)=>{if(typeof r!="string"||r.length===0)throw new Error(`${t} must be a non-empty string.`)},pf=(r,t)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${t} must be a number.`)},XI=(r,t)=>{ji(r,t);let e={};if(r.initialValue!==void 0&&(pf(r.initialValue,`${t}.initialValue`),e.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${t}.keyframes must be a non-empty array.`);return e.keyframes=r.keyframes.map((i,s)=>{let o=`${t}.keyframes[${s}]`;if(ji(i,o),pf(i.value,`${o}.value`),pf(i.duration,`${o}.duration`),i.easing!==void 0&&typeof i.easing!="string")throw new Error(`${o}.easing must be a string.`);if(i.easing!==void 0&&!iD.has(i.easing))throw new Error(`${o}.easing must be one of: ${nx.join(", ")}.`);if(i.relative!==void 0&&typeof i.relative!="boolean")throw new Error(`${o}.relative must be a boolean.`);return{value:i.value,duration:i.duration,easing:i.easing??"linear",...i.relative!==void 0?{relative:i.relative}:{}}}),e},jI=(r,t,e)=>{ji(r,t);let i=Object.entries(r).map(([s,o])=>{if(!e.has(s))throw new Error(`${t}.${s} is not a supported animation property.`);return[s,XI(o,`${t}.${s}`)]});if(i.length===0)throw new Error(`${t} must define at least one property.`);return Object.fromEntries(i)},sD=(r,t)=>{if(ji(r,t),Vs(r.texture,`${t}.texture`),r.channel!==void 0&&!mf.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(mf).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},oD=(r,t)=>{if(ji(r,t),!WI.has(r.kind))throw new Error(`${t}.kind must be one of: ${Array.from(WI).join(", ")}.`);let e={kind:r.kind};if(r.channel!==void 0){if(!mf.has(r.channel))throw new Error(`${t}.channel must be one of: ${Array.from(mf).join(", ")}.`);e.channel=r.channel}if(r.softness!==void 0&&(pf(r.softness,`${t}.softness`),e.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${t}.invert must be a boolean.`);e.invert=r.invert}if(r.progress!==void 0&&(e.progress=XI(r.progress,`${t}.progress`)),r.kind==="single"&&(Vs(r.texture,`${t}.texture`),e.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${t}.textures must be a non-empty array.`);e.textures=r.textures.map((i,s)=>(Vs(i,`${t}.textures[${s}]`),i)),r.sample!==void 0&&(Vs(r.sample,`${t}.sample`),e.sample=r.sample)}if(r.kind==="composite"){if(!zI.has(r.combine??"max"))throw new Error(`${t}.combine must be one of: ${Array.from(zI).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${t}.items must be a non-empty array.`);e.combine=r.combine??"max",e.items=r.items.map((i,s)=>sD(i,`${t}.items[${s}]`))}return e.progress||(e.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),e},$I=(r,t)=>{if(ji(r,t),r.mask!==void 0)throw new Error(`${t}.mask is not valid. Define mask on ${t}.`);let e={};if(r.tween!==void 0&&(e.tween=jI(r.tween,`${t}.tween`,rD)),Object.keys(e).length===0)throw new Error(`${t} must define tween.`);return e},nD=(r,t)=>{let e={};if(r.shader!==void 0)throw new Error(`${t}.shader is not supported.`);if(r.prev!==void 0&&(e.prev=$I(r.prev,`${t}.prev`)),r.next!==void 0&&(e.next=$I(r.next,`${t}.next`)),r.mask!==void 0&&(e.mask=oD(r.mask,`${t}.mask`)),e.prev===void 0&&e.next===void 0&&e.mask===void 0)throw new Error(`${t} must define prev, next, or mask.`);return e},zy=(r,t,e)=>{if(r!==void 0)throw new Error(`${t} ${e}`)},YI=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let t=r.map((i,s)=>{let o=`animations[${s}]`;if(ji(i,o),Vs(i.id,`${o}.id`),Vs(i.targetId,`${o}.targetId`),Vs(i.type,`${o}.type`),!VI.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(VI).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(ji(i.complete,`${o}.complete`),n.complete=i.complete),zy(i.operation,`${o}.operation`,"is no longer supported. Use `type: live | replace` instead."),zy(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),zy(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="live"){if(n.tween=jI(i.tween,`${o}.tween`,eD),i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(i.prev!==void 0)throw new Error(`${o}.prev is only valid for replace animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for replace animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for replace animations.`);if(i.shader!==void 0)throw new Error(`${o}.shader is not supported.`);return n}if(i.tween!==void 0)throw new Error(`${o}.tween is not valid for replace animations.`);if(i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let a=nD(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),e=new Map;for(let i of t){let s=e.get(i.targetId)??new Set;s.add(i.type),e.set(i.targetId,s)}for(let[i,s]of e)if(s.has("replace")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix live and replace types in the same state.`);return t};var $y=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let t={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};if(!Array.isArray(t.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(t.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(t.audio))throw new Error("Input error: `audio` must be an array.");return t.animations=YI(t.animations),t};var aD=r=>r.split("/").pop(),lD=r=>({name:"advancedBufferLoader",priority:2,bufferMap:r,load:async t=>{let e=t.startsWith("file:")?t:aD(t),i=r[e];if(!i)throw new Error(`Buffer not found for key: ${e}`);return{data:i.buffer,type:i.type,metadata:null,alias:e}},test:async t=>!t.startsWith("blob:"),testParse:async t=>!0,parse:async t=>{if(t instanceof M)return t;let e=new Blob([t.data],{type:t.type}),i=await createImageBitmap(e);return M.from(i)},unload:async t=>t.destroy(!0)}),hD=()=>{let r,t=AI(),e={elements:[],animations:[],audio:[]},i,s={animations:[],elements:[],audio:[],parsers:[]},o,n,a,l,h=!1,c,u,d,f,m=new Set,g,p=(T,C,A,P)=>{T.clear(),T.rect(0,0,C,A),T.fill(P??0)},b=T=>T?T.startsWith("audio/")?"audio":T.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(T)?"font":T.startsWith("video/")?"video":"texture":"texture",y=T=>{m.add(T)},_=()=>{for(let T of m)URL.revokeObjectURL(T);m.clear()},S=(T,C,A)=>{o&&o.registerHotkeys(A?.keyboard??{}),T.renderer.events.cursorStyles||(T.renderer.events.cursorStyles={}),T.renderer.events.cursorStyles.default||(T.renderer.events.cursorStyles.default="default"),T.renderer.events.cursorStyles.hover||(T.renderer.events.cursorStyles.hover="pointer");let P=C?.cursorStyles,R=A?.cursorStyles;Et(P,R)||(R?(R.default&&(T.renderer.events.cursorStyles.default=R.default,T.canvas.style.cursor=R.default),R.hover&&(T.renderer.events.cursorStyles.hover=R.hover)):P&&(T.renderer.events.cursorStyles.default="default",T.renderer.events.cursorStyles.hover="pointer"))},E=(T,C,A,P)=>{u&&u.abort(),u=new AbortController;let R=u.signal;a.reset(A.id),S(T,e.global,A.global),n.cancelAll(),Cl({app:T,parent:C,prevComputedTree:e.elements,nextComputedTree:A.elements,animations:A.animations,elementPlugins:s.elements,animationBus:n,completionTracker:a,eventHandler:P,signal:R}),n.flush(),bx({app:T,prevAudioTree:e.audio,nextAudioTree:A.audio,audioPlugins:s.audio}),e=A,a.completeIfEmpty(),h||(h=!0,l&&l())},w={rendererName:"pixi",get canvas(){return r.canvas},findElementByLabel:T=>r.stage.getChildByLabel(T,!0)??null,extractBase64:async T=>{let C=new ot(0,0,r.renderer.width,r.renderer.height);if(!T)return await r.renderer.extract.base64({target:r.stage,frame:C});let A=r.stage.getChildByLabel(T,!0);if(!A)throw new Error(`Element with label '${T}' not found`);return await r.renderer.extract.base64({target:A,frame:C})},assignStageEvent:(T,C)=>{r.stage.eventMode="static",r.stage.on(T,C)},init:async T=>{let{eventHandler:C,plugins:A,width:P,height:R,backgroundColor:I,debug:F=!1,onFirstRender:G}=T;l=G;let z=[];return A?.elements?.forEach(U=>{U?.parse&&z.push(PI({type:U.type,parse:U.parse}))}),s={animations:A?.animations??[],elements:A?.elements??[],audio:A?.audio??[],parsers:z},i=C,o=OI(C),a=HI(C),r=new _l,r.audioStage=t,await r.init({width:P,height:R,backgroundColor:I,preference:"webgl"}),r.debug=F,f=U=>{U.preventDefault()},r.canvas.addEventListener("contextmenu",f),g=new ce,g.label="__route_graphics_background__",p(g,P,R,I),r.stage.addChild(g),r.stage.width=P,r.stage.height=R,r.ticker.add(r.audioStage.tick),n=NI(),F?(d=U=>{U?.detail?.deltaMS&&n.tick(Number(U.detail.deltaMS))},window.addEventListener("snapShotKeyFrame",d)):r.ticker.add(U=>n.tick(U.deltaMS)),w},destroy:()=>{u&&(u.abort(),u=void 0),d&&(window.removeEventListener("snapShotKeyFrame",d),d=void 0),f&&r?.canvas&&(r.canvas.removeEventListener("contextmenu",f),f=void 0),o?.destroy(),fx(),n&&n.destroy(),r?.audioStage&&r.audioStage.destroy();let T=C=>{for(let A of C.children){let P=A.texture?.source?.resource;P instanceof HTMLVideoElement&&P.pause(),A.children&&T(A)}};r?.stage&&T(r.stage),r&&r.destroy(),g=void 0,c&&(L.remove(c),c=void 0),_()},loadAssets:async T=>{if(!T)throw new Error("assetBufferMap is required");let C={audio:{},font:{},video:{},texture:{}};for(let[I,F]of Object.entries(T)){let G=b(F.type);C[G][I]=F}await Promise.all(Object.entries(C.audio).map(([I,F])=>Xo.load(I,F.buffer))),await Promise.all(Object.entries(C.font).map(async([I,F])=>{let G=new Blob([F.buffer],{type:F.type}),z=URL.createObjectURL(G),U=new FontFace(I,`url(${z})`);try{await U.load(),document.fonts.add(U)}catch($){console.error(`Failed to load font ${I}:`,$)}finally{URL.revokeObjectURL(z)}})),c?Object.assign(c.bufferMap,C.texture):(c=lD(C.texture),L.add({name:"advanced-buffer-loader",extension:v.Asset,priority:ge.High,loader:c}),typeof Sr.registerPlugin=="function"&&Sr.registerPlugin(c));let A=Object.entries(C.video).map(([I,F])=>{let G=new Blob([F.buffer],{type:F.type}),z=URL.createObjectURL(G);return y(z),Sr.load({alias:I,src:z,loadParser:"loadVideo"}).catch(U=>{throw m.delete(z),URL.revokeObjectURL(z),U})}),R=Object.keys(C.texture).map(I=>Sr.load(I));return Promise.all([...R,...A])},loadAudioAssets:async T=>Promise.all(T.map(async C=>{let P=await(await fetch(C)).arrayBuffer();return Xo.load(C,P)})),updatedBackgroundColor:T=>{r.renderer.background.color=T,g&&p(g,r.renderer.width,r.renderer.height,T)},render:T=>{let C=$y(T),A=Dy({JSONObject:C.elements,parserPlugins:s.parsers}),P={...C,elements:A};E(r,r.stage,P,i)},parse:T=>{let C=$y(T),A=Dy({JSONObject:C.elements,parserPlugins:s.parsers});return{...C,elements:A}}};return w},qI=hD;var ZEt=qI;export{_l as Application,Sr as Assets,Xo as AudioAsset,hG as animatedSpritePlugin,Zk as containerPlugin,rx as createAnimationPlugin,sB as createAssetBufferManager,ix as createAudioPlugin,ue as createElementPlugin,ZEt as default,xG as particlesPlugin,Ck as rectPlugin,bx as renderAudio,Cl as renderElements,Bk as sliderPlugin,dG as soundPlugin,Rk as spritePlugin,Pk as textPlugin,lG as textRevealingPlugin,cG as tweenPlugin,Ik as videoPlugin}; +`))}}var uV=0,Ep={textureCount:0,uboCount:0},us=class{constructor(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=uV++}systemCheck(){if(!bp())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(e){this.gl=e,this.reset()}bind(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;let i=e.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),t||(Ep.textureCount=0,Ep.uboCount=0,this.syncUniformGroup(e.uniformGroup,Ep)),s}setUniforms(e){let t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,t){let i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))}syncUniforms(e,t,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){let t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=ab(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){let i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;let s=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,t);e.buffer.update(),s(i.uniformData,e.uniforms,this.renderer,Ep,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])}createSyncBufferGroup(e,t,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);let o=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(t.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(e,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=gb(e,this.shader.program.uniformData)),e.autoManage){let l=new Float32Array(a.size/4);e.buffer.update(l)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),t[n]&&o.push(t[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){let t=this.gl,i=e.program,s=mb(t,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};us.extension={type:$.RendererSystem,name:"shader"};Z.add(us);var Bi=class{constructor(e){this.renderer=e}run(e){let{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.4.3 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}};Bi.defaultOptions={hello:!1},Bi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"startup"};Z.add(Bi);function dF(r,e=[]){return e[re.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.ADD]=[r.ONE,r.ONE],e[re.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.NONE]=[0,0],e[re.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[re.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[re.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[re.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[re.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[re.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[re.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[re.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[re.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[re.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}var hV=0,dV=1,fV=2,pV=3,mV=4,gV=5,fF=class xb{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=re.NONE,this._blendEq=!1,this.map=[],this.map[hV]=this.setBlend,this.map[dV]=this.setOffset,this.map[fV]=this.setCullFace,this.map[pV]=this.setDepthTest,this.map[mV]=this.setFrontFace,this.map[gV]=this.setDepthMask,this.checks=[],this.defaultState=new oi,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=dF(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<>1,i++;this.stateId=e.data}for(let t=0;te.systems[s]),i=[...t,...Object.keys(e.systems).filter(s=>!t.includes(s))];for(let s of i)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(t=>{this.runners[t]=new rt(t)})}addSystem(e,t){let i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(e,t){let i=Object.keys(this._systemsHash);e.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[e.name](t[o])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}};var nu=class Ap{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Ap.defaultMaxIdle,this.checkCountMax=Ap.defaultCheckCountMax,this.mode=Ap.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Df.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this.renderer.texture,t=e.managedTextures,i=!1;for(let s=0;sthis.maxIdle&&(e.destroyTexture(o,!0),t[s]=null,i=!0)}if(i){let s=0;for(let o=0;o=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};nu.defaultMode=Df.AUTO,nu.defaultMaxIdle=60*60,nu.defaultCheckCountMax=60*10,nu.extension={type:$.RendererSystem,name:"textureGC"};var li=nu;Z.add(li);var uo=class{constructor(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=ae.UNSIGNED_BYTE,this.internalFormat=H.RGBA,this.samplerType=0}};function pF(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.R8]:z.FLOAT,[r.R8_SNORM]:z.FLOAT,[r.RG8]:z.FLOAT,[r.RG8_SNORM]:z.FLOAT,[r.RGB8]:z.FLOAT,[r.RGB8_SNORM]:z.FLOAT,[r.RGB565]:z.FLOAT,[r.RGBA4]:z.FLOAT,[r.RGB5_A1]:z.FLOAT,[r.RGBA8]:z.FLOAT,[r.RGBA8_SNORM]:z.FLOAT,[r.RGB10_A2]:z.FLOAT,[r.RGB10_A2UI]:z.FLOAT,[r.SRGB8]:z.FLOAT,[r.SRGB8_ALPHA8]:z.FLOAT,[r.R16F]:z.FLOAT,[r.RG16F]:z.FLOAT,[r.RGB16F]:z.FLOAT,[r.RGBA16F]:z.FLOAT,[r.R32F]:z.FLOAT,[r.RG32F]:z.FLOAT,[r.RGB32F]:z.FLOAT,[r.RGBA32F]:z.FLOAT,[r.R11F_G11F_B10F]:z.FLOAT,[r.RGB9_E5]:z.FLOAT,[r.R8I]:z.INT,[r.R8UI]:z.UINT,[r.R16I]:z.INT,[r.R16UI]:z.UINT,[r.R32I]:z.INT,[r.R32UI]:z.UINT,[r.RG8I]:z.INT,[r.RG8UI]:z.UINT,[r.RG16I]:z.INT,[r.RG16UI]:z.UINT,[r.RG32I]:z.INT,[r.RG32UI]:z.UINT,[r.RGB8I]:z.INT,[r.RGB8UI]:z.UINT,[r.RGB16I]:z.INT,[r.RGB16UI]:z.UINT,[r.RGB32I]:z.INT,[r.RGB32UI]:z.UINT,[r.RGBA8I]:z.INT,[r.RGBA8UI]:z.UINT,[r.RGBA16I]:z.INT,[r.RGBA16UI]:z.UINT,[r.RGBA32I]:z.INT,[r.RGBA32UI]:z.UINT,[r.DEPTH_COMPONENT16]:z.FLOAT,[r.DEPTH_COMPONENT24]:z.FLOAT,[r.DEPTH_COMPONENT32F]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT,[r.DEPTH24_STENCIL8]:z.FLOAT,[r.DEPTH32F_STENCIL8]:z.FLOAT}:e={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT},e}function mF(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[ae.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA8,[H.RGB]:r.RGB8,[H.RG]:r.RG8,[H.RED]:r.R8,[H.RGBA_INTEGER]:r.RGBA8UI,[H.RGB_INTEGER]:r.RGB8UI,[H.RG_INTEGER]:r.RG8UI,[H.RED_INTEGER]:r.R8UI,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ae.BYTE]:{[H.RGBA]:r.RGBA8_SNORM,[H.RGB]:r.RGB8_SNORM,[H.RG]:r.RG8_SNORM,[H.RED]:r.R8_SNORM,[H.RGBA_INTEGER]:r.RGBA8I,[H.RGB_INTEGER]:r.RGB8I,[H.RG_INTEGER]:r.RG8I,[H.RED_INTEGER]:r.R8I},[ae.UNSIGNED_SHORT]:{[H.RGBA_INTEGER]:r.RGBA16UI,[H.RGB_INTEGER]:r.RGB16UI,[H.RG_INTEGER]:r.RG16UI,[H.RED_INTEGER]:r.R16UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ae.SHORT]:{[H.RGBA_INTEGER]:r.RGBA16I,[H.RGB_INTEGER]:r.RGB16I,[H.RG_INTEGER]:r.RG16I,[H.RED_INTEGER]:r.R16I},[ae.UNSIGNED_INT]:{[H.RGBA_INTEGER]:r.RGBA32UI,[H.RGB_INTEGER]:r.RGB32UI,[H.RG_INTEGER]:r.RG32UI,[H.RED_INTEGER]:r.R32UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ae.INT]:{[H.RGBA_INTEGER]:r.RGBA32I,[H.RGB_INTEGER]:r.RGB32I,[H.RG_INTEGER]:r.RG32I,[H.RED_INTEGER]:r.R32I},[ae.FLOAT]:{[H.RGBA]:r.RGBA32F,[H.RGB]:r.RGB32F,[H.RG]:r.RG32F,[H.RED]:r.R32F,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ae.HALF_FLOAT]:{[H.RGBA]:r.RGBA16F,[H.RGB]:r.RGB16F,[H.RG]:r.RG16F,[H.RED]:r.R16F},[ae.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB565},[ae.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA4},[ae.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGB5_A1},[ae.UNSIGNED_INT_2_10_10_10_REV]:{[H.RGBA]:r.RGB10_A2,[H.RGBA_INTEGER]:r.RGB10_A2UI},[ae.UNSIGNED_INT_10F_11F_11F_REV]:{[H.RGB]:r.R11F_G11F_B10F},[ae.UNSIGNED_INT_5_9_9_9_REV]:{[H.RGB]:r.RGB9_E5},[ae.UNSIGNED_INT_24_8]:{[H.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ae.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[H.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:e={[ae.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA,[H.RGB]:r.RGB,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ae.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB},[ae.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA},[ae.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGBA}},e}var la=class{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xe,this.hasIntegerTextures=!1}contextChange(){let e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=mF(e),this.samplerTypes=pF(e);let t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s=0;--o){let n=t[o];n&&n._glTextures[s].samplerType!==z.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(e){let t=new uo(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t}initTextureType(e,t){t.internalFormat=this.internalFormats[e.type]?.[e.format]??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??z.FLOAT,this.webGLVersion===2&&e.type===ae.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){let t=e._glTextures[this.CONTEXT_UID];if(!t)return;let i=this.renderer;if(this.initTextureType(e,t),e.resource?.upload(i,e,t))t.samplerType!==z.FLOAT&&(this.hasIntegerTextures=!0);else{let s=e.realWidth,o=e.realHeight,n=i.gl;(t.width!==s||t.height!==o||t.dirtyId<0)&&(t.width=s,t.height=o,n.texImage2D(e.target,0,t.internalFormat,s,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){let{gl:i}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){let s=this.managedTextures.indexOf(e);s!==-1&&j_(this.managedTextures,s,1)}}updateTextureStyle(e){let t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Fr.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=wc.CLAMP:t.wrapMode=e.wrapMode,e.resource?.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){let i=this.gl;if(t.mipmap&&e.mipmap!==Fr.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===vr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===vr.LINEAR){let o=Math.min(e.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===vr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===vr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};la.extension={type:$.RendererSystem,name:"texture"};Z.add(la);var ca=class{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){let{gl:i,renderer:s}=this;t&&s.shader.bind(t),i.beginTransformFeedback(e)}endTransformFeedback(){let{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){let{gl:t,renderer:i,CONTEXT_UID:s}=this,o=t.createTransformFeedback();e._glTransformFeedbacks[s]=o,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,o);for(let n=0;n(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(ho||{});var ua=class{constructor(e,t=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=s}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));let t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let t=this.next;return this.next=e?null:t,this.previous=null,t}};var gF=class cr{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new ua(null,null,1/0),this.deltaMS=1/cr.targetFPMS,this.elapsedMS=1/cr.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,i=ho.NORMAL){return this._addListener(new ua(e,t,i))}addOnce(e,t,i=ho.NORMAL){return this._addListener(new ua(e,t,i,!0))}_addListener(e){let t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,t){let i=this._head.next;for(;i;)i.match(e,t)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){let o=e-this._lastFrame|0;if(o{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Er.shared:new Er,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};au.extension=$.Application;Z.add(au);var xV=[];Z.handleByList($.Renderer,xV);var lu=class{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){let i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{let i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=Pe.HIGH?this.multisample=Pe.HIGH:t>=Pe.MEDIUM?this.multisample=Pe.MEDIUM:t>=Pe.LOW?this.multisample=Pe.LOW:this.multisample=Pe.NONE}destroy(){}};lu.extension={type:$.RendererSystem,name:"_multisample"};Z.add(lu);var Pp=class{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var cu=class{constructor(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);t.bindBuffer(e.type,s.buffer)}unbind(e){let{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[t]!==e){let o=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,o.buffer)}}bindBufferRange(e,t,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=e._glBuffers[o]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,n.buffer,i*256,256)}update(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,t.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{let o=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,o)}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];let i=e._glBuffers[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this),i&&(t||s.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){let t=Object.keys(this.managedBuffers);for(let i=0;it.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{let{realWidth:t,realHeight:i}=this.items[0];return this.resize(t,i),this.update(),Promise.resolve(this)}),this._load}};var hu=class extends hs{constructor(e,t){let{width:i,height:s}=t||{},o,n;Array.isArray(e)?(o=e,n=e.length):n=e,super(n,{width:i,height:s}),o&&this.initFromArray(o,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=wi.TEXTURE_2D_ARRAY}upload(e,t,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=e;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,t.format,i.type,null);for(let l=0;l0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=wi.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,i){let s=this.itemDirtyIds;for(let o=0;o{if(this.url===null){e(this);return}try{let i=await K.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===or.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),e(this)}catch(i){if(this.destroyed)return;t(i),this.onError.emit(i)}}),this._load)}upload(e,t,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof e=="string"||e instanceof ImageBitmap)}static get EMPTY(){return r._EMPTY=r._EMPTY??K.ADAPTER.createCanvas(0,0),r._EMPTY}};var vb=class Rp extends pt{constructor(e,t){t=t||{},super(K.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},Rp.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let e=new Image;pt.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;let t=e.width,i=e.height;if(!t||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=t*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*t,o=this._overrideHeight||this._overrideWidth/t*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${Ai()}`,n.getContext("2d").drawImage(e,0,0,t,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(e){let t=Rp.SVG_SIZE.exec(e),i={};return t&&(i[t[1]]=Math.round(parseFloat(t[3])),i[t[5]]=Math.round(parseFloat(t[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&Rp.SVG_XML.test(e)}};vb.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var Tb=vb;var Ip=class extends pt{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}};var Sb=class wb extends pt{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){let i=document.createElement("video");t.autoLoad!==!1&&i.setAttribute("preload","auto"),t.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),t.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),t.loop===!0&&i.setAttribute("loop",""),t.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);let s=e[0].src||e[0];pt.crossOrigin(i,s,t.crossorigin);for(let o=0;o{this.valid?t(this):(this._resolve=t,this._reject=i,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.source;return!e.paused&&!e.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);let t=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!t&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._configureAutoUpdate();let e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(Er.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Er.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Er.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||wb.TYPES.includes(t)}};Sb.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Sb.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var Eb=Sb;Dc.push(pu,no,du,Eb,Ip,Tb,Qs,bb,hu);var yV={vec3(r,e,t,i){(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2])&&(t[0]=i[0],t[1]=i[1],t[2]=i[2],r.uniform3f(e,i[0],i[1],i[2]))},int(r,e,t,i){r.uniform1i(e,i)},ivec2(r,e,t,i){r.uniform2i(e,i[0],i[1])},ivec3(r,e,t,i){r.uniform3i(e,i[0],i[1],i[2])},ivec4(r,e,t,i){r.uniform4i(e,i[0],i[1],i[2],i[3])},uint(r,e,t,i){r.uniform1ui(e,i)},uvec2(r,e,t,i){r.uniform2ui(e,i[0],i[1])},uvec3(r,e,t,i){r.uniform3ui(e,i[0],i[1],i[2])},uvec4(r,e,t,i){r.uniform4ui(e,i[0],i[1],i[2],i[3])},bvec2(r,e,t,i){r.uniform2i(e,i[0],i[1])},bvec3(r,e,t,i){r.uniform3i(e,i[0],i[1],i[2])},bvec4(r,e,t,i){r.uniform4i(e,i[0],i[1],i[2],i[3])},mat2(r,e,t,i){r.uniformMatrix2fv(e,!1,i)},mat4(r,e,t,i){r.uniformMatrix4fv(e,!1,i)}},_V={float(r,e,t,i){r.uniform1fv(e,i)},vec2(r,e,t,i){r.uniform2fv(e,i)},vec3(r,e,t,i){r.uniform3fv(e,i)},vec4(r,e,t,i){r.uniform4fv(e,i)},int(r,e,t,i){r.uniform1iv(e,i)},ivec2(r,e,t,i){r.uniform2iv(e,i)},ivec3(r,e,t,i){r.uniform3iv(e,i)},ivec4(r,e,t,i){r.uniform4iv(e,i)},uint(r,e,t,i){r.uniform1uiv(e,i)},uvec2(r,e,t,i){r.uniform2uiv(e,i)},uvec3(r,e,t,i){r.uniform3uiv(e,i)},uvec4(r,e,t,i){r.uniform4uiv(e,i)},bool(r,e,t,i){r.uniform1iv(e,i)},bvec2(r,e,t,i){r.uniform2iv(e,i)},bvec3(r,e,t,i){r.uniform3iv(e,i)},bvec4(r,e,t,i){r.uniform4iv(e,i)},sampler2D(r,e,t,i){r.uniform1iv(e,i)},samplerCube(r,e,t,i){r.uniform1iv(e,i)},sampler2DArray(r,e,t,i){r.uniform1iv(e,i)}};function yF(r,e,t,i,s){let o=0,n=null,a=null,l=s.gl;for(let c in r.uniforms){let u=e[c],h=i[c],d=t[c],f=r.uniforms[c];if(!u){f.group===!0&&s.shader.syncUniformGroup(h);continue}u.type==="float"&&u.size===1&&!u.isArray?h!==d.value&&(d.value=h,l.uniform1f(d.location,h)):u.type==="bool"&&u.size===1&&!u.isArray?h!==d.value&&(d.value=h,l.uniform1i(d.location,Number(h))):(u.type==="sampler2D"||u.type==="samplerCube"||u.type==="sampler2DArray")&&u.size===1&&!u.isArray?(s.texture.bind(h,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):u.type==="mat3"&&u.size===1&&!u.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,h.toArray(!0)):l.uniformMatrix3fv(d.location,!1,h):u.type==="vec2"&&u.size===1&&!u.isArray?f.x!==void 0?(a=d.value,n=h,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,l.uniform2f(d.location,n.x,n.y))):(a=d.value,n=h,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):u.type==="vec4"&&u.size===1&&!u.isArray?f.width!==void 0?(a=d.value,n=h,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,l.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=h,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],l.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(u.size===1&&!u.isArray?yV:_V)[u.type].call(null,l,d.location,d.value,h)}}function bV(){Object.assign(us.prototype,{systemCheck(){},syncUniforms(r,e){let{shader:t,renderer:i}=this;yF(r,t.program.uniformData,e.uniformData,r.uniforms,i)}})}bV();var mu=new(window.AudioContext||window.webkitAudioContext),vV=(r,e)=>{let t,i=mu.createGain();i.gain.value=e.volume??1,i.connect(mu.destination);let s={id:r,url:e.url,loop:e.loop||!1,volume:e.volume??1};return{play:()=>{let m=yn.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}t=mu.createBufferSource(),t.buffer=m,t.loop=s.loop,i.gain.setValueAtTime(s.volume,mu.currentTime),t.connect(i),t.start(0)},stop:()=>{t&&(t.stop(),t.disconnect(),i.disconnect(),i.connect(mu.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,i.gain.value=m},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},_F=()=>{let r=[],e=[];return{add:a=>{e.push(a)},remove:a=>{e=e.filter(l=>l.id!==a)},getById:a=>e.find(l=>l.id===a),tick:()=>{for(let l of e){let c=r.find(u=>u.id===l.id);if(!c){let u=vV(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(u),u.play();continue}(c.url!==l.url||c.loop!==l.loop)&&(c.stop(),c.setUrl(l.url),c.setLoop(l.loop??!1),c.play()),c.getVolume()!==(l.volume??1)&&c.setVolume(l.volume??1)}let a=[];for(let l of r)e.find(c=>c.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],e=[]}}};var TV=({JSONObject:r,parserPlugins:e=[]})=>r.map(i=>{let s=e.find(o=>o.type===i.type);if(!s)throw new Error(`No parser plugin found for element type: ${i.type} (id: ${i.id??"unknown"})`);return s.parse({state:i,parserPlugins:e})});var Ab=TV;var bF=({type:r,parse:e})=>({type:r,parse:e});var Pb=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Cb(r,e,t,i){r.addEventListener?r.addEventListener(e,t,i):r.attachEvent&&r.attachEvent(`on${e}`,t)}function gu(r,e,t,i){r&&(r.removeEventListener?r.removeEventListener(e,t,i):r.detachEvent&&r.detachEvent(`on${e}`,t))}function SF(r,e){let t=e.slice(0,e.length-1),i=[];for(let s=0;s=0;)e[t-1]+=",",e.splice(t,1),t=e.lastIndexOf("");return e}function SV(r,e){let t=r.length>=e.length?r:e,i=r.length>=e.length?e:r,s=!0;for(let o=0;o_u[r.toLowerCase()]||Lr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),wV=r=>Object.keys(_u).find(e=>_u[e]===r),EV=r=>Object.keys(Lr).find(e=>Lr[e]===r),PF=r=>{AF=r||"all"},bu=()=>AF||"all",AV=()=>ze.slice(0),PV=()=>ze.map(r=>wV(r)||EV(r)||String.fromCharCode(r)),CV=()=>{let r=[];return Object.keys(qe).forEach(e=>{qe[e].forEach(({key:t,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:t.split("+").map(n=>ha(n))})})}),r},CF=r=>{let e=r.target||r.srcElement,{tagName:t}=e,i=!0,s=t==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(e.type);return(e.isContentEditable||(s||t==="TEXTAREA"||t==="SELECT")&&!e.readOnly)&&(i=!1),i},MV=r=>(typeof r=="string"&&(r=ha(r)),ze.indexOf(r)!==-1),RV=(r,e)=>{let t,i;r||(r=bu());for(let s in qe)if(Object.prototype.hasOwnProperty.call(qe,s))for(t=qe[s],i=0;iRb(o)):i++;bu()===r&&PF(e||"all")};function IV(r){let e=EF(r);r.key&&r.key.toLowerCase()==="capslock"&&(e=ha(r.key));let t=ze.indexOf(e);if(t>=0&&ze.splice(t,1),r.key&&r.key.toLowerCase()==="meta"&&ze.splice(0,ze.length),(e===93||e===224)&&(e=91),e in At){At[e]=!1;for(let i in Lr)Lr[i]===e&&(ur[i]=!1)}}var MF=(r,...e)=>{if(typeof r>"u")Object.keys(qe).forEach(t=>{Array.isArray(qe[t])&&qe[t].forEach(i=>Bp(i)),delete qe[t]}),Rb(null);else if(Array.isArray(r))r.forEach(t=>{t.key&&Bp(t)});else if(typeof r=="object")r.key&&Bp(r);else if(typeof r=="string"){let[t,i]=e;typeof t=="function"&&(i=t,t=""),Bp({key:r,scope:t,method:i,splitKey:"+"})}},Bp=({key:r,scope:e,method:t,splitKey:i="+"})=>{wF(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":ha(a);if(!qe[l])return;e||(e=bu());let c=n>1?SF(Lr,o):[],u=[];qe[l]=qe[l].filter(h=>{let d=(t?h.method===t:!0)&&h.scope===e&&SV(h.mods,c);return d&&u.push(h.element),!d}),u.forEach(h=>Rb(h))})};function vF(r,e,t,i){if(e.element!==i)return;let s;if(e.scope===t||e.scope==="all"){s=e.mods.length>0;for(let o in At)Object.prototype.hasOwnProperty.call(At,o)&&(!At[o]&&e.mods.indexOf(+o)>-1||At[o]&&e.mods.indexOf(+o)===-1)&&(s=!1);(e.mods.length===0&&!At[16]&&!At[18]&&!At[17]&&!At[91]||s||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(ze),e.method(r,e)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function TF(r,e){let t=qe["*"],i=EF(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(ur.filter||CF).call(this,r))return;if((i===93||i===224)&&(i=91),ze.indexOf(i)===-1&&i!==229&&ze.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=xu[a];r[a]&&ze.indexOf(l)===-1?ze.push(l):!r[a]&&ze.indexOf(l)>-1?ze.splice(ze.indexOf(l),1):a==="metaKey"&&r[a]&&(ze=ze.filter(c=>c in xu||c===i))}),i in At){At[i]=!0;for(let a in Lr)if(Object.prototype.hasOwnProperty.call(Lr,a)){let l=xu[Lr[a]];ur[a]=r[l]}if(!t)return}for(let a in At)Object.prototype.hasOwnProperty.call(At,a)&&(At[a]=r[xu[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(ze.indexOf(17)===-1&&ze.push(17),ze.indexOf(18)===-1&&ze.push(18),At[17]=!0,At[18]=!0);let s=bu();if(t)for(let a=0;a1&&(s=SF(Lr,f));let p=f[f.length-1];p=p==="*"?"*":ha(p),p in qe||(qe[p]=[]),qe[p].push({keyup:l,keydown:c,scope:o,mods:s,shortcut:i[a],method:t,key:i[a],splitKey:u,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!Fi.has(n)){let f=(m=window.event)=>TF(m,n),p=(m=window.event)=>{TF(m,n),IV(m)};Fi.set(n,{keydownListener:f,keyupListenr:p,capture:h}),Cb(n,"keydown",f,h),Cb(n,"keyup",p,h)}if(!yu){let f=()=>{ze=[]};yu={listener:f,capture:h},Cb(window,"focus",f,h)}}};function BV(r,e="all"){Object.keys(qe).forEach(t=>{qe[t].filter(i=>i.scope===e&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function Rb(r){let e=Object.values(qe).flat();if(e.findIndex(({element:t})=>t===r)<0&&r){let{keydownListener:t,keyupListenr:i,capture:s}=Fi.get(r)||{};t&&i&&(gu(r,"keyup",i,s),gu(r,"keydown",t,s),Fi.delete(r))}if((e.length<=0||Fi.size<=0)&&(Array.from(Fi.keys()).forEach(t=>{let{keydownListener:i,keyupListenr:s,capture:o}=Fi.get(t)||{};i&&s&&(gu(t,"keyup",s,o),gu(t,"keydown",i,o),Fi.delete(t))}),Fi.clear(),Object.keys(qe).forEach(t=>delete qe[t]),yu)){let{listener:t,capture:i}=yu;gu(window,"focus",t,i),yu=null}}var Mb={getPressedKeyString:PV,setScope:PF,getScope:bu,deleteScope:RV,getPressedKeyCodes:AV,getAllKeyCodes:CV,isPressed:MV,filter:CF,trigger:BV,unbind:MF,keyMap:_u,modifier:Lr,modifierMap:xu};for(let r in Mb){let e=r;Object.prototype.hasOwnProperty.call(Mb,e)&&(ur[e]=Mb[e])}if(typeof window<"u"){let r=window.hotkeys;ur.noConflict=e=>(e&&window.hotkeys===ur&&(window.hotkeys=r),ur),window.hotkeys=ur}var kV=Object.prototype.hasOwnProperty,RF=r=>{let e=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let c=e.get(l);c?pe(c.payload,s[l].payload)||(n.push(l),ur.unbind(l)):o.push(l)}),e.forEach((l,c)=>{kV.call(s,c)||a.push(c)}),a.forEach(l=>{ur.unbind(l),e.delete(l)}),[...o,...n].forEach(l=>{let u=s[l].payload??{};ur(l,()=>{r&&r("keydown",{_event:{key:l},...u})}),e.set(l,{value:l,payload:u})})},destroy:()=>{for(let s of e.keys())ur.unbind(s);e.clear()}}};var BF=(r,e)=>typeof e!="string"?e:r[e]??e,FV=(r,e,t,i)=>{let s=BF(t,e);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},IF=(r,e,t,i)=>{let s=BF(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n{if(!r||!Object.prototype.hasOwnProperty.call(r,e))throw new Error(`Animation "${t}" cannot auto-resolve property "${e}" from targetState.`);return r[e]},UV=(r,e,t,i,s)=>Object.entries(e).map(([o,n])=>{if(!Cd[o])throw new Error(`${o} is not a supported property for animation.`);let a=FV(r,o,t,0);if(n.auto){let u=OV(i,o,s);if(a===u)return null;let h=Mn([{value:a},{duration:n.auto.duration,value:u,easing:n.auto.easing}]);return{property:o,timeline:h}}let l=n.initialValue??a,c=Mn([{value:l},...n.keyframes]);return{property:o,timeline:c}}).filter(Boolean),kF=()=>{let r=[],e=new Map,t=new Map,i=0,s=null,o=!1,n=(M,F)=>Math.min(Math.max(M,0),Math.max(F??0,0)),a=(M,F)=>{let O=n(F,M.duration);return M.currentTime=O,M.applyFrame(O),O>=M.duration},l=(M,F)=>{t.get(M)?.forEach(O=>{try{O(F)}catch{}})},c=M=>{if(l("completed",{id:M.id}),M.onComplete)try{M.onComplete()}catch{}},u=M=>{M.applyFrame(0),e.set(M.id,M);let F=s!==null&&a(M,s);l("started",{id:M.id}),F&&(c(M),e.delete(M.id))},h=M=>{let{id:F,element:O,properties:D,targetState:N,onComplete:L,onCancel:Y,propertyPathMap:ue=Md}=M,J=UV(O,D,ue,N,F);if(J.length===0){c({id:F,onComplete:L});return}let Be={id:F,kind:"property",element:O,timelines:J,duration:mc(J),currentTime:0,stateVersion:i,targetState:N,onComplete:L,onCancel:Y,applyFrame:ke=>{for(let{property:Me,timeline:$e}of J){let it=gc($e,ke);try{IF(O,Me,ue,it)}catch{}}},applyTargetState:()=>{if(!(!O||O.destroyed)){if(N===null){O.destroy();return}if(N)for(let[ke,Me]of Object.entries(N))try{IF(O,ke,ue,Me)}catch{}}},isValid:()=>!!O&&!O.destroyed};u(Be)},d=M=>{let F={id:M.id,kind:"custom",duration:M.duration??0,currentTime:0,stateVersion:i,onComplete:M.onComplete,onCancel:M.onCancel,applyFrame:M.applyFrame??(()=>{}),applyTargetState:M.applyTargetState??(()=>{}),isValid:M.isValid??(()=>!0)};u(F)},f=M=>{if(M.driver==="custom"){d(M);return}h(M)},p=M=>{try{M.applyTargetState?.()}catch{}if(M.onCancel)try{M.onCancel()}catch{}},m=M=>{switch(M.type){case"START":f(M.payload);break;case"CANCEL":v(M.id);break}},g=()=>{let M=r.splice(0);for(let F of M)m(F)},_=()=>{s===null||o||(o=!0,queueMicrotask(()=>{o=!1,s!==null&&g()}))},v=M=>{let F=e.get(M);F&&(p(F),e.delete(M),l("cancelled",{id:M}))},x=M=>{r.push(M),_()},T=()=>{for(let[M,F]of e)p(F),l("cancelled",{id:M});e.clear(),i++},b=M=>{g();let F=[];for(let[O,D]of e){if(D.stateVersion!==i){F.push(O);continue}if(!D.isValid()){F.push(O);continue}if(D.currentTime+=M,D.currentTime>=D.duration){D.applyFrame(D.duration),c(D),F.push(O);continue}D.applyFrame(D.currentTime)}for(let O of F)e.delete(O)},w=M=>{s=M,g();let F=[];for(let[O,D]of e){if(D.stateVersion!==i){F.push(O);continue}if(!D.isValid()){F.push(O);continue}a(D,M)&&(c(D),F.push(O))}for(let O of F)e.delete(O)},E=()=>{s=null},I=()=>{g()},B=(M,F)=>(t.has(M)||t.set(M,new Set),t.get(M).add(F),()=>C(M,F)),C=(M,F)=>{t.get(M)?.delete(F)};return{dispatch:x,cancelAll:T,flush:I,tick:b,setTime:w,clearTime:E,on:B,off:C,getState:()=>({stateVersion:i,activeCount:e.size,animations:Array.from(e.entries()).map(([M,F])=>({id:M,currentTime:F.currentTime,duration:F.duration,progress:F.duration>0?F.currentTime/F.duration:0}))}),isAnimating:M=>e.has(M),destroy:()=>{T(),t.clear()}}};var FF=r=>{let e=0,t=0,i=null,s=!1,o=!1,n=d=>{o||(o=!0,r?.("renderComplete",d))};return{reset:d=>{e>0&&i!==null&&!o&&r?.("renderComplete",{id:i,aborted:!0}),t++,e=0,i=d,s=!0,o=!1},track:d=>{d===t&&e++},complete:d=>{d!==t||e===0||(e--,e===0&&!s&&n({id:i,aborted:!1}))},getVersion:()=>t,completeIfEmpty:()=>{s=!1,e===0&&n({id:i,aborted:!1})}}};var OF=new Set(["update","transition"]),GV=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),LV=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),UF=new Set(["single","sequence","composite"]),kp=new Set(["red","green","blue","alpha"]),GF=new Set(["max","min","multiply","add"]),DF=new Set(nf),ci=(r,e)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${e} must be an object.`)},fo=(r,e)=>{if(typeof r!="string"||r.length===0)throw new Error(`${e} must be a non-empty string.`)},vu=(r,e)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${e} must be a number.`)},DV=(r,e)=>{if(ci(r,e),vu(r.duration,`${e}.duration`),r.easing!==void 0&&typeof r.easing!="string")throw new Error(`${e}.easing must be a string.`);if(r.easing!==void 0&&!DF.has(r.easing))throw new Error(`${e}.easing must be one of: ${nf.join(", ")}.`);return{duration:r.duration,easing:r.easing??"linear"}},Bb=(r,e)=>{ci(r,e);let t={};if(r.initialValue!==void 0&&(vu(r.initialValue,`${e}.initialValue`),t.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${e}.keyframes must be a non-empty array.`);return t.keyframes=r.keyframes.map((i,s)=>{let o=`${e}.keyframes[${s}]`;if(ci(i,o),vu(i.value,`${o}.value`),vu(i.duration,`${o}.duration`),i.easing!==void 0&&typeof i.easing!="string")throw new Error(`${o}.easing must be a string.`);if(i.easing!==void 0&&!DF.has(i.easing))throw new Error(`${o}.easing must be one of: ${nf.join(", ")}.`);if(i.relative!==void 0&&typeof i.relative!="boolean")throw new Error(`${o}.relative must be a boolean.`);return{value:i.value,duration:i.duration,easing:i.easing??"linear",...i.relative!==void 0?{relative:i.relative}:{}}}),t},NV=(r,e)=>{ci(r,e);let t=r.keyframes!==void 0,i=r.auto!==void 0;if(t&&i)throw new Error(`${e} cannot define both keyframes and auto.`);if(!t&&!i)throw new Error(`${e} must define keyframes or auto.`);if(i){if(r.initialValue!==void 0)throw new Error(`${e}.initialValue is not valid when auto is defined.`);return{auto:DV(r.auto,`${e}.auto`)}}return Bb(r,e)},NF=(r,e,t,i=Bb)=>{ci(r,e);let s=Object.entries(r).map(([o,n])=>{if(!t.has(o))throw new Error(`${e}.${o} is not a supported animation property.`);return[o,i(n,`${e}.${o}`)]});if(s.length===0)throw new Error(`${e} must define at least one property.`);return Object.fromEntries(s)},HV=(r,e)=>{if(ci(r,e),fo(r.texture,`${e}.texture`),r.channel!==void 0&&!kp.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(kp).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},VV=(r,e)=>{if(ci(r,e),!UF.has(r.kind))throw new Error(`${e}.kind must be one of: ${Array.from(UF).join(", ")}.`);let t={kind:r.kind};if(r.channel!==void 0){if(!kp.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(kp).join(", ")}.`);t.channel=r.channel}if(r.softness!==void 0&&(vu(r.softness,`${e}.softness`),t.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);t.invert=r.invert}if(r.progress!==void 0&&(t.progress=Bb(r.progress,`${e}.progress`)),r.kind==="single"&&(fo(r.texture,`${e}.texture`),t.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${e}.textures must be a non-empty array.`);t.textures=r.textures.map((i,s)=>(fo(i,`${e}.textures[${s}]`),i)),r.sample!==void 0&&(fo(r.sample,`${e}.sample`),t.sample=r.sample)}if(r.kind==="composite"){if(!GF.has(r.combine??"max"))throw new Error(`${e}.combine must be one of: ${Array.from(GF).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${e}.items must be a non-empty array.`);t.combine=r.combine??"max",t.items=r.items.map((i,s)=>HV(i,`${e}.items[${s}]`))}return t.progress||(t.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),t},LF=(r,e)=>{if(ci(r,e),r.mask!==void 0)throw new Error(`${e}.mask is not valid. Define mask on ${e}.`);let t={};if(r.tween!==void 0&&(t.tween=NF(r.tween,`${e}.tween`,LV)),Object.keys(t).length===0)throw new Error(`${e} must define tween.`);return t},WV=(r,e)=>{let t={};if(r.shader!==void 0)throw new Error(`${e}.shader is not supported.`);if(r.prev!==void 0&&(t.prev=LF(r.prev,`${e}.prev`)),r.next!==void 0&&(t.next=LF(r.next,`${e}.next`)),r.mask!==void 0&&(t.mask=VV(r.mask,`${e}.mask`)),t.prev===void 0&&t.next===void 0&&t.mask===void 0)throw new Error(`${e} must define prev, next, or mask.`);return t},Ib=(r,e,t)=>{if(r!==void 0)throw new Error(`${e} ${t}`)},HF=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let e=r.map((i,s)=>{let o=`animations[${s}]`;if(ci(i,o),fo(i.id,`${o}.id`),fo(i.targetId,`${o}.targetId`),fo(i.type,`${o}.type`),!OF.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(OF).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(ci(i.complete,`${o}.complete`),n.complete=i.complete),Ib(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),Ib(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),Ib(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=NF(i.tween,`${o}.tween`,GV,NV),i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(i.prev!==void 0)throw new Error(`${o}.prev is only valid for transition animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for transition animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for transition animations.`);if(i.shader!==void 0)throw new Error(`${o}.shader is not supported.`);return n}if(i.tween!==void 0)throw new Error(`${o}.tween is not valid for transition animations.`);if(i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let a=WV(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),t=new Map;for(let i of e){let s=t.get(i.targetId)??new Set;s.add(i.type),t.set(i.targetId,s)}for(let[i,s]of t)if(s.has("transition")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix update and transition types in the same state.`);return e};var kb=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let e={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};if(!Array.isArray(e.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(e.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(e.audio))throw new Error("Input error: `audio` must be an array.");return e.animations=HF(e.animations),e};var zV="0",da=(r,e)=>{let t=r?.[e];return typeof t=="number"?t:0},hr=r=>({value:r.element.value??"",selectionStart:da(r.element,"selectionStart"),selectionEnd:da(r.element,"selectionEnd"),focused:document.activeElement===r.element,composing:r.composing===!0}),$V=(r,e)=>!r||!e?!1:r.value===e.value&&r.selectionStart===e.selectionStart&&r.selectionEnd===e.selectionEnd&&r.focused===e.focused&&r.composing===e.composing,XV=r=>r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement,Tu=r=>{r.element.style.pointerEvents="none"},Fb=(r,e,t)=>{if(typeof r?.setSelectionRange=="function")try{r.setSelectionRange(e,t)}catch{}},jV=({app:r,geometry:e})=>{let t=r.canvas;if(!e||!t||e.visible===!1)return null;let i=t.getBoundingClientRect(),s=r.renderer?.width||i.width||1,o=r.renderer?.height||i.height||1,n=i.width/s,a=i.height/o,l=e.clipInsets??{top:0,right:0,bottom:0,left:0},c=i.left+(e.x+l.left)*n,u=i.top+(e.y+l.top)*a,h=i.left+(e.x+e.width-l.right)*n,d=i.top+(e.y+e.height-l.bottom)*a;return h<=c||d<=u?null:{left:c,top:u,right:h,bottom:d}},YV=({app:r,entry:e,event:t})=>{let i=e.options.getGeometry?.(),s=jV({app:r,geometry:i}),o=t.clientX,n=t.clientY;return!!s&&Number.isFinite(o)&&Number.isFinite(n)&&o>=s.left&&o<=s.right&&n>=s.top&&n<=s.bottom},VF=({app:r})=>{let e=new Map,t,i=null,s=()=>{t||(t=document.createElement("div"),t.dataset.routeGraphicsInputBridge="true",t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.pointerEvents="none",t.style.zIndex="1000",t.style.width="0",t.style.height="0");let x=r.canvas?.parentNode??document.body;t.isConnected||x.appendChild(t)},o=(x,T=x.lastSnapshot)=>{let b=hr(x);b.focused&&i!==x.id?i=x.id:!b.focused&&i===x.id&&(i=null),Tu(x,i),T?.value!==b.value&&x.callbacks.onValueChange?.(b),(T?.selectionStart!==b.selectionStart||T?.selectionEnd!==b.selectionEnd||T?.focused!==b.focused||T?.composing!==b.composing)&&x.callbacks.onSelectionChange?.(b),x.lastSnapshot=b},n=x=>{let{disabled:T=!1,multiline:b=!1,maxLength:w,textStyle:E,padding:I,placeholder:B="",autocomplete:C="off",autocapitalize:A="off",spellcheck:P=!1}=x.options,{element:R}=x;R instanceof HTMLInputElement&&(R.type="text"),R.disabled=T,R.placeholder=B,R.autocomplete=C,R.autocapitalize=A,R.spellcheck=!!P,R.style.opacity=zV,R.style.color="transparent",R.style.caretColor="transparent",R.style.background="transparent",R.style.paddingTop=`${I.top}px`,R.style.paddingRight=`${I.right}px`,R.style.paddingBottom=`${I.bottom}px`,R.style.paddingLeft=`${I.left}px`,R.style.fontFamily=E?.fontFamily??"Arial",R.style.fontSize=`${E?.fontSize??16}px`,R.style.fontWeight=E?.fontWeight??"400",R.style.textAlign=E?.align??"left",R.style.lineHeight=typeof E?.lineHeight=="number"?`${E.lineHeight}px`:"normal",R.style.whiteSpace=b?"pre":"nowrap",R.style.overflowWrap="normal",R.style.resize="none",R.style.overflow="hidden",typeof w=="number"?R.maxLength=w:R.removeAttribute("maxLength"),R.tabIndex=-1,b&&R instanceof HTMLTextAreaElement&&(R.wrap="off",R.rows=1),Tu(x,i)},a=x=>{s();let T=r.canvas,b=x.options.getGeometry?.();if(!T||!b||b.visible===!1){x.element.style.display="none";return}let w=T.getBoundingClientRect(),E=r.renderer?.width||w.width||1,I=r.renderer?.height||w.height||1,B=w.width/E,C=w.height/I,A=b.clipInsets??{top:0,right:0,bottom:0,left:0},P={top:A.top*C,right:A.right*B,bottom:A.bottom*C,left:A.left*B};x.element.style.display="block",x.element.style.left=`${w.left+b.x*B}px`,x.element.style.top=`${w.top+b.y*C}px`,x.element.style.width=`${b.width*B}px`,x.element.style.height=`${b.height*C}px`;let R=Object.values(P).some(M=>M>0);x.element.style.clipPath=R?`inset(${P.top}px ${P.right}px ${P.bottom}px ${P.left}px)`:"none"},l=x=>{if(!i)return;let T=e.get(i),b=x.target;!T||b===T.element||T.element.contains(b)||XV(b)&&t?.contains(b)||YV({app:r,entry:T,event:x})||T.element.blur()},c=()=>{for(let x of e.values()){if(a(x),!x.lastSnapshot){x.lastSnapshot=hr(x);continue}let T=hr(x);$V(T,x.lastSnapshot)||o(x,x.lastSnapshot)}},u=({id:x,options:T})=>{let b=T.multiline===!0?document.createElement("textarea"):document.createElement("input");return b.dataset.routeGraphicsInputId=x,b.style.position="fixed",b.style.border="none",b.style.outline="none",b.style.margin="0",b.style.boxSizing="border-box",b.style.borderRadius="0",b.style.transformOrigin="top left",b.style.appearance="none",b.style.boxShadow="none",b.style.userSelect="none",b.style.webkitUserSelect="none",b},h=x=>{let{id:T,element:b}=x,w=()=>{o(x)};b.addEventListener("focus",()=>{x.pendingBlurTimer&&(clearTimeout(x.pendingBlurTimer),x.pendingBlurTimer=null),i=T,Tu(x,i);let E=hr(x);x.lastSnapshot=E,x.callbacks.onFocus?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("blur",()=>{i===T&&(i=null),Tu(x,i),x.pendingBlurTimer=setTimeout(()=>{x.pendingBlurTimer=null;let E=hr(x);if(E.focused){x.lastSnapshot=E;return}x.lastSnapshot=E,x.callbacks.onBlur?.(E),x.callbacks.onSelectionChange?.(E)},0)}),b.addEventListener("input",w),b.addEventListener("select",w),b.addEventListener("click",()=>queueMicrotask(w)),b.addEventListener("keyup",()=>queueMicrotask(w)),b.addEventListener("keydown",E=>{let I=E.key==="Enter"&&x.options.multiline!==!0&&!E.shiftKey,B=E.key==="Enter"&&x.options.multiline===!0&&(E.ctrlKey||E.metaKey);(I||B)&&(E.preventDefault(),x.callbacks.onSubmit?.(hr(x),E)),E.key==="Escape"&&b.blur(),queueMicrotask(w)}),b.addEventListener("compositionstart",()=>{x.composing=!0;let E=hr(x);x.lastSnapshot=E,x.callbacks.onCompositionStart?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("compositionupdate",()=>{let E=hr(x);x.lastSnapshot=E,x.callbacks.onCompositionUpdate?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("compositionend",()=>{x.composing=!1,w(),x.callbacks.onCompositionEnd?.(hr(x))})};document.addEventListener("pointerdown",l,!0),r.ticker?.add?.(c);let d=(x,T)=>{s();let b=e.get(x);if(b)return b.options=T,b.callbacks=T.callbacks??{},n(b),a(b),typeof T.value=="string"&&b.element.value!==T.value&&(b.element.value=T.value),b.lastSnapshot=hr(b),b.element;let w={id:x,element:u({id:x,options:T}),options:T,callbacks:T.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return h(w),typeof T.value=="string"&&(w.element.value=T.value),n(w),t.appendChild(w.element),e.set(x,w),a(w),w.lastSnapshot=hr(w),w.element};return{mount:d,update:(x,T)=>{let b=e.get(x);if(!b)return d(x,T);let w=T.multiline===!0!=b.element instanceof HTMLTextAreaElement;if(b.options=T,b.callbacks=T.callbacks??{},w){let E=b.element,I=document.activeElement===E,B=da(E,"selectionStart"),C=da(E,"selectionEnd");return b.element=u({id:x,options:T}),h(b),E.replaceWith(b.element),b.element.value=typeof T.value=="string"?T.value:E.value,n(b),a(b),b.lastSnapshot=hr(b),I&&!T.disabled&&queueMicrotask(()=>{b.element.focus(),Fb(b.element,B,C)}),b.element}return typeof T.value=="string"&&T.value!==b.element.value&&b.composing!==!0&&(b.element.value=T.value),n(b),a(b),b.lastSnapshot=hr(b),b.element},focus:(x,{selectAll:T=!1,selectionStart:b,selectionEnd:w}={})=>{let E=e.get(x);if(!E||E.element.disabled)return;let I=document.activeElement===E.element;if(i=x,Tu(E,i),I||E.element.focus(),T){E.element.select?.(),o(E,E.lastSnapshot);return}if(typeof b=="number"||typeof w=="number"){let B=typeof b=="number"?b:da(E.element,"selectionStart"),C=typeof w=="number"?w:typeof b=="number"?b:da(E.element,"selectionEnd");Fb(E.element,B,C)}o(E,E.lastSnapshot)},setSelection:(x,T,b=T,{focus:w=!1}={})=>{let E=e.get(x);if(!E||E.element.disabled)return;let I=()=>{Fb(E.element,T,b),o(E,E.lastSnapshot)};if(w&&document.activeElement!==E.element){E.element.focus(),I();return}I()},blur:x=>{e.get(x)?.element.blur()},unmount:x=>{let T=e.get(x);T&&(i===x&&(i=null),T.pendingBlurTimer&&(clearTimeout(T.pendingBlurTimer),T.pendingBlurTimer=null),T.element.remove(),e.delete(x),e.size===0&&t?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),r.ticker?.remove?.(c);for(let x of e.values())x.pendingBlurTimer&&(clearTimeout(x.pendingBlurTimer),x.pendingBlurTimer=null),x.element.remove();e.clear(),i=null,t?.remove(),t=void 0}}};var qV=()=>{let r=A=>{if(A!=="auto"&&A!=="manual")throw new Error(`Invalid animation playback mode "${A}". Expected "auto" or "manual".`)},e,t=_F(),i={elements:[],animations:[],audio:[]},s,o={animations:[],elements:[],audio:[],parsers:[]},n,a,l,c,u=!1,h,d,f,p="auto",m=null,g=[],_,v=new Map,x,T=(A,P,R,M)=>{A.clear(),A.rect(0,0,P,R),A.fill(M??0)},b=A=>A?A.startsWith("audio/")?"audio":A.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(A)?"font":A.startsWith("video/")?"video":"texture":"texture",w=(A,P,{revokable:R=!1}={})=>{v.set(A,{url:P,revokable:R})},E=()=>{for(let A of v.values())A?.revokable===!0&&typeof A?.url=="string"&&URL.revokeObjectURL(A.url);v.clear()},I=(A,P,R)=>{n&&n.registerHotkeys(R?.keyboard??{}),A.renderer.events.cursorStyles||(A.renderer.events.cursorStyles={}),A.renderer.events.cursorStyles.default||(A.renderer.events.cursorStyles.default="default"),A.renderer.events.cursorStyles.hover||(A.renderer.events.cursorStyles.hover="pointer");let M=P?.cursorStyles,F=R?.cursorStyles;pe(M,F)||(F?(F.default&&(A.renderer.events.cursorStyles.default=F.default,A.canvas.style.cursor=F.default),F.hover&&(A.renderer.events.cursorStyles.hover=F.hover)):M&&(A.renderer.events.cursorStyles.default="default",A.renderer.events.cursorStyles.hover="pointer"))},B=(A,P,R,M)=>{if(pe(i,R)){typeof A.render=="function"&&A.render();return}h&&h.abort(),h=new AbortController;let F=h.signal;l.reset(R.id),I(A,i.global,R.global),a.cancelAll(),Vs({app:A,parent:P,prevComputedTree:i.elements,nextComputedTree:R.elements,animations:R.animations,elementPlugins:o.elements,animationBus:a,completionTracker:l,eventHandler:M,signal:F}),a.flush(),p==="manual"&&m!==null&&a.setTime(m),a_({app:A,prevAudioTree:i.audio,nextAudioTree:R.audio,audioPlugins:o.audio}),i=R,typeof A.render=="function"&&A.render(),l.completeIfEmpty(),u||(u=!0,c&&c())},C={rendererName:"pixi",get canvas(){return e.canvas},findElementByLabel:A=>e.stage.getChildByLabel(A,!0)??null,extractBase64:async A=>{typeof e.render=="function"&&e.render();let P=new Q(0,0,e.renderer.width,e.renderer.height);if(!A)return await e.renderer.extract.base64({target:e.stage,frame:P});let R=e.stage.getChildByLabel(A,!0);if(!R)throw new Error(`Element with label '${A}' not found`);return await e.renderer.extract.base64({target:R,frame:P})},assignStageEvent:(A,P)=>{e.stage.eventMode="static",e.stage.on(A,P)},setAnimationPlaybackMode:A=>{r(A),p=A,p!=="manual"&&(m=null,a?.clearTime?.())},setAnimationTime:A=>{let P=Number(A);if(!Number.isFinite(P))throw new Error("Animation time must be a finite number.");p==="manual"&&(m=P),a.flush(),a.setTime(P),p!=="manual"&&(m=null,a.clearTime()),typeof e.render=="function"&&e.render()},init:async A=>{let{eventHandler:P,plugins:R,width:M,height:F,backgroundColor:O,debug:D=!1,onFirstRender:N,animationPlaybackMode:L="auto"}=A;c=N,r(L),p=L,m=null,g.forEach(J=>J()),g=[];let Y=[];R?.elements?.forEach(J=>{J?.parse&&Y.push(bF({type:J.type,parse:J.parse}))}),o={animations:R?.animations??[],elements:R?.elements??[],audio:R?.audio??[],parsers:Y},s=P,n=RF(P),l=FF(P),e=new ic,e.audioStage=t,await e.init({width:M,height:F,backgroundColor:O,preference:"webgl",preserveDrawingBuffer:D===!0}),typeof e.ticker?.remove=="function"&&e.ticker.remove(e.render,e),e.debug=D,e.inputDomBridge=VF({app:e}),_=J=>{J.preventDefault()},e.canvas.addEventListener("contextmenu",_),x=new Ue,x.label="__route_graphics_background__",T(x,M,F,O),e.stage.addChild(x),e.stage.width=M,e.stage.height=F,e.ticker.add(e.audioStage.tick),a=kF();let ue=()=>{p==="manual"&&typeof e.render=="function"&&e.render()};return g=[a.on("started",ue),a.on("completed",ue),a.on("cancelled",ue)],D?(d=J=>{p==="auto"&&J?.detail?.deltaMS&&(a.tick(Number(J.detail.deltaMS)),typeof e.render=="function"&&e.render())},window.addEventListener("snapShotKeyFrame",d)):(f=J=>{p==="auto"&&(a.tick(J.deltaMS),typeof e.render=="function"&&e.render())},e.ticker.add(f)),C},destroy:()=>{h&&(h.abort(),h=void 0),d&&(window.removeEventListener("snapShotKeyFrame",d),d=void 0),f&&typeof e?.ticker?.remove=="function"&&(e.ticker.remove(f),f=void 0),_&&e?.canvas&&(e.canvas.removeEventListener("contextmenu",_),_=void 0),e?.inputDomBridge?.destroy?.(),n?.destroy(),Qy(),g.forEach(P=>P()),g=[],a&&a.destroy(),e?.audioStage&&e.audioStage.destroy();let A=P=>{for(let R of P.children){let M=R.texture?.source?.resource;M instanceof HTMLVideoElement&&M.pause(),R.children&&A(R)}};e?.stage&&A(e.stage),e&&e.destroy(),p="auto",m=null,x=void 0,E()},loadAssets:async A=>{if(!A)throw new Error("assetBufferMap is required");let P={audio:{},font:{},video:{},texture:{}};for(let[F,O]of Object.entries(A)){let D=b(O.type);P[D][F]=O}await Promise.all(Object.entries(P.audio).map(([F,O])=>yn.load(F,O.buffer))),await Promise.all(Object.entries(P.font).map(async([F,O])=>{let D=new Blob([O.buffer],{type:O.type}),N=URL.createObjectURL(D),L=new FontFace(F,`url(${N})`);try{await L.load(),document.fonts.add(L)}catch(Y){console.error(`Failed to load font ${F}:`,Y)}finally{URL.revokeObjectURL(N)}}));let R=Object.entries(P.texture).map(async([F,O])=>{if(br.cache.has(F))return br.cache.get(F);if(O?.source==="url"&&typeof O?.url=="string")return br.load({alias:F,src:O.url,parser:"loadTextures"});let D=new Blob([O.buffer],{type:O.type}),N=await createImageBitmap(D),L=k.from(N);return br.cache.set(F,L),L}),M=Object.entries(P.video).map(async([F,O])=>{let D=O?.source==="url"&&typeof O?.url=="string"?O.url:URL.createObjectURL(new Blob([O.buffer],{type:O.type})),N=O?.source!=="url";w(F,D,{revokable:N});let L={alias:F,src:D,parser:"loadVideo",data:{}};return typeof O?.type=="string"&&O.type.length>0&&(L.data.mime=O.type),br.load(L).then(Y=>Y).catch(Y=>{throw v.delete(F),N&&URL.revokeObjectURL(D),Y})});return Promise.all([...R,...M])},loadAudioAssets:async A=>Promise.all(A.map(async P=>{let M=await(await fetch(P)).arrayBuffer();return yn.load(P,M)})),updatedBackgroundColor:A=>{e.renderer.background.color=A,x&&T(x,e.renderer.width,e.renderer.height,A),typeof e.render=="function"&&e.render()},render:A=>{let P=kb(A),R=Ab({JSONObject:P.elements,parserPlugins:o.parsers}),M={...P,elements:R};B(e,e.stage,M,s)},parse:A=>{let P=kb(A),R=Ab({JSONObject:P.elements,parserPlugins:o.parsers});return{...P,elements:R}}};return C},WF=qV;var wIe=WF;export{ic as Application,br as Assets,yn as AudioAsset,cD as animatedSpritePlugin,JL as containerPlugin,vy as createAnimationPlugin,QF as createAssetBufferManager,Ty as createAudioPlugin,et as createElementPlugin,wIe as default,mL as inputPlugin,QD as particlesPlugin,WG as rectPlugin,a_ as renderAudio,Vs as renderElements,rL as sliderPlugin,dD as soundPlugin,zG as spritePlugin,NR as spritesheetAnimationPlugin,NG as textPlugin,oD as textRevealingPlugin,uD as tweenPlugin,XG as videoPlugin}; /*! Bundled license information: punycode/punycode.js: diff --git a/spec/audio/updateSound.spec.js b/spec/audio/updateSound.spec.js index 1e0457bd..440c02c5 100644 --- a/spec/audio/updateSound.spec.js +++ b/spec/audio/updateSound.spec.js @@ -43,7 +43,7 @@ describe("updateSound", () => { src: "next.mp3", delay: 100, loop: true, - volume: 500, + volume: 50, }, }); @@ -78,7 +78,7 @@ describe("updateSound", () => { src: "new.mp3", delay: 0, loop: false, - volume: 900, + volume: 90, }, }); @@ -106,7 +106,7 @@ describe("updateSound", () => { src: "amb-2.mp3", delay: 0, loop: true, - volume: 600, + volume: 60, }, }); diff --git a/spec/elements/updateVideo.spec.js b/spec/elements/updateVideo.spec.js index ed6e7622..7664b71d 100644 --- a/spec/elements/updateVideo.spec.js +++ b/spec/elements/updateVideo.spec.js @@ -65,7 +65,7 @@ describe("updateVideo", () => { id: "video-1", src: "video.mp4", loop: true, - volume: 500, + volume: 50, x: 0, y: 0, width: 100, @@ -76,7 +76,7 @@ describe("updateVideo", () => { id: "video-1", src: "video.mp4", loop: false, - volume: 500, + volume: 50, x: 0, y: 0, width: 100, diff --git a/src/plugins/audio/sound/addSound.js b/src/plugins/audio/sound/addSound.js index 26615fa7..6904b0dc 100644 --- a/src/plugins/audio/sound/addSound.js +++ b/src/plugins/audio/sound/addSound.js @@ -1,3 +1,5 @@ +import { normalizeVolume } from "../../../util/normalizeVolume.js"; + // Track pending delayed sounds by sound id so updates/deletes can cancel specific entries. const pendingTimeoutById = new Map(); @@ -5,7 +7,7 @@ const createAudioElement = (element) => ({ id: element.id, url: element.src, loop: element.loop ?? false, - volume: (element.volume ?? 800) / 1000, + volume: normalizeVolume(element.volume, 80), }); export const hasPendingSound = (id) => pendingTimeoutById.has(id); diff --git a/src/plugins/audio/sound/updateSound.js b/src/plugins/audio/sound/updateSound.js index 1ea2cca9..dd5ced71 100644 --- a/src/plugins/audio/sound/updateSound.js +++ b/src/plugins/audio/sound/updateSound.js @@ -3,6 +3,7 @@ import { hasPendingSound, scheduleSound, } from "./addSound.js"; +import { normalizeVolume } from "../../../util/normalizeVolume.js"; /** * Update sound element on the audio stage @@ -29,7 +30,7 @@ export const updateSound = ({ app, prevElement, nextElement }) => { id, url: nextElement.src, loop: nextElement.loop ?? false, - volume: (nextElement.volume ?? 800) / 1000, + volume: normalizeVolume(nextElement.volume, 80), }); return; } @@ -40,12 +41,12 @@ export const updateSound = ({ app, prevElement, nextElement }) => { id, url: nextElement.src, loop: nextElement.loop ?? false, - volume: (nextElement.volume ?? 800) / 1000, + volume: normalizeVolume(nextElement.volume, 80), }); return; } audioElement.url = nextElement.src; audioElement.loop = nextElement.loop ?? false; - audioElement.volume = (nextElement.volume ?? 800) / 1000; + audioElement.volume = normalizeVolume(nextElement.volume, 80); }; diff --git a/src/plugins/elements/container/util/bindContainerInteractions.js b/src/plugins/elements/container/util/bindContainerInteractions.js index c3c0d739..27f4433c 100644 --- a/src/plugins/elements/container/util/bindContainerInteractions.js +++ b/src/plugins/elements/container/util/bindContainerInteractions.js @@ -1,4 +1,5 @@ import { Rectangle } from "pixi.js"; +import { normalizeVolume } from "../../../../util/normalizeVolume.js"; import { isPrimaryPointerEvent, isSecondaryPointerEvent, @@ -225,7 +226,7 @@ export const bindContainerInteractions = ({ id: `click-${Date.now()}`, url: soundSrc, loop: false, - volume: (soundVolume ?? 1000) / 1000, + volume: normalizeVolume(soundVolume), }); }; diff --git a/src/plugins/elements/rect/addRect.js b/src/plugins/elements/rect/addRect.js index 22994088..7048c6b0 100644 --- a/src/plugins/elements/rect/addRect.js +++ b/src/plugins/elements/rect/addRect.js @@ -1,4 +1,5 @@ import { Graphics } from "pixi.js"; +import { normalizeVolume } from "../../../util/normalizeVolume.js"; import { dispatchLiveAnimations } from "../../animations/planAnimations.js"; import { setupScrollInteraction } from "./setupScrollInteraction.js"; import { isPrimaryPointerEvent } from "../util/isPrimaryPointerEvent.js"; @@ -120,7 +121,7 @@ export const addRect = ({ id: `click-${Date.now()}`, url: soundSrc, loop: false, - volume: (soundVolume ?? 1000) / 1000, + volume: normalizeVolume(soundVolume), }); }; diff --git a/src/plugins/elements/rect/updateRect.js b/src/plugins/elements/rect/updateRect.js index cd973ba9..4c72c155 100644 --- a/src/plugins/elements/rect/updateRect.js +++ b/src/plugins/elements/rect/updateRect.js @@ -1,4 +1,5 @@ import { isDeepEqual } from "../../../util/isDeepEqual.js"; +import { normalizeVolume } from "../../../util/normalizeVolume.js"; import { dispatchLiveAnimations } from "../../animations/planAnimations.js"; import { setupScrollInteraction } from "./setupScrollInteraction.js"; import { isPrimaryPointerEvent } from "../util/isPrimaryPointerEvent.js"; @@ -133,7 +134,7 @@ export const updateRect = ({ id: `click-${Date.now()}`, url: soundSrc, loop: false, - volume: (soundVolume ?? 1000) / 1000, + volume: normalizeVolume(soundVolume), }); }; diff --git a/src/plugins/elements/sprite/addSprite.js b/src/plugins/elements/sprite/addSprite.js index d0a3a1bd..3ccf11b2 100644 --- a/src/plugins/elements/sprite/addSprite.js +++ b/src/plugins/elements/sprite/addSprite.js @@ -1,4 +1,5 @@ import { Sprite, Texture } from "pixi.js"; +import { normalizeVolume } from "../../../util/normalizeVolume.js"; import { dispatchLiveAnimations } from "../../animations/planAnimations.js"; import { isPrimaryPointerEvent } from "../util/isPrimaryPointerEvent.js"; import { @@ -132,7 +133,7 @@ export const addSprite = ({ id: `click-${Date.now()}`, url: soundSrc, loop: false, - volume: (soundVolume ?? 1000) / 1000, + volume: normalizeVolume(soundVolume), }); }; diff --git a/src/plugins/elements/sprite/updateSprite.js b/src/plugins/elements/sprite/updateSprite.js index 680ace22..f93e5566 100644 --- a/src/plugins/elements/sprite/updateSprite.js +++ b/src/plugins/elements/sprite/updateSprite.js @@ -1,5 +1,6 @@ import { Texture } from "pixi.js"; import { isDeepEqual } from "../../../util/isDeepEqual.js"; +import { normalizeVolume } from "../../../util/normalizeVolume.js"; import { dispatchLiveAnimations } from "../../animations/planAnimations.js"; import { isPrimaryPointerEvent } from "../util/isPrimaryPointerEvent.js"; import { @@ -157,7 +158,7 @@ export const updateSprite = ({ id: `click-${Date.now()}`, url: soundSrc, loop: false, - volume: (soundVolume ?? 1000) / 1000, + volume: normalizeVolume(soundVolume), }); }; diff --git a/src/plugins/elements/text/addText.js b/src/plugins/elements/text/addText.js index 2772abf2..9d5428ef 100644 --- a/src/plugins/elements/text/addText.js +++ b/src/plugins/elements/text/addText.js @@ -1,5 +1,6 @@ import { Text } from "pixi.js"; import applyTextStyle from "../../../util/applyTextStyle.js"; +import { normalizeVolume } from "../../../util/normalizeVolume.js"; import { dispatchLiveAnimations } from "../../animations/planAnimations.js"; import { getTextLayoutPosition, @@ -147,7 +148,7 @@ export const addText = ({ id: `click-${Date.now()}`, url: soundSrc, loop: false, - volume: (soundVolume ?? 1000) / 1000, + volume: normalizeVolume(soundVolume), }); }; diff --git a/src/plugins/elements/text/updateText.js b/src/plugins/elements/text/updateText.js index d9a0b4e4..7f2669e5 100644 --- a/src/plugins/elements/text/updateText.js +++ b/src/plugins/elements/text/updateText.js @@ -1,5 +1,6 @@ import applyTextStyle from "../../../util/applyTextStyle.js"; import { isDeepEqual } from "../../../util/isDeepEqual.js"; +import { normalizeVolume } from "../../../util/normalizeVolume.js"; import { dispatchLiveAnimations } from "../../animations/planAnimations.js"; import { getTextLayoutPosition, @@ -173,7 +174,7 @@ export const updateText = ({ id: `click-${Date.now()}`, url: soundSrc, loop: false, - volume: (soundVolume ?? 1000) / 1000, + volume: normalizeVolume(soundVolume), }); }; diff --git a/src/plugins/elements/video/addVideo.js b/src/plugins/elements/video/addVideo.js index eb03a212..50d742ce 100644 --- a/src/plugins/elements/video/addVideo.js +++ b/src/plugins/elements/video/addVideo.js @@ -1,6 +1,7 @@ import { Texture, Sprite } from "pixi.js"; import { syncVideoPlaybackTracking } from "./playbackTracking.js"; import { queueDeferredVideoPlay } from "../renderContext.js"; +import { normalizeVolume } from "../../../util/normalizeVolume.js"; /** * Add video element to the stage @@ -21,7 +22,7 @@ export const addVideo = ({ video.pause(); video.currentTime = 0; video.loop = loop ?? false; - video.volume = volume / 1000; + video.volume = normalizeVolume(volume); video.muted = false; const sprite = new Sprite(texture); diff --git a/src/plugins/elements/video/parseVideo.js b/src/plugins/elements/video/parseVideo.js index 4991497a..38c46ec0 100644 --- a/src/plugins/elements/video/parseVideo.js +++ b/src/plugins/elements/video/parseVideo.js @@ -18,7 +18,7 @@ export const parseVideo = ({ state }) => { return { ...finalObj, src: state.src, - volume: state.volume ?? 1000, + volume: state.volume ?? 100, loop: state.loop ?? false, }; }; diff --git a/src/plugins/elements/video/updateVideo.js b/src/plugins/elements/video/updateVideo.js index 09c98421..645c3fe1 100644 --- a/src/plugins/elements/video/updateVideo.js +++ b/src/plugins/elements/video/updateVideo.js @@ -5,6 +5,7 @@ import { syncVideoPlaybackTracking, } from "./playbackTracking.js"; import { dispatchLiveAnimations } from "../../animations/planAnimations.js"; +import { normalizeVolume } from "../../../util/normalizeVolume.js"; /** * Update video element @@ -67,7 +68,7 @@ export const updateVideo = ({ completionTracker, }); - activeVideo.volume = nextElement.volume / 1000; + activeVideo.volume = normalizeVolume(nextElement.volume); activeVideo.loop = nextElement.loop ?? false; if (prevElement.src !== nextElement.src) { diff --git a/src/schemas/audio/sound.yaml b/src/schemas/audio/sound.yaml index ef8eb021..364e61b3 100644 --- a/src/schemas/audio/sound.yaml +++ b/src/schemas/audio/sound.yaml @@ -18,9 +18,10 @@ properties: description: Source of the sound volume: type: number - description: Volume. 0 means muted. 1000 means original full volume. It can go above 1000, but there is no guarantee that it won't be clipped. - default: 800 + description: Volume. 0 means muted. 100 means original full volume. + default: 80 minimum: 0 + maximum: 100 loop: type: boolean description: Loop diff --git a/src/schemas/elements/container.computed.yaml b/src/schemas/elements/container.computed.yaml index 45863f3f..9d2d2e41 100644 --- a/src/schemas/elements/container.computed.yaml +++ b/src/schemas/elements/container.computed.yaml @@ -157,10 +157,10 @@ properties: description: source of sound to be played when the container is clicked soundVolume: type: number - description: Volume. 0 means muted. 1000 means original full volume. + description: Volume. 0 means muted. 100 means original full volume. minimum: 0 - maximum: 1000 - default: 1000 + maximum: 100 + default: 100 payload: type: object description: Payload for click action event diff --git a/src/schemas/elements/container.element.yaml b/src/schemas/elements/container.element.yaml index 002eba49..c70fa4ea 100644 --- a/src/schemas/elements/container.element.yaml +++ b/src/schemas/elements/container.element.yaml @@ -190,10 +190,10 @@ properties: description: source of sound to be played when the container is clicked soundVolume: type: number - description: Volume. 0 means muted. 1000 means original full volume. + description: Volume. 0 means muted. 100 means original full volume. minimum: 0 - maximum: 1000 - default: 1000 + maximum: 100 + default: 100 payload: type: object description: Payload for click action event diff --git a/src/schemas/elements/rect.computed.yaml b/src/schemas/elements/rect.computed.yaml index b71785de..f27a62ee 100644 --- a/src/schemas/elements/rect.computed.yaml +++ b/src/schemas/elements/rect.computed.yaml @@ -78,10 +78,10 @@ properties: description: source of sound to be played when the sprite is clicked soundVolume: type: number - description: Volume. 0 means muted. 1000 means original full volume. + description: Volume. 0 means muted. 100 means original full volume. minimum: 0 - maximum: 1000 - default: 1000 + maximum: 100 + default: 100 payload: type: object description: Payload for click action event diff --git a/src/schemas/elements/rect.element.yaml b/src/schemas/elements/rect.element.yaml index 3e128436..ecbe2e24 100644 --- a/src/schemas/elements/rect.element.yaml +++ b/src/schemas/elements/rect.element.yaml @@ -85,10 +85,10 @@ properties: description: source of sound to be played when the sprite is clicked soundVolume: type: number - description: Volume. 0 means muted. 1000 means original full volume. + description: Volume. 0 means muted. 100 means original full volume. minimum: 0 - maximum: 1000 - default: 1000 + maximum: 100 + default: 100 payload: type: object description: Payload for click action event diff --git a/src/schemas/elements/sprite.computed.yaml b/src/schemas/elements/sprite.computed.yaml index 4c784229..97cc335d 100644 --- a/src/schemas/elements/sprite.computed.yaml +++ b/src/schemas/elements/sprite.computed.yaml @@ -72,10 +72,10 @@ properties: description: source of sound to be played when the sprite is clicked soundVolume: type: number - description: Volume. 0 means muted. 1000 means original full volume. + description: Volume. 0 means muted. 100 means original full volume. minimum: 0 - maximum: 1000 - default: 1000 + maximum: 100 + default: 100 payload: type: object description: Payload for click action event diff --git a/src/schemas/elements/sprite.element.yaml b/src/schemas/elements/sprite.element.yaml index 54bc1fd6..a23dce49 100644 --- a/src/schemas/elements/sprite.element.yaml +++ b/src/schemas/elements/sprite.element.yaml @@ -72,10 +72,10 @@ properties: description: source of sound to be played when the sprite is clicked soundVolume: type: number - description: Volume. 0 means muted. 1000 means original full volume. + description: Volume. 0 means muted. 100 means original full volume. minimum: 0 - maximum: 1000 - default: 1000 + maximum: 100 + default: 100 payload: type: object description: Payload for click action event diff --git a/src/schemas/elements/text.computed.yaml b/src/schemas/elements/text.computed.yaml index 68b8d1f0..4419f903 100644 --- a/src/schemas/elements/text.computed.yaml +++ b/src/schemas/elements/text.computed.yaml @@ -119,10 +119,10 @@ properties: description: URL to sound file to play on click soundVolume: type: number - description: Volume. 0 means muted. 1000 means original full volume. + description: Volume. 0 means muted. 100 means original full volume. minimum: 0 - maximum: 1000 - default: 1000 + maximum: 100 + default: 100 payload: type: object description: Payload for click action event diff --git a/src/schemas/elements/text.element.yaml b/src/schemas/elements/text.element.yaml index 9bb7863b..51f8c9d6 100644 --- a/src/schemas/elements/text.element.yaml +++ b/src/schemas/elements/text.element.yaml @@ -106,10 +106,10 @@ properties: description: URL to sound file to play on click soundVolume: type: number - description: Volume. 0 means muted. 1000 means original full volume. + description: Volume. 0 means muted. 100 means original full volume. minimum: 0 - maximum: 1000 - default: 1000 + maximum: 100 + default: 100 payload: type: object description: Payload for click action event diff --git a/src/schemas/elements/video.computed.yaml b/src/schemas/elements/video.computed.yaml index 8723a5e5..fafc721f 100644 --- a/src/schemas/elements/video.computed.yaml +++ b/src/schemas/elements/video.computed.yaml @@ -56,9 +56,9 @@ properties: description: Source URL of the video file volume: type: number - description: Volume of the video audio (0-1000) + description: Volume of the video audio (0-100) minimum: 0 - maximum: 1000 + maximum: 100 loop: type: boolean - description: Whether the video should loop when it ends \ No newline at end of file + description: Whether the video should loop when it ends diff --git a/src/schemas/elements/video.element.yaml b/src/schemas/elements/video.element.yaml index cc89df6a..ca26b187 100644 --- a/src/schemas/elements/video.element.yaml +++ b/src/schemas/elements/video.element.yaml @@ -43,10 +43,10 @@ properties: description: Source URL of the video file volume: type: number - description: Volume of the video audio (0-1000) + description: Volume of the video audio (0-100) minimum: 0 - maximum: 1000 - default: 1000 + maximum: 100 + default: 100 loop: type: boolean description: Whether the video should loop when it ends @@ -56,4 +56,4 @@ properties: description: Opacity/transparency of the video (0-1) minimum: 0 maximum: 1 - default: 1 \ No newline at end of file + default: 1 diff --git a/src/types.js b/src/types.js index cf82fe19..8684c0d4 100644 --- a/src/types.js +++ b/src/types.js @@ -517,7 +517,7 @@ * @property {string} id - Unique identifier * @property {string} type - Should be "sound" * @property {string} src - Source of the sound - * @property {number} [volume=800] - Volume (0-1000+, 800 default) + * @property {number} [volume=80] - Volume (0-100, 80 default) * @property {boolean} [loop=false] - Whether to loop the sound * @property {number} [delay=0] - Delay in milliseconds before playing */ diff --git a/src/util/normalizeVolume.js b/src/util/normalizeVolume.js new file mode 100644 index 00000000..4e5ee346 --- /dev/null +++ b/src/util/normalizeVolume.js @@ -0,0 +1,2 @@ +export const normalizeVolume = (volume, fallback = 100) => + Math.min(Math.max(volume ?? fallback, 0), 100) / 100; diff --git a/tasks/TASK/000/TASK-015.md b/tasks/TASK/000/TASK-015.md index 0519e6f3..b82421ed 100644 --- a/tasks/TASK/000/TASK-015.md +++ b/tasks/TASK/000/TASK-015.md @@ -15,5 +15,4 @@ labels: ['feat'] it should have these properties that sound element has: loop: boolean -volume: number (from 0 to 1000) - +volume: number (from 0 to 100)