route-graphics 0.0.2-rc20 → 0.0.2-rc21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RouteGraphics.js +79 -81
- package/package.json +2 -3
package/dist/RouteGraphics.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var UT=Object.create;var Bc=Object.defineProperty;var DT=Object.getOwnPropertyDescriptor;var OT=Object.getOwnPropertyNames;var LT=Object.getPrototypeOf,NT=Object.prototype.hasOwnProperty;var m=(i,t)=>()=>(i&&(t=i(i=0)),t);var Rc=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Ud=(i,t)=>{for(var e in t)Bc(i,e,{get:t[e],enumerable:!0})},HT=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of OT(t))!NT.call(i,s)&&s!==e&&Bc(i,s,{get:()=>t[s],enumerable:!(r=DT(t,s))||r.enumerable});return i};var Jo=(i,t,e)=>(e=i!=null?UT(LT(i)):{},HT(t||!i||!i.__esModule?Bc(e,"default",{value:i,enumerable:!0}):e,i));var x,Ic,Ji,G,E=m(()=>{"use strict";x=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(x||{}),Ic=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Ji=(i,t)=>Ic(i).priority??t,G={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Ic).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Ic).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>Ji(n.value,e)-Ji(o.value,e)))},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1)})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>Ji(o,e)-Ji(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e))}}});var Od=Rc((AE,Gc)=>{"use strict";var WT=Object.prototype.hasOwnProperty,Lt="~";function ts(){}Object.create&&(ts.prototype=Object.create(null),new ts().__proto__||(Lt=!1));function zT(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function Dd(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new zT(e,r||i,s),n=Lt?Lt+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function tn(i,t){--i._eventsCount===0?i._events=new ts:delete i._events[t]}function Ut(){this._events=new ts,this._eventsCount=0}Ut.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)WT.call(e,r)&&t.push(Lt?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Ut.prototype.listeners=function(t){var e=Lt?Lt+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};Ut.prototype.listenerCount=function(t){var e=Lt?Lt+t:t,r=this._events[e];return r?r.fn?1:r.length:0};Ut.prototype.emit=function(t,e,r,s,o,n){var a=Lt?Lt+t:t;if(!this._events[a])return!1;var c=this._events[a],l=arguments.length,h,u;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,r),!0;case 4:return c.fn.call(c.context,e,r,s),!0;case 5:return c.fn.call(c.context,e,r,s,o),!0;case 6:return c.fn.call(c.context,e,r,s,o,n),!0}for(u=1,h=new Array(l-1);u<l;u++)h[u-1]=arguments[u];c.fn.apply(c.context,h)}else{var d=c.length,f;for(u=0;u<d;u++)switch(c[u].once&&this.removeListener(t,c[u].fn,void 0,!0),l){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,e);break;case 3:c[u].fn.call(c[u].context,e,r);break;case 4:c[u].fn.call(c[u].context,e,r,s);break;default:if(!h)for(f=1,h=new Array(l-1);f<l;f++)h[f-1]=arguments[f];c[u].fn.apply(c[u].context,h)}}return!0};Ut.prototype.on=function(t,e,r){return Dd(this,t,e,r,!1)};Ut.prototype.once=function(t,e,r){return Dd(this,t,e,r,!0)};Ut.prototype.removeListener=function(t,e,r,s){var o=Lt?Lt+t:t;if(!this._events[o])return this;if(!e)return tn(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&tn(this,o);else{for(var a=0,c=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&c.push(n[a]);c.length?this._events[o]=c.length===1?c[0]:c:tn(this,o)}return this};Ut.prototype.removeAllListeners=function(t){var e;return t?(e=Lt?Lt+t:t,this._events[e]&&tn(this,e)):(this._events=new ts,this._eventsCount=0),this};Ut.prototype.off=Ut.prototype.removeListener;Ut.prototype.addListener=Ut.prototype.on;Ut.prefixed=Lt;Ut.EventEmitter=Ut;typeof Gc<"u"&&(Gc.exports=Ut)});var Ld,nt,Dt=m(()=>{Ld=Jo(Od(),1),nt=Ld.default});var VT,Oe,Pt,ne,$d,Nd,kc,XT,en,Yd,Kd,Hd,Wd,zd,es,jT,$T,YT,KT,Dc,Vd,qT,Fc,Uc,Xd,Oc,me,jd,qd,Zd=m(()=>{VT={grad:.9,turn:360,rad:360/(2*Math.PI)},Oe=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},Pt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},ne=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},$d=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Nd=function(i){return{r:ne(i.r,0,255),g:ne(i.g,0,255),b:ne(i.b,0,255),a:ne(i.a)}},kc=function(i){return{r:Pt(i.r),g:Pt(i.g),b:Pt(i.b),a:Pt(i.a,3)}},XT=/^#([0-9a-f]{3,8})$/i,en=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Yd=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-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}},Kd=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),c=r*(1-(1-t+o)*e),l=o%6;return{r:255*[r,a,n,n,c,r][l],g:255*[c,r,r,a,n,n][l],b:255*[n,n,c,r,r,a][l],a:s}},Hd=function(i){return{h:$d(i.h),s:ne(i.s,0,100),l:ne(i.l,0,100),a:ne(i.a)}},Wd=function(i){return{h:Pt(i.h),s:Pt(i.s),l:Pt(i.l),a:Pt(i.a,3)}},zd=function(i){return Kd((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},es=function(i){return{h:(t=Yd(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s},jT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$T=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,YT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,KT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dc={string:[[function(i){var t=XT.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?Pt(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?Pt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=YT.exec(i)||KT.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Nd({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(i){var t=jT.exec(i)||$T.exec(i);if(!t)return null;var e,r,s=Hd({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(VT[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return zd(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Oe(t)&&Oe(e)&&Oe(r)?Nd({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Oe(t)||!Oe(e)||!Oe(r))return null;var n=Hd({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return zd(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Oe(t)||!Oe(e)||!Oe(r))return null;var n=function(a){return{h:$d(a.h),s:ne(a.s,0,100),v:ne(a.v,0,100),a:ne(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Kd(n)},"hsv"]]},Vd=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return[r,t[e][1]]}return[null,void 0]},qT=function(i){return typeof i=="string"?Vd(i.trim(),Dc.string):typeof i=="object"&&i!==null?Vd(i,Dc.object):[null,void 0]},Fc=function(i,t){var e=es(i);return{h:e.h,s:ne(e.s+100*t,0,100),l:e.l,a:e.a}},Uc=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},Xd=function(i,t){var e=es(i);return{h:e.h,s:e.s,l:ne(e.l+100*t,0,100),a:e.a}},Oc=function(){function i(t){this.parsed=qT(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return Pt(Uc(this.rgba),2)},i.prototype.isDark=function(){return Uc(this.rgba)<.5},i.prototype.isLight=function(){return Uc(this.rgba)>=.5},i.prototype.toHex=function(){return t=kc(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?en(Pt(255*o)):"","#"+en(e)+en(r)+en(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return kc(this.rgba)},i.prototype.toRgbString=function(){return t=kc(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o},i.prototype.toHsl=function(){return Wd(es(this.rgba))},i.prototype.toHslString=function(){return t=Wd(es(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o},i.prototype.toHsv=function(){return t=Yd(this.rgba),{h:Pt(t.h),s:Pt(t.s),v:Pt(t.v),a:Pt(t.a,3)};var t},i.prototype.invert=function(){return me({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),me(Fc(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),me(Fc(this.rgba,-t))},i.prototype.grayscale=function(){return me(Fc(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),me(Xd(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),me(Xd(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?me({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):Pt(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=es(this.rgba);return typeof t=="number"?me({h:t,s:e.s,l:e.l,a:e.a}):Pt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===me(t).toHex()},i}(),me=function(i){return i instanceof Oc?i:new Oc(i)},jd=[],qd=function(i){i.forEach(function(t){jd.indexOf(t)<0&&(t(Oc,Dc),jd.push(t))})}});function Qd(i,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"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,c,l=r[this.toHex()];if(l)return l;if(n?.closest){var h=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new i(e[f]).toRgb();for(var p in e){var g=(a=h,c=o[p],Math.pow(a.r-c.r,2)+Math.pow(a.g-c.g,2)+Math.pow(a.b-c.b,2));g<u&&(u=g,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),c=a==="transparent"?"#0000":e[a];return c?new i(c).toRgb():null},"name"])}var Jd=m(()=>{});var zr,V,It=m(()=>{Zd();Jd();qd([Qd]);zr=class rs{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 rs)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 r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="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,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=rs._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,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 r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<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,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(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,r,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,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=rs.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=me(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,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,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof rs||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}};zr.shared=new zr;zr._temp=new zr;zr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;V=zr});var tf,ef=m(()=>{"use strict";tf={cullArea:null,cullable:!1,cullableChildren:!0}});var rf,sf,of,Lc=m(()=>{"use strict";rf=Math.PI*2,sf=180/Math.PI,of=Math.PI/180});var $,Nc,ae=m(()=>{"use strict";$=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(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 Nc.x=0,Nc.y=0,Nc}},Nc=new $});var B,ZT,QT,K=m(()=>{Lc();ae();B=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,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,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new $;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new $;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,c=this.ty,l=1/(r*n+o*-s),h=t.x,u=t.y;return e.x=n*l*h+-o*l*u+(c*o-a*n)*l,e.y=r*l*u+-s*l*h+(-c*r+a*s)*l,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),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,c=t.ty,l=e.a,h=e.b,u=e.c,d=e.d;return this.a=r*l+s*u,this.b=r*h+s*d,this.c=o*l+n*u,this.d=o*h+n*d,this.tx=a*l+c*u+e.tx,this.ty=a*h+c*d+e.ty,this}setTransform(t,e,r,s,o,n,a,c,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-c)*n,this.d=Math.cos(a-c)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*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 r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*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,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),c=Math.atan2(r,e),l=Math.abs(a+c);return l<1e-5||Math.abs(rf-l)<1e-5?(t.rotation=c,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=c),t.scale.x=Math.sqrt(e*e+r*r),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*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*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 i;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 QT.identity()}static get shared(){return ZT.identity()}},ZT=new B,QT=new B});var Gt,rn=m(()=>{"use strict";Gt=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(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 j(i="default"){return Hc[i]===void 0&&(Hc[i]=-1),++Hc[i]}var Hc,kt=m(()=>{"use strict";Hc={default:-1}});function U(i,t,e=3){if(nf[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1
|
+
var w0=Object.create;var $a=Object.defineProperty;var P0=Object.getOwnPropertyDescriptor;var A0=Object.getOwnPropertyNames;var E0=Object.getPrototypeOf,C0=Object.prototype.hasOwnProperty;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var Ya=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),$u=(i,t)=>{for(var e in t)$a(i,e,{get:t[e],enumerable:!0})},M0=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of A0(t))!C0.call(i,s)&&s!==e&&$a(i,s,{get:()=>t[s],enumerable:!(r=P0(t,s))||r.enumerable});return i};var Io=(i,t,e)=>(e=i!=null?w0(E0(i)):{},M0(t||!i||!i.__esModule?$a(e,"default",{value:i,enumerable:!0}):e,i));var x,ja,Di,k,w=p(()=>{"use strict";x=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(x||{}),ja=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Di=(i,t)=>ja(i).priority??t,k={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(ja).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(ja).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>Di(n.value,e)-Di(o.value,e)))},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1)})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>Di(o,e)-Di(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e))}}});var ju=Ya((tP,Ka)=>{"use strict";var B0=Object.prototype.hasOwnProperty,Ut="~";function Oi(){}Object.create&&(Oi.prototype=Object.create(null),new Oi().__proto__||(Ut=!1));function R0(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function Yu(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new R0(e,r||i,s),n=Ut?Ut+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function Fo(i,t){--i._eventsCount===0?i._events=new Oi:delete i._events[t]}function Gt(){this._events=new Oi,this._eventsCount=0}Gt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)B0.call(e,r)&&t.push(Ut?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Gt.prototype.listeners=function(t){var e=Ut?Ut+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};Gt.prototype.listenerCount=function(t){var e=Ut?Ut+t:t,r=this._events[e];return r?r.fn?1:r.length:0};Gt.prototype.emit=function(t,e,r,s,o,n){var a=Ut?Ut+t:t;if(!this._events[a])return!1;var c=this._events[a],l=arguments.length,h,u;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,r),!0;case 4:return c.fn.call(c.context,e,r,s),!0;case 5:return c.fn.call(c.context,e,r,s,o),!0;case 6:return c.fn.call(c.context,e,r,s,o,n),!0}for(u=1,h=new Array(l-1);u<l;u++)h[u-1]=arguments[u];c.fn.apply(c.context,h)}else{var d=c.length,f;for(u=0;u<d;u++)switch(c[u].once&&this.removeListener(t,c[u].fn,void 0,!0),l){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,e);break;case 3:c[u].fn.call(c[u].context,e,r);break;case 4:c[u].fn.call(c[u].context,e,r,s);break;default:if(!h)for(f=1,h=new Array(l-1);f<l;f++)h[f-1]=arguments[f];c[u].fn.apply(c[u].context,h)}}return!0};Gt.prototype.on=function(t,e,r){return Yu(this,t,e,r,!1)};Gt.prototype.once=function(t,e,r){return Yu(this,t,e,r,!0)};Gt.prototype.removeListener=function(t,e,r,s){var o=Ut?Ut+t:t;if(!this._events[o])return this;if(!e)return Fo(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&Fo(this,o);else{for(var a=0,c=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&c.push(n[a]);c.length?this._events[o]=c.length===1?c[0]:c:Fo(this,o)}return this};Gt.prototype.removeAllListeners=function(t){var e;return t?(e=Ut?Ut+t:t,this._events[e]&&Fo(this,e)):(this._events=new Oi,this._eventsCount=0),this};Gt.prototype.off=Gt.prototype.removeListener;Gt.prototype.addListener=Gt.prototype.on;Gt.prefixed=Ut;Gt.EventEmitter=Gt;typeof Ka<"u"&&(Ka.exports=Gt)});var Ku,nt,kt=p(()=>{Ku=Io(ju(),1),nt=Ku.default});var G0,Be,St,re,id,qu,qa,k0,Uo,sd,od,Zu,Qu,Ju,Li,I0,F0,U0,D0,Ja,td,O0,Za,Qa,ed,tc,ue,rd,nd,ad=p(()=>{G0={grad:.9,turn:360,rad:360/(2*Math.PI)},Be=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},St=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},re=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},id=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},qu=function(i){return{r:re(i.r,0,255),g:re(i.g,0,255),b:re(i.b,0,255),a:re(i.a)}},qa=function(i){return{r:St(i.r),g:St(i.g),b:St(i.b),a:St(i.a,3)}},k0=/^#([0-9a-f]{3,8})$/i,Uo=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},sd=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-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}},od=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),c=r*(1-(1-t+o)*e),l=o%6;return{r:255*[r,a,n,n,c,r][l],g:255*[c,r,r,a,n,n][l],b:255*[n,n,c,r,r,a][l],a:s}},Zu=function(i){return{h:id(i.h),s:re(i.s,0,100),l:re(i.l,0,100),a:re(i.a)}},Qu=function(i){return{h:St(i.h),s:St(i.s),l:St(i.l),a:St(i.a,3)}},Ju=function(i){return od((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},Li=function(i){return{h:(t=sd(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s},I0=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,F0=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,U0=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D0=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ja={string:[[function(i){var t=k0.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?St(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?St(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=U0.exec(i)||D0.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:qu({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(i){var t=I0.exec(i)||F0.exec(i);if(!t)return null;var e,r,s=Zu({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(G0[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Ju(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Be(t)&&Be(e)&&Be(r)?qu({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Be(t)||!Be(e)||!Be(r))return null;var n=Zu({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return Ju(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Be(t)||!Be(e)||!Be(r))return null;var n=function(a){return{h:id(a.h),s:re(a.s,0,100),v:re(a.v,0,100),a:re(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return od(n)},"hsv"]]},td=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return[r,t[e][1]]}return[null,void 0]},O0=function(i){return typeof i=="string"?td(i.trim(),Ja.string):typeof i=="object"&&i!==null?td(i,Ja.object):[null,void 0]},Za=function(i,t){var e=Li(i);return{h:e.h,s:re(e.s+100*t,0,100),l:e.l,a:e.a}},Qa=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},ed=function(i,t){var e=Li(i);return{h:e.h,s:e.s,l:re(e.l+100*t,0,100),a:e.a}},tc=function(){function i(t){this.parsed=O0(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return St(Qa(this.rgba),2)},i.prototype.isDark=function(){return Qa(this.rgba)<.5},i.prototype.isLight=function(){return Qa(this.rgba)>=.5},i.prototype.toHex=function(){return t=qa(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?Uo(St(255*o)):"","#"+Uo(e)+Uo(r)+Uo(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return qa(this.rgba)},i.prototype.toRgbString=function(){return t=qa(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o},i.prototype.toHsl=function(){return Qu(Li(this.rgba))},i.prototype.toHslString=function(){return t=Qu(Li(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o},i.prototype.toHsv=function(){return t=sd(this.rgba),{h:St(t.h),s:St(t.s),v:St(t.v),a:St(t.a,3)};var t},i.prototype.invert=function(){return ue({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),ue(Za(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),ue(Za(this.rgba,-t))},i.prototype.grayscale=function(){return ue(Za(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),ue(ed(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),ue(ed(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?ue({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):St(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=Li(this.rgba);return typeof t=="number"?ue({h:t,s:e.s,l:e.l,a:e.a}):St(e.h)},i.prototype.isEqual=function(t){return this.toHex()===ue(t).toHex()},i}(),ue=function(i){return i instanceof tc?i:new tc(i)},rd=[],nd=function(i){i.forEach(function(t){rd.indexOf(t)<0&&(t(tc,Ja),rd.push(t))})}});function cd(i,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"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,c,l=r[this.toHex()];if(l)return l;if(n?.closest){var h=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new i(e[f]).toRgb();for(var m in e){var _=(a=h,c=o[m],Math.pow(a.r-c.r,2)+Math.pow(a.g-c.g,2)+Math.pow(a.b-c.b,2));_<u&&(u=_,d=m)}return d}},t.string.push([function(n){var a=n.toLowerCase(),c=a==="transparent"?"#0000":e[a];return c?new i(c).toRgb():null},"name"])}var ld=p(()=>{});var Gr,X,Mt=p(()=>{ad();ld();nd([cd]);Gr=class Ni{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 Ni)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 r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="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,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=Ni._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,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 r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<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,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(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,r,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,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=Ni.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=ue(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,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,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Ni||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}};Gr.shared=new Gr;Gr._temp=new Gr;Gr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;X=Gr});var hd,ud=p(()=>{"use strict";hd={cullArea:null,cullable:!1,cullableChildren:!0}});var dd,fd,pd,ec=p(()=>{"use strict";dd=Math.PI*2,fd=180/Math.PI,pd=Math.PI/180});var K,rc,ie=p(()=>{"use strict";K=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(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 rc.x=0,rc.y=0,rc}},rc=new K});var G,L0,N0,Z=p(()=>{ec();ie();G=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,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,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new K;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new K;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,c=this.ty,l=1/(r*n+o*-s),h=t.x,u=t.y;return e.x=n*l*h+-o*l*u+(c*o-a*n)*l,e.y=r*l*u+-s*l*h+(-c*r+a*s)*l,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),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,c=t.ty,l=e.a,h=e.b,u=e.c,d=e.d;return this.a=r*l+s*u,this.b=r*h+s*d,this.c=o*l+n*u,this.d=o*h+n*d,this.tx=a*l+c*u+e.tx,this.ty=a*h+c*d+e.ty,this}setTransform(t,e,r,s,o,n,a,c,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-c)*n,this.d=Math.cos(a-c)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*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 r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*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,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),c=Math.atan2(r,e),l=Math.abs(a+c);return l<1e-5||Math.abs(dd-l)<1e-5?(t.rotation=c,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=c),t.scale.x=Math.sqrt(e*e+r*r),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*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*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 i;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 N0.identity()}static get shared(){return L0.identity()}},L0=new G,N0=new G});var Bt,Do=p(()=>{"use strict";Bt=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(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 j(i="default"){return ic[i]===void 0&&(ic[i]=-1),++ic[i]}var ic,Rt=p(()=>{"use strict";ic={default:-1}});function D(i,t,e=3){if(md[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
2
2
|
Deprecated since v${i}`):(r=r.split(`
|
|
3
3
|
`).splice(e).join(`
|
|
4
4
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
5
5
|
Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
|
-
Deprecated since v${i}`),console.warn(r))),nf[t]=!0}var nf,H,af,ft=m(()=>{"use strict";nf={},H="8.0.0",af="8.3.4"});var xr,Wc=m(()=>{"use strict";xr=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;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?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 zc,W,Nt=m(()=>{Wc();zc=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 xr(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},W=new zc});var cf,lf=m(()=>{ft();cf={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){U("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function sn(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var Vc=m(()=>{"use strict"});var hf,uf=m(()=>{Vc();ft();hf={allowChildren:!0,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}sn(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t)},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||U(H,"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(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}}});var df,ff=m(()=>{"use strict";df={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e))},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e)},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i)}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i)}}}});var Le,on=m(()=>{"use strict";Le=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}});var Xc,nn,pf=m(()=>{E();Nt();Xc=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<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return W.get(r.maskClass,t)}return t}returnMaskEffect(t){W.return(t)}},nn=new Xc;G.handleByList(x.MaskEffect,nn._effectClasses)});var mf,gf=m(()=>{on();pf();mf={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),nn.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=nn.getMaskEffect(i),this.addEffect(this._maskEffect)))},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Le);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Le),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var xf,_f=m(()=>{ft();xf={label:null,get name(){return U(H,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){U(H,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o)}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,e);return e}}});var an,z,vt=m(()=>{ae();an=[new $,new $,new $,new $],z=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),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 i(0,0,0,0)}clone(){return new i(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.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,c=this.y,l=r*(1-s),h=r-l,u=a-l,d=a+o+l,f=c-l,p=c+n+l,g=a+h,_=a+o-h,b=c+h,y=c+n-h;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>g&&t<_&&e>b&&e<y)}intersects(t,e){if(!e){let A=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=A)return!1;let C=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>C}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=an[0].set(t.left,t.top),c=an[1].set(t.left,t.bottom),l=an[2].set(t.right,t.top),h=an[3].set(t.right,t.bottom);if(l.x<=a.x||c.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(c,c),e.apply(l,l),e.apply(h,h),Math.max(a.x,c.x,l.x,h.x)<=r||Math.min(a.x,c.x,l.x,h.x)>=s||Math.max(a.y,c.y,l.y,h.y)<=o||Math.min(a.y,c.y,l.y,h.y)>=n))return!1;let d=u*(c.y-a.y),f=u*(a.x-c.x),p=d*r+f*o,g=d*s+f*o,_=d*r+f*n,b=d*s+f*n;if(Math.max(p,g,_,b)<=d*a.x+f*a.y||Math.min(p,g,_,b)>=d*h.x+f*h.y)return!1;let y=u*(a.y-l.y),v=u*(l.x-a.x),S=y*r+v*o,P=y*s+v*o,T=y*r+v*n,w=y*s+v*n;return!(Math.max(S,P,T,w)<=y*a.x+v*a.y||Math.min(S,P,T,w)>=y*h.x+v*h.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),r=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(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=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=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=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=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var yf,it,Yt=m(()=>{K();vt();yf=new B,it=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=yf,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new z);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=yf,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,c=o.c,l=o.d,h=o.tx,u=o.ty,d=this.minX,f=this.minY,p=this.maxX,g=this.maxY,_=n*t+c*e+h,b=a*t+l*e+u;_<d&&(d=_),b<f&&(f=b),_>p&&(p=_),b>g&&(g=b),_=n*r+c*e+h,b=a*r+l*e+u,_<d&&(d=_),b<f&&(f=b),_>p&&(p=_),b>g&&(g=b),_=n*t+c*s+h,b=a*t+l*s+u,_<d&&(d=_),b<f&&(f=b),_>p&&(p=_),b>g&&(g=b),_=n*r+c*s+h,b=a*r+l*s+u,_<d&&(d=_),b<f&&(f=b),_>p&&(p=_),b>g&&(g=b),this.minX=d,this.minY=f,this.maxX=p,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.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c,d:l,tx:h,ty:u}=t,d=n*e+c*r+h,f=a*e+l*r+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+c*r+h,f=a*s+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+c*o+h,f=a*e+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+c*o+h,f=a*s+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(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 i(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,r,s){let o=this.minX,n=this.minY,a=this.maxX,c=this.maxY;s||(s=this.matrix);let l=s.a,h=s.b,u=s.c,d=s.d,f=s.tx,p=s.ty;for(let g=e;g<r;g+=2){let _=t[g],b=t[g+1],y=l*_+u*b+f,v=h*_+d*b+p;o=y<o?y:o,n=v<n?v:n,a=y>a?y:a,c=v>c?v:c}this.minX=o,this.minY=n,this.maxX=a,this.maxY=c}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 yt,re,_r=m(()=>{K();Wc();Yt();yt=new xr(B),re=new xr(it)});var JT,bf,vf=m(()=>{K();Yt();_r();JT=new B,bf={getFastGlobalBounds(i,t){t||(t=new it),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=re.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&(r.applyMatrix(n.worldTransform.copyTo(JT).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),re.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),re.return(r))}}});function Vr(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=yt.get().identity(),r=cn(i,s)):r=B.IDENTITY,Tf(i,e,r,t),s&&yt.return(s),e.isValid||e.set(0,0,0,0),e}function Tf(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=yt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=re.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else{i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)Tf(i.children[a],t,s,r)}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,B.IDENTITY),re.return(t)}r||yt.return(s)}function cn(i,t){let e=i.parent;return e&&(cn(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var is=m(()=>{K();_r()});function ln(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,c=e*o/255|0,l=r*n/255|0,h=s*a/255|0;return(c<<16)+(l<<8)+h}var jc=m(()=>{"use strict"});function Xr(i,t){return i===Sf?t:t===Sf?i:ln(i,t)}var Sf,$c=m(()=>{jc();Sf=16777215});function ss(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var wf,Pf=m(()=>{is();_r();$c();wf={getGlobalAlpha(i){if(i)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(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=cn(this,yt.get().identity());return i.appendFrom(this.localTransform,e),yt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?ss(this.renderGroup.worldColor):this.parentRenderGroup?ss(Xr(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Xr(t,e.localColor),e=e.parent;return ss(t)}}});function k(...i){Yc!==Ef&&(Yc++,Yc===Ef?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var Yc,Ef,st=m(()=>{"use strict";Yc=0,Ef=500});function jr(i,t,e){return t.clear(),e||(e=B.IDENTITY),Af(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function Af(i,t,e,r,s){let o;if(s)o=yt.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let c=i.localTransform;o=yt.get(),o.appendFrom(c,e)}let n=t,a=!!i.effects.length;if(a&&(t=re.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let c=i.children;for(let l=0;l<c.length;l++)Af(c[l],t,o,r,!1)}if(a){for(let c=0;c<i.effects.length;c++)i.effects[c].addLocalBounds?.(t,r);n.addBounds(t,B.IDENTITY),re.return(t)}yt.return(o)}var hn=m(()=>{K();_r()});function Kc(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&Kc(s,t)}return t.didChange}var Cf=m(()=>{"use strict"});var tS,Mf,Bf=m(()=>{K();Yt();is();hn();Cf();tS=new B,Mf={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new it});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),Kc(this,i),i.didChange&&jr(this,i.localBounds,tS),i.localBounds},getBounds(i,t){return Vr(this,i,t||new it)}}});var Rf,If=m(()=>{"use strict";Rf={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}}});function eS(i,t){return i._zIndex-t._zIndex}var Gf,kf=m(()=>{"use strict";Gf={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,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(eS))}}});var Ff,Uf=m(()=>{ae();_r();Ff={getGlobalPosition(i=new $,t=!1){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=!1){let r=this.getGlobalTransform(yt.get(),e);return t=r.apply(i,t),yt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(yt.get(),r);return e=s.applyInverse(i,e),yt.return(s),e}}});var $r,qc=m(()=>{kt();$r=class{constructor(){this.uid=j("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 Ne(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Zc(i){return!(i&i-1)&&!!i}var os=m(()=>{"use strict"});function un(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var Qc=m(()=>{"use strict"});function rS(i){let t=Df[i];return t===void 0&&(Df[i]=j("resource")),t}var Df,Of,dn,Jc=m(()=>{Dt();kt();ft();Df=Object.create(null);Of=class Lf extends nt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Lf.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){U(H,"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=rS(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Of.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};dn=Of});var Nf,tt,Kt=m(()=>{Dt();os();Qc();kt();Jc();Nf=class Hf extends nt{constructor(t={}){super(),this.options=t,this.uid=j("textureSource"),this._resourceType="textureSource",this._resourceId=j("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={...Hf.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 dn(un(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=j("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,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=j("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=Zc(this.pixelWidth)&&Zc(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Nf.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};tt=Nf});function iS(){for(let i=0;i<16;i++){let t=[];tl.push(t);for(let e=0;e<16;e++){let r=fn(yr[i]*yr[e]+vr[i]*br[e]),s=fn(br[i]*yr[e]+Tr[i]*br[e]),o=fn(yr[i]*vr[e]+vr[i]*Tr[e]),n=fn(br[i]*vr[e]+Tr[i]*Tr[e]);for(let a=0;a<16;a++)if(yr[a]===r&&br[a]===s&&vr[a]===o&&Tr[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new B;t.set(yr[i],br[i],vr[i],Tr[i],0,0),Wf.push(t)}}var yr,br,vr,Tr,tl,Wf,fn,ut,zf=m(()=>{K();yr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],br=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],vr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Tr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],tl=[],Wf=[],fn=Math.sign;iS();ut={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:i=>yr[i],uY:i=>br[i],vX:i=>vr[i],vY:i=>Tr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>tl[i][t],sub:(i,t)=>tl[i][ut.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?ut.S:ut.N:Math.abs(t)*2<=Math.abs(i)?i>0?ut.E:ut.W:t>0?i>0?ut.SE:ut.SW:i>0?ut.NE:ut.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Wf[ut.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var el,Vf=m(()=>{"use strict";el=()=>{}});var Sr,rl=m(()=>{E();Kt();Sr=class extends tt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),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}};Sr.extension=x.TextureSource});var Xf,Yr,il=m(()=>{K();Xf=new B,Yr=class{constructor(t,e){this.mapCoord=new B,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 r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(Xf.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Xf));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,c=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+c)/o.width,n[1]=(t.frame.y+a+c)/o.height,n[2]=(t.frame.x+t.frame.width-a+c)/o.width,n[3]=(t.frame.y+t.frame.height-a+c)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,!0}}});var M,et=m(()=>{Dt();zf();vt();kt();ft();Vf();rl();Kt();il();M=class extends nt{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:c,dynamic:l}={}){if(super(),this.uid=j("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new z,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new tt,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=c??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!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 Yr(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,c=e.height/s,l=this.rotate;if(l){let h=a/2,u=c/2,d=o+h,f=n+u;l=ut.add(l,ut.NW),t.x0=d+h*ut.uX(l),t.y0=f+u*ut.uY(l),l=ut.add(l,2),t.x1=d+h*ut.uX(l),t.y1=f+u*ut.uY(l),l=ut.add(l,2),t.x2=d+h*ut.uX(l),t.y2=f+u*ut.uY(l),l=ut.add(l,2),t.x3=d+h*ut.uX(l),t.y3=f+u*ut.uY(l)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+c,t.x3=o,t.y3=n+c}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 U(H,"Texture.baseTexture is now Texture.source"),this._source}};M.EMPTY=new M({label:"EMPTY",source:new tt({label:"EMPTY"})});M.EMPTY.destroy=el;M.WHITE=new M({source:new Sr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});M.WHITE.destroy=el});var sS,sl,pt,qe=m(()=>{os();Kt();et();sS=0,sl=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new tt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new M({source:s,label:`texturePool_${sS++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=Ne(o),n=Ne(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let c=this._texturePool[a].pop();return c||(c=this.createTexture(o,n,s)),c.source._resolution=r,c.source.width=o/r,c.source.height=n/r,c.source.pixelWidth=o,c.source.pixelHeight=n,c.frame.x=0,c.frame.y=0,c.frame.width=t,c.frame.height=e,c.updateUvs(),this._poolKeyHash[c.uid]=a,c}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._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 r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}},pt=new sl});var pn,jf=m(()=>{K();qc();qe();pn=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new B,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 $r,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 r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(pt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-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 r=0;r<e.length;r++)this.addChild(e[r])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new B),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new B),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new B),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function $f(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var Yf=m(()=>{"use strict"});var ol,nl,al,Kr,ns,wr,at,ge=m(()=>{Dt();It();ef();E();K();Lc();rn();kt();ft();Nt();lf();uf();ff();gf();_f();vf();Pf();Bf();If();kf();Uf();jf();Yf();ol=new Gt(null),nl=new Gt(null),al=new Gt(null,1,1),Kr=1,ns=2,wr=4,at=class i extends nt{constructor(t={}){super(),this.uid=j("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 B,this.relativeGroupTransform=new B,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Gt(this,0,0),this._scale=al,this._pivot=nl,this._skew=ol,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=[],$f(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){U("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),G.mixin(i,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||U(H,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,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,r),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=W.get(pn,this),this.groupTransform=B.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),W.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 B),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*sf}set angle(t){this.rotation=t*of}get pivot(){return this._pivot===nl&&(this._pivot=new Gt(this,0,0)),this._pivot}set pivot(t){this._pivot===nl&&(this._pivot=new Gt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===ol&&(this._skew=new Gt(this,0,0)),this._skew}set skew(t){this._skew===ol&&(this._skew=new Gt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===al&&(this._scale=new Gt(this,1,1)),this._scale}set scale(t){this._scale===al&&(this._scale=new Gt(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 r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.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,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,c=s._x,l=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-(c*e.a+l*e.c),e.ty=o._y-(c*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Kr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=V.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Kr,this._onUpdate())}get tint(){return ss(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ns,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|=wr,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|=wr,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|=wr,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<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};G.mixin(at,hf,bf,Ff,Rf,Mf,mf,xf,Gf,tf,cf,wf,df)});var Ze,mn=m(()=>{ae();Ze=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new $,this.page=new $,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,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,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 oS(i){return function(t){return t.test(i)}}function as(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=oS(e),o={apple:{phone:s(cl)&&!s(He),ipod:s(Kf),tablet:!s(cl)&&(s(qf)||op(t))&&!s(He),universal:s(Zf),device:(s(cl)||s(Kf)||s(qf)||s(Zf)||op(t))&&!s(He)},amazon:{phone:s(qr),tablet:!s(qr)&&s(gn),device:s(qr)||s(gn)},android:{phone:!s(He)&&s(qr)||!s(He)&&s(ll),tablet:!s(He)&&!s(qr)&&!s(ll)&&(s(gn)||s(Qf)),device:!s(He)&&(s(qr)||s(gn)||s(ll)||s(Qf))||s(/\bokhttp\b/i)},windows:{phone:s(He),tablet:s(Jf),device:s(He)||s(Jf)},other:{blackberry:s(tp),blackberry10:s(ep),opera:s(rp),firefox:s(sp),chrome:s(ip),device:s(tp)||s(ep)||s(rp)||s(sp)||s(ip)},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 cl,Kf,qf,Zf,ll,Qf,qr,gn,He,Jf,tp,ep,rp,ip,sp,op,hl=m(()=>{cl=/iPhone/i,Kf=/iPod/i,qf=/iPad/i,Zf=/\biOS-universal(?:.+)Mac\b/i,ll=/\bAndroid(?:.+)Mobile\b/i,Qf=/Android/i,qr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,gn=/Silk/i,He=/Windows Phone/i,Jf=/\bWindows(?:.+)ARM\b/i,tp=/BlackBerry/i,ep=/BB10/i,rp=/Opera Mini/i,ip=/\b(CriOS|Chrome)(?:.+)Mobile/i,sp=/Mobile(?:.+)Firefox\b/i,op=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var np=m(()=>{hl();hl()});var nS,ap,cp=m(()=>{np();nS=as.default??as,ap=nS(globalThis.navigator)});var aS,xn,cS,lS,lp,hp,hS,uS,dS,ul,dp,fp=m(()=>{mn();E();cp();Vc();aS=9,xn=100,cS=0,lS=0,lp=2,hp=1,hS=-1e3,uS=-1e3,dS=2,ul=class up{constructor(t,e=ap){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=`${hp}px`,t.style.height=`${hp}px`,t.style.position="absolute",t.style.top=`${hS}px`,t.style.left=`${uS}px`,t.style.zIndex=dS.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=`${xn}px`,this._div.style.height=`${xn}px`,this._div.style.position="absolute",this._div.style.top=`${cS}px`,this._div.style.left=`${lS}px`,this._div.style.zIndex=lp.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 r=0;r<e.length;r++)this._updateAccessibleObjects(e[r])}init(t){let r={accessibilityOptions:{...up.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r))}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,sn(this._children,r,1))}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,c=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*c}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*c}px`,o.style.height=`${n.height*a.d*l}px`}else{this._capHitArea(n);let a=this._renderer.resolution,c=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*c}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*c}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> 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:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-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=`
|
|
6
|
+
Deprecated since v${i}`),console.warn(r))),md[t]=!0}var md,W,gd,dt=p(()=>{"use strict";md={},W="8.0.0",gd="8.3.4"});var hr,sc=p(()=>{"use strict";hr=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;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?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 oc,z,Dt=p(()=>{sc();oc=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 hr(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},z=new oc});var xd,_d=p(()=>{dt();xd={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){D("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function Oo(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var nc=p(()=>{"use strict"});var yd,bd=p(()=>{nc();dt();yd={allowChildren:!0,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Oo(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t)},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||D(W,"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(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}}});var vd,Td=p(()=>{"use strict";vd={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e))},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e)},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i)}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i)}}}});var Re,Lo=p(()=>{"use strict";Re=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}});var ac,No,Sd=p(()=>{w();Dt();ac=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<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return z.get(r.maskClass,t)}return t}returnMaskEffect(t){z.return(t)}},No=new ac;k.handleByList(x.MaskEffect,No._effectClasses)});var wd,Pd=p(()=>{Lo();Sd();wd={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),No.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=No.getMaskEffect(i),this.addEffect(this._maskEffect)))},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Re);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Re),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var Ad,Ed=p(()=>{dt();Ad={label:null,get name(){return D(W,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){D(W,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o)}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,e);return e}}});var Ho,V,bt=p(()=>{ie();Ho=[new K,new K,new K,new K],V=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),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 i(0,0,0,0)}clone(){return new i(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.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,c=this.y,l=r*(1-s),h=r-l,u=a-l,d=a+o+l,f=c-l,m=c+n+l,_=a+h,g=a+o-h,b=c+h,y=c+n-h;return t>=u&&t<=d&&e>=f&&e<=m&&!(t>_&&t<g&&e>b&&e<y)}intersects(t,e){if(!e){let A=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=A)return!1;let E=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>E}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=Ho[0].set(t.left,t.top),c=Ho[1].set(t.left,t.bottom),l=Ho[2].set(t.right,t.top),h=Ho[3].set(t.right,t.bottom);if(l.x<=a.x||c.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(c,c),e.apply(l,l),e.apply(h,h),Math.max(a.x,c.x,l.x,h.x)<=r||Math.min(a.x,c.x,l.x,h.x)>=s||Math.max(a.y,c.y,l.y,h.y)<=o||Math.min(a.y,c.y,l.y,h.y)>=n))return!1;let d=u*(c.y-a.y),f=u*(a.x-c.x),m=d*r+f*o,_=d*s+f*o,g=d*r+f*n,b=d*s+f*n;if(Math.max(m,_,g,b)<=d*a.x+f*a.y||Math.min(m,_,g,b)>=d*h.x+f*h.y)return!1;let y=u*(a.y-l.y),v=u*(l.x-a.x),T=y*r+v*o,R=y*s+v*o,S=y*r+v*n,P=y*s+v*n;return!(Math.max(T,R,S,P)<=y*a.x+v*a.y||Math.min(T,R,S,P)>=y*h.x+v*h.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),r=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(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=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=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=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=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var Cd,rt,Xt=p(()=>{Z();bt();Cd=new G,rt=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Cd,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new V);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=Cd,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,c=o.c,l=o.d,h=o.tx,u=o.ty,d=this.minX,f=this.minY,m=this.maxX,_=this.maxY,g=n*t+c*e+h,b=a*t+l*e+u;g<d&&(d=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),g=n*r+c*e+h,b=a*r+l*e+u,g<d&&(d=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),g=n*t+c*s+h,b=a*t+l*s+u,g<d&&(d=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),g=n*r+c*s+h,b=a*r+l*s+u,g<d&&(d=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),this.minX=d,this.minY=f,this.maxX=m,this.maxY=_}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.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c,d:l,tx:h,ty:u}=t,d=n*e+c*r+h,f=a*e+l*r+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+c*r+h,f=a*s+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+c*o+h,f=a*e+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+c*o+h,f=a*s+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(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 i(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,r,s){let o=this.minX,n=this.minY,a=this.maxX,c=this.maxY;s||(s=this.matrix);let l=s.a,h=s.b,u=s.c,d=s.d,f=s.tx,m=s.ty;for(let _=e;_<r;_+=2){let g=t[_],b=t[_+1],y=l*g+u*b+f,v=h*g+d*b+m;o=y<o?y:o,n=v<n?v:n,a=y>a?y:a,c=v>c?v:c}this.minX=o,this.minY=n,this.maxX=a,this.maxY=c}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 _t,Qt,ur=p(()=>{Z();sc();Xt();_t=new hr(G),Qt=new hr(rt)});var H0,Md,Bd=p(()=>{Z();Xt();ur();H0=new G,Md={getFastGlobalBounds(i,t){t||(t=new rt),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=Qt.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&(r.applyMatrix(n.worldTransform.copyTo(H0).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Qt.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Qt.return(r))}}});function kr(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=_t.get().identity(),r=Wo(i,s)):r=G.IDENTITY,Rd(i,e,r,t),s&&_t.return(s),e.isValid||e.set(0,0,0,0),e}function Rd(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=_t.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=Qt.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else{i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)Rd(i.children[a],t,s,r)}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,G.IDENTITY),Qt.return(t)}r||_t.return(s)}function Wo(i,t){let e=i.parent;return e&&(Wo(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var Hi=p(()=>{Z();ur()});function zo(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,c=e*o/255|0,l=r*n/255|0,h=s*a/255|0;return(c<<16)+(l<<8)+h}var cc=p(()=>{"use strict"});function Ir(i,t){return i===Gd?t:t===Gd?i:zo(i,t)}var Gd,lc=p(()=>{cc();Gd=16777215});function Wi(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var kd,Id=p(()=>{Hi();ur();lc();kd={getGlobalAlpha(i){if(i)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(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=Wo(this,_t.get().identity());return i.appendFrom(this.localTransform,e),_t.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?Wi(this.renderGroup.worldColor):this.parentRenderGroup?Wi(Ir(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Ir(t,e.localColor),e=e.parent;return Wi(t)}}});function F(...i){hc!==Fd&&(hc++,hc===Fd?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var hc,Fd,it=p(()=>{"use strict";hc=0,Fd=500});function Fr(i,t,e){return t.clear(),e||(e=G.IDENTITY),Ud(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function Ud(i,t,e,r,s){let o;if(s)o=_t.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let c=i.localTransform;o=_t.get(),o.appendFrom(c,e)}let n=t,a=!!i.effects.length;if(a&&(t=Qt.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let c=i.children;for(let l=0;l<c.length;l++)Ud(c[l],t,o,r,!1)}if(a){for(let c=0;c<i.effects.length;c++)i.effects[c].addLocalBounds?.(t,r);n.addBounds(t,G.IDENTITY),Qt.return(t)}_t.return(o)}var Vo=p(()=>{Z();ur()});function uc(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&uc(s,t)}return t.didChange}var Dd=p(()=>{"use strict"});var W0,Od,Ld=p(()=>{Z();Xt();Hi();Vo();Dd();W0=new G,Od={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new rt});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),uc(this,i),i.didChange&&Fr(this,i.localBounds,W0),i.localBounds},getBounds(i,t){return kr(this,i,t||new rt)}}});var Nd,Hd=p(()=>{"use strict";Nd={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}}});function z0(i,t){return i._zIndex-t._zIndex}var Wd,zd=p(()=>{"use strict";Wd={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,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(z0))}}});var Vd,Xd=p(()=>{ie();ur();Vd={getGlobalPosition(i=new K,t=!1){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=!1){let r=this.getGlobalTransform(_t.get(),e);return t=r.apply(i,t),_t.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(_t.get(),r);return e=s.applyInverse(i,e),_t.return(s),e}}});var Ur,dc=p(()=>{Rt();Ur=class{constructor(){this.uid=j("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 Ge(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function fc(i){return!(i&i-1)&&!!i}var zi=p(()=>{"use strict"});function Xo(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var pc=p(()=>{"use strict"});function V0(i){let t=$d[i];return t===void 0&&($d[i]=j("resource")),t}var $d,Yd,$o,mc=p(()=>{kt();Rt();dt();$d=Object.create(null);Yd=class jd extends nt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...jd.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){D(W,"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=V0(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Yd.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};$o=Yd});var Kd,tt,$t=p(()=>{kt();zi();pc();Rt();mc();Kd=class qd extends nt{constructor(t={}){super(),this.options=t,this.uid=j("textureSource"),this._resourceType="textureSource",this._resourceId=j("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={...qd.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 $o(Xo(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=j("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,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=j("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=fc(this.pixelWidth)&&fc(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Kd.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};tt=Kd});function X0(){for(let i=0;i<16;i++){let t=[];gc.push(t);for(let e=0;e<16;e++){let r=Yo(dr[i]*dr[e]+pr[i]*fr[e]),s=Yo(fr[i]*dr[e]+mr[i]*fr[e]),o=Yo(dr[i]*pr[e]+pr[i]*mr[e]),n=Yo(fr[i]*pr[e]+mr[i]*mr[e]);for(let a=0;a<16;a++)if(dr[a]===r&&fr[a]===s&&pr[a]===o&&mr[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new G;t.set(dr[i],fr[i],pr[i],mr[i],0,0),Zd.push(t)}}var dr,fr,pr,mr,gc,Zd,Yo,ht,Qd=p(()=>{Z();dr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],fr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],pr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],mr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],gc=[],Zd=[],Yo=Math.sign;X0();ht={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:i=>dr[i],uY:i=>fr[i],vX:i=>pr[i],vY:i=>mr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>gc[i][t],sub:(i,t)=>gc[i][ht.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?ht.S:ht.N:Math.abs(t)*2<=Math.abs(i)?i>0?ht.E:ht.W:t>0?i>0?ht.SE:ht.SW:i>0?ht.NE:ht.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Zd[ht.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var xc,Jd=p(()=>{"use strict";xc=()=>{}});var gr,_c=p(()=>{w();$t();gr=class extends tt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),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}};gr.extension=x.TextureSource});var tf,Dr,yc=p(()=>{Z();tf=new G,Dr=class{constructor(t,e){this.mapCoord=new G,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 r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(tf.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(tf));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,c=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+c)/o.width,n[1]=(t.frame.y+a+c)/o.height,n[2]=(t.frame.x+t.frame.width-a+c)/o.width,n[3]=(t.frame.y+t.frame.height-a+c)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,!0}}});var C,et=p(()=>{kt();Qd();bt();Rt();dt();Jd();_c();$t();yc();C=class extends nt{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:c,dynamic:l}={}){if(super(),this.uid=j("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new V,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new tt,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=c??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!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 Dr(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,c=e.height/s,l=this.rotate;if(l){let h=a/2,u=c/2,d=o+h,f=n+u;l=ht.add(l,ht.NW),t.x0=d+h*ht.uX(l),t.y0=f+u*ht.uY(l),l=ht.add(l,2),t.x1=d+h*ht.uX(l),t.y1=f+u*ht.uY(l),l=ht.add(l,2),t.x2=d+h*ht.uX(l),t.y2=f+u*ht.uY(l),l=ht.add(l,2),t.x3=d+h*ht.uX(l),t.y3=f+u*ht.uY(l)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+c,t.x3=o,t.y3=n+c}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 D(W,"Texture.baseTexture is now Texture.source"),this._source}};C.EMPTY=new C({label:"EMPTY",source:new tt({label:"EMPTY"})});C.EMPTY.destroy=xc;C.WHITE=new C({source:new gr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});C.WHITE.destroy=xc});var $0,bc,ft,We=p(()=>{zi();$t();et();$0=0,bc=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new tt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new C({source:s,label:`texturePool_${$0++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=Ge(o),n=Ge(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let c=this._texturePool[a].pop();return c||(c=this.createTexture(o,n,s)),c.source._resolution=r,c.source.width=o/r,c.source.height=n/r,c.source.pixelWidth=o,c.source.pixelHeight=n,c.frame.x=0,c.frame.y=0,c.frame.width=t,c.frame.height=e,c.updateUvs(),this._poolKeyHash[c.uid]=a,c}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._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 r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}},ft=new bc});var jo,ef=p(()=>{Z();dc();We();jo=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 Ur,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 r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(ft.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-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 r=0;r<e.length;r++)this.addChild(e[r])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new G),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new G),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new G),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function rf(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var sf=p(()=>{"use strict"});var vc,Tc,Sc,Or,Vi,xr,at,de=p(()=>{kt();Mt();ud();w();Z();ec();Do();Rt();dt();Dt();_d();bd();Td();Pd();Ed();Bd();Id();Ld();Hd();zd();Xd();ef();sf();vc=new Bt(null),Tc=new Bt(null),Sc=new Bt(null,1,1),Or=1,Vi=2,xr=4,at=class i extends nt{constructor(t={}){super(),this.uid=j("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 Bt(this,0,0),this._scale=Sc,this._pivot=Tc,this._skew=vc,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=[],rf(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){D("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),k.mixin(i,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||D(W,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,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,r),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=z.get(jo,this),this.groupTransform=G.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),z.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 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(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*fd}set angle(t){this.rotation=t*pd}get pivot(){return this._pivot===Tc&&(this._pivot=new Bt(this,0,0)),this._pivot}set pivot(t){this._pivot===Tc&&(this._pivot=new Bt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===vc&&(this._skew=new Bt(this,0,0)),this._skew}set skew(t){this._skew===vc&&(this._skew=new Bt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Sc&&(this._scale=new Bt(this,1,1)),this._scale}set scale(t){this._scale===Sc&&(this._scale=new Bt(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 r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.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,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,c=s._x,l=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-(c*e.a+l*e.c),e.ty=o._y-(c*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Or,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=X.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Or,this._onUpdate())}get tint(){return Wi(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Vi,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|=xr,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|=xr,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|=xr,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<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};k.mixin(at,yd,Md,Vd,Nd,Od,wd,Ad,Wd,hd,xd,kd,vd)});var ze,Ko=p(()=>{ie();ze=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new K,this.page=new K,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,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,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 Y0(i){return function(t){return t.test(i)}}function Xi(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=Y0(e),o={apple:{phone:s(wc)&&!s(ke),ipod:s(of),tablet:!s(wc)&&(s(nf)||mf(t))&&!s(ke),universal:s(af),device:(s(wc)||s(of)||s(nf)||s(af)||mf(t))&&!s(ke)},amazon:{phone:s(Lr),tablet:!s(Lr)&&s(qo),device:s(Lr)||s(qo)},android:{phone:!s(ke)&&s(Lr)||!s(ke)&&s(Pc),tablet:!s(ke)&&!s(Lr)&&!s(Pc)&&(s(qo)||s(cf)),device:!s(ke)&&(s(Lr)||s(qo)||s(Pc)||s(cf))||s(/\bokhttp\b/i)},windows:{phone:s(ke),tablet:s(lf),device:s(ke)||s(lf)},other:{blackberry:s(hf),blackberry10:s(uf),opera:s(df),firefox:s(pf),chrome:s(ff),device:s(hf)||s(uf)||s(df)||s(pf)||s(ff)},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 wc,of,nf,af,Pc,cf,Lr,qo,ke,lf,hf,uf,df,ff,pf,mf,Ac=p(()=>{wc=/iPhone/i,of=/iPod/i,nf=/iPad/i,af=/\biOS-universal(?:.+)Mac\b/i,Pc=/\bAndroid(?:.+)Mobile\b/i,cf=/Android/i,Lr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,qo=/Silk/i,ke=/Windows Phone/i,lf=/\bWindows(?:.+)ARM\b/i,hf=/BlackBerry/i,uf=/BB10/i,df=/Opera Mini/i,ff=/\b(CriOS|Chrome)(?:.+)Mobile/i,pf=/Mobile(?:.+)Firefox\b/i,mf=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var gf=p(()=>{Ac();Ac()});var j0,xf,_f=p(()=>{gf();j0=Xi.default??Xi,xf=j0(globalThis.navigator)});var K0,Zo,q0,Z0,yf,bf,Q0,J0,tT,Ec,Tf,Sf=p(()=>{Ko();w();_f();nc();K0=9,Zo=100,q0=0,Z0=0,yf=2,bf=1,Q0=-1e3,J0=-1e3,tT=2,Ec=class vf{constructor(t,e=xf){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=`${bf}px`,t.style.height=`${bf}px`,t.style.position="absolute",t.style.top=`${Q0}px`,t.style.left=`${J0}px`,t.style.zIndex=tT.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=`${Zo}px`,this._div.style.height=`${Zo}px`,this._div.style.position="absolute",this._div.style.top=`${q0}px`,this._div.style.left=`${Z0}px`,this._div.style.zIndex=yf.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 r=0;r<e.length;r++)this._updateAccessibleObjects(e[r])}init(t){let r={accessibilityOptions:{...vf.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r))}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Oo(this._children,r,1))}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,c=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*c}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*c}px`,o.style.height=`${n.height*a.d*l}px`}else{this._capHitArea(n);let a=this._renderer.resolution,c=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*c}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*c}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> 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:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-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=`
|
|
7
7
|
color: transparent;
|
|
8
8
|
pointer-events: none;
|
|
9
9
|
padding: 0;
|
|
@@ -16,9 +16,9 @@ Deprecated since v${i}`),console.warn(r))),nf[t]=!0}var nf,H,af,ft=m(()=>{"use s
|
|
|
16
16
|
-webkit-user-select: none;
|
|
17
17
|
-moz-user-select: none;
|
|
18
18
|
-ms-user-select: none;
|
|
19
|
-
`,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${xn}px`,e.style.height=`${xn}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=lp.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:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new Ze(s),{target:r});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!==aS||!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()}};ul.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"accessibility"};ul.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};dp=ul});var pp,mp=m(()=>{"use strict";pp={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var gp=m(()=>{E();ge();fp();mp();G.add(dp);G.mixin(at,pp)});var cs,xp=m(()=>{E();cs=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,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o}this.renderer.resize(e,r),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}};cs.extension=x.Application});var Qe,_n=m(()=>{"use strict";Qe=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Qe||{})});var Zr,_p=m(()=>{"use strict";Zr=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,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 yp,qt,ls=m(()=>{_n();_p();yp=class ie{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 Zr(null,null,1/0),this.deltaMS=1/ie.targetFPMS,this.elapsedMS=1/ie.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,r=Qe.NORMAL){return this._addListener(new Zr(t,e,r))}addOnce(t,e,r=Qe.NORMAL){return this._addListener(new Zr(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.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._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*ie.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,ie.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!ie._shared){let t=ie._shared=new ie;t.autoStart=!0,t._protected=!0}return ie._shared}static get system(){if(!ie._system){let t=ie._system=new ie;t.autoStart=!0,t._protected=!0}return ie._system}};yp.targetFPMS=.06;qt=yp});var hs,bp=m(()=>{E();_n();ls();hs=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,Qe.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?qt.shared:new qt,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};hs.extension=x.Application});var dl=m(()=>{E();xp();bp();G.add(cs);G.add(hs)});var fl,Se,pl=m(()=>{_n();ls();fl=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||(qt.system.add(this._tickerUpdate,this,Qe.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(qt.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<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},Se=new fl});var We,yn=m(()=>{ae();mn();We=class extends Ze{constructor(){super(...arguments),this.client=new $,this.movement=new $,this.offset=new $,this.global=new $,this.screen=new $}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,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,c,l,h,u,d,f,p,g){throw new Error("Method not implemented.")}}});var Ht,ml=m(()=>{yn();Ht=class extends We{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 we,gl=m(()=>{yn();we=class extends We{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};we.DOM_DELTA_PIXEL=0;we.DOM_DELTA_LINE=1;we.DOM_DELTA_PAGE=2});var fS,pS,us,bn,vp=m(()=>{Dt();ae();st();pl();yn();ml();gl();fS=2048,pS=new $,us=new $,bn=class{constructor(t){this.dispatch=new nt,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((r,s)=>r.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 r=0,s=e.length;r<s;r++)e[r].fn(t);else k(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Se.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,pS.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let r=0;r<fS&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Se.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children;for(let u=h.length-1;u>=0;u--){let d=h[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,r,s,o,n||o(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let c=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:c&&!o(t,r)&&s(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Se.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children,l=r;for(let h=c.length-1;h>=0;h--){let u=c[h],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,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,r)?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,us),!t.hitArea.contains(us.x,us.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,us),t.containsPoint(us)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ht)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Ht)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let c=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,c,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(o)){let h=this.createPointerEvent(t,"pointerleave",o);for(h.eventPhase=h.AT_TARGET;h.target&&!e.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),r&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(o!==e.target){let c=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,c);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let h=o?.parent;for(;h&&h!==this.rootTarget.parent&&h!==e.target;)h=h.parent;if(!h||h===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),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(l)}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")),r&&(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 Ht)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"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=r.composedPath(),this.freeEvent(r),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Ht)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&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),r&&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 Ht)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let c=r.button===2;this.notifyTarget(r,c?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let c=s.clicksByButton[t.button];if(c.target===a.target&&e-c.timeStamp<200?++c.clickCount:c.clickCount=1,c.target=a.target,c.timeStamp=e,a.detail=c.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Ht)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;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 we)){k("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 r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Ht);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(we);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Ht);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ht&&e instanceof Ht&&(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)}copyMouseData(t,e){t instanceof We&&e instanceof We&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,!0),r[s].fn.call(r[s].context,t)}}});var mS,gS,_l,vn,yl=m(()=>{E();vp();pl();ml();gl();mS=1,gS={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},_l=class xl{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new bn(null),Se.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Ht(null),this._rootWheelEvent=new we(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...xl.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=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:r}=this.renderer;this.setTargetElement(e),this.resolution=r,xl._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 r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r);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 r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Se.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Se.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Se.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Se.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"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 r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=mS),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}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=gS[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}};_l.extension={name:"events",type:[x.WebGLSystem,x.CanvasSystem,x.WebGPUSystem],priority:-1};_l.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};vn=_l});var Tp,Sp=m(()=>{yl();mn();Tp={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(i){this.eventMode=i?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??vn.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){let r=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;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,c=this;s&&s.addEventListener("abort",()=>{c.off(i,a,n)}),o?c.once(i,a,n):c.on(i,a,n)},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s)},dispatchEvent(i){if(!(i instanceof Ze))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var wp=m(()=>{E();ge();yl();Sp();G.add(vn);G.mixin(at,Tp)});var ds,Pp=m(()=>{E();ds=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 r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,c=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${c}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-c}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};ds.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"dom"}});var Je,Tn=m(()=>{Yt();ge();Je=class extends at{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new it(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:r,y:s}=t;return r>=e.minX&&r<=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,r){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,c=a.length;for(let l=0;l<c;l++)a[l].collectRenderables(t,e,r)}}});var Ep=m(()=>{E();Pp();G.add(ds)});var Et,ze=m(()=>{"use strict";Et=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Et||{})});var Ap,Cp=m(()=>{"use strict";Ap={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var Mp,D,ct=m(()=>{Cp();Mp=Ap,D={get(){return Mp},set(i){Mp=i}}});function xe(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function fs(i){return i.split("?")[0].split("#")[0]}function xS(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _S(i,t,e){return i.replace(new RegExp(xS(t),"g"),e)}function yS(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let c=e.lastIndexOf("/");if(c!==e.length-1){c===-1?(e="",r=0):(e=e.slice(0,c),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var Tt,Pr=m(()=>{ct();Tt={toPosix(i){return _S(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){xe(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(xe(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=fs(this.toPosix(t??D.get().getBaseUrl())),s=fs(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?Tt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(xe(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=yS(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return xe(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(xe(r),r.length>0)if(t===void 0)t=r;else{let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(xe(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){xe(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){xe(i),t&&xe(t),i=fs(this.toPosix(i));let e=0,r=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let c=i.charCodeAt(o);if(c===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(c===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){xe(i),i=fs(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=!1,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){xe(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=fs(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,c=-1,l=!0,h=i.length-1,u=0;for(;h>=s;--h){if(e=i.charCodeAt(h),e===47){if(!l){a=h+1;break}continue}c===-1&&(l=!1,c=h+1),e===46?n===-1?n=h:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||c===-1||u===0||u===1&&n===c-1&&n===a+1?c!==-1&&(a===0&&r?t.base=t.name=i.slice(1,c):t.base=t.name=i.slice(a,c)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,c)):(t.name=i.slice(a,n),t.base=i.slice(a,c)),t.ext=i.slice(n,c)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Wt,ps=m(()=>{"use strict";Wt=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function Bp(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Bp(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function Rp(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),Bp(i,s,0,e,r)}else r.push(i);return r}var Ip=m(()=>{"use strict"});var Er,Sn=m(()=>{"use strict";Er=i=>!Array.isArray(i)});function bS(i){return i.split(".").pop().split("?").shift().split("#").shift()}var se,Qr=m(()=>{st();Pr();ps();Ip();Sn();se=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(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return Wt(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&k("[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 r=[],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,c;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),c=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(t,h));r.push(...l),c=[...a,...l]}this.add({...o,alias:c,src:n})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&k(`[Resolver] already has key: ${o} overwriting`)},Wt(e).forEach(o=>{let{src:n}=o,{data:a,format:c,loadParser:l}=o,h=Wt(n).map(f=>typeof f=="string"?Rp(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let d=[];h.forEach(f=>{f.forEach(p=>{let g={};if(typeof p!="object"){g.src=p;for(let _=0;_<this._parsers.length;_++){let b=this._parsers[_];if(b.test(p)){g=b.parse(p);break}}}else a=p.data??a,c=p.format??c,l=p.loadParser??l,g={...g,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this._buildResolvedAsset(g,{aliases:u,data:a,format:c,loadParser:l}),d.push(g)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=Er(t);t=Wt(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let c in n){let l=n[c];a[this._extractAssetIdFromBundle(s,c)]=l}r[s]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=Er(t);t=Wt(t);let r={};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(c=>{let l=o.filter(h=>h[a]?h[a]===c:!1);l.length&&(o=l)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.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:r,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=Tt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??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??bS(t.src),t}};se.RETINA_PREFIX=/@([0-9\.]+)x/});var ms,bl=m(()=>{"use strict";ms=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var Gp,vl,kp=m(()=>{vt();et();Gp=class gs{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof M?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,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<=gs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=gs.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,c=null,l=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,h=new z(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new z(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new z(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(c=new z(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new M({source:this.textureSource,frame:a,orig:h,trim:c,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*gs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*gs.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Gp.BATCH_SIZE=1e3;vl=Gp});function Fp(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s]}),!e){let s=Tt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Fp([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var vS,Up,Dp=m(()=>{ze();Qr();bl();E();et();Pr();kp();vS=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Up={extension:x.Asset,cache:{test:i=>i instanceof vl,getCacheableAssets:(i,t)=>Fp(i,t,!1)},resolver:{extension:{type:x.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&vS.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(se.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:x.LoadParser,priority:Et.Normal,name:"spritesheetLoader"},async testParse(i,t){return Tt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=Tt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof M)a=r;else{let h=ms(n+(s??i.meta.image),t.src);a=(await e.load([{src:h,data:o}]))[h]}let c=new vl(a.source,i);await c.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let d of l){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=ms(f,t.src),h.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(h);c.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[c].concat(c.linkedSheets.filter(f=>f!==d))})}return c},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var wn=m(()=>{E();Dp();G.add(Up)});function Pn(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s}var Tl=m(()=>{"use strict"});var zt,En=m(()=>{rn();et();Tl();ft();Tn();zt=class i extends Je{constructor(t=M.EMPTY){t instanceof M&&(t={texture:t});let{texture:e=M.EMPTY,anchor:r,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 Gt({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r: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 i(t):new i(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 Pn(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return U("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}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 An(i,t,e){let r=TS;i.measurable=!0,Vr(i,e,r),t.addBoundsMask(r),i.measurable=!1}var TS,Sl=m(()=>{Yt();is();TS=new it});function Cn(i,t,e){let r=re.get();i.measurable=!0;let s=yt.get().identity(),o=Op(i,e,s);jr(i,r,o),i.measurable=!1,t.addBoundsMask(r),yt.return(s),re.return(r)}function Op(i,t,e){return i?(i!==t&&(Op(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(k("Mask bounds, renderable is not inside the root container"),e)}var wl=m(()=>{hn();_r();st()});var xs,Lp=m(()=>{E();En();Sl();wl();xs=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 zt),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||An(this.mask,t,e)}addLocalBounds(t,e){Cn(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof zt}};xs.extension=x.MaskEffect});var _s,Np=m(()=>{E();_s=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"}};_s.extension=x.MaskEffect});var ys,Hp=m(()=>{E();ge();Sl();wl();ys=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){An(this.mask,t,e)}addLocalBounds(t,e){Cn(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof at}};ys.extension=x.MaskEffect});var Ot,Jr=m(()=>{ct();E();Kt();Ot=class extends tt{constructor(t){t.resource||(t.resource=D.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,r=this._resolution){let s=super.resize(t,e,r);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"))}};Ot.extension=x.TextureSource});var Zt,ti=m(()=>{ct();E();st();Kt();Zt=class extends tt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=D.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,k("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}};Zt.extension=x.TextureSource});async function Mn(){return Pl??(Pl=(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 r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,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(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Pl}var Pl,El=m(()=>{"use strict"});var Bn,ei,Al=m(()=>{E();ls();El();Kt();Bn=class Wp extends tt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Wp.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=qt.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 Mn(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,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&&(qt.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||(qt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(qt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Bn.extension=x.TextureSource;Bn.defaultOptions={...tt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Bn.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};ei=Bn});var Cl,Q,tr=m(()=>{st();ps();Cl=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||k(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Wt(t),s;for(let c=0;c<this.parsers.length;c++){let l=this.parsers[c];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(c=>{o.set(c,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(c=>{this._cacheMap.set(c,a)}),n.forEach(c=>{let l=s?s[c]:e;this._cache.has(c)&&this._cache.get(c)!==l&&k("[Cache] already has key:",c),this._cache.set(c,o.get(c))})}remove(t){if(!this._cacheMap.has(t)){k(`[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}},Q=new Cl});function zp(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Ml.length;s++){let o=Ml[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function Vp(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&Q.has(r))return Q.get(r);let o=new M({source:zp(s)});return o.on("destroy",()=>{Q.has(r)&&Q.remove(r)}),t||Q.set(r,o),o}function Xp(i,t=!1){return typeof i=="string"?Q.get(i):i instanceof tt?new M({source:i}):Vp(i,t)}var Ml,Bl=m(()=>{tr();E();Kt();et();Ml=[];G.handleByList(x.TextureSource,Ml);M.from=Xp;tt.from=zp});var Rn=m(()=>{E();Lp();Np();Hp();rl();Jr();ti();Al();Bl();G.add(xs,_s,ys,ei,Zt,Ot,Sr)});var At,er=m(()=>{"use strict";At=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&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 r in e)e[r]._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 r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function Gn(){return(!In||In?.isContextLost())&&(In=D.get().createCanvas().getContext("webgl",{})),In}var In,Rl=m(()=>{ct()});function wS(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
20
|
-
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function
|
|
21
|
-
`)});function ce(){if(ri)return ri;let i=Gn();return ri=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),ri=jp(ri,i),i.getExtension("WEBGL_lose_context")?.loseContext(),ri}var ri,Ar=m(()=>{Rl();$p();ri=null});function ii(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return Yp[e]||PS(i,t,e)}function PS(i,t,e){let r={},s=0;Il||(Il=ce());for(let n=0;n<Il;n++){let a=n<t?i[n]:M.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new At(r);return Yp[e]=o,o}var Yp,Il,kn=m(()=>{er();et();Ar();Yp={};Il=0});var Pe,Gl=m(()=>{"use strict";Pe=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 bs(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var kl=m(()=>{"use strict"});var Kp,lt,Cr=m(()=>{"use strict";Kp={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},lt=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(lt||{})});function Ve(i,t){return t.alphaMode==="no-premultiply-alpha"&&Kp[i]||i}var vs=m(()=>{Cr()});var Fn,qp=m(()=>{"use strict";Fn=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function Zp(){return Ul>0?Jp[--Ul]:new Fl}function Qp(i){Jp[Ul++]=i}var Fl,Jp,Ul,Ts,tm,em,rm=m(()=>{kt();Gl();kl();vs();Ar();qp();Fl=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Fn,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Jp=[],Ul=0;Ts=0,tm=class Un{constructor(t={}){this.uid=j("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Un.defaultOptions.maxTextures=Un.defaultOptions.maxTextures??ce(),t={...Un.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Pe(r*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;t<this.batchIndex;t++)Qp(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return!r&&r!==0?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=Zp(),s=r.textures;s.clear();let o=e[this.elementStart],n=Ve(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let c=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){let _=e[g];e[g]=null;let y=_.texture._source,v=Ve(_.blendMode,y),S=n!==v||a!==_.topology;if(y._batchTick===Ts&&!S){_._textureId=y._textureBindLocation,u+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,c,l,_._attributeStart,_._textureId),this.packQuadIndex(h,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,c,l,_._attributeStart,_._textureId),this.packIndex(_,h,_._indexStart,_._attributeStart/this.vertexSize)),_._batch=r;continue}y._batchTick=Ts,(s.count>=p||S)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=v,a=_.topology,r=Zp(),s=r.textures,s.clear(),++Ts),_._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,_._batch=r,u+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,c,l,_._attributeStart,_._textureId),this.packQuadIndex(h,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,c,l,_._attributeStart,_._textureId),this.packIndex(_,h,_._indexStart,_._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,u-d,s,n,a,t,f),d=u,++Ts),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,r,s,o,n,a,c){t.gpuBindGroup=null,t.bindGroup=null,t.action=c,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++Ts,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),r=new Pe(e);bs(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else bs(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,c=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-c}destroy(){for(let t=0;t<this.batches.length;t++)Qp(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};tm.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};em=tm});var X,Xe=m(()=>{"use strict";X=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(X||{})});var gt,rr=m(()=>{Dt();kt();Xe();gt=class extends nt{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=j("buffer"),this._resourceType="buffer",this._resourceId=j("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,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,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&X.STATIC)}set static(t){t?this.descriptor.usage|=X.STATIC:this.descriptor.usage&=~X.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&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<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=j("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function Dl(i,t){if(!(i instanceof gt)){let e=t?X.INDEX:X.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=X.INDEX|X.COPY_DST):(i=new Float32Array(i),e=X.VERTEX|X.COPY_DST)),i=new gt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var im=m(()=>{rr();Xe()});function sm(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,c=-1/0,l=s.BYTES_PER_ELEMENT,h=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let d=h;d<s.length;d+=u){let f=s[d],p=s[d+1];f>a&&(a=f),p>c&&(c=p),f<o&&(o=f),p<n&&(n=p)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=c,e}var om=m(()=>{"use strict"});function ES(i){return(i instanceof gt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Dl(i.buffer,!1),i}var le,si=m(()=>{Dt();Yt();kt();rr();im();om();le=class extends nt{constructor(t={}){super(),this.uid=j("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new it,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),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 r=ES(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=Dl(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,sm(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 AS,CS,Dn,nm=m(()=>{rr();Xe();si();AS=new Float32Array(1),CS=new Uint32Array(1),Dn=class extends le{constructor(){let e=new gt({data:AS,label:"attribute-batch-buffer",usage:X.VERTEX|X.COPY_DST,shrinkToFit:!1}),r=new gt({data:CS,label:"index-batch-buffer",usage:X.INDEX|X.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:r})}}});function je(i,t){let e=am[i];return e===void 0&&(Ol[t]===void 0&&(Ol[t]=1),am[i]=e=Ol[t]++),e}var Ol,am,Ss=m(()=>{"use strict";Ol=Object.create(null),am=Object.create(null)});function cm(){if(!On){On="mediump";let i=Gn();i&&i.getShaderPrecisionFormat&&(On=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return On}var On,lm=m(()=>{Rl()});function hm(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
|
|
19
|
+
`,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${Zo}px`,e.style.height=`${Zo}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=yf.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:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new ze(s),{target:r});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!==K0||!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()}};Ec.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"accessibility"};Ec.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};Tf=Ec});var wf,Pf=p(()=>{"use strict";wf={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var Af=p(()=>{w();de();Sf();Pf();k.add(Tf);k.mixin(at,wf)});var $i,Ef=p(()=>{w();$i=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,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o}this.renderer.resize(e,r),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}};$i.extension=x.Application});var Ve,Qo=p(()=>{"use strict";Ve=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Ve||{})});var Nr,Cf=p(()=>{"use strict";Nr=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,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 Mf,Yt,Yi=p(()=>{Qo();Cf();Mf=class Jt{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 Nr(null,null,1/0),this.deltaMS=1/Jt.targetFPMS,this.elapsedMS=1/Jt.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,r=Ve.NORMAL){return this._addListener(new Nr(t,e,r))}addOnce(t,e,r=Ve.NORMAL){return this._addListener(new Nr(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.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._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Jt.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Jt.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Jt._shared){let t=Jt._shared=new Jt;t.autoStart=!0,t._protected=!0}return Jt._shared}static get system(){if(!Jt._system){let t=Jt._system=new Jt;t.autoStart=!0,t._protected=!0}return Jt._system}};Mf.targetFPMS=.06;Yt=Mf});var ji,Bf=p(()=>{w();Qo();Yi();ji=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,Ve.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Yt.shared:new Yt,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};ji.extension=x.Application});var Cc=p(()=>{w();Ef();Bf();k.add($i);k.add(ji)});var Mc,_e,Bc=p(()=>{Qo();Yi();Mc=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||(Yt.system.add(this._tickerUpdate,this,Ve.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Yt.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<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},_e=new Mc});var Ie,Jo=p(()=>{ie();Ko();Ie=class extends ze{constructor(){super(...arguments),this.client=new K,this.movement=new K,this.offset=new K,this.global=new K,this.screen=new K}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,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,c,l,h,u,d,f,m,_){throw new Error("Method not implemented.")}}});var Ot,Rc=p(()=>{Jo();Ot=class extends Ie{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 ye,Gc=p(()=>{Jo();ye=class extends Ie{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};ye.DOM_DELTA_PIXEL=0;ye.DOM_DELTA_LINE=1;ye.DOM_DELTA_PAGE=2});var eT,rT,Ki,tn,Rf=p(()=>{kt();ie();it();Bc();Jo();Rc();Gc();eT=2048,rT=new K,Ki=new K,tn=class{constructor(t){this.dispatch=new nt,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((r,s)=>r.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 r=0,s=e.length;r<s;r++)e[r].fn(t);else F(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){_e.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,rT.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let r=0;r<eT&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(_e.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children;for(let u=h.length-1;u>=0;u--){let d=h[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,r,s,o,n||o(t,r));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 c=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:c&&!o(t,r)&&s(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(_e.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children,l=r;for(let h=c.length-1;h>=0;h--){let u=c[h],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,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,r)?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,Ki),!t.hitArea.contains(Ki.x,Ki.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,Ki),t.containsPoint(Ki)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ot)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Ot)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let c=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,c,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(o)){let h=this.createPointerEvent(t,"pointerleave",o);for(h.eventPhase=h.AT_TARGET;h.target&&!e.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),r&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(o!==e.target){let c=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,c);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let h=o?.parent;for(;h&&h!==this.rootTarget.parent&&h!==e.target;)h=h.parent;if(!h||h===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),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(l)}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")),r&&(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 Ot)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"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=r.composedPath(),this.freeEvent(r),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Ot)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&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),r&&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 Ot)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let c=r.button===2;this.notifyTarget(r,c?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let c=s.clicksByButton[t.button];if(c.target===a.target&&e-c.timeStamp<200?++c.clickCount:c.clickCount=1,c.target=a.target,c.timeStamp=e,a.detail=c.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Ot)){F("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;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 ye)){F("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 r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Ot);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(ye);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Ot);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ot&&e instanceof Ot&&(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)}copyMouseData(t,e){t instanceof Ie&&e instanceof Ie&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,!0),r[s].fn.call(r[s].context,t)}}});var iT,sT,Ic,en,Fc=p(()=>{w();Rf();Bc();Rc();Gc();iT=1,sT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ic=class kc{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new tn(null),_e.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Ot(null),this._rootWheelEvent=new ye(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...kc.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=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:r}=this.renderer;this.setTargetElement(e),this.resolution=r,kc._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 r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r);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 r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,_e.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,_e.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;_e.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;_e.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"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 r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=iT),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}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=sT[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}};Ic.extension={name:"events",type:[x.WebGLSystem,x.CanvasSystem,x.WebGPUSystem],priority:-1};Ic.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};en=Ic});var Gf,kf=p(()=>{Fc();Ko();Gf={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(i){this.eventMode=i?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??en.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){let r=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;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,c=this;s&&s.addEventListener("abort",()=>{c.off(i,a,n)}),o?c.once(i,a,n):c.on(i,a,n)},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s)},dispatchEvent(i){if(!(i instanceof ze))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var If=p(()=>{w();de();Fc();kf();k.add(en);k.mixin(at,Gf)});var qi,Ff=p(()=>{w();qi=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 r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,c=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${c}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-c}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};qi.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"dom"}});var Xe,rn=p(()=>{Xt();de();Xe=class extends at{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new rt(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:r,y:s}=t;return r>=e.minX&&r<=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,r){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,c=a.length;for(let l=0;l<c;l++)a[l].collectRenderables(t,e,r)}}});var Uf=p(()=>{w();Ff();k.add(qi)});var wt,Fe=p(()=>{"use strict";wt=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(wt||{})});var Df,Of=p(()=>{"use strict";Df={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var Lf,O,ct=p(()=>{Of();Lf=Df,O={get(){return Lf},set(i){Lf=i}}});function fe(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Zi(i){return i.split("?")[0].split("#")[0]}function oT(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nT(i,t,e){return i.replace(new RegExp(oT(t),"g"),e)}function aT(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let c=e.lastIndexOf("/");if(c!==e.length-1){c===-1?(e="",r=0):(e=e.slice(0,c),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var vt,_r=p(()=>{ct();vt={toPosix(i){return nT(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){fe(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(fe(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=Zi(this.toPosix(t??O.get().getBaseUrl())),s=Zi(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?vt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(fe(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=aT(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return fe(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(fe(r),r.length>0)if(t===void 0)t=r;else{let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(fe(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){fe(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){fe(i),t&&fe(t),i=Zi(this.toPosix(i));let e=0,r=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let c=i.charCodeAt(o);if(c===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(c===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){fe(i),i=Zi(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=!1,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){fe(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Zi(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,c=-1,l=!0,h=i.length-1,u=0;for(;h>=s;--h){if(e=i.charCodeAt(h),e===47){if(!l){a=h+1;break}continue}c===-1&&(l=!1,c=h+1),e===46?n===-1?n=h:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||c===-1||u===0||u===1&&n===c-1&&n===a+1?c!==-1&&(a===0&&r?t.base=t.name=i.slice(1,c):t.base=t.name=i.slice(a,c)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,c)):(t.name=i.slice(a,n),t.base=i.slice(a,c)),t.ext=i.slice(n,c)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Lt,Qi=p(()=>{"use strict";Lt=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function Nf(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Nf(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function Hf(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),Nf(i,s,0,e,r)}else r.push(i);return r}var Wf=p(()=>{"use strict"});var yr,sn=p(()=>{"use strict";yr=i=>!Array.isArray(i)});function cT(i){return i.split(".").pop().split("?").shift().split("#").shift()}var te,Hr=p(()=>{it();_r();Qi();Wf();sn();te=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(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return Lt(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&F("[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 r=[],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,c;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),c=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(t,h));r.push(...l),c=[...a,...l]}this.add({...o,alias:c,src:n})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&F(`[Resolver] already has key: ${o} overwriting`)},Lt(e).forEach(o=>{let{src:n}=o,{data:a,format:c,loadParser:l}=o,h=Lt(n).map(f=>typeof f=="string"?Hf(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let d=[];h.forEach(f=>{f.forEach(m=>{let _={};if(typeof m!="object"){_.src=m;for(let g=0;g<this._parsers.length;g++){let b=this._parsers[g];if(b.test(m)){_=b.parse(m);break}}}else a=m.data??a,c=m.format??c,l=m.loadParser??l,_={..._,...m};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:u,data:a,format:c,loadParser:l}),d.push(_)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=yr(t);t=Lt(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let c in n){let l=n[c];a[this._extractAssetIdFromBundle(s,c)]=l}r[s]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=yr(t);t=Lt(t);let r={};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(c=>{let l=o.filter(h=>h[a]?h[a]===c:!1);l.length&&(o=l)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.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:r,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=vt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??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??cT(t.src),t}};te.RETINA_PREFIX=/@([0-9\.]+)x/});var Ji,Uc=p(()=>{"use strict";Ji=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var zf,Dc,Vf=p(()=>{bt();et();zf=class ts{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof C?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,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<=ts.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=ts.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,c=null,l=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,h=new V(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new V(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new V(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(c=new V(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new C({source:this.textureSource,frame:a,orig:h,trim:c,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*ts.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*ts.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};zf.BATCH_SIZE=1e3;Dc=zf});function Xf(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s]}),!e){let s=vt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Xf([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var lT,$f,Yf=p(()=>{Fe();Hr();Uc();w();et();_r();Vf();lT=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];$f={extension:x.Asset,cache:{test:i=>i instanceof Dc,getCacheableAssets:(i,t)=>Xf(i,t,!1)},resolver:{extension:{type:x.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&lT.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(te.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:x.LoadParser,priority:wt.Normal,name:"spritesheetLoader"},async testParse(i,t){return vt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=vt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof C)a=r;else{let h=Ji(n+(s??i.meta.image),t.src);a=(await e.load([{src:h,data:o}]))[h]}let c=new Dc(a.source,i);await c.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let d of l){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=Ji(f,t.src),h.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(h);c.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[c].concat(c.linkedSheets.filter(f=>f!==d))})}return c},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var on=p(()=>{w();Yf();k.add($f)});function nn(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s}var Oc=p(()=>{"use strict"});var Nt,an=p(()=>{Do();et();Oc();dt();rn();Nt=class i extends Xe{constructor(t=C.EMPTY){t instanceof C&&(t={texture:t});let{texture:e=C.EMPTY,anchor:r,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 Bt({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r: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 C?new i(t):new i(C.from(t,e))}set texture(t){t||(t=C.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 nn(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return D("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}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 cn(i,t,e){let r=hT;i.measurable=!0,kr(i,e,r),t.addBoundsMask(r),i.measurable=!1}var hT,Lc=p(()=>{Xt();Hi();hT=new rt});function ln(i,t,e){let r=Qt.get();i.measurable=!0;let s=_t.get().identity(),o=jf(i,e,s);Fr(i,r,o),i.measurable=!1,t.addBoundsMask(r),_t.return(s),Qt.return(r)}function jf(i,t,e){return i?(i!==t&&(jf(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(F("Mask bounds, renderable is not inside the root container"),e)}var Nc=p(()=>{Vo();ur();it()});var es,Kf=p(()=>{w();an();Lc();Nc();es=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 Nt),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||cn(this.mask,t,e)}addLocalBounds(t,e){ln(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Nt}};es.extension=x.MaskEffect});var rs,qf=p(()=>{w();rs=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"}};rs.extension=x.MaskEffect});var is,Zf=p(()=>{w();de();Lc();Nc();is=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){cn(this.mask,t,e)}addLocalBounds(t,e){ln(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof at}};is.extension=x.MaskEffect});var It,Wr=p(()=>{ct();w();$t();It=class extends tt{constructor(t){t.resource||(t.resource=O.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,r=this._resolution){let s=super.resize(t,e,r);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"))}};It.extension=x.TextureSource});var jt,zr=p(()=>{ct();w();it();$t();jt=class extends tt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=O.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,F("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}};jt.extension=x.TextureSource});async function hn(){return Hc??(Hc=(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 r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,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(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Hc}var Hc,Wc=p(()=>{"use strict"});var un,Vr,zc=p(()=>{w();Yi();Wc();$t();un=class Qf extends tt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Qf.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=Yt.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 hn(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,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&&(Yt.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||(Yt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Yt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};un.extension=x.TextureSource;un.defaultOptions={...tt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};un.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Vr=un});var Vc,J,$e=p(()=>{it();Qi();Vc=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||F(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Lt(t),s;for(let c=0;c<this.parsers.length;c++){let l=this.parsers[c];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(c=>{o.set(c,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(c=>{this._cacheMap.set(c,a)}),n.forEach(c=>{let l=s?s[c]:e;this._cache.has(c)&&this._cache.get(c)!==l&&F("[Cache] already has key:",c),this._cache.set(c,o.get(c))})}remove(t){if(!this._cacheMap.has(t)){F(`[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}},J=new Vc});function Jf(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Xc.length;s++){let o=Xc[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function tp(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&J.has(r))return J.get(r);let o=new C({source:Jf(s)});return o.on("destroy",()=>{J.has(r)&&J.remove(r)}),t||J.set(r,o),o}function ep(i,t=!1){return typeof i=="string"?J.get(i):i instanceof tt?new C({source:i}):tp(i,t)}var Xc,$c=p(()=>{$e();w();$t();et();Xc=[];k.handleByList(x.TextureSource,Xc);C.from=ep;tt.from=Jf});var dn=p(()=>{w();Kf();qf();Zf();_c();Wr();zr();zc();$c();k.add(es,rs,is,Vr,jt,It,gr)});var Pt,Ye=p(()=>{"use strict";Pt=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&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 r in e)e[r]._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 r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function pn(){return(!fn||fn?.isContextLost())&&(fn=O.get().createCanvas().getContext("webgl",{})),fn}var fn,Yc=p(()=>{ct()});function dT(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
20
|
+
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function rp(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=uT.replace(/%forloop%/gi,dT(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}}finally{t.deleteShader(e)}return i}var uT,ip=p(()=>{"use strict";uT=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
21
|
+
`)});function se(){if(Xr)return Xr;let i=pn();return Xr=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),Xr=rp(Xr,i),i.getExtension("WEBGL_lose_context")?.loseContext(),Xr}var Xr,br=p(()=>{Yc();ip();Xr=null});function $r(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return sp[e]||fT(i,t,e)}function fT(i,t,e){let r={},s=0;jc||(jc=se());for(let n=0;n<jc;n++){let a=n<t?i[n]:C.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new Pt(r);return sp[e]=o,o}var sp,jc,mn=p(()=>{Ye();et();br();sp={};jc=0});var be,Kc=p(()=>{"use strict";be=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 ss(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var qc=p(()=>{"use strict"});var op,lt,vr=p(()=>{"use strict";op={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},lt=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(lt||{})});function Ue(i,t){return t.alphaMode==="no-premultiply-alpha"&&op[i]||i}var os=p(()=>{vr()});var gn,np=p(()=>{"use strict";gn=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function ap(){return Qc>0?lp[--Qc]:new Zc}function cp(i){lp[Qc++]=i}var Zc,lp,Qc,ns,hp,up,dp=p(()=>{Rt();Kc();qc();os();br();np();Zc=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new gn,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},lp=[],Qc=0;ns=0,hp=class xn{constructor(t={}){this.uid=j("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],xn.defaultOptions.maxTextures=xn.defaultOptions.maxTextures??se(),t={...xn.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new be(r*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;t<this.batchIndex;t++)cp(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return!r&&r!==0?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=ap(),s=r.textures;s.clear();let o=e[this.elementStart],n=Ue(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let c=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",m=this.maxTextures;for(let _=this.elementStart;_<this.elementSize;++_){let g=e[_];e[_]=null;let y=g.texture._source,v=Ue(g.blendMode,y),T=n!==v||a!==g.topology;if(y._batchTick===ns&&!T){g._textureId=y._textureBindLocation,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,c,l,g._attributeStart,g._textureId),this.packQuadIndex(h,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,c,l,g._attributeStart,g._textureId),this.packIndex(g,h,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=r;continue}y._batchTick=ns,(s.count>=m||T)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=v,a=g.topology,r=ap(),s=r.textures,s.clear(),++ns),g._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,g._batch=r,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,c,l,g._attributeStart,g._textureId),this.packQuadIndex(h,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,c,l,g._attributeStart,g._textureId),this.packIndex(g,h,g._indexStart,g._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,u-d,s,n,a,t,f),d=u,++ns),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,r,s,o,n,a,c){t.gpuBindGroup=null,t.bindGroup=null,t.action=c,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++ns,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),r=new be(e);ss(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else ss(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,c=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-c}destroy(){for(let t=0;t<this.batches.length;t++)cp(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};hp.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};up=hp});var Y,De=p(()=>{"use strict";Y=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(Y||{})});var mt,je=p(()=>{kt();Rt();De();mt=class extends nt{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=j("buffer"),this._resourceType="buffer",this._resourceId=j("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,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,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&Y.STATIC)}set static(t){t?this.descriptor.usage|=Y.STATIC:this.descriptor.usage&=~Y.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&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<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=j("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function Jc(i,t){if(!(i instanceof mt)){let e=t?Y.INDEX:Y.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=Y.INDEX|Y.COPY_DST):(i=new Float32Array(i),e=Y.VERTEX|Y.COPY_DST)),i=new mt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var fp=p(()=>{je();De()});function pp(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,c=-1/0,l=s.BYTES_PER_ELEMENT,h=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let d=h;d<s.length;d+=u){let f=s[d],m=s[d+1];f>a&&(a=f),m>c&&(c=m),f<o&&(o=f),m<n&&(n=m)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=c,e}var mp=p(()=>{"use strict"});function pT(i){return(i instanceof mt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Jc(i.buffer,!1),i}var oe,Yr=p(()=>{kt();Xt();Rt();je();fp();mp();oe=class extends nt{constructor(t={}){super(),this.uid=j("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new rt,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),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 r=pT(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=Jc(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,pp(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 mT,gT,_n,gp=p(()=>{je();De();Yr();mT=new Float32Array(1),gT=new Uint32Array(1),_n=class extends oe{constructor(){let e=new mt({data:mT,label:"attribute-batch-buffer",usage:Y.VERTEX|Y.COPY_DST,shrinkToFit:!1}),r=new mt({data:gT,label:"index-batch-buffer",usage:Y.INDEX|Y.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:r})}}});function Oe(i,t){let e=xp[i];return e===void 0&&(tl[t]===void 0&&(tl[t]=1),xp[i]=e=tl[t]++),e}var tl,xp,as=p(()=>{"use strict";tl=Object.create(null),xp=Object.create(null)});function _p(){if(!yn){yn="mediump";let i=pn();i&&i.getShaderPrecisionFormat&&(yn=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return yn}var yn,yp=p(()=>{Yc()});function bp(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
|
|
22
22
|
|
|
23
23
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
24
24
|
#define in varying
|
|
@@ -33,27 +33,27 @@ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function jp(i,t){if(i===0)th
|
|
|
33
33
|
#define out varying
|
|
34
34
|
#endif
|
|
35
35
|
${i}
|
|
36
|
-
`}var
|
|
37
|
-
${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var
|
|
38
|
-
${i}`:i}var
|
|
39
|
-
${i}`}var
|
|
36
|
+
`}var vp=p(()=>{"use strict"});function Tp(i,t,e){let r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(i.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
|
|
37
|
+
${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var Sp=p(()=>{"use strict"});function wp(i,t){return t?`#version 300 es
|
|
38
|
+
${i}`:i}var Pp=p(()=>{"use strict"});function Ap(i,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?xT:_T;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,i.indexOf("#define SHADER_NAME")!==-1?i:`${`#define SHADER_NAME ${t}`}
|
|
39
|
+
${i}`}var xT,_T,Ep=p(()=>{"use strict";xT={},_T={}});function Cp(i,t){return t?i.replace("#version 300 es",""):i}var Mp=p(()=>{"use strict"});var el,rl,Bp,ne,Tr=p(()=>{as();yp();vp();Sp();Pp();Ep();Mp();el={stripVersion:Cp,ensurePrecision:Tp,addProgramDefines:bp,setProgramName:Ap,insertVersion:wp},rl=Object.create(null),Bp=class il{constructor(t){t={...il.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:_p()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(el).forEach(n=>{let a=r[n];s=el[n](s,a,!0),o=el[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Oe(`${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 rl[e]||(rl[e]=new il(t)),rl[e]}};Bp.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};ne=Bp});function Kt(i){return Rp[i]??Rp.float32}var Rp,Sr=p(()=>{"use strict";Rp={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 Gp({source:i,entryPoint:t}){let e={},r=i.indexOf(`fn ${t}`);if(r!==-1){let s=i.indexOf("->",r);if(s!==-1){let o=i.substring(r,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 c=yT[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:c,stride:Kt(c).stride,offset:0,instance:!1,start:0}}}}return e}var yT,kp=p(()=>{Sr();yT={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"}});function bn(i){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,c=/struct\s+(\w+)/,l=i.match(t)?.map(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(r)[1],10),name:u.match(s)[2],isUniform:u.match(s)[1]==="<uniform>",type:u.match(o)[1]}));if(!l)return{groups:[],structs:[]};let h=i.match(n)?.map(u=>{let d=u.match(c)[1],f=u.match(a).reduce((m,_)=>{let[g,b]=_.split(":");return m[g.trim()]=b.trim(),m},{});return f?{name:d,members:f}:null}).filter(({name:u})=>l.some(d=>d.type===u))??[];return{groups:l,structs:h}}var Ip=p(()=>{"use strict"});var jr,Fp=p(()=>{"use strict";jr=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(jr||{})});function Up({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]=[]),r.isUniform?t[r.group].push({binding:r.binding,visibility:jr.VERTEX|jr.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:jr.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:jr.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var Dp=p(()=>{Fp()});function Op({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]={}),t[r.group][r.name]=r.binding}return t}var Lp=p(()=>{"use strict"});function Np(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...i.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:o}}var Hp=p(()=>{"use strict"});var sl,ae,Kr=p(()=>{as();kp();Ip();Dp();Lp();Hp();sl=Object.create(null),ae=class i{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:r,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=r,e.source===r.source){let a=bn(e.source);this.structsAndGroups=a}else{let a=bn(r.source),c=bn(e.source);this.structsAndGroups=Np(a,c)}this.layout=s??Op(this.structsAndGroups),this.gpuLayout=o??Up(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,r=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Oe(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Gp(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 sl[e]||(sl[e]=new i(t)),sl[e]}}});function ol(i,t,e){if(i)for(let r in i){let s=r.toLocaleLowerCase(),o=t[s];if(o){let n=i[r];r==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n)}else F(`${r} placement hook does not exist in shader`)}}var Wp=p(()=>{it()});function nl(i){let t={};return(i.match(bT)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var bT,zp=p(()=>{"use strict";bT=/\{\{(.*?)\}\}/g});function Vp(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function al(i,t,e=!1){let r=[];Vp(t,r),i.forEach(a=>{a.header&&Vp(a.header,r)});let s=r;e&&s.sort();let o=s.map((a,c)=>` @location(${c}) ${a},`).join(`
|
|
40
40
|
`),n=t.replace(/@in\s+[^;]+;\s*/g,"");return n=n.replace("{{in}}",`
|
|
41
41
|
${o}
|
|
42
|
-
`),n}var
|
|
43
|
-
`),o=e.sort().map(c=>` var ${
|
|
42
|
+
`),n}var Xp=p(()=>{"use strict"});function $p(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function vT(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function TT(i){let t=/@.*?\s+/g;return i.replace(t,"")}function Yp(i,t){let e=[];$p(t,e),i.forEach(c=>{c.header&&$p(c.header,e)});let r=0,s=e.sort().map(c=>c.indexOf("builtin")>-1?c:`@location(${r++}) ${c}`).join(`,
|
|
43
|
+
`),o=e.sort().map(c=>` var ${TT(c)};`).join(`
|
|
44
44
|
`),n=`return VSOutput(
|
|
45
|
-
${e.sort().map(c=>` ${
|
|
45
|
+
${e.sort().map(c=>` ${vT(c)}`).join(`,
|
|
46
46
|
`)});`,a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
|
|
47
47
|
${s}
|
|
48
48
|
`),a=a.replace("{{start}}",`
|
|
49
49
|
${o}
|
|
50
50
|
`),a=a.replace("{{return}}",`
|
|
51
51
|
${n}
|
|
52
|
-
`),a}var
|
|
52
|
+
`),a}var jp=p(()=>{"use strict"});function cl(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
|
|
53
53
|
`).length?e=e.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
54
54
|
${s.join(`
|
|
55
55
|
`)}
|
|
56
|
-
//----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}var
|
|
56
|
+
//----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}var Kp=p(()=>{"use strict"});function qp({template:i,bits:t}){let e=Qp(i,t);if(Ke[e])return Ke[e];let{vertex:r,fragment:s}=wT(i,t);return Ke[e]=Jp(r,s,t),Ke[e]}function Zp({template:i,bits:t}){let e=Qp(i,t);return Ke[e]||(Ke[e]=Jp(i.vertex,i.fragment,t)),Ke[e]}function wT(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=al(e,i.vertex,!0);s=Yp(e,s);let o=al(r,i.fragment,!0);return{vertex:s,fragment:o}}function Qp(i,t){return t.map(e=>(ll.has(e)||ll.set(e,ST++),ll.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function Jp(i,t,e){let r=nl(i),s=nl(t);return e.forEach(o=>{ol(o.vertex,r,o.name),ol(o.fragment,s,o.name)}),{vertex:cl(i,r),fragment:cl(t,s)}}var Ke,ll,ST,tm=p(()=>{Wp();zp();Xp();jp();Kp();Ke=Object.create(null),ll=new Map,ST=0});var em,rm,im,sm,om=p(()=>{"use strict";em=`
|
|
57
57
|
@in aPosition: vec2<f32>;
|
|
58
58
|
@in aUV: vec2<f32>;
|
|
59
59
|
|
|
@@ -97,7 +97,7 @@ ${s.join(`
|
|
|
97
97
|
|
|
98
98
|
{{return}}
|
|
99
99
|
};
|
|
100
|
-
`,
|
|
100
|
+
`,rm=`
|
|
101
101
|
@in vUV : vec2<f32>;
|
|
102
102
|
@in vColor : vec4<f32>;
|
|
103
103
|
|
|
@@ -120,7 +120,7 @@ ${s.join(`
|
|
|
120
120
|
|
|
121
121
|
return finalColor;
|
|
122
122
|
};
|
|
123
|
-
|
|
123
|
+
`,im=`
|
|
124
124
|
in vec2 aPosition;
|
|
125
125
|
in vec2 aUV;
|
|
126
126
|
|
|
@@ -156,7 +156,7 @@ ${s.join(`
|
|
|
156
156
|
|
|
157
157
|
{{end}}
|
|
158
158
|
}
|
|
159
|
-
`,
|
|
159
|
+
`,sm=`
|
|
160
160
|
|
|
161
161
|
in vec4 vColor;
|
|
162
162
|
in vec2 vUV;
|
|
@@ -177,7 +177,7 @@ ${s.join(`
|
|
|
177
177
|
|
|
178
178
|
{{end}}
|
|
179
179
|
}
|
|
180
|
-
`});var
|
|
180
|
+
`});var nm,am,cm=p(()=>{"use strict";nm={name:"global-uniforms-bit",vertex:{header:`
|
|
181
181
|
struct GlobalUniforms {
|
|
182
182
|
uProjectionMatrix:mat3x3<f32>,
|
|
183
183
|
uWorldTransformMatrix:mat3x3<f32>,
|
|
@@ -186,22 +186,22 @@ ${s.join(`
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
189
|
-
`}},
|
|
189
|
+
`}},am={name:"global-uniforms-bit",vertex:{header:`
|
|
190
190
|
uniform mat3 uProjectionMatrix;
|
|
191
191
|
uniform mat3 uWorldTransformMatrix;
|
|
192
192
|
uniform vec4 uWorldColorAlpha;
|
|
193
193
|
uniform vec2 uResolution;
|
|
194
|
-
`}}});function
|
|
194
|
+
`}}});function ve({bits:i,name:t}){let e=qp({template:{fragment:rm,vertex:em},bits:[nm,...i]});return ae.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Te({bits:i,name:t}){return new ne({name:t,...Zp({template:{vertex:im,fragment:sm},bits:[am,...i]})})}var qe=p(()=>{Tr();Kr();tm();om();cm()});var qr,Zr,cs=p(()=>{"use strict";qr={name:"color-bit",vertex:{header:`
|
|
195
195
|
@in aColor: vec4<f32>;
|
|
196
196
|
`,main:`
|
|
197
197
|
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
198
|
-
`}},
|
|
198
|
+
`}},Zr={name:"color-bit",vertex:{header:`
|
|
199
199
|
in vec4 aColor;
|
|
200
200
|
`,main:`
|
|
201
201
|
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
202
|
-
`}}});function
|
|
203
|
-
`)}function
|
|
204
|
-
`)}function
|
|
202
|
+
`}}});function PT(i){let t=[];if(i===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let r=0;r<i;r++)t.push(`@group(1) @binding(${e++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${r+1}: sampler;`)}return t.join(`
|
|
203
|
+
`)}function AT(i){let t=[];if(i===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<i;e++)e===i-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
|
|
204
|
+
`)}function Qr(i){return hl[i]||(hl[i]={name:"texture-batch-bit",vertex:{header:`
|
|
205
205
|
@in aTextureIdAndRound: vec2<u32>;
|
|
206
206
|
@out @interpolate(flat) vTextureId : u32;
|
|
207
207
|
`,main:`
|
|
@@ -214,14 +214,14 @@ ${s.join(`
|
|
|
214
214
|
`},fragment:{header:`
|
|
215
215
|
@in @interpolate(flat) vTextureId: u32;
|
|
216
216
|
|
|
217
|
-
${
|
|
217
|
+
${PT(i)}
|
|
218
218
|
`,main:`
|
|
219
219
|
var uvDx = dpdx(vUV);
|
|
220
220
|
var uvDy = dpdy(vUV);
|
|
221
221
|
|
|
222
|
-
${
|
|
223
|
-
`}}),
|
|
224
|
-
`)}function
|
|
222
|
+
${AT(i)}
|
|
223
|
+
`}}),hl[i]}function ET(i){let t=[];for(let e=0;e<i;e++)e>0&&t.push("else"),e<i-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
|
|
224
|
+
`)}function Jr(i){return ul[i]||(ul[i]={name:"texture-batch-bit",vertex:{header:`
|
|
225
225
|
in vec2 aTextureIdAndRound;
|
|
226
226
|
out float vTextureId;
|
|
227
227
|
|
|
@@ -239,18 +239,18 @@ ${s.join(`
|
|
|
239
239
|
|
|
240
240
|
`,main:`
|
|
241
241
|
|
|
242
|
-
${
|
|
243
|
-
`}}),
|
|
242
|
+
${ET(i)}
|
|
243
|
+
`}}),ul[i]}var hl,ul,ls=p(()=>{"use strict";hl={};ul={}});var Se,we,Ze=p(()=>{"use strict";Se={name:"round-pixels-bit",vertex:{header:`
|
|
244
244
|
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
245
245
|
{
|
|
246
246
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
247
247
|
}
|
|
248
|
-
`}},
|
|
248
|
+
`}},we={name:"round-pixels-bit",vertex:{header:`
|
|
249
249
|
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
250
250
|
{
|
|
251
251
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
252
252
|
}
|
|
253
|
-
`}}});var ql,Jm,tg=m(()=>{"use strict";ql=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],Jm=ql.reduce((i,t)=>(i[t]=!0,i),{})});function eg(i,t){switch(i){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var rg=m(()=>{"use strict"});var ig,ot,Vt=m(()=>{kt();Ss();tg();rg();ig=class sg{constructor(t,e){this._touched=0,this.uid=j("uniform"),this._resourceType="uniformGroup",this._resourceId=j("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...sg.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Jm[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${ql.join(", ")}`);o.value??(o.value=eg(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=je(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};ig.defaultOptions={ubo:!1,isStatic:!1};ot=ig});function ui(i){let t=og[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=og[i]=new ot({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var og,Nn=m(()=>{Vt();og={}});var bt,Be=m(()=>{"use strict";bt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(bt||{})});var xt,_e=m(()=>{Dt();kt();Mr();er();ni();Be();Vt();xt=class i extends nt{constructor(t){super(),this.uid=j("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=bt.WEBGPU),r&&(n|=bt.WEBGL)),this.compatibleRenderers=n;let c={};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 l in a)for(let h in a[l]){let u=a[l][h];c[u]={group:l,binding:h,name:u}}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,c[h.name]=h})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,c[u.name]=u});let l=0;for(let h in o)c[h]||(s[99]||(s[99]=new At,this._ownedBindGroups.push(s[99])),c[h]={group:99,binding:l,name:h},a[99]=a[99]||{},a[99][l]=h,l++);for(let h in o){let u=h,d=o[h];!d.source&&!d._resourceType&&(d=new ot(d));let f=c[u];f&&(s[f.group]||(s[f.group]=new At,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,c)}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new At,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return r}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:r,...s}=t,o,n;return e&&(o=ue.from(e)),r&&(n=he.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Hn,ng=m(()=>{sr();ws();Ps();or();Nn();_e();Hn=class extends xt{constructor(t){let e=Ae({name:"batch",bits:[ci,hi(t),Me]}),r=Ee({name:"batch",bits:[ai,li(t),Ce]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:ui(t)}})}}});var ag,cg,Es,Zl=m(()=>{E();rm();nm();ng();ag=null,cg=class lg extends em{constructor(){super(...arguments),this.geometry=new Dn,this.shader=ag||(ag=new Hn(this.maxTextures)),this.name=lg.extension.name,this.vertexSize=6}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,c=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,{positions:p,uvs:g}=t,_=t.color,b=t.attributeOffset,y=b+t.attributeSize;for(let v=b;v<y;v++){let S=v*2,P=p[S],T=p[S+1];e[s++]=c*P+h*T+d,e[s++]=u*T+l*P+f,e[s++]=g[S],e[s++]=g[S+1],r[s++]=_,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,c=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,p=t.bounds,g=p.maxX,_=p.minX,b=p.maxY,y=p.minY,v=n.uvs,S=t.color,P=o<<16|t.roundPixels&65535;e[s+0]=c*_+h*y+d,e[s+1]=u*y+l*_+f,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=S,r[s+5]=P,e[s+6]=c*g+h*y+d,e[s+7]=u*y+l*g+f,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=S,r[s+11]=P,e[s+12]=c*g+h*b+d,e[s+13]=u*b+l*g+f,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=S,r[s+17]=P,e[s+18]=c*_+h*b+d,e[s+19]=u*b+l*_+f,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=S,r[s+23]=P}};cg.extension={type:[x.Batcher],name:"default"};Es=cg});function hg(i,t,e,r,s,o,n,a=null){let c=0;e*=t,s*=o;let l=a.a,h=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;c<n;){let g=i[e],_=i[e+1];r[s]=l*g+u*_+f,r[s+1]=h*g+d*_+p,s+=o,e+=t,c++}}function ug(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var dg=m(()=>{"use strict"});function Ql(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,c=t.d,l=t.tx,h=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let d=0;d<s;d++){let f=i[u],p=i[u+1];i[u]=o*f+a*p+l,i[u+1]=n*f+c*p+h,u+=r}}var fg=m(()=>{"use strict"});var NS,Rr,Jl=m(()=>{K();jc();NS=new B,Rr=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,r=this.renderable;return r?ln(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||NS}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 di,pg,mg,gg=m(()=>{E();di={extension:{type:x.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let S=i;e=S.x,r=S.y,n=a=S.radius,s=o=0}else if(i.type==="ellipse"){let S=i;e=S.x,r=S.y,n=S.halfWidth,a=S.halfHeight,s=o=0}else{let S=i,P=S.width/2,T=S.height/2;e=S.x+P,r=S.y+T,n=a=Math.max(0,Math.min(S.radius,Math.min(P,T))),s=P-n,o=T-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let c=Math.ceil(2.3*Math.sqrt(n+a)),l=c*8+(s?4:0)+(o?4:0);if(l===0)return t;if(c===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let h=0,u=c*4+(s?2:0)+2,d=u,f=l,p=s+n,g=o,_=e+p,b=e-p,y=r+g;if(t[h++]=_,t[h++]=y,t[--u]=y,t[--u]=b,o){let S=r-g;t[d++]=b,t[d++]=S,t[--f]=S,t[--f]=_}for(let S=1;S<c;S++){let P=Math.PI/2*(S/c),T=s+Math.cos(P)*n,w=o+Math.sin(P)*a,A=e+T,R=e-T,C=r+w,I=r-w;t[h++]=A,t[h++]=C,t[--u]=C,t[--u]=R,t[d++]=R,t[d++]=I,t[--f]=I,t[--f]=A}p=s,g=o+a,_=e+p,b=e-p,y=r+g;let v=r-g;return t[h++]=_,t[h++]=y,t[--f]=v,t[--f]=_,s&&(t[h++]=b,t[h++]=y,t[--f]=v,t[--f]=b),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let h=0;h<i.length;h+=2)n+=i[h],a+=i[h+1];n/=i.length/2,a/=i.length/2;let c=r;t[c*e]=n,t[c*e+1]=a;let l=c++;for(let h=0;h<i.length;h+=2)t[c*e]=i[h],t[c*e+1]=i[h+1],h>0&&(s[o++]=c,s[o++]=l,s[o++]=c-1),c++;s[o++]=l+1,s[o++]=l,s[o++]=c-1}},pg={...di,extension:{...di.extension,name:"ellipse"}},mg={...di,extension:{...di.extension,name:"roundedRectangle"}}});function xg(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var _g=m(()=>{"use strict"});function yg(i,t,e,r,s,o,n,a){let c=i-e*s,l=t-r*s,h=i+e*o,u=t+r*o,d,f;n?(d=r,f=-e):(d=-r,f=e);let p=c+d,g=l+f,_=h+d,b=u+f;return a.push(p,g),a.push(_,b),2}function Ir(i,t,e,r,s,o,n,a){let c=e-i,l=r-t,h=Math.atan2(c,l),u=Math.atan2(s-i,o-t);a&&h<u?h+=Math.PI*2:!a&&h>u&&(u+=Math.PI*2);let d=h,f=u-h,p=Math.abs(f),g=Math.sqrt(c*c+l*l),_=(15*p*Math.sqrt(g)/Math.PI>>0)+1,b=f/_;if(d+=b,a){n.push(i,t),n.push(e,r);for(let y=1,v=d;y<_;y++,v+=b)n.push(i,t),n.push(i+Math.sin(v)*g,t+Math.cos(v)*g);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let y=1,v=d;y<_;y++,v+=b)n.push(i+Math.sin(v)*g,t+Math.cos(v)*g),n.push(i,t);n.push(s,o),n.push(i,t)}return _*2}function bg(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,c=a.alignment;if(t.alignment!==.5){let q=xg(i);e&&(q*=-1),c=(c-.5)*q+.5}let l=new $(i[0],i[1]),h=new $(i[i.length-2],i[i.length-1]),u=r,d=Math.abs(l.x-h.x)<n&&Math.abs(l.y-h.y)<n;if(u){i=i.slice(),d&&(i.pop(),i.pop(),h.set(i[i.length-2],i[i.length-1]));let q=(l.x+h.x)*.5,ee=(h.y+l.y)*.5;i.unshift(q,ee),i.push(q,ee)}let f=s,p=i.length/2,g=i.length,_=f.length/2,b=a.width/2,y=b*b,v=a.miterLimit*a.miterLimit,S=i[0],P=i[1],T=i[2],w=i[3],A=0,R=0,C=-(P-w),I=S-T,L=0,Y=0,ht=Math.sqrt(C*C+I*I);C/=ht,I/=ht,C*=b,I*=b;let Ft=c,N=(1-Ft)*2,F=Ft*2;u||(a.cap==="round"?g+=Ir(S-C*(N-F)*.5,P-I*(N-F)*.5,S-C*N,P-I*N,S+C*F,P+I*F,f,!0)+2:a.cap==="square"&&(g+=yg(S,P,C,I,N,F,!0,f))),f.push(S-C*N,P-I*N),f.push(S+C*F,P+I*F);for(let q=1;q<p-1;++q){S=i[(q-1)*2],P=i[(q-1)*2+1],T=i[q*2],w=i[q*2+1],A=i[(q+1)*2],R=i[(q+1)*2+1],C=-(P-w),I=S-T,ht=Math.sqrt(C*C+I*I),C/=ht,I/=ht,C*=b,I*=b,L=-(w-R),Y=T-A,ht=Math.sqrt(L*L+Y*Y),L/=ht,Y/=ht,L*=b,Y*=b;let ee=T-S,De=P-w,qi=T-A,Zi=R-w,Id=ee*qi+De*Zi,qo=De*qi-Zi*ee,Qi=qo<0;if(Math.abs(qo)<.001*Math.abs(Id)){f.push(T-C*N,w-I*N),f.push(T+C*F,w+I*F),Id>=0&&(a.join==="round"?g+=Ir(T,w,T-C*N,w-I*N,T-L*N,w-Y*N,f,!1)+4:g+=2,f.push(T-L*F,w-Y*F),f.push(T+L*N,w+Y*N));continue}let Gd=(-C+S)*(-I+w)-(-C+T)*(-I+P),kd=(-L+A)*(-Y+w)-(-L+T)*(-Y+R),Zo=(ee*kd-qi*Gd)/qo,Qo=(Zi*Gd-De*kd)/qo,Mc=(Zo-T)*(Zo-T)+(Qo-w)*(Qo-w),fr=T+(Zo-T)*N,pr=w+(Qo-w)*N,mr=T-(Zo-T)*F,gr=w-(Qo-w)*F,kT=Math.min(ee*ee+De*De,qi*qi+Zi*Zi),Fd=Qi?N:F,FT=kT+Fd*Fd*y;Mc<=FT?a.join==="bevel"||Mc/y>v?(Qi?(f.push(fr,pr),f.push(T+C*F,w+I*F),f.push(fr,pr),f.push(T+L*F,w+Y*F)):(f.push(T-C*N,w-I*N),f.push(mr,gr),f.push(T-L*N,w-Y*N),f.push(mr,gr)),g+=2):a.join==="round"?Qi?(f.push(fr,pr),f.push(T+C*F,w+I*F),g+=Ir(T,w,T+C*F,w+I*F,T+L*F,w+Y*F,f,!0)+4,f.push(fr,pr),f.push(T+L*F,w+Y*F)):(f.push(T-C*N,w-I*N),f.push(mr,gr),g+=Ir(T,w,T-C*N,w-I*N,T-L*N,w-Y*N,f,!1)+4,f.push(T-L*N,w-Y*N),f.push(mr,gr)):(f.push(fr,pr),f.push(mr,gr)):(f.push(T-C*N,w-I*N),f.push(T+C*F,w+I*F),a.join==="round"?Qi?g+=Ir(T,w,T+C*F,w+I*F,T+L*F,w+Y*F,f,!0)+2:g+=Ir(T,w,T-C*N,w-I*N,T-L*N,w-Y*N,f,!1)+2:a.join==="miter"&&Mc/y<=v&&(Qi?(f.push(mr,gr),f.push(mr,gr)):(f.push(fr,pr),f.push(fr,pr)),g+=2),f.push(T-L*N,w-Y*N),f.push(T+L*F,w+Y*F),g+=2)}S=i[(p-2)*2],P=i[(p-2)*2+1],T=i[(p-1)*2],w=i[(p-1)*2+1],C=-(P-w),I=S-T,ht=Math.sqrt(C*C+I*I),C/=ht,I/=ht,C*=b,I*=b,f.push(T-C*N,w-I*N),f.push(T+C*F,w+I*F),u||(a.cap==="round"?g+=Ir(T-C*(N-F)*.5,w-I*(N-F)*.5,T-C*N,w-I*N,T+C*F,w+I*F,f,!1)+2:a.cap==="square"&&(g+=yg(T,w,C,I,N,F,!1,f)));let oe=1e-4*1e-4;for(let q=_;q<g+_-2;++q)S=f[q*2],P=f[q*2+1],T=f[(q+1)*2],w=f[(q+1)*2+1],A=f[(q+2)*2],R=f[(q+2)*2+1],!(Math.abs(S*(w-R)+T*(R-P)+A*(P-w))<oe)&&o.push(q,q+1,q+2)}var vg=m(()=>{ae();_g()});function Tg(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],c=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-c)<s,h=e,u=i.length/2,d=h.length/2;for(let f=0;f<u;f++)h.push(i[f*2]),h.push(i[f*2+1]);for(let f=0;f<u-1;f++)r.push(d+f,d+f+1);l&&r.push(d+u-1,d)}var Sg=m(()=>{});var sh=Rc((GI,ih)=>{"use strict";ih.exports=Vn;ih.exports.default=Vn;function Vn(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Pg(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,c,l,h,u,d,f;if(r&&(o=$S(i,t,o,e)),i.length>80*e){a=l=i[0],c=h=i[1];for(var p=e;p<s;p+=e)u=i[p],d=i[p+1],u<a&&(a=u),d<c&&(c=d),u>l&&(l=u),d>h&&(h=d);f=Math.max(l-a,h-c),f=f!==0?32767/f:0}return As(o,n,e,a,c,f,0),n}function Pg(i,t,e,r,s){var o,n;if(s===rh(i,t,e,r)>0)for(o=t;o<e;o+=r)n=wg(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=wg(o,i[o],i[o+1],n);return n&&Xn(n,n.next)&&(Ms(n),n=n.next),n}function Gr(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(Xn(e,e.next)||mt(e.prev,e,e.next)===0)){if(Ms(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function As(i,t,e,r,s,o,n){if(i){!n&&o&&QS(i,r,s,o);for(var a=i,c,l;i.prev!==i.next;){if(c=i.prev,l=i.next,o?VS(i,r,s,o):zS(i)){t.push(c.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Ms(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=XS(Gr(i),t,e),As(i,t,e,r,s,o,2)):n===2&&jS(i,t,e,r,s,o):As(Gr(i),t,e,r,s,o,1);break}}}}function zS(i){var t=i.prev,e=i,r=i.next;if(mt(t,e,r)>=0)return!1;for(var s=t.x,o=e.x,n=r.x,a=t.y,c=e.y,l=r.y,h=s<o?s<n?s:n:o<n?o:n,u=a<c?a<l?a:l:c<l?c:l,d=s>o?s>n?s:n:o>n?o:n,f=a>c?a>l?a:l:c>l?c:l,p=r.next;p!==t;){if(p.x>=h&&p.x<=d&&p.y>=u&&p.y<=f&&fi(s,a,o,c,n,l,p.x,p.y)&&mt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function VS(i,t,e,r){var s=i.prev,o=i,n=i.next;if(mt(s,o,n)>=0)return!1;for(var a=s.x,c=o.x,l=n.x,h=s.y,u=o.y,d=n.y,f=a<c?a<l?a:l:c<l?c:l,p=h<u?h<d?h:d:u<d?u:d,g=a>c?a>l?a:l:c>l?c:l,_=h>u?h>d?h:d:u>d?u:d,b=th(f,p,t,e,r),y=th(g,_,t,e,r),v=i.prevZ,S=i.nextZ;v&&v.z>=b&&S&&S.z<=y;){if(v.x>=f&&v.x<=g&&v.y>=p&&v.y<=_&&v!==s&&v!==n&&fi(a,h,c,u,l,d,v.x,v.y)&&mt(v.prev,v,v.next)>=0||(v=v.prevZ,S.x>=f&&S.x<=g&&S.y>=p&&S.y<=_&&S!==s&&S!==n&&fi(a,h,c,u,l,d,S.x,S.y)&&mt(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;v&&v.z>=b;){if(v.x>=f&&v.x<=g&&v.y>=p&&v.y<=_&&v!==s&&v!==n&&fi(a,h,c,u,l,d,v.x,v.y)&&mt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;S&&S.z<=y;){if(S.x>=f&&S.x<=g&&S.y>=p&&S.y<=_&&S!==s&&S!==n&&fi(a,h,c,u,l,d,S.x,S.y)&&mt(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function XS(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!Xn(s,o)&&Eg(s,r,r.next,o)&&Cs(s,o)&&Cs(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),Ms(r),Ms(r.next),r=i=o),r=r.next}while(r!==i);return Gr(r)}function jS(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&ew(n,a)){var c=Ag(n,a);n=Gr(n,n.next),c=Gr(c,c.next),As(n,t,e,r,s,o,0),As(c,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function $S(i,t,e,r){var s=[],o,n,a,c,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,c=o<n-1?t[o+1]*r:i.length,l=Pg(i,a,c,r,!1),l===l.next&&(l.steiner=!0),s.push(tw(l));for(s.sort(YS),o=0;o<s.length;o++)e=KS(s[o],e);return e}function YS(i,t){return i.x-t.x}function KS(i,t){var e=qS(i,t);if(!e)return t;var r=Ag(e,i);return Gr(r,r.next),Gr(e,e.next)}function qS(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;do{if(s<=e.y&&s>=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<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next}while(e!==t);if(!n)return null;var c=n,l=n.x,h=n.y,u=1/0,d;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&fi(s<h?r:o,s,l,h,s<h?o:r,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(r-e.x),Cs(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&ZS(n,e)))&&(n=e,u=d)),e=e.next;while(e!==c);return n}function ZS(i,t){return mt(i.prev,i,t.prev)<0&&mt(t.next,i,i.next)<0}function QS(i,t,e,r){var s=i;do s.z===0&&(s.z=th(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,JS(s)}function JS(i){var t,e,r,s,o,n,a,c,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(c=l;a>0||c>0&&r;)a!==0&&(c===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,c--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r}o.nextZ=null,l*=2}while(n>1);return i}function th(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function tw(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function fi(i,t,e,r,s,o,n,a){return(s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function ew(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!rw(i,t)&&(Cs(i,t)&&Cs(t,i)&&iw(i,t)&&(mt(i.prev,i,t.prev)||mt(i,t.prev,t))||Xn(i,t)&&mt(i.prev,i,i.next)>0&&mt(t.prev,t,t.next)>0)}function mt(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Xn(i,t){return i.x===t.x&&i.y===t.y}function Eg(i,t,e,r){var s=zn(mt(i,t,e)),o=zn(mt(i,t,r)),n=zn(mt(e,r,i)),a=zn(mt(e,r,t));return!!(s!==o&&n!==a||s===0&&Wn(i,e,t)||o===0&&Wn(i,r,t)||n===0&&Wn(e,i,r)||a===0&&Wn(e,t,r))}function Wn(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function zn(i){return i>0?1:i<0?-1:0}function rw(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Eg(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function Cs(i,t){return mt(i.prev,i,i.next)<0?mt(i,t,i.next)>=0&&mt(i,i.prev,t)>=0:mt(i,t,i.prev)<0||mt(i,i.next,t)<0}function iw(i,t){var e=i,r=!1,s=(i.x+t.x)/2,o=(i.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&&(r=!r),e=e.next;while(e!==i);return r}function Ag(i,t){var e=new eh(i.i,i.x,i.y),r=new eh(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function wg(i,t,e,r){var s=new eh(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Ms(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function eh(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Vn.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(rh(i,0,o,e));if(s)for(var a=0,c=t.length;a<c;a++){var l=t[a]*e,h=a<c-1?t[a+1]*e:i.length;n-=Math.abs(rh(i,l,h,e))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*e,f=r[a+1]*e,p=r[a+2]*e;u+=Math.abs((i[d]-i[p])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[p+1]-i[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function rh(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Vn.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r))}return e}});function jn(i,t,e,r,s,o,n){let a=(0,Cg.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let c=s*r;for(let l=0;l<i.length;l+=2)e[c]=i[l],e[c+1]=i[l+1],c+=r}var Cg,oh=m(()=>{Cg=Jo(sh(),1)});var sw,Mg,Bg=m(()=>{E();oh();sw=[],Mg={extension:{type:x.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){jn(i,sw,t,e,r,s,o)}}});var Rg,Ig=m(()=>{E();Rg={extension:{type:x.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/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 Gg,kg=m(()=>{E();Gg={extension:{type:x.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function Ug(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function Dg(i,t){let e=D.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function ow(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(U("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??Jt.defaultLinearOptions.textureSize}),t}var Fg,ah,Jt,pi=m(()=>{It();ct();K();ti();et();kt();ft();Qc();Fg=[{offset:0,color:"white"},{offset:1,color:"black"}],ah=class nh{constructor(...t){this.uid=j("fillGradient"),this.type="linear",this.colorStops=[];let e=ow(t);e={...e.type==="radial"?nh.defaultRadialOptions:nh.defaultLinearOptions,...un(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:V.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let _=t;t=r,r=_,o*=-1}if(n<0){let _=e;e=s,s=_,n*=-1}}let c=this.colorStops.length?this.colorStops:Fg,l=this._textureSize,{canvas:h,context:u}=Dg(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);Ug(d,c),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new M({source:new Zt({resource:h,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),g=new B;g.scale(f/l,1),g.rotate(p),g.translate(t,e),this.textureSpace==="local"&&g.scale(l,l),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:Fg,e=this._textureSize,{canvas:r,context:s}=Dg(e,e),{x:o,y:n}=this.center,{x:a,y:c}=this.outerCenter,l=this.innerRadius,h=this.outerRadius,u=a-h,d=c-h,f=e/(h*2),p=(o-u)*f,g=(n-d)*f,_=s.createRadialGradient(p,g,l*f,(a-u)*f,(c-d)*f,h*f);Ug(_,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=_,s.translate(p,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-g),s.fillRect(0,0,e,e),this.texture=new M({source:new Zt({resource:r,addressMode:this._wrapMode})});let b=new B;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}};ah.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};ah.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Jt=ah});function Og(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(aw);t.width&&n.pad(t.width);let{x:a,y:c}=n,l=1/n.width,h=1/n.height,u=-a*l,d=-c*h,f=s.a,p=s.b,g=s.c,_=s.d;s.a*=l,s.b*=l,s.c*=h,s.d*=h,s.tx=u*f+d*g+s.tx,s.ty=u*p+d*_+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 Jt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(nw.copyFrom(r).invert()),s}var nw,aw,Lg=m(()=>{K();vt();pi();nw=new B,aw=new z});function Hg(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")hw(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,c=o.data.style,l=o.data.hole;n&&l&&Ng(l.shapePath,c,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),Ng(a,c,n,r,e)}}}function hw(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,c=[],l=$n.rectangle,h=cw,u=i.image;h.x=i.dx,h.y=i.dy,h.width=i.dw,h.height=i.dh;let d=i.transform;l.build(h,c),d&&Ql(c,d),l.triangulate(c,r,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let p=W.get(Rr);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=r.length/2-a,p.baseColor=i.style,p.alpha=i.alpha,p.texture=u,p.geometryData=e,t.push(p)}function Ng(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:c,transform:l,holes:h})=>{let u=a.length,d=o.length/2,f=[],p=$n[c.type],g="triangle-list";if(p.build(c,f),l&&Ql(f,l),e){let v=c.closePath??!0,S=t;S.pixelLine?(Tg(f,v,o,a),g="line-list"):bg(f,S,!1,v,o,a)}else if(h){let v=[],S=f.slice();uw(h).forEach(T=>{v.push(S.length/2),S.push(...T)}),jn(S,v,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let _=n.length/2,b=t.texture;if(b!==M.WHITE){let v=Og(lw,t,c,l);hg(o,2,d,n,_,2,o.length/2-d,v)}else ug(n,_,2,o.length/2-d);let y=W.get(Rr);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,r.push(y)})}function uw(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];$n[r.type].build(r,s),t.push(s)}return t}var $n,cw,lw,Wg=m(()=>{E();K();vt();dg();fg();et();Nt();Jl();gg();vg();Sg();Bg();Ig();kg();Lg();oh();$n={};G.handleByMap(x.ShapeBuilder,$n);G.add(Rg,Mg,Gg,di,pg,mg);cw=new z,lw=new B});var ch,lh,uh,mi,Yn=m(()=>{E();kn();Zl();qc();ft();Nt();Wg();ch=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},lh=class{constructor(){this.batcher=new Es,this.instructions=new $r}init(){this.instructions.reset()}get geometry(){return U(af,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},uh=class hh{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){hh.defaultOptions.bezierSmoothness=t?.bezierSmoothness??hh.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),Hg(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="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=W.get(lh),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let h=0;h<r.length;h++)r[h].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let h=0;h<r.length;h++){let u=r[h];a.add(u)}a.finish(e.instructions);let c=a.geometry;c.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),c.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let l=a.batches;for(let h=0;h<l.length;h++){let u=l[h];u.bindGroup=ii(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new ch;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(W.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{W.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};uh.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"graphicsContext"};uh.defaultOptions={bezierSmoothness:.5};mi=uh});var dw,dh,fh,ph,mh,gh,xh,_h,_t,ye=m(()=>{"use strict";dw={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},dh=0,fh=1,ph=2,mh=3,gh=4,xh=5,_h=class zg{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<dh)}set blend(t){!!(this.data&1<<dh)!==t&&(this.data^=1<<dh)}get offsets(){return!!(this.data&1<<fh)}set offsets(t){!!(this.data&1<<fh)!==t&&(this.data^=1<<fh)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<ph)}set culling(t){!!(this.data&1<<ph)!==t&&(this.data^=1<<ph)}get depthTest(){return!!(this.data&1<<mh)}set depthTest(t){!!(this.data&1<<mh)!==t&&(this.data^=1<<mh)}get depthMask(){return!!(this.data&1<<xh)}set depthMask(t){!!(this.data&1<<xh)!==t&&(this.data^=1<<xh)}get clockwiseFrontFace(){return!!(this.data&1<<gh)}set clockwiseFrontFace(t){!!(this.data&1<<gh)!==t&&(this.data^=1<<gh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=dw[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new zg;return t.depthTest=!1,t.blend=!0,t}};_h.default2d=_h.for2d();_t=_h});function Re(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r}var gi=m(()=>{"use strict"});var Bs,Vg=m(()=>{E();ye();Nt();gi();Jl();Bs=class{constructor(t,e){this.state=_t.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,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.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 r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Re(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=W.get(Rr);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=>{W.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}};Bs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"graphics"}});var yh=m(()=>{E();Yn();Vg();G.add(Bs);G.add(mi)});var nr,Kn=m(()=>{"use strict";nr=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"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var Rs,Xg=m(()=>{E();K();er();Vt();vs();Nt();gi();Kn();Rs=class{constructor(t,e){this.localUniforms=new ot({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new At({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),r=e.batched,s=t.batched;if(e.batched=s,r!==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 r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.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&&(W.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ve(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Re(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=W.get(nr);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]&&W.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}};Rs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"mesh"}});var bh=m(()=>{E();Xg();G.add(Rs)});var qn,jg=m(()=>{"use strict";qn=class{execute(t,e){let r=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(r),s.geometry.bind(a.geometry,o.glProgram);let l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,l,0)}}});function vh(i,t=null){let e=i*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 r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var $g=m(()=>{"use strict"});function Kg(i){return{dynamicUpdate:Yg(i,!0),staticUpdate:Yg(i,!1)}}function Yg(i,t){let e=[];e.push(`
|
|
253
|
+
`}}});var dl,lm,hm=p(()=>{"use strict";dl=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],lm=dl.reduce((i,t)=>(i[t]=!0,i),{})});function um(i,t){switch(i){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var dm=p(()=>{"use strict"});var fm,st,Ht=p(()=>{Rt();as();hm();dm();fm=class pm{constructor(t,e){this._touched=0,this.uid=j("uniform"),this._resourceType="uniformGroup",this._resourceId=j("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...pm.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!lm[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${dl.join(", ")}`);o.value??(o.value=um(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Oe(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};fm.defaultOptions={ubo:!1,isStatic:!1};st=fm});function ti(i){let t=mm[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=mm[i]=new st({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var mm,vn=p(()=>{Ht();mm={}});var yt,Pe=p(()=>{"use strict";yt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(yt||{})});var gt,pe=p(()=>{kt();Rt();Tr();Ye();Kr();Pe();Ht();gt=class i extends nt{constructor(t){super(),this.uid=j("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=yt.WEBGPU),r&&(n|=yt.WEBGL)),this.compatibleRenderers=n;let c={};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 l in a)for(let h in a[l]){let u=a[l][h];c[u]={group:l,binding:h,name:u}}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,c[h.name]=h})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,c[u.name]=u});let l=0;for(let h in o)c[h]||(s[99]||(s[99]=new Pt,this._ownedBindGroups.push(s[99])),c[h]={group:99,binding:l,name:h},a[99]=a[99]||{},a[99][l]=h,l++);for(let h in o){let u=h,d=o[h];!d.source&&!d._resourceType&&(d=new st(d));let f=c[u];f&&(s[f.group]||(s[f.group]=new Pt,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,c)}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new Pt,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return r}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:r,...s}=t,o,n;return e&&(o=ae.from(e)),r&&(n=ne.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Tn,gm=p(()=>{qe();cs();ls();Ze();vn();pe();Tn=class extends gt{constructor(t){let e=Te({name:"batch",bits:[Zr,Jr(t),we]}),r=ve({name:"batch",bits:[qr,Qr(t),Se]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:ti(t)}})}}});var xm,_m,hs,fl=p(()=>{w();dp();gp();gm();xm=null,_m=class ym extends up{constructor(){super(...arguments),this.geometry=new _n,this.shader=xm||(xm=new Tn(this.maxTextures)),this.name=ym.extension.name,this.vertexSize=6}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,c=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,{positions:m,uvs:_}=t,g=t.color,b=t.attributeOffset,y=b+t.attributeSize;for(let v=b;v<y;v++){let T=v*2,R=m[T],S=m[T+1];e[s++]=c*R+h*S+d,e[s++]=u*S+l*R+f,e[s++]=_[T],e[s++]=_[T+1],r[s++]=g,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,c=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,m=t.bounds,_=m.maxX,g=m.minX,b=m.maxY,y=m.minY,v=n.uvs,T=t.color,R=o<<16|t.roundPixels&65535;e[s+0]=c*g+h*y+d,e[s+1]=u*y+l*g+f,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=T,r[s+5]=R,e[s+6]=c*_+h*y+d,e[s+7]=u*y+l*_+f,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=T,r[s+11]=R,e[s+12]=c*_+h*b+d,e[s+13]=u*b+l*_+f,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=T,r[s+17]=R,e[s+18]=c*g+h*b+d,e[s+19]=u*b+l*g+f,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=T,r[s+23]=R}};_m.extension={type:[x.Batcher],name:"default"};hs=_m});function bm(i,t,e,r,s,o,n,a=null){let c=0;e*=t,s*=o;let l=a.a,h=a.b,u=a.c,d=a.d,f=a.tx,m=a.ty;for(;c<n;){let _=i[e],g=i[e+1];r[s]=l*_+u*g+f,r[s+1]=h*_+d*g+m,s+=o,e+=t,c++}}function vm(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var Tm=p(()=>{"use strict"});function pl(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,c=t.d,l=t.tx,h=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let d=0;d<s;d++){let f=i[u],m=i[u+1];i[u]=o*f+a*m+l,i[u+1]=n*f+c*m+h,u+=r}}var Sm=p(()=>{"use strict"});var CT,wr,ml=p(()=>{Z();cc();CT=new G,wr=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,r=this.renderable;return r?zo(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||CT}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 ei,wm,Pm,Am=p(()=>{w();ei={extension:{type:x.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let T=i;e=T.x,r=T.y,n=a=T.radius,s=o=0}else if(i.type==="ellipse"){let T=i;e=T.x,r=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=i,R=T.width/2,S=T.height/2;e=T.x+R,r=T.y+S,n=a=Math.max(0,Math.min(T.radius,Math.min(R,S))),s=R-n,o=S-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let c=Math.ceil(2.3*Math.sqrt(n+a)),l=c*8+(s?4:0)+(o?4:0);if(l===0)return t;if(c===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let h=0,u=c*4+(s?2:0)+2,d=u,f=l,m=s+n,_=o,g=e+m,b=e-m,y=r+_;if(t[h++]=g,t[h++]=y,t[--u]=y,t[--u]=b,o){let T=r-_;t[d++]=b,t[d++]=T,t[--f]=T,t[--f]=g}for(let T=1;T<c;T++){let R=Math.PI/2*(T/c),S=s+Math.cos(R)*n,P=o+Math.sin(R)*a,A=e+S,M=e-S,E=r+P,B=r-P;t[h++]=A,t[h++]=E,t[--u]=E,t[--u]=M,t[d++]=M,t[d++]=B,t[--f]=B,t[--f]=A}m=s,_=o+a,g=e+m,b=e-m,y=r+_;let v=r-_;return t[h++]=g,t[h++]=y,t[--f]=v,t[--f]=g,s&&(t[h++]=b,t[h++]=y,t[--f]=v,t[--f]=b),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let h=0;h<i.length;h+=2)n+=i[h],a+=i[h+1];n/=i.length/2,a/=i.length/2;let c=r;t[c*e]=n,t[c*e+1]=a;let l=c++;for(let h=0;h<i.length;h+=2)t[c*e]=i[h],t[c*e+1]=i[h+1],h>0&&(s[o++]=c,s[o++]=l,s[o++]=c-1),c++;s[o++]=l+1,s[o++]=l,s[o++]=c-1}},wm={...ei,extension:{...ei.extension,name:"ellipse"}},Pm={...ei,extension:{...ei.extension,name:"roundedRectangle"}}});function Em(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var Cm=p(()=>{"use strict"});function Mm(i,t,e,r,s,o,n,a){let c=i-e*s,l=t-r*s,h=i+e*o,u=t+r*o,d,f;n?(d=r,f=-e):(d=-r,f=e);let m=c+d,_=l+f,g=h+d,b=u+f;return a.push(m,_),a.push(g,b),2}function Pr(i,t,e,r,s,o,n,a){let c=e-i,l=r-t,h=Math.atan2(c,l),u=Math.atan2(s-i,o-t);a&&h<u?h+=Math.PI*2:!a&&h>u&&(u+=Math.PI*2);let d=h,f=u-h,m=Math.abs(f),_=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(_)/Math.PI>>0)+1,b=f/g;if(d+=b,a){n.push(i,t),n.push(e,r);for(let y=1,v=d;y<g;y++,v+=b)n.push(i,t),n.push(i+Math.sin(v)*_,t+Math.cos(v)*_);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let y=1,v=d;y<g;y++,v+=b)n.push(i+Math.sin(v)*_,t+Math.cos(v)*_),n.push(i,t);n.push(s,o),n.push(i,t)}return g*2}function Bm(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,c=a.alignment;if(t.alignment!==.5){let q=Em(i);e&&(q*=-1),c=(c-.5)*q+.5}let l=new K(i[0],i[1]),h=new K(i[i.length-2],i[i.length-1]),u=r,d=Math.abs(l.x-h.x)<n&&Math.abs(l.y-h.y)<n;if(u){i=i.slice(),d&&(i.pop(),i.pop(),h.set(i[i.length-2],i[i.length-1]));let q=(l.x+h.x)*.5,Ft=(h.y+l.y)*.5;i.unshift(q,Ft),i.push(q,Ft)}let f=s,m=i.length/2,_=i.length,g=f.length/2,b=a.width/2,y=b*b,v=a.miterLimit*a.miterLimit,T=i[0],R=i[1],S=i[2],P=i[3],A=0,M=0,E=-(R-P),B=T-S,I=0,H=0,$=Math.sqrt(E*E+B*B);E/=$,B/=$,E*=b,B*=b;let ot=c,N=(1-ot)*2,U=ot*2;u||(a.cap==="round"?_+=Pr(T-E*(N-U)*.5,R-B*(N-U)*.5,T-E*N,R-B*N,T+E*U,R+B*U,f,!0)+2:a.cap==="square"&&(_+=Mm(T,R,E,B,N,U,!0,f))),f.push(T-E*N,R-B*N),f.push(T+E*U,R+B*U);for(let q=1;q<m-1;++q){T=i[(q-1)*2],R=i[(q-1)*2+1],S=i[q*2],P=i[q*2+1],A=i[(q+1)*2],M=i[(q+1)*2+1],E=-(R-P),B=T-S,$=Math.sqrt(E*E+B*B),E/=$,B/=$,E*=b,B*=b,I=-(P-M),H=S-A,$=Math.sqrt(I*I+H*H),I/=$,H/=$,I*=b,H*=b;let Ft=S-T,he=R-P,or=S-A,Fi=M-P,Wu=Ft*or+he*Fi,Ro=he*or-Fi*Ft,Ui=Ro<0;if(Math.abs(Ro)<.001*Math.abs(Wu)){f.push(S-E*N,P-B*N),f.push(S+E*U,P+B*U),Wu>=0&&(a.join==="round"?_+=Pr(S,P,S-E*N,P-B*N,S-I*N,P-H*N,f,!1)+4:_+=2,f.push(S-I*U,P-H*U),f.push(S+I*N,P+H*N));continue}let zu=(-E+T)*(-B+P)-(-E+S)*(-B+R),Vu=(-I+A)*(-H+P)-(-I+S)*(-H+M),Go=(Ft*Vu-or*zu)/Ro,ko=(Fi*zu-he*Vu)/Ro,Xa=(Go-S)*(Go-S)+(ko-P)*(ko-P),nr=S+(Go-S)*N,ar=P+(ko-P)*N,cr=S-(Go-S)*U,lr=P-(ko-P)*U,T0=Math.min(Ft*Ft+he*he,or*or+Fi*Fi),Xu=Ui?N:U,S0=T0+Xu*Xu*y;Xa<=S0?a.join==="bevel"||Xa/y>v?(Ui?(f.push(nr,ar),f.push(S+E*U,P+B*U),f.push(nr,ar),f.push(S+I*U,P+H*U)):(f.push(S-E*N,P-B*N),f.push(cr,lr),f.push(S-I*N,P-H*N),f.push(cr,lr)),_+=2):a.join==="round"?Ui?(f.push(nr,ar),f.push(S+E*U,P+B*U),_+=Pr(S,P,S+E*U,P+B*U,S+I*U,P+H*U,f,!0)+4,f.push(nr,ar),f.push(S+I*U,P+H*U)):(f.push(S-E*N,P-B*N),f.push(cr,lr),_+=Pr(S,P,S-E*N,P-B*N,S-I*N,P-H*N,f,!1)+4,f.push(S-I*N,P-H*N),f.push(cr,lr)):(f.push(nr,ar),f.push(cr,lr)):(f.push(S-E*N,P-B*N),f.push(S+E*U,P+B*U),a.join==="round"?Ui?_+=Pr(S,P,S+E*U,P+B*U,S+I*U,P+H*U,f,!0)+2:_+=Pr(S,P,S-E*N,P-B*N,S-I*N,P-H*N,f,!1)+2:a.join==="miter"&&Xa/y<=v&&(Ui?(f.push(cr,lr),f.push(cr,lr)):(f.push(nr,ar),f.push(nr,ar)),_+=2),f.push(S-I*N,P-H*N),f.push(S+I*U,P+H*U),_+=2)}T=i[(m-2)*2],R=i[(m-2)*2+1],S=i[(m-1)*2],P=i[(m-1)*2+1],E=-(R-P),B=T-S,$=Math.sqrt(E*E+B*B),E/=$,B/=$,E*=b,B*=b,f.push(S-E*N,P-B*N),f.push(S+E*U,P+B*U),u||(a.cap==="round"?_+=Pr(S-E*(N-U)*.5,P-B*(N-U)*.5,S-E*N,P-B*N,S+E*U,P+B*U,f,!1)+2:a.cap==="square"&&(_+=Mm(S,P,E,B,N,U,!1,f)));let ee=1e-4*1e-4;for(let q=g;q<_+g-2;++q)T=f[q*2],R=f[q*2+1],S=f[(q+1)*2],P=f[(q+1)*2+1],A=f[(q+2)*2],M=f[(q+2)*2+1],!(Math.abs(T*(P-M)+S*(M-R)+A*(R-P))<ee)&&o.push(q,q+1,q+2)}var Rm=p(()=>{ie();Cm()});function Gm(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],c=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-c)<s,h=e,u=i.length/2,d=h.length/2;for(let f=0;f<u;f++)h.push(i[f*2]),h.push(i[f*2+1]);for(let f=0;f<u-1;f++)r.push(d+f,d+f+1);l&&r.push(d+u-1,d)}var km=p(()=>{});var bl=Ya((n2,yl)=>{"use strict";yl.exports=Pn;yl.exports.default=Pn;function Pn(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Fm(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,c,l,h,u,d,f;if(r&&(o=FT(i,t,o,e)),i.length>80*e){a=l=i[0],c=h=i[1];for(var m=e;m<s;m+=e)u=i[m],d=i[m+1],u<a&&(a=u),d<c&&(c=d),u>l&&(l=u),d>h&&(h=d);f=Math.max(l-a,h-c),f=f!==0?32767/f:0}return us(o,n,e,a,c,f,0),n}function Fm(i,t,e,r,s){var o,n;if(s===_l(i,t,e,r)>0)for(o=t;o<e;o+=r)n=Im(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=Im(o,i[o],i[o+1],n);return n&&An(n,n.next)&&(fs(n),n=n.next),n}function Ar(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(An(e,e.next)||pt(e.prev,e,e.next)===0)){if(fs(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function us(i,t,e,r,s,o,n){if(i){!n&&o&&NT(i,r,s,o);for(var a=i,c,l;i.prev!==i.next;){if(c=i.prev,l=i.next,o?GT(i,r,s,o):RT(i)){t.push(c.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),fs(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=kT(Ar(i),t,e),us(i,t,e,r,s,o,2)):n===2&&IT(i,t,e,r,s,o):us(Ar(i),t,e,r,s,o,1);break}}}}function RT(i){var t=i.prev,e=i,r=i.next;if(pt(t,e,r)>=0)return!1;for(var s=t.x,o=e.x,n=r.x,a=t.y,c=e.y,l=r.y,h=s<o?s<n?s:n:o<n?o:n,u=a<c?a<l?a:l:c<l?c:l,d=s>o?s>n?s:n:o>n?o:n,f=a>c?a>l?a:l:c>l?c:l,m=r.next;m!==t;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&ri(s,a,o,c,n,l,m.x,m.y)&&pt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function GT(i,t,e,r){var s=i.prev,o=i,n=i.next;if(pt(s,o,n)>=0)return!1;for(var a=s.x,c=o.x,l=n.x,h=s.y,u=o.y,d=n.y,f=a<c?a<l?a:l:c<l?c:l,m=h<u?h<d?h:d:u<d?u:d,_=a>c?a>l?a:l:c>l?c:l,g=h>u?h>d?h:d:u>d?u:d,b=gl(f,m,t,e,r),y=gl(_,g,t,e,r),v=i.prevZ,T=i.nextZ;v&&v.z>=b&&T&&T.z<=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==s&&v!==n&&ri(a,h,c,u,l,d,v.x,v.y)&&pt(v.prev,v,v.next)>=0||(v=v.prevZ,T.x>=f&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==n&&ri(a,h,c,u,l,d,T.x,T.y)&&pt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;v&&v.z>=b;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==s&&v!==n&&ri(a,h,c,u,l,d,v.x,v.y)&&pt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;T&&T.z<=y;){if(T.x>=f&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==n&&ri(a,h,c,u,l,d,T.x,T.y)&&pt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function kT(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!An(s,o)&&Um(s,r,r.next,o)&&ds(s,o)&&ds(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),fs(r),fs(r.next),r=i=o),r=r.next}while(r!==i);return Ar(r)}function IT(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&zT(n,a)){var c=Dm(n,a);n=Ar(n,n.next),c=Ar(c,c.next),us(n,t,e,r,s,o,0),us(c,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function FT(i,t,e,r){var s=[],o,n,a,c,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,c=o<n-1?t[o+1]*r:i.length,l=Fm(i,a,c,r,!1),l===l.next&&(l.steiner=!0),s.push(WT(l));for(s.sort(UT),o=0;o<s.length;o++)e=DT(s[o],e);return e}function UT(i,t){return i.x-t.x}function DT(i,t){var e=OT(i,t);if(!e)return t;var r=Dm(e,i);return Ar(r,r.next),Ar(e,e.next)}function OT(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;do{if(s<=e.y&&s>=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<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next}while(e!==t);if(!n)return null;var c=n,l=n.x,h=n.y,u=1/0,d;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&ri(s<h?r:o,s,l,h,s<h?o:r,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(r-e.x),ds(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&<(n,e)))&&(n=e,u=d)),e=e.next;while(e!==c);return n}function LT(i,t){return pt(i.prev,i,t.prev)<0&&pt(t.next,i,i.next)<0}function NT(i,t,e,r){var s=i;do s.z===0&&(s.z=gl(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,HT(s)}function HT(i){var t,e,r,s,o,n,a,c,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(c=l;a>0||c>0&&r;)a!==0&&(c===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,c--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r}o.nextZ=null,l*=2}while(n>1);return i}function gl(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function WT(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function ri(i,t,e,r,s,o,n,a){return(s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function zT(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!VT(i,t)&&(ds(i,t)&&ds(t,i)&&XT(i,t)&&(pt(i.prev,i,t.prev)||pt(i,t.prev,t))||An(i,t)&&pt(i.prev,i,i.next)>0&&pt(t.prev,t,t.next)>0)}function pt(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function An(i,t){return i.x===t.x&&i.y===t.y}function Um(i,t,e,r){var s=wn(pt(i,t,e)),o=wn(pt(i,t,r)),n=wn(pt(e,r,i)),a=wn(pt(e,r,t));return!!(s!==o&&n!==a||s===0&&Sn(i,e,t)||o===0&&Sn(i,r,t)||n===0&&Sn(e,i,r)||a===0&&Sn(e,t,r))}function Sn(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function wn(i){return i>0?1:i<0?-1:0}function VT(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Um(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function ds(i,t){return pt(i.prev,i,i.next)<0?pt(i,t,i.next)>=0&&pt(i,i.prev,t)>=0:pt(i,t,i.prev)<0||pt(i,i.next,t)<0}function XT(i,t){var e=i,r=!1,s=(i.x+t.x)/2,o=(i.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&&(r=!r),e=e.next;while(e!==i);return r}function Dm(i,t){var e=new xl(i.i,i.x,i.y),r=new xl(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function Im(i,t,e,r){var s=new xl(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function fs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function xl(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Pn.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(_l(i,0,o,e));if(s)for(var a=0,c=t.length;a<c;a++){var l=t[a]*e,h=a<c-1?t[a+1]*e:i.length;n-=Math.abs(_l(i,l,h,e))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*e,f=r[a+1]*e,m=r[a+2]*e;u+=Math.abs((i[d]-i[m])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[m+1]-i[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function _l(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Pn.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r))}return e}});function En(i,t,e,r,s,o,n){let a=(0,Om.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let c=s*r;for(let l=0;l<i.length;l+=2)e[c]=i[l],e[c+1]=i[l+1],c+=r}var Om,vl=p(()=>{Om=Io(bl(),1)});var $T,Lm,Nm=p(()=>{w();vl();$T=[],Lm={extension:{type:x.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){En(i,$T,t,e,r,s,o)}}});var Hm,Wm=p(()=>{w();Hm={extension:{type:x.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/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 zm,Vm=p(()=>{w();zm={extension:{type:x.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function $m(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function Ym(i,t){let e=O.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function YT(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(D("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??qt.defaultLinearOptions.textureSize}),t}var Xm,Sl,qt,ii=p(()=>{Mt();ct();Z();zr();et();Rt();dt();pc();Xm=[{offset:0,color:"white"},{offset:1,color:"black"}],Sl=class Tl{constructor(...t){this.uid=j("fillGradient"),this.type="linear",this.colorStops=[];let e=YT(t);e={...e.type==="radial"?Tl.defaultRadialOptions:Tl.defaultLinearOptions,...Xo(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:X.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=t;t=r,r=g,o*=-1}if(n<0){let g=e;e=s,s=g,n*=-1}}let c=this.colorStops.length?this.colorStops:Xm,l=this._textureSize,{canvas:h,context:u}=Ym(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);$m(d,c),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new C({source:new jt({resource:h,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),_=new G;_.scale(f/l,1),_.rotate(m),_.translate(t,e),this.textureSpace==="local"&&_.scale(l,l),this.transform=_}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:Xm,e=this._textureSize,{canvas:r,context:s}=Ym(e,e),{x:o,y:n}=this.center,{x:a,y:c}=this.outerCenter,l=this.innerRadius,h=this.outerRadius,u=a-h,d=c-h,f=e/(h*2),m=(o-u)*f,_=(n-d)*f,g=s.createRadialGradient(m,_,l*f,(a-u)*f,(c-d)*f,h*f);$m(g,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=g,s.translate(m,_),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-_),s.fillRect(0,0,e,e),this.texture=new C({source:new jt({resource:r,addressMode:this._wrapMode})});let b=new G;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}};Sl.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Sl.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};qt=Sl});function jm(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(KT);t.width&&n.pad(t.width);let{x:a,y:c}=n,l=1/n.width,h=1/n.height,u=-a*l,d=-c*h,f=s.a,m=s.b,_=s.c,g=s.d;s.a*=l,s.b*=l,s.c*=h,s.d*=h,s.tx=u*f+d*_+s.tx,s.ty=u*m+d*g+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 qt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(jT.copyFrom(r).invert()),s}var jT,KT,Km=p(()=>{Z();bt();ii();jT=new G,KT=new V});function Zm(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")QT(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,c=o.data.style,l=o.data.hole;n&&l&&qm(l.shapePath,c,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),qm(a,c,n,r,e)}}}function QT(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,c=[],l=Cn.rectangle,h=qT,u=i.image;h.x=i.dx,h.y=i.dy,h.width=i.dw,h.height=i.dh;let d=i.transform;l.build(h,c),d&&pl(c,d),l.triangulate(c,r,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let m=z.get(wr);m.indexOffset=n,m.indexSize=o.length-n,m.attributeOffset=a,m.attributeSize=r.length/2-a,m.baseColor=i.style,m.alpha=i.alpha,m.texture=u,m.geometryData=e,t.push(m)}function qm(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:c,transform:l,holes:h})=>{let u=a.length,d=o.length/2,f=[],m=Cn[c.type],_="triangle-list";if(m.build(c,f),l&&pl(f,l),e){let v=c.closePath??!0,T=t;T.pixelLine?(Gm(f,v,o,a),_="line-list"):Bm(f,T,!1,v,o,a)}else if(h){let v=[],T=f.slice();JT(h).forEach(S=>{v.push(T.length/2),T.push(...S)}),En(T,v,o,2,d,a,u)}else m.triangulate(f,o,2,d,a,u);let g=n.length/2,b=t.texture;if(b!==C.WHITE){let v=jm(ZT,t,c,l);bm(o,2,d,n,g,2,o.length/2-d,v)}else vm(n,g,2,o.length/2-d);let y=z.get(wr);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=_,r.push(y)})}function JT(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Cn[r.type].build(r,s),t.push(s)}return t}var Cn,qT,ZT,Qm=p(()=>{w();Z();bt();Tm();Sm();et();Dt();ml();Am();Rm();km();Nm();Wm();Vm();Km();vl();Cn={};k.handleByMap(x.ShapeBuilder,Cn);k.add(Hm,Lm,zm,ei,wm,Pm);qT=new V,ZT=new G});var wl,Pl,El,si,Mn=p(()=>{w();mn();fl();dc();dt();Dt();Qm();wl=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Pl=class{constructor(){this.batcher=new hs,this.instructions=new Ur}init(){this.instructions.reset()}get geometry(){return D(gd,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},El=class Al{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Al.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Al.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),Zm(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="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=z.get(Pl),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let h=0;h<r.length;h++)r[h].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let h=0;h<r.length;h++){let u=r[h];a.add(u)}a.finish(e.instructions);let c=a.geometry;c.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),c.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let l=a.batches;for(let h=0;h<l.length;h++){let u=l[h];u.bindGroup=$r(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new wl;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(z.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{z.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};El.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"graphicsContext"};El.defaultOptions={bezierSmoothness:.5};si=El});var tS,Cl,Ml,Bl,Rl,Gl,kl,Il,xt,me=p(()=>{"use strict";tS={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},Cl=0,Ml=1,Bl=2,Rl=3,Gl=4,kl=5,Il=class Jm{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Cl)}set blend(t){!!(this.data&1<<Cl)!==t&&(this.data^=1<<Cl)}get offsets(){return!!(this.data&1<<Ml)}set offsets(t){!!(this.data&1<<Ml)!==t&&(this.data^=1<<Ml)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Bl)}set culling(t){!!(this.data&1<<Bl)!==t&&(this.data^=1<<Bl)}get depthTest(){return!!(this.data&1<<Rl)}set depthTest(t){!!(this.data&1<<Rl)!==t&&(this.data^=1<<Rl)}get depthMask(){return!!(this.data&1<<kl)}set depthMask(t){!!(this.data&1<<kl)!==t&&(this.data^=1<<kl)}get clockwiseFrontFace(){return!!(this.data&1<<Gl)}set clockwiseFrontFace(t){!!(this.data&1<<Gl)!==t&&(this.data^=1<<Gl)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=tS[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new Jm;return t.depthTest=!1,t.blend=!0,t}};Il.default2d=Il.for2d();xt=Il});function Ae(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r}var oi=p(()=>{"use strict"});var ps,tg=p(()=>{w();me();Dt();oi();ml();ps=class{constructor(t,e){this.state=xt.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,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.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 r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Ae(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=z.get(wr);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=>{z.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}};ps.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"graphics"}});var Fl=p(()=>{w();Mn();tg();k.add(ps);k.add(si)});var Qe,Bn=p(()=>{"use strict";Qe=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"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var ms,eg=p(()=>{w();Z();Ye();Ht();os();Dt();oi();Bn();ms=class{constructor(t,e){this.localUniforms=new st({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Pt({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),r=e.batched,s=t.batched;if(e.batched=s,r!==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 r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.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&&(z.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ue(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Ae(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=z.get(Qe);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]&&z.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}};ms.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"mesh"}});var Ul=p(()=>{w();eg();k.add(ms)});var Rn,rg=p(()=>{"use strict";Rn=class{execute(t,e){let r=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(r),s.geometry.bind(a.geometry,o.glProgram);let l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,l,0)}}});function Dl(i,t=null){let e=i*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 r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var ig=p(()=>{"use strict"});function og(i){return{dynamicUpdate:sg(i,!0),staticUpdate:sg(i,!1)}}function sg(i,t){let e=[];e.push(`
|
|
254
254
|
|
|
255
255
|
var index = 0;
|
|
256
256
|
|
|
@@ -258,13 +258,13 @@ ${s.join(`
|
|
|
258
258
|
{
|
|
259
259
|
const p = ps[i];
|
|
260
260
|
|
|
261
|
-
`);let r=0;for(let o in i){let n=i[o];if(t!==n.dynamic)continue;e.push(`offset = index + ${r}`),e.push(n.code);let a=
|
|
261
|
+
`);let r=0;for(let o in i){let n=i[o];if(t!==n.dynamic)continue;e.push(`offset = index + ${r}`),e.push(n.code);let a=Kt(n.format);r+=a.stride/4}e.push(`
|
|
262
262
|
index += stride * 4;
|
|
263
263
|
}
|
|
264
264
|
`),e.unshift(`
|
|
265
265
|
var stride = ${r};
|
|
266
266
|
`);let s=e.join(`
|
|
267
|
-
`);return new Function("ps","f32v","u32v",s)}var
|
|
267
|
+
`);return new Function("ps","f32v","u32v",s)}var ng=p(()=>{Sr()});function eS(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s")}return t.join("_")}var Gn,ag=p(()=>{je();De();Yr();Sr();Kc();ig();ng();Gn=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let h in r){let u=r[h],d=Kt(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new be(e*4*s),this.dynamicAttributeBuffer=new be(e*4*o),this.indexBuffer=Dl(e);let n=new oe,a=0,c=0;this._staticBuffer=new mt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:Y.VERTEX|Y.COPY_DST}),this._dynamicBuffer=new mt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:Y.VERTEX|Y.COPY_DST});for(let h in r){let u=r[h],d=Kt(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:c*4,format:u.format}),c+=d.size)}n.addIndex(this.indexBuffer);let l=this.getParticleUpdate(r);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=eS(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return og(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new be(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new be(this._size*this._dynamicStride*4*4),this.indexBuffer=Dl(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.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 cg,lg=p(()=>{cg=`varying vec2 vUV;
|
|
268
268
|
varying vec4 vColor;
|
|
269
269
|
|
|
270
270
|
uniform sampler2D uTexture;
|
|
@@ -272,7 +272,7 @@ uniform sampler2D uTexture;
|
|
|
272
272
|
void main(void){
|
|
273
273
|
vec4 color = texture2D(uTexture, vUV) * vColor;
|
|
274
274
|
gl_FragColor = color;
|
|
275
|
-
}`});var
|
|
275
|
+
}`});var hg,ug=p(()=>{hg=`attribute vec2 aVertex;
|
|
276
276
|
attribute vec2 aUV;
|
|
277
277
|
attribute vec4 aColor;
|
|
278
278
|
|
|
@@ -311,7 +311,7 @@ void main(void){
|
|
|
311
311
|
vUV = aUV;
|
|
312
312
|
vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
|
|
313
313
|
}
|
|
314
|
-
`});var
|
|
314
|
+
`});var Ol,dg=p(()=>{Ol=`
|
|
315
315
|
struct ParticleUniforms {
|
|
316
316
|
uProjectionMatrix:mat3x3<f32>,
|
|
317
317
|
uColor:vec4<f32>,
|
|
@@ -364,8 +364,8 @@ fn mainFragment(
|
|
|
364
364
|
var sample = textureSample(uTexture, uSampler, uv) * color;
|
|
365
365
|
|
|
366
366
|
return sample;
|
|
367
|
-
}`});var Qn,ix=m(()=>{It();K();Mr();ni();_e();et();Jc();Jg();ex();rx();Qn=class extends xt{constructor(){let t=he.from({vertex:tx,fragment:Qg}),e=ue.from({fragment:{source:Th,entryPoint:"mainFragment"},vertex:{source:Th,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:M.WHITE.source,uSampler:new dn({}),uniforms:{uTranslationMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new V(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var xi,Sh=m(()=>{K();Vt();vs();ye();gi();Zg();ix();xi=class{constructor(t,e){this.state=_t.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new ot({uTranslationMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Qn,this.state=_t.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 Zn({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 r=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=Ve(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Re(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Is,sx=m(()=>{E();jg();Sh();Is=class extends xi{constructor(t){super(t,new qn)}};Is.extension={type:[x.WebGLPipes],name:"particle"}});var Jn,ox=m(()=>{"use strict";Jn=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var Gs,nx=m(()=>{E();ox();Sh();Gs=class extends xi{constructor(t){super(t,new Jn)}};Gs.extension={type:[x.WebGPUPipes],name:"particle"}});var wh=m(()=>{E();sx();nx();G.add(Is);G.add(Gs)});var Ie,ks=m(()=>{"use strict";Ie=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 Fs(i,t){let{texture:e,bounds:r}=i;Pn(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var Ph=m(()=>{Tl()});var Us,ax=m(()=>{E();Nt();ks();Ph();Us=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 r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),W.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,Fs(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:W.get(Ie)};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}};Us.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"text"}});var Eh,te,_i=m(()=>{ct();os();Eh=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=D.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return{canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=Ne(t),e=Ne(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:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},te=new Eh});function cx(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function lx(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return!1;return!0}function hx(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,c=0,l=e-1,h=r-1;for(;c<r&&cx(n,e,c);)++c;if(c===r)return z.EMPTY;for(;cx(n,e,h);)--h;for(;lx(n,e,a,c,h);)++a;for(;lx(n,e,l,c,h);)--l;return++l,++h,new z(a/t,c/t,(l-a)/t,(h-c)/t)}var ux=m(()=>{vt()});var dx,$e,ta=m(()=>{K();kt();dx={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"}},$e=class{constructor(t,e){this.uid=j("fillPattern"),this.transform=new B,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=dx[e].addressModeU,t.source.style.addressModeV=dx[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 px=Rc((iF,fx)=>{fx.exports=mw;var Ah={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},pw=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function mw(i){var t=[];return i.replace(pw,function(e,r,s){var o=r.toLowerCase();for(s=xw(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Ah[o])return s.unshift(r),t.push(s);if(s.length<Ah[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Ah[o])))}}),t}var gw=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function xw(i){var t=i.match(gw);return t?t.map(Number):[]}});function gx(i,t){let e=(0,mx.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let c=e[a],l=c[0],h=c;switch(l){case"M":o=h[1],n=h[2],t.moveTo(o,n);break;case"m":o+=h[1],n+=h[2],t.moveTo(o,n);break;case"H":o=h[1],t.lineTo(o,n);break;case"h":o+=h[1],t.lineTo(o,n);break;case"V":n=h[1],t.lineTo(o,n);break;case"v":n+=h[1],t.lineTo(o,n);break;case"L":o=h[1],n=h[2],t.lineTo(o,n);break;case"l":o+=h[1],n+=h[2],t.lineTo(o,n);break;case"C":o=h[5],n=h[6],t.bezierCurveTo(h[1],h[2],h[3],h[4],o,n);break;case"c":t.bezierCurveTo(o+h[1],n+h[2],o+h[3],n+h[4],o+h[5],n+h[6]),o+=h[5],n+=h[6];break;case"S":o=h[3],n=h[4],t.bezierCurveToShort(h[1],h[2],o,n);break;case"s":t.bezierCurveToShort(o+h[1],n+h[2],o+h[3],n+h[4]),o+=h[3],n+=h[4];break;case"Q":o=h[3],n=h[4],t.quadraticCurveTo(h[1],h[2],o,n);break;case"q":t.quadraticCurveTo(o+h[1],n+h[2],o+h[3],n+h[4]),o+=h[3],n+=h[4];break;case"T":o=h[1],n=h[2],t.quadraticCurveToShort(o,n);break;case"t":o+=h[1],n+=h[2],t.quadraticCurveToShort(o,n);break;case"A":o=h[6],n=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],o,n);break;case"a":o+=h[6],n+=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],o,n);break;case"Z":case"z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:k(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var mx,xx=m(()=>{mx=Jo(px(),1);st()});var ea,_x=m(()=>{vt();ea=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,c=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+c&&l>a-(r-c)}getBounds(t){return t||(t=new z),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 ra,yx=m(()=>{vt();ra=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=r*(1-s),c=r-a,l=o-c,h=n-c,u=o+a,d=n+a,f=t-this.x,p=e-this.y,g=f*f/(l*l)+p*p/(h*h),_=f*f/(u*u)+p*p/(d*d);return g>1&&_<=1}getBounds(t){return t||(t=new z),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 bx(i,t,e,r,s,o){let n=i-e,a=t-r,c=s-e,l=o-r,h=n*c+a*l,u=c*c+l*l,d=-1;u!==0&&(d=h/u);let f,p;d<0?(f=e,p=r):d>1?(f=s,p=o):(f=e+d*c,p=r+d*l);let g=i-f,_=t-p;return g*g+_*_}var vx=m(()=>{"use strict"});var _w,yw,yi,Tx=m(()=>{vx();vt();yi=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],c=e[(s+3)%r];t+=(a-o)*(c+n)}return t<0}containsPolygon(t){let e=this.getBounds(_w),r=t.getBounds(yw);if(!e.containsRect(r))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],c=this.points[o*2+1],l=this.points[n*2],h=this.points[n*2+1];c>e!=h>e&&t<(l-a)*((e-c)/(h-c))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:c}=this,l=c.length-(this.closePath?0:2);for(let h=0;h<l;h+=2){let u=c[h],d=c[h+1],f=c[(h+2)%c.length],p=c[(h+3)%c.length],g=bx(t,e,u,d,f,p),_=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(g<=(_<0?a:n))return!0}return!1}getBounds(t){t||(t=new z);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,c=e.length;a<c;a+=2){let l=e[a],h=e[a+1];r=l<r?l:r,s=l>s?l:s,o=h<o?h:o,n=h>n?h:n}return t.x=r,t.width=s-r,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 ia,sa,Sx=m(()=>{vt();ia=(i,t,e,r,s,o,n)=>{let a=i-e,c=t-r,l=Math.sqrt(a*a+c*c);return l>=s-o&&l<=s+n},sa=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new z),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:c,radius:l}=this,h=r*(1-s),u=r-h,d=o+l,f=n+l,p=a-l*2,g=c-l*2,_=o+a,b=n+c;return(t>=o-h&&t<=o+u||t>=_-u&&t<=_+h)&&e>=f&&e<=f+g||(e>=n-h&&e<=n+u||e>=b-u&&e<=b+h)&&t>=d&&t<=d+p?!0:t<d&&e<f&&ia(t,e,d,f,l,u,h)||t>_-l&&e<f&&ia(t,e,_-l,f,l,u,h)||t>_-l&&e>b-l&&ia(t,e,_-l,b-l,l,u,h)||t<d&&e>b-l&&ia(t,e,d,b-l,l,u,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function na(i,t,e,r,s,o,n,a,c,l){let u=Math.min(.99,Math.max(0,l??mi.defaultOptions.bezierSmoothness)),d=(vw-u)/1;return d*=d,Tw(t,e,r,s,o,n,a,c,i,d),i}function Tw(i,t,e,r,s,o,n,a,c,l){Mh(i,t,e,r,s,o,n,a,c,l,0),c.push(n,a)}function Mh(i,t,e,r,s,o,n,a,c,l,h){if(h>bw)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,p=(e+s)/2,g=(r+o)/2,_=(s+n)/2,b=(o+a)/2,y=(d+p)/2,v=(f+g)/2,S=(p+_)/2,P=(g+b)/2,T=(y+S)/2,w=(v+P)/2;if(h>0){let A=n-i,R=a-t,C=Math.abs((e-n)*R-(r-a)*A),I=Math.abs((s-n)*R-(o-a)*A),L,Y;if(C>oa&&I>oa){if((C+I)*(C+I)<=l*(A*A+R*R)){if(bi<Ch){c.push(T,w);return}let ht=Math.atan2(o-r,s-e);if(L=Math.abs(ht-Math.atan2(r-t,e-i)),Y=Math.abs(Math.atan2(a-o,n-s)-ht),L>=u&&(L=2*u-L),Y>=u&&(Y=2*u-Y),L+Y<bi){c.push(T,w);return}if(kr!==0){if(L>kr){c.push(e,r);return}if(Y>kr){c.push(s,o);return}}}}else if(C>oa){if(C*C<=l*(A*A+R*R)){if(bi<Ch){c.push(T,w);return}if(L=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),L>=u&&(L=2*u-L),L<bi){c.push(e,r),c.push(s,o);return}if(kr!==0&&L>kr){c.push(e,r);return}}}else if(I>oa){if(I*I<=l*(A*A+R*R)){if(bi<Ch){c.push(T,w);return}if(L=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),L>=u&&(L=2*u-L),L<bi){c.push(e,r),c.push(s,o);return}if(kr!==0&&L>kr){c.push(s,o);return}}}else if(A=T-(i+n)/2,R=w-(t+a)/2,A*A+R*R<=l){c.push(T,w);return}}Mh(i,t,d,f,y,v,T,w,c,l,h+1),Mh(T,w,S,P,_,b,n,a,c,l,h+1)}var bw,oa,vw,Ch,bi,kr,Bh=m(()=>{Yn();bw=8,oa=11920929e-14,vw=1,Ch=.01,bi=0,kr=0});function Px(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??mi.defaultOptions.bezierSmoothness)),h=(Pw-l)/1;return h*=h,Aw(t,e,r,s,o,n,i,h),i}function Aw(i,t,e,r,s,o,n,a){Rh(n,i,t,e,r,s,o,a,0),n.push(s,o)}function Rh(i,t,e,r,s,o,n,a,c){if(c>Sw)return;let l=Math.PI,h=(t+r)/2,u=(e+s)/2,d=(r+o)/2,f=(s+n)/2,p=(h+d)/2,g=(u+f)/2,_=o-t,b=n-e,y=Math.abs((r-o)*b-(s-n)*_);if(y>ww){if(y*y<=a*(_*_+b*b)){if(wx<Ew){i.push(p,g);return}let v=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(v>=l&&(v=2*l-v),v<wx){i.push(p,g);return}}}else if(_=p-(t+o)/2,b=g-(e+n)/2,_*_+b*b<=a){i.push(p,g);return}Rh(i,t,e,h,u,p,g,a,c+1),Rh(i,p,g,d,f,o,n,a,c+1)}var Sw,ww,Pw,Ew,wx,Ex=m(()=>{Yn();Sw=8,ww=11920929e-14,Pw=1,Ew=.01,wx=0});function aa(i,t,e,r,s,o,n,a){let c=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(c=2*Math.PI-c),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(c/Math.PI)))),a=Math.max(a,3);let l=c/a,h=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(h),f=Math.sin(h),p=t+d*r,g=e+f*r;i.push(p,g),h+=l}}var Ih=m(()=>{"use strict"});function Ax(i,t,e,r,s,o){let n=i[i.length-2],c=i[i.length-1]-e,l=n-t,h=s-e,u=r-t,d=Math.abs(c*u-l*h);if(d<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=c*c+l*l,p=h*h+u*u,g=c*h+l*u,_=o*Math.sqrt(f)/d,b=o*Math.sqrt(p)/d,y=_*g/f,v=b*g/p,S=_*u+b*l,P=_*h+b*c,T=l*(b+y),w=c*(b+y),A=u*(_+v),R=h*(_+v),C=Math.atan2(w-P,T-S),I=Math.atan2(R-P,A-S);aa(i,S+t,P+e,o,C,I,l*h>u*c)}var Cx=m(()=>{Ih()});function Cw(i,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return[{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function Bx(i,t,e,r,s,o,n,a=0,c=0,l=0){if(o===0||n===0)return;let h=Math.sin(a*Ds/360),u=Math.cos(a*Ds/360),d=u*(t-r)/2+h*(e-s)/2,f=-h*(t-r)/2+u*(e-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)),Mw(t,e,r,s,o,n,c,l,h,u,d,f,Gh);let{ang1:g,ang2:_}=Gh,{centerX:b,centerY:y}=Gh,v=Math.abs(_)/(Ds/4);Math.abs(1-v)<1e-7&&(v=1);let S=Math.max(Math.ceil(v),1);_/=S;let P=i[i.length-2],T=i[i.length-1],w={x:0,y:0};for(let A=0;A<S;A++){let R=Cw(g,_),{x:C,y:I}=kh(R[0],o,n,u,h,b,y,w),{x:L,y:Y}=kh(R[1],o,n,u,h,b,y,w),{x:ht,y:Ft}=kh(R[2],o,n,u,h,b,y,w);na(i,P,T,C,I,L,Y,ht,Ft),P=ht,T=Ft,g+=_}}var Ds,Gh,kh,Mx,Mw,Rx=m(()=>{Bh();Ds=Math.PI*2,Gh={centerX:0,centerY:0,ang1:0,ang2:0},kh=({x:i,y:t},e,r,s,o,n,a,c)=>{i*=e,t*=r;let l=s*i-o*t,h=o*i+s*t;return c.x=l+n,c.y=h+a,c};Mx=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},Mw=(i,t,e,r,s,o,n,a,c,l,h,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),g=Math.pow(h,2),_=Math.pow(u,2),b=f*p-f*_-p*g;b<0&&(b=0),b/=f*_+p*g,b=Math.sqrt(b)*(n===a?-1:1);let y=b*s/o*u,v=b*-o/s*h,S=l*y-c*v+(i+e)/2,P=c*y+l*v+(t+r)/2,T=(h-y)/s,w=(u-v)/o,A=(-h-y)/s,R=(-u-v)/o,C=Mx(1,0,T,w),I=Mx(T,w,A,R);a===0&&I>0&&(I-=Ds),a===1&&I<0&&(I+=Ds),d.centerX=S,d.centerY=P,d.ang1=C,d.ang2=I}});function Ix(i,t,e){let r=(n,a)=>{let c=a.x-n.x,l=a.y-n.y,h=Math.sqrt(c*c+l*l),u=c/h,d=l/h;return{len:h,nx:u,ny:d}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],c=a.radius??e;if(c<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],h=r(a,o),u=r(a,l);if(h.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(h.nx*u.ny-h.ny*u.nx),f=1,p=!1;h.nx*u.nx-h.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);let g=d/2,_,b=Math.abs(Math.cos(g)*c/Math.sin(g));b>Math.min(h.len/2,u.len/2)?(b=Math.min(h.len/2,u.len/2),_=Math.abs(b*Math.sin(g)/Math.cos(g))):_=c;let y=a.x+u.nx*b+-u.ny*_*f,v=a.y+u.ny*b+u.nx*_*f,S=Math.atan2(h.ny,h.nx)+Math.PI/2*f,P=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(y+Math.cos(S)*_,v+Math.sin(S)*_),i.arc(y,v,_,S,P,p),o=a}}function Gx(i,t,e,r){let s=(a,c)=>Math.sqrt((a.x-c.x)**2+(a.y-c.y)**2),o=(a,c,l)=>({x:a.x+(c.x-a.x)*l,y:a.y+(c.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let c=t[(a+1)%n],l=c.radius??e;if(l<=0){a===0?i.moveTo(c.x,c.y):i.lineTo(c.x,c.y);continue}let h=t[a],u=t[(a+2)%n],d=s(h,c),f;if(d<1e-4)f=c;else{let _=Math.min(d/2,l);f=o(c,h,_/d)}let p=s(u,c),g;if(p<1e-4)g=c;else{let _=Math.min(p/2,l);g=o(c,u,_/p)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(c.x,c.y,g.x,g.y,r)}}var kx=m(()=>{"use strict"});var Bw,ca,Fx=m(()=>{_x();yx();Tx();vt();Sx();Yt();Bh();Ex();Ih();Cx();Rx();kx();Bw=new z,ca=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new it,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return(s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return aa(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Ax(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let c=this._currentPoly.points;return Bx(c,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let c=this._currentPoly;return na(this._currentPoly.points,c.lastX,c.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return Px(this._currentPoly.points,n.lastX,n.lastY,t,e,r,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 r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let c=a.shape,l=o?.shape;l&&l.containsPolygon(c)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new z(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new ea(t,e,r),s),this}poly(t,e,r){let s=new yi(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,c=Math.PI*2/s,l=[];for(let h=0;h<s;h++){let u=a-h*c;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let c=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,c);let l=-1*Math.PI/2+n,h=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*h+l,p=t+r*Math.cos(f),g=e+r*Math.sin(f),_=f+Math.PI+u,b=f-Math.PI-u,y=p+o*Math.cos(_),v=g+o*Math.sin(_),S=p+o*Math.cos(b),P=g+o*Math.sin(b);d===0?this.moveTo(y,v):this.lineTo(y,v),this.quadraticCurveTo(p,g,S,P,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?Gx(this,t,e,s):Ix(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),c=t+r,l=e+s,h=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+h,e+h,t+u,e,u).lineTo(c-u,e).arcTo(c-h,e+h,c,e+u,u).lineTo(c,l-u).arcTo(c-h,l-h,t+r-u,l,u).lineTo(t+u,l).arcTo(t+h,l-h,t,l-u,u).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),c=t+r,l=e+s,h=[t+a,e,c-a,e,c,e+a,c,l-a,c-a,l,t+a,l,t,l-a,t,e+a];for(let u=h.length-1;u>=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,n)}ellipse(t,e,r,s,o){return this.drawShape(new ra(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new sa(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new yi,r.points.push(t,e),this._currentPoly=r,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 yi,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(r,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<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(Bw);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function Os(i,t){return i?i.prepend(t):t.clone()}var ar,Fh=m(()=>{ae();kt();st();xx();Fx();ar=class i{constructor(t,e=!1){this.instructions=[],this.uid=j("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?gx(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new ca(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,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint($.shared),c=0,l=0;if(!n||n.action!=="bezierCurveTo")c=a.x,l=a.y;else{c=n.data[2],l=n.data[3];let h=a.x,u=a.y;c=h+(h-c),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[c,l,t,e,r,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,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint($.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 c=o.x,l=o.y;n=c+(c-n),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,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,r,s,o,n,a){o||(o=s/2);let c=-1*Math.PI/2+n,l=r*2,h=Math.PI*2/l,u=[];for(let d=0;d<l;d++){let f=d%2?o:s,p=d*h+c;u.push(t+f*Math.cos(p),e+f*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,c=0,l=0,h=0,u=0,d=0,f=0,p=0,g=0;for(let _=0;_<this.instructions.length;_++){let b=this.instructions[_],y=b.data;switch(b.action){case"moveTo":case"lineTo":c=y[0],l=y[1],y[0]=e*c+s*l+n,y[1]=r*c+o*l+a;break;case"bezierCurveTo":h=y[0],u=y[1],d=y[2],f=y[3],c=y[4],l=y[5],y[0]=e*h+s*u+n,y[1]=r*h+o*u+a,y[2]=e*d+s*f+n,y[3]=r*d+o*f+a,y[4]=e*c+s*l+n,y[5]=r*c+o*l+a;break;case"quadraticCurveTo":h=y[0],u=y[1],c=y[2],l=y[3],y[0]=e*h+s*u+n,y[1]=r*h+o*u+a,y[2]=e*c+s*l+n,y[3]=r*c+o*l+a;break;case"arcToSvg":c=y[5],l=y[6],p=y[0],g=y[1],y[0]=e*p+s*g,y[1]=r*p+o*g,y[5]=e*c+s*l+n,y[6]=r*c+o*l+a;break;case"circle":y[4]=Os(y[3],t);break;case"rect":y[4]=Os(y[4],t);break;case"ellipse":y[8]=Os(y[8],t);break;case"roundRect":y[5]=Os(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=Os(y[2],t);break;default:k("unknown transform action",b.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}});function dt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Uh=m(()=>{"use strict"});function Ux(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=Rw(n);break;case"radialgradient":t.defs[n.id]=Iw(n);break;default:break}}}}function Rw(i){let t=dt(i,"x1",0),e=dt(i,"y1",0),r=dt(i,"x2",1),s=dt(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new Jt(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let c=i.children[a],l=dt(c,"offset",0),h=V.shared.setValue(c.getAttribute("stop-color")).toNumber();n.addColorStop(l,h)}return n}function Iw(i){return k("[SVG Parser] Radial gradients are not yet supported"),new Jt(0,0,1,0)}var Dx=m(()=>{It();st();pi();Uh()});function Dh(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var Ox=m(()=>{"use strict"});function Oh(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Lx){let a=i.getAttribute(n);a&&Nx(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let c=n[a].trim(),[l,h]=c.split(":");Lx[l]&&Nx(t,o,l,h.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function Nx(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Dh(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=V.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=Dh(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=V.shared.setValue(r).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(r);break;case"stroke-opacity":t.strokeStyle.alpha=Number(r);break;case"opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var Lx,Hx=m(()=>{It();Ox();Lx={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 Wx(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg")}let e={context:t,defs:{},path:new ar};Ux(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=Oh(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&zx(a,e,s,o)}return t}function zx(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=Oh(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let c,l,h,u,d,f,p,g,_,b,y,v,S,P,T,w,A;switch(i.nodeName.toLowerCase()){case"path":P=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&k("SVG Evenodd fill rule not supported, your svg may render incorrectly"),T=new ar(P,!0),t.context.path(T),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"circle":p=dt(i,"cx",0),g=dt(i,"cy",0),_=dt(i,"r",0),t.context.ellipse(p,g,_,_),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":c=dt(i,"x",0),l=dt(i,"y",0),w=dt(i,"width",0),A=dt(i,"height",0),b=dt(i,"rx",0),y=dt(i,"ry",0),b||y?t.context.roundRect(c,l,w,A,b||y):t.context.rect(c,l,w,A),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":p=dt(i,"cx",0),g=dt(i,"cy",0),b=dt(i,"rx",0),y=dt(i,"ry",0),t.context.beginPath(),t.context.ellipse(p,g,b,y),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":h=dt(i,"x1",0),u=dt(i,"y1",0),d=dt(i,"x2",0),f=dt(i,"y2",0),t.context.beginPath(),t.context.moveTo(h,u),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":S=i.getAttribute("points"),v=S.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(v,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":S=i.getAttribute("points"),v=S.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(v,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{k(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let R=0;R<s.length;R++)zx(s[R],t,e,r)}var Vx=m(()=>{st();Fh();Dx();Uh();Hx()});function Gw(i){return V.isColorLike(i)}function Xx(i){return i instanceof $e}function jx(i){return i instanceof Jt}function kw(i){return i instanceof M}function Fw(i,t,e){let r=V.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=M.WHITE,{...e,...i}}function Uw(i,t,e){return i.texture=t,{...e,...i}}function $x(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function Yx(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function Dw(i,t){let e={...t,...i},r=V.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Ye(i,t){if(i==null)return null;let e={},r=i;return Gw(i)?Fw(e,i,t):kw(i)?Uw(e,i,t):Xx(i)?$x(e,i,t):jx(i)?Yx(e,i,t):r.fill&&Xx(r.fill)?$x(r,r.fill,t):r.fill&&jx(r.fill)?Yx(r,r.fill,t):Dw(r,t)}function vi(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...c}=t,l=Ye(i,c);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var Lh=m(()=>{It();et();pi();ta()});var Ow,Kx,Nh,Xt,la=m(()=>{Dt();It();K();ae();et();kt();ft();Yt();Fh();Vx();Lh();Ow=new $,Kx=new B,Nh=class Ge extends nt{constructor(){super(...arguments),this.uid=j("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new ar,this._transform=new B,this._fillStyle={...Ge.defaultFillStyle},this._strokeStyle={...Ge.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new it,this._boundsDirty=!0}clone(){let t=new Ge;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=Ye(t,Ge.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=vi(t,Ge.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Ye(t,Ge.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Ye(t,Ge.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?V.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new ar,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(U(H,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Ye(t,Ge.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint($.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=vi(t,Ge.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],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else{e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,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,r,s,o,n),this}arcTo(t,e,r,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*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let c=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,c.a*n+c.c*a+c.tx,c.b*n+c.d*a+c.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let c=this._transform;return this._activePath.bezierCurveTo(c.a*t+c.c*e+c.tx,c.b*t+c.d*e+c.ty,c.a*r+c.c*s+c.tx,c.b*r+c.d*s+c.ty,c.a*o+c.c*n+c.tx,c.b*o+c.d*n+c.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.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,r,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*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,Wx(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,r,s,o,n){return t instanceof B?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof B?(this._transform.append(t),this):(Kx.set(t,e,r,s,o,n),this._transform.append(Kx),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<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),c=o.path.bounds;t.addFrame(c.minX-a,c.minY-a,c.maxX+a,c.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let c=n.style,l=a.shapePath.shapePrimitives;for(let h=0;h<l.length;h++){let u=l[h].shape;if(!c||!u)continue;let d=l[h].transform,f=d?d.applyInverse(t,Ow):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let g=c;r=u.strokeContains(f.x,f.y,g.width,g.alignment)}let p=n.hole;if(p){let g=p.shapePath?.shapePrimitives;if(g)for(let _=0;_<g.length;_++)g[_].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Nh.defaultFillStyle={color:16777215,alpha:1,texture:M.WHITE,matrix:null,fill:null,textureSpace:"local"};Nh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:M.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Xt=Nh});function ha(i){let t=[],e=0;for(let r=0;r<qx.length;r++){let s=`_${qx[r]}`;t[e++]=i[s]}return e=Zx(i._fill,t,e),e=Lw(i._stroke,t,e),e=Nw(i.dropShadow,t,e),t.join("-")}function Zx(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function Lw(i,t,e){return i&&(e=Zx(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function Nw(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=V.shared.setValue(i.color).toNumber()),e}var qx,Hh=m(()=>{It();qx=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function Hw(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=St.defaultDropShadow;i.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){U(H,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(V.isColorLike(e))r.color=e;else if(e instanceof Jt||e instanceof $e)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){U(H,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=St.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new Jt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>V.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var Wh,St,Fr=m(()=>{Dt();It();ft();pi();ta();la();Lh();Hh();Wh=class Ti extends nt{constructor(t={}){super(),Hw(t);let e={...Ti.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r]}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({...Ti.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Ti.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({...Xt.defaultFillStyle,...t},()=>{this._fill=Ye({...this._originalFill},Xt.defaultFillStyle)})),this._fill=Ye(t===0?"black":t,Xt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Xt.defaultStrokeStyle,...t},()=>{this._stroke=vi({...this._originalStroke},Xt.defaultStrokeStyle)})),this._stroke=vi(t,Xt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=ha(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Ti.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Ti({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 r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(V.isColorLike(t)||t instanceof Jt||t instanceof $e)}};Wh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Wh.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};St=Wh});function ua(i,t,e,r){let s=Ww;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=pt.getOptimalTexture(s.width,s.height,r,!1);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var Ww,zh=m(()=>{qe();Yt();Ww=new it});function Ur(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!zw.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var zw,da=m(()=>{"use strict";zw=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Vh,be,Ct,Ls=m(()=>{ct();da();Vh={willReadFrequently:!0},be=class O{static get experimentalLetterSpacingSupported(){let t=O._experimentalLetterSpacingSupported;if(t!==void 0){let e=D.get().getCanvasRenderingContext2D().prototype;t=O._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,c,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=c,this.fontProperties=l}static measureText(t=" ",e,r=O._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(O._measurementCache[o])return O._measurementCache[o];let n=Ur(e),a=O.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let c=O.__context;c.font=n;let h=(s?O._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let y=0;y<h.length;y++){let v=O._measureText(h[y],e.letterSpacing,c);u[y]=v,d=Math.max(d,v)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let g=e.lineHeight||a.fontSize,_=Math.max(g,a.fontSize+f)+(h.length-1)*(g+e.leading);return e.dropShadow&&(_+=e.dropShadow.distance),new O(t,e,p,_,h,u,g+e.leading,d,a)}static _measureText(t,e,r){let s=!1;O.experimentalLetterSpacingSupported&&(O.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else{let h=(O.graphemeSegmenter(t).length-1)*e;n+=h,l+=h}return Math.max(n,l)}static _wordWrap(t,e,r=O._canvas){let s=r.getContext("2d",Vh),o=0,n="",a="",c=Object.create(null),{letterSpacing:l,whiteSpace:h}=e,u=O._collapseSpaces(h),d=O._collapseNewlines(h),f=!u,p=e.wordWrapWidth+l,g=O._tokenize(t);for(let _=0;_<g.length;_++){let b=g[_];if(O._isNewline(b)){if(!d){a+=O._addLine(n),f=!u,n="",o=0;continue}b=" "}if(u){let v=O.isBreakingSpace(b),S=O.isBreakingSpace(n[n.length-1]);if(v&&S)continue}let y=O._getFromCache(b,l,c,s);if(y>p)if(n!==""&&(a+=O._addLine(n),n="",o=0),O.canBreakWords(b,e.breakWords)){let v=O.wordWrapSplit(b);for(let S=0;S<v.length;S++){let P=v[S],T=P,w=1;for(;v[S+w];){let R=v[S+w];if(!O.canBreakChars(T,R,b,S,e.breakWords))P+=R;else break;T=R,w++}S+=w-1;let A=O._getFromCache(P,l,c,s);A+o>p&&(a+=O._addLine(n),f=!1,n="",o=0),n+=P,o+=A}}else{n.length>0&&(a+=O._addLine(n),n="",o=0);let v=_===g.length-1;a+=O._addLine(b,!v),f=!1,n="",o=0}else y+o>p&&(f=!1,a+=O._addLine(n),n="",o=0),(n.length>0||!O.isBreakingSpace(b)||f)&&(n+=b,o+=y)}return a+=O._addLine(n,!1),a}static _addLine(t,e=!0){return t=O._trimRight(t),t=e?`${t}
|
|
368
|
-
`:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=O._measureText(t,e,s)+e,r[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 r=t[e];if(!O.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:O._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:O._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(O.isBreakingSpace(o,n)||O._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return!0}static wordWrapSplit(t){return O.graphemeSegmenter(t)}static measureFont(t){if(O._fonts[t])return O._fonts[t];let e=O._context;e.font=t;let r=e.measureText(O.METRICS_STRING+O.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return O._fonts[t]=s,s}static clearMetrics(t=""){t?delete O._fonts[t]:O._fonts={}}static get _canvas(){if(!O.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",Vh)?.measureText)return O.__canvas=e,e;t=D.get().createCanvas()}catch{t=D.get().createCanvas()}t.width=t.height=10,O.__canvas=t}return O.__canvas}static get _context(){return O.__context||(O.__context=O._canvas.getContext("2d",Vh)),O.__context}};be.METRICS_STRING="|\xC9q\xC5";be.BASELINE_SYMBOL="M";be.BASELINE_MULTIPLIER=1.4;be.HEIGHT_MULTIPLIER=2;be.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();be.experimentalLetterSpacing=!1;be._fonts={};be._newlines=[10,13];be._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];be._measurementCache={};Ct=be});function Si(i,t,e,r=0){if(i.texture===M.WHITE&&!i.fill)return V.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof $e){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(B.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof Jt){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,c=1;n&&e&&(a=e.width+r,c=e.height+r);let l,h=!1;if(o){let{start:u,end:d}=s;l=t.createLinearGradient(u.x*a,u.y*c,d.x*a,d.y*c),h=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:p}=s;l=t.createRadialGradient(u.x*a,u.y*c,d*a,f.x*a,f.y*c,p*a)}if(h&&n&&e){let u=e.lineHeight/c;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+r/2)/c;s.colorStops.forEach(p=>{let g=f+p.offset*u;l.addColorStop(Math.floor(g*Qx)/Qx,V.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,V.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(B.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return k("FillStyle not recognised",i),"red"}var Qx,Xh=m(()=>{It();K();et();st();pi();ta();Qx=1e5});var Ns,Jx=m(()=>{It();E();os();_i();qe();ux();ft();Fr();zh();Ls();da();Xh();Ns=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let s=Ct.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=Ne(o),n=Ne(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(U("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof St||(t.style=new St(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),te.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=Ct.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),c=te.getOptimalCanvasAndContext(n,a),{canvas:l}=c;this.renderTextToCanvas(e,r,s,c);let h=ua(l,n,a,s);if(r.trim){let u=hx(l,s);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:c}}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:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",pt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(te.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=Ur(e),c=Ct.measureText(t||" ",e),l=c.lines,h=c.lineHeight,u=c.lineWidths,d=c.maxLineWidth,f=c.fontProperties,p=o.height;if(n.resetTransform(),n.scale(r,r),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,_,b=e.dropShadow?2:1;for(let y=0;y<b;++y){let v=e.dropShadow&&y===0,S=v?Math.ceil(Math.max(1,p)+e.padding*2):0,P=S*r;if(v){n.fillStyle="black",n.strokeStyle="black";let A=e.dropShadow,R=A.color,C=A.alpha;n.shadowColor=V.shared.setValue(R).setAlpha(C).toRgbaString();let I=A.blur*r,L=A.distance*r;n.shadowBlur=I,n.shadowOffsetX=Math.cos(A.angle)*L,n.shadowOffsetY=Math.sin(A.angle)*L+P}else{if(n.fillStyle=e._fill?Si(e._fill,n,c):null,e._stroke?.width){let A=e._stroke.width*e._stroke.alignment;n.strokeStyle=Si(e._stroke,n,c,A)}n.shadowColor="black"}let T=(h-f.fontSize)/2;h-f.fontSize<0&&(T=0);let w=e._stroke?.width??0;for(let A=0;A<l.length;A++)g=w/2,_=w/2+A*h+f.ascent+T,e.align==="right"?g+=d-u[A]:e.align==="center"&&(g+=(d-u[A])/2),e._stroke?.width&&this._drawLetterSpacing(l[A],e,s,g+e.padding,_+e.padding-S,!0),e._fill!==void 0&&this._drawLetterSpacing(l[A],e,s,g+e.padding,_+e.padding-S)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,c=e.letterSpacing,l=!1;if(Ct.experimentalLetterSpacingSupported&&(Ct.experimentalLetterSpacing?(a.letterSpacing=`${c}px`,a.textLetterSpacing=`${c}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),c===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let h=s,u=Ct.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let g=u[p];n?a.strokeText(g,h,o):a.fillText(g,h,o);let _="";for(let b=p+1;b<u.length;++b)_+=u[b];f=a.measureText(_).width,h+=d-f+c,d=f}}destroy(){this._activeTextures=null}};Ns.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"canvasText"}});var jh=m(()=>{E();ax();Jx();G.add(Ns);G.add(Us)});var jt,$h=m(()=>{ft();Tn();la();jt=class i extends Je{constructor(t){t instanceof Xt&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Xt,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!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 i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){U(H,"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),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){U(H,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){U(H,"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!==Xt.defaultStrokeStyle.width||t.color!==Xt.defaultStrokeStyle.color||t.alpha!==Xt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return U(H,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return U(H,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return U(H,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return U(H,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return U(H,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return U(H,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var t_,e_,r_=m(()=>{"use strict";t_={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
367
|
+
}`});var kn,fg=p(()=>{Mt();Z();Tr();Kr();pe();et();mc();lg();ug();dg();kn=class extends gt{constructor(){let t=ne.from({vertex:hg,fragment:cg}),e=ae.from({fragment:{source:Ol,entryPoint:"mainFragment"},vertex:{source:Ol,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:C.WHITE.source,uSampler:new $o({}),uniforms:{uTranslationMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new X(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var ni,Ll=p(()=>{Z();Ht();os();me();oi();ag();fg();ni=class{constructor(t,e){this.state=xt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new st({uTranslationMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new kn,this.state=xt.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 Gn({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 r=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=Ue(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Ae(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var gs,pg=p(()=>{w();rg();Ll();gs=class extends ni{constructor(t){super(t,new Rn)}};gs.extension={type:[x.WebGLPipes],name:"particle"}});var In,mg=p(()=>{"use strict";In=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var xs,gg=p(()=>{w();mg();Ll();xs=class extends ni{constructor(t){super(t,new In)}};xs.extension={type:[x.WebGPUPipes],name:"particle"}});var Nl=p(()=>{w();pg();gg();k.add(gs);k.add(xs)});var Ee,_s=p(()=>{"use strict";Ee=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 ys(i,t){let{texture:e,bounds:r}=i;nn(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var Hl=p(()=>{Oc()});var bs,xg=p(()=>{w();Dt();_s();Hl();bs=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 r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),z.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,ys(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:z.get(Ee)};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}};bs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"text"}});var Wl,Zt,ai=p(()=>{ct();zi();Wl=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=O.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return{canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=Ge(t),e=Ge(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:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},Zt=new Wl});function _g(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function yg(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return!1;return!0}function bg(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,c=0,l=e-1,h=r-1;for(;c<r&&_g(n,e,c);)++c;if(c===r)return V.EMPTY;for(;_g(n,e,h);)--h;for(;yg(n,e,a,c,h);)++a;for(;yg(n,e,l,c,h);)--l;return++l,++h,new V(a/t,c/t,(l-a)/t,(h-c)/t)}var vg=p(()=>{bt()});var Tg,Le,Fn=p(()=>{Z();Rt();Tg={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"}},Le=class{constructor(t,e){this.uid=j("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Tg[e].addressModeU,t.source.style.addressModeV=Tg[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 wg=Ya((Bk,Sg)=>{Sg.exports=iS;var zl={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},rS=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function iS(i){var t=[];return i.replace(rS,function(e,r,s){var o=r.toLowerCase();for(s=oS(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==zl[o])return s.unshift(r),t.push(s);if(s.length<zl[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,zl[o])))}}),t}var sS=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function oS(i){var t=i.match(sS);return t?t.map(Number):[]}});function Ag(i,t){let e=(0,Pg.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let c=e[a],l=c[0],h=c;switch(l){case"M":o=h[1],n=h[2],t.moveTo(o,n);break;case"m":o+=h[1],n+=h[2],t.moveTo(o,n);break;case"H":o=h[1],t.lineTo(o,n);break;case"h":o+=h[1],t.lineTo(o,n);break;case"V":n=h[1],t.lineTo(o,n);break;case"v":n+=h[1],t.lineTo(o,n);break;case"L":o=h[1],n=h[2],t.lineTo(o,n);break;case"l":o+=h[1],n+=h[2],t.lineTo(o,n);break;case"C":o=h[5],n=h[6],t.bezierCurveTo(h[1],h[2],h[3],h[4],o,n);break;case"c":t.bezierCurveTo(o+h[1],n+h[2],o+h[3],n+h[4],o+h[5],n+h[6]),o+=h[5],n+=h[6];break;case"S":o=h[3],n=h[4],t.bezierCurveToShort(h[1],h[2],o,n);break;case"s":t.bezierCurveToShort(o+h[1],n+h[2],o+h[3],n+h[4]),o+=h[3],n+=h[4];break;case"Q":o=h[3],n=h[4],t.quadraticCurveTo(h[1],h[2],o,n);break;case"q":t.quadraticCurveTo(o+h[1],n+h[2],o+h[3],n+h[4]),o+=h[3],n+=h[4];break;case"T":o=h[1],n=h[2],t.quadraticCurveToShort(o,n);break;case"t":o+=h[1],n+=h[2],t.quadraticCurveToShort(o,n);break;case"A":o=h[6],n=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],o,n);break;case"a":o+=h[6],n+=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],o,n);break;case"Z":case"z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:F(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var Pg,Eg=p(()=>{Pg=Io(wg(),1);it()});var Un,Cg=p(()=>{bt();Un=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,c=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+c&&l>a-(r-c)}getBounds(t){return t||(t=new V),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 Dn,Mg=p(()=>{bt();Dn=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=r*(1-s),c=r-a,l=o-c,h=n-c,u=o+a,d=n+a,f=t-this.x,m=e-this.y,_=f*f/(l*l)+m*m/(h*h),g=f*f/(u*u)+m*m/(d*d);return _>1&&g<=1}getBounds(t){return t||(t=new V),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 Bg(i,t,e,r,s,o){let n=i-e,a=t-r,c=s-e,l=o-r,h=n*c+a*l,u=c*c+l*l,d=-1;u!==0&&(d=h/u);let f,m;d<0?(f=e,m=r):d>1?(f=s,m=o):(f=e+d*c,m=r+d*l);let _=i-f,g=t-m;return _*_+g*g}var Rg=p(()=>{"use strict"});var nS,aS,ci,Gg=p(()=>{Rg();bt();ci=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],c=e[(s+3)%r];t+=(a-o)*(c+n)}return t<0}containsPolygon(t){let e=this.getBounds(nS),r=t.getBounds(aS);if(!e.containsRect(r))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],c=this.points[o*2+1],l=this.points[n*2],h=this.points[n*2+1];c>e!=h>e&&t<(l-a)*((e-c)/(h-c))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:c}=this,l=c.length-(this.closePath?0:2);for(let h=0;h<l;h+=2){let u=c[h],d=c[h+1],f=c[(h+2)%c.length],m=c[(h+3)%c.length],_=Bg(t,e,u,d,f,m),g=Math.sign((f-u)*(e-d)-(m-d)*(t-u));if(_<=(g<0?a:n))return!0}return!1}getBounds(t){t||(t=new V);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,c=e.length;a<c;a+=2){let l=e[a],h=e[a+1];r=l<r?l:r,s=l>s?l:s,o=h<o?h:o,n=h>n?h:n}return t.x=r,t.width=s-r,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 On,Ln,kg=p(()=>{bt();On=(i,t,e,r,s,o,n)=>{let a=i-e,c=t-r,l=Math.sqrt(a*a+c*c);return l>=s-o&&l<=s+n},Ln=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new V),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:c,radius:l}=this,h=r*(1-s),u=r-h,d=o+l,f=n+l,m=a-l*2,_=c-l*2,g=o+a,b=n+c;return(t>=o-h&&t<=o+u||t>=g-u&&t<=g+h)&&e>=f&&e<=f+_||(e>=n-h&&e<=n+u||e>=b-u&&e<=b+h)&&t>=d&&t<=d+m?!0:t<d&&e<f&&On(t,e,d,f,l,u,h)||t>g-l&&e<f&&On(t,e,g-l,f,l,u,h)||t>g-l&&e>b-l&&On(t,e,g-l,b-l,l,u,h)||t<d&&e>b-l&&On(t,e,d,b-l,l,u,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Hn(i,t,e,r,s,o,n,a,c,l){let u=Math.min(.99,Math.max(0,l??si.defaultOptions.bezierSmoothness)),d=(lS-u)/1;return d*=d,hS(t,e,r,s,o,n,a,c,i,d),i}function hS(i,t,e,r,s,o,n,a,c,l){Xl(i,t,e,r,s,o,n,a,c,l,0),c.push(n,a)}function Xl(i,t,e,r,s,o,n,a,c,l,h){if(h>cS)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,m=(e+s)/2,_=(r+o)/2,g=(s+n)/2,b=(o+a)/2,y=(d+m)/2,v=(f+_)/2,T=(m+g)/2,R=(_+b)/2,S=(y+T)/2,P=(v+R)/2;if(h>0){let A=n-i,M=a-t,E=Math.abs((e-n)*M-(r-a)*A),B=Math.abs((s-n)*M-(o-a)*A),I,H;if(E>Nn&&B>Nn){if((E+B)*(E+B)<=l*(A*A+M*M)){if(li<Vl){c.push(S,P);return}let $=Math.atan2(o-r,s-e);if(I=Math.abs($-Math.atan2(r-t,e-i)),H=Math.abs(Math.atan2(a-o,n-s)-$),I>=u&&(I=2*u-I),H>=u&&(H=2*u-H),I+H<li){c.push(S,P);return}if(Er!==0){if(I>Er){c.push(e,r);return}if(H>Er){c.push(s,o);return}}}}else if(E>Nn){if(E*E<=l*(A*A+M*M)){if(li<Vl){c.push(S,P);return}if(I=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),I>=u&&(I=2*u-I),I<li){c.push(e,r),c.push(s,o);return}if(Er!==0&&I>Er){c.push(e,r);return}}}else if(B>Nn){if(B*B<=l*(A*A+M*M)){if(li<Vl){c.push(S,P);return}if(I=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),I>=u&&(I=2*u-I),I<li){c.push(e,r),c.push(s,o);return}if(Er!==0&&I>Er){c.push(s,o);return}}}else if(A=S-(i+n)/2,M=P-(t+a)/2,A*A+M*M<=l){c.push(S,P);return}}Xl(i,t,d,f,y,v,S,P,c,l,h+1),Xl(S,P,T,R,g,b,n,a,c,l,h+1)}var cS,Nn,lS,Vl,li,Er,$l=p(()=>{Mn();cS=8,Nn=11920929e-14,lS=1,Vl=.01,li=0,Er=0});function Fg(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??si.defaultOptions.bezierSmoothness)),h=(fS-l)/1;return h*=h,mS(t,e,r,s,o,n,i,h),i}function mS(i,t,e,r,s,o,n,a){Yl(n,i,t,e,r,s,o,a,0),n.push(s,o)}function Yl(i,t,e,r,s,o,n,a,c){if(c>uS)return;let l=Math.PI,h=(t+r)/2,u=(e+s)/2,d=(r+o)/2,f=(s+n)/2,m=(h+d)/2,_=(u+f)/2,g=o-t,b=n-e,y=Math.abs((r-o)*b-(s-n)*g);if(y>dS){if(y*y<=a*(g*g+b*b)){if(Ig<pS){i.push(m,_);return}let v=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(v>=l&&(v=2*l-v),v<Ig){i.push(m,_);return}}}else if(g=m-(t+o)/2,b=_-(e+n)/2,g*g+b*b<=a){i.push(m,_);return}Yl(i,t,e,h,u,m,_,a,c+1),Yl(i,m,_,d,f,o,n,a,c+1)}var uS,dS,fS,pS,Ig,Ug=p(()=>{Mn();uS=8,dS=11920929e-14,fS=1,pS=.01,Ig=0});function Wn(i,t,e,r,s,o,n,a){let c=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(c=2*Math.PI-c),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(c/Math.PI)))),a=Math.max(a,3);let l=c/a,h=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(h),f=Math.sin(h),m=t+d*r,_=e+f*r;i.push(m,_),h+=l}}var jl=p(()=>{"use strict"});function Dg(i,t,e,r,s,o){let n=i[i.length-2],c=i[i.length-1]-e,l=n-t,h=s-e,u=r-t,d=Math.abs(c*u-l*h);if(d<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=c*c+l*l,m=h*h+u*u,_=c*h+l*u,g=o*Math.sqrt(f)/d,b=o*Math.sqrt(m)/d,y=g*_/f,v=b*_/m,T=g*u+b*l,R=g*h+b*c,S=l*(b+y),P=c*(b+y),A=u*(g+v),M=h*(g+v),E=Math.atan2(P-R,S-T),B=Math.atan2(M-R,A-T);Wn(i,T+t,R+e,o,E,B,l*h>u*c)}var Og=p(()=>{jl()});function gS(i,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return[{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function Ng(i,t,e,r,s,o,n,a=0,c=0,l=0){if(o===0||n===0)return;let h=Math.sin(a*vs/360),u=Math.cos(a*vs/360),d=u*(t-r)/2+h*(e-s)/2,f=-h*(t-r)/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)),xS(t,e,r,s,o,n,c,l,h,u,d,f,Kl);let{ang1:_,ang2:g}=Kl,{centerX:b,centerY:y}=Kl,v=Math.abs(g)/(vs/4);Math.abs(1-v)<1e-7&&(v=1);let T=Math.max(Math.ceil(v),1);g/=T;let R=i[i.length-2],S=i[i.length-1],P={x:0,y:0};for(let A=0;A<T;A++){let M=gS(_,g),{x:E,y:B}=ql(M[0],o,n,u,h,b,y,P),{x:I,y:H}=ql(M[1],o,n,u,h,b,y,P),{x:$,y:ot}=ql(M[2],o,n,u,h,b,y,P);Hn(i,R,S,E,B,I,H,$,ot),R=$,S=ot,_+=g}}var vs,Kl,ql,Lg,xS,Hg=p(()=>{$l();vs=Math.PI*2,Kl={centerX:0,centerY:0,ang1:0,ang2:0},ql=({x:i,y:t},e,r,s,o,n,a,c)=>{i*=e,t*=r;let l=s*i-o*t,h=o*i+s*t;return c.x=l+n,c.y=h+a,c};Lg=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},xS=(i,t,e,r,s,o,n,a,c,l,h,u,d)=>{let f=Math.pow(s,2),m=Math.pow(o,2),_=Math.pow(h,2),g=Math.pow(u,2),b=f*m-f*g-m*_;b<0&&(b=0),b/=f*g+m*_,b=Math.sqrt(b)*(n===a?-1:1);let y=b*s/o*u,v=b*-o/s*h,T=l*y-c*v+(i+e)/2,R=c*y+l*v+(t+r)/2,S=(h-y)/s,P=(u-v)/o,A=(-h-y)/s,M=(-u-v)/o,E=Lg(1,0,S,P),B=Lg(S,P,A,M);a===0&&B>0&&(B-=vs),a===1&&B<0&&(B+=vs),d.centerX=T,d.centerY=R,d.ang1=E,d.ang2=B}});function Wg(i,t,e){let r=(n,a)=>{let c=a.x-n.x,l=a.y-n.y,h=Math.sqrt(c*c+l*l),u=c/h,d=l/h;return{len:h,nx:u,ny:d}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],c=a.radius??e;if(c<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],h=r(a,o),u=r(a,l);if(h.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(h.nx*u.ny-h.ny*u.nx),f=1,m=!1;h.nx*u.nx-h.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,m=!0):d>0&&(f=-1,m=!0);let _=d/2,g,b=Math.abs(Math.cos(_)*c/Math.sin(_));b>Math.min(h.len/2,u.len/2)?(b=Math.min(h.len/2,u.len/2),g=Math.abs(b*Math.sin(_)/Math.cos(_))):g=c;let y=a.x+u.nx*b+-u.ny*g*f,v=a.y+u.ny*b+u.nx*g*f,T=Math.atan2(h.ny,h.nx)+Math.PI/2*f,R=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(y+Math.cos(T)*g,v+Math.sin(T)*g),i.arc(y,v,g,T,R,m),o=a}}function zg(i,t,e,r){let s=(a,c)=>Math.sqrt((a.x-c.x)**2+(a.y-c.y)**2),o=(a,c,l)=>({x:a.x+(c.x-a.x)*l,y:a.y+(c.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let c=t[(a+1)%n],l=c.radius??e;if(l<=0){a===0?i.moveTo(c.x,c.y):i.lineTo(c.x,c.y);continue}let h=t[a],u=t[(a+2)%n],d=s(h,c),f;if(d<1e-4)f=c;else{let g=Math.min(d/2,l);f=o(c,h,g/d)}let m=s(u,c),_;if(m<1e-4)_=c;else{let g=Math.min(m/2,l);_=o(c,u,g/m)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(c.x,c.y,_.x,_.y,r)}}var Vg=p(()=>{"use strict"});var _S,zn,Xg=p(()=>{Cg();Mg();Gg();bt();kg();Xt();$l();Ug();jl();Og();Hg();Vg();_S=new V,zn=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new rt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return(s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Wn(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Dg(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let c=this._currentPoly.points;return Ng(c,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let c=this._currentPoly;return Hn(this._currentPoly.points,c.lastX,c.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return Fg(this._currentPoly.points,n.lastX,n.lastY,t,e,r,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 r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let c=a.shape,l=o?.shape;l&&l.containsPolygon(c)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new V(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new Un(t,e,r),s),this}poly(t,e,r){let s=new ci(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,c=Math.PI*2/s,l=[];for(let h=0;h<s;h++){let u=a-h*c;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let c=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,c);let l=-1*Math.PI/2+n,h=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*h+l,m=t+r*Math.cos(f),_=e+r*Math.sin(f),g=f+Math.PI+u,b=f-Math.PI-u,y=m+o*Math.cos(g),v=_+o*Math.sin(g),T=m+o*Math.cos(b),R=_+o*Math.sin(b);d===0?this.moveTo(y,v):this.lineTo(y,v),this.quadraticCurveTo(m,_,T,R,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?zg(this,t,e,s):Wg(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),c=t+r,l=e+s,h=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+h,e+h,t+u,e,u).lineTo(c-u,e).arcTo(c-h,e+h,c,e+u,u).lineTo(c,l-u).arcTo(c-h,l-h,t+r-u,l,u).lineTo(t+u,l).arcTo(t+h,l-h,t,l-u,u).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),c=t+r,l=e+s,h=[t+a,e,c-a,e,c,e+a,c,l-a,c-a,l,t+a,l,t,l-a,t,e+a];for(let u=h.length-1;u>=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,n)}ellipse(t,e,r,s,o){return this.drawShape(new Dn(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new Ln(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new ci,r.points.push(t,e),this._currentPoly=r,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 ci,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(r,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<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(_S);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function Ts(i,t){return i?i.prepend(t):t.clone()}var Je,Zl=p(()=>{ie();Rt();it();Eg();Xg();Je=class i{constructor(t,e=!1){this.instructions=[],this.uid=j("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Ag(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new zn(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,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(K.shared),c=0,l=0;if(!n||n.action!=="bezierCurveTo")c=a.x,l=a.y;else{c=n.data[2],l=n.data[3];let h=a.x,u=a.y;c=h+(h-c),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[c,l,t,e,r,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,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(K.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 c=o.x,l=o.y;n=c+(c-n),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,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,r,s,o,n,a){o||(o=s/2);let c=-1*Math.PI/2+n,l=r*2,h=Math.PI*2/l,u=[];for(let d=0;d<l;d++){let f=d%2?o:s,m=d*h+c;u.push(t+f*Math.cos(m),e+f*Math.sin(m))}return this.poly(u,!0,a),this}clone(t=!1){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,c=0,l=0,h=0,u=0,d=0,f=0,m=0,_=0;for(let g=0;g<this.instructions.length;g++){let b=this.instructions[g],y=b.data;switch(b.action){case"moveTo":case"lineTo":c=y[0],l=y[1],y[0]=e*c+s*l+n,y[1]=r*c+o*l+a;break;case"bezierCurveTo":h=y[0],u=y[1],d=y[2],f=y[3],c=y[4],l=y[5],y[0]=e*h+s*u+n,y[1]=r*h+o*u+a,y[2]=e*d+s*f+n,y[3]=r*d+o*f+a,y[4]=e*c+s*l+n,y[5]=r*c+o*l+a;break;case"quadraticCurveTo":h=y[0],u=y[1],c=y[2],l=y[3],y[0]=e*h+s*u+n,y[1]=r*h+o*u+a,y[2]=e*c+s*l+n,y[3]=r*c+o*l+a;break;case"arcToSvg":c=y[5],l=y[6],m=y[0],_=y[1],y[0]=e*m+s*_,y[1]=r*m+o*_,y[5]=e*c+s*l+n,y[6]=r*c+o*l+a;break;case"circle":y[4]=Ts(y[3],t);break;case"rect":y[4]=Ts(y[4],t);break;case"ellipse":y[8]=Ts(y[8],t);break;case"roundRect":y[5]=Ts(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=Ts(y[2],t);break;default:F("unknown transform action",b.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}});function ut(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Ql=p(()=>{"use strict"});function $g(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=yS(n);break;case"radialgradient":t.defs[n.id]=bS(n);break;default:break}}}}function yS(i){let t=ut(i,"x1",0),e=ut(i,"y1",0),r=ut(i,"x2",1),s=ut(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new qt(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let c=i.children[a],l=ut(c,"offset",0),h=X.shared.setValue(c.getAttribute("stop-color")).toNumber();n.addColorStop(l,h)}return n}function bS(i){return F("[SVG Parser] Radial gradients are not yet supported"),new qt(0,0,1,0)}var Yg=p(()=>{Mt();it();ii();Ql()});function Jl(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var jg=p(()=>{"use strict"});function th(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Kg){let a=i.getAttribute(n);a&&qg(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let c=n[a].trim(),[l,h]=c.split(":");Kg[l]&&qg(t,o,l,h.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function qg(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Jl(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=X.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=Jl(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=X.shared.setValue(r).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(r);break;case"stroke-opacity":t.strokeStyle.alpha=Number(r);break;case"opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var Kg,Zg=p(()=>{Mt();jg();Kg={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 Qg(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg")}let e={context:t,defs:{},path:new Je};$g(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=th(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&Jg(a,e,s,o)}return t}function Jg(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=th(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let c,l,h,u,d,f,m,_,g,b,y,v,T,R,S,P,A;switch(i.nodeName.toLowerCase()){case"path":R=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&F("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new Je(R,!0),t.context.path(S),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"circle":m=ut(i,"cx",0),_=ut(i,"cy",0),g=ut(i,"r",0),t.context.ellipse(m,_,g,g),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":c=ut(i,"x",0),l=ut(i,"y",0),P=ut(i,"width",0),A=ut(i,"height",0),b=ut(i,"rx",0),y=ut(i,"ry",0),b||y?t.context.roundRect(c,l,P,A,b||y):t.context.rect(c,l,P,A),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":m=ut(i,"cx",0),_=ut(i,"cy",0),b=ut(i,"rx",0),y=ut(i,"ry",0),t.context.beginPath(),t.context.ellipse(m,_,b,y),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":h=ut(i,"x1",0),u=ut(i,"y1",0),d=ut(i,"x2",0),f=ut(i,"y2",0),t.context.beginPath(),t.context.moveTo(h,u),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":T=i.getAttribute("points"),v=T.match(/\d+/g).map(M=>parseInt(M,10)),t.context.poly(v,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":T=i.getAttribute("points"),v=T.match(/\d+/g).map(M=>parseInt(M,10)),t.context.poly(v,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{F(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let M=0;M<s.length;M++)Jg(s[M],t,e,r)}var tx=p(()=>{it();Zl();Yg();Ql();Zg()});function vS(i){return X.isColorLike(i)}function ex(i){return i instanceof Le}function rx(i){return i instanceof qt}function TS(i){return i instanceof C}function SS(i,t,e){let r=X.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=C.WHITE,{...e,...i}}function wS(i,t,e){return i.texture=t,{...e,...i}}function ix(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function sx(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function PS(i,t){let e={...t,...i},r=X.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Ne(i,t){if(i==null)return null;let e={},r=i;return vS(i)?SS(e,i,t):TS(i)?wS(e,i,t):ex(i)?ix(e,i,t):rx(i)?sx(e,i,t):r.fill&&ex(r.fill)?ix(r,r.fill,t):r.fill&&rx(r.fill)?sx(r,r.fill,t):PS(r,t)}function hi(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...c}=t,l=Ne(i,c);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var eh=p(()=>{Mt();et();ii();Fn()});var AS,ox,rh,Wt,Vn=p(()=>{kt();Mt();Z();ie();et();Rt();dt();Xt();Zl();tx();eh();AS=new K,ox=new G,rh=class Ce extends nt{constructor(){super(...arguments),this.uid=j("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Je,this._transform=new G,this._fillStyle={...Ce.defaultFillStyle},this._strokeStyle={...Ce.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new rt,this._boundsDirty=!0}clone(){let t=new Ce;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=Ne(t,Ce.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=hi(t,Ce.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Ne(t,Ce.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Ne(t,Ce.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?X.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Je,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(D(W,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Ne(t,Ce.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(K.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=hi(t,Ce.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],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else{e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,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,r,s,o,n),this}arcTo(t,e,r,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*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let c=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,c.a*n+c.c*a+c.tx,c.b*n+c.d*a+c.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let c=this._transform;return this._activePath.bezierCurveTo(c.a*t+c.c*e+c.tx,c.b*t+c.d*e+c.ty,c.a*r+c.c*s+c.tx,c.b*r+c.d*s+c.ty,c.a*o+c.c*n+c.tx,c.b*o+c.d*n+c.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.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,r,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*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,Qg(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,r,s,o,n){return t instanceof G?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof G?(this._transform.append(t),this):(ox.set(t,e,r,s,o,n),this._transform.append(ox),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<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),c=o.path.bounds;t.addFrame(c.minX-a,c.minY-a,c.maxX+a,c.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let c=n.style,l=a.shapePath.shapePrimitives;for(let h=0;h<l.length;h++){let u=l[h].shape;if(!c||!u)continue;let d=l[h].transform,f=d?d.applyInverse(t,AS):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let _=c;r=u.strokeContains(f.x,f.y,_.width,_.alignment)}let m=n.hole;if(m){let _=m.shapePath?.shapePrimitives;if(_)for(let g=0;g<_.length;g++)_[g].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};rh.defaultFillStyle={color:16777215,alpha:1,texture:C.WHITE,matrix:null,fill:null,textureSpace:"local"};rh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:C.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Wt=rh});function Xn(i){let t=[],e=0;for(let r=0;r<nx.length;r++){let s=`_${nx[r]}`;t[e++]=i[s]}return e=ax(i._fill,t,e),e=ES(i._stroke,t,e),e=CS(i.dropShadow,t,e),t.join("-")}function ax(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function ES(i,t,e){return i&&(e=ax(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function CS(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=X.shared.setValue(i.color).toNumber()),e}var nx,ih=p(()=>{Mt();nx=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function MS(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Tt.defaultDropShadow;i.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){D(W,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(X.isColorLike(e))r.color=e;else if(e instanceof qt||e instanceof Le)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){D(W,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=Tt.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new qt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>X.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var sh,Tt,Cr=p(()=>{kt();Mt();dt();ii();Fn();Vn();eh();ih();sh=class ui extends nt{constructor(t={}){super(),MS(t);let e={...ui.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r]}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({...ui.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...ui.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({...Wt.defaultFillStyle,...t},()=>{this._fill=Ne({...this._originalFill},Wt.defaultFillStyle)})),this._fill=Ne(t===0?"black":t,Wt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Wt.defaultStrokeStyle,...t},()=>{this._stroke=hi({...this._originalStroke},Wt.defaultStrokeStyle)})),this._stroke=hi(t,Wt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Xn(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=ui.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new ui({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 r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(X.isColorLike(t)||t instanceof qt||t instanceof Le)}};sh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};sh.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};Tt=sh});function $n(i,t,e,r){let s=BS;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=ft.getOptimalTexture(s.width,s.height,r,!1);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var BS,oh=p(()=>{We();Xt();BS=new rt});function Mr(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!RS.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var RS,Yn=p(()=>{"use strict";RS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var nh,ge,At,Ss=p(()=>{ct();Yn();nh={willReadFrequently:!0},ge=class L{static get experimentalLetterSpacingSupported(){let t=L._experimentalLetterSpacingSupported;if(t!==void 0){let e=O.get().getCanvasRenderingContext2D().prototype;t=L._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,c,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=c,this.fontProperties=l}static measureText(t=" ",e,r=L._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(L._measurementCache[o])return L._measurementCache[o];let n=Mr(e),a=L.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let c=L.__context;c.font=n;let h=(s?L._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let y=0;y<h.length;y++){let v=L._measureText(h[y],e.letterSpacing,c);u[y]=v,d=Math.max(d,v)}let f=e._stroke?.width||0,m=d+f;e.dropShadow&&(m+=e.dropShadow.distance);let _=e.lineHeight||a.fontSize,g=Math.max(_,a.fontSize+f)+(h.length-1)*(_+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new L(t,e,m,g,h,u,_+e.leading,d,a)}static _measureText(t,e,r){let s=!1;L.experimentalLetterSpacingSupported&&(L.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else{let h=(L.graphemeSegmenter(t).length-1)*e;n+=h,l+=h}return Math.max(n,l)}static _wordWrap(t,e,r=L._canvas){let s=r.getContext("2d",nh),o=0,n="",a="",c=Object.create(null),{letterSpacing:l,whiteSpace:h}=e,u=L._collapseSpaces(h),d=L._collapseNewlines(h),f=!u,m=e.wordWrapWidth+l,_=L._tokenize(t);for(let g=0;g<_.length;g++){let b=_[g];if(L._isNewline(b)){if(!d){a+=L._addLine(n),f=!u,n="",o=0;continue}b=" "}if(u){let v=L.isBreakingSpace(b),T=L.isBreakingSpace(n[n.length-1]);if(v&&T)continue}let y=L._getFromCache(b,l,c,s);if(y>m)if(n!==""&&(a+=L._addLine(n),n="",o=0),L.canBreakWords(b,e.breakWords)){let v=L.wordWrapSplit(b);for(let T=0;T<v.length;T++){let R=v[T],S=R,P=1;for(;v[T+P];){let M=v[T+P];if(!L.canBreakChars(S,M,b,T,e.breakWords))R+=M;else break;S=M,P++}T+=P-1;let A=L._getFromCache(R,l,c,s);A+o>m&&(a+=L._addLine(n),f=!1,n="",o=0),n+=R,o+=A}}else{n.length>0&&(a+=L._addLine(n),n="",o=0);let v=g===_.length-1;a+=L._addLine(b,!v),f=!1,n="",o=0}else y+o>m&&(f=!1,a+=L._addLine(n),n="",o=0),(n.length>0||!L.isBreakingSpace(b)||f)&&(n+=b,o+=y)}return a+=L._addLine(n,!1),a}static _addLine(t,e=!0){return t=L._trimRight(t),t=e?`${t}
|
|
368
|
+
`:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=L._measureText(t,e,s)+e,r[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 r=t[e];if(!L.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:L._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:L._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(L.isBreakingSpace(o,n)||L._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return!0}static wordWrapSplit(t){return L.graphemeSegmenter(t)}static measureFont(t){if(L._fonts[t])return L._fonts[t];let e=L._context;e.font=t;let r=e.measureText(L.METRICS_STRING+L.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return L._fonts[t]=s,s}static clearMetrics(t=""){t?delete L._fonts[t]:L._fonts={}}static get _canvas(){if(!L.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",nh)?.measureText)return L.__canvas=e,e;t=O.get().createCanvas()}catch{t=O.get().createCanvas()}t.width=t.height=10,L.__canvas=t}return L.__canvas}static get _context(){return L.__context||(L.__context=L._canvas.getContext("2d",nh)),L.__context}};ge.METRICS_STRING="|\xC9q\xC5";ge.BASELINE_SYMBOL="M";ge.BASELINE_MULTIPLIER=1.4;ge.HEIGHT_MULTIPLIER=2;ge.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();ge.experimentalLetterSpacing=!1;ge._fonts={};ge._newlines=[10,13];ge._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];ge._measurementCache={};At=ge});function di(i,t,e,r=0){if(i.texture===C.WHITE&&!i.fill)return X.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Le){let s=i.fill,o=t.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(i.fill instanceof qt){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,c=1;n&&e&&(a=e.width+r,c=e.height+r);let l,h=!1;if(o){let{start:u,end:d}=s;l=t.createLinearGradient(u.x*a,u.y*c,d.x*a,d.y*c),h=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:m}=s;l=t.createRadialGradient(u.x*a,u.y*c,d*a,f.x*a,f.y*c,m*a)}if(h&&n&&e){let u=e.lineHeight/c;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+r/2)/c;s.colorStops.forEach(m=>{let _=f+m.offset*u;l.addColorStop(Math.floor(_*cx)/cx,X.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,X.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(G.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return F("FillStyle not recognised",i),"red"}var cx,ah=p(()=>{Mt();Z();et();it();ii();Fn();cx=1e5});var ws,lx=p(()=>{Mt();w();zi();ai();We();vg();dt();Cr();oh();Ss();Yn();ah();ws=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let s=At.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=Ge(o),n=Ge(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(D("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof Tt||(t.style=new Tt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Zt.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=At.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),c=Zt.getOptimalCanvasAndContext(n,a),{canvas:l}=c;this.renderTextToCanvas(e,r,s,c);let h=$n(l,n,a,s);if(r.trim){let u=bg(l,s);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:c}}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:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",ft.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(Zt.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=Mr(e),c=At.measureText(t||" ",e),l=c.lines,h=c.lineHeight,u=c.lineWidths,d=c.maxLineWidth,f=c.fontProperties,m=o.height;if(n.resetTransform(),n.scale(r,r),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,b=e.dropShadow?2:1;for(let y=0;y<b;++y){let v=e.dropShadow&&y===0,T=v?Math.ceil(Math.max(1,m)+e.padding*2):0,R=T*r;if(v){n.fillStyle="black",n.strokeStyle="black";let A=e.dropShadow,M=A.color,E=A.alpha;n.shadowColor=X.shared.setValue(M).setAlpha(E).toRgbaString();let B=A.blur*r,I=A.distance*r;n.shadowBlur=B,n.shadowOffsetX=Math.cos(A.angle)*I,n.shadowOffsetY=Math.sin(A.angle)*I+R}else{if(n.fillStyle=e._fill?di(e._fill,n,c):null,e._stroke?.width){let A=e._stroke.width*e._stroke.alignment;n.strokeStyle=di(e._stroke,n,c,A)}n.shadowColor="black"}let S=(h-f.fontSize)/2;h-f.fontSize<0&&(S=0);let P=e._stroke?.width??0;for(let A=0;A<l.length;A++)_=P/2,g=P/2+A*h+f.ascent+S,e.align==="right"?_+=d-u[A]:e.align==="center"&&(_+=(d-u[A])/2),e._stroke?.width&&this._drawLetterSpacing(l[A],e,s,_+e.padding,g+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[A],e,s,_+e.padding,g+e.padding-T)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,c=e.letterSpacing,l=!1;if(At.experimentalLetterSpacingSupported&&(At.experimentalLetterSpacing?(a.letterSpacing=`${c}px`,a.textLetterSpacing=`${c}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),c===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let h=s,u=At.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let m=0;m<u.length;++m){let _=u[m];n?a.strokeText(_,h,o):a.fillText(_,h,o);let g="";for(let b=m+1;b<u.length;++b)g+=u[b];f=a.measureText(g).width,h+=d-f+c,d=f}}destroy(){this._activeTextures=null}};ws.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"canvasText"}});var ch=p(()=>{w();xg();lx();k.add(ws);k.add(bs)});var zt,lh=p(()=>{dt();rn();Vn();zt=class i extends Xe{constructor(t){t instanceof Wt&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Wt,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!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 i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){D(W,"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),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){D(W,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){D(W,"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!==Wt.defaultStrokeStyle.width||t.color!==Wt.defaultStrokeStyle.color||t.alpha!==Wt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return D(W,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return D(W,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return D(W,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return D(W,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return D(W,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return D(W,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var hx,ux,dx=p(()=>{"use strict";hx={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
369
369
|
struct LocalUniforms {
|
|
370
370
|
uColor:vec4<f32>,
|
|
371
371
|
uTransformMatrix:mat3x3<f32>,
|
|
@@ -392,7 +392,7 @@ fn mainFragment(
|
|
|
392
392
|
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
393
393
|
`,main:`
|
|
394
394
|
outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
|
|
395
|
-
`}},
|
|
395
|
+
`}},ux={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
396
396
|
uniform mat3 uTransformMatrix;
|
|
397
397
|
uniform vec4 uColor;
|
|
398
398
|
uniform float uRound;
|
|
@@ -408,7 +408,7 @@ fn mainFragment(
|
|
|
408
408
|
uniform float uDistance;
|
|
409
409
|
`,main:`
|
|
410
410
|
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
|
|
411
|
-
`}}});var
|
|
411
|
+
`}}});var fx,px,mx=p(()=>{"use strict";fx={name:"msdf-bit",fragment:{header:`
|
|
412
412
|
fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
|
|
413
413
|
|
|
414
414
|
// MSDF
|
|
@@ -435,7 +435,7 @@ fn mainFragment(
|
|
|
435
435
|
return coverage;
|
|
436
436
|
|
|
437
437
|
}
|
|
438
|
-
`}},
|
|
438
|
+
`}},px={name:"msdf-bit",fragment:{header:`
|
|
439
439
|
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
|
|
440
440
|
|
|
441
441
|
// MSDF
|
|
@@ -462,16 +462,16 @@ fn mainFragment(
|
|
|
462
462
|
|
|
463
463
|
return coverage;
|
|
464
464
|
}
|
|
465
|
-
`}}});var
|
|
466
|
-
`&&b!=="\r"&&b!==" "&&b!==" "&&(f=!0,d=Math.ceil(Math.max(
|
|
467
|
-
`||
|
|
468
|
-
`)o.width!==0&&h();else if(!_){let P=b.xAdvance+(b.kerning[n]||0)+d;o.width+=P,o.spaceWidth=P,o.spacesIndex.push(o.charPositions.length),o.chars.push(g)}}else{let S=b.kerning[n]||0,P=b.xAdvance+S+d;c.positions[c.index++]=c.width+S,c.chars.push(g),c.width+=P}n=g}return h(),t.align==="center"?Vw(s):t.align==="right"?Xw(s):t.align==="justify"&&jw(s),s}function Vw(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function Xw(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function jw(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,l=(t-r.width)/a;for(let h=0;h<r.charPositions.length;h++)h===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[h]+=n}}var Jh=m(()=>{"use strict"});var ga,tu,Hs,eu=m(()=>{tr();ft();st();Fr();l_();Jh();Zh();ga=0,tu=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 r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=!1}if(!Q.has(r)){let n=new Qh({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});ga++,ga>50&&k("BitmapText",`You have dynamically created ${ga} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{ga--,Q.remove(r)}),Q.set(r,n)}let o=Q.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return ma([...t],e,s,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}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},U(H,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof St?s:new St(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Qh({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),c=pa(e.chars);return a.ensureCharacters(c.join("")),Q.set(`${r}-bitmap`,a),a.once("destroy",()=>Q.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=Q.get(e);r&&r.destroy()}},Hs=new tu});function h_(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels}var Ws,u_=m(()=>{tr();E();Nt();$h();n_();eu();Jh();Ws=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 r=this._getGpuBitmapText(t);h_(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.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&&(W.return(e.customShader),e.customShader=null),W.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);h_(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Hs.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=W.get(fa)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,c=ma(o,n,s,!0),l=0,h=n.padding,u=c.scale,d=c.width,f=c.height+c.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),r.translate(-t._anchor._x*d-h,-t._anchor._y*f-h).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let g=0;g<c.lines.length;g++){let _=c.lines[g];for(let b=0;b<_.charPositions.length;b++){let y=o[l++],v=s.chars[y];v?.texture&&r.texture(v.texture,p||"black",Math.round(_.charPositions[b]+v.xOffset),Math.round(a+v.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=W.get(jt);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=Q.get(`${r}-bitmap`),{a:o,b:n,c:a,d:c}=t.groupTransform,l=Math.sqrt(o*o+n*n),h=Math.sqrt(a*a+c*c),u=(Math.abs(l)+Math.abs(h))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};Ws.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"bitmapText"}});var ru=m(()=>{E();u_();G.add(Ws)});var zs,d_=m(()=>{E();et();Nt();ks();Ph();zs=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 r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),W.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,Fs(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;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(),Fs(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:M.EMPTY,currentKey:"--",batchableSprite:W.get(Ie),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=M.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.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}};zs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"htmlText"}});function f_(){let{userAgent:i}=D.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var p_=m(()=>{ct()});var m_,g_,Pi,iu=m(()=>{"use strict";m_="http://www.w3.org/2000/svg",g_="http://www.w3.org/1999/xhtml",Pi=class{constructor(){this.svgRoot=document.createElementNS(m_,"svg"),this.foreignObject=document.createElementNS(m_,"foreignObject"),this.domElement=document.createElementNS(g_,"div"),this.styleElement=document.createElementNS(g_,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s)}}});function y_(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${V.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[v_(t)]:[],...i.dropShadow?[b_(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return $w(i.tagStyles,s),s.join(" ")}function b_(i){let t=V.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function v_(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${V.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${V.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function $w(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)__[o]?s.push(__[o](r[o])):x_[o]&&s.push(x_[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var x_,__,T_=m(()=>{It();x_={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"},__={fill:i=>`color: ${V.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:v_,dropShadow:b_}});var xa,S_=m(()=>{st();Fr();Hh();T_();xa=class i extends St{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=ha(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new i({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=y_(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&k("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&k("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function w_(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(c){s[c]||(r.push(c),s[c]=!0)}if(Array.isArray(e))for(let c=0;c<e.length;c++)a(e[c]);else a(e);n&&n.forEach(c=>{let l=c.split(":")[1].trim();a(l)});for(let c in t.tagStyles){let l=t.tagStyles[c].fontFamily;a(l)}return r}var P_=m(()=>{"use strict"});async function E_(i){let e=await(await D.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e)})}var A_=m(()=>{ct()});async function su(i,t){let e=await E_(t);return`@font-face {
|
|
465
|
+
`}}});var hh,uh,jn,gx=p(()=>{Z();br();qe();cs();ls();Ze();vn();pe();Ht();dx();mx();jn=class extends gt{constructor(){let t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=se();hh??(hh=ve({name:"sdf-shader",bits:[qr,Qr(e),hx,fx,Se]})),uh??(uh=Te({name:"sdf-shader",bits:[Zr,Jr(e),ux,px,we]})),super({glProgram:uh,gpuProgram:hh,resources:{localUniforms:t,batchSamplers:ti(e)}})}}});var fi,dh=p(()=>{kt();dt();fi=class extends nt{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 D(W,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return D(W,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return D(W,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return D(W,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return D(W,"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 Kn(i){if(i==="")return[];typeof i=="string"&&(i=[i]);let t=[];for(let e=0,r=i.length;e<r;e++){let s=i[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,c=n;a<=c;a++)t.push(String.fromCharCode(a))}else t.push(...Array.from(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var fh=p(()=>{"use strict"});var xx,ph,yx=p(()=>{Mt();bt();ai();zr();et();dt();Ss();Yn();ah();Cr();dh();fh();xx=class _x extends fi{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={..._x.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let r=e.style.clone();e.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=C.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=Mr(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=At.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let e=Kn(t).filter(g=>!this._currentChars.includes(g)).filter((g,b,y)=>y.indexOf(g)===b);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:s,context:o}=r.canvasAndContext,n=r.texture.source,a=this._style,c=this._currentX,l=this._currentY,h=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*h,d=0,f=!1,m=s.width/this.resolution,_=s.height/this.resolution;for(let g=0;g<e.length;g++){let b=e[g],y=At.measureText(b,a,s,!1);y.lineHeight=y.height;let v=y.width*h,T=Math.ceil((a.fontStyle==="italic"?2:1)*v),R=y.height*h,S=T+u*2,P=R+u*2;if(f=!1,b!==`
|
|
466
|
+
`&&b!=="\r"&&b!==" "&&b!==" "&&(f=!0,d=Math.ceil(Math.max(P,d))),c+S>m&&(l+=d,d=P,c=0,l+d>_)){n.update();let M=this._nextPage();s=M.canvasAndContext.canvas,o=M.canvasAndContext.context,n=M.texture.source,l=0}let A=v/h-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[b]={id:b.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:A,kerning:{}},f){this._drawGlyph(o,y,c+u,l+u,h,a);let M=n.width*h,E=n.height*h,B=new V(c/M*n.width,l/E*n.height,S/M*n.width,P/E*n.height);this.chars[b].texture=new C({source:n,frame:B}),c+=Math.ceil(S)}}n.update(),this._currentX=c,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return D(W,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],c=r[o];c||(c=r[o]=e.measureText(o).width);let l=r[a];l||(l=r[a]=e.measureText(a).width);let h=e.measureText(o+a).width,u=h-(c+l);u&&(this.chars[o].kerning[a]=u),h=e.measureText(o+a).width,u=h-(c+l),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=Zt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new C({source:new jt({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=Mr(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;let s=e._stroke,o=s?.width??0;if(s&&(t.lineWidth=o,t.lineJoin=s.join,t.miterLimit=s.miterLimit,t.strokeStyle=di(s,t)),e._fill&&(t.fillStyle=di(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=X.shared.setValue(n.color).toArray(),c=n.blur*r,l=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=c,t.shadowOffsetX=Math.cos(n.angle)*l,t.shadowOffsetY=Math.sin(n.angle)*l}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,r,s,o,n){let a=e.text,c=e.fontProperties,h=(n._stroke?.width??0)*o,u=r+h/2,d=s-h/2,f=c.descent*o,m=e.lineHeight*o;n.stroke&&h&&t.strokeText(a,u,d+m-f),n._fill&&t.fillText(a,u,d+m-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];Zt.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};xx.defaultOptions={textureSize:512,style:new Tt,mipmap:!0};ph=xx});function qn(i,t,e,r){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=!0,c={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=m=>{let _=o.width;for(let g=0;g<c.index;g++){let b=m.positions[g];o.chars.push(m.chars[g]),o.charPositions.push(b+_)}o.width+=m.width,a=!1,c.width=0,c.index=0,c.chars.length=0},h=()=>{let m=o.chars.length-1;if(r){let _=o.chars[m];for(;_===" ";)o.width-=e.chars[_].xAdvance,_=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;m<i.length+1;m++){let _,g=m===i.length;g||(_=i[m]);let b=e.chars[_]||e.chars[" "];if(/(?:\s)/.test(_)||_==="\r"||_===`
|
|
467
|
+
`||g){if(!a&&t.wordWrap&&o.width+c.width-d>f?(h(),l(c),g||o.charPositions.push(0)):(c.start=o.width,l(c),g||o.charPositions.push(0)),_==="\r"||_===`
|
|
468
|
+
`)o.width!==0&&h();else if(!g){let R=b.xAdvance+(b.kerning[n]||0)+d;o.width+=R,o.spaceWidth=R,o.spacesIndex.push(o.charPositions.length),o.chars.push(_)}}else{let T=b.kerning[n]||0,R=b.xAdvance+T+d;c.positions[c.index++]=c.width+T,c.chars.push(_),c.width+=R}n=_}return h(),t.align==="center"?GS(s):t.align==="right"?kS(s):t.align==="justify"&&IS(s),s}function GS(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function kS(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function IS(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,l=(t-r.width)/a;for(let h=0;h<r.charPositions.length;h++)h===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[h]+=n}}var mh=p(()=>{"use strict"});var Zn,gh,Ps,xh=p(()=>{$e();dt();it();Cr();yx();mh();fh();Zn=0,gh=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 r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=!1}if(!J.has(r)){let n=new ph({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});Zn++,Zn>50&&F("BitmapText",`You have dynamically created ${Zn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Zn--,J.remove(r)}),J.set(r,n)}let o=J.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return qn([...t],e,s,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}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},D(W,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Tt?s:new Tt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new ph({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),c=Kn(e.chars);return a.ensureCharacters(c.join("")),J.set(`${r}-bitmap`,a),a.once("destroy",()=>J.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=J.get(e);r&&r.destroy()}},Ps=new gh});function bx(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels}var As,vx=p(()=>{$e();w();Dt();lh();gx();xh();mh();As=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 r=this._getGpuBitmapText(t);bx(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.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&&(z.return(e.customShader),e.customShader=null),z.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);bx(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Ps.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=z.get(jn)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,c=qn(o,n,s,!0),l=0,h=n.padding,u=c.scale,d=c.width,f=c.height+c.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),r.translate(-t._anchor._x*d-h,-t._anchor._y*f-h).scale(u,u);let m=s.applyFillAsTint?n._fill.color:16777215;for(let _=0;_<c.lines.length;_++){let g=c.lines[_];for(let b=0;b<g.charPositions.length;b++){let y=o[l++],v=s.chars[y];v?.texture&&r.texture(v.texture,m||"black",Math.round(g.charPositions[b]+v.xOffset),Math.round(a+v.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=z.get(zt);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=J.get(`${r}-bitmap`),{a:o,b:n,c:a,d:c}=t.groupTransform,l=Math.sqrt(o*o+n*n),h=Math.sqrt(a*a+c*c),u=(Math.abs(l)+Math.abs(h))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};As.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"bitmapText"}});var _h=p(()=>{w();vx();k.add(As)});var Es,Tx=p(()=>{w();et();Dt();_s();Hl();Es=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 r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),z.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,ys(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;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(),ys(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:C.EMPTY,currentKey:"--",batchableSprite:z.get(Ee),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=C.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.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}};Es.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"htmlText"}});function Sx(){let{userAgent:i}=O.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var wx=p(()=>{ct()});var Px,Ax,pi,yh=p(()=>{"use strict";Px="http://www.w3.org/2000/svg",Ax="http://www.w3.org/1999/xhtml",pi=class{constructor(){this.svgRoot=document.createElementNS(Px,"svg"),this.foreignObject=document.createElementNS(Px,"foreignObject"),this.domElement=document.createElementNS(Ax,"div"),this.styleElement=document.createElementNS(Ax,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s)}}});function Mx(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${X.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[Rx(t)]:[],...i.dropShadow?[Bx(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return FS(i.tagStyles,s),s.join(" ")}function Bx(i){let t=X.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function Rx(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${X.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${X.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function FS(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)Cx[o]?s.push(Cx[o](r[o])):Ex[o]&&s.push(Ex[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var Ex,Cx,Gx=p(()=>{Mt();Ex={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"},Cx={fill:i=>`color: ${X.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:Rx,dropShadow:Bx}});var Qn,kx=p(()=>{it();Cr();ih();Gx();Qn=class i extends Tt{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=Xn(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new i({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=Mx(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&F("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function Ix(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(c){s[c]||(r.push(c),s[c]=!0)}if(Array.isArray(e))for(let c=0;c<e.length;c++)a(e[c]);else a(e);n&&n.forEach(c=>{let l=c.split(":")[1].trim();a(l)});for(let c in t.tagStyles){let l=t.tagStyles[c].fontFamily;a(l)}return r}var Fx=p(()=>{"use strict"});async function Ux(i){let e=await(await O.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e)})}var Dx=p(()=>{ct()});async function bh(i,t){let e=await Ux(t);return`@font-face {
|
|
469
469
|
font-family: "${i.fontFamily}";
|
|
470
470
|
src: url('${e}');
|
|
471
471
|
font-weight: ${i.fontWeight};
|
|
472
472
|
font-style: ${i.fontStyle};
|
|
473
|
-
}`}var
|
|
474
|
-
`)}var
|
|
473
|
+
}`}var Ox=p(()=>{Dx()});async function Lx(i,t,e){let r=i.filter(s=>J.has(`${s}-and-url`)).map((s,o)=>{if(!Jn.has(s)){let{url:n}=J.get(`${s}-and-url`);o===0?Jn.set(s,bh({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):Jn.set(s,bh({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return Jn.get(s)});return(await Promise.all(r)).join(`
|
|
474
|
+
`)}var Jn,Nx=p(()=>{$e();Ox();Jn=new Map});function Hx(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:c,height:l}=s.image;return a.setAttribute("width",c.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var Wx=p(()=>{"use strict"});function zx(i,t){let e=Zt.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var Vx=p(()=>{ai()});function Xx(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r()},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous"})}var $x=p(()=>{"use strict"});function jx(i,t,e,r){r||(r=Yx||(Yx=new pi));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,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 c=t.padding*2;return{width:a.width-c,height:a.height-c}}var Yx,Kx=p(()=>{yh()});var mi,qx=p(()=>{w();ai();We();Pe();wx();it();Dt();oh();yh();kx();Fx();Nx();Wx();Vx();$x();Kx();mi=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===yt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=z.get(pi),o=Ix(t,r),n=await Lx(o,r,Qn.defaultTextStyle),a=jx(t,r,n,s),c=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*e),h=s.image,u=2;h.width=(c|0)+u,h.height=(l|0)+u;let d=Hx(t,r,e,n,s);await Xx(h,d,Sx()&&o.length>0);let f=h,m;this._createCanvas&&(m=zx(h,e));let _=$n(m?m.canvas:f,h.width-u,h.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(_.source),Zt.returnCanvasAndContext(m)),z.return(s),_}_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(r=>{e.texture=r,this._cleanUp(e)}).catch(()=>{F("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){ft.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};mi.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"htmlText"};mi.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var vh=p(()=>{w();Tx();qx();k.add(mi);k.add(Es)});var Zx,gi,ta=p(()=>{je();De();Yr();dt();Zx=class Qx extends oe{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(D(W,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...Qx.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.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 mt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:Y.VERTEX|Y.COPY_DST}),c=new mt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:Y.VERTEX|Y.COPY_DST}),l=new mt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:Y.INDEX|Y.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:c,format:"float32x2",stride:2*4,offset:0}},indexBuffer:l,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}};Zx.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};gi=Zx});var Br,Jx,xi,_i=p(()=>{"use strict";Br={name:"local-uniform-bit",vertex:{header:`
|
|
475
475
|
|
|
476
476
|
struct LocalUniforms {
|
|
477
477
|
uTransformMatrix:mat3x3<f32>,
|
|
@@ -488,7 +488,7 @@ fn mainFragment(
|
|
|
488
488
|
{
|
|
489
489
|
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
490
490
|
}
|
|
491
|
-
`}},
|
|
491
|
+
`}},Jx={...Br,vertex:{...Br.vertex,header:Br.vertex.header.replace("group(1)","group(2)")}},xi={name:"local-uniform-bit",vertex:{header:`
|
|
492
492
|
|
|
493
493
|
uniform mat3 uTransformMatrix;
|
|
494
494
|
uniform vec4 uColor;
|
|
@@ -501,7 +501,7 @@ fn mainFragment(
|
|
|
501
501
|
{
|
|
502
502
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
503
503
|
}
|
|
504
|
-
`}}});var
|
|
504
|
+
`}}});var t_,e_,r_=p(()=>{"use strict";t_={name:"tiling-bit",vertex:{header:`
|
|
505
505
|
struct TilingUniforms {
|
|
506
506
|
uMapCoord:mat3x3<f32>,
|
|
507
507
|
uClampFrame:vec4<f32>,
|
|
@@ -544,7 +544,7 @@ fn mainFragment(
|
|
|
544
544
|
}
|
|
545
545
|
|
|
546
546
|
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
|
547
|
-
`}},
|
|
547
|
+
`}},e_={name:"tiling-bit",vertex:{header:`
|
|
548
548
|
uniform mat3 uTextureTransform;
|
|
549
549
|
uniform vec4 uSizeAnchor;
|
|
550
550
|
|
|
@@ -566,7 +566,7 @@ fn mainFragment(
|
|
|
566
566
|
|
|
567
567
|
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
568
568
|
|
|
569
|
-
`}}});var nu,au,ba,$_=m(()=>{K();sr();Mi();or();_e();Vt();et();j_();ba=class extends xt{constructor(){nu??(nu=Ee({name:"tiling-sprite-shader",bits:[Dr,V_,Ce]})),au??(au=Ae({name:"tiling-sprite-shader",bits:[Ci,X_,Me]}));let t=new ot({uMapCoord:{value:new B,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new B,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:au,gpuProgram:nu,resources:{localUniforms:new ot({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:M.EMPTY.source,uSampler:M.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,c=n.width,l=n.height,h=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*c/t,r.b*c/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.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 va,Y_=m(()=>{ya();va=class extends Ai{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 K_(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height}var q_=m(()=>{"use strict"});function Z_(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,c=r.c,l=r.d,h=r.tx,u=r.ty;for(e*=t;s<o;){let d=i[e],f=i[e+1];i[e]=n*d+c*f+h,i[e+1]=a*d+l*f+u,e+=t,s++}}var Q_=m(()=>{"use strict"});function J_(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=B.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),Z_(t,2,0,a)}var ty=m(()=>{K();Q_()});var Ta,Vs,ey=m(()=>{E();vs();ye();Be();gi();Kn();ya();$_();Y_();q_();ty();Ta=new va,Vs=class{constructor(t){this._state=_t.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new nr);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),s.shader||(s.shader=new ba),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Re(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Ve(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Ta,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Ai({indices:Ta.indices,positions:Ta.positions.slice(),uvs:Ta.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:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),J_(t,r.uvs),K_(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===bt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Vs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"tilingSprite"}});var cu=m(()=>{E();ey();G.add(Vs)});var ry,sy,oy=m(()=>{ft();ya();ry=class iy extends Ai{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(U(H,"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={...iy.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,c=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;r.push(d*c,f*l),s.push(d/n,f/a)}let h=n*a;for(let u=0;u<h;u++){let d=u%n,f=u/n|0,p=f*this.verticesX+d,g=f*this.verticesX+d+1,_=(f+1)*this.verticesX+d,b=(f+1)*this.verticesX+d+1;o.push(p,g,_,g,b,_)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};ry.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};sy=ry});var ny,cy,ly=m(()=>{oy();ny=class ay extends sy{constructor(t={}){t={...ay.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:c,_anchorY:l}=this,h=s+o,u=e>h?1:e/h,d=n+a,f=r>d?1:r/d,p=Math.min(u,f),g=c*e,_=l*r;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*p-g,t[4]=t[12]=t[20]=t[28]=e-o*p-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-_,t[9]=t[11]=t[13]=t[15]=n*p-_,t[17]=t[19]=t[21]=t[23]=r-a*p-_,t[25]=t[27]=t[29]=t[31]=r-_,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};ny.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};cy=ny});var Xs,hy=m(()=>{E();Nt();Kn();ly();Xs=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.return(e.geometry),W.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=W.get(nr);return e.geometry=W.get(cy),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}};Xs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"nineSliceSprite"}});var lu=m(()=>{E();hy();G.add(Xs)});var js,uy=m(()=>{E();js=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.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}};js.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"filter"}});function dy(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var fy=m(()=>{"use strict"});var Yw,$s,py=m(()=>{E();K();ae();er();si();Vt();et();qe();Be();Yt();fy();st();Yw=new le({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])}),$s=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new ot({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new At({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?dy(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 p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,c=0,l=!0,h=!1,u=!1,d=!0;for(let f=0;f<r.length;f++){let p=r[f];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),c+=p.padding,p.antialias==="off"?l=!1:p.antialias==="inherit"&&l&&(l=n.antialias),p.clipToViewport||(d=!1),!!!(p.compatibleRenderers&e.type)){u=!1;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){k("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=p.enabled||u,h||(h=p.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/p,0,f.height/p)}if(o.scale(a).ceil().scale(1/a).pad(c|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=h,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=pt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=M.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,c=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(c,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,!1),pt.returnTexture(r);else{let a=e.inputTexture,c=pt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,c,!0);let u=a;a=c,c=u}n[l].apply(this,a,e.previousRenderSurface,!1),pt.returnTexture(a),pt.returnTexture(c)}e.blendRequired&&pt.returnTexture(o)}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=pt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let c=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:c,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,c=$.shared,h=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,g=p.uOutputFrame,_=p.uInputSize,b=p.uInputPixel,y=p.uInputClamp,v=p.uGlobalFrame,S=p.uOutputTexture;if(h){let w=this._filterStackIndex;for(;w>0;){w--;let A=this._filterStack[this._filterStackIndex-1];if(!A.skip){c.x=A.bounds.minX,c.y=A.bounds.minY;break}}g[0]=a.minX-c.x,g[1]=a.minY-c.y}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,_[0]=e.source.width,_[1]=e.source.height,_[2]=1/_[0],_[3]=1/_[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*_[2]-.5*b[2],y[3]=e.frame.height*_[3]-.5*b[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=c.x*u,v[1]=c.y*u,v[2]=P.source.width*u,v[3]=P.source.height*u;let T=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof M?(S[0]=r.frame.width,S[1]=r.frame.height):(S[0]=T.width,S[1]=T.height),S[2]=T.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(w,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:Yw,shader:t,state:t._state,topology:"triangle-list"}),o.type===bt.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new it,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(B.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}};$s.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"filter"}});var hu=m(()=>{E();uy();py();G.add($s);G.add(js)});var Kw={};var my=m(()=>{gp();dl();wp();Ep();wn();Rn();yh();bh();wh();jh();ru();ou();cu();lu();hu()});var qw={};var xy=m(()=>{dl();wn();Rn();yh();bh();wh();jh();ru();ou();cu();lu();hu()});var yy,by,vy=m(()=>{Mr();ni();_e();ye();yy=class uu extends xt{constructor(t){t={...uu.defaultOptions,...t},super(t),this.enabled=!0,this._state=_t.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,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=ue.from(e)),r&&(n=he.from(r)),new uu({gpuProgram:o,glProgram:n,...s})}};yy.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};by=yy});async function Ty(i){if(!i)for(let t=0;t<du.length;t++){let e=du[t];if(e.value.test()){await e.value.load();return}}}var du,Sy=m(()=>{E();du=[];G.handleByNamedList(x.Environment,du)});function Sa(){if(typeof Ys=="boolean")return Ys;try{Ys=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Ys=!1}return Ys}var Ys,fu=m(()=>{"use strict"});var Mt,Bi=m(()=>{"use strict";Mt=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(Mt||{})});var Ri,pu=m(()=>{"use strict";Ri=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,c){let{name:l,items:h}=this;for(let u=0,d=h.length;u<d;u++)h[u][l](t,e,r,s,o,n,a,c);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var Zw,wy,cr,Ks=m(()=>{It();Sy();ge();fu();ft();Bi();pu();Dt();Zw=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],wy=class Py extends nt{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=[...Zw,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Ty(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...Py.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof at&&(r={container:r},e&&(U(H,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:V.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=Mt.ALL);let{clear:r,clearColor:s,target:o}=t;V.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,V.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new Ri(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[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(!Sa())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()}};wy.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};cr=wy});var qs,Cy=m(()=>{E();K();Ar();kn();sr();ws();Ps();Mi();or();_e();Vt();qs=class{init(){let t=new ot({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Ee({name:"graphics",bits:[ai,li(ce()),z_,Ce]});this.shader=new xt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:c}=n.getContextRenderData(r),l=o.encoder;l.setGeometry(a.geometry,s.gpuProgram);let h=o.globalUniforms.bindGroup;l.setBindGroup(0,h,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,u,s.gpuProgram);let d=c.instructions,f=null;for(let p=0;p<c.instructionSize;p++){let g=d[p];if(g.topology!==f&&(f=g.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,g.topology)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){let _=g.textures;g.bindGroup=ii(_.textures,_.count),g.gpuBindGroup=o.bindGroup.getBindGroup(g.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,g.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};qs.extension={type:[x.WebGPUPipesAdaptor],name:"graphics"}});var My,By,mu=m(()=>{"use strict";My={name:"texture-bit",vertex:{header:`
|
|
569
|
+
`}}});var Th,Sh,ea,i_=p(()=>{Z();qe();_i();Ze();pe();Ht();et();r_();ea=class extends gt{constructor(){Th??(Th=ve({name:"tiling-sprite-shader",bits:[Br,t_,Se]})),Sh??(Sh=Te({name:"tiling-sprite-shader",bits:[xi,e_,we]}));let t=new st({uMapCoord:{value:new G,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new G,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Sh,gpuProgram:Th,resources:{localUniforms:new st({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:C.EMPTY.source,uSampler:C.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,c=n.width,l=n.height,h=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*c/t,r.b*c/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.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 ra,s_=p(()=>{ta();ra=class extends gi{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 o_(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height}var n_=p(()=>{"use strict"});function a_(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,c=r.c,l=r.d,h=r.tx,u=r.ty;for(e*=t;s<o;){let d=i[e],f=i[e+1];i[e]=n*d+c*f+h,i[e+1]=a*d+l*f+u,e+=t,s++}}var c_=p(()=>{"use strict"});function l_(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=G.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),a_(t,2,0,a)}var h_=p(()=>{Z();c_()});var ia,Cs,u_=p(()=>{w();os();me();Pe();oi();Bn();ta();i_();s_();n_();h_();ia=new ra,Cs=class{constructor(t){this._state=xt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new Qe);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),s.shader||(s.shader=new ea),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Ae(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Ue(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:ia,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new gi({indices:ia.indices,positions:ia.positions.slice(),uvs:ia.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:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),l_(t,r.uvs),o_(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===yt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Cs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"tilingSprite"}});var wh=p(()=>{w();u_();k.add(Cs)});var d_,p_,m_=p(()=>{dt();ta();d_=class f_ extends gi{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(D(W,"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={...f_.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,c=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;r.push(d*c,f*l),s.push(d/n,f/a)}let h=n*a;for(let u=0;u<h;u++){let d=u%n,f=u/n|0,m=f*this.verticesX+d,_=f*this.verticesX+d+1,g=(f+1)*this.verticesX+d,b=(f+1)*this.verticesX+d+1;o.push(m,_,g,_,b,g)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};d_.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};p_=d_});var g_,__,y_=p(()=>{m_();g_=class x_ extends p_{constructor(t={}){t={...x_.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:c,_anchorY:l}=this,h=s+o,u=e>h?1:e/h,d=n+a,f=r>d?1:r/d,m=Math.min(u,f),_=c*e,g=l*r;t[0]=t[8]=t[16]=t[24]=-_,t[2]=t[10]=t[18]=t[26]=s*m-_,t[4]=t[12]=t[20]=t[28]=e-o*m-_,t[6]=t[14]=t[22]=t[30]=e-_,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*m-g,t[17]=t[19]=t[21]=t[23]=r-a*m-g,t[25]=t[27]=t[29]=t[31]=r-g,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};g_.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};__=g_});var Ms,b_=p(()=>{w();Dt();Bn();y_();Ms=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];z.return(e.geometry),z.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=z.get(Qe);return e.geometry=z.get(__),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}};Ms.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"nineSliceSprite"}});var Ph=p(()=>{w();b_();k.add(Ms)});var Bs,v_=p(()=>{w();Bs=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.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}};Bs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"filter"}});function T_(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var S_=p(()=>{"use strict"});var US,Rs,w_=p(()=>{w();Z();ie();Ye();Yr();Ht();et();We();Pe();Xt();S_();it();US=new oe({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])}),Rs=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new st({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Pt({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?T_(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,c=0,l=!0,h=!1,u=!1,d=!0;for(let f=0;f<r.length;f++){let m=r[f];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),c+=m.padding,m.antialias==="off"?l=!1:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(d=!1),!!!(m.compatibleRenderers&e.type)){u=!1;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){F("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=m.enabled||u,h||(h=m.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/m,0,f.height/m)}if(o.scale(a).ceil().scale(1/a).pad(c|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=h,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=ft.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=C.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,c=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(c,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,!1),ft.returnTexture(r);else{let a=e.inputTexture,c=ft.getOptimalTexture(s.width,s.height,a.source._resolution,!1),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,c,!0);let u=a;a=c,c=u}n[l].apply(this,a,e.previousRenderSurface,!1),ft.returnTexture(a),ft.returnTexture(c)}e.blendRequired&&ft.returnTexture(o)}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=ft.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let c=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:c,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,c=K.shared,h=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,m=f.uniforms,_=m.uOutputFrame,g=m.uInputSize,b=m.uInputPixel,y=m.uInputClamp,v=m.uGlobalFrame,T=m.uOutputTexture;if(h){let P=this._filterStackIndex;for(;P>0;){P--;let A=this._filterStack[this._filterStackIndex-1];if(!A.skip){c.x=A.bounds.minX,c.y=A.bounds.minY;break}}_[0]=a.minX-c.x,_[1]=a.minY-c.y}else _[0]=0,_[1]=0;_[2]=e.frame.width,_[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[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*g[2]-.5*b[2],y[3]=e.frame.height*g[3]-.5*b[3];let R=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=c.x*u,v[1]=c.y*u,v[2]=R.source.width*u,v[3]=R.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof C?(T[0]=r.frame.width,T[1]=r.frame.height):(T[0]=S.width,T[1]=S.height),T[2]=S.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let P=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(P,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:US,shader:t,state:t._state,topology:"triangle-list"}),o.type===yt.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new rt,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(G.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}};Rs.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"filter"}});var Ah=p(()=>{w();v_();w_();k.add(Rs);k.add(Bs)});var DS={};var P_=p(()=>{Af();Cc();If();Uf();on();dn();Fl();Ul();Nl();ch();_h();vh();wh();Ph();Ah()});var OS={};var E_=p(()=>{Cc();on();dn();Fl();Ul();Nl();ch();_h();vh();wh();Ph();Ah()});var M_,B_,R_=p(()=>{Tr();Kr();pe();me();M_=class Eh extends gt{constructor(t){t={...Eh.defaultOptions,...t},super(t),this.enabled=!0,this._state=xt.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,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=ae.from(e)),r&&(n=ne.from(r)),new Eh({gpuProgram:o,glProgram:n,...s})}};M_.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};B_=M_});async function G_(i){if(!i)for(let t=0;t<Ch.length;t++){let e=Ch[t];if(e.value.test()){await e.value.load();return}}}var Ch,k_=p(()=>{w();Ch=[];k.handleByNamedList(x.Environment,Ch)});function sa(){if(typeof Gs=="boolean")return Gs;try{Gs=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Gs=!1}return Gs}var Gs,Mh=p(()=>{"use strict"});var Et,yi=p(()=>{"use strict";Et=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(Et||{})});var bi,Bh=p(()=>{"use strict";bi=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,c){let{name:l,items:h}=this;for(let u=0,d=h.length;u<d;u++)h[u][l](t,e,r,s,o,n,a,c);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var LS,I_,tr,ks=p(()=>{Mt();k_();de();Mh();dt();yi();Bh();kt();LS=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],I_=class F_ extends nt{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=[...LS,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await G_(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...F_.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof at&&(r={container:r},e&&(D(W,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:X.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=Et.ALL);let{clear:r,clearColor:s,target:o}=t;X.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,X.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new bi(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[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(!sa())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()}};I_.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};tr=I_});var Is,O_=p(()=>{w();Z();br();mn();qe();cs();ls();_i();Ze();pe();Ht();Is=class{init(){let t=new st({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=ve({name:"graphics",bits:[qr,Qr(se()),Jx,Se]});this.shader=new gt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:c}=n.getContextRenderData(r),l=o.encoder;l.setGeometry(a.geometry,s.gpuProgram);let h=o.globalUniforms.bindGroup;l.setBindGroup(0,h,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,u,s.gpuProgram);let d=c.instructions,f=null;for(let m=0;m<c.instructionSize;m++){let _=d[m];if(_.topology!==f&&(f=_.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,_.topology)),s.groups[1]=_.bindGroup,!_.gpuBindGroup){let g=_.textures;_.bindGroup=$r(g.textures,g.count),_.gpuBindGroup=o.bindGroup.getBindGroup(_.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,_.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(_.size,1,_.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};Is.extension={type:[x.WebGPUPipesAdaptor],name:"graphics"}});var L_,N_,Rh=p(()=>{"use strict";L_={name:"texture-bit",vertex:{header:`
|
|
570
570
|
|
|
571
571
|
struct TextureUniforms {
|
|
572
572
|
uTextureMatrix:mat3x3<f32>,
|
|
@@ -582,7 +582,7 @@ fn mainFragment(
|
|
|
582
582
|
|
|
583
583
|
`,main:`
|
|
584
584
|
outColor = textureSample(uTexture, uSampler, vUV);
|
|
585
|
-
`}},
|
|
585
|
+
`}},N_={name:"texture-bit",vertex:{header:`
|
|
586
586
|
uniform mat3 uTextureMatrix;
|
|
587
587
|
`,main:`
|
|
588
588
|
uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
@@ -592,7 +592,7 @@ fn mainFragment(
|
|
|
592
592
|
|
|
593
593
|
`,main:`
|
|
594
594
|
outColor = texture(uTexture, vUV);
|
|
595
|
-
`}}});var Zs,Ry=m(()=>{E();K();sr();Mi();or();mu();_e();et();st();Zs=class{init(){let t=Ee({name:"mesh",bits:[Dr,My,Ce]});this._shader=new xt({gpuProgram:t,resources:{uTexture:M.EMPTY._source,uSampler:M.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){k("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Zs.extension={type:[x.WebGPUPipesAdaptor],name:"mesh"}});var Ea,Qs,Iy=m(()=>{E();ye();kn();Ea=_t.for2d(),Qs=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),Ea.blendMode="normal",s.pipeline.getPipeline(e,n,Ea);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let c=e.textures;e.bindGroup=ii(c.textures,c.count)}Ea.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,Ea,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Qs.extension={type:[x.WebGPUPipesAdaptor],name:"batch"}});var Js,Gy=m(()=>{E();Js=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}};Js.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"}});function to(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var gu=m(()=>{"use strict"});var Qw,eo,ky=m(()=>{E();K();Nt();ks();gu();Qw=new B,eo=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&&(W.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=W.get(Ie));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=Qw.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}),to(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}),to(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};eo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"renderGroup"}});function ro(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var xu=m(()=>{"use strict"});function _u(i,t=!1){tP(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,c=n.index;for(let l=0;l<c;l++){let h=a[l];h.parentRenderGroup===i&&h.relativeRenderGroupDepth===o&&Dy(h,r,0)}ro(a,c),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)_u(i.renderGroupChildren[s],t)}function tP(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=Xr(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function Dy(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&Fy&&Uy(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&Fy&&Uy(i,Jw,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)Dy(o[l],t,e);let a=i.parentRenderGroup,c=i;c.renderPipeId&&!a.structureDidChange&&a.updateRenderable(c)}}function Uy(i,t,e){if(e&Kr){i.groupColor=Xr(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&ns&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&wr&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var Jw,Fy,Oy=m(()=>{ge();xu();$c();Jw=new at,Fy=wr|Kr|ns});function Ly(i,t){let{list:e,index:r}=i.childrenRenderablesToUpdate,s=!1;for(let o=0;o<r;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return i.structureDidChange=s,s}var Ny=m(()=>{"use strict"});var eP,io,Hy=m(()=>{E();K();qe();Yt();xu();gu();Oy();Ny();eP=new B,io=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=eP;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}),to(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,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 r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&pt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=pt.getOptimalTexture(r.width,r.height,n,a),t._textureBounds||(t._textureBounds=new it),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(pt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?ro(t.childrenRenderablesToUpdate.list,0):Ly(t,r),_u(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<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}ro(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};io.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"renderGroup"}});var so,Wy=m(()=>{E();Nt();ks();so=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.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=W.get(Ie);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)W.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};so.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"sprite"}});var Ii,yu=m(()=>{Dt();Ii="8.9.2"});var oo,no,bu=m(()=>{E();yu();oo=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Ii)}static destroy(){}};oo.extension=x.Application;no=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Ii)}destroy(){this._renderer=null}};no.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"initHook",priority:-10}});var vu,Tu,Vy=m(()=>{E();ye();Zl();vu=class zy{constructor(t,e){this.state=_t.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 Es)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=zy.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],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 r in e){let s=e[r],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,r=e.geometry,s=e.shader;this._adaptor.start(this,r,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}};vu.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"batch"};vu._availableBatchers=Object.create(null);Tu=vu;G.handleByMap(x.Batcher,Tu._availableBatchers);G.add(Es)});var Xy,jy=m(()=>{Xy=`in vec2 vMaskCoord;
|
|
595
|
+
`}}});var Fs,H_=p(()=>{w();Z();qe();_i();Ze();Rh();pe();et();it();Fs=class{init(){let t=ve({name:"mesh",bits:[Br,L_,Se]});this._shader=new gt({gpuProgram:t,resources:{uTexture:C.EMPTY._source,uSampler:C.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){F("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Fs.extension={type:[x.WebGPUPipesAdaptor],name:"mesh"}});var aa,Us,W_=p(()=>{w();me();mn();aa=xt.for2d(),Us=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),aa.blendMode="normal",s.pipeline.getPipeline(e,n,aa);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let c=e.textures;e.bindGroup=$r(c.textures,c.count)}aa.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,aa,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Us.extension={type:[x.WebGPUPipesAdaptor],name:"batch"}});var Ds,z_=p(()=>{w();Ds=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}};Ds.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"}});function Os(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var Gh=p(()=>{"use strict"});var NS,Ls,V_=p(()=>{w();Z();Dt();_s();Gh();NS=new G,Ls=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&&(z.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=z.get(Ee));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=NS.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}),Os(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}),Os(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};Ls.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"renderGroup"}});function Ns(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var kh=p(()=>{"use strict"});function Ih(i,t=!1){WS(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,c=n.index;for(let l=0;l<c;l++){let h=a[l];h.parentRenderGroup===i&&h.relativeRenderGroupDepth===o&&Y_(h,r,0)}Ns(a,c),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)Ih(i.renderGroupChildren[s],t)}function WS(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=Ir(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function Y_(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&X_&&$_(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&X_&&$_(i,HS,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)Y_(o[l],t,e);let a=i.parentRenderGroup,c=i;c.renderPipeId&&!a.structureDidChange&&a.updateRenderable(c)}}function $_(i,t,e){if(e&Or){i.groupColor=Ir(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&Vi&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&xr&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var HS,X_,j_=p(()=>{de();kh();lc();HS=new at,X_=xr|Or|Vi});function K_(i,t){let{list:e,index:r}=i.childrenRenderablesToUpdate,s=!1;for(let o=0;o<r;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return i.structureDidChange=s,s}var q_=p(()=>{"use strict"});var zS,Hs,Z_=p(()=>{w();Z();We();Xt();kh();Gh();j_();q_();zS=new G,Hs=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=zS;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}),Os(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,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 r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&ft.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=ft.getOptimalTexture(r.width,r.height,n,a),t._textureBounds||(t._textureBounds=new rt),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(ft.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?Ns(t.childrenRenderablesToUpdate.list,0):K_(t,r),Ih(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<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}Ns(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};Hs.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"renderGroup"}});var Ws,Q_=p(()=>{w();Dt();_s();Ws=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];z.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=z.get(Ee);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)z.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};Ws.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"sprite"}});var vi,Fh=p(()=>{kt();vi="8.9.2"});var zs,Vs,Uh=p(()=>{w();Fh();zs=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,vi)}static destroy(){}};zs.extension=x.Application;Vs=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,vi)}destroy(){this._renderer=null}};Vs.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"initHook",priority:-10}});var Dh,Oh,ty=p(()=>{w();me();fl();Dh=class J_{constructor(t,e){this.state=xt.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 hs)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=J_.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],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 r in e){let s=e[r],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,r=e.geometry,s=e.shader;this._adaptor.start(this,r,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}};Dh.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"batch"};Dh._availableBatchers=Object.create(null);Oh=Dh;k.handleByMap(x.Batcher,Oh._availableBatchers);k.add(hs)});var ey,ry=p(()=>{ey=`in vec2 vMaskCoord;
|
|
596
596
|
in vec2 vTextureCoord;
|
|
597
597
|
|
|
598
598
|
uniform sampler2D uTexture;
|
|
@@ -626,7 +626,7 @@ void main(void)
|
|
|
626
626
|
|
|
627
627
|
finalColor = original * a;
|
|
628
628
|
}
|
|
629
|
-
`});var
|
|
629
|
+
`});var iy,sy=p(()=>{iy=`in vec2 aPosition;
|
|
630
630
|
|
|
631
631
|
out vec2 vTextureCoord;
|
|
632
632
|
out vec2 vMaskCoord;
|
|
@@ -663,7 +663,7 @@ void main(void)
|
|
|
663
663
|
vTextureCoord = filterTextureCoord(aPosition);
|
|
664
664
|
vMaskCoord = getFilterCoord(aPosition);
|
|
665
665
|
}
|
|
666
|
-
`});var
|
|
666
|
+
`});var Lh,oy=p(()=>{Lh=`struct GlobalFilterUniforms {
|
|
667
667
|
uInputSize:vec4<f32>,
|
|
668
668
|
uInputPixel:vec4<f32>,
|
|
669
669
|
uInputClamp:vec4<f32>,
|
|
@@ -761,9 +761,9 @@ fn mainFragment(
|
|
|
761
761
|
|
|
762
762
|
return source * a;
|
|
763
763
|
}
|
|
764
|
-
`});var Aa,qy=m(()=>{K();Mr();ni();Vt();il();vy();jy();Yy();Ky();Aa=class extends by{constructor(t){let{sprite:e,...r}=t,s=new Yr(e.texture),o=new ot({uFilterMatrix:{value:new B,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=ue.from({vertex:{source:Su,entryPoint:"mainVertex"},fragment:{source:Su,entryPoint:"mainFragment"}}),a=he.from({vertex:$y,fragment:Xy,name:"mask-filter"});super({...r,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,r,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,r,s)}}});var rP,wu,ao,Zy=m(()=>{E();on();qy();Yt();is();En();Nt();et();qe();Be();rP=new it,wu=class extends Le{constructor(){super(),this.filters=[new Aa({sprite:new zt(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}},ao=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.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(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=W.get(wu);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=Vr(t.mask.mask,!0,rP);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=pt.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let c=s.sprite;c.texture=a,c.worldTransform.tx=o.minX,c.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];r&&(e.type===bt.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();r&&pt.returnTexture(s.filterTexture),W.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};ao.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"alphaMask"}});var co,Qy=m(()=>{E();co=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,r){this._renderer.renderPipes.batch.break(r);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,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};co.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"colorMask"}});var lo,Jy=m(()=>{E();Bi();Cr();lo=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.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 c=this._maskHash.get(o);c.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-c.instructionsStart-1;c.instructionsLength=l;let h=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[h]??(s[h]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(lt.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(lt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(lt.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(lt.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,Mt.STENCIL),r.stencil.setStencilMode(lt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(lt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(lt.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};lo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"stencilMask"}});var Pu,eb,rb=m(()=>{It();E();Pu=class tb{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...tb.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(){}};Pu.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0};Pu.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};eb=Pu});var ho,uo,ib=m(()=>{E();on();st();ho={};G.handle(x.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");ho[i.name]=i.ref},i=>{delete ho[i.name]});uo=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,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!ho[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!ho[e]){k(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new Le,r.filters=[new ho[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,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}};uo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"}});var Eu,Au,ob,nb=m(()=>{E();ge();et();Eu={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Au=class sb{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,sb.defaultImageOptions);let{format:e,quality:r}=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 c=new FileReader;c.onload=()=>o(c.result),c.onerror=n,c.readAsDataURL(a)},Eu[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(Eu[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Eu[e],quality:r});return new Promise((n,a)=>{let c=new FileReader;c.onload=()=>n(c.result),c.onerror=a,c.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,r=this._renderer;if(e instanceof M)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof M?e:r.textureGenerator.generateTexture(t),o=r.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),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.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}};Au.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"};Au.defaultImageOptions={format:"png",quality:1};ob=Au});var Ca,ab=m(()=>{Kt();et();Ca=class i extends M{static create(t){return new i({source:new tt(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var iP,sP,oP,fo,cb=m(()=>{It();E();K();vt();Yt();hn();ge();ab();iP=new z,sP=new it,oP=[0,0,0,0],fo=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,r=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:V.shared.setValue(o).toArray():o=oP;let n=t.frame?.copyTo(iP)||jr(s,sP).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=Ca.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),c=B.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:c,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};fo.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"}});var po,lb=m(()=>{E();K();ae();gi();er();Be();Vt();po=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<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new B,worldColor:4294967295,offset:new $},c={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let h=l.uniforms;h.uProjectionMatrix=c.projectionMatrix,h.uResolution=c.resolution,h.uWorldTransformMatrix.copyFrom(c.worldTransformMatrix),h.uWorldTransformMatrix.tx-=c.offset.x,h.uWorldTransformMatrix.ty-=c.offset.y,Re(c.worldColor,h.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new At,this._activeBindGroups.push(u),u.setResource(l,0)),c.bindGroup=u,this._currentGlobalUniformData=c}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===bt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new ot({uProjectionMatrix:{value:new B,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new B,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};po.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"}});var nP,mo,hb=m(()=>{E();ls();nP=1,mo=class{constructor(){this._tasks=[],this._offset=0}init(){qt.system.add(this._update,this)}repeat(t,e,r=!0){let s=nP++,o=0;return r&&(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<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){qt.system.remove(this._update,this),this._tasks.length=0}};mo.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0}});function db(i){if(!ub){if(D.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Ii} (${i}) http://www.pixijs.com/
|
|
764
|
+
`});var ca,ny=p(()=>{Z();Tr();Kr();Ht();yc();R_();ry();sy();oy();ca=class extends B_{constructor(t){let{sprite:e,...r}=t,s=new Dr(e.texture),o=new st({uFilterMatrix:{value:new G,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=ae.from({vertex:{source:Lh,entryPoint:"mainVertex"},fragment:{source:Lh,entryPoint:"mainFragment"}}),a=ne.from({vertex:iy,fragment:ey,name:"mask-filter"});super({...r,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,r,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,r,s)}}});var VS,Nh,Xs,ay=p(()=>{w();Lo();ny();Xt();Hi();an();Dt();et();We();Pe();VS=new rt,Nh=class extends Re{constructor(){super(),this.filters=[new ca({sprite:new Nt(C.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}},Xs=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.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(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=z.get(Nh);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=kr(t.mask.mask,!0,VS);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=ft.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let c=s.sprite;c.texture=a,c.worldTransform.tx=o.minX,c.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];r&&(e.type===yt.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();r&&ft.returnTexture(s.filterTexture),z.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};Xs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"alphaMask"}});var $s,cy=p(()=>{w();$s=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,r){this._renderer.renderPipes.batch.break(r);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,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};$s.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"colorMask"}});var Ys,ly=p(()=>{w();yi();vr();Ys=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.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 c=this._maskHash.get(o);c.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-c.instructionsStart-1;c.instructionsLength=l;let h=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[h]??(s[h]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(lt.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(lt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(lt.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(lt.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,Et.STENCIL),r.stencil.setStencilMode(lt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(lt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(lt.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};Ys.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"stencilMask"}});var Hh,uy,dy=p(()=>{Mt();w();Hh=class hy{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new X(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...hy.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(){}};Hh.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0};Hh.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};uy=Hh});var js,Ks,fy=p(()=>{w();Lo();it();js={};k.handle(x.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");js[i.name]=i.ref},i=>{delete js[i.name]});Ks=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,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!js[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!js[e]){F(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new Re,r.filters=[new js[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,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}};Ks.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"}});var Wh,zh,my,gy=p(()=>{w();de();et();Wh={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},zh=class py{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof at||t instanceof C?{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,py.defaultImageOptions);let{format:e,quality:r}=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 c=new FileReader;c.onload=()=>o(c.result),c.onerror=n,c.readAsDataURL(a)},Wh[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(Wh[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Wh[e],quality:r});return new Promise((n,a)=>{let c=new FileReader;c.onload=()=>n(c.result),c.onerror=a,c.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,r=this._renderer;if(e instanceof C)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof C?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof at&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof C?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.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}};zh.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"};zh.defaultImageOptions={format:"png",quality:1};my=zh});var la,xy=p(()=>{$t();et();la=class i extends C{static create(t){return new i({source:new tt(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var XS,$S,YS,qs,_y=p(()=>{Mt();w();Z();bt();Xt();Vo();de();xy();XS=new V,$S=new rt,YS=[0,0,0,0],qs=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,r=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:X.shared.setValue(o).toArray():o=YS;let n=t.frame?.copyTo(XS)||Fr(s,$S).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=la.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),c=G.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:c,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};qs.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"}});var Zs,yy=p(()=>{w();Z();ie();oi();Ye();Pe();Ht();Zs=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<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new G,worldColor:4294967295,offset:new K},c={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let h=l.uniforms;h.uProjectionMatrix=c.projectionMatrix,h.uResolution=c.resolution,h.uWorldTransformMatrix.copyFrom(c.worldTransformMatrix),h.uWorldTransformMatrix.tx-=c.offset.x,h.uWorldTransformMatrix.ty-=c.offset.y,Ae(c.worldColor,h.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new Pt,this._activeBindGroups.push(u),u.setResource(l,0)),c.bindGroup=u,this._currentGlobalUniformData=c}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===yt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new st({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};Zs.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"}});var jS,Qs,by=p(()=>{w();Yi();jS=1,Qs=class{constructor(){this._tasks=[],this._offset=0}init(){Yt.system.add(this._update,this)}repeat(t,e,r=!0){let s=jS++,o=0;return r&&(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<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){Yt.system.remove(this._update,this),this._tasks.length=0}};Qs.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0}});function Ty(i){if(!vy){if(O.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${vi} (${i}) http://www.pixijs.com/
|
|
765
765
|
|
|
766
|
-
`,"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 ${Ii} - ${i} - http://www.pixijs.com/`);ub=!0}}var ub,fb=m(()=>{ct();yu();ub=!1});var Gi,pb=m(()=>{E();fb();Be();Gi=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===bt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),db(e)}}};Gi.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"hello",priority:-2};Gi.defaultOptions={hello:!1}});function mb(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function gb(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var xb=m(()=>{"use strict"});var aP,Cu,yb,bb=m(()=>{E();xb();aP=0,Cu=class _b{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={..._b.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]=mb(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)gb(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=aP++,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,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,c=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===c&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let l=r;a&&(a.structureDidChange=!0),l[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 r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};Cu.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"renderableGC",priority:0};Cu.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};yb=Cu});var Mu,Tb,Sb=m(()=>{E();Mu=class vb{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...vb.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<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};Mu.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGC"};Mu.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};Tb=Mu});var wb,go,Bu=m(()=>{kt();Kt();et();wb=class Pb{constructor(t={}){if(this.uid=j("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...Pb.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;e<t.colorTextures;e++)this.colorTextures.push(new tt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.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 tt?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 tt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}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)}};wb.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};go=wb});function Ma(i,t){if(!xo.has(i)){let e=new M({source:new Ot({resource:i,...t})}),r=()=>{xo.get(i)===e&&xo.delete(i)};e.once("destroy",r),e.source.once("destroy",r),xo.set(i,e)}return xo.get(i)}var xo,Ru=m(()=>{Jr();et();xo=new Map});var Iu,Ab,Cb=m(()=>{ct();E();vt();ft();Bu();Ru();Iu=class Eb{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={...Eb.defaultOptions,...t},t.view&&(U(H,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new z(0,0,t.width,t.height),this.canvas=t.canvas||D.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Ma(this.canvas,t),this.renderTarget=new go({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),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)}};Iu.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"view",priority:0};Iu.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};Ab=Iu});var Ba,Ra,Gu=m(()=>{Gy();ky();Hy();Wy();bu();Vy();Zy();Qy();Jy();rb();ib();nb();cb();lb();hb();pb();bb();Sb();Cb();Ba=[eb,po,Gi,Ab,io,Tb,fo,ob,no,yb,mo],Ra=[uo,Tu,so,eo,ao,lo,co,Js]});var _o,Mb=m(()=>{E();_o=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,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let h in o){let u=t.resources[h]??t.resources[o[h]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let p=f.buffer;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.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[h],resource:d})}let c=a.shader.getProgramData(e).bindGroups[r],l=s.createBindGroup({layout:c,entries:n});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};_o.extension={type:[x.WebGPUSystem],name:"bindGroup"}});var yo,Bb=m(()=>{E();kl();yo=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),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.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&&(bs(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}};yo.extension={type:[x.WebGPUSystem],name:"buffer"}});var bo,Rb=m(()=>{E();bo=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}};bo.extension={type:[x.WebGPUSystem],name:"colorMask"}});var ki,Ib=m(()=>{ct();E();ki=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 D.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};ki.extension={type:[x.WebGPUSystem],name:"device"};ki.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var vo,Gb=m(()=>{E();vo=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,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,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,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(s,t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:c,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,c??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),c??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,r={...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 r)this._setVertexBuffer(a,r[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}};vo.extension={type:[x.WebGPUSystem],name:"encoder",priority:1}});var To,kb=m(()=>{E();Cr();To=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:lt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.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}};To.extension={type:[x.WebGPUSystem],name:"stencil"}});var Fi,ku=m(()=>{fu();rr();Xe();Fi=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!Sa())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 gt({data:new Float32Array(e.layout.size/4),usage:X.UNIFORM|X.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new gt({data:new Float32Array(s.layout.size/4),usage:X.UNIFORM|X.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!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 Fb(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=So[s.data.type].size,n=So[s.data.type].align;if(!So[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(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 So,Fu=m(()=>{"use strict";So={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var Ke,Uu=m(()=>{"use strict";Ke=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
|
|
766
|
+
`,"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 ${vi} - ${i} - http://www.pixijs.com/`);vy=!0}}var vy,Sy=p(()=>{ct();Fh();vy=!1});var Ti,wy=p(()=>{w();Sy();Pe();Ti=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===yt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),Ty(e)}}};Ti.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"hello",priority:-2};Ti.defaultOptions={hello:!1}});function Py(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function Ay(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var Ey=p(()=>{"use strict"});var KS,Vh,My,By=p(()=>{w();Ey();KS=0,Vh=class Cy{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...Cy.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]=Py(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)Ay(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=KS++,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,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,c=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===c&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let l=r;a&&(a.structureDidChange=!0),l[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 r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};Vh.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"renderableGC",priority:0};Vh.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};My=Vh});var Xh,Gy,ky=p(()=>{w();Xh=class Ry{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...Ry.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<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};Xh.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGC"};Xh.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};Gy=Xh});var Iy,Js,$h=p(()=>{Rt();$t();et();Iy=class Fy{constructor(t={}){if(this.uid=j("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...Fy.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;e<t.colorTextures;e++)this.colorTextures.push(new tt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.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 C||t.depthStencilTexture instanceof tt?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 tt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}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)}};Iy.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Js=Iy});function ha(i,t){if(!to.has(i)){let e=new C({source:new It({resource:i,...t})}),r=()=>{to.get(i)===e&&to.delete(i)};e.once("destroy",r),e.source.once("destroy",r),to.set(i,e)}return to.get(i)}var to,Yh=p(()=>{Wr();et();to=new Map});var jh,Dy,Oy=p(()=>{ct();w();bt();dt();$h();Yh();jh=class Uy{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={...Uy.defaultOptions,...t},t.view&&(D(W,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new V(0,0,t.width,t.height),this.canvas=t.canvas||O.get().createCanvas(),this.antialias=!!t.antialias,this.texture=ha(this.canvas,t),this.renderTarget=new Js({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),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)}};jh.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"view",priority:0};jh.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};Dy=jh});var ua,da,Kh=p(()=>{z_();V_();Z_();Q_();Uh();ty();ay();cy();ly();dy();fy();gy();_y();yy();by();wy();By();ky();Oy();ua=[uy,Zs,Ti,Dy,Hs,Gy,qs,my,Vs,My,Qs],da=[Ks,Oh,Ws,Ls,Xs,Ys,$s,Ds]});var eo,Ly=p(()=>{w();eo=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,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let h in o){let u=t.resources[h]??t.resources[o[h]],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[h],resource:d})}let c=a.shader.getProgramData(e).bindGroups[r],l=s.createBindGroup({layout:c,entries:n});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};eo.extension={type:[x.WebGPUSystem],name:"bindGroup"}});var ro,Ny=p(()=>{w();qc();ro=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),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.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&&(ss(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}};ro.extension={type:[x.WebGPUSystem],name:"buffer"}});var io,Hy=p(()=>{w();io=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}};io.extension={type:[x.WebGPUSystem],name:"colorMask"}});var Si,Wy=p(()=>{ct();w();Si=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 O.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};Si.extension={type:[x.WebGPUSystem],name:"device"};Si.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var so,zy=p(()=>{w();so=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,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,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,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(s,t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:c,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,c??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),c??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,r={...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 r)this._setVertexBuffer(a,r[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}};so.extension={type:[x.WebGPUSystem],name:"encoder",priority:1}});var oo,Vy=p(()=>{w();vr();oo=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:lt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.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}};oo.extension={type:[x.WebGPUSystem],name:"stencil"}});var wi,qh=p(()=>{Mh();je();De();wi=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!sa())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 mt({data:new Float32Array(e.layout.size/4),usage:Y.UNIFORM|Y.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new mt({data:new Float32Array(s.layout.size/4),usage:Y.UNIFORM|Y.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!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 Xy(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=no[s.data.type].size,n=no[s.data.type].align;if(!no[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(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 no,Zh=p(()=>{"use strict";no={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var He,Qh=p(()=>{"use strict";He=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
|
|
767
767
|
var matrix = uv[name].toArray(true);
|
|
768
768
|
data[offset] = matrix[0];
|
|
769
769
|
data[offset + 1] = matrix[1];
|
|
@@ -834,23 +834,23 @@ fn mainFragment(
|
|
|
834
834
|
cv[2] = v.blue;
|
|
835
835
|
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
|
|
836
836
|
}
|
|
837
|
-
`}]});function
|
|
837
|
+
`}]});function fa(i,t,e,r){let s=[`
|
|
838
838
|
var v = null;
|
|
839
839
|
var v2 = null;
|
|
840
840
|
var t = 0;
|
|
841
841
|
var index = 0;
|
|
842
842
|
var name = null;
|
|
843
843
|
var arrayOffset = null;
|
|
844
|
-
`],o=0;for(let a=0;a<i.length;a++){let c=i[a],l=c.data.name,h=!1,u=0;for(let d=0;d<
|
|
844
|
+
`],o=0;for(let a=0;a<i.length;a++){let c=i[a],l=c.data.name,h=!1,u=0;for(let d=0;d<He.length;d++)if(He[d].test(c.data)){u=c.offset/4,s.push(`name = "${l}";`,`offset += ${u-o};`,He[d][t]||He[d].ubo),h=!0;break}if(!h)if(c.data.size>1)u=c.offset/4,s.push(e(c,u-o));else{let d=r[c.data.type];u=c.offset/4,s.push(`
|
|
845
845
|
v = uv.${l};
|
|
846
846
|
offset += ${u-o};
|
|
847
847
|
${d};
|
|
848
848
|
`)}o=u}let n=s.join(`
|
|
849
|
-
`);return new Function("uv","data","dataInt32","offset",n)}var
|
|
849
|
+
`);return new Function("uv","data","dataInt32","offset",n)}var Jh=p(()=>{Qh()});function Pi(i,t){return`
|
|
850
850
|
for (let i = 0; i < ${i*t}; i++) {
|
|
851
851
|
data[offset + (((i / ${i})|0) * 4) + (i % ${i})] = v[i];
|
|
852
852
|
}
|
|
853
|
-
`}var
|
|
853
|
+
`}var tu,$y,eu=p(()=>{"use strict";tu={f32:`
|
|
854
854
|
data[offset] = v;`,i32:`
|
|
855
855
|
dataInt32[offset] = v;`,"vec2<f32>":`
|
|
856
856
|
data[offset] = v[0];
|
|
@@ -886,12 +886,12 @@ fn mainFragment(
|
|
|
886
886
|
data[offset + 10] = v[8];`,"mat4x4<f32>":`
|
|
887
887
|
for (let i = 0; i < 16; i++) {
|
|
888
888
|
data[offset + i] = v[i];
|
|
889
|
-
}`,"mat3x2<f32>":
|
|
889
|
+
}`,"mat3x2<f32>":Pi(3,2),"mat4x2<f32>":Pi(4,2),"mat2x3<f32>":Pi(2,3),"mat4x3<f32>":Pi(4,3),"mat2x4<f32>":Pi(2,4),"mat3x4<f32>":Pi(3,4)},$y={...tu,"mat2x2<f32>":`
|
|
890
890
|
data[offset] = v[0];
|
|
891
891
|
data[offset + 1] = v[1];
|
|
892
892
|
data[offset + 2] = v[2];
|
|
893
893
|
data[offset + 3] = v[3];
|
|
894
|
-
`}});function
|
|
894
|
+
`}});function Yy(i,t){let{size:e,align:r}=no[i.data.type],s=(r-e)/4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
895
895
|
v = uv.${i.data.name};
|
|
896
896
|
${t!==0?`offset += ${t};`:""}
|
|
897
897
|
|
|
@@ -907,7 +907,7 @@ fn mainFragment(
|
|
|
907
907
|
}
|
|
908
908
|
${s!==0?`arrayOffset += ${s};`:""}
|
|
909
909
|
}
|
|
910
|
-
`}var Ob=m(()=>{Fu()});function Lb(i){return Ia(i,"uboWgsl",Db,Ub)}var Nb=m(()=>{Du();Lu();Ob()});var wo,Hb=m(()=>{E();ku();Fu();Nb();wo=class extends Fi{constructor(){super({createUboElements:Fb,generateUboSync:Lb})}};wo.extension={type:[x.WebGPUSystem],name:"ubo"}});var lr,Ga=m(()=>{Dt();kt();lr=class extends nt{constructor({buffer:t,offset:e,size:r}){super(),this.uid=j("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=j("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=j("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var ka,Wb=m(()=>{"use strict";ka=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,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var hr,Po,zb=m(()=>{E();rr();Ga();Xe();Wb();er();hr=128,Po=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 ka({minUniformOffsetAlignment:hr});let e=256/hr;for(let r=0;r<e;r++){let s=X.UNIFORM|X.COPY_DST;r===0&&(s|=X.COPY_SRC),this._buffers.push(new gt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/hr),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/hr)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/hr)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/hr;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new lr({buffer:e,offset:(t/2|0)*256,size:hr})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new At({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),hr,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Po.extension={type:[x.WebGPUPipes],name:"uniformBatch"}});function Fa(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):k(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}cP(i)}function cP(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=Qt(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=Qt(n.format).stride}}var Nu=m(()=>{st();Br()});var ke,Hu=m(()=>{Cr();ke=[];ke[lt.NONE]=void 0;ke[lt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};ke[lt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};ke[lt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};ke[lt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};ke[lt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function hP(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function uP(i,t,e,r){return e<<6|i<<3|r<<1|t}var lP,Eo,Vb=m(()=>{E();st();Nu();Cr();Ss();Hu();lP={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Eo=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(lt.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=ke[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(Fa(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=hP(t._layoutKey,e._layoutKey,r.data,r._blendModeId,lP[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===lt.RENDERING_MASK_ADD?0:this._colorMask;let c=this._renderer.shader.getProgramData(e).pipeline,l={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:r.cullMode},layout:c,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(l)}_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=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=je(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=je(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let l=Object.values(s[a].attributes)[0].shaderLocation;for(let h in n)if(n[h].location===l){o[a]=h;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let c in e.attributeData){let l=t.attributes[c];(l.divisor??1)!==1&&k(`Attribute ${c} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===o&&(n.arrayStride=l.stride,n.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[c].location,offset:l.offset,format:l.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=uP(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}};Eo.extension={type:[x.WebGPUSystem],name:"pipeline"}});function Xb(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var jb=m(()=>{"use strict"});function $b(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var Yb=m(()=>{"use strict"});var Di,Wu=m(()=>{K();vt();Bi();jb();pu();Jr();Kt();et();Ru();Yb();Bu();Di=class{constructor(t){this.rootViewPort=new z,this.viewport=new z,this.onRenderTargetChange=new Ri("onRenderTargetChange"),this.projectionMatrix=new B,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:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=$b(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,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 c=o.colorTexture,l=this.viewport,h=c.pixelWidth,u=c.pixelHeight;if(!s&&t instanceof M&&(s=t.frame),s){let d=c._resolution;l.x=s.x*d+.5|0,l.y=s.y*d+.5|0,l.width=s.width*d+.5|0,l.height=s.height*d+.5|0}else l.x=0,l.y=0,l.width=h,l.height=u;return Xb(this.projectionMatrix,0,0,l.width/c.resolution,l.height/c.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=Mt.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=Mt.ALL,r,s){let o=this.bind(t,e,r,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,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,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 Ot.test(t)&&(t=Ma(t).source),t instanceof go?e=t:t instanceof tt&&(e=new go({colorTextures:[t]}),Ot.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),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 Ua,Kb=m(()=>{"use strict";Ua=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var Da,qb=m(()=>{Bi();Jr();Kt();Kb();Da=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),c=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:c,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);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,r){typeof e=="boolean"&&(e=e?Mt.ALL:Mt.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((l,h)=>{let u=o.contexts[h],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),o.msaaTextures[h]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[h]));let p=e&Mt.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:r,storeOp:"store",loadOp:p}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let l=e&Mt.STENCIL?"clear":"load",h=e&Mt.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:h,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let l=a.createCommandEncoder(),h=this.getDescriptor(t,e,r),u=l.beginRenderPass(h);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=l.finish();a.queue.submit([d])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new Ua;return t.colorTextures.forEach((r,s)=>{if(Ot.test(r.resource)){let o=r.resource.getContext("webgpu"),n=r.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=r.source.antialias,r.source.antialias){let o=new tt({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((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var Ao,Zb=m(()=>{E();Wu();qb();Ao=class extends Di{constructor(t){super(t),this.adaptor=new Da,this.adaptor.init(t,this)}};Ao.extension={type:[x.WebGPUSystem],name:"renderTarget"}});var Co,Qb=m(()=>{E();Co=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,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Co.extension={type:[x.WebGPUSystem],name:"shader"}});var $t,Jb=m(()=>{"use strict";$t={};$t.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};$t.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};$t.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};$t.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};$t.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};$t.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};$t["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};$t["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};$t["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};$t.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};$t.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};$t.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Mo,tv=m(()=>{E();ye();Jb();Mo=class{constructor(){this.defaultState=new _t,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:$t[t.blendMode]||$t.normal}]}destroy(){this.gpu=null}};Mo.extension={type:[x.WebGPUSystem],name:"state"}});var ev,rv=m(()=>{"use strict";ev={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var zu,dP,iv,sv=m(()=>{"use strict";zu={"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}},dP={blockBytes:4,blockWidth:1,blockHeight:1},iv={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=zu[i.format]||dP;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],c=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:c},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Oa,Vu=m(()=>{"use strict";Oa={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var ov,nv=m(()=>{Vu();ov={type:"video",upload(i,t,e){Oa.upload(i,t,e)}}});var La,av=m(()=>{"use strict";La=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:`
|
|
910
|
+
`}var jy=p(()=>{Zh()});function Ky(i){return fa(i,"uboWgsl",Yy,$y)}var qy=p(()=>{Jh();eu();jy()});var ao,Zy=p(()=>{w();qh();Zh();qy();ao=class extends wi{constructor(){super({createUboElements:Xy,generateUboSync:Ky})}};ao.extension={type:[x.WebGPUSystem],name:"ubo"}});var er,pa=p(()=>{kt();Rt();er=class extends nt{constructor({buffer:t,offset:e,size:r}){super(),this.uid=j("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=j("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=j("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var ma,Qy=p(()=>{"use strict";ma=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,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var rr,co,Jy=p(()=>{w();je();pa();De();Qy();Ye();rr=128,co=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 ma({minUniformOffsetAlignment:rr});let e=256/rr;for(let r=0;r<e;r++){let s=Y.UNIFORM|Y.COPY_DST;r===0&&(s|=Y.COPY_SRC),this._buffers.push(new mt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/rr),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/rr)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/rr)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/rr;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new er({buffer:e,offset:(t/2|0)*256,size:rr})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new Pt({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),rr,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};co.extension={type:[x.WebGPUPipes],name:"uniformBatch"}});function ga(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):F(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}qS(i)}function qS(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=Kt(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=Kt(n.format).stride}}var ru=p(()=>{it();Sr()});var Me,iu=p(()=>{vr();Me=[];Me[lt.NONE]=void 0;Me[lt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Me[lt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Me[lt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Me[lt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Me[lt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function QS(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function JS(i,t,e,r){return e<<6|i<<3|r<<1|t}var ZS,lo,tb=p(()=>{w();it();ru();vr();as();iu();ZS={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};lo=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(lt.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=Me[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(ga(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=QS(t._layoutKey,e._layoutKey,r.data,r._blendModeId,ZS[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===lt.RENDERING_MASK_ADD?0:this._colorMask;let c=this._renderer.shader.getProgramData(e).pipeline,l={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:r.cullMode},layout:c,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(l)}_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=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=Oe(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=Oe(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let l=Object.values(s[a].attributes)[0].shaderLocation;for(let h in n)if(n[h].location===l){o[a]=h;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let c in e.attributeData){let l=t.attributes[c];(l.divisor??1)!==1&&F(`Attribute ${c} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===o&&(n.arrayStride=l.stride,n.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[c].location,offset:l.offset,format:l.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=JS(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}};lo.extension={type:[x.WebGPUSystem],name:"pipeline"}});function eb(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var rb=p(()=>{"use strict"});function ib(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var sb=p(()=>{"use strict"});var Ai,su=p(()=>{Z();bt();yi();rb();Bh();Wr();$t();et();Yh();sb();$h();Ai=class{constructor(t){this.rootViewPort=new V,this.viewport=new V,this.onRenderTargetChange=new bi("onRenderTargetChange"),this.projectionMatrix=new G,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:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=ib(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,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 c=o.colorTexture,l=this.viewport,h=c.pixelWidth,u=c.pixelHeight;if(!s&&t instanceof C&&(s=t.frame),s){let d=c._resolution;l.x=s.x*d+.5|0,l.y=s.y*d+.5|0,l.width=s.width*d+.5|0,l.height=s.height*d+.5|0}else l.x=0,l.y=0,l.width=h,l.height=u;return eb(this.projectionMatrix,0,0,l.width/c.resolution,l.height/c.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=Et.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=Et.ALL,r,s){let o=this.bind(t,e,r,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,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,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 It.test(t)&&(t=ha(t).source),t instanceof Js?e=t:t instanceof tt&&(e=new Js({colorTextures:[t]}),It.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),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 xa,ob=p(()=>{"use strict";xa=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var _a,nb=p(()=>{yi();Wr();$t();ob();_a=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),c=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:c,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);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,r){typeof e=="boolean"&&(e=e?Et.ALL:Et.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((l,h)=>{let u=o.contexts[h],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),o.msaaTextures[h]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[h]));let m=e&Et.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:r,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 l=e&Et.STENCIL?"clear":"load",h=e&Et.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:h,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let l=a.createCommandEncoder(),h=this.getDescriptor(t,e,r),u=l.beginRenderPass(h);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=l.finish();a.queue.submit([d])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new xa;return t.colorTextures.forEach((r,s)=>{if(It.test(r.resource)){let o=r.resource.getContext("webgpu"),n=r.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=r.source.antialias,r.source.antialias){let o=new tt({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((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var ho,ab=p(()=>{w();su();nb();ho=class extends Ai{constructor(t){super(t),this.adaptor=new _a,this.adaptor.init(t,this)}};ho.extension={type:[x.WebGPUSystem],name:"renderTarget"}});var uo,cb=p(()=>{w();uo=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,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};uo.extension={type:[x.WebGPUSystem],name:"shader"}});var Vt,lb=p(()=>{"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 fo,hb=p(()=>{w();me();lb();fo=class{constructor(){this.defaultState=new xt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Vt[t.blendMode]||Vt.normal}]}destroy(){this.gpu=null}};fo.extension={type:[x.WebGPUSystem],name:"state"}});var ub,db=p(()=>{"use strict";ub={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var ou,tw,fb,pb=p(()=>{"use strict";ou={"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}},tw={blockBytes:4,blockWidth:1,blockHeight:1},fb={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=ou[i.format]||tw;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],c=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:c},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var ya,nu=p(()=>{"use strict";ya={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var mb,gb=p(()=>{nu();mb={type:"video",upload(i,t,e){ya.upload(i,t,e)}}});var ba,xb=p(()=>{"use strict";ba=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:`
|
|
911
911
|
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
912
912
|
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
913
913
|
|
|
@@ -931,7 +931,7 @@ fn mainFragment(
|
|
|
931
931
|
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
932
932
|
return textureSample(img, imgSampler, texCoord);
|
|
933
933
|
}
|
|
934
|
-
`})),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 r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let c={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};r=this.device.createTexture(c)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let c=0;c<s;++c){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:c,arrayLayerCount:1}),h=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=r.createView({baseMipLevel:h++,mipLevelCount:1,dimension:"2d",baseArrayLayer:c,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});f.setPipeline(e),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),l=d}}if(!o){let c={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)n.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},c),c.width=Math.ceil(c.width/2),c.height=Math.ceil(c.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var Bo,cv=m(()=>{ct();E();Vt();_i();er();rv();sv();Vu();nv();av();Bo=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:Oa,buffer:ev,video:ov,compressed:iv},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 c=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(c))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=zu[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.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 La(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 At({0:e,1:e.style,2:new ot({uTextureMatrix:{type:"mat3x3<f32>",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,r=e.gpu.device.createCommandEncoder(),s=D.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:D.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.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([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=te.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),c=new Uint8ClampedArray(a.data.buffer);return te.returnCanvasAndContext(r),{pixels:c,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}};Bo.extension={type:[x.WebGPUSystem],name:"texture"}});var dv={};Ud(dv,{WebGPURenderer:()=>Xu});var fP,pP,mP,lv,hv,uv,Xu,fv=m(()=>{E();Cy();Ry();Iy();Ks();Gu();Be();Mb();Bb();Rb();Ib();Gb();kb();Hb();zb();Vb();Zb();Qb();tv();cv();fP=[...Ba,wo,vo,ki,yo,Bo,Ao,Co,Mo,Eo,bo,To,_o],pP=[...Ra,Po],mP=[Qs,Zs,qs],lv=[],hv=[],uv=[];G.handleByNamedList(x.WebGPUSystem,lv);G.handleByNamedList(x.WebGPUPipes,hv);G.handleByNamedList(x.WebGPUPipesAdaptor,uv);G.add(...fP,...pP,...mP);Xu=class extends cr{constructor(){let t={name:"webgpu",type:bt.WEBGPU,systems:lv,renderPipes:hv,renderPipeAdaptors:uv};super(t)}}});var Ro,pv=m(()=>{E();K();Ar();sr();ws();Ps();Mi();or();Nn();_e();Vt();Ro=class{init(){let t=new ot({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=ce(),r=Ae({name:"graphics",bits:[ci,hi(e),Ci,Me]});this.shader=new xt({glProgram:r,resources:{localUniforms:t,batchSamplers:ui(e)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:c}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let l=c.instructions;for(let h=0;h<c.instructionSize;h++){let u=l[h];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};Ro.extension={type:[x.WebGLPipesAdaptor],name:"graphics"}});var Io,mv=m(()=>{E();K();sr();Mi();or();mu();_e();et();st();Io=class{init(){let t=Ae({name:"mesh",bits:[Ci,By,Me]});this._shader=new xt({glProgram:t,resources:{uTexture:M.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){k("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]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Io.extension={type:[x.WebGLPipesAdaptor],name:"mesh"}});var Go,gv=m(()=>{E();ye();Go=class{constructor(){this._tempState=_t.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};Go.extension={type:[x.WebGLPipesAdaptor],name:"batch"}});var ko,xv=m(()=>{"use strict";ko=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(ko||{})});var Na,_v=m(()=>{"use strict";Na=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var Fo,yv=m(()=>{E();Xe();xv();_v();Fo=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,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.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 r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=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,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&X.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}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 r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=ko.ARRAY_BUFFER;t.descriptor.usage&X.INDEX?r=ko.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&X.UNIFORM&&(r=ko.UNIFORM_BUFFER);let s=new Na(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};Fo.extension={type:[x.WebGLSystem],name:"buffer"}});var ju,vv,Tv=m(()=>{ct();E();st();ju=class bv{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={...bv.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(k("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=D.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&k("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof D.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={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"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)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"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{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&&k("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||k("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};ju.extension={type:[x.WebGLSystem],name:"context"};ju.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};vv=ju});var Ha,$u,Z,Yu=m(()=>{"use strict";Ha=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Ha||{}),$u=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))($u||{}),Z=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(Z||{})});function wv(i){return Sv[i]??Sv.float32}var Sv,Pv=m(()=>{Yu();Sv={uint8x2:Z.UNSIGNED_BYTE,uint8x4:Z.UNSIGNED_BYTE,sint8x2:Z.BYTE,sint8x4:Z.BYTE,unorm8x2:Z.UNSIGNED_BYTE,unorm8x4:Z.UNSIGNED_BYTE,snorm8x2:Z.BYTE,snorm8x4:Z.BYTE,uint16x2:Z.UNSIGNED_SHORT,uint16x4:Z.UNSIGNED_SHORT,sint16x2:Z.SHORT,sint16x4:Z.SHORT,unorm16x2:Z.UNSIGNED_SHORT,unorm16x4:Z.UNSIGNED_SHORT,snorm16x2:Z.SHORT,snorm16x4:Z.SHORT,float16x2:Z.HALF_FLOAT,float16x4:Z.HALF_FLOAT,float32:Z.FLOAT,float32x2:Z.FLOAT,float32x3:Z.FLOAT,float32x4:Z.FLOAT,uint32:Z.UNSIGNED_INT,uint32x2:Z.UNSIGNED_INT,uint32x3:Z.UNSIGNED_INT,uint32x4:Z.UNSIGNED_INT,sint32:Z.INT,sint32x2:Z.INT,sint32x3:Z.INT,sint32x4:Z.INT}});var gP,Uo,Ev=m(()=>{E();Br();Nu();Pv();gP={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Uo=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 r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,c)=>{r.drawElementsInstancedANGLE(s,o,n,a,c)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],c=a[n];if(c)return a[e._key]=c,c;Fa(t,e._attributeData);let l=t.buffers;c=s.createVertexArray(),s.bindVertexArray(c);for(let h=0;h<l.length;h++){let u=l[h];o.bind(u)}return this.activateVao(t,e),a[e._key]=c,a[n]=c,s.bindVertexArray(null),c}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let c=o[a],l=c.buffer,h=s.getGlBuffer(l),u=e._attributeData[a];if(u){n!==h&&(s.bind(l),n=h);let d=u.location;r.enableVertexAttribArray(d);let f=Qt(c.format),p=wv(c.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,p,c.stride,c.offset):r.vertexAttribPointer(d,f.size,p,f.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){let g=c.divisor??1;r.vertexAttribDivisor(d,g)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=gP[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let c=n.indexBuffer.data.BYTES_PER_ELEMENT,l=c===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,l,(r||0)*c,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(r||0)*c)}else s>1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||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}};Uo.extension={type:[x.WebGLSystem],name:"geometry"}});var xP,Ku,Cv,Mv=m(()=>{E();st();si();_e();ye();Kt();et();Mr();xP=new le({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Ku=class Av{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...Av.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(k("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=_t.for2d();let s=new he({vertex:`
|
|
934
|
+
`})),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 r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let c={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};r=this.device.createTexture(c)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let c=0;c<s;++c){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:c,arrayLayerCount:1}),h=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=r.createView({baseMipLevel:h++,mipLevelCount:1,dimension:"2d",baseArrayLayer:c,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),m=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});f.setPipeline(e),f.setBindGroup(0,m),f.draw(3,1,0,0),f.end(),l=d}}if(!o){let c={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)n.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},c),c.width=Math.ceil(c.width/2),c.height=Math.ceil(c.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var po,_b=p(()=>{ct();w();Ht();ai();Ye();db();pb();nu();gb();xb();po=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:ya,buffer:ub,video:mb,compressed:fb},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 c=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(c))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=ou[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.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 ba(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 Pt({0:e,1:e.style,2:new st({uTextureMatrix:{type:"mat3x3<f32>",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,r=e.gpu.device.createCommandEncoder(),s=O.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:O.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.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([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=Zt.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),c=new Uint8ClampedArray(a.data.buffer);return Zt.returnCanvasAndContext(r),{pixels:c,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}};po.extension={type:[x.WebGPUSystem],name:"texture"}});var Tb={};$u(Tb,{WebGPURenderer:()=>au});var ew,rw,iw,yb,bb,vb,au,Sb=p(()=>{w();O_();H_();W_();ks();Kh();Pe();Ly();Ny();Hy();Wy();zy();Vy();Zy();Jy();tb();ab();cb();hb();_b();ew=[...ua,ao,so,Si,ro,po,ho,uo,fo,lo,io,oo,eo],rw=[...da,co],iw=[Us,Fs,Is],yb=[],bb=[],vb=[];k.handleByNamedList(x.WebGPUSystem,yb);k.handleByNamedList(x.WebGPUPipes,bb);k.handleByNamedList(x.WebGPUPipesAdaptor,vb);k.add(...ew,...rw,...iw);au=class extends tr{constructor(){let t={name:"webgpu",type:yt.WEBGPU,systems:yb,renderPipes:bb,renderPipeAdaptors:vb};super(t)}}});var mo,wb=p(()=>{w();Z();br();qe();cs();ls();_i();Ze();vn();pe();Ht();mo=class{init(){let t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=se(),r=Te({name:"graphics",bits:[Zr,Jr(e),xi,we]});this.shader=new gt({glProgram:r,resources:{localUniforms:t,batchSamplers:ti(e)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:c}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let l=c.instructions;for(let h=0;h<c.instructionSize;h++){let u=l[h];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};mo.extension={type:[x.WebGLPipesAdaptor],name:"graphics"}});var go,Pb=p(()=>{w();Z();qe();_i();Ze();Rh();pe();et();it();go=class{init(){let t=Te({name:"mesh",bits:[xi,N_,we]});this._shader=new gt({glProgram:t,resources:{uTexture:C.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){F("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]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};go.extension={type:[x.WebGLPipesAdaptor],name:"mesh"}});var xo,Ab=p(()=>{w();me();xo=class{constructor(){this._tempState=xt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};xo.extension={type:[x.WebGLPipesAdaptor],name:"batch"}});var _o,Eb=p(()=>{"use strict";_o=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(_o||{})});var va,Cb=p(()=>{"use strict";va=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var yo,Mb=p(()=>{w();De();Eb();Cb();yo=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,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.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 r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=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,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&Y.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}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 r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=_o.ARRAY_BUFFER;t.descriptor.usage&Y.INDEX?r=_o.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&Y.UNIFORM&&(r=_o.UNIFORM_BUFFER);let s=new va(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};yo.extension={type:[x.WebGLSystem],name:"buffer"}});var cu,Rb,Gb=p(()=>{ct();w();it();cu=class Bb{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={...Bb.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(F("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=O.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&F("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof O.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={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"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)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"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{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&&F("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||F("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};cu.extension={type:[x.WebGLSystem],name:"context"};cu.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};Rb=cu});var Ta,lu,Q,hu=p(()=>{"use strict";Ta=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Ta||{}),lu=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(lu||{}),Q=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(Q||{})});function Ib(i){return kb[i]??kb.float32}var kb,Fb=p(()=>{hu();kb={uint8x2:Q.UNSIGNED_BYTE,uint8x4:Q.UNSIGNED_BYTE,sint8x2:Q.BYTE,sint8x4:Q.BYTE,unorm8x2:Q.UNSIGNED_BYTE,unorm8x4:Q.UNSIGNED_BYTE,snorm8x2:Q.BYTE,snorm8x4:Q.BYTE,uint16x2:Q.UNSIGNED_SHORT,uint16x4:Q.UNSIGNED_SHORT,sint16x2:Q.SHORT,sint16x4:Q.SHORT,unorm16x2:Q.UNSIGNED_SHORT,unorm16x4:Q.UNSIGNED_SHORT,snorm16x2:Q.SHORT,snorm16x4:Q.SHORT,float16x2:Q.HALF_FLOAT,float16x4:Q.HALF_FLOAT,float32:Q.FLOAT,float32x2:Q.FLOAT,float32x3:Q.FLOAT,float32x4:Q.FLOAT,uint32:Q.UNSIGNED_INT,uint32x2:Q.UNSIGNED_INT,uint32x3:Q.UNSIGNED_INT,uint32x4:Q.UNSIGNED_INT,sint32:Q.INT,sint32x2:Q.INT,sint32x3:Q.INT,sint32x4:Q.INT}});var sw,bo,Ub=p(()=>{w();Sr();ru();Fb();sw={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},bo=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 r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,c)=>{r.drawElementsInstancedANGLE(s,o,n,a,c)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],c=a[n];if(c)return a[e._key]=c,c;ga(t,e._attributeData);let l=t.buffers;c=s.createVertexArray(),s.bindVertexArray(c);for(let h=0;h<l.length;h++){let u=l[h];o.bind(u)}return this.activateVao(t,e),a[e._key]=c,a[n]=c,s.bindVertexArray(null),c}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let c=o[a],l=c.buffer,h=s.getGlBuffer(l),u=e._attributeData[a];if(u){n!==h&&(s.bind(l),n=h);let d=u.location;r.enableVertexAttribArray(d);let f=Kt(c.format),m=Ib(c.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,m,c.stride,c.offset):r.vertexAttribPointer(d,f.size,m,f.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){let _=c.divisor??1;r.vertexAttribDivisor(d,_)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=sw[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let c=n.indexBuffer.data.BYTES_PER_ELEMENT,l=c===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,l,(r||0)*c,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(r||0)*c)}else s>1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||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}};bo.extension={type:[x.WebGLSystem],name:"geometry"}});var ow,uu,Ob,Lb=p(()=>{w();it();Yr();pe();me();$t();et();Tr();ow=new oe({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),uu=class Db{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...Db.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(F("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=xt.for2d();let s=new ne({vertex:`
|
|
935
935
|
attribute vec2 aPosition;
|
|
936
936
|
out vec2 vUv;
|
|
937
937
|
|
|
@@ -950,7 +950,7 @@ fn mainFragment(
|
|
|
950
950
|
|
|
951
951
|
void main() {
|
|
952
952
|
finalColor = texture(uTexture, vUv);
|
|
953
|
-
}`,name:"big-triangle"});this._bigTriangleShader=new
|
|
953
|
+
}`,name:"big-triangle"});this._bigTriangleShader=new gt({glProgram:s,resources:{uTexture:C.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let r=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=r.colorTexture,t.target=this._getBackBufferTexture(r.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:ow,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new C({source:new tt({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)}};uu.extension={type:[x.WebGLSystem],name:"backBuffer",priority:1};uu.defaultOptions={useBackBuffer:!1};Ob=uu});var vo,Nb=p(()=>{w();vo=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)))}};vo.extension={type:[x.WebGLSystem],name:"colorMask"}});var To,Hb=p(()=>{w();To=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:r,shader:s,state:o,skipSync:n,topology:a,size:c,start:l,instanceCount:h}=t;e.shader.bind(s,n),e.geometry.bind(r,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,c,l,h??r.instanceCount)}destroy(){this._renderer=null}};To.extension={type:[x.WebGLSystem],name:"encoder"}});var So,Wb=p(()=>{w();iu();vr();So=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:lt.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:lt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=lt.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Me[t],n=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===lt.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]))}};So.extension={type:[x.WebGLSystem],name:"stencil"}});function zb(i){let t=i.map(o=>({data:o,offset:0,size:0})),e=16,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(r=du[n.data.type],!r)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(r=Math.max(r,e)*n.data.size);let a=r===12?16:r;n.size=r;let c=s%e;c>0&&e-c<a?s+=(e-c)%16:s+=(r-c%r)%r,n.offset=s,s+=r}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var du,fu=p(()=>{"use strict";du={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function Vb(i,t){let e=Math.max(du[i.data.type]/16,1),r=i.data.value.length/i.data.size,s=(4-r%4)%4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
954
954
|
v = uv.${i.data.name};
|
|
955
955
|
offset += ${t};
|
|
956
956
|
|
|
@@ -966,7 +966,7 @@ fn mainFragment(
|
|
|
966
966
|
}
|
|
967
967
|
${s!==0?`arrayOffset += ${s};`:""}
|
|
968
968
|
}
|
|
969
|
-
`}var
|
|
969
|
+
`}var Xb=p(()=>{fu()});function $b(i){return fa(i,"uboStd40",Vb,tu)}var Yb=p(()=>{Jh();eu();Xb()});var wo,jb=p(()=>{w();qh();fu();Yb();wo=class extends wi{constructor(){super({createUboElements:zb,generateUboSync:$b})}};wo.extension={type:[x.WebGLSystem],name:"ubo"}});var Sa,Kb=p(()=>{"use strict";Sa=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var wa,qb=p(()=>{bt();it();Wr();yi();Kb();wa=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new V}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new V}copyToTexture(t,e,r,s,o){let n=this._renderTargetSystem,a=this._renderer,c=n.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,c.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,o.x,o.y,r.x,r.y,s.width,s.height),e}startRenderPass(t,e=!0,r,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),c=s.y;t.isRoot&&(c=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let h=this._viewPortCache;(h.x!==s.x||h.y!==c||h.width!==s.width||h.height!==s.height)&&(h.x=s.x,h.y=c,h.width=s.width,h.height=s.height,l.viewport(s.x,c,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let r=this._renderTargetSystem.getGpuRenderTarget(t);if(!r.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,r.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,r.framebuffer),s.blitFramebuffer(0,0,r.width,r.height,0,0,r.width,r.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,r.framebuffer)}initGpuRenderTarget(t){let r=this._renderer.gl,s=new Sa,o=t.colorTexture;return It.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),r.bindFramebuffer(r.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(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?Et.ALL:Et.NONE);let o=this._renderer.gl;if(e&Et.COLOR){r??(r=s.defaultClearColor);let n=this._clearColorCache,a=r;(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 r=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,r),(t.stencil||t.depth)&&this._resizeStencil(r)}_initColor(t,e){let r=this._renderer,s=r.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 c=n.source;c.antialias&&(r.context.supports.msaa?e.msaa=!0:F("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(c,0);let h=r.texture.getGlSource(c).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,h,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,c)=>{let l=s.createRenderbuffer();e.msaaRenderBuffer[c]=l})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(r.width,r.height,r._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,c)=>{let l=a.source;s.texture.bindSource(l,0);let u=s.texture.getGlSource(l).internalFormat,d=e.msaaRenderBuffer[c];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,l.pixelWidth,l.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+c,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),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&&It.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&It.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}});var Po,Zb=p(()=>{w();su();qb();Po=class extends Ai{constructor(t){super(t),this.adaptor=new wa,this.adaptor.init(t,this)}};Po.extension={type:[x.WebGLSystem],name:"renderTarget"}});function Qb(i,t){let e=[],r=[`
|
|
970
970
|
var g = s.groups;
|
|
971
971
|
var sS = r.shader;
|
|
972
972
|
var p = s.glProgram;
|
|
@@ -974,7 +974,7 @@ fn mainFragment(
|
|
|
974
974
|
var resources;
|
|
975
975
|
`],s=!1,o=0,n=t._getProgramData(i.glProgram);for(let c in i.groups){let l=i.groups[c];e.push(`
|
|
976
976
|
resources = g[${c}].resources;
|
|
977
|
-
`);for(let h in l.resources){let u=l.resources[h];if(u instanceof
|
|
977
|
+
`);for(let h in l.resources){let u=l.resources[h];if(u instanceof st)if(u.ubo){let d=i._uniformBindMap[c][Number(h)];e.push(`
|
|
978
978
|
sS.bindUniformBlock(
|
|
979
979
|
resources[${h}],
|
|
980
980
|
'${d}',
|
|
@@ -982,7 +982,7 @@ fn mainFragment(
|
|
|
982
982
|
);
|
|
983
983
|
`)}else e.push(`
|
|
984
984
|
ugS.updateUniformGroup(resources[${h}], p, sD);
|
|
985
|
-
`);else if(u instanceof
|
|
985
|
+
`);else if(u instanceof er){let d=i._uniformBindMap[c][Number(h)];e.push(`
|
|
986
986
|
sS.bindUniformBlock(
|
|
987
987
|
resources[${h}],
|
|
988
988
|
'${d}',
|
|
@@ -993,10 +993,10 @@ fn mainFragment(
|
|
|
993
993
|
`)),t._gl.uniform1i(f.location,o),e.push(`
|
|
994
994
|
tS.bind(resources[${h}], ${o});
|
|
995
995
|
`),o++)}}}let a=[...r,...e].join(`
|
|
996
|
-
`);return new Function("r","s","sD",a)}var
|
|
996
|
+
`);return new Function("r","s","sD",a)}var Jb=p(()=>{pa();Ht();$t()});var Pa,tv=p(()=>{"use strict";Pa=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 pu(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}var ev=p(()=>{"use strict"});function mu(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Aa(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return mu(2*t);case"bvec3":return mu(3*t);case"bvec4":return mu(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var gu=p(()=>{"use strict"});function xu(i,t){if(!Ea){let e=Object.keys(rv);Ea={};for(let r=0;r<e.length;++r){let s=e[r];Ea[i[s]]=rv[s]}}return Ea[t]}function iv(i,t){let e=xu(i,t);return nw[e]||"float32"}var Ea,rv,nw,_u=p(()=>{"use strict";Ea=null,rv={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"},nw={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 sv(i,t,e=!1){let r={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(i,n);if(a.name.startsWith("gl_"))continue;let c=iv(t,a.type);r[a.name]={location:0,format:c,stride:Kt(c).stride,offset:0,instance:!1,start:0}}let o=Object.keys(r);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)r[o[n]].location=n,t.bindAttribLocation(i,n,o[n]);t.linkProgram(i)}else for(let n=0;n<o.length;n++)r[o[n]].location=t.getAttribLocation(i,o[n]);return r}var ov=p(()=>{Sr();_u()});function nv(i,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<r;s++){let o=t.getActiveUniformBlockName(i,s),n=t.getUniformBlockIndex(i,o),a=t.getActiveUniformBlockParameter(i,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var av=p(()=>{"use strict"});function cv(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),c=xu(t,o.type);e[n]={name:n,index:s,type:c,size:o.size,isArray:a,value:Aa(c,o.size)}}return e}var lv=p(()=>{gu();_u()});function hv(i,t){let e=i.getShaderSource(t).split(`
|
|
997
997
|
`).map((l,h)=>`${h}: ${l}`),r=i.getShaderInfoLog(t),s=r.split(`
|
|
998
998
|
`),o={},n=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!o[l]?(o[l]=!0,!0):!1),a=[""];n.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let c=e.join(`
|
|
999
|
-
`);a[0]=c,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function
|
|
999
|
+
`);a[0]=c,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function uv(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||hv(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||hv(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var dv=p(()=>{"use strict"});function fv(i,t){let e=pu(i,i.VERTEX_SHADER,t.vertex),r=pu(i,i.FRAGMENT_SHADER,t.fragment),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.transformFeedbackVaryings;o&&(typeof i.transformFeedbackVaryings!="function"?F("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||uv(i,s,e,r),t._attributeData=sv(s,i,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=cv(s,i),t._uniformBlockData=nv(s,i),i.deleteShader(e),i.deleteShader(r);let n={};for(let c in t._uniformData){let l=t._uniformData[c];n[c]={location:i.getUniformLocation(s,c),value:Aa(l.type,l.size)}}return new Pa(s,n)}var pv=p(()=>{it();tv();ev();gu();ov();av();lv();dv()});var Ca,Ao,mv=p(()=>{w();br();Jb();pv();Ca={textureCount:0,blockIndex:0},Ao=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=se()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Ca.textureCount=0,Ca.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),r(this._renderer,t,Ca)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Ca)}bindUniformBlock(t,e,r=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,c=s.updateBuffer(a),l=s.freeLocationForBufferBase(c);if(n){let{offset:u,size:d}=t;u===0&&d===a.data.byteLength?s.bindBufferBase(c,l):s.bindBufferRange(c,l,u)}else s.getLastBindBaseLocation(c)!==l&&s.bindBufferBase(c,l);let h=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[r]!==l&&(o.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(o.program,h,l))}_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]=fv(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 Qb(t,e)}resetState(){this._activeProgram=null}};Ao.extension={type:[x.WebGLSystem],name:"shader"}});var gv,xv,_v=p(()=>{"use strict";gv={f32:`if (cv !== v) {
|
|
1000
1000
|
cu.value = v;
|
|
1001
1001
|
gl.uniform1f(location, v);
|
|
1002
1002
|
}`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
@@ -1068,26 +1068,26 @@ fn mainFragment(
|
|
|
1068
1068
|
cv[2] = v[2];
|
|
1069
1069
|
cv[3] = v[3];
|
|
1070
1070
|
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
1071
|
-
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},
|
|
1071
|
+
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},xv={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"}});function yv(i,t){let e=[`
|
|
1072
1072
|
var v = null;
|
|
1073
1073
|
var cv = null;
|
|
1074
1074
|
var cu = null;
|
|
1075
1075
|
var t = 0;
|
|
1076
1076
|
var gl = renderer.gl;
|
|
1077
1077
|
var name = null;
|
|
1078
|
-
`];for(let r in i.uniforms){if(!t[r]){i.uniforms[r]instanceof
|
|
1078
|
+
`];for(let r in i.uniforms){if(!t[r]){i.uniforms[r]instanceof st?i.uniforms[r].ubo?e.push(`
|
|
1079
1079
|
renderer.shader.bindUniformBlock(uv.${r}, "${r}");
|
|
1080
1080
|
`):e.push(`
|
|
1081
1081
|
renderer.shader.updateUniformGroup(uv.${r});
|
|
1082
|
-
`):i.uniforms[r]instanceof
|
|
1082
|
+
`):i.uniforms[r]instanceof er&&e.push(`
|
|
1083
1083
|
renderer.shader.bindBufferResource(uv.${r}, "${r}");
|
|
1084
|
-
`);continue}let s=i.uniformStructures[r],o=!1;for(let n=0;n<
|
|
1084
|
+
`);continue}let s=i.uniformStructures[r],o=!1;for(let n=0;n<He.length;n++){let a=He[n];if(s.type===a.type&&a.test(s)){e.push(`name = "${r}";`,He[n].uniform),o=!0;break}}if(!o){let a=(s.size===1?gv:xv)[s.type].replace("location",`ud["${r}"].location`);e.push(`
|
|
1085
1085
|
cu = ud["${r}"];
|
|
1086
1086
|
cv = cu.value;
|
|
1087
1087
|
v = uv["${r}"];
|
|
1088
1088
|
${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
1089
|
-
`))}var h0=m(()=>{Ga();Vt();Uu();c0()});var zo,u0=m(()=>{E();h0();zo=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){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,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=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)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return l0(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];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}};zo.extension={type:[x.WebGLSystem],name:"uniformGroup"}});function d0(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof D.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var f0=m(()=>{ct()});var yP,bP,vP,TP,SP,wP,p0,m0,g0=m(()=>{E();ye();f0();yP=0,bP=1,vP=2,TP=3,SP=4,wP=5,p0=class id{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[yP]=this.setBlend,this.map[bP]=this.setOffset,this.map[vP]=this.setCullFace,this.map[TP]=this.setDepthTest,this.map[SP]=this.setFrontFace,this.map[wP]=this.setDepthMask,this.checks=[],this.defaultState=_t.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=d0(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(id._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(id._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};p0.extension={type:[x.WebGLSystem],name:"state"};m0=p0});var Ya,x0=m(()=>{Yu();Ya=class{constructor(t){this.target=$u.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=Z.UNSIGNED_BYTE,this.internalFormat=Ha.RGBA,this.format=Ha.RGBA,this.samplerType=0}}});var _0,y0=m(()=>{"use strict";_0={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var PP,b0,v0=m(()=>{"use strict";PP={"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},b0={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!PP[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Ka,sd=m(()=>{"use strict";Ka={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,c=i.resourceWidth,l=i.resourceHeight;c<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,c,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var T0,S0=m(()=>{sd();T0={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Ka.upload(i,t,e,r)}}});var od,w0,qa,P0,E0=m(()=>{"use strict";od={linear:9729,nearest:9728},w0={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},qa={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},P0={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function nd(i,t,e,r,s,o,n,a){let c=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=qa[n?"clamp-to-edge":i.addressModeU],h=qa[n?"clamp-to-edge":i.addressModeV],u=qa[n?"clamp-to-edge":i.addressModeW];t[s](c,t.TEXTURE_WRAP_S,l),t[s](c,t.TEXTURE_WRAP_T,h),t.TEXTURE_WRAP_R&&t[s](c,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](c,t.TEXTURE_MAG_FILTER,od[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=w0[i.minFilter][i.mipmapFilter];t[s](c,t.TEXTURE_MIN_FILTER,l)}}else t[s](c,t.TEXTURE_MIN_FILTER,od[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](c,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](c,t.TEXTURE_COMPARE_FUNC,P0[i.compare])}var A0=m(()=>{E0()});function C0(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var M0=m(()=>{"use strict"});function B0(i,t){let e={},r=i.RGBA;return i instanceof D.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.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 R0=m(()=>{ct()});function I0(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var G0=m(()=>{"use strict"});var EP,Vo,k0=m(()=>{ct();E();et();x0();y0();v0();sd();S0();A0();M0();R0();G0();EP=4,Vo=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:Ka,buffer:_0,video:T0,compressed:b0},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=B0(t,this._renderer.context.extensions),this._mapFormatToType=I0(t),this._mapFormatToFormat=C0(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 r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=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);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new Ya(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,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),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,nd(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.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,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.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,r,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 r=this.getGlSource(t);this._gl.generateMipmap(r.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,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,nd(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!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:r,height:s}=this.getPixels(t),o=D.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(EP*s*o),a=this._renderer,c=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(c),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,h.RGBA,h.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)}};Vo.extension={type:[x.WebGLSystem],name:"texture"}});var O0={};Ud(O0,{WebGLRenderer:()=>ad});var AP,CP,MP,F0,U0,D0,ad,L0=m(()=>{E();pv();mv();gv();Ks();Gu();Be();yv();Tv();Ev();Mv();Bv();Rv();Iv();Ov();Hv();o0();u0();g0();k0();AP=[...Ba,No,Cv,vv,Fo,Vo,Ho,Uo,zo,Wo,Oo,m0,Lo,Do],CP=[...Ra],MP=[Go,Io,Ro],F0=[],U0=[],D0=[];G.handleByNamedList(x.WebGLSystem,F0);G.handleByNamedList(x.WebGLPipes,U0);G.handleByNamedList(x.WebGLPipesAdaptor,D0);G.add(...AP,...CP,...MP);ad=class extends cr{constructor(){let t={name:"webgl",type:bt.WEBGL,systems:F0,renderPipes:U0,renderPipeAdaptors:D0};super(t)}}});E();var gy={extension:{type:x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(my(),Kw))}};E();var _y={extension:{type:x.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(xy(),qw))}};E();E();Rn();wn();E();ct();Ks();var wa;function Ey(i){return wa!==void 0||(wa=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??cr.defaultOptions.failIfMajorPerformanceCaveat};try{if(!D.get().getWebGLRenderingContext())return!1;let r=D.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),wa}ct();var Pa;async function Ay(i={}){return Pa!==void 0||(Pa=await(async()=>{let t=D.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Pa}Ks();var N0=["webgl","webgpu","canvas"];async function H0(i){let t=[];i.preference?(t.push(i.preference),N0.forEach(o=>{o!==i.preference&&t.push(o)})):t=N0.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await Ay()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(fv(),dv));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&Ey(i.failIfMajorPerformanceCaveat??cr.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(L0(),O0));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}ge();bu();ft();var W0=class cd{constructor(...t){this.stage=new at,t[0]!==void 0&&U(H,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await H0(t),cd._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return U(H,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=cd._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};W0._plugins=[];var Za=W0;G.handleByList(x.Application,Za._plugins);G.add(oo);E();ze();bl();ct();E();Pr();vt();et();qh();eu();var Xo=class extends wi{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:c}=r[n.page],l=new z(n.x+a.x,n.y+a.y,n.width,n.height),h=new M({source:c,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:h}}),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<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Hs.install(t)}static uninstall(t){Hs.uninstall(t)}};var Qa={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let g in f){let _=f[g].split("="),b=_[0],y=_[1].replace(/"/gm,""),v=parseFloat(y),S=isNaN(v)?y:v;p[b]=S}e[d].push(p)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let c={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),c[f]=p,r.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let h=e.kerning||[];for(let u=0;u<h.length;u++){let d=parseInt(h[u].first,10),f=parseInt(h[u].second,10),p=parseInt(h[u].amount,10);r.chars[c[f]].kerning[c[d]]=p}return r}};ct();var ld={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let c={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let h=n[l],u=parseInt(h.getAttribute("id"),10),d=h.getAttribute("letter")??h.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),c[u]=d,t.chars[d]={id:u,page:parseInt(h.getAttribute("page"),10)||0,x:parseInt(h.getAttribute("x"),10),y:parseInt(h.getAttribute("y"),10),width:parseInt(h.getAttribute("width"),10),height:parseInt(h.getAttribute("height"),10),xOffset:parseInt(h.getAttribute("xoffset"),10),yOffset:parseInt(h.getAttribute("yoffset"),10),xAdvance:parseInt(h.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let h=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[c[u]].kerning[c[h]]=d}return t}};var hd={test(i){return typeof i=="string"&&i.includes("<font>")?ld.test(D.get().parseXML(i)):!1},parse(i){return ld.parse(D.get().parseXML(i))}};var BP=[".xml",".fnt"],z0={extension:{type:x.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof Xo,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},V0={extension:{type:x.LoadParser,priority:Et.Normal},name:"loadBitmapFont",test(i){return BP.includes(Tt.extname(i).toLowerCase())},async testParse(i){return Qa.test(i)||hd.test(i)},async parse(i,t,e){let r=Qa.test(i)?Qa.parse(i):hd.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=Tt.join(Tt.dirname(s),d);f=ms(f,s),n.push({src:f,data:a})}let c=await e.load(n),l=n.map(u=>c[u.src]);return new Xo({data:r,textures:l},s)},async load(i,t){return await(await D.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};st();var Ja=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 r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};tr();E();et();var X0={extension:{type:x.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof M),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};E();async function tc(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var j0={extension:{type:x.DetectionParser,priority:1},test:async()=>tc("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};E();var $0=["png","jpg","jpeg"],Y0={extension:{type:x.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...$0],remove:async i=>i.filter(t=>!$0.includes(t))};E();var RP="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Oi(i){return RP?!1:document.createElement("video").canPlayType(i)!==""}var K0={extension:{type:x.DetectionParser,priority:0},test:async()=>Oi("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};E();var q0={extension:{type:x.DetectionParser,priority:0},test:async()=>Oi("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};E();var Z0={extension:{type:x.DetectionParser,priority:0},test:async()=>Oi("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};E();var Q0={extension:{type:x.DetectionParser,priority:0},test:async()=>tc("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};st();Pr();ps();Sn();var ec=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||k(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return k(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=Er(t),n=Wt(t,l=>({alias:[l],src:l,data:{}})),a=n.length,c=n.map(async l=>{let h=Tt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[h]||(this.promiseCache[h]=this._getLoadPromiseAndParser(h,l)),s[l.src]=await this.promiseCache[h].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[h],delete s[l.src],new Error(`[Loader.load] Failed to load ${h}.
|
|
1090
|
-
${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=
|
|
1089
|
+
`))}var bv=p(()=>{pa();Ht();Qh();_v()});var Eo,vv=p(()=>{w();bv();Eo=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){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,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=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)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return yv(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];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}};Eo.extension={type:[x.WebGLSystem],name:"uniformGroup"}});function Tv(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof O.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var Sv=p(()=>{ct()});var aw,cw,lw,hw,uw,dw,wv,Pv,Av=p(()=>{w();me();Sv();aw=0,cw=1,lw=2,hw=3,uw=4,dw=5,wv=class yu{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[aw]=this.setBlend,this.map[cw]=this.setOffset,this.map[lw]=this.setCullFace,this.map[hw]=this.setDepthTest,this.map[uw]=this.setFrontFace,this.map[dw]=this.setDepthMask,this.checks=[],this.defaultState=xt.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=Tv(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(yu._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(yu._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};wv.extension={type:[x.WebGLSystem],name:"state"};Pv=wv});var Ma,Ev=p(()=>{hu();Ma=class{constructor(t){this.target=lu.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=Q.UNSIGNED_BYTE,this.internalFormat=Ta.RGBA,this.format=Ta.RGBA,this.samplerType=0}}});var Cv,Mv=p(()=>{"use strict";Cv={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var fw,Bv,Rv=p(()=>{"use strict";fw={"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},Bv={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!fw[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Ba,bu=p(()=>{"use strict";Ba={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,c=i.resourceWidth,l=i.resourceHeight;c<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,c,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var Gv,kv=p(()=>{bu();Gv={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Ba.upload(i,t,e,r)}}});var vu,Iv,Ra,Fv,Uv=p(()=>{"use strict";vu={linear:9729,nearest:9728},Iv={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Ra={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Fv={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Tu(i,t,e,r,s,o,n,a){let c=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=Ra[n?"clamp-to-edge":i.addressModeU],h=Ra[n?"clamp-to-edge":i.addressModeV],u=Ra[n?"clamp-to-edge":i.addressModeW];t[s](c,t.TEXTURE_WRAP_S,l),t[s](c,t.TEXTURE_WRAP_T,h),t.TEXTURE_WRAP_R&&t[s](c,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](c,t.TEXTURE_MAG_FILTER,vu[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=Iv[i.minFilter][i.mipmapFilter];t[s](c,t.TEXTURE_MIN_FILTER,l)}}else t[s](c,t.TEXTURE_MIN_FILTER,vu[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](c,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](c,t.TEXTURE_COMPARE_FUNC,Fv[i.compare])}var Dv=p(()=>{Uv()});function Ov(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var Lv=p(()=>{"use strict"});function Nv(i,t){let e={},r=i.RGBA;return i instanceof O.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.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 Hv=p(()=>{ct()});function Wv(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var zv=p(()=>{"use strict"});var pw,Co,Vv=p(()=>{ct();w();et();Ev();Mv();Rv();bu();kv();Dv();Lv();Hv();zv();pw=4,Co=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:Ba,buffer:Cv,video:Gv,compressed:Bv},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=Nv(t,this._renderer.context.extensions),this._mapFormatToType=Wv(t),this._mapFormatToFormat=Ov(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(C.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=C.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new Ma(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,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),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Tu(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.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,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.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,r,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 r=this.getGlSource(t);this._gl.generateMipmap(r.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,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Tu(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!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:r,height:s}=this.getPixels(t),o=O.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(pw*s*o),a=this._renderer,c=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(c),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,h.RGBA,h.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(C.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Co.extension={type:[x.WebGLSystem],name:"texture"}});var jv={};$u(jv,{WebGLRenderer:()=>Su});var mw,gw,xw,Xv,$v,Yv,Su,Kv=p(()=>{w();wb();Pb();Ab();ks();Kh();Pe();Mb();Gb();Ub();Lb();Nb();Hb();Wb();jb();Zb();mv();vv();Av();Vv();mw=[...ua,wo,Ob,Rb,yo,Co,Po,bo,Eo,Ao,To,Pv,So,vo],gw=[...da],xw=[xo,go,mo],Xv=[],$v=[],Yv=[];k.handleByNamedList(x.WebGLSystem,Xv);k.handleByNamedList(x.WebGLPipes,$v);k.handleByNamedList(x.WebGLPipesAdaptor,Yv);k.add(...mw,...gw,...xw);Su=class extends tr{constructor(){let t={name:"webgl",type:yt.WEBGL,systems:Xv,renderPipes:$v,renderPipeAdaptors:Yv};super(t)}}});w();var A_={extension:{type:x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(P_(),DS))}};w();var C_={extension:{type:x.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(E_(),OS))}};w();w();dn();on();w();ct();ks();var oa;function U_(i){return oa!==void 0||(oa=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??tr.defaultOptions.failIfMajorPerformanceCaveat};try{if(!O.get().getWebGLRenderingContext())return!1;let r=O.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),oa}ct();var na;async function D_(i={}){return na!==void 0||(na=await(async()=>{let t=O.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),na}ks();var qv=["webgl","webgpu","canvas"];async function Zv(i){let t=[];i.preference?(t.push(i.preference),qv.forEach(o=>{o!==i.preference&&t.push(o)})):t=qv.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await D_()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(Sb(),Tb));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&U_(i.failIfMajorPerformanceCaveat??tr.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(Kv(),jv));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}de();Uh();dt();var Qv=class wu{constructor(...t){this.stage=new at,t[0]!==void 0&&D(W,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await Zv(t),wu._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return D(W,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=wu._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Qv._plugins=[];var Ga=Qv;k.handleByList(x.Application,Ga._plugins);k.add(zs);w();Fe();Uc();ct();w();_r();bt();et();dh();xh();var Mo=class extends fi{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:c}=r[n.page],l=new V(n.x+a.x,n.y+a.y,n.width,n.height),h=new C({source:c,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:h}}),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<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Ps.install(t)}static uninstall(t){Ps.uninstall(t)}};var ka={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),m={};for(let _ in f){let g=f[_].split("="),b=g[0],y=g[1].replace(/"/gm,""),v=parseFloat(y),T=isNaN(v)?y:v;m[b]=T}e[d].push(m)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let c={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),m=d.letter??d.char??String.fromCharCode(f);m==="space"&&(m=" "),c[f]=m,r.chars[m]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let h=e.kerning||[];for(let u=0;u<h.length;u++){let d=parseInt(h[u].first,10),f=parseInt(h[u].second,10),m=parseInt(h[u].amount,10);r.chars[c[f]].kerning[c[d]]=m}return r}};ct();var Pu={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let c={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let h=n[l],u=parseInt(h.getAttribute("id"),10),d=h.getAttribute("letter")??h.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),c[u]=d,t.chars[d]={id:u,page:parseInt(h.getAttribute("page"),10)||0,x:parseInt(h.getAttribute("x"),10),y:parseInt(h.getAttribute("y"),10),width:parseInt(h.getAttribute("width"),10),height:parseInt(h.getAttribute("height"),10),xOffset:parseInt(h.getAttribute("xoffset"),10),yOffset:parseInt(h.getAttribute("yoffset"),10),xAdvance:parseInt(h.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let h=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[c[u]].kerning[c[h]]=d}return t}};var Au={test(i){return typeof i=="string"&&i.includes("<font>")?Pu.test(O.get().parseXML(i)):!1},parse(i){return Pu.parse(O.get().parseXML(i))}};var _w=[".xml",".fnt"],Jv={extension:{type:x.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof Mo,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},t0={extension:{type:x.LoadParser,priority:wt.Normal},name:"loadBitmapFont",test(i){return _w.includes(vt.extname(i).toLowerCase())},async testParse(i){return ka.test(i)||Au.test(i)},async parse(i,t,e){let r=ka.test(i)?ka.parse(i):Au.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=vt.join(vt.dirname(s),d);f=Ji(f,s),n.push({src:f,data:a})}let c=await e.load(n),l=n.map(u=>c[u.src]);return new Mo({data:r,textures:l},s)},async load(i,t){return await(await O.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};it();var Ia=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 r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};$e();w();et();var e0={extension:{type:x.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof C),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};w();async function Fa(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var r0={extension:{type:x.DetectionParser,priority:1},test:async()=>Fa("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};w();var i0=["png","jpg","jpeg"],s0={extension:{type:x.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...i0],remove:async i=>i.filter(t=>!i0.includes(t))};w();var yw="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Ei(i){return yw?!1:document.createElement("video").canPlayType(i)!==""}var o0={extension:{type:x.DetectionParser,priority:0},test:async()=>Ei("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};w();var n0={extension:{type:x.DetectionParser,priority:0},test:async()=>Ei("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};w();var a0={extension:{type:x.DetectionParser,priority:0},test:async()=>Ei("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};w();var c0={extension:{type:x.DetectionParser,priority:0},test:async()=>Fa("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};it();_r();Qi();sn();var Ua=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||F(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return F(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=yr(t),n=Lt(t,l=>({alias:[l],src:l,data:{}})),a=n.length,c=n.map(async l=>{let h=vt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[h]||(this.promiseCache[h]=this._getLoadPromiseAndParser(h,l)),s[l.src]=await this.promiseCache[h].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[h],delete s[l.src],new Error(`[Loader.load] Failed to load ${h}.
|
|
1090
|
+
${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Lt(t,s=>({alias:[s],src:s})).map(async s=>{let o=vt.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(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&F(`[Assets] loadParser name conflict "${e.name}"`):F("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};ct();w();function ce(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}_r();function le(i,t){let e=i.split("?")[0],r=vt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}Fe();var bw=".json",vw="application/json",l0={extension:{type:x.LoadParser,priority:wt.Low},name:"loadJson",test(i){return ce(i,vw)||le(i,bw)},async load(i){return await(await O.get().fetch(i)).json()}};ct();w();Fe();var Tw=".txt",Sw="text/plain",h0={name:"loadTxt",extension:{type:x.LoadParser,priority:wt.Low,name:"loadTxt"},test(i){return ce(i,Sw)||le(i,Tw)},async load(i){return await(await O.get().fetch(i)).text()}};ct();w();it();_r();$e();Fe();var ww=["normal","bold","100","200","300","400","500","600","700","800","900"],Pw=[".ttf",".otf",".woff",".woff2"],Aw=["font/ttf","font/otf","font/woff","font/woff2"],Ew=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Cw(i){let t=vt.extname(i),s=vt.basename(i,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(Ew)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var Mw=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Bw(i){return Mw.test(i)?i:encodeURI(i)}var u0={extension:{type:x.LoadParser,priority:wt.Low},name:"loadWebFont",test(i){return ce(i,Aw)||le(i,Pw)},async load(i,t){let e=O.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??Cw(i),o=t.data?.weights?.filter(a=>ww.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let c=o[a],l=new FontFace(s,`url(${Bw(i)})`,{...n,weight:c});await l.load(),e.add(l),r.push(l)}return J.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return F("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{J.remove(`${t.family}-and-url`),O.get().getFontFaceSet().delete(t)})}};ct();w();zr();Vn();Hr();function Ci(i,t=1){let e=te.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}Fe();et();it();$e();function Mi(i,t,e){i.label=e,i._sourceOrigin=e;let r=new C({source:i,label:e}),s=()=>{delete t.promiseCache[e],J.has(e)&&J.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(F("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),r.once("destroy",()=>{i.destroyed||(F("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var Rw=".svg",Gw="image/svg+xml",d0={extension:{type:x.LoadParser,priority:wt.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return ce(i,Gw)||le(i,Rw)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?Iw(i):kw(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function kw(i,t,e,r){let o=await(await O.get().fetch(i)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=r,await a.decode(),URL.revokeObjectURL(n);let c=document.createElement("canvas"),l=c.getContext("2d"),h=t.data?.resolution||Ci(i),u=t.data?.width??a.width,d=t.data?.height??a.height;c.width=u*h,c.height=d*h,l.drawImage(a,0,0,u*h,d*h);let{parseAsGraphicsContext:f,...m}=t.data??{},_=new jt({resource:c,alphaMode:"premultiply-alpha-on-upload",resolution:h,...m});return Mi(_,e,i)}async function Iw(i){let e=await(await O.get().fetch(i)).text(),r=new Wt;return r.svg(e),r}ct();w();zr();var Fw=`(function () {
|
|
1091
1091
|
'use strict';
|
|
1092
1092
|
|
|
1093
1093
|
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
|
|
@@ -1108,7 +1108,7 @@ ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Wt(t
|
|
|
1108
1108
|
});
|
|
1109
1109
|
|
|
1110
1110
|
})();
|
|
1111
|
-
`,
|
|
1111
|
+
`,Bi=null,Ri=class{constructor(){Bi||(Bi=URL.createObjectURL(new Blob([Fw],{type:"application/javascript"}))),this.worker=new Worker(Bi)}};Ri.revokeObjectURL=function(){Bi&&(URL.revokeObjectURL(Bi),Bi=null)};var Uw=`(function () {
|
|
1112
1112
|
'use strict';
|
|
1113
1113
|
|
|
1114
1114
|
async function loadImageBitmap(url, alphaMode) {
|
|
@@ -1137,6 +1137,4 @@ ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Wt(t
|
|
|
1137
1137
|
};
|
|
1138
1138
|
|
|
1139
1139
|
})();
|
|
1140
|
-
`,zi=null,jo=class{constructor(){zi||(zi=URL.createObjectURL(new Blob([YP],{type:"application/javascript"}))),this.worker=new Worker(zi)}};jo.revokeObjectURL=function(){zi&&(URL.revokeObjectURL(zi),zi=null)};var iT=0,ud,dd=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 Wi;e.addEventListener("message",r=>{e.terminate(),Wi.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){ud===void 0&&(ud=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<ud&&(this._createdWorkers++,t=new jo().worker,t.addEventListener("message",e=>{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 r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[iT]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:iT++,id:r})}},fd=new dd;ze();var KP=[".jpeg",".jpg",".png",".webp",".avif"],qP=["image/jpeg","image/png","image/webp","image/avif"];async function ZP(i,t){let e=await D.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var rc={name:"loadTextures",extension:{type:x.LoadParser,priority:Et.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return de(i,qP)||fe(i,KP)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await fd.isImageBitmapSupported()?r=await fd.loadImageBitmap(i,t):r=await ZP(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new Zt({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Li(i),...t.data});return Ni(s,e,i)},unload(i){i.destroy(!0)}};E();Al();El();var sT=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],QP=sT.map(i=>`video/${i.substring(1)}`);function JP(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=eE(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function tE(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function eE(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var oT={name:"loadVideo",extension:{type:x.LoadParser,name:"loadVideo"},test(i){let t=de(i,QP),e=fe(i,sT);return t||e},async load(i,t,e){let r={...ei.defaultOptions,resolution:t.data?.resolution||Li(i),alphaMode:t.data?.alphaMode||await Mn(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(c=>{let l=o[c];l!==void 0&&s.setAttribute(c,l)}),r.muted===!0&&(s.muted=!0),JP(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let c=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=ei.MIME_TYPES[c]||`video/${c}`}return n.src=i,a&&(n.type=a),new Promise(c=>{let l=async()=>{let h=new ei({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await tE(s),c(Ni(h,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};E();Qr();E();Qr();var ic={extension:{type:x.ResolveParser,name:"resolveTexture"},test:rc.test,parse:i=>({resolution:parseFloat(se.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var nT={extension:{type:x.ResolveParser,priority:-2,name:"resolveJson"},test:i=>se.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:ic.parse};Qr();ps();Sn();var sc=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new se,this.loader=new ec,this.cache=Q,this._backgroundLoader=new Ja(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){k("[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,r=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:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=Er(t),s=Wt(t).map(a=>{if(typeof a!="string"){let c=this.resolver.getAlias(a);return c.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(c)?c[0]:c}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,c=0,l=()=>{e?.(++a/c)},h=n.map(u=>{let d=s[u];return c+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(h),r?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(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Q.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=Q.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],c=[n.src];n.alias&&c.push(...n.alias),c.forEach(l=>{o[l]=a}),Q.set(c,a)}),o}async unload(t){this._initialized||await this.init();let e=Wt(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Wt(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{Q.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},ve=new sc;G.handleByList(x.LoadParser,ve.loader.parsers).handleByList(x.ResolveParser,ve.resolver.parsers).handleByList(x.CacheParser,ve.cache.parsers).handleByList(x.DetectionParser,ve.detections);G.add(X0,Y0,j0,Q0,K0,q0,Z0,J0,tT,eT,rT,rc,oT,V0,z0,ic,nT);var aT={loader:x.LoadParser,resolver:x.ResolveParser,cache:x.CacheParser,detection:x.DetectionParser};G.handle(x.Asset,i=>{let t=i.ref;Object.entries(aT).filter(([e])=>!!t[e]).forEach(([e,r])=>G.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(aT).filter(e=>!!t[e]).forEach(e=>G.remove(t[e]))});rn();ft();Tn();var oc=class extends Je{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:c,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Gt({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),c!==void 0&&(this.height=c)}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,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}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 cT(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(U(H,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Ls();Fr();var ur=class extends oc{constructor(...t){let e=cT(t,"Text");super(e,St),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=Ct.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ze();vt();et();Bl();ge();$h();En();Ls();Fr();Dt();var rE=Jo(sh(),1);G.add(gy,_y);var Bt={Add:"add",Remove:"remove",Update:"update"},nc=class{init(t){throw new Error("Method not implemented.")}render(t){throw new Error("Method not implemented.")}},dr=class{rendererName;rendererType;add=(t,e)=>{throw new Error("Method not implemented.")};remove=(t,e)=>{throw new Error("Method not implemented.")};update=(t,e)=>{throw new Error("Method not implemented.")}};var ac=(i=[],t=[])=>{let e=[],r=[],s=[],o=i.filter(a=>!a.hidden),n=t.filter(a=>!a.hidden);for(let a of o){let c=n.find(l=>l.id===a.id&&l.type===a.type);c?r.push({prev:a,next:c}):e.push(a)}for(let a of n)o.find(l=>l.id===a.id&&l.type===a.type)||s.push(a);for(let a of i){let c=t.find(l=>l.id===a.id&&l.type===a.type);c&&c.hidden&&!a.hidden&&e.push(a)}return{toDeleteElements:e,toUpdateElements:r,toAddElements:s}};var Or=new(window.AudioContext||window.webkitAudioContext),Vi=class i{static loadedAssets={};static load=async(t,e)=>{if(!i.loadedAssets[t]&&e.byteLength!==0)try{let r=await Or.decodeAudioData(e);i.loadedAssets[t]=r}catch(r){console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}};static getAsset=t=>i.loadedAssets[t]},pd=class{_audioSource;_gainNode;volume=1;id;url;loop=!1;constructor(t,e){this.id=t,this.url=e.url,this.loop=e.loop||!1,this.volume=e.volume??1,this._gainNode=Or.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Or.destination)}play=()=>{let t=Vi.getAsset(this.url);if(!t){console.warn("AudioPlayer.play: Asset not found",this.url);return}this._audioSource=Or.createBufferSource(),this._audioSource.buffer=t,this._audioSource.loop=this.loop,this._gainNode.gain.setValueAtTime(this.volume,Or.currentTime),this._audioSource.connect(this._gainNode),this._audioSource.start(0)};stop=()=>{this._audioSource&&(this._audioSource.stop(),this._audioSource.disconnect(),this._gainNode.disconnect(),this._gainNode=Or.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Or.destination))}},cc=class{audioPlayers=[];stageAudios=[];add=t=>{this.stageAudios.push(t)};remove=t=>{this.stageAudios=this.stageAudios.filter(e=>e.id!==t)};getById=t=>this.stageAudios.find(e=>e.id===t);tick=()=>{for(let e of this.stageAudios){let r=this.audioPlayers.find(s=>s.id===e.id);if(!r){let s=new pd(e.id,{url:e.url,loop:e.loop,volume:e.volume??1});this.audioPlayers.push(s),s.play();return}(r.url!==e.url||r.loop!==e.loop)&&(r.stop(),r.url=e.url,r.loop=e.loop??!1,r.play()),r.volume!==(e.volume??1)&&(r.volume=e.volume??1,r._gainNode.gain.value=r.volume)}let t=[];for(let e of this.audioPlayers)this.stageAudios.find(r=>r.id===e.id)||(e.stop(),t.push(e.id));this.audioPlayers=this.audioPlayers.filter(e=>!t.includes(e.id))};destroy=()=>{for(let t of this.audioPlayers)t.stop();this.audioPlayers=[],this.stageAudios=[]}};var md=function(i,t){return md=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},md(i,t)};function $o(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");md(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function lT(i,t,e,r){function s(o){return o instanceof e?o:new e(function(n){n(o)})}return new(e||(e=Promise))(function(o,n){function a(h){try{l(r.next(h))}catch(u){n(u)}}function c(h){try{l(r.throw(h))}catch(u){n(u)}}function l(h){h.done?o(h.value):s(h.value).then(a,c)}l((r=r.apply(i,t||[])).next())})}function lc(i,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,s,o,n=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return n.next=a(0),n.throw=a(1),n.return=a(2),typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function a(l){return function(h){return c([l,h])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n&&(n=0,l[0]&&(e=0)),e;)try{if(r=1,s&&(o=l[0]&2?s.return:l[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,l[1])).done)return o;switch(s=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,s=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){e.label=l[1];break}if(l[0]===6&&e.label<o[1]){e.label=o[1],o=l;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(l);break}o[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(i,e)}catch(h){l=[6,h],s=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Lr(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],r=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Xi(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var r=e.call(i),s,o=[],n;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){n={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(n)throw n.error}}return o}function ji(i,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return i.concat(o||Array.prototype.slice.call(t))}function Nr(i){return this instanceof Nr?(this.v=i,this):new Nr(i)}function hT(i,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(i,t||[]),s,o=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",n),s[Symbol.asyncIterator]=function(){return this},s;function n(f){return function(p){return Promise.resolve(p).then(f,u)}}function a(f,p){r[f]&&(s[f]=function(g){return new Promise(function(_,b){o.push([f,g,_,b])>1||c(f,g)})},p&&(s[f]=p(s[f])))}function c(f,p){try{l(r[f](p))}catch(g){d(o[0][3],g)}}function l(f){f.value instanceof Nr?Promise.resolve(f.value.v).then(h,u):d(o[0][2],f)}function h(f){c("next",f)}function u(f){c("throw",f)}function d(f,p){f(p),o.shift(),o.length&&c(o[0][0],o[0][1])}}function uT(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],e;return t?t.call(i):(i=typeof Lr=="function"?Lr(i):i[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(o){e[o]=i[o]&&function(n){return new Promise(function(a,c){n=i[o](n),s(a,c,n.done,n.value)})}}function s(o,n,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},n)}}function rt(i){return typeof i=="function"}function dT(i){var t=function(r){Error.call(r),r.stack=new Error().stack},e=i(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var hc=dT(function(i){return function(e){i(this),this.message=e?e.length+` errors occurred during unsubscription:
|
|
1141
|
-
`+e.map(function(r,s){return s+1+") "+r.toString()}).join(`
|
|
1142
|
-
`):"",this.name="UnsubscriptionError",this.errors=e}});function gd(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var uc=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,r,s,o;if(!this.closed){this.closed=!0;var n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=Lr(n),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(g){t={error:g}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else n.remove(this);var h=this.initialTeardown;if(rt(h))try{h()}catch(g){o=g instanceof hc?g.errors:[g]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var d=Lr(u),f=d.next();!f.done;f=d.next()){var p=f.value;try{fT(p)}catch(g){o=o??[],g instanceof hc?o=ji(ji([],Xi(o)),Xi(g.errors)):o.push(g)}}}catch(g){r={error:g}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}if(o)throw new hc(o)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)fT(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&gd(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&gd(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}();var $Y=uc.EMPTY;function dc(i){return i instanceof uc||i&&"closed"in i&&rt(i.remove)&&rt(i.add)&&rt(i.unsubscribe)}function fT(i){rt(i)?i():i.unsubscribe()}var Te={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var $i={setTimeout:function(i,t){for(var e=[],r=2;r<arguments.length;r++)e[r-2]=arguments[r];var s=$i.delegate;return s?.setTimeout?s.setTimeout.apply(s,ji([i,t],Xi(e))):setTimeout.apply(void 0,ji([i,t],Xi(e)))},clearTimeout:function(i){var t=$i.delegate;return(t?.clearTimeout||clearTimeout)(i)},delegate:void 0};function fc(i){$i.setTimeout(function(){var t=Te.onUnhandledError;if(t)t(i);else throw i})}function xd(){}var pT=function(){return _d("C",void 0,void 0)}();function mT(i){return _d("E",void 0,i)}function gT(i){return _d("N",i,void 0)}function _d(i,t,e){return{kind:i,value:t,error:e}}var Hr=null;function xT(i){if(Te.useDeprecatedSynchronousErrorHandling){var t=!Hr;if(t&&(Hr={errorThrown:!1,error:null}),i(),t){var e=Hr,r=e.errorThrown,s=e.error;if(Hr=null,r)throw s}}else i()}function _T(i){Te.useDeprecatedSynchronousErrorHandling&&Hr&&(Hr.errorThrown=!0,Hr.error=i)}var Yo=function(i){$o(t,i);function t(e){var r=i.call(this)||this;return r.isStopped=!1,e?(r.destination=e,dc(e)&&e.add(r)):r.destination=nE,r}return t.create=function(e,r,s){return new mc(e,r,s)},t.prototype.next=function(e){this.isStopped?bd(gT(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?bd(mT(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?bd(pT,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(uc);var iE=Function.prototype.bind;function yd(i,t){return iE.call(i,t)}var sE=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(r){pc(r)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(r){pc(r)}else pc(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){pc(e)}},i}(),mc=function(i){$o(t,i);function t(e,r,s){var o=i.call(this)||this,n;if(rt(e)||!e)n={next:e??void 0,error:r??void 0,complete:s??void 0};else{var a;o&&Te.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return o.unsubscribe()},n={next:e.next&&yd(e.next,a),error:e.error&&yd(e.error,a),complete:e.complete&&yd(e.complete,a)}):n=e}return o.destination=new sE(n),o}return t}(Yo);function pc(i){Te.useDeprecatedSynchronousErrorHandling?_T(i):fc(i)}function oE(i){throw i}function bd(i,t){var e=Te.onStoppedNotification;e&&$i.setTimeout(function(){return e(i,t)})}var nE={closed:!0,next:xd,error:oE,complete:xd};var Yi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function yT(i){return i}function bT(i){return i.length===0?yT:i.length===1?i[0]:function(e){return i.reduce(function(r,s){return s(r)},e)}}var J=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,r){var s=this,o=cE(t)?t:new mc(t,e,r);return xT(function(){var n=s,a=n.operator,c=n.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var r=this;return e=vT(e),new e(function(s,o){var n=new mc({next:function(a){try{t(a)}catch(c){o(c),n.unsubscribe()}},error:o,complete:s});r.subscribe(n)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Yi]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return bT(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=vT(t),new t(function(r,s){var o;e.subscribe(function(n){return o=n},function(n){return s(n)},function(){return r(o)})})},i.create=function(t){return new i(t)},i}();function vT(i){var t;return(t=i??Te.Promise)!==null&&t!==void 0?t:Promise}function aE(i){return i&&rt(i.next)&&rt(i.error)&&rt(i.complete)}function cE(i){return i&&i instanceof Yo||aE(i)&&dc(i)}function lE(i){return rt(i?.lift)}function Fe(i){return function(t){if(lE(t))return t.lift(function(e){try{return i(e,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Wr(i,t,e,r,s){return new hE(i,t,e,r,s)}var hE=function(i){$o(t,i);function t(e,r,s,o,n,a){var c=i.call(this,e)||this;return c.onFinalize=n,c.shouldUnsubscribe=a,c._next=r?function(l){try{r(l)}catch(h){e.error(h)}}:i.prototype._next,c._error=o?function(l){try{o(l)}catch(h){e.error(h)}finally{this.unsubscribe()}}:i.prototype._error,c._complete=s?function(){try{s()}catch(l){e.error(l)}finally{this.unsubscribe()}}:i.prototype._complete,c}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;i.prototype.unsubscribe.call(this),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}(Yo);var gc=function(i){return i&&typeof i.length=="number"&&typeof i!="function"};function xc(i){return rt(i?.then)}function _c(i){return rt(i[Yi])}function yc(i){return Symbol.asyncIterator&&rt(i?.[Symbol.asyncIterator])}function bc(i){return new TypeError("You provided "+(i!==null&&typeof i=="object"?"an invalid object":"'"+i+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function uE(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var vc=uE();function Tc(i){return rt(i?.[vc])}function Sc(i){return hT(this,arguments,function(){var e,r,s,o;return lc(this,function(n){switch(n.label){case 0:e=i.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,Nr(e.read())];case 3:return r=n.sent(),s=r.value,o=r.done,o?[4,Nr(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,Nr(s)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function wc(i){return rt(i?.getReader)}function Ue(i){if(i instanceof J)return i;if(i!=null){if(_c(i))return dE(i);if(gc(i))return fE(i);if(xc(i))return pE(i);if(yc(i))return TT(i);if(Tc(i))return mE(i);if(wc(i))return gE(i)}throw bc(i)}function dE(i){return new J(function(t){var e=i[Yi]();if(rt(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function fE(i){return new J(function(t){for(var e=0;e<i.length&&!t.closed;e++)t.next(i[e]);t.complete()})}function pE(i){return new J(function(t){i.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,fc)})}function mE(i){return new J(function(t){var e,r;try{for(var s=Lr(i),o=s.next();!o.done;o=s.next()){var n=o.value;if(t.next(n),t.closed)return}}catch(a){e={error:a}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}t.complete()})}function TT(i){return new J(function(t){xE(i,t).catch(function(e){return t.error(e)})})}function gE(i){return TT(Sc(i))}function xE(i,t){var e,r,s,o;return lT(this,void 0,void 0,function(){var n,a;return lc(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),e=uT(i),c.label=1;case 1:return[4,e.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(n=r.value,t.next(n),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),s={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=e.return)?[4,o.call(e)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function pe(i,t,e,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var o=t.schedule(function(){e(),s?i.add(this.schedule(null,r)):this.unsubscribe()},r);if(i.add(o),!s)return o}function Pc(i,t){return t===void 0&&(t=0),Fe(function(e,r){e.subscribe(Wr(r,function(s){return pe(r,i,function(){return r.next(s)},t)},function(){return pe(r,i,function(){return r.complete()},t)},function(s){return pe(r,i,function(){return r.error(s)},t)}))})}function Ec(i,t){return t===void 0&&(t=0),Fe(function(e,r){r.add(i.schedule(function(){return e.subscribe(r)},t))})}function ST(i,t){return Ue(i).pipe(Ec(t),Pc(t))}function wT(i,t){return Ue(i).pipe(Ec(t),Pc(t))}function PT(i,t){return new J(function(e){var r=0;return t.schedule(function(){r===i.length?e.complete():(e.next(i[r++]),e.closed||this.schedule())})})}function ET(i,t){return new J(function(e){var r;return pe(e,t,function(){r=i[vc](),pe(e,t,function(){var s,o,n;try{s=r.next(),o=s.value,n=s.done}catch(a){e.error(a);return}n?e.complete():e.next(o)},0,!0)}),function(){return rt(r?.return)&&r.return()}})}function Ac(i,t){if(!i)throw new Error("Iterable cannot be null");return new J(function(e){pe(e,t,function(){var r=i[Symbol.asyncIterator]();pe(e,t,function(){r.next().then(function(s){s.done?e.complete():e.next(s.value)})},0,!0)})})}function AT(i,t){return Ac(Sc(i),t)}function CT(i,t){if(i!=null){if(_c(i))return ST(i,t);if(gc(i))return PT(i,t);if(xc(i))return wT(i,t);if(yc(i))return Ac(i,t);if(Tc(i))return ET(i,t);if(wc(i))return AT(i,t)}throw bc(i)}function Rt(i,t){return t?CT(i,t):Ue(i)}function MT(i,t){return Fe(function(e,r){var s=0;e.subscribe(Wr(r,function(o){r.next(i.call(t,o,s++))}))})}function BT(i,t,e,r,s,o,n,a){var c=[],l=0,h=0,u=!1,d=function(){u&&!c.length&&!l&&t.complete()},f=function(g){return l<r?p(g):c.push(g)},p=function(g){o&&t.next(g),l++;var _=!1;Ue(e(g,h++)).subscribe(Wr(t,function(b){s?.(b),o?f(b):t.next(b)},function(){_=!0},void 0,function(){if(_)try{l--;for(var b=function(){var y=c.shift();n?pe(t,n,function(){return p(y)}):p(y)};c.length&&l<r;)b();d()}catch(y){t.error(y)}}))};return i.subscribe(Wr(t,f,function(){u=!0,d()})),function(){a?.()}}function wt(i,t,e){return e===void 0&&(e=1/0),rt(t)?wt(function(r,s){return MT(function(o,n){return t(r,o,s,n)})(Ue(i(r,s)))},e):(typeof t=="number"&&(e=t),Fe(function(r,s){return BT(r,s,i,e)}))}function Ko(i){return Fe(function(t,e){try{t.subscribe(e)}finally{e.add(i)}})}var _E=i=>i.split("/").pop(),vd=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:_E(t),r=this.bufferMap[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}}async testParse(t){return!0}async parse(t){if(t instanceof M)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new M.from(r)}async unload(t){t.destroy(!0)}},Td=class i extends nc{static rendererName="pixi";_app;_audioStage=new cc;_state={elements:[]};_eventHandler;_plugins;_currentSubscription;_advancedLoader;get canvas(){return this._app.canvas}init=async t=>{let{eventHandler:e,plugins:r,width:s,height:o,backgroundColor:n}=t;for(let c of r)if(c.rendererName!==i.rendererName)throw new Error("Plugin does not match renderer name");this._plugins=r,this._eventHandler=e,this._app=new Za,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new jt;return a.rect(0,0,s,o),a.fill(n||0),this._app.stage.addChild(a),this._app.stage.width=s,this._app.stage.height=o,this._app.ticker.add(this._app.audioStage.tick),this};destroy=()=>{this._app.audioStage.destroy(),this._app.destroy()};_classifyAsset=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":"texture":"texture";loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={audio:{},font:{},texture:{}};for(let[s,o]of Object.entries(t)){let n=this._classifyAsset(o.type);e[n][s]=o}await Promise.all(Object.entries(e.audio).map(([s,o])=>Vi.load(s,o.buffer))),await Promise.all(Object.entries(e.font).map(async([s,o])=>{let n=new Blob([o.buffer],{type:o.type}),a=URL.createObjectURL(n),c=new FontFace(s,`url(${a})`);try{await c.load(),document.fonts.add(c),console.log(`Font loaded successfully: ${s}`)}catch(l){console.error(`Failed to load font ${s}:`,l)}finally{URL.revokeObjectURL(a)}})),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e.texture):(this._advancedLoader=new vd(e.texture),ve.loader.parsers.length=0,ve.reset(),G.add({name:"advanced-buffer-loader",extension:x.Asset,priority:Et.High,loader:this._advancedLoader}),typeof ve.registerPlugin=="function"&&ve.registerPlugin(this._advancedLoader));let r=Object.keys(e.texture);return Promise.all(r.map(s=>ve.load(s)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return Vi.load(e,s)}));updatedBackgroundColor=t=>{this._app.renderer.background.color=t};render=t=>{this._render(this._app,this._app.stage,this._state,t,this._eventHandler),this._state=t};_getRendererByElement=t=>{for(let e of this._plugins)if(e.rendererType===t.type)return e;throw new Error(`No renderer found for element type: ${t.type}`)};_getTransitionByType=t=>{for(let e of this._plugins)if(e.transitionType===t)return e;throw new Error(`No transition found for transition type: ${t}`)};_render=async(t,e,r,s,o)=>{let n=Date.now(),{toAddElements:a,toUpdateElements:c,toDeleteElements:l}=ac(r.elements,s.elements),h=[];for(let u of l){let d=this._getRendererByElement(u);h.push(d.remove(t,{parent:e,element:u,transitions:s.transitions,getRendererByElement:this._getRendererByElement,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of a){let d=this._getRendererByElement(u);h.push(d.add(t,{parent:e,element:u,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of c){let d=this._getRendererByElement(u.next);h.push(d.update(t,{parent:e,prevElement:u.prev,nextElement:u.next,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}this._currentSubscription&&(this._currentSubscription.closed||this._currentSubscription.unsubscribe()),this._currentSubscription=Rt(h).pipe(wt(u=>u),Ko(()=>{t.stage.children.sort((u,d)=>{let f=s.elements.find(g=>g.id===u.label),p=s.elements.find(g=>g.id===d.label);if(f&&p){let g=f.zIndex??0,_=p.zIndex??0;if(g!==_)return g-_;let b=s.elements.findIndex(v=>v.id===u.label),y=s.elements.findIndex(v=>v.id===d.label);return b-y}if(!f&&!p)return 0;if(!f)return-1;if(!p)return 1}),o&&o("completed",{id:s.id,diffTime:Date.now()-n}),this._currentSubscription=void 0})).subscribe({error:u=>{console.error("Error:",u)}})}},RT=Td;var Sd=class extends dr{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=(t,e)=>new J(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=o.url?M.from(o.url):M.EMPTY,h,u,d=o.scaleX??1,f=o.scaleY??1;o.hoverUrl&&(h=M.from(o.hoverUrl)),o.clickUrl&&(u=M.from(o.clickUrl));let p=new zt(l);p.label=o.id,(o.eventName||o.hoverUrl||o.clickUrl)&&(p.cursor="pointer",p.eventMode="static"),o.width!==void 0?p.width=o.width*d:p.width*=d,o.height!==void 0?p.height=o.height*f:p.height*=f,o.anchorX!==void 0&&(p.pivot.x=p.width*o.anchorX),o.anchorY!==void 0&&(p.pivot.y=p.height*o.anchorY),o.rotation!==void 0&&(p.rotation=o.rotation*Math.PI/180),o.x!==void 0&&(p.x=o.x),o.y!==void 0&&(p.y=o.y),o.zIndex!==void 0&&(p.zIndex=o.zIndex),o.alpha!==void 0&&(p.alpha=o.alpha),(h||u)&&p.on("pointerup",()=>{p.texture=l}).on("pointerupoutside",()=>{p.texture=l}).on("pointerleave",()=>{p.texture=l}),u&&p.on("pointerdown",()=>{p.texture=u}),h&&p.on("pointerenter",()=>{p.texture=h}),p.on("pointerup",b=>{b.stopPropagation();let y=b.button;y===0?c&&c(o.eventName,o.eventPayload):y===2&&(o.rightClickEventName&&c?c(o.rightClickEventName):t.stage.emit("rightclick",event))});let g=[];for(let b of n)if(b.elementId===o.id&&b.event===Bt.Add){let y=a(b.type);if(!y)throw new Error(`Transition class not found for type ${b.type}`);g.push(y.add(t,p,b))}s.addChild(p);let _=Rt(g).pipe(wt(b=>b)).subscribe({error:b=>{console.error("Error:",b)},complete:()=>r.complete()});return()=>{_.unsubscribe()}});remove=(t,e)=>new J(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Sprite with id ${o.id} not found`);let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Bt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=Rt(l).pipe(wt(u=>u)).subscribe({error:u=>{console.error("Error:",u)},complete:()=>{r.complete(),c&&c.destroy()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a})=>new J(c=>{let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);let h=[];for(let f of o)if(f.elementId===r.id&&f.event===Bt.Update){let p=n(f.type);if(!p)throw new Error(`Transition class not found for type ${f.type}`);h.push(p.add(t,l,f))}if(h.length>0){let f=Rt(h).pipe(wt(p=>p)).subscribe({error:p=>{console.error("Error:",p)},complete:()=>{u(),c.complete()}});return()=>{f.unsubscribe()}}else return d(),c.complete(),()=>{};function u(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let _=M.from(s.url);if(l.texture=_,!r.url&&s.url)if(_.baseTexture.valid){let b=s.scaleX??1,y=s.scaleY??1;l.width=(s.width??_.width)*b,l.height=(s.height??_.height)*y}else _.baseTexture.once("loaded",()=>{let b=s.scaleX??1,y=s.scaleY??1;l.width=(s.width??_.width)*b,l.height=(s.height??_.height)*y})}let p=r.hoverUrl||r.clickUrl,g=s.hoverUrl||s.clickUrl;if(!p&&g){let _=l.texture;l.on("pointerup",()=>{l.texture=_}).on("pointerupoutside",()=>{l.texture=_}).on("pointerleave",()=>{l.texture=_})}if(s.hoverUrl){let _=M.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=_})}if(s.clickUrl){let _=M.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=_})}}(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="pointer",l.eventMode="static")}function d(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let y=M.from(s.url);if(l.texture=y,!r.url&&s.url)if(y.baseTexture.valid){let v=s.scaleX??1,S=s.scaleY??1;l.width=(s.width??y.width)*v,l.height=(s.height??y.height)*S}else y.baseTexture.once("loaded",()=>{let v=s.scaleX??1,S=s.scaleY??1;l.width=(s.width??y.width)*v,l.height=(s.height??y.height)*S})}let _=r.hoverUrl||r.clickUrl,b=s.hoverUrl||s.clickUrl;if(!_&&b){let y=l.texture;l.on("pointerup",()=>{l.texture=y}).on("pointerupoutside",()=>{l.texture=y}).on("pointerleave",()=>{l.texture=y})}if(s.hoverUrl){let y=M.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=y})}if(s.clickUrl){let y=M.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=y})}}s.x!==void 0&&s.x!==r.x&&(l.x=s.x),s.y!==void 0&&s.y!==r.y&&(l.y=s.y),s.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180);let p=s.scaleX??1,g=s.scaleY??1;s.width!==void 0&&(s.width!==r.width||p!==(r.scaleX??1))&&(l.width=s.width*p),s.height!==void 0&&(s.height!==r.height||g!==(r.scaleY??1))&&(l.height=s.height*g),s.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=l.width*s.anchorX/p),s.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=l.height*s.anchorY/g),s.zIndex!==void 0&&s.zIndex!==r.zIndex&&(l.zIndex=s.zIndex),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="pointer",l.eventMode="static")}})};var Cc=i=>new St({wordWrap:i.wordWrap||!0,breakWords:i.breakWords||!1,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),wd=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=(t,e)=>new J(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=Cc(o.style),h=new ur({text:o.text,style:l}),u;o.hoverStyle&&(u=Cc(o.hoverStyle));let d;if(o.clickedStyle&&(d=Cc(o.clickedStyle)),(o.eventName||o.clickedStyle||o.hoverStyle)&&(h.cursor="pointer",h.eventMode="static"),h.label=o.id,o.x!==void 0&&(h.x=o.x),o.y!==void 0&&(h.y=o.y),o.anchorX!==void 0&&(h.anchor.x=o.anchorX),o.anchorY!==void 0&&(h.anchor.y=o.anchorY),o.anchorX!==void 0||o.anchorY!==void 0){let g=h.getLocalBounds();h.hitArea=new z(-g.width*h.anchor.x,-g.height*h.anchor.y,g.width,g.height)}h.on("pointerupoutside",()=>{h.style=l}).on("pointerup",()=>{h.style=l}).on("pointerleave",()=>{h.style=l}),h.on("pointerup",g=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),g.stopPropagation(),c&&c(o.eventName,o.eventPayload)}),d&&h.on("pointerdown",()=>{h.style=d}),u&&h.on("pointerenter",()=>{h.style=u,o.hoverSoundUrl&&t.soundStage&&o.hoverSoundVolume!==void 0&&t.soundStage.add({id:`${o.id}-hover-${Math.random()}`,url:o.hoverSoundUrl,loop:!1,volume:o.hoverSoundVolume/100})});let f=[];for(let g of n)if(g.elementId===o.id&&g.event===Bt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,h,g))}s.addChild(h);let p=Rt(f).pipe(wt(g=>g)).subscribe({error:g=>{console.error("Error:",g),r.error(g)},complete:()=>r.complete()});return()=>{p.unsubscribe()}});remove=(t,e)=>new J(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c){console.warn(`Text with id ${o.id} not found`),r.complete();return}let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Bt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=Rt(l).pipe(wt(u=>u)).subscribe({error:u=>{console.error("Error:",u),r.error(u)},complete:()=>{c.destroy(),r.complete()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,e)=>new J(r=>{let{parent:s,prevElement:o,nextElement:n,transitions:a,getTransitionByType:c,eventHandler:l}=e,h=s.getChildByName(o.id);if(!h){console.warn(`Text with id ${o.id} not found`),r.complete();return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:c,eventHandler:l}),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:c})],d=Rt(u).pipe(wt(f=>f)).subscribe({error:f=>{console.error("Error:",f),r.error(f)},complete:()=>r.complete()});return()=>{d.unsubscribe()}}else o.text!==n.text&&(h.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(h.style=Cc(n?.style)),n.x!==void 0&&(h.x=n.x),n.y!==void 0&&(h.y=n.y),r.complete();return()=>{}})};var Ki=(i,t=!1)=>new St({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Pd=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=Ki(r.style,r.text),o=new ur({text:"",style:s});o.label=r.id,o.text_id=r.text;let n=new at;r.x!==void 0&&(n.x=r.x),r.y!==void 0&&(n.y=r.y),n.addChild(o),n.label=r.id,e.addChild(n);let a=r.style.wordWrapWidth||500,c=r.text?[{text:r.text,style:r.style}]:r.segments,l=[],h=[],u=0,d=0,f=0;for(;;){let T=c[0];if(!T){h.length>0&&l.push({lineParts:h,y:d});break}if(d>1e4)break;let w={...T.style,wordWrapWidth:a-u},A=Ct.measureText(T.text,Ki(w));A.lineHeight>f&&(f=A.lineHeight);let R=Ct.measureText("a",Ki(w)),I=Ct.measureText("a a",Ki(w)).width-R.width*2;if(A.lineWidths[0]+u>a){u=0,l.push({lineParts:h,y:d}),d+=f,f=0,h=[];continue}let L=A.lines[0],Y=A.lines.slice(1).join(" "),ht={text:L,style:w,x:u,y:0};if(h.push(ht),Y&&Y.length>0?T.text=Y:c.shift(),!(!L||L.length===0)){if(T.furigana){let Ft=Ct.measureText(T.furigana.text,Ki(T.furigana.style)),N={text:T.furigana.text,style:T.furigana.style,x:u+(A.width-Ft.width)/2,y:-10};h.push(N)}u+=A.lineWidths[0]+I}}l.forEach(T=>{let w=new at;w.y=T.y,w.alpha=0,T.lineParts.forEach(A=>{let R=new ur({text:A.text,style:Ki(A.style),x:A.x,y:A.y});w.addChild(R)}),n.addChild(w)});let p=new jt,g=1e3,_=a/2,b=a/2;p.fill({color:16777215,alpha:1}),p.rect(0,0,_,g);for(let T=0;T<b;T++)p.fill({color:16777215,alpha:1-T/b}),p.rect(_+T,0,_+1,g);let y=t.renderer.generateTexture(p),v=new zt(y);v.x=-1.35*_-b,t.stage.addChild(v);let S=0,P=1;if(l.length!==0){if(r.displaySpeed===100||r.hasEnded){n.children.forEach(T=>{t.stage.removeChild(v),T.mask=null,T.alpha=1});return}await new Promise(T=>{let w=A=>{if(P>n.children.length){T();return}n.getChildAt(P).mask||(n.getChildAt(P).mask=v,n.getChildAt(P).alpha=1),S+=A.deltaMS;let C=(r.displaySpeed||50)/1e3;v.x+=C*S,v.x>=0&&(n.getChildAt(P).mask=null,v.x=-1.35*_-b,P=P+1,S=0,P>=n.children.length&&(n.getChildAt(P-1).mask=null,t.ticker.remove(w),T()))};t.ticker.add(w)})}};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Text with id ${s.id} not found`,{parent:r});return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Bt.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o}=e;if(!r.getChildByName(s.id)){console.warn(`Text with id ${s.id} not found`,{parent:r});return}await this.remove(t,{parent:r,element:s}),await this.add(t,{parent:r,element:o})}};var Ed=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=(t,e)=>new J(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,getRendererByElement:c,eventHandler:l}=e,h=structuredClone(o),u=new at;u.label=h.id;let d={};h.x!==void 0&&(typeof h.x=="string"&&h.x.endsWith("%")?u.x=Number(h.x.replace("%",""))*t.screen.width/100:u.x=h.x),h.y!==void 0&&(typeof h.y=="string"&&h.y.endsWith("%")?u.y=Number(h.y.replace("%",""))*t.screen.height/100:u.y=h.y),h.scaleX!==void 0&&(u.scale.x=h.scaleX),h.scaleY!==void 0&&(u.scale.y=h.scaleY),h.zIndex!==void 0&&(u.zIndex=h.zIndex),h.rotation!==void 0&&(u.rotation=h.rotation*Math.PI/180),h.propagateEvents&&(u.eventMode="static",["pointerup","pointerupoutside","pointerleave","pointerdown","pointerenter"].forEach(P=>{u.on(P,T=>{T.stopPropagation();for(let w of u.children)w.emit(P)})}));let f=h.gap||0,p=new jt().roundRect(0,0,h.width||0,h.height||0,1).fill(h.fill?h.fill.color:"transparent"),g=[0,.5,1],_=h.anchorX??0,b=h.anchorY??0;if(!g.includes(_))throw new Error(`Invalid anchorX value: ${_}. Must be 0, 0.5, or 1`);if(!g.includes(b))throw new Error(`Invalid anchorY value: ${b}. Must be 0, 0.5, or 1`);if(h.direction){let P,T;h.direction==="horizontal"?(P=h.children.reduce((A,R)=>A+R.width+f,0),T=h.children.reduce((A,R)=>Math.max(A,R.height||0),0)):h.direction==="vertical"&&(P=h.children.reduce((A,R)=>Math.max(A,R.width||0),0),T=h.children.reduce((A,R)=>A+R.height+f,0));let w={x:_,y:b};h.direction==="horizontal"?this.layoutChildren({element:h,anchor:w,totalWidth:P,totalHeight:T,gap:f,direction:"horizontal",scroll:h.scroll}):h.direction==="vertical"&&this.layoutChildren({element:h,anchor:w,totalWidth:P,totalHeight:T,gap:f,direction:"vertical",scroll:h.scroll}),this.setupScrolling({container:u,element:h,totalHeight:T,totalWidth:P,eventHandler:l,sliderRef:d}),p=this.createContainerGraphic(h,P,T,w)}p.label=`${h.id}-container-background`,u.addChild(p);let y=[];(h.children||[]).forEach(P=>{let T=c(P),w=h.width||0,A=h.height||0,R=_*w,C=b*A,I={zIndex:h.zIndex,...P,x:(P.x||0)+R,y:(P.y||0)+C};y.push(T.add(t,{parent:u,element:I,transitions:n,getTransitionByType:a,getRendererByElement:c,eventHandler:l}))});let v=[];for(let P of n)if(P.elementId===h.id&&P.event===Bt.Add){let T=a(P.type);if(!T)throw new Error(`Transition class not found for type ${P.type}`);v.push(T.add(t,u,P))}s.addChild(u);let S=Rt(y).pipe(wt(P=>P)).subscribe({error:P=>{console.error("Error:",P)},complete:()=>{let{width:P,height:T}=this.getContainerDimensions(h,u),w=_*P,A=b*T;u.pivot.x=w,u.pivot.y=A,r.complete()}});return()=>{S.unsubscribe()}});remove=(t,e)=>(console.log("remove container 11111111111"),new J(r=>{let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}return n.destroy(),()=>{n.destroy()}}));update=(t,e)=>new J(r=>{let{parent:s,prevElement:o,nextElement:n,getRendererByElement:a,transitions:c=[],getTransitionByType:l,eventHandler:h}=e,u=structuredClone(o),d=structuredClone(n),f=s.getChildByName(u.id);if(!f){console.warn(`Container with id ${u.id} not found`);return}d.x!==void 0&&d.x!==u.x&&(f.x=d.x),d.y!==void 0&&d.y!==u.y&&(f.y=d.y),d.rotation!==void 0&&d.rotation!==u.rotation&&(f.rotation=d.rotation*Math.PI/180);let p=[0,.5,1],g=d.anchorX??0,_=d.anchorY??0;if(!p.includes(g))throw new Error(`Invalid anchorX value: ${g}. Must be 0, 0.5, or 1`);if(!p.includes(_))throw new Error(`Invalid anchorY value: ${_}. Must be 0, 0.5, or 1`);if(d.direction){let P=d.gap||0,T,w;d.direction==="horizontal"?(T=d.children.reduce((C,I)=>C+I.width+P,0),w=d.children.reduce((C,I)=>Math.max(C,I.height||0),0)):d.direction==="vertical"&&(T=d.children.reduce((C,I)=>Math.max(C,I.width||0),0),w=d.children.reduce((C,I)=>C+I.height+P,0));let A={x:g,y:_};d.direction==="horizontal"?this.layoutChildren({element:d,anchor:A,totalWidth:T,totalHeight:w,gap:P,direction:"horizontal",scroll:d.scroll}):d.direction==="vertical"&&this.layoutChildren({element:d,anchor:A,totalWidth:T,totalHeight:w,gap:P,direction:"vertical",scroll:d.scroll});let R=f.children.find(C=>C.label===`${d.id}-container-background`);if(R){R.destroy();let C=this.createContainerGraphic(d,T,w,A);C.label=`${d.id}-container-background`,f.addChildAt(C,0)}u.scroll!==d.scroll&&this.setupScrolling({container:f,element:d,totalHeight:w,totalWidth:T,eventHandler:h,sliderRef:{}})}let b=[],{toAddElements:y,toUpdateElements:v,toDeleteElements:S}=ac(u.children,d.children);for(let P of S){let T=a(P);b.push(T.remove(t,{parent:f,element:P,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let P of y){let T=a(P),w=d.width||0,A=d.height||0,R=g*w,C=_*A,I={...P,x:(P.x||0)+R,y:(P.y||0)+C};b.push(T.add(t,{parent:f,element:I,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let P of v){let T=a(P.next),w=d.width||0,A=d.height||0,R=g*w,C=_*A,I=u.anchorX??0,L=u.anchorY??0,Y=u.width||0,ht=u.height||0,Ft=I*Y,N=L*ht,F={...P.prev,x:(P.prev.x||0)+Ft,y:(P.prev.y||0)+N},oe={...P.next,x:(P.next.x||0)+R,y:(P.next.y||0)+C};b.push(T.update(t,{parent:f,prevElement:F,nextElement:oe,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}return d.children&&d.children.length>0&&f.children.sort((P,T)=>{let w=d.children.find(R=>R.id===P.label),A=d.children.find(R=>R.id===T.label);if(w&&A){let R=w.zIndex??0,C=A.zIndex??0;if(R!==C)return R-C;let I=d.children.indexOf(w),L=d.children.indexOf(A);return I-L}if(!w&&!A)return 0;if(!w)return-1;if(!A)return 1}),this._currentSubscription=Rt(b).pipe(wt(P=>P),Ko(()=>{let{width:P,height:T}=this.getContainerDimensions(d,f),w=g*P,A=_*T;f.pivot.x=w,f.pivot.y=A,r.complete()})).subscribe({error:P=>{r.error(P),console.error("Error:",P)}}),()=>{this._currentSubscription?.unsubscribe()}});layoutChildren({element:t,anchor:e,totalWidth:r,totalHeight:s,gap:o,direction:n,scroll:a}){let c=n==="horizontal",l=c?"x":"y",h=c?"y":"x",u=c?"width":"height",d=c?"height":"width",f=c?r:s,p=c?s:r,g=c?e.x:e.y,_=c?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<f){let y=0,v=0,S=0,P=0;(t.children||[]).forEach((T,w)=>{y>0&&y+T[u]>t[u]&&(this.alignRowElements(t.children.slice(P,w),l,g,t[u]),y=0,v+=S+o,S=0,P=w),T[l]=y,T[h]=v,y+=T[u]+o,S=Math.max(S,T[d]||0)}),P<t.children.length&&this.alignRowElements(t.children.slice(P),l,g,t[u])}else{if(g===0){let y=0;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}else if(g===1){let y=-f;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}else if(g===.5){let y=-f/2;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}_===0?(t.children||[]).forEach(y=>{y[h]=0}):_===.5?(t.children||[]).forEach(y=>{y[h]=-p/2}):_===1&&(t.children||[]).forEach(y=>{y[h]=-p})}}alignRowElements(t,e,r,s){if(!t.length)return;let o=t.reduce((n,a,c)=>n+a[e==="x"?"width":"height"]+(c>0,0),0);if(r===.5){let a=(s-o)/2;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}else if(r===1){let a=s-o;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}}createContainerGraphic(t,e,r,s){let o=new jt().roundRect(0,0,e,r,1).fill(t.fill?t.fill.color:"transparent");return s.x===1&&(o.x-=t.width),s.x===.5&&(o.x-=t.width/2),s.y===1&&(o.y-=t.height),s.y===.5&&(o.y-=t.height/2),o}getContainerDimensions(t,e){let r=t.width||0,s=t.height||0;if(!t.direction&&(!t.width||!t.height)&&e.children&&e.children.length>0){let o=1/0,n=-1/0,a=1/0,c=-1/0;e.children.forEach(l=>{let h=l.x||0,u=l.y||0,d=l.width||0,f=l.height||0;o=Math.min(o,h),n=Math.max(n,h+d),a=Math.min(a,u),c=Math.max(c,u+f)}),t.width||(r=n-o,(isNaN(r)||!isFinite(r))&&(r=0)),t.height||(s=c-a,(isNaN(s)||!isFinite(s))&&(s=0))}return{width:r,height:s}}setupScrolling({container:t,element:e,totalHeight:r,totalWidth:s,eventHandler:o,sliderRef:n}){let a=e.scroll&&e.height&&r>e.height,c=e.scroll&&e.width&&s>e.width;if(a||c){let l=0,h=0,u=-r+e.height,d=-s+e.width,f=new jt().rect(0,0,e.width||s,e.height||r).fill("red");t.mask=f,t.eventMode="static",t.addChild(f),t.on("wheel",p=>{if(a&&p.deltaY!==0&&(l-p.deltaY>0||l-p.deltaY<u||(l-=p.deltaY,t.y-=p.deltaY,f.y+=p.deltaY)),c&&(p.deltaX!==0||p.shiftKey&&p.deltaY!==0)){let g=p.deltaX!==0?p.deltaX:p.deltaY;if(h-g>0||h-g<d)return;h-=g,t.x-=g,f.x+=g}})}}};var yE={linear:i=>i},bE=(i,t,e,r)=>i+(t-i)*yE[r](e);function IT(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r}function GT(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i}var vE=(i,t)=>{let e=[],r=0,s;i.forEach(({value:n,duration:a,easing:c,relative:l},h)=>{h===0?(s=n,e.push({time:r,value:n,easing:"linear"})):a!==void 0&&c!==void 0&&(r+=a,l?s=s+n:s=n,e.push({time:r,value:s,easing:c}))});let o=0;for(let n=0;n<e.length-1;n++){let{time:a,value:c,easing:l}=e[n],{time:h,value:u}=e[n+1];if(t>=a&&t<=h){let d=(t-a)/(h-a);o=bE(c,u,d,l);break}else t>h&&(o=u)}return o};function TE(i){return Math.max.apply(null,i)}var Ad=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=(t,e,r)=>new J(s=>{let{properties:o}=r,n=Array.isArray(o)?o:Object.entries(o).map(([d,f])=>({...f,property:d})),a=n.map(d=>d.keyframes.reduce((f,p)=>f+p.duration||0,0)),c=TE(a),l=0,h={};n.forEach(d=>{h[d.property]=IT(e,d.property)});let u=d=>{if(l+=d.deltaMS,l>=c){t.ticker.remove(u),s.complete();return}let f={};n.forEach(p=>{let g=[];p.initialValue!==void 0?g=[{value:p.initialValue,duration:0}]:g=[{value:h[p.property],duration:0}],g=g.concat(p.keyframes),GT(f,p.property,vE(g,l))}),n.forEach(p=>{let{property:g}=p;e&&!e.destroyed&>(e,g,IT(f,g))})};return t.ticker.add(u),()=>{t.ticker.remove(u),u({deltaMS:c-l})}});add=(t,e,r)=>this._transition(t,e,r);remove=(t,e,r)=>this._transition(t,e,r)};var Cd=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=(t,e)=>new J(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=new jt;l.label=o.id,o.x!==void 0&&(l.x=o.x),o.y!==void 0&&(l.y=o.y),o.alpha!==void 0&&(l.alpha=o.alpha),o.scaleX!==void 0&&(l.scale.x=o.scaleX),o.scaleY!==void 0&&(l.scale.y=o.scaleY),o.rotation!==void 0&&(l.rotation=o.rotation*Math.PI/180);let h=o.width,u=o.height;l.rect(0,0,h,u),l.fill(o.fill),o.anchorX!==void 0&&(l.pivot.x=h*o.anchorX),o.anchorY!==void 0&&(l.pivot.y=u*o.anchorY),(o.clickEventName||o.rightClickEventName)&&c&&(l.eventMode="static",l.on("pointerup",p=>{p.button===0?c(o.clickEventName):p.button===2&&c(o.rightClickEventName)})),o.wheelEventName&&c&&(l.eventMode="static",l.on("wheel",p=>{c(o.wheelEventName,{deltaY:p.deltaY})}));let d=[];for(let p of n)if(p.elementId===o.id&&p.event===Bt.Add){let g=a(p.type);if(!g)throw new Error(`Transition class not found for type ${p.type}`);d.push(g.add(t,l,p))}s.addChild(l);let f=Rt(d).pipe(wt(p=>p)).subscribe({error:p=>{console.error("Error:",p)},complete:()=>r.complete()});return()=>{f.unsubscribe()}});remove=(t,e)=>new J(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Rect with id ${o.id} not found`);let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Bt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=Rt(l).pipe(wt(u=>u)).subscribe({error:u=>{console.error("Error:",u)},complete:()=>{r.complete(),c&&c.destroy()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a})=>new J(c=>{let l=e.getChildByName(r.id);if(!l)throw new Error(`Rect with id ${r.id} not found`);let h=[];for(let u of o)if(u.elementId===r.id&&u.event===Bt.Update){let d=n(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);h.push(d.add(t,l,u))}if(h.length>0){let u=Rt(h).pipe(wt(d=>d)).subscribe({error:d=>{console.error("Error:",d)},complete:()=>{(r.width!==s.width||r.height!==s.height||r.fill!==s.fill)&&(l.clear(),l.rect(0,0,s.width,s.height),l.fill(s.fill)),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY),c.complete()}});return()=>{u.unsubscribe()}}else return r.x!==void 0&&s.x!==r.x&&(l.x=s.x),r.y!==void 0&&s.y!==r.y&&(l.y=s.y),r.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),r.scaleX!==void 0&&s.scaleX!==r.scaleX&&(l.scale.x=s.scaleX),r.scaleY!==void 0&&s.scaleY!==r.scaleY&&(l.scale.y=s.scaleY),r.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180),(r.width!==s.width||r.height!==s.height||r.fill!==s.fill)&&(l.clear(),l.rect(0,0,s.width,s.height),l.fill(s.fill)),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY),c.complete(),()=>{}})};var Md=class extends dr{static rendererName="pixi";rendererName="pixi";rendererType="slider";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o,eventHandler:n,ref:a})=>{let{direction:c,idleThumb:l,hoverThumb:h,idleBar:u,hoverBar:d,dragEndEventName:f,dragEventName:p,dragEventPayload:g,initialValue:_}=r,b={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},y=b[c].axis,v=b[c].size,S=M.from(l),P=M.from(h),T=M.from(u),w=M.from(d),A=new zt({texture:T,anchor:{x:0,y:0}});A.label=r.id;let R=A[v];A.x=r.x||0,A.y=r.y||0;let C=new zt({texture:S,anchor:{x:.5,y:.5}});if(C.y=A.height/2,C.x=A.width/2,C.eventMode="static",C.cursor="pointer",A.eventMode="static",A.cursor="pointer",C.on("pointerdown",Y).on("pointerup",ht).on("pointerupoutside",ht),A.on("pointerdown",I).on("pointerup",L).on("pointerupoutside",L),A.addChild(C),_!==void 0){let F=C[v]/2;C[y]=_/100*(R-C[v])+F}function I(F){C.texture=P,A.texture=w,Ft(F),t.stage.eventMode="static",t.stage.addEventListener("pointermove",Ft)}function L(F){C.texture=S,A.texture=T,Ft(F),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",Ft)}function Y(F){F.stopPropagation(),C.texture=P,A.texture=w,t.stage.eventMode="static",t.stage.addEventListener("pointermove",Ft)}function ht(F){if(C.texture=S,A.texture=T,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",Ft),f){let oe=A.toLocal(F.global)[y],q=C[v]/2;C[y]=Math.max(0+q,Math.min(oe,R-q));let ee=Math.floor((C[y]-q)/(R-C[v])*100),De=JSON.stringify(g);n&&n(f,JSON.parse(De.replace('"{{ value }}"',String(ee))))}}function Ft(F){let oe=A.toLocal(F.global)[y],q=C[v]/2;C[y]=Math.max(0+q,Math.min(oe,R-q));let ee=Math.floor((C[y]-q)/(R-C[v])*100);if(p){let De=JSON.stringify(g);n&&n(p,JSON.parse(De.replace('"{{ value }}"',String(ee))))}return ee}a&&(a.current={updateValue:F=>{let oe=C[v]/2;C[y]=F/100*(R-C[v])+oe}});let N=[];for(let F of s)if(F.elementId===r.id&&F.event===Bt.Add){let oe=o(F.type);if(!oe)throw new Error(`Transition class not found for type ${F.type}`);N.push(oe.add(t,A,F))}e.addChild(A),await Promise.all(N)};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Sprite with id ${s.id} not found`);return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Bt.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>{if(!e.getChildByName(r.id)){console.warn(`Slider with id ${r.id} not found`,{parent:e});return}JSON.stringify(r)!==JSON.stringify(s)&&await Promise.all([this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n,eventHandler:a}),this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a})])}};var Bd=class extends dr{static rendererName="pixi";rendererName="pixi";rendererType="audio";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o})=>{r.delay?setTimeout(()=>{t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})},r.delay):t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})};remove=async(t,e)=>{let{element:r}=e;t.audioStage.remove(r.id)};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n})=>{if(r.url!==s.url||r.volume!==s.volume){let a=t.audioStage.getById(r.id);a&&(a.url=s.url,a.volume=s.volume??1)}}};var Rd=class{constructor(){this.cache=new Map}async load(t){let e=[];for(let[r,s]of Object.entries(t))this.cache.has(r)||e.push([r,s]);e.length>0&&await Promise.all(e.map(async([r,s])=>{let a={buffer:await(await fetch(s.url)).arrayBuffer(),type:s.type};this.cache.set(r,a)}))}getBufferMap(){let t={};for(let[e,r]of this.cache.entries())t[e]=r;return t}clear(){this.cache.clear()}size(){return this.cache.size}has(t){return this.cache.has(t)}},SE=()=>new Rd;var g7=RT;export{Bd as AudioPlugin,Ed as ContainerRendererPlugin,Ad as KeyframeTransitionPlugin,Cd as RectRendererPlugin,Md as SliderRendererPlugin,Sd as SpriteRendererPlugin,wd as TextRendererPlugin,Pd as TextRevealingRendererPlugin,SE as createAssetBufferManager,g7 as default};
|
|
1140
|
+
`,Gi=null,Bo=class{constructor(){Gi||(Gi=URL.createObjectURL(new Blob([Uw],{type:"application/javascript"}))),this.worker=new Worker(Gi)}};Bo.revokeObjectURL=function(){Gi&&(URL.revokeObjectURL(Gi),Gi=null)};var f0=0,Eu,Cu=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 Ri;e.addEventListener("message",r=>{e.terminate(),Ri.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Eu===void 0&&(Eu=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Eu&&(this._createdWorkers++,t=new Bo().worker,t.addEventListener("message",e=>{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 r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[f0]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:f0++,id:r})}},Mu=new Cu;Fe();var Dw=[".jpeg",".jpg",".png",".webp",".avif"],Ow=["image/jpeg","image/png","image/webp","image/avif"];async function Lw(i,t){let e=await O.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Da={name:"loadTextures",extension:{type:x.LoadParser,priority:wt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ce(i,Ow)||le(i,Dw)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Mu.isImageBitmapSupported()?r=await Mu.loadImageBitmap(i,t):r=await Lw(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new jt({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Ci(i),...t.data});return Mi(s,e,i)},unload(i){i.destroy(!0)}};w();zc();Wc();var p0=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Nw=p0.map(i=>`video/${i.substring(1)}`);function Hw(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=zw(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function Ww(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function zw(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var m0={name:"loadVideo",extension:{type:x.LoadParser,name:"loadVideo"},test(i){let t=ce(i,Nw),e=le(i,p0);return t||e},async load(i,t,e){let r={...Vr.defaultOptions,resolution:t.data?.resolution||Ci(i),alphaMode:t.data?.alphaMode||await hn(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(c=>{let l=o[c];l!==void 0&&s.setAttribute(c,l)}),r.muted===!0&&(s.muted=!0),Hw(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let c=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Vr.MIME_TYPES[c]||`video/${c}`}return n.src=i,a&&(n.type=a),new Promise(c=>{let l=async()=>{let h=new Vr({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await Ww(s),c(Mi(h,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};w();Hr();w();Hr();var Oa={extension:{type:x.ResolveParser,name:"resolveTexture"},test:Da.test,parse:i=>({resolution:parseFloat(te.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var g0={extension:{type:x.ResolveParser,priority:-2,name:"resolveJson"},test:i=>te.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Oa.parse};Hr();Qi();sn();var La=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new te,this.loader=new Ua,this.cache=J,this._backgroundLoader=new Ia(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){F("[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,r=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:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=yr(t),s=Lt(t).map(a=>{if(typeof a!="string"){let c=this.resolver.getAlias(a);return c.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(c)?c[0]:c}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,c=0,l=()=>{e?.(++a/c)},h=n.map(u=>{let d=s[u];return c+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(h),r?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(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return J.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=J.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],c=[n.src];n.alias&&c.push(...n.alias),c.forEach(l=>{o[l]=a}),J.set(c,a)}),o}async unload(t){this._initialized||await this.init();let e=Lt(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Lt(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{J.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},xe=new La;k.handleByList(x.LoadParser,xe.loader.parsers).handleByList(x.ResolveParser,xe.resolver.parsers).handleByList(x.CacheParser,xe.cache.parsers).handleByList(x.DetectionParser,xe.detections);k.add(e0,s0,r0,c0,o0,n0,a0,l0,h0,u0,d0,Da,m0,t0,Jv,Oa,g0);var x0={loader:x.LoadParser,resolver:x.ResolveParser,cache:x.CacheParser,detection:x.DetectionParser};k.handle(x.Asset,i=>{let t=i.ref;Object.entries(x0).filter(([e])=>!!t[e]).forEach(([e,r])=>k.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(x0).filter(e=>!!t[e]).forEach(e=>k.remove(t[e]))});Do();dt();rn();var Na=class extends Xe{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:c,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Bt({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),c!==void 0&&(this.height=c)}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,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}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 _0(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(D(W,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Ss();Cr();var ir=class extends Na{constructor(...t){let e=_0(t,"Text");super(e,Tt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=At.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};Fe();bt();et();$c();de();lh();an();Ss();Cr();kt();var Vw=Io(bl(),1);k.add(A_,C_);var Ct={Add:"add",Remove:"remove",Update:"update"},Ha=class{init(t){throw new Error("Method not implemented.")}render(t){throw new Error("Method not implemented.")}},sr=class{rendererName;rendererType;add=async(t,e,r)=>{throw new Error("Method not implemented.")};remove=async(t,e,r)=>{throw new Error("Method not implemented.")};update=async(t,e,r)=>{throw new Error("Method not implemented.")}};var Wa=(i=[],t=[])=>{let e=[],r=[],s=[],o=i.filter(a=>!a.hidden),n=t.filter(a=>!a.hidden);for(let a of o){let c=n.find(l=>l.id===a.id&&l.type===a.type);c?r.push({prev:a,next:c}):e.push(a)}for(let a of n)o.find(l=>l.id===a.id&&l.type===a.type)||s.push(a);for(let a of i){let c=t.find(l=>l.id===a.id&&l.type===a.type);c&&c.hidden&&!a.hidden&&e.push(a)}return{toDeleteElements:e,toUpdateElements:r,toAddElements:s}};var Rr=new(window.AudioContext||window.webkitAudioContext),ki=class i{static loadedAssets={};static load=async(t,e)=>{if(!i.loadedAssets[t]&&e.byteLength!==0)try{let r=await Rr.decodeAudioData(e);i.loadedAssets[t]=r}catch(r){console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}};static getAsset=t=>i.loadedAssets[t]},Bu=class{_audioSource;_gainNode;volume=1;id;url;loop=!1;constructor(t,e){this.id=t,this.url=e.url,this.loop=e.loop||!1,this.volume=e.volume??1,this._gainNode=Rr.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Rr.destination)}play=()=>{let t=ki.getAsset(this.url);if(!t){console.warn("AudioPlayer.play: Asset not found",this.url);return}this._audioSource=Rr.createBufferSource(),this._audioSource.buffer=t,this._audioSource.loop=this.loop,this._gainNode.gain.setValueAtTime(this.volume,Rr.currentTime),this._audioSource.connect(this._gainNode),this._audioSource.start(0)};stop=()=>{this._audioSource&&(this._audioSource.stop(),this._audioSource.disconnect(),this._gainNode.disconnect(),this._gainNode=Rr.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Rr.destination))}},za=class{audioPlayers=[];stageAudios=[];add=t=>{this.stageAudios.push(t)};remove=t=>{this.stageAudios=this.stageAudios.filter(e=>e.id!==t)};getById=t=>this.stageAudios.find(e=>e.id===t);tick=()=>{for(let e of this.stageAudios){let r=this.audioPlayers.find(s=>s.id===e.id);if(!r){let s=new Bu(e.id,{url:e.url,loop:e.loop,volume:e.volume??1});this.audioPlayers.push(s),s.play();return}(r.url!==e.url||r.loop!==e.loop)&&(r.stop(),r.url=e.url,r.loop=e.loop??!1,r.play()),r.volume!==(e.volume??1)&&(r.volume=e.volume??1,r._gainNode.gain.value=r.volume)}let t=[];for(let e of this.audioPlayers)this.stageAudios.find(r=>r.id===e.id)||(e.stop(),t.push(e.id));this.audioPlayers=this.audioPlayers.filter(e=>!t.includes(e.id))};destroy=()=>{for(let t of this.audioPlayers)t.stop();this.audioPlayers=[],this.stageAudios=[]}};var Xw=i=>i.split("/").pop(),Ru=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:Xw(t),r=this.bufferMap[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}}async testParse(t){return!0}async parse(t){if(t instanceof C)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new C.from(r)}async unload(t){t.destroy(!0)}},Gu=class i extends Ha{static rendererName="pixi";_app;_audioStage=new za;_state={elements:[]};_eventHandler;_plugins;_currentAbortController;_advancedLoader;get canvas(){return this._app.canvas}init=async t=>{let{eventHandler:e,plugins:r,width:s,height:o,backgroundColor:n}=t;for(let c of r)if(c.rendererName!==i.rendererName)throw new Error("Plugin does not match renderer name");this._plugins=r,this._eventHandler=e,this._app=new Ga,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new zt;return a.rect(0,0,s,o),a.fill(n||0),this._app.stage.addChild(a),this._app.stage.width=s,this._app.stage.height=o,this._app.ticker.add(this._app.audioStage.tick),this};destroy=()=>{this._app.audioStage.destroy(),this._app.destroy()};_classifyAsset=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":"texture":"texture";loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={audio:{},font:{},texture:{}};for(let[s,o]of Object.entries(t)){let n=this._classifyAsset(o.type);e[n][s]=o}await Promise.all(Object.entries(e.audio).map(([s,o])=>ki.load(s,o.buffer))),await Promise.all(Object.entries(e.font).map(async([s,o])=>{let n=new Blob([o.buffer],{type:o.type}),a=URL.createObjectURL(n),c=new FontFace(s,`url(${a})`);try{await c.load(),document.fonts.add(c),console.log(`Font loaded successfully: ${s}`)}catch(l){console.error(`Failed to load font ${s}:`,l)}finally{URL.revokeObjectURL(a)}})),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e.texture):(this._advancedLoader=new Ru(e.texture),xe.loader.parsers.length=0,xe.reset(),k.add({name:"advanced-buffer-loader",extension:x.Asset,priority:wt.High,loader:this._advancedLoader}),typeof xe.registerPlugin=="function"&&xe.registerPlugin(this._advancedLoader));let r=Object.keys(e.texture);return Promise.all(r.map(s=>xe.load(s)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return ki.load(e,s)}));updatedBackgroundColor=t=>{this._app.renderer.background.color=t};render=t=>{this._render(this._app,this._app.stage,this._state,t,this._eventHandler),this._state=t};_getRendererByElement=t=>{for(let e of this._plugins)if(e.rendererType===t.type)return e;throw new Error(`No renderer found for element type: ${t.type}`)};_getTransitionByType=t=>{for(let e of this._plugins)if(e.transitionType===t)return e;throw new Error(`No transition found for transition type: ${t}`)};_render=async(t,e,r,s,o)=>{let n=Date.now(),{toAddElements:a,toUpdateElements:c,toDeleteElements:l}=Wa(r.elements,s.elements);this._currentAbortController&&this._currentAbortController.abort(),this._currentAbortController=new AbortController;let h=this._currentAbortController.signal,u=[];for(let d of l){let f=this._getRendererByElement(d);u.push(()=>f.remove(t,{parent:e,element:d,transitions:s.transitions,getRendererByElement:this._getRendererByElement,getTransitionByType:this._getTransitionByType,eventHandler:o},h))}for(let d of a){let f=this._getRendererByElement(d);u.push(()=>f.add(t,{parent:e,element:d,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o},h))}for(let d of c){let f=this._getRendererByElement(d.next);u.push(()=>f.update(t,{parent:e,prevElement:d.prev,nextElement:d.next,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o},h))}try{await Promise.all(u.map(d=>d())),t.stage.children.sort((d,f)=>{let m=s.elements.find(g=>g.id===d.label),_=s.elements.find(g=>g.id===f.label);if(m&&_){let g=m.zIndex??0,b=_.zIndex??0;if(g!==b)return g-b;let y=s.elements.findIndex(T=>T.id===d.label),v=s.elements.findIndex(T=>T.id===f.label);return y-v}if(!m&&!_)return 0;if(!m)return-1;if(!_)return 1}),o&&o("completed",{id:s.id,diffTime:Date.now()-n})}catch(d){if(d.name==="AbortError")return;throw console.error("Error:",d),d}finally{this._currentAbortController=void 0}}},y0=Gu;var ku=class extends sr{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=o.url?C.from(o.url):C.EMPTY,h,u,d=o.scaleX??1,f=o.scaleY??1;o.hoverUrl&&(h=C.from(o.hoverUrl)),o.clickUrl&&(u=C.from(o.clickUrl));let m=new Nt(l);m.label=o.id,(o.eventName||o.hoverUrl||o.clickUrl)&&(m.cursor="pointer",m.eventMode="static"),o.width!==void 0?m.width=o.width*d:m.width*=d,o.height!==void 0?m.height=o.height*f:m.height*=f,o.anchorX!==void 0&&(m.pivot.x=m.width*o.anchorX),o.anchorY!==void 0&&(m.pivot.y=m.height*o.anchorY),o.rotation!==void 0&&(m.rotation=o.rotation*Math.PI/180),o.x!==void 0&&(m.x=o.x),o.y!==void 0&&(m.y=o.y),o.zIndex!==void 0&&(m.zIndex=o.zIndex),o.alpha!==void 0&&(m.alpha=o.alpha),(h||u)&&m.on("pointerup",()=>{m.texture=l}).on("pointerupoutside",()=>{m.texture=l}).on("pointerleave",()=>{m.texture=l}),u&&m.on("pointerdown",()=>{m.texture=u}),h&&m.on("pointerenter",()=>{m.texture=h}),m.on("pointerup",g=>{g.stopPropagation();let b=g.button;b===0?c&&c(o.eventName,o.eventPayload):b===2&&(o.rightClickEventName&&c?c(o.rightClickEventName):t.stage.emit("rightclick",event))});let _=[];for(let g of n)if(g.elementId===o.id&&g.event===Ct.Add){let b=a(g.type);if(!b)throw new Error(`Transition class not found for type ${g.type}`);_.push(b.add(t,m,g,r))}s.addChild(m),await Promise.all(_)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Sprite with id ${o.id} not found`);let l=[];for(let h of n)if(h.elementId===o.id&&h.event===Ct.Remove){let u=a(h.type);if(!u)throw new Error(`Transition class not found for type ${h.type}`);l.push(u.remove(t,c,h,r))}await Promise.all(l),c&&c.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a},c)=>{if(c?.aborted)throw new DOMException("Operation aborted","AbortError");let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);let h=[];for(let f of o)if(f.elementId===r.id&&f.event===Ct.Update){let m=n(f.type);if(!m)throw new Error(`Transition class not found for type ${f.type}`);h.push(m.add(t,l,f,c))}h.length>0?(await Promise.all(h),u()):d();function u(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let g=C.from(s.url);if(l.texture=g,!r.url&&s.url)if(g.baseTexture.valid){let b=s.scaleX??1,y=s.scaleY??1;l.width=(s.width??g.width)*b,l.height=(s.height??g.height)*y}else g.baseTexture.once("loaded",()=>{let b=s.scaleX??1,y=s.scaleY??1;l.width=(s.width??g.width)*b,l.height=(s.height??g.height)*y})}let m=r.hoverUrl||r.clickUrl,_=s.hoverUrl||s.clickUrl;if(!m&&_){let g=l.texture;l.on("pointerup",()=>{l.texture=g}).on("pointerupoutside",()=>{l.texture=g}).on("pointerleave",()=>{l.texture=g})}if(s.hoverUrl){let g=C.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=g})}if(s.clickUrl){let g=C.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=g})}}(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="pointer",l.eventMode="static")}function d(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let y=C.from(s.url);if(l.texture=y,!r.url&&s.url)if(y.baseTexture.valid){let v=s.scaleX??1,T=s.scaleY??1;l.width=(s.width??y.width)*v,l.height=(s.height??y.height)*T}else y.baseTexture.once("loaded",()=>{let v=s.scaleX??1,T=s.scaleY??1;l.width=(s.width??y.width)*v,l.height=(s.height??y.height)*T})}let g=r.hoverUrl||r.clickUrl,b=s.hoverUrl||s.clickUrl;if(!g&&b){let y=l.texture;l.on("pointerup",()=>{l.texture=y}).on("pointerupoutside",()=>{l.texture=y}).on("pointerleave",()=>{l.texture=y})}if(s.hoverUrl){let y=C.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=y})}if(s.clickUrl){let y=C.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=y})}}s.x!==void 0&&s.x!==r.x&&(l.x=s.x),s.y!==void 0&&s.y!==r.y&&(l.y=s.y),s.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180);let m=s.scaleX??1,_=s.scaleY??1;s.width!==void 0&&(s.width!==r.width||m!==(r.scaleX??1))&&(l.width=s.width*m),s.height!==void 0&&(s.height!==r.height||_!==(r.scaleY??1))&&(l.height=s.height*_),s.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=l.width*s.anchorX/m),s.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=l.height*s.anchorY/_),s.zIndex!==void 0&&s.zIndex!==r.zIndex&&(l.zIndex=s.zIndex),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="pointer",l.eventMode="static")}}};var Va=i=>new Tt({wordWrap:i.wordWrap||!0,breakWords:i.breakWords||!1,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Iu=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=Va(o.style),h=new ir({text:o.text,style:l}),u;o.hoverStyle&&(u=Va(o.hoverStyle));let d;if(o.clickedStyle&&(d=Va(o.clickedStyle)),(o.eventName||o.clickedStyle||o.hoverStyle)&&(h.cursor="pointer",h.eventMode="static"),h.label=o.id,o.x!==void 0&&(h.x=o.x),o.y!==void 0&&(h.y=o.y),o.anchorX!==void 0&&(h.anchor.x=o.anchorX),o.anchorY!==void 0&&(h.anchor.y=o.anchorY),o.anchorX!==void 0||o.anchorY!==void 0){let m=h.getLocalBounds();h.hitArea=new V(-m.width*h.anchor.x,-m.height*h.anchor.y,m.width,m.height)}h.on("pointerupoutside",()=>{h.style=l}).on("pointerup",()=>{h.style=l}).on("pointerleave",()=>{h.style=l}),h.on("pointerup",m=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),m.stopPropagation(),c&&c(o.eventName,o.eventPayload)}),d&&h.on("pointerdown",()=>{h.style=d}),u&&h.on("pointerenter",()=>{h.style=u,o.hoverSoundUrl&&t.soundStage&&o.hoverSoundVolume!==void 0&&t.soundStage.add({id:`${o.id}-hover-${Math.random()}`,url:o.hoverSoundUrl,loop:!1,volume:o.hoverSoundVolume/100})});let f=[];for(let m of n)if(m.elementId===o.id&&m.event===Ct.Add){let _=a(m.type);if(!_)throw new Error(`Transition class not found for type ${m.type}`);f.push(_.add(t,h,m,r))}s.addChild(h),await Promise.all(f)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c){console.warn(`Text with id ${o.id} not found`);return}let l=[];for(let h of n)if(h.elementId===o.id&&h.event===Ct.Remove){let u=a(h.type);if(!u)throw new Error(`Transition class not found for type ${h.type}`);l.push(u.remove(t,c,h,r))}await Promise.all(l),c&&c.destroy()};update=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,prevElement:o,nextElement:n,transitions:a,getTransitionByType:c,eventHandler:l}=e,h=s.getChildByName(o.id);if(!h){console.warn(`Text with id ${o.id} not found`);return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:c,eventHandler:l},r),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:c},r)];await Promise.all(u)}else o.text!==n.text&&(h.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(h.style=Va(n?.style)),n.x!==void 0&&(h.x=n.x),n.y!==void 0&&(h.y=n.y)}};var Ii=(i,t=!1)=>new Tt({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Fu=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=Ii(r.style,r.text),o=new ir({text:"",style:s});o.label=r.id,o.text_id=r.text;let n=new at;r.x!==void 0&&(n.x=r.x),r.y!==void 0&&(n.y=r.y),n.addChild(o),n.label=r.id,e.addChild(n);let a=r.style.wordWrapWidth||500,c=r.text?[{text:r.text,style:r.style}]:r.segments,l=[],h=[],u=0,d=0,f=0;for(;;){let S=c[0];if(!S){h.length>0&&l.push({lineParts:h,y:d});break}if(d>1e4)break;let P={...S.style,wordWrapWidth:a-u},A=At.measureText(S.text,Ii(P));A.lineHeight>f&&(f=A.lineHeight);let M=At.measureText("a",Ii(P)),B=At.measureText("a a",Ii(P)).width-M.width*2;if(A.lineWidths[0]+u>a){u=0,l.push({lineParts:h,y:d}),d+=f,f=0,h=[];continue}let I=A.lines[0],H=A.lines.slice(1).join(" "),$={text:I,style:P,x:u,y:0};if(h.push($),H&&H.length>0?S.text=H:c.shift(),!(!I||I.length===0)){if(S.furigana){let ot=At.measureText(S.furigana.text,Ii(S.furigana.style)),N={text:S.furigana.text,style:S.furigana.style,x:u+(A.width-ot.width)/2,y:-10};h.push(N)}u+=A.lineWidths[0]+B}}l.forEach(S=>{let P=new at;P.y=S.y,P.alpha=0,S.lineParts.forEach(A=>{let M=new ir({text:A.text,style:Ii(A.style),x:A.x,y:A.y});P.addChild(M)}),n.addChild(P)});let m=new zt,_=1e3,g=a/2,b=a/2;m.fill({color:16777215,alpha:1}),m.rect(0,0,g,_);for(let S=0;S<b;S++)m.fill({color:16777215,alpha:1-S/b}),m.rect(g+S,0,g+1,_);let y=t.renderer.generateTexture(m),v=new Nt(y);v.x=-1.35*g-b,t.stage.addChild(v);let T=0,R=1;if(l.length!==0){if(r.displaySpeed===100||r.hasEnded){n.children.forEach(S=>{t.stage.removeChild(v),S.mask=null,S.alpha=1});return}await new Promise(S=>{let P=A=>{if(R>n.children.length){S();return}n.getChildAt(R).mask||(n.getChildAt(R).mask=v,n.getChildAt(R).alpha=1),T+=A.deltaMS;let E=(r.displaySpeed||50)/1e3;v.x+=E*T,v.x>=0&&(n.getChildAt(R).mask=null,v.x=-1.35*g-b,R=R+1,T=0,R>=n.children.length&&(n.getChildAt(R-1).mask=null,t.ticker.remove(P),S()))};t.ticker.add(P)})}};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Text with id ${s.id} not found`,{parent:r});return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Ct.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o}=e;if(!r.getChildByName(s.id)){console.warn(`Text with id ${s.id} not found`,{parent:r});return}await this.remove(t,{parent:r,element:s}),await this.add(t,{parent:r,element:o})}};var Uu=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,getRendererByElement:c,eventHandler:l}=e,h=structuredClone(o),u=new at;u.label=h.id;let d={};h.x!==void 0&&(typeof h.x=="string"&&h.x.endsWith("%")?u.x=Number(h.x.replace("%",""))*t.screen.width/100:u.x=h.x),h.y!==void 0&&(typeof h.y=="string"&&h.y.endsWith("%")?u.y=Number(h.y.replace("%",""))*t.screen.height/100:u.y=h.y),h.scaleX!==void 0&&(u.scale.x=h.scaleX),h.scaleY!==void 0&&(u.scale.y=h.scaleY),h.zIndex!==void 0&&(u.zIndex=h.zIndex),h.rotation!==void 0&&(u.rotation=h.rotation*Math.PI/180),h.propagateEvents&&(u.eventMode="static",["pointerup","pointerupoutside","pointerleave","pointerdown","pointerenter"].forEach(A=>{u.on(A,M=>{M.stopPropagation();for(let E of u.children)E.emit(A)})}));let f=h.gap||0,m=new zt().roundRect(0,0,h.width||0,h.height||0,1).fill(h.fill?h.fill.color:"transparent"),_=[0,.5,1],g=h.anchorX??0,b=h.anchorY??0;if(!_.includes(g))throw new Error(`Invalid anchorX value: ${g}. Must be 0, 0.5, or 1`);if(!_.includes(b))throw new Error(`Invalid anchorY value: ${b}. Must be 0, 0.5, or 1`);if(h.direction){let A,M;h.direction==="horizontal"?(A=h.children.reduce((B,I)=>B+I.width+f,0),M=h.children.reduce((B,I)=>Math.max(B,I.height||0),0)):h.direction==="vertical"&&(A=h.children.reduce((B,I)=>Math.max(B,I.width||0),0),M=h.children.reduce((B,I)=>B+I.height+f,0));let E={x:g,y:b};h.direction==="horizontal"?this.layoutChildren({element:h,anchor:E,totalWidth:A,totalHeight:M,gap:f,direction:"horizontal",scroll:h.scroll}):h.direction==="vertical"&&this.layoutChildren({element:h,anchor:E,totalWidth:A,totalHeight:M,gap:f,direction:"vertical",scroll:h.scroll}),this.setupScrolling({container:u,element:h,totalHeight:M,totalWidth:A,eventHandler:l,sliderRef:d}),m=this.createContainerGraphic(h,A,M,E)}m.label=`${h.id}-container-background`,u.addChild(m);let y=[];(h.children||[]).forEach(A=>{let M=c(A),E=h.width||0,B=h.height||0,I=g*E,H=b*B,$={zIndex:h.zIndex,...A,x:(A.x||0)+I,y:(A.y||0)+H};y.push(M.add(t,{parent:u,element:$,transitions:n,getTransitionByType:a,getRendererByElement:c,eventHandler:l},r))});let v=[];for(let A of n)if(A.elementId===h.id&&A.event===Ct.Add){let M=a(A.type);if(!M)throw new Error(`Transition class not found for type ${A.type}`);v.push(M.add(t,u,A,r))}s.addChild(u),await Promise.all([...y,...v]);let{width:T,height:R}=this.getContainerDimensions(h,u),S=g*T,P=b*R;u.pivot.x=S,u.pivot.y=P};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");console.log("remove container 11111111111");let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}n.destroy()};update=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,prevElement:o,nextElement:n,getRendererByElement:a,transitions:c=[],getTransitionByType:l,eventHandler:h}=e,u=structuredClone(o),d=structuredClone(n),f=s.getChildByName(u.id);if(!f){console.warn(`Container with id ${u.id} not found`);return}d.x!==void 0&&d.x!==u.x&&(f.x=d.x),d.y!==void 0&&d.y!==u.y&&(f.y=d.y),d.rotation!==void 0&&d.rotation!==u.rotation&&(f.rotation=d.rotation*Math.PI/180);let m=[0,.5,1],_=d.anchorX??0,g=d.anchorY??0;if(!m.includes(_))throw new Error(`Invalid anchorX value: ${_}. Must be 0, 0.5, or 1`);if(!m.includes(g))throw new Error(`Invalid anchorY value: ${g}. Must be 0, 0.5, or 1`);if(d.direction){let M=d.gap||0,E,B;d.direction==="horizontal"?(E=d.children.reduce(($,ot)=>$+ot.width+M,0),B=d.children.reduce(($,ot)=>Math.max($,ot.height||0),0)):d.direction==="vertical"&&(E=d.children.reduce(($,ot)=>Math.max($,ot.width||0),0),B=d.children.reduce(($,ot)=>$+ot.height+M,0));let I={x:_,y:g};d.direction==="horizontal"?this.layoutChildren({element:d,anchor:I,totalWidth:E,totalHeight:B,gap:M,direction:"horizontal",scroll:d.scroll}):d.direction==="vertical"&&this.layoutChildren({element:d,anchor:I,totalWidth:E,totalHeight:B,gap:M,direction:"vertical",scroll:d.scroll});let H=f.children.find($=>$.label===`${d.id}-container-background`);if(H){H.destroy();let $=this.createContainerGraphic(d,E,B,I);$.label=`${d.id}-container-background`,f.addChildAt($,0)}u.scroll!==d.scroll&&this.setupScrolling({container:f,element:d,totalHeight:B,totalWidth:E,eventHandler:h,sliderRef:{}})}let b=[],{toAddElements:y,toUpdateElements:v,toDeleteElements:T}=Wa(u.children,d.children);for(let M of T){let E=a(M);b.push(E.remove(t,{parent:f,element:M,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h},r))}for(let M of y){let E=a(M),B=d.width||0,I=d.height||0,H=_*B,$=g*I,ot={...M,x:(M.x||0)+H,y:(M.y||0)+$};b.push(E.add(t,{parent:f,element:ot,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h},r))}for(let M of v){let E=a(M.next),B=d.width||0,I=d.height||0,H=_*B,$=g*I,ot=u.anchorX??0,N=u.anchorY??0,U=u.width||0,ee=u.height||0,q=ot*U,Ft=N*ee,he={...M.prev,x:(M.prev.x||0)+q,y:(M.prev.y||0)+Ft},or={...M.next,x:(M.next.x||0)+H,y:(M.next.y||0)+$};b.push(E.update(t,{parent:f,prevElement:he,nextElement:or,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h},r))}d.children&&d.children.length>0&&f.children.sort((M,E)=>{let B=d.children.find(H=>H.id===M.label),I=d.children.find(H=>H.id===E.label);if(B&&I){let H=B.zIndex??0,$=I.zIndex??0;if(H!==$)return H-$;let ot=d.children.indexOf(B),N=d.children.indexOf(I);return ot-N}if(!B&&!I)return 0;if(!B)return-1;if(!I)return 1}),await Promise.all(b);let{width:R,height:S}=this.getContainerDimensions(d,f),P=_*R,A=g*S;f.pivot.x=P,f.pivot.y=A};layoutChildren({element:t,anchor:e,totalWidth:r,totalHeight:s,gap:o,direction:n,scroll:a}){let c=n==="horizontal",l=c?"x":"y",h=c?"y":"x",u=c?"width":"height",d=c?"height":"width",f=c?r:s,m=c?s:r,_=c?e.x:e.y,g=c?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<f){let y=0,v=0,T=0,R=0;(t.children||[]).forEach((S,P)=>{y>0&&y+S[u]>t[u]&&(this.alignRowElements(t.children.slice(R,P),l,_,t[u]),y=0,v+=T+o,T=0,R=P),S[l]=y,S[h]=v,y+=S[u]+o,T=Math.max(T,S[d]||0)}),R<t.children.length&&this.alignRowElements(t.children.slice(R),l,_,t[u])}else{if(_===0){let y=0;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}else if(_===1){let y=-f;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}else if(_===.5){let y=-f/2;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}g===0?(t.children||[]).forEach(y=>{y[h]=0}):g===.5?(t.children||[]).forEach(y=>{y[h]=-m/2}):g===1&&(t.children||[]).forEach(y=>{y[h]=-m})}}alignRowElements(t,e,r,s){if(!t.length)return;let o=t.reduce((n,a,c)=>n+a[e==="x"?"width":"height"]+(c>0,0),0);if(r===.5){let a=(s-o)/2;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}else if(r===1){let a=s-o;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}}createContainerGraphic(t,e,r,s){let o=new zt().roundRect(0,0,e,r,1).fill(t.fill?t.fill.color:"transparent");return s.x===1&&(o.x-=t.width),s.x===.5&&(o.x-=t.width/2),s.y===1&&(o.y-=t.height),s.y===.5&&(o.y-=t.height/2),o}getContainerDimensions(t,e){let r=t.width||0,s=t.height||0;if(!t.direction&&(!t.width||!t.height)&&e.children&&e.children.length>0){let o=1/0,n=-1/0,a=1/0,c=-1/0;e.children.forEach(l=>{let h=l.x||0,u=l.y||0,d=l.width||0,f=l.height||0;o=Math.min(o,h),n=Math.max(n,h+d),a=Math.min(a,u),c=Math.max(c,u+f)}),t.width||(r=n-o,(isNaN(r)||!isFinite(r))&&(r=0)),t.height||(s=c-a,(isNaN(s)||!isFinite(s))&&(s=0))}return{width:r,height:s}}setupScrolling({container:t,element:e,totalHeight:r,totalWidth:s,eventHandler:o,sliderRef:n}){let a=e.scroll&&e.height&&r>e.height,c=e.scroll&&e.width&&s>e.width;if(a||c){let l=0,h=0,u=-r+e.height,d=-s+e.width,f=new zt().rect(0,0,e.width||s,e.height||r).fill("red");t.mask=f,t.eventMode="static",t.addChild(f),t.on("wheel",m=>{if(a&&m.deltaY!==0&&(l-m.deltaY>0||l-m.deltaY<u||(l-=m.deltaY,t.y-=m.deltaY,f.y+=m.deltaY)),c&&(m.deltaX!==0||m.shiftKey&&m.deltaY!==0)){let _=m.deltaX!==0?m.deltaX:m.deltaY;if(h-_>0||h-_<d)return;h-=_,t.x-=_,f.x+=_}})}}};var $w={linear:i=>i},Yw=(i,t,e,r)=>i+(t-i)*$w[r](e);function b0(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r}function v0(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i}var jw=(i,t)=>{let e=[],r=0,s;i.forEach(({value:n,duration:a,easing:c,relative:l},h)=>{h===0?(s=n,e.push({time:r,value:n,easing:"linear"})):a!==void 0&&c!==void 0&&(r+=a,l?s=s+n:s=n,e.push({time:r,value:s,easing:c}))});let o=0;for(let n=0;n<e.length-1;n++){let{time:a,value:c,easing:l}=e[n],{time:h,value:u}=e[n+1];if(t>=a&&t<=h){let d=(t-a)/(h-a);o=Yw(c,u,d,l);break}else t>h&&(o=u)}return o};function Kw(i){return Math.max.apply(null,i)}var Du=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=async(t,e,r,s)=>new Promise((o,n)=>{if(s?.aborted){n(new DOMException("Operation aborted","AbortError"));return}let{properties:a}=r,c=Array.isArray(a)?a:Object.entries(a).map(([g,b])=>({...b,property:g})),l=c.map(g=>g.keyframes.reduce((b,y)=>b+y.duration||0,0)),h=Kw(l),u=0,d={};c.forEach(g=>{d[g.property]=b0(e,g.property)});let f=g=>{let b={};c.forEach(y=>{let v=[];y.initialValue!==void 0?v=[{value:y.initialValue,duration:0}]:v=[{value:d[y.property],duration:0}],v=v.concat(y.keyframes),v0(b,y.property,jw(v,g))}),c.forEach(y=>{let{property:v}=y;e&&!e.destroyed&&v0(e,v,b0(b,v))})},m=()=>{t.ticker.remove(_),f(h)};s&&s.addEventListener("abort",()=>{m(),n(new DOMException("Operation aborted","AbortError"))});let _=g=>{if(u+=g.deltaMS,u>=h){t.ticker.remove(_),o();return}f(u)};if(s?.aborted){m(),n(new DOMException("Operation aborted","AbortError"));return}t.ticker.add(_)});add=async(t,e,r,s)=>this._transition(t,e,r,s);remove=async(t,e,r,s)=>this._transition(t,e,r,s)};var Ou=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=new zt;l.label=o.id,o.x!==void 0&&(l.x=o.x),o.y!==void 0&&(l.y=o.y),o.alpha!==void 0&&(l.alpha=o.alpha),o.scaleX!==void 0&&(l.scale.x=o.scaleX),o.scaleY!==void 0&&(l.scale.y=o.scaleY),o.rotation!==void 0&&(l.rotation=o.rotation*Math.PI/180);let h=o.width,u=o.height;l.rect(0,0,h,u),l.fill(o.fill),o.anchorX!==void 0&&(l.pivot.x=h*o.anchorX),o.anchorY!==void 0&&(l.pivot.y=u*o.anchorY),(o.clickEventName||o.rightClickEventName)&&c&&(l.eventMode="static",l.on("pointerup",f=>{f.button===0?c(o.clickEventName):f.button===2&&c(o.rightClickEventName)})),o.wheelEventName&&c&&(l.eventMode="static",l.on("wheel",f=>{c(o.wheelEventName,{deltaY:f.deltaY})}));let d=[];for(let f of n)if(f.elementId===o.id&&f.event===Ct.Add){let m=a(f.type);if(!m)throw new Error(`Transition class not found for type ${f.type}`);d.push(m.add(t,l,f,r))}s.addChild(l),await Promise.all(d)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Rect with id ${o.id} not found`);let l=[];for(let h of n)if(h.elementId===o.id&&h.event===Ct.Remove){let u=a(h.type);if(!u)throw new Error(`Transition class not found for type ${h.type}`);l.push(u.remove(t,c,h,r))}await Promise.all(l),c&&c.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a},c)=>{if(c?.aborted)throw new DOMException("Operation aborted","AbortError");let l=e.getChildByName(r.id);if(!l)throw new Error(`Rect with id ${r.id} not found`);let h=[];for(let u of o)if(u.elementId===r.id&&u.event===Ct.Update){let d=n(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);h.push(d.add(t,l,u,c))}h.length>0?(await Promise.all(h),(r.width!==s.width||r.height!==s.height||r.fill!==s.fill)&&(l.clear(),l.rect(0,0,s.width,s.height),l.fill(s.fill)),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY)):(r.x!==void 0&&s.x!==r.x&&(l.x=s.x),r.y!==void 0&&s.y!==r.y&&(l.y=s.y),r.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),r.scaleX!==void 0&&s.scaleX!==r.scaleX&&(l.scale.x=s.scaleX),r.scaleY!==void 0&&s.scaleY!==r.scaleY&&(l.scale.y=s.scaleY),r.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180),(r.width!==s.width||r.height!==s.height||r.fill!==s.fill)&&(l.clear(),l.rect(0,0,s.width,s.height),l.fill(s.fill)),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY))}};var Lu=class extends sr{static rendererName="pixi";rendererName="pixi";rendererType="slider";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o,eventHandler:n,ref:a})=>{let{direction:c,idleThumb:l,hoverThumb:h,idleBar:u,hoverBar:d,dragEndEventName:f,dragEventName:m,dragEventPayload:_,initialValue:g}=r,b={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},y=b[c].axis,v=b[c].size,T=C.from(l),R=C.from(h),S=C.from(u),P=C.from(d),A=new Nt({texture:S,anchor:{x:0,y:0}});A.label=r.id;let M=A[v];A.x=r.x||0,A.y=r.y||0;let E=new Nt({texture:T,anchor:{x:.5,y:.5}});if(E.y=A.height/2,E.x=A.width/2,E.eventMode="static",E.cursor="pointer",A.eventMode="static",A.cursor="pointer",E.on("pointerdown",H).on("pointerup",$).on("pointerupoutside",$),A.on("pointerdown",B).on("pointerup",I).on("pointerupoutside",I),A.addChild(E),g!==void 0){let U=E[v]/2;E[y]=g/100*(M-E[v])+U}function B(U){E.texture=R,A.texture=P,ot(U),t.stage.eventMode="static",t.stage.addEventListener("pointermove",ot)}function I(U){E.texture=T,A.texture=S,ot(U),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",ot)}function H(U){U.stopPropagation(),E.texture=R,A.texture=P,t.stage.eventMode="static",t.stage.addEventListener("pointermove",ot)}function $(U){if(E.texture=T,A.texture=S,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",ot),f){let ee=A.toLocal(U.global)[y],q=E[v]/2;E[y]=Math.max(0+q,Math.min(ee,M-q));let Ft=Math.floor((E[y]-q)/(M-E[v])*100),he=JSON.stringify(_);n&&n(f,JSON.parse(he.replace('"{{ value }}"',String(Ft))))}}function ot(U){let ee=A.toLocal(U.global)[y],q=E[v]/2;E[y]=Math.max(0+q,Math.min(ee,M-q));let Ft=Math.floor((E[y]-q)/(M-E[v])*100);if(m){let he=JSON.stringify(_);n&&n(m,JSON.parse(he.replace('"{{ value }}"',String(Ft))))}return Ft}a&&(a.current={updateValue:U=>{let ee=E[v]/2;E[y]=U/100*(M-E[v])+ee}});let N=[];for(let U of s)if(U.elementId===r.id&&U.event===Ct.Add){let ee=o(U.type);if(!ee)throw new Error(`Transition class not found for type ${U.type}`);N.push(ee.add(t,A,U))}e.addChild(A),await Promise.all(N)};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Sprite with id ${s.id} not found`);return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Ct.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>{if(!e.getChildByName(r.id)){console.warn(`Slider with id ${r.id} not found`,{parent:e});return}JSON.stringify(r)!==JSON.stringify(s)&&await Promise.all([this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n,eventHandler:a}),this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a})])}};var Nu=class extends sr{static rendererName="pixi";rendererName="pixi";rendererType="audio";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o})=>{r.delay?setTimeout(()=>{t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})},r.delay):t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})};remove=async(t,e)=>{let{element:r}=e;t.audioStage.remove(r.id)};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n})=>{if(r.url!==s.url||r.volume!==s.volume){let a=t.audioStage.getById(r.id);a&&(a.url=s.url,a.volume=s.volume??1)}}};var Hu=class{constructor(){this.cache=new Map}async load(t){let e=[];for(let[r,s]of Object.entries(t))this.cache.has(r)||e.push([r,s]);e.length>0&&await Promise.all(e.map(async([r,s])=>{let a={buffer:await(await fetch(s.url)).arrayBuffer(),type:s.type};this.cache.set(r,a)}))}getBufferMap(){let t={};for(let[e,r]of this.cache.entries())t[e]=r;return t}clear(){this.cache.clear()}size(){return this.cache.size}has(t){return this.cache.has(t)}},qw=()=>new Hu;var tj=y0;export{Nu as AudioPlugin,Uu as ContainerRendererPlugin,Du as KeyframeTransitionPlugin,Ou as RectRendererPlugin,Lu as SliderRendererPlugin,ku as SpriteRendererPlugin,Iu as TextRendererPlugin,Fu as TextRevealingRendererPlugin,qw as createAssetBufferManager,tj as default};
|